@atlaskit/editor-plugin-table 7.11.3 → 7.11.5
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 +1734 -700
- package/dist/cjs/commands/column-resize.js +5 -1
- package/dist/cjs/nodeviews/TableComponent.js +28 -6
- package/dist/cjs/nodeviews/table.js +17 -11
- 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 +30 -7
- package/dist/es2019/nodeviews/table.js +17 -12
- 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 +28 -6
- package/dist/esm/nodeviews/table.js +17 -11
- 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 +3 -6
- package/src/commands/column-resize.ts +11 -2
- package/src/nodeviews/TableComponent.tsx +71 -9
- package/src/nodeviews/table.tsx +34 -18
- 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
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
3
3
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
5
|
-
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
6
5
|
import { dragMenuDropdownWidth, tablePopupMenuFitHeight } from '../consts';
|
|
7
6
|
import DragMenu from './DragMenu';
|
|
8
7
|
const FloatingDragMenu = ({
|
|
@@ -18,7 +17,8 @@ const FloatingDragMenu = ({
|
|
|
18
17
|
getEditorContainerWidth,
|
|
19
18
|
editorAnalyticsAPI,
|
|
20
19
|
stickyHeaders,
|
|
21
|
-
pluginConfig
|
|
20
|
+
pluginConfig,
|
|
21
|
+
isTableScalingEnabled
|
|
22
22
|
}) => {
|
|
23
23
|
if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
24
24
|
return null;
|
|
@@ -29,9 +29,6 @@ const FloatingDragMenu = ({
|
|
|
29
29
|
if (!targetHandleRef || !(editorView.state.selection instanceof CellSelection)) {
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
|
-
const {
|
|
33
|
-
isTableScalingEnabled = false
|
|
34
|
-
} = getPluginState(editorView.state);
|
|
35
32
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
36
33
|
alignX: direction === 'row' ? 'right' : undefined,
|
|
37
34
|
alignY: direction === 'row' ? 'start' : undefined,
|
|
@@ -158,44 +158,32 @@ const viewModeSortStyles = () => {
|
|
|
158
158
|
}
|
|
159
159
|
};
|
|
160
160
|
const tableBorderStyles = () => {
|
|
161
|
-
|
|
162
|
-
return `border-color: ${tableBorderDeleteColor}`;
|
|
163
|
-
} else {
|
|
164
|
-
return `border: 1px solid ${tableBorderDeleteColor}`;
|
|
165
|
-
}
|
|
161
|
+
return `border-color: ${tableBorderDeleteColor}`;
|
|
166
162
|
};
|
|
167
163
|
|
|
168
164
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
169
165
|
const tableStickyHeaderColumnControlsDecorationsStyle = () => {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
166
|
+
return css`
|
|
167
|
+
.${ClassName.TABLE_STICKY} .${ClassName.COLUMN_CONTROLS_DECORATIONS} {
|
|
168
|
+
z-index: 0;
|
|
169
|
+
left: -1px;
|
|
170
|
+
}
|
|
176
171
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
172
|
+
.${ClassName.TABLE_STICKY}
|
|
173
|
+
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
174
|
+
border-left: 1px solid ${tableBorderColor};
|
|
175
|
+
}
|
|
181
176
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
177
|
+
.${ClassName.TABLE_STICKY}
|
|
178
|
+
tr:first-of-type
|
|
179
|
+
th.${ClassName.TABLE_HEADER_CELL} {
|
|
180
|
+
&.${ClassName.COLUMN_SELECTED}, &.${ClassName.HOVERED_COLUMN} {
|
|
181
|
+
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
182
|
+
left: 0;
|
|
189
183
|
}
|
|
190
184
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
return css`
|
|
194
|
-
.${ClassName.TABLE_STICKY} .${ClassName.COLUMN_CONTROLS_DECORATIONS} {
|
|
195
|
-
z-index: 0;
|
|
196
|
-
}
|
|
197
|
-
`;
|
|
198
|
-
}
|
|
185
|
+
}
|
|
186
|
+
`;
|
|
199
187
|
};
|
|
200
188
|
const tableStickyHeaderFirefoxFixStyle = () => {
|
|
201
189
|
/*
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { css } from '@emotion/react';
|
|
3
3
|
import { tableCellBorderWidth, tableMarginTop, tableMarginTopWithControl } from '@atlaskit/editor-common/styles';
|
|
4
4
|
import { akEditorShadowZIndex, akEditorTableBorder, akEditorTableNumberColumnWidth, akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
|
|
5
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { B300, N0, N300, N40A, N60A, Y200, Y50 } from '@atlaskit/theme/colors';
|
|
7
6
|
import { TableCssClassName as ClassName } from '../types';
|
|
8
7
|
import { columnControlsDecorationHeight, columnControlsSelectedZIndex, columnControlsZIndex, dragTableInsertColumnButtonSize, insertLineWidth, lineMarkerSize, resizeHandlerAreaWidth, resizeHandlerZIndex, resizeLineWidth, tableBorderColor, tableBorderDeleteColor, tableBorderSelectedColor, tableCellDeleteColor, tableCellHoverDeleteIconBackground, tableCellHoverDeleteIconColor, tableCellSelectedDeleteIconBackground, tableCellSelectedDeleteIconColor, tableDeleteButtonSize, tableHeaderCellBackgroundColor, tableInsertColumnButtonSize, tableOverflowShadowWidthWide, tableToolbarDeleteColor, tableToolbarSelectedColor, tableToolbarSize } from './consts';
|
|
@@ -317,28 +316,15 @@ const overflowShadowWidhoutDnD = isDragAndDropEnabled => {
|
|
|
317
316
|
}
|
|
318
317
|
};
|
|
319
318
|
const columnHeaderButton = cssString => {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
}, cssString);
|
|
330
|
-
} else {
|
|
331
|
-
return css({
|
|
332
|
-
background: tableHeaderCellBackgroundColor,
|
|
333
|
-
border: `1px solid ${tableBorderColor}`,
|
|
334
|
-
display: 'block',
|
|
335
|
-
boxSizing: 'border-box',
|
|
336
|
-
padding: 0,
|
|
337
|
-
':focus': {
|
|
338
|
-
outline: 'none'
|
|
339
|
-
}
|
|
340
|
-
}, cssString);
|
|
341
|
-
}
|
|
319
|
+
return css({
|
|
320
|
+
background: tableHeaderCellBackgroundColor,
|
|
321
|
+
display: 'block',
|
|
322
|
+
boxSizing: 'border-box',
|
|
323
|
+
padding: 0,
|
|
324
|
+
':focus': {
|
|
325
|
+
outline: 'none'
|
|
326
|
+
}
|
|
327
|
+
}, cssString);
|
|
342
328
|
};
|
|
343
329
|
const columnHeaderButtonSelected = () => css({
|
|
344
330
|
color: `var(--ds-text-inverse, ${N0})`,
|
|
@@ -410,33 +396,32 @@ export const rowControlsWrapperDotStyle = () => {
|
|
|
410
396
|
`;
|
|
411
397
|
};
|
|
412
398
|
export const columnControlsDecoration = () => {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
399
|
+
return css`
|
|
400
|
+
.${ClassName.COLUMN_CONTROLS_DECORATIONS} {
|
|
401
|
+
display: none;
|
|
402
|
+
cursor: pointer;
|
|
403
|
+
position: absolute;
|
|
404
|
+
width: 100%;
|
|
405
|
+
left: 0;
|
|
406
|
+
top: -${columnControlsDecorationHeight + tableCellBorderWidth}px;
|
|
407
|
+
height: ${columnControlsDecorationHeight}px;
|
|
408
|
+
// floating dot for adding column button
|
|
409
|
+
&::before {
|
|
410
|
+
content: ' ';
|
|
411
|
+
background-color: ${tableBorderColor};
|
|
418
412
|
position: absolute;
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
background-color: ${tableBorderColor};
|
|
427
|
-
position: absolute;
|
|
428
|
-
height: ${lineMarkerSize}px;
|
|
429
|
-
width: ${lineMarkerSize}px;
|
|
430
|
-
border-radius: 50%;
|
|
431
|
-
pointer-events: none;
|
|
432
|
-
top: 2px;
|
|
433
|
-
right: -1px;
|
|
434
|
-
}
|
|
413
|
+
height: ${lineMarkerSize}px;
|
|
414
|
+
width: ${lineMarkerSize}px;
|
|
415
|
+
border-radius: 50%;
|
|
416
|
+
pointer-events: none;
|
|
417
|
+
top: 2px;
|
|
418
|
+
right: ${"var(--ds-space-negative-025, -2px)"};
|
|
419
|
+
}
|
|
435
420
|
|
|
436
|
-
|
|
437
|
-
|
|
421
|
+
&::after {
|
|
422
|
+
content: ' ';
|
|
438
423
|
|
|
439
|
-
|
|
424
|
+
${columnHeaderButton(`
|
|
440
425
|
border-right: ${tableCellBorderWidth}px solid ${tableBorderColor};
|
|
441
426
|
border-top: ${tableCellBorderWidth}px solid ${tableBorderColor};
|
|
442
427
|
border-bottom: ${tableCellBorderWidth}px solid ${tableBorderColor};
|
|
@@ -448,156 +433,85 @@ export const columnControlsDecoration = () => {
|
|
|
448
433
|
left: 0px;
|
|
449
434
|
z-index: ${columnControlsZIndex};
|
|
450
435
|
`)}
|
|
451
|
-
}
|
|
452
436
|
}
|
|
437
|
+
}
|
|
453
438
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
.${ClassName.WITH_CONTROLS} .${ClassName.COLUMN_CONTROLS_DECORATIONS} {
|
|
458
|
-
display: block;
|
|
459
|
-
}
|
|
439
|
+
// floating dot for adding column button - overriding style on last column to avoid scroll
|
|
440
|
+
${getFloatingDotOverrides()}
|
|
460
441
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
${columnHeaderButtonSelected()};
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
&.${ClassName.HOVERED_CELL_IN_DANGER}
|
|
468
|
-
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
469
|
-
background-color: ${tableToolbarDeleteColor};
|
|
470
|
-
border-color: ${tableBorderDeleteColor};
|
|
471
|
-
z-index: ${akEditorUnitZIndex * 100};
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
}
|
|
442
|
+
.${ClassName.WITH_CONTROLS} .${ClassName.COLUMN_CONTROLS_DECORATIONS} {
|
|
443
|
+
display: block;
|
|
444
|
+
}
|
|
475
445
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
}
|
|
446
|
+
table
|
|
447
|
+
tr:first-of-type
|
|
448
|
+
td.${ClassName.TABLE_CELL},table
|
|
449
|
+
tr:first-of-type
|
|
450
|
+
th.${ClassName.TABLE_HEADER_CELL} {
|
|
451
|
+
&.${ClassName.COLUMN_SELECTED}, &.${ClassName.HOVERED_TABLE} {
|
|
452
|
+
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
453
|
+
${columnHeaderButtonSelected()};
|
|
484
454
|
}
|
|
485
|
-
}
|
|
486
455
|
|
|
487
|
-
|
|
488
|
-
&.${ClassName.HOVERED_COLUMN} {
|
|
456
|
+
&.${ClassName.HOVERED_CELL_IN_DANGER}
|
|
489
457
|
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
490
|
-
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
&.${ClassName.HOVERED_CELL_IN_DANGER}
|
|
494
|
-
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
495
|
-
background-color: ${tableToolbarDeleteColor};
|
|
496
|
-
border-color: ${tableBorderDeleteColor};
|
|
497
|
-
border-left: ${tableCellBorderWidth}px solid
|
|
498
|
-
${tableBorderDeleteColor};
|
|
499
|
-
left: -${tableCellBorderWidth}px;
|
|
500
|
-
z-index: ${akEditorUnitZIndex * 100};
|
|
501
|
-
}
|
|
458
|
+
background-color: ${tableToolbarDeleteColor};
|
|
459
|
+
border-color: ${tableBorderDeleteColor};
|
|
460
|
+
z-index: ${akEditorUnitZIndex * 100};
|
|
502
461
|
}
|
|
503
462
|
}
|
|
463
|
+
}
|
|
504
464
|
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
tr:first-of-type
|
|
512
|
-
th.${ClassName.TABLE_HEADER_CELL} {
|
|
465
|
+
table
|
|
466
|
+
tr:first-of-type
|
|
467
|
+
td.${ClassName.TABLE_CELL},table
|
|
468
|
+
tr:first-of-type
|
|
469
|
+
th.${ClassName.TABLE_HEADER_CELL} {
|
|
470
|
+
&.${ClassName.COLUMN_SELECTED}, &.${ClassName.HOVERED_COLUMN} {
|
|
513
471
|
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
514
472
|
${columnHeaderButtonSelected()};
|
|
473
|
+
border-left: ${tableCellBorderWidth}px solid
|
|
474
|
+
${tableBorderSelectedColor};
|
|
475
|
+
left: -${tableCellBorderWidth}px;
|
|
515
476
|
}
|
|
516
477
|
}
|
|
517
|
-
|
|
518
|
-
} else {
|
|
519
|
-
return css`
|
|
520
|
-
.${ClassName.COLUMN_CONTROLS_DECORATIONS} {
|
|
521
|
-
display: none;
|
|
522
|
-
cursor: pointer;
|
|
523
|
-
position: absolute;
|
|
524
|
-
width: calc(100% + ${tableCellBorderWidth * 2}px);
|
|
525
|
-
left: -1px;
|
|
526
|
-
top: -${columnControlsDecorationHeight + tableCellBorderWidth}px;
|
|
527
|
-
height: ${columnControlsDecorationHeight}px;
|
|
528
|
-
// floating dot for adding column button
|
|
529
|
-
&::before {
|
|
530
|
-
content: ' ';
|
|
531
|
-
background-color: ${tableBorderColor};
|
|
532
|
-
position: absolute;
|
|
533
|
-
height: ${lineMarkerSize}px;
|
|
534
|
-
width: ${lineMarkerSize}px;
|
|
535
|
-
border-radius: 50%;
|
|
536
|
-
pointer-events: none;
|
|
537
|
-
top: 2px;
|
|
538
|
-
right: -1px;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
&::after {
|
|
542
|
-
content: ' ';
|
|
478
|
+
}
|
|
543
479
|
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
`)}
|
|
480
|
+
table
|
|
481
|
+
tr:first-of-type
|
|
482
|
+
td.${ClassName.TABLE_CELL},
|
|
483
|
+
table
|
|
484
|
+
tr:first-of-type
|
|
485
|
+
th.${ClassName.TABLE_HEADER_CELL} {
|
|
486
|
+
&.${ClassName.HOVERED_COLUMN} {
|
|
487
|
+
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
488
|
+
${columnHeaderButtonSelected()};
|
|
554
489
|
}
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
// floating dot for adding column button - overriding style on last column to avoid scroll
|
|
558
|
-
${getFloatingDotOverrides()}
|
|
559
490
|
|
|
560
|
-
|
|
561
|
-
display: block;
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
table
|
|
565
|
-
tr:first-of-type
|
|
566
|
-
td.${ClassName.TABLE_CELL},
|
|
567
|
-
table
|
|
568
|
-
tr:first-of-type
|
|
569
|
-
th.${ClassName.TABLE_HEADER_CELL} {
|
|
570
|
-
&.${ClassName.COLUMN_SELECTED},
|
|
571
|
-
&.${ClassName.HOVERED_COLUMN},
|
|
572
|
-
&.${ClassName.HOVERED_TABLE} {
|
|
491
|
+
&.${ClassName.HOVERED_CELL_IN_DANGER}
|
|
573
492
|
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
574
|
-
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
background-color: ${tableToolbarDeleteColor};
|
|
580
|
-
border: 1px solid ${tableBorderDeleteColor};
|
|
581
|
-
border-bottom: none;
|
|
582
|
-
z-index: ${akEditorUnitZIndex * 100};
|
|
583
|
-
}
|
|
493
|
+
background-color: ${tableToolbarDeleteColor};
|
|
494
|
+
border-color: ${tableBorderDeleteColor};
|
|
495
|
+
border-left: ${tableCellBorderWidth}px solid ${tableBorderDeleteColor};
|
|
496
|
+
left: -${tableCellBorderWidth}px;
|
|
497
|
+
z-index: ${akEditorUnitZIndex * 100};
|
|
584
498
|
}
|
|
585
499
|
}
|
|
500
|
+
}
|
|
586
501
|
|
|
502
|
+
.${ClassName.TABLE_SELECTED}
|
|
503
|
+
table
|
|
504
|
+
tr:first-of-type
|
|
505
|
+
td.${ClassName.TABLE_CELL},
|
|
587
506
|
.${ClassName.TABLE_SELECTED}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
tr:first-of-type
|
|
594
|
-
th.${ClassName.TABLE_HEADER_CELL} {
|
|
595
|
-
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
596
|
-
${columnHeaderButtonSelected()};
|
|
597
|
-
}
|
|
507
|
+
table
|
|
508
|
+
tr:first-of-type
|
|
509
|
+
th.${ClassName.TABLE_HEADER_CELL} {
|
|
510
|
+
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
511
|
+
${columnHeaderButtonSelected()};
|
|
598
512
|
}
|
|
599
|
-
|
|
600
|
-
|
|
513
|
+
}
|
|
514
|
+
`;
|
|
601
515
|
};
|
|
602
516
|
export const hoveredDeleteButton = () => css`
|
|
603
517
|
.${ClassName.TABLE_CONTAINER}.${ClassName.HOVERED_DELETE_BUTTON} {
|
|
@@ -204,6 +204,10 @@ export var changeColumnWidthByStep = function changeColumnWidthByStep(_ref4) {
|
|
|
204
204
|
layout: originalTable.attrs.layout,
|
|
205
205
|
getEditorContainerWidth: getEditorContainerWidth
|
|
206
206
|
});
|
|
207
|
+
var isTableScalingEnabledOnCurrentTable = isTableScalingEnabled;
|
|
208
|
+
if (isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')) {
|
|
209
|
+
isTableScalingEnabledOnCurrentTable = originalTable.attrs.displayMode !== 'fixed';
|
|
210
|
+
}
|
|
207
211
|
var initialResizeState = getResizeState({
|
|
208
212
|
minWidth: tableCellMinWidth,
|
|
209
213
|
maxSize: maxSize,
|
|
@@ -211,7 +215,7 @@ export var changeColumnWidthByStep = function changeColumnWidthByStep(_ref4) {
|
|
|
211
215
|
tableRef: dom,
|
|
212
216
|
start: tableStartPosition,
|
|
213
217
|
domAtPos: domAtPos,
|
|
214
|
-
isTableScalingEnabled:
|
|
218
|
+
isTableScalingEnabled: isTableScalingEnabledOnCurrentTable
|
|
215
219
|
});
|
|
216
220
|
updateControls()(state);
|
|
217
221
|
var selectionRect = getSelectionRect(state.selection);
|
|
@@ -348,7 +348,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
348
348
|
this === null || this === void 0 || (_this$table = this.table) === null || _this$table === void 0 || _this$table.addEventListener('mouseenter', this.handleMouseEnter);
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
|
-
if (isTableScalingEnabled) {
|
|
351
|
+
if (isTableScalingEnabled && !getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')) {
|
|
352
|
+
this.handleColgroupUpdates(true);
|
|
353
|
+
}
|
|
354
|
+
if (isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') && getNode().attrs.displayMode !== 'fixed') {
|
|
352
355
|
this.handleColgroupUpdates(true);
|
|
353
356
|
}
|
|
354
357
|
if (allowColumnResizing && this.wrapper && !isIE11) {
|
|
@@ -472,8 +475,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
472
475
|
var wasTableResized = hasTableBeenResized(this.node);
|
|
473
476
|
var isTableResized = hasTableBeenResized(tableNode);
|
|
474
477
|
var isColumnsDistributed = wasTableResized && !isTableResized;
|
|
475
|
-
var
|
|
476
|
-
|
|
478
|
+
var isTableDisplayModeChanged = this.node.attrs.displayMode !== tableNode.attrs.displayMode;
|
|
479
|
+
var shouldUpdateColgroup = isWidthChanged || isColumnsDistributed || isTableResizedFullWidth || isTableWidthChanged || isTableDisplayModeChanged;
|
|
480
|
+
if (force || !isResizing && shouldUpdateColgroup) {
|
|
481
|
+
var _this$props$options, _this$props$options2;
|
|
477
482
|
var resizeState = getResizeState({
|
|
478
483
|
minWidth: COLUMN_MIN_WIDTH,
|
|
479
484
|
maxSize: tableRenderWidth,
|
|
@@ -483,10 +488,17 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
483
488
|
domAtPos: view.domAtPos,
|
|
484
489
|
isTableScalingEnabled: true
|
|
485
490
|
});
|
|
491
|
+
var shouldScaleOnColgroupUpdate = false;
|
|
492
|
+
if ((_this$props$options = this.props.options) !== null && _this$props$options !== void 0 && _this$props$options.isTableScalingEnabled && !getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')) {
|
|
493
|
+
shouldScaleOnColgroupUpdate = true;
|
|
494
|
+
}
|
|
495
|
+
if ((_this$props$options2 = this.props.options) !== null && _this$props$options2 !== void 0 && _this$props$options2.isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') && tableNode.attrs.displayMode !== 'fixed') {
|
|
496
|
+
shouldScaleOnColgroupUpdate = true;
|
|
497
|
+
}
|
|
486
498
|
|
|
487
499
|
// Request animation frame required for Firefox
|
|
488
500
|
requestAnimationFrame(function () {
|
|
489
|
-
updateColgroup(resizeState, _this2.table, tableNode,
|
|
501
|
+
updateColgroup(resizeState, _this2.table, tableNode, shouldScaleOnColgroupUpdate);
|
|
490
502
|
});
|
|
491
503
|
}
|
|
492
504
|
}
|
|
@@ -514,7 +526,17 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
514
526
|
var pluginState = getPluginState(view.state);
|
|
515
527
|
isInDanger = pluginState.isInDanger;
|
|
516
528
|
}
|
|
517
|
-
|
|
529
|
+
var shouldScale = false;
|
|
530
|
+
var shouldHandleColgroupUpdates = false;
|
|
531
|
+
if (isTableScalingEnabled && !getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')) {
|
|
532
|
+
shouldScale = true;
|
|
533
|
+
shouldHandleColgroupUpdates = true;
|
|
534
|
+
}
|
|
535
|
+
if (isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') && getNode().attrs.displayMode !== 'fixed') {
|
|
536
|
+
shouldScale = true;
|
|
537
|
+
shouldHandleColgroupUpdates = true;
|
|
538
|
+
}
|
|
539
|
+
if (shouldHandleColgroupUpdates) {
|
|
518
540
|
this.handleColgroupUpdates();
|
|
519
541
|
}
|
|
520
542
|
if (isInDanger && !table) {
|
|
@@ -561,7 +583,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
561
583
|
if (shouldRecreateResizeCols) {
|
|
562
584
|
var start = getPos() || 0;
|
|
563
585
|
var depth = _view.state.doc.resolve(start).depth;
|
|
564
|
-
|
|
586
|
+
shouldScale = depth === 0 && shouldScale;
|
|
565
587
|
insertColgroupFromNode(this.table, currentTable, shouldScale);
|
|
566
588
|
}
|
|
567
589
|
updateControls()(_view.state);
|
|
@@ -83,10 +83,9 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
83
83
|
value: function getContentDOM() {
|
|
84
84
|
var rendered = DOMSerializer.renderSpec(document, toDOM(this.node, this.reactComponentProps));
|
|
85
85
|
if (rendered.dom) {
|
|
86
|
-
var _this$options;
|
|
86
|
+
var _this$options, _this$options2;
|
|
87
87
|
this.table = rendered.dom;
|
|
88
|
-
|
|
89
|
-
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.isTableScalingEnabled)) {
|
|
88
|
+
if (!((_this$options = this.options) !== null && _this$options !== void 0 && _this$options.isTableScalingEnabled) || (_this$options2 = this.options) !== null && _this$options2 !== void 0 && _this$options2.isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') && this.node.attrs.displayMode === 'fixed') {
|
|
90
89
|
var tableInlineWidth = getInlineWidth(this.node, this.reactComponentProps.options, this.reactComponentProps.view.state, this.reactComponentProps.getPos());
|
|
91
90
|
if (tableInlineWidth) {
|
|
92
91
|
handleInlineTableWidth(this.table, tableInlineWidth);
|
|
@@ -99,7 +98,8 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
99
98
|
key: "setDomAttrs",
|
|
100
99
|
value: function setDomAttrs(node) {
|
|
101
100
|
var _this2 = this,
|
|
102
|
-
|
|
101
|
+
_this$options3,
|
|
102
|
+
_this$options4;
|
|
103
103
|
if (!this.table) {
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
@@ -108,11 +108,15 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
108
108
|
_this2.table.setAttribute(attr, attrs[attr]);
|
|
109
109
|
});
|
|
110
110
|
|
|
111
|
-
//
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
// Preserve Table Width cannot have inline width set on the table
|
|
112
|
+
if (!((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.isTableScalingEnabled) || (_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') && node.attrs.displayMode === 'fixed') {
|
|
113
|
+
var _tableWidthPluginKey$;
|
|
114
|
+
// handle inline style when table been resized
|
|
115
|
+
var tableInlineWidth = getInlineWidth(node, this.reactComponentProps.options, this.view.state, this.getPos());
|
|
116
|
+
var isTableResizing = (_tableWidthPluginKey$ = tableWidthPluginKey.getState(this.view.state)) === null || _tableWidthPluginKey$ === void 0 ? void 0 : _tableWidthPluginKey$.resizing;
|
|
117
|
+
if (!isTableResizing && tableInlineWidth) {
|
|
118
|
+
handleInlineTableWidth(this.table, tableInlineWidth);
|
|
119
|
+
}
|
|
116
120
|
}
|
|
117
121
|
}
|
|
118
122
|
}, {
|
|
@@ -165,6 +169,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
165
169
|
},
|
|
166
170
|
editorView: props.view,
|
|
167
171
|
render: function render(pluginStates) {
|
|
172
|
+
var _props$options;
|
|
168
173
|
var tableResizingPluginState = pluginStates.tableResizingPluginState,
|
|
169
174
|
tableWidthPluginState = pluginStates.tableWidthPluginState,
|
|
170
175
|
pluginState = pluginStates.pluginState,
|
|
@@ -196,7 +201,8 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
196
201
|
isHeaderRowEnabled: pluginState.isHeaderRowEnabled,
|
|
197
202
|
isHeaderColumnEnabled: pluginState.isHeaderColumnEnabled,
|
|
198
203
|
isDragAndDropEnabled: pluginState.isDragAndDropEnabled,
|
|
199
|
-
isTableScalingEnabled: pluginState.isTableScalingEnabled
|
|
204
|
+
isTableScalingEnabled: (_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.isTableScalingEnabled // this.options?.isTableScalingEnabled sams as TableOptions.isTableScalingEnabled same as pluginState.isTableScalingEnabled
|
|
205
|
+
,
|
|
200
206
|
tableActive: tableActive,
|
|
201
207
|
ordering: pluginState.ordering,
|
|
202
208
|
isResizing: isResizing,
|
|
@@ -296,7 +302,7 @@ export var createTableView = function createTableView(node, view, getPos, portal
|
|
|
296
302
|
wasFullWidthModeEnabled: wasFullWidthModeEnabled,
|
|
297
303
|
isTableResizingEnabled: isTableResizingEnabled,
|
|
298
304
|
isDragAndDropEnabled: isDragAndDropEnabled,
|
|
299
|
-
isTableScalingEnabled: isTableScalingEnabled
|
|
305
|
+
isTableScalingEnabled: isTableScalingEnabled // same as options.isTableScalingEnabled
|
|
300
306
|
},
|
|
301
307
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
302
308
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
package/dist/esm/plugin.js
CHANGED
|
@@ -151,12 +151,13 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
151
151
|
var _ref5 = options || {},
|
|
152
152
|
fullWidthEnabled = _ref5.fullWidthEnabled,
|
|
153
153
|
tableOptions = _ref5.tableOptions,
|
|
154
|
-
getEditorFeatureFlags = _ref5.getEditorFeatureFlags
|
|
154
|
+
getEditorFeatureFlags = _ref5.getEditorFeatureFlags,
|
|
155
|
+
isTableScalingEnabled = _ref5.isTableScalingEnabled;
|
|
155
156
|
var _pluginConfig = pluginConfig(tableOptions),
|
|
156
157
|
allowColumnResizing = _pluginConfig.allowColumnResizing;
|
|
157
158
|
return allowColumnResizing ? createFlexiResizingPlugin(dispatch, {
|
|
158
159
|
lastColumnResizable: !fullWidthEnabled
|
|
159
|
-
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, editorAnalyticsAPI) : undefined;
|
|
160
|
+
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, editorAnalyticsAPI, isTableScalingEnabled || false) : undefined;
|
|
160
161
|
}
|
|
161
162
|
}, {
|
|
162
163
|
name: 'tableEditing',
|
|
@@ -234,10 +235,10 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
234
235
|
}, {
|
|
235
236
|
name: 'tableWidth',
|
|
236
237
|
plugin: function plugin(_ref13) {
|
|
237
|
-
var _options$fullWidthEna;
|
|
238
|
+
var _options$fullWidthEna, _options$isTableScali;
|
|
238
239
|
var dispatchAnalyticsEvent = _ref13.dispatchAnalyticsEvent,
|
|
239
240
|
dispatch = _ref13.dispatch;
|
|
240
|
-
return options !== null && options !== void 0 && options.tableResizingEnabled ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false) : undefined;
|
|
241
|
+
return options !== null && options !== void 0 && options.tableResizingEnabled ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false) : undefined;
|
|
241
242
|
}
|
|
242
243
|
},
|
|
243
244
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
@@ -377,7 +378,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
377
378
|
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
378
379
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
379
380
|
stickyHeaders: stickyHeader,
|
|
380
|
-
pluginConfig: pluginConfig
|
|
381
|
+
pluginConfig: pluginConfig,
|
|
382
|
+
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled
|
|
381
383
|
}), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
|
|
382
384
|
editorView: editorView,
|
|
383
385
|
selection: editorView.state.selection,
|
|
@@ -409,10 +411,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
409
411
|
var _api$table;
|
|
410
412
|
// see comment on tablesPlugin.getSharedState on usage
|
|
411
413
|
var tableState = api === null || api === void 0 || (_api$table = api.table) === null || _api$table === void 0 ? void 0 : _api$table.sharedState.currentState();
|
|
412
|
-
var
|
|
413
|
-
_getPluginState$isTab = _getPluginState.isTableScalingEnabled,
|
|
414
|
-
isTableScalingEnabled = _getPluginState$isTab === void 0 ? false : _getPluginState$isTab;
|
|
415
|
-
var tr = insert(createTableWithWidth(isTableScalingEnabled, tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled)(state.schema));
|
|
414
|
+
var tr = insert(createTableWithWidth(options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled)(state.schema));
|
|
416
415
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
417
416
|
action: ACTION.INSERTED,
|
|
418
417
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
@@ -3,6 +3,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
3
3
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
5
5
|
import { getCellsInRow, getSelectedCellInfo } from '@atlaskit/editor-tables/utils';
|
|
6
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { autoScrollForElements } from '@atlaskit/pragmatic-drag-and-drop-auto-scroll/element';
|
|
7
8
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
8
9
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
@@ -156,7 +157,11 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI) {
|
|
|
156
157
|
var _getTablePluginState4 = getTablePluginState(editorView.state),
|
|
157
158
|
_getTablePluginState5 = _getTablePluginState4.isTableScalingEnabled,
|
|
158
159
|
isTableScalingEnabled = _getTablePluginState5 === void 0 ? false : _getTablePluginState5;
|
|
159
|
-
|
|
160
|
+
var isTableScalingEnabledOnCurrentTable = isTableScalingEnabled;
|
|
161
|
+
if (isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')) {
|
|
162
|
+
isTableScalingEnabledOnCurrentTable = tableNode.attrs.displayMode !== 'fixed';
|
|
163
|
+
}
|
|
164
|
+
insertColgroupFromNode(tableRef, tableNode, isTableScalingEnabledOnCurrentTable);
|
|
160
165
|
}
|
|
161
166
|
}
|
|
162
167
|
editorView.focus();
|