import React from 'react'; import PropTypes from 'prop-types'; /** * 处理表格列配置:为每列注入 onCell,并按 middlewares/widgetByJs 组装渲染中间件链(通过 DataConverter)生成最终的 render 函数 * @param {Array} columns 原始列配置(可能包含 widgetByJs/widgetByJsSetting/middlewares/render) * @param {Object} [base62params={}] 分页/查询参数,仅作为依赖项触发重新计算 * @returns {Array} 处理后可直接传给 antd Table 的列配置 */ declare function useColumnsRender(columns: Array, base62params?: any): Array; /** * 补全 antd Table 的 components 配置,确保 body.cell 默认使用可编辑单元格组件 DataListCellEditable * @param {Object} [components={}] 原始 components 配置 * @returns {Object} 补全后的 components 配置 */ declare function useCellEditableComponents(components?: any): any; /** * 根据 listCode 拉取列表结构配置(字段/列/分页/布局等元数据) * @param {string} listCode 列表标识 * @returns {Object} 列表结构配置,请求完成前为空对象 */ declare function useStructure(listCode: string): any; /** * 根据 listCode 及查询参数拉取列表数据 * @param {string} listCode 列表标识 * @param {Object} [base62params={}] 查询参数,会与 page:1 合并后进行 base62 编码请求 * @returns {Object} 接口返回的数据,包含 dataSource 等字段;请求完成前为 { dataSource: [] } */ declare function useDataSource(listCode: string, base62params?: any): any; /** * 生成一个按权限映射过滤某行数据可用行内操作按钮的函数 * @param {Array} [itemOperations=[]] 行内操作按钮配置 * @param {Map} [itemOperationsAccess=new Map] 操作 uuid 到有权限的数据主键列表的映射 * @param {string} [pk='id'] 主键字段名 * @param {string} [resource] 数据嵌套的资源字段名(主键从 data[resource][pk] 取值) * @returns {(data: Object) => Array} 传入一行数据,返回其可用操作按钮列表 */ declare function useItemOperationsAccess(itemOperations?: Array, itemOperationsAccess?: Map, pk?: string, resource?: string): (data: any) => Array; /** * 判断是否需要渲染操作列:操作按钮需通过全局权限校验(auth.check),且(若配置了行级权限映射)当前数据中至少一行拥有权限 * @param {Array} [operations=[]] 操作按钮配置 * @param {Map} [itemOperationsAccess=new Map] 操作 uuid 到有权限的数据主键列表的映射 * @param {Array} [dataSource=[]] 当前页数据 * @param {string} [pk='id'] 主键字段名 * @param {string} [resource] 数据嵌套的资源字段名 * @returns {boolean} 是否存在可展示的操作列 */ declare function useHasOperationColumn(operations?: Array, itemOperationsAccess?: Map, dataSource?: Array, pk?: string, resource?: string): boolean; /** * 生成行内/批量操作点击后的处理逻辑:isRefresh=1 触发整体刷新(onReload),isRefresh=2 仅拉取该行最新详情与权限并合并回 dataSource(局部刷新) * @param {Object} props 列表状态,须包含 dataSource/itemOperationsAccess/onReload * @param {string} listCode 列表标识 * @param {string} [primaryKey='id'] 主键字段名 * @param {string} [resource=null] 数据嵌套的资源字段名 * @returns {[Object, (isRefresh: number, item?: Object) => void]} 元组:可能已合并局部刷新结果的 props,以及操作点击回调 */ declare function useOperationCallback(props: any, listCode: string, primaryKey?: string, resource?: string): [any, (isRefresh: number, item?: any) => void]; /** * 组合式获取并管理列表数据(分页/tab/筛选条件/侧边栏/关键字等),供 DataListHelper 使用 * @param {string} listCode 列表标识 * @param {Object} base62params 初始查询参数 * @returns {Object} 列表状态与操作方法(dataSource/tab/page/pageSize/condition/sider/keyword/total/itemOperationsAccess/onXxxChange/onReload/payload 等) */ declare function useDataListHelper(listCode: string, base62params: any): any; /** * 数据列表根组件:根据 isItemGridLayout 选择宫格(DataListFramework)或表格(DataTableFramework)布局, * 也可通过 theme 动态加载自定义主题组件替代默认布局;并通过 DataListContext 向下透传分页/筛选/选中等状态与操作方法 * @param {Object} props * @param {boolean} [props.isItemGridLayout] 是否使用宫格布局(否则使用表格布局,theme 设置时忽略) * @param {string} [props.theme] 自定义主题组件标识,设置后通过 core.getWidgetComponent 动态加载并替代默认布局 * @param {Object} [props.themeProps] 传给自定义主题组件的 $setting * @param {Function} [props.onClickCallback] 行内/批量操作点击后的回调 * @param {Function} [props.onReload] 刷新回调 * @param {string} [props.listCode] 列表标识 * @param {number} [props.total=0] 数据总条数 * @param {number} [props.page=0] 当前页码 * @param {Function} [props.onPageChange] 页码变更回调 * @param {number} [props.pageSize=30] 每页条数 * @param {Function} [props.onPageSizeChange] 每页条数变更回调 * @param {*} [props.tab] 当前选中的 tab * @param {Function} [props.onTabChange] tab 变更回调 * @param {string} [props.keyword] 关键字搜索值 * @param {Function} [props.onKeywordChange] 关键字变更回调 * @param {Object} [props.condition] 筛选条件 * @param {Function} [props.onConditionChange] 筛选条件变更回调 * @param {*} [props.sider] 侧边栏选中值 * @param {Function} [props.onSiderChange] 侧边栏选中值变更回调 * @param {boolean|Object} [props.layouts] 自定义子布局组件集合(sider/filter/footer/toolbar/empty),false 表示全部隐藏 * @param {Object} [props.classNames={}] 各区块自定义 className * @param {Object} [props.payload={}] 附加请求参数 * @param {Array} [props.dataSource=[]] 列表数据 * @param {Object} [props.rowSelection] 行选择配置 * @param {Function} [props.getSelectedRows] 获取已选中行的方法,未提供时默认返回 dataSource * @param {string} [props.primaryKey] 主键字段名 */ declare function DataList({ isItemGridLayout, theme, themeProps, onClickCallback, onReload, listCode, total, page, onPageChange, pageSize, onPageSizeChange, tab, onTabChange, keyword, onKeywordChange, condition, onConditionChange, sider, onSiderChange, layouts, classNames, payload, dataSource, rowSelection, getSelectedRows: getSelectedRowsProp, primaryKey, ...props }: { isItemGridLayout?: boolean; theme?: string; themeProps?: any; onClickCallback?: Function; onReload?: Function; listCode?: string; total?: number; page?: number; onPageChange?: Function; pageSize?: number; onPageSizeChange?: Function; tab?: any; onTabChange?: Function; keyword?: string; onKeywordChange?: Function; condition?: any; onConditionChange?: Function; sider?: any; onSiderChange?: Function; layouts?: boolean | any; classNames?: any; payload?: any; dataSource?: any[]; rowSelection?: any; getSelectedRows?: Function; primaryKey?: string; }): React.JSX.Element; declare namespace DataList { namespace propTypes { let classNames: PropTypes.Requireable; filter: PropTypes.Requireable; footer: PropTypes.Requireable; toolbar: PropTypes.Requireable; container: PropTypes.Requireable; content: PropTypes.Requireable; item: PropTypes.Requireable; empty: PropTypes.Requireable; }>>>; let layouts: PropTypes.Requireable>; filter: PropTypes.Requireable>; footer: PropTypes.Requireable>; toolbar: PropTypes.Requireable>; empty: PropTypes.Requireable>; }>>>>; } } /** * 列表筛选区:isConditionFormLayout 为 true 时拉取后台配置的条件表单结构并渲染 GridLayoutForm,否则渲染默认的关键字搜索框 * @param {Object} props * @param {string} [props.className] 自定义 className * @param {boolean} [props.isConditionFormLayout] 是否使用后台配置的条件表单布局 */ declare function DataListFilter({ className, isConditionFormLayout }: { className?: string; isConditionFormLayout?: boolean; }): React.JSX.Element; declare namespace DataListFilter { let reservedFields: { x: number; y: number; h: number; w: number; field: { isVirtual: boolean; widgetPrefix: string; widget: string; code: string; label: string; placeholder: string; extras: { prefix: string; }; }; }[]; } /** * 列表工具栏:展示标题、tab 面包屑导航以及刷新等操作按钮 * @param {Object} props * @param {string} [props.className] 自定义 className * @param {string} [props.title] 列表标题 * @param {Array} [props.tabs] tab 配置列表 */ declare function DataListToolbar({ className, title, tabs }: { className?: string; title?: string; tabs?: Array; }): React.JSX.Element; /** * 列表侧边栏:isTreeSider 为 true 时渲染目录树(当前 treeData 为占位示例数据) * @param {Object} props * @param {string} [props.className] 自定义 className * @param {number} [props.width=280] 侧边栏宽度 * @param {boolean} [props.isTreeSider] 是否渲染树形侧边栏 */ declare function DataListSider({ className, width, isTreeSider }: { className?: string; width?: number; isTreeSider?: boolean; }): React.JSX.Element; /** * 列表底部:渲染批量操作按钮与分页器;operations 为空且不分页时不渲染任何内容 * @param {Object} props * @param {string} [props.className] 自定义 className * @param {Array} [props.operations] 批量操作按钮配置 * @param {boolean} [props.isOperations] 是否展示批量操作按钮 * @param {boolean} [props.isPaginate] 是否展示分页器 */ declare function DataListFooter({ className, operations, isOperations, isPaginate }: { className?: string; operations?: Array; isOperations?: boolean; isPaginate?: boolean; }): React.JSX.Element; /** * DataList 的开箱即用封装:根据 listCode 自动拉取结构与数据、管理分页/筛选/选中等状态, * 并通过 ref 暴露 onReload/onClickCallback/getSelectedRows * @param {Object} props * @param {string} props.listCode 列表标识 * @param {Object} [props.base62params] 初始查询参数 * @param {string} [props.className] 自定义 className * @param {string} [props.theme] 自定义主题组件标识,未传时使用结构配置中的 theme * @param {Object} [props.themeProps] 传给主题组件的 $setting,会与结构配置中的 themeConfig 合并 * @param {boolean|Object} [props.layouts] 自定义子布局组件集合 * @param {Object} [props.classNames] 各区块自定义 className * @param {Object} [props.rowSelection] 行选择配置(type/selectedRowKeys/defaultSelectedRowKeys/onChange 等) * @param {(dataSource: Array, meta: Object) => void} [props.onDataSourceChange] dataSource 变更后的回调 */ declare const DataListHelper: React.ForwardRefExoticComponent>; declare const _default: React.Context<{ listCode: string; classNames: {}; getBase62params: (k: any, defaultValue: any) => void; getSelectedRows: () => any[]; onReload: () => void; onClickCallback: () => void; onConditionChange: () => void; onTabChange: () => void; onSiderChange: () => void; onKeywordChange: () => void; onPageChange: () => void; onPageSizeChange: () => void; reload: () => void; setPage: () => void; setPageSize: () => void; setTab: () => void; setSider: () => void; setKeyword: () => void; setCondition: () => void; }>; /** * 列表表格视图:在 antd Table 基础上支持列宽按容器自适应缩放、单元格可编辑、默认展开行等能力 * @param {Object} props * @param {string} [props.className] 自定义 className * @param {string} [props.primaryKey] 主键字段名 * @param {Array} [props.columns=[]] 列配置 * @param {Array} [props.dataSource=[]] 表格数据 * @param {(record: Object, index: number) => *} [props.operationRender] 操作列渲染函数,提供时会追加一列操作列 * @param {number} [props.operationWidth=180] 操作列宽度 * @param {Object} [props.components={}] antd Table 的 components 配置 * @param {Object} [props.rowSelection] 行选择配置 */ declare function DataListTable({ className, primaryKey, columns, dataSource, operationRender, operationWidth, components, rowSelection, ...props }: { className?: string; primaryKey?: string; columns?: Array; dataSource?: Array; operationRender?: (record: any, index: number) => any; operationWidth?: number; components?: any; rowSelection?: any; }): React.JSX.Element; /** * 列表宫格(卡片)视图:基于 GridLayout 渲染每条数据的卡片,并处理行选中状态 * @param {Object} props * @param {number} [props.column=0] 每行列数 * @param {number} [props.colWidth=0] 列宽 * @param {number} [props.cols] GridLayout 栅格总列数 * @param {number} [props.rowHeight] 行高 * @param {[number, number]} [props.itemMargin] 卡片间距 [marginX, marginY] * @param {*} [props.containerPadding] 容器内边距 * @param {Array} [props.fields] 卡片内字段/组件布局配置 * @param {string} [props.primaryKey] 主键字段名 * @param {Array} [props.dataSource] 列表数据 * @param {(dataSource: Array) => *} [props.beforeRender=null] 数据渲染前的额外内容 * @param {(dataSource: Array) => *} [props.afterRender=null] 数据渲染后的额外内容 * @param {string} [props.itemClassName] 传给每张卡片(itemRender.children)的 className * @param {(children: *, data: Object, index: number) => *} [props.itemRender] 卡片渲染包装函数 * @param {*} [props.empty] 空数据时展示的内容 * @param {string} [props.className] 自定义 className * @param {Object} [props.style={}] 容器行内样式 * @param {string} [props.theme] GridLayout 主题 * @param {Object} [props.themeProps={}] GridLayout 主题参数 * @param {Array} [props.groups=[{ key: 'default', label: '默认' }]] 分组配置 * @param {Object} [props.rowSelection] 行选择配置(selectedRowKeys/onChange/type) */ declare function DataListContent({ column, colWidth, cols, rowHeight, itemMargin, containerPadding, fields, primaryKey, dataSource, beforeRender, afterRender, itemClassName, itemRender, empty, className, style, theme, themeProps, groups, rowSelection, }: { column?: number; colWidth?: number; cols?: number; rowHeight?: number; itemMargin?: [number, number]; containerPadding?: any; fields?: Array; primaryKey?: string; dataSource?: Array; beforeRender?: (dataSource: any[]) => any; afterRender?: (dataSource: any[]) => any; itemClassName?: string; itemRender?: (children: any, data: any, index: number) => any; empty?: any; className?: string; style?: any; theme?: string; themeProps?: any; groups?: Array; rowSelection?: any; }): React.JSX.Element; /** * 宫格列表整体布局:组合侧边栏/筛选/工具栏/内容(卡片列表)/底部分页等子区块,并为每条数据包装行内操作按钮 * @param {Object} props * @param {string} [props.listCode] 列表标识 * @param {string} [props.className] 自定义 className * @param {Object} [props.layouts={}] 子布局组件集合 { sider, filter, toolbar, footer, empty } * @param {Array} [props.dataSource] 列表数据 * @param {boolean} [props.isPaginate] 是否分页 * @param {boolean} [props.isItemOperations] 是否展示行内操作按钮 * @param {boolean} [props.isBatchOperations] 是否展示批量操作按钮 * @param {Array} [props.batchOperations] 批量操作按钮配置 * @param {Array} [props.itemOperations] 行内操作按钮配置 * @param {Map} [props.itemOperationsAccess] 行内操作权限映射 * @param {string} [props.resource] 数据嵌套的资源字段名 * @param {string} [props.primaryKey] 主键字段名 * @param {string} [props.title] 列表标题 * @param {Object} [props.itemGridLayout] 卡片宫格布局配置,透传给 DataListContent * @param {Object} [props.$setting] 主题设置,包含 column/colWidth/beforeRender/afterRender/style/itemMargin/containerPadding/isMarkSelected * @param {Array} [props.tabs] tab 配置 * @param {boolean} [props.isConditionFormLayout] 是否使用条件表单布局 * @param {boolean} [props.isTreeSider] 是否展示树形侧边栏 * @param {Object} [props.treeSiderConfig] 树形侧边栏配置 * @param {Object} [props.rowSelection] 行选择配置 */ declare function DataListFramework({ listCode, className, layouts, dataSource, isPaginate, isItemOperations, isBatchOperations, batchOperations, itemOperations, itemOperationsAccess, resource, primaryKey, title, itemGridLayout, $setting, tabs, isConditionFormLayout, isTreeSider, treeSiderConfig, rowSelection, }: { listCode?: string; className?: string; layouts?: any; dataSource?: Array; isPaginate?: boolean; isItemOperations?: boolean; isBatchOperations?: boolean; batchOperations?: Array; itemOperations?: Array; itemOperationsAccess?: Map; resource?: string; primaryKey?: string; title?: string; itemGridLayout?: any; $setting?: any; tabs?: Array; isConditionFormLayout?: boolean; isTreeSider?: boolean; treeSiderConfig?: any; rowSelection?: any; }): React.JSX.Element; /** * 表格列表整体布局:组合侧边栏/筛选/工具栏/表格(DataListTable)/底部分页等子区块,并按权限计算操作列 * @param {Object} props * @param {string} [props.listCode] 列表标识 * @param {string} [props.className] 自定义 className * @param {Object} [props.layouts={}] 子布局组件集合 { sider, filter, toolbar, footer } * @param {Array} [props.dataSource] 表格数据 * @param {Array} [props.columns] 表格列配置 * @param {boolean} [props.isItemOperations] 是否展示行内操作按钮(结合权限计算实际是否展示操作列) * @param {boolean} [props.isBatchOperations] 是否展示批量操作按钮 * @param {Array} [props.batchOperations] 批量操作按钮配置 * @param {Array} [props.itemOperations] 行内操作按钮配置 * @param {Map} [props.itemOperationsAccess] 行内操作权限映射 * @param {string} [props.resource] 数据嵌套的资源字段名 * @param {string} [props.primaryKey] 主键字段名 * @param {string} [props.title] 列表标题 * @param {Array} [props.tabs] tab 配置 * @param {boolean} [props.isPaginate] 是否分页 * @param {Object} [props.rowSelection] 行选择配置 * @param {boolean} [props.isTreeSider] 是否展示树形侧边栏 * @param {Object} [props.treeSiderConfig] 树形侧边栏配置 * @param {boolean} [props.isConditionFormLayout] 是否使用条件表单布局 */ declare function DataTableFramework({ listCode, className, layouts, dataSource, columns, isItemOperations, isBatchOperations, batchOperations, itemOperations, itemOperationsAccess, resource, primaryKey, title, tabs, isPaginate, rowSelection, isTreeSider, treeSiderConfig, isConditionFormLayout, ...props }: { listCode?: string; className?: string; layouts?: any; dataSource?: Array; columns?: Array; isItemOperations?: boolean; isBatchOperations?: boolean; batchOperations?: Array; itemOperations?: Array; itemOperationsAccess?: Map; resource?: string; primaryKey?: string; title?: string; tabs?: Array; isPaginate?: boolean; rowSelection?: any; isTreeSider?: boolean; treeSiderConfig?: any; isConditionFormLayout?: boolean; }): React.JSX.Element; export { DataListContent, _default as DataListContext, DataListFilter, DataListFooter, DataListFramework, DataListHelper, DataListSider, DataListTable, DataListToolbar, DataTableFramework, DataList as default, useCellEditableComponents, useColumnsRender, useDataListHelper, useDataSource, useHasOperationColumn, useItemOperationsAccess, useOperationCallback, useStructure };