Update from Vibe Studio

This commit is contained in:
Vibe Studio
2026-01-16 02:20:32 +00:00
parent a4605e311a
commit 71de1506ca
28603 changed files with 2179459 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
import type { IntlType } from '@ant-design/pro-provider';
import React, { Key } from 'react';
export type AlertRenderType<T> = ((props: {
intl: IntlType;
selectedRowKeys: (number | string | Key)[];
selectedRows: T[];
onCleanSelected: () => void;
}) => React.ReactNode) | false;
export type TableAlertProps<T> = {
selectedRowKeys: (number | string | Key)[];
selectedRows: T[];
alwaysShowAlert?: boolean;
alertInfoRender?: AlertRenderType<T>;
onCleanSelected: () => void;
alertOptionRender?: AlertRenderType<T>;
};
declare function TableAlert<T>({ selectedRowKeys, onCleanSelected, alwaysShowAlert, selectedRows, alertInfoRender, alertOptionRender, }: TableAlertProps<T>): React.JSX.Element | null;
export default TableAlert;

View File

@@ -0,0 +1,72 @@
import { useIntl } from '@ant-design/pro-provider';
import { ConfigProvider, Space } from 'antd';
import React, { useContext } from 'react';
import { useStyle } from "./style";
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
var defaultAlertOptionRender = function defaultAlertOptionRender(props) {
var intl = props.intl,
onCleanSelected = props.onCleanSelected;
return [/*#__PURE__*/_jsx("a", {
onClick: onCleanSelected,
children: intl.getMessage('alert.clear', '清空')
}, "0")];
};
function TableAlert(_ref) {
var _ref$selectedRowKeys = _ref.selectedRowKeys,
selectedRowKeys = _ref$selectedRowKeys === void 0 ? [] : _ref$selectedRowKeys,
onCleanSelected = _ref.onCleanSelected,
alwaysShowAlert = _ref.alwaysShowAlert,
selectedRows = _ref.selectedRows,
_ref$alertInfoRender = _ref.alertInfoRender,
alertInfoRender = _ref$alertInfoRender === void 0 ? function (_ref2) {
var intl = _ref2.intl;
return /*#__PURE__*/_jsxs(Space, {
children: [intl.getMessage('alert.selected', '已选择'), selectedRowKeys.length, intl.getMessage('alert.item', '项'), "\xA0\xA0"]
});
} : _ref$alertInfoRender,
_ref$alertOptionRende = _ref.alertOptionRender,
alertOptionRender = _ref$alertOptionRende === void 0 ? defaultAlertOptionRender : _ref$alertOptionRende;
var intl = useIntl();
var option = alertOptionRender && alertOptionRender({
onCleanSelected: onCleanSelected,
selectedRowKeys: selectedRowKeys,
selectedRows: selectedRows,
intl: intl
});
var _useContext = useContext(ConfigProvider.ConfigContext),
getPrefixCls = _useContext.getPrefixCls;
var className = getPrefixCls('pro-table-alert');
var _useStyle = useStyle(className),
wrapSSR = _useStyle.wrapSSR,
hashId = _useStyle.hashId;
if (alertInfoRender === false) {
return null;
}
var dom = alertInfoRender({
intl: intl,
selectedRowKeys: selectedRowKeys,
selectedRows: selectedRows,
onCleanSelected: onCleanSelected
});
if (dom === false || selectedRowKeys.length < 1 && !alwaysShowAlert) {
return null;
}
return wrapSSR( /*#__PURE__*/_jsx("div", {
className: "".concat(className, " ").concat(hashId).trim(),
children: /*#__PURE__*/_jsx("div", {
className: "".concat(className, "-container ").concat(hashId).trim(),
children: /*#__PURE__*/_jsxs("div", {
className: "".concat(className, "-info ").concat(hashId).trim(),
children: [/*#__PURE__*/_jsx("div", {
className: "".concat(className, "-info-content ").concat(hashId).trim(),
children: dom
}), option ? /*#__PURE__*/_jsx("div", {
className: "".concat(className, "-info-option ").concat(hashId).trim(),
children: option
}) : null]
})
})
}));
}
export default TableAlert;

View File

@@ -0,0 +1,9 @@
/// <reference types="react" />
import type { ProAliasToken } from '@ant-design/pro-provider';
export interface ProToken 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,36 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { setAlpha, useStyle as useAntdStyle } from '@ant-design/pro-provider';
var genProStyle = function genProStyle(token) {
return _defineProperty({}, token.componentCls, {
marginBlockEnd: 16,
backgroundColor: setAlpha(token.colorTextBase, 0.02),
borderRadius: token.borderRadius,
border: 'none',
'&-container': {
paddingBlock: token.paddingSM,
paddingInline: token.paddingLG
},
'&-info': {
display: 'flex',
alignItems: 'center',
transition: 'all 0.3s',
color: token.colorTextTertiary,
'&-content': {
flex: 1
},
'&-option': {
minWidth: 48,
paddingInlineStart: 16
}
}
});
};
export function useStyle(prefixCls) {
return useAntdStyle('ProTableAlert', function (token) {
var proToken = _objectSpread(_objectSpread({}, token), {}, {
componentCls: ".".concat(prefixCls)
});
return [genProStyle(proToken)];
});
}