assui 2.0.144 → 2.0.147

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.
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
2
  import type { DrawerProps } from 'antd/lib/drawer';
3
+ export declare type DrawerAction = {
4
+ close: () => void;
5
+ open: () => void;
6
+ };
3
7
  export interface ButtonDrawerProps extends DrawerProps {
4
8
  onClose?: () => void;
5
9
  onOpen?: () => void;
6
10
  trigger: React.ReactElement;
7
- children: React.ReactElement;
11
+ children: ((v: DrawerAction) => React.ReactElement) | React.ReactElement;
8
12
  }
9
- export declare type DrawerAction = {
10
- close: () => void;
11
- open: () => void;
12
- };
13
13
  declare const ForwardRefButtonDrawer: React.ForwardRefExoticComponent<ButtonDrawerProps & React.RefAttributes<unknown>>;
14
14
  export default ForwardRefButtonDrawer;
@@ -56,6 +56,7 @@ var __read = this && this.__read || function (o, n) {
56
56
 
57
57
  import React, { useState, useRef, useImperativeHandle } from 'react';
58
58
  import Drawer from 'antd/lib/drawer';
59
+ import isFunction from 'lodash/isFunction';
59
60
  import classNames from 'classnames';
60
61
 
61
62
  var ButtonDrawer = function ButtonDrawer(props, ref) {
@@ -107,7 +108,7 @@ var ButtonDrawer = function ButtonDrawer(props, ref) {
107
108
  title: title,
108
109
  onClose: closeDrawer,
109
110
  visible: drawerVisible
110
- }, restProps), /*#__PURE__*/React.cloneElement(children, {
111
+ }, restProps), isFunction(children) ? children(actionRef.current) : /*#__PURE__*/React.cloneElement(children, {
111
112
  drawerAction: actionRef.current
112
113
  })));
113
114
  };
@@ -0,0 +1,24 @@
1
+ import type { Moment } from 'moment';
2
+ export declare enum dateTypeEnum {
3
+ TODAY = 1,
4
+ YESTERDAY = 2,
5
+ WEEK = 3,
6
+ LAST_WEEK = 4,
7
+ MONTH = 5,
8
+ LAST_MONTH = 6,
9
+ QUARTER = 7,
10
+ LAST_QUARTER = 8,
11
+ BEFORE_7_DAY = 9,
12
+ BEFORE_14_DAY = 10,
13
+ BEFORE_30_DAY = 11,
14
+ BEFORE_90_DAY = 12,
15
+ BEFORE_180_DAY = 13,
16
+ BEFORE_365_DAY = 14
17
+ }
18
+ export declare type RadioListType = {
19
+ key: string | number | dateTypeEnum;
20
+ text: string;
21
+ value: [Moment, Moment];
22
+ };
23
+ declare const defaultRadioList: RadioListType[];
24
+ export default defaultRadioList;
@@ -0,0 +1,79 @@
1
+ import moment from 'moment';
2
+ var now = moment();
3
+ export var dateTypeEnum;
4
+
5
+ (function (dateTypeEnum) {
6
+ dateTypeEnum[dateTypeEnum["TODAY"] = 1] = "TODAY";
7
+ dateTypeEnum[dateTypeEnum["YESTERDAY"] = 2] = "YESTERDAY";
8
+ dateTypeEnum[dateTypeEnum["WEEK"] = 3] = "WEEK";
9
+ dateTypeEnum[dateTypeEnum["LAST_WEEK"] = 4] = "LAST_WEEK";
10
+ dateTypeEnum[dateTypeEnum["MONTH"] = 5] = "MONTH";
11
+ dateTypeEnum[dateTypeEnum["LAST_MONTH"] = 6] = "LAST_MONTH";
12
+ dateTypeEnum[dateTypeEnum["QUARTER"] = 7] = "QUARTER";
13
+ dateTypeEnum[dateTypeEnum["LAST_QUARTER"] = 8] = "LAST_QUARTER";
14
+ dateTypeEnum[dateTypeEnum["BEFORE_7_DAY"] = 9] = "BEFORE_7_DAY";
15
+ dateTypeEnum[dateTypeEnum["BEFORE_14_DAY"] = 10] = "BEFORE_14_DAY";
16
+ dateTypeEnum[dateTypeEnum["BEFORE_30_DAY"] = 11] = "BEFORE_30_DAY";
17
+ dateTypeEnum[dateTypeEnum["BEFORE_90_DAY"] = 12] = "BEFORE_90_DAY";
18
+ dateTypeEnum[dateTypeEnum["BEFORE_180_DAY"] = 13] = "BEFORE_180_DAY";
19
+ dateTypeEnum[dateTypeEnum["BEFORE_365_DAY"] = 14] = "BEFORE_365_DAY";
20
+ })(dateTypeEnum || (dateTypeEnum = {}));
21
+
22
+ var defaultRadioList = [{
23
+ key: dateTypeEnum.TODAY,
24
+ text: '今日',
25
+ value: [now, now]
26
+ }, {
27
+ key: dateTypeEnum.YESTERDAY,
28
+ text: '昨日',
29
+ value: [now.clone().subtract(1, 'day'), now.clone().subtract(1, 'day').endOf('day')]
30
+ }, {
31
+ key: dateTypeEnum.WEEK,
32
+ text: '本周',
33
+ value: [now.clone().startOf('week'), now.clone().endOf('week')]
34
+ }, {
35
+ key: dateTypeEnum.LAST_WEEK,
36
+ text: '上周',
37
+ value: [now.clone().subtract(1, 'week').startOf('week'), now.clone().subtract(1, 'week').endOf('week')]
38
+ }, {
39
+ key: dateTypeEnum.MONTH,
40
+ text: '本月',
41
+ value: [now.clone().startOf('month'), now.clone().endOf('month')]
42
+ }, {
43
+ key: dateTypeEnum.LAST_MONTH,
44
+ text: '上月',
45
+ value: [now.clone().subtract(1, 'month').startOf('month'), now.clone().subtract(1, 'month').endOf('month')]
46
+ }, {
47
+ key: dateTypeEnum.QUARTER,
48
+ text: '本季度',
49
+ value: [now.clone().startOf('quarter'), now.clone().endOf('quarter')]
50
+ }, {
51
+ key: dateTypeEnum.LAST_QUARTER,
52
+ text: '上季度',
53
+ value: [now.clone().subtract(1, 'quarter').startOf('quarter'), now.clone().subtract(1, 'quarter').endOf('quarter')]
54
+ }, {
55
+ key: dateTypeEnum.BEFORE_7_DAY,
56
+ text: '最近7天',
57
+ value: [now.clone().subtract(6, 'day').startOf('day'), now.endOf('day')]
58
+ }, {
59
+ key: dateTypeEnum.BEFORE_14_DAY,
60
+ text: '最近14天',
61
+ value: [now.clone().subtract(13, 'day').startOf('day'), now.endOf('day')]
62
+ }, {
63
+ key: dateTypeEnum.BEFORE_30_DAY,
64
+ text: '最近30天',
65
+ value: [now.clone().subtract(29, 'day').startOf('day'), now.endOf('day')]
66
+ }, {
67
+ key: dateTypeEnum.BEFORE_90_DAY,
68
+ text: '最近90天',
69
+ value: [now.clone().subtract(89, 'day').startOf('day'), now.endOf('day')]
70
+ }, {
71
+ key: dateTypeEnum.BEFORE_180_DAY,
72
+ text: '最近180天',
73
+ value: [now.clone().subtract(179, 'day').startOf('day'), now.endOf('day')]
74
+ }, {
75
+ key: dateTypeEnum.BEFORE_365_DAY,
76
+ text: '最近365天',
77
+ value: [now.clone().subtract(364, 'day').startOf('day'), now.endOf('day')]
78
+ }];
79
+ export default defaultRadioList;
@@ -1,15 +1,14 @@
1
- import { dateTypeEnum } from './getDateScope';
1
+ import type { Moment } from 'moment';
2
+ import type { dateTypeEnum } from './defaultRadioList';
2
3
  import type { LabelRangePickerProps } from '../label-range-picker';
3
4
  export declare type RadioListType = {
4
- key: dateTypeEnum;
5
+ key: string | number | dateTypeEnum;
5
6
  text: string;
7
+ value: [Moment, Moment];
6
8
  };
7
9
  export interface LabelCustomizeRangePickerProps extends LabelRangePickerProps {
8
- customizeTimeList?: dateTypeEnum[];
9
10
  radioList?: RadioListType[];
11
+ customizeTimeList?: dateTypeEnum[];
10
12
  }
11
- declare const LabelCustomizeRangePicker: {
12
- (props: LabelCustomizeRangePickerProps): JSX.Element;
13
- dateTypeEnum: typeof dateTypeEnum;
14
- };
13
+ declare const LabelCustomizeRangePicker: (props: LabelCustomizeRangePickerProps) => JSX.Element;
15
14
  export default LabelCustomizeRangePicker;
@@ -58,9 +58,8 @@ import React, { useState, useEffect } from 'react';
58
58
  import Radio from 'antd/lib/radio';
59
59
  import Checkbox from 'antd/lib/checkbox';
60
60
  import useControllableValue from 'ahooks/lib/useControllableValue';
61
- import getRadioList from './getRadioList';
61
+ import defaultRadioList from './defaultRadioList';
62
62
  import LabelRangePicker from '../label-range-picker';
63
- import { useDateScope, dateTypeEnum } from './getDateScope';
64
63
 
65
64
  var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
66
65
  var customizeTimeList = props.customizeTimeList,
@@ -79,12 +78,9 @@ var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
79
78
  radioKey = _c[0],
80
79
  setRadioKey = _c[1];
81
80
 
82
- var _d = useDateScope(),
83
- dateScopeMap = _d.dateScopeMap,
84
- dateScopeList = _d.dateScopeList;
85
-
81
+ var dataSource = radioList !== null && radioList !== void 0 ? radioList : defaultRadioList;
86
82
  useEffect(function () {
87
- var foundItem = dateScopeList.find(function (item) {
83
+ var foundItem = dataSource.find(function (item) {
88
84
  if (!date) return false;
89
85
 
90
86
  var _a = __read(item.value, 2),
@@ -117,13 +113,15 @@ var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
117
113
  var onRadioChange = function onRadioChange(event) {
118
114
  var value = event.target.value;
119
115
  setRadioKey(value);
120
- setDate(dateScopeMap[value]);
116
+ var selectRadioInfo = dataSource.find(function (item) {
117
+ return item.key === value;
118
+ });
119
+ setDate(selectRadioInfo === null || selectRadioInfo === void 0 ? void 0 : selectRadioInfo.value);
121
120
  };
122
121
 
123
- var list = radioList !== null && radioList !== void 0 ? radioList : getRadioList().filter(function (item) {
122
+ var list = radioList !== null && radioList !== void 0 ? radioList : defaultRadioList.filter(function (item) {
124
123
  return customizeTimeList === null || customizeTimeList === void 0 ? void 0 : customizeTimeList.includes(item.key);
125
124
  });
126
- var finallyRadioList = list.length ? list : getRadioList();
127
125
 
128
126
  var panelRender = function panelRender(panel) {
129
127
  return /*#__PURE__*/React.createElement("div", {
@@ -141,7 +139,7 @@ var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
141
139
  }, /*#__PURE__*/React.createElement(Radio.Group, {
142
140
  onChange: onRadioChange,
143
141
  value: radioKey
144
- }, finallyRadioList.map(function (_a) {
142
+ }, list.map(function (_a) {
145
143
  var key = _a.key,
146
144
  text = _a.text;
147
145
  return /*#__PURE__*/React.createElement(Radio, {
@@ -159,5 +157,4 @@ var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
159
157
  }, options));
160
158
  };
161
159
 
162
- LabelCustomizeRangePicker.dateTypeEnum = dateTypeEnum;
163
160
  export default LabelCustomizeRangePicker;
@@ -1,4 +1,9 @@
1
- .label-number-input {
1
+ .label-number-input-warper {
2
+ position: relative;
3
+ width: 100%;
4
+ height: 100%;
5
+ }
6
+ .label-number-input-warper .label-number-input {
2
7
  z-index: 1;
3
8
  width: 100%;
4
9
  height: 100%;
@@ -9,26 +14,21 @@
9
14
  border: 0;
10
15
  outline: 0;
11
16
  }
12
- .label-number-input:focus + label,
13
- .label-number-input:not([data-value='0']) + label {
17
+ .label-number-input-warper .label-number-input:focus + label,
18
+ .label-number-input-warper .label-number-input:not([data-value='0']) + label {
14
19
  transform: translateY(-8px) scale(0.8);
15
20
  }
16
- .label-number-input-field {
21
+ .label-number-input-warper .label-number-input-field {
17
22
  height: 45px;
18
23
  overflow: hidden;
19
24
  border: 1px solid #e5e5e5;
20
25
  border-radius: 8px;
21
26
  transition: border 0.3s;
22
27
  }
23
- .label-number-input-focused {
28
+ .label-number-input-warper .label-number-input-focused {
24
29
  border-color: #000;
25
30
  }
26
- .label-number-input-warper {
27
- position: relative;
28
- width: 100%;
29
- height: 100%;
30
- }
31
- .label-number-input-text {
31
+ .label-number-input-warper .label-number-input-text {
32
32
  position: absolute;
33
33
  top: 12px;
34
34
  left: 15px;
@@ -9,51 +9,51 @@
9
9
 
10
10
  @font-weight-500: 500;
11
11
 
12
- .label-number-input {
13
- z-index: 1;
12
+ .label-number-input-warper {
13
+ position: relative;
14
14
  width: 100%;
15
15
  height: 100%;
16
- padding: 19px 15px 2px 15px;
17
- color: @color_263241;
18
- font-size: @font-size-base;
19
- line-height: 16px;
20
- border: 0;
21
- outline: 0;
22
-
23
- &:focus + label,
24
- &:not([data-value='0']) + label {
25
- transform: translateY(@labelTextLabeltranslateY) scale(@labelTextLabelScale);
26
- }
27
-
28
- &-field {
29
- height: 45px;
30
- overflow: hidden;
31
- border: 1px solid @color_e5e5e5;
32
- border-radius: 8px;
33
- transition: border 0.3s;
34
- }
35
16
 
36
- &-focused {
37
- border-color: @labelFocusBorderColor;
38
- }
39
-
40
- &-warper {
41
- position: relative;
17
+ .label-number-input {
18
+ z-index: 1;
42
19
  width: 100%;
43
20
  height: 100%;
44
- }
45
-
46
- &-text {
47
- position: absolute;
48
- top: 12px;
49
- left: 15px;
50
- z-index: 2;
51
- height: 20px;
52
- color: @color_9aa5b5;
21
+ padding: 19px 15px 2px 15px;
22
+ color: @color_263241;
53
23
  font-size: @font-size-base;
54
- line-height: 20px;
55
- transform-origin: top left;
56
- cursor: text;
57
- transition: all 0.2s ease-out;
24
+ line-height: 16px;
25
+ border: 0;
26
+ outline: 0;
27
+
28
+ &:focus + label,
29
+ &:not([data-value='0']) + label {
30
+ transform: translateY(@labelTextLabeltranslateY) scale(@labelTextLabelScale);
31
+ }
32
+
33
+ &-field {
34
+ height: 45px;
35
+ overflow: hidden;
36
+ border: 1px solid @color_e5e5e5;
37
+ border-radius: 8px;
38
+ transition: border 0.3s;
39
+ }
40
+
41
+ &-focused {
42
+ border-color: @labelFocusBorderColor;
43
+ }
44
+
45
+ &-text {
46
+ position: absolute;
47
+ top: 12px;
48
+ left: 15px;
49
+ z-index: 2;
50
+ height: 20px;
51
+ color: @color_9aa5b5;
52
+ font-size: @font-size-base;
53
+ line-height: 20px;
54
+ transform-origin: top left;
55
+ cursor: text;
56
+ transition: all 0.2s ease-out;
57
+ }
58
58
  }
59
59
  }
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
2
  import type { DrawerProps } from 'antd/lib/drawer';
3
+ export declare type DrawerAction = {
4
+ close: () => void;
5
+ open: () => void;
6
+ };
3
7
  export interface ButtonDrawerProps extends DrawerProps {
4
8
  onClose?: () => void;
5
9
  onOpen?: () => void;
6
10
  trigger: React.ReactElement;
7
- children: React.ReactElement;
11
+ children: ((v: DrawerAction) => React.ReactElement) | React.ReactElement;
8
12
  }
9
- export declare type DrawerAction = {
10
- close: () => void;
11
- open: () => void;
12
- };
13
13
  declare const ForwardRefButtonDrawer: React.ForwardRefExoticComponent<ButtonDrawerProps & React.RefAttributes<unknown>>;
14
14
  export default ForwardRefButtonDrawer;
@@ -104,6 +104,8 @@ var react_1 = __importStar(require("react"));
104
104
 
105
105
  var drawer_1 = __importDefault(require("antd/lib/drawer"));
106
106
 
107
+ var isFunction_1 = __importDefault(require("lodash/isFunction"));
108
+
107
109
  var classnames_1 = __importDefault(require("classnames"));
108
110
 
109
111
  var ButtonDrawer = function ButtonDrawer(props, ref) {
@@ -155,7 +157,7 @@ var ButtonDrawer = function ButtonDrawer(props, ref) {
155
157
  title: title,
156
158
  onClose: closeDrawer,
157
159
  visible: drawerVisible
158
- }, restProps), react_1["default"].cloneElement(children, {
160
+ }, restProps), isFunction_1["default"](children) ? children(actionRef.current) : react_1["default"].cloneElement(children, {
159
161
  drawerAction: actionRef.current
160
162
  })));
161
163
  };
@@ -0,0 +1,24 @@
1
+ import type { Moment } from 'moment';
2
+ export declare enum dateTypeEnum {
3
+ TODAY = 1,
4
+ YESTERDAY = 2,
5
+ WEEK = 3,
6
+ LAST_WEEK = 4,
7
+ MONTH = 5,
8
+ LAST_MONTH = 6,
9
+ QUARTER = 7,
10
+ LAST_QUARTER = 8,
11
+ BEFORE_7_DAY = 9,
12
+ BEFORE_14_DAY = 10,
13
+ BEFORE_30_DAY = 11,
14
+ BEFORE_90_DAY = 12,
15
+ BEFORE_180_DAY = 13,
16
+ BEFORE_365_DAY = 14
17
+ }
18
+ export declare type RadioListType = {
19
+ key: string | number | dateTypeEnum;
20
+ text: string;
21
+ value: [Moment, Moment];
22
+ };
23
+ declare const defaultRadioList: RadioListType[];
24
+ export default defaultRadioList;
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+
3
+ var __importDefault = this && this.__importDefault || function (mod) {
4
+ return mod && mod.__esModule ? mod : {
5
+ "default": mod
6
+ };
7
+ };
8
+
9
+ Object.defineProperty(exports, "__esModule", {
10
+ value: true
11
+ });
12
+ exports.dateTypeEnum = void 0;
13
+
14
+ var moment_1 = __importDefault(require("moment"));
15
+
16
+ var now = moment_1["default"]();
17
+ var dateTypeEnum;
18
+
19
+ (function (dateTypeEnum) {
20
+ dateTypeEnum[dateTypeEnum["TODAY"] = 1] = "TODAY";
21
+ dateTypeEnum[dateTypeEnum["YESTERDAY"] = 2] = "YESTERDAY";
22
+ dateTypeEnum[dateTypeEnum["WEEK"] = 3] = "WEEK";
23
+ dateTypeEnum[dateTypeEnum["LAST_WEEK"] = 4] = "LAST_WEEK";
24
+ dateTypeEnum[dateTypeEnum["MONTH"] = 5] = "MONTH";
25
+ dateTypeEnum[dateTypeEnum["LAST_MONTH"] = 6] = "LAST_MONTH";
26
+ dateTypeEnum[dateTypeEnum["QUARTER"] = 7] = "QUARTER";
27
+ dateTypeEnum[dateTypeEnum["LAST_QUARTER"] = 8] = "LAST_QUARTER";
28
+ dateTypeEnum[dateTypeEnum["BEFORE_7_DAY"] = 9] = "BEFORE_7_DAY";
29
+ dateTypeEnum[dateTypeEnum["BEFORE_14_DAY"] = 10] = "BEFORE_14_DAY";
30
+ dateTypeEnum[dateTypeEnum["BEFORE_30_DAY"] = 11] = "BEFORE_30_DAY";
31
+ dateTypeEnum[dateTypeEnum["BEFORE_90_DAY"] = 12] = "BEFORE_90_DAY";
32
+ dateTypeEnum[dateTypeEnum["BEFORE_180_DAY"] = 13] = "BEFORE_180_DAY";
33
+ dateTypeEnum[dateTypeEnum["BEFORE_365_DAY"] = 14] = "BEFORE_365_DAY";
34
+ })(dateTypeEnum = exports.dateTypeEnum || (exports.dateTypeEnum = {}));
35
+
36
+ var defaultRadioList = [{
37
+ key: dateTypeEnum.TODAY,
38
+ text: '今日',
39
+ value: [now, now]
40
+ }, {
41
+ key: dateTypeEnum.YESTERDAY,
42
+ text: '昨日',
43
+ value: [now.clone().subtract(1, 'day'), now.clone().subtract(1, 'day').endOf('day')]
44
+ }, {
45
+ key: dateTypeEnum.WEEK,
46
+ text: '本周',
47
+ value: [now.clone().startOf('week'), now.clone().endOf('week')]
48
+ }, {
49
+ key: dateTypeEnum.LAST_WEEK,
50
+ text: '上周',
51
+ value: [now.clone().subtract(1, 'week').startOf('week'), now.clone().subtract(1, 'week').endOf('week')]
52
+ }, {
53
+ key: dateTypeEnum.MONTH,
54
+ text: '本月',
55
+ value: [now.clone().startOf('month'), now.clone().endOf('month')]
56
+ }, {
57
+ key: dateTypeEnum.LAST_MONTH,
58
+ text: '上月',
59
+ value: [now.clone().subtract(1, 'month').startOf('month'), now.clone().subtract(1, 'month').endOf('month')]
60
+ }, {
61
+ key: dateTypeEnum.QUARTER,
62
+ text: '本季度',
63
+ value: [now.clone().startOf('quarter'), now.clone().endOf('quarter')]
64
+ }, {
65
+ key: dateTypeEnum.LAST_QUARTER,
66
+ text: '上季度',
67
+ value: [now.clone().subtract(1, 'quarter').startOf('quarter'), now.clone().subtract(1, 'quarter').endOf('quarter')]
68
+ }, {
69
+ key: dateTypeEnum.BEFORE_7_DAY,
70
+ text: '最近7天',
71
+ value: [now.clone().subtract(6, 'day').startOf('day'), now.endOf('day')]
72
+ }, {
73
+ key: dateTypeEnum.BEFORE_14_DAY,
74
+ text: '最近14天',
75
+ value: [now.clone().subtract(13, 'day').startOf('day'), now.endOf('day')]
76
+ }, {
77
+ key: dateTypeEnum.BEFORE_30_DAY,
78
+ text: '最近30天',
79
+ value: [now.clone().subtract(29, 'day').startOf('day'), now.endOf('day')]
80
+ }, {
81
+ key: dateTypeEnum.BEFORE_90_DAY,
82
+ text: '最近90天',
83
+ value: [now.clone().subtract(89, 'day').startOf('day'), now.endOf('day')]
84
+ }, {
85
+ key: dateTypeEnum.BEFORE_180_DAY,
86
+ text: '最近180天',
87
+ value: [now.clone().subtract(179, 'day').startOf('day'), now.endOf('day')]
88
+ }, {
89
+ key: dateTypeEnum.BEFORE_365_DAY,
90
+ text: '最近365天',
91
+ value: [now.clone().subtract(364, 'day').startOf('day'), now.endOf('day')]
92
+ }];
93
+ exports["default"] = defaultRadioList;
@@ -1,15 +1,14 @@
1
- import { dateTypeEnum } from './getDateScope';
1
+ import type { Moment } from 'moment';
2
+ import type { dateTypeEnum } from './defaultRadioList';
2
3
  import type { LabelRangePickerProps } from '../label-range-picker';
3
4
  export declare type RadioListType = {
4
- key: dateTypeEnum;
5
+ key: string | number | dateTypeEnum;
5
6
  text: string;
7
+ value: [Moment, Moment];
6
8
  };
7
9
  export interface LabelCustomizeRangePickerProps extends LabelRangePickerProps {
8
- customizeTimeList?: dateTypeEnum[];
9
10
  radioList?: RadioListType[];
11
+ customizeTimeList?: dateTypeEnum[];
10
12
  }
11
- declare const LabelCustomizeRangePicker: {
12
- (props: LabelCustomizeRangePickerProps): JSX.Element;
13
- dateTypeEnum: typeof dateTypeEnum;
14
- };
13
+ declare const LabelCustomizeRangePicker: (props: LabelCustomizeRangePickerProps) => JSX.Element;
15
14
  export default LabelCustomizeRangePicker;
@@ -108,12 +108,10 @@ var checkbox_1 = __importDefault(require("antd/lib/checkbox"));
108
108
 
109
109
  var useControllableValue_1 = __importDefault(require("ahooks/lib/useControllableValue"));
110
110
 
111
- var getRadioList_1 = __importDefault(require("./getRadioList"));
111
+ var defaultRadioList_1 = __importDefault(require("./defaultRadioList"));
112
112
 
113
113
  var label_range_picker_1 = __importDefault(require("../label-range-picker"));
114
114
 
115
- var getDateScope_1 = require("./getDateScope");
116
-
117
115
  var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
118
116
  var customizeTimeList = props.customizeTimeList,
119
117
  radioList = props.radioList,
@@ -131,12 +129,9 @@ var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
131
129
  radioKey = _c[0],
132
130
  setRadioKey = _c[1];
133
131
 
134
- var _d = getDateScope_1.useDateScope(),
135
- dateScopeMap = _d.dateScopeMap,
136
- dateScopeList = _d.dateScopeList;
137
-
132
+ var dataSource = radioList !== null && radioList !== void 0 ? radioList : defaultRadioList_1["default"];
138
133
  react_1.useEffect(function () {
139
- var foundItem = dateScopeList.find(function (item) {
134
+ var foundItem = dataSource.find(function (item) {
140
135
  if (!date) return false;
141
136
 
142
137
  var _a = __read(item.value, 2),
@@ -169,13 +164,15 @@ var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
169
164
  var onRadioChange = function onRadioChange(event) {
170
165
  var value = event.target.value;
171
166
  setRadioKey(value);
172
- setDate(dateScopeMap[value]);
167
+ var selectRadioInfo = dataSource.find(function (item) {
168
+ return item.key === value;
169
+ });
170
+ setDate(selectRadioInfo === null || selectRadioInfo === void 0 ? void 0 : selectRadioInfo.value);
173
171
  };
174
172
 
175
- var list = radioList !== null && radioList !== void 0 ? radioList : getRadioList_1["default"]().filter(function (item) {
173
+ var list = radioList !== null && radioList !== void 0 ? radioList : defaultRadioList_1["default"].filter(function (item) {
176
174
  return customizeTimeList === null || customizeTimeList === void 0 ? void 0 : customizeTimeList.includes(item.key);
177
175
  });
178
- var finallyRadioList = list.length ? list : getRadioList_1["default"]();
179
176
 
180
177
  var panelRender = function panelRender(panel) {
181
178
  return react_1["default"].createElement("div", {
@@ -193,7 +190,7 @@ var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
193
190
  }, react_1["default"].createElement(radio_1["default"].Group, {
194
191
  onChange: onRadioChange,
195
192
  value: radioKey
196
- }, finallyRadioList.map(function (_a) {
193
+ }, list.map(function (_a) {
197
194
  var key = _a.key,
198
195
  text = _a.text;
199
196
  return react_1["default"].createElement(radio_1["default"], {
@@ -211,5 +208,4 @@ var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
211
208
  }, options));
212
209
  };
213
210
 
214
- LabelCustomizeRangePicker.dateTypeEnum = getDateScope_1.dateTypeEnum;
215
211
  exports["default"] = LabelCustomizeRangePicker;
@@ -1,4 +1,9 @@
1
- .label-number-input {
1
+ .label-number-input-warper {
2
+ position: relative;
3
+ width: 100%;
4
+ height: 100%;
5
+ }
6
+ .label-number-input-warper .label-number-input {
2
7
  z-index: 1;
3
8
  width: 100%;
4
9
  height: 100%;
@@ -9,26 +14,21 @@
9
14
  border: 0;
10
15
  outline: 0;
11
16
  }
12
- .label-number-input:focus + label,
13
- .label-number-input:not([data-value='0']) + label {
17
+ .label-number-input-warper .label-number-input:focus + label,
18
+ .label-number-input-warper .label-number-input:not([data-value='0']) + label {
14
19
  transform: translateY(-8px) scale(0.8);
15
20
  }
16
- .label-number-input-field {
21
+ .label-number-input-warper .label-number-input-field {
17
22
  height: 45px;
18
23
  overflow: hidden;
19
24
  border: 1px solid #e5e5e5;
20
25
  border-radius: 8px;
21
26
  transition: border 0.3s;
22
27
  }
23
- .label-number-input-focused {
28
+ .label-number-input-warper .label-number-input-focused {
24
29
  border-color: #000;
25
30
  }
26
- .label-number-input-warper {
27
- position: relative;
28
- width: 100%;
29
- height: 100%;
30
- }
31
- .label-number-input-text {
31
+ .label-number-input-warper .label-number-input-text {
32
32
  position: absolute;
33
33
  top: 12px;
34
34
  left: 15px;
@@ -9,51 +9,51 @@
9
9
 
10
10
  @font-weight-500: 500;
11
11
 
12
- .label-number-input {
13
- z-index: 1;
12
+ .label-number-input-warper {
13
+ position: relative;
14
14
  width: 100%;
15
15
  height: 100%;
16
- padding: 19px 15px 2px 15px;
17
- color: @color_263241;
18
- font-size: @font-size-base;
19
- line-height: 16px;
20
- border: 0;
21
- outline: 0;
22
-
23
- &:focus + label,
24
- &:not([data-value='0']) + label {
25
- transform: translateY(@labelTextLabeltranslateY) scale(@labelTextLabelScale);
26
- }
27
-
28
- &-field {
29
- height: 45px;
30
- overflow: hidden;
31
- border: 1px solid @color_e5e5e5;
32
- border-radius: 8px;
33
- transition: border 0.3s;
34
- }
35
16
 
36
- &-focused {
37
- border-color: @labelFocusBorderColor;
38
- }
39
-
40
- &-warper {
41
- position: relative;
17
+ .label-number-input {
18
+ z-index: 1;
42
19
  width: 100%;
43
20
  height: 100%;
44
- }
45
-
46
- &-text {
47
- position: absolute;
48
- top: 12px;
49
- left: 15px;
50
- z-index: 2;
51
- height: 20px;
52
- color: @color_9aa5b5;
21
+ padding: 19px 15px 2px 15px;
22
+ color: @color_263241;
53
23
  font-size: @font-size-base;
54
- line-height: 20px;
55
- transform-origin: top left;
56
- cursor: text;
57
- transition: all 0.2s ease-out;
24
+ line-height: 16px;
25
+ border: 0;
26
+ outline: 0;
27
+
28
+ &:focus + label,
29
+ &:not([data-value='0']) + label {
30
+ transform: translateY(@labelTextLabeltranslateY) scale(@labelTextLabelScale);
31
+ }
32
+
33
+ &-field {
34
+ height: 45px;
35
+ overflow: hidden;
36
+ border: 1px solid @color_e5e5e5;
37
+ border-radius: 8px;
38
+ transition: border 0.3s;
39
+ }
40
+
41
+ &-focused {
42
+ border-color: @labelFocusBorderColor;
43
+ }
44
+
45
+ &-text {
46
+ position: absolute;
47
+ top: 12px;
48
+ left: 15px;
49
+ z-index: 2;
50
+ height: 20px;
51
+ color: @color_9aa5b5;
52
+ font-size: @font-size-base;
53
+ line-height: 20px;
54
+ transform-origin: top left;
55
+ cursor: text;
56
+ transition: all 0.2s ease-out;
57
+ }
58
58
  }
59
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assui",
3
- "version": "2.0.144",
3
+ "version": "2.0.147",
4
4
  "description": "react ui library",
5
5
  "author": "jason <usochen@gmail.com>",
6
6
  "main": "./lib/index.js",
@@ -69,5 +69,5 @@
69
69
  "node": ">=10.0.0"
70
70
  },
71
71
  "license": "MIT",
72
- "gitHead": "4cb9764c58c343887caf3fdcefdd6a8e96b56b46"
72
+ "gitHead": "e7faebace17ebf416b51906b1b8dab8cf0fc9a7c"
73
73
  }
@@ -1,45 +0,0 @@
1
- import moment from 'moment';
2
- export declare enum dateTypeEnum {
3
- TODAY = 1,
4
- YESTERDAY = 2,
5
- WEEK = 3,
6
- LAST_WEEK = 4,
7
- MONTH = 5,
8
- LAST_MONTH = 6,
9
- QUARTER = 7,
10
- LAST_QUARTER = 8,
11
- BEFORE_7_DAY = 9,
12
- BEFORE_14_DAY = 10,
13
- BEFORE_30_DAY = 11,
14
- BEFORE_90_DAY = 12,
15
- BEFORE_180_DAY = 13,
16
- BEFORE_365_DAY = 14,
17
- PAST_7_DAY = 15,
18
- FUTURE_7_DAY = 16,
19
- TOMORROW = 17
20
- }
21
- export declare const useDateScope: () => {
22
- dateScopeList: {
23
- key: dateTypeEnum;
24
- value: moment.Moment[];
25
- }[];
26
- dateScopeMap: {
27
- 1: moment.Moment[];
28
- 2: moment.Moment[];
29
- 3: moment.Moment[];
30
- 4: moment.Moment[];
31
- 5: moment.Moment[];
32
- 6: moment.Moment[];
33
- 7: moment.Moment[];
34
- 8: moment.Moment[];
35
- 9: moment.Moment[];
36
- 10: moment.Moment[];
37
- 11: moment.Moment[];
38
- 12: moment.Moment[];
39
- 13: moment.Moment[];
40
- 14: moment.Moment[];
41
- 15: moment.Moment[];
42
- 17: moment.Moment[];
43
- 16: moment.Moment[];
44
- };
45
- };
@@ -1,85 +0,0 @@
1
- import moment from 'moment';
2
- var now = moment();
3
- export var dateTypeEnum;
4
-
5
- (function (dateTypeEnum) {
6
- dateTypeEnum[dateTypeEnum["TODAY"] = 1] = "TODAY";
7
- dateTypeEnum[dateTypeEnum["YESTERDAY"] = 2] = "YESTERDAY";
8
- dateTypeEnum[dateTypeEnum["WEEK"] = 3] = "WEEK";
9
- dateTypeEnum[dateTypeEnum["LAST_WEEK"] = 4] = "LAST_WEEK";
10
- dateTypeEnum[dateTypeEnum["MONTH"] = 5] = "MONTH";
11
- dateTypeEnum[dateTypeEnum["LAST_MONTH"] = 6] = "LAST_MONTH";
12
- dateTypeEnum[dateTypeEnum["QUARTER"] = 7] = "QUARTER";
13
- dateTypeEnum[dateTypeEnum["LAST_QUARTER"] = 8] = "LAST_QUARTER";
14
- dateTypeEnum[dateTypeEnum["BEFORE_7_DAY"] = 9] = "BEFORE_7_DAY";
15
- dateTypeEnum[dateTypeEnum["BEFORE_14_DAY"] = 10] = "BEFORE_14_DAY";
16
- dateTypeEnum[dateTypeEnum["BEFORE_30_DAY"] = 11] = "BEFORE_30_DAY";
17
- dateTypeEnum[dateTypeEnum["BEFORE_90_DAY"] = 12] = "BEFORE_90_DAY";
18
- dateTypeEnum[dateTypeEnum["BEFORE_180_DAY"] = 13] = "BEFORE_180_DAY";
19
- dateTypeEnum[dateTypeEnum["BEFORE_365_DAY"] = 14] = "BEFORE_365_DAY";
20
- dateTypeEnum[dateTypeEnum["PAST_7_DAY"] = 15] = "PAST_7_DAY";
21
- dateTypeEnum[dateTypeEnum["FUTURE_7_DAY"] = 16] = "FUTURE_7_DAY";
22
- dateTypeEnum[dateTypeEnum["TOMORROW"] = 17] = "TOMORROW";
23
- })(dateTypeEnum || (dateTypeEnum = {}));
24
-
25
- export var useDateScope = function useDateScope() {
26
- var _a;
27
-
28
- var dateScopeList = [{
29
- key: dateTypeEnum.TODAY,
30
- value: [now, now]
31
- }, {
32
- key: dateTypeEnum.YESTERDAY,
33
- value: [now.clone().subtract(1, 'day'), now.clone().subtract(1, 'day').endOf('day')]
34
- }, {
35
- key: dateTypeEnum.WEEK,
36
- value: [now.clone().startOf('week'), now.clone().endOf('week')]
37
- }, {
38
- key: dateTypeEnum.LAST_WEEK,
39
- value: [now.clone().subtract(1, 'week').startOf('week'), now.clone().subtract(1, 'week').endOf('week')]
40
- }, {
41
- key: dateTypeEnum.MONTH,
42
- value: [now.clone().startOf('month'), now.clone().endOf('month')]
43
- }, {
44
- key: dateTypeEnum.LAST_MONTH,
45
- value: [now.clone().subtract(1, 'month').startOf('month'), now.clone().subtract(1, 'month').endOf('month')]
46
- }, {
47
- key: dateTypeEnum.QUARTER,
48
- value: [now.clone().startOf('quarter'), now.clone().endOf('quarter')]
49
- }, {
50
- key: dateTypeEnum.LAST_QUARTER,
51
- value: [now.clone().subtract(1, 'quarter').startOf('quarter'), now.clone().subtract(1, 'quarter').endOf('quarter')]
52
- }, {
53
- key: dateTypeEnum.BEFORE_7_DAY,
54
- value: [now.clone().subtract(6, 'day').startOf('day'), now.endOf('day')]
55
- }, {
56
- key: dateTypeEnum.BEFORE_14_DAY,
57
- value: [now.clone().subtract(13, 'day').startOf('day'), now.endOf('day')]
58
- }, {
59
- key: dateTypeEnum.BEFORE_30_DAY,
60
- value: [now.clone().subtract(29, 'day').startOf('day'), now.endOf('day')]
61
- }, {
62
- key: dateTypeEnum.BEFORE_90_DAY,
63
- value: [now.clone().subtract(89, 'day').startOf('day'), now.endOf('day')]
64
- }, {
65
- key: dateTypeEnum.BEFORE_180_DAY,
66
- value: [now.clone().subtract(179, 'day').startOf('day'), now.endOf('day')]
67
- }, {
68
- key: dateTypeEnum.BEFORE_365_DAY,
69
- value: [now.clone().subtract(364, 'day').startOf('day'), now.endOf('day')]
70
- }, {
71
- key: dateTypeEnum.PAST_7_DAY,
72
- value: [now.clone().subtract(7, 'day').startOf('day'), now.clone().subtract(1, 'day').endOf('day')]
73
- }, {
74
- key: dateTypeEnum.TOMORROW,
75
- value: [now.clone().add(1, 'day').startOf('day'), now.clone().add(1, 'day').endOf('day')]
76
- }, {
77
- key: dateTypeEnum.FUTURE_7_DAY,
78
- value: [now.clone().add(1, 'day').startOf('day'), now.clone().add(7, 'day').endOf('day')]
79
- }];
80
- var dateScopeMap = (_a = {}, _a[dateTypeEnum.TODAY] = [now.clone().startOf('day'), now.clone().endOf('day')], _a[dateTypeEnum.YESTERDAY] = [now.clone().subtract(1, 'day').startOf('day'), now.clone().subtract(1, 'day').endOf('day')], _a[dateTypeEnum.WEEK] = [now.clone().startOf('week'), now.clone().endOf('week')], _a[dateTypeEnum.LAST_WEEK] = [now.clone().subtract(1, 'week').startOf('week'), now.clone().subtract(1, 'week').endOf('week')], _a[dateTypeEnum.MONTH] = [now.clone().startOf('month'), now.clone().endOf('month')], _a[dateTypeEnum.LAST_MONTH] = [now.clone().subtract(1, 'month').startOf('month'), now.clone().subtract(1, 'month').endOf('month')], _a[dateTypeEnum.QUARTER] = [now.clone().startOf('quarter'), now.clone().endOf('quarter')], _a[dateTypeEnum.LAST_QUARTER] = [now.clone().subtract(1, 'quarter').startOf('quarter'), now.clone().subtract(1, 'quarter').endOf('quarter')], _a[dateTypeEnum.BEFORE_7_DAY] = [now.clone().subtract(6, 'day').startOf('day'), now.endOf('day')], _a[dateTypeEnum.BEFORE_14_DAY] = [now.clone().subtract(13, 'day').startOf('day'), now.endOf('day')], _a[dateTypeEnum.BEFORE_30_DAY] = [now.clone().subtract(29, 'day').startOf('day'), now.endOf('day')], _a[dateTypeEnum.BEFORE_90_DAY] = [now.clone().subtract(89, 'day').startOf('day'), now.endOf('day')], _a[dateTypeEnum.BEFORE_180_DAY] = [now.clone().subtract(179, 'day').startOf('day'), now.endOf('day')], _a[dateTypeEnum.BEFORE_365_DAY] = [now.clone().subtract(364, 'day').startOf('day'), now.endOf('day')], _a[dateTypeEnum.PAST_7_DAY] = [now.clone().subtract(7, 'day').startOf('day'), now.clone().subtract(1, 'day').endOf('day')], _a[dateTypeEnum.TOMORROW] = [now.clone().add(1, 'day').startOf('day'), now.clone().add(1, 'day').endOf('day')], _a[dateTypeEnum.FUTURE_7_DAY] = [now.clone().add(1, 'day').startOf('day'), now.clone().add(7, 'day').endOf('day')], _a);
81
- return {
82
- dateScopeList: dateScopeList,
83
- dateScopeMap: dateScopeMap
84
- };
85
- };
@@ -1,10 +0,0 @@
1
- import { dateTypeEnum } from './getDateScope';
2
- export declare type RadioListType = {
3
- key: dateTypeEnum;
4
- text: string;
5
- };
6
- declare const getRadioList: () => {
7
- key: dateTypeEnum;
8
- text: string;
9
- }[];
10
- export default getRadioList;
@@ -1,49 +0,0 @@
1
- import { dateTypeEnum } from './getDateScope';
2
-
3
- var getRadioList = function getRadioList() {
4
- return [{
5
- key: dateTypeEnum.TODAY,
6
- text: '今日'
7
- }, {
8
- key: dateTypeEnum.YESTERDAY,
9
- text: '昨日'
10
- }, {
11
- key: dateTypeEnum.WEEK,
12
- text: '本周'
13
- }, {
14
- key: dateTypeEnum.LAST_WEEK,
15
- text: '上周'
16
- }, {
17
- key: dateTypeEnum.MONTH,
18
- text: '本月'
19
- }, {
20
- key: dateTypeEnum.LAST_MONTH,
21
- text: '上月'
22
- }, {
23
- key: dateTypeEnum.QUARTER,
24
- text: '本季度'
25
- }, {
26
- key: dateTypeEnum.LAST_QUARTER,
27
- text: '上季度'
28
- }, {
29
- key: dateTypeEnum.BEFORE_7_DAY,
30
- text: '最近7天'
31
- }, {
32
- key: dateTypeEnum.BEFORE_14_DAY,
33
- text: '最近14天'
34
- }, {
35
- key: dateTypeEnum.BEFORE_30_DAY,
36
- text: '最近30天'
37
- }, {
38
- key: dateTypeEnum.BEFORE_90_DAY,
39
- text: '最近90天'
40
- }, {
41
- key: dateTypeEnum.BEFORE_180_DAY,
42
- text: '最近180天'
43
- }, {
44
- key: dateTypeEnum.BEFORE_365_DAY,
45
- text: '最近365天'
46
- }];
47
- };
48
-
49
- export default getRadioList;
@@ -1,45 +0,0 @@
1
- import moment from 'moment';
2
- export declare enum dateTypeEnum {
3
- TODAY = 1,
4
- YESTERDAY = 2,
5
- WEEK = 3,
6
- LAST_WEEK = 4,
7
- MONTH = 5,
8
- LAST_MONTH = 6,
9
- QUARTER = 7,
10
- LAST_QUARTER = 8,
11
- BEFORE_7_DAY = 9,
12
- BEFORE_14_DAY = 10,
13
- BEFORE_30_DAY = 11,
14
- BEFORE_90_DAY = 12,
15
- BEFORE_180_DAY = 13,
16
- BEFORE_365_DAY = 14,
17
- PAST_7_DAY = 15,
18
- FUTURE_7_DAY = 16,
19
- TOMORROW = 17
20
- }
21
- export declare const useDateScope: () => {
22
- dateScopeList: {
23
- key: dateTypeEnum;
24
- value: moment.Moment[];
25
- }[];
26
- dateScopeMap: {
27
- 1: moment.Moment[];
28
- 2: moment.Moment[];
29
- 3: moment.Moment[];
30
- 4: moment.Moment[];
31
- 5: moment.Moment[];
32
- 6: moment.Moment[];
33
- 7: moment.Moment[];
34
- 8: moment.Moment[];
35
- 9: moment.Moment[];
36
- 10: moment.Moment[];
37
- 11: moment.Moment[];
38
- 12: moment.Moment[];
39
- 13: moment.Moment[];
40
- 14: moment.Moment[];
41
- 15: moment.Moment[];
42
- 17: moment.Moment[];
43
- 16: moment.Moment[];
44
- };
45
- };
@@ -1,99 +0,0 @@
1
- "use strict";
2
-
3
- var __importDefault = this && this.__importDefault || function (mod) {
4
- return mod && mod.__esModule ? mod : {
5
- "default": mod
6
- };
7
- };
8
-
9
- Object.defineProperty(exports, "__esModule", {
10
- value: true
11
- });
12
- exports.useDateScope = exports.dateTypeEnum = void 0;
13
-
14
- var moment_1 = __importDefault(require("moment"));
15
-
16
- var now = moment_1["default"]();
17
- var dateTypeEnum;
18
-
19
- (function (dateTypeEnum) {
20
- dateTypeEnum[dateTypeEnum["TODAY"] = 1] = "TODAY";
21
- dateTypeEnum[dateTypeEnum["YESTERDAY"] = 2] = "YESTERDAY";
22
- dateTypeEnum[dateTypeEnum["WEEK"] = 3] = "WEEK";
23
- dateTypeEnum[dateTypeEnum["LAST_WEEK"] = 4] = "LAST_WEEK";
24
- dateTypeEnum[dateTypeEnum["MONTH"] = 5] = "MONTH";
25
- dateTypeEnum[dateTypeEnum["LAST_MONTH"] = 6] = "LAST_MONTH";
26
- dateTypeEnum[dateTypeEnum["QUARTER"] = 7] = "QUARTER";
27
- dateTypeEnum[dateTypeEnum["LAST_QUARTER"] = 8] = "LAST_QUARTER";
28
- dateTypeEnum[dateTypeEnum["BEFORE_7_DAY"] = 9] = "BEFORE_7_DAY";
29
- dateTypeEnum[dateTypeEnum["BEFORE_14_DAY"] = 10] = "BEFORE_14_DAY";
30
- dateTypeEnum[dateTypeEnum["BEFORE_30_DAY"] = 11] = "BEFORE_30_DAY";
31
- dateTypeEnum[dateTypeEnum["BEFORE_90_DAY"] = 12] = "BEFORE_90_DAY";
32
- dateTypeEnum[dateTypeEnum["BEFORE_180_DAY"] = 13] = "BEFORE_180_DAY";
33
- dateTypeEnum[dateTypeEnum["BEFORE_365_DAY"] = 14] = "BEFORE_365_DAY";
34
- dateTypeEnum[dateTypeEnum["PAST_7_DAY"] = 15] = "PAST_7_DAY";
35
- dateTypeEnum[dateTypeEnum["FUTURE_7_DAY"] = 16] = "FUTURE_7_DAY";
36
- dateTypeEnum[dateTypeEnum["TOMORROW"] = 17] = "TOMORROW";
37
- })(dateTypeEnum = exports.dateTypeEnum || (exports.dateTypeEnum = {}));
38
-
39
- exports.useDateScope = function () {
40
- var _a;
41
-
42
- var dateScopeList = [{
43
- key: dateTypeEnum.TODAY,
44
- value: [now, now]
45
- }, {
46
- key: dateTypeEnum.YESTERDAY,
47
- value: [now.clone().subtract(1, 'day'), now.clone().subtract(1, 'day').endOf('day')]
48
- }, {
49
- key: dateTypeEnum.WEEK,
50
- value: [now.clone().startOf('week'), now.clone().endOf('week')]
51
- }, {
52
- key: dateTypeEnum.LAST_WEEK,
53
- value: [now.clone().subtract(1, 'week').startOf('week'), now.clone().subtract(1, 'week').endOf('week')]
54
- }, {
55
- key: dateTypeEnum.MONTH,
56
- value: [now.clone().startOf('month'), now.clone().endOf('month')]
57
- }, {
58
- key: dateTypeEnum.LAST_MONTH,
59
- value: [now.clone().subtract(1, 'month').startOf('month'), now.clone().subtract(1, 'month').endOf('month')]
60
- }, {
61
- key: dateTypeEnum.QUARTER,
62
- value: [now.clone().startOf('quarter'), now.clone().endOf('quarter')]
63
- }, {
64
- key: dateTypeEnum.LAST_QUARTER,
65
- value: [now.clone().subtract(1, 'quarter').startOf('quarter'), now.clone().subtract(1, 'quarter').endOf('quarter')]
66
- }, {
67
- key: dateTypeEnum.BEFORE_7_DAY,
68
- value: [now.clone().subtract(6, 'day').startOf('day'), now.endOf('day')]
69
- }, {
70
- key: dateTypeEnum.BEFORE_14_DAY,
71
- value: [now.clone().subtract(13, 'day').startOf('day'), now.endOf('day')]
72
- }, {
73
- key: dateTypeEnum.BEFORE_30_DAY,
74
- value: [now.clone().subtract(29, 'day').startOf('day'), now.endOf('day')]
75
- }, {
76
- key: dateTypeEnum.BEFORE_90_DAY,
77
- value: [now.clone().subtract(89, 'day').startOf('day'), now.endOf('day')]
78
- }, {
79
- key: dateTypeEnum.BEFORE_180_DAY,
80
- value: [now.clone().subtract(179, 'day').startOf('day'), now.endOf('day')]
81
- }, {
82
- key: dateTypeEnum.BEFORE_365_DAY,
83
- value: [now.clone().subtract(364, 'day').startOf('day'), now.endOf('day')]
84
- }, {
85
- key: dateTypeEnum.PAST_7_DAY,
86
- value: [now.clone().subtract(7, 'day').startOf('day'), now.clone().subtract(1, 'day').endOf('day')]
87
- }, {
88
- key: dateTypeEnum.TOMORROW,
89
- value: [now.clone().add(1, 'day').startOf('day'), now.clone().add(1, 'day').endOf('day')]
90
- }, {
91
- key: dateTypeEnum.FUTURE_7_DAY,
92
- value: [now.clone().add(1, 'day').startOf('day'), now.clone().add(7, 'day').endOf('day')]
93
- }];
94
- var dateScopeMap = (_a = {}, _a[dateTypeEnum.TODAY] = [now.clone().startOf('day'), now.clone().endOf('day')], _a[dateTypeEnum.YESTERDAY] = [now.clone().subtract(1, 'day').startOf('day'), now.clone().subtract(1, 'day').endOf('day')], _a[dateTypeEnum.WEEK] = [now.clone().startOf('week'), now.clone().endOf('week')], _a[dateTypeEnum.LAST_WEEK] = [now.clone().subtract(1, 'week').startOf('week'), now.clone().subtract(1, 'week').endOf('week')], _a[dateTypeEnum.MONTH] = [now.clone().startOf('month'), now.clone().endOf('month')], _a[dateTypeEnum.LAST_MONTH] = [now.clone().subtract(1, 'month').startOf('month'), now.clone().subtract(1, 'month').endOf('month')], _a[dateTypeEnum.QUARTER] = [now.clone().startOf('quarter'), now.clone().endOf('quarter')], _a[dateTypeEnum.LAST_QUARTER] = [now.clone().subtract(1, 'quarter').startOf('quarter'), now.clone().subtract(1, 'quarter').endOf('quarter')], _a[dateTypeEnum.BEFORE_7_DAY] = [now.clone().subtract(6, 'day').startOf('day'), now.endOf('day')], _a[dateTypeEnum.BEFORE_14_DAY] = [now.clone().subtract(13, 'day').startOf('day'), now.endOf('day')], _a[dateTypeEnum.BEFORE_30_DAY] = [now.clone().subtract(29, 'day').startOf('day'), now.endOf('day')], _a[dateTypeEnum.BEFORE_90_DAY] = [now.clone().subtract(89, 'day').startOf('day'), now.endOf('day')], _a[dateTypeEnum.BEFORE_180_DAY] = [now.clone().subtract(179, 'day').startOf('day'), now.endOf('day')], _a[dateTypeEnum.BEFORE_365_DAY] = [now.clone().subtract(364, 'day').startOf('day'), now.endOf('day')], _a[dateTypeEnum.PAST_7_DAY] = [now.clone().subtract(7, 'day').startOf('day'), now.clone().subtract(1, 'day').endOf('day')], _a[dateTypeEnum.TOMORROW] = [now.clone().add(1, 'day').startOf('day'), now.clone().add(1, 'day').endOf('day')], _a[dateTypeEnum.FUTURE_7_DAY] = [now.clone().add(1, 'day').startOf('day'), now.clone().add(7, 'day').endOf('day')], _a);
95
- return {
96
- dateScopeList: dateScopeList,
97
- dateScopeMap: dateScopeMap
98
- };
99
- };
@@ -1,10 +0,0 @@
1
- import { dateTypeEnum } from './getDateScope';
2
- export declare type RadioListType = {
3
- key: dateTypeEnum;
4
- text: string;
5
- };
6
- declare const getRadioList: () => {
7
- key: dateTypeEnum;
8
- text: string;
9
- }[];
10
- export default getRadioList;
@@ -1,55 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var getDateScope_1 = require("./getDateScope");
8
-
9
- var getRadioList = function getRadioList() {
10
- return [{
11
- key: getDateScope_1.dateTypeEnum.TODAY,
12
- text: '今日'
13
- }, {
14
- key: getDateScope_1.dateTypeEnum.YESTERDAY,
15
- text: '昨日'
16
- }, {
17
- key: getDateScope_1.dateTypeEnum.WEEK,
18
- text: '本周'
19
- }, {
20
- key: getDateScope_1.dateTypeEnum.LAST_WEEK,
21
- text: '上周'
22
- }, {
23
- key: getDateScope_1.dateTypeEnum.MONTH,
24
- text: '本月'
25
- }, {
26
- key: getDateScope_1.dateTypeEnum.LAST_MONTH,
27
- text: '上月'
28
- }, {
29
- key: getDateScope_1.dateTypeEnum.QUARTER,
30
- text: '本季度'
31
- }, {
32
- key: getDateScope_1.dateTypeEnum.LAST_QUARTER,
33
- text: '上季度'
34
- }, {
35
- key: getDateScope_1.dateTypeEnum.BEFORE_7_DAY,
36
- text: '最近7天'
37
- }, {
38
- key: getDateScope_1.dateTypeEnum.BEFORE_14_DAY,
39
- text: '最近14天'
40
- }, {
41
- key: getDateScope_1.dateTypeEnum.BEFORE_30_DAY,
42
- text: '最近30天'
43
- }, {
44
- key: getDateScope_1.dateTypeEnum.BEFORE_90_DAY,
45
- text: '最近90天'
46
- }, {
47
- key: getDateScope_1.dateTypeEnum.BEFORE_180_DAY,
48
- text: '最近180天'
49
- }, {
50
- key: getDateScope_1.dateTypeEnum.BEFORE_365_DAY,
51
- text: '最近365天'
52
- }];
53
- };
54
-
55
- exports["default"] = getRadioList;