@sheinx/hooks 3.9.0-beta.2 → 3.9.0-beta.20

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.
Files changed (65) hide show
  1. package/cjs/common/use-filter/use-filter.type.d.ts +1 -1
  2. package/cjs/common/use-filter/use-filter.type.d.ts.map +1 -1
  3. package/cjs/components/use-button/use-button.d.ts +2 -2
  4. package/cjs/components/use-carousel/use-carousel.d.ts +12 -0
  5. package/cjs/components/use-carousel/use-carousel.d.ts.map +1 -1
  6. package/cjs/components/use-carousel/use-carousel.js +67 -17
  7. package/cjs/components/use-form/use-form.type.d.ts +1 -1
  8. package/cjs/components/use-form/use-form.type.d.ts.map +1 -1
  9. package/cjs/components/use-input/use-input-format.d.ts +1 -1
  10. package/cjs/components/use-input/use-input-number.d.ts +1 -1
  11. package/cjs/components/use-table/use-table-columns.d.ts +8 -1
  12. package/cjs/components/use-table/use-table-columns.d.ts.map +1 -1
  13. package/cjs/components/use-table/use-table-columns.js +90 -1
  14. package/cjs/components/use-table/use-table-filter.d.ts +2 -2
  15. package/cjs/components/use-table/use-table-filter.d.ts.map +1 -1
  16. package/cjs/components/use-table/use-table-filter.js +11 -5
  17. package/cjs/components/use-table/use-table-virtual.d.ts +2 -0
  18. package/cjs/components/use-table/use-table-virtual.d.ts.map +1 -1
  19. package/cjs/components/use-table/use-table-virtual.js +44 -10
  20. package/cjs/components/use-tree/use-tree.d.ts +0 -1
  21. package/cjs/components/use-tree/use-tree.d.ts.map +1 -1
  22. package/cjs/components/use-tree/use-tree.js +3 -11
  23. package/cjs/utils/dom/get-dataset.d.ts +4 -0
  24. package/cjs/utils/dom/get-dataset.d.ts.map +1 -0
  25. package/cjs/utils/dom/get-dataset.js +18 -0
  26. package/cjs/utils/dom/index.d.ts +1 -0
  27. package/cjs/utils/dom/index.d.ts.map +1 -1
  28. package/cjs/utils/dom/index.js +12 -0
  29. package/cjs/utils/rule/regexp.d.ts +1 -1
  30. package/cjs/utils/rule/required.d.ts.map +1 -1
  31. package/cjs/utils/rule/required.js +3 -1
  32. package/cjs/utils/validate/get-rule.js +1 -1
  33. package/esm/common/use-filter/use-filter.type.d.ts +1 -1
  34. package/esm/common/use-filter/use-filter.type.d.ts.map +1 -1
  35. package/esm/components/use-button/use-button.d.ts +2 -2
  36. package/esm/components/use-carousel/use-carousel.d.ts +12 -0
  37. package/esm/components/use-carousel/use-carousel.d.ts.map +1 -1
  38. package/esm/components/use-carousel/use-carousel.js +67 -17
  39. package/esm/components/use-form/use-form.type.d.ts +1 -1
  40. package/esm/components/use-form/use-form.type.d.ts.map +1 -1
  41. package/esm/components/use-input/use-input-format.d.ts +1 -1
  42. package/esm/components/use-input/use-input-number.d.ts +1 -1
  43. package/esm/components/use-table/use-table-columns.d.ts +8 -1
  44. package/esm/components/use-table/use-table-columns.d.ts.map +1 -1
  45. package/esm/components/use-table/use-table-columns.js +91 -2
  46. package/esm/components/use-table/use-table-filter.d.ts +2 -2
  47. package/esm/components/use-table/use-table-filter.d.ts.map +1 -1
  48. package/esm/components/use-table/use-table-filter.js +11 -5
  49. package/esm/components/use-table/use-table-virtual.d.ts +2 -0
  50. package/esm/components/use-table/use-table-virtual.d.ts.map +1 -1
  51. package/esm/components/use-table/use-table-virtual.js +44 -10
  52. package/esm/components/use-tree/use-tree.d.ts +0 -1
  53. package/esm/components/use-tree/use-tree.d.ts.map +1 -1
  54. package/esm/components/use-tree/use-tree.js +3 -11
  55. package/esm/utils/dom/get-dataset.d.ts +4 -0
  56. package/esm/utils/dom/get-dataset.d.ts.map +1 -0
  57. package/esm/utils/dom/get-dataset.js +12 -0
  58. package/esm/utils/dom/index.d.ts +1 -0
  59. package/esm/utils/dom/index.d.ts.map +1 -1
  60. package/esm/utils/dom/index.js +1 -0
  61. package/esm/utils/rule/regexp.d.ts +1 -1
  62. package/esm/utils/rule/required.d.ts.map +1 -1
  63. package/esm/utils/rule/required.js +3 -1
  64. package/esm/utils/validate/get-rule.js +1 -1
  65. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"use-table-virtual.d.ts","sourceRoot":"","sources":["use-table-virtual.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAWrD,UAAU,oBAAoB;IAC5B,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC3C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AACD,QAAA,MAAM,eAAe,UAAW,oBAAoB;;;;;;oBAqLpC,MAAM;mBACP,MAAM;WACd,MAAM;gBACD,MAAM;kBACJ,OAAO;;0BAnGuB,MAAM,UAAU,MAAM;2BAsIrB,MAAM,aAAa,MAAM,IAAI;qCAoBnB,MAAM;mCAUR,MAAM,GAAG,MAAM;;;;;CA2GnE,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"use-table-virtual.d.ts","sourceRoot":"","sources":["use-table-virtual.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAWrD,UAAU,oBAAoB;IAC5B,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC3B,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC3C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AACD,QAAA,MAAM,eAAe,UAAW,oBAAoB;;;;;;oBAoNpC,MAAM;mBACP,MAAM;WACd,MAAM;gBACD,MAAM;kBACJ,OAAO;;0BArHuB,MAAM,UAAU,MAAM;2BAwJrB,MAAM,aAAa,MAAM,IAAI;qCAoBnB,MAAM;mCAUR,MAAM,GAAG,MAAM;;;;;CA4GnE,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -29,11 +29,14 @@ function getMaxRowSpanLength(input) {
29
29
  return Math.max.apply(Math, _toConsumableArray(Array.from(map.values())));
30
30
  }
31
31
  var useTableVirtual = function useTableVirtual(props) {
32
+ var _props$scrollRef$curr;
32
33
  var _useState = useState(0),
33
34
  _useState2 = _slicedToArray(_useState, 2),
34
35
  innerTop = _useState2[0],
35
36
  setTop = _useState2[1];
36
- var _useState3 = useState(props.data.length * props.rowHeight),
37
+ var strictRowHeight = props.strictRowHeight ? props.strictRowHeight : 0;
38
+ var defaultScrollHeight = strictRowHeight ? props.data.length * strictRowHeight : props.data.length * props.rowHeight;
39
+ var _useState3 = useState(defaultScrollHeight),
37
40
  _useState4 = _slicedToArray(_useState3, 2),
38
41
  scrollHeight = _useState4[0],
39
42
  setHeight = _useState4[1];
@@ -45,6 +48,15 @@ var useTableVirtual = function useTableVirtual(props) {
45
48
  _useState8 = _slicedToArray(_useState7, 2),
46
49
  offsetY = _useState8[0],
47
50
  setOffsetY = _useState8[1];
51
+
52
+ // TODO: 尝试垂直滚动采用延迟销毁 + 操作dom transform方案提升性能?
53
+ // const setTop = (v: number) => {
54
+ // if (props.virtual === 'lazy') {
55
+ // props.innerRef.current && (props.innerRef.current.style.transform = `translate3d(0, ${-v}px, 0)`);
56
+ // } else {
57
+ // }
58
+ // _setTop(v);
59
+ // }
48
60
  var rowsInView = props.rowsInView === 0 ? props.data.length : props.rowsInView;
49
61
  var rowSpanInfo = useMemo(function () {
50
62
  var rowSpanColumns = props.columns.filter(function (col) {
@@ -119,6 +131,9 @@ var useTableVirtual = function useTableVirtual(props) {
119
131
  context = _useRef.current;
120
132
  var getContentHeight = function getContentHeight(index) {
121
133
  if (props.disabled) return 0;
134
+ if (strictRowHeight) {
135
+ return strictRowHeight * (index + 1) + props.theadHeight + props.tfootHeight;
136
+ }
122
137
  var sum = 0;
123
138
  for (var i = 0; i <= index; i++) {
124
139
  sum += context.cachedHeight[i] || props.rowHeight;
@@ -144,17 +159,26 @@ var useTableVirtual = function useTableVirtual(props) {
144
159
  });
145
160
  }
146
161
  });
162
+
163
+ // const setStartIndex2 = (index:number) => {
164
+ // let sum = 0;
165
+ // for (let i = 0; i < index; i++) {
166
+ // sum += context.cachedHeight[i] || props.rowHeight;
167
+ // }
168
+ // props.innerRef.current && (props.innerRef.current.style.transform = `translate3d(0, ${-innerTop + sum}px, 0)`);
169
+ // setStartIndex(index);
170
+ // }
171
+
172
+ var maxIndex = Math.max(props.data.length - rowsInView, 0);
173
+ var scrollContainerHeight = Math.max(((_props$scrollRef$curr = props.scrollRef.current) === null || _props$scrollRef$curr === void 0 ? void 0 : _props$scrollRef$curr.clientHeight) || 0, 200);
147
174
  var updateIndexAndTopFromTop = function updateIndexAndTopFromTop(scrollTop, fromDrag) {
148
- var _props$scrollRef$curr;
149
175
  if (props.disabled) return;
150
176
  var sum = 0;
151
177
  var currentIndex = 0;
152
178
  var top = 0;
153
- var maxIndex = Math.max(props.data.length - rowsInView, 0);
154
- var scrollContainerHeight = Math.max(((_props$scrollRef$curr = props.scrollRef.current) === null || _props$scrollRef$curr === void 0 ? void 0 : _props$scrollRef$curr.clientHeight) || 0, 200);
155
179
  for (var i = 0; i <= maxIndex; i++) {
156
180
  context.rowSpanRows = 0;
157
- var currentRowHeight = context.cachedHeight[i] || props.rowHeight;
181
+ var currentRowHeight = strictRowHeight || context.cachedHeight[i] || props.rowHeight;
158
182
  sum += currentRowHeight;
159
183
  var rowSpanHeight = 0;
160
184
  if (rowSpanInfo) {
@@ -169,17 +193,26 @@ var useTableVirtual = function useTableVirtual(props) {
169
193
  if (rowSpanHeight < scrollContainerHeight) {
170
194
  var index = siblingsIndexs[j];
171
195
  context.rowSpanRows += 1;
172
- rowSpanHeight += context.cachedHeight[index] || props.rowHeight;
196
+ rowSpanHeight += strictRowHeight || context.cachedHeight[index] || props.rowHeight;
173
197
  }
174
198
  }
175
199
  }
176
200
  if (scrollTop < sum + rowSpanHeight || i === maxIndex) {
177
201
  currentIndex = i;
178
- var beforeHeight = i === 0 ? 0 : sum - (context.cachedHeight[i] || props.rowHeight);
202
+ var beforeHeight = i === 0 ? 0 : sum - (strictRowHeight || context.cachedHeight[i] || props.rowHeight);
179
203
  top = scrollTop - beforeHeight;
180
204
  break;
181
205
  }
182
206
  }
207
+ // if (props.virtual === 'lazy') {
208
+ // setTop(scrollTop);
209
+ // context.autoAddRows = currentIndex
210
+ // setTimeout(() => {
211
+ // setStartIndex2(currentIndex);
212
+ // context.autoAddRows = 0
213
+ // }, 300);
214
+ // return;
215
+ // }
183
216
  if (currentIndex !== startIndex) {
184
217
  setStartIndex(currentIndex);
185
218
 
@@ -308,16 +341,16 @@ var useTableVirtual = function useTableVirtual(props) {
308
341
  var addonHeight = 0;
309
342
  var addonCount = 0;
310
343
  for (var i = startIndex + rowsInView; i < props.data.length; i++) {
311
- var height = context.cachedHeight[i] || props.rowHeight;
344
+ var height = strictRowHeight || context.cachedHeight[i] || props.rowHeight;
312
345
  addonHeight += height;
313
346
  addonCount += 1;
314
- if (addonHeight >= remainHeight + context.cachedHeight[0]) break;
347
+ if (addonHeight >= remainHeight + (strictRowHeight || context.cachedHeight[0])) break;
315
348
  }
316
349
  if (addonCount > 0) {
317
350
  context.autoAddRows = addonCount;
318
351
  }
319
352
  }
320
- }, []);
353
+ }, [props.data.length]);
321
354
  useEffect(function () {
322
355
  // 记录preIndex
323
356
  context.preIndex = startIndex;
@@ -360,6 +393,7 @@ var useTableVirtual = function useTableVirtual(props) {
360
393
  return _toConsumableArray(props.data).slice(startIndex, startIndex + finalRowsInView);
361
394
  }, [props.data, props.disabled, startIndex, finalRowsInView]);
362
395
  var translateStyle = useMemo(function () {
396
+ // if (props.virtual === 'lazy') return 'translate3d(0, 0, 0)';
363
397
  var t = innerTop + offsetY;
364
398
  if (t < 0) {
365
399
  t = 0;
@@ -23,7 +23,6 @@ export declare const MODE: {
23
23
  MODE_4: number;
24
24
  };
25
25
  declare const useTree: <DataItem>(props: BaseTreeProps<DataItem>) => {
26
- inited: boolean;
27
26
  datum: TreeDatum<DataItem>;
28
27
  expanded: KeygenResult[] | undefined;
29
28
  onExpand: (value: KeygenResult[]) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["use-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAKb,SAAS,EAIV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAiBjD,eAAO,MAAM,IAAI;IACf;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEJ,CAAC;AAEF,QAAA,MAAM,OAAO;;;;;CAotBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["use-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAKb,SAAS,EAIV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAiBjD,eAAO,MAAM,IAAI;IACf;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEJ,CAAC;AAEF,QAAA,MAAM,OAAO;;;;CA+sBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -71,14 +71,10 @@ var useTree = function useTree(props) {
71
71
  onExpandProp = props.onExpand;
72
72
  var disabledProps = isOptionalDisabled(props.disabled) ? props.disabled.disabled : props.disabled;
73
73
  var isRealtime = isOptionalDisabled(props.disabled) ? props.disabled.isRealtime : false;
74
- var _useState = useState(false),
74
+ var _useState = useState([]),
75
75
  _useState2 = _slicedToArray(_useState, 2),
76
- inited = _useState2[0],
77
- setInited = _useState2[1];
78
- var _useState3 = useState([]),
79
- _useState4 = _slicedToArray(_useState3, 2),
80
- dataFlat = _useState4[0],
81
- setDataFlat = _useState4[1];
76
+ dataFlat = _useState2[0],
77
+ setDataFlat = _useState2[1];
82
78
  var _useInputAble = useInputAble({
83
79
  value: expandedProp,
84
80
  defaultValue: defaultExpanded,
@@ -659,9 +655,6 @@ var useTree = function useTree(props) {
659
655
  var tiledFlatData = initFlatData(props.tiledData, [], 1);
660
656
  setDataFlat(tiledFlatData);
661
657
  }, [props.tiledData]);
662
- useEffect(function () {
663
- setInited(true);
664
- }, []);
665
658
  var datum = useLatestObj({
666
659
  get: get,
667
660
  set: set,
@@ -694,7 +687,6 @@ var useTree = function useTree(props) {
694
687
  dataFlatStatusMap: context.dataFlatStatusMap
695
688
  });
696
689
  return {
697
- inited: inited,
698
690
  datum: props.datum || datum,
699
691
  expanded: expanded,
700
692
  onExpand: onExpand
@@ -0,0 +1,4 @@
1
+ export declare const getDataset: <T extends {}>(props?: T | undefined) => {
2
+ [key: string]: T[keyof T];
3
+ };
4
+ //# sourceMappingURL=get-dataset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-dataset.d.ts","sourceRoot":"","sources":["get-dataset.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;CAWtB,CAAA"}
@@ -0,0 +1,12 @@
1
+ export var getDataset = function getDataset(props) {
2
+ if (!props) return {};
3
+ var dataset = {};
4
+ var keys = Object.keys(props);
5
+ for (var i = 0; i < keys.length; i++) {
6
+ var _key = keys[i];
7
+ if (_key.startsWith('data-')) {
8
+ dataset[_key] = props[keys[i]];
9
+ }
10
+ }
11
+ return dataset;
12
+ };
@@ -4,6 +4,7 @@ export type { OldWheelEvent } from './normalize-wheel.type';
4
4
  export * from './ready';
5
5
  export * from './element';
6
6
  export * from './document';
7
+ export * from './get-dataset';
7
8
  export { default as ResponsiveObserve } from './responsiveObserve';
8
9
  export type { Breakpoint, ScreenMap } from './responsiveObserve.type';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC"}
@@ -3,4 +3,5 @@ export { parsePxToNumber, addResizeObserver } from "./element";
3
3
  export * from "./ready";
4
4
  export * from "./element";
5
5
  export * from "./document";
6
+ export * from "./get-dataset";
6
7
  export { default as ResponsiveObserve } from "./responsiveObserve";
@@ -1,6 +1,6 @@
1
1
  import { MessageType } from './rule.type';
2
2
  declare const _default: ({ message }?: {
3
3
  message?: MessageType | undefined;
4
- }) => (regExp: string | RegExp, msg?: MessageType) => import("../..").ObjectType | null;
4
+ }) => (regExp: string | RegExp, msg?: MessageType) => import("@sheinx/base").ObjectType | null;
5
5
  export default _default;
6
6
  //# sourceMappingURL=regexp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"required.d.ts","sourceRoot":"","sources":["required.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1C,eAAO,MAAM,eAAe,UAAW,UAAU,WAGhD,CAAC;;;YAEM,WAAW;AADnB,wBASM"}
1
+ {"version":3,"file":"required.d.ts","sourceRoot":"","sources":["required.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,eAAO,MAAM,eAAe,UAAW,UAAU,WAGhD,CAAC;;;YAEM,WAAW;AADnB,wBASM"}
@@ -1,10 +1,12 @@
1
+ import { getLocale, config } from '@sheinx/base';
1
2
  import { deepMerge } from "../object";
3
+ import { substitute } from "../string";
2
4
  var options = {
3
5
  skipUndefined: true
4
6
  };
5
7
  export var requiredMessage = function requiredMessage(props) {
6
8
  var type = props.type === 'array' ? 'array' : 'string';
7
- return "$rules.required.".concat(type);
9
+ return substitute(getLocale(config.locale, "rules.required.".concat(type)), props);
8
10
  };
9
11
  export default (function () {
10
12
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
@@ -54,7 +54,7 @@ export default function getRule(rule, props) {
54
54
  return;
55
55
  }
56
56
  if (reg.global) reg.lastIndex = 0;
57
- if (typeof value === 'string' && reg.test(value)) {
57
+ if (reg.test(value)) {
58
58
  callback(true);
59
59
  } else {
60
60
  callback(new FormError(po.message, po));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/hooks",
3
- "version": "3.9.0-beta.2",
3
+ "version": "3.9.0-beta.20",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -14,7 +14,7 @@
14
14
  "date-fns": "2.30.0",
15
15
  "dayjs": "^1.11.9",
16
16
  "react-fast-compare": "^3.2.2",
17
- "@shined/reactive": "^0.1.2",
17
+ "@shined/reactive": "^0.3.3",
18
18
  "immer": "10.0.2"
19
19
  },
20
20
  "peerDependencies": {