@worktile/theia 16.3.0 → 16.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/editor.module.d.ts +1 -1
- package/esm2022/components/plugin-menu/plugin-menu.component.mjs +5 -2
- package/esm2022/services/table-contextmenu.service.mjs +9 -8
- package/fesm2022/worktile-theia.mjs +159 -155
- package/fesm2022/worktile-theia.mjs.map +1 -1
- package/package.json +1 -1
- package/services/table-contextmenu.service.d.ts +2 -2
- package/styles/editor.scss +9 -0
|
@@ -6017,7 +6017,10 @@ class ThePluginMenuComponent extends mixinUnsubscribe(MixinBase) {
|
|
|
6017
6017
|
this.autoActiveFirstItem = true;
|
|
6018
6018
|
this.removeKeywords = () => {
|
|
6019
6019
|
const node = Node.get(this.editor, this.editor.selection.anchor.path);
|
|
6020
|
-
|
|
6020
|
+
const nodeString = Node.string(node);
|
|
6021
|
+
const isStartWithHotkey = nodeString.startsWith('/');
|
|
6022
|
+
const isIncludeKeywords = nodeString.toLocaleLowerCase().trim().includes(this.keyWords);
|
|
6023
|
+
if (node && nodeString.length > 0 && (isStartWithHotkey || isIncludeKeywords)) {
|
|
6021
6024
|
Editor.deleteBackward(this.editor, { unit: 'block' });
|
|
6022
6025
|
}
|
|
6023
6026
|
};
|
|
@@ -11460,31 +11463,76 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImpor
|
|
|
11460
11463
|
const SLA_TABLE_SELECTOR = '.slate-element-table';
|
|
11461
11464
|
const SLA_TABLE_CELL_SELECTOR = '.slate-element-table-cell';
|
|
11462
11465
|
|
|
11463
|
-
|
|
11464
|
-
|
|
11465
|
-
|
|
11466
|
-
|
|
11467
|
-
|
|
11468
|
-
|
|
11469
|
-
|
|
11470
|
-
|
|
11471
|
-
|
|
11472
|
-
|
|
11473
|
-
|
|
11474
|
-
|
|
11475
|
-
|
|
11476
|
-
|
|
11477
|
-
|
|
11478
|
-
|
|
11479
|
-
|
|
11480
|
-
|
|
11481
|
-
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
11486
|
-
|
|
11466
|
+
class TheContextMenuComponent {
|
|
11467
|
+
handleDocumentMouseDown(event) {
|
|
11468
|
+
if (isColorPanel(event.target)) {
|
|
11469
|
+
return;
|
|
11470
|
+
}
|
|
11471
|
+
if (!this.elementRef.nativeElement.contains(event.target) && event.button !== 2) {
|
|
11472
|
+
this.thyPopoverRef.close();
|
|
11473
|
+
}
|
|
11474
|
+
}
|
|
11475
|
+
handleMouseDown(event) {
|
|
11476
|
+
event.preventDefault();
|
|
11477
|
+
event.stopPropagation();
|
|
11478
|
+
}
|
|
11479
|
+
itemMousedown(event, entity) {
|
|
11480
|
+
event.preventDefault();
|
|
11481
|
+
this.actionHandle(entity);
|
|
11482
|
+
this.thyPopoverRef.close();
|
|
11483
|
+
}
|
|
11484
|
+
itemMouseleave(event, entity) {
|
|
11485
|
+
event.preventDefault();
|
|
11486
|
+
this.deactivateHandle(event, entity);
|
|
11487
|
+
}
|
|
11488
|
+
itemMouseenter(event, entity) {
|
|
11489
|
+
event.preventDefault();
|
|
11490
|
+
this.activeHandle(event, entity);
|
|
11491
|
+
}
|
|
11492
|
+
inputNumberFocus(e) {
|
|
11493
|
+
e.target.focus();
|
|
11494
|
+
}
|
|
11495
|
+
itemEnterHandle(e, entity) {
|
|
11496
|
+
e.preventDefault();
|
|
11497
|
+
e.stopPropagation();
|
|
11498
|
+
this.actionHandle(entity);
|
|
11499
|
+
this.thyPopoverRef.close();
|
|
11500
|
+
}
|
|
11501
|
+
changeColor(color, item) {
|
|
11502
|
+
item.backgroundColor = color;
|
|
11503
|
+
item.activeHandle(undefined, item);
|
|
11504
|
+
}
|
|
11505
|
+
constructor(elementRef, thyPopoverRef) {
|
|
11506
|
+
this.elementRef = elementRef;
|
|
11507
|
+
this.thyPopoverRef = thyPopoverRef;
|
|
11508
|
+
this.menuEntities = [];
|
|
11509
|
+
this.wrap = true;
|
|
11510
|
+
}
|
|
11511
|
+
ngOnInit() { }
|
|
11512
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: TheContextMenuComponent, deps: [{ token: i0.ElementRef }, { token: i1$1.ThyPopoverRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
11513
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", 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 && menuItem.key !== 'background-color'\">\n <ng-template [ngTemplateOutlet]=\"defaultMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"menuItem.visibility && menuItem.key === 'background-color'\">\n <ng-template [ngTemplateOutlet]=\"backgroundColorTemplate\" [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 [thyIconName]=\"item.icon\"></thy-icon>\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 #backgroundColorTemplate let-item>\n <a\n href=\"javascript:;\"\n thyDropdownMenuItem\n thyColorPicker\n thyTrigger=\"hover\"\n thyPlacement=\"rightTop\"\n [(ngModel)]=\"item.backgroundColor\"\n (ngModelChange)=\"changeColor($event, item)\"\n [thyHasBackdrop]=\"false\"\n >\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\" thyIconType=\"twotone\" [thyTwotoneColor]=\"item.backgroundColor\"></thy-icon>\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: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.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"] }, { kind: "directive", type: i5.ThyColorPickerDirective, selector: "[thyColorPicker]", inputs: ["thyOffset", "thyHasBackdrop", "thyDefaultColor", "thyTransparentColorSelectable", "thyPresetColors", "thyPlacement", "thyTrigger", "thyShowDelay", "thyHideDelay"], outputs: ["thyPanelOpen", "thyPanelClose"] }] }); }
|
|
11487
11514
|
}
|
|
11515
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: TheContextMenuComponent, decorators: [{
|
|
11516
|
+
type: Component,
|
|
11517
|
+
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 && menuItem.key !== 'background-color'\">\n <ng-template [ngTemplateOutlet]=\"defaultMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"menuItem.visibility && menuItem.key === 'background-color'\">\n <ng-template [ngTemplateOutlet]=\"backgroundColorTemplate\" [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 [thyIconName]=\"item.icon\"></thy-icon>\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 #backgroundColorTemplate let-item>\n <a\n href=\"javascript:;\"\n thyDropdownMenuItem\n thyColorPicker\n thyTrigger=\"hover\"\n thyPlacement=\"rightTop\"\n [(ngModel)]=\"item.backgroundColor\"\n (ngModelChange)=\"changeColor($event, item)\"\n [thyHasBackdrop]=\"false\"\n >\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\" thyIconType=\"twotone\" [thyTwotoneColor]=\"item.backgroundColor\"></thy-icon>\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" }]
|
|
11518
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.ThyPopoverRef }]; }, propDecorators: { menuEntities: [{
|
|
11519
|
+
type: Input
|
|
11520
|
+
}], actionHandle: [{
|
|
11521
|
+
type: Input
|
|
11522
|
+
}], activeHandle: [{
|
|
11523
|
+
type: Input
|
|
11524
|
+
}], deactivateHandle: [{
|
|
11525
|
+
type: Input
|
|
11526
|
+
}], wrap: [{
|
|
11527
|
+
type: HostBinding,
|
|
11528
|
+
args: ['class.the-overlay-menu-wrap']
|
|
11529
|
+
}], handleDocumentMouseDown: [{
|
|
11530
|
+
type: HostListener,
|
|
11531
|
+
args: ['document: mousedown', ['$event']]
|
|
11532
|
+
}], handleMouseDown: [{
|
|
11533
|
+
type: HostListener,
|
|
11534
|
+
args: ['mousedown', ['$event']]
|
|
11535
|
+
}] } });
|
|
11488
11536
|
|
|
11489
11537
|
function isSelectedCellMerged(editor) {
|
|
11490
11538
|
if (editor && editor.selection) {
|
|
@@ -11585,117 +11633,6 @@ function getCellPositionsBeforeMerge(editor, { row, col }) {
|
|
|
11585
11633
|
return [{ row, col }];
|
|
11586
11634
|
}
|
|
11587
11635
|
|
|
11588
|
-
function setCellMenuVisibility(editor, menuList, tableInfo) {
|
|
11589
|
-
const { selectedCellPositions, isFullscreen, isSelectedTable, selectedRowsIndex, selectedColumnsIndex } = tableInfo;
|
|
11590
|
-
const isCellMerged = isSelectedCellMerged(editor);
|
|
11591
|
-
const selectCellNodes = getSelectCellNode(editor, selectedCellPositions).filter(item => !item.node.hidden);
|
|
11592
|
-
const isRect = isRectangularInTableCells(editor, selectedCellPositions);
|
|
11593
|
-
menuList.forEach(item => {
|
|
11594
|
-
switch (item.key) {
|
|
11595
|
-
case 'merge-cells':
|
|
11596
|
-
item.visibility = selectCellNodes && selectCellNodes.length > 1 && !isSelectedTable && isRect;
|
|
11597
|
-
break;
|
|
11598
|
-
case 'split-cells':
|
|
11599
|
-
item.visibility = selectCellNodes && selectCellNodes.length === 1 && isCellMerged;
|
|
11600
|
-
break;
|
|
11601
|
-
case 'delete-selection-rows':
|
|
11602
|
-
item.visibility = !(isFullscreen && selectedColumnsIndex.length);
|
|
11603
|
-
break;
|
|
11604
|
-
case 'delete-selection-columns':
|
|
11605
|
-
item.visibility = !(isFullscreen && selectedRowsIndex.length);
|
|
11606
|
-
break;
|
|
11607
|
-
case 'delete-table':
|
|
11608
|
-
item.visibility = !isFullscreen;
|
|
11609
|
-
break;
|
|
11610
|
-
case TableInsertType.insertRowsUp:
|
|
11611
|
-
const hasHeaderRowCell = TableEditor.hasHeaderRowCell(editor);
|
|
11612
|
-
item.visibility = !hasHeaderRowCell && isRect;
|
|
11613
|
-
break;
|
|
11614
|
-
case TableInsertType.insertRowsDown:
|
|
11615
|
-
item.visibility = isRect;
|
|
11616
|
-
break;
|
|
11617
|
-
case TableInsertType.insertColumnsLeft:
|
|
11618
|
-
const hasHeaderColumnCell = TableEditor.hasHeaderColumnCell(editor);
|
|
11619
|
-
item.visibility = !hasHeaderColumnCell && isRect;
|
|
11620
|
-
break;
|
|
11621
|
-
case TableInsertType.insertColumnsRight:
|
|
11622
|
-
item.visibility = isRect;
|
|
11623
|
-
break;
|
|
11624
|
-
}
|
|
11625
|
-
});
|
|
11626
|
-
}
|
|
11627
|
-
|
|
11628
|
-
class TheContextMenuComponent {
|
|
11629
|
-
handleDocumentMouseDown(event) {
|
|
11630
|
-
if (isColorPanel(event.target)) {
|
|
11631
|
-
return;
|
|
11632
|
-
}
|
|
11633
|
-
if (!this.elementRef.nativeElement.contains(event.target) && event.button !== 2) {
|
|
11634
|
-
this.thyPopoverRef.close();
|
|
11635
|
-
}
|
|
11636
|
-
}
|
|
11637
|
-
handleMouseDown(event) {
|
|
11638
|
-
event.preventDefault();
|
|
11639
|
-
event.stopPropagation();
|
|
11640
|
-
}
|
|
11641
|
-
itemMousedown(event, entity) {
|
|
11642
|
-
event.preventDefault();
|
|
11643
|
-
this.actionHandle(entity);
|
|
11644
|
-
this.thyPopoverRef.close();
|
|
11645
|
-
}
|
|
11646
|
-
itemMouseleave(event, entity) {
|
|
11647
|
-
event.preventDefault();
|
|
11648
|
-
this.deactivateHandle(event, entity);
|
|
11649
|
-
}
|
|
11650
|
-
itemMouseenter(event, entity) {
|
|
11651
|
-
event.preventDefault();
|
|
11652
|
-
this.activeHandle(event, entity);
|
|
11653
|
-
}
|
|
11654
|
-
inputNumberFocus(e) {
|
|
11655
|
-
e.target.focus();
|
|
11656
|
-
}
|
|
11657
|
-
itemEnterHandle(e, entity) {
|
|
11658
|
-
e.preventDefault();
|
|
11659
|
-
e.stopPropagation();
|
|
11660
|
-
this.actionHandle(entity);
|
|
11661
|
-
this.thyPopoverRef.close();
|
|
11662
|
-
}
|
|
11663
|
-
changeColor(color, item) {
|
|
11664
|
-
item.backgroundColor = color;
|
|
11665
|
-
item.activeHandle(undefined, item);
|
|
11666
|
-
}
|
|
11667
|
-
constructor(elementRef, thyPopoverRef) {
|
|
11668
|
-
this.elementRef = elementRef;
|
|
11669
|
-
this.thyPopoverRef = thyPopoverRef;
|
|
11670
|
-
this.menuEntities = [];
|
|
11671
|
-
this.wrap = true;
|
|
11672
|
-
}
|
|
11673
|
-
ngOnInit() { }
|
|
11674
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: TheContextMenuComponent, deps: [{ token: i0.ElementRef }, { token: i1$1.ThyPopoverRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
11675
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", 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 && menuItem.key !== 'background-color'\">\n <ng-template [ngTemplateOutlet]=\"defaultMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"menuItem.visibility && menuItem.key === 'background-color'\">\n <ng-template [ngTemplateOutlet]=\"backgroundColorTemplate\" [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 [thyIconName]=\"item.icon\"></thy-icon>\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 #backgroundColorTemplate let-item>\n <a\n href=\"javascript:;\"\n thyDropdownMenuItem\n thyColorPicker\n thyTrigger=\"hover\"\n thyPlacement=\"rightTop\"\n [(ngModel)]=\"item.backgroundColor\"\n (ngModelChange)=\"changeColor($event, item)\"\n [thyHasBackdrop]=\"false\"\n >\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\" thyIconType=\"twotone\" [thyTwotoneColor]=\"item.backgroundColor\"></thy-icon>\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: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.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"] }, { kind: "directive", type: i5.ThyColorPickerDirective, selector: "[thyColorPicker]", inputs: ["thyOffset", "thyHasBackdrop", "thyDefaultColor", "thyTransparentColorSelectable", "thyPresetColors", "thyPlacement", "thyTrigger", "thyShowDelay", "thyHideDelay"], outputs: ["thyPanelOpen", "thyPanelClose"] }] }); }
|
|
11676
|
-
}
|
|
11677
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: TheContextMenuComponent, decorators: [{
|
|
11678
|
-
type: Component,
|
|
11679
|
-
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 && menuItem.key !== 'background-color'\">\n <ng-template [ngTemplateOutlet]=\"defaultMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"menuItem.visibility && menuItem.key === 'background-color'\">\n <ng-template [ngTemplateOutlet]=\"backgroundColorTemplate\" [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 [thyIconName]=\"item.icon\"></thy-icon>\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 #backgroundColorTemplate let-item>\n <a\n href=\"javascript:;\"\n thyDropdownMenuItem\n thyColorPicker\n thyTrigger=\"hover\"\n thyPlacement=\"rightTop\"\n [(ngModel)]=\"item.backgroundColor\"\n (ngModelChange)=\"changeColor($event, item)\"\n [thyHasBackdrop]=\"false\"\n >\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\" thyIconType=\"twotone\" [thyTwotoneColor]=\"item.backgroundColor\"></thy-icon>\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" }]
|
|
11680
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.ThyPopoverRef }]; }, propDecorators: { menuEntities: [{
|
|
11681
|
-
type: Input
|
|
11682
|
-
}], actionHandle: [{
|
|
11683
|
-
type: Input
|
|
11684
|
-
}], activeHandle: [{
|
|
11685
|
-
type: Input
|
|
11686
|
-
}], deactivateHandle: [{
|
|
11687
|
-
type: Input
|
|
11688
|
-
}], wrap: [{
|
|
11689
|
-
type: HostBinding,
|
|
11690
|
-
args: ['class.the-overlay-menu-wrap']
|
|
11691
|
-
}], handleDocumentMouseDown: [{
|
|
11692
|
-
type: HostListener,
|
|
11693
|
-
args: ['document: mousedown', ['$event']]
|
|
11694
|
-
}], handleMouseDown: [{
|
|
11695
|
-
type: HostListener,
|
|
11696
|
-
args: ['mousedown', ['$event']]
|
|
11697
|
-
}] } });
|
|
11698
|
-
|
|
11699
11636
|
const getTableEntry = (editor) => {
|
|
11700
11637
|
const { tableEntry } = createTablePosition(editor);
|
|
11701
11638
|
return tableEntry;
|
|
@@ -11716,25 +11653,6 @@ const getSelectedCell = (editor) => {
|
|
|
11716
11653
|
return null;
|
|
11717
11654
|
};
|
|
11718
11655
|
|
|
11719
|
-
const setSelectedCellsBackgroundColor = (editor, color, tableStore) => {
|
|
11720
|
-
// 点击自定义颜色面板输入框设置颜色值时,会丢失焦点和选区(目前无法做到焦点同时存在于编辑器和输入框)
|
|
11721
|
-
let location;
|
|
11722
|
-
if (!editor.selection) {
|
|
11723
|
-
const { rangeRef } = THE_EDITOR_PREVIOUS_SELECTION.get(editor);
|
|
11724
|
-
location = rangeRef.current.anchor;
|
|
11725
|
-
}
|
|
11726
|
-
const isHeader = TableEditor.isActiveHeader(editor, location);
|
|
11727
|
-
if (color === 'transparent') {
|
|
11728
|
-
color = null;
|
|
11729
|
-
}
|
|
11730
|
-
if ((color === TableHeaderBackgroundColor && isHeader) || (color === SpecialBackgroundColor && !isHeader)) {
|
|
11731
|
-
tableStore.setSelectedCellsBackgroundColor(null);
|
|
11732
|
-
}
|
|
11733
|
-
else {
|
|
11734
|
-
tableStore.setSelectedCellsBackgroundColor(color);
|
|
11735
|
-
}
|
|
11736
|
-
};
|
|
11737
|
-
|
|
11738
11656
|
function setTableOptions(editor, newOptions) {
|
|
11739
11657
|
const tablePosition = createTablePosition(editor);
|
|
11740
11658
|
const tablePath = getTablePath(editor);
|
|
@@ -11784,6 +11702,91 @@ function removeColumnOrRows(editor, tableStore, options) {
|
|
|
11784
11702
|
}
|
|
11785
11703
|
}
|
|
11786
11704
|
|
|
11705
|
+
const setSelectedCellsBackgroundColor = (editor, color, tableStore) => {
|
|
11706
|
+
// 点击自定义颜色面板输入框设置颜色值时,会丢失焦点和选区(目前无法做到焦点同时存在于编辑器和输入框)
|
|
11707
|
+
let location;
|
|
11708
|
+
if (!editor.selection) {
|
|
11709
|
+
const { rangeRef } = THE_EDITOR_PREVIOUS_SELECTION.get(editor);
|
|
11710
|
+
location = rangeRef.current.anchor;
|
|
11711
|
+
}
|
|
11712
|
+
const isHeader = TableEditor.isActiveHeader(editor, location);
|
|
11713
|
+
if (color === 'transparent') {
|
|
11714
|
+
color = null;
|
|
11715
|
+
}
|
|
11716
|
+
if ((color === TableHeaderBackgroundColor && isHeader) || (color === SpecialBackgroundColor && !isHeader)) {
|
|
11717
|
+
tableStore.setSelectedCellsBackgroundColor(null);
|
|
11718
|
+
}
|
|
11719
|
+
else {
|
|
11720
|
+
tableStore.setSelectedCellsBackgroundColor(color);
|
|
11721
|
+
}
|
|
11722
|
+
};
|
|
11723
|
+
|
|
11724
|
+
function setCellMenuVisibility(editor, menuList, tableInfo) {
|
|
11725
|
+
const { selectedCellPositions, isFullscreen, isSelectedTable, selectedRowsIndex, selectedColumnsIndex } = tableInfo;
|
|
11726
|
+
const isCellMerged = isSelectedCellMerged(editor);
|
|
11727
|
+
const selectCellNodes = getSelectCellNode(editor, selectedCellPositions).filter(item => !item.node.hidden);
|
|
11728
|
+
const isRect = isRectangularInTableCells(editor, selectedCellPositions);
|
|
11729
|
+
menuList.forEach(item => {
|
|
11730
|
+
switch (item.key) {
|
|
11731
|
+
case 'merge-cells':
|
|
11732
|
+
item.visibility = selectCellNodes && selectCellNodes.length > 1 && !isSelectedTable && isRect;
|
|
11733
|
+
break;
|
|
11734
|
+
case 'split-cells':
|
|
11735
|
+
item.visibility = selectCellNodes && selectCellNodes.length === 1 && isCellMerged;
|
|
11736
|
+
break;
|
|
11737
|
+
case 'delete-selection-rows':
|
|
11738
|
+
item.visibility = !(isFullscreen && selectedColumnsIndex.length);
|
|
11739
|
+
break;
|
|
11740
|
+
case 'delete-selection-columns':
|
|
11741
|
+
item.visibility = !(isFullscreen && selectedRowsIndex.length);
|
|
11742
|
+
break;
|
|
11743
|
+
case 'delete-table':
|
|
11744
|
+
item.visibility = !isFullscreen;
|
|
11745
|
+
break;
|
|
11746
|
+
case TableInsertType.insertRowsUp:
|
|
11747
|
+
const hasHeaderRowCell = TableEditor.hasHeaderRowCell(editor);
|
|
11748
|
+
item.visibility = !hasHeaderRowCell && isRect;
|
|
11749
|
+
break;
|
|
11750
|
+
case TableInsertType.insertRowsDown:
|
|
11751
|
+
item.visibility = isRect;
|
|
11752
|
+
break;
|
|
11753
|
+
case TableInsertType.insertColumnsLeft:
|
|
11754
|
+
const hasHeaderColumnCell = TableEditor.hasHeaderColumnCell(editor);
|
|
11755
|
+
item.visibility = !hasHeaderColumnCell && isRect;
|
|
11756
|
+
break;
|
|
11757
|
+
case TableInsertType.insertColumnsRight:
|
|
11758
|
+
item.visibility = isRect;
|
|
11759
|
+
break;
|
|
11760
|
+
}
|
|
11761
|
+
});
|
|
11762
|
+
}
|
|
11763
|
+
|
|
11764
|
+
function splitCell(editor) {
|
|
11765
|
+
const tablePosition = createTablePosition(editor);
|
|
11766
|
+
const { cell, table, cellEntry } = tablePosition;
|
|
11767
|
+
if ((!cell.rowspan && !cell.colspan) || (cell.rowspan === 1 && cell.colspan === 1))
|
|
11768
|
+
return editor;
|
|
11769
|
+
const cellRow = tablePosition.getRowIndex();
|
|
11770
|
+
const cellCol = tablePosition.getColumnIndex();
|
|
11771
|
+
resetTableCell(editor, table, cell, cellRow, cellCol);
|
|
11772
|
+
Transforms.select(editor, cellEntry[1]);
|
|
11773
|
+
Transforms.collapse(editor, { edge: 'end' });
|
|
11774
|
+
}
|
|
11775
|
+
function resetTableCell(editor, table, cell, cellRow, cellCol) {
|
|
11776
|
+
const rowSpanIndex = cellRow + (cell.rowspan || 1) - 1;
|
|
11777
|
+
const colSpanIndex = cellCol + (cell.colspan || 1) - 1;
|
|
11778
|
+
Editor.withoutNormalizing(editor, () => {
|
|
11779
|
+
table.children.map((row, rowIndex) => {
|
|
11780
|
+
row.children.map((col, colIndex) => {
|
|
11781
|
+
if (rowIndex >= cellRow && rowIndex <= rowSpanIndex && colIndex >= cellCol && colIndex <= colSpanIndex) {
|
|
11782
|
+
const path = findPath(editor, col);
|
|
11783
|
+
Transforms.setNodes(editor, { colspan: null, rowspan: null, hidden: null }, { at: path });
|
|
11784
|
+
}
|
|
11785
|
+
});
|
|
11786
|
+
});
|
|
11787
|
+
});
|
|
11788
|
+
}
|
|
11789
|
+
|
|
11787
11790
|
const getMinAndMaxCellIndex = (editor, selectedCellPositions, maxRow, maxCol, minRow, minCol, table) => {
|
|
11788
11791
|
const beforeCols = [];
|
|
11789
11792
|
const beforeRows = [];
|
|
@@ -12522,6 +12525,7 @@ class TheTableContextMenuService {
|
|
|
12522
12525
|
},
|
|
12523
12526
|
hasBackdrop: false,
|
|
12524
12527
|
placement: 'bottomLeft',
|
|
12528
|
+
panelClass: 'the-table-contextmenu-panel',
|
|
12525
12529
|
viewContainerRef: this.theContextService.getOptions().viewContainerRef,
|
|
12526
12530
|
manualClosure: true,
|
|
12527
12531
|
insideClosable: false,
|