@atlaskit/renderer 106.0.0 → 106.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/react/nodes/table/colgroup.js +31 -3
- package/dist/cjs/react/nodes/tableCell.js +19 -2
- package/dist/cjs/ui/Renderer/ErrorBoundary.js +3 -1
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/react/nodes/table/colgroup.js +30 -2
- package/dist/es2019/react/nodes/tableCell.js +19 -2
- package/dist/es2019/ui/Renderer/ErrorBoundary.js +3 -1
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/react/nodes/table/colgroup.js +29 -2
- package/dist/esm/react/nodes/tableCell.js +19 -2
- package/dist/esm/ui/Renderer/ErrorBoundary.js +3 -1
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/events.d.ts +5 -3
- package/dist/types/react/nodes/table/colgroup.d.ts +6 -0
- package/package.json +13 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 106.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`8c04b73312e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8c04b73312e) - ED-16758 Added data-cell-background attribute to store table cell background color information.
|
|
8
|
+
|
|
9
|
+
## 106.0.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`1bd38dae4ab`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1bd38dae4ab) - [ux] add back table column max scaling percent logic
|
|
14
|
+
- [`336f7dab111`](https://bitbucket.org/atlassian/atlassian-frontend/commits/336f7dab111) - ED-16200 Updating CRASHED event action to map to new event "unhandledErrorCaughtV2 and moving its errorStack attribute to nonPrivacySafeAttributes"
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 106.0.0
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -4,10 +4,15 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.Colgroup = void 0;
|
|
7
|
+
exports.calcScalePercent = exports.Colgroup = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
10
10
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
11
|
+
// we allow scaling down column widths by no more than 30%
|
|
12
|
+
// this intends to reduce unwanted scrolling in the Renderer in these scenarios:
|
|
13
|
+
// User A creates a table with column widths → User B views it on a smaller screen
|
|
14
|
+
// User A creates a table with column widths → User A views it with reduced viewport space (eg. Confluence sidebar is open)
|
|
15
|
+
var MAX_SCALING_PERCENT = 0.3;
|
|
11
16
|
var getTableLayoutWidth = function getTableLayoutWidth(layout, opts) {
|
|
12
17
|
switch (layout) {
|
|
13
18
|
case 'full-width':
|
|
@@ -24,14 +29,28 @@ var isTableResized = function isTableResized(columnWidths) {
|
|
|
24
29
|
});
|
|
25
30
|
return !!filteredWidths.length;
|
|
26
31
|
};
|
|
27
|
-
var fixColumnWidth = function fixColumnWidth(columnWidth, _tableWidth, _layoutWidth, zeroWidthColumnsCount) {
|
|
32
|
+
var fixColumnWidth = function fixColumnWidth(columnWidth, _tableWidth, _layoutWidth, zeroWidthColumnsCount, scaleDownPercent) {
|
|
28
33
|
if (columnWidth === 0) {
|
|
29
34
|
return columnWidth;
|
|
30
35
|
}
|
|
36
|
+
|
|
37
|
+
// If the tables total width (including no zero widths col or cols without width) is less than the current layout
|
|
38
|
+
// We scale up the columns to meet the minimum of the table layout.
|
|
39
|
+
if (zeroWidthColumnsCount === 0 && scaleDownPercent) {
|
|
40
|
+
return Math.floor((1 - scaleDownPercent) * columnWidth);
|
|
41
|
+
}
|
|
31
42
|
return Math.max(
|
|
32
43
|
// We need to take tableCellBorderWidth, to avoid unneccesary overflow.
|
|
33
44
|
columnWidth - _styles.tableCellBorderWidth, zeroWidthColumnsCount ? _editorSharedStyles.akEditorTableLegacyCellMinWidth : _styles.tableCellMinWidth);
|
|
34
45
|
};
|
|
46
|
+
var calcScalePercent = function calcScalePercent(_ref) {
|
|
47
|
+
var renderWidth = _ref.renderWidth,
|
|
48
|
+
tableWidth = _ref.tableWidth,
|
|
49
|
+
maxScale = _ref.maxScale;
|
|
50
|
+
var diffPercent = 1 - renderWidth / tableWidth;
|
|
51
|
+
return diffPercent < maxScale ? diffPercent : maxScale;
|
|
52
|
+
};
|
|
53
|
+
exports.calcScalePercent = calcScalePercent;
|
|
35
54
|
var Colgroup = function Colgroup(props) {
|
|
36
55
|
var columnWidths = props.columnWidths,
|
|
37
56
|
layout = props.layout,
|
|
@@ -65,6 +84,7 @@ var Colgroup = function Colgroup(props) {
|
|
|
65
84
|
minTableWidth += Math.ceil(width) || _editorSharedStyles.akEditorTableLegacyCellMinWidth;
|
|
66
85
|
});
|
|
67
86
|
var cellMinWidth = 0;
|
|
87
|
+
var scaleDownPercent = 0;
|
|
68
88
|
// fixes migration tables with zero-width columns
|
|
69
89
|
if (zeroWidthColumnsCount > 0) {
|
|
70
90
|
if (minTableWidth > maxTableWidth) {
|
|
@@ -72,12 +92,20 @@ var Colgroup = function Colgroup(props) {
|
|
|
72
92
|
cellMinWidth = minWidth < _editorSharedStyles.akEditorTableLegacyCellMinWidth ? _editorSharedStyles.akEditorTableLegacyCellMinWidth : minWidth;
|
|
73
93
|
}
|
|
74
94
|
}
|
|
95
|
+
// scaling down
|
|
96
|
+
else if (renderWidth < tableWidth) {
|
|
97
|
+
scaleDownPercent = calcScalePercent({
|
|
98
|
+
renderWidth: renderWidth,
|
|
99
|
+
tableWidth: tableWidth,
|
|
100
|
+
maxScale: MAX_SCALING_PERCENT
|
|
101
|
+
});
|
|
102
|
+
}
|
|
75
103
|
return /*#__PURE__*/_react.default.createElement("colgroup", null, isNumberColumnEnabled && /*#__PURE__*/_react.default.createElement("col", {
|
|
76
104
|
style: {
|
|
77
105
|
width: _editorSharedStyles.akEditorTableNumberColumnWidth
|
|
78
106
|
}
|
|
79
107
|
}), columnWidths.map(function (colWidth, idx) {
|
|
80
|
-
var width = fixColumnWidth(colWidth, minTableWidth, maxTableWidth, zeroWidthColumnsCount) || cellMinWidth;
|
|
108
|
+
var width = fixColumnWidth(colWidth, minTableWidth, maxTableWidth, zeroWidthColumnsCount, scaleDownPercent) || cellMinWidth;
|
|
81
109
|
var style = width ? {
|
|
82
110
|
width: "".concat(width, "px")
|
|
83
111
|
} : {};
|
|
@@ -52,11 +52,28 @@ var getSortOrderLabel = function getSortOrderLabel(intl, currentSortOrder) {
|
|
|
52
52
|
return intl.formatMessage(noneSortingLabel);
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
-
var getDataAttributes = function getDataAttributes(colwidth) {
|
|
55
|
+
var getDataAttributes = function getDataAttributes(colwidth, background) {
|
|
56
56
|
var attrs = {};
|
|
57
57
|
if (colwidth) {
|
|
58
58
|
attrs['data-colwidth'] = colwidth.join(',');
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Storing hex code in data-cell-background because
|
|
62
|
+
* we want to have DST token (css variable) or
|
|
63
|
+
* DST token value (value (hex code) of css variable) in
|
|
64
|
+
* inline style to correct render table cell background
|
|
65
|
+
* based on selected theme.
|
|
66
|
+
* Currently we rely on background color hex code stored in
|
|
67
|
+
* inline style.
|
|
68
|
+
* Because of that when we copy and paste table, we end up
|
|
69
|
+
* having DST token or DST token value in ADF instead of
|
|
70
|
+
* original hex code which we map to DST token.
|
|
71
|
+
* So, introducing data-cell-background.
|
|
72
|
+
* More details at https://product-fabric.atlassian.net/wiki/spaces/EUXQ/pages/3472556903/Tokenising+tableCell+background+colors#Update-toDom-and-parseDom-to-store-and-read-background-color-from-data-cell-background-attribute.4
|
|
73
|
+
*/
|
|
74
|
+
if (background) {
|
|
75
|
+
attrs['data-cell-background'] = background;
|
|
76
|
+
}
|
|
60
77
|
return attrs;
|
|
61
78
|
};
|
|
62
79
|
var getStyle = function getStyle(background, colGroupWidth, offsetTop) {
|
|
@@ -105,7 +122,7 @@ var withCellProps = function withCellProps(WrapperComponent) {
|
|
|
105
122
|
colorname: colorName,
|
|
106
123
|
onClick: onClick,
|
|
107
124
|
className: className
|
|
108
|
-
}, getDataAttributes(colwidth), {
|
|
125
|
+
}, getDataAttributes(colwidth, background), {
|
|
109
126
|
"aria-sort": ariaSort
|
|
110
127
|
}), children);
|
|
111
128
|
}
|
|
@@ -64,9 +64,11 @@ var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
|
64
64
|
attributes: {
|
|
65
65
|
platform: _events.PLATFORM.WEB,
|
|
66
66
|
errorMessage: error === null || error === void 0 ? void 0 : error.message,
|
|
67
|
-
errorStack: error === null || error === void 0 ? void 0 : error.stack,
|
|
68
67
|
componentStack: errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.componentStack,
|
|
69
68
|
errorRethrown: Boolean(this.props.rethrowError)
|
|
69
|
+
},
|
|
70
|
+
nonPrivacySafeAttributes: {
|
|
71
|
+
errorStack: error === null || error === void 0 ? void 0 : error.stack
|
|
70
72
|
}
|
|
71
73
|
});
|
|
72
74
|
if (this.hasFallback()) {
|
|
@@ -55,7 +55,7 @@ exports.NORMAL_SEVERITY_THRESHOLD = NORMAL_SEVERITY_THRESHOLD;
|
|
|
55
55
|
var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
56
56
|
exports.DEGRADED_SEVERITY_THRESHOLD = DEGRADED_SEVERITY_THRESHOLD;
|
|
57
57
|
var packageName = "@atlaskit/renderer";
|
|
58
|
-
var packageVersion = "106.0.
|
|
58
|
+
var packageVersion = "106.0.2";
|
|
59
59
|
var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
60
60
|
(0, _inherits2.default)(Renderer, _PureComponent);
|
|
61
61
|
var _super = _createSuper(Renderer);
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { tableCellBorderWidth, tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { akEditorTableNumberColumnWidth, akEditorWideLayoutWidth, akEditorFullWidthLayoutWidth, akEditorTableLegacyCellMinWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
4
|
+
// we allow scaling down column widths by no more than 30%
|
|
5
|
+
// this intends to reduce unwanted scrolling in the Renderer in these scenarios:
|
|
6
|
+
// User A creates a table with column widths → User B views it on a smaller screen
|
|
7
|
+
// User A creates a table with column widths → User A views it with reduced viewport space (eg. Confluence sidebar is open)
|
|
8
|
+
const MAX_SCALING_PERCENT = 0.3;
|
|
4
9
|
const getTableLayoutWidth = (layout, opts) => {
|
|
5
10
|
switch (layout) {
|
|
6
11
|
case 'full-width':
|
|
@@ -15,14 +20,28 @@ const isTableResized = columnWidths => {
|
|
|
15
20
|
const filteredWidths = columnWidths.filter(width => width !== 0);
|
|
16
21
|
return !!filteredWidths.length;
|
|
17
22
|
};
|
|
18
|
-
const fixColumnWidth = (columnWidth, _tableWidth, _layoutWidth, zeroWidthColumnsCount) => {
|
|
23
|
+
const fixColumnWidth = (columnWidth, _tableWidth, _layoutWidth, zeroWidthColumnsCount, scaleDownPercent) => {
|
|
19
24
|
if (columnWidth === 0) {
|
|
20
25
|
return columnWidth;
|
|
21
26
|
}
|
|
27
|
+
|
|
28
|
+
// If the tables total width (including no zero widths col or cols without width) is less than the current layout
|
|
29
|
+
// We scale up the columns to meet the minimum of the table layout.
|
|
30
|
+
if (zeroWidthColumnsCount === 0 && scaleDownPercent) {
|
|
31
|
+
return Math.floor((1 - scaleDownPercent) * columnWidth);
|
|
32
|
+
}
|
|
22
33
|
return Math.max(
|
|
23
34
|
// We need to take tableCellBorderWidth, to avoid unneccesary overflow.
|
|
24
35
|
columnWidth - tableCellBorderWidth, zeroWidthColumnsCount ? akEditorTableLegacyCellMinWidth : tableCellMinWidth);
|
|
25
36
|
};
|
|
37
|
+
export const calcScalePercent = ({
|
|
38
|
+
renderWidth,
|
|
39
|
+
tableWidth,
|
|
40
|
+
maxScale
|
|
41
|
+
}) => {
|
|
42
|
+
const diffPercent = 1 - renderWidth / tableWidth;
|
|
43
|
+
return diffPercent < maxScale ? diffPercent : maxScale;
|
|
44
|
+
};
|
|
26
45
|
export const Colgroup = props => {
|
|
27
46
|
let {
|
|
28
47
|
columnWidths,
|
|
@@ -58,6 +77,7 @@ export const Colgroup = props => {
|
|
|
58
77
|
minTableWidth += Math.ceil(width) || akEditorTableLegacyCellMinWidth;
|
|
59
78
|
});
|
|
60
79
|
let cellMinWidth = 0;
|
|
80
|
+
let scaleDownPercent = 0;
|
|
61
81
|
// fixes migration tables with zero-width columns
|
|
62
82
|
if (zeroWidthColumnsCount > 0) {
|
|
63
83
|
if (minTableWidth > maxTableWidth) {
|
|
@@ -65,12 +85,20 @@ export const Colgroup = props => {
|
|
|
65
85
|
cellMinWidth = minWidth < akEditorTableLegacyCellMinWidth ? akEditorTableLegacyCellMinWidth : minWidth;
|
|
66
86
|
}
|
|
67
87
|
}
|
|
88
|
+
// scaling down
|
|
89
|
+
else if (renderWidth < tableWidth) {
|
|
90
|
+
scaleDownPercent = calcScalePercent({
|
|
91
|
+
renderWidth,
|
|
92
|
+
tableWidth,
|
|
93
|
+
maxScale: MAX_SCALING_PERCENT
|
|
94
|
+
});
|
|
95
|
+
}
|
|
68
96
|
return /*#__PURE__*/React.createElement("colgroup", null, isNumberColumnEnabled && /*#__PURE__*/React.createElement("col", {
|
|
69
97
|
style: {
|
|
70
98
|
width: akEditorTableNumberColumnWidth
|
|
71
99
|
}
|
|
72
100
|
}), columnWidths.map((colWidth, idx) => {
|
|
73
|
-
const width = fixColumnWidth(colWidth, minTableWidth, maxTableWidth, zeroWidthColumnsCount) || cellMinWidth;
|
|
101
|
+
const width = fixColumnWidth(colWidth, minTableWidth, maxTableWidth, zeroWidthColumnsCount, scaleDownPercent) || cellMinWidth;
|
|
74
102
|
const style = width ? {
|
|
75
103
|
width: `${width}px`
|
|
76
104
|
} : {};
|
|
@@ -39,11 +39,28 @@ const getSortOrderLabel = (intl, currentSortOrder) => {
|
|
|
39
39
|
return intl.formatMessage(noneSortingLabel);
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
-
const getDataAttributes = colwidth => {
|
|
42
|
+
const getDataAttributes = (colwidth, background) => {
|
|
43
43
|
const attrs = {};
|
|
44
44
|
if (colwidth) {
|
|
45
45
|
attrs['data-colwidth'] = colwidth.join(',');
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Storing hex code in data-cell-background because
|
|
49
|
+
* we want to have DST token (css variable) or
|
|
50
|
+
* DST token value (value (hex code) of css variable) in
|
|
51
|
+
* inline style to correct render table cell background
|
|
52
|
+
* based on selected theme.
|
|
53
|
+
* Currently we rely on background color hex code stored in
|
|
54
|
+
* inline style.
|
|
55
|
+
* Because of that when we copy and paste table, we end up
|
|
56
|
+
* having DST token or DST token value in ADF instead of
|
|
57
|
+
* original hex code which we map to DST token.
|
|
58
|
+
* So, introducing data-cell-background.
|
|
59
|
+
* More details at https://product-fabric.atlassian.net/wiki/spaces/EUXQ/pages/3472556903/Tokenising+tableCell+background+colors#Update-toDom-and-parseDom-to-store-and-read-background-color-from-data-cell-background-attribute.4
|
|
60
|
+
*/
|
|
61
|
+
if (background) {
|
|
62
|
+
attrs['data-cell-background'] = background;
|
|
63
|
+
}
|
|
47
64
|
return attrs;
|
|
48
65
|
};
|
|
49
66
|
const getStyle = (background, colGroupWidth, offsetTop) => {
|
|
@@ -85,7 +102,7 @@ const withCellProps = WrapperComponent => {
|
|
|
85
102
|
colorname: colorName,
|
|
86
103
|
onClick: onClick,
|
|
87
104
|
className: className
|
|
88
|
-
}, getDataAttributes(colwidth), {
|
|
105
|
+
}, getDataAttributes(colwidth, background), {
|
|
89
106
|
"aria-sort": ariaSort
|
|
90
107
|
}), children);
|
|
91
108
|
}
|
|
@@ -34,9 +34,11 @@ export class ErrorBoundary extends React.Component {
|
|
|
34
34
|
attributes: {
|
|
35
35
|
platform: PLATFORM.WEB,
|
|
36
36
|
errorMessage: error === null || error === void 0 ? void 0 : error.message,
|
|
37
|
-
errorStack: error === null || error === void 0 ? void 0 : error.stack,
|
|
38
37
|
componentStack: errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.componentStack,
|
|
39
38
|
errorRethrown: Boolean(this.props.rethrowError)
|
|
39
|
+
},
|
|
40
|
+
nonPrivacySafeAttributes: {
|
|
41
|
+
errorStack: error === null || error === void 0 ? void 0 : error.stack
|
|
40
42
|
}
|
|
41
43
|
});
|
|
42
44
|
if (this.hasFallback()) {
|
|
@@ -35,7 +35,7 @@ import { RenderTracking } from '../../react/utils/performance/RenderTracking';
|
|
|
35
35
|
export const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
36
36
|
export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
37
37
|
const packageName = "@atlaskit/renderer";
|
|
38
|
-
const packageVersion = "106.0.
|
|
38
|
+
const packageVersion = "106.0.2";
|
|
39
39
|
export class Renderer extends PureComponent {
|
|
40
40
|
/**
|
|
41
41
|
* This is used in measuring the Renderer Mount time and is then
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { tableCellBorderWidth, tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { akEditorTableNumberColumnWidth, akEditorWideLayoutWidth, akEditorFullWidthLayoutWidth, akEditorTableLegacyCellMinWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
4
|
+
// we allow scaling down column widths by no more than 30%
|
|
5
|
+
// this intends to reduce unwanted scrolling in the Renderer in these scenarios:
|
|
6
|
+
// User A creates a table with column widths → User B views it on a smaller screen
|
|
7
|
+
// User A creates a table with column widths → User A views it with reduced viewport space (eg. Confluence sidebar is open)
|
|
8
|
+
var MAX_SCALING_PERCENT = 0.3;
|
|
4
9
|
var getTableLayoutWidth = function getTableLayoutWidth(layout, opts) {
|
|
5
10
|
switch (layout) {
|
|
6
11
|
case 'full-width':
|
|
@@ -17,14 +22,27 @@ var isTableResized = function isTableResized(columnWidths) {
|
|
|
17
22
|
});
|
|
18
23
|
return !!filteredWidths.length;
|
|
19
24
|
};
|
|
20
|
-
var fixColumnWidth = function fixColumnWidth(columnWidth, _tableWidth, _layoutWidth, zeroWidthColumnsCount) {
|
|
25
|
+
var fixColumnWidth = function fixColumnWidth(columnWidth, _tableWidth, _layoutWidth, zeroWidthColumnsCount, scaleDownPercent) {
|
|
21
26
|
if (columnWidth === 0) {
|
|
22
27
|
return columnWidth;
|
|
23
28
|
}
|
|
29
|
+
|
|
30
|
+
// If the tables total width (including no zero widths col or cols without width) is less than the current layout
|
|
31
|
+
// We scale up the columns to meet the minimum of the table layout.
|
|
32
|
+
if (zeroWidthColumnsCount === 0 && scaleDownPercent) {
|
|
33
|
+
return Math.floor((1 - scaleDownPercent) * columnWidth);
|
|
34
|
+
}
|
|
24
35
|
return Math.max(
|
|
25
36
|
// We need to take tableCellBorderWidth, to avoid unneccesary overflow.
|
|
26
37
|
columnWidth - tableCellBorderWidth, zeroWidthColumnsCount ? akEditorTableLegacyCellMinWidth : tableCellMinWidth);
|
|
27
38
|
};
|
|
39
|
+
export var calcScalePercent = function calcScalePercent(_ref) {
|
|
40
|
+
var renderWidth = _ref.renderWidth,
|
|
41
|
+
tableWidth = _ref.tableWidth,
|
|
42
|
+
maxScale = _ref.maxScale;
|
|
43
|
+
var diffPercent = 1 - renderWidth / tableWidth;
|
|
44
|
+
return diffPercent < maxScale ? diffPercent : maxScale;
|
|
45
|
+
};
|
|
28
46
|
export var Colgroup = function Colgroup(props) {
|
|
29
47
|
var columnWidths = props.columnWidths,
|
|
30
48
|
layout = props.layout,
|
|
@@ -58,6 +76,7 @@ export var Colgroup = function Colgroup(props) {
|
|
|
58
76
|
minTableWidth += Math.ceil(width) || akEditorTableLegacyCellMinWidth;
|
|
59
77
|
});
|
|
60
78
|
var cellMinWidth = 0;
|
|
79
|
+
var scaleDownPercent = 0;
|
|
61
80
|
// fixes migration tables with zero-width columns
|
|
62
81
|
if (zeroWidthColumnsCount > 0) {
|
|
63
82
|
if (minTableWidth > maxTableWidth) {
|
|
@@ -65,12 +84,20 @@ export var Colgroup = function Colgroup(props) {
|
|
|
65
84
|
cellMinWidth = minWidth < akEditorTableLegacyCellMinWidth ? akEditorTableLegacyCellMinWidth : minWidth;
|
|
66
85
|
}
|
|
67
86
|
}
|
|
87
|
+
// scaling down
|
|
88
|
+
else if (renderWidth < tableWidth) {
|
|
89
|
+
scaleDownPercent = calcScalePercent({
|
|
90
|
+
renderWidth: renderWidth,
|
|
91
|
+
tableWidth: tableWidth,
|
|
92
|
+
maxScale: MAX_SCALING_PERCENT
|
|
93
|
+
});
|
|
94
|
+
}
|
|
68
95
|
return /*#__PURE__*/React.createElement("colgroup", null, isNumberColumnEnabled && /*#__PURE__*/React.createElement("col", {
|
|
69
96
|
style: {
|
|
70
97
|
width: akEditorTableNumberColumnWidth
|
|
71
98
|
}
|
|
72
99
|
}), columnWidths.map(function (colWidth, idx) {
|
|
73
|
-
var width = fixColumnWidth(colWidth, minTableWidth, maxTableWidth, zeroWidthColumnsCount) || cellMinWidth;
|
|
100
|
+
var width = fixColumnWidth(colWidth, minTableWidth, maxTableWidth, zeroWidthColumnsCount, scaleDownPercent) || cellMinWidth;
|
|
74
101
|
var style = width ? {
|
|
75
102
|
width: "".concat(width, "px")
|
|
76
103
|
} : {};
|
|
@@ -45,11 +45,28 @@ var getSortOrderLabel = function getSortOrderLabel(intl, currentSortOrder) {
|
|
|
45
45
|
return intl.formatMessage(noneSortingLabel);
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
var getDataAttributes = function getDataAttributes(colwidth) {
|
|
48
|
+
var getDataAttributes = function getDataAttributes(colwidth, background) {
|
|
49
49
|
var attrs = {};
|
|
50
50
|
if (colwidth) {
|
|
51
51
|
attrs['data-colwidth'] = colwidth.join(',');
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Storing hex code in data-cell-background because
|
|
55
|
+
* we want to have DST token (css variable) or
|
|
56
|
+
* DST token value (value (hex code) of css variable) in
|
|
57
|
+
* inline style to correct render table cell background
|
|
58
|
+
* based on selected theme.
|
|
59
|
+
* Currently we rely on background color hex code stored in
|
|
60
|
+
* inline style.
|
|
61
|
+
* Because of that when we copy and paste table, we end up
|
|
62
|
+
* having DST token or DST token value in ADF instead of
|
|
63
|
+
* original hex code which we map to DST token.
|
|
64
|
+
* So, introducing data-cell-background.
|
|
65
|
+
* More details at https://product-fabric.atlassian.net/wiki/spaces/EUXQ/pages/3472556903/Tokenising+tableCell+background+colors#Update-toDom-and-parseDom-to-store-and-read-background-color-from-data-cell-background-attribute.4
|
|
66
|
+
*/
|
|
67
|
+
if (background) {
|
|
68
|
+
attrs['data-cell-background'] = background;
|
|
69
|
+
}
|
|
53
70
|
return attrs;
|
|
54
71
|
};
|
|
55
72
|
var getStyle = function getStyle(background, colGroupWidth, offsetTop) {
|
|
@@ -98,7 +115,7 @@ var withCellProps = function withCellProps(WrapperComponent) {
|
|
|
98
115
|
colorname: colorName,
|
|
99
116
|
onClick: onClick,
|
|
100
117
|
className: className
|
|
101
|
-
}, getDataAttributes(colwidth), {
|
|
118
|
+
}, getDataAttributes(colwidth, background), {
|
|
102
119
|
"aria-sort": ariaSort
|
|
103
120
|
}), children);
|
|
104
121
|
}
|
|
@@ -57,9 +57,11 @@ export var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
|
57
57
|
attributes: {
|
|
58
58
|
platform: PLATFORM.WEB,
|
|
59
59
|
errorMessage: error === null || error === void 0 ? void 0 : error.message,
|
|
60
|
-
errorStack: error === null || error === void 0 ? void 0 : error.stack,
|
|
61
60
|
componentStack: errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.componentStack,
|
|
62
61
|
errorRethrown: Boolean(this.props.rethrowError)
|
|
62
|
+
},
|
|
63
|
+
nonPrivacySafeAttributes: {
|
|
64
|
+
errorStack: error === null || error === void 0 ? void 0 : error.stack
|
|
63
65
|
}
|
|
64
66
|
});
|
|
65
67
|
if (this.hasFallback()) {
|
|
@@ -45,7 +45,7 @@ import { RenderTracking } from '../../react/utils/performance/RenderTracking';
|
|
|
45
45
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
46
46
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
47
47
|
var packageName = "@atlaskit/renderer";
|
|
48
|
-
var packageVersion = "106.0.
|
|
48
|
+
var packageVersion = "106.0.2";
|
|
49
49
|
export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
50
50
|
_inherits(Renderer, _PureComponent);
|
|
51
51
|
var _super = _createSuper(Renderer);
|
package/dist/esm/version.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
1
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, OperationalAEP } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { AEP } from './enums';
|
|
3
3
|
import { PropsDifference, SEVERITY, ShallowPropsDifference, UNSUPPORTED_CONTENT_LEVEL_SEVERITY } from '@atlaskit/editor-common/utils';
|
|
4
4
|
import type { UnsupportedContentPayload, UnsupportedContentTooltipPayload } from '@atlaskit/editor-common/utils';
|
|
@@ -28,13 +28,15 @@ declare type RendererReRenderedAEP<Props> = AEP<ACTION.RE_RENDERED, ACTION_SUBJE
|
|
|
28
28
|
count: number;
|
|
29
29
|
componentId?: string;
|
|
30
30
|
}, EVENT_TYPE.OPERATIONAL>;
|
|
31
|
-
export declare type ComponentCrashErrorAEP =
|
|
31
|
+
export declare type ComponentCrashErrorAEP = OperationalAEP<ACTION.CRASHED, ACTION_SUBJECT.RENDERER, ACTION_SUBJECT_ID, {
|
|
32
32
|
platform: PLATFORM.WEB;
|
|
33
33
|
errorMessage?: string;
|
|
34
34
|
errorStack?: string;
|
|
35
35
|
componentStack?: string;
|
|
36
36
|
errorRethrown?: boolean;
|
|
37
|
-
},
|
|
37
|
+
}, {
|
|
38
|
+
errorStack?: string;
|
|
39
|
+
}>;
|
|
38
40
|
declare type InvalidProsemirrorDocumentErrorAEP = AEP<ACTION.INVALID_PROSEMIRROR_DOCUMENT, ACTION_SUBJECT.RENDERER, ACTION_SUBJECT_ID, {
|
|
39
41
|
platform: PLATFORM.WEB;
|
|
40
42
|
errorStack?: string;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SharedTableProps } from './types';
|
|
3
|
+
export interface ScaleOptions {
|
|
4
|
+
renderWidth: number;
|
|
5
|
+
tableWidth: number;
|
|
6
|
+
maxScale: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const calcScalePercent: ({ renderWidth, tableWidth, maxScale, }: ScaleOptions) => number;
|
|
3
9
|
export declare const Colgroup: (props: SharedTableProps) => JSX.Element | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "106.0.
|
|
3
|
+
"version": "106.0.2",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -24,30 +24,30 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@atlaskit/adf-schema": "^25.
|
|
27
|
+
"@atlaskit/adf-schema": "^25.2.0",
|
|
28
28
|
"@atlaskit/adf-utils": "^18.0.0",
|
|
29
29
|
"@atlaskit/analytics-listeners": "^8.5.0",
|
|
30
30
|
"@atlaskit/analytics-namespaced-context": "^6.6.0",
|
|
31
|
-
"@atlaskit/analytics-next": "^
|
|
31
|
+
"@atlaskit/analytics-next": "^9.0.0",
|
|
32
32
|
"@atlaskit/button": "^16.5.0",
|
|
33
33
|
"@atlaskit/code": "^14.4.0",
|
|
34
|
-
"@atlaskit/editor-common": "^72.
|
|
34
|
+
"@atlaskit/editor-common": "^72.4.0",
|
|
35
35
|
"@atlaskit/editor-json-transformer": "^8.8.0",
|
|
36
36
|
"@atlaskit/editor-palette": "1.0.0",
|
|
37
37
|
"@atlaskit/editor-shared-styles": "^2.3.0",
|
|
38
38
|
"@atlaskit/emoji": "^67.0.0",
|
|
39
39
|
"@atlaskit/icon": "^21.11.0",
|
|
40
|
-
"@atlaskit/media-card": "^74.
|
|
40
|
+
"@atlaskit/media-card": "^74.6.0",
|
|
41
41
|
"@atlaskit/media-client": "^20.0.0",
|
|
42
42
|
"@atlaskit/media-common": "^2.19.0",
|
|
43
43
|
"@atlaskit/media-filmstrip": "^46.1.0",
|
|
44
44
|
"@atlaskit/media-ui": "^22.3.0",
|
|
45
45
|
"@atlaskit/media-viewer": "^47.4.0",
|
|
46
|
-
"@atlaskit/smart-card": "^24.
|
|
46
|
+
"@atlaskit/smart-card": "^24.3.0",
|
|
47
47
|
"@atlaskit/status": "^1.2.0",
|
|
48
48
|
"@atlaskit/task-decision": "^17.5.0",
|
|
49
49
|
"@atlaskit/theme": "^12.2.0",
|
|
50
|
-
"@atlaskit/tokens": "^1.
|
|
50
|
+
"@atlaskit/tokens": "^1.2.0",
|
|
51
51
|
"@atlaskit/tooltip": "^17.6.0",
|
|
52
52
|
"@babel/runtime": "^7.0.0",
|
|
53
53
|
"@emotion/react": "^11.7.1",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@atlaskit/avatar": "^21.1.0",
|
|
72
72
|
"@atlaskit/css-reset": "^6.3.0",
|
|
73
73
|
"@atlaskit/docs": "*",
|
|
74
|
-
"@atlaskit/editor-core": "^179.
|
|
74
|
+
"@atlaskit/editor-core": "^179.1.0",
|
|
75
75
|
"@atlaskit/editor-test-helpers": "^18.0.0",
|
|
76
76
|
"@atlaskit/link-provider": "^1.4.0",
|
|
77
77
|
"@atlaskit/logo": "^13.11.0",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"@atlaskit/media-test-helpers": "^30.1.0",
|
|
81
81
|
"@atlaskit/mention": "^21.0.0",
|
|
82
82
|
"@atlaskit/navigation-next": "^9.0.0",
|
|
83
|
-
"@atlaskit/profilecard": "^18.
|
|
83
|
+
"@atlaskit/profilecard": "^18.3.0",
|
|
84
84
|
"@atlaskit/radio": "^5.4.0",
|
|
85
85
|
"@atlaskit/range": "^7.0.0",
|
|
86
86
|
"@atlaskit/ssr": "*",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"ajv": "^6.12.6",
|
|
96
96
|
"enzyme": "^3.10.0",
|
|
97
97
|
"jsdom": "^16.2.2",
|
|
98
|
-
"mockdate": "^3.0.
|
|
98
|
+
"mockdate": "^3.0.5",
|
|
99
99
|
"puppeteer": "13.7.0",
|
|
100
100
|
"react": "^16.8.0",
|
|
101
101
|
"react-dom": "^16.8.0",
|
|
@@ -110,7 +110,9 @@
|
|
|
110
110
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1",
|
|
111
111
|
"techstack": {
|
|
112
112
|
"@repo/internal": {
|
|
113
|
-
"
|
|
113
|
+
"design-tokens": [
|
|
114
|
+
"color"
|
|
115
|
+
],
|
|
114
116
|
"deprecation": "no-deprecated-imports",
|
|
115
117
|
"styling": [
|
|
116
118
|
"emotion"
|