@sheinx/hooks 3.9.10 → 3.9.11-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/use-form-fieldset/fieldset-context.d.ts +1 -1
- 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 +2 -1
- package/esm/components/use-form/use-form-fieldset/fieldset-context.d.ts +1 -1
- 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 +2 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ export declare const FieldsetContext: React.Context<{
|
|
|
3
3
|
path: string;
|
|
4
4
|
}>;
|
|
5
5
|
interface BaseFieldProps {
|
|
6
|
-
bind?: string[];
|
|
6
|
+
bind?: string[] | string;
|
|
7
7
|
name: string | string[];
|
|
8
8
|
}
|
|
9
9
|
export declare const useFieldSetConsumer: <T extends BaseFieldProps>(props: T) => T & {
|
|
@@ -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;;EAA8B,CAAC;AAG3D,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
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,GAAG,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACzB;AAiBD,eAAO,MAAM,mBAAmB;;;CAsB/B,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -34,7 +34,8 @@ var useFieldSetConsumer = exports.useFieldSetConsumer = function useFieldSetCons
|
|
|
34
34
|
var _React$useContext = _react.default.useContext(FieldsetContext),
|
|
35
35
|
path = _React$useContext.path;
|
|
36
36
|
var bind = _react.default.useMemo(function () {
|
|
37
|
-
var
|
|
37
|
+
var propsBind = props.bind ? Array.isArray(props.bind) ? props.bind : [props.bind] : undefined;
|
|
38
|
+
var _bind = path ? (propsBind || []).concat(path) : propsBind;
|
|
38
39
|
// 只有当路径中包含超过1个索引时才需要去掉最后一个索引
|
|
39
40
|
return _bind === null || _bind === void 0 ? void 0 : _bind.map(function (b) {
|
|
40
41
|
var indexCount = (b.match(/\[\d+\]/g) || []).length;
|
|
@@ -3,7 +3,7 @@ export declare const FieldsetContext: React.Context<{
|
|
|
3
3
|
path: string;
|
|
4
4
|
}>;
|
|
5
5
|
interface BaseFieldProps {
|
|
6
|
-
bind?: string[];
|
|
6
|
+
bind?: string[] | string;
|
|
7
7
|
name: string | string[];
|
|
8
8
|
}
|
|
9
9
|
export declare const useFieldSetConsumer: <T extends BaseFieldProps>(props: T) => T & {
|
|
@@ -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;;EAA8B,CAAC;AAG3D,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
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,GAAG,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACzB;AAiBD,eAAO,MAAM,mBAAmB;;;CAsB/B,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -27,7 +27,8 @@ export var useFieldSetConsumer = function useFieldSetConsumer(props) {
|
|
|
27
27
|
var _React$useContext = React.useContext(FieldsetContext),
|
|
28
28
|
path = _React$useContext.path;
|
|
29
29
|
var bind = React.useMemo(function () {
|
|
30
|
-
var
|
|
30
|
+
var propsBind = props.bind ? Array.isArray(props.bind) ? props.bind : [props.bind] : undefined;
|
|
31
|
+
var _bind = path ? (propsBind || []).concat(path) : propsBind;
|
|
31
32
|
// 只有当路径中包含超过1个索引时才需要去掉最后一个索引
|
|
32
33
|
return _bind === null || _bind === void 0 ? void 0 : _bind.map(function (b) {
|
|
33
34
|
var indexCount = (b.match(/\[\d+\]/g) || []).length;
|