@atlaskit/editor-plugin-table 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/plugins/table/commands/clear.js +4 -16
- package/dist/cjs/plugins/table/commands/collapse.js +0 -6
- package/dist/cjs/plugins/table/commands/go-to-next-cell.js +7 -18
- package/dist/cjs/plugins/table/commands/hover.js +7 -37
- package/dist/cjs/plugins/table/commands/index.js +0 -8
- package/dist/cjs/plugins/table/commands/insert.js +17 -56
- package/dist/cjs/plugins/table/commands/misc.js +36 -132
- package/dist/cjs/plugins/table/commands/referentiality.js +0 -4
- package/dist/cjs/plugins/table/commands/selection.js +21 -87
- package/dist/cjs/plugins/table/commands/sort.js +2 -23
- package/dist/cjs/plugins/table/commands/split-cell.js +3 -11
- package/dist/cjs/plugins/table/commands/toggle.js +8 -34
- package/dist/cjs/plugins/table/commands-with-analytics.js +50 -139
- package/dist/cjs/plugins/table/create-plugin-config.js +0 -6
- package/dist/cjs/plugins/table/event-handlers.js +58 -160
- package/dist/cjs/plugins/table/handlers.js +10 -39
- package/dist/cjs/plugins/table/index.js +47 -91
- package/dist/cjs/plugins/table/nodeviews/OverflowShadowsObserver.js +8 -41
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +82 -188
- package/dist/cjs/plugins/table/nodeviews/table.js +12 -70
- package/dist/cjs/plugins/table/nodeviews/tableCell.js +15 -39
- package/dist/cjs/plugins/table/nodeviews/update-overflow-shadows.js +3 -15
- package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +0 -18
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +8 -27
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-resizing.js +8 -20
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/compose-decorations.js +1 -3
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/index.js +0 -3
- package/dist/cjs/plugins/table/pm-plugins/keymap.js +2 -15
- package/dist/cjs/plugins/table/pm-plugins/main.js +20 -72
- package/dist/cjs/plugins/table/pm-plugins/plugin-factory.js +25 -42
- package/dist/cjs/plugins/table/pm-plugins/plugin-key.js +0 -2
- package/dist/cjs/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +8 -8
- package/dist/cjs/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +4 -23
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/commands.js +0 -5
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/index.js +0 -5
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +4 -13
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +56 -138
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin-key.js +0 -2
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin-state.js +15 -30
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin.js +0 -6
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/util.js +0 -5
- package/dist/cjs/plugins/table/pm-plugins/table-local-id.js +13 -44
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/commands.js +12 -42
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +16 -52
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/index.js +0 -4
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin-factory.js +0 -10
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin-key.js +0 -2
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin.js +5 -19
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/reducer.js +0 -10
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +0 -15
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/column-state.js +8 -28
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/content-width.js +3 -23
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/dom.js +4 -46
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/index.js +0 -9
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/misc.js +15 -36
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-column.js +1 -4
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +15 -71
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +34 -82
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +12 -36
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.js +0 -2
- package/dist/cjs/plugins/table/pm-plugins/table-selection-keymap.js +0 -5
- package/dist/cjs/plugins/table/reducer.js +0 -24
- package/dist/cjs/plugins/table/toolbar.js +14 -94
- package/dist/cjs/plugins/table/transforms/column-width.js +12 -45
- package/dist/cjs/plugins/table/transforms/delete-columns.js +11 -76
- package/dist/cjs/plugins/table/transforms/delete-rows.js +4 -42
- package/dist/cjs/plugins/table/transforms/fix-tables.js +24 -61
- package/dist/cjs/plugins/table/transforms/index.js +0 -7
- package/dist/cjs/plugins/table/transforms/merge.js +14 -90
- package/dist/cjs/plugins/table/transforms/metadata.js +0 -5
- package/dist/cjs/plugins/table/transforms/replace-table.js +2 -13
- package/dist/cjs/plugins/table/transforms/split.js +18 -32
- package/dist/cjs/plugins/table/types.js +0 -11
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +10 -51
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/styles.js +0 -12
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +46 -145
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/index.js +12 -35
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/styles.js +0 -11
- package/dist/cjs/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +5 -12
- package/dist/cjs/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +3 -16
- package/dist/cjs/plugins/table/ui/FloatingDeleteButton/index.js +19 -89
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/InsertButton.js +6 -31
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +5 -22
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +25 -80
- package/dist/cjs/plugins/table/ui/LayoutButton/index.js +16 -64
- package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +14 -47
- package/dist/cjs/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +20 -48
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/index.js +10 -43
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +33 -74
- package/dist/cjs/plugins/table/ui/common-styles.js +6 -19
- package/dist/cjs/plugins/table/ui/consts.js +3 -8
- package/dist/cjs/plugins/table/ui/messages.js +0 -3
- package/dist/cjs/plugins/table/ui/ui-styles.js +0 -32
- package/dist/cjs/plugins/table/utils/analytics.js +4 -19
- package/dist/cjs/plugins/table/utils/collapse.js +4 -21
- package/dist/cjs/plugins/table/utils/column-controls.js +25 -61
- package/dist/cjs/plugins/table/utils/decoration.js +46 -114
- package/dist/cjs/plugins/table/utils/dom.js +4 -51
- package/dist/cjs/plugins/table/utils/get-allow-add-column-custom-step.js +0 -2
- package/dist/cjs/plugins/table/utils/index.js +0 -10
- package/dist/cjs/plugins/table/utils/nodes.js +5 -48
- package/dist/cjs/plugins/table/utils/paste.js +22 -47
- package/dist/cjs/plugins/table/utils/row-controls.js +6 -67
- package/dist/cjs/plugins/table/utils/selection.js +3 -36
- package/dist/cjs/plugins/table/utils/table.js +0 -11
- package/dist/cjs/plugins/table/utils/update-plugin-state-decorations.js +0 -4
- package/dist/cjs/plugins/table-plugin.js +0 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/table/commands/clear.js +3 -8
- package/dist/es2019/plugins/table/commands/collapse.js +0 -3
- package/dist/es2019/plugins/table/commands/go-to-next-cell.js +4 -7
- package/dist/es2019/plugins/table/commands/hover.js +7 -17
- package/dist/es2019/plugins/table/commands/insert.js +16 -36
- package/dist/es2019/plugins/table/commands/misc.js +37 -67
- package/dist/es2019/plugins/table/commands/selection.js +7 -62
- package/dist/es2019/plugins/table/commands/sort.js +0 -12
- package/dist/es2019/plugins/table/commands/split-cell.js +0 -4
- package/dist/es2019/plugins/table/commands/toggle.js +13 -15
- package/dist/es2019/plugins/table/commands-with-analytics.js +4 -14
- package/dist/es2019/plugins/table/event-handlers.js +14 -62
- package/dist/es2019/plugins/table/handlers.js +16 -26
- package/dist/es2019/plugins/table/index.js +12 -25
- package/dist/es2019/plugins/table/nodeviews/OverflowShadowsObserver.js +8 -40
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +27 -100
- package/dist/es2019/plugins/table/nodeviews/table.js +3 -33
- package/dist/es2019/plugins/table/nodeviews/tableCell.js +7 -16
- package/dist/es2019/plugins/table/nodeviews/update-overflow-shadows.js +3 -10
- package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +0 -5
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +4 -13
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-resizing.js +0 -3
- package/dist/es2019/plugins/table/pm-plugins/keymap.js +2 -3
- package/dist/es2019/plugins/table/pm-plugins/main.js +19 -43
- package/dist/es2019/plugins/table/pm-plugins/plugin-factory.js +2 -6
- package/dist/es2019/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +8 -3
- package/dist/es2019/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +0 -12
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +4 -9
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +55 -130
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/plugin-state.js +2 -9
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/util.js +0 -3
- package/dist/es2019/plugins/table/pm-plugins/table-local-id.js +20 -39
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/commands.js +7 -15
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +9 -27
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/plugin-factory.js +2 -4
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/plugin.js +2 -5
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/reducer.js +8 -8
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +0 -4
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/column-state.js +8 -11
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/content-width.js +4 -21
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/dom.js +3 -22
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/misc.js +10 -18
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +29 -59
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +54 -51
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +9 -14
- package/dist/es2019/plugins/table/reducer.js +26 -30
- package/dist/es2019/plugins/table/toolbar.js +5 -48
- package/dist/es2019/plugins/table/transforms/column-width.js +16 -28
- package/dist/es2019/plugins/table/transforms/delete-columns.js +17 -58
- package/dist/es2019/plugins/table/transforms/delete-rows.js +8 -25
- package/dist/es2019/plugins/table/transforms/fix-tables.js +25 -42
- package/dist/es2019/plugins/table/transforms/merge.js +22 -70
- package/dist/es2019/plugins/table/transforms/metadata.js +3 -2
- package/dist/es2019/plugins/table/transforms/replace-table.js +0 -2
- package/dist/es2019/plugins/table/transforms/split.js +16 -19
- package/dist/es2019/plugins/table/types.js +2 -4
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +2 -16
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +8 -54
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/index.js +4 -13
- package/dist/es2019/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +0 -2
- package/dist/es2019/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +2 -11
- package/dist/es2019/plugins/table/ui/FloatingDeleteButton/index.js +13 -49
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/InsertButton.js +0 -8
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +16 -24
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +3 -31
- package/dist/es2019/plugins/table/ui/LayoutButton/index.js +2 -29
- package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/index.js +0 -12
- package/dist/es2019/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +6 -12
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/index.js +0 -9
- package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +4 -19
- package/dist/es2019/plugins/table/ui/common-styles.js +6 -5
- package/dist/es2019/plugins/table/ui/consts.js +4 -3
- package/dist/es2019/plugins/table/ui/ui-styles.js +0 -10
- package/dist/es2019/plugins/table/utils/analytics.js +0 -8
- package/dist/es2019/plugins/table/utils/collapse.js +3 -14
- package/dist/es2019/plugins/table/utils/column-controls.js +22 -37
- package/dist/es2019/plugins/table/utils/decoration.js +13 -51
- package/dist/es2019/plugins/table/utils/dom.js +3 -19
- package/dist/es2019/plugins/table/utils/nodes.js +2 -15
- package/dist/es2019/plugins/table/utils/paste.js +17 -22
- package/dist/es2019/plugins/table/utils/row-controls.js +12 -45
- package/dist/es2019/plugins/table/utils/selection.js +0 -21
- package/dist/es2019/plugins/table/utils/table.js +0 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/table/commands/clear.js +3 -8
- package/dist/esm/plugins/table/commands/collapse.js +0 -3
- package/dist/esm/plugins/table/commands/go-to-next-cell.js +6 -9
- package/dist/esm/plugins/table/commands/hover.js +8 -18
- package/dist/esm/plugins/table/commands/insert.js +16 -36
- package/dist/esm/plugins/table/commands/misc.js +39 -78
- package/dist/esm/plugins/table/commands/selection.js +21 -78
- package/dist/esm/plugins/table/commands/sort.js +2 -14
- package/dist/esm/plugins/table/commands/split-cell.js +3 -8
- package/dist/esm/plugins/table/commands/toggle.js +11 -20
- package/dist/esm/plugins/table/commands-with-analytics.js +50 -85
- package/dist/esm/plugins/table/create-plugin-config.js +0 -3
- package/dist/esm/plugins/table/event-handlers.js +58 -123
- package/dist/esm/plugins/table/handlers.js +11 -29
- package/dist/esm/plugins/table/index.js +47 -60
- package/dist/esm/plugins/table/nodeviews/OverflowShadowsObserver.js +8 -44
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +82 -181
- package/dist/esm/plugins/table/nodeviews/table.js +12 -52
- package/dist/esm/plugins/table/nodeviews/tableCell.js +15 -33
- package/dist/esm/plugins/table/nodeviews/update-overflow-shadows.js +3 -10
- package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +0 -5
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +8 -19
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-resizing.js +8 -13
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/compose-decorations.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/keymap.js +2 -3
- package/dist/esm/plugins/table/pm-plugins/main.js +20 -47
- package/dist/esm/plugins/table/pm-plugins/plugin-factory.js +25 -37
- package/dist/esm/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +8 -3
- package/dist/esm/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +3 -15
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +4 -9
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +58 -147
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/plugin-state.js +15 -27
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/util.js +0 -3
- package/dist/esm/plugins/table/pm-plugins/table-local-id.js +14 -37
- package/dist/esm/plugins/table/pm-plugins/table-resizing/commands.js +12 -24
- package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +16 -36
- package/dist/esm/plugins/table/pm-plugins/table-resizing/plugin-factory.js +0 -6
- package/dist/esm/plugins/table/pm-plugins/table-resizing/plugin.js +5 -8
- package/dist/esm/plugins/table/pm-plugins/table-resizing/reducer.js +0 -7
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +0 -4
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/column-state.js +8 -12
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/content-width.js +5 -22
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/dom.js +4 -23
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/misc.js +15 -23
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +15 -60
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +34 -55
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +12 -24
- package/dist/esm/plugins/table/reducer.js +0 -20
- package/dist/esm/plugins/table/toolbar.js +13 -63
- package/dist/esm/plugins/table/transforms/column-width.js +12 -32
- package/dist/esm/plugins/table/transforms/delete-columns.js +11 -62
- package/dist/esm/plugins/table/transforms/delete-rows.js +4 -30
- package/dist/esm/plugins/table/transforms/fix-tables.js +24 -49
- package/dist/esm/plugins/table/transforms/merge.js +16 -75
- package/dist/esm/plugins/table/transforms/metadata.js +3 -2
- package/dist/esm/plugins/table/transforms/replace-table.js +2 -6
- package/dist/esm/plugins/table/transforms/split.js +18 -29
- package/dist/esm/plugins/table/types.js +0 -6
- package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +10 -31
- package/dist/esm/plugins/table/ui/FloatingContextualButton/styles.js +0 -2
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +46 -126
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/index.js +13 -24
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/styles.js +0 -2
- package/dist/esm/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +5 -7
- package/dist/esm/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +3 -13
- package/dist/esm/plugins/table/ui/FloatingDeleteButton/index.js +19 -68
- package/dist/esm/plugins/table/ui/FloatingInsertButton/InsertButton.js +6 -14
- package/dist/esm/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +5 -18
- package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +25 -57
- package/dist/esm/plugins/table/ui/LayoutButton/index.js +16 -47
- package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/index.js +14 -35
- package/dist/esm/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +20 -38
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/index.js +10 -29
- package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +33 -62
- package/dist/esm/plugins/table/ui/common-styles.js +6 -7
- package/dist/esm/plugins/table/ui/consts.js +4 -3
- package/dist/esm/plugins/table/ui/ui-styles.js +0 -12
- package/dist/esm/plugins/table/utils/analytics.js +4 -13
- package/dist/esm/plugins/table/utils/collapse.js +4 -15
- package/dist/esm/plugins/table/utils/column-controls.js +25 -41
- package/dist/esm/plugins/table/utils/decoration.js +46 -88
- package/dist/esm/plugins/table/utils/dom.js +4 -20
- package/dist/esm/plugins/table/utils/nodes.js +5 -18
- package/dist/esm/plugins/table/utils/paste.js +24 -29
- package/dist/esm/plugins/table/utils/row-controls.js +6 -46
- package/dist/esm/plugins/table/utils/selection.js +3 -26
- package/dist/esm/plugins/table/utils/table.js +0 -2
- package/dist/esm/version.json +1 -1
- package/package.json +2 -2
- package/src/__tests__/visual-regression/cell-options-menu.ts +1 -12
|
@@ -10,70 +10,55 @@ exports.getLayoutSize = getLayoutSize;
|
|
|
10
10
|
exports.getTableMaxWidth = void 0;
|
|
11
11
|
exports.pointsAtCell = pointsAtCell;
|
|
12
12
|
exports.tableLayoutToSize = void 0;
|
|
13
|
-
|
|
14
13
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
15
|
-
|
|
16
14
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
17
|
-
|
|
18
15
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
19
|
-
|
|
20
16
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
21
|
-
|
|
22
17
|
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
23
|
-
|
|
24
18
|
var tableLayoutToSize = {
|
|
25
19
|
default: _editorSharedStyles.akEditorDefaultLayoutWidth,
|
|
26
20
|
wide: _editorSharedStyles.akEditorWideLayoutWidth,
|
|
27
21
|
'full-width': _editorSharedStyles.akEditorFullWidthLayoutWidth
|
|
28
|
-
};
|
|
22
|
+
};
|
|
29
23
|
|
|
24
|
+
// Translates named layouts in number values.
|
|
30
25
|
exports.tableLayoutToSize = tableLayoutToSize;
|
|
31
|
-
|
|
32
26
|
function getLayoutSize(tableLayout) {
|
|
33
27
|
var containerWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
34
28
|
var options = arguments.length > 2 ? arguments[2] : undefined;
|
|
35
29
|
var isFullWidthModeEnabled = options.isFullWidthModeEnabled;
|
|
36
|
-
|
|
37
30
|
if (isFullWidthModeEnabled) {
|
|
38
31
|
return containerWidth ? Math.min(containerWidth - _editorSharedStyles.akEditorGutterPadding * 2, _editorSharedStyles.akEditorFullWidthLayoutWidth) : _editorSharedStyles.akEditorFullWidthLayoutWidth;
|
|
39
32
|
}
|
|
40
|
-
|
|
41
33
|
var calculatedTableWidth = (0, _styles.calcTableWidth)(tableLayout, containerWidth, true);
|
|
42
|
-
|
|
43
34
|
if (calculatedTableWidth.endsWith('px')) {
|
|
44
35
|
return parseInt(calculatedTableWidth, 10);
|
|
45
36
|
}
|
|
46
|
-
|
|
47
37
|
if (tableLayout === 'default') {
|
|
48
38
|
return getDefaultLayoutMaxWidth(containerWidth);
|
|
49
39
|
}
|
|
50
|
-
|
|
51
40
|
return tableLayoutToSize[tableLayout] || containerWidth;
|
|
52
41
|
}
|
|
53
|
-
|
|
54
42
|
function getDefaultLayoutMaxWidth(containerWidth) {
|
|
55
43
|
return (0, _ui.mapBreakpointToLayoutMaxWidth)((0, _ui.getBreakpoint)(containerWidth));
|
|
56
|
-
}
|
|
57
|
-
|
|
44
|
+
}
|
|
58
45
|
|
|
46
|
+
// Does the current position point at a cell.
|
|
59
47
|
function pointsAtCell($pos) {
|
|
60
48
|
return $pos.parent.type.spec.tableRole === 'row' && $pos.nodeAfter;
|
|
61
|
-
}
|
|
62
|
-
|
|
49
|
+
}
|
|
63
50
|
|
|
51
|
+
// Get the current col width, handles colspan.
|
|
64
52
|
function currentColWidth(view, cellPos, _ref) {
|
|
65
53
|
var colspan = _ref.colspan,
|
|
66
|
-
|
|
54
|
+
colwidth = _ref.colwidth;
|
|
67
55
|
var width = colwidth && colwidth[colwidth.length - 1];
|
|
68
|
-
|
|
69
56
|
if (width) {
|
|
70
57
|
return width;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
58
|
+
}
|
|
59
|
+
// Not fixed, read current width from DOM
|
|
74
60
|
var domWidth = view.domAtPos(cellPos + 1).node.offsetWidth;
|
|
75
61
|
var parts = colspan || 0;
|
|
76
|
-
|
|
77
62
|
if (colwidth) {
|
|
78
63
|
for (var i = 0; i < (colspan || 0); i++) {
|
|
79
64
|
if (colwidth[i]) {
|
|
@@ -82,34 +67,28 @@ function currentColWidth(view, cellPos, _ref) {
|
|
|
82
67
|
}
|
|
83
68
|
}
|
|
84
69
|
}
|
|
85
|
-
|
|
86
70
|
return domWidth / parts;
|
|
87
|
-
}
|
|
88
|
-
|
|
71
|
+
}
|
|
89
72
|
|
|
73
|
+
// Attempts to find a parent TD/TH depending on target element.
|
|
90
74
|
function domCellAround(target) {
|
|
91
75
|
while (target && target.nodeName !== 'TD' && target.nodeName !== 'TH') {
|
|
92
76
|
target = (0, _utils.containsClassName)(target, 'ProseMirror') ? null : target.parentNode;
|
|
93
77
|
}
|
|
94
|
-
|
|
95
78
|
return target;
|
|
96
79
|
}
|
|
97
|
-
|
|
98
80
|
var getTableMaxWidth = function getTableMaxWidth(_ref2) {
|
|
99
81
|
var table = _ref2.table,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
82
|
+
tableStart = _ref2.tableStart,
|
|
83
|
+
state = _ref2.state,
|
|
84
|
+
layout = _ref2.layout,
|
|
85
|
+
getEditorContainerWidth = _ref2.getEditorContainerWidth;
|
|
104
86
|
var containerWidth = getEditorContainerWidth();
|
|
105
87
|
var parentWidth = (0, _nodeWidth.getParentNodeWidth)(tableStart, state, containerWidth);
|
|
106
88
|
var maxWidth = parentWidth || getLayoutSize(layout, containerWidth.width, {});
|
|
107
|
-
|
|
108
89
|
if (table.attrs.isNumberColumnEnabled) {
|
|
109
90
|
maxWidth -= _editorSharedStyles.akEditorTableNumberColumnWidth;
|
|
110
91
|
}
|
|
111
|
-
|
|
112
92
|
return maxWidth;
|
|
113
93
|
};
|
|
114
|
-
|
|
115
94
|
exports.getTableMaxWidth = getTableMaxWidth;
|
|
@@ -4,16 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.resizeColumn = void 0;
|
|
7
|
-
|
|
8
7
|
var _resizeLogic = require("./resize-logic");
|
|
9
|
-
|
|
10
8
|
var _resizeState = require("./resize-state");
|
|
11
|
-
|
|
12
9
|
// Resize a given column by an amount from the current state
|
|
10
|
+
|
|
13
11
|
var resizeColumn = function resizeColumn(resizeState, colIndex, amount, tableRef, selectedColumns) {
|
|
14
12
|
var newState = amount > 0 ? (0, _resizeLogic.growColumn)(resizeState, colIndex, amount, selectedColumns) : amount < 0 ? (0, _resizeLogic.shrinkColumn)(resizeState, colIndex, amount, selectedColumns) : resizeState;
|
|
15
13
|
(0, _resizeState.updateColgroup)(newState, tableRef);
|
|
16
14
|
return newState;
|
|
17
15
|
};
|
|
18
|
-
|
|
19
16
|
exports.resizeColumn = resizeColumn;
|
|
@@ -1,106 +1,80 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.growColumn = void 0;
|
|
9
8
|
exports.reduceSpace = reduceSpace;
|
|
10
9
|
exports.shrinkColumn = void 0;
|
|
11
|
-
|
|
12
10
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
-
|
|
14
11
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
15
|
-
|
|
16
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
-
|
|
18
13
|
var _columnState = require("./column-state");
|
|
19
|
-
|
|
20
14
|
var _resizeState = require("./resize-state");
|
|
21
|
-
|
|
22
15
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
|
-
|
|
24
16
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
25
|
-
|
|
26
17
|
var growColumn = function growColumn(state, colIndex, amount, selectedColumns) {
|
|
27
18
|
// can't grow if columns don't exist or it's the last column
|
|
28
19
|
if (!state.cols[colIndex] || !state.cols[colIndex + 1]) {
|
|
29
20
|
return state;
|
|
30
21
|
}
|
|
31
|
-
|
|
32
22
|
var res = moveSpaceFrom(state, colIndex + 1, colIndex, amount);
|
|
33
23
|
var remaining = amount - res.amount;
|
|
34
24
|
var newState = res.state;
|
|
35
|
-
|
|
36
25
|
if (remaining > 0) {
|
|
37
26
|
newState = stackSpace(newState, colIndex, remaining).state;
|
|
38
27
|
}
|
|
39
|
-
|
|
40
28
|
if (selectedColumns) {
|
|
41
29
|
return (0, _resizeState.bulkColumnsResize)(newState, selectedColumns, colIndex);
|
|
42
30
|
}
|
|
43
|
-
|
|
44
31
|
return newState;
|
|
45
32
|
};
|
|
46
|
-
|
|
47
33
|
exports.growColumn = growColumn;
|
|
48
|
-
|
|
49
34
|
var shrinkColumn = function shrinkColumn(state, colIndex, amount, selectedColumns) {
|
|
50
35
|
// can't shrink if columns don't exist
|
|
51
36
|
if (!state.cols[colIndex]) {
|
|
52
37
|
return state;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
38
|
+
}
|
|
39
|
+
// try to shrink dragging column by giving from the column to the right first
|
|
56
40
|
var res = moveSpaceFrom(state, colIndex, colIndex + 1, -amount);
|
|
57
41
|
var newState = res.state;
|
|
58
42
|
var isOverflownTable = (0, _resizeState.getTotalWidth)(newState) > newState.maxSize;
|
|
59
|
-
var isLastColumn = !newState.cols[colIndex + 1];
|
|
60
|
-
|
|
43
|
+
var isLastColumn = !newState.cols[colIndex + 1];
|
|
44
|
+
// stop resizing the last column once table is not overflown
|
|
61
45
|
if (isLastColumn && !isOverflownTable) {
|
|
62
46
|
return newState;
|
|
63
47
|
}
|
|
64
|
-
|
|
65
48
|
var remaining = amount + res.amount;
|
|
66
|
-
|
|
67
49
|
if (remaining < 0) {
|
|
68
50
|
newState = stackSpace(newState, colIndex + 1, remaining).state;
|
|
69
51
|
}
|
|
70
|
-
|
|
71
52
|
if (selectedColumns) {
|
|
72
53
|
return (0, _resizeState.bulkColumnsResize)(newState, selectedColumns, colIndex);
|
|
73
54
|
}
|
|
74
|
-
|
|
75
55
|
return newState;
|
|
76
56
|
};
|
|
77
|
-
|
|
78
57
|
exports.shrinkColumn = shrinkColumn;
|
|
79
|
-
|
|
80
58
|
function reduceSpace(state, amount) {
|
|
81
59
|
var ignoreCols = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
82
|
-
var remaining = amount;
|
|
83
|
-
// or nothing to resize
|
|
60
|
+
var remaining = amount;
|
|
84
61
|
|
|
62
|
+
// keep trying to resolve resize request until we run out of free space,
|
|
63
|
+
// or nothing to resize
|
|
85
64
|
var _loop = function _loop() {
|
|
86
65
|
// filter candidates only with free space
|
|
87
66
|
var candidates = state.cols.filter(function (column) {
|
|
88
67
|
return (0, _columnState.getFreeSpace)(column) && ignoreCols.indexOf(column.index) === -1;
|
|
89
68
|
});
|
|
90
|
-
|
|
91
69
|
if (candidates.length === 0) {
|
|
92
70
|
return "break";
|
|
93
71
|
}
|
|
94
|
-
|
|
95
72
|
var requestedResize = Math.floor(remaining / candidates.length);
|
|
96
|
-
|
|
97
73
|
if (requestedResize === 0) {
|
|
98
74
|
return "break";
|
|
99
75
|
}
|
|
100
|
-
|
|
101
76
|
candidates.forEach(function (candidate) {
|
|
102
77
|
var newWidth = candidate.width - requestedResize;
|
|
103
|
-
|
|
104
78
|
if (newWidth < candidate.minWidth) {
|
|
105
79
|
// If the new requested width is less than our min
|
|
106
80
|
// Calc what width we didn't use, we'll try extract that
|
|
@@ -111,7 +85,6 @@ function reduceSpace(state, amount) {
|
|
|
111
85
|
} else {
|
|
112
86
|
remaining -= requestedResize;
|
|
113
87
|
}
|
|
114
|
-
|
|
115
88
|
state = _objectSpread(_objectSpread({}, state), {}, {
|
|
116
89
|
cols: [].concat((0, _toConsumableArray2.default)(state.cols.slice(0, candidate.index)), [_objectSpread(_objectSpread({}, candidate), {}, {
|
|
117
90
|
width: newWidth
|
|
@@ -119,60 +92,48 @@ function reduceSpace(state, amount) {
|
|
|
119
92
|
});
|
|
120
93
|
});
|
|
121
94
|
};
|
|
122
|
-
|
|
123
95
|
while (remaining > 0) {
|
|
124
96
|
var _ret = _loop();
|
|
125
|
-
|
|
126
97
|
if (_ret === "break") break;
|
|
127
98
|
}
|
|
128
|
-
|
|
129
99
|
return state;
|
|
130
100
|
}
|
|
131
|
-
|
|
132
101
|
var ColType; // TODO: should handle when destIdx:
|
|
133
102
|
// - is beyond the range, and then not give it back
|
|
134
|
-
|
|
135
103
|
(function (ColType) {
|
|
136
104
|
ColType["SOURCE"] = "src";
|
|
137
105
|
ColType["DEST"] = "dest";
|
|
138
106
|
})(ColType || (ColType = {}));
|
|
139
|
-
|
|
140
107
|
function moveSpaceFrom(state, srcIdx, destIdx, amount) {
|
|
141
108
|
var useFreeSpace = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
142
109
|
var srcCol = state.cols[srcIdx];
|
|
143
110
|
var destCol = state.cols[destIdx];
|
|
144
|
-
|
|
145
111
|
if (useFreeSpace) {
|
|
146
|
-
var freeSpace = (0, _columnState.getFreeSpace)(srcCol);
|
|
147
|
-
|
|
112
|
+
var freeSpace = (0, _columnState.getFreeSpace)(srcCol);
|
|
113
|
+
// if taking more than source column's free space, only take that much
|
|
148
114
|
if (amountFor(ColType.DEST)(amount) > freeSpace) {
|
|
149
115
|
amount = amount > 0 ? freeSpace : -freeSpace;
|
|
150
116
|
}
|
|
151
|
-
}
|
|
152
|
-
|
|
117
|
+
}
|
|
153
118
|
|
|
119
|
+
// if the source column shrinks past its min size, don't give the space away
|
|
154
120
|
if (amountFor(ColType.SOURCE)(amount) < 0 && widthFor(ColType.SOURCE)(amount, srcCol, destCol) < srcCol.minWidth) {
|
|
155
121
|
amount = srcCol.width - srcCol.minWidth;
|
|
156
122
|
}
|
|
157
|
-
|
|
158
123
|
var newDest = destCol ? _objectSpread(_objectSpread({}, destCol), {}, {
|
|
159
124
|
width: widthFor(ColType.DEST)(amount, srcCol, destCol)
|
|
160
125
|
}) : undefined;
|
|
161
|
-
|
|
162
126
|
if (!newDest && amountFor(ColType.SOURCE)(amount) < 0) {
|
|
163
127
|
// non-zero-sum game, ensure that we're not removing more than the total table width either
|
|
164
128
|
var totalWidth = (0, _resizeState.getTotalWidth)(state);
|
|
165
|
-
|
|
166
129
|
if (totalWidth - srcCol.width + widthFor(ColType.SOURCE)(amount, srcCol, destCol) < state.maxSize) {
|
|
167
130
|
// would shrink table below max width, stop it
|
|
168
131
|
amount = state.maxSize - (totalWidth - srcCol.width) - srcCol.width - 1;
|
|
169
132
|
}
|
|
170
133
|
}
|
|
171
|
-
|
|
172
134
|
var newSrc = _objectSpread(_objectSpread({}, srcCol), {}, {
|
|
173
135
|
width: widthFor(ColType.SOURCE)(amount, srcCol, destCol)
|
|
174
136
|
});
|
|
175
|
-
|
|
176
137
|
var newCols = state.cols.map(function (existingCol, idx) {
|
|
177
138
|
return idx === srcIdx ? newSrc : idx === destIdx ? newDest : existingCol;
|
|
178
139
|
}).filter(Boolean);
|
|
@@ -183,14 +144,11 @@ function moveSpaceFrom(state, srcIdx, destIdx, amount) {
|
|
|
183
144
|
amount: amount
|
|
184
145
|
};
|
|
185
146
|
}
|
|
186
|
-
|
|
187
147
|
function stackSpace(state, destIdx, amount) {
|
|
188
148
|
var candidates = getCandidates(state, destIdx, amount);
|
|
189
|
-
|
|
190
149
|
var _loop2 = function _loop2() {
|
|
191
150
|
// search for most (or least) free space in candidates
|
|
192
151
|
var candidateIdx = findNextFreeColumn(candidates, amount);
|
|
193
|
-
|
|
194
152
|
if (candidateIdx === -1) {
|
|
195
153
|
// stack to the right -> growing the dragging column and go overflow
|
|
196
154
|
if (amount > 0) {
|
|
@@ -204,21 +162,18 @@ function stackSpace(state, destIdx, amount) {
|
|
|
204
162
|
remaining: amount
|
|
205
163
|
}
|
|
206
164
|
};
|
|
207
|
-
}
|
|
208
|
-
|
|
165
|
+
}
|
|
209
166
|
|
|
167
|
+
// stacking to the left, if no free space remains
|
|
210
168
|
return "break";
|
|
211
169
|
}
|
|
212
|
-
|
|
213
170
|
var column = candidates.find(function (col) {
|
|
214
171
|
return col.index === candidateIdx;
|
|
215
172
|
});
|
|
216
|
-
|
|
217
173
|
if (!column || (0, _columnState.getFreeSpace)(column) <= 0) {
|
|
218
174
|
// no more columns with free space remain
|
|
219
175
|
return "break";
|
|
220
176
|
}
|
|
221
|
-
|
|
222
177
|
var res = moveSpaceFrom(state, column.index, destIdx, amount);
|
|
223
178
|
state = res.state;
|
|
224
179
|
amount -= res.amount;
|
|
@@ -226,59 +181,48 @@ function stackSpace(state, destIdx, amount) {
|
|
|
226
181
|
return col.index !== candidateIdx;
|
|
227
182
|
});
|
|
228
183
|
};
|
|
229
|
-
|
|
230
184
|
while (candidates.length && amount) {
|
|
231
185
|
var _ret2 = _loop2();
|
|
232
|
-
|
|
233
186
|
if (_ret2 === "break") break;
|
|
234
187
|
if ((0, _typeof2.default)(_ret2) === "object") return _ret2.v;
|
|
235
188
|
}
|
|
236
|
-
|
|
237
189
|
return {
|
|
238
190
|
state: state,
|
|
239
191
|
remaining: amount
|
|
240
192
|
};
|
|
241
193
|
}
|
|
242
|
-
|
|
243
194
|
function findNextFreeColumn(columns, amount) {
|
|
244
195
|
if (columns.length === 0) {
|
|
245
196
|
return -1;
|
|
246
197
|
}
|
|
247
|
-
|
|
248
198
|
var direction = amount < 0 ? 'left' : 'right';
|
|
249
|
-
|
|
250
199
|
if (direction === 'left') {
|
|
251
200
|
columns = columns.slice().reverse();
|
|
252
201
|
}
|
|
253
|
-
|
|
254
202
|
var freeIndex = -1;
|
|
255
203
|
columns.forEach(function (column) {
|
|
256
204
|
if ((0, _columnState.getFreeSpace)(column) && freeIndex === -1) {
|
|
257
205
|
freeIndex = column.index;
|
|
258
206
|
}
|
|
259
207
|
});
|
|
260
|
-
|
|
261
208
|
if (freeIndex === -1) {
|
|
262
209
|
return -1;
|
|
263
210
|
}
|
|
264
|
-
|
|
265
211
|
return freeIndex;
|
|
266
212
|
}
|
|
267
|
-
|
|
268
213
|
function amountFor(colType) {
|
|
269
214
|
return function (amount) {
|
|
270
215
|
return colType === ColType.SOURCE ? amount > 0 ? -amount : amount : amount < 0 ? -amount : amount;
|
|
271
216
|
};
|
|
272
217
|
}
|
|
273
|
-
|
|
274
218
|
function widthFor(colType) {
|
|
275
219
|
return function (amount, srcCol, destCol) {
|
|
276
220
|
return (colType === ColType.SOURCE ? srcCol : destCol).width + amountFor(colType)(amount);
|
|
277
221
|
};
|
|
278
222
|
}
|
|
279
|
-
|
|
280
223
|
function getCandidates(state, destIdx, amount) {
|
|
281
|
-
var candidates = state.cols;
|
|
224
|
+
var candidates = state.cols;
|
|
282
225
|
|
|
226
|
+
// only consider rows after the selected column in the direction of resize
|
|
283
227
|
return amount < 0 ? candidates.slice(0, destIdx) : candidates.slice(destIdx + 1);
|
|
284
228
|
}
|