@ai-table/grid 0.1.1 → 0.1.3

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.
@@ -3,10 +3,12 @@ import { AITable } from '../../core';
3
3
  import { AITableContextMenuItem } from '../../types';
4
4
  import { AITableGridSelectionService } from '../../services/selection.service';
5
5
  import { ThyNotifyService } from 'ngx-tethys/notify';
6
+ import { ThyPopoverRef } from 'ngx-tethys/popover';
6
7
  import * as i0 from "@angular/core";
7
8
  export declare class AITableContextMenu extends ThyDropdownAbstractMenu {
8
9
  aiTableGridSelectionService: AITableGridSelectionService;
9
10
  notifyService: ThyNotifyService;
11
+ thyPopoverRef: ThyPopoverRef<any, any, any>;
10
12
  aiTable: import("@angular/core").InputSignal<AITable>;
11
13
  menuItems: import("@angular/core").InputSignal<AITableContextMenuItem[]>;
12
14
  targetName: import("@angular/core").InputSignal<string>;
@@ -15,6 +17,8 @@ export declare class AITableContextMenu extends ThyDropdownAbstractMenu {
15
17
  y: number;
16
18
  }>;
17
19
  execute(menu: AITableContextMenuItem): void;
20
+ inputNumberFocus(e: Event): void;
21
+ itemEnterHandle(e: Event, menu: AITableContextMenuItem): void;
18
22
  static ɵfac: i0.ɵɵFactoryDeclaration<AITableContextMenu, never>;
19
23
  static ɵcmp: i0.ɵɵComponentDeclaration<AITableContextMenu, "ai-table-context-menu", never, { "aiTable": { "alias": "aiTable"; "required": true; "isSignal": true; }; "menuItems": { "alias": "menuItems"; "required": true; "isSignal": true; }; "targetName": { "alias": "targetName"; "required": true; "isSignal": true; }; "position": { "alias": "position"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
20
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"context-menu.component.d.ts","sourceRoot":"","sources":["../../../../packages/grid/src/components/context-menu/context-menu.component.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,uBAAuB,EAK1B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;;AAErD,qBAiBa,kBAAmB,SAAQ,uBAAuB;IAC3D,2BAA2B,8BAAuC;IAElE,aAAa,mBAA4B;IAEzC,OAAO,+CAA6B;IAEpC,SAAS,gEAA8C;IAEvD,UAAU,8CAA4B;IAEtC,QAAQ;WAAuB,MAAM;WAAK,MAAM;OAAM;IAEtD,OAAO,CAAC,IAAI,EAAE,sBAAsB;yCAb3B,kBAAkB;2CAAlB,kBAAkB;CAmB9B"}
1
+ {"version":3,"file":"context-menu.component.d.ts","sourceRoot":"","sources":["../../../../packages/grid/src/components/context-menu/context-menu.component.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,uBAAuB,EAK1B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAIrD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;;AACnD,qBAqBa,kBAAmB,SAAQ,uBAAuB;IAC3D,2BAA2B,8BAAuC;IAElE,aAAa,mBAA4B;IAEzC,aAAa,+BAAyB;IAEtC,OAAO,+CAA6B;IAEpC,SAAS,gEAA8C;IAEvD,UAAU,8CAA4B;IAEtC,QAAQ;WAAuB,MAAM;WAAK,MAAM;OAAM;IAEtD,OAAO,CAAC,IAAI,EAAE,sBAAsB;IAcpC,gBAAgB,CAAC,CAAC,EAAE,KAAK;IAIzB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,sBAAsB;yCAjC7C,kBAAkB;2CAAlB,kBAAkB;CAqC9B"}
@@ -9,4 +9,7 @@
9
9
  color: variables.$danger !important;
10
10
  }
11
11
  }
12
+ .thy-input-number {
13
+ width: 76px;
14
+ }
12
15
  }
@@ -2170,6 +2170,7 @@ class AITableContextMenu extends ThyDropdownAbstractMenu {
2170
2170
  super(...arguments);
2171
2171
  this.aiTableGridSelectionService = inject(AITableGridSelectionService);
2172
2172
  this.notifyService = inject(ThyNotifyService);
2173
+ this.thyPopoverRef = inject(ThyPopoverRef);
2173
2174
  this.aiTable = input.required();
2174
2175
  this.menuItems = input.required();
2175
2176
  this.targetName = input.required();
@@ -2178,17 +2179,28 @@ class AITableContextMenu extends ThyDropdownAbstractMenu {
2178
2179
  execute(menu) {
2179
2180
  if ((menu.disabled && !menu.disabled(this.aiTable(), this.targetName(), this.position())) || !menu.disabled) {
2180
2181
  menu.exec &&
2181
- menu.exec(this.aiTable(), this.targetName(), this.position(), this.aiTableGridSelectionService, this.notifyService);
2182
+ menu.exec(this.aiTable(), this.targetName(), this.position(), this.aiTableGridSelectionService, this.notifyService, menu.count);
2182
2183
  }
2183
2184
  }
2185
+ inputNumberFocus(e) {
2186
+ e.target.focus();
2187
+ }
2188
+ itemEnterHandle(e, menu) {
2189
+ this.execute(menu);
2190
+ this.thyPopoverRef.close();
2191
+ }
2184
2192
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AITableContextMenu, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2185
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.10", type: AITableContextMenu, isStandalone: true, selector: "ai-table-context-menu", inputs: { aiTable: { classPropertyName: "aiTable", publicName: "aiTable", isSignal: true, isRequired: true, transformFunction: null }, menuItems: { classPropertyName: "menuItems", publicName: "menuItems", isSignal: true, isRequired: true, transformFunction: null }, targetName: { classPropertyName: "targetName", publicName: "targetName", isSignal: true, isRequired: true, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: true, transformFunction: null } }, host: { classAttribute: "context-menu" }, usesInheritance: true, ngImport: i0, template: "@for (menu of menuItems(); track $index) {\n @if ((menu.hidden && !menu.hidden(aiTable(), targetName(), position())) || !menu.hidden) {\n @if (menu.type === 'divider') {\n <thy-divider thyStyle=\"solid\"></thy-divider>\n } @else {\n @let disabled = !!(menu.disabled && menu.disabled(aiTable(), targetName(), position()));\n @let isRemoveRecords = menu.type === 'removeRecords';\n @let isPreventClearSelection = menu.type === 'copyCells' || menu.type === 'pasteCells' || menu.type === 'removeRecords';\n\n <a\n thyDropdownMenuItem\n href=\"javascript:;\"\n [ngClass]=\"{\n 'remove-record': isRemoveRecords && !disabled,\n 'ai-table-prevent-clear-selection': isPreventClearSelection && !disabled\n }\"\n (click)=\"execute(menu)\"\n [thyDisabled]=\"disabled\"\n >\n <thy-icon thyDropdownMenuItemIcon [thyIconName]=\"menu.icon!\"></thy-icon>\n <span thyDropdownMenuItemName>{{ menu.name }}</span>\n <span thyDropdownMenuItemMeta class=\"text-desc\">{{ menu.shortcutKey }}</span>\n </a>\n }\n }\n}\n", dependencies: [{ kind: "directive", type: ThyDropdownMenuItemDirective, selector: "[thyDropdownMenuItem]", inputs: ["thyType", "thyDisabled"] }, { kind: "directive", type: ThyDropdownMenuItemNameDirective, selector: "[thyDropdownMenuItemName]" }, { kind: "directive", type: ThyDropdownMenuItemIconDirective, selector: "[thyDropdownMenuItemIcon]" }, { kind: "directive", type: ThyDropdownMenuItemMetaDirective, selector: "[thyDropdownMenuItemMeta]" }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ThyDivider, selector: "thy-divider", inputs: ["thyVertical", "thyStyle", "thyColor", "thyText", "thyTextDirection", "thyDeeper"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2193
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.10", type: AITableContextMenu, isStandalone: true, selector: "ai-table-context-menu", inputs: { aiTable: { classPropertyName: "aiTable", publicName: "aiTable", isSignal: true, isRequired: true, transformFunction: null }, menuItems: { classPropertyName: "menuItems", publicName: "menuItems", isSignal: true, isRequired: true, transformFunction: null }, targetName: { classPropertyName: "targetName", publicName: "targetName", isSignal: true, isRequired: true, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: true, transformFunction: null } }, host: { classAttribute: "context-menu" }, usesInheritance: true, ngImport: i0, template: "@for (menu of menuItems(); track $index) {\n @if ((menu.hidden && !menu.hidden(aiTable(), targetName(), position())) || !menu.hidden) {\n @if (menu.type === 'divider') {\n <thy-divider thyStyle=\"solid\"></thy-divider>\n } @else {\n @let disabled = !!(menu.disabled && menu.disabled(aiTable(), targetName(), position()));\n @let isRemoveRecords = menu.type === 'removeRecords';\n @let isPreventClearSelection =\n menu.type === 'copyCells' ||\n menu.type === 'pasteCells' ||\n menu.type === 'removeRecords' ||\n menu.type === 'insertUpwardRecords' ||\n menu.type === 'insertDownwardRecords';\n\n <a\n thyDropdownMenuItem\n href=\"javascript:;\"\n [ngClass]=\"{\n 'remove-record': isRemoveRecords && !disabled,\n 'ai-table-prevent-clear-selection': isPreventClearSelection && !disabled\n }\"\n (click)=\"execute(menu)\"\n [thyDisabled]=\"disabled\"\n >\n <thy-icon thyDropdownMenuItemIcon [thyIconName]=\"menu.icon!\"></thy-icon>\n @if (menu?.isInputNumber) {\n <span thyDropdownMenuItemName class=\"d-flex align-items-center\">\n {{ menu.name }}\n <thy-input-number\n #inputNumber\n class=\"mx-2\"\n thySize=\"sm\"\n [(ngModel)]=\"menu.count\"\n [thyStep]=\"1\"\n [thyMin]=\"1\"\n (click)=\"inputNumberFocus($event)\"\n (thyEnter)=\"itemEnterHandle($event, menu)\"\n thyStopPropagation\n ></thy-input-number>\n {{ menu.nameSuffix }}\n </span>\n } @else {\n <span thyDropdownMenuItemName>{{ menu.name }}</span>\n }\n <span thyDropdownMenuItemMeta class=\"text-desc\">{{ menu.shortcutKey }}</span>\n </a>\n }\n }\n}\n", dependencies: [{ kind: "component", type: ThyInputNumber, selector: "thy-input-number", inputs: ["thyAutoFocus", "thyPlaceholder", "thyDisabled", "thyMax", "thyMin", "thyStep", "thyStepDelay", "thySize", "thyPrecision", "thySuffix"], outputs: ["thyBlur", "thyFocus", "thyStepChange"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ThyEnterDirective, selector: "[thyEnter]", outputs: ["thyEnter"] }, { kind: "directive", type: ThyStopPropagationDirective, selector: "[thyStopPropagation]", inputs: ["thyStopPropagation"] }, { kind: "directive", type: ThyDropdownMenuItemDirective, selector: "[thyDropdownMenuItem]", inputs: ["thyType", "thyDisabled"] }, { kind: "directive", type: ThyDropdownMenuItemNameDirective, selector: "[thyDropdownMenuItemName]" }, { kind: "directive", type: ThyDropdownMenuItemIconDirective, selector: "[thyDropdownMenuItemIcon]" }, { kind: "directive", type: ThyDropdownMenuItemMetaDirective, selector: "[thyDropdownMenuItemMeta]" }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ThyDivider, selector: "thy-divider", inputs: ["thyVertical", "thyStyle", "thyColor", "thyText", "thyTextDirection", "thyDeeper"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2186
2194
  }
2187
2195
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AITableContextMenu, decorators: [{
2188
2196
  type: Component,
2189
2197
  args: [{ selector: 'ai-table-context-menu', changeDetection: ChangeDetectionStrategy.OnPush, host: {
2190
2198
  class: 'context-menu'
2191
2199
  }, imports: [
2200
+ ThyInputNumber,
2201
+ FormsModule,
2202
+ ThyEnterDirective,
2203
+ ThyStopPropagationDirective,
2192
2204
  ThyDropdownMenuItemDirective,
2193
2205
  ThyDropdownMenuItemNameDirective,
2194
2206
  ThyDropdownMenuItemIconDirective,
@@ -2196,7 +2208,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
2196
2208
  ThyIcon,
2197
2209
  NgClass,
2198
2210
  ThyDivider
2199
- ], template: "@for (menu of menuItems(); track $index) {\n @if ((menu.hidden && !menu.hidden(aiTable(), targetName(), position())) || !menu.hidden) {\n @if (menu.type === 'divider') {\n <thy-divider thyStyle=\"solid\"></thy-divider>\n } @else {\n @let disabled = !!(menu.disabled && menu.disabled(aiTable(), targetName(), position()));\n @let isRemoveRecords = menu.type === 'removeRecords';\n @let isPreventClearSelection = menu.type === 'copyCells' || menu.type === 'pasteCells' || menu.type === 'removeRecords';\n\n <a\n thyDropdownMenuItem\n href=\"javascript:;\"\n [ngClass]=\"{\n 'remove-record': isRemoveRecords && !disabled,\n 'ai-table-prevent-clear-selection': isPreventClearSelection && !disabled\n }\"\n (click)=\"execute(menu)\"\n [thyDisabled]=\"disabled\"\n >\n <thy-icon thyDropdownMenuItemIcon [thyIconName]=\"menu.icon!\"></thy-icon>\n <span thyDropdownMenuItemName>{{ menu.name }}</span>\n <span thyDropdownMenuItemMeta class=\"text-desc\">{{ menu.shortcutKey }}</span>\n </a>\n }\n }\n}\n" }]
2211
+ ], template: "@for (menu of menuItems(); track $index) {\n @if ((menu.hidden && !menu.hidden(aiTable(), targetName(), position())) || !menu.hidden) {\n @if (menu.type === 'divider') {\n <thy-divider thyStyle=\"solid\"></thy-divider>\n } @else {\n @let disabled = !!(menu.disabled && menu.disabled(aiTable(), targetName(), position()));\n @let isRemoveRecords = menu.type === 'removeRecords';\n @let isPreventClearSelection =\n menu.type === 'copyCells' ||\n menu.type === 'pasteCells' ||\n menu.type === 'removeRecords' ||\n menu.type === 'insertUpwardRecords' ||\n menu.type === 'insertDownwardRecords';\n\n <a\n thyDropdownMenuItem\n href=\"javascript:;\"\n [ngClass]=\"{\n 'remove-record': isRemoveRecords && !disabled,\n 'ai-table-prevent-clear-selection': isPreventClearSelection && !disabled\n }\"\n (click)=\"execute(menu)\"\n [thyDisabled]=\"disabled\"\n >\n <thy-icon thyDropdownMenuItemIcon [thyIconName]=\"menu.icon!\"></thy-icon>\n @if (menu?.isInputNumber) {\n <span thyDropdownMenuItemName class=\"d-flex align-items-center\">\n {{ menu.name }}\n <thy-input-number\n #inputNumber\n class=\"mx-2\"\n thySize=\"sm\"\n [(ngModel)]=\"menu.count\"\n [thyStep]=\"1\"\n [thyMin]=\"1\"\n (click)=\"inputNumberFocus($event)\"\n (thyEnter)=\"itemEnterHandle($event, menu)\"\n thyStopPropagation\n ></thy-input-number>\n {{ menu.nameSuffix }}\n </span>\n } @else {\n <span thyDropdownMenuItemName>{{ menu.name }}</span>\n }\n <span thyDropdownMenuItemMeta class=\"text-desc\">{{ menu.shortcutKey }}</span>\n </a>\n }\n }\n}\n" }]
2200
2212
  }] });
2201
2213
 
2202
2214
  const GRID_CELL_EDITOR_MAP = {