assui 3.1.43 → 3.1.45

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.
@@ -5,6 +5,7 @@ export declare enum InputTypeEnum {
5
5
  CONDITION_INPUT = "conditionInput",
6
6
  SELECT = "select"
7
7
  }
8
+ export declare type ChangeSelectType = typeof InputTypeEnum[keyof typeof InputTypeEnum];
8
9
  declare type SelectOptionsType = {
9
10
  value: number;
10
11
  label: string;
@@ -27,10 +28,11 @@ export interface LabelConditionSelectInputProps {
27
28
  conditionInputProps?: LabelConditionInputProps;
28
29
  /** 联动selectProps */
29
30
  conditionSelectProps?: LabelSelectProps;
31
+ onChangeSelectType?: (changeSelectType: ChangeSelectType, value?: ValueType) => void;
30
32
  /** onChange */
31
33
  onChange?: (value: ValueType) => void;
32
34
  /** onBlur */
33
- onBlur?: (value: ValueType) => void;
35
+ onBlur?: (value: ValueType, blurSelectType: ChangeSelectType) => void;
34
36
  /** 输入框类型 */
35
37
  inputType?: InputTypeEnum;
36
38
  /** select options */
@@ -66,6 +66,7 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
66
66
  inputType = _b === void 0 ? InputTypeEnum.CONDITION_INPUT : _b,
67
67
  _c = props.optionsList,
68
68
  optionsList = _c === void 0 ? [] : _c,
69
+ onChangeSelectType = props.onChangeSelectType,
69
70
  label = props.label,
70
71
  className = props.className,
71
72
  onBlur = props.onBlur;
@@ -102,6 +103,7 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
102
103
  });
103
104
  }
104
105
  setSelectInputValue(finalSelectInputValue);
106
+ onChangeSelectType === null || onChangeSelectType === void 0 ? void 0 : onChangeSelectType(InputTypeEnum.SELECT, finalSelectInputValue);
105
107
  if (isInput || isNil(selectValue)) {
106
108
  setSubSelectOptions([]);
107
109
  return;
@@ -115,10 +117,12 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
115
117
  }
116
118
  };
117
119
  var onInputChange = function onInputChange(inputValue) {
118
- setSelectInputValue({
120
+ var finalValue = {
119
121
  selectValue: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
120
122
  inputValue: inputValue
121
- });
123
+ };
124
+ setSelectInputValue(finalValue);
125
+ onChangeSelectType === null || onChangeSelectType === void 0 ? void 0 : onChangeSelectType(InputTypeEnum.SELECT, finalValue);
122
126
  };
123
127
  var onTypeSelectChange = function onTypeSelectChange(inputValue) {
124
128
  var finalSelectInputValue = {
@@ -131,10 +135,11 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
131
135
  });
132
136
  }
133
137
  setSelectInputValue(finalSelectInputValue);
138
+ onChangeSelectType === null || onChangeSelectType === void 0 ? void 0 : onChangeSelectType(InputTypeEnum.CONDITION_INPUT, finalSelectInputValue);
134
139
  };
135
140
  /** 联级选择框失去焦点 */
136
- var onLabelConditionSelectInputBlur = function onLabelConditionSelectInputBlur() {
137
- onBlur === null || onBlur === void 0 ? void 0 : onBlur(selectInputValue);
141
+ var onLabelConditionSelectInputBlur = function onLabelConditionSelectInputBlur(blurSelectType) {
142
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(selectInputValue, blurSelectType);
138
143
  };
139
144
  /** 二级下拉框清空 */
140
145
  var onTypeSelectClear = function onTypeSelectClear() {
@@ -147,7 +152,7 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
147
152
  finalSelectValue: findAllSubSelectItems(optionsList, selectInputValue.selectValue)
148
153
  });
149
154
  }
150
- onBlur === null || onBlur === void 0 ? void 0 : onBlur(finalSelectInputValue);
155
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(finalSelectInputValue, InputTypeEnum.CONDITION_INPUT);
151
156
  };
152
157
  /** 一级下拉框清空 */
153
158
  var onSelectClear = function onSelectClear() {
@@ -155,7 +160,7 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
155
160
  selectValue: undefined,
156
161
  inputValue: undefined,
157
162
  finalSelectValue: undefined
158
- });
163
+ }, InputTypeEnum.CONDITION_INPUT);
159
164
  };
160
165
  // 是否展示输入框
161
166
  var isShowInput = !isNil(selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue) && !(hiddenInputKeys === null || hiddenInputKeys === void 0 ? void 0 : hiddenInputKeys.includes(selectInputValue.selectValue));
@@ -163,7 +168,9 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
163
168
  onChange: onInputChange,
164
169
  className: "label-condition-select-second-input",
165
170
  value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.inputValue,
166
- onBlur: onLabelConditionSelectInputBlur
171
+ onBlur: function onBlur() {
172
+ return onLabelConditionSelectInputBlur(InputTypeEnum.CONDITION_INPUT);
173
+ }
167
174
  })) : /*#__PURE__*/React.createElement("div", {
168
175
  className: "label-condition-select-second-select"
169
176
  }, /*#__PURE__*/React.createElement(LabelSelect, __assign({}, conditionSelectProps, {
@@ -175,7 +182,9 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
175
182
  var _a;
176
183
  (_a = subSelectRef.current) === null || _a === void 0 ? void 0 : _a.focus();
177
184
  },
178
- onBlur: onLabelConditionSelectInputBlur,
185
+ onBlur: function onBlur() {
186
+ return onLabelConditionSelectInputBlur(InputTypeEnum.CONDITION_INPUT);
187
+ },
179
188
  onClear: onTypeSelectClear
180
189
  })));
181
190
  return /*#__PURE__*/React.createElement("div", {
@@ -191,7 +200,9 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
191
200
  onChange: onSelectChange,
192
201
  value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
193
202
  options: optionsList,
194
- onBlur: onLabelConditionSelectInputBlur,
203
+ onBlur: function onBlur() {
204
+ return onLabelConditionSelectInputBlur(InputTypeEnum.SELECT);
205
+ },
195
206
  onClear: onSelectClear
196
207
  }))), isShowInput && typeInput);
197
208
  };
@@ -5,6 +5,7 @@ export declare enum InputTypeEnum {
5
5
  CONDITION_INPUT = "conditionInput",
6
6
  SELECT = "select"
7
7
  }
8
+ export declare type ChangeSelectType = typeof InputTypeEnum[keyof typeof InputTypeEnum];
8
9
  declare type SelectOptionsType = {
9
10
  value: number;
10
11
  label: string;
@@ -27,10 +28,11 @@ export interface LabelConditionSelectInputProps {
27
28
  conditionInputProps?: LabelConditionInputProps;
28
29
  /** 联动selectProps */
29
30
  conditionSelectProps?: LabelSelectProps;
31
+ onChangeSelectType?: (changeSelectType: ChangeSelectType, value?: ValueType) => void;
30
32
  /** onChange */
31
33
  onChange?: (value: ValueType) => void;
32
34
  /** onBlur */
33
- onBlur?: (value: ValueType) => void;
35
+ onBlur?: (value: ValueType, blurSelectType: ChangeSelectType) => void;
34
36
  /** 输入框类型 */
35
37
  inputType?: InputTypeEnum;
36
38
  /** select options */
@@ -110,6 +110,7 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
110
110
  inputType = _b === void 0 ? InputTypeEnum.CONDITION_INPUT : _b,
111
111
  _c = props.optionsList,
112
112
  optionsList = _c === void 0 ? [] : _c,
113
+ onChangeSelectType = props.onChangeSelectType,
113
114
  label = props.label,
114
115
  className = props.className,
115
116
  onBlur = props.onBlur;
@@ -146,6 +147,7 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
146
147
  });
147
148
  }
148
149
  setSelectInputValue(finalSelectInputValue);
150
+ onChangeSelectType === null || onChangeSelectType === void 0 ? void 0 : onChangeSelectType(InputTypeEnum.SELECT, finalSelectInputValue);
149
151
  if (isInput || (0, isNil_1["default"])(selectValue)) {
150
152
  setSubSelectOptions([]);
151
153
  return;
@@ -159,10 +161,12 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
159
161
  }
160
162
  };
161
163
  var onInputChange = function onInputChange(inputValue) {
162
- setSelectInputValue({
164
+ var finalValue = {
163
165
  selectValue: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
164
166
  inputValue: inputValue
165
- });
167
+ };
168
+ setSelectInputValue(finalValue);
169
+ onChangeSelectType === null || onChangeSelectType === void 0 ? void 0 : onChangeSelectType(InputTypeEnum.SELECT, finalValue);
166
170
  };
167
171
  var onTypeSelectChange = function onTypeSelectChange(inputValue) {
168
172
  var finalSelectInputValue = {
@@ -175,10 +179,11 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
175
179
  });
176
180
  }
177
181
  setSelectInputValue(finalSelectInputValue);
182
+ onChangeSelectType === null || onChangeSelectType === void 0 ? void 0 : onChangeSelectType(InputTypeEnum.CONDITION_INPUT, finalSelectInputValue);
178
183
  };
179
184
  /** 联级选择框失去焦点 */
180
- var onLabelConditionSelectInputBlur = function onLabelConditionSelectInputBlur() {
181
- onBlur === null || onBlur === void 0 ? void 0 : onBlur(selectInputValue);
185
+ var onLabelConditionSelectInputBlur = function onLabelConditionSelectInputBlur(blurSelectType) {
186
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(selectInputValue, blurSelectType);
182
187
  };
183
188
  /** 二级下拉框清空 */
184
189
  var onTypeSelectClear = function onTypeSelectClear() {
@@ -191,7 +196,7 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
191
196
  finalSelectValue: findAllSubSelectItems(optionsList, selectInputValue.selectValue)
192
197
  });
193
198
  }
194
- onBlur === null || onBlur === void 0 ? void 0 : onBlur(finalSelectInputValue);
199
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(finalSelectInputValue, InputTypeEnum.CONDITION_INPUT);
195
200
  };
196
201
  /** 一级下拉框清空 */
197
202
  var onSelectClear = function onSelectClear() {
@@ -199,7 +204,7 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
199
204
  selectValue: undefined,
200
205
  inputValue: undefined,
201
206
  finalSelectValue: undefined
202
- });
207
+ }, InputTypeEnum.CONDITION_INPUT);
203
208
  };
204
209
  // 是否展示输入框
205
210
  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));
@@ -207,7 +212,9 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
207
212
  onChange: onInputChange,
208
213
  className: "label-condition-select-second-input",
209
214
  value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.inputValue,
210
- onBlur: onLabelConditionSelectInputBlur
215
+ onBlur: function onBlur() {
216
+ return onLabelConditionSelectInputBlur(InputTypeEnum.CONDITION_INPUT);
217
+ }
211
218
  })) : react_1["default"].createElement("div", {
212
219
  className: "label-condition-select-second-select"
213
220
  }, react_1["default"].createElement(label_select_1["default"], __assign({}, conditionSelectProps, {
@@ -219,7 +226,9 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
219
226
  var _a;
220
227
  (_a = subSelectRef.current) === null || _a === void 0 ? void 0 : _a.focus();
221
228
  },
222
- onBlur: onLabelConditionSelectInputBlur,
229
+ onBlur: function onBlur() {
230
+ return onLabelConditionSelectInputBlur(InputTypeEnum.CONDITION_INPUT);
231
+ },
223
232
  onClear: onTypeSelectClear
224
233
  })));
225
234
  return react_1["default"].createElement("div", {
@@ -235,7 +244,9 @@ var LabelConditionSelect = function LabelConditionSelect(props) {
235
244
  onChange: onSelectChange,
236
245
  value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
237
246
  options: optionsList,
238
- onBlur: onLabelConditionSelectInputBlur,
247
+ onBlur: function onBlur() {
248
+ return onLabelConditionSelectInputBlur(InputTypeEnum.SELECT);
249
+ },
239
250
  onClear: onSelectClear
240
251
  }))), isShowInput && typeInput);
241
252
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assui",
3
- "version": "3.1.43",
3
+ "version": "3.1.45",
4
4
  "description": "react ui library",
5
5
  "author": "jason <usochen@gmail.com>",
6
6
  "main": "./lib/index.js",
@@ -80,5 +80,5 @@
80
80
  "node": ">=10.0.0"
81
81
  },
82
82
  "license": "MIT",
83
- "gitHead": "802b8d8e9a21335b93a4ac0872e70fdd228fa3d3"
83
+ "gitHead": "26b823994025a58c6fb4572d340bf3b57866d1b9"
84
84
  }