Compare commits
15 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
f5753e779d | |
|
|
8566185de1 | |
|
|
582bbc0470 | |
|
|
896b394752 | |
|
|
31571d1466 | |
|
|
5e9764fdfb | |
|
|
b4adc46214 | |
|
|
e9962bf995 | |
|
|
05621be758 | |
|
|
585b03329b | |
|
|
c3268aff48 | |
|
|
8bbdff2506 | |
|
|
acc9a1106a | |
|
|
1cc778a90a | |
|
|
390d8c7799 |
|
|
@ -15,4 +15,8 @@ yarn add zy-react-library
|
|||
|
||||
### v1.1.2 (2025-12-25)
|
||||
|
||||
- 🎉 优化编译效果
|
||||
- 🎉 优化编译效果
|
||||
|
||||
### v2.0.0 (2026-06-22)
|
||||
|
||||
- 🎉 升级到antd6
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "zy-react-library",
|
||||
"private": false,
|
||||
"version": "1.3.19",
|
||||
"version": "2.0.6",
|
||||
"type": "module",
|
||||
"description": "",
|
||||
"author": "LiuJiaNan",
|
||||
|
|
@ -30,13 +30,13 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@ahooksjs/use-url-state": "^3.5.1",
|
||||
"@ant-design/icons": "^5.6.1",
|
||||
"@ant-design/pro-components": "^2.8.10",
|
||||
"@ant-design/icons": "^6.2.5",
|
||||
"@ant-design/pro-components": "^3.1.12-0",
|
||||
"@cqsjjb/jjb-common-lib": "latest",
|
||||
"@wangeditor/editor": "^5.1.23",
|
||||
"@wangeditor/editor-for-react": "^1.0.6",
|
||||
"ahooks": "^3.9.5",
|
||||
"antd": "^5.27.6",
|
||||
"antd": "^6.4.4",
|
||||
"dayjs": "^1.11.18",
|
||||
"lodash-es": "^4.17.21",
|
||||
"react": "^18.3.1",
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@ export interface BasicCascaderProps extends Omit<CascaderProps, "fieldNames"> {
|
|||
idKey?: string;
|
||||
/** 树形数据 children 字段,默认 children */
|
||||
childrenKey?: string;
|
||||
/** @deprecated 已弃用,请使用 getNodePathsIsIncludeOneself */
|
||||
onGetNodePathsIsIncludeOneself?: boolean;
|
||||
/** 决定 onGetNodePaths 是否包含自身节点,默认 true */
|
||||
getNodePathsIsIncludeOneself?: boolean;
|
||||
/** 获取父级节点 */
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ function BasicCascader(props) {
|
|||
onGetData,
|
||||
onChange,
|
||||
onGetNodePaths,
|
||||
onGetNodePathsIsIncludeOneself,
|
||||
getNodePathsIsIncludeOneself = true,
|
||||
placeholder = "",
|
||||
data = [],
|
||||
|
|
@ -21,14 +20,6 @@ function BasicCascader(props) {
|
|||
...restProps
|
||||
} = props;
|
||||
|
||||
// 如果使用了已弃用的参数给出警告
|
||||
if (onGetNodePathsIsIncludeOneself !== undefined) {
|
||||
console.warn("【BasicCascader】 onGetNodePathsIsIncludeOneself 参数已弃用,请使用 getNodePathsIsIncludeOneself 参数");
|
||||
}
|
||||
|
||||
// 向后兼容,如果传入了旧参数,使用旧参数
|
||||
const finalGetNodePathsIsIncludeOneself = onGetNodePathsIsIncludeOneself !== undefined ? onGetNodePathsIsIncludeOneself : getNodePathsIsIncludeOneself;
|
||||
|
||||
// 根据 level 处理树数据
|
||||
const processedData = useMemo(() => {
|
||||
return level
|
||||
|
|
@ -43,7 +34,7 @@ function BasicCascader(props) {
|
|||
|
||||
const getNodePaths = (selectedOptions) => {
|
||||
let nodePaths = selectedOptions;
|
||||
if (!finalGetNodePathsIsIncludeOneself && selectedOptions) {
|
||||
if (!getNodePathsIsIncludeOneself && selectedOptions) {
|
||||
nodePaths = selectedOptions.slice(0, -1);
|
||||
}
|
||||
return nodePaths || [];
|
||||
|
|
|
|||
|
|
@ -44,6 +44,11 @@ export interface FormBuilderProps<Values = any> extends Omit<FormProps, "form" |
|
|||
form: FormInstance<Values>;
|
||||
/** 表单提交时的回调函数 */
|
||||
onFinish?: (values: Values) => void;
|
||||
/** 历史记录对象,用于返回上一页,默认使用 window.history.back */
|
||||
history?: {
|
||||
goBack?: () => void;
|
||||
[key: string]: any;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ const FormBuilder = (props) => {
|
|||
showCancelButton = true,
|
||||
customActionButtons,
|
||||
extraActionButtons,
|
||||
history,
|
||||
loading = false,
|
||||
...restProps
|
||||
} = props;
|
||||
|
|
@ -51,7 +52,7 @@ const FormBuilder = (props) => {
|
|||
}, [showActionButtons]);
|
||||
|
||||
const handleCancel = () => {
|
||||
window.history.back();
|
||||
history?.goBack ? history.goBack() : window.history.back();
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import type { NamePath } from "@rc-component/form/lib/interface";
|
||||
import type { ColProps } from "antd/es/col";
|
||||
import type { FormItemProps, Rule } from "antd/es/form";
|
||||
import type { FormListFieldData } from "antd/es/form/FormList";
|
||||
import type { Gutter } from "antd/es/grid/row";
|
||||
import type { NamePath } from "rc-field-form/lib/interface";
|
||||
import type { ReactElement, ReactNode } from "react";
|
||||
import type { CSSProperties, ReactElement, ReactNode } from "react";
|
||||
import type { FORM_ITEM_RENDER_TYPE_MAP } from "../../enum/formItemRender";
|
||||
import type { DeepPartial } from "./FormBuilder";
|
||||
|
||||
|
|
@ -131,6 +131,10 @@ export interface FormOptionBase<
|
|||
dependencies?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender, Dependencies[]>;
|
||||
/** 是否仅用于保存标签,不渲染到页面上,只在表单中保存数据,默认 false */
|
||||
onlyForLabel?: IsOnlyForLabel;
|
||||
/** Col 的内联样式,会合并到 Col 的 style 上,支持函数动态计算 */
|
||||
colStyle?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender, CSSProperties | ((formValues: AllValues) => CSSProperties)>;
|
||||
/** Col 内部、Form.Item 之前渲染的标题节点,支持函数动态计算 */
|
||||
colTitle?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender, ReactNode | ((formValues: AllValues) => ReactNode)>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -157,6 +161,10 @@ export type FormOptionByRender<
|
|||
checkboxCol?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender, RenderType extends "checkbox" ? number : never>;
|
||||
/** Form.List 独有的属性 */
|
||||
formListUniqueProps?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender, RenderType extends "formList" ? FormListUniqueProps | ((formValues: AllValues) => FormListUniqueProps) : never>;
|
||||
/** FormList 每行的内联样式,仅 render 为 formList 时可用,支持函数按行计算 */
|
||||
rowStyle?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender, RenderType extends "formList" ? CSSProperties | ((field: FormListFieldData, fieldIndex: number) => CSSProperties) : never>;
|
||||
/** FormList 每行起始位置渲染的标题节点,仅 render 为 formList 时可用,支持函数按行计算 */
|
||||
rowTitle?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender, RenderType extends "formList" ? ReactNode | ((field: FormListFieldData, fieldIndex: number) => ReactNode) : never>;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -84,12 +84,8 @@ const FormItemsRenderer = ({
|
|||
};
|
||||
};
|
||||
|
||||
// 获取传给formItem的属性
|
||||
const getFormItemProps = (option) => {
|
||||
const formItemProps = typeof option.formItemProps === "function"
|
||||
? option.formItemProps(getFormValues())
|
||||
: (option.formItemProps || {});
|
||||
|
||||
// 设置日期组件的属性
|
||||
const setDateComponentProps = (option, formItemProps) => {
|
||||
// 为日期组件添加特殊处理
|
||||
if ([
|
||||
FORM_ITEM_RENDER_ENUM.DATE,
|
||||
|
|
@ -117,6 +113,15 @@ const FormItemsRenderer = ({
|
|||
formItemProps.getValueFromEvent = (_, dateString) => dateString;
|
||||
formItemProps.getValueProps = value => ({ value: Array.isArray(value) ? value.map(v => v ? dayjs(v) : undefined) : undefined });
|
||||
}
|
||||
};
|
||||
|
||||
// 获取传给 formItem 的属性
|
||||
const getFormItemProps = (option) => {
|
||||
const formItemProps = typeof option.formItemProps === "function"
|
||||
? option.formItemProps(getFormValues())
|
||||
: (option.formItemProps || {});
|
||||
|
||||
setDateComponentProps(option, formItemProps);
|
||||
|
||||
return formItemProps;
|
||||
};
|
||||
|
|
@ -218,6 +223,39 @@ const FormItemsRenderer = ({
|
|||
return { span: itemSpan, labelCol: itemLabelCol, wrapperCol: itemWrapperCol };
|
||||
};
|
||||
|
||||
// 获取 col 样式
|
||||
const getColStyle = (option) => {
|
||||
return typeof option.colStyle === "function"
|
||||
? option.colStyle(getFormValues())
|
||||
: option.colStyle;
|
||||
};
|
||||
|
||||
// 获取 col 标题(Col 内部、Form.Item 之后)
|
||||
const getColTitle = (option) => {
|
||||
return typeof option.colTitle === "function"
|
||||
? option.colTitle(getFormValues())
|
||||
: option.colTitle;
|
||||
};
|
||||
|
||||
// 获取 row 样式(FormList 的每一行)
|
||||
const getRowStyle = (option, field, fieldIndex) => {
|
||||
return typeof option.rowStyle === "function"
|
||||
? option.rowStyle(field, fieldIndex)
|
||||
: option.rowStyle;
|
||||
};
|
||||
|
||||
// 获取 row 标题(FormList 每行末尾)
|
||||
const getRowTitle = (option, field, fieldIndex) => {
|
||||
return typeof option.rowTitle === "function"
|
||||
? option.rowTitle(field, fieldIndex)
|
||||
: option.rowTitle;
|
||||
};
|
||||
|
||||
// 获取是否动态表单项
|
||||
const getIsDynamicFormItem = (option, formItemProps) => {
|
||||
return (option.shouldUpdate ?? option.dependencies) || (formItemProps.shouldUpdate ?? formItemProps.dependencies);
|
||||
};
|
||||
|
||||
// 获取 hidden
|
||||
const getHidden = (hidden) => {
|
||||
// 支持动态计算 hidden
|
||||
|
|
@ -264,7 +302,7 @@ const FormItemsRenderer = ({
|
|||
|
||||
case FORM_ITEM_RENDER_ENUM.SELECT:
|
||||
return (
|
||||
<Select placeholder={placeholder} showSearch allowClear optionFilterProp="children" {...componentProps}>
|
||||
<Select placeholder={placeholder} showSearch={{ optionFilterProp: "children" }} allowClear {...componentProps}>
|
||||
{(option.items || []).map((item) => {
|
||||
const { value, label, disabled } = getSelectableItemAttributes(item, itemsFieldKey);
|
||||
return (
|
||||
|
|
@ -420,8 +458,12 @@ const FormItemsRenderer = ({
|
|||
delete formItemProps.dependencies;
|
||||
delete formItemProps.shouldUpdate;
|
||||
|
||||
if (getHidden(option.hidden))
|
||||
return null;
|
||||
|
||||
return (
|
||||
<Col key={getKey(option) || index} span={col.span} style={style}>
|
||||
<Col key={getKey(option) || index} span={col.span} style={{ ...style, ...getColStyle(option) }}>
|
||||
{getColTitle(option)}
|
||||
<Form.Item
|
||||
name={option.name}
|
||||
label={renderLabel(option)}
|
||||
|
|
@ -470,7 +512,7 @@ const FormItemsRenderer = ({
|
|||
if (option.render === FORM_ITEM_RENDER_ENUM.DIVIDER) {
|
||||
return (
|
||||
<Col key={getKey(option) || index} span={col.span} style={style}>
|
||||
<Divider orientation="left" {...componentProps}>{option.label}</Divider>
|
||||
<Divider titlePlacement="start" {...componentProps}>{option.label}</Divider>
|
||||
</Col>
|
||||
);
|
||||
}
|
||||
|
|
@ -503,18 +545,19 @@ const FormItemsRenderer = ({
|
|||
const componentProps = getComponentProps(option);
|
||||
|
||||
return (
|
||||
<Col key={getKey(option) || index} span={col.span} style={style}>
|
||||
<Col key={getKey(option) || index} span={col.span} style={{ ...style, ...getColStyle(option) }}>
|
||||
{getColTitle(option)}
|
||||
<Form.List name={option.name} {...componentProps}>
|
||||
{(fields, { add, remove, move }) => (
|
||||
<>
|
||||
{fields.map((field, fieldIndex) => {
|
||||
const listOptions = getListOptions(formListUniqueProps.options, field, fieldIndex, add, remove, move);
|
||||
const rowStyle = getRowStyle(option, field, fieldIndex);
|
||||
const rowTitle = getRowTitle(option, field, fieldIndex);
|
||||
return (
|
||||
<Row gutter={gutter} key={field.key}>
|
||||
<Row gutter={gutter} key={field.key} style={rowStyle}>
|
||||
{rowTitle}
|
||||
{listOptions.map((listOption, listIndex) => {
|
||||
if (getHidden(listOption.hidden))
|
||||
return null;
|
||||
|
||||
const col = getCol(listOption);
|
||||
const formItemProps = getFormItemProps(listOption);
|
||||
|
||||
|
|
@ -532,7 +575,7 @@ const FormItemsRenderer = ({
|
|||
if (listOption.render === FORM_ITEM_RENDER_ENUM.FORM_LIST)
|
||||
return renderFormList(params);
|
||||
|
||||
if ((listOption.shouldUpdate ?? listOption.dependencies) || (formItemProps.shouldUpdate ?? formItemProps.dependencies))
|
||||
if (getIsDynamicFormItem(listOption, formItemProps))
|
||||
return renderDynamicFormItem(params);
|
||||
|
||||
// 判断一个项是否需要显示按钮(不是 onlyForLabel 且不是隐藏的)
|
||||
|
|
@ -562,8 +605,10 @@ const FormItemsRenderer = ({
|
|||
if (listIndex === lastShowIndex || isNextNestedFormList || isNextNoShow) {
|
||||
delete formItemProps.dependencies;
|
||||
delete formItemProps.shouldUpdate;
|
||||
|
||||
return (
|
||||
<Col key={getKey(listOption) || listIndex} span={col.span} style={style}>
|
||||
<Col key={getKey(listOption) || listIndex} span={col.span} style={{ ...style, ...getColStyle(listOption) }}>
|
||||
{getColTitle(listOption)}
|
||||
<Form.Item
|
||||
label={renderLabel(listOption)}
|
||||
labelCol={col.labelCol}
|
||||
|
|
@ -574,7 +619,7 @@ const FormItemsRenderer = ({
|
|||
{...formItemProps}
|
||||
>
|
||||
<div style={{ display: "flex", gap: 10, alignItems: "center", justifyContent: "space-between" }}>
|
||||
<div style={{ flex: 1 }}>
|
||||
<div style={{ flex: 1, minWidth: 0 }}>
|
||||
<Form.Item
|
||||
noStyle
|
||||
rules={getRules(listOption)}
|
||||
|
|
@ -632,9 +677,6 @@ const FormItemsRenderer = ({
|
|||
return (
|
||||
<>
|
||||
{options.map((option, index) => {
|
||||
if (getHidden(option.hidden))
|
||||
return null;
|
||||
|
||||
const col = getCol(option);
|
||||
const style = getStyle(index);
|
||||
const formItemProps = getFormItemProps(option);
|
||||
|
|
@ -657,7 +699,7 @@ const FormItemsRenderer = ({
|
|||
return renderFormList(params);
|
||||
|
||||
// 如果配置了 shouldUpdate 或 dependencies,使用 Form.Item 的联动机制
|
||||
if ((option.shouldUpdate ?? option.dependencies) || (formItemProps.shouldUpdate ?? formItemProps.dependencies))
|
||||
if (getIsDynamicFormItem(option, formItemProps))
|
||||
return renderDynamicFormItem(params);
|
||||
|
||||
// 普通表单项(静态配置)
|
||||
|
|
|
|||
|
|
@ -17,12 +17,14 @@ function HeaderBack(props) {
|
|||
<>
|
||||
<div
|
||||
className="back"
|
||||
onClick={() => history?.goBack?.() || window.history.back()}
|
||||
onClick={() => {
|
||||
history?.goBack ? history.goBack() : window.history.back();
|
||||
}}
|
||||
>
|
||||
<ArrowLeftOutlined style={{ fontSize: 14 }} />
|
||||
<span>返回</span>
|
||||
</div>
|
||||
<Divider type="vertical" style={{ backgroundColor: "#dcdfe6", marginLeft: 15, marginRight: 15 }} />
|
||||
<Divider orientation="vertical" style={{ backgroundColor: "#dcdfe6", marginLeft: 15, marginRight: 15 }} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ function HiddenInfo(props) {
|
|||
return (
|
||||
<div>
|
||||
<Spin spinning={loading || downloadFileLoading}>
|
||||
<Divider orientation="left">隐患信息</Divider>
|
||||
<Divider titlePlacement="start">隐患信息</Divider>
|
||||
<Descriptions
|
||||
bordered
|
||||
column={1}
|
||||
|
|
@ -193,7 +193,7 @@ function HiddenInfo(props) {
|
|||
{
|
||||
(info.hiddenUserPresetsCO && Object.keys(info.hiddenUserPresetsCO).length > 0) && (
|
||||
<>
|
||||
<Divider orientation="left">整改信息(发现人预填)</Divider>
|
||||
<Divider titlePlacement="start">整改信息(发现人预填)</Divider>
|
||||
<Descriptions
|
||||
bordered
|
||||
column={1}
|
||||
|
|
@ -223,7 +223,7 @@ function HiddenInfo(props) {
|
|||
{
|
||||
(info.hiddenConfirmUserCO && info.hiddenConfirmUserCO.length > 0) && (
|
||||
<>
|
||||
<Divider orientation="left">隐患确认</Divider>
|
||||
<Divider titlePlacement="start">隐患确认</Divider>
|
||||
{
|
||||
info.hiddenConfirmUserCO.map(item => (
|
||||
<Descriptions
|
||||
|
|
@ -256,7 +256,7 @@ function HiddenInfo(props) {
|
|||
{
|
||||
info.hiddenExtensionList && info.hiddenExtensionList.length > 0 && (
|
||||
<>
|
||||
<Divider orientation="left">延期信息</Divider>
|
||||
<Divider titlePlacement="start">延期信息</Divider>
|
||||
{
|
||||
info.hiddenExtensionList.map(item => (
|
||||
<Descriptions
|
||||
|
|
@ -319,7 +319,7 @@ function HiddenInfo(props) {
|
|||
{
|
||||
info.hiddenSpecialList && info.hiddenSpecialList.length > 0 && (
|
||||
<>
|
||||
<Divider orientation="left">特殊处置审核信息</Divider>
|
||||
<Divider titlePlacement="start">特殊处置审核信息</Divider>
|
||||
{
|
||||
info.hiddenSpecialList.map(item => (
|
||||
<Descriptions
|
||||
|
|
@ -405,7 +405,7 @@ function HiddenInfo(props) {
|
|||
{
|
||||
(info.hiddenRectifyUserCO && info.hiddenRectifyUserCO.length > 0) && (
|
||||
<>
|
||||
<Divider orientation="left">整改信息</Divider>
|
||||
<Divider titlePlacement="start">整改信息</Divider>
|
||||
{
|
||||
info.hiddenRectifyUserCO.map((item, index) => (
|
||||
<Descriptions
|
||||
|
|
@ -454,7 +454,7 @@ function HiddenInfo(props) {
|
|||
info.hiddenAcceptQualifiedUserCO.length > 0
|
||||
? (
|
||||
<>
|
||||
<Divider orientation="left">验收信息</Divider>
|
||||
<Divider titlePlacement="start">验收信息</Divider>
|
||||
{
|
||||
info.hiddenAcceptQualifiedUserCO.map((item, index) => (
|
||||
<Descriptions
|
||||
|
|
@ -482,7 +482,7 @@ function HiddenInfo(props) {
|
|||
info.hiddenAcceptUnqualifiedUserCO.length > 0
|
||||
? (
|
||||
<>
|
||||
<Divider orientation="left">验收打回信息</Divider>
|
||||
<Divider titlePlacement="start">验收打回信息</Divider>
|
||||
{
|
||||
info.hiddenAcceptUnqualifiedUserCO.map(item => (
|
||||
<Descriptions
|
||||
|
|
@ -507,7 +507,7 @@ function HiddenInfo(props) {
|
|||
(info.hiddenInspecCO && Object.keys(info.hiddenInspecCO).length > 0)
|
||||
? (
|
||||
<>
|
||||
<Divider orientation="left">安全环保验收信息</Divider>
|
||||
<Divider titlePlacement="start">安全环保验收信息</Divider>
|
||||
<Descriptions
|
||||
bordered
|
||||
column={1}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ const ImportFile = (props) => {
|
|||
open={visible}
|
||||
onCancel={handleClose}
|
||||
width={600}
|
||||
maskClosable={false}
|
||||
mask={{ closable: false }}
|
||||
footer={[
|
||||
templateUrl && (
|
||||
<Button key="export" onClick={handleExportTemplate}>
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@ export interface BasicLeftTreeProps extends Omit<TreeProps, "fieldNames"> {
|
|||
idKey?: string;
|
||||
/** 树形数据 children 字段,默认 children */
|
||||
childrenKey?: string;
|
||||
/** @deprecated 已弃用,请使用 getNodePathsIsIncludeOneself */
|
||||
onGetNodePathsIsIncludeOneself?: boolean;
|
||||
/** 决定 onGetNodePaths 是否包含自身节点,默认 true */
|
||||
getNodePathsIsIncludeOneself?: boolean;
|
||||
/** 获取父级节点 */
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ const BasicLeftTree = (props) => {
|
|||
onGetData,
|
||||
onSelect,
|
||||
onGetNodePaths,
|
||||
onGetNodePathsIsIncludeOneself,
|
||||
getNodePathsIsIncludeOneself = true,
|
||||
expandedKeys: externalExpandedKeys,
|
||||
treeData = [],
|
||||
|
|
@ -22,14 +21,6 @@ const BasicLeftTree = (props) => {
|
|||
...restProps
|
||||
} = props;
|
||||
|
||||
// 如果使用了已弃用的参数给出警告
|
||||
if (onGetNodePathsIsIncludeOneself !== undefined) {
|
||||
console.warn("【BasicLeftTree】 onGetNodePathsIsIncludeOneself 参数已弃用,请使用 getNodePathsIsIncludeOneself 参数");
|
||||
}
|
||||
|
||||
// 向后兼容,如果传入了旧参数,使用旧参数
|
||||
const finalGetNodePathsIsIncludeOneself = onGetNodePathsIsIncludeOneself !== undefined ? onGetNodePathsIsIncludeOneself : getNodePathsIsIncludeOneself;
|
||||
|
||||
const [expandedKeys, setExpandedKeys] = useState([]);
|
||||
const [searchValue, setSearchValue] = useState("");
|
||||
const [autoExpandParent, setAutoExpandParent] = useState(true);
|
||||
|
|
@ -90,7 +81,7 @@ const BasicLeftTree = (props) => {
|
|||
targetId: selectedNodeId,
|
||||
idKey,
|
||||
childrenKey,
|
||||
isIncludeOneself: finalGetNodePathsIsIncludeOneself,
|
||||
isIncludeOneself: getNodePathsIsIncludeOneself,
|
||||
});
|
||||
onGetNodePaths?.(parentNodes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ const MapSelector = (props) => {
|
|||
onCancel={handleClose}
|
||||
width={1000}
|
||||
destroyOnHidden={false}
|
||||
maskClosable={false}
|
||||
mask={{ closable: false }}
|
||||
afterClose={handleAfterClose}
|
||||
footer={[
|
||||
<Button key="back" onClick={handleClose}>
|
||||
|
|
|
|||
|
|
@ -61,7 +61,11 @@ function Page(props) {
|
|||
{customActionButtons || (
|
||||
<Space>
|
||||
{extraActionButtons}
|
||||
<Button onClick={() => history?.goBack?.() || window.history.back()}>
|
||||
<Button
|
||||
onClick={() => {
|
||||
history?.goBack ? history.goBack() : window.history.back();
|
||||
}}
|
||||
>
|
||||
{backButtonText}
|
||||
</Button>
|
||||
</Space>
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ function Pdf(props) {
|
|||
<Modal
|
||||
style={{ top: isFullscreen ? 0 : 100, maxWidth: isFullscreen ? "100vw" : "calc(100vw - 32px)", paddingBottom: isFullscreen ? 0 : 24 }}
|
||||
open={visible}
|
||||
maskClosable={false}
|
||||
mask={{ closable: false }}
|
||||
width={isFullscreen ? "100vw" : pdfWidth + 100}
|
||||
title={title}
|
||||
onCancel={() => {
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ function BasicSelect(props) {
|
|||
}, [data]);
|
||||
|
||||
return (
|
||||
<Select placeholder={`请选择${placeholder}`} showSearch allowClear optionFilterProp="children" onChange={handleChange} {...restProps}>
|
||||
<Select placeholder={`请选择${placeholder}`} showSearch={{ optionFilterProp: "children" }} allowClear onChange={handleChange} {...restProps}>
|
||||
{data.map((item) => {
|
||||
const value = item[idKey];
|
||||
const label = labelRender ? labelRender(item) : item[nameKey];
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@ export interface BasicSelectTreeProps extends Omit<TreeSelectProps, "fieldNames"
|
|||
idKey?: string;
|
||||
/** 树形数据 children 字段,默认 children */
|
||||
childrenKey?: string;
|
||||
/** @deprecated 已弃用,请使用 getNodePathsIsIncludeOneself */
|
||||
onGetNodePathsIsIncludeOneself?: boolean;
|
||||
/** 决定 onGetNodePaths 是否包含自身节点,默认 true */
|
||||
getNodePathsIsIncludeOneself?: boolean;
|
||||
/** 获取父级节点 */
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ function BasicSelectTree(props) {
|
|||
onChange,
|
||||
onGetLabel,
|
||||
onGetNodePaths,
|
||||
onGetNodePathsIsIncludeOneself,
|
||||
getNodePathsIsIncludeOneself = true,
|
||||
placeholder = "",
|
||||
treeData = [],
|
||||
|
|
@ -23,14 +22,6 @@ function BasicSelectTree(props) {
|
|||
...restProps
|
||||
} = props;
|
||||
|
||||
// 如果使用了已弃用的参数给出警告
|
||||
if (onGetNodePathsIsIncludeOneself !== undefined) {
|
||||
console.warn("【BasicSelectTree】 onGetNodePathsIsIncludeOneself 参数已弃用,请使用 getNodePathsIsIncludeOneself 参数");
|
||||
}
|
||||
|
||||
// 向后兼容,如果传入了旧参数,使用旧参数
|
||||
const finalGetNodePathsIsIncludeOneself = onGetNodePathsIsIncludeOneself !== undefined ? onGetNodePathsIsIncludeOneself : getNodePathsIsIncludeOneself;
|
||||
|
||||
const processedTreeData = useMemo(() => {
|
||||
// 根据 level 处理树数据
|
||||
let result = level
|
||||
|
|
@ -64,7 +55,7 @@ function BasicSelectTree(props) {
|
|||
targetId,
|
||||
idKey,
|
||||
childrenKey,
|
||||
isIncludeOneself: finalGetNodePathsIsIncludeOneself,
|
||||
isIncludeOneself: getNodePathsIsIncludeOneself,
|
||||
});
|
||||
parentNodes.push(...currentParentNodes);
|
||||
}
|
||||
|
|
@ -81,7 +72,7 @@ function BasicSelectTree(props) {
|
|||
targetId,
|
||||
idKey,
|
||||
childrenKey,
|
||||
isIncludeOneself: finalGetNodePathsIsIncludeOneself,
|
||||
isIncludeOneself: getNodePathsIsIncludeOneself,
|
||||
});
|
||||
onGetNodePaths?.(parentNodes);
|
||||
onGetLabel?.(parentNodes[parentNodes.length - 1][nameKey]);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ export interface Params {
|
|||
inType?: InType[];
|
||||
/** 企业类型 1-监管 2-企业 3-相关方 */
|
||||
enterpriseType?: EnterpriseType | EnterpriseType[];
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ function Signature(props) {
|
|||
title="签字"
|
||||
width={800}
|
||||
open={signatureModalOpen}
|
||||
maskClosable={false}
|
||||
mask={{ closable: false }}
|
||||
onCancel={() => setSignatureModalOpen(false)}
|
||||
footer={[
|
||||
<Button key="clear" onClick={() => signatureCanvas.current.clear()}>重签</Button>,
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ const Video = forwardRef(({
|
|||
关闭
|
||||
</Button>,
|
||||
]}
|
||||
maskClosable={false}
|
||||
mask={{ closable: false }}
|
||||
onCancel={() => setVisible(false)}
|
||||
>
|
||||
{playerElement}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@ export interface UseTableOptions<TData extends Data, TParams extends Params> ext
|
|||
params?: Record<string, any> | (() => Record<string, any>);
|
||||
/** 表单数据转换函数,在每次请求之前调用,接收当前搜索的表单项,要求返回一个对象 */
|
||||
transform?: (formData: FormValues) => FormValues;
|
||||
/** @deprecated 已弃用,请使用 onSuccess */
|
||||
callback?: (list: any[], data: any) => void;
|
||||
/** 表单实例(通过 Form.useForm() 创建) */
|
||||
form?: FormInstance;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,13 +96,6 @@ function useTable(service, options) {
|
|||
},
|
||||
);
|
||||
|
||||
if (restOptions.callback !== undefined) {
|
||||
console.warn("【useTable】 callback 参数已弃用,请使用 onSuccess 参数");
|
||||
}
|
||||
|
||||
// 执行回调函数
|
||||
restOptions.callback && restOptions.callback(res?.data?.list || [], res?.data || {});
|
||||
|
||||
// 返回结果
|
||||
return {
|
||||
...res,
|
||||
|
|
|
|||
Loading…
Reference in New Issue