@atlaskit/editor-plugin-table 5.3.26 → 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 +7 -0
- package/dist/cjs/plugins/table/commands/hover.js +9 -3
- 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/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/types.js +3 -0
- package/dist/es2019/plugins/table/ui/DragHandle/index.js +19 -6
- 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/types.js +3 -0
- package/dist/esm/plugins/table/ui/DragHandle/index.js +18 -6
- 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/types.ts +4 -0
- package/src/plugins/table/ui/DragHandle/index.tsx +36 -5
- 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
|
@@ -56,6 +56,7 @@ import {
|
|
|
56
56
|
columnControlsDecoration,
|
|
57
57
|
columnControlsLineMarker,
|
|
58
58
|
DeleteButton,
|
|
59
|
+
disabledCell,
|
|
59
60
|
dragCornerControlButton,
|
|
60
61
|
dragInsertButtonWrapper,
|
|
61
62
|
floatingColumnControls,
|
|
@@ -315,6 +316,7 @@ export const tableStyles = (
|
|
|
315
316
|
${columnControlsLineMarker()};
|
|
316
317
|
${hoveredDeleteButton(props)};
|
|
317
318
|
${hoveredCell(props)};
|
|
319
|
+
${disabledCell(props)};
|
|
318
320
|
${hoveredWarningCell};
|
|
319
321
|
${getBooleanFF('platform.editor.table.drag-and-drop') && insertLine(props)};
|
|
320
322
|
${resizeHandle(props)};
|
|
@@ -779,58 +781,49 @@ export const tableStyles = (
|
|
|
779
781
|
align-items: center;
|
|
780
782
|
outline: none !important;
|
|
781
783
|
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
fill: ${token('color.background.accent.gray.subtlest', '#F1F2F4')};
|
|
785
|
-
}
|
|
786
|
-
g {
|
|
787
|
-
fill: ${token('color.icon.subtle', '#626F86')};
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
&:hover {
|
|
792
|
-
svg {
|
|
784
|
+
&:not(.${ClassName.DRAG_HANDLE_DISABLED}) {
|
|
785
|
+
& > svg {
|
|
793
786
|
rect {
|
|
794
|
-
fill: ${token('color.background.accent.
|
|
787
|
+
fill: ${token('color.background.accent.gray.subtlest', '#F1F2F4')};
|
|
795
788
|
}
|
|
796
789
|
g {
|
|
797
|
-
fill: ${token('color.icon.
|
|
790
|
+
fill: ${token('color.icon.subtle', '#626F86')};
|
|
798
791
|
}
|
|
799
792
|
}
|
|
800
|
-
}
|
|
801
793
|
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
794
|
+
&:hover {
|
|
795
|
+
svg {
|
|
796
|
+
rect {
|
|
797
|
+
fill: ${token('color.background.accent.blue.subtle', '#579DFF')};
|
|
798
|
+
}
|
|
799
|
+
g {
|
|
800
|
+
fill: ${token('color.icon.inverse', '#FFF')};
|
|
801
|
+
}
|
|
809
802
|
}
|
|
810
803
|
}
|
|
811
|
-
}
|
|
812
804
|
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
g {
|
|
822
|
-
fill: ${token('color.border.inverse', '#FFF')};
|
|
805
|
+
&.selected {
|
|
806
|
+
svg {
|
|
807
|
+
rect {
|
|
808
|
+
fill: ${token('color.background.accent.blue.subtle', '#579dff')};
|
|
809
|
+
}
|
|
810
|
+
g {
|
|
811
|
+
fill: ${token('color.icon.inverse', '#fff')};
|
|
812
|
+
}
|
|
823
813
|
}
|
|
824
814
|
}
|
|
825
|
-
}
|
|
826
815
|
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
816
|
+
&.danger {
|
|
817
|
+
svg {
|
|
818
|
+
rect {
|
|
819
|
+
fill: ${token(
|
|
820
|
+
'color.background.accent.red.subtler.pressed',
|
|
821
|
+
'#F87462',
|
|
822
|
+
)};
|
|
823
|
+
}
|
|
824
|
+
g {
|
|
825
|
+
fill: ${token('color.border.inverse', '#FFF')};
|
|
826
|
+
}
|
|
834
827
|
}
|
|
835
828
|
}
|
|
836
829
|
}
|
|
@@ -97,6 +97,12 @@ export const tableCellDeleteColor = themed({
|
|
|
97
97
|
light: token('color.blanket.danger', akEditorTableCellBlanketDeleted),
|
|
98
98
|
dark: token('color.blanket.danger', akEditorTableCellBlanketDeleted),
|
|
99
99
|
});
|
|
100
|
+
|
|
101
|
+
export const tableCellDisabledColor = token(
|
|
102
|
+
'color.background.accent.gray.subtler.hovered',
|
|
103
|
+
'#C1C7D0',
|
|
104
|
+
);
|
|
105
|
+
|
|
100
106
|
export const tableBorderDeleteColor = themed({
|
|
101
107
|
light: token('color.border.danger', R400),
|
|
102
108
|
dark: token('color.border.danger', R400),
|
|
@@ -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,
|