@atlaskit/editor-plugin-table 7.16.11 → 7.16.13
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/.eslintrc.js +3 -3
- package/CHANGELOG.md +16 -0
- package/dist/cjs/commands/misc.js +3 -3
- package/dist/cjs/nodeviews/TableCell.js +10 -10
- package/dist/cjs/nodeviews/TableContainer.js +83 -27
- package/dist/cjs/nodeviews/TableResizer.js +40 -19
- package/dist/cjs/nodeviews/TableRow.js +23 -23
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +3 -3
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +4 -4
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +3 -3
- package/dist/cjs/ui/FloatingContextualMenu/styles.js +1 -1
- package/dist/cjs/ui/FloatingDragMenu/styles.js +1 -1
- package/dist/cjs/ui/common-styles.js +13 -13
- package/dist/cjs/ui/ui-styles.js +25 -25
- package/dist/cjs/utils/guidelines.js +7 -4
- package/dist/cjs/utils/merged-cells.js +3 -3
- package/dist/cjs/utils/snapping.js +7 -8
- package/dist/es2019/commands/misc.js +3 -3
- package/dist/es2019/nodeviews/TableContainer.js +70 -9
- package/dist/es2019/nodeviews/TableResizer.js +42 -21
- package/dist/es2019/nodeviews/TableRow.js +21 -21
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +3 -3
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +4 -4
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +3 -3
- package/dist/es2019/ui/FloatingContextualMenu/styles.js +47 -47
- package/dist/es2019/ui/FloatingDragMenu/styles.js +30 -30
- package/dist/es2019/ui/common-styles.js +802 -816
- package/dist/es2019/ui/ui-styles.js +665 -678
- package/dist/es2019/utils/guidelines.js +5 -2
- package/dist/es2019/utils/merged-cells.js +3 -3
- package/dist/es2019/utils/snapping.js +5 -6
- package/dist/esm/commands/misc.js +3 -3
- package/dist/esm/nodeviews/TableCell.js +10 -10
- package/dist/esm/nodeviews/TableContainer.js +85 -29
- package/dist/esm/nodeviews/TableResizer.js +42 -21
- package/dist/esm/nodeviews/TableRow.js +23 -23
- package/dist/esm/pm-plugins/table-resizing/plugin.js +3 -3
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +4 -4
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +3 -3
- package/dist/esm/ui/FloatingContextualMenu/styles.js +1 -1
- package/dist/esm/ui/FloatingDragMenu/styles.js +1 -1
- package/dist/esm/ui/common-styles.js +13 -13
- package/dist/esm/ui/ui-styles.js +25 -25
- package/dist/esm/utils/guidelines.js +6 -3
- package/dist/esm/utils/merged-cells.js +3 -3
- package/dist/esm/utils/snapping.js +6 -7
- package/dist/types/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types/pm-plugins/decorations/utils/index.d.ts +1 -1
- package/dist/types/pm-plugins/drag-and-drop/utils/autoscrollers.d.ts +1 -1
- package/dist/types/pm-plugins/drag-and-drop/utils/getDragBehaviour.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +1 -1
- package/dist/types/ui/ColumnResizeWidget/index.d.ts +1 -1
- package/dist/types/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.d.ts +1 -1
- package/dist/types/ui/FloatingToolbarLabel/FloatingToolbarLabel.d.ts +1 -1
- package/dist/types/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +1 -1
- package/dist/types/ui/TableFloatingControls/CornerControls/index.d.ts +1 -1
- package/dist/types/ui/icons/DragHandleDisabledIcon.d.ts +1 -1
- package/dist/types/utils/guidelines.d.ts +2 -1
- package/dist/types/utils/snapping.d.ts +3 -2
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/decorations/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/utils/autoscrollers.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/utils/getDragBehaviour.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/ColumnResizeWidget/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingToolbarLabel/FloatingToolbarLabel.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/icons/DragHandleDisabledIcon.d.ts +1 -1
- package/dist/types-ts4.5/utils/guidelines.d.ts +2 -1
- package/dist/types-ts4.5/utils/snapping.d.ts +3 -2
- package/docs/0-intro.tsx +9 -7
- package/package.json +3 -3
- package/report.api.md +67 -66
- package/src/commands/clear.ts +36 -44
- package/src/commands/collapse.ts +8 -8
- package/src/commands/column-resize.ts +412 -452
- package/src/commands/delete.ts +14 -14
- package/src/commands/display-mode.ts +10 -11
- package/src/commands/go-to-next-cell.ts +48 -54
- package/src/commands/hover.ts +210 -227
- package/src/commands/index.ts +35 -35
- package/src/commands/insert.ts +208 -235
- package/src/commands/misc.ts +655 -748
- package/src/commands/referentiality.ts +9 -9
- package/src/commands/selection.ts +433 -563
- package/src/commands/sort.ts +68 -86
- package/src/commands/split-cell.ts +14 -14
- package/src/commands/toggle.ts +69 -67
- package/src/commands-with-analytics.ts +570 -639
- package/src/create-plugin-config.ts +13 -13
- package/src/event-handlers.ts +513 -612
- package/src/handlers.ts +120 -133
- package/src/nodeviews/ExternalDropTargets.tsx +68 -73
- package/src/nodeviews/OverflowShadowsObserver.ts +148 -157
- package/src/nodeviews/TableCell.ts +47 -54
- package/src/nodeviews/TableComponent.tsx +1018 -1112
- package/src/nodeviews/TableComponentWithSharedState.tsx +91 -94
- package/src/nodeviews/TableContainer.tsx +384 -340
- package/src/nodeviews/TableNodeViewBase.ts +19 -24
- package/src/nodeviews/TableResizer.tsx +642 -653
- package/src/nodeviews/TableRow.ts +580 -629
- package/src/nodeviews/TableStickyScrollbar.ts +173 -190
- package/src/nodeviews/__mocks__/OverflowShadowsObserver.ts +8 -8
- package/src/nodeviews/__mocks__/OverridableMock.ts +14 -15
- package/src/nodeviews/table.tsx +345 -375
- package/src/nodeviews/types.ts +21 -24
- package/src/nodeviews/update-overflow-shadows.ts +8 -14
- package/src/plugin.tsx +578 -603
- package/src/pm-plugins/analytics/actions.ts +10 -12
- package/src/pm-plugins/analytics/commands.ts +31 -37
- package/src/pm-plugins/analytics/plugin-factory.ts +4 -2
- package/src/pm-plugins/analytics/plugin-key.ts +1 -3
- package/src/pm-plugins/analytics/plugin.ts +60 -70
- package/src/pm-plugins/analytics/reducer.ts +19 -19
- package/src/pm-plugins/analytics/types.ts +10 -10
- package/src/pm-plugins/analytics/utils/moved-event.ts +38 -38
- package/src/pm-plugins/decorations/plugin.ts +58 -77
- package/src/pm-plugins/decorations/utils/column-controls.ts +59 -71
- package/src/pm-plugins/decorations/utils/column-resizing.ts +50 -57
- package/src/pm-plugins/decorations/utils/compose-decorations.ts +6 -6
- package/src/pm-plugins/decorations/utils/index.ts +3 -6
- package/src/pm-plugins/decorations/utils/types.ts +7 -12
- package/src/pm-plugins/default-table-selection.ts +3 -3
- package/src/pm-plugins/drag-and-drop/actions.ts +25 -25
- package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +158 -190
- package/src/pm-plugins/drag-and-drop/commands.ts +154 -170
- package/src/pm-plugins/drag-and-drop/consts.ts +4 -5
- package/src/pm-plugins/drag-and-drop/plugin-factory.ts +23 -20
- package/src/pm-plugins/drag-and-drop/plugin-key.ts +1 -3
- package/src/pm-plugins/drag-and-drop/plugin.ts +329 -383
- package/src/pm-plugins/drag-and-drop/reducer.ts +30 -30
- package/src/pm-plugins/drag-and-drop/types.ts +8 -8
- package/src/pm-plugins/drag-and-drop/utils/autoscrollers.ts +38 -41
- package/src/pm-plugins/drag-and-drop/utils/getDragBehaviour.ts +3 -6
- package/src/pm-plugins/drag-and-drop/utils/monitor.ts +57 -70
- package/src/pm-plugins/keymap.ts +208 -220
- package/src/pm-plugins/main.ts +348 -400
- package/src/pm-plugins/plugin-factory.ts +32 -34
- package/src/pm-plugins/safari-delete-composition-text-issue-workaround.ts +83 -97
- package/src/pm-plugins/sticky-headers/commands.ts +2 -6
- package/src/pm-plugins/sticky-headers/plugin-key.ts +1 -3
- package/src/pm-plugins/sticky-headers/plugin-state.ts +41 -44
- package/src/pm-plugins/sticky-headers/plugin.ts +4 -4
- package/src/pm-plugins/sticky-headers/types.ts +8 -8
- package/src/pm-plugins/sticky-headers/util.ts +10 -10
- package/src/pm-plugins/table-analytics.ts +70 -72
- package/src/pm-plugins/table-local-id.ts +180 -184
- package/src/pm-plugins/table-resizing/commands.ts +72 -85
- package/src/pm-plugins/table-resizing/event-handlers.ts +298 -317
- package/src/pm-plugins/table-resizing/plugin-factory.ts +10 -10
- package/src/pm-plugins/table-resizing/plugin-key.ts +1 -3
- package/src/pm-plugins/table-resizing/plugin.ts +61 -68
- package/src/pm-plugins/table-resizing/reducer.ts +30 -33
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +84 -84
- package/src/pm-plugins/table-resizing/utils/column-state.ts +78 -81
- package/src/pm-plugins/table-resizing/utils/content-width.ts +94 -114
- package/src/pm-plugins/table-resizing/utils/dom.ts +93 -110
- package/src/pm-plugins/table-resizing/utils/index.ts +29 -34
- package/src/pm-plugins/table-resizing/utils/misc.ts +94 -119
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +93 -106
- package/src/pm-plugins/table-resizing/utils/resize-logic.ts +240 -257
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +343 -372
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +202 -207
- package/src/pm-plugins/table-resizing/utils/types.ts +17 -17
- package/src/pm-plugins/table-resizing/utils/unit-to-number.ts +1 -2
- package/src/pm-plugins/table-selection-keymap.ts +25 -51
- package/src/pm-plugins/table-width.ts +191 -204
- package/src/pm-plugins/view-mode-sort/index.ts +223 -227
- package/src/pm-plugins/view-mode-sort/plugin-key.ts +3 -2
- package/src/pm-plugins/view-mode-sort/types.ts +12 -12
- package/src/pm-plugins/view-mode-sort/utils.ts +108 -117
- package/src/reducer.ts +139 -155
- package/src/toolbar.tsx +815 -905
- package/src/transforms/column-width.ts +186 -213
- package/src/transforms/delete-columns.ts +208 -222
- package/src/transforms/delete-rows.ts +117 -121
- package/src/transforms/fix-tables.ts +190 -215
- package/src/transforms/merge.ts +263 -269
- package/src/transforms/replace-table.ts +27 -43
- package/src/transforms/split.ts +65 -75
- package/src/types.ts +421 -427
- package/src/ui/ColumnResizeWidget/index.tsx +40 -47
- package/src/ui/DragHandle/HandleIconComponent.tsx +9 -13
- package/src/ui/DragHandle/index.tsx +221 -250
- package/src/ui/DragPreview/index.tsx +35 -35
- package/src/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.tsx +33 -41
- package/src/ui/FloatingContextualButton/FixedButton.tsx +154 -157
- package/src/ui/FloatingContextualButton/index.tsx +109 -115
- package/src/ui/FloatingContextualButton/styles.ts +43 -46
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +634 -694
- package/src/ui/FloatingContextualMenu/index.tsx +83 -101
- package/src/ui/FloatingContextualMenu/styles.ts +57 -65
- package/src/ui/FloatingDeleteButton/DeleteButton.tsx +37 -37
- package/src/ui/FloatingDeleteButton/getPopUpOptions.ts +47 -57
- package/src/ui/FloatingDeleteButton/index.tsx +319 -350
- package/src/ui/FloatingDragMenu/DragMenu.tsx +555 -596
- package/src/ui/FloatingDragMenu/DropdownMenu.tsx +152 -162
- package/src/ui/FloatingDragMenu/index.tsx +88 -102
- package/src/ui/FloatingDragMenu/styles.ts +51 -54
- package/src/ui/FloatingInsertButton/InsertButton.tsx +204 -217
- package/src/ui/FloatingInsertButton/getPopupOptions.ts +100 -115
- package/src/ui/FloatingInsertButton/index.tsx +248 -292
- package/src/ui/FloatingToolbarLabel/FloatingToolbarLabel.tsx +24 -29
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +308 -329
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +85 -94
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +46 -46
- package/src/ui/TableFloatingColumnControls/index.tsx +116 -136
- package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +79 -91
- package/src/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +95 -102
- package/src/ui/TableFloatingControls/CornerControls/index.tsx +1 -4
- package/src/ui/TableFloatingControls/CornerControls/types.ts +8 -8
- package/src/ui/TableFloatingControls/FloatingControlsWithSelection.tsx +50 -50
- package/src/ui/TableFloatingControls/NumberColumn/index.tsx +111 -124
- package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +86 -105
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +305 -341
- package/src/ui/TableFloatingControls/RowDropTarget/index.tsx +72 -75
- package/src/ui/TableFloatingControls/index.tsx +191 -193
- package/src/ui/TableFullWidthLabel/index.tsx +20 -20
- package/src/ui/common-styles.ts +880 -912
- package/src/ui/consts.ts +29 -74
- package/src/ui/icons/AddColLeftIcon.tsx +33 -39
- package/src/ui/icons/AddColRightIcon.tsx +33 -39
- package/src/ui/icons/AddRowAboveIcon.tsx +16 -22
- package/src/ui/icons/AddRowBelowIcon.tsx +33 -39
- package/src/ui/icons/DisplayModeIcon.tsx +31 -31
- package/src/ui/icons/DragHandleDisabledIcon.tsx +19 -21
- package/src/ui/icons/DragHandleIcon.tsx +12 -12
- package/src/ui/icons/DragInMotionIcon.tsx +45 -52
- package/src/ui/icons/MergeCellsIcon.tsx +22 -28
- package/src/ui/icons/MinimisedHandle.tsx +9 -9
- package/src/ui/icons/SplitCellIcon.tsx +30 -36
- package/src/ui/ui-styles.ts +769 -798
- package/src/utils/alignment.ts +1 -1
- package/src/utils/analytics.ts +192 -208
- package/src/utils/collapse.ts +55 -64
- package/src/utils/column-controls.ts +237 -254
- package/src/utils/create.ts +30 -30
- package/src/utils/decoration.ts +482 -502
- package/src/utils/dom.ts +127 -134
- package/src/utils/drag-menu.ts +322 -373
- package/src/utils/get-allow-add-column-custom-step.ts +4 -5
- package/src/utils/guidelines.ts +16 -21
- package/src/utils/index.ts +68 -68
- package/src/utils/merged-cells.ts +245 -254
- package/src/utils/nodes.ts +91 -106
- package/src/utils/paste.ts +119 -135
- package/src/utils/row-controls.ts +199 -213
- package/src/utils/selection.ts +77 -87
- package/src/utils/snapping.ts +87 -100
- package/src/utils/table.ts +44 -44
- package/src/utils/transforms.ts +5 -5
- package/src/utils/update-plugin-state-decorations.ts +5 -9
package/src/types.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
2
|
|
|
3
3
|
import type { TableLayout } from '@atlaskit/adf-schema';
|
|
4
|
-
import {
|
|
5
|
-
tableCellSelector,
|
|
6
|
-
tableHeaderSelector,
|
|
7
|
-
tablePrefixSelector,
|
|
8
|
-
} from '@atlaskit/adf-schema';
|
|
4
|
+
import { tableCellSelector, tableHeaderSelector, tablePrefixSelector } from '@atlaskit/adf-schema';
|
|
9
5
|
import type { TableColumnOrdering } from '@atlaskit/custom-steps';
|
|
10
6
|
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
11
7
|
import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
@@ -29,76 +25,76 @@ export type Cell = { pos: number; start: number; node: PmNode };
|
|
|
29
25
|
export type CellTransform = (cell: Cell) => (tr: Transaction) => Transaction;
|
|
30
26
|
|
|
31
27
|
export interface InsertRowOptions {
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
index: number;
|
|
29
|
+
moveCursorToInsertedRow: boolean;
|
|
34
30
|
}
|
|
35
31
|
|
|
36
32
|
export type PluginInjectionAPI = ExtractInjectionAPI<TablePlugin>;
|
|
37
33
|
|
|
38
34
|
export type PluginInjectionAPIWithA11y = ExtractInjectionAPI<TablePlugin> & {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
accessibilityUtils?: {
|
|
36
|
+
actions: {
|
|
37
|
+
ariaNotify: (message: string) => void | undefined;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
44
40
|
};
|
|
45
41
|
|
|
46
42
|
// override getPluginState but do not expose publicly as this type is experimental and will change
|
|
47
43
|
// in the future
|
|
48
44
|
export type TableSharedStateInternal = Pick<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
45
|
+
TablePluginState,
|
|
46
|
+
| 'isFullWidthModeEnabled'
|
|
47
|
+
| 'wasFullWidthModeEnabled'
|
|
48
|
+
| 'isHeaderRowEnabled'
|
|
49
|
+
| 'isHeaderColumnEnabled'
|
|
50
|
+
| 'ordering'
|
|
51
|
+
| 'isInDanger'
|
|
52
|
+
| 'hoveredRows'
|
|
53
|
+
| 'hoveredCell'
|
|
54
|
+
| 'isTableHovered'
|
|
55
|
+
| 'tableNode'
|
|
56
|
+
| 'widthToWidest'
|
|
61
57
|
> & {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
58
|
+
isResizing: boolean;
|
|
59
|
+
isTableResizing?: boolean;
|
|
60
|
+
isWholeTableInDanger?: boolean;
|
|
65
61
|
};
|
|
66
62
|
|
|
67
63
|
export type TableSharedState = Pick<
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
TablePluginState,
|
|
65
|
+
'isFullWidthModeEnabled' | 'wasFullWidthModeEnabled'
|
|
70
66
|
>;
|
|
71
67
|
|
|
72
68
|
export type AlignmentOptions = 'center' | 'align-start';
|
|
73
69
|
|
|
74
70
|
export type InsertRowMethods =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
71
|
+
| INPUT_METHOD.CONTEXT_MENU
|
|
72
|
+
| INPUT_METHOD.BUTTON
|
|
73
|
+
| INPUT_METHOD.SHORTCUT
|
|
74
|
+
| INPUT_METHOD.KEYBOARD
|
|
75
|
+
| INPUT_METHOD.FLOATING_TB
|
|
76
|
+
| INPUT_METHOD.TABLE_CONTEXT_MENU;
|
|
81
77
|
|
|
82
78
|
export interface PluginConfig {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
79
|
+
advanced?: boolean;
|
|
80
|
+
allowBackgroundColor?: boolean;
|
|
81
|
+
allowColumnResizing?: boolean;
|
|
82
|
+
allowHeaderColumn?: boolean;
|
|
83
|
+
allowHeaderRow?: boolean;
|
|
84
|
+
allowMergeCells?: boolean;
|
|
85
|
+
allowNumberColumn?: boolean;
|
|
86
|
+
allowColumnSorting?: boolean;
|
|
87
|
+
allowAddColumnWithCustomStep?: boolean;
|
|
88
|
+
allowCollapse?: boolean;
|
|
89
|
+
isHeaderRowRequired?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-6877 Internal documentation for deprecation (no external access)}
|
|
92
|
+
**/
|
|
93
|
+
permittedLayouts?: PermittedLayoutsDescriptor;
|
|
94
|
+
allowControls?: boolean;
|
|
95
|
+
stickyHeaders?: boolean;
|
|
96
|
+
allowCellOptionsInFloatingToolbar?: boolean;
|
|
97
|
+
allowDistributeColumns?: boolean;
|
|
102
98
|
}
|
|
103
99
|
|
|
104
100
|
export type { ColumnResizingPluginState } from '@atlaskit/editor-common/types';
|
|
@@ -129,382 +125,380 @@ export type { ColumnResizingPluginState } from '@atlaskit/editor-common/types';
|
|
|
129
125
|
*/
|
|
130
126
|
export type CellColumnPositioning = Pick<Rect, 'right' | 'left'>;
|
|
131
127
|
export interface CellHoverMeta {
|
|
132
|
-
|
|
133
|
-
|
|
128
|
+
colIndex?: number;
|
|
129
|
+
rowIndex?: number;
|
|
134
130
|
}
|
|
135
131
|
export interface WidthToWidest {
|
|
136
|
-
|
|
132
|
+
[tableLocalId: string]: boolean;
|
|
137
133
|
}
|
|
138
134
|
|
|
139
135
|
export interface TablePluginState {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
136
|
+
editorHasFocus?: boolean;
|
|
137
|
+
hoveredColumns: number[];
|
|
138
|
+
hoveredRows: number[];
|
|
139
|
+
hoveredCell: CellHoverMeta;
|
|
140
|
+
pluginConfig: PluginConfig;
|
|
141
|
+
isHeaderColumnEnabled: boolean;
|
|
142
|
+
isHeaderRowEnabled: boolean;
|
|
143
|
+
isNumberColumnEnabled?: boolean;
|
|
144
|
+
// position of a cell PM node that has cursor
|
|
145
|
+
targetCellPosition?: number;
|
|
146
|
+
// controls need to be re-rendered when table content changes
|
|
147
|
+
// e.g. when pressing enter inside of a cell, it creates a new p and we need to update row controls
|
|
148
|
+
tableNode?: PmNode;
|
|
149
|
+
tableRef?: HTMLTableElement;
|
|
150
|
+
tablePos?: number;
|
|
151
|
+
tableWrapperTarget?: HTMLElement;
|
|
152
|
+
isContextualMenuOpen?: boolean;
|
|
153
|
+
isInDanger?: boolean;
|
|
154
|
+
isWholeTableInDanger?: boolean;
|
|
155
|
+
insertColumnButtonIndex?: number;
|
|
156
|
+
insertRowButtonIndex?: number;
|
|
157
|
+
isFullWidthModeEnabled?: boolean;
|
|
158
|
+
ordering?: TableColumnOrdering;
|
|
159
|
+
isResizeHandleWidgetAdded?: boolean;
|
|
160
|
+
resizeHandleRowIndex?: number;
|
|
161
|
+
resizeHandleColumnIndex?: number;
|
|
162
|
+
resizeHandleIncludeTooltip?: boolean;
|
|
163
|
+
isKeyboardResize?: boolean;
|
|
164
|
+
// for table wrap/collapse
|
|
165
|
+
isTableCollapsed?: boolean; // is the current table already in an expand?
|
|
166
|
+
canCollapseTable?: boolean; // enabled/disabled state of collapse option
|
|
167
|
+
widthToWidest?: WidthToWidest; // is the current table set to the widest width regarding view port
|
|
168
|
+
|
|
169
|
+
getIntl: () => IntlShape;
|
|
170
|
+
|
|
171
|
+
wasFullWidthModeEnabled?: boolean;
|
|
172
|
+
isTableResizingEnabled?: boolean;
|
|
173
|
+
isDragAndDropEnabled?: boolean;
|
|
174
|
+
isTableHovered?: boolean;
|
|
175
|
+
|
|
176
|
+
// Currently isTableScalingEnabled is the same as options.isTableScalingEnabled from TablePluginOptions.
|
|
177
|
+
// However, if you want to learn if tablePlugin is configured to enable Preserve Table Widths feature,
|
|
178
|
+
// use options.isTableScalingEnabled and avoid using pluginState.isTableScalingEnabled or
|
|
179
|
+
// const { isTableScalingEnabled } = getPluginState(state) for that purpose.
|
|
180
|
+
isTableScalingEnabled?: boolean;
|
|
185
181
|
}
|
|
186
182
|
|
|
187
183
|
export type TablePluginAction =
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
184
|
+
| { type: 'SET_EDITOR_FOCUS'; data: { editorHasFocus: boolean } }
|
|
185
|
+
| { type: 'TOGGLE_HEADER_ROW' }
|
|
186
|
+
| { type: 'TOGGLE_HEADER_COLUMN' }
|
|
187
|
+
| { type: 'SORT_TABLE'; data: { ordering: TableColumnOrdering } }
|
|
188
|
+
| {
|
|
189
|
+
type: 'SET_TABLE_REF';
|
|
190
|
+
data: {
|
|
191
|
+
tableRef?: HTMLTableElement;
|
|
192
|
+
tableNode?: PmNode;
|
|
193
|
+
tableWrapperTarget?: HTMLElement;
|
|
194
|
+
isHeaderRowEnabled: boolean;
|
|
195
|
+
isHeaderColumnEnabled: boolean;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
| {
|
|
199
|
+
type: 'HOVER_ROWS';
|
|
200
|
+
data: {
|
|
201
|
+
decorationSet: DecorationSet;
|
|
202
|
+
hoveredRows: number[];
|
|
203
|
+
isInDanger?: boolean;
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
| {
|
|
207
|
+
type: 'HOVER_MERGED_CELLS';
|
|
208
|
+
data: {
|
|
209
|
+
decorationSet: DecorationSet;
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
| {
|
|
213
|
+
type: 'HOVER_COLUMNS';
|
|
214
|
+
data: {
|
|
215
|
+
decorationSet: DecorationSet;
|
|
216
|
+
hoveredColumns: number[];
|
|
217
|
+
isInDanger?: boolean;
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
| {
|
|
221
|
+
type: 'HOVER_TABLE';
|
|
222
|
+
data: {
|
|
223
|
+
decorationSet: DecorationSet;
|
|
224
|
+
hoveredRows: number[];
|
|
225
|
+
hoveredColumns: number[];
|
|
226
|
+
isInDanger?: boolean;
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
| {
|
|
230
|
+
type: 'START_KEYBOARD_COLUMN_RESIZE';
|
|
231
|
+
data: {
|
|
232
|
+
decorationSet: DecorationSet;
|
|
233
|
+
resizeHandleRowIndex: number;
|
|
234
|
+
resizeHandleColumnIndex: number;
|
|
235
|
+
resizeHandleIncludeTooltip: boolean;
|
|
236
|
+
isKeyboardResize?: boolean;
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
| {
|
|
240
|
+
type: 'ADD_RESIZE_HANDLE_DECORATIONS';
|
|
241
|
+
data: {
|
|
242
|
+
decorationSet: DecorationSet;
|
|
243
|
+
resizeHandleRowIndex: number;
|
|
244
|
+
resizeHandleColumnIndex: number;
|
|
245
|
+
resizeHandleIncludeTooltip: boolean;
|
|
246
|
+
isKeyboardResize?: boolean;
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
| {
|
|
250
|
+
type: 'UPDATE_RESIZE_HANDLE_DECORATIONS';
|
|
251
|
+
data: {
|
|
252
|
+
decorationSet: DecorationSet;
|
|
253
|
+
resizeHandleRowIndex: number | undefined;
|
|
254
|
+
resizeHandleColumnIndex: number | undefined;
|
|
255
|
+
resizeHandleIncludeTooltip: boolean | undefined;
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
| {
|
|
259
|
+
type: 'UPDATE_TABLE_WIDTH_TO_WIDEST';
|
|
260
|
+
data: {
|
|
261
|
+
widthToWidest: WidthToWidest | undefined;
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
| {
|
|
265
|
+
type: 'REMOVE_RESIZE_HANDLE_DECORATIONS';
|
|
266
|
+
data: { decorationSet: DecorationSet };
|
|
267
|
+
}
|
|
268
|
+
| {
|
|
269
|
+
type: 'STOP_KEYBOARD_COLUMN_RESIZE';
|
|
270
|
+
data: { decorationSet: DecorationSet };
|
|
271
|
+
}
|
|
272
|
+
| { type: 'CLEAR_HOVER_SELECTION'; data: { decorationSet: DecorationSet } }
|
|
273
|
+
| { type: 'SHOW_RESIZE_HANDLE_LINE'; data: { decorationSet: DecorationSet } }
|
|
274
|
+
| { type: 'HIDE_RESIZE_HANDLE_LINE'; data: { decorationSet: DecorationSet } }
|
|
275
|
+
| {
|
|
276
|
+
type: 'HOVER_CELL';
|
|
277
|
+
data: {
|
|
278
|
+
hoveredCell: CellHoverMeta;
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
| {
|
|
282
|
+
type: 'TABLE_HOVERED';
|
|
283
|
+
data: {
|
|
284
|
+
isTableHovered: boolean;
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
| { type: 'SET_TARGET_CELL_POSITION'; data: { targetCellPosition?: number } }
|
|
288
|
+
| {
|
|
289
|
+
type: 'SELECT_COLUMN';
|
|
290
|
+
data: { targetCellPosition: number; decorationSet: DecorationSet };
|
|
291
|
+
}
|
|
292
|
+
| { type: 'SHOW_INSERT_ROW_BUTTON'; data: { insertRowButtonIndex: number } }
|
|
293
|
+
| {
|
|
294
|
+
type: 'SHOW_INSERT_COLUMN_BUTTON';
|
|
295
|
+
data: { insertColumnButtonIndex: number };
|
|
296
|
+
}
|
|
297
|
+
| {
|
|
298
|
+
type: 'HIDE_INSERT_COLUMN_OR_ROW_BUTTON';
|
|
299
|
+
}
|
|
300
|
+
| { type: 'TOGGLE_CONTEXTUAL_MENU' };
|
|
305
301
|
|
|
306
302
|
export type ColumnResizingPluginAction =
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
303
|
+
| {
|
|
304
|
+
type: 'SET_RESIZE_HANDLE_POSITION';
|
|
305
|
+
data: { resizeHandlePos: number | null };
|
|
306
|
+
}
|
|
307
|
+
| { type: 'STOP_RESIZING' }
|
|
308
|
+
| {
|
|
309
|
+
type: 'SET_DRAGGING';
|
|
310
|
+
data: { dragging: { startX: number; startWidth: number } | null };
|
|
311
|
+
}
|
|
312
|
+
| {
|
|
313
|
+
type: 'SET_LAST_CLICK';
|
|
314
|
+
data: { lastClick: { x: number; y: number; time: number } | null };
|
|
315
|
+
};
|
|
320
316
|
|
|
321
317
|
export enum TableDecorations {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
318
|
+
/** Classic controls */
|
|
319
|
+
ALL_CONTROLS_HOVER = 'CONTROLS_HOVER',
|
|
320
|
+
ROW_CONTROLS_HOVER = 'ROW_CONTROLS_HOVER',
|
|
321
|
+
COLUMN_CONTROLS_HOVER = 'COLUMN_CONTROLS_HOVER',
|
|
322
|
+
TABLE_CONTROLS_HOVER = 'TABLE_CONTROLS_HOVER',
|
|
323
|
+
CELL_CONTROLS_HOVER = 'CELL_CONTROLS_HOVER',
|
|
324
|
+
|
|
325
|
+
COLUMN_CONTROLS_DECORATIONS = 'COLUMN_CONTROLS_DECORATIONS',
|
|
326
|
+
COLUMN_DROP_TARGET_DECORATIONS = 'COLUMN_DROP_TARGET_DECORATIONS',
|
|
327
|
+
COLUMN_SELECTED = 'COLUMN_SELECTED',
|
|
328
|
+
COLUMN_RESIZING_HANDLE = 'COLUMN_RESIZING_HANDLE',
|
|
329
|
+
COLUMN_RESIZING_HANDLE_WIDGET = 'COLUMN_RESIZING_HANDLE_WIDGET',
|
|
330
|
+
COLUMN_RESIZING_HANDLE_LINE = 'COLUMN_RESIZING_HANDLE_LINE',
|
|
331
|
+
|
|
332
|
+
COLUMN_INSERT_LINE = 'COLUMN_INSERT_LINE',
|
|
333
|
+
ROW_INSERT_LINE = 'ROW_INSERT_LINE',
|
|
334
|
+
|
|
335
|
+
LAST_CELL_ELEMENT = 'LAST_CELL_ELEMENT',
|
|
340
336
|
}
|
|
341
337
|
|
|
342
338
|
export const TableCssClassName = {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
339
|
+
...TableSharedCssClassName,
|
|
340
|
+
|
|
341
|
+
/** Classic controls */
|
|
342
|
+
COLUMN_CONTROLS: `${tablePrefixSelector}-column-controls`,
|
|
343
|
+
COLUMN_CONTROLS_DECORATIONS: `${tablePrefixSelector}-column-controls-decoration`,
|
|
344
|
+
COLUMN_SELECTED: `${tablePrefixSelector}-column__selected`,
|
|
345
|
+
|
|
346
|
+
ROW_CONTROLS_WRAPPER: `${tablePrefixSelector}-row-controls-wrapper`,
|
|
347
|
+
ROW_CONTROLS: `${tablePrefixSelector}-row-controls`,
|
|
348
|
+
ROW_CONTROLS_INNER: `${tablePrefixSelector}-row-controls__inner`,
|
|
349
|
+
ROW_CONTROLS_BUTTON_WRAP: `${tablePrefixSelector}-row-controls__button-wrap`,
|
|
350
|
+
ROW_CONTROLS_BUTTON: `${tablePrefixSelector}-row-controls__button`,
|
|
351
|
+
|
|
352
|
+
CONTROLS_BUTTON: `${tablePrefixSelector}-controls__button`,
|
|
353
|
+
CONTROLS_BUTTON_ICON: `${tablePrefixSelector}-controls__button-icon`,
|
|
354
|
+
|
|
355
|
+
CONTROLS_INSERT_BUTTON: `${tablePrefixSelector}-controls__insert-button`,
|
|
356
|
+
CONTROLS_INSERT_BUTTON_INNER: `${tablePrefixSelector}-controls__insert-button-inner`,
|
|
357
|
+
CONTROLS_INSERT_BUTTON_WRAP: `${tablePrefixSelector}-controls__insert-button-wrap`,
|
|
358
|
+
CONTROLS_INSERT_LINE: `${tablePrefixSelector}-controls__insert-line`,
|
|
359
|
+
CONTROLS_BUTTON_OVERLAY: `${tablePrefixSelector}-controls__button-overlay`,
|
|
360
|
+
|
|
361
|
+
DRAG_CONTROLS_INSERT_BUTTON: `${tablePrefixSelector}-controls__drag-insert-button`,
|
|
362
|
+
DRAG_CONTROLS_INSERT_BUTTON_INNER: `${tablePrefixSelector}-controls__drag-insert-button-inner`,
|
|
363
|
+
DRAG_CONTROLS_INSERT_BUTTON_INNER_COLUMN: `${tablePrefixSelector}-controls__drag-insert-button-inner-column`,
|
|
364
|
+
DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW: `${tablePrefixSelector}-controls__drag-insert-button-inner-row`,
|
|
365
|
+
DRAG_CONTROLS_INSERT_BUTTON_WRAP: `${tablePrefixSelector}-controls__drag-insert-button-wrap`,
|
|
366
|
+
|
|
367
|
+
CONTROLS_INSERT_MARKER: `${tablePrefixSelector}-controls__insert-marker`,
|
|
368
|
+
CONTROLS_INSERT_COLUMN: `${tablePrefixSelector}-controls__insert-column`,
|
|
369
|
+
CONTROLS_INSERT_ROW: `${tablePrefixSelector}-controls__insert-row`,
|
|
370
|
+
CONTROLS_DELETE_BUTTON_WRAP: `${tablePrefixSelector}-controls__delete-button-wrap`,
|
|
371
|
+
CONTROLS_DELETE_BUTTON: `${tablePrefixSelector}-controls__delete-button`,
|
|
372
|
+
|
|
373
|
+
CONTROLS_FLOATING_BUTTON_COLUMN: `${tablePrefixSelector}-controls-floating__button-column`,
|
|
374
|
+
CONTROLS_FLOATING_BUTTON_ROW: `${tablePrefixSelector}-controls-floating__button-row`,
|
|
375
|
+
|
|
376
|
+
CORNER_CONTROLS: `${tablePrefixSelector}-corner-controls`,
|
|
377
|
+
CORNER_CONTROLS_INSERT_ROW_MARKER: `${tablePrefixSelector}-corner-controls__insert-row-marker`,
|
|
378
|
+
CORNER_CONTROLS_INSERT_COLUMN_MARKER: `${tablePrefixSelector}-corner-controls__insert-column-marker`,
|
|
379
|
+
CONTROLS_CORNER_BUTTON: `${tablePrefixSelector}-corner-button`,
|
|
380
|
+
|
|
381
|
+
/** drag and drop controls */
|
|
382
|
+
DRAG_ROW_CONTROLS_WRAPPER: `${tablePrefixSelector}-drag-row-controls-wrapper`,
|
|
383
|
+
DRAG_ROW_CONTROLS: `${tablePrefixSelector}-drag-row-controls`,
|
|
384
|
+
DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER: `${tablePrefixSelector}-drag-row-floating-insert-dot-wrapper`,
|
|
385
|
+
DRAG_ROW_FLOATING_INSERT_DOT: `${tablePrefixSelector}-drag-row-floating-insert-dot`,
|
|
386
|
+
|
|
387
|
+
DRAG_COLUMN_CONTROLS: `${tablePrefixSelector}-drag-column-controls`,
|
|
388
|
+
DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER: `${tablePrefixSelector}-drag-columns-floating-insert-dot-wrapper`,
|
|
389
|
+
DRAG_COLUMN_FLOATING_INSERT_DOT: `${tablePrefixSelector}-drag-columns-floating-insert-dot`,
|
|
390
|
+
|
|
391
|
+
DRAG_COLUMN_CONTROLS_WRAPPER: `${tablePrefixSelector}-col-controls-wrapper`,
|
|
392
|
+
DRAG_COLUMN_DROP_TARGET_CONTROLS: `${tablePrefixSelector}-col-drop-target-controls`,
|
|
393
|
+
DRAG_COLUMN_CONTROLS_INNER: `${tablePrefixSelector}-col-controls__inner`,
|
|
394
|
+
|
|
395
|
+
DRAG_HANDLE_BUTTON_CONTAINER: `${tablePrefixSelector}-drag-handle-button-container`,
|
|
396
|
+
DRAG_HANDLE_BUTTON_CLICKABLE_ZONE: `${tablePrefixSelector}-drag-handle-button-clickable-zone`,
|
|
397
|
+
|
|
398
|
+
DRAG_CORNER_BUTTON: `${tablePrefixSelector}-drag-corner-button`,
|
|
399
|
+
DRAG_CORNER_BUTTON_INNER: `${tablePrefixSelector}-drag-corner-button-inner`,
|
|
400
|
+
|
|
401
|
+
/** disabled classes */
|
|
402
|
+
DRAG_HANDLE_DISABLED: `${tablePrefixSelector}-drag-handle-disabled`,
|
|
403
|
+
|
|
404
|
+
/** minimised handle class */
|
|
405
|
+
DRAG_HANDLE_MINIMISED: `${tablePrefixSelector}-drag-handle-minimised`,
|
|
406
|
+
|
|
407
|
+
DRAG_SUBMENU: `${tablePrefixSelector}-drag-submenu`,
|
|
408
|
+
DRAG_SUBMENU_ICON: `${tablePrefixSelector}-drag-submenu-icon`,
|
|
409
|
+
|
|
410
|
+
/** Other classes */
|
|
411
|
+
NUMBERED_COLUMN: `${tablePrefixSelector}-numbered-column`,
|
|
412
|
+
NUMBERED_COLUMN_BUTTON: `${tablePrefixSelector}-numbered-column__button`,
|
|
413
|
+
NUMBERED_COLUMN_BUTTON_DISABLED: `${tablePrefixSelector}-numbered-column__button-disabled`,
|
|
414
|
+
|
|
415
|
+
HOVERED_COLUMN: `${tablePrefixSelector}-hovered-column`,
|
|
416
|
+
HOVERED_ROW: `${tablePrefixSelector}-hovered-row`,
|
|
417
|
+
HOVERED_TABLE: `${tablePrefixSelector}-hovered-table`,
|
|
418
|
+
HOVERED_NO_HIGHLIGHT: `${tablePrefixSelector}-hovered-no-highlight`,
|
|
419
|
+
HOVERED_CELL: `${tablePrefixSelector}-hovered-cell`,
|
|
420
|
+
HOVERED_CELL_IN_DANGER: 'danger',
|
|
421
|
+
HOVERED_CELL_ACTIVE: 'active',
|
|
422
|
+
HOVERED_CELL_WARNING: `${tablePrefixSelector}-hovered-cell__warning`,
|
|
423
|
+
HOVERED_DELETE_BUTTON: `${tablePrefixSelector}-hovered-delete-button`,
|
|
424
|
+
WITH_CONTROLS: `${tablePrefixSelector}-with-controls`,
|
|
425
|
+
RESIZING_PLUGIN: `${tablePrefixSelector}-resizing-plugin`,
|
|
426
|
+
RESIZE_CURSOR: `${tablePrefixSelector}-resize-cursor`,
|
|
427
|
+
IS_RESIZING: `${tablePrefixSelector}-is-resizing`,
|
|
428
|
+
|
|
429
|
+
RESIZE_HANDLE_DECORATION: `${tablePrefixSelector}-resize-decoration`,
|
|
430
|
+
|
|
431
|
+
CONTEXTUAL_SUBMENU: `${tablePrefixSelector}-contextual-submenu`,
|
|
432
|
+
CONTEXTUAL_MENU_BUTTON_WRAP: `${tablePrefixSelector}-contextual-menu-button-wrap`,
|
|
433
|
+
CONTEXTUAL_MENU_BUTTON: `${tablePrefixSelector}-contextual-menu-button`,
|
|
434
|
+
CONTEXTUAL_MENU_BUTTON_FIXED: `${tablePrefixSelector}-contextual-menu-button-fixed`,
|
|
435
|
+
CONTEXTUAL_MENU_ICON: `${tablePrefixSelector}-contextual-submenu-icon`,
|
|
436
|
+
CONTEXTUAL_MENU_ICON_SMALL: `${tablePrefixSelector}-contextual-submenu-icon-small`,
|
|
437
|
+
|
|
438
|
+
// come from prosemirror-table
|
|
439
|
+
SELECTED_CELL: 'selectedCell',
|
|
440
|
+
|
|
441
|
+
// defined in ReactNodeView based on PM node name
|
|
442
|
+
NODEVIEW_WRAPPER: 'tableView-content-wrap',
|
|
443
|
+
|
|
444
|
+
TABLE_SELECTED: `${tablePrefixSelector}-table__selected`,
|
|
445
|
+
TABLE_CELL: tableCellSelector,
|
|
446
|
+
TABLE_HEADER_CELL: tableHeaderSelector,
|
|
447
|
+
TABLE_STICKY: `${tablePrefixSelector}-sticky`,
|
|
448
|
+
|
|
449
|
+
TOP_LEFT_CELL: 'table > tbody > tr:nth-child(2) > td:nth-child(1)',
|
|
450
|
+
LAST_ITEM_IN_CELL: `${tablePrefixSelector}-last-item-in-cell`,
|
|
451
|
+
|
|
452
|
+
WITH_COLUMN_INSERT_LINE: `${tablePrefixSelector}-column-insert-line`,
|
|
453
|
+
WITH_COLUMN_INSERT_LINE_INACTIVE: `${tablePrefixSelector}-column-insert-line__inactive`,
|
|
454
|
+
WITH_FIRST_COLUMN_INSERT_LINE: `${tablePrefixSelector}-first-column-insert-line`,
|
|
455
|
+
WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE: `${tablePrefixSelector}-first-column-insert-line__inactive`,
|
|
456
|
+
|
|
457
|
+
WITH_LAST_COLUMN_INSERT_LINE: `${tablePrefixSelector}-last-column-insert-line`,
|
|
458
|
+
WITH_LAST_COLUMN_INSERT_LINE_INACTIVE: `${tablePrefixSelector}-last-column-insert-line__inactive`,
|
|
459
|
+
|
|
460
|
+
WITH_RESIZE_LINE: `${tablePrefixSelector}-column-resize-line`,
|
|
461
|
+
WITH_RESIZE_LINE_LAST_COLUMN: `${tablePrefixSelector}-column-resize-line-last-column`,
|
|
462
|
+
|
|
463
|
+
WITH_ROW_INSERT_LINE: `${tablePrefixSelector}-row-insert-line`,
|
|
464
|
+
WITH_ROW_INSERT_LINE_INACTIVE: `${tablePrefixSelector}-row-insert-line__inactive`,
|
|
465
|
+
WITH_LAST_ROW_INSERT_LINE: `${tablePrefixSelector}-last-row-insert-line`,
|
|
466
|
+
WITH_LAST_ROW_INSERT_LINE_INACTIVE: `${tablePrefixSelector}-last-row-insert-line__inactive`,
|
|
471
467
|
};
|
|
472
468
|
|
|
473
469
|
export interface ToolbarMenuConfig {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
470
|
+
allowHeaderRow?: boolean;
|
|
471
|
+
allowHeaderColumn?: boolean;
|
|
472
|
+
allowNumberColumn?: boolean;
|
|
473
|
+
allowCollapse?: boolean;
|
|
478
474
|
}
|
|
479
475
|
|
|
480
476
|
export interface ToolbarMenuState {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
477
|
+
isHeaderRowEnabled?: boolean;
|
|
478
|
+
isHeaderColumnEnabled?: boolean;
|
|
479
|
+
isNumberColumnEnabled?: boolean;
|
|
480
|
+
isTableCollapsed?: boolean;
|
|
481
|
+
canCollapseTable?: boolean;
|
|
482
|
+
isDragAndDropEnabled?: boolean;
|
|
487
483
|
}
|
|
488
484
|
|
|
489
485
|
export interface ToolbarMenuContext {
|
|
490
|
-
|
|
486
|
+
formatMessage: IntlShape['formatMessage'];
|
|
491
487
|
}
|
|
492
488
|
|
|
493
489
|
export enum ShadowEvent {
|
|
494
|
-
|
|
495
|
-
|
|
490
|
+
SHOW_BEFORE_SHADOW = 'showBeforeShadow',
|
|
491
|
+
SHOW_AFTER_SHADOW = 'showAfterShadow',
|
|
496
492
|
}
|
|
497
493
|
|
|
498
|
-
export type ReportInvalidNodeAttrs = (
|
|
499
|
-
invalidNodeAttrs: InvalidNodeAttr,
|
|
500
|
-
) => void;
|
|
494
|
+
export type ReportInvalidNodeAttrs = (invalidNodeAttrs: InvalidNodeAttr) => void;
|
|
501
495
|
|
|
502
496
|
export type InvalidNodeAttr = {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
497
|
+
nodeType: string;
|
|
498
|
+
attribute: string;
|
|
499
|
+
reason: string;
|
|
500
|
+
spanValue: number;
|
|
501
|
+
tableLocalId: string;
|
|
508
502
|
};
|
|
509
503
|
|
|
510
504
|
export type TableDirection = 'row' | 'column';
|
|
@@ -516,43 +510,43 @@ export type DraggableType = 'table-row' | 'table-column';
|
|
|
516
510
|
export type DraggableBehaviour = 'move' | 'clone';
|
|
517
511
|
|
|
518
512
|
export interface DraggableSourceData extends Record<string, unknown> {
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
513
|
+
type: DraggableType;
|
|
514
|
+
localId: string;
|
|
515
|
+
indexes: number[];
|
|
522
516
|
}
|
|
523
517
|
|
|
524
518
|
export interface DraggableTargetData extends Record<string | symbol, unknown> {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
519
|
+
type: DraggableType;
|
|
520
|
+
localId: string;
|
|
521
|
+
targetIndex: number;
|
|
528
522
|
}
|
|
529
523
|
|
|
530
524
|
export interface DraggableData {
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
525
|
+
sourceType: DraggableType;
|
|
526
|
+
sourceLocalId: string;
|
|
527
|
+
sourceIndexes: number[];
|
|
528
|
+
targetType: DraggableType;
|
|
529
|
+
targetLocalId: string;
|
|
530
|
+
targetIndex: number;
|
|
531
|
+
targetAdjustedIndex: number;
|
|
532
|
+
targetClosestEdge: Edge;
|
|
533
|
+
/**
|
|
534
|
+
* The target direction identifies where relative to the target index is the item being dropped. A value of 'start' would
|
|
535
|
+
* mean that the item is being inserted before the index, and 'end would be after.
|
|
536
|
+
*/
|
|
537
|
+
targetDirection: 'start' | 'end';
|
|
538
|
+
/**
|
|
539
|
+
* This represents a hollistic movement direction; a value of 1 means the source->target index would shift in a positive direction.
|
|
540
|
+
* A value of 0 indicates that the target index is inside the the source indexes.
|
|
541
|
+
*/
|
|
542
|
+
direction: 1 | -1 | 0;
|
|
543
|
+
behaviour: DraggableBehaviour;
|
|
550
544
|
}
|
|
551
545
|
|
|
552
546
|
export type HandleTypes = 'hover' | 'selected';
|
|
553
547
|
|
|
554
548
|
export interface MessageDescriptor {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
549
|
+
id: string;
|
|
550
|
+
description: string;
|
|
551
|
+
defaultMessage: string;
|
|
558
552
|
}
|