@atlaskit/editor-plugin-table 5.3.25 → 5.3.27
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 +14 -0
- package/dist/cjs/plugins/table/commands/hover.js +9 -3
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/commands.js +19 -6
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +6 -1
- package/dist/cjs/plugins/table/types.js +3 -0
- package/dist/cjs/plugins/table/ui/DragHandle/index.js +16 -4
- package/dist/cjs/plugins/table/ui/FloatingDragMenu/DragMenu.js +26 -1
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -1
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +2 -1
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/ui/consts.js +2 -1
- package/dist/cjs/plugins/table/ui/icons/DragHandleDisabledIcon.js +45 -0
- package/dist/cjs/plugins/table/ui/icons/index.js +7 -0
- package/dist/cjs/plugins/table/ui/ui-styles.js +12 -9
- package/dist/cjs/plugins/table/utils/decoration.js +7 -1
- package/dist/es2019/plugins/table/commands/hover.js +13 -4
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/commands.js +19 -6
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +6 -1
- package/dist/es2019/plugins/table/types.js +3 -0
- package/dist/es2019/plugins/table/ui/DragHandle/index.js +19 -6
- package/dist/es2019/plugins/table/ui/FloatingDragMenu/DragMenu.js +27 -1
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -1
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +2 -1
- package/dist/es2019/plugins/table/ui/common-styles.js +30 -38
- package/dist/es2019/plugins/table/ui/consts.js +1 -0
- package/dist/es2019/plugins/table/ui/icons/DragHandleDisabledIcon.js +37 -0
- package/dist/es2019/plugins/table/ui/icons/index.js +1 -0
- package/dist/es2019/plugins/table/ui/ui-styles.js +13 -1
- package/dist/es2019/plugins/table/utils/decoration.js +7 -1
- package/dist/esm/plugins/table/commands/hover.js +10 -4
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/commands.js +19 -6
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +6 -1
- package/dist/esm/plugins/table/types.js +3 -0
- package/dist/esm/plugins/table/ui/DragHandle/index.js +18 -6
- package/dist/esm/plugins/table/ui/FloatingDragMenu/DragMenu.js +26 -1
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -1
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/DragControls.js +2 -1
- package/dist/esm/plugins/table/ui/common-styles.js +2 -2
- package/dist/esm/plugins/table/ui/consts.js +1 -0
- package/dist/esm/plugins/table/ui/icons/DragHandleDisabledIcon.js +38 -0
- package/dist/esm/plugins/table/ui/icons/index.js +1 -0
- package/dist/esm/plugins/table/ui/ui-styles.js +12 -9
- package/dist/esm/plugins/table/utils/decoration.js +7 -1
- package/dist/types/plugins/table/types.d.ts +3 -0
- package/dist/types/plugins/table/ui/DragHandle/index.d.ts +3 -1
- package/dist/types/plugins/table/ui/consts.d.ts +1 -0
- package/dist/types/plugins/table/ui/icons/DragHandleDisabledIcon.d.ts +6 -0
- package/dist/types/plugins/table/ui/icons/index.d.ts +1 -0
- package/dist/types/plugins/table/ui/ui-styles.d.ts +1 -0
- package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
- package/dist/types/plugins/table/utils/selection.d.ts +2 -2
- package/dist/types-ts4.5/plugins/table/types.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/ui/DragHandle/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/ui/icons/DragHandleDisabledIcon.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/ui/icons/index.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/utils/selection.d.ts +2 -2
- package/package.json +2 -2
- package/src/plugins/table/commands/hover.ts +12 -1
- package/src/plugins/table/pm-plugins/drag-and-drop/commands.ts +31 -7
- package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +7 -1
- package/src/plugins/table/types.ts +4 -0
- package/src/plugins/table/ui/DragHandle/index.tsx +36 -5
- package/src/plugins/table/ui/FloatingDragMenu/DragMenu.tsx +33 -1
- package/src/plugins/table/ui/TableFloatingColumnControls/ColumnControls/index.tsx +1 -0
- package/src/plugins/table/ui/TableFloatingControls/RowControls/DragControls.tsx +1 -0
- package/src/plugins/table/ui/common-styles.ts +33 -40
- package/src/plugins/table/ui/consts.ts +6 -0
- package/src/plugins/table/ui/icons/DragHandleDisabledIcon.tsx +53 -0
- package/src/plugins/table/ui/icons/index.ts +1 -0
- package/src/plugins/table/ui/ui-styles.ts +13 -0
- package/src/plugins/table/utils/decoration.ts +14 -0
- package/src/plugins/table/utils/selection.ts +6 -2
- package/src/__tests__/integration/__snapshots__/auto-size.ts.snap +0 -612
- package/src/__tests__/integration/__snapshots__/delete-columns.ts.snap +0 -820
- package/src/__tests__/integration/__snapshots__/delete-last-column-in-full-width.ts.snap +0 -120
- package/src/__tests__/integration/__snapshots__/delete-last-column-with-empty-action.ts.snap +0 -120
- package/src/__tests__/integration/__snapshots__/delete-last-row-with-empty-action.ts.snap +0 -229
- package/src/__tests__/integration/__snapshots__/insert-row-inside-layout.ts.snap +0 -239
- package/src/__tests__/integration/__snapshots__/resize.ts.snap +0 -2685
- package/src/__tests__/integration/__snapshots__/scale.ts.snap +0 -1085
- package/src/__tests__/integration/arrow-down-into-table.ts +0 -50
- package/src/__tests__/integration/auto-size.ts +0 -92
- package/src/__tests__/integration/cell-selection.ts +0 -105
- package/src/__tests__/integration/delete-columns.ts +0 -99
- package/src/__tests__/integration/delete-last-column-in-full-width.ts +0 -73
- package/src/__tests__/integration/delete-last-column-with-empty-action.ts +0 -60
- package/src/__tests__/integration/delete-last-row-with-empty-action.ts +0 -99
- package/src/__tests__/integration/insert-row-inside-layout.ts +0 -52
- package/src/__tests__/integration/resize.ts +0 -333
- package/src/__tests__/integration/scale.ts +0 -70
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { token } from '@atlaskit/tokens';
|
|
4
|
+
|
|
5
|
+
interface DragHandleDisabledIconProps {
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const DragHandleDisabledIcon = ({
|
|
10
|
+
style,
|
|
11
|
+
}: DragHandleDisabledIconProps) => (
|
|
12
|
+
<svg
|
|
13
|
+
width="24"
|
|
14
|
+
height="16"
|
|
15
|
+
viewBox="0 0 24 16"
|
|
16
|
+
fill="none"
|
|
17
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
18
|
+
style={style}
|
|
19
|
+
>
|
|
20
|
+
<rect
|
|
21
|
+
width="24"
|
|
22
|
+
height="16"
|
|
23
|
+
rx="4"
|
|
24
|
+
fill={token('color.background.accent.gray.subtlest', 'Neutral200')}
|
|
25
|
+
/>
|
|
26
|
+
<g>
|
|
27
|
+
<rect
|
|
28
|
+
x="7"
|
|
29
|
+
y="4"
|
|
30
|
+
width="2"
|
|
31
|
+
height="8"
|
|
32
|
+
rx="1"
|
|
33
|
+
fill={token('color.icon.disabled', '#091E424F')}
|
|
34
|
+
/>
|
|
35
|
+
<rect
|
|
36
|
+
x="11"
|
|
37
|
+
y="4"
|
|
38
|
+
width="2"
|
|
39
|
+
height="8"
|
|
40
|
+
rx="1"
|
|
41
|
+
fill={token('color.icon.disabled', '#091E424F')}
|
|
42
|
+
/>
|
|
43
|
+
<rect
|
|
44
|
+
x="15"
|
|
45
|
+
y="4"
|
|
46
|
+
width="2"
|
|
47
|
+
height="8"
|
|
48
|
+
rx="1"
|
|
49
|
+
fill={token('color.icon.disabled', '#091E424F')}
|
|
50
|
+
/>
|
|
51
|
+
</g>
|
|
52
|
+
</svg>
|
|
53
|
+
);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { DragHandleIcon } from './DragHandleIcon';
|
|
2
2
|
export { DragInMotionIcon } from './DragInMotionIcon';
|
|
3
|
+
export { DragHandleDisabledIcon } from './DragHandleDisabledIcon';
|
|
3
4
|
export { AddRowAboveIcon } from './AddRowAboveIcon';
|
|
4
5
|
export { AddRowBelowIcon } from './AddRowBelowIcon';
|
|
5
6
|
export { AddColLeftIcon } from './AddColLeftIcon';
|
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
tableBorderDeleteColor,
|
|
32
32
|
tableBorderSelectedColor,
|
|
33
33
|
tableCellDeleteColor,
|
|
34
|
+
tableCellDisabledColor,
|
|
34
35
|
tableCellHoverDeleteIconBackground,
|
|
35
36
|
tableCellHoverDeleteIconColor,
|
|
36
37
|
tableCellSelectedDeleteIconBackground,
|
|
@@ -707,6 +708,18 @@ export const hoveredDeleteButton = (props: ThemeProps) => css`
|
|
|
707
708
|
}
|
|
708
709
|
`;
|
|
709
710
|
|
|
711
|
+
export const disabledCell = (props: ThemeProps) => css`
|
|
712
|
+
:not(.${ClassName.IS_RESIZING})
|
|
713
|
+
.${ClassName.TABLE_CONTAINER}:not(.${ClassName.HOVERED_DELETE_BUTTON}) {
|
|
714
|
+
.${ClassName.HOVERED_CELL}.${ClassName.HOVERED_DISABLED_CELL} {
|
|
715
|
+
position: relative;
|
|
716
|
+
border: 1px solid ${tableCellDisabledColor};
|
|
717
|
+
}
|
|
718
|
+
.${ClassName.HOVERED_CELL}.${ClassName.HOVERED_DISABLED_CELL}::after {
|
|
719
|
+
border: 1px solid ${tableCellDisabledColor};
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
`;
|
|
710
723
|
export const hoveredCell = (props: ThemeProps) => css`
|
|
711
724
|
:not(.${ClassName.IS_RESIZING})
|
|
712
725
|
.${ClassName.TABLE_CONTAINER}:not(.${ClassName.HOVERED_DELETE_BUTTON}) {
|
|
@@ -28,6 +28,8 @@ import type { Cell, CellColumnPositioning } from '../types';
|
|
|
28
28
|
import { TableCssClassName as ClassName, TableDecorations } from '../types';
|
|
29
29
|
import { ColumnResizeWidget } from '../ui/ColumnResizeWidget';
|
|
30
30
|
|
|
31
|
+
import { hasMergedCellsInColumn, hasMergedCellsInRow } from './merged-cells';
|
|
32
|
+
|
|
31
33
|
const filterDecorationByKey = (
|
|
32
34
|
key: TableDecorations,
|
|
33
35
|
decorationSet: DecorationSet,
|
|
@@ -66,6 +68,8 @@ export const createControlsHoverDecoration = (
|
|
|
66
68
|
cells: Cell[],
|
|
67
69
|
type: 'row' | 'column' | 'table',
|
|
68
70
|
tr: Transaction | ReadonlyTransaction,
|
|
71
|
+
isDragAndDropEnable: boolean | undefined,
|
|
72
|
+
hoveredIndexes: number[],
|
|
69
73
|
danger?: boolean,
|
|
70
74
|
selected?: boolean,
|
|
71
75
|
): Decoration[] => {
|
|
@@ -95,6 +99,13 @@ export const createControlsHoverDecoration = (
|
|
|
95
99
|
|
|
96
100
|
let updatedCells: number[] = cells.map((x) => x.pos);
|
|
97
101
|
|
|
102
|
+
const hasMergedCells =
|
|
103
|
+
type === 'row'
|
|
104
|
+
? hasMergedCellsInRow(hoveredIndexes[0])(tr.selection)
|
|
105
|
+
: hasMergedCellsInColumn(hoveredIndexes[0])(tr.selection);
|
|
106
|
+
|
|
107
|
+
let disabled: boolean = hasMergedCells;
|
|
108
|
+
|
|
98
109
|
// ED-15246 fixed trello card table overflow issue
|
|
99
110
|
// If columns / rows have been merged the hovered selection is different to the actual selection
|
|
100
111
|
// So If the table cells are in danger we want to create a "rectangle" selection
|
|
@@ -140,6 +151,9 @@ export const createControlsHoverDecoration = (
|
|
|
140
151
|
if (selected) {
|
|
141
152
|
classes.push(ClassName.SELECTED_CELL);
|
|
142
153
|
}
|
|
154
|
+
if (isDragAndDropEnable && disabled) {
|
|
155
|
+
classes.push(ClassName.HOVERED_DISABLED_CELL);
|
|
156
|
+
}
|
|
143
157
|
|
|
144
158
|
classes.push(
|
|
145
159
|
type === 'column'
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
|
+
Selection,
|
|
3
|
+
Transaction,
|
|
4
|
+
} from '@atlaskit/editor-prosemirror/state';
|
|
2
5
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
3
|
-
import { Rect
|
|
6
|
+
import type { Rect } from '@atlaskit/editor-tables/table-map';
|
|
7
|
+
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
4
8
|
import {
|
|
5
9
|
findTable,
|
|
6
10
|
getSelectionRangeInColumn,
|