yootd 0.0.30 → 0.0.32

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.
@@ -7,8 +7,14 @@ export type DateIntervalProps = AntdDatePickerProps & {
7
7
  label: string;
8
8
  value: PickerType;
9
9
  }[];
10
- value?: dayjs.Dayjs;
11
- changeTime?: (date: dayjs.Dayjs, dateString: string | string[], type: string) => void;
10
+ value?: {
11
+ date: dayjs.Dayjs;
12
+ type: string;
13
+ };
14
+ onChange?: (record: {
15
+ date: dayjs.Dayjs;
16
+ type: string;
17
+ }) => void;
12
18
  };
13
19
  export declare const DateInterval: FC<DateIntervalProps>;
14
20
  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,18 +13,24 @@ 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'),
20
20
  _useState2 = _slicedToArray(_useState, 2),
21
21
  type = _useState2[0],
22
22
  setType = _useState2[1];
23
- var onChangeDate = function onChangeDate(date, dateString) {
24
- changeTime === null || changeTime === void 0 || changeTime(date, dateString, type);
23
+ var onChangeDate = function onChangeDate(date) {
24
+ onChange === null || onChange === void 0 || onChange({
25
+ date: date,
26
+ type: type
27
+ });
25
28
  };
26
- var onChangeTime = function onChangeTime(date, dateString) {
27
- changeTime === null || changeTime === void 0 || changeTime(date, dateString, type);
29
+ var onChangeTime = function onChangeTime(date) {
30
+ onChange === null || onChange === void 0 || onChange({
31
+ date: date,
32
+ type: type
33
+ });
28
34
  };
29
35
  var handleSelectChange = function handleSelectChange(e) {
30
36
  setType(e);
@@ -7,8 +7,14 @@ export type DateRangeProps = RangePickerProps & {
7
7
  label: string;
8
8
  value: PickerType;
9
9
  }[];
10
- value?: [dayjs.Dayjs, dayjs.Dayjs];
11
- changeTime?: (dates: [dayjs.Dayjs, dayjs.Dayjs], dateStrings: [string, string], type: PickerType) => void;
10
+ value?: {
11
+ dates: [dayjs.Dayjs, dayjs.Dayjs];
12
+ type: PickerType;
13
+ };
14
+ onChange?: (record: {
15
+ dates: [dayjs.Dayjs, dayjs.Dayjs];
16
+ type: PickerType;
17
+ }) => void;
12
18
  };
13
19
  export declare const DateRange: FC<DateRangeProps>;
14
20
  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,17 @@ 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
- var onChangeDate = function onChangeDate(dates, dateStrings) {
24
- changeTime === null || changeTime === void 0 || changeTime(dates, dateStrings, type);
23
+ var onChangeDate = function onChangeDate(dates) {
24
+ onChange === null || onChange === void 0 || onChange({
25
+ dates: dates,
26
+ type: type
27
+ });
25
28
  };
26
29
  var datePickerMap = useMemo(function () {
27
30
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yootd",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",