@atlaskit/editor-plugin-table 7.6.14 → 7.7.1
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 +14 -0
- package/dist/cjs/commands/misc.js +0 -2
- package/dist/cjs/nodeviews/OverflowShadowsObserver.js +1 -3
- package/dist/cjs/nodeviews/TableComponent.js +3 -18
- package/dist/cjs/nodeviews/TableContainer.js +6 -25
- package/dist/cjs/nodeviews/TableResizer.js +2 -2
- package/dist/cjs/nodeviews/table.js +0 -2
- package/dist/cjs/plugin.js +3 -20
- package/dist/cjs/pm-plugins/main.js +1 -2
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +12 -21
- package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +32 -57
- package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +1 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +29 -4
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-logic.js +19 -0
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +16 -28
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +2 -12
- package/dist/cjs/reducer.js +0 -2
- package/dist/cjs/transforms/column-width.js +3 -5
- package/dist/cjs/types.js +0 -1
- package/dist/cjs/ui/ColumnResizeWidget/index.js +5 -1
- package/dist/cjs/ui/common-styles.js +5 -12
- package/dist/cjs/ui/ui-styles.js +7 -12
- package/dist/cjs/utils/index.js +0 -6
- package/dist/cjs/utils/nodes.js +5 -18
- package/dist/es2019/commands/misc.js +0 -2
- package/dist/es2019/nodeviews/OverflowShadowsObserver.js +1 -3
- package/dist/es2019/nodeviews/TableComponent.js +3 -18
- package/dist/es2019/nodeviews/TableContainer.js +6 -24
- package/dist/es2019/nodeviews/TableResizer.js +2 -2
- package/dist/es2019/nodeviews/table.js +0 -2
- package/dist/es2019/plugin.js +5 -24
- package/dist/es2019/pm-plugins/main.js +1 -2
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +13 -22
- package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +30 -53
- package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +1 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +28 -4
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-logic.js +20 -0
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +14 -24
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +2 -12
- package/dist/es2019/reducer.js +0 -5
- package/dist/es2019/transforms/column-width.js +3 -5
- package/dist/es2019/types.js +0 -1
- package/dist/es2019/ui/ColumnResizeWidget/index.js +5 -1
- package/dist/es2019/ui/common-styles.js +15 -46
- package/dist/es2019/ui/ui-styles.js +34 -41
- package/dist/es2019/utils/index.js +1 -1
- package/dist/es2019/utils/nodes.js +0 -15
- package/dist/esm/commands/misc.js +0 -2
- package/dist/esm/nodeviews/OverflowShadowsObserver.js +1 -3
- package/dist/esm/nodeviews/TableComponent.js +3 -18
- package/dist/esm/nodeviews/TableContainer.js +6 -25
- package/dist/esm/nodeviews/TableResizer.js +2 -2
- package/dist/esm/nodeviews/table.js +0 -2
- package/dist/esm/plugin.js +5 -22
- package/dist/esm/pm-plugins/main.js +1 -2
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +13 -22
- package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +32 -57
- package/dist/esm/pm-plugins/table-resizing/utils/misc.js +1 -2
- package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +30 -4
- package/dist/esm/pm-plugins/table-resizing/utils/resize-logic.js +18 -0
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +16 -28
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +2 -12
- package/dist/esm/reducer.js +0 -2
- package/dist/esm/transforms/column-width.js +3 -5
- package/dist/esm/types.js +0 -1
- package/dist/esm/ui/ColumnResizeWidget/index.js +5 -1
- package/dist/esm/ui/common-styles.js +6 -13
- package/dist/esm/ui/ui-styles.js +7 -12
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/nodes.js +0 -13
- package/dist/types/nodeviews/TableContainer.d.ts +1 -2
- package/dist/types/nodeviews/types.d.ts +0 -1
- package/dist/types/plugin.d.ts +0 -1
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/resize-logic.d.ts +4 -0
- package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +0 -1
- package/dist/types/types.d.ts +0 -9
- package/dist/types/ui/FloatingContextualButton/index.d.ts +0 -2
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/nodes.d.ts +0 -1
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +1 -2
- package/dist/types-ts4.5/nodeviews/types.d.ts +0 -1
- package/dist/types-ts4.5/plugin.d.ts +0 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-logic.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +0 -1
- package/dist/types-ts4.5/types.d.ts +0 -9
- package/dist/types-ts4.5/ui/FloatingContextualButton/index.d.ts +0 -2
- package/dist/types-ts4.5/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/nodes.d.ts +0 -1
- package/package.json +7 -10
- package/src/commands/misc.ts +0 -2
- package/src/nodeviews/OverflowShadowsObserver.ts +1 -6
- package/src/nodeviews/TableComponent.tsx +2 -25
- package/src/nodeviews/TableContainer.tsx +7 -34
- package/src/nodeviews/TableResizer.tsx +2 -8
- package/src/nodeviews/table.tsx +0 -2
- package/src/nodeviews/types.ts +0 -1
- package/src/plugin.tsx +4 -43
- package/src/pm-plugins/main.ts +0 -2
- package/src/pm-plugins/table-resizing/event-handlers.ts +13 -37
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +40 -61
- package/src/pm-plugins/table-resizing/utils/misc.ts +4 -6
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +52 -9
- package/src/pm-plugins/table-resizing/utils/resize-logic.ts +25 -0
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +18 -29
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +2 -13
- package/src/reducer.ts +0 -3
- package/src/transforms/column-width.ts +2 -10
- package/src/types.ts +0 -8
- package/src/ui/ColumnResizeWidget/index.tsx +10 -1
- package/src/ui/FloatingContextualButton/index.tsx +0 -2
- package/src/ui/common-styles.ts +15 -53
- package/src/ui/ui-styles.ts +34 -47
- package/src/utils/index.ts +0 -1
- package/src/utils/nodes.ts +0 -23
- package/dist/cjs/ui/LayoutButton/index.js +0 -206
- package/dist/es2019/ui/LayoutButton/index.js +0 -168
- package/dist/esm/ui/LayoutButton/index.js +0 -196
- package/dist/types/ui/LayoutButton/index.d.ts +0 -21
- package/dist/types-ts4.5/ui/LayoutButton/index.d.ts +0 -21
- package/src/ui/LayoutButton/index.tsx +0 -217
package/dist/esm/ui/ui-styles.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26;
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { tableCellBorderWidth, tableMarginTop, tableMarginTopWithControl } from '@atlaskit/editor-common/styles';
|
|
5
5
|
import { akEditorShadowZIndex, akEditorTableBorder, akEditorTableNumberColumnWidth, akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
|
|
@@ -66,7 +66,7 @@ export var DeleteButton = function DeleteButton() {
|
|
|
66
66
|
return css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n .", ",\n .", " {\n height: ", "px;\n width: ", "px;\n }\n .", " {\n .", " {\n ", "\n }\n }\n\n .", ":hover {\n background: ", ";\n color: ", ";\n cursor: pointer;\n }\n"])), ClassName.CONTROLS_DELETE_BUTTON_WRAP, ClassName.CONTROLS_DELETE_BUTTON, tableDeleteButtonSize, tableDeleteButtonSize, ClassName.CONTROLS_DELETE_BUTTON_WRAP, ClassName.CONTROLS_DELETE_BUTTON, Button("\n background: ".concat(tableCellSelectedDeleteIconBackground, ";\n color: ").concat(tableCellSelectedDeleteIconColor, ";\n ")), ClassName.CONTROLS_DELETE_BUTTON, tableCellHoverDeleteIconBackground, tableCellHoverDeleteIconColor);
|
|
67
67
|
};
|
|
68
68
|
export var OverflowShadow = function OverflowShadow(isDragAndDropEnabled) {
|
|
69
|
-
return css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n .", ", .", " {\n display: block;\n height: calc(100% - ", "px);\n position: absolute;\n pointer-events: none;\n top: ", "px;\n z-index: ", ";\n width: ", "px;\n }\n .", " {\n background: linear-gradient(\n to left,\n transparent 0,\n ", " 140%\n ),\n linear-gradient(\n to right,\n ", " 0px,\n transparent 1px\n );\n left: 0px;\n }\n .", "[data-number-column='true'] > :not(.", ").", " {\n left: ", "px;\n }\n .", " {\n background: linear-gradient(\n to right,\n transparent 0,\n ", " 140%\n ),\n linear-gradient(\n to left,\n ", " 0px,\n transparent 1px\n );\n left: ", ";\n }\n .", " {\n ", "\n .", " {\n border-left: 1px solid ", ";\n }\n }\n"])), ClassName.TABLE_RIGHT_SHADOW, ClassName.TABLE_LEFT_SHADOW, tableMarginTop, tableMarginTop, akEditorShadowZIndex, tableOverflowShadowWidthWide, ClassName.TABLE_LEFT_SHADOW, "var(--ds-shadow-overflow-spread, ".concat(N40A, ")"), "var(--ds-shadow-overflow-perimeter, transparent)", ClassName.TABLE_CONTAINER, ClassName.TABLE_STICKY_SHADOW, ClassName.TABLE_LEFT_SHADOW, akEditorTableNumberColumnWidth - 1, ClassName.TABLE_RIGHT_SHADOW, "var(--ds-shadow-overflow-spread, ".concat(N40A, ")"), "var(--ds-shadow-overflow-perimeter, transparent)",
|
|
69
|
+
return css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n .", ", .", " {\n display: block;\n height: calc(100% - ", "px);\n position: absolute;\n pointer-events: none;\n top: ", "px;\n z-index: ", ";\n width: ", "px;\n }\n .", " {\n background: linear-gradient(\n to left,\n transparent 0,\n ", " 140%\n ),\n linear-gradient(\n to right,\n ", " 0px,\n transparent 1px\n );\n left: 0px;\n }\n .", "[data-number-column='true'] > :not(.", ").", " {\n left: ", "px;\n }\n .", " {\n background: linear-gradient(\n to right,\n transparent 0,\n ", " 140%\n ),\n linear-gradient(\n to left,\n ", " 0px,\n transparent 1px\n );\n left: calc(100% - ", "px);\n }\n .", " {\n ", "\n .", " {\n border-left: 1px solid ", ";\n }\n }\n"])), ClassName.TABLE_RIGHT_SHADOW, ClassName.TABLE_LEFT_SHADOW, tableMarginTop, tableMarginTop, akEditorShadowZIndex, tableOverflowShadowWidthWide, ClassName.TABLE_LEFT_SHADOW, "var(--ds-shadow-overflow-spread, ".concat(N40A, ")"), "var(--ds-shadow-overflow-perimeter, transparent)", ClassName.TABLE_CONTAINER, ClassName.TABLE_STICKY_SHADOW, ClassName.TABLE_LEFT_SHADOW, akEditorTableNumberColumnWidth - 1, ClassName.TABLE_RIGHT_SHADOW, "var(--ds-shadow-overflow-spread, ".concat(N40A, ")"), "var(--ds-shadow-overflow-perimeter, transparent)", tableOverflowShadowWidthWide, ClassName.WITH_CONTROLS, overflowShadowWidhoutDnD(isDragAndDropEnabled), ClassName.TABLE_LEFT_SHADOW, tableBorderColor);
|
|
70
70
|
};
|
|
71
71
|
var overflowShadowWidhoutDnD = function overflowShadowWidhoutDnD(isDragAndDropEnabled) {
|
|
72
72
|
if (!isDragAndDropEnabled) {
|
|
@@ -106,7 +106,7 @@ var columnHeaderButtonSelected = function columnHeaderButtonSelected() {
|
|
|
106
106
|
});
|
|
107
107
|
};
|
|
108
108
|
var getFloatingDotOverrides = function getFloatingDotOverrides() {
|
|
109
|
-
return
|
|
109
|
+
return css(_templateObject15 || (_templateObject15 = _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, lineMarkerSize, lineMarkerSize, "var(--ds-space-025, 2px)");
|
|
110
110
|
};
|
|
111
111
|
export var floatingColumnControls = function floatingColumnControls() {
|
|
112
112
|
return css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n .", " {\n box-sizing: border-box;\n position: absolute;\n top: 0;\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.DRAG_COLUMN_DROP_TARGET_CONTROLS, ClassName.DRAG_COLUMN_CONTROLS_INNER, ClassName.DRAG_COLUMN_CONTROLS, ClassName.DRAG_COLUMN_CONTROLS_INNER);
|
|
@@ -129,21 +129,16 @@ export var hoveredCell = function hoveredCell() {
|
|
|
129
129
|
};
|
|
130
130
|
export var hoveredWarningCell = css(_templateObject22 || (_templateObject22 = _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, ")"));
|
|
131
131
|
|
|
132
|
-
// move the resize handle zone completely inside the table cell to avoid overflow
|
|
133
|
-
var getLastColumnResizerOverrides = function getLastColumnResizerOverrides() {
|
|
134
|
-
return getBooleanFF('platform.editor.custom-table-width') ? css(_templateObject23 || (_templateObject23 = _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) : '';
|
|
135
|
-
};
|
|
136
|
-
|
|
137
132
|
// Explicit pixel values required here to ensure correct positioning and sizes of column resize handle
|
|
138
133
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
139
134
|
var resizeHandleOverrides = function resizeHandleOverrides(isDragAndDropEnabled) {
|
|
140
135
|
if (isDragAndDropEnabled) {
|
|
141
|
-
return css(
|
|
136
|
+
return css(_templateObject23 || (_templateObject23 = _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, columnControlsZIndex * 2, ClassName.WITH_RESIZE_LINE_LAST_COLUMN, ClassName.WITH_RESIZE_LINE_LAST_COLUMN, resizeLineWidth, tableBorderSelectedColor, columnControlsZIndex * 2);
|
|
142
137
|
}
|
|
143
|
-
return css(
|
|
138
|
+
return css(_templateObject24 || (_templateObject24 = _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, columnControlsZIndex * 2, ClassName.WITH_RESIZE_LINE, "var(--ds-space-negative-025, -2px)", resizeLineWidth, tableToolbarSize + tableCellBorderWidth, tableBorderSelectedColor, columnControlsZIndex * 2, tableToolbarSize + tableCellBorderWidth, ClassName.WITH_RESIZE_LINE_LAST_COLUMN, resizeLineWidth, tableBorderSelectedColor, columnControlsZIndex * 2, ClassName.WITH_RESIZE_LINE_LAST_COLUMN, resizeLineWidth, tableToolbarSize + tableCellBorderWidth, tableBorderSelectedColor, columnControlsZIndex * 2, tableToolbarSize + tableCellBorderWidth);
|
|
144
139
|
};
|
|
145
140
|
export var resizeHandle = function resizeHandle(isDragAndDropEnabled) {
|
|
146
|
-
return css(
|
|
141
|
+
return css(_templateObject25 || (_templateObject25 = _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 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\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, ClassName.RESIZE_HANDLE_DECORATION, ClassName.RESIZE_HANDLE_DECORATION, resizeHandlerAreaWidth / 2, resizeHandlerZIndex, resizeHandleOverrides(isDragAndDropEnabled), ClassName.WITH_RESIZE_LINE, ClassName.RESIZE_HANDLE_DECORATION, ClassName.WITH_RESIZE_LINE, ClassName.RESIZE_HANDLE_DECORATION, tableToolbarSize + tableCellBorderWidth, tableToolbarSize + tableCellBorderWidth);
|
|
147
142
|
};
|
|
148
143
|
|
|
149
144
|
// Drag and Drop: drop target insert line
|
|
@@ -173,5 +168,5 @@ var insertLineInactiveColor = css({
|
|
|
173
168
|
// or column drag
|
|
174
169
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
175
170
|
export var insertLine = function insertLine() {
|
|
176
|
-
return css(
|
|
171
|
+
return css(_templateObject26 || (_templateObject26 = _taggedTemplateLiteral(["\n .", " {\n td.", "::before {\n ", "\n left: -1px;\n top: -1px;\n ", "\n }\n\n td.", "::before {\n ", "\n left: -1px;\n top: -1px;\n ", "\n }\n\n th.", "::before {\n ", "\n left: -1px;\n top: -", "px;\n ", "\n }\n\n th.", "::before {\n ", "\n left: -1px;\n top: -", "px;\n ", "\n }\n\n td.", "::before {\n ", "\n left: ", ";\n top: -1px;\n ", "\n }\n\n td.", "::before {\n ", "\n left: ", ";\n top: -1px;\n ", "\n }\n\n th.", "::before {\n ", "\n left: ", ";\n top: -", "px;\n ", "\n }\n\n th.", "::before {\n ", "\n left: ", ";\n top: -", "px;\n ", "\n }\n\n td.", "::before {\n ", "\n right: -1px;\n top: -1px;\n ", "\n }\n\n td.", "::before {\n ", "\n right: -1px;\n top: -1px;\n ", "\n }\n\n th.", "::before {\n ", "\n right: -1px;\n top: -", "px;\n ", "\n }\n\n th.", "::before {\n ", "\n right: -1px;\n top: -", "px;\n ", "\n }\n\n td.", "::before {\n ", "\n top: -1px;\n ", "\n }\n\n td.", "::before {\n ", "\n top: -1px;\n ", "\n }\n\n th.", "::before {\n ", "\n top: -1px;\n ", "\n }\n\n th.", "::before {\n ", "\n top: -1px;\n ", "\n }\n\n td.", "::before {\n ", "\n bottom: 0;\n ", "\n }\n\n td.", "::before {\n ", "\n bottom: 0;\n ", "\n }\n\n th.", "::before {\n ", "\n bottom: 0;\n ", "\n }\n\n th.", "::before {\n ", "\n bottom: 0;\n ", "\n }\n }\n"])), ClassName.TABLE_CONTAINER, ClassName.WITH_FIRST_COLUMN_INSERT_LINE, tableCellColumnInsertLineStyles, insertLineActiveColor, ClassName.WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE, tableCellColumnInsertLineStyles, insertLineInactiveColor, ClassName.WITH_FIRST_COLUMN_INSERT_LINE, tableCellColumnInsertLineStyles, tableCellBorderWidth, insertLineActiveColor, ClassName.WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE, tableCellColumnInsertLineStyles, tableCellBorderWidth, insertLineInactiveColor, ClassName.WITH_COLUMN_INSERT_LINE, tableCellColumnInsertLineStyles, "var(--ds-space-negative-025, -2px)", insertLineActiveColor, ClassName.WITH_COLUMN_INSERT_LINE_INACTIVE, tableCellColumnInsertLineStyles, "var(--ds-space-negative-025, -2px)", insertLineInactiveColor, ClassName.WITH_COLUMN_INSERT_LINE, tableCellColumnInsertLineStyles, "var(--ds-space-negative-025, -2px)", tableCellBorderWidth, insertLineActiveColor, ClassName.WITH_COLUMN_INSERT_LINE_INACTIVE, tableCellColumnInsertLineStyles, "var(--ds-space-negative-025, -2px)", tableCellBorderWidth, insertLineInactiveColor, ClassName.WITH_LAST_COLUMN_INSERT_LINE, tableCellColumnInsertLineStyles, insertLineActiveColor, ClassName.WITH_LAST_COLUMN_INSERT_LINE_INACTIVE, tableCellColumnInsertLineStyles, insertLineInactiveColor, ClassName.WITH_LAST_COLUMN_INSERT_LINE, tableCellColumnInsertLineStyles, tableCellBorderWidth, insertLineActiveColor, ClassName.WITH_LAST_COLUMN_INSERT_LINE_INACTIVE, tableCellColumnInsertLineStyles, tableCellBorderWidth, insertLineInactiveColor, ClassName.WITH_ROW_INSERT_LINE, tableCellRowInsertLineStyles, insertLineActiveColor, ClassName.WITH_ROW_INSERT_LINE_INACTIVE, tableCellRowInsertLineStyles, insertLineInactiveColor, ClassName.WITH_ROW_INSERT_LINE, tableCellRowInsertLineStyles, insertLineActiveColor, ClassName.WITH_ROW_INSERT_LINE_INACTIVE, tableCellRowInsertLineStyles, insertLineInactiveColor, ClassName.WITH_LAST_ROW_INSERT_LINE, tableCellRowInsertLineStyles, insertLineActiveColor, ClassName.WITH_LAST_ROW_INSERT_LINE_INACTIVE, tableCellRowInsertLineStyles, insertLineInactiveColor, ClassName.WITH_LAST_ROW_INSERT_LINE, tableCellRowInsertLineStyles, insertLineActiveColor, ClassName.WITH_LAST_ROW_INSERT_LINE_INACTIVE, tableCellRowInsertLineStyles, insertLineInactiveColor);
|
|
177
172
|
};
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { getSelectedColumnIndexes, getSelectedRowIndexes, normalizeSelection, isSelectionUpdated } from './selection';
|
|
2
2
|
export { findControlsHoverDecoration, createControlsHoverDecoration, createColumnControlsDecoration, createColumnSelectedDecoration, createCellHoverDecoration, updateDecorations, createResizeHandleDecoration, createColumnInsertLine, createColumnLineResize, createRowInsertLine } from './decoration';
|
|
3
|
-
export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled,
|
|
3
|
+
export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, getTableWidth, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, isTableNested, anyChildCellMergedAcrossRow, supportedHeaderRow } from './nodes';
|
|
4
4
|
export { unwrapContentFromTable, removeTableFromFirstChild, removeTableFromLastChild, transformSliceToRemoveOpenTable, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell } from './paste';
|
|
5
5
|
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton, isDragRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, isDragCornerButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, isResizeHandleDecoration, hasResizeHandler, findNearestCellIndexToPoint } from './dom';
|
|
6
6
|
export { convertHTMLCellIndexToColumnIndex, getColumnsWidths, isColumnDeleteButtonVisible, getColumnDeleteButtonParams, getColumnClassNames, getColumnIndexMappedToColumnIndexInFirstRow } from './column-controls';
|
package/dist/esm/utils/nodes.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { mapChildren } from '@atlaskit/editor-common/utils';
|
|
3
|
-
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
4
3
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
5
4
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
6
|
-
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
7
5
|
export var isIsolating = function isIsolating(node) {
|
|
8
6
|
return !!node.type.spec.isolating;
|
|
9
7
|
};
|
|
@@ -49,17 +47,6 @@ export var checkIfNumberColumnEnabled = function checkIfNumberColumnEnabled(sele
|
|
|
49
47
|
return !!table.attrs.isNumberColumnEnabled;
|
|
50
48
|
}, false);
|
|
51
49
|
};
|
|
52
|
-
export var isLayoutSupported = function isLayoutSupported(state) {
|
|
53
|
-
var _pluginKey$getState;
|
|
54
|
-
var _ref = ((_pluginKey$getState = pluginKey.getState(state)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.pluginConfig) || {},
|
|
55
|
-
permittedLayouts = _ref.permittedLayouts;
|
|
56
|
-
var _state$schema$nodes = state.schema.nodes,
|
|
57
|
-
bodiedExtension = _state$schema$nodes.bodiedExtension,
|
|
58
|
-
layoutSection = _state$schema$nodes.layoutSection,
|
|
59
|
-
expand = _state$schema$nodes.expand,
|
|
60
|
-
extensionFrame = _state$schema$nodes.extensionFrame;
|
|
61
|
-
return !hasParentNodeOfType([expand, layoutSection, bodiedExtension, extensionFrame])(state.selection) && !!permittedLayouts && (permittedLayouts === 'all' || permittedLayouts.indexOf('default') > -1 && permittedLayouts.indexOf('wide') > -1 && permittedLayouts.indexOf('full-width') > -1);
|
|
62
|
-
};
|
|
63
50
|
export var getTableWidth = function getTableWidth(node) {
|
|
64
51
|
return getTableWidths(node).reduce(function (acc, current) {
|
|
65
52
|
return acc + current;
|
|
@@ -34,7 +34,6 @@ type TableContainerProps = {
|
|
|
34
34
|
className: string;
|
|
35
35
|
containerWidth: EditorContainerWidth;
|
|
36
36
|
isTableResizingEnabled: boolean | undefined;
|
|
37
|
-
isBreakoutEnabled: boolean | undefined;
|
|
38
37
|
editorView: EditorView;
|
|
39
38
|
getPos: () => number | undefined;
|
|
40
39
|
tableRef: HTMLTableElement;
|
|
@@ -45,5 +44,5 @@ type TableContainerProps = {
|
|
|
45
44
|
tableWrapperHeight?: number;
|
|
46
45
|
isWholeTableInDanger?: boolean;
|
|
47
46
|
};
|
|
48
|
-
export declare const TableContainer: ({ children, node, className, containerWidth: {
|
|
47
|
+
export declare const TableContainer: ({ children, node, className, containerWidth: { width: editorWidth }, isTableResizingEnabled, editorView, getPos, tableRef, isNested, tableWrapperHeight, isResizing, pluginInjectionApi, isTableScalingEnabled, isWholeTableInDanger, }: PropsWithChildren<TableContainerProps>) => JSX.Element;
|
|
49
48
|
export {};
|
|
@@ -6,7 +6,6 @@ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
6
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import type { PluginInjectionAPI } from '../types';
|
|
8
8
|
export type TableOptions = {
|
|
9
|
-
isBreakoutEnabled?: boolean;
|
|
10
9
|
isFullWidthModeEnabled?: boolean;
|
|
11
10
|
wasFullWidthModeEnabled?: boolean;
|
|
12
11
|
isTableResizingEnabled?: boolean;
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ export interface TablePluginOptions {
|
|
|
13
13
|
tableOptions: PluginConfig;
|
|
14
14
|
tableResizingEnabled?: boolean;
|
|
15
15
|
dragAndDropEnabled?: boolean;
|
|
16
|
-
breakoutEnabled?: boolean;
|
|
17
16
|
allowContextualMenu?: boolean;
|
|
18
17
|
fullWidthEnabled?: boolean;
|
|
19
18
|
wasFullWidthEnabled?: boolean;
|
|
@@ -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,
|
|
8
|
+
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, tableResizingEnabled?: boolean, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, dragAndDropEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean) => SafePlugin<import("../types").TablePluginState>;
|
|
@@ -2,3 +2,7 @@ import type { ResizeState } from './types';
|
|
|
2
2
|
export declare const growColumn: (state: ResizeState, colIndex: number, amount: number, selectedColumns?: number[]) => ResizeState;
|
|
3
3
|
export declare const shrinkColumn: (state: ResizeState, colIndex: number, amount: number, selectedColumns?: number[]) => ResizeState;
|
|
4
4
|
export declare function reduceSpace(state: ResizeState, amount: number, ignoreCols?: number[]): ResizeState;
|
|
5
|
+
/**
|
|
6
|
+
* Update the given column based on resizeAmount, maintaining all other columns
|
|
7
|
+
*/
|
|
8
|
+
export declare function updateAffectedColumn(resizeState: ResizeState, colIndex: number, resizeAmount: number): ResizeState;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -90,7 +90,6 @@ export interface TablePluginState {
|
|
|
90
90
|
insertColumnButtonIndex?: number;
|
|
91
91
|
insertRowButtonIndex?: number;
|
|
92
92
|
isFullWidthModeEnabled?: boolean;
|
|
93
|
-
layout?: TableLayout;
|
|
94
93
|
ordering?: TableColumnOrdering;
|
|
95
94
|
isResizeHandleWidgetAdded?: boolean;
|
|
96
95
|
resizeHandleRowIndex?: number;
|
|
@@ -101,7 +100,6 @@ export interface TablePluginState {
|
|
|
101
100
|
canCollapseTable?: boolean;
|
|
102
101
|
widthToWidest?: WidthToWidest;
|
|
103
102
|
getIntl: () => IntlShape;
|
|
104
|
-
isBreakoutEnabled?: boolean;
|
|
105
103
|
wasFullWidthModeEnabled?: boolean;
|
|
106
104
|
isTableResizingEnabled?: boolean;
|
|
107
105
|
isDragAndDropEnabled?: boolean;
|
|
@@ -128,7 +126,6 @@ export type TablePluginAction = {
|
|
|
128
126
|
tableRef?: HTMLTableElement;
|
|
129
127
|
tableNode?: PmNode;
|
|
130
128
|
tableWrapperTarget?: HTMLElement;
|
|
131
|
-
layout: TableLayout;
|
|
132
129
|
isHeaderRowEnabled: boolean;
|
|
133
130
|
isHeaderColumnEnabled: boolean;
|
|
134
131
|
};
|
|
@@ -236,11 +233,6 @@ export type TablePluginAction = {
|
|
|
236
233
|
targetCellPosition: number;
|
|
237
234
|
decorationSet: DecorationSet;
|
|
238
235
|
};
|
|
239
|
-
} | {
|
|
240
|
-
type: 'SET_TABLE_LAYOUT';
|
|
241
|
-
data: {
|
|
242
|
-
layout: TableLayout;
|
|
243
|
-
};
|
|
244
236
|
} | {
|
|
245
237
|
type: 'SHOW_INSERT_ROW_BUTTON';
|
|
246
238
|
data: {
|
|
@@ -315,7 +307,6 @@ export declare const TableCssClassName: {
|
|
|
315
307
|
CONTROLS_INSERT_BUTTON_WRAP: string;
|
|
316
308
|
CONTROLS_INSERT_LINE: string;
|
|
317
309
|
CONTROLS_BUTTON_OVERLAY: string;
|
|
318
|
-
LAYOUT_BUTTON: string;
|
|
319
310
|
DRAG_CONTROLS_INSERT_BUTTON: string;
|
|
320
311
|
DRAG_CONTROLS_INSERT_BUTTON_INNER: string;
|
|
321
312
|
DRAG_CONTROLS_INSERT_BUTTON_INNER_COLUMN: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
|
-
import type { TableLayout } from '@atlaskit/adf-schema';
|
|
3
2
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
4
3
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -13,7 +12,6 @@ export interface Props {
|
|
|
13
12
|
mountPoint?: HTMLElement;
|
|
14
13
|
boundariesElement?: HTMLElement;
|
|
15
14
|
scrollableElement?: HTMLElement;
|
|
16
|
-
layout?: TableLayout;
|
|
17
15
|
isNumberColumnEnabled?: boolean;
|
|
18
16
|
stickyHeader?: RowStickyState;
|
|
19
17
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { getSelectedColumnIndexes, getSelectedRowIndexes, normalizeSelection, isSelectionUpdated, } from './selection';
|
|
2
2
|
export { findControlsHoverDecoration, createControlsHoverDecoration, createColumnControlsDecoration, createColumnSelectedDecoration, createCellHoverDecoration, updateDecorations, createResizeHandleDecoration, createColumnInsertLine, createColumnLineResize, createRowInsertLine, } from './decoration';
|
|
3
|
-
export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled,
|
|
3
|
+
export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, getTableWidth, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, isTableNested, anyChildCellMergedAcrossRow, supportedHeaderRow, } from './nodes';
|
|
4
4
|
export { unwrapContentFromTable, removeTableFromFirstChild, removeTableFromLastChild, transformSliceToRemoveOpenTable, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, } from './paste';
|
|
5
5
|
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton, isDragRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, isDragCornerButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, isResizeHandleDecoration, hasResizeHandler, findNearestCellIndexToPoint, } from './dom';
|
|
6
6
|
export { convertHTMLCellIndexToColumnIndex, getColumnsWidths, isColumnDeleteButtonVisible, getColumnDeleteButtonParams, getColumnClassNames, getColumnIndexMappedToColumnIndexInFirstRow, } from './column-controls';
|
|
@@ -6,7 +6,6 @@ export declare const containsHeaderRow: (table: PmNode) => boolean;
|
|
|
6
6
|
export declare const checkIfHeaderColumnEnabled: (selection: Selection) => boolean;
|
|
7
7
|
export declare const checkIfHeaderRowEnabled: (selection: Selection) => boolean;
|
|
8
8
|
export declare const checkIfNumberColumnEnabled: (selection: Selection) => boolean;
|
|
9
|
-
export declare const isLayoutSupported: (state: EditorState) => boolean;
|
|
10
9
|
export declare const getTableWidth: (node: PmNode) => number;
|
|
11
10
|
export declare const tablesHaveDifferentColumnWidths: (currentTable: PmNode, previousTable: PmNode) => boolean;
|
|
12
11
|
export declare const tablesHaveDifferentNoOfColumns: (currentTable: PmNode, previousTable: PmNode) => boolean;
|
|
@@ -34,7 +34,6 @@ type TableContainerProps = {
|
|
|
34
34
|
className: string;
|
|
35
35
|
containerWidth: EditorContainerWidth;
|
|
36
36
|
isTableResizingEnabled: boolean | undefined;
|
|
37
|
-
isBreakoutEnabled: boolean | undefined;
|
|
38
37
|
editorView: EditorView;
|
|
39
38
|
getPos: () => number | undefined;
|
|
40
39
|
tableRef: HTMLTableElement;
|
|
@@ -45,5 +44,5 @@ type TableContainerProps = {
|
|
|
45
44
|
tableWrapperHeight?: number;
|
|
46
45
|
isWholeTableInDanger?: boolean;
|
|
47
46
|
};
|
|
48
|
-
export declare const TableContainer: ({ children, node, className, containerWidth: {
|
|
47
|
+
export declare const TableContainer: ({ children, node, className, containerWidth: { width: editorWidth }, isTableResizingEnabled, editorView, getPos, tableRef, isNested, tableWrapperHeight, isResizing, pluginInjectionApi, isTableScalingEnabled, isWholeTableInDanger, }: PropsWithChildren<TableContainerProps>) => JSX.Element;
|
|
49
48
|
export {};
|
|
@@ -6,7 +6,6 @@ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
6
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import type { PluginInjectionAPI } from '../types';
|
|
8
8
|
export type TableOptions = {
|
|
9
|
-
isBreakoutEnabled?: boolean;
|
|
10
9
|
isFullWidthModeEnabled?: boolean;
|
|
11
10
|
wasFullWidthModeEnabled?: boolean;
|
|
12
11
|
isTableResizingEnabled?: boolean;
|
|
@@ -13,7 +13,6 @@ export interface TablePluginOptions {
|
|
|
13
13
|
tableOptions: PluginConfig;
|
|
14
14
|
tableResizingEnabled?: boolean;
|
|
15
15
|
dragAndDropEnabled?: boolean;
|
|
16
|
-
breakoutEnabled?: boolean;
|
|
17
16
|
allowContextualMenu?: boolean;
|
|
18
17
|
fullWidthEnabled?: boolean;
|
|
19
18
|
wasFullWidthEnabled?: boolean;
|
|
@@ -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,
|
|
8
|
+
export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, tableResizingEnabled?: boolean, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, dragAndDropEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean) => SafePlugin<import("../types").TablePluginState>;
|
|
@@ -2,3 +2,7 @@ import type { ResizeState } from './types';
|
|
|
2
2
|
export declare const growColumn: (state: ResizeState, colIndex: number, amount: number, selectedColumns?: number[]) => ResizeState;
|
|
3
3
|
export declare const shrinkColumn: (state: ResizeState, colIndex: number, amount: number, selectedColumns?: number[]) => ResizeState;
|
|
4
4
|
export declare function reduceSpace(state: ResizeState, amount: number, ignoreCols?: number[]): ResizeState;
|
|
5
|
+
/**
|
|
6
|
+
* Update the given column based on resizeAmount, maintaining all other columns
|
|
7
|
+
*/
|
|
8
|
+
export declare function updateAffectedColumn(resizeState: ResizeState, colIndex: number, resizeAmount: number): ResizeState;
|
|
@@ -90,7 +90,6 @@ export interface TablePluginState {
|
|
|
90
90
|
insertColumnButtonIndex?: number;
|
|
91
91
|
insertRowButtonIndex?: number;
|
|
92
92
|
isFullWidthModeEnabled?: boolean;
|
|
93
|
-
layout?: TableLayout;
|
|
94
93
|
ordering?: TableColumnOrdering;
|
|
95
94
|
isResizeHandleWidgetAdded?: boolean;
|
|
96
95
|
resizeHandleRowIndex?: number;
|
|
@@ -101,7 +100,6 @@ export interface TablePluginState {
|
|
|
101
100
|
canCollapseTable?: boolean;
|
|
102
101
|
widthToWidest?: WidthToWidest;
|
|
103
102
|
getIntl: () => IntlShape;
|
|
104
|
-
isBreakoutEnabled?: boolean;
|
|
105
103
|
wasFullWidthModeEnabled?: boolean;
|
|
106
104
|
isTableResizingEnabled?: boolean;
|
|
107
105
|
isDragAndDropEnabled?: boolean;
|
|
@@ -128,7 +126,6 @@ export type TablePluginAction = {
|
|
|
128
126
|
tableRef?: HTMLTableElement;
|
|
129
127
|
tableNode?: PmNode;
|
|
130
128
|
tableWrapperTarget?: HTMLElement;
|
|
131
|
-
layout: TableLayout;
|
|
132
129
|
isHeaderRowEnabled: boolean;
|
|
133
130
|
isHeaderColumnEnabled: boolean;
|
|
134
131
|
};
|
|
@@ -236,11 +233,6 @@ export type TablePluginAction = {
|
|
|
236
233
|
targetCellPosition: number;
|
|
237
234
|
decorationSet: DecorationSet;
|
|
238
235
|
};
|
|
239
|
-
} | {
|
|
240
|
-
type: 'SET_TABLE_LAYOUT';
|
|
241
|
-
data: {
|
|
242
|
-
layout: TableLayout;
|
|
243
|
-
};
|
|
244
236
|
} | {
|
|
245
237
|
type: 'SHOW_INSERT_ROW_BUTTON';
|
|
246
238
|
data: {
|
|
@@ -315,7 +307,6 @@ export declare const TableCssClassName: {
|
|
|
315
307
|
CONTROLS_INSERT_BUTTON_WRAP: string;
|
|
316
308
|
CONTROLS_INSERT_LINE: string;
|
|
317
309
|
CONTROLS_BUTTON_OVERLAY: string;
|
|
318
|
-
LAYOUT_BUTTON: string;
|
|
319
310
|
DRAG_CONTROLS_INSERT_BUTTON: string;
|
|
320
311
|
DRAG_CONTROLS_INSERT_BUTTON_INNER: string;
|
|
321
312
|
DRAG_CONTROLS_INSERT_BUTTON_INNER_COLUMN: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
|
-
import type { TableLayout } from '@atlaskit/adf-schema';
|
|
3
2
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
4
3
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -13,7 +12,6 @@ export interface Props {
|
|
|
13
12
|
mountPoint?: HTMLElement;
|
|
14
13
|
boundariesElement?: HTMLElement;
|
|
15
14
|
scrollableElement?: HTMLElement;
|
|
16
|
-
layout?: TableLayout;
|
|
17
15
|
isNumberColumnEnabled?: boolean;
|
|
18
16
|
stickyHeader?: RowStickyState;
|
|
19
17
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { getSelectedColumnIndexes, getSelectedRowIndexes, normalizeSelection, isSelectionUpdated, } from './selection';
|
|
2
2
|
export { findControlsHoverDecoration, createControlsHoverDecoration, createColumnControlsDecoration, createColumnSelectedDecoration, createCellHoverDecoration, updateDecorations, createResizeHandleDecoration, createColumnInsertLine, createColumnLineResize, createRowInsertLine, } from './decoration';
|
|
3
|
-
export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled,
|
|
3
|
+
export { isIsolating, containsHeaderColumn, containsHeaderRow, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, getTableWidth, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns, isTableNested, anyChildCellMergedAcrossRow, supportedHeaderRow, } from './nodes';
|
|
4
4
|
export { unwrapContentFromTable, removeTableFromFirstChild, removeTableFromLastChild, transformSliceToRemoveOpenTable, transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, } from './paste';
|
|
5
5
|
export { isCell, isCornerButton, isInsertRowButton, isColumnControlsDecorations, isTableControlsButton, isTableContainerOrWrapper, isRowControlsButton, isDragRowControlsButton, isDragColumnFloatingInsertDot, isDragRowFloatingInsertDot, isDragCornerButton, getColumnOrRowIndex, getMousePositionHorizontalRelativeByElement, getMousePositionVerticalRelativeByElement, isResizeHandleDecoration, hasResizeHandler, findNearestCellIndexToPoint, } from './dom';
|
|
6
6
|
export { convertHTMLCellIndexToColumnIndex, getColumnsWidths, isColumnDeleteButtonVisible, getColumnDeleteButtonParams, getColumnClassNames, getColumnIndexMappedToColumnIndexInFirstRow, } from './column-controls';
|
|
@@ -6,7 +6,6 @@ export declare const containsHeaderRow: (table: PmNode) => boolean;
|
|
|
6
6
|
export declare const checkIfHeaderColumnEnabled: (selection: Selection) => boolean;
|
|
7
7
|
export declare const checkIfHeaderRowEnabled: (selection: Selection) => boolean;
|
|
8
8
|
export declare const checkIfNumberColumnEnabled: (selection: Selection) => boolean;
|
|
9
|
-
export declare const isLayoutSupported: (state: EditorState) => boolean;
|
|
10
9
|
export declare const getTableWidth: (node: PmNode) => number;
|
|
11
10
|
export declare const tablesHaveDifferentColumnWidths: (currentTable: PmNode, previousTable: PmNode) => boolean;
|
|
12
11
|
export declare const tablesHaveDifferentNoOfColumns: (currentTable: PmNode, previousTable: PmNode) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.7.1",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"runReact18": false
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@atlaskit/adf-schema": "^35.
|
|
32
|
-
"@atlaskit/custom-steps": "^0.0.
|
|
33
|
-
"@atlaskit/editor-common": "^78.
|
|
31
|
+
"@atlaskit/adf-schema": "^35.9.0",
|
|
32
|
+
"@atlaskit/custom-steps": "^0.0.18",
|
|
33
|
+
"@atlaskit/editor-common": "^78.28.0",
|
|
34
34
|
"@atlaskit/editor-palette": "1.5.3",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.0.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.0.0",
|
|
@@ -103,9 +103,6 @@
|
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
105
|
"platform-feature-flags": {
|
|
106
|
-
"platform.editor.custom-table-width": {
|
|
107
|
-
"type": "boolean"
|
|
108
|
-
},
|
|
109
106
|
"platform.editor.table.column-controls-styles-updated": {
|
|
110
107
|
"type": "boolean"
|
|
111
108
|
},
|
|
@@ -115,9 +112,6 @@
|
|
|
115
112
|
"platform.editor.table.drag-move-options-logic-update_fp7xw": {
|
|
116
113
|
"type": "boolean"
|
|
117
114
|
},
|
|
118
|
-
"platform.editor.resizing-table-height-improvement": {
|
|
119
|
-
"type": "boolean"
|
|
120
|
-
},
|
|
121
115
|
"platform.editor.table.shift-arrowup-fix": {
|
|
122
116
|
"type": "boolean"
|
|
123
117
|
},
|
|
@@ -147,6 +141,9 @@
|
|
|
147
141
|
},
|
|
148
142
|
"platform.editor.a11y-table-floating-toolbar-dropdown-menu_zkb33": {
|
|
149
143
|
"type": "boolean"
|
|
144
|
+
},
|
|
145
|
+
"platform.editor.table.colum-resizing-improvements": {
|
|
146
|
+
"type": "boolean"
|
|
150
147
|
}
|
|
151
148
|
}
|
|
152
149
|
}
|
package/src/commands/misc.ts
CHANGED
|
@@ -79,7 +79,6 @@ export const setTableRef = (ref?: HTMLTableElement) =>
|
|
|
79
79
|
const tableWrapperTarget =
|
|
80
80
|
closestElement(tableRef, `.${ClassName.TABLE_NODE_WRAPPER}`) ||
|
|
81
81
|
undefined;
|
|
82
|
-
const layout = tableNode ? tableNode.attrs.layout : undefined;
|
|
83
82
|
const { isDragAndDropEnabled } = getPluginState(state);
|
|
84
83
|
|
|
85
84
|
return {
|
|
@@ -89,7 +88,6 @@ export const setTableRef = (ref?: HTMLTableElement) =>
|
|
|
89
88
|
tableNode,
|
|
90
89
|
tablePos,
|
|
91
90
|
tableWrapperTarget,
|
|
92
|
-
layout: layout || 'default',
|
|
93
91
|
isNumberColumnEnabled: checkIfNumberColumnEnabled(state.selection),
|
|
94
92
|
isHeaderRowEnabled: checkIfHeaderRowEnabled(state.selection),
|
|
95
93
|
isHeaderColumnEnabled: checkIfHeaderColumnEnabled(state.selection),
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import rafSchedule from 'raf-schd';
|
|
2
2
|
|
|
3
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
|
-
|
|
5
3
|
import { TableCssClassName as ClassName, ShadowEvent } from '../types';
|
|
6
|
-
import { tableInsertColumnButtonSize } from '../ui/consts';
|
|
7
4
|
|
|
8
5
|
import { updateShadowListForStickyStyles } from './update-overflow-shadows';
|
|
9
6
|
|
|
@@ -67,9 +64,7 @@ export class OverflowShadowsObserver {
|
|
|
67
64
|
{
|
|
68
65
|
threshold: [0, 1],
|
|
69
66
|
root: this.wrapper,
|
|
70
|
-
rootMargin:
|
|
71
|
-
? '0px'
|
|
72
|
-
: `0px ${tableInsertColumnButtonSize / 2}px 0px 0px`,
|
|
67
|
+
rootMargin: '0px',
|
|
73
68
|
},
|
|
74
69
|
);
|
|
75
70
|
return;
|
|
@@ -700,7 +700,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
700
700
|
node={node}
|
|
701
701
|
tableRef={tableRef!}
|
|
702
702
|
containerWidth={containerWidth}
|
|
703
|
-
isBreakoutEnabled={options?.isBreakoutEnabled}
|
|
704
703
|
isNested={isNested}
|
|
705
704
|
pluginInjectionApi={pluginInjectionApi}
|
|
706
705
|
tableWrapperHeight={this.state.tableWrapperHeight}
|
|
@@ -795,12 +794,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
795
794
|
<div
|
|
796
795
|
style={{
|
|
797
796
|
position: 'absolute',
|
|
798
|
-
right:
|
|
799
|
-
? `${
|
|
800
|
-
token('space.400', '32px') // tableOverflowShadowWidthWide
|
|
801
|
-
}`
|
|
802
|
-
: // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
803
|
-
'22px',
|
|
797
|
+
right: token('space.400', '32px'), // tableOverflowShadowWidthWide
|
|
804
798
|
}}
|
|
805
799
|
>
|
|
806
800
|
<div
|
|
@@ -866,10 +860,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
866
860
|
const prevAttrs = prevNode.attrs;
|
|
867
861
|
|
|
868
862
|
const isNested = isTableNested(this.props.view.state, this.props.getPos());
|
|
869
|
-
// We only consider a layout change valid if it's done outside of an autoSize.
|
|
870
|
-
const layoutChanged =
|
|
871
|
-
prevAttrs.layout !== node.attrs.layout &&
|
|
872
|
-
prevAttrs.__autoSize === node.attrs.__autoSize;
|
|
873
863
|
|
|
874
864
|
const parentWidth = this.getParentNodeWidth();
|
|
875
865
|
const parentWidthChanged =
|
|
@@ -887,8 +877,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
887
877
|
const noOfColumnsChanged = tablesHaveDifferentNoOfColumns(node, prevNode);
|
|
888
878
|
|
|
889
879
|
if (
|
|
890
|
-
// Breakout mode/layout changed
|
|
891
|
-
layoutChanged ||
|
|
892
880
|
// We need to react if our parent changes
|
|
893
881
|
// Scales the cols widths relative to the new parent width.
|
|
894
882
|
parentWidthChanged ||
|
|
@@ -909,7 +897,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
909
897
|
if (shouldScaleTable) {
|
|
910
898
|
this.scaleTable({
|
|
911
899
|
parentWidth,
|
|
912
|
-
layoutChanged,
|
|
913
900
|
});
|
|
914
901
|
}
|
|
915
902
|
|
|
@@ -918,7 +905,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
918
905
|
if (!hasTableBeenResized(prevNode)) {
|
|
919
906
|
this.scaleTable({
|
|
920
907
|
parentWidth: node.attrs.width,
|
|
921
|
-
layoutChanged,
|
|
922
908
|
});
|
|
923
909
|
}
|
|
924
910
|
}
|
|
@@ -931,10 +917,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
931
917
|
this.layoutSize = layoutSize;
|
|
932
918
|
};
|
|
933
919
|
|
|
934
|
-
private scaleTable = (scaleOptions: {
|
|
935
|
-
layoutChanged: boolean;
|
|
936
|
-
parentWidth?: number;
|
|
937
|
-
}) => {
|
|
920
|
+
private scaleTable = (scaleOptions: { parentWidth?: number }) => {
|
|
938
921
|
const { view, getNode, getPos, containerWidth, options } = this.props;
|
|
939
922
|
const node = getNode();
|
|
940
923
|
const { state, dispatch } = view;
|
|
@@ -1006,12 +989,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
1006
989
|
private handleWindowResize = () => {
|
|
1007
990
|
const { getNode, containerWidth } = this.props;
|
|
1008
991
|
const node = getNode();
|
|
1009
|
-
const prevNode = this.node;
|
|
1010
992
|
const layoutSize = this.tableNodeLayoutSize(node);
|
|
1011
|
-
const prevAttrs = prevNode?.attrs;
|
|
1012
|
-
const layoutChanged =
|
|
1013
|
-
prevAttrs?.layout !== node?.attrs?.layout &&
|
|
1014
|
-
prevAttrs?.__autoSize === node?.attrs?.__autoSize;
|
|
1015
993
|
|
|
1016
994
|
if (containerWidth.width > layoutSize) {
|
|
1017
995
|
return;
|
|
@@ -1019,7 +997,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
1019
997
|
|
|
1020
998
|
const parentWidth = this.getParentNodeWidth();
|
|
1021
999
|
this.scaleTableDebounced({
|
|
1022
|
-
layoutChanged: layoutChanged,
|
|
1023
1000
|
parentWidth: parentWidth,
|
|
1024
1001
|
});
|
|
1025
1002
|
};
|