yootd 0.0.34 → 0.0.35

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.
@@ -9,7 +9,7 @@ export type DateIntervalProps = AntdDatePickerProps & {
9
9
  }[];
10
10
  value?: {
11
11
  date: dayjs.Dayjs;
12
- type: string;
12
+ type: PickerType;
13
13
  };
14
14
  onChange?: (record: {
15
15
  date: dayjs.Dayjs;
@@ -10,7 +10,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
10
10
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
11
11
  import { DatePicker as AntdDatePicker, Select } from 'antd';
12
12
  import dayjs from 'dayjs';
13
- import React, { useMemo, useState } from 'react';
13
+ import React, { useEffect, useMemo, useState } from 'react';
14
14
  export var DateInterval = function DateInterval(_ref) {
15
15
  var _options$;
16
16
  var options = _ref.options,
@@ -46,6 +46,13 @@ export var DateInterval = function DateInterval(_ref) {
46
46
  type: e
47
47
  });
48
48
  };
49
+ // 设置初始值
50
+ useEffect(function () {
51
+ if (value != null) {
52
+ setType(value.type);
53
+ setDate(value.date);
54
+ }
55
+ }, [value]);
49
56
  var datePickerMap = useMemo(function () {
50
57
  return {
51
58
  time: /*#__PURE__*/React.createElement(AntdDatePicker.TimePicker, _extends({}, props, {
@@ -1,4 +1,3 @@
1
- import { type DatePickerProps as AntDatePickerProps } from 'antd';
2
- import { FC } from 'react';
1
+ import type { DatePickerProps as AntDatePickerProps } from 'antd';
3
2
  export type DatePickerProps = AntDatePickerProps;
4
- export declare const DatePicker: FC<DatePickerProps>;
3
+ export declare const DatePicker: import("antd/es/date-picker").DatePickerType;
@@ -1,5 +1,2 @@
1
1
  import { DatePicker as AntDatePicker } from 'antd';
2
- import React from 'react';
3
- export var DatePicker = function DatePicker(props) {
4
- return /*#__PURE__*/React.createElement(AntDatePicker, props);
5
- };
2
+ export var DatePicker = AntDatePicker;
@@ -10,7 +10,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
10
10
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
11
11
  import { DatePicker, Select, TimePicker } from 'antd';
12
12
  import dayjs from 'dayjs';
13
- import React, { useMemo, useState } from 'react';
13
+ import React, { useEffect, useMemo, useState } from 'react';
14
14
  export var DateRange = function DateRange(_ref) {
15
15
  var _options$;
16
16
  var options = _ref.options,
@@ -93,6 +93,13 @@ export var DateRange = function DateRange(_ref) {
93
93
  type: e
94
94
  });
95
95
  };
96
+ // 设置初始值
97
+ useEffect(function () {
98
+ if (value != null) {
99
+ setType(value.type);
100
+ setDates(value.dates);
101
+ }
102
+ }, [value]);
96
103
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Select, {
97
104
  value: type,
98
105
  style: {
@@ -30,17 +30,5 @@ export var HeaderIcon = function HeaderIcon(_ref) {
30
30
  fillRule: "evenodd",
31
31
  clipRule: "evenodd",
32
32
  d: "M22.9552 13C22.9848 12.6706 23 12.3371 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 12.3371 1.01516 12.6706 1.04484 13H22.9552Z"
33
- })), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
34
- id: "paint0_linear_589_9609",
35
- x1: "132.5",
36
- y1: "0",
37
- x2: "132.5",
38
- y2: "56",
39
- gradientUnits: "userSpaceOnUse"
40
- }, /*#__PURE__*/React.createElement("stop", {
41
- className: "stop-color-1"
42
- }), /*#__PURE__*/React.createElement("stop", {
43
- className: "stop-color-2",
44
- offset: "1"
45
- }))));
33
+ })));
46
34
  };
@@ -17,7 +17,21 @@ var ModalComponent = function ModalComponent(_ref) {
17
17
 
18
18
  // title content block
19
19
  var tcb = mb.b('title').b('content');
20
- return /*#__PURE__*/React.createElement(AntModal, _extends({}, rest, {
20
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("svg", {
21
+ className: "".concat(mb.e('color-defs'))
22
+ }, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
23
+ id: "paint0_linear_589_9609",
24
+ x1: "132.5",
25
+ y1: "0",
26
+ x2: "132.5",
27
+ y2: "56",
28
+ gradientUnits: "userSpaceOnUse"
29
+ }, /*#__PURE__*/React.createElement("stop", {
30
+ className: "stop-color-1"
31
+ }), /*#__PURE__*/React.createElement("stop", {
32
+ className: "stop-color-2",
33
+ offset: "1"
34
+ })))), /*#__PURE__*/React.createElement(AntModal, _extends({}, rest, {
21
35
  className: "".concat(mb, " ").concat(className !== null && className !== void 0 ? className : ''),
22
36
  title: /*#__PURE__*/React.createElement("div", {
23
37
  className: "".concat(tcb)
@@ -26,7 +40,7 @@ var ModalComponent = function ModalComponent(_ref) {
26
40
  }), /*#__PURE__*/React.createElement("div", {
27
41
  className: "".concat(tcb.e('body'))
28
42
  }, title))
29
- }), children);
43
+ }), children));
30
44
  };
31
45
  export var Modal = ModalComponent;
32
46
  Modal.useModal = AntModal.useModal;
@@ -1,65 +1,73 @@
1
- .yot-modal {
2
- padding-top: 13px;
3
- position: relative;
4
- max-width: calc(2 / 3 * 100vw) !important;
5
-
6
- & > div:first-child {
7
- box-sizing: border-box;
8
- padding: 4px;
9
- background: linear-gradient(180deg, #3a8cff 0%, #c4ddff 100%);
10
- border-radius: 24px;
11
- }
12
-
13
- .ant-modal-header {
14
- width: 100%;
15
- position: absolute;
16
- left: 0;
17
- top: -13px;
18
- background-color: transparent;
19
- }
20
-
21
- .ant-modal-content {
22
- padding: var(--ant-margin-xl);
23
- padding-top: 71px;
24
- border-radius: 24px;
25
- }
26
-
27
- .ant-modal-body {
28
- max-height: 529px;
29
- overflow-y: auto;
30
- }
31
-
32
- .ant-modal-footer {
33
- margin-top: 40px;
34
- }
35
-
36
- &-title {
37
- &-content {
38
- width: 100%;
39
- display: flex;
40
- justify-content: center;
41
- align-items: center;
42
-
43
- &__body {
44
- position: absolute;
45
- color: var(--ant-color-bg-base);
46
- font-size: var(--ant-font-size-heading-3);
47
- }
48
-
49
- &__icon {
50
- .path-1 {
51
- fill: var(--yot-modal-color-tertiary);
52
- }
53
- .path-2 {
54
- fill: var(--yot-modal-color-tertiary);
55
- }
56
- .stop-color-1 {
57
- stop-color: var(--yot-modal-color-secondary);
58
- }
59
- .stop-color-2 {
60
- stop-color: var(--yot-modal-color-primary);
61
- }
62
- }
63
- }
64
- }
65
- }
1
+ .yot-modal {
2
+ padding-top: 13px;
3
+ position: relative;
4
+ max-width: calc(2 / 3 * 100vw) !important;
5
+
6
+ & > div:first-child {
7
+ box-sizing: border-box;
8
+ padding: 4px;
9
+ background: linear-gradient(180deg, #3a8cff 0%, #c4ddff 100%);
10
+ border-radius: 24px;
11
+ }
12
+
13
+ .ant-modal-header {
14
+ width: 100%;
15
+ position: absolute;
16
+ left: 0;
17
+ top: -13px;
18
+ background-color: transparent;
19
+ }
20
+
21
+ .ant-modal-content {
22
+ padding: var(--ant-margin-xl);
23
+ padding-top: 71px;
24
+ border-radius: 24px;
25
+ }
26
+
27
+ .ant-modal-body {
28
+ max-height: 529px;
29
+ overflow-y: auto;
30
+ }
31
+
32
+ .ant-modal-footer {
33
+ margin-top: 40px;
34
+ }
35
+
36
+ &-title {
37
+ &-content {
38
+ width: 100%;
39
+ display: flex;
40
+ justify-content: center;
41
+ align-items: center;
42
+
43
+ &__body {
44
+ position: absolute;
45
+ color: var(--ant-color-bg-base);
46
+ font-size: var(--ant-font-size-heading-3);
47
+ }
48
+
49
+ &__icon {
50
+ .path-1 {
51
+ fill: var(--yot-modal-color-tertiary);
52
+ }
53
+ .path-2 {
54
+ fill: var(--yot-modal-color-tertiary);
55
+ }
56
+ .stop-color-1 {
57
+ stop-color: var(--yot-modal-color-secondary);
58
+ }
59
+ .stop-color-2 {
60
+ stop-color: var(--yot-modal-color-primary);
61
+ }
62
+ }
63
+ }
64
+ }
65
+ &__color-defs {
66
+ .stop-color-1 {
67
+ stop-color: var(--yot-modal-color-secondary);
68
+ }
69
+ .stop-color-2 {
70
+ stop-color: var(--yot-modal-color-primary);
71
+ }
72
+ }
73
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yootd",
3
- "version": "0.0.34",
3
+ "version": "0.0.35",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",