@sheinx/hooks 3.9.4-beta.2 → 3.9.4-beta.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/cjs/components/use-form/Provider.js +1 -2
- package/cjs/components/use-form/use-form-control/use-form-control.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-control/use-form-control.js +1 -3
- package/cjs/components/use-form/use-form-fieldset/fieldset-context.d.ts +0 -2
- package/cjs/components/use-form/use-form-fieldset/fieldset-context.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-fieldset/fieldset-context.js +3 -6
- package/cjs/components/use-form/use-form-fieldset/use-form-fieldset.d.ts +0 -2
- package/cjs/components/use-form/use-form-fieldset/use-form-fieldset.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-fieldset/use-form-fieldset.js +1 -2
- package/esm/components/use-form/Provider.js +1 -2
- package/esm/components/use-form/use-form-control/use-form-control.d.ts.map +1 -1
- package/esm/components/use-form/use-form-control/use-form-control.js +1 -3
- package/esm/components/use-form/use-form-fieldset/fieldset-context.d.ts +0 -2
- package/esm/components/use-form/use-form-fieldset/fieldset-context.d.ts.map +1 -1
- package/esm/components/use-form/use-form-fieldset/fieldset-context.js +3 -6
- package/esm/components/use-form/use-form-fieldset/use-form-fieldset.d.ts +0 -2
- package/esm/components/use-form/use-form-fieldset/use-form-fieldset.d.ts.map +1 -1
- package/esm/components/use-form/use-form-fieldset/use-form-fieldset.js +1 -2
- package/package.json +1 -1
|
@@ -16,8 +16,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
16
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
18
|
var topPath = {
|
|
19
|
-
path: ''
|
|
20
|
-
validateFieldSet: function validateFieldSet() {}
|
|
19
|
+
path: ''
|
|
21
20
|
};
|
|
22
21
|
var Provider = exports.Provider = function Provider(props) {
|
|
23
22
|
var children = props.children,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-form-control.d.ts","sourceRoot":"","sources":["use-form-control.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,oBAAoB,EAAsB,MAAM,yBAAyB,CAAC;AA4BnF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC;;kBA8JpC,CAAC,YAAY,GAAG,EAAE;;;;;
|
|
1
|
+
{"version":3,"file":"use-form-control.d.ts","sourceRoot":"","sources":["use-form-control.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,oBAAoB,EAAsB,MAAM,yBAAyB,CAAC;AA4BnF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC;;kBA8JpC,CAAC,YAAY,GAAG,EAAE;;;;;EAgFrD"}
|
|
@@ -64,8 +64,7 @@ function useFormControl(props) {
|
|
|
64
64
|
bind: props.bind
|
|
65
65
|
}),
|
|
66
66
|
name = _useFieldSetConsumer.name,
|
|
67
|
-
bind = _useFieldSetConsumer.bind
|
|
68
|
-
validateFieldSet = _useFieldSetConsumer.validateFieldSet;
|
|
67
|
+
bind = _useFieldSetConsumer.bind;
|
|
69
68
|
var _React$useState = _react.default.useState(undefined),
|
|
70
69
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
71
70
|
errorState = _React$useState2[0],
|
|
@@ -232,7 +231,6 @@ function useFormControl(props) {
|
|
|
232
231
|
other[_key - 1] = arguments[_key];
|
|
233
232
|
}
|
|
234
233
|
if (onChangePo) onChangePo.apply(void 0, [v].concat(other));
|
|
235
|
-
if (validateFieldSet) validateFieldSet();
|
|
236
234
|
});
|
|
237
235
|
var initError = (0, _usePersistFn.default)(function () {
|
|
238
236
|
var errors = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getErrors();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare const FieldsetContext: React.Context<{
|
|
3
3
|
path: string;
|
|
4
|
-
validateFieldSet: () => void;
|
|
5
4
|
}>;
|
|
6
5
|
interface BaseFieldProps {
|
|
7
6
|
bind?: string[];
|
|
@@ -10,7 +9,6 @@ interface BaseFieldProps {
|
|
|
10
9
|
export declare const useFieldSetConsumer: <T extends BaseFieldProps>(props: T) => T & {
|
|
11
10
|
name: string;
|
|
12
11
|
bind: string[] | undefined;
|
|
13
|
-
validateFieldSet: () => void;
|
|
14
12
|
};
|
|
15
13
|
export default FieldsetContext;
|
|
16
14
|
//# sourceMappingURL=fieldset-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldset-context.d.ts","sourceRoot":"","sources":["fieldset-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"fieldset-context.d.ts","sourceRoot":"","sources":["fieldset-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,eAAO,MAAM,eAAe;;EAA8B,CAAC;AAG3D,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACzB;AAiBD,eAAO,MAAM,mBAAmB;;;CAmB/B,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -15,8 +15,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
15
15
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
16
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
17
|
var FieldsetContext = exports.FieldsetContext = /*#__PURE__*/(0, _react.createContext)({
|
|
18
|
-
path: ''
|
|
19
|
-
validateFieldSet: function validateFieldSet() {}
|
|
18
|
+
path: ''
|
|
20
19
|
});
|
|
21
20
|
FieldsetContext.displayName = 'FieldsetContext';
|
|
22
21
|
function extendName() {
|
|
@@ -33,8 +32,7 @@ function extendName() {
|
|
|
33
32
|
}
|
|
34
33
|
var useFieldSetConsumer = exports.useFieldSetConsumer = function useFieldSetConsumer(props) {
|
|
35
34
|
var _React$useContext = _react.default.useContext(FieldsetContext),
|
|
36
|
-
path = _React$useContext.path
|
|
37
|
-
validateFieldSet = _React$useContext.validateFieldSet;
|
|
35
|
+
path = _React$useContext.path;
|
|
38
36
|
var bind = _react.default.useMemo(function () {
|
|
39
37
|
var _bind = path ? (props.bind || []).concat(path) : props.bind;
|
|
40
38
|
// 只有当路径中包含超过1个索引时才需要去掉最后一个索引
|
|
@@ -48,8 +46,7 @@ var useFieldSetConsumer = exports.useFieldSetConsumer = function useFieldSetCons
|
|
|
48
46
|
}, [path, props.name]);
|
|
49
47
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
50
48
|
name: name,
|
|
51
|
-
bind: bind
|
|
52
|
-
validateFieldSet: validateFieldSet
|
|
49
|
+
bind: bind
|
|
53
50
|
});
|
|
54
51
|
};
|
|
55
52
|
var _default = exports.default = FieldsetContext;
|
|
@@ -3,11 +3,9 @@ import { BaseFormFieldSetProps } from './use-form-fieldset.type';
|
|
|
3
3
|
export declare const useFormFieldSet: <T>(props: BaseFormFieldSetProps<T>) => {
|
|
4
4
|
Provider: import("react").Provider<{
|
|
5
5
|
path: string;
|
|
6
|
-
validateFieldSet: () => void;
|
|
7
6
|
}>;
|
|
8
7
|
ProviderValue: {
|
|
9
8
|
path: string | (string[] & string);
|
|
10
|
-
validateFieldSet: () => void;
|
|
11
9
|
};
|
|
12
10
|
error: Error | undefined;
|
|
13
11
|
value: T | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-form-fieldset.d.ts","sourceRoot":"","sources":["use-form-fieldset.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAMjE,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"use-form-fieldset.d.ts","sourceRoot":"","sources":["use-form-fieldset.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAMjE,eAAO,MAAM,eAAe;;;;;;;;;;;CA2B3B,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -30,8 +30,7 @@ var useFormFieldSet = exports.useFormFieldSet = function useFormFieldSet(props)
|
|
|
30
30
|
_utils.devUseWarning.error('[FieldSet] should render in Form');
|
|
31
31
|
}
|
|
32
32
|
var ProviderValue = {
|
|
33
|
-
path: name
|
|
34
|
-
validateFieldSet: function validateFieldSet() {}
|
|
33
|
+
path: name
|
|
35
34
|
};
|
|
36
35
|
return {
|
|
37
36
|
Provider: _fieldsetContext.default.Provider,
|
|
@@ -6,8 +6,7 @@ import { FormSchemaContext } from "./form-schema-context";
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
var topPath = {
|
|
9
|
-
path: ''
|
|
10
|
-
validateFieldSet: function validateFieldSet() {}
|
|
9
|
+
path: ''
|
|
11
10
|
};
|
|
12
11
|
export var Provider = function Provider(props) {
|
|
13
12
|
var children = props.children,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-form-control.d.ts","sourceRoot":"","sources":["use-form-control.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,oBAAoB,EAAsB,MAAM,yBAAyB,CAAC;AA4BnF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC;;kBA8JpC,CAAC,YAAY,GAAG,EAAE;;;;;
|
|
1
|
+
{"version":3,"file":"use-form-control.d.ts","sourceRoot":"","sources":["use-form-control.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,oBAAoB,EAAsB,MAAM,yBAAyB,CAAC;AA4BnF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC;;kBA8JpC,CAAC,YAAY,GAAG,EAAE;;;;;EAgFrD"}
|
|
@@ -55,8 +55,7 @@ export default function useFormControl(props) {
|
|
|
55
55
|
bind: props.bind
|
|
56
56
|
}),
|
|
57
57
|
name = _useFieldSetConsumer.name,
|
|
58
|
-
bind = _useFieldSetConsumer.bind
|
|
59
|
-
validateFieldSet = _useFieldSetConsumer.validateFieldSet;
|
|
58
|
+
bind = _useFieldSetConsumer.bind;
|
|
60
59
|
var _React$useState = React.useState(undefined),
|
|
61
60
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
62
61
|
errorState = _React$useState2[0],
|
|
@@ -223,7 +222,6 @@ export default function useFormControl(props) {
|
|
|
223
222
|
other[_key - 1] = arguments[_key];
|
|
224
223
|
}
|
|
225
224
|
if (onChangePo) onChangePo.apply(void 0, [v].concat(other));
|
|
226
|
-
if (validateFieldSet) validateFieldSet();
|
|
227
225
|
});
|
|
228
226
|
var initError = usePersistFn(function () {
|
|
229
227
|
var errors = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getErrors();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare const FieldsetContext: React.Context<{
|
|
3
3
|
path: string;
|
|
4
|
-
validateFieldSet: () => void;
|
|
5
4
|
}>;
|
|
6
5
|
interface BaseFieldProps {
|
|
7
6
|
bind?: string[];
|
|
@@ -10,7 +9,6 @@ interface BaseFieldProps {
|
|
|
10
9
|
export declare const useFieldSetConsumer: <T extends BaseFieldProps>(props: T) => T & {
|
|
11
10
|
name: string;
|
|
12
11
|
bind: string[] | undefined;
|
|
13
|
-
validateFieldSet: () => void;
|
|
14
12
|
};
|
|
15
13
|
export default FieldsetContext;
|
|
16
14
|
//# sourceMappingURL=fieldset-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldset-context.d.ts","sourceRoot":"","sources":["fieldset-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"fieldset-context.d.ts","sourceRoot":"","sources":["fieldset-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,eAAO,MAAM,eAAe;;EAA8B,CAAC;AAG3D,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACzB;AAiBD,eAAO,MAAM,mBAAmB;;;CAmB/B,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -8,8 +8,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
8
8
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
9
|
import React, { createContext } from 'react';
|
|
10
10
|
export var FieldsetContext = /*#__PURE__*/createContext({
|
|
11
|
-
path: ''
|
|
12
|
-
validateFieldSet: function validateFieldSet() {}
|
|
11
|
+
path: ''
|
|
13
12
|
});
|
|
14
13
|
FieldsetContext.displayName = 'FieldsetContext';
|
|
15
14
|
function extendName() {
|
|
@@ -26,8 +25,7 @@ function extendName() {
|
|
|
26
25
|
}
|
|
27
26
|
export var useFieldSetConsumer = function useFieldSetConsumer(props) {
|
|
28
27
|
var _React$useContext = React.useContext(FieldsetContext),
|
|
29
|
-
path = _React$useContext.path
|
|
30
|
-
validateFieldSet = _React$useContext.validateFieldSet;
|
|
28
|
+
path = _React$useContext.path;
|
|
31
29
|
var bind = React.useMemo(function () {
|
|
32
30
|
var _bind = path ? (props.bind || []).concat(path) : props.bind;
|
|
33
31
|
// 只有当路径中包含超过1个索引时才需要去掉最后一个索引
|
|
@@ -41,8 +39,7 @@ export var useFieldSetConsumer = function useFieldSetConsumer(props) {
|
|
|
41
39
|
}, [path, props.name]);
|
|
42
40
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
43
41
|
name: name,
|
|
44
|
-
bind: bind
|
|
45
|
-
validateFieldSet: validateFieldSet
|
|
42
|
+
bind: bind
|
|
46
43
|
});
|
|
47
44
|
};
|
|
48
45
|
export default FieldsetContext;
|
|
@@ -3,11 +3,9 @@ import { BaseFormFieldSetProps } from './use-form-fieldset.type';
|
|
|
3
3
|
export declare const useFormFieldSet: <T>(props: BaseFormFieldSetProps<T>) => {
|
|
4
4
|
Provider: import("react").Provider<{
|
|
5
5
|
path: string;
|
|
6
|
-
validateFieldSet: () => void;
|
|
7
6
|
}>;
|
|
8
7
|
ProviderValue: {
|
|
9
8
|
path: string | (string[] & string);
|
|
10
|
-
validateFieldSet: () => void;
|
|
11
9
|
};
|
|
12
10
|
error: Error | undefined;
|
|
13
11
|
value: T | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-form-fieldset.d.ts","sourceRoot":"","sources":["use-form-fieldset.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAMjE,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"use-form-fieldset.d.ts","sourceRoot":"","sources":["use-form-fieldset.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAMjE,eAAO,MAAM,eAAe;;;;;;;;;;;CA2B3B,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -23,8 +23,7 @@ export var useFormFieldSet = function useFormFieldSet(props) {
|
|
|
23
23
|
devUseWarning.error('[FieldSet] should render in Form');
|
|
24
24
|
}
|
|
25
25
|
var ProviderValue = {
|
|
26
|
-
path: name
|
|
27
|
-
validateFieldSet: function validateFieldSet() {}
|
|
26
|
+
path: name
|
|
28
27
|
};
|
|
29
28
|
return {
|
|
30
29
|
Provider: FieldsetContext.Provider,
|