assui 3.1.38 → 3.1.40
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-select-input/index.d.ts +3 -0
- package/es/condition-select-input/index.js +11 -4
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -1
- package/es/label-condition-select-input/index.d.ts +43 -0
- package/es/label-condition-select-input/index.js +144 -0
- package/es/label-condition-select-input/style/index.css +1259 -0
- package/es/label-condition-select-input/style/index.d.ts +3 -0
- package/es/label-condition-select-input/style/index.js +3 -0
- package/es/label-condition-select-input/style/index.less +32 -0
- package/es/label-customize-range-picker/index.js +23 -10
- package/lib/condition-select-input/index.d.ts +3 -0
- package/lib/condition-select-input/index.js +11 -4
- package/lib/index.d.ts +2 -0
- package/lib/index.js +8 -1
- package/lib/label-condition-select-input/index.d.ts +43 -0
- package/lib/label-condition-select-input/index.js +188 -0
- package/lib/label-condition-select-input/style/index.css +1259 -0
- package/lib/label-condition-select-input/style/index.d.ts +3 -0
- package/lib/label-condition-select-input/style/index.js +8 -0
- package/lib/label-condition-select-input/style/index.less +32 -0
- package/lib/label-customize-range-picker/index.js +23 -10
- package/package.json +2 -2
|
@@ -25,7 +25,10 @@ export interface ConditionSelectInputProps {
|
|
|
25
25
|
conditionInputProps?: ConditionInputProps;
|
|
26
26
|
/** 联动selectProps */
|
|
27
27
|
conditionSelectProps?: SelectProps;
|
|
28
|
+
/** onChange */
|
|
28
29
|
onChange?: (value: ValueType) => void;
|
|
30
|
+
/** onBlur */
|
|
31
|
+
onBlur?: (value: ValueType) => void;
|
|
29
32
|
/** 输入框类型 */
|
|
30
33
|
inputType?: InputTypeEnum;
|
|
31
34
|
/** select options */
|
|
@@ -55,7 +55,8 @@ var ConditionSelectInput = function ConditionSelectInput(props) {
|
|
|
55
55
|
_b = props.inputType,
|
|
56
56
|
inputType = _b === void 0 ? InputTypeEnum.CONDITION_INPUT : _b,
|
|
57
57
|
_c = props.optionsList,
|
|
58
|
-
optionsList = _c === void 0 ? [] : _c
|
|
58
|
+
optionsList = _c === void 0 ? [] : _c,
|
|
59
|
+
onBlur = props.onBlur;
|
|
59
60
|
var isInput = inputType === InputTypeEnum.CONDITION_INPUT;
|
|
60
61
|
var _d = __read(useControllableValue(props), 2),
|
|
61
62
|
selectInputValue = _d[0],
|
|
@@ -104,19 +105,24 @@ var ConditionSelectInput = function ConditionSelectInput(props) {
|
|
|
104
105
|
inputValue: inputValue
|
|
105
106
|
});
|
|
106
107
|
};
|
|
108
|
+
var onConditionSelectInputBlur = function onConditionSelectInputBlur() {
|
|
109
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(selectInputValue);
|
|
110
|
+
};
|
|
107
111
|
// 是否展示输入框
|
|
108
112
|
var isShowInput = !isNil(selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue) && !(hiddenInputKeys === null || hiddenInputKeys === void 0 ? void 0 : hiddenInputKeys.includes(selectInputValue.selectValue));
|
|
109
113
|
var typeInput = isInput ? /*#__PURE__*/React.createElement("div", {
|
|
110
114
|
className: "condition-select-input"
|
|
111
115
|
}, /*#__PURE__*/React.createElement(ConditionInput, __assign({}, conditionInputProps, {
|
|
112
116
|
onChange: onInputChange,
|
|
113
|
-
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.inputValue
|
|
117
|
+
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.inputValue,
|
|
118
|
+
onBlur: onConditionSelectInputBlur
|
|
114
119
|
}))) : /*#__PURE__*/React.createElement("div", {
|
|
115
120
|
className: "condition-select-select-input"
|
|
116
121
|
}, /*#__PURE__*/React.createElement(Select, __assign({}, conditionSelectProps, {
|
|
117
122
|
onChange: onTypeSelectChange,
|
|
118
123
|
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.inputValue,
|
|
119
|
-
options: subSelectOptions
|
|
124
|
+
options: subSelectOptions,
|
|
125
|
+
onBlur: onConditionSelectInputBlur
|
|
120
126
|
})));
|
|
121
127
|
return /*#__PURE__*/React.createElement("div", {
|
|
122
128
|
className: "condition-select-wrap"
|
|
@@ -128,7 +134,8 @@ var ConditionSelectInput = function ConditionSelectInput(props) {
|
|
|
128
134
|
}, /*#__PURE__*/React.createElement(Select, __assign({}, selectProps, {
|
|
129
135
|
onChange: onSelectChange,
|
|
130
136
|
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
131
|
-
options: optionsList
|
|
137
|
+
options: optionsList,
|
|
138
|
+
onBlur: onConditionSelectInputBlur
|
|
132
139
|
}))), isShowInput && typeInput);
|
|
133
140
|
};
|
|
134
141
|
export default ConditionSelectInput;
|
package/es/index.d.ts
CHANGED
|
@@ -78,3 +78,5 @@ export { default as BeautifulDnd } from './beautiful-dnd';
|
|
|
78
78
|
export { default as Resizable } from './resizable';
|
|
79
79
|
export type { FlexProps } from './flex';
|
|
80
80
|
export { default as Flex } from './flex';
|
|
81
|
+
export type { LabelConditionSelectInputProps } from './label-condition-select-input';
|
|
82
|
+
export { default as LabelConditionSelectInput } from './label-condition-select-input';
|
package/es/index.js
CHANGED
|
@@ -39,4 +39,5 @@ export { default as LabelCustomizeRangePicker } from './label-customize-range-pi
|
|
|
39
39
|
export { default as RichTextEditor } from './rich-text-editor';
|
|
40
40
|
export { default as BeautifulDnd } from './beautiful-dnd';
|
|
41
41
|
export { default as Resizable } from './resizable';
|
|
42
|
-
export { default as Flex } from './flex';
|
|
42
|
+
export { default as Flex } from './flex';
|
|
43
|
+
export { default as LabelConditionSelectInput } from './label-condition-select-input';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { LabelConditionInputProps } from '../label-condition-input';
|
|
3
|
+
import type { LabelSelectProps } from '../label-select';
|
|
4
|
+
export declare enum InputTypeEnum {
|
|
5
|
+
CONDITION_INPUT = "conditionInput",
|
|
6
|
+
SELECT = "select"
|
|
7
|
+
}
|
|
8
|
+
declare type SelectOptionsType = {
|
|
9
|
+
value: number;
|
|
10
|
+
label: string;
|
|
11
|
+
};
|
|
12
|
+
export interface MainSelectOptionsType extends SelectOptionsType {
|
|
13
|
+
children?: SelectOptionsType[];
|
|
14
|
+
}
|
|
15
|
+
export interface ValueType {
|
|
16
|
+
selectValue?: number | string | null;
|
|
17
|
+
inputValue?: LabelSelectProps['value'] | LabelConditionInputProps['value'];
|
|
18
|
+
}
|
|
19
|
+
export interface LabelConditionSelectInputProps {
|
|
20
|
+
value?: ValueType;
|
|
21
|
+
/** 不需要展示联动输入框的字段值 */
|
|
22
|
+
hiddenInputKeys?: ValueType['selectValue'][];
|
|
23
|
+
/** selectProps */
|
|
24
|
+
selectProps?: LabelSelectProps;
|
|
25
|
+
/** 联动inputProps */
|
|
26
|
+
conditionInputProps?: LabelConditionInputProps;
|
|
27
|
+
/** 联动selectProps */
|
|
28
|
+
conditionSelectProps?: LabelSelectProps;
|
|
29
|
+
/** onChange */
|
|
30
|
+
onChange?: (value: ValueType) => void;
|
|
31
|
+
/** onBlur */
|
|
32
|
+
onBlur?: (value: ValueType) => void;
|
|
33
|
+
/** 输入框类型 */
|
|
34
|
+
inputType?: InputTypeEnum;
|
|
35
|
+
/** select options */
|
|
36
|
+
optionsList: MainSelectOptionsType[];
|
|
37
|
+
/** label */
|
|
38
|
+
label?: React.ReactNode;
|
|
39
|
+
/** 样式 */
|
|
40
|
+
className?: string;
|
|
41
|
+
}
|
|
42
|
+
declare const LabelConditionSelect: (props: LabelConditionSelectInputProps) => JSX.Element;
|
|
43
|
+
export default LabelConditionSelect;
|
|
@@ -0,0 +1,144 @@
|
|
|
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
|
+
for (var p in s) {
|
|
6
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __read = this && this.__read || function (o, n) {
|
|
14
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
+
if (!m) return o;
|
|
16
|
+
var i = m.call(o),
|
|
17
|
+
r,
|
|
18
|
+
ar = [],
|
|
19
|
+
e;
|
|
20
|
+
try {
|
|
21
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
22
|
+
ar.push(r.value);
|
|
23
|
+
}
|
|
24
|
+
} catch (error) {
|
|
25
|
+
e = {
|
|
26
|
+
error: error
|
|
27
|
+
};
|
|
28
|
+
} finally {
|
|
29
|
+
try {
|
|
30
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
31
|
+
} finally {
|
|
32
|
+
if (e) throw e.error;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return ar;
|
|
36
|
+
};
|
|
37
|
+
import isNil from 'lodash/isNil';
|
|
38
|
+
import classNames from 'classnames';
|
|
39
|
+
import React, { useEffect, useState } from 'react';
|
|
40
|
+
import useControllableValue from "ahooks/es/useControllableValue";
|
|
41
|
+
import LabelConditionInput from '../label-condition-input';
|
|
42
|
+
import LabelSelect from '../label-select';
|
|
43
|
+
export var InputTypeEnum;
|
|
44
|
+
(function (InputTypeEnum) {
|
|
45
|
+
InputTypeEnum["CONDITION_INPUT"] = "conditionInput";
|
|
46
|
+
InputTypeEnum["SELECT"] = "select";
|
|
47
|
+
})(InputTypeEnum || (InputTypeEnum = {}));
|
|
48
|
+
var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
49
|
+
var value = props.value,
|
|
50
|
+
_a = props.hiddenInputKeys,
|
|
51
|
+
hiddenInputKeys = _a === void 0 ? [] : _a,
|
|
52
|
+
selectProps = props.selectProps,
|
|
53
|
+
conditionInputProps = props.conditionInputProps,
|
|
54
|
+
conditionSelectProps = props.conditionSelectProps,
|
|
55
|
+
_b = props.inputType,
|
|
56
|
+
inputType = _b === void 0 ? InputTypeEnum.CONDITION_INPUT : _b,
|
|
57
|
+
_c = props.optionsList,
|
|
58
|
+
optionsList = _c === void 0 ? [] : _c,
|
|
59
|
+
label = props.label,
|
|
60
|
+
className = props.className,
|
|
61
|
+
onBlur = props.onBlur;
|
|
62
|
+
var isInput = inputType === InputTypeEnum.CONDITION_INPUT;
|
|
63
|
+
var _d = __read(useControllableValue(props), 2),
|
|
64
|
+
selectInputValue = _d[0],
|
|
65
|
+
setSelectInputValue = _d[1];
|
|
66
|
+
var _e = __read(useState([]), 2),
|
|
67
|
+
subSelectOptions = _e[0],
|
|
68
|
+
setSubSelectOptions = _e[1];
|
|
69
|
+
useEffect(function () {
|
|
70
|
+
if (value && value.selectValue && optionsList.length) {
|
|
71
|
+
var _a = __read(optionsList.filter(function (item) {
|
|
72
|
+
return item.value === value.selectValue;
|
|
73
|
+
}), 1),
|
|
74
|
+
selectValueItem = _a[0];
|
|
75
|
+
if (selectValueItem && selectValueItem.children) {
|
|
76
|
+
setSubSelectOptions(selectValueItem.children);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}, [value, optionsList]);
|
|
80
|
+
var onSelectChange = function onSelectChange(selectValue) {
|
|
81
|
+
var inputValue = isInput ? '' : undefined;
|
|
82
|
+
setSelectInputValue({
|
|
83
|
+
selectValue: selectValue,
|
|
84
|
+
inputValue: inputValue
|
|
85
|
+
});
|
|
86
|
+
if (isInput || isNil(selectValue)) {
|
|
87
|
+
setSubSelectOptions([]);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
var _a = __read(optionsList.filter(function (item) {
|
|
91
|
+
return item.value === selectValue;
|
|
92
|
+
}), 1),
|
|
93
|
+
selectValueItem = _a[0];
|
|
94
|
+
if (selectValueItem.children) {
|
|
95
|
+
setSubSelectOptions(selectValueItem.children);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var onInputChange = function onInputChange(inputValue) {
|
|
99
|
+
setSelectInputValue({
|
|
100
|
+
selectValue: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
101
|
+
inputValue: inputValue
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
var onTypeSelectChange = function onTypeSelectChange(inputValue) {
|
|
105
|
+
setSelectInputValue({
|
|
106
|
+
selectValue: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
107
|
+
inputValue: inputValue
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
var onLabelConditionSelectInputBlur = function onLabelConditionSelectInputBlur() {
|
|
111
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(selectInputValue);
|
|
112
|
+
};
|
|
113
|
+
// 是否展示输入框
|
|
114
|
+
var isShowInput = !isNil(selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue) && !(hiddenInputKeys === null || hiddenInputKeys === void 0 ? void 0 : hiddenInputKeys.includes(selectInputValue.selectValue));
|
|
115
|
+
var typeInput = isInput ? /*#__PURE__*/React.createElement(LabelConditionInput, __assign({}, conditionInputProps, {
|
|
116
|
+
onChange: onInputChange,
|
|
117
|
+
className: "label-condition-select-second-input",
|
|
118
|
+
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.inputValue,
|
|
119
|
+
onBlur: onLabelConditionSelectInputBlur
|
|
120
|
+
})) : /*#__PURE__*/React.createElement("div", {
|
|
121
|
+
className: "label-condition-select-second-select"
|
|
122
|
+
}, /*#__PURE__*/React.createElement(LabelSelect, __assign({}, conditionSelectProps, {
|
|
123
|
+
onChange: onTypeSelectChange,
|
|
124
|
+
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.inputValue,
|
|
125
|
+
options: subSelectOptions,
|
|
126
|
+
onBlur: onLabelConditionSelectInputBlur
|
|
127
|
+
})));
|
|
128
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
129
|
+
className: classNames('label-condition-select', className)
|
|
130
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
131
|
+
className: classNames('label-condition-select-selector', {
|
|
132
|
+
'label-condition-select-two-select-selector': !isInput,
|
|
133
|
+
'label-condition-select-only-selector': !isShowInput
|
|
134
|
+
})
|
|
135
|
+
}, /*#__PURE__*/React.createElement(LabelSelect, __assign({
|
|
136
|
+
label: label
|
|
137
|
+
}, selectProps, {
|
|
138
|
+
onChange: onSelectChange,
|
|
139
|
+
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
140
|
+
options: optionsList,
|
|
141
|
+
onBlur: onLabelConditionSelectInputBlur
|
|
142
|
+
}))), isShowInput && typeInput);
|
|
143
|
+
};
|
|
144
|
+
export default LabelConditionSelect;
|