@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
|
@@ -14,7 +14,6 @@ import { N40A } from '@atlaskit/theme/colors';
|
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import { Table } from './table';
|
|
16
16
|
import { recursivelyInjectProps } from '../../utils/inject-props';
|
|
17
|
-
import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
|
|
18
17
|
export const tableStickyPadding = 8;
|
|
19
18
|
const modeSpecficStyles = {
|
|
20
19
|
none: css({
|
|
@@ -30,7 +29,7 @@ const modeSpecficStyles = {
|
|
|
30
29
|
|
|
31
30
|
// refactored based on fixedTableDivStaticStyles
|
|
32
31
|
// TODO: DSP-4123 - Quality ticket
|
|
33
|
-
const
|
|
32
|
+
const fixedTableDivStaticStyles = css({
|
|
34
33
|
zIndex: 'var(--ak-renderer-sticky-header-zindex)',
|
|
35
34
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
36
35
|
[`& .${TableSharedCssClassName.TABLE_CONTAINER}, & .${TableSharedCssClassName.TABLE_STICKY_WRAPPER} > table`]: {
|
|
@@ -59,72 +58,7 @@ const fixedTableDivStaticStylesNew = css({
|
|
|
59
58
|
zIndex: 'var(--ak-renderer-sticky-header-zindex)'
|
|
60
59
|
}
|
|
61
60
|
});
|
|
62
|
-
|
|
63
|
-
// TODO: DSP-4123 - Quality ticket
|
|
64
|
-
const fixedTableDivStaticStyles = (top, width, allowTableResizing) => {
|
|
65
|
-
let stickyHeaderZIndex;
|
|
66
|
-
if (allowTableResizing) {
|
|
67
|
-
stickyHeaderZIndex = 13;
|
|
68
|
-
} else {
|
|
69
|
-
stickyHeaderZIndex = akEditorStickyHeaderZIndex;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
73
|
-
return css(typeof top === 'number' && `top: ${top}px;`, {
|
|
74
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
75
|
-
width: `${width}px`,
|
|
76
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
77
|
-
zIndex: stickyHeaderZIndex,
|
|
78
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
79
|
-
[`& .${TableSharedCssClassName.TABLE_CONTAINER}, & .${TableSharedCssClassName.TABLE_STICKY_WRAPPER} > table`]: {
|
|
80
|
-
marginTop: 0,
|
|
81
|
-
marginBottom: 0,
|
|
82
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
83
|
-
tr: {
|
|
84
|
-
background: "var(--ds-surface, white)"
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
borderTop: `${tableStickyPadding}px solid ${"var(--ds-surface, white)"}`,
|
|
88
|
-
background: "var(--ds-surface-overlay, white)",
|
|
89
|
-
boxShadow: `0 6px 4px -4px ${`var(--ds-shadow-overflow-perimeter, ${N40A})`}`,
|
|
90
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
91
|
-
"div[data-expanded='false'] &": {
|
|
92
|
-
display: 'none'
|
|
93
|
-
},
|
|
94
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
95
|
-
[`& .${TableSharedCssClassName.TABLE_CONTAINER}.is-sticky.right-shadow::after, & .${TableSharedCssClassName.TABLE_CONTAINER}.is-sticky.left-shadow::before`]: {
|
|
96
|
-
top: '0px',
|
|
97
|
-
height: '100%'
|
|
98
|
-
},
|
|
99
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
100
|
-
"&.fixed-table-div-custom-table-resizing[mode='stick']": {
|
|
101
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
102
|
-
zIndex: stickyHeaderZIndex
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
};
|
|
106
|
-
const FixedTableDivOld = props => {
|
|
107
|
-
const {
|
|
108
|
-
top,
|
|
109
|
-
wrapperWidth,
|
|
110
|
-
mode,
|
|
111
|
-
allowTableResizing
|
|
112
|
-
} = props;
|
|
113
|
-
const fixedTableCss = [fixedTableDivStaticStyles(top, wrapperWidth, allowTableResizing), modeSpecficStyles === null || modeSpecficStyles === void 0 ? void 0 : modeSpecficStyles[mode]];
|
|
114
|
-
const attrs = {
|
|
115
|
-
mode
|
|
116
|
-
};
|
|
117
|
-
return jsx("div", _extends({}, attrs, {
|
|
118
|
-
"data-testid": "sticky-table-fixed"
|
|
119
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
120
|
-
,
|
|
121
|
-
className: allowTableResizing ? 'fixed-table-div-custom-table-resizing' : ''
|
|
122
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
123
|
-
,
|
|
124
|
-
css: fixedTableCss
|
|
125
|
-
}), props.children);
|
|
126
|
-
};
|
|
127
|
-
const FixedTableDivNew = props => {
|
|
61
|
+
const FixedTableDiv = props => {
|
|
128
62
|
const {
|
|
129
63
|
top,
|
|
130
64
|
wrapperWidth,
|
|
@@ -145,7 +79,7 @@ const FixedTableDivNew = props => {
|
|
|
145
79
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
146
80
|
,
|
|
147
81
|
className: allowTableResizing ? 'fixed-table-div-custom-table-resizing' : '',
|
|
148
|
-
css: [
|
|
82
|
+
css: [fixedTableDivStaticStyles, modeSpecficStyles === null || modeSpecficStyles === void 0 ? void 0 : modeSpecficStyles[mode]],
|
|
149
83
|
style: {
|
|
150
84
|
'--ak-renderer-sticky-header-zindex': stickyHeaderZIndex,
|
|
151
85
|
width: `${wrapperWidth}px`,
|
|
@@ -153,7 +87,6 @@ const FixedTableDivNew = props => {
|
|
|
153
87
|
}
|
|
154
88
|
}), props.children);
|
|
155
89
|
};
|
|
156
|
-
const FixedTableDiv = componentWithFG('platform_editor_emotion_refactor_renderer', FixedTableDivNew, FixedTableDivOld);
|
|
157
90
|
export const StickyTable = ({
|
|
158
91
|
top,
|
|
159
92
|
left,
|
|
@@ -25,7 +25,12 @@ export const Table = /*#__PURE__*/React.memo(({
|
|
|
25
25
|
tableWidth = 'inherit';
|
|
26
26
|
}
|
|
27
27
|
if (rendererAppearance === 'comment' && !allowTableResizing) {
|
|
28
|
-
|
|
28
|
+
// in the case we have css container stylings,
|
|
29
|
+
// we don't need to calculate width here as this
|
|
30
|
+
// is done via css
|
|
31
|
+
if (!fg('platform-ssr-table-resize')) {
|
|
32
|
+
tableWidth = renderWidth;
|
|
33
|
+
}
|
|
29
34
|
}
|
|
30
35
|
const tableLayout = tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout;
|
|
31
36
|
const tableDisplayMode = tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.displayMode;
|
|
@@ -16,13 +16,14 @@ import { StickyTable, tableStickyPadding, OverflowParent } from './table/sticky'
|
|
|
16
16
|
import { Table } from './table/table';
|
|
17
17
|
import { isCommentAppearance, isFullPageAppearance, isFullWidthAppearance, isFullWidthOrFullPageAppearance } from '../utils/appearance';
|
|
18
18
|
import { TableStickyScrollbar } from './TableStickyScrollbar';
|
|
19
|
+
import { TableProcessorWithContainerStyles } from './tableNew';
|
|
19
20
|
export const isTableResizingEnabled = appearance => isFullWidthOrFullPageAppearance(appearance) || isCommentAppearance(appearance) && editorExperiment('support_table_in_comment', true, {
|
|
20
21
|
exposure: true
|
|
21
22
|
});
|
|
22
23
|
export const isStickyScrollbarEnabled = appearance => isFullWidthOrFullPageAppearance(appearance) && editorExperiment('platform_renderer_table_sticky_scrollbar', true, {
|
|
23
24
|
exposure: true
|
|
24
25
|
});
|
|
25
|
-
const orderChildren = (children, tableNode, smartCardStorage, tableOrderStatus) => {
|
|
26
|
+
export const orderChildren = (children, tableNode, smartCardStorage, tableOrderStatus) => {
|
|
26
27
|
if (!tableOrderStatus || tableOrderStatus.order === SortOrder.NO_ORDER) {
|
|
27
28
|
return children;
|
|
28
29
|
}
|
|
@@ -53,17 +54,17 @@ const orderChildren = (children, tableNode, smartCardStorage, tableOrderStatus)
|
|
|
53
54
|
}
|
|
54
55
|
return sortedTable.map(elem => elem.rowReact);
|
|
55
56
|
};
|
|
56
|
-
const hasRowspan = row => {
|
|
57
|
+
export const hasRowspan = row => {
|
|
57
58
|
let hasRowspan = false;
|
|
58
59
|
row.forEach(cell => hasRowspan = hasRowspan || cell.attrs.rowspan > 1);
|
|
59
60
|
return hasRowspan;
|
|
60
61
|
};
|
|
61
|
-
const getRefTop = refElement => {
|
|
62
|
+
export const getRefTop = refElement => {
|
|
62
63
|
return Math.round(refElement.getBoundingClientRect().top);
|
|
63
64
|
};
|
|
64
|
-
const shouldHeaderStick = (scrollTop, tableTop, tableBottom, rowHeight) => tableTop <= scrollTop && !(tableBottom - rowHeight <= scrollTop);
|
|
65
|
-
const shouldHeaderPinBottom = (scrollTop, tableBottom, rowHeight) => tableBottom - rowHeight <= scrollTop && !(tableBottom < scrollTop);
|
|
66
|
-
const addSortableColumn = (rows, tableOrderStatus, onSorting) => {
|
|
65
|
+
export const shouldHeaderStick = (scrollTop, tableTop, tableBottom, rowHeight) => tableTop <= scrollTop && !(tableBottom - rowHeight <= scrollTop);
|
|
66
|
+
export const shouldHeaderPinBottom = (scrollTop, tableBottom, rowHeight) => tableBottom - rowHeight <= scrollTop && !(tableBottom < scrollTop);
|
|
67
|
+
export const addSortableColumn = (rows, tableOrderStatus, onSorting) => {
|
|
67
68
|
return React.Children.map(rows, (row, index) => {
|
|
68
69
|
if (index === 0) {
|
|
69
70
|
return /*#__PURE__*/React.cloneElement(React.Children.only(row), {
|
|
@@ -74,7 +75,7 @@ const addSortableColumn = (rows, tableOrderStatus, onSorting) => {
|
|
|
74
75
|
return row;
|
|
75
76
|
});
|
|
76
77
|
};
|
|
77
|
-
const isHeaderRowEnabled = rows => {
|
|
78
|
+
export const isHeaderRowEnabled = rows => {
|
|
78
79
|
if (!rows.length) {
|
|
79
80
|
return false;
|
|
80
81
|
}
|
|
@@ -91,7 +92,7 @@ const isHeaderRowEnabled = rows => {
|
|
|
91
92
|
}
|
|
92
93
|
return children.every(node => node.type === TableHeader);
|
|
93
94
|
};
|
|
94
|
-
const tableCanBeSticky = (node, children) => {
|
|
95
|
+
export const tableCanBeSticky = (node, children) => {
|
|
95
96
|
return isHeaderRowEnabled(children) && node && node.firstChild && !hasRowspan(node.firstChild);
|
|
96
97
|
};
|
|
97
98
|
// Ignored via go/ees005
|
|
@@ -532,6 +533,19 @@ export class TableProcessor extends React.Component {
|
|
|
532
533
|
return /*#__PURE__*/React.createElement(TableContainer, this.props, orderedChildren);
|
|
533
534
|
}
|
|
534
535
|
}
|
|
536
|
+
|
|
537
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
538
|
+
const TableWithShadowsAndContainerStyles = overflowShadow(TableProcessorWithContainerStyles, {
|
|
539
|
+
/**
|
|
540
|
+
* The :scope is in reference to table container and we are selecting only
|
|
541
|
+
* direct children that match the table node wrapper selector, not their
|
|
542
|
+
* descendants.
|
|
543
|
+
*/
|
|
544
|
+
overflowSelector: `:scope > .${TableSharedCssClassName.TABLE_NODE_WRAPPER}`,
|
|
545
|
+
useShadowObserver: true
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
535
549
|
const TableWithShadows = overflowShadow(TableProcessor, {
|
|
536
550
|
/**
|
|
537
551
|
* The :scope is in reference to table container and we are selecting only
|
|
@@ -542,26 +556,40 @@ const TableWithShadows = overflowShadow(TableProcessor, {
|
|
|
542
556
|
useShadowObserver: true
|
|
543
557
|
});
|
|
544
558
|
const TableWithWidth = props => {
|
|
545
|
-
//
|
|
546
|
-
|
|
547
|
-
width
|
|
548
|
-
}) => {
|
|
559
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
560
|
+
if (fg('platform-ssr-table-resize')) {
|
|
549
561
|
var _props$columnWidths;
|
|
550
|
-
const renderWidth = props.rendererAppearance === 'full-page' ? width - FullPagePadding * 2 : width;
|
|
551
562
|
const colWidthsSum = ((_props$columnWidths = props.columnWidths) === null || _props$columnWidths === void 0 ? void 0 : _props$columnWidths.reduce((total, val) => total + val, 0)) || 0;
|
|
552
563
|
if (colWidthsSum || props.allowTableResizing) {
|
|
553
564
|
// Ignored via go/ees005
|
|
554
565
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
555
|
-
return /*#__PURE__*/React.createElement(
|
|
566
|
+
return /*#__PURE__*/React.createElement(TableWithShadowsAndContainerStyles, props);
|
|
567
|
+
}
|
|
568
|
+
return /*#__PURE__*/React.createElement(TableProcessorWithContainerStyles
|
|
569
|
+
// Ignored via go/ees005
|
|
570
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
571
|
+
, props);
|
|
572
|
+
} else {
|
|
573
|
+
return /*#__PURE__*/React.createElement(WidthConsumer, null, ({
|
|
574
|
+
width
|
|
575
|
+
}) => {
|
|
576
|
+
var _props$columnWidths2;
|
|
577
|
+
const renderWidth = props.rendererAppearance === 'full-page' ? width - FullPagePadding * 2 : width;
|
|
578
|
+
const colWidthsSum = ((_props$columnWidths2 = props.columnWidths) === null || _props$columnWidths2 === void 0 ? void 0 : _props$columnWidths2.reduce((total, val) => total + val, 0)) || 0;
|
|
579
|
+
if (colWidthsSum || props.allowTableResizing) {
|
|
580
|
+
// Ignored via go/ees005
|
|
581
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
582
|
+
return /*#__PURE__*/React.createElement(TableWithShadows, _extends({
|
|
583
|
+
renderWidth: renderWidth
|
|
584
|
+
}, props));
|
|
585
|
+
}
|
|
586
|
+
// 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
|
|
587
|
+
return /*#__PURE__*/React.createElement(TableProcessor, _extends({
|
|
556
588
|
renderWidth: renderWidth
|
|
589
|
+
// Ignored via go/ees005
|
|
590
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
557
591
|
}, props));
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
return /*#__PURE__*/React.createElement(TableProcessor, _extends({
|
|
561
|
-
renderWidth: renderWidth
|
|
562
|
-
// Ignored via go/ees005
|
|
563
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
564
|
-
}, props));
|
|
565
|
-
});
|
|
592
|
+
});
|
|
593
|
+
}
|
|
566
594
|
};
|
|
567
595
|
export default withSmartCardStorage(TableWithWidth);
|