@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
|
@@ -5,15 +5,10 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
|
|
9
8
|
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; }
|
|
10
|
-
|
|
11
9
|
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) { _defineProperty(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; }
|
|
12
|
-
|
|
13
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
|
-
|
|
15
11
|
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; } }
|
|
16
|
-
|
|
17
12
|
/** @jsx jsx */
|
|
18
13
|
import { Component } from 'react';
|
|
19
14
|
import { jsx } from '@emotion/react';
|
|
@@ -80,59 +75,46 @@ export var messages = defineMessages({
|
|
|
80
75
|
});
|
|
81
76
|
export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
82
77
|
_inherits(ContextualMenu, _Component);
|
|
83
|
-
|
|
84
78
|
var _super = _createSuper(ContextualMenu);
|
|
85
|
-
|
|
86
79
|
function ContextualMenu() {
|
|
87
80
|
var _this;
|
|
88
|
-
|
|
89
81
|
_classCallCheck(this, ContextualMenu);
|
|
90
|
-
|
|
91
82
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
92
83
|
args[_key] = arguments[_key];
|
|
93
84
|
}
|
|
94
|
-
|
|
95
85
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
96
|
-
|
|
97
86
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
98
87
|
isSubmenuOpen: false
|
|
99
88
|
});
|
|
100
|
-
|
|
101
89
|
_defineProperty(_assertThisInitialized(_this), "handleSubMenuRef", function (ref) {
|
|
102
90
|
var parent = closestElement(_this.props.editorView.dom, '.fabric-editor-popup-scroll-parent');
|
|
103
|
-
|
|
104
91
|
if (!(parent && ref)) {
|
|
105
92
|
return;
|
|
106
93
|
}
|
|
107
|
-
|
|
108
94
|
var boundariesRect = parent.getBoundingClientRect();
|
|
109
95
|
var rect = ref.getBoundingClientRect();
|
|
110
|
-
|
|
111
96
|
if (rect.left + rect.width > boundariesRect.width) {
|
|
112
97
|
ref.style.left = "-".concat(rect.width, "px");
|
|
113
98
|
}
|
|
114
99
|
});
|
|
115
|
-
|
|
116
100
|
_defineProperty(_assertThisInitialized(_this), "createItems", function () {
|
|
117
101
|
var _this$props = _this.props,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
102
|
+
allowMergeCells = _this$props.allowMergeCells,
|
|
103
|
+
allowColumnSorting = _this$props.allowColumnSorting,
|
|
104
|
+
allowBackgroundColor = _this$props.allowBackgroundColor,
|
|
105
|
+
state = _this$props.editorView.state,
|
|
106
|
+
isOpen = _this$props.isOpen,
|
|
107
|
+
selectionRect = _this$props.selectionRect,
|
|
108
|
+
formatMessage = _this$props.intl.formatMessage,
|
|
109
|
+
editorView = _this$props.editorView;
|
|
126
110
|
var items = [];
|
|
127
|
-
var isSubmenuOpen = _this.state.isSubmenuOpen;
|
|
128
|
-
|
|
111
|
+
var isSubmenuOpen = _this.state.isSubmenuOpen;
|
|
112
|
+
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
129
113
|
var _getPluginState = getPluginState(editorView.state),
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
114
|
+
targetCellPosition = _getPluginState.targetCellPosition,
|
|
115
|
+
allowDistributeColumns = _getPluginState.pluginConfig.allowDistributeColumns;
|
|
133
116
|
if (allowBackgroundColor) {
|
|
134
117
|
var _node$attrs;
|
|
135
|
-
|
|
136
118
|
var node = isOpen && targetCellPosition ? state.doc.nodeAt(targetCellPosition) : null;
|
|
137
119
|
var background = (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.background) || '#ffffff';
|
|
138
120
|
items.push({
|
|
@@ -154,7 +136,6 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
154
136
|
})))
|
|
155
137
|
});
|
|
156
138
|
}
|
|
157
|
-
|
|
158
139
|
items.push({
|
|
159
140
|
content: formatMessage(tableMessages.insertColumn),
|
|
160
141
|
value: {
|
|
@@ -174,9 +155,9 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
174
155
|
}, tooltip(addRowAfter))
|
|
175
156
|
});
|
|
176
157
|
var top = selectionRect.top,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
158
|
+
bottom = selectionRect.bottom,
|
|
159
|
+
right = selectionRect.right,
|
|
160
|
+
left = selectionRect.left;
|
|
180
161
|
var noOfColumns = right - left;
|
|
181
162
|
var noOfRows = bottom - top;
|
|
182
163
|
items.push({
|
|
@@ -195,7 +176,6 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
195
176
|
name: 'delete_row'
|
|
196
177
|
}
|
|
197
178
|
});
|
|
198
|
-
|
|
199
179
|
if (allowMergeCells) {
|
|
200
180
|
items.push({
|
|
201
181
|
content: formatMessage(messages.mergeCells),
|
|
@@ -212,10 +192,8 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
212
192
|
isDisabled: !splitCell(state)
|
|
213
193
|
});
|
|
214
194
|
}
|
|
215
|
-
|
|
216
195
|
if (allowDistributeColumns) {
|
|
217
196
|
var _newResizeState$chang;
|
|
218
|
-
|
|
219
197
|
var newResizeState = getNewResizeStateFromSelectedColumns(selectionRect, state, editorView.domAtPos.bind(editorView), _this.props.getEditorContainerWidth);
|
|
220
198
|
var wouldChange = (_newResizeState$chang = newResizeState === null || newResizeState === void 0 ? void 0 : newResizeState.changed) !== null && _newResizeState$chang !== void 0 ? _newResizeState$chang : false;
|
|
221
199
|
items.push({
|
|
@@ -226,7 +204,6 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
226
204
|
isDisabled: !wouldChange
|
|
227
205
|
});
|
|
228
206
|
}
|
|
229
|
-
|
|
230
207
|
if (allowColumnSorting) {
|
|
231
208
|
var hasMergedCellsInTable = getMergedCellsPositions(state.tr).length > 0;
|
|
232
209
|
var warning = hasMergedCellsInTable ? {
|
|
@@ -246,7 +223,6 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
246
223
|
}
|
|
247
224
|
}, warning));
|
|
248
225
|
}
|
|
249
|
-
|
|
250
226
|
items.push({
|
|
251
227
|
content: formatMessage(messages.clearCells, {
|
|
252
228
|
0: Math.max(noOfColumns, noOfRows)
|
|
@@ -262,138 +238,98 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
262
238
|
items: items
|
|
263
239
|
}] : null;
|
|
264
240
|
});
|
|
265
|
-
|
|
266
241
|
_defineProperty(_assertThisInitialized(_this), "onMenuItemActivated", function (_ref) {
|
|
267
242
|
var item = _ref.item;
|
|
268
243
|
var _this$props2 = _this.props,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
244
|
+
editorView = _this$props2.editorView,
|
|
245
|
+
selectionRect = _this$props2.selectionRect,
|
|
246
|
+
editorAnalyticsAPI = _this$props2.editorAnalyticsAPI,
|
|
247
|
+
getEditorContainerWidth = _this$props2.getEditorContainerWidth;
|
|
248
|
+
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
274
249
|
var state = editorView.state,
|
|
275
|
-
|
|
276
|
-
|
|
250
|
+
dispatch = editorView.dispatch;
|
|
277
251
|
var _getPluginState2 = getPluginState(state),
|
|
278
|
-
|
|
279
|
-
|
|
252
|
+
targetCellPosition = _getPluginState2.targetCellPosition;
|
|
280
253
|
switch (item.value.name) {
|
|
281
254
|
case 'sort_column_desc':
|
|
282
255
|
sortColumnWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, selectionRect.left, SortOrder.DESC)(state, dispatch);
|
|
283
|
-
|
|
284
256
|
_this.toggleOpen();
|
|
285
|
-
|
|
286
257
|
break;
|
|
287
|
-
|
|
288
258
|
case 'sort_column_asc':
|
|
289
259
|
sortColumnWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, selectionRect.left, SortOrder.ASC)(state, dispatch);
|
|
290
|
-
|
|
291
260
|
_this.toggleOpen();
|
|
292
|
-
|
|
293
261
|
break;
|
|
294
|
-
|
|
295
262
|
case 'merge':
|
|
296
263
|
mergeCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU)(state, dispatch);
|
|
297
|
-
|
|
298
264
|
_this.toggleOpen();
|
|
299
|
-
|
|
300
265
|
break;
|
|
301
|
-
|
|
302
266
|
case 'split':
|
|
303
267
|
splitCellWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU)(state, dispatch);
|
|
304
|
-
|
|
305
268
|
_this.toggleOpen();
|
|
306
|
-
|
|
307
269
|
break;
|
|
308
|
-
|
|
309
270
|
case 'distribute_columns':
|
|
310
271
|
var newResizeStateWithAnalytics = getNewResizeStateFromSelectedColumns(selectionRect, state, editorView.domAtPos.bind(editorView), getEditorContainerWidth);
|
|
311
|
-
|
|
312
272
|
if (newResizeStateWithAnalytics) {
|
|
313
273
|
distributeColumnsWidthsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, newResizeStateWithAnalytics)(state, dispatch);
|
|
314
|
-
|
|
315
274
|
_this.toggleOpen();
|
|
316
275
|
}
|
|
317
|
-
|
|
318
276
|
break;
|
|
319
|
-
|
|
320
277
|
case 'clear':
|
|
321
278
|
emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, targetCellPosition)(state, dispatch);
|
|
322
|
-
|
|
323
279
|
_this.toggleOpen();
|
|
324
|
-
|
|
325
280
|
break;
|
|
326
|
-
|
|
327
281
|
case 'insert_column':
|
|
328
282
|
insertColumnWithAnalytics(getEditorContainerWidth, editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
|
|
329
|
-
|
|
330
283
|
_this.toggleOpen();
|
|
331
|
-
|
|
332
284
|
break;
|
|
333
|
-
|
|
334
285
|
case 'insert_row':
|
|
335
286
|
insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, {
|
|
336
287
|
index: selectionRect.bottom,
|
|
337
288
|
moveCursorToInsertedRow: true
|
|
338
289
|
})(state, dispatch);
|
|
339
|
-
|
|
340
290
|
_this.toggleOpen();
|
|
341
|
-
|
|
342
291
|
break;
|
|
343
|
-
|
|
344
292
|
case 'delete_column':
|
|
345
293
|
deleteColumnsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, selectionRect)(state, dispatch);
|
|
346
|
-
|
|
347
294
|
_this.toggleOpen();
|
|
348
|
-
|
|
349
295
|
break;
|
|
350
|
-
|
|
351
296
|
case 'delete_row':
|
|
352
297
|
var _getPluginState3 = getPluginState(state),
|
|
353
|
-
|
|
354
|
-
|
|
298
|
+
isHeaderRowRequired = _getPluginState3.pluginConfig.isHeaderRowRequired;
|
|
355
299
|
deleteRowsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, selectionRect, !!isHeaderRowRequired)(state, dispatch);
|
|
356
|
-
|
|
357
300
|
_this.toggleOpen();
|
|
358
|
-
|
|
359
301
|
break;
|
|
360
302
|
}
|
|
361
303
|
});
|
|
362
|
-
|
|
363
304
|
_defineProperty(_assertThisInitialized(_this), "toggleOpen", function () {
|
|
364
305
|
var _this$props3 = _this.props,
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
306
|
+
isOpen = _this$props3.isOpen,
|
|
307
|
+
_this$props3$editorVi = _this$props3.editorView,
|
|
308
|
+
state = _this$props3$editorVi.state,
|
|
309
|
+
dispatch = _this$props3$editorVi.dispatch;
|
|
369
310
|
toggleContextualMenu()(state, dispatch);
|
|
370
|
-
|
|
371
311
|
if (!isOpen) {
|
|
372
312
|
_this.setState({
|
|
373
313
|
isSubmenuOpen: false
|
|
374
314
|
});
|
|
375
315
|
}
|
|
376
316
|
});
|
|
377
|
-
|
|
378
317
|
_defineProperty(_assertThisInitialized(_this), "handleOpenChange", function () {
|
|
379
318
|
var _this$props$editorVie = _this.props.editorView,
|
|
380
|
-
|
|
381
|
-
|
|
319
|
+
state = _this$props$editorVie.state,
|
|
320
|
+
dispatch = _this$props$editorVie.dispatch;
|
|
382
321
|
toggleContextualMenu()(state, dispatch);
|
|
383
|
-
|
|
384
322
|
_this.setState({
|
|
385
323
|
isSubmenuOpen: false
|
|
386
324
|
});
|
|
387
325
|
});
|
|
388
|
-
|
|
389
326
|
_defineProperty(_assertThisInitialized(_this), "handleItemMouseEnter", function (_ref2) {
|
|
390
327
|
var item = _ref2.item;
|
|
391
328
|
var _this$props4 = _this.props,
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
329
|
+
_this$props4$editorVi = _this$props4.editorView,
|
|
330
|
+
state = _this$props4$editorVi.state,
|
|
331
|
+
dispatch = _this$props4$editorVi.dispatch,
|
|
332
|
+
selectionRect = _this$props4.selectionRect;
|
|
397
333
|
if (item.value.name === 'background') {
|
|
398
334
|
if (!_this.state.isSubmenuOpen) {
|
|
399
335
|
_this.setState({
|
|
@@ -401,35 +337,28 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
401
337
|
});
|
|
402
338
|
}
|
|
403
339
|
}
|
|
404
|
-
|
|
405
340
|
if (item.value.name === 'delete_column') {
|
|
406
341
|
hoverColumns(getSelectedColumnIndexes(selectionRect), true)(state, dispatch);
|
|
407
342
|
}
|
|
408
|
-
|
|
409
343
|
if (item.value.name === 'delete_row') {
|
|
410
344
|
hoverRows(getSelectedRowIndexes(selectionRect), true)(state, dispatch);
|
|
411
345
|
}
|
|
412
|
-
|
|
413
346
|
if (['sort_column_asc', 'sort_column_desc'].indexOf(item.value.name) > -1 && getMergedCellsPositions(state.tr).length !== 0) {
|
|
414
347
|
hoverMergedCells()(state, dispatch);
|
|
415
348
|
}
|
|
416
349
|
});
|
|
417
|
-
|
|
418
350
|
_defineProperty(_assertThisInitialized(_this), "handleItemMouseLeave", function (_ref3) {
|
|
419
351
|
var item = _ref3.item;
|
|
420
352
|
var _this$props$editorVie2 = _this.props.editorView,
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
353
|
+
state = _this$props$editorVie2.state,
|
|
354
|
+
dispatch = _this$props$editorVie2.dispatch;
|
|
424
355
|
if (item.value.name === 'background') {
|
|
425
356
|
_this.closeSubmenu();
|
|
426
357
|
}
|
|
427
|
-
|
|
428
358
|
if (['sort_column_asc', 'sort_column_desc', 'delete_column', 'delete_row'].indexOf(item.value.name) > -1) {
|
|
429
359
|
clearHoverSelection()(state, dispatch);
|
|
430
360
|
}
|
|
431
361
|
});
|
|
432
|
-
|
|
433
362
|
_defineProperty(_assertThisInitialized(_this), "closeSubmenu", function () {
|
|
434
363
|
if (_this.state.isSubmenuOpen) {
|
|
435
364
|
_this.setState({
|
|
@@ -437,44 +366,38 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
437
366
|
});
|
|
438
367
|
}
|
|
439
368
|
});
|
|
440
|
-
|
|
441
369
|
_defineProperty(_assertThisInitialized(_this), "setColor", function (color) {
|
|
442
370
|
var _this$props5 = _this.props,
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
371
|
+
editorView = _this$props5.editorView,
|
|
372
|
+
editorAnalyticsAPI = _this$props5.editorAnalyticsAPI;
|
|
373
|
+
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
446
374
|
var _getPluginState4 = getPluginState(editorView.state),
|
|
447
|
-
|
|
448
|
-
|
|
375
|
+
targetCellPosition = _getPluginState4.targetCellPosition;
|
|
449
376
|
var state = editorView.state,
|
|
450
|
-
|
|
377
|
+
dispatch = editorView.dispatch;
|
|
451
378
|
setColorWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.CONTEXT_MENU, color, targetCellPosition)(state, dispatch);
|
|
452
|
-
|
|
453
379
|
_this.toggleOpen();
|
|
454
380
|
});
|
|
455
|
-
|
|
456
381
|
return _this;
|
|
457
382
|
}
|
|
458
|
-
|
|
459
383
|
_createClass(ContextualMenu, [{
|
|
460
384
|
key: "render",
|
|
461
385
|
value: function render() {
|
|
462
386
|
var _this$props6 = this.props,
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
387
|
+
isOpen = _this$props6.isOpen,
|
|
388
|
+
mountPoint = _this$props6.mountPoint,
|
|
389
|
+
offset = _this$props6.offset,
|
|
390
|
+
boundariesElement = _this$props6.boundariesElement;
|
|
467
391
|
var items = this.createItems();
|
|
468
|
-
|
|
469
392
|
if (!items) {
|
|
470
393
|
return null;
|
|
471
394
|
}
|
|
472
|
-
|
|
473
395
|
return jsx("div", {
|
|
474
396
|
"data-testid": "table-cell-contextual-menu",
|
|
475
397
|
onMouseLeave: this.closeSubmenu
|
|
476
398
|
}, jsx(DropdownMenu, {
|
|
477
|
-
mountTo: mountPoint
|
|
399
|
+
mountTo: mountPoint
|
|
400
|
+
//This needs be removed when the a11y is completely handled
|
|
478
401
|
//Disabling key navigation now as it works only partially
|
|
479
402
|
,
|
|
480
403
|
disableArrowKeyNavigation: true,
|
|
@@ -491,12 +414,9 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
491
414
|
}));
|
|
492
415
|
}
|
|
493
416
|
}]);
|
|
494
|
-
|
|
495
417
|
return ContextualMenu;
|
|
496
418
|
}(Component);
|
|
497
|
-
|
|
498
419
|
_defineProperty(ContextualMenu, "defaultProps", {
|
|
499
420
|
boundariesElement: document.body
|
|
500
421
|
});
|
|
501
|
-
|
|
502
422
|
export default injectIntl(ContextualMenu);
|
|
@@ -8,59 +8,48 @@ import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
|
8
8
|
import { pluginKey } from '../../pm-plugins/plugin-key';
|
|
9
9
|
import { contextualMenuDropdownWidth, contextualMenuTriggerSize } from '../consts';
|
|
10
10
|
import { tablePopupStyles } from './styles';
|
|
11
|
-
import ContextualMenu from './ContextualMenu';
|
|
11
|
+
import ContextualMenu from './ContextualMenu';
|
|
12
12
|
|
|
13
|
+
// offset of the contextual menu dropdown
|
|
13
14
|
var calculateOffset = function calculateOffset(targetCellRef, state) {
|
|
14
15
|
var _pluginKey$getState = pluginKey.getState(state),
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
tableRef = _pluginKey$getState.tableRef;
|
|
17
17
|
var top = -contextualMenuTriggerSize;
|
|
18
|
-
|
|
19
18
|
if (tableRef && targetCellRef) {
|
|
20
19
|
var targetOffset = targetCellRef.getBoundingClientRect();
|
|
21
20
|
var tableOffset = tableRef.getBoundingClientRect();
|
|
22
21
|
var topDiff = targetOffset.top - tableOffset.top;
|
|
23
|
-
|
|
24
22
|
if (topDiff < 200) {
|
|
25
23
|
top -= topDiff + 2;
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
|
-
|
|
29
26
|
return [contextualMenuTriggerSize / 2, top];
|
|
30
27
|
};
|
|
31
|
-
|
|
32
28
|
var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
33
29
|
var mountPoint = _ref.mountPoint,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
boundariesElement = _ref.boundariesElement,
|
|
31
|
+
scrollableElement = _ref.scrollableElement,
|
|
32
|
+
editorView = _ref.editorView,
|
|
33
|
+
isOpen = _ref.isOpen,
|
|
34
|
+
pluginConfig = _ref.pluginConfig,
|
|
35
|
+
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
36
|
+
getEditorContainerWidth = _ref.getEditorContainerWidth;
|
|
42
37
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
43
38
|
var _getPluginState = getPluginState(editorView.state),
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
targetCellPosition = _getPluginState.targetCellPosition;
|
|
46
40
|
if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
47
41
|
return null;
|
|
48
42
|
}
|
|
49
|
-
|
|
50
43
|
var selection = editorView.state.selection;
|
|
51
44
|
var selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
52
|
-
|
|
53
45
|
if (!selectionRect) {
|
|
54
46
|
return null;
|
|
55
47
|
}
|
|
56
|
-
|
|
57
48
|
var domAtPos = editorView.domAtPos.bind(editorView);
|
|
58
49
|
var targetCellRef = findDomRefAtPos(targetCellPosition, domAtPos);
|
|
59
|
-
|
|
60
50
|
if (!targetCellRef) {
|
|
61
51
|
return null;
|
|
62
52
|
}
|
|
63
|
-
|
|
64
53
|
return jsx(Popup, {
|
|
65
54
|
alignX: "right",
|
|
66
55
|
alignY: "top",
|
|
@@ -69,7 +58,8 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
69
58
|
boundariesElement: boundariesElement,
|
|
70
59
|
scrollableElement: scrollableElement,
|
|
71
60
|
fitHeight: 188,
|
|
72
|
-
fitWidth: contextualMenuDropdownWidth
|
|
61
|
+
fitWidth: contextualMenuDropdownWidth
|
|
62
|
+
// z-index value below is to ensure that this menu is above other floating menu
|
|
73
63
|
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
74
64
|
,
|
|
75
65
|
zIndex: akEditorFloatingOverlapPanelZIndex,
|
|
@@ -91,6 +81,5 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
91
81
|
getEditorContainerWidth: getEditorContainerWidth
|
|
92
82
|
})));
|
|
93
83
|
};
|
|
94
|
-
|
|
95
84
|
FloatingContextualMenu.displayName = 'FloatingContextualMenu';
|
|
96
85
|
export default FloatingContextualMenu;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
|
|
3
2
|
var _templateObject, _templateObject2;
|
|
4
|
-
|
|
5
3
|
import { css } from '@emotion/react';
|
|
6
4
|
import { tableBackgroundBorderColor } from '@atlaskit/adf-schema';
|
|
7
5
|
import { N60A, N90 } from '@atlaskit/theme/colors';
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { injectIntl } from 'react-intl-next';
|
|
3
3
|
import { TableCssClassName as ClassName } from '../../types';
|
|
4
|
-
|
|
5
4
|
var DeleteButton = function DeleteButton(_ref) {
|
|
6
5
|
var style = _ref.style,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
onClick = _ref.onClick,
|
|
7
|
+
onMouseEnter = _ref.onMouseEnter,
|
|
8
|
+
onMouseLeave = _ref.onMouseLeave,
|
|
9
|
+
removeLabel = _ref.removeLabel,
|
|
10
|
+
formatMessage = _ref.intl.formatMessage;
|
|
12
11
|
return /*#__PURE__*/React.createElement("div", {
|
|
13
12
|
className: ClassName.CONTROLS_DELETE_BUTTON_WRAP,
|
|
14
13
|
style: style,
|
|
@@ -32,5 +31,4 @@ var DeleteButton = function DeleteButton(_ref) {
|
|
|
32
31
|
fillRule: "evenodd"
|
|
33
32
|
}))));
|
|
34
33
|
};
|
|
35
|
-
|
|
36
34
|
export default injectIntl(DeleteButton);
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
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; }
|
|
4
|
-
|
|
5
3
|
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) { _defineProperty(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; }
|
|
6
|
-
|
|
7
4
|
import { tableDeleteButtonOffset, tableDeleteButtonSize, tableToolbarSize } from '../consts';
|
|
8
5
|
var DELETE_BUTTON_CONTROLS_OFFSET = tableToolbarSize + tableDeleteButtonSize + tableDeleteButtonOffset;
|
|
9
|
-
|
|
10
6
|
function getColumnOptions(left, tableWrapper) {
|
|
11
7
|
return {
|
|
12
8
|
alignX: 'left',
|
|
@@ -19,12 +15,10 @@ function getColumnOptions(left, tableWrapper) {
|
|
|
19
15
|
var minVisibleLeftPosition = tableWrapper.scrollLeft;
|
|
20
16
|
return maxVisibleLeftPosition - left > 0 && left > minVisibleLeftPosition;
|
|
21
17
|
}
|
|
22
|
-
|
|
23
18
|
return true;
|
|
24
19
|
}
|
|
25
20
|
};
|
|
26
21
|
}
|
|
27
|
-
|
|
28
22
|
function getRowOptions(top) {
|
|
29
23
|
return {
|
|
30
24
|
alignX: 'left',
|
|
@@ -39,20 +33,16 @@ function getRowOptions(top) {
|
|
|
39
33
|
}
|
|
40
34
|
};
|
|
41
35
|
}
|
|
42
|
-
|
|
43
36
|
export default function getPopupOptions(_ref) {
|
|
44
37
|
var left = _ref.left,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
top = _ref.top,
|
|
39
|
+
selectionType = _ref.selectionType,
|
|
40
|
+
tableWrapper = _ref.tableWrapper;
|
|
49
41
|
switch (selectionType) {
|
|
50
42
|
case 'column':
|
|
51
43
|
return getColumnOptions(left, tableWrapper);
|
|
52
|
-
|
|
53
44
|
case 'row':
|
|
54
45
|
return getRowOptions(top);
|
|
55
|
-
|
|
56
46
|
default:
|
|
57
47
|
{
|
|
58
48
|
return {};
|