assui 2.0.121 → 2.0.124
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/condition-input/index.d.ts +2 -1
- package/es/condition-input/index.js +11 -18
- package/es/index.d.ts +4 -0
- package/es/index.js +2 -0
- package/es/keep-tab/index.js +1 -1
- package/es/label-auto-complete/style/index.less +1 -1
- package/es/label-condition-input/index.d.ts +17 -0
- package/es/label-condition-input/index.js +118 -0
- package/es/label-condition-input/style/index.css +43 -0
- package/es/label-condition-input/style/index.d.ts +1 -0
- package/es/label-condition-input/style/index.js +1 -0
- package/es/label-condition-input/style/index.less +59 -0
- package/es/label-number-input/index.d.ts +15 -0
- package/es/label-number-input/index.js +117 -0
- package/es/label-number-input/style/index.css +43 -0
- package/es/label-number-input/style/index.d.ts +1 -0
- package/es/label-number-input/style/index.js +1 -0
- package/es/label-number-input/style/index.less +59 -0
- package/es/label-select/index.js +1 -1
- package/es/label-text-area/index.js +1 -1
- package/es/number-input/index.d.ts +4 -3
- package/es/number-input/index.js +28 -41
- package/lib/condition-input/index.d.ts +2 -1
- package/lib/condition-input/index.js +13 -18
- package/lib/index.d.ts +4 -0
- package/lib/index.js +18 -0
- package/lib/keep-tab/index.js +1 -1
- package/lib/label-auto-complete/style/index.less +1 -1
- package/lib/label-condition-input/index.d.ts +17 -0
- package/lib/label-condition-input/index.js +135 -0
- package/lib/label-condition-input/style/index.css +43 -0
- package/lib/label-condition-input/style/index.d.ts +1 -0
- package/lib/label-condition-input/style/index.js +7 -0
- package/lib/label-condition-input/style/index.less +59 -0
- package/lib/label-number-input/index.d.ts +15 -0
- package/lib/label-number-input/index.js +135 -0
- package/lib/label-number-input/style/index.css +43 -0
- package/lib/label-number-input/style/index.d.ts +1 -0
- package/lib/label-number-input/style/index.js +7 -0
- package/lib/label-number-input/style/index.less +59 -0
- package/lib/label-select/index.js +2 -2
- package/lib/label-text-area/index.js +2 -2
- package/lib/number-input/index.d.ts +4 -3
- package/lib/number-input/index.js +29 -41
- package/package.json +2 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import type { InputProps } from 'antd/es/input';
|
|
2
3
|
export interface ConditionInputProps extends Omit<InputProps, 'onChange'> {
|
|
3
4
|
/** 过滤的正则条件 */
|
|
@@ -12,5 +13,5 @@ export interface ConditionInputProps extends Omit<InputProps, 'onChange'> {
|
|
|
12
13
|
/** 输入框内容 */
|
|
13
14
|
value?: string;
|
|
14
15
|
}
|
|
15
|
-
declare const ConditionInput:
|
|
16
|
+
declare const ConditionInput: React.ForwardRefExoticComponent<ConditionInputProps & React.RefAttributes<unknown>>;
|
|
16
17
|
export default ConditionInput;
|
|
@@ -58,20 +58,17 @@ import * as React from 'react';
|
|
|
58
58
|
import isArray from 'lodash/isArray';
|
|
59
59
|
import Input from 'antd/es/input';
|
|
60
60
|
import isFunction from 'lodash/isFunction';
|
|
61
|
+
import useControllableValue from 'ahooks/lib/useControllableValue';
|
|
61
62
|
import parse2RegexOption from './parse2RegexOption';
|
|
63
|
+
var ConditionInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
64
|
+
var _a = __read(useControllableValue(props), 2),
|
|
65
|
+
value = _a[0],
|
|
66
|
+
setValue = _a[1];
|
|
62
67
|
|
|
63
|
-
var ConditionInput = function ConditionInput(props) {
|
|
64
68
|
var regexp = props.regexp,
|
|
65
69
|
formatter = props.formatter,
|
|
66
|
-
value = props.value,
|
|
67
70
|
onChange = props.onChange,
|
|
68
|
-
rest = __rest(props, ["regexp", "formatter", "
|
|
69
|
-
|
|
70
|
-
var _a = __read(React.useState(''), 2),
|
|
71
|
-
stateValue = _a[0],
|
|
72
|
-
setStateValue = _a[1];
|
|
73
|
-
|
|
74
|
-
var resultValue = value === undefined ? stateValue : value;
|
|
71
|
+
rest = __rest(props, ["regexp", "formatter", "onChange"]);
|
|
75
72
|
|
|
76
73
|
var handleChange = function handleChange(e) {
|
|
77
74
|
var originalValue = e.target.value;
|
|
@@ -94,19 +91,15 @@ var ConditionInput = function ConditionInput(props) {
|
|
|
94
91
|
nextValue = formatter(nextValue);
|
|
95
92
|
}
|
|
96
93
|
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (onChange) {
|
|
101
|
-
onChange(nextValue);
|
|
102
|
-
}
|
|
94
|
+
if (value !== nextValue) {
|
|
95
|
+
setValue(nextValue);
|
|
103
96
|
}
|
|
104
97
|
};
|
|
105
98
|
|
|
106
99
|
return /*#__PURE__*/React.createElement(Input, __assign({
|
|
107
|
-
|
|
100
|
+
ref: ref,
|
|
101
|
+
value: value,
|
|
108
102
|
onChange: handleChange
|
|
109
103
|
}, rest));
|
|
110
|
-
};
|
|
111
|
-
|
|
104
|
+
});
|
|
112
105
|
export default ConditionInput;
|
package/es/index.d.ts
CHANGED
|
@@ -46,6 +46,10 @@ export type { LabelDatePickerProps } from './label-date-picker';
|
|
|
46
46
|
export { default as LabelDatePicker } from './label-date-picker';
|
|
47
47
|
export type { LabelAutoCompleteProps } from './label-auto-complete';
|
|
48
48
|
export { default as LabelAutoComplete } from './label-auto-complete';
|
|
49
|
+
export type { LabelNumberInputProps } from './label-number-input';
|
|
50
|
+
export { default as LabelNumberInput } from './label-number-input';
|
|
51
|
+
export type { LabelConditionInputProps } from './label-condition-input';
|
|
52
|
+
export { default as LabelConditionInput } from './label-condition-input';
|
|
49
53
|
export type { LabelTreeSelectProps } from './label-tree-select';
|
|
50
54
|
export { default as LabelTreeSelect } from './label-tree-select';
|
|
51
55
|
export type { LabelCustomizeRangePickerProps } from './label-customize-range-picker';
|
package/es/index.js
CHANGED
|
@@ -23,6 +23,8 @@ export { default as LabelTextArea } from './label-text-area';
|
|
|
23
23
|
export { default as LabelRangePicker } from './label-range-picker';
|
|
24
24
|
export { default as LabelDatePicker } from './label-date-picker';
|
|
25
25
|
export { default as LabelAutoComplete } from './label-auto-complete';
|
|
26
|
+
export { default as LabelNumberInput } from './label-number-input';
|
|
27
|
+
export { default as LabelConditionInput } from './label-condition-input';
|
|
26
28
|
export { default as LabelTreeSelect } from './label-tree-select';
|
|
27
29
|
export { default as LabelCustomizeRangePicker } from './label-customize-range-picker';
|
|
28
30
|
export { default as LabelDescItem } from './label-desc-item';
|
package/es/keep-tab/index.js
CHANGED
|
@@ -60,7 +60,7 @@ import qsHelp from 'aa-utils/lib/qsHelp';
|
|
|
60
60
|
import Badge from 'antd/es/badge';
|
|
61
61
|
import Tabs from 'antd/es/tabs';
|
|
62
62
|
import useUrlState from '@ahooksjs/use-url-state';
|
|
63
|
-
import useControllableValue from 'ahooks/
|
|
63
|
+
import useControllableValue from 'ahooks/lib/useControllableValue';
|
|
64
64
|
import toArray from 'rc-util/lib/Children/toArray';
|
|
65
65
|
var TabPane = Tabs.TabPane;
|
|
66
66
|
var defaultBadgeProps = {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ConditionInputProps } from '../condition-input';
|
|
3
|
+
export interface LabelConditionInputProps extends ConditionInputProps {
|
|
4
|
+
/** label 标签的文本 */
|
|
5
|
+
label?: React.ReactNode;
|
|
6
|
+
/** 输入框内容变化时的回调 */
|
|
7
|
+
onChange?: (value: string) => void;
|
|
8
|
+
/** 输入框除去label之后的最小末尾宽度 */
|
|
9
|
+
baseMinWidth?: number;
|
|
10
|
+
/** 组件dom id */
|
|
11
|
+
id?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const LabelConditionInput: {
|
|
14
|
+
(props: LabelConditionInputProps): JSX.Element;
|
|
15
|
+
Option: new (text?: string | undefined, value?: string | undefined, defaultSelected?: boolean | undefined, selected?: boolean | undefined) => HTMLOptionElement;
|
|
16
|
+
};
|
|
17
|
+
export default LabelConditionInput;
|
|
@@ -0,0 +1,118 @@
|
|
|
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 __read = this && this.__read || function (o, n) {
|
|
18
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
19
|
+
if (!m) return o;
|
|
20
|
+
var i = m.call(o),
|
|
21
|
+
r,
|
|
22
|
+
ar = [],
|
|
23
|
+
e;
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
27
|
+
ar.push(r.value);
|
|
28
|
+
}
|
|
29
|
+
} catch (error) {
|
|
30
|
+
e = {
|
|
31
|
+
error: error
|
|
32
|
+
};
|
|
33
|
+
} finally {
|
|
34
|
+
try {
|
|
35
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
36
|
+
} finally {
|
|
37
|
+
if (e) throw e.error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return ar;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
import React from 'react';
|
|
45
|
+
import classNames from 'classnames';
|
|
46
|
+
import omit from 'lodash/omit';
|
|
47
|
+
import useControllableValue from 'ahooks/lib/useControllableValue';
|
|
48
|
+
import useSize from 'ahooks/lib/useSize';
|
|
49
|
+
import ConditionInput from '../condition-input';
|
|
50
|
+
|
|
51
|
+
var LabelConditionInput = function LabelConditionInput(props) {
|
|
52
|
+
var className = props.className,
|
|
53
|
+
label = props.label,
|
|
54
|
+
onBlur = props.onBlur,
|
|
55
|
+
id = props.id,
|
|
56
|
+
onFocus = props.onFocus,
|
|
57
|
+
_a = props.baseMinWidth,
|
|
58
|
+
baseMinWidth = _a === void 0 ? 50 : _a;
|
|
59
|
+
|
|
60
|
+
var _b = __read(useControllableValue(props), 2),
|
|
61
|
+
value = _b[0],
|
|
62
|
+
setValue = _b[1];
|
|
63
|
+
|
|
64
|
+
var labelDomRef = React.useRef(null);
|
|
65
|
+
var labelSize = useSize(labelDomRef);
|
|
66
|
+
var InputDomRef = React.useRef(null);
|
|
67
|
+
|
|
68
|
+
var _c = __read(React.useState(false), 2),
|
|
69
|
+
focused = _c[0],
|
|
70
|
+
setFocused = _c[1];
|
|
71
|
+
|
|
72
|
+
var handleLabelClick = function handleLabelClick() {
|
|
73
|
+
var _a;
|
|
74
|
+
|
|
75
|
+
setFocused(true);
|
|
76
|
+
(_a = InputDomRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
var handleFocus = function handleFocus() {
|
|
80
|
+
setFocused(true);
|
|
81
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(value);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
var handleBlur = function handleBlur(e) {
|
|
85
|
+
setFocused(false);
|
|
86
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
var controlMinWidth = (labelSize === null || labelSize === void 0 ? void 0 : labelSize.width) ? labelSize.width + baseMinWidth : undefined;
|
|
90
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
91
|
+
className: classNames('label-condition-input-warper', className),
|
|
92
|
+
id: id,
|
|
93
|
+
style: {
|
|
94
|
+
minWidth: controlMinWidth
|
|
95
|
+
}
|
|
96
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
className: classNames('label-condition-input-field', {
|
|
98
|
+
'label-condition-input-focused': focused || value
|
|
99
|
+
})
|
|
100
|
+
}, /*#__PURE__*/React.createElement(ConditionInput, __assign({}, omit(props, ['onChange', 'onBlur', 'onFocus', 'className', 'label', 'placeholder']), {
|
|
101
|
+
ref: InputDomRef,
|
|
102
|
+
"data-value": value ? value.length : 0,
|
|
103
|
+
value: value,
|
|
104
|
+
onBlur: handleBlur,
|
|
105
|
+
onFocus: handleFocus,
|
|
106
|
+
className: "label-condition-input",
|
|
107
|
+
onChange: function onChange(inputValue) {
|
|
108
|
+
return setValue(inputValue);
|
|
109
|
+
}
|
|
110
|
+
})), /*#__PURE__*/React.createElement("label", {
|
|
111
|
+
ref: labelDomRef,
|
|
112
|
+
className: "label-condition-input-text",
|
|
113
|
+
onClick: handleLabelClick
|
|
114
|
+
}, label)));
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export default LabelConditionInput;
|
|
118
|
+
LabelConditionInput.Option = Option;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.label-condition-input {
|
|
2
|
+
z-index: 1;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
padding: 19px 15px 2px 15px;
|
|
6
|
+
color: #263241;
|
|
7
|
+
font-size: 14px;
|
|
8
|
+
line-height: 16px;
|
|
9
|
+
border: 0;
|
|
10
|
+
outline: 0;
|
|
11
|
+
}
|
|
12
|
+
.label-condition-input:focus + label,
|
|
13
|
+
.label-condition-input:not([data-value='0']) + label {
|
|
14
|
+
transform: translateY(-8px) scale(0.8);
|
|
15
|
+
}
|
|
16
|
+
.label-condition-input-field {
|
|
17
|
+
height: 45px;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
border: 1px solid #e5e5e5;
|
|
20
|
+
border-radius: 8px;
|
|
21
|
+
transition: border 0.3s;
|
|
22
|
+
}
|
|
23
|
+
.label-condition-input-focused {
|
|
24
|
+
border-color: #000;
|
|
25
|
+
}
|
|
26
|
+
.label-condition-input-warper {
|
|
27
|
+
position: relative;
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 100%;
|
|
30
|
+
}
|
|
31
|
+
.label-condition-input-text {
|
|
32
|
+
position: absolute;
|
|
33
|
+
top: 12px;
|
|
34
|
+
left: 15px;
|
|
35
|
+
z-index: 2;
|
|
36
|
+
height: 20px;
|
|
37
|
+
color: #9aa5b5;
|
|
38
|
+
font-size: 14px;
|
|
39
|
+
line-height: 20px;
|
|
40
|
+
transform-origin: top left;
|
|
41
|
+
cursor: text;
|
|
42
|
+
transition: all 0.2s ease-out;
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
@import '../../style/themes/default.less';
|
|
2
|
+
|
|
3
|
+
@color_263241: #263241;
|
|
4
|
+
@color_9aa5b5: #9aa5b5;
|
|
5
|
+
@color_e5e5e5: #e5e5e5;
|
|
6
|
+
|
|
7
|
+
@font-size-base: 14px;
|
|
8
|
+
@font-size-lg: @font-size-base + 2px;
|
|
9
|
+
|
|
10
|
+
@font-weight-500: 500;
|
|
11
|
+
|
|
12
|
+
.label-condition-input {
|
|
13
|
+
z-index: 1;
|
|
14
|
+
width: 100%;
|
|
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
|
+
|
|
36
|
+
&-focused {
|
|
37
|
+
border-color: @labelFocusBorderColor;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&-warper {
|
|
41
|
+
position: relative;
|
|
42
|
+
width: 100%;
|
|
43
|
+
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;
|
|
53
|
+
font-size: @font-size-base;
|
|
54
|
+
line-height: 20px;
|
|
55
|
+
transform-origin: top left;
|
|
56
|
+
cursor: text;
|
|
57
|
+
transition: all 0.2s ease-out;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { NumberInputProps } from '../number-input';
|
|
3
|
+
export interface LabelNumberInputProps extends NumberInputProps {
|
|
4
|
+
/** label 标签的文本 */
|
|
5
|
+
label?: React.ReactNode;
|
|
6
|
+
/** 输入框除去label之后的最小末尾宽度 */
|
|
7
|
+
baseMinWidth?: number;
|
|
8
|
+
/** 组件dom id */
|
|
9
|
+
id?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const LabelNumberInput: {
|
|
12
|
+
(props: LabelNumberInputProps): JSX.Element;
|
|
13
|
+
Option: new (text?: string | undefined, value?: string | undefined, defaultSelected?: boolean | undefined, selected?: boolean | undefined) => HTMLOptionElement;
|
|
14
|
+
};
|
|
15
|
+
export default LabelNumberInput;
|
|
@@ -0,0 +1,117 @@
|
|
|
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 __read = this && this.__read || function (o, n) {
|
|
18
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
19
|
+
if (!m) return o;
|
|
20
|
+
var i = m.call(o),
|
|
21
|
+
r,
|
|
22
|
+
ar = [],
|
|
23
|
+
e;
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
27
|
+
ar.push(r.value);
|
|
28
|
+
}
|
|
29
|
+
} catch (error) {
|
|
30
|
+
e = {
|
|
31
|
+
error: error
|
|
32
|
+
};
|
|
33
|
+
} finally {
|
|
34
|
+
try {
|
|
35
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
36
|
+
} finally {
|
|
37
|
+
if (e) throw e.error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return ar;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
import React from 'react';
|
|
45
|
+
import useControllableValue from 'ahooks/lib/useControllableValue';
|
|
46
|
+
import useSize from 'ahooks/lib/useSize';
|
|
47
|
+
import isUndefined from 'lodash/isUndefined';
|
|
48
|
+
import classNames from 'classnames';
|
|
49
|
+
import omit from 'lodash/omit';
|
|
50
|
+
import NumberInput from '../number-input';
|
|
51
|
+
|
|
52
|
+
var LabelNumberInput = function LabelNumberInput(props) {
|
|
53
|
+
var className = props.className,
|
|
54
|
+
label = props.label,
|
|
55
|
+
onBlur = props.onBlur,
|
|
56
|
+
onFocus = props.onFocus,
|
|
57
|
+
id = props.id,
|
|
58
|
+
_a = props.baseMinWidth,
|
|
59
|
+
baseMinWidth = _a === void 0 ? 50 : _a;
|
|
60
|
+
var numberInputRef = React.useRef(null);
|
|
61
|
+
var labelDomRef = React.useRef(null);
|
|
62
|
+
var labelSize = useSize(labelDomRef);
|
|
63
|
+
|
|
64
|
+
var _b = __read(useControllableValue(props), 2),
|
|
65
|
+
value = _b[0],
|
|
66
|
+
setValue = _b[1];
|
|
67
|
+
|
|
68
|
+
var _c = __read(React.useState(false), 2),
|
|
69
|
+
focused = _c[0],
|
|
70
|
+
setFocused = _c[1];
|
|
71
|
+
|
|
72
|
+
var handleLabelClick = function handleLabelClick() {
|
|
73
|
+
var _a;
|
|
74
|
+
|
|
75
|
+
setFocused(true);
|
|
76
|
+
(_a = numberInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
var handleFocus = function handleFocus() {
|
|
80
|
+
setFocused(true);
|
|
81
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(value);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
var handleBlur = function handleBlur(e) {
|
|
85
|
+
setFocused(false);
|
|
86
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
var controlMinWidth = (labelSize === null || labelSize === void 0 ? void 0 : labelSize.width) ? labelSize.width + baseMinWidth : undefined;
|
|
90
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
91
|
+
className: classNames('label-number-input-warper', className),
|
|
92
|
+
id: id,
|
|
93
|
+
style: {
|
|
94
|
+
minWidth: controlMinWidth
|
|
95
|
+
}
|
|
96
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
className: classNames('label-number-input-field', {
|
|
98
|
+
'label-number-input-focused': focused || !isUndefined(value)
|
|
99
|
+
})
|
|
100
|
+
}, /*#__PURE__*/React.createElement(NumberInput, __assign({}, omit(props, ['onChange', 'onBlur', 'onFocus', 'className', 'label', 'placeholder']), {
|
|
101
|
+
ref: numberInputRef,
|
|
102
|
+
"data-value": !isUndefined(value) ? ("" + value).length : 0,
|
|
103
|
+
value: value,
|
|
104
|
+
onBlur: handleBlur,
|
|
105
|
+
onFocus: handleFocus,
|
|
106
|
+
className: "label-number-input",
|
|
107
|
+
onChange: function onChange(inputValue) {
|
|
108
|
+
return setValue(inputValue);
|
|
109
|
+
}
|
|
110
|
+
})), /*#__PURE__*/React.createElement("label", {
|
|
111
|
+
className: "label-number-input-text",
|
|
112
|
+
onClick: handleLabelClick
|
|
113
|
+
}, label)));
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export default LabelNumberInput;
|
|
117
|
+
LabelNumberInput.Option = Option;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.label-number-input {
|
|
2
|
+
z-index: 1;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
padding: 19px 15px 2px 15px;
|
|
6
|
+
color: #263241;
|
|
7
|
+
font-size: 14px;
|
|
8
|
+
line-height: 16px;
|
|
9
|
+
border: 0;
|
|
10
|
+
outline: 0;
|
|
11
|
+
}
|
|
12
|
+
.label-number-input:focus + label,
|
|
13
|
+
.label-number-input:not([data-value='0']) + label {
|
|
14
|
+
transform: translateY(-8px) scale(0.8);
|
|
15
|
+
}
|
|
16
|
+
.label-number-input-field {
|
|
17
|
+
height: 45px;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
border: 1px solid #e5e5e5;
|
|
20
|
+
border-radius: 8px;
|
|
21
|
+
transition: border 0.3s;
|
|
22
|
+
}
|
|
23
|
+
.label-number-input-focused {
|
|
24
|
+
border-color: #000;
|
|
25
|
+
}
|
|
26
|
+
.label-number-input-warper {
|
|
27
|
+
position: relative;
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 100%;
|
|
30
|
+
}
|
|
31
|
+
.label-number-input-text {
|
|
32
|
+
position: absolute;
|
|
33
|
+
top: 12px;
|
|
34
|
+
left: 15px;
|
|
35
|
+
z-index: 2;
|
|
36
|
+
height: 20px;
|
|
37
|
+
color: #9aa5b5;
|
|
38
|
+
font-size: 14px;
|
|
39
|
+
line-height: 20px;
|
|
40
|
+
transform-origin: top left;
|
|
41
|
+
cursor: text;
|
|
42
|
+
transition: all 0.2s ease-out;
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
@import '../../style/themes/default.less';
|
|
2
|
+
|
|
3
|
+
@color_263241: #263241;
|
|
4
|
+
@color_9aa5b5: #9aa5b5;
|
|
5
|
+
@color_e5e5e5: #e5e5e5;
|
|
6
|
+
|
|
7
|
+
@font-size-base: 14px;
|
|
8
|
+
@font-size-lg: @font-size-base + 2px;
|
|
9
|
+
|
|
10
|
+
@font-weight-500: 500;
|
|
11
|
+
|
|
12
|
+
.label-number-input {
|
|
13
|
+
z-index: 1;
|
|
14
|
+
width: 100%;
|
|
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
|
+
|
|
36
|
+
&-focused {
|
|
37
|
+
border-color: @labelFocusBorderColor;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&-warper {
|
|
41
|
+
position: relative;
|
|
42
|
+
width: 100%;
|
|
43
|
+
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;
|
|
53
|
+
font-size: @font-size-base;
|
|
54
|
+
line-height: 20px;
|
|
55
|
+
transform-origin: top left;
|
|
56
|
+
cursor: text;
|
|
57
|
+
transition: all 0.2s ease-out;
|
|
58
|
+
}
|
|
59
|
+
}
|
package/es/label-select/index.js
CHANGED
|
@@ -44,7 +44,7 @@ var __read = this && this.__read || function (o, n) {
|
|
|
44
44
|
import React from 'react';
|
|
45
45
|
import useControllableValue from 'ahooks/lib/useControllableValue';
|
|
46
46
|
import Select from 'antd/es/select';
|
|
47
|
-
import
|
|
47
|
+
import isUndefined from 'lodash/isUndefined';
|
|
48
48
|
import classNames from 'classnames';
|
|
49
49
|
import ArrowDropDownFilled from 'a-icons/lib/ArrowDropDownFilled';
|
|
50
50
|
import omit from 'lodash/omit';
|
|
@@ -56,7 +56,7 @@ var __read = this && this.__read || function (o, n) {
|
|
|
56
56
|
|
|
57
57
|
import React from 'react';
|
|
58
58
|
import classNames from 'classnames';
|
|
59
|
-
import
|
|
59
|
+
import useControllableValue from 'ahooks/lib/useControllableValue';
|
|
60
60
|
import trimStart from 'lodash/trimStart';
|
|
61
61
|
|
|
62
62
|
var LabelTextArea = function LabelTextArea(props) {
|
|
@@ -2,9 +2,10 @@ import * as React from 'react';
|
|
|
2
2
|
import type { InputProps } from 'antd/es/input';
|
|
3
3
|
import * as dataTypeEnum from './const/dataTypeEnum';
|
|
4
4
|
import * as numberTypeEnum from './const/numberType';
|
|
5
|
+
export declare type NumberInputValueType = string | number;
|
|
5
6
|
export interface NumberInputProps extends Omit<InputProps, 'onChange' | 'onBlur'> {
|
|
6
7
|
/** 输入框的内容 */
|
|
7
|
-
value?:
|
|
8
|
+
value?: NumberInputValueType;
|
|
8
9
|
/** 输入数据的类型 */
|
|
9
10
|
numberType?: 'int' | 'float';
|
|
10
11
|
/** value的数据类型 */
|
|
@@ -20,9 +21,9 @@ export interface NumberInputProps extends Omit<InputProps, 'onChange' | 'onBlur'
|
|
|
20
21
|
/** 是否允许输入负数 */
|
|
21
22
|
enableMinus?: boolean;
|
|
22
23
|
/** 变化回调 */
|
|
23
|
-
onChange?: (value:
|
|
24
|
+
onChange?: (value: NumberInputValueType) => void;
|
|
24
25
|
/** 失去焦点回调 */
|
|
25
|
-
onBlur?: (value:
|
|
26
|
+
onBlur?: (value: NumberInputValueType) => void;
|
|
26
27
|
/** 按下回车的回调 */
|
|
27
28
|
onPressEnter?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
28
29
|
/** 带标签的 input,设置前置标签 */
|