@sheinx/hooks 3.4.7-beta.3 → 3.5.0-beta.10
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/common/use-position-style/check-position.d.ts +11 -0
- package/cjs/common/use-position-style/check-position.d.ts.map +1 -0
- package/cjs/common/use-position-style/check-position.js +90 -0
- package/cjs/common/use-position-style/index.d.ts.map +1 -1
- package/cjs/common/use-position-style/index.js +15 -21
- package/cjs/components/use-form/index.d.ts +1 -0
- package/cjs/components/use-form/index.d.ts.map +1 -1
- package/cjs/components/use-form/index.js +12 -0
- package/cjs/components/use-form/use-form-context.d.ts +6 -0
- package/cjs/components/use-form/use-form-context.d.ts.map +1 -0
- package/cjs/components/use-form/use-form-context.js +22 -0
- package/cjs/components/use-form/use-form-context.type.d.ts +45 -0
- package/cjs/components/use-form/use-form-context.type.d.ts.map +1 -0
- package/cjs/components/use-form/use-form-context.type.js +5 -0
- package/cjs/components/use-form/use-form.d.ts.map +1 -1
- package/cjs/components/use-form/use-form.js +4 -2
- package/cjs/components/use-form/use-form.type.d.ts +7 -0
- package/cjs/components/use-form/use-form.type.d.ts.map +1 -1
- package/cjs/components/use-input/use-input-format.d.ts +1 -1
- package/cjs/components/use-input/use-input-number.d.ts +1 -1
- package/cjs/components/use-table/use-table-group.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-group.js +2 -1
- package/cjs/components/use-table/use-table-layout.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-layout.js +2 -1
- package/cjs/components/use-table/use-table-virtual.d.ts +3 -0
- package/cjs/components/use-table/use-table-virtual.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-virtual.js +30 -1
- package/cjs/components/use-table/use-table.type.d.ts +26 -0
- package/cjs/components/use-table/use-table.type.d.ts.map +1 -1
- package/cjs/utils/dom/document.d.ts +2 -0
- package/cjs/utils/dom/document.d.ts.map +1 -0
- package/cjs/utils/dom/document.js +49 -0
- package/cjs/utils/dom/element.d.ts +1 -1
- package/cjs/utils/dom/element.d.ts.map +1 -1
- package/cjs/utils/dom/index.d.ts +1 -0
- package/cjs/utils/dom/index.d.ts.map +1 -1
- package/cjs/utils/dom/index.js +12 -0
- package/cjs/utils/is.d.ts +0 -1
- package/cjs/utils/is.d.ts.map +1 -1
- package/cjs/utils/is.js +1 -10
- package/esm/common/use-position-style/check-position.d.ts +11 -0
- package/esm/common/use-position-style/check-position.d.ts.map +1 -0
- package/esm/common/use-position-style/check-position.js +84 -0
- package/esm/common/use-position-style/index.d.ts.map +1 -1
- package/esm/common/use-position-style/index.js +17 -22
- package/esm/components/use-form/index.d.ts +1 -0
- package/esm/components/use-form/index.d.ts.map +1 -1
- package/esm/components/use-form/index.js +1 -0
- package/esm/components/use-form/use-form-context.d.ts +6 -0
- package/esm/components/use-form/use-form-context.d.ts.map +1 -0
- package/esm/components/use-form/use-form-context.js +13 -0
- package/esm/components/use-form/use-form-context.type.d.ts +45 -0
- package/esm/components/use-form/use-form-context.type.d.ts.map +1 -0
- package/esm/components/use-form/use-form-context.type.js +1 -0
- package/esm/components/use-form/use-form.d.ts.map +1 -1
- package/esm/components/use-form/use-form.js +4 -2
- package/esm/components/use-form/use-form.type.d.ts +7 -0
- package/esm/components/use-form/use-form.type.d.ts.map +1 -1
- package/esm/components/use-input/use-input-format.d.ts +1 -1
- package/esm/components/use-input/use-input-number.d.ts +1 -1
- package/esm/components/use-table/use-table-group.d.ts.map +1 -1
- package/esm/components/use-table/use-table-group.js +3 -2
- package/esm/components/use-table/use-table-layout.d.ts.map +1 -1
- package/esm/components/use-table/use-table-layout.js +2 -1
- package/esm/components/use-table/use-table-virtual.d.ts +3 -0
- package/esm/components/use-table/use-table-virtual.d.ts.map +1 -1
- package/esm/components/use-table/use-table-virtual.js +30 -1
- package/esm/components/use-table/use-table.type.d.ts +26 -0
- package/esm/components/use-table/use-table.type.d.ts.map +1 -1
- package/esm/utils/dom/document.d.ts +2 -0
- package/esm/utils/dom/document.d.ts.map +1 -0
- package/esm/utils/dom/document.js +43 -0
- package/esm/utils/dom/element.d.ts +1 -1
- package/esm/utils/dom/element.d.ts.map +1 -1
- package/esm/utils/dom/index.d.ts +1 -0
- package/esm/utils/dom/index.d.ts.map +1 -1
- package/esm/utils/dom/index.js +1 -0
- package/esm/utils/is.d.ts +0 -1
- package/esm/utils/is.d.ts.map +1 -1
- package/esm/utils/is.js +0 -9
- package/package.json +1 -1
@@ -0,0 +1,49 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getCurrentCSSZoom = void 0;
|
7
|
+
var cachedZoom = 0;
|
8
|
+
var getCurrentCSSZoom = exports.getCurrentCSSZoom = function getCurrentCSSZoom() {
|
9
|
+
if (cachedZoom) return cachedZoom;
|
10
|
+
if (typeof window === 'undefined' || typeof navigator === 'undefined' || !document.body) {
|
11
|
+
return 1;
|
12
|
+
}
|
13
|
+
var currentCSSZoom = Math.round(document.body.getBoundingClientRect().width) / document.body.clientWidth;
|
14
|
+
if (window.ResizeObserver) {
|
15
|
+
// 监听document.body的变化,更新缓存的zoom
|
16
|
+
var resizeObserver = new ResizeObserver(function () {
|
17
|
+
cachedZoom = Math.round(document.body.getBoundingClientRect().width) / document.body.clientWidth;
|
18
|
+
});
|
19
|
+
resizeObserver.observe(document.body);
|
20
|
+
}
|
21
|
+
cachedZoom = currentCSSZoom;
|
22
|
+
return currentCSSZoom;
|
23
|
+
};
|
24
|
+
|
25
|
+
// export const getZoomBoundingClientRect = (element: HTMLElement) => {
|
26
|
+
// const currentCSSZoom = getCurrentCSSZoom()
|
27
|
+
// if (currentCSSZoom === 1 || !currentCSSZoom) {
|
28
|
+
// return element.getBoundingClientRect()
|
29
|
+
// }
|
30
|
+
// const isNotZoom = currentCSSZoom === 1 || !currentCSSZoom
|
31
|
+
|
32
|
+
// if (isNotZoom) {
|
33
|
+
// return element.getBoundingClientRect()
|
34
|
+
// }
|
35
|
+
|
36
|
+
// const zoomRatio = 1 / currentCSSZoom
|
37
|
+
// const rect = element.getBoundingClientRect()
|
38
|
+
|
39
|
+
// return {
|
40
|
+
// x: rect.x * zoomRatio,
|
41
|
+
// y: rect.y * zoomRatio,
|
42
|
+
// top: rect.top * zoomRatio,
|
43
|
+
// right: rect.right * zoomRatio,
|
44
|
+
// bottom: rect.bottom * zoomRatio,
|
45
|
+
// left: rect.left * zoomRatio,
|
46
|
+
// width: rect.width * zoomRatio,
|
47
|
+
// height: rect.height * zoomRatio,
|
48
|
+
// }
|
49
|
+
// }
|
@@ -12,7 +12,7 @@ export declare const addResizeObserver: (el: HTMLElement, handler: any, options?
|
|
12
12
|
timer?: number | undefined;
|
13
13
|
}) => () => void;
|
14
14
|
export declare function getParent(el: HTMLElement | null | Element, target?: string | HTMLElement): Element | null;
|
15
|
-
export declare function getClosestScrollContainer(element: HTMLElement | null):
|
15
|
+
export declare function getClosestScrollContainer(element: HTMLElement | null): HTMLElement | null;
|
16
16
|
export declare function cssSupport(attr: keyof CSSStyleDeclaration, value: string): boolean;
|
17
17
|
export declare const parsePxToNumber: (str: string) => number;
|
18
18
|
//# sourceMappingURL=element.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["element.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,WAAW,UAAQ,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,KAAK,CAAC,SAAS,CASjB;AAGD,eAAO,MAAM,iBAAiB,OACxB,WAAW,WACN,GAAG;;;gBA4Cb,CAAC;AAEF,wBAAgB,SAAS,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,kBAmBxF;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["element.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,WAAW,UAAQ,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,KAAK,CAAC,SAAS,CASjB;AAGD,eAAO,MAAM,iBAAiB,OACxB,WAAW,WACN,GAAG;;;gBA4Cb,CAAC;AAEF,wBAAgB,SAAS,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,kBAmBxF;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,WAAW,GAAG,IAAI,CA+BzF;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,mBAAmB,EAAE,KAAK,EAAE,MAAM,WAYxE;AAED,eAAO,MAAM,eAAe,QAAS,MAAM,WAAwC,CAAC"}
|
package/cjs/utils/dom/index.d.ts
CHANGED
@@ -3,6 +3,7 @@ export { parsePxToNumber, addResizeObserver } from './element';
|
|
3
3
|
export type { OldWheelEvent } from './normalize-wheel.type';
|
4
4
|
export * from './ready';
|
5
5
|
export * from './element';
|
6
|
+
export * from './document';
|
6
7
|
export { default as ResponsiveObserve } from './responsiveObserve';
|
7
8
|
export type { Breakpoint, ScreenMap } from './responsiveObserve.type';
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC"}
|
package/cjs/utils/dom/index.js
CHANGED
@@ -64,5 +64,17 @@ Object.keys(_ready).forEach(function (key) {
|
|
64
64
|
}
|
65
65
|
});
|
66
66
|
});
|
67
|
+
var _document = require("./document");
|
68
|
+
Object.keys(_document).forEach(function (key) {
|
69
|
+
if (key === "default" || key === "__esModule") return;
|
70
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
71
|
+
if (key in exports && exports[key] === _document[key]) return;
|
72
|
+
Object.defineProperty(exports, key, {
|
73
|
+
enumerable: true,
|
74
|
+
get: function get() {
|
75
|
+
return _document[key];
|
76
|
+
}
|
77
|
+
});
|
78
|
+
});
|
67
79
|
var _responsiveObserve = _interopRequireDefault(require("./responsiveObserve"));
|
68
80
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/cjs/utils/is.d.ts
CHANGED
@@ -24,6 +24,5 @@ export declare const isLink: (el: unknown) => el is React.ReactElement<any, stri
|
|
24
24
|
export declare function isNamedComponent(type: any): type is React.ForwardRefExoticComponent<unknown>;
|
25
25
|
export declare const isMacOS: () => boolean;
|
26
26
|
export declare const isFirefox: () => boolean;
|
27
|
-
export declare const isChromeLowerThan: (version: number) => boolean;
|
28
27
|
export declare function isDomElement(element: any): element is HTMLElement;
|
29
28
|
//# sourceMappingURL=is.d.ts.map
|
package/cjs/utils/is.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"is.d.ts","sourceRoot":"","sources":["is.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,wBAAgB,SAAS,YAExB;AASD,eAAO,MAAM,OAAO,4BAAgB,CAAC;AACrC,eAAO,MAAM,QAAQ,QAAS,OAAO,sBACc,CAAC;AACpD,eAAO,MAAM,MAAM,QAAS,OAAO,gBAAqC,CAAC;AACzE,eAAO,MAAM,SAAS,QAAS,OAAO,mBAA2C,CAAC;AAClF,eAAO,MAAM,OAAO,QAAS,OAAO,KAAG,OAA+B,CAAC;AACvE,eAAO,MAAM,QAAQ,MAAO,OAAO,gBAAuC,CAAC;AAC3E,eAAO,MAAM,QAAQ,QAAS,OAAO,KAAG,OAAgC,CAAC;AACzE,eAAO,MAAM,QAAQ,MAAO,OAAO,gBAAuC,CAAC;AAC3E,eAAO,MAAM,WAAW,QAAS,GAAG,qBAAwC,CAAC;AAC7E,eAAO,MAAM,KAAK,QAjBsB,OAAO,mBAiBb,CAAC;AACnC,eAAO,MAAM,KAAK,QAlBsB,OAAO,mBAkBb,CAAC;AACnC,eAAO,MAAM,QAAQ,QAAS,OAAO,KAAG,OAUvC,CAAC;AACF,eAAO,MAAM,eAAe,QAAS,OAAO,yBAE3C,CAAC;AACF,eAAO,MAAM,WAAW,QAAS,OAAO,KAAG,OAS1C,CAAC;AAEF,eAAO,MAAM,MAAM,MAAO,OAAO,kBAA2C,CAAC;AAE7E,eAAO,MAAM,SAAS,MAAO,OAAO,YACiC,CAAC;AAGtE,eAAO,MAAM,KAAK,MAAO,OA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AACF,eAAO,MAAM,WAAW,QAAS,OAAO,KAAG,OAS1C,CAAC;AAEF,eAAO,MAAM,MAAM,MAAO,OAAO,kBAA2C,CAAC;AAE7E,eAAO,MAAM,SAAS,MAAO,OAAO,YACiC,CAAC;AAGtE,eAAO,MAAM,KAAK,MAAO,OAAO,KAAG,OAAkB,CAAC;AAEtD,eAAO,MAAM,OAAO,QAAS,OAAO,KAAG,OActC,CAAC;AAEF,eAAO,MAAM,MAAM,OAAQ,OAAO,6EASjC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,KAAK,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAE5F;AAED,eAAO,MAAM,OAAO,QAAO,OACqC,CAAC;AAEjE,eAAO,MAAM,SAAS,QAAO,OAG5B,CAAC;AAEF,wBAAgB,YAAY,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,IAAI,WAAW,CAQjE"}
|
package/cjs/utils/is.js
CHANGED
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.isBoolean = exports.isArray = void 0;
|
7
7
|
exports.isBrowser = isBrowser;
|
8
|
-
exports.isDate = exports.
|
8
|
+
exports.isDate = exports.isBuffer = void 0;
|
9
9
|
exports.isDomElement = isDomElement;
|
10
10
|
exports.isMergeable = exports.isMap = exports.isMacOS = exports.isLink = exports.isFunc = exports.isFirefox = exports.isError = exports.isEmpty = void 0;
|
11
11
|
exports.isNamedComponent = isNamedComponent;
|
@@ -108,15 +108,6 @@ var isFirefox = exports.isFirefox = function isFirefox() {
|
|
108
108
|
if (!isBrowser()) return false;
|
109
109
|
return navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
110
110
|
};
|
111
|
-
var isChromeLowerThan = exports.isChromeLowerThan = function isChromeLowerThan(version) {
|
112
|
-
// 服务器端渲染时,不执行版本检查
|
113
|
-
if (typeof window === 'undefined' || typeof navigator === 'undefined') {
|
114
|
-
return false;
|
115
|
-
}
|
116
|
-
var ua = navigator.userAgent;
|
117
|
-
var chrome = ua.match(/chrome\/(\d+)/i);
|
118
|
-
return Boolean(chrome && chrome[1] && parseInt(chrome[1], 10) < version);
|
119
|
-
};
|
120
111
|
function isDomElement(element) {
|
121
112
|
return (typeof HTMLElement === "undefined" ? "undefined" : _typeof(HTMLElement)) === 'object' ? element instanceof HTMLElement // DOM2
|
122
113
|
: element && _typeof(element) === 'object' && element !== null && element.nodeType === 1 && typeof element.nodeName === 'string';
|
@@ -0,0 +1,11 @@
|
|
1
|
+
interface Position {
|
2
|
+
top: number;
|
3
|
+
left: number;
|
4
|
+
}
|
5
|
+
interface UseCheckElementPositionOptions {
|
6
|
+
enable?: boolean;
|
7
|
+
scrollContainer?: HTMLElement | null;
|
8
|
+
}
|
9
|
+
export declare const useCheckElementPosition: (elementRef: React.RefObject<HTMLElement>, options?: UseCheckElementPositionOptions) => Position | null;
|
10
|
+
export {};
|
11
|
+
//# sourceMappingURL=check-position.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"check-position.d.ts","sourceRoot":"","sources":["check-position.ts"],"names":[],"mappings":"AAEA,UAAU,QAAQ;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,8BAA8B;IAEtC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CACtC;AAED,eAAO,MAAM,uBAAuB,eACtB,MAAM,SAAS,CAAC,WAAW,CAAC,YAC/B,8BAA8B,KACtC,QAAQ,GAAG,IAyEb,CAAC"}
|
@@ -0,0 +1,84 @@
|
|
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 { useState, useEffect, useRef, useCallback } from 'react';
|
8
|
+
export var useCheckElementPosition = function useCheckElementPosition(elementRef) {
|
9
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
10
|
+
var enable = options.enable,
|
11
|
+
scrollContainer = options.scrollContainer;
|
12
|
+
var _useState = useState({
|
13
|
+
top: 0,
|
14
|
+
left: 0
|
15
|
+
}),
|
16
|
+
_useState2 = _slicedToArray(_useState, 2),
|
17
|
+
position = _useState2[0],
|
18
|
+
setPosition = _useState2[1];
|
19
|
+
var lastPosition = useRef({
|
20
|
+
top: 0,
|
21
|
+
left: 0
|
22
|
+
});
|
23
|
+
var checkPosition = useCallback(function () {
|
24
|
+
if (elementRef.current) {
|
25
|
+
var rect = elementRef.current.getBoundingClientRect();
|
26
|
+
var scrollContainerRect = scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.getBoundingClientRect();
|
27
|
+
var newPosition;
|
28
|
+
if (scrollContainerRect) {
|
29
|
+
newPosition = {
|
30
|
+
top: rect.top - scrollContainerRect.top,
|
31
|
+
left: rect.left - scrollContainerRect.left
|
32
|
+
};
|
33
|
+
} else {
|
34
|
+
newPosition = {
|
35
|
+
top: rect.top,
|
36
|
+
left: rect.left
|
37
|
+
};
|
38
|
+
}
|
39
|
+
if (newPosition.top !== lastPosition.current.top || newPosition.left !== lastPosition.current.left) {
|
40
|
+
setPosition(newPosition);
|
41
|
+
lastPosition.current = newPosition;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}, [elementRef, scrollContainer]);
|
45
|
+
useEffect(function () {
|
46
|
+
var _window;
|
47
|
+
if (!enable) return;
|
48
|
+
var element = elementRef.current;
|
49
|
+
var container = scrollContainer || window;
|
50
|
+
if (!element) return;
|
51
|
+
|
52
|
+
// 初始检查
|
53
|
+
checkPosition();
|
54
|
+
var resizeObserver = null;
|
55
|
+
if ((_window = window) !== null && _window !== void 0 && _window.ResizeObserver) {
|
56
|
+
resizeObserver = new ResizeObserver(checkPosition);
|
57
|
+
resizeObserver.observe(element);
|
58
|
+
if (container instanceof Element) {
|
59
|
+
resizeObserver.observe(container);
|
60
|
+
}
|
61
|
+
}
|
62
|
+
// 滚动事件监听
|
63
|
+
container.addEventListener('scroll', checkPosition);
|
64
|
+
|
65
|
+
// 如果容器不是 window,我们仍然需要监听 window 的 resize 事件
|
66
|
+
if (container !== window) {
|
67
|
+
window.addEventListener('resize', checkPosition);
|
68
|
+
}
|
69
|
+
|
70
|
+
// 清理函数
|
71
|
+
return function () {
|
72
|
+
var _resizeObserver;
|
73
|
+
(_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 || _resizeObserver.disconnect();
|
74
|
+
container.removeEventListener('scroll', checkPosition);
|
75
|
+
if (container !== window) {
|
76
|
+
window.removeEventListener('resize', checkPosition);
|
77
|
+
}
|
78
|
+
};
|
79
|
+
}, [enable, elementRef, scrollContainer, checkPosition]);
|
80
|
+
if (!enable || !elementRef) {
|
81
|
+
return null;
|
82
|
+
}
|
83
|
+
return position;
|
84
|
+
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAQnD,MAAM,MAAM,kBAAkB,GAC1B,aAAa,GACb,UAAU,GACV,cAAc,GACd,WAAW,GACX,MAAM,GACN,OAAO,CAAC;AACZ,MAAM,MAAM,gBAAgB,GACxB,aAAa,GACb,cAAc,GACd,UAAU,GACV,WAAW,GACX,KAAK,GACL,QAAQ,CAAC;AAYb,KAAK,YAAY,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,OAAO,CAAC;AACpE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;IAEd,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAE1C,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAEzC,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC3C,YAAY,EAAE,MAAM,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAOD,eAAO,MAAM,gBAAgB,WAAY,mBAAmB;;;CAyS3D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
@@ -7,17 +7,17 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
7
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
8
8
|
import React, { useEffect, useState } from 'react';
|
9
9
|
import { getPositionStyle } from "./get-position-style";
|
10
|
+
import { useCheckElementPosition } from "./check-position";
|
10
11
|
import shallowEqual from "../../utils/shallow-equal";
|
11
12
|
import usePersistFn from "../use-persist-fn";
|
12
|
-
import {
|
13
|
-
import {
|
13
|
+
import { getCurrentCSSZoom } from "../../utils";
|
14
|
+
import { docSize } from "../../utils";
|
14
15
|
var horizontalPosition = ['left-bottom', 'left-top', 'right-bottom', 'right-top', 'left', 'right'];
|
15
16
|
var verticalPosition = ['bottom-left', 'bottom-right', 'top-left', 'top-right', 'bottom', 'top'];
|
16
17
|
var hideStyle = {
|
17
18
|
pointerEvents: 'none',
|
18
19
|
position: 'fixed',
|
19
|
-
|
20
|
-
opacity: 0
|
20
|
+
visibility: 'hidden'
|
21
21
|
};
|
22
22
|
export var usePositionStyle = function usePositionStyle(config) {
|
23
23
|
var _ref = config || {},
|
@@ -45,7 +45,6 @@ export var usePositionStyle = function usePositionStyle(config) {
|
|
45
45
|
arrayStyle = _useState4[0],
|
46
46
|
setArrayStyle = _useState4[1];
|
47
47
|
var _React$useRef = React.useRef({
|
48
|
-
element: null,
|
49
48
|
containerRect: {
|
50
49
|
left: 0,
|
51
50
|
width: 0
|
@@ -59,10 +58,13 @@ export var usePositionStyle = function usePositionStyle(config) {
|
|
59
58
|
width: 0
|
60
59
|
},
|
61
60
|
popUpHeight: 0,
|
62
|
-
popUpWidth: 0
|
63
|
-
opsStyle: {}
|
61
|
+
popUpWidth: 0
|
64
62
|
}),
|
65
63
|
context = _React$useRef.current;
|
64
|
+
var parentElNewPosition = useCheckElementPosition(parentElRef, {
|
65
|
+
scrollContainer: scrollElRef === null || scrollElRef === void 0 ? void 0 : scrollElRef.current,
|
66
|
+
enable: show && adjust
|
67
|
+
});
|
66
68
|
var adjustPosition = function adjustPosition(position) {
|
67
69
|
var winHeight = docSize.height;
|
68
70
|
if (!verticalPosition.includes(position)) return position;
|
@@ -129,7 +131,6 @@ export var usePositionStyle = function usePositionStyle(config) {
|
|
129
131
|
}
|
130
132
|
var targetPosition = position;
|
131
133
|
var rootContainer = getContainer() || document.body;
|
132
|
-
var closestScrollContainer = absolute ? null : getClosestScrollContainer(parentElRef.current);
|
133
134
|
var containerRect = rootContainer.getBoundingClientRect();
|
134
135
|
var bodyRect = (document.documentElement || document.body).getBoundingClientRect();
|
135
136
|
var containerScrollBarWidth = rootContainer.offsetWidth - rootContainer.clientWidth;
|
@@ -148,7 +149,7 @@ export var usePositionStyle = function usePositionStyle(config) {
|
|
148
149
|
var overRight = 0;
|
149
150
|
var overLeft = 0;
|
150
151
|
if (h === 'left') {
|
151
|
-
style.left = rect.left - containerRect.left + containerScroll.left
|
152
|
+
style.left = rect.left - containerRect.left + containerScroll.left;
|
152
153
|
style.transform = '';
|
153
154
|
arrayStyle.left = "8px";
|
154
155
|
if (adjust) {
|
@@ -247,13 +248,14 @@ export var usePositionStyle = function usePositionStyle(config) {
|
|
247
248
|
};
|
248
249
|
};
|
249
250
|
var getAbsoluteStyle = function getAbsoluteStyle(position) {
|
251
|
+
var _scrollElRef$current;
|
250
252
|
if (!parentElRef.current) return {
|
251
253
|
style: hideStyle
|
252
254
|
};
|
253
255
|
var rect = context.parentRect;
|
254
|
-
if (scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current) {
|
255
|
-
var _scrollElRef$
|
256
|
-
var visibleRect = ((_scrollElRef$
|
256
|
+
if (scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current = scrollElRef.current) !== null && _scrollElRef$current !== void 0 && _scrollElRef$current.contains(parentElRef.current)) {
|
257
|
+
var _scrollElRef$current2;
|
258
|
+
var visibleRect = ((_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.getBoundingClientRect()) || {};
|
257
259
|
if (rect.bottom < visibleRect.top || rect.top > visibleRect.bottom || rect.right < visibleRect.left || rect.left > visibleRect.right) {
|
258
260
|
return {
|
259
261
|
style: hideStyle
|
@@ -263,15 +265,8 @@ export var usePositionStyle = function usePositionStyle(config) {
|
|
263
265
|
var _getAbsolutePositionS = getAbsolutePositionStyle(rect, position),
|
264
266
|
style = _getAbsolutePositionS.style,
|
265
267
|
arrayStyle = _getAbsolutePositionS.arrayStyle;
|
266
|
-
|
267
|
-
|
268
|
-
if (!isChromeLowerThan(128)) {
|
269
|
-
// @ts-ignore currentCSSZoom
|
270
|
-
var currentCSSZoom = document.body.currentCSSZoom;
|
271
|
-
if (currentCSSZoom === 1 || !currentCSSZoom) return {
|
272
|
-
style: style,
|
273
|
-
arrayStyle: arrayStyle
|
274
|
-
};
|
268
|
+
var currentCSSZoom = getCurrentCSSZoom();
|
269
|
+
if (currentCSSZoom && currentCSSZoom !== 1) {
|
275
270
|
if (style.left && typeof style.left === 'number') {
|
276
271
|
style.left = style.left * (1 / currentCSSZoom);
|
277
272
|
}
|
@@ -337,7 +332,7 @@ export var usePositionStyle = function usePositionStyle(config) {
|
|
337
332
|
setArrayStyle(newArrayStyle || {});
|
338
333
|
}
|
339
334
|
});
|
340
|
-
useEffect(updateStyle, [show, position, absolute, updateKey, fixedWidth]);
|
335
|
+
useEffect(updateStyle, [show, position, absolute, updateKey, fixedWidth, parentElNewPosition]);
|
341
336
|
return {
|
342
337
|
style: style,
|
343
338
|
arrayStyle: arrayStyle
|
@@ -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;
|
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,EAGjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OAAO;;;;;;;;;
|
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"}
|
@@ -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
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AAK,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"}
|
@@ -5,7 +5,7 @@ declare const useInputFormat: (props: InputFormatProps) => {
|
|
5
5
|
onBlur: (e: React.FocusEvent) => void;
|
6
6
|
onFocus: (e: React.FocusEvent) => void;
|
7
7
|
value: string | undefined;
|
8
|
-
type: "search" | "color" | "button" | "time" | "image" | "text" | "reset" | "submit" | "email" | "url" | "range" | "tel" | (string & {}) | "
|
8
|
+
type: "search" | "color" | "button" | "time" | "image" | "text" | "reset" | "submit" | "email" | "url" | "range" | "tel" | (string & {}) | "hidden" | "checkbox" | "radio" | "date" | "datetime-local" | "file" | "month" | "password" | "week" | undefined;
|
9
9
|
};
|
10
10
|
export default useInputFormat;
|
11
11
|
//# sourceMappingURL=use-input-format.d.ts.map
|
@@ -7,7 +7,7 @@ declare const useNumberFormat: (props: InputNumberProps) => {
|
|
7
7
|
onBlur: (e: React.FocusEvent<Element, Element>) => void;
|
8
8
|
onFocus: (e: React.FocusEvent<Element, Element>) => void;
|
9
9
|
value: string | undefined;
|
10
|
-
type: "search" | "color" | "button" | "time" | "image" | "text" | "reset" | "submit" | "email" | "url" | "range" | "tel" | (string & {}) | "
|
10
|
+
type: "search" | "color" | "button" | "time" | "image" | "text" | "reset" | "submit" | "email" | "url" | "range" | "tel" | (string & {}) | "hidden" | "checkbox" | "radio" | "date" | "datetime-local" | "file" | "month" | "password" | "week" | undefined;
|
11
11
|
};
|
12
12
|
export default useNumberFormat;
|
13
13
|
//# sourceMappingURL=use-input-number.d.ts.map
|
@@ -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;;;
|
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:
|
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;AA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MAAM,UAAU,MAAM;;;;;;;;CAsO5D,CAAC;AAEF,eAAe,cAAc,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:
|
350
|
+
width: tableWidth,
|
350
351
|
shouldLastColAuto: props.columnResizable && !adjust,
|
351
352
|
scrollWidth: scrollWidth,
|
352
353
|
maxScrollLeft: scrollWidth - context.clientWidth,
|
@@ -10,6 +10,7 @@ interface UseTableVirtualProps {
|
|
10
10
|
disabled?: boolean;
|
11
11
|
isRtl?: boolean;
|
12
12
|
columns: TableFormatColumn<any>[];
|
13
|
+
colgroup: (number | string | undefined)[];
|
13
14
|
}
|
14
15
|
declare const useTableVirtual: (props: UseTableVirtualProps) => {
|
15
16
|
scrollHeight: number;
|
@@ -27,6 +28,8 @@ declare const useTableVirtual: (props: UseTableVirtualProps) => {
|
|
27
28
|
setRowHeight: (index: number, height: number) => void;
|
28
29
|
getTranslate: (left?: number, top?: number) => string;
|
29
30
|
scrollToIndex: (index: number, callback?: () => void) => void;
|
31
|
+
scrollColumnByLeft: (targetLeft: number) => void;
|
32
|
+
scrollColumnIntoView: (colKey: string | number) => void;
|
30
33
|
};
|
31
34
|
export default useTableVirtual;
|
32
35
|
//# sourceMappingURL=use-table-virtual.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-table-virtual.d.ts","sourceRoot":"","sources":["use-table-virtual.tsx"],"names":[],"mappings":";AAE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