assui 2.0.96 → 2.0.97

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.
@@ -0,0 +1,39 @@
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
+ }
18
+ export declare const useDateScope: () => {
19
+ dateScopeList: {
20
+ key: dateTypeEnum;
21
+ value: moment.Moment[];
22
+ }[];
23
+ dateScopeMap: {
24
+ 1: moment.Moment[];
25
+ 2: moment.Moment[];
26
+ 3: moment.Moment[];
27
+ 4: moment.Moment[];
28
+ 5: moment.Moment[];
29
+ 6: moment.Moment[];
30
+ 7: moment.Moment[];
31
+ 8: moment.Moment[];
32
+ 9: moment.Moment[];
33
+ 10: moment.Moment[];
34
+ 11: moment.Moment[];
35
+ 12: moment.Moment[];
36
+ 13: moment.Moment[];
37
+ 14: moment.Moment[];
38
+ };
39
+ };
@@ -0,0 +1,73 @@
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
+ export var useDateScope = function useDateScope() {
23
+ var _a;
24
+
25
+ var dateScopeList = [{
26
+ key: dateTypeEnum.TODAY,
27
+ value: [now, now]
28
+ }, {
29
+ key: dateTypeEnum.YESTERDAY,
30
+ value: [now.clone().subtract(1, 'day'), now.clone().subtract(1, 'day').endOf('day')]
31
+ }, {
32
+ key: dateTypeEnum.WEEK,
33
+ value: [now.clone().startOf('week'), now.clone().endOf('week')]
34
+ }, {
35
+ key: dateTypeEnum.LAST_WEEK,
36
+ value: [now.clone().subtract(1, 'week').startOf('week'), now.clone().subtract(1, 'week').endOf('week')]
37
+ }, {
38
+ key: dateTypeEnum.MONTH,
39
+ value: [now.clone().startOf('month'), now.clone().endOf('month')]
40
+ }, {
41
+ key: dateTypeEnum.LAST_MONTH,
42
+ value: [now.clone().subtract(1, 'month').startOf('month'), now.clone().subtract(1, 'month').endOf('month')]
43
+ }, {
44
+ key: dateTypeEnum.QUARTER,
45
+ value: [now.clone().startOf('quarter'), now.clone().endOf('quarter')]
46
+ }, {
47
+ key: dateTypeEnum.LAST_QUARTER,
48
+ value: [now.clone().subtract(1, 'quarter').startOf('quarter'), now.clone().subtract(1, 'quarter').endOf('quarter')]
49
+ }, {
50
+ key: dateTypeEnum.BEFORE_7_DAY,
51
+ value: [now.clone().subtract(6, 'day').startOf('day'), now.endOf('day')]
52
+ }, {
53
+ key: dateTypeEnum.BEFORE_14_DAY,
54
+ value: [now.clone().subtract(13, 'day').startOf('day'), now.endOf('day')]
55
+ }, {
56
+ key: dateTypeEnum.BEFORE_30_DAY,
57
+ value: [now.clone().subtract(29, 'day').startOf('day'), now.endOf('day')]
58
+ }, {
59
+ key: dateTypeEnum.BEFORE_90_DAY,
60
+ value: [now.clone().subtract(89, 'day').startOf('day'), now.endOf('day')]
61
+ }, {
62
+ key: dateTypeEnum.BEFORE_180_DAY,
63
+ value: [now.clone().subtract(179, 'day').startOf('day'), now.endOf('day')]
64
+ }, {
65
+ key: dateTypeEnum.BEFORE_365_DAY,
66
+ value: [now.clone().subtract(364, 'day').startOf('day'), now.endOf('day')]
67
+ }];
68
+ 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);
69
+ return {
70
+ dateScopeList: dateScopeList,
71
+ dateScopeMap: dateScopeMap
72
+ };
73
+ };
@@ -0,0 +1,10 @@
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;
@@ -0,0 +1,49 @@
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;
@@ -0,0 +1,10 @@
1
+ import { dateTypeEnum } from './getDateScope';
2
+ import type { LabelRangePickerProps } from '../label-range-picker';
3
+ export interface LabelCustomizeRangePickerProps extends LabelRangePickerProps {
4
+ customizeTimeList?: dateTypeEnum[];
5
+ }
6
+ declare const LabelCustomizeRangePicker: {
7
+ (props: LabelCustomizeRangePickerProps): JSX.Element;
8
+ dateTypeEnum: typeof dateTypeEnum;
9
+ };
10
+ export default LabelCustomizeRangePicker;
@@ -0,0 +1,162 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+
6
+ for (var p in s) {
7
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
8
+ }
9
+ }
10
+
11
+ return t;
12
+ };
13
+
14
+ return __assign.apply(this, arguments);
15
+ };
16
+
17
+ var __rest = this && this.__rest || function (s, e) {
18
+ var t = {};
19
+
20
+ for (var p in s) {
21
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
22
+ }
23
+
24
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
25
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
26
+ }
27
+ return t;
28
+ };
29
+
30
+ var __read = this && this.__read || function (o, n) {
31
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
32
+ if (!m) return o;
33
+ var i = m.call(o),
34
+ r,
35
+ ar = [],
36
+ e;
37
+
38
+ try {
39
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
40
+ ar.push(r.value);
41
+ }
42
+ } catch (error) {
43
+ e = {
44
+ error: error
45
+ };
46
+ } finally {
47
+ try {
48
+ if (r && !r.done && (m = i["return"])) m.call(i);
49
+ } finally {
50
+ if (e) throw e.error;
51
+ }
52
+ }
53
+
54
+ return ar;
55
+ };
56
+
57
+ import React, { useState, useEffect } from 'react';
58
+ import Radio from 'antd/es/radio';
59
+ import Checkbox from 'antd/es/checkbox';
60
+ import useControllableValue from 'ahooks/lib/useControllableValue';
61
+ import getRadioList from './getRadioList';
62
+ import LabelRangePicker from '../label-range-picker';
63
+ import { useDateScope, dateTypeEnum } from './getDateScope';
64
+
65
+ var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
66
+ var customizeTimeList = props.customizeTimeList,
67
+ options = __rest(props, ["customizeTimeList"]);
68
+
69
+ var _a = __read(useControllableValue(props), 2),
70
+ date = _a[0],
71
+ setDate = _a[1];
72
+
73
+ var _b = __read(useState(false), 2),
74
+ isVisiblePanel = _b[0],
75
+ setIsVisiblePanel = _b[1];
76
+
77
+ var _c = __read(useState(), 2),
78
+ radioKey = _c[0],
79
+ setRadioKey = _c[1];
80
+
81
+ var _d = useDateScope(),
82
+ dateScopeMap = _d.dateScopeMap,
83
+ dateScopeList = _d.dateScopeList;
84
+
85
+ useEffect(function () {
86
+ var foundItem = dateScopeList.find(function (item) {
87
+ if (!date) return false;
88
+
89
+ var _a = __read(item.value, 2),
90
+ startTime = _a[0],
91
+ endTime = _a[1];
92
+
93
+ var _b = __read(date || [], 2),
94
+ defaultStartTime = _b[0],
95
+ defaultEndTime = _b[1];
96
+
97
+ if (startTime.isSame(defaultStartTime, 'day') && endTime.isSame(defaultEndTime, 'day')) {
98
+ return true;
99
+ }
100
+
101
+ return false;
102
+ });
103
+ var data = foundItem ? foundItem.key : null;
104
+ setRadioKey(data);
105
+ }, [date]);
106
+
107
+ var onDiyTimeChange = function onDiyTimeChange(event) {
108
+ var checked = event.target.checked;
109
+ setIsVisiblePanel(checked);
110
+ };
111
+
112
+ var onDateChange = function onDateChange(nextValue) {
113
+ setDate(nextValue);
114
+ };
115
+
116
+ var onRadioChange = function onRadioChange(event) {
117
+ var value = event.target.value;
118
+ setRadioKey(value);
119
+ setDate(dateScopeMap[value]);
120
+ };
121
+
122
+ var list = getRadioList().filter(function (item) {
123
+ return customizeTimeList === null || customizeTimeList === void 0 ? void 0 : customizeTimeList.includes(item.key);
124
+ });
125
+ var finallyRadioList = list.length ? list : getRadioList();
126
+
127
+ var panelRender = function panelRender(panel) {
128
+ return /*#__PURE__*/React.createElement("div", {
129
+ className: "wrapper"
130
+ }, /*#__PURE__*/React.createElement("div", {
131
+ className: "check-wrapper"
132
+ }, /*#__PURE__*/React.createElement("span", {
133
+ className: "customize-select"
134
+ }, /*#__PURE__*/React.createElement(Checkbox, {
135
+ onChange: onDiyTimeChange
136
+ }), /*#__PURE__*/React.createElement("span", null, "\u81EA\u5B9A\u4E49\u65F6\u95F4"))), isVisiblePanel ? /*#__PURE__*/React.createElement("div", {
137
+ className: "panel"
138
+ }, panel) : /*#__PURE__*/React.createElement("div", {
139
+ className: "pick-box"
140
+ }, /*#__PURE__*/React.createElement(Radio.Group, {
141
+ onChange: onRadioChange,
142
+ value: radioKey
143
+ }, finallyRadioList.map(function (_a) {
144
+ var key = _a.key,
145
+ text = _a.text;
146
+ return /*#__PURE__*/React.createElement(Radio, {
147
+ className: "radio",
148
+ key: key,
149
+ value: key
150
+ }, text);
151
+ }))));
152
+ };
153
+
154
+ return /*#__PURE__*/React.createElement(LabelRangePicker, __assign({
155
+ value: date,
156
+ onChange: onDateChange,
157
+ panelRender: panelRender
158
+ }, options));
159
+ };
160
+
161
+ LabelCustomizeRangePicker.dateTypeEnum = dateTypeEnum;
162
+ export default LabelCustomizeRangePicker;
@@ -0,0 +1,34 @@
1
+ /* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */
2
+ /* stylelint-disable no-duplicate-selectors */
3
+ /* stylelint-disable */
4
+ /* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */
5
+ .wrapper {
6
+ overflow-x: auto;
7
+ }
8
+ .wrapper .check-wrapper {
9
+ padding: 8px 11px 6px;
10
+ border-bottom: 1px solid #f5f6fa;
11
+ }
12
+ .wrapper .pick-box {
13
+ display: flex;
14
+ justify-content: space-between;
15
+ width: 265px;
16
+ padding: 8px 11px 11px;
17
+ }
18
+ .wrapper .pick-box .radio {
19
+ display: inline-block;
20
+ width: 50%;
21
+ margin-right: 0;
22
+ }
23
+ .wrapper .pick-box .ant-radio-group {
24
+ width: 100%;
25
+ }
26
+ .wrapper .customize-select {
27
+ vertical-align: middle;
28
+ }
29
+ @media screen and (max-width: 576px) {
30
+ .wrapper .panel {
31
+ max-width: 280px;
32
+ overflow-x: scroll;
33
+ }
34
+ }
@@ -0,0 +1,4 @@
1
+ import 'antd/es/date-picker/style';
2
+ import 'antd/es/checkbox/style';
3
+ import './index.less';
4
+ import '../../label-range-picker/style/index';
@@ -0,0 +1,4 @@
1
+ import 'antd/es/date-picker/style';
2
+ import 'antd/es/checkbox/style';
3
+ import './index.less';
4
+ import '../../label-range-picker/style/index';
@@ -0,0 +1,40 @@
1
+ @import '~antd/es/style/themes/index';
2
+
3
+ .wrapper {
4
+ overflow-x: auto;
5
+
6
+ .check-wrapper {
7
+ padding: 8px 11px 6px;
8
+ border-bottom: 1px solid #f5f6fa;
9
+ }
10
+
11
+ .pick-box {
12
+ display: flex;
13
+ justify-content: space-between;
14
+ width: 265px;
15
+ padding: 8px 11px 11px;
16
+
17
+ .radio {
18
+ display: inline-block;
19
+ width: 50%;
20
+ margin-right: 0;
21
+ }
22
+
23
+ .@{ant-prefix}-radio-group {
24
+ width: 100%;
25
+ }
26
+ }
27
+
28
+ .customize-select {
29
+ vertical-align: middle;
30
+ }
31
+ }
32
+
33
+ @media screen and (max-width: 576px) {
34
+ .wrapper {
35
+ .panel {
36
+ max-width: 280px;
37
+ overflow-x: scroll;
38
+ }
39
+ }
40
+ }
@@ -14,6 +14,10 @@ export interface LabelInputProps extends Omit<React.InputHTMLAttributes<HTMLInpu
14
14
  onChange?: (value: string) => void;
15
15
  /** 输入框失去焦点的回调 */
16
16
  onBlur?: (value: string) => void;
17
+ /** 规定 input 元素的类型 */
18
+ type?: 'text' | 'password';
19
+ /** 规定输入字段中的字符的最大长度 */
20
+ maxLength?: number;
17
21
  /** 输入框获取焦点的回调 */
18
22
  onFocus?: (value: string) => void;
19
23
  /** 组件dom id */
@@ -29,6 +29,8 @@ import React from 'react';
29
29
  import classNames from 'classnames';
30
30
  import { useControllableValue } from 'ahooks';
31
31
  import { trimStart } from 'lodash';
32
+ import EyeFilled from 'a-icons/lib/EyeFilled';
33
+ import EyeOutlined from 'a-icons/lib/EyeOutlined';
32
34
 
33
35
  var LabelInput = function LabelInput(props) {
34
36
  var className = props.className,
@@ -37,19 +39,27 @@ var LabelInput = function LabelInput(props) {
37
39
  label = props.label,
38
40
  id = props.id,
39
41
  onFocus = props.onFocus,
40
- onBlur = props.onBlur;
42
+ onBlur = props.onBlur,
43
+ _a = props.type,
44
+ type = _a === void 0 ? 'text' : _a,
45
+ maxLength = props.maxLength;
41
46
 
42
- var _a = __read(React.useState(false), 2),
43
- focused = _a[0],
44
- setFocused = _a[1];
47
+ var _b = __read(React.useState(false), 2),
48
+ focused = _b[0],
49
+ setFocused = _b[1];
45
50
 
46
- var _b = __read(useControllableValue(props, {
51
+ var _c = __read(useControllableValue(props, {
47
52
  defaultValue: ''
48
53
  }), 2),
49
- value = _b[0],
50
- setValue = _b[1];
54
+ value = _c[0],
55
+ setValue = _c[1];
56
+
57
+ var _d = __read(React.useState(type), 2),
58
+ inputType = _d[0],
59
+ setInputType = _d[1];
51
60
 
52
61
  var InputDomRef = React.useRef(null);
62
+ var isPasswordInput = type === 'password';
53
63
 
54
64
  var handleFocus = function handleFocus() {
55
65
  setFocused(true);
@@ -72,12 +82,21 @@ var LabelInput = function LabelInput(props) {
72
82
  (_a = InputDomRef.current) === null || _a === void 0 ? void 0 : _a.focus();
73
83
  };
74
84
 
85
+ var passwordSuffix = inputType === 'password' ? /*#__PURE__*/React.createElement(EyeOutlined, {
86
+ onClick: function onClick() {
87
+ setInputType('text');
88
+ }
89
+ }) : /*#__PURE__*/React.createElement(EyeFilled, {
90
+ onClick: function onClick() {
91
+ return setInputType('password');
92
+ }
93
+ });
75
94
  return /*#__PURE__*/React.createElement("div", {
76
95
  className: classNames('label-input-control', className),
77
96
  id: id
78
97
  }, /*#__PURE__*/React.createElement("div", {
79
98
  className: classNames('label-input-field', {
80
- 'label-input-affix': prefix || suffix,
99
+ 'label-input-affix': prefix || suffix || isPasswordInput,
81
100
  'label-input-focused': focused
82
101
  })
83
102
  }, prefix && /*#__PURE__*/React.createElement("div", {
@@ -90,17 +109,18 @@ var LabelInput = function LabelInput(props) {
90
109
  },
91
110
  "data-value": value ? value.length : 0,
92
111
  className: "label-input",
93
- type: "text",
112
+ type: inputType,
94
113
  value: value || '',
95
114
  onFocus: handleFocus,
96
115
  onBlur: handleBlur,
97
- onChange: handleChange
116
+ onChange: handleChange,
117
+ maxLength: maxLength
98
118
  }), /*#__PURE__*/React.createElement("label", {
99
119
  className: "label-input-text",
100
120
  onClick: handleLabelClick
101
- }, label)), suffix && /*#__PURE__*/React.createElement("div", {
121
+ }, label)), (suffix || isPasswordInput) && /*#__PURE__*/React.createElement("div", {
102
122
  className: "label-input-suffix"
103
- }, suffix)));
123
+ }, suffix || passwordSuffix)));
104
124
  };
105
125
 
106
126
  export default LabelInput;
@@ -0,0 +1,39 @@
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
+ }
18
+ export declare const useDateScope: () => {
19
+ dateScopeList: {
20
+ key: dateTypeEnum;
21
+ value: moment.Moment[];
22
+ }[];
23
+ dateScopeMap: {
24
+ 1: moment.Moment[];
25
+ 2: moment.Moment[];
26
+ 3: moment.Moment[];
27
+ 4: moment.Moment[];
28
+ 5: moment.Moment[];
29
+ 6: moment.Moment[];
30
+ 7: moment.Moment[];
31
+ 8: moment.Moment[];
32
+ 9: moment.Moment[];
33
+ 10: moment.Moment[];
34
+ 11: moment.Moment[];
35
+ 12: moment.Moment[];
36
+ 13: moment.Moment[];
37
+ 14: moment.Moment[];
38
+ };
39
+ };
@@ -0,0 +1,87 @@
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 = exports.dateTypeEnum || (exports.dateTypeEnum = {}));
35
+
36
+ exports.useDateScope = function () {
37
+ var _a;
38
+
39
+ var dateScopeList = [{
40
+ key: dateTypeEnum.TODAY,
41
+ value: [now, now]
42
+ }, {
43
+ key: dateTypeEnum.YESTERDAY,
44
+ value: [now.clone().subtract(1, 'day'), now.clone().subtract(1, 'day').endOf('day')]
45
+ }, {
46
+ key: dateTypeEnum.WEEK,
47
+ value: [now.clone().startOf('week'), now.clone().endOf('week')]
48
+ }, {
49
+ key: dateTypeEnum.LAST_WEEK,
50
+ value: [now.clone().subtract(1, 'week').startOf('week'), now.clone().subtract(1, 'week').endOf('week')]
51
+ }, {
52
+ key: dateTypeEnum.MONTH,
53
+ value: [now.clone().startOf('month'), now.clone().endOf('month')]
54
+ }, {
55
+ key: dateTypeEnum.LAST_MONTH,
56
+ value: [now.clone().subtract(1, 'month').startOf('month'), now.clone().subtract(1, 'month').endOf('month')]
57
+ }, {
58
+ key: dateTypeEnum.QUARTER,
59
+ value: [now.clone().startOf('quarter'), now.clone().endOf('quarter')]
60
+ }, {
61
+ key: dateTypeEnum.LAST_QUARTER,
62
+ value: [now.clone().subtract(1, 'quarter').startOf('quarter'), now.clone().subtract(1, 'quarter').endOf('quarter')]
63
+ }, {
64
+ key: dateTypeEnum.BEFORE_7_DAY,
65
+ value: [now.clone().subtract(6, 'day').startOf('day'), now.endOf('day')]
66
+ }, {
67
+ key: dateTypeEnum.BEFORE_14_DAY,
68
+ value: [now.clone().subtract(13, 'day').startOf('day'), now.endOf('day')]
69
+ }, {
70
+ key: dateTypeEnum.BEFORE_30_DAY,
71
+ value: [now.clone().subtract(29, 'day').startOf('day'), now.endOf('day')]
72
+ }, {
73
+ key: dateTypeEnum.BEFORE_90_DAY,
74
+ value: [now.clone().subtract(89, 'day').startOf('day'), now.endOf('day')]
75
+ }, {
76
+ key: dateTypeEnum.BEFORE_180_DAY,
77
+ value: [now.clone().subtract(179, 'day').startOf('day'), now.endOf('day')]
78
+ }, {
79
+ key: dateTypeEnum.BEFORE_365_DAY,
80
+ value: [now.clone().subtract(364, 'day').startOf('day'), now.endOf('day')]
81
+ }];
82
+ 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);
83
+ return {
84
+ dateScopeList: dateScopeList,
85
+ dateScopeMap: dateScopeMap
86
+ };
87
+ };
@@ -0,0 +1,10 @@
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;
@@ -0,0 +1,55 @@
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;
@@ -0,0 +1,10 @@
1
+ import { dateTypeEnum } from './getDateScope';
2
+ import type { LabelRangePickerProps } from '../label-range-picker';
3
+ export interface LabelCustomizeRangePickerProps extends LabelRangePickerProps {
4
+ customizeTimeList?: dateTypeEnum[];
5
+ }
6
+ declare const LabelCustomizeRangePicker: {
7
+ (props: LabelCustomizeRangePickerProps): JSX.Element;
8
+ dateTypeEnum: typeof dateTypeEnum;
9
+ };
10
+ export default LabelCustomizeRangePicker;
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+
3
+ var __assign = this && this.__assign || function () {
4
+ __assign = Object.assign || function (t) {
5
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6
+ s = arguments[i];
7
+
8
+ for (var p in s) {
9
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
10
+ }
11
+ }
12
+
13
+ return t;
14
+ };
15
+
16
+ return __assign.apply(this, arguments);
17
+ };
18
+
19
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
20
+ if (k2 === undefined) k2 = k;
21
+ Object.defineProperty(o, k2, {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return m[k];
25
+ }
26
+ });
27
+ } : function (o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ });
31
+
32
+ var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
33
+ Object.defineProperty(o, "default", {
34
+ enumerable: true,
35
+ value: v
36
+ });
37
+ } : function (o, v) {
38
+ o["default"] = v;
39
+ });
40
+
41
+ var __importStar = this && this.__importStar || function (mod) {
42
+ if (mod && mod.__esModule) return mod;
43
+ var result = {};
44
+ if (mod != null) for (var k in mod) {
45
+ if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
46
+ }
47
+
48
+ __setModuleDefault(result, mod);
49
+
50
+ return result;
51
+ };
52
+
53
+ var __rest = this && this.__rest || function (s, e) {
54
+ var t = {};
55
+
56
+ for (var p in s) {
57
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
58
+ }
59
+
60
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
61
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
62
+ }
63
+ return t;
64
+ };
65
+
66
+ var __read = this && this.__read || function (o, n) {
67
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
68
+ if (!m) return o;
69
+ var i = m.call(o),
70
+ r,
71
+ ar = [],
72
+ e;
73
+
74
+ try {
75
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
76
+ ar.push(r.value);
77
+ }
78
+ } catch (error) {
79
+ e = {
80
+ error: error
81
+ };
82
+ } finally {
83
+ try {
84
+ if (r && !r.done && (m = i["return"])) m.call(i);
85
+ } finally {
86
+ if (e) throw e.error;
87
+ }
88
+ }
89
+
90
+ return ar;
91
+ };
92
+
93
+ var __importDefault = this && this.__importDefault || function (mod) {
94
+ return mod && mod.__esModule ? mod : {
95
+ "default": mod
96
+ };
97
+ };
98
+
99
+ Object.defineProperty(exports, "__esModule", {
100
+ value: true
101
+ });
102
+
103
+ var react_1 = __importStar(require("react"));
104
+
105
+ var radio_1 = __importDefault(require("antd/es/radio"));
106
+
107
+ var checkbox_1 = __importDefault(require("antd/es/checkbox"));
108
+
109
+ var useControllableValue_1 = __importDefault(require("ahooks/lib/useControllableValue"));
110
+
111
+ var getRadioList_1 = __importDefault(require("./getRadioList"));
112
+
113
+ var label_range_picker_1 = __importDefault(require("../label-range-picker"));
114
+
115
+ var getDateScope_1 = require("./getDateScope");
116
+
117
+ var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
118
+ var customizeTimeList = props.customizeTimeList,
119
+ options = __rest(props, ["customizeTimeList"]);
120
+
121
+ var _a = __read(useControllableValue_1["default"](props), 2),
122
+ date = _a[0],
123
+ setDate = _a[1];
124
+
125
+ var _b = __read(react_1.useState(false), 2),
126
+ isVisiblePanel = _b[0],
127
+ setIsVisiblePanel = _b[1];
128
+
129
+ var _c = __read(react_1.useState(), 2),
130
+ radioKey = _c[0],
131
+ setRadioKey = _c[1];
132
+
133
+ var _d = getDateScope_1.useDateScope(),
134
+ dateScopeMap = _d.dateScopeMap,
135
+ dateScopeList = _d.dateScopeList;
136
+
137
+ react_1.useEffect(function () {
138
+ var foundItem = dateScopeList.find(function (item) {
139
+ if (!date) return false;
140
+
141
+ var _a = __read(item.value, 2),
142
+ startTime = _a[0],
143
+ endTime = _a[1];
144
+
145
+ var _b = __read(date || [], 2),
146
+ defaultStartTime = _b[0],
147
+ defaultEndTime = _b[1];
148
+
149
+ if (startTime.isSame(defaultStartTime, 'day') && endTime.isSame(defaultEndTime, 'day')) {
150
+ return true;
151
+ }
152
+
153
+ return false;
154
+ });
155
+ var data = foundItem ? foundItem.key : null;
156
+ setRadioKey(data);
157
+ }, [date]);
158
+
159
+ var onDiyTimeChange = function onDiyTimeChange(event) {
160
+ var checked = event.target.checked;
161
+ setIsVisiblePanel(checked);
162
+ };
163
+
164
+ var onDateChange = function onDateChange(nextValue) {
165
+ setDate(nextValue);
166
+ };
167
+
168
+ var onRadioChange = function onRadioChange(event) {
169
+ var value = event.target.value;
170
+ setRadioKey(value);
171
+ setDate(dateScopeMap[value]);
172
+ };
173
+
174
+ var list = getRadioList_1["default"]().filter(function (item) {
175
+ return customizeTimeList === null || customizeTimeList === void 0 ? void 0 : customizeTimeList.includes(item.key);
176
+ });
177
+ var finallyRadioList = list.length ? list : getRadioList_1["default"]();
178
+
179
+ var panelRender = function panelRender(panel) {
180
+ return react_1["default"].createElement("div", {
181
+ className: "wrapper"
182
+ }, react_1["default"].createElement("div", {
183
+ className: "check-wrapper"
184
+ }, react_1["default"].createElement("span", {
185
+ className: "customize-select"
186
+ }, react_1["default"].createElement(checkbox_1["default"], {
187
+ onChange: onDiyTimeChange
188
+ }), react_1["default"].createElement("span", null, "\u81EA\u5B9A\u4E49\u65F6\u95F4"))), isVisiblePanel ? react_1["default"].createElement("div", {
189
+ className: "panel"
190
+ }, panel) : react_1["default"].createElement("div", {
191
+ className: "pick-box"
192
+ }, react_1["default"].createElement(radio_1["default"].Group, {
193
+ onChange: onRadioChange,
194
+ value: radioKey
195
+ }, finallyRadioList.map(function (_a) {
196
+ var key = _a.key,
197
+ text = _a.text;
198
+ return react_1["default"].createElement(radio_1["default"], {
199
+ className: "radio",
200
+ key: key,
201
+ value: key
202
+ }, text);
203
+ }))));
204
+ };
205
+
206
+ return react_1["default"].createElement(label_range_picker_1["default"], __assign({
207
+ value: date,
208
+ onChange: onDateChange,
209
+ panelRender: panelRender
210
+ }, options));
211
+ };
212
+
213
+ LabelCustomizeRangePicker.dateTypeEnum = getDateScope_1.dateTypeEnum;
214
+ exports["default"] = LabelCustomizeRangePicker;
@@ -0,0 +1,34 @@
1
+ /* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */
2
+ /* stylelint-disable no-duplicate-selectors */
3
+ /* stylelint-disable */
4
+ /* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */
5
+ .wrapper {
6
+ overflow-x: auto;
7
+ }
8
+ .wrapper .check-wrapper {
9
+ padding: 8px 11px 6px;
10
+ border-bottom: 1px solid #f5f6fa;
11
+ }
12
+ .wrapper .pick-box {
13
+ display: flex;
14
+ justify-content: space-between;
15
+ width: 265px;
16
+ padding: 8px 11px 11px;
17
+ }
18
+ .wrapper .pick-box .radio {
19
+ display: inline-block;
20
+ width: 50%;
21
+ margin-right: 0;
22
+ }
23
+ .wrapper .pick-box .ant-radio-group {
24
+ width: 100%;
25
+ }
26
+ .wrapper .customize-select {
27
+ vertical-align: middle;
28
+ }
29
+ @media screen and (max-width: 576px) {
30
+ .wrapper .panel {
31
+ max-width: 280px;
32
+ overflow-x: scroll;
33
+ }
34
+ }
@@ -0,0 +1,4 @@
1
+ import 'antd/es/date-picker/style';
2
+ import 'antd/es/checkbox/style';
3
+ import './index.less';
4
+ import '../../label-range-picker/style/index';
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ require("antd/es/date-picker/style");
8
+
9
+ require("antd/es/checkbox/style");
10
+
11
+ require("./index.less");
12
+
13
+ require("../../label-range-picker/style/index");
@@ -0,0 +1,40 @@
1
+ @import '~antd/es/style/themes/index';
2
+
3
+ .wrapper {
4
+ overflow-x: auto;
5
+
6
+ .check-wrapper {
7
+ padding: 8px 11px 6px;
8
+ border-bottom: 1px solid #f5f6fa;
9
+ }
10
+
11
+ .pick-box {
12
+ display: flex;
13
+ justify-content: space-between;
14
+ width: 265px;
15
+ padding: 8px 11px 11px;
16
+
17
+ .radio {
18
+ display: inline-block;
19
+ width: 50%;
20
+ margin-right: 0;
21
+ }
22
+
23
+ .@{ant-prefix}-radio-group {
24
+ width: 100%;
25
+ }
26
+ }
27
+
28
+ .customize-select {
29
+ vertical-align: middle;
30
+ }
31
+ }
32
+
33
+ @media screen and (max-width: 576px) {
34
+ .wrapper {
35
+ .panel {
36
+ max-width: 280px;
37
+ overflow-x: scroll;
38
+ }
39
+ }
40
+ }
@@ -14,6 +14,10 @@ export interface LabelInputProps extends Omit<React.InputHTMLAttributes<HTMLInpu
14
14
  onChange?: (value: string) => void;
15
15
  /** 输入框失去焦点的回调 */
16
16
  onBlur?: (value: string) => void;
17
+ /** 规定 input 元素的类型 */
18
+ type?: 'text' | 'password';
19
+ /** 规定输入字段中的字符的最大长度 */
20
+ maxLength?: number;
17
21
  /** 输入框获取焦点的回调 */
18
22
  onFocus?: (value: string) => void;
19
23
  /** 组件dom id */
@@ -45,6 +45,10 @@ var ahooks_1 = require("ahooks");
45
45
 
46
46
  var lodash_1 = require("lodash");
47
47
 
48
+ var EyeFilled_1 = __importDefault(require("a-icons/lib/EyeFilled"));
49
+
50
+ var EyeOutlined_1 = __importDefault(require("a-icons/lib/EyeOutlined"));
51
+
48
52
  var LabelInput = function LabelInput(props) {
49
53
  var className = props.className,
50
54
  prefix = props.prefix,
@@ -52,19 +56,27 @@ var LabelInput = function LabelInput(props) {
52
56
  label = props.label,
53
57
  id = props.id,
54
58
  onFocus = props.onFocus,
55
- onBlur = props.onBlur;
59
+ onBlur = props.onBlur,
60
+ _a = props.type,
61
+ type = _a === void 0 ? 'text' : _a,
62
+ maxLength = props.maxLength;
56
63
 
57
- var _a = __read(react_1["default"].useState(false), 2),
58
- focused = _a[0],
59
- setFocused = _a[1];
64
+ var _b = __read(react_1["default"].useState(false), 2),
65
+ focused = _b[0],
66
+ setFocused = _b[1];
60
67
 
61
- var _b = __read(ahooks_1.useControllableValue(props, {
68
+ var _c = __read(ahooks_1.useControllableValue(props, {
62
69
  defaultValue: ''
63
70
  }), 2),
64
- value = _b[0],
65
- setValue = _b[1];
71
+ value = _c[0],
72
+ setValue = _c[1];
73
+
74
+ var _d = __read(react_1["default"].useState(type), 2),
75
+ inputType = _d[0],
76
+ setInputType = _d[1];
66
77
 
67
78
  var InputDomRef = react_1["default"].useRef(null);
79
+ var isPasswordInput = type === 'password';
68
80
 
69
81
  var handleFocus = function handleFocus() {
70
82
  setFocused(true);
@@ -87,12 +99,21 @@ var LabelInput = function LabelInput(props) {
87
99
  (_a = InputDomRef.current) === null || _a === void 0 ? void 0 : _a.focus();
88
100
  };
89
101
 
102
+ var passwordSuffix = inputType === 'password' ? react_1["default"].createElement(EyeOutlined_1["default"], {
103
+ onClick: function onClick() {
104
+ setInputType('text');
105
+ }
106
+ }) : react_1["default"].createElement(EyeFilled_1["default"], {
107
+ onClick: function onClick() {
108
+ return setInputType('password');
109
+ }
110
+ });
90
111
  return react_1["default"].createElement("div", {
91
112
  className: classnames_1["default"]('label-input-control', className),
92
113
  id: id
93
114
  }, react_1["default"].createElement("div", {
94
115
  className: classnames_1["default"]('label-input-field', {
95
- 'label-input-affix': prefix || suffix,
116
+ 'label-input-affix': prefix || suffix || isPasswordInput,
96
117
  'label-input-focused': focused
97
118
  })
98
119
  }, prefix && react_1["default"].createElement("div", {
@@ -105,17 +126,18 @@ var LabelInput = function LabelInput(props) {
105
126
  },
106
127
  "data-value": value ? value.length : 0,
107
128
  className: "label-input",
108
- type: "text",
129
+ type: inputType,
109
130
  value: value || '',
110
131
  onFocus: handleFocus,
111
132
  onBlur: handleBlur,
112
- onChange: handleChange
133
+ onChange: handleChange,
134
+ maxLength: maxLength
113
135
  }), react_1["default"].createElement("label", {
114
136
  className: "label-input-text",
115
137
  onClick: handleLabelClick
116
- }, label)), suffix && react_1["default"].createElement("div", {
138
+ }, label)), (suffix || isPasswordInput) && react_1["default"].createElement("div", {
117
139
  className: "label-input-suffix"
118
- }, suffix)));
140
+ }, suffix || passwordSuffix)));
119
141
  };
120
142
 
121
143
  exports["default"] = LabelInput;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assui",
3
- "version": "2.0.96",
3
+ "version": "2.0.97",
4
4
  "description": "react ui library",
5
5
  "author": "jason <usochen@gmail.com>",
6
6
  "main": "./lib/index.js",
@@ -33,7 +33,7 @@
33
33
  "@ahooksjs/use-url-state": "^2.5.8",
34
34
  "@tinymce/tinymce-react": "^3.13.0",
35
35
  "@types/react-beautiful-dnd": "^13.1.2",
36
- "a-icons": "^1.0.49",
36
+ "a-icons": "^1.0.50",
37
37
  "ahooks": "^3.0.8",
38
38
  "bignumber.js": "^9.0.1",
39
39
  "copy-to-clipboard": "^3.3.1",
@@ -69,5 +69,5 @@
69
69
  "node": ">=10.0.0"
70
70
  },
71
71
  "license": "MIT",
72
- "gitHead": "71e712d21e6851a8e1aecdec663d95c1546cedca"
72
+ "gitHead": "b4f5c717bd3010c951c09332fa56099483a6b852"
73
73
  }