ngx-material-entity 20.0.3 → 20.0.5

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/index.d.ts CHANGED
@@ -10,6 +10,7 @@ import { DateFilterFn } from '@angular/material/datepicker';
10
10
  import { NgModel, Validator, AbstractControl, ValidationErrors } from '@angular/forms';
11
11
  import { SelectionModel } from '@angular/cdk/collections';
12
12
  import { MatTableDataSource } from '@angular/material/table';
13
+ import { MatTabChangeEvent } from '@angular/material/tabs';
13
14
 
14
15
  /**
15
16
  * A generic EntityService class.
@@ -1240,6 +1241,7 @@ interface DateTimeDateDecoratorConfig extends DateDecoratorConfig<Date> {
1240
1241
  }
1241
1242
 
1242
1243
  type StringDropdownValues = DropdownValue<string | undefined>[] | ((entity: any) => DropdownValue<string | undefined>[]) | ((entity: any) => Promise<DropdownValue<string | undefined>[]>);
1244
+ type RequiredStringDropdownValues = DropdownValue<string>[] | ((entity: any) => DropdownValue<string>[]) | ((entity: any) => Promise<DropdownValue<string>[]>);
1243
1245
  type StringAutocompleteValues = string[] | ((entity: any) => string[]) | ((entity: any) => Promise<string[]>);
1244
1246
  /**
1245
1247
  * Definition for the @string metadata.
@@ -1593,6 +1595,17 @@ interface AutocompleteStringChipsArrayDecoratorConfig extends ArrayDecoratorConf
1593
1595
  */
1594
1596
  restrictToOptions?: boolean;
1595
1597
  }
1598
+ /**
1599
+ * Definition for an array of strings displayed in a dropdown.
1600
+ */
1601
+ interface StringDropdownArrayDecoratorConfig extends ArrayDecoratorConfig<string[]> {
1602
+ itemType: DecoratorTypes.STRING_DROPDOWN;
1603
+ /**
1604
+ * The values of the dropdown, consisting of a name to display and the actual value
1605
+ * Can also receive a function to determine the values.
1606
+ */
1607
+ dropdownValues: RequiredStringDropdownValues;
1608
+ }
1596
1609
 
1597
1610
  /**
1598
1611
  * The internal Position. Sets default values and validates user input.
@@ -1751,6 +1764,14 @@ declare class AutocompleteStringChipsArrayDecoratorConfigInternal extends Proper
1751
1764
  constructor(data: AutocompleteStringChipsArrayDecoratorConfig, globalConfig: NgxGlobalDefaultValues);
1752
1765
  private autocompleteValuesToFunction;
1753
1766
  }
1767
+ /**
1768
+ * The internal StringDropdownArrayDecoratorConfig. Sets default values.
1769
+ */
1770
+ declare class StringDropdownArrayDecoratorConfigInternal extends PropertyDecoratorConfigInternal<string[]> implements StringDropdownArrayDecoratorConfig {
1771
+ itemType: DecoratorTypes.STRING_DROPDOWN;
1772
+ dropdownValues: (entity: any) => Promise<DropdownValue<string>[]>;
1773
+ constructor(data: StringDropdownArrayDecoratorConfig);
1774
+ }
1754
1775
 
1755
1776
  /**
1756
1777
  * The Definition for the @boolean metadata.
@@ -2628,6 +2649,7 @@ declare enum DecoratorTypes {
2628
2649
  ARRAY_DATE_RANGE = "arrayDateRange",
2629
2650
  ARRAY_STRING_CHIPS = "arrayStringChips",
2630
2651
  ARRAY_STRING_AUTOCOMPLETE_CHIPS = "arrayStringAutocompleteChips",
2652
+ ARRAY_STRING_DROPDOWN = "arrayStringDropdown",
2631
2653
  DATE = "date",
2632
2654
  DATE_RANGE = "dateRange",
2633
2655
  DATE_TIME = "dateTime",
@@ -2641,7 +2663,7 @@ declare enum DecoratorTypes {
2641
2663
  /**
2642
2664
  * Gives the metadata-config Type based on the DecoratorTypes enum.
2643
2665
  */
2644
- type DecoratorType<T, CustomMetadataType extends Record<string, unknown>> = T extends DecoratorTypes.STRING ? DefaultStringDecoratorConfigInternal : T extends DecoratorTypes.STRING_TEXTBOX ? TextboxStringDecoratorConfigInternal : T extends DecoratorTypes.STRING_DROPDOWN ? DropdownStringDecoratorConfigInternal : T extends DecoratorTypes.STRING_AUTOCOMPLETE ? AutocompleteStringDecoratorConfigInternal : T extends DecoratorTypes.STRING_PASSWORD ? PasswordStringDecoratorConfigInternal : T extends DecoratorTypes.NUMBER ? DefaultNumberDecoratorConfigInternal : T extends DecoratorTypes.NUMBER_DROPDOWN ? DropdownNumberDecoratorConfigInternal : T extends DecoratorTypes.NUMBER_SLIDER ? SliderNumberDecoratorConfigInternal : T extends DecoratorTypes.BOOLEAN_CHECKBOX ? CheckboxBooleanDecoratorConfigInternal : T extends DecoratorTypes.BOOLEAN_TOGGLE ? ToggleBooleanDecoratorConfigInternal : T extends DecoratorTypes.BOOLEAN_DROPDOWN ? DropdownBooleanDecoratorConfigInternal : T extends DecoratorTypes.OBJECT ? DefaultObjectDecoratorConfigInternal<any> : T extends DecoratorTypes.OBJECT_DROPDOWN ? DropdownObjectDecoratorConfigInternal<any> : T extends DecoratorTypes.ARRAY ? EntityArrayDecoratorConfigInternal<any> : T extends DecoratorTypes.ARRAY_DATE ? DateArrayDecoratorConfigInternal : T extends DecoratorTypes.ARRAY_DATE_TIME ? DateTimeArrayDecoratorConfigInternal : T extends DecoratorTypes.ARRAY_DATE_RANGE ? DateRangeArrayDecoratorConfigInternal : T extends DecoratorTypes.ARRAY_STRING_CHIPS ? StringChipsArrayDecoratorConfigInternal : T extends DecoratorTypes.ARRAY_STRING_AUTOCOMPLETE_CHIPS ? AutocompleteStringChipsArrayDecoratorConfigInternal : T extends DecoratorTypes.DATE ? DefaultDateDecoratorConfigInternal : T extends DecoratorTypes.DATE_RANGE ? DateRangeDateDecoratorConfigInternal : T extends DecoratorTypes.DATE_TIME ? DateTimeDateDecoratorConfigInternal : T extends DecoratorTypes.FILE_DEFAULT ? DefaultFileDecoratorConfigInternal : T extends DecoratorTypes.FILE_IMAGE ? ImageFileDecoratorConfigInternal : T extends DecoratorTypes.REFERENCES_MANY ? ReferencesManyDecoratorConfigInternal<any> : T extends DecoratorTypes.REFERENCES_ONE ? ReferencesOneDecoratorConfigInternal<any> : T extends DecoratorTypes.HAS_MANY ? HasManyDecoratorConfigInternal<any, any> : T extends DecoratorTypes.CUSTOM ? CustomDecoratorConfigInternal<any, any, CustomMetadataType, any> : never;
2666
+ type DecoratorType<T, CustomMetadataType extends Record<string, unknown>> = T extends DecoratorTypes.STRING ? DefaultStringDecoratorConfigInternal : T extends DecoratorTypes.STRING_TEXTBOX ? TextboxStringDecoratorConfigInternal : T extends DecoratorTypes.STRING_DROPDOWN ? DropdownStringDecoratorConfigInternal : T extends DecoratorTypes.STRING_AUTOCOMPLETE ? AutocompleteStringDecoratorConfigInternal : T extends DecoratorTypes.STRING_PASSWORD ? PasswordStringDecoratorConfigInternal : T extends DecoratorTypes.NUMBER ? DefaultNumberDecoratorConfigInternal : T extends DecoratorTypes.NUMBER_DROPDOWN ? DropdownNumberDecoratorConfigInternal : T extends DecoratorTypes.NUMBER_SLIDER ? SliderNumberDecoratorConfigInternal : T extends DecoratorTypes.BOOLEAN_CHECKBOX ? CheckboxBooleanDecoratorConfigInternal : T extends DecoratorTypes.BOOLEAN_TOGGLE ? ToggleBooleanDecoratorConfigInternal : T extends DecoratorTypes.BOOLEAN_DROPDOWN ? DropdownBooleanDecoratorConfigInternal : T extends DecoratorTypes.OBJECT ? DefaultObjectDecoratorConfigInternal<any> : T extends DecoratorTypes.OBJECT_DROPDOWN ? DropdownObjectDecoratorConfigInternal<any> : T extends DecoratorTypes.ARRAY ? EntityArrayDecoratorConfigInternal<any> : T extends DecoratorTypes.ARRAY_DATE ? DateArrayDecoratorConfigInternal : T extends DecoratorTypes.ARRAY_DATE_TIME ? DateTimeArrayDecoratorConfigInternal : T extends DecoratorTypes.ARRAY_DATE_RANGE ? DateRangeArrayDecoratorConfigInternal : T extends DecoratorTypes.ARRAY_STRING_CHIPS ? StringChipsArrayDecoratorConfigInternal : T extends DecoratorTypes.ARRAY_STRING_AUTOCOMPLETE_CHIPS ? AutocompleteStringChipsArrayDecoratorConfigInternal : T extends DecoratorTypes.ARRAY_STRING_DROPDOWN ? StringDropdownArrayDecoratorConfigInternal : T extends DecoratorTypes.DATE ? DefaultDateDecoratorConfigInternal : T extends DecoratorTypes.DATE_RANGE ? DateRangeDateDecoratorConfigInternal : T extends DecoratorTypes.DATE_TIME ? DateTimeDateDecoratorConfigInternal : T extends DecoratorTypes.FILE_DEFAULT ? DefaultFileDecoratorConfigInternal : T extends DecoratorTypes.FILE_IMAGE ? ImageFileDecoratorConfigInternal : T extends DecoratorTypes.REFERENCES_MANY ? ReferencesManyDecoratorConfigInternal<any> : T extends DecoratorTypes.REFERENCES_ONE ? ReferencesOneDecoratorConfigInternal<any> : T extends DecoratorTypes.HAS_MANY ? HasManyDecoratorConfigInternal<any, any> : T extends DecoratorTypes.CUSTOM ? CustomDecoratorConfigInternal<any, any, CustomMetadataType, any> : never;
2645
2667
 
2646
2668
  /**
2647
2669
  * Shows information about differences between two entities.
@@ -2651,6 +2673,10 @@ interface Difference<EntityType extends BaseEntityType<EntityType>> {
2651
2673
  * The key where the two entities have different values.
2652
2674
  */
2653
2675
  key: keyof EntityType;
2676
+ /**
2677
+ * The display name resolved from metadata.
2678
+ */
2679
+ name: string | undefined;
2654
2680
  /**
2655
2681
  * The value before any changes.
2656
2682
  */
@@ -2920,6 +2946,7 @@ declare abstract class ValidationUtilities {
2920
2946
  */
2921
2947
  static getPropertyValidationError<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, key: keyof EntityType, omit?: 'create' | 'update'): Promise<ValidationError | undefined>;
2922
2948
  private static getArrayStringAutocompleteChipsValidationError;
2949
+ private static getArrayStringDropdownValidationError;
2923
2950
  private static getBooleanValidationError;
2924
2951
  private static getStringValidationError;
2925
2952
  private static getAutocompleteStringValidationError;
@@ -4230,6 +4257,66 @@ declare class NgxMatEntityTableComponent<EntityType extends BaseEntityType<Entit
4230
4257
  static ɵcmp: i0.ɵɵComponentDeclaration<NgxMatEntityTableComponent<any>, "ngx-mat-entity-table", never, { "tableData": { "alias": "tableData"; "required": true; }; }, { "unsavedDialogChanges": "unsavedDialogChanges"; }, never, never, true, never>;
4231
4258
  }
4232
4259
 
4260
+ /**
4261
+ * A form component based on the ngx-material-entity framework.
4262
+ */
4263
+ declare class NgxMatEntityFormComponent<EntityType extends BaseEntityType<EntityType>> implements OnInit {
4264
+ private readonly injector;
4265
+ EntityUtilities: typeof EntityUtilities;
4266
+ /**
4267
+ * The entity that should be represented by the form.
4268
+ */
4269
+ entity: EntityType;
4270
+ /**
4271
+ * The tabs to display.
4272
+ */
4273
+ entityTabs: EntityTab<EntityType>[];
4274
+ /**
4275
+ * Whether or not the entity is readonly.
4276
+ * @default false
4277
+ */
4278
+ isEntityReadOnly: boolean;
4279
+ /**
4280
+ * Whether to hide a value if it is omitted for creation.
4281
+ * Is used internally for the object property.
4282
+ * @default false
4283
+ */
4284
+ hideOmitForCreate?: boolean;
4285
+ /**
4286
+ * Whether to hide a value if it is omitted for editing.
4287
+ * Is used internally for the object property.
4288
+ * @default false
4289
+ */
4290
+ hideOmitForEdit?: boolean;
4291
+ /**
4292
+ * Additional keys that should be omitted.
4293
+ */
4294
+ additionalOmitKeys?: (keyof EntityType)[];
4295
+ /**
4296
+ * Fires whenever an input of the form changes.
4297
+ */
4298
+ readonly formChange: EventEmitter<void>;
4299
+ /**
4300
+ * Fires when the selected tab has been changed.
4301
+ */
4302
+ readonly selectedTabChange: EventEmitter<MatTabChangeEvent>;
4303
+ constructor(injector: EnvironmentInjector);
4304
+ ngOnInit(): void;
4305
+ /**
4306
+ * Checks if the input with the given key is readonly.
4307
+ * @param key - The key for the input to check.
4308
+ * @returns Whether or not the input for the key is read only.
4309
+ */
4310
+ isReadOnly(key: keyof EntityType): boolean;
4311
+ /**
4312
+ * What happens when an input changes its value.
4313
+ * This refreshes the entity tabs to check if there are now different inputs to display and emits the form change.
4314
+ */
4315
+ inputChange(): void;
4316
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxMatEntityFormComponent<any>, never>;
4317
+ static ɵcmp: i0.ɵɵComponentDeclaration<NgxMatEntityFormComponent<any>, "ngx-mat-entity-form", never, { "entity": { "alias": "entity"; "required": true; }; "isEntityReadOnly": { "alias": "isEntityReadOnly"; "required": false; }; "hideOmitForCreate": { "alias": "hideOmitForCreate"; "required": false; }; "hideOmitForEdit": { "alias": "hideOmitForEdit"; "required": false; }; "additionalOmitKeys": { "alias": "additionalOmitKeys"; "required": false; }; }, { "formChange": "formChange"; "selectedTabChange": "selectedTabChange"; }, never, never, true, never>;
4318
+ }
4319
+
4233
4320
  /**
4234
4321
  * A component that displays an info-symbol and a tooltip when it is hovered/clicked.
4235
4322
  */
@@ -4249,7 +4336,7 @@ declare class TooltipComponent {
4249
4336
  * @returns The method that defines the metadata.
4250
4337
  * @throws When the given type of the array-items is unknown.
4251
4338
  */
4252
- declare function array<EntityType extends BaseEntityType<EntityType>>(metadata: EntityArrayDecoratorConfig<EntityType> | StringChipsArrayDecoratorConfig | AutocompleteStringChipsArrayDecoratorConfig | DateArrayDecoratorConfig | DateTimeArrayDecoratorConfig | DateRangeArrayDecoratorConfig): (target: object, propertyKey: string) => void;
4339
+ declare function array<EntityType extends BaseEntityType<EntityType>>(metadata: EntityArrayDecoratorConfig<EntityType> | StringChipsArrayDecoratorConfig | AutocompleteStringChipsArrayDecoratorConfig | StringDropdownArrayDecoratorConfig | DateArrayDecoratorConfig | DateTimeArrayDecoratorConfig | DateRangeArrayDecoratorConfig): (target: object, propertyKey: string) => void;
4253
4340
 
4254
4341
  /**
4255
4342
  * Decorator for setting and getting boolean property metadata.
@@ -4506,5 +4593,5 @@ declare abstract class FileUtilities {
4506
4593
  private static transformToBytes;
4507
4594
  }
4508
4595
 
4509
- export { ArrayDecoratorConfig, DateUtilities, DecoratorTypes, DynamicStyleClassDirective, Entity, EntityService, EntityUtilities, FileUtilities, IncludedInValidatorDirective, NGX_COMPLETE_GLOBAL_DEFAULT_VALUES, NGX_CREATE_DATA, NGX_CREATE_DATA_ENTITY, NGX_CREATE_DATA_ENTITY_SERVICE, NGX_EDIT_DATA, NGX_EDIT_DATA_ENTITY, NGX_EDIT_DATA_ENTITY_SERVICE, NGX_GET_VALIDATION_ERROR_MESSAGE, NGX_GLOBAL_DEFAULT_VALUES, NgxChangesTooltipTitle, NgxMatEntityBaseDisplayColumnValueComponent, NgxMatEntityBaseInputComponent, NgxMatEntityConfirmDialogComponent, NgxMatEntityCreateDialogComponent, NgxMatEntityCreatePageComponent, NgxMatEntityEditDialogComponent, NgxMatEntityEditPageComponent, NgxMatEntityInputComponent, NgxMatEntityTableComponent, NgxValidationErrorsTooltipTitle, NumberDirective, TooltipComponent, TooltipDirective, UnsavedChangesGuard, ValidationUtilities, array, boolean, custom, date, defaultCreateDataRoute, defaultEditDataRoute, exportAsCsvMultiAction, exportAsJsonMultiAction, exportAsXmlMultiAction, file, getChangesTooltipContent, getValidationErrorsTooltipContent, hasMany, importFromJsonMultiAction, number, object, referencesMany, referencesOne, string };
4510
- export type { AutocompleteStringChipsArrayDecoratorConfig, AutocompleteStringDecoratorConfig, BaseData, BaseEntityType, BaseTableAction, CheckboxBooleanDecoratorConfig, Col, ConfirmDialogData, ConfirmDialogTypes, CreateData, CreateDataRoute, CreateEntityData, CustomDecoratorConfig, DateArrayDecoratorConfig, DateRange, DateRangeArrayDecoratorConfig, DateRangeDateDecoratorConfig, DateTimeArrayDecoratorConfig, DateTimeDateDecoratorConfig, DecoratorType, DefaultDateDecoratorConfig, DefaultFileDecoratorConfig, DefaultNumberDecoratorConfig, DefaultObjectDecoratorConfig, DefaultStringDecoratorConfig, Difference, DisplayColumn, DropdownBooleanDecoratorConfig, DropdownNumberDecoratorConfig, DropdownObjectDecoratorConfig, DropdownStringDecoratorConfig, DropdownValue, DynamicStyleClasses, EditAction, EditArrayItemDialogData, EditData, EditDataRoute, EditEntityData, EntityArrayDecoratorConfig, EntityClassNewable, EntityRow, EntityServiceClassNewable, EntityTab, FileData, HasManyDecoratorConfig, Hour, ImageFileDecoratorConfig, Minute, MultiSelectAction, NgxGlobalDefaultValues, NumberDropdownValues, ObjectDropdownValues, PageCreateData, PageEditData, PasswordStringDecoratorConfig, Position, ReferencesManyDecoratorConfig, ReferencesOneDecoratorConfig, SliderNumberDecoratorConfig, StringAutocompleteValues, StringChipsArrayDecoratorConfig, StringDropdownValues, TableAction, TableColumnValue, TableData, TextboxStringDecoratorConfig, Time, ToggleBooleanDecoratorConfig, UnsavedChangesPage, ValidationError };
4596
+ export { ArrayDecoratorConfig, DateUtilities, DecoratorTypes, DynamicStyleClassDirective, Entity, EntityService, EntityUtilities, FileUtilities, IncludedInValidatorDirective, NGX_COMPLETE_GLOBAL_DEFAULT_VALUES, NGX_CREATE_DATA, NGX_CREATE_DATA_ENTITY, NGX_CREATE_DATA_ENTITY_SERVICE, NGX_EDIT_DATA, NGX_EDIT_DATA_ENTITY, NGX_EDIT_DATA_ENTITY_SERVICE, NGX_GET_VALIDATION_ERROR_MESSAGE, NGX_GLOBAL_DEFAULT_VALUES, NgxChangesTooltipTitle, NgxMatEntityBaseDisplayColumnValueComponent, NgxMatEntityBaseInputComponent, NgxMatEntityConfirmDialogComponent, NgxMatEntityCreateDialogComponent, NgxMatEntityCreatePageComponent, NgxMatEntityEditDialogComponent, NgxMatEntityEditPageComponent, NgxMatEntityFormComponent, NgxMatEntityInputComponent, NgxMatEntityTableComponent, NgxValidationErrorsTooltipTitle, NumberDirective, TooltipComponent, TooltipDirective, UnsavedChangesGuard, ValidationUtilities, array, boolean, custom, date, defaultCreateDataRoute, defaultEditDataRoute, exportAsCsvMultiAction, exportAsJsonMultiAction, exportAsXmlMultiAction, file, getChangesTooltipContent, getValidationErrorsTooltipContent, hasMany, importFromJsonMultiAction, number, object, referencesMany, referencesOne, string };
4597
+ export type { AutocompleteStringChipsArrayDecoratorConfig, AutocompleteStringDecoratorConfig, BaseData, BaseEntityType, BaseTableAction, CheckboxBooleanDecoratorConfig, Col, ConfirmDialogData, ConfirmDialogTypes, CreateData, CreateDataRoute, CreateEntityData, CustomDecoratorConfig, DateArrayDecoratorConfig, DateRange, DateRangeArrayDecoratorConfig, DateRangeDateDecoratorConfig, DateTimeArrayDecoratorConfig, DateTimeDateDecoratorConfig, DecoratorType, DefaultDateDecoratorConfig, DefaultFileDecoratorConfig, DefaultNumberDecoratorConfig, DefaultObjectDecoratorConfig, DefaultStringDecoratorConfig, Difference, DisplayColumn, DropdownBooleanDecoratorConfig, DropdownNumberDecoratorConfig, DropdownObjectDecoratorConfig, DropdownStringDecoratorConfig, DropdownValue, DynamicStyleClasses, EditAction, EditArrayItemDialogData, EditData, EditDataRoute, EditEntityData, EntityArrayDecoratorConfig, EntityClassNewable, EntityRow, EntityServiceClassNewable, EntityTab, FileData, HasManyDecoratorConfig, Hour, ImageFileDecoratorConfig, Minute, MultiSelectAction, NgxGlobalDefaultValues, NumberDropdownValues, ObjectDropdownValues, PageCreateData, PageEditData, PasswordStringDecoratorConfig, Position, ReferencesManyDecoratorConfig, ReferencesOneDecoratorConfig, RequiredStringDropdownValues, SliderNumberDecoratorConfig, StringAutocompleteValues, StringChipsArrayDecoratorConfig, StringDropdownArrayDecoratorConfig, StringDropdownValues, TableAction, TableColumnValue, TableData, TextboxStringDecoratorConfig, Time, ToggleBooleanDecoratorConfig, UnsavedChangesPage, ValidationError };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-material-entity",
3
- "version": "20.0.3",
3
+ "version": "20.0.5",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "angular",
@@ -8,6 +8,9 @@
8
8
  "crud",
9
9
  "entity"
10
10
  ],
11
+ "repository": {
12
+ "url": "https://github.com/Service-Soft/ngx-material-entity"
13
+ },
11
14
  "peerDependencies": {
12
15
  "@angular/animations": "20",
13
16
  "@angular/cdk": "20",