assui 3.1.45 → 3.1.47
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 +6 -0
- package/es/condition-select-input/index.js +33 -23
- package/es/label-condition-select-input/index.d.ts +9 -5
- package/es/label-condition-select-input/index.js +24 -26
- package/lib/condition-select-input/index.d.ts +6 -0
- package/lib/condition-select-input/index.js +34 -24
- package/lib/label-condition-select-input/index.d.ts +9 -5
- package/lib/label-condition-select-input/index.js +25 -27
- package/package.json +3 -3
|
@@ -4,6 +4,11 @@ export declare enum InputTypeEnum {
|
|
|
4
4
|
CONDITION_INPUT = "conditionInput",
|
|
5
5
|
SELECT = "select"
|
|
6
6
|
}
|
|
7
|
+
export declare enum EntryTypeEnum {
|
|
8
|
+
FIRST_ENTRY = "firstEntry",
|
|
9
|
+
SECOND_ENTRY = "secondEntry"
|
|
10
|
+
}
|
|
11
|
+
export declare type ChangedEntryType = typeof EntryTypeEnum[keyof typeof EntryTypeEnum];
|
|
7
12
|
declare type SelectOptionsType = {
|
|
8
13
|
value: number;
|
|
9
14
|
label: string;
|
|
@@ -15,6 +20,7 @@ export interface ValueType {
|
|
|
15
20
|
selectValue?: number | string | null;
|
|
16
21
|
inputValue?: SelectProps['value'] | ConditionInputProps['value'];
|
|
17
22
|
finalSelectValue?: SelectProps['value'] | ConditionInputProps['value'][];
|
|
23
|
+
changedEntryType: ChangedEntryType;
|
|
18
24
|
}
|
|
19
25
|
export interface ConditionSelectInputProps {
|
|
20
26
|
value?: ValueType;
|
|
@@ -46,6 +46,11 @@ export var InputTypeEnum;
|
|
|
46
46
|
InputTypeEnum["CONDITION_INPUT"] = "conditionInput";
|
|
47
47
|
InputTypeEnum["SELECT"] = "select";
|
|
48
48
|
})(InputTypeEnum || (InputTypeEnum = {}));
|
|
49
|
+
export var EntryTypeEnum;
|
|
50
|
+
(function (EntryTypeEnum) {
|
|
51
|
+
EntryTypeEnum["FIRST_ENTRY"] = "firstEntry";
|
|
52
|
+
EntryTypeEnum["SECOND_ENTRY"] = "secondEntry";
|
|
53
|
+
})(EntryTypeEnum || (EntryTypeEnum = {}));
|
|
49
54
|
/** 找所有的子代选项 */
|
|
50
55
|
var findAllSubSelectItems = function findAllSubSelectItems(dataSource, key) {
|
|
51
56
|
var _a, _b;
|
|
@@ -91,7 +96,8 @@ var ConditionSelectInput = function ConditionSelectInput(props) {
|
|
|
91
96
|
var inputValue = isInput ? '' : undefined;
|
|
92
97
|
var finalSelectInputValue = {
|
|
93
98
|
selectValue: selectValue,
|
|
94
|
-
inputValue: inputValue
|
|
99
|
+
inputValue: inputValue,
|
|
100
|
+
changedEntryType: EntryTypeEnum.FIRST_ENTRY
|
|
95
101
|
};
|
|
96
102
|
if (isSubSelectMultiple) {
|
|
97
103
|
finalSelectInputValue = __assign(__assign({}, finalSelectInputValue), {
|
|
@@ -111,16 +117,11 @@ var ConditionSelectInput = function ConditionSelectInput(props) {
|
|
|
111
117
|
setSubSelectOptions(selectValueItem.children);
|
|
112
118
|
}
|
|
113
119
|
};
|
|
114
|
-
var onInputChange = function onInputChange(inputValue) {
|
|
115
|
-
setSelectInputValue({
|
|
116
|
-
selectValue: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
117
|
-
inputValue: inputValue
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
120
|
var onTypeSelectChange = function onTypeSelectChange(inputValue) {
|
|
121
121
|
var finalSelectInputValue = {
|
|
122
122
|
selectValue: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
123
|
-
inputValue: inputValue
|
|
123
|
+
inputValue: inputValue,
|
|
124
|
+
changedEntryType: EntryTypeEnum.SECOND_ENTRY
|
|
124
125
|
};
|
|
125
126
|
if (isSubSelectMultiple) {
|
|
126
127
|
finalSelectInputValue = __assign(__assign({}, finalSelectInputValue), {
|
|
@@ -129,14 +130,26 @@ var ConditionSelectInput = function ConditionSelectInput(props) {
|
|
|
129
130
|
}
|
|
130
131
|
setSelectInputValue(finalSelectInputValue);
|
|
131
132
|
};
|
|
132
|
-
var
|
|
133
|
-
|
|
133
|
+
var onInputChange = function onInputChange(inputValue) {
|
|
134
|
+
var finalValue = {
|
|
135
|
+
selectValue: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
136
|
+
inputValue: inputValue,
|
|
137
|
+
changedEntryType: EntryTypeEnum.SECOND_ENTRY
|
|
138
|
+
};
|
|
139
|
+
setSelectInputValue(finalValue);
|
|
140
|
+
};
|
|
141
|
+
/** 联级选择框失去焦点 */
|
|
142
|
+
var onConditionSelectInputBlur = function onConditionSelectInputBlur(blurEntryType) {
|
|
143
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(__assign(__assign({}, selectInputValue), {
|
|
144
|
+
changedEntryType: blurEntryType
|
|
145
|
+
}));
|
|
134
146
|
};
|
|
135
147
|
/** 二级下拉框清空 */
|
|
136
148
|
var onTypeSelectClear = function onTypeSelectClear() {
|
|
137
149
|
var finalSelectInputValue = {
|
|
138
150
|
selectValue: selectInputValue.selectValue,
|
|
139
|
-
inputValue: []
|
|
151
|
+
inputValue: [],
|
|
152
|
+
changedEntryType: EntryTypeEnum.SECOND_ENTRY
|
|
140
153
|
};
|
|
141
154
|
if (isSubSelectMultiple) {
|
|
142
155
|
finalSelectInputValue = __assign(__assign({}, finalSelectInputValue), {
|
|
@@ -145,14 +158,6 @@ var ConditionSelectInput = function ConditionSelectInput(props) {
|
|
|
145
158
|
}
|
|
146
159
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(finalSelectInputValue);
|
|
147
160
|
};
|
|
148
|
-
/** 一级下拉框清空 */
|
|
149
|
-
var onSelectClear = function onSelectClear() {
|
|
150
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
151
|
-
selectValue: undefined,
|
|
152
|
-
inputValue: undefined,
|
|
153
|
-
finalSelectValue: undefined
|
|
154
|
-
});
|
|
155
|
-
};
|
|
156
161
|
// 是否展示输入框
|
|
157
162
|
var isShowInput = !isNil(selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue) && !(hiddenInputKeys === null || hiddenInputKeys === void 0 ? void 0 : hiddenInputKeys.includes(selectInputValue.selectValue));
|
|
158
163
|
var typeInput = isInput ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -160,14 +165,18 @@ var ConditionSelectInput = function ConditionSelectInput(props) {
|
|
|
160
165
|
}, /*#__PURE__*/React.createElement(ConditionInput, __assign({}, conditionInputProps, {
|
|
161
166
|
onChange: onInputChange,
|
|
162
167
|
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.inputValue,
|
|
163
|
-
onBlur:
|
|
168
|
+
onBlur: function onBlur() {
|
|
169
|
+
return onConditionSelectInputBlur(EntryTypeEnum.SECOND_ENTRY);
|
|
170
|
+
}
|
|
164
171
|
}))) : /*#__PURE__*/React.createElement("div", {
|
|
165
172
|
className: "condition-select-select-input"
|
|
166
173
|
}, /*#__PURE__*/React.createElement(Select, __assign({}, conditionSelectProps, {
|
|
167
174
|
onChange: onTypeSelectChange,
|
|
168
175
|
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.inputValue,
|
|
169
176
|
options: subSelectOptions,
|
|
170
|
-
onBlur:
|
|
177
|
+
onBlur: function onBlur() {
|
|
178
|
+
return onConditionSelectInputBlur(EntryTypeEnum.SECOND_ENTRY);
|
|
179
|
+
},
|
|
171
180
|
onClear: onTypeSelectClear
|
|
172
181
|
})));
|
|
173
182
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -181,8 +190,9 @@ var ConditionSelectInput = function ConditionSelectInput(props) {
|
|
|
181
190
|
onChange: onSelectChange,
|
|
182
191
|
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
183
192
|
options: optionsList,
|
|
184
|
-
onBlur:
|
|
185
|
-
|
|
193
|
+
onBlur: function onBlur() {
|
|
194
|
+
return onConditionSelectInputBlur(EntryTypeEnum.FIRST_ENTRY);
|
|
195
|
+
}
|
|
186
196
|
}))), isShowInput && typeInput);
|
|
187
197
|
};
|
|
188
198
|
export default ConditionSelectInput;
|
|
@@ -5,7 +5,11 @@ export declare enum InputTypeEnum {
|
|
|
5
5
|
CONDITION_INPUT = "conditionInput",
|
|
6
6
|
SELECT = "select"
|
|
7
7
|
}
|
|
8
|
-
export declare
|
|
8
|
+
export declare enum EntryTypeEnum {
|
|
9
|
+
FIRST_ENTRY = "firstEntry",
|
|
10
|
+
SECOND_ENTRY = "secondEntry"
|
|
11
|
+
}
|
|
12
|
+
export declare type ChangedEntryType = typeof EntryTypeEnum[keyof typeof EntryTypeEnum];
|
|
9
13
|
declare type SelectOptionsType = {
|
|
10
14
|
value: number;
|
|
11
15
|
label: string;
|
|
@@ -17,6 +21,7 @@ export interface ValueType {
|
|
|
17
21
|
selectValue?: number | string | null;
|
|
18
22
|
inputValue?: LabelSelectProps['value'] | LabelConditionInputProps['value'];
|
|
19
23
|
finalSelectValue?: LabelSelectProps['value'] | LabelConditionInputProps['value'][];
|
|
24
|
+
changedEntryType: ChangedEntryType;
|
|
20
25
|
}
|
|
21
26
|
export interface LabelConditionSelectInputProps {
|
|
22
27
|
value?: ValueType;
|
|
@@ -28,11 +33,10 @@ export interface LabelConditionSelectInputProps {
|
|
|
28
33
|
conditionInputProps?: LabelConditionInputProps;
|
|
29
34
|
/** 联动selectProps */
|
|
30
35
|
conditionSelectProps?: LabelSelectProps;
|
|
31
|
-
onChangeSelectType?: (changeSelectType: ChangeSelectType, value?: ValueType) => void;
|
|
32
36
|
/** onChange */
|
|
33
37
|
onChange?: (value: ValueType) => void;
|
|
34
38
|
/** onBlur */
|
|
35
|
-
onBlur?: (value: ValueType
|
|
39
|
+
onBlur?: (value: ValueType) => void;
|
|
36
40
|
/** 输入框类型 */
|
|
37
41
|
inputType?: InputTypeEnum;
|
|
38
42
|
/** select options */
|
|
@@ -42,5 +46,5 @@ export interface LabelConditionSelectInputProps {
|
|
|
42
46
|
/** 样式 */
|
|
43
47
|
className?: string;
|
|
44
48
|
}
|
|
45
|
-
declare const
|
|
46
|
-
export default
|
|
49
|
+
declare const LabelConditionSelectInput: (props: LabelConditionSelectInputProps) => JSX.Element;
|
|
50
|
+
export default LabelConditionSelectInput;
|
|
@@ -46,6 +46,11 @@ export var InputTypeEnum;
|
|
|
46
46
|
InputTypeEnum["CONDITION_INPUT"] = "conditionInput";
|
|
47
47
|
InputTypeEnum["SELECT"] = "select";
|
|
48
48
|
})(InputTypeEnum || (InputTypeEnum = {}));
|
|
49
|
+
export var EntryTypeEnum;
|
|
50
|
+
(function (EntryTypeEnum) {
|
|
51
|
+
EntryTypeEnum["FIRST_ENTRY"] = "firstEntry";
|
|
52
|
+
EntryTypeEnum["SECOND_ENTRY"] = "secondEntry";
|
|
53
|
+
})(EntryTypeEnum || (EntryTypeEnum = {}));
|
|
49
54
|
/** 找所有的子代选项 */
|
|
50
55
|
var findAllSubSelectItems = function findAllSubSelectItems(dataSource, key) {
|
|
51
56
|
var _a, _b;
|
|
@@ -55,7 +60,7 @@ var findAllSubSelectItems = function findAllSubSelectItems(dataSource, key) {
|
|
|
55
60
|
return subItem.value;
|
|
56
61
|
});
|
|
57
62
|
};
|
|
58
|
-
var
|
|
63
|
+
var LabelConditionSelectInput = function LabelConditionSelectInput(props) {
|
|
59
64
|
var value = props.value,
|
|
60
65
|
_a = props.hiddenInputKeys,
|
|
61
66
|
hiddenInputKeys = _a === void 0 ? [] : _a,
|
|
@@ -66,7 +71,6 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
66
71
|
inputType = _b === void 0 ? InputTypeEnum.CONDITION_INPUT : _b,
|
|
67
72
|
_c = props.optionsList,
|
|
68
73
|
optionsList = _c === void 0 ? [] : _c,
|
|
69
|
-
onChangeSelectType = props.onChangeSelectType,
|
|
70
74
|
label = props.label,
|
|
71
75
|
className = props.className,
|
|
72
76
|
onBlur = props.onBlur;
|
|
@@ -95,7 +99,8 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
95
99
|
var inputValue = isInput ? '' : undefined;
|
|
96
100
|
var finalSelectInputValue = {
|
|
97
101
|
selectValue: selectValue,
|
|
98
|
-
inputValue: inputValue
|
|
102
|
+
inputValue: inputValue,
|
|
103
|
+
changedEntryType: EntryTypeEnum.FIRST_ENTRY
|
|
99
104
|
};
|
|
100
105
|
if (isSubSelectMultiple) {
|
|
101
106
|
finalSelectInputValue = __assign(__assign({}, finalSelectInputValue), {
|
|
@@ -103,7 +108,6 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
103
108
|
});
|
|
104
109
|
}
|
|
105
110
|
setSelectInputValue(finalSelectInputValue);
|
|
106
|
-
onChangeSelectType === null || onChangeSelectType === void 0 ? void 0 : onChangeSelectType(InputTypeEnum.SELECT, finalSelectInputValue);
|
|
107
111
|
if (isInput || isNil(selectValue)) {
|
|
108
112
|
setSubSelectOptions([]);
|
|
109
113
|
return;
|
|
@@ -119,15 +123,16 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
119
123
|
var onInputChange = function onInputChange(inputValue) {
|
|
120
124
|
var finalValue = {
|
|
121
125
|
selectValue: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
122
|
-
inputValue: inputValue
|
|
126
|
+
inputValue: inputValue,
|
|
127
|
+
changedEntryType: EntryTypeEnum.SECOND_ENTRY
|
|
123
128
|
};
|
|
124
129
|
setSelectInputValue(finalValue);
|
|
125
|
-
onChangeSelectType === null || onChangeSelectType === void 0 ? void 0 : onChangeSelectType(InputTypeEnum.SELECT, finalValue);
|
|
126
130
|
};
|
|
127
131
|
var onTypeSelectChange = function onTypeSelectChange(inputValue) {
|
|
128
132
|
var finalSelectInputValue = {
|
|
129
133
|
selectValue: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
130
|
-
inputValue: inputValue
|
|
134
|
+
inputValue: inputValue,
|
|
135
|
+
changedEntryType: EntryTypeEnum.SECOND_ENTRY
|
|
131
136
|
};
|
|
132
137
|
if (isSubSelectMultiple) {
|
|
133
138
|
finalSelectInputValue = __assign(__assign({}, finalSelectInputValue), {
|
|
@@ -135,32 +140,26 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
135
140
|
});
|
|
136
141
|
}
|
|
137
142
|
setSelectInputValue(finalSelectInputValue);
|
|
138
|
-
onChangeSelectType === null || onChangeSelectType === void 0 ? void 0 : onChangeSelectType(InputTypeEnum.CONDITION_INPUT, finalSelectInputValue);
|
|
139
143
|
};
|
|
140
144
|
/** 联级选择框失去焦点 */
|
|
141
|
-
var onLabelConditionSelectInputBlur = function onLabelConditionSelectInputBlur(
|
|
142
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur(selectInputValue,
|
|
145
|
+
var onLabelConditionSelectInputBlur = function onLabelConditionSelectInputBlur(blurEntryType) {
|
|
146
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(__assign(__assign({}, selectInputValue), {
|
|
147
|
+
changedEntryType: blurEntryType
|
|
148
|
+
}));
|
|
143
149
|
};
|
|
144
150
|
/** 二级下拉框清空 */
|
|
145
151
|
var onTypeSelectClear = function onTypeSelectClear() {
|
|
146
152
|
var finalSelectInputValue = {
|
|
147
153
|
selectValue: selectInputValue.selectValue,
|
|
148
|
-
inputValue: []
|
|
154
|
+
inputValue: [],
|
|
155
|
+
changedEntryType: EntryTypeEnum.SECOND_ENTRY
|
|
149
156
|
};
|
|
150
157
|
if (isSubSelectMultiple) {
|
|
151
158
|
finalSelectInputValue = __assign(__assign({}, finalSelectInputValue), {
|
|
152
159
|
finalSelectValue: findAllSubSelectItems(optionsList, selectInputValue.selectValue)
|
|
153
160
|
});
|
|
154
161
|
}
|
|
155
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur(finalSelectInputValue
|
|
156
|
-
};
|
|
157
|
-
/** 一级下拉框清空 */
|
|
158
|
-
var onSelectClear = function onSelectClear() {
|
|
159
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
160
|
-
selectValue: undefined,
|
|
161
|
-
inputValue: undefined,
|
|
162
|
-
finalSelectValue: undefined
|
|
163
|
-
}, InputTypeEnum.CONDITION_INPUT);
|
|
162
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(finalSelectInputValue);
|
|
164
163
|
};
|
|
165
164
|
// 是否展示输入框
|
|
166
165
|
var isShowInput = !isNil(selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue) && !(hiddenInputKeys === null || hiddenInputKeys === void 0 ? void 0 : hiddenInputKeys.includes(selectInputValue.selectValue));
|
|
@@ -169,7 +168,7 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
169
168
|
className: "label-condition-select-second-input",
|
|
170
169
|
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.inputValue,
|
|
171
170
|
onBlur: function onBlur() {
|
|
172
|
-
return onLabelConditionSelectInputBlur(
|
|
171
|
+
return onLabelConditionSelectInputBlur(EntryTypeEnum.SECOND_ENTRY);
|
|
173
172
|
}
|
|
174
173
|
})) : /*#__PURE__*/React.createElement("div", {
|
|
175
174
|
className: "label-condition-select-second-select"
|
|
@@ -183,7 +182,7 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
183
182
|
(_a = subSelectRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
184
183
|
},
|
|
185
184
|
onBlur: function onBlur() {
|
|
186
|
-
return onLabelConditionSelectInputBlur(
|
|
185
|
+
return onLabelConditionSelectInputBlur(EntryTypeEnum.SECOND_ENTRY);
|
|
187
186
|
},
|
|
188
187
|
onClear: onTypeSelectClear
|
|
189
188
|
})));
|
|
@@ -201,9 +200,8 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
201
200
|
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
202
201
|
options: optionsList,
|
|
203
202
|
onBlur: function onBlur() {
|
|
204
|
-
return onLabelConditionSelectInputBlur(
|
|
205
|
-
}
|
|
206
|
-
onClear: onSelectClear
|
|
203
|
+
return onLabelConditionSelectInputBlur(EntryTypeEnum.FIRST_ENTRY);
|
|
204
|
+
}
|
|
207
205
|
}))), isShowInput && typeInput);
|
|
208
206
|
};
|
|
209
|
-
export default
|
|
207
|
+
export default LabelConditionSelectInput;
|
|
@@ -4,6 +4,11 @@ export declare enum InputTypeEnum {
|
|
|
4
4
|
CONDITION_INPUT = "conditionInput",
|
|
5
5
|
SELECT = "select"
|
|
6
6
|
}
|
|
7
|
+
export declare enum EntryTypeEnum {
|
|
8
|
+
FIRST_ENTRY = "firstEntry",
|
|
9
|
+
SECOND_ENTRY = "secondEntry"
|
|
10
|
+
}
|
|
11
|
+
export declare type ChangedEntryType = typeof EntryTypeEnum[keyof typeof EntryTypeEnum];
|
|
7
12
|
declare type SelectOptionsType = {
|
|
8
13
|
value: number;
|
|
9
14
|
label: string;
|
|
@@ -15,6 +20,7 @@ export interface ValueType {
|
|
|
15
20
|
selectValue?: number | string | null;
|
|
16
21
|
inputValue?: SelectProps['value'] | ConditionInputProps['value'];
|
|
17
22
|
finalSelectValue?: SelectProps['value'] | ConditionInputProps['value'][];
|
|
23
|
+
changedEntryType: ChangedEntryType;
|
|
18
24
|
}
|
|
19
25
|
export interface ConditionSelectInputProps {
|
|
20
26
|
value?: ValueType;
|
|
@@ -77,7 +77,7 @@ var __importDefault = this && this.__importDefault || function (mod) {
|
|
|
77
77
|
Object.defineProperty(exports, "__esModule", {
|
|
78
78
|
value: true
|
|
79
79
|
});
|
|
80
|
-
exports.InputTypeEnum = void 0;
|
|
80
|
+
exports.EntryTypeEnum = exports.InputTypeEnum = void 0;
|
|
81
81
|
var isNil_1 = __importDefault(require("lodash/isNil"));
|
|
82
82
|
var isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
83
83
|
var classnames_1 = __importDefault(require("classnames"));
|
|
@@ -90,6 +90,11 @@ var InputTypeEnum;
|
|
|
90
90
|
InputTypeEnum["CONDITION_INPUT"] = "conditionInput";
|
|
91
91
|
InputTypeEnum["SELECT"] = "select";
|
|
92
92
|
})(InputTypeEnum = exports.InputTypeEnum || (exports.InputTypeEnum = {}));
|
|
93
|
+
var EntryTypeEnum;
|
|
94
|
+
(function (EntryTypeEnum) {
|
|
95
|
+
EntryTypeEnum["FIRST_ENTRY"] = "firstEntry";
|
|
96
|
+
EntryTypeEnum["SECOND_ENTRY"] = "secondEntry";
|
|
97
|
+
})(EntryTypeEnum = exports.EntryTypeEnum || (exports.EntryTypeEnum = {}));
|
|
93
98
|
/** 找所有的子代选项 */
|
|
94
99
|
var findAllSubSelectItems = function findAllSubSelectItems(dataSource, key) {
|
|
95
100
|
var _a, _b;
|
|
@@ -135,7 +140,8 @@ var ConditionSelectInput = function ConditionSelectInput(props) {
|
|
|
135
140
|
var inputValue = isInput ? '' : undefined;
|
|
136
141
|
var finalSelectInputValue = {
|
|
137
142
|
selectValue: selectValue,
|
|
138
|
-
inputValue: inputValue
|
|
143
|
+
inputValue: inputValue,
|
|
144
|
+
changedEntryType: EntryTypeEnum.FIRST_ENTRY
|
|
139
145
|
};
|
|
140
146
|
if (isSubSelectMultiple) {
|
|
141
147
|
finalSelectInputValue = __assign(__assign({}, finalSelectInputValue), {
|
|
@@ -155,16 +161,11 @@ var ConditionSelectInput = function ConditionSelectInput(props) {
|
|
|
155
161
|
setSubSelectOptions(selectValueItem.children);
|
|
156
162
|
}
|
|
157
163
|
};
|
|
158
|
-
var onInputChange = function onInputChange(inputValue) {
|
|
159
|
-
setSelectInputValue({
|
|
160
|
-
selectValue: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
161
|
-
inputValue: inputValue
|
|
162
|
-
});
|
|
163
|
-
};
|
|
164
164
|
var onTypeSelectChange = function onTypeSelectChange(inputValue) {
|
|
165
165
|
var finalSelectInputValue = {
|
|
166
166
|
selectValue: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
167
|
-
inputValue: inputValue
|
|
167
|
+
inputValue: inputValue,
|
|
168
|
+
changedEntryType: EntryTypeEnum.SECOND_ENTRY
|
|
168
169
|
};
|
|
169
170
|
if (isSubSelectMultiple) {
|
|
170
171
|
finalSelectInputValue = __assign(__assign({}, finalSelectInputValue), {
|
|
@@ -173,14 +174,26 @@ var ConditionSelectInput = function ConditionSelectInput(props) {
|
|
|
173
174
|
}
|
|
174
175
|
setSelectInputValue(finalSelectInputValue);
|
|
175
176
|
};
|
|
176
|
-
var
|
|
177
|
-
|
|
177
|
+
var onInputChange = function onInputChange(inputValue) {
|
|
178
|
+
var finalValue = {
|
|
179
|
+
selectValue: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
180
|
+
inputValue: inputValue,
|
|
181
|
+
changedEntryType: EntryTypeEnum.SECOND_ENTRY
|
|
182
|
+
};
|
|
183
|
+
setSelectInputValue(finalValue);
|
|
184
|
+
};
|
|
185
|
+
/** 联级选择框失去焦点 */
|
|
186
|
+
var onConditionSelectInputBlur = function onConditionSelectInputBlur(blurEntryType) {
|
|
187
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(__assign(__assign({}, selectInputValue), {
|
|
188
|
+
changedEntryType: blurEntryType
|
|
189
|
+
}));
|
|
178
190
|
};
|
|
179
191
|
/** 二级下拉框清空 */
|
|
180
192
|
var onTypeSelectClear = function onTypeSelectClear() {
|
|
181
193
|
var finalSelectInputValue = {
|
|
182
194
|
selectValue: selectInputValue.selectValue,
|
|
183
|
-
inputValue: []
|
|
195
|
+
inputValue: [],
|
|
196
|
+
changedEntryType: EntryTypeEnum.SECOND_ENTRY
|
|
184
197
|
};
|
|
185
198
|
if (isSubSelectMultiple) {
|
|
186
199
|
finalSelectInputValue = __assign(__assign({}, finalSelectInputValue), {
|
|
@@ -189,14 +202,6 @@ var ConditionSelectInput = function ConditionSelectInput(props) {
|
|
|
189
202
|
}
|
|
190
203
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(finalSelectInputValue);
|
|
191
204
|
};
|
|
192
|
-
/** 一级下拉框清空 */
|
|
193
|
-
var onSelectClear = function onSelectClear() {
|
|
194
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
195
|
-
selectValue: undefined,
|
|
196
|
-
inputValue: undefined,
|
|
197
|
-
finalSelectValue: undefined
|
|
198
|
-
});
|
|
199
|
-
};
|
|
200
205
|
// 是否展示输入框
|
|
201
206
|
var isShowInput = !(0, isNil_1["default"])(selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue) && !(hiddenInputKeys === null || hiddenInputKeys === void 0 ? void 0 : hiddenInputKeys.includes(selectInputValue.selectValue));
|
|
202
207
|
var typeInput = isInput ? react_1["default"].createElement("div", {
|
|
@@ -204,14 +209,18 @@ var ConditionSelectInput = function ConditionSelectInput(props) {
|
|
|
204
209
|
}, react_1["default"].createElement(condition_input_1["default"], __assign({}, conditionInputProps, {
|
|
205
210
|
onChange: onInputChange,
|
|
206
211
|
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.inputValue,
|
|
207
|
-
onBlur:
|
|
212
|
+
onBlur: function onBlur() {
|
|
213
|
+
return onConditionSelectInputBlur(EntryTypeEnum.SECOND_ENTRY);
|
|
214
|
+
}
|
|
208
215
|
}))) : react_1["default"].createElement("div", {
|
|
209
216
|
className: "condition-select-select-input"
|
|
210
217
|
}, react_1["default"].createElement(select_1["default"], __assign({}, conditionSelectProps, {
|
|
211
218
|
onChange: onTypeSelectChange,
|
|
212
219
|
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.inputValue,
|
|
213
220
|
options: subSelectOptions,
|
|
214
|
-
onBlur:
|
|
221
|
+
onBlur: function onBlur() {
|
|
222
|
+
return onConditionSelectInputBlur(EntryTypeEnum.SECOND_ENTRY);
|
|
223
|
+
},
|
|
215
224
|
onClear: onTypeSelectClear
|
|
216
225
|
})));
|
|
217
226
|
return react_1["default"].createElement("div", {
|
|
@@ -225,8 +234,9 @@ var ConditionSelectInput = function ConditionSelectInput(props) {
|
|
|
225
234
|
onChange: onSelectChange,
|
|
226
235
|
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
227
236
|
options: optionsList,
|
|
228
|
-
onBlur:
|
|
229
|
-
|
|
237
|
+
onBlur: function onBlur() {
|
|
238
|
+
return onConditionSelectInputBlur(EntryTypeEnum.FIRST_ENTRY);
|
|
239
|
+
}
|
|
230
240
|
}))), isShowInput && typeInput);
|
|
231
241
|
};
|
|
232
242
|
exports["default"] = ConditionSelectInput;
|
|
@@ -5,7 +5,11 @@ export declare enum InputTypeEnum {
|
|
|
5
5
|
CONDITION_INPUT = "conditionInput",
|
|
6
6
|
SELECT = "select"
|
|
7
7
|
}
|
|
8
|
-
export declare
|
|
8
|
+
export declare enum EntryTypeEnum {
|
|
9
|
+
FIRST_ENTRY = "firstEntry",
|
|
10
|
+
SECOND_ENTRY = "secondEntry"
|
|
11
|
+
}
|
|
12
|
+
export declare type ChangedEntryType = typeof EntryTypeEnum[keyof typeof EntryTypeEnum];
|
|
9
13
|
declare type SelectOptionsType = {
|
|
10
14
|
value: number;
|
|
11
15
|
label: string;
|
|
@@ -17,6 +21,7 @@ export interface ValueType {
|
|
|
17
21
|
selectValue?: number | string | null;
|
|
18
22
|
inputValue?: LabelSelectProps['value'] | LabelConditionInputProps['value'];
|
|
19
23
|
finalSelectValue?: LabelSelectProps['value'] | LabelConditionInputProps['value'][];
|
|
24
|
+
changedEntryType: ChangedEntryType;
|
|
20
25
|
}
|
|
21
26
|
export interface LabelConditionSelectInputProps {
|
|
22
27
|
value?: ValueType;
|
|
@@ -28,11 +33,10 @@ export interface LabelConditionSelectInputProps {
|
|
|
28
33
|
conditionInputProps?: LabelConditionInputProps;
|
|
29
34
|
/** 联动selectProps */
|
|
30
35
|
conditionSelectProps?: LabelSelectProps;
|
|
31
|
-
onChangeSelectType?: (changeSelectType: ChangeSelectType, value?: ValueType) => void;
|
|
32
36
|
/** onChange */
|
|
33
37
|
onChange?: (value: ValueType) => void;
|
|
34
38
|
/** onBlur */
|
|
35
|
-
onBlur?: (value: ValueType
|
|
39
|
+
onBlur?: (value: ValueType) => void;
|
|
36
40
|
/** 输入框类型 */
|
|
37
41
|
inputType?: InputTypeEnum;
|
|
38
42
|
/** select options */
|
|
@@ -42,5 +46,5 @@ export interface LabelConditionSelectInputProps {
|
|
|
42
46
|
/** 样式 */
|
|
43
47
|
className?: string;
|
|
44
48
|
}
|
|
45
|
-
declare const
|
|
46
|
-
export default
|
|
49
|
+
declare const LabelConditionSelectInput: (props: LabelConditionSelectInputProps) => JSX.Element;
|
|
50
|
+
export default LabelConditionSelectInput;
|
|
@@ -77,7 +77,7 @@ var __importDefault = this && this.__importDefault || function (mod) {
|
|
|
77
77
|
Object.defineProperty(exports, "__esModule", {
|
|
78
78
|
value: true
|
|
79
79
|
});
|
|
80
|
-
exports.InputTypeEnum = void 0;
|
|
80
|
+
exports.EntryTypeEnum = exports.InputTypeEnum = void 0;
|
|
81
81
|
var isNil_1 = __importDefault(require("lodash/isNil"));
|
|
82
82
|
var isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
83
83
|
var classnames_1 = __importDefault(require("classnames"));
|
|
@@ -90,6 +90,11 @@ var InputTypeEnum;
|
|
|
90
90
|
InputTypeEnum["CONDITION_INPUT"] = "conditionInput";
|
|
91
91
|
InputTypeEnum["SELECT"] = "select";
|
|
92
92
|
})(InputTypeEnum = exports.InputTypeEnum || (exports.InputTypeEnum = {}));
|
|
93
|
+
var EntryTypeEnum;
|
|
94
|
+
(function (EntryTypeEnum) {
|
|
95
|
+
EntryTypeEnum["FIRST_ENTRY"] = "firstEntry";
|
|
96
|
+
EntryTypeEnum["SECOND_ENTRY"] = "secondEntry";
|
|
97
|
+
})(EntryTypeEnum = exports.EntryTypeEnum || (exports.EntryTypeEnum = {}));
|
|
93
98
|
/** 找所有的子代选项 */
|
|
94
99
|
var findAllSubSelectItems = function findAllSubSelectItems(dataSource, key) {
|
|
95
100
|
var _a, _b;
|
|
@@ -99,7 +104,7 @@ var findAllSubSelectItems = function findAllSubSelectItems(dataSource, key) {
|
|
|
99
104
|
return subItem.value;
|
|
100
105
|
});
|
|
101
106
|
};
|
|
102
|
-
var
|
|
107
|
+
var LabelConditionSelectInput = function LabelConditionSelectInput(props) {
|
|
103
108
|
var value = props.value,
|
|
104
109
|
_a = props.hiddenInputKeys,
|
|
105
110
|
hiddenInputKeys = _a === void 0 ? [] : _a,
|
|
@@ -110,7 +115,6 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
110
115
|
inputType = _b === void 0 ? InputTypeEnum.CONDITION_INPUT : _b,
|
|
111
116
|
_c = props.optionsList,
|
|
112
117
|
optionsList = _c === void 0 ? [] : _c,
|
|
113
|
-
onChangeSelectType = props.onChangeSelectType,
|
|
114
118
|
label = props.label,
|
|
115
119
|
className = props.className,
|
|
116
120
|
onBlur = props.onBlur;
|
|
@@ -139,7 +143,8 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
139
143
|
var inputValue = isInput ? '' : undefined;
|
|
140
144
|
var finalSelectInputValue = {
|
|
141
145
|
selectValue: selectValue,
|
|
142
|
-
inputValue: inputValue
|
|
146
|
+
inputValue: inputValue,
|
|
147
|
+
changedEntryType: EntryTypeEnum.FIRST_ENTRY
|
|
143
148
|
};
|
|
144
149
|
if (isSubSelectMultiple) {
|
|
145
150
|
finalSelectInputValue = __assign(__assign({}, finalSelectInputValue), {
|
|
@@ -147,7 +152,6 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
147
152
|
});
|
|
148
153
|
}
|
|
149
154
|
setSelectInputValue(finalSelectInputValue);
|
|
150
|
-
onChangeSelectType === null || onChangeSelectType === void 0 ? void 0 : onChangeSelectType(InputTypeEnum.SELECT, finalSelectInputValue);
|
|
151
155
|
if (isInput || (0, isNil_1["default"])(selectValue)) {
|
|
152
156
|
setSubSelectOptions([]);
|
|
153
157
|
return;
|
|
@@ -163,15 +167,16 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
163
167
|
var onInputChange = function onInputChange(inputValue) {
|
|
164
168
|
var finalValue = {
|
|
165
169
|
selectValue: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
166
|
-
inputValue: inputValue
|
|
170
|
+
inputValue: inputValue,
|
|
171
|
+
changedEntryType: EntryTypeEnum.SECOND_ENTRY
|
|
167
172
|
};
|
|
168
173
|
setSelectInputValue(finalValue);
|
|
169
|
-
onChangeSelectType === null || onChangeSelectType === void 0 ? void 0 : onChangeSelectType(InputTypeEnum.SELECT, finalValue);
|
|
170
174
|
};
|
|
171
175
|
var onTypeSelectChange = function onTypeSelectChange(inputValue) {
|
|
172
176
|
var finalSelectInputValue = {
|
|
173
177
|
selectValue: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
174
|
-
inputValue: inputValue
|
|
178
|
+
inputValue: inputValue,
|
|
179
|
+
changedEntryType: EntryTypeEnum.SECOND_ENTRY
|
|
175
180
|
};
|
|
176
181
|
if (isSubSelectMultiple) {
|
|
177
182
|
finalSelectInputValue = __assign(__assign({}, finalSelectInputValue), {
|
|
@@ -179,32 +184,26 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
179
184
|
});
|
|
180
185
|
}
|
|
181
186
|
setSelectInputValue(finalSelectInputValue);
|
|
182
|
-
onChangeSelectType === null || onChangeSelectType === void 0 ? void 0 : onChangeSelectType(InputTypeEnum.CONDITION_INPUT, finalSelectInputValue);
|
|
183
187
|
};
|
|
184
188
|
/** 联级选择框失去焦点 */
|
|
185
|
-
var onLabelConditionSelectInputBlur = function onLabelConditionSelectInputBlur(
|
|
186
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur(selectInputValue,
|
|
189
|
+
var onLabelConditionSelectInputBlur = function onLabelConditionSelectInputBlur(blurEntryType) {
|
|
190
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(__assign(__assign({}, selectInputValue), {
|
|
191
|
+
changedEntryType: blurEntryType
|
|
192
|
+
}));
|
|
187
193
|
};
|
|
188
194
|
/** 二级下拉框清空 */
|
|
189
195
|
var onTypeSelectClear = function onTypeSelectClear() {
|
|
190
196
|
var finalSelectInputValue = {
|
|
191
197
|
selectValue: selectInputValue.selectValue,
|
|
192
|
-
inputValue: []
|
|
198
|
+
inputValue: [],
|
|
199
|
+
changedEntryType: EntryTypeEnum.SECOND_ENTRY
|
|
193
200
|
};
|
|
194
201
|
if (isSubSelectMultiple) {
|
|
195
202
|
finalSelectInputValue = __assign(__assign({}, finalSelectInputValue), {
|
|
196
203
|
finalSelectValue: findAllSubSelectItems(optionsList, selectInputValue.selectValue)
|
|
197
204
|
});
|
|
198
205
|
}
|
|
199
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur(finalSelectInputValue
|
|
200
|
-
};
|
|
201
|
-
/** 一级下拉框清空 */
|
|
202
|
-
var onSelectClear = function onSelectClear() {
|
|
203
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
204
|
-
selectValue: undefined,
|
|
205
|
-
inputValue: undefined,
|
|
206
|
-
finalSelectValue: undefined
|
|
207
|
-
}, InputTypeEnum.CONDITION_INPUT);
|
|
206
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(finalSelectInputValue);
|
|
208
207
|
};
|
|
209
208
|
// 是否展示输入框
|
|
210
209
|
var isShowInput = !(0, isNil_1["default"])(selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue) && !(hiddenInputKeys === null || hiddenInputKeys === void 0 ? void 0 : hiddenInputKeys.includes(selectInputValue.selectValue));
|
|
@@ -213,7 +212,7 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
213
212
|
className: "label-condition-select-second-input",
|
|
214
213
|
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.inputValue,
|
|
215
214
|
onBlur: function onBlur() {
|
|
216
|
-
return onLabelConditionSelectInputBlur(
|
|
215
|
+
return onLabelConditionSelectInputBlur(EntryTypeEnum.SECOND_ENTRY);
|
|
217
216
|
}
|
|
218
217
|
})) : react_1["default"].createElement("div", {
|
|
219
218
|
className: "label-condition-select-second-select"
|
|
@@ -227,7 +226,7 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
227
226
|
(_a = subSelectRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
228
227
|
},
|
|
229
228
|
onBlur: function onBlur() {
|
|
230
|
-
return onLabelConditionSelectInputBlur(
|
|
229
|
+
return onLabelConditionSelectInputBlur(EntryTypeEnum.SECOND_ENTRY);
|
|
231
230
|
},
|
|
232
231
|
onClear: onTypeSelectClear
|
|
233
232
|
})));
|
|
@@ -245,9 +244,8 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
|
|
|
245
244
|
value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
|
|
246
245
|
options: optionsList,
|
|
247
246
|
onBlur: function onBlur() {
|
|
248
|
-
return onLabelConditionSelectInputBlur(
|
|
249
|
-
}
|
|
250
|
-
onClear: onSelectClear
|
|
247
|
+
return onLabelConditionSelectInputBlur(EntryTypeEnum.FIRST_ENTRY);
|
|
248
|
+
}
|
|
251
249
|
}))), isShowInput && typeInput);
|
|
252
250
|
};
|
|
253
|
-
exports["default"] =
|
|
251
|
+
exports["default"] = LabelConditionSelectInput;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "assui",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.47",
|
|
4
4
|
"description": "react ui library",
|
|
5
5
|
"author": "jason <usochen@gmail.com>",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@types/react-beautiful-dnd": "^13.1.2",
|
|
36
36
|
"@types/react-color": "^3.0.6",
|
|
37
37
|
"@types/react-resizable": "^3.0.0",
|
|
38
|
-
"a-icons": "^1.1.
|
|
38
|
+
"a-icons": "^1.1.61",
|
|
39
39
|
"aa-utils": "^2.1.20",
|
|
40
40
|
"ahooks": "^3.0.8",
|
|
41
41
|
"bignumber.js": "^9.0.1",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"node": ">=10.0.0"
|
|
81
81
|
},
|
|
82
82
|
"license": "MIT",
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "e3f65e28246ab283f9f024e5eeb0cd86ea066566"
|
|
84
84
|
}
|