@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,90 +1,51 @@
|
|
|
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 _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
10
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
-
|
|
16
11
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
12
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
|
|
20
13
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
-
|
|
22
14
|
var _defineProperty3 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
-
|
|
24
15
|
var _react = _interopRequireDefault(require("react"));
|
|
25
|
-
|
|
26
16
|
var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
27
|
-
|
|
28
17
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
29
|
-
|
|
30
18
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
31
|
-
|
|
32
19
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
33
|
-
|
|
34
20
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
35
|
-
|
|
36
21
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
37
|
-
|
|
38
22
|
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
39
|
-
|
|
40
23
|
var _commands = require("../commands");
|
|
41
|
-
|
|
42
24
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
43
|
-
|
|
44
25
|
var _stickyHeaders = require("../pm-plugins/sticky-headers");
|
|
45
|
-
|
|
46
26
|
var _tableResizing = require("../pm-plugins/table-resizing");
|
|
47
|
-
|
|
48
27
|
var _utils3 = require("../pm-plugins/table-resizing/utils");
|
|
49
|
-
|
|
50
28
|
var _dom = require("../pm-plugins/table-resizing/utils/dom");
|
|
51
|
-
|
|
52
29
|
var _types = require("../types");
|
|
53
|
-
|
|
54
30
|
var _TableFloatingControls = _interopRequireDefault(require("../ui/TableFloatingControls"));
|
|
55
|
-
|
|
56
31
|
var _utils4 = require("../utils");
|
|
57
|
-
|
|
58
32
|
var _updateOverflowShadows = require("./update-overflow-shadows");
|
|
59
|
-
|
|
60
33
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
61
|
-
|
|
62
34
|
var _OverflowShadowsObserver = require("./OverflowShadowsObserver");
|
|
63
|
-
|
|
64
35
|
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; }
|
|
65
|
-
|
|
66
36
|
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, _defineProperty3.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; }
|
|
67
|
-
|
|
68
37
|
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); }; }
|
|
69
|
-
|
|
70
38
|
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; } }
|
|
71
|
-
|
|
72
39
|
var isIE11 = _utils2.browser.ie_version === 11;
|
|
73
|
-
|
|
74
40
|
var NOOP = function NOOP() {
|
|
75
41
|
return undefined;
|
|
76
42
|
};
|
|
77
|
-
|
|
78
43
|
var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
79
44
|
(0, _inherits2.default)(TableComponent, _React$Component);
|
|
80
|
-
|
|
81
45
|
var _super = _createSuper(TableComponent);
|
|
82
|
-
|
|
83
46
|
function TableComponent(props) {
|
|
84
47
|
var _defineProperty2;
|
|
85
|
-
|
|
86
48
|
var _this;
|
|
87
|
-
|
|
88
49
|
(0, _classCallCheck2.default)(this, TableComponent);
|
|
89
50
|
_this = _super.call(this, props);
|
|
90
51
|
(0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "state", (_defineProperty2 = {
|
|
@@ -96,32 +57,25 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
96
57
|
(0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "updateShadowState", function (shadowKey, value) {
|
|
97
58
|
if (_this.state[shadowKey] === value) {
|
|
98
59
|
return;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
60
|
+
}
|
|
61
|
+
// need this check to satisfy types for the setState argument
|
|
102
62
|
if (shadowKey === _types.ShadowEvent.SHOW_BEFORE_SHADOW) {
|
|
103
63
|
return _this.setState((0, _defineProperty3.default)({}, shadowKey, value));
|
|
104
64
|
}
|
|
105
|
-
|
|
106
65
|
_this.setState((0, _defineProperty3.default)({}, shadowKey, value));
|
|
107
66
|
});
|
|
108
67
|
(0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "onStickyState", function (state) {
|
|
109
68
|
var _this$props$getEditor = _this.props.getEditorFeatureFlags(),
|
|
110
|
-
|
|
111
|
-
|
|
69
|
+
tableOverflowShadowsOptimization = _this$props$getEditor.tableOverflowShadowsOptimization;
|
|
112
70
|
var pos = _this.props.getPos();
|
|
113
|
-
|
|
114
71
|
if (!(0, _utils2.isValidPosition)(pos, _this.props.view.state)) {
|
|
115
72
|
return;
|
|
116
73
|
}
|
|
117
|
-
|
|
118
74
|
var stickyHeader = (0, _stickyHeaders.findStickyHeaderForTable)(state, pos);
|
|
119
|
-
|
|
120
75
|
if (stickyHeader !== _this.state.stickyHeader) {
|
|
121
76
|
_this.setState({
|
|
122
77
|
stickyHeader: stickyHeader
|
|
123
78
|
});
|
|
124
|
-
|
|
125
79
|
if (tableOverflowShadowsOptimization && _this.overflowShadowsObserver) {
|
|
126
80
|
_this.overflowShadowsObserver.updateStickyShadows();
|
|
127
81
|
}
|
|
@@ -132,65 +86,58 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
132
86
|
var containerWidth = _this.props.containerWidth;
|
|
133
87
|
var lineLength = containerWidth.lineLength;
|
|
134
88
|
var marginLeft;
|
|
135
|
-
|
|
136
89
|
if (tableContainerCssWidth !== 'inherit' && lineLength) {
|
|
137
90
|
var _containerWidth2 = (0, _utils2.parsePx)(tableContainerCssWidth);
|
|
138
|
-
|
|
139
91
|
if (_containerWidth2) {
|
|
140
92
|
marginLeft = (lineLength - _containerWidth2) / 2;
|
|
141
93
|
}
|
|
142
94
|
}
|
|
143
|
-
|
|
144
95
|
return marginLeft;
|
|
145
96
|
});
|
|
146
97
|
(0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "handleScroll", function (event) {
|
|
147
98
|
if (!_this.wrapper || event.target !== _this.wrapper) {
|
|
148
99
|
return;
|
|
149
100
|
}
|
|
150
|
-
|
|
151
101
|
if (_this.table) {
|
|
152
102
|
// sync sticky header row to table scroll
|
|
153
103
|
var headers = _this.table.querySelectorAll('tr[data-header-row]');
|
|
154
|
-
|
|
155
104
|
for (var i = 0; i < headers.length; i++) {
|
|
156
105
|
var header = headers[i];
|
|
157
106
|
header.scrollLeft = _this.wrapper.scrollLeft;
|
|
158
107
|
header.style.marginRight = '2px';
|
|
159
108
|
}
|
|
160
109
|
}
|
|
161
|
-
|
|
162
110
|
var _this$props$getEditor2 = _this.props.getEditorFeatureFlags(),
|
|
163
|
-
|
|
164
|
-
|
|
111
|
+
tableOverflowShadowsOptimization = _this$props$getEditor2.tableOverflowShadowsOptimization;
|
|
165
112
|
if (!tableOverflowShadowsOptimization) {
|
|
166
113
|
_this.updateShadows();
|
|
167
114
|
}
|
|
168
115
|
});
|
|
169
116
|
(0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "handleTableResizing", function () {
|
|
170
117
|
var _this$props = _this.props,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
118
|
+
getNode = _this$props.getNode,
|
|
119
|
+
containerWidth = _this$props.containerWidth,
|
|
120
|
+
options = _this$props.options;
|
|
174
121
|
var prevNode = _this.node;
|
|
175
122
|
var node = getNode();
|
|
176
|
-
var prevAttrs = prevNode.attrs;
|
|
123
|
+
var prevAttrs = prevNode.attrs;
|
|
177
124
|
|
|
125
|
+
// We only consider a layout change valid if it's done outside of an autoSize.
|
|
178
126
|
var layoutChanged = prevAttrs.layout !== node.attrs.layout && prevAttrs.__autoSize === node.attrs.__autoSize;
|
|
179
|
-
|
|
180
127
|
var parentWidth = _this.getParentNodeWidth();
|
|
181
|
-
|
|
182
128
|
var parentWidthChanged = parentWidth && parentWidth !== _this.state.parentWidth;
|
|
183
|
-
|
|
184
129
|
var layoutSize = _this.tableNodeLayoutSize(node, containerWidth.width, options);
|
|
185
|
-
|
|
186
130
|
var hasNumberedColumnChanged = prevAttrs.isNumberColumnEnabled !== node.attrs.isNumberColumnEnabled;
|
|
187
131
|
var noOfColumnsChanged = (0, _utils4.tablesHaveDifferentNoOfColumns)(node, prevNode);
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
layoutChanged ||
|
|
132
|
+
if (
|
|
133
|
+
// Breakout mode/layout changed
|
|
134
|
+
layoutChanged ||
|
|
135
|
+
// We need to react if our parent changes
|
|
191
136
|
// Scales the cols widths relative to the new parent width.
|
|
192
|
-
parentWidthChanged ||
|
|
193
|
-
|
|
137
|
+
parentWidthChanged ||
|
|
138
|
+
// Enabling / disabling this feature reduces or adds size to the table.
|
|
139
|
+
hasNumberedColumnChanged ||
|
|
140
|
+
// This last check is also to cater for dynamic text sizing changing the 'default' layout width
|
|
194
141
|
// Usually happens on window resize.
|
|
195
142
|
layoutSize !== _this.layoutSize || noOfColumnsChanged) {
|
|
196
143
|
// If column has been inserted/deleted avoid multi dispatch
|
|
@@ -200,37 +147,30 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
200
147
|
layoutChanged: layoutChanged
|
|
201
148
|
});
|
|
202
149
|
}
|
|
203
|
-
|
|
204
150
|
_this.updateParentWidth(parentWidth);
|
|
205
151
|
}
|
|
206
|
-
|
|
207
152
|
_this.updateTableContainerWidth();
|
|
208
|
-
|
|
209
153
|
_this.node = node;
|
|
210
154
|
_this.containerWidth = containerWidth;
|
|
211
155
|
_this.layoutSize = layoutSize;
|
|
212
156
|
});
|
|
213
157
|
(0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "scaleTable", function (scaleOptions) {
|
|
214
158
|
var _this$props2 = _this.props,
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
159
|
+
view = _this$props2.view,
|
|
160
|
+
getNode = _this$props2.getNode,
|
|
161
|
+
getPos = _this$props2.getPos,
|
|
162
|
+
containerWidth = _this$props2.containerWidth,
|
|
163
|
+
options = _this$props2.options;
|
|
220
164
|
var node = getNode();
|
|
221
165
|
var state = view.state,
|
|
222
|
-
|
|
166
|
+
dispatch = view.dispatch;
|
|
223
167
|
var pos = getPos();
|
|
224
|
-
|
|
225
168
|
if (!(0, _utils2.isValidPosition)(pos, state)) {
|
|
226
169
|
return;
|
|
227
170
|
}
|
|
228
|
-
|
|
229
171
|
var domAtPos = view.domAtPos.bind(view);
|
|
230
172
|
var width = containerWidth.width;
|
|
231
|
-
|
|
232
173
|
_this.scaleTableDebounced.cancel();
|
|
233
|
-
|
|
234
174
|
(0, _tableResizing.scaleTable)(_this.table, _objectSpread(_objectSpread({}, scaleOptions), {}, {
|
|
235
175
|
node: node,
|
|
236
176
|
prevNode: _this.node || node,
|
|
@@ -242,19 +182,15 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
242
182
|
(0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "handleAutoSize", function () {
|
|
243
183
|
if (_this.table) {
|
|
244
184
|
var _this$props3 = _this.props,
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
185
|
+
view = _this$props3.view,
|
|
186
|
+
getNode = _this$props3.getNode,
|
|
187
|
+
getPos = _this$props3.getPos,
|
|
188
|
+
containerWidth = _this$props3.containerWidth;
|
|
250
189
|
var _node = getNode();
|
|
251
|
-
|
|
252
190
|
var pos = getPos();
|
|
253
|
-
|
|
254
191
|
if (!(0, _utils2.isValidPosition)(pos, view.state)) {
|
|
255
192
|
return;
|
|
256
193
|
}
|
|
257
|
-
|
|
258
194
|
(0, _commands.autoSizeTable)(view, _node, _this.table, pos, {
|
|
259
195
|
containerWidth: containerWidth.width
|
|
260
196
|
});
|
|
@@ -262,43 +198,34 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
262
198
|
});
|
|
263
199
|
(0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "handleWindowResize", function () {
|
|
264
200
|
var _this$props4 = _this.props,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
201
|
+
getNode = _this$props4.getNode,
|
|
202
|
+
containerWidth = _this$props4.containerWidth;
|
|
268
203
|
var layoutSize = _this.tableNodeLayoutSize(getNode());
|
|
269
|
-
|
|
270
204
|
if (containerWidth.width > layoutSize) {
|
|
271
205
|
return;
|
|
272
206
|
}
|
|
273
|
-
|
|
274
207
|
var parentWidth = _this.getParentNodeWidth();
|
|
275
|
-
|
|
276
208
|
_this.scaleTableDebounced(parentWidth);
|
|
277
209
|
});
|
|
278
210
|
(0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "updateTableContainerWidth", function () {
|
|
279
211
|
var _this$props5 = _this.props,
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
212
|
+
getNode = _this$props5.getNode,
|
|
213
|
+
containerWidth = _this$props5.containerWidth,
|
|
214
|
+
options = _this$props5.options;
|
|
283
215
|
var node = getNode();
|
|
284
|
-
|
|
285
216
|
if (options && options.isBreakoutEnabled === false) {
|
|
286
217
|
return;
|
|
287
218
|
}
|
|
288
|
-
|
|
289
219
|
var tableContainerWidth = (0, _styles.calcTableWidth)(node.attrs.layout, containerWidth.width);
|
|
290
|
-
|
|
291
220
|
if (_this.state.tableContainerWidth === tableContainerWidth) {
|
|
292
221
|
return null;
|
|
293
222
|
}
|
|
294
|
-
|
|
295
223
|
_this.setState(function (prevState) {
|
|
296
224
|
if (options && options.isBreakoutEnabled === false && prevState.tableContainerWidth !== 'inherit') {
|
|
297
225
|
return {
|
|
298
226
|
tableContainerWidth: 'inherit'
|
|
299
227
|
};
|
|
300
228
|
}
|
|
301
|
-
|
|
302
229
|
return {
|
|
303
230
|
tableContainerWidth: tableContainerWidth
|
|
304
231
|
};
|
|
@@ -306,16 +233,14 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
306
233
|
});
|
|
307
234
|
(0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "getParentNodeWidth", function () {
|
|
308
235
|
var _this$props6 = _this.props,
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
236
|
+
getPos = _this$props6.getPos,
|
|
237
|
+
containerWidth = _this$props6.containerWidth,
|
|
238
|
+
options = _this$props6.options,
|
|
239
|
+
state = _this$props6.view.state;
|
|
313
240
|
var pos = getPos();
|
|
314
|
-
|
|
315
241
|
if (!(0, _utils2.isValidPosition)(pos, state)) {
|
|
316
242
|
return;
|
|
317
243
|
}
|
|
318
|
-
|
|
319
244
|
return (0, _nodeWidth.getParentNodeWidth)(pos, state, containerWidth, options && options.isFullWidthModeEnabled);
|
|
320
245
|
});
|
|
321
246
|
(0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "updateParentWidth", function (width) {
|
|
@@ -332,18 +257,20 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
332
257
|
(0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "handleAutoSizeDebounced", (0, _rafSchd.default)(_this.handleAutoSize));
|
|
333
258
|
(0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "handleWindowResizeDebounced", (0, _rafSchd.default)(_this.handleWindowResize));
|
|
334
259
|
var _options = props.options,
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
260
|
+
_containerWidth = props.containerWidth,
|
|
261
|
+
_getNode = props.getNode,
|
|
262
|
+
getEditorFeatureFlags = props.getEditorFeatureFlags;
|
|
338
263
|
_this.node = _getNode();
|
|
339
|
-
_this.containerWidth = _containerWidth;
|
|
264
|
+
_this.containerWidth = _containerWidth;
|
|
340
265
|
|
|
266
|
+
// store table size using previous full-width mode so can detect if it has changed
|
|
341
267
|
var isFullWidthModeEnabled = _options ? _options.wasFullWidthModeEnabled : false;
|
|
342
268
|
_this.layoutSize = _this.tableNodeLayoutSize(_this.node, _containerWidth.width, {
|
|
343
269
|
isFullWidthModeEnabled: isFullWidthModeEnabled
|
|
344
|
-
});
|
|
345
|
-
// https://github.com/ProseMirror/prosemirror/issues/432
|
|
270
|
+
});
|
|
346
271
|
|
|
272
|
+
// Disable inline table editing and resizing controls in Firefox
|
|
273
|
+
// https://github.com/ProseMirror/prosemirror/issues/432
|
|
347
274
|
if ('execCommand' in document) {
|
|
348
275
|
['enableObjectResizing', 'enableInlineTableEditing'].forEach(function (cmd) {
|
|
349
276
|
if (document.queryCommandSupported(cmd)) {
|
|
@@ -351,10 +278,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
351
278
|
}
|
|
352
279
|
});
|
|
353
280
|
}
|
|
354
|
-
|
|
355
281
|
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
356
|
-
|
|
357
|
-
|
|
282
|
+
initialRenderOptimization = _getEditorFeatureFlag.initialRenderOptimization;
|
|
358
283
|
if (!initialRenderOptimization) {
|
|
359
284
|
// @see ED-7945
|
|
360
285
|
requestAnimationFrame(function () {
|
|
@@ -363,21 +288,17 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
363
288
|
});
|
|
364
289
|
});
|
|
365
290
|
}
|
|
366
|
-
|
|
367
291
|
return _this;
|
|
368
292
|
}
|
|
369
|
-
|
|
370
293
|
(0, _createClass2.default)(TableComponent, [{
|
|
371
294
|
key: "componentDidMount",
|
|
372
295
|
value: function componentDidMount() {
|
|
373
296
|
var _this$props7 = this.props,
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
297
|
+
allowColumnResizing = _this$props7.allowColumnResizing,
|
|
298
|
+
eventDispatcher = _this$props7.eventDispatcher;
|
|
377
299
|
if (allowColumnResizing && this.wrapper && !isIE11) {
|
|
378
300
|
this.wrapper.addEventListener('scroll', this.handleScrollDebounced);
|
|
379
301
|
}
|
|
380
|
-
|
|
381
302
|
if (allowColumnResizing) {
|
|
382
303
|
/**
|
|
383
304
|
* We no longer use `containerWidth` as a variable to determine an update for table resizing (avoids unnecessary updates).
|
|
@@ -387,13 +308,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
387
308
|
this.updateTableContainerWidth();
|
|
388
309
|
this.handleTableResizingDebounced();
|
|
389
310
|
}
|
|
390
|
-
|
|
391
311
|
var currentStickyState = _stickyHeaders.pluginKey.getState(this.props.view.state);
|
|
392
|
-
|
|
393
312
|
if (currentStickyState) {
|
|
394
313
|
this.onStickyState(currentStickyState);
|
|
395
314
|
}
|
|
396
|
-
|
|
397
315
|
eventDispatcher.on(_stickyHeaders.pluginKey.key, this.onStickyState);
|
|
398
316
|
}
|
|
399
317
|
}, {
|
|
@@ -402,78 +320,63 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
402
320
|
if (this.wrapper && !isIE11) {
|
|
403
321
|
this.wrapper.removeEventListener('scroll', this.handleScrollDebounced);
|
|
404
322
|
}
|
|
405
|
-
|
|
406
323
|
this.handleScrollDebounced.cancel();
|
|
407
324
|
this.scaleTableDebounced.cancel();
|
|
408
325
|
this.handleTableResizingDebounced.cancel();
|
|
409
326
|
this.handleAutoSizeDebounced.cancel();
|
|
410
327
|
this.handleWindowResizeDebounced.cancel();
|
|
411
|
-
|
|
412
328
|
if (this.props.allowColumnResizing) {
|
|
413
329
|
window.removeEventListener('resize', this.handleWindowResizeDebounced);
|
|
414
330
|
}
|
|
415
|
-
|
|
416
331
|
if (this.overflowShadowsObserver) {
|
|
417
332
|
this.overflowShadowsObserver.dispose();
|
|
418
333
|
}
|
|
419
|
-
|
|
420
334
|
this.props.eventDispatcher.off(_stickyHeaders.pluginKey.key, this.onStickyState);
|
|
421
335
|
}
|
|
422
336
|
}, {
|
|
423
337
|
key: "componentDidUpdate",
|
|
424
338
|
value: function componentDidUpdate(prevProps) {
|
|
425
339
|
var _this$props8 = this.props,
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
340
|
+
view = _this$props8.view,
|
|
341
|
+
getNode = _this$props8.getNode,
|
|
342
|
+
isMediaFullscreen = _this$props8.isMediaFullscreen,
|
|
343
|
+
allowColumnResizing = _this$props8.allowColumnResizing;
|
|
431
344
|
var _getPluginState = (0, _pluginFactory.getPluginState)(view.state),
|
|
432
|
-
|
|
433
|
-
|
|
345
|
+
isInDanger = _getPluginState.isInDanger;
|
|
434
346
|
var table = (0, _utils.findTable)(view.state.selection);
|
|
435
|
-
|
|
436
347
|
if (isInDanger && !table) {
|
|
437
348
|
(0, _commands.clearHoverSelection)()(view.state, view.dispatch);
|
|
438
349
|
}
|
|
439
|
-
|
|
440
350
|
var _this$props$getEditor3 = this.props.getEditorFeatureFlags(),
|
|
441
|
-
|
|
442
|
-
|
|
351
|
+
tableOverflowShadowsOptimization = _this$props$getEditor3.tableOverflowShadowsOptimization;
|
|
443
352
|
if (!tableOverflowShadowsOptimization) {
|
|
444
353
|
this.updateShadows();
|
|
445
354
|
} else {
|
|
446
355
|
var _this$wrapper;
|
|
447
|
-
|
|
448
356
|
if ((_this$wrapper = this.wrapper) !== null && _this$wrapper !== void 0 && _this$wrapper.parentElement && this.table && !this.overflowShadowsObserver) {
|
|
449
357
|
this.overflowShadowsObserver = new _OverflowShadowsObserver.OverflowShadowsObserver(this.updateShadowState, this.table, this.wrapper);
|
|
450
358
|
}
|
|
451
|
-
|
|
452
359
|
if (this.overflowShadowsObserver) {
|
|
453
360
|
var _this$state$stickyHea;
|
|
454
|
-
|
|
455
361
|
this.overflowShadowsObserver.observeCells((_this$state$stickyHea = this.state.stickyHeader) === null || _this$state$stickyHea === void 0 ? void 0 : _this$state$stickyHea.sticky, (0, _utils4.containsHeaderRow)(getNode()));
|
|
456
362
|
}
|
|
457
363
|
}
|
|
458
|
-
|
|
459
364
|
var currentTable = getNode();
|
|
460
|
-
|
|
461
365
|
if (currentTable.attrs.__autoSize) {
|
|
462
366
|
// Wait for next tick to handle auto sizing, gives the browser time to do layout calc etc.
|
|
463
367
|
this.handleAutoSizeDebounced();
|
|
464
|
-
}
|
|
368
|
+
}
|
|
369
|
+
// re-drawing will cause media component get unmounted that will exit fullscreen mode if media is in fullscreen mode
|
|
465
370
|
// see https://product-fabric.atlassian.net/browse/MEX-1290
|
|
466
371
|
else if (allowColumnResizing && this.table && !isMediaFullscreen) {
|
|
467
372
|
// If col widths (e.g. via collab) or number of columns (e.g. delete a column) have changed,
|
|
468
373
|
// re-draw colgroup.
|
|
469
374
|
var previousTable = this.node;
|
|
470
|
-
|
|
471
375
|
if ((0, _utils4.tablesHaveDifferentColumnWidths)(currentTable, previousTable) || (0, _utils4.tablesHaveDifferentNoOfColumns)(currentTable, previousTable)) {
|
|
472
376
|
var _view = this.props.view;
|
|
473
377
|
(0, _utils3.insertColgroupFromNode)(this.table, currentTable);
|
|
474
378
|
(0, _dom.updateControls)(this.props.getEditorFeatureFlags)(_view.state);
|
|
475
379
|
}
|
|
476
|
-
|
|
477
380
|
this.handleTableResizingDebounced();
|
|
478
381
|
}
|
|
479
382
|
}
|
|
@@ -481,9 +384,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
481
384
|
key: "updateShadows",
|
|
482
385
|
value: function updateShadows() {
|
|
483
386
|
var _this$wrapper2;
|
|
484
|
-
|
|
485
387
|
var parent = (_this$wrapper2 = this.wrapper) === null || _this$wrapper2 === void 0 ? void 0 : _this$wrapper2.parentElement;
|
|
486
|
-
|
|
487
388
|
if (this.wrapper && parent) {
|
|
488
389
|
var rightShadows = parent.querySelectorAll(".".concat(_types.TableCssClassName.TABLE_RIGHT_SHADOW));
|
|
489
390
|
var leftShadows = parent.querySelectorAll(".".concat(_types.TableCssClassName.TABLE_LEFT_SHADOW));
|
|
@@ -494,43 +395,40 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
494
395
|
key: "render",
|
|
495
396
|
value: function render() {
|
|
496
397
|
var _classnames,
|
|
497
|
-
|
|
498
|
-
|
|
398
|
+
_this2 = this;
|
|
499
399
|
var _this$props9 = this.props,
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
400
|
+
view = _this$props9.view,
|
|
401
|
+
getNode = _this$props9.getNode,
|
|
402
|
+
tableResizingPluginState = _this$props9.tableResizingPluginState,
|
|
403
|
+
_this$props9$allowCon = _this$props9.allowControls,
|
|
404
|
+
allowControls = _this$props9$allowCon === void 0 ? true : _this$props9$allowCon,
|
|
405
|
+
isHeaderRowEnabled = _this$props9.isHeaderRowEnabled,
|
|
406
|
+
ordering = _this$props9.ordering,
|
|
407
|
+
isHeaderColumnEnabled = _this$props9.isHeaderColumnEnabled,
|
|
408
|
+
tableActive = _this$props9.tableActive,
|
|
409
|
+
containerWidth = _this$props9.containerWidth;
|
|
510
410
|
var _this$state = this.state,
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
var node = getNode();
|
|
516
|
-
|
|
411
|
+
isLoading = _this$state.isLoading,
|
|
412
|
+
tableContainerWidth = _this$state.tableContainerWidth,
|
|
413
|
+
showBeforeShadow = _this$state.showBeforeShadow,
|
|
414
|
+
showAfterShadow = _this$state.showAfterShadow;
|
|
415
|
+
var node = getNode();
|
|
416
|
+
// doesn't work well with WithPluginState
|
|
517
417
|
var _getPluginState2 = (0, _pluginFactory.getPluginState)(view.state),
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
418
|
+
isInDanger = _getPluginState2.isInDanger,
|
|
419
|
+
hoveredRows = _getPluginState2.hoveredRows;
|
|
521
420
|
var _this$props$getEditor4 = this.props.getEditorFeatureFlags(),
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
421
|
+
stickyHeadersOptimization = _this$props$getEditor4.stickyHeadersOptimization,
|
|
422
|
+
initialRenderOptimization = _this$props$getEditor4.initialRenderOptimization,
|
|
423
|
+
tableRenderOptimization = _this$props$getEditor4.tableRenderOptimization,
|
|
424
|
+
tableOverflowShadowsOptimization = _this$props$getEditor4.tableOverflowShadowsOptimization;
|
|
527
425
|
var tableRef = this.table || undefined;
|
|
528
426
|
var isResizing = !!tableResizingPluginState && !!tableResizingPluginState.dragging;
|
|
529
|
-
var headerRow = tableRef ? tableRef.querySelector('tr[data-header-row]') : undefined;
|
|
427
|
+
var headerRow = tableRef ? tableRef.querySelector('tr[data-header-row]') : undefined;
|
|
530
428
|
|
|
429
|
+
//dont need to change tableHeight with tableRenderOptimization because it will be observed inside floating components
|
|
531
430
|
var tableHeight = tableRef && !tableRenderOptimization ? tableRef.offsetHeight : undefined;
|
|
532
431
|
var hasHeaderRow = (0, _utils4.containsHeaderRow)(node);
|
|
533
|
-
|
|
534
432
|
var rowControls = /*#__PURE__*/_react.default.createElement("div", {
|
|
535
433
|
className: _types.TableCssClassName.ROW_CONTROLS_WRAPPER
|
|
536
434
|
}, /*#__PURE__*/_react.default.createElement(_TableFloatingControls.default, {
|
|
@@ -544,7 +442,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
544
442
|
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
545
443
|
ordering: ordering,
|
|
546
444
|
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
547
|
-
hasHeaderRow: hasHeaderRow
|
|
445
|
+
hasHeaderRow: hasHeaderRow
|
|
446
|
+
// pass `selection` and `tableHeight` to control re-render
|
|
548
447
|
,
|
|
549
448
|
selection: view.state.selection,
|
|
550
449
|
tableHeight: tableHeight,
|
|
@@ -552,7 +451,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
552
451
|
stickyHeader: this.state.stickyHeader,
|
|
553
452
|
getEditorFeatureFlags: this.props.getEditorFeatureFlags
|
|
554
453
|
}));
|
|
555
|
-
|
|
556
454
|
var shadowPadding = allowControls && (!isLoading || initialRenderOptimization) && tableActive ? -_editorSharedStyles.akEditorTableToolbarSize : _styles.tableMarginSides;
|
|
557
455
|
var shadowStyle = tableOverflowShadowsOptimization ? (0, _memoizeOne.default)(function (visible) {
|
|
558
456
|
return {
|
|
@@ -583,12 +481,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
583
481
|
className: (0, _classnames2.default)(_types.TableCssClassName.TABLE_NODE_WRAPPER),
|
|
584
482
|
ref: function ref(elem) {
|
|
585
483
|
_this2.wrapper = elem;
|
|
586
|
-
|
|
587
484
|
if (elem) {
|
|
588
485
|
_this2.props.contentDOM(elem);
|
|
589
|
-
|
|
590
486
|
var tableElement = elem.querySelector('table');
|
|
591
|
-
|
|
592
487
|
if (tableElement !== _this2.table) {
|
|
593
488
|
_this2.table = tableElement;
|
|
594
489
|
}
|
|
@@ -616,7 +511,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
616
511
|
}]);
|
|
617
512
|
return TableComponent;
|
|
618
513
|
}(_react.default.Component);
|
|
619
|
-
|
|
620
514
|
(0, _defineProperty3.default)(TableComponent, "displayName", 'TableComponent');
|
|
621
515
|
var _default = TableComponent;
|
|
622
516
|
exports.default = _default;
|