import { Snippet } from '@alilc/lowcode-types'; const getColumns = () => { return [ { title: '姓名', dataIndex: 'name', valueType: 'text', }, { title: '年龄', dataIndex: 'age', valueType: 'digit', }, { title: '任务状态', dataIndex: 'status', renderTag: true, valueEnum: { all: { text: '全部', status: 'Default' }, close: { text: '关闭', status: 'Default' }, running: { text: '运行中', status: 'Processing' }, online: { text: '已上线', status: 'Success' }, error: { text: '异常', status: 'Error' }, }, } ]; }; const getDataSource = () => { return [ { id: '1', name: '小王', age: 30, link: 'https://www.chinaunicom.com/', loan: 700000, trade_progress: 17, address: '公园路1号', create_time: '2022-04-21 21:00', status: 'close', }, { id: '2', name: '小李', age: 28, link: 'https://www.chinaunicom.com/', loan: 600000, trade_progress: 36, address: '滨海路699号', create_time: '2022-04-21 22:00', status: 'running', }, ]; }; export const snippets: Snippet[] = [ { title: '可编辑表格', screenshot: 'https://alifd.alicdn.com/fusion-cool/icons/icon-antd/table-1.png', schema: { componentName: 'ProEditableTable', props: { cardBordered: true, value: getDataSource(), columns: [ ...getColumns(), { title: '操作', dataIndex: 'options', valueType: 'option', align: 'left', fixed: '', render: { type: 'JSSlot', params: ['text', 'record', 'index'], value: [ { componentName: 'Button', props: { type: 'link', children: '编辑', htmlType: 'button', size: 'small', shape: 'default', block: false, danger: false, ghost: false, disabled: false, icon: '', }, }, { componentName: 'ProPopconfirm', props: { title: '确定删除?', okType: 'primary', okText: '确定', cancelText: '取消', }, children: [ { componentName: 'Button', props: { children: '删除', htmlType: 'button', type: 'link', size: 'small', shape: 'default', block: false, danger: true, ghost: false, disabled: false, icon: '', }, }, ], }, ], }, }, ], rowKey: 'id', pagination: false, search: false, rowSelection: false, toolBarRender: false, scroll: false, intl: 'zhCNIntl', }, }, }, ];