@sheinx/hooks 3.5.0-beta.5 → 3.5.0-beta.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. package/cjs/common/use-in-view/index.d.ts +2 -0
  2. package/cjs/common/use-in-view/index.d.ts.map +1 -0
  3. package/cjs/common/use-in-view/index.js +14 -0
  4. package/cjs/common/use-in-view/use-in-view.d.ts +14 -0
  5. package/cjs/common/use-in-view/use-in-view.d.ts.map +1 -0
  6. package/cjs/common/use-in-view/use-in-view.js +73 -0
  7. package/cjs/components/use-form/index.d.ts +1 -0
  8. package/cjs/components/use-form/index.d.ts.map +1 -1
  9. package/cjs/components/use-form/index.js +12 -0
  10. package/cjs/components/use-form/use-form-context.d.ts +6 -0
  11. package/cjs/components/use-form/use-form-context.d.ts.map +1 -0
  12. package/cjs/components/use-form/use-form-context.js +22 -0
  13. package/cjs/components/use-form/use-form-context.type.d.ts +45 -0
  14. package/cjs/components/use-form/use-form-context.type.d.ts.map +1 -0
  15. package/cjs/components/use-form/use-form-context.type.js +5 -0
  16. package/cjs/components/use-form/use-form.d.ts.map +1 -1
  17. package/cjs/components/use-form/use-form.js +4 -2
  18. package/cjs/components/use-form/use-form.type.d.ts +7 -0
  19. package/cjs/components/use-form/use-form.type.d.ts.map +1 -1
  20. package/cjs/components/use-image/use-image.d.ts.map +1 -1
  21. package/cjs/components/use-image/use-image.js +7 -0
  22. package/cjs/components/use-image/use-image.type.d.ts +7 -0
  23. package/cjs/components/use-image/use-image.type.d.ts.map +1 -1
  24. package/cjs/components/use-table/use-table-group.d.ts.map +1 -1
  25. package/cjs/components/use-table/use-table-group.js +2 -1
  26. package/cjs/components/use-table/use-table-layout.d.ts.map +1 -1
  27. package/cjs/components/use-table/use-table-layout.js +2 -1
  28. package/cjs/components/use-table/use-table.type.d.ts +12 -0
  29. package/cjs/components/use-table/use-table.type.d.ts.map +1 -1
  30. package/cjs/index.d.ts +1 -0
  31. package/cjs/index.d.ts.map +1 -1
  32. package/cjs/index.js +12 -0
  33. package/cjs/utils/lazyload.d.ts +1 -0
  34. package/cjs/utils/lazyload.d.ts.map +1 -1
  35. package/cjs/utils/lazyload.js +3 -0
  36. package/esm/common/use-in-view/index.d.ts +2 -0
  37. package/esm/common/use-in-view/index.d.ts.map +1 -0
  38. package/esm/common/use-in-view/index.js +2 -0
  39. package/esm/common/use-in-view/use-in-view.d.ts +14 -0
  40. package/esm/common/use-in-view/use-in-view.d.ts.map +1 -0
  41. package/esm/common/use-in-view/use-in-view.js +70 -0
  42. package/esm/components/use-form/index.d.ts +1 -0
  43. package/esm/components/use-form/index.d.ts.map +1 -1
  44. package/esm/components/use-form/index.js +1 -0
  45. package/esm/components/use-form/use-form-context.d.ts +6 -0
  46. package/esm/components/use-form/use-form-context.d.ts.map +1 -0
  47. package/esm/components/use-form/use-form-context.js +13 -0
  48. package/esm/components/use-form/use-form-context.type.d.ts +45 -0
  49. package/esm/components/use-form/use-form-context.type.d.ts.map +1 -0
  50. package/esm/components/use-form/use-form-context.type.js +1 -0
  51. package/esm/components/use-form/use-form.d.ts.map +1 -1
  52. package/esm/components/use-form/use-form.js +4 -2
  53. package/esm/components/use-form/use-form.type.d.ts +7 -0
  54. package/esm/components/use-form/use-form.type.d.ts.map +1 -1
  55. package/esm/components/use-image/use-image.d.ts.map +1 -1
  56. package/esm/components/use-image/use-image.js +7 -0
  57. package/esm/components/use-image/use-image.type.d.ts +7 -0
  58. package/esm/components/use-image/use-image.type.d.ts.map +1 -1
  59. package/esm/components/use-table/use-table-group.d.ts.map +1 -1
  60. package/esm/components/use-table/use-table-group.js +3 -2
  61. package/esm/components/use-table/use-table-layout.d.ts.map +1 -1
  62. package/esm/components/use-table/use-table-layout.js +2 -1
  63. package/esm/components/use-table/use-table.type.d.ts +12 -0
  64. package/esm/components/use-table/use-table.type.d.ts.map +1 -1
  65. package/esm/index.d.ts +1 -0
  66. package/esm/index.d.ts.map +1 -1
  67. package/esm/index.js +1 -0
  68. package/esm/utils/lazyload.d.ts +1 -0
  69. package/esm/utils/lazyload.d.ts.map +1 -1
  70. package/esm/utils/lazyload.js +3 -0
  71. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ export { default as useInView } from './use-in-view';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ "use client";
3
+
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ Object.defineProperty(exports, "useInView", {
8
+ enumerable: true,
9
+ get: function get() {
10
+ return _useInView.default;
11
+ }
12
+ });
13
+ var _useInView = _interopRequireDefault(require("./use-in-view"));
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ interface UseInViewOptions {
3
+ root?: HTMLElement | null;
4
+ rootMargin?: string;
5
+ threshold?: number | number[];
6
+ once?: boolean;
7
+ }
8
+ declare const useInView: <T extends HTMLElement>(options?: UseInViewOptions) => {
9
+ ref: import("react").MutableRefObject<T | null>;
10
+ isInView: boolean;
11
+ wasInView: boolean;
12
+ };
13
+ export default useInView;
14
+ //# sourceMappingURL=use-in-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-in-view.d.ts","sourceRoot":"","sources":["use-in-view.ts"],"names":[],"mappings":";AAIA,UAAU,gBAAgB;IACxB,IAAI,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,QAAA,MAAM,SAAS,oCAAoC,gBAAgB;;;;CA2ClE,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = require("react");
8
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
12
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+ var useInView = function useInView() {
15
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
16
+ var elementRef = (0, _react.useRef)(null);
17
+ var _useState = (0, _react.useState)(false),
18
+ _useState2 = _slicedToArray(_useState, 2),
19
+ isInView = _useState2[0],
20
+ setIsInView = _useState2[1];
21
+ var _useState3 = (0, _react.useState)(false),
22
+ _useState4 = _slicedToArray(_useState3, 2),
23
+ wasInView = _useState4[0],
24
+ setWasInView = _useState4[1];
25
+ (0, _react.useEffect)(function () {
26
+ var element = elementRef.current;
27
+ if (!element) return;
28
+ if (typeof window === 'undefined' || !window.IntersectionObserver) {
29
+ setIsInView(true);
30
+ setWasInView(true);
31
+ return;
32
+ }
33
+ var observer = new IntersectionObserver(function (_ref) {
34
+ var _ref2 = _slicedToArray(_ref, 1),
35
+ entry = _ref2[0];
36
+ var inView = entry.isIntersecting;
37
+ setIsInView(inView);
38
+ if (inView) {
39
+ setWasInView(true);
40
+ // 如果设置了 once 选项,且元素已经出现过,则取消观察
41
+ if (options.once) {
42
+ observer.disconnect();
43
+ }
44
+ }
45
+ }, {
46
+ root: options.root || null,
47
+ rootMargin: options.rootMargin || '0px',
48
+ threshold: options.threshold || 0
49
+ });
50
+ observer.observe(element);
51
+ return function () {
52
+ observer.disconnect();
53
+ };
54
+ }, [options.root, options.rootMargin, options.threshold, options.once]);
55
+ return {
56
+ ref: elementRef,
57
+ isInView: isInView,
58
+ wasInView: wasInView
59
+ };
60
+ };
61
+ var _default = exports.default = useInView; // 使用示例
62
+ // const Example = () => {
63
+ // const { ref, isInView } = useInView({
64
+ // threshold: 0.5,
65
+ // rootMargin: '50px',
66
+ // once: true
67
+ // });
68
+ // return (
69
+ // <div ref={ref}>
70
+ // {isInView ? '元素在视窗中' : '元素不在视窗中'}
71
+ // </div>
72
+ // );
73
+ // };
@@ -2,6 +2,7 @@ export * from './use-form-control';
2
2
  export * from './use-form-item';
3
3
  export * from './use-form-fieldset';
4
4
  export * from './use-form-flow';
5
+ export * from './use-form-context';
5
6
  export { default, default as useForm } from './use-form';
6
7
  export { useFormConfig } from './form-config-context';
7
8
  export { useFormFunc } from './form-func-context';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AAEnC,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
@@ -81,6 +81,18 @@ Object.keys(_useFormFlow).forEach(function (key) {
81
81
  }
82
82
  });
83
83
  });
84
+ var _useFormContext = require("./use-form-context");
85
+ Object.keys(_useFormContext).forEach(function (key) {
86
+ if (key === "default" || key === "__esModule") return;
87
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
88
+ if (key in exports && exports[key] === _useFormContext[key]) return;
89
+ Object.defineProperty(exports, key, {
90
+ enumerable: true,
91
+ get: function get() {
92
+ return _useFormContext[key];
93
+ }
94
+ });
95
+ });
84
96
  var _useForm = _interopRequireDefault(require("./use-form"));
85
97
  var _formConfigContext = require("./form-config-context");
86
98
  var _formFuncContext = require("./form-func-context");
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { FormRef } from './use-form-context.type';
3
+ export declare const FormContext: React.Context<any>;
4
+ export declare function useFormRef<V>(): [FormRef<V>, ((formRef: FormRef<V>) => void)];
5
+ export declare function useFromInstance<V>(): FormRef<V>;
6
+ //# sourceMappingURL=use-form-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-form-context.d.ts","sourceRoot":"","sources":["use-form-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,eAAO,MAAM,WAAW,oBAA+B,CAAC;AAExD,wBAAgB,UAAU,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAQ7E;AAED,wBAAgB,eAAe,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAG/C"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.FormContext = void 0;
7
+ exports.useFormRef = useFormRef;
8
+ exports.useFromInstance = useFromInstance;
9
+ var _react = _interopRequireDefault(require("react"));
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ var FormContext = exports.FormContext = /*#__PURE__*/_react.default.createContext({});
12
+ function useFormRef() {
13
+ var ref = _react.default.useRef({});
14
+ var setFormRef = function setFormRef(formRef) {
15
+ ref.current = formRef;
16
+ };
17
+ return [ref.current, setFormRef];
18
+ }
19
+ function useFromInstance() {
20
+ var formCtx = _react.default.useContext(FormContext);
21
+ return formCtx;
22
+ }
@@ -0,0 +1,45 @@
1
+ export interface FormRef<Value> {
2
+ /**
3
+ * @en return form value
4
+ * @cn 返回表单的值
5
+ */
6
+ getValue: (name?: string) => any | Value;
7
+ /**
8
+ * @en Validate form
9
+ * @cn 校验表单
10
+ */
11
+ validate: () => Promise<any>;
12
+ /**
13
+ * @en Validation form fields
14
+ * @cn 校验表单指定字段
15
+ */
16
+ validateFields: (fields: string | string[]) => Promise<any>;
17
+ /**
18
+ * @en The verification can get the error message through Promise.catch
19
+ * @cn 校验可以通过 catch 获取报错信息
20
+ */
21
+ validateFieldsWithError: (fields: string | string[]) => Promise<any>;
22
+ /**
23
+ * @en Clear check
24
+ * @cn 清除校验
25
+ */
26
+ clearValidate: (names?: string[]) => void;
27
+ /**
28
+ * @en Submit Form, withValidate: Whether to verify
29
+ * @cn 提交表单, withValidate: 是否校验
30
+ */
31
+ submit: (withValidate?: boolean) => void;
32
+ /**
33
+ * @en reset form
34
+ * @cn 重置表单
35
+ */
36
+ reset: () => void;
37
+ /**
38
+ * @en set field value, key is field path, Example: { 'name': 'sanmao', 'account.name': 'sanmao', 'friends[0].name': 'sanmao' }
39
+ * @cn 设置字段值, key为字段路径,示例:{ 'name': 'sanmao', 'account.name': 'sanmao', 'friends[0].name': 'sanmao' }
40
+ */
41
+ set: (value: {
42
+ [key: string]: any;
43
+ }) => void;
44
+ }
45
+ //# sourceMappingURL=use-form-context.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-form-context.type.d.ts","sourceRoot":"","sources":["use-form-context.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO,CAAC,KAAK;IAC5B;;;OAGG;IACH,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,GAAG,GAAG,KAAK,CAAC;IACzC;;;OAGG;IACH,QAAQ,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;IAC7B;;;OAGG;IACH,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5D;;;OAGG;IACH,uBAAuB,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACrE;;;OAGG;IACH,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5D,MAAM;4BA3CE,MAAM,SAAS,MAAM,UAAU,KAAK;4BAKpC,MAAM,SAAS,MAAM;;CAiQ9D,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":";AA0BA,OAAO,EAEL,aAAa,EACb,YAAY,EACZ,gBAAgB,EAGjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OAAO;;;;;;;;;wBA0KC;gBAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;gBAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;aAAE;8BAVd,MAAM;oCAkED,OAAO;;6BAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;oCAdrB,MAAM,EAAE;sCAlFN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;qCAgJ5D,MAAM;gCA3CE,MAAM,SAAS,MAAM,UAAU,KAAK;gCAKpC,MAAM,SAAS,MAAM;;;;;;oBAnDjD;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE;0BAVd,MAAM;gCAkED,OAAO;;yBAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCAlFN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;iCAgJ5D,MAAM;4BA3CE,MAAM,SAAS,MAAM,UAAU,KAAK;4BAKpC,MAAM,SAAS,MAAM;;CAkQ9D,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -45,6 +45,7 @@ var useForm = function useForm(props) {
45
45
  _props$throttle = props.throttle,
46
46
  throttle = _props$throttle === void 0 ? 1000 : _props$throttle,
47
47
  size = props.size,
48
+ reserveAble = props.reserveAble,
48
49
  scrollParent = props.scrollParent;
49
50
  var deepSetOptions = {
50
51
  removeUndefined: removeUndefined,
@@ -443,9 +444,10 @@ var useForm = function useForm(props) {
443
444
  keepErrorHeight: keepErrorHeight,
444
445
  inline: inline,
445
446
  disabled: disabled,
446
- size: size
447
+ size: size,
448
+ reserveAble: reserveAble
447
449
  };
448
- }, [labelWidth, labelAlign, labelVerticalAlign, keepErrorHeight, inline, disabled, size]);
450
+ }, [labelWidth, labelAlign, labelVerticalAlign, keepErrorHeight, inline, disabled, size, reserveAble]);
449
451
  var updateValue = function updateValue() {
450
452
  if (props.value !== context.lastValue && props.value !== context.value) {
451
453
  context.value = (0, _utils.deepClone)(props.value) || emptyObj;
@@ -67,6 +67,13 @@ export interface FormCommonConfig extends FormLabelConfig {
67
67
  * @default 'default'
68
68
  */
69
69
  size?: 'small' | 'default' | 'large';
70
+ /**
71
+ * @en When set to true, the form items in Form will not automatically delete data after unmounting
72
+ * @cn 设置为 true 时,表单内所有组件的reserveAble都为 true : 卸载后不自动删除数据
73
+ * @default false
74
+ * @version 3.5.0
75
+ */
76
+ reserveAble?: boolean;
70
77
  }
71
78
  export interface FormFunc {
72
79
  setValue: (vals: {
@@ -1 +1 @@
1
- {"version":3,"file":"use-form.type.d.ts","sourceRoot":"","sources":["use-form.type.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,UAAU,GAAG,CACvB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,GAAG,EACV,QAAQ,EAAE,UAAU,EACpB,MAAM,CAAC,EAAE;IACP,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,KACE,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAA;AAEjC,MAAM,MAAM,QAAQ,GAAG,C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AEjB,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,EAAE,YAAY,EAAE,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;IAEhJ,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;IACrC,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;IACtC,YAAY,EAAE,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;IAC5C,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,GAAG,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,UAAU,CACzE,mBAAmB,EACnB,MAAM,CACP,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-image.d.ts","sourceRoot":"","sources":["use-image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAWlD,QAAA,MAAM,QAAQ,WAAW,cAAc;;;;;;;;;;yBA6D3B,gBAAgB,CAAC,gBAAgB,GAAG,cAAc,CAAC;;;;;;;;;;;CA2E9D,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"use-image.d.ts","sourceRoot":"","sources":["use-image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAWlD,QAAA,MAAM,QAAQ,WAAW,cAAc;;;;;;;;;;yBA6D3B,gBAAgB,CAAC,gBAAgB,GAAG,cAAc,CAAC;;;;;;;;;;;CAmF9D,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -139,10 +139,17 @@ var useImage = function useImage() {
139
139
  offset: typeof lazy === 'number' ? lazy : 0,
140
140
  element: elementRef.current,
141
141
  render: markToRender,
142
+ offscreen: function offscreen() {
143
+ setStatus(PLACEHOLDER);
144
+ },
145
+ noRemove: props.inViewOnly,
142
146
  container: typeof container === 'string' ? document.querySelector(container) : container
143
147
  });
144
148
  }
145
149
  }
150
+ return function () {
151
+ if (lazyId) (0, _utils.removeStack)(lazyId);
152
+ };
146
153
  }, [src]);
147
154
  return {
148
155
  src: src,
@@ -54,6 +54,13 @@ export interface BaseImageProps {
54
54
  * @default false
55
55
  */
56
56
  lazy?: boolean | number;
57
+ /**
58
+ * @en Whether to load only when in view
59
+ * @cn 是否仅在视图内加载
60
+ * @default false
61
+ * @version 3.4.5
62
+ */
63
+ inViewOnly?: boolean;
57
64
  /**
58
65
  * @en The original property of html
59
66
  * @cn 是否禁止 img 元素原生 draggable 属性
@@ -1 +1 @@
1
- {"version":3,"file":"use-image.type.d.ts","sourceRoot":"","sources":["use-image.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAC;AAChE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;AACjE,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE1E,MAAM,MAAM,MAAM,GAAG;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IAC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AAM,GAAG,MAAM,CAAC;IACxB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC7C;;;OAGG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAClC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-table-group.d.ts","sourceRoot":"","sources":["use-table-group.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAoB,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKxF,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,QAAA,MAAM,aAAa,UAAW,kBAAkB;;;CAoE/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"use-table-group.d.ts","sourceRoot":"","sources":["use-table-group.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAoB,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKxF,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,QAAA,MAAM,aAAa,UAAW,kBAAkB;;;CAsE/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -59,8 +59,9 @@ var useTableGroup = function useTableGroup(props) {
59
59
  });
60
60
  return columns;
61
61
  };
62
+ var groupColumns = (0, _react.useMemo)(formatColumns, [props.columns]);
62
63
  return {
63
- groupColumns: formatColumns(),
64
+ groupColumns: groupColumns,
64
65
  columnLevel: context.columnLevel
65
66
  };
66
67
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-table-layout.d.ts","sourceRoot":"","sources":["use-table-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAKlE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAerE,MAAM,WAAW,mBACf,SAAQ,IAAI,CACV,cAAc,CAAC,GAAG,CAAC,EACnB,MAAM,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,OAAO,CAC7E;IACD,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,QAAA,MAAM,cAAc,UAAW,mBAAmB;;;;;;;;;;;yBA+CX,MAAM,UAAU,MAAM;;;;;;;;CAmO5D,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"use-table-layout.d.ts","sourceRoot":"","sources":["use-table-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAKlE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAerE,MAAM,WAAW,mBACf,SAAQ,IAAI,CACV,cAAc,CAAC,GAAG,CAAC,EACnB,MAAM,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,OAAO,CAC7E;IACD,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,QAAA,MAAM,cAAc,UAAW,mBAAmB;;;;;;;;;;;yBA+CX,MAAM,UAAU,MAAM;;;;;;;;CAsO5D,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -347,6 +347,7 @@ var useTableLayout = function useTableLayout(props) {
347
347
  checkScroll();
348
348
  checkFloat();
349
349
  }, [colgroup]);
350
+ var tableWidth = isNaN(Number(props.width)) ? undefined : typeof props.width === 'number' ? props.width + deltaXSum : props.width;
350
351
  return {
351
352
  isScrollX: !!isScrollX,
352
353
  isScrollY: !!isScrollY,
@@ -355,7 +356,7 @@ var useTableLayout = function useTableLayout(props) {
355
356
  scrollBarWidth: scrollBarWidth,
356
357
  colgroup: colgroup ? colgroup : [],
357
358
  func: func,
358
- width: typeof props.width === 'number' ? props.width + deltaXSum : props.width,
359
+ width: tableWidth,
359
360
  shouldLastColAuto: props.columnResizable && !adjust,
360
361
  scrollWidth: scrollWidth,
361
362
  maxScrollLeft: scrollWidth - context.clientWidth,
@@ -31,6 +31,18 @@ export interface BaseTableProps<Item> {
31
31
  * @cn 树形数据展开行,受控
32
32
  */
33
33
  treeExpandKeys?: KeygenResult[];
34
+ /**
35
+ * @en Tree Table expand icon
36
+ * @cn 树形数据展开图标,函数返回null时隐藏展开图标
37
+ * @version 3.5.0
38
+ */
39
+ treeExpandIcon?: (data: Item, index: number, isExpanded: boolean) => React.ReactNode;
40
+ /**
41
+ * @en Tree Table data loader
42
+ * @cn 树形数据加载函数
43
+ * @version 3.5.0
44
+ */
45
+ loader?: (data: Item, index: number) => Promise<void>;
34
46
  /**
35
47
  * @en data
36
48
  * @cn 数据
@@ -1 +1 @@
1
- {"version":3,"file":"use-table.type.d.ts","sourceRoot":"","sources":["use-table.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE9E,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,MAAM,CAAC;AAC9C,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,CAAC;AAC9C,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,YAAY,GAAG,UAAU,CAAC;AAEnE,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,YAAY,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB;AACD,MAAM,WAAW,cAAc,CAAC,IAAI;IAClC;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,YAAY,EAAE,CAAC;IACvC;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9F;;;OAGG;IACH,cAAc,CAAC,EAAE,YAAY,EAAE,CAAC;IAChC;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;IACd;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,CACP,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,KAAK,GAAG,MAAM,EACtB,UAAU,EAAE,KAAK,CAAC,eAAe,CAAC,KAC/B,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC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KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC"}
package/cjs/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export { util };
5
5
  export * from './common/type';
6
6
  export * from './common/use-fork-ref';
7
7
  export * from './common/use-input-able';
8
+ export * from './common/use-in-view';
8
9
  export * from './common/use-latest-obj';
9
10
  export * from './common/use-persist-fn';
10
11
  export * from './common/use-key-event';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,UAAU,CAAC;AAEjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAE5B,OAAO,EAAE,IAAI,EAAE,CAAC;AAGhB,cAAc,eAAe,CAAC;AAE9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC;AAG7C,cAAc,w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qB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC;AAG7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;;AAE1C,wBAAkB"}
package/cjs/index.js CHANGED
@@ -71,6 +71,18 @@ Object.keys(_useInputAble).forEach(function (key) {
71
71
  }
72
72
  });
73
73
  });
74
+ var _useInView = require("./common/use-in-view");
75
+ Object.keys(_useInView).forEach(function (key) {
76
+ if (key === "default" || key === "__esModule") return;
77
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
78
+ if (key in exports && exports[key] === _useInView[key]) return;
79
+ Object.defineProperty(exports, key, {
80
+ enumerable: true,
81
+ get: function get() {
82
+ return _useInView[key];
83
+ }
84
+ });
85
+ });
74
86
  var _useLatestObj = require("./common/use-latest-obj");
75
87
  Object.keys(_useLatestObj).forEach(function (key) {
76
88
  if (key === "default" || key === "__esModule") return;
@@ -2,6 +2,7 @@ type LazyConfig = {
2
2
  container?: Element | null;
3
3
  element: Element;
4
4
  render: () => void;
5
+ offscreen?: () => void;
5
6
  offset: number;
6
7
  noRemove?: boolean;
7
8
  observer?: IntersectionObserver;
@@ -1 +1 @@
1
- {"version":3,"file":"lazyload.d.ts","sourceRoot":"","sources":["lazyload.ts"],"names":[],"mappings":"AAIA,KAAK,UAAU,GAAG;IAChB,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CACjC,CAAC;AAoBF,wBAAgB,QAAQ,SAgBvB;AAWD,wBAAgB,WAAW,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,cAAc,CAAC,EAAE,OAAO,QAUvE;AAsBD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,UAAU,iBA4BvC"}
1
+ {"version":3,"file":"lazyload.d.ts","sourceRoot":"","sources":["lazyload.ts"],"names":[],"mappings":"AAIA,KAAK,UAAU,GAAG;IAChB,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CACjC,CAAC;AAoBF,wBAAgB,QAAQ,SAgBvB;AAWD,wBAAgB,WAAW,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,cAAc,CAAC,EAAE,OAAO,QAUvE;AAwBD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,UAAU,iBA4BvC"}
@@ -68,12 +68,15 @@ function getObserver(obj, id) {
68
68
  container = _obj$container === void 0 ? null : _obj$container,
69
69
  offset = obj.offset,
70
70
  render = obj.render,
71
+ offscreen = obj.offscreen,
71
72
  noRemove = obj.noRemove;
72
73
  var observer = new IntersectionObserver(function (entries) {
73
74
  entries.forEach(function (en) {
74
75
  if (en.isIntersecting || en.intersectionRatio > 0) {
75
76
  render();
76
77
  if (!noRemove) removeStack(id);
78
+ } else {
79
+ offscreen && offscreen();
77
80
  }
78
81
  });
79
82
  }, {
@@ -0,0 +1,2 @@
1
+ export { default as useInView } from './use-in-view';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ export { default as useInView } from "./use-in-view";
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ interface UseInViewOptions {
3
+ root?: HTMLElement | null;
4
+ rootMargin?: string;
5
+ threshold?: number | number[];
6
+ once?: boolean;
7
+ }
8
+ declare const useInView: <T extends HTMLElement>(options?: UseInViewOptions) => {
9
+ ref: import("react").MutableRefObject<T | null>;
10
+ isInView: boolean;
11
+ wasInView: boolean;
12
+ };
13
+ export default useInView;
14
+ //# sourceMappingURL=use-in-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-in-view.d.ts","sourceRoot":"","sources":["use-in-view.ts"],"names":[],"mappings":";AAIA,UAAU,gBAAgB;IACxB,IAAI,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,QAAA,MAAM,SAAS,oCAAoC,gBAAgB;;;;CA2ClE,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,70 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { useEffect, useRef, useState } from 'react';
8
+ var useInView = function useInView() {
9
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
10
+ var elementRef = useRef(null);
11
+ var _useState = useState(false),
12
+ _useState2 = _slicedToArray(_useState, 2),
13
+ isInView = _useState2[0],
14
+ setIsInView = _useState2[1];
15
+ var _useState3 = useState(false),
16
+ _useState4 = _slicedToArray(_useState3, 2),
17
+ wasInView = _useState4[0],
18
+ setWasInView = _useState4[1];
19
+ useEffect(function () {
20
+ var element = elementRef.current;
21
+ if (!element) return;
22
+ if (typeof window === 'undefined' || !window.IntersectionObserver) {
23
+ setIsInView(true);
24
+ setWasInView(true);
25
+ return;
26
+ }
27
+ var observer = new IntersectionObserver(function (_ref) {
28
+ var _ref2 = _slicedToArray(_ref, 1),
29
+ entry = _ref2[0];
30
+ var inView = entry.isIntersecting;
31
+ setIsInView(inView);
32
+ if (inView) {
33
+ setWasInView(true);
34
+ // 如果设置了 once 选项,且元素已经出现过,则取消观察
35
+ if (options.once) {
36
+ observer.disconnect();
37
+ }
38
+ }
39
+ }, {
40
+ root: options.root || null,
41
+ rootMargin: options.rootMargin || '0px',
42
+ threshold: options.threshold || 0
43
+ });
44
+ observer.observe(element);
45
+ return function () {
46
+ observer.disconnect();
47
+ };
48
+ }, [options.root, options.rootMargin, options.threshold, options.once]);
49
+ return {
50
+ ref: elementRef,
51
+ isInView: isInView,
52
+ wasInView: wasInView
53
+ };
54
+ };
55
+ export default useInView;
56
+
57
+ // 使用示例
58
+ // const Example = () => {
59
+ // const { ref, isInView } = useInView({
60
+ // threshold: 0.5,
61
+ // rootMargin: '50px',
62
+ // once: true
63
+ // });
64
+
65
+ // return (
66
+ // <div ref={ref}>
67
+ // {isInView ? '元素在视窗中' : '元素不在视窗中'}
68
+ // </div>
69
+ // );
70
+ // };
@@ -2,6 +2,7 @@ export * from './use-form-control';
2
2
  export * from './use-form-item';
3
3
  export * from './use-form-fieldset';
4
4
  export * from './use-form-flow';
5
+ export * from './use-form-context';
5
6
  export { default, default as useForm } from './use-form';
6
7
  export { useFormConfig } from './form-config-context';
7
8
  export { useFormFunc } from './form-func-context';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AAEnC,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
@@ -3,6 +3,7 @@ export * from "./use-form-control";
3
3
  export * from "./use-form-item";
4
4
  export * from "./use-form-fieldset";
5
5
  export * from "./use-form-flow";
6
+ export * from "./use-form-context";
6
7
  export { default, default as useForm } from "./use-form";
7
8
  export { useFormConfig } from "./form-config-context";
8
9
  export { useFormFunc } from "./form-func-context";
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { FormRef } from './use-form-context.type';
3
+ export declare const FormContext: React.Context<any>;
4
+ export declare function useFormRef<V>(): [FormRef<V>, ((formRef: FormRef<V>) => void)];
5
+ export declare function useFromInstance<V>(): FormRef<V>;
6
+ //# sourceMappingURL=use-form-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-form-context.d.ts","sourceRoot":"","sources":["use-form-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,eAAO,MAAM,WAAW,oBAA+B,CAAC;AAExD,wBAAgB,UAAU,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAQ7E;AAED,wBAAgB,eAAe,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAG/C"}
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ export var FormContext = /*#__PURE__*/React.createContext({});
3
+ export function useFormRef() {
4
+ var ref = React.useRef({});
5
+ var setFormRef = function setFormRef(formRef) {
6
+ ref.current = formRef;
7
+ };
8
+ return [ref.current, setFormRef];
9
+ }
10
+ export function useFromInstance() {
11
+ var formCtx = React.useContext(FormContext);
12
+ return formCtx;
13
+ }
@@ -0,0 +1,45 @@
1
+ export interface FormRef<Value> {
2
+ /**
3
+ * @en return form value
4
+ * @cn 返回表单的值
5
+ */
6
+ getValue: (name?: string) => any | Value;
7
+ /**
8
+ * @en Validate form
9
+ * @cn 校验表单
10
+ */
11
+ validate: () => Promise<any>;
12
+ /**
13
+ * @en Validation form fields
14
+ * @cn 校验表单指定字段
15
+ */
16
+ validateFields: (fields: string | string[]) => Promise<any>;
17
+ /**
18
+ * @en The verification can get the error message through Promise.catch
19
+ * @cn 校验可以通过 catch 获取报错信息
20
+ */
21
+ validateFieldsWithError: (fields: string | string[]) => Promise<any>;
22
+ /**
23
+ * @en Clear check
24
+ * @cn 清除校验
25
+ */
26
+ clearValidate: (names?: string[]) => void;
27
+ /**
28
+ * @en Submit Form, withValidate: Whether to verify
29
+ * @cn 提交表单, withValidate: 是否校验
30
+ */
31
+ submit: (withValidate?: boolean) => void;
32
+ /**
33
+ * @en reset form
34
+ * @cn 重置表单
35
+ */
36
+ reset: () => void;
37
+ /**
38
+ * @en set field value, key is field path, Example: { 'name': 'sanmao', 'account.name': 'sanmao', 'friends[0].name': 'sanmao' }
39
+ * @cn 设置字段值, key为字段路径,示例:{ 'name': 'sanmao', 'account.name': 'sanmao', 'friends[0].name': 'sanmao' }
40
+ */
41
+ set: (value: {
42
+ [key: string]: any;
43
+ }) => void;
44
+ }
45
+ //# sourceMappingURL=use-form-context.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-form-context.type.d.ts","sourceRoot":"","sources":["use-form-context.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO,CAAC,KAAK;IAC5B;;;OAGG;IACH,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,GAAG,GAAG,KAAK,CAAC;IACzC;;;OAGG;IACH,QAAQ,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;IAC7B;;;OAGG;IACH,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5D;;;OAGG;IACH,uBAAuB,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACrE;;;OAGG;IACH,aAAa,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC1C;;;OAGG;IACH,MAAM,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC;;;OAGG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;;;OAGG;IACH,GAAG,EAAE,CAAC,KAAK,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,KAAK,IAAI,CAAC;CAC9C"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":";AA0BA,OAAO,EAEL,aAAa,EACb,YAAY,EACZ,gBAAgB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,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;qCAgJ5D,MAAM;gCA3CE,MAAM,SAAS,MAAM,UAAU,KAAK;gCAKpC,MAAM,SAAS,MAAM;;;;;;oBAnDjD;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE;0BAVd,MAAM;gCAkED,OAAO;;yBAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCAlFN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;iCAgJ5D,MAAM;4BA3CE,MAAM,SAAS,MAAM,UAAU,KAAK;4BAKpC,MAAM,SAAS,MAAM;;CAkQ9D,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -36,6 +36,7 @@ var useForm = function useForm(props) {
36
36
  _props$throttle = props.throttle,
37
37
  throttle = _props$throttle === void 0 ? 1000 : _props$throttle,
38
38
  size = props.size,
39
+ reserveAble = props.reserveAble,
39
40
  scrollParent = props.scrollParent;
40
41
  var deepSetOptions = {
41
42
  removeUndefined: removeUndefined,
@@ -434,9 +435,10 @@ var useForm = function useForm(props) {
434
435
  keepErrorHeight: keepErrorHeight,
435
436
  inline: inline,
436
437
  disabled: disabled,
437
- size: size
438
+ size: size,
439
+ reserveAble: reserveAble
438
440
  };
439
- }, [labelWidth, labelAlign, labelVerticalAlign, keepErrorHeight, inline, disabled, size]);
441
+ }, [labelWidth, labelAlign, labelVerticalAlign, keepErrorHeight, inline, disabled, size, reserveAble]);
440
442
  var updateValue = function updateValue() {
441
443
  if (props.value !== context.lastValue && props.value !== context.value) {
442
444
  context.value = deepClone(props.value) || emptyObj;
@@ -67,6 +67,13 @@ export interface FormCommonConfig extends FormLabelConfig {
67
67
  * @default 'default'
68
68
  */
69
69
  size?: 'small' | 'default' | 'large';
70
+ /**
71
+ * @en When set to true, the form items in Form will not automatically delete data after unmounting
72
+ * @cn 设置为 true 时,表单内所有组件的reserveAble都为 true : 卸载后不自动删除数据
73
+ * @default false
74
+ * @version 3.5.0
75
+ */
76
+ reserveAble?: boolean;
70
77
  }
71
78
  export interface FormFunc {
72
79
  setValue: (vals: {
@@ -1 +1 @@
1
- {"version":3,"file":"use-form.type.d.ts","sourceRoot":"","sources":["use-form.type.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,UAAU,GAAG,CACvB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,GAAG,EACV,QAAQ,EAAE,UAAU,EACpB,MAAM,CAAC,EAAE;IACP,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,KACE,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAA;AAEjC,MAAM,MAAM,QAAQ,GAAG,CACrB,SAAS,EAAE,UAAU,EACrB,MAAM,EAAE,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,EACrC,YAAY,EAAE,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,KACxC,IAAI,CAAA;AAET,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE;QACL,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAC,UAAU,EAAE,MAAM,CAAC,EAAC,QAAQ,KAAM,IAAI,CAAC;QAC5F,IAAI,EAAE,CACJ,CAAC,EAAE,MAAM,EACT,EAAE,EAAE,GAAG,EACP,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE,QAAQ,KACb,IAAI,CAAC;QACV,YAAY,EAAE,CAAC,SAAS,EACtB,IAAI,EAAE,MAAM,EACZ,SAAS,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,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,GAAG,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,UAAU,CACzE,mBAAmB,EACnB,MAAM,CACP,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-image.d.ts","sourceRoot":"","sources":["use-image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAWlD,QAAA,MAAM,QAAQ,WAAW,cAAc;;;;;;;;;;yBA6D3B,gBAAgB,CAAC,gBAAgB,GAAG,cAAc,CAAC;;;;;;;;;;;CA2E9D,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"use-image.d.ts","sourceRoot":"","sources":["use-image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAWlD,QAAA,MAAM,QAAQ,WAAW,cAAc;;;;;;;;;;yBA6D3B,gBAAgB,CAAC,gBAAgB,GAAG,cAAc,CAAC;;;;;;;;;;;CAmF9D,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -132,10 +132,17 @@ var useImage = function useImage() {
132
132
  offset: typeof lazy === 'number' ? lazy : 0,
133
133
  element: elementRef.current,
134
134
  render: markToRender,
135
+ offscreen: function offscreen() {
136
+ setStatus(PLACEHOLDER);
137
+ },
138
+ noRemove: props.inViewOnly,
135
139
  container: typeof container === 'string' ? document.querySelector(container) : container
136
140
  });
137
141
  }
138
142
  }
143
+ return function () {
144
+ if (lazyId) removeStack(lazyId);
145
+ };
139
146
  }, [src]);
140
147
  return {
141
148
  src: src,
@@ -54,6 +54,13 @@ export interface BaseImageProps {
54
54
  * @default false
55
55
  */
56
56
  lazy?: boolean | number;
57
+ /**
58
+ * @en Whether to load only when in view
59
+ * @cn 是否仅在视图内加载
60
+ * @default false
61
+ * @version 3.4.5
62
+ */
63
+ inViewOnly?: boolean;
57
64
  /**
58
65
  * @en The original property of html
59
66
  * @cn 是否禁止 img 元素原生 draggable 属性
@@ -1 +1 @@
1
- {"version":3,"file":"use-image.type.d.ts","sourceRoot":"","sources":["use-image.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAC;AAChE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;AACjE,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE1E,MAAM,MAAM,MAAM,GAAG;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B;;;;;;;;;OASG;IACH;;;OAGG;IACH,GAAG,CAAC,EAAE,YAAY,CAAC;IAEnB;;;;OAIG;IACH;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAEjC;;;;OAIG;IACH;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACxB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH;;;;OAIG;IACH,WAAW,CAAC,EAAE,KA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":"use-table-group.d.ts","sourceRoot":"","sources":["use-table-group.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAoB,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKxF,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,QAAA,MAAM,aAAa,UAAW,kBAAkB;;;CAoE/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"use-table-group.d.ts","sourceRoot":"","sources":["use-table-group.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAoB,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKxF,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,QAAA,MAAM,aAAa,UAAW,kBAAkB;;;CAsE/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,4 +1,4 @@
1
- import { useRef } from 'react';
1
+ import { useMemo, useRef } from 'react';
2
2
  import { getUidStr } from "../../utils/uid";
3
3
  var cacheGroup = new Map();
4
4
  var useTableGroup = function useTableGroup(props) {
@@ -53,8 +53,9 @@ var useTableGroup = function useTableGroup(props) {
53
53
  });
54
54
  return columns;
55
55
  };
56
+ var groupColumns = useMemo(formatColumns, [props.columns]);
56
57
  return {
57
- groupColumns: formatColumns(),
58
+ groupColumns: groupColumns,
58
59
  columnLevel: context.columnLevel
59
60
  };
60
61
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-table-layout.d.ts","sourceRoot":"","sources":["use-table-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAKlE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAerE,MAAM,WAAW,mBACf,S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AAc,CAAC"}
@@ -338,6 +338,7 @@ var useTableLayout = function useTableLayout(props) {
338
338
  checkScroll();
339
339
  checkFloat();
340
340
  }, [colgroup]);
341
+ var tableWidth = isNaN(Number(props.width)) ? undefined : typeof props.width === 'number' ? props.width + deltaXSum : props.width;
341
342
  return {
342
343
  isScrollX: !!isScrollX,
343
344
  isScrollY: !!isScrollY,
@@ -346,7 +347,7 @@ var useTableLayout = function useTableLayout(props) {
346
347
  scrollBarWidth: scrollBarWidth,
347
348
  colgroup: colgroup ? colgroup : [],
348
349
  func: func,
349
- width: typeof props.width === 'number' ? props.width + deltaXSum : props.width,
350
+ width: tableWidth,
350
351
  shouldLastColAuto: props.columnResizable && !adjust,
351
352
  scrollWidth: scrollWidth,
352
353
  maxScrollLeft: scrollWidth - context.clientWidth,
@@ -31,6 +31,18 @@ export interface BaseTableProps<Item> {
31
31
  * @cn 树形数据展开行,受控
32
32
  */
33
33
  treeExpandKeys?: KeygenResult[];
34
+ /**
35
+ * @en Tree Table expand icon
36
+ * @cn 树形数据展开图标,函数返回null时隐藏展开图标
37
+ * @version 3.5.0
38
+ */
39
+ treeExpandIcon?: (data: Item, index: number, isExpanded: boolean) => React.ReactNode;
40
+ /**
41
+ * @en Tree Table data loader
42
+ * @cn 树形数据加载函数
43
+ * @version 3.5.0
44
+ */
45
+ loader?: (data: Item, index: number) => Promise<void>;
34
46
  /**
35
47
  * @en data
36
48
  * @cn 数据
@@ -1 +1 @@
1
- {"version":3,"file":"use-table.type.d.ts","sourceRoot":"","sources":["use-table.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE9E,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,MAAM,CAAC;AAC9C,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,CAAC;AAC9C,MAAM,MAAM,eAAe,GAAG,QA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IG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC;IAEvB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAExB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAE5B;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAEnD;;;OAGG;IACH,eAAe,CAAC,EAAE,KAAK,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB,CAAC,QAAQ,CAAE,SAAQ,eAAe,CAAC,QAAQ,CAAC;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC"}
package/esm/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export { util };
5
5
  export * from './common/type';
6
6
  export * from './common/use-fork-ref';
7
7
  export * from './common/use-input-able';
8
+ export * from './common/use-in-view';
8
9
  export * from './common/use-latest-obj';
9
10
  export * from './common/use-persist-fn';
10
11
  export * from './common/use-key-event';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,UAAU,CAAC;AAEjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAE5B,OAAO,EAAE,IAAI,EAAE,CAAC;AAGhB,cAAc,eAAe,CAAC;AAE9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC;AAG7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,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,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;;AAE1C,wBAAkB"}
package/esm/index.js CHANGED
@@ -8,6 +8,7 @@ export { util };
8
8
  export * from "./common/type";
9
9
  export * from "./common/use-fork-ref";
10
10
  export * from "./common/use-input-able";
11
+ export * from "./common/use-in-view";
11
12
  export * from "./common/use-latest-obj";
12
13
  export * from "./common/use-persist-fn";
13
14
  export * from "./common/use-key-event";
@@ -2,6 +2,7 @@ type LazyConfig = {
2
2
  container?: Element | null;
3
3
  element: Element;
4
4
  render: () => void;
5
+ offscreen?: () => void;
5
6
  offset: number;
6
7
  noRemove?: boolean;
7
8
  observer?: IntersectionObserver;
@@ -1 +1 @@
1
- {"version":3,"file":"lazyload.d.ts","sourceRoot":"","sources":["lazyload.ts"],"names":[],"mappings":"AAIA,KAAK,UAAU,GAAG;IAChB,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CACjC,CAAC;AAoBF,wBAAgB,QAAQ,SAgBvB;AAWD,wBAAgB,WAAW,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,cAAc,CAAC,EAAE,OAAO,QAUvE;AAsBD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,UAAU,iBA4BvC"}
1
+ {"version":3,"file":"lazyload.d.ts","sourceRoot":"","sources":["lazyload.ts"],"names":[],"mappings":"AAIA,KAAK,UAAU,GAAG;IAChB,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CACjC,CAAC;AAoBF,wBAAgB,QAAQ,SAgBvB;AAWD,wBAAgB,WAAW,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,cAAc,CAAC,EAAE,OAAO,QAUvE;AAwBD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,UAAU,iBA4BvC"}
@@ -60,12 +60,15 @@ function getObserver(obj, id) {
60
60
  container = _obj$container === void 0 ? null : _obj$container,
61
61
  offset = obj.offset,
62
62
  render = obj.render,
63
+ offscreen = obj.offscreen,
63
64
  noRemove = obj.noRemove;
64
65
  var observer = new IntersectionObserver(function (entries) {
65
66
  entries.forEach(function (en) {
66
67
  if (en.isIntersecting || en.intersectionRatio > 0) {
67
68
  render();
68
69
  if (!noRemove) removeStack(id);
70
+ } else {
71
+ offscreen && offscreen();
69
72
  }
70
73
  });
71
74
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/hooks",
3
- "version": "3.5.0-beta.5",
3
+ "version": "3.5.0-beta.7",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",