quill-table-up 3.3.0 → 3.3.2
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 +5 -5
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/index.umd.js.map +1 -1
- package/dist/table-creator.css +1 -1
- package/package.json +14 -14
- package/src/__tests__/e2e/table-resize.test.ts +1 -1
- package/src/__tests__/unit/table-cell-merge.test.ts +5 -5
- package/src/__tests__/unit/table-redo-undo.test.ts +1 -1
- package/src/__tests__/unit/table-remove.test.ts +3 -3
- package/src/__tests__/unit/utils.ts +2 -2
- package/src/formats/table-col-format.ts +3 -0
- package/src/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/src/style/select-box.less +5 -1
- package/src/table-up.ts +1 -1
- package/src/utils/components/table/select-box.ts +4 -4
package/dist/table-creator.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.table-up-input__item{--input-height:2rem;--input-inner-height:calc(var(--input-height) - 0.125rem);--input-color-text:#606266;--input-color-boxshaow:#dcdfe6;--input-color-focus:#409eff;--input-color-error:#f56c6c;--input-boxshaow:0 0 0 0.0625rem var(--input-color-boxshaow) inset;--input-boxshaow-focus:0 0 0 0.0625rem var(--input-color-focus) inset;--input-boxshaow-error:0 0 0 0.0625rem var(--input-color-error) inset;display:flex;align-items:center}.table-up-input__item+.table-up-input__item{margin-top:1.125rem}.table-up-input__label{width:5rem;flex-shrink:0}.table-up-input__input{box-sizing:border-box;position:relative;display:flex;flex-wrap:wrap;width:100%;height:var(--input-height);line-height:var(--input-height);padding:.0625rem .5rem;border-radius:.25rem;box-shadow:var(--input-boxshaow);transition:box-shadow .2s linear}.table-up-input__input.focus{box-shadow:var(--input-boxshaow-focus)}.table-up-input__input input{width:100%;height:var(--input-inner-height);line-height:var(--input-inner-height);flex-grow:1;font-size:.875rem;color:var(--input-color-text);outline:0;border:0;padding:0}.table-up-input__input.error{box-shadow:var(--input-boxshaow-error)}.table-up-input__error-tip{position:absolute;top:100%;left:0;font-size:.75rem;color:var(--input-color-error);line-height:1rem}.ql-snow .table-up-select-box{--select-box-color-bg-hover:#f5f5f5;--select-box-color-bg-active:#e0f2fe;--select-box-custom-color-text:#0d0d0d;--select-box-custom-color-bg:transparent;--select-box-custom-color-bg-hover:#ebebeb}.table-up-select-box{--select-box-color-border:#e5e7eb;--select-box-border:0.0625rem solid var(--select-box-color-border);--select-box-color-active:#0ea5e9;--select-box-color-bg-hover:#f5f5f5;--select-box-color-bg-active:transparent;--select-box-custom-color-text:#f5f5f5;--select-box-custom-color-bg:transparent;--select-box-custom-color-bg-hover:#2c2c2c}.table-up-select-box__block{display:flex;width:10rem;flex-wrap:wrap;align-items:center;justify-content:center}.table-up-select-box__item{margin:.125rem;height:1rem;width:1rem;border:var(--select-box-border);cursor:pointer}.table-up-select-box__item.active{border-color:var(--select-box-color-active);background-color:var(--select-box-color-bg-active)}.table-up-select-box__custom{padding:.5rem;color:var(--select-box-custom-color-text);background-color:var(--select-box-custom-color-bg);font-size:1rem;text-align:center;cursor:pointer}.table-up-select-box__custom:hover{background-color:var(--select-box-custom-color-bg-hover)}.table-up-creator{padding:1.5rem}.table-up-creator__input{display:flex;flex-direction:column;width:100%}.table-up-creator__control{margin-top:1rem;text-align:right}.table-up-creator__checkbox{--check-color:#212121;--checked-color:#506eec;display:flex;align-items:center;margin-top:.25rem;cursor:pointer;font-size:.75rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}.table-up-creator__checkbox input{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:1.125rem;height:1.125rem;border:.0625rem solid var(--check-color);border-radius:.3125rem;background-color:transparent;display:inline-block;position:relative;margin-right:.625rem;cursor:pointer}.table-up-creator__checkbox input:before{content:'';background-color:var(--checked-color);display:block;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) scale(0);width:.625rem;height:.625rem;border-radius:.1875rem;transition:all .2s ease-in-out}.table-up-creator__checkbox input:checked:before{transform:translate(-50%,-50%) scale(1)}
|
|
1
|
+
.table-up-input__item{--input-height:2rem;--input-inner-height:calc(var(--input-height) - 0.125rem);--input-color-text:#606266;--input-color-boxshaow:#dcdfe6;--input-color-focus:#409eff;--input-color-error:#f56c6c;--input-boxshaow:0 0 0 0.0625rem var(--input-color-boxshaow) inset;--input-boxshaow-focus:0 0 0 0.0625rem var(--input-color-focus) inset;--input-boxshaow-error:0 0 0 0.0625rem var(--input-color-error) inset;display:flex;align-items:center}.table-up-input__item+.table-up-input__item{margin-top:1.125rem}.table-up-input__label{width:5rem;flex-shrink:0}.table-up-input__input{box-sizing:border-box;position:relative;display:flex;flex-wrap:wrap;width:100%;height:var(--input-height);line-height:var(--input-height);padding:.0625rem .5rem;border-radius:.25rem;box-shadow:var(--input-boxshaow);transition:box-shadow .2s linear}.table-up-input__input.focus{box-shadow:var(--input-boxshaow-focus)}.table-up-input__input input{width:100%;height:var(--input-inner-height);line-height:var(--input-inner-height);flex-grow:1;font-size:.875rem;color:var(--input-color-text);outline:0;border:0;padding:0}.table-up-input__input.error{box-shadow:var(--input-boxshaow-error)}.table-up-input__error-tip{position:absolute;top:100%;left:0;font-size:.75rem;color:var(--input-color-error);line-height:1rem}.ql-snow .table-up-select-box{--select-box-color-bg-hover:#f5f5f5;--select-box-color-bg-active:#e0f2fe;--select-box-custom-color-text:#0d0d0d;--select-box-custom-color-bg:transparent;--select-box-custom-color-bg-hover:#ebebeb}.table-up-select-box{--select-box-color-border:#e5e7eb;--select-box-border:0.0625rem solid var(--select-box-color-border);--select-box-color-active:#0ea5e9;--select-box-color-bg-hover:#f5f5f5;--select-box-color-bg-active:transparent;--select-box-custom-color-text:#f5f5f5;--select-box-custom-color-bg:transparent;--select-box-custom-color-bg-hover:#2c2c2c;display:block}.table-up-select-box__block{display:inline-flex;width:10rem;flex-wrap:wrap;align-items:center;justify-content:center}.table-up-select-box__item{display:inline-block;margin:.125rem;height:1rem;width:1rem;border:var(--select-box-border);cursor:pointer}.table-up-select-box__item.active{border-color:var(--select-box-color-active);background-color:var(--select-box-color-bg-active)}.table-up-select-box__custom{display:block;padding:.5rem;color:var(--select-box-custom-color-text);background-color:var(--select-box-custom-color-bg);font-size:1rem;text-align:center;cursor:pointer}.table-up-select-box__custom:hover{background-color:var(--select-box-custom-color-bg-hover)}.table-up-creator{padding:1.5rem}.table-up-creator__input{display:flex;flex-direction:column;width:100%}.table-up-creator__control{margin-top:1rem;text-align:right}.table-up-creator__checkbox{--check-color:#212121;--checked-color:#506eec;display:flex;align-items:center;margin-top:.25rem;cursor:pointer;font-size:.75rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}.table-up-creator__checkbox input{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:1.125rem;height:1.125rem;border:.0625rem solid var(--check-color);border-radius:.3125rem;background-color:transparent;display:inline-block;position:relative;margin-right:.625rem;cursor:pointer}.table-up-creator__checkbox input:before{content:'';background-color:var(--checked-color);display:block;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) scale(0);width:.625rem;height:.625rem;border-radius:.1875rem;transition:all .2s ease-in-out}.table-up-creator__checkbox input:checked:before{transform:translate(-50%,-50%) scale(1)}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quill-table-up",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.3.
|
|
5
|
-
"packageManager": "pnpm@10.28.
|
|
4
|
+
"version": "3.3.2",
|
|
5
|
+
"packageManager": "pnpm@10.28.2",
|
|
6
6
|
"description": "A table module for quill2.x",
|
|
7
7
|
"author": "zzxming",
|
|
8
8
|
"license": "MIT",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"quill": "^2.0.3"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@floating-ui/dom": "^1.7.
|
|
44
|
+
"@floating-ui/dom": "^1.7.5"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@babel/preset-env": "^7.
|
|
48
|
-
"@oxc-project/runtime": "^0.
|
|
49
|
-
"@playwright/test": "^1.58.
|
|
47
|
+
"@babel/preset-env": "^7.29.0",
|
|
48
|
+
"@oxc-project/runtime": "^0.112.0",
|
|
49
|
+
"@playwright/test": "^1.58.2",
|
|
50
50
|
"@prettier/plugin-xml": "^3.4.2",
|
|
51
51
|
"@rollup/plugin-babel": "^6.1.0",
|
|
52
52
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
@@ -54,26 +54,26 @@
|
|
|
54
54
|
"@types/gulp-clean-css": "^4.3.4",
|
|
55
55
|
"@types/gulp-less": "^0.0.36",
|
|
56
56
|
"@types/gulp-postcss": "^8.0.6",
|
|
57
|
-
"@types/node": "^25.
|
|
57
|
+
"@types/node": "^25.2.1",
|
|
58
58
|
"@types/postcss-pxtorem": "^6.1.0",
|
|
59
59
|
"@types/ws": "^8.18.1",
|
|
60
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
61
|
-
"@typescript-eslint/parser": "^8.
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^8.54.0",
|
|
61
|
+
"@typescript-eslint/parser": "^8.54.0",
|
|
62
62
|
"@vitest/coverage-v8": "^4.0.18",
|
|
63
63
|
"@vitest/ui": "^4.0.18",
|
|
64
|
-
"@zzxming/eslint-config": "0.6.
|
|
65
|
-
"autoprefixer": "^10.4.
|
|
66
|
-
"eslint": "^
|
|
64
|
+
"@zzxming/eslint-config": "0.6.3",
|
|
65
|
+
"autoprefixer": "^10.4.24",
|
|
66
|
+
"eslint": "^10.0.0",
|
|
67
67
|
"gulp": "^5.0.1",
|
|
68
68
|
"gulp-clean-css": "^4.3.0",
|
|
69
69
|
"gulp-less": "^5.0.0",
|
|
70
70
|
"gulp-postcss": "^10.0.0",
|
|
71
|
-
"jsdom": "^
|
|
71
|
+
"jsdom": "^28.0.0",
|
|
72
72
|
"open": "^11.0.0",
|
|
73
73
|
"parchment": "^3.0.0",
|
|
74
74
|
"postcss-pxtorem": "^6.1.0",
|
|
75
75
|
"resize-observer-polyfill": "^1.5.1",
|
|
76
|
-
"tsdown": "^0.
|
|
76
|
+
"tsdown": "^0.20.3",
|
|
77
77
|
"tslib": "^2.8.1",
|
|
78
78
|
"tsx": "^4.21.0",
|
|
79
79
|
"typescript": "~5.9.3",
|
|
@@ -166,7 +166,7 @@ extendTest('TableResize on full width should not outer 100%', async ({ page, edi
|
|
|
166
166
|
for (let i = 0; i < colCount; i++) {
|
|
167
167
|
width += Number.parseFloat((await cols.nth(i).getAttribute('width'))!);
|
|
168
168
|
}
|
|
169
|
-
expect(width).toBeCloseTo(100,
|
|
169
|
+
expect(width).toBeCloseTo(100, 2);
|
|
170
170
|
});
|
|
171
171
|
|
|
172
172
|
extendTest.describe('TableResizeScale functional', () => {
|
|
@@ -28,7 +28,7 @@ describe('merge and split cell', () => {
|
|
|
28
28
|
<div>
|
|
29
29
|
<table cellpadding="0" cellspacing="0" data-full="true">
|
|
30
30
|
<colgroup data-full="true">
|
|
31
|
-
${new Array(3).fill(0).map(() => `<col width="
|
|
31
|
+
${new Array(3).fill(0).map(() => `<col width="33.3333%" data-full="true" />`).join('\n')}
|
|
32
32
|
</colgroup>
|
|
33
33
|
<tbody>
|
|
34
34
|
<tr>
|
|
@@ -113,9 +113,9 @@ describe('merge and split cell', () => {
|
|
|
113
113
|
<div>
|
|
114
114
|
<table cellpadding="0" cellspacing="0" data-full="true">
|
|
115
115
|
<colgroup data-full="true">
|
|
116
|
-
${new Array(4).fill(0).map(() => `<col width="
|
|
117
|
-
<col width="
|
|
118
|
-
<col width="
|
|
116
|
+
${new Array(4).fill(0).map(() => `<col width="14.2857%" data-full="true" />`).join('\n')}
|
|
117
|
+
<col width="28.5714%" data-full="true" />
|
|
118
|
+
<col width="14.2857%" data-full="true" />
|
|
119
119
|
</colgroup>
|
|
120
120
|
<tbody>
|
|
121
121
|
<tr>
|
|
@@ -178,7 +178,7 @@ describe('merge and split cell', () => {
|
|
|
178
178
|
<div>
|
|
179
179
|
<table cellpadding="0" cellspacing="0" data-full="true">
|
|
180
180
|
<colgroup data-full="true">
|
|
181
|
-
${new Array(3).fill(0).map(() => `<col width="
|
|
181
|
+
${new Array(3).fill(0).map(() => `<col width="33.3333%" data-full="true" />`).join('\n')}
|
|
182
182
|
</colgroup>
|
|
183
183
|
<tbody>
|
|
184
184
|
<tr>
|
|
@@ -122,7 +122,7 @@ describe('table undo', () => {
|
|
|
122
122
|
<div>
|
|
123
123
|
<table cellpadding="0" cellspacing="0" data-full="true">
|
|
124
124
|
<colgroup data-full="true">
|
|
125
|
-
${new Array(3).fill(0).map((_, i) => `<col width="
|
|
125
|
+
${new Array(3).fill(0).map((_, i) => `<col width="33.3333%" data-col-id="${i + 1}" data-full="true" />`).join('\n')}
|
|
126
126
|
</colgroup>
|
|
127
127
|
<tbody>
|
|
128
128
|
<tr data-row-id="1">
|
|
@@ -25,7 +25,7 @@ describe('remove column from table', () => {
|
|
|
25
25
|
<div>
|
|
26
26
|
<table cellpadding="0" cellspacing="0" data-full="true">
|
|
27
27
|
<colgroup data-full="true">
|
|
28
|
-
<col width="
|
|
28
|
+
<col width="99.9999%" data-full="true" />
|
|
29
29
|
</colgroup>
|
|
30
30
|
<tbody>
|
|
31
31
|
${
|
|
@@ -144,7 +144,7 @@ describe('remove row from table', () => {
|
|
|
144
144
|
<div>
|
|
145
145
|
<table cellpadding="0" cellspacing="0" data-full="true">
|
|
146
146
|
<colgroup data-full="true">
|
|
147
|
-
${new Array(3).fill(0).map(() => `<col width="
|
|
147
|
+
${new Array(3).fill(0).map(() => `<col width="33.3333%" data-full="true" />`).join('\n')}
|
|
148
148
|
</colgroup>
|
|
149
149
|
<tbody>
|
|
150
150
|
<tr>
|
|
@@ -175,7 +175,7 @@ describe('remove row from table', () => {
|
|
|
175
175
|
<div>
|
|
176
176
|
<table cellpadding="0" cellspacing="0" data-full="true">
|
|
177
177
|
<colgroup data-full="true">
|
|
178
|
-
${new Array(3).fill(0).map(() => `<col width="
|
|
178
|
+
${new Array(3).fill(0).map(() => `<col width="33.3333%" data-full="true" />`).join('\n')}
|
|
179
179
|
</colgroup>
|
|
180
180
|
<tbody>
|
|
181
181
|
<tr>
|
|
@@ -168,7 +168,7 @@ export function getColWidthStyle(options: Required<Omit<ColOptions, 'align' | 't
|
|
|
168
168
|
const { full, width, colNum } = options;
|
|
169
169
|
let colWidth = `${width}px`;
|
|
170
170
|
if (full) {
|
|
171
|
-
colWidth = `${1 / colNum * 100}%`;
|
|
171
|
+
colWidth = `${Math.trunc(1 / colNum * 100 * 10_000) / 10_000}%`;
|
|
172
172
|
}
|
|
173
173
|
return `width="${colWidth}"`;
|
|
174
174
|
}
|
|
@@ -187,7 +187,7 @@ export function createTableDeltaOps(row: number, col: number, colOptions?: ColOp
|
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
189
|
for (const [i, _] of new Array(col).fill(0).entries()) {
|
|
190
|
-
const value: TableColDeltaValue = { tableId, colId: `${i + 1}`, width: 1 / col * 100, full };
|
|
190
|
+
const value: TableColDeltaValue = { tableId, colId: `${i + 1}`, width: Math.trunc(1 / col * 100 * 10_000) / 10_000, full };
|
|
191
191
|
if (!full) {
|
|
192
192
|
value.width = width;
|
|
193
193
|
}
|
|
@@ -15,6 +15,9 @@ export class TableColFormat extends BlockEmbed {
|
|
|
15
15
|
if (Number.isNaN(widthNumber)) {
|
|
16
16
|
widthNumber = tableUpSize[full ? 'colMinWidthPre' : 'colMinWidthPx'];
|
|
17
17
|
}
|
|
18
|
+
if (full) {
|
|
19
|
+
widthNumber = Math.trunc(widthNumber * 10_000) / 10_000;
|
|
20
|
+
}
|
|
18
21
|
return `${widthNumber}${full ? '%' : 'px'}`;
|
|
19
22
|
}
|
|
20
23
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":"4.0.18","results":[[":__tests__/unit/utils.test-d.ts",{"duration":0,"failed":false}],[":__tests__/unit/table-insert.test.ts",{"duration":18173.0784,"failed":false}],[":__tests__/unit/table-clipboard.test.ts",{"duration":22002.459899999998,"failed":false}],[":__tests__/unit/table-blots.test.ts",{"duration":10285.912399999997,"failed":false}],[":__tests__/unit/table-cell-merge.test.ts",{"duration":12967.189000000002,"failed":false}],[":__tests__/unit/utils.test.ts",{"duration":3874.055199999999,"failed":false}],[":__tests__/unit/table-hack.test.ts",{"duration":9750.4833,"failed":false}],[":__tests__/unit/table-redo-undo.test.ts",{"duration":32718.328999999998,"failed":false}],[":__tests__/unit/table-caption.test.ts",{"duration":3572.148699999998,"failed":false}],[":__tests__/unit/table-remove.test.ts",{"duration":6382.709699999998,"failed":false}],[":__tests__/unit/table-contenteditable.test.ts",{"duration":1995.755299999999,"failed":false}]]}
|
|
@@ -20,14 +20,17 @@
|
|
|
20
20
|
.setCssVar(select-box-custom-color-bg, transparent);
|
|
21
21
|
.setCssVar(select-box-custom-color-bg-hover, rgb(44, 44, 44));
|
|
22
22
|
|
|
23
|
+
display: block;
|
|
24
|
+
|
|
23
25
|
&__block {
|
|
24
|
-
display: flex;
|
|
26
|
+
display: inline-flex;
|
|
25
27
|
width: 160px;
|
|
26
28
|
flex-wrap: wrap;
|
|
27
29
|
align-items: center;
|
|
28
30
|
justify-content: center;
|
|
29
31
|
}
|
|
30
32
|
&__item {
|
|
33
|
+
display: inline-block;
|
|
31
34
|
margin: 2px;
|
|
32
35
|
height: 16px;
|
|
33
36
|
width: 16px;
|
|
@@ -39,6 +42,7 @@
|
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
&__custom {
|
|
45
|
+
display: block;
|
|
42
46
|
padding: 8px;
|
|
43
47
|
color: .getCssVar(select-box-custom-color-text) [];
|
|
44
48
|
background-color: .getCssVar(select-box-custom-color-bg) [];
|
package/src/table-up.ts
CHANGED
|
@@ -655,7 +655,7 @@ export class TableUp {
|
|
|
655
655
|
|
|
656
656
|
async buildCustomSelect(customSelect: ((module: TableUp, picker: QuillThemePicker) => HTMLElement | Promise<HTMLElement>) | undefined, picker: QuillThemePicker) {
|
|
657
657
|
if (!customSelect || !isFunction(customSelect)) return;
|
|
658
|
-
const dom = document.createElement('
|
|
658
|
+
const dom = document.createElement('span');
|
|
659
659
|
dom.classList.add('ql-custom-select');
|
|
660
660
|
this.selector = await customSelect(this, picker);
|
|
661
661
|
dom.appendChild(this.selector);
|
|
@@ -11,14 +11,14 @@ interface TableSelectOptions {
|
|
|
11
11
|
}
|
|
12
12
|
export function createSelectBox(options: Partial<TableSelectOptions> = {}) {
|
|
13
13
|
const bem = createBEM('select-box');
|
|
14
|
-
const selectDom = document.createElement('
|
|
14
|
+
const selectDom = document.createElement('span');
|
|
15
15
|
selectDom.classList.add(bem.b());
|
|
16
16
|
|
|
17
|
-
const selectBlock = document.createElement('
|
|
17
|
+
const selectBlock = document.createElement('span');
|
|
18
18
|
selectBlock.classList.add(bem.be('block'));
|
|
19
19
|
for (let r = 0; r < (options.row || 8); r++) {
|
|
20
20
|
for (let c = 0; c < (options.col || 8); c++) {
|
|
21
|
-
const selectItem = document.createElement('
|
|
21
|
+
const selectItem = document.createElement('span');
|
|
22
22
|
selectItem.classList.add(bem.be('item'));
|
|
23
23
|
selectItem.dataset.row = String(r + 1);
|
|
24
24
|
selectItem.dataset.col = String(c + 1);
|
|
@@ -62,7 +62,7 @@ export function createSelectBox(options: Partial<TableSelectOptions> = {}) {
|
|
|
62
62
|
|
|
63
63
|
if (options.customBtn) {
|
|
64
64
|
const texts = options.texts || {};
|
|
65
|
-
const selectCustom = document.createElement('
|
|
65
|
+
const selectCustom = document.createElement('span');
|
|
66
66
|
selectCustom.classList.add(bem.be('custom'));
|
|
67
67
|
selectCustom.textContent = texts.customBtnText || 'Custom';
|
|
68
68
|
selectCustom.addEventListener('click', async () => {
|