@flowgram.ai/form 0.2.11 → 0.2.13
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/dist/esm/index.js +9 -12
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +6 -9
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/esm/index.js
CHANGED
|
@@ -624,8 +624,8 @@ function toFieldArray(model) {
|
|
|
624
624
|
}
|
|
625
625
|
|
|
626
626
|
// src/core/form-model.ts
|
|
627
|
-
import {
|
|
628
|
-
import {
|
|
627
|
+
import { flatten as flatten2, get as get4 } from "lodash";
|
|
628
|
+
import { deepEqual } from "fast-equals";
|
|
629
629
|
import { Emitter as Emitter3 } from "@flowgram.ai/utils";
|
|
630
630
|
import { ReactiveState as ReactiveState2 } from "@flowgram.ai/reactive";
|
|
631
631
|
|
|
@@ -678,22 +678,19 @@ function createFieldModelState(initialState) {
|
|
|
678
678
|
}
|
|
679
679
|
|
|
680
680
|
// src/core/store.ts
|
|
681
|
-
import { get as get2 } from "lodash";
|
|
681
|
+
import { get as get2, clone as clone2, cloneDeep } from "lodash";
|
|
682
682
|
var Store = class {
|
|
683
683
|
get values() {
|
|
684
|
-
return this._values;
|
|
684
|
+
return clone2(this._values);
|
|
685
685
|
}
|
|
686
686
|
set values(v) {
|
|
687
|
-
this._values = v;
|
|
688
|
-
}
|
|
689
|
-
setInitialValues(values) {
|
|
690
|
-
this._values = values;
|
|
687
|
+
this._values = cloneDeep(v);
|
|
691
688
|
}
|
|
692
689
|
setIn(path, value) {
|
|
693
690
|
this._values = shallowSetIn(this._values || {}, path.toString(), value);
|
|
694
691
|
}
|
|
695
692
|
getIn(path) {
|
|
696
|
-
return get2(this.
|
|
693
|
+
return get2(this.values, path.value);
|
|
697
694
|
}
|
|
698
695
|
dispose() {
|
|
699
696
|
}
|
|
@@ -1231,11 +1228,11 @@ var FormModel = class {
|
|
|
1231
1228
|
return this._options.initialValues;
|
|
1232
1229
|
}
|
|
1233
1230
|
get values() {
|
|
1234
|
-
return
|
|
1231
|
+
return this.store.values;
|
|
1235
1232
|
}
|
|
1236
1233
|
set values(v) {
|
|
1237
1234
|
const prevValues = this.values;
|
|
1238
|
-
if (
|
|
1235
|
+
if (deepEqual(prevValues, v)) {
|
|
1239
1236
|
return;
|
|
1240
1237
|
}
|
|
1241
1238
|
this.store.values = v;
|
|
@@ -1274,7 +1271,7 @@ var FormModel = class {
|
|
|
1274
1271
|
this._options = options;
|
|
1275
1272
|
if (options.initialValues) {
|
|
1276
1273
|
const prevValues = this.store.values;
|
|
1277
|
-
this.store.
|
|
1274
|
+
this.store.values = options.initialValues;
|
|
1278
1275
|
this.fireOnFormValuesInit({
|
|
1279
1276
|
values: options.initialValues,
|
|
1280
1277
|
prevValues,
|