@atlaskit/editor-plugin-table 12.1.13 → 12.1.15
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 +19 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-dev-agents/tsconfig.json +3 -0
- package/afm-jira/tsconfig.json +3 -0
- package/afm-passionfruit/tsconfig.json +117 -0
- package/afm-post-office/tsconfig.json +3 -0
- package/afm-rovo-extension/tsconfig.json +3 -0
- package/afm-townsquare/tsconfig.json +3 -0
- package/afm-volt/tsconfig.json +13 -4
- package/dist/cjs/nodeviews/TableComponent.js +4 -4
- package/dist/cjs/nodeviews/TableRow.js +24 -1
- package/dist/cjs/nodeviews/table-node-views.js +1 -1
- package/dist/cjs/nodeviews/table.js +10 -5
- package/dist/cjs/pm-plugins/main.js +2 -1
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +2 -7
- package/dist/es2019/nodeviews/TableComponent.js +4 -4
- package/dist/es2019/nodeviews/TableRow.js +24 -1
- package/dist/es2019/nodeviews/table-node-views.js +1 -1
- package/dist/es2019/nodeviews/table.js +9 -4
- package/dist/es2019/pm-plugins/main.js +2 -1
- package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +5 -14
- package/dist/esm/nodeviews/TableComponent.js +4 -4
- package/dist/esm/nodeviews/TableRow.js +24 -1
- package/dist/esm/nodeviews/table-node-views.js +1 -1
- package/dist/esm/nodeviews/table.js +10 -5
- package/dist/esm/pm-plugins/main.js +2 -1
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +1 -6
- package/dist/types/nodeviews/ExternalDropTargets.d.ts +1 -1
- package/dist/types/nodeviews/TableComponent.d.ts +1 -0
- package/dist/types/nodeviews/TableRow.d.ts +3 -1
- package/dist/types/nodeviews/table.d.ts +1 -1
- package/dist/types/pm-plugins/analytics/commands.d.ts +2 -2
- package/dist/types/pm-plugins/analytics/plugin-factory.d.ts +1 -1
- package/dist/types/pm-plugins/analytics/utils/moved-event.d.ts +1 -1
- package/dist/types/pm-plugins/commands/column-resize.d.ts +10 -10
- package/dist/types/pm-plugins/commands/commands-with-analytics.d.ts +1 -1
- package/dist/types/pm-plugins/commands/go-to-next-cell.d.ts +1 -1
- package/dist/types/pm-plugins/commands/misc.d.ts +2 -2
- package/dist/types/pm-plugins/commands/selection.d.ts +6 -6
- package/dist/types/pm-plugins/drag-and-drop/commands-with-analytics.d.ts +3 -3
- package/dist/types/pm-plugins/drag-and-drop/commands.d.ts +1 -1
- package/dist/types/pm-plugins/drag-and-drop/plugin-factory.d.ts +1 -1
- package/dist/types/pm-plugins/plugin-factory.d.ts +1 -1
- package/dist/types/pm-plugins/sticky-headers/plugin-state.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/plugin-factory.d.ts +1 -1
- package/dist/types/pm-plugins/utils/create.d.ts +10 -10
- package/dist/types/pm-plugins/utils/decoration.d.ts +3 -3
- package/dist/types/pm-plugins/utils/dom.d.ts +2 -2
- package/dist/types/pm-plugins/utils/drag-menu.d.ts +3 -3
- package/dist/types/pm-plugins/utils/merged-cells.d.ts +3 -2
- package/dist/types/tablePluginType.d.ts +2 -0
- package/dist/types/ui/DragHandle/index.d.ts +4 -14
- package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +1 -7
- package/dist/types/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +4 -14
- package/dist/types/ui/TableFloatingControls/RowControls/DragControls.d.ts +1 -1
- package/dist/types/ui/TableFloatingControls/index.d.ts +1 -7
- package/dist/types/ui/global-styles.d.ts +2 -8
- package/dist/types/ui/hooks/useInternalTablePluginStateSelector.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/ExternalDropTargets.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +1 -0
- package/dist/types-ts4.5/nodeviews/TableRow.d.ts +3 -1
- package/dist/types-ts4.5/nodeviews/table.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/analytics/commands.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/analytics/plugin-factory.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/analytics/utils/moved-event.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/commands/column-resize.d.ts +10 -10
- package/dist/types-ts4.5/pm-plugins/commands/commands-with-analytics.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/commands/go-to-next-cell.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/commands/misc.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/commands/selection.d.ts +6 -6
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/commands-with-analytics.d.ts +3 -3
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/commands.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/plugin-factory.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/plugin-factory.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/sticky-headers/plugin-state.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/plugin-factory.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/utils/create.d.ts +10 -10
- package/dist/types-ts4.5/pm-plugins/utils/decoration.d.ts +3 -3
- package/dist/types-ts4.5/pm-plugins/utils/dom.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/utils/drag-menu.d.ts +3 -3
- package/dist/types-ts4.5/pm-plugins/utils/merged-cells.d.ts +3 -2
- package/dist/types-ts4.5/tablePluginType.d.ts +2 -0
- package/dist/types-ts4.5/ui/DragHandle/index.d.ts +4 -14
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +1 -7
- package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +4 -14
- package/dist/types-ts4.5/ui/TableFloatingControls/RowControls/DragControls.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +1 -7
- package/dist/types-ts4.5/ui/global-styles.d.ts +2 -8
- package/dist/types-ts4.5/ui/hooks/useInternalTablePluginStateSelector.d.ts +1 -1
- package/package.json +8 -10
- package/src/nodeviews/TableComponent.tsx +8 -4
- package/src/nodeviews/TableRow.ts +38 -1
- package/src/nodeviews/table-node-views.ts +1 -1
- package/src/nodeviews/table.tsx +9 -0
- package/src/pm-plugins/main.ts +1 -1
- package/src/tablePluginType.ts +2 -0
- package/src/ui/TableFloatingControls/NumberColumn/index.tsx +5 -14
- package/tsconfig.app.json +3 -0
|
@@ -136,6 +136,7 @@ interface ComponentProps {
|
|
|
136
136
|
isTableHovered?: boolean;
|
|
137
137
|
isWholeTableInDanger?: boolean;
|
|
138
138
|
selection?: Selection;
|
|
139
|
+
limitedMode?: boolean;
|
|
139
140
|
}
|
|
140
141
|
|
|
141
142
|
interface TableState {
|
|
@@ -917,7 +918,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
917
918
|
// pass `selection` and `tableHeight` to control re-render
|
|
918
919
|
selection={view.state.selection}
|
|
919
920
|
headerRowHeight={headerRow ? headerRow.offsetHeight : undefined}
|
|
920
|
-
stickyHeader={this.state.stickyHeader}
|
|
921
|
+
stickyHeader={!this.props.limitedMode ? this.state.stickyHeader : undefined}
|
|
921
922
|
tableWrapperWidth={this.state.tableWrapperWidth}
|
|
922
923
|
api={pluginInjectionApi}
|
|
923
924
|
isChromelessEditor={options?.isChromelessEditor}
|
|
@@ -940,7 +941,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
940
941
|
// pass `selection` to control re-render
|
|
941
942
|
selection={view.state.selection}
|
|
942
943
|
headerRowHeight={headerRow ? headerRow.offsetHeight : undefined}
|
|
943
|
-
stickyHeader={this.state.stickyHeader}
|
|
944
|
+
stickyHeader={!this.props.limitedMode ? this.state.stickyHeader : undefined}
|
|
944
945
|
getEditorFeatureFlags={getEditorFeatureFlags}
|
|
945
946
|
tableContainerWidth={tableContainerWidth}
|
|
946
947
|
isNumberColumnEnabled={node.attrs.isNumberColumnEnabled}
|
|
@@ -975,7 +976,9 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
975
976
|
const topOffset = 0;
|
|
976
977
|
|
|
977
978
|
const topStickyShadowPosition =
|
|
978
|
-
this.
|
|
979
|
+
!this.props.limitedMode &&
|
|
980
|
+
this.state.stickyHeader &&
|
|
981
|
+
topOffset + this.state.stickyHeader.padding + topShadowPadding + 2;
|
|
979
982
|
|
|
980
983
|
const { tableWithFixedColumnWidthsOption = false } = getEditorFeatureFlags();
|
|
981
984
|
|
|
@@ -988,7 +991,8 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
988
991
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
989
992
|
className={classnames(ClassName.TABLE_CONTAINER, {
|
|
990
993
|
[ClassName.WITH_CONTROLS]: allowControls && tableActive,
|
|
991
|
-
[ClassName.TABLE_STICKY]:
|
|
994
|
+
[ClassName.TABLE_STICKY]:
|
|
995
|
+
!this.props.limitedMode && this.state.stickyHeader && hasHeaderRow,
|
|
992
996
|
[ClassName.HOVERED_DELETE_BUTTON]: isInDanger,
|
|
993
997
|
[ClassName.TABLE_SELECTED]: isTableSelected(selection ?? view.state.selection),
|
|
994
998
|
[ClassName.NESTED_TABLE_WITH_CONTROLS]:
|
|
@@ -20,7 +20,11 @@ import type { TableDOMElements } from '../pm-plugins/utils/dom';
|
|
|
20
20
|
import { getTop, getTree } from '../pm-plugins/utils/dom';
|
|
21
21
|
import { supportedHeaderRow } from '../pm-plugins/utils/nodes';
|
|
22
22
|
import type { TablePluginState } from '../types';
|
|
23
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
TableCssClassName as ClassName,
|
|
25
|
+
TableCssClassName,
|
|
26
|
+
type PluginInjectionAPI,
|
|
27
|
+
} from '../types';
|
|
24
28
|
import {
|
|
25
29
|
stickyHeaderBorderBottomWidth,
|
|
26
30
|
stickyRowOffsetTop,
|
|
@@ -46,11 +50,31 @@ const HEADER_ROW_SCROLL_RESET_DEBOUNCE_TIMEOUT = 400;
|
|
|
46
50
|
export default class TableRow extends TableNodeView<HTMLTableRowElement> implements NodeView {
|
|
47
51
|
private nodeVisibilityObserverCleanupFn?: () => void;
|
|
48
52
|
|
|
53
|
+
cleanup = () => {
|
|
54
|
+
if (this.isStickyHeaderEnabled) {
|
|
55
|
+
this.unsubscribe();
|
|
56
|
+
|
|
57
|
+
this.nodeVisibilityObserverCleanupFn && this.nodeVisibilityObserverCleanupFn();
|
|
58
|
+
|
|
59
|
+
const tree = getTree(this.dom);
|
|
60
|
+
if (tree) {
|
|
61
|
+
this.makeRowHeaderNotSticky(tree.table, true);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
this.emitOff(false);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (this.tableContainerObserver) {
|
|
68
|
+
this.tableContainerObserver.disconnect();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
49
72
|
constructor(
|
|
50
73
|
node: PMNode,
|
|
51
74
|
view: EditorView,
|
|
52
75
|
getPos: () => number | undefined,
|
|
53
76
|
eventDispatcher: EventDispatcher,
|
|
77
|
+
api?: PluginInjectionAPI,
|
|
54
78
|
) {
|
|
55
79
|
super(node, view, getPos, eventDispatcher);
|
|
56
80
|
|
|
@@ -60,6 +84,16 @@ export default class TableRow extends TableNodeView<HTMLTableRowElement> impleme
|
|
|
60
84
|
const { pluginConfig } = getPluginState(view.state);
|
|
61
85
|
|
|
62
86
|
this.isStickyHeaderEnabled = !!pluginConfig.stickyHeaders;
|
|
87
|
+
|
|
88
|
+
if (
|
|
89
|
+
api?.limitedMode?.sharedState.currentState()?.limitedModePluginKey.getState(view.state)
|
|
90
|
+
?.documentSizeBreachesThreshold
|
|
91
|
+
) {
|
|
92
|
+
this.isStickyHeaderEnabled = false;
|
|
93
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
94
|
+
document.addEventListener('limited-mode-activated', this.cleanup);
|
|
95
|
+
}
|
|
96
|
+
|
|
63
97
|
const pos = this.getPos();
|
|
64
98
|
this.isInNestedTable = false;
|
|
65
99
|
if (pos) {
|
|
@@ -177,6 +211,9 @@ export default class TableRow extends TableNodeView<HTMLTableRowElement> impleme
|
|
|
177
211
|
this.emitOff(true);
|
|
178
212
|
}
|
|
179
213
|
|
|
214
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
215
|
+
document.removeEventListener('limited-mode-activated', this.cleanup);
|
|
216
|
+
|
|
180
217
|
if (this.tableContainerObserver) {
|
|
181
218
|
this.tableContainerObserver.disconnect();
|
|
182
219
|
}
|
|
@@ -71,6 +71,6 @@ export const tableHeaderView = (options: TableCellViewOptions) => {
|
|
|
71
71
|
|
|
72
72
|
export const tableRowView = (options: TableCellViewOptions) => {
|
|
73
73
|
return (node: PMNode, view: EditorView, getPos: () => number | undefined) => {
|
|
74
|
-
return new TableRow(node, view, getPos, options.eventDispatcher);
|
|
74
|
+
return new TableRow(node, view, getPos, options.eventDispatcher, options.pluginInjectionApi);
|
|
75
75
|
};
|
|
76
76
|
};
|
package/src/nodeviews/table.tsx
CHANGED
|
@@ -13,6 +13,7 @@ import type {
|
|
|
13
13
|
getPosHandlerNode,
|
|
14
14
|
} from '@atlaskit/editor-common/types';
|
|
15
15
|
import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
16
|
+
import type { LimitedModePluginState } from '@atlaskit/editor-plugin-limited-mode';
|
|
16
17
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
17
18
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
18
19
|
import {
|
|
@@ -104,6 +105,10 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
104
105
|
props.portalProviderAPI,
|
|
105
106
|
props.eventDispatcher,
|
|
106
107
|
props,
|
|
108
|
+
undefined,
|
|
109
|
+
undefined,
|
|
110
|
+
// @portal-render-immediately
|
|
111
|
+
true,
|
|
107
112
|
);
|
|
108
113
|
this.getPos = props.getPos;
|
|
109
114
|
this.eventDispatcher = props.eventDispatcher;
|
|
@@ -306,6 +311,9 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
306
311
|
widthPlugin: fakePluginKey,
|
|
307
312
|
mediaState: fakeMediaPluginKey,
|
|
308
313
|
tableDragAndDropState: tableDragAndDropPluginKey,
|
|
314
|
+
|
|
315
|
+
limitedModePlugin: props.pluginInjectionApi?.limitedMode?.sharedState.currentState()
|
|
316
|
+
?.limitedModePluginKey as PluginKey<LimitedModePluginState>,
|
|
309
317
|
}}
|
|
310
318
|
editorView={props.view}
|
|
311
319
|
render={(pluginStates) => {
|
|
@@ -370,6 +378,7 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
370
378
|
getEditorFeatureFlags={props.getEditorFeatureFlags}
|
|
371
379
|
dispatchAnalyticsEvent={props.dispatchAnalyticsEvent}
|
|
372
380
|
pluginInjectionApi={props.pluginInjectionApi}
|
|
381
|
+
limitedMode={pluginStates.limitedModePlugin?.documentSizeBreachesThreshold ?? false}
|
|
373
382
|
/>
|
|
374
383
|
);
|
|
375
384
|
}}
|
package/src/pm-plugins/main.ts
CHANGED
|
@@ -145,7 +145,7 @@ export const createPlugin = (
|
|
|
145
145
|
isCommentEditor,
|
|
146
146
|
isChromelessEditor,
|
|
147
147
|
}),
|
|
148
|
-
tableRow: tableRowView({ eventDispatcher }),
|
|
148
|
+
tableRow: tableRowView({ eventDispatcher, pluginInjectionApi }),
|
|
149
149
|
tableCell: tableCellView({ eventDispatcher, pluginInjectionApi }),
|
|
150
150
|
tableHeader: tableHeaderView({ eventDispatcher, pluginInjectionApi }),
|
|
151
151
|
};
|
package/src/tablePluginType.ts
CHANGED
|
@@ -15,6 +15,7 @@ import type { ExtensionPlugin } from '@atlaskit/editor-plugin-extension';
|
|
|
15
15
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
16
16
|
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
17
17
|
import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
|
|
18
|
+
import type { LimitedModePlugin } from '@atlaskit/editor-plugin-limited-mode';
|
|
18
19
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
19
20
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
20
21
|
|
|
@@ -76,6 +77,7 @@ export type TablePluginDependencies = [
|
|
|
76
77
|
ContentInsertionPlugin,
|
|
77
78
|
WidthPlugin,
|
|
78
79
|
SelectionPlugin,
|
|
80
|
+
OptionalPlugin<LimitedModePlugin>,
|
|
79
81
|
OptionalPlugin<GuidelinePlugin>,
|
|
80
82
|
OptionalPlugin<BatchAttributeUpdatesPlugin>,
|
|
81
83
|
OptionalPlugin<AccessibilityUtilsPlugin>,
|
|
@@ -5,7 +5,6 @@ import classnames from 'classnames';
|
|
|
5
5
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import { isRowSelected } from '@atlaskit/editor-tables/utils';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
|
|
10
9
|
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
11
10
|
import { getRowHeights } from '../../../pm-plugins/utils/row-controls';
|
|
@@ -142,18 +141,10 @@ export default class NumberColumn extends Component<Props, any> {
|
|
|
142
141
|
isRowSelected(index)(editorView.state.selection) ||
|
|
143
142
|
((hoveredRows || []).indexOf(index) !== -1 && !isResizing);
|
|
144
143
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
});
|
|
151
|
-
} else {
|
|
152
|
-
return classnames(ClassName.NUMBERED_COLUMN_BUTTON, {
|
|
153
|
-
[ClassName.NUMBERED_COLUMN_BUTTON_DISABLED]: isButtonDisabled,
|
|
154
|
-
[ClassName.HOVERED_CELL_IN_DANGER]: isActive && isInDanger,
|
|
155
|
-
[ClassName.HOVERED_CELL_ACTIVE]: isActive,
|
|
156
|
-
});
|
|
157
|
-
}
|
|
144
|
+
return classnames(ClassName.NUMBERED_COLUMN_BUTTON, {
|
|
145
|
+
[ClassName.NUMBERED_COLUMN_BUTTON_DISABLED]: isButtonDisabled,
|
|
146
|
+
[ClassName.HOVERED_CELL_IN_DANGER]: tableActive && isActive && isInDanger,
|
|
147
|
+
[ClassName.HOVERED_CELL_ACTIVE]: tableActive && isActive,
|
|
148
|
+
});
|
|
158
149
|
};
|
|
159
150
|
}
|