yootd 0.0.30 → 0.0.31

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.
@@ -8,7 +8,11 @@ export type DateIntervalProps = AntdDatePickerProps & {
8
8
  value: PickerType;
9
9
  }[];
10
10
  value?: dayjs.Dayjs;
11
- changeTime?: (date: dayjs.Dayjs, dateString: string | string[], type: string) => void;
11
+ onChange?: (record: {
12
+ date: dayjs.Dayjs;
13
+ dateString: string | string[];
14
+ type: string;
15
+ }) => void;
12
16
  };
13
17
  export declare const DateInterval: FC<DateIntervalProps>;
14
18
  export {};
@@ -1,4 +1,4 @@
1
- var _excluded = ["options", "changeTime", "value"];
1
+ var _excluded = ["options", "onChange", "value"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
4
  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."); }
@@ -13,7 +13,7 @@ import React, { useMemo, useState } from 'react';
13
13
  export var DateInterval = function DateInterval(_ref) {
14
14
  var _options$;
15
15
  var options = _ref.options,
16
- changeTime = _ref.changeTime,
16
+ onChange = _ref.onChange,
17
17
  value = _ref.value,
18
18
  props = _objectWithoutProperties(_ref, _excluded);
19
19
  var _useState = useState((options === null || options === void 0 || (_options$ = options[0]) === null || _options$ === void 0 ? void 0 : _options$.value) || 'time'),
@@ -21,10 +21,18 @@ export var DateInterval = function DateInterval(_ref) {
21
21
  type = _useState2[0],
22
22
  setType = _useState2[1];
23
23
  var onChangeDate = function onChangeDate(date, dateString) {
24
- changeTime === null || changeTime === void 0 || changeTime(date, dateString, type);
24
+ onChange === null || onChange === void 0 || onChange({
25
+ date: date,
26
+ dateString: dateString,
27
+ type: type
28
+ });
25
29
  };
26
30
  var onChangeTime = function onChangeTime(date, dateString) {
27
- changeTime === null || changeTime === void 0 || changeTime(date, dateString, type);
31
+ onChange === null || onChange === void 0 || onChange({
32
+ date: date,
33
+ dateString: dateString,
34
+ type: type
35
+ });
28
36
  };
29
37
  var handleSelectChange = function handleSelectChange(e) {
30
38
  setType(e);
@@ -8,7 +8,11 @@ export type DateRangeProps = RangePickerProps & {
8
8
  value: PickerType;
9
9
  }[];
10
10
  value?: [dayjs.Dayjs, dayjs.Dayjs];
11
- changeTime?: (dates: [dayjs.Dayjs, dayjs.Dayjs], dateStrings: [string, string], type: PickerType) => void;
11
+ onChange?: (record: {
12
+ dates: [dayjs.Dayjs, dayjs.Dayjs];
13
+ dateStrings: [string, string];
14
+ type: PickerType;
15
+ }) => void;
12
16
  };
13
17
  export declare const DateRange: FC<DateRangeProps>;
14
18
  export {};
@@ -1,4 +1,4 @@
1
- var _excluded = ["options", "value", "changeTime"];
1
+ var _excluded = ["options", "value", "onChange"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
4
  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."); }
@@ -14,14 +14,18 @@ export var DateRange = function DateRange(_ref) {
14
14
  var _options$;
15
15
  var options = _ref.options,
16
16
  value = _ref.value,
17
- changeTime = _ref.changeTime,
17
+ onChange = _ref.onChange,
18
18
  props = _objectWithoutProperties(_ref, _excluded);
19
19
  var _useState = useState((options === null || options === void 0 || (_options$ = options[0]) === null || _options$ === void 0 ? void 0 : _options$.value) || 'time'),
20
20
  _useState2 = _slicedToArray(_useState, 2),
21
21
  type = _useState2[0],
22
22
  setType = _useState2[1];
23
23
  var onChangeDate = function onChangeDate(dates, dateStrings) {
24
- changeTime === null || changeTime === void 0 || changeTime(dates, dateStrings, type);
24
+ onChange === null || onChange === void 0 || onChange({
25
+ dates: dates,
26
+ dateStrings: dateStrings,
27
+ type: type
28
+ });
25
29
  };
26
30
  var datePickerMap = useMemo(function () {
27
31
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yootd",
3
- "version": "0.0.30",
3
+ "version": "0.0.31",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",