@atlaskit/editor-plugin-table 7.31.3 → 8.1.0
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 +96 -0
- package/dist/cjs/commands/column-resize.js +3 -2
- package/dist/cjs/commands/hover.js +5 -3
- package/dist/cjs/event-handlers.js +12 -1
- package/dist/cjs/nodeviews/TableComponent.js +18 -15
- package/dist/cjs/nodeviews/TableComponentWithSharedState.js +5 -2
- package/dist/cjs/nodeviews/lazy-node-views.js +2 -3
- package/dist/cjs/nodeviews/table.js +16 -12
- package/dist/cjs/plugin.js +21 -26
- package/dist/cjs/pm-plugins/main.js +3 -5
- package/dist/cjs/toolbar.js +1 -1
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/ui/common-styles.js +2 -2
- package/dist/cjs/ui/ui-styles.js +6 -9
- package/dist/cjs/utils/decoration.js +2 -2
- package/dist/es2019/commands/column-resize.js +3 -2
- package/dist/es2019/commands/hover.js +11 -6
- package/dist/es2019/event-handlers.js +12 -1
- package/dist/es2019/nodeviews/TableComponent.js +18 -15
- package/dist/es2019/nodeviews/TableComponentWithSharedState.js +5 -2
- package/dist/es2019/nodeviews/lazy-node-views.js +2 -3
- package/dist/es2019/nodeviews/table.js +16 -12
- package/dist/es2019/plugin.js +21 -24
- package/dist/es2019/pm-plugins/main.js +3 -5
- package/dist/es2019/toolbar.js +1 -1
- package/dist/es2019/types.js +2 -0
- package/dist/es2019/ui/common-styles.js +4 -4
- package/dist/es2019/ui/ui-styles.js +36 -29
- package/dist/es2019/utils/decoration.js +2 -2
- package/dist/esm/commands/column-resize.js +3 -2
- package/dist/esm/commands/hover.js +5 -3
- package/dist/esm/event-handlers.js +12 -1
- package/dist/esm/nodeviews/TableComponent.js +18 -15
- package/dist/esm/nodeviews/TableComponentWithSharedState.js +5 -2
- package/dist/esm/nodeviews/lazy-node-views.js +2 -3
- package/dist/esm/nodeviews/table.js +16 -12
- package/dist/esm/plugin.js +21 -26
- package/dist/esm/pm-plugins/main.js +3 -5
- package/dist/esm/toolbar.js +1 -1
- package/dist/esm/types.js +2 -0
- package/dist/esm/ui/common-styles.js +2 -2
- package/dist/esm/ui/ui-styles.js +6 -9
- package/dist/esm/utils/decoration.js +2 -2
- package/dist/types/event-handlers.d.ts +1 -1
- package/dist/types/nodeviews/TableComponent.d.ts +2 -1
- package/dist/types/nodeviews/TableComponentWithSharedState.d.ts +3 -1
- package/dist/types/nodeviews/lazy-node-views.d.ts +0 -1
- package/dist/types/nodeviews/table.d.ts +1 -1
- package/dist/types/nodeviews/types.d.ts +2 -2
- package/dist/types/plugin.d.ts +1 -3
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/types.d.ts +4 -1
- package/dist/types/ui/ui-styles.d.ts +1 -1
- package/dist/types/utils/decoration.d.ts +1 -1
- package/dist/types-ts4.5/event-handlers.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/TableComponentWithSharedState.d.ts +3 -1
- package/dist/types-ts4.5/nodeviews/lazy-node-views.d.ts +0 -1
- package/dist/types-ts4.5/nodeviews/table.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/types.d.ts +2 -2
- package/dist/types-ts4.5/plugin.d.ts +1 -3
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +4 -1
- package/dist/types-ts4.5/ui/ui-styles.d.ts +1 -1
- package/dist/types-ts4.5/utils/decoration.d.ts +1 -1
- package/package.json +5 -5
- package/src/commands/column-resize.ts +8 -3
- package/src/commands/hover.ts +14 -10
- package/src/event-handlers.ts +16 -1
- package/src/nodeviews/TableComponent.tsx +22 -16
- package/src/nodeviews/TableComponentWithSharedState.tsx +6 -1
- package/src/nodeviews/lazy-node-views.ts +0 -4
- package/src/nodeviews/table.tsx +13 -8
- package/src/nodeviews/types.ts +2 -2
- package/src/plugin.tsx +24 -31
- package/src/pm-plugins/main.ts +2 -6
- package/src/toolbar.tsx +1 -1
- package/src/types.ts +5 -1
- package/src/ui/common-styles.ts +1 -1
- package/src/ui/ui-styles.ts +36 -29
- package/src/utils/decoration.ts +8 -3
package/src/ui/ui-styles.ts
CHANGED
|
@@ -660,34 +660,32 @@ export const hoveredWarningCell = css`
|
|
|
660
660
|
|
|
661
661
|
// Explicit pixel values required here to ensure correct positioning and sizes of column resize handle
|
|
662
662
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
663
|
-
const
|
|
664
|
-
if (isDragAndDropEnabled) {
|
|
665
|
-
return css`
|
|
666
|
-
th.${ClassName.WITH_RESIZE_LINE}::before, td.${ClassName.WITH_RESIZE_LINE}::before {
|
|
667
|
-
content: ' ';
|
|
668
|
-
position: absolute;
|
|
669
|
-
left: ${token('space.negative.025', '-2px')};
|
|
670
|
-
top: -1px;
|
|
671
|
-
width: ${resizeLineWidth}px;
|
|
672
|
-
height: calc(100% + 2px);
|
|
673
|
-
background-color: ${tableBorderSelectedColor};
|
|
674
|
-
z-index: ${columnControlsZIndex * 2};
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
th.${ClassName.WITH_RESIZE_LINE_LAST_COLUMN}::before,
|
|
678
|
-
td.${ClassName.WITH_RESIZE_LINE_LAST_COLUMN}::before {
|
|
679
|
-
content: ' ';
|
|
680
|
-
position: absolute;
|
|
681
|
-
right: -1px;
|
|
682
|
-
top: -1px;
|
|
683
|
-
width: ${resizeLineWidth}px;
|
|
684
|
-
height: calc(100% + 2px);
|
|
685
|
-
background-color: ${tableBorderSelectedColor};
|
|
686
|
-
z-index: ${columnControlsZIndex * 2};
|
|
687
|
-
}
|
|
688
|
-
`;
|
|
689
|
-
}
|
|
663
|
+
const resizeLineStyles = () => {
|
|
690
664
|
return css`
|
|
665
|
+
th.${ClassName.WITH_DRAG_RESIZE_LINE}::before, td.${ClassName.WITH_DRAG_RESIZE_LINE}::before {
|
|
666
|
+
content: ' ';
|
|
667
|
+
position: absolute;
|
|
668
|
+
left: ${token('space.negative.025', '-2px')};
|
|
669
|
+
top: -1px;
|
|
670
|
+
width: ${resizeLineWidth}px;
|
|
671
|
+
height: calc(100% + 2px);
|
|
672
|
+
background-color: ${tableBorderSelectedColor};
|
|
673
|
+
z-index: ${columnControlsZIndex * 2};
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
th.${ClassName.WITH_DRAG_RESIZE_LINE_LAST_COLUMN}::before,
|
|
677
|
+
td.${ClassName.WITH_DRAG_RESIZE_LINE_LAST_COLUMN}::before {
|
|
678
|
+
content: ' ';
|
|
679
|
+
position: absolute;
|
|
680
|
+
right: -1px;
|
|
681
|
+
top: -1px;
|
|
682
|
+
width: ${resizeLineWidth}px;
|
|
683
|
+
height: calc(100% + 2px);
|
|
684
|
+
background-color: ${tableBorderSelectedColor};
|
|
685
|
+
z-index: ${columnControlsZIndex * 2};
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
// Styles when drag and drop is disabled - will be removed
|
|
691
689
|
td.${ClassName.WITH_RESIZE_LINE}::before {
|
|
692
690
|
content: ' ';
|
|
693
691
|
position: absolute;
|
|
@@ -734,7 +732,7 @@ const resizeHandleOverrides = (isDragAndDropEnabled: boolean | undefined) => {
|
|
|
734
732
|
`;
|
|
735
733
|
};
|
|
736
734
|
|
|
737
|
-
export const resizeHandle = (
|
|
735
|
+
export const resizeHandle = () => css`
|
|
738
736
|
.${ClassName.TABLE_CONTAINER} {
|
|
739
737
|
.${ClassName.RESIZE_HANDLE_DECORATION} {
|
|
740
738
|
background-color: transparent;
|
|
@@ -763,10 +761,19 @@ export const resizeHandle = (isDragAndDropEnabled: boolean | undefined) => css`
|
|
|
763
761
|
z-index: ${resizeHandlerZIndex};
|
|
764
762
|
}
|
|
765
763
|
|
|
766
|
-
${
|
|
764
|
+
${resizeLineStyles()}
|
|
767
765
|
|
|
768
766
|
table
|
|
769
767
|
tr:first-of-type
|
|
768
|
+
th.${ClassName.WITH_DRAG_RESIZE_LINE}
|
|
769
|
+
.${ClassName.RESIZE_HANDLE_DECORATION}::after,
|
|
770
|
+
table
|
|
771
|
+
tr:first-of-type
|
|
772
|
+
td.${ClassName.WITH_DRAG_RESIZE_LINE}
|
|
773
|
+
.${ClassName.RESIZE_HANDLE_DECORATION}::after,
|
|
774
|
+
// Styles when drag and drop is disabled - will be removed
|
|
775
|
+
table
|
|
776
|
+
tr:first-of-type
|
|
770
777
|
th.${ClassName.WITH_RESIZE_LINE}
|
|
771
778
|
.${ClassName.RESIZE_HANDLE_DECORATION}::after,
|
|
772
779
|
table
|
package/src/utils/decoration.ts
CHANGED
|
@@ -511,6 +511,7 @@ export const createResizeHandleDecoration = (
|
|
|
511
511
|
export const createColumnLineResize = (
|
|
512
512
|
selection: Selection,
|
|
513
513
|
cellColumnPositioning: Omit<CellColumnPositioning, 'left'>,
|
|
514
|
+
isDragAndDropEnabled?: boolean,
|
|
514
515
|
): Decoration[] => {
|
|
515
516
|
const table = findTable(selection);
|
|
516
517
|
if (!table || cellColumnPositioning.right === null) {
|
|
@@ -524,9 +525,13 @@ export const createColumnLineResize = (
|
|
|
524
525
|
if (isLastColumn) {
|
|
525
526
|
columnIndex -= 1;
|
|
526
527
|
}
|
|
527
|
-
const decorationClassName =
|
|
528
|
-
?
|
|
529
|
-
|
|
528
|
+
const decorationClassName = isDragAndDropEnabled
|
|
529
|
+
? isLastColumn
|
|
530
|
+
? ClassName.WITH_DRAG_RESIZE_LINE_LAST_COLUMN
|
|
531
|
+
: ClassName.WITH_DRAG_RESIZE_LINE
|
|
532
|
+
: isLastColumn
|
|
533
|
+
? ClassName.WITH_RESIZE_LINE_LAST_COLUMN
|
|
534
|
+
: ClassName.WITH_RESIZE_LINE;
|
|
530
535
|
|
|
531
536
|
const cellPositions = makeArray(map.height)
|
|
532
537
|
.map((rowIndex) => map.map[map.width * rowIndex + columnIndex])
|