Update from Vibe Studio

This commit is contained in:
Vibe Studio
2026-01-16 01:51:36 +00:00
parent a4605e311a
commit 58905d02c2
28599 changed files with 2179074 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
import React from 'react';
type LightFilterFooterRender = ((onConfirm?: (e?: React.MouseEvent) => void, onClear?: (e?: React.MouseEvent) => void) => JSX.Element | false) | false;
type OnClick = (e?: React.MouseEvent) => void;
export type DropdownFooterProps = {
onClear?: OnClick;
onConfirm?: OnClick;
disabled?: boolean;
footerRender?: LightFilterFooterRender;
children?: React.ReactNode;
};
declare const DropdownFooter: React.FC<DropdownFooterProps>;
export { DropdownFooter };

View File

@@ -0,0 +1,53 @@
import { useIntl } from '@ant-design/pro-provider';
import { Button, ConfigProvider } from 'antd';
import classNames from 'classnames';
import React, { useContext } from 'react';
import { useStyle } from "./style";
import { jsx as _jsx } from "react/jsx-runtime";
var DropdownFooter = function DropdownFooter(props) {
var intl = useIntl();
var onClear = props.onClear,
onConfirm = props.onConfirm,
disabled = props.disabled,
footerRender = props.footerRender;
var _useContext = useContext(ConfigProvider.ConfigContext),
getPrefixCls = _useContext.getPrefixCls;
var prefixCls = getPrefixCls('pro-core-dropdown-footer');
var _useStyle = useStyle(prefixCls),
wrapSSR = _useStyle.wrapSSR,
hashId = _useStyle.hashId;
var defaultFooter = [/*#__PURE__*/_jsx(Button, {
style: {
visibility: onClear ? 'visible' : 'hidden'
},
type: "link",
size: "small",
disabled: disabled,
onClick: function onClick(e) {
if (onClear) {
onClear(e);
}
e.stopPropagation();
},
children: intl.getMessage('form.lightFilter.clear', '清除')
}, "clear"), /*#__PURE__*/_jsx(Button, {
"data-type": "confirm",
type: "primary",
size: "small",
onClick: onConfirm,
disabled: disabled,
children: intl.getMessage('form.lightFilter.confirm', '确认')
}, "confirm")];
if (footerRender === false || (footerRender === null || footerRender === void 0 ? void 0 : footerRender(onConfirm, onClear)) === false) {
return null;
}
var renderDom = (footerRender === null || footerRender === void 0 ? void 0 : footerRender(onConfirm, onClear)) || defaultFooter;
return wrapSSR( /*#__PURE__*/_jsx("div", {
className: classNames(prefixCls, hashId),
onClick: function onClick(e) {
return e.target.getAttribute('data-type') !== 'confirm' && e.stopPropagation();
},
children: renderDom
}));
};
export { DropdownFooter };

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,21 @@
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';
var genProStyle = function genProStyle(token) {
return _defineProperty({}, token.componentCls, {
display: 'flex',
justifyContent: 'space-between',
paddingBlock: 8,
paddingInlineStart: 8,
paddingInlineEnd: 8,
borderBlockStart: "1px solid ".concat(token.colorSplit)
});
};
export function useStyle(prefixCls) {
return useAntdStyle('DropdownFooter', function (token) {
var proToken = _objectSpread(_objectSpread({}, token), {}, {
componentCls: ".".concat(prefixCls)
});
return [genProStyle(proToken)];
});
}

View File

@@ -0,0 +1,20 @@
import type { ErrorInfo } from 'react';
import React from 'react';
declare class ErrorBoundary extends React.Component<{
children?: React.ReactNode;
}, {
hasError: boolean;
errorInfo: string;
}> {
state: {
hasError: boolean;
errorInfo: string;
};
static getDerivedStateFromError(error: Error): {
hasError: boolean;
errorInfo: string;
};
componentDidCatch(error: any, errorInfo: ErrorInfo): void;
render(): string | number | boolean | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
}
export { ErrorBoundary };

View File

@@ -0,0 +1,59 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Result } from 'antd';
import React from 'react';
// eslint-disable-next-line @typescript-eslint/ban-types
import { jsx as _jsx } from "react/jsx-runtime";
var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
_inherits(ErrorBoundary, _React$Component);
var _super = _createSuper(ErrorBoundary);
function ErrorBoundary() {
var _this;
_classCallCheck(this, ErrorBoundary);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "state", {
hasError: false,
errorInfo: ''
});
return _this;
}
_createClass(ErrorBoundary, [{
key: "componentDidCatch",
value: function componentDidCatch(error, errorInfo) {
// You can also log the error to an error reporting service
// eslint-disable-next-line no-console
console.log(error, errorInfo);
}
}, {
key: "render",
value: function render() {
if (this.state.hasError) {
// You can render any custom fallback UI
return /*#__PURE__*/_jsx(Result, {
status: "error",
title: "Something went wrong.",
extra: this.state.errorInfo
});
}
return this.props.children;
}
}], [{
key: "getDerivedStateFromError",
value: function getDerivedStateFromError(error) {
return {
hasError: true,
errorInfo: error.message
};
}
}]);
return ErrorBoundary;
}(React.Component);
export { ErrorBoundary };

View File

@@ -0,0 +1,24 @@
import type { SizeType } from 'antd/lib/config-provider/SizeContext';
import React from 'react';
export type FieldLabelProps = {
label?: React.ReactNode;
value?: any;
disabled?: boolean;
onClear?: () => void;
size?: SizeType;
ellipsis?: boolean;
placeholder?: React.ReactNode;
className?: string;
formatter?: (value: any) => React.ReactNode;
style?: React.CSSProperties;
bordered?: boolean;
allowClear?: boolean;
downIcon?: React.ReactNode | false;
onClick?: () => void;
valueMaxLength?: number;
/**
* 点击标签的事件,用来唤醒 down menu 状态
*/
onLabelClick?: () => void;
};
export declare const FieldLabel: React.ForwardRefExoticComponent<FieldLabelProps & React.RefAttributes<any>>;

View File

@@ -0,0 +1,141 @@
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { CloseCircleFilled, DownOutlined } from '@ant-design/icons';
import { useIntl } from '@ant-design/pro-provider';
import { ConfigProvider } from 'antd';
import classNames from 'classnames';
import React, { useContext, useImperativeHandle, useRef } from 'react';
import { useStyle } from "./style";
import { jsxs as _jsxs } from "react/jsx-runtime";
import { jsx as _jsx } from "react/jsx-runtime";
var FieldLabelFunction = function FieldLabelFunction(props, ref) {
var _ConfigProvider$useCo, _ref2, _props$size;
var label = props.label,
onClear = props.onClear,
value = props.value,
disabled = props.disabled,
onLabelClick = props.onLabelClick,
ellipsis = props.ellipsis,
placeholder = props.placeholder,
className = props.className,
formatter = props.formatter,
bordered = props.bordered,
style = props.style,
downIcon = props.downIcon,
_props$allowClear = props.allowClear,
allowClear = _props$allowClear === void 0 ? true : _props$allowClear,
_props$valueMaxLength = props.valueMaxLength,
valueMaxLength = _props$valueMaxLength === void 0 ? 41 : _props$valueMaxLength;
var _ref = (ConfigProvider === null || ConfigProvider === void 0 || (_ConfigProvider$useCo = ConfigProvider.useConfig) === null || _ConfigProvider$useCo === void 0 ? void 0 : _ConfigProvider$useCo.call(ConfigProvider)) || {
componentSize: 'middle'
},
componentSize = _ref.componentSize;
var size = componentSize;
var _useContext = useContext(ConfigProvider.ConfigContext),
getPrefixCls = _useContext.getPrefixCls;
var prefixCls = getPrefixCls('pro-core-field-label');
var _useStyle = useStyle(prefixCls),
wrapSSR = _useStyle.wrapSSR,
hashId = _useStyle.hashId;
var intl = useIntl();
var clearRef = useRef(null);
var labelRef = useRef(null);
useImperativeHandle(ref, function () {
return {
labelRef: labelRef,
clearRef: clearRef
};
});
var wrapElements = function wrapElements(array) {
if (array.every(function (item) {
return typeof item === 'string';
})) return array.join(',');
return array.map(function (item, index) {
var comma = index === array.length - 1 ? '' : ',';
if (typeof item === 'string') {
return /*#__PURE__*/_jsxs("span", {
children: [item, comma]
}, index);
}
return /*#__PURE__*/_jsxs("span", {
style: {
display: 'flex'
},
children: [item, comma]
}, index);
});
};
var formatterText = function formatterText(aValue) {
if (formatter) {
return formatter(aValue);
}
return Array.isArray(aValue) ? wrapElements(aValue) : aValue;
};
var getTextByValue = function getTextByValue(aLabel, aValue) {
if (aValue !== undefined && aValue !== null && aValue !== '' && (!Array.isArray(aValue) || aValue.length)) {
var _str$toString, _str$toString$slice;
var prefix = aLabel ? /*#__PURE__*/_jsxs("span", {
onClick: function onClick() {
onLabelClick === null || onLabelClick === void 0 || onLabelClick();
},
className: "".concat(prefixCls, "-text"),
children: [aLabel, ': ']
}) : '';
var str = formatterText(aValue);
if (!ellipsis) {
return /*#__PURE__*/_jsxs("span", {
style: {
display: 'inline-flex',
alignItems: 'center'
},
children: [prefix, formatterText(aValue)]
});
}
var getText = function getText() {
var isArrayValue = Array.isArray(aValue) && aValue.length > 1;
var unitText = intl.getMessage('form.lightFilter.itemUnit', '项');
if (typeof str === 'string' && str.length > valueMaxLength && isArrayValue) {
return "...".concat(aValue.length).concat(unitText);
}
return '';
};
var tail = getText();
return /*#__PURE__*/_jsxs("span", {
title: typeof str === 'string' ? str : undefined,
style: {
display: 'inline-flex',
alignItems: 'center'
},
children: [prefix, /*#__PURE__*/_jsx("span", {
style: {
paddingInlineStart: 4,
display: 'flex'
},
children: typeof str === 'string' ? str === null || str === void 0 || (_str$toString = str.toString()) === null || _str$toString === void 0 || (_str$toString$slice = _str$toString.slice) === null || _str$toString$slice === void 0 ? void 0 : _str$toString$slice.call(_str$toString, 0, valueMaxLength) : str
}), tail]
});
}
return aLabel || placeholder;
};
return wrapSSR( /*#__PURE__*/_jsxs("span", {
className: classNames(prefixCls, hashId, "".concat(prefixCls, "-").concat((_ref2 = (_props$size = props.size) !== null && _props$size !== void 0 ? _props$size : size) !== null && _ref2 !== void 0 ? _ref2 : 'middle'), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-active"), (Array.isArray(value) ? value.length > 0 : !!value) || value === 0), "".concat(prefixCls, "-disabled"), disabled), "".concat(prefixCls, "-bordered"), bordered), "".concat(prefixCls, "-allow-clear"), allowClear), className),
style: style,
ref: labelRef,
onClick: function onClick() {
var _props$onClick;
props === null || props === void 0 || (_props$onClick = props.onClick) === null || _props$onClick === void 0 || _props$onClick.call(props);
},
children: [getTextByValue(label, value), (value || value === 0) && allowClear && /*#__PURE__*/_jsx(CloseCircleFilled, {
role: "button",
title: intl.getMessage('form.lightFilter.clear', '清除'),
className: classNames("".concat(prefixCls, "-icon"), hashId, "".concat(prefixCls, "-close")),
onClick: function onClick(e) {
if (!disabled) onClear === null || onClear === void 0 || onClear();
e.stopPropagation();
},
ref: clearRef
}), downIcon !== false ? downIcon !== null && downIcon !== void 0 ? downIcon : /*#__PURE__*/_jsx(DownOutlined, {
className: classNames("".concat(prefixCls, "-icon"), hashId, "".concat(prefixCls, "-arrow"))
}) : null]
}));
};
export var FieldLabel = /*#__PURE__*/React.forwardRef(FieldLabelFunction);

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,89 @@
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';
var genProStyle = function genProStyle(token) {
return _defineProperty({}, token.componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
display: 'inline-flex',
gap: token.marginXXS,
alignItems: 'center',
height: '30px',
paddingBlock: 0,
paddingInline: 8,
fontSize: token.fontSize,
lineHeight: '30px',
borderRadius: '2px',
cursor: 'pointer',
'&:hover': {
backgroundColor: token.colorBgTextHover
},
'&-active': _defineProperty({
paddingBlock: 0,
paddingInline: 8,
backgroundColor: token.colorBgTextHover
}, "&".concat(token.componentCls, "-allow-clear:hover:not(").concat(token.componentCls, "-disabled)"), _defineProperty(_defineProperty({}, "".concat(token.componentCls, "-arrow"), {
display: 'none'
}), "".concat(token.componentCls, "-close"), {
display: 'inline-flex'
}))
}, "".concat(token.antCls, "-select"), _defineProperty({}, "".concat(token.antCls, "-select-clear"), {
borderRadius: '50%'
})), "".concat(token.antCls, "-picker"), _defineProperty({}, "".concat(token.antCls, "-picker-clear"), {
borderRadius: '50%'
})), '&-icon', _defineProperty(_defineProperty({
color: token.colorIcon,
transition: 'color 0.3s',
fontSize: 12,
verticalAlign: 'middle'
}, "&".concat(token.componentCls, "-close"), {
display: 'none',
fontSize: 12,
alignItems: 'center',
justifyContent: 'center',
color: token.colorTextPlaceholder,
borderRadius: '50%'
}), '&:hover', {
color: token.colorIconHover
})), '&-disabled', _defineProperty({
color: token.colorTextPlaceholder,
cursor: 'not-allowed'
}, "".concat(token.componentCls, "-icon"), {
color: token.colorTextPlaceholder
})), '&-small', _defineProperty(_defineProperty(_defineProperty({
height: '24px',
paddingBlock: 0,
paddingInline: 4,
fontSize: token.fontSizeSM,
lineHeight: '24px'
}, "&".concat(token.componentCls, "-active"), {
paddingBlock: 0,
paddingInline: 8
}), "".concat(token.componentCls, "-icon"), {
paddingBlock: 0,
paddingInline: 0
}), "".concat(token.componentCls, "-close"), {
marginBlockStart: '-2px',
paddingBlock: 4,
paddingInline: 4,
fontSize: '6px'
})), '&-bordered', {
height: '32px',
paddingBlock: 0,
paddingInline: 8,
border: "".concat(token.lineWidth, "px solid ").concat(token.colorBorder),
borderRadius: '@border-radius-base'
}), '&-bordered&-small', {
height: '24px',
paddingBlock: 0,
paddingInline: 8
}), '&-bordered&-active', {
backgroundColor: token.colorBgContainer
}));
};
export function useStyle(prefixCls) {
return useAntdStyle('FieldLabel', function (token) {
var proToken = _objectSpread(_objectSpread({}, token), {}, {
componentCls: ".".concat(prefixCls)
});
return [genProStyle(proToken)];
});
}

View File

@@ -0,0 +1,26 @@
import React from 'react';
import type { DropdownFooterProps } from '../DropdownFooter';
import 'antd/lib/dropdown/style';
import type { TooltipPlacement } from 'antd/lib/tooltip';
export type FooterRender = ((onConfirm?: (e?: React.MouseEvent) => void, onClear?: (e?: React.MouseEvent) => void) => JSX.Element | false) | false;
export type DropdownProps = {
label?: React.ReactNode;
footer?: DropdownFooterProps;
footerRender?: FooterRender;
padding?: number;
disabled?: boolean;
/**
* @deprecated use onOpenChange replace
*/
onVisibleChange?: (visible: boolean) => void;
/**
* @deprecated use open replace
*/
visible?: boolean;
onOpenChange?: (visible: boolean) => void;
open?: boolean;
placement?: TooltipPlacement;
children?: React.ReactNode;
};
declare const FilterDropdown: React.FC<DropdownProps>;
export { FilterDropdown };

View File

@@ -0,0 +1,62 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { ConfigProvider, Popover } from 'antd';
import React, { useContext, useRef } from 'react';
import { DropdownFooter } from "../DropdownFooter";
import "antd/es/dropdown/style";
import classNames from 'classnames';
import { openVisibleCompatible } from "../../compareVersions/openVisibleCompatible";
import { useStyle } from "./style";
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
var FilterDropdown = function FilterDropdown(props) {
var children = props.children,
label = props.label,
footer = props.footer,
open = props.open,
onOpenChange = props.onOpenChange,
disabled = props.disabled,
onVisibleChange = props.onVisibleChange,
visible = props.visible,
footerRender = props.footerRender,
placement = props.placement;
var _useContext = useContext(ConfigProvider.ConfigContext),
getPrefixCls = _useContext.getPrefixCls;
var prefixCls = getPrefixCls('pro-core-field-dropdown');
var _useStyle = useStyle(prefixCls),
wrapSSR = _useStyle.wrapSSR,
hashId = _useStyle.hashId;
var dropdownOpenProps = openVisibleCompatible(open || visible || false, onOpenChange || onVisibleChange);
var htmlRef = useRef(null);
return wrapSSR( /*#__PURE__*/_jsx(Popover, _objectSpread(_objectSpread({
placement: placement,
trigger: ['click']
}, dropdownOpenProps), {}, {
styles: {
body: {
padding: 0
}
},
content: /*#__PURE__*/_jsxs("div", {
ref: htmlRef,
className: classNames("".concat(prefixCls, "-overlay"), _defineProperty(_defineProperty({}, "".concat(prefixCls, "-overlay-").concat(placement), placement), "hashId", hashId)),
children: [/*#__PURE__*/_jsx(ConfigProvider, {
getPopupContainer: function getPopupContainer() {
return htmlRef.current || document.body;
},
children: /*#__PURE__*/_jsx("div", {
className: "".concat(prefixCls, "-content ").concat(hashId).trim(),
children: children
})
}), footer && /*#__PURE__*/_jsx(DropdownFooter, _objectSpread({
disabled: disabled,
footerRender: footerRender
}, footer))]
}),
children: /*#__PURE__*/_jsx("span", {
className: "".concat(prefixCls, "-label ").concat(hashId).trim(),
children: label
})
})));
};
export { FilterDropdown };

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,22 @@
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';
var genProStyle = function genProStyle(token) {
return _defineProperty(_defineProperty(_defineProperty({}, "".concat(token.componentCls, "-label"), {
cursor: 'pointer'
}), "".concat(token.componentCls, "-overlay"), {
minWidth: '200px',
marginBlockStart: '4px'
}), "".concat(token.componentCls, "-content"), {
paddingBlock: 16,
paddingInline: 16
});
};
export function useStyle(prefixCls) {
return useAntdStyle('FilterDropdown', function (token) {
var proToken = _objectSpread(_objectSpread({}, token), {}, {
componentCls: ".".concat(prefixCls)
});
return [genProStyle(proToken)];
});
}

View File

@@ -0,0 +1,8 @@
import type { FormItemProps, PopoverProps } from 'antd';
interface InlineErrorFormItemProps extends FormItemProps {
errorType?: 'popover' | 'default';
popoverProps?: PopoverProps;
children: any;
}
export declare const InlineErrorFormItem: (props: InlineErrorFormItemProps) => import("react/jsx-runtime").JSX.Element;
export {};

View File

@@ -0,0 +1,149 @@
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
var _excluded = ["rules", "name", "children", "popoverProps"],
_excluded2 = ["errorType", "rules", "name", "popoverProps", "children"];
import { LoadingOutlined } from '@ant-design/icons';
import { useToken } from '@ant-design/pro-provider';
import { ConfigProvider, Form, Popover } from 'antd';
import get from "rc-util/es/utils/get";
import React, { useContext, useEffect, useState } from 'react';
import { openVisibleCompatible } from "../../compareVersions/openVisibleCompatible";
import { useStyle } from "./style";
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
import { Fragment as _Fragment } from "react/jsx-runtime";
var FIX_INLINE_STYLE = {
marginBlockStart: -5,
marginBlockEnd: -5,
marginInlineStart: 0,
marginInlineEnd: 0
};
var InlineErrorFormItemPopover = function InlineErrorFormItemPopover(_ref) {
var inputProps = _ref.inputProps,
input = _ref.input,
extra = _ref.extra,
errorList = _ref.errorList,
popoverProps = _ref.popoverProps;
var _useState = useState(false),
_useState2 = _slicedToArray(_useState, 2),
open = _useState2[0],
setOpen = _useState2[1];
var _useState3 = useState([]),
_useState4 = _slicedToArray(_useState3, 2),
errorStringList = _useState4[0],
setErrorList = _useState4[1];
var _useContext = useContext(ConfigProvider.ConfigContext),
getPrefixCls = _useContext.getPrefixCls;
var prefixCls = getPrefixCls();
var token = useToken();
var _useStyle = useStyle("".concat(prefixCls, "-form-item-with-help")),
wrapSSR = _useStyle.wrapSSR,
hashId = _useStyle.hashId;
useEffect(function () {
if (inputProps.validateStatus !== 'validating') {
setErrorList(inputProps.errors);
}
}, [inputProps.errors, inputProps.validateStatus]);
var popoverOpenProps = openVisibleCompatible(errorStringList.length < 1 ? false : open, function (changeOpen) {
if (changeOpen === open) return;
setOpen(changeOpen);
});
var loading = inputProps.validateStatus === 'validating';
return /*#__PURE__*/_jsx(Popover, _objectSpread(_objectSpread(_objectSpread({
trigger: (popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.trigger) || ['click'],
placement: (popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.placement) || 'topLeft'
}, popoverOpenProps), {}, {
getPopupContainer: popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.getPopupContainer,
getTooltipContainer: popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.getTooltipContainer,
content: wrapSSR( /*#__PURE__*/_jsx("div", {
className: "".concat(prefixCls, "-form-item ").concat(hashId, " ").concat(token.hashId).trim(),
style: {
margin: 0,
padding: 0
},
children: /*#__PURE__*/_jsxs("div", {
className: "".concat(prefixCls, "-form-item-with-help ").concat(hashId, " ").concat(token.hashId).trim(),
children: [loading ? /*#__PURE__*/_jsx(LoadingOutlined, {}) : null, errorList]
})
}))
}, popoverProps), {}, {
children: /*#__PURE__*/_jsxs(_Fragment, {
children: [input, extra]
})
}), "popover");
};
var InternalFormItemFunction = function InternalFormItemFunction(_ref2) {
var rules = _ref2.rules,
name = _ref2.name,
children = _ref2.children,
popoverProps = _ref2.popoverProps,
rest = _objectWithoutProperties(_ref2, _excluded);
return /*#__PURE__*/_jsx(Form.Item, _objectSpread(_objectSpread({
name: name,
rules: rules,
hasFeedback: false,
shouldUpdate: function shouldUpdate(prev, next) {
if (prev === next) return false;
var shouldName = [name].flat(1);
if (shouldName.length > 1) {
shouldName.pop();
}
try {
return JSON.stringify(get(prev, shouldName)) !== JSON.stringify(get(next, shouldName));
} catch (error) {
return true;
}
}
// @ts-ignore
,
_internalItemRender: {
mark: 'pro_table_render',
render: function render(inputProps, doms) {
return /*#__PURE__*/_jsx(InlineErrorFormItemPopover, _objectSpread({
inputProps: inputProps,
popoverProps: popoverProps
}, doms));
}
}
}, rest), {}, {
style: _objectSpread(_objectSpread({}, FIX_INLINE_STYLE), rest === null || rest === void 0 ? void 0 : rest.style),
children: children
}));
};
export var InlineErrorFormItem = function InlineErrorFormItem(props) {
var errorType = props.errorType,
rules = props.rules,
name = props.name,
popoverProps = props.popoverProps,
children = props.children,
rest = _objectWithoutProperties(props, _excluded2);
if (name && rules !== null && rules !== void 0 && rules.length && errorType === 'popover') {
return /*#__PURE__*/_jsx(InternalFormItemFunction, _objectSpread(_objectSpread({
name: name,
rules: rules,
popoverProps: popoverProps
}, rest), {}, {
children: children
}));
}
return /*#__PURE__*/_jsx(Form.Item, _objectSpread(_objectSpread({
rules: rules,
shouldUpdate: name ? function (prev, next) {
if (prev === next) return false;
var shouldName = [name].flat(1);
if (shouldName.length > 1) {
shouldName.pop();
}
try {
return JSON.stringify(get(prev, shouldName)) !== JSON.stringify(get(next, shouldName));
} catch (error) {
return true;
}
} : undefined
}, rest), {}, {
style: _objectSpread(_objectSpread({}, FIX_INLINE_STYLE), rest.style),
name: name,
children: children
}));
};

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,63 @@
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';
var genProStyle = function genProStyle(token) {
var progressBgCls = "".concat(token.antCls, "-progress-bg");
return _defineProperty({}, token.componentCls, {
'&-multiple': {
paddingBlockStart: 6,
paddingBlockEnd: 12,
paddingInline: 8
},
'&-progress': {
'&-success': _defineProperty({}, progressBgCls, {
backgroundColor: token.colorSuccess
}),
'&-error': _defineProperty({}, progressBgCls, {
backgroundColor: token.colorError
}),
'&-warning': _defineProperty({}, progressBgCls, {
backgroundColor: token.colorWarning
})
},
'&-rule': {
display: 'flex',
alignItems: 'center',
'&-icon': {
'&-default': {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
width: '14px',
height: '22px',
'&-circle': {
width: '6px',
height: '6px',
backgroundColor: token.colorTextSecondary,
borderRadius: '4px'
}
},
'&-loading': {
color: token.colorPrimary
},
'&-error': {
color: token.colorError
},
'&-success': {
color: token.colorSuccess
}
},
'&-text': {
color: token.colorText
}
}
});
};
export function useStyle(prefixCls) {
return useAntdStyle('InlineErrorFormItem', function (token) {
var proToken = _objectSpread(_objectSpread({}, token), {}, {
componentCls: ".".concat(prefixCls)
});
return [genProStyle(proToken)];
});
}

View File

@@ -0,0 +1,15 @@
import type { LabelTooltipType } from 'antd/lib/form/FormItemLabel';
import React from 'react';
/**
* 在 form 的 label 后面增加一个 tips 来展示一些说明文案
*
* @param props
*/
export declare const LabelIconTip: React.FC<{
label: React.ReactNode;
subTitle?: React.ReactNode;
tooltip?: string | LabelTooltipType;
ellipsis?: boolean | {
showTitle?: boolean;
};
}>;

View File

@@ -0,0 +1,61 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { InfoCircleOutlined } from '@ant-design/icons';
import { ConfigProvider, Tooltip } from 'antd';
import classNames from 'classnames';
import React, { useContext } from 'react';
import { useStyle } from "./style";
/**
* 在 form 的 label 后面增加一个 tips 来展示一些说明文案
*
* @param props
*/
import { Fragment as _Fragment } from "react/jsx-runtime";
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
export var LabelIconTip = /*#__PURE__*/React.memo(function (props) {
var label = props.label,
tooltip = props.tooltip,
ellipsis = props.ellipsis,
subTitle = props.subTitle;
var _useContext = useContext(ConfigProvider.ConfigContext),
getPrefixCls = _useContext.getPrefixCls;
var className = getPrefixCls('pro-core-label-tip');
var _useStyle = useStyle(className),
wrapSSR = _useStyle.wrapSSR,
hashId = _useStyle.hashId;
if (!tooltip && !subTitle) {
return /*#__PURE__*/_jsx(_Fragment, {
children: label
});
}
var tooltipProps = typeof tooltip === 'string' || /*#__PURE__*/React.isValidElement(tooltip) ? {
title: tooltip
} : tooltip;
var icon = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.icon) || /*#__PURE__*/_jsx(InfoCircleOutlined, {});
return wrapSSR( /*#__PURE__*/_jsxs("div", {
className: classNames(className, hashId),
onMouseDown: function onMouseDown(e) {
return e.stopPropagation();
},
onMouseLeave: function onMouseLeave(e) {
return e.stopPropagation();
},
onMouseMove: function onMouseMove(e) {
return e.stopPropagation();
},
children: [/*#__PURE__*/_jsx("div", {
className: classNames("".concat(className, "-title"), hashId, _defineProperty({}, "".concat(className, "-title-ellipsis"), ellipsis)),
children: label
}), subTitle && /*#__PURE__*/_jsx("div", {
className: "".concat(className, "-subtitle ").concat(hashId).trim(),
children: subTitle
}), tooltip && /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({}, tooltipProps), {}, {
children: /*#__PURE__*/_jsx("span", {
className: "".concat(className, "-icon ").concat(hashId).trim(),
children: icon
})
}))]
}));
});

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,43 @@
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';
var genProStyle = function genProStyle(token) {
return _defineProperty({}, token.componentCls, {
display: 'inline-flex',
alignItems: 'center',
maxWidth: '100%',
'&-icon': {
display: 'block',
marginInlineStart: '4px',
cursor: 'pointer',
'&:hover': {
color: token.colorPrimary
}
},
'&-title': {
display: 'inline-flex',
flex: '1'
},
'&-subtitle ': {
marginInlineStart: 8,
color: token.colorTextSecondary,
fontWeight: 'normal',
fontSize: token.fontSize,
whiteSpace: 'nowrap'
},
'&-title-ellipsis': {
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
wordBreak: 'keep-all'
}
});
};
export function useStyle(prefixCls) {
return useAntdStyle('LabelIconTip', function (token) {
var proToken = _objectSpread(_objectSpread({}, token), {}, {
componentCls: ".".concat(prefixCls)
});
return [genProStyle(proToken)];
});
}

View File

@@ -0,0 +1,41 @@
import type { FormInstance } from 'antd';
import type { NamePath } from 'antd/lib/form/interface';
import React from 'react';
export type ProFormInstanceType<T> = {
/**
* 获取被 ProForm 格式化后的所有数据
* @param nameList boolean
* @returns T
*
* @example getFieldsFormatValue() ->返回所有数据
* @example getFieldsFormatValue(true) ->返回所有数据,即使没有被 form 托管的
*/
getFieldsFormatValue?: (nameList?: true, omitNil?: boolean) => T;
/**
* 获取被 ProForm 格式化后的单个数据
* @param nameList (string|number)[]
* @returns T
*
* @example {a:{b:value}} -> getFieldFormatValue(['a', 'b']) -> value
*/
getFieldFormatValue?: (nameList?: NamePath) => T;
/**
* 获取被 ProForm 格式化后的单个数据, 包含他的 name
* @param nameList (string|number)[]
* @returns T
*
* @example {a:{b:value}}->getFieldFormatValueObject(['a','b'])->{a:{b:value}}
*/
getFieldFormatValueObject?: (nameList?: NamePath) => T;
/**
*验字段后返回格式化之后的所有数据
* @param nameList (string|number)[]
* @returns T
*
* @example validateFieldsReturnFormatValue -> {a:{b:value}}
*/
validateFieldsReturnFormatValue?: (nameList?: NamePath[]) => Promise<T>;
};
export declare const ProFormContext: React.Context<ProFormInstanceType<any> & {
formRef?: React.MutableRefObject<FormInstance<any>> | undefined;
}>;

View File

@@ -0,0 +1,2 @@
import React from 'react';
export var ProFormContext = /*#__PURE__*/React.createContext({});