@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-input-format.d.ts","sourceRoot":"","sources":["use-input-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAM3D,QAAA,MAAM,cAAc,UAAW,gBAAgB;kBAsBP,MAAM,GAAG,SAAS;gBA4BpB,gBAAgB;iBAgDd,gBAAgB;;;CAwBvD,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"use-input-format.d.ts","sourceRoot":"","sources":["use-input-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAM3D,QAAA,MAAM,cAAc,UAAW,gBAAgB;kBAsBP,MAAM,GAAG,SAAS;gBAoCpB,gBAAgB;iBAgDd,gBAAgB;;;CAyBvD,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -28,7 +28,7 @@ var useInputFormat = function useInputFormat(props) {
28
28
  autoFix = props.autoFix,
29
29
  coin = props.coin,
30
30
  cancelBlurChange = props.cancelBlurChange;
31
- var _React$useState = _react.default.useState(false),
31
+ var _React$useState = _react.default.useState(coin),
32
32
  _React$useState2 = _slicedToArray(_React$useState, 2),
33
33
  showCoin = _React$useState2[0],
34
34
  setShowCoin = _React$useState2[1];
@@ -55,6 +55,13 @@ var useInputFormat = function useInputFormat(props) {
55
55
  var noNeg = numType === 'non-negative' || numType === 'positive';
56
56
  var regExp = new RegExp("^(".concat(noNeg ? '' : '-', ")?(\\d").concat(regLength(integerLimit), ")(").concat(digits !== 0 ? "\\.\\d".concat(regLength(digits)) : '', ")?.*$"), 'g');
57
57
  value = value.replace(regExp, '$1$2$3');
58
+
59
+ // 修正小数位数
60
+ var _value = v.split('.');
61
+ var __value = value.split('.');
62
+ if (_value[1] !== undefined && __value[1] === undefined && digits !== 0) {
63
+ value = "".concat(value, ".").concat(_value[1]);
64
+ }
58
65
  }
59
66
  onChange(value);
60
67
  });
@@ -112,14 +119,15 @@ var useInputFormat = function useInputFormat(props) {
112
119
  });
113
120
  function getValue(str) {
114
121
  if (type === 'number' && coin) {
115
- if (showCoin && str) {
116
- return "".concat(str).replace(/\d+/, function (n) {
122
+ var _str = str;
123
+ if (showCoin && _str) {
124
+ return "".concat(_str).replace(/\d+/, function (n) {
117
125
  return n.replace(/(\d)(?=(\d{3})+$)/g, function ($1) {
118
126
  return "".concat($1, ",");
119
127
  });
120
128
  });
121
129
  }
122
- return "".concat(str || '').replace(/,/g, '');
130
+ return "".concat(_str === 0 ? _str : _str || '').replace(/,/g, '');
123
131
  }
124
132
  return str;
125
133
  }
@@ -7,7 +7,7 @@ declare const useNumberFormat: (props: InputNumberProps) => {
7
7
  onBlur: (e: React.FocusEvent<Element, Element>) => void;
8
8
  onFocus: (e: React.FocusEvent<Element, Element>) => void;
9
9
  value: string | undefined;
10
- 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;
10
+ 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;
11
11
  };
12
12
  export default useNumberFormat;
13
13
  //# sourceMappingURL=use-input-number.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-input-number.d.ts","sourceRoot":"","sources":["use-input-number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,QAAA,MAAM,eAAe,UAAW,gBAAgB;;;;;;;;CAuJ/C,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"use-input-number.d.ts","sourceRoot":"","sources":["use-input-number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,QAAA,MAAM,eAAe,UAAW,gBAAgB;;;;;;;;CAwJ/C,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -75,6 +75,7 @@ var useNumberFormat = function useNumberFormat(props) {
75
75
  var onInnerChange = (0, _usePersistFn.default)(function (val) {
76
76
  setInternalInputValue(getStringValue(val));
77
77
  if (typeof val === 'string') {
78
+ if (val.endsWith('.')) return;
78
79
  var num = parseFloat(val);
79
80
  if (val === '') {
80
81
  // 如果允许空值,则返回 null,否则返回 undefined
@@ -1 +1 @@
1
- {"version":3,"file":"use-popup.d.ts","sourceRoot":"","sources":["use-popup.ts"],"names":[],"mappings":"AAAA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAOhE,QAAA,MAAM,QAAQ,UAAW,cAAc;;;;;;;0BAyHK;YAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAAA;SAAE;0BAM9B;YAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAAA;SAAE;;;;;qBA5B7B;YAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;;;;2BA6ElD,MAAM,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC;6BAGxC,MAAM,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC;;CAsBpE,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"use-popup.d.ts","sourceRoot":"","sources":["use-popup.ts"],"names":[],"mappings":"AAAA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAOhE,QAAA,MAAM,QAAQ,UAAW,cAAc;;;;;;;0BA8HK;YAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAAA;SAAE;0BAM9B;YAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAAA;SAAE;;;;;qBA5B7B;YAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;;;;2BA6ElD,MAAM,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC;6BAGxC,MAAM,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC;;CAsBpE,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -79,6 +79,11 @@ var usePopup = function usePopup(props) {
79
79
  updatePosition();
80
80
  }
81
81
  setOpenState(!!props.open);
82
+
83
+ // 外部传了open时,需要正常的触发onCollapse;触发了onCollapse才能让组件内部的edit状态正确,否则可能会出现弹出层打开了但是用户却无法选择的情况
84
+ if (props.open !== undefined) {
85
+ changeOpen(!!props.open);
86
+ }
82
87
  }, [props.open]);
83
88
 
84
89
  // const getPopUpHeight = () => {
@@ -2,9 +2,10 @@ export { default, default as useTableLayout } from './use-table-layout';
2
2
  export { default as useTableColumns } from './use-table-columns';
3
3
  export { default as useTableGroup } from './use-table-group';
4
4
  export { default as useTableSort } from './use-table-sort';
5
+ export { default as useTableFilter } from './use-table-filter';
5
6
  export { default as useTableRow } from './use-table-row';
6
7
  export { default as useTableExpand } from './use-table-expand';
7
8
  export { default as useTableTree } from './use-table-tree';
8
9
  export { default as useTableVirtual } from './use-table-virtual';
9
- export type { TableFormatColumn, TableColumnItem, TableHeadColumn, TableGroupColumn, TableSorterInfo, BaseTableProps, } from './use-table.type';
10
+ export type { TableFormatColumn, TableColumnItem, TableHeadColumn, TableGroupColumn, TableSorterInfo, BaseTableProps, TableColumnFilter, TableFilterData, } from './use-table.type';
10
11
  //# 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,oBAAoB,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEjE,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,cAAc,GACf,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEjE,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,eAAe,GAChB,MAAM,kBAAkB,CAAC"}
@@ -22,6 +22,12 @@ Object.defineProperty(exports, "useTableExpand", {
22
22
  return _useTableExpand.default;
23
23
  }
24
24
  });
25
+ Object.defineProperty(exports, "useTableFilter", {
26
+ enumerable: true,
27
+ get: function get() {
28
+ return _useTableFilter.default;
29
+ }
30
+ });
25
31
  Object.defineProperty(exports, "useTableGroup", {
26
32
  enumerable: true,
27
33
  get: function get() {
@@ -62,6 +68,7 @@ var _useTableLayout = _interopRequireDefault(require("./use-table-layout"));
62
68
  var _useTableColumns = _interopRequireDefault(require("./use-table-columns"));
63
69
  var _useTableGroup = _interopRequireDefault(require("./use-table-group"));
64
70
  var _useTableSort = _interopRequireDefault(require("./use-table-sort"));
71
+ var _useTableFilter = _interopRequireDefault(require("./use-table-filter"));
65
72
  var _useTableRow = _interopRequireDefault(require("./use-table-row"));
66
73
  var _useTableExpand = _interopRequireDefault(require("./use-table-expand"));
67
74
  var _useTableTree = _interopRequireDefault(require("./use-table-tree"));
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ import { TableColumnItem, BaseTableProps } from './use-table.type';
3
+ import { KeygenResult } from '../../common/type';
4
+ export interface UseTableFilterProps<Item = any> extends Pick<BaseTableProps<Item>, 'onSortCancel' | 'sorter' | 'data'> {
5
+ columns?: TableColumnItem<Item>[];
6
+ }
7
+ export interface FilterInfo<T> {
8
+ value?: any;
9
+ onFilter?: (value: any, row: T) => boolean;
10
+ }
11
+ export type FilterMap<T> = Map<KeygenResult, FilterInfo<T>>;
12
+ declare const useTableFilter: <Item = any>(props: UseTableFilterProps<Item>) => {
13
+ filterInfo: FilterMap<Item>;
14
+ setFilterInfo: import("react").Dispatch<import("react").SetStateAction<FilterMap<Item>>>;
15
+ filteredData: Item[] | undefined;
16
+ onFilterChange: (columnKey: KeygenResult, value: any) => void;
17
+ };
18
+ export default useTableFilter;
19
+ //# sourceMappingURL=use-table-filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-table-filter.d.ts","sourceRoot":"","sources":["use-table-filter.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,WAAW,mBAAmB,CAAC,IAAI,GAAG,GAAG,CAC7C,SAAQ,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,cAAc,GAAG,QAAQ,GAAG,MAAM,CAAC;IACtE,OAAO,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;CACnC;AACD,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC;CAC5C;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAE5D,QAAA,MAAM,cAAc;;;;gCA6BH,YAAY,SAAS,GAAG;CAoDxC,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,96 @@
1
+ "use strict";
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
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = require("react");
9
+ var _usePersistFn = _interopRequireDefault(require("../../common/use-persist-fn"));
10
+ var _is = require("../../utils/is");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ 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; }
13
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
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
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
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
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
18
+ 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."); }
19
+ 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); }
20
+ 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; }
21
+ 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; } }
22
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
+ var useTableFilter = function useTableFilter(props) {
24
+ var _useState = (0, _react.useState)(new Map()),
25
+ _useState2 = _slicedToArray(_useState, 2),
26
+ filterInfo = _useState2[0],
27
+ setFilterInfo = _useState2[1];
28
+ var activeFilters = (0, _react.useMemo)(function () {
29
+ return Array.from(filterInfo.keys()).filter(function (key) {
30
+ var _filterInfo$get;
31
+ return ((_filterInfo$get = filterInfo.get(key)) === null || _filterInfo$get === void 0 ? void 0 : _filterInfo$get.value) !== undefined;
32
+ });
33
+ }, [filterInfo]);
34
+ var filteredData = (0, _react.useMemo)(function () {
35
+ var _props$data;
36
+ if (activeFilters.length === 0) return props.data;
37
+ return (_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.filter(function (item) {
38
+ return activeFilters.every(function (key) {
39
+ var filter = filterInfo.get(key);
40
+ if ((filter === null || filter === void 0 ? void 0 : filter.value) === undefined) return true;
41
+ if (Array.isArray(filter.value) && filter.value.length === 0) return true;
42
+ if (filter !== null && filter !== void 0 && filter.onFilter && (0, _is.isFunc)(filter.onFilter)) {
43
+ return filter.onFilter(filter.value, item);
44
+ }
45
+ return true;
46
+ });
47
+ });
48
+ }, [activeFilters, props.data]);
49
+ var onFilterChange = (0, _usePersistFn.default)(function (columnKey, value) {
50
+ // TODO: 暂未开放reset全部筛选条件
51
+ if (columnKey === '__reset__') {
52
+ setFilterInfo(function (prev) {
53
+ var next = new Map(prev);
54
+ next.forEach(function (v, k) {
55
+ next.set(k, _objectSpread(_objectSpread({}, v), {}, {
56
+ value: undefined
57
+ }));
58
+ });
59
+ return next;
60
+ });
61
+ } else {
62
+ setFilterInfo(function (prev) {
63
+ var _prev$get;
64
+ var next = new Map(prev);
65
+ next.set(columnKey, {
66
+ value: value,
67
+ onFilter: (_prev$get = prev.get(columnKey)) === null || _prev$get === void 0 ? void 0 : _prev$get.onFilter
68
+ });
69
+ return next;
70
+ });
71
+ }
72
+ });
73
+
74
+ // 根据columns生成filterInfo
75
+ (0, _react.useEffect)(function () {
76
+ var _props$columns;
77
+ var _filterInfo = props === null || props === void 0 || (_props$columns = props.columns) === null || _props$columns === void 0 ? void 0 : _props$columns.reduce(function (acc, column, index) {
78
+ var _column$filter;
79
+ if (!column.filter) return acc;
80
+ var columnKey = typeof column.render === 'string' ? column.render : String(index);
81
+ acc.set(columnKey, {
82
+ value: undefined,
83
+ onFilter: (_column$filter = column.filter) === null || _column$filter === void 0 ? void 0 : _column$filter.onFilter
84
+ });
85
+ return acc;
86
+ }, new Map());
87
+ if (_filterInfo) setFilterInfo(_filterInfo);
88
+ }, [props.columns]);
89
+ return {
90
+ filterInfo: filterInfo,
91
+ setFilterInfo: setFilterInfo,
92
+ filteredData: filteredData,
93
+ onFilterChange: onFilterChange
94
+ };
95
+ };
96
+ var _default = exports.default = useTableFilter;
@@ -1,5 +1,18 @@
1
1
  import type { BaseTableProps } from './use-table.type';
2
2
  import { OptionalToRequired } from '../../common/type';
3
+ type treeDataInfoType = {
4
+ id: string | number;
5
+ level: number;
6
+ data: any;
7
+ pid: null | string | number;
8
+ };
9
+ interface GetExpandDataVirtualResult {
10
+ treeData: any[];
11
+ treeExpandLevel: Map<any, number>;
12
+ unmatchExpandKeys: (string | number)[];
13
+ treeDataInfo: treeDataInfoType[];
14
+ }
15
+ export declare const getExpandVirtualData: (_treeData: any[], keys: (string | number)[], keygen: any, treeColumnsName?: string) => GetExpandDataVirtualResult;
3
16
  export interface UseTableTreeProps extends Pick<OptionalToRequired<BaseTableProps<any>>, 'onTreeExpand' | 'treeExpandKeys' | 'defaultTreeExpandKeys' | 'keygen'> {
4
17
  treeColumnsName: string | undefined;
5
18
  data: any[];
@@ -1 +1 @@
1
- {"version":3,"file":"use-table-tree.d.ts","sourceRoot":"","sources":["use-table-tree.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AA+CvD,MAAM,WAAW,iBACf,SAAQ,IAAI,CACV,kBAAkB,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,EACvC,cAAc,GAAG,gBAAgB,GAAG,uBAAuB,GAAG,QAAQ,CACvE;IACD,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,IAAI,EAAE,GAAG,EAAE,CAAC;CACb;AAED,eAAO,MAAM,YAAY,UAAW,iBAAiB;;;;;;+BA6BR,GAAG,SAAS,MAAM;iCAjBhB,GAAG,SAAS,MAAM;;CA4DhE,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"use-table-tree.d.ts","sourceRoot":"","sources":["use-table-tree.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAIvD,KAAK,gBAAgB,GAAG;IACtB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,GAAG,CAAC;IACV,GAAG,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;CAC7B,CAAC;AAOF,UAAU,0BAA0B;IAClC,QAAQ,EAAE,GAAG,EAAE,CAAC;IAChB,eAAe,EAAE,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAClC,iBAAiB,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IACvC,YAAY,EAAE,gBAAgB,EAAE,CAAC;CAClC;AAwCD,eAAO,MAAM,oBAAoB,cACpB,GAAG,EAAE,QACV,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,UACjB,GAAG,oBACO,MAAM,KACvB,0BAyDF,CAAC;AAEF,MAAM,WAAW,iBACf,SAAQ,IAAI,CACV,kBAAkB,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,EACvC,cAAc,GAAG,gBAAgB,GAAG,uBAAuB,GAAG,QAAQ,CACvE;IACD,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,IAAI,EAAE,GAAG,EAAE,CAAC;CACb;AAED,eAAO,MAAM,YAAY,UAAW,iBAAiB;;;;;;+BA6BR,GAAG,SAAS,MAAM;iCAjBhB,GAAG,SAAS,MAAM;;CA4DhE,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useTableTree = exports.default = void 0;
6
+ exports.useTableTree = exports.getExpandVirtualData = exports.default = void 0;
7
7
  var _react = require("react");
8
8
  var _usePersistFn = require("../../common/use-persist-fn");
9
9
  var _render = require("../../utils/render");
@@ -60,6 +60,73 @@ var getExpandData = function getExpandData(_treeData, keys, keygen, treeColumnsN
60
60
  unmatchExpandKeys: unmatchExpandKeys
61
61
  };
62
62
  };
63
+ var getExpandVirtualData = exports.getExpandVirtualData = function getExpandVirtualData(_treeData, keys, keygen, treeColumnsName) {
64
+ var expandKeys = keys;
65
+ var expandSet = new Set(expandKeys);
66
+ var unmatchExpandKeys = [];
67
+ var treeExpandLevel = new Map();
68
+ if (expandSet.size === 0 || !treeColumnsName) {
69
+ var _treeDataInfo = _treeData.map(function (item, index) {
70
+ return {
71
+ id: (0, _render.getKey)(keygen, item, index),
72
+ level: 1,
73
+ data: item,
74
+ pid: null
75
+ };
76
+ });
77
+ return {
78
+ treeData: _treeData,
79
+ treeExpandLevel: treeExpandLevel,
80
+ unmatchExpandKeys: unmatchExpandKeys,
81
+ treeDataInfo: _treeDataInfo
82
+ };
83
+ }
84
+ var treeData = _toConsumableArray(_treeData || []);
85
+ var treeDataInfo = treeData.map(function (item) {
86
+ return {
87
+ id: (0, _render.getKey)(keygen, item),
88
+ level: 1,
89
+ data: item,
90
+ pid: null
91
+ };
92
+ });
93
+ var _loop2 = function _loop2() {
94
+ if (expandSet.size === 0) return 1; // break
95
+ var item = treeData[i];
96
+ var key = (0, _render.getKey)(keygen, item, i);
97
+ var parentLevel = treeExpandLevel.get(key) || 0;
98
+ var children = (0, _is.isObject)(item) && item[treeColumnsName];
99
+ if (expandSet.has(key)) {
100
+ if (children && children.length > 0) {
101
+ var nodes = [];
102
+ children.forEach(function (child) {
103
+ var node = {
104
+ id: (0, _render.getKey)(keygen, child),
105
+ level: parentLevel + 2,
106
+ data: child,
107
+ pid: key
108
+ };
109
+ nodes.push(node);
110
+ treeExpandLevel.set((0, _render.getKey)(keygen, child), parentLevel + 1);
111
+ });
112
+ treeData.splice.apply(treeData, [i + 1, 0].concat(_toConsumableArray(children)));
113
+ treeDataInfo.splice.apply(treeDataInfo, [i + 1, 0].concat(nodes));
114
+ expandSet.delete(key);
115
+ } else {
116
+ unmatchExpandKeys.push(key);
117
+ }
118
+ }
119
+ };
120
+ for (var i = 0; i < treeData.length; i++) {
121
+ if (_loop2()) break;
122
+ }
123
+ return {
124
+ treeData: treeData,
125
+ treeExpandLevel: treeExpandLevel,
126
+ unmatchExpandKeys: unmatchExpandKeys,
127
+ treeDataInfo: treeDataInfo
128
+ };
129
+ };
63
130
  var useTableTree = exports.useTableTree = function useTableTree(props) {
64
131
  var _useState = (0, _react.useState)(props.defaultTreeExpandKeys || []),
65
132
  _useState2 = _slicedToArray(_useState, 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;CAC3C;AACD,QAAA,MAAM,eAAe,UAAW,oBAAoB;;;;;;;oBAuMpC,MAAM;mBACP,MAAM;WACd,MAAM;gBACD,MAAM;kBACJ,OAAO;;0BAnGuB,MAAM,UAAU,MAAM;0BAxBtB,MAAM,QAAQ,MAAM;2BA+JnB,MAAM,aAAa,MAAM,IAAI;qCAoBnB,MAAM;mCAWR,MAAM,GAAG,MAAM;CAyFnE,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,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;CAC3C;AACD,QAAA,MAAM,eAAe,UAAW,oBAAoB;;;;;;;oBAuMpC,MAAM;mBACP,MAAM;WACd,MAAM;gBACD,MAAM;kBACJ,OAAO;;0BAnGuB,MAAM,UAAU,MAAM;0BAxBtB,MAAM,QAAQ,MAAM;2BA+JnB,MAAM,aAAa,MAAM,IAAI;qCAoBnB,MAAM;mCAWR,MAAM,GAAG,MAAM;CA2FnE,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -169,7 +169,7 @@ var useTableVirtual = function useTableVirtual(props) {
169
169
  });
170
170
  }
171
171
  });
172
- var updateIndexAndTopFromTop = function updateIndexAndTopFromTop(scrollTop) {
172
+ var updateIndexAndTopFromTop = function updateIndexAndTopFromTop(scrollTop, fromDrag) {
173
173
  var _props$scrollRef$curr;
174
174
  if (props.disabled) return;
175
175
  var sum = 0;
@@ -209,7 +209,7 @@ var useTableVirtual = function useTableVirtual(props) {
209
209
  setStartIndex(currentIndex);
210
210
 
211
211
  // startIndex处于上方某个合并行的中间一行时,可能引起translate闪烁
212
- if (startIndex < currentIndex) {
212
+ if (rowSpanInfo && !fromDrag && startIndex < currentIndex) {
213
213
  context.autoAddRows = currentIndex - startIndex;
214
214
  setTimeout(function () {
215
215
  context.autoAddRows = 0;
@@ -269,7 +269,7 @@ var useTableVirtual = function useTableVirtual(props) {
269
269
  // 拖动滚动条
270
270
  if (fromDrag) {
271
271
  var top = y * max;
272
- updateIndexAndTopFromTop(top);
272
+ updateIndexAndTopFromTop(top, fromDrag);
273
273
  if (context.rateTimer) clearTimeout(context.rateTimer);
274
274
  context.rateTimer = setTimeout(function () {
275
275
  updateRateScroll(y);
@@ -371,8 +371,10 @@ var useTableVirtual = function useTableVirtual(props) {
371
371
  if (props.disabled) return;
372
372
  if (context.heightCallback) {
373
373
  var cb = context.heightCallback;
374
- context.heightCallback = null;
375
374
  cb();
375
+ setTimeout(function () {
376
+ context.heightCallback = null;
377
+ }, 300);
376
378
  }
377
379
  }, [scrollHeight]);
378
380
  var finalRowsInView = rowsInView + context.rowSpanRows + context.autoAddRows;
@@ -139,6 +139,93 @@ export interface TableColumnSorter {
139
139
  export interface ColumnRenderFunc<DataItem> {
140
140
  (data: DataItem, index: number, checkInstance?: React.ReactComponentElement<any>): React.ReactNode | (() => React.ReactNode);
141
141
  }
142
+ export interface TableColumnFilterBase<DataItem> {
143
+ /**
144
+ * @cn 筛选模式: search 搜索模式, select 选择模式
145
+ * @en Filter mode: search search mode, select select mode
146
+ */
147
+ mode: 'search' | 'select';
148
+ /**
149
+ * @cn 筛选数据的函数
150
+ * @en Filter data function
151
+ * @param value 筛选值
152
+ * @param row 行数据
153
+ * @returns 是否通过筛选
154
+ */
155
+ onFilter: (value: any, row: DataItem) => boolean;
156
+ /**
157
+ * @cn 自定义的筛选项图标
158
+ * @en Custom filter icon
159
+ */
160
+ icon?: React.ReactNode;
161
+ }
162
+ export type TableFilterData = {
163
+ label: string;
164
+ value: any;
165
+ icon?: React.ReactNode;
166
+ [key: string]: any;
167
+ children?: TableFilterData[];
168
+ };
169
+ export interface SelectModeColumnFilter<DataItem> extends TableColumnFilterBase<DataItem> {
170
+ /**
171
+ * @cn 筛选模式为 select 时
172
+ * @en Filter mode is select
173
+ */
174
+ mode: 'select';
175
+ /**
176
+ * 必填的 `config` 字段
177
+ */
178
+ config: {
179
+ /**
180
+ * @cn 筛选项数据
181
+ * @en Filter item data
182
+ */
183
+ data: Array<TableFilterData>;
184
+ /**
185
+ * @cn 自定义渲染筛选项
186
+ * @en Custom rendering filter options
187
+ * @default (data) => data.label
188
+ */
189
+ renderItem?: ((item: TableFilterData) => React.ReactNode) | ObjectKey<TableFilterData>;
190
+ /**
191
+ * @cn 是否多选
192
+ * @en Whether to multiple select
193
+ */
194
+ multiple?: boolean;
195
+ /**
196
+ * @cn 是否开启顶部的搜索框
197
+ * @en Whether to open the top search box
198
+ */
199
+ search?: boolean;
200
+ /**
201
+ * @cn 是否高亮命中的关键词,仅当 search 为 true 时有效
202
+ * @en Whether to highlight the hit keywords
203
+ */
204
+ highlight?: boolean;
205
+ };
206
+ /**
207
+ * @cn 筛选数据的函数
208
+ * @en Filter data function
209
+ * @param value 筛选值,单选时为单个值,多选时为数组
210
+ * @param row 行数据
211
+ * @returns 是否通过筛选
212
+ */
213
+ onFilter: (value: any, row: DataItem) => boolean;
214
+ }
215
+ export interface SearchModeColumnFilter<DataItem> extends TableColumnFilterBase<DataItem> {
216
+ /**
217
+ * 筛选模式为 search 时
218
+ */
219
+ mode: 'search';
220
+ /**
221
+ * 此时不允许传 `config`
222
+ */
223
+ config?: never;
224
+ }
225
+ /**
226
+ * 最终的联合类型
227
+ */
228
+ export type TableColumnFilter<DataItem> = SelectModeColumnFilter<DataItem> | SearchModeColumnFilter<DataItem>;
142
229
  /**
143
230
  * @title TableColumn
144
231
  */
@@ -227,6 +314,12 @@ export interface TableColumnItem<DataItem> {
227
314
  * @version 3.5.0
228
315
  */
229
316
  sortDirections?: ('asc' | 'desc')[];
317
+ /**
318
+ * @cn 列的筛选配置
319
+ * @en Column filter configuration
320
+ * @version 3.6.0
321
+ */
322
+ filter?: TableColumnFilter<DataItem>;
230
323
  /**
231
324
  * @en The content of the header
232
325
  * @cn 表头显示内容
@@ -1 +1 @@
1
- {"version":3,"file":"use-table.type.d.ts","sourceRoot":"","sources":["use-table.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE9E,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,MAAM,CAAC;AAC9C,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,CAAC;AAC9C,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,YAAY,GAAG,UAAU,CAAC;AAEnE,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,YAAY,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB;AACD,MAAM,WAAW,cAAc,CAAC,IAAI;IAClC;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,YAAY,EAAE,CAAC;IACvC;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9F;;;OAGG;IACH,cAAc,CAAC,EAAE,YAAY,EAAE,CAAC;IAEhC;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE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AAG,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { TabsProviderProps, TabsContextProps } from './context.type';
3
3
  export declare const TabsContext: React.Context<TabsContextProps<any>>;
4
- export declare const Provider: <TabData>(props: TabsProviderProps<TabData>) => JSX.Element;
4
+ export declare const Provider: <TabData>(props: TabsProviderProps<TabData>) => import("react/jsx-runtime").JSX.Element;
5
5
  export declare const useTabsContext: <TabData>() => TabsContextProps<TabData>;
6
6
  //# sourceMappingURL=context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAErE,eAAO,MAAM,WAAW,sCAA8E,CAAC;AAEvG,eAAO,MAAM,QAAQ,6DAGpB,CAAC;AAEF,eAAO,MAAM,cAAc,0CAA8E,CAAC"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAErE,eAAO,MAAM,WAAW,sCAA8E,CAAC;AAEvG,eAAO,MAAM,QAAQ,yFAGpB,CAAC;AAEF,eAAO,MAAM,cAAc,0CAA8E,CAAC"}
@@ -5,7 +5,7 @@ declare const useTabs: <TabData = any>(props: BaseTabsProps) => {
5
5
  onChange: (key: string | number) => void;
6
6
  tabs: TabData[];
7
7
  setTabs: import("react").Dispatch<import("react").SetStateAction<TabData[]>>;
8
- Provider: <TabData_1>(props: import("./context.type").TabsProviderProps<TabData_1>) => JSX.Element;
8
+ Provider: <TabData_1>(props: import("./context.type").TabsProviderProps<TabData_1>) => import("react/jsx-runtime").JSX.Element;
9
9
  };
10
10
  export default useTabs;
11
11
  //# sourceMappingURL=use-tabs.d.ts.map
@@ -1,5 +1,6 @@
1
- export { default, default as useTree } from './use-tree';
2
- export type { BaseTreeProps, UpdateFunc, TreePathType, TreeModeType } from './use-tree.type';
1
+ export { default, default as useTree, MODE } from './use-tree';
2
+ export type { BaseTreeProps, UpdateFunc, TreePathType, TreeModeType, DisabledOption, FlatNodeType, } from './use-tree.type';
3
3
  export { default as useTreeNode } from './use-tree-node';
4
+ export { default as useTreeVirtualNode } from './use-tree-virtual-node';
4
5
  export type { BaseTreeNodeProps, UpdateType } from './use-tree-node.type';
5
6
  //# 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,OAAO,EAAE,MAAM,YAAY,CAAC;AACzD,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE7F,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAC/D,YAAY,EACV,aAAa,EACb,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,YAAY,GACb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACxE,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1,9 +1,16 @@
1
1
  "use strict";
2
2
  "use client";
3
3
 
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); }
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
8
+ Object.defineProperty(exports, "MODE", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _useTree.MODE;
12
+ }
13
+ });
7
14
  Object.defineProperty(exports, "default", {
8
15
  enumerable: true,
9
16
  get: function get() {
@@ -22,6 +29,15 @@ Object.defineProperty(exports, "useTreeNode", {
22
29
  return _useTreeNode.default;
23
30
  }
24
31
  });
25
- var _useTree = _interopRequireDefault(require("./use-tree"));
32
+ Object.defineProperty(exports, "useTreeVirtualNode", {
33
+ enumerable: true,
34
+ get: function get() {
35
+ return _useTreeVirtualNode.default;
36
+ }
37
+ });
38
+ var _useTree = _interopRequireWildcard(require("./use-tree"));
26
39
  var _useTreeNode = _interopRequireDefault(require("./use-tree-node"));
27
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
40
+ var _useTreeVirtualNode = _interopRequireDefault(require("./use-tree-virtual-node"));
41
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
42
+ 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); }
43
+ 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; }
@@ -1 +1 @@
1
- {"version":3,"file":"use-tree-node.d.ts","sourceRoot":"","sources":["use-tree-node.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,QAAA,MAAM,WAAW;kBAMmB,MAAM,SAAS,OAAO;;;;;;;;CAmDzD,CAAC;AACF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"use-tree-node.d.ts","sourceRoot":"","sources":["use-tree-node.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,QAAA,MAAM,WAAW;kBAMmB,MAAM,SAAS,OAAO;;;;;;;;CA+CzD,CAAC;AACF,eAAe,WAAW,CAAC"}