yootd 0.0.33 → 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;
@@ -9,7 +9,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
9
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
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
- import React, { useMemo, useState } from 'react';
12
+ import dayjs from 'dayjs';
13
+ import React, { useEffect, useMemo, useState } from 'react';
13
14
  export var DateInterval = function DateInterval(_ref) {
14
15
  var _options$;
15
16
  var options = _ref.options,
@@ -20,13 +21,19 @@ export var DateInterval = function DateInterval(_ref) {
20
21
  _useState2 = _slicedToArray(_useState, 2),
21
22
  type = _useState2[0],
22
23
  setType = _useState2[1];
24
+ var _useState3 = useState((value === null || value === void 0 ? void 0 : value.date) || dayjs()),
25
+ _useState4 = _slicedToArray(_useState3, 2),
26
+ date = _useState4[0],
27
+ setDate = _useState4[1];
23
28
  var onChangeDate = function onChangeDate(date) {
29
+ setDate(date);
24
30
  onChange === null || onChange === void 0 || onChange({
25
31
  date: date,
26
32
  type: type
27
33
  });
28
34
  };
29
35
  var onChangeTime = function onChangeTime(date) {
36
+ setDate(date);
30
37
  onChange === null || onChange === void 0 || onChange({
31
38
  date: date,
32
39
  type: type
@@ -34,7 +41,18 @@ export var DateInterval = function DateInterval(_ref) {
34
41
  };
35
42
  var handleSelectChange = function handleSelectChange(e) {
36
43
  setType(e);
44
+ onChange === null || onChange === void 0 || onChange({
45
+ date: date,
46
+ type: e
47
+ });
37
48
  };
49
+ // 设置初始值
50
+ useEffect(function () {
51
+ if (value != null) {
52
+ setType(value.type);
53
+ setDate(value.date);
54
+ }
55
+ }, [value]);
38
56
  var datePickerMap = useMemo(function () {
39
57
  return {
40
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;
@@ -9,7 +9,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
9
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
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
- import React, { useMemo, useState } from 'react';
12
+ import dayjs from 'dayjs';
13
+ import React, { useEffect, useMemo, useState } from 'react';
13
14
  export var DateRange = function DateRange(_ref) {
14
15
  var _options$;
15
16
  var options = _ref.options,
@@ -20,7 +21,12 @@ export var DateRange = function DateRange(_ref) {
20
21
  _useState2 = _slicedToArray(_useState, 2),
21
22
  type = _useState2[0],
22
23
  setType = _useState2[1];
24
+ var _useState3 = useState((value === null || value === void 0 ? void 0 : value.dates) || [dayjs(), dayjs()]),
25
+ _useState4 = _slicedToArray(_useState3, 2),
26
+ dates = _useState4[0],
27
+ setDates = _useState4[1];
23
28
  var onChangeDate = function onChangeDate(dates) {
29
+ setDates(dates);
24
30
  onChange === null || onChange === void 0 || onChange({
25
31
  dates: dates,
26
32
  type: type
@@ -82,7 +88,18 @@ export var DateRange = function DateRange(_ref) {
82
88
  }, [type]);
83
89
  var handleSelectChange = function handleSelectChange(e) {
84
90
  setType(e);
91
+ onChange === null || onChange === void 0 || onChange({
92
+ dates: dates,
93
+ type: e
94
+ });
85
95
  };
96
+ // 设置初始值
97
+ useEffect(function () {
98
+ if (value != null) {
99
+ setType(value.type);
100
+ setDates(value.dates);
101
+ }
102
+ }, [value]);
86
103
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Select, {
87
104
  value: type,
88
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
+ }
@@ -1,5 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["type", "label", "connectors", "loading", "onChange", "onSearch", "showSearch", "optionFilterProp", "teacher_id"];
2
+ var _excluded = ["type", "label", "connectors", "loading", "onChange", "showSearch", "optionFilterProp", "teacher_id"];
3
3
  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); }
4
4
  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; }
5
5
  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; }
@@ -27,7 +27,6 @@ export var UserDropdown = function UserDropdown(_ref) {
27
27
  connectors = _ref$connectors === void 0 ? '~' : _ref$connectors,
28
28
  loading = _ref.loading,
29
29
  onChange = _ref.onChange,
30
- onSearch = _ref.onSearch,
31
30
  _ref$showSearch = _ref.showSearch,
32
31
  showSearch = _ref$showSearch === void 0 ? true : _ref$showSearch,
33
32
  _ref$optionFilterProp = _ref.optionFilterProp,
@@ -42,7 +41,7 @@ export var UserDropdown = function UserDropdown(_ref) {
42
41
  setValue = _useState2[1];
43
42
  // 查询学生数据
44
43
  var _useQuery = useQuery({
45
- queryKey: ['teacherData', value],
44
+ queryKey: ['userData', value],
46
45
  queryFn: function queryFn() {
47
46
  return request('v1/users/by/name_no', {
48
47
  params: {
@@ -94,7 +93,7 @@ export var UserDropdown = function UserDropdown(_ref) {
94
93
  var debounceInput = useDebounce(handlerInput, 500);
95
94
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Select, _extends({
96
95
  loading: loading != null ? loading : userLoading,
97
- onSearch: onSearch != null ? onSearch : debounceInput,
96
+ onSearch: debounceInput,
98
97
  onChange: onChange,
99
98
  showSearch: showSearch,
100
99
  optionFilterProp: optionFilterProp,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yootd",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",