@atlaskit/editor-plugin-table 5.0.0 → 5.2.0
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/plugins/table/index.js +47 -37
- package/dist/cjs/plugins/table/nodeviews/TableCell.js +111 -0
- package/dist/cjs/plugins/table/nodeviews/TableNodeViewBase.js +30 -0
- package/dist/cjs/plugins/table/{pm-plugins/sticky-headers/nodeviews/tableRow.js → nodeviews/TableRow.js} +313 -307
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/actions.js +12 -0
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/commands.js +27 -0
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/consts.js +11 -0
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/index.js +32 -0
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin-factory.js +13 -0
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin-key.js +8 -0
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +28 -0
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/reducer.js +28 -0
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/types.js +5 -0
- package/dist/cjs/plugins/table/pm-plugins/main.js +16 -13
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/index.js +1 -8
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin.js +1 -9
- package/dist/cjs/plugins/table/utils/dom.js +31 -1
- package/dist/cjs/plugins/table/utils/index.js +12 -0
- package/dist/cjs/plugins/table/utils/nodes.js +31 -7
- package/dist/es2019/plugins/table/index.js +12 -3
- package/dist/es2019/plugins/table/nodeviews/{tableCell.js → TableCell.js} +28 -24
- package/dist/es2019/plugins/table/nodeviews/TableNodeViewBase.js +22 -0
- package/dist/es2019/plugins/table/{pm-plugins/sticky-headers/nodeviews/tableRow.js → nodeviews/TableRow.js} +273 -284
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/actions.js +6 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/commands.js +14 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/consts.js +5 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/index.js +3 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin-factory.js +8 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin-key.js +2 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +22 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/reducer.js +20 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/types.js +1 -0
- package/dist/es2019/plugins/table/pm-plugins/main.js +8 -8
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/index.js +1 -2
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/plugin.js +1 -9
- package/dist/es2019/plugins/table/utils/dom.js +30 -0
- package/dist/es2019/plugins/table/utils/index.js +1 -1
- package/dist/es2019/plugins/table/utils/nodes.js +16 -0
- package/dist/esm/plugins/table/index.js +47 -37
- package/dist/esm/plugins/table/nodeviews/TableCell.js +105 -0
- package/dist/esm/plugins/table/nodeviews/TableNodeViewBase.js +24 -0
- package/dist/esm/plugins/table/{pm-plugins/sticky-headers/nodeviews/tableRow.js → nodeviews/TableRow.js} +314 -307
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/actions.js +6 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/commands.js +22 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/consts.js +5 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/index.js +3 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin-factory.js +7 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin-key.js +2 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +22 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/reducer.js +21 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/types.js +1 -0
- package/dist/esm/plugins/table/pm-plugins/main.js +16 -13
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/index.js +1 -2
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/plugin.js +1 -9
- package/dist/esm/plugins/table/utils/dom.js +30 -0
- package/dist/esm/plugins/table/utils/index.js +1 -1
- package/dist/esm/plugins/table/utils/nodes.js +24 -0
- package/dist/types/plugins/table/nodeviews/TableCell.d.ts +13 -0
- package/dist/types/plugins/table/nodeviews/TableNodeViewBase.d.ts +18 -0
- package/dist/types/plugins/table/nodeviews/TableRow.d.ts +60 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/actions.d.ts +15 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +4 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/consts.d.ts +6 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/index.d.ts +4 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/plugin-factory.d.ts +2 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/plugin-key.d.ts +3 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/plugin.d.ts +3 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/reducer.d.ts +4 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/types.d.ts +5 -0
- package/dist/types/plugins/table/pm-plugins/main.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/sticky-headers/index.d.ts +0 -1
- package/dist/types/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +1 -1
- package/dist/types/plugins/table/types.d.ts +1 -0
- package/dist/types/plugins/table/utils/dom.d.ts +6 -0
- package/dist/types/plugins/table/utils/index.d.ts +1 -1
- package/dist/types/plugins/table/utils/nodes.d.ts +12 -2
- package/dist/types-ts4.5/i18n/cs.d.ts +37 -0
- package/dist/types-ts4.5/i18n/da.d.ts +35 -0
- package/dist/types-ts4.5/i18n/de.d.ts +35 -0
- package/dist/types-ts4.5/i18n/en.d.ts +37 -0
- package/dist/types-ts4.5/i18n/en_GB.d.ts +37 -0
- package/dist/types-ts4.5/i18n/en_ZZ.d.ts +37 -0
- package/dist/types-ts4.5/i18n/es.d.ts +35 -0
- package/dist/types-ts4.5/i18n/fi.d.ts +35 -0
- package/dist/types-ts4.5/i18n/fr.d.ts +37 -0
- package/dist/types-ts4.5/i18n/hu.d.ts +37 -0
- package/dist/types-ts4.5/i18n/it.d.ts +37 -0
- package/dist/types-ts4.5/i18n/ja.d.ts +37 -0
- package/dist/types-ts4.5/i18n/ko.d.ts +35 -0
- package/dist/types-ts4.5/i18n/nb.d.ts +35 -0
- package/dist/types-ts4.5/i18n/nl.d.ts +37 -0
- package/dist/types-ts4.5/i18n/pl.d.ts +37 -0
- package/dist/types-ts4.5/i18n/pt_BR.d.ts +37 -0
- package/dist/types-ts4.5/i18n/ru.d.ts +37 -0
- package/dist/types-ts4.5/i18n/sv.d.ts +35 -0
- package/dist/types-ts4.5/i18n/th.d.ts +35 -0
- package/dist/types-ts4.5/i18n/tr.d.ts +37 -0
- package/dist/types-ts4.5/i18n/uk.d.ts +37 -0
- package/dist/types-ts4.5/i18n/vi.d.ts +35 -0
- package/dist/types-ts4.5/i18n/zh.d.ts +37 -0
- package/dist/types-ts4.5/i18n/zh_TW.d.ts +37 -0
- package/dist/types-ts4.5/index.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/commands/clear.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/commands/collapse.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/commands/delete.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/commands/go-to-next-cell.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/commands/hover.d.ts +8 -0
- package/dist/types-ts4.5/plugins/table/commands/index.d.ts +8 -0
- package/dist/types-ts4.5/plugins/table/commands/insert.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/commands/misc.d.ts +29 -0
- package/dist/types-ts4.5/plugins/table/commands/referentiality.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/commands/selection.d.ts +8 -0
- package/dist/types-ts4.5/plugins/table/commands/sort.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/commands/split-cell.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/commands/toggle.d.ts +12 -0
- package/dist/types-ts4.5/plugins/table/commands-with-analytics.d.ts +25 -0
- package/dist/types-ts4.5/plugins/table/create-plugin-config.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/event-handlers.d.ts +15 -0
- package/dist/types-ts4.5/plugins/table/handlers.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/index.d.ts +38 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/OverflowShadowsObserver.d.ts +24 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/TableCell.d.ts +13 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +73 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/TableContainer.d.ts +44 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/TableNodeViewBase.d.ts +18 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/TableResizer.d.ts +25 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/TableRow.d.ts +60 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/TableStickyScrollbar.d.ts +24 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/__mocks__/OverflowShadowsObserver.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/__mocks__/OverridableMock.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/table.d.ts +33 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/types.d.ts +26 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/update-overflow-shadows.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/plugin.d.ts +7 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/compose-decorations.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/index.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/types.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/default-table-selection.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/actions.d.ts +15 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/consts.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/index.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/plugin-factory.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/plugin.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/reducer.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/types.d.ts +5 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/keymap.d.ts +5 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +8 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/plugin-factory.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +15 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/commands.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/index.d.ts +5 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin-state.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/types.d.ts +16 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/util.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-analytics.d.ts +23 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-local-id.d.ts +10 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/commands.d.ts +23 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/index.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin-factory.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/reducer.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +23 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/column-state.d.ts +14 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/consts.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/content-width.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +12 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/index.d.ts +13 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +20 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-logic.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +29 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +21 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +22 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-selection-keymap.d.ts +5 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-width.d.ts +17 -0
- package/dist/types-ts4.5/plugins/table/reducer.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/toolbar.d.ts +36 -0
- package/dist/types-ts4.5/plugins/table/transforms/column-width.d.ts +37 -0
- package/dist/types-ts4.5/plugins/table/transforms/delete-columns.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/transforms/delete-rows.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/transforms/fix-tables.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/transforms/index.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/transforms/merge.d.ts +5 -0
- package/dist/types-ts4.5/plugins/table/transforms/replace-table.d.ts +5 -0
- package/dist/types-ts4.5/plugins/table/transforms/split.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/types.d.ts +343 -0
- package/dist/types-ts4.5/plugins/table/ui/ColumnResizeWidget/index.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/FixedButton.d.ts +23 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/index.d.ts +21 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/styles.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/ContextualMenu.d.ts +87 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/index.d.ts +23 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/styles.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/DeleteButton.d.ts +13 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.d.ts +10 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/index.d.ts +54 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/types.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +13 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/index.d.ts +35 -0
- package/dist/types-ts4.5/plugins/table/ui/LayoutButton/index.d.ts +21 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +16 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +21 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +17 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +39 -0
- package/dist/types-ts4.5/plugins/table/ui/common-styles.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +50 -0
- package/dist/types-ts4.5/plugins/table/ui/messages.d.ts +63 -0
- package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +15 -0
- package/dist/types-ts4.5/plugins/table/utils/analytics.d.ts +45 -0
- package/dist/types-ts4.5/plugins/table/utils/collapse.d.ts +29 -0
- package/dist/types-ts4.5/plugins/table/utils/column-controls.d.ts +10 -0
- package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +19 -0
- package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +26 -0
- package/dist/types-ts4.5/plugins/table/utils/get-allow-add-column-custom-step.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/utils/guidelines.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/utils/index.d.ts +11 -0
- package/dist/types-ts4.5/plugins/table/utils/nodes.d.ts +23 -0
- package/dist/types-ts4.5/plugins/table/utils/paste.d.ts +14 -0
- package/dist/types-ts4.5/plugins/table/utils/row-controls.d.ts +16 -0
- package/dist/types-ts4.5/plugins/table/utils/selection.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/utils/snapping.d.ts +10 -0
- package/dist/types-ts4.5/plugins/table/utils/table.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/utils/update-plugin-state-decorations.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table-plugin.d.ts +2 -0
- package/dist/types-ts4.5/types/i18n.d.ts +5 -0
- package/package.json +3 -3
- package/report.api.md +2 -17
- package/src/__tests__/unit/nodeviews/cell.ts +2 -2
- package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +25 -148
- package/src/plugins/table/index.tsx +14 -0
- package/src/plugins/table/nodeviews/{tableCell.tsx → TableCell.ts} +41 -46
- package/src/plugins/table/nodeviews/TableNodeViewBase.ts +32 -0
- package/src/plugins/table/{pm-plugins/sticky-headers/nodeviews/tableRow.ts → nodeviews/TableRow.ts} +193 -246
- package/src/plugins/table/pm-plugins/drag-and-drop/actions.ts +29 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/commands.ts +32 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/consts.ts +8 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/index.ts +5 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/plugin-factory.ts +8 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/plugin-key.ts +7 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +32 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/reducer.ts +26 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/types.ts +6 -0
- package/src/plugins/table/pm-plugins/main.ts +10 -19
- package/src/plugins/table/pm-plugins/sticky-headers/index.ts +0 -1
- package/src/plugins/table/pm-plugins/sticky-headers/plugin.ts +1 -9
- package/src/plugins/table/types.ts +2 -0
- package/src/plugins/table/utils/dom.ts +38 -0
- package/src/plugins/table/utils/index.ts +2 -0
- package/src/plugins/table/utils/nodes.ts +30 -2
- package/tmp/api-report-tmp.d.ts +100 -0
- package/dist/cjs/plugins/table/nodeviews/tableCell.js +0 -99
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +0 -35
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +0 -29
- package/dist/esm/plugins/table/nodeviews/tableCell.js +0 -93
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +0 -29
- package/dist/types/plugins/table/nodeviews/tableCell.d.ts +0 -17
- package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.d.ts +0 -6
- package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +0 -73
- package/src/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.ts +0 -37
|
@@ -4,288 +4,156 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.default = void 0;
|
|
8
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
10
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
15
|
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
12
16
|
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
13
17
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
14
18
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var _dom = require("
|
|
19
|
-
var
|
|
20
|
-
var
|
|
19
|
+
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
20
|
+
var _pluginKey = require("../pm-plugins/plugin-key");
|
|
21
|
+
var _commands = require("../pm-plugins/sticky-headers/commands");
|
|
22
|
+
var _dom = require("../pm-plugins/table-resizing/utils/dom");
|
|
23
|
+
var _types = require("../types");
|
|
24
|
+
var _consts = require("../ui/consts");
|
|
25
|
+
var _dom2 = require("../utils/dom");
|
|
26
|
+
var _nodes = require("../utils/nodes");
|
|
27
|
+
var _TableNodeViewBase = _interopRequireDefault(require("./TableNodeViewBase"));
|
|
28
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
29
|
+
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; } }
|
|
21
30
|
// limit scroll event calls
|
|
22
31
|
var HEADER_ROW_SCROLL_THROTTLE_TIMEOUT = 200;
|
|
23
32
|
|
|
24
33
|
// timeout for resetting the scroll class - if it’s too long then users won’t be able to click on the header cells,
|
|
25
34
|
// if too short it would trigger too many dom updates.
|
|
26
35
|
var HEADER_ROW_SCROLL_RESET_DEBOUNCE_TIMEOUT = 400;
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return child.type.name === 'tableHeader';
|
|
46
|
-
}).every(Boolean);
|
|
47
|
-
var someMerged = anyChildCellMergedAcrossRow(node);
|
|
48
|
-
return allHeaders && !someMerged;
|
|
49
|
-
};
|
|
50
|
-
var TableRowNodeView = exports.TableRowNodeView = /*#__PURE__*/function () {
|
|
51
|
-
function TableRowNodeView(node, view, getPos, eventDispatcher) {
|
|
52
|
-
var _this = this;
|
|
53
|
-
(0, _classCallCheck2.default)(this, TableRowNodeView);
|
|
54
|
-
// this is the sticky header table row
|
|
55
|
-
(0, _defineProperty2.default)(this, "colControlsOffset", 0);
|
|
56
|
-
(0, _defineProperty2.default)(this, "focused", false);
|
|
57
|
-
(0, _defineProperty2.default)(this, "topPosEditorElement", 0);
|
|
58
|
-
(0, _defineProperty2.default)(this, "sentinels", {});
|
|
59
|
-
/* external events */
|
|
60
|
-
(0, _defineProperty2.default)(this, "listening", false);
|
|
61
|
-
(0, _defineProperty2.default)(this, "headerRowMouseScrollEnd", (0, _debounce.default)(function () {
|
|
36
|
+
var TableRow = exports.default = /*#__PURE__*/function (_ref) {
|
|
37
|
+
(0, _inherits2.default)(TableRow, _ref);
|
|
38
|
+
var _super = _createSuper(TableRow);
|
|
39
|
+
function TableRow(node, view, getPos, eventDispatcher) {
|
|
40
|
+
var _this;
|
|
41
|
+
(0, _classCallCheck2.default)(this, TableRow);
|
|
42
|
+
_this = _super.call(this, node, view, getPos, eventDispatcher);
|
|
43
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "colControlsOffset", 0);
|
|
44
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "focused", false);
|
|
45
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "topPosEditorElement", 0);
|
|
46
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sentinels", {});
|
|
47
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "listening", false);
|
|
48
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "padding", 0);
|
|
49
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "top", 0);
|
|
50
|
+
/**
|
|
51
|
+
* Methods
|
|
52
|
+
*/
|
|
53
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "headerRowMouseScrollEnd", (0, _debounce.default)(function () {
|
|
62
54
|
_this.dom.classList.remove('no-pointer-events');
|
|
63
55
|
}, HEADER_ROW_SCROLL_RESET_DEBOUNCE_TIMEOUT));
|
|
64
56
|
// When the header is sticky, the header row is set to position: fixed
|
|
65
57
|
// This prevents mouse wheel scrolling on the scroll-parent div when user's mouse is hovering the header row.
|
|
66
58
|
// This fix sets pointer-events: none on the header row briefly to avoid this behaviour
|
|
67
|
-
(0, _defineProperty2.default)(
|
|
59
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "headerRowMouseScroll", (0, _throttle.default)(function () {
|
|
68
60
|
if (_this.isSticky) {
|
|
69
61
|
_this.dom.classList.add('no-pointer-events');
|
|
70
62
|
_this.headerRowMouseScrollEnd();
|
|
71
63
|
}
|
|
72
64
|
}, HEADER_ROW_SCROLL_THROTTLE_TIMEOUT));
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
if (el) {
|
|
85
|
-
delete el.dataset.isObserved;
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
var isCurrentTableSelected = tableRef === tree.table;
|
|
90
|
-
|
|
91
|
-
// If current table selected and header row is toggled off, turn off sticky header
|
|
92
|
-
if (isCurrentTableSelected && !state.isHeaderRowEnabled && _this.tree) {
|
|
93
|
-
_this.makeRowHeaderNotSticky(_this.tree.table);
|
|
94
|
-
}
|
|
95
|
-
_this.focused = isCurrentTableSelected;
|
|
96
|
-
var wrapper = tree.wrapper;
|
|
97
|
-
var tableContainer = wrapper.parentElement;
|
|
98
|
-
var tableContentWrapper = tableContainer.parentElement;
|
|
99
|
-
var layoutContainer = tableContentWrapper && tableContentWrapper.parentElement;
|
|
100
|
-
if (isCurrentTableSelected) {
|
|
101
|
-
_this.colControlsOffset = _consts.tableControlsSpacing;
|
|
102
|
-
if (layoutContainer && layoutContainer.getAttribute('data-layout-content')) {
|
|
103
|
-
// move table a little out of the way
|
|
104
|
-
// to provide spacing for table controls
|
|
105
|
-
tableContentWrapper.style.paddingLeft = '11px';
|
|
106
|
-
}
|
|
107
|
-
} else {
|
|
108
|
-
_this.colControlsOffset = 0;
|
|
109
|
-
if (layoutContainer && layoutContainer.getAttribute('data-layout-content')) {
|
|
110
|
-
tableContentWrapper.style.removeProperty('padding-left');
|
|
111
|
-
}
|
|
65
|
+
_this.isHeaderRow = (0, _nodes.supportedHeaderRow)(node);
|
|
66
|
+
_this.isSticky = false;
|
|
67
|
+
var _getPluginState = (0, _pluginFactory.getPluginState)(view.state),
|
|
68
|
+
pluginConfig = _getPluginState.pluginConfig,
|
|
69
|
+
isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
|
|
70
|
+
_this.isStickyHeaderEnabled = !!pluginConfig.stickyHeaders;
|
|
71
|
+
_this.isDragAndDropEnabled = !!isDragAndDropEnabled;
|
|
72
|
+
if (_this.isHeaderRow) {
|
|
73
|
+
_this.dom.setAttribute('data-header-row', 'true');
|
|
74
|
+
if (_this.isStickyHeaderEnabled) {
|
|
75
|
+
_this.subscribe();
|
|
112
76
|
}
|
|
77
|
+
}
|
|
78
|
+
return _this;
|
|
79
|
+
}
|
|
113
80
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}, 0);
|
|
118
|
-
});
|
|
119
|
-
(0, _defineProperty2.default)(this, "updateStickyHeaderWidth", function () {
|
|
120
|
-
// table width might have changed, sync that back to sticky row
|
|
121
|
-
var tree = _this.tree;
|
|
122
|
-
if (!tree) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
(0, _dom.syncStickyRowToTable)(tree.table);
|
|
126
|
-
});
|
|
127
|
-
(0, _defineProperty2.default)(this, "shouldHeaderStick", function (tree) {
|
|
128
|
-
var wrapper = tree.wrapper;
|
|
129
|
-
var tableWrapperRect = wrapper.getBoundingClientRect();
|
|
130
|
-
var editorAreaRect = _this.editorScrollableElement.getBoundingClientRect();
|
|
131
|
-
var stickyHeaderRect = _this.contentDOM.getBoundingClientRect();
|
|
132
|
-
var firstHeaderRow = !_this.dom.previousElementSibling;
|
|
133
|
-
var subsequentRows = !!_this.dom.nextElementSibling;
|
|
134
|
-
var isHeaderValid = firstHeaderRow && subsequentRows;
|
|
81
|
+
/**
|
|
82
|
+
* Variables
|
|
83
|
+
*/
|
|
135
84
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
85
|
+
// @ts-ignore
|
|
86
|
+
(0, _createClass2.default)(TableRow, [{
|
|
87
|
+
key: "update",
|
|
88
|
+
value:
|
|
89
|
+
/**
|
|
90
|
+
* Methods: Nodeview Lifecycle
|
|
91
|
+
*/
|
|
92
|
+
function update(node) {
|
|
93
|
+
// do nothing if nodes were identical
|
|
94
|
+
if (node === this.node) {
|
|
140
95
|
return true;
|
|
141
96
|
}
|
|
142
97
|
|
|
143
|
-
// if
|
|
144
|
-
|
|
145
|
-
|
|
98
|
+
// see if we're changing into a header row or
|
|
99
|
+
// changing away from one
|
|
100
|
+
var newNodeIsHeaderRow = (0, _nodes.supportedHeaderRow)(node);
|
|
101
|
+
if (this.isHeaderRow !== newNodeIsHeaderRow) {
|
|
102
|
+
return false; // re-create nodeview
|
|
146
103
|
}
|
|
147
104
|
|
|
148
|
-
//
|
|
149
|
-
|
|
150
|
-
});
|
|
151
|
-
/**
|
|
152
|
-
* Manually refire the intersection observers.
|
|
153
|
-
* Useful when the header may have detached from the table.
|
|
154
|
-
*/
|
|
155
|
-
(0, _defineProperty2.default)(this, "refireIntersectionObservers", function () {
|
|
156
|
-
if (_this.isSticky) {
|
|
157
|
-
[_this.sentinels.top, _this.sentinels.bottom].forEach(function (el) {
|
|
158
|
-
if (el && _this.intersectionObserver) {
|
|
159
|
-
_this.intersectionObserver.unobserve(el);
|
|
160
|
-
_this.intersectionObserver.observe(el);
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
(0, _defineProperty2.default)(this, "makeHeaderRowSticky", function (tree, scrollTop) {
|
|
166
|
-
var _tbody$firstChild;
|
|
167
|
-
// If header row height is more than 50% of viewport height don't do this
|
|
168
|
-
if (_this.isSticky || _this.stickyRowHeight && _this.stickyRowHeight > window.innerHeight / 2) {
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
var table = tree.table,
|
|
172
|
-
wrapper = tree.wrapper;
|
|
105
|
+
// node is different but no need to re-create nodeview
|
|
106
|
+
this.node = node;
|
|
173
107
|
|
|
174
|
-
//
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
if (!isFirstHeader) {
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
var currentTableTop = _this.getCurrentTableTop(tree);
|
|
181
|
-
if (!scrollTop) {
|
|
182
|
-
scrollTop = (0, _dom2.getTop)(_this.editorScrollableElement);
|
|
108
|
+
// don't do anything if we're just a regular tr
|
|
109
|
+
if (!this.isHeaderRow) {
|
|
110
|
+
return true;
|
|
183
111
|
}
|
|
184
|
-
var domTop = currentTableTop > 0 ? scrollTop : scrollTop + currentTableTop;
|
|
185
|
-
if (!_this.isSticky) {
|
|
186
|
-
var _this$editorScrollabl;
|
|
187
|
-
(0, _dom.syncStickyRowToTable)(table);
|
|
188
|
-
_this.dom.classList.add('sticky');
|
|
189
|
-
table.classList.add(_types.TableCssClassName.TABLE_STICKY);
|
|
190
|
-
_this.isSticky = true;
|
|
191
112
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
(_this$editorScrollabl = _this.editorScrollableElement) === null || _this$editorScrollabl === void 0 || _this$editorScrollabl.addEventListener('scrollend', _this.refireIntersectionObservers, {
|
|
198
|
-
passive: true,
|
|
199
|
-
once: true
|
|
200
|
-
});
|
|
201
|
-
var fastScrollThresholdMs = 500;
|
|
202
|
-
setTimeout(function () {
|
|
203
|
-
_this.refireIntersectionObservers();
|
|
204
|
-
}, fastScrollThresholdMs);
|
|
205
|
-
}
|
|
206
|
-
_this.dom.style.top = "".concat(domTop, "px");
|
|
207
|
-
(0, _dom.updateStickyMargins)(table);
|
|
208
|
-
_this.dom.scrollLeft = wrapper.scrollLeft;
|
|
209
|
-
_this.emitOn(domTop, _this.colControlsOffset);
|
|
210
|
-
});
|
|
211
|
-
(0, _defineProperty2.default)(this, "makeRowHeaderNotSticky", function (table) {
|
|
212
|
-
var isEditorDestroyed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
213
|
-
if (!_this.isSticky || !table || !_this.dom) {
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
_this.dom.style.removeProperty('width');
|
|
217
|
-
_this.dom.classList.remove('sticky');
|
|
218
|
-
table.classList.remove(_types.TableCssClassName.TABLE_STICKY);
|
|
219
|
-
_this.isSticky = false;
|
|
220
|
-
_this.dom.style.top = '';
|
|
221
|
-
table.style.removeProperty('margin-top');
|
|
222
|
-
_this.emitOff(isEditorDestroyed);
|
|
223
|
-
});
|
|
224
|
-
(0, _defineProperty2.default)(this, "getWrapperoffset", function () {
|
|
225
|
-
var inverse = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
226
|
-
var focusValue = inverse ? !_this.focused : _this.focused;
|
|
227
|
-
return focusValue ? 0 : _consts.tableControlsSpacing;
|
|
228
|
-
});
|
|
229
|
-
(0, _defineProperty2.default)(this, "getWrapperRefTop", function (wrapper) {
|
|
230
|
-
return Math.round((0, _dom2.getTop)(wrapper)) + _this.getWrapperoffset();
|
|
231
|
-
});
|
|
232
|
-
// TODO: rename!
|
|
233
|
-
(0, _defineProperty2.default)(this, "getScrolledTableTop", function (wrapper) {
|
|
234
|
-
return _this.getWrapperRefTop(wrapper) - _this.topPosEditorElement;
|
|
235
|
-
});
|
|
236
|
-
(0, _defineProperty2.default)(this, "getCurrentTableTop", function (tree) {
|
|
237
|
-
return _this.getScrolledTableTop(tree.wrapper) + tree.table.clientHeight;
|
|
238
|
-
});
|
|
239
|
-
/* emit external events */
|
|
240
|
-
(0, _defineProperty2.default)(this, "padding", 0);
|
|
241
|
-
(0, _defineProperty2.default)(this, "top", 0);
|
|
242
|
-
(0, _defineProperty2.default)(this, "emitOn", function (top, padding) {
|
|
243
|
-
if (top === _this.top && padding === _this.padding) {
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
_this.top = top;
|
|
247
|
-
_this.padding = padding;
|
|
248
|
-
(0, _commands.updateStickyState)({
|
|
249
|
-
pos: _this.getPos(),
|
|
250
|
-
top: top,
|
|
251
|
-
sticky: true,
|
|
252
|
-
padding: padding
|
|
253
|
-
})(_this.view.state, _this.view.dispatch, _this.view);
|
|
254
|
-
});
|
|
255
|
-
(0, _defineProperty2.default)(this, "emitOff", function (isEditorDestroyed) {
|
|
256
|
-
if (_this.top === 0 && _this.padding === 0) {
|
|
257
|
-
return;
|
|
113
|
+
// something changed, sync widths
|
|
114
|
+
if (this.isStickyHeaderEnabled) {
|
|
115
|
+
var tbody = this.dom.parentElement;
|
|
116
|
+
var table = tbody && tbody.parentElement;
|
|
117
|
+
(0, _dom.syncStickyRowToTable)(table);
|
|
258
118
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
}, {
|
|
122
|
+
key: "destroy",
|
|
123
|
+
value: function destroy() {
|
|
124
|
+
if (this.isStickyHeaderEnabled) {
|
|
125
|
+
this.unsubscribe();
|
|
126
|
+
var tree = (0, _dom2.getTree)(this.dom);
|
|
127
|
+
if (tree) {
|
|
128
|
+
this.makeRowHeaderNotSticky(tree.table, true);
|
|
129
|
+
}
|
|
130
|
+
this.emitOff(true);
|
|
268
131
|
}
|
|
269
|
-
});
|
|
270
|
-
this.view = view;
|
|
271
|
-
this.node = node;
|
|
272
|
-
this.getPos = getPos;
|
|
273
|
-
this.eventDispatcher = eventDispatcher;
|
|
274
|
-
this.dom = document.createElement('tr');
|
|
275
|
-
this.contentDOM = this.dom;
|
|
276
|
-
this.lastTimePainted = 0;
|
|
277
|
-
this.isHeaderRow = supportedHeaderRow(node);
|
|
278
|
-
this.isSticky = false;
|
|
279
|
-
this.lastStickyTimestamp = undefined;
|
|
280
|
-
if (this.isHeaderRow) {
|
|
281
|
-
this.dom.setAttribute('data-header-row', 'true');
|
|
282
|
-
this.subscribe();
|
|
283
132
|
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
133
|
+
}, {
|
|
134
|
+
key: "ignoreMutation",
|
|
135
|
+
value: function ignoreMutation(mutationRecord) {
|
|
136
|
+
/* tableRows are not directly editable by the user
|
|
137
|
+
* so it should be safe to ignore mutations that we cause
|
|
138
|
+
* by updating styles and classnames on this DOM element
|
|
139
|
+
*
|
|
140
|
+
* Update: should not ignore mutations for row selection to avoid known issue with table selection highlight in firefox
|
|
141
|
+
* Related bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=1289673
|
|
142
|
+
* */
|
|
143
|
+
var isTableSelection = mutationRecord.type === 'selection' && mutationRecord.target.nodeName === 'TR';
|
|
144
|
+
/**
|
|
145
|
+
* Update: should not ignore mutations when an node is added, as this interferes with
|
|
146
|
+
* prosemirrors handling of some language inputs in Safari (ie. Pinyin, Hiragana).
|
|
147
|
+
*
|
|
148
|
+
* In paticular, when a composition occurs at the start of the first node inside a table cell, if the resulting mutation
|
|
149
|
+
* from the composition end is ignored than prosemirror will end up with; invalid table markup nesting and a misplaced
|
|
150
|
+
* selection and insertion.
|
|
151
|
+
*/
|
|
152
|
+
var isNodeInsertion = mutationRecord.type === 'childList' && mutationRecord.target.nodeName === 'TR' && mutationRecord.addedNodes.length;
|
|
153
|
+
if (isTableSelection || isNodeInsertion) {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
return true;
|
|
289
157
|
}
|
|
290
158
|
}, {
|
|
291
159
|
key: "subscribe",
|
|
@@ -295,8 +163,8 @@ var TableRowNodeView = exports.TableRowNodeView = /*#__PURE__*/function () {
|
|
|
295
163
|
this.initObservers();
|
|
296
164
|
this.topPosEditorElement = (0, _dom2.getTop)(this.editorScrollableElement);
|
|
297
165
|
}
|
|
298
|
-
this.eventDispatcher.on('widthPlugin', this.updateStickyHeaderWidth);
|
|
299
|
-
this.eventDispatcher.on(_pluginKey.pluginKey.key, this.onTablePluginState);
|
|
166
|
+
this.eventDispatcher.on('widthPlugin', this.updateStickyHeaderWidth.bind(this));
|
|
167
|
+
this.eventDispatcher.on(_pluginKey.pluginKey.key, this.onTablePluginState.bind(this));
|
|
300
168
|
this.listening = true;
|
|
301
169
|
this.dom.addEventListener('wheel', this.headerRowMouseScroll.bind(this), {
|
|
302
170
|
passive: true
|
|
@@ -350,9 +218,9 @@ var TableRowNodeView = exports.TableRowNodeView = /*#__PURE__*/function () {
|
|
|
350
218
|
this.resizeObserver.observe(this.editorScrollableElement);
|
|
351
219
|
}
|
|
352
220
|
window.requestAnimationFrame(function () {
|
|
353
|
-
var
|
|
221
|
+
var _getTree;
|
|
354
222
|
// we expect tree to be defined after animation frame
|
|
355
|
-
var tableContainer = (
|
|
223
|
+
var tableContainer = (_getTree = (0, _dom2.getTree)(_this2.dom)) === null || _getTree === void 0 ? void 0 : _getTree.wrapper.closest(".".concat(_types.TableCssClassName.NODEVIEW_WRAPPER));
|
|
356
224
|
if (tableContainer) {
|
|
357
225
|
_this2.sentinels.top = tableContainer.getElementsByClassName(_types.TableCssClassName.TABLE_STICKY_SENTINEL_TOP).item(0);
|
|
358
226
|
_this2.sentinels.bottom = tableContainer.getElementsByClassName(_types.TableCssClassName.TABLE_STICKY_SENTINEL_BOTTOM).item(0);
|
|
@@ -374,10 +242,11 @@ var TableRowNodeView = exports.TableRowNodeView = /*#__PURE__*/function () {
|
|
|
374
242
|
value: function createResizeObserver() {
|
|
375
243
|
var _this3 = this;
|
|
376
244
|
this.resizeObserver = new ResizeObserver(function (entries) {
|
|
377
|
-
|
|
245
|
+
var tree = (0, _dom2.getTree)(_this3.dom);
|
|
246
|
+
if (!tree) {
|
|
378
247
|
return;
|
|
379
248
|
}
|
|
380
|
-
var table =
|
|
249
|
+
var table = tree.table;
|
|
381
250
|
entries.forEach(function (entry) {
|
|
382
251
|
var _this3$editorScrollab;
|
|
383
252
|
// On resize of the parent scroll element we need to adjust the width
|
|
@@ -403,10 +272,11 @@ var TableRowNodeView = exports.TableRowNodeView = /*#__PURE__*/function () {
|
|
|
403
272
|
value: function createIntersectionObserver() {
|
|
404
273
|
var _this4 = this;
|
|
405
274
|
this.intersectionObserver = new IntersectionObserver(function (entries, _) {
|
|
406
|
-
|
|
275
|
+
var tree = (0, _dom2.getTree)(_this4.dom);
|
|
276
|
+
if (!tree) {
|
|
407
277
|
return;
|
|
408
278
|
}
|
|
409
|
-
var table =
|
|
279
|
+
var table = tree.table;
|
|
410
280
|
if (table.rows.length < 2) {
|
|
411
281
|
// ED-19307 - When there's only one row in a table the top & bottom sentinels become inverted. This creates some nasty visiblity
|
|
412
282
|
// toggling side-effects because the intersection observers gets confused.
|
|
@@ -425,7 +295,7 @@ var TableRowNodeView = exports.TableRowNodeView = /*#__PURE__*/function () {
|
|
|
425
295
|
var sentinelIsBelowScrollArea = (((_entry$rootBounds2 = entry.rootBounds) === null || _entry$rootBounds2 === void 0 ? void 0 : _entry$rootBounds2.bottom) || 0) < entry.boundingClientRect.bottom;
|
|
426
296
|
if (!entry.isIntersecting && !sentinelIsBelowScrollArea) {
|
|
427
297
|
var _entry$rootBounds3;
|
|
428
|
-
|
|
298
|
+
tree && _this4.makeHeaderRowSticky(tree, (_entry$rootBounds3 = entry.rootBounds) === null || _entry$rootBounds3 === void 0 ? void 0 : _entry$rootBounds3.top);
|
|
429
299
|
_this4.lastStickyTimestamp = Date.now();
|
|
430
300
|
} else {
|
|
431
301
|
table && _this4.makeRowHeaderNotSticky(table);
|
|
@@ -445,7 +315,7 @@ var TableRowNodeView = exports.TableRowNodeView = /*#__PURE__*/function () {
|
|
|
445
315
|
}
|
|
446
316
|
} else if (entry.isIntersecting && sentinelIsAboveScrollArea) {
|
|
447
317
|
var _entry$rootBounds5;
|
|
448
|
-
|
|
318
|
+
tree && _this4.makeHeaderRowSticky(tree, entry === null || entry === void 0 || (_entry$rootBounds5 = entry.rootBounds) === null || _entry$rootBounds5 === void 0 ? void 0 : _entry$rootBounds5.top);
|
|
449
319
|
_this4.lastStickyTimestamp = Date.now();
|
|
450
320
|
}
|
|
451
321
|
}
|
|
@@ -455,72 +325,208 @@ var TableRowNodeView = exports.TableRowNodeView = /*#__PURE__*/function () {
|
|
|
455
325
|
root: this.editorScrollableElement
|
|
456
326
|
});
|
|
457
327
|
}
|
|
458
|
-
|
|
459
|
-
/* paint/update loop */
|
|
328
|
+
/* receive external events */
|
|
460
329
|
}, {
|
|
461
|
-
key: "
|
|
462
|
-
value:
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
if (
|
|
466
|
-
return
|
|
330
|
+
key: "onTablePluginState",
|
|
331
|
+
value: function onTablePluginState(state) {
|
|
332
|
+
var tableRef = state.tableRef;
|
|
333
|
+
var tree = (0, _dom2.getTree)(this.dom);
|
|
334
|
+
if (!tree) {
|
|
335
|
+
return;
|
|
467
336
|
}
|
|
468
337
|
|
|
469
|
-
//
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
338
|
+
// when header rows are toggled off - mark sentinels as unobserved
|
|
339
|
+
if (!state.isHeaderRowEnabled) {
|
|
340
|
+
[this.sentinels.top, this.sentinels.bottom].forEach(function (el) {
|
|
341
|
+
if (el) {
|
|
342
|
+
delete el.dataset.isObserved;
|
|
343
|
+
}
|
|
344
|
+
});
|
|
474
345
|
}
|
|
346
|
+
var isCurrentTableSelected = tableRef === tree.table;
|
|
475
347
|
|
|
476
|
-
//
|
|
477
|
-
|
|
348
|
+
// If current table selected and header row is toggled off, turn off sticky header
|
|
349
|
+
if (isCurrentTableSelected && !state.isHeaderRowEnabled && tree) {
|
|
350
|
+
this.makeRowHeaderNotSticky(tree.table);
|
|
351
|
+
}
|
|
352
|
+
this.focused = isCurrentTableSelected;
|
|
353
|
+
var wrapper = tree.wrapper;
|
|
354
|
+
var tableContainer = wrapper.parentElement;
|
|
355
|
+
var tableContentWrapper = tableContainer.parentElement;
|
|
356
|
+
var layoutContainer = tableContentWrapper && tableContentWrapper.parentElement;
|
|
357
|
+
if (isCurrentTableSelected) {
|
|
358
|
+
this.colControlsOffset = _consts.tableControlsSpacing;
|
|
359
|
+
if (layoutContainer && layoutContainer.getAttribute('data-layout-content')) {
|
|
360
|
+
// move table a little out of the way
|
|
361
|
+
// to provide spacing for table controls
|
|
362
|
+
tableContentWrapper.style.paddingLeft = '11px';
|
|
363
|
+
}
|
|
364
|
+
} else {
|
|
365
|
+
this.colControlsOffset = 0;
|
|
366
|
+
if (layoutContainer && layoutContainer.getAttribute('data-layout-content')) {
|
|
367
|
+
tableContentWrapper.style.removeProperty('padding-left');
|
|
368
|
+
}
|
|
369
|
+
}
|
|
478
370
|
|
|
479
|
-
//
|
|
480
|
-
|
|
481
|
-
|
|
371
|
+
// run after table style changes have been committed
|
|
372
|
+
setTimeout(function () {
|
|
373
|
+
(0, _dom.syncStickyRowToTable)(tree.table);
|
|
374
|
+
}, 0);
|
|
375
|
+
}
|
|
376
|
+
}, {
|
|
377
|
+
key: "updateStickyHeaderWidth",
|
|
378
|
+
value: function updateStickyHeaderWidth() {
|
|
379
|
+
// table width might have changed, sync that back to sticky row
|
|
380
|
+
var tree = (0, _dom2.getTree)(this.dom);
|
|
381
|
+
if (!tree) {
|
|
382
|
+
return;
|
|
482
383
|
}
|
|
384
|
+
(0, _dom.syncStickyRowToTable)(tree.table);
|
|
385
|
+
}
|
|
483
386
|
|
|
484
|
-
|
|
387
|
+
/**
|
|
388
|
+
* Manually refire the intersection observers.
|
|
389
|
+
* Useful when the header may have detached from the table.
|
|
390
|
+
*/
|
|
391
|
+
}, {
|
|
392
|
+
key: "refireIntersectionObservers",
|
|
393
|
+
value: function refireIntersectionObservers() {
|
|
394
|
+
var _this5 = this;
|
|
395
|
+
if (this.isSticky) {
|
|
396
|
+
[this.sentinels.top, this.sentinels.bottom].forEach(function (el) {
|
|
397
|
+
if (el && _this5.intersectionObserver) {
|
|
398
|
+
_this5.intersectionObserver.unobserve(el);
|
|
399
|
+
_this5.intersectionObserver.observe(el);
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}, {
|
|
405
|
+
key: "makeHeaderRowSticky",
|
|
406
|
+
value: function makeHeaderRowSticky(tree, scrollTop) {
|
|
407
|
+
var _tbody$firstChild,
|
|
408
|
+
_this6 = this;
|
|
409
|
+
// If header row height is more than 50% of viewport height don't do this
|
|
410
|
+
if (this.isSticky || this.stickyRowHeight && this.stickyRowHeight > window.innerHeight / 2) {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
var table = tree.table,
|
|
414
|
+
wrapper = tree.wrapper;
|
|
415
|
+
|
|
416
|
+
// ED-16035 Make sure sticky header is only applied to first row
|
|
485
417
|
var tbody = this.dom.parentElement;
|
|
486
|
-
var
|
|
487
|
-
|
|
488
|
-
|
|
418
|
+
var isFirstHeader = tbody === null || tbody === void 0 || (_tbody$firstChild = tbody.firstChild) === null || _tbody$firstChild === void 0 ? void 0 : _tbody$firstChild.isEqualNode(this.dom);
|
|
419
|
+
if (!isFirstHeader) {
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
var currentTableTop = this.getCurrentTableTop(tree);
|
|
423
|
+
if (!scrollTop) {
|
|
424
|
+
scrollTop = (0, _dom2.getTop)(this.editorScrollableElement);
|
|
425
|
+
}
|
|
426
|
+
var domTop = currentTableTop > 0 ? scrollTop : scrollTop + currentTableTop;
|
|
427
|
+
if (!this.isSticky) {
|
|
428
|
+
var _this$editorScrollabl;
|
|
429
|
+
(0, _dom.syncStickyRowToTable)(table);
|
|
430
|
+
this.dom.classList.add('sticky');
|
|
431
|
+
table.classList.add(_types.TableCssClassName.TABLE_STICKY);
|
|
432
|
+
this.isSticky = true;
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* The logic below is not desirable, but acts as a fail safe for scenarios where the sticky header
|
|
436
|
+
* detaches from the table. This typically happens during a fast scroll by the user which causes
|
|
437
|
+
* the intersection observer logic to not fire as expected.
|
|
438
|
+
*/
|
|
439
|
+
(_this$editorScrollabl = this.editorScrollableElement) === null || _this$editorScrollabl === void 0 || _this$editorScrollabl.addEventListener('scrollend', this.refireIntersectionObservers, {
|
|
440
|
+
passive: true,
|
|
441
|
+
once: true
|
|
442
|
+
});
|
|
443
|
+
var fastScrollThresholdMs = 500;
|
|
444
|
+
setTimeout(function () {
|
|
445
|
+
_this6.refireIntersectionObservers();
|
|
446
|
+
}, fastScrollThresholdMs);
|
|
447
|
+
}
|
|
448
|
+
this.dom.style.top = "".concat(domTop, "px");
|
|
449
|
+
(0, _dom.updateStickyMargins)(table);
|
|
450
|
+
this.dom.scrollLeft = wrapper.scrollLeft;
|
|
451
|
+
this.emitOn(domTop, this.colControlsOffset);
|
|
489
452
|
}
|
|
490
453
|
}, {
|
|
491
|
-
key: "
|
|
492
|
-
value: function
|
|
493
|
-
|
|
494
|
-
if (this.
|
|
495
|
-
|
|
454
|
+
key: "makeRowHeaderNotSticky",
|
|
455
|
+
value: function makeRowHeaderNotSticky(table) {
|
|
456
|
+
var isEditorDestroyed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
457
|
+
if (!this.isSticky || !table || !this.dom) {
|
|
458
|
+
return;
|
|
496
459
|
}
|
|
497
|
-
this.
|
|
460
|
+
this.dom.style.removeProperty('width');
|
|
461
|
+
this.dom.classList.remove('sticky');
|
|
462
|
+
table.classList.remove(_types.TableCssClassName.TABLE_STICKY);
|
|
463
|
+
this.isSticky = false;
|
|
464
|
+
this.dom.style.top = '';
|
|
465
|
+
table.style.removeProperty('margin-top');
|
|
466
|
+
this.emitOff(isEditorDestroyed);
|
|
498
467
|
}
|
|
499
468
|
}, {
|
|
500
|
-
key: "
|
|
501
|
-
value: function
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
469
|
+
key: "getWrapperoffset",
|
|
470
|
+
value: function getWrapperoffset() {
|
|
471
|
+
var inverse = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
472
|
+
var focusValue = inverse ? !this.focused : this.focused;
|
|
473
|
+
return focusValue ? 0 : _consts.tableControlsSpacing;
|
|
474
|
+
}
|
|
475
|
+
}, {
|
|
476
|
+
key: "getWrapperRefTop",
|
|
477
|
+
value: function getWrapperRefTop(wrapper) {
|
|
478
|
+
return Math.round((0, _dom2.getTop)(wrapper)) + this.getWrapperoffset();
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// TODO: rename!
|
|
482
|
+
}, {
|
|
483
|
+
key: "getScrolledTableTop",
|
|
484
|
+
value: function getScrolledTableTop(wrapper) {
|
|
485
|
+
return this.getWrapperRefTop(wrapper) - this.topPosEditorElement;
|
|
486
|
+
}
|
|
487
|
+
}, {
|
|
488
|
+
key: "getCurrentTableTop",
|
|
489
|
+
value: function getCurrentTableTop(tree) {
|
|
490
|
+
return this.getScrolledTableTop(tree.wrapper) + tree.table.clientHeight;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/* emit external events */
|
|
494
|
+
}, {
|
|
495
|
+
key: "emitOn",
|
|
496
|
+
value: function emitOn(top, padding) {
|
|
497
|
+
if (top === this.top && padding === this.padding) {
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
this.top = top;
|
|
501
|
+
this.padding = padding;
|
|
502
|
+
var pos = this.getPos();
|
|
503
|
+
if (Number.isFinite(pos)) {
|
|
504
|
+
(0, _commands.updateStickyState)({
|
|
505
|
+
pos: pos,
|
|
506
|
+
top: top,
|
|
507
|
+
sticky: true,
|
|
508
|
+
padding: padding
|
|
509
|
+
})(this.view.state, this.view.dispatch, this.view);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}, {
|
|
513
|
+
key: "emitOff",
|
|
514
|
+
value: function emitOff(isEditorDestroyed) {
|
|
515
|
+
if (this.top === 0 && this.padding === 0) {
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
this.top = 0;
|
|
519
|
+
this.padding = 0;
|
|
520
|
+
var pos = this.getPos();
|
|
521
|
+
if (!isEditorDestroyed && Number.isFinite(pos)) {
|
|
522
|
+
(0, _commands.updateStickyState)({
|
|
523
|
+
pos: pos,
|
|
524
|
+
sticky: false,
|
|
525
|
+
top: this.top,
|
|
526
|
+
padding: this.padding
|
|
527
|
+
})(this.view.state, this.view.dispatch, this.view);
|
|
521
528
|
}
|
|
522
|
-
return true;
|
|
523
529
|
}
|
|
524
530
|
}]);
|
|
525
|
-
return
|
|
526
|
-
}();
|
|
531
|
+
return TableRow;
|
|
532
|
+
}(_TableNodeViewBase.default);
|