@kdcloudjs/kdesign 1.6.10 → 1.6.11
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/CHANGELOG.md +27 -0
- package/dist/kdesign.css +1 -1
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +8 -6
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +1 -1
- package/dist/kdesign.min.js +2 -2
- package/dist/kdesign.min.js.map +1 -1
- package/es/select/interface.d.ts +1 -0
- package/es/select/select.js +7 -5
- package/lib/select/interface.d.ts +1 -0
- package/lib/select/select.js +7 -5
- package/package.json +1 -1
package/es/select/interface.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export interface AbstractSelectProps extends PopperProps {
|
|
|
36
36
|
maxTagPlaceholder?: React.ReactNode | ((omittedValues: LabeledValue[]) => React.ReactNode);
|
|
37
37
|
filterOption?: boolean | ((inputValue: string, option?: OptionsType) => boolean);
|
|
38
38
|
optionFilterProp?: string;
|
|
39
|
+
optionLabelProp?: string;
|
|
39
40
|
}
|
|
40
41
|
export interface LabeledValue {
|
|
41
42
|
key?: string;
|
package/es/select/select.js
CHANGED
|
@@ -275,20 +275,22 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
275
275
|
var getOptionLabel = useCallback(function (obj) {
|
|
276
276
|
var _a;
|
|
277
277
|
|
|
278
|
+
var text = 'options' in selectProps ? 'label' : optionLabelProp;
|
|
279
|
+
|
|
278
280
|
if (obj.props) {
|
|
279
|
-
if (
|
|
280
|
-
return obj === null || obj === void 0 ? void 0 : obj.props[
|
|
281
|
+
if (text) {
|
|
282
|
+
return obj === null || obj === void 0 ? void 0 : obj.props[text];
|
|
281
283
|
}
|
|
282
284
|
|
|
283
285
|
return (_a = obj.props) === null || _a === void 0 ? void 0 : _a.children;
|
|
284
286
|
} else {
|
|
285
|
-
if (
|
|
286
|
-
return obj[
|
|
287
|
+
if (text) {
|
|
288
|
+
return obj[text];
|
|
287
289
|
}
|
|
288
290
|
}
|
|
289
291
|
|
|
290
292
|
return obj === null || obj === void 0 ? void 0 : obj.label;
|
|
291
|
-
}, [optionLabelProp]); // 点击下拉列表中某项回调
|
|
293
|
+
}, [optionLabelProp, selectProps]); // 点击下拉列表中某项回调
|
|
292
294
|
|
|
293
295
|
var handleOption = function handleOption(key, label, isSelected) {
|
|
294
296
|
var onSelect = selectProps.onSelect,
|
|
@@ -36,6 +36,7 @@ export interface AbstractSelectProps extends PopperProps {
|
|
|
36
36
|
maxTagPlaceholder?: React.ReactNode | ((omittedValues: LabeledValue[]) => React.ReactNode);
|
|
37
37
|
filterOption?: boolean | ((inputValue: string, option?: OptionsType) => boolean);
|
|
38
38
|
optionFilterProp?: string;
|
|
39
|
+
optionLabelProp?: string;
|
|
39
40
|
}
|
|
40
41
|
export interface LabeledValue {
|
|
41
42
|
key?: string;
|
package/lib/select/select.js
CHANGED
|
@@ -313,20 +313,22 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
313
313
|
var getOptionLabel = (0, _react.useCallback)(function (obj) {
|
|
314
314
|
var _a;
|
|
315
315
|
|
|
316
|
+
var text = 'options' in selectProps ? 'label' : optionLabelProp;
|
|
317
|
+
|
|
316
318
|
if (obj.props) {
|
|
317
|
-
if (
|
|
318
|
-
return obj === null || obj === void 0 ? void 0 : obj.props[
|
|
319
|
+
if (text) {
|
|
320
|
+
return obj === null || obj === void 0 ? void 0 : obj.props[text];
|
|
319
321
|
}
|
|
320
322
|
|
|
321
323
|
return (_a = obj.props) === null || _a === void 0 ? void 0 : _a.children;
|
|
322
324
|
} else {
|
|
323
|
-
if (
|
|
324
|
-
return obj[
|
|
325
|
+
if (text) {
|
|
326
|
+
return obj[text];
|
|
325
327
|
}
|
|
326
328
|
}
|
|
327
329
|
|
|
328
330
|
return obj === null || obj === void 0 ? void 0 : obj.label;
|
|
329
|
-
}, [optionLabelProp]); // 点击下拉列表中某项回调
|
|
331
|
+
}, [optionLabelProp, selectProps]); // 点击下拉列表中某项回调
|
|
330
332
|
|
|
331
333
|
var handleOption = function handleOption(key, label, isSelected) {
|
|
332
334
|
var onSelect = selectProps.onSelect,
|