ideaz-element
Version:
<p align="center"> <a href="" target="_blank" rel="noopener noreferrer"> <img src="./docs/public/logo.svg" alt="Ideaz Element" width="180" style="width: 180px;" /> </a> </p>
1 lines • 6.91 kB
Source Map (JSON)
{"version":3,"file":"props.cjs","sources":["../../../../../packages/element/crud/src/props.ts"],"sourcesContent":["import { omit } from 'lodash-unified'\nimport type { ExtractPropTypes, VNode } from 'vue'\nimport type { ComponentSize, ElTable } from 'element-plus'\nimport { tableProps } from '../../table/src/props'\nimport { formProps } from '../../form/src/props'\nimport type { DialogProps } from '../../dialog/src/props'\nimport type { AddRequestApiParams, CrudCol, DeleteRequestApiParams, DetailRequestApiParams, EditRequestApiParams, TableFormConfig } from '../../types'\nimport type ZTable from '../../table/src/Table'\n\nconst _tableProps = omit(tableProps, 'columns')\n// const _formProps = omit(formProps, 'columns')\n\ntype FormKeys = Array<keyof typeof formProps>\ntype TableKeys = Array<keyof typeof tableProps>\n\nexport const tableKeys = Object.keys(_tableProps) as TableKeys\nexport const formKeys = Object.keys(formProps) as FormKeys\n\nexport interface CrudDeleteDialogConfirmParams<T = any> {\n done: () => void\n confirmButtonLoading: Ref<boolean>\n selectionData?: T[]\n row?: T\n tableRef: typeof ZTable\n getTableData: () => void\n}\n\nexport type CrudDeleteDialogTipProps<T = any> = Omit<DialogProps, 'onConfirm'> & {\n onConfirm: ({ done, confirmButtonLoading, selectionData, row, tableRef }: CrudDeleteDialogConfirmParams<T>) => void\n}\n\nexport interface RequestConfig {\n deleteApi?: (params?: DeleteRequestApiParams) => Promise<any>\n submitApi?: (params?: AddRequestApiParams | EditRequestApiParams) => Promise<any>\n searchApi?: (params?: any) => Promise<any>\n addApi?: (params?: AddRequestApiParams) => Promise<any>\n editApi?: (params?: EditRequestApiParams) => Promise<any>\n detailApi?: (params: DetailRequestApiParams) => Promise<any>\n alias?: {\n list: string | ((res: any) => any)\n total: string | ((res: any) => any)\n detail: string | ((res: any) => any)\n }\n beforeData?: () => Promise<any>\n afterData?: (res: any) => Promise<any>\n searchFunc?: ({ params }: any) => void\n tableData?: (res: any) => any\n}\n\nexport interface AlertConfig {\n render?: (selectionData: any) => VNode\n title?: string | ((selectionData: any, tableRef: typeof ElTable) => VNode)\n type?: 'success' | 'warning' | 'info' | 'error'\n description?: string | ((selectionData: any, tableRef: typeof ElTable) => VNode)\n closeable?: boolean\n center?: boolean\n closeText?: string\n showIcon?: boolean\n effect?: 'light' | 'dark'\n}\n\nexport interface CrudOperation extends TableFormConfig {\n referenceLabel?: string\n referenceDisabled?: boolean | (() => boolean)\n referenceHide?: boolean | (() => boolean)\n}\n\nexport const crudProps = {\n ..._tableProps,\n // ..._formProps,\n size: {\n type: String as PropType<ComponentSize>,\n default: 'small',\n },\n columns: Array as PropType<CrudCol[]>,\n formData: {\n type: Object as PropType<any>,\n default: () => ({}),\n },\n selectionData: {\n type: Array as PropType<any>,\n },\n tableDecorator: {\n type: Object as PropType<any>,\n default: () => ({}),\n },\n formDecorator: {\n type: Object as PropType<any>,\n default: () => ({}),\n },\n name: {\n type: String,\n default: '',\n },\n paginationStorage: {\n type: Boolean,\n default: undefined,\n },\n formStorage: {\n type: Boolean,\n default: undefined,\n },\n request: {\n type: Object as PropType<RequestConfig>,\n },\n export: {\n type: [Function, String],\n },\n add: {\n type: [Object, Boolean] as PropType<TableFormConfig | boolean>,\n default: true,\n },\n edit: {\n type: [Object, Boolean] as PropType<CrudOperation | boolean>,\n default: true,\n },\n search: {\n type: [Object, Boolean] as PropType<TableFormConfig | boolean>,\n default: true,\n },\n form: {\n type: [Object, Boolean] as PropType<TableFormConfig | boolean>,\n default: true,\n },\n detail: {\n type: [Object, Boolean, Function] as PropType<CrudOperation | boolean | (({ row, tableRef }: { row: any, tableRef: typeof ZTable }) => void)>,\n default: true,\n },\n delete: {\n type: [Boolean, Function, Object] as PropType<boolean | (({ row, tableRef, getTableData }: { row: any, tableRef: typeof ZTable, getTableData: (() => void) }) => void) | (CrudDeleteDialogTipProps & CrudOperation)>,\n default: true,\n },\n dialog: {\n type: Object as PropType<any>,\n default: () => ({}),\n },\n drawer: {\n type: Object as PropType<any>,\n default: () => ({}),\n },\n addFormData: {\n type: Object as PropType<any>,\n default: () => ({}),\n },\n editFormData: {\n type: Object as PropType<any>,\n default: () => ({}),\n },\n onOperateCancel: {\n type: Function,\n },\n onOperateView: {\n type: Function,\n },\n dataKey: {\n type: String,\n default: 'id',\n },\n alert: {\n type: [Object, Function, Boolean] as PropType<AlertConfig | ((selectionData: any) => VNode | boolean)>,\n default: () => ({}),\n },\n action: {\n type: Boolean,\n default: true,\n },\n}\n\nexport type CrudProps = ExtractPropTypes<typeof crudProps>\nexport const crudProvideKey = Symbol('crudKey')\nexport const EXCLUDE_FORM_PROPS_KEYS = ['columns', 'dialog']\nexport const COLUMN_TYPE_FIELDS = ['type', 'slot', 'label', 'render', 'prop', '__uid', 'component']\n\nexport const FILTER_TABLE_KEYS = ['watermark']\n"],"names":["_tableProps","omit","props","tableKeys","formKeys","props$1","crudProps","crudProvideKey","EXCLUDE_FORM_PROPS_KEYS","COLUMN_TYPE_FIELDS","FILTER_TABLE_KEYS"],"mappings":"2ZASAA,EAAAC,EAAAC,EAAA,WAAA,SAAA,EAMaC,EAAA,OAAA,KAAAH,CAAA,EACAI,EAAA,OAAA,KAAAC,EAAA,SAAA,EAmDNC,EAAA,CAAkB,GAAAN,EACpB,KAAA,CAEG,KAAA,OACE,QAAA,OACG,EACX,QAAA,MACS,SAAA,CACC,KAAA,OACF,QAAA,KAAA,CAAA,EACW,EACnB,cAAA,CACe,KAAA,KACP,EACR,eAAA,CACgB,KAAA,OACR,QAAA,KAAA,CAAA,EACW,EACnB,cAAA,CACe,KAAA,OACP,QAAA,KAAA,CAAA,EACW,EACnB,KAAA,CACM,KAAA,OACE,QAAA,EACG,EACX,kBAAA,CACmB,KAAA,QACX,QAAA,MACG,EACX,YAAA,CACa,KAAA,QACL,QAAA,MACG,EACX,QAAA,CACS,KAAA,MACD,EACR,OAAA,CACQ,KAAA,CAAA,SAA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