@sheinx/base 3.4.5-beta.2 → 3.4.5-beta.4
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/card-group/item.d.ts.map +1 -1
- package/cjs/card-group/item.js +33 -7
- package/cjs/card-group/item.type.d.ts +5 -0
- package/cjs/card-group/item.type.d.ts.map +1 -1
- package/cjs/link/link.type.d.ts +10 -0
- package/cjs/link/link.type.d.ts.map +1 -1
- package/esm/card-group/item.d.ts.map +1 -1
- package/esm/card-group/item.js +33 -7
- package/esm/card-group/item.type.d.ts +5 -0
- package/esm/card-group/item.type.d.ts.map +1 -1
- package/esm/link/link.type.d.ts +10 -0
- package/esm/link/link.type.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["item.tsx"],"names":[],"mappings":";AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,QAAA,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["item.tsx"],"names":[],"mappings":";AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,QAAA,MAAM,IAAI,kDAkET,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/cjs/card-group/item.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -14,20 +15,34 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
14
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
18
18
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
19
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
20
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
22
22
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
23
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
24
|
+
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."); }
|
|
25
|
+
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); }
|
|
26
|
+
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; }
|
|
27
|
+
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; } }
|
|
28
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
29
|
var Item = function Item(props) {
|
|
24
30
|
var _props$jssStyle, _props$jssStyle$cardG;
|
|
25
31
|
var _useContext = (0, _react.useContext)(_cardGroupContext.CardGroupContext),
|
|
26
32
|
container = _useContext.container;
|
|
27
33
|
var classes = (_props$jssStyle = props.jssStyle) === null || _props$jssStyle === void 0 || (_props$jssStyle$cardG = _props$jssStyle.cardGroup) === null || _props$jssStyle$cardG === void 0 ? void 0 : _props$jssStyle$cardG.call(_props$jssStyle);
|
|
28
|
-
var _useInView = (0, _hooks.useInView)(
|
|
34
|
+
var _useInView = (0, _hooks.useInView)({
|
|
35
|
+
root: container,
|
|
36
|
+
rootMargin: "".concat(props.lazyLoadOffset || (container === null || container === void 0 ? void 0 : container.clientHeight) || 100, "px")
|
|
37
|
+
}),
|
|
29
38
|
itemRef = _useInView.ref,
|
|
30
|
-
|
|
39
|
+
itemIsInView = _useInView.isInView,
|
|
40
|
+
wasInView = _useInView.wasInView;
|
|
41
|
+
var isInView = props.placeholder ? itemIsInView : true;
|
|
42
|
+
var _useState = (0, _react.useState)(0),
|
|
43
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
+
itemHeight = _useState2[0],
|
|
45
|
+
setItemHeight = _useState2[1];
|
|
31
46
|
var handleChange = (0, _hooks.usePersistFn)(function (_, checked) {
|
|
32
47
|
if (props.onChange) props.onChange(checked, props.value);
|
|
33
48
|
});
|
|
@@ -52,11 +67,22 @@ var Item = function Item(props) {
|
|
|
52
67
|
className: classes === null || classes === void 0 ? void 0 : classes.checkbox
|
|
53
68
|
})]
|
|
54
69
|
});
|
|
55
|
-
|
|
56
|
-
|
|
70
|
+
(0, _react.useLayoutEffect)(function () {
|
|
71
|
+
if (isInView) {
|
|
72
|
+
var _itemRef$current;
|
|
73
|
+
setItemHeight(((_itemRef$current = itemRef.current) === null || _itemRef$current === void 0 ? void 0 : _itemRef$current.offsetHeight) || 0);
|
|
74
|
+
}
|
|
75
|
+
}, [isInView]);
|
|
76
|
+
var hiddenStyle = (0, _react.useMemo)(function () {
|
|
77
|
+
return !isInView && wasInView && itemHeight ? {
|
|
78
|
+
height: itemHeight,
|
|
79
|
+
overflow: 'hidden',
|
|
57
80
|
visibility: isInView ? 'visible' : 'hidden'
|
|
58
|
-
}
|
|
59
|
-
}, [isInView,
|
|
81
|
+
} : undefined;
|
|
82
|
+
}, [isInView, itemHeight]);
|
|
83
|
+
var itemStyle = (0, _react.useMemo)(function () {
|
|
84
|
+
return hiddenStyle ? _objectSpread(_objectSpread({}, props.style), hiddenStyle) : props.style;
|
|
85
|
+
}, [hiddenStyle, props.style]);
|
|
60
86
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
61
87
|
ref: itemRef,
|
|
62
88
|
className: cls,
|
|
@@ -9,6 +9,11 @@ export interface CardGroupItemProps<Value> extends Pick<CommonType, 'className'
|
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
11
|
placeholder?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* @en lazy load offset
|
|
14
|
+
* @cn 懒加载偏移量,距离视口的距离即可视为进入视口中
|
|
15
|
+
*/
|
|
16
|
+
lazyLoadOffset?: number;
|
|
12
17
|
/**
|
|
13
18
|
* @en checked status, hide while not set
|
|
14
19
|
* @cn checked 表示选中状态,不设置则不显示选择框
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.type.d.ts","sourceRoot":"","sources":["item.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,MAAM,WAAW,kBAAkB,CAAC,KAAK,CAAE,SAAQ,IAAI,CAAC,UAAU,EAAE,WAAW,GAAG,OAAO,CAAC;IACxF,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B;;;;OAIG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE9B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEpD;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB"}
|
|
1
|
+
{"version":3,"file":"item.type.d.ts","sourceRoot":"","sources":["item.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,MAAM,WAAW,kBAAkB,CAAC,KAAK,CAAE,SAAQ,IAAI,CAAC,UAAU,EAAE,WAAW,GAAG,OAAO,CAAC;IACxF,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B;;;;OAIG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE9B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEpD;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB"}
|
package/cjs/link/link.type.d.ts
CHANGED
|
@@ -19,6 +19,16 @@ export interface LinkProps extends Pick<CommonType, 'className' | 'style'>, Reac
|
|
|
19
19
|
jssStyle?: {
|
|
20
20
|
link?: () => LinkClasses;
|
|
21
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* @cn 链接地址
|
|
24
|
+
* @en Link address
|
|
25
|
+
*/
|
|
26
|
+
href?: string;
|
|
27
|
+
/**
|
|
28
|
+
* @cn 链接打开方式
|
|
29
|
+
* @en Link target
|
|
30
|
+
*/
|
|
31
|
+
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
22
32
|
/**
|
|
23
33
|
* @cn 是否禁用
|
|
24
34
|
* @en Whether the link is disabled
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.type.d.ts","sourceRoot":"","sources":["link.type.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C,MAAM,MAAM,QAAQ,GAAI,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAA;AAElF,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IAEvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAElB,QAAQ,EAAE,MAAM,CAAC;IAEjB,IAAI,EAAE,MAAM,CAAC;IAEb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SACf,SAAQ,IAAI,CAAC,UAAU,EAAE,WAAW,GAAG,OAAO,CAAC,EAC/C,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IAC3C,QAAQ,CAAC,EAAE;QACP,IAAI,CAAC,EAAE,MAAM,WAAW,CAAC;KAC5B,CAAC;IAEF;;;OAGG;IACH,QAAQ,CAA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G,MAAM,CAAC;IAEjD;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAE9B;;;;OAIG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAA;IAEf;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;IAErC;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC;CACpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["item.tsx"],"names":[],"mappings":";AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,QAAA,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["item.tsx"],"names":[],"mappings":";AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,QAAA,MAAM,IAAI,kDAkET,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/esm/card-group/item.js
CHANGED
|
@@ -4,7 +4,13 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
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; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import React, { useContext, useLayoutEffect, useMemo, useState } from 'react';
|
|
8
14
|
import { useInView, usePersistFn } from '@sheinx/hooks';
|
|
9
15
|
import classNames from 'classnames';
|
|
10
16
|
import { CardGroupContext } from "./card-group-context";
|
|
@@ -18,9 +24,18 @@ var Item = function Item(props) {
|
|
|
18
24
|
var _useContext = useContext(CardGroupContext),
|
|
19
25
|
container = _useContext.container;
|
|
20
26
|
var classes = (_props$jssStyle = props.jssStyle) === null || _props$jssStyle === void 0 || (_props$jssStyle$cardG = _props$jssStyle.cardGroup) === null || _props$jssStyle$cardG === void 0 ? void 0 : _props$jssStyle$cardG.call(_props$jssStyle);
|
|
21
|
-
var _useInView = useInView(
|
|
27
|
+
var _useInView = useInView({
|
|
28
|
+
root: container,
|
|
29
|
+
rootMargin: "".concat(props.lazyLoadOffset || (container === null || container === void 0 ? void 0 : container.clientHeight) || 100, "px")
|
|
30
|
+
}),
|
|
22
31
|
itemRef = _useInView.ref,
|
|
23
|
-
|
|
32
|
+
itemIsInView = _useInView.isInView,
|
|
33
|
+
wasInView = _useInView.wasInView;
|
|
34
|
+
var isInView = props.placeholder ? itemIsInView : true;
|
|
35
|
+
var _useState = useState(0),
|
|
36
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
37
|
+
itemHeight = _useState2[0],
|
|
38
|
+
setItemHeight = _useState2[1];
|
|
24
39
|
var handleChange = usePersistFn(function (_, checked) {
|
|
25
40
|
if (props.onChange) props.onChange(checked, props.value);
|
|
26
41
|
});
|
|
@@ -45,11 +60,22 @@ var Item = function Item(props) {
|
|
|
45
60
|
className: classes === null || classes === void 0 ? void 0 : classes.checkbox
|
|
46
61
|
})]
|
|
47
62
|
});
|
|
48
|
-
|
|
49
|
-
|
|
63
|
+
useLayoutEffect(function () {
|
|
64
|
+
if (isInView) {
|
|
65
|
+
var _itemRef$current;
|
|
66
|
+
setItemHeight(((_itemRef$current = itemRef.current) === null || _itemRef$current === void 0 ? void 0 : _itemRef$current.offsetHeight) || 0);
|
|
67
|
+
}
|
|
68
|
+
}, [isInView]);
|
|
69
|
+
var hiddenStyle = useMemo(function () {
|
|
70
|
+
return !isInView && wasInView && itemHeight ? {
|
|
71
|
+
height: itemHeight,
|
|
72
|
+
overflow: 'hidden',
|
|
50
73
|
visibility: isInView ? 'visible' : 'hidden'
|
|
51
|
-
}
|
|
52
|
-
}, [isInView,
|
|
74
|
+
} : undefined;
|
|
75
|
+
}, [isInView, itemHeight]);
|
|
76
|
+
var itemStyle = useMemo(function () {
|
|
77
|
+
return hiddenStyle ? _objectSpread(_objectSpread({}, props.style), hiddenStyle) : props.style;
|
|
78
|
+
}, [hiddenStyle, props.style]);
|
|
53
79
|
return /*#__PURE__*/_jsx("div", {
|
|
54
80
|
ref: itemRef,
|
|
55
81
|
className: cls,
|
|
@@ -9,6 +9,11 @@ export interface CardGroupItemProps<Value> extends Pick<CommonType, 'className'
|
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
11
|
placeholder?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* @en lazy load offset
|
|
14
|
+
* @cn 懒加载偏移量,距离视口的距离即可视为进入视口中
|
|
15
|
+
*/
|
|
16
|
+
lazyLoadOffset?: number;
|
|
12
17
|
/**
|
|
13
18
|
* @en checked status, hide while not set
|
|
14
19
|
* @cn checked 表示选中状态,不设置则不显示选择框
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.type.d.ts","sourceRoot":"","sources":["item.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,MAAM,WAAW,kBAAkB,CAAC,KAAK,CAAE,SAAQ,IAAI,CAAC,UAAU,EAAE,WAAW,GAAG,OAAO,CAAC;IACxF,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B;;;;OAIG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE9B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEpD;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB"}
|
|
1
|
+
{"version":3,"file":"item.type.d.ts","sourceRoot":"","sources":["item.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,MAAM,WAAW,kBAAkB,CAAC,KAAK,CAAE,SAAQ,IAAI,CAAC,UAAU,EAAE,WAAW,GAAG,OAAO,CAAC;IACxF,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B;;;;OAIG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE9B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEpD;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB"}
|
package/esm/link/link.type.d.ts
CHANGED
|
@@ -19,6 +19,16 @@ export interface LinkProps extends Pick<CommonType, 'className' | 'style'>, Reac
|
|
|
19
19
|
jssStyle?: {
|
|
20
20
|
link?: () => LinkClasses;
|
|
21
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* @cn 链接地址
|
|
24
|
+
* @en Link address
|
|
25
|
+
*/
|
|
26
|
+
href?: string;
|
|
27
|
+
/**
|
|
28
|
+
* @cn 链接打开方式
|
|
29
|
+
* @en Link target
|
|
30
|
+
*/
|
|
31
|
+
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
22
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AAG,KAAK,CAAC,SAAS,CAAC;CACpC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheinx/base",
|
|
3
|
-
"version": "3.4.5-beta.
|
|
3
|
+
"version": "3.4.5-beta.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"module": "./esm/index.js",
|
|
11
11
|
"typings": "./cjs/index.d.ts",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@sheinx/hooks": "3.4.5-beta.
|
|
13
|
+
"@sheinx/hooks": "3.4.5-beta.4",
|
|
14
14
|
"immer": "^10.0.0",
|
|
15
15
|
"classnames": "^2.0.0",
|
|
16
16
|
"@shined/reactive": "^0.1.3-alpha.0"
|