@atlaskit/renderer 108.7.1 → 108.7.3
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/dist/cjs/react/nodes/table/colgroup.js +5 -4
- package/dist/cjs/react/nodes/table/sticky.js +19 -15
- package/dist/cjs/react/nodes/table/table.js +4 -2
- package/dist/cjs/react/nodes/table.js +13 -5
- package/dist/cjs/react/utils/appearance.js +18 -0
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/cjs/ui/Renderer/style.js +7 -4
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/react/nodes/table/colgroup.js +6 -4
- package/dist/es2019/react/nodes/table/sticky.js +46 -40
- package/dist/es2019/react/nodes/table/table.js +4 -2
- package/dist/es2019/react/nodes/table.js +9 -4
- package/dist/es2019/react/utils/appearance.js +3 -0
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/es2019/ui/Renderer/style.js +8 -5
- package/dist/es2019/version.json +1 -1
- package/dist/esm/react/nodes/table/colgroup.js +6 -4
- package/dist/esm/react/nodes/table/sticky.js +19 -15
- package/dist/esm/react/nodes/table/table.js +4 -2
- package/dist/esm/react/nodes/table.js +11 -4
- package/dist/esm/react/utils/appearance.js +9 -0
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/esm/ui/Renderer/style.js +7 -4
- package/dist/esm/version.json +1 -1
- package/dist/types/react/nodes/table/sticky.d.ts +4 -1
- package/dist/types/react/nodes/table/table.d.ts +1 -1
- package/dist/types/react/nodes/table/types.d.ts +2 -0
- package/dist/types/react/nodes/table.d.ts +1 -0
- package/dist/types/react/utils/appearance.d.ts +4 -0
- package/dist/types-ts4.5/react/nodes/table/sticky.d.ts +4 -1
- package/dist/types-ts4.5/react/nodes/table/table.d.ts +1 -1
- package/dist/types-ts4.5/react/nodes/table/types.d.ts +2 -0
- package/dist/types-ts4.5/react/nodes/table.d.ts +1 -0
- package/dist/types-ts4.5/react/utils/appearance.d.ts +4 -0
- package/package.json +7 -3
- package/tmp/api-report-tmp.d.ts +0 -546
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 108.7.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e7ed90bad7c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e7ed90bad7c) - Use renderer appearance to use custom width
|
|
8
|
+
|
|
9
|
+
## 108.7.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`3fb20c4aeba`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3fb20c4aeba) - Add postinstall check to enforce internal peer dependencies
|
|
14
|
+
|
|
3
15
|
## 108.7.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -8,8 +8,8 @@ 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
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
11
|
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
12
|
+
var _table = require("../table");
|
|
13
13
|
// we allow scaling down column widths by no more than 30%
|
|
14
14
|
// this intends to reduce unwanted scrolling in the Renderer in these scenarios:
|
|
15
15
|
// User A creates a table with column widths → User B views it on a smaller screen
|
|
@@ -58,12 +58,13 @@ var Colgroup = function Colgroup(props) {
|
|
|
58
58
|
layout = props.layout,
|
|
59
59
|
isNumberColumnEnabled = props.isNumberColumnEnabled,
|
|
60
60
|
renderWidth = props.renderWidth,
|
|
61
|
-
tableNode = props.tableNode
|
|
61
|
+
tableNode = props.tableNode,
|
|
62
|
+
rendererAppearance = props.rendererAppearance;
|
|
62
63
|
if (!columnWidths) {
|
|
63
64
|
return null;
|
|
64
65
|
}
|
|
65
66
|
var tableResized = isTableResized(columnWidths);
|
|
66
|
-
if ((0,
|
|
67
|
+
if ((0, _table.isTableResizingEnabled)(rendererAppearance) && !tableResized) {
|
|
67
68
|
return /*#__PURE__*/_react.default.createElement("colgroup", null, isNumberColumnEnabled && /*#__PURE__*/_react.default.createElement("col", {
|
|
68
69
|
style: {
|
|
69
70
|
width: _editorSharedStyles.akEditorTableNumberColumnWidth
|
|
@@ -80,7 +81,7 @@ var Colgroup = function Colgroup(props) {
|
|
|
80
81
|
return null;
|
|
81
82
|
}
|
|
82
83
|
var tableContainerWidth;
|
|
83
|
-
if ((0,
|
|
84
|
+
if ((0, _table.isTableResizingEnabled)(rendererAppearance) && tableNode) {
|
|
84
85
|
tableContainerWidth = (0, _nodeWidth.getTableContainerWidth)(tableNode);
|
|
85
86
|
} else {
|
|
86
87
|
tableContainerWidth = getTableLayoutWidth(layout);
|
|
@@ -14,9 +14,9 @@ var _react2 = require("@emotion/react");
|
|
|
14
14
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
15
15
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
16
16
|
var _colors = require("@atlaskit/theme/colors");
|
|
17
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
17
|
var _table = require("./table");
|
|
19
18
|
var _injectProps = require("../../utils/inject-props");
|
|
19
|
+
var _table2 = require("../table");
|
|
20
20
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
21
21
|
/** @jsx jsx */
|
|
22
22
|
var tableStickyPadding = 8;
|
|
@@ -26,22 +26,23 @@ var modeSpecficStyles = {
|
|
|
26
26
|
stick: (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n position: fixed;\n "]))),
|
|
27
27
|
'pin-bottom': (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n "])))
|
|
28
28
|
};
|
|
29
|
-
var stickyHeaderZIndex;
|
|
30
|
-
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width')) {
|
|
31
|
-
stickyHeaderZIndex = 13;
|
|
32
|
-
} else {
|
|
33
|
-
stickyHeaderZIndex = _editorSharedStyles.akEditorStickyHeaderZIndex;
|
|
34
|
-
}
|
|
35
29
|
|
|
36
30
|
// TODO: Quality ticket: https://product-fabric.atlassian.net/browse/DSP-4123
|
|
37
|
-
var fixedTableDivStaticStyles = function fixedTableDivStaticStyles(top, width) {
|
|
38
|
-
|
|
31
|
+
var fixedTableDivStaticStyles = function fixedTableDivStaticStyles(top, width, rendererAppearance) {
|
|
32
|
+
var stickyHeaderZIndex;
|
|
33
|
+
if ((0, _table2.isTableResizingEnabled)(rendererAppearance)) {
|
|
34
|
+
stickyHeaderZIndex = 13;
|
|
35
|
+
} else {
|
|
36
|
+
stickyHeaderZIndex = _editorSharedStyles.akEditorStickyHeaderZIndex;
|
|
37
|
+
}
|
|
38
|
+
return (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n width: ", "px;\n z-index: ", ";\n &\n .", ",\n &\n .", "\n > table {\n margin-top: 0;\n margin-bottom: 0;\n tr {\n background: ", ";\n }\n }\n\n border-top: ", "px solid\n ", ";\n background: ", ";\n box-shadow: 0 6px 4px -4px ", ";\n\n div[data-expanded='false'] & {\n display: none;\n }\n\n &\n .", ".is-sticky.right-shadow::after,\n &\n .", ".is-sticky.left-shadow::before {\n top: 0px;\n height: 100%;\n }\n "])), typeof top === 'number' && "top: ".concat(top, "px;"), width, stickyHeaderZIndex, _styles.TableSharedCssClassName.TABLE_CONTAINER, _styles.TableSharedCssClassName.TABLE_STICKY_WRAPPER, "var(--ds-surface, white)", tableStickyPadding, "var(--ds-surface, white)", "var(--ds-surface-overlay, white)", "var(--ds-shadow-overflow-perimeter, ".concat(_colors.N40A, ")"), _styles.TableSharedCssClassName.TABLE_CONTAINER, _styles.TableSharedCssClassName.TABLE_CONTAINER);
|
|
39
39
|
};
|
|
40
40
|
var FixedTableDiv = function FixedTableDiv(props) {
|
|
41
41
|
var top = props.top,
|
|
42
42
|
wrapperWidth = props.wrapperWidth,
|
|
43
|
-
mode = props.mode
|
|
44
|
-
|
|
43
|
+
mode = props.mode,
|
|
44
|
+
rendererAppearance = props.rendererAppearance;
|
|
45
|
+
var fixedTableCss = [fixedTableDivStaticStyles(top, wrapperWidth, rendererAppearance), modeSpecficStyles === null || modeSpecficStyles === void 0 ? void 0 : modeSpecficStyles[mode]];
|
|
45
46
|
var attrs = {
|
|
46
47
|
mode: mode
|
|
47
48
|
};
|
|
@@ -65,10 +66,11 @@ var StickyTable = function StickyTable(_ref) {
|
|
|
65
66
|
columnWidths = _ref.columnWidths,
|
|
66
67
|
renderWidth = _ref.renderWidth,
|
|
67
68
|
rowHeight = _ref.rowHeight,
|
|
68
|
-
tableNode = _ref.tableNode
|
|
69
|
+
tableNode = _ref.tableNode,
|
|
70
|
+
rendererAppearance = _ref.rendererAppearance;
|
|
69
71
|
var styles;
|
|
70
72
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
71
|
-
if ((0,
|
|
73
|
+
if ((0, _table2.isTableResizingEnabled)(rendererAppearance)) {
|
|
72
74
|
styles = (0, _react2.css)({
|
|
73
75
|
top: mode === 'pin-bottom' ? top : undefined,
|
|
74
76
|
position: 'relative'
|
|
@@ -86,7 +88,8 @@ var StickyTable = function StickyTable(_ref) {
|
|
|
86
88
|
}, (0, _react2.jsx)(FixedTableDiv, {
|
|
87
89
|
top: mode === 'stick' ? top : undefined,
|
|
88
90
|
mode: rowHeight > 300 ? 'none' : mode,
|
|
89
|
-
wrapperWidth: wrapperWidth
|
|
91
|
+
wrapperWidth: wrapperWidth,
|
|
92
|
+
rendererAppearance: rendererAppearance
|
|
90
93
|
}, (0, _react2.jsx)("div", {
|
|
91
94
|
className: "".concat(_styles.TableSharedCssClassName.TABLE_CONTAINER, " is-sticky ").concat(shadowClassNames || ''),
|
|
92
95
|
"data-layout": layout,
|
|
@@ -104,7 +107,8 @@ var StickyTable = function StickyTable(_ref) {
|
|
|
104
107
|
layout: layout,
|
|
105
108
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
106
109
|
renderWidth: renderWidth,
|
|
107
|
-
tableNode: tableNode
|
|
110
|
+
tableNode: tableNode,
|
|
111
|
+
rendererAppearance: rendererAppearance
|
|
108
112
|
},
|
|
109
113
|
/**
|
|
110
114
|
* @see https://product-fabric.atlassian.net/browse/ED-10235
|
|
@@ -14,7 +14,8 @@ var Table = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
14
14
|
layout = _ref.layout,
|
|
15
15
|
renderWidth = _ref.renderWidth,
|
|
16
16
|
children = _ref.children,
|
|
17
|
-
tableNode = _ref.tableNode
|
|
17
|
+
tableNode = _ref.tableNode,
|
|
18
|
+
rendererAppearance = _ref.rendererAppearance;
|
|
18
19
|
return /*#__PURE__*/_react.default.createElement("table", {
|
|
19
20
|
"data-number-column": isNumberColumnEnabled,
|
|
20
21
|
ref: innerRef
|
|
@@ -23,7 +24,8 @@ var Table = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
23
24
|
layout: layout,
|
|
24
25
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
25
26
|
renderWidth: renderWidth,
|
|
26
|
-
tableNode: tableNode
|
|
27
|
+
tableNode: tableNode,
|
|
28
|
+
rendererAppearance: rendererAppearance
|
|
27
29
|
}), /*#__PURE__*/_react.default.createElement("tbody", null, children));
|
|
28
30
|
});
|
|
29
31
|
exports.Table = Table;
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.default = exports.TableProcessor = exports.TableContainer = void 0;
|
|
7
|
+
exports.isTableResizingEnabled = exports.default = exports.TableProcessor = exports.TableContainer = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -26,8 +26,13 @@ var _tableCell = require("./tableCell");
|
|
|
26
26
|
var _SmartCardStorage = require("../../ui/SmartCardStorage");
|
|
27
27
|
var _sticky = require("./table/sticky");
|
|
28
28
|
var _table = require("./table/table");
|
|
29
|
+
var _appearance = require("../utils/appearance");
|
|
29
30
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
30
31
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
32
|
+
var isTableResizingEnabled = function isTableResizingEnabled(appearance) {
|
|
33
|
+
return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') && (0, _appearance.isFullWidthOrFullPageAppearance)(appearance);
|
|
34
|
+
};
|
|
35
|
+
exports.isTableResizingEnabled = isTableResizingEnabled;
|
|
31
36
|
var orderChildren = function orderChildren(children, tableNode, smartCardStorage, tableOrderStatus) {
|
|
32
37
|
if (!tableOrderStatus || tableOrderStatus.order === _types.SortOrder.NO_ORDER) {
|
|
33
38
|
return children;
|
|
@@ -261,7 +266,7 @@ var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
261
266
|
var calcDefaultLayoutWidthByAppearance = function calcDefaultLayoutWidthByAppearance(tableNode, rendererAppearance) {
|
|
262
267
|
return rendererAppearance === 'full-width' && !tableNode.attrs.width ? Math.min(_editorSharedStyles.akEditorFullWidthLayoutWidth, renderWidth) : Math.min((0, _nodeWidth.getTableContainerWidth)(tableNode), renderWidth);
|
|
263
268
|
};
|
|
264
|
-
if ((
|
|
269
|
+
if (isTableResizingEnabled(rendererAppearance) && tableNode) {
|
|
265
270
|
tableWidth = calcDefaultLayoutWidthByAppearance(tableNode, rendererAppearance);
|
|
266
271
|
} else {
|
|
267
272
|
tableWidth = (0, _styles.calcTableWidth)(layout, renderWidth, false);
|
|
@@ -284,7 +289,8 @@ var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
284
289
|
innerRef: this.stickyWrapperRef,
|
|
285
290
|
wrapperWidth: wrapperWidth,
|
|
286
291
|
columnWidths: columnWidths,
|
|
287
|
-
rowHeight: this.headerRowHeight
|
|
292
|
+
rowHeight: this.headerRowHeight,
|
|
293
|
+
rendererAppearance: rendererAppearance
|
|
288
294
|
}, [children && children[0]]), /*#__PURE__*/_react.default.createElement("div", {
|
|
289
295
|
className: "".concat(_styles.TableSharedCssClassName.TABLE_CONTAINER, " ").concat(this.props.shadowClassNames || ''),
|
|
290
296
|
"data-layout": layout,
|
|
@@ -306,7 +312,8 @@ var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
306
312
|
wrapperWidth: wrapperWidth,
|
|
307
313
|
columnWidths: columnWidths,
|
|
308
314
|
rowHeight: this.headerRowHeight,
|
|
309
|
-
tableNode: tableNode
|
|
315
|
+
tableNode: tableNode,
|
|
316
|
+
rendererAppearance: rendererAppearance
|
|
310
317
|
}, [children && children[0]]), /*#__PURE__*/_react.default.createElement("div", {
|
|
311
318
|
className: _styles.TableSharedCssClassName.TABLE_NODE_WRAPPER,
|
|
312
319
|
ref: this.wrapperRef,
|
|
@@ -317,7 +324,8 @@ var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
317
324
|
layout: layout,
|
|
318
325
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
319
326
|
renderWidth: renderWidth,
|
|
320
|
-
tableNode: tableNode
|
|
327
|
+
tableNode: tableNode,
|
|
328
|
+
rendererAppearance: rendererAppearance
|
|
321
329
|
}, this.grabFirstRowRef(children)))));
|
|
322
330
|
}
|
|
323
331
|
}]);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isFullWidthOrFullPageAppearance = exports.isFullWidthAppearance = exports.isFullPageAppearance = void 0;
|
|
7
|
+
var isFullWidthAppearance = function isFullWidthAppearance(appearance) {
|
|
8
|
+
return appearance === 'full-width';
|
|
9
|
+
};
|
|
10
|
+
exports.isFullWidthAppearance = isFullWidthAppearance;
|
|
11
|
+
var isFullPageAppearance = function isFullPageAppearance(appearance) {
|
|
12
|
+
return appearance === 'full-page';
|
|
13
|
+
};
|
|
14
|
+
exports.isFullPageAppearance = isFullPageAppearance;
|
|
15
|
+
var isFullWidthOrFullPageAppearance = function isFullWidthOrFullPageAppearance(appearance) {
|
|
16
|
+
return isFullPageAppearance(appearance) || isFullWidthAppearance(appearance);
|
|
17
|
+
};
|
|
18
|
+
exports.isFullWidthOrFullPageAppearance = isFullWidthOrFullPageAppearance;
|
|
@@ -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 = "108.7.
|
|
58
|
+
var packageVersion = "108.7.3";
|
|
59
59
|
var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
60
60
|
(0, _inherits2.default)(Renderer, _PureComponent);
|
|
61
61
|
var _super = _createSuper(Renderer);
|
|
@@ -12,7 +12,6 @@ var _components = require("@atlaskit/theme/components");
|
|
|
12
12
|
var _constants = require("@atlaskit/theme/constants");
|
|
13
13
|
var colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
|
|
14
14
|
var _typography = require("@atlaskit/theme/typography");
|
|
15
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
15
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
17
16
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
18
17
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
@@ -20,6 +19,7 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
|
20
19
|
var _consts = require("../../consts");
|
|
21
20
|
var _headingAnchor = require("../../react/nodes/heading-anchor");
|
|
22
21
|
var _lightWeightCodeBlock = require("../../react/nodes/codeBlock/components/lightWeightCodeBlock");
|
|
22
|
+
var _table = require("../../react/nodes/table");
|
|
23
23
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
24
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
25
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -50,14 +50,17 @@ var headingSizes = {
|
|
|
50
50
|
};
|
|
51
51
|
exports.headingSizes = headingSizes;
|
|
52
52
|
var headingAnchorStyle = function headingAnchorStyle(headingTag) {
|
|
53
|
-
return (
|
|
53
|
+
return (// TODO Delete this comment after verifying space token -> previous value `margin-left: 6px`
|
|
54
|
+
(0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n /**\n * The copy link button doesn't reserve space in the DOM so that\n * the text alignment isn't impacted by the button/icon's space.\n */\n .", " {\n position: absolute;\n height: ", "em;\n\n margin-left: ", ";\n\n button {\n padding-left: 0;\n padding-right: 0;\n }\n }\n\n /**\n * Applies hover effects to the heading anchor link button\n * to fade in when the user rolls over the heading.\n *\n * The link is persistent on mobile, so we use feature detection\n * to enable hover effects for systems that support it (desktop).\n *\n * @see https://caniuse.com/mdn-css_at-rules_media_hover\n */\n @media (hover: hover) and (pointer: fine) {\n .", " {\n > button {\n opacity: 0;\n transform: translate(-8px, 0px);\n transition: opacity 0.2s ease 0s, transform 0.2s ease 0s;\n }\n }\n\n &:hover {\n .", " > button {\n opacity: 1;\n transform: none !important;\n }\n }\n }\n "])), _headingAnchor.HeadingAnchorWrapperClassName, headingSizes[headingTag].lineHeight, "var(--ds-space-075, 6px)", _headingAnchor.HeadingAnchorWrapperClassName, _headingAnchor.HeadingAnchorWrapperClassName)
|
|
55
|
+
);
|
|
54
56
|
};
|
|
55
57
|
var alignedHeadingAnchorStyle = function alignedHeadingAnchorStyle(_ref) {
|
|
56
58
|
var allowNestedHeaderLinks = _ref.allowNestedHeaderLinks;
|
|
57
59
|
if (!allowNestedHeaderLinks) {
|
|
58
60
|
return '';
|
|
59
61
|
}
|
|
60
|
-
|
|
62
|
+
// TODO Delete this comment after verifying space token -> previous value `margin: 6px`
|
|
63
|
+
return (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n .fabric-editor-block-mark[data-align] > {\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n position: relative;\n }\n }\n\n /**\n * For right-alignment we flip the link to be before the heading\n * text so that the text is flush up against the edge of the editor's\n * container edge.\n */\n .fabric-editor-block-mark:not([data-align='center'])[data-align] {\n > {\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n // Using right to left text to achieve the inverse effect\n // of where the copy link button icon sits for left/center\n // alignment.\n // Although this is unorthodox it's the only approach which\n // allows the button to sit flush against the left edge of\n // bottom line of text.\n direction: rtl;\n\n // By default RTL will negatively impact the layout of special\n // characters within the heading text, and potentially other\n // nested inline nodes. To prevent this we insert pseudo elements\n // containing HTML entities to retain LTR for all heading content\n // except for the copy link button.\n > *:not(.", "):not(br) {\n ::before {\n // Open LTR: https://www.fileformat.info/info/unicode/char/202a/index.htm\n content: '\u202A';\n }\n ::after {\n // Close LTR: https://www.fileformat.info/info/unicode/char/202c/index.htm\n content: '\u202C';\n }\n }\n }\n }\n .", " {\n margin: 0 ", " 0 0;\n }\n\n @media (hover: hover) and (pointer: fine) {\n .", " > button {\n transform: translate(8px, 0px);\n }\n }\n }\n "], ["\n .fabric-editor-block-mark[data-align] > {\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n position: relative;\n }\n }\n\n /**\n * For right-alignment we flip the link to be before the heading\n * text so that the text is flush up against the edge of the editor's\n * container edge.\n */\n .fabric-editor-block-mark:not([data-align='center'])[data-align] {\n > {\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n // Using right to left text to achieve the inverse effect\n // of where the copy link button icon sits for left/center\n // alignment.\n // Although this is unorthodox it's the only approach which\n // allows the button to sit flush against the left edge of\n // bottom line of text.\n direction: rtl;\n\n // By default RTL will negatively impact the layout of special\n // characters within the heading text, and potentially other\n // nested inline nodes. To prevent this we insert pseudo elements\n // containing HTML entities to retain LTR for all heading content\n // except for the copy link button.\n > *:not(.", "):not(br) {\n ::before {\n // Open LTR: https://www.fileformat.info/info/unicode/char/202a/index.htm\n content: '\\u202A';\n }\n ::after {\n // Close LTR: https://www.fileformat.info/info/unicode/char/202c/index.htm\n content: '\\u202C';\n }\n }\n }\n }\n .", " {\n margin: 0 ", " 0 0;\n }\n\n @media (hover: hover) and (pointer: fine) {\n .", " > button {\n transform: translate(8px, 0px);\n }\n }\n }\n "])), _headingAnchor.HeadingAnchorWrapperClassName, _headingAnchor.HeadingAnchorWrapperClassName, "var(--ds-space-075, 6px)", _headingAnchor.HeadingAnchorWrapperClassName);
|
|
61
64
|
};
|
|
62
65
|
var tableSortableColumnStyle = function tableSortableColumnStyle(_ref2) {
|
|
63
66
|
var allowColumnSorting = _ref2.allowColumnSorting,
|
|
@@ -84,7 +87,7 @@ var fullWidthStyles = function fullWidthStyles(_ref5) {
|
|
|
84
87
|
if (appearance !== 'full-width') {
|
|
85
88
|
return '';
|
|
86
89
|
}
|
|
87
|
-
return (0, _react.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n max-width: ", "px;\n margin: 0 auto;\n\n .fabric-editor-breakout-mark,\n .ak-renderer-extension {\n width: 100% !important;\n }\n\n ", "\n "])), _editorSharedStyles.akEditorFullWidthLayoutWidth, (0,
|
|
90
|
+
return (0, _react.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n max-width: ", "px;\n margin: 0 auto;\n\n .fabric-editor-breakout-mark,\n .ak-renderer-extension {\n width: 100% !important;\n }\n\n ", "\n "])), _editorSharedStyles.akEditorFullWidthLayoutWidth, (0, _table.isTableResizingEnabled)(appearance) ? '' : "\n .pm-table-container {\n width: 100% !important;\n }\n ");
|
|
88
91
|
};
|
|
89
92
|
var breakoutWidthStyle = function breakoutWidthStyle(useFragmentMarkBreakoutWidthStylingFix) {
|
|
90
93
|
if (useFragmentMarkBreakoutWidthStylingFix) {
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
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
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
5
|
+
import { isTableResizingEnabled } from '../table';
|
|
6
|
+
|
|
6
7
|
// we allow scaling down column widths by no more than 30%
|
|
7
8
|
// this intends to reduce unwanted scrolling in the Renderer in these scenarios:
|
|
8
9
|
// User A creates a table with column widths → User B views it on a smaller screen
|
|
@@ -50,13 +51,14 @@ export const Colgroup = props => {
|
|
|
50
51
|
layout,
|
|
51
52
|
isNumberColumnEnabled,
|
|
52
53
|
renderWidth,
|
|
53
|
-
tableNode
|
|
54
|
+
tableNode,
|
|
55
|
+
rendererAppearance
|
|
54
56
|
} = props;
|
|
55
57
|
if (!columnWidths) {
|
|
56
58
|
return null;
|
|
57
59
|
}
|
|
58
60
|
const tableResized = isTableResized(columnWidths);
|
|
59
|
-
if (
|
|
61
|
+
if (isTableResizingEnabled(rendererAppearance) && !tableResized) {
|
|
60
62
|
return /*#__PURE__*/React.createElement("colgroup", null, isNumberColumnEnabled && /*#__PURE__*/React.createElement("col", {
|
|
61
63
|
style: {
|
|
62
64
|
width: akEditorTableNumberColumnWidth
|
|
@@ -71,7 +73,7 @@ export const Colgroup = props => {
|
|
|
71
73
|
return null;
|
|
72
74
|
}
|
|
73
75
|
let tableContainerWidth;
|
|
74
|
-
if (
|
|
76
|
+
if (isTableResizingEnabled(rendererAppearance) && tableNode) {
|
|
75
77
|
tableContainerWidth = getTableContainerWidth(tableNode);
|
|
76
78
|
} else {
|
|
77
79
|
tableContainerWidth = getTableLayoutWidth(layout);
|
|
@@ -5,9 +5,9 @@ import { css, jsx } from '@emotion/react';
|
|
|
5
5
|
import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
6
6
|
import { akEditorStickyHeaderZIndex } from '@atlaskit/editor-shared-styles';
|
|
7
7
|
import { N40A } from '@atlaskit/theme/colors';
|
|
8
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { Table } from './table';
|
|
10
9
|
import { recursivelyInjectProps } from '../../utils/inject-props';
|
|
10
|
+
import { isTableResizingEnabled } from '../table';
|
|
11
11
|
export const tableStickyPadding = 8;
|
|
12
12
|
const modeSpecficStyles = {
|
|
13
13
|
none: css`
|
|
@@ -20,54 +20,57 @@ const modeSpecficStyles = {
|
|
|
20
20
|
position: absolute;
|
|
21
21
|
`
|
|
22
22
|
};
|
|
23
|
-
let stickyHeaderZIndex;
|
|
24
|
-
if (getBooleanFF('platform.editor.custom-table-width')) {
|
|
25
|
-
stickyHeaderZIndex = 13;
|
|
26
|
-
} else {
|
|
27
|
-
stickyHeaderZIndex = akEditorStickyHeaderZIndex;
|
|
28
|
-
}
|
|
29
23
|
|
|
30
24
|
// TODO: Quality ticket: https://product-fabric.atlassian.net/browse/DSP-4123
|
|
31
|
-
const fixedTableDivStaticStyles = (top, width) =>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
const fixedTableDivStaticStyles = (top, width, rendererAppearance) => {
|
|
26
|
+
let stickyHeaderZIndex;
|
|
27
|
+
if (isTableResizingEnabled(rendererAppearance)) {
|
|
28
|
+
stickyHeaderZIndex = 13;
|
|
29
|
+
} else {
|
|
30
|
+
stickyHeaderZIndex = akEditorStickyHeaderZIndex;
|
|
31
|
+
}
|
|
32
|
+
return css`
|
|
33
|
+
${typeof top === 'number' && `top: ${top}px;`}
|
|
34
|
+
width: ${width}px;
|
|
35
|
+
z-index: ${stickyHeaderZIndex};
|
|
37
36
|
&
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
.${TableSharedCssClassName.TABLE_CONTAINER},
|
|
38
|
+
&
|
|
39
|
+
.${TableSharedCssClassName.TABLE_STICKY_WRAPPER}
|
|
40
|
+
> table {
|
|
41
|
+
margin-top: 0;
|
|
42
|
+
margin-bottom: 0;
|
|
43
|
+
tr {
|
|
44
|
+
background: ${"var(--ds-surface, white)"};
|
|
45
|
+
}
|
|
44
46
|
}
|
|
45
|
-
}
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
border-top: ${tableStickyPadding}px solid
|
|
49
|
+
${"var(--ds-surface, white)"};
|
|
50
|
+
background: ${"var(--ds-surface-overlay, white)"};
|
|
51
|
+
box-shadow: 0 6px 4px -4px ${`var(--ds-shadow-overflow-perimeter, ${N40A})`};
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
div[data-expanded='false'] & {
|
|
54
|
+
display: none;
|
|
55
|
+
}
|
|
55
56
|
|
|
56
|
-
&
|
|
57
|
-
.${TableSharedCssClassName.TABLE_CONTAINER}.is-sticky.right-shadow::after,
|
|
58
57
|
&
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
.${TableSharedCssClassName.TABLE_CONTAINER}.is-sticky.right-shadow::after,
|
|
59
|
+
&
|
|
60
|
+
.${TableSharedCssClassName.TABLE_CONTAINER}.is-sticky.left-shadow::before {
|
|
61
|
+
top: 0px;
|
|
62
|
+
height: 100%;
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
};
|
|
64
66
|
export const FixedTableDiv = props => {
|
|
65
67
|
const {
|
|
66
68
|
top,
|
|
67
69
|
wrapperWidth,
|
|
68
|
-
mode
|
|
70
|
+
mode,
|
|
71
|
+
rendererAppearance
|
|
69
72
|
} = props;
|
|
70
|
-
const fixedTableCss = [fixedTableDivStaticStyles(top, wrapperWidth), modeSpecficStyles === null || modeSpecficStyles === void 0 ? void 0 : modeSpecficStyles[mode]];
|
|
73
|
+
const fixedTableCss = [fixedTableDivStaticStyles(top, wrapperWidth, rendererAppearance), modeSpecficStyles === null || modeSpecficStyles === void 0 ? void 0 : modeSpecficStyles[mode]];
|
|
71
74
|
const attrs = {
|
|
72
75
|
mode
|
|
73
76
|
};
|
|
@@ -90,11 +93,12 @@ export const StickyTable = ({
|
|
|
90
93
|
columnWidths,
|
|
91
94
|
renderWidth,
|
|
92
95
|
rowHeight,
|
|
93
|
-
tableNode
|
|
96
|
+
tableNode,
|
|
97
|
+
rendererAppearance
|
|
94
98
|
}) => {
|
|
95
99
|
let styles;
|
|
96
100
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
97
|
-
if (
|
|
101
|
+
if (isTableResizingEnabled(rendererAppearance)) {
|
|
98
102
|
styles = css({
|
|
99
103
|
top: mode === 'pin-bottom' ? top : undefined,
|
|
100
104
|
position: 'relative'
|
|
@@ -112,7 +116,8 @@ export const StickyTable = ({
|
|
|
112
116
|
}, jsx(FixedTableDiv, {
|
|
113
117
|
top: mode === 'stick' ? top : undefined,
|
|
114
118
|
mode: rowHeight > 300 ? 'none' : mode,
|
|
115
|
-
wrapperWidth: wrapperWidth
|
|
119
|
+
wrapperWidth: wrapperWidth,
|
|
120
|
+
rendererAppearance: rendererAppearance
|
|
116
121
|
}, jsx("div", {
|
|
117
122
|
className: `${TableSharedCssClassName.TABLE_CONTAINER} is-sticky ${shadowClassNames || ''}`,
|
|
118
123
|
"data-layout": layout,
|
|
@@ -130,7 +135,8 @@ export const StickyTable = ({
|
|
|
130
135
|
layout: layout,
|
|
131
136
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
132
137
|
renderWidth: renderWidth,
|
|
133
|
-
tableNode: tableNode
|
|
138
|
+
tableNode: tableNode,
|
|
139
|
+
rendererAppearance: rendererAppearance
|
|
134
140
|
},
|
|
135
141
|
/**
|
|
136
142
|
* @see https://product-fabric.atlassian.net/browse/ED-10235
|
|
@@ -7,7 +7,8 @@ export const Table = /*#__PURE__*/React.memo(({
|
|
|
7
7
|
layout,
|
|
8
8
|
renderWidth,
|
|
9
9
|
children,
|
|
10
|
-
tableNode
|
|
10
|
+
tableNode,
|
|
11
|
+
rendererAppearance
|
|
11
12
|
}) => {
|
|
12
13
|
return /*#__PURE__*/React.createElement("table", {
|
|
13
14
|
"data-number-column": isNumberColumnEnabled,
|
|
@@ -17,6 +18,7 @@ export const Table = /*#__PURE__*/React.memo(({
|
|
|
17
18
|
layout: layout,
|
|
18
19
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
19
20
|
renderWidth: renderWidth,
|
|
20
|
-
tableNode: tableNode
|
|
21
|
+
tableNode: tableNode,
|
|
22
|
+
rendererAppearance: rendererAppearance
|
|
21
23
|
}), /*#__PURE__*/React.createElement("tbody", null, children));
|
|
22
24
|
});
|
|
@@ -14,6 +14,8 @@ import { TableHeader } from './tableCell';
|
|
|
14
14
|
import { withSmartCardStorage } from '../../ui/SmartCardStorage';
|
|
15
15
|
import { StickyTable, tableStickyPadding, OverflowParent } from './table/sticky';
|
|
16
16
|
import { Table } from './table/table';
|
|
17
|
+
import { isFullWidthOrFullPageAppearance } from '../utils/appearance';
|
|
18
|
+
export const isTableResizingEnabled = appearance => getBooleanFF('platform.editor.custom-table-width') && isFullWidthOrFullPageAppearance(appearance);
|
|
17
19
|
const orderChildren = (children, tableNode, smartCardStorage, tableOrderStatus) => {
|
|
18
20
|
if (!tableOrderStatus || tableOrderStatus.order === SortOrder.NO_ORDER) {
|
|
19
21
|
return children;
|
|
@@ -221,7 +223,7 @@ export class TableContainer extends React.Component {
|
|
|
221
223
|
const calcDefaultLayoutWidthByAppearance = (tableNode, rendererAppearance) => {
|
|
222
224
|
return rendererAppearance === 'full-width' && !tableNode.attrs.width ? Math.min(akEditorFullWidthLayoutWidth, renderWidth) : Math.min(getTableContainerWidth(tableNode), renderWidth);
|
|
223
225
|
};
|
|
224
|
-
if (
|
|
226
|
+
if (isTableResizingEnabled(rendererAppearance) && tableNode) {
|
|
225
227
|
tableWidth = calcDefaultLayoutWidthByAppearance(tableNode, rendererAppearance);
|
|
226
228
|
} else {
|
|
227
229
|
tableWidth = calcTableWidth(layout, renderWidth, false);
|
|
@@ -244,7 +246,8 @@ export class TableContainer extends React.Component {
|
|
|
244
246
|
innerRef: this.stickyWrapperRef,
|
|
245
247
|
wrapperWidth: wrapperWidth,
|
|
246
248
|
columnWidths: columnWidths,
|
|
247
|
-
rowHeight: this.headerRowHeight
|
|
249
|
+
rowHeight: this.headerRowHeight,
|
|
250
|
+
rendererAppearance: rendererAppearance
|
|
248
251
|
}, [children && children[0]]), /*#__PURE__*/React.createElement("div", {
|
|
249
252
|
className: `${TableSharedCssClassName.TABLE_CONTAINER} ${this.props.shadowClassNames || ''}`,
|
|
250
253
|
"data-layout": layout,
|
|
@@ -266,7 +269,8 @@ export class TableContainer extends React.Component {
|
|
|
266
269
|
wrapperWidth: wrapperWidth,
|
|
267
270
|
columnWidths: columnWidths,
|
|
268
271
|
rowHeight: this.headerRowHeight,
|
|
269
|
-
tableNode: tableNode
|
|
272
|
+
tableNode: tableNode,
|
|
273
|
+
rendererAppearance: rendererAppearance
|
|
270
274
|
}, [children && children[0]]), /*#__PURE__*/React.createElement("div", {
|
|
271
275
|
className: TableSharedCssClassName.TABLE_NODE_WRAPPER,
|
|
272
276
|
ref: this.wrapperRef,
|
|
@@ -277,7 +281,8 @@ export class TableContainer extends React.Component {
|
|
|
277
281
|
layout: layout,
|
|
278
282
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
279
283
|
renderWidth: renderWidth,
|
|
280
|
-
tableNode: tableNode
|
|
284
|
+
tableNode: tableNode,
|
|
285
|
+
rendererAppearance: rendererAppearance
|
|
281
286
|
}, this.grabFirstRowRef(children)))));
|
|
282
287
|
}
|
|
283
288
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export const isFullWidthAppearance = appearance => appearance === 'full-width';
|
|
2
|
+
export const isFullPageAppearance = appearance => appearance === 'full-page';
|
|
3
|
+
export const isFullWidthOrFullPageAppearance = appearance => isFullPageAppearance(appearance) || isFullWidthAppearance(appearance);
|
|
@@ -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 = "108.7.
|
|
38
|
+
const packageVersion = "108.7.3";
|
|
39
39
|
export class Renderer extends PureComponent {
|
|
40
40
|
constructor(props) {
|
|
41
41
|
super(props);
|