@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.
@@ -2241,12 +2241,21 @@ function useElementStyle(el, element) {
2241
2241
  if (element.align) {
2242
2242
  el.style.textAlign = element.align || Alignment.left;
2243
2243
  }
2244
+ else if (el.style.textAlign) {
2245
+ el.style.removeProperty('text-align');
2246
+ }
2244
2247
  if (element.textIndent) {
2245
2248
  el.style.textIndent = element.textIndent + 'em';
2246
2249
  }
2250
+ else if (el.style.textIndent) {
2251
+ el.style.removeProperty('text-indent');
2252
+ }
2247
2253
  if (element.verticalAlign) {
2248
2254
  el.style.verticalAlign = element.verticalAlign;
2249
2255
  }
2256
+ else if (el.style.verticalAlign) {
2257
+ el.style.removeProperty('vertical-align');
2258
+ }
2250
2259
  }
2251
2260
  function getElementClassByPrefix(el, prefix) {
2252
2261
  let matchClass = null;
@@ -6234,32 +6243,26 @@ const TableEditor = {
6234
6243
  return tableComponent.headerRow;
6235
6244
  },
6236
6245
  hasHeaderRowCell(editor) {
6237
- const tableNode = getAboveByType(editor, ElementKinds.table);
6238
- const cells = TableEditor.getSelectedCells(editor);
6239
- const { row, col } = cells[0];
6240
- const cellPath = [...tableNode[1], row, col];
6241
- const cellRange = { anchor: Editor.start(editor, cellPath), focus: Editor.end(editor, cellPath) };
6242
- const [headerRow] = Editor.nodes(editor, {
6246
+ var _a;
6247
+ const isHeaderRow = Editor.nodes(editor, {
6243
6248
  match: n => {
6244
6249
  var _a;
6245
6250
  return Element$1.isElement(n) &&
6246
6251
  ((n.type === ElementKinds.tableRow && n.header) || (n.type === ElementKinds.table && ((_a = n.options) === null || _a === void 0 ? void 0 : _a.headerRow)));
6247
- },
6248
- at: cellRange
6252
+ }
6249
6253
  });
6250
- return headerRow;
6254
+ const selectedCells = (_a = TableEditor.getSelectedCells(editor)) !== null && _a !== void 0 ? _a : [];
6255
+ sortCell(selectedCells);
6256
+ const isContainHeaderRow = !!selectedCells && selectedCells[0].row === 0;
6257
+ return isHeaderRow && isContainHeaderRow;
6251
6258
  },
6252
6259
  hasHeaderColumnCell(editor) {
6253
- var _a, _b;
6254
- const [table] = Editor.nodes(editor, { match: n => Element$1.isElement(n) && n.type === ElementKinds.table });
6255
- const { anchor, focus } = editor.selection;
6256
- const opts = new TableOptions();
6257
- const anchorPosition = TablePosition.create(opts, editor, anchor.path);
6258
- const focusPosition = TablePosition.create(opts, editor, focus.path);
6259
- const anchorIndex = anchorPosition.getColumnIndex();
6260
- const focusIndex = focusPosition.getColumnIndex();
6261
- const isContainHeaderColumn = anchorIndex === 0 || focusIndex === 0;
6262
- const isHeaderColumn = table && table[0] && ((_b = (_a = table[0]) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.headerColumn);
6260
+ var _a, _b, _c;
6261
+ const table = getAboveByType(editor, ElementKinds.table);
6262
+ const selectedCells = (_a = TableEditor.getSelectedCells(editor)) !== null && _a !== void 0 ? _a : [];
6263
+ sortCell(selectedCells);
6264
+ const isContainHeaderColumn = !!selectedCells && selectedCells[0].col === 0;
6265
+ const isHeaderColumn = table && table[0] && ((_c = (_b = table[0]) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.headerColumn);
6263
6266
  return isHeaderColumn && isContainHeaderColumn;
6264
6267
  },
6265
6268
  selectOriginCell(editor, table, rowIndex, columnIndex, isStart) {
@@ -11184,14 +11187,14 @@ function mergeCellContent(editor, leftTopCellPath, cellPath) {
11184
11187
  }
11185
11188
 
11186
11189
  function setCellMenuVisibility(editor, menuList, tableInfo) {
11187
- const { selectedCells, isFullscreen, selectedRowsIndex, selectedColumnsIndex } = tableInfo;
11190
+ const { selectedCells, isFullscreen, isSelectedTable, selectedRowsIndex, selectedColumnsIndex } = tableInfo;
11188
11191
  const isCellMerged = isSelectedCellMerged(editor);
11189
11192
  const selectCellNodes = getSelectCellNode(editor, selectedCells).filter(item => !item.node.hidden);
11190
11193
  const isRect = isRectangularInTableCells(editor, selectedCells);
11191
11194
  menuList.forEach(item => {
11192
11195
  switch (item.key) {
11193
11196
  case 'merge-cells':
11194
- item.visibility = selectCellNodes && selectCellNodes.length > 1 && isRect;
11197
+ item.visibility = selectCellNodes && selectCellNodes.length > 1 && !isSelectedTable && isRect;
11195
11198
  break;
11196
11199
  case 'split-cells':
11197
11200
  item.visibility = selectCellNodes && selectCellNodes.length === 1 && isCellMerged;
@@ -11255,13 +11258,19 @@ class TheContextMenuComponent {
11255
11258
  inputNumberFocus(e) {
11256
11259
  e.target.focus();
11257
11260
  }
11261
+ itemEnterHandle(e, entity) {
11262
+ e.preventDefault();
11263
+ e.stopPropagation();
11264
+ this.actionHandle(entity);
11265
+ this.thyPopoverRef.close();
11266
+ }
11258
11267
  ngOnInit() { }
11259
11268
  }
11260
11269
  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 });
11261
- 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)=\"itemMousedown($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"] }] });
11270
+ 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"] }] });
11262
11271
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TheContextMenuComponent, decorators: [{
11263
11272
  type: Component,
11264
- 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)=\"itemMousedown($event, item)\"\n thyStopPropagation\n ></thy-input-number>\n {{ item.nameSuffix }}\n </span>\n </a>\n</ng-template>\n" }]
11273
+ 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" }]
11265
11274
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.ThyPopoverRef }]; }, propDecorators: { menuEntities: [{
11266
11275
  type: Input
11267
11276
  }], actionHandle: [{
@@ -11294,10 +11303,10 @@ class TableStore {
11294
11303
  this.isPrepareSelecting = false;
11295
11304
  this.isCellSelecting = false;
11296
11305
  this.isRightClicking = false;
11297
- this.isModSelecting = false;
11306
+ this.pointerSelection = false;
11298
11307
  this.isSelectedAllCell = () => {
11299
11308
  const pos = this.createTablePosition();
11300
- return pos.getHeight() * pos.getWidth() === this.selectedCells.length;
11309
+ return !!this.selectedCells.length && pos.getHeight() * pos.getWidth() === this.selectedCells.length;
11301
11310
  };
11302
11311
  }
11303
11312
  get selectedCells() {
@@ -11314,6 +11323,13 @@ class TableStore {
11314
11323
  const tableEntry = this.getTableEntry();
11315
11324
  return tableEntry[1];
11316
11325
  }
11326
+ updateCellPositionRefs(row = 0, col = 0) {
11327
+ const cells = [];
11328
+ this.selectedCells.forEach(cell => {
11329
+ cells.push(Object.assign(Object.assign({}, cell), { row: cell.row + row, col: cell.col + col }));
11330
+ });
11331
+ this.selectedCells$.next(cells);
11332
+ }
11317
11333
  setSelectedCells(cells, pos) {
11318
11334
  const rowGroup = groupBy(cells, ({ row, col }) => row);
11319
11335
  const colGroup = groupBy(cells, ({ row, col }) => col);
@@ -11348,7 +11364,7 @@ class TableStore {
11348
11364
  */
11349
11365
  uniqueCellPosition(cells) {
11350
11366
  let result = [];
11351
- if (this.isModSelecting) {
11367
+ if (this.pointerSelection) {
11352
11368
  const modCells = new Set();
11353
11369
  cells.concat(this.selectedCells).forEach(cell => modCells.add(JSON.stringify(cell)));
11354
11370
  modCells.forEach((cell) => result.push(JSON.parse(cell)));
@@ -11483,7 +11499,7 @@ class TableStore {
11483
11499
  const [row, col] = path.slice(-2);
11484
11500
  const pos = this.createTablePosition();
11485
11501
  const result = [{ row, col }];
11486
- if (this.isModSelecting) {
11502
+ if (this.pointerSelection) {
11487
11503
  result.push(...this.selectedCells);
11488
11504
  // 处理单元格选中时,处理为选中多单元格
11489
11505
  result.push(...this.getCellPositionsBeforeMerge({ row, col }));
@@ -11657,8 +11673,7 @@ class TableStore {
11657
11673
  const cells = this.selectedCells;
11658
11674
  const tablePath = this.getTablePath();
11659
11675
  Editor.withoutNormalizing(this.editor, () => {
11660
- for (const cell of cells) {
11661
- const { row, col } = cell;
11676
+ for (const { row, col } of cells) {
11662
11677
  const cellPath = [...tablePath, row, col];
11663
11678
  Transforms.setNodes(this.editor, { backgroundColor }, { at: cellPath });
11664
11679
  }
@@ -11676,8 +11691,7 @@ class TableStore {
11676
11691
  const tablePosition = this.createTablePosition();
11677
11692
  if (tablePosition.isInTable()) {
11678
11693
  Editor.withoutNormalizing(this.editor, () => {
11679
- for (const cell of cells) {
11680
- const { row, col } = cell;
11694
+ for (const { row, col } of cells) {
11681
11695
  const cellPath = [...tablePosition.tableEntry[1], row, col];
11682
11696
  const node = Node.get(this.editor, cellPath);
11683
11697
  TableEditor.clearCell(this.editor, [node, cellPath]);
@@ -11701,7 +11715,7 @@ class TableStore {
11701
11715
  this.removeColumnOrRows(dangerousRowsIndex, dangerousColumnsIndex);
11702
11716
  }
11703
11717
  createTablePosition() {
11704
- const { anchor: { path } } = this.editor.selection;
11718
+ const { path } = this.editor.selection.anchor;
11705
11719
  const opts = new TableOptions();
11706
11720
  return TablePosition.create(opts, this.editor, path);
11707
11721
  }
@@ -11807,6 +11821,7 @@ class TheTableContextMenuService {
11807
11821
  actionHandle: (item) => {
11808
11822
  const { targetRowIndex } = this.getTargetRowOrColIndex();
11809
11823
  TableEditor.insertRow(this.editor, item.count, targetRowIndex);
11824
+ this.tableStore.updateCellPositionRefs(item.count);
11810
11825
  this.tableStore.changeCells();
11811
11826
  }
11812
11827
  },
@@ -11833,6 +11848,7 @@ class TheTableContextMenuService {
11833
11848
  actionHandle: (item) => {
11834
11849
  const { targetColIndex } = this.getTargetRowOrColIndex();
11835
11850
  TableEditor.insertColumn(this.editor, item.count, targetColIndex);
11851
+ this.tableStore.updateCellPositionRefs(0, item.count);
11836
11852
  this.tableStore.changeCells();
11837
11853
  }
11838
11854
  },
@@ -11948,8 +11964,8 @@ class TheTableContextMenuService {
11948
11964
  }
11949
11965
  openMenuList(event) {
11950
11966
  this.ngZone.run(() => {
11951
- const { selectedCells, isFullscreen, selectedRowsIndex, selectedColumnsIndex } = this.tableStore;
11952
- const tableInfo = { selectedCells, isFullscreen, selectedRowsIndex, selectedColumnsIndex };
11967
+ const { selectedCells, isFullscreen, selectedRowsIndex, selectedColumnsIndex, isSelectedTable } = this.tableStore;
11968
+ const tableInfo = { selectedCells, isFullscreen, selectedRowsIndex, selectedColumnsIndex, isSelectedTable };
11953
11969
  const { row, col } = this.getSelectedCell();
11954
11970
  setCellMenuVisibility(this.editor, this.menuEntities, tableInfo);
11955
11971
  this.menuEntities.forEach(item => {
@@ -12157,8 +12173,8 @@ class TheTableToolbarComponent {
12157
12173
  ngOnInit() {
12158
12174
  var _a, _b, _c;
12159
12175
  this.isColumnEqual = (_c = (_b = (_a = this.tableElement) === null || _a === void 0 ? void 0 : _a.columns) === null || _b === void 0 ? void 0 : _b.every(col => this.tableElement.columns[0].width === col.width)) !== null && _c !== void 0 ? _c : true;
12160
- const { selectedCells } = this.tableStore;
12161
- const tableInfo = { selectedCells };
12176
+ const { selectedCells, isSelectedTable } = this.tableStore;
12177
+ const tableInfo = { selectedCells, isSelectedTable };
12162
12178
  this.isRectangle = isRectangularInTableCells(this.editor, selectedCells);
12163
12179
  this.deleteIcon = this.isRectangle && DeleteIcon[this.getDeleteIcon()];
12164
12180
  this.getIconName(this.deleteIcon);
@@ -12400,12 +12416,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
12400
12416
  args: [{ name: 'freezeColumn' }]
12401
12417
  }] });
12402
12418
  class TableFreezeRowPipe {
12403
- transform(table, headerRow) {
12419
+ transform(table, headerRow, tablePluginOptions) {
12404
12420
  var _a;
12405
12421
  // 标题行存在合并的行时,取消冻结
12406
12422
  if (table.children) {
12407
12423
  const mergeRows = (_a = table.children[0]) === null || _a === void 0 ? void 0 : _a.children.filter(item => item.rowspan && item.rowspan !== 1);
12408
- return !!(headerRow && !mergeRows.length);
12424
+ return !!(headerRow && !mergeRows.length && (tablePluginOptions === null || tablePluginOptions === void 0 ? void 0 : tablePluginOptions.freezeRowHeader));
12409
12425
  }
12410
12426
  return false;
12411
12427
  }
@@ -12753,7 +12769,7 @@ class TheTableComponent extends TheBaseElementComponent {
12753
12769
  this.isStickyTop =
12754
12770
  top <= this.scrollContainerTop + 8 && clientRect.bottom - this.scrollContainerTop >= headerRowHeight;
12755
12771
  // 标题行内容超过固定高度时移除冻结
12756
- if (this.isStickyTop && this.freezeRowPipe.transform(this.element, this.headerRow)) {
12772
+ if (this.isStickyTop && this.freezeRowPipe.transform(this.element, this.headerRow, this.tablePluginOptions)) {
12757
12773
  const maxHeaderRowHeight = (24 + 8) * 11; // 超出 11 行,取消冻结
12758
12774
  this.isStickyTop = headerRowHeight <= maxHeaderRowHeight;
12759
12775
  }
@@ -12825,7 +12841,7 @@ class TheTableComponent extends TheBaseElementComponent {
12825
12841
  const colControl = this.columnControlsWrapper.nativeElement;
12826
12842
  const headerRow = this.nativeElement.querySelector('tbody tr');
12827
12843
  const stickyRows = this.isInTable ? [colControl, headerRow] : [headerRow];
12828
- if (this.freezeRowPipe.transform(this.element, this.headerRow)) {
12844
+ if (this.freezeRowPipe.transform(this.element, this.headerRow, this.tablePluginOptions)) {
12829
12845
  let gridColumns = '';
12830
12846
  const tablePadding = 44;
12831
12847
  let tableWidth = this.elementRef.nativeElement.offsetWidth;
@@ -12847,7 +12863,7 @@ class TheTableComponent extends TheBaseElementComponent {
12847
12863
  const rowControlButton = (_a = this.rowControlsButtonWrapper.first) === null || _a === void 0 ? void 0 : _a.nativeElement;
12848
12864
  const tableCornerBtn = this.cornerControl.nativeElement;
12849
12865
  const headerRowHeight = (_b = this.calculateRowControls()[0]) === null || _b === void 0 ? void 0 : _b.height;
12850
- if (this.isStickyTop && this.freezeRowPipe.transform(this.element, this.headerRow)) {
12866
+ if (this.isStickyTop && this.freezeRowPipe.transform(this.element, this.headerRow, this.tablePluginOptions)) {
12851
12867
  this.renderer.addClass(this.nativeElement, TableWithStickyRowClass);
12852
12868
  this.updateStickyRowScrollLeft();
12853
12869
  const numberedColumn = (_c = this.element.options) === null || _c === void 0 ? void 0 : _c.numberedColumn;
@@ -12917,7 +12933,7 @@ class TheTableComponent extends TheBaseElementComponent {
12917
12933
  }
12918
12934
  useRowControls() {
12919
12935
  var _a;
12920
- if ((this.selection && !this.readonly) || ((_a = this.element.options) === null || _a === void 0 ? void 0 : _a.numberedColumn) || this.tableStore.isCellSelecting) {
12936
+ if ((this.selection && !this.readonly) || ((_a = this.element.options) === null || _a === void 0 ? void 0 : _a.numberedColumn) || this.tableStore.isRightClicking) {
12921
12937
  this.rowControls = this.calculateRowControls();
12922
12938
  }
12923
12939
  }
@@ -13172,7 +13188,7 @@ class TheTableComponent extends TheBaseElementComponent {
13172
13188
  }
13173
13189
  // patch for right click select next cell
13174
13190
  setTimeout(() => {
13175
- Transforms.select(this.editor, this.editor.selection.anchor.path);
13191
+ Transforms.select(this.editor, Editor.start(this.editor, this.editor.selection));
13176
13192
  });
13177
13193
  });
13178
13194
  });
@@ -13189,7 +13205,7 @@ class TheTableComponent extends TheBaseElementComponent {
13189
13205
  this.tableStore.clearSelectedCellsContent();
13190
13206
  }
13191
13207
  const isCurrentTableElement = this.nativeElement.contains(e.target);
13192
- if (!isCurrentTableElement || !this.tableStore.isModSelecting) {
13208
+ if (!isCurrentTableElement || !this.tableStore.pointerSelection) {
13193
13209
  this.tableStore.clearSelectedCells();
13194
13210
  }
13195
13211
  if (!isCurrentTableElement) {
@@ -13205,13 +13221,13 @@ class TheTableComponent extends TheBaseElementComponent {
13205
13221
  .pipe(takeUntil(this.destroy$), filter((e) => !!e))
13206
13222
  .subscribe((event) => {
13207
13223
  if (isHotkey('mod', event) && !this.readonly) {
13208
- this.tableStore.isModSelecting = true;
13224
+ this.tableStore.pointerSelection = true;
13209
13225
  }
13210
13226
  });
13211
13227
  fromEvent(document, 'keyup')
13212
13228
  .pipe(takeUntil(this.destroy$), filter((e) => !!e))
13213
13229
  .subscribe(() => {
13214
- this.tableStore.isModSelecting = false;
13230
+ this.tableStore.pointerSelection = false;
13215
13231
  });
13216
13232
  });
13217
13233
  }
@@ -13265,7 +13281,7 @@ class TheTableComponent extends TheBaseElementComponent {
13265
13281
  }
13266
13282
  }
13267
13283
  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 });
13268
- 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.isCellSelecting", "class.the-numberd-table": "element?.options?.numberedColumn", "class.the-table-selection-hide": "tableStore.isCellSelecting || tableStore.isRightClicking" } }, providers: [
13284
+ 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: [
13269
13285
  TableStore,
13270
13286
  TableService,
13271
13287
  TheTableContextMenuService,
@@ -13277,7 +13293,7 @@ TheTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", vers
13277
13293
  provide: THE_TABLE_COMPONENT_TOKEN,
13278
13294
  useExisting: TheTableComponent
13279
13295
  }
13280
- ], 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.isCellSelecting),\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=\"!element.options?.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.isCellSelecting) && !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.isCellSelecting\"\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" }] });
13296
+ ], 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" }] });
13281
13297
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TheTableComponent, decorators: [{
13282
13298
  type: Component,
13283
13299
  args: [{ selector: 'the-table, [theTable]', providers: [
@@ -13293,10 +13309,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
13293
13309
  useExisting: TheTableComponent
13294
13310
  }
13295
13311
  ], host: {
13296
- '[class.the-table-with-controls]': 'isInTable || tableStore.isCellSelecting',
13312
+ '[class.the-table-with-controls]': 'isInTable || tableStore.isRightClicking',
13313
+ '[class.the-table-with-sticky-column]': 'element?.options?.headerColumn',
13297
13314
  '[class.the-numberd-table]': 'element?.options?.numberedColumn',
13298
13315
  '[class.the-table-selection-hide]': 'tableStore.isCellSelecting || tableStore.isRightClicking'
13299
- }, 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.isCellSelecting),\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=\"!element.options?.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.isCellSelecting) && !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.isCellSelecting\"\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" }]
13316
+ }, 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" }]
13300
13317
  }], 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: [{
13301
13318
  type: ViewChild,
13302
13319
  args: ['tableWrapper', { read: ElementRef, static: true }]
@@ -13879,7 +13896,8 @@ class TheTdComponent extends TheBaseElementComponent {
13879
13896
  this.renderer.removeClass(this.elementRef.nativeElement, 'selected-cell');
13880
13897
  }
13881
13898
  else {
13882
- const isSelectedCell = x.some(({ row, col }) => row === this.tablePosition.getRowIndex() && col === this.tablePosition.getColumnIndex());
13899
+ const selectCellNodes = getSelectCellNode(this.editor, x);
13900
+ const isSelectedCell = selectCellNodes.find(cell => cell.node === this.element);
13883
13901
  if (isSelectedCell) {
13884
13902
  this.renderer.addClass(this.elementRef.nativeElement, 'selected-cell');
13885
13903
  }
@@ -13899,7 +13917,8 @@ class TheTdComponent extends TheBaseElementComponent {
13899
13917
  this.renderer.removeClass(this.elementRef.nativeElement, 'dangerous-cell');
13900
13918
  }
13901
13919
  else {
13902
- const isSelectedCell = x.some(({ row, col }) => row === this.tablePosition.getRowIndex() && col === this.tablePosition.getColumnIndex());
13920
+ const selectCellNodes = getSelectCellNode(this.editor, x);
13921
+ const isSelectedCell = selectCellNodes.find(cell => cell.node === this.element);
13903
13922
  if (isSelectedCell) {
13904
13923
  this.renderer.addClass(this.elementRef.nativeElement, 'dangerous-cell');
13905
13924
  }
@@ -14007,8 +14026,8 @@ class TheTdComponent extends TheBaseElementComponent {
14007
14026
  fromEvent(element, 'mousedown')
14008
14027
  .pipe(takeUntil(this.destroy$), filter((e) => e.button !== 2), map$1(event => event.target.closest(SLA_TABLE_CELL_SELECTOR)), filter(cell => !!cell))
14009
14028
  .subscribe((cell) => {
14010
- // 单选
14011
- if (this.tableStore.isModSelecting) {
14029
+ // 点选
14030
+ if (this.tableStore.pointerSelection) {
14012
14031
  this.tableStore.selectCell(cell, this.editor);
14013
14032
  }
14014
14033
  this.tableStore.selectCellStart(cell, this.editor);
@@ -14035,7 +14054,7 @@ class TheTdComponent extends TheBaseElementComponent {
14035
14054
  .pipe(take(1))
14036
14055
  .subscribe(() => {
14037
14056
  this.tableStore.selectCellEnd(this.editor);
14038
- if (this.tableStore.isCellSelecting || this.tableStore.isModSelecting) {
14057
+ if (this.tableStore.isCellSelecting || this.tableStore.pointerSelection) {
14039
14058
  this.ngZone.run(() => {
14040
14059
  this.tableComponent.tableService.afterSelectedCells(this.tableStore.focusCellElement, this.tableComponent.element);
14041
14060
  });
@@ -15198,14 +15217,12 @@ class TheInlineToolbarComponent {
15198
15217
  merge(fromEvent(document, 'mouseup').pipe(filter((e) => e.button !== 2)), fromEvent(document, 'keyup').pipe(filter((e) => !e.shiftKey)))
15199
15218
  .pipe(debounceTime(200), takeUntil(this.destroy$))
15200
15219
  .subscribe(() => {
15201
- var _a;
15202
15220
  this.updateInlineToolbar();
15203
- (_a = this.inlineToolbar) === null || _a === void 0 ? void 0 : _a.selectionChange(this.editor);
15204
- this.cdr.detectChanges();
15205
15221
  });
15206
15222
  });
15207
15223
  }
15208
15224
  updateInlineToolbar() {
15225
+ var _a;
15209
15226
  const inlineToolbar = this.elementRef.nativeElement.firstElementChild;
15210
15227
  if (!this.editor.selection) {
15211
15228
  inlineToolbar.removeAttribute('style');
@@ -15231,7 +15248,9 @@ class TheInlineToolbarComponent {
15231
15248
  if (native.type !== 'None') {
15232
15249
  const range = native.getRangeAt(0);
15233
15250
  this.updatePosition(inlineToolbar, range);
15251
+ (_a = this.inlineToolbar) === null || _a === void 0 ? void 0 : _a.selectionChange(this.editor);
15234
15252
  }
15253
+ this.cdr.detectChanges();
15235
15254
  }
15236
15255
  updatePosition(toolbarElement, range) {
15237
15256
  let boundary = range.getBoundingClientRect();