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