@kdcloudjs/kdesign 1.6.10 → 1.6.12

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.
@@ -47,5 +47,5 @@ export interface PickerTimeProps extends PickerSharedProps, Omit<OmitPanelProps<
47
47
  defaultOpenValue?: DateType;
48
48
  }
49
49
  export declare type PickerProps = PickerBaseProps | PickerDateProps | PickerTimeProps;
50
- declare function DatePicker(props: Partial<PickerProps>): JSX.Element;
50
+ declare const DatePicker: React.ForwardRefExoticComponent<(Partial<PickerBaseProps> & React.RefAttributes<unknown>) | (Partial<PickerDateProps> & React.RefAttributes<unknown>) | (Partial<PickerTimeProps> & React.RefAttributes<unknown>)>;
51
51
  export default DatePicker;
@@ -18,7 +18,7 @@ import getExtraFooter from './utils/get-extra-footer';
18
18
  import getRanges from './utils/get-ranges';
19
19
  import usePopper from '../_utils/usePopper';
20
20
 
21
- function DatePicker(props) {
21
+ var InternalDatePicker = function InternalDatePicker(props, ref) {
22
22
  var customPrefixcls = props.prefixCls;
23
23
 
24
24
  var _useContext = useContext(ConfigContext),
@@ -85,7 +85,7 @@ function DatePicker(props) {
85
85
  _onOk = datePickerProps.onOk; // ref
86
86
 
87
87
  var panelDivRef = React.useRef(null);
88
- var inputDivRef = React.useRef(null);
88
+ var inputDivRef = ref || /*#__PURE__*/React.createRef();
89
89
  var popperRef = React.useRef(null);
90
90
  var inputRef = React.useRef(null);
91
91
  var isHourStepValid = 24 % hourStep === 0;
@@ -439,6 +439,8 @@ function DatePicker(props) {
439
439
  placement: 'bottomLeft',
440
440
  getPopupContainer: getPopupContainer
441
441
  });
442
- }
442
+ };
443
443
 
444
+ var DatePicker = /*#__PURE__*/React.forwardRef(InternalDatePicker);
445
+ DatePicker.displayName = 'DatePicker';
444
446
  export default DatePicker;
@@ -47,5 +47,5 @@ export declare type RangeArray = {
47
47
  key: string;
48
48
  newValue: RangeValue;
49
49
  }[];
50
- declare function DatePicker(props: Partial<RangePickerProps>): JSX.Element;
51
- export default DatePicker;
50
+ declare const RangePicker: React.ForwardRefExoticComponent<(Partial<RangePickerBaseProps> & React.RefAttributes<unknown>) | (Partial<RangePickerDateProps> & React.RefAttributes<unknown>) | (Partial<RangePickerTimeProps> & React.RefAttributes<unknown>)>;
51
+ export default RangePicker;
@@ -59,7 +59,7 @@ function canValueTrigger(value, index, disabled, allowEmpty) {
59
59
  return false;
60
60
  }
61
61
 
62
- function DatePicker(props) {
62
+ var InternalRangePicker = function InternalRangePicker(props, ref) {
63
63
  var customPrefixcls = props.prefixCls;
64
64
 
65
65
  var _useContext = useContext(ConfigContext),
@@ -123,7 +123,7 @@ function DatePicker(props) {
123
123
 
124
124
 
125
125
  var panelDivRef = React.useRef(null);
126
- var inputDivRef = React.useRef(null);
126
+ var inputDivRef = ref || /*#__PURE__*/React.createRef();
127
127
  var startInputDivRef = React.useRef(null);
128
128
  var endInputDivRef = React.useRef(null);
129
129
  var separatorRef = React.useRef(null);
@@ -772,6 +772,8 @@ function DatePicker(props) {
772
772
  placement: 'bottomLeft',
773
773
  getPopupContainer: getPopupContainer
774
774
  });
775
- }
775
+ };
776
776
 
777
- export default DatePicker;
777
+ var RangePicker = /*#__PURE__*/React.forwardRef(InternalRangePicker);
778
+ RangePicker.displayName = 'RangePicker';
779
+ export default RangePicker;
@@ -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,22 +275,26 @@ 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) {
296
+ var _a;
297
+
294
298
  var onSelect = selectProps.onSelect,
295
299
  onDeselect = selectProps.onDeselect,
296
300
  labelInValue = selectProps.labelInValue,
@@ -304,6 +308,11 @@ var InternalSelect = function InternalSelect(props, ref) {
304
308
  return (child === null || child === void 0 ? void 0 : child.value) === key;
305
309
  }
306
310
  })) || {};
311
+
312
+ if (isMultiple) {
313
+ (_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.focus();
314
+ }
315
+
307
316
  var optionsObj = obj.props ? obj.props : obj || {};
308
317
 
309
318
  if (value !== undefined) {
@@ -22,6 +22,7 @@ export interface ISliderProps {
22
22
  tooltipVisible?: boolean;
23
23
  tooltipPlacemant?: PlacementType;
24
24
  value?: number | number[];
25
+ getPopupContainer?: () => React.ReactNode;
25
26
  vertical?: boolean;
26
27
  onAfterChange?: (value?: number | number[]) => void;
27
28
  onChange?: (value?: number | number[]) => void;
@@ -54,10 +54,11 @@ var InteranalSlider = function InteranalSlider(props, ref) {
54
54
  tooltipVisible = sliderProps.tooltipVisible,
55
55
  tooltipPlacement = sliderProps.tooltipPlacement,
56
56
  propsValue = sliderProps.value,
57
+ getPopupContainer = sliderProps.getPopupContainer,
57
58
  onAfterChange = sliderProps.onAfterChange,
58
59
  onChange = sliderProps.onChange,
59
60
  onBlur = sliderProps.onBlur,
60
- others = __rest(sliderProps, ["className", "style", "prefixCls", "defaultValue", "disabled", "dots", "marks", "min", "max", "vertical", "reverse", "step", "tipFormatter", "tooltipVisible", "tooltipPlacement", "value", "onAfterChange", "onChange", "onBlur"]);
61
+ others = __rest(sliderProps, ["className", "style", "prefixCls", "defaultValue", "disabled", "dots", "marks", "min", "max", "vertical", "reverse", "step", "tipFormatter", "tooltipVisible", "tooltipPlacement", "value", "getPopupContainer", "onAfterChange", "onChange", "onBlur"]);
61
62
 
62
63
  devWarning(className && className.indexOf('shit') > -1, 'slider', "slider className can't include '".concat(className, "'"));
63
64
  var sliderPrefixCls = getPrefixCls(prefixCls, 'slider', customPrefixcls); // ref
@@ -274,7 +275,8 @@ var InteranalSlider = function InteranalSlider(props, ref) {
274
275
  reverse: reverse,
275
276
  min: min,
276
277
  max: max,
277
- bound: value
278
+ bound: value,
279
+ getPopupContainer: getPopupContainer
278
280
  }), /*#__PURE__*/React.createElement(Marks, {
279
281
  marks: marks,
280
282
  prefixCls: sliderPrefixCls,
@@ -49,4 +49,5 @@ var SliderTooltip = /*#__PURE__*/React.forwardRef(function (props, ref) {
49
49
  style: handleStyle
50
50
  }));
51
51
  });
52
+ SliderTooltip.displayName = 'SliderTooltip';
52
53
  export default SliderTooltip;
@@ -47,5 +47,5 @@ export interface PickerTimeProps extends PickerSharedProps, Omit<OmitPanelProps<
47
47
  defaultOpenValue?: DateType;
48
48
  }
49
49
  export declare type PickerProps = PickerBaseProps | PickerDateProps | PickerTimeProps;
50
- declare function DatePicker(props: Partial<PickerProps>): JSX.Element;
50
+ declare const DatePicker: React.ForwardRefExoticComponent<(Partial<PickerBaseProps> & React.RefAttributes<unknown>) | (Partial<PickerDateProps> & React.RefAttributes<unknown>) | (Partial<PickerTimeProps> & React.RefAttributes<unknown>)>;
51
51
  export default DatePicker;
@@ -55,7 +55,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "functi
55
55
 
56
56
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
57
57
 
58
- function DatePicker(props) {
58
+ var InternalDatePicker = function InternalDatePicker(props, ref) {
59
59
  var customPrefixcls = props.prefixCls;
60
60
 
61
61
  var _useContext = (0, _react.useContext)(_ConfigContext.default),
@@ -123,7 +123,7 @@ function DatePicker(props) {
123
123
 
124
124
  var panelDivRef = _react.default.useRef(null);
125
125
 
126
- var inputDivRef = _react.default.useRef(null);
126
+ var inputDivRef = ref || /*#__PURE__*/_react.default.createRef();
127
127
 
128
128
  var popperRef = _react.default.useRef(null);
129
129
 
@@ -477,7 +477,10 @@ function DatePicker(props) {
477
477
  placement: 'bottomLeft',
478
478
  getPopupContainer: getPopupContainer
479
479
  });
480
- }
480
+ };
481
481
 
482
+ var DatePicker = /*#__PURE__*/_react.default.forwardRef(InternalDatePicker);
483
+
484
+ DatePicker.displayName = 'DatePicker';
482
485
  var _default = DatePicker;
483
486
  exports.default = _default;
@@ -47,5 +47,5 @@ export declare type RangeArray = {
47
47
  key: string;
48
48
  newValue: RangeValue;
49
49
  }[];
50
- declare function DatePicker(props: Partial<RangePickerProps>): JSX.Element;
51
- export default DatePicker;
50
+ declare const RangePicker: React.ForwardRefExoticComponent<(Partial<RangePickerBaseProps> & React.RefAttributes<unknown>) | (Partial<RangePickerDateProps> & React.RefAttributes<unknown>) | (Partial<RangePickerTimeProps> & React.RefAttributes<unknown>)>;
51
+ export default RangePicker;
@@ -103,7 +103,7 @@ function canValueTrigger(value, index, disabled, allowEmpty) {
103
103
  return false;
104
104
  }
105
105
 
106
- function DatePicker(props) {
106
+ var InternalRangePicker = function InternalRangePicker(props, ref) {
107
107
  var customPrefixcls = props.prefixCls;
108
108
 
109
109
  var _useContext = (0, _react.useContext)(_ConfigContext.default),
@@ -166,7 +166,7 @@ function DatePicker(props) {
166
166
 
167
167
  var panelDivRef = _react.default.useRef(null);
168
168
 
169
- var inputDivRef = _react.default.useRef(null);
169
+ var inputDivRef = ref || /*#__PURE__*/_react.default.createRef();
170
170
 
171
171
  var startInputDivRef = _react.default.useRef(null);
172
172
 
@@ -824,7 +824,10 @@ function DatePicker(props) {
824
824
  placement: 'bottomLeft',
825
825
  getPopupContainer: getPopupContainer
826
826
  });
827
- }
827
+ };
828
+
829
+ var RangePicker = /*#__PURE__*/_react.default.forwardRef(InternalRangePicker);
828
830
 
829
- var _default = DatePicker;
831
+ RangePicker.displayName = 'RangePicker';
832
+ var _default = RangePicker;
830
833
  exports.default = _default;
@@ -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,22 +313,26 @@ 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) {
334
+ var _a;
335
+
332
336
  var onSelect = selectProps.onSelect,
333
337
  onDeselect = selectProps.onDeselect,
334
338
  labelInValue = selectProps.labelInValue,
@@ -342,6 +346,11 @@ var InternalSelect = function InternalSelect(props, ref) {
342
346
  return (child === null || child === void 0 ? void 0 : child.value) === key;
343
347
  }
344
348
  })) || {};
349
+
350
+ if (isMultiple) {
351
+ (_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.focus();
352
+ }
353
+
345
354
  var optionsObj = obj.props ? obj.props : obj || {};
346
355
 
347
356
  if (value !== undefined) {
@@ -22,6 +22,7 @@ export interface ISliderProps {
22
22
  tooltipVisible?: boolean;
23
23
  tooltipPlacemant?: PlacementType;
24
24
  value?: number | number[];
25
+ getPopupContainer?: () => React.ReactNode;
25
26
  vertical?: boolean;
26
27
  onAfterChange?: (value?: number | number[]) => void;
27
28
  onChange?: (value?: number | number[]) => void;
@@ -87,10 +87,11 @@ var InteranalSlider = function InteranalSlider(props, ref) {
87
87
  tooltipVisible = sliderProps.tooltipVisible,
88
88
  tooltipPlacement = sliderProps.tooltipPlacement,
89
89
  propsValue = sliderProps.value,
90
+ getPopupContainer = sliderProps.getPopupContainer,
90
91
  onAfterChange = sliderProps.onAfterChange,
91
92
  onChange = sliderProps.onChange,
92
93
  onBlur = sliderProps.onBlur,
93
- others = __rest(sliderProps, ["className", "style", "prefixCls", "defaultValue", "disabled", "dots", "marks", "min", "max", "vertical", "reverse", "step", "tipFormatter", "tooltipVisible", "tooltipPlacement", "value", "onAfterChange", "onChange", "onBlur"]);
94
+ others = __rest(sliderProps, ["className", "style", "prefixCls", "defaultValue", "disabled", "dots", "marks", "min", "max", "vertical", "reverse", "step", "tipFormatter", "tooltipVisible", "tooltipPlacement", "value", "getPopupContainer", "onAfterChange", "onChange", "onBlur"]);
94
95
 
95
96
  (0, _devwarning.default)(className && className.indexOf('shit') > -1, 'slider', "slider className can't include '".concat(className, "'"));
96
97
  var sliderPrefixCls = getPrefixCls(prefixCls, 'slider', customPrefixcls); // ref
@@ -306,7 +307,8 @@ var InteranalSlider = function InteranalSlider(props, ref) {
306
307
  reverse: reverse,
307
308
  min: min,
308
309
  max: max,
309
- bound: value
310
+ bound: value,
311
+ getPopupContainer: getPopupContainer
310
312
  }), /*#__PURE__*/_react.default.createElement(_marks.default, {
311
313
  marks: marks,
312
314
  prefixCls: sliderPrefixCls,
@@ -74,5 +74,6 @@ var SliderTooltip = /*#__PURE__*/_react.default.forwardRef(function (props, ref)
74
74
  }));
75
75
  });
76
76
 
77
+ SliderTooltip.displayName = 'SliderTooltip';
77
78
  var _default = SliderTooltip;
78
79
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kdcloudjs/kdesign",
3
- "version": "1.6.10",
3
+ "version": "1.6.12",
4
4
  "description": "KDesign 金蝶前端react 组件库",
5
5
  "title": "kdesign",
6
6
  "keywords": [