@atlaskit/editor-plugin-table 7.11.3 → 7.11.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 +1726 -700
- package/dist/cjs/commands/column-resize.js +5 -1
- package/dist/cjs/nodeviews/TableComponent.js +31 -6
- package/dist/cjs/nodeviews/table.js +31 -14
- package/dist/cjs/plugin.js +8 -9
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +6 -1
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +16 -10
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +7 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +16 -11
- package/dist/cjs/pm-plugins/table-width.js +1 -5
- package/dist/cjs/pm-plugins/view-mode-sort/utils.js +37 -20
- package/dist/cjs/toolbar.js +12 -21
- package/dist/cjs/transforms/column-width.js +3 -0
- package/dist/cjs/ui/FloatingDragMenu/index.js +2 -5
- package/dist/cjs/ui/common-styles.js +8 -16
- package/dist/cjs/ui/ui-styles.js +18 -36
- package/dist/es2019/commands/column-resize.js +6 -2
- package/dist/es2019/nodeviews/TableComponent.js +33 -7
- package/dist/es2019/nodeviews/table.js +32 -15
- package/dist/es2019/plugin.js +8 -9
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +6 -1
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +13 -7
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +7 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +16 -11
- package/dist/es2019/pm-plugins/table-width.js +1 -5
- package/dist/es2019/pm-plugins/view-mode-sort/utils.js +36 -21
- package/dist/es2019/toolbar.js +7 -16
- package/dist/es2019/transforms/column-width.js +4 -1
- package/dist/es2019/ui/FloatingDragMenu/index.js +2 -5
- package/dist/es2019/ui/common-styles.js +18 -30
- package/dist/es2019/ui/ui-styles.js +88 -174
- package/dist/esm/commands/column-resize.js +5 -1
- package/dist/esm/nodeviews/TableComponent.js +31 -6
- package/dist/esm/nodeviews/table.js +31 -14
- package/dist/esm/plugin.js +8 -9
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +6 -1
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +16 -10
- package/dist/esm/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +7 -2
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +16 -11
- package/dist/esm/pm-plugins/table-width.js +1 -5
- package/dist/esm/pm-plugins/view-mode-sort/utils.js +37 -20
- package/dist/esm/toolbar.js +12 -21
- package/dist/esm/transforms/column-width.js +3 -0
- package/dist/esm/ui/FloatingDragMenu/index.js +2 -5
- package/dist/esm/ui/common-styles.js +8 -16
- package/dist/esm/ui/ui-styles.js +18 -36
- package/dist/types/pm-plugins/table-resizing/event-handlers.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/plugin.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +3 -3
- package/dist/types/pm-plugins/table-width.d.ts +1 -1
- package/dist/types/pm-plugins/view-mode-sort/utils.d.ts +3 -1
- package/dist/types/ui/FloatingDragMenu/index.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/event-handlers.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/plugin.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +3 -3
- package/dist/types-ts4.5/pm-plugins/table-width.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/view-mode-sort/utils.d.ts +3 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +2 -1
- package/package.json +2 -5
- package/src/commands/column-resize.ts +11 -2
- package/src/nodeviews/TableComponent.tsx +79 -9
- package/src/nodeviews/table.tsx +49 -26
- package/src/plugin.tsx +10 -4
- package/src/pm-plugins/drag-and-drop/plugin.ts +14 -1
- package/src/pm-plugins/table-resizing/event-handlers.ts +26 -4
- package/src/pm-plugins/table-resizing/plugin.ts +2 -0
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +13 -2
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +24 -10
- package/src/pm-plugins/table-width.ts +1 -3
- package/src/pm-plugins/view-mode-sort/utils.ts +49 -23
- package/src/toolbar.tsx +7 -11
- package/src/transforms/column-width.ts +8 -1
- package/src/ui/FloatingDragMenu/index.tsx +2 -3
- package/src/ui/common-styles.ts +18 -30
- package/src/ui/ui-styles.ts +92 -183
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { SortOrder } from '@atlaskit/editor-common/types';
|
|
2
|
+
import {
|
|
3
|
+
convertProsemirrorTableNodeToArrayOfRows,
|
|
4
|
+
createCompareNodes,
|
|
5
|
+
} from '@atlaskit/editor-common/utils';
|
|
6
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
8
|
|
|
4
9
|
import {
|
|
@@ -21,30 +26,42 @@ export const unsort = (
|
|
|
21
26
|
});
|
|
22
27
|
};
|
|
23
28
|
|
|
24
|
-
// TODO - reuse sort logic from the Renderer and support switching between ASC, DESC and NO_ORDER
|
|
25
29
|
export const getSortOrderFromTable = (
|
|
26
|
-
|
|
30
|
+
tableNode: PMNode,
|
|
27
31
|
sortIndex: number,
|
|
28
|
-
direction:
|
|
32
|
+
direction: SortOrder,
|
|
29
33
|
) => {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
const tableArray = convertProsemirrorTableNodeToArrayOfRows(tableNode);
|
|
35
|
+
tableArray.shift(); // remove header row
|
|
36
|
+
|
|
37
|
+
// Keep track of the origin row index
|
|
38
|
+
const tableArrayWithIndex = tableArray.map((node, index) => ({
|
|
39
|
+
node,
|
|
40
|
+
originalIndex: index,
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
const compareNodesInOrder = createCompareNodes(
|
|
44
|
+
{
|
|
45
|
+
// TODO - add inline card support
|
|
46
|
+
getInlineCardTextFromStore() {
|
|
47
|
+
return null;
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
direction,
|
|
51
|
+
);
|
|
52
|
+
const order = tableArrayWithIndex
|
|
38
53
|
.sort((a, b) => {
|
|
39
|
-
|
|
40
|
-
return string.localeCompare(strings[b] || '') * sortOrder;
|
|
54
|
+
return compareNodesInOrder(a.node[sortIndex], b.node[sortIndex]);
|
|
41
55
|
})
|
|
42
|
-
.map((
|
|
43
|
-
value,
|
|
56
|
+
.map((tableRow, index) => ({
|
|
57
|
+
value: tableRow.originalIndex,
|
|
44
58
|
index,
|
|
45
59
|
}));
|
|
46
|
-
|
|
47
|
-
|
|
60
|
+
return [
|
|
61
|
+
// Ensures the first tr is always first in the order
|
|
62
|
+
{ value: -1, index: -1 },
|
|
63
|
+
...order,
|
|
64
|
+
];
|
|
48
65
|
};
|
|
49
66
|
|
|
50
67
|
export const toggleSort = (
|
|
@@ -52,20 +69,29 @@ export const toggleSort = (
|
|
|
52
69
|
event: Event,
|
|
53
70
|
pluginState: TableSortMeta,
|
|
54
71
|
) => {
|
|
55
|
-
const target = event.target
|
|
72
|
+
const target = event.target;
|
|
73
|
+
if (!(target instanceof HTMLElement)) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
56
76
|
const widget = target.closest(`.${SORTING_ICON_CLASS_NAME}`);
|
|
57
77
|
if (widget?.classList.contains(IS_DISABLED_CLASS_NAME) || !widget) {
|
|
58
78
|
return;
|
|
59
79
|
}
|
|
60
|
-
let
|
|
80
|
+
let dataSortIndex = target
|
|
61
81
|
?.closest('.ProseMirror-widget')
|
|
62
82
|
?.getAttribute(SORT_INDEX_DATA_ATTRIBUTE);
|
|
63
83
|
const tr = view.state.tr;
|
|
64
84
|
const tableElement = target.closest('table');
|
|
65
|
-
if (!tableElement || !
|
|
85
|
+
if (!tableElement || !dataSortIndex) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const tablePos = view.posAtDOM(tableElement, 0);
|
|
89
|
+
const tableNode = view.state.doc.nodeAt(tablePos - 1);
|
|
90
|
+
const tableId = tableNode?.attrs.localId;
|
|
91
|
+
|
|
92
|
+
if (!tableId || !tableNode || tableNode?.type?.name !== 'table') {
|
|
66
93
|
return;
|
|
67
94
|
}
|
|
68
|
-
const tableId = tableElement.getAttribute('data-table-local-id') || '';
|
|
69
95
|
|
|
70
96
|
let { index, direction, order: oldOrder } = pluginState?.[tableId] || {};
|
|
71
97
|
|
|
@@ -74,7 +100,7 @@ export const toggleSort = (
|
|
|
74
100
|
unsort(oldOrder, tableElement);
|
|
75
101
|
}
|
|
76
102
|
|
|
77
|
-
const sortIndex = parseInt(
|
|
103
|
+
const sortIndex = parseInt(dataSortIndex);
|
|
78
104
|
if (sortIndex === index) {
|
|
79
105
|
switch (direction) {
|
|
80
106
|
case SortOrder.NO_ORDER:
|
|
@@ -91,7 +117,7 @@ export const toggleSort = (
|
|
|
91
117
|
direction = SortOrder.ASC; // default direction when a new index is clicked
|
|
92
118
|
}
|
|
93
119
|
|
|
94
|
-
const order = getSortOrderFromTable(
|
|
120
|
+
const order = getSortOrderFromTable(tableNode, sortIndex, direction);
|
|
95
121
|
|
|
96
122
|
if (direction === SortOrder.NO_ORDER) {
|
|
97
123
|
tr.setMeta('tableSortMeta', {
|
package/src/toolbar.tsx
CHANGED
|
@@ -466,11 +466,11 @@ export const getToolbarConfig =
|
|
|
466
466
|
// We don't want to show floating toolbar while resizing the table
|
|
467
467
|
const isWidthResizing = tableWidthState?.resizing;
|
|
468
468
|
|
|
469
|
-
const {
|
|
469
|
+
const { widthToWidest } = pluginState;
|
|
470
470
|
const currentTableNodeLocalId = tableObject?.node?.attrs?.localId ?? '';
|
|
471
471
|
|
|
472
472
|
if (
|
|
473
|
-
isTableScalingEnabled &&
|
|
473
|
+
options?.isTableScalingEnabled &&
|
|
474
474
|
isWidthResizing &&
|
|
475
475
|
widthToWidest &&
|
|
476
476
|
currentTableNodeLocalId &&
|
|
@@ -531,8 +531,6 @@ export const getToolbarConfig =
|
|
|
531
531
|
editorAnalyticsAPI,
|
|
532
532
|
);
|
|
533
533
|
|
|
534
|
-
const { isTableScalingEnabled = false } = getPluginState(state); // TODO ED-21670: check if we need options.isTableScalingEnabled and not an acutual state of displayNode attr on the table
|
|
535
|
-
|
|
536
534
|
let cellItems: Array<FloatingToolbarItem<Command>>;
|
|
537
535
|
cellItems = pluginState.isDragAndDropEnabled
|
|
538
536
|
? []
|
|
@@ -542,7 +540,7 @@ export const getToolbarConfig =
|
|
|
542
540
|
intl,
|
|
543
541
|
getEditorContainerWidth,
|
|
544
542
|
editorAnalyticsAPI,
|
|
545
|
-
isTableScalingEnabled,
|
|
543
|
+
options?.isTableScalingEnabled,
|
|
546
544
|
);
|
|
547
545
|
|
|
548
546
|
let columnSettingsItems;
|
|
@@ -553,8 +551,7 @@ export const getToolbarConfig =
|
|
|
553
551
|
intl,
|
|
554
552
|
getEditorContainerWidth,
|
|
555
553
|
editorAnalyticsAPI,
|
|
556
|
-
options,
|
|
557
|
-
isTableScalingEnabled,
|
|
554
|
+
options?.isTableScalingEnabled,
|
|
558
555
|
)
|
|
559
556
|
: [];
|
|
560
557
|
const colorPicker = getColorPicker(
|
|
@@ -740,7 +737,6 @@ const getColumnSettingItems = (
|
|
|
740
737
|
{ formatMessage }: ToolbarMenuContext,
|
|
741
738
|
getEditorContainerWidth: GetEditorContainerWidth,
|
|
742
739
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
743
|
-
options: TablePluginOptions | undefined,
|
|
744
740
|
isTableScalingEnabled = false,
|
|
745
741
|
): Array<FloatingToolbarItem<Command>> => {
|
|
746
742
|
const pluginState = getPluginState(editorState);
|
|
@@ -755,7 +751,7 @@ const getColumnSettingItems = (
|
|
|
755
751
|
editorState,
|
|
756
752
|
editorView.domAtPos.bind(editorView),
|
|
757
753
|
getEditorContainerWidth,
|
|
758
|
-
isTableScalingEnabled,
|
|
754
|
+
isTableScalingEnabled,
|
|
759
755
|
);
|
|
760
756
|
|
|
761
757
|
const wouldChange = newResizeStateWithAnalytics?.changed ?? false;
|
|
@@ -763,7 +759,7 @@ const getColumnSettingItems = (
|
|
|
763
759
|
const items: Array<FloatingToolbarItem<Command>> = [];
|
|
764
760
|
|
|
765
761
|
const isTableScalingLockBtnEnabled =
|
|
766
|
-
|
|
762
|
+
isTableScalingEnabled &&
|
|
767
763
|
getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
|
|
768
764
|
|
|
769
765
|
if (isTableScalingLockBtnEnabled) {
|
|
@@ -798,7 +794,7 @@ const getColumnSettingItems = (
|
|
|
798
794
|
getDistributeConfig(
|
|
799
795
|
getEditorContainerWidth,
|
|
800
796
|
editorAnalyticsAPI,
|
|
801
|
-
isTableScalingEnabled,
|
|
797
|
+
isTableScalingEnabled,
|
|
802
798
|
)(state, dispatch, view),
|
|
803
799
|
disabled: !wouldChange,
|
|
804
800
|
});
|
|
@@ -143,7 +143,14 @@ export const rescaleColumns =
|
|
|
143
143
|
};
|
|
144
144
|
|
|
145
145
|
const tableDepth = view.state.doc.resolve(table.pos).depth;
|
|
146
|
-
|
|
146
|
+
let shouldScale = isTableScalingEnabled && tableDepth === 0;
|
|
147
|
+
if (
|
|
148
|
+
shouldScale &&
|
|
149
|
+
getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')
|
|
150
|
+
) {
|
|
151
|
+
shouldScale = newTable.attrs.displayMode !== 'fixed';
|
|
152
|
+
}
|
|
153
|
+
|
|
147
154
|
if (shouldScale) {
|
|
148
155
|
previousTableInfo = {
|
|
149
156
|
width: getTableElementWidth(table.node),
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
} from '@atlaskit/editor-shared-styles';
|
|
12
12
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
13
13
|
|
|
14
|
-
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
15
14
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
16
15
|
import type { PluginConfig, TableDirection } from '../../types';
|
|
17
16
|
import { dragMenuDropdownWidth, tablePopupMenuFitHeight } from '../consts';
|
|
@@ -33,6 +32,7 @@ export interface Props {
|
|
|
33
32
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
34
33
|
stickyHeaders?: RowStickyState;
|
|
35
34
|
pluginConfig?: PluginConfig;
|
|
35
|
+
isTableScalingEnabled?: boolean;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
const FloatingDragMenu = ({
|
|
@@ -49,6 +49,7 @@ const FloatingDragMenu = ({
|
|
|
49
49
|
editorAnalyticsAPI,
|
|
50
50
|
stickyHeaders,
|
|
51
51
|
pluginConfig,
|
|
52
|
+
isTableScalingEnabled,
|
|
52
53
|
}: Props) => {
|
|
53
54
|
if (
|
|
54
55
|
!isOpen ||
|
|
@@ -73,8 +74,6 @@ const FloatingDragMenu = ({
|
|
|
73
74
|
return null;
|
|
74
75
|
}
|
|
75
76
|
|
|
76
|
-
const { isTableScalingEnabled = false } = getPluginState(editorView.state);
|
|
77
|
-
|
|
78
77
|
return (
|
|
79
78
|
<Popup
|
|
80
79
|
alignX={direction === 'row' ? 'right' : undefined}
|
package/src/ui/common-styles.ts
CHANGED
|
@@ -239,44 +239,32 @@ const viewModeSortStyles = () => {
|
|
|
239
239
|
};
|
|
240
240
|
|
|
241
241
|
const tableBorderStyles = () => {
|
|
242
|
-
|
|
243
|
-
return `border-color: ${tableBorderDeleteColor}`;
|
|
244
|
-
} else {
|
|
245
|
-
return `border: 1px solid ${tableBorderDeleteColor}`;
|
|
246
|
-
}
|
|
242
|
+
return `border-color: ${tableBorderDeleteColor}`;
|
|
247
243
|
};
|
|
248
244
|
|
|
249
245
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
250
246
|
const tableStickyHeaderColumnControlsDecorationsStyle = () => {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
247
|
+
return css`
|
|
248
|
+
.${ClassName.TABLE_STICKY} .${ClassName.COLUMN_CONTROLS_DECORATIONS} {
|
|
249
|
+
z-index: 0;
|
|
250
|
+
left: -1px;
|
|
251
|
+
}
|
|
257
252
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
253
|
+
.${ClassName.TABLE_STICKY}
|
|
254
|
+
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
255
|
+
border-left: 1px solid ${tableBorderColor};
|
|
256
|
+
}
|
|
262
257
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
258
|
+
.${ClassName.TABLE_STICKY}
|
|
259
|
+
tr:first-of-type
|
|
260
|
+
th.${ClassName.TABLE_HEADER_CELL} {
|
|
261
|
+
&.${ClassName.COLUMN_SELECTED}, &.${ClassName.HOVERED_COLUMN} {
|
|
262
|
+
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
263
|
+
left: 0;
|
|
270
264
|
}
|
|
271
265
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
return css`
|
|
275
|
-
.${ClassName.TABLE_STICKY} .${ClassName.COLUMN_CONTROLS_DECORATIONS} {
|
|
276
|
-
z-index: 0;
|
|
277
|
-
}
|
|
278
|
-
`;
|
|
279
|
-
}
|
|
266
|
+
}
|
|
267
|
+
`;
|
|
280
268
|
};
|
|
281
269
|
|
|
282
270
|
const tableStickyHeaderFirefoxFixStyle = () => {
|
package/src/ui/ui-styles.ts
CHANGED
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
akEditorTableNumberColumnWidth,
|
|
13
13
|
akEditorUnitZIndex,
|
|
14
14
|
} from '@atlaskit/editor-shared-styles';
|
|
15
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
16
15
|
import { B300, N0, N300, N40A, N60A, Y200, Y50 } from '@atlaskit/theme/colors';
|
|
17
16
|
import { token } from '@atlaskit/tokens';
|
|
18
17
|
|
|
@@ -399,34 +398,18 @@ const overflowShadowWidhoutDnD = (
|
|
|
399
398
|
};
|
|
400
399
|
|
|
401
400
|
const columnHeaderButton = (cssString?: string) => {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
outline: 'none',
|
|
411
|
-
},
|
|
401
|
+
return css(
|
|
402
|
+
{
|
|
403
|
+
background: tableHeaderCellBackgroundColor,
|
|
404
|
+
display: 'block',
|
|
405
|
+
boxSizing: 'border-box',
|
|
406
|
+
padding: 0,
|
|
407
|
+
':focus': {
|
|
408
|
+
outline: 'none',
|
|
412
409
|
},
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
return css(
|
|
417
|
-
{
|
|
418
|
-
background: tableHeaderCellBackgroundColor,
|
|
419
|
-
border: `1px solid ${tableBorderColor}`,
|
|
420
|
-
display: 'block',
|
|
421
|
-
boxSizing: 'border-box',
|
|
422
|
-
padding: 0,
|
|
423
|
-
':focus': {
|
|
424
|
-
outline: 'none',
|
|
425
|
-
},
|
|
426
|
-
},
|
|
427
|
-
cssString,
|
|
428
|
-
);
|
|
429
|
-
}
|
|
410
|
+
},
|
|
411
|
+
cssString,
|
|
412
|
+
);
|
|
430
413
|
};
|
|
431
414
|
|
|
432
415
|
const columnHeaderButtonSelected = () =>
|
|
@@ -504,34 +487,33 @@ export const rowControlsWrapperDotStyle = () => {
|
|
|
504
487
|
};
|
|
505
488
|
|
|
506
489
|
export const columnControlsDecoration = () => {
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
490
|
+
return css`
|
|
491
|
+
.${ClassName.COLUMN_CONTROLS_DECORATIONS} {
|
|
492
|
+
display: none;
|
|
493
|
+
cursor: pointer;
|
|
494
|
+
position: absolute;
|
|
495
|
+
width: 100%;
|
|
496
|
+
left: 0;
|
|
497
|
+
top: -${columnControlsDecorationHeight + tableCellBorderWidth}px;
|
|
498
|
+
height: ${columnControlsDecorationHeight}px;
|
|
499
|
+
// floating dot for adding column button
|
|
500
|
+
&::before {
|
|
501
|
+
content: ' ';
|
|
502
|
+
background-color: ${tableBorderColor};
|
|
512
503
|
position: absolute;
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
background-color: ${tableBorderColor};
|
|
521
|
-
position: absolute;
|
|
522
|
-
height: ${lineMarkerSize}px;
|
|
523
|
-
width: ${lineMarkerSize}px;
|
|
524
|
-
border-radius: 50%;
|
|
525
|
-
pointer-events: none;
|
|
526
|
-
top: 2px;
|
|
527
|
-
right: -1px;
|
|
528
|
-
}
|
|
504
|
+
height: ${lineMarkerSize}px;
|
|
505
|
+
width: ${lineMarkerSize}px;
|
|
506
|
+
border-radius: 50%;
|
|
507
|
+
pointer-events: none;
|
|
508
|
+
top: 2px;
|
|
509
|
+
right: ${token('space.negative.025', '-2px')};
|
|
510
|
+
}
|
|
529
511
|
|
|
530
|
-
|
|
531
|
-
|
|
512
|
+
&::after {
|
|
513
|
+
content: ' ';
|
|
532
514
|
|
|
533
|
-
|
|
534
|
-
|
|
515
|
+
${columnHeaderButton(
|
|
516
|
+
`
|
|
535
517
|
border-right: ${tableCellBorderWidth}px solid ${tableBorderColor};
|
|
536
518
|
border-top: ${tableCellBorderWidth}px solid ${tableBorderColor};
|
|
537
519
|
border-bottom: ${tableCellBorderWidth}px solid ${tableBorderColor};
|
|
@@ -543,159 +525,86 @@ export const columnControlsDecoration = () => {
|
|
|
543
525
|
left: 0px;
|
|
544
526
|
z-index: ${columnControlsZIndex};
|
|
545
527
|
`,
|
|
546
|
-
|
|
547
|
-
}
|
|
528
|
+
)}
|
|
548
529
|
}
|
|
530
|
+
}
|
|
549
531
|
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
.${ClassName.WITH_CONTROLS} .${ClassName.COLUMN_CONTROLS_DECORATIONS} {
|
|
554
|
-
display: block;
|
|
555
|
-
}
|
|
532
|
+
// floating dot for adding column button - overriding style on last column to avoid scroll
|
|
533
|
+
${getFloatingDotOverrides()}
|
|
556
534
|
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
${columnHeaderButtonSelected()};
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
&.${ClassName.HOVERED_CELL_IN_DANGER}
|
|
564
|
-
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
565
|
-
background-color: ${tableToolbarDeleteColor};
|
|
566
|
-
border-color: ${tableBorderDeleteColor};
|
|
567
|
-
z-index: ${akEditorUnitZIndex * 100};
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
}
|
|
535
|
+
.${ClassName.WITH_CONTROLS} .${ClassName.COLUMN_CONTROLS_DECORATIONS} {
|
|
536
|
+
display: block;
|
|
537
|
+
}
|
|
571
538
|
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
}
|
|
539
|
+
table
|
|
540
|
+
tr:first-of-type
|
|
541
|
+
td.${ClassName.TABLE_CELL},table
|
|
542
|
+
tr:first-of-type
|
|
543
|
+
th.${ClassName.TABLE_HEADER_CELL} {
|
|
544
|
+
&.${ClassName.COLUMN_SELECTED}, &.${ClassName.HOVERED_TABLE} {
|
|
545
|
+
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
546
|
+
${columnHeaderButtonSelected()};
|
|
580
547
|
}
|
|
581
|
-
}
|
|
582
548
|
|
|
583
|
-
|
|
584
|
-
&.${ClassName.HOVERED_COLUMN} {
|
|
549
|
+
&.${ClassName.HOVERED_CELL_IN_DANGER}
|
|
585
550
|
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
586
|
-
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
&.${ClassName.HOVERED_CELL_IN_DANGER}
|
|
590
|
-
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
591
|
-
background-color: ${tableToolbarDeleteColor};
|
|
592
|
-
border-color: ${tableBorderDeleteColor};
|
|
593
|
-
border-left: ${tableCellBorderWidth}px solid
|
|
594
|
-
${tableBorderDeleteColor};
|
|
595
|
-
left: -${tableCellBorderWidth}px;
|
|
596
|
-
z-index: ${akEditorUnitZIndex * 100};
|
|
597
|
-
}
|
|
551
|
+
background-color: ${tableToolbarDeleteColor};
|
|
552
|
+
border-color: ${tableBorderDeleteColor};
|
|
553
|
+
z-index: ${akEditorUnitZIndex * 100};
|
|
598
554
|
}
|
|
599
555
|
}
|
|
556
|
+
}
|
|
600
557
|
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
tr:first-of-type
|
|
608
|
-
th.${ClassName.TABLE_HEADER_CELL} {
|
|
558
|
+
table
|
|
559
|
+
tr:first-of-type
|
|
560
|
+
td.${ClassName.TABLE_CELL},table
|
|
561
|
+
tr:first-of-type
|
|
562
|
+
th.${ClassName.TABLE_HEADER_CELL} {
|
|
563
|
+
&.${ClassName.COLUMN_SELECTED}, &.${ClassName.HOVERED_COLUMN} {
|
|
609
564
|
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
610
565
|
${columnHeaderButtonSelected()};
|
|
566
|
+
border-left: ${tableCellBorderWidth}px solid
|
|
567
|
+
${tableBorderSelectedColor};
|
|
568
|
+
left: -${tableCellBorderWidth}px;
|
|
611
569
|
}
|
|
612
570
|
}
|
|
613
|
-
|
|
614
|
-
} else {
|
|
615
|
-
return css`
|
|
616
|
-
.${ClassName.COLUMN_CONTROLS_DECORATIONS} {
|
|
617
|
-
display: none;
|
|
618
|
-
cursor: pointer;
|
|
619
|
-
position: absolute;
|
|
620
|
-
width: calc(100% + ${tableCellBorderWidth * 2}px);
|
|
621
|
-
left: -1px;
|
|
622
|
-
top: -${columnControlsDecorationHeight + tableCellBorderWidth}px;
|
|
623
|
-
height: ${columnControlsDecorationHeight}px;
|
|
624
|
-
// floating dot for adding column button
|
|
625
|
-
&::before {
|
|
626
|
-
content: ' ';
|
|
627
|
-
background-color: ${tableBorderColor};
|
|
628
|
-
position: absolute;
|
|
629
|
-
height: ${lineMarkerSize}px;
|
|
630
|
-
width: ${lineMarkerSize}px;
|
|
631
|
-
border-radius: 50%;
|
|
632
|
-
pointer-events: none;
|
|
633
|
-
top: 2px;
|
|
634
|
-
right: -1px;
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
&::after {
|
|
638
|
-
content: ' ';
|
|
571
|
+
}
|
|
639
572
|
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
z-index: ${columnControlsZIndex};
|
|
650
|
-
`,
|
|
651
|
-
)}
|
|
573
|
+
table
|
|
574
|
+
tr:first-of-type
|
|
575
|
+
td.${ClassName.TABLE_CELL},
|
|
576
|
+
table
|
|
577
|
+
tr:first-of-type
|
|
578
|
+
th.${ClassName.TABLE_HEADER_CELL} {
|
|
579
|
+
&.${ClassName.HOVERED_COLUMN} {
|
|
580
|
+
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
581
|
+
${columnHeaderButtonSelected()};
|
|
652
582
|
}
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
// floating dot for adding column button - overriding style on last column to avoid scroll
|
|
656
|
-
${getFloatingDotOverrides()}
|
|
657
583
|
|
|
658
|
-
|
|
659
|
-
display: block;
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
table
|
|
663
|
-
tr:first-of-type
|
|
664
|
-
td.${ClassName.TABLE_CELL},
|
|
665
|
-
table
|
|
666
|
-
tr:first-of-type
|
|
667
|
-
th.${ClassName.TABLE_HEADER_CELL} {
|
|
668
|
-
&.${ClassName.COLUMN_SELECTED},
|
|
669
|
-
&.${ClassName.HOVERED_COLUMN},
|
|
670
|
-
&.${ClassName.HOVERED_TABLE} {
|
|
584
|
+
&.${ClassName.HOVERED_CELL_IN_DANGER}
|
|
671
585
|
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
672
|
-
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
background-color: ${tableToolbarDeleteColor};
|
|
678
|
-
border: 1px solid ${tableBorderDeleteColor};
|
|
679
|
-
border-bottom: none;
|
|
680
|
-
z-index: ${akEditorUnitZIndex * 100};
|
|
681
|
-
}
|
|
586
|
+
background-color: ${tableToolbarDeleteColor};
|
|
587
|
+
border-color: ${tableBorderDeleteColor};
|
|
588
|
+
border-left: ${tableCellBorderWidth}px solid ${tableBorderDeleteColor};
|
|
589
|
+
left: -${tableCellBorderWidth}px;
|
|
590
|
+
z-index: ${akEditorUnitZIndex * 100};
|
|
682
591
|
}
|
|
683
592
|
}
|
|
593
|
+
}
|
|
684
594
|
|
|
595
|
+
.${ClassName.TABLE_SELECTED}
|
|
596
|
+
table
|
|
597
|
+
tr:first-of-type
|
|
598
|
+
td.${ClassName.TABLE_CELL},
|
|
685
599
|
.${ClassName.TABLE_SELECTED}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
tr:first-of-type
|
|
692
|
-
th.${ClassName.TABLE_HEADER_CELL} {
|
|
693
|
-
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
694
|
-
${columnHeaderButtonSelected()};
|
|
695
|
-
}
|
|
600
|
+
table
|
|
601
|
+
tr:first-of-type
|
|
602
|
+
th.${ClassName.TABLE_HEADER_CELL} {
|
|
603
|
+
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
604
|
+
${columnHeaderButtonSelected()};
|
|
696
605
|
}
|
|
697
|
-
|
|
698
|
-
|
|
606
|
+
}
|
|
607
|
+
`;
|
|
699
608
|
};
|
|
700
609
|
|
|
701
610
|
export const hoveredDeleteButton = () => css`
|