shineout 3.3.3-beta.7 → 3.3.3-fix.1

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/cjs/index.js CHANGED
@@ -476,5 +476,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
476
476
  // 此文件由脚本自动生成,请勿直接修改。
477
477
  // This file was generated automatically by a script. Please do not modify it directly.
478
478
  var _default = exports.default = {
479
- version: '3.3.3-beta.7'
479
+ version: '3.3.3-fix.1'
480
480
  };
package/dist/shineout.js CHANGED
@@ -11968,7 +11968,7 @@ var handleStyle = function handleStyle(style) {
11968
11968
  };
11969
11969
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
11970
11970
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
11971
- /* harmony default export */ var version = ('3.3.3-beta.7');
11971
+ /* harmony default export */ var version = ('3.3.3-fix.1');
11972
11972
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
11973
11973
 
11974
11974
 
@@ -16813,6 +16813,13 @@ var cascaderStyle = objectSpread2_default()(objectSpread2_default()({
16813
16813
  marginTop: src.cascaderPlaceholderMarginY,
16814
16814
  marginBottom: src.cascaderPlaceholderMarginY
16815
16815
  },
16816
+ inputPlaceholder: {
16817
+ pointerEvents: 'none',
16818
+ opacity: 0.5,
16819
+ inset: 0,
16820
+ position: 'absolute',
16821
+ padding: "".concat(src.selectOptionInnerPaddingY, " ").concat(src.selectOptionInnerPaddingX)
16822
+ },
16816
16823
  inputMirror: {
16817
16824
  position: 'absolute',
16818
16825
  left: 0,
@@ -22136,6 +22143,13 @@ var selectStyle = objectSpread2_default()(objectSpread2_default()({
22136
22143
  marginTop: src.selectPlaceholderMarginY,
22137
22144
  marginBottom: src.selectPlaceholderMarginY
22138
22145
  },
22146
+ inputPlaceholder: {
22147
+ pointerEvents: 'none',
22148
+ opacity: 0.5,
22149
+ inset: 0,
22150
+ position: 'absolute',
22151
+ padding: "".concat(src.selectOptionInnerPaddingY, " ").concat(src.selectOptionInnerPaddingX)
22152
+ },
22139
22153
  inputMirror: {
22140
22154
  position: 'absolute',
22141
22155
  left: 0,
@@ -27042,6 +27056,13 @@ var treeSelectStyle = objectSpread2_default()(objectSpread2_default()({
27042
27056
  marginTop: src.treeSelectPlaceholderMarginY,
27043
27057
  marginBottom: src.treeSelectPlaceholderMarginY
27044
27058
  },
27059
+ inputPlaceholder: {
27060
+ pointerEvents: 'none',
27061
+ opacity: 0.5,
27062
+ inset: 0,
27063
+ position: 'absolute',
27064
+ padding: "".concat(src.selectOptionInnerPaddingY, " ").concat(src.selectOptionInnerPaddingX)
27065
+ },
27045
27066
  inputMirror: {
27046
27067
  position: 'absolute',
27047
27068
  left: 0,
@@ -29854,7 +29875,7 @@ var addResizeObserver = function addResizeObserver(el, handler) {
29854
29875
  if (height && lastHeight !== height) {
29855
29876
  debounceHandler(entry);
29856
29877
  }
29857
- } else if (width && height) {
29878
+ } else if (lastWidth !== width || lastHeight !== height) {
29858
29879
  debounceHandler(entry, {
29859
29880
  x: lastWidth !== width,
29860
29881
  y: lastHeight !== height
@@ -31828,19 +31849,18 @@ function useInputAble(props) {
31828
31849
  var render = useRender(syncValue);
31829
31850
  var shouldUseState = delay || !control;
31830
31851
  var value = shouldUseState ? stateValue : valuePo;
31831
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
31832
- if (context.timer) {
31852
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
31853
+ if (delay && control && props.value !== stateValue) {
31854
+ changeStateValue(props.value);
31855
+ } else if (context.timer) {
31833
31856
  clearTimeout(context.timer);
31834
31857
  context.timer = null;
31835
31858
  }
31836
- if (delay && props.value !== stateValue) {
31837
- changeStateValue(props.value);
31838
- }
31839
- }, [props.value, delay]);
31859
+ }, [props.value, delay, control]);
31840
31860
  var forceDelayChange = use_persist_fn(function () {
31841
- if (context.timer && context.delayChange) {
31861
+ if (context.delayChange) context.delayChange();
31862
+ if (context.timer) {
31842
31863
  clearTimeout(context.timer);
31843
- context.delayChange();
31844
31864
  context.timer = null;
31845
31865
  context.delayChange = null;
31846
31866
  }
@@ -36002,6 +36022,14 @@ var result_Input = function Input(props) {
36002
36022
  _useState2 = slicedToArray_default()(_useState, 2),
36003
36023
  value = _useState2[0],
36004
36024
  setValue = _useState2[1];
36025
+ var updateValue = function updateValue() {
36026
+ setValue(props.value);
36027
+ };
36028
+ if (props.inputRef) {
36029
+ props.inputRef.current = {
36030
+ updateValue: updateValue
36031
+ };
36032
+ }
36005
36033
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
36006
36034
  setValue(props.value);
36007
36035
  }, [props.value, props.open]);
@@ -36040,6 +36068,7 @@ var Result = function Result(props) {
36040
36068
  range = props.range,
36041
36069
  placeholder = props.placeholder,
36042
36070
  _onChange = props.onChange,
36071
+ _onRef = props.onRef,
36043
36072
  disabledLeft = props.disabledLeft,
36044
36073
  disabledRight = props.disabledRight,
36045
36074
  _props$activeIndex = props.activeIndex,
@@ -36053,6 +36082,7 @@ var Result = function Result(props) {
36053
36082
  clickIndex: 0
36054
36083
  }),
36055
36084
  context = _useRef.current;
36085
+ var inputRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({});
36056
36086
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
36057
36087
  if (open) {
36058
36088
  if (context.inputRefs[activeIndex]) {
@@ -36105,10 +36135,12 @@ var Result = function Result(props) {
36105
36135
  className: styles === null || styles === void 0 ? void 0 : styles.resultTextPadding,
36106
36136
  children: info.inputable ? /*#__PURE__*/(0,jsx_runtime.jsx)(result_Input, {
36107
36137
  onRef: function onRef(el) {
36138
+ _onRef.current.inputRef = el;
36108
36139
  context.inputRefs[info.index] = el;
36109
36140
  },
36110
36141
  disabled: dis,
36111
36142
  open: !!open,
36143
+ inputRef: inputRef,
36112
36144
  value: info.target || info.value || '',
36113
36145
  placeholder: info.place,
36114
36146
  onChange: function onChange(s) {
@@ -36118,10 +36150,11 @@ var Result = function Result(props) {
36118
36150
  context.clickIndex = info.index;
36119
36151
  },
36120
36152
  onBlur: function onBlur(e) {
36121
- var _props$onBlur;
36153
+ var _props$onBlur, _inputRef$current$upd, _inputRef$current;
36122
36154
  e.stopPropagation();
36123
36155
  if (e.relatedTarget === context.inputRefs[1 - info.index]) return;
36124
36156
  (_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 || _props$onBlur.call(props, e);
36157
+ if (inputRef.current) (_inputRef$current$upd = (_inputRef$current = inputRef.current).updateValue) === null || _inputRef$current$upd === void 0 || _inputRef$current$upd.call(_inputRef$current);
36125
36158
  context.clickIndex = 0;
36126
36159
  },
36127
36160
  onFocus: function onFocus(e) {
@@ -36223,6 +36256,13 @@ var ResultInput = function ResultInput(props) {
36223
36256
  onRef.current = inputRef.current;
36224
36257
  onBindInput === null || onBindInput === void 0 || onBindInput(inputRef.current);
36225
36258
  }, []);
36259
+ var renderResultPlaceholder = function renderResultPlaceholder() {
36260
+ if (inputText || !focus || typeof props.placeholder === 'string') return null;
36261
+ return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
36262
+ className: styles.inputPlaceholder,
36263
+ children: props.placeholder
36264
+ });
36265
+ };
36226
36266
  var style = {};
36227
36267
  if (!multiple) {
36228
36268
  style.width = '100%';
@@ -36236,7 +36276,7 @@ var ResultInput = function ResultInput(props) {
36236
36276
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)(result_Input, {
36237
36277
  onRef: bindInputRef,
36238
36278
  style: style,
36239
- placeholder: props.placeholder,
36279
+ placeholder: typeof props.placeholder === 'string' ? props.placeholder : undefined,
36240
36280
  value: inputText,
36241
36281
  maxLength: maxLength,
36242
36282
  onChange: onChange,
@@ -36248,7 +36288,7 @@ var ResultInput = function ResultInput(props) {
36248
36288
  className: styles.inputMirror,
36249
36289
  ref: mirrorRef,
36250
36290
  children: inputText || value
36251
- })]
36291
+ }), renderResultPlaceholder()]
36252
36292
  });
36253
36293
  };
36254
36294
  /* harmony default export */ var result_input = (ResultInput);
@@ -36777,14 +36817,10 @@ var result_Result = function Result(props) {
36777
36817
  onResultItemClick === null || onResultItemClick === void 0 || onResultItemClick(e, item);
36778
36818
  };
36779
36819
  var renderInput = function renderInput() {
36780
- var placeholder2 = empty ? placeholder : '';
36820
+ var _placeholder = empty ? placeholder : '';
36781
36821
  if (!multiple && valueProp && valueProp !== 0) {
36782
36822
  var _result = getDataByValues(value);
36783
- // 获取合法的 content
36784
- var content = renderResultContent(_result[0]);
36785
- if (typeof content === 'string') {
36786
- placeholder2 = content;
36787
- }
36823
+ _placeholder = renderResultContent(_result[0]);
36788
36824
  }
36789
36825
  return /*#__PURE__*/(0,jsx_runtime.jsx)((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, {
36790
36826
  children: /*#__PURE__*/(0,jsx_runtime.jsx)(result_input, {
@@ -36802,7 +36838,7 @@ var result_Result = function Result(props) {
36802
36838
  convertBr: convertBr,
36803
36839
  onInputBlur: onInputBlur,
36804
36840
  onClearCreatedData: onClearCreatedData,
36805
- placeholder: placeholder2,
36841
+ placeholder: _placeholder,
36806
36842
  disabled: isFunc(disabled) ? false : !!disabled
36807
36843
  })
36808
36844
  }, 'input');
@@ -42443,6 +42479,9 @@ var DatePicker = function DatePicker(props0) {
42443
42479
  _React$useState2 = slicedToArray_default()(_React$useState, 2),
42444
42480
  activeIndex = _React$useState2[0],
42445
42481
  setActiveIndex = _React$useState2[1];
42482
+ var inputRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
42483
+ inputRef: null
42484
+ });
42446
42485
  var styles = jssStyle === null || jssStyle === void 0 || (_jssStyle$datePicker = jssStyle.datePicker) === null || _jssStyle$datePicker === void 0 ? void 0 : _jssStyle$datePicker.call(jssStyle);
42447
42486
  var isRTL = direction === 'rtl';
42448
42487
  var dfp = isRTL ? 'bottom-right' : 'bottom-left';
@@ -42541,6 +42580,11 @@ var DatePicker = function DatePicker(props0) {
42541
42580
  setFocused(false);
42542
42581
  (_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 || _props$onBlur.call(props, e);
42543
42582
  });
42583
+ var handleClose = function handleClose() {
42584
+ var _inputRef$current$inp;
42585
+ closePop();
42586
+ (_inputRef$current$inp = inputRef.current.inputRef) === null || _inputRef$current$inp === void 0 || _inputRef$current$inp.blur();
42587
+ };
42544
42588
  var handleResultClick = usePersistFn(function () {
42545
42589
  if (disabledStatus === 'all') return;
42546
42590
  openPop();
@@ -42553,6 +42597,7 @@ var DatePicker = function DatePicker(props0) {
42553
42597
  activeIndex: activeIndex,
42554
42598
  type: type,
42555
42599
  range: range,
42600
+ onRef: inputRef,
42556
42601
  inputable: props.inputable && !props.formatResult,
42557
42602
  disabledLeft: disabledStatus === 'left',
42558
42603
  disabledRight: disabledStatus === 'right',
@@ -42581,7 +42626,7 @@ var DatePicker = function DatePicker(props0) {
42581
42626
  onKeyDown: function onKeyDown(e) {
42582
42627
  if (e.key === 'Enter') {
42583
42628
  if (open) {
42584
- closePop();
42629
+ handleClose();
42585
42630
  } else {
42586
42631
  openPop();
42587
42632
  }
@@ -42638,7 +42683,7 @@ var DatePicker = function DatePicker(props0) {
42638
42683
  options: options,
42639
42684
  disabled: disabled,
42640
42685
  jssStyle: jssStyle,
42641
- closePop: closePop,
42686
+ closePop: handleClose,
42642
42687
  defaultTime: props.defaultTime,
42643
42688
  min: props.min,
42644
42689
  max: props.max,
@@ -63686,7 +63731,7 @@ var upload_interface = __webpack_require__(8821);
63686
63731
 
63687
63732
 
63688
63733
  /* harmony default export */ var src_0 = ({
63689
- version: '3.3.3-beta.7'
63734
+ version: '3.3.3-fix.1'
63690
63735
  });
63691
63736
  }();
63692
63737
  /******/ return __webpack_exports__;