@acorex/components 20.2.39 → 20.2.41

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/button/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as i0 from '@angular/core';
1
+ import * as _angular_core from '@angular/core';
2
2
  import { EventEmitter, QueryList, AfterViewInit } from '@angular/core';
3
3
  import { MXInteractiveComponent, MXColorComponent, AXClickEvent, AXStyleColorType, AXItemClickEvent, AXStyleLookType, AXHotKeyAction, MXButtonBaseComponent } from '@acorex/cdk/common';
4
4
  import * as polytype from 'polytype';
@@ -11,7 +11,9 @@ interface AXButtonItemListItem {
11
11
  divided?: boolean;
12
12
  disabled?: boolean;
13
13
  selected?: boolean;
14
+ iconOnly?: boolean;
14
15
  color?: AXStyleColorType;
16
+ loading?: boolean;
15
17
  }
16
18
  declare const AXButtonItemComponent_base: polytype.Polytype.ClusteredConstructor<[typeof MXInteractiveComponent, typeof MXColorComponent]>;
17
19
  /**
@@ -93,8 +95,8 @@ declare class AXButtonItemComponent extends AXButtonItemComponent_base {
93
95
  * @ignore
94
96
  */
95
97
  tabindex: string;
96
- static ɵfac: i0.ɵɵFactoryDeclaration<AXButtonItemComponent, never>;
97
- static ɵcmp: i0.ɵɵComponentDeclaration<AXButtonItemComponent, "ax-button-item", never, { "color": { "alias": "color"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "text": { "alias": "text"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "divided": { "alias": "divided"; "required": false; }; "data": { "alias": "data"; "required": false; }; "name": { "alias": "name"; "required": false; }; }, { "onClick": "onClick"; "onFocus": "onFocus"; "onBlur": "onBlur"; "disabledChange": "disabledChange"; }, never, ["ax-prefix", "ax-loading", "ax-icon", "ax-suffix", "ax-dropdown-panel"], true, never>;
98
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXButtonItemComponent, never>;
99
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<AXButtonItemComponent, "ax-button-item", never, { "color": { "alias": "color"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "text": { "alias": "text"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "divided": { "alias": "divided"; "required": false; }; "data": { "alias": "data"; "required": false; }; "name": { "alias": "name"; "required": false; }; }, { "onClick": "onClick"; "onFocus": "onFocus"; "onBlur": "onBlur"; "disabledChange": "disabledChange"; }, never, ["ax-prefix", "ax-loading", "ax-icon", "ax-suffix", "ax-dropdown-panel"], true, never>;
98
100
  }
99
101
 
100
102
  /**
@@ -110,7 +112,20 @@ declare class AXButtonItemListComponent extends MXInteractiveComponent {
110
112
  *
111
113
  * @defaultValue []
112
114
  */
113
- items: i0.InputSignal<AXButtonItemListItem[]>;
115
+ items: _angular_core.InputSignal<AXButtonItemListItem[]>;
116
+ /**
117
+ * Determines if the parent closable component should be closed automatically when
118
+ * an item is clicked.
119
+ *
120
+ * @defaultValue true
121
+ */
122
+ closeParentOnClick: _angular_core.InputSignal<boolean>;
123
+ /**
124
+ * Locks interaction for all items when any item is loading.
125
+ *
126
+ * @defaultValue false
127
+ */
128
+ lockOnLoading: _angular_core.InputSignal<boolean>;
114
129
  /**
115
130
  * Emits an event when an item is clicked.
116
131
  * The event contains details about the clicked item.
@@ -125,6 +140,8 @@ declare class AXButtonItemListComponent extends MXInteractiveComponent {
125
140
  * @ignore
126
141
  */
127
142
  constructor();
143
+ protected isDisabled(item: AXButtonItemListItem): boolean;
144
+ protected hasAnyLoadingItem(): boolean;
128
145
  /**
129
146
  * Initializes the content of the button item list.
130
147
  * Binds events and properties to content button items and marks for change detection.
@@ -162,6 +179,10 @@ declare class AXButtonItemListComponent extends MXInteractiveComponent {
162
179
  * @ignore
163
180
  */
164
181
  _emitOnItemClickEvent(e: AXClickEvent, item: AXButtonItemComponent): void;
182
+ /**
183
+ * Closes the parent closable component if available.
184
+ */
185
+ closeParent(): void;
165
186
  /**
166
187
  * Generates the CSS classes for the button item list host element.
167
188
  * Includes classes for action list and vertical layout.
@@ -170,8 +191,8 @@ declare class AXButtonItemListComponent extends MXInteractiveComponent {
170
191
  * @ignore
171
192
  */
172
193
  private get __hostClass();
173
- static ɵfac: i0.ɵɵFactoryDeclaration<AXButtonItemListComponent, never>;
174
- static ɵcmp: i0.ɵɵComponentDeclaration<AXButtonItemListComponent, "ax-button-item-list", never, { "items": { "alias": "items"; "required": false; "isSignal": true; }; }, { "onItemClick": "onItemClick"; }, ["_contentButtons"], ["*"], true, never>;
194
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXButtonItemListComponent, never>;
195
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<AXButtonItemListComponent, "ax-button-item-list", never, { "items": { "alias": "items"; "required": false; "isSignal": true; }; "closeParentOnClick": { "alias": "closeParentOnClick"; "required": false; "isSignal": true; }; "lockOnLoading": { "alias": "lockOnLoading"; "required": false; "isSignal": true; }; }, { "onItemClick": "onItemClick"; }, ["_contentButtons"], ["*"], true, never>;
175
196
  }
176
197
 
177
198
  type AXButtonType = 'submit' | 'button' | 'cancel' | 'reset';
@@ -204,10 +225,10 @@ interface AXButtonItem {
204
225
  * @category Components
205
226
  */
206
227
  declare class AXButtonComponent extends MXButtonBaseComponent implements AfterViewInit {
207
- iconOnly: i0.InputSignal<boolean>;
208
- protected showIcon: i0.Signal<boolean>;
209
- protected loadingIcon: i0.Signal<AXLoadingComponent>;
210
- protected hasLoadingIcon: i0.Signal<boolean>;
228
+ iconOnly: _angular_core.InputSignal<boolean>;
229
+ protected showIcon: _angular_core.Signal<boolean>;
230
+ protected loadingIcon: _angular_core.Signal<AXLoadingComponent>;
231
+ protected hasLoadingIcon: _angular_core.Signal<boolean>;
211
232
  /**
212
233
  * Fires each time the user clicks the button.
213
234
  * @event
@@ -218,13 +239,13 @@ declare class AXButtonComponent extends MXButtonBaseComponent implements AfterVi
218
239
  *
219
240
  * @defaultValue 'button'
220
241
  */
221
- type: i0.InputSignal<AXButtonType>;
242
+ type: _angular_core.InputSignal<AXButtonType>;
222
243
  /**
223
244
  * Defines the text displayed while the action sheet is loading.
224
245
  *
225
246
  * @defaultValue null
226
247
  */
227
- loadingText: i0.ModelSignal<string>;
248
+ loadingText: _angular_core.ModelSignal<string>;
228
249
  /**
229
250
  * @ignore
230
251
  */
@@ -255,14 +276,14 @@ declare class AXButtonComponent extends MXButtonBaseComponent implements AfterVi
255
276
  * when the button loses focus.
256
277
  */
257
278
  blur(): void;
258
- static ɵfac: i0.ɵɵFactoryDeclaration<AXButtonComponent, never>;
259
- static ɵcmp: i0.ɵɵComponentDeclaration<AXButtonComponent, "ax-button", never, { "disabled": { "alias": "disabled"; "required": false; }; "size": { "alias": "size"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "color": { "alias": "color"; "required": false; }; "look": { "alias": "look"; "required": false; }; "text": { "alias": "text"; "required": false; }; "toggleable": { "alias": "toggleable"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "iconOnly": { "alias": "iconOnly"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "loadingText": { "alias": "loadingText"; "required": false; "isSignal": true; }; }, { "onBlur": "onBlur"; "onFocus": "onFocus"; "onClick": "onClick"; "selectedChange": "selectedChange"; "toggleableChange": "toggleableChange"; "lookChange": "lookChange"; "colorChange": "colorChange"; "disabledChange": "disabledChange"; "loadingText": "loadingTextChange"; }, ["loadingIcon"], ["ax-loading, ax-loading-spinner", "ax-prefix, ax-icon", "ax-content", "ax-suffix", "ax-dropdown-panel", ".tab-content", "*"], true, never>;
279
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXButtonComponent, never>;
280
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<AXButtonComponent, "ax-button", never, { "disabled": { "alias": "disabled"; "required": false; }; "size": { "alias": "size"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "color": { "alias": "color"; "required": false; }; "look": { "alias": "look"; "required": false; }; "text": { "alias": "text"; "required": false; }; "toggleable": { "alias": "toggleable"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "iconOnly": { "alias": "iconOnly"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "loadingText": { "alias": "loadingText"; "required": false; "isSignal": true; }; }, { "onBlur": "onBlur"; "onFocus": "onFocus"; "onClick": "onClick"; "selectedChange": "selectedChange"; "toggleableChange": "toggleableChange"; "lookChange": "lookChange"; "colorChange": "colorChange"; "disabledChange": "disabledChange"; "loadingText": "loadingTextChange"; }, ["loadingIcon"], ["ax-loading, ax-loading-spinner", "ax-prefix, ax-icon", "ax-content", "ax-suffix", "ax-dropdown-panel", ".tab-content", "*"], true, never>;
260
281
  }
261
282
 
262
283
  declare class AXButtonModule {
263
- static ɵfac: i0.ɵɵFactoryDeclaration<AXButtonModule, never>;
264
- static ɵmod: i0.ɵɵNgModuleDeclaration<AXButtonModule, never, [typeof AXButtonComponent, typeof AXButtonItemComponent, typeof AXButtonItemListComponent], [typeof AXButtonComponent, typeof AXButtonItemComponent, typeof AXButtonItemListComponent]>;
265
- static ɵinj: i0.ɵɵInjectorDeclaration<AXButtonModule>;
284
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXButtonModule, never>;
285
+ static ɵmod: _angular_core.ɵɵNgModuleDeclaration<AXButtonModule, never, [typeof AXButtonComponent, typeof AXButtonItemComponent, typeof AXButtonItemListComponent], [typeof AXButtonComponent, typeof AXButtonItemComponent, typeof AXButtonItemListComponent]>;
286
+ static ɵinj: _angular_core.ɵɵInjectorDeclaration<AXButtonModule>;
266
287
  }
267
288
 
268
289
  export { AXButtonComponent, AXButtonItemComponent, AXButtonItemListComponent, AXButtonModule };
@@ -1,5 +1,5 @@
1
1
  import * as i2 from '@acorex/cdk/common';
2
- import { AXEvent, MXBaseComponent, AXDataSource, AXSortOrder, AXButtonClickEvent, AXItemClickEvent, AXValueChangedEvent, AXListDataSource } from '@acorex/cdk/common';
2
+ import { AXEvent, MXBaseComponent, AXDataSource, AXSortOrder, AXStyleLookType, AXButtonClickEvent, AXItemClickEvent, AXClickEvent, AXValueChangedEvent, AXListDataSource } from '@acorex/cdk/common';
3
3
  import * as i0 from '@angular/core';
4
4
  import { EventEmitter, TemplateRef, ChangeDetectorRef, OnInit, DoCheck, QueryList, WritableSignal, ElementRef, AfterViewInit, Signal } from '@angular/core';
5
5
  import * as i11 from '@acorex/core/format';
@@ -86,7 +86,15 @@ declare abstract class AXBaseDataTable extends MXBaseComponent {
86
86
 
87
87
  declare abstract class AXDataTableColumnComponent {
88
88
  caption: string;
89
- width: string | number;
89
+ /**
90
+ * Width of the column.
91
+ * - string: e.g., '180px', '20%'
92
+ * - number: e.g., 180 (treated as pixels)
93
+ * - 'auto': automatically fits to content after data load
94
+ *
95
+ * @defaultValue 'auto'
96
+ */
97
+ width: string | number | 'auto';
90
98
  fixed: 'start' | 'end' | undefined;
91
99
  allowSorting: boolean;
92
100
  allowResizing: boolean;
@@ -245,14 +253,24 @@ declare class AXDataTableTextColumnComponent extends AXDataTableColumnComponent
245
253
  static ɵcmp: i0.ɵɵComponentDeclaration<AXDataTableTextColumnComponent, "ax-text-column", never, { "width": { "alias": "width"; "required": false; }; "caption": { "alias": "caption"; "required": false; }; "allowSorting": { "alias": "allowSorting"; "required": false; }; "allowResizing": { "alias": "allowResizing"; "required": false; }; "fixed": { "alias": "fixed"; "required": false; }; "customExpandIcon": { "alias": "customExpandIcon"; "required": false; }; "customCollapseIcon": { "alias": "customCollapseIcon"; "required": false; }; "dataField": { "alias": "dataField"; "required": false; }; "expandHandler": { "alias": "expandHandler"; "required": false; }; "wrapText": { "alias": "wrapText"; "required": false; }; "cellTemplate": { "alias": "cellTemplate"; "required": false; }; "footerTemplate": { "alias": "footerTemplate"; "required": false; }; "headerTemplate": { "alias": "headerTemplate"; "required": false; }; "format": { "alias": "format"; "required": false; }; "formatOptions": { "alias": "formatOptions"; "required": false; }; }, {}, never, never, true, never>;
246
254
  }
247
255
 
248
- type AXRowCommandItem = AXButtonItemListItem;
249
- type AXRowCommandItemClickEvent = AXButtonClickEvent;
256
+ type AXRowCommandItem = AXButtonItemListItem & {
257
+ commandId?: string;
258
+ look?: AXStyleLookType;
259
+ };
260
+ interface AXRowCommandItemClickEvent extends AXButtonClickEvent {
261
+ setLoading?: (loading: boolean) => void;
262
+ }
250
263
  declare abstract class AXBaseRowCommandColumnComponent extends AXDataTableColumnComponent {
251
264
  protected grid: AXBaseDataTable;
252
265
  protected cdr: ChangeDetectorRef;
266
+ protected commandLoading: i0.WritableSignal<string>;
267
+ private rowIdentityMap;
268
+ private rowIdentitySeq;
253
269
  allowSorting: boolean;
254
270
  get loadingEnabled(): boolean;
255
271
  get cssClass(): string;
272
+ protected resolveCommandId(rowData: unknown, commandName: string): string;
273
+ protected setCommandLoadingState(commandId: string, loading: boolean): void;
256
274
  onItemClick: EventEmitter<AXRowCommandItemClickEvent>;
257
275
  }
258
276
  /**
@@ -280,6 +298,10 @@ declare class AXRowDropdownCommandColumnComponent extends AXBaseRowCommandColumn
280
298
  */
281
299
  get renderHeaderTemplate(): TemplateRef<unknown>;
282
300
  footerTemplate: TemplateRef<unknown>;
301
+ emptyStateTemplate?: TemplateRef<unknown>;
302
+ emptyStateText: string;
303
+ protected itemsLoading: i0.WritableSignal<boolean>;
304
+ protected itemsFetched: i0.WritableSignal<boolean>;
283
305
  /**
284
306
  * @ignore
285
307
  */
@@ -298,6 +320,7 @@ declare class AXRowDropdownCommandColumnComponent extends AXBaseRowCommandColumn
298
320
  */
299
321
  protected _items: AXRowCommandItem[];
300
322
  items: AXRowCommandItem[] | ((rowData: unknown) => AXRowCommandItem[] | Promise<AXRowCommandItem[]>);
323
+ private dropdownLoadingEffect;
301
324
  /**
302
325
  * @ignore
303
326
  */
@@ -306,12 +329,14 @@ declare class AXRowDropdownCommandColumnComponent extends AXBaseRowCommandColumn
306
329
  * @ignore
307
330
  */
308
331
  protected handleOnClosed(): void;
332
+ private decorateItems;
333
+ private applyLoadingState;
309
334
  /**
310
335
  * @ignore
311
336
  */
312
337
  protected handleOnItemClick(e: AXItemClickEvent<AXButtonItemComponent>, data: unknown): void;
313
338
  static ɵfac: i0.ɵɵFactoryDeclaration<AXRowDropdownCommandColumnComponent, never>;
314
- static ɵcmp: i0.ɵɵComponentDeclaration<AXRowDropdownCommandColumnComponent, "ax-dropdown-command-column", never, { "width": { "alias": "width"; "required": false; }; "caption": { "alias": "caption"; "required": false; }; "fixed": { "alias": "fixed"; "required": false; }; "footerTemplate": { "alias": "footerTemplate"; "required": false; }; "items": { "alias": "items"; "required": false; }; }, { "onItemClick": "onItemClick"; }, never, never, true, never>;
339
+ static ɵcmp: i0.ɵɵComponentDeclaration<AXRowDropdownCommandColumnComponent, "ax-dropdown-command-column", never, { "width": { "alias": "width"; "required": false; }; "caption": { "alias": "caption"; "required": false; }; "fixed": { "alias": "fixed"; "required": false; }; "footerTemplate": { "alias": "footerTemplate"; "required": false; }; "emptyStateTemplate": { "alias": "emptyStateTemplate"; "required": false; }; "emptyStateText": { "alias": "emptyStateText"; "required": false; }; "items": { "alias": "items"; "required": false; }; }, { "onItemClick": "onItemClick"; }, never, never, true, never>;
315
340
  }
316
341
  /**
317
342
  * A column for displaying command buttons in a data table.
@@ -363,10 +388,15 @@ declare class AXRowCommandColumnComponent extends AXBaseRowCommandColumnComponen
363
388
  * @ignore
364
389
  */
365
390
  protected getItems(rowData: unknown): AXRowCommandItem[];
391
+ protected getItemsWithIds(rowData: unknown): Array<{
392
+ item: AXRowCommandItem;
393
+ commandId: string;
394
+ }>;
366
395
  /**
367
396
  * @ignore
368
397
  */
369
- protected handleOnItemClick(e: MouseEvent, item: AXRowCommandItem, data: unknown): void;
398
+ protected getCommandId(rowData: unknown, item: AXRowCommandItem): string;
399
+ protected handleOnItemClick(e: AXClickEvent, item: AXRowCommandItem, data: unknown): void;
370
400
  static ɵfac: i0.ɵɵFactoryDeclaration<AXRowCommandColumnComponent, never>;
371
401
  static ɵcmp: i0.ɵɵComponentDeclaration<AXRowCommandColumnComponent, "ax-command-column", never, { "width": { "alias": "width"; "required": false; }; "caption": { "alias": "caption"; "required": false; }; "fixed": { "alias": "fixed"; "required": false; }; "footerTemplate": { "alias": "footerTemplate"; "required": false; }; "items": { "alias": "items"; "required": false; }; }, { "onItemClick": "onItemClick"; }, never, never, true, never>;
372
402
  }
@@ -1096,6 +1126,14 @@ declare class AXDataTableComponent extends AXBaseDataTable implements OnInit, Af
1096
1126
  * @ignore
1097
1127
  */
1098
1128
  protected calculateRowIndex(index: number): number;
1129
+ /**
1130
+ * Handles double-click on resize handle to auto-fit column width.
1131
+ *
1132
+ * @param event - The mouse event from the double-click
1133
+ * @param columnIndex - The index of the column to auto-fit
1134
+ * @ignore
1135
+ */
1136
+ protected onResizeHandlerDoubleClick(event: MouseEvent, columnIndex: number): void;
1099
1137
  /**
1100
1138
  * @ignore
1101
1139
  */
@@ -1116,6 +1154,40 @@ declare class AXDataTableComponent extends AXBaseDataTable implements OnInit, Af
1116
1154
  * @ignore
1117
1155
  */
1118
1156
  private calculateStickyColumnsPositions;
1157
+ /**
1158
+ * Auto-fits columns that have width='auto'.
1159
+ * Called automatically after data load.
1160
+ *
1161
+ * @ignore
1162
+ */
1163
+ private autoFitColumnsWithAutoWidth;
1164
+ /**
1165
+ * Auto-fits all columns width based on their content.
1166
+ *
1167
+ * @param options - Configuration options
1168
+ * @param options.skipFixed - If true, skips fixed columns (default: true)
1169
+ * @param options.skipLoading - If true, skips if data is loading (default: true)
1170
+ * @param options.maxWidth - Maximum width for any column in pixels (default: 500)
1171
+ * @returns void
1172
+ */
1173
+ autoFitAllColumns(options?: {
1174
+ skipFixed?: boolean;
1175
+ skipLoading?: boolean;
1176
+ maxWidth?: number;
1177
+ }): void;
1178
+ /**
1179
+ * Auto-fits a column width based on its content.
1180
+ * Similar to Excel's "AutoFit Column Width" feature.
1181
+ * Uses an invisible helper table to measure actual content width without affecting the main table.
1182
+ *
1183
+ * @param columnIndex - The index of the column to auto-fit (0-based, based on columns QueryList)
1184
+ * @param options - Configuration options
1185
+ * @param options.maxWidth - Maximum width for the column in pixels (default: none)
1186
+ * @returns void
1187
+ */
1188
+ autoFitColumn(columnIndex: number, options?: {
1189
+ maxWidth?: number;
1190
+ }): void;
1119
1191
  static ɵfac: i0.ɵɵFactoryDeclaration<AXDataTableComponent, never>;
1120
1192
  static ɵcmp: i0.ɵɵComponentDeclaration<AXDataTableComponent, "ax-data-table", never, { "dataSource": { "alias": "dataSource"; "required": false; }; "selectedRows": { "alias": "selectedRows"; "required": false; }; "parentField": { "alias": "parentField"; "required": false; }; "rowTemplate": { "alias": "rowTemplate"; "required": false; }; "emptyTemplate": { "alias": "emptyTemplate"; "required": false; }; "noDataTemplate": { "alias": "noDataTemplate"; "required": false; }; "alternative": { "alias": "alternative"; "required": false; }; "showHeader": { "alias": "showHeader"; "required": false; }; "fixedHeader": { "alias": "fixedHeader"; "required": false; }; "showFooter": { "alias": "showFooter"; "required": false; }; "fixedFooter": { "alias": "fixedFooter"; "required": false; }; "itemHeight": { "alias": "itemHeight"; "required": false; }; "allowReordering": { "alias": "allowReordering"; "required": false; }; "paging": { "alias": "paging"; "required": false; }; "fetchDataMode": { "alias": "fetchDataMode"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "focusedRow": { "alias": "focusedRow"; "required": false; }; }, { "selectedRowsChange": "selectedRowsChange"; "focusedRowChange": "focusedRowChange"; "onRowClick": "onRowClick"; "onRowDbClick": "onRowDbClick"; "onColumnsOrderChanged": "onColumnsOrderChanged"; "onColumnSizeChanged": "onColumnSizeChanged"; "onPageChanged": "onPageChanged"; }, ["customDataPager", "columns"], ["ax-header", "ax-data-pager", "ax-footer"], true, never>;
1121
1193
  }
@@ -1,5 +1,6 @@
1
1
  import { MXInteractiveComponent, MXColorComponent, AXComponent, AXClosableComponent, MXButtonBaseComponent, AXRippleDirective, AXFocusableComponent } from '@acorex/cdk/common';
2
2
  import { AXDecoratorGenericComponent, AXDecoratorIconComponent } from '@acorex/components/decorators';
3
+ import { AXLoadingComponent } from '@acorex/components/loading';
3
4
  import * as i0 from '@angular/core';
4
5
  import { EventEmitter, HostBinding, HostListener, Output, Input, ChangeDetectionStrategy, ViewEncapsulation, Component, inject, input, afterNextRender, ContentChildren, computed, contentChild, model, NgModule } from '@angular/core';
5
6
  import * as i2 from '@acorex/core/translation';
@@ -7,7 +8,6 @@ import { AXTranslationModule } from '@acorex/core/translation';
7
8
  import * as i1 from '@angular/common';
8
9
  import { CommonModule } from '@angular/common';
9
10
  import { classes } from 'polytype';
10
- import { AXLoadingComponent } from '@acorex/components/loading';
11
11
 
12
12
  /**
13
13
  * Represents a button item with optional content like icons, text, and dropdowns.
@@ -187,6 +187,19 @@ class AXButtonItemListComponent extends MXInteractiveComponent {
187
187
  * @defaultValue []
188
188
  */
189
189
  this.items = input([], ...(ngDevMode ? [{ debugName: "items" }] : []));
190
+ /**
191
+ * Determines if the parent closable component should be closed automatically when
192
+ * an item is clicked.
193
+ *
194
+ * @defaultValue true
195
+ */
196
+ this.closeParentOnClick = input(true, ...(ngDevMode ? [{ debugName: "closeParentOnClick" }] : []));
197
+ /**
198
+ * Locks interaction for all items when any item is loading.
199
+ *
200
+ * @defaultValue false
201
+ */
202
+ this.lockOnLoading = input(false, ...(ngDevMode ? [{ debugName: "lockOnLoading" }] : []));
190
203
  /**
191
204
  * Emits an event when an item is clicked.
192
205
  * The event contains details about the clicked item.
@@ -201,6 +214,21 @@ class AXButtonItemListComponent extends MXInteractiveComponent {
201
214
  });
202
215
  });
203
216
  }
217
+ isDisabled(item) {
218
+ if (item.disabled) {
219
+ return true;
220
+ }
221
+ if (item.loading) {
222
+ return true;
223
+ }
224
+ if (this.lockOnLoading() && this.hasAnyLoadingItem()) {
225
+ return true;
226
+ }
227
+ return false;
228
+ }
229
+ hasAnyLoadingItem() {
230
+ return this.items().some((item) => !!item.loading);
231
+ }
204
232
  /**
205
233
  * Initializes the content of the button item list.
206
234
  * Binds events and properties to content button items and marks for change detection.
@@ -245,7 +273,9 @@ class AXButtonItemListComponent extends MXInteractiveComponent {
245
273
  * @ignore
246
274
  */
247
275
  _handleOnItemClick(e) {
248
- this.parent?.close();
276
+ if (this.closeParentOnClick()) {
277
+ this.parent?.close();
278
+ }
249
279
  this._emitOnItemClickEvent(e, e.component);
250
280
  }
251
281
  /**
@@ -265,6 +295,12 @@ class AXButtonItemListComponent extends MXInteractiveComponent {
265
295
  data: item.data,
266
296
  });
267
297
  }
298
+ /**
299
+ * Closes the parent closable component if available.
300
+ */
301
+ closeParent() {
302
+ this.parent?.close();
303
+ }
268
304
  /**
269
305
  * Generates the CSS classes for the button item list host element.
270
306
  * Includes classes for action list and vertical layout.
@@ -276,17 +312,19 @@ class AXButtonItemListComponent extends MXInteractiveComponent {
276
312
  return `ax-action-list ax-action-list-vertical`;
277
313
  }
278
314
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: AXButtonItemListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
279
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: AXButtonItemListComponent, isStandalone: true, selector: "ax-button-item-list", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onItemClick: "onItemClick" }, host: { properties: { "class": "this.__hostClass" } }, providers: [{ provide: AXComponent, useExisting: AXButtonItemListComponent }], queries: [{ propertyName: "_contentButtons", predicate: AXButtonItemComponent }], usesInheritance: true, ngImport: i0, template: `
315
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: AXButtonItemListComponent, isStandalone: true, selector: "ax-button-item-list", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, closeParentOnClick: { classPropertyName: "closeParentOnClick", publicName: "closeParentOnClick", isSignal: true, isRequired: false, transformFunction: null }, lockOnLoading: { classPropertyName: "lockOnLoading", publicName: "lockOnLoading", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onItemClick: "onItemClick" }, host: { properties: { "class": "this.__hostClass" } }, providers: [{ provide: AXComponent, useExisting: AXButtonItemListComponent }], queries: [{ propertyName: "_contentButtons", predicate: AXButtonItemComponent }], usesInheritance: true, ngImport: i0, template: `
280
316
  @for (item of items(); track item.name) {
281
317
  <ax-button-item
282
318
  [text]="item.text"
283
319
  [name]="item.name"
284
- [disabled]="item.disabled"
320
+ [disabled]="isDisabled(item)"
285
321
  [color]="item.color"
286
322
  [selected]="item.selected"
287
323
  (onClick)="_handleOnItemClick($event)"
288
324
  >
289
- @if (item.icon) {
325
+ @if (item.loading) {
326
+ <ax-loading class="ax-button-item-loading"></ax-loading>
327
+ } @else if (item.icon) {
290
328
  <ax-prefix>
291
329
  <ax-icon [icon]="item.icon"></ax-icon>
292
330
  </ax-prefix>
@@ -297,7 +335,7 @@ class AXButtonItemListComponent extends MXInteractiveComponent {
297
335
  }
298
336
  }
299
337
  <ng-content></ng-content>
300
- `, isInline: true, styles: ["ax-button-item-list.ax-action-list{padding-block:var(--ax-comp-button-item-list-padding-block, .25rem)}\n"], dependencies: [{ kind: "component", type: AXButtonItemComponent, selector: "ax-button-item", inputs: ["color", "disabled", "text", "selected", "divided", "data", "name"], outputs: ["onClick", "onFocus", "onBlur", "disabledChange"] }, { kind: "component", type: AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "component", type: AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
338
+ `, isInline: true, styles: ["ax-button-item-list.ax-action-list{padding-block:var(--ax-comp-button-item-list-padding-block, .25rem)}ax-button-item-list .ax-button-item-loading{display:inline-flex;align-items:center;justify-content:center;inline-size:1.5rem;block-size:1.5rem}\n"], dependencies: [{ kind: "component", type: AXButtonItemComponent, selector: "ax-button-item", inputs: ["color", "disabled", "text", "selected", "divided", "data", "name"], outputs: ["onClick", "onFocus", "onBlur", "disabledChange"] }, { kind: "component", type: AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "component", type: AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: AXLoadingComponent, selector: "ax-loading", inputs: ["visible", "type", "context"], outputs: ["visibleChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
301
339
  }
302
340
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: AXButtonItemListComponent, decorators: [{
303
341
  type: Component,
@@ -306,12 +344,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
306
344
  <ax-button-item
307
345
  [text]="item.text"
308
346
  [name]="item.name"
309
- [disabled]="item.disabled"
347
+ [disabled]="isDisabled(item)"
310
348
  [color]="item.color"
311
349
  [selected]="item.selected"
312
350
  (onClick)="_handleOnItemClick($event)"
313
351
  >
314
- @if (item.icon) {
352
+ @if (item.loading) {
353
+ <ax-loading class="ax-button-item-loading"></ax-loading>
354
+ } @else if (item.icon) {
315
355
  <ax-prefix>
316
356
  <ax-icon [icon]="item.icon"></ax-icon>
317
357
  </ax-prefix>
@@ -322,11 +362,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
322
362
  }
323
363
  }
324
364
  <ng-content></ng-content>
325
- `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [AXButtonItemComponent, AXDecoratorGenericComponent, AXDecoratorIconComponent], providers: [{ provide: AXComponent, useExisting: AXButtonItemListComponent }], styles: ["ax-button-item-list.ax-action-list{padding-block:var(--ax-comp-button-item-list-padding-block, .25rem)}\n"] }]
365
+ `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [AXButtonItemComponent, AXDecoratorGenericComponent, AXDecoratorIconComponent, AXLoadingComponent], providers: [{ provide: AXComponent, useExisting: AXButtonItemListComponent }], styles: ["ax-button-item-list.ax-action-list{padding-block:var(--ax-comp-button-item-list-padding-block, .25rem)}ax-button-item-list .ax-button-item-loading{display:inline-flex;align-items:center;justify-content:center;inline-size:1.5rem;block-size:1.5rem}\n"] }]
326
366
  }], ctorParameters: () => [], propDecorators: { _contentButtons: [{
327
367
  type: ContentChildren,
328
368
  args: [AXButtonItemComponent]
329
- }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], onItemClick: [{
369
+ }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], closeParentOnClick: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeParentOnClick", required: false }] }], lockOnLoading: [{ type: i0.Input, args: [{ isSignal: true, alias: "lockOnLoading", required: false }] }], onItemClick: [{
330
370
  type: Output
331
371
  }], __hostClass: [{
332
372
  type: HostBinding,