@sheinx/base 3.5.5-beta.7 → 3.5.6-beta.1

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.
@@ -18,10 +18,8 @@ var produce = _hooks.util.produce;
18
18
  var FormFieldSet = function FormFieldSet(props) {
19
19
  var children = props.children,
20
20
  empty = props.empty;
21
- var _React$useRef = _react.default.useRef({
22
- ids: []
23
- }),
24
- context = _React$useRef.current;
21
+ // const { current: context } = React.useRef<{ ids: string[] }>({ ids: [] });
22
+
25
23
  var formFunc = (0, _hooks.useFormFunc)();
26
24
  var validateFieldSet = function validateFieldSet() {
27
25
  formFunc === null || formFunc === void 0 || formFunc.validateFields(props.name).catch(function (e) {
@@ -61,19 +59,17 @@ var FormFieldSet = function FormFieldSet(props) {
61
59
  draft.push(val);
62
60
  });
63
61
  _onChange(newValue);
64
- context.ids.push(_hooks.util.generateUUID());
62
+ // context.ids.push(util.generateUUID());
65
63
  formFunc === null || formFunc === void 0 || formFunc.insertError(name, 0);
66
64
  })
67
65
  }, 'empty');
68
66
  }
69
67
  var errorList = (Array.isArray(error) ? error : [error]).filter(Boolean);
70
- if (context.ids.length !== valueArr.length) {
71
- context.ids = valueArr.map(function () {
72
- return _hooks.util.generateUUID();
73
- });
74
- }
68
+ // if (context.ids.length !== valueArr.length) {
69
+ // context.ids = valueArr.map(() => util.generateUUID());
70
+ // }
71
+
75
72
  return valueArr.map(function (v, i) {
76
- var _context$ids$i;
77
73
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Provider, {
78
74
  value: {
79
75
  path: "".concat(ProviderValue.path, "[").concat(i, "]"),
@@ -98,7 +94,7 @@ var FormFieldSet = function FormFieldSet(props) {
98
94
  draft.splice(i, 0, val);
99
95
  });
100
96
  _onChange(newValue);
101
- context.ids.splice(i, 0, _hooks.util.generateUUID());
97
+ // context.ids.splice(i, 0, util.generateUUID());
102
98
  formFunc === null || formFunc === void 0 || formFunc.insertError(name, i);
103
99
  },
104
100
  onAppend: function onAppend(val) {
@@ -107,7 +103,7 @@ var FormFieldSet = function FormFieldSet(props) {
107
103
  draft.splice(i + 1, 0, val);
108
104
  });
109
105
  _onChange(newValue);
110
- context.ids.splice(i + 1, 0, _hooks.util.generateUUID());
106
+ // context.ids.splice(i + 1, 0, util.generateUUID());
111
107
  formFunc === null || formFunc === void 0 || formFunc.insertError(name, i + 1);
112
108
  },
113
109
  onRemove: function onRemove() {
@@ -116,11 +112,11 @@ var FormFieldSet = function FormFieldSet(props) {
116
112
  draft.splice(i, 1);
117
113
  });
118
114
  _onChange(newValue);
119
- context.ids.splice(i, 1);
115
+ // context.ids.splice(i, 1);
120
116
  formFunc === null || formFunc === void 0 || formFunc.spliceError(name, i);
121
117
  }
122
118
  })
123
- }, (_context$ids$i = context.ids[i]) !== null && _context$ids$i !== void 0 ? _context$ids$i : i);
119
+ }, i);
124
120
  });
125
121
  };
126
122
  var _default = exports.default = FormFieldSet;
@@ -11,10 +11,8 @@ var produce = util.produce;
11
11
  var FormFieldSet = function FormFieldSet(props) {
12
12
  var children = props.children,
13
13
  empty = props.empty;
14
- var _React$useRef = React.useRef({
15
- ids: []
16
- }),
17
- context = _React$useRef.current;
14
+ // const { current: context } = React.useRef<{ ids: string[] }>({ ids: [] });
15
+
18
16
  var formFunc = useFormFunc();
19
17
  var validateFieldSet = function validateFieldSet() {
20
18
  formFunc === null || formFunc === void 0 || formFunc.validateFields(props.name).catch(function (e) {
@@ -54,19 +52,17 @@ var FormFieldSet = function FormFieldSet(props) {
54
52
  draft.push(val);
55
53
  });
56
54
  _onChange(newValue);
57
- context.ids.push(util.generateUUID());
55
+ // context.ids.push(util.generateUUID());
58
56
  formFunc === null || formFunc === void 0 || formFunc.insertError(name, 0);
59
57
  })
60
58
  }, 'empty');
61
59
  }
62
60
  var errorList = (Array.isArray(error) ? error : [error]).filter(Boolean);
63
- if (context.ids.length !== valueArr.length) {
64
- context.ids = valueArr.map(function () {
65
- return util.generateUUID();
66
- });
67
- }
61
+ // if (context.ids.length !== valueArr.length) {
62
+ // context.ids = valueArr.map(() => util.generateUUID());
63
+ // }
64
+
68
65
  return valueArr.map(function (v, i) {
69
- var _context$ids$i;
70
66
  return /*#__PURE__*/_jsx(Provider, {
71
67
  value: {
72
68
  path: "".concat(ProviderValue.path, "[").concat(i, "]"),
@@ -91,7 +87,7 @@ var FormFieldSet = function FormFieldSet(props) {
91
87
  draft.splice(i, 0, val);
92
88
  });
93
89
  _onChange(newValue);
94
- context.ids.splice(i, 0, util.generateUUID());
90
+ // context.ids.splice(i, 0, util.generateUUID());
95
91
  formFunc === null || formFunc === void 0 || formFunc.insertError(name, i);
96
92
  },
97
93
  onAppend: function onAppend(val) {
@@ -100,7 +96,7 @@ var FormFieldSet = function FormFieldSet(props) {
100
96
  draft.splice(i + 1, 0, val);
101
97
  });
102
98
  _onChange(newValue);
103
- context.ids.splice(i + 1, 0, util.generateUUID());
99
+ // context.ids.splice(i + 1, 0, util.generateUUID());
104
100
  formFunc === null || formFunc === void 0 || formFunc.insertError(name, i + 1);
105
101
  },
106
102
  onRemove: function onRemove() {
@@ -109,11 +105,11 @@ var FormFieldSet = function FormFieldSet(props) {
109
105
  draft.splice(i, 1);
110
106
  });
111
107
  _onChange(newValue);
112
- context.ids.splice(i, 1);
108
+ // context.ids.splice(i, 1);
113
109
  formFunc === null || formFunc === void 0 || formFunc.spliceError(name, i);
114
110
  }
115
111
  })
116
- }, (_context$ids$i = context.ids[i]) !== null && _context$ids$i !== void 0 ? _context$ids$i : i);
112
+ }, i);
117
113
  });
118
114
  };
119
115
  export default FormFieldSet;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/base",
3
- "version": "3.5.5-beta.7",
3
+ "version": "3.5.6-beta.1",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -10,7 +10,7 @@
10
10
  "module": "./esm/index.js",
11
11
  "typings": "./cjs/index.d.ts",
12
12
  "dependencies": {
13
- "@sheinx/hooks": "3.5.5-beta.7",
13
+ "@sheinx/hooks": "3.5.6-beta.1",
14
14
  "immer": "^10.0.0",
15
15
  "classnames": "^2.0.0",
16
16
  "@shined/reactive": "^0.1.3-alpha.0"