@atlaskit/editor-plugin-table 4.0.1 → 4.0.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 +146 -133
- package/README.md +1 -1
- package/dist/cjs/i18n/cs.js +2 -3
- package/dist/cjs/i18n/da.js +2 -3
- package/dist/cjs/i18n/de.js +2 -3
- package/dist/cjs/i18n/en.js +2 -3
- package/dist/cjs/i18n/en_GB.js +2 -3
- package/dist/cjs/i18n/en_ZZ.js +2 -3
- package/dist/cjs/i18n/es.js +2 -3
- package/dist/cjs/i18n/fi.js +2 -3
- package/dist/cjs/i18n/fr.js +2 -3
- package/dist/cjs/i18n/hu.js +2 -3
- package/dist/cjs/i18n/it.js +2 -3
- package/dist/cjs/i18n/ja.js +2 -3
- package/dist/cjs/i18n/ko.js +2 -3
- package/dist/cjs/i18n/nb.js +2 -3
- package/dist/cjs/i18n/nl.js +2 -3
- package/dist/cjs/i18n/pl.js +2 -3
- package/dist/cjs/i18n/pt_BR.js +2 -3
- package/dist/cjs/i18n/ru.js +2 -3
- package/dist/cjs/i18n/sv.js +2 -3
- package/dist/cjs/i18n/th.js +2 -3
- package/dist/cjs/i18n/tr.js +2 -3
- package/dist/cjs/i18n/uk.js +2 -3
- package/dist/cjs/i18n/vi.js +2 -3
- package/dist/cjs/i18n/zh.js +2 -3
- package/dist/cjs/i18n/zh_TW.js +2 -3
- package/dist/cjs/plugins/table/commands/clear.js +3 -5
- package/dist/cjs/plugins/table/commands/collapse.js +2 -3
- package/dist/cjs/plugins/table/commands/go-to-next-cell.js +2 -3
- package/dist/cjs/plugins/table/commands/hover.js +8 -15
- package/dist/cjs/plugins/table/commands/insert.js +8 -13
- package/dist/cjs/plugins/table/commands/misc.js +23 -45
- package/dist/cjs/plugins/table/commands/referentiality.js +2 -3
- package/dist/cjs/plugins/table/commands/selection.js +3 -6
- package/dist/cjs/plugins/table/commands/sort.js +5 -6
- package/dist/cjs/plugins/table/commands/split-cell.js +2 -3
- package/dist/cjs/plugins/table/commands/toggle.js +7 -13
- package/dist/cjs/plugins/table/commands-with-analytics.js +19 -37
- package/dist/cjs/plugins/table/create-plugin-config.js +2 -3
- package/dist/cjs/plugins/table/event-handlers.js +12 -22
- package/dist/cjs/plugins/table/handlers.js +4 -5
- package/dist/cjs/plugins/table/index.js +8 -9
- package/dist/cjs/plugins/table/nodeviews/OverflowShadowsObserver.js +5 -6
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +2 -3
- package/dist/cjs/plugins/table/nodeviews/TableContainer.js +10 -13
- package/dist/cjs/plugins/table/nodeviews/TableResizer.js +4 -5
- package/dist/cjs/plugins/table/nodeviews/TableStickyScrollbar.js +5 -10
- package/dist/cjs/plugins/table/nodeviews/table.js +4 -6
- package/dist/cjs/plugins/table/nodeviews/tableCell.js +2 -3
- package/dist/cjs/plugins/table/nodeviews/update-overflow-shadows.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +5 -9
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +3 -5
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-resizing.js +3 -5
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/compose-decorations.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/default-table-selection.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/keymap.js +1 -2
- package/dist/cjs/plugins/table/pm-plugins/main.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/plugin-factory.js +3 -6
- package/dist/cjs/plugins/table/pm-plugins/plugin-key.js +1 -2
- package/dist/cjs/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +3 -5
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/commands.js +3 -5
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +3 -5
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +6 -8
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin-key.js +1 -2
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin-state.js +2 -4
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/util.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/table-analytics.js +5 -8
- package/dist/cjs/plugins/table/pm-plugins/table-local-id.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/commands.js +7 -13
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +3 -4
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin-factory.js +3 -6
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin-key.js +1 -2
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/reducer.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +7 -13
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/column-state.js +5 -10
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/consts.js +2 -4
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/dom.js +8 -15
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/misc.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-column.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +70 -71
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +11 -21
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +5 -9
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/table-selection-keymap.js +1 -2
- package/dist/cjs/plugins/table/pm-plugins/table-width.js +3 -5
- package/dist/cjs/plugins/table/reducer.js +2 -3
- package/dist/cjs/plugins/table/toolbar.js +8 -12
- package/dist/cjs/plugins/table/transforms/column-width.js +4 -6
- package/dist/cjs/plugins/table/transforms/delete-columns.js +60 -60
- package/dist/cjs/plugins/table/transforms/delete-rows.js +52 -52
- package/dist/cjs/plugins/table/transforms/fix-tables.js +3 -6
- package/dist/cjs/plugins/table/transforms/replace-table.js +3 -4
- package/dist/cjs/plugins/table/types.js +5 -9
- package/dist/cjs/plugins/table/ui/ColumnResizeWidget/index.js +2 -3
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/FixedButton.js +5 -10
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/styles.js +3 -5
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +7 -10
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/index.js +1 -2
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/styles.js +2 -4
- package/dist/cjs/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +1 -2
- package/dist/cjs/plugins/table/ui/FloatingDeleteButton/index.js +1 -2
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/InsertButton.js +1 -2
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +1 -2
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +2 -4
- package/dist/cjs/plugins/table/ui/LayoutButton/index.js +1 -2
- package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +1 -2
- package/dist/cjs/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +2 -3
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/index.js +1 -2
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +1 -2
- package/dist/cjs/plugins/table/ui/common-styles.js +23 -14
- package/dist/cjs/plugins/table/ui/consts.js +47 -94
- package/dist/cjs/plugins/table/ui/messages.js +2 -3
- package/dist/cjs/plugins/table/ui/ui-styles.js +32 -38
- package/dist/cjs/plugins/table/utils/analytics.js +7 -12
- package/dist/cjs/plugins/table/utils/collapse.js +3 -5
- package/dist/cjs/plugins/table/utils/column-controls.js +6 -11
- package/dist/cjs/plugins/table/utils/decoration.js +10 -19
- package/dist/cjs/plugins/table/utils/dom.js +16 -28
- package/dist/cjs/plugins/table/utils/guidelines.js +1 -2
- package/dist/cjs/plugins/table/utils/nodes.js +12 -23
- package/dist/cjs/plugins/table/utils/paste.js +10 -16
- package/dist/cjs/plugins/table/utils/row-controls.js +7 -13
- package/dist/cjs/plugins/table/utils/selection.js +5 -9
- package/dist/cjs/plugins/table/utils/snapping.js +4 -7
- package/dist/cjs/plugins/table/utils/table.js +3 -5
- package/dist/cjs/plugins/table/utils/update-plugin-state-decorations.js +2 -3
- package/dist/cjs/plugins/table-plugin.js +1 -2
- package/dist/es2019/plugins/table/commands/insert.js +1 -1
- package/dist/es2019/plugins/table/commands/sort.js +1 -1
- package/dist/es2019/plugins/table/handlers.js +1 -1
- package/dist/es2019/plugins/table/toolbar.js +1 -1
- package/dist/es2019/plugins/table/transforms/delete-columns.js +1 -1
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
- package/dist/es2019/plugins/table/ui/common-styles.js +40 -4
- package/dist/es2019/plugins/table/ui/ui-styles.js +223 -85
- package/dist/esm/plugins/table/commands/insert.js +1 -1
- package/dist/esm/plugins/table/commands/sort.js +1 -1
- package/dist/esm/plugins/table/event-handlers.js +1 -1
- package/dist/esm/plugins/table/handlers.js +1 -1
- package/dist/esm/plugins/table/index.js +7 -7
- package/dist/esm/plugins/table/nodeviews/OverflowShadowsObserver.js +3 -3
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +1 -1
- package/dist/esm/plugins/table/nodeviews/TableContainer.js +6 -6
- package/dist/esm/plugins/table/nodeviews/TableResizer.js +2 -2
- package/dist/esm/plugins/table/nodeviews/TableStickyScrollbar.js +3 -7
- package/dist/esm/plugins/table/nodeviews/table.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +3 -3
- package/dist/esm/plugins/table/pm-plugins/table-analytics.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +68 -67
- package/dist/esm/plugins/table/toolbar.js +2 -2
- package/dist/esm/plugins/table/transforms/column-width.js +1 -1
- package/dist/esm/plugins/table/transforms/delete-columns.js +57 -56
- package/dist/esm/plugins/table/transforms/delete-rows.js +51 -50
- package/dist/esm/plugins/table/transforms/replace-table.js +1 -1
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +2 -2
- package/dist/esm/plugins/table/ui/common-styles.js +20 -6
- package/dist/esm/plugins/table/ui/ui-styles.js +18 -10
- package/dist/esm/plugins/table/utils/analytics.js +1 -1
- package/dist/esm/plugins/table/utils/dom.js +1 -1
- package/dist/esm/plugins/table/utils/paste.js +4 -4
- package/dist/types/plugins/table/commands/sort.d.ts +2 -2
- package/dist/types/plugins/table/commands-with-analytics.d.ts +4 -4
- package/dist/types/plugins/table/handlers.d.ts +2 -2
- package/dist/types/plugins/table/nodeviews/TableComponent.d.ts +1 -1
- package/dist/types/plugins/table/types.d.ts +1 -1
- package/dist/types/plugins/table/ui/TableFloatingControls/index.d.ts +4 -4
- package/dist/types-ts4.5/plugins/table/commands/sort.d.ts +2 -2
- package/dist/types-ts4.5/plugins/table/commands-with-analytics.d.ts +4 -4
- package/dist/types-ts4.5/plugins/table/handlers.d.ts +2 -2
- package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/types.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +4 -4
- package/docs/0-intro.tsx +1 -1
- package/package.json +8 -4
- package/src/__tests__/integration/__snapshots__/auto-size.ts.snap +3 -0
- package/src/__tests__/integration/__snapshots__/copy-button.ts.snap +2 -0
- package/src/__tests__/integration/__snapshots__/delete-columns.ts.snap +2 -0
- package/src/__tests__/integration/__snapshots__/delete-last-column-in-full-width.ts.snap +1 -0
- package/src/__tests__/integration/__snapshots__/delete-last-column-with-empty-action.ts.snap +1 -0
- package/src/__tests__/integration/__snapshots__/delete-last-row-with-empty-action.ts.snap +2 -0
- package/src/__tests__/integration/__snapshots__/delete-rows.ts.snap +3 -0
- package/src/__tests__/integration/__snapshots__/deleting-empty-paragraph-under-table.ts.snap +3 -0
- package/src/__tests__/integration/__snapshots__/even-columns.ts.snap +2 -0
- package/src/__tests__/integration/__snapshots__/insert-cell-header-with-strong-mark.ts.snap +1 -0
- package/src/__tests__/integration/__snapshots__/insert-row-inside-layout.ts.snap +1 -0
- package/src/__tests__/integration/__snapshots__/layout.ts.snap +9 -0
- package/src/__tests__/integration/__snapshots__/resize.ts.snap +11 -0
- package/src/__tests__/integration/__snapshots__/scale.ts.snap +2 -0
- package/src/__tests__/unit/commands/sort.ts +1 -1
- package/src/__tests__/unit/pm-plugins/table-width.ts +190 -1
- package/src/__tests__/unit/sort-column.ts +1 -1
- package/src/plugins/table/commands/insert.ts +1 -1
- package/src/plugins/table/commands/sort.ts +7 -7
- package/src/plugins/table/commands-with-analytics.ts +11 -6
- package/src/plugins/table/handlers.ts +7 -8
- package/src/plugins/table/nodeviews/TableComponent.tsx +1 -1
- package/src/plugins/table/nodeviews/table.tsx +1 -1
- package/src/plugins/table/toolbar.tsx +1 -1
- package/src/plugins/table/transforms/delete-columns.ts +1 -1
- package/src/plugins/table/types.ts +1 -1
- package/src/plugins/table/ui/FloatingContextualMenu/ContextualMenu.tsx +1 -1
- package/src/plugins/table/ui/TableFloatingControls/index.tsx +4 -4
- package/src/plugins/table/ui/common-styles.ts +46 -4
- package/src/plugins/table/ui/ui-styles.ts +235 -90
- package/tsconfig.app.json +3 -0
- package/tsconfig.dev.json +3 -0
|
@@ -7,14 +7,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.growColumn = void 0;
|
|
8
8
|
exports.reduceSpace = reduceSpace;
|
|
9
9
|
exports.shrinkColumn = void 0;
|
|
10
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
12
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
12
|
var _columnState = require("./column-state");
|
|
14
13
|
var _resizeState = require("./resize-state");
|
|
15
14
|
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; }
|
|
16
15
|
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; }
|
|
17
|
-
var growColumn = function growColumn(state, colIndex, amount, selectedColumns) {
|
|
16
|
+
var growColumn = exports.growColumn = function growColumn(state, colIndex, amount, selectedColumns) {
|
|
18
17
|
// can't grow if columns don't exist or it's the last column
|
|
19
18
|
if (!state.cols[colIndex] || !state.cols[colIndex + 1]) {
|
|
20
19
|
return state;
|
|
@@ -30,8 +29,7 @@ var growColumn = function growColumn(state, colIndex, amount, selectedColumns) {
|
|
|
30
29
|
}
|
|
31
30
|
return newState;
|
|
32
31
|
};
|
|
33
|
-
exports.
|
|
34
|
-
var shrinkColumn = function shrinkColumn(state, colIndex, amount, selectedColumns) {
|
|
32
|
+
var shrinkColumn = exports.shrinkColumn = function shrinkColumn(state, colIndex, amount, selectedColumns) {
|
|
35
33
|
// can't shrink if columns don't exist
|
|
36
34
|
if (!state.cols[colIndex]) {
|
|
37
35
|
return state;
|
|
@@ -54,7 +52,6 @@ var shrinkColumn = function shrinkColumn(state, colIndex, amount, selectedColumn
|
|
|
54
52
|
}
|
|
55
53
|
return newState;
|
|
56
54
|
};
|
|
57
|
-
exports.shrinkColumn = shrinkColumn;
|
|
58
55
|
function reduceSpace(state, amount) {
|
|
59
56
|
var ignoreCols = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
60
57
|
var remaining = amount;
|
|
@@ -62,39 +59,40 @@ function reduceSpace(state, amount) {
|
|
|
62
59
|
// keep trying to resolve resize request until we run out of free space,
|
|
63
60
|
// or nothing to resize
|
|
64
61
|
var _loop = function _loop() {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
candidates.forEach(function (candidate) {
|
|
77
|
-
var newWidth = candidate.width - requestedResize;
|
|
78
|
-
if (newWidth < candidate.minWidth) {
|
|
79
|
-
// If the new requested width is less than our min
|
|
80
|
-
// Calc what width we didn't use, we'll try extract that
|
|
81
|
-
// from other cols.
|
|
82
|
-
var remainder = candidate.minWidth - newWidth;
|
|
83
|
-
newWidth = candidate.minWidth;
|
|
84
|
-
remaining = remaining - requestedResize + remainder;
|
|
85
|
-
} else {
|
|
86
|
-
remaining -= requestedResize;
|
|
62
|
+
// filter candidates only with free space
|
|
63
|
+
var candidates = state.cols.filter(function (column) {
|
|
64
|
+
return (0, _columnState.getFreeSpace)(column) && ignoreCols.indexOf(column.index) === -1;
|
|
65
|
+
});
|
|
66
|
+
if (candidates.length === 0) {
|
|
67
|
+
return 0; // break
|
|
68
|
+
}
|
|
69
|
+
var requestedResize = Math.floor(remaining / candidates.length);
|
|
70
|
+
if (requestedResize === 0) {
|
|
71
|
+
return 0; // break
|
|
87
72
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
73
|
+
candidates.forEach(function (candidate) {
|
|
74
|
+
var newWidth = candidate.width - requestedResize;
|
|
75
|
+
if (newWidth < candidate.minWidth) {
|
|
76
|
+
// If the new requested width is less than our min
|
|
77
|
+
// Calc what width we didn't use, we'll try extract that
|
|
78
|
+
// from other cols.
|
|
79
|
+
var remainder = candidate.minWidth - newWidth;
|
|
80
|
+
newWidth = candidate.minWidth;
|
|
81
|
+
remaining = remaining - requestedResize + remainder;
|
|
82
|
+
} else {
|
|
83
|
+
remaining -= requestedResize;
|
|
84
|
+
}
|
|
85
|
+
state = _objectSpread(_objectSpread({}, state), {}, {
|
|
86
|
+
cols: [].concat((0, _toConsumableArray2.default)(state.cols.slice(0, candidate.index)), [_objectSpread(_objectSpread({}, candidate), {}, {
|
|
87
|
+
width: newWidth
|
|
88
|
+
})], (0, _toConsumableArray2.default)(state.cols.slice(candidate.index + 1)))
|
|
89
|
+
});
|
|
92
90
|
});
|
|
93
|
-
}
|
|
94
|
-
|
|
91
|
+
},
|
|
92
|
+
_ret;
|
|
95
93
|
while (remaining > 0) {
|
|
96
|
-
|
|
97
|
-
if (_ret ===
|
|
94
|
+
_ret = _loop();
|
|
95
|
+
if (_ret === 0) break;
|
|
98
96
|
}
|
|
99
97
|
return state;
|
|
100
98
|
}
|
|
@@ -147,44 +145,45 @@ function moveSpaceFrom(state, srcIdx, destIdx, amount) {
|
|
|
147
145
|
function stackSpace(state, destIdx, amount) {
|
|
148
146
|
var candidates = getCandidates(state, destIdx, amount);
|
|
149
147
|
var _loop2 = function _loop2() {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
148
|
+
// search for most (or least) free space in candidates
|
|
149
|
+
var candidateIdx = findNextFreeColumn(candidates, amount);
|
|
150
|
+
if (candidateIdx === -1) {
|
|
151
|
+
// stack to the right -> growing the dragging column and go overflow
|
|
152
|
+
if (amount > 0) {
|
|
153
|
+
return {
|
|
154
|
+
v: {
|
|
155
|
+
state: _objectSpread(_objectSpread({}, state), {}, {
|
|
156
|
+
cols: [].concat((0, _toConsumableArray2.default)(state.cols.slice(0, destIdx)), [_objectSpread(_objectSpread({}, state.cols[destIdx]), {}, {
|
|
157
|
+
width: state.cols[destIdx].width + amount
|
|
158
|
+
})], (0, _toConsumableArray2.default)(state.cols.slice(destIdx + 1)))
|
|
159
|
+
}),
|
|
160
|
+
remaining: amount
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
166
164
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
165
|
+
// stacking to the left, if no free space remains
|
|
166
|
+
return 0; // break
|
|
167
|
+
}
|
|
168
|
+
var column = candidates.find(function (col) {
|
|
169
|
+
return col.index === candidateIdx;
|
|
170
|
+
});
|
|
171
|
+
if (!column || (0, _columnState.getFreeSpace)(column) <= 0) {
|
|
172
|
+
// no more columns with free space remain
|
|
173
|
+
return 0; // break
|
|
174
|
+
}
|
|
175
|
+
var res = moveSpaceFrom(state, column.index, destIdx, amount);
|
|
176
|
+
state = res.state;
|
|
177
|
+
amount -= res.amount;
|
|
178
|
+
candidates = candidates.filter(function (col) {
|
|
179
|
+
return col.index !== candidateIdx;
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
_ret2;
|
|
184
183
|
while (candidates.length && amount) {
|
|
185
|
-
|
|
186
|
-
if (_ret2 ===
|
|
187
|
-
if (
|
|
184
|
+
_ret2 = _loop2();
|
|
185
|
+
if (_ret2 === 0) break;
|
|
186
|
+
if (_ret2) return _ret2.v;
|
|
188
187
|
}
|
|
189
188
|
return {
|
|
190
189
|
state: state,
|
|
@@ -16,7 +16,7 @@ var _dom = require("./dom");
|
|
|
16
16
|
var _misc = require("./misc");
|
|
17
17
|
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; }
|
|
18
18
|
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; }
|
|
19
|
-
var getResizeState = function getResizeState(_ref) {
|
|
19
|
+
var getResizeState = exports.getResizeState = function getResizeState(_ref) {
|
|
20
20
|
var minWidth = _ref.minWidth,
|
|
21
21
|
maxSize = _ref.maxSize,
|
|
22
22
|
table = _ref.table,
|
|
@@ -70,8 +70,7 @@ var getResizeState = function getResizeState(_ref) {
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
// updates Colgroup DOM node with new widths
|
|
73
|
-
exports.
|
|
74
|
-
var updateColgroup = function updateColgroup(state, tableRef) {
|
|
73
|
+
var updateColgroup = exports.updateColgroup = function updateColgroup(state, tableRef) {
|
|
75
74
|
var cols = tableRef.querySelectorAll('col');
|
|
76
75
|
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width')) {
|
|
77
76
|
var columnsCount = cols.length;
|
|
@@ -97,8 +96,7 @@ var updateColgroup = function updateColgroup(state, tableRef) {
|
|
|
97
96
|
// colgroup has updated, reflect new widths in sticky header
|
|
98
97
|
(0, _dom.syncStickyRowToTable)(tableRef);
|
|
99
98
|
};
|
|
100
|
-
exports.
|
|
101
|
-
var getTotalWidth = function getTotalWidth(_ref2) {
|
|
99
|
+
var getTotalWidth = exports.getTotalWidth = function getTotalWidth(_ref2) {
|
|
102
100
|
var cols = _ref2.cols;
|
|
103
101
|
return cols.reduce(function (totalWidth, col) {
|
|
104
102
|
return totalWidth + col.width;
|
|
@@ -107,8 +105,7 @@ var getTotalWidth = function getTotalWidth(_ref2) {
|
|
|
107
105
|
|
|
108
106
|
// adjust columns to take up the total width
|
|
109
107
|
// difference in total columns widths vs table width happens due to the "Math.floor"
|
|
110
|
-
exports.
|
|
111
|
-
var adjustColumnsWidths = function adjustColumnsWidths(resizeState, maxSize) {
|
|
108
|
+
var adjustColumnsWidths = exports.adjustColumnsWidths = function adjustColumnsWidths(resizeState, maxSize) {
|
|
112
109
|
var totalWidth = getTotalWidth(resizeState);
|
|
113
110
|
var diff = maxSize - totalWidth;
|
|
114
111
|
if (diff > 0 || diff < 0 && Math.abs(diff) < _styles.tableCellMinWidth) {
|
|
@@ -127,8 +124,7 @@ var adjustColumnsWidths = function adjustColumnsWidths(resizeState, maxSize) {
|
|
|
127
124
|
}
|
|
128
125
|
return resizeState;
|
|
129
126
|
};
|
|
130
|
-
exports.
|
|
131
|
-
var evenAllColumnsWidths = function evenAllColumnsWidths(resizeState) {
|
|
127
|
+
var evenAllColumnsWidths = exports.evenAllColumnsWidths = function evenAllColumnsWidths(resizeState) {
|
|
132
128
|
var maxSize = getTotalWidth(resizeState);
|
|
133
129
|
var evenWidth = Math.floor(maxSize / resizeState.cols.length);
|
|
134
130
|
var cols = resizeState.cols.map(function (col) {
|
|
@@ -140,7 +136,6 @@ var evenAllColumnsWidths = function evenAllColumnsWidths(resizeState) {
|
|
|
140
136
|
cols: cols
|
|
141
137
|
}), maxSize);
|
|
142
138
|
};
|
|
143
|
-
exports.evenAllColumnsWidths = evenAllColumnsWidths;
|
|
144
139
|
var getSpace = function getSpace(columns, start, end) {
|
|
145
140
|
return columns.slice(start, end).map(function (col) {
|
|
146
141
|
return col.width;
|
|
@@ -148,7 +143,7 @@ var getSpace = function getSpace(columns, start, end) {
|
|
|
148
143
|
return sum + width;
|
|
149
144
|
}, 0);
|
|
150
145
|
};
|
|
151
|
-
var evenSelectedColumnsWidths = function evenSelectedColumnsWidths(resizeState, rect) {
|
|
146
|
+
var evenSelectedColumnsWidths = exports.evenSelectedColumnsWidths = function evenSelectedColumnsWidths(resizeState, rect) {
|
|
152
147
|
var cols = resizeState.cols;
|
|
153
148
|
var selectedSpace = getSpace(cols, rect.left, rect.right);
|
|
154
149
|
var allSpace = getSpace(cols, 0, cols.length);
|
|
@@ -180,8 +175,7 @@ var evenSelectedColumnsWidths = function evenSelectedColumnsWidths(resizeState,
|
|
|
180
175
|
})
|
|
181
176
|
});
|
|
182
177
|
};
|
|
183
|
-
exports.
|
|
184
|
-
var bulkColumnsResize = function bulkColumnsResize(resizeState, columnsIndexes, sourceColumnIndex) {
|
|
178
|
+
var bulkColumnsResize = exports.bulkColumnsResize = function bulkColumnsResize(resizeState, columnsIndexes, sourceColumnIndex) {
|
|
185
179
|
var currentTableWidth = getTotalWidth(resizeState);
|
|
186
180
|
var colIndex = columnsIndexes.indexOf(sourceColumnIndex) > -1 ? sourceColumnIndex : sourceColumnIndex + 1;
|
|
187
181
|
var sourceCol = resizeState.cols[colIndex];
|
|
@@ -256,8 +250,7 @@ var bulkColumnsResize = function bulkColumnsResize(resizeState, columnsIndexes,
|
|
|
256
250
|
// fix total table widths by adding missing pixels to columns widths here and there
|
|
257
251
|
return adjustColumnsWidths(newState, resizeState.maxSize);
|
|
258
252
|
};
|
|
259
|
-
exports.
|
|
260
|
-
var areColumnsEven = function areColumnsEven(resizeState) {
|
|
253
|
+
var areColumnsEven = exports.areColumnsEven = function areColumnsEven(resizeState) {
|
|
261
254
|
var newResizeState = evenAllColumnsWidths(resizeState);
|
|
262
255
|
return newResizeState.cols.every(function (col, i) {
|
|
263
256
|
return col.width === resizeState.cols[i].width;
|
|
@@ -265,8 +258,7 @@ var areColumnsEven = function areColumnsEven(resizeState) {
|
|
|
265
258
|
};
|
|
266
259
|
|
|
267
260
|
// Get the layout
|
|
268
|
-
exports.
|
|
269
|
-
var normaliseTableLayout = function normaliseTableLayout(input) {
|
|
261
|
+
var normaliseTableLayout = exports.normaliseTableLayout = function normaliseTableLayout(input) {
|
|
270
262
|
switch (input) {
|
|
271
263
|
case 'wide':
|
|
272
264
|
return input;
|
|
@@ -276,8 +268,7 @@ var normaliseTableLayout = function normaliseTableLayout(input) {
|
|
|
276
268
|
return 'default';
|
|
277
269
|
}
|
|
278
270
|
};
|
|
279
|
-
exports.
|
|
280
|
-
var getNewResizeStateFromSelectedColumns = function getNewResizeStateFromSelectedColumns(rect, state, domAtPos, getEditorContainerWidth) {
|
|
271
|
+
var getNewResizeStateFromSelectedColumns = exports.getNewResizeStateFromSelectedColumns = function getNewResizeStateFromSelectedColumns(rect, state, domAtPos, getEditorContainerWidth) {
|
|
281
272
|
// Fail early so that we don't do complex calculations for no reason
|
|
282
273
|
var numColumnsSelected = rect.right - rect.left;
|
|
283
274
|
if (numColumnsSelected <= 1) {
|
|
@@ -335,5 +326,4 @@ var getNewResizeStateFromSelectedColumns = function getNewResizeStateFromSelecte
|
|
|
335
326
|
widthsAfter: widthsAfter
|
|
336
327
|
}
|
|
337
328
|
};
|
|
338
|
-
};
|
|
339
|
-
exports.getNewResizeStateFromSelectedColumns = getNewResizeStateFromSelectedColumns;
|
|
329
|
+
};
|
|
@@ -22,7 +22,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
22
22
|
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; }
|
|
23
23
|
// Base function to trigger the actual scale on a table node.
|
|
24
24
|
// Will only resize/scale if a table has been previously resized.
|
|
25
|
-
var scale = function scale(tableRef, options, domAtPos) {
|
|
25
|
+
var scale = exports.scale = function scale(tableRef, options, domAtPos) {
|
|
26
26
|
/**
|
|
27
27
|
* isBreakoutEnabled === true -> default center aligned
|
|
28
28
|
* isBreakoutEnabled === false -> full width mode
|
|
@@ -71,8 +71,7 @@ var scale = function scale(tableRef, options, domAtPos) {
|
|
|
71
71
|
});
|
|
72
72
|
return scaleTableTo(resizeState, newWidth);
|
|
73
73
|
};
|
|
74
|
-
exports.
|
|
75
|
-
var scaleWithParent = function scaleWithParent(tableRef, parentWidth, table, start, domAtPos) {
|
|
74
|
+
var scaleWithParent = exports.scaleWithParent = function scaleWithParent(tableRef, parentWidth, table, start, domAtPos) {
|
|
76
75
|
var resizeState = (0, _resizeState.getResizeState)({
|
|
77
76
|
minWidth: _styles.tableCellMinWidth,
|
|
78
77
|
maxSize: parentWidth,
|
|
@@ -88,7 +87,6 @@ var scaleWithParent = function scaleWithParent(tableRef, parentWidth, table, sta
|
|
|
88
87
|
};
|
|
89
88
|
|
|
90
89
|
// Scales the table to a given size and updates its colgroup DOM node
|
|
91
|
-
exports.scaleWithParent = scaleWithParent;
|
|
92
90
|
function scaleTableTo(state, maxSize) {
|
|
93
91
|
var scaleFactor = maxSize / (0, _resizeState.getTotalWidth)(state);
|
|
94
92
|
var newState = _objectSpread(_objectSpread({}, state), {}, {
|
|
@@ -111,7 +109,7 @@ function scaleTableTo(state, maxSize) {
|
|
|
111
109
|
}
|
|
112
110
|
return (0, _resizeState.adjustColumnsWidths)(newState, maxSize);
|
|
113
111
|
}
|
|
114
|
-
var previewScaleTable = function previewScaleTable(tableRef, options, domAtPos) {
|
|
112
|
+
var previewScaleTable = exports.previewScaleTable = function previewScaleTable(tableRef, options, domAtPos) {
|
|
115
113
|
var node = options.node,
|
|
116
114
|
start = options.start,
|
|
117
115
|
parentWidth = options.parentWidth;
|
|
@@ -134,8 +132,7 @@ var previewScaleTable = function previewScaleTable(tableRef, options, domAtPos)
|
|
|
134
132
|
};
|
|
135
133
|
|
|
136
134
|
// Scale the table to meet new requirements (col, layout change etc)
|
|
137
|
-
exports.
|
|
138
|
-
var scaleTable = function scaleTable(tableRef, options, domAtPos) {
|
|
135
|
+
var scaleTable = exports.scaleTable = function scaleTable(tableRef, options, domAtPos) {
|
|
139
136
|
return function (tr) {
|
|
140
137
|
if (!tableRef) {
|
|
141
138
|
return tr;
|
|
@@ -175,5 +172,4 @@ var scaleTable = function scaleTable(tableRef, options, domAtPos) {
|
|
|
175
172
|
}
|
|
176
173
|
return tr;
|
|
177
174
|
};
|
|
178
|
-
};
|
|
179
|
-
exports.scaleTable = scaleTable;
|
|
175
|
+
};
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.unitToNumber = void 0;
|
|
7
|
-
var unitToNumber = function unitToNumber(unit) {
|
|
7
|
+
var unitToNumber = exports.unitToNumber = function unitToNumber(unit) {
|
|
8
8
|
return unit ? parseInt(unit, 10) : 0;
|
|
9
|
-
};
|
|
10
|
-
exports.unitToNumber = unitToNumber;
|
|
9
|
+
};
|
|
@@ -14,5 +14,4 @@ function tableSelectionKeymapPlugin(editorSelectionAPI) {
|
|
|
14
14
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveLeft.common, (0, _selection.arrowLeftFromTable)(editorSelectionAPI)(), list);
|
|
15
15
|
return (0, _keymap.keymap)(list);
|
|
16
16
|
}
|
|
17
|
-
var _default = tableSelectionKeymapPlugin;
|
|
18
|
-
exports.default = _default;
|
|
17
|
+
var _default = exports.default = tableSelectionKeymapPlugin;
|
|
@@ -22,9 +22,8 @@ var _excluded = ["width"];
|
|
|
22
22
|
*/
|
|
23
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; }
|
|
24
24
|
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; }
|
|
25
|
-
var pluginKey = new _state.PluginKey('tableWidthPlugin');
|
|
26
|
-
exports.
|
|
27
|
-
var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullWidthEnabled) {
|
|
25
|
+
var pluginKey = exports.pluginKey = new _state.PluginKey('tableWidthPlugin');
|
|
26
|
+
var createPlugin = exports.createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullWidthEnabled) {
|
|
28
27
|
return new _safePlugin.SafePlugin({
|
|
29
28
|
key: pluginKey,
|
|
30
29
|
state: {
|
|
@@ -146,5 +145,4 @@ var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullW
|
|
|
146
145
|
return tr;
|
|
147
146
|
}
|
|
148
147
|
});
|
|
149
|
-
};
|
|
150
|
-
exports.createPlugin = createPlugin;
|
|
148
|
+
};
|
|
@@ -9,7 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _defaultTableSelection = require("./pm-plugins/default-table-selection");
|
|
10
10
|
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; }
|
|
11
11
|
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; }
|
|
12
|
-
var _default = function _default(pluginState, action) {
|
|
12
|
+
var _default = exports.default = function _default(pluginState, action) {
|
|
13
13
|
switch (action.type) {
|
|
14
14
|
case 'TOGGLE_HEADER_COLUMN':
|
|
15
15
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
@@ -104,5 +104,4 @@ var _default = function _default(pluginState, action) {
|
|
|
104
104
|
default:
|
|
105
105
|
return pluginState;
|
|
106
106
|
}
|
|
107
|
-
};
|
|
108
|
-
exports.default = _default;
|
|
107
|
+
};
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.messages = exports.getToolbarMenuConfig = exports.getToolbarConfig = exports.getToolbarCellOptionsConfig = void 0;
|
|
8
8
|
var _react = require("@emotion/react");
|
|
9
9
|
var _reactIntlNext = require("react-intl-next");
|
|
10
|
-
var
|
|
10
|
+
var _customSteps = require("@atlaskit/custom-steps");
|
|
11
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
12
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
13
13
|
var _messages = _interopRequireDefault(require("@atlaskit/editor-common/messages"));
|
|
@@ -32,7 +32,7 @@ var _messages2 = _interopRequireDefault(require("./ui/messages"));
|
|
|
32
32
|
var _utils4 = require("./utils");
|
|
33
33
|
/** @jsx jsx */
|
|
34
34
|
|
|
35
|
-
var messages = (0, _reactIntlNext.defineMessages)({
|
|
35
|
+
var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
|
|
36
36
|
tableOptions: {
|
|
37
37
|
id: 'fabric.editor.tableOptions',
|
|
38
38
|
defaultMessage: 'Table options',
|
|
@@ -59,8 +59,7 @@ var messages = (0, _reactIntlNext.defineMessages)({
|
|
|
59
59
|
description: 'Wraps table in an expand'
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
|
-
exports.
|
|
63
|
-
var getToolbarMenuConfig = function getToolbarMenuConfig(config, state, _ref, editorAnalyticsAPI) {
|
|
62
|
+
var getToolbarMenuConfig = exports.getToolbarMenuConfig = function getToolbarMenuConfig(config, state, _ref, editorAnalyticsAPI) {
|
|
64
63
|
var formatMessage = _ref.formatMessage;
|
|
65
64
|
var options = [{
|
|
66
65
|
id: 'editor.table.headerRow',
|
|
@@ -103,8 +102,7 @@ var getToolbarMenuConfig = function getToolbarMenuConfig(config, state, _ref, ed
|
|
|
103
102
|
// Added these options for mobile. Mobile bridge translates this menu and
|
|
104
103
|
// relay it to the native mobile. Native mobile displays the menu
|
|
105
104
|
// with native widgets. It's enabled via a plugin config.
|
|
106
|
-
exports.
|
|
107
|
-
var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(editorState, editorView, initialSelectionRect, _ref2, getEditorContainerWidth, editorAnalyticsAPI) {
|
|
105
|
+
var getToolbarCellOptionsConfig = exports.getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(editorState, editorView, initialSelectionRect, _ref2, getEditorContainerWidth, editorAnalyticsAPI) {
|
|
108
106
|
var _pluginState$pluginCo, _pluginState$pluginCo2;
|
|
109
107
|
var formatMessage = _ref2.formatMessage;
|
|
110
108
|
var top = initialSelectionRect.top,
|
|
@@ -235,7 +233,7 @@ var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(editorSta
|
|
|
235
233
|
return true;
|
|
236
234
|
},
|
|
237
235
|
onClick: function onClick(state, dispatch) {
|
|
238
|
-
(0, _commandsWithAnalytics.sortColumnWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.FLOATING_TB, initialSelectionRect.left,
|
|
236
|
+
(0, _commandsWithAnalytics.sortColumnWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.FLOATING_TB, initialSelectionRect.left, _customSteps.TableSortOrder.ASC)(state, dispatch);
|
|
239
237
|
return true;
|
|
240
238
|
},
|
|
241
239
|
selected: false,
|
|
@@ -257,7 +255,7 @@ var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(editorSta
|
|
|
257
255
|
return true;
|
|
258
256
|
},
|
|
259
257
|
onClick: function onClick(state, dispatch) {
|
|
260
|
-
(0, _commandsWithAnalytics.sortColumnWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.FLOATING_TB, initialSelectionRect.left,
|
|
258
|
+
(0, _commandsWithAnalytics.sortColumnWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.FLOATING_TB, initialSelectionRect.left, _customSteps.TableSortOrder.DESC)(state, dispatch);
|
|
261
259
|
return true;
|
|
262
260
|
},
|
|
263
261
|
selected: false,
|
|
@@ -293,12 +291,11 @@ var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(editorSta
|
|
|
293
291
|
showSelected: false
|
|
294
292
|
};
|
|
295
293
|
};
|
|
296
|
-
exports.getToolbarCellOptionsConfig = getToolbarCellOptionsConfig;
|
|
297
294
|
var getClosestSelectionRect = function getClosestSelectionRect(state) {
|
|
298
295
|
var selection = state.selection;
|
|
299
296
|
return (0, _utils3.isSelectionType)(selection, 'cell') ? (0, _utils3.getSelectionRect)(selection) : (0, _utils3.findCellRectClosestToPos)(selection.$from);
|
|
300
297
|
};
|
|
301
|
-
var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth, editorAnalyticsAPI, getEditorFeatureFlags, getEditorView) {
|
|
298
|
+
var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getEditorContainerWidth, editorAnalyticsAPI, getEditorFeatureFlags, getEditorView) {
|
|
302
299
|
return function (config) {
|
|
303
300
|
return function (state, intl) {
|
|
304
301
|
var tableObject = (0, _utils3.findTable)(state.selection);
|
|
@@ -400,7 +397,6 @@ var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth, editor
|
|
|
400
397
|
};
|
|
401
398
|
};
|
|
402
399
|
};
|
|
403
|
-
exports.getToolbarConfig = getToolbarConfig;
|
|
404
400
|
var separator = function separator(hidden) {
|
|
405
401
|
return {
|
|
406
402
|
type: 'separator',
|
|
@@ -428,7 +424,7 @@ var getColorPicker = function getColorPicker(state, menu, _ref4, editorAnalytics
|
|
|
428
424
|
return [];
|
|
429
425
|
}
|
|
430
426
|
var node = targetCellPosition ? state.doc.nodeAt(targetCellPosition) : undefined;
|
|
431
|
-
var currentBackground = (node === null || node === void 0
|
|
427
|
+
var currentBackground = (node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.background) || '#ffffff';
|
|
432
428
|
var defaultPalette = _uiColor.cellBackgroundColorPalette.find(function (item) {
|
|
433
429
|
return item.value === currentBackground;
|
|
434
430
|
}) || {
|
|
@@ -19,7 +19,7 @@ var _scaleTable = require("../pm-plugins/table-resizing/utils/scale-table");
|
|
|
19
19
|
var _commonStyles = require("../ui/common-styles");
|
|
20
20
|
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; }
|
|
21
21
|
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; }
|
|
22
|
-
var updateColumnWidths = function updateColumnWidths(resizeState, table, start) {
|
|
22
|
+
var updateColumnWidths = exports.updateColumnWidths = function updateColumnWidths(resizeState, table, start) {
|
|
23
23
|
return function (tr) {
|
|
24
24
|
var map = _tableMap.TableMap.get(table);
|
|
25
25
|
var updatedCellsAttrs = {};
|
|
@@ -121,8 +121,7 @@ var updateColumnWidths = function updateColumnWidths(resizeState, table, start)
|
|
|
121
121
|
* @param view
|
|
122
122
|
* @returns Updated transaction with rescaled columns for a given table
|
|
123
123
|
*/
|
|
124
|
-
exports.
|
|
125
|
-
var rescaleColumns = function rescaleColumns(getEditorContainerWidth) {
|
|
124
|
+
var rescaleColumns = exports.rescaleColumns = function rescaleColumns(getEditorContainerWidth) {
|
|
126
125
|
return function (table, view) {
|
|
127
126
|
return function (tr) {
|
|
128
127
|
var _tableRef$parentEleme;
|
|
@@ -148,7 +147,7 @@ var rescaleColumns = function rescaleColumns(getEditorContainerWidth) {
|
|
|
148
147
|
getEditorContainerWidth: getEditorContainerWidth
|
|
149
148
|
});
|
|
150
149
|
var tableWidth = tableRef.clientWidth || _editorSharedStyles.akEditorDefaultLayoutWidth;
|
|
151
|
-
var tableMaxWidth = (tableRef === null || tableRef === void 0
|
|
150
|
+
var tableMaxWidth = (tableRef === null || tableRef === void 0 || (_tableRef$parentEleme = tableRef.parentElement) === null || _tableRef$parentEleme === void 0 ? void 0 : _tableRef$parentEleme.clientWidth) || 0;
|
|
152
151
|
tableMaxWidth -= _commonStyles.insertColumnButtonOffset;
|
|
153
152
|
var newTableMap = _tableMap.TableMap.get(newTable);
|
|
154
153
|
var noOfColumns = newTableMap.width;
|
|
@@ -204,5 +203,4 @@ var rescaleColumns = function rescaleColumns(getEditorContainerWidth) {
|
|
|
204
203
|
return updateColumnWidths(resizeState, table.node, table.start)(tr);
|
|
205
204
|
};
|
|
206
205
|
};
|
|
207
|
-
};
|
|
208
|
-
exports.rescaleColumns = rescaleColumns;
|
|
206
|
+
};
|