Skip to content

Commit

Permalink
Merge pull request #291 from Service-Soft/dev
Browse files Browse the repository at this point in the history
Release 18.2.3
  • Loading branch information
tim-fabian authored Jan 7, 2025
2 parents 4e931fb + a7665bb commit b653739
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
2 changes: 1 addition & 1 deletion projects/ngx-material-entity/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-material-entity",
"version": "18.2.2",
"version": "18.2.3",
"license": "MIT",
"keywords": [
"angular",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -759,10 +759,10 @@ export class NgxMatEntityInputComponent<EntityType extends BaseEntityType<Entity
this.metadata as EntityArrayDecoratorConfigInternal<EntityType>,
this.globalConfig
);
ReflectUtilities.defineMetadata('metadata', this.metadata, this.entity, this.propertyKey);
this.metadataEntityArray = this.metadata as EntityArrayDecoratorConfigInternal<EntityType>;
if (this.entity[this.propertyKey] == undefined) {
(this.entity[this.propertyKey] as EntityType[]) = [];
ReflectUtilities.defineMetadata('metadata', this.metadata, this.entity, this.propertyKey);
}
if (!this.metadataEntityArray.createInline && !this.metadataEntityArray.createDialogData) {
this.metadataEntityArray.createDialogData = {
Expand Down Expand Up @@ -818,18 +818,6 @@ export class NgxMatEntityInputComponent<EntityType extends BaseEntityType<Entity
.withDefault('title', this.globalConfig.addArrayItemTitle)
.getResult();

this.editArrayItemFormContext = {
$implicit: {
entity: this.arrayItem,
tabs: EntityUtilities.getEntityTabs(this.arrayItem, this.injector, true),
isReadOnly: (property, key) => this.isPropertyReadOnly(property, key),
inputChangeEvent: () => {
void this.checkArrayItem();
this.editArrayItemFormContext.$implicit.tabs = EntityUtilities.getEntityTabs(this.arrayItem, this.injector, true);
},
hideOmitForEdit: true
}
};
this.editArrayItemDialogData = this.metadataEntityArray.editDialogData;
}

Expand Down Expand Up @@ -1419,6 +1407,21 @@ export class NgxMatEntityInputComponent<EntityType extends BaseEntityType<Entity
async addEntity(): Promise<void> {
await this.checkIsArrayItemValid();
if (!this.metadataEntityArray.createInline) {
this.arrayItem = new this.metadataEntityArray.EntityClass();
this.arrayItemPriorChanges = LodashUtilities.cloneDeep(this.arrayItem);
EntityUtilities.setDefaultValues(this.arrayItem);

this.addArrayItemFormContext = {
$implicit: {
entity: this.arrayItem,
tabs: EntityUtilities.getEntityTabs(this.arrayItem, this.injector, true),
inputChangeEvent: () => {
void this.checkIsArrayItemValid();
this.addArrayItemFormContext.$implicit.tabs = EntityUtilities.getEntityTabs(this.arrayItem, this.injector, true);
},
hideOmitForCreate: true
}
};
this.addArrayItemDialogRef = this.dialog.open(
this.addArrayItemDialog,
{
Expand Down Expand Up @@ -1485,6 +1488,19 @@ export class NgxMatEntityInputComponent<EntityType extends BaseEntityType<Entity
this.arrayItem = new this.metadataEntityArray.EntityClass(entity);
this.arrayItemPriorChanges = LodashUtilities.cloneDeep(this.arrayItem);

this.editArrayItemFormContext = {
$implicit: {
entity: this.arrayItem,
tabs: EntityUtilities.getEntityTabs(this.arrayItem, this.injector, true),
isReadOnly: (property, key) => this.isPropertyReadOnly(property, key),
inputChangeEvent: () => {
void this.checkArrayItem();
this.editArrayItemFormContext.$implicit.tabs = EntityUtilities.getEntityTabs(this.arrayItem, this.injector, true);
},
hideOmitForEdit: true
}
};

await this.checkArrayItem();

this.editArrayItemDialogRef = this.dialog.open(
Expand Down

0 comments on commit b653739

Please sign in to comment.