@atlaskit/editor-plugin-table 7.5.7 → 7.5.9

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 7.5.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [#81302](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81302) [`969e899b8844`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/969e899b8844) - Update column resize logic to match mouse movement
8
+ - [#81427](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81427) [`8adea3fa8973`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8adea3fa8973) - [ux] When number column toggled and preserve table widths ff enabled, the table oveflow state should align with current behaviour.
9
+
10
+ ## 7.5.8
11
+
12
+ ### Patch Changes
13
+
14
+ - [#80679](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80679) [`104eb9443b7e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/104eb9443b7e) - ED-22553 Updating adf-schema version to 35.6.0
15
+ - Updated dependencies
16
+
3
17
  ## 7.5.7
4
18
 
5
19
  ### Patch Changes
@@ -185,8 +185,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
185
185
  getNode = _this$props2.getNode,
186
186
  getPos = _this$props2.getPos,
187
187
  containerWidth = _this$props2.containerWidth,
188
- options = _this$props2.options,
189
- isTableScalingEnabled = _this$props2.isTableScalingEnabled;
188
+ options = _this$props2.options;
190
189
  var node = getNode();
191
190
  var state = view.state,
192
191
  dispatch = view.dispatch;
@@ -203,7 +202,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
203
202
  start: pos + 1,
204
203
  containerWidth: width,
205
204
  previousContainerWidth: _this.containerWidth.width || width
206
- }, options), domAtPos, isTableScalingEnabled)(state.tr);
205
+ }, options), domAtPos, false)(state.tr);
207
206
  dispatch(tr);
208
207
  });
209
208
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "setTimerToSendInitialOverflowCaptured", function (isOverflowing) {
@@ -4,13 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.resizeColumn = void 0;
7
+ var _misc = require("./misc");
7
8
  var _resizeLogic = require("./resize-logic");
8
9
  var _resizeState = require("./resize-state");
9
10
  // Resize a given column by an amount from the current state
10
11
 
11
12
  var resizeColumn = exports.resizeColumn = function resizeColumn(resizeState, colIndex, amount, tableRef, tableNode, selectedColumns) {
12
13
  var isTableScalingEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
13
- var newState = amount > 0 ? (0, _resizeLogic.growColumn)(resizeState, colIndex, amount, selectedColumns) : amount < 0 ? (0, _resizeLogic.shrinkColumn)(resizeState, colIndex, amount, selectedColumns) : resizeState;
14
+ var scalePercent = 1;
15
+ var resizeAmount = amount;
16
+ if (isTableScalingEnabled) {
17
+ scalePercent = (0, _misc.getTableScalingPercent)(tableNode, tableRef);
18
+ resizeAmount = amount / scalePercent;
19
+ }
20
+ var newState = resizeAmount > 0 ? (0, _resizeLogic.growColumn)(resizeState, colIndex, resizeAmount, selectedColumns) : resizeAmount < 0 ? (0, _resizeLogic.shrinkColumn)(resizeState, colIndex, resizeAmount, selectedColumns) : resizeState;
14
21
  (0, _resizeState.updateColgroup)(newState, tableRef, tableNode, isTableScalingEnabled);
15
22
  return newState;
16
23
  };
@@ -169,8 +169,7 @@ class TableComponent extends React.Component {
169
169
  getNode,
170
170
  getPos,
171
171
  containerWidth,
172
- options,
173
- isTableScalingEnabled
172
+ options
174
173
  } = this.props;
175
174
  const node = getNode();
176
175
  const {
@@ -194,7 +193,7 @@ class TableComponent extends React.Component {
194
193
  containerWidth: width,
195
194
  previousContainerWidth: this.containerWidth.width || width,
196
195
  ...options
197
- }, domAtPos, isTableScalingEnabled)(state.tr);
196
+ }, domAtPos, false)(state.tr);
198
197
  dispatch(tr);
199
198
  });
200
199
  _defineProperty(this, "setTimerToSendInitialOverflowCaptured", isOverflowing => {
@@ -1,9 +1,16 @@
1
1
  // Resize a given column by an amount from the current state
2
2
 
3
+ import { getTableScalingPercent } from './misc';
3
4
  import { growColumn, shrinkColumn } from './resize-logic';
4
5
  import { updateColgroup } from './resize-state';
5
6
  export const resizeColumn = (resizeState, colIndex, amount, tableRef, tableNode, selectedColumns, isTableScalingEnabled = false) => {
6
- const newState = amount > 0 ? growColumn(resizeState, colIndex, amount, selectedColumns) : amount < 0 ? shrinkColumn(resizeState, colIndex, amount, selectedColumns) : resizeState;
7
+ let scalePercent = 1;
8
+ let resizeAmount = amount;
9
+ if (isTableScalingEnabled) {
10
+ scalePercent = getTableScalingPercent(tableNode, tableRef);
11
+ resizeAmount = amount / scalePercent;
12
+ }
13
+ const newState = resizeAmount > 0 ? growColumn(resizeState, colIndex, resizeAmount, selectedColumns) : resizeAmount < 0 ? shrinkColumn(resizeState, colIndex, resizeAmount, selectedColumns) : resizeState;
7
14
  updateColgroup(newState, tableRef, tableNode, isTableScalingEnabled);
8
15
  return newState;
9
16
  };
@@ -178,8 +178,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
178
178
  getNode = _this$props2.getNode,
179
179
  getPos = _this$props2.getPos,
180
180
  containerWidth = _this$props2.containerWidth,
181
- options = _this$props2.options,
182
- isTableScalingEnabled = _this$props2.isTableScalingEnabled;
181
+ options = _this$props2.options;
183
182
  var node = getNode();
184
183
  var state = view.state,
185
184
  dispatch = view.dispatch;
@@ -196,7 +195,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
196
195
  start: pos + 1,
197
196
  containerWidth: width,
198
197
  previousContainerWidth: _this.containerWidth.width || width
199
- }, options), domAtPos, isTableScalingEnabled)(state.tr);
198
+ }, options), domAtPos, false)(state.tr);
200
199
  dispatch(tr);
201
200
  });
202
201
  _defineProperty(_assertThisInitialized(_this), "setTimerToSendInitialOverflowCaptured", function (isOverflowing) {
@@ -1,10 +1,17 @@
1
1
  // Resize a given column by an amount from the current state
2
2
 
3
+ import { getTableScalingPercent } from './misc';
3
4
  import { growColumn, shrinkColumn } from './resize-logic';
4
5
  import { updateColgroup } from './resize-state';
5
6
  export var resizeColumn = function resizeColumn(resizeState, colIndex, amount, tableRef, tableNode, selectedColumns) {
6
7
  var isTableScalingEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
7
- var newState = amount > 0 ? growColumn(resizeState, colIndex, amount, selectedColumns) : amount < 0 ? shrinkColumn(resizeState, colIndex, amount, selectedColumns) : resizeState;
8
+ var scalePercent = 1;
9
+ var resizeAmount = amount;
10
+ if (isTableScalingEnabled) {
11
+ scalePercent = getTableScalingPercent(tableNode, tableRef);
12
+ resizeAmount = amount / scalePercent;
13
+ }
14
+ var newState = resizeAmount > 0 ? growColumn(resizeState, colIndex, resizeAmount, selectedColumns) : resizeAmount < 0 ? shrinkColumn(resizeState, colIndex, resizeAmount, selectedColumns) : resizeState;
8
15
  updateColgroup(newState, tableRef, tableNode, isTableScalingEnabled);
9
16
  return newState;
10
17
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "7.5.7",
3
+ "version": "7.5.9",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -28,8 +28,8 @@
28
28
  "runReact18": false
29
29
  },
30
30
  "dependencies": {
31
- "@atlaskit/adf-schema": "^35.5.2",
32
- "@atlaskit/custom-steps": "^0.0.14",
31
+ "@atlaskit/adf-schema": "^35.6.0",
32
+ "@atlaskit/custom-steps": "^0.0.15",
33
33
  "@atlaskit/editor-common": "^78.12.0",
34
34
  "@atlaskit/editor-palette": "1.5.2",
35
35
  "@atlaskit/editor-plugin-analytics": "^1.0.0",
@@ -888,14 +888,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
888
888
  layoutChanged: boolean;
889
889
  parentWidth?: number;
890
890
  }) => {
891
- const {
892
- view,
893
- getNode,
894
- getPos,
895
- containerWidth,
896
- options,
897
- isTableScalingEnabled,
898
- } = this.props;
891
+ const { view, getNode, getPos, containerWidth, options } = this.props;
899
892
  const node = getNode();
900
893
  const { state, dispatch } = view;
901
894
  const pos = getPos();
@@ -920,7 +913,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
920
913
  ...options,
921
914
  },
922
915
  domAtPos,
923
- isTableScalingEnabled,
916
+ false,
924
917
  )(state.tr);
925
918
 
926
919
  dispatch(tr);
@@ -1,6 +1,7 @@
1
1
  // Resize a given column by an amount from the current state
2
2
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
3
3
 
4
+ import { getTableScalingPercent } from './misc';
4
5
  import { growColumn, shrinkColumn } from './resize-logic';
5
6
  import { updateColgroup } from './resize-state';
6
7
  import type { ResizeState } from './types';
@@ -14,11 +15,18 @@ export const resizeColumn = (
14
15
  selectedColumns?: number[],
15
16
  isTableScalingEnabled = false,
16
17
  ): ResizeState => {
18
+ let scalePercent = 1;
19
+ let resizeAmount = amount;
20
+
21
+ if (isTableScalingEnabled) {
22
+ scalePercent = getTableScalingPercent(tableNode, tableRef);
23
+ resizeAmount = amount / scalePercent;
24
+ }
17
25
  const newState =
18
- amount > 0
19
- ? growColumn(resizeState, colIndex, amount, selectedColumns)
20
- : amount < 0
21
- ? shrinkColumn(resizeState, colIndex, amount, selectedColumns)
26
+ resizeAmount > 0
27
+ ? growColumn(resizeState, colIndex, resizeAmount, selectedColumns)
28
+ : resizeAmount < 0
29
+ ? shrinkColumn(resizeState, colIndex, resizeAmount, selectedColumns)
22
30
  : resizeState;
23
31
 
24
32
  updateColgroup(newState, tableRef, tableNode, isTableScalingEnabled);