@sheinx/hooks 3.3.0-beta.5 → 3.3.0-beta.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. package/cjs/common/use-position-style/index.js +1 -1
  2. package/cjs/components/use-datepicker/use-date.d.ts.map +1 -1
  3. package/cjs/components/use-datepicker/use-date.js +1 -11
  4. package/cjs/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
  5. package/cjs/components/use-datepicker/use-datepicker-format.js +1 -0
  6. package/cjs/components/use-datepicker/use-datepicker-range.d.ts +2 -0
  7. package/cjs/components/use-datepicker/use-datepicker-range.d.ts.map +1 -1
  8. package/cjs/components/use-datepicker/use-datepicker-range.js +12 -2
  9. package/cjs/components/use-datepicker/util.d.ts +1 -0
  10. package/cjs/components/use-datepicker/util.d.ts.map +1 -1
  11. package/cjs/components/use-datepicker/util.js +15 -1
  12. package/cjs/components/use-pagination/use-pagination.d.ts +1 -1
  13. package/cjs/components/use-pagination/use-pagination.d.ts.map +1 -1
  14. package/cjs/components/use-pagination/use-pagination.js +7 -5
  15. package/esm/common/use-position-style/index.js +1 -1
  16. package/esm/components/use-datepicker/use-date.d.ts.map +1 -1
  17. package/esm/components/use-datepicker/use-date.js +1 -11
  18. package/esm/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
  19. package/esm/components/use-datepicker/use-datepicker-format.js +1 -0
  20. package/esm/components/use-datepicker/use-datepicker-range.d.ts +2 -0
  21. package/esm/components/use-datepicker/use-datepicker-range.d.ts.map +1 -1
  22. package/esm/components/use-datepicker/use-datepicker-range.js +12 -2
  23. package/esm/components/use-datepicker/util.d.ts +1 -0
  24. package/esm/components/use-datepicker/util.d.ts.map +1 -1
  25. package/esm/components/use-datepicker/util.js +15 -1
  26. package/esm/components/use-pagination/use-pagination.d.ts +1 -1
  27. package/esm/components/use-pagination/use-pagination.d.ts.map +1 -1
  28. package/esm/components/use-pagination/use-pagination.js +7 -5
  29. package/package.json +1 -1
@@ -24,7 +24,7 @@ var horizontalPosition = ['left-bottom', 'left-top', 'right-bottom', 'right-top'
24
24
  var verticalPosition = ['bottom-left', 'bottom-right', 'top-left', 'top-right', 'bottom', 'top'];
25
25
  var hideStyle = {
26
26
  pointerEvents: 'none',
27
- position: 'absolute',
27
+ position: 'fixed',
28
28
  zIndex: -1000,
29
29
  opacity: 0
30
30
  };
@@ -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;0BAqDH,IAAI;+BAzEC,IAAI;+BAmDJ,IAAI;0BAvBT,IAAI;2BAIH,IAAI;;gCAIC,IAAI;;CAoFpC,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;0BAnBT,IAAI;2BAIH,IAAI;;gCAIC,IAAI;;CAgFpC,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -99,17 +99,7 @@ var useDate = function useDate(props) {
99
99
  return _util.default.getDateInfo(date, 'week', options);
100
100
  };
101
101
  var getDateWithTime = function getDateWithTime(date) {
102
- var min = props.min,
103
- max = props.max;
104
- var timeDate = props.value || props.defaultTime && _util.default.cloneTime(date, props.defaultTime, _util.default.TIME_FORMAT, options);
105
- var newDate = _util.default.toDate(date);
106
- if (timeDate) {
107
- newDate = _util.default.setTime(newDate, timeDate, options);
108
- }
109
- // only can select day with the same day of min/max
110
- if (min && _util.default.compareAsc(newDate, min) < 0) newDate = _util.default.setTime(newDate, min, options);
111
- if (max && _util.default.compareAsc(newDate, max) > 0) newDate = _util.default.setTime(newDate, max, options);
112
- return newDate;
102
+ return _util.default.getDateWithTime(date, props.value, props.defaultTime, props.min, props.max, options);
113
103
  };
114
104
  var handleDayClick = function handleDayClick(date) {
115
105
  var _props$onChange;
@@ -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;;;;;;;;;;;;;;;;yBA2Ic,gBAAgB;iCA8BR,MAAM,SAAS,MAAM;yCA5HrD,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;;+BAOH,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;;;;;;;;;;;;;;;;yBA4Ic,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"}
@@ -141,6 +141,7 @@ var useDatePickerFormat = function useDatePickerFormat(props) {
141
141
  });
142
142
  var setCurrentArrWithParams = (0, _usePersistFn.usePersistFn)(function (arg, type, quick) {
143
143
  setCurrentArr(arg);
144
+ if (!type && !quick) return;
144
145
  setParams({
145
146
  type: type,
146
147
  quick: quick
@@ -16,6 +16,8 @@ declare const useRangePick: (props: useRangeProps) => {
16
16
  setTargetEnd: (date?: Date) => void;
17
17
  startDisabled: (date: Date) => boolean;
18
18
  endDisabled: (date: Date) => boolean;
19
+ getStartDobule: (date: Date) => Date;
20
+ getEndDobule: (date: Date) => Date;
19
21
  };
20
22
  };
21
23
  export default useRangePick;
@@ -1 +1 @@
1
- {"version":3,"file":"use-datepicker-range.d.ts","sourceRoot":"","sources":["use-datepicker-range.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAK5D,QAAA,MAAM,YAAY,UAAW,aAAa;;;;;;;;;6BAqFC,IAAI,YAAY,OAAO;2BAKzB,IAAI,YAAY,OAAO;gCAblB,IAAI,WAAW,GAAG,EAAE;8BAItB,IAAI,WAAW,GAAG,EAAE;gCAclB,IAAI;8BAIN,IAAI;8BAqBJ,IAAI;4BAeN,IAAI;;CAqE7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"use-datepicker-range.d.ts","sourceRoot":"","sources":["use-datepicker-range.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAK5D,QAAA,MAAM,YAAY,UAAW,aAAa;;;;;;;;;6BA0FC,IAAI,YAAY,OAAO;2BAKzB,IAAI,YAAY,OAAO;gCAblB,IAAI,WAAW,GAAG,EAAE;8BAItB,IAAI,WAAW,GAAG,EAAE;gCAclB,IAAI;8BA4BN,IAAI;8BAqBJ,IAAI;4BAeN,IAAI;+BA5DD,IAAI;6BAYN,IAAI;;CAuH9C,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -44,7 +44,7 @@ var useRangePick = function useRangePick(props) {
44
44
  newArr[1] = rangeMax;
45
45
  }
46
46
  } else if (date.getTime() > newArr[1].getTime()) {
47
- var a = _util.default.cloneTime(new Date(date), defaultTimeArr[1], 'HH:mm:ss', options);
47
+ var a = _util.default.cloneTime(new Date(date), arr[1] || defaultTimeArr[1], 'HH:mm:ss', options);
48
48
  newArr[1] = a.getTime() > date.getTime() ? a : new Date(date);
49
49
  }
50
50
  }
@@ -112,6 +112,14 @@ var useRangePick = function useRangePick(props) {
112
112
  var setTargetStart = (0, _usePersistFn.usePersistFn)(function (date) {
113
113
  setTargetArr([date, undefined]);
114
114
  });
115
+ var getStartDobule = (0, _usePersistFn.usePersistFn)(function (date) {
116
+ var end = _util.default.getDateWithTime(date, props.dateArr[1], defaultTimeArr[1], endMin, endMax, options);
117
+ return end;
118
+ });
119
+ var getEndDobule = (0, _usePersistFn.usePersistFn)(function (date) {
120
+ var start = _util.default.getDateWithTime(date, props.dateArr[1], defaultTimeArr[1], startMin, startMax, options);
121
+ return start;
122
+ });
115
123
  var setTargetEnd = (0, _usePersistFn.usePersistFn)(function (date) {
116
124
  setTargetArr([undefined, date]);
117
125
  });
@@ -168,7 +176,9 @@ var useRangePick = function useRangePick(props) {
168
176
  setTargetStart: setTargetStart,
169
177
  setTargetEnd: setTargetEnd,
170
178
  startDisabled: startDisabled,
171
- endDisabled: endDisabled
179
+ endDisabled: endDisabled,
180
+ getStartDobule: getStartDobule,
181
+ getEndDobule: getEndDobule
172
182
  });
173
183
  var minDate = min ? _util.default.toDate(min, options) : undefined;
174
184
  var maxDate = max ? _util.default.toDate(max, options) : undefined;
@@ -77,6 +77,7 @@ declare const _default: {
77
77
  transDateWithZone: typeof transDateWithZone;
78
78
  getStartYear: typeof getStartYear;
79
79
  isValidString: typeof isValidString;
80
+ getDateWithTime: (date: Date, value: Date | undefined, defaultTime: string | number | Date | undefined, min: Date | undefined, max: Date | undefined, options: DateOptions) => Date;
80
81
  };
81
82
  export default _default;
82
83
  //# sourceMappingURL=util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["util.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAC9D,MAAM,MAAM,IAAI,GACZ,MAAM,GACN,OAAO,GACP,SAAS,GACT,MAAM,GACN,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,MAAM,CAAC;AACX,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;AAKjD,UAAU,WAAW;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAqBD,eAAO,MAAM,aAAa,SAAU,MAAM,uBAmBzC,CAAC;AAOF,iBAAS,iBAAiB,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,GAAE,WAAgB,EAAE,IAAI,UAAQ,QAa3E;AAED,iBAAS,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,QAKhE;AAED,iBAAS,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,QAKlE;AAED,iBAAS,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,QAKnE;AAED,iBAAS,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,QAKjE;AAED,iBAAS,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,QAKh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CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,QAKpF;AAED,iBAAS,yBAAyB,CAChC,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,IAAI,GAAG,SAAS,EACvB,WAAW,EAAE,IAAI,GAAG,SAAS,EAC7B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,WAAW,iBAWrB;AAED,iBAAS,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,QAMjD;AAED,iBAAS,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,IAAI,oBAAS,EAAE,OAAO,EAAE,WAAW,WAQxF;AAcD,iBAAS,iBAAiB,CAAC,KAAK,EAAE,IAAI,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,eAInF;AAED,iBAAS,SAAS,CAChB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,KAAK,MAAM,CAAC,EACxD,OAAO,EAAE,WAAW,UAKrB;AAED,iBAAS,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,UAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBD,wBAsCE"}
@@ -358,6 +358,19 @@ function formatted(date, fmt, options) {
358
358
  function getStartYear(date, options) {
359
359
  return Math.floor(getDateInfo(date, 'year', options) / 10) * 10;
360
360
  }
361
+
362
+ // 如果有 value 取 value 的 time 否则取 defaultTime
363
+ var getDateWithTime = function getDateWithTime(date, value, defaultTime, min, max, options) {
364
+ var timeDate = value || defaultTime && cloneTime(date, defaultTime, TIME_FORMAT, options);
365
+ var newDate = toDate(date);
366
+ if (timeDate) {
367
+ newDate = setTime(newDate, timeDate, options);
368
+ }
369
+ // only can select day with the same day of min/max
370
+ if (min && compareAsc(newDate, min) < 0) newDate = setTime(newDate, min, options);
371
+ if (max && compareAsc(newDate, max) > 0) newDate = setTime(newDate, max, options);
372
+ return newDate;
373
+ };
361
374
  var _default = exports.default = {
362
375
  clearHMS: clearHMS,
363
376
  addDays: addDays,
@@ -394,5 +407,6 @@ var _default = exports.default = {
394
407
  compatibleFmt: compatibleFmt,
395
408
  transDateWithZone: transDateWithZone,
396
409
  getStartYear: getStartYear,
397
- isValidString: isValidString
410
+ isValidString: isValidString,
411
+ getDateWithTime: getDateWithTime
398
412
  };
@@ -4,7 +4,7 @@ declare const usePagination: (props: BasePaginationProps) => {
4
4
  current: number | undefined;
5
5
  pageSize: number;
6
6
  total: number;
7
- onChange: (current: number, size?: number) => void;
7
+ onChange: (c: number, size?: number) => void;
8
8
  getRootProps: <TOther extends ObjectType = ObjectType>(externalProps?: TOther) => {
9
9
  [x: string]: (event: any) => void;
10
10
  } & TOther & {
@@ -1 +1 @@
1
- {"version":3,"file":"use-pagination.d.ts","sourceRoot":"","sources":["use-pagination.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,QAAA,MAAM,aAAa,UAAW,mBAAmB;;;;wBAiBhB,MAAM,SAAS,MAAM;;;;;;;CAiCrD,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"use-pagination.d.ts","sourceRoot":"","sources":["use-pagination.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,QAAA,MAAM,aAAa,UAAW,mBAAmB;;;;kBAiBT,MAAM,SAAS,MAAM;;;;;;;CAiC5D,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _react = require("react");
9
9
  var _utils = require("../../utils");
10
+ var _usePersistFn = require("../../common/use-persist-fn");
10
11
  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; }
11
12
  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; }
12
13
  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; }
@@ -38,14 +39,15 @@ var usePagination = function usePagination(props) {
38
39
  (0, _react.useEffect)(function () {
39
40
  if (pageSizeProp !== pageSize) setPageSize(pageSizeProp);
40
41
  }, [pageSizeProp]);
41
- var handleChange = function handleChange(current, size) {
42
- setCurrent(current);
42
+ var handleChange = (0, _usePersistFn.usePersistFn)(function (c, size) {
43
+ if (c === current && size === undefined) return;
44
+ setCurrent(c);
43
45
  setPageSize(size || pageSizeProp);
44
46
  if (onChange) {
45
- var sizeChange = pageSize !== size;
46
- onChange(current, size || pageSize, sizeChange);
47
+ var sizeChange = size !== undefined && pageSize !== size;
48
+ onChange(c, size || pageSize, sizeChange);
47
49
  }
48
- };
50
+ });
49
51
  var getRootProps = function getRootProps() {
50
52
  var externalProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
51
53
  var externalEventHandlers = (0, _utils.extractEventHandlers)(externalProps);
@@ -14,7 +14,7 @@ var horizontalPosition = ['left-bottom', 'left-top', 'right-bottom', 'right-top'
14
14
  var verticalPosition = ['bottom-left', 'bottom-right', 'top-left', 'top-right', 'bottom', 'top'];
15
15
  var hideStyle = {
16
16
  pointerEvents: 'none',
17
- position: 'absolute',
17
+ position: 'fixed',
18
18
  zIndex: -1000,
19
19
  opacity: 0
20
20
  };
@@ -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;0BAqDH,IAAI;+BAzEC,IAAI;+BAmDJ,IAAI;0BAvBT,IAAI;2BAIH,IAAI;;gCAIC,IAAI;;CAoFpC,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;0BAnBT,IAAI;2BAIH,IAAI;;gCAIC,IAAI;;CAgFpC,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -93,17 +93,7 @@ var useDate = function useDate(props) {
93
93
  return utils.getDateInfo(date, 'week', options);
94
94
  };
95
95
  var getDateWithTime = function getDateWithTime(date) {
96
- var min = props.min,
97
- max = props.max;
98
- var timeDate = props.value || props.defaultTime && utils.cloneTime(date, props.defaultTime, utils.TIME_FORMAT, options);
99
- var newDate = utils.toDate(date);
100
- if (timeDate) {
101
- newDate = utils.setTime(newDate, timeDate, options);
102
- }
103
- // only can select day with the same day of min/max
104
- if (min && utils.compareAsc(newDate, min) < 0) newDate = utils.setTime(newDate, min, options);
105
- if (max && utils.compareAsc(newDate, max) > 0) newDate = utils.setTime(newDate, max, options);
106
- return newDate;
96
+ return utils.getDateWithTime(date, props.value, props.defaultTime, props.min, props.max, options);
107
97
  };
108
98
  var handleDayClick = function handleDayClick(date) {
109
99
  var _props$onChange;
@@ -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;;;;;;;;;;;;;;;;yBA2Ic,gBAAgB;iCA8BR,MAAM,SAAS,MAAM;yCA5HrD,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;;+BAOH,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;;;;;;;;;;;;;;;;yBA4Ic,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"}
@@ -134,6 +134,7 @@ var useDatePickerFormat = function useDatePickerFormat(props) {
134
134
  });
135
135
  var setCurrentArrWithParams = usePersistFn(function (arg, type, quick) {
136
136
  setCurrentArr(arg);
137
+ if (!type && !quick) return;
137
138
  setParams({
138
139
  type: type,
139
140
  quick: quick
@@ -16,6 +16,8 @@ declare const useRangePick: (props: useRangeProps) => {
16
16
  setTargetEnd: (date?: Date) => void;
17
17
  startDisabled: (date: Date) => boolean;
18
18
  endDisabled: (date: Date) => boolean;
19
+ getStartDobule: (date: Date) => Date;
20
+ getEndDobule: (date: Date) => Date;
19
21
  };
20
22
  };
21
23
  export default useRangePick;
@@ -1 +1 @@
1
- {"version":3,"file":"use-datepicker-range.d.ts","sourceRoot":"","sources":["use-datepicker-range.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAK5D,QAAA,MAAM,YAAY,UAAW,aAAa;;;;;;;;;6BAqFC,IAAI,YAAY,OAAO;2BAKzB,IAAI,YAAY,OAAO;gCAblB,IAAI,WAAW,GAAG,EAAE;8BAItB,IAAI,WAAW,GAAG,EAAE;gCAclB,IAAI;8BAIN,IAAI;8BAqBJ,IAAI;4BAeN,IAAI;;CAqE7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"use-datepicker-range.d.ts","sourceRoot":"","sources":["use-datepicker-range.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAK5D,QAAA,MAAM,YAAY,UAAW,aAAa;;;;;;;;;6BA0FC,IAAI,YAAY,OAAO;2BAKzB,IAAI,YAAY,OAAO;gCAblB,IAAI,WAAW,GAAG,EAAE;8BAItB,IAAI,WAAW,GAAG,EAAE;gCAclB,IAAI;8BA4BN,IAAI;8BAqBJ,IAAI;4BAeN,IAAI;+BA5DD,IAAI;6BAYN,IAAI;;CAuH9C,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -37,7 +37,7 @@ var useRangePick = function useRangePick(props) {
37
37
  newArr[1] = rangeMax;
38
38
  }
39
39
  } else if (date.getTime() > newArr[1].getTime()) {
40
- var a = utils.cloneTime(new Date(date), defaultTimeArr[1], 'HH:mm:ss', options);
40
+ var a = utils.cloneTime(new Date(date), arr[1] || defaultTimeArr[1], 'HH:mm:ss', options);
41
41
  newArr[1] = a.getTime() > date.getTime() ? a : new Date(date);
42
42
  }
43
43
  }
@@ -105,6 +105,14 @@ var useRangePick = function useRangePick(props) {
105
105
  var setTargetStart = usePersistFn(function (date) {
106
106
  setTargetArr([date, undefined]);
107
107
  });
108
+ var getStartDobule = usePersistFn(function (date) {
109
+ var end = utils.getDateWithTime(date, props.dateArr[1], defaultTimeArr[1], endMin, endMax, options);
110
+ return end;
111
+ });
112
+ var getEndDobule = usePersistFn(function (date) {
113
+ var start = utils.getDateWithTime(date, props.dateArr[1], defaultTimeArr[1], startMin, startMax, options);
114
+ return start;
115
+ });
108
116
  var setTargetEnd = usePersistFn(function (date) {
109
117
  setTargetArr([undefined, date]);
110
118
  });
@@ -161,7 +169,9 @@ var useRangePick = function useRangePick(props) {
161
169
  setTargetStart: setTargetStart,
162
170
  setTargetEnd: setTargetEnd,
163
171
  startDisabled: startDisabled,
164
- endDisabled: endDisabled
172
+ endDisabled: endDisabled,
173
+ getStartDobule: getStartDobule,
174
+ getEndDobule: getEndDobule
165
175
  });
166
176
  var minDate = min ? utils.toDate(min, options) : undefined;
167
177
  var maxDate = max ? utils.toDate(max, options) : undefined;
@@ -77,6 +77,7 @@ declare const _default: {
77
77
  transDateWithZone: typeof transDateWithZone;
78
78
  getStartYear: typeof getStartYear;
79
79
  isValidString: typeof isValidString;
80
+ getDateWithTime: (date: Date, value: Date | undefined, defaultTime: string | number | Date | undefined, min: Date | undefined, max: Date | undefined, options: DateOptions) => Date;
80
81
  };
81
82
  export default _default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O,CAAC,EAAE,WAAW,QAKpF;AAED,iBAAS,yBAAyB,CAChC,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,IAAI,GAAG,SAAS,EACvB,WAAW,EAAE,IAAI,GAAG,SAAS,EAC7B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,WAAW,iBAWrB;AAED,iBAAS,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,QAMjD;AAED,iBAAS,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,IAAI,oBAAS,EAAE,OAAO,EAAE,WAAW,WAQxF;AAcD,iBAAS,iBAAiB,CAAC,KAAK,EAAE,IAAI,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,eAInF;AAED,iBAAS,SAAS,CAChB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,KAAK,MAAM,CAAC,EACxD,OAAO,EAAE,WAAW,UAKrB;AAED,iBAAS,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,UAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBD,wBAsCE"}
@@ -352,6 +352,19 @@ function formatted(date, fmt, options) {
352
352
  function getStartYear(date, options) {
353
353
  return Math.floor(getDateInfo(date, 'year', options) / 10) * 10;
354
354
  }
355
+
356
+ // 如果有 value 取 value 的 time 否则取 defaultTime
357
+ var getDateWithTime = function getDateWithTime(date, value, defaultTime, min, max, options) {
358
+ var timeDate = value || defaultTime && cloneTime(date, defaultTime, TIME_FORMAT, options);
359
+ var newDate = toDate(date);
360
+ if (timeDate) {
361
+ newDate = setTime(newDate, timeDate, options);
362
+ }
363
+ // only can select day with the same day of min/max
364
+ if (min && compareAsc(newDate, min) < 0) newDate = setTime(newDate, min, options);
365
+ if (max && compareAsc(newDate, max) > 0) newDate = setTime(newDate, max, options);
366
+ return newDate;
367
+ };
355
368
  export default {
356
369
  clearHMS: clearHMS,
357
370
  addDays: addDays,
@@ -388,5 +401,6 @@ export default {
388
401
  compatibleFmt: compatibleFmt,
389
402
  transDateWithZone: transDateWithZone,
390
403
  getStartYear: getStartYear,
391
- isValidString: isValidString
404
+ isValidString: isValidString,
405
+ getDateWithTime: getDateWithTime
392
406
  };
@@ -4,7 +4,7 @@ declare const usePagination: (props: BasePaginationProps) => {
4
4
  current: number | undefined;
5
5
  pageSize: number;
6
6
  total: number;
7
- onChange: (current: number, size?: number) => void;
7
+ onChange: (c: number, size?: number) => void;
8
8
  getRootProps: <TOther extends ObjectType = ObjectType>(externalProps?: TOther) => {
9
9
  [x: string]: (event: any) => void;
10
10
  } & TOther & {
@@ -1 +1 @@
1
- {"version":3,"file":"use-pagination.d.ts","sourceRoot":"","sources":["use-pagination.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,QAAA,MAAM,aAAa,UAAW,mBAAmB;;;;wBAiBhB,MAAM,SAAS,MAAM;;;;;;;CAiCrD,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"use-pagination.d.ts","sourceRoot":"","sources":["use-pagination.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,QAAA,MAAM,aAAa,UAAW,mBAAmB;;;;kBAiBT,MAAM,SAAS,MAAM;;;;;;;CAiC5D,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -12,6 +12,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import { useEffect, useState } from 'react';
14
14
  import { extractEventHandlers } from "../../utils";
15
+ import { usePersistFn } from "../../common/use-persist-fn";
15
16
  var usePagination = function usePagination(props) {
16
17
  var totalProp = props.total,
17
18
  pageSizeProp = props.pageSize,
@@ -32,14 +33,15 @@ var usePagination = function usePagination(props) {
32
33
  useEffect(function () {
33
34
  if (pageSizeProp !== pageSize) setPageSize(pageSizeProp);
34
35
  }, [pageSizeProp]);
35
- var handleChange = function handleChange(current, size) {
36
- setCurrent(current);
36
+ var handleChange = usePersistFn(function (c, size) {
37
+ if (c === current && size === undefined) return;
38
+ setCurrent(c);
37
39
  setPageSize(size || pageSizeProp);
38
40
  if (onChange) {
39
- var sizeChange = pageSize !== size;
40
- onChange(current, size || pageSize, sizeChange);
41
+ var sizeChange = size !== undefined && pageSize !== size;
42
+ onChange(c, size || pageSize, sizeChange);
41
43
  }
42
- };
44
+ });
43
45
  var getRootProps = function getRootProps() {
44
46
  var externalProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
45
47
  var externalEventHandlers = extractEventHandlers(externalProps);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/hooks",
3
- "version": "3.3.0-beta.5",
3
+ "version": "3.3.0-beta.6",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",