@sheinx/hooks 3.8.0-beta.8 → 3.8.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/common/use-position-style/check-border.d.ts +1 -0
- package/cjs/common/use-position-style/check-border.d.ts.map +1 -1
- package/cjs/common/use-position-style/check-border.js +2 -2
- package/cjs/common/use-position-style/index.d.ts.map +1 -1
- package/cjs/common/use-position-style/index.js +9 -6
- package/cjs/components/use-form/use-form-context.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-context.js +11 -5
- package/esm/common/use-position-style/check-border.d.ts +1 -0
- package/esm/common/use-position-style/check-border.d.ts.map +1 -1
- package/esm/common/use-position-style/check-border.js +2 -2
- package/esm/common/use-position-style/index.d.ts.map +1 -1
- package/esm/common/use-position-style/index.js +9 -6
- package/esm/components/use-form/use-form-context.d.ts.map +1 -1
- package/esm/components/use-form/use-form-context.js +11 -5
- package/package.json +1 -1
@@ -1,5 +1,6 @@
|
|
1
1
|
interface UseCheckElementBorderWidthOptions {
|
2
2
|
direction?: 'horizontal' | 'vertical';
|
3
|
+
enable?: boolean;
|
3
4
|
}
|
4
5
|
export declare const useCheckElementBorderWidth: (elementRef: React.RefObject<HTMLElement>, options?: UseCheckElementBorderWidthOptions) => number;
|
5
6
|
export {};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"check-border.d.ts","sourceRoot":"","sources":["check-border.ts"],"names":[],"mappings":"AAEA,UAAU,iCAAiC;IAGzC,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;
|
1
|
+
{"version":3,"file":"check-border.d.ts","sourceRoot":"","sources":["check-border.ts"],"names":[],"mappings":"AAEA,UAAU,iCAAiC;IAGzC,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAGD,eAAO,MAAM,0BAA0B,eACzB,MAAM,SAAS,CAAC,WAAW,CAAC,YAC/B,iCAAiC,KACzC,MAqBF,CAAC"}
|
@@ -20,14 +20,14 @@ var useCheckElementBorderWidth = exports.useCheckElementBorderWidth = function u
|
|
20
20
|
|
21
21
|
// 获取指定方向上的border宽度之和
|
22
22
|
var getBorderWidth = (0, _react.useCallback)(function () {
|
23
|
-
if (elementRef.current) {
|
23
|
+
if (elementRef.current && options.enable) {
|
24
24
|
var _options$direction = options.direction,
|
25
25
|
direction = _options$direction === void 0 ? 'horizontal' : _options$direction;
|
26
26
|
var style = window.getComputedStyle(elementRef.current);
|
27
27
|
var _borderWidth = direction === 'horizontal' ? parseFloat(style.borderLeftWidth) + parseFloat(style.borderRightWidth) : parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
|
28
28
|
setBorderWidth(_borderWidth);
|
29
29
|
}
|
30
|
-
}, [elementRef]);
|
30
|
+
}, [elementRef, options.enable]);
|
31
31
|
(0, _react.useEffect)(function () {
|
32
32
|
getBorderWidth();
|
33
33
|
}, [getBorderWidth]);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAUpE,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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AAM,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;IACjB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3B;AAsBD,eAAO,MAAM,gBAAgB,WAAY,mBAAmB;;CA8S3D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
@@ -88,7 +88,8 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
|
|
88
88
|
enable: show && adjust
|
89
89
|
});
|
90
90
|
var parentElBorderWidth = (0, _checkBorder.useCheckElementBorderWidth)(parentElRef, {
|
91
|
-
direction: 'horizontal'
|
91
|
+
direction: 'horizontal',
|
92
|
+
enable: show
|
92
93
|
});
|
93
94
|
var popupElSize = (0, _checkElementSize.useCheckElementSize)(popupElRef, {
|
94
95
|
enable: show
|
@@ -267,16 +268,18 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
|
|
267
268
|
};
|
268
269
|
};
|
269
270
|
var getAbsoluteStyle = function getAbsoluteStyle(position) {
|
270
|
-
var _scrollElRef$current;
|
271
|
+
var _scrollElRef$current, _scrollElRef$current2, _scrollElRef$current3;
|
271
272
|
if (!parentElRef.current) return {
|
272
273
|
style: hideStyle
|
273
274
|
};
|
274
275
|
var rect = context.parentRect;
|
275
276
|
var needCheck = !show || !(0, _shallowEqual.default)(context.prevParentPosition, parentElNewPosition);
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
277
|
+
var scrollTop = (scrollElRef === null || scrollElRef === void 0 || (_scrollElRef$current = scrollElRef.current) === null || _scrollElRef$current === void 0 ? void 0 : _scrollElRef$current.scrollTop) || 0;
|
278
|
+
var scrollLeft = (scrollElRef === null || scrollElRef === void 0 || (_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.scrollLeft) || 0;
|
279
|
+
if (needCheck && scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current3 = scrollElRef.current) !== null && _scrollElRef$current3 !== void 0 && _scrollElRef$current3.contains(parentElRef.current)) {
|
280
|
+
var _scrollElRef$current4;
|
281
|
+
var visibleRect = ((_scrollElRef$current4 = scrollElRef.current) === null || _scrollElRef$current4 === void 0 ? void 0 : _scrollElRef$current4.getBoundingClientRect()) || {};
|
282
|
+
if (rect.bottom < visibleRect.top || rect.top > visibleRect.bottom + scrollTop || rect.right < visibleRect.left || rect.left > visibleRect.right + scrollLeft) {
|
280
283
|
return {
|
281
284
|
style: hideStyle
|
282
285
|
};
|
@@ -1 +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,
|
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,CAG7E;AAED,wBAAgB,eAAe,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAG/C"}
|
@@ -8,13 +8,19 @@ exports.useFormInstance = useFormInstance;
|
|
8
8
|
exports.useFormRef = useFormRef;
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
12
|
+
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."); }
|
13
|
+
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); }
|
14
|
+
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; }
|
15
|
+
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; } }
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
11
17
|
var FormContext = exports.FormContext = /*#__PURE__*/_react.default.createContext({});
|
12
18
|
function useFormRef() {
|
13
|
-
var
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
return [
|
19
|
+
var _React$useState = _react.default.useState({}),
|
20
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
21
|
+
formRef = _React$useState2[0],
|
22
|
+
setFormRef = _React$useState2[1];
|
23
|
+
return [formRef, setFormRef];
|
18
24
|
}
|
19
25
|
function useFormInstance() {
|
20
26
|
var formCtx = _react.default.useContext(FormContext);
|
@@ -1,5 +1,6 @@
|
|
1
1
|
interface UseCheckElementBorderWidthOptions {
|
2
2
|
direction?: 'horizontal' | 'vertical';
|
3
|
+
enable?: boolean;
|
3
4
|
}
|
4
5
|
export declare const useCheckElementBorderWidth: (elementRef: React.RefObject<HTMLElement>, options?: UseCheckElementBorderWidthOptions) => number;
|
5
6
|
export {};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"check-border.d.ts","sourceRoot":"","sources":["check-border.ts"],"names":[],"mappings":"AAEA,UAAU,iCAAiC;IAGzC,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;
|
1
|
+
{"version":3,"file":"check-border.d.ts","sourceRoot":"","sources":["check-border.ts"],"names":[],"mappings":"AAEA,UAAU,iCAAiC;IAGzC,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAGD,eAAO,MAAM,0BAA0B,eACzB,MAAM,SAAS,CAAC,WAAW,CAAC,YAC/B,iCAAiC,KACzC,MAqBF,CAAC"}
|
@@ -14,14 +14,14 @@ export var useCheckElementBorderWidth = function useCheckElementBorderWidth(elem
|
|
14
14
|
|
15
15
|
// 获取指定方向上的border宽度之和
|
16
16
|
var getBorderWidth = useCallback(function () {
|
17
|
-
if (elementRef.current) {
|
17
|
+
if (elementRef.current && options.enable) {
|
18
18
|
var _options$direction = options.direction,
|
19
19
|
direction = _options$direction === void 0 ? 'horizontal' : _options$direction;
|
20
20
|
var style = window.getComputedStyle(elementRef.current);
|
21
21
|
var _borderWidth = direction === 'horizontal' ? parseFloat(style.borderLeftWidth) + parseFloat(style.borderRightWidth) : parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
|
22
22
|
setBorderWidth(_borderWidth);
|
23
23
|
}
|
24
|
-
}, [elementRef]);
|
24
|
+
}, [elementRef, options.enable]);
|
25
25
|
useEffect(function () {
|
26
26
|
getBorderWidth();
|
27
27
|
}, [getBorderWidth]);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAUpE,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;IAC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7 +79,8 @@ export var usePositionStyle = function usePositionStyle(config) {
|
|
79
79
|
enable: show && adjust
|
80
80
|
});
|
81
81
|
var parentElBorderWidth = useCheckElementBorderWidth(parentElRef, {
|
82
|
-
direction: 'horizontal'
|
82
|
+
direction: 'horizontal',
|
83
|
+
enable: show
|
83
84
|
});
|
84
85
|
var popupElSize = useCheckElementSize(popupElRef, {
|
85
86
|
enable: show
|
@@ -258,16 +259,18 @@ export var usePositionStyle = function usePositionStyle(config) {
|
|
258
259
|
};
|
259
260
|
};
|
260
261
|
var getAbsoluteStyle = function getAbsoluteStyle(position) {
|
261
|
-
var _scrollElRef$current;
|
262
|
+
var _scrollElRef$current, _scrollElRef$current2, _scrollElRef$current3;
|
262
263
|
if (!parentElRef.current) return {
|
263
264
|
style: hideStyle
|
264
265
|
};
|
265
266
|
var rect = context.parentRect;
|
266
267
|
var needCheck = !show || !shallowEqual(context.prevParentPosition, parentElNewPosition);
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
268
|
+
var scrollTop = (scrollElRef === null || scrollElRef === void 0 || (_scrollElRef$current = scrollElRef.current) === null || _scrollElRef$current === void 0 ? void 0 : _scrollElRef$current.scrollTop) || 0;
|
269
|
+
var scrollLeft = (scrollElRef === null || scrollElRef === void 0 || (_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.scrollLeft) || 0;
|
270
|
+
if (needCheck && scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current3 = scrollElRef.current) !== null && _scrollElRef$current3 !== void 0 && _scrollElRef$current3.contains(parentElRef.current)) {
|
271
|
+
var _scrollElRef$current4;
|
272
|
+
var visibleRect = ((_scrollElRef$current4 = scrollElRef.current) === null || _scrollElRef$current4 === void 0 ? void 0 : _scrollElRef$current4.getBoundingClientRect()) || {};
|
273
|
+
if (rect.bottom < visibleRect.top || rect.top > visibleRect.bottom + scrollTop || rect.right < visibleRect.left || rect.left > visibleRect.right + scrollLeft) {
|
271
274
|
return {
|
272
275
|
style: hideStyle
|
273
276
|
};
|
@@ -1 +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,
|
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,CAG7E;AAED,wBAAgB,eAAe,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAG/C"}
|
@@ -1,11 +1,17 @@
|
|
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; }
|
1
7
|
import React from 'react';
|
2
8
|
export var FormContext = /*#__PURE__*/React.createContext({});
|
3
9
|
export function useFormRef() {
|
4
|
-
var
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
return [
|
10
|
+
var _React$useState = React.useState({}),
|
11
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
12
|
+
formRef = _React$useState2[0],
|
13
|
+
setFormRef = _React$useState2[1];
|
14
|
+
return [formRef, setFormRef];
|
9
15
|
}
|
10
16
|
export function useFormInstance() {
|
11
17
|
var formCtx = React.useContext(FormContext);
|