@atlaskit/editor-plugin-table 7.16.8 → 7.16.10
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 +16 -0
- package/dist/cjs/nodeviews/ExternalDropTargets.js +4 -0
- package/dist/cjs/nodeviews/TableComponent.js +28 -5
- package/dist/cjs/nodeviews/TableContainer.js +32 -11
- package/dist/cjs/nodeviews/TableResizer.js +15 -9
- package/dist/cjs/toolbar.js +17 -7
- package/dist/cjs/ui/ColumnResizeWidget/index.js +2 -0
- package/dist/cjs/ui/DragHandle/index.js +10 -3
- package/dist/cjs/ui/DragPreview/index.js +1 -0
- package/dist/cjs/ui/FloatingContextualButton/FixedButton.js +12 -1
- package/dist/cjs/ui/FloatingContextualButton/index.js +3 -1
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +7 -2
- package/dist/cjs/ui/FloatingDeleteButton/DeleteButton.js +7 -2
- package/dist/cjs/ui/FloatingDeleteButton/index.js +2 -0
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +7 -2
- package/dist/cjs/ui/FloatingDragMenu/DropdownMenu.js +61 -57
- package/dist/cjs/ui/FloatingInsertButton/InsertButton.js +36 -14
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +22 -4
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +2 -0
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +4 -1
- package/dist/cjs/ui/TableFloatingColumnControls/index.js +3 -1
- package/dist/cjs/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +12 -3
- package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +2 -0
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +13 -4
- package/dist/cjs/ui/TableFloatingControls/RowControls/ClassicControls.js +50 -43
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +16 -2
- package/dist/cjs/ui/TableFloatingControls/RowDropTarget/index.js +3 -1
- package/dist/cjs/ui/TableFloatingControls/index.js +80 -76
- package/dist/cjs/ui/icons/DragHandleDisabledIcon.js +3 -1
- package/dist/cjs/ui/icons/DragInMotionIcon.js +3 -1
- package/dist/cjs/ui/icons/MinimisedHandle.js +1 -0
- package/dist/cjs/utils/guidelines.js +5 -2
- package/dist/cjs/utils/snapping.js +16 -7
- package/dist/es2019/nodeviews/ExternalDropTargets.js +4 -0
- package/dist/es2019/nodeviews/TableComponent.js +28 -5
- package/dist/es2019/nodeviews/TableContainer.js +32 -11
- package/dist/es2019/nodeviews/TableResizer.js +13 -9
- package/dist/es2019/toolbar.js +13 -3
- package/dist/es2019/ui/ColumnResizeWidget/index.js +2 -0
- package/dist/es2019/ui/DragHandle/index.js +10 -3
- package/dist/es2019/ui/DragPreview/index.js +1 -0
- package/dist/es2019/ui/FloatingContextualButton/FixedButton.js +12 -1
- package/dist/es2019/ui/FloatingContextualButton/index.js +3 -1
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +7 -2
- package/dist/es2019/ui/FloatingDeleteButton/DeleteButton.js +7 -2
- package/dist/es2019/ui/FloatingDeleteButton/index.js +2 -0
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +7 -2
- package/dist/es2019/ui/FloatingDragMenu/DropdownMenu.js +56 -52
- package/dist/es2019/ui/FloatingInsertButton/InsertButton.js +36 -14
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +22 -4
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +2 -0
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +4 -1
- package/dist/es2019/ui/TableFloatingColumnControls/index.js +3 -1
- package/dist/es2019/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +12 -3
- package/dist/es2019/ui/TableFloatingControls/CornerControls/DragCornerControls.js +2 -0
- package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +13 -4
- package/dist/es2019/ui/TableFloatingControls/RowControls/ClassicControls.js +47 -40
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +16 -2
- package/dist/es2019/ui/TableFloatingControls/RowDropTarget/index.js +3 -1
- package/dist/es2019/ui/TableFloatingControls/index.js +78 -74
- package/dist/es2019/ui/icons/DragHandleDisabledIcon.js +3 -1
- package/dist/es2019/ui/icons/DragInMotionIcon.js +3 -1
- package/dist/es2019/ui/icons/MinimisedHandle.js +1 -0
- package/dist/es2019/utils/guidelines.js +5 -2
- package/dist/es2019/utils/snapping.js +16 -7
- package/dist/esm/nodeviews/ExternalDropTargets.js +4 -0
- package/dist/esm/nodeviews/TableComponent.js +28 -5
- package/dist/esm/nodeviews/TableContainer.js +32 -11
- package/dist/esm/nodeviews/TableResizer.js +15 -9
- package/dist/esm/toolbar.js +16 -4
- package/dist/esm/ui/ColumnResizeWidget/index.js +2 -0
- package/dist/esm/ui/DragHandle/index.js +10 -3
- package/dist/esm/ui/DragPreview/index.js +1 -0
- package/dist/esm/ui/FloatingContextualButton/FixedButton.js +12 -1
- package/dist/esm/ui/FloatingContextualButton/index.js +3 -1
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +7 -2
- package/dist/esm/ui/FloatingDeleteButton/DeleteButton.js +7 -2
- package/dist/esm/ui/FloatingDeleteButton/index.js +2 -0
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +7 -2
- package/dist/esm/ui/FloatingDragMenu/DropdownMenu.js +61 -57
- package/dist/esm/ui/FloatingInsertButton/InsertButton.js +36 -14
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +22 -4
- package/dist/esm/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +2 -0
- package/dist/esm/ui/TableFloatingColumnControls/ColumnDropTargets/index.js +4 -1
- package/dist/esm/ui/TableFloatingColumnControls/index.js +3 -1
- package/dist/esm/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +12 -3
- package/dist/esm/ui/TableFloatingControls/CornerControls/DragCornerControls.js +2 -0
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +13 -4
- package/dist/esm/ui/TableFloatingControls/RowControls/ClassicControls.js +50 -43
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +16 -2
- package/dist/esm/ui/TableFloatingControls/RowDropTarget/index.js +3 -1
- package/dist/esm/ui/TableFloatingControls/index.js +80 -76
- package/dist/esm/ui/icons/DragHandleDisabledIcon.js +3 -1
- package/dist/esm/ui/icons/DragInMotionIcon.js +3 -1
- package/dist/esm/ui/icons/MinimisedHandle.js +1 -0
- package/dist/esm/utils/guidelines.js +5 -2
- package/dist/esm/utils/snapping.js +16 -7
- package/dist/types/toolbar.d.ts +2 -1
- package/dist/types/utils/guidelines.d.ts +2 -1
- package/dist/types/utils/snapping.d.ts +6 -2
- package/dist/types-ts4.5/toolbar.d.ts +2 -1
- package/dist/types-ts4.5/utils/guidelines.d.ts +2 -1
- package/dist/types-ts4.5/utils/snapping.d.ts +6 -2
- package/docs/0-intro.tsx +1 -0
- package/package.json +1 -1
- package/src/nodeviews/ExternalDropTargets.tsx +4 -0
- package/src/nodeviews/TableComponent.tsx +19 -1
- package/src/nodeviews/TableContainer.tsx +12 -0
- package/src/nodeviews/TableResizer.tsx +20 -10
- package/src/toolbar.tsx +20 -1
- package/src/ui/ColumnResizeWidget/index.tsx +2 -0
- package/src/ui/DragHandle/index.tsx +3 -0
- package/src/ui/DragPreview/index.tsx +1 -0
- package/src/ui/FloatingContextualButton/FixedButton.tsx +10 -0
- package/src/ui/FloatingContextualButton/index.tsx +1 -0
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +3 -0
- package/src/ui/FloatingDeleteButton/DeleteButton.tsx +4 -0
- package/src/ui/FloatingDeleteButton/index.tsx +2 -0
- package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -0
- package/src/ui/FloatingDragMenu/DropdownMenu.tsx +3 -0
- package/src/ui/FloatingInsertButton/InsertButton.tsx +14 -0
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +16 -1
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +2 -0
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +2 -0
- package/src/ui/TableFloatingColumnControls/index.tsx +1 -0
- package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +6 -0
- package/src/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +4 -0
- package/src/ui/TableFloatingControls/NumberColumn/index.tsx +5 -0
- package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +5 -0
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +15 -1
- package/src/ui/TableFloatingControls/RowDropTarget/index.tsx +1 -0
- package/src/ui/TableFloatingControls/index.tsx +1 -0
- package/src/ui/icons/DragHandleDisabledIcon.tsx +1 -0
- package/src/ui/icons/DragInMotionIcon.tsx +1 -0
- package/src/ui/icons/MinimisedHandle.tsx +1 -0
- package/src/utils/guidelines.ts +6 -2
- package/src/utils/snapping.ts +32 -19
|
@@ -76,81 +76,85 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
|
|
|
76
76
|
}
|
|
77
77
|
var stickyTop = stickyHeader && stickyHeader.sticky && hasHeaderRow ? stickyHeader.top : undefined;
|
|
78
78
|
var wrapperClassName = isDragAndDropEnabled ? _types.TableCssClassName.DRAG_ROW_CONTROLS_WRAPPER : _types.TableCssClassName.ROW_CONTROLS_WRAPPER;
|
|
79
|
-
return
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
79
|
+
return (
|
|
80
|
+
/*#__PURE__*/
|
|
81
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
82
|
+
_react.default.createElement("div", {
|
|
83
|
+
className: wrapperClassName
|
|
84
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
85
|
+
onMouseDown: function onMouseDown(e) {
|
|
86
|
+
return !isDragAndDropEnabled && e.preventDefault();
|
|
87
|
+
}
|
|
88
|
+
}, isNumberColumnEnabled ? /*#__PURE__*/_react.default.createElement(_NumberColumn.default, {
|
|
89
|
+
editorView: editorView,
|
|
90
|
+
hoverRows: _hoverRows,
|
|
91
|
+
tableRef: tableRef,
|
|
92
|
+
tableActive: tableActive,
|
|
93
|
+
hoveredRows: hoveredRows,
|
|
94
|
+
hasHeaderRow: hasHeaderRow,
|
|
95
|
+
isInDanger: isInDanger,
|
|
96
|
+
isResizing: isResizing,
|
|
97
|
+
selectRow: _selectRow,
|
|
98
|
+
updateCellHoverLocation: updateCellHoverLocation,
|
|
99
|
+
stickyTop: stickyTop,
|
|
100
|
+
isDragAndDropEnabled: isDragAndDropEnabled
|
|
101
|
+
}) : null, tableActive && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.use-shared-state-hook') ? /*#__PURE__*/_react.default.createElement(_CornerControls.DragCornerControlsWithSelection, {
|
|
102
|
+
editorView: editorView,
|
|
103
|
+
tableRef: tableRef,
|
|
104
|
+
isInDanger: isInDanger,
|
|
105
|
+
isResizing: isResizing,
|
|
106
|
+
api: api
|
|
107
|
+
}) : /*#__PURE__*/_react.default.createElement(_CornerControls.DragCornerControls, {
|
|
108
|
+
editorView: editorView,
|
|
109
|
+
tableRef: tableRef,
|
|
110
|
+
isInDanger: isInDanger,
|
|
111
|
+
isResizing: isResizing
|
|
112
|
+
}), /*#__PURE__*/_react.default.createElement(_RowControls.DragControls, {
|
|
113
|
+
tableRef: tableRef,
|
|
114
|
+
tableNode: tableNode,
|
|
115
|
+
hoveredCell: hoveredCell,
|
|
116
|
+
isTableHovered: isTableHovered,
|
|
117
|
+
editorView: editorView,
|
|
118
|
+
tableActive: tableActive,
|
|
119
|
+
isInDanger: isInDanger,
|
|
120
|
+
isResizing: isResizing,
|
|
121
|
+
tableWidth: tableWrapperWidth,
|
|
122
|
+
hoverRows: _hoverRows,
|
|
123
|
+
selectRow: _selectRow,
|
|
124
|
+
selectRows: _selectRows,
|
|
125
|
+
updateCellHoverLocation: updateCellHoverLocation
|
|
126
|
+
})) : (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.use-shared-state-hook') ? /*#__PURE__*/_react.default.createElement(_FloatingControlsWithSelection.FloatingControlsWithSelection, {
|
|
127
|
+
editorView: editorView,
|
|
128
|
+
tableRef: tableRef,
|
|
129
|
+
isInDanger: isInDanger,
|
|
130
|
+
isResizing: isResizing,
|
|
131
|
+
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
132
|
+
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
133
|
+
hoveredRows: hoveredRows,
|
|
134
|
+
stickyTop: tableActive ? stickyTop : undefined,
|
|
135
|
+
tableActive: tableActive,
|
|
136
|
+
hoverRows: _hoverRows,
|
|
137
|
+
selectRow: _selectRow,
|
|
138
|
+
api: api
|
|
139
|
+
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_CornerControls.CornerControls, {
|
|
140
|
+
editorView: editorView,
|
|
141
|
+
tableRef: tableRef,
|
|
142
|
+
isInDanger: isInDanger,
|
|
143
|
+
isResizing: isResizing,
|
|
144
|
+
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
145
|
+
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
146
|
+
hoveredRows: hoveredRows,
|
|
147
|
+
stickyTop: tableActive ? stickyTop : undefined
|
|
148
|
+
}), /*#__PURE__*/_react.default.createElement(_RowControls.RowControls, {
|
|
149
|
+
editorView: editorView,
|
|
150
|
+
tableRef: tableRef,
|
|
151
|
+
hoverRows: _hoverRows,
|
|
152
|
+
hoveredRows: hoveredRows,
|
|
153
|
+
isInDanger: isInDanger,
|
|
154
|
+
isResizing: isResizing,
|
|
155
|
+
selectRow: _selectRow,
|
|
156
|
+
stickyTop: tableActive ? stickyTop : undefined
|
|
157
|
+
})))))
|
|
158
|
+
);
|
|
155
159
|
};
|
|
156
160
|
var _default = exports.default = TableFloatingControls;
|
|
@@ -13,7 +13,9 @@ var DragHandleDisabledIcon = exports.DragHandleDisabledIcon = function DragHandl
|
|
|
13
13
|
height: "16",
|
|
14
14
|
viewBox: "0 0 24 16",
|
|
15
15
|
fill: "none",
|
|
16
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
16
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
18
|
+
,
|
|
17
19
|
style: style,
|
|
18
20
|
"data-testid": "drag-icon-disabled"
|
|
19
21
|
}, /*#__PURE__*/_react.default.createElement("rect", {
|
|
@@ -13,7 +13,9 @@ var DragInMotionIcon = exports.DragInMotionIcon = function DragInMotionIcon(_ref
|
|
|
13
13
|
height: "20",
|
|
14
14
|
viewBox: "0 0 28 20",
|
|
15
15
|
fill: "none",
|
|
16
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
16
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
18
|
+
,
|
|
17
19
|
style: style
|
|
18
20
|
}, /*#__PURE__*/_react.default.createElement("rect", {
|
|
19
21
|
x: "1",
|
|
@@ -14,6 +14,7 @@ var MinimisedHandleIcon = exports.MinimisedHandleIcon = function MinimisedHandle
|
|
|
14
14
|
height: "5",
|
|
15
15
|
fill: "none"
|
|
16
16
|
}, /*#__PURE__*/_react.default.createElement("rect", {
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
17
18
|
className: _types.TableCssClassName.DRAG_HANDLE_MINIMISED,
|
|
18
19
|
width: "24",
|
|
19
20
|
height: "5",
|
|
@@ -12,7 +12,10 @@ var _snapping = require("./snapping");
|
|
|
12
12
|
// If we don't do this then the guidelines will not align correctly to the edge of the table
|
|
13
13
|
var defaultGuidelines = exports.defaultGuidelines = (0, _guideline.createFixedGuidelinesFromLengths)([0].concat((0, _toConsumableArray2.default)((0, _snapping.calculateDefaultSnappings)(-1))));
|
|
14
14
|
var defaultGuidelinesForPreserveTable = exports.defaultGuidelinesForPreserveTable = function defaultGuidelinesForPreserveTable(editorContainerWidth) {
|
|
15
|
-
var
|
|
16
|
-
|
|
15
|
+
var exclude = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
16
|
+
innerGuidelines: false,
|
|
17
|
+
breakoutPoints: false
|
|
18
|
+
};
|
|
19
|
+
var lengths = (0, _snapping.calculateDefaultTablePreserveSnappings)(-1, editorContainerWidth, exclude);
|
|
17
20
|
return (0, _guideline.createFixedGuidelinesFromLengths)(lengths, undefined, true);
|
|
18
21
|
};
|
|
@@ -19,24 +19,33 @@ var calculateDefaultSnappings = exports.calculateDefaultSnappings = function cal
|
|
|
19
19
|
var lengthOffset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
20
20
|
return [].concat((0, _toConsumableArray2.default)(calculateSubSnappingWidths(numberOfLanesInDefaultLayoutWidth, _editorSharedStyles.akEditorDefaultLayoutWidth + lengthOffset)), [_editorSharedStyles.akEditorDefaultLayoutWidth + lengthOffset, _editorSharedStyles.akEditorCalculatedWideLayoutWidth + lengthOffset, _editorSharedStyles.akEditorFullWidthLayoutWidth + lengthOffset]);
|
|
21
21
|
};
|
|
22
|
-
|
|
23
22
|
// FF TablePreserve for calculateDefaultSnappings
|
|
24
23
|
var calculateDefaultTablePreserveSnappings = exports.calculateDefaultTablePreserveSnappings = function calculateDefaultTablePreserveSnappings() {
|
|
25
24
|
var lengthOffset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
26
25
|
var editorContainerWith = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _editorSharedStyles.akEditorFullWidthLayoutWidth;
|
|
27
|
-
var
|
|
26
|
+
var exclude = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
27
|
+
innerGuidelines: false,
|
|
28
|
+
breakoutPoints: false
|
|
29
|
+
};
|
|
28
30
|
var dynamicFullWidthLine = editorContainerWith - _editorSharedStyles.akEditorGutterPadding * 2 >= _editorSharedStyles.akEditorFullWidthLayoutWidth ? _editorSharedStyles.akEditorFullWidthLayoutWidth : editorContainerWith - _editorSharedStyles.akEditorGutterPadding * 2 - _consts.tableResizerWidth;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
var guides = [dynamicFullWidthLine - lengthOffset];
|
|
32
|
+
if (!exclude.breakoutPoints) {
|
|
33
|
+
guides.unshift(_editorSharedStyles.akEditorDefaultLayoutWidth + lengthOffset, _editorSharedStyles.akEditorCalculatedWideLayoutWidth + lengthOffset);
|
|
31
34
|
}
|
|
32
|
-
|
|
35
|
+
if (!exclude.innerGuidelines) {
|
|
36
|
+
guides.unshift.apply(guides, [0].concat((0, _toConsumableArray2.default)(calculateSubSnappingWidths(numberOfLanesInDefaultLayoutWidth, _editorSharedStyles.akEditorDefaultLayoutWidth + lengthOffset))));
|
|
37
|
+
}
|
|
38
|
+
return guides;
|
|
33
39
|
};
|
|
34
40
|
var defaultSnappingWidths = exports.defaultSnappingWidths = calculateDefaultSnappings();
|
|
35
41
|
|
|
36
42
|
// FF TablePreserve for defaultSnappingWidths
|
|
37
43
|
var defaultTablePreserveSnappingWidths = exports.defaultTablePreserveSnappingWidths = function defaultTablePreserveSnappingWidths(editorContainerWidth) {
|
|
38
|
-
var
|
|
39
|
-
|
|
44
|
+
var exclude = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
45
|
+
innerGuidelines: false,
|
|
46
|
+
breakoutPoints: false
|
|
47
|
+
};
|
|
48
|
+
return editorContainerWidth - _editorSharedStyles.akEditorGutterPadding * 2 > _editorSharedStyles.akEditorFullWidthLayoutWidth ? calculateDefaultSnappings() : calculateDefaultTablePreserveSnappings(0, editorContainerWidth, exclude);
|
|
40
49
|
};
|
|
41
50
|
|
|
42
51
|
/**
|
|
@@ -39,16 +39,20 @@ export const ExternalDropTargets = ({
|
|
|
39
39
|
return /*#__PURE__*/React.createElement("div", {
|
|
40
40
|
style: {
|
|
41
41
|
width: getTableWrapperWidth(),
|
|
42
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
42
43
|
overflow: 'hidden',
|
|
44
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
43
45
|
position: 'absolute',
|
|
44
46
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
45
47
|
top: `-${dropTargetExtendedWidth - tableMarginTop}px`,
|
|
48
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
46
49
|
pointerEvents: 'auto',
|
|
47
50
|
zIndex: `${dropTargetsZIndex}`
|
|
48
51
|
},
|
|
49
52
|
"data-testid": "table-floating-column-extended-drop-targets"
|
|
50
53
|
}, /*#__PURE__*/React.createElement("div", {
|
|
51
54
|
style: {
|
|
55
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
52
56
|
display: 'flex',
|
|
53
57
|
// move drop targets based on table wrapper scroll
|
|
54
58
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
@@ -736,7 +736,9 @@ class TableComponent extends React.Component {
|
|
|
736
736
|
const {
|
|
737
737
|
stickyScrollbar
|
|
738
738
|
} = getEditorFeatureFlags();
|
|
739
|
-
return /*#__PURE__*/React.createElement(TableContainer
|
|
739
|
+
return /*#__PURE__*/React.createElement(TableContainer
|
|
740
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
741
|
+
, {
|
|
740
742
|
className: classnames(ClassName.TABLE_CONTAINER, {
|
|
741
743
|
[ClassName.WITH_CONTROLS]: allowControls && tableActive,
|
|
742
744
|
[ClassName.TABLE_STICKY]: this.state.stickyHeader && hasHeaderRow,
|
|
@@ -757,9 +759,11 @@ class TableComponent extends React.Component {
|
|
|
757
759
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
758
760
|
isTableAlignmentEnabled: isTableAlignmentEnabled
|
|
759
761
|
}, /*#__PURE__*/React.createElement("div", {
|
|
762
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
760
763
|
className: ClassName.TABLE_STICKY_SENTINEL_TOP,
|
|
761
764
|
"data-testid": "sticky-sentinel-top"
|
|
762
765
|
}), stickyScrollbar && /*#__PURE__*/React.createElement("div", {
|
|
766
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
763
767
|
className: ClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_TOP,
|
|
764
768
|
"data-testid": "sticky-scrollbar-sentinel-top"
|
|
765
769
|
}), allowControls && rowControls, isDragAndDropEnabled && /*#__PURE__*/React.createElement(ExternalDropTargets, {
|
|
@@ -774,10 +778,15 @@ class TableComponent extends React.Component {
|
|
|
774
778
|
return ((_this$wrapper4 = this.wrapper) === null || _this$wrapper4 === void 0 ? void 0 : _this$wrapper4.clientWidth) || 760;
|
|
775
779
|
}
|
|
776
780
|
}), /*#__PURE__*/React.createElement("div", {
|
|
777
|
-
contentEditable: false
|
|
778
|
-
style
|
|
781
|
+
contentEditable: false
|
|
782
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
783
|
+
,
|
|
784
|
+
style: shadowStyle(showBeforeShadow)
|
|
785
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
786
|
+
,
|
|
779
787
|
className: ClassName.TABLE_LEFT_SHADOW
|
|
780
788
|
}), this.state.stickyHeader && /*#__PURE__*/React.createElement("div", {
|
|
789
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
781
790
|
className: `${ClassName.TABLE_LEFT_SHADOW} ${ClassName.TABLE_STICKY_SHADOW}`,
|
|
782
791
|
style: {
|
|
783
792
|
visibility: showBeforeShadow && hasHeaderRow ? 'visible' : 'hidden',
|
|
@@ -785,6 +794,7 @@ class TableComponent extends React.Component {
|
|
|
785
794
|
paddingBottom: `${isDragAndDropEnabled && "var(--ds-space-025, 2px)"}`
|
|
786
795
|
}
|
|
787
796
|
}), /*#__PURE__*/React.createElement("div", {
|
|
797
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
788
798
|
className: classnames(ClassName.TABLE_NODE_WRAPPER),
|
|
789
799
|
ref: elem => {
|
|
790
800
|
this.wrapper = elem;
|
|
@@ -799,10 +809,13 @@ class TableComponent extends React.Component {
|
|
|
799
809
|
}
|
|
800
810
|
}
|
|
801
811
|
}, allowControls && colControls), stickyScrollbar && /*#__PURE__*/React.createElement("div", {
|
|
812
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
802
813
|
className: ClassName.TABLE_STICKY_SCROLLBAR_CONTAINER,
|
|
803
814
|
style: {
|
|
815
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
804
816
|
height: "var(--ds-space-250, 20px)",
|
|
805
817
|
// MAX_BROWSER_SCROLLBAR_HEIGHT
|
|
818
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
806
819
|
display: 'none',
|
|
807
820
|
// prevent unwanted scroll during table resize without removing scrollbar container from the dom
|
|
808
821
|
width: isResizing ? "var(--ds-space-0, 0px)" : '100%'
|
|
@@ -810,18 +823,26 @@ class TableComponent extends React.Component {
|
|
|
810
823
|
}, /*#__PURE__*/React.createElement("div", {
|
|
811
824
|
style: {
|
|
812
825
|
width: tableRef === null || tableRef === void 0 ? void 0 : tableRef.clientWidth,
|
|
826
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
813
827
|
height: '100%'
|
|
814
828
|
}
|
|
815
829
|
})), /*#__PURE__*/React.createElement("div", {
|
|
816
|
-
contentEditable: false
|
|
817
|
-
style
|
|
830
|
+
contentEditable: false
|
|
831
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
832
|
+
,
|
|
833
|
+
style: shadowStyle(showAfterShadow)
|
|
834
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
835
|
+
,
|
|
818
836
|
className: ClassName.TABLE_RIGHT_SHADOW
|
|
819
837
|
}), this.state.stickyHeader && /*#__PURE__*/React.createElement("div", {
|
|
820
838
|
style: {
|
|
839
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
821
840
|
position: 'absolute',
|
|
841
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
822
842
|
right: "var(--ds-space-400, 32px)" // tableOverflowShadowWidthWide
|
|
823
843
|
}
|
|
824
844
|
}, /*#__PURE__*/React.createElement("div", {
|
|
845
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
825
846
|
className: `${ClassName.TABLE_RIGHT_SHADOW} ${ClassName.TABLE_STICKY_SHADOW}`,
|
|
826
847
|
style: {
|
|
827
848
|
visibility: showAfterShadow && hasHeaderRow ? 'visible' : 'hidden',
|
|
@@ -829,9 +850,11 @@ class TableComponent extends React.Component {
|
|
|
829
850
|
paddingBottom: `${isDragAndDropEnabled && "var(--ds-space-025, 2px)"}`
|
|
830
851
|
}
|
|
831
852
|
})), /*#__PURE__*/React.createElement("div", {
|
|
853
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
832
854
|
className: ClassName.TABLE_STICKY_SENTINEL_BOTTOM,
|
|
833
855
|
"data-testid": "sticky-sentinel-bottom"
|
|
834
856
|
}), stickyScrollbar && /*#__PURE__*/React.createElement("div", {
|
|
857
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
835
858
|
className: ClassName.TABLE_STICKY_SCROLLBAR_SENTINEL_BOTTOM,
|
|
836
859
|
"data-testid": "sticky-scrollbar-sentinel-bottom"
|
|
837
860
|
}));
|
|
@@ -13,8 +13,12 @@ export const InnerContainer = /*#__PURE__*/forwardRef(({
|
|
|
13
13
|
children
|
|
14
14
|
}, ref) => {
|
|
15
15
|
return /*#__PURE__*/React.createElement("div", {
|
|
16
|
-
ref: ref
|
|
17
|
-
style
|
|
16
|
+
ref: ref
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
18
|
+
,
|
|
19
|
+
style: style
|
|
20
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
21
|
+
,
|
|
18
22
|
className: className,
|
|
19
23
|
"data-number-column": node.attrs.isNumberColumnEnabled,
|
|
20
24
|
"data-layout": node.attrs.layout,
|
|
@@ -37,10 +41,14 @@ const AlignmentTableContainer = ({
|
|
|
37
41
|
const style = useMemo(() => {
|
|
38
42
|
return alignment === 'align-start' ? leftAlignStyle : centerAlignStyle;
|
|
39
43
|
}, [alignment]);
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
style
|
|
43
|
-
|
|
44
|
+
return (
|
|
45
|
+
/*#__PURE__*/
|
|
46
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
47
|
+
React.createElement("div", {
|
|
48
|
+
"data-testid": "table-alignment-container",
|
|
49
|
+
style: style
|
|
50
|
+
}, children)
|
|
51
|
+
);
|
|
44
52
|
};
|
|
45
53
|
const AlignmentTableContainerWrapper = ({
|
|
46
54
|
isTableAlignmentEnabled,
|
|
@@ -51,7 +59,9 @@ const AlignmentTableContainerWrapper = ({
|
|
|
51
59
|
return /*#__PURE__*/React.createElement("div", {
|
|
52
60
|
"data-testid": "table-alignment-container",
|
|
53
61
|
style: {
|
|
62
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
54
63
|
display: 'flex',
|
|
64
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
55
65
|
justifyContent: 'center'
|
|
56
66
|
}
|
|
57
67
|
}, children);
|
|
@@ -172,12 +182,18 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
172
182
|
width: tableWidthRef.current,
|
|
173
183
|
height: resizing ? updateContainerHeight(tableWrapperHeight !== null && tableWrapperHeight !== void 0 ? tableWrapperHeight : 'auto') : 'auto',
|
|
174
184
|
position: isLivePageViewMode ? 'relative' : 'unset'
|
|
175
|
-
}
|
|
185
|
+
}
|
|
186
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
187
|
+
,
|
|
176
188
|
className: ClassName.TABLE_RESIZER_CONTAINER,
|
|
177
189
|
ref: containerRef
|
|
178
|
-
}, isLivePageViewMode ? /*#__PURE__*/React.createElement(InnerContainer
|
|
190
|
+
}, isLivePageViewMode ? /*#__PURE__*/React.createElement(InnerContainer
|
|
191
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
192
|
+
, {
|
|
179
193
|
className: className,
|
|
180
|
-
node: node
|
|
194
|
+
node: node
|
|
195
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
196
|
+
,
|
|
181
197
|
style: {
|
|
182
198
|
width: 'inherit'
|
|
183
199
|
}
|
|
@@ -207,7 +223,9 @@ export const TableContainer = ({
|
|
|
207
223
|
isTableAlignmentEnabled
|
|
208
224
|
}) => {
|
|
209
225
|
if (isTableResizingEnabled && !isNested) {
|
|
210
|
-
return /*#__PURE__*/React.createElement(ResizableTableContainer
|
|
226
|
+
return /*#__PURE__*/React.createElement(ResizableTableContainer
|
|
227
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
228
|
+
, {
|
|
211
229
|
className: className,
|
|
212
230
|
node: node,
|
|
213
231
|
containerWidth: editorWidth,
|
|
@@ -224,11 +242,14 @@ export const TableContainer = ({
|
|
|
224
242
|
}, children);
|
|
225
243
|
}
|
|
226
244
|
return /*#__PURE__*/React.createElement(InnerContainer, {
|
|
227
|
-
node: node
|
|
245
|
+
node: node
|
|
246
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
247
|
+
,
|
|
228
248
|
className: classNames(className, {
|
|
229
249
|
'less-padding': editorWidth < akEditorMobileBreakoutPoint && !isNested
|
|
230
250
|
}),
|
|
231
251
|
style: {
|
|
252
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
232
253
|
width: 'inherit'
|
|
233
254
|
}
|
|
234
255
|
}, children);
|
|
@@ -118,19 +118,23 @@ export const TableResizer = ({
|
|
|
118
118
|
endMeasure,
|
|
119
119
|
countFrames
|
|
120
120
|
} = useMeasureFramerate();
|
|
121
|
+
const excludeGuidelineConfig = useMemo(() => ({
|
|
122
|
+
innerGuidelines: !!isTableAlignmentEnabled,
|
|
123
|
+
breakoutPoints: !!(isTableAlignmentEnabled && tableState !== null && tableState !== void 0 && tableState.isFullWidthModeEnabled)
|
|
124
|
+
}), [tableState, isTableAlignmentEnabled]);
|
|
121
125
|
const updateActiveGuidelines = useCallback(({
|
|
122
126
|
gap,
|
|
123
127
|
keys
|
|
124
128
|
}) => {
|
|
125
129
|
if (gap !== currentGap.current) {
|
|
126
130
|
currentGap.current = gap;
|
|
127
|
-
const visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(containerWidth,
|
|
131
|
+
const visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(containerWidth, excludeGuidelineConfig) : defaultGuidelines, containerWidth);
|
|
128
132
|
displayGuideline(getGuidelinesWithHighlights(gap, TABLE_SNAP_GAP, keys, visibleGuidelines));
|
|
129
133
|
}
|
|
130
|
-
}, [isTableScalingEnabled,
|
|
134
|
+
}, [isTableScalingEnabled, excludeGuidelineConfig, containerWidth, displayGuideline]);
|
|
131
135
|
const guidelineSnaps = useMemo(() => snappingEnabled ? {
|
|
132
|
-
x: isTableScalingEnabled ? defaultTablePreserveSnappingWidths(containerWidth,
|
|
133
|
-
} : undefined, [snappingEnabled, isTableScalingEnabled,
|
|
136
|
+
x: isTableScalingEnabled ? defaultTablePreserveSnappingWidths(containerWidth, excludeGuidelineConfig) : defaultSnappingWidths
|
|
137
|
+
} : undefined, [snappingEnabled, isTableScalingEnabled, excludeGuidelineConfig, containerWidth]);
|
|
134
138
|
const switchToCenterAlignment = useCallback((pos, node, newWidth, state, dispatch) => {
|
|
135
139
|
if (isTableAlignmentEnabled && node && node.attrs.layout === ALIGN_START && newWidth > lineLength && lineLength < FULL_WIDTH_EDITOR_CONTENT_WIDTH &&
|
|
136
140
|
// We don't want to switch alignment in Full-width editor
|
|
@@ -188,12 +192,12 @@ export const TableResizer = ({
|
|
|
188
192
|
name: TABLE_OVERFLOW_CHANGE_TRIGGER.RESIZED
|
|
189
193
|
});
|
|
190
194
|
dispatch(tr);
|
|
191
|
-
const visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(containerWidth,
|
|
195
|
+
const visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(containerWidth, excludeGuidelineConfig) : defaultGuidelines, containerWidth);
|
|
192
196
|
setSnappingEnabled(displayGuideline(visibleGuidelines));
|
|
193
197
|
if (onResizeStart) {
|
|
194
198
|
onResizeStart();
|
|
195
199
|
}
|
|
196
|
-
}, [startMeasure, editorView, displayGapCursor, node.attrs.localId, tableRef, isTableScalingEnabled,
|
|
200
|
+
}, [startMeasure, editorView, displayGapCursor, node.attrs.localId, tableRef, isTableScalingEnabled, excludeGuidelineConfig, containerWidth, displayGuideline, onResizeStart]);
|
|
197
201
|
const handleResize = useCallback((originalState, delta) => {
|
|
198
202
|
var _node$attrs$localId, _node$attrs;
|
|
199
203
|
countFrames();
|
|
@@ -213,7 +217,7 @@ export const TableResizer = ({
|
|
|
213
217
|
start: pos + 1,
|
|
214
218
|
parentWidth: newWidth
|
|
215
219
|
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled);
|
|
216
|
-
const closestSnap = findClosestSnap(newWidth, isTableScalingEnabled ? defaultTablePreserveSnappingWidths(containerWidth,
|
|
220
|
+
const closestSnap = findClosestSnap(newWidth, isTableScalingEnabled ? defaultTablePreserveSnappingWidths(containerWidth, excludeGuidelineConfig) : defaultSnappingWidths, isTableScalingEnabled ? defaultGuidelinesForPreserveTable(containerWidth, excludeGuidelineConfig) : defaultGuidelines, TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE);
|
|
217
221
|
updateActiveGuidelines(closestSnap);
|
|
218
222
|
|
|
219
223
|
// When snapping to the full width guideline, resize the table to be 1800px
|
|
@@ -222,7 +226,7 @@ export const TableResizer = ({
|
|
|
222
226
|
dispatch
|
|
223
227
|
} = editorView;
|
|
224
228
|
const currentTableNodeLocalId = (_node$attrs$localId = node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) !== null && _node$attrs$localId !== void 0 ? _node$attrs$localId : '';
|
|
225
|
-
const fullWidthGuideline = defaultGuidelinesForPreserveTable(containerWidth,
|
|
229
|
+
const fullWidthGuideline = defaultGuidelinesForPreserveTable(containerWidth, excludeGuidelineConfig).filter(guideline => guideline.isFullWidth)[0];
|
|
226
230
|
const isFullWidthGuidelineActive = closestSnap.keys.includes(fullWidthGuideline.key);
|
|
227
231
|
const shouldUpdateWidthToWidest = !!isTableScalingEnabled && isFullWidthGuidelineActive;
|
|
228
232
|
chainCommands((state, dispatch) => {
|
|
@@ -232,7 +236,7 @@ export const TableResizer = ({
|
|
|
232
236
|
}))(state, dispatch);
|
|
233
237
|
updateWidth(shouldUpdateWidthToWidest ? TABLE_MAX_WIDTH : newWidth);
|
|
234
238
|
return newWidth;
|
|
235
|
-
}, [countFrames, isTableScalingEnabled,
|
|
239
|
+
}, [countFrames, isTableScalingEnabled, excludeGuidelineConfig, tableRef, node, editorView, updateActiveGuidelines, containerWidth, updateWidth, getPos, switchToCenterAlignment]);
|
|
236
240
|
const scheduleResize = useMemo(() => rafSchd(handleResize), [handleResize]);
|
|
237
241
|
const handleResizeStop = useCallback((originalState, delta) => {
|
|
238
242
|
var _node$attrs$localId2, _node$attrs2;
|
package/dist/es2019/toolbar.js
CHANGED
|
@@ -317,7 +317,7 @@ export const getToolbarConfig = (getEditorContainerWidth, editorAnalyticsAPI, ge
|
|
|
317
317
|
const menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI);
|
|
318
318
|
let alignmentMenu;
|
|
319
319
|
const isNested = pluginState.tablePos && isTableNested(state, pluginState.tablePos);
|
|
320
|
-
alignmentMenu = options !== null && options !== void 0 && options.isTableAlignmentEnabled && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI) : [];
|
|
320
|
+
alignmentMenu = options !== null && options !== void 0 && options.isTableAlignmentEnabled && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth) : [];
|
|
321
321
|
let cellItems;
|
|
322
322
|
cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled);
|
|
323
323
|
let columnSettingsItems;
|
|
@@ -564,7 +564,7 @@ const highlightColumnsHandler = (state, dispatch) => {
|
|
|
564
564
|
};
|
|
565
565
|
export const getAlignmentOptionsConfig = (editorState, {
|
|
566
566
|
formatMessage
|
|
567
|
-
}, editorAnalyticsAPI) => {
|
|
567
|
+
}, editorAnalyticsAPI, getEditorContainerWidth) => {
|
|
568
568
|
const tableObject = findTable(editorState.selection);
|
|
569
569
|
if (!tableObject) {
|
|
570
570
|
return [];
|
|
@@ -597,7 +597,10 @@ export const getAlignmentOptionsConfig = (editorState, {
|
|
|
597
597
|
icon: icon,
|
|
598
598
|
title: formatMessage(layoutToMessages[value]),
|
|
599
599
|
selected: normaliseAlignment(currentLayout) === value,
|
|
600
|
-
onClick: setTableAlignmentWithAnalytics(editorAnalyticsAPI)(value, currentLayout, INPUT_METHOD.FLOATING_TB)
|
|
600
|
+
onClick: setTableAlignmentWithAnalytics(editorAnalyticsAPI)(value, currentLayout, INPUT_METHOD.FLOATING_TB),
|
|
601
|
+
...(isLayoutOptionDisabled(tableObject.node, getEditorContainerWidth) && {
|
|
602
|
+
disabled: value !== 'center'
|
|
603
|
+
})
|
|
601
604
|
};
|
|
602
605
|
});
|
|
603
606
|
const alignmentItemOptions = {
|
|
@@ -623,4 +626,11 @@ export const getAlignmentOptionsConfig = (editorState, {
|
|
|
623
626
|
export const getSelectedAlignmentIcon = (alignmentIcons, selectedNode) => {
|
|
624
627
|
const selectedAlignment = selectedNode.attrs.layout;
|
|
625
628
|
return alignmentIcons.find(icon => icon.value === normaliseAlignment(selectedAlignment));
|
|
629
|
+
};
|
|
630
|
+
export const isLayoutOptionDisabled = (selectedNode, getEditorContainerWidth) => {
|
|
631
|
+
const lineLength = getEditorContainerWidth().lineLength;
|
|
632
|
+
if (selectedNode && lineLength && selectedNode.attrs.width > lineLength) {
|
|
633
|
+
return true;
|
|
634
|
+
}
|
|
635
|
+
return false;
|
|
626
636
|
};
|
|
@@ -16,6 +16,7 @@ export const ColumnResizeWidget = ({
|
|
|
16
16
|
} = useIntl();
|
|
17
17
|
if (!includeTooltip) {
|
|
18
18
|
return jsx("div", {
|
|
19
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
19
20
|
className: TableCssClassName.RESIZE_HANDLE_DECORATION,
|
|
20
21
|
"data-start-index": startIndex,
|
|
21
22
|
"data-end-index": endIndex
|
|
@@ -31,6 +32,7 @@ export const ColumnResizeWidget = ({
|
|
|
31
32
|
position: "mouse",
|
|
32
33
|
mousePosition: "auto-start"
|
|
33
34
|
}, tooltipProps => jsx("div", _extends({
|
|
35
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
34
36
|
className: TableCssClassName.RESIZE_HANDLE_DECORATION,
|
|
35
37
|
"data-start-index": startIndex,
|
|
36
38
|
"data-end-index": endIndex
|