shineout 3.6.7-beta.6 → 3.6.7-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
@@ -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.7-beta.6'
517
+ version: '3.6.7-fix.1'
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.7-beta.6');
12220
+ /* harmony default export */ var version = ('3.6.7-fix.1');
12221
12221
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12222
12222
 
12223
12223
 
@@ -34951,19 +34951,18 @@ function useInputAble(props) {
34951
34951
  var render = useRender(syncValue);
34952
34952
  var shouldUseState = delay || !control;
34953
34953
  var value = shouldUseState ? stateValue : valuePo;
34954
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
34955
- if (context.timer) {
34956
- clearTimeout(context.timer);
34957
- context.timer = null;
34958
- }
34954
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
34959
34955
  if (delay && control && props.value !== stateValue) {
34960
34956
  changeStateValue(props.value);
34957
+ } else if (context.timer) {
34958
+ clearTimeout(context.timer);
34959
+ context.timer = null;
34961
34960
  }
34962
34961
  }, [props.value, delay, control]);
34963
34962
  var forceDelayChange = use_persist_fn(function () {
34964
- if (context.timer && context.delayChange) {
34963
+ if (context.delayChange) context.delayChange();
34964
+ if (context.timer) {
34965
34965
  clearTimeout(context.timer);
34966
- context.delayChange();
34967
34966
  context.timer = null;
34968
34967
  context.delayChange = null;
34969
34968
  }
@@ -49572,7 +49571,8 @@ var useForm = function useForm(props) {
49572
49571
  resetTime: 0,
49573
49572
  mounted: false,
49574
49573
  unmounted: false,
49575
- removeLock: false
49574
+ removeLock: false,
49575
+ settingMap: {}
49576
49576
  }),
49577
49577
  context = _React$useRef.current;
49578
49578
  var update = function update(name) {
@@ -49809,6 +49809,8 @@ var useForm = function useForm(props) {
49809
49809
  // upload组件返回的可能是函数: (prev) => [...prev, file]
49810
49810
  var valueOfKey = typeof vals[key] === 'function' ? vals[key](getValue(key)) : vals[key];
49811
49811
  deepSet(draft, key, valueOfKey, deepSetOptions);
49812
+ // 设置 settingMap 用于标记该字段正在被设置值
49813
+ context.settingMap[key] = true;
49812
49814
  });
49813
49815
  values.forEach(function (key) {
49814
49816
  if (option.validate) {
@@ -49819,6 +49821,13 @@ var useForm = function useForm(props) {
49819
49821
  });
49820
49822
  }
49821
49823
  });
49824
+
49825
+ // 设置 settingMap 的值为 false,表示该字段设置值完成
49826
+ setTimeout(function () {
49827
+ values.forEach(function (key) {
49828
+ delete context.settingMap[key];
49829
+ });
49830
+ });
49822
49831
  });
49823
49832
 
49824
49833
  // 获取vals的所有key,包括嵌套对象的key
@@ -49999,11 +50008,18 @@ var useForm = function useForm(props) {
49999
50008
  context.updateMap[n].add(updateFn);
50000
50009
  var shouldTriggerResetChange = context.removeArr.has(n);
50001
50010
  context.removeArr.delete(n);
50002
- var shouldTriggerDefaultChange = df !== undefined && deepGet(context.value, n) === undefined;
50011
+ var currentValue = deepGet(context.value, n);
50012
+ var shouldTriggerDefaultChange = df !== undefined && currentValue === undefined;
50003
50013
  if (shouldTriggerDefaultChange || shouldTriggerResetChange) {
50004
50014
  if (!context.mounted) context.defaultValues[n] = df;
50015
+ var _defaultValue = df;
50016
+
50017
+ // 如果组件是重新 bind ,比如更改了 key 或者通过三元表达式切换了组件但 name 都是相同的情况下,在切换过程中改了 value 的值(比如通过 datum.set),需要阻止 defaultValue 的上位,按照当前的 value 来设置 defaultValue
50018
+ if (shouldTriggerResetChange && context.settingMap[n]) {
50019
+ _defaultValue = currentValue !== undefined ? currentValue : df;
50020
+ }
50005
50021
  onChange(function (v) {
50006
- deepSet(v, n, df, deepSetOptions);
50022
+ deepSet(v, n, _defaultValue, deepSetOptions);
50007
50023
  });
50008
50024
  update(n);
50009
50025
  }
@@ -70160,7 +70176,7 @@ var upload_interface = __webpack_require__(8821);
70160
70176
 
70161
70177
 
70162
70178
  /* harmony default export */ var src_0 = ({
70163
- version: '3.6.7-beta.6'
70179
+ version: '3.6.7-fix.1'
70164
70180
  });
70165
70181
  }();
70166
70182
  /******/ return __webpack_exports__;