@atlaskit/editor-plugin-table 39.0.2 → 39.0.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 +15 -0
- package/dist/cjs/ui/TableMenu/cell/getCellMenuComponents.js +3 -136
- package/dist/cjs/ui/TableMenu/column/getColumnMenuComponents.js +1 -205
- package/dist/cjs/ui/TableMenu/row/getRowMenuComponents.js +1 -161
- package/dist/cjs/ui/TableMenu/shared/getSharedItems.js +2 -49
- package/dist/cjs/ui/TableMenu/shared/selection.js +1 -6
- package/dist/es2019/ui/TableMenu/cell/getCellMenuComponents.js +3 -118
- package/dist/es2019/ui/TableMenu/column/getColumnMenuComponents.js +2 -178
- package/dist/es2019/ui/TableMenu/row/getRowMenuComponents.js +2 -140
- package/dist/es2019/ui/TableMenu/shared/getSharedItems.js +2 -45
- package/dist/es2019/ui/TableMenu/shared/selection.js +2 -9
- package/dist/esm/ui/TableMenu/cell/getCellMenuComponents.js +3 -136
- package/dist/esm/ui/TableMenu/column/getColumnMenuComponents.js +2 -206
- package/dist/esm/ui/TableMenu/row/getRowMenuComponents.js +2 -162
- package/dist/esm/ui/TableMenu/shared/getSharedItems.js +2 -49
- package/dist/esm/ui/TableMenu/shared/selection.js +1 -6
- package/dist/types/ui/TableMenu/column/getColumnMenuComponents.d.ts +1 -1
- package/dist/types/ui/TableMenu/shared/selection.d.ts +1 -2
- package/package.json +4 -10
|
@@ -4,7 +4,6 @@ import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar/toolbar-dro
|
|
|
4
4
|
import AlignPositionBottomIcon from '@atlaskit/icon-lab/core/align-position-bottom';
|
|
5
5
|
import AlignPositionCenterVerticalIcon from '@atlaskit/icon-lab/core/align-position-center-vertical';
|
|
6
6
|
import AlignPositionTopIcon from '@atlaskit/icon-lab/core/align-position-top';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
8
7
|
import { MergeCellsItem } from './items/MergeCellsItem';
|
|
9
8
|
import { SplitCellItem } from './items/SplitCellItem';
|
|
10
9
|
import { VerticalAlignDropdownItem } from './items/VerticalAlignDropdownItem';
|
|
@@ -12,10 +11,9 @@ import { VerticalAlignNestedMenu } from './items/VerticalAlignNestedMenu';
|
|
|
12
11
|
import { CELL_MENU, CELL_ACTION_SECTION, CELL_ADD_SECTION, CELL_DANGER_SECTION, CELL_MENU_RANK, MERGE_CELLS_ITEM, SPLIT_CELL_ITEM, CELL_ACTION_SECTION_RANK, CELL_ADD_SECTION_RANK, VERTICAL_ALIGN_BOTTOM_ITEM, VERTICAL_ALIGN_MENU, VERTICAL_ALIGN_MENU_RANK, VERTICAL_ALIGN_MENU_SECTION, VERTICAL_ALIGN_MENU_SECTION_RANK, VERTICAL_ALIGN_MIDDLE_ITEM, VERTICAL_ALIGN_TOP_ITEM } from './keys';
|
|
13
12
|
export const getCellMenuComponents = ({
|
|
14
13
|
api
|
|
15
|
-
}) =>
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
// items); the danger section gains the shared Delete column/row items.
|
|
14
|
+
}) => [
|
|
15
|
+
// Merge/Split cells live in the Add section (alongside the shared add/distribute
|
|
16
|
+
// items); the danger section also contains the shared Delete column/row items.
|
|
19
17
|
|
|
20
18
|
// --- Menu surface ---
|
|
21
19
|
{
|
|
@@ -130,119 +128,6 @@ export const getCellMenuComponents = ({
|
|
|
130
128
|
})
|
|
131
129
|
},
|
|
132
130
|
// --- Danger section (Clear cell + shared Delete column / Delete row) ---
|
|
133
|
-
{
|
|
134
|
-
type: CELL_DANGER_SECTION.type,
|
|
135
|
-
key: CELL_DANGER_SECTION.key,
|
|
136
|
-
parents: [{
|
|
137
|
-
type: CELL_MENU.type,
|
|
138
|
-
key: CELL_MENU.key,
|
|
139
|
-
rank: CELL_MENU_RANK[CELL_DANGER_SECTION.key]
|
|
140
|
-
}],
|
|
141
|
-
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
142
|
-
hasSeparator: true
|
|
143
|
-
}, props.children)
|
|
144
|
-
}] : [
|
|
145
|
-
// --- Cell menu update OFF: legacy cell menu (Merge/Split live in the action section) ---
|
|
146
|
-
|
|
147
|
-
// --- Menu surface ---
|
|
148
|
-
{
|
|
149
|
-
type: CELL_MENU.type,
|
|
150
|
-
key: CELL_MENU.key
|
|
151
|
-
},
|
|
152
|
-
// --- Main action section (Background color, Merge cells, Split cell) ---
|
|
153
|
-
{
|
|
154
|
-
type: CELL_ACTION_SECTION.type,
|
|
155
|
-
key: CELL_ACTION_SECTION.key,
|
|
156
|
-
parents: [{
|
|
157
|
-
type: CELL_MENU.type,
|
|
158
|
-
key: CELL_MENU.key,
|
|
159
|
-
rank: CELL_MENU_RANK[CELL_ACTION_SECTION.key]
|
|
160
|
-
}],
|
|
161
|
-
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, props.children)
|
|
162
|
-
}, {
|
|
163
|
-
type: VERTICAL_ALIGN_MENU.type,
|
|
164
|
-
key: VERTICAL_ALIGN_MENU.key,
|
|
165
|
-
parents: [{
|
|
166
|
-
type: CELL_ACTION_SECTION.type,
|
|
167
|
-
key: CELL_ACTION_SECTION.key,
|
|
168
|
-
rank: CELL_ACTION_SECTION_RANK[VERTICAL_ALIGN_MENU.key]
|
|
169
|
-
}],
|
|
170
|
-
component: props => /*#__PURE__*/React.createElement(VerticalAlignNestedMenu, null, props.children)
|
|
171
|
-
}, {
|
|
172
|
-
type: VERTICAL_ALIGN_MENU_SECTION.type,
|
|
173
|
-
key: VERTICAL_ALIGN_MENU_SECTION.key,
|
|
174
|
-
parents: [{
|
|
175
|
-
type: VERTICAL_ALIGN_MENU.type,
|
|
176
|
-
key: VERTICAL_ALIGN_MENU.key,
|
|
177
|
-
rank: VERTICAL_ALIGN_MENU_RANK[VERTICAL_ALIGN_MENU_SECTION.key]
|
|
178
|
-
}],
|
|
179
|
-
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, props.children)
|
|
180
|
-
}, {
|
|
181
|
-
type: VERTICAL_ALIGN_TOP_ITEM.type,
|
|
182
|
-
key: VERTICAL_ALIGN_TOP_ITEM.key,
|
|
183
|
-
parents: [{
|
|
184
|
-
type: VERTICAL_ALIGN_MENU_SECTION.type,
|
|
185
|
-
key: VERTICAL_ALIGN_MENU_SECTION.key,
|
|
186
|
-
rank: VERTICAL_ALIGN_MENU_SECTION_RANK[VERTICAL_ALIGN_TOP_ITEM.key]
|
|
187
|
-
}],
|
|
188
|
-
component: () => /*#__PURE__*/React.createElement(VerticalAlignDropdownItem, {
|
|
189
|
-
api: api,
|
|
190
|
-
icon: AlignPositionTopIcon,
|
|
191
|
-
label: messages.cellAlignmentTop,
|
|
192
|
-
value: "top"
|
|
193
|
-
})
|
|
194
|
-
}, {
|
|
195
|
-
type: VERTICAL_ALIGN_MIDDLE_ITEM.type,
|
|
196
|
-
key: VERTICAL_ALIGN_MIDDLE_ITEM.key,
|
|
197
|
-
parents: [{
|
|
198
|
-
type: VERTICAL_ALIGN_MENU_SECTION.type,
|
|
199
|
-
key: VERTICAL_ALIGN_MENU_SECTION.key,
|
|
200
|
-
rank: VERTICAL_ALIGN_MENU_SECTION_RANK[VERTICAL_ALIGN_MIDDLE_ITEM.key]
|
|
201
|
-
}],
|
|
202
|
-
component: () => /*#__PURE__*/React.createElement(VerticalAlignDropdownItem, {
|
|
203
|
-
api: api,
|
|
204
|
-
icon: AlignPositionCenterVerticalIcon,
|
|
205
|
-
label: messages.cellAlignmentMiddle,
|
|
206
|
-
value: "middle"
|
|
207
|
-
})
|
|
208
|
-
}, {
|
|
209
|
-
type: VERTICAL_ALIGN_BOTTOM_ITEM.type,
|
|
210
|
-
key: VERTICAL_ALIGN_BOTTOM_ITEM.key,
|
|
211
|
-
parents: [{
|
|
212
|
-
type: VERTICAL_ALIGN_MENU_SECTION.type,
|
|
213
|
-
key: VERTICAL_ALIGN_MENU_SECTION.key,
|
|
214
|
-
rank: VERTICAL_ALIGN_MENU_SECTION_RANK[VERTICAL_ALIGN_BOTTOM_ITEM.key]
|
|
215
|
-
}],
|
|
216
|
-
component: () => /*#__PURE__*/React.createElement(VerticalAlignDropdownItem, {
|
|
217
|
-
api: api,
|
|
218
|
-
icon: AlignPositionBottomIcon,
|
|
219
|
-
label: messages.cellAlignmentBottom,
|
|
220
|
-
value: "bottom"
|
|
221
|
-
})
|
|
222
|
-
}, {
|
|
223
|
-
type: MERGE_CELLS_ITEM.type,
|
|
224
|
-
key: MERGE_CELLS_ITEM.key,
|
|
225
|
-
parents: [{
|
|
226
|
-
type: CELL_ACTION_SECTION.type,
|
|
227
|
-
key: CELL_ACTION_SECTION.key,
|
|
228
|
-
rank: CELL_ACTION_SECTION_RANK[MERGE_CELLS_ITEM.key]
|
|
229
|
-
}],
|
|
230
|
-
component: () => /*#__PURE__*/React.createElement(MergeCellsItem, {
|
|
231
|
-
api: api
|
|
232
|
-
})
|
|
233
|
-
}, {
|
|
234
|
-
type: SPLIT_CELL_ITEM.type,
|
|
235
|
-
key: SPLIT_CELL_ITEM.key,
|
|
236
|
-
parents: [{
|
|
237
|
-
type: CELL_ACTION_SECTION.type,
|
|
238
|
-
key: CELL_ACTION_SECTION.key,
|
|
239
|
-
rank: CELL_ACTION_SECTION_RANK[SPLIT_CELL_ITEM.key]
|
|
240
|
-
}],
|
|
241
|
-
component: () => /*#__PURE__*/React.createElement(SplitCellItem, {
|
|
242
|
-
api: api
|
|
243
|
-
})
|
|
244
|
-
},
|
|
245
|
-
// --- Danger section (Clear cell) ---
|
|
246
131
|
{
|
|
247
132
|
type: CELL_DANGER_SECTION.type,
|
|
248
133
|
key: CELL_DANGER_SECTION.key,
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar/toolbar-dropdown-item-section';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
4
3
|
import { AddColumnLeftItem } from './items/AddColumnLeftItem';
|
|
5
|
-
import { AddColumnRightItem } from './items/AddColumnRightItem';
|
|
6
4
|
import { ColumnBackgroundSection } from './items/ColumnBackgroundSection';
|
|
7
5
|
import { ColumnToggleSection } from './items/ColumnToggleSection';
|
|
8
|
-
import { DeleteColumnItem } from './items/DeleteColumnItem';
|
|
9
|
-
import { DistributeColumnsItem } from './items/DistributeColumnsItem';
|
|
10
6
|
import { HeaderColumnToggleItem } from './items/HeaderColumnToggleItem';
|
|
11
7
|
import { MoveColumnLeftItem } from './items/MoveColumnLeftItem';
|
|
12
8
|
import { MoveColumnRightItem } from './items/MoveColumnRightItem';
|
|
13
9
|
import { SortDecreasingItem } from './items/SortDecreasingItem';
|
|
14
10
|
import { SortIncreasingItem } from './items/SortIncreasingItem';
|
|
15
|
-
import { COLUMN_MENU, COLUMN_TOGGLE_SECTION, COLUMN_BACKGROUND_SECTION, COLUMN_SORT_SECTION, COLUMN_ADD_SECTION, COLUMN_DANGER_SECTION, COLUMN_SECTION_RANK, HEADER_COLUMN_TOGGLE_ITEM, SORT_INCREASING_ITEM, SORT_DECREASING_ITEM, ADD_COLUMN_LEFT_ITEM,
|
|
11
|
+
import { COLUMN_MENU, COLUMN_TOGGLE_SECTION, COLUMN_BACKGROUND_SECTION, COLUMN_SORT_SECTION, COLUMN_ADD_SECTION, COLUMN_DANGER_SECTION, COLUMN_SECTION_RANK, HEADER_COLUMN_TOGGLE_ITEM, SORT_INCREASING_ITEM, SORT_DECREASING_ITEM, ADD_COLUMN_LEFT_ITEM, MOVE_COLUMN_LEFT_ITEM, MOVE_COLUMN_RIGHT_ITEM, COLUMN_TOGGLE_SECTION_RANK, COLUMN_SORT_SECTION_RANK, COLUMN_ADD_SECTION_RANK } from './keys';
|
|
16
12
|
export const getColumnMenuComponents = ({
|
|
17
13
|
api
|
|
18
|
-
}) =>
|
|
19
|
-
// --- Cell menu update ON ---
|
|
14
|
+
}) => [
|
|
20
15
|
// AddColumnRightItem/DistributeColumnsItem/DeleteColumnItem are registered in
|
|
21
16
|
// `../shared/getSharedItems` (shared with the cell menu), so they are omitted here.
|
|
22
17
|
|
|
@@ -155,175 +150,4 @@ export const getColumnMenuComponents = ({
|
|
|
155
150
|
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
156
151
|
hasSeparator: true
|
|
157
152
|
}, props.children)
|
|
158
|
-
}] : [
|
|
159
|
-
// --- Cell menu update OFF: legacy column menu (registers its own add/delete items) ---
|
|
160
|
-
|
|
161
|
-
// --- Menu surface ---
|
|
162
|
-
{
|
|
163
|
-
type: COLUMN_MENU.type,
|
|
164
|
-
key: COLUMN_MENU.key
|
|
165
|
-
},
|
|
166
|
-
// --- Toggle section (Header column) ---
|
|
167
|
-
{
|
|
168
|
-
type: COLUMN_TOGGLE_SECTION.type,
|
|
169
|
-
key: COLUMN_TOGGLE_SECTION.key,
|
|
170
|
-
parents: [{
|
|
171
|
-
type: COLUMN_MENU.type,
|
|
172
|
-
key: COLUMN_MENU.key,
|
|
173
|
-
rank: COLUMN_SECTION_RANK[COLUMN_TOGGLE_SECTION.key]
|
|
174
|
-
}],
|
|
175
|
-
component: props => /*#__PURE__*/React.createElement(ColumnToggleSection, {
|
|
176
|
-
api: api
|
|
177
|
-
}, props.children)
|
|
178
|
-
}, {
|
|
179
|
-
type: HEADER_COLUMN_TOGGLE_ITEM.type,
|
|
180
|
-
key: HEADER_COLUMN_TOGGLE_ITEM.key,
|
|
181
|
-
parents: [{
|
|
182
|
-
type: COLUMN_TOGGLE_SECTION.type,
|
|
183
|
-
key: COLUMN_TOGGLE_SECTION.key,
|
|
184
|
-
rank: COLUMN_TOGGLE_SECTION_RANK[HEADER_COLUMN_TOGGLE_ITEM.key]
|
|
185
|
-
}],
|
|
186
|
-
component: () => /*#__PURE__*/React.createElement(HeaderColumnToggleItem, {
|
|
187
|
-
api: api
|
|
188
|
-
})
|
|
189
|
-
},
|
|
190
|
-
// --- Background color section ---
|
|
191
|
-
{
|
|
192
|
-
type: COLUMN_BACKGROUND_SECTION.type,
|
|
193
|
-
key: COLUMN_BACKGROUND_SECTION.key,
|
|
194
|
-
parents: [{
|
|
195
|
-
type: COLUMN_MENU.type,
|
|
196
|
-
key: COLUMN_MENU.key,
|
|
197
|
-
rank: COLUMN_SECTION_RANK[COLUMN_BACKGROUND_SECTION.key]
|
|
198
|
-
}],
|
|
199
|
-
component: props => /*#__PURE__*/React.createElement(ColumnBackgroundSection, {
|
|
200
|
-
api: api
|
|
201
|
-
}, props.children)
|
|
202
|
-
},
|
|
203
|
-
// --- Sort section ---
|
|
204
|
-
{
|
|
205
|
-
type: COLUMN_SORT_SECTION.type,
|
|
206
|
-
key: COLUMN_SORT_SECTION.key,
|
|
207
|
-
parents: [{
|
|
208
|
-
type: COLUMN_MENU.type,
|
|
209
|
-
key: COLUMN_MENU.key,
|
|
210
|
-
rank: COLUMN_SECTION_RANK[COLUMN_SORT_SECTION.key]
|
|
211
|
-
}],
|
|
212
|
-
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
213
|
-
hasSeparator: true
|
|
214
|
-
}, props.children)
|
|
215
|
-
}, {
|
|
216
|
-
type: SORT_INCREASING_ITEM.type,
|
|
217
|
-
key: SORT_INCREASING_ITEM.key,
|
|
218
|
-
parents: [{
|
|
219
|
-
type: COLUMN_SORT_SECTION.type,
|
|
220
|
-
key: COLUMN_SORT_SECTION.key,
|
|
221
|
-
rank: COLUMN_SORT_SECTION_RANK[SORT_INCREASING_ITEM.key]
|
|
222
|
-
}],
|
|
223
|
-
component: () => /*#__PURE__*/React.createElement(SortIncreasingItem, {
|
|
224
|
-
api: api
|
|
225
|
-
})
|
|
226
|
-
}, {
|
|
227
|
-
type: SORT_DECREASING_ITEM.type,
|
|
228
|
-
key: SORT_DECREASING_ITEM.key,
|
|
229
|
-
parents: [{
|
|
230
|
-
type: COLUMN_SORT_SECTION.type,
|
|
231
|
-
key: COLUMN_SORT_SECTION.key,
|
|
232
|
-
rank: COLUMN_SORT_SECTION_RANK[SORT_DECREASING_ITEM.key]
|
|
233
|
-
}],
|
|
234
|
-
component: () => /*#__PURE__*/React.createElement(SortDecreasingItem, {
|
|
235
|
-
api: api
|
|
236
|
-
})
|
|
237
|
-
},
|
|
238
|
-
// --- Add / Move section ---
|
|
239
|
-
{
|
|
240
|
-
type: COLUMN_ADD_SECTION.type,
|
|
241
|
-
key: COLUMN_ADD_SECTION.key,
|
|
242
|
-
parents: [{
|
|
243
|
-
type: COLUMN_MENU.type,
|
|
244
|
-
key: COLUMN_MENU.key,
|
|
245
|
-
rank: COLUMN_SECTION_RANK[COLUMN_ADD_SECTION.key]
|
|
246
|
-
}],
|
|
247
|
-
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
248
|
-
hasSeparator: true
|
|
249
|
-
}, props.children)
|
|
250
|
-
}, {
|
|
251
|
-
type: ADD_COLUMN_LEFT_ITEM.type,
|
|
252
|
-
key: ADD_COLUMN_LEFT_ITEM.key,
|
|
253
|
-
parents: [{
|
|
254
|
-
type: COLUMN_ADD_SECTION.type,
|
|
255
|
-
key: COLUMN_ADD_SECTION.key,
|
|
256
|
-
rank: COLUMN_ADD_SECTION_RANK[ADD_COLUMN_LEFT_ITEM.key]
|
|
257
|
-
}],
|
|
258
|
-
component: () => /*#__PURE__*/React.createElement(AddColumnLeftItem, {
|
|
259
|
-
api: api
|
|
260
|
-
})
|
|
261
|
-
}, {
|
|
262
|
-
type: ADD_COLUMN_RIGHT_ITEM.type,
|
|
263
|
-
key: ADD_COLUMN_RIGHT_ITEM.key,
|
|
264
|
-
parents: [{
|
|
265
|
-
type: COLUMN_ADD_SECTION.type,
|
|
266
|
-
key: COLUMN_ADD_SECTION.key,
|
|
267
|
-
rank: COLUMN_ADD_SECTION_RANK[ADD_COLUMN_RIGHT_ITEM.key]
|
|
268
|
-
}],
|
|
269
|
-
component: () => /*#__PURE__*/React.createElement(AddColumnRightItem, {
|
|
270
|
-
api: api
|
|
271
|
-
})
|
|
272
|
-
}, {
|
|
273
|
-
type: MOVE_COLUMN_LEFT_ITEM.type,
|
|
274
|
-
key: MOVE_COLUMN_LEFT_ITEM.key,
|
|
275
|
-
parents: [{
|
|
276
|
-
type: COLUMN_ADD_SECTION.type,
|
|
277
|
-
key: COLUMN_ADD_SECTION.key,
|
|
278
|
-
rank: COLUMN_ADD_SECTION_RANK[MOVE_COLUMN_LEFT_ITEM.key]
|
|
279
|
-
}],
|
|
280
|
-
component: () => /*#__PURE__*/React.createElement(MoveColumnLeftItem, {
|
|
281
|
-
api: api
|
|
282
|
-
})
|
|
283
|
-
}, {
|
|
284
|
-
type: MOVE_COLUMN_RIGHT_ITEM.type,
|
|
285
|
-
key: MOVE_COLUMN_RIGHT_ITEM.key,
|
|
286
|
-
parents: [{
|
|
287
|
-
type: COLUMN_ADD_SECTION.type,
|
|
288
|
-
key: COLUMN_ADD_SECTION.key,
|
|
289
|
-
rank: COLUMN_ADD_SECTION_RANK[MOVE_COLUMN_RIGHT_ITEM.key]
|
|
290
|
-
}],
|
|
291
|
-
component: () => /*#__PURE__*/React.createElement(MoveColumnRightItem, {
|
|
292
|
-
api: api
|
|
293
|
-
})
|
|
294
|
-
}, {
|
|
295
|
-
type: DISTRIBUTE_COLUMNS_ITEM.type,
|
|
296
|
-
key: DISTRIBUTE_COLUMNS_ITEM.key,
|
|
297
|
-
parents: [{
|
|
298
|
-
type: COLUMN_ADD_SECTION.type,
|
|
299
|
-
key: COLUMN_ADD_SECTION.key,
|
|
300
|
-
rank: COLUMN_ADD_SECTION_RANK[DISTRIBUTE_COLUMNS_ITEM.key]
|
|
301
|
-
}],
|
|
302
|
-
component: () => /*#__PURE__*/React.createElement(DistributeColumnsItem, {
|
|
303
|
-
api: api
|
|
304
|
-
})
|
|
305
|
-
},
|
|
306
|
-
// --- Danger section (Clear cells, Delete column) ---
|
|
307
|
-
{
|
|
308
|
-
type: COLUMN_DANGER_SECTION.type,
|
|
309
|
-
key: COLUMN_DANGER_SECTION.key,
|
|
310
|
-
parents: [{
|
|
311
|
-
type: COLUMN_MENU.type,
|
|
312
|
-
key: COLUMN_MENU.key,
|
|
313
|
-
rank: COLUMN_SECTION_RANK[COLUMN_DANGER_SECTION.key]
|
|
314
|
-
}],
|
|
315
|
-
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
316
|
-
hasSeparator: true
|
|
317
|
-
}, props.children)
|
|
318
|
-
}, {
|
|
319
|
-
type: DELETE_COLUMN_ITEM.type,
|
|
320
|
-
key: DELETE_COLUMN_ITEM.key,
|
|
321
|
-
parents: [{
|
|
322
|
-
type: COLUMN_DANGER_SECTION.type,
|
|
323
|
-
key: COLUMN_DANGER_SECTION.key,
|
|
324
|
-
rank: COLUMN_DANGER_SECTION_RANK[DELETE_COLUMN_ITEM.key]
|
|
325
|
-
}],
|
|
326
|
-
component: () => /*#__PURE__*/React.createElement(DeleteColumnItem, {
|
|
327
|
-
api: api
|
|
328
|
-
})
|
|
329
153
|
}];
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar/toolbar-dropdown-item-section';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
4
3
|
import { AddRowAboveItem } from './items/AddRowAboveItem';
|
|
5
|
-
import { AddRowBelowItem } from './items/AddRowBelowItem';
|
|
6
|
-
import { DeleteRowItem } from './items/DeleteRowItem';
|
|
7
4
|
import { HeaderRowToggleItem } from './items/HeaderRowToggleItem';
|
|
8
5
|
import { MoveRowDownItem } from './items/MoveRowDownItem';
|
|
9
6
|
import { MoveRowUpItem } from './items/MoveRowUpItem';
|
|
10
7
|
import { NumberedRowsToggleItem } from './items/NumberedRowsToggleItem';
|
|
11
|
-
import { ROW_MENU, ROW_TOGGLE_SECTION, ROW_BACKGROUND_SECTION, ROW_ADD_SECTION, ROW_DANGER_SECTION, ROW_MENU_SECTION_RANK, HEADER_ROW_TOGGLE_ITEM, NUMBERED_ROWS_TOGGLE_ITEM, ADD_ROW_ABOVE_ITEM,
|
|
8
|
+
import { ROW_MENU, ROW_TOGGLE_SECTION, ROW_BACKGROUND_SECTION, ROW_ADD_SECTION, ROW_DANGER_SECTION, ROW_MENU_SECTION_RANK, HEADER_ROW_TOGGLE_ITEM, NUMBERED_ROWS_TOGGLE_ITEM, ADD_ROW_ABOVE_ITEM, MOVE_ROW_UP_ITEM, MOVE_ROW_DOWN_ITEM, ROW_TOGGLE_SECTION_RANK, ROW_ADD_SECTION_RANK } from './keys';
|
|
12
9
|
export const getRowMenuComponents = ({
|
|
13
10
|
api
|
|
14
|
-
}) =>
|
|
15
|
-
// --- Cell menu update ON ---
|
|
11
|
+
}) => [
|
|
16
12
|
// AddRowBelowItem/DeleteRowItem are registered in `../shared/getSharedItems`
|
|
17
13
|
// (shared with the cell menu), so they are omitted here.
|
|
18
14
|
|
|
@@ -125,138 +121,4 @@ export const getRowMenuComponents = ({
|
|
|
125
121
|
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
126
122
|
hasSeparator: true
|
|
127
123
|
}, props.children)
|
|
128
|
-
}] : [
|
|
129
|
-
// --- Cell menu update OFF: legacy row menu (registers its own add/delete items) ---
|
|
130
|
-
|
|
131
|
-
// --- Menu surface ---
|
|
132
|
-
{
|
|
133
|
-
type: ROW_MENU.type,
|
|
134
|
-
key: ROW_MENU.key
|
|
135
|
-
},
|
|
136
|
-
// --- Toggle section (Header row, Numbered rows) ---
|
|
137
|
-
{
|
|
138
|
-
type: ROW_TOGGLE_SECTION.type,
|
|
139
|
-
key: ROW_TOGGLE_SECTION.key,
|
|
140
|
-
parents: [{
|
|
141
|
-
type: ROW_MENU.type,
|
|
142
|
-
key: ROW_MENU.key,
|
|
143
|
-
rank: ROW_MENU_SECTION_RANK[ROW_TOGGLE_SECTION.key]
|
|
144
|
-
}],
|
|
145
|
-
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, props.children)
|
|
146
|
-
}, {
|
|
147
|
-
type: HEADER_ROW_TOGGLE_ITEM.type,
|
|
148
|
-
key: HEADER_ROW_TOGGLE_ITEM.key,
|
|
149
|
-
parents: [{
|
|
150
|
-
type: ROW_TOGGLE_SECTION.type,
|
|
151
|
-
key: ROW_TOGGLE_SECTION.key,
|
|
152
|
-
rank: ROW_TOGGLE_SECTION_RANK[HEADER_ROW_TOGGLE_ITEM.key]
|
|
153
|
-
}],
|
|
154
|
-
component: () => /*#__PURE__*/React.createElement(HeaderRowToggleItem, {
|
|
155
|
-
api: api
|
|
156
|
-
})
|
|
157
|
-
}, {
|
|
158
|
-
type: NUMBERED_ROWS_TOGGLE_ITEM.type,
|
|
159
|
-
key: NUMBERED_ROWS_TOGGLE_ITEM.key,
|
|
160
|
-
parents: [{
|
|
161
|
-
type: ROW_TOGGLE_SECTION.type,
|
|
162
|
-
key: ROW_TOGGLE_SECTION.key,
|
|
163
|
-
rank: ROW_TOGGLE_SECTION_RANK[NUMBERED_ROWS_TOGGLE_ITEM.key]
|
|
164
|
-
}],
|
|
165
|
-
component: () => /*#__PURE__*/React.createElement(NumberedRowsToggleItem, {
|
|
166
|
-
api: api
|
|
167
|
-
})
|
|
168
|
-
},
|
|
169
|
-
// --- Background color section ---
|
|
170
|
-
{
|
|
171
|
-
type: ROW_BACKGROUND_SECTION.type,
|
|
172
|
-
key: ROW_BACKGROUND_SECTION.key,
|
|
173
|
-
parents: [{
|
|
174
|
-
type: ROW_MENU.type,
|
|
175
|
-
key: ROW_MENU.key,
|
|
176
|
-
rank: ROW_MENU_SECTION_RANK[ROW_BACKGROUND_SECTION.key]
|
|
177
|
-
}],
|
|
178
|
-
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
179
|
-
hasSeparator: true
|
|
180
|
-
}, props.children)
|
|
181
|
-
},
|
|
182
|
-
// --- Add / Move section ---
|
|
183
|
-
{
|
|
184
|
-
type: ROW_ADD_SECTION.type,
|
|
185
|
-
key: ROW_ADD_SECTION.key,
|
|
186
|
-
parents: [{
|
|
187
|
-
type: ROW_MENU.type,
|
|
188
|
-
key: ROW_MENU.key,
|
|
189
|
-
rank: ROW_MENU_SECTION_RANK[ROW_ADD_SECTION.key]
|
|
190
|
-
}],
|
|
191
|
-
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
192
|
-
hasSeparator: true
|
|
193
|
-
}, props.children)
|
|
194
|
-
}, {
|
|
195
|
-
type: ADD_ROW_ABOVE_ITEM.type,
|
|
196
|
-
key: ADD_ROW_ABOVE_ITEM.key,
|
|
197
|
-
parents: [{
|
|
198
|
-
type: ROW_ADD_SECTION.type,
|
|
199
|
-
key: ROW_ADD_SECTION.key,
|
|
200
|
-
rank: ROW_ADD_SECTION_RANK[ADD_ROW_ABOVE_ITEM.key]
|
|
201
|
-
}],
|
|
202
|
-
component: () => /*#__PURE__*/React.createElement(AddRowAboveItem, {
|
|
203
|
-
api: api
|
|
204
|
-
})
|
|
205
|
-
}, {
|
|
206
|
-
type: ADD_ROW_BELOW_ITEM.type,
|
|
207
|
-
key: ADD_ROW_BELOW_ITEM.key,
|
|
208
|
-
parents: [{
|
|
209
|
-
type: ROW_ADD_SECTION.type,
|
|
210
|
-
key: ROW_ADD_SECTION.key,
|
|
211
|
-
rank: ROW_ADD_SECTION_RANK[ADD_ROW_BELOW_ITEM.key]
|
|
212
|
-
}],
|
|
213
|
-
component: () => /*#__PURE__*/React.createElement(AddRowBelowItem, {
|
|
214
|
-
api: api
|
|
215
|
-
})
|
|
216
|
-
}, {
|
|
217
|
-
type: MOVE_ROW_UP_ITEM.type,
|
|
218
|
-
key: MOVE_ROW_UP_ITEM.key,
|
|
219
|
-
parents: [{
|
|
220
|
-
type: ROW_ADD_SECTION.type,
|
|
221
|
-
key: ROW_ADD_SECTION.key,
|
|
222
|
-
rank: ROW_ADD_SECTION_RANK[MOVE_ROW_UP_ITEM.key]
|
|
223
|
-
}],
|
|
224
|
-
component: () => /*#__PURE__*/React.createElement(MoveRowUpItem, {
|
|
225
|
-
api: api
|
|
226
|
-
})
|
|
227
|
-
}, {
|
|
228
|
-
type: MOVE_ROW_DOWN_ITEM.type,
|
|
229
|
-
key: MOVE_ROW_DOWN_ITEM.key,
|
|
230
|
-
parents: [{
|
|
231
|
-
type: ROW_ADD_SECTION.type,
|
|
232
|
-
key: ROW_ADD_SECTION.key,
|
|
233
|
-
rank: ROW_ADD_SECTION_RANK[MOVE_ROW_DOWN_ITEM.key]
|
|
234
|
-
}],
|
|
235
|
-
component: () => /*#__PURE__*/React.createElement(MoveRowDownItem, {
|
|
236
|
-
api: api
|
|
237
|
-
})
|
|
238
|
-
},
|
|
239
|
-
// --- Danger section (Clear cells, Delete row) ---
|
|
240
|
-
{
|
|
241
|
-
type: ROW_DANGER_SECTION.type,
|
|
242
|
-
key: ROW_DANGER_SECTION.key,
|
|
243
|
-
parents: [{
|
|
244
|
-
type: ROW_MENU.type,
|
|
245
|
-
key: ROW_MENU.key,
|
|
246
|
-
rank: ROW_MENU_SECTION_RANK[ROW_DANGER_SECTION.key]
|
|
247
|
-
}],
|
|
248
|
-
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
249
|
-
hasSeparator: true
|
|
250
|
-
}, props.children)
|
|
251
|
-
}, {
|
|
252
|
-
type: DELETE_ROW_ITEM.type,
|
|
253
|
-
key: DELETE_ROW_ITEM.key,
|
|
254
|
-
parents: [{
|
|
255
|
-
type: ROW_DANGER_SECTION.type,
|
|
256
|
-
key: ROW_DANGER_SECTION.key,
|
|
257
|
-
rank: ROW_DANGER_SECTION_RANK[DELETE_ROW_ITEM.key]
|
|
258
|
-
}],
|
|
259
|
-
component: () => /*#__PURE__*/React.createElement(DeleteRowItem, {
|
|
260
|
-
api: api
|
|
261
|
-
})
|
|
262
124
|
}];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
3
2
|
import { CELL_ACTION_SECTION, CELL_ADD_SECTION, CELL_DANGER_SECTION, CELL_ACTION_SECTION_RANK, CELL_ADD_SECTION_RANK, CELL_DANGER_SECTION_RANK } from '../cell/keys';
|
|
4
3
|
import { AddColumnRightItem } from '../column/items/AddColumnRightItem';
|
|
5
4
|
import { DeleteColumnItem } from '../column/items/DeleteColumnItem';
|
|
@@ -13,9 +12,8 @@ import { ClearCellsItem } from './items/ClearCellsItem';
|
|
|
13
12
|
import { BACKGROUND_COLOR_ITEM, CLEAR_CELLS_ITEM } from './keys';
|
|
14
13
|
export const getSharedItems = ({
|
|
15
14
|
api
|
|
16
|
-
}) =>
|
|
17
|
-
//
|
|
18
|
-
// The add/delete items move out of the row/column menu files and are registered here
|
|
15
|
+
}) => [
|
|
16
|
+
// The add/delete items are registered here rather than in the row/column menu files,
|
|
19
17
|
// once with an additional cell parent, so they render inside the cell menu too.
|
|
20
18
|
{
|
|
21
19
|
type: BACKGROUND_COLOR_ITEM.type,
|
|
@@ -130,45 +128,4 @@ export const getSharedItems = ({
|
|
|
130
128
|
component: () => /*#__PURE__*/React.createElement(DeleteRowItem, {
|
|
131
129
|
api: api
|
|
132
130
|
})
|
|
133
|
-
}] : [
|
|
134
|
-
// --- Cell menu update OFF: legacy shared items (background color + clear cells only).
|
|
135
|
-
// The add/delete items are registered by the row/column menu files in this mode.
|
|
136
|
-
{
|
|
137
|
-
type: BACKGROUND_COLOR_ITEM.type,
|
|
138
|
-
key: BACKGROUND_COLOR_ITEM.key,
|
|
139
|
-
parents: [{
|
|
140
|
-
type: ROW_BACKGROUND_SECTION.type,
|
|
141
|
-
key: ROW_BACKGROUND_SECTION.key,
|
|
142
|
-
rank: ROW_BACKGROUND_SECTION_RANK[BACKGROUND_COLOR_ITEM.key]
|
|
143
|
-
}, {
|
|
144
|
-
type: COLUMN_BACKGROUND_SECTION.type,
|
|
145
|
-
key: COLUMN_BACKGROUND_SECTION.key,
|
|
146
|
-
rank: COLUMN_BACKGROUND_SECTION_RANK[BACKGROUND_COLOR_ITEM.key]
|
|
147
|
-
}, {
|
|
148
|
-
type: CELL_ACTION_SECTION.type,
|
|
149
|
-
key: CELL_ACTION_SECTION.key,
|
|
150
|
-
rank: CELL_ACTION_SECTION_RANK[BACKGROUND_COLOR_ITEM.key]
|
|
151
|
-
}],
|
|
152
|
-
component: () => /*#__PURE__*/React.createElement(BackgroundColorItem, {
|
|
153
|
-
api: api
|
|
154
|
-
})
|
|
155
|
-
}, {
|
|
156
|
-
type: CLEAR_CELLS_ITEM.type,
|
|
157
|
-
key: CLEAR_CELLS_ITEM.key,
|
|
158
|
-
parents: [{
|
|
159
|
-
type: ROW_DANGER_SECTION.type,
|
|
160
|
-
key: ROW_DANGER_SECTION.key,
|
|
161
|
-
rank: ROW_DANGER_SECTION_RANK[CLEAR_CELLS_ITEM.key]
|
|
162
|
-
}, {
|
|
163
|
-
type: COLUMN_DANGER_SECTION.type,
|
|
164
|
-
key: COLUMN_DANGER_SECTION.key,
|
|
165
|
-
rank: COLUMN_DANGER_SECTION_RANK[CLEAR_CELLS_ITEM.key]
|
|
166
|
-
}, {
|
|
167
|
-
type: CELL_DANGER_SECTION.type,
|
|
168
|
-
key: CELL_DANGER_SECTION.key,
|
|
169
|
-
rank: CELL_DANGER_SECTION_RANK[CLEAR_CELLS_ITEM.key]
|
|
170
|
-
}],
|
|
171
|
-
component: () => /*#__PURE__*/React.createElement(ClearCellsItem, {
|
|
172
|
-
api: api
|
|
173
|
-
})
|
|
174
131
|
}];
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { findCellRectClosestToPos } from '@atlaskit/editor-tables/utils';
|
|
2
2
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils/get-selection-rect';
|
|
3
3
|
import { isSelectionType } from '@atlaskit/editor-tables/utils/is-selection-type';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Resolve the table `Rect` for the current selection. Falls back to the closest cell's rect
|
|
8
|
-
* for a `TextSelection` (cell menu), where `getSelectionRect` returns `undefined`.
|
|
9
|
-
* with the gate off this behaves exactly like `getSelectionRect`.
|
|
7
|
+
* for a `TextSelection` (cell menu), where `getSelectionRect` returns `undefined`.
|
|
10
8
|
*/
|
|
11
|
-
export const getMenuSelectionRect = selection =>
|
|
12
|
-
if (!fg('platform_editor_table_cell_menu_update')) {
|
|
13
|
-
return getSelectionRect(selection);
|
|
14
|
-
}
|
|
15
|
-
return isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
16
|
-
};
|
|
9
|
+
export const getMenuSelectionRect = selection => isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|