@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.
@@ -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;
@@ -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 (optionLabelProp) {
280
- return obj === null || obj === void 0 ? void 0 : obj.props[optionLabelProp];
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 (optionLabelProp) {
286
- return obj[optionLabelProp];
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;
@@ -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 (optionLabelProp) {
318
- return obj === null || obj === void 0 ? void 0 : obj.props[optionLabelProp];
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 (optionLabelProp) {
324
- return obj[optionLabelProp];
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kdcloudjs/kdesign",
3
- "version": "1.6.10",
3
+ "version": "1.6.11",
4
4
  "description": "KDesign 金蝶前端react 组件库",
5
5
  "title": "kdesign",
6
6
  "keywords": [