@atlaskit/editor-plugin-table 5.3.0 → 5.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/plugins/table/commands/hover.js +17 -8
- package/dist/cjs/plugins/table/commands/index.js +6 -0
- package/dist/cjs/plugins/table/commands/misc.js +1 -7
- package/dist/cjs/plugins/table/event-handlers.js +29 -2
- package/dist/cjs/plugins/table/index.js +1 -1
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +5 -3
- package/dist/cjs/plugins/table/nodeviews/table.js +4 -2
- package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +7 -3
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +7 -2
- package/dist/cjs/plugins/table/pm-plugins/default-table-selection.js +14 -1
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/commands.js +36 -7
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +69 -7
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/reducer.js +2 -0
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/utils/index.js +12 -0
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/utils/monitor.js +59 -0
- package/dist/cjs/plugins/table/pm-plugins/main.js +5 -5
- package/dist/cjs/plugins/table/reducer.js +2 -1
- package/dist/cjs/plugins/table/types.js +14 -1
- package/dist/cjs/plugins/table/ui/DragHandle/index.js +50 -0
- package/dist/cjs/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +53 -14
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.js +114 -0
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +53 -0
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/index.js +11 -106
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +16 -6
- package/dist/cjs/plugins/table/ui/common-styles.js +9 -6
- package/dist/cjs/plugins/table/ui/consts.js +3 -1
- package/dist/cjs/plugins/table/ui/ui-styles.js +21 -9
- package/dist/cjs/plugins/table/utils/decoration.js +111 -19
- package/dist/cjs/plugins/table/utils/dom.js +7 -1
- package/dist/cjs/plugins/table/utils/index.js +38 -1
- package/dist/cjs/plugins/table/utils/merged-cells.js +66 -0
- package/dist/es2019/plugins/table/commands/hover.js +12 -8
- package/dist/es2019/plugins/table/commands/index.js +1 -1
- package/dist/es2019/plugins/table/commands/misc.js +1 -7
- package/dist/es2019/plugins/table/event-handlers.js +28 -2
- package/dist/es2019/plugins/table/index.js +1 -1
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +5 -3
- package/dist/es2019/plugins/table/nodeviews/table.js +4 -2
- package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +8 -6
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +7 -2
- package/dist/es2019/plugins/table/pm-plugins/default-table-selection.js +13 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/commands.js +35 -7
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +69 -4
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/reducer.js +2 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/utils/index.js +1 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/utils/monitor.js +56 -0
- package/dist/es2019/plugins/table/pm-plugins/main.js +6 -5
- package/dist/es2019/plugins/table/reducer.js +2 -1
- package/dist/es2019/plugins/table/types.js +14 -1
- package/dist/es2019/plugins/table/ui/DragHandle/index.js +41 -0
- package/dist/es2019/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +54 -10
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.js +86 -0
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +43 -0
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/index.js +2 -88
- package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +17 -7
- package/dist/es2019/plugins/table/ui/common-styles.js +49 -13
- package/dist/es2019/plugins/table/ui/consts.js +2 -0
- package/dist/es2019/plugins/table/ui/ui-styles.js +171 -15
- package/dist/es2019/plugins/table/utils/decoration.js +106 -18
- package/dist/es2019/plugins/table/utils/dom.js +2 -0
- package/dist/es2019/plugins/table/utils/index.js +4 -3
- package/dist/es2019/plugins/table/utils/merged-cells.js +48 -0
- package/dist/esm/plugins/table/commands/hover.js +16 -8
- package/dist/esm/plugins/table/commands/index.js +1 -1
- package/dist/esm/plugins/table/commands/misc.js +1 -7
- package/dist/esm/plugins/table/event-handlers.js +29 -2
- package/dist/esm/plugins/table/index.js +1 -1
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +5 -3
- package/dist/esm/plugins/table/nodeviews/table.js +4 -2
- package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +8 -6
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +7 -2
- package/dist/esm/plugins/table/pm-plugins/default-table-selection.js +13 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/commands.js +36 -7
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +65 -4
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/reducer.js +2 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/utils/index.js +1 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/utils/monitor.js +53 -0
- package/dist/esm/plugins/table/pm-plugins/main.js +7 -7
- package/dist/esm/plugins/table/reducer.js +2 -1
- package/dist/esm/plugins/table/types.js +14 -1
- package/dist/esm/plugins/table/ui/DragHandle/index.js +41 -0
- package/dist/esm/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +54 -15
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.js +104 -0
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +46 -0
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/index.js +2 -104
- package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +17 -7
- package/dist/esm/plugins/table/ui/common-styles.js +11 -8
- package/dist/esm/plugins/table/ui/consts.js +2 -0
- package/dist/esm/plugins/table/ui/ui-styles.js +21 -9
- package/dist/esm/plugins/table/utils/decoration.js +110 -18
- package/dist/esm/plugins/table/utils/dom.js +6 -0
- package/dist/esm/plugins/table/utils/index.js +4 -3
- package/dist/esm/plugins/table/utils/merged-cells.js +60 -0
- package/dist/types/plugins/table/commands/hover.d.ts +2 -1
- package/dist/types/plugins/table/commands/index.d.ts +1 -1
- package/dist/types/plugins/table/event-handlers.d.ts +1 -0
- package/dist/types/plugins/table/nodeviews/types.d.ts +4 -3
- package/dist/types/plugins/table/pm-plugins/decorations/plugin.d.ts +2 -1
- package/dist/types/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/default-table-selection.d.ts +12 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/actions.d.ts +5 -1
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +6 -1
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/utils/index.d.ts +1 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/utils/monitor.d.ts +3 -0
- package/dist/types/plugins/table/pm-plugins/main.d.ts +1 -1
- package/dist/types/plugins/table/types.d.ts +35 -2
- package/dist/types/plugins/table/ui/DragHandle/index.d.ts +11 -0
- package/dist/types/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +4 -1
- package/dist/types/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.d.ts +17 -0
- package/dist/types/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +16 -0
- package/dist/types/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +2 -17
- package/dist/types/plugins/table/ui/TableFloatingControls/index.d.ts +3 -2
- package/dist/types/plugins/table/ui/consts.d.ts +2 -0
- package/dist/types/plugins/table/ui/ui-styles.d.ts +1 -0
- package/dist/types/plugins/table/utils/decoration.d.ts +4 -2
- package/dist/types/plugins/table/utils/dom.d.ts +2 -0
- package/dist/types/plugins/table/utils/index.d.ts +3 -2
- package/dist/types/plugins/table/utils/merged-cells.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/commands/hover.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/commands/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/event-handlers.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/types.d.ts +4 -3
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/plugin.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/default-table-selection.d.ts +12 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/actions.d.ts +5 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +6 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/utils/index.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/utils/monitor.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/types.d.ts +35 -2
- package/dist/types-ts4.5/plugins/table/ui/DragHandle/index.d.ts +11 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +4 -1
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.d.ts +17 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/DragControls.d.ts +16 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +2 -17
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +3 -2
- package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +4 -2
- package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/utils/index.d.ts +3 -2
- package/dist/types-ts4.5/plugins/table/utils/merged-cells.d.ts +3 -0
- package/package.json +6 -2
- package/src/__tests__/unit/event-handlers.ts +74 -1
- package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +35 -15
- package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +146 -42
- package/src/__tests__/unit/ui/NumberColumn.tsx +148 -0
- package/src/__tests__/unit/ui/RowControls.tsx +4 -4
- package/src/__tests__/unit/ui/RowDragControls.tsx +118 -0
- package/src/__tests__/unit/ui/TableFloatingControls.tsx +9 -5
- package/src/plugins/table/commands/hover.ts +16 -7
- package/src/plugins/table/commands/index.ts +1 -0
- package/src/plugins/table/commands/misc.ts +0 -5
- package/src/plugins/table/event-handlers.ts +49 -2
- package/src/plugins/table/index.tsx +1 -1
- package/src/plugins/table/nodeviews/TableComponent.tsx +3 -2
- package/src/plugins/table/nodeviews/table.tsx +2 -0
- package/src/plugins/table/nodeviews/types.ts +4 -3
- package/src/plugins/table/pm-plugins/decorations/plugin.ts +13 -4
- package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +10 -5
- package/src/plugins/table/pm-plugins/default-table-selection.ts +10 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/actions.ts +6 -1
- package/src/plugins/table/pm-plugins/drag-and-drop/commands.ts +58 -8
- package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +77 -4
- package/src/plugins/table/pm-plugins/drag-and-drop/reducer.ts +2 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/utils/index.ts +1 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/utils/monitor.ts +72 -0
- package/src/plugins/table/pm-plugins/main.ts +9 -4
- package/src/plugins/table/reducer.ts +2 -1
- package/src/plugins/table/types.ts +37 -3
- package/src/plugins/table/ui/DragHandle/index.tsx +57 -0
- package/src/plugins/table/ui/TableFloatingControls/NumberColumn/index.tsx +68 -30
- package/src/plugins/table/ui/TableFloatingControls/RowControls/ClassicControls.tsx +129 -0
- package/src/plugins/table/ui/TableFloatingControls/RowControls/DragControls.tsx +75 -0
- package/src/plugins/table/ui/TableFloatingControls/RowControls/index.tsx +2 -135
- package/src/plugins/table/ui/TableFloatingControls/index.tsx +43 -24
- package/src/plugins/table/ui/common-styles.ts +54 -11
- package/src/plugins/table/ui/consts.ts +2 -0
- package/src/plugins/table/ui/ui-styles.ts +173 -14
- package/src/plugins/table/utils/decoration.ts +176 -27
- package/src/plugins/table/utils/dom.ts +8 -0
- package/src/plugins/table/utils/index.ts +5 -0
- package/src/plugins/table/utils/merged-cells.ts +67 -0
- package/tsconfig.app.json +3 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30;
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { tableCellBorderWidth, tableMarginTop, tableMarginTopWithControl } from '@atlaskit/editor-common/styles';
|
|
5
5
|
import { akEditorShadowZIndex, akEditorTableNumberColumnWidth, akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
|
|
@@ -7,7 +7,7 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
|
7
7
|
import { B300, N0, N300, N40A, N60A, Y200, Y50 } from '@atlaskit/theme/colors';
|
|
8
8
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
9
9
|
import { TableCssClassName as ClassName } from '../types';
|
|
10
|
-
import { columnControlsDecorationHeight, columnControlsSelectedZIndex, columnControlsZIndex, lineMarkerSize, resizeHandlerAreaWidth, resizeHandlerZIndex, resizeLineWidth, tableBorderColor, tableBorderDeleteColor, tableBorderSelectedColor, tableCellDeleteColor, tableCellHoverDeleteIconBackground, tableCellHoverDeleteIconColor, tableCellSelectedDeleteIconBackground, tableCellSelectedDeleteIconColor, tableDeleteButtonSize, tableHeaderCellBackgroundColor, tableInsertColumnButtonSize, tableOverflowShadowWidth, tableOverflowShadowWidthWide, tableToolbarDeleteColor, tableToolbarSelectedColor, tableToolbarSize } from './consts';
|
|
10
|
+
import { columnControlsDecorationHeight, columnControlsSelectedZIndex, columnControlsZIndex, insertLineWidth, lineMarkerSize, resizeHandlerAreaWidth, resizeHandlerZIndex, resizeLineWidth, tableBorderColor, tableBorderDeleteColor, tableBorderSelectedColor, tableCellDeleteColor, tableCellHoverDeleteIconBackground, tableCellHoverDeleteIconColor, tableCellSelectedDeleteIconBackground, tableCellSelectedDeleteIconColor, tableDeleteButtonSize, tableHeaderCellBackgroundColor, tableInsertColumnButtonSize, tableOverflowShadowWidth, tableOverflowShadowWidthWide, tableToolbarDeleteColor, tableToolbarSelectedColor, tableToolbarSize } from './consts';
|
|
11
11
|
var InsertLine = function InsertLine(props, cssString) {
|
|
12
12
|
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n background: ", ";\n display: none;\n position: absolute;\n z-index: ", ";\n ", "\n }\n"])), ClassName.CONTROLS_INSERT_LINE, tableBorderSelectedColor(props), akEditorUnitZIndex, cssString);
|
|
13
13
|
};
|
|
@@ -67,24 +67,36 @@ export var floatingColumnControls = function floatingColumnControls(props) {
|
|
|
67
67
|
return css(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n .", " {\n box-sizing: border-box;\n position: absolute;\n\n .", " {\n display: flex;\n flex-direction: row;\n }\n }\n "])), ClassName.COLUMN_DROP_TARGET_CONTROLS, ClassName.COLUMN_CONTROLS_INNER);
|
|
68
68
|
};
|
|
69
69
|
export var columnControlsDecoration = function columnControlsDecoration(props) {
|
|
70
|
+
if (getBooleanFF('platform.editor.table.drag-and-drop')) {
|
|
71
|
+
return css(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n .", " {\n position: absolute;\n // kinda a hacky way to center an element with absolute positioning inside a relative element\n top: 25%;\n left: 50%;\n transform: translate(-50%, -100%);\n }\n "])), ClassName.COLUMN_CONTROLS_DECORATIONS_WITH_DRAG);
|
|
72
|
+
}
|
|
70
73
|
if (getBooleanFF('platform.editor.table.column-controls-styles-updated')) {
|
|
71
|
-
return css(
|
|
74
|
+
return css(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["\n .", " {\n display: none;\n cursor: pointer;\n position: absolute;\n width: 100%;\n left: 0;\n top: -", "px;\n height: ", "px;\n // floating dot for adding column button\n &::before {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: 2px;\n right: -1px;\n }\n\n &::after {\n content: ' ';\n\n ", "\n }\n }\n\n // floating dot for adding column button - overriding style on last column to avoid scroll\n ", "\n\n div.", ">.", "::after {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: -", "px;\n right: -1px;\n }\n\n .", " .", " {\n display: block;\n }\n\n table tr:first-of-type th.", " {\n &.", ", &.", " {\n .", "::after {\n ", ";\n }\n\n &.", "\n .", "::after {\n background-color: ", ";\n border-color: ", ";\n z-index: ", ";\n }\n }\n }\n\n table tr:first-of-type th.", " {\n &.", ", &.", " {\n .", "::after {\n ", ";\n border-left: ", "px solid\n ", ";\n left: -", "px;\n }\n }\n }\n\n table tr:first-of-type th.", " {\n &.", " {\n .", "::after {\n ", ";\n }\n\n &.", "\n .", "::after {\n background-color: ", ";\n border-color: ", ";\n border-left: ", "px solid\n ", ";\n left: -", "px;\n z-index: ", ";\n }\n }\n }\n\n .", "\n table\n tr:first-of-type\n td.", ",\n .", "\n table\n tr:first-of-type\n th.", " {\n .", "::after {\n ", ";\n }\n }\n "])), ClassName.COLUMN_CONTROLS_DECORATIONS, columnControlsDecorationHeight + tableCellBorderWidth, columnControlsDecorationHeight, tableBorderColor(props), lineMarkerSize, lineMarkerSize, columnHeaderButton(props, "\n border-right: ".concat(tableCellBorderWidth, "px solid ").concat(tableBorderColor(props), ";\n border-top: ").concat(tableCellBorderWidth, "px solid ").concat(tableBorderColor(props), ";\n border-bottom: ").concat(tableCellBorderWidth, "px solid ").concat(tableBorderColor(props), ";\n box-sizing: content-box;\n height: ").concat(tableToolbarSize - 1, "px;\n width: 100%;\n position: absolute;\n top: ").concat(columnControlsDecorationHeight - tableToolbarSize, "px;\n left: 0px;\n z-index: ").concat(columnControlsZIndex, ";\n ")), getFloatingDotOverrides(props), ClassName.WITH_CONTROLS, ClassName.ROW_CONTROLS_WRAPPER, tableBorderColor(props), lineMarkerSize, lineMarkerSize, tableToolbarSize + tableCellBorderWidth, ClassName.WITH_CONTROLS, ClassName.COLUMN_CONTROLS_DECORATIONS, ClassName.TABLE_HEADER_CELL, ClassName.COLUMN_SELECTED, ClassName.HOVERED_TABLE, ClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props), ClassName.HOVERED_CELL_IN_DANGER, ClassName.COLUMN_CONTROLS_DECORATIONS, tableToolbarDeleteColor(props), tableBorderDeleteColor(props), akEditorUnitZIndex * 100, ClassName.TABLE_HEADER_CELL, ClassName.COLUMN_SELECTED, ClassName.HOVERED_COLUMN, ClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props), tableCellBorderWidth, tableBorderSelectedColor(props), tableCellBorderWidth, ClassName.TABLE_HEADER_CELL, ClassName.HOVERED_COLUMN, ClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props), ClassName.HOVERED_CELL_IN_DANGER, ClassName.COLUMN_CONTROLS_DECORATIONS, tableToolbarDeleteColor(props), tableBorderDeleteColor(props), tableCellBorderWidth, tableBorderDeleteColor(props), tableCellBorderWidth, akEditorUnitZIndex * 100, ClassName.TABLE_SELECTED, ClassName.TABLE_CELL, ClassName.TABLE_SELECTED, ClassName.TABLE_HEADER_CELL, ClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props));
|
|
72
75
|
} else {
|
|
73
|
-
return css(
|
|
76
|
+
return css(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral(["\n .", " {\n display: none;\n cursor: pointer;\n position: absolute;\n width: calc(100% + ", "px);\n left: -1px;\n top: -", "px;\n height: ", "px;\n // floating dot for adding column button\n &::before {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: 2px;\n right: -1px;\n }\n\n &::after {\n content: ' ';\n\n ", "\n }\n }\n\n // floating dot for adding column button - overriding style on last column to avoid scroll\n ", "\n\n div.", ">.", "::after {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: -", "px;\n right: -1px;\n }\n\n .", " .", " {\n display: block;\n }\n\n table\n tr:first-of-type\n td.", ",\n table\n tr:first-of-type\n th.", " {\n &.", ",\n &.", ",\n &.", " {\n .", "::after {\n ", ";\n }\n\n &.", "\n .", "::after {\n background-color: ", ";\n border: 1px solid ", ";\n border-bottom: none;\n z-index: ", ";\n }\n }\n }\n\n .", "\n table\n tr:first-of-type\n td.", ",\n .", "\n table\n tr:first-of-type\n th.", " {\n .", "::after {\n ", ";\n }\n }\n "])), ClassName.COLUMN_CONTROLS_DECORATIONS, tableCellBorderWidth * 2, columnControlsDecorationHeight + tableCellBorderWidth, columnControlsDecorationHeight, tableBorderColor(props), lineMarkerSize, lineMarkerSize, columnHeaderButton(props, "\n border-right: ".concat(tableCellBorderWidth, "px solid ").concat(tableBorderColor(props), ";\n border-bottom: none;\n height: ").concat(tableToolbarSize, "px;\n width: 100%;\n position: absolute;\n top: ").concat(columnControlsDecorationHeight - tableToolbarSize, "px;\n left: 0px;\n z-index: ").concat(columnControlsZIndex, ";\n ")), getFloatingDotOverrides(props), ClassName.WITH_CONTROLS, ClassName.ROW_CONTROLS_WRAPPER, tableBorderColor(props), lineMarkerSize, lineMarkerSize, tableToolbarSize + tableCellBorderWidth, ClassName.WITH_CONTROLS, ClassName.COLUMN_CONTROLS_DECORATIONS, ClassName.TABLE_CELL, ClassName.TABLE_HEADER_CELL, ClassName.COLUMN_SELECTED, ClassName.HOVERED_COLUMN, ClassName.HOVERED_TABLE, ClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props), ClassName.HOVERED_CELL_IN_DANGER, ClassName.COLUMN_CONTROLS_DECORATIONS, tableToolbarDeleteColor(props), tableBorderDeleteColor(props), akEditorUnitZIndex * 100, ClassName.TABLE_SELECTED, ClassName.TABLE_CELL, ClassName.TABLE_SELECTED, ClassName.TABLE_HEADER_CELL, ClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props));
|
|
74
77
|
}
|
|
75
78
|
};
|
|
76
79
|
export var hoveredDeleteButton = function hoveredDeleteButton(props) {
|
|
77
|
-
return css(
|
|
80
|
+
return css(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["\n .", ".", " {\n .", ",\n .", ",\n .", " {\n border: 1px solid ", ";\n }\n .", "::after {\n background: ", ";\n }\n }\n"])), ClassName.TABLE_CONTAINER, ClassName.HOVERED_DELETE_BUTTON, ClassName.SELECTED_CELL, ClassName.COLUMN_SELECTED, ClassName.HOVERED_CELL, tableBorderDeleteColor(props), ClassName.SELECTED_CELL, tableCellDeleteColor(props));
|
|
78
81
|
};
|
|
79
82
|
export var hoveredCell = function hoveredCell(props) {
|
|
80
|
-
return css(
|
|
83
|
+
return css(_templateObject24 || (_templateObject24 = _taggedTemplateLiteral(["\n :not(.", ")\n .", ":not(.", ") {\n .", " {\n position: relative;\n border: 1px solid ", ";\n }\n }\n"])), ClassName.IS_RESIZING, ClassName.TABLE_CONTAINER, ClassName.HOVERED_DELETE_BUTTON, ClassName.HOVERED_CELL, tableBorderSelectedColor(props));
|
|
81
84
|
};
|
|
82
|
-
export var hoveredWarningCell = css(
|
|
85
|
+
export var hoveredWarningCell = css(_templateObject25 || (_templateObject25 = _taggedTemplateLiteral(["\n :not(.", ")\n .", ":not(.", ") {\n td.", " {\n background-color: ", " !important; // We need to override the background-color added to the cell\n border: 1px solid ", ";\n }\n }\n"])), ClassName.IS_RESIZING, ClassName.TABLE_CONTAINER, ClassName.HOVERED_DELETE_BUTTON, ClassName.HOVERED_CELL_WARNING, "var(--ds-background-warning, ".concat(Y50, ")"), "var(--ds-border-warning, ".concat(Y200, ")"));
|
|
83
86
|
|
|
84
87
|
// move the resize handle zone completely inside the table cell to avoid overflow
|
|
85
88
|
var getLastColumnResizerOverrides = function getLastColumnResizerOverrides() {
|
|
86
|
-
return getBooleanFF('platform.editor.custom-table-width') ? css(
|
|
89
|
+
return getBooleanFF('platform.editor.custom-table-width') ? css(_templateObject26 || (_templateObject26 = _taggedTemplateLiteral(["\n tr\n th:last-child\n .", ",\n tr\n td:last-child\n .", " {\n background-color: transparent;\n position: absolute;\n width: ", "px;\n height: 100%;\n top: 0;\n right: 0;\n cursor: col-resize;\n z-index: ", ";\n }\n "])), ClassName.RESIZE_HANDLE_DECORATION, ClassName.RESIZE_HANDLE_DECORATION, resizeHandlerAreaWidth / 2, resizeHandlerZIndex) : '';
|
|
90
|
+
};
|
|
91
|
+
var resizeHandleOverrides = function resizeHandleOverrides(props) {
|
|
92
|
+
if (getBooleanFF('platform.editor.table.drag-and-drop')) {
|
|
93
|
+
return css(_templateObject27 || (_templateObject27 = _taggedTemplateLiteral(["\n th.", "::before,\n td.", "::before {\n content: ' ';\n position: absolute;\n left: ", ";\n top: -1px;\n width: ", "px;\n height: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before,\n td.", "::before {\n content: ' ';\n position: absolute;\n right: -1px;\n top: -1px;\n width: ", "px;\n height: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n "])), ClassName.WITH_RESIZE_LINE, ClassName.WITH_RESIZE_LINE, "var(--ds-space-negative-025, -2px)", resizeLineWidth, tableBorderSelectedColor(props), columnControlsZIndex * 2, ClassName.WITH_RESIZE_LINE_LAST_COLUMN, ClassName.WITH_RESIZE_LINE_LAST_COLUMN, resizeLineWidth, tableBorderSelectedColor(props), columnControlsZIndex * 2);
|
|
94
|
+
}
|
|
95
|
+
return css(_templateObject28 || (_templateObject28 = _taggedTemplateLiteral(["\n td.", "::before {\n content: ' ';\n position: absolute;\n left: ", ";\n top: -1px;\n width: ", "px;\n height: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: ", ";\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n right: -1px;\n top: -1px;\n width: ", "px;\n height: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n right: -1px;\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n "])), ClassName.WITH_RESIZE_LINE, "var(--ds-space-negative-025, -2px)", resizeLineWidth, tableBorderSelectedColor(props), columnControlsZIndex * 2, ClassName.WITH_RESIZE_LINE, "var(--ds-space-negative-025, -2px)", resizeLineWidth, tableToolbarSize + tableCellBorderWidth, tableBorderSelectedColor(props), columnControlsZIndex * 2, tableToolbarSize + tableCellBorderWidth, ClassName.WITH_RESIZE_LINE_LAST_COLUMN, resizeLineWidth, tableBorderSelectedColor(props), columnControlsZIndex * 2, ClassName.WITH_RESIZE_LINE_LAST_COLUMN, resizeLineWidth, tableToolbarSize + tableCellBorderWidth, tableBorderSelectedColor(props), columnControlsZIndex * 2, tableToolbarSize + tableCellBorderWidth);
|
|
87
96
|
};
|
|
88
97
|
export var resizeHandle = function resizeHandle(props) {
|
|
89
|
-
return css(
|
|
98
|
+
return css(_templateObject29 || (_templateObject29 = _taggedTemplateLiteral(["\n .", " {\n .", " {\n background-color: transparent;\n position: absolute;\n width: ", "px;\n height: 100%;\n top: 0;\n right: -", "px;\n cursor: col-resize;\n z-index: ", ";\n }\n\n ", "\n\n ", "\n\n table\n tr:first-of-type\n th.", "\n .", "::after,\n table\n tr:first-of-type\n td.", "\n .", "::after {\n top: -", "px;\n height: calc(100% + ", "px);\n }\n }\n"])), ClassName.TABLE_CONTAINER, ClassName.RESIZE_HANDLE_DECORATION, resizeHandlerAreaWidth, resizeHandlerAreaWidth / 2, resizeHandlerZIndex, getLastColumnResizerOverrides(), resizeHandleOverrides(props), ClassName.WITH_RESIZE_LINE, ClassName.RESIZE_HANDLE_DECORATION, ClassName.WITH_RESIZE_LINE, ClassName.RESIZE_HANDLE_DECORATION, tableToolbarSize + tableCellBorderWidth, tableToolbarSize + tableCellBorderWidth);
|
|
99
|
+
};
|
|
100
|
+
export var insertLine = function insertLine(props) {
|
|
101
|
+
return css(_templateObject30 || (_templateObject30 = _taggedTemplateLiteral(["\n .", " {\n td.", "::before {\n content: ' ';\n position: absolute;\n left: -1px;\n top: -1px;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: -1px;\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n left: ", ";\n top: -1px;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: ", ";\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n right: -1px;\n top: -1px;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n right: -1px;\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n left: ", ";\n top: -1px;\n height: ", "px;\n width: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: ", ";\n position: absolute;\n height: ", "px;\n width: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -1px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n left: ", ";\n bottom: 0;\n height: ", "px;\n width: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: ", ";\n bottom: 0;\n position: absolute;\n height: ", "px;\n width: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n }\n }\n"])), ClassName.TABLE_CONTAINER, ClassName.WITH_FIRST_COLUMN_INSERT_LINE, insertLineWidth, tableCellBorderWidth * 2, tableBorderSelectedColor(props), columnControlsZIndex * 2, ClassName.WITH_FIRST_COLUMN_INSERT_LINE, insertLineWidth, tableCellBorderWidth * 2, tableBorderSelectedColor(props), columnControlsZIndex * 2, tableCellBorderWidth, ClassName.WITH_COLUMN_INSERT_LINE, "var(--ds-space-negative-025, -2px)", insertLineWidth, tableCellBorderWidth * 2, tableBorderSelectedColor(props), columnControlsZIndex * 2, ClassName.WITH_COLUMN_INSERT_LINE, "var(--ds-space-negative-025, -2px)", insertLineWidth, tableCellBorderWidth * 2, tableBorderSelectedColor(props), columnControlsZIndex * 2, tableCellBorderWidth, ClassName.WITH_LAST_COLUMN_INSERT_LINE, insertLineWidth, tableCellBorderWidth * 2, tableBorderSelectedColor(props), columnControlsZIndex * 2, ClassName.WITH_LAST_COLUMN_INSERT_LINE, insertLineWidth, tableCellBorderWidth * 2, tableBorderSelectedColor(props), columnControlsZIndex * 2, tableCellBorderWidth, ClassName.WITH_ROW_INSERT_LINE, "var(--ds-space-negative-025, -2px)", insertLineWidth, tableCellBorderWidth * 2, tableBorderSelectedColor(props), columnControlsZIndex * 2, ClassName.WITH_ROW_INSERT_LINE, "var(--ds-space-negative-025, -2px)", insertLineWidth, tableCellBorderWidth * 2, tableBorderSelectedColor(props), columnControlsZIndex * 2, ClassName.WITH_LAST_ROW_INSERT_LINE, "var(--ds-space-negative-025, -2px)", insertLineWidth, tableBorderSelectedColor(props), columnControlsZIndex * 2, ClassName.WITH_LAST_ROW_INSERT_LINE, "var(--ds-space-negative-025, -2px)", insertLineWidth, tableCellBorderWidth * 2, tableBorderSelectedColor(props), columnControlsZIndex * 2);
|
|
90
102
|
};
|
|
@@ -9,8 +9,10 @@ import { nonNullable } from '@atlaskit/editor-common/utils';
|
|
|
9
9
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
10
10
|
import { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
|
|
11
11
|
import { findTable, getCellsInRow, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
12
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
12
13
|
import { TableCssClassName as ClassName, TableDecorations } from '../types';
|
|
13
14
|
import { ColumnResizeWidget } from '../ui/ColumnResizeWidget';
|
|
15
|
+
import { DragHandle } from '../ui/DragHandle';
|
|
14
16
|
var filterDecorationByKey = function filterDecorationByKey(key, decorationSet) {
|
|
15
17
|
return decorationSet.find(undefined, undefined, function (spec) {
|
|
16
18
|
return spec.key.indexOf(key) > -1;
|
|
@@ -147,30 +149,54 @@ export var createColumnSelectedDecoration = function createColumnSelectedDecorat
|
|
|
147
149
|
});
|
|
148
150
|
});
|
|
149
151
|
};
|
|
150
|
-
export var createColumnControlsDecoration = function createColumnControlsDecoration(selection) {
|
|
152
|
+
export var createColumnControlsDecoration = function createColumnControlsDecoration(selection, hoverLocation) {
|
|
153
|
+
// todo: issue here where table may not be selected yet
|
|
151
154
|
var cells = getCellsInRow(0)(selection) || [];
|
|
152
|
-
var
|
|
153
|
-
|
|
154
|
-
var
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
var startIndex = index;
|
|
158
|
-
var endIndex = startIndex + colspan;
|
|
159
|
-
|
|
160
|
-
// The next cell start index will commence from the current cell end index.
|
|
161
|
-
index = endIndex;
|
|
162
|
-
return Decoration.widget(cell.pos + 1, function () {
|
|
155
|
+
var table = findTable(selection);
|
|
156
|
+
if (getBooleanFF('platform.editor.table.drag-and-drop') && hoverLocation && !Number.isNaN(hoverLocation === null || hoverLocation === void 0 ? void 0 : hoverLocation.colIndex) && table) {
|
|
157
|
+
var colIndex = hoverLocation.colIndex;
|
|
158
|
+
var cell = cells[colIndex];
|
|
159
|
+
return [Decoration.widget(cell.pos + 1, function () {
|
|
163
160
|
var element = document.createElement('div');
|
|
164
|
-
element.classList.add(ClassName.
|
|
165
|
-
|
|
166
|
-
|
|
161
|
+
element.classList.add(ClassName.COLUMN_CONTROLS_DECORATIONS_WITH_DRAG);
|
|
162
|
+
ReactDOM.render( /*#__PURE__*/createElement(DragHandle, {
|
|
163
|
+
tableLocalId: table.node.attrs.localId,
|
|
164
|
+
direction: 'column',
|
|
165
|
+
indexes: [colIndex]
|
|
166
|
+
}), element);
|
|
167
167
|
return element;
|
|
168
168
|
}, {
|
|
169
|
-
key: "".concat(TableDecorations.COLUMN_CONTROLS_DECORATIONS, "_").concat(
|
|
169
|
+
key: "".concat(TableDecorations.COLUMN_CONTROLS_DECORATIONS, "_").concat(colIndex),
|
|
170
170
|
// this decoration should be the first one, even before gap cursor.
|
|
171
|
-
side: -100
|
|
171
|
+
side: -100,
|
|
172
|
+
destroy: function destroy(node) {
|
|
173
|
+
ReactDOM.unmountComponentAtNode(node);
|
|
174
|
+
}
|
|
175
|
+
})];
|
|
176
|
+
} else {
|
|
177
|
+
var index = 0;
|
|
178
|
+
return cells.map(function (cell) {
|
|
179
|
+
var colspan = cell.node.attrs.colspan || 1;
|
|
180
|
+
// It's important these values are scoped locally as the widget callback could be executed anytime in the future
|
|
181
|
+
// and we want to avoid value leak
|
|
182
|
+
var startIndex = index;
|
|
183
|
+
var endIndex = startIndex + colspan;
|
|
184
|
+
|
|
185
|
+
// The next cell start index will commence from the current cell end index.
|
|
186
|
+
index = endIndex;
|
|
187
|
+
return Decoration.widget(cell.pos + 1, function () {
|
|
188
|
+
var element = document.createElement('div');
|
|
189
|
+
element.classList.add(ClassName.COLUMN_CONTROLS_DECORATIONS);
|
|
190
|
+
element.dataset.startIndex = "".concat(startIndex);
|
|
191
|
+
element.dataset.endIndex = "".concat(endIndex);
|
|
192
|
+
return element;
|
|
193
|
+
}, {
|
|
194
|
+
key: "".concat(TableDecorations.COLUMN_CONTROLS_DECORATIONS, "_").concat(endIndex),
|
|
195
|
+
// this decoration should be the first one, even before gap cursor.
|
|
196
|
+
side: -100
|
|
197
|
+
});
|
|
172
198
|
});
|
|
173
|
-
}
|
|
199
|
+
}
|
|
174
200
|
};
|
|
175
201
|
export var updateDecorations = function updateDecorations(node, decorationSet, decorations, key) {
|
|
176
202
|
var filteredDecorations = filterDecorationByKey(key, decorationSet);
|
|
@@ -431,4 +457,70 @@ export var createColumnLineResize = function createColumnLineResize(selection, c
|
|
|
431
457
|
key: "".concat(TableDecorations.COLUMN_RESIZING_HANDLE_LINE, "_").concat(cellColumnPositioning.right, "_").concat(index)
|
|
432
458
|
});
|
|
433
459
|
}).filter(nonNullable);
|
|
460
|
+
};
|
|
461
|
+
export var createColumnInsertLine = function createColumnInsertLine(columnIndex, selection) {
|
|
462
|
+
var table = findTable(selection);
|
|
463
|
+
if (!table) {
|
|
464
|
+
return [];
|
|
465
|
+
}
|
|
466
|
+
var map = TableMap.get(table.node);
|
|
467
|
+
var isFirstColumn = columnIndex === 0;
|
|
468
|
+
var isLastColumn = columnIndex === map.width;
|
|
469
|
+
if (isLastColumn) {
|
|
470
|
+
columnIndex -= 1;
|
|
471
|
+
}
|
|
472
|
+
var decorationClassName = isFirstColumn ? ClassName.WITH_FIRST_COLUMN_INSERT_LINE : isLastColumn ? ClassName.WITH_LAST_COLUMN_INSERT_LINE : ClassName.WITH_COLUMN_INSERT_LINE;
|
|
473
|
+
var cellPositions = makeArray(map.height).map(function (rowIndex) {
|
|
474
|
+
return map.map[map.width * rowIndex + columnIndex];
|
|
475
|
+
}).filter(function (cellPosition, rowIndex) {
|
|
476
|
+
if (isLastColumn) {
|
|
477
|
+
return true; // If is the last column no filter applied
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
var nextPosition = map.map[map.width * rowIndex + columnIndex - 1];
|
|
481
|
+
return cellPosition !== nextPosition; // Removed it if next position is merged
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
var cells = cellPositions.map(function (pos) {
|
|
485
|
+
return {
|
|
486
|
+
pos: pos + table.start,
|
|
487
|
+
node: table.node.nodeAt(pos)
|
|
488
|
+
};
|
|
489
|
+
});
|
|
490
|
+
return cells.map(function (cell, index) {
|
|
491
|
+
if (!cell || !cell.node) {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
return Decoration.node(cell.pos, cell.pos + cell.node.nodeSize, {
|
|
495
|
+
class: decorationClassName
|
|
496
|
+
}, {
|
|
497
|
+
key: "".concat(TableDecorations.COLUMN_INSERT_LINE, "_").concat(index)
|
|
498
|
+
});
|
|
499
|
+
}).filter(nonNullable);
|
|
500
|
+
};
|
|
501
|
+
export var createRowInsertLine = function createRowInsertLine(rowIndex, selection) {
|
|
502
|
+
var table = findTable(selection);
|
|
503
|
+
if (!table) {
|
|
504
|
+
return [];
|
|
505
|
+
}
|
|
506
|
+
var map = TableMap.get(table.node);
|
|
507
|
+
var isLastRow = rowIndex === map.height;
|
|
508
|
+
if (isLastRow) {
|
|
509
|
+
rowIndex -= 1;
|
|
510
|
+
}
|
|
511
|
+
var cells = getCellsInRow(rowIndex)(selection);
|
|
512
|
+
if (!cells) {
|
|
513
|
+
return [];
|
|
514
|
+
}
|
|
515
|
+
var decorationClassName = isLastRow ? ClassName.WITH_LAST_ROW_INSERT_LINE : ClassName.WITH_ROW_INSERT_LINE;
|
|
516
|
+
return cells.map(function (cell, index) {
|
|
517
|
+
if (!cell || !cell.node) {
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
return Decoration.node(cell.pos, cell.pos + cell.node.nodeSize, {
|
|
521
|
+
class: decorationClassName
|
|
522
|
+
}, {
|
|
523
|
+
key: "".concat(TableDecorations.ROW_INSERT_LINE, "_").concat(index)
|
|
524
|
+
});
|
|
525
|
+
}).filter(nonNullable);
|
|
434
526
|
};
|
|
@@ -17,9 +17,15 @@ export var getColumnOrRowIndex = function getColumnOrRowIndex(target) {
|
|
|
17
17
|
export var isColumnControlsDecorations = function isColumnControlsDecorations(node) {
|
|
18
18
|
return containsClassName(node, ClassName.COLUMN_CONTROLS_DECORATIONS);
|
|
19
19
|
};
|
|
20
|
+
export var isColumnDragControlsDecorations = function isColumnDragControlsDecorations(node) {
|
|
21
|
+
return containsClassName(node, ClassName.COLUMN_CONTROLS_DECORATIONS_WITH_DRAG) || closestElement(node, ".".concat(ClassName.COLUMN_CONTROLS_DECORATIONS_WITH_DRAG));
|
|
22
|
+
};
|
|
20
23
|
export var isRowControlsButton = function isRowControlsButton(node) {
|
|
21
24
|
return containsClassName(node, ClassName.ROW_CONTROLS_BUTTON) || containsClassName(node, ClassName.NUMBERED_COLUMN_BUTTON);
|
|
22
25
|
};
|
|
26
|
+
export var isRowDragControlsButton = function isRowDragControlsButton(node) {
|
|
27
|
+
return containsClassName(node, ClassName.ROW_CONTROLS_WITH_DRAG) || closestElement(node, ".".concat(ClassName.ROW_CONTROLS_WITH_DRAG));
|
|
28
|
+
};
|
|
23
29
|
export var isResizeHandleDecoration = function isResizeHandleDecoration(node) {
|
|
24
30
|
return containsClassName(node, ClassName.RESIZE_HANDLE_DECORATION);
|
|
25
31
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export { getSelectedColumnIndexes, getSelectedRowIndexes, normalizeSelection, isSelectionUpdated } from './selection';
|
|
2
|
-
export { findControlsHoverDecoration, createControlsHoverDecoration, createColumnControlsDecoration, createColumnSelectedDecoration, createCellHoverDecoration, updateDecorations, createResizeHandleDecoration, createColumnLineResize } from './decoration';
|
|
2
|
+
export { findControlsHoverDecoration, createControlsHoverDecoration, createColumnControlsDecoration, createColumnSelectedDecoration, createCellHoverDecoration, updateDecorations, createResizeHandleDecoration, createColumnInsertLine, createColumnLineResize, createRowInsertLine } from './decoration';
|
|
3
3
|
export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, isLayoutSupported, getTableWidth, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, isTableNested, anyChildCellMergedAcrossRow, supportedHeaderRow } from './nodes';
|
|
4
4
|
export { unwrapContentFromTable, removeTableFromFirstChild, removeTableFromLastChild, transformSliceToRemoveOpenTable, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell } from './paste';
|
|
5
|
-
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, updateResizeHandles, isResizeHandleDecoration, hasResizeHandler } from './dom';
|
|
5
|
+
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isColumnDragControlsDecorations, isRowDragControlsButton, isRowControlsButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, updateResizeHandles, isResizeHandleDecoration, hasResizeHandler } from './dom';
|
|
6
6
|
export { getColumnsWidths, isColumnDeleteButtonVisible, getColumnDeleteButtonParams, getColumnClassNames } from './column-controls';
|
|
7
7
|
export { getRowHeights, isRowDeleteButtonVisible, getRowDeleteButtonParams, getRowsParams, getRowClassNames, copyPreviousRow } from './row-controls';
|
|
8
8
|
export { getSelectedTableInfo, getSelectedCellInfo } from './analytics';
|
|
9
9
|
export { getMergedCellsPositions } from './table';
|
|
10
|
-
export { updatePluginStateDecorations } from './update-plugin-state-decorations';
|
|
10
|
+
export { updatePluginStateDecorations } from './update-plugin-state-decorations';
|
|
11
|
+
export { hasMergedCellsInColumn, hasMergedCellsInRow } from './merged-cells';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { findTable, TableMap } from '@atlaskit/editor-tables';
|
|
2
|
+
var hasMergedCells = function hasMergedCells(indexes, normalizeRect) {
|
|
3
|
+
return function (selection) {
|
|
4
|
+
var table = findTable(selection);
|
|
5
|
+
if (!table) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
var map = TableMap.get(table.node);
|
|
9
|
+
var cellPositions = new Set();
|
|
10
|
+
var mergedCells = new Set();
|
|
11
|
+
map.map.forEach(function (value) {
|
|
12
|
+
if (cellPositions.has(value)) {
|
|
13
|
+
mergedCells.add(value);
|
|
14
|
+
} else {
|
|
15
|
+
cellPositions.add(value);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
if (!mergedCells.size) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return (Array.isArray(indexes) ? indexes : [indexes]).map(function (index) {
|
|
22
|
+
return normalizeRect(index, map);
|
|
23
|
+
}).filter(function (rect) {
|
|
24
|
+
return rect.left < rect.right && rect.top < rect.bottom;
|
|
25
|
+
}).some(function (rect) {
|
|
26
|
+
var n = (rect.right - rect.left) * (rect.bottom - rect.top);
|
|
27
|
+
var cells = map.cellsInRect(rect);
|
|
28
|
+
if (cells.length !== n) {
|
|
29
|
+
// We can quickly assume that if the amount of cells from the map is different to what the rect says
|
|
30
|
+
// then there is most likely merged cells across this area which is removing cells
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
return cells.some(function (nodePos) {
|
|
34
|
+
return mergedCells.has(nodePos);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export var hasMergedCellsInColumn = function hasMergedCellsInColumn(columnIndexes) {
|
|
40
|
+
return hasMergedCells(columnIndexes, function (index, map) {
|
|
41
|
+
var x = Math.max(Math.min(index, map.width - 1), 0); // clamped index
|
|
42
|
+
return {
|
|
43
|
+
left: x,
|
|
44
|
+
right: x === index ? x + 1 : x,
|
|
45
|
+
top: 0,
|
|
46
|
+
bottom: map.height
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
export var hasMergedCellsInRow = function hasMergedCellsInRow(rowIndexes) {
|
|
51
|
+
return hasMergedCells(rowIndexes, function (index, map) {
|
|
52
|
+
var y = Math.max(Math.min(index, map.height - 1), 0); // clamped index
|
|
53
|
+
return {
|
|
54
|
+
left: 0,
|
|
55
|
+
right: map.width,
|
|
56
|
+
top: y,
|
|
57
|
+
bottom: y === index ? y + 1 : y
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CellColumnPositioning } from '../types';
|
|
1
|
+
import type { CellColumnPositioning } from '../types';
|
|
2
2
|
export declare const hoverMergedCells: () => import("@atlaskit/editor-common/types").Command;
|
|
3
3
|
export declare const hoverColumns: (hoveredColumns: number[], isInDanger?: boolean) => import("@atlaskit/editor-common/types").Command;
|
|
4
4
|
export declare const hoverRows: (hoveredRows: number[], isInDanger?: boolean) => import("@atlaskit/editor-common/types").Command;
|
|
@@ -6,3 +6,4 @@ export declare const hoverTable: (isInDanger?: boolean, isSelected?: boolean) =>
|
|
|
6
6
|
export declare const clearHoverSelection: () => import("@atlaskit/editor-common/types").Command;
|
|
7
7
|
export declare const showResizeHandleLine: (cellColumnPositioning: CellColumnPositioning) => import("@atlaskit/editor-common/types").Command;
|
|
8
8
|
export declare const hideResizeHandleLine: () => import("@atlaskit/editor-common/types").Command;
|
|
9
|
+
export declare const hoverCell: (rowIndex?: number, colIndex?: number) => import("@atlaskit/editor-common/types").Command;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { hoverColumns, hoverRows, hoverTable, hoverMergedCells, clearHoverSelection, showResizeHandleLine, hideResizeHandleLine, } from './hover';
|
|
1
|
+
export { hoverColumns, hoverRows, hoverTable, hoverCell, hoverMergedCells, clearHoverSelection, showResizeHandleLine, hideResizeHandleLine, } from './hover';
|
|
2
2
|
export { insertColumn, insertRow, createTable } from './insert';
|
|
3
3
|
export { getNextLayout, toggleContextualMenu, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout, } from './toggle';
|
|
4
4
|
export { clearMultipleCells } from './clear';
|
|
@@ -13,3 +13,4 @@ export declare const handleMouseMove: (view: EditorView, event: Event, elementCo
|
|
|
13
13
|
export declare function handleTripleClick(view: EditorView, pos: number): boolean;
|
|
14
14
|
export declare const handleCut: (oldTr: Transaction, oldState: EditorState, newState: EditorState, editorAnalyticsAPI?: EditorAnalyticsAPI, editorView?: EditorView) => Transaction;
|
|
15
15
|
export declare const whenTableInFocus: (eventHandler: (view: EditorView, mouseEvent: Event, elementContentRects?: ElementContentRects) => boolean, elementContentRects?: ElementContentRects) => (view: EditorView, mouseEvent: Event) => boolean;
|
|
16
|
+
export declare const withCellTracking: (eventHandler: (view: EditorView, mouseEvent: Event, elementContentRects?: ElementContentRects) => boolean, elementContentRects?: ElementContentRects) => (view: EditorView, mouseEvent: Event) => boolean;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
1
|
+
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
2
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
3
3
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
|
-
import { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import type { PluginInjectionAPI } from '../types';
|
|
7
7
|
export type TableOptions = {
|
|
8
8
|
isBreakoutEnabled?: boolean;
|
|
9
9
|
isFullWidthModeEnabled?: boolean;
|
|
10
10
|
wasFullWidthModeEnabled?: boolean;
|
|
11
11
|
isTableResizingEnabled?: boolean;
|
|
12
|
+
isDragAndDropEnabled?: boolean;
|
|
12
13
|
};
|
|
13
14
|
export interface Props {
|
|
14
15
|
node: PmNode;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { EditorState,
|
|
2
|
+
import type { EditorState, ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
5
|
export declare const pluginKey: PluginKey<any>;
|
|
5
6
|
export declare const getDecorations: (state: EditorState) => DecorationSet;
|
|
@@ -2,3 +2,15 @@ export declare const defaultTableSelection: {
|
|
|
2
2
|
hoveredColumns: never[];
|
|
3
3
|
hoveredRows: never[];
|
|
4
4
|
};
|
|
5
|
+
/**
|
|
6
|
+
* Creating a separate object for hoveredCell so it doesn't get defaulted when `handleDocOrSelectionChanged` runs.
|
|
7
|
+
*
|
|
8
|
+
* It is safe to persist this value as it gets removed when the mouse cursor leaves the table, so no need to remove it
|
|
9
|
+
* when doc changes.
|
|
10
|
+
*/
|
|
11
|
+
export declare const defaultHoveredCell: {
|
|
12
|
+
hoveredCell: {
|
|
13
|
+
rowIndex: undefined;
|
|
14
|
+
colIndex: undefined;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
1
2
|
import type { DropTargetType } from './consts';
|
|
2
3
|
export interface DragAndDropAction<T, D> {
|
|
3
4
|
type: T;
|
|
@@ -10,6 +11,9 @@ export declare const DragAndDropActionType: {
|
|
|
10
11
|
export type DragAndDropSetDropTargetAction = DragAndDropAction<typeof DragAndDropActionType.SET_DROP_TARGET, {
|
|
11
12
|
type: DropTargetType;
|
|
12
13
|
index: number;
|
|
14
|
+
decorationSet: DecorationSet;
|
|
15
|
+
}>;
|
|
16
|
+
export type DragAndDropClearDropTargetAction = DragAndDropAction<typeof DragAndDropActionType.CLEAR_DROP_TARGET, {
|
|
17
|
+
decorationSet: DecorationSet;
|
|
13
18
|
}>;
|
|
14
|
-
export type DragAndDropClearDropTargetAction = DragAndDropAction<typeof DragAndDropActionType.CLEAR_DROP_TARGET, undefined>;
|
|
15
19
|
export type DragAndDropPluginAction = DragAndDropSetDropTargetAction | DragAndDropClearDropTargetAction;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
1
|
+
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
import type { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import { TableDecorations } from '../../types';
|
|
2
5
|
import type { DropTargetType } from './consts';
|
|
6
|
+
export declare const getDecorations: (state: EditorState) => DecorationSet;
|
|
7
|
+
export declare const updatePluginStateDecorations: (state: EditorState, decorations: Decoration[], key: TableDecorations) => DecorationSet;
|
|
3
8
|
export declare const setDropTarget: (type: DropTargetType, index: number, tr?: Transaction) => import("@atlaskit/editor-common/types").Command;
|
|
4
9
|
export declare const clearDropTarget: (tr?: Transaction) => import("@atlaskit/editor-common/types").Command;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getDraggableDataFromEvent } from './monitor';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ElementEventBasePayload } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
|
|
2
|
+
import type { DraggableData } from '../../../types';
|
|
3
|
+
export declare const getDraggableDataFromEvent: ({ location, source, }: ElementEventBasePayload) => DraggableData | undefined;
|
|
@@ -5,4 +5,4 @@ import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider'
|
|
|
5
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
6
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
7
7
|
import type { PluginConfig, PluginInjectionAPI } from '../types';
|
|
8
|
-
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, breakoutEnabled?: boolean,
|
|
8
|
+
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, breakoutEnabled?: boolean, tableResizingEnabled?: boolean, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, dragAndDropEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI) => SafePlugin<import("../types").TablePluginState>;
|
|
@@ -7,6 +7,7 @@ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
7
7
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
8
8
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
9
9
|
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
10
|
+
import type { Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
|
|
10
11
|
import type tablePlugin from './index';
|
|
11
12
|
export declare const RESIZE_HANDLE_AREA_DECORATION_GAP = 30;
|
|
12
13
|
export type RowInsertPosition = 'TOP' | 'BOTTOM';
|
|
@@ -43,10 +44,15 @@ export interface PluginConfig {
|
|
|
43
44
|
}
|
|
44
45
|
export type { ColumnResizingPluginState } from '@atlaskit/editor-common/types';
|
|
45
46
|
export type CellColumnPositioning = Pick<Rect, 'right' | 'left'>;
|
|
47
|
+
export type CellHoverCoordinates = {
|
|
48
|
+
colIndex?: number;
|
|
49
|
+
rowIndex?: number;
|
|
50
|
+
};
|
|
46
51
|
export interface TablePluginState {
|
|
47
52
|
editorHasFocus?: boolean;
|
|
48
53
|
hoveredColumns: number[];
|
|
49
54
|
hoveredRows: number[];
|
|
55
|
+
hoveredCell: CellHoverCoordinates;
|
|
50
56
|
pluginConfig: PluginConfig;
|
|
51
57
|
isHeaderColumnEnabled: boolean;
|
|
52
58
|
isHeaderRowEnabled: boolean;
|
|
@@ -107,7 +113,7 @@ export type TablePluginAction = {
|
|
|
107
113
|
isInDanger?: boolean;
|
|
108
114
|
};
|
|
109
115
|
} | {
|
|
110
|
-
type: '
|
|
116
|
+
type: 'HOVER_MERGED_CELLS';
|
|
111
117
|
data: {
|
|
112
118
|
decorationSet: DecorationSet;
|
|
113
119
|
};
|
|
@@ -162,6 +168,9 @@ export type TablePluginAction = {
|
|
|
162
168
|
data: {
|
|
163
169
|
decorationSet: DecorationSet;
|
|
164
170
|
};
|
|
171
|
+
} | {
|
|
172
|
+
type: 'HOVER_CELL';
|
|
173
|
+
data: CellHoverCoordinates;
|
|
165
174
|
} | {
|
|
166
175
|
type: 'SET_TARGET_CELL_POSITION';
|
|
167
176
|
data: {
|
|
@@ -219,6 +228,7 @@ export type ColumnResizingPluginAction = {
|
|
|
219
228
|
};
|
|
220
229
|
};
|
|
221
230
|
export declare enum TableDecorations {
|
|
231
|
+
/** Classic controls */
|
|
222
232
|
ALL_CONTROLS_HOVER = "CONTROLS_HOVER",
|
|
223
233
|
ROW_CONTROLS_HOVER = "ROW_CONTROLS_HOVER",
|
|
224
234
|
COLUMN_CONTROLS_HOVER = "COLUMN_CONTROLS_HOVER",
|
|
@@ -230,9 +240,12 @@ export declare enum TableDecorations {
|
|
|
230
240
|
COLUMN_RESIZING_HANDLE = "COLUMN_RESIZING_HANDLE",
|
|
231
241
|
COLUMN_RESIZING_HANDLE_WIDGET = "COLUMN_RESIZING_HANDLE_WIDGET",
|
|
232
242
|
COLUMN_RESIZING_HANDLE_LINE = "COLUMN_RESIZING_HANDLE_LINE",
|
|
243
|
+
COLUMN_INSERT_LINE = "COLUMN_INSERT_LINE",
|
|
244
|
+
ROW_INSERT_LINE = "ROW_INSERT_LINE",
|
|
233
245
|
LAST_CELL_ELEMENT = "LAST_CELL_ELEMENT"
|
|
234
246
|
}
|
|
235
247
|
export declare const TableCssClassName: {
|
|
248
|
+
/** Classic controls */
|
|
236
249
|
COLUMN_CONTROLS: string;
|
|
237
250
|
COLUMN_CONTROLS_DECORATIONS: string;
|
|
238
251
|
COLUMN_SELECTED: string;
|
|
@@ -263,8 +276,13 @@ export declare const TableCssClassName: {
|
|
|
263
276
|
CORNER_CONTROLS_INSERT_ROW_MARKER: string;
|
|
264
277
|
CORNER_CONTROLS_INSERT_COLUMN_MARKER: string;
|
|
265
278
|
CONTROLS_CORNER_BUTTON: string;
|
|
279
|
+
/** Controls with drag handle */
|
|
280
|
+
COLUMN_CONTROLS_DECORATIONS_WITH_DRAG: string;
|
|
281
|
+
ROW_CONTROLS_WITH_DRAG: string;
|
|
282
|
+
/** Other classes */
|
|
266
283
|
NUMBERED_COLUMN: string;
|
|
267
284
|
NUMBERED_COLUMN_BUTTON: string;
|
|
285
|
+
NUMBERED_COLUMN_BUTTON_DISABLED: string;
|
|
268
286
|
HOVERED_COLUMN: string;
|
|
269
287
|
HOVERED_ROW: string;
|
|
270
288
|
HOVERED_TABLE: string;
|
|
@@ -292,8 +310,13 @@ export declare const TableCssClassName: {
|
|
|
292
310
|
TABLE_STICKY: string;
|
|
293
311
|
TOP_LEFT_CELL: string;
|
|
294
312
|
LAST_ITEM_IN_CELL: string;
|
|
313
|
+
WITH_COLUMN_INSERT_LINE: string;
|
|
314
|
+
WITH_FIRST_COLUMN_INSERT_LINE: string;
|
|
315
|
+
WITH_LAST_COLUMN_INSERT_LINE: string;
|
|
295
316
|
WITH_RESIZE_LINE: string;
|
|
296
317
|
WITH_RESIZE_LINE_LAST_COLUMN: string;
|
|
318
|
+
WITH_ROW_INSERT_LINE: string;
|
|
319
|
+
WITH_LAST_ROW_INSERT_LINE: string;
|
|
297
320
|
TABLE_CONTAINER: string;
|
|
298
321
|
TABLE_NODE_WRAPPER: string;
|
|
299
322
|
TABLE_LEFT_SHADOW: string;
|
|
@@ -354,8 +377,18 @@ export interface DraggableSourceData extends Record<string, unknown> {
|
|
|
354
377
|
localId: string;
|
|
355
378
|
indexes: number[];
|
|
356
379
|
}
|
|
357
|
-
export interface DraggableTargetData extends Record<string, unknown> {
|
|
380
|
+
export interface DraggableTargetData extends Record<string | symbol, unknown> {
|
|
358
381
|
type: DraggableType;
|
|
359
382
|
localId: string;
|
|
360
383
|
targetIndex: number;
|
|
361
384
|
}
|
|
385
|
+
export interface DraggableData {
|
|
386
|
+
sourceType: DraggableType;
|
|
387
|
+
sourceLocalId: string;
|
|
388
|
+
sourceIndexes: number[];
|
|
389
|
+
targetType: DraggableType;
|
|
390
|
+
targetLocalId: string;
|
|
391
|
+
targetIndex: number;
|
|
392
|
+
targetAdjustedIndex: number;
|
|
393
|
+
targetClosestEdge: Edge;
|
|
394
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MouseEventHandler } from 'react';
|
|
2
|
+
type DragHandleProps = {
|
|
3
|
+
tableLocalId: string;
|
|
4
|
+
indexes: number[];
|
|
5
|
+
direction?: 'column' | 'row';
|
|
6
|
+
onClick?: MouseEventHandler;
|
|
7
|
+
onMouseOver?: MouseEventHandler;
|
|
8
|
+
onMouseOut?: MouseEventHandler;
|
|
9
|
+
};
|
|
10
|
+
export declare const DragHandle: ({ tableLocalId, direction, indexes, onClick, onMouseOver, onMouseOut, }: DragHandleProps) => JSX.Element;
|
|
11
|
+
export {};
|