shineout 3.10.3-beta.1 → 3.10.3-beta.2
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 +1 -1
- package/dist/shineout.js +60 -7
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/dist/shineout.min.js.map +1 -1
- package/esm/index.js +1 -1
- package/package.json +5 -5
package/cjs/index.js
CHANGED
|
@@ -545,5 +545,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
545
545
|
// 此文件由脚本自动生成,请勿直接修改。
|
|
546
546
|
// This file was generated automatically by a script. Please do not modify it directly.
|
|
547
547
|
var _default = exports.default = {
|
|
548
|
-
version: '3.10.3-beta.
|
|
548
|
+
version: '3.10.3-beta.2'
|
|
549
549
|
};
|
package/dist/shineout.js
CHANGED
|
@@ -13736,7 +13736,7 @@ var handleStyle = function handleStyle(style) {
|
|
|
13736
13736
|
};
|
|
13737
13737
|
/* harmony default export */ var jss_style_handleStyle = (handleStyle);
|
|
13738
13738
|
;// CONCATENATED MODULE: ../shineout-style/src/version.ts
|
|
13739
|
-
/* harmony default export */ var version = ('3.10.3-beta.
|
|
13739
|
+
/* harmony default export */ var version = ('3.10.3-beta.2');
|
|
13740
13740
|
;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
|
|
13741
13741
|
|
|
13742
13742
|
|
|
@@ -54454,6 +54454,47 @@ var SchemaBuilder = /*#__PURE__*/function () {
|
|
|
54454
54454
|
}]);
|
|
54455
54455
|
return SchemaBuilder;
|
|
54456
54456
|
}();
|
|
54457
|
+
;// CONCATENATED MODULE: ../hooks/src/components/use-form/flow-guard.ts
|
|
54458
|
+
|
|
54459
|
+
|
|
54460
|
+
/**
|
|
54461
|
+
* 为 Form.Flow 的更新函数加一层守卫:只有 Flow 关心的值发生变化时才触发更新。
|
|
54462
|
+
*
|
|
54463
|
+
* 依赖数据按 immutable 方式更新(结构共享):值没变引用就不变,因此可以用引用比较判断。
|
|
54464
|
+
* - 不带 names(globalKey):对表单根对象做浅比较
|
|
54465
|
+
* - 带 names:逐个比较对应路径的值
|
|
54466
|
+
*
|
|
54467
|
+
* 守卫以 updateFn 为 key 缓存,Flow 因 names 引用变化而重复 watch 时快照不丢失。
|
|
54468
|
+
* 首次通知没有快照,一律放行(Flow 渲染到挂载 watch 之间值可能已变化)。
|
|
54469
|
+
*/
|
|
54470
|
+
var createFlowGuard = function createFlowGuard(getFormValue, globalKey) {
|
|
54471
|
+
var guards = new WeakMap();
|
|
54472
|
+
return function (names, updateFn) {
|
|
54473
|
+
var guard = guards.get(updateFn);
|
|
54474
|
+
if (!guard) {
|
|
54475
|
+
var g = {
|
|
54476
|
+
names: names,
|
|
54477
|
+
snapshot: undefined,
|
|
54478
|
+
fn: function fn() {
|
|
54479
|
+
var formValue = getFormValue();
|
|
54480
|
+
var next = g.names.map(function (n) {
|
|
54481
|
+
return n === globalKey ? formValue : deepGet(formValue, n);
|
|
54482
|
+
});
|
|
54483
|
+
var prev = g.snapshot;
|
|
54484
|
+
var same = !!prev && prev.length === next.length && next.every(function (v, i) {
|
|
54485
|
+
return g.names[i] === globalKey ? shallow_equal_shallowEqual(prev[i], v) : prev[i] === v;
|
|
54486
|
+
});
|
|
54487
|
+
g.snapshot = next;
|
|
54488
|
+
if (!same) updateFn();
|
|
54489
|
+
}
|
|
54490
|
+
};
|
|
54491
|
+
guard = g;
|
|
54492
|
+
guards.set(updateFn, g);
|
|
54493
|
+
}
|
|
54494
|
+
guard.names = names;
|
|
54495
|
+
return guard.fn;
|
|
54496
|
+
};
|
|
54497
|
+
};
|
|
54457
54498
|
;// CONCATENATED MODULE: ../hooks/src/components/use-form/use-form.ts
|
|
54458
54499
|
|
|
54459
54500
|
|
|
@@ -54468,6 +54509,7 @@ var SchemaBuilder = /*#__PURE__*/function () {
|
|
|
54468
54509
|
|
|
54469
54510
|
|
|
54470
54511
|
|
|
54512
|
+
|
|
54471
54513
|
var globalKey = '__global__&&@@';
|
|
54472
54514
|
var SUBMIT_TIMEOUT = 10;
|
|
54473
54515
|
var RESET_TIMEOUT = 500;
|
|
@@ -54498,7 +54540,9 @@ var useForm = function useForm(props) {
|
|
|
54498
54540
|
scrollParent = props.scrollParent,
|
|
54499
54541
|
isControl = props.isControl,
|
|
54500
54542
|
_props$validateTrigge = props.validateTrigger,
|
|
54501
|
-
validateTrigger = _props$validateTrigge === void 0 ? 'change' : _props$validateTrigge
|
|
54543
|
+
validateTrigger = _props$validateTrigge === void 0 ? 'change' : _props$validateTrigge,
|
|
54544
|
+
_props$deepClone = props.deepClone,
|
|
54545
|
+
shouldDeepClone = _props$deepClone === void 0 ? true : _props$deepClone;
|
|
54502
54546
|
var deepSetOptions = {
|
|
54503
54547
|
removeUndefined: removeUndefined,
|
|
54504
54548
|
forceSet: true
|
|
@@ -54514,7 +54558,8 @@ var useForm = function useForm(props) {
|
|
|
54514
54558
|
removeArr: new Set(),
|
|
54515
54559
|
names: new Set(),
|
|
54516
54560
|
submitLock: false,
|
|
54517
|
-
|
|
54561
|
+
// deepClone 为 false 时跳过全量深拷贝,与外部 value 共享引用(依赖 immer 不可变更新)
|
|
54562
|
+
value: (shouldDeepClone ? deepClone(props.value) : props.value) || emptyObj,
|
|
54518
54563
|
errors: {},
|
|
54519
54564
|
serverErrors: {},
|
|
54520
54565
|
lastValue: props.value || emptyObj,
|
|
@@ -54649,6 +54694,13 @@ var useForm = function useForm(props) {
|
|
|
54649
54694
|
}
|
|
54650
54695
|
});
|
|
54651
54696
|
});
|
|
54697
|
+
|
|
54698
|
+
// deepClone 为 false 时,Flow 仅在其关心的值变化时才更新(见 flow-guard.ts)
|
|
54699
|
+
var getFlowGuard = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
|
|
54700
|
+
return createFlowGuard(function () {
|
|
54701
|
+
return context.value;
|
|
54702
|
+
}, globalKey);
|
|
54703
|
+
}, []);
|
|
54652
54704
|
var update = function update(name) {
|
|
54653
54705
|
var _context$flowMap$glob;
|
|
54654
54706
|
if (!name) {
|
|
@@ -55055,9 +55107,10 @@ var useForm = function useForm(props) {
|
|
|
55055
55107
|
watch: function watch() {
|
|
55056
55108
|
var names = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [globalKey];
|
|
55057
55109
|
var updateFn = arguments.length > 1 ? arguments[1] : undefined;
|
|
55110
|
+
var fn = shouldDeepClone ? updateFn : getFlowGuard(names, updateFn);
|
|
55058
55111
|
names.forEach(function (name) {
|
|
55059
55112
|
context.flowMap[name] = context.flowMap[name] || new Set();
|
|
55060
|
-
context.flowMap[name].add(
|
|
55113
|
+
context.flowMap[name].add(fn);
|
|
55061
55114
|
});
|
|
55062
55115
|
},
|
|
55063
55116
|
unWatch: function unWatch() {
|
|
@@ -55065,7 +55118,7 @@ var useForm = function useForm(props) {
|
|
|
55065
55118
|
var updateFn = arguments.length > 1 ? arguments[1] : undefined;
|
|
55066
55119
|
names.forEach(function (name) {
|
|
55067
55120
|
if (updateFn) {
|
|
55068
|
-
context.flowMap[name].delete(updateFn);
|
|
55121
|
+
context.flowMap[name].delete(shouldDeepClone ? updateFn : getFlowGuard(names, updateFn));
|
|
55069
55122
|
} else {
|
|
55070
55123
|
delete context.flowMap[name];
|
|
55071
55124
|
}
|
|
@@ -55112,7 +55165,7 @@ var useForm = function useForm(props) {
|
|
|
55112
55165
|
}, [labelWidth, labelAlign, labelVerticalAlign, keepErrorHeight, inline, disabled, size, formName, colon, validateTrigger]);
|
|
55113
55166
|
var updateValue = function updateValue() {
|
|
55114
55167
|
if (props.value !== context.lastValue && props.value !== context.value) {
|
|
55115
|
-
context.value = deepClone(props.value) || emptyObj;
|
|
55168
|
+
context.value = (shouldDeepClone ? deepClone(props.value) : props.value) || emptyObj;
|
|
55116
55169
|
}
|
|
55117
55170
|
context.lastValue = props.value;
|
|
55118
55171
|
};
|
|
@@ -80159,7 +80212,7 @@ var watermark_interface = __webpack_require__(6640);
|
|
|
80159
80212
|
|
|
80160
80213
|
|
|
80161
80214
|
/* harmony default export */ var src_0 = ({
|
|
80162
|
-
version: '3.10.3-beta.
|
|
80215
|
+
version: '3.10.3-beta.2'
|
|
80163
80216
|
});
|
|
80164
80217
|
}();
|
|
80165
80218
|
/******/ return __webpack_exports__;
|