@flowgram.ai/form 0.1.0-alpha.12 → 0.1.0-alpha.14
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 +14 -11
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +50 -47
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/esm/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// src/react/field.tsx
|
|
2
2
|
import * as React2 from "react";
|
|
3
|
-
import { isFunction } from "lodash";
|
|
3
|
+
import { isFunction } from "lodash-es";
|
|
4
4
|
import { DisposableCollection, useRefresh } from "@flowgram.ai/utils";
|
|
5
5
|
import { useReadonlyReactiveState } from "@flowgram.ai/reactive";
|
|
6
6
|
|
|
7
7
|
// src/utils/object.ts
|
|
8
|
-
import { clone, toPath } from "lodash";
|
|
8
|
+
import { clone, toPath } from "lodash-es";
|
|
9
9
|
var isObject = (obj) => obj !== null && typeof obj === "object";
|
|
10
10
|
var isInteger = (obj) => String(Math.floor(Number(obj))) === obj;
|
|
11
11
|
function getIn(obj, key, def, p = 0) {
|
|
@@ -33,7 +33,7 @@ function shallowSetIn(obj, path, value) {
|
|
|
33
33
|
resVal = resVal[currentPath] = isInteger(nextPath) && Number(nextPath) >= 0 ? [] : {};
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
if ((i === 0 ? obj : resVal)[pathArray[i]] === value) {
|
|
36
|
+
if ((i === 0 ? obj : resVal)[pathArray[i]] === value && pathArray[i] in obj) {
|
|
37
37
|
return obj;
|
|
38
38
|
}
|
|
39
39
|
resVal[pathArray[i]] = value;
|
|
@@ -59,7 +59,7 @@ function isCheckBoxEvent(e) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
// src/utils/glob.ts
|
|
62
|
-
import { flatten, get, isArray, isObject as isObject2 } from "lodash";
|
|
62
|
+
import { flatten, get, isArray, isObject as isObject2 } from "lodash-es";
|
|
63
63
|
var Glob;
|
|
64
64
|
((Glob2) => {
|
|
65
65
|
Glob2.DIVIDER = ".";
|
|
@@ -215,10 +215,10 @@ var ValidateTrigger = /* @__PURE__ */ ((ValidateTrigger2) => {
|
|
|
215
215
|
})(ValidateTrigger || {});
|
|
216
216
|
|
|
217
217
|
// src/core/utils.ts
|
|
218
|
-
import { isEmpty, isEqual } from "lodash";
|
|
218
|
+
import { isEmpty, isEqual } from "lodash-es";
|
|
219
219
|
|
|
220
220
|
// src/core/path.ts
|
|
221
|
-
import { toPath as toPath2 } from "lodash";
|
|
221
|
+
import { toPath as toPath2 } from "lodash-es";
|
|
222
222
|
var Path = class _Path {
|
|
223
223
|
constructor(path) {
|
|
224
224
|
this._path = [];
|
|
@@ -597,7 +597,7 @@ function Field({
|
|
|
597
597
|
|
|
598
598
|
// src/react/form.tsx
|
|
599
599
|
import React3, { Children, useEffect as useEffect2, useMemo as useMemo2 } from "react";
|
|
600
|
-
import { isFunction as isFunction2 } from "lodash";
|
|
600
|
+
import { isFunction as isFunction2 } from "lodash-es";
|
|
601
601
|
|
|
602
602
|
// src/core/to-field-array.ts
|
|
603
603
|
function toFieldArray(model) {
|
|
@@ -635,7 +635,7 @@ function toFieldArray(model) {
|
|
|
635
635
|
}
|
|
636
636
|
|
|
637
637
|
// src/core/form-model.ts
|
|
638
|
-
import { flatten as flatten2, get as get4 } from "lodash";
|
|
638
|
+
import { flatten as flatten2, get as get4 } from "lodash-es";
|
|
639
639
|
import { deepEqual } from "fast-equals";
|
|
640
640
|
import { Emitter as Emitter3 } from "@flowgram.ai/utils";
|
|
641
641
|
import { ReactiveState as ReactiveState2 } from "@flowgram.ai/reactive";
|
|
@@ -689,7 +689,7 @@ function createFieldModelState(initialState) {
|
|
|
689
689
|
}
|
|
690
690
|
|
|
691
691
|
// src/core/store.ts
|
|
692
|
-
import { get as get2, clone as clone2, cloneDeep } from "lodash";
|
|
692
|
+
import { get as get2, clone as clone2, cloneDeep } from "lodash-es";
|
|
693
693
|
var Store = class {
|
|
694
694
|
get values() {
|
|
695
695
|
return clone2(this._values);
|
|
@@ -709,7 +709,7 @@ var Store = class {
|
|
|
709
709
|
|
|
710
710
|
// src/core/field-model.ts
|
|
711
711
|
import { nanoid } from "nanoid";
|
|
712
|
-
import { get as get3, groupBy, some } from "lodash";
|
|
712
|
+
import { get as get3, groupBy, some } from "lodash-es";
|
|
713
713
|
import { DisposableCollection as DisposableCollection2, Emitter } from "@flowgram.ai/utils";
|
|
714
714
|
import { ReactiveState } from "@flowgram.ai/reactive";
|
|
715
715
|
var FieldModel = class {
|
|
@@ -1223,6 +1223,7 @@ var FormModel = class {
|
|
|
1223
1223
|
createFormModelState()
|
|
1224
1224
|
);
|
|
1225
1225
|
this._initialized = false;
|
|
1226
|
+
this.validateDisabled = false;
|
|
1226
1227
|
}
|
|
1227
1228
|
set fieldMap(map) {
|
|
1228
1229
|
this._fieldMap = map;
|
|
@@ -1364,6 +1365,7 @@ var FormModel = class {
|
|
|
1364
1365
|
this.setValueIn(name, void 0);
|
|
1365
1366
|
}
|
|
1366
1367
|
async validateIn(name) {
|
|
1368
|
+
if (this.validateDisabled) return [];
|
|
1367
1369
|
const validateOptions = this.getValidateOptions();
|
|
1368
1370
|
if (!validateOptions) {
|
|
1369
1371
|
return;
|
|
@@ -1390,6 +1392,7 @@ var FormModel = class {
|
|
|
1390
1392
|
return validate;
|
|
1391
1393
|
}
|
|
1392
1394
|
async validate() {
|
|
1395
|
+
if (this.validateDisabled) return [];
|
|
1393
1396
|
const validateOptions = this.getValidateOptions();
|
|
1394
1397
|
if (!validateOptions) {
|
|
1395
1398
|
return [];
|
|
@@ -1533,7 +1536,7 @@ function useWatch(name) {
|
|
|
1533
1536
|
|
|
1534
1537
|
// src/react/field-array.tsx
|
|
1535
1538
|
import * as React4 from "react";
|
|
1536
|
-
import { isFunction as isFunction3 } from "lodash";
|
|
1539
|
+
import { isFunction as isFunction3 } from "lodash-es";
|
|
1537
1540
|
import { DisposableCollection as DisposableCollection3, useRefresh as useRefresh3 } from "@flowgram.ai/utils";
|
|
1538
1541
|
import { useReadonlyReactiveState as useReadonlyReactiveState2 } from "@flowgram.ai/reactive";
|
|
1539
1542
|
function FieldArray({
|