@atlaskit/editor-plugin-table 8.1.1 → 8.2.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 +21 -0
- package/dist/cjs/nodeviews/TableResizer.js +12 -4
- package/dist/cjs/types.js +1 -1
- package/dist/cjs/ui/DragHandle/index.js +6 -2
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +34 -31
- package/dist/cjs/ui/FloatingDeleteButton/DeleteButton.js +31 -27
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +44 -40
- package/dist/cjs/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +6 -2
- package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +6 -2
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +17 -5
- package/dist/cjs/ui/TableFloatingControls/RowControls/ClassicControls.js +6 -2
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +54 -50
- package/dist/es2019/nodeviews/TableResizer.js +14 -5
- package/dist/es2019/types.js +1 -1
- package/dist/es2019/ui/DragHandle/index.js +6 -2
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +34 -31
- package/dist/es2019/ui/FloatingDeleteButton/DeleteButton.js +4 -1
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +46 -42
- package/dist/es2019/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +6 -2
- package/dist/es2019/ui/TableFloatingControls/CornerControls/DragCornerControls.js +6 -2
- package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +17 -5
- package/dist/es2019/ui/TableFloatingControls/RowControls/ClassicControls.js +6 -2
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +57 -53
- package/dist/esm/nodeviews/TableResizer.js +12 -4
- package/dist/esm/types.js +1 -1
- package/dist/esm/ui/DragHandle/index.js +6 -2
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +34 -31
- package/dist/esm/ui/FloatingDeleteButton/DeleteButton.js +31 -27
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +44 -40
- package/dist/esm/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +6 -2
- package/dist/esm/ui/TableFloatingControls/CornerControls/DragCornerControls.js +6 -2
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +17 -5
- package/dist/esm/ui/TableFloatingControls/RowControls/ClassicControls.js +6 -2
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +54 -50
- package/package.json +9 -6
- package/src/nodeviews/TableResizer.tsx +25 -13
- package/src/types.ts +1 -1
- package/src/ui/DragHandle/index.tsx +2 -0
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +1 -0
- package/src/ui/FloatingDeleteButton/DeleteButton.tsx +1 -0
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +1 -0
- package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +2 -0
- package/src/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +2 -0
- package/src/ui/TableFloatingControls/NumberColumn/index.tsx +5 -0
- package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +2 -0
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +1 -0
- package/src/ui/TableFloatingControls/index.tsx +1 -0
|
@@ -188,48 +188,52 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
188
188
|
return handles;
|
|
189
189
|
};
|
|
190
190
|
var containerWidth = isNumberColumnEnabled && tableContainerWidth ? tableContainerWidth - akEditorTableNumberColumnWidth : tableContainerWidth;
|
|
191
|
-
return
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
196
|
-
ref: columnControlsRef
|
|
197
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
198
|
-
,
|
|
199
|
-
className: ClassName.DRAG_COLUMN_CONTROLS_INNER,
|
|
200
|
-
"data-testid": "table-floating-column-controls",
|
|
201
|
-
style: {
|
|
202
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
203
|
-
gridTemplateColumns: widths,
|
|
204
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
205
|
-
marginTop: marginTop,
|
|
206
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
207
|
-
width: stickyTop ? containerWidth : undefined,
|
|
208
|
-
overflowX: stickyTop ? 'hidden' : 'visible',
|
|
209
|
-
pointerEvents: isDragging ? 'none' : undefined
|
|
210
|
-
}
|
|
211
|
-
}, columnParams.map(function (_ref2, index) {
|
|
212
|
-
var startIndex = _ref2.startIndex,
|
|
213
|
-
endIndex = _ref2.endIndex;
|
|
214
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
215
|
-
style: {
|
|
216
|
-
gridColumn: "".concat(startIndex + 1, " / span 1")
|
|
217
|
-
},
|
|
218
|
-
"data-start-index": startIndex,
|
|
219
|
-
"data-end-index": endIndex
|
|
191
|
+
return (
|
|
192
|
+
/*#__PURE__*/
|
|
193
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
194
|
+
React.createElement("div", {
|
|
220
195
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
221
|
-
,
|
|
222
|
-
|
|
223
|
-
contentEditable: false,
|
|
224
|
-
key: index
|
|
196
|
+
className: ClassName.DRAG_COLUMN_CONTROLS,
|
|
197
|
+
onMouseMove: handleMouseMove
|
|
225
198
|
}, /*#__PURE__*/React.createElement("div", {
|
|
199
|
+
ref: columnControlsRef
|
|
226
200
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
227
|
-
className: ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT
|
|
228
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
229
201
|
,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
202
|
+
className: ClassName.DRAG_COLUMN_CONTROLS_INNER,
|
|
203
|
+
"data-testid": "table-floating-column-controls",
|
|
204
|
+
style: {
|
|
205
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
206
|
+
gridTemplateColumns: widths,
|
|
207
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
208
|
+
marginTop: marginTop,
|
|
209
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
210
|
+
width: stickyTop ? containerWidth : undefined,
|
|
211
|
+
overflowX: stickyTop ? 'hidden' : 'visible',
|
|
212
|
+
pointerEvents: isDragging ? 'none' : undefined
|
|
213
|
+
}
|
|
214
|
+
}, columnParams.map(function (_ref2, index) {
|
|
215
|
+
var startIndex = _ref2.startIndex,
|
|
216
|
+
endIndex = _ref2.endIndex;
|
|
217
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
218
|
+
style: {
|
|
219
|
+
gridColumn: "".concat(startIndex + 1, " / span 1")
|
|
220
|
+
},
|
|
221
|
+
"data-start-index": startIndex,
|
|
222
|
+
"data-end-index": endIndex
|
|
223
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
224
|
+
,
|
|
225
|
+
className: ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER,
|
|
226
|
+
contentEditable: false,
|
|
227
|
+
key: index
|
|
228
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
229
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
230
|
+
className: ClassName.DRAG_COLUMN_FLOATING_INSERT_DOT
|
|
231
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
232
|
+
,
|
|
233
|
+
style: columnParams.length - 1 === index ? {
|
|
234
|
+
right: '0'
|
|
235
|
+
} : {}
|
|
236
|
+
}));
|
|
237
|
+
}), columnHandles()))
|
|
238
|
+
);
|
|
235
239
|
};
|
|
@@ -90,8 +90,12 @@ var CornerControlComponent = /*#__PURE__*/function (_Component) {
|
|
|
90
90
|
className: classnames(ClassName.CONTROLS_CORNER_BUTTON, {
|
|
91
91
|
danger: isActive && isInDanger
|
|
92
92
|
}),
|
|
93
|
-
onClick: this.selectTable
|
|
94
|
-
|
|
93
|
+
onClick: this.selectTable
|
|
94
|
+
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
95
|
+
,
|
|
96
|
+
onMouseOver: this.hoverTable
|
|
97
|
+
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
98
|
+
,
|
|
95
99
|
onMouseOut: this.clearHoverSelection
|
|
96
100
|
}), !isHeaderRowEnabled &&
|
|
97
101
|
/*#__PURE__*/
|
|
@@ -40,7 +40,9 @@ var DragCornerControlsComponent = function DragCornerControlsComponent(_ref) {
|
|
|
40
40
|
}),
|
|
41
41
|
"aria-label": formatMessage(messages.cornerControl),
|
|
42
42
|
type: "button",
|
|
43
|
-
onClick: handleOnClick
|
|
43
|
+
onClick: handleOnClick
|
|
44
|
+
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
45
|
+
,
|
|
44
46
|
onMouseOut: handleMouseOut,
|
|
45
47
|
contentEditable: false
|
|
46
48
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -86,7 +88,9 @@ var DragCornerControlsComponentWithSelection = function DragCornerControlsCompon
|
|
|
86
88
|
}),
|
|
87
89
|
"aria-label": formatMessage(messages.cornerControl),
|
|
88
90
|
type: "button",
|
|
89
|
-
onClick: handleOnClick
|
|
91
|
+
onClick: handleOnClick
|
|
92
|
+
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
93
|
+
,
|
|
90
94
|
onMouseOut: handleMouseOut,
|
|
91
95
|
contentEditable: false
|
|
92
96
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -113,7 +113,10 @@ var NumberColumn = /*#__PURE__*/function (_Component) {
|
|
|
113
113
|
},
|
|
114
114
|
contentEditable: false
|
|
115
115
|
}, rowHeights.map(function (rowHeight, index) {
|
|
116
|
-
return isDragAndDropEnabled ?
|
|
116
|
+
return isDragAndDropEnabled ?
|
|
117
|
+
/*#__PURE__*/
|
|
118
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
119
|
+
React.createElement("div", {
|
|
117
120
|
key: "wrapper-".concat(index)
|
|
118
121
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
119
122
|
,
|
|
@@ -121,11 +124,16 @@ var NumberColumn = /*#__PURE__*/function (_Component) {
|
|
|
121
124
|
"data-index": index
|
|
122
125
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
123
126
|
,
|
|
124
|
-
style: _this2.getCellStyles(index, rowHeight)
|
|
127
|
+
style: _this2.getCellStyles(index, rowHeight)
|
|
128
|
+
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
129
|
+
,
|
|
125
130
|
onMouseOver: function onMouseOver() {
|
|
126
131
|
return updateCellHoverLocation(index);
|
|
127
132
|
}
|
|
128
|
-
}, hasHeaderRow ? index > 0 ? index : null : index + 1) :
|
|
133
|
+
}, hasHeaderRow ? index > 0 ? index : null : index + 1) :
|
|
134
|
+
/*#__PURE__*/
|
|
135
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
136
|
+
React.createElement("div", {
|
|
129
137
|
key: "wrapper-".concat(index)
|
|
130
138
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
131
139
|
,
|
|
@@ -136,10 +144,14 @@ var NumberColumn = /*#__PURE__*/function (_Component) {
|
|
|
136
144
|
style: _this2.getCellStyles(index, rowHeight),
|
|
137
145
|
onClick: function onClick(event) {
|
|
138
146
|
return _this2.selectRow(index, event);
|
|
139
|
-
}
|
|
147
|
+
}
|
|
148
|
+
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
149
|
+
,
|
|
140
150
|
onMouseOver: function onMouseOver() {
|
|
141
151
|
return _this2.hoverRows(index);
|
|
142
|
-
}
|
|
152
|
+
}
|
|
153
|
+
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
154
|
+
,
|
|
143
155
|
onMouseOut: _this2.clearHoverSelection
|
|
144
156
|
}, hasHeaderRow ? index > 0 ? index : null : index + 1);
|
|
145
157
|
}));
|
|
@@ -92,10 +92,14 @@ var RowControlsComponent = /*#__PURE__*/function (_Component) {
|
|
|
92
92
|
className: "".concat(ClassName.ROW_CONTROLS_BUTTON, " ").concat(ClassName.CONTROLS_BUTTON),
|
|
93
93
|
onClick: function onClick(event) {
|
|
94
94
|
return _this2.props.selectRow(startIndex, event.shiftKey);
|
|
95
|
-
}
|
|
95
|
+
}
|
|
96
|
+
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
97
|
+
,
|
|
96
98
|
onMouseOver: function onMouseOver() {
|
|
97
99
|
return _this2.props.hoverRows([startIndex]);
|
|
98
|
-
}
|
|
100
|
+
}
|
|
101
|
+
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
102
|
+
,
|
|
99
103
|
onMouseOut: _this2.clearHoverSelection,
|
|
100
104
|
"data-start-index": startIndex,
|
|
101
105
|
"data-end-index": endIndex
|
|
@@ -177,57 +177,61 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
177
177
|
if (isResizing) {
|
|
178
178
|
return null;
|
|
179
179
|
}
|
|
180
|
-
return
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
gridTemplateRows: heights,
|
|
185
|
-
gridTemplateColumns: isDragging ? // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
186
|
-
"".concat(dropTargetExtendedWidth, "px 14px ").concat(tableWidth, "px") : '0px 14px 0px',
|
|
187
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
188
|
-
left: isDragging ? // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
189
|
-
"-".concat(dropTargetExtendedWidth + 2, "px") : "var(--ds-space-negative-025, -2px)"
|
|
190
|
-
},
|
|
191
|
-
onMouseMove: handleMouseMove,
|
|
192
|
-
contentEditable: false
|
|
193
|
-
}, rowsParams.map(function (_ref4, index) {
|
|
194
|
-
var startIndex = _ref4.startIndex,
|
|
195
|
-
endIndex = _ref4.endIndex;
|
|
196
|
-
return /*#__PURE__*/React.createElement(Fragment, {
|
|
197
|
-
key: index
|
|
198
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
199
|
-
style: {
|
|
200
|
-
gridRow: "".concat(index + 1, " / span 1"),
|
|
201
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
202
|
-
gridColumn: '2'
|
|
203
|
-
},
|
|
204
|
-
"data-start-index": startIndex,
|
|
205
|
-
"data-end-index": endIndex
|
|
180
|
+
return (
|
|
181
|
+
/*#__PURE__*/
|
|
182
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
183
|
+
React.createElement("div", {
|
|
206
184
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
207
|
-
,
|
|
208
|
-
className: ClassName.DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER,
|
|
209
|
-
contentEditable: false,
|
|
210
|
-
key: "insert-dot-".concat(index)
|
|
211
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
212
|
-
className: ClassName.DRAG_ROW_FLOATING_INSERT_DOT
|
|
213
|
-
})), isDragging && /*#__PURE__*/React.createElement(RowDropTarget, {
|
|
214
|
-
key: "drop-target-".concat(index),
|
|
215
|
-
index: index,
|
|
216
|
-
localId: currentNodeLocalId,
|
|
185
|
+
className: ClassName.DRAG_ROW_CONTROLS,
|
|
217
186
|
style: {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
// eslint-disable-next-line @atlaskit/
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
187
|
+
gridTemplateRows: heights,
|
|
188
|
+
gridTemplateColumns: isDragging ? // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
189
|
+
"".concat(dropTargetExtendedWidth, "px 14px ").concat(tableWidth, "px") : '0px 14px 0px',
|
|
190
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
191
|
+
left: isDragging ? // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
192
|
+
"-".concat(dropTargetExtendedWidth + 2, "px") : "var(--ds-space-negative-025, -2px)"
|
|
193
|
+
},
|
|
194
|
+
onMouseMove: handleMouseMove,
|
|
195
|
+
contentEditable: false
|
|
196
|
+
}, rowsParams.map(function (_ref4, index) {
|
|
197
|
+
var startIndex = _ref4.startIndex,
|
|
198
|
+
endIndex = _ref4.endIndex;
|
|
199
|
+
return /*#__PURE__*/React.createElement(Fragment, {
|
|
200
|
+
key: index
|
|
201
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
202
|
+
style: {
|
|
203
|
+
gridRow: "".concat(index + 1, " / span 1"),
|
|
204
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
205
|
+
gridColumn: '2'
|
|
206
|
+
},
|
|
207
|
+
"data-start-index": startIndex,
|
|
208
|
+
"data-end-index": endIndex
|
|
209
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
210
|
+
,
|
|
211
|
+
className: ClassName.DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER,
|
|
212
|
+
contentEditable: false,
|
|
213
|
+
key: "insert-dot-".concat(index)
|
|
214
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
215
|
+
className: ClassName.DRAG_ROW_FLOATING_INSERT_DOT
|
|
216
|
+
})), isDragging && /*#__PURE__*/React.createElement(RowDropTarget, {
|
|
217
|
+
key: "drop-target-".concat(index),
|
|
218
|
+
index: index,
|
|
219
|
+
localId: currentNodeLocalId,
|
|
220
|
+
style: {
|
|
221
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
222
|
+
gridColumn: '1 / span 3',
|
|
223
|
+
gridRow: "".concat(index + 1, " / span 1"),
|
|
224
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
225
|
+
height: '100%',
|
|
226
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
227
|
+
pointerEvents: 'auto',
|
|
228
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
229
|
+
position: 'relative',
|
|
230
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
231
|
+
left: "var(--ds-space-negative-100, -8px)"
|
|
232
|
+
}
|
|
233
|
+
}));
|
|
234
|
+
}), rowHandles())
|
|
235
|
+
);
|
|
232
236
|
};
|
|
233
237
|
export var DragControls = injectIntl(DragControlsComponent);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.2.1",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
31
31
|
"@atlaskit/button": "^20.3.0",
|
|
32
32
|
"@atlaskit/custom-steps": "^0.9.0",
|
|
33
|
-
"@atlaskit/editor-common": "^95.
|
|
33
|
+
"@atlaskit/editor-common": "^95.10.0",
|
|
34
34
|
"@atlaskit/editor-palette": "1.6.3",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
@@ -40,20 +40,20 @@
|
|
|
40
40
|
"@atlaskit/editor-plugin-guideline": "^1.2.0",
|
|
41
41
|
"@atlaskit/editor-plugin-selection": "^1.5.0",
|
|
42
42
|
"@atlaskit/editor-plugin-width": "^1.3.0",
|
|
43
|
-
"@atlaskit/editor-prosemirror": "6.
|
|
43
|
+
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
44
44
|
"@atlaskit/editor-shared-styles": "^3.2.0",
|
|
45
45
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
46
|
-
"@atlaskit/icon": "^22.
|
|
46
|
+
"@atlaskit/icon": "^22.28.0",
|
|
47
47
|
"@atlaskit/menu": "^2.13.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
49
49
|
"@atlaskit/pragmatic-drag-and-drop": "^1.4.0",
|
|
50
50
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.4.0",
|
|
51
51
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
|
|
52
|
-
"@atlaskit/primitives": "^13.
|
|
52
|
+
"@atlaskit/primitives": "^13.3.0",
|
|
53
53
|
"@atlaskit/theme": "^14.0.0",
|
|
54
54
|
"@atlaskit/tmp-editor-statsig": "^2.21.0",
|
|
55
55
|
"@atlaskit/toggle": "^13.4.0",
|
|
56
|
-
"@atlaskit/tokens": "^2.
|
|
56
|
+
"@atlaskit/tokens": "^2.4.0",
|
|
57
57
|
"@atlaskit/tooltip": "^18.9.0",
|
|
58
58
|
"@babel/runtime": "^7.0.0",
|
|
59
59
|
"@emotion/react": "^11.7.1",
|
|
@@ -124,6 +124,9 @@
|
|
|
124
124
|
},
|
|
125
125
|
"platform_editor_use_nested_table_pm_nodes": {
|
|
126
126
|
"type": "boolean"
|
|
127
|
+
},
|
|
128
|
+
"platform_editor_set_alignment_when_resized": {
|
|
129
|
+
"type": "boolean"
|
|
127
130
|
}
|
|
128
131
|
}
|
|
129
132
|
}
|
|
@@ -25,6 +25,7 @@ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/stat
|
|
|
25
25
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
26
26
|
import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
27
27
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
28
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
28
29
|
import { token } from '@atlaskit/tokens';
|
|
29
30
|
|
|
30
31
|
import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../commands-with-analytics';
|
|
@@ -574,10 +575,21 @@ export const TableResizer = ({
|
|
|
574
575
|
}
|
|
575
576
|
|
|
576
577
|
if (typeof pos === 'number') {
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
578
|
+
if (fg('platform_editor_set_alignment_when_resized')) {
|
|
579
|
+
tr = tr.setNodeMarkup(pos, undefined, {
|
|
580
|
+
...node.attrs,
|
|
581
|
+
width: newWidth,
|
|
582
|
+
layout:
|
|
583
|
+
node.attrs.layout !== ALIGN_START && node.attrs.layout !== ALIGN_CENTER
|
|
584
|
+
? ALIGN_CENTER
|
|
585
|
+
: node.attrs.layout,
|
|
586
|
+
});
|
|
587
|
+
} else {
|
|
588
|
+
tr = tr.setNodeMarkup(pos, undefined, {
|
|
589
|
+
...node.attrs,
|
|
590
|
+
width: newWidth,
|
|
591
|
+
});
|
|
592
|
+
}
|
|
581
593
|
|
|
582
594
|
const newNode = tr.doc.nodeAt(pos)!;
|
|
583
595
|
tr = scaleTable(
|
|
@@ -636,23 +648,23 @@ export const TableResizer = ({
|
|
|
636
648
|
return newWidth;
|
|
637
649
|
},
|
|
638
650
|
[
|
|
639
|
-
displayGapCursor,
|
|
640
|
-
updateWidth,
|
|
641
651
|
editorView,
|
|
642
652
|
getPos,
|
|
643
653
|
node,
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
displayGuideline,
|
|
647
|
-
attachAnalyticsEvent,
|
|
654
|
+
isCommentEditor,
|
|
655
|
+
widthToWidest,
|
|
648
656
|
endMeasure,
|
|
657
|
+
displayGapCursor,
|
|
658
|
+
displayGuideline,
|
|
659
|
+
updateWidth,
|
|
660
|
+
scheduleResize,
|
|
649
661
|
onResizeStop,
|
|
662
|
+
attachAnalyticsEvent,
|
|
663
|
+
tableRef,
|
|
664
|
+
pluginInjectionApi,
|
|
650
665
|
isTableScalingEnabled,
|
|
651
666
|
shouldUseIncreasedScalingPercent,
|
|
652
|
-
widthToWidest,
|
|
653
667
|
formatMessage,
|
|
654
|
-
pluginInjectionApi,
|
|
655
|
-
isCommentEditor,
|
|
656
668
|
],
|
|
657
669
|
);
|
|
658
670
|
|
package/src/types.ts
CHANGED
|
@@ -470,7 +470,7 @@ export const TableCssClassName = {
|
|
|
470
470
|
WITH_RESIZE_LINE: `${tablePrefixSelector}-column-resize-line`,
|
|
471
471
|
WITH_RESIZE_LINE_LAST_COLUMN: `${tablePrefixSelector}-column-resize-line-last-column`,
|
|
472
472
|
|
|
473
|
-
WITH_DRAG_RESIZE_LINE: `${tablePrefixSelector}-drag-column
|
|
473
|
+
WITH_DRAG_RESIZE_LINE: `${tablePrefixSelector}-drag-column-resize-line`,
|
|
474
474
|
WITH_DRAG_RESIZE_LINE_LAST_COLUMN: `${tablePrefixSelector}-drag-column-resize-line-last-column`,
|
|
475
475
|
|
|
476
476
|
WITH_ROW_INSERT_LINE: `${tablePrefixSelector}-row-insert-line`,
|
|
@@ -242,7 +242,9 @@ const DragHandleComponent = ({
|
|
|
242
242
|
aria-label={formatMessage(isRow ? messages.rowDragHandle : messages.columnDragHandle)}
|
|
243
243
|
aria-expanded={isDragMenuOpen && isDragMenuTarget ? 'true' : 'false'}
|
|
244
244
|
aria-haspopup="menu"
|
|
245
|
+
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
245
246
|
onMouseOver={onMouseOver}
|
|
247
|
+
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
246
248
|
onMouseOut={onMouseOut}
|
|
247
249
|
onMouseUp={(e) => {
|
|
248
250
|
// return focus to editor so copying table selections whilst still works, i cannot call e.preventDefault in a mousemove event as this stops dragstart events from firing
|
|
@@ -162,6 +162,7 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
162
162
|
isOpenAllowed = isCellMenuOpenByKeyboard ? this.state.isOpenAllowed : isOpen;
|
|
163
163
|
|
|
164
164
|
return (
|
|
165
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
165
166
|
<div
|
|
166
167
|
data-testid="table-cell-contextual-menu"
|
|
167
168
|
onMouseLeave={this.closeSubmenu}
|
|
@@ -22,6 +22,7 @@ const DeleteButton = ({
|
|
|
22
22
|
removeLabel,
|
|
23
23
|
intl: { formatMessage },
|
|
24
24
|
}: ButtonProps & WrappedComponentProps) => (
|
|
25
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
25
26
|
<div
|
|
26
27
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
27
28
|
className={ClassName.CONTROLS_DELETE_BUTTON_WRAP}
|
|
@@ -295,6 +295,7 @@ export const ColumnControls = ({
|
|
|
295
295
|
: tableContainerWidth;
|
|
296
296
|
|
|
297
297
|
return (
|
|
298
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
298
299
|
<div
|
|
299
300
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
300
301
|
className={ClassName.DRAG_COLUMN_CONTROLS}
|
|
@@ -55,7 +55,9 @@ class CornerControlComponent extends Component<CornerControlProps & WrappedCompo
|
|
|
55
55
|
danger: isActive && isInDanger,
|
|
56
56
|
})}
|
|
57
57
|
onClick={this.selectTable}
|
|
58
|
+
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
58
59
|
onMouseOver={this.hoverTable}
|
|
60
|
+
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
59
61
|
onMouseOut={this.clearHoverSelection}
|
|
60
62
|
/>
|
|
61
63
|
|
|
@@ -54,6 +54,7 @@ const DragCornerControlsComponent = ({
|
|
|
54
54
|
aria-label={formatMessage(messages.cornerControl)}
|
|
55
55
|
type="button"
|
|
56
56
|
onClick={handleOnClick}
|
|
57
|
+
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
57
58
|
onMouseOut={handleMouseOut}
|
|
58
59
|
contentEditable={false}
|
|
59
60
|
>
|
|
@@ -106,6 +107,7 @@ const DragCornerControlsComponentWithSelection = ({
|
|
|
106
107
|
aria-label={formatMessage(messages.cornerControl)}
|
|
107
108
|
type="button"
|
|
108
109
|
onClick={handleOnClick}
|
|
110
|
+
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
109
111
|
onMouseOut={handleMouseOut}
|
|
110
112
|
contentEditable={false}
|
|
111
113
|
>
|
|
@@ -48,6 +48,7 @@ export default class NumberColumn extends Component<Props, any> {
|
|
|
48
48
|
>
|
|
49
49
|
{rowHeights.map((rowHeight, index) =>
|
|
50
50
|
isDragAndDropEnabled ? (
|
|
51
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
51
52
|
<div
|
|
52
53
|
key={`wrapper-${index}`}
|
|
53
54
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -55,11 +56,13 @@ export default class NumberColumn extends Component<Props, any> {
|
|
|
55
56
|
data-index={index}
|
|
56
57
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
57
58
|
style={this.getCellStyles(index, rowHeight)}
|
|
59
|
+
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
58
60
|
onMouseOver={() => updateCellHoverLocation(index)}
|
|
59
61
|
>
|
|
60
62
|
{hasHeaderRow ? (index > 0 ? index : null) : index + 1}
|
|
61
63
|
</div>
|
|
62
64
|
) : (
|
|
65
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
63
66
|
<div
|
|
64
67
|
key={`wrapper-${index}`}
|
|
65
68
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -68,7 +71,9 @@ export default class NumberColumn extends Component<Props, any> {
|
|
|
68
71
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
69
72
|
style={this.getCellStyles(index, rowHeight)}
|
|
70
73
|
onClick={(event) => this.selectRow(index, event)}
|
|
74
|
+
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
71
75
|
onMouseOver={() => this.hoverRows(index)}
|
|
76
|
+
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
72
77
|
onMouseOut={this.clearHoverSelection}
|
|
73
78
|
>
|
|
74
79
|
{hasHeaderRow ? (index > 0 ? index : null) : index + 1}
|
|
@@ -96,7 +96,9 @@ class RowControlsComponent extends Component<Props & WrappedComponentProps> {
|
|
|
96
96
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
97
97
|
className={`${ClassName.ROW_CONTROLS_BUTTON} ${ClassName.CONTROLS_BUTTON}`}
|
|
98
98
|
onClick={(event) => this.props.selectRow(startIndex, event.shiftKey)}
|
|
99
|
+
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
99
100
|
onMouseOver={() => this.props.hoverRows([startIndex])}
|
|
101
|
+
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
100
102
|
onMouseOut={this.clearHoverSelection}
|
|
101
103
|
data-start-index={startIndex}
|
|
102
104
|
data-end-index={endIndex}
|
|
@@ -264,6 +264,7 @@ const DragControlsComponent = ({
|
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
return (
|
|
267
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
267
268
|
<div
|
|
268
269
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
269
270
|
className={ClassName.DRAG_ROW_CONTROLS}
|
|
@@ -141,6 +141,7 @@ export const TableFloatingControls = ({
|
|
|
141
141
|
return (
|
|
142
142
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
143
143
|
<div className={wrapperClassName}>
|
|
144
|
+
{/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}
|
|
144
145
|
<div onMouseDown={(e) => !isDragAndDropEnabled && e.preventDefault()}>
|
|
145
146
|
{isNumberColumnEnabled ? (
|
|
146
147
|
<NumberColumn
|