ngx-material-entity 18.0.0 → 18.1.0

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.
Files changed (67) hide show
  1. package/components/custom-table/custom-table-configuration.model.d.ts +65 -0
  2. package/components/custom-table/custom-table.component.d.ts +111 -0
  3. package/components/edit-page/edit-page.component.d.ts +5 -1
  4. package/components/input/array/array-date-input/array-date-input.component.d.ts +2 -2
  5. package/components/input/array/array-date-range-input/array-date-range-input.component.d.ts +3 -3
  6. package/components/input/array/array-date-time-input/array-date-time-input.component.d.ts +3 -3
  7. package/components/input/array/array-table.class.d.ts +25 -19
  8. package/components/input/input.component.d.ts +99 -80
  9. package/components/input/relations/references-many-input/references-many-input.component.d.ts +12 -17
  10. package/components/table/edit-dialog/edit-entity-dialog.component.d.ts +5 -5
  11. package/components/table/table-data.d.ts +9 -4
  12. package/components/table/table.component.d.ts +15 -37
  13. package/decorators/array/array-decorator-internal.data.d.ts +5 -1
  14. package/decorators/array/array-decorator.data.d.ts +38 -82
  15. package/decorators/references-many/references-many-decorator-internal.data.d.ts +3 -1
  16. package/decorators/references-many/references-many-decorator.data.d.ts +13 -1
  17. package/directives/dynamic-style-class.directive.d.ts +4 -5
  18. package/esm2022/components/confirm-dialog/confirm-dialog.component.mjs +5 -6
  19. package/esm2022/components/create-page/create-page.component.mjs +6 -7
  20. package/esm2022/components/custom-table/custom-table-configuration.model.mjs +37 -0
  21. package/esm2022/components/custom-table/custom-table.component.mjs +213 -0
  22. package/esm2022/components/edit-page/edit-page.component.mjs +19 -9
  23. package/esm2022/components/form/form.component.mjs +5 -6
  24. package/esm2022/components/input/array/array-date-input/array-date-input.component.mjs +16 -20
  25. package/esm2022/components/input/array/array-date-range-input/array-date-range-input.component.mjs +27 -26
  26. package/esm2022/components/input/array/array-date-time-input/array-date-time-input.component.mjs +17 -21
  27. package/esm2022/components/input/array/array-string-autocomplete-chips/array-string-autocomplete-chips.component.mjs +4 -4
  28. package/esm2022/components/input/array/array-string-chips-input/array-string-chips-input.component.mjs +4 -4
  29. package/esm2022/components/input/array/array-table.class.mjs +51 -43
  30. package/esm2022/components/input/date/date-range-input/date-range-input.component.mjs +5 -6
  31. package/esm2022/components/input/date/date-time-input/date-time-input.component.mjs +4 -4
  32. package/esm2022/components/input/file/file-image-input/file-image-input.component.mjs +4 -7
  33. package/esm2022/components/input/file/file-input/file-input.component.mjs +4 -5
  34. package/esm2022/components/input/input.component.mjs +143 -106
  35. package/esm2022/components/input/number/number-dropdown-input/number-dropdown-input.component.mjs +4 -5
  36. package/esm2022/components/input/relations/references-many-input/references-many-input.component.mjs +40 -55
  37. package/esm2022/components/input/string/string-autocomplete-input/string-autocomplete-input.component.mjs +4 -5
  38. package/esm2022/components/input/string/string-dropdown-input/string-dropdown-input.component.mjs +4 -5
  39. package/esm2022/components/input/string/string-password-input/string-password-input.component.mjs +4 -4
  40. package/esm2022/components/table/create-dialog/create-entity-dialog.component.mjs +9 -8
  41. package/esm2022/components/table/edit-dialog/edit-entity-dialog.component.mjs +22 -14
  42. package/esm2022/components/table/table-data.mjs +1 -1
  43. package/esm2022/components/table/table.component.mjs +40 -107
  44. package/esm2022/components/tooltip/tooltip.component.mjs +3 -3
  45. package/esm2022/decorators/array/array-decorator-internal.data.mjs +14 -1
  46. package/esm2022/decorators/array/array-decorator.data.mjs +33 -2
  47. package/esm2022/decorators/has-many/has-many-decorator-internal.data.mjs +1 -1
  48. package/esm2022/decorators/references-many/references-many-decorator-internal.data.mjs +8 -1
  49. package/esm2022/decorators/references-many/references-many-decorator.data.mjs +1 -1
  50. package/esm2022/directives/dynamic-style-class.directive.mjs +5 -5
  51. package/esm2022/directives/tooltip.directive.mjs +4 -1
  52. package/esm2022/functions/get-changes-tooltip-content.function.mjs +23 -0
  53. package/esm2022/functions/get-validation-errors-tooltip-content.function.mjs +23 -0
  54. package/esm2022/functions/table-column-value-to-sort-value.function.mjs +29 -0
  55. package/esm2022/public-api.mjs +3 -2
  56. package/esm2022/utilities/date.utilities.mjs +7 -6
  57. package/esm2022/utilities/entity.utilities.mjs +23 -7
  58. package/esm2022/utilities/validation.utilities.mjs +2 -2
  59. package/fesm2022/ngx-material-entity.mjs +2550 -2224
  60. package/fesm2022/ngx-material-entity.mjs.map +1 -1
  61. package/functions/get-changes-tooltip-content.function.d.ts +13 -0
  62. package/functions/table-column-value-to-sort-value.function.d.ts +9 -0
  63. package/package.json +1 -1
  64. package/public-api.d.ts +2 -1
  65. package/utilities/entity.utilities.d.ts +7 -3
  66. package/esm2022/functions/get-validation-errors-tooltip-content.function.ts.mjs +0 -23
  67. /package/functions/{get-validation-errors-tooltip-content.function.ts.d.ts → get-validation-errors-tooltip-content.function.d.ts} +0 -0
@@ -0,0 +1,13 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { BaseEntityType } from '../classes/entity.model';
3
+ import { Difference } from '../utilities/entity.utilities';
4
+ /**
5
+ * Provider for the changes tooltip title.
6
+ */
7
+ export declare const NgxChangesTooltipTitle: InjectionToken<string>;
8
+ /**
9
+ * The default function that gets the changes tooltip content.
10
+ * @param changes - All changes for which the tooltip content should be generated.
11
+ * @returns A html string, containing a list of the name of each changed property.
12
+ */
13
+ export declare function getChangesTooltipContent<EntityType extends BaseEntityType<EntityType>>(changes: Difference<EntityType>[]): string;
@@ -0,0 +1,9 @@
1
+ import { TableColumnValue } from '../components/table/table-data';
2
+ /**
3
+ * Converts the given table column value to a string/number for sorting.
4
+ * This also supports string dates, if you eg. Needed to format them.
5
+ * @param value - The value to convert.
6
+ * @returns A string or a number to sort by.
7
+ * @throws When a value with an unknown type has been provided.
8
+ */
9
+ export declare function tableColumnValueToSortValue(value: TableColumnValue): string | number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-material-entity",
3
- "version": "18.0.0",
3
+ "version": "18.1.0",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "angular",
package/public-api.d.ts CHANGED
@@ -49,7 +49,8 @@ export * from './directives/included-in.directive';
49
49
  export * from './directives/number.directive';
50
50
  export * from './directives/tooltip.directive';
51
51
  export * from './functions/get-validation-error-message.function';
52
- export * from './functions/get-validation-errors-tooltip-content.function.ts';
52
+ export * from './functions/get-validation-errors-tooltip-content.function';
53
+ export * from './functions/get-changes-tooltip-content.function';
53
54
  export * from './services/entity.service';
54
55
  export * from './services/unsaved-changes.guard';
55
56
  export * from './utilities/date.utilities';
@@ -121,17 +121,19 @@ export declare abstract class EntityUtilities {
121
121
  * @param entity - The entity after all changes.
122
122
  * @param entityPriorChanges - The entity before the changes.
123
123
  * @param http - The angular HttpClient. Used to fetch files.
124
+ * @param injector - An angular environment injector.
124
125
  * @returns Whether or not the entity is dirty.
125
126
  */
126
- static isDirty<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, entityPriorChanges: EntityType, http: HttpClient): Promise<boolean>;
127
+ static isDirty<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, entityPriorChanges: EntityType, http: HttpClient, injector: EnvironmentInjector): Promise<boolean>;
127
128
  /**
128
- * Gets the differences between the two given entities.
129
+ * Gets the differences between the two given entities. Only checks properties which are decorated.
129
130
  * @param entity - The entity as is.
130
131
  * @param entityPriorChanges - The entity before any changes have been made.
131
132
  * @param http - The angular http client, is needed to check if files are equal.
133
+ * @param injector - An angular environment injector.
132
134
  * @returns The differences as an array consisting of key, before and after.
133
135
  */
134
- static getDifferencesBetweenEntities<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, entityPriorChanges: EntityType, http: HttpClient): Promise<Difference<EntityType>[]>;
136
+ static getDifferencesBetweenEntities<EntityType extends BaseEntityType<EntityType>>(entity: EntityType, entityPriorChanges: EntityType, http: HttpClient, injector: EnvironmentInjector): Promise<Difference<EntityType>[]>;
135
137
  /**
136
138
  * Checks if two given values are equal.
137
139
  * It uses the isEqual method from LodashUtilities and extends it with functionality regarding Dates.
@@ -143,6 +145,8 @@ export declare abstract class EntityUtilities {
143
145
  * @returns Whether or not the given values are equal.
144
146
  */
145
147
  static isEqual(value: unknown, valuePriorChanges: unknown, metadata: PropertyDecoratorConfigInternal<unknown> | undefined, type: DecoratorTypes | undefined, http: HttpClient): Promise<boolean>;
148
+ private static differenceIsUndefinedAndEmptyString;
149
+ private static differenceIsUndefinedAndEmptyArray;
146
150
  private static isEqualArrayString;
147
151
  private static isEqualArrayDate;
148
152
  private static isEqualArrayDateRange;
@@ -1,23 +0,0 @@
1
- import { InjectionToken, inject } from '@angular/core';
2
- /**
3
- * Provider for the validation errors tooltip title.
4
- */
5
- export const NgxValidationErrorsTooltipTitle = new InjectionToken('Provider for the validation errors tooltip title.', {
6
- providedIn: 'root',
7
- factory: () => 'Validation Errors:'
8
- });
9
- /**
10
- * The default function that gets the validation errors tooltip content.
11
- * @param validationErrors - All validation errors for which the tooltip content should be generated.
12
- * @returns A html string, containing a list of the name of each invalid property.
13
- */
14
- export function getValidationErrorsTooltipContent(validationErrors) {
15
- const title = inject(NgxValidationErrorsTooltipTitle);
16
- let res = `${title}\n<br>\n<ul style="margin-bottom: 0px; padding-left: 16px;">`;
17
- for (const error of validationErrors) {
18
- res = res.concat(`\n\t<li>${error.property}</li>`);
19
- }
20
- res = res.concat('\n</ul>');
21
- return res;
22
- }
23
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LXZhbGlkYXRpb24tZXJyb3JzLXRvb2x0aXAtY29udGVudC5mdW5jdGlvbi50cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL25neC1tYXRlcmlhbC1lbnRpdHkvc3JjL2Z1bmN0aW9ucy9nZXQtdmFsaWRhdGlvbi1lcnJvcnMtdG9vbHRpcC1jb250ZW50LmZ1bmN0aW9uLnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSxFQUFFLE1BQU0sZUFBZSxDQUF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