shineout 3.6.5-beta.5 → 3.6.5-beta.6

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
@@ -514,5 +514,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
514
514
  // 此文件由脚本自动生成,请勿直接修改。
515
515
  // This file was generated automatically by a script. Please do not modify it directly.
516
516
  var _default = exports.default = {
517
- version: '3.6.5-beta.5'
517
+ version: '3.6.5-beta.6'
518
518
  };
package/dist/shineout.js CHANGED
@@ -12217,7 +12217,7 @@ var handleStyle = function handleStyle(style) {
12217
12217
  };
12218
12218
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12219
12219
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12220
- /* harmony default export */ var version = ('3.6.5-beta.5');
12220
+ /* harmony default export */ var version = ('3.6.5-beta.6');
12221
12221
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12222
12222
 
12223
12223
 
@@ -34961,11 +34961,11 @@ function useInputAble(props) {
34961
34961
  context.delayChange = function () {
34962
34962
  context.timer = null;
34963
34963
  context.delayChange = null;
34964
- onChange.apply(void 0, [isFunc(vv) ? vv() : vv].concat(other));
34964
+ onChange.apply(void 0, [vv].concat(other));
34965
34965
  render();
34966
34966
  };
34967
34967
  if (!delay) {
34968
- onChange.apply(void 0, [isFunc(vv) ? vv() : vv].concat(other));
34968
+ onChange.apply(void 0, [vv].concat(other));
34969
34969
  } else {
34970
34970
  if (context.timer) clearTimeout(context.timer);
34971
34971
  context.timer = setTimeout(context.delayChange, delay);
@@ -66648,21 +66648,22 @@ var useUpload = function useUpload(props) {
66648
66648
  responseType: props.responseType,
66649
66649
  onStart: props.onStart,
66650
66650
  onProgress: function onProgress(e, msg) {
66651
- if (throttle) return;
66651
+ var percent = typeof e.percent === 'number' ? e.percent : e.loaded / e.total * 100;
66652
+ if (throttle && percent !== 100) return;
66652
66653
  throttle = true;
66653
66654
  setTimeout(function () {
66654
66655
  throttle = false;
66655
66656
  }, 16);
66656
- var percent = typeof e.percent === 'number' ? e.percent : e.loaded / e.total * 100;
66657
- var filesState = latestState.filesState;
66658
- var newFiles = objectSpread2_default()({}, filesState);
66659
- if (!newFiles[id]) return;
66660
- newFiles[id].process = percent;
66661
- if (msg) newFiles[id].message = msg;
66662
- setFiles(newFiles);
66663
- if (typeof props.onProgress === 'function') {
66664
- props.onProgress(newFiles[id]);
66665
- }
66657
+ setFiles(function (files) {
66658
+ return utils_immer_produce(files, function (draft) {
66659
+ if (!draft[id]) return draft;
66660
+ draft[id].process = percent;
66661
+ if (msg) draft[id].message = msg;
66662
+ if (typeof props.onProgress === 'function') {
66663
+ props.onProgress(draft[id]);
66664
+ }
66665
+ });
66666
+ });
66666
66667
  },
66667
66668
  onLoad: function onLoad(xhr) {
66668
66669
  if (!/^2|1223/.test("".concat(xhr.status))) {
@@ -66690,10 +66691,17 @@ var useUpload = function useUpload(props) {
66690
66691
  delete draft[id];
66691
66692
  });
66692
66693
  });
66693
- // add value
66694
- props.onChange(function (prev) {
66695
- return [].concat(toConsumableArray_default()(prev || []), [result]);
66696
- });
66694
+ if (props.functionalOnChange) {
66695
+ // 回调型 setState不会丢值
66696
+ props.onChange(function (prev) {
66697
+ return [].concat(toConsumableArray_default()(prev || []), [result]);
66698
+ });
66699
+ } else {
66700
+ var latestValue = latestState.value;
66701
+ var newValue = toConsumableArray_default()(latestValue);
66702
+ newValue.push(result);
66703
+ props.onChange(newValue);
66704
+ }
66697
66705
  }
66698
66706
  },
66699
66707
  onError: function onError(xhr) {
@@ -67250,7 +67258,8 @@ var Upload = function Upload(props0) {
67250
67258
  invalidImage: getLocale(locale, 'invalidImage')
67251
67259
  },
67252
67260
  value: value,
67253
- onChange: onChange
67261
+ onChange: onChange,
67262
+ functionalOnChange: props.functionalOnChange
67254
67263
  })),
67255
67264
  func = _useUpload.func,
67256
67265
  files = _useUpload.files,
@@ -70034,7 +70043,7 @@ var upload_interface = __webpack_require__(8821);
70034
70043
 
70035
70044
 
70036
70045
  /* harmony default export */ var src_0 = ({
70037
- version: '3.6.5-beta.5'
70046
+ version: '3.6.5-beta.6'
70038
70047
  });
70039
70048
  }();
70040
70049
  /******/ return __webpack_exports__;