@atlaskit/renderer 114.11.1 → 114.12.0
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 +20 -0
- package/afm-cc/tsconfig.json +3 -0
- package/dist/cjs/react/marks/alignment.js +3 -15
- package/dist/cjs/react/nodes/blockCard.js +24 -8
- package/dist/cjs/react/nodes/codeBlock/components/codeBlockContainer.js +3 -10
- package/dist/cjs/react/nodes/codeBlock/components/lightWeightCodeBlock.js +8 -53
- package/dist/cjs/react/nodes/layoutColumn.js +3 -11
- package/dist/cjs/react/nodes/media/index.js +28 -58
- package/dist/cjs/react/nodes/panel.js +2 -26
- package/dist/cjs/react/nodes/table/colgroup.js +5 -2
- package/dist/cjs/react/nodes/table/sticky.js +3 -57
- package/dist/cjs/react/nodes/table/table.js +6 -1
- package/dist/cjs/react/nodes/table.js +51 -23
- package/dist/cjs/react/nodes/tableNew.js +550 -0
- package/dist/cjs/ui/Expand.js +12 -62
- package/dist/cjs/ui/Renderer/RendererStyleContainer.js +19 -42
- package/dist/cjs/ui/Renderer/breakout-ssr.js +22 -22
- package/dist/cjs/ui/Renderer/index.js +4 -2
- package/dist/cjs/ui/Renderer/style.js +2 -208
- package/dist/cjs/ui/annotations/draft/component.js +2 -17
- package/dist/cjs/ui/annotations/element/mark.js +12 -61
- package/dist/es2019/react/marks/alignment.js +2 -17
- package/dist/es2019/react/nodes/blockCard.js +24 -8
- package/dist/es2019/react/nodes/codeBlock/components/codeBlockContainer.js +2 -39
- package/dist/es2019/react/nodes/codeBlock/components/lightWeightCodeBlock.js +5 -50
- package/dist/es2019/react/nodes/layoutColumn.js +4 -12
- package/dist/es2019/react/nodes/media/index.js +3 -36
- package/dist/es2019/react/nodes/panel.js +2 -41
- package/dist/es2019/react/nodes/table/colgroup.js +5 -2
- package/dist/es2019/react/nodes/table/sticky.js +3 -70
- package/dist/es2019/react/nodes/table/table.js +6 -1
- package/dist/es2019/react/nodes/table.js +50 -22
- package/dist/es2019/react/nodes/tableNew.js +501 -0
- package/dist/es2019/ui/Expand.js +11 -67
- package/dist/es2019/ui/Renderer/RendererStyleContainer.js +20 -43
- package/dist/es2019/ui/Renderer/breakout-ssr.js +22 -22
- package/dist/es2019/ui/Renderer/index.js +4 -2
- package/dist/es2019/ui/Renderer/style.js +1 -889
- package/dist/es2019/ui/annotations/draft/component.js +2 -15
- package/dist/es2019/ui/annotations/element/mark.js +9 -71
- package/dist/esm/react/marks/alignment.js +2 -16
- package/dist/esm/react/nodes/blockCard.js +24 -8
- package/dist/esm/react/nodes/codeBlock/components/codeBlockContainer.js +2 -11
- package/dist/esm/react/nodes/codeBlock/components/lightWeightCodeBlock.js +7 -52
- package/dist/esm/react/nodes/layoutColumn.js +4 -12
- package/dist/esm/react/nodes/media/index.js +28 -58
- package/dist/esm/react/nodes/panel.js +3 -27
- package/dist/esm/react/nodes/table/colgroup.js +5 -2
- package/dist/esm/react/nodes/table/sticky.js +3 -57
- package/dist/esm/react/nodes/table/table.js +6 -1
- package/dist/esm/react/nodes/table.js +51 -21
- package/dist/esm/react/nodes/tableNew.js +544 -0
- package/dist/esm/ui/Expand.js +12 -62
- package/dist/esm/ui/Renderer/RendererStyleContainer.js +20 -43
- package/dist/esm/ui/Renderer/breakout-ssr.js +22 -22
- package/dist/esm/ui/Renderer/index.js +4 -2
- package/dist/esm/ui/Renderer/style.js +1 -203
- package/dist/esm/ui/annotations/draft/component.js +2 -17
- package/dist/esm/ui/annotations/element/mark.js +9 -56
- package/dist/types/react/nodes/codeBlock/components/lightWeightCodeBlock.d.ts +1 -1
- package/dist/types/react/nodes/table.d.ts +35 -254
- package/dist/types/react/nodes/tableNew.d.ts +83 -0
- package/dist/types/ui/Renderer/breakout-ssr.d.ts +1 -2
- package/dist/types/ui/Renderer/style.d.ts +0 -11
- package/dist/types/ui/annotations/element/mark.d.ts +30 -6
- package/dist/types-ts4.5/react/nodes/codeBlock/components/lightWeightCodeBlock.d.ts +1 -1
- package/dist/types-ts4.5/react/nodes/table.d.ts +35 -254
- package/dist/types-ts4.5/react/nodes/tableNew.d.ts +83 -0
- package/dist/types-ts4.5/ui/Renderer/breakout-ssr.d.ts +1 -2
- package/dist/types-ts4.5/ui/Renderer/style.d.ts +0 -11
- package/dist/types-ts4.5/ui/annotations/element/mark.d.ts +30 -6
- package/package.json +14 -7
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
3
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var
|
|
5
|
-
var _excluded = ["backgroundColor", "hasIcon"],
|
|
6
|
-
_excluded2 = ["backgroundColor", "hasIcon"];
|
|
3
|
+
var _excluded = ["backgroundColor", "hasIcon"];
|
|
7
4
|
/**
|
|
8
5
|
* @jsxRuntime classic
|
|
9
6
|
* @jsx jsx
|
|
@@ -13,13 +10,12 @@ import React from 'react';
|
|
|
13
10
|
import { css, jsx } from '@emotion/react';
|
|
14
11
|
import TipIcon from '@atlaskit/icon/core/migration/lightbulb--editor-hint';
|
|
15
12
|
import { PanelType } from '@atlaskit/adf-schema';
|
|
16
|
-
import { PanelSharedCssClassName
|
|
13
|
+
import { PanelSharedCssClassName } from '@atlaskit/editor-common/panel';
|
|
17
14
|
import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
18
15
|
import EmojiIcon from '@atlaskit/icon/core/migration/emoji--editor-emoji';
|
|
19
16
|
import EmojiItem from './emoji';
|
|
20
17
|
import { PanelInfoIcon, PanelSuccessIcon, PanelNoteIcon, PanelWarningIcon, PanelErrorIcon } from '@atlaskit/editor-common/icons';
|
|
21
18
|
import { akEditorCustomIconSize } from '@atlaskit/editor-shared-styles/consts';
|
|
22
|
-
import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
|
|
23
19
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
24
20
|
// New custom icons are a little smaller than predefined icons.
|
|
25
21
|
// To fix alignment issues with custom icons, vertical alignment is updated.
|
|
@@ -160,29 +156,10 @@ var panelCustomBackground = css({
|
|
|
160
156
|
}
|
|
161
157
|
}
|
|
162
158
|
});
|
|
163
|
-
var
|
|
159
|
+
var PanelStyled = function PanelStyled(_ref) {
|
|
164
160
|
var backgroundColor = _ref.backgroundColor,
|
|
165
161
|
hasIcon = _ref.hasIcon,
|
|
166
162
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
167
|
-
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- nested css mixins are violations
|
|
168
|
-
var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t\t&.", " {\n\t\t\t", "\n\n\t\t\t&[data-panel-type=", "] {\n\t\t\t\t", "\n\t\t\t}\n\t\t}\n\t"])), PanelSharedCssClassName.prefix, panelSharedStylesWithoutPrefix(), PanelType.CUSTOM, hasIcon ? '' : 'padding-left: 12px;padding-right: 12px;');
|
|
169
|
-
if (props['data-panel-type'] === PanelType.CUSTOM && backgroundColor) {
|
|
170
|
-
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- nested css mixins are violations
|
|
171
|
-
styles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n\t\t\t&.", " {\n\t\t\t\t", "\n\t\t\t}\n\n\t\t\t&[data-panel-type=", "] {\n\t\t\t\tbackground-color: ", ";\n\t\t\t\t", "\n\t\t\t}\n\t\t"])), PanelSharedCssClassName.prefix, panelSharedStylesWithoutPrefix(), PanelType.CUSTOM, hexToEditorBackgroundPaletteColor(backgroundColor) || backgroundColor, hasIcon ? '' : 'padding-left: 12px;padding-right: 12px;');
|
|
172
|
-
}
|
|
173
|
-
return (
|
|
174
|
-
// eslint-disable-next-line
|
|
175
|
-
// Ignored via go/ees005
|
|
176
|
-
// eslint-disable-next-line react/jsx-props-no-spreading, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
177
|
-
jsx("div", _extends({
|
|
178
|
-
css: styles
|
|
179
|
-
}, props), props.children)
|
|
180
|
-
);
|
|
181
|
-
};
|
|
182
|
-
var PanelStyledNew = function PanelStyledNew(_ref2) {
|
|
183
|
-
var backgroundColor = _ref2.backgroundColor,
|
|
184
|
-
hasIcon = _ref2.hasIcon,
|
|
185
|
-
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
186
163
|
var customBackgroundColor = backgroundColor ? hexToEditorBackgroundPaletteColor(backgroundColor) || backgroundColor : undefined;
|
|
187
164
|
return jsx("div", _extends({
|
|
188
165
|
style:
|
|
@@ -195,7 +172,6 @@ var PanelStyledNew = function PanelStyledNew(_ref2) {
|
|
|
195
172
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
196
173
|
}, props), props.children);
|
|
197
174
|
};
|
|
198
|
-
var PanelStyled = componentWithFG('platform_editor_emotion_refactor_renderer', PanelStyledNew, PanelStyledOld);
|
|
199
175
|
PanelStyled.displayName = 'PanelStyled';
|
|
200
176
|
var panelIcons = {
|
|
201
177
|
info: PanelInfoIcon,
|
|
@@ -2,6 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
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; }
|
|
3
3
|
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) { _defineProperty(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; }
|
|
4
4
|
import React from 'react';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { tableCellBorderWidth, tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
6
7
|
import { akEditorTableNumberColumnWidth, akEditorTableLegacyCellMinWidth } from '@atlaskit/editor-shared-styles';
|
|
7
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -192,7 +193,9 @@ export var Colgroup = function Colgroup(props) {
|
|
|
192
193
|
}
|
|
193
194
|
return /*#__PURE__*/React.createElement("colgroup", null, isNumberColumnEnabled && /*#__PURE__*/React.createElement("col", {
|
|
194
195
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
195
|
-
style:
|
|
196
|
+
style: fg('platform-ssr-table-resize') ? undefined :
|
|
197
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
198
|
+
{
|
|
196
199
|
width: akEditorTableNumberColumnWidth
|
|
197
200
|
},
|
|
198
201
|
"data-test-id": 'num'
|
|
@@ -203,7 +206,7 @@ export var Colgroup = function Colgroup(props) {
|
|
|
203
206
|
// eslint-disable-next-line react/no-array-index-key, @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
204
207
|
React.createElement("col", {
|
|
205
208
|
key: idx,
|
|
206
|
-
style: style
|
|
209
|
+
style: fg('platform-ssr-table-resize') ? undefined : style
|
|
207
210
|
})
|
|
208
211
|
);
|
|
209
212
|
}));
|
|
@@ -17,7 +17,6 @@ import { N40A } from '@atlaskit/theme/colors';
|
|
|
17
17
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
18
18
|
import { Table } from './table';
|
|
19
19
|
import { recursivelyInjectProps } from '../../utils/inject-props';
|
|
20
|
-
import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
|
|
21
20
|
export var tableStickyPadding = 8;
|
|
22
21
|
var modeSpecficStyles = {
|
|
23
22
|
none: css({
|
|
@@ -33,7 +32,7 @@ var modeSpecficStyles = {
|
|
|
33
32
|
|
|
34
33
|
// refactored based on fixedTableDivStaticStyles
|
|
35
34
|
// TODO: DSP-4123 - Quality ticket
|
|
36
|
-
var
|
|
35
|
+
var fixedTableDivStaticStyles = css(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
37
36
|
zIndex: 'var(--ak-renderer-sticky-header-zindex)'
|
|
38
37
|
}, "& .".concat(TableSharedCssClassName.TABLE_CONTAINER, ", & .").concat(TableSharedCssClassName.TABLE_STICKY_WRAPPER, " > table"), {
|
|
39
38
|
marginTop: 0,
|
|
@@ -51,59 +50,7 @@ var fixedTableDivStaticStylesNew = css(_defineProperty(_defineProperty(_definePr
|
|
|
51
50
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
52
51
|
zIndex: 'var(--ak-renderer-sticky-header-zindex)'
|
|
53
52
|
}));
|
|
54
|
-
|
|
55
|
-
// TODO: DSP-4123 - Quality ticket
|
|
56
|
-
var fixedTableDivStaticStyles = function fixedTableDivStaticStyles(top, width, allowTableResizing) {
|
|
57
|
-
var stickyHeaderZIndex;
|
|
58
|
-
if (allowTableResizing) {
|
|
59
|
-
stickyHeaderZIndex = 13;
|
|
60
|
-
} else {
|
|
61
|
-
stickyHeaderZIndex = akEditorStickyHeaderZIndex;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
65
|
-
return css(typeof top === 'number' && "top: ".concat(top, "px;"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
66
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
67
|
-
width: "".concat(width, "px"),
|
|
68
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
69
|
-
zIndex: stickyHeaderZIndex
|
|
70
|
-
}, "& .".concat(TableSharedCssClassName.TABLE_CONTAINER, ", & .").concat(TableSharedCssClassName.TABLE_STICKY_WRAPPER, " > table"), {
|
|
71
|
-
marginTop: 0,
|
|
72
|
-
marginBottom: 0,
|
|
73
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
74
|
-
tr: {
|
|
75
|
-
background: "var(--ds-surface, white)"
|
|
76
|
-
}
|
|
77
|
-
}), "borderTop", "".concat(tableStickyPadding, "px solid ", "var(--ds-surface, white)")), "background", "var(--ds-surface-overlay, white)"), "boxShadow", "0 6px 4px -4px ".concat("var(--ds-shadow-overflow-perimeter, ".concat(N40A, ")"))), "div[data-expanded='false'] &", {
|
|
78
|
-
display: 'none'
|
|
79
|
-
}), "& .".concat(TableSharedCssClassName.TABLE_CONTAINER, ".is-sticky.right-shadow::after, & .").concat(TableSharedCssClassName.TABLE_CONTAINER, ".is-sticky.left-shadow::before"), {
|
|
80
|
-
top: '0px',
|
|
81
|
-
height: '100%'
|
|
82
|
-
}), "&.fixed-table-div-custom-table-resizing[mode='stick']", {
|
|
83
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
84
|
-
zIndex: stickyHeaderZIndex
|
|
85
|
-
}));
|
|
86
|
-
};
|
|
87
|
-
var FixedTableDivOld = function FixedTableDivOld(props) {
|
|
88
|
-
var top = props.top,
|
|
89
|
-
wrapperWidth = props.wrapperWidth,
|
|
90
|
-
mode = props.mode,
|
|
91
|
-
allowTableResizing = props.allowTableResizing;
|
|
92
|
-
var fixedTableCss = [fixedTableDivStaticStyles(top, wrapperWidth, allowTableResizing), modeSpecficStyles === null || modeSpecficStyles === void 0 ? void 0 : modeSpecficStyles[mode]];
|
|
93
|
-
var attrs = {
|
|
94
|
-
mode: mode
|
|
95
|
-
};
|
|
96
|
-
return jsx("div", _extends({}, attrs, {
|
|
97
|
-
"data-testid": "sticky-table-fixed"
|
|
98
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
99
|
-
,
|
|
100
|
-
className: allowTableResizing ? 'fixed-table-div-custom-table-resizing' : ''
|
|
101
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
102
|
-
,
|
|
103
|
-
css: fixedTableCss
|
|
104
|
-
}), props.children);
|
|
105
|
-
};
|
|
106
|
-
var FixedTableDivNew = function FixedTableDivNew(props) {
|
|
53
|
+
var FixedTableDiv = function FixedTableDiv(props) {
|
|
107
54
|
var top = props.top,
|
|
108
55
|
wrapperWidth = props.wrapperWidth,
|
|
109
56
|
mode = props.mode,
|
|
@@ -122,7 +69,7 @@ var FixedTableDivNew = function FixedTableDivNew(props) {
|
|
|
122
69
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
123
70
|
,
|
|
124
71
|
className: allowTableResizing ? 'fixed-table-div-custom-table-resizing' : '',
|
|
125
|
-
css: [
|
|
72
|
+
css: [fixedTableDivStaticStyles, modeSpecficStyles === null || modeSpecficStyles === void 0 ? void 0 : modeSpecficStyles[mode]],
|
|
126
73
|
style: {
|
|
127
74
|
'--ak-renderer-sticky-header-zindex': stickyHeaderZIndex,
|
|
128
75
|
width: "".concat(wrapperWidth, "px"),
|
|
@@ -130,7 +77,6 @@ var FixedTableDivNew = function FixedTableDivNew(props) {
|
|
|
130
77
|
}
|
|
131
78
|
}), props.children);
|
|
132
79
|
};
|
|
133
|
-
var FixedTableDiv = componentWithFG('platform_editor_emotion_refactor_renderer', FixedTableDivNew, FixedTableDivOld);
|
|
134
80
|
export var StickyTable = function StickyTable(_ref) {
|
|
135
81
|
var top = _ref.top,
|
|
136
82
|
left = _ref.left,
|
|
@@ -24,7 +24,12 @@ export var Table = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
24
24
|
tableWidth = 'inherit';
|
|
25
25
|
}
|
|
26
26
|
if (rendererAppearance === 'comment' && !allowTableResizing) {
|
|
27
|
-
|
|
27
|
+
// in the case we have css container stylings,
|
|
28
|
+
// we don't need to calculate width here as this
|
|
29
|
+
// is done via css
|
|
30
|
+
if (!fg('platform-ssr-table-resize')) {
|
|
31
|
+
tableWidth = renderWidth;
|
|
32
|
+
}
|
|
28
33
|
}
|
|
29
34
|
var tableLayout = tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout;
|
|
30
35
|
var tableDisplayMode = tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.displayMode;
|
|
@@ -27,6 +27,7 @@ import { StickyTable, tableStickyPadding, OverflowParent } from './table/sticky'
|
|
|
27
27
|
import { Table } from './table/table';
|
|
28
28
|
import { isCommentAppearance, isFullPageAppearance, isFullWidthAppearance, isFullWidthOrFullPageAppearance } from '../utils/appearance';
|
|
29
29
|
import { TableStickyScrollbar } from './TableStickyScrollbar';
|
|
30
|
+
import { TableProcessorWithContainerStyles } from './tableNew';
|
|
30
31
|
export var isTableResizingEnabled = function isTableResizingEnabled(appearance) {
|
|
31
32
|
return isFullWidthOrFullPageAppearance(appearance) || isCommentAppearance(appearance) && editorExperiment('support_table_in_comment', true, {
|
|
32
33
|
exposure: true
|
|
@@ -37,7 +38,7 @@ export var isStickyScrollbarEnabled = function isStickyScrollbarEnabled(appearan
|
|
|
37
38
|
exposure: true
|
|
38
39
|
});
|
|
39
40
|
};
|
|
40
|
-
var orderChildren = function orderChildren(children, tableNode, smartCardStorage, tableOrderStatus) {
|
|
41
|
+
export var orderChildren = function orderChildren(children, tableNode, smartCardStorage, tableOrderStatus) {
|
|
41
42
|
if (!tableOrderStatus || tableOrderStatus.order === SortOrder.NO_ORDER) {
|
|
42
43
|
return children;
|
|
43
44
|
}
|
|
@@ -71,23 +72,23 @@ var orderChildren = function orderChildren(children, tableNode, smartCardStorage
|
|
|
71
72
|
return elem.rowReact;
|
|
72
73
|
});
|
|
73
74
|
};
|
|
74
|
-
var hasRowspan = function hasRowspan(row) {
|
|
75
|
+
export var hasRowspan = function hasRowspan(row) {
|
|
75
76
|
var hasRowspan = false;
|
|
76
77
|
row.forEach(function (cell) {
|
|
77
78
|
return hasRowspan = hasRowspan || cell.attrs.rowspan > 1;
|
|
78
79
|
});
|
|
79
80
|
return hasRowspan;
|
|
80
81
|
};
|
|
81
|
-
var getRefTop = function getRefTop(refElement) {
|
|
82
|
+
export var getRefTop = function getRefTop(refElement) {
|
|
82
83
|
return Math.round(refElement.getBoundingClientRect().top);
|
|
83
84
|
};
|
|
84
|
-
var shouldHeaderStick = function shouldHeaderStick(scrollTop, tableTop, tableBottom, rowHeight) {
|
|
85
|
+
export var shouldHeaderStick = function shouldHeaderStick(scrollTop, tableTop, tableBottom, rowHeight) {
|
|
85
86
|
return tableTop <= scrollTop && !(tableBottom - rowHeight <= scrollTop);
|
|
86
87
|
};
|
|
87
|
-
var shouldHeaderPinBottom = function shouldHeaderPinBottom(scrollTop, tableBottom, rowHeight) {
|
|
88
|
+
export var shouldHeaderPinBottom = function shouldHeaderPinBottom(scrollTop, tableBottom, rowHeight) {
|
|
88
89
|
return tableBottom - rowHeight <= scrollTop && !(tableBottom < scrollTop);
|
|
89
90
|
};
|
|
90
|
-
var addSortableColumn = function addSortableColumn(rows, tableOrderStatus, onSorting) {
|
|
91
|
+
export var addSortableColumn = function addSortableColumn(rows, tableOrderStatus, onSorting) {
|
|
91
92
|
return React.Children.map(rows, function (row, index) {
|
|
92
93
|
if (index === 0) {
|
|
93
94
|
return /*#__PURE__*/React.cloneElement(React.Children.only(row), {
|
|
@@ -98,7 +99,7 @@ var addSortableColumn = function addSortableColumn(rows, tableOrderStatus, onSor
|
|
|
98
99
|
return row;
|
|
99
100
|
});
|
|
100
101
|
};
|
|
101
|
-
var isHeaderRowEnabled = function isHeaderRowEnabled(rows) {
|
|
102
|
+
export var isHeaderRowEnabled = function isHeaderRowEnabled(rows) {
|
|
102
103
|
if (!rows.length) {
|
|
103
104
|
return false;
|
|
104
105
|
}
|
|
@@ -115,7 +116,7 @@ var isHeaderRowEnabled = function isHeaderRowEnabled(rows) {
|
|
|
115
116
|
return node.type === TableHeader;
|
|
116
117
|
});
|
|
117
118
|
};
|
|
118
|
-
var tableCanBeSticky = function tableCanBeSticky(node, children) {
|
|
119
|
+
export var tableCanBeSticky = function tableCanBeSticky(node, children) {
|
|
119
120
|
return isHeaderRowEnabled(children) && node && node.firstChild && !hasRowspan(node.firstChild);
|
|
120
121
|
};
|
|
121
122
|
// Ignored via go/ees005
|
|
@@ -586,6 +587,19 @@ export var TableProcessor = /*#__PURE__*/function (_React$Component2) {
|
|
|
586
587
|
}
|
|
587
588
|
}]);
|
|
588
589
|
}(React.Component);
|
|
590
|
+
|
|
591
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
592
|
+
var TableWithShadowsAndContainerStyles = overflowShadow(TableProcessorWithContainerStyles, {
|
|
593
|
+
/**
|
|
594
|
+
* The :scope is in reference to table container and we are selecting only
|
|
595
|
+
* direct children that match the table node wrapper selector, not their
|
|
596
|
+
* descendants.
|
|
597
|
+
*/
|
|
598
|
+
overflowSelector: ":scope > .".concat(TableSharedCssClassName.TABLE_NODE_WRAPPER),
|
|
599
|
+
useShadowObserver: true
|
|
600
|
+
});
|
|
601
|
+
|
|
602
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
589
603
|
var TableWithShadows = overflowShadow(TableProcessor, {
|
|
590
604
|
/**
|
|
591
605
|
* The :scope is in reference to table container and we are selecting only
|
|
@@ -596,27 +610,43 @@ var TableWithShadows = overflowShadow(TableProcessor, {
|
|
|
596
610
|
useShadowObserver: true
|
|
597
611
|
});
|
|
598
612
|
var TableWithWidth = function TableWithWidth(props) {
|
|
599
|
-
//
|
|
600
|
-
|
|
613
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
614
|
+
if (fg('platform-ssr-table-resize')) {
|
|
601
615
|
var _props$columnWidths;
|
|
602
|
-
var width = _ref2.width;
|
|
603
|
-
var renderWidth = props.rendererAppearance === 'full-page' ? width - FullPagePadding * 2 : width;
|
|
604
616
|
var colWidthsSum = ((_props$columnWidths = props.columnWidths) === null || _props$columnWidths === void 0 ? void 0 : _props$columnWidths.reduce(function (total, val) {
|
|
605
617
|
return total + val;
|
|
606
618
|
}, 0)) || 0;
|
|
607
619
|
if (colWidthsSum || props.allowTableResizing) {
|
|
608
620
|
// Ignored via go/ees005
|
|
609
621
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
610
|
-
return /*#__PURE__*/React.createElement(
|
|
622
|
+
return /*#__PURE__*/React.createElement(TableWithShadowsAndContainerStyles, props);
|
|
623
|
+
}
|
|
624
|
+
return /*#__PURE__*/React.createElement(TableProcessorWithContainerStyles
|
|
625
|
+
// Ignored via go/ees005
|
|
626
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
627
|
+
, props);
|
|
628
|
+
} else {
|
|
629
|
+
return /*#__PURE__*/React.createElement(WidthConsumer, null, function (_ref2) {
|
|
630
|
+
var _props$columnWidths2;
|
|
631
|
+
var width = _ref2.width;
|
|
632
|
+
var renderWidth = props.rendererAppearance === 'full-page' ? width - FullPagePadding * 2 : width;
|
|
633
|
+
var colWidthsSum = ((_props$columnWidths2 = props.columnWidths) === null || _props$columnWidths2 === void 0 ? void 0 : _props$columnWidths2.reduce(function (total, val) {
|
|
634
|
+
return total + val;
|
|
635
|
+
}, 0)) || 0;
|
|
636
|
+
if (colWidthsSum || props.allowTableResizing) {
|
|
637
|
+
// Ignored via go/ees005
|
|
638
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
639
|
+
return /*#__PURE__*/React.createElement(TableWithShadows, _extends({
|
|
640
|
+
renderWidth: renderWidth
|
|
641
|
+
}, props));
|
|
642
|
+
}
|
|
643
|
+
// 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
|
|
644
|
+
return /*#__PURE__*/React.createElement(TableProcessor, _extends({
|
|
611
645
|
renderWidth: renderWidth
|
|
646
|
+
// Ignored via go/ees005
|
|
647
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
612
648
|
}, props));
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
return /*#__PURE__*/React.createElement(TableProcessor, _extends({
|
|
616
|
-
renderWidth: renderWidth
|
|
617
|
-
// Ignored via go/ees005
|
|
618
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
619
|
-
}, props));
|
|
620
|
-
});
|
|
649
|
+
});
|
|
650
|
+
}
|
|
621
651
|
};
|
|
622
652
|
export default withSmartCardStorage(TableWithWidth);
|