@atlaskit/renderer 131.1.3 → 131.1.5

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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 131.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 131.1.4
10
+
11
+ ### Patch Changes
12
+
13
+ - [`b40f46a41421d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b40f46a41421d) -
14
+ Fix table indentation and forced 100% width when rendered inside the Include Page macro. Tables
15
+ with custom widths now render at their original resized size without unexpected indentation in
16
+ nested renderers.
17
+ - Updated dependencies
18
+
3
19
  ## 131.1.3
4
20
 
5
21
  ### Patch Changes
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.tableCanBeSticky = exports.shouldHeaderStick = exports.shouldHeaderPinBottom = exports.orderChildren = exports.isTableResizingEnabled = exports.isStickyScrollbarEnabled = exports.isHeaderRowEnabled = exports.hasRowspan = exports.getRefTop = exports.addSortableColumn = exports.TableProcessorWithContainerStyles = exports.TableContainer = exports.RefSyncBlockFakeBorders = void 0;
8
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
8
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
11
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
@@ -16,6 +17,7 @@ var _styles = require("@atlaskit/editor-common/styles");
16
17
  var _nodeWidth = require("@atlaskit/editor-common/node-width");
17
18
  var _style = require("../../ui/Renderer/style");
18
19
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
20
+ var _consts = require("../../consts");
19
21
  var _utils = require("@atlaskit/editor-common/utils");
20
22
  var _types = require("@atlaskit/editor-common/types");
21
23
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
@@ -220,6 +222,11 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
220
222
  (0, _defineProperty2.default)(_this, "wrapperRef", /*#__PURE__*/_react.default.createRef());
221
223
  (0, _defineProperty2.default)(_this, "overflowParent", null);
222
224
  (0, _defineProperty2.default)(_this, "updatedLayout", 'custom');
225
+ (0, _defineProperty2.default)(_this, "containerRef", null);
226
+ (0, _defineProperty2.default)(_this, "_isInsideNestedRenderer", null);
227
+ // Stores the last computed style values from render() for use by applyNestedRendererTableFix().
228
+ // This avoids reading from the DOM which can be stale when React removes properties between renders.
229
+ (0, _defineProperty2.default)(_this, "lastComputedStyle", {});
223
230
  (0, _defineProperty2.default)(_this, "resizeObserver", null);
224
231
  (0, _defineProperty2.default)(_this, "applyResizerChange", function (entries) {
225
232
  var wrapperWidth = _this.state.wrapperWidth;
@@ -247,6 +254,21 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
247
254
  });
248
255
  }
249
256
  });
257
+ /**
258
+ * Callback ref that captures the container DOM element and also forwards
259
+ * to the handleRef prop from the overflow shadow HOC.
260
+ */
261
+ (0, _defineProperty2.default)(_this, "setContainerRef", function (el) {
262
+ _this.containerRef = el;
263
+ var handleRef = _this.props.handleRef;
264
+ if (typeof handleRef === 'function') {
265
+ handleRef(el);
266
+ } else if (handleRef && (0, _typeof2.default)(handleRef) === 'object') {
267
+ // Ignored via go/ees005
268
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
269
+ handleRef.current = el;
270
+ }
271
+ });
250
272
  (0, _defineProperty2.default)(_this, "componentWillUnmount", function () {
251
273
  if (_this.overflowParent) {
252
274
  // Ignored via go/ees005
@@ -322,6 +344,66 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
322
344
  }
323
345
  (0, _inherits2.default)(TableContainer, _React$Component);
324
346
  return (0, _createClass2.default)(TableContainer, [{
347
+ key: "isInsideNestedRenderer",
348
+ value:
349
+ /**
350
+ * Checks if this table is inside a nested renderer (e.g. Include Page macro)
351
+ * by looking for multiple .ak-renderer-document ancestors in the DOM.
352
+ * The result is cached since a table's position in the DOM tree is stable after mount.
353
+ */
354
+ function isInsideNestedRenderer() {
355
+ if (this._isInsideNestedRenderer !== null) {
356
+ return this._isInsideNestedRenderer;
357
+ }
358
+ if (!this.containerRef) {
359
+ return false;
360
+ }
361
+ var docAncestorCount = 0;
362
+ var el = this.containerRef.parentElement;
363
+ while (el) {
364
+ if (el.classList.contains(_consts.RendererCssClassName.DOCUMENT)) {
365
+ docAncestorCount++;
366
+ if (docAncestorCount >= 2) {
367
+ this._isInsideNestedRenderer = true;
368
+ return true;
369
+ }
370
+ }
371
+ el = el.parentElement;
372
+ }
373
+ this._isInsideNestedRenderer = false;
374
+ return false;
375
+ }
376
+
377
+ /**
378
+ * For tables inside nested renderers (e.g. Include Page macro), the parent
379
+ * renderer's CSS override forces width:100%!important and left:0!important
380
+ * which overrides the inline styles set by this component. Using
381
+ * style.setProperty with 'important' priority on inline styles beats
382
+ * stylesheet !important rules per the CSS cascade.
383
+ *
384
+ * Uses lastComputedStyle (populated during render) rather than reading from
385
+ * element.style, because React may remove properties from the DOM when their
386
+ * values transition to undefined between renders.
387
+ */
388
+ }, {
389
+ key: "applyNestedRendererTableFix",
390
+ value: function applyNestedRendererTableFix() {
391
+ if (!this.containerRef || !(0, _platformFeatureFlags.fg)('platform_nested_table_style_override')) {
392
+ return;
393
+ }
394
+ if (!this.isInsideNestedRenderer()) {
395
+ return;
396
+ }
397
+ var _this$lastComputedSty = this.lastComputedStyle,
398
+ width = _this$lastComputedSty.width,
399
+ left = _this$lastComputedSty.left,
400
+ marginLeft = _this$lastComputedSty.marginLeft;
401
+ var style = this.containerRef.style;
402
+ style.setProperty('width', width || 'auto', 'important');
403
+ style.setProperty('left', left || 'auto', 'important');
404
+ style.setProperty('margin-left', marginLeft || '0', 'important');
405
+ }
406
+ }, {
325
407
  key: "componentDidMount",
326
408
  value:
327
409
  /**
@@ -347,6 +429,7 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
347
429
  if (this.wrapperRef.current && isStickyScrollbarEnabled(this.props.rendererAppearance)) {
348
430
  this.stickyScrollbar = new _TableStickyScrollbar.TableStickyScrollbar(this.wrapperRef.current);
349
431
  }
432
+ this.applyNestedRendererTableFix();
350
433
  }
351
434
 
352
435
  /**
@@ -379,6 +462,10 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
379
462
  if (prevState.stickyMode !== this.state.stickyMode) {
380
463
  this.onWrapperScrolled();
381
464
  }
465
+
466
+ // React re-applies the style prop on every render, which overwrites the
467
+ // !important priorities set at mount time. Re-apply after each update.
468
+ this.applyNestedRendererTableFix();
382
469
  }
383
470
  }, {
384
471
  key: "pinTop",
@@ -543,12 +630,21 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
543
630
  left: leftCSS ? "calc(".concat(leftCSS, ")") : undefined,
544
631
  marginLeft: shouldCalculateLeftForAlignment && leftCSS !== undefined ? "calc(-1 * (".concat(leftCSS, "))") : undefined
545
632
  });
633
+
634
+ // Store computed style values for applyNestedRendererTableFix() to use.
635
+ // Reading from props rather than the DOM ensures correctness when React
636
+ // removes properties (transitions from set to undefined) between renders.
637
+ this.lastComputedStyle = {
638
+ width: typeof style.width === 'number' ? "".concat(style.width, "px") : style.width,
639
+ left: style.left,
640
+ marginLeft: style.marginLeft
641
+ };
546
642
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
547
643
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
548
644
  className: "".concat(_styles.TableSharedCssClassName.TABLE_CONTAINER, " ").concat(this.props.shadowClassNames || ''),
549
645
  "data-layout": updatedLayout,
550
646
  "data-testid": "table-container",
551
- ref: this.props.handleRef,
647
+ ref: this.setContainerRef,
552
648
  style: style
553
649
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
554
650
  }, isStickyScrollbarEnabled(this.props.rendererAppearance) && /*#__PURE__*/_react.default.createElement("div", {
@@ -71,7 +71,7 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
71
71
  var TABLE_INFO_TIMEOUT = 10000;
72
72
  var RENDER_EVENT_SAMPLE_RATE = 0.2;
73
73
  var packageName = "@atlaskit/renderer";
74
- var packageVersion = "131.1.2";
74
+ var packageVersion = "131.1.4";
75
75
  var setAsQueryContainerStyles = (0, _react2.css)({
76
76
  containerName: 'ak-renderer-wrapper',
77
77
  containerType: 'inline-size'
@@ -5,6 +5,7 @@ import { TableSharedCssClassName, tableMarginTop } from '@atlaskit/editor-common
5
5
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
6
6
  import { FullPagePadding } from '../../ui/Renderer/style';
7
7
  import { fg } from '@atlaskit/platform-feature-flags';
8
+ import { RendererCssClassName } from '../../consts';
8
9
  import { createCompareNodes, convertProsemirrorTableNodeToArrayOfRows, hasMergedCell, compose } from '@atlaskit/editor-common/utils';
9
10
  import { SortOrder } from '@atlaskit/editor-common/types';
10
11
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorMaxWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
@@ -185,6 +186,11 @@ export class TableContainer extends React.Component {
185
186
  _defineProperty(this, "wrapperRef", /*#__PURE__*/React.createRef());
186
187
  _defineProperty(this, "overflowParent", null);
187
188
  _defineProperty(this, "updatedLayout", 'custom');
189
+ _defineProperty(this, "containerRef", null);
190
+ _defineProperty(this, "_isInsideNestedRenderer", null);
191
+ // Stores the last computed style values from render() for use by applyNestedRendererTableFix().
192
+ // This avoids reading from the DOM which can be stale when React removes properties between renders.
193
+ _defineProperty(this, "lastComputedStyle", {});
188
194
  _defineProperty(this, "resizeObserver", null);
189
195
  _defineProperty(this, "applyResizerChange", entries => {
190
196
  let wrapperWidth = this.state.wrapperWidth;
@@ -203,6 +209,23 @@ export class TableContainer extends React.Component {
203
209
  });
204
210
  }
205
211
  });
212
+ /**
213
+ * Callback ref that captures the container DOM element and also forwards
214
+ * to the handleRef prop from the overflow shadow HOC.
215
+ */
216
+ _defineProperty(this, "setContainerRef", el => {
217
+ this.containerRef = el;
218
+ const {
219
+ handleRef
220
+ } = this.props;
221
+ if (typeof handleRef === 'function') {
222
+ handleRef(el);
223
+ } else if (handleRef && typeof handleRef === 'object') {
224
+ // Ignored via go/ees005
225
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
226
+ handleRef.current = el;
227
+ }
228
+ });
206
229
  _defineProperty(this, "componentWillUnmount", () => {
207
230
  if (this.overflowParent) {
208
231
  // Ignored via go/ees005
@@ -277,6 +300,62 @@ export class TableContainer extends React.Component {
277
300
  });
278
301
  });
279
302
  }
303
+ /**
304
+ * Checks if this table is inside a nested renderer (e.g. Include Page macro)
305
+ * by looking for multiple .ak-renderer-document ancestors in the DOM.
306
+ * The result is cached since a table's position in the DOM tree is stable after mount.
307
+ */
308
+ isInsideNestedRenderer() {
309
+ if (this._isInsideNestedRenderer !== null) {
310
+ return this._isInsideNestedRenderer;
311
+ }
312
+ if (!this.containerRef) {
313
+ return false;
314
+ }
315
+ let docAncestorCount = 0;
316
+ let el = this.containerRef.parentElement;
317
+ while (el) {
318
+ if (el.classList.contains(RendererCssClassName.DOCUMENT)) {
319
+ docAncestorCount++;
320
+ if (docAncestorCount >= 2) {
321
+ this._isInsideNestedRenderer = true;
322
+ return true;
323
+ }
324
+ }
325
+ el = el.parentElement;
326
+ }
327
+ this._isInsideNestedRenderer = false;
328
+ return false;
329
+ }
330
+
331
+ /**
332
+ * For tables inside nested renderers (e.g. Include Page macro), the parent
333
+ * renderer's CSS override forces width:100%!important and left:0!important
334
+ * which overrides the inline styles set by this component. Using
335
+ * style.setProperty with 'important' priority on inline styles beats
336
+ * stylesheet !important rules per the CSS cascade.
337
+ *
338
+ * Uses lastComputedStyle (populated during render) rather than reading from
339
+ * element.style, because React may remove properties from the DOM when their
340
+ * values transition to undefined between renders.
341
+ */
342
+ applyNestedRendererTableFix() {
343
+ if (!this.containerRef || !fg('platform_nested_table_style_override')) {
344
+ return;
345
+ }
346
+ if (!this.isInsideNestedRenderer()) {
347
+ return;
348
+ }
349
+ const {
350
+ width,
351
+ left,
352
+ marginLeft
353
+ } = this.lastComputedStyle;
354
+ const style = this.containerRef.style;
355
+ style.setProperty('width', width || 'auto', 'important');
356
+ style.setProperty('left', left || 'auto', 'important');
357
+ style.setProperty('margin-left', marginLeft || '0', 'important');
358
+ }
280
359
  /**
281
360
  * Starts observing table dimensions and wires sticky header/scrollbar behavior after mount.
282
361
  *
@@ -300,6 +379,7 @@ export class TableContainer extends React.Component {
300
379
  if (this.wrapperRef.current && isStickyScrollbarEnabled(this.props.rendererAppearance)) {
301
380
  this.stickyScrollbar = new TableStickyScrollbar(this.wrapperRef.current);
302
381
  }
382
+ this.applyNestedRendererTableFix();
303
383
  }
304
384
 
305
385
  /**
@@ -330,6 +410,10 @@ export class TableContainer extends React.Component {
330
410
  if (prevState.stickyMode !== this.state.stickyMode) {
331
411
  this.onWrapperScrolled();
332
412
  }
413
+
414
+ // React re-applies the style prop on every render, which overwrites the
415
+ // !important priorities set at mount time. Re-apply after each update.
416
+ this.applyNestedRendererTableFix();
333
417
  }
334
418
  /**
335
419
  * Calculates the top offset used when the sticky header is pinned to the table bottom.
@@ -489,12 +573,21 @@ export class TableContainer extends React.Component {
489
573
  left: leftCSS ? `calc(${leftCSS})` : undefined,
490
574
  marginLeft: shouldCalculateLeftForAlignment && leftCSS !== undefined ? `calc(-1 * (${leftCSS}))` : undefined
491
575
  };
576
+
577
+ // Store computed style values for applyNestedRendererTableFix() to use.
578
+ // Reading from props rather than the DOM ensures correctness when React
579
+ // removes properties (transitions from set to undefined) between renders.
580
+ this.lastComputedStyle = {
581
+ width: typeof style.width === 'number' ? `${style.width}px` : style.width,
582
+ left: style.left,
583
+ marginLeft: style.marginLeft
584
+ };
492
585
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
493
586
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
494
587
  className: `${TableSharedCssClassName.TABLE_CONTAINER} ${this.props.shadowClassNames || ''}`,
495
588
  "data-layout": updatedLayout,
496
589
  "data-testid": "table-container",
497
- ref: this.props.handleRef,
590
+ ref: this.setContainerRef,
498
591
  style: style
499
592
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
500
593
  }, isStickyScrollbarEnabled(this.props.rendererAppearance) && /*#__PURE__*/React.createElement("div", {
@@ -57,7 +57,7 @@ export const DEGRADED_SEVERITY_THRESHOLD = 3000;
57
57
  const TABLE_INFO_TIMEOUT = 10000;
58
58
  const RENDER_EVENT_SAMPLE_RATE = 0.2;
59
59
  const packageName = "@atlaskit/renderer";
60
- const packageVersion = "131.1.2";
60
+ const packageVersion = "131.1.4";
61
61
  const setAsQueryContainerStyles = css({
62
62
  containerName: 'ak-renderer-wrapper',
63
63
  containerType: 'inline-size'
@@ -1,3 +1,4 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
1
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
3
  import _createClass from "@babel/runtime/helpers/createClass";
3
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
@@ -17,6 +18,7 @@ import { TableSharedCssClassName, tableMarginTop } from '@atlaskit/editor-common
17
18
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
18
19
  import { FullPagePadding } from '../../ui/Renderer/style';
19
20
  import { fg } from '@atlaskit/platform-feature-flags';
21
+ import { RendererCssClassName } from '../../consts';
20
22
  import { createCompareNodes, convertProsemirrorTableNodeToArrayOfRows, hasMergedCell, compose } from '@atlaskit/editor-common/utils';
21
23
  import { SortOrder } from '@atlaskit/editor-common/types';
22
24
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorMaxWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
@@ -214,6 +216,11 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
214
216
  _defineProperty(_this, "wrapperRef", /*#__PURE__*/React.createRef());
215
217
  _defineProperty(_this, "overflowParent", null);
216
218
  _defineProperty(_this, "updatedLayout", 'custom');
219
+ _defineProperty(_this, "containerRef", null);
220
+ _defineProperty(_this, "_isInsideNestedRenderer", null);
221
+ // Stores the last computed style values from render() for use by applyNestedRendererTableFix().
222
+ // This avoids reading from the DOM which can be stale when React removes properties between renders.
223
+ _defineProperty(_this, "lastComputedStyle", {});
217
224
  _defineProperty(_this, "resizeObserver", null);
218
225
  _defineProperty(_this, "applyResizerChange", function (entries) {
219
226
  var wrapperWidth = _this.state.wrapperWidth;
@@ -241,6 +248,21 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
241
248
  });
242
249
  }
243
250
  });
251
+ /**
252
+ * Callback ref that captures the container DOM element and also forwards
253
+ * to the handleRef prop from the overflow shadow HOC.
254
+ */
255
+ _defineProperty(_this, "setContainerRef", function (el) {
256
+ _this.containerRef = el;
257
+ var handleRef = _this.props.handleRef;
258
+ if (typeof handleRef === 'function') {
259
+ handleRef(el);
260
+ } else if (handleRef && _typeof(handleRef) === 'object') {
261
+ // Ignored via go/ees005
262
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
263
+ handleRef.current = el;
264
+ }
265
+ });
244
266
  _defineProperty(_this, "componentWillUnmount", function () {
245
267
  if (_this.overflowParent) {
246
268
  // Ignored via go/ees005
@@ -316,6 +338,66 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
316
338
  }
317
339
  _inherits(TableContainer, _React$Component);
318
340
  return _createClass(TableContainer, [{
341
+ key: "isInsideNestedRenderer",
342
+ value:
343
+ /**
344
+ * Checks if this table is inside a nested renderer (e.g. Include Page macro)
345
+ * by looking for multiple .ak-renderer-document ancestors in the DOM.
346
+ * The result is cached since a table's position in the DOM tree is stable after mount.
347
+ */
348
+ function isInsideNestedRenderer() {
349
+ if (this._isInsideNestedRenderer !== null) {
350
+ return this._isInsideNestedRenderer;
351
+ }
352
+ if (!this.containerRef) {
353
+ return false;
354
+ }
355
+ var docAncestorCount = 0;
356
+ var el = this.containerRef.parentElement;
357
+ while (el) {
358
+ if (el.classList.contains(RendererCssClassName.DOCUMENT)) {
359
+ docAncestorCount++;
360
+ if (docAncestorCount >= 2) {
361
+ this._isInsideNestedRenderer = true;
362
+ return true;
363
+ }
364
+ }
365
+ el = el.parentElement;
366
+ }
367
+ this._isInsideNestedRenderer = false;
368
+ return false;
369
+ }
370
+
371
+ /**
372
+ * For tables inside nested renderers (e.g. Include Page macro), the parent
373
+ * renderer's CSS override forces width:100%!important and left:0!important
374
+ * which overrides the inline styles set by this component. Using
375
+ * style.setProperty with 'important' priority on inline styles beats
376
+ * stylesheet !important rules per the CSS cascade.
377
+ *
378
+ * Uses lastComputedStyle (populated during render) rather than reading from
379
+ * element.style, because React may remove properties from the DOM when their
380
+ * values transition to undefined between renders.
381
+ */
382
+ }, {
383
+ key: "applyNestedRendererTableFix",
384
+ value: function applyNestedRendererTableFix() {
385
+ if (!this.containerRef || !fg('platform_nested_table_style_override')) {
386
+ return;
387
+ }
388
+ if (!this.isInsideNestedRenderer()) {
389
+ return;
390
+ }
391
+ var _this$lastComputedSty = this.lastComputedStyle,
392
+ width = _this$lastComputedSty.width,
393
+ left = _this$lastComputedSty.left,
394
+ marginLeft = _this$lastComputedSty.marginLeft;
395
+ var style = this.containerRef.style;
396
+ style.setProperty('width', width || 'auto', 'important');
397
+ style.setProperty('left', left || 'auto', 'important');
398
+ style.setProperty('margin-left', marginLeft || '0', 'important');
399
+ }
400
+ }, {
319
401
  key: "componentDidMount",
320
402
  value:
321
403
  /**
@@ -341,6 +423,7 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
341
423
  if (this.wrapperRef.current && isStickyScrollbarEnabled(this.props.rendererAppearance)) {
342
424
  this.stickyScrollbar = new TableStickyScrollbar(this.wrapperRef.current);
343
425
  }
426
+ this.applyNestedRendererTableFix();
344
427
  }
345
428
 
346
429
  /**
@@ -373,6 +456,10 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
373
456
  if (prevState.stickyMode !== this.state.stickyMode) {
374
457
  this.onWrapperScrolled();
375
458
  }
459
+
460
+ // React re-applies the style prop on every render, which overwrites the
461
+ // !important priorities set at mount time. Re-apply after each update.
462
+ this.applyNestedRendererTableFix();
376
463
  }
377
464
  }, {
378
465
  key: "pinTop",
@@ -537,12 +624,21 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
537
624
  left: leftCSS ? "calc(".concat(leftCSS, ")") : undefined,
538
625
  marginLeft: shouldCalculateLeftForAlignment && leftCSS !== undefined ? "calc(-1 * (".concat(leftCSS, "))") : undefined
539
626
  });
627
+
628
+ // Store computed style values for applyNestedRendererTableFix() to use.
629
+ // Reading from props rather than the DOM ensures correctness when React
630
+ // removes properties (transitions from set to undefined) between renders.
631
+ this.lastComputedStyle = {
632
+ width: typeof style.width === 'number' ? "".concat(style.width, "px") : style.width,
633
+ left: style.left,
634
+ marginLeft: style.marginLeft
635
+ };
540
636
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
541
637
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
542
638
  className: "".concat(TableSharedCssClassName.TABLE_CONTAINER, " ").concat(this.props.shadowClassNames || ''),
543
639
  "data-layout": updatedLayout,
544
640
  "data-testid": "table-container",
545
- ref: this.props.handleRef,
641
+ ref: this.setContainerRef,
546
642
  style: style
547
643
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
548
644
  }, isStickyScrollbarEnabled(this.props.rendererAppearance) && /*#__PURE__*/React.createElement("div", {
@@ -62,7 +62,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
62
62
  var TABLE_INFO_TIMEOUT = 10000;
63
63
  var RENDER_EVENT_SAMPLE_RATE = 0.2;
64
64
  var packageName = "@atlaskit/renderer";
65
- var packageVersion = "131.1.2";
65
+ var packageVersion = "131.1.4";
66
66
  var setAsQueryContainerStyles = css({
67
67
  containerName: 'ak-renderer-wrapper',
68
68
  containerType: 'inline-size'
@@ -67,8 +67,34 @@ export declare class TableContainer extends React.Component<TableProps & Overflo
67
67
  nextFrame: number | undefined;
68
68
  overflowParent: OverflowParent | null;
69
69
  updatedLayout: TableLayout | 'custom';
70
+ private containerRef;
71
+ private _isInsideNestedRenderer;
72
+ private lastComputedStyle;
70
73
  private resizeObserver;
71
74
  private applyResizerChange;
75
+ /**
76
+ * Checks if this table is inside a nested renderer (e.g. Include Page macro)
77
+ * by looking for multiple .ak-renderer-document ancestors in the DOM.
78
+ * The result is cached since a table's position in the DOM tree is stable after mount.
79
+ */
80
+ private isInsideNestedRenderer;
81
+ /**
82
+ * For tables inside nested renderers (e.g. Include Page macro), the parent
83
+ * renderer's CSS override forces width:100%!important and left:0!important
84
+ * which overrides the inline styles set by this component. Using
85
+ * style.setProperty with 'important' priority on inline styles beats
86
+ * stylesheet !important rules per the CSS cascade.
87
+ *
88
+ * Uses lastComputedStyle (populated during render) rather than reading from
89
+ * element.style, because React may remove properties from the DOM when their
90
+ * values transition to undefined between renders.
91
+ */
92
+ private applyNestedRendererTableFix;
93
+ /**
94
+ * Callback ref that captures the container DOM element and also forwards
95
+ * to the handleRef prop from the overflow shadow HOC.
96
+ */
97
+ private setContainerRef;
72
98
  /**
73
99
  * Starts observing table dimensions and wires sticky header/scrollbar behavior after mount.
74
100
  *
@@ -67,8 +67,34 @@ export declare class TableContainer extends React.Component<TableProps & Overflo
67
67
  nextFrame: number | undefined;
68
68
  overflowParent: OverflowParent | null;
69
69
  updatedLayout: TableLayout | 'custom';
70
+ private containerRef;
71
+ private _isInsideNestedRenderer;
72
+ private lastComputedStyle;
70
73
  private resizeObserver;
71
74
  private applyResizerChange;
75
+ /**
76
+ * Checks if this table is inside a nested renderer (e.g. Include Page macro)
77
+ * by looking for multiple .ak-renderer-document ancestors in the DOM.
78
+ * The result is cached since a table's position in the DOM tree is stable after mount.
79
+ */
80
+ private isInsideNestedRenderer;
81
+ /**
82
+ * For tables inside nested renderers (e.g. Include Page macro), the parent
83
+ * renderer's CSS override forces width:100%!important and left:0!important
84
+ * which overrides the inline styles set by this component. Using
85
+ * style.setProperty with 'important' priority on inline styles beats
86
+ * stylesheet !important rules per the CSS cascade.
87
+ *
88
+ * Uses lastComputedStyle (populated during render) rather than reading from
89
+ * element.style, because React may remove properties from the DOM when their
90
+ * values transition to undefined between renders.
91
+ */
92
+ private applyNestedRendererTableFix;
93
+ /**
94
+ * Callback ref that captures the container DOM element and also forwards
95
+ * to the handleRef prop from the overflow shadow HOC.
96
+ */
97
+ private setContainerRef;
72
98
  /**
73
99
  * Starts observing table dimensions and wires sticky header/scrollbar behavior after mount.
74
100
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "131.1.3",
3
+ "version": "131.1.5",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -62,11 +62,11 @@
62
62
  "@atlaskit/platform-feature-flags-react": "^0.5.0",
63
63
  "@atlaskit/pragmatic-drag-and-drop": "^1.8.0",
64
64
  "@atlaskit/react-ufo": "^6.0.0",
65
- "@atlaskit/smart-card": "^44.13.0",
65
+ "@atlaskit/smart-card": "^44.14.0",
66
66
  "@atlaskit/status": "^4.1.0",
67
67
  "@atlaskit/task-decision": "^20.1.0",
68
- "@atlaskit/theme": "^23.2.0",
69
- "@atlaskit/tmp-editor-statsig": "^82.1.0",
68
+ "@atlaskit/theme": "^24.0.0",
69
+ "@atlaskit/tmp-editor-statsig": "^82.3.0",
70
70
  "@atlaskit/tokens": "^13.0.0",
71
71
  "@atlaskit/tooltip": "^22.2.0",
72
72
  "@atlaskit/visually-hidden": "^3.1.0",
@@ -80,7 +80,7 @@
80
80
  "uuid": "^3.1.0"
81
81
  },
82
82
  "peerDependencies": {
83
- "@atlaskit/editor-common": "^114.39.0",
83
+ "@atlaskit/editor-common": "^114.41.0",
84
84
  "@atlaskit/link-provider": "^4.4.0",
85
85
  "@atlaskit/media-core": "^37.1.0",
86
86
  "react": "^18.2.0",
@@ -92,6 +92,7 @@
92
92
  "@af/visual-regression": "workspace:^",
93
93
  "@atlaskit/analytics-gas-types": "^5.1.0",
94
94
  "@atlaskit/checkbox": "^17.3.0",
95
+ "@atlaskit/editor-card-provider": "^6.8.0",
95
96
  "@atlaskit/link-provider": "^4.4.0",
96
97
  "@atlaskit/link-test-helpers": "^10.2.0",
97
98
  "@atlaskit/media-core": "^37.1.0",
@@ -118,6 +119,8 @@
118
119
  "jsdom": "^25.0.0",
119
120
  "mockdate": "^3.0.5",
120
121
  "puppeteer": "13.7.0",
122
+ "react": "^18.2.0",
123
+ "react-dom": "^18.2.0",
121
124
  "react-intl": "^6.6.2",
122
125
  "react-live-clock": "^5.0.0",
123
126
  "react-magnetic-di": "^3.1.4",
@@ -250,6 +253,9 @@
250
253
  },
251
254
  "platform-dst-lozenge-tag-badge-visual-uplifts": {
252
255
  "type": "boolean"
256
+ },
257
+ "platform_nested_table_style_override": {
258
+ "type": "boolean"
253
259
  }
254
260
  }
255
261
  }