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