quill-table-up 2.0.6 → 2.1.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 +18 -7
- package/dist/index.css +1 -1
- package/dist/index.d.ts +52 -18
- 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 +1 -1
- package/src/__tests__/e2e/table-selection.test.ts +2 -2
- package/src/__tests__/unit/table-clipboard.test.ts +5 -0
- package/src/__tests__/unit/table-insert-remove-merge.test.ts +47 -153
- package/src/__tests__/unit/table-redo-undo.test.ts +24 -81
- package/src/__tests__/unit/utils.test.ts +1 -5
- package/src/formats/table-wrapper-format.ts +23 -0
- package/src/index.ts +150 -80
- package/src/modules/table-menu/constants.ts +55 -20
- package/src/modules/table-menu/table-menu-common.ts +1 -2
- package/src/modules/table-resize/table-resize-box.ts +4 -7
- package/src/modules/table-resize/table-resize-line.ts +2 -0
- package/src/modules/table-scrollbar.ts +0 -1
- package/src/modules/table-selection.ts +454 -32
- package/src/style/table-creator.less +4 -4
- package/src/style/table-menu.less +4 -1
- package/src/style/table-selection.less +9 -1
- package/src/svg/copy.svg +1 -0
- package/src/svg/cut.svg +1 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/position.ts +12 -3
- package/src/utils/types.ts +12 -8
- package/src/utils/utils.ts +10 -0
- package/src/modules/user-selection.ts +0 -110
package/README.md
CHANGED
|
@@ -99,6 +99,18 @@ const defaultTexts = {
|
|
|
99
99
|
clear: 'Clear',
|
|
100
100
|
transparent: 'Transparent',
|
|
101
101
|
perWidthInsufficient: 'The percentage width is insufficient. To complete the operation, the table needs to be converted to a fixed width. Do you want to continue?',
|
|
102
|
+
|
|
103
|
+
InsertTop: 'Insert a row above',
|
|
104
|
+
InsertRight: 'Insert a column right',
|
|
105
|
+
InsertBottom: 'Insert a row below',
|
|
106
|
+
InsertLeft: 'Insert a column Left',
|
|
107
|
+
MergeCell: 'Merge Cell',
|
|
108
|
+
SplitCell: 'Split Cell',
|
|
109
|
+
DeleteRow: 'Delete Row',
|
|
110
|
+
DeleteColumn: 'Delete Column',
|
|
111
|
+
DeleteTable: 'Delete table',
|
|
112
|
+
BackgroundColor: 'Set background color',
|
|
113
|
+
BorderColor: 'Set border color',
|
|
102
114
|
};
|
|
103
115
|
```
|
|
104
116
|
|
|
@@ -120,13 +132,12 @@ const defaultTexts = {
|
|
|
120
132
|
|
|
121
133
|
### TableMenu Options
|
|
122
134
|
|
|
123
|
-
| attribute | description
|
|
124
|
-
| --------------- |
|
|
125
|
-
| tipText | when `tableMenuClass` set `TableUp.TableMenuSelect`, display tip text when hover icon. when `tableMenuClass` set `TableUp.TableMenuContextmenu
|
|
126
|
-
|
|
|
127
|
-
|
|
|
128
|
-
|
|
|
129
|
-
| defaultColorMap | color map | `string[][]` | in source code |
|
|
135
|
+
| attribute | description | type | default |
|
|
136
|
+
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ----------------------- |
|
|
137
|
+
| tipText | when `tableMenuClass` set `TableUp.TableMenuSelect`, display tip text when hover icon. when `tableMenuClass` set `TableUp.TableMenuContextmenu`, display tip text after icon | `boolean` | `true` |
|
|
138
|
+
| localstorageKey | used color save localstorage key | `string` | `__table-bg-used-color` |
|
|
139
|
+
| tools | menu items | `Tool[]` | `defaultTools` |
|
|
140
|
+
| defaultColorMap | color map | `string[][]` | in source code |
|
|
130
141
|
|
|
131
142
|
<details>
|
|
132
143
|
<summary> types and default value </summary>
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.ql-toolbar .ql-picker:not(.ql-color-picker):not(.ql-icon-picker).ql-table-up{width:28px}.ql-toolbar .ql-picker:not(.ql-color-picker):not(.ql-icon-picker).ql-table-up .ql-picker-label{padding:2px 4px}.ql-toolbar .ql-picker:not(.ql-color-picker):not(.ql-icon-picker).ql-table-up .ql-picker-label svg{position:static;margin-top:0}.ql-toolbar .ql-picker.ql-expanded .ql-picker-options{z-index:1}.ql-editor .ql-table{display:table;border-collapse:collapse;table-layout:fixed;width:auto}.ql-editor .ql-table[data-full]{width:100%}.ql-editor .ql-table-wrapper{width:100%;overflow:auto;scrollbar-width:none}.ql-editor .ql-table-cell{padding:8px 12px;border-color:transparent;font-size:14px;outline:0;overflow:auto}.ql-editor .ql-table-cell-inner{display:inline-block;min-width:100%;word-break:break-word}.ql-editor .ql-table col{border-collapse:separate;text-indent:initial;display:table-column;table-layout:fixed}.ql-editor .ql-table td{border:1px solid #a1a1aa}.table-up-toolbox{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none}.table-up-toolbox *{pointer-events:all}.table-up-tooltip{position:absolute;z-index:20;padding:.25rem .75rem;border-radius:.25rem;font-size:.75rem;color:#fff;white-space:nowrap;background-color:#303133;transition:opacity .15s linear}.table-up-tooltip.transparent{opacity:0}.table-up-tooltip.hidden{display:none}.table-up-button{--table-btn-color:#606266;--table-btn-bg-hover:#f3f4f6;--table-btn-color-border:#dcdfe6;--table-btn-border:0.0625rem solid var(--table-btn-color-border);--table-btn-confirm-color-border:#409eff;--table-btn-confirm-bg:#409eff;--table-btn-confirm-hover:#79bbff;--table-btn-confirm-outline-focus-visible:0.125rem solid #a0cfff;box-sizing:border-box;display:inline-flex;height:2rem;line-height:1;margin:0;padding:.5rem 1rem;border-radius:.25rem;border:var(--table-btn-border);color:var(--table-btn-color);background-color:transparent;font-size:.875rem;cursor:pointer}.table-up-button+.table-up-button{margin-left:.375rem}.table-up-button:hover{background-color:var(--table-btn-bg-hover)}.table-up-button.confirm{border-color:var(--table-btn-confirm-color-border);background-color:var(--table-btn-confirm-bg);color:#fff}.table-up-button.confirm:hover{border-color:var(--table-btn-confirm-hover);background-color:var(--table-btn-confirm-hover)}.table-up-button.confirm:focus-visible{outline:var(--table-btn-confirm-outline-focus-visible);outline-offset:.0625rem}.table-up-dialog{--dialog-bg:rgba(0, 0, 0, 0.5);--dialog-color-border:#ebeef5;--dialog-color-boxshadow:rgba(0, 0, 0, 0.12);--dialog-border:0.0625rem solid var(--dialog-color-border);--dialog-boxshadow:0 0 0.75rem var(--dialog-color-boxshadow);position:fixed;top:0;right:0;bottom:0;left:0;z-index:2000;height:100%;background-color:var(--dialog-bg);overflow:auto}.table-up-dialog__overlay{position:fixed;top:0;right:0;bottom:0;left:0;padding:1rem;overflow:auto;text-align:center}.table-up-dialog__overlay::after{content:'';display:inline-block;height:100%;width:0;vertical-align:middle}.table-up-dialog__content{display:inline-block;max-width:50vw;width:100%;vertical-align:middle;background-color:#fff;border-radius:.25rem;border:var(--dialog-border);font-size:1.125rem;box-shadow:var(--dialog-boxshadow);text-align:left;overflow:hidden;box-sizing:border-box}.table-up-color-picker{--color-picker-bg-color:#ffffff;box-sizing:border-box;display:inline-flex;flex-direction:column;width:16.75rem;padding:.5rem;border-radius:.375rem;background:var(--color-picker-bg-color);box-shadow:0 0 .375rem #b2b5b8}.table-up-color-picker__content{box-sizing:border-box;width:100%;height:11.75rem;padding-top:.5rem}.table-up-color-picker__selector{width:14.375rem;height:9.375rem;position:absolute}.table-up-color-picker__background{width:100%;height:100%;background:linear-gradient(to top,#000 0,rgba(0,0,0,0) 100%),linear-gradient(to right,#fff 0,rgba(255,255,255,0) 100%)}.table-up-color-picker__background-handle{box-sizing:border-box;position:absolute;border:.0625rem solid #fff;cursor:pointer;top:0;left:14.375rem;border-radius:100%;width:.625rem;height:.625rem;transform:translate(-.3125rem,-.3125rem)}.table-up-color-picker__hue{width:.75rem;height:9.375rem;margin-left:15rem;position:absolute;background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.table-up-color-picker__hue-handle{box-sizing:border-box;position:absolute;border:.0625rem solid #fff;cursor:pointer;background-color:#fff;box-shadow:0 0 .125rem #0009;left:0;width:1rem;height:.625rem;transform:translate(-.125rem,-.3125rem)}.table-up-color-picker__alpha{width:14.375rem;height:.75rem;position:absolute;margin-top:10rem;background:linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(135deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(135deg,transparent 75%,#ccc 75%);background-size:.75rem .75rem;background-position:0 0,.375rem 0,.375rem -.375rem,0 .375rem}.table-up-color-picker__alpha-bg{position:relative;height:100%;background:linear-gradient(to right,rgba(255,255,255,0) 0,#fff 100%)}.table-up-color-picker__alpha-handle{box-sizing:border-box;position:absolute;border:.0625rem solid #fff;cursor:pointer;background-color:#fff;box-shadow:0 0 .125rem #0009;top:0;width:.625rem;height:1rem;transform:translate(-.3125rem,-.125rem)}.table-up-color-picker__action{box-sizing:border-box;display:flex;align-items:center;gap:.375rem;width:100%;padding-top:.5rem;border-top:.0625rem solid #e9ecef}.table-up-color-picker__action-item{flex:1;display:inline-flex;align-items:center;font-size:.75rem}.table-up-color-picker__input{box-sizing:border-box;width:100%;height:1.375rem;margin-left:.125rem;padding:.125rem 0 .125rem .25rem;background-color:#fff;border:.0625rem solid #ced4da;border-radius:.25rem;outline:0;color:#405057}.table-up-tooltip .table-up-color-picker{--color-picker-bg-color:transparent;box-shadow:none;width:15.75rem;padding:.5rem 0}.ql-container .table-up-selection{display:none;position:absolute;overflow:hidden;pointer-events:none}.ql-container .table-up-selection__line{position:absolute;border:2px solid;pointer-events:none}.table-up-resize-line__col,.table-up-resize-line__row{position:absolute;z-index:0}.table-up-resize-line__col::after,.table-up-resize-line__col::before,.table-up-resize-line__row::after,.table-up-resize-line__row::before{content:'';display:block;position:absolute;top:0;z-index:1}.table-up-resize-line__row{height:.0625rem;cursor:ns-resize}.table-up-resize-line__row::after,.table-up-resize-line__row::before{width:100%;height:.5rem}.table-up-resize-line__row::before{transform:translateY(-.5rem)}.table-up-resize-line__col{width:.0625rem;cursor:ew-resize}.table-up-resize-line__col::after,.table-up-resize-line__col::before{height:100%;width:.5rem}.table-up-resize-line__col::before{transform:translateX(-.5rem)}.table-up-resize-box{position:absolute;z-index:0}.table-up-resize-box.is-hidden{display:none}.table-up-resize-box.is-align-right .table-up-resize-box__col-separator{left:-.125rem}.table-up-resize-box.is-align-right .table-up-resize-box__corner{border-left-width:.0625rem;border-right-width:.0625rem;border-top-left-radius:0;border-top-right-radius:50%}.table-up-resize-box__col,.table-up-resize-box__row{position:absolute;top:0;left:0;overflow:hidden}.table-up-resize-box__col-wrapper,.table-up-resize-box__row-wrapper{display:flex}.table-up-resize-box__col-header,.table-up-resize-box__row-header{position:relative;flex-shrink:0;background-color:#f3f4f5;border:.0625rem solid #ccc}.table-up-resize-box__col-wrapper{height:100%}.table-up-resize-box__col-header{height:100%;cursor:pointer;border-right-color:transparent}.table-up-resize-box__col-header:last-child{border-right-color:#ccc}.table-up-resize-box__col-separator{position:absolute;top:0;bottom:0;right:-.125rem;width:.125rem;cursor:ew-resize;z-index:0}.table-up-resize-box__col-separator::after{right:-.375rem}.table-up-resize-box__col-separator::before{left:-.375rem}.table-up-resize-box__col-separator::after,.table-up-resize-box__col-separator::before{content:'';position:absolute;top:0;display:block;width:.5rem;height:100%;z-index:1}.table-up-resize-box__row-wrapper{flex-direction:column;width:100%}.table-up-resize-box__row-header{width:100%;cursor:pointer;border-bottom-color:transparent}.table-up-resize-box__row-header:last-child{border-bottom-color:#ccc}.table-up-resize-box__row-separator{position:absolute;left:0;right:0;bottom:-.125rem;height:.125rem;cursor:ns-resize;z-index:0}.table-up-resize-box__row-separator::after{bottom:-.375rem}.table-up-resize-box__row-separator::before{top:-.375rem}.table-up-resize-box__row-separator::after,.table-up-resize-box__row-separator::before{content:'';position:absolute;left:0;display:block;width:100%;height:.5rem;z-index:1}.table-up-resize-box__corner{position:absolute;top:0;left:0;background-color:#f3f4f5;border:.0625rem solid #ccc;border-right-width:0;border-bottom-width:0;border-top-left-radius:50%;cursor:pointer}.table-up-drag-line{position:fixed;z-index:0;background-color:#409eff}.table-up-drag-line.is-col{width:.125rem;cursor:ew-resize}.table-up-drag-line.is-row{height:.125rem;cursor:ns-resize}.table-up-scale{position:absolute;top:0;left:0;overflow:hidden;pointer-events:none}.table-up-scale__block{position:absolute;top:0;left:0;transform:translate(-100%,-100%);width:.75rem;height:.75rem;background-color:#f1f5f9;border:.0625rem solid grey;cursor:nw-resize;pointer-events:all}.table-up-scale.is-align-right .table-up-scale__block{cursor:ne-resize}.table-up-scale.is-hidden{display:none}.table-up-scrollbar{position:absolute;z-index:1;transition:opacity .15s linear}.table-up-scrollbar__container{position:relative}.table-up-scrollbar.is-transparent{opacity:0}.table-up-scrollbar.is-vertical{top:.125rem;bottom:.125rem;left:-.5rem;width:.375rem}.table-up-scrollbar.is-vertical .table-up-scrollbar__thumb{width:100%}.table-up-scrollbar.is-horizontal{bottom:.125rem;left:.125rem;right:.125rem;height:.375rem}.table-up-scrollbar.is-horizontal .table-up-scrollbar__thumb{height:100%}.table-up-scrollbar__thumb{border-radius:.3125rem;background-color:#d2d2d2;cursor:pointer}.table-up-scrollbar__thumb:hover{background-color:#a1a1aa}.table-up-scrollbar--origin.ql-container .ql-table-wrapper{scrollbar-width:inherit}.table-up-align,.table-up-menu{position:absolute;z-index:1;display:none;align-items:center;justify-content:center;padding:.25rem;border-radius:.375rem;box-shadow:0 0 .5rem rgba(0,0,0,.5);background-color:#fff;font-size:.875rem}.table-up-align__item,.table-up-menu__item{position:relative;display:inline-flex;align-items:center;justify-content:center;padding:.25rem;border-radius:.25rem;cursor:pointer}.table-up-align__item:hover,.table-up-menu__item:hover{background-color:#eee}.table-up-align__item.is-break,.table-up-menu__item.is-break{align-self:stretch;width:.0625rem;padding:0;margin:.125rem .25rem;background-color:#a3a3a3;cursor:default}.table-up-align .icon,.table-up-menu .icon{display:flex;flex-shrink:0;font-size:1.25rem}.table-up-align span,.table-up-menu span{text-wrap:nowrap}.table-up-menu.is-contextmenu{flex-direction:column;padding:.25rem .5rem}.table-up-menu.is-contextmenu .table-up-menu__item{display:flex;justify-content:flex-start;width:100%;gap:.25rem;cursor:pointer}.table-up-menu.is-contextmenu .is-break{width:100%;height:.0625rem;margin:.25rem 0;background-color:#a3a3a3}.table-up-align--active{display:flex}.table-up-align .icon{width:1.25rem;height:1.25rem}.table-up-color-map{display:flex;flex-direction:column}.table-up-color-map--used{display:flex;align-items:center;justify-content:center;flex-direction:row-reverse;margin-top:.25rem;padding-top:.25rem;border-top:.0625rem solid #ccc}.table-up-color-map__content{display:flex;flex-direction:column}.table-up-color-map__content-row{display:flex;align-items:center;justify-content:center;gap:.25rem}.table-up-color-map__item{width:.875rem;height:.875rem;margin:.125rem;border:.0625rem solid #a3a3a3;cursor:pointer}.table-up-color-map__btn{display:flex;align-items:center;justify-content:center;flex:1;height:1.25rem;padding:0 .375rem;color:#303133;background-color:#fff;cursor:pointer}.table-up-color-map__btn:hover{background-color:#edeeef}
|
|
1
|
+
.ql-toolbar .ql-picker:not(.ql-color-picker):not(.ql-icon-picker).ql-table-up{width:28px}.ql-toolbar .ql-picker:not(.ql-color-picker):not(.ql-icon-picker).ql-table-up .ql-picker-label{padding:2px 4px}.ql-toolbar .ql-picker:not(.ql-color-picker):not(.ql-icon-picker).ql-table-up .ql-picker-label svg{position:static;margin-top:0}.ql-toolbar .ql-picker.ql-expanded .ql-picker-options{z-index:1}.ql-editor .ql-table{display:table;border-collapse:collapse;table-layout:fixed;width:auto}.ql-editor .ql-table[data-full]{width:100%}.ql-editor .ql-table-wrapper{width:100%;overflow:auto;scrollbar-width:none}.ql-editor .ql-table-cell{padding:8px 12px;border-color:transparent;font-size:14px;outline:0;overflow:auto}.ql-editor .ql-table-cell-inner{display:inline-block;min-width:100%;word-break:break-word}.ql-editor .ql-table col{border-collapse:separate;text-indent:initial;display:table-column;table-layout:fixed}.ql-editor .ql-table td{border:1px solid #a1a1aa}.table-up-toolbox{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none}.table-up-toolbox *{pointer-events:all}.table-up-tooltip{position:absolute;z-index:20;padding:.25rem .75rem;border-radius:.25rem;font-size:.75rem;color:#fff;white-space:nowrap;background-color:#303133;transition:opacity .15s linear}.table-up-tooltip.transparent{opacity:0}.table-up-tooltip.hidden{display:none}.table-up-button{--table-btn-color:#606266;--table-btn-bg-hover:#f3f4f6;--table-btn-color-border:#dcdfe6;--table-btn-border:0.0625rem solid var(--table-btn-color-border);--table-btn-confirm-color-border:#409eff;--table-btn-confirm-bg:#409eff;--table-btn-confirm-hover:#79bbff;--table-btn-confirm-outline-focus-visible:0.125rem solid #a0cfff;box-sizing:border-box;display:inline-flex;height:2rem;line-height:1;margin:0;padding:.5rem 1rem;border-radius:.25rem;border:var(--table-btn-border);color:var(--table-btn-color);background-color:transparent;font-size:.875rem;cursor:pointer}.table-up-button+.table-up-button{margin-left:.375rem}.table-up-button:hover{background-color:var(--table-btn-bg-hover)}.table-up-button.confirm{border-color:var(--table-btn-confirm-color-border);background-color:var(--table-btn-confirm-bg);color:#fff}.table-up-button.confirm:hover{border-color:var(--table-btn-confirm-hover);background-color:var(--table-btn-confirm-hover)}.table-up-button.confirm:focus-visible{outline:var(--table-btn-confirm-outline-focus-visible);outline-offset:.0625rem}.table-up-dialog{--dialog-bg:rgba(0, 0, 0, 0.5);--dialog-color-border:#ebeef5;--dialog-color-boxshadow:rgba(0, 0, 0, 0.12);--dialog-border:0.0625rem solid var(--dialog-color-border);--dialog-boxshadow:0 0 0.75rem var(--dialog-color-boxshadow);position:fixed;top:0;right:0;bottom:0;left:0;z-index:2000;height:100%;background-color:var(--dialog-bg);overflow:auto}.table-up-dialog__overlay{position:fixed;top:0;right:0;bottom:0;left:0;padding:1rem;overflow:auto;text-align:center}.table-up-dialog__overlay::after{content:'';display:inline-block;height:100%;width:0;vertical-align:middle}.table-up-dialog__content{display:inline-block;max-width:50vw;width:100%;vertical-align:middle;background-color:#fff;border-radius:.25rem;border:var(--dialog-border);font-size:1.125rem;box-shadow:var(--dialog-boxshadow);text-align:left;overflow:hidden;box-sizing:border-box}.table-up-color-picker{--color-picker-bg-color:#ffffff;box-sizing:border-box;display:inline-flex;flex-direction:column;width:16.75rem;padding:.5rem;border-radius:.375rem;background:var(--color-picker-bg-color);box-shadow:0 0 .375rem #b2b5b8}.table-up-color-picker__content{box-sizing:border-box;width:100%;height:11.75rem;padding-top:.5rem}.table-up-color-picker__selector{width:14.375rem;height:9.375rem;position:absolute}.table-up-color-picker__background{width:100%;height:100%;background:linear-gradient(to top,#000 0,rgba(0,0,0,0) 100%),linear-gradient(to right,#fff 0,rgba(255,255,255,0) 100%)}.table-up-color-picker__background-handle{box-sizing:border-box;position:absolute;border:.0625rem solid #fff;cursor:pointer;top:0;left:14.375rem;border-radius:100%;width:.625rem;height:.625rem;transform:translate(-.3125rem,-.3125rem)}.table-up-color-picker__hue{width:.75rem;height:9.375rem;margin-left:15rem;position:absolute;background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.table-up-color-picker__hue-handle{box-sizing:border-box;position:absolute;border:.0625rem solid #fff;cursor:pointer;background-color:#fff;box-shadow:0 0 .125rem #0009;left:0;width:1rem;height:.625rem;transform:translate(-.125rem,-.3125rem)}.table-up-color-picker__alpha{width:14.375rem;height:.75rem;position:absolute;margin-top:10rem;background:linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(135deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(135deg,transparent 75%,#ccc 75%);background-size:.75rem .75rem;background-position:0 0,.375rem 0,.375rem -.375rem,0 .375rem}.table-up-color-picker__alpha-bg{position:relative;height:100%;background:linear-gradient(to right,rgba(255,255,255,0) 0,#fff 100%)}.table-up-color-picker__alpha-handle{box-sizing:border-box;position:absolute;border:.0625rem solid #fff;cursor:pointer;background-color:#fff;box-shadow:0 0 .125rem #0009;top:0;width:.625rem;height:1rem;transform:translate(-.3125rem,-.125rem)}.table-up-color-picker__action{box-sizing:border-box;display:flex;align-items:center;gap:.375rem;width:100%;padding-top:.5rem;border-top:.0625rem solid #e9ecef}.table-up-color-picker__action-item{flex:1;display:inline-flex;align-items:center;font-size:.75rem}.table-up-color-picker__input{box-sizing:border-box;width:100%;height:1.375rem;margin-left:.125rem;padding:.125rem 0 .125rem .25rem;background-color:#fff;border:.0625rem solid #ced4da;border-radius:.25rem;outline:0;color:#405057}.table-up-tooltip .table-up-color-picker{--color-picker-bg-color:transparent;box-shadow:none;width:15.75rem;padding:.5rem 0}.ql-container .table-up-selection{--select-color:#0589f340;display:none;position:absolute;overflow:hidden;pointer-events:none}.ql-container .table-up-selection__line{position:absolute;background-color:var(--select-color);pointer-events:none}.table-up-resize-line__col,.table-up-resize-line__row{position:absolute;z-index:0}.table-up-resize-line__col::after,.table-up-resize-line__col::before,.table-up-resize-line__row::after,.table-up-resize-line__row::before{content:'';display:block;position:absolute;top:0;z-index:1}.table-up-resize-line__row{height:.0625rem;cursor:ns-resize}.table-up-resize-line__row::after,.table-up-resize-line__row::before{width:100%;height:.5rem}.table-up-resize-line__row::before{transform:translateY(-.5rem)}.table-up-resize-line__col{width:.0625rem;cursor:ew-resize}.table-up-resize-line__col::after,.table-up-resize-line__col::before{height:100%;width:.5rem}.table-up-resize-line__col::before{transform:translateX(-.5rem)}.table-up-resize-box{position:absolute;z-index:0}.table-up-resize-box.is-hidden{display:none}.table-up-resize-box.is-align-right .table-up-resize-box__col-separator{left:-.125rem}.table-up-resize-box.is-align-right .table-up-resize-box__corner{border-left-width:.0625rem;border-right-width:.0625rem;border-top-left-radius:0;border-top-right-radius:50%}.table-up-resize-box__col,.table-up-resize-box__row{position:absolute;top:0;left:0;overflow:hidden}.table-up-resize-box__col-wrapper,.table-up-resize-box__row-wrapper{display:flex}.table-up-resize-box__col-header,.table-up-resize-box__row-header{position:relative;flex-shrink:0;background-color:#f3f4f5;border:.0625rem solid #ccc}.table-up-resize-box__col-wrapper{height:100%}.table-up-resize-box__col-header{height:100%;cursor:pointer;border-right-color:transparent}.table-up-resize-box__col-header:last-child{border-right-color:#ccc}.table-up-resize-box__col-separator{position:absolute;top:0;bottom:0;right:-.125rem;width:.125rem;cursor:ew-resize;z-index:0}.table-up-resize-box__col-separator::after{right:-.375rem}.table-up-resize-box__col-separator::before{left:-.375rem}.table-up-resize-box__col-separator::after,.table-up-resize-box__col-separator::before{content:'';position:absolute;top:0;display:block;width:.5rem;height:100%;z-index:1}.table-up-resize-box__row-wrapper{flex-direction:column;width:100%}.table-up-resize-box__row-header{width:100%;cursor:pointer;border-bottom-color:transparent}.table-up-resize-box__row-header:last-child{border-bottom-color:#ccc}.table-up-resize-box__row-separator{position:absolute;left:0;right:0;bottom:-.125rem;height:.125rem;cursor:ns-resize;z-index:0}.table-up-resize-box__row-separator::after{bottom:-.375rem}.table-up-resize-box__row-separator::before{top:-.375rem}.table-up-resize-box__row-separator::after,.table-up-resize-box__row-separator::before{content:'';position:absolute;left:0;display:block;width:100%;height:.5rem;z-index:1}.table-up-resize-box__corner{position:absolute;top:0;left:0;background-color:#f3f4f5;border:.0625rem solid #ccc;border-right-width:0;border-bottom-width:0;border-top-left-radius:50%;cursor:pointer}.table-up-drag-line{position:fixed;z-index:0;background-color:#409eff}.table-up-drag-line.is-col{width:.125rem;cursor:ew-resize}.table-up-drag-line.is-row{height:.125rem;cursor:ns-resize}.table-up-scale{position:absolute;top:0;left:0;overflow:hidden;pointer-events:none}.table-up-scale__block{position:absolute;top:0;left:0;transform:translate(-100%,-100%);width:.75rem;height:.75rem;background-color:#f1f5f9;border:.0625rem solid grey;cursor:nw-resize;pointer-events:all}.table-up-scale.is-align-right .table-up-scale__block{cursor:ne-resize}.table-up-scale.is-hidden{display:none}.table-up-scrollbar{position:absolute;z-index:1;transition:opacity .15s linear}.table-up-scrollbar__container{position:relative}.table-up-scrollbar.is-transparent{opacity:0}.table-up-scrollbar.is-vertical{top:.125rem;bottom:.125rem;left:-.5rem;width:.375rem}.table-up-scrollbar.is-vertical .table-up-scrollbar__thumb{width:100%}.table-up-scrollbar.is-horizontal{bottom:.125rem;left:.125rem;right:.125rem;height:.375rem}.table-up-scrollbar.is-horizontal .table-up-scrollbar__thumb{height:100%}.table-up-scrollbar__thumb{border-radius:.3125rem;background-color:#d2d2d2;cursor:pointer}.table-up-scrollbar__thumb:hover{background-color:#a1a1aa}.table-up-scrollbar--origin.ql-container .ql-table-wrapper{scrollbar-width:inherit}.table-up-align,.table-up-menu{position:absolute;z-index:1;display:none;align-items:center;padding:.25rem;border-radius:.375rem;box-shadow:0 0 .5rem rgba(0,0,0,.5);background-color:#fff;font-size:.875rem}.table-up-align__item,.table-up-menu__item{position:relative;display:inline-flex;align-items:center;justify-content:center;padding:.25rem;border-radius:.25rem;cursor:pointer}.table-up-align__item:hover,.table-up-menu__item:hover{background-color:#eee}.table-up-align__item.is-break,.table-up-menu__item.is-break{align-self:stretch;width:.0625rem;padding:0;margin:.125rem .25rem;background-color:#a3a3a3;cursor:default}.table-up-align .icon,.table-up-menu .icon{display:flex;flex-shrink:0;font-size:1.25rem}.table-up-align span,.table-up-menu span{text-wrap:nowrap}.table-up-menu.is-contextmenu{flex-direction:column;padding:.25rem .5rem;max-height:21.875rem;overflow-y:auto;overflow-x:hidden}.table-up-menu.is-contextmenu .table-up-menu__item{display:flex;justify-content:flex-start;width:100%;gap:.25rem;cursor:pointer}.table-up-menu.is-contextmenu .is-break{width:100%;height:.0625rem;flex-shrink:0;margin:.25rem 0;background-color:#a3a3a3}.table-up-align--active{display:flex}.table-up-align .icon{width:1.25rem;height:1.25rem}.table-up-color-map{display:flex;flex-direction:column}.table-up-color-map--used{display:flex;align-items:center;justify-content:center;flex-direction:row-reverse;margin-top:.25rem;padding-top:.25rem;border-top:.0625rem solid #ccc}.table-up-color-map__content{display:flex;flex-direction:column}.table-up-color-map__content-row{display:flex;align-items:center;justify-content:center;gap:.25rem}.table-up-color-map__item{width:.875rem;height:.875rem;margin:.125rem;border:.0625rem solid #a3a3a3;cursor:pointer}.table-up-color-map__btn{display:flex;align-items:center;justify-content:center;flex:1;height:1.25rem;padding:0 .375rem;color:#303133;background-color:#fff;cursor:pointer}.table-up-color-map__btn:hover{background-color:#edeeef}
|
package/dist/index.d.ts
CHANGED
|
@@ -34,7 +34,6 @@ interface ToolOptionBreak {
|
|
|
34
34
|
type Tool = ToolOption | ToolOptionBreak;
|
|
35
35
|
interface TableMenuOptions {
|
|
36
36
|
tipText: boolean;
|
|
37
|
-
tipTexts: Record<string, string>;
|
|
38
37
|
tools: Tool[];
|
|
39
38
|
localstorageKey: string;
|
|
40
39
|
defaultColorMap: string[];
|
|
@@ -57,7 +56,8 @@ interface TableCreatorTextOptions {
|
|
|
57
56
|
notPositiveNumberError: string;
|
|
58
57
|
perWidthInsufficient: string;
|
|
59
58
|
}
|
|
60
|
-
|
|
59
|
+
type TableMenuTexts = Record<string, string>;
|
|
60
|
+
interface TableTextOptions extends TableCreatorTextOptions, TableMenuTexts {
|
|
61
61
|
custom: string;
|
|
62
62
|
clear: string;
|
|
63
63
|
transparent: string;
|
|
@@ -70,7 +70,7 @@ interface TableUpOptions {
|
|
|
70
70
|
customBtn: boolean;
|
|
71
71
|
texts: TableTextOptions;
|
|
72
72
|
icon: string;
|
|
73
|
-
selection?: Constructor<InternalTableSelectionModule, [TableUp,
|
|
73
|
+
selection?: Constructor<InternalTableSelectionModule, [TableUp, Quill, Partial<TableSelectionOptions>]>;
|
|
74
74
|
selectionOptions: Partial<TableSelectionOptions>;
|
|
75
75
|
resize?: Constructor<InternalModule, [TableUp, HTMLElement, Quill, any]>;
|
|
76
76
|
resizeOptions: any;
|
|
@@ -133,6 +133,7 @@ interface InternalTableSelectionModule extends InternalModule {
|
|
|
133
133
|
x: number;
|
|
134
134
|
y: number;
|
|
135
135
|
}) => TableCellInnerFormat[];
|
|
136
|
+
updateWithSelectedTds: () => void;
|
|
136
137
|
}
|
|
137
138
|
interface TableConstantsData {
|
|
138
139
|
blotName: Record<string, string>;
|
|
@@ -371,13 +372,17 @@ declare class TableMainFormat extends ContainerFormat {
|
|
|
371
372
|
}
|
|
372
373
|
|
|
373
374
|
declare class TableWrapperFormat extends ContainerFormat {
|
|
375
|
+
scroll: any;
|
|
374
376
|
static blotName: "table-up";
|
|
375
377
|
static tagName: string;
|
|
376
378
|
static className: string;
|
|
377
379
|
static create(value: string): HTMLElement;
|
|
380
|
+
constructor(scroll: any, node: Node, _value: string);
|
|
378
381
|
get tableId(): string;
|
|
379
382
|
checkMerge(): boolean;
|
|
380
383
|
deleteAt(index: number, length: number): void;
|
|
384
|
+
remove(): void;
|
|
385
|
+
insertLineAround: () => void;
|
|
381
386
|
}
|
|
382
387
|
|
|
383
388
|
declare const randomId: () => string;
|
|
@@ -763,11 +768,17 @@ declare class TableVirtualScrollbar {
|
|
|
763
768
|
hide(): void;
|
|
764
769
|
show(): void;
|
|
765
770
|
update(): void;
|
|
766
|
-
destroy():
|
|
771
|
+
destroy(): void;
|
|
767
772
|
}
|
|
768
773
|
|
|
774
|
+
interface SelectionData {
|
|
775
|
+
anchorNode: Node | null;
|
|
776
|
+
anchorOffset: number;
|
|
777
|
+
focusNode: Node | null;
|
|
778
|
+
focusOffset: number;
|
|
779
|
+
}
|
|
769
780
|
declare class TableSelection {
|
|
770
|
-
|
|
781
|
+
tableModule: TableUp;
|
|
771
782
|
quill: Quill;
|
|
772
783
|
options: TableSelectionOptions;
|
|
773
784
|
boundary: RelactiveRect | null;
|
|
@@ -782,9 +793,10 @@ declare class TableSelection {
|
|
|
782
793
|
cellSelect: HTMLElement;
|
|
783
794
|
dragging: boolean;
|
|
784
795
|
scrollHandler: [HTMLElement, (...args: any[]) => void][];
|
|
785
|
-
selectingHandler: (mousedownEvent: MouseEvent) => void;
|
|
786
796
|
tableMenu?: InternalModule;
|
|
787
797
|
resizeObserver: ResizeObserver;
|
|
798
|
+
table?: HTMLTableElement;
|
|
799
|
+
isDisplaySelection: boolean;
|
|
788
800
|
bem: {
|
|
789
801
|
b: () => string;
|
|
790
802
|
be: (e?: string) => string;
|
|
@@ -795,8 +807,26 @@ declare class TableSelection {
|
|
|
795
807
|
cv: (v?: string) => string;
|
|
796
808
|
is: (n: string) => string;
|
|
797
809
|
};
|
|
798
|
-
|
|
810
|
+
shiftKeyDown: boolean;
|
|
811
|
+
keySelectionChange: boolean;
|
|
812
|
+
lastSelection: SelectionData;
|
|
813
|
+
constructor(tableModule: TableUp, quill: Quill, options?: Partial<TableSelectionOptions>);
|
|
814
|
+
getFirstTextNode(dom: HTMLElement | Node): Node;
|
|
815
|
+
getLastTextNode(dom: HTMLElement | Node): Node;
|
|
816
|
+
getNodeTailOffset(node: Node): number;
|
|
817
|
+
setSelectionData(selection: Selection, selectionData: SelectionData): void;
|
|
818
|
+
selectionDirectionUp(selection: SelectionData): boolean;
|
|
819
|
+
findWrapSelection(points: {
|
|
820
|
+
node: Node | null;
|
|
821
|
+
offset: number;
|
|
822
|
+
}[]): {
|
|
823
|
+
startNode: Node | null;
|
|
824
|
+
startOffset: number;
|
|
825
|
+
endNode: Node | null;
|
|
826
|
+
endOffset: number;
|
|
827
|
+
};
|
|
799
828
|
resolveOptions(options: Partial<TableSelectionOptions>): TableSelectionOptions;
|
|
829
|
+
selectionChangeHandler: () => void;
|
|
800
830
|
helpLinesInitial(): HTMLDivElement;
|
|
801
831
|
computeSelectedTds(startPoint: {
|
|
802
832
|
x: number;
|
|
@@ -805,7 +835,8 @@ declare class TableSelection {
|
|
|
805
835
|
x: number;
|
|
806
836
|
y: number;
|
|
807
837
|
}): TableCellInnerFormat[];
|
|
808
|
-
mouseDownHandler(mousedownEvent: MouseEvent)
|
|
838
|
+
mouseDownHandler: (mousedownEvent: MouseEvent) => void;
|
|
839
|
+
updateWithSelectedTds(): void;
|
|
809
840
|
update(): void;
|
|
810
841
|
getQuillViewScroll(): {
|
|
811
842
|
x: number;
|
|
@@ -815,9 +846,10 @@ declare class TableSelection {
|
|
|
815
846
|
x: number;
|
|
816
847
|
y: number;
|
|
817
848
|
};
|
|
849
|
+
setSelectionTable(table: HTMLTableElement | undefined): void;
|
|
818
850
|
show(): void;
|
|
819
851
|
hide(): void;
|
|
820
|
-
destroy():
|
|
852
|
+
destroy(): void;
|
|
821
853
|
}
|
|
822
854
|
|
|
823
855
|
declare const tableCantInsert: Set<string>;
|
|
@@ -884,28 +916,30 @@ declare class TableUp {
|
|
|
884
916
|
perWidthInsufficient: string;
|
|
885
917
|
} & Partial<TableTextOptions>;
|
|
886
918
|
pasteTableHandler(): void;
|
|
887
|
-
showTableTools(table: HTMLElement
|
|
919
|
+
showTableTools(table: HTMLElement): void;
|
|
888
920
|
hideTableTools(): void;
|
|
889
921
|
buildCustomSelect(customSelect: ((module: TableUp, picker: QuillThemePicker) => HTMLElement | Promise<HTMLElement>) | undefined, picker: QuillThemePicker): Promise<void>;
|
|
890
922
|
setCellAttrs(selectedTds: TableCellInnerFormat[], attr: string, value?: any, isStyle?: boolean): void;
|
|
923
|
+
getTextByCell(tds: TableCellInnerFormat[]): string;
|
|
924
|
+
getHTMLByCell(tds: TableCellInnerFormat[], isCut?: boolean): string;
|
|
891
925
|
insertTable(rows: number, columns: number): void;
|
|
892
926
|
calculateTableCellBorderWidth(): number;
|
|
893
927
|
fixUnusuaDeletelTable(tableBlot: TableMainFormat): void;
|
|
894
928
|
balanceTables(): void;
|
|
895
929
|
listenBalanceCells(): void;
|
|
896
|
-
deleteTable(): void;
|
|
897
|
-
appendRow(isDown: boolean): void;
|
|
898
|
-
appendCol(isRight: boolean): void;
|
|
930
|
+
deleteTable(selectedTds: TableCellInnerFormat[]): void;
|
|
931
|
+
appendRow(selectedTds: TableCellInnerFormat[], isDown: boolean): void;
|
|
932
|
+
appendCol(selectedTds: TableCellInnerFormat[], isRight: boolean): void;
|
|
899
933
|
/**
|
|
900
934
|
* after insert or remove cell. handle cell colspan and rowspan merge
|
|
901
935
|
*/
|
|
902
936
|
fixTableByRemove(tableBlot: TableMainFormat): void;
|
|
903
|
-
removeRow(): void;
|
|
904
|
-
removeCol(): void;
|
|
905
|
-
mergeCells(): void;
|
|
906
|
-
splitCell(): void;
|
|
937
|
+
removeRow(selectedTds: TableCellInnerFormat[]): void;
|
|
938
|
+
removeCol(selectedTds: TableCellInnerFormat[]): void;
|
|
939
|
+
mergeCells(selectedTds: TableCellInnerFormat[]): void;
|
|
940
|
+
splitCell(selectedTds: TableCellInnerFormat[]): void;
|
|
907
941
|
}
|
|
908
942
|
declare function updateTableConstants(data: Partial<TableConstantsData>): void;
|
|
909
943
|
declare function defaultCustomSelect(tableModule: TableUp, picker: QuillThemePicker): HTMLDivElement;
|
|
910
944
|
|
|
911
|
-
export { BlockOverride, BlockquoteOverride, CodeBlockOverride, type Constructor, ContainerFormat, HeaderOverride, type InternalModule, type InternalTableSelectionModule, ListItemOverride, type QuillTheme, type QuillThemePicker, type RelactiveRect, ScrollOverride, Scrollbar, type SkipRowCount, TableAlign, TableBodyFormat, TableCellFormat, TableCellInnerFormat, type TableCellValue, TableColFormat, type TableColValue, TableColgroupFormat, type TableConstantsData, type TableCreatorTextOptions, TableMainFormat, TableMenuCommon, TableMenuContextmenu, type TableMenuOptions, type TableMenuOptionsInput$1 as TableMenuOptionsInput, TableMenuSelect, TableResizeBox, TableResizeCommon, TableResizeLine, TableResizeScale, type TableResizeScaleOptions, TableRowFormat, type TableRowValue, TableSelection, type TableSelectionOptions, type TableTextOptions, TableUp, type TableUpOptions, type TableValue, TableVirtualScrollbar, TableWrapperFormat, type Tool, type ToolOption, type ToolOptionBreak, blotName, createColorPicker, createSelectBox, createTooltip, TableUp as default, defaultCustomSelect, findParentBlot, findParentBlots, isTableAlignRight, randomId, tableCantInsert, tableUpEvent, tableUpSize, updateTableConstants };
|
|
945
|
+
export { BlockOverride, BlockquoteOverride, CodeBlockOverride, type Constructor, ContainerFormat, HeaderOverride, type InternalModule, type InternalTableSelectionModule, ListItemOverride, type QuillTheme, type QuillThemePicker, type RelactiveRect, ScrollOverride, Scrollbar, type SkipRowCount, TableAlign, TableBodyFormat, TableCellFormat, TableCellInnerFormat, type TableCellValue, TableColFormat, type TableColValue, TableColgroupFormat, type TableConstantsData, type TableCreatorTextOptions, TableMainFormat, TableMenuCommon, TableMenuContextmenu, type TableMenuOptions, type TableMenuOptionsInput$1 as TableMenuOptionsInput, TableMenuSelect, type TableMenuTexts, TableResizeBox, TableResizeCommon, TableResizeLine, TableResizeScale, type TableResizeScaleOptions, TableRowFormat, type TableRowValue, TableSelection, type TableSelectionOptions, type TableTextOptions, TableUp, type TableUpOptions, type TableValue, TableVirtualScrollbar, TableWrapperFormat, type Tool, type ToolOption, type ToolOptionBreak, blotName, createColorPicker, createSelectBox, createTooltip, TableUp as default, defaultCustomSelect, findParentBlot, findParentBlots, isTableAlignRight, randomId, tableCantInsert, tableUpEvent, tableUpSize, updateTableConstants };
|