@lobehub/ui 1.120.4 → 1.120.6
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.
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ImageProps } from 'antd';
|
|
2
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
|
3
3
|
export interface ImageGalleryProps extends PropsWithChildren {
|
|
4
4
|
enable?: boolean;
|
|
5
5
|
items?: string[];
|
|
6
|
-
preview?: ImageProps['preview']
|
|
6
|
+
preview?: ImageProps['preview'] & {
|
|
7
|
+
toolbarAddon?: ReactNode;
|
|
8
|
+
} & any;
|
|
7
9
|
}
|
|
8
10
|
declare const ImageGallery: import("react").NamedExoticComponent<ImageGalleryProps>;
|
|
9
11
|
export default ImageGallery;
|
package/es/Image/ImageGallery.js
CHANGED
|
@@ -8,8 +8,7 @@ var ImageGallery = /*#__PURE__*/memo(function (_ref) {
|
|
|
8
8
|
children = _ref.children,
|
|
9
9
|
_ref$enable = _ref.enable,
|
|
10
10
|
enable = _ref$enable === void 0 ? true : _ref$enable,
|
|
11
|
-
|
|
12
|
-
preview = _ref$preview === void 0 ? {} : _ref$preview;
|
|
11
|
+
preview = _ref.preview;
|
|
13
12
|
var mergePreivew = usePreview(preview);
|
|
14
13
|
if (!enable) return children;
|
|
15
14
|
return /*#__PURE__*/_jsx(PreviewGroup, {
|
package/es/Image/index.d.ts
CHANGED
|
@@ -6,7 +6,11 @@ export interface ImageProps extends AntImageProps {
|
|
|
6
6
|
isLoading?: boolean;
|
|
7
7
|
minSize?: number | string;
|
|
8
8
|
objectFit?: 'cover' | 'contain';
|
|
9
|
+
preview?: AntImageProps['preview'] & {
|
|
10
|
+
toolbarAddon?: ReactNode;
|
|
11
|
+
} & any;
|
|
9
12
|
size?: number | string;
|
|
13
|
+
toolbarAddon?: ReactNode;
|
|
10
14
|
}
|
|
11
15
|
declare const Image: import("react").NamedExoticComponent<ImageProps>;
|
|
12
16
|
export default Image;
|
package/es/Image/usePreview.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { ImageProps } from 'antd';
|
|
2
|
-
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export type PreviewOptions = any & {
|
|
4
|
+
toolbarAddon?: ReactNode;
|
|
5
|
+
};
|
|
6
|
+
export declare const usePreview: ({ onVisibleChange, styles: previewStyle, minScale, maxScale, toolbarAddon, ...rest }?: PreviewOptions) => ImageProps['preview'];
|
|
3
7
|
export default usePreview;
|
package/es/Image/usePreview.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["onVisibleChange", "styles"];
|
|
4
|
+
var _excluded = ["onVisibleChange", "styles", "minScale", "maxScale", "toolbarAddon"];
|
|
5
5
|
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; }
|
|
6
6
|
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; }
|
|
7
7
|
import { FlipHorizontal, FlipVertical, RotateCcw, RotateCw, X, ZoomIn, ZoomOut } from 'lucide-react';
|
|
@@ -18,6 +18,11 @@ export var usePreview = function usePreview() {
|
|
|
18
18
|
_onVisibleChange = _ref.onVisibleChange,
|
|
19
19
|
_ref$styles = _ref.styles,
|
|
20
20
|
previewStyle = _ref$styles === void 0 ? {} : _ref$styles,
|
|
21
|
+
_ref$minScale = _ref.minScale,
|
|
22
|
+
minScale = _ref$minScale === void 0 ? 0.32 : _ref$minScale,
|
|
23
|
+
_ref$maxScale = _ref.maxScale,
|
|
24
|
+
maxScale = _ref$maxScale === void 0 ? 32 : _ref$maxScale,
|
|
25
|
+
toolbarAddon = _ref.toolbarAddon,
|
|
21
26
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
22
27
|
var _useState = useState(false),
|
|
23
28
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -39,6 +44,8 @@ export var usePreview = function usePreview() {
|
|
|
39
44
|
children: node
|
|
40
45
|
});
|
|
41
46
|
},
|
|
47
|
+
maxScale: maxScale,
|
|
48
|
+
minScale: minScale,
|
|
42
49
|
onVisibleChange: function onVisibleChange(e) {
|
|
43
50
|
setVisible(e);
|
|
44
51
|
_onVisibleChange === null || _onVisibleChange === void 0 || _onVisibleChange(e);
|
|
@@ -79,15 +86,15 @@ export var usePreview = function usePreview() {
|
|
|
79
86
|
onClick: onRotateRight
|
|
80
87
|
}), /*#__PURE__*/_jsx(ActionIcon, {
|
|
81
88
|
color: '#fff',
|
|
82
|
-
disable: scale ===
|
|
89
|
+
disable: scale === minScale,
|
|
83
90
|
icon: ZoomOut,
|
|
84
91
|
onClick: onZoomOut
|
|
85
92
|
}), /*#__PURE__*/_jsx(ActionIcon, {
|
|
86
93
|
color: '#fff',
|
|
87
|
-
disable: scale ===
|
|
94
|
+
disable: scale === maxScale,
|
|
88
95
|
icon: ZoomIn,
|
|
89
96
|
onClick: onZoomIn
|
|
90
|
-
})]
|
|
97
|
+
}), toolbarAddon]
|
|
91
98
|
});
|
|
92
99
|
}
|
|
93
100
|
}, rest);
|
|
@@ -13,7 +13,7 @@ import { CHILDREN_CLASSNAME, useStyles } from "./style";
|
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
var SpotlightCard = /*#__PURE__*/memo(function (_ref) {
|
|
15
15
|
var items = _ref.items,
|
|
16
|
-
|
|
16
|
+
Content = _ref.renderItem,
|
|
17
17
|
className = _ref.className,
|
|
18
18
|
_ref$columns = _ref.columns,
|
|
19
19
|
columns = _ref$columns === void 0 ? 3 : _ref$columns,
|
|
@@ -75,12 +75,11 @@ var SpotlightCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
75
75
|
}, style)
|
|
76
76
|
}, rest), {}, {
|
|
77
77
|
children: items.map(function (item, index) {
|
|
78
|
-
var children = renderItem(item);
|
|
79
78
|
return /*#__PURE__*/_jsx(SpotlightCardItem, {
|
|
80
79
|
borderRadius: borderRadius,
|
|
81
80
|
className: CHILDREN_CLASSNAME,
|
|
82
81
|
size: size,
|
|
83
|
-
children:
|
|
82
|
+
children: /*#__PURE__*/_jsx(Content, _objectSpread({}, item))
|
|
84
83
|
}, index);
|
|
85
84
|
})
|
|
86
85
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/ui",
|
|
3
|
-
"version": "1.120.
|
|
3
|
+
"version": "1.120.6",
|
|
4
4
|
"description": "Lobe UI is an open-source UI component library for building AIGC web apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lobehub",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"@types/lodash-es": "^4",
|
|
123
123
|
"@types/pangu": "^4",
|
|
124
124
|
"@types/query-string": "^6",
|
|
125
|
-
"@types/react": "
|
|
125
|
+
"@types/react": "18.2.40",
|
|
126
126
|
"@types/react-dom": "^18",
|
|
127
127
|
"@types/uuid": "^9",
|
|
128
128
|
"@vitest/coverage-v8": "latest",
|