@atlaskit/editor-plugin-table 5.1.0 → 5.2.1
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 +12 -0
- package/dist/cjs/plugins/table/index.js +3 -2
- package/dist/cjs/plugins/table/nodeviews/TableCell.js +111 -0
- package/dist/cjs/plugins/table/nodeviews/TableNodeViewBase.js +30 -0
- package/dist/cjs/plugins/table/{pm-plugins/sticky-headers/nodeviews/tableRow.js → nodeviews/TableRow.js} +363 -303
- package/dist/cjs/plugins/table/pm-plugins/main.js +16 -13
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/index.js +1 -8
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin.js +1 -9
- package/dist/cjs/plugins/table/types.js +4 -1
- package/dist/cjs/plugins/table/utils/dom.js +31 -1
- package/dist/cjs/plugins/table/utils/index.js +12 -0
- package/dist/cjs/plugins/table/utils/nodes.js +31 -7
- package/dist/es2019/plugins/table/index.js +3 -2
- package/dist/es2019/plugins/table/nodeviews/{tableCell.js → TableCell.js} +28 -24
- package/dist/es2019/plugins/table/nodeviews/TableNodeViewBase.js +22 -0
- package/dist/es2019/plugins/table/{pm-plugins/sticky-headers/nodeviews/tableRow.js → nodeviews/TableRow.js} +324 -280
- package/dist/es2019/plugins/table/pm-plugins/main.js +8 -8
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/index.js +1 -2
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/plugin.js +1 -9
- package/dist/es2019/plugins/table/types.js +5 -1
- package/dist/es2019/plugins/table/utils/dom.js +30 -0
- package/dist/es2019/plugins/table/utils/index.js +1 -1
- package/dist/es2019/plugins/table/utils/nodes.js +16 -0
- package/dist/esm/plugins/table/index.js +3 -2
- package/dist/esm/plugins/table/nodeviews/TableCell.js +105 -0
- package/dist/esm/plugins/table/nodeviews/TableNodeViewBase.js +24 -0
- package/dist/esm/plugins/table/{pm-plugins/sticky-headers/nodeviews/tableRow.js → nodeviews/TableRow.js} +364 -303
- package/dist/esm/plugins/table/pm-plugins/main.js +16 -13
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/index.js +1 -2
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/plugin.js +1 -9
- package/dist/esm/plugins/table/types.js +5 -1
- package/dist/esm/plugins/table/utils/dom.js +30 -0
- package/dist/esm/plugins/table/utils/index.js +1 -1
- package/dist/esm/plugins/table/utils/nodes.js +24 -0
- package/dist/types/plugins/table/nodeviews/TableCell.d.ts +13 -0
- package/dist/types/plugins/table/nodeviews/TableNodeViewBase.d.ts +18 -0
- package/dist/types/plugins/table/nodeviews/TableRow.d.ts +62 -0
- package/dist/types/plugins/table/pm-plugins/main.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/sticky-headers/index.d.ts +0 -1
- package/dist/types/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +1 -1
- package/dist/types/plugins/table/types.d.ts +15 -0
- package/dist/types/plugins/table/utils/dom.d.ts +6 -0
- package/dist/types/plugins/table/utils/index.d.ts +1 -1
- package/dist/types/plugins/table/utils/nodes.d.ts +12 -2
- package/dist/types-ts4.5/plugins/table/nodeviews/TableCell.d.ts +13 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/TableNodeViewBase.d.ts +18 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/TableRow.d.ts +62 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/types.d.ts +15 -0
- package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/utils/nodes.d.ts +12 -2
- package/package.json +4 -2
- package/src/__tests__/unit/nodeviews/cell.ts +2 -2
- package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +25 -148
- package/src/plugins/table/index.tsx +2 -0
- package/src/plugins/table/nodeviews/{tableCell.tsx → TableCell.ts} +41 -46
- package/src/plugins/table/nodeviews/TableNodeViewBase.ts +32 -0
- package/src/plugins/table/{pm-plugins/sticky-headers/nodeviews/tableRow.ts → nodeviews/TableRow.ts} +246 -246
- package/src/plugins/table/pm-plugins/main.ts +10 -19
- package/src/plugins/table/pm-plugins/sticky-headers/index.ts +0 -1
- package/src/plugins/table/pm-plugins/sticky-headers/plugin.ts +1 -9
- package/src/plugins/table/types.ts +18 -0
- package/src/plugins/table/utils/dom.ts +38 -0
- package/src/plugins/table/utils/index.ts +2 -0
- package/src/plugins/table/utils/nodes.ts +30 -2
- package/tsconfig.app.json +6 -0
- package/dist/cjs/plugins/table/nodeviews/tableCell.js +0 -99
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +0 -35
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +0 -29
- package/dist/esm/plugins/table/nodeviews/tableCell.js +0 -93
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +0 -29
- package/dist/types/plugins/table/nodeviews/tableCell.d.ts +0 -17
- package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.d.ts +0 -6
- package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +0 -73
- package/dist/types-ts4.5/plugins/table/nodeviews/tableCell.d.ts +0 -17
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.d.ts +0 -6
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +0 -73
- package/src/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.ts +0 -37
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/// <reference types="lodash" />
|
|
2
|
-
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
|
-
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { TablePluginState } from '../../../types';
|
|
6
|
-
import type { TableDOMElements } from './dom';
|
|
7
|
-
/**
|
|
8
|
-
* Check if a given node is a header row with this definition:
|
|
9
|
-
* - all children are tableHeader cells
|
|
10
|
-
* - no table cells have been have merged with other table row cells
|
|
11
|
-
*
|
|
12
|
-
* @param node ProseMirror node
|
|
13
|
-
* @return boolean if it meets definition
|
|
14
|
-
*/
|
|
15
|
-
export declare const supportedHeaderRow: (node: PmNode) => boolean;
|
|
16
|
-
export declare class TableRowNodeView implements NodeView {
|
|
17
|
-
view: EditorView;
|
|
18
|
-
node: PmNode;
|
|
19
|
-
getPos: () => number;
|
|
20
|
-
eventDispatcher: EventDispatcher;
|
|
21
|
-
dom: HTMLTableRowElement;
|
|
22
|
-
contentDOM: HTMLElement;
|
|
23
|
-
isHeaderRow: boolean;
|
|
24
|
-
editorScrollableElement?: HTMLElement | Window;
|
|
25
|
-
colControlsOffset: number;
|
|
26
|
-
focused: boolean;
|
|
27
|
-
topPosEditorElement: number;
|
|
28
|
-
isSticky: boolean;
|
|
29
|
-
lastStickyTimestamp: number | undefined;
|
|
30
|
-
lastTimePainted: number;
|
|
31
|
-
private intersectionObserver?;
|
|
32
|
-
private resizeObserver?;
|
|
33
|
-
private sentinels;
|
|
34
|
-
private stickyRowHeight?;
|
|
35
|
-
get tree(): TableDOMElements | null | undefined;
|
|
36
|
-
constructor(node: PmNode, view: EditorView, getPos: any, eventDispatcher: EventDispatcher);
|
|
37
|
-
listening: boolean;
|
|
38
|
-
headerRowMouseScrollEnd: import("lodash").DebouncedFunc<() => void>;
|
|
39
|
-
headerRowMouseScroll: import("lodash").DebouncedFunc<() => void>;
|
|
40
|
-
subscribe(): void;
|
|
41
|
-
unsubscribe(): void;
|
|
42
|
-
private initObservers;
|
|
43
|
-
private createResizeObserver;
|
|
44
|
-
private createIntersectionObserver;
|
|
45
|
-
previousDomTop: number | undefined;
|
|
46
|
-
previousPadding: number | undefined;
|
|
47
|
-
latestDomTop: number | undefined;
|
|
48
|
-
nextFrame: number | undefined;
|
|
49
|
-
update(node: PmNode, ..._args: any[]): boolean;
|
|
50
|
-
destroy(): void;
|
|
51
|
-
ignoreMutation(mutationRecord: MutationRecord | {
|
|
52
|
-
type: 'selection';
|
|
53
|
-
target: Element;
|
|
54
|
-
}): boolean;
|
|
55
|
-
onTablePluginState: (state: TablePluginState) => void;
|
|
56
|
-
updateStickyHeaderWidth: () => void;
|
|
57
|
-
shouldHeaderStick: (tree: TableDOMElements) => boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Manually refire the intersection observers.
|
|
60
|
-
* Useful when the header may have detached from the table.
|
|
61
|
-
*/
|
|
62
|
-
refireIntersectionObservers: () => void;
|
|
63
|
-
makeHeaderRowSticky: (tree: TableDOMElements, scrollTop?: number) => void;
|
|
64
|
-
makeRowHeaderNotSticky: (table: HTMLElement, isEditorDestroyed?: boolean) => void;
|
|
65
|
-
getWrapperoffset: (inverse?: boolean) => number;
|
|
66
|
-
getWrapperRefTop: (wrapper: HTMLElement) => number;
|
|
67
|
-
getScrolledTableTop: (wrapper: HTMLElement) => number;
|
|
68
|
-
getCurrentTableTop: (tree: TableDOMElements) => number;
|
|
69
|
-
padding: number;
|
|
70
|
-
top: number;
|
|
71
|
-
emitOn: (top: number, padding: number) => void;
|
|
72
|
-
emitOff: (isEditorDestroyed: boolean) => void;
|
|
73
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export type TableDOMElements = {
|
|
2
|
-
wrapper: HTMLDivElement;
|
|
3
|
-
table: HTMLTableElement;
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
export const getTree = (tr: HTMLTableRowElement): TableDOMElements | null => {
|
|
7
|
-
// pm renders into tbody, owned by react
|
|
8
|
-
const tbody = tr.parentElement;
|
|
9
|
-
if (!tbody) {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// rendered by react
|
|
14
|
-
const table = tbody.parentElement;
|
|
15
|
-
if (!table) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// rendered by react
|
|
20
|
-
const wrapper = table.parentElement;
|
|
21
|
-
if (!wrapper) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
wrapper: wrapper as HTMLDivElement,
|
|
27
|
-
table: table as HTMLTableElement,
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const getTop = (element: HTMLElement | Window | undefined): number => {
|
|
32
|
-
if (!element || element instanceof Window) {
|
|
33
|
-
return 0;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return element.getBoundingClientRect().top;
|
|
37
|
-
};
|