@messaia/cdk 21.0.0-rc.26 → 21.0.0-rc.27
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.
package/fesm2022/messaia-cdk.mjs
CHANGED
|
@@ -19826,13 +19826,18 @@ class GenericFormBaseComponent extends BaseComponent {
|
|
|
19826
19826
|
route;
|
|
19827
19827
|
changeDetectorRef;
|
|
19828
19828
|
/**
|
|
19829
|
-
|
|
19830
|
-
|
|
19829
|
+
* The action of the form (add | edit).
|
|
19830
|
+
*/
|
|
19831
19831
|
action = 'add';
|
|
19832
19832
|
/**
|
|
19833
19833
|
* Indicates if the form is in edit mode.
|
|
19834
19834
|
*/
|
|
19835
19835
|
isEditMode = false;
|
|
19836
|
+
/**
|
|
19837
|
+
* Whether to automatically initialize a new form instance if
|
|
19838
|
+
* no existing record is found in the database.
|
|
19839
|
+
*/
|
|
19840
|
+
initializeDefaultOnEmpty = false;
|
|
19836
19841
|
/**
|
|
19837
19842
|
* Save action enumeration.
|
|
19838
19843
|
*/
|
|
@@ -20100,6 +20105,17 @@ class GenericFormBaseComponent extends BaseComponent {
|
|
|
20100
20105
|
if (errorCallback) {
|
|
20101
20106
|
errorCallback(error);
|
|
20102
20107
|
}
|
|
20108
|
+
/* If the error indicates that the item was not found and initializeDefaultOnEmpty is true, initialize a new form instance */
|
|
20109
|
+
const isNotFound = error?.status === 404 || (typeof error === 'string' && error.includes('404'));
|
|
20110
|
+
/* If the error status is 404 (Not Found) and initializeDefaultOnEmpty is true, initialize a new form instance */
|
|
20111
|
+
if (this.initializeDefaultOnEmpty && isNotFound) {
|
|
20112
|
+
/* Set the form to edit mode to allow creating a new item */
|
|
20113
|
+
this.isEditMode = false;
|
|
20114
|
+
/* Initialize a new item with default values and the provided ID */
|
|
20115
|
+
this.item = Object.assign(this.newInstance(), { id: this.id });
|
|
20116
|
+
/* Build the form for the new item */
|
|
20117
|
+
this.buildForm();
|
|
20118
|
+
}
|
|
20103
20119
|
}
|
|
20104
20120
|
});
|
|
20105
20121
|
}
|
|
@@ -20710,11 +20726,13 @@ class GenericFormBaseComponent extends BaseComponent {
|
|
|
20710
20726
|
}
|
|
20711
20727
|
}
|
|
20712
20728
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: GenericFormBaseComponent, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
|
|
20713
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.6", type: GenericFormBaseComponent, isStandalone: true, inputs: { id: "id", _item: "_item", item: "item", includes: "includes", updateIncludes: "updateIncludes", projection: "projection", query: "query", readonly: "readonly", disabled: "disabled", form: "form", fieldSets: "fieldSets" }, outputs: { formInitialized: "formInitialized" }, host: { listeners: { "document:keydown": "handleKeyboardEvent($event)" } }, viewQueries: [{ propertyName: "matStepper", first: true, predicate: MatStepper, descendants: true }, { propertyName: "input", predicate: ["focus"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
20729
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.6", type: GenericFormBaseComponent, isStandalone: true, inputs: { initializeDefaultOnEmpty: "initializeDefaultOnEmpty", id: "id", _item: "_item", item: "item", includes: "includes", updateIncludes: "updateIncludes", projection: "projection", query: "query", readonly: "readonly", disabled: "disabled", form: "form", fieldSets: "fieldSets" }, outputs: { formInitialized: "formInitialized" }, host: { listeners: { "document:keydown": "handleKeyboardEvent($event)" } }, viewQueries: [{ propertyName: "matStepper", first: true, predicate: MatStepper, descendants: true }, { propertyName: "input", predicate: ["focus"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
20714
20730
|
}
|
|
20715
20731
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: GenericFormBaseComponent, decorators: [{
|
|
20716
20732
|
type: Directive
|
|
20717
|
-
}], ctorParameters: () => [{ type: i0.Type }, { type: undefined }, { type: i1$2.ActivatedRoute }, { type: i0.ChangeDetectorRef }], propDecorators: {
|
|
20733
|
+
}], ctorParameters: () => [{ type: i0.Type }, { type: undefined }, { type: i1$2.ActivatedRoute }, { type: i0.ChangeDetectorRef }], propDecorators: { initializeDefaultOnEmpty: [{
|
|
20734
|
+
type: Input
|
|
20735
|
+
}], id: [{
|
|
20718
20736
|
type: Input
|
|
20719
20737
|
}], _item: [{
|
|
20720
20738
|
type: Input
|