@atlaskit/editor-plugin-table 7.16.3 → 7.16.4
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 +8 -0
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +6 -2
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +6 -2
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +6 -2
- package/package.json +1 -1
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +18 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.16.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#102667](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/102667)
|
|
8
|
+
[`ab69107b7352`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ab69107b7352) -
|
|
9
|
+
Force placeholder drag handle to be positioned in first column to avoid overflow
|
|
10
|
+
|
|
3
11
|
## 7.16.3
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -126,6 +126,7 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
|
|
|
126
126
|
var generateHandleByType = function generateHandleByType(type, appearance, gridColumn, indexes) {
|
|
127
127
|
var _rowHeights$reduce, _colWidths$reduce;
|
|
128
128
|
var isHover = type === 'hover';
|
|
129
|
+
var isPlaceholder = appearance === 'placeholder';
|
|
129
130
|
var previewHeight = (_rowHeights$reduce = rowHeights === null || rowHeights === void 0 ? void 0 : rowHeights.reduce(function (sum, cur) {
|
|
130
131
|
return sum + cur;
|
|
131
132
|
}, 0)) !== null && _rowHeights$reduce !== void 0 ? _rowHeights$reduce : 0;
|
|
@@ -147,7 +148,7 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
|
|
|
147
148
|
width: '100%',
|
|
148
149
|
position: 'relative'
|
|
149
150
|
},
|
|
150
|
-
"data-testid": "table-floating-column-".concat(isHover ? colIndex : selectedColIndexes[0], "-drag-handle")
|
|
151
|
+
"data-testid": "table-floating-column-".concat(isHover ? colIndex : isPlaceholder ? appearance : selectedColIndexes[0], "-drag-handle")
|
|
151
152
|
}, /*#__PURE__*/_react.default.createElement(_DragHandle.DragHandle, {
|
|
152
153
|
isDragMenuTarget: !isHover,
|
|
153
154
|
direction: "column",
|
|
@@ -172,10 +173,13 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
|
|
|
172
173
|
if (!tableActive) {
|
|
173
174
|
return null;
|
|
174
175
|
}
|
|
176
|
+
var selectedAppearance = isColumnSelected && isEntireTableSelected ? isInDanger ? 'danger' : 'selected' : 'placeholder';
|
|
175
177
|
|
|
176
178
|
// placeholder / selected need to always render at least one handle
|
|
177
179
|
// so it can be focused via keyboard shortcuts
|
|
178
|
-
handles.push(generateHandleByType('selected',
|
|
180
|
+
handles.push(generateHandleByType('selected', selectedAppearance,
|
|
181
|
+
// always position placeholder in first column to avoid overflow issues
|
|
182
|
+
selectedAppearance === 'placeholder' ? '1 / span 1' : "".concat(selectedColIndexes[0] + 1, " / span ").concat(selectedColIndexes.length), selectedColIndexes));
|
|
179
183
|
if (hoveredCell && isTableHovered && colIndex !== undefined && !selectedColIndexes.includes(colIndex)) {
|
|
180
184
|
handles.push(generateHandleByType('hover', 'default', "".concat(colIndex + 1, " / span 1"), colIndexes));
|
|
181
185
|
}
|
|
@@ -126,6 +126,7 @@ export const ColumnControls = ({
|
|
|
126
126
|
const generateHandleByType = (type, appearance, gridColumn, indexes) => {
|
|
127
127
|
var _rowHeights$reduce, _colWidths$reduce;
|
|
128
128
|
const isHover = type === 'hover';
|
|
129
|
+
const isPlaceholder = appearance === 'placeholder';
|
|
129
130
|
const previewHeight = (_rowHeights$reduce = rowHeights === null || rowHeights === void 0 ? void 0 : rowHeights.reduce((sum, cur) => sum + cur, 0)) !== null && _rowHeights$reduce !== void 0 ? _rowHeights$reduce : 0;
|
|
130
131
|
const previewWidth = (_colWidths$reduce = colWidths === null || colWidths === void 0 ? void 0 : colWidths.reduce((sum, v, i) => sum + (v !== null && v !== void 0 ? v : tableCellMinWidth) * (indexes.includes(i) ? 1 : 0), 0)) !== null && _colWidths$reduce !== void 0 ? _colWidths$reduce : tableCellMinWidth;
|
|
131
132
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -143,7 +144,7 @@ export const ColumnControls = ({
|
|
|
143
144
|
width: '100%',
|
|
144
145
|
position: 'relative'
|
|
145
146
|
},
|
|
146
|
-
"data-testid": `table-floating-column-${isHover ? colIndex : selectedColIndexes[0]}-drag-handle`
|
|
147
|
+
"data-testid": `table-floating-column-${isHover ? colIndex : isPlaceholder ? appearance : selectedColIndexes[0]}-drag-handle`
|
|
147
148
|
}, /*#__PURE__*/React.createElement(DragHandle, {
|
|
148
149
|
isDragMenuTarget: !isHover,
|
|
149
150
|
direction: "column",
|
|
@@ -168,10 +169,13 @@ export const ColumnControls = ({
|
|
|
168
169
|
if (!tableActive) {
|
|
169
170
|
return null;
|
|
170
171
|
}
|
|
172
|
+
const selectedAppearance = isColumnSelected && isEntireTableSelected ? isInDanger ? 'danger' : 'selected' : 'placeholder';
|
|
171
173
|
|
|
172
174
|
// placeholder / selected need to always render at least one handle
|
|
173
175
|
// so it can be focused via keyboard shortcuts
|
|
174
|
-
handles.push(generateHandleByType('selected',
|
|
176
|
+
handles.push(generateHandleByType('selected', selectedAppearance,
|
|
177
|
+
// always position placeholder in first column to avoid overflow issues
|
|
178
|
+
selectedAppearance === 'placeholder' ? '1 / span 1' : `${selectedColIndexes[0] + 1} / span ${selectedColIndexes.length}`, selectedColIndexes));
|
|
175
179
|
if (hoveredCell && isTableHovered && colIndex !== undefined && !selectedColIndexes.includes(colIndex)) {
|
|
176
180
|
handles.push(generateHandleByType('hover', 'default', `${colIndex + 1} / span 1`, colIndexes));
|
|
177
181
|
}
|
|
@@ -117,6 +117,7 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
117
117
|
var generateHandleByType = function generateHandleByType(type, appearance, gridColumn, indexes) {
|
|
118
118
|
var _rowHeights$reduce, _colWidths$reduce;
|
|
119
119
|
var isHover = type === 'hover';
|
|
120
|
+
var isPlaceholder = appearance === 'placeholder';
|
|
120
121
|
var previewHeight = (_rowHeights$reduce = rowHeights === null || rowHeights === void 0 ? void 0 : rowHeights.reduce(function (sum, cur) {
|
|
121
122
|
return sum + cur;
|
|
122
123
|
}, 0)) !== null && _rowHeights$reduce !== void 0 ? _rowHeights$reduce : 0;
|
|
@@ -138,7 +139,7 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
138
139
|
width: '100%',
|
|
139
140
|
position: 'relative'
|
|
140
141
|
},
|
|
141
|
-
"data-testid": "table-floating-column-".concat(isHover ? colIndex : selectedColIndexes[0], "-drag-handle")
|
|
142
|
+
"data-testid": "table-floating-column-".concat(isHover ? colIndex : isPlaceholder ? appearance : selectedColIndexes[0], "-drag-handle")
|
|
142
143
|
}, /*#__PURE__*/React.createElement(DragHandle, {
|
|
143
144
|
isDragMenuTarget: !isHover,
|
|
144
145
|
direction: "column",
|
|
@@ -163,10 +164,13 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
163
164
|
if (!tableActive) {
|
|
164
165
|
return null;
|
|
165
166
|
}
|
|
167
|
+
var selectedAppearance = isColumnSelected && isEntireTableSelected ? isInDanger ? 'danger' : 'selected' : 'placeholder';
|
|
166
168
|
|
|
167
169
|
// placeholder / selected need to always render at least one handle
|
|
168
170
|
// so it can be focused via keyboard shortcuts
|
|
169
|
-
handles.push(generateHandleByType('selected',
|
|
171
|
+
handles.push(generateHandleByType('selected', selectedAppearance,
|
|
172
|
+
// always position placeholder in first column to avoid overflow issues
|
|
173
|
+
selectedAppearance === 'placeholder' ? '1 / span 1' : "".concat(selectedColIndexes[0] + 1, " / span ").concat(selectedColIndexes.length), selectedColIndexes));
|
|
170
174
|
if (hoveredCell && isTableHovered && colIndex !== undefined && !selectedColIndexes.includes(colIndex)) {
|
|
171
175
|
handles.push(generateHandleByType('hover', 'default', "".concat(colIndex + 1, " / span 1"), colIndexes));
|
|
172
176
|
}
|
package/package.json
CHANGED
|
@@ -195,6 +195,7 @@ export const ColumnControls = ({
|
|
|
195
195
|
indexes: number[],
|
|
196
196
|
) => {
|
|
197
197
|
const isHover = type === 'hover';
|
|
198
|
+
const isPlaceholder = appearance === 'placeholder';
|
|
198
199
|
const previewHeight = rowHeights?.reduce((sum, cur) => sum + cur, 0) ?? 0;
|
|
199
200
|
|
|
200
201
|
const previewWidth =
|
|
@@ -221,7 +222,11 @@ export const ColumnControls = ({
|
|
|
221
222
|
position: 'relative',
|
|
222
223
|
}}
|
|
223
224
|
data-testid={`table-floating-column-${
|
|
224
|
-
isHover
|
|
225
|
+
isHover
|
|
226
|
+
? colIndex
|
|
227
|
+
: isPlaceholder
|
|
228
|
+
? appearance
|
|
229
|
+
: selectedColIndexes[0]
|
|
225
230
|
}-drag-handle`}
|
|
226
231
|
>
|
|
227
232
|
<DragHandle
|
|
@@ -254,17 +259,23 @@ export const ColumnControls = ({
|
|
|
254
259
|
return null;
|
|
255
260
|
}
|
|
256
261
|
|
|
262
|
+
const selectedAppearance =
|
|
263
|
+
isColumnSelected && isEntireTableSelected
|
|
264
|
+
? isInDanger
|
|
265
|
+
? 'danger'
|
|
266
|
+
: 'selected'
|
|
267
|
+
: 'placeholder';
|
|
268
|
+
|
|
257
269
|
// placeholder / selected need to always render at least one handle
|
|
258
270
|
// so it can be focused via keyboard shortcuts
|
|
259
271
|
handles.push(
|
|
260
272
|
generateHandleByType(
|
|
261
273
|
'selected',
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
:
|
|
267
|
-
`${selectedColIndexes[0] + 1} / span ${selectedColIndexes.length}`,
|
|
274
|
+
selectedAppearance,
|
|
275
|
+
// always position placeholder in first column to avoid overflow issues
|
|
276
|
+
selectedAppearance === 'placeholder'
|
|
277
|
+
? '1 / span 1'
|
|
278
|
+
: `${selectedColIndexes[0] + 1} / span ${selectedColIndexes.length}`,
|
|
268
279
|
selectedColIndexes,
|
|
269
280
|
),
|
|
270
281
|
);
|