Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/lib/components/crud-field/crud-field.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@
[attr.readonly]="readonly !== undefined ? readonly : null"
[max]="max !== undefined ? max : null"
[min]="min !== undefined ? min : null"
[pattern]="pattern !== undefined ? pattern : null"
[step]="step !== undefined ? step : null"
[fill]="fill"
[placeholder]="placeholder | translate"
Expand Down
10 changes: 6 additions & 4 deletions src/lib/engine/NgxModelPageDirective.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
repo = this._repository as DecafRepository<M>;
}

if (!repo || repo.class.name !== this.model?.constructor.name) {
if (!repo || repo?.class?.name !== this.model?.constructor?.name) {
const { context } = (await this.process(
event,
this.model as Model,
Expand Down Expand Up @@ -313,7 +313,7 @@
const getRepository = async (
modelName: string,
acc: KeyValue = {},
parent: string = '',

Check warning on line 316 in src/lib/engine/NgxModelPageDirective.ts

View workflow job for this annotation

GitHub Actions / coverage (22)

'parent' is assigned a value but never used
): Promise<DecafRepository<Model> | void> => {
if (this._repository) return this._repository as DecafRepository<Model>;
const constructor = Model.get(modelName);
Expand Down Expand Up @@ -376,7 +376,7 @@
async process<M extends Model>(
event: ICrudFormEvent,
model?: M,
submit: boolean = false,

Check warning on line 379 in src/lib/engine/NgxModelPageDirective.ts

View workflow job for this annotation

GitHub Actions / coverage (22)

'submit' is assigned a value but never used
): Promise<ILayoutModelContext | IModelComponentSubmitEvent<M>> {
const result = { models: {} } as ILayoutModelContext;
const iterate = async (evt: ICrudFormEvent, model: string | M, parent?: string) => {
Expand All @@ -392,7 +392,7 @@
: (event.data as KeyValue)[prop]);
if (data) {
if (parent || Array.isArray(data)) data = [...Object.values(data)];
const context = getModelAndRepository(type);
const context = getModelAndRepository(type) || getModelAndRepository(prop);
evt = { ...evt, data };
if (!context) {
await iterate(evt, type, prop);
Expand All @@ -407,7 +407,9 @@
pkType: pkType,
data,
};
if (!this.modelId) this.modelId = (data as KeyValue)[pk];
if (!this.modelId) {
this.modelId = (data as KeyValue)[pk];
}
} else {
Object.assign(result.context.data, {
[prop]: Array.isArray(data) ? this.buildTransactionModel(data, repository) : data,
Expand All @@ -417,7 +419,7 @@
[prop]: {
model,
data,
repository: repository as IRepository<Model>,
repository: repository,
pk,
},
});
Expand Down
Loading