@atlaskit/editor-plugin-table 5.3.1 → 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 +6 -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/main.js +5 -5
- package/dist/cjs/plugins/table/reducer.js +2 -1
- package/dist/cjs/plugins/table/types.js +6 -0
- 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 +2 -1
- package/dist/cjs/plugins/table/ui/ui-styles.js +18 -9
- package/dist/cjs/plugins/table/utils/decoration.js +44 -18
- package/dist/cjs/plugins/table/utils/dom.js +7 -1
- package/dist/cjs/plugins/table/utils/index.js +12 -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/main.js +6 -5
- package/dist/es2019/plugins/table/reducer.js +2 -1
- package/dist/es2019/plugins/table/types.js +6 -0
- 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 +47 -12
- package/dist/es2019/plugins/table/ui/consts.js +1 -0
- package/dist/es2019/plugins/table/ui/ui-styles.js +57 -14
- package/dist/es2019/plugins/table/utils/decoration.js +44 -18
- package/dist/es2019/plugins/table/utils/dom.js +2 -0
- package/dist/es2019/plugins/table/utils/index.js +1 -1
- 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/main.js +7 -7
- package/dist/esm/plugins/table/reducer.js +2 -1
- package/dist/esm/plugins/table/types.js +6 -0
- 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 +10 -7
- package/dist/esm/plugins/table/ui/consts.js +1 -0
- package/dist/esm/plugins/table/ui/ui-styles.js +18 -9
- package/dist/esm/plugins/table/utils/decoration.js +44 -18
- package/dist/esm/plugins/table/utils/dom.js +6 -0
- package/dist/esm/plugins/table/utils/index.js +1 -1
- 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/main.d.ts +1 -1
- package/dist/types/plugins/table/types.d.ts +16 -1
- 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 +1 -0
- package/dist/types/plugins/table/utils/decoration.d.ts +2 -2
- package/dist/types/plugins/table/utils/dom.d.ts +2 -0
- package/dist/types/plugins/table/utils/index.d.ts +1 -1
- 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/main.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/types.d.ts +16 -1
- 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 +1 -0
- package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +2 -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 +1 -1
- package/package.json +3 -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/main.ts +9 -4
- package/src/plugins/table/reducer.ts +2 -1
- package/src/plugins/table/types.ts +14 -2
- 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 +52 -11
- package/src/plugins/table/ui/consts.ts +1 -0
- package/src/plugins/table/ui/ui-styles.ts +58 -14
- package/src/plugins/table/utils/decoration.ts +75 -27
- package/src/plugins/table/utils/dom.ts +8 -0
- package/src/plugins/table/utils/index.ts +2 -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, _templateObject27;
|
|
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';
|
|
@@ -67,27 +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);
|
|
90
99
|
};
|
|
91
100
|
export var insertLine = function insertLine(props) {
|
|
92
|
-
return css(
|
|
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);
|
|
93
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);
|
|
@@ -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
|
};
|
|
@@ -2,7 +2,7 @@ export { getSelectedColumnIndexes, getSelectedRowIndexes, normalizeSelection, is
|
|
|
2
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';
|
|
@@ -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
|
+
};
|
|
@@ -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>;
|
|
@@ -44,10 +44,15 @@ export interface PluginConfig {
|
|
|
44
44
|
}
|
|
45
45
|
export type { ColumnResizingPluginState } from '@atlaskit/editor-common/types';
|
|
46
46
|
export type CellColumnPositioning = Pick<Rect, 'right' | 'left'>;
|
|
47
|
+
export type CellHoverCoordinates = {
|
|
48
|
+
colIndex?: number;
|
|
49
|
+
rowIndex?: number;
|
|
50
|
+
};
|
|
47
51
|
export interface TablePluginState {
|
|
48
52
|
editorHasFocus?: boolean;
|
|
49
53
|
hoveredColumns: number[];
|
|
50
54
|
hoveredRows: number[];
|
|
55
|
+
hoveredCell: CellHoverCoordinates;
|
|
51
56
|
pluginConfig: PluginConfig;
|
|
52
57
|
isHeaderColumnEnabled: boolean;
|
|
53
58
|
isHeaderRowEnabled: boolean;
|
|
@@ -108,7 +113,7 @@ export type TablePluginAction = {
|
|
|
108
113
|
isInDanger?: boolean;
|
|
109
114
|
};
|
|
110
115
|
} | {
|
|
111
|
-
type: '
|
|
116
|
+
type: 'HOVER_MERGED_CELLS';
|
|
112
117
|
data: {
|
|
113
118
|
decorationSet: DecorationSet;
|
|
114
119
|
};
|
|
@@ -163,6 +168,9 @@ export type TablePluginAction = {
|
|
|
163
168
|
data: {
|
|
164
169
|
decorationSet: DecorationSet;
|
|
165
170
|
};
|
|
171
|
+
} | {
|
|
172
|
+
type: 'HOVER_CELL';
|
|
173
|
+
data: CellHoverCoordinates;
|
|
166
174
|
} | {
|
|
167
175
|
type: 'SET_TARGET_CELL_POSITION';
|
|
168
176
|
data: {
|
|
@@ -220,6 +228,7 @@ export type ColumnResizingPluginAction = {
|
|
|
220
228
|
};
|
|
221
229
|
};
|
|
222
230
|
export declare enum TableDecorations {
|
|
231
|
+
/** Classic controls */
|
|
223
232
|
ALL_CONTROLS_HOVER = "CONTROLS_HOVER",
|
|
224
233
|
ROW_CONTROLS_HOVER = "ROW_CONTROLS_HOVER",
|
|
225
234
|
COLUMN_CONTROLS_HOVER = "COLUMN_CONTROLS_HOVER",
|
|
@@ -236,6 +245,7 @@ export declare enum TableDecorations {
|
|
|
236
245
|
LAST_CELL_ELEMENT = "LAST_CELL_ELEMENT"
|
|
237
246
|
}
|
|
238
247
|
export declare const TableCssClassName: {
|
|
248
|
+
/** Classic controls */
|
|
239
249
|
COLUMN_CONTROLS: string;
|
|
240
250
|
COLUMN_CONTROLS_DECORATIONS: string;
|
|
241
251
|
COLUMN_SELECTED: string;
|
|
@@ -266,8 +276,13 @@ export declare const TableCssClassName: {
|
|
|
266
276
|
CORNER_CONTROLS_INSERT_ROW_MARKER: string;
|
|
267
277
|
CORNER_CONTROLS_INSERT_COLUMN_MARKER: string;
|
|
268
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 */
|
|
269
283
|
NUMBERED_COLUMN: string;
|
|
270
284
|
NUMBERED_COLUMN_BUTTON: string;
|
|
285
|
+
NUMBERED_COLUMN_BUTTON_DISABLED: string;
|
|
271
286
|
HOVERED_COLUMN: string;
|
|
272
287
|
HOVERED_ROW: string;
|
|
273
288
|
HOVERED_TABLE: string;
|
|
@@ -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 {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
export interface Props {
|
|
4
4
|
editorView: EditorView;
|
|
5
5
|
tableRef: HTMLTableElement;
|
|
@@ -11,11 +11,14 @@ export interface Props {
|
|
|
11
11
|
isInDanger?: boolean;
|
|
12
12
|
isResizing?: boolean;
|
|
13
13
|
stickyTop?: number;
|
|
14
|
+
isDragAndDropEnabled?: boolean;
|
|
14
15
|
}
|
|
15
16
|
export default class NumberColumn extends Component<Props, any> {
|
|
16
17
|
render(): JSX.Element;
|
|
17
18
|
private hoverRows;
|
|
18
19
|
private selectRow;
|
|
19
20
|
private clearHoverSelection;
|
|
21
|
+
private updateDragHandleLocation;
|
|
22
|
+
private getCellStyles;
|
|
20
23
|
private getClassNames;
|
|
21
24
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
export interface Props {
|
|
5
|
+
editorView: EditorView;
|
|
6
|
+
tableRef: HTMLTableElement;
|
|
7
|
+
selectRow: (row: number, expand: boolean) => void;
|
|
8
|
+
hoverRows: (rows: number[], danger?: boolean) => void;
|
|
9
|
+
hoveredRows?: number[];
|
|
10
|
+
isInDanger?: boolean;
|
|
11
|
+
isResizing?: boolean;
|
|
12
|
+
insertRowButtonIndex?: number;
|
|
13
|
+
stickyTop?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare const RowControls: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
|
|
16
|
+
WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>;
|
|
17
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { WrappedComponentProps } from 'react-intl-next';
|
|
3
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import type { CellHoverCoordinates } from '../../../types';
|
|
5
|
+
type DragControlsProps = {
|
|
6
|
+
editorView: EditorView;
|
|
7
|
+
tableRef: HTMLTableElement;
|
|
8
|
+
tableActive?: boolean;
|
|
9
|
+
hoveredCell?: CellHoverCoordinates;
|
|
10
|
+
hoverRows?: (rows: number[], danger?: boolean) => void;
|
|
11
|
+
selectRow?: (row: number, expand: boolean) => void;
|
|
12
|
+
};
|
|
13
|
+
export declare const DragControls: React.FC<import("react-intl-next").WithIntlProps<DragControlsProps & WrappedComponentProps<"intl">>> & {
|
|
14
|
+
WrappedComponent: React.ComponentType<DragControlsProps & WrappedComponentProps<"intl">>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
export interface Props {
|
|
5
|
-
editorView: EditorView;
|
|
6
|
-
tableRef: HTMLTableElement;
|
|
7
|
-
selectRow: (row: number, expand: boolean) => void;
|
|
8
|
-
hoverRows: (rows: number[], danger?: boolean) => void;
|
|
9
|
-
hoveredRows?: number[];
|
|
10
|
-
isInDanger?: boolean;
|
|
11
|
-
isResizing?: boolean;
|
|
12
|
-
insertRowButtonIndex?: number;
|
|
13
|
-
stickyTop?: number;
|
|
14
|
-
}
|
|
15
|
-
export declare const RowControls: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
|
|
16
|
-
WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>;
|
|
17
|
-
};
|
|
1
|
+
export { RowControls } from './ClassicControls';
|
|
2
|
+
export { DragControls } from './DragControls';
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
2
|
import type { TableColumnOrdering } from '@atlaskit/custom-steps';
|
|
3
|
-
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
3
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
5
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
5
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
6
|
+
import type { CellHoverCoordinates } from '../../types';
|
|
7
7
|
export interface Props {
|
|
8
8
|
editorView: EditorView;
|
|
9
|
-
getEditorFeatureFlags: GetEditorFeatureFlags;
|
|
10
9
|
selection?: Selection;
|
|
11
10
|
tableRef?: HTMLTableElement;
|
|
12
11
|
tableActive?: boolean;
|
|
@@ -15,9 +14,11 @@ export interface Props {
|
|
|
15
14
|
isHeaderRowEnabled?: boolean;
|
|
16
15
|
isHeaderColumnEnabled?: boolean;
|
|
17
16
|
isNumberColumnEnabled?: boolean;
|
|
17
|
+
isDragAndDropEnabled?: boolean;
|
|
18
18
|
hasHeaderRow?: boolean;
|
|
19
19
|
headerRowHeight?: number;
|
|
20
20
|
hoveredRows?: number[];
|
|
21
|
+
hoveredCell?: CellHoverCoordinates;
|
|
21
22
|
ordering?: TableColumnOrdering;
|
|
22
23
|
stickyHeader?: RowStickyState;
|
|
23
24
|
}
|
|
@@ -33,6 +33,7 @@ export declare const lineMarkerSize = 4;
|
|
|
33
33
|
export declare const columnControlsDecorationHeight = 25;
|
|
34
34
|
export declare const columnControlsZIndex: number;
|
|
35
35
|
export declare const columnControlsSelectedZIndex: number;
|
|
36
|
+
export declare const rowControlsZIndex: number;
|
|
36
37
|
export declare const columnResizeHandleZIndex: number;
|
|
37
38
|
export declare const insertLineWidth = 3;
|
|
38
39
|
export declare const resizeHandlerAreaWidth: number;
|
|
@@ -3,14 +3,14 @@ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
3
3
|
import type { ReadonlyTransaction, Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
-
import type { Cell, CellColumnPositioning } from '../types';
|
|
6
|
+
import type { Cell, CellColumnPositioning, CellHoverCoordinates } from '../types';
|
|
7
7
|
import { TableDecorations } from '../types';
|
|
8
8
|
export declare const findColumnControlSelectedDecoration: (decorationSet: DecorationSet) => Decoration[];
|
|
9
9
|
export declare const findControlsHoverDecoration: (decorationSet: DecorationSet) => Decoration[];
|
|
10
10
|
export declare const createCellHoverDecoration: (cells: Cell[]) => Decoration[];
|
|
11
11
|
export declare const createControlsHoverDecoration: (cells: Cell[], type: 'row' | 'column' | 'table', tr: Transaction | ReadonlyTransaction, danger?: boolean, selected?: boolean) => Decoration[];
|
|
12
12
|
export declare const createColumnSelectedDecoration: (tr: Transaction | ReadonlyTransaction) => Decoration[];
|
|
13
|
-
export declare const createColumnControlsDecoration: (selection: Selection) => Decoration[];
|
|
13
|
+
export declare const createColumnControlsDecoration: (selection: Selection, hoverLocation?: CellHoverCoordinates) => Decoration[];
|
|
14
14
|
export declare const updateDecorations: (node: PmNode, decorationSet: DecorationSet, decorations: Decoration[], key: TableDecorations) => DecorationSet;
|
|
15
15
|
export declare const createResizeHandleDecoration: (tr: Transaction | ReadonlyTransaction, rowIndexTarget: number, columnEndIndexTarget: Omit<CellColumnPositioning, 'left'>, includeTooltip: boolean | undefined, getIntl: () => IntlShape) => [Decoration[], Decoration[]];
|
|
16
16
|
export declare const createColumnLineResize: (selection: Selection, cellColumnPositioning: Omit<CellColumnPositioning, 'left'>) => Decoration[];
|
|
@@ -4,7 +4,9 @@ export declare const isCornerButton: (node: HTMLElement | null) => boolean;
|
|
|
4
4
|
export declare const isInsertRowButton: (node: HTMLElement | null) => boolean | HTMLElement | null;
|
|
5
5
|
export declare const getColumnOrRowIndex: (target: HTMLElement) => [number, number];
|
|
6
6
|
export declare const isColumnControlsDecorations: (node: HTMLElement | null) => boolean;
|
|
7
|
+
export declare const isColumnDragControlsDecorations: (node: HTMLElement | null) => true | HTMLElement | null;
|
|
7
8
|
export declare const isRowControlsButton: (node: HTMLElement | null) => boolean;
|
|
9
|
+
export declare const isRowDragControlsButton: (node: HTMLElement | null) => true | HTMLElement | null;
|
|
8
10
|
export declare const isResizeHandleDecoration: (node: HTMLElement | null) => boolean;
|
|
9
11
|
export declare const isTableControlsButton: (node: HTMLElement | null) => boolean;
|
|
10
12
|
export declare const isTableContainerOrWrapper: (node: HTMLElement | null) => boolean;
|
|
@@ -2,7 +2,7 @@ export { getSelectedColumnIndexes, getSelectedRowIndexes, normalizeSelection, is
|
|
|
2
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 type { RowParams } from './row-controls';
|
|
@@ -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;
|