@atlaskit/renderer 112.3.0 → 112.3.2

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,22 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 112.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#160291](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/160291)
8
+ [`223443d621e88`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/223443d621e88) -
9
+ [ux] Fixes default table column widths when table is nested in extension that is nested in layout
10
+
11
+ ## 112.3.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [#159704](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/159704)
16
+ [`03e6dc49c3d4f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/03e6dc49c3d4f) -
17
+ Add temporary sticky header configuration options to allow consumer to set the default overflow
18
+ parent
19
+
3
20
  ## 112.3.0
4
21
 
5
22
  ### Minor Changes
@@ -11,7 +11,9 @@ var _styles = require("@atlaskit/editor-common/styles");
11
11
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
12
12
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
13
13
  var _nodeWidth = require("@atlaskit/editor-common/node-width");
14
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
15
  var _useFeatureFlags = require("../../../use-feature-flags");
16
+ var _rendererContext = require("../../../renderer-context");
15
17
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
18
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
19
  // we allow scaling down column widths by no more than 30%
@@ -68,7 +70,8 @@ var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
68
70
  isinsideMultiBodiedExtension = props.isinsideMultiBodiedExtension,
69
71
  isTableScalingEnabled = props.isTableScalingEnabled,
70
72
  isTableFixedColumnWidthsOptionEnabled = props.isTableFixedColumnWidthsOptionEnabled,
71
- allowTableResizing = props.allowTableResizing;
73
+ allowTableResizing = props.allowTableResizing,
74
+ isTopLevelRenderer = props.isTopLevelRenderer;
72
75
  if (!columnWidths) {
73
76
  return [];
74
77
  }
@@ -76,10 +79,16 @@ var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
76
79
  var noOfColumns = columnWidths.length;
77
80
  var targetWidths;
78
81
 
82
+ // This is a fix for ED-23259
83
+ // Some extensions (for ex: Page Properties or Excerpt) do not renderer tables directly inside themselves. They use ReactRenderer.
84
+ // So if we add a check like isInsideExtension (similar to exising isInsideBlockNode), it will fail, and to the only way to learn
85
+ // if the table is rendered inside another node, is to check if the Renderer itself is nested.
86
+ var isRendererNested = isTopLevelRenderer === false && (0, _platformFeatureFlags.fg)('platform_editor_nested_table_in_nested_parent_fix');
87
+
79
88
  // appearance == comment && allowTableResizing && !tableNode?.attrs.width, means it is a comment
80
89
  // appearance == comment && !allowTableResizing && !tableNode?.attrs.width, means it is a inline comment
81
90
  // When comment and inline comment table width inherits from the parent container, we want tableContainerWidth === renderWidth
82
- var tableContainerWidth = rendererAppearance === 'comment' && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) ? renderWidth : (0, _nodeWidth.getTableContainerWidth)(tableNode);
91
+ var tableContainerWidth = rendererAppearance === 'comment' && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) || isRendererNested ? renderWidth : (0, _nodeWidth.getTableContainerWidth)(tableNode);
83
92
  if (allowTableResizing && !isInsideOfBlockNode && !isinsideMultiBodiedExtension && !tableColumnResized) {
84
93
  // when no columns are resized, each column should have equal width, equals to tableWidth / noOfColumns
85
94
  var _tableWidth2 = (isNumberColumnEnabled ? tableContainerWidth - _editorSharedStyles.akEditorTableNumberColumnWidth : tableContainerWidth) - 1;
@@ -167,6 +176,8 @@ var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
167
176
  });
168
177
  };
169
178
  var Colgroup = exports.Colgroup = function Colgroup(props) {
179
+ var _useRendererContext = (0, _rendererContext.useRendererContext)(),
180
+ isTopLevelRenderer = _useRendererContext.isTopLevelRenderer;
170
181
  var columnWidths = props.columnWidths,
171
182
  isNumberColumnEnabled = props.isNumberColumnEnabled;
172
183
  var flags = (0, _useFeatureFlags.useFeatureFlags)();
@@ -174,6 +185,7 @@ var Colgroup = exports.Colgroup = function Colgroup(props) {
174
185
  return null;
175
186
  }
176
187
  var colStyles = renderScaleDownColgroup(_objectSpread(_objectSpread({}, props), {}, {
188
+ isTopLevelRenderer: isTopLevelRenderer,
177
189
  isTableScalingEnabled: !!(flags && 'tablePreserveWidth' in flags && flags.tablePreserveWidth) || props.rendererAppearance === 'comment' && (0, _experiments.editorExperiment)('support_table_in_comment', true, {
178
190
  exposure: true
179
191
  }) || props.rendererAppearance === 'comment' && (0, _experiments.editorExperiment)('support_table_in_comment_jira', true, {
@@ -173,7 +173,7 @@ var StickyTable = exports.StickyTable = function StickyTable(_ref) {
173
173
  /**
174
174
  * Traverse DOM Tree upwards looking for table parents with "overflow: scroll".
175
175
  */
176
- function findHorizontalOverflowScrollParent(table) {
176
+ function findHorizontalOverflowScrollParent(table, defaultScrollRootEl) {
177
177
  var parent = table;
178
178
  if (!parent) {
179
179
  return null;
@@ -184,6 +184,11 @@ function findHorizontalOverflowScrollParent(table) {
184
184
  if (style.overflow === 'scroll' || style.overflowY === 'scroll') {
185
185
  return parent;
186
186
  }
187
+ if (!!defaultScrollRootEl && defaultScrollRootEl === parent) {
188
+ // If a defaultScrollRootEl was specified and we reached it without finding a closer scroll parent,
189
+ // use the defaultScrollRootEl.
190
+ return parent;
191
+ }
187
192
  }
188
193
  return null;
189
194
  }
@@ -226,8 +231,8 @@ var OverflowParent = exports.OverflowParent = /*#__PURE__*/function () {
226
231
  }
227
232
  }], [{
228
233
  key: "fromElement",
229
- value: function fromElement(el) {
230
- return new OverflowParent(findHorizontalOverflowScrollParent(el) || window);
234
+ value: function fromElement(el, defaultScrollRootEl) {
235
+ return new OverflowParent(findHorizontalOverflowScrollParent(el, defaultScrollRootEl) || window);
231
236
  }
232
237
  }]);
233
238
  return OverflowParent;
@@ -253,7 +253,8 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
253
253
  this.resizeObserver.observe(this.stickyHeaderRef.current);
254
254
  }
255
255
  if (this.props.stickyHeaders) {
256
- this.overflowParent = _sticky.OverflowParent.fromElement(this.tableRef.current);
256
+ var _this$props$stickyHea;
257
+ this.overflowParent = _sticky.OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea = this.props.stickyHeaders) === null || _this$props$stickyHea === void 0 ? void 0 : _this$props$stickyHea.defaultScrollRoot_DO_NOT_USE);
257
258
  this.overflowParent.addEventListener('scroll', this.onScroll);
258
259
  }
259
260
  if (this.wrapperRef.current && isStickyScrollbarEnabled(this.props.rendererAppearance)) {
@@ -265,7 +266,8 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
265
266
  value: function componentDidUpdate(prevProps, prevState) {
266
267
  // toggling sticky headers visiblity
267
268
  if (this.props.stickyHeaders && !this.overflowParent) {
268
- this.overflowParent = _sticky.OverflowParent.fromElement(this.tableRef.current);
269
+ var _this$props$stickyHea2;
270
+ this.overflowParent = _sticky.OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea2 = this.props.stickyHeaders) === null || _this$props$stickyHea2 === void 0 ? void 0 : _this$props$stickyHea2.defaultScrollRoot_DO_NOT_USE);
269
271
  } else if (!this.props.stickyHeaders && this.overflowParent) {
270
272
  this.overflowParent.removeEventListener('scroll', this.onScroll);
271
273
  this.overflowParent = null;
@@ -296,7 +298,14 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
296
298
  case 'pin-bottom':
297
299
  return this.pinTop;
298
300
  case 'stick':
299
- return this.props.stickyHeaders && this.props.stickyHeaders.offsetTop;
301
+ var offsetTop = this.props.stickyHeaders && this.props.stickyHeaders.offsetTop;
302
+ if (typeof offsetTop === 'number') {
303
+ var _this$props$stickyHea3, _this$props$stickyHea4;
304
+ var defaultScrollRootOffsetTop = (_this$props$stickyHea3 = (_this$props$stickyHea4 = this.props.stickyHeaders) === null || _this$props$stickyHea4 === void 0 ? void 0 : _this$props$stickyHea4.defaultScrollRootTop_DO_NOT_USE) !== null && _this$props$stickyHea3 !== void 0 ? _this$props$stickyHea3 : 0;
305
+ return offsetTop + defaultScrollRootOffsetTop;
306
+ } else {
307
+ return offsetTop;
308
+ }
300
309
  default:
301
310
  return undefined;
302
311
  }
@@ -65,7 +65,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
65
65
  var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
66
66
  var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
67
67
  var packageName = "@atlaskit/renderer";
68
- var packageVersion = "112.3.0";
68
+ var packageVersion = "112.3.2";
69
69
  var setAsQueryContainerStyles = (0, _react2.css)({
70
70
  containerName: 'ak-renderer-wrapper',
71
71
  containerType: 'inline-size',
@@ -3,7 +3,10 @@ import { tableCellBorderWidth, tableCellMinWidth } from '@atlaskit/editor-common
3
3
  import { akEditorTableNumberColumnWidth, akEditorTableLegacyCellMinWidth } from '@atlaskit/editor-shared-styles';
4
4
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
5
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { useFeatureFlags } from '../../../use-feature-flags';
8
+ import { useRendererContext } from '../../../renderer-context';
9
+
7
10
  // we allow scaling down column widths by no more than 30%
8
11
  // this intends to reduce unwanted scrolling in the Renderer in these scenarios:
9
12
  // User A creates a table with column widths → User B views it on a smaller screen
@@ -54,7 +57,8 @@ const renderScaleDownColgroup = props => {
54
57
  isinsideMultiBodiedExtension,
55
58
  isTableScalingEnabled,
56
59
  isTableFixedColumnWidthsOptionEnabled,
57
- allowTableResizing
60
+ allowTableResizing,
61
+ isTopLevelRenderer
58
62
  } = props;
59
63
  if (!columnWidths) {
60
64
  return [];
@@ -63,10 +67,16 @@ const renderScaleDownColgroup = props => {
63
67
  const noOfColumns = columnWidths.length;
64
68
  let targetWidths;
65
69
 
70
+ // This is a fix for ED-23259
71
+ // Some extensions (for ex: Page Properties or Excerpt) do not renderer tables directly inside themselves. They use ReactRenderer.
72
+ // So if we add a check like isInsideExtension (similar to exising isInsideBlockNode), it will fail, and to the only way to learn
73
+ // if the table is rendered inside another node, is to check if the Renderer itself is nested.
74
+ const isRendererNested = isTopLevelRenderer === false && fg('platform_editor_nested_table_in_nested_parent_fix');
75
+
66
76
  // appearance == comment && allowTableResizing && !tableNode?.attrs.width, means it is a comment
67
77
  // appearance == comment && !allowTableResizing && !tableNode?.attrs.width, means it is a inline comment
68
78
  // When comment and inline comment table width inherits from the parent container, we want tableContainerWidth === renderWidth
69
- const tableContainerWidth = rendererAppearance === 'comment' && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) ? renderWidth : getTableContainerWidth(tableNode);
79
+ const tableContainerWidth = rendererAppearance === 'comment' && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) || isRendererNested ? renderWidth : getTableContainerWidth(tableNode);
70
80
  if (allowTableResizing && !isInsideOfBlockNode && !isinsideMultiBodiedExtension && !tableColumnResized) {
71
81
  // when no columns are resized, each column should have equal width, equals to tableWidth / noOfColumns
72
82
  const tableWidth = (isNumberColumnEnabled ? tableContainerWidth - akEditorTableNumberColumnWidth : tableContainerWidth) - 1;
@@ -154,6 +164,9 @@ const renderScaleDownColgroup = props => {
154
164
  });
155
165
  };
156
166
  export const Colgroup = props => {
167
+ const {
168
+ isTopLevelRenderer
169
+ } = useRendererContext();
157
170
  let {
158
171
  columnWidths,
159
172
  isNumberColumnEnabled
@@ -164,6 +177,7 @@ export const Colgroup = props => {
164
177
  }
165
178
  const colStyles = renderScaleDownColgroup({
166
179
  ...props,
180
+ isTopLevelRenderer,
167
181
  isTableScalingEnabled: !!(flags && 'tablePreserveWidth' in flags && flags.tablePreserveWidth) || props.rendererAppearance === 'comment' && editorExperiment('support_table_in_comment', true, {
168
182
  exposure: true
169
183
  }) || props.rendererAppearance === 'comment' && editorExperiment('support_table_in_comment_jira', true, {
@@ -174,7 +174,7 @@ export const StickyTable = ({
174
174
  /**
175
175
  * Traverse DOM Tree upwards looking for table parents with "overflow: scroll".
176
176
  */
177
- function findHorizontalOverflowScrollParent(table) {
177
+ function findHorizontalOverflowScrollParent(table, defaultScrollRootEl) {
178
178
  let parent = table;
179
179
  if (!parent) {
180
180
  return null;
@@ -185,6 +185,11 @@ function findHorizontalOverflowScrollParent(table) {
185
185
  if (style.overflow === 'scroll' || style.overflowY === 'scroll') {
186
186
  return parent;
187
187
  }
188
+ if (!!defaultScrollRootEl && defaultScrollRootEl === parent) {
189
+ // If a defaultScrollRootEl was specified and we reached it without finding a closer scroll parent,
190
+ // use the defaultScrollRootEl.
191
+ return parent;
192
+ }
188
193
  }
189
194
  return null;
190
195
  }
@@ -193,8 +198,8 @@ export class OverflowParent {
193
198
  this.ref = ref;
194
199
  this.ref = ref;
195
200
  }
196
- static fromElement(el) {
197
- return new OverflowParent(findHorizontalOverflowScrollParent(el) || window);
201
+ static fromElement(el, defaultScrollRootEl) {
202
+ return new OverflowParent(findHorizontalOverflowScrollParent(el, defaultScrollRootEl) || window);
198
203
  }
199
204
  get isElement() {
200
205
  return this.ref instanceof HTMLElement;
@@ -204,7 +204,8 @@ export class TableContainer extends React.Component {
204
204
  this.resizeObserver.observe(this.stickyHeaderRef.current);
205
205
  }
206
206
  if (this.props.stickyHeaders) {
207
- this.overflowParent = OverflowParent.fromElement(this.tableRef.current);
207
+ var _this$props$stickyHea;
208
+ this.overflowParent = OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea = this.props.stickyHeaders) === null || _this$props$stickyHea === void 0 ? void 0 : _this$props$stickyHea.defaultScrollRoot_DO_NOT_USE);
208
209
  this.overflowParent.addEventListener('scroll', this.onScroll);
209
210
  }
210
211
  if (this.wrapperRef.current && isStickyScrollbarEnabled(this.props.rendererAppearance)) {
@@ -214,7 +215,8 @@ export class TableContainer extends React.Component {
214
215
  componentDidUpdate(prevProps, prevState) {
215
216
  // toggling sticky headers visiblity
216
217
  if (this.props.stickyHeaders && !this.overflowParent) {
217
- this.overflowParent = OverflowParent.fromElement(this.tableRef.current);
218
+ var _this$props$stickyHea2;
219
+ this.overflowParent = OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea2 = this.props.stickyHeaders) === null || _this$props$stickyHea2 === void 0 ? void 0 : _this$props$stickyHea2.defaultScrollRoot_DO_NOT_USE);
218
220
  } else if (!this.props.stickyHeaders && this.overflowParent) {
219
221
  this.overflowParent.removeEventListener('scroll', this.onScroll);
220
222
  this.overflowParent = null;
@@ -241,7 +243,14 @@ export class TableContainer extends React.Component {
241
243
  case 'pin-bottom':
242
244
  return this.pinTop;
243
245
  case 'stick':
244
- return this.props.stickyHeaders && this.props.stickyHeaders.offsetTop;
246
+ const offsetTop = this.props.stickyHeaders && this.props.stickyHeaders.offsetTop;
247
+ if (typeof offsetTop === 'number') {
248
+ var _this$props$stickyHea3, _this$props$stickyHea4;
249
+ const defaultScrollRootOffsetTop = (_this$props$stickyHea3 = (_this$props$stickyHea4 = this.props.stickyHeaders) === null || _this$props$stickyHea4 === void 0 ? void 0 : _this$props$stickyHea4.defaultScrollRootTop_DO_NOT_USE) !== null && _this$props$stickyHea3 !== void 0 ? _this$props$stickyHea3 : 0;
250
+ return offsetTop + defaultScrollRootOffsetTop;
251
+ } else {
252
+ return offsetTop;
253
+ }
245
254
  default:
246
255
  return undefined;
247
256
  }
@@ -45,7 +45,7 @@ import { countNodes } from './count-nodes';
45
45
  export const NORMAL_SEVERITY_THRESHOLD = 2000;
46
46
  export const DEGRADED_SEVERITY_THRESHOLD = 3000;
47
47
  const packageName = "@atlaskit/renderer";
48
- const packageVersion = "112.3.0";
48
+ const packageVersion = "112.3.2";
49
49
  const setAsQueryContainerStyles = css({
50
50
  containerName: 'ak-renderer-wrapper',
51
51
  containerType: 'inline-size',
@@ -6,7 +6,10 @@ import { tableCellBorderWidth, tableCellMinWidth } from '@atlaskit/editor-common
6
6
  import { akEditorTableNumberColumnWidth, akEditorTableLegacyCellMinWidth } from '@atlaskit/editor-shared-styles';
7
7
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
8
8
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
9
+ import { fg } from '@atlaskit/platform-feature-flags';
9
10
  import { useFeatureFlags } from '../../../use-feature-flags';
11
+ import { useRendererContext } from '../../../renderer-context';
12
+
10
13
  // we allow scaling down column widths by no more than 30%
11
14
  // this intends to reduce unwanted scrolling in the Renderer in these scenarios:
12
15
  // User A creates a table with column widths → User B views it on a smaller screen
@@ -61,7 +64,8 @@ var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
61
64
  isinsideMultiBodiedExtension = props.isinsideMultiBodiedExtension,
62
65
  isTableScalingEnabled = props.isTableScalingEnabled,
63
66
  isTableFixedColumnWidthsOptionEnabled = props.isTableFixedColumnWidthsOptionEnabled,
64
- allowTableResizing = props.allowTableResizing;
67
+ allowTableResizing = props.allowTableResizing,
68
+ isTopLevelRenderer = props.isTopLevelRenderer;
65
69
  if (!columnWidths) {
66
70
  return [];
67
71
  }
@@ -69,10 +73,16 @@ var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
69
73
  var noOfColumns = columnWidths.length;
70
74
  var targetWidths;
71
75
 
76
+ // This is a fix for ED-23259
77
+ // Some extensions (for ex: Page Properties or Excerpt) do not renderer tables directly inside themselves. They use ReactRenderer.
78
+ // So if we add a check like isInsideExtension (similar to exising isInsideBlockNode), it will fail, and to the only way to learn
79
+ // if the table is rendered inside another node, is to check if the Renderer itself is nested.
80
+ var isRendererNested = isTopLevelRenderer === false && fg('platform_editor_nested_table_in_nested_parent_fix');
81
+
72
82
  // appearance == comment && allowTableResizing && !tableNode?.attrs.width, means it is a comment
73
83
  // appearance == comment && !allowTableResizing && !tableNode?.attrs.width, means it is a inline comment
74
84
  // When comment and inline comment table width inherits from the parent container, we want tableContainerWidth === renderWidth
75
- var tableContainerWidth = rendererAppearance === 'comment' && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) ? renderWidth : getTableContainerWidth(tableNode);
85
+ var tableContainerWidth = rendererAppearance === 'comment' && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) || isRendererNested ? renderWidth : getTableContainerWidth(tableNode);
76
86
  if (allowTableResizing && !isInsideOfBlockNode && !isinsideMultiBodiedExtension && !tableColumnResized) {
77
87
  // when no columns are resized, each column should have equal width, equals to tableWidth / noOfColumns
78
88
  var _tableWidth2 = (isNumberColumnEnabled ? tableContainerWidth - akEditorTableNumberColumnWidth : tableContainerWidth) - 1;
@@ -160,6 +170,8 @@ var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
160
170
  });
161
171
  };
162
172
  export var Colgroup = function Colgroup(props) {
173
+ var _useRendererContext = useRendererContext(),
174
+ isTopLevelRenderer = _useRendererContext.isTopLevelRenderer;
163
175
  var columnWidths = props.columnWidths,
164
176
  isNumberColumnEnabled = props.isNumberColumnEnabled;
165
177
  var flags = useFeatureFlags();
@@ -167,6 +179,7 @@ export var Colgroup = function Colgroup(props) {
167
179
  return null;
168
180
  }
169
181
  var colStyles = renderScaleDownColgroup(_objectSpread(_objectSpread({}, props), {}, {
182
+ isTopLevelRenderer: isTopLevelRenderer,
170
183
  isTableScalingEnabled: !!(flags && 'tablePreserveWidth' in flags && flags.tablePreserveWidth) || props.rendererAppearance === 'comment' && editorExperiment('support_table_in_comment', true, {
171
184
  exposure: true
172
185
  }) || props.rendererAppearance === 'comment' && editorExperiment('support_table_in_comment_jira', true, {
@@ -164,7 +164,7 @@ export var StickyTable = function StickyTable(_ref) {
164
164
  /**
165
165
  * Traverse DOM Tree upwards looking for table parents with "overflow: scroll".
166
166
  */
167
- function findHorizontalOverflowScrollParent(table) {
167
+ function findHorizontalOverflowScrollParent(table, defaultScrollRootEl) {
168
168
  var parent = table;
169
169
  if (!parent) {
170
170
  return null;
@@ -175,6 +175,11 @@ function findHorizontalOverflowScrollParent(table) {
175
175
  if (style.overflow === 'scroll' || style.overflowY === 'scroll') {
176
176
  return parent;
177
177
  }
178
+ if (!!defaultScrollRootEl && defaultScrollRootEl === parent) {
179
+ // If a defaultScrollRootEl was specified and we reached it without finding a closer scroll parent,
180
+ // use the defaultScrollRootEl.
181
+ return parent;
182
+ }
178
183
  }
179
184
  return null;
180
185
  }
@@ -217,8 +222,8 @@ export var OverflowParent = /*#__PURE__*/function () {
217
222
  }
218
223
  }], [{
219
224
  key: "fromElement",
220
- value: function fromElement(el) {
221
- return new OverflowParent(findHorizontalOverflowScrollParent(el) || window);
225
+ value: function fromElement(el, defaultScrollRootEl) {
226
+ return new OverflowParent(findHorizontalOverflowScrollParent(el, defaultScrollRootEl) || window);
222
227
  }
223
228
  }]);
224
229
  return OverflowParent;
@@ -246,7 +246,8 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
246
246
  this.resizeObserver.observe(this.stickyHeaderRef.current);
247
247
  }
248
248
  if (this.props.stickyHeaders) {
249
- this.overflowParent = OverflowParent.fromElement(this.tableRef.current);
249
+ var _this$props$stickyHea;
250
+ this.overflowParent = OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea = this.props.stickyHeaders) === null || _this$props$stickyHea === void 0 ? void 0 : _this$props$stickyHea.defaultScrollRoot_DO_NOT_USE);
250
251
  this.overflowParent.addEventListener('scroll', this.onScroll);
251
252
  }
252
253
  if (this.wrapperRef.current && isStickyScrollbarEnabled(this.props.rendererAppearance)) {
@@ -258,7 +259,8 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
258
259
  value: function componentDidUpdate(prevProps, prevState) {
259
260
  // toggling sticky headers visiblity
260
261
  if (this.props.stickyHeaders && !this.overflowParent) {
261
- this.overflowParent = OverflowParent.fromElement(this.tableRef.current);
262
+ var _this$props$stickyHea2;
263
+ this.overflowParent = OverflowParent.fromElement(this.tableRef.current, (_this$props$stickyHea2 = this.props.stickyHeaders) === null || _this$props$stickyHea2 === void 0 ? void 0 : _this$props$stickyHea2.defaultScrollRoot_DO_NOT_USE);
262
264
  } else if (!this.props.stickyHeaders && this.overflowParent) {
263
265
  this.overflowParent.removeEventListener('scroll', this.onScroll);
264
266
  this.overflowParent = null;
@@ -289,7 +291,14 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
289
291
  case 'pin-bottom':
290
292
  return this.pinTop;
291
293
  case 'stick':
292
- return this.props.stickyHeaders && this.props.stickyHeaders.offsetTop;
294
+ var offsetTop = this.props.stickyHeaders && this.props.stickyHeaders.offsetTop;
295
+ if (typeof offsetTop === 'number') {
296
+ var _this$props$stickyHea3, _this$props$stickyHea4;
297
+ var defaultScrollRootOffsetTop = (_this$props$stickyHea3 = (_this$props$stickyHea4 = this.props.stickyHeaders) === null || _this$props$stickyHea4 === void 0 ? void 0 : _this$props$stickyHea4.defaultScrollRootTop_DO_NOT_USE) !== null && _this$props$stickyHea3 !== void 0 ? _this$props$stickyHea3 : 0;
298
+ return offsetTop + defaultScrollRootOffsetTop;
299
+ } else {
300
+ return offsetTop;
301
+ }
293
302
  default:
294
303
  return undefined;
295
304
  }
@@ -55,7 +55,7 @@ import { countNodes } from './count-nodes';
55
55
  export var NORMAL_SEVERITY_THRESHOLD = 2000;
56
56
  export var DEGRADED_SEVERITY_THRESHOLD = 3000;
57
57
  var packageName = "@atlaskit/renderer";
58
- var packageVersion = "112.3.0";
58
+ var packageVersion = "112.3.2";
59
59
  var setAsQueryContainerStyles = css({
60
60
  containerName: 'ak-renderer-wrapper',
61
61
  containerType: 'inline-size',
@@ -31,7 +31,7 @@ export declare const StickyTable: ({ top, left, mode, shadowClassNames, innerRef
31
31
  export declare class OverflowParent {
32
32
  private ref;
33
33
  private constructor();
34
- static fromElement(el: HTMLElement | null): OverflowParent;
34
+ static fromElement(el: HTMLElement | null, defaultScrollRootEl?: HTMLElement): OverflowParent;
35
35
  get isElement(): boolean;
36
36
  get top(): number;
37
37
  addEventListener(type: string, cb: EventListenerOrEventListenerObject, ...args: any[]): void;
@@ -1,8 +1,27 @@
1
1
  /// <reference types="react" />
2
2
  export type RendererAppearance = 'comment' | 'full-page' | 'full-width' | undefined;
3
+ /**
4
+ * DO NOT USE THESE OPTIONS
5
+ * These StickyHeaderConfig_DO_NOT_USE options are being TEMPORARILY added so Confluence can use Sticky Table Headers
6
+ * in Nav4.
7
+ *
8
+ * They will be cleaned up ASAP after Confluence refactors its page layout to add an explicit scroll container (DISCO-3121)
9
+ *
10
+ * `defaultScrollRoot_DO_NOT_USE` - defaults to undefined - can be used to specify the default OverflowParent if the table
11
+ * doesn't have a parent that explicitly specifies `overflow: scroll` or `overflow-y: scroll`. When undefined, the
12
+ * default OverflowParent will be the window
13
+ * `defaultScrollRootTop_DO_NOT_USE` - defaults to 0 - can be used to specify any offset that should be applied to the
14
+ * sticky table header offset but does not need to be included when determining if the header should be sticky.
15
+ * This is required bcause the llogic that determines if the header should be sticky takes the OverflowParent.offsetTop
16
+ * into account. But the calculation to get the actual header offset does not.
17
+ */
18
+ type StickyHeaderConfig_DO_NOT_USE = {
19
+ defaultScrollRoot_DO_NOT_USE?: HTMLElement;
20
+ defaultScrollRootTop_DO_NOT_USE?: number;
21
+ };
3
22
  export type StickyHeaderConfig = {
4
23
  offsetTop?: number;
5
- };
24
+ } & StickyHeaderConfig_DO_NOT_USE;
6
25
  export type StickyHeaderProps = boolean | ({
7
26
  show?: boolean;
8
27
  } & StickyHeaderConfig);
@@ -14,3 +33,4 @@ export type NodeComponentsProps = {
14
33
  [key: string]: React.ComponentType<React.PropsWithChildren<any>>;
15
34
  };
16
35
  export type HeadingAnchorLinksProps = boolean | HeadingAnchorLinksConfig;
36
+ export {};
@@ -31,7 +31,7 @@ export declare const StickyTable: ({ top, left, mode, shadowClassNames, innerRef
31
31
  export declare class OverflowParent {
32
32
  private ref;
33
33
  private constructor();
34
- static fromElement(el: HTMLElement | null): OverflowParent;
34
+ static fromElement(el: HTMLElement | null, defaultScrollRootEl?: HTMLElement): OverflowParent;
35
35
  get isElement(): boolean;
36
36
  get top(): number;
37
37
  addEventListener(type: string, cb: EventListenerOrEventListenerObject, ...args: any[]): void;
@@ -1,8 +1,27 @@
1
1
  /// <reference types="react" />
2
2
  export type RendererAppearance = 'comment' | 'full-page' | 'full-width' | undefined;
3
+ /**
4
+ * DO NOT USE THESE OPTIONS
5
+ * These StickyHeaderConfig_DO_NOT_USE options are being TEMPORARILY added so Confluence can use Sticky Table Headers
6
+ * in Nav4.
7
+ *
8
+ * They will be cleaned up ASAP after Confluence refactors its page layout to add an explicit scroll container (DISCO-3121)
9
+ *
10
+ * `defaultScrollRoot_DO_NOT_USE` - defaults to undefined - can be used to specify the default OverflowParent if the table
11
+ * doesn't have a parent that explicitly specifies `overflow: scroll` or `overflow-y: scroll`. When undefined, the
12
+ * default OverflowParent will be the window
13
+ * `defaultScrollRootTop_DO_NOT_USE` - defaults to 0 - can be used to specify any offset that should be applied to the
14
+ * sticky table header offset but does not need to be included when determining if the header should be sticky.
15
+ * This is required bcause the llogic that determines if the header should be sticky takes the OverflowParent.offsetTop
16
+ * into account. But the calculation to get the actual header offset does not.
17
+ */
18
+ type StickyHeaderConfig_DO_NOT_USE = {
19
+ defaultScrollRoot_DO_NOT_USE?: HTMLElement;
20
+ defaultScrollRootTop_DO_NOT_USE?: number;
21
+ };
3
22
  export type StickyHeaderConfig = {
4
23
  offsetTop?: number;
5
- };
24
+ } & StickyHeaderConfig_DO_NOT_USE;
6
25
  export type StickyHeaderProps = boolean | ({
7
26
  show?: boolean;
8
27
  } & StickyHeaderConfig);
@@ -14,3 +33,4 @@ export type NodeComponentsProps = {
14
33
  [key: string]: React.ComponentType<React.PropsWithChildren<any>>;
15
34
  };
16
35
  export type HeadingAnchorLinksProps = boolean | HeadingAnchorLinksConfig;
36
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "112.3.0",
3
+ "version": "112.3.2",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,7 +29,7 @@
29
29
  "@atlaskit/analytics-next": "^10.1.0",
30
30
  "@atlaskit/button": "^20.3.0",
31
31
  "@atlaskit/code": "^15.6.0",
32
- "@atlaskit/editor-common": "^94.11.0",
32
+ "@atlaskit/editor-common": "^94.12.0",
33
33
  "@atlaskit/editor-json-transformer": "^8.20.0",
34
34
  "@atlaskit/editor-palette": "1.6.3",
35
35
  "@atlaskit/editor-prosemirror": "6.0.0",
@@ -37,7 +37,7 @@
37
37
  "@atlaskit/emoji": "^67.9.0",
38
38
  "@atlaskit/feature-gate-js-client": "^4.22.0",
39
39
  "@atlaskit/icon": "^22.24.0",
40
- "@atlaskit/link-datasource": "^3.7.0",
40
+ "@atlaskit/link-datasource": "^3.8.0",
41
41
  "@atlaskit/media-card": "^78.10.0",
42
42
  "@atlaskit/media-client": "^28.0.0",
43
43
  "@atlaskit/media-client-react": "^2.3.0",
@@ -51,7 +51,7 @@
51
51
  "@atlaskit/task-decision": "^17.11.0",
52
52
  "@atlaskit/theme": "^14.0.0",
53
53
  "@atlaskit/tmp-editor-statsig": "^2.11.0",
54
- "@atlaskit/tokens": "^2.0.0",
54
+ "@atlaskit/tokens": "^2.1.0",
55
55
  "@atlaskit/tooltip": "^18.8.0",
56
56
  "@babel/runtime": "^7.0.0",
57
57
  "@emotion/react": "^11.7.1",
@@ -143,6 +143,9 @@
143
143
  },
144
144
  "platform_editor_advanced_layouts_pre_release_2": {
145
145
  "type": "boolean"
146
+ },
147
+ "platform_editor_nested_table_in_nested_parent_fix": {
148
+ "type": "boolean"
146
149
  }
147
150
  },
148
151
  "af:exports": {