@sheinx/hooks 3.3.0-beta.8 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/common/use-position-style/index.d.ts.map +1 -1
- package/cjs/common/use-position-style/index.js +4 -1
- package/cjs/components/use-datepicker/use-datepicker-range.d.ts.map +1 -1
- package/cjs/components/use-datepicker/use-datepicker-range.js +2 -1
- package/cjs/components/use-pagination/use-pagination.d.ts.map +1 -1
- package/cjs/components/use-pagination/use-pagination.js +4 -1
- package/cjs/components/use-table/use-table-layout.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-layout.js +6 -1
- package/cjs/components/use-table/use-table-virtual.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-virtual.js +14 -3
- package/cjs/components/use-table/use-table.type.d.ts +2 -2
- package/cjs/utils/is.d.ts +1 -0
- package/cjs/utils/is.d.ts.map +1 -1
- package/cjs/utils/is.js +10 -1
- package/esm/common/use-position-style/index.d.ts.map +1 -1
- package/esm/common/use-position-style/index.js +4 -1
- package/esm/components/use-datepicker/use-datepicker-range.d.ts.map +1 -1
- package/esm/components/use-datepicker/use-datepicker-range.js +2 -1
- package/esm/components/use-pagination/use-pagination.d.ts.map +1 -1
- package/esm/components/use-pagination/use-pagination.js +4 -1
- package/esm/components/use-table/use-table-layout.d.ts.map +1 -1
- package/esm/components/use-table/use-table-layout.js +6 -1
- package/esm/components/use-table/use-table-virtual.d.ts.map +1 -1
- package/esm/components/use-table/use-table-virtual.js +14 -3
- package/esm/components/use-table/use-table.type.d.ts +2 -2
- package/esm/utils/is.d.ts +1 -0
- package/esm/utils/is.d.ts.map +1 -1
- package/esm/utils/is.js +9 -0
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAMnD,MAAM,MAAM,kBAAkB,GAC1B,aAAa,GACb,UAAU,GACV,cAAc,GACd,WAAW,GACX,MAAM,GACN,OAAO,C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G,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;AAQD,eAAO,MAAM,gBAAgB,WAAY,mBAAmB,wBAsO3D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
@@ -171,7 +171,10 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
|
|
171
171
|
if (adjust) {
|
172
172
|
// 调节左右溢出
|
173
173
|
if (overRight > 0) {
|
174
|
+
var toRightDistance = bodyRect.right - rect.right;
|
174
175
|
style.left -= overRight;
|
176
|
+
// 扣除触发器距离页面右侧的距离,以保证从右侧弹出的窗口最右边对齐触发器最右边
|
177
|
+
style.left -= toRightDistance;
|
175
178
|
}
|
176
179
|
if (overLeft > 0) {
|
177
180
|
style.left += overLeft;
|
@@ -258,7 +261,7 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
|
|
258
261
|
setStyle(newStyle);
|
259
262
|
}
|
260
263
|
});
|
261
|
-
(0, _react.useEffect)(updateStyle, [show, position, absolute, updateKey]);
|
264
|
+
(0, _react.useEffect)(updateStyle, [show, position, absolute, updateKey, fixedWidth]);
|
262
265
|
return style;
|
263
266
|
};
|
264
267
|
var _default = exports.default = usePositionStyle;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-datepicker-range.d.ts","sourceRoot":"","sources":["use-datepicker-range.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAK5D,QAAA,MAAM,YAAY,UAAW,aAAa;;;;;;;;;
|
1
|
+
{"version":3,"file":"use-datepicker-range.d.ts","sourceRoot":"","sources":["use-datepicker-range.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAK5D,QAAA,MAAM,YAAY,UAAW,aAAa;;;;;;;;;6BA2FC,IAAI,YAAY,OAAO;2BAKzB,IAAI,YAAY,OAAO;gCAblB,IAAI,WAAW,GAAG,EAAE;8BAItB,IAAI,WAAW,GAAG,EAAE;gCAclB,IAAI;8BA4BN,IAAI;8BAqBJ,IAAI;4BAeN,IAAI;+BA5DD,IAAI;6BAYN,IAAI;;CAuH9C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
@@ -43,7 +43,8 @@ var useRangePick = function useRangePick(props) {
|
|
43
43
|
if (rangeMax.getTime() < newArr[1].getTime()) {
|
44
44
|
newArr[1] = rangeMax;
|
45
45
|
}
|
46
|
-
}
|
46
|
+
}
|
47
|
+
if (date.getTime() > newArr[1].getTime()) {
|
47
48
|
var a = _util.default.cloneTime(new Date(date), arr[1] || defaultTimeArr[1], 'HH:mm:ss', options);
|
48
49
|
newArr[1] = a.getTime() > date.getTime() ? a : new Date(date);
|
49
50
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-pagination.d.ts","sourceRoot":"","sources":["use-pagination.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,QAAA,MAAM,aAAa,UAAW,mBAAmB;;;;
|
1
|
+
{"version":3,"file":"use-pagination.d.ts","sourceRoot":"","sources":["use-pagination.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,QAAA,MAAM,aAAa,UAAW,mBAAmB;;;;kBAqBT,MAAM,SAAS,MAAM;;;;;;;CAiC5D,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
@@ -39,6 +39,9 @@ var usePagination = function usePagination(props) {
|
|
39
39
|
(0, _react.useEffect)(function () {
|
40
40
|
if (pageSizeProp !== pageSize) setPageSize(pageSizeProp);
|
41
41
|
}, [pageSizeProp]);
|
42
|
+
(0, _react.useEffect)(function () {
|
43
|
+
if (currentProp !== undefined && currentProp !== current) setCurrent(currentProp);
|
44
|
+
}, [currentProp]);
|
42
45
|
var handleChange = (0, _usePersistFn.usePersistFn)(function (c, size) {
|
43
46
|
if (c === current && size === undefined) return;
|
44
47
|
setCurrent(c);
|
@@ -58,7 +61,7 @@ var usePagination = function usePagination(props) {
|
|
58
61
|
return _objectSpread({}, mergedEventHandlers);
|
59
62
|
};
|
60
63
|
return {
|
61
|
-
current:
|
64
|
+
current: current,
|
62
65
|
pageSize: pageSize,
|
63
66
|
total: total,
|
64
67
|
onChange: handleChange,
|
@@ -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;AAcrE,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;;;;;;;;;;;yBA8CX,MAAM,UAAU,MAAM;;;;;;;;
|
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;AAcrE,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;;;;;;;;;;;yBA8CX,MAAM,UAAU,MAAM;;;;;;;;CAkO5D,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
@@ -145,6 +145,10 @@ var useTableLayout = function useTableLayout(props) {
|
|
145
145
|
});
|
146
146
|
};
|
147
147
|
var changeColGroup = function changeColGroup(cols, adjust) {
|
148
|
+
// 修改`Table`被display:none时,表格头样式错乱的问题
|
149
|
+
if (cols && cols.every(function (v) {
|
150
|
+
return v === 0;
|
151
|
+
})) return;
|
148
152
|
setColgroup(cols);
|
149
153
|
setAdjust(adjust);
|
150
154
|
if (!adjust) {
|
@@ -334,10 +338,11 @@ var useTableLayout = function useTableLayout(props) {
|
|
334
338
|
setAdjust(false);
|
335
339
|
} else {
|
336
340
|
checkFloat();
|
337
|
-
checkScroll();
|
341
|
+
// checkScroll();
|
338
342
|
// 拖拽列会导致 scrollWidth 变化
|
339
343
|
syncScrollWidth();
|
340
344
|
}
|
345
|
+
checkScroll();
|
341
346
|
}, [colgroup]);
|
342
347
|
return {
|
343
348
|
isScrollX: !!isScrollX,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-table-virtual.d.ts","sourceRoot":"","sources":["use-table-virtual.tsx"],"names":[],"mappings":";
|
1
|
+
{"version":3,"file":"use-table-virtual.d.ts","sourceRoot":"","sources":["use-table-virtual.tsx"],"names":[],"mappings":";AAGA,UAAU,oBAAoB;IAC5B,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC3C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AACD,QAAA,MAAM,eAAe,UAAW,oBAAoB;;;;;;;oBA+GpC,MAAM;mBACP,MAAM;WACd,MAAM;gBACD,MAAM;kBACJ,OAAO;;0BAtEuB,MAAM,UAAU,MAAM;0BAxBtB,MAAM,QAAQ,MAAM;2BAkInB,MAAM;CAmElD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
var _usePrevious = require("../.../../../common/use-previous");
|
8
7
|
var _usePersistFn = require("../../common/use-persist-fn");
|
9
8
|
var _react = require("react");
|
10
9
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
@@ -34,7 +33,6 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
34
33
|
_useState8 = _slicedToArray(_useState7, 2),
|
35
34
|
startIndex = _useState8[0],
|
36
35
|
setStartIndex = _useState8[1];
|
37
|
-
var preIndex = (0, _usePrevious.usePrevious)(startIndex);
|
38
36
|
var _useState9 = (0, _react.useState)(0),
|
39
37
|
_useState10 = _slicedToArray(_useState9, 2),
|
40
38
|
offsetY = _useState10[0],
|
@@ -47,7 +45,8 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
47
45
|
rateTimer: null,
|
48
46
|
topTimer: null,
|
49
47
|
controlScrollRate: null,
|
50
|
-
heightCallback: null
|
48
|
+
heightCallback: null,
|
49
|
+
preIndex: null
|
51
50
|
}),
|
52
51
|
context = _useRef.current;
|
53
52
|
var getTranslate = (0, _usePersistFn.usePersistFn)(function (left, top) {
|
@@ -80,6 +79,8 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
80
79
|
if (context.shouldUpdateHeight) {
|
81
80
|
setHeight(getContentHeight(props.data.length - 1));
|
82
81
|
}
|
82
|
+
var preIndex = context.preIndex;
|
83
|
+
// 解决: 从下往上滚 由于高度变化会导致滚动条跳动
|
83
84
|
if (preIndex && preIndex > startIndex && startIndex === index) {
|
84
85
|
// 发生在顶部
|
85
86
|
if (context.heightCallback) return;
|
@@ -184,6 +185,16 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
184
185
|
props.scrollRef.current.scrollTop = beforeHeight;
|
185
186
|
}
|
186
187
|
});
|
188
|
+
(0, _react.useEffect)(function () {
|
189
|
+
// 记录preIndex
|
190
|
+
context.preIndex = startIndex;
|
191
|
+
}, [startIndex]);
|
192
|
+
(0, _react.useEffect)(function () {
|
193
|
+
// 数据变化的时候清空掉 preIndex, 如果之前有缓存的index, setRowHeight 会有问题
|
194
|
+
return function () {
|
195
|
+
context.preIndex = null;
|
196
|
+
};
|
197
|
+
}, [props.data]);
|
187
198
|
(0, _react.useEffect)(function () {
|
188
199
|
if (props.disabled) return;
|
189
200
|
if (offsetY) {
|
@@ -239,8 +239,8 @@ export interface TableColumnItem<DataItem> {
|
|
239
239
|
*/
|
240
240
|
style?: React.CSSProperties;
|
241
241
|
/**
|
242
|
-
* @cn
|
243
|
-
* @en Click event of column
|
242
|
+
* @cn 可展开元素点击事件仅当(仅该列为行展开列,并且传入 expandKeys 的时候生效)
|
243
|
+
* @en Click event of expandable element only when (only this column is row-expand column and expandKeys is passed in)
|
244
244
|
*/
|
245
245
|
onClick?: (d: DataItem, isExpand: boolean) => void;
|
246
246
|
/**
|
package/cjs/utils/is.d.ts
CHANGED
@@ -23,5 +23,6 @@ export declare const isEmpty: (val: unknown) => boolean;
|
|
23
23
|
export declare const isLink: (el: unknown) => el is React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
24
24
|
export declare const isMacOS: () => boolean;
|
25
25
|
export declare const isFirefox: () => boolean;
|
26
|
+
export declare const isChromeLowerThan: (version: number) => boolean;
|
26
27
|
export declare function isDomElement(element: any): element is HTMLElement;
|
27
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,C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ils/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.isBuffer = void 0;
|
8
|
+
exports.isDate = exports.isChromeLowerThan = exports.isBuffer = void 0;
|
9
9
|
exports.isDomElement = isDomElement;
|
10
10
|
exports.isUndefined = exports.isUnMatchedData = exports.isString = exports.isSet = exports.isRegexp = exports.isPromise = exports.isObject = exports.isNumber = exports.isNan = exports.isMergeable = exports.isMap = exports.isMacOS = exports.isLink = exports.isFunc = exports.isFirefox = exports.isError = exports.isEmpty = void 0;
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
@@ -103,6 +103,15 @@ var isFirefox = exports.isFirefox = function isFirefox() {
|
|
103
103
|
if (!isBrowser()) return false;
|
104
104
|
return navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
105
105
|
};
|
106
|
+
var isChromeLowerThan = exports.isChromeLowerThan = function isChromeLowerThan(version) {
|
107
|
+
// 服务器端渲染时,不执行版本检查
|
108
|
+
if (typeof window === 'undefined' || typeof navigator === 'undefined') {
|
109
|
+
return false;
|
110
|
+
}
|
111
|
+
var ua = navigator.userAgent;
|
112
|
+
var chrome = ua.match(/chrome\/(\d+)/i);
|
113
|
+
return Boolean(chrome && chrome[1] && parseInt(chrome[1], 10) < version);
|
114
|
+
};
|
106
115
|
function isDomElement(element) {
|
107
116
|
return (typeof HTMLElement === "undefined" ? "undefined" : _typeof(HTMLElement)) === 'object' ? element instanceof HTMLElement // DOM2
|
108
117
|
: element && _typeof(element) === 'object' && element !== null && element.nodeType === 1 && typeof element.nodeName === 'string';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAMnD,MAAM,MAAM,kBAAkB,GAC1B,aAAa,G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ACpE,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;AAQD,eAAO,MAAM,gBAAgB,WAAY,mBAAmB,wBAsO3D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
@@ -161,7 +161,10 @@ export var usePositionStyle = function usePositionStyle(config) {
|
|
161
161
|
if (adjust) {
|
162
162
|
// 调节左右溢出
|
163
163
|
if (overRight > 0) {
|
164
|
+
var toRightDistance = bodyRect.right - rect.right;
|
164
165
|
style.left -= overRight;
|
166
|
+
// 扣除触发器距离页面右侧的距离,以保证从右侧弹出的窗口最右边对齐触发器最右边
|
167
|
+
style.left -= toRightDistance;
|
165
168
|
}
|
166
169
|
if (overLeft > 0) {
|
167
170
|
style.left += overLeft;
|
@@ -248,7 +251,7 @@ export var usePositionStyle = function usePositionStyle(config) {
|
|
248
251
|
setStyle(newStyle);
|
249
252
|
}
|
250
253
|
});
|
251
|
-
useEffect(updateStyle, [show, position, absolute, updateKey]);
|
254
|
+
useEffect(updateStyle, [show, position, absolute, updateKey, fixedWidth]);
|
252
255
|
return style;
|
253
256
|
};
|
254
257
|
export default usePositionStyle;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-datepicker-range.d.ts","sourceRoot":"","sources":["use-datepicker-range.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAK5D,QAAA,MAAM,YAAY,UAAW,aAAa;;;;;;;;;
|
1
|
+
{"version":3,"file":"use-datepicker-range.d.ts","sourceRoot":"","sources":["use-datepicker-range.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAK5D,QAAA,MAAM,YAAY,UAAW,aAAa;;;;;;;;;6BA2FC,IAAI,YAAY,OAAO;2BAKzB,IAAI,YAAY,OAAO;gCAblB,IAAI,WAAW,GAAG,EAAE;8BAItB,IAAI,WAAW,GAAG,EAAE;gCAclB,IAAI;8BA4BN,IAAI;8BAqBJ,IAAI;4BAeN,IAAI;+BA5DD,IAAI;6BAYN,IAAI;;CAuH9C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
@@ -36,7 +36,8 @@ var useRangePick = function useRangePick(props) {
|
|
36
36
|
if (rangeMax.getTime() < newArr[1].getTime()) {
|
37
37
|
newArr[1] = rangeMax;
|
38
38
|
}
|
39
|
-
}
|
39
|
+
}
|
40
|
+
if (date.getTime() > newArr[1].getTime()) {
|
40
41
|
var a = utils.cloneTime(new Date(date), arr[1] || defaultTimeArr[1], 'HH:mm:ss', options);
|
41
42
|
newArr[1] = a.getTime() > date.getTime() ? a : new Date(date);
|
42
43
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-pagination.d.ts","sourceRoot":"","sources":["use-pagination.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,QAAA,MAAM,aAAa,UAAW,mBAAmB;;;;
|
1
|
+
{"version":3,"file":"use-pagination.d.ts","sourceRoot":"","sources":["use-pagination.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,QAAA,MAAM,aAAa,UAAW,mBAAmB;;;;kBAqBT,MAAM,SAAS,MAAM;;;;;;;CAiC5D,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
@@ -33,6 +33,9 @@ var usePagination = function usePagination(props) {
|
|
33
33
|
useEffect(function () {
|
34
34
|
if (pageSizeProp !== pageSize) setPageSize(pageSizeProp);
|
35
35
|
}, [pageSizeProp]);
|
36
|
+
useEffect(function () {
|
37
|
+
if (currentProp !== undefined && currentProp !== current) setCurrent(currentProp);
|
38
|
+
}, [currentProp]);
|
36
39
|
var handleChange = usePersistFn(function (c, size) {
|
37
40
|
if (c === current && size === undefined) return;
|
38
41
|
setCurrent(c);
|
@@ -52,7 +55,7 @@ var usePagination = function usePagination(props) {
|
|
52
55
|
return _objectSpread({}, mergedEventHandlers);
|
53
56
|
};
|
54
57
|
return {
|
55
|
-
current:
|
58
|
+
current: current,
|
56
59
|
pageSize: pageSize,
|
57
60
|
total: total,
|
58
61
|
onChange: handleChange,
|
@@ -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;AAcrE,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;;;;;;;;;;;yBA8CX,MAAM,UAAU,MAAM;;;;;;;;
|
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;AAcrE,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;;;;;;;;;;;yBA8CX,MAAM,UAAU,MAAM;;;;;;;;CAkO5D,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
@@ -136,6 +136,10 @@ var useTableLayout = function useTableLayout(props) {
|
|
136
136
|
});
|
137
137
|
};
|
138
138
|
var changeColGroup = function changeColGroup(cols, adjust) {
|
139
|
+
// 修改`Table`被display:none时,表格头样式错乱的问题
|
140
|
+
if (cols && cols.every(function (v) {
|
141
|
+
return v === 0;
|
142
|
+
})) return;
|
139
143
|
setColgroup(cols);
|
140
144
|
setAdjust(adjust);
|
141
145
|
if (!adjust) {
|
@@ -325,10 +329,11 @@ var useTableLayout = function useTableLayout(props) {
|
|
325
329
|
setAdjust(false);
|
326
330
|
} else {
|
327
331
|
checkFloat();
|
328
|
-
checkScroll();
|
332
|
+
// checkScroll();
|
329
333
|
// 拖拽列会导致 scrollWidth 变化
|
330
334
|
syncScrollWidth();
|
331
335
|
}
|
336
|
+
checkScroll();
|
332
337
|
}, [colgroup]);
|
333
338
|
return {
|
334
339
|
isScrollX: !!isScrollX,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-table-virtual.d.ts","sourceRoot":"","sources":["use-table-virtual.tsx"],"names":[],"mappings":";
|
1
|
+
{"version":3,"file":"use-table-virtual.d.ts","sourceRoot":"","sources":["use-table-virtual.tsx"],"names":[],"mappings":";AAGA,UAAU,oBAAoB;IAC5B,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC3C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AACD,QAAA,MAAM,eAAe,UAAW,oBAAoB;;;;;;;oBA+GpC,MAAM;mBACP,MAAM;WACd,MAAM;gBACD,MAAM;kBACJ,OAAO;;0BAtEuB,MAAM,UAAU,MAAM;0BAxBtB,MAAM,QAAQ,MAAM;2BAkInB,MAAM;CAmElD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
@@ -8,7 +8,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
8
8
|
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; }
|
9
9
|
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; } }
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
11
|
-
import { usePrevious } from "../.../../../common/use-previous";
|
12
11
|
import { usePersistFn } from "../../common/use-persist-fn";
|
13
12
|
import { useState, useRef, useEffect } from 'react';
|
14
13
|
var useTableVirtual = function useTableVirtual(props) {
|
@@ -28,7 +27,6 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
28
27
|
_useState8 = _slicedToArray(_useState7, 2),
|
29
28
|
startIndex = _useState8[0],
|
30
29
|
setStartIndex = _useState8[1];
|
31
|
-
var preIndex = usePrevious(startIndex);
|
32
30
|
var _useState9 = useState(0),
|
33
31
|
_useState10 = _slicedToArray(_useState9, 2),
|
34
32
|
offsetY = _useState10[0],
|
@@ -41,7 +39,8 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
41
39
|
rateTimer: null,
|
42
40
|
topTimer: null,
|
43
41
|
controlScrollRate: null,
|
44
|
-
heightCallback: null
|
42
|
+
heightCallback: null,
|
43
|
+
preIndex: null
|
45
44
|
}),
|
46
45
|
context = _useRef.current;
|
47
46
|
var getTranslate = usePersistFn(function (left, top) {
|
@@ -74,6 +73,8 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
74
73
|
if (context.shouldUpdateHeight) {
|
75
74
|
setHeight(getContentHeight(props.data.length - 1));
|
76
75
|
}
|
76
|
+
var preIndex = context.preIndex;
|
77
|
+
// 解决: 从下往上滚 由于高度变化会导致滚动条跳动
|
77
78
|
if (preIndex && preIndex > startIndex && startIndex === index) {
|
78
79
|
// 发生在顶部
|
79
80
|
if (context.heightCallback) return;
|
@@ -178,6 +179,16 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
178
179
|
props.scrollRef.current.scrollTop = beforeHeight;
|
179
180
|
}
|
180
181
|
});
|
182
|
+
useEffect(function () {
|
183
|
+
// 记录preIndex
|
184
|
+
context.preIndex = startIndex;
|
185
|
+
}, [startIndex]);
|
186
|
+
useEffect(function () {
|
187
|
+
// 数据变化的时候清空掉 preIndex, 如果之前有缓存的index, setRowHeight 会有问题
|
188
|
+
return function () {
|
189
|
+
context.preIndex = null;
|
190
|
+
};
|
191
|
+
}, [props.data]);
|
181
192
|
useEffect(function () {
|
182
193
|
if (props.disabled) return;
|
183
194
|
if (offsetY) {
|
@@ -239,8 +239,8 @@ export interface TableColumnItem<DataItem> {
|
|
239
239
|
*/
|
240
240
|
style?: React.CSSProperties;
|
241
241
|
/**
|
242
|
-
* @cn
|
243
|
-
* @en Click event of column
|
242
|
+
* @cn 可展开元素点击事件仅当(仅该列为行展开列,并且传入 expandKeys 的时候生效)
|
243
|
+
* @en Click event of expandable element only when (only this column is row-expand column and expandKeys is passed in)
|
244
244
|
*/
|
245
245
|
onClick?: (d: DataItem, isExpand: boolean) => void;
|
246
246
|
/**
|
package/esm/utils/is.d.ts
CHANGED
@@ -23,5 +23,6 @@ export declare const isEmpty: (val: unknown) => boolean;
|
|
23
23
|
export declare const isLink: (el: unknown) => el is React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
24
24
|
export declare const isMacOS: () => boolean;
|
25
25
|
export declare const isFirefox: () => boolean;
|
26
|
+
export declare const isChromeLowerThan: (version: number) => boolean;
|
26
27
|
export declare function isDomElement(element: any): element is HTMLElement;
|
27
28
|
//# sourceMappingURL=is.d.ts.map
|
package/esm/utils/is.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"is.d.ts","sourceRoot":"","sources":["is.ts"],"names":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AS,OAAO,KAAG,OActC,CAAC;AAEF,eAAO,MAAM,MAAM,OAAQ,OAAO,6EASjC,CAAC;AAEF,eAAO,MAAM,OAAO,QAAO,OACqC,CAAC;AAEjE,eAAO,MAAM,SAAS,QAAO,OAG5B,CAAC;AAEF,eAAO,MAAM,iBAAiB,YAAY,MAAM,KAAE,OASjD,CAAA;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,IAAI,WAAW,CAQjE"}
|
package/esm/utils/is.js
CHANGED
@@ -92,6 +92,15 @@ export var isFirefox = function isFirefox() {
|
|
92
92
|
if (!isBrowser()) return false;
|
93
93
|
return navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
94
94
|
};
|
95
|
+
export var isChromeLowerThan = function isChromeLowerThan(version) {
|
96
|
+
// 服务器端渲染时,不执行版本检查
|
97
|
+
if (typeof window === 'undefined' || typeof navigator === 'undefined') {
|
98
|
+
return false;
|
99
|
+
}
|
100
|
+
var ua = navigator.userAgent;
|
101
|
+
var chrome = ua.match(/chrome\/(\d+)/i);
|
102
|
+
return Boolean(chrome && chrome[1] && parseInt(chrome[1], 10) < version);
|
103
|
+
};
|
95
104
|
export function isDomElement(element) {
|
96
105
|
return (typeof HTMLElement === "undefined" ? "undefined" : _typeof(HTMLElement)) === 'object' ? element instanceof HTMLElement // DOM2
|
97
106
|
: element && _typeof(element) === 'object' && element !== null && element.nodeType === 1 && typeof element.nodeName === 'string';
|