rusackas commented on code in PR #43917:
URL: https://github.com/apache/superset/pull/43917#discussion_r4131754889
##########
superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/Styles.ts:
##########
@@ -120,6 +157,27 @@ export const Styles = styled.div<{ isDashboardEditMode:
boolean }>`
table.pvtTable tbody tr th.pvtRowLabel {
Review Comment:
Good catch — `left: 0` wasn't gated at all, so multi-level row headers did
stack on the same edge. Scoped the sticky positioning (`pvtRowLabel`, the
corner cells, `pvtRowTotalLabel`) to the single-row-dimension case; with more
than one it falls back to static like before this PR.
##########
superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.tsx:
##########
@@ -1166,21 +1195,15 @@ export function TableRenderer(props:
TableRendererProps) {
</th>
);
})}
- <th
- className="pvtTotalLabel"
- key="padding"
- onClick={clickHeaderHandler(
- pivotData,
- [],
- rows,
- 0,
- tableOptions.clickRowHeaderCallback,
- false,
- true,
- )}
- >
- {settingsColAttrs.length === 0 ? t('Total') : null}
- </th>
+ {mergeTotalLabel ? null : (
Review Comment:
Right, that rule can't match anymore after the corner-cell merge — removed
it as dead code.
##########
superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.tsx:
##########
@@ -1137,12 +1140,29 @@ export function TableRenderer(props:
TableRendererProps) {
namesMapping,
allowRenderHtml: settingsAllowRenderHtml,
} = settings;
+ // When column attributes are present, renderTableRow gives the last
+ // row-label cell in the body an extra colSpan to absorb the corner
Review Comment:
Fixed — the comment now calls out the subtotal-row case separately, where
the extra span lands on `attrValuePaddingCell` instead of the last label cell.
##########
superset-frontend/plugins/plugin-chart-pivot-table/test/react-pivottable/Styles.test.tsx:
##########
@@ -0,0 +1,201 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import '@testing-library/jest-dom';
+import { render } from '@testing-library/react';
+import { supersetTheme } from '@apache-superset/core/theme';
+import PivotTableChart from '../../src/PivotTableChart';
+import transformProps from '../../src/plugin/transformProps';
+import testData from '../testData';
+import { ProviderWrapper } from '../testHelpers';
+
+test('sticky-positions the row-label column and its corner header cell(s) so
they stay visible while scrolling', () => {
+ const transformedProps = {
+ ...transformProps(testData.withoutColTotals),
+ margin: 32,
+ legacy_order_by: null,
+ order_desc: false,
+ };
+ const { container } = render(
+ ProviderWrapper({
+ children: <PivotTableChart {...transformedProps} />,
+ }),
+ );
+
+ const rowLabelCell = container.querySelector('tbody th.pvtRowLabel');
+ expect(rowLabelCell).toBeInTheDocument();
+ const rowLabelStyle = getComputedStyle(rowLabelCell as Element);
+ expect(rowLabelStyle.position).toBe('sticky');
+ expect(rowLabelStyle.left).toBe('0px');
+
+ // The corner cells above the frozen row-label column (the column
+ // attribute name cell in each column-header row and the row-attribute
+ // name cell in the row-header row) must stick on both axes and paint
+ // over the column labels that scroll underneath them.
+ const cornerCells = [
Review Comment:
Split the corner-cell length check into two separate non-empty assertions
(so either selector going dark on its own fails the test), and switched the
z-index checks to assert the declared value instead of `> 0`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]