@sheinx/hooks 3.6.0-beta.3 → 3.6.0-beta.30

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 (173) hide show
  1. package/cjs/common/use-filter/use-filter.d.ts.map +1 -1
  2. package/cjs/common/use-pagination-list/index.d.ts.map +1 -1
  3. package/cjs/common/use-pagination-list/index.js +6 -1
  4. package/cjs/common/use-position-style/check-border.d.ts +6 -0
  5. package/cjs/common/use-position-style/check-border.d.ts.map +1 -0
  6. package/cjs/common/use-position-style/check-border.js +35 -0
  7. package/cjs/common/use-position-style/get-position-style.d.ts +1 -0
  8. package/cjs/common/use-position-style/get-position-style.d.ts.map +1 -1
  9. package/cjs/common/use-position-style/get-position-style.js +14 -8
  10. package/cjs/common/use-position-style/index.d.ts +1 -0
  11. package/cjs/common/use-position-style/index.d.ts.map +1 -1
  12. package/cjs/common/use-position-style/index.js +21 -10
  13. package/cjs/components/use-cascader/use-cascader.d.ts.map +1 -1
  14. package/cjs/components/use-cascader/use-cascader.type.d.ts +2 -1
  15. package/cjs/components/use-cascader/use-cascader.type.d.ts.map +1 -1
  16. package/cjs/components/use-check/use-check.d.ts +1 -1
  17. package/cjs/components/use-check/use-check.d.ts.map +1 -1
  18. package/cjs/components/use-check/use-check.js +10 -3
  19. package/cjs/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
  20. package/cjs/components/use-datepicker/use-datepicker-format.js +4 -0
  21. package/cjs/components/use-datepicker/use-datepicker-format.type.d.ts +1 -1
  22. package/cjs/components/use-datepicker/use-datepicker-format.type.d.ts.map +1 -1
  23. package/cjs/components/use-form/Provider.d.ts +1 -2
  24. package/cjs/components/use-form/Provider.d.ts.map +1 -1
  25. package/cjs/components/use-form/use-form-control/use-form-control.d.ts.map +1 -1
  26. package/cjs/components/use-form/use-form-fieldset/fieldset-context.d.ts +1 -1
  27. package/cjs/components/use-form/use-form-fieldset/fieldset-context.d.ts.map +1 -1
  28. package/cjs/components/use-form/use-form-fieldset/fieldset-context.js +3 -2
  29. package/cjs/components/use-form/use-form-fieldset/index.d.ts +1 -0
  30. package/cjs/components/use-form/use-form-fieldset/index.d.ts.map +1 -1
  31. package/cjs/components/use-form/use-form-fieldset/index.js +6 -0
  32. package/cjs/components/use-form/use-form.d.ts +1 -2
  33. package/cjs/components/use-form/use-form.d.ts.map +1 -1
  34. package/cjs/components/use-form/use-form.js +19 -9
  35. package/cjs/components/use-form/use-form.type.d.ts +3 -1
  36. package/cjs/components/use-form/use-form.type.d.ts.map +1 -1
  37. package/cjs/components/use-input/use-input-format.d.ts +1 -1
  38. package/cjs/components/use-input/use-input-format.d.ts.map +1 -1
  39. package/cjs/components/use-input/use-input-format.js +12 -4
  40. package/cjs/components/use-input/use-input-number.d.ts +1 -1
  41. package/cjs/components/use-input/use-input-number.d.ts.map +1 -1
  42. package/cjs/components/use-input/use-input-number.js +1 -0
  43. package/cjs/components/use-popup/use-popup.d.ts.map +1 -1
  44. package/cjs/components/use-popup/use-popup.js +5 -0
  45. package/cjs/components/use-table/index.d.ts +2 -1
  46. package/cjs/components/use-table/index.d.ts.map +1 -1
  47. package/cjs/components/use-table/index.js +7 -0
  48. package/cjs/components/use-table/use-table-filter.d.ts +19 -0
  49. package/cjs/components/use-table/use-table-filter.d.ts.map +1 -0
  50. package/cjs/components/use-table/use-table-filter.js +96 -0
  51. package/cjs/components/use-table/use-table-tree.d.ts +13 -0
  52. package/cjs/components/use-table/use-table-tree.d.ts.map +1 -1
  53. package/cjs/components/use-table/use-table-tree.js +68 -1
  54. package/cjs/components/use-table/use-table-virtual.d.ts.map +1 -1
  55. package/cjs/components/use-table/use-table-virtual.js +6 -4
  56. package/cjs/components/use-table/use-table.type.d.ts +93 -0
  57. package/cjs/components/use-table/use-table.type.d.ts.map +1 -1
  58. package/cjs/components/use-tabs/context.d.ts +1 -1
  59. package/cjs/components/use-tabs/context.d.ts.map +1 -1
  60. package/cjs/components/use-tabs/use-tabs.d.ts +1 -1
  61. package/cjs/components/use-tree/index.d.ts +3 -2
  62. package/cjs/components/use-tree/index.d.ts.map +1 -1
  63. package/cjs/components/use-tree/index.js +18 -2
  64. package/cjs/components/use-tree/use-tree-node.d.ts.map +1 -1
  65. package/cjs/components/use-tree/use-tree-node.js +1 -5
  66. package/cjs/components/use-tree/use-tree-node.type.d.ts +18 -0
  67. package/cjs/components/use-tree/use-tree-node.type.d.ts.map +1 -1
  68. package/cjs/components/use-tree/use-tree-virtual-node.d.ts +13 -0
  69. package/cjs/components/use-tree/use-tree-virtual-node.d.ts.map +1 -0
  70. package/cjs/components/use-tree/use-tree-virtual-node.js +92 -0
  71. package/cjs/components/use-tree/use-tree.d.ts.map +1 -1
  72. package/cjs/components/use-tree/use-tree.js +236 -18
  73. package/cjs/components/use-tree/use-tree.type.d.ts +35 -1
  74. package/cjs/components/use-tree/use-tree.type.d.ts.map +1 -1
  75. package/cjs/components/use-treeselect/use-tiled.d.ts +1 -1
  76. package/cjs/utils/dom/element.d.ts +1 -1
  77. package/cjs/utils/dom/element.d.ts.map +1 -1
  78. package/cjs/utils/dom/element.js +5 -3
  79. package/cjs/utils/is.d.ts +2 -0
  80. package/cjs/utils/is.d.ts.map +1 -1
  81. package/cjs/utils/is.js +5 -2
  82. package/cjs/utils/lazyload.d.ts.map +1 -1
  83. package/cjs/utils/lazyload.js +2 -2
  84. package/cjs/utils/object.d.ts.map +1 -1
  85. package/cjs/utils/object.js +6 -1
  86. package/cjs/utils/warning.js +5 -5
  87. package/esm/common/use-filter/use-filter.d.ts.map +1 -1
  88. package/esm/common/use-pagination-list/index.d.ts.map +1 -1
  89. package/esm/common/use-pagination-list/index.js +6 -1
  90. package/esm/common/use-position-style/check-border.d.ts +6 -0
  91. package/esm/common/use-position-style/check-border.d.ts.map +1 -0
  92. package/esm/common/use-position-style/check-border.js +29 -0
  93. package/esm/common/use-position-style/get-position-style.d.ts +1 -0
  94. package/esm/common/use-position-style/get-position-style.d.ts.map +1 -1
  95. package/esm/common/use-position-style/get-position-style.js +14 -8
  96. package/esm/common/use-position-style/index.d.ts +1 -0
  97. package/esm/common/use-position-style/index.d.ts.map +1 -1
  98. package/esm/common/use-position-style/index.js +21 -10
  99. package/esm/components/use-cascader/use-cascader.d.ts.map +1 -1
  100. package/esm/components/use-cascader/use-cascader.type.d.ts +2 -1
  101. package/esm/components/use-cascader/use-cascader.type.d.ts.map +1 -1
  102. package/esm/components/use-check/use-check.d.ts +1 -1
  103. package/esm/components/use-check/use-check.d.ts.map +1 -1
  104. package/esm/components/use-check/use-check.js +10 -3
  105. package/esm/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
  106. package/esm/components/use-datepicker/use-datepicker-format.js +4 -0
  107. package/esm/components/use-datepicker/use-datepicker-format.type.d.ts +1 -1
  108. package/esm/components/use-datepicker/use-datepicker-format.type.d.ts.map +1 -1
  109. package/esm/components/use-form/Provider.d.ts +1 -2
  110. package/esm/components/use-form/Provider.d.ts.map +1 -1
  111. package/esm/components/use-form/use-form-control/use-form-control.d.ts.map +1 -1
  112. package/esm/components/use-form/use-form-fieldset/fieldset-context.d.ts +1 -1
  113. package/esm/components/use-form/use-form-fieldset/fieldset-context.d.ts.map +1 -1
  114. package/esm/components/use-form/use-form-fieldset/fieldset-context.js +2 -1
  115. package/esm/components/use-form/use-form-fieldset/index.d.ts +1 -0
  116. package/esm/components/use-form/use-form-fieldset/index.d.ts.map +1 -1
  117. package/esm/components/use-form/use-form-fieldset/index.js +2 -1
  118. package/esm/components/use-form/use-form.d.ts +1 -2
  119. package/esm/components/use-form/use-form.d.ts.map +1 -1
  120. package/esm/components/use-form/use-form.js +19 -9
  121. package/esm/components/use-form/use-form.type.d.ts +3 -1
  122. package/esm/components/use-form/use-form.type.d.ts.map +1 -1
  123. package/esm/components/use-input/use-input-format.d.ts +1 -1
  124. package/esm/components/use-input/use-input-format.d.ts.map +1 -1
  125. package/esm/components/use-input/use-input-format.js +12 -4
  126. package/esm/components/use-input/use-input-number.d.ts +1 -1
  127. package/esm/components/use-input/use-input-number.d.ts.map +1 -1
  128. package/esm/components/use-input/use-input-number.js +1 -0
  129. package/esm/components/use-popup/use-popup.d.ts.map +1 -1
  130. package/esm/components/use-popup/use-popup.js +5 -0
  131. package/esm/components/use-table/index.d.ts +2 -1
  132. package/esm/components/use-table/index.d.ts.map +1 -1
  133. package/esm/components/use-table/index.js +1 -0
  134. package/esm/components/use-table/use-table-filter.d.ts +19 -0
  135. package/esm/components/use-table/use-table-filter.d.ts.map +1 -0
  136. package/esm/components/use-table/use-table-filter.js +89 -0
  137. package/esm/components/use-table/use-table-tree.d.ts +13 -0
  138. package/esm/components/use-table/use-table-tree.d.ts.map +1 -1
  139. package/esm/components/use-table/use-table-tree.js +67 -0
  140. package/esm/components/use-table/use-table-virtual.d.ts.map +1 -1
  141. package/esm/components/use-table/use-table-virtual.js +6 -4
  142. package/esm/components/use-table/use-table.type.d.ts +93 -0
  143. package/esm/components/use-table/use-table.type.d.ts.map +1 -1
  144. package/esm/components/use-tabs/context.d.ts +1 -1
  145. package/esm/components/use-tabs/context.d.ts.map +1 -1
  146. package/esm/components/use-tabs/use-tabs.d.ts +1 -1
  147. package/esm/components/use-tree/index.d.ts +3 -2
  148. package/esm/components/use-tree/index.d.ts.map +1 -1
  149. package/esm/components/use-tree/index.js +3 -2
  150. package/esm/components/use-tree/use-tree-node.d.ts.map +1 -1
  151. package/esm/components/use-tree/use-tree-node.js +1 -5
  152. package/esm/components/use-tree/use-tree-node.type.d.ts +18 -0
  153. package/esm/components/use-tree/use-tree-node.type.d.ts.map +1 -1
  154. package/esm/components/use-tree/use-tree-virtual-node.d.ts +13 -0
  155. package/esm/components/use-tree/use-tree-virtual-node.d.ts.map +1 -0
  156. package/esm/components/use-tree/use-tree-virtual-node.js +85 -0
  157. package/esm/components/use-tree/use-tree.d.ts.map +1 -1
  158. package/esm/components/use-tree/use-tree.js +238 -20
  159. package/esm/components/use-tree/use-tree.type.d.ts +35 -1
  160. package/esm/components/use-tree/use-tree.type.d.ts.map +1 -1
  161. package/esm/components/use-treeselect/use-tiled.d.ts +1 -1
  162. package/esm/utils/dom/element.d.ts +1 -1
  163. package/esm/utils/dom/element.d.ts.map +1 -1
  164. package/esm/utils/dom/element.js +4 -2
  165. package/esm/utils/is.d.ts +2 -0
  166. package/esm/utils/is.d.ts.map +1 -1
  167. package/esm/utils/is.js +4 -1
  168. package/esm/utils/lazyload.d.ts.map +1 -1
  169. package/esm/utils/lazyload.js +3 -3
  170. package/esm/utils/object.d.ts.map +1 -1
  171. package/esm/utils/object.js +6 -1
  172. package/esm/utils/warning.js +5 -5
  173. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"use-filter.d.ts","sourceRoot":"","sources":["use-filter.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,QAAA,MAAM,SAAS;;;;;;;;;;kCAmBkD,OAAO;sBAiB1C,MAAM;sBAKN,MAAM,SAAQ,MAAM;;CAuGjD,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"use-filter.d.ts","sourceRoot":"","sources":["use-filter.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,QAAA,MAAM,SAAS;;;;;;;;;;kCAmBkD,OAAO;sBAiB1C,MAAM;sBAKN,MAAM,SAAQ,MAAM;;CAqGjD,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAGA,UAAU,mBAAmB;IAC3B,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACpE,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;AAED,QAAA,MAAM,iBAAiB,UAAW,mBAAmB;;;;;;;;;;;;;wBAKP,MAAM,YAAY,MAAM;CAmCrE,CAAC;AAEF,eAAe,iBAAiB,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAGA,UAAU,mBAAmB;IAC3B,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACpE,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;AAED,QAAA,MAAM,iBAAiB,UAAW,mBAAmB;;;;;;;;;;;;;wBAKP,MAAM,YAAY,MAAM;CA0CrE,CAAC;AAEF,eAAe,iBAAiB,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -40,8 +40,13 @@ var usePaginationList = exports.usePaginationList = function usePaginationList(p
40
40
  var _props$total;
41
41
  if (!shouldPage) return {};
42
42
  var total = (_props$total = props.total) !== null && _props$total !== void 0 ? _props$total : Array.isArray(data) ? data.length : 0;
43
+ var finalCurrent = props.current || current;
44
+ var maxCurrent = Math.ceil(total / (props.pageSize || pageSize));
45
+ if (current > maxCurrent) {
46
+ finalCurrent = 1;
47
+ }
43
48
  return {
44
- current: props.current || current,
49
+ current: finalCurrent,
45
50
  pageSize: props.pageSize || pageSize,
46
51
  total: total,
47
52
  disabled: !!props.loading,
@@ -0,0 +1,6 @@
1
+ interface UseCheckElementBorderWidthOptions {
2
+ direction?: 'horizontal' | 'vertical';
3
+ }
4
+ export declare const useCheckElementBorderWidth: (elementRef: React.RefObject<HTMLElement>, options?: UseCheckElementBorderWidthOptions) => number;
5
+ export {};
6
+ //# sourceMappingURL=check-border.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-border.d.ts","sourceRoot":"","sources":["check-border.ts"],"names":[],"mappings":"AAEA,UAAU,iCAAiC;IAGzC,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;CACvC;AAGD,eAAO,MAAM,0BAA0B,eACzB,MAAM,SAAS,CAAC,WAAW,CAAC,YAC/B,iCAAiC,KACzC,MAqBF,CAAC"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useCheckElementBorderWidth = void 0;
7
+ var _react = require("react");
8
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
12
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+ var useCheckElementBorderWidth = exports.useCheckElementBorderWidth = function useCheckElementBorderWidth(elementRef) {
15
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
16
+ var _useState = (0, _react.useState)(0),
17
+ _useState2 = _slicedToArray(_useState, 2),
18
+ borderWidth = _useState2[0],
19
+ setBorderWidth = _useState2[1];
20
+
21
+ // 获取指定方向上的border宽度之和
22
+ var getBorderWidth = (0, _react.useCallback)(function () {
23
+ if (elementRef.current) {
24
+ var _options$direction = options.direction,
25
+ direction = _options$direction === void 0 ? 'horizontal' : _options$direction;
26
+ var style = window.getComputedStyle(elementRef.current);
27
+ var _borderWidth = direction === 'horizontal' ? parseFloat(style.borderLeftWidth) + parseFloat(style.borderRightWidth) : parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
28
+ setBorderWidth(_borderWidth);
29
+ }
30
+ }, [elementRef]);
31
+ (0, _react.useEffect)(function () {
32
+ getBorderWidth();
33
+ }, [getBorderWidth]);
34
+ return borderWidth;
35
+ };
@@ -3,5 +3,6 @@ export declare const getPositionStyle: (position: string, config?: {
3
3
  popupGap?: number | undefined;
4
4
  zIndex?: number | undefined;
5
5
  fixedWidth?: boolean | "min" | undefined;
6
+ parentBorderWidth?: number | undefined;
6
7
  } | undefined) => React.CSSProperties;
7
8
  //# sourceMappingURL=get-position-style.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-position-style.d.ts","sourceRoot":"","sources":["get-position-style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,eAAO,MAAM,gBAAgB,aACjB,MAAM;;;;qCAwCjB,CAAC"}
1
+ {"version":3,"file":"get-position-style.d.ts","sourceRoot":"","sources":["get-position-style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,eAAO,MAAM,gBAAgB,aACjB,MAAM;;;;;qCA+CjB,CAAC"}
@@ -28,6 +28,9 @@ var getPositionStyle = exports.getPositionStyle = function getPositionStyle(posi
28
28
  if (config !== null && config !== void 0 && config.fixedWidth) {
29
29
  var key = config.fixedWidth === 'min' ? 'minWidth' : 'width';
30
30
  newStyle[key] = '100%';
31
+ if (config.parentBorderWidth) {
32
+ newStyle[key] = "calc(100% + ".concat(config.parentBorderWidth, "px)");
33
+ }
31
34
  }
32
35
  if (position === 'drop-down') {
33
36
  newStyle.top = mainMargin;
@@ -39,19 +42,22 @@ var getPositionStyle = exports.getPositionStyle = function getPositionStyle(posi
39
42
  var positionArr = (position || '').split('-');
40
43
  if (positionArr.length === 2) {
41
44
  var _positionArr = _slicedToArray(positionArr, 2),
42
- m = _positionArr[0],
43
- n = _positionArr[1];
44
- newStyle[ReverseDir[m]] = mainMargin;
45
- newStyle[n] = 0;
45
+ vDirection = _positionArr[0],
46
+ hDirection = _positionArr[1];
47
+ newStyle[ReverseDir[vDirection]] = mainMargin;
48
+ newStyle[hDirection] = 0;
49
+ if (config !== null && config !== void 0 && config.parentBorderWidth) {
50
+ newStyle[hDirection] = -config.parentBorderWidth / 2;
51
+ }
46
52
  } else {
47
53
  var _positionArr2 = _slicedToArray(positionArr, 1),
48
- _m = _positionArr2[0];
49
- newStyle[ReverseDir[_m]] = mainMargin;
50
- if (_m === 'left' || _m === 'right') {
54
+ _vDirection = _positionArr2[0];
55
+ newStyle[ReverseDir[_vDirection]] = mainMargin;
56
+ if (_vDirection === 'left' || _vDirection === 'right') {
51
57
  newStyle.top = halfMargin;
52
58
  newStyle.transform = 'translateY(-50%)';
53
59
  }
54
- if (_m === 'top' || _m === 'bottom') {
60
+ if (_vDirection === 'top' || _vDirection === 'bottom') {
55
61
  newStyle.left = halfMargin;
56
62
  newStyle.transform = 'translateX(-50%)';
57
63
  }
@@ -15,6 +15,7 @@ export interface PositionStyleConfig {
15
15
  fixedWidth?: boolean | 'min';
16
16
  updateKey?: number | string;
17
17
  adjust?: boolean;
18
+ offset?: [number, number];
18
19
  }
19
20
  export declare const usePositionStyle: (config: PositionStyleConfig) => {
20
21
  style: React.CSSProperties;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAQnD,MAAM,MAAM,kBAAkB,GAC1B,aAAa,GACb,UAAU,GACV,cAAc,GACd,WAAW,GACX,MAAM,GACN,OAAO,CAAC;AACZ,MAAM,MAAM,gBAAgB,GACxB,aAAa,GACb,cAAc,GACd,UAAU,GACV,WAAW,GACX,KAAK,GACL,QAAQ,CAAC;AAYb,KAAK,YAAY,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,OAAO,CAAC;AACpE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;IAEd,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAE1C,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAEzC,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC3C,YAAY,EAAE,MAAM,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;IAC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,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3B;AAOD,eAAO,MAAM,gBAAgB,WAAY,mBAAmB;;;CAkT3D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -9,6 +9,7 @@ exports.usePositionStyle = exports.default = void 0;
9
9
  var _react = _interopRequireWildcard(require("react"));
10
10
  var _getPositionStyle = require("./get-position-style");
11
11
  var _checkPosition = require("./check-position");
12
+ var _checkBorder = require("./check-border");
12
13
  var _shallowEqual = _interopRequireDefault(require("../../utils/shallow-equal"));
13
14
  var _usePersistFn = _interopRequireDefault(require("../use-persist-fn"));
14
15
  var _utils = require("../../utils");
@@ -43,7 +44,8 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
43
44
  popupElRef = _ref.popupElRef,
44
45
  scrollElRef = _ref.scrollElRef,
45
46
  updateKey = _ref.updateKey,
46
- adjust = _ref.adjust;
47
+ adjust = _ref.adjust,
48
+ offset = _ref.offset;
47
49
  // 初次渲染无样式的时候, 隐藏展示
48
50
  var _useState = (0, _react.useState)(hideStyle),
49
51
  _useState2 = _slicedToArray(_useState, 2),
@@ -74,6 +76,9 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
74
76
  scrollContainer: scrollElRef === null || scrollElRef === void 0 ? void 0 : scrollElRef.current,
75
77
  enable: show && adjust
76
78
  });
79
+ var parentElBorderWidth = (0, _checkBorder.useCheckElementBorderWidth)(parentElRef, {
80
+ direction: 'horizontal'
81
+ });
77
82
  var adjustPosition = function adjustPosition(position) {
78
83
  var winHeight = _utils.docSize.height;
79
84
  if (!verticalPosition.includes(position)) return position;
@@ -158,7 +163,7 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
158
163
  var overRight = 0;
159
164
  var overLeft = 0;
160
165
  if (h === 'left') {
161
- style.left = rect.left - containerRect.left + containerScroll.left;
166
+ style.left = rect.left - containerRect.left + containerScroll.left - (offset ? offset[0] : 0);
162
167
  style.transform = '';
163
168
  arrayStyle.left = "8px";
164
169
  if (adjust) {
@@ -168,7 +173,7 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
168
173
  }
169
174
  }
170
175
  } else if (h === 'right') {
171
- style.right = containerRect.right - rect.right + containerScrollBarWidth - containerScroll.left;
176
+ style.right = containerRect.right - rect.right + containerScrollBarWidth - containerScroll.left - (offset ? offset[0] : 0);
172
177
  style.left = 'auto';
173
178
  style.transform = '';
174
179
  arrayStyle.right = "8px";
@@ -225,11 +230,11 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
225
230
  _h = _targetPosition$split4[0],
226
231
  _v = _targetPosition$split4[1];
227
232
  if (_v === 'top') {
228
- style.top = rect.top - containerRect.top + containerScroll.top;
233
+ style.top = rect.top - containerRect.top + containerScroll.top - (offset ? offset[1] : 0);
229
234
  style.transform = '';
230
235
  arrayStyle.top = "8px";
231
236
  } else if (_v === 'bottom') {
232
- style.top = rect.bottom - containerRect.top + containerScroll.top;
237
+ style.top = rect.bottom - containerRect.top + containerScroll.top + (offset ? offset[1] : 0);
233
238
  arrayStyle.bottom = "8px";
234
239
  style.transform = 'translateY(-100%)';
235
240
  } else {
@@ -242,10 +247,12 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
242
247
  }
243
248
  if (_h === 'right') {
244
249
  style.left = rect.right - containerRect.left + containerScroll.left + popupGap;
250
+ arrayStyle.left = '0px';
251
+ arrayStyle.right = 'auto';
245
252
  } else {
246
- style.left = rect.left - containerRect.left + containerScroll.left - popupGap;
247
- arrayStyle.right = "0px";
248
- style.transform += ' translateX(-100%)';
253
+ style.right = containerRect.right - rect.left;
254
+ arrayStyle.right = '0px';
255
+ arrayStyle.left = 'auto';
249
256
  }
250
257
  } else if (position === 'cover') {
251
258
  style.top = rect.top - containerRect.top + containerScroll.top;
@@ -304,17 +311,19 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
304
311
  newStyle: style
305
312
  };
306
313
  context.parentRect = parentElRef.current.getBoundingClientRect();
314
+ var realPosition = position;
307
315
  if (adjust) {
308
316
  var popupInfo = getPopUpInfo(context.parentRect);
309
317
  context.popUpHeight = popupInfo.height;
310
318
  context.popUpWidth = popupInfo.width;
319
+ realPosition = adjustPosition(position);
311
320
  }
312
- var realPosition = adjust ? adjustPosition(position) : position;
313
321
  if (!absolute) {
314
322
  newStyle = (0, _getPositionStyle.getPositionStyle)(realPosition, {
315
323
  popupGap: popupGap,
316
324
  zIndex: zIndex,
317
- fixedWidth: fixedWidth
325
+ fixedWidth: fixedWidth,
326
+ parentBorderWidth: parentElBorderWidth
318
327
  });
319
328
  } else {
320
329
  var _ref3 = getAbsoluteStyle(realPosition),
@@ -326,6 +335,8 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
326
335
  // for animation
327
336
  if (realPosition.indexOf('top') === 0) {
328
337
  newStyle.transformOrigin = 'center bottom';
338
+ } else if (realPosition.indexOf('bottom') === 0) {
339
+ newStyle.transformOrigin = 'center top';
329
340
  }
330
341
  return {
331
342
  newStyle: newStyle,
@@ -1 +1 @@
1
- {"version":3,"file":"use-cascader.d.ts","sourceRoot":"","sources":["use-cascader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,QAAA,MAAM,WAAW;;;;CA0ChB,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"use-cascader.d.ts","sourceRoot":"","sources":["use-cascader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,QAAA,MAAM,WAAW;;;;CA2ChB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { KeygenResult, TreeKeygenType, ObjectKey } from '../../common/type';
2
+ import { DisabledOption } from '../use-tree';
2
3
  import { TreeModeType } from '../use-tree/use-tree.type';
3
4
  export interface BaseCascaderProps<DataItem, Value extends KeygenResult[]> {
4
5
  value?: Value;
@@ -11,7 +12,7 @@ export interface BaseCascaderProps<DataItem, Value extends KeygenResult[]> {
11
12
  beforeChange?: (value: Value) => any;
12
13
  mode?: TreeModeType;
13
14
  keygen: TreeKeygenType<DataItem>;
14
- disabled?: ((data: DataItem) => boolean) | boolean;
15
+ disabled?: DisabledOption<DataItem> | boolean | ((item: DataItem) => boolean);
15
16
  filterSameChange?: boolean;
16
17
  }
17
18
  //# sourceMappingURL=use-cascader.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-cascader.type.d.ts","sourceRoot":"","sources":["use-cascader.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,MAAM,WAAW,iBAAiB,CAAC,QAAQ,EAAE,KAAK,SAAS,YAAY,EAAE;IACvE,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvD,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,GAAG,CAAC;IACrC,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,GAAG,OAAO,CAAC;IACnD,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B"}
1
+ {"version":3,"file":"use-cascader.type.d.ts","sourceRoot":"","sources":["use-cascader.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,MAAM,WAAW,iBAAiB,CAAC,QAAQ,EAAE,KAAK,SAAS,YAAY,EAAE;IACvE,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvD,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,GAAG,CAAC;IACrC,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC;IAC9E,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B"}
@@ -22,7 +22,7 @@ declare const useCheck: (props: BaseCheckProps) => {
22
22
  ref: ((instance: HTMLInputElement | null) => void) | null;
23
23
  disabled: boolean | undefined;
24
24
  };
25
- getRootProps: <TOther_2 extends ObjectType>(externalProps?: TOther_2) => TOther_2 & {
25
+ getRootProps: <TOther_2 extends ObjectType>(externalProps?: TOther_2) => Omit<TOther_2, "needStopPropagation"> & {
26
26
  onClick: (event: React.MouseEvent) => void;
27
27
  };
28
28
  disabled: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"use-check.d.ts","sourceRoot":"","sources":["use-check.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,QAAA,MAAM,QAAQ,UAAW,cAAc;;;;;qBAoDpB,gBAAgB,CAAC,gBAAgB,CAAC;0BArBT,MAAM,WAAW,CAAC,gBAAgB,CAAC;;;;;;;;;;;yBAhBjB,gBAAgB;;;;CA6D7E,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"use-check.d.ts","sourceRoot":"","sources":["use-check.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,QAAA,MAAM,QAAQ,UAAW,cAAc;;;;;qBAuDpB,gBAAgB,CAAC,gBAAgB,CAAC;0BArBT,MAAM,WAAW,CAAC,gBAAgB,CAAC;;;;;;;;;;;yBAnBa,gBAAgB;;;;CAiE3G,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _utils = require("../../utils");
10
+ var _ = require("../..");
10
11
  var _useForkRef = _interopRequireDefault(require("../../common/use-fork-ref"));
11
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
13
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -43,9 +44,12 @@ var useCheck = function useCheck(props) {
43
44
  };
44
45
  var inputRef = _react.default.useRef(null);
45
46
  var handleInputRef = (0, _useForkRef.default)(inputRef, inputRefPo);
46
- var handleClick = function handleClick(otherHandlers) {
47
+ var handleClick = function handleClick(otherHandlers, needStopPropagation) {
47
48
  return function (event) {
48
49
  var _inputRef$current, _otherHandlers$onClic;
50
+ if (needStopPropagation) {
51
+ event.stopPropagation();
52
+ }
49
53
  (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.click();
50
54
  otherHandlers === null || otherHandlers === void 0 || (_otherHandlers$onClic = otherHandlers.onClick) === null || _otherHandlers$onClic === void 0 || _otherHandlers$onClic.call(otherHandlers, event);
51
55
  };
@@ -53,8 +57,10 @@ var useCheck = function useCheck(props) {
53
57
  var getRootProps = function getRootProps() {
54
58
  var externalProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
55
59
  var externalEventHandlers = (0, _utils.extractEventHandlers)(externalProps);
56
- return _objectSpread(_objectSpread({}, externalProps), {}, {
57
- onClick: handleClick(externalEventHandlers)
60
+ return _objectSpread(_objectSpread({}, _.util.removeProps(externalProps, {
61
+ needStopPropagation: true
62
+ })), {}, {
63
+ onClick: handleClick(externalEventHandlers, externalProps.needStopPropagation)
58
64
  });
59
65
  //封装点击事件 点击触发input 的点击
60
66
  // disabled 禁用后不可点击
@@ -83,6 +89,7 @@ var useCheck = function useCheck(props) {
83
89
  disabled: disabled
84
90
  }, checkProps), {}, {
85
91
  onClick: function onClick(e) {
92
+ // TODO: 这个e.stopPropagation生效不了,外部的触发是通过inputRef.current?.click()方式的;没啥用的代码
86
93
  e.stopPropagation();
87
94
  _onClick === null || _onClick === void 0 || _onClick(e);
88
95
  },
@@ -1 +1 @@
1
- {"version":3,"file":"use-datepicker-format.d.ts","sourceRoot":"","sources":["use-datepicker-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,8BAA8B,CAAC;AAkEtC,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;0BAqMe,gBAAgB;sCAiEJ,MAAM;iCA7BX,MAAM,SAAS,MAAM;yCAtLrD,OAAO,GAAG,KAAK,GAAG,SAAS,QAAQ,MAAM,UAAU,IAAI,KAAK,OAAO;uCAWvE,MAAM,cAAc,CAAC,IAAI,EAAE,CAAC,QAC3B,MAAM;kBACG,MAAM,SAAS;mBAAS,GAAG;;+BA4CrC,IAAI,YAAY,OAAO,GAAG,KAAK,GAAG,SAAS,gBAAgB,MAAM;;CAsN3E,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"use-datepicker-format.d.ts","sourceRoot":"","sources":["use-datepicker-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,8BAA8B,CAAC;AAkEtC,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;0BAuMe,gBAAgB;sCAiEJ,MAAM;iCA7BX,MAAM,SAAS,MAAM;yCAxLrD,OAAO,GAAG,KAAK,GAAG,SAAS,QAAQ,MAAM,UAAU,IAAI,KAAK,OAAO;uCAWvE,MAAM,cAAc,CAAC,IAAI,EAAE,CAAC,QAC3B,MAAM;kBACG,MAAM,SAAS;mBAAS,GAAG;;+BA4CrC,IAAI,YAAY,OAAO,GAAG,KAAK,GAAG,SAAS,gBAAgB,MAAM;;CAwN3E,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -211,6 +211,10 @@ var useDatePickerFormat = function useDatePickerFormat(props) {
211
211
  if (props.formatResult) {
212
212
  if (typeof props.formatResult === 'string') {
213
213
  return getFormatValueArr(dateArr, props.formatResult);
214
+ } else if (typeof props.formatResult === 'function') {
215
+ return dateArr.map(function (item) {
216
+ return props.formatResult(item);
217
+ });
214
218
  } else {
215
219
  return dateArr.map(function (item) {
216
220
  if (!item) return '';
@@ -5,7 +5,7 @@ export type DatePickerModeType = 'year' | 'month' | 'quarter' | 'time' | 'day';
5
5
  export interface UseDatePickerFormatProps<Value extends DatePickerValueType> {
6
6
  type: 'date' | 'datetime' | 'month' | 'time' | 'week' | 'year' | 'quarter';
7
7
  format: string | undefined;
8
- formatResult: string | ((date: Date) => string) | undefined;
8
+ formatResult?: string | ((date?: Date) => string);
9
9
  range: boolean | undefined | number;
10
10
  value: Value | undefined;
11
11
  onChange: ((value: Value extends any[] ? string[] : string, ...args: any) => void) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"use-datepicker-format.type.d.ts","sourceRoot":"","sources":["use-datepicker-format.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAC9D,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,YAAY,EAAE,CAAC;AAChE,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAClG,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC;AAC/E,MAAM,WAAW,wBAAwB,CAAC,KAAK,SAAS,mBAAmB;IACzE,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC3E,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,YAAY,EAAE,MAAM,GAAG,CAAC,CAA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,GAAG,SAAS,CAAC;IAClC,WAAW,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,cAAc,EAAE,mBAAmB,CAAC;IACpC,cAAc,EACV,CAAC,CACC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,GAAG,CAAA;KAAE,EACnC,IAAI,EAAE,kBAAkB,KACrB,IAAI,CAAC,GACV,SAAS,CAAC;IACd,QAAQ,EACJ,OAAO,GACP,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,EAAE,SAAS,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,IAAI,KAAK,OAAO,CAAC,GACvF,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,GAC1C,SAAS,CAAC;CACf"}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { ProviderProps } from './use-form.type';
3
- export declare const Provider: (props: ProviderProps) => JSX.Element;
2
+ export declare const Provider: (props: ProviderProps) => import("react/jsx-runtime").JSX.Element;
4
3
  //# sourceMappingURL=Provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["Provider.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,eAAO,MAAM,QAAQ,UAAW,aAAa,gBAW5C,CAAC"}
1
+ {"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["Provider.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,eAAO,MAAM,QAAQ,UAAW,aAAa,4CAW5C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-form-control.d.ts","sourceRoot":"","sources":["use-form-control.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AA0B/D,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC;;kBAoJpC,CAAC,YAAY,GAAG,EAAE;;;;;EAkDrD"}
1
+ {"version":3,"file":"use-form-control.d.ts","sourceRoot":"","sources":["use-form-control.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AA0B/D,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC;;kBAiJpC,CAAC,YAAY,GAAG,EAAE;;;;;EAkDrD"}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- declare const FieldsetContext: React.Context<{
2
+ export declare const FieldsetContext: React.Context<{
3
3
  path: string;
4
4
  validateFieldSet: () => void;
5
5
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"fieldset-context.d.ts","sourceRoot":"","sources":["fieldset-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,QAAA,MAAM,eAAe;;;EAA0D,CAAC;AAEhF,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;;;;CAe/B,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -4,7 +4,7 @@
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.useFieldSetConsumer = exports.default = void 0;
7
+ exports.useFieldSetConsumer = exports.default = exports.FieldsetContext = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  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); }
10
10
  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; }
@@ -14,10 +14,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
14
14
  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; }
15
15
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
16
16
  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); }
17
- var FieldsetContext = /*#__PURE__*/(0, _react.createContext)({
17
+ var FieldsetContext = exports.FieldsetContext = /*#__PURE__*/(0, _react.createContext)({
18
18
  path: '',
19
19
  validateFieldSet: function validateFieldSet() {}
20
20
  });
21
+ FieldsetContext.displayName = 'FieldsetContext';
21
22
  function extendName() {
22
23
  var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
23
24
  var name = arguments.length > 1 ? arguments[1] : undefined;
@@ -1,4 +1,5 @@
1
1
  export { default as useFormFieldSet, default } from './use-form-fieldset';
2
2
  export { useFieldSetConsumer } from './fieldset-context';
3
+ export { FieldsetContext } from './fieldset-context';
3
4
  export type { BaseFormFieldSetProps } from './use-form-fieldset.type';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,YAAY,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,YAAY,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -4,6 +4,12 @@
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
+ Object.defineProperty(exports, "FieldsetContext", {
8
+ enumerable: true,
9
+ get: function get() {
10
+ return _fieldsetContext.FieldsetContext;
11
+ }
12
+ });
7
13
  Object.defineProperty(exports, "default", {
8
14
  enumerable: true,
9
15
  get: function get() {
@@ -1,9 +1,8 @@
1
- /// <reference types="react" />
2
1
  import { ProviderProps, UseFormProps, UseFormSlotProps, ValidateFnConfig } from './use-form.type';
3
2
  import { ObjectType } from '../../common/type';
4
3
  declare const useForm: <T extends ObjectType>(props: UseFormProps<T>) => {
5
4
  getFormProps: <TOther extends ObjectType = ObjectType>(externalProps?: TOther) => UseFormSlotProps<TOther>;
6
- Provider: (props: ProviderProps) => JSX.Element;
5
+ Provider: (props: ProviderProps) => import("react/jsx-runtime").JSX.Element;
7
6
  ProviderProps: {
8
7
  formValue: import("./use-form.type").FormContextValueType;
9
8
  formConfig: import("./use-form.type").FormCommonConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":";AA+BA,OAAO,EAEL,aAAa,EACb,YAAY,EACZ,gBAAgB,EAGhB,gBAAgB,EAEjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OAAO;;;;;;;;;wBA8QC;gBAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;gBAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;aAAE;8BAjJd,MAAM;oCAoND,OAAO;;6BAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;oCAdrB,MAAM,EAAE;sCA/KxC,MAAM,GAAG,MAAM,EAAE,WAAU,gBAAgB;qCAiPvB,MAAM,WAAW,gBAAgB;gCA/CzB,MAAM,SAAS,MAAM,UAAU,KAAK;gCAKpC,MAAM,SAAS,MAAM;kCAzHpD,MAAM,0BAAyB,qBAAqB;;;;;;oBA2DjD;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE;0BAjJd,MAAM;gCAoND,OAAO;;yBAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCA/KxC,MAAM,GAAG,MAAM,EAAE,WAAU,gBAAgB;iCAiPvB,MAAM,WAAW,gBAAgB;4BA/CzB,MAAM,SAAS,MAAM,UAAU,KAAK;4BAKpC,MAAM,SAAS,MAAM;8BAzHpD,MAAM,0BAAyB,qBAAqB;;CA+Y9D,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":"AA+BA,OAAO,EAEL,aAAa,EACb,YAAY,EACZ,gBAAgB,EAGhB,gBAAgB,EAEjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OAAO;;;;;;;;;wBAyRC;gBAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;gBAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;aAAE;8BA9Jd,MAAM;oCAiOD,OAAO;;6BAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;oCAdrB,MAAM,EAAE;sCA5LxC,MAAM,GAAG,MAAM,EAAE,WAAU,gBAAgB;qCA8PvB,MAAM,WAAW,gBAAgB;gCA/CzB,MAAM,SAAS,MAAM,UAAU,KAAK;gCAKpC,MAAM,SAAS,MAAM;kCAnIpD,MAAM,0BAAyB,qBAAqB;;;;;;oBAqEjD;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE;0BA9Jd,MAAM;gCAiOD,OAAO;;yBAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCA5LxC,MAAM,GAAG,MAAM,EAAE,WAAU,gBAAgB;iCA8PvB,MAAM,WAAW,gBAAgB;4BA/CzB,MAAM,SAAS,MAAM,UAAU,KAAK;4BAKpC,MAAM,SAAS,MAAM;8BAnIpD,MAAM,0BAAyB,qBAAqB;;CAma9D,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -53,7 +53,6 @@ var useForm = function useForm(props) {
53
53
  forceSet: true
54
54
  };
55
55
  var preValue = (0, _useDefaultValue.usePrevious)(props.value);
56
- var formDomRef = React.useRef();
57
56
  var _React$useRef = React.useRef({
58
57
  defaultValues: {},
59
58
  validateMap: {},
@@ -127,9 +126,9 @@ var useForm = function useForm(props) {
127
126
  onError === null || onError === void 0 || onError(err);
128
127
  if (!props.scrollToError) return;
129
128
  setTimeout(function () {
130
- var _formDomRef$current;
129
+ var _props$formElRef$curr;
131
130
  var selector = "[".concat((0, _attribute.getDataAttributeName)('status'), "=\"error\"]");
132
- var el = (_formDomRef$current = formDomRef.current) === null || _formDomRef$current === void 0 ? void 0 : _formDomRef$current.querySelector(selector);
131
+ var el = (_props$formElRef$curr = props.formElRef.current) === null || _props$formElRef$curr === void 0 ? void 0 : _props$formElRef$curr.querySelector(selector);
133
132
  if (el) {
134
133
  el.scrollIntoView();
135
134
  var focusableSelectors = 'textarea, input,[tabindex]:not([tabindex="-1"])';
@@ -163,7 +162,7 @@ var useForm = function useForm(props) {
163
162
  return new Promise(function (resolve, reject) {
164
163
  var finalFields = Object.keys(context.validateMap);
165
164
  if (fields) {
166
- if (config.ignoreChildren) {
165
+ if (config.ignoreChildren || config.ignoreBind) {
167
166
  // 旧行为:仅校验当前字段
168
167
  finalFields = ((0, _utils.isArray)(fields) ? fields : [fields]).filter(function (key) {
169
168
  return context.validateMap[key];
@@ -182,6 +181,7 @@ var useForm = function useForm(props) {
182
181
  }
183
182
  var validates = finalFields.map(function (key) {
184
183
  var validateField = context.validateMap[key];
184
+ if (!validateField) return [];
185
185
  return Array.from(validateField).map(function (validate) {
186
186
  return validate(key, (0, _utils.deepGet)(context.value, key), context.value, config);
187
187
  });
@@ -252,10 +252,20 @@ var useForm = function useForm(props) {
252
252
  var isVisibleX = elementRect.left >= parentRect.left && elementRect.right <= parentRect.right;
253
253
  if (!isVisibleY || !isVisibleX) {
254
254
  // 计算元素相对于父元素的偏移量
255
- var offsetTop = element.offsetTop - parentEl.offsetTop;
256
- var offsetLeft = element.offsetLeft - parentEl.offsetLeft;
257
- parentEl.scrollTop = offsetTop;
258
- parentEl.scrollLeft = offsetLeft;
255
+ var offsetTop = elementRect.top - parentRect.top;
256
+ var offsetLeft = elementRect.left - parentRect.left;
257
+ // 如果是往上滚动,那么只有当元素的偏移量小于0时才需要滚动
258
+ if (offsetTop < 0) {
259
+ parentEl.scrollTop = Math.max(parentEl.scrollTop + offsetTop, 0);
260
+ } else {
261
+ parentEl.scrollTop = Math.min(parentEl.scrollTop + offsetTop, parentEl.scrollHeight - parentEl.clientHeight);
262
+ }
263
+ // 如果是往左滚动,那么只有当元素的偏移量小于0时才需要滚动
264
+ if (offsetLeft < 0) {
265
+ parentEl.scrollLeft = Math.max(parentEl.scrollLeft + offsetLeft, 0);
266
+ } else {
267
+ parentEl.scrollLeft = Math.min(parentEl.scrollLeft + offsetLeft, parentEl.scrollWidth - parentEl.clientWidth);
268
+ }
259
269
  }
260
270
  } else {
261
271
  // 如果没有找到可滚动的父元素,使用默认行为
@@ -459,7 +469,6 @@ var useForm = function useForm(props) {
459
469
  var externalProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
460
470
  var externalEventHandlers = (0, _utils.extractEventHandlers)(externalProps);
461
471
  return _objectSpread(_objectSpread(_objectSpread({}, externalProps), externalEventHandlers), {}, {
462
- ref: formDomRef,
463
472
  disabled: !!disabled,
464
473
  onSubmit: handleSubmit(externalEventHandlers),
465
474
  onReset: handleReset(externalEventHandlers)
@@ -505,6 +514,7 @@ var useForm = function useForm(props) {
505
514
  }
506
515
  if (validateFieldSet.size === 0 && updateFieldSet.size === 0) {
507
516
  context.names.delete(n);
517
+ delete context.errors[n];
508
518
  delete context.defaultValues[n];
509
519
  }
510
520
  var finalReserveAble = (_props$reserveAble = props.reserveAble) !== null && _props$reserveAble !== void 0 ? _props$reserveAble : reserveAble;
@@ -185,7 +185,9 @@ export interface BaseFormProps<T> extends Omit<FormCommonConfig, 'formName'> {
185
185
  */
186
186
  name?: string;
187
187
  }
188
- export type UseFormProps<T> = BaseFormProps<T>;
188
+ export type UseFormProps<T> = BaseFormProps<T> & {
189
+ formElRef: React.RefObject<HTMLFormElement>;
190
+ };
189
191
  export type FormContext = {
190
192
  defaultValues: ObjectType;
191
193
  validateMap: ObjectType<Set<(name: string, v: any, formValue: ObjectType, config?: {
@@ -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;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAE/C,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,MAAM,EAAE,CAAC,CAAC;IACV,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,EAAE,CAAC;KAClB,EAAE,CAAC;CACL;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,CAAC,EAAE,WAAW,GAAG,WAAW,CAAC;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,CACvB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,GAAG,EACV,QAAQ,EAAE,UAAU,EACpB,MAAM,CAAC,EAAE,gBAAgB,KACtB,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC,CAAA;AAE9B,MAAM,MAAM,QAAQ,GAAG,CACrB,SAAS,EAAE,UAAU,EACrB,MAAM,EAAE,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,EACrC,YAAY,EAAE,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,KACxC,IAAI,CAAA;AAET,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC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EAAE,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;IAC5C,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC,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"}
@@ -5,7 +5,7 @@ declare const useInputFormat: (props: InputFormatProps) => {
5
5
  onBlur: (e: React.FocusEvent) => void;
6
6
  onFocus: (e: React.FocusEvent) => void;
7
7
  value: string | undefined;
8
- type: "search" | "color" | "button" | "time" | "image" | "text" | "reset" | "submit" | "email" | "url" | "range" | "tel" | (string & {}) | "hidden" | "checkbox" | "radio" | "date" | "datetime-local" | "file" | "month" | "password" | "week" | undefined;
8
+ type: "search" | (string & {}) | "color" | "button" | "time" | "reset" | "submit" | "email" | "url" | "range" | "tel" | "hidden" | "checkbox" | "radio" | "text" | "date" | "datetime-local" | "file" | "image" | "month" | "password" | "week" | undefined;
9
9
  };
10
10
  export default useInputFormat;
11
11
  //# sourceMappingURL=use-input-format.d.ts.map