@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,22 +1,15 @@
|
|
|
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 = getPopupOptions;
|
|
9
|
-
|
|
10
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
9
|
var _consts = require("../consts");
|
|
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 DELETE_BUTTON_CONTROLS_OFFSET = _consts.tableToolbarSize + _consts.tableDeleteButtonSize + _consts.tableDeleteButtonOffset;
|
|
19
|
-
|
|
20
13
|
function getColumnOptions(left, tableWrapper) {
|
|
21
14
|
return {
|
|
22
15
|
alignX: 'left',
|
|
@@ -29,12 +22,10 @@ function getColumnOptions(left, tableWrapper) {
|
|
|
29
22
|
var minVisibleLeftPosition = tableWrapper.scrollLeft;
|
|
30
23
|
return maxVisibleLeftPosition - left > 0 && left > minVisibleLeftPosition;
|
|
31
24
|
}
|
|
32
|
-
|
|
33
25
|
return true;
|
|
34
26
|
}
|
|
35
27
|
};
|
|
36
28
|
}
|
|
37
|
-
|
|
38
29
|
function getRowOptions(top) {
|
|
39
30
|
return {
|
|
40
31
|
alignX: 'left',
|
|
@@ -49,20 +40,16 @@ function getRowOptions(top) {
|
|
|
49
40
|
}
|
|
50
41
|
};
|
|
51
42
|
}
|
|
52
|
-
|
|
53
43
|
function getPopupOptions(_ref) {
|
|
54
44
|
var left = _ref.left,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
45
|
+
top = _ref.top,
|
|
46
|
+
selectionType = _ref.selectionType,
|
|
47
|
+
tableWrapper = _ref.tableWrapper;
|
|
59
48
|
switch (selectionType) {
|
|
60
49
|
case 'column':
|
|
61
50
|
return getColumnOptions(left, tableWrapper);
|
|
62
|
-
|
|
63
51
|
case 'row':
|
|
64
52
|
return getRowOptions(top);
|
|
65
|
-
|
|
66
53
|
default:
|
|
67
54
|
{
|
|
68
55
|
return {};
|
|
@@ -1,171 +1,120 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = void 0;
|
|
11
9
|
exports.getSelectionType = getSelectionType;
|
|
12
|
-
|
|
13
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
14
|
-
|
|
15
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
16
|
-
|
|
17
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
18
|
-
|
|
19
13
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
20
|
-
|
|
21
14
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
22
|
-
|
|
23
15
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
24
|
-
|
|
25
16
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
26
|
-
|
|
27
17
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
28
|
-
|
|
29
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
30
|
-
|
|
31
19
|
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
32
|
-
|
|
33
20
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
34
|
-
|
|
35
21
|
var _reactDom = require("react-dom");
|
|
36
|
-
|
|
37
22
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
38
|
-
|
|
39
23
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
40
|
-
|
|
41
24
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
42
|
-
|
|
43
25
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
44
|
-
|
|
45
26
|
var _commands = require("../../commands");
|
|
46
|
-
|
|
47
27
|
var _commandsWithAnalytics = require("../../commands-with-analytics");
|
|
48
|
-
|
|
49
28
|
var _pluginFactory = require("../../pm-plugins/plugin-factory");
|
|
50
|
-
|
|
51
29
|
var _types = require("../../types");
|
|
52
|
-
|
|
53
30
|
var _utils3 = require("../../utils");
|
|
54
|
-
|
|
55
31
|
var _messages = _interopRequireDefault(require("../messages"));
|
|
56
|
-
|
|
57
32
|
var _consts = require("../consts");
|
|
58
|
-
|
|
59
33
|
var _DeleteButton = _interopRequireDefault(require("./DeleteButton"));
|
|
60
|
-
|
|
61
34
|
var _getPopUpOptions = _interopRequireDefault(require("./getPopUpOptions"));
|
|
62
|
-
|
|
63
35
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
64
|
-
|
|
65
36
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
66
|
-
|
|
67
37
|
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; }
|
|
68
|
-
|
|
69
38
|
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; }
|
|
70
|
-
|
|
71
39
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
72
|
-
|
|
73
40
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
74
|
-
|
|
75
41
|
function getSelectionType(selection) {
|
|
76
42
|
if (!(0, _utils.isTableSelected)(selection) && selection instanceof _cellSelection.CellSelection) {
|
|
77
43
|
if (selection.isRowSelection()) {
|
|
78
44
|
return 'row';
|
|
79
45
|
}
|
|
80
|
-
|
|
81
46
|
if (selection.isColSelection()) {
|
|
82
47
|
return 'column';
|
|
83
48
|
}
|
|
84
49
|
}
|
|
85
|
-
|
|
86
50
|
return;
|
|
87
51
|
}
|
|
88
|
-
|
|
89
52
|
var FloatingDeleteButton = /*#__PURE__*/function (_Component) {
|
|
90
53
|
(0, _inherits2.default)(FloatingDeleteButton, _Component);
|
|
91
|
-
|
|
92
54
|
var _super = _createSuper(FloatingDeleteButton);
|
|
93
|
-
|
|
94
55
|
function FloatingDeleteButton(props) {
|
|
95
56
|
var _this;
|
|
96
|
-
|
|
97
57
|
(0, _classCallCheck2.default)(this, FloatingDeleteButton);
|
|
98
58
|
_this = _super.call(this, props);
|
|
99
59
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "wrapper", null);
|
|
100
60
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateWrapper", function () {
|
|
101
61
|
var tableWrapper = (0, _utils2.closestElement)(_this.props.tableRef, ".".concat(_types.TableCssClassName.TABLE_NODE_WRAPPER));
|
|
102
|
-
|
|
103
62
|
if (tableWrapper) {
|
|
104
63
|
_this.wrapper = tableWrapper;
|
|
105
|
-
|
|
106
64
|
_this.wrapper.addEventListener('scroll', _this.onWrapperScrolled);
|
|
107
|
-
|
|
108
65
|
_this.setState({
|
|
109
66
|
scrollLeft: tableWrapper.scrollLeft
|
|
110
67
|
});
|
|
111
68
|
} else {
|
|
112
69
|
if (_this.wrapper) {
|
|
113
70
|
// unsubscribe if we previously had one and it just went away
|
|
114
|
-
_this.wrapper.removeEventListener('scroll', _this.onWrapperScrolled);
|
|
115
|
-
|
|
71
|
+
_this.wrapper.removeEventListener('scroll', _this.onWrapperScrolled);
|
|
116
72
|
|
|
73
|
+
// and reset scroll position
|
|
117
74
|
_this.setState({
|
|
118
75
|
scrollLeft: 0
|
|
119
76
|
});
|
|
120
77
|
}
|
|
121
|
-
|
|
122
78
|
_this.wrapper = null;
|
|
123
79
|
}
|
|
124
80
|
});
|
|
125
81
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onWrapperScrolled", function (e) {
|
|
126
82
|
var wrapper = e.target;
|
|
127
|
-
|
|
128
83
|
_this.setState({
|
|
129
84
|
scrollLeft: wrapper.scrollLeft
|
|
130
85
|
});
|
|
131
86
|
});
|
|
132
87
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleMouseEnter", function () {
|
|
133
88
|
var _this$props$editorVie = _this.props.editorView,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
89
|
+
state = _this$props$editorVie.state,
|
|
90
|
+
dispatch = _this$props$editorVie.dispatch;
|
|
137
91
|
switch (_this.state.selectionType) {
|
|
138
92
|
case 'row':
|
|
139
93
|
{
|
|
140
94
|
return (0, _commands.hoverRows)(_this.state.indexes, true)(state, dispatch, _this.props.editorView);
|
|
141
95
|
}
|
|
142
|
-
|
|
143
96
|
case 'column':
|
|
144
97
|
{
|
|
145
98
|
return (0, _commands.hoverColumns)(_this.state.indexes, true)(state, dispatch, _this.props.editorView);
|
|
146
99
|
}
|
|
147
100
|
}
|
|
148
|
-
|
|
149
101
|
return false;
|
|
150
102
|
});
|
|
151
103
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleMouseLeave", function () {
|
|
152
104
|
var _this$props$editorVie2 = _this.props.editorView,
|
|
153
|
-
|
|
154
|
-
|
|
105
|
+
state = _this$props$editorVie2.state,
|
|
106
|
+
dispatch = _this$props$editorVie2.dispatch;
|
|
155
107
|
return (0, _commands.clearHoverSelection)()(state, dispatch);
|
|
156
108
|
});
|
|
157
109
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClick", function (event) {
|
|
158
110
|
event.preventDefault();
|
|
159
111
|
var editorAnalyticsAPI = _this.props.editorAnalyticsAPI;
|
|
160
112
|
var _this$props$editorVie3 = _this.props.editorView,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
113
|
+
state = _this$props$editorVie3.state,
|
|
114
|
+
dispatch = _this$props$editorVie3.dispatch;
|
|
164
115
|
var _getTablePluginState = (0, _pluginFactory.getPluginState)(state),
|
|
165
|
-
|
|
166
|
-
|
|
116
|
+
isHeaderRowRequired = _getTablePluginState.pluginConfig.isHeaderRowRequired;
|
|
167
117
|
var rect = (0, _utils.getSelectionRect)(state.selection);
|
|
168
|
-
|
|
169
118
|
if (rect) {
|
|
170
119
|
switch (_this.state.selectionType) {
|
|
171
120
|
case 'column':
|
|
@@ -173,7 +122,6 @@ var FloatingDeleteButton = /*#__PURE__*/function (_Component) {
|
|
|
173
122
|
(0, _commandsWithAnalytics.deleteColumnsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.BUTTON, rect)(state, dispatch);
|
|
174
123
|
return;
|
|
175
124
|
}
|
|
176
|
-
|
|
177
125
|
case 'row':
|
|
178
126
|
{
|
|
179
127
|
(0, _commandsWithAnalytics.deleteRowsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.BUTTON, rect, !!isHeaderRowRequired)(state, dispatch);
|
|
@@ -181,7 +129,6 @@ var FloatingDeleteButton = /*#__PURE__*/function (_Component) {
|
|
|
181
129
|
}
|
|
182
130
|
}
|
|
183
131
|
}
|
|
184
|
-
|
|
185
132
|
var _this$props$editorVie4 = _this.props.editorView;
|
|
186
133
|
state = _this$props$editorVie4.state;
|
|
187
134
|
dispatch = _this$props$editorVie4.dispatch;
|
|
@@ -196,7 +143,6 @@ var FloatingDeleteButton = /*#__PURE__*/function (_Component) {
|
|
|
196
143
|
};
|
|
197
144
|
return _this;
|
|
198
145
|
}
|
|
199
|
-
|
|
200
146
|
(0, _createClass2.default)(FloatingDeleteButton, [{
|
|
201
147
|
key: "shouldComponentUpdate",
|
|
202
148
|
value: function shouldComponentUpdate(_, nextState) {
|
|
@@ -223,24 +169,20 @@ var FloatingDeleteButton = /*#__PURE__*/function (_Component) {
|
|
|
223
169
|
key: "render",
|
|
224
170
|
value: function render() {
|
|
225
171
|
var _this$props = this.props,
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
172
|
+
mountPoint = _this$props.mountPoint,
|
|
173
|
+
boundariesElement = _this$props.boundariesElement,
|
|
174
|
+
tableRef = _this$props.tableRef;
|
|
229
175
|
var selectionType = this.state.selectionType;
|
|
230
|
-
|
|
231
176
|
if (!selectionType || !tableRef) {
|
|
232
177
|
return null;
|
|
233
178
|
}
|
|
234
|
-
|
|
235
179
|
var tableContainerWrapper = (0, _utils2.closestElement)(tableRef, ".".concat(_types.TableCssClassName.TABLE_CONTAINER));
|
|
236
|
-
|
|
237
180
|
var button = /*#__PURE__*/_react.default.createElement(_DeleteButton.default, {
|
|
238
181
|
removeLabel: selectionType === 'column' ? _messages.default.removeColumns : _messages.default.removeRows,
|
|
239
182
|
onClick: this.handleClick,
|
|
240
183
|
onMouseEnter: this.handleMouseEnter,
|
|
241
184
|
onMouseLeave: this.handleMouseLeave
|
|
242
185
|
});
|
|
243
|
-
|
|
244
186
|
var popupOpts = (0, _getPopUpOptions.default)({
|
|
245
187
|
left: this.state.left,
|
|
246
188
|
top: this.state.top,
|
|
@@ -248,17 +190,13 @@ var FloatingDeleteButton = /*#__PURE__*/function (_Component) {
|
|
|
248
190
|
tableWrapper: this.wrapper
|
|
249
191
|
});
|
|
250
192
|
var mountTo = tableContainerWrapper || mountPoint;
|
|
251
|
-
|
|
252
193
|
if (this.state.position === 'sticky' && mountTo) {
|
|
253
194
|
var headerRow = tableRef.querySelector('tr.sticky');
|
|
254
|
-
|
|
255
195
|
if (headerRow) {
|
|
256
196
|
var rect = headerRow.getBoundingClientRect();
|
|
257
|
-
|
|
258
197
|
var calculatePosition = popupOpts.onPositionCalculated || function (pos) {
|
|
259
198
|
return pos;
|
|
260
199
|
};
|
|
261
|
-
|
|
262
200
|
var pos = calculatePosition({
|
|
263
201
|
left: this.state.left,
|
|
264
202
|
top: this.state.top
|
|
@@ -273,7 +211,6 @@ var FloatingDeleteButton = /*#__PURE__*/function (_Component) {
|
|
|
273
211
|
}, button), mountTo);
|
|
274
212
|
}
|
|
275
213
|
}
|
|
276
|
-
|
|
277
214
|
return /*#__PURE__*/_react.default.createElement(_ui.Popup, (0, _extends2.default)({
|
|
278
215
|
target: tableRef,
|
|
279
216
|
mountTo: mountTo,
|
|
@@ -294,14 +231,14 @@ var FloatingDeleteButton = /*#__PURE__*/function (_Component) {
|
|
|
294
231
|
function getDerivedStateFromProps(nextProps, prevState) {
|
|
295
232
|
var selectionType = getSelectionType(nextProps.selection);
|
|
296
233
|
var inStickyMode = nextProps.stickyHeaders && nextProps.stickyHeaders.sticky;
|
|
297
|
-
var rect = (0, _utils.getSelectionRect)(nextProps.selection);
|
|
234
|
+
var rect = (0, _utils.getSelectionRect)(nextProps.selection);
|
|
235
|
+
|
|
236
|
+
// only tie row delete to sticky header if it's the only thing
|
|
298
237
|
// in the selection, otherwise the row delete will hover around
|
|
299
238
|
// the rest of the selection
|
|
300
|
-
|
|
301
239
|
var firstRowInSelection = rect && rect.top === 0 && rect.bottom === 1;
|
|
302
240
|
var shouldStickyButton = inStickyMode && firstRowInSelection;
|
|
303
241
|
var stickyTop = nextProps.stickyHeaders ? nextProps.stickyHeaders.top + nextProps.stickyHeaders.padding : 0;
|
|
304
|
-
|
|
305
242
|
if (selectionType) {
|
|
306
243
|
switch (selectionType) {
|
|
307
244
|
case 'column':
|
|
@@ -309,7 +246,6 @@ var FloatingDeleteButton = /*#__PURE__*/function (_Component) {
|
|
|
309
246
|
// Calculate the button position and indexes for columns
|
|
310
247
|
var columnsWidths = (0, _utils3.getColumnsWidths)(nextProps.editorView);
|
|
311
248
|
var deleteBtnParams = (0, _utils3.getColumnDeleteButtonParams)(columnsWidths, nextProps.editorView.state.selection);
|
|
312
|
-
|
|
313
249
|
if (deleteBtnParams) {
|
|
314
250
|
return _objectSpread(_objectSpread({}, deleteBtnParams), {}, {
|
|
315
251
|
top: inStickyMode ? nextProps.stickyHeaders.top : 0,
|
|
@@ -317,19 +253,15 @@ var FloatingDeleteButton = /*#__PURE__*/function (_Component) {
|
|
|
317
253
|
selectionType: selectionType
|
|
318
254
|
});
|
|
319
255
|
}
|
|
320
|
-
|
|
321
256
|
return null;
|
|
322
257
|
}
|
|
323
|
-
|
|
324
258
|
case 'row':
|
|
325
259
|
{
|
|
326
260
|
// Calculate the button position and indexes for rows
|
|
327
261
|
if (nextProps.tableRef) {
|
|
328
262
|
var rowHeights = (0, _utils3.getRowHeights)(nextProps.tableRef);
|
|
329
263
|
var offsetTop = inStickyMode ? -rowHeights[0] : 0;
|
|
330
|
-
|
|
331
264
|
var _deleteBtnParams = (0, _utils3.getRowDeleteButtonParams)(rowHeights, nextProps.editorView.state.selection, shouldStickyButton ? stickyTop : offsetTop);
|
|
332
|
-
|
|
333
265
|
if (_deleteBtnParams) {
|
|
334
266
|
return _objectSpread(_objectSpread({}, _deleteBtnParams), {}, {
|
|
335
267
|
position: shouldStickyButton ? 'sticky' : undefined,
|
|
@@ -338,13 +270,12 @@ var FloatingDeleteButton = /*#__PURE__*/function (_Component) {
|
|
|
338
270
|
});
|
|
339
271
|
}
|
|
340
272
|
}
|
|
341
|
-
|
|
342
273
|
return null;
|
|
343
274
|
}
|
|
344
275
|
}
|
|
345
|
-
}
|
|
346
|
-
|
|
276
|
+
}
|
|
347
277
|
|
|
278
|
+
// Clean state if no type
|
|
348
279
|
if (prevState.selectionType !== selectionType) {
|
|
349
280
|
return {
|
|
350
281
|
selectionType: undefined,
|
|
@@ -352,15 +283,14 @@ var FloatingDeleteButton = /*#__PURE__*/function (_Component) {
|
|
|
352
283
|
left: 0,
|
|
353
284
|
indexes: []
|
|
354
285
|
};
|
|
355
|
-
}
|
|
356
|
-
|
|
286
|
+
}
|
|
357
287
|
|
|
288
|
+
// Do nothing if doesn't change anything
|
|
358
289
|
return null;
|
|
359
290
|
}
|
|
360
291
|
}]);
|
|
361
292
|
return FloatingDeleteButton;
|
|
362
293
|
}(_react.Component);
|
|
363
|
-
|
|
364
294
|
(0, _defineProperty2.default)(FloatingDeleteButton, "displayName", 'FloatingDeleteButton');
|
|
365
295
|
var _default = FloatingDeleteButton;
|
|
366
296
|
exports.default = _default;
|
|
@@ -1,38 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = void 0;
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
|
|
14
10
|
var _reactIntlNext = require("react-intl-next");
|
|
15
|
-
|
|
16
11
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
17
|
-
|
|
18
12
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
19
|
-
|
|
20
13
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
21
|
-
|
|
22
14
|
var keymaps = _interopRequireWildcard(require("@atlaskit/editor-common/keymaps"));
|
|
23
|
-
|
|
24
15
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
25
|
-
|
|
26
16
|
var _types = require("../../types");
|
|
27
|
-
|
|
28
17
|
var _messages = _interopRequireDefault(require("../messages"));
|
|
29
|
-
|
|
30
18
|
var _consts = require("../consts");
|
|
31
|
-
|
|
32
19
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
|
-
|
|
34
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
|
-
|
|
36
21
|
var getInsertLineHeight = function getInsertLineHeight(tableRef, hasStickyHeaders) {
|
|
37
22
|
// The line gets height 100% from the table,
|
|
38
23
|
// but since we have an overflow on the left,
|
|
@@ -41,43 +26,36 @@ var getInsertLineHeight = function getInsertLineHeight(tableRef, hasStickyHeader
|
|
|
41
26
|
var ADDITIONAL_HEIGHT = hasStickyHeaders ? tableRef.getBoundingClientRect().top - _styles.tableMarginTop * 4 - LINE_OFFSET : _consts.tableToolbarSize + LINE_OFFSET;
|
|
42
27
|
return tableRef.offsetHeight + ADDITIONAL_HEIGHT;
|
|
43
28
|
};
|
|
44
|
-
|
|
45
29
|
var getToolbarSize = function getToolbarSize(tableRef) {
|
|
46
30
|
var parent = (0, _utils.closestElement)(tableRef, ".".concat(_types.TableCssClassName.TABLE_CONTAINER));
|
|
47
|
-
|
|
48
31
|
if (parent) {
|
|
49
32
|
return parent.querySelector(".".concat(_types.TableCssClassName.NUMBERED_COLUMN)) ? _consts.tableToolbarSize + _editorSharedStyles.akEditorTableNumberColumnWidth - 1 : _consts.tableToolbarSize;
|
|
50
33
|
}
|
|
51
|
-
|
|
52
34
|
return _consts.tableToolbarSize;
|
|
53
35
|
};
|
|
54
|
-
|
|
55
36
|
var getInsertLineWidth = function getInsertLineWidth(tableRef) {
|
|
56
37
|
// The line gets width 100% from the table,
|
|
57
38
|
// but since we have an overflow on the left,
|
|
58
39
|
// we should add an offset to make up for it.
|
|
59
40
|
var LINE_OFFSET = 4;
|
|
60
41
|
var parentElement = tableRef.parentElement,
|
|
61
|
-
|
|
42
|
+
offsetWidth = tableRef.offsetWidth;
|
|
62
43
|
var parentOffsetWidth = parentElement.offsetWidth;
|
|
63
44
|
var _ref = parentElement,
|
|
64
|
-
|
|
45
|
+
scrollLeft = _ref.scrollLeft;
|
|
65
46
|
var diff = offsetWidth - parentOffsetWidth;
|
|
66
47
|
var toolbarSize = getToolbarSize(tableRef);
|
|
67
48
|
return Math.min(offsetWidth + toolbarSize, parentOffsetWidth + toolbarSize - Math.max(scrollLeft - diff, 0)) + LINE_OFFSET;
|
|
68
49
|
};
|
|
69
|
-
|
|
70
50
|
var tooltipMessageByType = function tooltipMessageByType(type) {
|
|
71
51
|
return type === 'row' ? _messages.default.insertRow : _messages.default.insertColumn;
|
|
72
52
|
};
|
|
73
|
-
|
|
74
53
|
var InsertButton = function InsertButton(_ref2) {
|
|
75
54
|
var onMouseDown = _ref2.onMouseDown,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
55
|
+
tableRef = _ref2.tableRef,
|
|
56
|
+
type = _ref2.type,
|
|
57
|
+
formatMessage = _ref2.intl.formatMessage,
|
|
58
|
+
hasStickyHeaders = _ref2.hasStickyHeaders;
|
|
81
59
|
var content = /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
82
60
|
content: /*#__PURE__*/_react.default.createElement(keymaps.ToolTipContent, {
|
|
83
61
|
description: formatMessage(tooltipMessageByType(type)),
|
|
@@ -104,7 +82,6 @@ var InsertButton = function InsertButton(_ref2) {
|
|
|
104
82
|
height: getInsertLineHeight(tableRef, hasStickyHeaders)
|
|
105
83
|
}
|
|
106
84
|
})));
|
|
107
|
-
|
|
108
85
|
var floatingButtonClassName = type === 'column' ? _types.TableCssClassName.CONTROLS_FLOATING_BUTTON_COLUMN : _types.TableCssClassName.CONTROLS_FLOATING_BUTTON_ROW;
|
|
109
86
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
110
87
|
className: floatingButtonClassName
|
|
@@ -112,7 +89,5 @@ var InsertButton = function InsertButton(_ref2) {
|
|
|
112
89
|
className: "".concat(_types.TableCssClassName.CONTROLS_INSERT_BUTTON_WRAP, " ").concat(_types.TableCssClassName.CONTROLS_INSERT_ROW)
|
|
113
90
|
}, content));
|
|
114
91
|
};
|
|
115
|
-
|
|
116
92
|
var _default = (0, _reactIntlNext.injectIntl)(InsertButton);
|
|
117
|
-
|
|
118
93
|
exports.default = _default;
|
|
@@ -1,35 +1,26 @@
|
|
|
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 _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
13
|
-
|
|
14
10
|
var _consts = require("../consts");
|
|
15
|
-
|
|
16
11
|
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; }
|
|
17
|
-
|
|
18
12
|
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; }
|
|
19
|
-
|
|
20
13
|
var HORIZONTAL_ALIGN_COLUMN_BUTTON = -(_consts.tableInsertColumnButtonSize / 2);
|
|
21
14
|
var HORIZONTAL_ALIGN_NUMBERED_COLUMN_BUTTON = HORIZONTAL_ALIGN_COLUMN_BUTTON + _editorSharedStyles.akEditorTableNumberColumnWidth;
|
|
22
15
|
var VERTICAL_ALIGN_COLUMN_BUTTON = _consts.tableToolbarSize + _consts.tableInsertColumnButtonOffset;
|
|
23
16
|
var HORIZONTAL_ALIGN_ROW_BUTTON = -(_consts.tableToolbarSize + _consts.tableInsertColumnButtonOffset + _consts.tableInsertColumnButtonSize);
|
|
24
17
|
var VERTICAL_ALIGN_ROW_BUTTON = _consts.tableInsertColumnButtonSize / 2;
|
|
25
|
-
|
|
26
18
|
function getRowOptions(index) {
|
|
27
19
|
var defaultOptions = {
|
|
28
20
|
alignX: 'left',
|
|
29
21
|
alignY: 'bottom',
|
|
30
22
|
offset: [0, VERTICAL_ALIGN_ROW_BUTTON]
|
|
31
23
|
};
|
|
32
|
-
|
|
33
24
|
if (index === 0) {
|
|
34
25
|
defaultOptions = _objectSpread(_objectSpread({}, defaultOptions), {}, {
|
|
35
26
|
alignY: 'top',
|
|
@@ -37,7 +28,6 @@ function getRowOptions(index) {
|
|
|
37
28
|
offset: [0, -VERTICAL_ALIGN_ROW_BUTTON]
|
|
38
29
|
});
|
|
39
30
|
}
|
|
40
|
-
|
|
41
31
|
return _objectSpread(_objectSpread({}, defaultOptions), {}, {
|
|
42
32
|
onPositionCalculated: function onPositionCalculated(position) {
|
|
43
33
|
return _objectSpread(_objectSpread({}, position), {}, {
|
|
@@ -47,7 +37,6 @@ function getRowOptions(index) {
|
|
|
47
37
|
}
|
|
48
38
|
});
|
|
49
39
|
}
|
|
50
|
-
|
|
51
40
|
function getColumnOptions(index, tableContainer, hasNumberedColumns) {
|
|
52
41
|
var options = {
|
|
53
42
|
alignX: 'end',
|
|
@@ -60,49 +49,43 @@ function getColumnOptions(index, tableContainer, hasNumberedColumns) {
|
|
|
60
49
|
// considering the offset from the first column
|
|
61
50
|
onPositionCalculated: function onPositionCalculated(position) {
|
|
62
51
|
var left = position.left;
|
|
63
|
-
|
|
64
52
|
if (!left) {
|
|
65
53
|
// If not left, lest skip expensive next calculations.
|
|
66
54
|
return position;
|
|
67
55
|
}
|
|
68
|
-
|
|
69
56
|
if (index === 0) {
|
|
70
57
|
return _objectSpread(_objectSpread({}, position), {}, {
|
|
71
58
|
left: hasNumberedColumns ? HORIZONTAL_ALIGN_NUMBERED_COLUMN_BUTTON : HORIZONTAL_ALIGN_COLUMN_BUTTON
|
|
72
59
|
});
|
|
73
|
-
}
|
|
74
|
-
|
|
60
|
+
}
|
|
75
61
|
|
|
62
|
+
// Check if current position is greater than the available container width
|
|
76
63
|
var rect = tableContainer ? tableContainer.getBoundingClientRect() : null;
|
|
77
64
|
return _objectSpread(_objectSpread({}, position), {}, {
|
|
78
65
|
left: rect && left > rect.width ? rect.width : left
|
|
79
66
|
});
|
|
80
67
|
}
|
|
81
|
-
};
|
|
82
|
-
// the column index is zero
|
|
68
|
+
};
|
|
83
69
|
|
|
70
|
+
// We need to change the popup position when
|
|
71
|
+
// the column index is zero
|
|
84
72
|
if (index === 0) {
|
|
85
73
|
return _objectSpread(_objectSpread({}, options), {}, {
|
|
86
74
|
alignX: 'left',
|
|
87
75
|
alignY: 'top'
|
|
88
76
|
});
|
|
89
77
|
}
|
|
90
|
-
|
|
91
78
|
return options;
|
|
92
79
|
}
|
|
93
|
-
|
|
94
80
|
function getPopupOptions(type, index, hasNumberedColumns, tableContainer) {
|
|
95
81
|
switch (type) {
|
|
96
82
|
case 'column':
|
|
97
83
|
return getColumnOptions(index, tableContainer, hasNumberedColumns);
|
|
98
|
-
|
|
99
84
|
case 'row':
|
|
100
85
|
return getRowOptions(index);
|
|
101
|
-
|
|
102
86
|
default:
|
|
103
87
|
return {};
|
|
104
88
|
}
|
|
105
89
|
}
|
|
106
|
-
|
|
107
90
|
var _default = getPopupOptions;
|
|
108
91
|
exports.default = _default;
|