@kne/super-select 0.1.10 → 0.1.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.
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect, useRef, Fragment } from 'react';
1
+ import React, { forwardRef, useState, useImperativeHandle, useEffect, useRef, Fragment } from 'react';
2
2
  import { createContext } from '@kne/global-context';
3
3
  import useResize from '@kne/use-resize';
4
4
  import useControlValue from '@kne/use-control-value';
@@ -2282,7 +2282,7 @@ const ModalContent = _ref => {
2282
2282
  value: contextProps
2283
2283
  }, children(contextProps));
2284
2284
  };
2285
- const SelectInput = p => {
2285
+ const SelectInput = forwardRef((p, ref) => {
2286
2286
  const locale = Object.assign({}, {
2287
2287
  placeholder: '请选择',
2288
2288
  selectAll: '全选',
@@ -2490,6 +2490,9 @@ const SelectInput = p => {
2490
2490
  onOpenChange: setOpen,
2491
2491
  children
2492
2492
  };
2493
+ useImperativeHandle(ref, () => {
2494
+ return contextProps;
2495
+ });
2493
2496
  return /*#__PURE__*/React.createElement(Provider, {
2494
2497
  value: contextProps
2495
2498
  }, isPopup ? /*#__PURE__*/React.createElement(Dropdown, {
@@ -2513,7 +2516,7 @@ const SelectInput = p => {
2513
2516
  setOpen(true);
2514
2517
  }
2515
2518
  }), /*#__PURE__*/React.createElement(ModalContent, contextProps, renderModal)));
2516
- };
2519
+ });
2517
2520
 
2518
2521
  /** `Object#toString` result references. */
2519
2522
  var symbolTag = '[object Symbol]';
@@ -2948,7 +2951,7 @@ const SelectedTagList = () => {
2948
2951
  var style$1 = {"list":"_IsXdU","is-popup":"_-dvpa","default-list":"_QD1Mz","is-selected-all":"_M-mOy","default-list-item":"_KtOsz","is-selected":"_TQhBB","single-checked":"_2rUrh","is-disabled":"_NbwX5","selected-all":"_vN2Fx","selected-tag":"_6oITk","select-search":"_iAH9D"};
2949
2952
 
2950
2953
  const _excluded = ["children"];
2951
- const SelectList = _ref => {
2954
+ const SelectList = forwardRef((_ref, ref) => {
2952
2955
  let {
2953
2956
  children
2954
2957
  } = _ref,
@@ -3039,7 +3042,9 @@ const SelectList = _ref => {
3039
3042
  });
3040
3043
  }
3041
3044
  }, p);
3042
- return /*#__PURE__*/React.createElement(SelectInput, props, targetProps => {
3045
+ return /*#__PURE__*/React.createElement(SelectInput, _extends({}, props, {
3046
+ ref: ref
3047
+ }), targetProps => {
3043
3048
  const {
3044
3049
  props,
3045
3050
  value,
@@ -3130,11 +3135,11 @@ const SelectList = _ref => {
3130
3135
  vertical: true
3131
3136
  }, components.search, components.selectedAll, components.fetchList, components.selectedTag);
3132
3137
  });
3133
- };
3138
+ });
3134
3139
 
3135
3140
  var style = {"list":"_DrEYJ","is-popup":"_KgWTX","header":"_Vmbrg","col":"_dJmfs","body":"_704J1","is-selected-all":"_qU5zU","is-selected":"_MzyWg","is-disabled":"_5luTv","right-options":"_UXi-g","no-padding-btn":"_iaCir","tag":"_JkYqS","tag-inner":"_VZlBL","single-checked":"_Eiz-u","select-search":"_temy6","tags-search":"_7phL2","descriptions":"_ttNK9","descriptions-col-label":"_xU-i7","descriptions-col-content":"_SvfzQ"};
3136
3141
 
3137
- const SelectTableList = p => {
3142
+ const SelectTableList = forwardRef((p, ref) => {
3138
3143
  const [filter, setFilter] = useState({});
3139
3144
  const [tagSearchText, setTagSearchText] = useState('');
3140
3145
  const props = Object.assign({}, {
@@ -3186,7 +3191,9 @@ const SelectTableList = p => {
3186
3191
  }
3187
3192
  }, p);
3188
3193
  const bodyRef = useRef(null);
3189
- return /*#__PURE__*/React.createElement(SelectInput, props, targetProps => {
3194
+ return /*#__PURE__*/React.createElement(SelectInput, _extends({}, props, {
3195
+ ref: ref
3196
+ }), targetProps => {
3190
3197
  const {
3191
3198
  props,
3192
3199
  value,
@@ -3400,7 +3407,7 @@ const SelectTableList = p => {
3400
3407
  }, item[labelKey])));
3401
3408
  })))));
3402
3409
  });
3403
- };
3410
+ });
3404
3411
 
3405
3412
  export { SelectInput, SelectTableList, SelectedAll, SelectedTagList, SelectList as default };
3406
3413
  //# sourceMappingURL=index.modern.js.map