@atlaskit/editor-plugin-table 2.8.6 → 2.9.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 +15 -0
- package/dist/cjs/plugins/table/nodeviews/OverflowShadowsObserver.js +2 -1
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +6 -6
- package/dist/cjs/plugins/table/nodeviews/TableContainer.js +1 -1
- package/dist/cjs/plugins/table/nodeviews/TableResizer.js +3 -1
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +4 -1
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +13 -2
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/misc.js +1 -6
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +21 -8
- package/dist/cjs/plugins/table/ui/common-styles.js +12 -4
- package/dist/cjs/plugins/table/ui/consts.js +3 -1
- package/dist/cjs/plugins/table/ui/ui-styles.js +16 -7
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/table/nodeviews/OverflowShadowsObserver.js +2 -1
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +6 -6
- package/dist/es2019/plugins/table/nodeviews/TableContainer.js +1 -1
- package/dist/es2019/plugins/table/nodeviews/TableResizer.js +3 -1
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +4 -1
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +9 -1
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/misc.js +1 -6
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +18 -7
- package/dist/es2019/plugins/table/ui/common-styles.js +27 -9
- package/dist/es2019/plugins/table/ui/consts.js +1 -0
- package/dist/es2019/plugins/table/ui/ui-styles.js +51 -4
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/table/nodeviews/OverflowShadowsObserver.js +2 -1
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +6 -6
- package/dist/esm/plugins/table/nodeviews/TableContainer.js +1 -1
- package/dist/esm/plugins/table/nodeviews/TableResizer.js +3 -1
- package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +4 -1
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +11 -1
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/misc.js +1 -6
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +22 -9
- package/dist/esm/plugins/table/ui/common-styles.js +12 -4
- package/dist/esm/plugins/table/ui/consts.js +1 -0
- package/dist/esm/plugins/table/ui/ui-styles.js +17 -8
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/table/nodeviews/TableComponent.d.ts +5 -4
- package/dist/types/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +8 -1
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +5 -5
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +5 -5
- package/dist/types/plugins/table/types.d.ts +8 -8
- package/dist/types/plugins/table/ui/consts.d.ts +1 -0
- package/dist/types/plugins/table/ui/ui-styles.d.ts +1 -1
- package/dist/types/plugins/table/utils/decoration.d.ts +6 -4
- package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +5 -4
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +8 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +5 -5
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +5 -5
- package/dist/types-ts4.5/plugins/table/types.d.ts +8 -8
- package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +6 -4
- package/package.json +2 -2
- package/report.api.md +1 -1
- package/src/__tests__/unit/pm-plugins/table-resizing/colgroup.ts +157 -61
- package/src/plugins/table/nodeviews/OverflowShadowsObserver.ts +5 -1
- package/src/plugins/table/nodeviews/TableComponent.tsx +16 -15
- package/src/plugins/table/nodeviews/TableContainer.tsx +1 -1
- package/src/plugins/table/nodeviews/TableResizer.tsx +3 -2
- package/src/plugins/table/nodeviews/update-overflow-shadows.ts +0 -1
- package/src/plugins/table/pm-plugins/table-resizing/event-handlers.ts +18 -9
- package/src/plugins/table/pm-plugins/table-resizing/utils/colgroup.ts +17 -8
- package/src/plugins/table/pm-plugins/table-resizing/utils/misc.ts +9 -13
- package/src/plugins/table/pm-plugins/table-resizing/utils/resize-state.ts +34 -17
- package/src/plugins/table/types.ts +8 -8
- package/src/plugins/table/ui/common-styles.ts +28 -9
- package/src/plugins/table/ui/consts.ts +1 -0
- package/src/plugins/table/ui/ui-styles.ts +59 -4
- package/src/plugins/table/utils/decoration.ts +8 -11
- package/tmp/api-report-tmp.d.ts +1 -1
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
SelectionStyle,
|
|
19
19
|
} from '@atlaskit/editor-shared-styles';
|
|
20
20
|
import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
|
|
21
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
21
22
|
import { B300, N0, N20A, N300, N40A, R500 } from '@atlaskit/theme/colors';
|
|
22
23
|
import { fontSize } from '@atlaskit/theme/constants';
|
|
23
24
|
import { ThemeProps } from '@atlaskit/theme/types';
|
|
@@ -155,6 +156,32 @@ const breakoutWidthStyling = () => {
|
|
|
155
156
|
`;
|
|
156
157
|
};
|
|
157
158
|
|
|
159
|
+
const tableWrapperStyles = () => {
|
|
160
|
+
if (getBooleanFF('platform.editor.custom-table-width')) {
|
|
161
|
+
return css`
|
|
162
|
+
.${ClassName.TABLE_NODE_WRAPPER} {
|
|
163
|
+
padding-bottom: 0px;
|
|
164
|
+
/* fixes gap cursor height */
|
|
165
|
+
overflow: auto;
|
|
166
|
+
overflow-y: hidden;
|
|
167
|
+
position: relative;
|
|
168
|
+
}
|
|
169
|
+
`;
|
|
170
|
+
} else {
|
|
171
|
+
return css`
|
|
172
|
+
.${ClassName.TABLE_NODE_WRAPPER} {
|
|
173
|
+
padding-right: ${insertColumnButtonOffset}px;
|
|
174
|
+
margin-right: -${insertColumnButtonOffset}px;
|
|
175
|
+
padding-bottom: 0px;
|
|
176
|
+
/* fixes gap cursor height */
|
|
177
|
+
overflow: auto;
|
|
178
|
+
overflow-y: hidden;
|
|
179
|
+
position: relative;
|
|
180
|
+
}
|
|
181
|
+
`;
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
|
|
158
185
|
// TODO: https://product-fabric.atlassian.net/browse/DSP-4139
|
|
159
186
|
export const tableStyles = (
|
|
160
187
|
props: ThemeProps & { featureFlags?: FeatureFlags },
|
|
@@ -733,15 +760,7 @@ export const tableStyles = (
|
|
|
733
760
|
.${ClassName.ROW_CONTROLS_WRAPPER} {
|
|
734
761
|
left: -${tableToolbarSize}px;
|
|
735
762
|
}
|
|
736
|
-
|
|
737
|
-
padding-right: ${insertColumnButtonOffset}px;
|
|
738
|
-
margin-right: -${insertColumnButtonOffset}px;
|
|
739
|
-
padding-bottom: 0px;
|
|
740
|
-
/* fixes gap cursor height */
|
|
741
|
-
overflow: auto;
|
|
742
|
-
overflow-y: hidden;
|
|
743
|
-
position: relative;
|
|
744
|
-
}
|
|
763
|
+
${tableWrapperStyles()}
|
|
745
764
|
}
|
|
746
765
|
|
|
747
766
|
.ProseMirror.${ClassName.IS_RESIZING} {
|
|
@@ -130,6 +130,7 @@ export const contextualMenuDropdownWidth = 180;
|
|
|
130
130
|
export const stickyRowZIndex = resizeHandlerZIndex + 2;
|
|
131
131
|
export const stickyRowOffsetTop = 8;
|
|
132
132
|
export const stickyHeaderBorderBottomWidth = 1;
|
|
133
|
+
export const tableOverflowShadowWidth = 8;
|
|
133
134
|
|
|
134
135
|
export const TABLE_SNAP_GAP = 9;
|
|
135
136
|
export const TABLE_HIGHLIGHT_GAP = 10;
|
|
@@ -10,9 +10,10 @@ import {
|
|
|
10
10
|
akEditorTableNumberColumnWidth,
|
|
11
11
|
akEditorUnitZIndex,
|
|
12
12
|
} from '@atlaskit/editor-shared-styles';
|
|
13
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
13
14
|
import { B300, N0, N300, N40A, N60A, Y200, Y50 } from '@atlaskit/theme/colors';
|
|
14
15
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
15
|
-
import { ThemeProps } from '@atlaskit/theme/types';
|
|
16
|
+
import type { ThemeProps } from '@atlaskit/theme/types';
|
|
16
17
|
import { token } from '@atlaskit/tokens';
|
|
17
18
|
|
|
18
19
|
import { TableCssClassName as ClassName } from '../types';
|
|
@@ -36,6 +37,7 @@ import {
|
|
|
36
37
|
tableDeleteButtonSize,
|
|
37
38
|
tableHeaderCellBackgroundColor,
|
|
38
39
|
tableInsertColumnButtonSize,
|
|
40
|
+
tableOverflowShadowWidth,
|
|
39
41
|
tableToolbarDeleteColor,
|
|
40
42
|
tableToolbarSelectedColor,
|
|
41
43
|
tableToolbarSize,
|
|
@@ -244,7 +246,7 @@ export const OverflowShadow = (props: ThemeProps) => css`
|
|
|
244
246
|
pointer-events: none;
|
|
245
247
|
top: ${tableMarginTop}px;
|
|
246
248
|
z-index: ${akEditorShadowZIndex};
|
|
247
|
-
width:
|
|
249
|
+
width: ${tableOverflowShadowWidth}px;
|
|
248
250
|
}
|
|
249
251
|
.${ClassName.TABLE_LEFT_SHADOW} {
|
|
250
252
|
background: linear-gradient(
|
|
@@ -273,9 +275,10 @@ export const OverflowShadow = (props: ThemeProps) => css`
|
|
|
273
275
|
${token('elevation.shadow.overflow.perimeter', 'transparent')} 0px,
|
|
274
276
|
transparent 1px
|
|
275
277
|
);
|
|
276
|
-
left:
|
|
278
|
+
left: ${getBooleanFF('platform.editor.custom-table-width')
|
|
279
|
+
? `calc(100% - ${tableOverflowShadowWidth}px)`
|
|
280
|
+
: 'calc(100% + 2px)'};
|
|
277
281
|
}
|
|
278
|
-
|
|
279
282
|
.${ClassName.WITH_CONTROLS} {
|
|
280
283
|
.${ClassName.TABLE_RIGHT_SHADOW}, .${ClassName.TABLE_LEFT_SHADOW} {
|
|
281
284
|
height: calc(100% - ${tableMarginTopWithControl}px);
|
|
@@ -308,6 +311,29 @@ const columnHeaderButtonSelected = (props: ThemeProps) => css`
|
|
|
308
311
|
z-index: ${columnControlsSelectedZIndex};
|
|
309
312
|
`;
|
|
310
313
|
|
|
314
|
+
const getFloatingDotOverrides = (props: ThemeProps) => {
|
|
315
|
+
return getBooleanFF('platform.editor.custom-table-width')
|
|
316
|
+
? css`
|
|
317
|
+
tr
|
|
318
|
+
th:last-child
|
|
319
|
+
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::before,
|
|
320
|
+
tr
|
|
321
|
+
td:last-child
|
|
322
|
+
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::before {
|
|
323
|
+
content: '';
|
|
324
|
+
background-color: ${tableBorderColor(props)};
|
|
325
|
+
position: absolute;
|
|
326
|
+
height: ${lineMarkerSize}px;
|
|
327
|
+
width: ${lineMarkerSize}px;
|
|
328
|
+
border-radius: 50%;
|
|
329
|
+
pointer-events: none;
|
|
330
|
+
top: ${token('space.025', '2px')};
|
|
331
|
+
right: 0px;
|
|
332
|
+
}
|
|
333
|
+
`
|
|
334
|
+
: '';
|
|
335
|
+
};
|
|
336
|
+
|
|
311
337
|
export const columnControlsDecoration = (props: ThemeProps) => css`
|
|
312
338
|
.${ClassName.COLUMN_CONTROLS_DECORATIONS} {
|
|
313
339
|
display: none;
|
|
@@ -317,6 +343,7 @@ export const columnControlsDecoration = (props: ThemeProps) => css`
|
|
|
317
343
|
left: -1px;
|
|
318
344
|
top: -${columnControlsDecorationHeight + tableCellBorderWidth}px;
|
|
319
345
|
height: ${columnControlsDecorationHeight}px;
|
|
346
|
+
// floating dot for adding column button
|
|
320
347
|
&::before {
|
|
321
348
|
content: ' ';
|
|
322
349
|
background-color: ${tableBorderColor(props)};
|
|
@@ -350,6 +377,9 @@ export const columnControlsDecoration = (props: ThemeProps) => css`
|
|
|
350
377
|
}
|
|
351
378
|
}
|
|
352
379
|
|
|
380
|
+
// floating dot for adding column button - overriding style on last column to avoid scroll
|
|
381
|
+
${getFloatingDotOverrides(props)}
|
|
382
|
+
|
|
353
383
|
div.${ClassName.WITH_CONTROLS}>.${ClassName.ROW_CONTROLS_WRAPPER}::after {
|
|
354
384
|
content: ' ';
|
|
355
385
|
background-color: ${tableBorderColor(props)};
|
|
@@ -439,6 +469,29 @@ export const hoveredWarningCell = css`
|
|
|
439
469
|
}
|
|
440
470
|
`;
|
|
441
471
|
|
|
472
|
+
// move the resize handle zone completely inside the table cell to avoid overflow
|
|
473
|
+
const getLastColumnResizerOverrides = () => {
|
|
474
|
+
return getBooleanFF('platform.editor.custom-table-width')
|
|
475
|
+
? css`
|
|
476
|
+
tr
|
|
477
|
+
th:last-child
|
|
478
|
+
.${ClassName.RESIZE_HANDLE_DECORATION},
|
|
479
|
+
tr
|
|
480
|
+
td:last-child
|
|
481
|
+
.${ClassName.RESIZE_HANDLE_DECORATION} {
|
|
482
|
+
background-color: transparent;
|
|
483
|
+
position: absolute;
|
|
484
|
+
width: ${resizeHandlerAreaWidth}px;
|
|
485
|
+
height: 100%;
|
|
486
|
+
top: 0;
|
|
487
|
+
right: 0;
|
|
488
|
+
cursor: col-resize;
|
|
489
|
+
z-index: ${resizeHandlerZIndex};
|
|
490
|
+
}
|
|
491
|
+
`
|
|
492
|
+
: '';
|
|
493
|
+
};
|
|
494
|
+
|
|
442
495
|
export const resizeHandle = (props: ThemeProps) => css`
|
|
443
496
|
.${ClassName.TABLE_CONTAINER} {
|
|
444
497
|
.${ClassName.RESIZE_HANDLE_DECORATION} {
|
|
@@ -452,6 +505,8 @@ export const resizeHandle = (props: ThemeProps) => css`
|
|
|
452
505
|
z-index: ${resizeHandlerZIndex};
|
|
453
506
|
}
|
|
454
507
|
|
|
508
|
+
${getLastColumnResizerOverrides()}
|
|
509
|
+
|
|
455
510
|
td.${ClassName.WITH_RESIZE_LINE}::before {
|
|
456
511
|
content: ' ';
|
|
457
512
|
position: absolute;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { CellAttributes } from '@atlaskit/adf-schema';
|
|
1
|
+
import type { CellAttributes } from '@atlaskit/adf-schema';
|
|
2
2
|
import { nonNullable } from '@atlaskit/editor-common/utils';
|
|
3
|
-
import { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
5
|
-
import {
|
|
5
|
+
import type {
|
|
6
6
|
ReadonlyTransaction,
|
|
7
7
|
Selection,
|
|
8
8
|
Transaction,
|
|
9
9
|
} from '@atlaskit/editor-prosemirror/state';
|
|
10
|
-
import { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
11
|
-
import {
|
|
10
|
+
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
11
|
+
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
12
|
+
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
12
13
|
import { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
|
|
13
14
|
import {
|
|
14
15
|
findTable,
|
|
@@ -16,12 +17,8 @@ import {
|
|
|
16
17
|
getSelectionRect,
|
|
17
18
|
} from '@atlaskit/editor-tables/utils';
|
|
18
19
|
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
CellColumnPositioning,
|
|
22
|
-
TableCssClassName as ClassName,
|
|
23
|
-
TableDecorations,
|
|
24
|
-
} from '../types';
|
|
20
|
+
import type { Cell, CellColumnPositioning } from '../types';
|
|
21
|
+
import { TableCssClassName as ClassName, TableDecorations } from '../types';
|
|
25
22
|
|
|
26
23
|
const filterDecorationByKey = (
|
|
27
24
|
key: TableDecorations,
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
|
|
|
12
12
|
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
13
13
|
import type { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
14
14
|
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
15
|
-
import { TableLayout } from '@atlaskit/adf-schema';
|
|
15
|
+
import type { TableLayout } from '@atlaskit/adf-schema';
|
|
16
16
|
import type { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
17
17
|
|
|
18
18
|
// @public (undocumented)
|