@smallpearl/ngx-helper 0.31.1 → 0.31.6

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.
@@ -2,6 +2,8 @@
2
2
  "save": "Save",
3
3
  "edit": "Update",
4
4
  "delete": "Delete",
5
+ "createNew": "Create New",
6
+ "refresh": "Refresh",
5
7
  "newItem": "New {{item}}",
6
8
  "editItem": "Update {{item}}",
7
9
  "deleteItem": "Delete {{item}}",
@@ -2,18 +2,20 @@
2
2
  "save": "保存",
3
3
  "edit": "編輯",
4
4
  "delete": "刪除",
5
- "newItem": "新建 {{item}}",
6
- "editItem": "編輯 {{item}}",
7
- "deleteItem": "刪除 {{item}}",
8
- "deleteItemConfirm": "確定要刪除這個 {{item}} 嗎?",
9
- "deleteItemSuccess": "{{item}} 刪除成功",
10
- "deleteItemError": "{{item}} 刪除失敗",
11
- "saveSuccess": "{{item}} 保存成功",
12
- "saveError": "{{item}} 保存失敗",
13
- "createSuccess": "{{item}} 創建成功",
14
- "createError": "{{item}} 創建失敗",
15
- "updateSuccess": "{{item}} 更新成功",
16
- "updateError": "{{item}} 更新失敗",
5
+ "createNew": "新建",
6
+ "refresh": "刷新",
7
+ "newItem": "新建{{item}}",
8
+ "editItem": "編輯{{item}}",
9
+ "deleteItem": "刪除{{item}}",
10
+ "deleteItemConfirm": "確定要刪除這個{{item}}嗎?",
11
+ "deleteItemSuccess": "{{item}}刪除成功",
12
+ "deleteItemError": "{{item}}刪除失敗",
13
+ "saveSuccess": "{{item}}保存成功",
14
+ "saveError": "{{item}}保存失敗",
15
+ "createSuccess": "{{item}}創建成功",
16
+ "createError": "{{item}}創建失敗",
17
+ "updateSuccess": "{{item}}更新成功",
18
+ "updateError": "{{item}}更新失敗",
17
19
  "loseChangesConfirm": "您有未保存的更改。確定要離開嗎?",
18
20
  "cancel": "取消",
19
21
  "confirm": "確認",
@@ -1,11 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, EventEmitter, Component, ChangeDetectionStrategy, Output } from '@angular/core';
2
+ import { input, signal, EventEmitter, viewChild, Component, ChangeDetectionStrategy, Output } from '@angular/core';
3
3
  import * as i2 from '@angular/material/button';
4
4
  import { MatButtonModule } from '@angular/material/button';
5
5
  import * as i3 from '@angular/material/icon';
6
6
  import { MatIconModule } from '@angular/material/icon';
7
7
  import * as i4 from '@angular/material/menu';
8
- import { MatMenuModule } from '@angular/material/menu';
8
+ import { MatMenuTrigger, MatMenuModule } from '@angular/material/menu';
9
9
  import * as i1 from '@angular/router';
10
10
  import { RouterModule } from '@angular/router';
11
11
  import { HoverDropDownDirective } from '@smallpearl/ngx-helper/hover-dropdown';
@@ -13,9 +13,13 @@ import { HoverDropDownDirective } from '@smallpearl/ngx-helper/hover-dropdown';
13
13
  class SPMatContextMenuComponent {
14
14
  /**
15
15
  * The menu items to display. Refer to ContextMenuItem doc for details
16
- * on the menu items.
16
+ * on the menu items. This can be an array ofSPContextMenuItem objects or
17
+ * a function that returns an array of SPContextMenuItem objects.
18
+ * If it is a function, the function will be called with the contextData
19
+ * as the argument when the user clicks on the menu trigger button.
17
20
  */
18
21
  menuItems = input.required();
22
+ _menuItems = signal([]);
19
23
  /**
20
24
  * Label to display for the context menu. If omitted will just show the
21
25
  * menuIcon.
@@ -45,8 +49,22 @@ class SPMatContextMenuComponent {
45
49
  * value.
46
50
  */
47
51
  selected = new EventEmitter();
52
+ menuTrigger = viewChild(MatMenuTrigger);
48
53
  constructor() { }
49
54
  ngOnInit() { }
55
+ showMenu() {
56
+ const menuTrigger = this.menuTrigger();
57
+ const menuItems = this.menuItems();
58
+ if (typeof menuItems === 'function') {
59
+ this._menuItems.set(menuItems(this.contextData()));
60
+ }
61
+ else {
62
+ this._menuItems.set(menuItems);
63
+ }
64
+ if (menuTrigger) {
65
+ menuTrigger.openMenu();
66
+ }
67
+ }
50
68
  onSelectMenuItem(item) {
51
69
  if (!item.route) {
52
70
  this.selected.emit(item?.role || item.label);
@@ -56,14 +74,14 @@ class SPMatContextMenuComponent {
56
74
  return menuItem?.disable && menuItem.disable(this.contextData());
57
75
  }
58
76
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: SPMatContextMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
59
- /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.6", type: SPMatContextMenuComponent, isStandalone: true, selector: "sp-mat-context-menu", inputs: { menuItems: { classPropertyName: "menuItems", publicName: "menuItems", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, menuIconName: { classPropertyName: "menuIconName", publicName: "menuIconName", isSignal: true, isRequired: false, transformFunction: null }, enableHover: { classPropertyName: "enableHover", publicName: "enableHover", isSignal: true, isRequired: false, transformFunction: null }, contextData: { classPropertyName: "contextData", publicName: "contextData", isSignal: true, isRequired: false, transformFunction: null }, hasBackdrop: { classPropertyName: "hasBackdrop", publicName: "hasBackdrop", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selected" }, ngImport: i0, template: `
77
+ /** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.6", type: SPMatContextMenuComponent, isStandalone: true, selector: "sp-mat-context-menu", inputs: { menuItems: { classPropertyName: "menuItems", publicName: "menuItems", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, menuIconName: { classPropertyName: "menuIconName", publicName: "menuIconName", isSignal: true, isRequired: false, transformFunction: null }, enableHover: { classPropertyName: "enableHover", publicName: "enableHover", isSignal: true, isRequired: false, transformFunction: null }, contextData: { classPropertyName: "contextData", publicName: "contextData", isSignal: true, isRequired: false, transformFunction: null }, hasBackdrop: { classPropertyName: "hasBackdrop", publicName: "hasBackdrop", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selected" }, viewQueries: [{ propertyName: "menuTrigger", first: true, predicate: MatMenuTrigger, descendants: true, isSignal: true }], ngImport: i0, template: `
60
78
  <button
61
- #menuTrigger="matMenuTrigger"
79
+ #menuTrigger
62
80
  mat-icon-button
63
81
  [matMenuTriggerFor]="contextMenu"
64
82
  hoverDropDown
65
83
  [menu]="contextMenu"
66
- [hoverTrigger]="enableHover() ? menuTrigger : null"
84
+ (click)="$event.stopImmediatePropagation(); showMenu()"
67
85
  >
68
86
  @if (menuIconName()) {
69
87
  <mat-icon>{{ menuIconName() }}</mat-icon>
@@ -71,7 +89,7 @@ class SPMatContextMenuComponent {
71
89
  {{ label() }}
72
90
  </button>
73
91
  <mat-menu #contextMenu="matMenu" [hasBackdrop]="hasBackdrop()">
74
- @for (menuItem of menuItems(); track $index) {
92
+ @for (menuItem of _menuItems(); track $index) {
75
93
  @if (menuItem.role) {
76
94
  <button
77
95
  mat-menu-item
@@ -117,12 +135,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
117
135
  selector: 'sp-mat-context-menu',
118
136
  template: `
119
137
  <button
120
- #menuTrigger="matMenuTrigger"
138
+ #menuTrigger
121
139
  mat-icon-button
122
140
  [matMenuTriggerFor]="contextMenu"
123
141
  hoverDropDown
124
142
  [menu]="contextMenu"
125
- [hoverTrigger]="enableHover() ? menuTrigger : null"
143
+ (click)="$event.stopImmediatePropagation(); showMenu()"
126
144
  >
127
145
  @if (menuIconName()) {
128
146
  <mat-icon>{{ menuIconName() }}</mat-icon>
@@ -130,7 +148,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
130
148
  {{ label() }}
131
149
  </button>
132
150
  <mat-menu #contextMenu="matMenu" [hasBackdrop]="hasBackdrop()">
133
- @for (menuItem of menuItems(); track $index) {
151
+ @for (menuItem of _menuItems(); track $index) {
134
152
  @if (menuItem.role) {
135
153
  <button
136
154
  mat-menu-item
@@ -1 +1 @@
1
- {"version":3,"file":"smallpearl-ngx-helper-mat-context-menu.mjs","sources":["../../../../projects/smallpearl/ngx-helper/mat-context-menu/src/mat-context-menu.component.ts","../../../../projects/smallpearl/ngx-helper/mat-context-menu/smallpearl-ngx-helper-mat-context-menu.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n input,\n OnInit,\n Output,\n} from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatMenuModule } from '@angular/material/menu';\nimport { RouterModule } from '@angular/router';\nimport { HoverDropDownDirective } from '@smallpearl/ngx-helper/hover-dropdown';\n\n/**\n * Describes each item in the context menu.\n */\nexport interface SPContextMenuItem {\n // Menu item label\n label: string;\n // Menu icon, A material icon\n icon?: string;\n // Angular route to navigate to when the menu item is selected.\n route?: string | string[];\n // Argument to the (selected) event when this menu item is selected\n // by the user and the corresponding ContextMenuItem does not have a\n // 'route' property value.\n role?: string;\n // Whether the menu item should be disabled\n disable?: (arg: any) => boolean;\n}\n\n@Component({\n imports: [\n RouterModule,\n MatButtonModule,\n MatIconModule,\n MatMenuModule,\n HoverDropDownDirective,\n ],\n selector: 'sp-mat-context-menu',\n template: `\n <button\n #menuTrigger=\"matMenuTrigger\"\n mat-icon-button\n [matMenuTriggerFor]=\"contextMenu\"\n hoverDropDown\n [menu]=\"contextMenu\"\n [hoverTrigger]=\"enableHover() ? menuTrigger : null\"\n >\n @if (menuIconName()) {\n <mat-icon>{{ menuIconName() }}</mat-icon>\n }\n {{ label() }}\n </button>\n <mat-menu #contextMenu=\"matMenu\" [hasBackdrop]=\"hasBackdrop()\">\n @for (menuItem of menuItems(); track $index) {\n @if (menuItem.role) {\n <button\n mat-menu-item\n [routerLink]=\"menuItem.route ? menuItem.route : undefined\"\n (click)=\"$event.preventDefault(); onSelectMenuItem(menuItem)\"\n [disabled]=\"itemDisabled(menuItem)\"\n >\n @if (menuItem.icon) {\n <mat-icon>{{ menuItem.icon }}</mat-icon>\n }\n {{ menuItem.label }}\n </button>\n } @else {\n <div style=\"padding: .2em 0.6em;\">\n <strong>{{ menuItem.label }}</strong>\n </div>\n }\n <!-- <button\n mat-menu-item\n [routerLink]=\"menuItem.route ? menuItem.route : undefined\"\n (click)=\"$event.preventDefault(); onSelectMenuItem(menuItem)\"\n [disabled]=\"itemDisabled(menuItem)\"\n >\n @if (menuItem.icon) {\n <mat-icon>{{ menuItem.icon }}</mat-icon>\n }\n {{ menuItem.label }}\n </button> -->\n }\n </mat-menu>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class SPMatContextMenuComponent implements OnInit {\n /**\n * The menu items to display. Refer to ContextMenuItem doc for details\n * on the menu items.\n */\n menuItems = input.required<SPContextMenuItem[]>();\n /**\n * Label to display for the context menu. If omitted will just show the\n * menuIcon.\n */\n label = input<string>('');\n /**\n * Button icon. defaults to more_vert.\n */\n menuIconName = input<string>('more_vert');\n /**\n * By default the context menu is activated whenever the mouse cursor hovers\n * over the button. Set this to 'true' to disable this feature.\n */\n enableHover = input<boolean>(false);\n /**\n * Context data for menu item disabled callback\n */\n contextData = input<any>();\n /**\n * enable menu backdrop\n */\n hasBackdrop = input<boolean>(false);\n /**\n * Event generated when use selects an item in the context menu. This event\n * is generated only if the context menu item does not specify a route to\n * activate. The string event parameter is ContextMenuItem.role property\n * value.\n */\n @Output() selected = new EventEmitter<string>();\n\n constructor() {}\n\n ngOnInit() {}\n\n\n onSelectMenuItem(item: SPContextMenuItem) {\n if (!item.route) {\n this.selected.emit(item?.role || item.label);\n }\n }\n\n itemDisabled(menuItem: SPContextMenuItem) {\n return menuItem?.disable && menuItem.disable(this.contextData());\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;MA0Fa,yBAAyB,CAAA;AACpC;;;AAGG;AACH,IAAA,SAAS,GAAG,KAAK,CAAC,QAAQ,EAAuB;AACjD;;;AAGG;AACH,I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EAAA,QAAA,EAAA,SAAA,EAAA,SAAA,EAAA,UAAA,CAAA,EAAA,QAAA,EAAA,CAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,aAAa,8vBACb,sBAAsB,EAAA,QAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,CAAA,cAAA,EAAA,MAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAoDjB,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBA1DrC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,OAAO,EAAE;wBACL,YAAY;wBACZ,eAAe;wBACf,aAAa;wBACb,aAAa;wBACb,sBAAsB;AACzB,qBAAA;AACD,oBAAA,QAAQ,EAAE,qBAAqB;AAC/B,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CX,EAAA,CAAA;oBACC,eAAe,EAAE,uBAAuB,CAAC;AAC5C,iBAAA;wDAmCW,QAAQ,EAAA,CAAA;sBAAjB;;;AC5HH;;AAEG;;;;"}
1
+ {"version":3,"file":"smallpearl-ngx-helper-mat-context-menu.mjs","sources":["../../../../projects/smallpearl/ngx-helper/mat-context-menu/src/mat-context-menu.component.ts","../../../../projects/smallpearl/ngx-helper/mat-context-menu/smallpearl-ngx-helper-mat-context-menu.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n EventEmitter,\n input,\n OnInit,\n Output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatMenuModule, MatMenuTrigger } from '@angular/material/menu';\nimport { RouterModule } from '@angular/router';\nimport { HoverDropDownDirective } from '@smallpearl/ngx-helper/hover-dropdown';\n\n/**\n * Describes each item in the context menu.\n */\nexport interface SPContextMenuItem {\n // Menu item label\n label: string;\n // Menu icon, A material icon\n icon?: string;\n // Angular route to navigate to when the menu item is selected.\n route?: string | string[];\n // Argument to the (selected) event when this menu item is selected\n // by the user and the corresponding ContextMenuItem does not have a\n // 'route' property value.\n role?: string;\n // Whether the menu item should be disabled\n disable?: (arg: any) => boolean;\n}\n\n@Component({\n imports: [\n RouterModule,\n MatButtonModule,\n MatIconModule,\n MatMenuModule,\n HoverDropDownDirective,\n ],\n selector: 'sp-mat-context-menu',\n template: `\n <button\n #menuTrigger\n mat-icon-button\n [matMenuTriggerFor]=\"contextMenu\"\n hoverDropDown\n [menu]=\"contextMenu\"\n (click)=\"$event.stopImmediatePropagation(); showMenu()\"\n >\n @if (menuIconName()) {\n <mat-icon>{{ menuIconName() }}</mat-icon>\n }\n {{ label() }}\n </button>\n <mat-menu #contextMenu=\"matMenu\" [hasBackdrop]=\"hasBackdrop()\">\n @for (menuItem of _menuItems(); track $index) {\n @if (menuItem.role) {\n <button\n mat-menu-item\n [routerLink]=\"menuItem.route ? menuItem.route : undefined\"\n (click)=\"$event.preventDefault(); onSelectMenuItem(menuItem)\"\n [disabled]=\"itemDisabled(menuItem)\"\n >\n @if (menuItem.icon) {\n <mat-icon>{{ menuItem.icon }}</mat-icon>\n }\n {{ menuItem.label }}\n </button>\n } @else {\n <div style=\"padding: .2em 0.6em;\">\n <strong>{{ menuItem.label }}</strong>\n </div>\n }\n <!-- <button\n mat-menu-item\n [routerLink]=\"menuItem.route ? menuItem.route : undefined\"\n (click)=\"$event.preventDefault(); onSelectMenuItem(menuItem)\"\n [disabled]=\"itemDisabled(menuItem)\"\n >\n @if (menuItem.icon) {\n <mat-icon>{{ menuItem.icon }}</mat-icon>\n }\n {{ menuItem.label }}\n </button> -->\n }\n </mat-menu>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class SPMatContextMenuComponent implements OnInit {\n /**\n * The menu items to display. Refer to ContextMenuItem doc for details\n * on the menu items. This can be an array ofSPContextMenuItem objects or\n * a function that returns an array of SPContextMenuItem objects.\n * If it is a function, the function will be called with the contextData\n * as the argument when the user clicks on the menu trigger button.\n */\n menuItems = input.required<SPContextMenuItem[]|((contextData?: any) => SPContextMenuItem[])>();\n\n _menuItems = signal<SPContextMenuItem[]>([])\n /**\n * Label to display for the context menu. If omitted will just show the\n * menuIcon.\n */\n label = input<string>('');\n /**\n * Button icon. defaults to more_vert.\n */\n menuIconName = input<string>('more_vert');\n /**\n * By default the context menu is activated whenever the mouse cursor hovers\n * over the button. Set this to 'true' to disable this feature.\n */\n enableHover = input<boolean>(false);\n /**\n * Context data for menu item disabled callback\n */\n contextData = input<any>();\n /**\n * enable menu backdrop\n */\n hasBackdrop = input<boolean>(false);\n /**\n * Event generated when use selects an item in the context menu. This event\n * is generated only if the context menu item does not specify a route to\n * activate. The string event parameter is ContextMenuItem.role property\n * value.\n */\n @Output() selected = new EventEmitter<string>();\n\n menuTrigger = viewChild(MatMenuTrigger);\n\n constructor() {}\n\n ngOnInit() {}\n\n showMenu() {\n const menuTrigger = this.menuTrigger();\n const menuItems = this.menuItems();\n if (typeof menuItems === 'function') {\n this._menuItems.set(menuItems(this.contextData()));\n } else {\n this._menuItems.set(menuItems);\n }\n if (menuTrigger) {\n menuTrigger.openMenu();\n }\n }\n\n onSelectMenuItem(item: SPContextMenuItem) {\n if (!item.route) {\n this.selected.emit(item?.role || item.label);\n }\n }\n\n itemDisabled(menuItem: SPContextMenuItem) {\n return menuItem?.disable && menuItem.disable(this.contextData());\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;MA6Fa,yBAAyB,CAAA;AACpC;;;;;;AAMG;AACH,IAAA,SAAS,GAAG,KAAK,CAAC,QAAQ,EAAoE;AAE9F,IAAA,UAAU,GAAG,MAAM,CAAsB,EAAE,CAAC;AAC5C;;;AAGG;AACH,IAAA,KAAK,GAAG,KAAK,CAAS,EAAE,CAAC;AACzB;;AAEG;AACH,IAAA,YAAY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