ngx-material-entity 16.1.3 → 16.1.4

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.
@@ -5977,7 +5977,9 @@ class NgxMatEntityInputComponent {
5977
5977
  * @returns Whether or not the objects are the same.
5978
5978
  */
5979
5979
  compareObjects(value1, value2) {
5980
- return LodashUtilities.isEqual(value1, value2);
5980
+ const valueObject1 = new this.metadataDropdownObject.EntityClass(value1);
5981
+ const valueObject2 = new this.metadataDropdownObject.EntityClass(value2);
5982
+ return LodashUtilities.isEqual(valueObject1, valueObject2);
5981
5983
  }
5982
5984
  /**
5983
5985
  * Filters the dropdown values.
@@ -6362,33 +6364,32 @@ class NgxMatEntityInputComponent {
6362
6364
  */
6363
6365
  async addEntity() {
6364
6366
  await this.checkIsArrayItemValid();
6365
- if (this.metadataEntityArray.createInline) {
6366
- if (!this.metadataEntityArray.allowDuplicates) {
6367
- for (const v of this.entityArrayValues) {
6368
- if ((await EntityUtilities.isEqual(this.arrayItem, v, this.metadata, this.metadataEntityArray.itemType, this.http))) {
6369
- this.dialog.open(NgxMatEntityConfirmDialogComponent, {
6370
- data: this.metadataEntityArray.duplicatesErrorDialog,
6371
- autoFocus: false,
6372
- restoreFocus: false
6373
- });
6374
- return;
6375
- }
6376
- }
6377
- }
6378
- this.entityArrayValues.push(LodashUtilities.cloneDeep(this.arrayItem));
6379
- this.entityArrayDataSource.data = this.entityArrayValues;
6380
- EntityUtilities.resetChangesOnEntity(this.arrayItem, this.arrayItemPriorChanges);
6381
- EntityUtilities.setDefaultValues(this.arrayItem);
6382
- await this.checkIsArrayItemValid();
6383
- this.emitChange();
6384
- }
6385
- else {
6367
+ if (!this.metadataEntityArray.createInline) {
6386
6368
  this.addArrayItemDialogRef = this.dialog.open(this.addArrayItemDialog, {
6387
6369
  minWidth: '60%',
6388
6370
  autoFocus: false,
6389
6371
  restoreFocus: false
6390
6372
  });
6373
+ return;
6391
6374
  }
6375
+ if (!this.metadataEntityArray.allowDuplicates) {
6376
+ for (const v of this.entityArrayValues) {
6377
+ if ((await EntityUtilities.isEqual(this.arrayItem, v, this.metadata, this.metadataEntityArray.itemType, this.http))) {
6378
+ this.dialog.open(NgxMatEntityConfirmDialogComponent, {
6379
+ data: this.metadataEntityArray.duplicatesErrorDialog,
6380
+ autoFocus: false,
6381
+ restoreFocus: false
6382
+ });
6383
+ return;
6384
+ }
6385
+ }
6386
+ }
6387
+ this.entityArrayValues.push(LodashUtilities.cloneDeep(this.arrayItem));
6388
+ this.entityArrayDataSource.data = this.entityArrayValues;
6389
+ EntityUtilities.resetChangesOnEntity(this.arrayItem, this.arrayItemPriorChanges);
6390
+ EntityUtilities.setDefaultValues(this.arrayItem);
6391
+ await this.checkIsArrayItemValid();
6392
+ this.emitChange();
6392
6393
  }
6393
6394
  /**
6394
6395
  * Adds the array item defined in the dialog.
@@ -6616,7 +6617,7 @@ class NgxMatEntityFormComponent {
6616
6617
  });
6617
6618
  }
6618
6619
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.0", ngImport: i0, type: NgxMatEntityFormComponent, deps: [{ token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Component });
6619
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.0", type: NgxMatEntityFormComponent, isStandalone: true, selector: "ngx-mat-entity-form", inputs: { entity: "entity", isEntityReadOnly: "isEntityReadOnly", hideOmitForCreate: "hideOmitForCreate", hideOmitForEdit: "hideOmitForEdit", additionalOmitKeys: "additionalOmitKeys" }, outputs: { formChange: "formChange", selectedTabChange: "selectedTabChange" }, ngImport: i0, template: "<!-- eslint-disable angular/cyclomatic-complexity -->\n<!-- eslint-disable angular/no-call-expression -->\n<mat-tab-group *ngIf=\"entityTabs.length > 1\" preserveContent (selectedTabChange)=\"selectedTabChange.emit()\">\n <mat-tab *ngFor=\"let tab of entityTabs\" [label]=\"tab.tabName\">\n <div *ngFor=\"let row of tab.rows\" class=\"row\">\n <ngx-mat-entity-input\n *ngFor=\"let key of row.keys\"\n [entity]=\"entity\"\n [propertyKey]=\"key\"\n [hideOmitForEdit]=\"hideOmitForEdit\"\n [hideOmitForCreate]=\"hideOmitForCreate\"\n [class]=\"EntityUtilities.getWidthClasses(entity, key)\"\n [isReadOnly]=\"isReadOnly(key)\"\n (inputChangeEvent)=\"formChange.emit()\"\n >\n </ngx-mat-entity-input>\n </div>\n </mat-tab>\n</mat-tab-group>\n\n<div *ngIf=\"entityTabs.length <= 1\">\n <span *ngIf=\"!entityTabs.length\" class=\"no-entity-tabs\">\n ERROR: No Inputs. Did you correctly assign all values in the model constructor?\n </span>\n <div *ngFor=\"let row of entityTabs[0]?.rows\" class=\"row\">\n <ngx-mat-entity-input\n *ngFor=\"let key of row.keys\"\n [entity]=\"entity\"\n [propertyKey]=\"key\"\n [hideOmitForEdit]=\"true\"\n [class]=\"EntityUtilities.getWidthClasses(entity, key)\"\n [isReadOnly]=\"isReadOnly(key)\"\n (inputChangeEvent)=\"formChange.emit()\"\n >\n </ngx-mat-entity-input>\n </div>\n</div>", styles: [".no-entity-tabs{padding:10px;background-color:red;color:#f5f5f5}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "ngmodule", type: MatTabsModule }, { kind: "component", type: i4$4.MatTab, selector: "mat-tab", inputs: ["disabled"], exportAs: ["matTab"] }, { kind: "component", type: i4$4.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "disableRipple", "fitInkBarToContent", "mat-stretch-tabs"], exportAs: ["matTabGroup"] }, { kind: "component", type: NgxMatEntityInputComponent, selector: "ngx-mat-entity-input", inputs: ["entity", "propertyKey", "getValidationErrorMessage", "hideOmitForCreate", "hideOmitForEdit", "validEmpty", "isReadOnly"], outputs: ["inputChangeEvent"] }] });
6620
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.0", type: NgxMatEntityFormComponent, isStandalone: true, selector: "ngx-mat-entity-form", inputs: { entity: "entity", isEntityReadOnly: "isEntityReadOnly", hideOmitForCreate: "hideOmitForCreate", hideOmitForEdit: "hideOmitForEdit", additionalOmitKeys: "additionalOmitKeys" }, outputs: { formChange: "formChange", selectedTabChange: "selectedTabChange" }, ngImport: i0, template: "<!-- eslint-disable angular/cyclomatic-complexity -->\n<!-- eslint-disable angular/no-call-expression -->\n<mat-tab-group *ngIf=\"entityTabs.length > 1\" preserveContent (selectedTabChange)=\"selectedTabChange.emit()\">\n <mat-tab *ngFor=\"let tab of entityTabs\" [label]=\"tab.tabName\">\n <div *ngFor=\"let row of tab.rows\" class=\"row\">\n <ngx-mat-entity-input\n *ngFor=\"let key of row.keys\"\n [entity]=\"entity\"\n [propertyKey]=\"key\"\n [hideOmitForEdit]=\"hideOmitForEdit\"\n [hideOmitForCreate]=\"hideOmitForCreate\"\n [class]=\"EntityUtilities.getWidthClasses(entity, key)\"\n [isReadOnly]=\"isReadOnly(key)\"\n (inputChangeEvent)=\"formChange.emit()\"\n >\n </ngx-mat-entity-input>\n </div>\n </mat-tab>\n</mat-tab-group>\n\n<div *ngIf=\"entityTabs.length <= 1\">\n <span *ngIf=\"!entityTabs.length\" class=\"no-entity-tabs\">\n ERROR: No Inputs. Did you correctly assign all values in the model constructor?\n </span>\n <div *ngFor=\"let row of entityTabs[0]?.rows\" class=\"row\">\n <ngx-mat-entity-input\n *ngFor=\"let key of row.keys\"\n [entity]=\"entity\"\n [propertyKey]=\"key\"\n [hideOmitForEdit]=\"hideOmitForEdit\"\n [hideOmitForCreate]=\"hideOmitForCreate\"\n [class]=\"EntityUtilities.getWidthClasses(entity, key)\"\n [isReadOnly]=\"isReadOnly(key)\"\n (inputChangeEvent)=\"formChange.emit()\"\n >\n </ngx-mat-entity-input>\n </div>\n</div>", styles: [".no-entity-tabs{padding:10px;background-color:red;color:#f5f5f5}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "ngmodule", type: MatTabsModule }, { kind: "component", type: i4$4.MatTab, selector: "mat-tab", inputs: ["disabled"], exportAs: ["matTab"] }, { kind: "component", type: i4$4.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "disableRipple", "fitInkBarToContent", "mat-stretch-tabs"], exportAs: ["matTabGroup"] }, { kind: "component", type: NgxMatEntityInputComponent, selector: "ngx-mat-entity-input", inputs: ["entity", "propertyKey", "getValidationErrorMessage", "hideOmitForCreate", "hideOmitForEdit", "validEmpty", "isReadOnly"], outputs: ["inputChangeEvent"] }] });
6620
6621
  }
6621
6622
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.0", ngImport: i0, type: NgxMatEntityFormComponent, decorators: [{
6622
6623
  type: Component,
@@ -6625,7 +6626,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.0", ngImpor
6625
6626
  NgFor,
6626
6627
  MatTabsModule,
6627
6628
  NgxMatEntityInputComponent
6628
- ], template: "<!-- eslint-disable angular/cyclomatic-complexity -->\n<!-- eslint-disable angular/no-call-expression -->\n<mat-tab-group *ngIf=\"entityTabs.length > 1\" preserveContent (selectedTabChange)=\"selectedTabChange.emit()\">\n <mat-tab *ngFor=\"let tab of entityTabs\" [label]=\"tab.tabName\">\n <div *ngFor=\"let row of tab.rows\" class=\"row\">\n <ngx-mat-entity-input\n *ngFor=\"let key of row.keys\"\n [entity]=\"entity\"\n [propertyKey]=\"key\"\n [hideOmitForEdit]=\"hideOmitForEdit\"\n [hideOmitForCreate]=\"hideOmitForCreate\"\n [class]=\"EntityUtilities.getWidthClasses(entity, key)\"\n [isReadOnly]=\"isReadOnly(key)\"\n (inputChangeEvent)=\"formChange.emit()\"\n >\n </ngx-mat-entity-input>\n </div>\n </mat-tab>\n</mat-tab-group>\n\n<div *ngIf=\"entityTabs.length <= 1\">\n <span *ngIf=\"!entityTabs.length\" class=\"no-entity-tabs\">\n ERROR: No Inputs. Did you correctly assign all values in the model constructor?\n </span>\n <div *ngFor=\"let row of entityTabs[0]?.rows\" class=\"row\">\n <ngx-mat-entity-input\n *ngFor=\"let key of row.keys\"\n [entity]=\"entity\"\n [propertyKey]=\"key\"\n [hideOmitForEdit]=\"true\"\n [class]=\"EntityUtilities.getWidthClasses(entity, key)\"\n [isReadOnly]=\"isReadOnly(key)\"\n (inputChangeEvent)=\"formChange.emit()\"\n >\n </ngx-mat-entity-input>\n </div>\n</div>", styles: [".no-entity-tabs{padding:10px;background-color:red;color:#f5f5f5}\n"] }]
6629
+ ], template: "<!-- eslint-disable angular/cyclomatic-complexity -->\n<!-- eslint-disable angular/no-call-expression -->\n<mat-tab-group *ngIf=\"entityTabs.length > 1\" preserveContent (selectedTabChange)=\"selectedTabChange.emit()\">\n <mat-tab *ngFor=\"let tab of entityTabs\" [label]=\"tab.tabName\">\n <div *ngFor=\"let row of tab.rows\" class=\"row\">\n <ngx-mat-entity-input\n *ngFor=\"let key of row.keys\"\n [entity]=\"entity\"\n [propertyKey]=\"key\"\n [hideOmitForEdit]=\"hideOmitForEdit\"\n [hideOmitForCreate]=\"hideOmitForCreate\"\n [class]=\"EntityUtilities.getWidthClasses(entity, key)\"\n [isReadOnly]=\"isReadOnly(key)\"\n (inputChangeEvent)=\"formChange.emit()\"\n >\n </ngx-mat-entity-input>\n </div>\n </mat-tab>\n</mat-tab-group>\n\n<div *ngIf=\"entityTabs.length <= 1\">\n <span *ngIf=\"!entityTabs.length\" class=\"no-entity-tabs\">\n ERROR: No Inputs. Did you correctly assign all values in the model constructor?\n </span>\n <div *ngFor=\"let row of entityTabs[0]?.rows\" class=\"row\">\n <ngx-mat-entity-input\n *ngFor=\"let key of row.keys\"\n [entity]=\"entity\"\n [propertyKey]=\"key\"\n [hideOmitForEdit]=\"hideOmitForEdit\"\n [hideOmitForCreate]=\"hideOmitForCreate\"\n [class]=\"EntityUtilities.getWidthClasses(entity, key)\"\n [isReadOnly]=\"isReadOnly(key)\"\n (inputChangeEvent)=\"formChange.emit()\"\n >\n </ngx-mat-entity-input>\n </div>\n</div>", styles: [".no-entity-tabs{padding:10px;background-color:red;color:#f5f5f5}\n"] }]
6629
6630
  }], ctorParameters: function () { return [{ type: i0.EnvironmentInjector }]; }, propDecorators: { entity: [{
6630
6631
  type: Input,
6631
6632
  args: [{ required: true }]