@sheinx/hooks 3.3.7-beta.6 → 3.4.0-beta.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. package/cjs/components/use-datepicker/use-date.d.ts +1 -1
  2. package/cjs/components/use-datepicker/use-date.d.ts.map +1 -1
  3. package/cjs/components/use-datepicker/use-date.js +2 -2
  4. package/cjs/components/use-datepicker/use-date.type.d.ts +1 -1
  5. package/cjs/components/use-datepicker/use-date.type.d.ts.map +1 -1
  6. package/cjs/components/use-datepicker/use-datepicker-format.d.ts +1 -1
  7. package/cjs/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
  8. package/cjs/components/use-datepicker/use-datepicker-format.js +4 -9
  9. package/cjs/components/use-datepicker/use-datepicker-format.type.d.ts +1 -0
  10. package/cjs/components/use-datepicker/use-datepicker-format.type.d.ts.map +1 -1
  11. package/cjs/components/use-datepicker/use-month.d.ts +1 -1
  12. package/cjs/components/use-datepicker/use-month.d.ts.map +1 -1
  13. package/cjs/components/use-datepicker/use-month.js +2 -2
  14. package/cjs/components/use-datepicker/use-month.type.d.ts +1 -1
  15. package/cjs/components/use-datepicker/use-month.type.d.ts.map +1 -1
  16. package/cjs/components/use-datepicker/use-quarter.d.ts +1 -1
  17. package/cjs/components/use-datepicker/use-quarter.d.ts.map +1 -1
  18. package/cjs/components/use-datepicker/use-quarter.js +2 -2
  19. package/cjs/components/use-datepicker/use-year.d.ts +1 -1
  20. package/cjs/components/use-datepicker/use-year.d.ts.map +1 -1
  21. package/cjs/components/use-datepicker/use-year.js +2 -2
  22. package/cjs/components/use-datepicker/use-year.type.d.ts +1 -1
  23. package/cjs/components/use-datepicker/use-year.type.d.ts.map +1 -1
  24. package/cjs/components/use-table/use-table-layout.d.ts.map +1 -1
  25. package/cjs/components/use-table/use-table-layout.js +0 -1
  26. package/cjs/components/use-table/use-table-virtual.d.ts +1 -1
  27. package/cjs/components/use-table/use-table-virtual.d.ts.map +1 -1
  28. package/cjs/components/use-table/use-table-virtual.js +6 -1
  29. package/esm/components/use-datepicker/use-date.d.ts +1 -1
  30. package/esm/components/use-datepicker/use-date.d.ts.map +1 -1
  31. package/esm/components/use-datepicker/use-date.js +2 -2
  32. package/esm/components/use-datepicker/use-date.type.d.ts +1 -1
  33. package/esm/components/use-datepicker/use-date.type.d.ts.map +1 -1
  34. package/esm/components/use-datepicker/use-datepicker-format.d.ts +1 -1
  35. package/esm/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
  36. package/esm/components/use-datepicker/use-datepicker-format.js +4 -9
  37. package/esm/components/use-datepicker/use-datepicker-format.type.d.ts +1 -0
  38. package/esm/components/use-datepicker/use-datepicker-format.type.d.ts.map +1 -1
  39. package/esm/components/use-datepicker/use-month.d.ts +1 -1
  40. package/esm/components/use-datepicker/use-month.d.ts.map +1 -1
  41. package/esm/components/use-datepicker/use-month.js +2 -2
  42. package/esm/components/use-datepicker/use-month.type.d.ts +1 -1
  43. package/esm/components/use-datepicker/use-month.type.d.ts.map +1 -1
  44. package/esm/components/use-datepicker/use-quarter.d.ts +1 -1
  45. package/esm/components/use-datepicker/use-quarter.d.ts.map +1 -1
  46. package/esm/components/use-datepicker/use-quarter.js +2 -2
  47. package/esm/components/use-datepicker/use-year.d.ts +1 -1
  48. package/esm/components/use-datepicker/use-year.d.ts.map +1 -1
  49. package/esm/components/use-datepicker/use-year.js +2 -2
  50. package/esm/components/use-datepicker/use-year.type.d.ts +1 -1
  51. package/esm/components/use-datepicker/use-year.type.d.ts.map +1 -1
  52. package/esm/components/use-table/use-table-layout.d.ts.map +1 -1
  53. package/esm/components/use-table/use-table-layout.js +0 -1
  54. package/esm/components/use-table/use-table-virtual.d.ts +1 -1
  55. package/esm/components/use-table/use-table-virtual.d.ts.map +1 -1
  56. package/esm/components/use-table/use-table-virtual.js +6 -1
  57. package/package.json +1 -1
@@ -14,7 +14,7 @@ declare const useDate: (props: UseDateProps) => {
14
14
  isActive: (date: Date) => boolean;
15
15
  isInRange: (date: Date) => false | "end" | "start" | "start-end" | "in";
16
16
  isCurrentMonth: (date: Date) => boolean;
17
- handleDayClick: (date: Date) => void;
17
+ handleDayClick: (date: Date, noClose?: boolean) => void;
18
18
  getDayStr: (date: Date) => number;
19
19
  getWeekStr: (date: Date) => number;
20
20
  getTimeStr: () => string;
@@ -1 +1 @@
1
- {"version":3,"file":"use-date.d.ts","sourceRoot":"","sources":["use-date.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAU/C,QAAA,MAAM,OAAO,UAAW,YAAY;;;;;;;;;;wBAmBX,IAAI;2BA6CD,IAAI;yBAgBN,IAAI;0BAiDH,IAAI;+BArEC,IAAI;+BA+CJ,IAAI;0BAnBT,IAAI;2BAIH,IAAI;;gCAIC,IAAI;;CAgFpC,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"use-date.d.ts","sourceRoot":"","sources":["use-date.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAU/C,QAAA,MAAM,OAAO,UAAW,YAAY;;;;;;;;;;wBAmBX,IAAI;2BA6CD,IAAI;yBAgBN,IAAI;0BAiDH,IAAI;+BArEC,IAAI;+BA+CJ,IAAI,YAAY,OAAO;0BAnB5B,IAAI;2BAIH,IAAI;;gCAIC,IAAI;;CAgFpC,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -101,11 +101,11 @@ var useDate = function useDate(props) {
101
101
  var getDateWithTime = function getDateWithTime(date) {
102
102
  return _util.default.getDateWithTime(date, props.value, props.defaultTime, props.min, props.max, options);
103
103
  };
104
- var handleDayClick = function handleDayClick(date) {
104
+ var handleDayClick = function handleDayClick(date, noClose) {
105
105
  var _props$onChange;
106
106
  if (isDisabled(date)) return;
107
107
  var newDate = getDateWithTime(date);
108
- (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newDate);
108
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newDate, noClose);
109
109
  setCurrent(newDate);
110
110
  };
111
111
  var getTimeStr = function getTimeStr() {
@@ -4,7 +4,7 @@ export interface UseDateProps {
4
4
  defaultCurrent?: Date;
5
5
  onCurrentChange?: (date: Date) => void;
6
6
  value?: Date;
7
- onChange?: (date: Date) => void;
7
+ onChange?: (date: Date, noClose?: boolean) => void;
8
8
  min?: Date;
9
9
  max?: Date;
10
10
  type?: 'date' | 'week' | 'datetime';
@@ -1 +1 @@
1
- {"version":3,"file":"use-date.type.d.ts","sourceRoot":"","sources":["use-date.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,SAAS,CAAC,EAAE,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC;IAC/C,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACrC,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH"}
1
+ {"version":3,"file":"use-date.type.d.ts","sourceRoot":"","sources":["use-date.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,SAAS,CAAC,EAAE,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC;IAC/C,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACrC,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH"}
@@ -16,7 +16,7 @@ declare const useDatePickerFormat: <Value extends DatePickerValueType>(props: Us
16
16
  finishEdit: () => void;
17
17
  setCurrentArr: React.Dispatch<React.SetStateAction<Date[]>>;
18
18
  setTargetArr: React.Dispatch<React.SetStateAction<(Date | undefined)[]>>;
19
- handleClear: (e: React.MouseEvent) => void;
19
+ handleClear: (e?: React.MouseEvent) => void;
20
20
  handleInputChange: (str: string, index: number) => void;
21
21
  registerModeDisabled: (position: 'start' | 'end' | undefined, mode: string, fn: (d: Date) => boolean) => void;
22
22
  setCurrentArrWithParams: (arg: React.SetStateAction<Date[]>, type: string, quick: {
@@ -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;;;;;;;;;;;;;;;;yBAiJc,gBAAgB;iCA8BR,MAAM,SAAS,MAAM;yCA7HrD,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;;+BAQH,IAAI,YAAY,OAAO,GAAG,KAAK,GAAG,SAAS;;CAwKvF,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;;;;;;;;;;;;;;;;0BA4Ie,gBAAgB;iCAgCT,MAAM,SAAS,MAAM;yCA/HrD,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;;+BAQH,IAAI,YAAY,OAAO,GAAG,KAAK,GAAG,SAAS;;CA0KvF,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -92,13 +92,6 @@ var useDatePickerFormat = function useDatePickerFormat(props) {
92
92
  var getCurrentArr = function getCurrentArr() {
93
93
  var arr = convertValueToDateArr(value, format, options);
94
94
  var currentArr = convertValueToDateArr(props.defaultCurrent, 'YYYY-MM-DD', options);
95
- var validArr = arr.filter(function (item) {
96
- return item;
97
- });
98
- var validCurrentArr = currentArr.filter(function (item) {
99
- return item;
100
- });
101
- if (!validArr.length && currentArr.length) return validCurrentArr;
102
95
  if (!arr[0]) arr[0] = arr[1] || currentArr[0] || new Date();
103
96
  if (range && !arr[1]) arr[1] = arr[0] || currentArr[1] || new Date();
104
97
  return arr;
@@ -222,7 +215,7 @@ var useDatePickerFormat = function useDatePickerFormat(props) {
222
215
  var handleClear = (0, _usePersistFn.usePersistFn)(function (e) {
223
216
  var _props$onClear;
224
217
  if (!clearable) return;
225
- e.stopPropagation();
218
+ e === null || e === void 0 || e.stopPropagation();
226
219
  if (disabledStatus === 'all') return;
227
220
  if (edit) {
228
221
  if (range) {
@@ -236,7 +229,7 @@ var useDatePickerFormat = function useDatePickerFormat(props) {
236
229
  }
237
230
  } else {
238
231
  var _props$onChange;
239
- var emptyValue = props.clearWithUndefined ? undefined : '';
232
+ var emptyValue = props.clearWithUndefined || props.clearToUndefined ? undefined : '';
240
233
  var v = emptyValue;
241
234
  if (range) {
242
235
  v = [emptyValue, emptyValue];
@@ -245,6 +238,8 @@ var useDatePickerFormat = function useDatePickerFormat(props) {
245
238
  v = [props.value[0], emptyValue];
246
239
  } else if (props.value[1] && disabledStatus === 'right') {
247
240
  v = [emptyValue, props.value[1]];
241
+ } else if (props.clearToUndefined) {
242
+ v = undefined;
248
243
  }
249
244
  }
250
245
  }
@@ -15,6 +15,7 @@ export interface UseDatePickerFormatProps<Value extends DatePickerValueType> {
15
15
  } | undefined;
16
16
  clearable: boolean | undefined;
17
17
  clearWithUndefined: boolean | undefined;
18
+ clearToUndefined?: boolean;
18
19
  onClear: (() => void) | undefined;
19
20
  allowSingle: boolean | undefined;
20
21
  defaultCurrent: DatePickerValueType;
@@ -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,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KAAK,GAAG,SAAS,CAAC;IACzB,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,SAAS,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC/F,OAAO,EACH;QACE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GACD,SAAS,CAAC;IACd,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,kBAAkB,EAAE,OAAO,GAAG,SAAS,CAAC;IACxC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,EAAE,CAAC,MAAM,IAAI,CAAC,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"}
@@ -10,7 +10,7 @@ declare const useMonth: (props: UseMonthProps) => {
10
10
  isDisabled: (date: Date) => boolean;
11
11
  isActive: (date: Date) => boolean;
12
12
  isInRange: (date: Date) => false | "end" | "start" | "start-end" | "in";
13
- handleMonthClick: (date: Date) => void;
13
+ handleMonthClick: (date: Date, onClose?: boolean) => void;
14
14
  getMonthStr: (date: Date) => number;
15
15
  };
16
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-month.d.ts","sourceRoot":"","sources":["use-month.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAajD,QAAA,MAAM,QAAQ,UAAW,aAAa;;;;;;;sBAuBf,IAAI;2BAkCC,IAAI;yBAQN,IAAI;0BAgBH,IAAI;iCAPG,IAAI;4BAJT,IAAI;;CAwChC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"use-month.d.ts","sourceRoot":"","sources":["use-month.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAajD,QAAA,MAAM,QAAQ,UAAW,aAAa;;;;;;;sBAuBf,IAAI;2BAkCC,IAAI;yBAQN,IAAI;0BAgBH,IAAI;iCAPG,IAAI,YAAW,OAAO;4BAJ3B,IAAI;;CAwChC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -82,11 +82,11 @@ var useMonth = function useMonth(props) {
82
82
  var getMonthStr = function getMonthStr(date) {
83
83
  return _util.default.getDateInfo(date, 'month', options) + 1;
84
84
  };
85
- var handleMonthClick = function handleMonthClick(date) {
85
+ var handleMonthClick = function handleMonthClick(date, onClose) {
86
86
  var _props$onChange;
87
87
  if (isDisabled(date)) return;
88
88
  var newDate = _util.default.toDate(date);
89
- (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newDate);
89
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newDate, onClose);
90
90
  setCurrent(newDate);
91
91
  };
92
92
  var isInRange = function isInRange(date) {
@@ -4,7 +4,7 @@ export interface UseMonthProps {
4
4
  defaultCurrent?: Date;
5
5
  onCurrentChange?: (date: Date) => void;
6
6
  value?: Date;
7
- onChange?: (date: Date) => void;
7
+ onChange?: (date: Date, onClose?: boolean) => void;
8
8
  min?: Date;
9
9
  max?: Date;
10
10
  disabled?: boolean | ((date: Date) => boolean);
@@ -1 +1 @@
1
- {"version":3,"file":"use-month.type.d.ts","sourceRoot":"","sources":["use-month.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,SAAS,CAAC,EAAE,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC;IAC/C,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH"}
1
+ {"version":3,"file":"use-month.type.d.ts","sourceRoot":"","sources":["use-month.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,SAAS,CAAC,EAAE,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC;IAC/C,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH"}
@@ -10,7 +10,7 @@ declare const useQuarter: (props: UseMonthProps) => {
10
10
  isDisabled: (date: Date) => boolean;
11
11
  isActive: (date: Date) => boolean;
12
12
  isInRange: (date: Date) => false | "end" | "start" | "start-end" | "in";
13
- handleQuarterClick: (date: Date) => void;
13
+ handleQuarterClick: (date: Date, noClose?: boolean) => void;
14
14
  getQuarterStr: (date: Date) => number;
15
15
  };
16
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-quarter.d.ts","sourceRoot":"","sources":["use-quarter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAajD,QAAA,MAAM,UAAU,UAAW,aAAa;;;;;;;sBAuBjB,IAAI;2BAiCC,IAAI;yBAQN,IAAI;0BAgBH,IAAI;mCAPK,IAAI;8BAJT,IAAI;;CAwClC,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"use-quarter.d.ts","sourceRoot":"","sources":["use-quarter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAajD,QAAA,MAAM,UAAU,UAAW,aAAa;;;;;;;sBAuBjB,IAAI;2BAiCC,IAAI;yBAQN,IAAI;0BAgBH,IAAI;mCAPK,IAAI,YAAY,OAAO;8BAJ5B,IAAI;;CAwClC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -81,11 +81,11 @@ var useQuarter = function useQuarter(props) {
81
81
  var getQuarterStr = function getQuarterStr(date) {
82
82
  return _util.default.getDateInfo(date, 'quarter', options);
83
83
  };
84
- var handleQuarterClick = function handleQuarterClick(date) {
84
+ var handleQuarterClick = function handleQuarterClick(date, noClose) {
85
85
  var _props$onChange;
86
86
  if (isDisabled(date)) return;
87
87
  var newDate = _util.default.toDate(date);
88
- (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newDate);
88
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newDate, noClose);
89
89
  setCurrent(newDate);
90
90
  };
91
91
  var isInRange = function isInRange(date) {
@@ -12,7 +12,7 @@ declare const useYear: (props: UseYearProps) => {
12
12
  isDisabled: (date: Date) => boolean;
13
13
  isActive: (date: Date) => boolean;
14
14
  isInRange: (date: Date) => false | "end" | "start" | "start-end" | "in";
15
- handleYearClick: (date: Date) => void;
15
+ handleYearClick: (date: Date, noClose?: boolean) => void;
16
16
  getYearStr: (date: Date) => number;
17
17
  };
18
18
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-year.d.ts","sourceRoot":"","sources":["use-year.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAW/C,QAAA,MAAM,OAAO,UAAW,YAAY;;;;;;;;;sBAsBb,IAAI;2BA8BC,IAAI;yBAQN,IAAI;0BAgBH,IAAI;gCAPE,IAAI;2BAJT,IAAI;;CA4C/B,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"use-year.d.ts","sourceRoot":"","sources":["use-year.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAW/C,QAAA,MAAM,OAAO,UAAW,YAAY;;;;;;;;;sBAsBb,IAAI;2BA8BC,IAAI;yBAQN,IAAI;0BAgBH,IAAI;gCAPE,IAAI,YAAY,OAAO;2BAJ5B,IAAI;;CA4C/B,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -80,11 +80,11 @@ var useYear = function useYear(props) {
80
80
  var getYearStr = function getYearStr(date) {
81
81
  return _util.default.getDateInfo(date, 'year', options);
82
82
  };
83
- var handleYearClick = function handleYearClick(date) {
83
+ var handleYearClick = function handleYearClick(date, noClose) {
84
84
  var _props$onChange;
85
85
  if (isDisabled(date)) return;
86
86
  var newDate = _util.default.toDate(date);
87
- (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newDate);
87
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newDate, noClose);
88
88
  setCurrent(newDate);
89
89
  };
90
90
  var isInRange = function isInRange(date) {
@@ -4,7 +4,7 @@ export interface UseYearProps {
4
4
  defaultCurrent?: Date;
5
5
  onCurrentChange?: (date: Date) => void;
6
6
  value?: Date;
7
- onChange?: (date: Date) => void;
7
+ onChange?: (date: Date, noClose?: boolean) => void;
8
8
  min?: Date;
9
9
  max?: Date;
10
10
  disabled?: boolean | ((date: Date) => boolean);
@@ -1 +1 @@
1
- {"version":3,"file":"use-year.type.d.ts","sourceRoot":"","sources":["use-year.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,SAAS,CAAC,EAAE,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;IAEX,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC;IAC/C,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH"}
1
+ {"version":3,"file":"use-year.type.d.ts","sourceRoot":"","sources":["use-year.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,SAAS,CAAC,EAAE,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;IAEX,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC;IAC/C,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-table-layout.d.ts","sourceRoot":"","sources":["use-table-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAKlE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAcrE,MAAM,WAAW,mBACf,SAAQ,IAAI,CACV,cAAc,CAAC,GAAG,CAAC,EACnB,MAAM,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,OAAO,CAC7E;IACD,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,QAAA,MAAM,cAAc,UAAW,mBAAmB;;;;;;;;;;;yBA+CX,MAAM,UAAU,MAAM;;;;;;;;CAmO5D,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"use-table-layout.d.ts","sourceRoot":"","sources":["use-table-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAKlE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAcrE,MAAM,WAAW,mBACf,SAAQ,IAAI,CACV,cAAc,CAAC,GAAG,CAAC,EACnB,MAAM,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,OAAO,CAC7E;IACD,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,QAAA,MAAM,cAAc,UAAW,mBAAmB;;;;;;;;;;;yBA8CX,MAAM,UAAU,MAAM;;;;;;;;CAmO5D,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -103,7 +103,6 @@ var useTableLayout = function useTableLayout(props) {
103
103
  return;
104
104
  }
105
105
  context.clientWidth = scrollEl.clientWidth;
106
- if (scrollEl.clientHeight === 0) return;
107
106
  var overHeight = scrollEl.scrollHeight > scrollEl.clientHeight;
108
107
  var overWidth = scrollEl.scrollWidth > context.clientWidth;
109
108
  var newScrollBarWidth = overHeight ? scrollEl.offsetWidth - scrollEl.clientWidth : 0;
@@ -26,7 +26,7 @@ declare const useTableVirtual: (props: UseTableVirtualProps) => {
26
26
  }) => void;
27
27
  setRowHeight: (index: number, height: number) => void;
28
28
  getTranslate: (left?: number, top?: number) => string;
29
- scrollToIndex: (index: number) => void;
29
+ scrollToIndex: (index: number, callback?: () => void) => void;
30
30
  };
31
31
  export default useTableVirtual;
32
32
  //# sourceMappingURL=use-table-virtual.d.ts.map
@@ -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;AAGrD,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;CACnC;AACD,QAAA,MAAM,eAAe,UAAW,oBAAoB;;;;;;;oBAsLpC,MAAM;mBACP,MAAM;WACd,MAAM;gBACD,MAAM;kBACJ,OAAO;;0BAtFuB,MAAM,UAAU,MAAM;0BAxBtB,MAAM,QAAQ,MAAM;2BAkJnB,MAAM;CAwFlD,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;AAGrD,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;CACnC;AACD,QAAA,MAAM,eAAe,UAAW,oBAAoB;;;;;;;oBAqLpC,MAAM;mBACP,MAAM;WACd,MAAM;gBACD,MAAM;kBACJ,OAAO;;0BAzFuB,MAAM,UAAU,MAAM;0BAxBtB,MAAM,QAAQ,MAAM;2BAqJnB,MAAM,aAAa,MAAM,IAAI;CA8FzE,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -241,7 +241,7 @@ var useTableVirtual = function useTableVirtual(props) {
241
241
  updateIndexAndTopFromTop(scrollTop);
242
242
  }
243
243
  };
244
- var scrollToIndex = (0, _usePersistFn.usePersistFn)(function (index) {
244
+ var scrollToIndex = (0, _usePersistFn.usePersistFn)(function (index, callback) {
245
245
  if (props.disabled) return;
246
246
  if (props.scrollRef.current) {
247
247
  context.shouldUpdateHeight = true;
@@ -252,6 +252,9 @@ var useTableVirtual = function useTableVirtual(props) {
252
252
  if (beforeHeight2 !== beforeHeight) {
253
253
  scrollToIndex(index);
254
254
  }
255
+ if (callback && typeof callback === 'function') {
256
+ callback();
257
+ }
255
258
  };
256
259
  props.scrollRef.current.scrollTop = beforeHeight;
257
260
  }
@@ -280,6 +283,8 @@ var useTableVirtual = function useTableVirtual(props) {
280
283
  }, [startIndex]);
281
284
  (0, _react.useEffect)(function () {
282
285
  // 数据变化的时候清空掉 preIndex, 如果之前有缓存的index, setRowHeight 会有问题
286
+ setTop(0);
287
+ setStartIndex(0);
283
288
  return function () {
284
289
  context.preIndex = null;
285
290
  };
@@ -14,7 +14,7 @@ declare const useDate: (props: UseDateProps) => {
14
14
  isActive: (date: Date) => boolean;
15
15
  isInRange: (date: Date) => false | "end" | "start" | "start-end" | "in";
16
16
  isCurrentMonth: (date: Date) => boolean;
17
- handleDayClick: (date: Date) => void;
17
+ handleDayClick: (date: Date, noClose?: boolean) => void;
18
18
  getDayStr: (date: Date) => number;
19
19
  getWeekStr: (date: Date) => number;
20
20
  getTimeStr: () => string;
@@ -1 +1 @@
1
- {"version":3,"file":"use-date.d.ts","sourceRoot":"","sources":["use-date.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAU/C,QAAA,MAAM,OAAO,UAAW,YAAY;;;;;;;;;;wBAmBX,IAAI;2BA6CD,IAAI;yBAgBN,IAAI;0BAiDH,IAAI;+BArEC,IAAI;+BA+CJ,IAAI;0BAnBT,IAAI;2BAIH,IAAI;;gCAIC,IAAI;;CAgFpC,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"use-date.d.ts","sourceRoot":"","sources":["use-date.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAU/C,QAAA,MAAM,OAAO,UAAW,YAAY;;;;;;;;;;wBAmBX,IAAI;2BA6CD,IAAI;yBAgBN,IAAI;0BAiDH,IAAI;+BArEC,IAAI;+BA+CJ,IAAI,YAAY,OAAO;0BAnB5B,IAAI;2BAIH,IAAI;;gCAIC,IAAI;;CAgFpC,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -95,11 +95,11 @@ var useDate = function useDate(props) {
95
95
  var getDateWithTime = function getDateWithTime(date) {
96
96
  return utils.getDateWithTime(date, props.value, props.defaultTime, props.min, props.max, options);
97
97
  };
98
- var handleDayClick = function handleDayClick(date) {
98
+ var handleDayClick = function handleDayClick(date, noClose) {
99
99
  var _props$onChange;
100
100
  if (isDisabled(date)) return;
101
101
  var newDate = getDateWithTime(date);
102
- (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newDate);
102
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newDate, noClose);
103
103
  setCurrent(newDate);
104
104
  };
105
105
  var getTimeStr = function getTimeStr() {
@@ -4,7 +4,7 @@ export interface UseDateProps {
4
4
  defaultCurrent?: Date;
5
5
  onCurrentChange?: (date: Date) => void;
6
6
  value?: Date;
7
- onChange?: (date: Date) => void;
7
+ onChange?: (date: Date, noClose?: boolean) => void;
8
8
  min?: Date;
9
9
  max?: Date;
10
10
  type?: 'date' | 'week' | 'datetime';
@@ -1 +1 @@
1
- {"version":3,"file":"use-date.type.d.ts","sourceRoot":"","sources":["use-date.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,SAAS,CAAC,EAAE,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC;IAC/C,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACrC,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH"}
1
+ {"version":3,"file":"use-date.type.d.ts","sourceRoot":"","sources":["use-date.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,SAAS,CAAC,EAAE,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC;IAC/C,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACrC,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH"}
@@ -16,7 +16,7 @@ declare const useDatePickerFormat: <Value extends DatePickerValueType>(props: Us
16
16
  finishEdit: () => void;
17
17
  setCurrentArr: React.Dispatch<React.SetStateAction<Date[]>>;
18
18
  setTargetArr: React.Dispatch<React.SetStateAction<(Date | undefined)[]>>;
19
- handleClear: (e: React.MouseEvent) => void;
19
+ handleClear: (e?: React.MouseEvent) => void;
20
20
  handleInputChange: (str: string, index: number) => void;
21
21
  registerModeDisabled: (position: 'start' | 'end' | undefined, mode: string, fn: (d: Date) => boolean) => void;
22
22
  setCurrentArrWithParams: (arg: React.SetStateAction<Date[]>, type: string, quick: {
@@ -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;;;;;;;;;;;;;;;;yBAiJc,gBAAgB;iCA8BR,MAAM,SAAS,MAAM;yCA7HrD,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;;+BAQH,IAAI,YAAY,OAAO,GAAG,KAAK,GAAG,SAAS;;CAwKvF,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;;;;;;;;;;;;;;;;0BA4Ie,gBAAgB;iCAgCT,MAAM,SAAS,MAAM;yCA/HrD,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;;+BAQH,IAAI,YAAY,OAAO,GAAG,KAAK,GAAG,SAAS;;CA0KvF,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -85,13 +85,6 @@ var useDatePickerFormat = function useDatePickerFormat(props) {
85
85
  var getCurrentArr = function getCurrentArr() {
86
86
  var arr = convertValueToDateArr(value, format, options);
87
87
  var currentArr = convertValueToDateArr(props.defaultCurrent, 'YYYY-MM-DD', options);
88
- var validArr = arr.filter(function (item) {
89
- return item;
90
- });
91
- var validCurrentArr = currentArr.filter(function (item) {
92
- return item;
93
- });
94
- if (!validArr.length && currentArr.length) return validCurrentArr;
95
88
  if (!arr[0]) arr[0] = arr[1] || currentArr[0] || new Date();
96
89
  if (range && !arr[1]) arr[1] = arr[0] || currentArr[1] || new Date();
97
90
  return arr;
@@ -215,7 +208,7 @@ var useDatePickerFormat = function useDatePickerFormat(props) {
215
208
  var handleClear = usePersistFn(function (e) {
216
209
  var _props$onClear;
217
210
  if (!clearable) return;
218
- e.stopPropagation();
211
+ e === null || e === void 0 || e.stopPropagation();
219
212
  if (disabledStatus === 'all') return;
220
213
  if (edit) {
221
214
  if (range) {
@@ -229,7 +222,7 @@ var useDatePickerFormat = function useDatePickerFormat(props) {
229
222
  }
230
223
  } else {
231
224
  var _props$onChange;
232
- var emptyValue = props.clearWithUndefined ? undefined : '';
225
+ var emptyValue = props.clearWithUndefined || props.clearToUndefined ? undefined : '';
233
226
  var v = emptyValue;
234
227
  if (range) {
235
228
  v = [emptyValue, emptyValue];
@@ -238,6 +231,8 @@ var useDatePickerFormat = function useDatePickerFormat(props) {
238
231
  v = [props.value[0], emptyValue];
239
232
  } else if (props.value[1] && disabledStatus === 'right') {
240
233
  v = [emptyValue, props.value[1]];
234
+ } else if (props.clearToUndefined) {
235
+ v = undefined;
241
236
  }
242
237
  }
243
238
  }
@@ -15,6 +15,7 @@ export interface UseDatePickerFormatProps<Value extends DatePickerValueType> {
15
15
  } | undefined;
16
16
  clearable: boolean | undefined;
17
17
  clearWithUndefined: boolean | undefined;
18
+ clearToUndefined?: boolean;
18
19
  onClear: (() => void) | undefined;
19
20
  allowSingle: boolean | undefined;
20
21
  defaultCurrent: DatePickerValueType;
@@ -1 +1 @@
1
- {"version":3,"file":"use-datepicker-format.type.d.ts","sourceRoot":"","sources":["use-datepicker-format.type.ts"],"names":[],"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  isActive: (date: Date) => boolean;
12
12
  isInRange: (date: Date) => false | "end" | "start" | "start-end" | "in";
13
- handleMonthClick: (date: Date) => void;
13
+ handleMonthClick: (date: Date, onClose?: boolean) => void;
14
14
  getMonthStr: (date: Date) => number;
15
15
  };
16
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-month.d.ts","sourceRoot":"","sources":["use-month.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAajD,QAAA,MAAM,QAAQ,UAAW,aAAa;;;;;;;sBAuBf,IAAI;2BAkCC,IAAI;yBAQN,IAAI;0BAgBH,IAAI;iCAPG,IAAI;4BAJT,IAAI;;CAwChC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"use-month.d.ts","sourceRoot":"","sources":["use-month.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAajD,QAAA,MAAM,QAAQ,UAAW,aAAa;;;;;;;sBAuBf,IAAI;2BAkCC,IAAI;yBAQN,IAAI;0BAgBH,IAAI;iCAPG,IAAI,YAAW,OAAO;4BAJ3B,IAAI;;CAwChC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -76,11 +76,11 @@ var useMonth = function useMonth(props) {
76
76
  var getMonthStr = function getMonthStr(date) {
77
77
  return utils.getDateInfo(date, 'month', options) + 1;
78
78
  };
79
- var handleMonthClick = function handleMonthClick(date) {
79
+ var handleMonthClick = function handleMonthClick(date, onClose) {
80
80
  var _props$onChange;
81
81
  if (isDisabled(date)) return;
82
82
  var newDate = utils.toDate(date);
83
- (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newDate);
83
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newDate, onClose);
84
84
  setCurrent(newDate);
85
85
  };
86
86
  var isInRange = function isInRange(date) {
@@ -4,7 +4,7 @@ export interface UseMonthProps {
4
4
  defaultCurrent?: Date;
5
5
  onCurrentChange?: (date: Date) => void;
6
6
  value?: Date;
7
- onChange?: (date: Date) => void;
7
+ onChange?: (date: Date, onClose?: boolean) => void;
8
8
  min?: Date;
9
9
  max?: Date;
10
10
  disabled?: boolean | ((date: Date) => boolean);
@@ -1 +1 @@
1
- {"version":3,"file":"use-month.type.d.ts","sourceRoot":"","sources":["use-month.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,SAAS,CAAC,EAAE,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC;IAC/C,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH"}
1
+ {"version":3,"file":"use-month.type.d.ts","sourceRoot":"","sources":["use-month.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,SAAS,CAAC,EAAE,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC;IAC/C,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH"}
@@ -10,7 +10,7 @@ declare const useQuarter: (props: UseMonthProps) => {
10
10
  isDisabled: (date: Date) => boolean;
11
11
  isActive: (date: Date) => boolean;
12
12
  isInRange: (date: Date) => false | "end" | "start" | "start-end" | "in";
13
- handleQuarterClick: (date: Date) => void;
13
+ handleQuarterClick: (date: Date, noClose?: boolean) => void;
14
14
  getQuarterStr: (date: Date) => number;
15
15
  };
16
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-quarter.d.ts","sourceRoot":"","sources":["use-quarter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAajD,QAAA,MAAM,UAAU,UAAW,aAAa;;;;;;;sBAuBjB,IAAI;2BAiCC,IAAI;yBAQN,IAAI;0BAgBH,IAAI;mCAPK,IAAI;8BAJT,IAAI;;CAwClC,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"use-quarter.d.ts","sourceRoot":"","sources":["use-quarter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAajD,QAAA,MAAM,UAAU,UAAW,aAAa;;;;;;;sBAuBjB,IAAI;2BAiCC,IAAI;yBAQN,IAAI;0BAgBH,IAAI;mCAPK,IAAI,YAAY,OAAO;8BAJ5B,IAAI;;CAwClC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -75,11 +75,11 @@ var useQuarter = function useQuarter(props) {
75
75
  var getQuarterStr = function getQuarterStr(date) {
76
76
  return utils.getDateInfo(date, 'quarter', options);
77
77
  };
78
- var handleQuarterClick = function handleQuarterClick(date) {
78
+ var handleQuarterClick = function handleQuarterClick(date, noClose) {
79
79
  var _props$onChange;
80
80
  if (isDisabled(date)) return;
81
81
  var newDate = utils.toDate(date);
82
- (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newDate);
82
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newDate, noClose);
83
83
  setCurrent(newDate);
84
84
  };
85
85
  var isInRange = function isInRange(date) {
@@ -12,7 +12,7 @@ declare const useYear: (props: UseYearProps) => {
12
12
  isDisabled: (date: Date) => boolean;
13
13
  isActive: (date: Date) => boolean;
14
14
  isInRange: (date: Date) => false | "end" | "start" | "start-end" | "in";
15
- handleYearClick: (date: Date) => void;
15
+ handleYearClick: (date: Date, noClose?: boolean) => void;
16
16
  getYearStr: (date: Date) => number;
17
17
  };
18
18
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-year.d.ts","sourceRoot":"","sources":["use-year.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAW/C,QAAA,MAAM,OAAO,UAAW,YAAY;;;;;;;;;sBAsBb,IAAI;2BA8BC,IAAI;yBAQN,IAAI;0BAgBH,IAAI;gCAPE,IAAI;2BAJT,IAAI;;CA4C/B,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"use-year.d.ts","sourceRoot":"","sources":["use-year.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAW/C,QAAA,MAAM,OAAO,UAAW,YAAY;;;;;;;;;sBAsBb,IAAI;2BA8BC,IAAI;yBAQN,IAAI;0BAgBH,IAAI;gCAPE,IAAI,YAAY,OAAO;2BAJ5B,IAAI;;CA4C/B,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -74,11 +74,11 @@ var useYear = function useYear(props) {
74
74
  var getYearStr = function getYearStr(date) {
75
75
  return utils.getDateInfo(date, 'year', options);
76
76
  };
77
- var handleYearClick = function handleYearClick(date) {
77
+ var handleYearClick = function handleYearClick(date, noClose) {
78
78
  var _props$onChange;
79
79
  if (isDisabled(date)) return;
80
80
  var newDate = utils.toDate(date);
81
- (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newDate);
81
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newDate, noClose);
82
82
  setCurrent(newDate);
83
83
  };
84
84
  var isInRange = function isInRange(date) {
@@ -4,7 +4,7 @@ export interface UseYearProps {
4
4
  defaultCurrent?: Date;
5
5
  onCurrentChange?: (date: Date) => void;
6
6
  value?: Date;
7
- onChange?: (date: Date) => void;
7
+ onChange?: (date: Date, noClose?: boolean) => void;
8
8
  min?: Date;
9
9
  max?: Date;
10
10
  disabled?: boolean | ((date: Date) => boolean);
@@ -1 +1 @@
1
- {"version":3,"file":"use-year.type.d.ts","sourceRoot":"","sources":["use-year.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,SAAS,CAAC,EAAE,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;IAEX,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC;IAC/C,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH"}
1
+ {"version":3,"file":"use-year.type.d.ts","sourceRoot":"","sources":["use-year.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,SAAS,CAAC,EAAE,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;IAEX,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC;IAC/C,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-table-layout.d.ts","sourceRoot":"","sources":["use-table-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAKlE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAcrE,MAAM,WAAW,mBACf,SAAQ,IAAI,CACV,cAAc,CAAC,GAAG,CAAC,EACnB,MAAM,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,OAAO,CAC7E;IACD,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,QAAA,MAAM,cAAc,UAAW,mBAAmB;;;;;;;;;;;yBA+CX,MAAM,UAAU,MAAM;;;;;;;;CAmO5D,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"use-table-layout.d.ts","sourceRoot":"","sources":["use-table-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAKlE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAcrE,MAAM,WAAW,mBACf,SAAQ,IAAI,CACV,cAAc,CAAC,GAAG,CAAC,EACnB,MAAM,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,OAAO,CAC7E;IACD,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,QAAA,MAAM,cAAc,UAAW,mBAAmB;;;;;;;;;;;yBA8CX,MAAM,UAAU,MAAM;;;;;;;;CAmO5D,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -94,7 +94,6 @@ var useTableLayout = function useTableLayout(props) {
94
94
  return;
95
95
  }
96
96
  context.clientWidth = scrollEl.clientWidth;
97
- if (scrollEl.clientHeight === 0) return;
98
97
  var overHeight = scrollEl.scrollHeight > scrollEl.clientHeight;
99
98
  var overWidth = scrollEl.scrollWidth > context.clientWidth;
100
99
  var newScrollBarWidth = overHeight ? scrollEl.offsetWidth - scrollEl.clientWidth : 0;
@@ -26,7 +26,7 @@ declare const useTableVirtual: (props: UseTableVirtualProps) => {
26
26
  }) => void;
27
27
  setRowHeight: (index: number, height: number) => void;
28
28
  getTranslate: (left?: number, top?: number) => string;
29
- scrollToIndex: (index: number) => void;
29
+ scrollToIndex: (index: number, callback?: () => void) => void;
30
30
  };
31
31
  export default useTableVirtual;
32
32
  //# sourceMappingURL=use-table-virtual.d.ts.map
@@ -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;AAGrD,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;CACnC;AACD,QAAA,MAAM,eAAe,UAAW,oBAAoB;;;;;;;oBAsLpC,MAAM;mBACP,MAAM;WACd,MAAM;gBACD,MAAM;kBACJ,OAAO;;0BAtFuB,MAAM,UAAU,MAAM;0BAxBtB,MAAM,QAAQ,MAAM;2BAkJnB,MAAM;CAwFlD,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;AAGrD,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;CACnC;AACD,QAAA,MAAM,eAAe,UAAW,oBAAoB;;;;;;;oBAqLpC,MAAM;mBACP,MAAM;WACd,MAAM;gBACD,MAAM;kBACJ,OAAO;;0BAzFuB,MAAM,UAAU,MAAM;0BAxBtB,MAAM,QAAQ,MAAM;2BAqJnB,MAAM,aAAa,MAAM,IAAI;CA8FzE,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -235,7 +235,7 @@ var useTableVirtual = function useTableVirtual(props) {
235
235
  updateIndexAndTopFromTop(scrollTop);
236
236
  }
237
237
  };
238
- var scrollToIndex = usePersistFn(function (index) {
238
+ var scrollToIndex = usePersistFn(function (index, callback) {
239
239
  if (props.disabled) return;
240
240
  if (props.scrollRef.current) {
241
241
  context.shouldUpdateHeight = true;
@@ -246,6 +246,9 @@ var useTableVirtual = function useTableVirtual(props) {
246
246
  if (beforeHeight2 !== beforeHeight) {
247
247
  scrollToIndex(index);
248
248
  }
249
+ if (callback && typeof callback === 'function') {
250
+ callback();
251
+ }
249
252
  };
250
253
  props.scrollRef.current.scrollTop = beforeHeight;
251
254
  }
@@ -274,6 +277,8 @@ var useTableVirtual = function useTableVirtual(props) {
274
277
  }, [startIndex]);
275
278
  useEffect(function () {
276
279
  // 数据变化的时候清空掉 preIndex, 如果之前有缓存的index, setRowHeight 会有问题
280
+ setTop(0);
281
+ setStartIndex(0);
277
282
  return function () {
278
283
  context.preIndex = null;
279
284
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/hooks",
3
- "version": "3.3.7-beta.6",
3
+ "version": "3.4.0-beta.10",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",