@atlaskit/renderer 137.1.8 → 137.1.10
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 +28 -0
- package/dist/cjs/react/index.js +1 -1
- package/dist/cjs/react/nodes/table/colgroup.js +1 -2
- package/dist/cjs/react/nodes/table/sticky.js +2 -4
- package/dist/cjs/react/nodes/table/table.js +1 -12
- package/dist/cjs/react/nodes/table.js +471 -203
- package/dist/cjs/ui/Expand.js +33 -7
- package/dist/cjs/ui/Renderer/breakout-ssr.js +1 -2
- package/dist/cjs/ui/Renderer/index.js +3 -3
- package/dist/cjs/ui/utils/expand-body.js +218 -0
- package/dist/cjs/ui/utils/expand-search-text.js +39 -1
- package/dist/es2019/react/index.js +1 -1
- package/dist/es2019/react/nodes/table/colgroup.js +1 -2
- package/dist/es2019/react/nodes/table/sticky.js +2 -3
- package/dist/es2019/react/nodes/table/table.js +1 -12
- package/dist/es2019/react/nodes/table.js +457 -190
- package/dist/es2019/ui/Expand.js +33 -7
- package/dist/es2019/ui/Renderer/breakout-ssr.js +1 -2
- package/dist/es2019/ui/Renderer/index.js +3 -3
- package/dist/es2019/ui/utils/expand-body.js +198 -0
- package/dist/es2019/ui/utils/expand-search-text.js +38 -0
- package/dist/esm/react/index.js +1 -1
- package/dist/esm/react/nodes/table/colgroup.js +1 -2
- package/dist/esm/react/nodes/table/sticky.js +2 -4
- package/dist/esm/react/nodes/table/table.js +1 -12
- package/dist/esm/react/nodes/table.js +471 -202
- package/dist/esm/ui/Expand.js +33 -7
- package/dist/esm/ui/Renderer/breakout-ssr.js +1 -2
- package/dist/esm/ui/Renderer/index.js +3 -3
- package/dist/esm/ui/utils/expand-body.js +210 -0
- package/dist/esm/ui/utils/expand-search-text.js +38 -0
- package/dist/types/react/nodes/table/sticky.d.ts +1 -2
- package/dist/types/react/nodes/table.d.ts +78 -8
- package/dist/types/ui/{expand-body.d.ts → utils/expand-body.d.ts} +26 -5
- package/dist/types/ui/utils/expand-search-text.d.ts +14 -0
- package/package.json +6 -9
- package/dist/cjs/react/nodes/tableNew.js +0 -1050
- package/dist/cjs/ui/expand-body.js +0 -122
- package/dist/es2019/react/nodes/tableNew.js +0 -986
- package/dist/es2019/ui/expand-body.js +0 -107
- package/dist/esm/react/nodes/tableNew.js +0 -1044
- package/dist/esm/ui/expand-body.js +0 -114
- package/dist/types/react/nodes/tableNew.d.ts +0 -189
|
@@ -4,9 +4,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.tableCanBeSticky = exports.shouldHeaderStick = exports.shouldHeaderPinBottom = exports.orderChildren = exports.isTableResizingEnabled = exports.isStickyScrollbarEnabled = exports.isHeaderRowEnabled = exports.hasRowspan = exports.getRefTop = exports.default = exports.addSortableColumn = exports.
|
|
7
|
+
exports.tableCanBeSticky = exports.shouldHeaderStick = exports.shouldHeaderPinBottom = exports.orderChildren = exports.isTableResizingEnabled = exports.isStickyScrollbarEnabled = exports.isHeaderRowEnabled = exports.hasRowspan = exports.getRefTop = exports.default = exports.addSortableColumn = exports.TableProcessorWithContainerStyles = exports.TableContainer = exports.RefSyncBlockFakeBorders = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
var
|
|
9
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
12
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
@@ -14,17 +14,16 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
14
14
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
16
|
var _react = _interopRequireDefault(require("react"));
|
|
17
|
-
var _reactIntl = require("react-intl");
|
|
18
17
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
19
|
-
var _messages = require("@atlaskit/editor-common/messages");
|
|
20
18
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
19
|
+
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
20
|
+
var _style = require("../../ui/Renderer/style");
|
|
21
21
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
22
|
+
var _consts = require("../../consts");
|
|
22
23
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
23
24
|
var _types = require("@atlaskit/editor-common/types");
|
|
24
25
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
25
|
-
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
26
26
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
27
|
-
var _style = require("../../ui/Renderer/style");
|
|
28
27
|
var _tableCell = require("./tableCell");
|
|
29
28
|
var _SmartCardStorage = require("../../ui/SmartCardStorage");
|
|
30
29
|
var _sticky = require("./table/sticky");
|
|
@@ -32,7 +31,6 @@ var _table = require("./table/table");
|
|
|
32
31
|
var _appearance = require("../utils/appearance");
|
|
33
32
|
var _TableStickyScrollbar = require("./TableStickyScrollbar");
|
|
34
33
|
var _rendererContext = require("../../renderer-context");
|
|
35
|
-
var _tableNew = require("./tableNew");
|
|
36
34
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
37
35
|
var _table2 = require("@atlaskit/editor-common/table");
|
|
38
36
|
var _contentMode = require("./table/content-mode");
|
|
@@ -42,7 +40,24 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
|
|
|
42
40
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
43
41
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
44
42
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
45
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
43
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/enforce-style-prop, @repo/internal/react/no-class-components */
|
|
44
|
+
var stickyContainerBaseStyles = {
|
|
45
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
46
|
+
height: "var(--ds-space-250, 20px)",
|
|
47
|
+
// MAX_BROWSER_SCROLLBAR_HEIGHT
|
|
48
|
+
// Follow editor to hide by default so it does not show empty gap in SSR
|
|
49
|
+
// https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master/platform/packages/editor/editor-plugin-table/src/nodeviews/TableComponent.tsx#957
|
|
50
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
51
|
+
display: 'block',
|
|
52
|
+
width: '100%'
|
|
53
|
+
};
|
|
54
|
+
var stickyContainerAdditionalStyles = {
|
|
55
|
+
visibility: 'hidden',
|
|
56
|
+
overflowX: 'auto',
|
|
57
|
+
position: 'sticky',
|
|
58
|
+
bottom: "var(--ds-space-0, 0px)",
|
|
59
|
+
zIndex: 1
|
|
60
|
+
};
|
|
46
61
|
var isTableResizingEnabled = exports.isTableResizingEnabled = function isTableResizingEnabled(appearance) {
|
|
47
62
|
return (0, _appearance.isFullWidthOrFullPageAppearance)(appearance) || (0, _appearance.isCommentAppearance)(appearance);
|
|
48
63
|
};
|
|
@@ -102,7 +117,7 @@ var shouldHeaderPinBottom = exports.shouldHeaderPinBottom = function shouldHeade
|
|
|
102
117
|
return tableBottom - rowHeight <= scrollTop && !(tableBottom < scrollTop);
|
|
103
118
|
};
|
|
104
119
|
var addSortableColumn = exports.addSortableColumn = function addSortableColumn(rows, tableOrderStatus, onSorting
|
|
105
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
120
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
106
121
|
) {
|
|
107
122
|
return _react.default.Children.map(rows, function (row, index) {
|
|
108
123
|
if (index === 0) {
|
|
@@ -133,44 +148,53 @@ var isHeaderRowEnabled = exports.isHeaderRowEnabled = function isHeaderRowEnable
|
|
|
133
148
|
return node.type === _tableCell.TableHeader;
|
|
134
149
|
});
|
|
135
150
|
};
|
|
136
|
-
/**
|
|
137
|
-
* This TableWrapper component was created to make sure that the aria-label can be
|
|
138
|
-
* internationalized without needing to add `intl` to the TableContainer.
|
|
139
|
-
*
|
|
140
|
-
* <TableWrapper wrapperRef={ref} onScroll={handleScroll} stickyHeaders={config}>
|
|
141
|
-
* <Table>...</Table>
|
|
142
|
-
* </TableWrapper>
|
|
143
|
-
*/
|
|
144
|
-
var TableWrapper = function TableWrapper(_ref2) {
|
|
145
|
-
var children = _ref2.children,
|
|
146
|
-
wrapperRef = _ref2.wrapperRef,
|
|
147
|
-
onScroll = _ref2.onScroll,
|
|
148
|
-
stickyHeaders = _ref2.stickyHeaders,
|
|
149
|
-
tabIndex = _ref2.tabIndex;
|
|
150
|
-
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
151
|
-
formatMessage = _useIntl.formatMessage;
|
|
152
|
-
var isScrollableRegion = tabIndex !== undefined;
|
|
153
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
154
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
155
|
-
className: _styles.TableSharedCssClassName.TABLE_NODE_WRAPPER,
|
|
156
|
-
ref: wrapperRef,
|
|
157
|
-
onScroll: stickyHeaders ? onScroll : undefined
|
|
158
|
-
// Adding tabIndex here because this is a scrollable container and it needs to be focusable so keyboard users can scroll it.
|
|
159
|
-
// eslint-disable-next-line @atlassian/a11y/no-noninteractive-tabindex
|
|
160
|
-
,
|
|
161
|
-
tabIndex: tabIndex,
|
|
162
|
-
role: isScrollableRegion ? 'region' : undefined,
|
|
163
|
-
"aria-label": isScrollableRegion ? formatMessage(_messages.tableMessages.tableScrollRegion) : undefined
|
|
164
|
-
}, children);
|
|
165
|
-
};
|
|
166
151
|
var tableCanBeSticky = exports.tableCanBeSticky = function tableCanBeSticky(node, children
|
|
167
152
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
168
153
|
) {
|
|
169
154
|
return isHeaderRowEnabled(children) && node && node.firstChild && !hasRowspan(node.firstChild);
|
|
170
155
|
};
|
|
171
156
|
/**
|
|
172
|
-
*
|
|
173
|
-
|
|
157
|
+
* Fake left/right borders rendered as direct children of TABLE_CONTAINER
|
|
158
|
+
* (the non-scrolling parent of the horizontally scrolling TABLE_NODE_WRAPPER).
|
|
159
|
+
*
|
|
160
|
+
* The visible styling for these divs lives in `tableFakeBorderStyles`
|
|
161
|
+
* (`renderer/src/ui/Renderer/RendererStyleContainer.tsx`), which is applied
|
|
162
|
+
* when `isInsideSyncBlock` is true.
|
|
163
|
+
*/
|
|
164
|
+
var TableFakeBorders = function TableFakeBorders(_ref2) {
|
|
165
|
+
var isNumberColumnEnabled = _ref2.isNumberColumnEnabled;
|
|
166
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
167
|
+
className: _styles.TableSharedCssClassName.TABLE_LEFT_BORDER,
|
|
168
|
+
"data-with-numbered-table": isNumberColumnEnabled ? 'true' : undefined,
|
|
169
|
+
"data-testid": "table-left-border"
|
|
170
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
171
|
+
className: _styles.TableSharedCssClassName.TABLE_RIGHT_BORDER,
|
|
172
|
+
"data-with-numbered-table": isNumberColumnEnabled ? 'true' : undefined,
|
|
173
|
+
"data-testid": "table-right-border"
|
|
174
|
+
}));
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Reads `nestedRendererType` from RendererContext and renders the fake left/right
|
|
179
|
+
* borders only when the current renderer is the nested renderer for a reference
|
|
180
|
+
* synced block.
|
|
181
|
+
*/
|
|
182
|
+
var RefSyncBlockFakeBorders = exports.RefSyncBlockFakeBorders = function RefSyncBlockFakeBorders(_ref3) {
|
|
183
|
+
var isNumberColumnEnabled = _ref3.isNumberColumnEnabled;
|
|
184
|
+
var _useRendererContext = (0, _rendererContext.useRendererContext)(),
|
|
185
|
+
nestedRendererType = _useRendererContext.nestedRendererType;
|
|
186
|
+
var isInsideOfRefSyncBlock = nestedRendererType === 'syncedBlock';
|
|
187
|
+
if (!isInsideOfRefSyncBlock) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
return /*#__PURE__*/_react.default.createElement(TableFakeBorders, {
|
|
191
|
+
isNumberColumnEnabled: isNumberColumnEnabled
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* TableContainer renders tables using only CSS-based rules
|
|
197
|
+
*/
|
|
174
198
|
// Ignored via go/ees005
|
|
175
199
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
176
200
|
var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
@@ -193,6 +217,12 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
193
217
|
(0, _defineProperty2.default)(_this, "stickyWrapperRef", /*#__PURE__*/_react.default.createRef());
|
|
194
218
|
(0, _defineProperty2.default)(_this, "wrapperRef", /*#__PURE__*/_react.default.createRef());
|
|
195
219
|
(0, _defineProperty2.default)(_this, "overflowParent", null);
|
|
220
|
+
(0, _defineProperty2.default)(_this, "containerRef", null);
|
|
221
|
+
(0, _defineProperty2.default)(_this, "_isInsideNestedRenderer", null);
|
|
222
|
+
(0, _defineProperty2.default)(_this, "_isInsideTableCell", null);
|
|
223
|
+
// Stores the last computed style values from render() for use by applyNestedRendererTableFix().
|
|
224
|
+
// This avoids reading from the DOM which can be stale when React removes properties between renders.
|
|
225
|
+
(0, _defineProperty2.default)(_this, "lastComputedStyle", {});
|
|
196
226
|
(0, _defineProperty2.default)(_this, "resizeObserver", null);
|
|
197
227
|
(0, _defineProperty2.default)(_this, "applyResizerChange", function (entries) {
|
|
198
228
|
var wrapperWidth = _this.state.wrapperWidth;
|
|
@@ -220,6 +250,25 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
220
250
|
});
|
|
221
251
|
}
|
|
222
252
|
});
|
|
253
|
+
/**
|
|
254
|
+
* Callback ref that captures the container DOM element and also forwards
|
|
255
|
+
* to the handleRef prop from the overflow shadow HOC.
|
|
256
|
+
*/
|
|
257
|
+
(0, _defineProperty2.default)(_this, "setContainerRef", function (el) {
|
|
258
|
+
if (_this.containerRef !== el) {
|
|
259
|
+
_this._isInsideNestedRenderer = null;
|
|
260
|
+
_this._isInsideTableCell = null;
|
|
261
|
+
}
|
|
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
|
+
});
|
|
223
272
|
(0, _defineProperty2.default)(_this, "componentWillUnmount", function () {
|
|
224
273
|
if (_this.overflowParent) {
|
|
225
274
|
// Ignored via go/ees005
|
|
@@ -295,9 +344,148 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
295
344
|
}
|
|
296
345
|
(0, _inherits2.default)(TableContainer, _React$Component);
|
|
297
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
|
+
* Checks if this table is inside a table cell in the DOM. The result is cached
|
|
379
|
+
* since a table's position in the DOM tree is stable after mount.
|
|
380
|
+
*/
|
|
381
|
+
}, {
|
|
382
|
+
key: "isInsideTableCell",
|
|
383
|
+
value: function isInsideTableCell() {
|
|
384
|
+
if (this._isInsideTableCell !== null) {
|
|
385
|
+
return this._isInsideTableCell;
|
|
386
|
+
}
|
|
387
|
+
if (!this.containerRef) {
|
|
388
|
+
return false;
|
|
389
|
+
}
|
|
390
|
+
this._isInsideTableCell = Boolean(this.containerRef.closest('td, th'));
|
|
391
|
+
return this._isInsideTableCell;
|
|
392
|
+
}
|
|
393
|
+
}, {
|
|
394
|
+
key: "isInsideTableContext",
|
|
395
|
+
value: function isInsideTableContext() {
|
|
396
|
+
return Boolean(this.props.isInsideOfTable || this.isInsideTableCell());
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* For tables inside nested renderers (e.g. Include Page macro), the parent
|
|
401
|
+
* renderer's CSS override forces width:100%!important and left:0!important
|
|
402
|
+
* which overrides the inline styles set by this component. Using
|
|
403
|
+
* style.setProperty with 'important' priority on inline styles beats
|
|
404
|
+
* stylesheet !important rules per the CSS cascade.
|
|
405
|
+
*
|
|
406
|
+
* Tables that are nested inside another table need to remain constrained by
|
|
407
|
+
* their table-cell context. Do not promote their width to inline !important,
|
|
408
|
+
* otherwise nested tables rendered through macros such as Excerpt Include can
|
|
409
|
+
* overflow and overlap adjacent cells.
|
|
410
|
+
*
|
|
411
|
+
* Top-level tables in nested renderers still preserve their saved width, but
|
|
412
|
+
* are capped to their containing block so wide tables do not escape constrained
|
|
413
|
+
* macro bodies such as Excerpt Include panels.
|
|
414
|
+
*
|
|
415
|
+
* Uses lastComputedStyle (populated during render) rather than reading from
|
|
416
|
+
* element.style, because React may remove properties from the DOM when their
|
|
417
|
+
* values transition to undefined between renders.
|
|
418
|
+
*
|
|
419
|
+
* `platform_nested_table_style_override_2` fixes a follow-up regression where a
|
|
420
|
+
* NON-resized table inside an Excerpt macro (not Excerpt Include) on a
|
|
421
|
+
* wide/full-width page shrinks to only show its first columns in the renderer.
|
|
422
|
+
* Inside a nested renderer (a macro body) a non-resized table's computed width
|
|
423
|
+
* is a default layout cap (760px/1800px, or a `cqw` length for full-page
|
|
424
|
+
* appearances) taken from the outer renderer's width context. That value does
|
|
425
|
+
* not match the macro's own box, so promoting it to inline `!important` makes
|
|
426
|
+
* the table collapse. Such tables have no author-chosen size to preserve, so
|
|
427
|
+
* under this gate we re-assert the parent stylesheet's intent (fill the box:
|
|
428
|
+
* `width: 100%; left: 0`) with inline `!important`.
|
|
429
|
+
*
|
|
430
|
+
* Explicitly resized tables (`tableNode.attrs.width` set) are excluded and keep
|
|
431
|
+
* the original PGXT-10226 behavior: their author-chosen width/left is promoted
|
|
432
|
+
* verbatim so the Include Page macro does not stretch or indent them. The
|
|
433
|
+
* table-cell short-circuit (PGXT-10294) above also still applies.
|
|
434
|
+
*/
|
|
435
|
+
}, {
|
|
436
|
+
key: "applyNestedRendererTableFix",
|
|
437
|
+
value: function applyNestedRendererTableFix() {
|
|
438
|
+
var _this$props$tableNode;
|
|
439
|
+
if (!this.containerRef || !(0, _fg.fg)('platform_nested_table_style_override')) {
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
if (!this.isInsideNestedRenderer() || this.isInsideTableContext()) {
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
var _this$lastComputedSty = this.lastComputedStyle,
|
|
446
|
+
width = _this$lastComputedSty.width,
|
|
447
|
+
left = _this$lastComputedSty.left,
|
|
448
|
+
marginLeft = _this$lastComputedSty.marginLeft;
|
|
449
|
+
var style = this.containerRef.style;
|
|
450
|
+
|
|
451
|
+
// A table is "explicitly resized" when the author set a width on the node.
|
|
452
|
+
// Non-resized tables instead take a default layout cap (e.g. 760px/1800px)
|
|
453
|
+
// derived from the outer renderer's appearance.
|
|
454
|
+
var isExplicitlyResized = Boolean((_this$props$tableNode = this.props.tableNode) === null || _this$props$tableNode === void 0 ? void 0 : _this$props$tableNode.attrs.width);
|
|
455
|
+
if (!isExplicitlyResized && (0, _fg.fg)('platform_nested_table_style_override_2')) {
|
|
456
|
+
// PGXT-10421: For a NON-resized table inside a nested renderer (e.g. an
|
|
457
|
+
// Excerpt macro body), the computed width is a default layout cap
|
|
458
|
+
// (760px/1800px, or a `cqw` length for full-page appearances) taken from
|
|
459
|
+
// the *outer* renderer's width context. That value does not match the
|
|
460
|
+
// macro's own box, so promoting it to inline `!important` makes the table
|
|
461
|
+
// ignore the available space and collapse to its first columns.
|
|
462
|
+
//
|
|
463
|
+
// These tables have no author-chosen size to preserve, so re-assert the
|
|
464
|
+
// parent stylesheet's intent — fill the available box (`width: 100%`) —
|
|
465
|
+
// with inline `!important` priority so it survives React re-renders and
|
|
466
|
+
// wins over the stylesheet rule that leaks into nested renderers.
|
|
467
|
+
style.setProperty('width', '100%', 'important');
|
|
468
|
+
style.setProperty('max-width', '100%', 'important');
|
|
469
|
+
style.setProperty('left', '0', 'important');
|
|
470
|
+
style.setProperty('margin-left', '0', 'important');
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// PGXT-10226: An explicitly resized table inside a nested renderer (e.g.
|
|
475
|
+
// Include Page macro) must keep its author-chosen width and position. The
|
|
476
|
+
// parent stylesheet forces `width: 100% !important; left: 0 !important`,
|
|
477
|
+
// which would stretch and indent it, so we promote the component's own
|
|
478
|
+
// computed width/left with inline `!important` to win the cascade.
|
|
479
|
+
style.setProperty('width', width || 'auto', 'important');
|
|
480
|
+
style.setProperty('max-width', '100%', 'important');
|
|
481
|
+
style.setProperty('left', left || 'auto', 'important');
|
|
482
|
+
style.setProperty('margin-left', marginLeft || '0', 'important');
|
|
483
|
+
}
|
|
484
|
+
}, {
|
|
298
485
|
key: "componentDidMount",
|
|
299
486
|
value:
|
|
300
487
|
/**
|
|
488
|
+
* Starts observing table dimensions and wires sticky header/scrollbar behavior after mount.
|
|
301
489
|
*
|
|
302
490
|
* @example
|
|
303
491
|
*/
|
|
@@ -319,9 +507,11 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
319
507
|
if (this.wrapperRef.current && isStickyScrollbarEnabled(this.props.rendererAppearance)) {
|
|
320
508
|
this.stickyScrollbar = new _TableStickyScrollbar.TableStickyScrollbar(this.wrapperRef.current);
|
|
321
509
|
}
|
|
510
|
+
this.applyNestedRendererTableFix();
|
|
322
511
|
}
|
|
323
512
|
|
|
324
513
|
/**
|
|
514
|
+
* Updates sticky header wiring and scroll synchronization after prop or state changes.
|
|
325
515
|
*
|
|
326
516
|
* @param prevProps
|
|
327
517
|
* @param prevState
|
|
@@ -350,12 +540,16 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
350
540
|
if (prevState.stickyMode !== this.state.stickyMode) {
|
|
351
541
|
this.onWrapperScrolled();
|
|
352
542
|
}
|
|
543
|
+
|
|
544
|
+
// React re-applies the style prop on every render, which overwrites the
|
|
545
|
+
// !important priorities set at mount time. Re-apply after each update.
|
|
546
|
+
this.applyNestedRendererTableFix();
|
|
353
547
|
}
|
|
354
548
|
}, {
|
|
355
549
|
key: "pinTop",
|
|
356
550
|
get:
|
|
357
551
|
/**
|
|
358
|
-
*
|
|
552
|
+
* Calculates the top offset used when the sticky header is pinned to the table bottom.
|
|
359
553
|
*/
|
|
360
554
|
function get() {
|
|
361
555
|
if (!this.tableRef.current || !this.stickyHeaderRef.current) {
|
|
@@ -365,7 +559,7 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
365
559
|
}
|
|
366
560
|
|
|
367
561
|
/**
|
|
368
|
-
*
|
|
562
|
+
* Determines whether sticky header positioning should include the default scroll root offset.
|
|
369
563
|
*/
|
|
370
564
|
}, {
|
|
371
565
|
key: "shouldAddOverflowParentOffsetTop_DO_NOT_USE",
|
|
@@ -378,7 +572,7 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
378
572
|
}
|
|
379
573
|
|
|
380
574
|
/**
|
|
381
|
-
*
|
|
575
|
+
* Resolves the top position for the sticky header based on the current sticky mode.
|
|
382
576
|
*/
|
|
383
577
|
}, {
|
|
384
578
|
key: "stickyTop",
|
|
@@ -400,6 +594,7 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
400
594
|
}
|
|
401
595
|
|
|
402
596
|
/**
|
|
597
|
+
* Renders the table container, sticky header, table content, sticky scrollbar, and synced block borders.
|
|
403
598
|
*
|
|
404
599
|
* @example
|
|
405
600
|
*/
|
|
@@ -410,7 +605,6 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
410
605
|
var _this$props = this.props,
|
|
411
606
|
isNumberColumnEnabled = _this$props.isNumberColumnEnabled,
|
|
412
607
|
layout = _this$props.layout,
|
|
413
|
-
renderWidth = _this$props.renderWidth,
|
|
414
608
|
columnWidths = _this$props.columnWidths,
|
|
415
609
|
stickyHeaders = _this$props.stickyHeaders,
|
|
416
610
|
tableNode = _this$props.tableNode,
|
|
@@ -425,67 +619,43 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
425
619
|
allowFixedColumnWidthOption = _this$props.allowFixedColumnWidthOption;
|
|
426
620
|
var stickyMode = this.state.stickyMode;
|
|
427
621
|
var lineLengthFixedWidth = _editorSharedStyles.akEditorDefaultLayoutWidth;
|
|
428
|
-
var left;
|
|
429
622
|
var updatedLayout;
|
|
430
|
-
|
|
431
|
-
// The tableWidth and left offset logic below must stay aligned with the `breakout-ssr.tsx` logic
|
|
432
|
-
// Please consider changes below carefully to not negatively impact SSR
|
|
433
|
-
// `renderWidth` cannot be depended on during SSR
|
|
434
|
-
var isRenderWidthValid = !!renderWidth && renderWidth > 0;
|
|
435
623
|
var fullPageRendererWidthCSS = (0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true, {
|
|
436
624
|
exposure: true
|
|
437
625
|
}) ? 'calc(100cqw - var(--ak-renderer--full-page-gutter) * 2)' : "100cqw - ".concat(_style.FullPagePadding, "px * 2");
|
|
438
626
|
var renderWidthCSS = rendererAppearance === 'full-page' ? fullPageRendererWidthCSS : "100cqw";
|
|
439
627
|
var calcDefaultLayoutWidthByAppearance = function calcDefaultLayoutWidthByAppearance(rendererAppearance, tableNode) {
|
|
440
|
-
if (rendererAppearance === '
|
|
441
|
-
return
|
|
442
|
-
} else if (rendererAppearance === '
|
|
443
|
-
return
|
|
628
|
+
if (rendererAppearance === 'max' && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) && ((0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) || (0, _expValEquals.expValEquals)('confluence_max_width_content_appearance', 'isEnabled', true))) {
|
|
629
|
+
return "min(".concat(_editorSharedStyles.akEditorMaxWidthLayoutWidth, "px, ").concat(renderWidthCSS, ")");
|
|
630
|
+
} else if (rendererAppearance === 'full-width' && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width)) {
|
|
631
|
+
return "min(".concat(_editorSharedStyles.akEditorFullWidthLayoutWidth, "px, ").concat(renderWidthCSS, ")");
|
|
444
632
|
} else if (rendererAppearance === 'comment' && allowTableResizing && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width)) {
|
|
445
|
-
|
|
446
|
-
return [isRenderWidthValid ? renderWidth : tableContainerWidth, renderWidthCSS];
|
|
633
|
+
return renderWidthCSS;
|
|
447
634
|
} else {
|
|
448
635
|
// custom width, or width mapped to breakpoint
|
|
449
|
-
var
|
|
450
|
-
return
|
|
636
|
+
var tableContainerWidth = (0, _nodeWidth.getTableContainerWidth)(tableNode);
|
|
637
|
+
return "min(".concat(tableContainerWidth, "px, ").concat(renderWidthCSS, ")");
|
|
451
638
|
}
|
|
452
639
|
};
|
|
453
|
-
var
|
|
454
|
-
_calcDefaultLayoutWid2 = (0, _slicedToArray2.default)(_calcDefaultLayoutWid, 2),
|
|
455
|
-
tableWidth = _calcDefaultLayoutWid2[0],
|
|
456
|
-
tableWidthCSS = _calcDefaultLayoutWid2[1];
|
|
640
|
+
var tableWidthCSS = calcDefaultLayoutWidthByAppearance(rendererAppearance, tableNode);
|
|
457
641
|
|
|
458
642
|
// Logic for table alignment in renderer
|
|
459
643
|
var isTableAlignStart = tableNode && tableNode.attrs && tableNode.attrs.layout === 'align-start' && allowTableAlignment;
|
|
460
|
-
var fullWidthLineLength = isRenderWidthValid ? Math.min(_editorSharedStyles.akEditorFullWidthLayoutWidth, renderWidth) : _editorSharedStyles.akEditorFullWidthLayoutWidth;
|
|
461
644
|
var fullWidthLineLengthCSS = "min(".concat(_editorSharedStyles.akEditorFullWidthLayoutWidth, "px, ").concat(renderWidthCSS, ")");
|
|
462
|
-
var maxWidthLineLength = isRenderWidthValid ? Math.min(_editorSharedStyles.akEditorMaxWidthLayoutWidth, renderWidth) : _editorSharedStyles.akEditorMaxWidthLayoutWidth;
|
|
463
645
|
var maxWidthLineLengthCSS = "min(".concat(_editorSharedStyles.akEditorMaxWidthLayoutWidth, "px, ").concat(renderWidthCSS, ")");
|
|
464
|
-
var commentLineLength = isRenderWidthValid ? renderWidth : lineLengthFixedWidth;
|
|
465
646
|
var isCommentAppearanceAndTableAlignmentEnabled = (0, _appearance.isCommentAppearance)(rendererAppearance) && allowTableAlignment;
|
|
466
|
-
var lineLength = (0, _appearance.isFullWidthAppearance)(rendererAppearance) ? fullWidthLineLength : (0, _appearance.isMaxWidthAppearance)(rendererAppearance) && ((0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) || (0, _expValEquals.expValEquals)('confluence_max_width_content_appearance', 'isEnabled', true)) ? maxWidthLineLength : isCommentAppearanceAndTableAlignmentEnabled ? commentLineLength : lineLengthFixedWidth;
|
|
467
647
|
var lineLengthCSS = (0, _appearance.isFullWidthAppearance)(rendererAppearance) ? fullWidthLineLengthCSS : (0, _appearance.isMaxWidthAppearance)(rendererAppearance) && ((0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) || (0, _expValEquals.expValEquals)('confluence_max_width_content_appearance', 'isEnabled', true)) ? maxWidthLineLengthCSS : isCommentAppearanceAndTableAlignmentEnabled ? renderWidthCSS : "".concat(lineLengthFixedWidth, "px");
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
var fixTableSSRResizing = false;
|
|
471
|
-
var tableWidthNew = fixTableSSRResizing ? (0, _nodeWidth.getTableContainerWidth)(tableNode) : tableWidth;
|
|
472
|
-
var shouldCalculateLeftForAlignment = !isInsideOfBlockNode && !isInsideOfTable && isTableAlignStart && ((0, _appearance.isFullPageAppearance)(rendererAppearance) && tableWidthNew <= lineLengthFixedWidth || (0, _appearance.isFullWidthAppearance)(rendererAppearance) || ((0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) || (0, _expValEquals.expValEquals)('confluence_max_width_content_appearance', 'isEnabled', true)) && (0, _appearance.isMaxWidthAppearance)(rendererAppearance) || isCommentAppearanceAndTableAlignmentEnabled);
|
|
648
|
+
var tableWidthNew = (0, _nodeWidth.getTableContainerWidth)(tableNode);
|
|
649
|
+
var shouldCalculateLeftForAlignment = !isInsideOfBlockNode && !isInsideOfTable && isTableAlignStart && ((0, _appearance.isFullPageAppearance)(rendererAppearance) && tableWidthNew <= lineLengthFixedWidth || (0, _appearance.isFullWidthAppearance)(rendererAppearance) || (0, _appearance.isMaxWidthAppearance)(rendererAppearance) && ((0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) || (0, _expValEquals.expValEquals)('confluence_max_width_content_appearance', 'isEnabled', true)) || isCommentAppearanceAndTableAlignmentEnabled);
|
|
473
650
|
var leftCSS;
|
|
474
651
|
if (shouldCalculateLeftForAlignment) {
|
|
475
|
-
left = (tableWidth - lineLength) / 2;
|
|
476
652
|
leftCSS = "(".concat(tableWidthCSS, " - ").concat(lineLengthCSS, ") / 2");
|
|
477
653
|
}
|
|
478
|
-
if (
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
leftCSS = "min(0px, ".concat(lineLengthCSS, " - ").concat(tableWidthCSS, ") / 2");
|
|
484
|
-
}
|
|
485
|
-
} else {
|
|
486
|
-
if (!shouldCalculateLeftForAlignment && (0, _appearance.isFullPageAppearance)(rendererAppearance) && tableWidthNew > lineLengthFixedWidth) {
|
|
487
|
-
left = lineLengthFixedWidth / 2 - tableWidth / 2;
|
|
488
|
-
}
|
|
654
|
+
if (!shouldCalculateLeftForAlignment && (0, _appearance.isFullPageAppearance)(rendererAppearance)) {
|
|
655
|
+
// Note tableWidthCSS here is the renderer width
|
|
656
|
+
// When the screen is super wide we want table to break out.
|
|
657
|
+
// However if screen is smaller than 760px. We want table align to left.
|
|
658
|
+
leftCSS = "min(0px, ".concat(lineLengthCSS, " - ").concat(tableWidthCSS, ") / 2");
|
|
489
659
|
}
|
|
490
660
|
var children = _react.default.Children.toArray(this.props.children);
|
|
491
661
|
|
|
@@ -505,7 +675,7 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
505
675
|
// We can only use CSS to determine the width when we have a known width in container.
|
|
506
676
|
// When appearance is full-page, full-width or comment we use CSS based width calculation.
|
|
507
677
|
// Otherwise it's fixed table width (customized width) or inherit.
|
|
508
|
-
if (
|
|
678
|
+
if (rendererAppearance === 'full-page' || rendererAppearance === 'full-width' || rendererAppearance === 'max' && ((0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) || (0, _expValEquals.expValEquals)('confluence_max_width_content_appearance', 'isEnabled', true))) {
|
|
509
679
|
finalTableContainerWidth = allowTableResizing ? "calc(".concat(tableWidthCSS, ")") : 'inherit';
|
|
510
680
|
}
|
|
511
681
|
if (rendererAppearance === 'comment' && allowTableResizing && !allowTableAlignment) {
|
|
@@ -516,13 +686,13 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
516
686
|
|
|
517
687
|
// !NOTE: it a table resized to 760 is copied from 'full-page' editor and pasted in comment editor
|
|
518
688
|
// where (allowTableResizing && !allowTableAlignment), the table will loose 760px width.
|
|
519
|
-
finalTableContainerWidth = tableNode !== null && tableNode !== void 0 && tableNode.attrs.width && (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width) !== _editorSharedStyles.akEditorDefaultLayoutWidth ?
|
|
689
|
+
finalTableContainerWidth = tableNode !== null && tableNode !== void 0 && tableNode.attrs.width && (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width) !== _editorSharedStyles.akEditorDefaultLayoutWidth ? "calc(".concat(tableWidthCSS, ")") : 'inherit';
|
|
520
690
|
}
|
|
521
691
|
if (rendererAppearance === 'comment' && allowTableResizing && allowTableAlignment) {
|
|
522
692
|
// If table alignment is enabled and layout is not 'align-start' or 'center', we are loading a table that was
|
|
523
693
|
// created before "Support Table in Comments" FF was enabled. So the table should have the same width as renderer container
|
|
524
694
|
// instead of 760 that was set on tableNode when the table had been published.
|
|
525
|
-
finalTableContainerWidth = ((tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'align-start' || (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'center') && tableNode !== null && tableNode !== void 0 && tableNode.attrs.width ?
|
|
695
|
+
finalTableContainerWidth = ((tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'align-start' || (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'center') && tableNode !== null && tableNode !== void 0 && tableNode.attrs.width ? "calc(".concat(tableWidthCSS, ")") : 'inherit';
|
|
526
696
|
}
|
|
527
697
|
var isContentModeTable = (0, _table2.isTableInContentMode)({
|
|
528
698
|
tableNode: tableNode,
|
|
@@ -532,41 +702,39 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
532
702
|
}),
|
|
533
703
|
isTableNested: isInsideOfBlockNode || isInsideOfNestedRenderer || isInsideOfTable
|
|
534
704
|
}) && (0, _expValEquals.expValEquals)('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true);
|
|
535
|
-
var style
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
});
|
|
552
|
-
}
|
|
705
|
+
var style = _objectSpread(_objectSpread({}, isContentModeTable && {
|
|
706
|
+
'--renderer-table-max-width': renderWidthCSS
|
|
707
|
+
}), {}, {
|
|
708
|
+
width: finalTableContainerWidth,
|
|
709
|
+
left: leftCSS ? "calc(".concat(leftCSS, ")") : undefined,
|
|
710
|
+
marginLeft: shouldCalculateLeftForAlignment && leftCSS !== undefined ? "calc(-1 * (".concat(leftCSS, "))") : undefined
|
|
711
|
+
});
|
|
712
|
+
|
|
713
|
+
// Store computed style values for applyNestedRendererTableFix() to use.
|
|
714
|
+
// Reading from props rather than the DOM ensures correctness when React
|
|
715
|
+
// removes properties (transitions from set to undefined) between renders.
|
|
716
|
+
this.lastComputedStyle = {
|
|
717
|
+
width: typeof style.width === 'number' ? "".concat(style.width, "px") : style.width,
|
|
718
|
+
left: style.left,
|
|
719
|
+
marginLeft: style.marginLeft
|
|
720
|
+
};
|
|
553
721
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
554
722
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
555
723
|
className: "".concat(_styles.TableSharedCssClassName.TABLE_CONTAINER, " ").concat(this.props.shadowClassNames || ''),
|
|
556
724
|
"data-layout": updatedLayout,
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
,
|
|
725
|
+
"data-testid": "table-container",
|
|
726
|
+
ref: this.setContainerRef,
|
|
560
727
|
style: style
|
|
728
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
561
729
|
}, isStickyScrollbarEnabled(this.props.rendererAppearance) && /*#__PURE__*/_react.default.createElement("div", {
|
|
562
730
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
563
731
|
className: _styles.TableSharedCssClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_TOP,
|
|
564
732
|
"data-testid": "sticky-scrollbar-sentinel-top"
|
|
565
|
-
}), stickyHeaders && tableCanBeSticky(tableNode, children) && /*#__PURE__*/_react.default.createElement(_sticky.StickyTable, {
|
|
733
|
+
}), stickyHeaders && tableNode && !isContentModeTable && tableCanBeSticky(tableNode, children) && /*#__PURE__*/_react.default.createElement(_sticky.StickyTable, {
|
|
566
734
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
567
|
-
tableWidth:
|
|
735
|
+
tableWidth: "inherit",
|
|
736
|
+
renderWidth: 0,
|
|
568
737
|
layout: layout,
|
|
569
|
-
renderWidth: renderWidth,
|
|
570
738
|
handleRef: this.props.handleRef,
|
|
571
739
|
shadowClassNames: this.props.shadowClassNames,
|
|
572
740
|
top: this.stickyTop,
|
|
@@ -579,17 +747,23 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
579
747
|
rendererAppearance: rendererAppearance,
|
|
580
748
|
allowTableResizing: allowTableResizing,
|
|
581
749
|
allowFixedColumnWidthOption: allowFixedColumnWidthOption
|
|
582
|
-
}, [children && children[0]]), /*#__PURE__*/_react.default.createElement(
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
750
|
+
}, [children && children[0]]), /*#__PURE__*/_react.default.createElement("div", {
|
|
751
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
752
|
+
className: _styles.TableSharedCssClassName.TABLE_NODE_WRAPPER,
|
|
753
|
+
ref: this.wrapperRef,
|
|
754
|
+
"data-number-column": tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.isNumberColumnEnabled,
|
|
755
|
+
"data-layout": tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout,
|
|
756
|
+
"data-autosize": tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.__autoSize,
|
|
757
|
+
"data-table-local-id": tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.localId,
|
|
758
|
+
"data-table-width": tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width,
|
|
759
|
+
"data-vc": "table-node-wrapper",
|
|
760
|
+
onScroll: this.props.stickyHeaders && this.onWrapperScrolled
|
|
587
761
|
}, /*#__PURE__*/_react.default.createElement(_table.Table, {
|
|
588
762
|
innerRef: this.tableRef,
|
|
589
763
|
columnWidths: columnWidths,
|
|
590
764
|
layout: layout,
|
|
765
|
+
renderWidth: 0,
|
|
591
766
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
592
|
-
renderWidth: renderWidth,
|
|
593
767
|
tableNode: tableNode,
|
|
594
768
|
rendererAppearance: rendererAppearance,
|
|
595
769
|
isInsideOfBlockNode: isInsideOfBlockNode,
|
|
@@ -601,22 +775,13 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
601
775
|
allowFixedColumnWidthOption: allowFixedColumnWidthOption
|
|
602
776
|
}, this.grabFirstRowRef(children))), isStickyScrollbarEnabled(this.props.rendererAppearance) && /*#__PURE__*/_react.default.createElement("div", {
|
|
603
777
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
604
|
-
className: _styles.TableSharedCssClassName.TABLE_STICKY_SCROLLBAR_CONTAINER,
|
|
778
|
+
className: "".concat(_styles.TableSharedCssClassName.TABLE_STICKY_SCROLLBAR_CONTAINER).concat((0, _fg.fg)('confluence_frontend_table_scrollbar_ttvc_fix') ? '-view-page' : ''),
|
|
605
779
|
ref: this.stickyScrollbarRef,
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
height: "var(--ds-space-250, 20px)",
|
|
609
|
-
// MAX_BROWSER_SCROLLBAR_HEIGHT
|
|
610
|
-
// Follow editor to hide by default so it does not show empty gap in SSR
|
|
611
|
-
// https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master/platform/packages/editor/editor-plugin-table/src/nodeviews/TableComponent.tsx#957
|
|
612
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
613
|
-
display: fixTableSSRResizing ? 'none' : 'block',
|
|
614
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
615
|
-
width: '100%'
|
|
616
|
-
}
|
|
780
|
+
"data-vc": "table-sticky-scrollbar-container",
|
|
781
|
+
style: (0, _fg.fg)('confluence_frontend_table_scrollbar_ttvc_fix') ? _objectSpread(_objectSpread({}, stickyContainerBaseStyles), stickyContainerAdditionalStyles) : stickyContainerBaseStyles
|
|
617
782
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
618
783
|
style: {
|
|
619
|
-
width: (_this$tableRef$curren = this.tableRef.current) === null || _this$tableRef$curren === void 0 ? void 0 : _this$tableRef$curren.clientWidth,
|
|
784
|
+
width: (0, _fg.fg)('confluence_frontend_table_scrollbar_ttvc_fix') ? '100%' : (_this$tableRef$curren = this.tableRef.current) === null || _this$tableRef$curren === void 0 ? void 0 : _this$tableRef$curren.clientWidth,
|
|
620
785
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
621
786
|
height: '100%'
|
|
622
787
|
}
|
|
@@ -624,25 +789,123 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
624
789
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
625
790
|
className: _styles.TableSharedCssClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_BOTTOM,
|
|
626
791
|
"data-testid": "sticky-scrollbar-sentinel-bottom"
|
|
627
|
-
}), /*#__PURE__*/_react.default.createElement(
|
|
792
|
+
}), /*#__PURE__*/_react.default.createElement(RefSyncBlockFakeBorders, {
|
|
628
793
|
isNumberColumnEnabled: isNumberColumnEnabled
|
|
629
794
|
})));
|
|
630
795
|
}
|
|
631
796
|
}]);
|
|
632
797
|
}(_react.default.Component);
|
|
798
|
+
var getCellEdgePropsByCellOffset = function getCellEdgePropsByCellOffset(tableNode, isNumberColumnEnabled) {
|
|
799
|
+
var cellEdgePropsByCellOffset = new Map();
|
|
800
|
+
var cellRightByCellOffset = new Map();
|
|
801
|
+
var occupiedGrid = [];
|
|
802
|
+
var tableWidth = 0;
|
|
803
|
+
var cellOffset = 0;
|
|
804
|
+
tableNode.forEach(function (rowNode, _rowOffset, rowIndex) {
|
|
805
|
+
var _occupiedGrid$rowInde;
|
|
806
|
+
occupiedGrid[rowIndex] = (_occupiedGrid$rowInde = occupiedGrid[rowIndex]) !== null && _occupiedGrid$rowInde !== void 0 ? _occupiedGrid$rowInde : [];
|
|
807
|
+
var columnIndex = 0;
|
|
808
|
+
cellOffset += 1;
|
|
809
|
+
rowNode.forEach(function (cellNode) {
|
|
810
|
+
while (occupiedGrid[rowIndex][columnIndex]) {
|
|
811
|
+
columnIndex += 1;
|
|
812
|
+
}
|
|
813
|
+
var colspan = cellNode.attrs.colspan || 1;
|
|
814
|
+
var rowspan = cellNode.attrs.rowspan || 1;
|
|
815
|
+
var cellLeft = columnIndex;
|
|
816
|
+
var cellRight = cellLeft + colspan;
|
|
817
|
+
var cellTop = rowIndex;
|
|
818
|
+
var cellBottom = cellTop + rowspan;
|
|
819
|
+
for (var row = cellTop; row < cellBottom; row += 1) {
|
|
820
|
+
var _occupiedGrid$row;
|
|
821
|
+
occupiedGrid[row] = (_occupiedGrid$row = occupiedGrid[row]) !== null && _occupiedGrid$row !== void 0 ? _occupiedGrid$row : [];
|
|
822
|
+
for (var column = cellLeft; column < cellRight; column += 1) {
|
|
823
|
+
occupiedGrid[row][column] = true;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
tableWidth = Math.max(tableWidth, cellRight);
|
|
827
|
+
cellRightByCellOffset.set(cellOffset, cellRight);
|
|
828
|
+
cellEdgePropsByCellOffset.set(cellOffset, {
|
|
829
|
+
reachesBottom: cellBottom >= tableNode.childCount,
|
|
830
|
+
// With number column enabled, PM column 0 is not visually leftmost and must not get `data-reaches-left`.
|
|
831
|
+
reachesLeft: cellLeft === 0 && !isNumberColumnEnabled,
|
|
832
|
+
reachesRight: false,
|
|
833
|
+
reachesTop: cellTop === 0
|
|
834
|
+
});
|
|
835
|
+
columnIndex = cellRight;
|
|
836
|
+
cellOffset += cellNode.nodeSize;
|
|
837
|
+
});
|
|
838
|
+
cellOffset += 1;
|
|
839
|
+
});
|
|
840
|
+
cellRightByCellOffset.forEach(function (cellRight, currentCellOffset) {
|
|
841
|
+
var edgeProps = cellEdgePropsByCellOffset.get(currentCellOffset);
|
|
842
|
+
if (edgeProps) {
|
|
843
|
+
edgeProps.reachesRight = cellRight >= tableWidth;
|
|
844
|
+
}
|
|
845
|
+
});
|
|
846
|
+
return cellEdgePropsByCellOffset;
|
|
847
|
+
};
|
|
848
|
+
var isRenderedTableCell = function isRenderedTableCell(element) {
|
|
849
|
+
var _ref4 = element.props,
|
|
850
|
+
nodeType = _ref4.nodeType;
|
|
851
|
+
return nodeType === 'tableCell' || nodeType === 'tableHeader' || element.type === _tableCell.TableCell || element.type === _tableCell.TableHeader;
|
|
852
|
+
};
|
|
853
|
+
var addTableCellEdgePropsThroughWrappers = function addTableCellEdgePropsThroughWrappers(rows, tableNode, isNumberColumnEnabled) {
|
|
854
|
+
try {
|
|
855
|
+
if (!tableNode) {
|
|
856
|
+
return rows;
|
|
857
|
+
}
|
|
858
|
+
var cellEdgePropsByCellOffset = getCellEdgePropsByCellOffset(tableNode, isNumberColumnEnabled);
|
|
859
|
+
var cellOffset = 0;
|
|
860
|
+
return _react.default.Children.map(rows, function (row, rowIndex) {
|
|
861
|
+
var rowNode = tableNode.child(rowIndex);
|
|
862
|
+
cellOffset += 1;
|
|
863
|
+
var cellIndex = 0;
|
|
864
|
+
var _addEdgePropsToRenderedCells = function addEdgePropsToRenderedCells(element) {
|
|
865
|
+
if (isRenderedTableCell(element)) {
|
|
866
|
+
var cellNode = rowNode.child(cellIndex);
|
|
867
|
+
var edgeProps = cellEdgePropsByCellOffset.get(cellOffset);
|
|
868
|
+
cellIndex += 1;
|
|
869
|
+
cellOffset += cellNode.nodeSize;
|
|
870
|
+
return edgeProps ? /*#__PURE__*/_react.default.cloneElement(element, edgeProps) : element;
|
|
871
|
+
}
|
|
872
|
+
var _ref5 = element.props,
|
|
873
|
+
children = _ref5.children;
|
|
874
|
+
if (children === undefined) {
|
|
875
|
+
return element;
|
|
876
|
+
}
|
|
877
|
+
var childrenWithEdgeProps = _react.default.Children.map(children, function (child) {
|
|
878
|
+
return /*#__PURE__*/_react.default.isValidElement(child) ? _addEdgePropsToRenderedCells(child) : child;
|
|
879
|
+
});
|
|
880
|
+
return /*#__PURE__*/_react.default.cloneElement(element, undefined, childrenWithEdgeProps);
|
|
881
|
+
};
|
|
882
|
+
var rowWithEdgeProps = _addEdgePropsToRenderedCells(row);
|
|
883
|
+
if (cellIndex !== rowNode.childCount) {
|
|
884
|
+
throw new Error('Rendered table row does not match its document node');
|
|
885
|
+
}
|
|
886
|
+
cellOffset += 1;
|
|
887
|
+
return rowWithEdgeProps;
|
|
888
|
+
});
|
|
889
|
+
} catch (_unused) {
|
|
890
|
+
// Renderer can receive malformed historical ADF. If the table shape cannot
|
|
891
|
+
// be described safely, keep rendering without rounded edge metadata.
|
|
892
|
+
return rows;
|
|
893
|
+
}
|
|
894
|
+
};
|
|
895
|
+
|
|
633
896
|
/**
|
|
634
|
-
*
|
|
897
|
+
* Processes table children before passing them to the styled table container.
|
|
635
898
|
*/
|
|
636
899
|
// Ignored via go/ees005
|
|
637
900
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
638
|
-
var
|
|
639
|
-
function
|
|
901
|
+
var TableProcessorWithContainerStyles = exports.TableProcessorWithContainerStyles = /*#__PURE__*/function (_React$Component2) {
|
|
902
|
+
function TableProcessorWithContainerStyles() {
|
|
640
903
|
var _this2;
|
|
641
|
-
(0, _classCallCheck2.default)(this,
|
|
904
|
+
(0, _classCallCheck2.default)(this, TableProcessorWithContainerStyles);
|
|
642
905
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
643
906
|
args[_key2] = arguments[_key2];
|
|
644
907
|
}
|
|
645
|
-
_this2 = _callSuper(this,
|
|
908
|
+
_this2 = _callSuper(this, TableProcessorWithContainerStyles, [].concat(args));
|
|
646
909
|
(0, _defineProperty2.default)(_this2, "state", {
|
|
647
910
|
tableOrderStatus: undefined
|
|
648
911
|
});
|
|
@@ -671,51 +934,86 @@ var TableProcessor = exports.TableProcessor = /*#__PURE__*/function (_React$Comp
|
|
|
671
934
|
(0, _defineProperty2.default)(_this2, "addNumberColumnIndexes", function (rows) {
|
|
672
935
|
var isNumberColumnEnabled = _this2.props.isNumberColumnEnabled;
|
|
673
936
|
var headerRowEnabled = isHeaderRowEnabled(rows);
|
|
937
|
+
var lastRowIndex = _react.default.Children.count(rows) - 1;
|
|
674
938
|
return _react.default.Children.map(rows, function (row, index) {
|
|
675
939
|
return /*#__PURE__*/_react.default.cloneElement(_react.default.Children.only(row), {
|
|
676
940
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
677
|
-
index: headerRowEnabled ? index === 0 ? '' : index : index + 1
|
|
941
|
+
index: headerRowEnabled ? index === 0 ? '' : index : index + 1,
|
|
942
|
+
isFirstRow: index === 0,
|
|
943
|
+
isLastRow: index === lastRowIndex
|
|
678
944
|
});
|
|
679
945
|
});
|
|
680
946
|
});
|
|
681
947
|
return _this2;
|
|
682
948
|
}
|
|
683
|
-
(0, _inherits2.default)(
|
|
684
|
-
return (0, _createClass2.default)(
|
|
949
|
+
(0, _inherits2.default)(TableProcessorWithContainerStyles, _React$Component2);
|
|
950
|
+
return (0, _createClass2.default)(TableProcessorWithContainerStyles, [{
|
|
685
951
|
key: "render",
|
|
686
952
|
value:
|
|
687
953
|
/**
|
|
954
|
+
* Renders processed table children inside the table container.
|
|
688
955
|
*
|
|
689
956
|
* @example
|
|
690
957
|
*/
|
|
691
958
|
function render() {
|
|
692
|
-
var
|
|
959
|
+
var _this$props2 = this.props,
|
|
960
|
+
allowColumnSorting = _this$props2.allowColumnSorting,
|
|
961
|
+
allowFixedColumnWidthOption = _this$props2.allowFixedColumnWidthOption,
|
|
962
|
+
allowTableAlignment = _this$props2.allowTableAlignment,
|
|
963
|
+
allowTableResizing = _this$props2.allowTableResizing,
|
|
964
|
+
children = _this$props2.children,
|
|
965
|
+
columnWidths = _this$props2.columnWidths,
|
|
966
|
+
disableTableOverflowShadow = _this$props2.disableTableOverflowShadow,
|
|
967
|
+
handleRef = _this$props2.handleRef,
|
|
968
|
+
isinsideMultiBodiedExtension = _this$props2.isinsideMultiBodiedExtension,
|
|
969
|
+
isInsideOfBlockNode = _this$props2.isInsideOfBlockNode,
|
|
970
|
+
isInsideOfNestedRenderer = _this$props2.isInsideOfNestedRenderer,
|
|
971
|
+
isInsideOfTable = _this$props2.isInsideOfTable,
|
|
972
|
+
isNumberColumnEnabled = _this$props2.isNumberColumnEnabled,
|
|
973
|
+
isPresentational = _this$props2.isPresentational,
|
|
974
|
+
layout = _this$props2.layout,
|
|
975
|
+
rendererAppearance = _this$props2.rendererAppearance,
|
|
976
|
+
renderWidth = _this$props2.renderWidth,
|
|
977
|
+
shadowClassNames = _this$props2.shadowClassNames,
|
|
978
|
+
smartCardStorage = _this$props2.smartCardStorage,
|
|
979
|
+
stickyHeaders = _this$props2.stickyHeaders,
|
|
980
|
+
tabIndex = _this$props2.tabIndex,
|
|
981
|
+
tableNode = _this$props2.tableNode;
|
|
693
982
|
if (!children) {
|
|
694
983
|
return null;
|
|
695
984
|
}
|
|
696
985
|
var childrenArray = _react.default.Children.toArray(children);
|
|
986
|
+
var childrenWithTableEdgeProps = (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? addTableCellEdgePropsThroughWrappers(childrenArray, tableNode, isNumberColumnEnabled) : childrenArray;
|
|
697
987
|
var orderedChildren = (0, _utils.compose)(this.addNumberColumnIndexes, this.addSortableColumn
|
|
698
988
|
// @ts-expect-error TS2345: Argument of type '(ReactChild | ReactFragment | ReactPortal)[]' is not assignable to parameter of type 'ReactElement<any, string | JSXElementConstructor<any>>[]'
|
|
699
|
-
)(
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
989
|
+
)(childrenWithTableEdgeProps);
|
|
990
|
+
return /*#__PURE__*/_react.default.createElement(TableContainer, {
|
|
991
|
+
allowColumnSorting: allowColumnSorting,
|
|
992
|
+
allowFixedColumnWidthOption: allowFixedColumnWidthOption,
|
|
993
|
+
allowTableAlignment: allowTableAlignment,
|
|
994
|
+
allowTableResizing: allowTableResizing,
|
|
995
|
+
columnWidths: columnWidths,
|
|
996
|
+
disableTableOverflowShadow: disableTableOverflowShadow,
|
|
997
|
+
handleRef: handleRef,
|
|
998
|
+
isinsideMultiBodiedExtension: isinsideMultiBodiedExtension,
|
|
999
|
+
isInsideOfBlockNode: isInsideOfBlockNode,
|
|
1000
|
+
isInsideOfNestedRenderer: isInsideOfNestedRenderer,
|
|
1001
|
+
isInsideOfTable: isInsideOfTable,
|
|
1002
|
+
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
1003
|
+
isPresentational: isPresentational,
|
|
1004
|
+
layout: layout,
|
|
1005
|
+
rendererAppearance: rendererAppearance,
|
|
1006
|
+
renderWidth: renderWidth,
|
|
1007
|
+
shadowClassNames: shadowClassNames,
|
|
1008
|
+
smartCardStorage: smartCardStorage,
|
|
1009
|
+
stickyHeaders: stickyHeaders,
|
|
1010
|
+
tabIndex: tabIndex,
|
|
1011
|
+
tableNode: tableNode
|
|
1012
|
+
}, orderedChildren);
|
|
704
1013
|
}
|
|
705
1014
|
}]);
|
|
706
1015
|
}(_react.default.Component); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
707
|
-
var TableWithShadowsAndContainerStyles = (0, _ui.overflowShadow)(
|
|
708
|
-
/**
|
|
709
|
-
* The :scope is in reference to table container and we are selecting only
|
|
710
|
-
* direct children that match the table node wrapper selector, not their
|
|
711
|
-
* descendants.
|
|
712
|
-
*/
|
|
713
|
-
overflowSelector: ":scope > .".concat(_styles.TableSharedCssClassName.TABLE_NODE_WRAPPER),
|
|
714
|
-
useShadowObserver: true
|
|
715
|
-
});
|
|
716
|
-
|
|
717
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
718
|
-
var TableWithShadows = (0, _ui.overflowShadow)(TableProcessor, {
|
|
1016
|
+
var TableWithShadowsAndContainerStyles = (0, _ui.overflowShadow)(TableProcessorWithContainerStyles, {
|
|
719
1017
|
/**
|
|
720
1018
|
* The :scope is in reference to table container and we are selecting only
|
|
721
1019
|
* direct children that match the table node wrapper selector, not their
|
|
@@ -725,59 +1023,29 @@ var TableWithShadows = (0, _ui.overflowShadow)(TableProcessor, {
|
|
|
725
1023
|
useShadowObserver: true
|
|
726
1024
|
});
|
|
727
1025
|
var TableWithWidth = function TableWithWidth(props) {
|
|
728
|
-
var
|
|
729
|
-
|
|
1026
|
+
var _props$columnWidths;
|
|
1027
|
+
var _useRendererContext2 = (0, _rendererContext.useRendererContext)(),
|
|
1028
|
+
isTopLevelRenderer = _useRendererContext2.isTopLevelRenderer;
|
|
730
1029
|
var isInsideOfNestedRenderer = isTopLevelRenderer === false && (0, _expValEquals.expValEquals)('platform_editor_table_nested_content_mode_fix', 'isEnabled', true);
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
if (colWidthsSum || props.allowTableResizing) {
|
|
739
|
-
return /*#__PURE__*/_react.default.createElement(TableWithShadowsAndContainerStyles
|
|
740
|
-
// Ignored via go/ees005
|
|
741
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
742
|
-
, (0, _extends2.default)({}, props, {
|
|
743
|
-
isInsideOfNestedRenderer: isInsideOfNestedRenderer
|
|
744
|
-
}));
|
|
745
|
-
}
|
|
746
|
-
return /*#__PURE__*/_react.default.createElement(_tableNew.TableProcessorWithContainerStyles
|
|
1030
|
+
var colWidthsSum =
|
|
1031
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-expensive-computations-in-render -- Ignored via go/ees017 (to be fixed)
|
|
1032
|
+
((_props$columnWidths = props.columnWidths) === null || _props$columnWidths === void 0 ? void 0 : _props$columnWidths.reduce(function (total, val) {
|
|
1033
|
+
return total + val;
|
|
1034
|
+
}, 0)) || 0;
|
|
1035
|
+
if (colWidthsSum || props.allowTableResizing) {
|
|
1036
|
+
return /*#__PURE__*/_react.default.createElement(TableWithShadowsAndContainerStyles
|
|
747
1037
|
// Ignored via go/ees005
|
|
748
1038
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
749
1039
|
, (0, _extends2.default)({}, props, {
|
|
750
1040
|
isInsideOfNestedRenderer: isInsideOfNestedRenderer
|
|
751
1041
|
}));
|
|
752
|
-
} else {
|
|
753
|
-
return /*#__PURE__*/_react.default.createElement(_ui.WidthConsumer, null, function (_ref3) {
|
|
754
|
-
var _props$columnWidths2;
|
|
755
|
-
var width = _ref3.width;
|
|
756
|
-
var renderWidth = props.rendererAppearance === 'full-page' ? width - _style.FullPagePadding * 2 : width;
|
|
757
|
-
var colWidthsSum =
|
|
758
|
-
// eslint-disable-next-line @atlassian/perf-linting/no-expensive-computations-in-render -- Ignored via go/ees017 (to be fixed)
|
|
759
|
-
((_props$columnWidths2 = props.columnWidths) === null || _props$columnWidths2 === void 0 ? void 0 : _props$columnWidths2.reduce(function (total, val) {
|
|
760
|
-
return total + val;
|
|
761
|
-
}, 0)) || 0;
|
|
762
|
-
if (colWidthsSum || props.allowTableResizing) {
|
|
763
|
-
return /*#__PURE__*/_react.default.createElement(TableWithShadows, (0, _extends2.default)({
|
|
764
|
-
renderWidth: renderWidth
|
|
765
|
-
// Ignored via go/ees005
|
|
766
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
767
|
-
}, props, {
|
|
768
|
-
isInsideOfNestedRenderer: isInsideOfNestedRenderer
|
|
769
|
-
}));
|
|
770
|
-
}
|
|
771
|
-
// there should not be a case when colWidthsSum is 0 and table is in overflow state - so no need to render shadows in this case
|
|
772
|
-
return /*#__PURE__*/_react.default.createElement(TableProcessor, (0, _extends2.default)({
|
|
773
|
-
renderWidth: renderWidth
|
|
774
|
-
// Ignored via go/ees005
|
|
775
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
776
|
-
}, props, {
|
|
777
|
-
isInsideOfNestedRenderer: isInsideOfNestedRenderer
|
|
778
|
-
}));
|
|
779
|
-
});
|
|
780
1042
|
}
|
|
1043
|
+
return /*#__PURE__*/_react.default.createElement(TableProcessorWithContainerStyles
|
|
1044
|
+
// Ignored via go/ees005
|
|
1045
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
1046
|
+
, (0, _extends2.default)({}, props, {
|
|
1047
|
+
isInsideOfNestedRenderer: isInsideOfNestedRenderer
|
|
1048
|
+
}));
|
|
781
1049
|
};
|
|
782
1050
|
var _default_1 = (0, _SmartCardStorage.withSmartCardStorage)(TableWithWidth);
|
|
783
1051
|
var _default = exports.default = _default_1;
|