@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
@@ -253,6 +253,33 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
253
253
|
props.scrollRef.current.scrollTop = beforeHeight;
|
254
254
|
}
|
255
255
|
});
|
256
|
+
var scrollColumnByLeft = usePersistFn(function (targetLeft) {
|
257
|
+
if (targetLeft < 0) return;
|
258
|
+
var scrollEl = props.scrollRef.current;
|
259
|
+
if (!scrollEl) return;
|
260
|
+
// scrollLeft max
|
261
|
+
var max = scrollEl.scrollWidth - scrollEl.clientWidth;
|
262
|
+
var left = Math.min(targetLeft, max);
|
263
|
+
if (left === scrollEl.scrollLeft) return;
|
264
|
+
setLeft(left);
|
265
|
+
scrollEl.scrollLeft = left;
|
266
|
+
});
|
267
|
+
var scrollColumnIntoView = usePersistFn(function (colKey) {
|
268
|
+
if (colKey === undefined) return;
|
269
|
+
var col = props.columns.find(function (col) {
|
270
|
+
return col.key === colKey;
|
271
|
+
});
|
272
|
+
if (!col || col.fixed) return;
|
273
|
+
var left = 0;
|
274
|
+
for (var i = 0, len = col.index; i < len; i++) {
|
275
|
+
if (props.columns[i].fixed) {
|
276
|
+
left = 0;
|
277
|
+
} else {
|
278
|
+
left += props.colgroup[i];
|
279
|
+
}
|
280
|
+
}
|
281
|
+
scrollColumnByLeft(left);
|
282
|
+
});
|
256
283
|
useEffect(function () {
|
257
284
|
var scrollRefHeight = props.scrollRef.current ? props.scrollRef.current.clientHeight : 0;
|
258
285
|
var tableRefHeight = props.innerRef.current ? props.innerRef.current.clientHeight : 0;
|
@@ -316,7 +343,9 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
316
343
|
handleScroll: handleScroll,
|
317
344
|
setRowHeight: setRowHeight,
|
318
345
|
getTranslate: getTranslate,
|
319
|
-
scrollToIndex: scrollToIndex
|
346
|
+
scrollToIndex: scrollToIndex,
|
347
|
+
scrollColumnByLeft: scrollColumnByLeft,
|
348
|
+
scrollColumnIntoView: scrollColumnIntoView
|
320
349
|
};
|
321
350
|
};
|
322
351
|
export default useTableVirtual;
|
@@ -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 数据
|
@@ -54,6 +66,13 @@ export interface BaseTableProps<Item> {
|
|
54
66
|
* @cn 排序取消事件
|
55
67
|
*/
|
56
68
|
onSortCancel?: (preType: 'asc' | 'desc', key: KeygenResult, orders: SortItem[], sorter: string) => void;
|
69
|
+
/**
|
70
|
+
* @en sort directions
|
71
|
+
* @cn 排序方向
|
72
|
+
* @default ['asc', 'desc']
|
73
|
+
* @version 3.5.0
|
74
|
+
*/
|
75
|
+
sortDirections?: ('asc' | 'desc')[];
|
57
76
|
/**
|
58
77
|
* @en Set columnResizable to true to make all columns scalable
|
59
78
|
* @cn 设置 columnResizable 为 true,使所有列可伸缩
|
@@ -195,6 +214,13 @@ export interface TableColumnItem<DataItem> {
|
|
195
214
|
* 服务端排序,不要返回值,自行处理即可。(旧用法)
|
196
215
|
*/
|
197
216
|
sorter?: ((order: TableColumnOrder) => ((prevRowData: DataItem, nextRowData: DataItem) => number) | void) | string | TableColumnSorter;
|
217
|
+
/**
|
218
|
+
* @en sort directions
|
219
|
+
* @cn 排序方向
|
220
|
+
* @default ['asc', 'desc']
|
221
|
+
* @version 3.5.0
|
222
|
+
*/
|
223
|
+
sortDirections?: ('asc' | 'desc')[];
|
198
224
|
/**
|
199
225
|
* @en The content of the header
|
200
226
|
* @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;
|
1
|
+
{"version":3,"file":"use-table.type.d.ts","sourceRoot":"","sources":["use-table.type.ts"],"names":[],"mappings":"A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AAC;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"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["document.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,QAAO,MAqBpC,CAAA"}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
var cachedZoom = 0;
|
2
|
+
export var getCurrentCSSZoom = function getCurrentCSSZoom() {
|
3
|
+
if (cachedZoom) return cachedZoom;
|
4
|
+
if (typeof window === 'undefined' || typeof navigator === 'undefined' || !document.body) {
|
5
|
+
return 1;
|
6
|
+
}
|
7
|
+
var currentCSSZoom = Math.round(document.body.getBoundingClientRect().width) / document.body.clientWidth;
|
8
|
+
if (window.ResizeObserver) {
|
9
|
+
// 监听document.body的变化,更新缓存的zoom
|
10
|
+
var resizeObserver = new ResizeObserver(function () {
|
11
|
+
cachedZoom = Math.round(document.body.getBoundingClientRect().width) / document.body.clientWidth;
|
12
|
+
});
|
13
|
+
resizeObserver.observe(document.body);
|
14
|
+
}
|
15
|
+
cachedZoom = currentCSSZoom;
|
16
|
+
return currentCSSZoom;
|
17
|
+
};
|
18
|
+
|
19
|
+
// export const getZoomBoundingClientRect = (element: HTMLElement) => {
|
20
|
+
// const currentCSSZoom = getCurrentCSSZoom()
|
21
|
+
// if (currentCSSZoom === 1 || !currentCSSZoom) {
|
22
|
+
// return element.getBoundingClientRect()
|
23
|
+
// }
|
24
|
+
// const isNotZoom = currentCSSZoom === 1 || !currentCSSZoom
|
25
|
+
|
26
|
+
// if (isNotZoom) {
|
27
|
+
// return element.getBoundingClientRect()
|
28
|
+
// }
|
29
|
+
|
30
|
+
// const zoomRatio = 1 / currentCSSZoom
|
31
|
+
// const rect = element.getBoundingClientRect()
|
32
|
+
|
33
|
+
// return {
|
34
|
+
// x: rect.x * zoomRatio,
|
35
|
+
// y: rect.y * zoomRatio,
|
36
|
+
// top: rect.top * zoomRatio,
|
37
|
+
// right: rect.right * zoomRatio,
|
38
|
+
// bottom: rect.bottom * zoomRatio,
|
39
|
+
// left: rect.left * zoomRatio,
|
40
|
+
// width: rect.width * zoomRatio,
|
41
|
+
// height: rect.height * zoomRatio,
|
42
|
+
// }
|
43
|
+
// }
|
@@ -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/esm/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/esm/utils/dom/index.js
CHANGED
@@ -2,4 +2,5 @@ export { default, default as NormalizeWheel } from "./normalize-wheel";
|
|
2
2
|
export { parsePxToNumber, addResizeObserver } from "./element";
|
3
3
|
export * from "./ready";
|
4
4
|
export * from "./element";
|
5
|
+
export * from "./document";
|
5
6
|
export { default as ResponsiveObserve } from "./responsiveObserve";
|
package/esm/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/esm/utils/is.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"is.d.ts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,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/esm/utils/is.js
CHANGED
@@ -95,15 +95,6 @@ export var isFirefox = function isFirefox() {
|
|
95
95
|
if (!isBrowser()) return false;
|
96
96
|
return navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
97
97
|
};
|
98
|
-
export var isChromeLowerThan = function isChromeLowerThan(version) {
|
99
|
-
// 服务器端渲染时,不执行版本检查
|
100
|
-
if (typeof window === 'undefined' || typeof navigator === 'undefined') {
|
101
|
-
return false;
|
102
|
-
}
|
103
|
-
var ua = navigator.userAgent;
|
104
|
-
var chrome = ua.match(/chrome\/(\d+)/i);
|
105
|
-
return Boolean(chrome && chrome[1] && parseInt(chrome[1], 10) < version);
|
106
|
-
};
|
107
98
|
export function isDomElement(element) {
|
108
99
|
return (typeof HTMLElement === "undefined" ? "undefined" : _typeof(HTMLElement)) === 'object' ? element instanceof HTMLElement // DOM2
|
109
100
|
: element && _typeof(element) === 'object' && element !== null && element.nodeType === 1 && typeof element.nodeName === 'string';
|