@sheinx/hooks 3.2.2-beta.1 → 3.3.0-beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/cjs/components/use-button/use-button.d.ts +1 -1
  2. package/cjs/components/use-form/use-form-fieldset/use-form-fieldset.d.ts +0 -1
  3. package/cjs/components/use-form/use-form-fieldset/use-form-fieldset.d.ts.map +1 -1
  4. package/cjs/components/use-form/use-form-fieldset/use-form-fieldset.js +1 -2
  5. package/cjs/components/use-form/use-form.d.ts +0 -6
  6. package/cjs/components/use-form/use-form.d.ts.map +1 -1
  7. package/cjs/components/use-form/use-form.js +1 -33
  8. package/cjs/components/use-form/use-form.type.d.ts +0 -3
  9. package/cjs/components/use-form/use-form.type.d.ts.map +1 -1
  10. package/cjs/components/use-image/use-image.d.ts +1 -1
  11. package/cjs/utils/index.d.ts +0 -1
  12. package/cjs/utils/index.d.ts.map +1 -1
  13. package/cjs/utils/index.js +1 -8
  14. package/cjs/utils/render.d.ts +1 -1
  15. package/cjs/utils/render.d.ts.map +1 -1
  16. package/cjs/utils/render.js +2 -2
  17. package/esm/components/use-button/use-button.d.ts +1 -1
  18. package/esm/components/use-form/use-form-fieldset/use-form-fieldset.d.ts +0 -1
  19. package/esm/components/use-form/use-form-fieldset/use-form-fieldset.d.ts.map +1 -1
  20. package/esm/components/use-form/use-form-fieldset/use-form-fieldset.js +1 -2
  21. package/esm/components/use-form/use-form.d.ts +0 -6
  22. package/esm/components/use-form/use-form.d.ts.map +1 -1
  23. package/esm/components/use-form/use-form.js +1 -33
  24. package/esm/components/use-form/use-form.type.d.ts +0 -3
  25. package/esm/components/use-form/use-form.type.d.ts.map +1 -1
  26. package/esm/components/use-image/use-image.d.ts +1 -1
  27. package/esm/utils/index.d.ts +0 -1
  28. package/esm/utils/index.d.ts.map +1 -1
  29. package/esm/utils/index.js +1 -3
  30. package/esm/utils/render.d.ts +1 -1
  31. package/esm/utils/render.d.ts.map +1 -1
  32. package/esm/utils/render.js +2 -2
  33. package/package.json +1 -1
  34. package/cjs/utils/flat.d.ts +0 -14
  35. package/cjs/utils/flat.d.ts.map +0 -1
  36. package/cjs/utils/flat.js +0 -94
  37. package/esm/utils/flat.d.ts +0 -14
  38. package/esm/utils/flat.d.ts.map +0 -1
  39. package/esm/utils/flat.js +0 -85
@@ -28,7 +28,7 @@ declare const useButton: (props?: BaseButtonProps) => {
28
28
  buttonRef?: React.Ref<HTMLButtonElement> | undefined;
29
29
  } & TOther_1 & {
30
30
  disabled: boolean | undefined;
31
- htmlType: "submit" | "reset" | "button" | undefined;
31
+ htmlType: "button" | "reset" | "submit" | undefined;
32
32
  onClick: (event: React.MouseEvent<HTMLButtonElement> | React.MouseEvent<HTMLAnchorElement>) => void;
33
33
  };
34
34
  getSpaceChildren: (children: React.ReactNode, space?: boolean, className?: string) => React.ReactNode;
@@ -10,7 +10,6 @@ export declare const useFormFieldSet: <T>(props: BaseFormFieldSetProps<T>) => {
10
10
  error: Error | undefined;
11
11
  value: T | undefined;
12
12
  onChange: (v: T, ...other: any[]) => void;
13
- name: string | (string[] & string);
14
13
  };
15
14
  export default useFormFieldSet;
16
15
  //# sourceMappingURL=use-form-fieldset.d.ts.map
@@ -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;AAKjE,eAAO,MAAM,eAAe;;;;;;;;;;;CA2B3B,CAAC;AAEF,eAAe,eAAe,CAAC"}
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;AAKjE,eAAO,MAAM,eAAe;;;;;;;;;;CA0B3B,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -36,8 +36,7 @@ var useFormFieldSet = exports.useFormFieldSet = function useFormFieldSet(props)
36
36
  ProviderValue: ProviderValue,
37
37
  error: error,
38
38
  value: value,
39
- onChange: onChange,
40
- name: name
39
+ onChange: onChange
41
40
  };
42
41
  };
43
42
  var _default = exports.default = useFormFieldSet;
@@ -20,9 +20,6 @@ declare const useForm: <T extends ObjectType>(props: UseFormProps<T>) => {
20
20
  getErrors: () => ObjectType<Error | undefined>;
21
21
  clearValidate: (names?: string[]) => void;
22
22
  validateFields: (fields?: string | string[], config?: any) => Promise<true>;
23
- validateFieldset: (name: string) => void;
24
- insertError: (name: string, index: number, error?: Error) => void;
25
- spliceError: (name: string, index: number) => void;
26
23
  };
27
24
  };
28
25
  formFunc: {
@@ -38,9 +35,6 @@ declare const useForm: <T extends ObjectType>(props: UseFormProps<T>) => {
38
35
  getErrors: () => ObjectType<Error | undefined>;
39
36
  clearValidate: (names?: string[]) => void;
40
37
  validateFields: (fields?: string | string[], config?: any) => Promise<true>;
41
- validateFieldset: (name: string) => void;
42
- insertError: (name: string, index: number, error?: Error) => void;
43
- spliceError: (name: string, index: number) => void;
44
38
  };
45
39
  };
46
40
  export default useForm;
@@ -1 +1 @@
1
- {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":";AAwBA,OAAO,EAAe,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OAAO;;;;;;;;;wBAgK8B;gBAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;aAAE;8BARzB,MAAM;oCAuDD,OAAO;;6BAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;oCAdrB,MAAM,EAAE;sCArEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;qCAiI5D,MAAM;gCAzCE,MAAM,SAAS,MAAM,UAAU,KAAK;gCAKpC,MAAM,SAAS,MAAM;;;;;;oBA1CpB;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE;0BARzB,MAAM;gCAuDD,OAAO;;yBAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCArEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;iCAiI5D,MAAM;4BAzCE,MAAM,SAAS,MAAM,UAAU,KAAK;4BAKpC,MAAM,SAAS,MAAM;;CA6P9D,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":";AAuBA,OAAO,EAAe,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OAAO;;;;;;;;;wBAsJ8B;gBAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;aAAE;8BARzB,MAAM;oCA6CD,OAAO;;6BALb,MAAM,KAAK,KAAK,GAAG,SAAS;;oCAdrB,MAAM,EAAE;sCArEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;;;;;;oBAmDnD;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE;0BARzB,MAAM;gCA6CD,OAAO;;yBALb,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCArEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;;CAiU7F,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -10,7 +10,6 @@ var _Provider = require("./Provider");
10
10
  var _useLatestObj = _interopRequireDefault(require("../../common/use-latest-obj"));
11
11
  var _usePersistFn = _interopRequireDefault(require("../../common/use-persist-fn"));
12
12
  var _attribute = require("../../utils/attribute");
13
- var _flat = require("../../utils/flat");
14
13
  var _immer = require("../../utils/immer");
15
14
  var _utils = require("../../utils");
16
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -94,15 +93,6 @@ var useForm = function useForm(props) {
94
93
  update();
95
94
  });
96
95
  };
97
- var updateFieldsets = (0, _usePersistFn.default)(function (name) {
98
- var na = "".concat(name, "[");
99
- var no = "".concat(name, ".");
100
- context.names.forEach(function (key) {
101
- if (key.startsWith(na) || key.startsWith(no)) {
102
- update(key);
103
- }
104
- });
105
- });
106
96
  var handleSubmitError = function handleSubmitError(err) {
107
97
  onError === null || onError === void 0 || onError(err);
108
98
  if (!props.scrollToError) return;
@@ -220,14 +210,6 @@ var useForm = function useForm(props) {
220
210
  context.errors[name] = e;
221
211
  update(name);
222
212
  });
223
- var insertError = (0, _usePersistFn.default)(function (name, index, error) {
224
- (0, _flat.insertValue)(context.errors, name, index, error);
225
- updateFieldsets(name);
226
- });
227
- var spliceError = (0, _usePersistFn.default)(function (name, index) {
228
- (0, _flat.spliceValue)(context.errors, name, index);
229
- updateFieldsets(name);
230
- });
231
213
  var submit = (0, _usePersistFn.default)(function () {
232
214
  var withValidate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
233
215
  if (disabled) return;
@@ -284,17 +266,6 @@ var useForm = function useForm(props) {
284
266
  other === null || other === void 0 || (_other$onSubmit = other.onSubmit) === null || _other$onSubmit === void 0 || _other$onSubmit.call(other, e);
285
267
  };
286
268
  };
287
- var validateFieldset = function validateFieldset(name) {
288
- var na = "".concat(name, "[");
289
- var no = "".concat(name, ".");
290
- var fields = [];
291
- context.names.forEach(function (key) {
292
- if (key.startsWith(na) || key.startsWith(no)) {
293
- fields.push(key);
294
- }
295
- });
296
- validateFields(fields).catch(function () {});
297
- };
298
269
  var getDefaultValue = function getDefaultValue() {
299
270
  var v = (0, _immer.produce)(defaultValue, function (draft) {
300
271
  Object.keys(context.defaultValues).forEach(function (key) {
@@ -400,10 +371,7 @@ var useForm = function useForm(props) {
400
371
  setError: setError,
401
372
  getErrors: getErrors,
402
373
  clearValidate: clearValidate,
403
- validateFields: validateFields,
404
- validateFieldset: validateFieldset,
405
- insertError: insertError,
406
- spliceError: spliceError
374
+ validateFields: validateFields
407
375
  });
408
376
  var formConfig = React.useMemo(function () {
409
377
  return {
@@ -80,9 +80,6 @@ export interface FormFunc {
80
80
  validateFields: (fields?: string | string[], config?: {
81
81
  ignoreBind?: boolean;
82
82
  }) => Promise<true>;
83
- validateFieldset: (name: string) => void;
84
- insertError: (name: string, index: number, error?: Error) => void;
85
- spliceError: (name: string, index: number) => void;
86
83
  }
87
84
  interface FormRuleObject<T> {
88
85
  [key: string]: FormRuleObject<T> | FormItemRule<T>;
@@ -1 +1 @@
1
- {"version":3,"file":"use-form.type.d.ts","sourceRoot":"","sources":["use-form.type.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE;QACL,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;QACnD,IAAI,EAAE,CACJ,CAAC,EAAE,MAAM,EACT,EAAE,EAAE,GAAG,EACP,QAAQ,EAAE,CACR,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,GAAG,EACV,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE;YACN,UAAU,CAAC,EAAE,OAAO,CAAC;SACtB,KACE,IAAI,EACT,MAAM,EAAE,CACN,SAAS,EAAE,UAAU,EACrB,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,EACzB,YAAY,EAAE,UAAU,CAAC,KAAK,CAAC,KAC5B,IAAI,KACN,IAAI,CAAC;QACV,YAAY,EAAE,CAAC,SAAS,EACtB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,YAAY,CAAC,SAAS,CAAC,KAC/B,YAAY,CAAC,SAAS,CAAC,C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ACP,CAAC"}
@@ -10,7 +10,7 @@ declare const useImage: (props?: BaseImageProps) => {
10
10
  getRootProps: <TOther extends ObjectType = ObjectType>(externalProps?: TOther) => {
11
11
  [x: string]: (event: any) => void;
12
12
  } & TOther & {
13
- ref: React.RefObject<HTMLAnchorElement | HTMLDivElement>;
13
+ ref: React.RefObject<HTMLDivElement | HTMLAnchorElement>;
14
14
  onClick: (event: React.MouseEvent<HTMLImageElement | HTMLDivElement>) => void;
15
15
  };
16
16
  getImageProps: <TOther_1 extends ObjectType = ObjectType>(externalProps?: TOther_1) => {
@@ -20,5 +20,4 @@ export * from './accept';
20
20
  export * from './array';
21
21
  export * from './tree';
22
22
  export * from './immer';
23
- export * as flat from './flat';
24
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  var _exportNames = {
8
- extractEventHandlers: true,
9
- flat: true
7
+ extractEventHandlers: true
10
8
  };
11
9
  Object.defineProperty(exports, "extractEventHandlers", {
12
10
  enumerable: true,
@@ -14,7 +12,6 @@ Object.defineProperty(exports, "extractEventHandlers", {
14
12
  return _extractEventHandlers.default;
15
13
  }
16
14
  });
17
- exports.flat = void 0;
18
15
  var _is = require("./is");
19
16
  Object.keys(_is).forEach(function (key) {
20
17
  if (key === "default" || key === "__esModule") return;
@@ -268,8 +265,4 @@ Object.keys(_immer).forEach(function (key) {
268
265
  }
269
266
  });
270
267
  });
271
- var _flat = _interopRequireWildcard(require("./flat"));
272
- exports.flat = _flat;
273
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
274
- 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; }
275
268
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  import { KeygenType } from '../common/type';
3
3
  export type renderFunc<T extends any[]> = (...args: T) => React.ReactNode;
4
4
  export declare const render: <T extends any[]>(r: string | renderFunc<T> | undefined, ...args: T) => any;
5
- export declare function getKey<T>(gen: KeygenType<T> | undefined, d: T, index?: number, ignoreError?: boolean): string | number;
5
+ export declare function getKey<T>(gen: KeygenType<T> | undefined, d: T, index?: number): string | number;
6
6
  //# sourceMappingURL=render.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;AAE1E,eAAO,MAAM,MAAM,6EAIlB,CAAC;AAQF,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,mBAMpG"}
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;AAE1E,eAAO,MAAM,MAAM,6EAIlB,CAAC;AAQF,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,mBAM7E"}
@@ -20,9 +20,9 @@ function $getKey(gen, d, index) {
20
20
  if (typeof gen === 'function') return gen(d, index);
21
21
  return index;
22
22
  }
23
- function getKey(gen, d, index, ignoreError) {
23
+ function getKey(gen, d, index) {
24
24
  var key = $getKey(gen, d, index);
25
- if (typeof key !== 'string' && typeof key !== 'number' && !ignoreError) {
25
+ if (typeof key !== 'string' && typeof key !== 'number') {
26
26
  console.error(new Error("keygen result expect a string or a number, get '".concat(_typeof(key), "'")));
27
27
  }
28
28
  return key;
@@ -28,7 +28,7 @@ declare const useButton: (props?: BaseButtonProps) => {
28
28
  buttonRef?: React.Ref<HTMLButtonElement> | undefined;
29
29
  } & TOther_1 & {
30
30
  disabled: boolean | undefined;
31
- htmlType: "submit" | "reset" | "button" | undefined;
31
+ htmlType: "button" | "reset" | "submit" | undefined;
32
32
  onClick: (event: React.MouseEvent<HTMLButtonElement> | React.MouseEvent<HTMLAnchorElement>) => void;
33
33
  };
34
34
  getSpaceChildren: (children: React.ReactNode, space?: boolean, className?: string) => React.ReactNode;
@@ -10,7 +10,6 @@ export declare const useFormFieldSet: <T>(props: BaseFormFieldSetProps<T>) => {
10
10
  error: Error | undefined;
11
11
  value: T | undefined;
12
12
  onChange: (v: T, ...other: any[]) => void;
13
- name: string | (string[] & string);
14
13
  };
15
14
  export default useFormFieldSet;
16
15
  //# sourceMappingURL=use-form-fieldset.d.ts.map
@@ -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;AAKjE,eAAO,MAAM,eAAe;;;;;;;;;;;CA2B3B,CAAC;AAEF,eAAe,eAAe,CAAC"}
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;AAKjE,eAAO,MAAM,eAAe;;;;;;;;;;CA0B3B,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -29,8 +29,7 @@ export var useFormFieldSet = function useFormFieldSet(props) {
29
29
  ProviderValue: ProviderValue,
30
30
  error: error,
31
31
  value: value,
32
- onChange: onChange,
33
- name: name
32
+ onChange: onChange
34
33
  };
35
34
  };
36
35
  export default useFormFieldSet;
@@ -20,9 +20,6 @@ declare const useForm: <T extends ObjectType>(props: UseFormProps<T>) => {
20
20
  getErrors: () => ObjectType<Error | undefined>;
21
21
  clearValidate: (names?: string[]) => void;
22
22
  validateFields: (fields?: string | string[], config?: any) => Promise<true>;
23
- validateFieldset: (name: string) => void;
24
- insertError: (name: string, index: number, error?: Error) => void;
25
- spliceError: (name: string, index: number) => void;
26
23
  };
27
24
  };
28
25
  formFunc: {
@@ -38,9 +35,6 @@ declare const useForm: <T extends ObjectType>(props: UseFormProps<T>) => {
38
35
  getErrors: () => ObjectType<Error | undefined>;
39
36
  clearValidate: (names?: string[]) => void;
40
37
  validateFields: (fields?: string | string[], config?: any) => Promise<true>;
41
- validateFieldset: (name: string) => void;
42
- insertError: (name: string, index: number, error?: Error) => void;
43
- spliceError: (name: string, index: number) => void;
44
38
  };
45
39
  };
46
40
  export default useForm;
@@ -1 +1 @@
1
- {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":";AAwBA,OAAO,EAAe,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OAAO;;;;;;;;;wBAgK8B;gBAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;aAAE;8BARzB,MAAM;oCAuDD,OAAO;;6BAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;oCAdrB,MAAM,EAAE;sCArEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;qCAiI5D,MAAM;gCAzCE,MAAM,SAAS,MAAM,UAAU,KAAK;gCAKpC,MAAM,SAAS,MAAM;;;;;;oBA1CpB;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE;0BARzB,MAAM;gCAuDD,OAAO;;yBAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCArEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;iCAiI5D,MAAM;4BAzCE,MAAM,SAAS,MAAM,UAAU,KAAK;4BAKpC,MAAM,SAAS,MAAM;;CA6P9D,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":";AAuBA,OAAO,EAAe,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OAAO;;;;;;;;;wBAsJ8B;gBAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;aAAE;8BARzB,MAAM;oCA6CD,OAAO;;6BALb,MAAM,KAAK,KAAK,GAAG,SAAS;;oCAdrB,MAAM,EAAE;sCArEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;;;;;;oBAmDnD;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE;0BARzB,MAAM;gCA6CD,OAAO;;yBALb,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCArEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;;CAiU7F,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -12,7 +12,6 @@ import { Provider } from "./Provider";
12
12
  import useLatestObj from "../../common/use-latest-obj";
13
13
  import usePersistFn from "../../common/use-persist-fn";
14
14
  import { getDataAttributeName } from "../../utils/attribute";
15
- import { insertValue, spliceValue } from "../../utils/flat";
16
15
  var globalKey = '__global__&&@@';
17
16
  import { current, produce } from "../../utils/immer";
18
17
  import { deepGet, deepRemove, deepSet, docScroll, extractEventHandlers, isArray, isObject, shallowEqual, wrapFormError, deepClone } from "../../utils";
@@ -85,15 +84,6 @@ var useForm = function useForm(props) {
85
84
  update();
86
85
  });
87
86
  };
88
- var updateFieldsets = usePersistFn(function (name) {
89
- var na = "".concat(name, "[");
90
- var no = "".concat(name, ".");
91
- context.names.forEach(function (key) {
92
- if (key.startsWith(na) || key.startsWith(no)) {
93
- update(key);
94
- }
95
- });
96
- });
97
87
  var handleSubmitError = function handleSubmitError(err) {
98
88
  onError === null || onError === void 0 || onError(err);
99
89
  if (!props.scrollToError) return;
@@ -211,14 +201,6 @@ var useForm = function useForm(props) {
211
201
  context.errors[name] = e;
212
202
  update(name);
213
203
  });
214
- var insertError = usePersistFn(function (name, index, error) {
215
- insertValue(context.errors, name, index, error);
216
- updateFieldsets(name);
217
- });
218
- var spliceError = usePersistFn(function (name, index) {
219
- spliceValue(context.errors, name, index);
220
- updateFieldsets(name);
221
- });
222
204
  var submit = usePersistFn(function () {
223
205
  var withValidate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
224
206
  if (disabled) return;
@@ -275,17 +257,6 @@ var useForm = function useForm(props) {
275
257
  other === null || other === void 0 || (_other$onSubmit = other.onSubmit) === null || _other$onSubmit === void 0 || _other$onSubmit.call(other, e);
276
258
  };
277
259
  };
278
- var validateFieldset = function validateFieldset(name) {
279
- var na = "".concat(name, "[");
280
- var no = "".concat(name, ".");
281
- var fields = [];
282
- context.names.forEach(function (key) {
283
- if (key.startsWith(na) || key.startsWith(no)) {
284
- fields.push(key);
285
- }
286
- });
287
- validateFields(fields).catch(function () {});
288
- };
289
260
  var getDefaultValue = function getDefaultValue() {
290
261
  var v = produce(defaultValue, function (draft) {
291
262
  Object.keys(context.defaultValues).forEach(function (key) {
@@ -391,10 +362,7 @@ var useForm = function useForm(props) {
391
362
  setError: setError,
392
363
  getErrors: getErrors,
393
364
  clearValidate: clearValidate,
394
- validateFields: validateFields,
395
- validateFieldset: validateFieldset,
396
- insertError: insertError,
397
- spliceError: spliceError
365
+ validateFields: validateFields
398
366
  });
399
367
  var formConfig = React.useMemo(function () {
400
368
  return {
@@ -80,9 +80,6 @@ export interface FormFunc {
80
80
  validateFields: (fields?: string | string[], config?: {
81
81
  ignoreBind?: boolean;
82
82
  }) => Promise<true>;
83
- validateFieldset: (name: string) => void;
84
- insertError: (name: string, index: number, error?: Error) => void;
85
- spliceError: (name: string, index: number) => void;
86
83
  }
87
84
  interface FormRuleObject<T> {
88
85
  [key: string]: FormRuleObject<T> | FormItemRule<T>;
@@ -1 +1 @@
1
- {"version":3,"file":"use-form.type.d.ts","sourceRoot":"","sources":["use-form.type.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE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,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,UAAU,GAAG,SAAS,CAAC;IAElC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IAEjB,SAAS,EAAE,UAAU,CAAC;IAEtB,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;IACrC,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;IACtC,YAAY,EAAE,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;IAC5C,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,GAAG,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,UAAU,CACzE,mBAAmB,EACnB,MAAM,CACP,CAAC"}
@@ -10,7 +10,7 @@ declare const useImage: (props?: BaseImageProps) => {
10
10
  getRootProps: <TOther extends ObjectType = ObjectType>(externalProps?: TOther) => {
11
11
  [x: string]: (event: any) => void;
12
12
  } & TOther & {
13
- ref: React.RefObject<HTMLAnchorElement | HTMLDivElement>;
13
+ ref: React.RefObject<HTMLDivElement | HTMLAnchorElement>;
14
14
  onClick: (event: React.MouseEvent<HTMLImageElement | HTMLDivElement>) => void;
15
15
  };
16
16
  getImageProps: <TOther_1 extends ObjectType = ObjectType>(externalProps?: TOther_1) => {
@@ -20,5 +20,4 @@ export * from './accept';
20
20
  export * from './array';
21
21
  export * from './tree';
22
22
  export * from './immer';
23
- export * as flat from './flat';
24
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AA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xB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
@@ -19,6 +19,4 @@ export * from "./attribute";
19
19
  export * from "./accept";
20
20
  export * from "./array";
21
21
  export * from "./tree";
22
- export * from "./immer";
23
- import * as _flat from "./flat";
24
- export { _flat as flat };
22
+ export * from "./immer";
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  import { KeygenType } from '../common/type';
3
3
  export type renderFunc<T extends any[]> = (...args: T) => React.ReactNode;
4
4
  export declare const render: <T extends any[]>(r: string | renderFunc<T> | undefined, ...args: T) => any;
5
- export declare function getKey<T>(gen: KeygenType<T> | undefined, d: T, index?: number, ignoreError?: boolean): string | number;
5
+ export declare function getKey<T>(gen: KeygenType<T> | undefined, d: T, index?: number): string | number;
6
6
  //# sourceMappingURL=render.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;AAE1E,eAAO,MAAM,MAAM,6EAIlB,CAAC;AAQF,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,mBAMpG"}
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;AAE1E,eAAO,MAAM,MAAM,6EAIlB,CAAC;AAQF,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,mBAM7E"}
@@ -13,9 +13,9 @@ function $getKey(gen, d, index) {
13
13
  if (typeof gen === 'function') return gen(d, index);
14
14
  return index;
15
15
  }
16
- export function getKey(gen, d, index, ignoreError) {
16
+ export function getKey(gen, d, index) {
17
17
  var key = $getKey(gen, d, index);
18
- if (typeof key !== 'string' && typeof key !== 'number' && !ignoreError) {
18
+ if (typeof key !== 'string' && typeof key !== 'number') {
19
19
  console.error(new Error("keygen result expect a string or a number, get '".concat(_typeof(key), "'")));
20
20
  }
21
21
  return key;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/hooks",
3
- "version": "3.2.2-beta.1",
3
+ "version": "3.3.0-beta.2",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -1,14 +0,0 @@
1
- export type insertObject = {
2
- [x: string]: any;
3
- };
4
- export declare function insertPoint(name: string): string;
5
- export type Result = {
6
- [x: string]: any;
7
- };
8
- export declare function flatten(data: Result, skipArray?: boolean): Result;
9
- export declare function insertValue(obj: insertObject, name: string, index: number, value: any): void;
10
- export type SpliceValue = {
11
- [x: string]: any;
12
- };
13
- export declare function spliceValue(obj: SpliceValue, name: keyof SpliceValue & string, index: number): void;
14
- //# sourceMappingURL=flat.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"flat.d.ts","sourceRoot":"","sources":["flat.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,YAAY,GAAG;IACzB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB,CAAC;AAEF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,UAGvC;AAED,MAAM,MAAM,MAAM,GAAG;IACnB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB,CAAC;AAEF,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,UAuCxD;AACD,wBAAgB,WAAW,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,QAmBrF;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB,CAAC;AAEF,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,WAAW,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM,QAyB5F"}
package/cjs/utils/flat.js DELETED
@@ -1,94 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.flatten = flatten;
7
- exports.insertPoint = insertPoint;
8
- exports.insertValue = insertValue;
9
- exports.spliceValue = spliceValue;
10
- var _is = require("./is");
11
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
13
- 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); }
14
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
15
- function insertPoint(name) {
16
- var reg = /(\[\d+\])/gi;
17
- return name.replace(reg, function (s, m, i) {
18
- return s.replace(m, i === 0 ? m : ".".concat(m));
19
- });
20
- }
21
- function flatten(data, skipArray) {
22
- if ((0, _is.isEmpty)(data)) return data;
23
- var result = {};
24
- function recurse(cur, prop) {
25
- if (Object(cur) !== cur || typeof cur === 'function' || cur instanceof Date || cur instanceof Error || skipArray && Array.isArray(cur)) {
26
- if (!(cur === undefined && /\[\d+\]$/.test(prop))) {
27
- result[prop] = cur;
28
- }
29
- } else if (Array.isArray(cur)) {
30
- if (cur.length === 0) {
31
- result[prop] = [];
32
- } else {
33
- for (var i = 0, l = cur.length; i < l; i++) {
34
- recurse(cur[i], prop ? "".concat(prop, "[").concat(i, "]") : "[".concat(i, "]"));
35
- }
36
- }
37
- } else {
38
- var empty = true;
39
- if (_typeof(cur) === 'object') {
40
- // eslint-disable-next-line
41
- for (var p in cur) {
42
- empty = false;
43
- recurse(cur[p], prop ? "".concat(prop, ".").concat(p) : p);
44
- }
45
- if (empty) {
46
- result[prop] = {};
47
- }
48
- }
49
- }
50
- }
51
- recurse(data, '');
52
- return result;
53
- }
54
- function insertValue(obj, name, index, value) {
55
- Object.keys(obj).filter(function (n) {
56
- return n.indexOf("".concat(name, "[")) === 0;
57
- }).sort().reverse().forEach(function (n) {
58
- // const reg = new RegExp(`${name}\\[(\\d+)\\]`)
59
- var reg = new RegExp("".concat(name.replace(/\[/g, '\\[').replace(/\]/g, '\\]'), "\\[(\\d+)\\]"));
60
- var match = reg.exec(n);
61
- var i = parseInt(match[1], 10);
62
- if (i < index) return;
63
- var newName = n.replace(reg, "".concat(name, "[").concat(i + 1, "]"));
64
- if (obj[n]) obj[newName] = obj[n];
65
- delete obj[n];
66
- });
67
- var newValue = flatten(_defineProperty({}, "".concat(name, "[").concat(index, "]"), value));
68
- Object.keys(newValue).forEach(function (k) {
69
- if (newValue[k] !== undefined) obj[k] = newValue[k];
70
- });
71
- }
72
- function spliceValue(obj, name, index) {
73
- var names = Object.keys(obj).filter(function (n) {
74
- return n === name || n.indexOf("".concat(name, "[")) === 0;
75
- }).sort();
76
- names.forEach(function (n) {
77
- if (n === name && !Array.isArray(obj[name])) return;
78
- if (n === name && Array.isArray(obj[name])) {
79
- obj[name].splice(index, 1);
80
- return;
81
- }
82
- var reg = new RegExp("".concat(name.replace(/\[/g, '\\[').replace(/\]/g, '\\]'), "\\[(\\d+)\\]"));
83
- var match = reg.exec(n);
84
- var i = parseInt(match[1], 10);
85
- if (i < index) return;
86
- if (i === index) {
87
- delete obj[n];
88
- return;
89
- }
90
- var newName = n.replace(reg, "".concat(name, "[").concat(i - 1, "]"));
91
- obj[newName] = obj[n];
92
- delete obj[n];
93
- });
94
- }
@@ -1,14 +0,0 @@
1
- export type insertObject = {
2
- [x: string]: any;
3
- };
4
- export declare function insertPoint(name: string): string;
5
- export type Result = {
6
- [x: string]: any;
7
- };
8
- export declare function flatten(data: Result, skipArray?: boolean): Result;
9
- export declare function insertValue(obj: insertObject, name: string, index: number, value: any): void;
10
- export type SpliceValue = {
11
- [x: string]: any;
12
- };
13
- export declare function spliceValue(obj: SpliceValue, name: keyof SpliceValue & string, index: number): void;
14
- //# sourceMappingURL=flat.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"flat.d.ts","sourceRoot":"","sources":["flat.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,YAAY,GAAG;IACzB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB,CAAC;AAEF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,UAGvC;AAED,MAAM,MAAM,MAAM,GAAG;IACnB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB,CAAC;AAEF,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,UAuCxD;AACD,wBAAgB,WAAW,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,QAmBrF;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB,CAAC;AAEF,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,WAAW,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM,QAyB5F"}
package/esm/utils/flat.js DELETED
@@ -1,85 +0,0 @@
1
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
3
- 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); }
4
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
5
- import { isEmpty } from "./is";
6
- export function insertPoint(name) {
7
- var reg = /(\[\d+\])/gi;
8
- return name.replace(reg, function (s, m, i) {
9
- return s.replace(m, i === 0 ? m : ".".concat(m));
10
- });
11
- }
12
- export function flatten(data, skipArray) {
13
- if (isEmpty(data)) return data;
14
- var result = {};
15
- function recurse(cur, prop) {
16
- if (Object(cur) !== cur || typeof cur === 'function' || cur instanceof Date || cur instanceof Error || skipArray && Array.isArray(cur)) {
17
- if (!(cur === undefined && /\[\d+\]$/.test(prop))) {
18
- result[prop] = cur;
19
- }
20
- } else if (Array.isArray(cur)) {
21
- if (cur.length === 0) {
22
- result[prop] = [];
23
- } else {
24
- for (var i = 0, l = cur.length; i < l; i++) {
25
- recurse(cur[i], prop ? "".concat(prop, "[").concat(i, "]") : "[".concat(i, "]"));
26
- }
27
- }
28
- } else {
29
- var empty = true;
30
- if (_typeof(cur) === 'object') {
31
- // eslint-disable-next-line
32
- for (var p in cur) {
33
- empty = false;
34
- recurse(cur[p], prop ? "".concat(prop, ".").concat(p) : p);
35
- }
36
- if (empty) {
37
- result[prop] = {};
38
- }
39
- }
40
- }
41
- }
42
- recurse(data, '');
43
- return result;
44
- }
45
- export function insertValue(obj, name, index, value) {
46
- Object.keys(obj).filter(function (n) {
47
- return n.indexOf("".concat(name, "[")) === 0;
48
- }).sort().reverse().forEach(function (n) {
49
- // const reg = new RegExp(`${name}\\[(\\d+)\\]`)
50
- var reg = new RegExp("".concat(name.replace(/\[/g, '\\[').replace(/\]/g, '\\]'), "\\[(\\d+)\\]"));
51
- var match = reg.exec(n);
52
- var i = parseInt(match[1], 10);
53
- if (i < index) return;
54
- var newName = n.replace(reg, "".concat(name, "[").concat(i + 1, "]"));
55
- if (obj[n]) obj[newName] = obj[n];
56
- delete obj[n];
57
- });
58
- var newValue = flatten(_defineProperty({}, "".concat(name, "[").concat(index, "]"), value));
59
- Object.keys(newValue).forEach(function (k) {
60
- if (newValue[k] !== undefined) obj[k] = newValue[k];
61
- });
62
- }
63
- export function spliceValue(obj, name, index) {
64
- var names = Object.keys(obj).filter(function (n) {
65
- return n === name || n.indexOf("".concat(name, "[")) === 0;
66
- }).sort();
67
- names.forEach(function (n) {
68
- if (n === name && !Array.isArray(obj[name])) return;
69
- if (n === name && Array.isArray(obj[name])) {
70
- obj[name].splice(index, 1);
71
- return;
72
- }
73
- var reg = new RegExp("".concat(name.replace(/\[/g, '\\[').replace(/\]/g, '\\]'), "\\[(\\d+)\\]"));
74
- var match = reg.exec(n);
75
- var i = parseInt(match[1], 10);
76
- if (i < index) return;
77
- if (i === index) {
78
- delete obj[n];
79
- return;
80
- }
81
- var newName = n.replace(reg, "".concat(name, "[").concat(i - 1, "]"));
82
- obj[newName] = obj[n];
83
- delete obj[n];
84
- });
85
- }