@messaia/cdk 17.1.4 → 17.1.5-rc02

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.
@@ -39,6 +39,7 @@ export { AuditUser } from './models/audit-user';
39
39
  export { BaseEntity } from './models/base-entity';
40
40
  export { IEntity } from './models/entity';
41
41
  export { EnumItem } from './models/enum-item';
42
+ export { Icon } from './models/icon';
42
43
  export { KeyValue } from './models/key-value';
43
44
  export { SaveAction } from './models/save-action';
44
45
  export { SuffixButton } from './models/suffix-button';
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Represents an icon configuration for a table column.
3
+ */
4
+ export declare class Icon<TEntity = any, TContext = any> {
5
+ /**
6
+ * Material icon name or function returning the icon dynamically.
7
+ */
8
+ matIcon?: ((x?: TEntity, ctx?: TContext) => any) | string;
9
+ /**
10
+ * SVG icon name or function returning the icon dynamically.
11
+ */
12
+ svgIcon?: ((x?: TEntity, ctx?: TContext) => any) | string;
13
+ /**
14
+ * Font icon name or function returning the icon dynamically.
15
+ */
16
+ fontIcon?: ((x?: TEntity, ctx?: TContext) => any) | string;
17
+ /**
18
+ * Font set name for font icon.
19
+ */
20
+ fontSet?: string;
21
+ /**
22
+ * CSS class name or function returning the class dynamically.
23
+ */
24
+ cssClass?: ((x?: TEntity, ctx?: TContext) => any) | string;
25
+ /**
26
+ * Function to dynamically hide the icon.
27
+ */
28
+ hide?: (x?: TEntity, ctx?: TContext, index?: number) => any;
29
+ /**
30
+ * Constructs a new instance of TableColumnIcon.
31
+ * @param init Optional configuration object to initialize properties.
32
+ */
33
+ constructor(init?: Partial<Icon<TEntity, TContext>>);
34
+ }
@@ -3,154 +3,172 @@ import { HttpClient } from '@angular/common/http';
3
3
  import { ChangeDetectorRef, ElementRef, EventEmitter, Injector, OnInit } from '@angular/core';
4
4
  import { FormGroupDirective, NgControl, NgForm } from '@angular/forms';
5
5
  import { ErrorStateMatcher } from '@angular/material/core';
6
+ import { Icon } from '../../common/models/icon';
6
7
  import { AbstractMatFormField } from '../../forms/helpers/abstract-mat-form-field';
7
8
  import * as i0 from "@angular/core";
8
9
  export declare abstract class AbstractSelectFormField<T> extends AbstractMatFormField<T> implements OnInit {
9
10
  protected injector: Injector;
10
11
  /**
11
- * Represents a value that changes over time.
12
+ * A BehaviorSubject that tracks changes to the endpoint data.
12
13
  */
13
14
  private _endpointChange;
14
15
  /**
15
- * Represents a value that changes over time.
16
+ * A BehaviorSubject that tracks changes to the enum data.
16
17
  */
17
18
  private _enumChange;
18
19
  /**
19
- * The http service from to get the data
20
+ * The HTTP client service used to fetch data from an API.
20
21
  */
21
22
  protected _http?: HttpClient;
22
23
  /**
23
- * Default select option
24
+ * Whether the default option should be selected by default.
24
25
  */
25
26
  protected _defaultOption: boolean;
26
27
  /**
27
- * Multiple select option
28
+ * Whether multiple selection is enabled.
28
29
  */
29
30
  protected _multiple: boolean;
30
31
  /**
31
- * Sorts options
32
+ * Whether the options should be sorted.
32
33
  */
33
34
  protected _sorted: boolean;
34
35
  /**
35
- * _endpoint: string
36
+ * The API endpoint or a function returning the endpoint URL.
36
37
  */
37
38
  protected _endpoint?: string | Function;
38
39
  /**
39
- * _params: any
40
+ * Parameters to be sent with the API request.
40
41
  */
41
42
  protected _params: any;
42
43
  /**
43
- * _projection: any
44
+ * Projection fields to be included in the API request.
44
45
  */
45
46
  protected _projection?: string | string[];
46
47
  /**
47
- * Load data
48
+ * Whether to load data automatically.
48
49
  */
49
50
  protected _loadData: boolean;
50
51
  /**
51
- * _enumFilter: Function
52
+ * A filter function to apply to the enum data.
52
53
  */
53
54
  protected _enumFilter?: Function;
54
55
  /**
55
- * A function to compare the option values with the selected values.
56
+ * A function to compare option values with the selected values.
56
57
  */
57
58
  private _compareWith;
58
59
  /**
59
- * The name of the endpoint
60
+ * The enumeration data or endpoint for the options.
60
61
  */
61
62
  enum: any;
62
63
  /**
63
- * textPrefix?: any
64
+ * Optional prefix text to display.
64
65
  */
65
66
  textPrefix: string;
66
67
  /**
67
- * The key
68
+ * The property name in the option object for the text to display.
69
+ * This is used to determine which property of the option object to show as the option's text.
68
70
  */
69
- key: any;
71
+ optionTextProperty: string;
70
72
  /**
71
- * The text
73
+ * The property name in the option object for the value of the options.
74
+ * This is used to identify the unique value for each option.
72
75
  */
73
- text: any;
76
+ optionValueProperty: string;
74
77
  /**
75
- * The prefix
78
+ * The key for the Material icon to display.
79
+ */
80
+ matIconKey?: string;
81
+ /**
82
+ * The key for the SVG icon to display.
83
+ */
84
+ svgIconKey?: string;
85
+ /**
86
+ * Font set name for font icon.
87
+ */
88
+ fontSet?: string;
89
+ /**
90
+ * Optional prefix to display before the options.
76
91
  */
77
92
  prefix: any;
78
93
  /**
79
- * Option list
94
+ * The list of available options.
80
95
  */
81
96
  options: any;
82
97
  /**
83
- * filtered option list
98
+ * The list of filtered options.
84
99
  */
85
100
  filteredOptions: any;
86
101
  /**
87
- * filterable?
102
+ * Whether the options can be filtered.
88
103
  */
89
104
  filterable: boolean;
90
105
  /**
91
- * cache?
106
+ * Whether to cache the options.
92
107
  */
93
108
  cache: boolean;
94
109
  /**
95
- * selectFirst?
110
+ * Whether to select the first option by default.
96
111
  */
97
112
  selectFirst: boolean;
98
113
  /**
99
- * sortBy?
114
+ * The field by which to sort the options.
100
115
  */
101
116
  sortBy?: string;
102
117
  /**
103
- * mapper: Function
118
+ * A function to map the options before displaying.
104
119
  */
105
120
  mapper?: (x: any[]) => any;
106
121
  /**
107
- * @property
122
+ * A function to return the icon for a given option.
123
+ */
124
+ optionIcon?: (x: any) => Icon<T, any>;
125
+ /**
126
+ * Whether the default option should be selected.
108
127
  */
109
128
  get defaultOption(): boolean;
110
129
  set defaultOption(defaultOption: boolean);
111
130
  /**
112
- * @property
131
+ * Whether multiple selection is enabled.
113
132
  */
114
133
  get multiple(): boolean;
115
134
  set multiple(multi: boolean);
116
135
  /**
117
- * @property
136
+ * Whether the options should be sorted.
118
137
  */
119
138
  get sorted(): boolean;
120
139
  set sorted(sorted: boolean);
121
140
  /**
122
- * @property
141
+ * The API endpoint or a function returning the endpoint URL.
123
142
  */
124
143
  get endpoint(): string | Function | undefined;
125
144
  set endpoint(endpoint: string | Function);
126
145
  /**
127
- * @property
146
+ * Parameters to be sent with the API request.
128
147
  */
129
148
  get params(): any;
130
149
  set params(params: any);
131
150
  /**
132
- * @property
151
+ * Projection fields to be included in the API request.
133
152
  */
134
153
  get projection(): string | string[];
135
154
  set projection(projection: string | string[] | undefined);
136
155
  /**
137
- * @property
156
+ * Whether to load data automatically.
138
157
  */
139
158
  get loadData(): boolean;
140
159
  set loadData(loadData: boolean);
141
160
  /**
142
- * @property
161
+ * A filter function to apply to the enum data.
143
162
  */
144
163
  get enumFilter(): Function | undefined;
145
164
  set enumFilter(enumFilter: Function);
146
165
  /**
147
- * Gets the control is disabled.
148
- * @param disabled
166
+ * Whether the control is disabled.
149
167
  */
150
168
  get disabled(): any;
151
169
  set disabled(disabled: any);
152
170
  /**
153
- * Gets current value
171
+ * Gets the currently selected value(s).
154
172
  */
155
173
  get currentValue(): any;
156
174
  /**
@@ -234,6 +252,12 @@ export declare abstract class AbstractSelectFormField<T> extends AbstractMatForm
234
252
  * Trigger enum changed
235
253
  */
236
254
  protected enumChanged(): void;
255
+ /**
256
+ * Log to console
257
+ * @param message
258
+ * @param optionalParams
259
+ */
260
+ log(message: any, ...optionalParams: any[]): void;
237
261
  static ɵfac: i0.ɵɵFactoryDeclaration<AbstractSelectFormField<any>, never>;
238
- static ɵdir: i0.ɵɵDirectiveDeclaration<AbstractSelectFormField<any>, never, never, { "enum": { "alias": "enum"; "required": false; }; "textPrefix": { "alias": "textPrefix"; "required": false; }; "key": { "alias": "key"; "required": false; }; "text": { "alias": "text"; "required": false; }; "prefix": { "alias": "prefix"; "required": false; }; "options": { "alias": "options"; "required": false; }; "filteredOptions": { "alias": "filteredOptions"; "required": false; }; "filterable": { "alias": "filterable"; "required": false; }; "cache": { "alias": "cache"; "required": false; }; "selectFirst": { "alias": "selectFirst"; "required": false; }; "sortBy": { "alias": "sortBy"; "required": false; }; "mapper": { "alias": "mapper"; "required": false; }; "defaultOption": { "alias": "defaultOption"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "sorted": { "alias": "sorted"; "required": false; }; "endpoint": { "alias": "endpoint"; "required": false; }; "params": { "alias": "params"; "required": false; }; "projection": { "alias": "projection"; "required": false; }; "loadData": { "alias": "loadData"; "required": false; }; "enumFilter": { "alias": "enumFilter"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "compareWith": { "alias": "compareWith"; "required": false; }; "searchField": { "alias": "searchField"; "required": false; }; }, { "onValueChange": "change"; "onItemChange": "itemChange"; "onSelected": "selected"; "onItemSelected": "itemSelected"; "onLaunch": "launch"; }, never, never, false, never>;
262
+ static ɵdir: i0.ɵɵDirectiveDeclaration<AbstractSelectFormField<any>, never, never, { "enum": { "alias": "enum"; "required": false; }; "textPrefix": { "alias": "textPrefix"; "required": false; }; "optionTextProperty": { "alias": "optionTextProperty"; "required": false; }; "optionValueProperty": { "alias": "optionValueProperty"; "required": false; }; "matIconKey": { "alias": "matIconKey"; "required": false; }; "svgIconKey": { "alias": "svgIconKey"; "required": false; }; "fontSet": { "alias": "fontSet"; "required": false; }; "prefix": { "alias": "prefix"; "required": false; }; "options": { "alias": "options"; "required": false; }; "filteredOptions": { "alias": "filteredOptions"; "required": false; }; "filterable": { "alias": "filterable"; "required": false; }; "cache": { "alias": "cache"; "required": false; }; "selectFirst": { "alias": "selectFirst"; "required": false; }; "sortBy": { "alias": "sortBy"; "required": false; }; "mapper": { "alias": "mapper"; "required": false; }; "defaultOption": { "alias": "defaultOption"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "sorted": { "alias": "sorted"; "required": false; }; "endpoint": { "alias": "endpoint"; "required": false; }; "params": { "alias": "params"; "required": false; }; "projection": { "alias": "projection"; "required": false; }; "loadData": { "alias": "loadData"; "required": false; }; "enumFilter": { "alias": "enumFilter"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "compareWith": { "alias": "compareWith"; "required": false; }; "searchField": { "alias": "searchField"; "required": false; }; }, { "onValueChange": "change"; "onItemChange": "itemChange"; "onSelected": "selected"; "onItemSelected": "itemSelected"; "onLaunch": "launch"; }, never, never, false, never>;
239
263
  }
@@ -258,15 +258,30 @@ export declare class FormFieldDefinition<TEntity = any, TProperty = any> {
258
258
  */
259
259
  optionTemplate?: (x: TProperty, y?: TEntity, f?: FormGroup, ctx?: IGenericFormBaseComponent<TEntity>) => any;
260
260
  /**
261
- * Text to display in options.
262
- * @property
261
+ * The property name in the option object for the text to display.
262
+ * This is used to determine which property of the option object to show as the option's text.
263
263
  */
264
- optionText: string;
264
+ optionTextProperty: string;
265
265
  /**
266
- * Value of options.
267
- * @property
266
+ * The property name in the option object for the value of the options.
267
+ * This is used to identify the unique value for each option.
268
+ */
269
+ optionValueProperty: string;
270
+ /**
271
+ * The property name in the option object for the Material icon.
272
+ * This can be used to display a Material icon in the options list.
273
+ */
274
+ optionMatIconProperty?: string;
275
+ /**
276
+ * The property name in the option object for the SVG icon.
277
+ * This can be used to display an SVG icon in the options list.
278
+ */
279
+ optionSvgIconProperty?: string;
280
+ /**
281
+ * The font set to be used for the icons in the options.
282
+ * This specifies a custom font set for the icons displayed in the options list.
268
283
  */
269
- optionValue: string;
284
+ optionIconFontSet?: string;
270
285
  /**
271
286
  * Parameters for data retrieval.
272
287
  * @property
@@ -1,7 +1,7 @@
1
1
  import { FocusMonitor } from '@angular/cdk/a11y';
2
2
  import { AfterViewInit, ChangeDetectorRef, ElementRef, Injector } from '@angular/core';
3
3
  import { FormGroupDirective, NgControl, NgForm } from '@angular/forms';
4
- import { ErrorStateMatcher, MatOption } from '@angular/material/core';
4
+ import { ErrorStateMatcher } from '@angular/material/core';
5
5
  import { MatSelect } from '@angular/material/select';
6
6
  import { AbstractSelectFormField } from '../../forms/helpers/abstract-select-form-field.component';
7
7
  import { VdSelectOptionDirective } from '../directives/vd-select-option.directive';
@@ -10,84 +10,100 @@ import * as i0 from "@angular/core";
10
10
  export declare class VdSelectComponent extends AbstractSelectFormField<any> implements AfterViewInit {
11
11
  protected injector: Injector;
12
12
  /**
13
- * Trigger css class
13
+ * CSS class applied to the trigger element.
14
14
  */
15
15
  protected _triggerCssClass?: string;
16
16
  /**
17
- * Trigger mode
17
+ * Mode of the trigger, default is 'chip'.
18
18
  */
19
19
  protected _triggerMode: string;
20
20
  /**
21
- * Option template
21
+ * Template for rendering options.
22
22
  */
23
23
  optionTemplate?: VdSelectOptionDirective;
24
24
  /**
25
- * Trigger template
25
+ * Template for rendering the trigger.
26
26
  */
27
27
  triggerTemplate?: VdSelectTriggerDirective;
28
28
  /**
29
- * The select element.
29
+ * Reference to the MatSelect element.
30
30
  */
31
31
  selectEl?: MatSelect;
32
32
  /**
33
- * The select element.
33
+ * Reference to the filter input element.
34
34
  */
35
35
  filterInput?: ElementRef;
36
36
  /**
37
- * Trigger css class
37
+ * CSS class applied to the trigger element.
38
38
  */
39
39
  get triggerCssClass(): string | undefined;
40
40
  set triggerCssClass(triggerCssClass: string | undefined);
41
41
  /**
42
- * Trigger mode
42
+ * Mode of the trigger, default is 'chip'.
43
43
  */
44
44
  get triggerMode(): string;
45
45
  set triggerMode(triggerMode: string);
46
46
  /**
47
- * Whether the select has a value.
47
+ * Gets the display values of the selected options for the trigger.
48
+ *
49
+ * @returns The display values of the selected options
50
+ */
51
+ get triggerValues(): any[];
52
+ /**
53
+ * Retrieves the currently selected options from the filtered options.
54
+ * If multiple options are selected, returns them as an array.
55
+ * If a single option is selected, returns it as an array with one element.
56
+ *
57
+ * @returns An array of selected items from the filtered options.
58
+ */
59
+ get selectedOptions(): any[];
60
+ /**
61
+ * Checks if the select element is empty.
62
+ *
63
+ * @returns true if the select element is empty, false otherwise.
48
64
  */
49
65
  get empty(): boolean;
50
66
  /**
51
- * Constructor
52
- * @param ngControl
53
- * @param parentForm
54
- * @param parentFormGroup
55
- * @param defaultErrorStateMatcher
56
- * @param focusMonitor
57
- * @param elementRef
67
+ * Constructor to initialize the VdSelectComponent.
68
+ *
69
+ * @param injector Dependency injector
70
+ * @param ngControl Angular form control directive
71
+ * @param parentForm Parent form
72
+ * @param parentFormGroup Parent form group
73
+ * @param defaultErrorStateMatcher Default error state matcher
74
+ * @param focusMonitor Focus monitor for managing focus state
75
+ * @param elementRef Reference to the component element
76
+ * @param changeDetectorRef Change detector reference
58
77
  */
59
78
  constructor(injector: Injector, ngControl: NgControl, parentForm: NgForm, parentFormGroup: FormGroupDirective, defaultErrorStateMatcher: ErrorStateMatcher, focusMonitor: FocusMonitor, elementRef: ElementRef, changeDetectorRef: ChangeDetectorRef);
60
79
  /**
61
- * A callback method that is invoked immediately after
62
- * Angular has completed initialization of a component's view.
63
- * It is invoked only once when the view is instantiated.
80
+ * Lifecycle hook that is called after Angular has initialized the component's view.
81
+ * Sets up an event listener to focus the filter input when the select element is opened.
64
82
  */
65
83
  ngAfterViewInit(): void;
66
84
  /**
67
- * From ControlValueAccessor interface
68
- * @param value
85
+ * Writes the value to the component. Part of the ControlValueAccessor interface.
86
+ *
87
+ * @param value The value to be written
69
88
  */
70
89
  writeValue(value: any): void;
71
90
  /**
72
- * Sets control focus
91
+ * Sets focus on the select element and opens the dropdown.
73
92
  */
74
93
  focus(): void;
75
94
  /**
76
- * Handles launch button click
77
- * @param value
95
+ * Handles the launch button click event.
96
+ * Emits the selected options through the onLaunch event emitter.
97
+ *
98
+ * @param value The value to be emitted
78
99
  */
79
100
  handleLaunchClicked(value: any): void;
80
101
  /**
81
- * Handels filter event
82
- * @param $event
102
+ * Handles the filter event to filter the options based on the input.
103
+ *
104
+ * @param $event The filter event
83
105
  */
84
106
  handleFilter($event?: Event): void;
85
- /**
86
- * Gets the values of the selected options for the trigger
87
- * @param options
88
- * @returns
89
- */
90
- getTriggerValues(options: MatOption | MatOption[]): any;
91
107
  static ɵfac: i0.ɵɵFactoryDeclaration<VdSelectComponent, [null, { optional: true; self: true; }, { optional: true; }, { optional: true; }, null, null, null, null]>;
92
108
  static ɵcmp: i0.ɵɵComponentDeclaration<VdSelectComponent, "vd-select", never, { "triggerCssClass": { "alias": "triggerCssClass"; "required": false; }; "triggerMode": { "alias": "triggerMode"; "required": false; }; }, {}, ["optionTemplate", "triggerTemplate"], never, false, never>;
93
109
  }
@@ -10,5 +10,6 @@ export declare enum TableColumnType {
10
10
  Date = 8,
11
11
  Action = 9,
12
12
  Menu = 10,
13
- IconButton = 11
13
+ Icon = 11,
14
+ IconButton = 12
14
15
  }
@@ -1,6 +1,7 @@
1
1
  import { FormGroup } from "@angular/forms";
2
2
  import { IGenericListComponent } from "../../base/interfaces/igeneric-list-component";
3
3
  import { ActionItem } from "../../common/models/action-item";
4
+ import { Icon } from "../../common/models/icon";
4
5
  import { FilterOperator } from "../enums/filter-operator";
5
6
  import { Grid } from "../enums/grid";
6
7
  import { TableColumnType } from "../enums/table-column-type";
@@ -120,6 +121,11 @@ export declare class TableColumn<TEntity = any> {
120
121
  * @property
121
122
  */
122
123
  iconButton?: ActionItem<TEntity, IGenericListComponent<TEntity>>;
124
+ /**
125
+ * Icon configuration for the column.
126
+ * @property
127
+ */
128
+ icon?: Icon<TEntity, IGenericListComponent<TEntity>>;
123
129
  /**
124
130
  * The index of the column.
125
131
  * @property
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@messaia/cdk",
3
- "version": "17.1.4",
3
+ "version": "17.1.5-rc02",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^17.3.5",
6
6
  "@angular/core": "^17.3.5"