@atlaskit/renderer 114.11.2 → 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 +12 -0
- package/afm-cc/tsconfig.json +3 -0
- package/dist/cjs/react/nodes/blockCard.js +24 -8
- package/dist/cjs/react/nodes/table/colgroup.js +5 -2
- 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/Renderer/breakout-ssr.js +22 -22
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/es2019/react/nodes/blockCard.js +24 -8
- package/dist/es2019/react/nodes/table/colgroup.js +5 -2
- 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/Renderer/breakout-ssr.js +22 -22
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/esm/react/nodes/blockCard.js +24 -8
- package/dist/esm/react/nodes/table/colgroup.js +5 -2
- 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/Renderer/breakout-ssr.js +22 -22
- package/dist/esm/ui/Renderer/index.js +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-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/package.json +10 -3
|
@@ -12,6 +12,8 @@ import { getCardClickHandler } from '../utils/getCardClickHandler';
|
|
|
12
12
|
import InlineCard from './inlineCard';
|
|
13
13
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
14
14
|
import { DatasourceTableView } from '@atlaskit/link-datasource';
|
|
15
|
+
import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
16
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
17
|
import { N40 } from '@atlaskit/theme/colors';
|
|
16
18
|
import { calcBreakoutWidth, canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
17
19
|
const datasourceContainerStyle = css({
|
|
@@ -109,6 +111,27 @@ export default function BlockCard(props) {
|
|
|
109
111
|
url: url
|
|
110
112
|
});
|
|
111
113
|
}
|
|
114
|
+
let cardComponent;
|
|
115
|
+
if (smartLinks !== null && smartLinks !== void 0 && smartLinks.ssr && url && fg('platform_ssr_smartlink_cards')) {
|
|
116
|
+
cardComponent = jsx(CardSSR, _extends({
|
|
117
|
+
appearance: "block",
|
|
118
|
+
platform: platform
|
|
119
|
+
// Ignored via go/ees005
|
|
120
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
121
|
+
}, cardProps, {
|
|
122
|
+
url: url,
|
|
123
|
+
onError: onError
|
|
124
|
+
}));
|
|
125
|
+
} else {
|
|
126
|
+
cardComponent = jsx(Card, _extends({
|
|
127
|
+
appearance: "block",
|
|
128
|
+
platform: platform
|
|
129
|
+
// Ignored via go/ees005
|
|
130
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
131
|
+
}, cardProps, {
|
|
132
|
+
onError: onError
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
112
135
|
return jsx(AnalyticsContext, {
|
|
113
136
|
data: analyticsData
|
|
114
137
|
}, jsx("div", {
|
|
@@ -121,12 +144,5 @@ export default function BlockCard(props) {
|
|
|
121
144
|
unsupportedComponent: UnsupportedBlock
|
|
122
145
|
// Ignored via go/ees005
|
|
123
146
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
124
|
-
}, cardProps),
|
|
125
|
-
appearance: "block",
|
|
126
|
-
platform: platform
|
|
127
|
-
// Ignored via go/ees005
|
|
128
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
129
|
-
}, cardProps, {
|
|
130
|
-
onError: onError
|
|
131
|
-
})))));
|
|
147
|
+
}, cardProps), cardComponent)));
|
|
132
148
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { tableCellBorderWidth, tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
3
4
|
import { akEditorTableNumberColumnWidth, akEditorTableLegacyCellMinWidth } from '@atlaskit/editor-shared-styles';
|
|
4
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -190,7 +191,9 @@ export const Colgroup = props => {
|
|
|
190
191
|
}
|
|
191
192
|
return /*#__PURE__*/React.createElement("colgroup", null, isNumberColumnEnabled && /*#__PURE__*/React.createElement("col", {
|
|
192
193
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
193
|
-
style:
|
|
194
|
+
style: fg('platform-ssr-table-resize') ? undefined :
|
|
195
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
196
|
+
{
|
|
194
197
|
width: akEditorTableNumberColumnWidth
|
|
195
198
|
},
|
|
196
199
|
"data-test-id": 'num'
|
|
@@ -200,6 +203,6 @@ export const Colgroup = props => {
|
|
|
200
203
|
// eslint-disable-next-line react/no-array-index-key, @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
201
204
|
React.createElement("col", {
|
|
202
205
|
key: idx,
|
|
203
|
-
style: style
|
|
206
|
+
style: fg('platform-ssr-table-resize') ? undefined : style
|
|
204
207
|
})));
|
|
205
208
|
};
|
|
@@ -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);
|