@atlaskit/editor-plugin-table 5.3.6 → 5.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +4 -4
- package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +3 -2
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +1 -2
- package/dist/cjs/plugins/table/types.js +1 -1
- package/dist/cjs/plugins/table/ui/DragHandle/index.js +49 -3
- package/dist/cjs/plugins/table/ui/DragPreview/index.js +1 -1
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +72 -0
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/index.js +20 -3
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +5 -2
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +1 -1
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/ui/ui-styles.js +19 -15
- package/dist/cjs/plugins/table/utils/decoration.js +3 -24
- package/dist/cjs/plugins/table/utils/dom.js +1 -4
- package/dist/cjs/plugins/table/utils/index.js +0 -6
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +4 -4
- package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +3 -2
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +1 -2
- package/dist/es2019/plugins/table/types.js +1 -1
- package/dist/es2019/plugins/table/ui/DragHandle/index.js +46 -4
- package/dist/es2019/plugins/table/ui/DragPreview/index.js +1 -1
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +60 -0
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/index.js +20 -3
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +5 -2
- package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +1 -1
- package/dist/es2019/plugins/table/ui/common-styles.js +2 -5
- package/dist/es2019/plugins/table/ui/ui-styles.js +29 -30
- package/dist/es2019/plugins/table/utils/decoration.js +3 -24
- package/dist/es2019/plugins/table/utils/dom.js +0 -1
- package/dist/es2019/plugins/table/utils/index.js +1 -1
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +4 -4
- package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +3 -2
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +1 -2
- package/dist/esm/plugins/table/types.js +1 -1
- package/dist/esm/plugins/table/ui/DragHandle/index.js +49 -4
- package/dist/esm/plugins/table/ui/DragPreview/index.js +1 -1
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +63 -0
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/index.js +20 -3
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +5 -2
- package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +1 -1
- package/dist/esm/plugins/table/ui/common-styles.js +2 -2
- package/dist/esm/plugins/table/ui/ui-styles.js +18 -14
- package/dist/esm/plugins/table/utils/decoration.js +3 -24
- package/dist/esm/plugins/table/utils/dom.js +0 -3
- package/dist/esm/plugins/table/utils/index.js +1 -1
- package/dist/types/plugins/table/types.d.ts +1 -1
- package/dist/types/plugins/table/ui/DragHandle/index.d.ts +3 -1
- package/dist/types/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +15 -0
- package/dist/types/plugins/table/ui/TableFloatingColumnControls/index.d.ts +3 -0
- package/dist/types/plugins/table/ui/ui-styles.d.ts +1 -0
- package/dist/types/plugins/table/utils/decoration.d.ts +2 -2
- package/dist/types/plugins/table/utils/dom.d.ts +0 -1
- package/dist/types/plugins/table/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/types.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/ui/DragHandle/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +15 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingColumnControls/index.d.ts +3 -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 +2 -2
- package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +0 -1
- package/dist/types-ts4.5/plugins/table/utils/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +2 -2
- package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +84 -34
- package/src/__tests__/unit/ui/TableFloatingColumnControls.tsx +5 -2
- package/src/plugins/table/nodeviews/TableComponent.tsx +15 -15
- package/src/plugins/table/pm-plugins/decorations/plugin.ts +3 -2
- package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +1 -1
- package/src/plugins/table/types.ts +1 -1
- package/src/plugins/table/ui/DragHandle/index.tsx +44 -2
- package/src/plugins/table/ui/DragPreview/index.tsx +1 -1
- package/src/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.tsx +100 -0
- package/src/plugins/table/ui/TableFloatingColumnControls/index.tsx +30 -8
- package/src/plugins/table/ui/TableFloatingControls/RowControls/DragControls.tsx +5 -2
- package/src/plugins/table/ui/TableFloatingControls/index.tsx +1 -1
- package/src/plugins/table/ui/common-styles.ts +2 -4
- package/src/plugins/table/ui/ui-styles.ts +30 -30
- package/src/plugins/table/utils/decoration.ts +3 -45
- package/src/plugins/table/utils/dom.ts +0 -4
- package/src/plugins/table/utils/index.ts +0 -1
- /package/dist/cjs/plugins/table/ui/{Icons → icons}/DragInMotionIcon.js +0 -0
- /package/dist/es2019/plugins/table/ui/{Icons → icons}/DragInMotionIcon.js +0 -0
- /package/dist/esm/plugins/table/ui/{Icons → icons}/DragInMotionIcon.js +0 -0
- /package/dist/types/plugins/table/ui/{Icons → icons}/DragInMotionIcon.d.ts +0 -0
- /package/dist/types-ts4.5/plugins/table/ui/{Icons → icons}/DragInMotionIcon.d.ts +0 -0
- /package/src/plugins/table/ui/{Icons → icons}/DragInMotionIcon.tsx +0 -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, _templateObject28, _templateObject29, _templateObject30;
|
|
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, _templateObject31;
|
|
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';
|
|
@@ -64,39 +64,43 @@ var getFloatingDotOverrides = function getFloatingDotOverrides(props) {
|
|
|
64
64
|
return getBooleanFF('platform.editor.custom-table-width') ? css(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n tr\n th:last-child\n .", "::before,\n tr\n td:last-child\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: ", ";\n right: 0px;\n }\n "])), ClassName.COLUMN_CONTROLS_DECORATIONS, ClassName.COLUMN_CONTROLS_DECORATIONS, tableBorderColor(props), lineMarkerSize, lineMarkerSize, "var(--ds-space-025, 2px)") : '';
|
|
65
65
|
};
|
|
66
66
|
export var floatingColumnControls = function floatingColumnControls(props) {
|
|
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);
|
|
67
|
+
return css(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n .", " {\n box-sizing: border-box;\n position: absolute;\n top: 0;\n z-index: -1;\n\n .", " {\n display: flex;\n flex-direction: row;\n }\n }\n\n .", " {\n box-sizing: border-box;\n\n .", " {\n display: grid;\n justify-items: center;\n }\n }\n "])), ClassName.COLUMN_DROP_TARGET_CONTROLS, ClassName.COLUMN_CONTROLS_INNER, ClassName.COLUMN_CONTROLS_WITH_DRAG, ClassName.COLUMN_CONTROLS_INNER);
|
|
68
68
|
};
|
|
69
|
-
export var
|
|
69
|
+
export var rowControlsWrapperDotStyle = function rowControlsWrapperDotStyle(props) {
|
|
70
70
|
if (getBooleanFF('platform.editor.table.drag-and-drop')) {
|
|
71
|
-
return css(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n .", " {\n
|
|
71
|
+
return css(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n div.", ">.", "::after {\n display: none;\n }\n "])), ClassName.WITH_CONTROLS, ClassName.ROW_CONTROLS_WRAPPER);
|
|
72
|
+
} else {
|
|
73
|
+
return css(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["\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 "])), ClassName.WITH_CONTROLS, ClassName.ROW_CONTROLS_WRAPPER, tableBorderColor(props), lineMarkerSize, lineMarkerSize, tableToolbarSize + tableCellBorderWidth);
|
|
72
74
|
}
|
|
75
|
+
};
|
|
76
|
+
export var columnControlsDecoration = function columnControlsDecoration(props) {
|
|
73
77
|
if (getBooleanFF('platform.editor.table.column-controls-styles-updated')) {
|
|
74
|
-
return css(
|
|
78
|
+
return css(_templateObject22 || (_templateObject22 = _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 .", " .", " {\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.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));
|
|
75
79
|
} else {
|
|
76
|
-
return css(
|
|
80
|
+
return css(_templateObject23 || (_templateObject23 = _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 .", " .", " {\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.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));
|
|
77
81
|
}
|
|
78
82
|
};
|
|
79
83
|
export var hoveredDeleteButton = function hoveredDeleteButton(props) {
|
|
80
|
-
return css(
|
|
84
|
+
return css(_templateObject24 || (_templateObject24 = _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));
|
|
81
85
|
};
|
|
82
86
|
export var hoveredCell = function hoveredCell(props) {
|
|
83
|
-
return css(
|
|
87
|
+
return css(_templateObject25 || (_templateObject25 = _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));
|
|
84
88
|
};
|
|
85
|
-
export var hoveredWarningCell = css(
|
|
89
|
+
export var hoveredWarningCell = css(_templateObject26 || (_templateObject26 = _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, ")"));
|
|
86
90
|
|
|
87
91
|
// move the resize handle zone completely inside the table cell to avoid overflow
|
|
88
92
|
var getLastColumnResizerOverrides = function getLastColumnResizerOverrides() {
|
|
89
|
-
return getBooleanFF('platform.editor.custom-table-width') ? css(
|
|
93
|
+
return getBooleanFF('platform.editor.custom-table-width') ? css(_templateObject27 || (_templateObject27 = _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
94
|
};
|
|
91
95
|
var resizeHandleOverrides = function resizeHandleOverrides(props) {
|
|
92
96
|
if (getBooleanFF('platform.editor.table.drag-and-drop')) {
|
|
93
|
-
return css(
|
|
97
|
+
return css(_templateObject28 || (_templateObject28 = _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
98
|
}
|
|
95
|
-
return css(
|
|
99
|
+
return css(_templateObject29 || (_templateObject29 = _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);
|
|
96
100
|
};
|
|
97
101
|
export var resizeHandle = function resizeHandle(props) {
|
|
98
|
-
return css(
|
|
102
|
+
return css(_templateObject30 || (_templateObject30 = _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
103
|
};
|
|
100
104
|
export var insertLine = function insertLine(props) {
|
|
101
|
-
return css(
|
|
105
|
+
return css(_templateObject31 || (_templateObject31 = _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);
|
|
102
106
|
};
|
|
@@ -12,7 +12,6 @@ import { findTable, getCellsInRow, getSelectionRect } from '@atlaskit/editor-tab
|
|
|
12
12
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
13
13
|
import { TableCssClassName as ClassName, TableDecorations } from '../types';
|
|
14
14
|
import { ColumnResizeWidget } from '../ui/ColumnResizeWidget';
|
|
15
|
-
import { DragHandle } from '../ui/DragHandle';
|
|
16
15
|
var filterDecorationByKey = function filterDecorationByKey(key, decorationSet) {
|
|
17
16
|
return decorationSet.find(undefined, undefined, function (spec) {
|
|
18
17
|
return spec.key.indexOf(key) > -1;
|
|
@@ -149,30 +148,10 @@ export var createColumnSelectedDecoration = function createColumnSelectedDecorat
|
|
|
149
148
|
});
|
|
150
149
|
});
|
|
151
150
|
};
|
|
152
|
-
export var createColumnControlsDecoration = function createColumnControlsDecoration(selection
|
|
153
|
-
// todo: issue here where table may not be selected yet
|
|
151
|
+
export var createColumnControlsDecoration = function createColumnControlsDecoration(selection) {
|
|
154
152
|
var cells = getCellsInRow(0)(selection) || [];
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
var colIndex = hoverLocation.colIndex;
|
|
158
|
-
var cell = cells[colIndex];
|
|
159
|
-
return [Decoration.widget(cell.pos + 1, function () {
|
|
160
|
-
var element = document.createElement('div');
|
|
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
|
-
return element;
|
|
168
|
-
}, {
|
|
169
|
-
key: "".concat(TableDecorations.COLUMN_CONTROLS_DECORATIONS, "_").concat(colIndex),
|
|
170
|
-
// this decoration should be the first one, even before gap cursor.
|
|
171
|
-
side: -100,
|
|
172
|
-
destroy: function destroy(node) {
|
|
173
|
-
ReactDOM.unmountComponentAtNode(node);
|
|
174
|
-
}
|
|
175
|
-
})];
|
|
153
|
+
if (getBooleanFF('platform.editor.table.drag-and-drop')) {
|
|
154
|
+
return [];
|
|
176
155
|
} else {
|
|
177
156
|
var index = 0;
|
|
178
157
|
return cells.map(function (cell) {
|
|
@@ -17,9 +17,6 @@ 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
|
-
};
|
|
23
20
|
export var isRowControlsButton = function isRowControlsButton(node) {
|
|
24
21
|
return containsClassName(node, ClassName.ROW_CONTROLS_BUTTON) || containsClassName(node, ClassName.NUMBERED_COLUMN_BUTTON);
|
|
25
22
|
};
|
|
@@ -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,
|
|
5
|
+
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, 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';
|
|
@@ -277,7 +277,7 @@ export declare const TableCssClassName: {
|
|
|
277
277
|
CORNER_CONTROLS_INSERT_COLUMN_MARKER: string;
|
|
278
278
|
CONTROLS_CORNER_BUTTON: string;
|
|
279
279
|
/** Controls with drag handle */
|
|
280
|
-
|
|
280
|
+
COLUMN_CONTROLS_WITH_DRAG: string;
|
|
281
281
|
ROW_CONTROLS_WITH_DRAG: string;
|
|
282
282
|
DRAG_HANDLE_BUTTON_CONTAINER: string;
|
|
283
283
|
/** Other classes */
|
|
@@ -3,11 +3,13 @@ type DragHandleState = 'default' | 'selected' | 'disabled' | 'danger';
|
|
|
3
3
|
type DragHandleProps = {
|
|
4
4
|
tableLocalId: string;
|
|
5
5
|
indexes: number[];
|
|
6
|
+
previewWidth?: number;
|
|
7
|
+
previewHeight?: number;
|
|
6
8
|
direction?: 'column' | 'row';
|
|
7
9
|
state?: DragHandleState;
|
|
8
10
|
onClick?: MouseEventHandler;
|
|
9
11
|
onMouseOver?: MouseEventHandler;
|
|
10
12
|
onMouseOut?: MouseEventHandler;
|
|
11
13
|
};
|
|
12
|
-
export declare const DragHandle: ({ tableLocalId, direction, state, indexes, onClick, onMouseOver, onMouseOut, }: DragHandleProps) => JSX.Element;
|
|
14
|
+
export declare const DragHandle: ({ tableLocalId, direction, state, indexes, previewWidth, previewHeight, onClick, onMouseOver, onMouseOut, }: DragHandleProps) => JSX.Element;
|
|
13
15
|
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import type { CellHoverCoordinates } from '../../../types';
|
|
4
|
+
export interface Props {
|
|
5
|
+
editorView: EditorView;
|
|
6
|
+
tableActive?: boolean;
|
|
7
|
+
tableRef: HTMLTableElement;
|
|
8
|
+
hoveredCell?: CellHoverCoordinates;
|
|
9
|
+
isResizing?: boolean;
|
|
10
|
+
stickyTop?: number;
|
|
11
|
+
tableHeight?: number;
|
|
12
|
+
localId?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const ColumnControls: React.FC<Props>;
|
|
15
|
+
export default ColumnControls;
|
|
@@ -4,6 +4,7 @@ import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
|
4
4
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
7
|
+
import type { CellHoverCoordinates } from '../../types';
|
|
7
8
|
export interface Props {
|
|
8
9
|
editorView: EditorView;
|
|
9
10
|
getEditorFeatureFlags: GetEditorFeatureFlags;
|
|
@@ -13,6 +14,8 @@ export interface Props {
|
|
|
13
14
|
hasHeaderRow?: boolean;
|
|
14
15
|
headerRowHeight?: number;
|
|
15
16
|
hoveredRows?: number[];
|
|
17
|
+
hoveredCell?: CellHoverCoordinates;
|
|
18
|
+
isResizing?: boolean;
|
|
16
19
|
ordering?: TableColumnOrdering;
|
|
17
20
|
stickyHeader?: RowStickyState;
|
|
18
21
|
}
|
|
@@ -9,6 +9,7 @@ export declare const columnControlsLineMarker: () => import("@emotion/react").Se
|
|
|
9
9
|
export declare const DeleteButton: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
10
10
|
export declare const OverflowShadow: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
11
11
|
export declare const floatingColumnControls: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
12
|
+
export declare const rowControlsWrapperDotStyle: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
12
13
|
export declare const columnControlsDecoration: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
13
14
|
export declare const hoveredDeleteButton: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
14
15
|
export declare const hoveredCell: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
@@ -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
|
|
6
|
+
import type { Cell, CellColumnPositioning } 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
|
|
13
|
+
export declare const createColumnControlsDecoration: (selection: Selection) => 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,6 @@ 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;
|
|
8
7
|
export declare const isRowControlsButton: (node: HTMLElement | null) => boolean;
|
|
9
8
|
export declare const isRowDragControlsButton: (node: HTMLElement | null) => true | HTMLElement | null;
|
|
10
9
|
export declare const isResizeHandleDecoration: (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,
|
|
5
|
+
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, 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';
|
|
@@ -277,7 +277,7 @@ export declare const TableCssClassName: {
|
|
|
277
277
|
CORNER_CONTROLS_INSERT_COLUMN_MARKER: string;
|
|
278
278
|
CONTROLS_CORNER_BUTTON: string;
|
|
279
279
|
/** Controls with drag handle */
|
|
280
|
-
|
|
280
|
+
COLUMN_CONTROLS_WITH_DRAG: string;
|
|
281
281
|
ROW_CONTROLS_WITH_DRAG: string;
|
|
282
282
|
DRAG_HANDLE_BUTTON_CONTAINER: string;
|
|
283
283
|
/** Other classes */
|
|
@@ -3,11 +3,13 @@ type DragHandleState = 'default' | 'selected' | 'disabled' | 'danger';
|
|
|
3
3
|
type DragHandleProps = {
|
|
4
4
|
tableLocalId: string;
|
|
5
5
|
indexes: number[];
|
|
6
|
+
previewWidth?: number;
|
|
7
|
+
previewHeight?: number;
|
|
6
8
|
direction?: 'column' | 'row';
|
|
7
9
|
state?: DragHandleState;
|
|
8
10
|
onClick?: MouseEventHandler;
|
|
9
11
|
onMouseOver?: MouseEventHandler;
|
|
10
12
|
onMouseOut?: MouseEventHandler;
|
|
11
13
|
};
|
|
12
|
-
export declare const DragHandle: ({ tableLocalId, direction, state, indexes, onClick, onMouseOver, onMouseOut, }: DragHandleProps) => JSX.Element;
|
|
14
|
+
export declare const DragHandle: ({ tableLocalId, direction, state, indexes, previewWidth, previewHeight, onClick, onMouseOver, onMouseOut, }: DragHandleProps) => JSX.Element;
|
|
13
15
|
export {};
|
package/dist/types-ts4.5/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import type { CellHoverCoordinates } from '../../../types';
|
|
4
|
+
export interface Props {
|
|
5
|
+
editorView: EditorView;
|
|
6
|
+
tableActive?: boolean;
|
|
7
|
+
tableRef: HTMLTableElement;
|
|
8
|
+
hoveredCell?: CellHoverCoordinates;
|
|
9
|
+
isResizing?: boolean;
|
|
10
|
+
stickyTop?: number;
|
|
11
|
+
tableHeight?: number;
|
|
12
|
+
localId?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const ColumnControls: React.FC<Props>;
|
|
15
|
+
export default ColumnControls;
|
|
@@ -4,6 +4,7 @@ import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
|
4
4
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
7
|
+
import type { CellHoverCoordinates } from '../../types';
|
|
7
8
|
export interface Props {
|
|
8
9
|
editorView: EditorView;
|
|
9
10
|
getEditorFeatureFlags: GetEditorFeatureFlags;
|
|
@@ -13,6 +14,8 @@ export interface Props {
|
|
|
13
14
|
hasHeaderRow?: boolean;
|
|
14
15
|
headerRowHeight?: number;
|
|
15
16
|
hoveredRows?: number[];
|
|
17
|
+
hoveredCell?: CellHoverCoordinates;
|
|
18
|
+
isResizing?: boolean;
|
|
16
19
|
ordering?: TableColumnOrdering;
|
|
17
20
|
stickyHeader?: RowStickyState;
|
|
18
21
|
}
|
|
@@ -9,6 +9,7 @@ export declare const columnControlsLineMarker: () => import("@emotion/react").Se
|
|
|
9
9
|
export declare const DeleteButton: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
10
10
|
export declare const OverflowShadow: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
11
11
|
export declare const floatingColumnControls: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
12
|
+
export declare const rowControlsWrapperDotStyle: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
12
13
|
export declare const columnControlsDecoration: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
13
14
|
export declare const hoveredDeleteButton: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
14
15
|
export declare const hoveredCell: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
|
|
@@ -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
|
|
6
|
+
import type { Cell, CellColumnPositioning } 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
|
|
13
|
+
export declare const createColumnControlsDecoration: (selection: Selection) => 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) => [
|
|
16
16
|
Decoration[],
|
|
@@ -7,7 +7,6 @@ export declare const getColumnOrRowIndex: (target: HTMLElement) => [
|
|
|
7
7
|
number
|
|
8
8
|
];
|
|
9
9
|
export declare const isColumnControlsDecorations: (node: HTMLElement | null) => boolean;
|
|
10
|
-
export declare const isColumnDragControlsDecorations: (node: HTMLElement | null) => true | HTMLElement | null;
|
|
11
10
|
export declare const isRowControlsButton: (node: HTMLElement | null) => boolean;
|
|
12
11
|
export declare const isRowDragControlsButton: (node: HTMLElement | null) => true | HTMLElement | null;
|
|
13
12
|
export declare const isResizeHandleDecoration: (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,
|
|
5
|
+
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, 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';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.8",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@atlaskit/adf-schema": "^32.0.0",
|
|
31
31
|
"@atlaskit/custom-steps": "^0.0.2",
|
|
32
|
-
"@atlaskit/editor-common": "^76.
|
|
32
|
+
"@atlaskit/editor-common": "^76.13.0",
|
|
33
33
|
"@atlaskit/editor-palette": "1.5.1",
|
|
34
34
|
"@atlaskit/editor-plugin-analytics": "^0.2.0",
|
|
35
35
|
"@atlaskit/editor-plugin-content-insertion": "^0.1.0",
|
|
@@ -15,7 +15,7 @@ import { buildColumnControlsDecorations } from '../../../../plugins/table/pm-plu
|
|
|
15
15
|
import { TableDecorations } from '../../../../plugins/table/types';
|
|
16
16
|
|
|
17
17
|
describe('tables: column controls decorations', () => {
|
|
18
|
-
describe(`should return a decorationSet with 2 ${TableDecorations.COLUMN_CONTROLS_DECORATIONS} type`, () => {
|
|
18
|
+
describe(`should return a decorationSet with 2 ${TableDecorations.COLUMN_CONTROLS_DECORATIONS} type when drag and drop disabled`, () => {
|
|
19
19
|
ffTest(
|
|
20
20
|
'platform.editor.table.drag-and-drop',
|
|
21
21
|
() => {
|
|
@@ -32,7 +32,7 @@ describe('tables: column controls decorations', () => {
|
|
|
32
32
|
(spec: any) => spec.key.indexOf(decorationKey) > -1,
|
|
33
33
|
);
|
|
34
34
|
|
|
35
|
-
expect(decorations).toHaveLength(
|
|
35
|
+
expect(decorations).toHaveLength(0);
|
|
36
36
|
},
|
|
37
37
|
() => {
|
|
38
38
|
const decorationKey = TableDecorations.COLUMN_CONTROLS_DECORATIONS;
|
|
@@ -108,38 +108,88 @@ describe('decorations plugin', () => {
|
|
|
108
108
|
});
|
|
109
109
|
|
|
110
110
|
describe('when the hovered cell state changes', () => {
|
|
111
|
-
describe('should add column control decorations', () => {
|
|
112
|
-
ffTest(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
transaction
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
111
|
+
describe('should not add column control decorations', () => {
|
|
112
|
+
ffTest(
|
|
113
|
+
'platform.editor.table.drag-and-drop',
|
|
114
|
+
() => {
|
|
115
|
+
const pluginState = DecorationSet.empty;
|
|
116
|
+
const { editorView } = editor(
|
|
117
|
+
doc(table()(tr(tdCursor, tdEmpty), tr(tdEmpty, tdEmpty))),
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
const transaction = editorView.state.tr.setMeta(pluginKey, {
|
|
121
|
+
type: 'HOVER_CELL',
|
|
122
|
+
data: {
|
|
123
|
+
colIndex: 0,
|
|
124
|
+
rowIndex: 0,
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const oldState = handleDocOrSelectionChanged(
|
|
129
|
+
transaction,
|
|
130
|
+
pluginState,
|
|
131
|
+
editorView.state,
|
|
132
|
+
editorView.state,
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
editorView.dispatch(transaction);
|
|
136
|
+
const newState = handleDocOrSelectionChanged(
|
|
137
|
+
transaction,
|
|
138
|
+
oldState,
|
|
139
|
+
editorView.state,
|
|
140
|
+
editorView.state,
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
const columnDecorations = newState.find(
|
|
144
|
+
undefined,
|
|
145
|
+
undefined,
|
|
146
|
+
(spec) =>
|
|
147
|
+
spec.key.indexOf(TableDecorations.COLUMN_CONTROLS_DECORATIONS) >
|
|
148
|
+
-1,
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
expect(columnDecorations).toHaveLength(0);
|
|
152
|
+
},
|
|
153
|
+
() => {
|
|
154
|
+
const pluginState = DecorationSet.empty;
|
|
155
|
+
const { editorView } = editor(
|
|
156
|
+
doc(table()(tr(tdCursor, tdEmpty), tr(tdEmpty, tdEmpty))),
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
const transaction = editorView.state.tr.setMeta(pluginKey, {
|
|
160
|
+
type: 'HOVER_CELL',
|
|
161
|
+
data: {
|
|
162
|
+
colIndex: 0,
|
|
163
|
+
rowIndex: 0,
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
const oldState = handleDocOrSelectionChanged(
|
|
168
|
+
transaction,
|
|
169
|
+
pluginState,
|
|
170
|
+
editorView.state,
|
|
171
|
+
editorView.state,
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
editorView.dispatch(transaction);
|
|
175
|
+
const newState = handleDocOrSelectionChanged(
|
|
176
|
+
transaction,
|
|
177
|
+
oldState,
|
|
178
|
+
editorView.state,
|
|
179
|
+
editorView.state,
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
const columnDecorations = newState.find(
|
|
183
|
+
undefined,
|
|
184
|
+
undefined,
|
|
185
|
+
(spec) =>
|
|
186
|
+
spec.key.indexOf(TableDecorations.COLUMN_CONTROLS_DECORATIONS) >
|
|
187
|
+
-1,
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
expect(columnDecorations).toHaveLength(2);
|
|
191
|
+
},
|
|
192
|
+
);
|
|
143
193
|
});
|
|
144
194
|
});
|
|
145
195
|
|
|
@@ -169,7 +219,7 @@ describe('decorations plugin', () => {
|
|
|
169
219
|
});
|
|
170
220
|
|
|
171
221
|
describe('when the table changed', () => {
|
|
172
|
-
describe('should re-create the column controls decorations', () => {
|
|
222
|
+
describe('should not re-create the column controls decorations', () => {
|
|
173
223
|
ffTest(
|
|
174
224
|
'platform.editor.table.drag-and-drop',
|
|
175
225
|
() => {
|
|
@@ -203,7 +253,7 @@ describe('decorations plugin', () => {
|
|
|
203
253
|
-1,
|
|
204
254
|
);
|
|
205
255
|
|
|
206
|
-
expect(decorations).toHaveLength(
|
|
256
|
+
expect(decorations).toHaveLength(0);
|
|
207
257
|
},
|
|
208
258
|
() => {
|
|
209
259
|
const { editorView } = editor(
|