Update from Vibe Studio

This commit is contained in:
Vibe Studio
2026-01-09 14:52:46 +00:00
parent 42a0efe70b
commit 47fa6d98b2
28661 changed files with 2421771 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
/**
* 默认的应用列表的图标
*
*/
export declare const AppsLogo: () => import("react/jsx-runtime").JSX.Element;

View File

@@ -0,0 +1,17 @@
import { jsx as _jsx } from "react/jsx-runtime";
/**
* 默认的应用列表的图标
*
*/
export var AppsLogo = function AppsLogo() {
return /*#__PURE__*/_jsx("svg", {
width: "1em",
height: "1em",
viewBox: "0 0 12 12",
fill: "currentColor",
"aria-hidden": "true",
children: /*#__PURE__*/_jsx("path", {
d: "M0 0h3v3H0V0zm4.5 0h3v3h-3V0zM9 0h3v3H9V0zM0 4.5h3v3H0v-3zm4.503 0h3v3h-3v-3zM9 4.5h3v3H9v-3zM0 9h3v3H0V9zm4.503 0h3v3h-3V9zM9 9h3v3H9V9z"
})
});
};

View File

@@ -0,0 +1,8 @@
import React from 'react';
import type { AppItemProps, AppListProps } from './types';
export declare const DefaultContent: React.FC<{
appList?: AppListProps;
itemClick?: (item: AppItemProps) => void;
baseClassName: string;
hashId?: string;
}>;

View File

@@ -0,0 +1,52 @@
import React from 'react';
import { defaultRenderLogo } from "./index";
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
export var DefaultContent = function DefaultContent(props) {
var appList = props.appList,
baseClassName = props.baseClassName,
hashId = props.hashId,
itemClick = props.itemClick;
return /*#__PURE__*/_jsx("div", {
className: "".concat(baseClassName, "-content ").concat(hashId).trim(),
children: /*#__PURE__*/_jsx("ul", {
className: "".concat(baseClassName, "-content-list ").concat(hashId).trim(),
children: appList === null || appList === void 0 ? void 0 : appList.map(function (app, index) {
var _app$children;
if (app !== null && app !== void 0 && (_app$children = app.children) !== null && _app$children !== void 0 && _app$children.length) {
return /*#__PURE__*/_jsxs("div", {
className: "".concat(baseClassName, "-content-list-item-group ").concat(hashId).trim(),
children: [/*#__PURE__*/_jsx("div", {
className: "".concat(baseClassName, "-content-list-item-group-title ").concat(hashId).trim(),
children: app.title
}), /*#__PURE__*/_jsx(DefaultContent, {
hashId: hashId,
itemClick: itemClick,
appList: app === null || app === void 0 ? void 0 : app.children,
baseClassName: baseClassName
})]
}, index);
}
return /*#__PURE__*/_jsx("li", {
className: "".concat(baseClassName, "-content-list-item ").concat(hashId).trim(),
onClick: function onClick(e) {
e.stopPropagation();
itemClick === null || itemClick === void 0 || itemClick(app);
},
children: /*#__PURE__*/_jsxs("a", {
href: itemClick ? undefined : app.url,
target: app.target,
rel: "noreferrer",
children: [defaultRenderLogo(app.icon), /*#__PURE__*/_jsxs("div", {
children: [/*#__PURE__*/_jsx("div", {
children: app.title
}), app.desc ? /*#__PURE__*/_jsx("span", {
children: app.desc
}) : null]
})]
})
}, index);
})
})
});
};

View File

@@ -0,0 +1,16 @@
import React from 'react';
import type { AppItemProps, AppListProps } from './types';
/**
* simple 模式渲染logo的方式
*
* @param logo
* @param title
* @returns
*/
export declare const renderLogo: (logo: React.ReactNode | (() => React.ReactNode), title?: React.ReactNode) => React.ReactNode;
export declare const SimpleContent: React.FC<{
appList?: AppListProps;
itemClick?: (item: AppItemProps) => void;
baseClassName: string;
hashId?: string;
}>;

View File

@@ -0,0 +1,82 @@
import { isUrl } from '@ant-design/pro-utils';
import React from 'react';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
/**
* simple 模式渲染logo的方式
*
* @param logo
* @param title
* @returns
*/
export var renderLogo = function renderLogo(logo, title) {
if (logo && typeof logo === 'string' && isUrl(logo)) {
return /*#__PURE__*/_jsx("img", {
src: logo,
alt: "logo"
});
}
if (typeof logo === 'function') {
return logo();
}
if (logo && typeof logo === 'string') {
return /*#__PURE__*/_jsx("div", {
id: "avatarLogo",
children: logo
});
}
if (!logo && title && typeof title === 'string') {
var symbol = title.substring(0, 1);
return /*#__PURE__*/_jsx("div", {
id: "avatarLogo",
children: symbol
});
}
return logo;
};
export var SimpleContent = function SimpleContent(props) {
var appList = props.appList,
baseClassName = props.baseClassName,
hashId = props.hashId,
itemClick = props.itemClick;
return /*#__PURE__*/_jsx("div", {
className: "".concat(baseClassName, "-content ").concat(hashId).trim(),
children: /*#__PURE__*/_jsx("ul", {
className: "".concat(baseClassName, "-content-list ").concat(hashId).trim(),
children: appList === null || appList === void 0 ? void 0 : appList.map(function (app, index) {
var _app$children;
if (app !== null && app !== void 0 && (_app$children = app.children) !== null && _app$children !== void 0 && _app$children.length) {
return /*#__PURE__*/_jsxs("div", {
className: "".concat(baseClassName, "-content-list-item-group ").concat(hashId).trim(),
children: [/*#__PURE__*/_jsx("div", {
className: "".concat(baseClassName, "-content-list-item-group-title ").concat(hashId).trim(),
children: app.title
}), /*#__PURE__*/_jsx(SimpleContent, {
hashId: hashId,
itemClick: itemClick,
appList: app === null || app === void 0 ? void 0 : app.children,
baseClassName: baseClassName
})]
}, index);
}
return /*#__PURE__*/_jsx("li", {
className: "".concat(baseClassName, "-content-list-item ").concat(hashId).trim(),
onClick: function onClick(e) {
e.stopPropagation();
itemClick === null || itemClick === void 0 || itemClick(app);
},
children: /*#__PURE__*/_jsxs("a", {
href: itemClick ? 'javascript:;' : app.url,
target: app.target,
rel: "noreferrer",
children: [renderLogo(app.icon, app.title), /*#__PURE__*/_jsx("div", {
children: /*#__PURE__*/_jsx("div", {
children: app.title
})
})]
})
}, index);
})
})
});
};

View File

@@ -0,0 +1,21 @@
import React from 'react';
import type { AppItemProps, AppListProps } from './types';
/**
* 默认渲染logo的方式如果是个string用img。否则直接返回
*
* @param logo
* @returns
*/
export declare const defaultRenderLogo: (logo: React.ReactNode | (() => React.ReactNode)) => React.ReactNode;
/**
* 相关品牌额icon 列表。用于展示相关的品牌
*
* @param props
* @returns
*/
export declare const AppsLogoComponents: React.FC<{
appList?: AppListProps;
appListRender?: (props: AppListProps, defaultDom: React.ReactNode) => React.ReactNode;
onItemClick?: (item: AppItemProps, popoverRef?: React.RefObject<HTMLSpanElement>) => void;
prefixCls?: string;
}>;

View File

@@ -0,0 +1,114 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import { openVisibleCompatible } from '@ant-design/pro-utils';
import { Popover } from 'antd';
import classNames from 'classnames';
import React, { useMemo, useState } from 'react';
import { AppsLogo } from "./AppsLogo";
import { DefaultContent } from "./DefaultContent";
import { SimpleContent } from "./SimpleContent";
import { useStyle } from "./style/index";
import { jsx as _jsx } from "react/jsx-runtime";
import { Fragment as _Fragment } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
/**
* 默认渲染logo的方式如果是个string用img。否则直接返回
*
* @param logo
* @returns
*/
export var defaultRenderLogo = function defaultRenderLogo(logo) {
if (typeof logo === 'string') {
return /*#__PURE__*/_jsx("img", {
width: "auto",
height: 22,
src: logo,
alt: "logo"
});
}
if (typeof logo === 'function') {
return logo();
}
return logo;
};
/**
* 相关品牌额icon 列表。用于展示相关的品牌
*
* @param props
* @returns
*/
export var AppsLogoComponents = function AppsLogoComponents(props) {
var _props$appList;
var appList = props.appList,
appListRender = props.appListRender,
_props$prefixCls = props.prefixCls,
prefixCls = _props$prefixCls === void 0 ? 'ant-pro' : _props$prefixCls,
itemClick = props.onItemClick;
var ref = React.useRef(null);
var popoverRef = React.useRef(null);
var baseClassName = "".concat(prefixCls, "-layout-apps");
var _useStyle = useStyle(baseClassName),
wrapSSR = _useStyle.wrapSSR,
hashId = _useStyle.hashId;
var _useState = useState(false),
_useState2 = _slicedToArray(_useState, 2),
open = _useState2[0],
setOpen = _useState2[1];
var cloneItemClick = function cloneItemClick(app) {
itemClick === null || itemClick === void 0 || itemClick(app, popoverRef);
};
var defaultDomContent = useMemo(function () {
var isSimple = appList === null || appList === void 0 ? void 0 : appList.some(function (app) {
return !(app !== null && app !== void 0 && app.desc);
});
if (isSimple) {
return /*#__PURE__*/_jsx(SimpleContent, {
hashId: hashId,
appList: appList,
itemClick: itemClick ? cloneItemClick : undefined,
baseClassName: "".concat(baseClassName, "-simple")
});
}
return /*#__PURE__*/_jsx(DefaultContent, {
hashId: hashId,
appList: appList,
itemClick: itemClick ? cloneItemClick : undefined,
baseClassName: "".concat(baseClassName, "-default")
});
}, [appList, baseClassName, hashId]);
if (!(props !== null && props !== void 0 && (_props$appList = props.appList) !== null && _props$appList !== void 0 && _props$appList.length)) return null;
var popoverContent = appListRender ? appListRender(props === null || props === void 0 ? void 0 : props.appList, defaultDomContent) : defaultDomContent;
var popoverOpenProps = openVisibleCompatible(undefined, function (openChange) {
return setOpen(openChange);
});
return wrapSSR( /*#__PURE__*/_jsxs(_Fragment, {
children: [/*#__PURE__*/_jsx("div", {
ref: ref,
onClick: function onClick(e) {
e.stopPropagation();
e.preventDefault();
}
}), /*#__PURE__*/_jsx(Popover, _objectSpread(_objectSpread({
placement: "bottomRight",
trigger: ['click'],
zIndex: 9999,
arrow: false
}, popoverOpenProps), {}, {
overlayClassName: "".concat(baseClassName, "-popover ").concat(hashId).trim(),
content: popoverContent,
getPopupContainer: function getPopupContainer() {
return ref.current || document.body;
},
children: /*#__PURE__*/_jsx("span", {
ref: popoverRef,
onClick: function onClick(e) {
e.stopPropagation();
},
className: classNames("".concat(baseClassName, "-icon"), hashId, _defineProperty({}, "".concat(baseClassName, "-icon-active"), open)),
children: /*#__PURE__*/_jsx(AppsLogo, {})
})
}))]
}));
};

View File

@@ -0,0 +1,4 @@
import type { GenerateStyle } from '@ant-design/pro-provider';
import type { AppsLogoComponentsToken } from './index';
declare const genAppsLogoComponentsDefaultListStyle: GenerateStyle<AppsLogoComponentsToken>;
export { genAppsLogoComponentsDefaultListStyle };

View File

@@ -0,0 +1,72 @@
import { resetComponent } from '@ant-design/pro-utils';
var genAppsLogoComponentsDefaultListStyle = function genAppsLogoComponentsDefaultListStyle(token) {
return {
'&-content': {
maxHeight: 'calc(100vh - 48px)',
overflow: 'auto',
'&-list': {
boxSizing: 'content-box',
maxWidth: 656,
marginBlock: 0,
marginInline: 0,
paddingBlock: 0,
paddingInline: 0,
listStyle: 'none',
'&-item': {
position: 'relative',
display: 'inline-block',
width: 328,
height: 72,
paddingInline: 16,
paddingBlock: 16,
verticalAlign: 'top',
listStyleType: 'none',
transition: 'transform 0.2s cubic-bezier(0.333, 0, 0, 1)',
borderRadius: token.borderRadius,
'&-group': {
marginBottom: 16,
'&-title': {
margin: '16px 0 8px 12px',
fontWeight: 600,
color: 'rgba(0, 0, 0, 0.88)',
fontSize: 16,
opacity: 0.85,
lineHeight: 1.5,
'&:first-child': {
marginTop: 12
}
}
},
'&:hover': {
backgroundColor: token.colorBgTextHover
},
'* div': resetComponent === null || resetComponent === void 0 ? void 0 : resetComponent(token),
a: {
display: 'flex',
height: '100%',
fontSize: 12,
textDecoration: 'none',
'& > img': {
width: 40,
height: 40
},
'& > div': {
marginInlineStart: 14,
color: token.colorTextHeading,
fontSize: 14,
lineHeight: '22px',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis'
},
'& > div > span': {
color: token.colorTextSecondary,
fontSize: 12,
lineHeight: '20px'
}
}
}
}
}
};
};
export { genAppsLogoComponentsDefaultListStyle };

View File

@@ -0,0 +1,9 @@
/// <reference types="react" />
import type { ProAliasToken } from '@ant-design/pro-provider';
export interface AppsLogoComponentsToken extends ProAliasToken {
componentCls: string;
}
export declare function useStyle(prefixCls: string): {
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").JSX.Element;
hashId: string;
};

View File

@@ -0,0 +1,59 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { useStyle as useAntdStyle } from '@ant-design/pro-provider';
import { genAppsLogoComponentsDefaultListStyle } from "./default";
import { genAppsLogoComponentsSimpleListStyle } from "./simple";
var genAppsLogoComponentsStyle = function genAppsLogoComponentsStyle(token) {
var _token$layout, _token$layout2, _token$layout3, _token$layout4, _token$layout5;
return _defineProperty({}, token.componentCls, {
'&-icon': {
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
paddingInline: 4,
paddingBlock: 0,
fontSize: 14,
lineHeight: '14px',
height: 28,
width: 28,
cursor: 'pointer',
color: (_token$layout = token.layout) === null || _token$layout === void 0 ? void 0 : _token$layout.colorTextAppListIcon,
borderRadius: token.borderRadius,
'&:hover': {
color: (_token$layout2 = token.layout) === null || _token$layout2 === void 0 ? void 0 : _token$layout2.colorTextAppListIconHover,
backgroundColor: (_token$layout3 = token.layout) === null || _token$layout3 === void 0 ? void 0 : _token$layout3.colorBgAppListIconHover
},
'&-active': {
color: (_token$layout4 = token.layout) === null || _token$layout4 === void 0 ? void 0 : _token$layout4.colorTextAppListIconHover,
backgroundColor: (_token$layout5 = token.layout) === null || _token$layout5 === void 0 ? void 0 : _token$layout5.colorBgAppListIconHover
}
},
'&-item-title': {
marginInlineStart: '16px',
marginInlineEnd: '8px',
marginBlockStart: 0,
marginBlockEnd: '12px',
fontWeight: 600,
color: 'rgba(0, 0, 0, 0.88)',
fontSize: 16,
opacity: 0.85,
lineHeight: 1.5,
'&:first-child': {
marginBlockStart: 12
}
},
'&-popover': _defineProperty({}, "".concat(token.antCls, "-popover-arrow"), {
display: 'none'
}),
'&-simple': genAppsLogoComponentsSimpleListStyle(token),
'&-default': genAppsLogoComponentsDefaultListStyle(token)
});
};
export function useStyle(prefixCls) {
return useAntdStyle('AppsLogoComponents', function (token) {
var proCardToken = _objectSpread(_objectSpread({}, token), {}, {
componentCls: ".".concat(prefixCls)
});
return [genAppsLogoComponentsStyle(proCardToken)];
});
}

View File

@@ -0,0 +1,4 @@
import type { GenerateStyle } from '@ant-design/pro-provider';
import type { AppsLogoComponentsToken } from './index';
declare const genAppsLogoComponentsSimpleListStyle: GenerateStyle<AppsLogoComponentsToken>;
export { genAppsLogoComponentsSimpleListStyle };

View File

@@ -0,0 +1,86 @@
var genAppsLogoComponentsSimpleListStyle = function genAppsLogoComponentsSimpleListStyle(token) {
return {
'&-content': {
maxHeight: 'calc(100vh - 48px)',
overflow: 'auto',
'&-list': {
boxSizing: 'border-box',
maxWidth: 376,
marginBlock: 0,
marginInline: 0,
paddingBlock: 0,
paddingInline: 0,
listStyle: 'none',
'&-item': {
position: 'relative',
display: 'inline-block',
width: 104,
height: 104,
marginBlock: 8,
marginInline: 8,
paddingInline: 24,
paddingBlock: 24,
verticalAlign: 'top',
listStyleType: 'none',
transition: 'transform 0.2s cubic-bezier(0.333, 0, 0, 1)',
borderRadius: token.borderRadius,
'&-group': {
marginBottom: 16,
'&-title': {
margin: '16px 0 8px 12px',
fontWeight: 600,
color: 'rgba(0, 0, 0, 0.88)',
fontSize: 16,
opacity: 0.85,
lineHeight: 1.5,
'&:first-child': {
marginTop: 12
}
}
},
'&:hover': {
backgroundColor: token.colorBgTextHover
},
a: {
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
height: '100%',
fontSize: 12,
textDecoration: 'none',
'& > #avatarLogo': {
width: 40,
height: 40,
margin: '0 auto',
color: token.colorPrimary,
fontSize: 22,
lineHeight: '40px',
textAlign: 'center',
backgroundImage: 'linear-gradient(180deg, #E8F0FB 0%, #F6F8FC 100%)',
borderRadius: token.borderRadius
},
'& > img': {
width: 40,
height: 40
},
'& > div': {
marginBlockStart: 5,
marginInlineStart: 0,
color: token.colorTextHeading,
fontSize: 14,
lineHeight: '22px',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis'
},
'& > div > span': {
color: token.colorTextSecondary,
fontSize: 12,
lineHeight: '20px'
}
}
}
}
}
};
};
export { genAppsLogoComponentsSimpleListStyle };

View File

@@ -0,0 +1,10 @@
export type AppItemProps = {
title: React.ReactNode;
desc?: React.ReactNode;
icon?: React.ReactNode | (() => React.ReactNode);
url?: string;
target?: string;
children?: Omit<AppItemProps, 'children'>[];
};
export type AppListProps = AppItemProps[];