@atlaskit/editor-plugin-table 23.3.12 → 23.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/nodeviews/TableCell.js +2 -5
  3. package/dist/cjs/nodeviews/TableComponent.js +18 -1
  4. package/dist/cjs/nodeviews/TableRow.js +4 -0
  5. package/dist/cjs/nodeviews/TableRowNativeStickyWithFallback.js +3 -0
  6. package/dist/cjs/nodeviews/toDOM.js +13 -1
  7. package/dist/cjs/pm-plugins/commands/selection.js +1 -2
  8. package/dist/cjs/pm-plugins/table-resizing/utils/dom.js +31 -1
  9. package/dist/cjs/tablePlugin.js +1 -1
  10. package/dist/cjs/types/index.js +1 -0
  11. package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +10 -2
  12. package/dist/cjs/ui/common-styles.js +8 -22
  13. package/dist/cjs/ui/rounded-table-styles.js +43 -0
  14. package/dist/es2019/nodeviews/TableCell.js +2 -5
  15. package/dist/es2019/nodeviews/TableComponent.js +19 -2
  16. package/dist/es2019/nodeviews/TableRow.js +5 -1
  17. package/dist/es2019/nodeviews/TableRowNativeStickyWithFallback.js +4 -1
  18. package/dist/es2019/nodeviews/toDOM.js +13 -1
  19. package/dist/es2019/pm-plugins/commands/selection.js +1 -2
  20. package/dist/es2019/pm-plugins/table-resizing/utils/dom.js +30 -0
  21. package/dist/es2019/tablePlugin.js +1 -1
  22. package/dist/es2019/types/index.js +1 -0
  23. package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +10 -2
  24. package/dist/es2019/ui/common-styles.js +21 -458
  25. package/dist/es2019/ui/rounded-table-styles.js +581 -0
  26. package/dist/esm/nodeviews/TableCell.js +2 -5
  27. package/dist/esm/nodeviews/TableComponent.js +19 -2
  28. package/dist/esm/nodeviews/TableRow.js +5 -1
  29. package/dist/esm/nodeviews/TableRowNativeStickyWithFallback.js +4 -1
  30. package/dist/esm/nodeviews/toDOM.js +13 -1
  31. package/dist/esm/pm-plugins/commands/selection.js +1 -2
  32. package/dist/esm/pm-plugins/table-resizing/utils/dom.js +30 -0
  33. package/dist/esm/tablePlugin.js +1 -1
  34. package/dist/esm/types/index.js +1 -0
  35. package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +10 -2
  36. package/dist/esm/ui/common-styles.js +8 -22
  37. package/dist/esm/ui/rounded-table-styles.js +37 -0
  38. package/dist/types/pm-plugins/table-resizing/utils/dom.d.ts +1 -0
  39. package/dist/types/types/index.d.ts +1 -0
  40. package/dist/types/ui/rounded-table-styles.d.ts +2 -0
  41. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/dom.d.ts +1 -0
  42. package/dist/types-ts4.5/types/index.d.ts +1 -0
  43. package/dist/types-ts4.5/ui/rounded-table-styles.d.ts +2 -0
  44. package/package.json +5 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 23.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`26cdaa58ad1b5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/26cdaa58ad1b5) -
8
+ Cleaned up stale feature gate platform_editor_table_sticky_header_patch_2. Merged sticky header
9
+ mask styles and removed gate from tablePlugin plugin registration.
10
+
11
+ ### Patch Changes
12
+
13
+ - [`c70fd1e57edcf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c70fd1e57edcf) -
14
+ Cleaned up stale feature flag `platform_editor_lovability_select_all_shortcut`
15
+ - [`edeed2f3314cd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/edeed2f3314cd) -
16
+ Fix rounded table edge interaction overlays
17
+ - Updated dependencies
18
+
3
19
  ## 23.3.12
4
20
 
5
21
  ### Patch Changes
@@ -72,7 +72,7 @@ var TableCell = exports.default = /*#__PURE__*/function (_TableNodeView) {
72
72
  }
73
73
  });
74
74
  if ((0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true)) {
75
- _this.updateTableEdgeAttrs(node);
75
+ _this.updateTableEdgeAttrs();
76
76
  }
77
77
 
78
78
  // CONFCLOUD-78239: Previously we had a bug which tried to invert the heading colour of a table
@@ -123,7 +123,7 @@ var TableCell = exports.default = /*#__PURE__*/function (_TableNodeView) {
123
123
  */
124
124
  }, {
125
125
  key: "updateTableEdgeAttrs",
126
- value: function updateTableEdgeAttrs(node) {
126
+ value: function updateTableEdgeAttrs() {
127
127
  var pos = this.getPos();
128
128
  if (pos === undefined) {
129
129
  return;
@@ -218,9 +218,6 @@ var TableCell = exports.default = /*#__PURE__*/function (_TableNodeView) {
218
218
  removedAttrs.forEach(function (key) {
219
219
  return _this2.dom.removeAttribute(key);
220
220
  });
221
- if ((0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true)) {
222
- this.updateTableEdgeAttrs(node);
223
- }
224
221
  return true;
225
222
  }
226
223
 
@@ -140,6 +140,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
140
140
  header.scrollLeft = _this.wrapper.scrollLeft;
141
141
  header.style.marginRight = '2px';
142
142
  }
143
+ if ((0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true)) {
144
+ (0, _dom.syncStickyRowToTable)(_this.table);
145
+ }
143
146
  }
144
147
 
145
148
  // force update to for table controls to re-align
@@ -978,7 +981,21 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
978
981
  , {
979
982
  className: (0, _classnames2.default)(_types.TableCssClassName.TABLE_NODE_WRAPPER),
980
983
  ref: this.setWrapperRef
981
- }, allowControls && colControls), !this.isNestedInTable ? /*#__PURE__*/_react.default.createElement("div", {
984
+ }, (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
985
+ contentEditable: false,
986
+ "aria-hidden": "true"
987
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
988
+ ,
989
+ className: _types.TableCssClassName.TABLE_CORNER_MASK,
990
+ "data-corner": "left"
991
+ }), /*#__PURE__*/_react.default.createElement("div", {
992
+ contentEditable: false,
993
+ "aria-hidden": "true"
994
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
995
+ ,
996
+ className: _types.TableCssClassName.TABLE_CORNER_MASK,
997
+ "data-corner": "right"
998
+ })), allowControls && colControls), !this.isNestedInTable ? /*#__PURE__*/_react.default.createElement("div", {
982
999
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
983
1000
  className: _types.TableCssClassName.TABLE_STICKY_SCROLLBAR_CONTAINER,
984
1001
  "data-vc-nvs": "true",
@@ -18,6 +18,7 @@ var _nodeVisibility = require("@atlaskit/editor-common/node-visibility");
18
18
  var _ui = require("@atlaskit/editor-common/ui");
19
19
  var _utils = require("@atlaskit/editor-prosemirror/utils");
20
20
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
21
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
21
22
  var _pluginFactory = require("../pm-plugins/plugin-factory");
22
23
  var _pluginKey = require("../pm-plugins/plugin-key");
23
24
  var _commands = require("../pm-plugins/sticky-headers/commands");
@@ -704,6 +705,9 @@ var TableRow = exports.default = /*#__PURE__*/function (_TableNodeView) {
704
705
  return;
705
706
  }
706
707
  this.dom.style.removeProperty('width');
708
+ if ((0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true)) {
709
+ (0, _dom.clearStickyCornerMaskPositions)(table);
710
+ }
707
711
  this.dom.classList.remove('sticky');
708
712
  table.classList.remove(_types.TableCssClassName.TABLE_STICKY);
709
713
  this.isSticky = false;
@@ -952,6 +952,9 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
952
952
  return;
953
953
  }
954
954
  this.dom.style.removeProperty('width');
955
+ if ((0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true)) {
956
+ (0, _dom.clearStickyCornerMaskPositions)(table);
957
+ }
955
958
  this.dom.classList.remove('sticky');
956
959
  table.classList.remove(_types.TableCssClassName.TABLE_STICKY);
957
960
  this.isLegacySticky = false;
@@ -19,6 +19,7 @@ var _colgroup = require("../pm-plugins/table-resizing/utils/colgroup");
19
19
  var _consts = require("../pm-plugins/table-resizing/utils/consts");
20
20
  var _misc = require("../pm-plugins/table-resizing/utils/misc");
21
21
  var _isContentModeSupported = require("../pm-plugins/utils/tableMode/is-content-mode-supported");
22
+ var _types = require("../types");
22
23
  var _tableContainerStyles = require("./table-container-styles");
23
24
  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; }
24
25
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -66,6 +67,17 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
66
67
  if (config.allowColumnResizing) {
67
68
  colgroup = ['colgroup', {}].concat((0, _toConsumableArray2.default)((0, _colgroup.generateColgroupFromNode)(node, config.isCommentEditor, config.isChromelessEditor, config.isNested, config.isTableScalingEnabled, config.shouldUseIncreasedScalingPercent)));
68
69
  }
70
+ var roundedTableCornerMasks = (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? [['div', {
71
+ contenteditable: 'false',
72
+ 'aria-hidden': 'true',
73
+ class: _types.TableCssClassName.TABLE_CORNER_MASK,
74
+ 'data-corner': 'left'
75
+ }], ['div', {
76
+ contenteditable: 'false',
77
+ 'aria-hidden': 'true',
78
+ class: _types.TableCssClassName.TABLE_CORNER_MASK,
79
+ 'data-corner': 'right'
80
+ }]] : [];
69
81
  var tableContainerDiv = ['div', {
70
82
  class: 'pm-table-container',
71
83
  'data-number-column': node.attrs.isNumberColumnEnabled,
@@ -78,7 +90,7 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
78
90
  class: 'pm-table-row-controls-wrapper'
79
91
  }, ['div']], ['div', {
80
92
  class: 'pm-table-wrapper'
81
- }, ['table', attrs, colgroup, ['tbody', 0]]], ['div', {
93
+ }].concat(roundedTableCornerMasks, [['table', attrs, colgroup, ['tbody', 0]]]), ['div', {
82
94
  class: 'pm-table-sticky-sentinel-bottom',
83
95
  'data-testid': 'sticky-sentinel-bottom'
84
96
  }]].concat((0, _toConsumableArray2.default)((0, _coreUtils.isSSRStreaming)() ? [['div', {
@@ -10,7 +10,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
10
10
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
11
11
  var _tableMap = require("@atlaskit/editor-tables/table-map");
12
12
  var _utils = require("@atlaskit/editor-tables/utils");
13
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
14
13
  var _toolbar = require("../../ui/toolbar");
15
14
  var _pluginFactory = require("../plugin-factory");
16
15
  var _misc = require("./misc");
@@ -470,7 +469,7 @@ var modASelectTable = exports.modASelectTable = function modASelectTable(editorS
470
469
  var isCellSelection = selection instanceof _cellSelection.CellSelection;
471
470
 
472
471
  // if no cells are selected
473
- if (!isCellSelection && (0, _expValEquals.expValEquals)('platform_editor_lovability_select_all_shortcut', 'isEnabled', true)) {
472
+ if (!isCellSelection) {
474
473
  return selectTableCell(state, dispatch);
475
474
  }
476
475
  // else if any number of cells are selected but not the full table
@@ -3,9 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.updateStickyMargins = exports.updateControls = exports.syncStickyRowToTable = exports.isClickNear = exports.getResizeCellPos = void 0;
6
+ exports.updateStickyMargins = exports.updateControls = exports.syncStickyRowToTable = exports.isClickNear = exports.getResizeCellPos = exports.clearStickyCornerMaskPositions = void 0;
7
7
  var _styles = require("@atlaskit/editor-common/styles");
8
8
  var _utils = require("@atlaskit/editor-common/utils");
9
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
9
10
  var _types = require("../../../types");
10
11
  var _pluginFactory = require("../../plugin-factory");
11
12
  var _columnControls = require("../../utils/column-controls");
@@ -103,5 +104,34 @@ var applyTableWidthToStickyRow = function applyTableWidthToStickyRow(tableRef, h
103
104
  var newWidth = Math.min(tbody.offsetWidth + 1, wrapper.offsetWidth);
104
105
  headerRow.style.width = "".concat(newWidth, "px");
105
106
  headerRow.scrollLeft = wrapper.scrollLeft;
107
+ if ((0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true)) {
108
+ syncCornerMasksToStickyRow(tableRef, headerRow, wrapper);
109
+ }
110
+ }
111
+ };
112
+ var clearStickyCornerMaskPositions = exports.clearStickyCornerMaskPositions = function clearStickyCornerMaskPositions(tableRef) {
113
+ var wrapper = tableRef === null || tableRef === void 0 ? void 0 : tableRef.parentElement;
114
+ if (!wrapper) {
115
+ return;
116
+ }
117
+ wrapper.querySelectorAll(".".concat(_types.TableCssClassName.TABLE_CORNER_MASK)).forEach(function (mask) {
118
+ mask.style.removeProperty('left');
119
+ });
120
+ };
121
+ var syncCornerMasksToStickyRow = function syncCornerMasksToStickyRow(tableRef, headerRow, wrapper) {
122
+ var cornerMasks = wrapper.querySelectorAll(".".concat(_types.TableCssClassName.TABLE_CORNER_MASK));
123
+ if (!cornerMasks.length) {
124
+ return;
125
+ }
126
+ var isLegacySticky = tableRef.classList.contains(_types.TableCssClassName.TABLE_STICKY) && headerRow.classList.contains('sticky');
127
+ if (!isLegacySticky) {
128
+ clearStickyCornerMaskPositions(tableRef);
129
+ return;
106
130
  }
131
+ var stickyRowRect = headerRow.getBoundingClientRect();
132
+ cornerMasks.forEach(function (mask) {
133
+ var corner = mask.dataset.corner;
134
+ var left = corner === 'right' ? stickyRowRect.right - 11 : stickyRowRect.left - 1;
135
+ mask.style.left = "".concat(left, "px");
136
+ });
107
137
  };
@@ -500,7 +500,7 @@ var tablePlugin = function tablePlugin(_ref) {
500
500
  return (0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') && (0, _platformFeatureFlags.fg)('platform_editor_table_sticky_header_patch_1') ? (0, _editorContentAreaHeight.createPlugin)() : undefined;
501
501
  }
502
502
  }];
503
- if (!(0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && (0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow') && (0, _platformFeatureFlags.fg)('platform_editor_table_sticky_header_patch_2')) {
503
+ if (!(0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && (0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
504
504
  plugins.push({
505
505
  name: 'tableAnchorNames',
506
506
  plugin: function plugin() {
@@ -147,6 +147,7 @@ var TableCssClassName = exports.TableCssClassName = _objectSpread(_objectSpread(
147
147
  NODEVIEW_WRAPPER: 'tableView-content-wrap',
148
148
  TABLE_SELECTED: "".concat(_adfSchema.tablePrefixSelector, "-table__selected"),
149
149
  TABLE_CELL: _adfSchema.tableCellSelector,
150
+ TABLE_CORNER_MASK: "".concat(_adfSchema.tablePrefixSelector, "-corner-mask"),
150
151
  TABLE_HEADER_CELL: _adfSchema.tableHeaderSelector,
151
152
  TABLE_STICKY: "".concat(_adfSchema.tablePrefixSelector, "-sticky"),
152
153
  TABLE_CHROMELESS: "".concat(_adfSchema.tablePrefixSelector, "-chromeless"),
@@ -73,13 +73,21 @@ var NumberColumn = exports.default = /*#__PURE__*/function (_Component) {
73
73
  tableActive = _this$props3.tableActive,
74
74
  updateCellHoverLocation = _this$props3.updateCellHoverLocation;
75
75
  var rowHeights = (0, _rowControls.getRowHeights)(tableRef);
76
+ var getMarginTop = function getMarginTop() {
77
+ if (!hasHeaderRow || _this2.props.stickyTop === undefined) {
78
+ return undefined;
79
+ }
80
+
81
+ // with platform_editor_table_q4_loveability enabled, table controls have margin-top of 1px applied. Offset this here.
82
+ return rowHeights[0] + 1;
83
+ };
76
84
  if ((0, _coreUtils.isSSR)()) {
77
85
  return /*#__PURE__*/_react.default.createElement("div", {
78
86
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
79
87
  className: _types.TableCssClassName.NUMBERED_COLUMN,
80
88
  style: {
81
89
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
82
- marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
90
+ marginTop: (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? getMarginTop() : hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
83
91
  borderLeft: isDragAndDropEnabled && tableActive && !(0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
84
92
  "1px solid ".concat(_consts.tableBorderColor) : undefined,
85
93
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
@@ -93,7 +101,7 @@ var NumberColumn = exports.default = /*#__PURE__*/function (_Component) {
93
101
  className: _types.TableCssClassName.NUMBERED_COLUMN,
94
102
  style: {
95
103
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
96
- marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
104
+ marginTop: (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? getMarginTop() : hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined,
97
105
  borderLeft: isDragAndDropEnabled && tableActive && !(0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
98
106
  "1px solid ".concat(_consts.tableBorderColor) : undefined,
99
107
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop