@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
|
@@ -1,40 +1,27 @@
|
|
|
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.updateColgroup = exports.normaliseTableLayout = exports.getTotalWidth = exports.getResizeState = exports.getNewResizeStateFromSelectedColumns = exports.evenSelectedColumnsWidths = exports.evenAllColumnsWidths = exports.bulkColumnsResize = exports.areColumnsEven = exports.adjustColumnsWidths = void 0;
|
|
9
|
-
|
|
10
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
9
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
13
|
-
|
|
14
10
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
15
|
-
|
|
16
11
|
var _colgroup = require("./colgroup");
|
|
17
|
-
|
|
18
12
|
var _columnState = require("./column-state");
|
|
19
|
-
|
|
20
13
|
var _dom = require("./dom");
|
|
21
|
-
|
|
22
14
|
var _misc = require("./misc");
|
|
23
|
-
|
|
24
15
|
var _utils2 = require("../../../utils");
|
|
25
|
-
|
|
26
16
|
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; }
|
|
27
|
-
|
|
28
17
|
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; }
|
|
29
|
-
|
|
30
18
|
var getResizeState = function getResizeState(_ref) {
|
|
31
19
|
var minWidth = _ref.minWidth,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
20
|
+
maxSize = _ref.maxSize,
|
|
21
|
+
table = _ref.table,
|
|
22
|
+
tableRef = _ref.tableRef,
|
|
23
|
+
start = _ref.start,
|
|
24
|
+
domAtPos = _ref.domAtPos;
|
|
38
25
|
if ((0, _colgroup.hasTableBeenResized)(table)) {
|
|
39
26
|
var _cols = (0, _utils.calcTableColumnWidths)(table).map(function (width, index) {
|
|
40
27
|
return {
|
|
@@ -43,17 +30,13 @@ var getResizeState = function getResizeState(_ref) {
|
|
|
43
30
|
index: index
|
|
44
31
|
};
|
|
45
32
|
});
|
|
46
|
-
|
|
47
33
|
var _widths = _cols.map(function (col) {
|
|
48
34
|
return col.width;
|
|
49
35
|
});
|
|
50
|
-
|
|
51
36
|
var _tableWidth = _widths.reduce(function (sum, width) {
|
|
52
37
|
return sum + width;
|
|
53
38
|
}, 0);
|
|
54
|
-
|
|
55
39
|
var _overflow = _tableWidth > maxSize;
|
|
56
|
-
|
|
57
40
|
return {
|
|
58
41
|
cols: _cols,
|
|
59
42
|
widths: _widths,
|
|
@@ -61,9 +44,9 @@ var getResizeState = function getResizeState(_ref) {
|
|
|
61
44
|
tableWidth: _tableWidth,
|
|
62
45
|
overflow: _overflow
|
|
63
46
|
};
|
|
64
|
-
}
|
|
65
|
-
|
|
47
|
+
}
|
|
66
48
|
|
|
49
|
+
// Getting the resize state from DOM
|
|
67
50
|
var colgroupChildren = (0, _colgroup.insertColgroupFromNode)(tableRef, table);
|
|
68
51
|
var cols = Array.from(colgroupChildren).map(function (_, index) {
|
|
69
52
|
var cellsRefs = (0, _columnState.getCellsRefsInColumn)(index, table, start, domAtPos);
|
|
@@ -83,11 +66,10 @@ var getResizeState = function getResizeState(_ref) {
|
|
|
83
66
|
tableWidth: tableWidth,
|
|
84
67
|
overflow: overflow
|
|
85
68
|
};
|
|
86
|
-
};
|
|
87
|
-
|
|
69
|
+
};
|
|
88
70
|
|
|
71
|
+
// updates Colgroup DOM node with new widths
|
|
89
72
|
exports.getResizeState = getResizeState;
|
|
90
|
-
|
|
91
73
|
var updateColgroup = function updateColgroup(state, tableRef) {
|
|
92
74
|
var cols = tableRef.querySelectorAll('col');
|
|
93
75
|
state.cols.filter(function (column) {
|
|
@@ -97,28 +79,25 @@ var updateColgroup = function updateColgroup(state, tableRef) {
|
|
|
97
79
|
if (cols[i]) {
|
|
98
80
|
cols[i].style.width = "".concat(column.width, "px");
|
|
99
81
|
}
|
|
100
|
-
});
|
|
82
|
+
});
|
|
101
83
|
|
|
84
|
+
// colgroup has updated, reflect new widths in sticky header
|
|
102
85
|
(0, _dom.syncStickyRowToTable)(tableRef);
|
|
103
86
|
};
|
|
104
|
-
|
|
105
87
|
exports.updateColgroup = updateColgroup;
|
|
106
|
-
|
|
107
88
|
var getTotalWidth = function getTotalWidth(_ref2) {
|
|
108
89
|
var cols = _ref2.cols;
|
|
109
90
|
return cols.reduce(function (totalWidth, col) {
|
|
110
91
|
return totalWidth + col.width;
|
|
111
92
|
}, 0);
|
|
112
|
-
};
|
|
113
|
-
// difference in total columns widths vs table width happens due to the "Math.floor"
|
|
114
|
-
|
|
93
|
+
};
|
|
115
94
|
|
|
95
|
+
// adjust columns to take up the total width
|
|
96
|
+
// difference in total columns widths vs table width happens due to the "Math.floor"
|
|
116
97
|
exports.getTotalWidth = getTotalWidth;
|
|
117
|
-
|
|
118
98
|
var adjustColumnsWidths = function adjustColumnsWidths(resizeState, maxSize) {
|
|
119
99
|
var totalWidth = getTotalWidth(resizeState);
|
|
120
100
|
var diff = maxSize - totalWidth;
|
|
121
|
-
|
|
122
101
|
if (diff > 0 || diff < 0 && Math.abs(diff) < _styles.tableCellMinWidth) {
|
|
123
102
|
var updated = false;
|
|
124
103
|
return _objectSpread(_objectSpread({}, resizeState), {}, {
|
|
@@ -129,17 +108,13 @@ var adjustColumnsWidths = function adjustColumnsWidths(resizeState, maxSize) {
|
|
|
129
108
|
width: col.width + diff
|
|
130
109
|
});
|
|
131
110
|
}
|
|
132
|
-
|
|
133
111
|
return col;
|
|
134
112
|
})
|
|
135
113
|
});
|
|
136
114
|
}
|
|
137
|
-
|
|
138
115
|
return resizeState;
|
|
139
116
|
};
|
|
140
|
-
|
|
141
117
|
exports.adjustColumnsWidths = adjustColumnsWidths;
|
|
142
|
-
|
|
143
118
|
var evenAllColumnsWidths = function evenAllColumnsWidths(resizeState) {
|
|
144
119
|
var maxSize = getTotalWidth(resizeState);
|
|
145
120
|
var evenWidth = Math.floor(maxSize / resizeState.cols.length);
|
|
@@ -152,9 +127,7 @@ var evenAllColumnsWidths = function evenAllColumnsWidths(resizeState) {
|
|
|
152
127
|
cols: cols
|
|
153
128
|
}), maxSize);
|
|
154
129
|
};
|
|
155
|
-
|
|
156
130
|
exports.evenAllColumnsWidths = evenAllColumnsWidths;
|
|
157
|
-
|
|
158
131
|
var getSpace = function getSpace(columns, start, end) {
|
|
159
132
|
return columns.slice(start, end).map(function (col) {
|
|
160
133
|
return col.width;
|
|
@@ -162,15 +135,15 @@ var getSpace = function getSpace(columns, start, end) {
|
|
|
162
135
|
return sum + width;
|
|
163
136
|
}, 0);
|
|
164
137
|
};
|
|
165
|
-
|
|
166
138
|
var evenSelectedColumnsWidths = function evenSelectedColumnsWidths(resizeState, rect) {
|
|
167
139
|
var cols = resizeState.cols;
|
|
168
140
|
var selectedSpace = getSpace(cols, rect.left, rect.right);
|
|
169
141
|
var allSpace = getSpace(cols, 0, cols.length);
|
|
170
142
|
var allWidth = allSpace / cols.length;
|
|
171
|
-
var width = selectedSpace / (rect.right - rect.left);
|
|
172
|
-
// unset widths of all columns
|
|
143
|
+
var width = selectedSpace / (rect.right - rect.left);
|
|
173
144
|
|
|
145
|
+
// Result equals even distribution of all columns -
|
|
146
|
+
// unset widths of all columns
|
|
174
147
|
if (allWidth === width) {
|
|
175
148
|
return _objectSpread(_objectSpread({}, resizeState), {}, {
|
|
176
149
|
widths: cols.map(function () {
|
|
@@ -183,7 +156,6 @@ var evenSelectedColumnsWidths = function evenSelectedColumnsWidths(resizeState,
|
|
|
183
156
|
})
|
|
184
157
|
});
|
|
185
158
|
}
|
|
186
|
-
|
|
187
159
|
return _objectSpread(_objectSpread({}, resizeState), {}, {
|
|
188
160
|
widths: cols.map(function (col, i) {
|
|
189
161
|
return i >= rect.left && i < rect.right ? width : col.width;
|
|
@@ -195,9 +167,7 @@ var evenSelectedColumnsWidths = function evenSelectedColumnsWidths(resizeState,
|
|
|
195
167
|
})
|
|
196
168
|
});
|
|
197
169
|
};
|
|
198
|
-
|
|
199
170
|
exports.evenSelectedColumnsWidths = evenSelectedColumnsWidths;
|
|
200
|
-
|
|
201
171
|
var bulkColumnsResize = function bulkColumnsResize(resizeState, columnsIndexes, sourceColumnIndex) {
|
|
202
172
|
var currentTableWidth = getTotalWidth(resizeState);
|
|
203
173
|
var colIndex = columnsIndexes.indexOf(sourceColumnIndex) > -1 ? sourceColumnIndex : sourceColumnIndex + 1;
|
|
@@ -207,31 +177,26 @@ var bulkColumnsResize = function bulkColumnsResize(resizeState, columnsIndexes,
|
|
|
207
177
|
var cols = resizeState.cols.map(function (col) {
|
|
208
178
|
if (columnsIndexes.indexOf(col.index) > -1) {
|
|
209
179
|
var diff = col.width - sourceCol.width;
|
|
210
|
-
|
|
211
180
|
if (diff !== 0) {
|
|
212
181
|
widthsDiffs.push(diff);
|
|
213
182
|
}
|
|
214
|
-
|
|
215
183
|
return _objectSpread(_objectSpread({}, col), {}, {
|
|
216
184
|
width: sourceCol.width
|
|
217
185
|
});
|
|
218
186
|
}
|
|
219
|
-
|
|
220
187
|
return col;
|
|
221
188
|
});
|
|
222
|
-
|
|
223
189
|
var newState = _objectSpread(_objectSpread({}, resizeState), {}, {
|
|
224
190
|
cols: cols.map(function (col) {
|
|
225
|
-
if (columnsIndexes.indexOf(col.index) > -1 ||
|
|
191
|
+
if (columnsIndexes.indexOf(col.index) > -1 ||
|
|
192
|
+
// take from prev columns only if dragging the first handle to the left
|
|
226
193
|
columnsIndexes.indexOf(sourceColumnIndex) > -1 && col.index < colIndex) {
|
|
227
194
|
return col;
|
|
228
195
|
}
|
|
229
|
-
|
|
230
196
|
while (widthsDiffs.length) {
|
|
231
197
|
var diff = widthsDiffs.shift() || 0;
|
|
232
198
|
var column = seenColumns[col.index] || col;
|
|
233
199
|
var maybeWidth = column.width + diff;
|
|
234
|
-
|
|
235
200
|
if (maybeWidth > column.minWidth) {
|
|
236
201
|
seenColumns[column.index] = _objectSpread(_objectSpread({}, column), {}, {
|
|
237
202
|
width: maybeWidth
|
|
@@ -244,21 +209,21 @@ var bulkColumnsResize = function bulkColumnsResize(resizeState, columnsIndexes,
|
|
|
244
209
|
break;
|
|
245
210
|
}
|
|
246
211
|
}
|
|
247
|
-
|
|
248
212
|
return seenColumns[col.index] || col;
|
|
249
213
|
})
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
var minTableWidth = resizeState.maxSize; // new table widths after bulk resize
|
|
254
|
-
|
|
255
|
-
var newTotalWidth = getTotalWidth(newState); // when all columns are selected, what do we do when sum of columns widths is lower than min possible table widths?
|
|
214
|
+
});
|
|
256
215
|
|
|
216
|
+
// minimum possible table widths at the current layout
|
|
217
|
+
var minTableWidth = resizeState.maxSize;
|
|
218
|
+
// new table widths after bulk resize
|
|
219
|
+
var newTotalWidth = getTotalWidth(newState);
|
|
220
|
+
// when all columns are selected, what do we do when sum of columns widths is lower than min possible table widths?
|
|
257
221
|
if (columnsIndexes.length === resizeState.cols.length && newTotalWidth < minTableWidth) {
|
|
258
222
|
// table is not in overflow -> normal resize of a single column
|
|
259
223
|
if (currentTableWidth === minTableWidth) {
|
|
260
224
|
return resizeState;
|
|
261
|
-
}
|
|
225
|
+
}
|
|
226
|
+
// table is in overflow: keep the dragged column at its widths and evenly distribute columns
|
|
262
227
|
// to recover from overflow state
|
|
263
228
|
else {
|
|
264
229
|
var columnWidth = Math.floor((minTableWidth - sourceCol.width) / (newState.cols.length - 1));
|
|
@@ -267,63 +232,51 @@ var bulkColumnsResize = function bulkColumnsResize(resizeState, columnsIndexes,
|
|
|
267
232
|
if (col.index === sourceCol.index) {
|
|
268
233
|
return col;
|
|
269
234
|
}
|
|
270
|
-
|
|
271
235
|
return _objectSpread(_objectSpread({}, col), {}, {
|
|
272
236
|
width: columnWidth
|
|
273
237
|
});
|
|
274
238
|
})
|
|
275
239
|
});
|
|
276
240
|
}
|
|
277
|
-
}
|
|
278
|
-
|
|
241
|
+
}
|
|
279
242
|
|
|
243
|
+
// fix total table widths by adding missing pixels to columns widths here and there
|
|
280
244
|
return adjustColumnsWidths(newState, resizeState.maxSize);
|
|
281
245
|
};
|
|
282
|
-
|
|
283
246
|
exports.bulkColumnsResize = bulkColumnsResize;
|
|
284
|
-
|
|
285
247
|
var areColumnsEven = function areColumnsEven(resizeState) {
|
|
286
248
|
var newResizeState = evenAllColumnsWidths(resizeState);
|
|
287
249
|
return newResizeState.cols.every(function (col, i) {
|
|
288
250
|
return col.width === resizeState.cols[i].width;
|
|
289
251
|
});
|
|
290
|
-
};
|
|
291
|
-
|
|
252
|
+
};
|
|
292
253
|
|
|
254
|
+
// Get the layout
|
|
293
255
|
exports.areColumnsEven = areColumnsEven;
|
|
294
|
-
|
|
295
256
|
var normaliseTableLayout = function normaliseTableLayout(input) {
|
|
296
257
|
switch (input) {
|
|
297
258
|
case 'wide':
|
|
298
259
|
return input;
|
|
299
|
-
|
|
300
260
|
case 'full-width':
|
|
301
261
|
return input;
|
|
302
|
-
|
|
303
262
|
default:
|
|
304
263
|
return 'default';
|
|
305
264
|
}
|
|
306
265
|
};
|
|
307
|
-
|
|
308
266
|
exports.normaliseTableLayout = normaliseTableLayout;
|
|
309
|
-
|
|
310
267
|
var getNewResizeStateFromSelectedColumns = function getNewResizeStateFromSelectedColumns(rect, state, domAtPos, getEditorContainerWidth) {
|
|
311
268
|
var _getSelectedTableInfo = (0, _utils2.getSelectedTableInfo)(state.selection),
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
269
|
+
totalRowCount = _getSelectedTableInfo.totalRowCount,
|
|
270
|
+
totalColumnCount = _getSelectedTableInfo.totalColumnCount,
|
|
271
|
+
table = _getSelectedTableInfo.table;
|
|
316
272
|
if (!table) {
|
|
317
273
|
return;
|
|
318
274
|
}
|
|
319
|
-
|
|
320
275
|
var maybeTable = domAtPos(table.start).node;
|
|
321
276
|
var tableRef = maybeTable.closest('table');
|
|
322
|
-
|
|
323
277
|
if (!tableRef) {
|
|
324
278
|
return;
|
|
325
279
|
}
|
|
326
|
-
|
|
327
280
|
var layout = normaliseTableLayout(tableRef === null || tableRef === void 0 ? void 0 : tableRef.dataset.layout);
|
|
328
281
|
var maxSize = (0, _misc.getTableMaxWidth)({
|
|
329
282
|
table: table.node,
|
|
@@ -360,5 +313,4 @@ var getNewResizeStateFromSelectedColumns = function getNewResizeStateFromSelecte
|
|
|
360
313
|
}
|
|
361
314
|
};
|
|
362
315
|
};
|
|
363
|
-
|
|
364
316
|
exports.getNewResizeStateFromSelectedColumns = getNewResizeStateFromSelectedColumns;
|
|
@@ -1,32 +1,21 @@
|
|
|
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.scale = void 0;
|
|
9
8
|
exports.scaleTableTo = scaleTableTo;
|
|
10
9
|
exports.scaleWithParent = void 0;
|
|
11
|
-
|
|
12
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
|
|
14
11
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
15
|
-
|
|
16
12
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
17
|
-
|
|
18
13
|
var _utils = require("../../../utils");
|
|
19
|
-
|
|
20
14
|
var _misc = require("../utils/misc");
|
|
21
|
-
|
|
22
15
|
var _resizeLogic = require("../utils/resize-logic");
|
|
23
|
-
|
|
24
16
|
var _resizeState = require("../utils/resize-state");
|
|
25
|
-
|
|
26
17
|
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; }
|
|
27
|
-
|
|
28
18
|
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; }
|
|
29
|
-
|
|
30
19
|
// Base function to trigger the actual scale on a table node.
|
|
31
20
|
// Will only resize/scale if a table has been previously resized.
|
|
32
21
|
var scale = function scale(tableRef, options, domAtPos) {
|
|
@@ -34,13 +23,14 @@ var scale = function scale(tableRef, options, domAtPos) {
|
|
|
34
23
|
* isBreakoutEnabled === true -> default center aligned
|
|
35
24
|
* isBreakoutEnabled === false -> full width mode
|
|
36
25
|
*/
|
|
26
|
+
|
|
37
27
|
var node = options.node,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
28
|
+
containerWidth = options.containerWidth,
|
|
29
|
+
previousContainerWidth = options.previousContainerWidth,
|
|
30
|
+
prevNode = options.prevNode,
|
|
31
|
+
start = options.start,
|
|
32
|
+
isBreakoutEnabled = options.isBreakoutEnabled,
|
|
33
|
+
layoutChanged = options.layoutChanged;
|
|
44
34
|
var maxSize = (0, _misc.getLayoutSize)(node.attrs.layout, containerWidth, {
|
|
45
35
|
isBreakoutEnabled: isBreakoutEnabled
|
|
46
36
|
});
|
|
@@ -48,14 +38,13 @@ var scale = function scale(tableRef, options, domAtPos) {
|
|
|
48
38
|
var previousMaxSize = (0, _misc.getLayoutSize)(prevNode.attrs.layout, previousContainerWidth, {
|
|
49
39
|
isBreakoutEnabled: isBreakoutEnabled
|
|
50
40
|
});
|
|
51
|
-
var newWidth = maxSize;
|
|
41
|
+
var newWidth = maxSize;
|
|
52
42
|
|
|
43
|
+
// adjust table width if layout is updated
|
|
53
44
|
var hasOverflow = prevTableWidth > previousMaxSize;
|
|
54
|
-
|
|
55
45
|
if (layoutChanged && hasOverflow) {
|
|
56
46
|
// No keep overflow if the old content can be in the new size
|
|
57
47
|
var canFitInNewSize = prevTableWidth < maxSize;
|
|
58
|
-
|
|
59
48
|
if (canFitInNewSize) {
|
|
60
49
|
newWidth = maxSize;
|
|
61
50
|
} else {
|
|
@@ -64,11 +53,9 @@ var scale = function scale(tableRef, options, domAtPos) {
|
|
|
64
53
|
newWidth = Math.floor(newWidth * overflowScale);
|
|
65
54
|
}
|
|
66
55
|
}
|
|
67
|
-
|
|
68
56
|
if (node.attrs.isNumberColumnEnabled) {
|
|
69
57
|
newWidth -= _editorSharedStyles.akEditorTableNumberColumnWidth;
|
|
70
58
|
}
|
|
71
|
-
|
|
72
59
|
var resizeState = (0, _resizeState.getResizeState)({
|
|
73
60
|
minWidth: _styles.tableCellMinWidth,
|
|
74
61
|
maxSize: maxSize,
|
|
@@ -79,9 +66,7 @@ var scale = function scale(tableRef, options, domAtPos) {
|
|
|
79
66
|
});
|
|
80
67
|
return scaleTableTo(resizeState, newWidth);
|
|
81
68
|
};
|
|
82
|
-
|
|
83
69
|
exports.scale = scale;
|
|
84
|
-
|
|
85
70
|
var scaleWithParent = function scaleWithParent(tableRef, parentWidth, table, start, domAtPos) {
|
|
86
71
|
var resizeState = (0, _resizeState.getResizeState)({
|
|
87
72
|
minWidth: _styles.tableCellMinWidth,
|
|
@@ -91,42 +76,33 @@ var scaleWithParent = function scaleWithParent(tableRef, parentWidth, table, sta
|
|
|
91
76
|
start: start,
|
|
92
77
|
domAtPos: domAtPos
|
|
93
78
|
});
|
|
94
|
-
|
|
95
79
|
if (table.attrs.isNumberColumnEnabled) {
|
|
96
80
|
parentWidth -= _editorSharedStyles.akEditorTableNumberColumnWidth;
|
|
97
81
|
}
|
|
98
|
-
|
|
99
82
|
return scaleTableTo(resizeState, Math.floor(parentWidth));
|
|
100
|
-
};
|
|
101
|
-
|
|
83
|
+
};
|
|
102
84
|
|
|
85
|
+
// Scales the table to a given size and updates its colgroup DOM node
|
|
103
86
|
exports.scaleWithParent = scaleWithParent;
|
|
104
|
-
|
|
105
87
|
function scaleTableTo(state, maxSize) {
|
|
106
88
|
var scaleFactor = maxSize / (0, _resizeState.getTotalWidth)(state);
|
|
107
|
-
|
|
108
89
|
var newState = _objectSpread(_objectSpread({}, state), {}, {
|
|
109
90
|
maxSize: maxSize,
|
|
110
91
|
cols: state.cols.map(function (col) {
|
|
111
92
|
var minWidth = col.minWidth,
|
|
112
|
-
|
|
93
|
+
width = col.width;
|
|
113
94
|
var newColWidth = Math.floor(width * scaleFactor);
|
|
114
|
-
|
|
115
95
|
if (newColWidth < minWidth) {
|
|
116
96
|
newColWidth = minWidth;
|
|
117
97
|
}
|
|
118
|
-
|
|
119
98
|
return _objectSpread(_objectSpread({}, col), {}, {
|
|
120
99
|
width: newColWidth
|
|
121
100
|
});
|
|
122
101
|
})
|
|
123
102
|
});
|
|
124
|
-
|
|
125
103
|
var newTotalWidth = (0, _resizeState.getTotalWidth)(newState);
|
|
126
|
-
|
|
127
104
|
if (newTotalWidth > maxSize) {
|
|
128
105
|
newState = (0, _resizeLogic.reduceSpace)(newState, newTotalWidth - maxSize);
|
|
129
106
|
}
|
|
130
|
-
|
|
131
107
|
return (0, _resizeState.adjustColumnsWidths)(newState, maxSize);
|
|
132
108
|
}
|
|
@@ -5,19 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
exports.tableSelectionKeymapPlugin = tableSelectionKeymapPlugin;
|
|
8
|
-
|
|
9
8
|
var _prosemirrorKeymap = require("prosemirror-keymap");
|
|
10
|
-
|
|
11
9
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
12
|
-
|
|
13
10
|
var _selection = require("../commands/selection");
|
|
14
|
-
|
|
15
11
|
function tableSelectionKeymapPlugin(editorSelectionAPI) {
|
|
16
12
|
var list = {};
|
|
17
13
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveRight.common, (0, _selection.arrowRightFromTable)(editorSelectionAPI)(), list);
|
|
18
14
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveLeft.common, (0, _selection.arrowLeftFromTable)(editorSelectionAPI)(), list);
|
|
19
15
|
return (0, _prosemirrorKeymap.keymap)(list);
|
|
20
16
|
}
|
|
21
|
-
|
|
22
17
|
var _default = tableSelectionKeymapPlugin;
|
|
23
18
|
exports.default = _default;
|
|
@@ -1,71 +1,54 @@
|
|
|
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.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
9
|
var _defaultTableSelection = require("./pm-plugins/default-table-selection");
|
|
13
|
-
|
|
14
10
|
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; }
|
|
15
|
-
|
|
16
11
|
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; }
|
|
17
|
-
|
|
18
12
|
var _default = function _default(pluginState, action) {
|
|
19
13
|
switch (action.type) {
|
|
20
14
|
case 'TOGGLE_HEADER_COLUMN':
|
|
21
15
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
22
16
|
isHeaderColumnEnabled: !pluginState.isHeaderColumnEnabled
|
|
23
17
|
});
|
|
24
|
-
|
|
25
18
|
case 'TOGGLE_HEADER_ROW':
|
|
26
19
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
27
20
|
isHeaderRowEnabled: !pluginState.isHeaderRowEnabled
|
|
28
21
|
});
|
|
29
|
-
|
|
30
22
|
case 'CLEAR_HOVER_SELECTION':
|
|
31
23
|
return _objectSpread(_objectSpread(_objectSpread({}, pluginState), action.data), _defaultTableSelection.defaultTableSelection);
|
|
32
|
-
|
|
33
24
|
case 'SELECT_COLUMN':
|
|
34
25
|
return _objectSpread(_objectSpread(_objectSpread({}, pluginState), action.data), {}, {
|
|
35
26
|
isContextualMenuOpen: false
|
|
36
27
|
});
|
|
37
|
-
|
|
38
28
|
case 'SET_TARGET_CELL_POSITION':
|
|
39
29
|
return _objectSpread(_objectSpread(_objectSpread({}, pluginState), action.data), {}, {
|
|
40
30
|
isContextualMenuOpen: false
|
|
41
31
|
});
|
|
42
|
-
|
|
43
32
|
case 'SET_TABLE_LAYOUT':
|
|
44
33
|
return _objectSpread(_objectSpread({}, pluginState), action.data);
|
|
45
|
-
|
|
46
34
|
case 'TOGGLE_CONTEXTUAL_MENU':
|
|
47
35
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
48
36
|
isContextualMenuOpen: !pluginState.isContextualMenuOpen
|
|
49
37
|
});
|
|
50
|
-
|
|
51
38
|
case 'SHOW_INSERT_ROW_BUTTON':
|
|
52
39
|
if (action.data.insertRowButtonIndex === pluginState.insertRowButtonIndex) {
|
|
53
40
|
return pluginState;
|
|
54
41
|
}
|
|
55
|
-
|
|
56
42
|
return _objectSpread(_objectSpread(_objectSpread({}, pluginState), action.data), {}, {
|
|
57
43
|
insertColumnButtonIndex: undefined // We need to assure that column is not shown
|
|
58
|
-
|
|
59
44
|
});
|
|
60
45
|
|
|
61
46
|
case 'SHOW_INSERT_COLUMN_BUTTON':
|
|
62
47
|
if (action.data.insertColumnButtonIndex === pluginState.insertColumnButtonIndex) {
|
|
63
48
|
return pluginState;
|
|
64
49
|
}
|
|
65
|
-
|
|
66
50
|
return _objectSpread(_objectSpread(_objectSpread({}, pluginState), action.data), {}, {
|
|
67
51
|
insertRowButtonIndex: undefined // We need to assure that row is not shown
|
|
68
|
-
|
|
69
52
|
});
|
|
70
53
|
|
|
71
54
|
case 'HIDE_INSERT_COLUMN_OR_ROW_BUTTON':
|
|
@@ -75,22 +58,17 @@ var _default = function _default(pluginState, action) {
|
|
|
75
58
|
insertColumnButtonIndex: undefined
|
|
76
59
|
});
|
|
77
60
|
}
|
|
78
|
-
|
|
79
61
|
return pluginState;
|
|
80
|
-
|
|
81
62
|
case 'HIDE_RESIZE_HANDLE_LINE':
|
|
82
63
|
return _objectSpread(_objectSpread(_objectSpread({}, pluginState), action.data), {}, {
|
|
83
64
|
resizeHandleColumnIndex: undefined,
|
|
84
65
|
resizeHandleRowIndex: undefined
|
|
85
66
|
});
|
|
86
|
-
|
|
87
67
|
case 'ADD_RESIZE_HANDLE_DECORATIONS':
|
|
88
68
|
if (action.data.resizeHandleColumnIndex === pluginState.resizeHandleColumnIndex && action.data.resizeHandleRowIndex === pluginState.resizeHandleRowIndex) {
|
|
89
69
|
return pluginState;
|
|
90
70
|
}
|
|
91
|
-
|
|
92
71
|
return _objectSpread(_objectSpread({}, pluginState), action.data);
|
|
93
|
-
|
|
94
72
|
case 'SET_TABLE_REF':
|
|
95
73
|
case 'HOVER_ROWS':
|
|
96
74
|
case 'HOVER_COLUMNS':
|
|
@@ -99,10 +77,8 @@ var _default = function _default(pluginState, action) {
|
|
|
99
77
|
case 'SHOW_RESIZE_HANDLE_LINE':
|
|
100
78
|
case 'SET_EDITOR_FOCUS':
|
|
101
79
|
return _objectSpread(_objectSpread({}, pluginState), action.data);
|
|
102
|
-
|
|
103
80
|
default:
|
|
104
81
|
return pluginState;
|
|
105
82
|
}
|
|
106
83
|
};
|
|
107
|
-
|
|
108
84
|
exports.default = _default;
|