@mediusinc/mng-commons 5.4.0-rc.1 → 5.4.0-rc.3
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/core/components/pages/error/error.page.component.d.ts +1 -1
- package/core/components/pages/not-found/not-found.page.component.d.ts +1 -1
- package/esm2022/core/components/pages/error/error.page.component.mjs +3 -3
- package/esm2022/core/components/pages/not-found/not-found.page.component.mjs +3 -3
- package/esm2022/form/components/autocomplete/autocomplete.component.mjs +45 -11
- package/esm2022/table/components/filter/filter-form/filter-form.component.mjs +4 -1
- package/esm2022/table/helpers/filters.mjs +3 -2
- package/esm2022/tableview/editor/components/editor/form-editor.component.mjs +7 -7
- package/fesm2022/mediusinc-mng-commons-core.mjs +4 -4
- package/fesm2022/mediusinc-mng-commons-core.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-form.mjs +44 -10
- package/fesm2022/mediusinc-mng-commons-form.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-table.mjs +5 -1
- package/fesm2022/mediusinc-mng-commons-table.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview.mjs +6 -6
- package/fesm2022/mediusinc-mng-commons-tableview.mjs.map +1 -1
- package/form/components/autocomplete/autocomplete.component.d.ts +9 -1
- package/package.json +1 -1
- package/table/helpers/filters.d.ts +1 -1
- package/version-info.json +5 -5
|
@@ -2340,11 +2340,10 @@ class FormEditorComponent {
|
|
|
2340
2340
|
const item = this.item();
|
|
2341
2341
|
if (item !== this.initialItemInput) {
|
|
2342
2342
|
// new item is different from the one the form was initialized with. Must trigger reset of form model.
|
|
2343
|
-
|
|
2343
|
+
// should be executed in untracked mode, because it updates multiple components underneath
|
|
2344
|
+
untracked(() => this.resetFormModel(item));
|
|
2344
2345
|
}
|
|
2345
|
-
}
|
|
2346
|
-
// resetModel uses signal like concept
|
|
2347
|
-
{ allowSignalWrites: true });
|
|
2346
|
+
});
|
|
2348
2347
|
effect(() => {
|
|
2349
2348
|
this._formlyOptions.formState.disabled =
|
|
2350
2349
|
this.isFormDisabled() || this.autoSavePreviewDisabledForm() || this._formlyOptions.formState.descriptor?.disabled === true || this._formlyOptions.formState.details;
|
|
@@ -2471,6 +2470,7 @@ class FormEditorComponent {
|
|
|
2471
2470
|
return formValue;
|
|
2472
2471
|
}
|
|
2473
2472
|
resetFormModel(item, opts) {
|
|
2473
|
+
// have to use formly's reset model, because _form.reset() does not reset the values correctly
|
|
2474
2474
|
this._formlyOptions.resetModel?.(this.getFormModelFromItem(item));
|
|
2475
2475
|
if (opts?.markAsPristine !== false) {
|
|
2476
2476
|
// mark form as pristine, should be done in next event hook to allow formly to initialize first
|
|
@@ -2588,13 +2588,13 @@ class FormEditorComponent {
|
|
|
2588
2588
|
const formModel = objectDeepCopy(item, { mapGettersToProperties: true }) ?? {};
|
|
2589
2589
|
const descriptor = this.descriptor();
|
|
2590
2590
|
descriptor.fields.forEach(field => {
|
|
2591
|
-
if (field.getter &&
|
|
2591
|
+
if (field.getter && formModel) {
|
|
2592
2592
|
const splitPath = field.property.split('.');
|
|
2593
2593
|
let currentObject = formModel;
|
|
2594
2594
|
for (let i = 0; i < splitPath.length; i++) {
|
|
2595
2595
|
const currentSubPath = splitPath[i];
|
|
2596
2596
|
if (i === splitPath.length - 1) {
|
|
2597
|
-
currentObject[currentSubPath] = field.getter(
|
|
2597
|
+
currentObject[currentSubPath] = field.getter(formModel?.[field.property], formModel);
|
|
2598
2598
|
}
|
|
2599
2599
|
else {
|
|
2600
2600
|
if (typeof currentObject[currentSubPath] !== 'object') {
|