@dataclouder/ngx-core 0.1.42 → 0.1.43
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.
|
@@ -1198,6 +1198,8 @@ class EntityBaseFormComponent {
|
|
|
1198
1198
|
this.entity = signal(undefined, ...(ngDevMode ? [{ debugName: "entity" }] : []));
|
|
1199
1199
|
this.entityIdFromUrl = toSignal(this.route.paramMap.pipe(map((params) => params.get('id'))));
|
|
1200
1200
|
this.entityId = computed(() => this.id() ?? this.entityIdFromUrl(), ...(ngDevMode ? [{ debugName: "entityId" }] : []));
|
|
1201
|
+
this.useFakeSave = input(false, ...(ngDevMode ? [{ debugName: "useFakeSave" }] : [])); // dont actually save if the father component that is in charge of save.
|
|
1202
|
+
this.fakeSaved = output();
|
|
1201
1203
|
this.loadEntityEffect = effect(() => {
|
|
1202
1204
|
const entityFromInput = this.entityInput();
|
|
1203
1205
|
if (entityFromInput) {
|
|
@@ -1209,7 +1211,7 @@ class EntityBaseFormComponent {
|
|
|
1209
1211
|
if (id) {
|
|
1210
1212
|
this.loadEntityById(id);
|
|
1211
1213
|
}
|
|
1212
|
-
else {
|
|
1214
|
+
else if (!this.useFakeSave()) {
|
|
1213
1215
|
this.createNewEntity();
|
|
1214
1216
|
}
|
|
1215
1217
|
}, ...(ngDevMode ? [{ debugName: "loadEntityEffect", allowSignalWrites: true }] : [{ allowSignalWrites: true }]));
|
|
@@ -1217,8 +1219,14 @@ class EntityBaseFormComponent {
|
|
|
1217
1219
|
async save() {
|
|
1218
1220
|
if (this.form.invalid) {
|
|
1219
1221
|
this.toastService?.error({ title: 'Error', subtitle: 'Form is invalid' });
|
|
1222
|
+
return undefined;
|
|
1220
1223
|
}
|
|
1221
1224
|
const entityData = { ...this.form.value, _id: this.entityId() };
|
|
1225
|
+
if (this.useFakeSave()) {
|
|
1226
|
+
this.toastService?.success({ title: 'info', subtitle: 'Se emitio el evento guardado' });
|
|
1227
|
+
this.fakeSaved.emit(entityData);
|
|
1228
|
+
return entityData;
|
|
1229
|
+
}
|
|
1222
1230
|
const result = await this.entityCommunicationService.createOrUpdate(entityData);
|
|
1223
1231
|
this.toastService?.success({ title: 'Success', subtitle: 'Entity saved successfully' });
|
|
1224
1232
|
this.entity.set(result);
|
|
@@ -1279,7 +1287,7 @@ class EntityBaseFormComponent {
|
|
|
1279
1287
|
}
|
|
1280
1288
|
}
|
|
1281
1289
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: EntityBaseFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1282
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.1.6", type: EntityBaseFormComponent, isStandalone: true, inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, entityInput: { classPropertyName: "entityInput", publicName: "entity", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
1290
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.1.6", type: EntityBaseFormComponent, isStandalone: true, inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, entityInput: { classPropertyName: "entityInput", publicName: "entity", isSignal: true, isRequired: false, transformFunction: null }, useFakeSave: { classPropertyName: "useFakeSave", publicName: "useFakeSave", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { fakeSaved: "fakeSaved" }, ngImport: i0 }); }
|
|
1283
1291
|
}
|
|
1284
1292
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: EntityBaseFormComponent, decorators: [{
|
|
1285
1293
|
type: Directive
|