@zgfe/business-lib 1.2.10 → 1.2.11-data.1
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.
- package/es/assets/styles/resetAntd.less +5 -3
- package/es/cycleTime/demo/hour.d.ts +3 -0
- package/es/cycleTime/demo/hour.js +38 -0
- package/es/cycleTime/index.d.ts +5 -0
- package/es/cycleTime/index.js +26 -14
- package/es/cycleTime/month.js +5 -2
- package/es/cycleTime/styles/index.less +2 -2
- package/es/cycleTime/styles/month.less +11 -0
- package/es/select/styles/handle.less +4 -0
- package/package.json +2 -2
|
@@ -194,9 +194,11 @@
|
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
&:
|
|
198
|
-
|
|
199
|
-
|
|
197
|
+
&:not(.ant-picker-disabled, .ant-picker-status-error) {
|
|
198
|
+
&:hover,
|
|
199
|
+
&.ant-picker-focused {
|
|
200
|
+
border-color: @primary-color!important;
|
|
201
|
+
}
|
|
200
202
|
}
|
|
201
203
|
|
|
202
204
|
.ant-picker-active-bar {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BizCycleTime } from '@zgfe/business-lib';
|
|
3
|
+
import { CycleTimeUnit } from '..';
|
|
4
|
+
export default (function () {
|
|
5
|
+
var options = [{
|
|
6
|
+
label: '每小时',
|
|
7
|
+
value: CycleTimeUnit.hour
|
|
8
|
+
}, {
|
|
9
|
+
label: '每日',
|
|
10
|
+
value: CycleTimeUnit.day
|
|
11
|
+
}, {
|
|
12
|
+
label: '每周',
|
|
13
|
+
value: CycleTimeUnit.week
|
|
14
|
+
}, {
|
|
15
|
+
label: '每月',
|
|
16
|
+
value: CycleTimeUnit.month
|
|
17
|
+
}];
|
|
18
|
+
var onChange = function onChange(data) {
|
|
19
|
+
console.log('change:', data);
|
|
20
|
+
};
|
|
21
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "\u9ED8\u8BA4\u503C")), /*#__PURE__*/React.createElement(BizCycleTime, {
|
|
22
|
+
value: {
|
|
23
|
+
unit: 3,
|
|
24
|
+
day: [1, 23, 4],
|
|
25
|
+
time: '12:00:00'
|
|
26
|
+
},
|
|
27
|
+
multiple: true,
|
|
28
|
+
showHour: true,
|
|
29
|
+
options: options,
|
|
30
|
+
onChange: onChange
|
|
31
|
+
}), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("b", null, "\u65E0\u9ED8\u8BA4\u503C")), /*#__PURE__*/React.createElement(BizCycleTime, {
|
|
32
|
+
multiple: true,
|
|
33
|
+
showHour: true,
|
|
34
|
+
options: options,
|
|
35
|
+
format: "HH",
|
|
36
|
+
onChange: onChange
|
|
37
|
+
}));
|
|
38
|
+
});
|
package/es/cycleTime/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { SizeType } from 'antd/es/config-provider/SizeContext';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { BaseOption } from '../utils/type';
|
|
3
4
|
import './styles/index.less';
|
|
4
5
|
export declare enum CycleTimeUnit {
|
|
6
|
+
hour = 0,
|
|
5
7
|
day = 1,
|
|
6
8
|
week = 2,
|
|
7
9
|
month = 3
|
|
@@ -18,5 +20,8 @@ declare const BizCycleTime: React.FC<{
|
|
|
18
20
|
onChange?: (val: Value) => void;
|
|
19
21
|
size?: SizeType;
|
|
20
22
|
disable?: boolean;
|
|
23
|
+
showHour?: boolean;
|
|
24
|
+
format?: string;
|
|
25
|
+
options?: BaseOption<CycleTimeUnit>[];
|
|
21
26
|
}>;
|
|
22
27
|
export default BizCycleTime;
|
package/es/cycleTime/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import MonthDay from './month';
|
|
|
12
12
|
import './styles/index.less';
|
|
13
13
|
export var CycleTimeUnit;
|
|
14
14
|
(function (CycleTimeUnit) {
|
|
15
|
+
CycleTimeUnit[CycleTimeUnit["hour"] = 0] = "hour";
|
|
15
16
|
CycleTimeUnit[CycleTimeUnit["day"] = 1] = "day";
|
|
16
17
|
CycleTimeUnit[CycleTimeUnit["week"] = 2] = "week";
|
|
17
18
|
CycleTimeUnit[CycleTimeUnit["month"] = 3] = "month";
|
|
@@ -19,9 +20,11 @@ export var CycleTimeUnit;
|
|
|
19
20
|
var BizCycleTime = function BizCycleTime(props) {
|
|
20
21
|
var multiple = props.multiple,
|
|
21
22
|
size = props.size,
|
|
22
|
-
disable = props.disable
|
|
23
|
+
disable = props.disable,
|
|
24
|
+
showHour = props.showHour,
|
|
25
|
+
options = props.options;
|
|
23
26
|
var classPrefix = 'biz-cycle-time';
|
|
24
|
-
var unitList = [{
|
|
27
|
+
var unitList = options || [{
|
|
25
28
|
label: '每日',
|
|
26
29
|
value: CycleTimeUnit.day
|
|
27
30
|
}, {
|
|
@@ -59,6 +62,9 @@ var BizCycleTime = function BizCycleTime(props) {
|
|
|
59
62
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
60
63
|
initing = _useState10[0],
|
|
61
64
|
setIniting = _useState10[1];
|
|
65
|
+
var _useState11 = useState(props.format || 'hh:mm:ss'),
|
|
66
|
+
_useState12 = _slicedToArray(_useState11, 1),
|
|
67
|
+
format = _useState12[0];
|
|
62
68
|
useEffect(function () {
|
|
63
69
|
if (!props.value) {
|
|
64
70
|
setIniting(false);
|
|
@@ -85,6 +91,7 @@ var BizCycleTime = function BizCycleTime(props) {
|
|
|
85
91
|
} else {
|
|
86
92
|
setDay(valList[0]);
|
|
87
93
|
}
|
|
94
|
+
if (showHour) setTime(props.value.time);
|
|
88
95
|
break;
|
|
89
96
|
case CycleTimeUnit.month:
|
|
90
97
|
setDay(props.value.day.map(function (v) {
|
|
@@ -93,6 +100,7 @@ var BizCycleTime = function BizCycleTime(props) {
|
|
|
93
100
|
value: v
|
|
94
101
|
};
|
|
95
102
|
}));
|
|
103
|
+
if (showHour) setTime(props.value.time);
|
|
96
104
|
break;
|
|
97
105
|
}
|
|
98
106
|
}
|
|
@@ -111,9 +119,12 @@ var BizCycleTime = function BizCycleTime(props) {
|
|
|
111
119
|
}) : [day.value],
|
|
112
120
|
time: time
|
|
113
121
|
};
|
|
114
|
-
if (unit.value === CycleTimeUnit.
|
|
122
|
+
if (unit.value === CycleTimeUnit.hour) {
|
|
115
123
|
delete res.day;
|
|
116
|
-
|
|
124
|
+
delete res.time;
|
|
125
|
+
} else if (unit.value === CycleTimeUnit.day) {
|
|
126
|
+
delete res.day;
|
|
127
|
+
} else if (!showHour) {
|
|
117
128
|
delete res.time;
|
|
118
129
|
}
|
|
119
130
|
if (props.onChange) props.onChange(res);
|
|
@@ -138,15 +149,6 @@ var BizCycleTime = function BizCycleTime(props) {
|
|
|
138
149
|
setTime(undefined);
|
|
139
150
|
setUnit(v);
|
|
140
151
|
}
|
|
141
|
-
}), unit.value === CycleTimeUnit.day && /*#__PURE__*/React.createElement(DatePicker.TimePicker, {
|
|
142
|
-
className: "".concat(classPrefix, "-hour"),
|
|
143
|
-
size: size,
|
|
144
|
-
placeholder: props.placeholder,
|
|
145
|
-
defaultValue: time ? moment(time, 'hh:mm:ss') : undefined,
|
|
146
|
-
onChange: function onChange(time) {
|
|
147
|
-
setTime(time === null || time === void 0 ? void 0 : time.format('hh:mm:ss'));
|
|
148
|
-
},
|
|
149
|
-
disabled: disable
|
|
150
152
|
}), unit.value === CycleTimeUnit.week && /*#__PURE__*/React.createElement(BizSelect, {
|
|
151
153
|
options: days,
|
|
152
154
|
labelField: "label",
|
|
@@ -166,7 +168,17 @@ var BizCycleTime = function BizCycleTime(props) {
|
|
|
166
168
|
defaultValue: day,
|
|
167
169
|
onChange: setDayList,
|
|
168
170
|
disable: disable
|
|
169
|
-
})
|
|
171
|
+
}), unit.value === CycleTimeUnit.day || unit.value && showHour ? /*#__PURE__*/React.createElement(DatePicker.TimePicker, {
|
|
172
|
+
className: "".concat(classPrefix, "-hour"),
|
|
173
|
+
size: size,
|
|
174
|
+
placeholder: props.placeholder,
|
|
175
|
+
value: time ? moment(time, format) : undefined,
|
|
176
|
+
format: format,
|
|
177
|
+
onChange: function onChange(time) {
|
|
178
|
+
setTime(time === null || time === void 0 ? void 0 : time.format(format));
|
|
179
|
+
},
|
|
180
|
+
disabled: disable
|
|
181
|
+
}) : null);
|
|
170
182
|
};
|
|
171
183
|
BizCycleTime.defaultProps = {
|
|
172
184
|
multiple: false,
|
package/es/cycleTime/month.js
CHANGED
|
@@ -5,10 +5,11 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5
5
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { Dropdown, Tag } from 'antd';
|
|
8
|
-
import React, { useEffect, useState } from 'react';
|
|
8
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
9
9
|
import { IconFont } from '..';
|
|
10
10
|
import './styles/month.less';
|
|
11
11
|
import _ from 'lodash';
|
|
12
|
+
import { FormItemInputContext } from 'antd/lib/form/context';
|
|
12
13
|
var MonthDay = function MonthDay(props) {
|
|
13
14
|
var classPrefix = 'biz-month-day';
|
|
14
15
|
var disable = props.disable;
|
|
@@ -20,6 +21,8 @@ var MonthDay = function MonthDay(props) {
|
|
|
20
21
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
21
22
|
visible = _useState4[0],
|
|
22
23
|
setVisible = _useState4[1];
|
|
24
|
+
var _useContext = useContext(FormItemInputContext),
|
|
25
|
+
contextStatus = _useContext.status;
|
|
23
26
|
var dayList = [];
|
|
24
27
|
for (var i = 1; i < 33; i++) {
|
|
25
28
|
dayList.push({
|
|
@@ -90,7 +93,7 @@ var MonthDay = function MonthDay(props) {
|
|
|
90
93
|
}, /*#__PURE__*/React.createElement("div", {
|
|
91
94
|
className: "".concat(classPrefix, "-wrapper")
|
|
92
95
|
}, /*#__PURE__*/React.createElement("div", {
|
|
93
|
-
className: "".concat(classPrefix, "-handle ").concat(props.size, " ").concat(!chosenDayList.length ? "holder" : '', " ").concat(disable ? 'disable' : '')
|
|
96
|
+
className: "".concat(classPrefix, "-handle ").concat(props.size, " ").concat(!chosenDayList.length ? "holder" : '', " ").concat(disable ? 'disable' : '', " ").concat(contextStatus ? "".concat(classPrefix, "-status-").concat(contextStatus) : '')
|
|
94
97
|
}, /*#__PURE__*/React.createElement("div", {
|
|
95
98
|
className: "".concat(classPrefix, "-val")
|
|
96
99
|
}, chosenDayList.map(function (item) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
@import '../../assets//styles/inner.less';
|
|
2
2
|
.biz-cycle-time {
|
|
3
|
-
display:
|
|
3
|
+
display: flex;
|
|
4
|
+
gap: 12px;
|
|
4
5
|
&-unit {
|
|
5
6
|
width: 129px;
|
|
6
7
|
}
|
|
@@ -15,7 +16,6 @@
|
|
|
15
16
|
&-day,
|
|
16
17
|
&-hour {
|
|
17
18
|
display: inline-block;
|
|
18
|
-
margin-right: @margin-xs;
|
|
19
19
|
}
|
|
20
20
|
&-hour {
|
|
21
21
|
width: 220px;
|
|
@@ -35,6 +35,13 @@
|
|
|
35
35
|
&-holder {
|
|
36
36
|
color: @input-placeholder-color;
|
|
37
37
|
}
|
|
38
|
+
|
|
39
|
+
&-status-error:not(.disable) {
|
|
40
|
+
border-color: @error-color;
|
|
41
|
+
&.biz-month-day-handle:hover {
|
|
42
|
+
border-color: @error-color;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
38
45
|
&-val {
|
|
39
46
|
flex: 1;
|
|
40
47
|
.ant-tag {
|
|
@@ -46,6 +53,10 @@
|
|
|
46
53
|
vertical-align: top;
|
|
47
54
|
&.ant-dropdown-open > .biz-month-day-handle {
|
|
48
55
|
.__default-focused();
|
|
56
|
+
&.biz-month-day-status-error:not(.disable) {
|
|
57
|
+
border-color: @error-color;
|
|
58
|
+
box-shadow: 0 0 0 4px rgba(#ff8170, 0.2) !important;
|
|
59
|
+
}
|
|
49
60
|
}
|
|
50
61
|
.biz-month-day-handle {
|
|
51
62
|
&.disable {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.11-data.1",
|
|
4
4
|
"module": "es/index.js",
|
|
5
5
|
"typings": "es/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"react": "^16.12.0 || ^17.0.0",
|
|
56
56
|
"yorkie": "^2.0.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "1fa4bb23f2f6ea058858a40192765a1932f24577",
|
|
59
59
|
"gitHooks": {
|
|
60
60
|
"pre-commit": "lint-staged"
|
|
61
61
|
}
|