@sheinx/hooks 3.9.3-beta.11 → 3.9.3-beta.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.
@@ -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;;;EAA0D,CAAC;AAGvF,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACzB;AAiBD,eAAO,MAAM,mBAAmB;;;;CAe/B,CAAC;AAEF,eAAe,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;;;EAA0D,CAAC;AAGvF,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACzB;AAiBD,eAAO,MAAM,mBAAmB;;;;CAoB/B,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -36,7 +36,12 @@ var useFieldSetConsumer = exports.useFieldSetConsumer = function useFieldSetCons
36
36
  path = _React$useContext.path,
37
37
  validateFieldSet = _React$useContext.validateFieldSet;
38
38
  var bind = _react.default.useMemo(function () {
39
- return path ? (props.bind || []).concat(path) : props.bind;
39
+ var _bind = path ? (props.bind || []).concat(path) : props.bind;
40
+ // 只有当路径中包含超过1个索引时才需要去掉最后一个索引
41
+ return _bind === null || _bind === void 0 ? void 0 : _bind.map(function (b) {
42
+ var indexCount = (b.match(/\[\d+\]/g) || []).length;
43
+ return indexCount > 1 ? b.replace(/\[\d+\]$/, '') : b;
44
+ });
40
45
  }, [path, props.bind]);
41
46
  var name = _react.default.useMemo(function () {
42
47
  return extendName(path, props.name);
@@ -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;;;EAA0D,CAAC;AAGvF,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACzB;AAiBD,eAAO,MAAM,mBAAmB;;;;CAe/B,CAAC;AAEF,eAAe,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;;;EAA0D,CAAC;AAGvF,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACzB;AAiBD,eAAO,MAAM,mBAAmB;;;;CAoB/B,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -29,7 +29,12 @@ export var useFieldSetConsumer = function useFieldSetConsumer(props) {
29
29
  path = _React$useContext.path,
30
30
  validateFieldSet = _React$useContext.validateFieldSet;
31
31
  var bind = React.useMemo(function () {
32
- return path ? (props.bind || []).concat(path) : props.bind;
32
+ var _bind = path ? (props.bind || []).concat(path) : props.bind;
33
+ // 只有当路径中包含超过1个索引时才需要去掉最后一个索引
34
+ return _bind === null || _bind === void 0 ? void 0 : _bind.map(function (b) {
35
+ var indexCount = (b.match(/\[\d+\]/g) || []).length;
36
+ return indexCount > 1 ? b.replace(/\[\d+\]$/, '') : b;
37
+ });
33
38
  }, [path, props.bind]);
34
39
  var name = React.useMemo(function () {
35
40
  return extendName(path, props.name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/hooks",
3
- "version": "3.9.3-beta.11",
3
+ "version": "3.9.3-beta.13",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",