assui 2.1.29 → 2.1.32
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/button-modal/index.js +2 -8
- package/es/label-auto-complete/index.js +1 -3
- package/es/label-condition-input/index.d.ts +3 -1
- package/es/label-condition-input/index.js +5 -7
- package/es/label-customize-range-picker/index.js +16 -3
- package/es/label-date-picker/index.js +1 -3
- package/es/label-input/index.js +1 -3
- package/es/label-number-input/index.js +4 -6
- package/es/label-select/index.js +2 -4
- package/es/label-text-area/index.js +1 -3
- package/es/messages/zh_CN.js +1 -1
- package/es/number-input/utils.d.ts +3 -3
- package/es/number-input/utils.js +6 -5
- package/es/step-number-input/index.d.ts +1 -1
- package/es/step-number-input/index.js +27 -55
- package/lib/button-modal/index.js +2 -8
- package/lib/label-auto-complete/index.js +1 -3
- package/lib/label-condition-input/index.d.ts +3 -1
- package/lib/label-condition-input/index.js +5 -7
- package/lib/label-customize-range-picker/index.js +16 -3
- package/lib/label-date-picker/index.js +1 -3
- package/lib/label-input/index.js +1 -3
- package/lib/label-number-input/index.js +4 -6
- package/lib/label-select/index.js +2 -4
- package/lib/label-text-area/index.js +1 -3
- package/lib/messages/zh_CN.js +1 -1
- package/lib/number-input/utils.d.ts +3 -3
- package/lib/number-input/utils.js +6 -5
- package/lib/step-number-input/index.d.ts +1 -1
- package/lib/step-number-input/index.js +28 -55
- package/package.json +4 -4
package/es/button-modal/index.js
CHANGED
|
@@ -72,19 +72,13 @@ var ButtonModal = function ButtonModal(props, ref) {
|
|
|
72
72
|
restModalProps = __rest(props, ["children", "trigger", "onOpen", "onClose", "onOk", "onCancel"]);
|
|
73
73
|
|
|
74
74
|
var openModal = function openModal() {
|
|
75
|
-
if (onOpen) {
|
|
76
|
-
onOpen();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
75
|
setModalVisible(true);
|
|
76
|
+
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
80
77
|
};
|
|
81
78
|
|
|
82
79
|
var closeModal = function closeModal() {
|
|
83
|
-
if (onClose) {
|
|
84
|
-
onClose();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
80
|
setModalVisible(false);
|
|
81
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
88
82
|
};
|
|
89
83
|
|
|
90
84
|
var modalActionRef = React.useRef({
|
|
@@ -74,13 +74,11 @@ var LabelAutoComplete = function LabelAutoComplete(props) {
|
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
var handleLabelClick = function handleLabelClick() {
|
|
77
|
-
var _a;
|
|
78
|
-
|
|
79
77
|
if (!open) {
|
|
80
78
|
setOpen(!open);
|
|
81
79
|
}
|
|
82
80
|
|
|
83
|
-
|
|
81
|
+
autoComplete.current.focus();
|
|
84
82
|
};
|
|
85
83
|
|
|
86
84
|
var onDropdownVisibleChange = function onDropdownVisibleChange(nextOpen) {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ConditionInputProps } from '../condition-input';
|
|
3
|
-
export interface LabelConditionInputProps extends ConditionInputProps {
|
|
3
|
+
export interface LabelConditionInputProps extends Omit<ConditionInputProps, 'onBlur' | 'onChange'> {
|
|
4
4
|
/** label 标签的文本 */
|
|
5
5
|
label?: React.ReactNode;
|
|
6
6
|
/** 输入框内容变化时的回调 */
|
|
7
7
|
onChange?: (value: string) => void;
|
|
8
|
+
/** 输入框失去焦点的回调 */
|
|
9
|
+
onBlur?: (value: string) => void;
|
|
8
10
|
/** 输入框除去label之后的最小末尾宽度 */
|
|
9
11
|
baseMinWidth?: number;
|
|
10
12
|
/** 组件dom id */
|
|
@@ -70,10 +70,8 @@ var LabelConditionInput = function LabelConditionInput(props) {
|
|
|
70
70
|
setFocused = _c[1];
|
|
71
71
|
|
|
72
72
|
var handleLabelClick = function handleLabelClick() {
|
|
73
|
-
var _a;
|
|
74
|
-
|
|
75
73
|
setFocused(true);
|
|
76
|
-
|
|
74
|
+
InputDomRef.current.focus();
|
|
77
75
|
};
|
|
78
76
|
|
|
79
77
|
var handleFocus = function handleFocus() {
|
|
@@ -81,9 +79,9 @@ var LabelConditionInput = function LabelConditionInput(props) {
|
|
|
81
79
|
onFocus === null || onFocus === void 0 ? void 0 : onFocus(value);
|
|
82
80
|
};
|
|
83
81
|
|
|
84
|
-
var handleBlur = function handleBlur(
|
|
82
|
+
var handleBlur = function handleBlur() {
|
|
85
83
|
setFocused(false);
|
|
86
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur(
|
|
84
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(value);
|
|
87
85
|
};
|
|
88
86
|
|
|
89
87
|
var controlMinWidth = (labelSize === null || labelSize === void 0 ? void 0 : labelSize.width) ? labelSize.width + baseMinWidth : undefined;
|
|
@@ -95,9 +93,9 @@ var LabelConditionInput = function LabelConditionInput(props) {
|
|
|
95
93
|
}
|
|
96
94
|
}, /*#__PURE__*/React.createElement("div", {
|
|
97
95
|
className: classNames('label-condition-input-field', {
|
|
98
|
-
'label-condition-input-focused': focused
|
|
96
|
+
'label-condition-input-focused': focused
|
|
99
97
|
})
|
|
100
|
-
}, /*#__PURE__*/React.createElement(ConditionInput, __assign({}, omit(props, ['onChange', 'onBlur', 'onFocus', 'className', 'label', 'placeholder']), {
|
|
98
|
+
}, /*#__PURE__*/React.createElement(ConditionInput, __assign({}, omit(props, ['onChange', 'onBlur', 'onFocus', 'className', 'label', 'placeholder', 'baseMinWidth']), {
|
|
101
99
|
ref: InputDomRef,
|
|
102
100
|
"data-value": value ? value.length : 0,
|
|
103
101
|
value: value,
|
|
@@ -92,7 +92,7 @@ var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
|
|
|
92
92
|
var messages = useContext(LocaleContext);
|
|
93
93
|
var dataSource = radioList !== null && radioList !== void 0 ? radioList : getDefaultRadioList(messages);
|
|
94
94
|
useEffect(function () {
|
|
95
|
-
var
|
|
95
|
+
var filterItemList = dataSource.filter(function (item) {
|
|
96
96
|
if (!date) return false;
|
|
97
97
|
|
|
98
98
|
var _a = __read(item.value, 2),
|
|
@@ -109,8 +109,21 @@ var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
|
|
|
109
109
|
|
|
110
110
|
return false;
|
|
111
111
|
});
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
|
|
113
|
+
if (filterItemList.length === 0) {
|
|
114
|
+
setRadioKey(null);
|
|
115
|
+
} else if (filterItemList.length > 1) {
|
|
116
|
+
var findItem = filterItemList.find(function (item) {
|
|
117
|
+
return item.key === radioKey;
|
|
118
|
+
});
|
|
119
|
+
var resutRadioKey = findItem ? findItem.key : filterItemList[0].key;
|
|
120
|
+
setRadioKey(resutRadioKey);
|
|
121
|
+
} else {
|
|
122
|
+
var _a = __read(filterItemList, 1),
|
|
123
|
+
item = _a[0];
|
|
124
|
+
|
|
125
|
+
setRadioKey(item.key);
|
|
126
|
+
}
|
|
114
127
|
}, [date]);
|
|
115
128
|
|
|
116
129
|
var onDiyTimeChange = function onDiyTimeChange(event) {
|
|
@@ -68,13 +68,11 @@ var LabelDatePicker = function LabelDatePicker(props) {
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
var handleLabelClick = function handleLabelClick() {
|
|
71
|
-
var _a;
|
|
72
|
-
|
|
73
71
|
if (!open) {
|
|
74
72
|
setOpen(!open);
|
|
75
73
|
}
|
|
76
74
|
|
|
77
|
-
|
|
75
|
+
datePickerRef.current.focus();
|
|
78
76
|
};
|
|
79
77
|
|
|
80
78
|
var onBlur = function onBlur() {
|
package/es/label-input/index.js
CHANGED
|
@@ -97,9 +97,7 @@ var LabelInput = function LabelInput(props) {
|
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
var handleLabelClick = function handleLabelClick() {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
(_a = InputDomRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
100
|
+
InputDomRef.current.focus();
|
|
103
101
|
};
|
|
104
102
|
|
|
105
103
|
var onChangeInputType = React.useCallback(function (nextInputType) {
|
|
@@ -70,10 +70,8 @@ var LabelNumberInput = function LabelNumberInput(props) {
|
|
|
70
70
|
setFocused = _c[1];
|
|
71
71
|
|
|
72
72
|
var handleLabelClick = function handleLabelClick() {
|
|
73
|
-
var _a;
|
|
74
|
-
|
|
75
73
|
setFocused(true);
|
|
76
|
-
|
|
74
|
+
numberInputRef.current.focus();
|
|
77
75
|
};
|
|
78
76
|
|
|
79
77
|
var handleFocus = function handleFocus() {
|
|
@@ -81,9 +79,9 @@ var LabelNumberInput = function LabelNumberInput(props) {
|
|
|
81
79
|
onFocus === null || onFocus === void 0 ? void 0 : onFocus(value);
|
|
82
80
|
};
|
|
83
81
|
|
|
84
|
-
var handleBlur = function handleBlur(
|
|
82
|
+
var handleBlur = function handleBlur() {
|
|
85
83
|
setFocused(false);
|
|
86
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur(
|
|
84
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(value);
|
|
87
85
|
};
|
|
88
86
|
|
|
89
87
|
var controlMinWidth = (labelSize === null || labelSize === void 0 ? void 0 : labelSize.width) ? labelSize.width + baseMinWidth : undefined;
|
|
@@ -97,7 +95,7 @@ var LabelNumberInput = function LabelNumberInput(props) {
|
|
|
97
95
|
className: classNames('label-number-input-field', {
|
|
98
96
|
'label-number-input-focused': focused
|
|
99
97
|
})
|
|
100
|
-
}, /*#__PURE__*/React.createElement(NumberInput, __assign({}, omit(props, ['onChange', 'onBlur', 'onFocus', 'className', 'label', 'placeholder']), {
|
|
98
|
+
}, /*#__PURE__*/React.createElement(NumberInput, __assign({}, omit(props, ['onChange', 'onBlur', 'onFocus', 'className', 'label', 'placeholder', 'baseMinWidth']), {
|
|
101
99
|
ref: numberInputRef,
|
|
102
100
|
"data-value": !isUndefined(value) ? "".concat(value).length : 0,
|
|
103
101
|
value: value,
|
package/es/label-select/index.js
CHANGED
|
@@ -72,13 +72,11 @@ var LabelSelect = function LabelSelect(props) {
|
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
var handleLabelClick = function handleLabelClick() {
|
|
75
|
-
var _a;
|
|
76
|
-
|
|
77
75
|
if (!open) {
|
|
78
76
|
setOpen(!open);
|
|
79
77
|
}
|
|
80
78
|
|
|
81
|
-
|
|
79
|
+
selectRef.current.focus();
|
|
82
80
|
};
|
|
83
81
|
|
|
84
82
|
var onDropdownVisibleChange = function onDropdownVisibleChange(nextOpen) {
|
|
@@ -93,7 +91,7 @@ var LabelSelect = function LabelSelect(props) {
|
|
|
93
91
|
}, /*#__PURE__*/React.createElement(Select, __assign({
|
|
94
92
|
maxTagCount: 3,
|
|
95
93
|
showSearch: false
|
|
96
|
-
}, omit(props, ['open', 'onChange', 'className', 'label']), {
|
|
94
|
+
}, omit(props, ['open', 'onChange', 'className', 'label', 'setOpen']), {
|
|
97
95
|
open: open,
|
|
98
96
|
ref: selectRef,
|
|
99
97
|
size: "large",
|
|
@@ -89,9 +89,7 @@ var LabelTextArea = function LabelTextArea(props) {
|
|
|
89
89
|
};
|
|
90
90
|
|
|
91
91
|
var handleLabelClick = function handleLabelClick() {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
(_a = TextAreaDomRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
92
|
+
TextAreaDomRef.current.focus();
|
|
95
93
|
};
|
|
96
94
|
|
|
97
95
|
var handleChange = function handleChange(e) {
|
package/es/messages/zh_CN.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export interface FilterIntType {
|
|
2
2
|
value: string;
|
|
3
3
|
enableMinus?: boolean;
|
|
4
|
-
preValue
|
|
4
|
+
preValue?: string;
|
|
5
5
|
}
|
|
6
6
|
export declare const filterInt: ({ value, enableMinus, preValue }: FilterIntType) => string;
|
|
7
7
|
export interface FilterFloatType extends FilterIntType {
|
|
8
|
-
precision
|
|
8
|
+
precision?: number;
|
|
9
9
|
}
|
|
10
|
-
export declare const filterFloat: ({ value, preValue, precision, enableMinus }: FilterFloatType) => string;
|
|
10
|
+
export declare const filterFloat: ({ value, preValue, precision, enableMinus, }: FilterFloatType) => string;
|
package/es/number-input/utils.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-useless-escape */
|
|
2
|
+
var intNumberReg = /^-?\d+$/;
|
|
2
3
|
export var filterInt = function filterInt(_a) {
|
|
3
4
|
var value = _a.value,
|
|
4
5
|
enableMinus = _a.enableMinus,
|
|
@@ -9,18 +10,18 @@ export var filterInt = function filterInt(_a) {
|
|
|
9
10
|
nextValue = value.replace(/\D/g, '');
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
var intNumberReg = /^-?\d+$/;
|
|
13
|
-
|
|
14
13
|
if (nextValue && nextValue.length > 1 && !intNumberReg.test(nextValue)) {
|
|
15
|
-
return preValue;
|
|
14
|
+
return preValue !== null && preValue !== void 0 ? preValue : '';
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
return nextValue;
|
|
19
18
|
};
|
|
20
19
|
export var filterFloat = function filterFloat(_a) {
|
|
21
20
|
var value = _a.value,
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
_b = _a.preValue,
|
|
22
|
+
preValue = _b === void 0 ? '' : _b,
|
|
23
|
+
_c = _a.precision,
|
|
24
|
+
precision = _c === void 0 ? 2 : _c,
|
|
24
25
|
enableMinus = _a.enableMinus;
|
|
25
26
|
var nextValue = value.replace(/[^\d.\-]/g, '');
|
|
26
27
|
var matchDecimalPoint = nextValue.match(/\./g) || [];
|
|
@@ -58,41 +58,36 @@ import * as React from 'react';
|
|
|
58
58
|
import classNames from 'classnames';
|
|
59
59
|
import BigNumber from 'bignumber.js';
|
|
60
60
|
import isUndefined from 'lodash/isUndefined';
|
|
61
|
+
import useControllableValue from 'ahooks/lib/useControllableValue';
|
|
61
62
|
import { INT } from './const/numberType';
|
|
62
63
|
import { PLUS, MINUS } from './const/countType';
|
|
63
64
|
import NumberInput from '../number-input';
|
|
64
65
|
|
|
65
66
|
var StepNumberInput = function StepNumberInput(props) {
|
|
66
|
-
var
|
|
67
|
-
|
|
67
|
+
var _a = __read(useControllableValue(props, {
|
|
68
|
+
defaultValue: ''
|
|
69
|
+
}), 2),
|
|
70
|
+
value = _a[0],
|
|
71
|
+
setValue = _a[1];
|
|
72
|
+
|
|
73
|
+
var onChange = props.onChange,
|
|
68
74
|
onBlur = props.onBlur,
|
|
69
75
|
numberType = props.numberType,
|
|
70
76
|
precision = props.precision,
|
|
71
77
|
step = props.step,
|
|
72
78
|
max = props.max,
|
|
73
79
|
min = props.min,
|
|
74
|
-
restProps = __rest(props, ["
|
|
75
|
-
|
|
76
|
-
var _a = __read(React.useState(''), 2),
|
|
77
|
-
inputValue = _a[0],
|
|
78
|
-
setInputValue = _a[1];
|
|
80
|
+
restProps = __rest(props, ["onChange", "onBlur", "numberType", "precision", "step", "max", "min"]);
|
|
79
81
|
|
|
80
|
-
var
|
|
81
|
-
var
|
|
82
|
-
var
|
|
83
|
-
var
|
|
84
|
-
var
|
|
85
|
-
var minCondition = isUndefined(min) ? false : min === Number(resultValue) || Number(min) > Number(minusNumber);
|
|
82
|
+
var isEmpty = isUndefined(value) || value === '';
|
|
83
|
+
var plusNumber = new BigNumber(value).plus(step).toString();
|
|
84
|
+
var minusNumber = new BigNumber(value).minus(step).toString();
|
|
85
|
+
var maxCondition = isUndefined(max) ? false : max === Number(value) || Number(max) < Number(plusNumber);
|
|
86
|
+
var minCondition = isUndefined(min) ? false : min === Number(value) || Number(min) > Number(minusNumber);
|
|
86
87
|
|
|
87
88
|
var onNumberChange = function onNumberChange(lastValue) {
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
setInputValue(lastValue);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (onChange) {
|
|
94
|
-
onChange(lastValue);
|
|
95
|
-
}
|
|
89
|
+
if (value !== lastValue) {
|
|
90
|
+
setValue(lastValue);
|
|
96
91
|
}
|
|
97
92
|
};
|
|
98
93
|
|
|
@@ -109,49 +104,26 @@ var StepNumberInput = function StepNumberInput(props) {
|
|
|
109
104
|
newNumber = minCondition ? "".concat(min) : minusNumber;
|
|
110
105
|
}
|
|
111
106
|
|
|
112
|
-
|
|
113
|
-
setInputValue(newNumber);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (onChange) {
|
|
117
|
-
onChange(newNumber);
|
|
118
|
-
}
|
|
107
|
+
setValue(newNumber);
|
|
119
108
|
};
|
|
120
109
|
|
|
121
110
|
var onNumberBlur = function onNumberBlur() {
|
|
122
|
-
|
|
123
|
-
if (value === undefined) {
|
|
124
|
-
setInputValue('');
|
|
125
|
-
}
|
|
111
|
+
var resultValue = value;
|
|
126
112
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
113
|
+
if (value === '-' || value === '.') {
|
|
114
|
+
resultValue = '';
|
|
130
115
|
}
|
|
131
116
|
|
|
132
|
-
if (!isUndefined(max) && Number(
|
|
133
|
-
|
|
134
|
-
setInputValue("".concat(max));
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (onChange) {
|
|
138
|
-
onChange("".concat(max));
|
|
139
|
-
}
|
|
117
|
+
if (!isUndefined(max) && Number(value) > max) {
|
|
118
|
+
resultValue = "".concat(max);
|
|
140
119
|
}
|
|
141
120
|
|
|
142
|
-
if (!isUndefined(min) && Number(
|
|
143
|
-
|
|
144
|
-
setInputValue("".concat(min));
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (onChange) {
|
|
148
|
-
onChange("".concat(min));
|
|
149
|
-
}
|
|
121
|
+
if (!isUndefined(min) && Number(value) < min) {
|
|
122
|
+
resultValue = "".concat(min);
|
|
150
123
|
}
|
|
151
124
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
125
|
+
setValue(resultValue);
|
|
126
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(resultValue);
|
|
155
127
|
};
|
|
156
128
|
|
|
157
129
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -173,7 +145,7 @@ var StepNumberInput = function StepNumberInput(props) {
|
|
|
173
145
|
'disabled-btn': isEmpty || maxCondition
|
|
174
146
|
})
|
|
175
147
|
}, "+"),
|
|
176
|
-
value: "".concat(
|
|
148
|
+
value: "".concat(value),
|
|
177
149
|
onChange: onNumberChange,
|
|
178
150
|
onBlur: onNumberBlur,
|
|
179
151
|
numberType: numberType,
|
|
@@ -126,19 +126,13 @@ var ButtonModal = function ButtonModal(props, ref) {
|
|
|
126
126
|
restModalProps = __rest(props, ["children", "trigger", "onOpen", "onClose", "onOk", "onCancel"]);
|
|
127
127
|
|
|
128
128
|
var openModal = function openModal() {
|
|
129
|
-
if (onOpen) {
|
|
130
|
-
onOpen();
|
|
131
|
-
}
|
|
132
|
-
|
|
133
129
|
setModalVisible(true);
|
|
130
|
+
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
134
131
|
};
|
|
135
132
|
|
|
136
133
|
var closeModal = function closeModal() {
|
|
137
|
-
if (onClose) {
|
|
138
|
-
onClose();
|
|
139
|
-
}
|
|
140
|
-
|
|
141
134
|
setModalVisible(false);
|
|
135
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
142
136
|
};
|
|
143
137
|
|
|
144
138
|
var modalActionRef = React.useRef({
|
|
@@ -91,13 +91,11 @@ var LabelAutoComplete = function LabelAutoComplete(props) {
|
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
var handleLabelClick = function handleLabelClick() {
|
|
94
|
-
var _a;
|
|
95
|
-
|
|
96
94
|
if (!open) {
|
|
97
95
|
setOpen(!open);
|
|
98
96
|
}
|
|
99
97
|
|
|
100
|
-
|
|
98
|
+
autoComplete.current.focus();
|
|
101
99
|
};
|
|
102
100
|
|
|
103
101
|
var onDropdownVisibleChange = function onDropdownVisibleChange(nextOpen) {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ConditionInputProps } from '../condition-input';
|
|
3
|
-
export interface LabelConditionInputProps extends ConditionInputProps {
|
|
3
|
+
export interface LabelConditionInputProps extends Omit<ConditionInputProps, 'onBlur' | 'onChange'> {
|
|
4
4
|
/** label 标签的文本 */
|
|
5
5
|
label?: React.ReactNode;
|
|
6
6
|
/** 输入框内容变化时的回调 */
|
|
7
7
|
onChange?: (value: string) => void;
|
|
8
|
+
/** 输入框失去焦点的回调 */
|
|
9
|
+
onBlur?: (value: string) => void;
|
|
8
10
|
/** 输入框除去label之后的最小末尾宽度 */
|
|
9
11
|
baseMinWidth?: number;
|
|
10
12
|
/** 组件dom id */
|
|
@@ -87,10 +87,8 @@ var LabelConditionInput = function LabelConditionInput(props) {
|
|
|
87
87
|
setFocused = _c[1];
|
|
88
88
|
|
|
89
89
|
var handleLabelClick = function handleLabelClick() {
|
|
90
|
-
var _a;
|
|
91
|
-
|
|
92
90
|
setFocused(true);
|
|
93
|
-
|
|
91
|
+
InputDomRef.current.focus();
|
|
94
92
|
};
|
|
95
93
|
|
|
96
94
|
var handleFocus = function handleFocus() {
|
|
@@ -98,9 +96,9 @@ var LabelConditionInput = function LabelConditionInput(props) {
|
|
|
98
96
|
onFocus === null || onFocus === void 0 ? void 0 : onFocus(value);
|
|
99
97
|
};
|
|
100
98
|
|
|
101
|
-
var handleBlur = function handleBlur(
|
|
99
|
+
var handleBlur = function handleBlur() {
|
|
102
100
|
setFocused(false);
|
|
103
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur(
|
|
101
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(value);
|
|
104
102
|
};
|
|
105
103
|
|
|
106
104
|
var controlMinWidth = (labelSize === null || labelSize === void 0 ? void 0 : labelSize.width) ? labelSize.width + baseMinWidth : undefined;
|
|
@@ -112,9 +110,9 @@ var LabelConditionInput = function LabelConditionInput(props) {
|
|
|
112
110
|
}
|
|
113
111
|
}, react_1["default"].createElement("div", {
|
|
114
112
|
className: (0, classnames_1["default"])('label-condition-input-field', {
|
|
115
|
-
'label-condition-input-focused': focused
|
|
113
|
+
'label-condition-input-focused': focused
|
|
116
114
|
})
|
|
117
|
-
}, react_1["default"].createElement(condition_input_1["default"], __assign({}, (0, omit_1["default"])(props, ['onChange', 'onBlur', 'onFocus', 'className', 'label', 'placeholder']), {
|
|
115
|
+
}, react_1["default"].createElement(condition_input_1["default"], __assign({}, (0, omit_1["default"])(props, ['onChange', 'onBlur', 'onFocus', 'className', 'label', 'placeholder', 'baseMinWidth']), {
|
|
118
116
|
ref: InputDomRef,
|
|
119
117
|
"data-value": value ? value.length : 0,
|
|
120
118
|
value: value,
|
|
@@ -153,7 +153,7 @@ var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
|
|
|
153
153
|
var messages = (0, react_1.useContext)(context_1["default"]);
|
|
154
154
|
var dataSource = radioList !== null && radioList !== void 0 ? radioList : (0, defaultRadioList_1["default"])(messages);
|
|
155
155
|
(0, react_1.useEffect)(function () {
|
|
156
|
-
var
|
|
156
|
+
var filterItemList = dataSource.filter(function (item) {
|
|
157
157
|
if (!date) return false;
|
|
158
158
|
|
|
159
159
|
var _a = __read(item.value, 2),
|
|
@@ -170,8 +170,21 @@ var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
|
|
|
170
170
|
|
|
171
171
|
return false;
|
|
172
172
|
});
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
|
|
174
|
+
if (filterItemList.length === 0) {
|
|
175
|
+
setRadioKey(null);
|
|
176
|
+
} else if (filterItemList.length > 1) {
|
|
177
|
+
var findItem = filterItemList.find(function (item) {
|
|
178
|
+
return item.key === radioKey;
|
|
179
|
+
});
|
|
180
|
+
var resutRadioKey = findItem ? findItem.key : filterItemList[0].key;
|
|
181
|
+
setRadioKey(resutRadioKey);
|
|
182
|
+
} else {
|
|
183
|
+
var _a = __read(filterItemList, 1),
|
|
184
|
+
item = _a[0];
|
|
185
|
+
|
|
186
|
+
setRadioKey(item.key);
|
|
187
|
+
}
|
|
175
188
|
}, [date]);
|
|
176
189
|
|
|
177
190
|
var onDiyTimeChange = function onDiyTimeChange(event) {
|
|
@@ -84,13 +84,11 @@ var LabelDatePicker = function LabelDatePicker(props) {
|
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
var handleLabelClick = function handleLabelClick() {
|
|
87
|
-
var _a;
|
|
88
|
-
|
|
89
87
|
if (!open) {
|
|
90
88
|
setOpen(!open);
|
|
91
89
|
}
|
|
92
90
|
|
|
93
|
-
|
|
91
|
+
datePickerRef.current.focus();
|
|
94
92
|
};
|
|
95
93
|
|
|
96
94
|
var onBlur = function onBlur() {
|
package/lib/label-input/index.js
CHANGED
|
@@ -116,9 +116,7 @@ var LabelInput = function LabelInput(props) {
|
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
var handleLabelClick = function handleLabelClick() {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
(_a = InputDomRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
119
|
+
InputDomRef.current.focus();
|
|
122
120
|
};
|
|
123
121
|
|
|
124
122
|
var onChangeInputType = react_1["default"].useCallback(function (nextInputType) {
|
|
@@ -88,10 +88,8 @@ var LabelNumberInput = function LabelNumberInput(props) {
|
|
|
88
88
|
setFocused = _c[1];
|
|
89
89
|
|
|
90
90
|
var handleLabelClick = function handleLabelClick() {
|
|
91
|
-
var _a;
|
|
92
|
-
|
|
93
91
|
setFocused(true);
|
|
94
|
-
|
|
92
|
+
numberInputRef.current.focus();
|
|
95
93
|
};
|
|
96
94
|
|
|
97
95
|
var handleFocus = function handleFocus() {
|
|
@@ -99,9 +97,9 @@ var LabelNumberInput = function LabelNumberInput(props) {
|
|
|
99
97
|
onFocus === null || onFocus === void 0 ? void 0 : onFocus(value);
|
|
100
98
|
};
|
|
101
99
|
|
|
102
|
-
var handleBlur = function handleBlur(
|
|
100
|
+
var handleBlur = function handleBlur() {
|
|
103
101
|
setFocused(false);
|
|
104
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur(
|
|
102
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(value);
|
|
105
103
|
};
|
|
106
104
|
|
|
107
105
|
var controlMinWidth = (labelSize === null || labelSize === void 0 ? void 0 : labelSize.width) ? labelSize.width + baseMinWidth : undefined;
|
|
@@ -115,7 +113,7 @@ var LabelNumberInput = function LabelNumberInput(props) {
|
|
|
115
113
|
className: (0, classnames_1["default"])('label-number-input-field', {
|
|
116
114
|
'label-number-input-focused': focused
|
|
117
115
|
})
|
|
118
|
-
}, react_1["default"].createElement(number_input_1["default"], __assign({}, (0, omit_1["default"])(props, ['onChange', 'onBlur', 'onFocus', 'className', 'label', 'placeholder']), {
|
|
116
|
+
}, react_1["default"].createElement(number_input_1["default"], __assign({}, (0, omit_1["default"])(props, ['onChange', 'onBlur', 'onFocus', 'className', 'label', 'placeholder', 'baseMinWidth']), {
|
|
119
117
|
ref: numberInputRef,
|
|
120
118
|
"data-value": !(0, isUndefined_1["default"])(value) ? "".concat(value).length : 0,
|
|
121
119
|
value: value,
|
|
@@ -92,13 +92,11 @@ var LabelSelect = function LabelSelect(props) {
|
|
|
92
92
|
};
|
|
93
93
|
|
|
94
94
|
var handleLabelClick = function handleLabelClick() {
|
|
95
|
-
var _a;
|
|
96
|
-
|
|
97
95
|
if (!open) {
|
|
98
96
|
setOpen(!open);
|
|
99
97
|
}
|
|
100
98
|
|
|
101
|
-
|
|
99
|
+
selectRef.current.focus();
|
|
102
100
|
};
|
|
103
101
|
|
|
104
102
|
var onDropdownVisibleChange = function onDropdownVisibleChange(nextOpen) {
|
|
@@ -113,7 +111,7 @@ var LabelSelect = function LabelSelect(props) {
|
|
|
113
111
|
}, react_1["default"].createElement(select_1["default"], __assign({
|
|
114
112
|
maxTagCount: 3,
|
|
115
113
|
showSearch: false
|
|
116
|
-
}, (0, omit_1["default"])(props, ['open', 'onChange', 'className', 'label']), {
|
|
114
|
+
}, (0, omit_1["default"])(props, ['open', 'onChange', 'className', 'label', 'setOpen']), {
|
|
117
115
|
open: open,
|
|
118
116
|
ref: selectRef,
|
|
119
117
|
size: "large",
|
|
@@ -104,9 +104,7 @@ var LabelTextArea = function LabelTextArea(props) {
|
|
|
104
104
|
};
|
|
105
105
|
|
|
106
106
|
var handleLabelClick = function handleLabelClick() {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
(_a = TextAreaDomRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
107
|
+
TextAreaDomRef.current.focus();
|
|
110
108
|
};
|
|
111
109
|
|
|
112
110
|
var handleChange = function handleChange(e) {
|
package/lib/messages/zh_CN.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export interface FilterIntType {
|
|
2
2
|
value: string;
|
|
3
3
|
enableMinus?: boolean;
|
|
4
|
-
preValue
|
|
4
|
+
preValue?: string;
|
|
5
5
|
}
|
|
6
6
|
export declare const filterInt: ({ value, enableMinus, preValue }: FilterIntType) => string;
|
|
7
7
|
export interface FilterFloatType extends FilterIntType {
|
|
8
|
-
precision
|
|
8
|
+
precision?: number;
|
|
9
9
|
}
|
|
10
|
-
export declare const filterFloat: ({ value, preValue, precision, enableMinus }: FilterFloatType) => string;
|
|
10
|
+
export declare const filterFloat: ({ value, preValue, precision, enableMinus, }: FilterFloatType) => string;
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.filterFloat = exports.filterInt = void 0;
|
|
8
|
+
var intNumberReg = /^-?\d+$/;
|
|
8
9
|
|
|
9
10
|
var filterInt = function filterInt(_a) {
|
|
10
11
|
var value = _a.value,
|
|
@@ -16,10 +17,8 @@ var filterInt = function filterInt(_a) {
|
|
|
16
17
|
nextValue = value.replace(/\D/g, '');
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
var intNumberReg = /^-?\d+$/;
|
|
20
|
-
|
|
21
20
|
if (nextValue && nextValue.length > 1 && !intNumberReg.test(nextValue)) {
|
|
22
|
-
return preValue;
|
|
21
|
+
return preValue !== null && preValue !== void 0 ? preValue : '';
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
return nextValue;
|
|
@@ -29,8 +28,10 @@ exports.filterInt = filterInt;
|
|
|
29
28
|
|
|
30
29
|
var filterFloat = function filterFloat(_a) {
|
|
31
30
|
var value = _a.value,
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
_b = _a.preValue,
|
|
32
|
+
preValue = _b === void 0 ? '' : _b,
|
|
33
|
+
_c = _a.precision,
|
|
34
|
+
precision = _c === void 0 ? 2 : _c,
|
|
34
35
|
enableMinus = _a.enableMinus;
|
|
35
36
|
var nextValue = value.replace(/[^\d.\-]/g, '');
|
|
36
37
|
var matchDecimalPoint = nextValue.match(/\./g) || [];
|
|
@@ -114,6 +114,8 @@ var bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
|
114
114
|
|
|
115
115
|
var isUndefined_1 = __importDefault(require("lodash/isUndefined"));
|
|
116
116
|
|
|
117
|
+
var useControllableValue_1 = __importDefault(require("ahooks/lib/useControllableValue"));
|
|
118
|
+
|
|
117
119
|
var numberType_1 = require("./const/numberType");
|
|
118
120
|
|
|
119
121
|
var countType_1 = require("./const/countType");
|
|
@@ -121,36 +123,30 @@ var countType_1 = require("./const/countType");
|
|
|
121
123
|
var number_input_1 = __importDefault(require("../number-input"));
|
|
122
124
|
|
|
123
125
|
var StepNumberInput = function StepNumberInput(props) {
|
|
124
|
-
var
|
|
125
|
-
|
|
126
|
+
var _a = __read((0, useControllableValue_1["default"])(props, {
|
|
127
|
+
defaultValue: ''
|
|
128
|
+
}), 2),
|
|
129
|
+
value = _a[0],
|
|
130
|
+
setValue = _a[1];
|
|
131
|
+
|
|
132
|
+
var onChange = props.onChange,
|
|
126
133
|
onBlur = props.onBlur,
|
|
127
134
|
numberType = props.numberType,
|
|
128
135
|
precision = props.precision,
|
|
129
136
|
step = props.step,
|
|
130
137
|
max = props.max,
|
|
131
138
|
min = props.min,
|
|
132
|
-
restProps = __rest(props, ["
|
|
133
|
-
|
|
134
|
-
var _a = __read(React.useState(''), 2),
|
|
135
|
-
inputValue = _a[0],
|
|
136
|
-
setInputValue = _a[1];
|
|
139
|
+
restProps = __rest(props, ["onChange", "onBlur", "numberType", "precision", "step", "max", "min"]);
|
|
137
140
|
|
|
138
|
-
var
|
|
139
|
-
var
|
|
140
|
-
var
|
|
141
|
-
var
|
|
142
|
-
var
|
|
143
|
-
var minCondition = (0, isUndefined_1["default"])(min) ? false : min === Number(resultValue) || Number(min) > Number(minusNumber);
|
|
141
|
+
var isEmpty = (0, isUndefined_1["default"])(value) || value === '';
|
|
142
|
+
var plusNumber = new bignumber_js_1["default"](value).plus(step).toString();
|
|
143
|
+
var minusNumber = new bignumber_js_1["default"](value).minus(step).toString();
|
|
144
|
+
var maxCondition = (0, isUndefined_1["default"])(max) ? false : max === Number(value) || Number(max) < Number(plusNumber);
|
|
145
|
+
var minCondition = (0, isUndefined_1["default"])(min) ? false : min === Number(value) || Number(min) > Number(minusNumber);
|
|
144
146
|
|
|
145
147
|
var onNumberChange = function onNumberChange(lastValue) {
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
setInputValue(lastValue);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (onChange) {
|
|
152
|
-
onChange(lastValue);
|
|
153
|
-
}
|
|
148
|
+
if (value !== lastValue) {
|
|
149
|
+
setValue(lastValue);
|
|
154
150
|
}
|
|
155
151
|
};
|
|
156
152
|
|
|
@@ -167,49 +163,26 @@ var StepNumberInput = function StepNumberInput(props) {
|
|
|
167
163
|
newNumber = minCondition ? "".concat(min) : minusNumber;
|
|
168
164
|
}
|
|
169
165
|
|
|
170
|
-
|
|
171
|
-
setInputValue(newNumber);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
if (onChange) {
|
|
175
|
-
onChange(newNumber);
|
|
176
|
-
}
|
|
166
|
+
setValue(newNumber);
|
|
177
167
|
};
|
|
178
168
|
|
|
179
169
|
var onNumberBlur = function onNumberBlur() {
|
|
180
|
-
|
|
181
|
-
if (value === undefined) {
|
|
182
|
-
setInputValue('');
|
|
183
|
-
}
|
|
170
|
+
var resultValue = value;
|
|
184
171
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
172
|
+
if (value === '-' || value === '.') {
|
|
173
|
+
resultValue = '';
|
|
188
174
|
}
|
|
189
175
|
|
|
190
|
-
if (!(0, isUndefined_1["default"])(max) && Number(
|
|
191
|
-
|
|
192
|
-
setInputValue("".concat(max));
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (onChange) {
|
|
196
|
-
onChange("".concat(max));
|
|
197
|
-
}
|
|
176
|
+
if (!(0, isUndefined_1["default"])(max) && Number(value) > max) {
|
|
177
|
+
resultValue = "".concat(max);
|
|
198
178
|
}
|
|
199
179
|
|
|
200
|
-
if (!(0, isUndefined_1["default"])(min) && Number(
|
|
201
|
-
|
|
202
|
-
setInputValue("".concat(min));
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
if (onChange) {
|
|
206
|
-
onChange("".concat(min));
|
|
207
|
-
}
|
|
180
|
+
if (!(0, isUndefined_1["default"])(min) && Number(value) < min) {
|
|
181
|
+
resultValue = "".concat(min);
|
|
208
182
|
}
|
|
209
183
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}
|
|
184
|
+
setValue(resultValue);
|
|
185
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(resultValue);
|
|
213
186
|
};
|
|
214
187
|
|
|
215
188
|
return React.createElement("div", {
|
|
@@ -231,7 +204,7 @@ var StepNumberInput = function StepNumberInput(props) {
|
|
|
231
204
|
'disabled-btn': isEmpty || maxCondition
|
|
232
205
|
})
|
|
233
206
|
}, "+"),
|
|
234
|
-
value: "".concat(
|
|
207
|
+
value: "".concat(value),
|
|
235
208
|
onChange: onNumberChange,
|
|
236
209
|
onBlur: onNumberBlur,
|
|
237
210
|
numberType: numberType,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "assui",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.32",
|
|
4
4
|
"description": "react ui library",
|
|
5
5
|
"author": "jason <usochen@gmail.com>",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"@tinymce/tinymce-react": "^4.0.0",
|
|
35
35
|
"@types/react-beautiful-dnd": "^13.1.2",
|
|
36
36
|
"@types/react-resizable": "^3.0.0",
|
|
37
|
-
"a-icons": "^1.0.
|
|
38
|
-
"aa-utils": "^2.0.
|
|
37
|
+
"a-icons": "^1.0.77",
|
|
38
|
+
"aa-utils": "^2.0.31",
|
|
39
39
|
"ahooks": "^3.0.8",
|
|
40
40
|
"bignumber.js": "^9.0.1",
|
|
41
41
|
"copy-to-clipboard": "^3.3.1",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"node": ">=10.0.0"
|
|
73
73
|
},
|
|
74
74
|
"license": "MIT",
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "522946669dc72275c25173889993140a9af4be81"
|
|
76
76
|
}
|