shineout 3.6.5-beta.4 → 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.4'
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.4');
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);
@@ -50740,8 +50740,6 @@ var use_form_flow_UseFormItem = function UseFormItem(props) {
50740
50740
 
50741
50741
  var FormFlow = function FormFlow(props) {
50742
50742
  var _props$names;
50743
- var _props$strict = props.strict,
50744
- strict = _props$strict === void 0 ? true : _props$strict;
50745
50743
  var datum = use_form_flow({
50746
50744
  names: props.names
50747
50745
  });
@@ -50749,13 +50747,13 @@ var FormFlow = function FormFlow(props) {
50749
50747
  return datum === null || datum === void 0 ? void 0 : datum.get(name);
50750
50748
  });
50751
50749
  var memoizedResult = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
50752
- if (!strict) return null;
50750
+ if (!props.strict) return null;
50753
50751
  if (isFunc(props.children)) {
50754
50752
  return props.children(datum);
50755
50753
  }
50756
50754
  return props.children;
50757
50755
  }, [valueOfNames === null || valueOfNames === void 0 ? void 0 : valueOfNames.toString()]);
50758
- if (strict) {
50756
+ if (props.strict) {
50759
50757
  return memoizedResult;
50760
50758
  }
50761
50759
  if (isFunc(props.children)) {
@@ -66650,21 +66648,22 @@ var useUpload = function useUpload(props) {
66650
66648
  responseType: props.responseType,
66651
66649
  onStart: props.onStart,
66652
66650
  onProgress: function onProgress(e, msg) {
66653
- if (throttle) return;
66651
+ var percent = typeof e.percent === 'number' ? e.percent : e.loaded / e.total * 100;
66652
+ if (throttle && percent !== 100) return;
66654
66653
  throttle = true;
66655
66654
  setTimeout(function () {
66656
66655
  throttle = false;
66657
66656
  }, 16);
66658
- var percent = typeof e.percent === 'number' ? e.percent : e.loaded / e.total * 100;
66659
- var filesState = latestState.filesState;
66660
- var newFiles = objectSpread2_default()({}, filesState);
66661
- if (!newFiles[id]) return;
66662
- newFiles[id].process = percent;
66663
- if (msg) newFiles[id].message = msg;
66664
- setFiles(newFiles);
66665
- if (typeof props.onProgress === 'function') {
66666
- props.onProgress(newFiles[id]);
66667
- }
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
+ });
66668
66667
  },
66669
66668
  onLoad: function onLoad(xhr) {
66670
66669
  if (!/^2|1223/.test("".concat(xhr.status))) {
@@ -66692,10 +66691,17 @@ var useUpload = function useUpload(props) {
66692
66691
  delete draft[id];
66693
66692
  });
66694
66693
  });
66695
- // add value
66696
- props.onChange(function (prev) {
66697
- return [].concat(toConsumableArray_default()(prev || []), [result]);
66698
- });
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
+ }
66699
66705
  }
66700
66706
  },
66701
66707
  onError: function onError(xhr) {
@@ -67252,7 +67258,8 @@ var Upload = function Upload(props0) {
67252
67258
  invalidImage: getLocale(locale, 'invalidImage')
67253
67259
  },
67254
67260
  value: value,
67255
- onChange: onChange
67261
+ onChange: onChange,
67262
+ functionalOnChange: props.functionalOnChange
67256
67263
  })),
67257
67264
  func = _useUpload.func,
67258
67265
  files = _useUpload.files,
@@ -70036,7 +70043,7 @@ var upload_interface = __webpack_require__(8821);
70036
70043
 
70037
70044
 
70038
70045
  /* harmony default export */ var src_0 = ({
70039
- version: '3.6.5-beta.4'
70046
+ version: '3.6.5-beta.6'
70040
70047
  });
70041
70048
  }();
70042
70049
  /******/ return __webpack_exports__;