@atlaskit/renderer 118.0.0 → 118.1.1

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/react/nodes/mediaGroup.js +6 -3
  3. package/dist/cjs/react/nodes/table/sticky.js +2 -1
  4. package/dist/cjs/react/nodes/table/table.js +7 -2
  5. package/dist/cjs/react/nodes/table.js +46 -16
  6. package/dist/cjs/react/nodes/tableNew.js +116 -88
  7. package/dist/cjs/ui/Renderer/index.js +3 -9
  8. package/dist/cjs/ui/annotations/element/mark.js +16 -23
  9. package/dist/cjs/ui/annotations/hooks/use-events.js +1 -1
  10. package/dist/es2019/react/nodes/mediaGroup.js +6 -3
  11. package/dist/es2019/react/nodes/table/sticky.js +2 -1
  12. package/dist/es2019/react/nodes/table/table.js +6 -2
  13. package/dist/es2019/react/nodes/table.js +45 -17
  14. package/dist/es2019/react/nodes/tableNew.js +112 -94
  15. package/dist/es2019/ui/Renderer/index.js +3 -9
  16. package/dist/es2019/ui/annotations/element/mark.js +16 -25
  17. package/dist/es2019/ui/annotations/hooks/use-events.js +1 -1
  18. package/dist/esm/react/nodes/mediaGroup.js +6 -3
  19. package/dist/esm/react/nodes/table/sticky.js +2 -1
  20. package/dist/esm/react/nodes/table/table.js +7 -2
  21. package/dist/esm/react/nodes/table.js +46 -16
  22. package/dist/esm/react/nodes/tableNew.js +118 -90
  23. package/dist/esm/ui/Renderer/index.js +3 -9
  24. package/dist/esm/ui/annotations/element/mark.js +16 -23
  25. package/dist/esm/ui/annotations/hooks/use-events.js +1 -1
  26. package/dist/types/react/nodes/table/table.d.ts +2 -1
  27. package/dist/types/react/nodes/table.d.ts +1 -1
  28. package/dist/types/react/nodes/tableNew.d.ts +33 -0
  29. package/dist/types/ui/Renderer/PortalContext.d.ts +1 -1
  30. package/dist/types/ui/annotations/element/mark.d.ts +0 -6
  31. package/dist/types-ts4.5/react/nodes/table/table.d.ts +2 -1
  32. package/dist/types-ts4.5/react/nodes/table.d.ts +1 -1
  33. package/dist/types-ts4.5/react/nodes/tableNew.d.ts +33 -0
  34. package/dist/types-ts4.5/ui/Renderer/PortalContext.d.ts +1 -1
  35. package/dist/types-ts4.5/ui/annotations/element/mark.d.ts +0 -6
  36. package/package.json +11 -11
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 118.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#156190](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/156190)
8
+ [`f62c2d1edf517`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f62c2d1edf517) -
9
+ CCP-6498 Cleanup FG cc_perf_reduce_rerenders
10
+ - [#157481](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/157481)
11
+ [`c8bf1b901208a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c8bf1b901208a) -
12
+ EDITOR-677 - Renderer - Selecting another annotation with unsaved draft/reply results in multiple
13
+ discard prompts
14
+
15
+ ## 118.1.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [#154702](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/154702)
20
+ [`a44461b56d840`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a44461b56d840) -
21
+ Prop type update for clarity and maintainability
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies
26
+
3
27
  ## 118.0.0
4
28
 
5
29
  ### Major Changes
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
12
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
@@ -15,6 +16,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
15
16
  var _react = _interopRequireWildcard(require("react"));
16
17
  var _mediaCard = require("@atlaskit/media-card");
17
18
  var _mediaFilmstrip = require("@atlaskit/media-filmstrip");
19
+ var _vcMedia = require("@atlaskit/react-ufo/vc-media");
20
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
21
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
19
22
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
20
23
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -72,6 +75,7 @@ var MediaGroup = exports.default = /*#__PURE__*/function (_PureComponent) {
72
75
  value: function render() {
73
76
  var numChildren = _react.default.Children.count(this.props.children);
74
77
  var content;
78
+ var mediaGroupProps = (0, _platformFeatureFlags.fg)('platform_editor_fix_vc90_bug_with_files') ? _vcMedia.VcMediaWrapperProps : {};
75
79
  if (numChildren === 1) {
76
80
  // Ignored via go/ees005
77
81
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -89,10 +93,9 @@ var MediaGroup = exports.default = /*#__PURE__*/function (_PureComponent) {
89
93
  } else {
90
94
  content = this.renderStrip();
91
95
  }
92
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
93
- return /*#__PURE__*/_react.default.createElement("div", {
96
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
94
97
  className: "MediaGroup"
95
- }, content);
98
+ }, mediaGroupProps), content));
96
99
  }
97
100
  }, {
98
101
  key: "renderSingleFile",
@@ -156,7 +156,8 @@ var StickyTable = exports.StickyTable = function StickyTable(_ref) {
156
156
  isNumberColumnEnabled: isNumberColumnEnabled,
157
157
  renderWidth: renderWidth,
158
158
  tableNode: tableNode,
159
- rendererAppearance: rendererAppearance
159
+ rendererAppearance: rendererAppearance,
160
+ fixTableSSRResizing: fixTableSSRResizing
160
161
  },
161
162
  /**
162
163
  * @see https://product-fabric.atlassian.net/browse/ED-10235
@@ -25,7 +25,9 @@ var Table = exports.Table = /*#__PURE__*/_react.default.memo(function (_ref) {
25
25
  isInsideOfTable = _ref.isInsideOfTable,
26
26
  isinsideMultiBodiedExtension = _ref.isinsideMultiBodiedExtension,
27
27
  allowTableResizing = _ref.allowTableResizing,
28
- isPresentational = _ref.isPresentational;
28
+ isPresentational = _ref.isPresentational,
29
+ _ref$fixTableSSRResiz = _ref.fixTableSSRResizing,
30
+ fixTableSSRResizing = _ref$fixTableSSRResiz === void 0 ? false : _ref$fixTableSSRResiz;
29
31
  var tableWidth = tableNode ? (0, _nodeWidth.getTableContainerWidth)(tableNode) : _editorSharedStyles.akEditorDefaultLayoutWidth;
30
32
  if (rendererAppearance === 'comment' && allowTableResizing && tableNode && !((_tableNode$attrs = tableNode.attrs) !== null && _tableNode$attrs !== void 0 && _tableNode$attrs.width)) {
31
33
  tableWidth = 'inherit';
@@ -48,7 +50,10 @@ var Table = exports.Table = /*#__PURE__*/_react.default.memo(function (_ref) {
48
50
  "data-table-width": tableWidth,
49
51
  "data-layout": tableLayout,
50
52
  "data-table-display-mode": tableDisplayMode,
51
- ref: innerRef
53
+ ref: innerRef,
54
+ style: {
55
+ marginTop: fixTableSSRResizing ? '0px' : ''
56
+ }
52
57
  }), /*#__PURE__*/_react.default.createElement(_colgroup.Colgroup, {
53
58
  columnWidths: columnWidths,
54
59
  layout: layout,
@@ -29,6 +29,7 @@ var _sticky = require("./table/sticky");
29
29
  var _table = require("./table/table");
30
30
  var _appearance = require("../utils/appearance");
31
31
  var _TableStickyScrollbar = require("./TableStickyScrollbar");
32
+ var _tableNew = require("./tableNew");
32
33
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
33
34
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
34
35
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
@@ -126,7 +127,7 @@ var tableCanBeSticky = exports.tableCanBeSticky = function tableCanBeSticky(node
126
127
  return isHeaderRowEnabled(children) && node && node.firstChild && !hasRowspan(node.firstChild);
127
128
  };
128
129
  /**
129
- * Class for Tables in Renderer
130
+ *
130
131
  */
131
132
  // Ignored via go/ees005
132
133
  // eslint-disable-next-line @repo/internal/react/no-class-components
@@ -413,7 +414,9 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
413
414
  var isCommentAppearanceAndTableAlignmentEnabled = (0, _appearance.isCommentAppearance)(rendererAppearance) && allowTableAlignment;
414
415
  var lineLength = (0, _appearance.isFullWidthAppearance)(rendererAppearance) ? fullWidthLineLength : isCommentAppearanceAndTableAlignmentEnabled ? commentLineLength : lineLengthFixedWidth;
415
416
  var lineLengthCSS = (0, _appearance.isFullWidthAppearance)(rendererAppearance) ? fullWidthLineLengthCSS : isCommentAppearanceAndTableAlignmentEnabled ? renderWidthCSS : "".concat(lineLengthFixedWidth, "px");
416
- var fixTableSSRResizing = (0, _platformFeatureFlags.fg)('platform-ssr-table-resize');
417
+
418
+ // Setting fixTableSSRResizing to false while FG logic is true in tableNew
419
+ var fixTableSSRResizing = false;
417
420
  var tableWidthNew = fixTableSSRResizing ? (0, _nodeWidth.getTableContainerWidth)(tableNode) : tableWidth;
418
421
  var shouldCalculateLeftForAlignment = !isInsideOfBlockNode && !isInsideOfTable && isTableAlignStart && ((0, _appearance.isFullPageAppearance)(rendererAppearance) && tableWidthNew <= lineLengthFixedWidth || (0, _appearance.isFullWidthAppearance)(rendererAppearance) || isCommentAppearanceAndTableAlignmentEnabled);
419
422
  var leftCSS;
@@ -511,8 +514,7 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
511
514
  rowHeight: this.state.headerRowHeight,
512
515
  tableNode: tableNode,
513
516
  rendererAppearance: rendererAppearance,
514
- allowTableResizing: allowTableResizing,
515
- fixTableSSRResizing: fixTableSSRResizing
517
+ allowTableResizing: allowTableResizing
516
518
  }, [children && children[0]]), /*#__PURE__*/_react.default.createElement("div", {
517
519
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
518
520
  className: _styles.TableSharedCssClassName.TABLE_NODE_WRAPPER,
@@ -634,6 +636,17 @@ var TableProcessor = exports.TableProcessor = /*#__PURE__*/function (_React$Comp
634
636
  }
635
637
  }]);
636
638
  }(_react.default.Component); // eslint-disable-next-line @typescript-eslint/no-explicit-any
639
+ var TableWithShadowsAndContainerStyles = (0, _ui.overflowShadow)(_tableNew.TableProcessorWithContainerStyles, {
640
+ /**
641
+ * The :scope is in reference to table container and we are selecting only
642
+ * direct children that match the table node wrapper selector, not their
643
+ * descendants.
644
+ */
645
+ overflowSelector: ":scope > .".concat(_styles.TableSharedCssClassName.TABLE_NODE_WRAPPER),
646
+ useShadowObserver: true
647
+ });
648
+
649
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
637
650
  var TableWithShadows = (0, _ui.overflowShadow)(TableProcessor, {
638
651
  /**
639
652
  * The :scope is in reference to table container and we are selecting only
@@ -644,26 +657,43 @@ var TableWithShadows = (0, _ui.overflowShadow)(TableProcessor, {
644
657
  useShadowObserver: true
645
658
  });
646
659
  var TableWithWidth = function TableWithWidth(props) {
647
- return /*#__PURE__*/_react.default.createElement(_ui.WidthConsumer, null, function (_ref2) {
660
+ // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
661
+ if ((0, _platformFeatureFlags.fg)('platform-ssr-table-resize')) {
648
662
  var _props$columnWidths;
649
- var width = _ref2.width;
650
- var renderWidth = props.rendererAppearance === 'full-page' ? width - _style.FullPagePadding * 2 : width;
651
663
  var colWidthsSum = ((_props$columnWidths = props.columnWidths) === null || _props$columnWidths === void 0 ? void 0 : _props$columnWidths.reduce(function (total, val) {
652
664
  return total + val;
653
665
  }, 0)) || 0;
654
666
  if (colWidthsSum || props.allowTableResizing) {
655
667
  // Ignored via go/ees005
656
668
  // eslint-disable-next-line react/jsx-props-no-spreading
657
- return /*#__PURE__*/_react.default.createElement(TableWithShadows, (0, _extends2.default)({
669
+ return /*#__PURE__*/_react.default.createElement(TableWithShadowsAndContainerStyles, props);
670
+ }
671
+ return /*#__PURE__*/_react.default.createElement(_tableNew.TableProcessorWithContainerStyles
672
+ // Ignored via go/ees005
673
+ // eslint-disable-next-line react/jsx-props-no-spreading
674
+ , props);
675
+ } else {
676
+ return /*#__PURE__*/_react.default.createElement(_ui.WidthConsumer, null, function (_ref2) {
677
+ var _props$columnWidths2;
678
+ var width = _ref2.width;
679
+ var renderWidth = props.rendererAppearance === 'full-page' ? width - _style.FullPagePadding * 2 : width;
680
+ var colWidthsSum = ((_props$columnWidths2 = props.columnWidths) === null || _props$columnWidths2 === void 0 ? void 0 : _props$columnWidths2.reduce(function (total, val) {
681
+ return total + val;
682
+ }, 0)) || 0;
683
+ if (colWidthsSum || props.allowTableResizing) {
684
+ // Ignored via go/ees005
685
+ // eslint-disable-next-line react/jsx-props-no-spreading
686
+ return /*#__PURE__*/_react.default.createElement(TableWithShadows, (0, _extends2.default)({
687
+ renderWidth: renderWidth
688
+ }, props));
689
+ }
690
+ // 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
691
+ return /*#__PURE__*/_react.default.createElement(TableProcessor, (0, _extends2.default)({
658
692
  renderWidth: renderWidth
693
+ // Ignored via go/ees005
694
+ // eslint-disable-next-line react/jsx-props-no-spreading
659
695
  }, props));
660
- }
661
- // 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
662
- return /*#__PURE__*/_react.default.createElement(TableProcessor, (0, _extends2.default)({
663
- renderWidth: renderWidth
664
- // Ignored via go/ees005
665
- // eslint-disable-next-line react/jsx-props-no-spreading
666
- }, props));
667
- });
696
+ });
697
+ }
668
698
  };
669
699
  var _default = exports.default = (0, _SmartCardStorage.withSmartCardStorage)(TableWithWidth);
@@ -13,6 +13,8 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
14
  var _react = _interopRequireDefault(require("react"));
15
15
  var _styles = require("@atlaskit/editor-common/styles");
16
+ var _nodeWidth = require("@atlaskit/editor-common/node-width");
17
+ var _style = require("../../ui/Renderer/style");
16
18
  var _utils = require("@atlaskit/editor-common/utils");
17
19
  var _types = require("@atlaskit/editor-common/types");
18
20
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
@@ -20,7 +22,6 @@ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
20
22
  var _tableCell = require("./tableCell");
21
23
  var _sticky = require("./table/sticky");
22
24
  var _table = require("./table/table");
23
- var _tableMap = require("@atlaskit/editor-tables/table-map");
24
25
  var _appearance = require("../utils/appearance");
25
26
  var _TableStickyScrollbar = require("./TableStickyScrollbar");
26
27
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
@@ -28,20 +29,6 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
28
29
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
29
30
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
30
31
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/enforce-style-prop */
31
- var getResizerMinWidth = function getResizerMinWidth(node) {
32
- var currentColumnCount = getColgroupChildrenLength(node);
33
- var minColumnWidth = Math.min(3, currentColumnCount) * COLUMN_MIN_WIDTH;
34
- // add an extra pixel as the scale table logic will scale columns to be tableContainerWidth - 1
35
- // the table can't scale past its min-width, so instead restrict table container min width to avoid that situation
36
- return minColumnWidth + 1;
37
- };
38
- var getColgroupChildrenLength = function getColgroupChildrenLength(table) {
39
- var map = _tableMap.TableMap.get(table);
40
- return map.width;
41
- };
42
- var gutterPadding = (0, _editorSharedStyles.akEditorGutterPaddingDynamic)() * 2;
43
- var TABLE_MAX_WIDTH = 1800;
44
- var COLUMN_MIN_WIDTH = 48;
45
32
  var isTableResizingEnabled = exports.isTableResizingEnabled = function isTableResizingEnabled(appearance) {
46
33
  return (0, _appearance.isFullWidthOrFullPageAppearance)(appearance) || (0, _appearance.isCommentAppearance)(appearance) && (0, _experiments.editorExperiment)('support_table_in_comment', true, {
47
34
  exposure: true
@@ -133,6 +120,9 @@ var isHeaderRowEnabled = exports.isHeaderRowEnabled = function isHeaderRowEnable
133
120
  var tableCanBeSticky = exports.tableCanBeSticky = function tableCanBeSticky(node, children) {
134
121
  return isHeaderRowEnabled(children) && node && node.firstChild && !hasRowspan(node.firstChild);
135
122
  };
123
+ /**
124
+ * TableContainer renders tables using only CSS-based rules
125
+ */
136
126
  // Ignored via go/ees005
137
127
  // eslint-disable-next-line @repo/internal/react/no-class-components
138
128
  var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Component) {
@@ -259,7 +249,12 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
259
249
  (0, _inherits2.default)(TableContainer, _React$Component);
260
250
  return (0, _createClass2.default)(TableContainer, [{
261
251
  key: "componentDidMount",
262
- value: function componentDidMount() {
252
+ value:
253
+ /**
254
+ *
255
+ * @example
256
+ */
257
+ function componentDidMount() {
263
258
  this.resizeObserver = new ResizeObserver(this.applyResizerChange);
264
259
  if (this.wrapperRef.current) {
265
260
  this.resizeObserver.observe(this.wrapperRef.current);
@@ -278,6 +273,13 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
278
273
  this.stickyScrollbar = new _TableStickyScrollbar.TableStickyScrollbar(this.wrapperRef.current);
279
274
  }
280
275
  }
276
+
277
+ /**
278
+ *
279
+ * @param prevProps
280
+ * @param prevState
281
+ * @example
282
+ */
281
283
  }, {
282
284
  key: "componentDidUpdate",
283
285
  value: function componentDidUpdate(prevProps, prevState) {
@@ -304,12 +306,20 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
304
306
  }
305
307
  }, {
306
308
  key: "pinTop",
307
- get: function get() {
309
+ get:
310
+ /**
311
+ *
312
+ */
313
+ function get() {
308
314
  if (!this.tableRef.current || !this.stickyHeaderRef.current) {
309
315
  return;
310
316
  }
311
317
  return this.tableRef.current.offsetHeight - this.stickyHeaderRef.current.offsetHeight + _styles.tableMarginTop - _sticky.tableStickyPadding;
312
318
  }
319
+
320
+ /**
321
+ *
322
+ */
313
323
  }, {
314
324
  key: "shouldAddOverflowParentOffsetTop_DO_NOT_USE",
315
325
  get: function get() {
@@ -319,6 +329,10 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
319
329
  // THEN we should add the OverflowParent offset top (RETURN TRUE)
320
330
  return this.props.stickyHeaders && !!this.props.stickyHeaders.shouldAddDefaultScrollRootOffsetTop_DO_NOT_USE && !!this.props.stickyHeaders.defaultScrollRootId_DO_NOT_USE && this.overflowParent && this.overflowParent.id === this.props.stickyHeaders.defaultScrollRootId_DO_NOT_USE;
321
331
  }
332
+
333
+ /**
334
+ *
335
+ */
322
336
  }, {
323
337
  key: "stickyTop",
324
338
  get: function get() {
@@ -337,6 +351,11 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
337
351
  return undefined;
338
352
  }
339
353
  }
354
+
355
+ /**
356
+ *
357
+ * @example
358
+ */
340
359
  }, {
341
360
  key: "render",
342
361
  value: function render() {
@@ -351,92 +370,92 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
351
370
  isInsideOfBlockNode = _this$props.isInsideOfBlockNode,
352
371
  isInsideOfTable = _this$props.isInsideOfTable,
353
372
  isinsideMultiBodiedExtension = _this$props.isinsideMultiBodiedExtension,
373
+ allowTableAlignment = _this$props.allowTableAlignment,
354
374
  allowTableResizing = _this$props.allowTableResizing,
355
375
  isPresentational = _this$props.isPresentational;
356
376
  var stickyMode = this.state.stickyMode;
357
- var getTableWidthAttribute = function getTableWidthAttribute() {
358
- // this scenario occurs when there is a full width table within the full width renderer,
359
- // in which case the parent container is already the correct size
360
- if (rendererAppearance === 'full-width' && (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width) === TABLE_MAX_WIDTH) {
361
- return "100%";
377
+ var lineLengthFixedWidth = _editorSharedStyles.akEditorDefaultLayoutWidth;
378
+ var updatedLayout;
379
+ var renderWidthCSS = rendererAppearance === 'full-page' ? "100cqw - ".concat(_style.FullPagePadding, "px * 2") : "100cqw";
380
+ var calcDefaultLayoutWidthByAppearance = function calcDefaultLayoutWidthByAppearance(rendererAppearance, tableNode) {
381
+ if (rendererAppearance === 'full-width' && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width)) {
382
+ return "min(".concat(_editorSharedStyles.akEditorFullWidthLayoutWidth, "px, ").concat(renderWidthCSS, ")");
383
+ } else if (rendererAppearance === 'comment' && allowTableResizing && !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width)) {
384
+ return renderWidthCSS;
385
+ } else {
386
+ // custom width, or width mapped to breakpoint
387
+ var tableContainerWidth = (0, _nodeWidth.getTableContainerWidth)(tableNode);
388
+ return "min(".concat(tableContainerWidth, "px, ").concat(renderWidthCSS, ")");
362
389
  }
363
- // this scenario occurs when there is a full width table nested within a component (expand, column layout). In these cases
364
- // the table should inherit the width of its parent component
365
- if (rendererAppearance === 'full-page' && (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width) === TABLE_MAX_WIDTH && layout === 'align-start') {
366
- return "100%";
367
- }
368
- return "".concat(tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width, "px");
369
390
  };
370
- var tableWidthAttribute = getTableWidthAttribute();
371
- var children = _react.default.Children.toArray(this.props.children);
372
- var tableMinWidth;
373
- if (tableNode) {
374
- tableMinWidth = getResizerMinWidth(tableNode);
391
+ var tableWidthCSS = calcDefaultLayoutWidthByAppearance(rendererAppearance, tableNode);
392
+
393
+ // Logic for table alignment in renderer
394
+ var isTableAlignStart = tableNode && tableNode.attrs && tableNode.attrs.layout === 'align-start' && allowTableAlignment;
395
+ var fullWidthLineLengthCSS = "min(".concat(_editorSharedStyles.akEditorFullWidthLayoutWidth, "px, ").concat(renderWidthCSS, ")");
396
+ var isCommentAppearanceAndTableAlignmentEnabled = (0, _appearance.isCommentAppearance)(rendererAppearance) && allowTableAlignment;
397
+ var lineLengthCSS = (0, _appearance.isFullWidthAppearance)(rendererAppearance) ? fullWidthLineLengthCSS : isCommentAppearanceAndTableAlignmentEnabled ? renderWidthCSS : "".concat(lineLengthFixedWidth, "px");
398
+ var tableWidthNew = (0, _nodeWidth.getTableContainerWidth)(tableNode);
399
+ var shouldCalculateLeftForAlignment = !isInsideOfBlockNode && !isInsideOfTable && isTableAlignStart && ((0, _appearance.isFullPageAppearance)(rendererAppearance) && tableWidthNew <= lineLengthFixedWidth || (0, _appearance.isFullWidthAppearance)(rendererAppearance) || isCommentAppearanceAndTableAlignmentEnabled);
400
+ var leftCSS;
401
+ if (shouldCalculateLeftForAlignment) {
402
+ leftCSS = "(".concat(tableWidthCSS, " - ").concat(lineLengthCSS, ") / 2");
403
+ }
404
+ if (!shouldCalculateLeftForAlignment && (0, _appearance.isFullPageAppearance)(rendererAppearance)) {
405
+ // Note tableWidthCSS here is the renderer width
406
+ // When the screen is super wide we want table to break out.
407
+ // However if screen is smaller than 760px. We want table align to left.
408
+ leftCSS = "min(0px, ".concat(lineLengthCSS, " - ").concat(tableWidthCSS, ") / 2");
375
409
  }
410
+ var children = _react.default.Children.toArray(this.props.children);
376
411
 
377
412
  // Historically, tables in the full-width renderer had their layout set to 'default' which is deceiving.
378
413
  // This check caters for those tables and helps with SSR logic
379
- var isFullWidth = rendererAppearance === 'full-width' && layout !== 'full-width';
414
+ var isFullWidth = !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) && rendererAppearance === 'full-width' && layout !== 'full-width';
380
415
  if (isFullWidth) {
381
- this.updatedLayout = 'full-width';
416
+ updatedLayout = 'full-width';
382
417
  // if table has width explicity set, ensure SSR is handled
383
418
  } else if (tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) {
384
- this.updatedLayout = 'custom';
419
+ updatedLayout = 'custom';
385
420
  } else {
386
- this.updatedLayout = layout;
421
+ updatedLayout = layout;
387
422
  }
423
+ var finalTableContainerWidth = allowTableResizing ? tableWidthNew : 'inherit';
388
424
 
389
- // defined in colgroup.tsx:
390
- // appearance == comment && allowTableResizing && means it is a comment
391
- // appearance == comment && !allowTableResizing && means it is a inline comment
392
- // for inline comments, the table should inherit the width of the parent component rather than maintain its own size
393
- var isInsideInlineComment = rendererAppearance === 'comment' && !allowTableResizing;
394
-
395
- // These styling removes extra padding for `comment` rendererAppearance.
396
- // This is especially relevant for Jira which only uses `comment` appearance and does not need padding.
397
- var resizerContainerPadding = rendererAppearance === 'comment' ? 0 : gutterPadding;
398
- var resizerItemMaxWidth = rendererAppearance === 'comment' ? isInsideInlineComment ? 'inherit' : "min(100cqw, var(--ak-editor-table-max-width))" : "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), var(--ak-editor-table-max-width))";
399
- var resizerItemWidth = rendererAppearance === 'comment' ? isInsideInlineComment ? 'inherit' : "min(100cqw, ".concat(tableWidthAttribute, ")") : "min(calc(100cqw - var(--ak-editor-table-gutter-padding)), ".concat(tableWidthAttribute, ")");
425
+ // We can only use CSS to determine the width when we have a known width in container.
426
+ // When appearance is full-page, full-width or comment we use CSS based width calculation.
427
+ // Otherwise it's fixed table width (customized width) or inherit.
428
+ if (rendererAppearance === 'full-page' || rendererAppearance === 'full-width') {
429
+ finalTableContainerWidth = allowTableResizing ? "calc(".concat(tableWidthCSS, ")") : 'inherit';
430
+ }
431
+ if (rendererAppearance === 'comment' && allowTableResizing && !allowTableAlignment) {
432
+ // If table alignment is disabled and table width is akEditorDefaultLayoutWidth = 760,
433
+ // it is most likely a table created before "Support Table in Comments" FF was enabled
434
+ // and we would see a bug ED-24795. A table created before "Support Table in Comments",
435
+ // should inhirit the width of the renderer container.
400
436
 
401
- // full width tables can have either left-aligned or centered layout despite looking centered in the renderer.
402
- // in these cases, keep the alignment unset
403
- var getTableAlignment = function getTableAlignment() {
404
- return isFullWidth && (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width) === TABLE_MAX_WIDTH ? '' : tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout;
437
+ // !NOTE: it a table resized to 760 is copied from 'full-page' editor and pasted in comment editor
438
+ // where (allowTableResizing && !allowTableAlignment), the table will loose 760px width.
439
+ finalTableContainerWidth = tableNode !== null && tableNode !== void 0 && tableNode.attrs.width && (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width) !== _editorSharedStyles.akEditorDefaultLayoutWidth ? "calc(".concat(tableWidthCSS, ")") : 'inherit';
440
+ }
441
+ if (rendererAppearance === 'comment' && allowTableResizing && allowTableAlignment) {
442
+ // If table alignment is enabled and layout is not 'align-start' or 'center', we are loading a table that was
443
+ // created before "Support Table in Comments" FF was enabled. So the table should have the same width as renderer container
444
+ // instead of 760 that was set on tableNode when the table had been published.
445
+ finalTableContainerWidth = ((tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'align-start' || (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'center') && tableNode !== null && tableNode !== void 0 && tableNode.attrs.width ? "calc(".concat(tableWidthCSS, ")") : 'inherit';
446
+ }
447
+ var style = {
448
+ width: finalTableContainerWidth,
449
+ left: leftCSS ? "calc(".concat(leftCSS, ")") : undefined,
450
+ marginLeft: shouldCalculateLeftForAlignment && leftCSS !== undefined ? "calc(-1 * (".concat(leftCSS, "))") : undefined
405
451
  };
406
- return /*#__PURE__*/_react.default.createElement("div", {
407
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
408
- className: "table-alignment-container"
409
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
410
- ,
411
- style: {
412
- display: 'flex',
413
- justifyContent: getTableAlignment()
414
- }
415
- }, /*#__PURE__*/_react.default.createElement("div", {
416
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
417
- className: "pm-table-resizer-container"
418
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
419
- ,
420
- style: {
421
- width: isInsideInlineComment ? '100%' : "min(calc(100cqw - ".concat(resizerContainerPadding, "px), ").concat(tableWidthAttribute, ")")
422
- }
423
- }, /*#__PURE__*/_react.default.createElement("div", {
424
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
425
- className: "resizer-item display-handle",
426
- style: (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({
427
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
428
- position: 'relative',
429
- userSelect: 'auto',
430
- boxSizing: 'border-box'
431
- }, '--ak-editor-table-gutter-padding', "".concat(gutterPadding, "px")), '--ak-editor-table-max-width', "".concat(TABLE_MAX_WIDTH, "px")), '--ak-editor-table-min-width', "".concat(tableMinWidth, "px")), "minWidth", 'var(--ak-editor-table-min-width)'), "maxWidth", resizerItemMaxWidth), "width", resizerItemWidth)
432
- }, /*#__PURE__*/_react.default.createElement("span", {
433
- className: "resizer-hover-zone"
434
- }, /*#__PURE__*/_react.default.createElement("div", {
452
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
435
453
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
436
454
  className: "".concat(_styles.TableSharedCssClassName.TABLE_CONTAINER, " ").concat(this.props.shadowClassNames || ''),
437
- "data-layout": this.updatedLayout,
455
+ "data-layout": updatedLayout,
438
456
  "data-testid": "table-container",
439
- ref: this.props.handleRef
457
+ ref: this.props.handleRef,
458
+ style: style
440
459
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
441
460
  }, isStickyScrollbarEnabled(this.props.rendererAppearance) && /*#__PURE__*/_react.default.createElement("div", {
442
461
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -444,8 +463,8 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
444
463
  "data-testid": "sticky-scrollbar-sentinel-top"
445
464
  }), stickyHeaders && tableNode && tableCanBeSticky(tableNode, children) && /*#__PURE__*/_react.default.createElement(_sticky.StickyTable, {
446
465
  isNumberColumnEnabled: isNumberColumnEnabled,
447
- renderWidth: 0,
448
466
  tableWidth: "inherit",
467
+ renderWidth: 0,
449
468
  layout: layout,
450
469
  handleRef: this.props.handleRef,
451
470
  shadowClassNames: this.props.shadowClassNames,
@@ -457,7 +476,8 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
457
476
  rowHeight: this.state.headerRowHeight,
458
477
  tableNode: tableNode,
459
478
  rendererAppearance: rendererAppearance,
460
- allowTableResizing: allowTableResizing
479
+ allowTableResizing: allowTableResizing,
480
+ fixTableSSRResizing: true
461
481
  }, [children && children[0]]), /*#__PURE__*/_react.default.createElement("div", {
462
482
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
463
483
  className: _styles.TableSharedCssClassName.TABLE_NODE_WRAPPER,
@@ -473,8 +493,8 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
473
493
  innerRef: this.tableRef,
474
494
  columnWidths: columnWidths,
475
495
  layout: layout,
476
- isNumberColumnEnabled: isNumberColumnEnabled,
477
496
  renderWidth: 0,
497
+ isNumberColumnEnabled: isNumberColumnEnabled,
478
498
  tableNode: tableNode,
479
499
  rendererAppearance: rendererAppearance,
480
500
  isInsideOfBlockNode: isInsideOfBlockNode,
@@ -508,10 +528,13 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
508
528
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
509
529
  className: _styles.TableSharedCssClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_BOTTOM,
510
530
  "data-testid": "sticky-scrollbar-sentinel-bottom"
511
- }))))));
531
+ })));
512
532
  }
513
533
  }]);
514
534
  }(_react.default.Component);
535
+ /**
536
+ *
537
+ */
515
538
  // Ignored via go/ees005
516
539
  // eslint-disable-next-line @repo/internal/react/no-class-components
517
540
  var TableProcessorWithContainerStyles = exports.TableProcessorWithContainerStyles = /*#__PURE__*/function (_React$Component2) {
@@ -562,7 +585,12 @@ var TableProcessorWithContainerStyles = exports.TableProcessorWithContainerStyle
562
585
  (0, _inherits2.default)(TableProcessorWithContainerStyles, _React$Component2);
563
586
  return (0, _createClass2.default)(TableProcessorWithContainerStyles, [{
564
587
  key: "render",
565
- value: function render() {
588
+ value:
589
+ /**
590
+ *
591
+ * @example
592
+ */
593
+ function render() {
566
594
  var children = this.props.children;
567
595
  if (!children) {
568
596
  return null;
@@ -63,7 +63,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
63
63
  var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
64
64
  var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
65
65
  var packageName = "@atlaskit/renderer";
66
- var packageVersion = "118.0.0";
66
+ var packageVersion = "118.1.1";
67
67
  var setAsQueryContainerStyles = (0, _react2.css)({
68
68
  containerName: 'ak-renderer-wrapper',
69
69
  containerType: 'inline-size'
@@ -472,15 +472,9 @@ var getRendererComponent = function getRendererComponent(nodeComponents) {
472
472
  // and use context instead because at this time we cannot guarantee that existing
473
473
  // consumers of Atlaskit Renderer will update to use the new portal context.
474
474
  if (!Boolean(nodeComponents) && (0, _platformFeatureFlags.fg)('cc_complexit_reduce_portal_rerenders')) {
475
- if ((0, _platformFeatureFlags.fg)('cc_perf_reduce_rerenders')) {
476
- return RendererFunctionalComponentWithPortalContextMemoized;
477
- }
478
- return RendererFunctionalComponentWithPortalContext;
479
- }
480
- if ((0, _platformFeatureFlags.fg)('cc_perf_reduce_rerenders')) {
481
- return RendererFunctionalComponentMemoized;
475
+ return RendererFunctionalComponentWithPortalContextMemoized;
482
476
  }
483
- return RendererFunctionalComponent;
477
+ return RendererFunctionalComponentMemoized;
484
478
  };
485
479
 
486
480
  /**