@atlaskit/renderer 133.16.4 → 133.16.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/cjs/react/nodes/tableNew.js +95 -2
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/es2019/react/nodes/tableNew.js +95 -2
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/esm/react/nodes/tableNew.js +96 -3
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/types/react/nodes/tableNew.d.ts +16 -0
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 133.16.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`b91c14d4dbad7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b91c14d4dbad7) -
|
|
8
|
+
Editor; Ensure only the first table row can become a sticky header when the rounded table patch is
|
|
9
|
+
enabled
|
|
10
|
+
|
|
11
|
+
Renderer; Patch table body elements to have rounded corners when overridden by consumers
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 133.16.5
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`2e067bdb34b2d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2e067bdb34b2d) -
|
|
20
|
+
Fix a non-resized table inside an Excerpt macro shrinking to only its first columns when rendered
|
|
21
|
+
on a wide or full-width page. Inside a nested renderer (a macro body) a non-resized table's width
|
|
22
|
+
is a default layout cap (e.g. 760px/1800px, or a container-query length) taken from the outer
|
|
23
|
+
renderer's width context, which does not match the macro's own box. Promoting that value to inline
|
|
24
|
+
`!important` made the table ignore the available space and collapse. Under
|
|
25
|
+
`platform_nested_table_style_override_2` the renderer now re-asserts the parent stylesheet's
|
|
26
|
+
intent (`width: 100%`) for these non-resized tables. Explicitly resized tables (with a saved
|
|
27
|
+
width) are excluded and keep their author-chosen width, preserving the PGXT-10226 Include Page
|
|
28
|
+
fix; tables nested inside table cells (PGXT-10294) also remain untouched.
|
|
29
|
+
|
|
3
30
|
## 133.16.4
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
|
@@ -420,10 +420,27 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
420
420
|
* Uses lastComputedStyle (populated during render) rather than reading from
|
|
421
421
|
* element.style, because React may remove properties from the DOM when their
|
|
422
422
|
* values transition to undefined between renders.
|
|
423
|
+
*
|
|
424
|
+
* `platform_nested_table_style_override_2` fixes a follow-up regression where a
|
|
425
|
+
* NON-resized table inside an Excerpt macro (not Excerpt Include) on a
|
|
426
|
+
* wide/full-width page shrinks to only show its first columns in the renderer.
|
|
427
|
+
* Inside a nested renderer (a macro body) a non-resized table's computed width
|
|
428
|
+
* is a default layout cap (760px/1800px, or a `cqw` length for full-page
|
|
429
|
+
* appearances) taken from the outer renderer's width context. That value does
|
|
430
|
+
* not match the macro's own box, so promoting it to inline `!important` makes
|
|
431
|
+
* the table collapse. Such tables have no author-chosen size to preserve, so
|
|
432
|
+
* under this gate we re-assert the parent stylesheet's intent (fill the box:
|
|
433
|
+
* `width: 100%; left: 0`) with inline `!important`.
|
|
434
|
+
*
|
|
435
|
+
* Explicitly resized tables (`tableNode.attrs.width` set) are excluded and keep
|
|
436
|
+
* the original PGXT-10226 behavior: their author-chosen width/left is promoted
|
|
437
|
+
* verbatim so the Include Page macro does not stretch or indent them. The
|
|
438
|
+
* table-cell short-circuit (PGXT-10294) above also still applies.
|
|
423
439
|
*/
|
|
424
440
|
}, {
|
|
425
441
|
key: "applyNestedRendererTableFix",
|
|
426
442
|
value: function applyNestedRendererTableFix() {
|
|
443
|
+
var _this$props$tableNode;
|
|
427
444
|
if (!this.containerRef || !(0, _platformFeatureFlags.fg)('platform_nested_table_style_override')) {
|
|
428
445
|
return;
|
|
429
446
|
}
|
|
@@ -435,6 +452,35 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
435
452
|
left = _this$lastComputedSty.left,
|
|
436
453
|
marginLeft = _this$lastComputedSty.marginLeft;
|
|
437
454
|
var style = this.containerRef.style;
|
|
455
|
+
|
|
456
|
+
// A table is "explicitly resized" when the author set a width on the node.
|
|
457
|
+
// Non-resized tables instead take a default layout cap (e.g. 760px/1800px)
|
|
458
|
+
// derived from the outer renderer's appearance.
|
|
459
|
+
var isExplicitlyResized = Boolean((_this$props$tableNode = this.props.tableNode) === null || _this$props$tableNode === void 0 ? void 0 : _this$props$tableNode.attrs.width);
|
|
460
|
+
if (!isExplicitlyResized && (0, _platformFeatureFlags.fg)('platform_nested_table_style_override_2')) {
|
|
461
|
+
// PGXT-10421: For a NON-resized table inside a nested renderer (e.g. an
|
|
462
|
+
// Excerpt macro body), the computed width is a default layout cap
|
|
463
|
+
// (760px/1800px, or a `cqw` length for full-page appearances) taken from
|
|
464
|
+
// the *outer* renderer's width context. That value does not match the
|
|
465
|
+
// macro's own box, so promoting it to inline `!important` makes the table
|
|
466
|
+
// ignore the available space and collapse to its first columns.
|
|
467
|
+
//
|
|
468
|
+
// These tables have no author-chosen size to preserve, so re-assert the
|
|
469
|
+
// parent stylesheet's intent — fill the available box (`width: 100%`) —
|
|
470
|
+
// with inline `!important` priority so it survives React re-renders and
|
|
471
|
+
// wins over the stylesheet rule that leaks into nested renderers.
|
|
472
|
+
style.setProperty('width', '100%', 'important');
|
|
473
|
+
style.setProperty('max-width', '100%', 'important');
|
|
474
|
+
style.setProperty('left', '0', 'important');
|
|
475
|
+
style.setProperty('margin-left', '0', 'important');
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
// PGXT-10226: An explicitly resized table inside a nested renderer (e.g.
|
|
480
|
+
// Include Page macro) must keep its author-chosen width and position. The
|
|
481
|
+
// parent stylesheet forces `width: 100% !important; left: 0 !important`,
|
|
482
|
+
// which would stretch and indent it, so we promote the component's own
|
|
483
|
+
// computed width/left with inline `!important` to win the cascade.
|
|
438
484
|
style.setProperty('width', width || 'auto', 'important');
|
|
439
485
|
style.setProperty('max-width', '100%', 'important');
|
|
440
486
|
style.setProperty('left', left || 'auto', 'important');
|
|
@@ -803,6 +849,53 @@ var getCellEdgePropsByCellOffset = function getCellEdgePropsByCellOffset(tableNo
|
|
|
803
849
|
});
|
|
804
850
|
return cellEdgePropsByCellOffset;
|
|
805
851
|
};
|
|
852
|
+
var isRenderedTableCell = function isRenderedTableCell(element) {
|
|
853
|
+
var _ref4 = element.props,
|
|
854
|
+
nodeType = _ref4.nodeType;
|
|
855
|
+
return nodeType === 'tableCell' || nodeType === 'tableHeader' || element.type === _tableCell.TableCell || element.type === _tableCell.TableHeader;
|
|
856
|
+
};
|
|
857
|
+
var addTableCellEdgePropsThroughWrappers = function addTableCellEdgePropsThroughWrappers(rows, tableNode, isNumberColumnEnabled) {
|
|
858
|
+
try {
|
|
859
|
+
if (!tableNode) {
|
|
860
|
+
return rows;
|
|
861
|
+
}
|
|
862
|
+
var cellEdgePropsByCellOffset = getCellEdgePropsByCellOffset(tableNode, isNumberColumnEnabled);
|
|
863
|
+
var cellOffset = 0;
|
|
864
|
+
return _react.default.Children.map(rows, function (row, rowIndex) {
|
|
865
|
+
var rowNode = tableNode.child(rowIndex);
|
|
866
|
+
cellOffset += 1;
|
|
867
|
+
var cellIndex = 0;
|
|
868
|
+
var _addEdgePropsToRenderedCells = function addEdgePropsToRenderedCells(element) {
|
|
869
|
+
if (isRenderedTableCell(element)) {
|
|
870
|
+
var cellNode = rowNode.child(cellIndex);
|
|
871
|
+
var edgeProps = cellEdgePropsByCellOffset.get(cellOffset);
|
|
872
|
+
cellIndex += 1;
|
|
873
|
+
cellOffset += cellNode.nodeSize;
|
|
874
|
+
return edgeProps ? /*#__PURE__*/_react.default.cloneElement(element, edgeProps) : element;
|
|
875
|
+
}
|
|
876
|
+
var _ref5 = element.props,
|
|
877
|
+
children = _ref5.children;
|
|
878
|
+
if (children === undefined) {
|
|
879
|
+
return element;
|
|
880
|
+
}
|
|
881
|
+
var childrenWithEdgeProps = _react.default.Children.map(children, function (child) {
|
|
882
|
+
return /*#__PURE__*/_react.default.isValidElement(child) ? _addEdgePropsToRenderedCells(child) : child;
|
|
883
|
+
});
|
|
884
|
+
return /*#__PURE__*/_react.default.cloneElement(element, undefined, childrenWithEdgeProps);
|
|
885
|
+
};
|
|
886
|
+
var rowWithEdgeProps = _addEdgePropsToRenderedCells(row);
|
|
887
|
+
if (cellIndex !== rowNode.childCount) {
|
|
888
|
+
throw new Error('Rendered table row does not match its document node');
|
|
889
|
+
}
|
|
890
|
+
cellOffset += 1;
|
|
891
|
+
return rowWithEdgeProps;
|
|
892
|
+
});
|
|
893
|
+
} catch (_unused) {
|
|
894
|
+
// Renderer can receive malformed historical ADF. If the table shape cannot
|
|
895
|
+
// be described safely, keep rendering without rounded edge metadata.
|
|
896
|
+
return rows;
|
|
897
|
+
}
|
|
898
|
+
};
|
|
806
899
|
var addTableCellEdgeProps = function addTableCellEdgeProps(rows, tableNode, isNumberColumnEnabled) {
|
|
807
900
|
try {
|
|
808
901
|
if (!tableNode) {
|
|
@@ -827,7 +920,7 @@ var addTableCellEdgeProps = function addTableCellEdgeProps(rows, tableNode, isNu
|
|
|
827
920
|
cellOffset += 1;
|
|
828
921
|
return /*#__PURE__*/_react.default.cloneElement(row, undefined, rowChildren);
|
|
829
922
|
});
|
|
830
|
-
} catch (
|
|
923
|
+
} catch (_unused2) {
|
|
831
924
|
// Renderer can receive malformed historical ADF. If the table shape cannot
|
|
832
925
|
// be described safely, keep rendering without rounded edge metadata.
|
|
833
926
|
return rows;
|
|
@@ -923,7 +1016,7 @@ var TableProcessorWithContainerStyles = exports.TableProcessorWithContainerStyle
|
|
|
923
1016
|
return null;
|
|
924
1017
|
}
|
|
925
1018
|
var childrenArray = _react.default.Children.toArray(children);
|
|
926
|
-
var childrenWithTableEdgeProps = (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? addTableCellEdgeProps(childrenArray, tableNode, isNumberColumnEnabled) : childrenArray;
|
|
1019
|
+
var childrenWithTableEdgeProps = (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? (0, _expValEquals.expValEquals)('platform_editor_table_q4_patch_5', 'isEnabled', true) ? addTableCellEdgePropsThroughWrappers(childrenArray, tableNode, isNumberColumnEnabled) : addTableCellEdgeProps(childrenArray, tableNode, isNumberColumnEnabled) : childrenArray;
|
|
927
1020
|
var orderedChildren = (0, _utils.compose)(this.addNumberColumnIndexes, this.addSortableColumn
|
|
928
1021
|
// @ts-expect-error TS2345: Argument of type '(ReactChild | ReactFragment | ReactPortal)[]' is not assignable to parameter of type 'ReactElement<any, string | JSXElementConstructor<any>>[]'
|
|
929
1022
|
)(childrenWithTableEdgeProps);
|
|
@@ -73,7 +73,7 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
73
73
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
74
74
|
var RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
75
75
|
var packageName = "@atlaskit/renderer";
|
|
76
|
-
var packageVersion = "133.16.
|
|
76
|
+
var packageVersion = "133.16.5";
|
|
77
77
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
78
78
|
containerName: 'ak-renderer-wrapper',
|
|
79
79
|
containerType: 'inline-size'
|
|
@@ -10,7 +10,7 @@ import { createCompareNodes, convertProsemirrorTableNodeToArrayOfRows, hasMerged
|
|
|
10
10
|
import { SortOrder } from '@atlaskit/editor-common/types';
|
|
11
11
|
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorMaxWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
12
12
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
|
-
import { TableHeader } from './tableCell';
|
|
13
|
+
import { TableCell, TableHeader } from './tableCell';
|
|
14
14
|
import { StickyTable, tableStickyPadding, OverflowParent } from './table/sticky';
|
|
15
15
|
import { Table } from './table/table';
|
|
16
16
|
import { isCommentAppearance, isFullWidthOrFullPageAppearance, isFullWidthAppearance, isMaxWidthAppearance, isFullPageAppearance } from '../utils/appearance';
|
|
@@ -370,8 +370,25 @@ export class TableContainer extends React.Component {
|
|
|
370
370
|
* Uses lastComputedStyle (populated during render) rather than reading from
|
|
371
371
|
* element.style, because React may remove properties from the DOM when their
|
|
372
372
|
* values transition to undefined between renders.
|
|
373
|
+
*
|
|
374
|
+
* `platform_nested_table_style_override_2` fixes a follow-up regression where a
|
|
375
|
+
* NON-resized table inside an Excerpt macro (not Excerpt Include) on a
|
|
376
|
+
* wide/full-width page shrinks to only show its first columns in the renderer.
|
|
377
|
+
* Inside a nested renderer (a macro body) a non-resized table's computed width
|
|
378
|
+
* is a default layout cap (760px/1800px, or a `cqw` length for full-page
|
|
379
|
+
* appearances) taken from the outer renderer's width context. That value does
|
|
380
|
+
* not match the macro's own box, so promoting it to inline `!important` makes
|
|
381
|
+
* the table collapse. Such tables have no author-chosen size to preserve, so
|
|
382
|
+
* under this gate we re-assert the parent stylesheet's intent (fill the box:
|
|
383
|
+
* `width: 100%; left: 0`) with inline `!important`.
|
|
384
|
+
*
|
|
385
|
+
* Explicitly resized tables (`tableNode.attrs.width` set) are excluded and keep
|
|
386
|
+
* the original PGXT-10226 behavior: their author-chosen width/left is promoted
|
|
387
|
+
* verbatim so the Include Page macro does not stretch or indent them. The
|
|
388
|
+
* table-cell short-circuit (PGXT-10294) above also still applies.
|
|
373
389
|
*/
|
|
374
390
|
applyNestedRendererTableFix() {
|
|
391
|
+
var _this$props$tableNode;
|
|
375
392
|
if (!this.containerRef || !fg('platform_nested_table_style_override')) {
|
|
376
393
|
return;
|
|
377
394
|
}
|
|
@@ -384,6 +401,35 @@ export class TableContainer extends React.Component {
|
|
|
384
401
|
marginLeft
|
|
385
402
|
} = this.lastComputedStyle;
|
|
386
403
|
const style = this.containerRef.style;
|
|
404
|
+
|
|
405
|
+
// A table is "explicitly resized" when the author set a width on the node.
|
|
406
|
+
// Non-resized tables instead take a default layout cap (e.g. 760px/1800px)
|
|
407
|
+
// derived from the outer renderer's appearance.
|
|
408
|
+
const isExplicitlyResized = Boolean((_this$props$tableNode = this.props.tableNode) === null || _this$props$tableNode === void 0 ? void 0 : _this$props$tableNode.attrs.width);
|
|
409
|
+
if (!isExplicitlyResized && fg('platform_nested_table_style_override_2')) {
|
|
410
|
+
// PGXT-10421: For a NON-resized table inside a nested renderer (e.g. an
|
|
411
|
+
// Excerpt macro body), the computed width is a default layout cap
|
|
412
|
+
// (760px/1800px, or a `cqw` length for full-page appearances) taken from
|
|
413
|
+
// the *outer* renderer's width context. That value does not match the
|
|
414
|
+
// macro's own box, so promoting it to inline `!important` makes the table
|
|
415
|
+
// ignore the available space and collapse to its first columns.
|
|
416
|
+
//
|
|
417
|
+
// These tables have no author-chosen size to preserve, so re-assert the
|
|
418
|
+
// parent stylesheet's intent — fill the available box (`width: 100%`) —
|
|
419
|
+
// with inline `!important` priority so it survives React re-renders and
|
|
420
|
+
// wins over the stylesheet rule that leaks into nested renderers.
|
|
421
|
+
style.setProperty('width', '100%', 'important');
|
|
422
|
+
style.setProperty('max-width', '100%', 'important');
|
|
423
|
+
style.setProperty('left', '0', 'important');
|
|
424
|
+
style.setProperty('margin-left', '0', 'important');
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// PGXT-10226: An explicitly resized table inside a nested renderer (e.g.
|
|
429
|
+
// Include Page macro) must keep its author-chosen width and position. The
|
|
430
|
+
// parent stylesheet forces `width: 100% !important; left: 0 !important`,
|
|
431
|
+
// which would stretch and indent it, so we promote the component's own
|
|
432
|
+
// computed width/left with inline `!important` to win the cascade.
|
|
387
433
|
style.setProperty('width', width || 'auto', 'important');
|
|
388
434
|
style.setProperty('max-width', '100%', 'important');
|
|
389
435
|
style.setProperty('left', left || 'auto', 'important');
|
|
@@ -744,6 +790,53 @@ const getCellEdgePropsByCellOffset = (tableNode, isNumberColumnEnabled) => {
|
|
|
744
790
|
});
|
|
745
791
|
return cellEdgePropsByCellOffset;
|
|
746
792
|
};
|
|
793
|
+
const isRenderedTableCell = element => {
|
|
794
|
+
const {
|
|
795
|
+
nodeType
|
|
796
|
+
} = element.props;
|
|
797
|
+
return nodeType === 'tableCell' || nodeType === 'tableHeader' || element.type === TableCell || element.type === TableHeader;
|
|
798
|
+
};
|
|
799
|
+
const addTableCellEdgePropsThroughWrappers = (rows, tableNode, isNumberColumnEnabled) => {
|
|
800
|
+
try {
|
|
801
|
+
if (!tableNode) {
|
|
802
|
+
return rows;
|
|
803
|
+
}
|
|
804
|
+
const cellEdgePropsByCellOffset = getCellEdgePropsByCellOffset(tableNode, isNumberColumnEnabled);
|
|
805
|
+
let cellOffset = 0;
|
|
806
|
+
return React.Children.map(rows, (row, rowIndex) => {
|
|
807
|
+
const rowNode = tableNode.child(rowIndex);
|
|
808
|
+
cellOffset += 1;
|
|
809
|
+
let cellIndex = 0;
|
|
810
|
+
const addEdgePropsToRenderedCells = element => {
|
|
811
|
+
if (isRenderedTableCell(element)) {
|
|
812
|
+
const cellNode = rowNode.child(cellIndex);
|
|
813
|
+
const edgeProps = cellEdgePropsByCellOffset.get(cellOffset);
|
|
814
|
+
cellIndex += 1;
|
|
815
|
+
cellOffset += cellNode.nodeSize;
|
|
816
|
+
return edgeProps ? /*#__PURE__*/React.cloneElement(element, edgeProps) : element;
|
|
817
|
+
}
|
|
818
|
+
const {
|
|
819
|
+
children
|
|
820
|
+
} = element.props;
|
|
821
|
+
if (children === undefined) {
|
|
822
|
+
return element;
|
|
823
|
+
}
|
|
824
|
+
const childrenWithEdgeProps = React.Children.map(children, child => /*#__PURE__*/React.isValidElement(child) ? addEdgePropsToRenderedCells(child) : child);
|
|
825
|
+
return /*#__PURE__*/React.cloneElement(element, undefined, childrenWithEdgeProps);
|
|
826
|
+
};
|
|
827
|
+
const rowWithEdgeProps = addEdgePropsToRenderedCells(row);
|
|
828
|
+
if (cellIndex !== rowNode.childCount) {
|
|
829
|
+
throw new Error('Rendered table row does not match its document node');
|
|
830
|
+
}
|
|
831
|
+
cellOffset += 1;
|
|
832
|
+
return rowWithEdgeProps;
|
|
833
|
+
});
|
|
834
|
+
} catch {
|
|
835
|
+
// Renderer can receive malformed historical ADF. If the table shape cannot
|
|
836
|
+
// be described safely, keep rendering without rounded edge metadata.
|
|
837
|
+
return rows;
|
|
838
|
+
}
|
|
839
|
+
};
|
|
747
840
|
const addTableCellEdgeProps = (rows, tableNode, isNumberColumnEnabled) => {
|
|
748
841
|
try {
|
|
749
842
|
if (!tableNode) {
|
|
@@ -860,7 +953,7 @@ export class TableProcessorWithContainerStyles extends React.Component {
|
|
|
860
953
|
return null;
|
|
861
954
|
}
|
|
862
955
|
const childrenArray = React.Children.toArray(children);
|
|
863
|
-
const childrenWithTableEdgeProps = expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? addTableCellEdgeProps(childrenArray, tableNode, isNumberColumnEnabled) : childrenArray;
|
|
956
|
+
const childrenWithTableEdgeProps = expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? expValEquals('platform_editor_table_q4_patch_5', 'isEnabled', true) ? addTableCellEdgePropsThroughWrappers(childrenArray, tableNode, isNumberColumnEnabled) : addTableCellEdgeProps(childrenArray, tableNode, isNumberColumnEnabled) : childrenArray;
|
|
864
957
|
const orderedChildren = compose(this.addNumberColumnIndexes, this.addSortableColumn
|
|
865
958
|
// @ts-expect-error TS2345: Argument of type '(ReactChild | ReactFragment | ReactPortal)[]' is not assignable to parameter of type 'ReactElement<any, string | JSXElementConstructor<any>>[]'
|
|
866
959
|
)(childrenWithTableEdgeProps);
|
|
@@ -59,7 +59,7 @@ export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
59
59
|
const TABLE_INFO_TIMEOUT = 10000;
|
|
60
60
|
const RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
61
61
|
const packageName = "@atlaskit/renderer";
|
|
62
|
-
const packageVersion = "133.16.
|
|
62
|
+
const packageVersion = "133.16.5";
|
|
63
63
|
const setAsQueryContainerStyles = css({
|
|
64
64
|
containerName: 'ak-renderer-wrapper',
|
|
65
65
|
containerType: 'inline-size'
|
|
@@ -23,7 +23,7 @@ import { createCompareNodes, convertProsemirrorTableNodeToArrayOfRows, hasMerged
|
|
|
23
23
|
import { SortOrder } from '@atlaskit/editor-common/types';
|
|
24
24
|
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorMaxWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
25
25
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
26
|
-
import { TableHeader } from './tableCell';
|
|
26
|
+
import { TableCell, TableHeader } from './tableCell';
|
|
27
27
|
import { StickyTable, tableStickyPadding, OverflowParent } from './table/sticky';
|
|
28
28
|
import { Table } from './table/table';
|
|
29
29
|
import { isCommentAppearance, isFullWidthOrFullPageAppearance, isFullWidthAppearance, isMaxWidthAppearance, isFullPageAppearance } from '../utils/appearance';
|
|
@@ -414,10 +414,27 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
414
414
|
* Uses lastComputedStyle (populated during render) rather than reading from
|
|
415
415
|
* element.style, because React may remove properties from the DOM when their
|
|
416
416
|
* values transition to undefined between renders.
|
|
417
|
+
*
|
|
418
|
+
* `platform_nested_table_style_override_2` fixes a follow-up regression where a
|
|
419
|
+
* NON-resized table inside an Excerpt macro (not Excerpt Include) on a
|
|
420
|
+
* wide/full-width page shrinks to only show its first columns in the renderer.
|
|
421
|
+
* Inside a nested renderer (a macro body) a non-resized table's computed width
|
|
422
|
+
* is a default layout cap (760px/1800px, or a `cqw` length for full-page
|
|
423
|
+
* appearances) taken from the outer renderer's width context. That value does
|
|
424
|
+
* not match the macro's own box, so promoting it to inline `!important` makes
|
|
425
|
+
* the table collapse. Such tables have no author-chosen size to preserve, so
|
|
426
|
+
* under this gate we re-assert the parent stylesheet's intent (fill the box:
|
|
427
|
+
* `width: 100%; left: 0`) with inline `!important`.
|
|
428
|
+
*
|
|
429
|
+
* Explicitly resized tables (`tableNode.attrs.width` set) are excluded and keep
|
|
430
|
+
* the original PGXT-10226 behavior: their author-chosen width/left is promoted
|
|
431
|
+
* verbatim so the Include Page macro does not stretch or indent them. The
|
|
432
|
+
* table-cell short-circuit (PGXT-10294) above also still applies.
|
|
417
433
|
*/
|
|
418
434
|
}, {
|
|
419
435
|
key: "applyNestedRendererTableFix",
|
|
420
436
|
value: function applyNestedRendererTableFix() {
|
|
437
|
+
var _this$props$tableNode;
|
|
421
438
|
if (!this.containerRef || !fg('platform_nested_table_style_override')) {
|
|
422
439
|
return;
|
|
423
440
|
}
|
|
@@ -429,6 +446,35 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
429
446
|
left = _this$lastComputedSty.left,
|
|
430
447
|
marginLeft = _this$lastComputedSty.marginLeft;
|
|
431
448
|
var style = this.containerRef.style;
|
|
449
|
+
|
|
450
|
+
// A table is "explicitly resized" when the author set a width on the node.
|
|
451
|
+
// Non-resized tables instead take a default layout cap (e.g. 760px/1800px)
|
|
452
|
+
// derived from the outer renderer's appearance.
|
|
453
|
+
var isExplicitlyResized = Boolean((_this$props$tableNode = this.props.tableNode) === null || _this$props$tableNode === void 0 ? void 0 : _this$props$tableNode.attrs.width);
|
|
454
|
+
if (!isExplicitlyResized && fg('platform_nested_table_style_override_2')) {
|
|
455
|
+
// PGXT-10421: For a NON-resized table inside a nested renderer (e.g. an
|
|
456
|
+
// Excerpt macro body), the computed width is a default layout cap
|
|
457
|
+
// (760px/1800px, or a `cqw` length for full-page appearances) taken from
|
|
458
|
+
// the *outer* renderer's width context. That value does not match the
|
|
459
|
+
// macro's own box, so promoting it to inline `!important` makes the table
|
|
460
|
+
// ignore the available space and collapse to its first columns.
|
|
461
|
+
//
|
|
462
|
+
// These tables have no author-chosen size to preserve, so re-assert the
|
|
463
|
+
// parent stylesheet's intent — fill the available box (`width: 100%`) —
|
|
464
|
+
// with inline `!important` priority so it survives React re-renders and
|
|
465
|
+
// wins over the stylesheet rule that leaks into nested renderers.
|
|
466
|
+
style.setProperty('width', '100%', 'important');
|
|
467
|
+
style.setProperty('max-width', '100%', 'important');
|
|
468
|
+
style.setProperty('left', '0', 'important');
|
|
469
|
+
style.setProperty('margin-left', '0', 'important');
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// PGXT-10226: An explicitly resized table inside a nested renderer (e.g.
|
|
474
|
+
// Include Page macro) must keep its author-chosen width and position. The
|
|
475
|
+
// parent stylesheet forces `width: 100% !important; left: 0 !important`,
|
|
476
|
+
// which would stretch and indent it, so we promote the component's own
|
|
477
|
+
// computed width/left with inline `!important` to win the cascade.
|
|
432
478
|
style.setProperty('width', width || 'auto', 'important');
|
|
433
479
|
style.setProperty('max-width', '100%', 'important');
|
|
434
480
|
style.setProperty('left', left || 'auto', 'important');
|
|
@@ -797,6 +843,53 @@ var getCellEdgePropsByCellOffset = function getCellEdgePropsByCellOffset(tableNo
|
|
|
797
843
|
});
|
|
798
844
|
return cellEdgePropsByCellOffset;
|
|
799
845
|
};
|
|
846
|
+
var isRenderedTableCell = function isRenderedTableCell(element) {
|
|
847
|
+
var _ref4 = element.props,
|
|
848
|
+
nodeType = _ref4.nodeType;
|
|
849
|
+
return nodeType === 'tableCell' || nodeType === 'tableHeader' || element.type === TableCell || element.type === TableHeader;
|
|
850
|
+
};
|
|
851
|
+
var addTableCellEdgePropsThroughWrappers = function addTableCellEdgePropsThroughWrappers(rows, tableNode, isNumberColumnEnabled) {
|
|
852
|
+
try {
|
|
853
|
+
if (!tableNode) {
|
|
854
|
+
return rows;
|
|
855
|
+
}
|
|
856
|
+
var cellEdgePropsByCellOffset = getCellEdgePropsByCellOffset(tableNode, isNumberColumnEnabled);
|
|
857
|
+
var cellOffset = 0;
|
|
858
|
+
return React.Children.map(rows, function (row, rowIndex) {
|
|
859
|
+
var rowNode = tableNode.child(rowIndex);
|
|
860
|
+
cellOffset += 1;
|
|
861
|
+
var cellIndex = 0;
|
|
862
|
+
var _addEdgePropsToRenderedCells = function addEdgePropsToRenderedCells(element) {
|
|
863
|
+
if (isRenderedTableCell(element)) {
|
|
864
|
+
var cellNode = rowNode.child(cellIndex);
|
|
865
|
+
var edgeProps = cellEdgePropsByCellOffset.get(cellOffset);
|
|
866
|
+
cellIndex += 1;
|
|
867
|
+
cellOffset += cellNode.nodeSize;
|
|
868
|
+
return edgeProps ? /*#__PURE__*/React.cloneElement(element, edgeProps) : element;
|
|
869
|
+
}
|
|
870
|
+
var _ref5 = element.props,
|
|
871
|
+
children = _ref5.children;
|
|
872
|
+
if (children === undefined) {
|
|
873
|
+
return element;
|
|
874
|
+
}
|
|
875
|
+
var childrenWithEdgeProps = React.Children.map(children, function (child) {
|
|
876
|
+
return /*#__PURE__*/React.isValidElement(child) ? _addEdgePropsToRenderedCells(child) : child;
|
|
877
|
+
});
|
|
878
|
+
return /*#__PURE__*/React.cloneElement(element, undefined, childrenWithEdgeProps);
|
|
879
|
+
};
|
|
880
|
+
var rowWithEdgeProps = _addEdgePropsToRenderedCells(row);
|
|
881
|
+
if (cellIndex !== rowNode.childCount) {
|
|
882
|
+
throw new Error('Rendered table row does not match its document node');
|
|
883
|
+
}
|
|
884
|
+
cellOffset += 1;
|
|
885
|
+
return rowWithEdgeProps;
|
|
886
|
+
});
|
|
887
|
+
} catch (_unused) {
|
|
888
|
+
// Renderer can receive malformed historical ADF. If the table shape cannot
|
|
889
|
+
// be described safely, keep rendering without rounded edge metadata.
|
|
890
|
+
return rows;
|
|
891
|
+
}
|
|
892
|
+
};
|
|
800
893
|
var addTableCellEdgeProps = function addTableCellEdgeProps(rows, tableNode, isNumberColumnEnabled) {
|
|
801
894
|
try {
|
|
802
895
|
if (!tableNode) {
|
|
@@ -821,7 +914,7 @@ var addTableCellEdgeProps = function addTableCellEdgeProps(rows, tableNode, isNu
|
|
|
821
914
|
cellOffset += 1;
|
|
822
915
|
return /*#__PURE__*/React.cloneElement(row, undefined, rowChildren);
|
|
823
916
|
});
|
|
824
|
-
} catch (
|
|
917
|
+
} catch (_unused2) {
|
|
825
918
|
// Renderer can receive malformed historical ADF. If the table shape cannot
|
|
826
919
|
// be described safely, keep rendering without rounded edge metadata.
|
|
827
920
|
return rows;
|
|
@@ -917,7 +1010,7 @@ export var TableProcessorWithContainerStyles = /*#__PURE__*/function (_React$Com
|
|
|
917
1010
|
return null;
|
|
918
1011
|
}
|
|
919
1012
|
var childrenArray = React.Children.toArray(children);
|
|
920
|
-
var childrenWithTableEdgeProps = expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? addTableCellEdgeProps(childrenArray, tableNode, isNumberColumnEnabled) : childrenArray;
|
|
1013
|
+
var childrenWithTableEdgeProps = expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? expValEquals('platform_editor_table_q4_patch_5', 'isEnabled', true) ? addTableCellEdgePropsThroughWrappers(childrenArray, tableNode, isNumberColumnEnabled) : addTableCellEdgeProps(childrenArray, tableNode, isNumberColumnEnabled) : childrenArray;
|
|
921
1014
|
var orderedChildren = compose(this.addNumberColumnIndexes, this.addSortableColumn
|
|
922
1015
|
// @ts-expect-error TS2345: Argument of type '(ReactChild | ReactFragment | ReactPortal)[]' is not assignable to parameter of type 'ReactElement<any, string | JSXElementConstructor<any>>[]'
|
|
923
1016
|
)(childrenWithTableEdgeProps);
|
|
@@ -64,7 +64,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
64
64
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
65
65
|
var RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
66
66
|
var packageName = "@atlaskit/renderer";
|
|
67
|
-
var packageVersion = "133.16.
|
|
67
|
+
var packageVersion = "133.16.5";
|
|
68
68
|
var setAsQueryContainerStyles = css({
|
|
69
69
|
containerName: 'ak-renderer-wrapper',
|
|
70
70
|
containerType: 'inline-size'
|
|
@@ -104,6 +104,22 @@ export declare class TableContainer extends React.Component<TableProps & Overflo
|
|
|
104
104
|
* Uses lastComputedStyle (populated during render) rather than reading from
|
|
105
105
|
* element.style, because React may remove properties from the DOM when their
|
|
106
106
|
* values transition to undefined between renders.
|
|
107
|
+
*
|
|
108
|
+
* `platform_nested_table_style_override_2` fixes a follow-up regression where a
|
|
109
|
+
* NON-resized table inside an Excerpt macro (not Excerpt Include) on a
|
|
110
|
+
* wide/full-width page shrinks to only show its first columns in the renderer.
|
|
111
|
+
* Inside a nested renderer (a macro body) a non-resized table's computed width
|
|
112
|
+
* is a default layout cap (760px/1800px, or a `cqw` length for full-page
|
|
113
|
+
* appearances) taken from the outer renderer's width context. That value does
|
|
114
|
+
* not match the macro's own box, so promoting it to inline `!important` makes
|
|
115
|
+
* the table collapse. Such tables have no author-chosen size to preserve, so
|
|
116
|
+
* under this gate we re-assert the parent stylesheet's intent (fill the box:
|
|
117
|
+
* `width: 100%; left: 0`) with inline `!important`.
|
|
118
|
+
*
|
|
119
|
+
* Explicitly resized tables (`tableNode.attrs.width` set) are excluded and keep
|
|
120
|
+
* the original PGXT-10226 behavior: their author-chosen width/left is promoted
|
|
121
|
+
* verbatim so the Include Page macro does not stretch or indent them. The
|
|
122
|
+
* table-cell short-circuit (PGXT-10294) above also still applies.
|
|
107
123
|
*/
|
|
108
124
|
private applyNestedRendererTableFix;
|
|
109
125
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "133.16.
|
|
3
|
+
"version": "133.16.6",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@atlaskit/status": "^5.7.0",
|
|
69
69
|
"@atlaskit/task-decision": "^21.7.0",
|
|
70
70
|
"@atlaskit/theme": "^26.1.0",
|
|
71
|
-
"@atlaskit/tmp-editor-statsig": "^135.
|
|
71
|
+
"@atlaskit/tmp-editor-statsig": "^135.2.0",
|
|
72
72
|
"@atlaskit/tokens": "^16.3.0",
|
|
73
73
|
"@atlaskit/tooltip": "^23.2.0",
|
|
74
74
|
"@atlaskit/visually-hidden": "^4.2.0",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"uuid": "^3.1.0"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
|
-
"@atlaskit/editor-common": "^116.
|
|
86
|
+
"@atlaskit/editor-common": "^116.42.0",
|
|
87
87
|
"@atlaskit/link-provider": "^5.2.0",
|
|
88
88
|
"@atlaskit/media-core": "^38.0.0",
|
|
89
89
|
"react": "^18.2.0",
|
|
@@ -265,6 +265,9 @@
|
|
|
265
265
|
"platform_nested_table_style_override": {
|
|
266
266
|
"type": "boolean"
|
|
267
267
|
},
|
|
268
|
+
"platform_nested_table_style_override_2": {
|
|
269
|
+
"type": "boolean"
|
|
270
|
+
},
|
|
268
271
|
"platform_editor_table_nested_renderer_fix": {
|
|
269
272
|
"type": "boolean"
|
|
270
273
|
},
|