quill-table-up 2.4.2 → 3.0.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/README.md +96 -40
- package/dist/index.css +1 -1
- package/dist/index.d.ts +172 -110
- package/dist/index.js +29 -28
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +29 -28
- package/dist/index.umd.js.map +1 -1
- package/dist/table-creator.css +1 -1
- package/package.json +1 -1
- package/src/__tests__/e2e/table-align.test.ts +1 -2
- package/src/__tests__/e2e/table-blots.test.ts +45 -35
- package/src/__tests__/e2e/table-clipboard.test.ts +20 -0
- package/src/__tests__/e2e/table-hack.test.ts +5 -5
- package/src/__tests__/e2e/table-keyboard-handler.test.ts +6 -6
- package/src/__tests__/e2e/table-menu.test.ts +23 -0
- package/src/__tests__/e2e/table-selection.test.ts +3 -3
- package/src/__tests__/unit/table-blots.test.ts +26 -26
- package/src/__tests__/unit/table-caption.test.ts +33 -36
- package/src/__tests__/unit/table-cell-merge.test.ts +114 -114
- package/src/__tests__/unit/table-clipboard.test.ts +383 -19
- package/src/__tests__/unit/table-hack.test.ts +202 -144
- package/src/__tests__/unit/table-insert.test.ts +79 -79
- package/src/__tests__/unit/table-redo-undo.test.ts +495 -64
- package/src/__tests__/unit/table-remove.test.ts +8 -11
- package/src/__tests__/unit/utils.test.ts +4 -4
- package/src/__tests__/unit/utils.ts +4 -3
- package/src/formats/container-format.ts +25 -2
- package/src/formats/index.ts +54 -8
- package/src/formats/overrides/block.ts +35 -30
- package/src/formats/table-body-format.ts +18 -58
- package/src/formats/table-cell-format.ts +296 -286
- package/src/formats/table-cell-inner-format.ts +384 -358
- package/src/formats/table-foot-format.ts +7 -0
- package/src/formats/table-head-format.ts +7 -0
- package/src/formats/table-main-format.ts +84 -5
- package/src/formats/table-row-format.ts +44 -14
- package/src/modules/index.ts +1 -0
- package/src/modules/table-align.ts +59 -53
- package/src/modules/table-clipboard.ts +60 -39
- package/src/modules/table-dom-selector.ts +33 -0
- package/src/modules/table-menu/constants.ts +21 -31
- package/src/modules/table-menu/table-menu-common.ts +72 -51
- package/src/modules/table-menu/table-menu-contextmenu.ts +22 -6
- package/src/modules/table-menu/table-menu-select.ts +75 -12
- package/src/modules/table-resize/table-resize-box.ts +148 -128
- package/src/modules/table-resize/table-resize-common.ts +37 -32
- package/src/modules/table-resize/table-resize-line.ts +53 -36
- package/src/modules/table-resize/table-resize-scale.ts +32 -27
- package/src/modules/table-scrollbar.ts +58 -32
- package/src/modules/table-selection.ts +102 -79
- package/src/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/src/style/index.less +0 -1
- package/src/style/select-box.less +1 -0
- package/src/style/table-menu.less +4 -4
- package/src/style/table-resize.less +1 -0
- package/src/style/table-scrollbar.less +2 -2
- package/src/table-up.ts +161 -194
- package/src/utils/components/table/creator.ts +4 -1
- package/src/utils/components/tooltip.ts +6 -1
- package/src/utils/constants.ts +8 -2
- package/src/utils/index.ts +2 -1
- package/src/utils/scroll.ts +47 -0
- package/src/utils/style-helper.ts +47 -0
- package/src/utils/transformer.ts +0 -25
- package/src/utils/types.ts +15 -15
- package/src/utils/scroll-event-helper.ts +0 -22
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as quill2 from "quill";
|
|
2
2
|
import Quill, { EmitterSource, Parchment, Range } from "quill";
|
|
3
3
|
import { Context } from "quill/modules/keyboard";
|
|
4
4
|
import TypeScroll from "quill/blots/scroll";
|
|
@@ -19,32 +19,15 @@ declare class ContainerFormat extends Container {
|
|
|
19
19
|
static allowedChildren?: Parchment.BlotConstructor[];
|
|
20
20
|
static requiredContainer: Parchment.BlotConstructor;
|
|
21
21
|
static defaultChild?: Parchment.BlotConstructor;
|
|
22
|
+
static allowAttrs: Set<string>;
|
|
23
|
+
static allowDataAttrs: Set<string>;
|
|
24
|
+
static allowDataAttrsChangeHandler: Record<string, string>;
|
|
22
25
|
static create(_value?: unknown): HTMLElement;
|
|
26
|
+
setFormatValue(name: string, value?: any): void;
|
|
23
27
|
optimize(_context: Record<string, any>): void;
|
|
24
28
|
enforceAllowedChildren(): void;
|
|
25
29
|
}
|
|
26
30
|
//#endregion
|
|
27
|
-
//#region src/formats/table-col-format.d.ts
|
|
28
|
-
declare const BlockEmbed$2: typeof BlockEmbed;
|
|
29
|
-
declare class TableColFormat extends BlockEmbed$2 {
|
|
30
|
-
static blotName: "table-up-col";
|
|
31
|
-
static tagName: string;
|
|
32
|
-
static validWidth(width: string | number, full: boolean): string;
|
|
33
|
-
static create(value: TableColValue): HTMLElement;
|
|
34
|
-
static value(domNode: HTMLElement): Record<string, any>;
|
|
35
|
-
get width(): number;
|
|
36
|
-
set width(value: string | number);
|
|
37
|
-
get tableId(): string;
|
|
38
|
-
get colId(): string;
|
|
39
|
-
get full(): boolean;
|
|
40
|
-
set full(value: boolean);
|
|
41
|
-
get align(): string;
|
|
42
|
-
set align(value: string);
|
|
43
|
-
checkMerge(): boolean;
|
|
44
|
-
optimize(context: Record<string, any>): void;
|
|
45
|
-
insertAt(index: number, value: string, def?: any): void;
|
|
46
|
-
}
|
|
47
|
-
//#endregion
|
|
48
31
|
//#region src/formats/table-cell-inner-format.d.ts
|
|
49
32
|
declare class TableCellInnerFormat extends ContainerFormat {
|
|
50
33
|
static blotName: "table-up-cell-inner";
|
|
@@ -58,7 +41,7 @@ declare class TableCellInnerFormat extends ContainerFormat {
|
|
|
58
41
|
static create(value: TableCellValue): HTMLElement;
|
|
59
42
|
static formats(domNode: HTMLElement): Record<string, any>;
|
|
60
43
|
constructor(scroll: TypeScroll, domNode: HTMLElement, _value: TableCellValue);
|
|
61
|
-
setFormatValue(name: string, value
|
|
44
|
+
setFormatValue(name: string, value?: any, isStyle?: boolean): void;
|
|
62
45
|
clearCache(): void;
|
|
63
46
|
get tableId(): string;
|
|
64
47
|
get rowId(): string;
|
|
@@ -71,7 +54,11 @@ declare class TableCellInnerFormat extends ContainerFormat {
|
|
|
71
54
|
set colspan(value: number);
|
|
72
55
|
get emptyRow(): string[];
|
|
73
56
|
set emptyRow(value: string[]);
|
|
57
|
+
set wrapTag(value: TableBodyTag);
|
|
58
|
+
get wrapTag(): TableBodyTag;
|
|
74
59
|
getColumnIndex(): number;
|
|
60
|
+
getTableBody(): TableBodyFormat | null;
|
|
61
|
+
getTableRow(): TableRowFormat | null;
|
|
75
62
|
setStyleByString(styleStr: string): void;
|
|
76
63
|
convertTableCell(): void;
|
|
77
64
|
formatAt(index: number, length: number, name: string, value: any): void;
|
|
@@ -87,8 +74,8 @@ declare class TableCellFormat extends ContainerFormat {
|
|
|
87
74
|
static blotName: "table-up-cell";
|
|
88
75
|
static tagName: string;
|
|
89
76
|
static className: string;
|
|
90
|
-
static allowDataAttrs: Set<string>;
|
|
91
77
|
static allowAttrs: Set<string>;
|
|
78
|
+
static allowDataAttrs: Set<string>;
|
|
92
79
|
static allowStyle: Set<string>;
|
|
93
80
|
static isAllowStyle(str: string): boolean;
|
|
94
81
|
static create(value: TableCellValue): HTMLTableCellElement;
|
|
@@ -103,6 +90,7 @@ declare class TableCellFormat extends ContainerFormat {
|
|
|
103
90
|
get rowspan(): number;
|
|
104
91
|
get colspan(): number;
|
|
105
92
|
get emptyRow(): string[];
|
|
93
|
+
get wrapTag(): TableBodyTag;
|
|
106
94
|
getColumnIndex(): number;
|
|
107
95
|
getCellInner(): TableCellInnerFormat;
|
|
108
96
|
convertTableCell(): void;
|
|
@@ -118,10 +106,13 @@ declare class TableRowFormat extends ContainerFormat {
|
|
|
118
106
|
static blotName: "table-up-row";
|
|
119
107
|
static tagName: string;
|
|
120
108
|
static className: string;
|
|
109
|
+
static allowDataAttrs: Set<string>;
|
|
110
|
+
static allowDataAttrsChangeHandler: Record<string, keyof TableRowFormat>;
|
|
121
111
|
static create(value: TableRowValue): HTMLElement;
|
|
122
112
|
children: Parchment.LinkedList<TableCellFormat>;
|
|
123
113
|
get rowId(): string;
|
|
124
114
|
get tableId(): string;
|
|
115
|
+
get wrapTag(): TableBodyTag;
|
|
125
116
|
setHeight(value: string): void;
|
|
126
117
|
getCellByColId(colId: string, direction: 'next' | 'prev'): TableCellFormat | null;
|
|
127
118
|
insertCell(targetIndex: number, value: TableCellValue): SkipRowCount;
|
|
@@ -129,9 +120,55 @@ declare class TableRowFormat extends ContainerFormat {
|
|
|
129
120
|
removeCell(targetIndex: number): SkipRowCount;
|
|
130
121
|
foreachCellInner(func: (tableCell: TableCellInnerFormat, index: number) => boolean | void): void;
|
|
131
122
|
checkMerge(): boolean;
|
|
123
|
+
wrapParentTag(): void;
|
|
132
124
|
optimize(_context: Record<string, any>): void;
|
|
133
125
|
}
|
|
134
126
|
//#endregion
|
|
127
|
+
//#region src/formats/table-body-format.d.ts
|
|
128
|
+
declare class TableBodyFormat extends ContainerFormat {
|
|
129
|
+
static blotName: string;
|
|
130
|
+
static tagName: string;
|
|
131
|
+
static create(value: string): HTMLElement;
|
|
132
|
+
get tableId(): string;
|
|
133
|
+
checkMerge(): boolean;
|
|
134
|
+
optimize(context: Record<string, any>): void;
|
|
135
|
+
convertBody(tag: TableBodyTag): void;
|
|
136
|
+
getRows(): TableRowFormat[];
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
139
|
+
//#region src/formats/table-foot-format.d.ts
|
|
140
|
+
declare class TableFootFormat extends TableBodyFormat {
|
|
141
|
+
static blotName: "table-up-foot";
|
|
142
|
+
static tagName: string;
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/formats/table-head-format.d.ts
|
|
146
|
+
declare class TableHeadFormat extends TableBodyFormat {
|
|
147
|
+
static blotName: "table-up-head";
|
|
148
|
+
static tagName: string;
|
|
149
|
+
}
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region src/formats/table-col-format.d.ts
|
|
152
|
+
declare const BlockEmbed$2: typeof BlockEmbed;
|
|
153
|
+
declare class TableColFormat extends BlockEmbed$2 {
|
|
154
|
+
static blotName: "table-up-col";
|
|
155
|
+
static tagName: string;
|
|
156
|
+
static validWidth(width: string | number, full: boolean): string;
|
|
157
|
+
static create(value: TableColValue): HTMLElement;
|
|
158
|
+
static value(domNode: HTMLElement): Record<string, any>;
|
|
159
|
+
get width(): number;
|
|
160
|
+
set width(value: string | number);
|
|
161
|
+
get tableId(): string;
|
|
162
|
+
get colId(): string;
|
|
163
|
+
get full(): boolean;
|
|
164
|
+
set full(value: boolean);
|
|
165
|
+
get align(): string;
|
|
166
|
+
set align(value: string);
|
|
167
|
+
checkMerge(): boolean;
|
|
168
|
+
optimize(context: Record<string, any>): void;
|
|
169
|
+
insertAt(index: number, value: string, def?: any): void;
|
|
170
|
+
}
|
|
171
|
+
//#endregion
|
|
135
172
|
//#region src/formats/table-main-format.d.ts
|
|
136
173
|
declare class TableMainFormat extends ContainerFormat {
|
|
137
174
|
scroll: TypeScroll;
|
|
@@ -149,6 +186,7 @@ declare class TableMainFormat extends ContainerFormat {
|
|
|
149
186
|
setFull(): void;
|
|
150
187
|
cancelFull(): void;
|
|
151
188
|
updateAlign(): void;
|
|
189
|
+
getBodys(): TableBodyFormat[];
|
|
152
190
|
getRows(): TableRowFormat[];
|
|
153
191
|
getRowIds(): string[];
|
|
154
192
|
getCols(): TableColFormat[];
|
|
@@ -159,17 +197,7 @@ declare class TableMainFormat extends ContainerFormat {
|
|
|
159
197
|
checkEmptyCol(autoMerge: boolean): void;
|
|
160
198
|
checkEmptyRow(autoMerge: boolean): void;
|
|
161
199
|
sortMergeChildren(): void;
|
|
162
|
-
}
|
|
163
|
-
//#endregion
|
|
164
|
-
//#region src/formats/table-body-format.d.ts
|
|
165
|
-
declare class TableBodyFormat extends ContainerFormat {
|
|
166
|
-
static blotName: "table-up-body";
|
|
167
|
-
static tagName: string;
|
|
168
|
-
static create(value: string): HTMLElement;
|
|
169
|
-
get tableId(): string;
|
|
170
200
|
insertRow(targetIndex: number): void;
|
|
171
|
-
checkMerge(): boolean;
|
|
172
|
-
optimize(context: Record<string, any>): void;
|
|
173
201
|
}
|
|
174
202
|
//#endregion
|
|
175
203
|
//#region src/formats/overrides/block.d.ts
|
|
@@ -182,7 +210,7 @@ declare class BlockOverride extends Block {
|
|
|
182
210
|
//#region src/formats/overrides/block-embed.d.ts
|
|
183
211
|
declare const BlockEmbed$1: typeof BlockEmbed;
|
|
184
212
|
declare class BlockEmbedOverride extends BlockEmbed$1 {
|
|
185
|
-
delta():
|
|
213
|
+
delta(): quill2.Delta;
|
|
186
214
|
length(): number;
|
|
187
215
|
}
|
|
188
216
|
//#endregion
|
|
@@ -250,11 +278,10 @@ declare class TableWrapperFormat extends ContainerFormat {
|
|
|
250
278
|
//#endregion
|
|
251
279
|
//#region src/formats/index.d.ts
|
|
252
280
|
declare function getTableMainRect(tableMainBlot: TableMainFormat): {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
rect: DOMRect;
|
|
281
|
+
rect: DOMRect | null;
|
|
282
|
+
head: TableHeadFormat | null;
|
|
283
|
+
body: TableBodyFormat | null;
|
|
284
|
+
foot: TableFootFormat | null;
|
|
258
285
|
};
|
|
259
286
|
//#endregion
|
|
260
287
|
//#region src/utils/constants.d.ts
|
|
@@ -265,7 +292,9 @@ declare const blotName: {
|
|
|
265
292
|
readonly tableMain: "table-up-main";
|
|
266
293
|
readonly tableColgroup: "table-up-colgroup";
|
|
267
294
|
readonly tableCol: "table-up-col";
|
|
295
|
+
readonly tableHead: "table-up-head";
|
|
268
296
|
readonly tableBody: "table-up-body";
|
|
297
|
+
readonly tableFoot: "table-up-foot";
|
|
269
298
|
readonly tableRow: "table-up-row";
|
|
270
299
|
readonly tableCell: "table-up-cell";
|
|
271
300
|
readonly tableCellInner: "table-up-cell-inner";
|
|
@@ -278,19 +307,36 @@ declare const tableUpSize: {
|
|
|
278
307
|
};
|
|
279
308
|
declare const tableUpEvent: {
|
|
280
309
|
AFTER_TABLE_RESIZE: string;
|
|
310
|
+
TABLE_SELECTION_DRAG_START: string;
|
|
311
|
+
TABLE_SELECTION_DRAG_END: string;
|
|
312
|
+
TABLE_SELECTION_CHANGE: string;
|
|
313
|
+
TABLE_SELECTION_DISPLAY_CHANGE: string;
|
|
281
314
|
};
|
|
282
315
|
declare const tableUpInternal: {
|
|
283
316
|
moduleName: string;
|
|
284
317
|
};
|
|
285
318
|
//#endregion
|
|
319
|
+
//#region src/modules/table-dom-selector.d.ts
|
|
320
|
+
declare class TableDomSelector {
|
|
321
|
+
tableModule: TableUp;
|
|
322
|
+
quill: Quill;
|
|
323
|
+
table?: HTMLTableElement;
|
|
324
|
+
constructor(tableModule: TableUp, quill: Quill);
|
|
325
|
+
tableSelectHandler(event: MouseEvent): void;
|
|
326
|
+
setSelectionTable(table: HTMLTableElement | undefined): void;
|
|
327
|
+
hide(): void;
|
|
328
|
+
show(): void;
|
|
329
|
+
update(): void;
|
|
330
|
+
}
|
|
331
|
+
//#endregion
|
|
286
332
|
//#region src/modules/table-align.d.ts
|
|
287
|
-
declare class TableAlign {
|
|
333
|
+
declare class TableAlign extends TableDomSelector {
|
|
288
334
|
tableModule: TableUp;
|
|
289
|
-
table: HTMLElement;
|
|
290
335
|
quill: Quill;
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
336
|
+
static moduleName: string;
|
|
337
|
+
tableBlot?: TableMainFormat;
|
|
338
|
+
tableWrapperBlot?: TableWrapperFormat;
|
|
339
|
+
alignBox: HTMLElement | null;
|
|
294
340
|
cleanup?: () => void;
|
|
295
341
|
bem: {
|
|
296
342
|
b: () => string;
|
|
@@ -302,10 +348,11 @@ declare class TableAlign {
|
|
|
302
348
|
cv: (v?: string) => string;
|
|
303
349
|
is: (n: string) => string;
|
|
304
350
|
};
|
|
305
|
-
resizeObserver
|
|
306
|
-
constructor(tableModule: TableUp,
|
|
307
|
-
updateWhenTextChange: () => void;
|
|
308
|
-
|
|
351
|
+
resizeObserver?: ResizeObserver;
|
|
352
|
+
constructor(tableModule: TableUp, quill: Quill, _options: any);
|
|
353
|
+
updateWhenTextChange: (eventName: string) => void;
|
|
354
|
+
buildTools(): HTMLElement;
|
|
355
|
+
handleAlignItemClick(e: MouseEvent): void;
|
|
309
356
|
setTableAlign(tableBlot: TableMainFormat, align: string): void;
|
|
310
357
|
show(): void;
|
|
311
358
|
hide(): void;
|
|
@@ -332,8 +379,11 @@ declare class TableClipboard extends Clipboard {
|
|
|
332
379
|
cellCount: number;
|
|
333
380
|
colCount: number;
|
|
334
381
|
constructor(quill: Quill, options: Partial<ClipboardOptions>);
|
|
382
|
+
getStyleBackgroundColor(node: Node, delta: Delta): void;
|
|
335
383
|
matchTable(node: Node, delta: Delta): Delta;
|
|
336
384
|
matchTbody(node: Node, delta: Delta): Delta;
|
|
385
|
+
matchThead(node: Node, delta: Delta): Delta;
|
|
386
|
+
matchTfoot(node: Node, delta: Delta): Delta;
|
|
337
387
|
matchColgroup(node: Node, delta: Delta): Delta;
|
|
338
388
|
matchCol(node: Node, _delta: Delta): Delta;
|
|
339
389
|
matchTr(node: Node, delta: Delta): Delta;
|
|
@@ -357,15 +407,15 @@ type TableMenuOptionsInput = Partial<Omit<TableMenuOptions, 'texts'>>;
|
|
|
357
407
|
interface MenuTooltipInstance extends TooltipInstance {
|
|
358
408
|
isColorPick?: boolean;
|
|
359
409
|
}
|
|
360
|
-
declare class TableMenuCommon {
|
|
410
|
+
declare class TableMenuCommon extends TableDomSelector {
|
|
361
411
|
tableModule: TableUp;
|
|
362
412
|
quill: Quill;
|
|
413
|
+
static moduleName: string;
|
|
363
414
|
usedColors: Set<string>;
|
|
364
415
|
options: TableMenuOptions;
|
|
365
416
|
menu: HTMLElement | null;
|
|
366
417
|
isMenuDisplay: boolean;
|
|
367
418
|
isColorPicking: boolean;
|
|
368
|
-
updateUsedColor: (this: any, color?: string) => void;
|
|
369
419
|
tooltipItem: MenuTooltipInstance[];
|
|
370
420
|
activeTooltip: MenuTooltipInstance | null;
|
|
371
421
|
bem: {
|
|
@@ -381,7 +431,9 @@ declare class TableMenuCommon {
|
|
|
381
431
|
colorItemClass: string;
|
|
382
432
|
colorChooseTooltipOption: ToolTipOptions;
|
|
383
433
|
constructor(tableModule: TableUp, quill: Quill, options: TableMenuOptionsInput);
|
|
384
|
-
|
|
434
|
+
updateUsedColor: (this: any, color?: string | undefined) => void;
|
|
435
|
+
hideWhenSelectionDragStart: () => void;
|
|
436
|
+
updateWhenTextChange: (eventName: string) => void;
|
|
385
437
|
resolveOptions(options: TableMenuOptionsInput): TableMenuOptions;
|
|
386
438
|
buildTools(): HTMLElement;
|
|
387
439
|
createColorChoose(item: HTMLElement, {
|
|
@@ -404,6 +456,7 @@ declare class TableMenuContextmenu extends TableMenuCommon {
|
|
|
404
456
|
quill: Quill;
|
|
405
457
|
colorChooseTooltipOption: ToolTipOptions;
|
|
406
458
|
constructor(tableModule: TableUp, quill: Quill, options: TableMenuOptionsInput$1);
|
|
459
|
+
tableSelectioChange: (tableSelection: InternalTableSelectionModule) => void;
|
|
407
460
|
listenContextmenu: (e: MouseEvent) => void;
|
|
408
461
|
buildTools(): HTMLElement;
|
|
409
462
|
createTipText(item: HTMLElement, text: string): void;
|
|
@@ -420,7 +473,14 @@ declare class TableMenuSelect extends TableMenuCommon {
|
|
|
420
473
|
tableModule: TableUp;
|
|
421
474
|
quill: Quill;
|
|
422
475
|
constructor(tableModule: TableUp, quill: Quill, options: TableMenuOptionsInput);
|
|
476
|
+
tableSelectionDragStart: () => void;
|
|
477
|
+
tableSelectionDragEnd: (tableSelection: InternalTableSelectionModule) => void;
|
|
478
|
+
tableSelectioChange: (tableSelection: InternalTableSelectionModule, selectedTds: TableCellInnerFormat[]) => void;
|
|
479
|
+
tableSelectionDisplayChange: (tableSelection: InternalTableSelectionModule) => void;
|
|
480
|
+
buildTools(): HTMLElement;
|
|
481
|
+
show(): void;
|
|
423
482
|
update(): void;
|
|
483
|
+
destroy(): void;
|
|
424
484
|
}
|
|
425
485
|
//#endregion
|
|
426
486
|
//#region src/modules/table-resize/table-resize-common.d.ts
|
|
@@ -428,11 +488,12 @@ interface sizeChangeValue {
|
|
|
428
488
|
px: number;
|
|
429
489
|
pre: number;
|
|
430
490
|
}
|
|
431
|
-
declare class TableResizeCommon {
|
|
491
|
+
declare class TableResizeCommon extends TableDomSelector {
|
|
432
492
|
tableModule: TableUp;
|
|
433
493
|
quill: Quill;
|
|
494
|
+
static moduleName: string;
|
|
434
495
|
colIndex: number;
|
|
435
|
-
|
|
496
|
+
tableBlot?: TableMainFormat;
|
|
436
497
|
dragging: boolean;
|
|
437
498
|
dragColBreak: HTMLElement | null;
|
|
438
499
|
handleColMouseUpFunc: () => Promise<void>;
|
|
@@ -513,11 +574,10 @@ declare class TableResizeCommon {
|
|
|
513
574
|
//#region src/modules/table-resize/table-resize-box.d.ts
|
|
514
575
|
declare class TableResizeBox extends TableResizeCommon {
|
|
515
576
|
tableModule: TableUp;
|
|
516
|
-
|
|
577
|
+
quill: Quill;
|
|
517
578
|
root: HTMLElement;
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
resizeObserver: ResizeObserver;
|
|
579
|
+
tableWrapperBlot?: TableWrapperFormat;
|
|
580
|
+
resizeObserver?: ResizeObserver;
|
|
521
581
|
tableCols: TableColFormat[];
|
|
522
582
|
tableRows: TableRowFormat[];
|
|
523
583
|
rowHeadWrapper: HTMLElement | null;
|
|
@@ -539,8 +599,9 @@ declare class TableResizeBox extends TableResizeCommon {
|
|
|
539
599
|
cv: (v?: string) => string;
|
|
540
600
|
is: (n: string) => string;
|
|
541
601
|
};
|
|
542
|
-
constructor(tableModule: TableUp,
|
|
543
|
-
updateWhenTextChange: () => void;
|
|
602
|
+
constructor(tableModule: TableUp, quill: Quill, _options: any);
|
|
603
|
+
updateWhenTextChange: (eventName: string) => void;
|
|
604
|
+
setSelectionTable(table: HTMLTableElement | undefined): void;
|
|
544
605
|
handleResizerHeader(isX: boolean, index: number, e: MouseEvent): void;
|
|
545
606
|
findCurrentColIndex(e: MouseEvent): number;
|
|
546
607
|
colWidthChange(i: number, w: sizeChangeValue, isFull: boolean): void;
|
|
@@ -567,9 +628,9 @@ declare class TableResizeBox extends TableResizeCommon {
|
|
|
567
628
|
//#region src/modules/table-resize/table-resize-line.d.ts
|
|
568
629
|
declare class TableResizeLine extends TableResizeCommon {
|
|
569
630
|
tableModule: TableUp;
|
|
570
|
-
|
|
571
|
-
colResizer
|
|
572
|
-
rowResizer
|
|
631
|
+
quill: Quill;
|
|
632
|
+
colResizer?: HTMLElement;
|
|
633
|
+
rowResizer?: HTMLElement;
|
|
573
634
|
currentTableCell?: HTMLElement;
|
|
574
635
|
dragging: boolean;
|
|
575
636
|
curColIndex: number;
|
|
@@ -585,9 +646,9 @@ declare class TableResizeLine extends TableResizeCommon {
|
|
|
585
646
|
cv: (v?: string) => string;
|
|
586
647
|
is: (n: string) => string;
|
|
587
648
|
};
|
|
588
|
-
constructor(tableModule: TableUp,
|
|
649
|
+
constructor(tableModule: TableUp, quill: Quill, _options: any);
|
|
650
|
+
updateWhenTextChange: (eventName: string) => void;
|
|
589
651
|
mousemoveHandler: (e: MouseEvent) => void;
|
|
590
|
-
hideWhenTextChange: () => void;
|
|
591
652
|
findTableCell(e: MouseEvent): HTMLElement | null;
|
|
592
653
|
findCurrentColIndex(): number;
|
|
593
654
|
handleColMouseUpFunc: () => Promise<void>;
|
|
@@ -602,13 +663,12 @@ declare class TableResizeLine extends TableResizeCommon {
|
|
|
602
663
|
}
|
|
603
664
|
//#endregion
|
|
604
665
|
//#region src/modules/table-resize/table-resize-scale.d.ts
|
|
605
|
-
declare class TableResizeScale {
|
|
666
|
+
declare class TableResizeScale extends TableDomSelector {
|
|
606
667
|
tableModule: TableUp;
|
|
607
|
-
table: HTMLElement;
|
|
608
668
|
quill: Quill;
|
|
609
669
|
scrollHandler: [HTMLElement, (e: Event) => void][];
|
|
610
|
-
tableMainBlot
|
|
611
|
-
tableWrapperBlot
|
|
670
|
+
tableMainBlot?: TableMainFormat;
|
|
671
|
+
tableWrapperBlot?: TableWrapperFormat;
|
|
612
672
|
bem: {
|
|
613
673
|
b: () => string;
|
|
614
674
|
be: (e?: string) => string;
|
|
@@ -626,8 +686,8 @@ declare class TableResizeScale {
|
|
|
626
686
|
root?: HTMLElement;
|
|
627
687
|
block?: HTMLElement;
|
|
628
688
|
resizeobserver: ResizeObserver;
|
|
629
|
-
constructor(tableModule: TableUp,
|
|
630
|
-
updateWhenTextChange: () => void;
|
|
689
|
+
constructor(tableModule: TableUp, quill: Quill, options: Partial<TableResizeScaleOptions>);
|
|
690
|
+
updateWhenTextChange: (eventName: string) => void;
|
|
631
691
|
resolveOptions(options: Partial<TableResizeScaleOptions>): {
|
|
632
692
|
blockSize: number;
|
|
633
693
|
} & Partial<TableResizeScaleOptions>;
|
|
@@ -645,9 +705,10 @@ declare const isTableAlignRight: (tableMainBlot: TableMainFormat) => boolean;
|
|
|
645
705
|
//#region src/modules/table-scrollbar.d.ts
|
|
646
706
|
declare class Scrollbar {
|
|
647
707
|
quill: Quill;
|
|
648
|
-
isVertical: boolean;
|
|
649
708
|
table: HTMLElement;
|
|
650
|
-
|
|
709
|
+
options: {
|
|
710
|
+
isVertical: boolean;
|
|
711
|
+
};
|
|
651
712
|
minSize: number;
|
|
652
713
|
gap: number;
|
|
653
714
|
move: number;
|
|
@@ -695,7 +756,10 @@ declare class Scrollbar {
|
|
|
695
756
|
is: (n: string) => string;
|
|
696
757
|
};
|
|
697
758
|
tableMainBlot: TableMainFormat;
|
|
698
|
-
|
|
759
|
+
get isVertical(): boolean;
|
|
760
|
+
constructor(quill: Quill, table: HTMLElement, options: {
|
|
761
|
+
isVertical: boolean;
|
|
762
|
+
});
|
|
699
763
|
update(): void;
|
|
700
764
|
setScrollbarPosition(): void;
|
|
701
765
|
calculateSize(): void;
|
|
@@ -706,10 +770,10 @@ declare class Scrollbar {
|
|
|
706
770
|
hideScrollbarTransitionend: () => void;
|
|
707
771
|
destroy(): void;
|
|
708
772
|
}
|
|
709
|
-
declare class TableVirtualScrollbar {
|
|
773
|
+
declare class TableVirtualScrollbar extends TableDomSelector {
|
|
710
774
|
tableModule: TableUp;
|
|
711
|
-
table: HTMLElement;
|
|
712
775
|
quill: Quill;
|
|
776
|
+
static moduleName: string;
|
|
713
777
|
scrollbarContainer: HTMLElement;
|
|
714
778
|
scrollbar: Scrollbar[];
|
|
715
779
|
bem: {
|
|
@@ -722,8 +786,8 @@ declare class TableVirtualScrollbar {
|
|
|
722
786
|
cv: (v?: string) => string;
|
|
723
787
|
is: (n: string) => string;
|
|
724
788
|
};
|
|
725
|
-
constructor(tableModule: TableUp,
|
|
726
|
-
updateWhenTextChange: () => void;
|
|
789
|
+
constructor(tableModule: TableUp, quill: Quill, _options: any);
|
|
790
|
+
updateWhenTextChange: (eventName: string) => void;
|
|
727
791
|
hide(): void;
|
|
728
792
|
show(): void;
|
|
729
793
|
update(): void;
|
|
@@ -737,9 +801,10 @@ interface SelectionData {
|
|
|
737
801
|
focusNode: Node | null;
|
|
738
802
|
focusOffset: number;
|
|
739
803
|
}
|
|
740
|
-
declare class TableSelection {
|
|
804
|
+
declare class TableSelection extends TableDomSelector {
|
|
741
805
|
tableModule: TableUp;
|
|
742
806
|
quill: Quill;
|
|
807
|
+
static moduleName: string;
|
|
743
808
|
options: TableSelectionOptions;
|
|
744
809
|
boundary: RelactiveRect | null;
|
|
745
810
|
scrollRecordEls: HTMLElement[];
|
|
@@ -754,11 +819,8 @@ declare class TableSelection {
|
|
|
754
819
|
selectedTds: TableCellInnerFormat[];
|
|
755
820
|
cellSelectWrap: HTMLElement;
|
|
756
821
|
cellSelect: HTMLElement;
|
|
757
|
-
dragging: boolean;
|
|
758
822
|
scrollHandler: [HTMLElement, (...args: any[]) => void][];
|
|
759
|
-
tableMenu?: InternalTableMenuModule;
|
|
760
823
|
resizeObserver: ResizeObserver;
|
|
761
|
-
table?: HTMLTableElement;
|
|
762
824
|
isDisplaySelection: boolean;
|
|
763
825
|
bem: {
|
|
764
826
|
b: () => string;
|
|
@@ -771,8 +833,14 @@ declare class TableSelection {
|
|
|
771
833
|
is: (n: string) => string;
|
|
772
834
|
};
|
|
773
835
|
lastSelection: SelectionData;
|
|
836
|
+
_dragging: boolean;
|
|
837
|
+
set dragging(val: boolean);
|
|
838
|
+
get dragging(): boolean;
|
|
774
839
|
constructor(tableModule: TableUp, quill: Quill, options?: Partial<TableSelectionOptions>);
|
|
840
|
+
updateWhenTextChange: (eventName: string) => void;
|
|
775
841
|
updateAfterEvent: () => void;
|
|
842
|
+
removeCell: (e: KeyboardEvent) => void;
|
|
843
|
+
setSelectedTds(tds: TableCellInnerFormat[]): void;
|
|
776
844
|
getFirstTextNode(dom: HTMLElement | Node): Node;
|
|
777
845
|
getLastTextNode(dom: HTMLElement | Node): Node;
|
|
778
846
|
getNodeTailOffset(node: Node): number;
|
|
@@ -789,7 +857,7 @@ declare class TableSelection {
|
|
|
789
857
|
endOffset: number;
|
|
790
858
|
};
|
|
791
859
|
resolveOptions(options: Partial<TableSelectionOptions>): TableSelectionOptions;
|
|
792
|
-
selectionChangeHandler
|
|
860
|
+
selectionChangeHandler(): void;
|
|
793
861
|
helpLinesInitial(): HTMLDivElement;
|
|
794
862
|
computeSelectedTds(startPoint: {
|
|
795
863
|
x: number;
|
|
@@ -804,15 +872,14 @@ declare class TableSelection {
|
|
|
804
872
|
};
|
|
805
873
|
recordScrollPosition(): void;
|
|
806
874
|
clearRecordScrollPosition(): void;
|
|
807
|
-
|
|
875
|
+
tableSelectHandler(mousedownEvent: MouseEvent): void;
|
|
808
876
|
updateWithSelectedTds(): void;
|
|
809
877
|
update(): void;
|
|
810
878
|
getTableViewScroll(): {
|
|
811
|
-
y: number;
|
|
812
879
|
x: number;
|
|
880
|
+
y: number;
|
|
813
881
|
};
|
|
814
882
|
setSelectionTable(table: HTMLTableElement | undefined): void;
|
|
815
|
-
removeCell: (e: KeyboardEvent) => void;
|
|
816
883
|
showDisplay(): void;
|
|
817
884
|
show(): void;
|
|
818
885
|
hideDisplay(): void;
|
|
@@ -833,7 +900,7 @@ interface ToolOption {
|
|
|
833
900
|
tip?: string;
|
|
834
901
|
isColorChoose?: boolean;
|
|
835
902
|
key?: string;
|
|
836
|
-
handle: (tableModule: TableUp, selectedTds: TableCellInnerFormat[], e: Event | string | null) => void;
|
|
903
|
+
handle: (this: TableMenuCommon, tableModule: TableUp, selectedTds: TableCellInnerFormat[], e: Event | string | null) => void;
|
|
837
904
|
}
|
|
838
905
|
interface ToolOptionBreak {
|
|
839
906
|
name: 'break';
|
|
@@ -847,8 +914,6 @@ interface TableMenuOptions {
|
|
|
847
914
|
}
|
|
848
915
|
interface TableSelectionOptions {
|
|
849
916
|
selectColor: string;
|
|
850
|
-
tableMenu?: Constructor<InternalTableMenuModule, [TableUp, Quill, Partial<TableMenuOptions>]>;
|
|
851
|
-
tableMenuOptions: TableMenuOptions;
|
|
852
917
|
}
|
|
853
918
|
interface TableResizeScaleOptions {
|
|
854
919
|
blockSize: number;
|
|
@@ -870,6 +935,13 @@ interface TableTextOptions extends TableCreatorTextOptions, TableMenuTexts {
|
|
|
870
935
|
transparent: string;
|
|
871
936
|
perWidthInsufficient: string;
|
|
872
937
|
}
|
|
938
|
+
interface TableUpExtraModule extends Constructor<any, [TableUp, Quill, any]> {
|
|
939
|
+
moduleName: string;
|
|
940
|
+
}
|
|
941
|
+
interface TableUpModule {
|
|
942
|
+
module: TableUpExtraModule;
|
|
943
|
+
options?: any;
|
|
944
|
+
}
|
|
873
945
|
interface TableUpOptions {
|
|
874
946
|
customSelect?: (tableModule: TableUp, picker: QuillThemePicker) => Promise<HTMLElement> | HTMLElement;
|
|
875
947
|
full: boolean;
|
|
@@ -877,17 +949,8 @@ interface TableUpOptions {
|
|
|
877
949
|
customBtn: boolean;
|
|
878
950
|
texts: TableTextOptions;
|
|
879
951
|
icon: string;
|
|
880
|
-
selection?: Constructor<InternalTableSelectionModule, [TableUp, Quill, Partial<TableSelectionOptions>]>;
|
|
881
|
-
selectionOptions: Partial<TableSelectionOptions>;
|
|
882
|
-
resize?: Constructor<InternalModule, [TableUp, HTMLElement, Quill, any]>;
|
|
883
|
-
resizeOptions: any;
|
|
884
|
-
scrollbar?: Constructor<InternalModule, [TableUp, HTMLElement, Quill, any]>;
|
|
885
|
-
scrollbarOptions: any;
|
|
886
|
-
align?: Constructor<InternalModule, [TableUp, HTMLElement, Quill, any]>;
|
|
887
|
-
alignOptions: any;
|
|
888
|
-
resizeScale?: Constructor<InternalModule, [TableUp, HTMLElement, Quill, Partial<TableResizeScaleOptions>]>;
|
|
889
|
-
resizeScaleOptions: Partial<TableResizeScaleOptions>;
|
|
890
952
|
autoMergeCell: boolean;
|
|
953
|
+
modules: TableUpModule[];
|
|
891
954
|
}
|
|
892
955
|
interface TableColValue {
|
|
893
956
|
tableId: string;
|
|
@@ -896,6 +959,7 @@ interface TableColValue {
|
|
|
896
959
|
full?: boolean;
|
|
897
960
|
align?: string;
|
|
898
961
|
}
|
|
962
|
+
type TableBodyTag = 'thead' | 'tbody' | 'tfoot';
|
|
899
963
|
interface TableCellValue {
|
|
900
964
|
tableId: string;
|
|
901
965
|
rowId: string;
|
|
@@ -905,10 +969,12 @@ interface TableCellValue {
|
|
|
905
969
|
style?: string;
|
|
906
970
|
emptyRow?: string[];
|
|
907
971
|
tag?: 'td' | 'th';
|
|
972
|
+
wrapTag?: TableBodyTag;
|
|
908
973
|
}
|
|
909
974
|
interface TableRowValue {
|
|
910
975
|
tableId: string;
|
|
911
976
|
rowId: string;
|
|
977
|
+
wrapTag?: TableBodyTag;
|
|
912
978
|
}
|
|
913
979
|
interface TableCaptionValue {
|
|
914
980
|
tableId: string;
|
|
@@ -928,6 +994,7 @@ interface RelactiveRect {
|
|
|
928
994
|
height: number;
|
|
929
995
|
}
|
|
930
996
|
interface InternalModule {
|
|
997
|
+
table?: HTMLElement;
|
|
931
998
|
show: () => void;
|
|
932
999
|
hide: () => void;
|
|
933
1000
|
update: () => void;
|
|
@@ -935,7 +1002,6 @@ interface InternalModule {
|
|
|
935
1002
|
}
|
|
936
1003
|
type Constructor<T = any, U extends Array<any> = any[]> = new (...args: U) => T;
|
|
937
1004
|
interface InternalTableSelectionModule extends InternalModule {
|
|
938
|
-
table?: HTMLElement;
|
|
939
1005
|
dragging: boolean;
|
|
940
1006
|
boundary: RelactiveRect | null;
|
|
941
1007
|
selectedTds: TableCellInnerFormat[];
|
|
@@ -949,6 +1015,7 @@ interface InternalTableSelectionModule extends InternalModule {
|
|
|
949
1015
|
x: number;
|
|
950
1016
|
y: number;
|
|
951
1017
|
}) => TableCellInnerFormat[];
|
|
1018
|
+
setSelectedTds: (tds: TableCellInnerFormat[]) => void;
|
|
952
1019
|
updateWithSelectedTds: () => void;
|
|
953
1020
|
showDisplay: () => void;
|
|
954
1021
|
hideDisplay: () => void;
|
|
@@ -1080,13 +1147,8 @@ declare class TableUp {
|
|
|
1080
1147
|
toolBox: HTMLDivElement;
|
|
1081
1148
|
fixTableByLisenter: (this: any) => void;
|
|
1082
1149
|
selector?: HTMLElement;
|
|
1083
|
-
table?: HTMLElement;
|
|
1084
|
-
tableSelection?: InternalTableSelectionModule;
|
|
1085
|
-
tableResize?: InternalModule;
|
|
1086
|
-
tableScrollbar?: InternalModule;
|
|
1087
|
-
tableAlign?: InternalModule;
|
|
1088
|
-
tableResizeScale?: InternalModule;
|
|
1089
1150
|
resizeOb: ResizeObserver;
|
|
1151
|
+
modules: Record<string, Constructor>;
|
|
1090
1152
|
get statics(): any;
|
|
1091
1153
|
constructor(quill: Quill, options: Partial<TableUpOptions>);
|
|
1092
1154
|
initialContainer(): HTMLDivElement;
|
|
@@ -1118,14 +1180,14 @@ declare class TableUp {
|
|
|
1118
1180
|
BackgroundColor: string;
|
|
1119
1181
|
BorderColor: string;
|
|
1120
1182
|
} & Partial<TableTextOptions>;
|
|
1183
|
+
initModules(): void;
|
|
1184
|
+
getModule<T>(name: string): T | undefined;
|
|
1121
1185
|
quillHack(): void;
|
|
1122
|
-
showTableTools(table: HTMLElement): void;
|
|
1123
|
-
hideTableTools(): void;
|
|
1124
1186
|
buildCustomSelect(customSelect: ((module: TableUp, picker: QuillThemePicker) => HTMLElement | Promise<HTMLElement>) | undefined, picker: QuillThemePicker): Promise<void>;
|
|
1125
1187
|
setCellAttrs(selectedTds: TableCellInnerFormat[], attr: string, value?: any, isStyle?: boolean): void;
|
|
1126
1188
|
getTextByCell(tds: TableCellInnerFormat[]): string;
|
|
1127
1189
|
getHTMLByCell(tds: TableCellInnerFormat[], isCut?: boolean): string;
|
|
1128
|
-
insertTable(rows: number, columns: number): void;
|
|
1190
|
+
insertTable(rows: number, columns: number, source?: EmitterSource): void;
|
|
1129
1191
|
calculateTableCellBorderWidth(): number;
|
|
1130
1192
|
fixUnusuaDeletelTable(tableBlot: TableMainFormat): void;
|
|
1131
1193
|
balanceTables(): void;
|
|
@@ -1143,5 +1205,5 @@ declare class TableUp {
|
|
|
1143
1205
|
splitCell(selectedTds: TableCellInnerFormat[]): void;
|
|
1144
1206
|
}
|
|
1145
1207
|
//#endregion
|
|
1146
|
-
export { BlockEmbedOverride, BlockOverride, ClipboardOptions, Constructor, ContainerFormat, InternalModule, InternalTableMenuModule, InternalTableSelectionModule, Matcher, MenuTooltipInstance, QuillTheme, QuillThemePicker, RelactiveRect, ScrollOverride, Scrollbar, SelectionData, Selector, SkipRowCount, TableAlign, TableBodyFormat, TableCaptionFormat, TableCaptionValue, TableCellFormat, TableCellInnerFormat, TableCellValue, TableClipboard, TableColFormat, TableColValue, TableColgroupFormat, TableConstantsData, TableCreatorTextOptions, TableMainFormat, TableMenuCommon, TableMenuContextmenu, TableMenuOptions, TableMenuOptionsInput, TableMenuSelect, TableMenuTexts, TableResizeBox, TableResizeCommon, TableResizeLine, TableResizeScale, TableResizeScaleOptions, TableRowFormat, TableRowValue, TableSelection, TableSelectionOptions, TableTextOptions, TableUp, TableUpOptions, TableValue, TableVirtualScrollbar, TableWrapperFormat, Tool, ToolOption, ToolOptionBreak, Writable, blotName, createColorPicker, createSelectBox, createTooltip, TableUp as default, defaultCustomSelect, findParentBlot, findParentBlots, getTableMainRect, isTableAlignRight, randomId, sizeChangeValue, tableMenuTools, tableUpEvent, tableUpInternal, tableUpSize, updateTableConstants };
|
|
1208
|
+
export { BlockEmbedOverride, BlockOverride, ClipboardOptions, Constructor, ContainerFormat, InternalModule, InternalTableMenuModule, InternalTableSelectionModule, Matcher, MenuTooltipInstance, QuillTheme, QuillThemePicker, RelactiveRect, ScrollOverride, Scrollbar, SelectionData, Selector, SkipRowCount, TableAlign, TableBodyFormat, TableBodyTag, TableCaptionFormat, TableCaptionValue, TableCellFormat, TableCellInnerFormat, TableCellValue, TableClipboard, TableColFormat, TableColValue, TableColgroupFormat, TableConstantsData, TableCreatorTextOptions, TableDomSelector, TableFootFormat, TableHeadFormat, TableMainFormat, TableMenuCommon, TableMenuContextmenu, TableMenuOptions, TableMenuOptionsInput, TableMenuSelect, TableMenuTexts, TableResizeBox, TableResizeCommon, TableResizeLine, TableResizeScale, TableResizeScaleOptions, TableRowFormat, TableRowValue, TableSelection, TableSelectionOptions, TableTextOptions, TableUp, TableUpExtraModule, TableUpModule, TableUpOptions, TableValue, TableVirtualScrollbar, TableWrapperFormat, Tool, ToolOption, ToolOptionBreak, Writable, blotName, createColorPicker, createSelectBox, createTooltip, TableUp as default, defaultCustomSelect, findParentBlot, findParentBlots, getTableMainRect, isTableAlignRight, randomId, sizeChangeValue, tableMenuTools, tableUpEvent, tableUpInternal, tableUpSize, updateTableConstants };
|
|
1147
1209
|
//# sourceMappingURL=index.d.ts.map
|