@worktile/theia 14.3.14 → 14.3.16
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/components/contextmenu/contextmenu.component.d.ts +1 -0
- package/esm2020/components/contextmenu/contextmenu.component.mjs +9 -3
- package/esm2020/components/inline-toolbar/inline-toolbar.component.mjs +3 -3
- package/esm2020/plugins/table/components/table.component.mjs +15 -14
- package/esm2020/plugins/table/components/td/td.component.mjs +9 -6
- package/esm2020/plugins/table/components/toolbar/table-toolbar.component.mjs +3 -3
- package/esm2020/plugins/table/table.editor.mjs +13 -20
- package/esm2020/plugins/table/table.pipe.mjs +3 -3
- package/esm2020/plugins/table/table.store.mjs +15 -10
- package/esm2020/plugins/table/utils/set-menu-cell-invisibility.mjs +3 -3
- package/esm2020/services/table-contextmenu.service.mjs +5 -3
- package/esm2020/utils/dom.mjs +10 -1
- package/fesm2015/worktile-theia.mjs +77 -58
- package/fesm2015/worktile-theia.mjs.map +1 -1
- package/fesm2020/worktile-theia.mjs +73 -55
- package/fesm2020/worktile-theia.mjs.map +1 -1
- package/package.json +1 -1
- package/plugins/table/components/table.component.scss +52 -43
- package/plugins/table/table.editor.d.ts +2 -2
- package/plugins/table/table.pipe.d.ts +1 -1
- package/plugins/table/table.store.d.ts +2 -1
- package/plugins/table/utils/set-menu-cell-invisibility.d.ts +1 -0
|
@@ -2259,12 +2259,21 @@ function useElementStyle(el, element) {
|
|
|
2259
2259
|
if (element.align) {
|
|
2260
2260
|
el.style.textAlign = element.align || Alignment.left;
|
|
2261
2261
|
}
|
|
2262
|
+
else if (el.style.textAlign) {
|
|
2263
|
+
el.style.removeProperty('text-align');
|
|
2264
|
+
}
|
|
2262
2265
|
if (element.textIndent) {
|
|
2263
2266
|
el.style.textIndent = element.textIndent + 'em';
|
|
2264
2267
|
}
|
|
2268
|
+
else if (el.style.textIndent) {
|
|
2269
|
+
el.style.removeProperty('text-indent');
|
|
2270
|
+
}
|
|
2265
2271
|
if (element.verticalAlign) {
|
|
2266
2272
|
el.style.verticalAlign = element.verticalAlign;
|
|
2267
2273
|
}
|
|
2274
|
+
else if (el.style.verticalAlign) {
|
|
2275
|
+
el.style.removeProperty('vertical-align');
|
|
2276
|
+
}
|
|
2268
2277
|
}
|
|
2269
2278
|
function getElementClassByPrefix(el, prefix) {
|
|
2270
2279
|
let matchClass = null;
|
|
@@ -6237,27 +6246,20 @@ const TableEditor = {
|
|
|
6237
6246
|
return tableComponent.headerRow;
|
|
6238
6247
|
},
|
|
6239
6248
|
hasHeaderRowCell(editor) {
|
|
6240
|
-
const
|
|
6241
|
-
const cells = TableEditor.getSelectedCells(editor);
|
|
6242
|
-
const { row, col } = cells[0];
|
|
6243
|
-
const cellPath = [...tableNode[1], row, col];
|
|
6244
|
-
const cellRange = { anchor: Editor.start(editor, cellPath), focus: Editor.end(editor, cellPath) };
|
|
6245
|
-
const [headerRow] = Editor.nodes(editor, {
|
|
6249
|
+
const isHeaderRow = Editor.nodes(editor, {
|
|
6246
6250
|
match: n => Element$1.isElement(n) &&
|
|
6247
|
-
((n.type === ElementKinds.tableRow && n.header) || (n.type === ElementKinds.table && n.options?.headerRow))
|
|
6248
|
-
at: cellRange
|
|
6251
|
+
((n.type === ElementKinds.tableRow && n.header) || (n.type === ElementKinds.table && n.options?.headerRow))
|
|
6249
6252
|
});
|
|
6250
|
-
|
|
6253
|
+
const selectedCells = TableEditor.getSelectedCells(editor) ?? [];
|
|
6254
|
+
sortCell(selectedCells);
|
|
6255
|
+
const isContainHeaderRow = !!selectedCells && selectedCells[0].row === 0;
|
|
6256
|
+
return isHeaderRow && isContainHeaderRow;
|
|
6251
6257
|
},
|
|
6252
6258
|
hasHeaderColumnCell(editor) {
|
|
6253
|
-
const
|
|
6254
|
-
const
|
|
6255
|
-
|
|
6256
|
-
const
|
|
6257
|
-
const focusPosition = TablePosition.create(opts, editor, focus.path);
|
|
6258
|
-
const anchorIndex = anchorPosition.getColumnIndex();
|
|
6259
|
-
const focusIndex = focusPosition.getColumnIndex();
|
|
6260
|
-
const isContainHeaderColumn = anchorIndex === 0 || focusIndex === 0;
|
|
6259
|
+
const table = getAboveByType(editor, ElementKinds.table);
|
|
6260
|
+
const selectedCells = TableEditor.getSelectedCells(editor) ?? [];
|
|
6261
|
+
sortCell(selectedCells);
|
|
6262
|
+
const isContainHeaderColumn = !!selectedCells && selectedCells[0].col === 0;
|
|
6261
6263
|
const isHeaderColumn = table && table[0] && table[0]?.options?.headerColumn;
|
|
6262
6264
|
return isHeaderColumn && isContainHeaderColumn;
|
|
6263
6265
|
},
|
|
@@ -11174,14 +11176,14 @@ function mergeCellContent(editor, leftTopCellPath, cellPath) {
|
|
|
11174
11176
|
}
|
|
11175
11177
|
|
|
11176
11178
|
function setCellMenuVisibility(editor, menuList, tableInfo) {
|
|
11177
|
-
const { selectedCells, isFullscreen, selectedRowsIndex, selectedColumnsIndex } = tableInfo;
|
|
11179
|
+
const { selectedCells, isFullscreen, isSelectedTable, selectedRowsIndex, selectedColumnsIndex } = tableInfo;
|
|
11178
11180
|
const isCellMerged = isSelectedCellMerged(editor);
|
|
11179
11181
|
const selectCellNodes = getSelectCellNode(editor, selectedCells).filter(item => !item.node.hidden);
|
|
11180
11182
|
const isRect = isRectangularInTableCells(editor, selectedCells);
|
|
11181
11183
|
menuList.forEach(item => {
|
|
11182
11184
|
switch (item.key) {
|
|
11183
11185
|
case 'merge-cells':
|
|
11184
|
-
item.visibility = selectCellNodes && selectCellNodes.length > 1 && isRect;
|
|
11186
|
+
item.visibility = selectCellNodes && selectCellNodes.length > 1 && !isSelectedTable && isRect;
|
|
11185
11187
|
break;
|
|
11186
11188
|
case 'split-cells':
|
|
11187
11189
|
item.visibility = selectCellNodes && selectCellNodes.length === 1 && isCellMerged;
|
|
@@ -11245,13 +11247,19 @@ class TheContextMenuComponent {
|
|
|
11245
11247
|
inputNumberFocus(e) {
|
|
11246
11248
|
e.target.focus();
|
|
11247
11249
|
}
|
|
11250
|
+
itemEnterHandle(e, entity) {
|
|
11251
|
+
e.preventDefault();
|
|
11252
|
+
e.stopPropagation();
|
|
11253
|
+
this.actionHandle(entity);
|
|
11254
|
+
this.thyPopoverRef.close();
|
|
11255
|
+
}
|
|
11248
11256
|
ngOnInit() { }
|
|
11249
11257
|
}
|
|
11250
11258
|
TheContextMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TheContextMenuComponent, deps: [{ token: i0.ElementRef }, { token: i1$1.ThyPopoverRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
11251
|
-
TheContextMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: TheContextMenuComponent, selector: "the-contextmenu", inputs: { menuEntities: "menuEntities", actionHandle: "actionHandle", activeHandle: "activeHandle", deactivateHandle: "deactivateHandle" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)", "mousedown": "handleMouseDown($event)" }, properties: { "class.the-overlay-menu-wrap": "this.wrap" } }, ngImport: i0, template: "<div class=\"thy-dropdown-menu\">\n <ng-container *ngFor=\"let menuItem of menuEntities\">\n <ng-container *ngIf=\"menuItem.visibility && !menuItem?.isInputNumber\">\n <ng-template [ngTemplateOutlet]=\"defaultMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"menuItem.visibility && menuItem?.isInputNumber\">\n <ng-template [ngTemplateOutlet]=\"inputNumberMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <thy-dropdown-menu-divider *ngIf=\"menuItem.divider && menuItem.visibility\"></thy-dropdown-menu-divider>\n </ng-container>\n</div>\n\n<ng-template #defaultMenuTemplate let-item>\n <a\n href=\"javascript:;\"\n thyDropdownMenuItem\n (mousedown)=\"itemMousedown($event, item)\"\n (mouseenter)=\"itemMouseenter($event, item)\"\n (mouseleave)=\"itemMouseleave($event, item)\"\n >\n <span thyDropdownMenuItemIcon>\n <thy-icon\n *ngIf=\"item?.backgroundColor; else elseIcon\"\n [thyIconName]=\"item.icon\"\n thyIconType=\"twotone\"\n [thyTwotoneColor]=\"item.backgroundColor\"\n ></thy-icon>\n <ng-template #elseIcon>\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </ng-template>\n </span>\n <span thyDropdownMenuItemName>{{ item.name }}</span>\n <span *ngIf=\"item.extendIcon\" thyDropdownMenuItemExtendIcon>\n <thy-icon thyIconName=\"{{ item.extendIcon }}\"></thy-icon>\n </span>\n </a>\n</ng-template>\n\n<ng-template #inputNumberMenuTemplate let-item>\n <a href=\"javascript:;\" class=\"the-input-number-menu\" thyDropdownMenuItem (click)=\"itemMousedown($event, item)\">\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName class=\"d-flex align-items-center\">\n {{ item.name }}\n <thy-input-number\n #inputNumber\n class=\"mx-2\"\n thySize=\"sm\"\n [(ngModel)]=\"item.count\"\n [thyStep]=\"1\"\n [thyMin]=\"1\"\n (click)=\"inputNumberFocus($event)\"\n (thyEnter)=\"
|
|
11259
|
+
TheContextMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: TheContextMenuComponent, selector: "the-contextmenu", inputs: { menuEntities: "menuEntities", actionHandle: "actionHandle", activeHandle: "activeHandle", deactivateHandle: "deactivateHandle" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)", "mousedown": "handleMouseDown($event)" }, properties: { "class.the-overlay-menu-wrap": "this.wrap" } }, ngImport: i0, template: "<div class=\"thy-dropdown-menu\">\n <ng-container *ngFor=\"let menuItem of menuEntities\">\n <ng-container *ngIf=\"menuItem.visibility && !menuItem?.isInputNumber\">\n <ng-template [ngTemplateOutlet]=\"defaultMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"menuItem.visibility && menuItem?.isInputNumber\">\n <ng-template [ngTemplateOutlet]=\"inputNumberMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <thy-dropdown-menu-divider *ngIf=\"menuItem.divider && menuItem.visibility\"></thy-dropdown-menu-divider>\n </ng-container>\n</div>\n\n<ng-template #defaultMenuTemplate let-item>\n <a\n href=\"javascript:;\"\n thyDropdownMenuItem\n (mousedown)=\"itemMousedown($event, item)\"\n (mouseenter)=\"itemMouseenter($event, item)\"\n (mouseleave)=\"itemMouseleave($event, item)\"\n >\n <span thyDropdownMenuItemIcon>\n <thy-icon\n *ngIf=\"item?.backgroundColor; else elseIcon\"\n [thyIconName]=\"item.icon\"\n thyIconType=\"twotone\"\n [thyTwotoneColor]=\"item.backgroundColor\"\n ></thy-icon>\n <ng-template #elseIcon>\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </ng-template>\n </span>\n <span thyDropdownMenuItemName>{{ item.name }}</span>\n <span *ngIf=\"item.extendIcon\" thyDropdownMenuItemExtendIcon>\n <thy-icon thyIconName=\"{{ item.extendIcon }}\"></thy-icon>\n </span>\n </a>\n</ng-template>\n\n<ng-template #inputNumberMenuTemplate let-item>\n <a href=\"javascript:;\" class=\"the-input-number-menu\" thyDropdownMenuItem (click)=\"itemMousedown($event, item)\">\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName class=\"d-flex align-items-center\">\n {{ item.name }}\n <thy-input-number\n #inputNumber\n class=\"mx-2\"\n thySize=\"sm\"\n [(ngModel)]=\"item.count\"\n [thyStep]=\"1\"\n [thyMin]=\"1\"\n (click)=\"inputNumberFocus($event)\"\n (thyEnter)=\"itemEnterHandle($event, item)\"\n thyStopPropagation\n ></thy-input-number>\n {{ item.nameSuffix }}\n </span>\n </a>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3.ThyIconComponent, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "directive", type: i5$1.ThyEnterDirective, selector: "[thyEnter]", outputs: ["thyEnter"] }, { kind: "directive", type: i5$1.ThyStopPropagationDirective, selector: "[thyStopPropagation]", inputs: ["thyStopPropagation"] }, { kind: "component", type: i6.ThyDropdownMenuDividerComponent, selector: "thy-dropdown-menu-divider" }, { kind: "directive", type: i6.ThyDropdownMenuItemDirective, selector: "[thyDropdownMenuItem]", inputs: ["thyType", "thyDisabled"] }, { kind: "directive", type: i6.ThyDropdownMenuItemNameDirective, selector: "[thyDropdownMenuItemName]" }, { kind: "directive", type: i6.ThyDropdownMenuItemIconDirective, selector: "[thyDropdownMenuItemIcon]" }, { kind: "directive", type: i6.ThyDropdownMenuItemExtendIconDirective, selector: "[thyDropdownMenuItemExtendIcon]" }, { kind: "component", type: i7$1.ThyInputNumberComponent, selector: "thy-input-number", inputs: ["thyAutoFocus", "thyPlaceholder", "thyDisabled", "thyMax", "thyMin", "thyStep", "thySize", "thyPrecision", "thySuffix"], outputs: ["thyBlur", "thyFocus"] }] });
|
|
11252
11260
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TheContextMenuComponent, decorators: [{
|
|
11253
11261
|
type: Component,
|
|
11254
|
-
args: [{ selector: 'the-contextmenu', template: "<div class=\"thy-dropdown-menu\">\n <ng-container *ngFor=\"let menuItem of menuEntities\">\n <ng-container *ngIf=\"menuItem.visibility && !menuItem?.isInputNumber\">\n <ng-template [ngTemplateOutlet]=\"defaultMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"menuItem.visibility && menuItem?.isInputNumber\">\n <ng-template [ngTemplateOutlet]=\"inputNumberMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <thy-dropdown-menu-divider *ngIf=\"menuItem.divider && menuItem.visibility\"></thy-dropdown-menu-divider>\n </ng-container>\n</div>\n\n<ng-template #defaultMenuTemplate let-item>\n <a\n href=\"javascript:;\"\n thyDropdownMenuItem\n (mousedown)=\"itemMousedown($event, item)\"\n (mouseenter)=\"itemMouseenter($event, item)\"\n (mouseleave)=\"itemMouseleave($event, item)\"\n >\n <span thyDropdownMenuItemIcon>\n <thy-icon\n *ngIf=\"item?.backgroundColor; else elseIcon\"\n [thyIconName]=\"item.icon\"\n thyIconType=\"twotone\"\n [thyTwotoneColor]=\"item.backgroundColor\"\n ></thy-icon>\n <ng-template #elseIcon>\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </ng-template>\n </span>\n <span thyDropdownMenuItemName>{{ item.name }}</span>\n <span *ngIf=\"item.extendIcon\" thyDropdownMenuItemExtendIcon>\n <thy-icon thyIconName=\"{{ item.extendIcon }}\"></thy-icon>\n </span>\n </a>\n</ng-template>\n\n<ng-template #inputNumberMenuTemplate let-item>\n <a href=\"javascript:;\" class=\"the-input-number-menu\" thyDropdownMenuItem (click)=\"itemMousedown($event, item)\">\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName class=\"d-flex align-items-center\">\n {{ item.name }}\n <thy-input-number\n #inputNumber\n class=\"mx-2\"\n thySize=\"sm\"\n [(ngModel)]=\"item.count\"\n [thyStep]=\"1\"\n [thyMin]=\"1\"\n (click)=\"inputNumberFocus($event)\"\n (thyEnter)=\"
|
|
11262
|
+
args: [{ selector: 'the-contextmenu', template: "<div class=\"thy-dropdown-menu\">\n <ng-container *ngFor=\"let menuItem of menuEntities\">\n <ng-container *ngIf=\"menuItem.visibility && !menuItem?.isInputNumber\">\n <ng-template [ngTemplateOutlet]=\"defaultMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"menuItem.visibility && menuItem?.isInputNumber\">\n <ng-template [ngTemplateOutlet]=\"inputNumberMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <thy-dropdown-menu-divider *ngIf=\"menuItem.divider && menuItem.visibility\"></thy-dropdown-menu-divider>\n </ng-container>\n</div>\n\n<ng-template #defaultMenuTemplate let-item>\n <a\n href=\"javascript:;\"\n thyDropdownMenuItem\n (mousedown)=\"itemMousedown($event, item)\"\n (mouseenter)=\"itemMouseenter($event, item)\"\n (mouseleave)=\"itemMouseleave($event, item)\"\n >\n <span thyDropdownMenuItemIcon>\n <thy-icon\n *ngIf=\"item?.backgroundColor; else elseIcon\"\n [thyIconName]=\"item.icon\"\n thyIconType=\"twotone\"\n [thyTwotoneColor]=\"item.backgroundColor\"\n ></thy-icon>\n <ng-template #elseIcon>\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </ng-template>\n </span>\n <span thyDropdownMenuItemName>{{ item.name }}</span>\n <span *ngIf=\"item.extendIcon\" thyDropdownMenuItemExtendIcon>\n <thy-icon thyIconName=\"{{ item.extendIcon }}\"></thy-icon>\n </span>\n </a>\n</ng-template>\n\n<ng-template #inputNumberMenuTemplate let-item>\n <a href=\"javascript:;\" class=\"the-input-number-menu\" thyDropdownMenuItem (click)=\"itemMousedown($event, item)\">\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName class=\"d-flex align-items-center\">\n {{ item.name }}\n <thy-input-number\n #inputNumber\n class=\"mx-2\"\n thySize=\"sm\"\n [(ngModel)]=\"item.count\"\n [thyStep]=\"1\"\n [thyMin]=\"1\"\n (click)=\"inputNumberFocus($event)\"\n (thyEnter)=\"itemEnterHandle($event, item)\"\n thyStopPropagation\n ></thy-input-number>\n {{ item.nameSuffix }}\n </span>\n </a>\n</ng-template>\n" }]
|
|
11255
11263
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.ThyPopoverRef }]; }, propDecorators: { menuEntities: [{
|
|
11256
11264
|
type: Input
|
|
11257
11265
|
}], actionHandle: [{
|
|
@@ -11284,10 +11292,10 @@ class TableStore {
|
|
|
11284
11292
|
this.isPrepareSelecting = false;
|
|
11285
11293
|
this.isCellSelecting = false;
|
|
11286
11294
|
this.isRightClicking = false;
|
|
11287
|
-
this.
|
|
11295
|
+
this.pointerSelection = false;
|
|
11288
11296
|
this.isSelectedAllCell = () => {
|
|
11289
11297
|
const pos = this.createTablePosition();
|
|
11290
|
-
return pos.getHeight() * pos.getWidth() === this.selectedCells.length;
|
|
11298
|
+
return !!this.selectedCells.length && pos.getHeight() * pos.getWidth() === this.selectedCells.length;
|
|
11291
11299
|
};
|
|
11292
11300
|
}
|
|
11293
11301
|
get selectedCells() {
|
|
@@ -11304,6 +11312,13 @@ class TableStore {
|
|
|
11304
11312
|
const tableEntry = this.getTableEntry();
|
|
11305
11313
|
return tableEntry[1];
|
|
11306
11314
|
}
|
|
11315
|
+
updateCellPositionRefs(row = 0, col = 0) {
|
|
11316
|
+
const cells = [];
|
|
11317
|
+
this.selectedCells.forEach(cell => {
|
|
11318
|
+
cells.push({ ...cell, row: cell.row + row, col: cell.col + col });
|
|
11319
|
+
});
|
|
11320
|
+
this.selectedCells$.next(cells);
|
|
11321
|
+
}
|
|
11307
11322
|
setSelectedCells(cells, pos) {
|
|
11308
11323
|
const rowGroup = groupBy(cells, ({ row, col }) => row);
|
|
11309
11324
|
const colGroup = groupBy(cells, ({ row, col }) => col);
|
|
@@ -11338,7 +11353,7 @@ class TableStore {
|
|
|
11338
11353
|
*/
|
|
11339
11354
|
uniqueCellPosition(cells) {
|
|
11340
11355
|
let result = [];
|
|
11341
|
-
if (this.
|
|
11356
|
+
if (this.pointerSelection) {
|
|
11342
11357
|
const modCells = new Set();
|
|
11343
11358
|
cells.concat(this.selectedCells).forEach(cell => modCells.add(JSON.stringify(cell)));
|
|
11344
11359
|
modCells.forEach((cell) => result.push(JSON.parse(cell)));
|
|
@@ -11476,7 +11491,7 @@ class TableStore {
|
|
|
11476
11491
|
const [row, col] = path.slice(-2);
|
|
11477
11492
|
const pos = this.createTablePosition();
|
|
11478
11493
|
const result = [{ row, col }];
|
|
11479
|
-
if (this.
|
|
11494
|
+
if (this.pointerSelection) {
|
|
11480
11495
|
result.push(...this.selectedCells);
|
|
11481
11496
|
// 处理单元格选中时,处理为选中多单元格
|
|
11482
11497
|
result.push(...this.getCellPositionsBeforeMerge({ row, col }));
|
|
@@ -11650,8 +11665,7 @@ class TableStore {
|
|
|
11650
11665
|
const cells = this.selectedCells;
|
|
11651
11666
|
const tablePath = this.getTablePath();
|
|
11652
11667
|
Editor.withoutNormalizing(this.editor, () => {
|
|
11653
|
-
for (const
|
|
11654
|
-
const { row, col } = cell;
|
|
11668
|
+
for (const { row, col } of cells) {
|
|
11655
11669
|
const cellPath = [...tablePath, row, col];
|
|
11656
11670
|
Transforms.setNodes(this.editor, { backgroundColor }, { at: cellPath });
|
|
11657
11671
|
}
|
|
@@ -11669,8 +11683,7 @@ class TableStore {
|
|
|
11669
11683
|
const tablePosition = this.createTablePosition();
|
|
11670
11684
|
if (tablePosition.isInTable()) {
|
|
11671
11685
|
Editor.withoutNormalizing(this.editor, () => {
|
|
11672
|
-
for (const
|
|
11673
|
-
const { row, col } = cell;
|
|
11686
|
+
for (const { row, col } of cells) {
|
|
11674
11687
|
const cellPath = [...tablePosition.tableEntry[1], row, col];
|
|
11675
11688
|
const node = Node.get(this.editor, cellPath);
|
|
11676
11689
|
TableEditor.clearCell(this.editor, [node, cellPath]);
|
|
@@ -11694,7 +11707,7 @@ class TableStore {
|
|
|
11694
11707
|
this.removeColumnOrRows(dangerousRowsIndex, dangerousColumnsIndex);
|
|
11695
11708
|
}
|
|
11696
11709
|
createTablePosition() {
|
|
11697
|
-
const {
|
|
11710
|
+
const { path } = this.editor.selection.anchor;
|
|
11698
11711
|
const opts = new TableOptions();
|
|
11699
11712
|
return TablePosition.create(opts, this.editor, path);
|
|
11700
11713
|
}
|
|
@@ -11799,6 +11812,7 @@ class TheTableContextMenuService {
|
|
|
11799
11812
|
actionHandle: (item) => {
|
|
11800
11813
|
const { targetRowIndex } = this.getTargetRowOrColIndex();
|
|
11801
11814
|
TableEditor.insertRow(this.editor, item.count, targetRowIndex);
|
|
11815
|
+
this.tableStore.updateCellPositionRefs(item.count);
|
|
11802
11816
|
this.tableStore.changeCells();
|
|
11803
11817
|
}
|
|
11804
11818
|
},
|
|
@@ -11825,6 +11839,7 @@ class TheTableContextMenuService {
|
|
|
11825
11839
|
actionHandle: (item) => {
|
|
11826
11840
|
const { targetColIndex } = this.getTargetRowOrColIndex();
|
|
11827
11841
|
TableEditor.insertColumn(this.editor, item.count, targetColIndex);
|
|
11842
|
+
this.tableStore.updateCellPositionRefs(0, item.count);
|
|
11828
11843
|
this.tableStore.changeCells();
|
|
11829
11844
|
}
|
|
11830
11845
|
},
|
|
@@ -11940,8 +11955,8 @@ class TheTableContextMenuService {
|
|
|
11940
11955
|
}
|
|
11941
11956
|
openMenuList(event) {
|
|
11942
11957
|
this.ngZone.run(() => {
|
|
11943
|
-
const { selectedCells, isFullscreen, selectedRowsIndex, selectedColumnsIndex } = this.tableStore;
|
|
11944
|
-
const tableInfo = { selectedCells, isFullscreen, selectedRowsIndex, selectedColumnsIndex };
|
|
11958
|
+
const { selectedCells, isFullscreen, selectedRowsIndex, selectedColumnsIndex, isSelectedTable } = this.tableStore;
|
|
11959
|
+
const tableInfo = { selectedCells, isFullscreen, selectedRowsIndex, selectedColumnsIndex, isSelectedTable };
|
|
11945
11960
|
const { row, col } = this.getSelectedCell();
|
|
11946
11961
|
setCellMenuVisibility(this.editor, this.menuEntities, tableInfo);
|
|
11947
11962
|
this.menuEntities.forEach(item => {
|
|
@@ -12148,8 +12163,8 @@ class TheTableToolbarComponent {
|
|
|
12148
12163
|
}
|
|
12149
12164
|
ngOnInit() {
|
|
12150
12165
|
this.isColumnEqual = this.tableElement?.columns?.every(col => this.tableElement.columns[0].width === col.width) ?? true;
|
|
12151
|
-
const { selectedCells } = this.tableStore;
|
|
12152
|
-
const tableInfo = { selectedCells };
|
|
12166
|
+
const { selectedCells, isSelectedTable } = this.tableStore;
|
|
12167
|
+
const tableInfo = { selectedCells, isSelectedTable };
|
|
12153
12168
|
this.isRectangle = isRectangularInTableCells(this.editor, selectedCells);
|
|
12154
12169
|
this.deleteIcon = this.isRectangle && DeleteIcon[this.getDeleteIcon()];
|
|
12155
12170
|
this.getIconName(this.deleteIcon);
|
|
@@ -12388,11 +12403,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
12388
12403
|
args: [{ name: 'freezeColumn' }]
|
|
12389
12404
|
}] });
|
|
12390
12405
|
class TableFreezeRowPipe {
|
|
12391
|
-
transform(table, headerRow) {
|
|
12406
|
+
transform(table, headerRow, tablePluginOptions) {
|
|
12392
12407
|
// 标题行存在合并的行时,取消冻结
|
|
12393
12408
|
if (table.children) {
|
|
12394
12409
|
const mergeRows = table.children[0]?.children.filter(item => item.rowspan && item.rowspan !== 1);
|
|
12395
|
-
return !!(headerRow && !mergeRows.length);
|
|
12410
|
+
return !!(headerRow && !mergeRows.length && tablePluginOptions?.freezeRowHeader);
|
|
12396
12411
|
}
|
|
12397
12412
|
return false;
|
|
12398
12413
|
}
|
|
@@ -12734,7 +12749,7 @@ class TheTableComponent extends TheBaseElementComponent {
|
|
|
12734
12749
|
this.isStickyTop =
|
|
12735
12750
|
top <= this.scrollContainerTop + 8 && clientRect.bottom - this.scrollContainerTop >= headerRowHeight;
|
|
12736
12751
|
// 标题行内容超过固定高度时移除冻结
|
|
12737
|
-
if (this.isStickyTop && this.freezeRowPipe.transform(this.element, this.headerRow)) {
|
|
12752
|
+
if (this.isStickyTop && this.freezeRowPipe.transform(this.element, this.headerRow, this.tablePluginOptions)) {
|
|
12738
12753
|
const maxHeaderRowHeight = (24 + 8) * 11; // 超出 11 行,取消冻结
|
|
12739
12754
|
this.isStickyTop = headerRowHeight <= maxHeaderRowHeight;
|
|
12740
12755
|
}
|
|
@@ -12804,7 +12819,7 @@ class TheTableComponent extends TheBaseElementComponent {
|
|
|
12804
12819
|
const colControl = this.columnControlsWrapper.nativeElement;
|
|
12805
12820
|
const headerRow = this.nativeElement.querySelector('tbody tr');
|
|
12806
12821
|
const stickyRows = this.isInTable ? [colControl, headerRow] : [headerRow];
|
|
12807
|
-
if (this.freezeRowPipe.transform(this.element, this.headerRow)) {
|
|
12822
|
+
if (this.freezeRowPipe.transform(this.element, this.headerRow, this.tablePluginOptions)) {
|
|
12808
12823
|
let gridColumns = '';
|
|
12809
12824
|
const tablePadding = 44;
|
|
12810
12825
|
let tableWidth = this.elementRef.nativeElement.offsetWidth;
|
|
@@ -12825,7 +12840,7 @@ class TheTableComponent extends TheBaseElementComponent {
|
|
|
12825
12840
|
const rowControlButton = this.rowControlsButtonWrapper.first?.nativeElement;
|
|
12826
12841
|
const tableCornerBtn = this.cornerControl.nativeElement;
|
|
12827
12842
|
const headerRowHeight = this.calculateRowControls()[0]?.height;
|
|
12828
|
-
if (this.isStickyTop && this.freezeRowPipe.transform(this.element, this.headerRow)) {
|
|
12843
|
+
if (this.isStickyTop && this.freezeRowPipe.transform(this.element, this.headerRow, this.tablePluginOptions)) {
|
|
12829
12844
|
this.renderer.addClass(this.nativeElement, TableWithStickyRowClass);
|
|
12830
12845
|
this.updateStickyRowScrollLeft();
|
|
12831
12846
|
const numberedColumn = this.element.options?.numberedColumn;
|
|
@@ -12894,7 +12909,7 @@ class TheTableComponent extends TheBaseElementComponent {
|
|
|
12894
12909
|
});
|
|
12895
12910
|
}
|
|
12896
12911
|
useRowControls() {
|
|
12897
|
-
if ((this.selection && !this.readonly) || this.element.options?.numberedColumn || this.tableStore.
|
|
12912
|
+
if ((this.selection && !this.readonly) || this.element.options?.numberedColumn || this.tableStore.isRightClicking) {
|
|
12898
12913
|
this.rowControls = this.calculateRowControls();
|
|
12899
12914
|
}
|
|
12900
12915
|
}
|
|
@@ -13148,7 +13163,7 @@ class TheTableComponent extends TheBaseElementComponent {
|
|
|
13148
13163
|
}
|
|
13149
13164
|
// patch for right click select next cell
|
|
13150
13165
|
setTimeout(() => {
|
|
13151
|
-
Transforms.select(this.editor, this.editor.selection
|
|
13166
|
+
Transforms.select(this.editor, Editor.start(this.editor, this.editor.selection));
|
|
13152
13167
|
});
|
|
13153
13168
|
});
|
|
13154
13169
|
});
|
|
@@ -13165,7 +13180,7 @@ class TheTableComponent extends TheBaseElementComponent {
|
|
|
13165
13180
|
this.tableStore.clearSelectedCellsContent();
|
|
13166
13181
|
}
|
|
13167
13182
|
const isCurrentTableElement = this.nativeElement.contains(e.target);
|
|
13168
|
-
if (!isCurrentTableElement || !this.tableStore.
|
|
13183
|
+
if (!isCurrentTableElement || !this.tableStore.pointerSelection) {
|
|
13169
13184
|
this.tableStore.clearSelectedCells();
|
|
13170
13185
|
}
|
|
13171
13186
|
if (!isCurrentTableElement) {
|
|
@@ -13181,13 +13196,13 @@ class TheTableComponent extends TheBaseElementComponent {
|
|
|
13181
13196
|
.pipe(takeUntil(this.destroy$), filter((e) => !!e))
|
|
13182
13197
|
.subscribe((event) => {
|
|
13183
13198
|
if (isHotkey('mod', event) && !this.readonly) {
|
|
13184
|
-
this.tableStore.
|
|
13199
|
+
this.tableStore.pointerSelection = true;
|
|
13185
13200
|
}
|
|
13186
13201
|
});
|
|
13187
13202
|
fromEvent(document, 'keyup')
|
|
13188
13203
|
.pipe(takeUntil(this.destroy$), filter((e) => !!e))
|
|
13189
13204
|
.subscribe(() => {
|
|
13190
|
-
this.tableStore.
|
|
13205
|
+
this.tableStore.pointerSelection = false;
|
|
13191
13206
|
});
|
|
13192
13207
|
});
|
|
13193
13208
|
}
|
|
@@ -13241,7 +13256,7 @@ class TheTableComponent extends TheBaseElementComponent {
|
|
|
13241
13256
|
}
|
|
13242
13257
|
}
|
|
13243
13258
|
TheTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TheTableComponent, deps: [{ token: i0.ElementRef }, { token: TableCellEventDispatcher }, { token: ColumnResizeNotifierSource }, { token: TableStore }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: TableService }, { token: TheTableContextMenuService }, { token: TableFreezeColumnPipe }, { token: TableFreezeRowPipe }, { token: i0.Renderer2 }, { token: TheContextService }], target: i0.ɵɵFactoryTarget.Component });
|
|
13244
|
-
TheTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: TheTableComponent, selector: "the-table, [theTable]", host: { listeners: { "mousedown": "handleMousedown($event)" }, properties: { "class.the-table-with-controls": "isInTable || tableStore.
|
|
13259
|
+
TheTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: TheTableComponent, selector: "the-table, [theTable]", host: { listeners: { "mousedown": "handleMousedown($event)" }, properties: { "class.the-table-with-controls": "isInTable || tableStore.isRightClicking", "class.the-table-with-sticky-column": "element?.options?.headerColumn", "class.the-numberd-table": "element?.options?.numberedColumn", "class.the-table-selection-hide": "tableStore.isCellSelecting || tableStore.isRightClicking" } }, providers: [
|
|
13245
13260
|
TableStore,
|
|
13246
13261
|
TableService,
|
|
13247
13262
|
TheTableContextMenuService,
|
|
@@ -13253,7 +13268,7 @@ TheTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", vers
|
|
|
13253
13268
|
provide: THE_TABLE_COMPONENT_TOKEN,
|
|
13254
13269
|
useExisting: TheTableComponent
|
|
13255
13270
|
}
|
|
13256
|
-
], viewQueries: [{ propertyName: "tableWrapper", first: true, predicate: ["tableWrapper"], descendants: true, read: ElementRef, static: true }, { propertyName: "theTableElement", first: true, predicate: ["theTable"], descendants: true, read: ElementRef, static: true }, { propertyName: "tbodyElement", first: true, predicate: ["tbody"], descendants: true, read: ElementRef, static: true }, { propertyName: "columnControlsWrapper", first: true, predicate: ["columnControlsWrapper"], descendants: true, read: ElementRef }, { propertyName: "cornerControl", first: true, predicate: ["cornerControl"], descendants: true, read: ElementRef }, { propertyName: "rowControlsButtonWrapper", predicate: ["rowControlsButtonWrapper"], descendants: true, read: ElementRef }], usesInheritance: true, ngImport: i0, template: "<div class=\"the-table-container\" theColumnResize>\n <div class=\"the-table-row-controls-wrapper\">\n <div\n class=\"the-table-corner-controls the-sticky-corner-controls\"\n #cornerControl\n [ngClass]=\"{\n visible: !readonly && (isInTable || tableStore.
|
|
13271
|
+
], viewQueries: [{ propertyName: "tableWrapper", first: true, predicate: ["tableWrapper"], descendants: true, read: ElementRef, static: true }, { propertyName: "theTableElement", first: true, predicate: ["theTable"], descendants: true, read: ElementRef, static: true }, { propertyName: "tbodyElement", first: true, predicate: ["tbody"], descendants: true, read: ElementRef, static: true }, { propertyName: "columnControlsWrapper", first: true, predicate: ["columnControlsWrapper"], descendants: true, read: ElementRef }, { propertyName: "cornerControl", first: true, predicate: ["cornerControl"], descendants: true, read: ElementRef }, { propertyName: "rowControlsButtonWrapper", predicate: ["rowControlsButtonWrapper"], descendants: true, read: ElementRef }], usesInheritance: true, ngImport: i0, template: "<div class=\"the-table-container\" theColumnResize>\n <div class=\"the-table-row-controls-wrapper\">\n <div\n class=\"the-table-corner-controls the-sticky-corner-controls\"\n #cornerControl\n [ngClass]=\"{\n visible: !readonly && (isInTable || tableStore.isRightClicking),\n active: isSelectedAllCell,\n dangerous: tableStore.isSelectedTable && tableStore.dangerousCells.length > 0\n }\"\n >\n <div class=\"the-table-corner-button\" (mousedown)=\"onSelectTable($event)\"></div>\n <div class=\"the-table-corner-controls-insert-row-marker\" *ngIf=\"!headerRow\">\n <the-table-insert-mark type=\"row\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n <div class=\"the-table-corner-controls-insert-column-marker\" *ngIf=\"!element.options?.headerColumn\">\n <the-table-insert-mark type=\"column\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n </div>\n <div class=\"the-table-row-controls\">\n <div class=\"the-table-row-controls-inner\">\n <div\n class=\"the-table-row-controls-button-wrap\"\n #rowControlsButtonWrapper\n *ngFor=\"let control of rowControls; let i = index; trackBy: trackByFnRowControls\"\n [ngClass]=\"{\n active: tableStore.selectedRowsIndex.includes(control.rowIndex),\n dangerous: tableStore.dangerousRowsIndex.includes(control.rowIndex) && tableStore.dangerousCells.length > 0\n }\"\n >\n <ng-container *ngIf=\"!readonly && (isInTable || tableStore.isRightClicking) && !element?.options?.numberedColumn\">\n <button\n (mousedown)=\"onRowMousedown($event, control.rowIndex)\"\n type=\"button\"\n [ngStyle]=\"{ height: control.height + 1 + 'px' }\"\n class=\"the-table-row-controls-button the-table-controls-button\"\n ></button>\n </ng-container>\n <ng-container *ngIf=\"element?.options?.numberedColumn\">\n <div\n [contentEditable]=\"false\"\n contenteditable=\"false\"\n (mousedown)=\"onRowMousedown($event, control.rowIndex)\"\n class=\"the-table-numbered-controls-button\"\n [ngStyle]=\"{ height: control.height + 1 + 'px' }\"\n >\n <p class=\"row-number d-flex align-items-center\">{{ headerRow && i === 0 ? '' : headerRow ? i : i + 1 }}</p>\n </div>\n </ng-container>\n <the-table-insert-mark type=\"row\" [at]=\"control.rowIndex + 1\" [tableStore]=\"tableStore\"> </the-table-insert-mark>\n </div>\n </div>\n </div>\n </div>\n <div class=\"the-table-wrapper\" #tableWrapper [ngClass]=\"{ 'the-table-numbered': element?.options?.numberedColumn }\">\n <table class=\"the-table\" #theTable>\n <colgroup *ngIf=\"columns\">\n <col *ngFor=\"let col of columns\" [ngStyle]=\"{ width: col.width + 'px' }\" />\n </colgroup>\n <thead>\n <tr class=\"the-table-col-controls-wrapper the-sticky-row\" #columnControlsWrapper>\n <th\n #colControl\n class=\"the-table-col-controls\"\n [ngClass]=\"{\n 'the-sticky-cell': i === 0 && element | freezeColumn : tablePluginOptions,\n active: tableStore.selectedColumnsIndex.includes(i),\n dangerous: tableStore.dangerousColumnsIndex.includes(i) && tableStore.dangerousCells.length > 0\n }\"\n (mousedown)=\"onColMousedown($event, i)\"\n *ngFor=\"let control of colControls; let i = index; trackBy: trackByFnColControls\"\n >\n <the-table-insert-mark\n *ngIf=\"isInTable || tableStore.isRightClicking\"\n type=\"column\"\n [at]=\"i + 1\"\n [tableStore]=\"tableStore\"\n [parentElement]=\"colControl\"\n >\n </the-table-insert-mark>\n </th>\n </tr>\n </thead>\n <tbody #tbody>\n <slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"> </slate-children>\n </tbody>\n </table>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { kind: "directive", type: TheColumnResizeDirective, selector: "div[theColumnResize]" }, { kind: "component", type: TheInsertMarkComponent, selector: "the-table-insert-mark", inputs: ["type", "at", "tableStore", "parentElement"] }, { kind: "pipe", type: TableFreezeColumnPipe, name: "freezeColumn" }] });
|
|
13257
13272
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TheTableComponent, decorators: [{
|
|
13258
13273
|
type: Component,
|
|
13259
13274
|
args: [{ selector: 'the-table, [theTable]', providers: [
|
|
@@ -13269,10 +13284,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
13269
13284
|
useExisting: TheTableComponent
|
|
13270
13285
|
}
|
|
13271
13286
|
], host: {
|
|
13272
|
-
'[class.the-table-with-controls]': 'isInTable || tableStore.
|
|
13287
|
+
'[class.the-table-with-controls]': 'isInTable || tableStore.isRightClicking',
|
|
13288
|
+
'[class.the-table-with-sticky-column]': 'element?.options?.headerColumn',
|
|
13273
13289
|
'[class.the-numberd-table]': 'element?.options?.numberedColumn',
|
|
13274
13290
|
'[class.the-table-selection-hide]': 'tableStore.isCellSelecting || tableStore.isRightClicking'
|
|
13275
|
-
}, template: "<div class=\"the-table-container\" theColumnResize>\n <div class=\"the-table-row-controls-wrapper\">\n <div\n class=\"the-table-corner-controls the-sticky-corner-controls\"\n #cornerControl\n [ngClass]=\"{\n visible: !readonly && (isInTable || tableStore.
|
|
13291
|
+
}, template: "<div class=\"the-table-container\" theColumnResize>\n <div class=\"the-table-row-controls-wrapper\">\n <div\n class=\"the-table-corner-controls the-sticky-corner-controls\"\n #cornerControl\n [ngClass]=\"{\n visible: !readonly && (isInTable || tableStore.isRightClicking),\n active: isSelectedAllCell,\n dangerous: tableStore.isSelectedTable && tableStore.dangerousCells.length > 0\n }\"\n >\n <div class=\"the-table-corner-button\" (mousedown)=\"onSelectTable($event)\"></div>\n <div class=\"the-table-corner-controls-insert-row-marker\" *ngIf=\"!headerRow\">\n <the-table-insert-mark type=\"row\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n <div class=\"the-table-corner-controls-insert-column-marker\" *ngIf=\"!element.options?.headerColumn\">\n <the-table-insert-mark type=\"column\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n </div>\n <div class=\"the-table-row-controls\">\n <div class=\"the-table-row-controls-inner\">\n <div\n class=\"the-table-row-controls-button-wrap\"\n #rowControlsButtonWrapper\n *ngFor=\"let control of rowControls; let i = index; trackBy: trackByFnRowControls\"\n [ngClass]=\"{\n active: tableStore.selectedRowsIndex.includes(control.rowIndex),\n dangerous: tableStore.dangerousRowsIndex.includes(control.rowIndex) && tableStore.dangerousCells.length > 0\n }\"\n >\n <ng-container *ngIf=\"!readonly && (isInTable || tableStore.isRightClicking) && !element?.options?.numberedColumn\">\n <button\n (mousedown)=\"onRowMousedown($event, control.rowIndex)\"\n type=\"button\"\n [ngStyle]=\"{ height: control.height + 1 + 'px' }\"\n class=\"the-table-row-controls-button the-table-controls-button\"\n ></button>\n </ng-container>\n <ng-container *ngIf=\"element?.options?.numberedColumn\">\n <div\n [contentEditable]=\"false\"\n contenteditable=\"false\"\n (mousedown)=\"onRowMousedown($event, control.rowIndex)\"\n class=\"the-table-numbered-controls-button\"\n [ngStyle]=\"{ height: control.height + 1 + 'px' }\"\n >\n <p class=\"row-number d-flex align-items-center\">{{ headerRow && i === 0 ? '' : headerRow ? i : i + 1 }}</p>\n </div>\n </ng-container>\n <the-table-insert-mark type=\"row\" [at]=\"control.rowIndex + 1\" [tableStore]=\"tableStore\"> </the-table-insert-mark>\n </div>\n </div>\n </div>\n </div>\n <div class=\"the-table-wrapper\" #tableWrapper [ngClass]=\"{ 'the-table-numbered': element?.options?.numberedColumn }\">\n <table class=\"the-table\" #theTable>\n <colgroup *ngIf=\"columns\">\n <col *ngFor=\"let col of columns\" [ngStyle]=\"{ width: col.width + 'px' }\" />\n </colgroup>\n <thead>\n <tr class=\"the-table-col-controls-wrapper the-sticky-row\" #columnControlsWrapper>\n <th\n #colControl\n class=\"the-table-col-controls\"\n [ngClass]=\"{\n 'the-sticky-cell': i === 0 && element | freezeColumn : tablePluginOptions,\n active: tableStore.selectedColumnsIndex.includes(i),\n dangerous: tableStore.dangerousColumnsIndex.includes(i) && tableStore.dangerousCells.length > 0\n }\"\n (mousedown)=\"onColMousedown($event, i)\"\n *ngFor=\"let control of colControls; let i = index; trackBy: trackByFnColControls\"\n >\n <the-table-insert-mark\n *ngIf=\"isInTable || tableStore.isRightClicking\"\n type=\"column\"\n [at]=\"i + 1\"\n [tableStore]=\"tableStore\"\n [parentElement]=\"colControl\"\n >\n </the-table-insert-mark>\n </th>\n </tr>\n </thead>\n <tbody #tbody>\n <slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"> </slate-children>\n </tbody>\n </table>\n </div>\n</div>\n" }]
|
|
13276
13292
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: TableCellEventDispatcher }, { type: ColumnResizeNotifierSource }, { type: TableStore }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: TableService }, { type: TheTableContextMenuService }, { type: TableFreezeColumnPipe }, { type: TableFreezeRowPipe }, { type: i0.Renderer2 }, { type: TheContextService }]; }, propDecorators: { tableWrapper: [{
|
|
13277
13293
|
type: ViewChild,
|
|
13278
13294
|
args: ['tableWrapper', { read: ElementRef, static: true }]
|
|
@@ -13852,7 +13868,8 @@ class TheTdComponent extends TheBaseElementComponent {
|
|
|
13852
13868
|
this.renderer.removeClass(this.elementRef.nativeElement, 'selected-cell');
|
|
13853
13869
|
}
|
|
13854
13870
|
else {
|
|
13855
|
-
const
|
|
13871
|
+
const selectCellNodes = getSelectCellNode(this.editor, x);
|
|
13872
|
+
const isSelectedCell = selectCellNodes.find(cell => cell.node === this.element);
|
|
13856
13873
|
if (isSelectedCell) {
|
|
13857
13874
|
this.renderer.addClass(this.elementRef.nativeElement, 'selected-cell');
|
|
13858
13875
|
}
|
|
@@ -13872,7 +13889,8 @@ class TheTdComponent extends TheBaseElementComponent {
|
|
|
13872
13889
|
this.renderer.removeClass(this.elementRef.nativeElement, 'dangerous-cell');
|
|
13873
13890
|
}
|
|
13874
13891
|
else {
|
|
13875
|
-
const
|
|
13892
|
+
const selectCellNodes = getSelectCellNode(this.editor, x);
|
|
13893
|
+
const isSelectedCell = selectCellNodes.find(cell => cell.node === this.element);
|
|
13876
13894
|
if (isSelectedCell) {
|
|
13877
13895
|
this.renderer.addClass(this.elementRef.nativeElement, 'dangerous-cell');
|
|
13878
13896
|
}
|
|
@@ -13980,8 +13998,8 @@ class TheTdComponent extends TheBaseElementComponent {
|
|
|
13980
13998
|
fromEvent(element, 'mousedown')
|
|
13981
13999
|
.pipe(takeUntil(this.destroy$), filter((e) => e.button !== 2), map$1(event => event.target.closest(SLA_TABLE_CELL_SELECTOR)), filter(cell => !!cell))
|
|
13982
14000
|
.subscribe((cell) => {
|
|
13983
|
-
//
|
|
13984
|
-
if (this.tableStore.
|
|
14001
|
+
// 点选
|
|
14002
|
+
if (this.tableStore.pointerSelection) {
|
|
13985
14003
|
this.tableStore.selectCell(cell, this.editor);
|
|
13986
14004
|
}
|
|
13987
14005
|
this.tableStore.selectCellStart(cell, this.editor);
|
|
@@ -14008,7 +14026,7 @@ class TheTdComponent extends TheBaseElementComponent {
|
|
|
14008
14026
|
.pipe(take(1))
|
|
14009
14027
|
.subscribe(() => {
|
|
14010
14028
|
this.tableStore.selectCellEnd(this.editor);
|
|
14011
|
-
if (this.tableStore.isCellSelecting || this.tableStore.
|
|
14029
|
+
if (this.tableStore.isCellSelecting || this.tableStore.pointerSelection) {
|
|
14012
14030
|
this.ngZone.run(() => {
|
|
14013
14031
|
this.tableComponent.tableService.afterSelectedCells(this.tableStore.focusCellElement, this.tableComponent.element);
|
|
14014
14032
|
});
|
|
@@ -15176,8 +15194,6 @@ class TheInlineToolbarComponent {
|
|
|
15176
15194
|
.pipe(debounceTime(200), takeUntil(this.destroy$))
|
|
15177
15195
|
.subscribe(() => {
|
|
15178
15196
|
this.updateInlineToolbar();
|
|
15179
|
-
this.inlineToolbar?.selectionChange(this.editor);
|
|
15180
|
-
this.cdr.detectChanges();
|
|
15181
15197
|
});
|
|
15182
15198
|
});
|
|
15183
15199
|
}
|
|
@@ -15207,7 +15223,9 @@ class TheInlineToolbarComponent {
|
|
|
15207
15223
|
if (native.type !== 'None') {
|
|
15208
15224
|
const range = native.getRangeAt(0);
|
|
15209
15225
|
this.updatePosition(inlineToolbar, range);
|
|
15226
|
+
this.inlineToolbar?.selectionChange(this.editor);
|
|
15210
15227
|
}
|
|
15228
|
+
this.cdr.detectChanges();
|
|
15211
15229
|
}
|
|
15212
15230
|
updatePosition(toolbarElement, range) {
|
|
15213
15231
|
let boundary = range.getBoundingClientRect();
|