quill-table-up 2.0.2 → 2.0.3
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/dist/index.d.ts +3 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/table-creator.css +1 -1
- package/package.json +9 -14
- package/src/__tests__/e2e/custom-creator.test.ts +44 -0
- package/src/__tests__/e2e/table-align.test.ts +39 -0
- package/src/__tests__/e2e/table-resize.test.ts +152 -0
- package/src/__tests__/e2e/table-scrollbar.test.ts +31 -0
- package/src/__tests__/e2e/table-selection.test.ts +83 -0
- package/src/__tests__/e2e/utils.ts +6 -0
- package/src/__tests__/unit/table-insert-blot.test.ts +464 -0
- package/src/__tests__/unit/table-insert-remove-merge.test.ts +1270 -0
- package/src/__tests__/unit/table-redo-undo.test.ts +909 -0
- package/src/__tests__/unit/utils.test-d.ts +49 -0
- package/src/__tests__/unit/utils.test.ts +715 -0
- package/src/__tests__/unit/utils.ts +216 -0
- package/src/__tests__/unit/vitest.d.ts +12 -0
- package/src/formats/container-format.ts +52 -0
- package/src/formats/index.ts +10 -0
- package/src/formats/overrides/block.ts +93 -0
- package/src/formats/overrides/blockquote.ts +8 -0
- package/src/formats/overrides/code.ts +8 -0
- package/src/formats/overrides/header.ts +8 -0
- package/src/formats/overrides/index.ts +6 -0
- package/src/formats/overrides/list.ts +10 -0
- package/src/formats/overrides/scroll.ts +51 -0
- package/src/formats/table-body-format.ts +92 -0
- package/src/formats/table-cell-format.ts +139 -0
- package/src/formats/table-cell-inner-format.ts +251 -0
- package/src/formats/table-col-format.ts +174 -0
- package/src/formats/table-colgroup-format.ts +133 -0
- package/src/formats/table-main-format.ts +143 -0
- package/src/formats/table-row-format.ts +147 -0
- package/src/formats/table-wrapper-format.ts +55 -0
- package/src/formats/utils.ts +3 -0
- package/src/index.ts +1157 -0
- package/src/modules/index.ts +5 -0
- package/src/modules/table-align.ts +116 -0
- package/src/modules/table-menu/constants.ts +140 -0
- package/src/modules/table-menu/index.ts +3 -0
- package/src/modules/table-menu/table-menu-common.ts +249 -0
- package/src/modules/table-menu/table-menu-contextmenu.ts +94 -0
- package/src/modules/table-menu/table-menu-select.ts +28 -0
- package/src/modules/table-resize/index.ts +5 -0
- package/src/modules/table-resize/table-resize-box.ts +293 -0
- package/src/modules/table-resize/table-resize-common.ts +343 -0
- package/src/modules/table-resize/table-resize-line.ts +163 -0
- package/src/modules/table-resize/table-resize-scale.ts +154 -0
- package/src/modules/table-resize/utils.ts +3 -0
- package/src/modules/table-scrollbar.ts +255 -0
- package/src/modules/table-selection.ts +262 -0
- package/src/style/button.less +45 -0
- package/src/style/color-picker.less +134 -0
- package/src/style/dialog.less +53 -0
- package/src/style/functions.less +9 -0
- package/src/style/index.less +89 -0
- package/src/style/input.less +64 -0
- package/src/style/select-box.less +51 -0
- package/src/style/table-creator.less +68 -0
- package/src/style/table-menu.less +122 -0
- package/src/style/table-resize-scale.less +31 -0
- package/src/style/table-resize.less +183 -0
- package/src/style/table-scrollbar.less +49 -0
- package/src/style/table-selection.less +15 -0
- package/src/style/tooltip.less +19 -0
- package/src/style/variables.less +1 -0
- package/src/svg/background.svg +1 -0
- package/src/svg/border.svg +1 -0
- package/src/svg/color.svg +1 -0
- package/src/svg/insert-bottom.svg +1 -0
- package/src/svg/insert-left.svg +1 -0
- package/src/svg/insert-right.svg +1 -0
- package/src/svg/insert-top.svg +1 -0
- package/src/svg/merge-cell.svg +1 -0
- package/src/svg/remove-column.svg +1 -0
- package/src/svg/remove-row.svg +1 -0
- package/src/svg/remove-table.svg +1 -0
- package/src/svg/split-cell.svg +1 -0
- package/src/types.d.ts +4 -0
- package/src/utils/bem.ts +23 -0
- package/src/utils/color.ts +109 -0
- package/src/utils/components/button.ts +22 -0
- package/src/utils/components/color-picker.ts +236 -0
- package/src/utils/components/dialog.ts +41 -0
- package/src/utils/components/index.ts +6 -0
- package/src/utils/components/input.ts +74 -0
- package/src/utils/components/table/creator.ts +86 -0
- package/src/utils/components/table/index.ts +2 -0
- package/src/utils/components/table/select-box.ts +83 -0
- package/src/utils/components/tooltip.ts +186 -0
- package/src/utils/constants.ts +99 -0
- package/src/utils/index.ts +7 -0
- package/src/utils/is.ts +6 -0
- package/src/utils/position.ts +21 -0
- package/src/utils/types.ts +131 -0
- package/src/utils/utils.ts +139 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { TableBodyFormat, TableCellFormat, TableMainFormat, TableRowFormat, TableWrapperFormat } from '../../formats';
|
|
2
|
+
import { afterEach, beforeEach, describe, expectTypeOf, it, vi } from 'vitest';
|
|
3
|
+
import { TableCellInnerFormat } from '../../formats';
|
|
4
|
+
import { blotName, findParentBlot, findParentBlots } from '../../utils';
|
|
5
|
+
import { createTable } from './utils';
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
vi.useFakeTimers();
|
|
9
|
+
});
|
|
10
|
+
afterEach(() => {
|
|
11
|
+
vi.useRealTimers();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
describe('test utils', () => {
|
|
15
|
+
it('test findParentBlot', async () => {
|
|
16
|
+
const quill = await createTable(1, 1);
|
|
17
|
+
const tds = quill.scroll.descendants(TableCellInnerFormat, 0);
|
|
18
|
+
const tableCellBlot = findParentBlot(tds[0], blotName.tableCell);
|
|
19
|
+
expectTypeOf(tableCellBlot).toEqualTypeOf<TableCellFormat>();
|
|
20
|
+
const tableRowBlot = findParentBlot(tds[0], blotName.tableRow);
|
|
21
|
+
expectTypeOf(tableRowBlot).toEqualTypeOf<TableRowFormat>();
|
|
22
|
+
const tableBodyBlot = findParentBlot(tds[0], blotName.tableBody);
|
|
23
|
+
expectTypeOf(tableBodyBlot).toEqualTypeOf<TableBodyFormat>();
|
|
24
|
+
const tableMainBlot = findParentBlot(tds[0], blotName.tableMain);
|
|
25
|
+
expectTypeOf(tableMainBlot).toEqualTypeOf<TableMainFormat>();
|
|
26
|
+
const tableWrapperBlot = findParentBlot(tds[0], blotName.tableWrapper);
|
|
27
|
+
expectTypeOf(tableWrapperBlot).toEqualTypeOf<TableWrapperFormat>();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('test findParentBlots', async () => {
|
|
31
|
+
const quill = await createTable(1, 1);
|
|
32
|
+
const tds = quill.scroll.descendants(TableCellInnerFormat, 0);
|
|
33
|
+
const [tableCellBlot, tableRowBlot, tableBodyBlot, tableMainBlot, tableWrapperBlot] = findParentBlots(
|
|
34
|
+
tds[0],
|
|
35
|
+
[
|
|
36
|
+
blotName.tableCell,
|
|
37
|
+
blotName.tableRow,
|
|
38
|
+
blotName.tableBody,
|
|
39
|
+
blotName.tableMain,
|
|
40
|
+
blotName.tableWrapper,
|
|
41
|
+
] as const,
|
|
42
|
+
);
|
|
43
|
+
expectTypeOf(tableCellBlot).toEqualTypeOf<TableCellFormat>();
|
|
44
|
+
expectTypeOf(tableRowBlot).toEqualTypeOf<TableRowFormat>();
|
|
45
|
+
expectTypeOf(tableBodyBlot).toEqualTypeOf<TableBodyFormat>();
|
|
46
|
+
expectTypeOf(tableMainBlot).toEqualTypeOf<TableMainFormat>();
|
|
47
|
+
expectTypeOf(tableWrapperBlot).toEqualTypeOf<TableWrapperFormat>();
|
|
48
|
+
});
|
|
49
|
+
});
|