shineout 3.10.2 → 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 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.2'
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.2');
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
 
@@ -32937,7 +32937,8 @@ var addResizeObserver = function addResizeObserver(el, handler) {
32937
32937
  }
32938
32938
  if (options.lazy && el.getAttribute('data-observer-hidden') === 'true') {
32939
32939
  el.removeAttribute('data-observer-hidden');
32940
- return;
32940
+ // 隐藏前已测量过有效尺寸才跳过;初始化即隐藏(如父容器 display:none)的元素首次可见时需要触发回调
32941
+ if (lastWidth || lastHeight) return;
32941
32942
  }
32942
32943
  if (width && direction === 'x') {
32943
32944
  if (lastWidth !== width) {
@@ -54453,6 +54454,47 @@ var SchemaBuilder = /*#__PURE__*/function () {
54453
54454
  }]);
54454
54455
  return SchemaBuilder;
54455
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
+ };
54456
54498
  ;// CONCATENATED MODULE: ../hooks/src/components/use-form/use-form.ts
54457
54499
 
54458
54500
 
@@ -54467,6 +54509,7 @@ var SchemaBuilder = /*#__PURE__*/function () {
54467
54509
 
54468
54510
 
54469
54511
 
54512
+
54470
54513
  var globalKey = '__global__&&@@';
54471
54514
  var SUBMIT_TIMEOUT = 10;
54472
54515
  var RESET_TIMEOUT = 500;
@@ -54497,7 +54540,9 @@ var useForm = function useForm(props) {
54497
54540
  scrollParent = props.scrollParent,
54498
54541
  isControl = props.isControl,
54499
54542
  _props$validateTrigge = props.validateTrigger,
54500
- 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;
54501
54546
  var deepSetOptions = {
54502
54547
  removeUndefined: removeUndefined,
54503
54548
  forceSet: true
@@ -54513,7 +54558,8 @@ var useForm = function useForm(props) {
54513
54558
  removeArr: new Set(),
54514
54559
  names: new Set(),
54515
54560
  submitLock: false,
54516
- value: deepClone(props.value) || emptyObj,
54561
+ // deepClone 为 false 时跳过全量深拷贝,与外部 value 共享引用(依赖 immer 不可变更新)
54562
+ value: (shouldDeepClone ? deepClone(props.value) : props.value) || emptyObj,
54517
54563
  errors: {},
54518
54564
  serverErrors: {},
54519
54565
  lastValue: props.value || emptyObj,
@@ -54648,6 +54694,13 @@ var useForm = function useForm(props) {
54648
54694
  }
54649
54695
  });
54650
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
+ }, []);
54651
54704
  var update = function update(name) {
54652
54705
  var _context$flowMap$glob;
54653
54706
  if (!name) {
@@ -55054,9 +55107,10 @@ var useForm = function useForm(props) {
55054
55107
  watch: function watch() {
55055
55108
  var names = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [globalKey];
55056
55109
  var updateFn = arguments.length > 1 ? arguments[1] : undefined;
55110
+ var fn = shouldDeepClone ? updateFn : getFlowGuard(names, updateFn);
55057
55111
  names.forEach(function (name) {
55058
55112
  context.flowMap[name] = context.flowMap[name] || new Set();
55059
- context.flowMap[name].add(updateFn);
55113
+ context.flowMap[name].add(fn);
55060
55114
  });
55061
55115
  },
55062
55116
  unWatch: function unWatch() {
@@ -55064,7 +55118,7 @@ var useForm = function useForm(props) {
55064
55118
  var updateFn = arguments.length > 1 ? arguments[1] : undefined;
55065
55119
  names.forEach(function (name) {
55066
55120
  if (updateFn) {
55067
- context.flowMap[name].delete(updateFn);
55121
+ context.flowMap[name].delete(shouldDeepClone ? updateFn : getFlowGuard(names, updateFn));
55068
55122
  } else {
55069
55123
  delete context.flowMap[name];
55070
55124
  }
@@ -55111,7 +55165,7 @@ var useForm = function useForm(props) {
55111
55165
  }, [labelWidth, labelAlign, labelVerticalAlign, keepErrorHeight, inline, disabled, size, formName, colon, validateTrigger]);
55112
55166
  var updateValue = function updateValue() {
55113
55167
  if (props.value !== context.lastValue && props.value !== context.value) {
55114
- context.value = deepClone(props.value) || emptyObj;
55168
+ context.value = (shouldDeepClone ? deepClone(props.value) : props.value) || emptyObj;
55115
55169
  }
55116
55170
  context.lastValue = props.value;
55117
55171
  };
@@ -70706,8 +70760,6 @@ function Table(props) {
70706
70760
  };
70707
70761
  var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
70708
70762
  emptyHeight: 0,
70709
- theadHeight: 0,
70710
- tfootHeight: 0,
70711
70763
  scrollingTimer: null
70712
70764
  }),
70713
70765
  context = _useRef.current;
@@ -70859,16 +70911,19 @@ function Table(props) {
70859
70911
  onChange: inputableData.onChange,
70860
70912
  disabled: props.disabled
70861
70913
  });
70914
+ var _useState7 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
70915
+ _useState8 = slicedToArray_default()(_useState7, 2),
70916
+ theadHeight = _useState8[0],
70917
+ setTheadHeight = _useState8[1];
70918
+ var _useState9 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
70919
+ _useState10 = slicedToArray_default()(_useState9, 2),
70920
+ tfootHeight = _useState10[0],
70921
+ setTfootHeight = _useState10[1];
70862
70922
  var handleTheadAndTfootHeight = usePersistFn(function () {
70863
70923
  var _theadRef$current, _tfootRef$current;
70864
- var theadHeight = (theadRef === null || theadRef === void 0 || (_theadRef$current = theadRef.current) === null || _theadRef$current === void 0 ? void 0 : _theadRef$current.clientHeight) || 0;
70865
- var tfootHeight = ((_tfootRef$current = tfootRef.current) === null || _tfootRef$current === void 0 ? void 0 : _tfootRef$current.clientHeight) || 0;
70866
- if (props.sticky) {
70867
- context.tfootHeight = tfootHeight;
70868
- } else {
70869
- context.theadHeight = theadHeight;
70870
- context.tfootHeight = tfootHeight;
70871
- }
70924
+ // sticky 时表头由 Sticky 单独渲染,不计入虚拟列表高度
70925
+ if (!props.sticky) setTheadHeight(((_theadRef$current = theadRef.current) === null || _theadRef$current === void 0 ? void 0 : _theadRef$current.clientHeight) || 0);
70926
+ setTfootHeight(((_tfootRef$current = tfootRef.current) === null || _tfootRef$current === void 0 ? void 0 : _tfootRef$current.clientHeight) || 0);
70872
70927
  });
70873
70928
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
70874
70929
  handleTheadAndTfootHeight();
@@ -70907,8 +70962,8 @@ function Table(props) {
70907
70962
  innerRef: tbodyRef,
70908
70963
  scrollLeft: props.scrollLeft,
70909
70964
  isRtl: isRtl,
70910
- theadHeight: context.theadHeight,
70911
- tfootHeight: context.tfootHeight,
70965
+ theadHeight: theadHeight,
70966
+ tfootHeight: tfootHeight,
70912
70967
  virtualScrollContainer: props.virtualScrollContainer,
70913
70968
  tableRef: tableRef,
70914
70969
  externalStickyHeader: !!props.virtualScrollContainer && !!props.sticky
@@ -80157,7 +80212,7 @@ var watermark_interface = __webpack_require__(6640);
80157
80212
 
80158
80213
 
80159
80214
  /* harmony default export */ var src_0 = ({
80160
- version: '3.10.2'
80215
+ version: '3.10.3-beta.2'
80161
80216
  });
80162
80217
  }();
80163
80218
  /******/ return __webpack_exports__;