fast-element-plus 2.0.20 → 2.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/component.d.ts +15 -15
- package/dist/components/avatar/index.d.ts +3 -3
- package/dist/components/avatar/index.mjs.map +1 -1
- package/dist/components/button/index.d.ts +3 -3
- package/dist/components/button/index.mjs.map +1 -1
- package/dist/components/button/src/button.d.ts +1 -1
- package/dist/components/carNumber/index.d.ts +1 -1
- package/dist/components/carNumber/index.mjs.map +1 -1
- package/dist/components/contextMenu/index.d.ts +1 -1
- package/dist/components/contextMenu/index.mjs.map +1 -1
- package/dist/components/contextMenu/src/contextMenu.type.d.ts +1 -1
- package/dist/components/dialog/index.d.ts +3 -3
- package/dist/components/dialog/index.mjs.map +1 -1
- package/dist/components/dialog/src/dialog.d.ts +3 -3
- package/dist/components/drawer/index.d.ts +3 -3
- package/dist/components/drawer/index.mjs.map +1 -1
- package/dist/components/drawer/src/drawer.d.ts +3 -3
- package/dist/components/form/index.d.ts +4 -4
- package/dist/components/form/index.mjs.map +1 -1
- package/dist/components/form/utils/form.d.ts +2 -2
- package/dist/components/form/utils/form.mjs +2 -2
- package/dist/components/form/utils/form.mjs.map +1 -1
- package/dist/components/formItemTip/index.d.ts +2 -2
- package/dist/components/formItemTip/index.mjs.map +1 -1
- package/dist/components/icon/index.d.ts +2 -2
- package/dist/components/icon/index.mjs.map +1 -1
- package/dist/components/iconSelector/index.d.ts +1 -1
- package/dist/components/iconSelector/index.mjs.map +1 -1
- package/dist/components/image/index.d.ts +2 -2
- package/dist/components/image/index.mjs.map +1 -1
- package/dist/components/image/src/image.d.ts +1 -1
- package/dist/components/inputDialogPage/index.d.ts +3 -3
- package/dist/components/inputDialogPage/index.mjs.map +1 -1
- package/dist/components/layoutGrid/index.d.ts +2 -2
- package/dist/components/layoutGrid/index.mjs.map +1 -1
- package/dist/components/select/index.d.ts +4 -4
- package/dist/components/select/index.mjs.map +1 -1
- package/dist/components/select/src/select.d.ts +1 -1
- package/dist/components/select/src/select.type.d.ts +2 -2
- package/dist/components/selectPage/index.d.ts +3 -3
- package/dist/components/selectPage/index.mjs.map +1 -1
- package/dist/components/selectPage/src/selectPage.d.ts +1 -1
- package/dist/components/selectV2/index.d.ts +3 -3
- package/dist/components/selectV2/index.mjs.map +1 -1
- package/dist/components/selectV2/src/selectV2.d.ts +1 -1
- package/dist/components/table/index.d.ts +4 -4
- package/dist/components/table/index.mjs.map +1 -1
- package/dist/components/table/src/page.type.d.ts +2 -2
- package/dist/components/table/src/table.mjs +20 -20
- package/dist/components/table/src/table.mjs.map +1 -1
- package/dist/components/table/src/table.type.d.ts +5 -5
- package/dist/components/table/src/table.type.mjs.map +1 -1
- package/dist/components/table/src/tableColumn.d.ts +2 -2
- package/dist/components/table/src/tableColumn.mjs +34 -28
- package/dist/components/table/src/tableColumn.mjs.map +1 -1
- package/dist/components/table/utils/table.d.ts +18 -15
- package/dist/components/table/utils/table.mjs +20 -17
- package/dist/components/table/utils/table.mjs.map +1 -1
- package/dist/components/tree/index.d.ts +3 -3
- package/dist/components/tree/index.mjs.map +1 -1
- package/dist/components/tree/src/tree.props.d.ts +2 -2
- package/dist/components/tree/src/tree.type.d.ts +2 -2
- package/dist/components/treeSelect/index.d.ts +3 -3
- package/dist/components/treeSelect/index.mjs.map +1 -1
- package/dist/components/treeSelect/src/treeSelect.d.ts +1 -1
- package/dist/components/upload/index.d.ts +3 -3
- package/dist/components/upload/index.mjs.map +1 -1
- package/dist/components/upload/utils/upload.d.ts +15 -10
- package/dist/components/upload/utils/upload.mjs +15 -10
- package/dist/components/upload/utils/upload.mjs.map +1 -1
- package/dist/components/uploadImage/index.d.ts +3 -3
- package/dist/components/uploadImage/index.mjs.map +1 -1
- package/dist/components/uploadImages/index.d.ts +3 -3
- package/dist/components/uploadImages/index.mjs.map +1 -1
- package/dist/index.global.min.js +4 -4
- package/dist/index.global.min.js.map +1 -1
- package/dist/internal/props.d.ts +1 -1
- package/dist/internal/props.mjs.map +1 -1
- package/dist/utils/async/index.d.ts +4 -4
- package/dist/utils/async/index.mjs +9 -9
- package/dist/utils/async/index.mjs.map +1 -1
- package/dist/utils/date/index.d.ts +8 -8
- package/dist/utils/date/index.mjs +16 -16
- package/dist/utils/date/index.mjs.map +1 -1
- package/dist/utils/dom/index.d.ts +1 -1
- package/dist/utils/dom/index.mjs +4 -4
- package/dist/utils/dom/index.mjs.map +1 -1
- package/dist/utils/object/index.d.ts +10 -10
- package/dist/utils/object/index.mjs +6 -6
- package/dist/utils/object/index.mjs.map +1 -1
- package/dist/utils/string/index.d.ts +4 -4
- package/dist/utils/string/index.mjs +14 -40
- package/dist/utils/string/index.mjs.map +1 -1
- package/dist/utils/vue/emits.d.ts +8 -8
- package/dist/utils/vue/emits.mjs +7 -7
- package/dist/utils/vue/emits.mjs.map +1 -1
- package/dist/utils/vue/expose.d.ts +3 -3
- package/dist/utils/vue/expose.mjs +3 -3
- package/dist/utils/vue/expose.mjs.map +1 -1
- package/dist/utils/vue/func.d.ts +2 -2
- package/dist/utils/vue/func.mjs +2 -2
- package/dist/utils/vue/func.mjs.map +1 -1
- package/dist/utils/vue/install.d.ts +9 -9
- package/dist/utils/vue/install.mjs +24 -24
- package/dist/utils/vue/install.mjs.map +1 -1
- package/dist/utils/vue/props.d.ts +4 -4
- package/dist/utils/vue/props.mjs +5 -5
- package/dist/utils/vue/props.mjs.map +1 -1
- package/dist/utils/vue/render.d.ts +1 -1
- package/dist/utils/vue/render.mjs +2 -2
- package/dist/utils/vue/render.mjs.map +1 -1
- package/dist/utils/vue/slots.d.ts +4 -4
- package/dist/utils/vue/slots.mjs.map +1 -1
- package/dist/utils/vue/with.d.ts +1 -1
- package/dist/utils/vue/with.mjs +1 -1
- package/dist/utils/vue/with.mjs.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.mjs +1 -1
- package/dist/version.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tableColumn.mjs","names":[],"sources":["../../../../src/components/table/src/tableColumn.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, h, inject, resolveComponent } from \"vue\";\nimport { CopyDocument } from \"@element-plus/icons-vue\";\nimport { ElIcon, ElImage, ElMessage, ElTableColumn, ElTag, ElText, dayjs, useGlobalSize } from \"element-plus\";\nimport { tableColumnProps } from \"../../../internal/props\";\nimport { copy as copyToClipboard, definePropType, formatChineseRelativeTime, makeSlots, useProps, useRender } from \"../../../utils\";\nimport FaImage from \"../../image\";\nimport artwork from \"../images/artwork.png\";\nimport notImage from \"../images/notImage.png\";\nimport { tableUtil } from \"../utils/table\";\nimport { getTableDefaultSlots } from \"./table.type\";\nimport { enumMapKey, tableStateKey } from \"./useTable\";\nimport type { TableColumnCtx } from \"element-plus\";\nimport type { VNode } from \"vue\";\nimport type { DefaultRow } from \"./table.state\";\nimport type {\n\tFaTableColumnCtx,\n\tFaTableColumnDateFormat,\n\tFaTableColumnType,\n\tFaTableDefaultSlotsResult,\n\tFaTableEnumColumnCtx,\n\tFaTableEnumColumnType,\n} from \"./table.type\";\n\nexport { tableColumnProps } from \"../../../internal/props\";\n\n/** FaTableColumn 插槽返回的行列上下文。 */\nexport interface FaTableColumnSlotsResult {\n\t/** slots为表格内容的时候才会返回 */\n\trow?: DefaultRow;\n\t/** slot为表头内容的时候返回 'TableColumnCtx<DefaultRow>' 否则返回 'FaTableColumnCtx' */\n\tcolumn?: TableColumnCtx<DefaultRow> | FaTableColumnCtx;\n\t$index?: number;\n}\n\ntype FaTableColumnDefaultSlots = Record<string, FaTableDefaultSlotsResult & FaTableColumnSlotsResult>;\n\n/** FaTableColumn 的固定插槽和动态命名插槽。 */\nexport type FaTableColumnSlots = Record<string, unknown> & {\n\t/** 默认内容插槽 */\n\tdefault: FaTableDefaultSlotsResult & { row: DefaultRow; column: FaTableColumnCtx; $index: number };\n\t/** 自定义表头的内容 */\n\theader: FaTableDefaultSlotsResult & { column: FaTableColumnCtx; $index: number };\n\t/** 自定义 filter 图标 */\n\tfilterIcon: FaTableDefaultSlotsResult & { filterOpened: boolean };\n\t/** 展开列的自定义内容 */\n\texpand: FaTableDefaultSlotsResult & { expanded: boolean };\n} & FaTableColumnDefaultSlots;\n\nexport default defineComponent({\n\tname: \"FaTableColumn\",\n\tprops: {\n\t\t...tableColumnProps,\n\t\t/**\n\t\t * type of the column. If set to `selection`, the column will display checkbox. If set to `index`, the column will display index of the row (staring from 1). If set to `expand`, the column will display expand icon\n\t\t */\n\t\ttype: {\n\t\t\ttype: definePropType<FaTableColumnType>(String),\n\t\t\tdefault: \"default\",\n\t\t},\n\t\t/**\n\t\t * column width\n\t\t */\n\t\twidth: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: \"auto\",\n\t\t},\n\t\t/** alignment, the value should be 'left' \\/ 'center' \\/ 'right' */\n\t\talign: {\n\t\t\ttype: String,\n\t\t\tdefault: \"left\",\n\t\t},\n\t\t/** alignment of the table header. If omitted, the value of the above `align` attribute will be applied, the value should be 'left' \\/ 'center' \\/ 'right' */\n\t\theaderAlign: {\n\t\t\ttype: String,\n\t\t\tdefault: \"left\",\n\t\t},\n\t\t/** 是否显示在表格当中 */\n\t\tshow: Boolean,\n\t\t/** 小页面的宽度,如果为空,则继承默认宽度 */\n\t\tsmallWidth: {\n\t\t\ttype: [String, Number],\n\t\t},\n\t\t/** 自适应宽度 */\n\t\tautoWidth: Boolean,\n\t\t/** 插槽名称 */\n\t\tslot: String,\n\t\t/** 表格头部插槽名称 */\n\t\theaderSlot: String,\n\t\t/** 自定义表头内容渲染(tsx语法) */\n\t\theaderRender: {\n\t\t\ttype: definePropType<({ column, $index }: { column: TableColumnCtx<DefaultRow>; $index: number } & FaTableDefaultSlotsResult) => VNode[]>(\n\t\t\t\tFunction\n\t\t\t),\n\t\t},\n\t\t/** 自定义单元格内容渲染(tsx语法) */\n\t\trender: {\n\t\t\ttype: definePropType<\n\t\t\t\t({ row, column, $index }: { row: DefaultRow; column: FaTableColumnCtx; $index: number } & FaTableDefaultSlotsResult) => VNode[]\n\t\t\t>(Function),\n\t\t},\n\t\t/** 多级表头 */\n\t\t_children: {\n\t\t\ttype: definePropType<FaTableColumnCtx[]>(Array),\n\t\t},\n\t\t/** 隐藏图片 */\n\t\thideImage: Boolean,\n\t\t/** 复制 */\n\t\tcopy: Boolean,\n\t\t/** 是否为 Link Button */\n\t\tlink: Boolean,\n\t\t/** 合并行字段 */\n\t\tspanProp: String,\n\t\t/** Link 按钮的点击事件,优先级最高 */\n\t\tclick: {\n\t\t\ttype: definePropType<({ row, $index }: { row: DefaultRow; $index?: number } & FaTableDefaultSlotsResult) => void>(Function),\n\t\t},\n\t\t/** 点击Emits事件回调 */\n\t\tclickEmit: String,\n\t\t/** 图片列是否显示为原图,默认 false 显示缩略图 */\n\t\toriginalImage: Boolean,\n\t\t/** 显示时间格式化字符串 */\n\t\tdateFix: Boolean,\n\t\t/** 显示在页面中的日期格式 */\n\t\tdateFormat: {\n\t\t\ttype: definePropType<FaTableColumnDateFormat>(String),\n\t\t},\n\t\t/** 是否是标签展示 */\n\t\ttag: Boolean,\n\t\t/** 枚举类型(渲染值的字典) */\n\t\tenum: {\n\t\t\ttype: definePropType<FaTableEnumColumnType>([String, Array, Function]),\n\t\t},\n\t\t/** 数据删除字段,如果为 true 会显示遮罩层 */\n\t\tdataDeleteField: String,\n\t\t/** 时间信息字段 */\n\t\ttimeInfoField: {\n\t\t\ttype: definePropType<{ userName?: string; time?: string }>(Object),\n\t\t\tdefault: () => ({\n\t\t\t\tuserName: \"createdUserName\",\n\t\t\t\ttime: \"createdTime\",\n\t\t\t}),\n\t\t},\n\t},\n\temits: {\n\t\t/** 图片预览 */\n\t\timagePreview: (url: string) => typeof url === \"string\",\n\t\t/** 自定义单元格点击事件 */\n\t\tcustomCellClick: (emitName: string, { row, column, $index }: { row: DefaultRow; column: FaTableColumnCtx; $index: number }) =>\n\t\t\t(emitName == null || typeof emitName === \"string\") &&\n\t\t\ttypeof row === \"object\" &&\n\t\t\trow !== null &&\n\t\t\ttypeof column === \"object\" &&\n\t\t\tcolumn !== null &&\n\t\t\ttypeof $index === \"number\",\n\t},\n\tslots: makeSlots<FaTableColumnSlots>(),\n\tsetup(props, { slots, emit }) {\n\t\tconst globalSize = useGlobalSize();\n\t\tconst tableState = inject(tableStateKey);\n\t\tconst enumMap = inject(enumMapKey);\n\t\tif (tableState === undefined || enumMap === undefined) {\n\t\t\tthrow new Error(\"FaTableColumn 必须在 FaTable 内部渲染。\");\n\t\t}\n\n\t\tconst columnCtx = computed(() => props as FaTableColumnCtx);\n\n\t\t/** 获取ClassName */\n\t\tconst getClassName = () => {\n\t\t\tlet className = \"\";\n\t\t\tif (props.type === \"timeInfo\") {\n\t\t\t\tclassName += \"fa-table__line-height-normal-column\";\n\t\t\t}\n\t\t\tif (props.type === \"date\" || props.type === \"time\" || props.type === \"dateTime\") {\n\t\t\t\tif (props.dateFix) {\n\t\t\t\t\tclassName += \"fa-table__line-height-normal-column\";\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (props.className) {\n\t\t\t\treturn `${className} ${props.className}`;\n\t\t\t}\n\t\t\treturn className;\n\t\t};\n\n\t\t/** 获取宽度 */\n\t\tconst getWidth = (defAttr: string) => {\n\t\t\tif (props.autoWidth) {\n\t\t\t\tconst autoWidthEntry = tableState.autoColumnWidth.find((f) => f.prop === props.prop);\n\t\t\t\treturn autoWidthEntry ? `${autoWidthEntry.width}px` : \"auto\";\n\t\t\t}\n\t\t\tif (globalSize.value === \"small\") {\n\t\t\t\treturn props.smallWidth || props.width || props.minWidth || defAttr;\n\t\t\t}\n\t\t\treturn props.width || props.minWidth || defAttr;\n\t\t};\n\n\t\t/** 表头自动宽度渲染 */\n\t\tconst autoWidthHeaderRender = (el: VNode[]) => {\n\t\t\tif (props.autoWidth) {\n\t\t\t\treturn [\n\t\t\t\t\t<div class={[\"fa-table__auto-width-column__cell-header\", `__fa-table__auto-width-column__cell-header__${props.prop}`]}>{el}</div>,\n\t\t\t\t];\n\t\t\t} else {\n\t\t\t\treturn el;\n\t\t\t}\n\t\t};\n\n\t\t/** 自动宽度渲染 */\n\t\tconst autoWidthRender = (el: VNode[]) => {\n\t\t\tif (props.autoWidth) {\n\t\t\t\treturn [<div class={[\"fa-table__auto-width-column__cell\", `__fa-table__auto-width-column__cell__${props.prop}`]}>{el}</div>];\n\t\t\t} else {\n\t\t\t\treturn el;\n\t\t\t}\n\t\t};\n\n\t\t/** 表头渲染 */\n\t\tconst headerRender = ({ column, $index }: { column: TableColumnCtx<DefaultRow>; $index: number }) => {\n\t\t\tif (props.headerRender) {\n\t\t\t\treturn autoWidthHeaderRender(props.headerRender({ column, $index, ...getTableDefaultSlots(tableState) }));\n\t\t\t} else if (props.headerSlot) {\n\t\t\t\treturn autoWidthHeaderRender(slots[props.headerSlot]?.({ column, $index, ...getTableDefaultSlots(tableState) }) ?? []);\n\t\t\t} else {\n\t\t\t\treturn autoWidthHeaderRender([<span>{props.label}</span>]);\n\t\t\t}\n\t\t};\n\n\t\t/** 复制渲染 */\n\t\tconst displayText = (value: unknown) => {\n\t\t\tif (typeof value === \"string\") return value;\n\t\t\tif (typeof value === \"number\" || typeof value === \"bigint\" || typeof value === \"boolean\") return String(value);\n\t\t\treturn \"\";\n\t\t};\n\n\t\tconst copyRender = (value: unknown, copy?: boolean) => {\n\t\t\tif (!(props.copy || copy) || !value) return [];\n\n\t\t\treturn [\n\t\t\t\t<ElIcon\n\t\t\t\t\tclass=\"fa__copy-icon\"\n\t\t\t\t\ttitle=\"复制\"\n\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\tcopyToClipboard(displayText(value)).then(\n\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\tElMessage({\n\t\t\t\t\t\t\t\t\ttype: \"success\",\n\t\t\t\t\t\t\t\t\tmessage: \"复制成功\",\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\tElMessage({\n\t\t\t\t\t\t\t\t\ttype: \"error\",\n\t\t\t\t\t\t\t\t\tmessage: \"复制失败\",\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<CopyDocument />\n\t\t\t\t</ElIcon>,\n\t\t\t];\n\t\t};\n\n\t\t/** 渲染单元格数据 */\n\t\tconst renderCellData = ({ row }: { row: DefaultRow }) => {\n\t\t\tconst cellValue: unknown = tableUtil.handleRowAccordingToProp(row, props.prop ?? \"\");\n\n\t\t\tlet enumData: FaTableEnumColumnCtx[] | undefined;\n\n\t\t\tif (typeof props.enum === \"string\") {\n\t\t\t\tenumData = enumMap.get(props.enum);\n\t\t\t} else if (Array.isArray(props.enum)) {\n\t\t\t\tenumData = props.enum;\n\t\t\t} else if (typeof props.enum === \"function\") {\n\t\t\t\tenumData = props.enum({ row });\n\t\t\t}\n\n\t\t\tif (enumData) {\n\t\t\t\treturn tableUtil.filterEnum(cellValue, enumData);\n\t\t\t} else {\n\t\t\t\treturn tableUtil.formatValue(cellValue);\n\t\t\t}\n\t\t};\n\n\t\t/** 格式化渲染 */\n\t\tconst formatterRender = (row: DefaultRow, column: TableColumnCtx<DefaultRow>, cellValue: unknown, index: number) => {\n\t\t\tconst formatter = column.formatter as TableColumnCtx<DefaultRow>[\"formatter\"] | null | undefined;\n\t\t\tif (formatter) {\n\t\t\t\treturn formatter(row, column, cellValue, index);\n\t\t\t} else {\n\t\t\t\treturn displayText(cellValue);\n\t\t\t}\n\t\t};\n\n\t\t/** 时间信息列渲染 */\n\t\tconst timeInfoRender = (row: DefaultRow, _column: TableColumnCtx<DefaultRow>, _$index: number) => {\n\t\t\tconst userName = displayText(row[props.timeInfoField.userName ?? \"createdUserName\"]);\n\t\t\tconst time = displayText(row[props.timeInfoField.time ?? \"createdTime\"]);\n\t\t\treturn [\n\t\t\t\t<Fragment>\n\t\t\t\t\t<div style=\"white-space: nowrap; overflow: hidden; text-overflow: ellipsis;\" title={time}>\n\t\t\t\t\t\t{userName && <span style=\"margin-right: 5px;\">{userName}</span>}\n\t\t\t\t\t\t<span>{time}</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t{time && (\n\t\t\t\t\t\t<ElTag type=\"info\" round effect=\"light\" size=\"small\">\n\t\t\t\t\t\t\t{formatChineseRelativeTime(time)}\n\t\t\t\t\t\t</ElTag>\n\t\t\t\t\t)}\n\t\t\t\t</Fragment>,\n\t\t\t];\n\t\t};\n\n\t\t/** 标签列渲染 */\n\t\tconst tagRender = (row: DefaultRow, column: TableColumnCtx<DefaultRow>, $index: number) => {\n\t\t\tconst renderValue = formatterRender(row, column, renderCellData({ row }), $index);\n\n\t\t\tlet enumData: FaTableEnumColumnCtx[] | undefined;\n\n\t\t\tif (typeof props.enum === \"string\") {\n\t\t\t\tenumData = enumMap.get(props.enum);\n\t\t\t} else if (Array.isArray(props.enum)) {\n\t\t\t\tenumData = props.enum;\n\t\t\t} else if (typeof props.enum === \"function\") {\n\t\t\t\tenumData = props.enum({ row });\n\t\t\t}\n\n\t\t\tconst enumValue: unknown = tableUtil.handleRowAccordingToProp(row, props.prop ?? \"\");\n\t\t\tconst type = enumData?.find((item) => item.value === enumValue)?.type ?? \"info\";\n\t\t\treturn [\n\t\t\t\t<Fragment>\n\t\t\t\t\t{copyRender(renderValue)}\n\t\t\t\t\t{renderValue ? <ElTag type={type}>{renderValue}</ElTag> : null}\n\t\t\t\t</Fragment>,\n\t\t\t];\n\t\t};\n\n\t\t/** 时间列渲染 */\n\t\tconst dateRender = (row: DefaultRow, column: TableColumnCtx<DefaultRow>, $index: number) => {\n\t\t\tlet dateFormat;\n\t\t\tswitch (props.type) {\n\t\t\t\tcase \"date\":\n\t\t\t\t\tdateFormat = \"YYYY-MM-DD\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"time\":\n\t\t\t\t\tdateFormat = \"HH:mm:ss\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"dateTime\":\n\t\t\t\t\tdateFormat = \"YYYY-MM-DD HH:mm:ss\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"default\":\n\t\t\t\tcase \"index\":\n\t\t\t\tcase \"selection\":\n\t\t\t\tcase \"expand\":\n\t\t\t\tcase \"image\":\n\t\t\t\tcase \"d2\":\n\t\t\t\tcase \"d4\":\n\t\t\t\tcase \"d6\":\n\t\t\t\tcase \"gd2\":\n\t\t\t\tcase \"gd4\":\n\t\t\t\tcase \"gd6\":\n\t\t\t\tcase \"timeInfo\":\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tconst rawValue: unknown = row[props.prop ?? \"\"];\n\t\t\tconst renderValue = rawValue\n\t\t\t\t? formatterRender(row, column, dayjs(rawValue as Parameters<typeof dayjs>[0]).format(props.dateFormat ?? dateFormat), $index)\n\t\t\t\t: null;\n\t\t\treturn [\n\t\t\t\t<Fragment>\n\t\t\t\t\t{copyRender(renderValue)}\n\t\t\t\t\t{renderValue}\n\t\t\t\t\t{props.dateFix && renderValue && (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t<ElTag type=\"info\" round effect=\"light\" size=\"small\">\n\t\t\t\t\t\t\t\t{formatChineseRelativeTime(displayText(renderValue))}\n\t\t\t\t\t\t\t</ElTag>\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t)}\n\t\t\t\t</Fragment>,\n\t\t\t];\n\t\t};\n\n\t\t/** 数值列渲染 */\n\t\tconst numberRender = (row: DefaultRow, column: TableColumnCtx<DefaultRow>, $index: number) => {\n\t\t\tconst renderValue: unknown = row[props.prop ?? \"\"];\n\t\t\tif (!renderValue || typeof renderValue !== \"number\") {\n\t\t\t\treturn [<Fragment>{formatterRender(row, column, renderValue, $index)}</Fragment>];\n\t\t\t}\n\t\t\tlet useGrouping = false;\n\t\t\tlet maximumFractionDigits = 2;\n\t\t\tswitch (props.type) {\n\t\t\t\tcase \"d2\":\n\t\t\t\t\tmaximumFractionDigits = 2;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"d4\":\n\t\t\t\t\tmaximumFractionDigits = 4;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"d6\":\n\t\t\t\t\tmaximumFractionDigits = 6;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"gd2\":\n\t\t\t\t\tmaximumFractionDigits = 2;\n\t\t\t\t\tuseGrouping = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"gd4\":\n\t\t\t\t\tmaximumFractionDigits = 4;\n\t\t\t\t\tuseGrouping = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"gd6\":\n\t\t\t\t\tmaximumFractionDigits = 6;\n\t\t\t\t\tuseGrouping = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"default\":\n\t\t\t\tcase \"index\":\n\t\t\t\tcase \"selection\":\n\t\t\t\tcase \"expand\":\n\t\t\t\tcase \"image\":\n\t\t\t\tcase \"date\":\n\t\t\t\tcase \"time\":\n\t\t\t\tcase \"dateTime\":\n\t\t\t\tcase \"timeInfo\":\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t<Fragment>\n\t\t\t\t\t{formatterRender(\n\t\t\t\t\t\trow,\n\t\t\t\t\t\tcolumn,\n\t\t\t\t\t\trenderValue.toLocaleString(\"zh-CN\", {\n\t\t\t\t\t\t\tminimumFractionDigits: 2,\n\t\t\t\t\t\t\tmaximumFractionDigits,\n\t\t\t\t\t\t\tuseGrouping,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t$index\n\t\t\t\t\t)}\n\t\t\t\t</Fragment>,\n\t\t\t];\n\t\t};\n\n\t\t/** 链接列渲染 */\n\t\tconst linkRender = (row: DefaultRow, column: TableColumnCtx<DefaultRow>, $index: number) => {\n\t\t\tconst renderValue = formatterRender(row, column, row[props.prop ?? \"\"], $index);\n\t\t\treturn autoWidthRender([\n\t\t\t\t<Fragment>\n\t\t\t\t\t{copyRender(renderValue)}\n\t\t\t\t\t{renderValue && (\n\t\t\t\t\t\t<ElText\n\t\t\t\t\t\t\tclass={\"el-link is-hover-underline fa-table__link-column__text\"}\n\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t// 数据删除拦截点击\n\t\t\t\t\t\t\t\tif (props.dataDeleteField && row[props.dataDeleteField] === true) return;\n\t\t\t\t\t\t\t\tif (props.click) {\n\t\t\t\t\t\t\t\t\tprops.click({ row, $index, ...getTableDefaultSlots(tableState) });\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\temit(\"customCellClick\", props.clickEmit ?? \"\", {\n\t\t\t\t\t\t\t\t\t\trow,\n\t\t\t\t\t\t\t\t\t\tcolumn: columnCtx.value,\n\t\t\t\t\t\t\t\t\t\t$index,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{renderValue}\n\t\t\t\t\t\t</ElText>\n\t\t\t\t\t)}\n\t\t\t\t</Fragment>,\n\t\t\t]);\n\t\t};\n\n\t\tconst defaultRender = ({ row, column, $index }: { row: DefaultRow; column: TableColumnCtx<DefaultRow>; $index: number }) => {\n\t\t\tif (props.type === \"timeInfo\") {\n\t\t\t\treturn timeInfoRender(row, column, $index);\n\t\t\t}\n\t\t\tif (props.tag) {\n\t\t\t\treturn tagRender(row, column, $index);\n\t\t\t}\n\t\t\tif (props.type === \"date\" || props.type === \"time\" || props.type === \"dateTime\") {\n\t\t\t\treturn dateRender(row, column, $index);\n\t\t\t}\n\t\t\tif (\n\t\t\t\tprops.type === \"d2\" ||\n\t\t\t\tprops.type === \"d4\" ||\n\t\t\t\tprops.type === \"d6\" ||\n\t\t\t\tprops.type === \"gd2\" ||\n\t\t\t\tprops.type === \"gd4\" ||\n\t\t\t\tprops.type === \"gd6\"\n\t\t\t) {\n\t\t\t\treturn numberRender(row, column, $index);\n\t\t\t}\n\t\t\tif (props.link) {\n\t\t\t\treturn linkRender(row, column, $index);\n\t\t\t}\n\t\t\tif (props.render) {\n\t\t\t\treturn autoWidthRender(props.render({ row, column: columnCtx.value, $index, ...getTableDefaultSlots(tableState) }));\n\t\t\t}\n\t\t\tif (props.slot) {\n\t\t\t\treturn autoWidthRender(slots[props.slot]?.({ row, column: columnCtx.value, $index, ...getTableDefaultSlots(tableState) }) ?? []);\n\t\t\t}\n\t\t\tconst renderValue = formatterRender(row, column, row[props.prop ?? \"\"], $index);\n\t\t\treturn autoWidthRender([\n\t\t\t\t<Fragment>\n\t\t\t\t\t{copyRender(renderValue)}\n\t\t\t\t\t{renderValue}\n\t\t\t\t</Fragment>,\n\t\t\t]);\n\t\t};\n\n\t\tconst elTableColumnProps = useProps(props, tableColumnProps, [\n\t\t\t\"type\",\n\t\t\t\"width\",\n\t\t\t\"minWidth\",\n\t\t\t\"sortable\",\n\t\t\t\"sortOrders\",\n\t\t\t\"resizable\",\n\t\t\t\"showOverflowTooltip\",\n\t\t]);\n\n\t\tuseRender(() => (\n\t\t\t<Fragment>\n\t\t\t\t{\n\t\t\t\t\t// 如果有配置多级表头的数据,则递归该组件\n\t\t\t\t\tprops._children?.length ? (\n\t\t\t\t\t\t<ElTableColumn\n\t\t\t\t\t\t\t{...elTableColumnProps.value}\n\t\t\t\t\t\t\tclassName={getClassName()}\n\t\t\t\t\t\t\tminWidth={getWidth(\"auto\")}\n\t\t\t\t\t\t\tsortable={props.sortable ? \"custom\" : false}\n\t\t\t\t\t\t\tsortOrders={props.sortOrders}\n\t\t\t\t\t\t\tresizable={props.resizable && !props.autoWidth}\n\t\t\t\t\t\t\tshowOverflowTooltip={(props.showOverflowTooltip ?? true) && !props.autoWidth && props.type === \"default\"}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{{\n\t\t\t\t\t\t\t\theader: ({ column, $index }: { column: TableColumnCtx<DefaultRow>; $index: number }) =>\n\t\t\t\t\t\t\t\t\theaderRender({ column, $index }),\n\t\t\t\t\t\t\t\tdefault: () =>\n\t\t\t\t\t\t\t\t\t(props._children ?? []).map((col: FaTableColumnCtx) =>\n\t\t\t\t\t\t\t\t\t\th(\n\t\t\t\t\t\t\t\t\t\t\tresolveComponent(\"FaTableColumn\"),\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t...col,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tslots\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t</ElTableColumn>\n\t\t\t\t\t) : props.type === \"image\" ? (\n\t\t\t\t\t\t<ElTableColumn\n\t\t\t\t\t\t\t{...elTableColumnProps.value}\n\t\t\t\t\t\t\talign=\"center\"\n\t\t\t\t\t\t\tclassName=\"fa-table__image-column\"\n\t\t\t\t\t\t\tminWidth=\"50px\"\n\t\t\t\t\t\t\tsortable={false}\n\t\t\t\t\t\t\tresizable={false}\n\t\t\t\t\t\t\tshowOverflowTooltip={false}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{{\n\t\t\t\t\t\t\t\theader: ({ column, $index }: { column: TableColumnCtx<DefaultRow>; $index: number }) =>\n\t\t\t\t\t\t\t\t\theaderRender({ column, $index }),\n\t\t\t\t\t\t\t\tdefault: ({ row }: { row: DefaultRow; column: TableColumnCtx<DefaultRow>; $index: number }) =>\n\t\t\t\t\t\t\t\t\trow[props.prop ?? \"\"] ? (\n\t\t\t\t\t\t\t\t\t\tprops.hideImage ? (\n\t\t\t\t\t\t\t\t\t\t\t<ElImage\n\t\t\t\t\t\t\t\t\t\t\t\tclass=\"fa-image\"\n\t\t\t\t\t\t\t\t\t\t\t\tlazy\n\t\t\t\t\t\t\t\t\t\t\t\tsrc={artwork}\n\t\t\t\t\t\t\t\t\t\t\t\tfit=\"cover\"\n\t\t\t\t\t\t\t\t\t\t\t\tpreviewSrcList={[displayText(row[props.prop ?? \"\"])]}\n\t\t\t\t\t\t\t\t\t\t\t\tcloseOnPressEscape\n\t\t\t\t\t\t\t\t\t\t\t\thideOnClickModal\n\t\t\t\t\t\t\t\t\t\t\t\tpreviewTeleported\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t<FaImage lazy src={displayText(row[props.prop ?? \"\"])} fit=\"cover\" original={props.originalImage} thumb />\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<ElImage class=\"fa-image\" lazy src={notImage} fit=\"cover\" />\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t</ElTableColumn>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t// 其他正常的列\n\t\t\t\t\t\t<ElTableColumn\n\t\t\t\t\t\t\t{...elTableColumnProps.value}\n\t\t\t\t\t\t\ttype={props.type === \"selection\" || props.type === \"index\" || props.type === \"expand\" ? props.type : \"default\"}\n\t\t\t\t\t\t\tclassName={getClassName()}\n\t\t\t\t\t\t\tminWidth={getWidth(\"auto\")}\n\t\t\t\t\t\t\tsortable={props.sortable ? \"custom\" : false}\n\t\t\t\t\t\t\tsortOrders={props.sortOrders}\n\t\t\t\t\t\t\tresizable={props.resizable && !props.autoWidth}\n\t\t\t\t\t\t\tshowOverflowTooltip={(props.showOverflowTooltip ?? true) && !props.autoWidth && props.type === \"default\"}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{{\n\t\t\t\t\t\t\t\theader: ({ column, $index }: { column: TableColumnCtx<DefaultRow>; $index: number }) =>\n\t\t\t\t\t\t\t\t\tslots.header\n\t\t\t\t\t\t\t\t\t\t? slots.header({ column: columnCtx.value, $index, ...getTableDefaultSlots(tableState) })\n\t\t\t\t\t\t\t\t\t\t: headerRender({ column, $index }),\n\t\t\t\t\t\t\t\tdefault: ({ row, column, $index }: { row: DefaultRow; column: TableColumnCtx<DefaultRow>; $index: number }) =>\n\t\t\t\t\t\t\t\t\tslots.default\n\t\t\t\t\t\t\t\t\t\t? slots.default({ row, column: columnCtx.value, $index, ...getTableDefaultSlots(tableState) })\n\t\t\t\t\t\t\t\t\t\t: defaultRender({ row, column, $index }),\n\t\t\t\t\t\t\t\tfilterIcon: ({ filterOpened }: { filterOpened: boolean }) =>\n\t\t\t\t\t\t\t\t\tslots.filterIcon?.({ filterOpened, ...getTableDefaultSlots(tableState) }),\n\t\t\t\t\t\t\t\texpand: ({ expanded }: { expanded: boolean }) => slots.expand?.({ expanded, ...getTableDefaultSlots(tableState) }),\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t</ElTableColumn>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t</Fragment>\n\t\t));\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;;;AAqBsB,SAAA,QAAA,GAAA;CAAA,OAAA,OAAA,MAAA,cAAA,OAAA,UAAA,SAAA,KAAA,CAAA,MAAA,qBAAA,CAAA,QAAA,CAAA;AAAA;AA2BtB,IAAA,sBAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;EACN,GAAG;;;;EAIH,MAAM;GACL,MAAM,eAAkC,MAAM;GAC9C,SAAS;EACV;;;;EAIA,OAAO;GACN,MAAM,CAAC,QAAQ,MAAM;GACrB,SAAS;EACV;;EAEA,OAAO;GACN,MAAM;GACN,SAAS;EACV;;EAEA,aAAa;GACZ,MAAM;GACN,SAAS;EACV;;EAEA,MAAM;;EAEN,YAAY,EACX,MAAM,CAAC,QAAQ,MAAM,EACtB;;EAEA,WAAW;;EAEX,MAAM;;EAEN,YAAY;;EAEZ,cAAc,EACb,MAAM,eACL,QACD,EACD;;EAEA,QAAQ,EACP,MAAM,eAEJ,QAAQ,EACX;;EAEA,WAAW,EACV,MAAM,eAAmC,KAAK,EAC/C;;EAEA,WAAW;;EAEX,MAAM;;EAEN,MAAM;;EAEN,UAAU;;EAEV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B,MAAM;GAAU,aACjB,MAAM,aAAa,CAAC,MAAM;GAAS,wBACxB,MAAM,uBAAuB,SAAS,CAAC,MAAM,aAAa,MAAM,SAAS;EAAS,CAAA,GAAA;GAGvG,SAAS,EAAE,QAAQ,aAClB,MAAM,SACH,MAAM,OAAO;IAAE,QAAQ,UAAU;IAAO;IAAQ,GAAG,qBAAqB,UAAU;GAAE,CAAC,IACrF,aAAa;IAAE;IAAQ;GAAO,CAAC;GACnC,UAAU,EAAE,KAAK,QAAQ,aACxB,MAAM,UACH,MAAM,QAAQ;IAAE;IAAK,QAAQ,UAAU;IAAO;IAAQ,GAAG,qBAAqB,UAAU;GAAE,CAAC,IAC3F,cAAc;IAAE;IAAK;IAAQ;GAAO,CAAC;GACzC,aAAa,EAAE,mBACd,MAAM,aAAa;IAAE;IAAc,GAAG,qBAAqB,UAAU;GAAE,CAAC;GACzE,SAAS,EAAE,eAAsC,MAAM,SAAS;IAAE;IAAU,GAAG,qBAAqB,UAAU;GAAE,CAAC;EAAC,CAAA,CAGpH,CAAA,CAGH;CACF;AACD,CAAC"}
|
|
1
|
+
{"version":3,"file":"tableColumn.mjs","names":[],"sources":["../../../../src/components/table/src/tableColumn.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, h, inject, resolveComponent } from \"vue\";\nimport { CopyDocument } from \"@element-plus/icons-vue\";\nimport { ElIcon, ElImage, ElMessage, ElTableColumn, ElTag, ElText, dayjs, useGlobalSize } from \"element-plus\";\nimport { tableColumnProps } from \"../../../internal/props\";\nimport { copy as copyToClipboard, definePropType, formatChineseRelativeTime, makeSlots, useProps, useRender } from \"../../../utils\";\nimport FaImage from \"../../image\";\nimport artwork from \"../images/artwork.png\";\nimport notImage from \"../images/notImage.png\";\nimport { tableUtil } from \"../utils/table\";\nimport { getTableDefaultSlots } from \"./table.type\";\nimport { enumMapKey, tableStateKey } from \"./useTable\";\nimport type { TableColumnCtx } from \"element-plus\";\nimport type { VNode } from \"vue\";\nimport type { DefaultRow } from \"./table.state\";\nimport type {\n\tFaTableColumnCtx,\n\tFaTableColumnDateFormat,\n\tFaTableColumnType,\n\tFaTableDefaultSlotsResult,\n\tFaTableEnumColumnCtx,\n\tFaTableEnumColumnType,\n} from \"./table.type\";\n\nexport { tableColumnProps } from \"../../../internal/props\";\n\n/** FaTableColumn 插槽返回的行列上下文 */\nexport interface FaTableColumnSlotsResult {\n\t/** slots为表格内容的时候才会返回 */\n\trow?: DefaultRow;\n\t/** slot为表头内容的时候返回 'TableColumnCtx<DefaultRow>' 否则返回 'FaTableColumnCtx' */\n\tcolumn?: TableColumnCtx<DefaultRow> | FaTableColumnCtx;\n\t$index?: number;\n}\n\ntype FaTableColumnDefaultSlots = Record<string, FaTableDefaultSlotsResult & FaTableColumnSlotsResult>;\n\n/** FaTableColumn 的固定插槽和动态命名插槽。 */\nexport type FaTableColumnSlots = Record<string, unknown> & {\n\t/** 默认内容插槽 */\n\tdefault: FaTableDefaultSlotsResult & { row: DefaultRow; column: FaTableColumnCtx; $index: number };\n\t/** 自定义表头的内容 */\n\theader: FaTableDefaultSlotsResult & { column: FaTableColumnCtx; $index: number };\n\t/** 自定义 filter 图标 */\n\tfilterIcon: FaTableDefaultSlotsResult & { filterOpened: boolean };\n\t/** 展开列的自定义内容 */\n\texpand: FaTableDefaultSlotsResult & { expanded: boolean };\n} & FaTableColumnDefaultSlots;\n\nexport default defineComponent({\n\tname: \"FaTableColumn\",\n\tprops: {\n\t\t...tableColumnProps,\n\t\t/**\n\t\t * type of the column. If set to `selection`, the column will display checkbox. If set to `index`, the column will display index of the row (staring from 1). If set to `expand`, the column will display expand icon\n\t\t */\n\t\ttype: {\n\t\t\ttype: definePropType<FaTableColumnType>(String),\n\t\t\tdefault: \"default\",\n\t\t},\n\t\t/**\n\t\t * column width\n\t\t */\n\t\twidth: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: \"auto\",\n\t\t},\n\t\t/** alignment, the value should be 'left' \\/ 'center' \\/ 'right' */\n\t\talign: {\n\t\t\ttype: String,\n\t\t\tdefault: \"left\",\n\t\t},\n\t\t/** alignment of the table header. If omitted, the value of the above `align` attribute will be applied, the value should be 'left' \\/ 'center' \\/ 'right' */\n\t\theaderAlign: {\n\t\t\ttype: String,\n\t\t\tdefault: \"left\",\n\t\t},\n\t\t/** 是否显示在表格当中 */\n\t\tshow: Boolean,\n\t\t/** 小页面的宽度,如果为空,则继承默认宽度 */\n\t\tsmallWidth: {\n\t\t\ttype: [String, Number],\n\t\t},\n\t\t/** 自适应宽度 */\n\t\tautoWidth: Boolean,\n\t\t/** 插槽名称 */\n\t\tslot: String,\n\t\t/** 表格头部插槽名称 */\n\t\theaderSlot: String,\n\t\t/** 自定义表头内容渲染(tsx语法) */\n\t\theaderRender: {\n\t\t\ttype: definePropType<({ column, $index }: { column: TableColumnCtx<DefaultRow>; $index: number } & FaTableDefaultSlotsResult) => VNode[]>(\n\t\t\t\tFunction\n\t\t\t),\n\t\t},\n\t\t/** 自定义单元格内容渲染(tsx语法) */\n\t\trender: {\n\t\t\ttype: definePropType<\n\t\t\t\t({ row, column, $index }: { row: DefaultRow; column: FaTableColumnCtx; $index: number } & FaTableDefaultSlotsResult) => VNode[]\n\t\t\t>(Function),\n\t\t},\n\t\t/** 多级表头 */\n\t\t_children: {\n\t\t\ttype: definePropType<FaTableColumnCtx[]>(Array),\n\t\t},\n\t\t/** 隐藏图片 */\n\t\thideImage: Boolean,\n\t\t/** 复制 */\n\t\tcopy: Boolean,\n\t\t/** 是否为 Link Button */\n\t\tlink: Boolean,\n\t\t/** 合并行字段 */\n\t\tspanProp: String,\n\t\t/** Link 按钮的点击事件,优先级最高 */\n\t\tclick: {\n\t\t\ttype: definePropType<({ row, $index }: { row: DefaultRow; $index?: number } & FaTableDefaultSlotsResult) => void>(Function),\n\t\t},\n\t\t/** 点击Emits事件回调 */\n\t\tclickEmit: String,\n\t\t/** 图片列是否显示为原图,默认 false 显示缩略图 */\n\t\toriginalImage: Boolean,\n\t\t/** 显示时间格式化字符串 */\n\t\tdateFix: Boolean,\n\t\t/** 显示在页面中的日期格式 */\n\t\tdateFormat: {\n\t\t\ttype: definePropType<FaTableColumnDateFormat>(String),\n\t\t},\n\t\t/** 是否是标签展示 */\n\t\ttag: Boolean,\n\t\t/** 枚举类型(渲染值的字典) */\n\t\tenum: {\n\t\t\ttype: definePropType<FaTableEnumColumnType>([String, Array, Function]),\n\t\t},\n\t\t/** 数据删除字段,如果为 true 会显示遮罩层 */\n\t\tdataDeleteField: String,\n\t\t/** 时间信息字段 */\n\t\ttimeInfoField: {\n\t\t\ttype: definePropType<{ userName?: string; time?: string }>(Object),\n\t\t\tdefault: () => ({\n\t\t\t\tuserName: \"createdUserName\",\n\t\t\t\ttime: \"createdTime\",\n\t\t\t}),\n\t\t},\n\t},\n\temits: {\n\t\t/** 图片预览 */\n\t\timagePreview: (url: string) => typeof url === \"string\",\n\t\t/** 自定义单元格点击事件 */\n\t\tcustomCellClick: (emitName: string, { row, column, $index }: { row: DefaultRow; column: FaTableColumnCtx; $index: number }) =>\n\t\t\t(emitName == null || typeof emitName === \"string\") &&\n\t\t\ttypeof row === \"object\" &&\n\t\t\trow !== null &&\n\t\t\ttypeof column === \"object\" &&\n\t\t\tcolumn !== null &&\n\t\t\ttypeof $index === \"number\",\n\t},\n\tslots: makeSlots<FaTableColumnSlots>(),\n\tsetup(props, { slots, emit }) {\n\t\tconst globalSize = useGlobalSize();\n\t\tconst tableState = inject(tableStateKey);\n\t\tconst enumMap = inject(enumMapKey);\n\t\tif (tableState === undefined || enumMap === undefined) {\n\t\t\tthrow new Error(\"FaTableColumn 必须在 FaTable 内部渲染。\");\n\t\t}\n\n\t\tconst columnCtx = computed(() => props as FaTableColumnCtx);\n\n\t\t/** 获取ClassName */\n\t\tconst getClassName = () => {\n\t\t\tlet className = \"\";\n\t\t\tif (props.type === \"timeInfo\") {\n\t\t\t\tclassName += \"fa-table__line-height-normal-column\";\n\t\t\t}\n\t\t\tif (props.type === \"date\" || props.type === \"time\" || props.type === \"dateTime\") {\n\t\t\t\tif (props.dateFix) {\n\t\t\t\t\tclassName += \"fa-table__line-height-normal-column\";\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (props.className) {\n\t\t\t\treturn `${className} ${props.className}`;\n\t\t\t}\n\t\t\treturn className;\n\t\t};\n\n\t\t/** 获取宽度 */\n\t\tconst getWidth = (defAttr: string) => {\n\t\t\tif (props.autoWidth) {\n\t\t\t\tconst autoWidthEntry = tableState.autoColumnWidth.find((f) => f.prop === props.prop);\n\t\t\t\treturn autoWidthEntry ? `${autoWidthEntry.width}px` : \"auto\";\n\t\t\t}\n\t\t\tif (globalSize.value === \"small\") {\n\t\t\t\treturn props.smallWidth || props.width || props.minWidth || defAttr;\n\t\t\t}\n\t\t\treturn props.width || props.minWidth || defAttr;\n\t\t};\n\n\t\t/** 表头自动宽度渲染 */\n\t\tconst autoWidthHeaderRender = (el: VNode[]) => {\n\t\t\tif (props.autoWidth) {\n\t\t\t\treturn [\n\t\t\t\t\t<div class={[\"fa-table__auto-width-column__cell-header\", `__fa-table__auto-width-column__cell-header__${props.prop}`]}>{el}</div>,\n\t\t\t\t];\n\t\t\t} else {\n\t\t\t\treturn el;\n\t\t\t}\n\t\t};\n\n\t\t/** 自动宽度渲染 */\n\t\tconst autoWidthRender = (el: VNode[]) => {\n\t\t\tif (props.autoWidth) {\n\t\t\t\treturn [<div class={[\"fa-table__auto-width-column__cell\", `__fa-table__auto-width-column__cell__${props.prop}`]}>{el}</div>];\n\t\t\t} else {\n\t\t\t\treturn el;\n\t\t\t}\n\t\t};\n\n\t\t/** 表头渲染 */\n\t\tconst headerRender = ({ column, $index }: { column: TableColumnCtx<DefaultRow>; $index: number }) => {\n\t\t\tif (props.headerRender) {\n\t\t\t\treturn autoWidthHeaderRender(props.headerRender({ column, $index, ...getTableDefaultSlots(tableState) }));\n\t\t\t} else if (props.headerSlot) {\n\t\t\t\treturn autoWidthHeaderRender(slots[props.headerSlot]?.({ column, $index, ...getTableDefaultSlots(tableState) }) ?? []);\n\t\t\t} else {\n\t\t\t\treturn autoWidthHeaderRender([<span>{props.label}</span>]);\n\t\t\t}\n\t\t};\n\n\t\t/** 复制渲染 */\n\t\tconst displayText = (value: unknown) => {\n\t\t\tif (typeof value === \"string\") return value;\n\t\t\tif (typeof value === \"number\" || typeof value === \"bigint\" || typeof value === \"boolean\") return String(value);\n\t\t\treturn \"\";\n\t\t};\n\n\t\tconst copyRender = (value: unknown, copy?: boolean) => {\n\t\t\tif (!(props.copy || copy) || !value) return [];\n\n\t\t\treturn [\n\t\t\t\t<ElIcon\n\t\t\t\t\tclass=\"fa__copy-icon\"\n\t\t\t\t\ttitle=\"复制\"\n\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\tcopyToClipboard(displayText(value)).then(\n\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\tElMessage({\n\t\t\t\t\t\t\t\t\ttype: \"success\",\n\t\t\t\t\t\t\t\t\tmessage: \"复制成功\",\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\tElMessage({\n\t\t\t\t\t\t\t\t\ttype: \"error\",\n\t\t\t\t\t\t\t\t\tmessage: \"复制失败\",\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<CopyDocument />\n\t\t\t\t</ElIcon>,\n\t\t\t];\n\t\t};\n\n\t\t/** 渲染单元格数据 */\n\t\tconst renderCellData = ({ row }: { row: DefaultRow }) => {\n\t\t\tconst cellValue = tableUtil.handleRowAccordingToProp(row, props.prop ?? \"\");\n\n\t\t\tlet enumData: FaTableEnumColumnCtx[] | undefined;\n\n\t\t\tif (typeof props.enum === \"string\") {\n\t\t\t\tenumData = enumMap.get(props.enum);\n\t\t\t} else if (Array.isArray(props.enum)) {\n\t\t\t\tenumData = props.enum;\n\t\t\t} else if (typeof props.enum === \"function\") {\n\t\t\t\tenumData = props.enum({ row });\n\t\t\t}\n\n\t\t\tif (enumData) {\n\t\t\t\treturn tableUtil.filterEnum(cellValue, enumData);\n\t\t\t} else {\n\t\t\t\treturn tableUtil.formatValue(cellValue);\n\t\t\t}\n\t\t};\n\n\t\t/** 格式化渲染 */\n\t\tconst formatterRender = (row: DefaultRow, column: TableColumnCtx<DefaultRow>, cellValue: unknown, index: number) => {\n\t\t\tconst formatter = column.formatter as TableColumnCtx<DefaultRow>[\"formatter\"] | null | undefined;\n\t\t\tif (formatter) {\n\t\t\t\treturn formatter(row, column, cellValue, index);\n\t\t\t} else {\n\t\t\t\treturn displayText(cellValue);\n\t\t\t}\n\t\t};\n\n\t\t/** 时间信息列渲染 */\n\t\tconst timeInfoRender = (row: DefaultRow, _column: TableColumnCtx<DefaultRow>, _$index: number) => {\n\t\t\tconst userName = displayText(row[props.timeInfoField.userName ?? \"createdUserName\"]);\n\t\t\tconst time = displayText(row[props.timeInfoField.time ?? \"createdTime\"]);\n\t\t\treturn [\n\t\t\t\t<Fragment>\n\t\t\t\t\t<div style=\"white-space: nowrap; overflow: hidden; text-overflow: ellipsis;\" title={time}>\n\t\t\t\t\t\t{userName && <span style=\"margin-right: 5px;\">{userName}</span>}\n\t\t\t\t\t\t<span>{time}</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t{time && (\n\t\t\t\t\t\t<ElTag type=\"info\" round effect=\"light\" size=\"small\">\n\t\t\t\t\t\t\t{formatChineseRelativeTime(time)}\n\t\t\t\t\t\t</ElTag>\n\t\t\t\t\t)}\n\t\t\t\t</Fragment>,\n\t\t\t];\n\t\t};\n\n\t\t/** 标签列渲染 */\n\t\tconst tagRender = (row: DefaultRow, column: TableColumnCtx<DefaultRow>, $index: number) => {\n\t\t\tconst renderValue = formatterRender(row, column, renderCellData({ row }), $index);\n\n\t\t\tlet enumData: FaTableEnumColumnCtx[] | undefined;\n\n\t\t\tif (typeof props.enum === \"string\") {\n\t\t\t\tenumData = enumMap.get(props.enum);\n\t\t\t} else if (Array.isArray(props.enum)) {\n\t\t\t\tenumData = props.enum;\n\t\t\t} else if (typeof props.enum === \"function\") {\n\t\t\t\tenumData = props.enum({ row });\n\t\t\t}\n\n\t\t\tconst enumValue: unknown = tableUtil.handleRowAccordingToProp(row, props.prop ?? \"\");\n\t\t\tconst type = enumData?.find((item) => item.value === enumValue)?.type ?? \"info\";\n\t\t\treturn [\n\t\t\t\t<Fragment>\n\t\t\t\t\t{copyRender(renderValue)}\n\t\t\t\t\t{renderValue ? <ElTag type={type}>{renderValue}</ElTag> : null}\n\t\t\t\t</Fragment>,\n\t\t\t];\n\t\t};\n\n\t\t/** 时间列渲染 */\n\t\tconst dateRender = (row: DefaultRow, column: TableColumnCtx<DefaultRow>, $index: number) => {\n\t\t\tlet dateFormat;\n\t\t\tswitch (props.type) {\n\t\t\t\tcase \"date\":\n\t\t\t\t\tdateFormat = \"YYYY-MM-DD\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"time\":\n\t\t\t\t\tdateFormat = \"HH:mm:ss\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"dateTime\":\n\t\t\t\t\tdateFormat = \"YYYY-MM-DD HH:mm:ss\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"default\":\n\t\t\t\tcase \"index\":\n\t\t\t\tcase \"selection\":\n\t\t\t\tcase \"expand\":\n\t\t\t\tcase \"image\":\n\t\t\t\tcase \"d2\":\n\t\t\t\tcase \"d4\":\n\t\t\t\tcase \"d6\":\n\t\t\t\tcase \"gd2\":\n\t\t\t\tcase \"gd4\":\n\t\t\t\tcase \"gd6\":\n\t\t\t\tcase \"timeInfo\":\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tconst cellValue = tableUtil.handleRowAccordingToProp(row, props.prop ?? \"\");\n\t\t\tconst renderValue = cellValue\n\t\t\t\t? formatterRender(row, column, dayjs(cellValue as Parameters<typeof dayjs>[0]).format(props.dateFormat ?? dateFormat), $index)\n\t\t\t\t: null;\n\t\t\treturn [\n\t\t\t\t<Fragment>\n\t\t\t\t\t{copyRender(renderValue)}\n\t\t\t\t\t{renderValue}\n\t\t\t\t\t{props.dateFix && renderValue && (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t<ElTag type=\"info\" round effect=\"light\" size=\"small\">\n\t\t\t\t\t\t\t\t{formatChineseRelativeTime(displayText(renderValue))}\n\t\t\t\t\t\t\t</ElTag>\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t)}\n\t\t\t\t</Fragment>,\n\t\t\t];\n\t\t};\n\n\t\t/** 数值列渲染 */\n\t\tconst numberRender = (row: DefaultRow, column: TableColumnCtx<DefaultRow>, $index: number) => {\n\t\t\tconst cellValue = tableUtil.handleRowAccordingToProp(row, props.prop ?? \"\");\n\t\t\tif (!cellValue || typeof cellValue !== \"number\") {\n\t\t\t\treturn [<Fragment>{formatterRender(row, column, cellValue, $index)}</Fragment>];\n\t\t\t}\n\t\t\tlet useGrouping = false;\n\t\t\tlet maximumFractionDigits = 2;\n\t\t\tswitch (props.type) {\n\t\t\t\tcase \"d2\":\n\t\t\t\t\tmaximumFractionDigits = 2;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"d4\":\n\t\t\t\t\tmaximumFractionDigits = 4;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"d6\":\n\t\t\t\t\tmaximumFractionDigits = 6;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"gd2\":\n\t\t\t\t\tmaximumFractionDigits = 2;\n\t\t\t\t\tuseGrouping = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"gd4\":\n\t\t\t\t\tmaximumFractionDigits = 4;\n\t\t\t\t\tuseGrouping = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"gd6\":\n\t\t\t\t\tmaximumFractionDigits = 6;\n\t\t\t\t\tuseGrouping = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"default\":\n\t\t\t\tcase \"index\":\n\t\t\t\tcase \"selection\":\n\t\t\t\tcase \"expand\":\n\t\t\t\tcase \"image\":\n\t\t\t\tcase \"date\":\n\t\t\t\tcase \"time\":\n\t\t\t\tcase \"dateTime\":\n\t\t\t\tcase \"timeInfo\":\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t<Fragment>\n\t\t\t\t\t{formatterRender(\n\t\t\t\t\t\trow,\n\t\t\t\t\t\tcolumn,\n\t\t\t\t\t\tcellValue.toLocaleString(\"zh-CN\", {\n\t\t\t\t\t\t\tminimumFractionDigits: 2,\n\t\t\t\t\t\t\tmaximumFractionDigits,\n\t\t\t\t\t\t\tuseGrouping,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t$index\n\t\t\t\t\t)}\n\t\t\t\t</Fragment>,\n\t\t\t];\n\t\t};\n\n\t\t/** 链接列渲染 */\n\t\tconst linkRender = (row: DefaultRow, column: TableColumnCtx<DefaultRow>, $index: number) => {\n\t\t\tconst cellValue = tableUtil.handleRowAccordingToProp(row, props.prop ?? \"\");\n\t\t\tconst renderValue = formatterRender(row, column, cellValue, $index);\n\t\t\treturn autoWidthRender([\n\t\t\t\t<Fragment>\n\t\t\t\t\t{copyRender(renderValue)}\n\t\t\t\t\t{renderValue && (\n\t\t\t\t\t\t<ElText\n\t\t\t\t\t\t\tclass={\"el-link is-hover-underline fa-table__link-column__text\"}\n\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t// 数据删除拦截点击\n\t\t\t\t\t\t\t\tif (props.dataDeleteField && row[props.dataDeleteField] === true) return;\n\t\t\t\t\t\t\t\tif (props.click) {\n\t\t\t\t\t\t\t\t\tprops.click({ row, $index, ...getTableDefaultSlots(tableState) });\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\temit(\"customCellClick\", props.clickEmit ?? \"\", {\n\t\t\t\t\t\t\t\t\t\trow,\n\t\t\t\t\t\t\t\t\t\tcolumn: columnCtx.value,\n\t\t\t\t\t\t\t\t\t\t$index,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{renderValue}\n\t\t\t\t\t\t</ElText>\n\t\t\t\t\t)}\n\t\t\t\t</Fragment>,\n\t\t\t]);\n\t\t};\n\n\t\tconst defaultRender = ({ row, column, $index }: { row: DefaultRow; column: TableColumnCtx<DefaultRow>; $index: number }) => {\n\t\t\tif (props.type === \"timeInfo\") {\n\t\t\t\treturn timeInfoRender(row, column, $index);\n\t\t\t}\n\t\t\tif (props.tag) {\n\t\t\t\treturn tagRender(row, column, $index);\n\t\t\t}\n\t\t\tif (props.type === \"date\" || props.type === \"time\" || props.type === \"dateTime\") {\n\t\t\t\treturn dateRender(row, column, $index);\n\t\t\t}\n\t\t\tif (\n\t\t\t\tprops.type === \"d2\" ||\n\t\t\t\tprops.type === \"d4\" ||\n\t\t\t\tprops.type === \"d6\" ||\n\t\t\t\tprops.type === \"gd2\" ||\n\t\t\t\tprops.type === \"gd4\" ||\n\t\t\t\tprops.type === \"gd6\"\n\t\t\t) {\n\t\t\t\treturn numberRender(row, column, $index);\n\t\t\t}\n\t\t\tif (props.link) {\n\t\t\t\treturn linkRender(row, column, $index);\n\t\t\t}\n\t\t\tif (props.render) {\n\t\t\t\treturn autoWidthRender(props.render({ row, column: columnCtx.value, $index, ...getTableDefaultSlots(tableState) }));\n\t\t\t}\n\t\t\tif (props.slot) {\n\t\t\t\treturn autoWidthRender(slots[props.slot]?.({ row, column: columnCtx.value, $index, ...getTableDefaultSlots(tableState) }) ?? []);\n\t\t\t}\n\t\t\tconst cellValue = tableUtil.handleRowAccordingToProp(row, props.prop ?? \"\");\n\t\t\tconst renderValue = formatterRender(row, column, cellValue, $index);\n\t\t\treturn autoWidthRender([\n\t\t\t\t<Fragment>\n\t\t\t\t\t{copyRender(renderValue)}\n\t\t\t\t\t{renderValue}\n\t\t\t\t</Fragment>,\n\t\t\t]);\n\t\t};\n\n\t\tconst elTableColumnProps = useProps(props, tableColumnProps, [\n\t\t\t\"type\",\n\t\t\t\"width\",\n\t\t\t\"minWidth\",\n\t\t\t\"sortable\",\n\t\t\t\"sortOrders\",\n\t\t\t\"resizable\",\n\t\t\t\"showOverflowTooltip\",\n\t\t]);\n\n\t\tuseRender(() => (\n\t\t\t<Fragment>\n\t\t\t\t{\n\t\t\t\t\t// 如果有配置多级表头的数据,则递归该组件\n\t\t\t\t\tprops._children?.length ? (\n\t\t\t\t\t\t<ElTableColumn\n\t\t\t\t\t\t\t{...elTableColumnProps.value}\n\t\t\t\t\t\t\tclassName={getClassName()}\n\t\t\t\t\t\t\tminWidth={getWidth(\"auto\")}\n\t\t\t\t\t\t\tsortable={props.sortable ? \"custom\" : false}\n\t\t\t\t\t\t\tsortOrders={props.sortOrders}\n\t\t\t\t\t\t\tresizable={props.resizable && !props.autoWidth}\n\t\t\t\t\t\t\tshowOverflowTooltip={(props.showOverflowTooltip ?? true) && !props.autoWidth && props.type === \"default\"}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{{\n\t\t\t\t\t\t\t\theader: ({ column, $index }: { column: TableColumnCtx<DefaultRow>; $index: number }) =>\n\t\t\t\t\t\t\t\t\theaderRender({ column, $index }),\n\t\t\t\t\t\t\t\tdefault: () =>\n\t\t\t\t\t\t\t\t\t(props._children ?? []).map((col: FaTableColumnCtx) =>\n\t\t\t\t\t\t\t\t\t\th(\n\t\t\t\t\t\t\t\t\t\t\tresolveComponent(\"FaTableColumn\"),\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t...col,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\tslots\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t</ElTableColumn>\n\t\t\t\t\t) : props.type === \"image\" ? (\n\t\t\t\t\t\t<ElTableColumn\n\t\t\t\t\t\t\t{...elTableColumnProps.value}\n\t\t\t\t\t\t\talign=\"center\"\n\t\t\t\t\t\t\tclassName=\"fa-table__image-column\"\n\t\t\t\t\t\t\tminWidth=\"50px\"\n\t\t\t\t\t\t\tsortable={false}\n\t\t\t\t\t\t\tresizable={false}\n\t\t\t\t\t\t\tshowOverflowTooltip={false}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{{\n\t\t\t\t\t\t\t\theader: ({ column, $index }: { column: TableColumnCtx<DefaultRow>; $index: number }) =>\n\t\t\t\t\t\t\t\t\theaderRender({ column, $index }),\n\t\t\t\t\t\t\t\tdefault: ({ row }: { row: DefaultRow; column: TableColumnCtx<DefaultRow>; $index: number }) => {\n\t\t\t\t\t\t\t\t\tconst cellValue = tableUtil.handleRowAccordingToProp(row, props.prop ?? \"\");\n\t\t\t\t\t\t\t\t\tconst renderValue = displayText(cellValue);\n\t\t\t\t\t\t\t\t\treturn renderValue ? (\n\t\t\t\t\t\t\t\t\t\tprops.hideImage ? (\n\t\t\t\t\t\t\t\t\t\t\t<ElImage\n\t\t\t\t\t\t\t\t\t\t\t\tclass=\"fa-image\"\n\t\t\t\t\t\t\t\t\t\t\t\tlazy\n\t\t\t\t\t\t\t\t\t\t\t\tsrc={artwork}\n\t\t\t\t\t\t\t\t\t\t\t\tfit=\"cover\"\n\t\t\t\t\t\t\t\t\t\t\t\tpreviewSrcList={[renderValue]}\n\t\t\t\t\t\t\t\t\t\t\t\tcloseOnPressEscape\n\t\t\t\t\t\t\t\t\t\t\t\thideOnClickModal\n\t\t\t\t\t\t\t\t\t\t\t\tpreviewTeleported\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t<FaImage lazy src={renderValue} fit=\"cover\" original={props.originalImage} thumb />\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<ElImage class=\"fa-image\" lazy src={notImage} fit=\"cover\" />\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t</ElTableColumn>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t// 其他正常的列\n\t\t\t\t\t\t<ElTableColumn\n\t\t\t\t\t\t\t{...elTableColumnProps.value}\n\t\t\t\t\t\t\ttype={props.type === \"selection\" || props.type === \"index\" || props.type === \"expand\" ? props.type : \"default\"}\n\t\t\t\t\t\t\tclassName={getClassName()}\n\t\t\t\t\t\t\tminWidth={getWidth(\"auto\")}\n\t\t\t\t\t\t\tsortable={props.sortable ? \"custom\" : false}\n\t\t\t\t\t\t\tsortOrders={props.sortOrders}\n\t\t\t\t\t\t\tresizable={props.resizable && !props.autoWidth}\n\t\t\t\t\t\t\tshowOverflowTooltip={(props.showOverflowTooltip ?? true) && !props.autoWidth && props.type === \"default\"}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{{\n\t\t\t\t\t\t\t\theader: ({ column, $index }: { column: TableColumnCtx<DefaultRow>; $index: number }) =>\n\t\t\t\t\t\t\t\t\tslots.header\n\t\t\t\t\t\t\t\t\t\t? slots.header({ column: columnCtx.value, $index, ...getTableDefaultSlots(tableState) })\n\t\t\t\t\t\t\t\t\t\t: headerRender({ column, $index }),\n\t\t\t\t\t\t\t\tdefault: ({ row, column, $index }: { row: DefaultRow; column: TableColumnCtx<DefaultRow>; $index: number }) =>\n\t\t\t\t\t\t\t\t\tslots.default\n\t\t\t\t\t\t\t\t\t\t? slots.default({ row, column: columnCtx.value, $index, ...getTableDefaultSlots(tableState) })\n\t\t\t\t\t\t\t\t\t\t: defaultRender({ row, column, $index }),\n\t\t\t\t\t\t\t\tfilterIcon: ({ filterOpened }: { filterOpened: boolean }) =>\n\t\t\t\t\t\t\t\t\tslots.filterIcon?.({ filterOpened, ...getTableDefaultSlots(tableState) }),\n\t\t\t\t\t\t\t\texpand: ({ expanded }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,qBAAqB,UAAU;GAAE,CAAC,IACrF,aAAa;IAAE;IAAQ;GAAO,CAAC;GACnC,UAAU,EAAE,KAAK,QAAQ,aACxB,MAAM,UACH,MAAM,QAAQ;IAAE;IAAK,QAAQ,UAAU;IAAO;IAAQ,GAAG,qBAAqB,UAAU;GAAE,CAAC,IAC3F,cAAc;IAAE;IAAK;IAAQ;GAAO,CAAC;GACzC,aAAa,EAAE,mBACd,MAAM,aAAa;IAAE;IAAc,GAAG,qBAAqB,UAAU;GAAE,CAAC;GACzE,SAAS,EAAE,eAAsC,MAAM,SAAS;IAAE;IAAU,GAAG,qBAAqB,UAAU;GAAE,CAAC;EAAC,CAAA,CAGpH,CAAA,CAGH;CACF;AACD,CAAC"}
|
|
@@ -6,42 +6,45 @@ import type { FaTableColumnCtx, FaTableEnumColumnCtx, FaTableEnumColumnType } fr
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const tableUtil: {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @param
|
|
9
|
+
* 将非空数组连接为逗号分隔的文本,空数组返回 null;其他值原样返回。
|
|
10
|
+
* @param callValue - 需要处理的值
|
|
11
11
|
*/
|
|
12
12
|
formatValue(callValue: unknown): unknown;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @param
|
|
16
|
-
* @param
|
|
14
|
+
* 按点分隔的属性路径读取行数据,例如 user.name。
|
|
15
|
+
* @param row - 当前行数据
|
|
16
|
+
* @param prop - 当前 prop
|
|
17
|
+
* @returns 目标属性值;中间节点不是对象或属性不存在时返回 undefined。
|
|
17
18
|
*/
|
|
18
19
|
handleRowAccordingToProp(row: DefaultRow, prop: string): unknown;
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
-
* @param
|
|
21
|
+
* 返回点分隔属性路径的最后一级名称。
|
|
22
|
+
* @param prop - 当前 prop
|
|
22
23
|
*/
|
|
23
24
|
handleProp(prop: string): string;
|
|
24
25
|
/**
|
|
25
|
-
*
|
|
26
|
-
* @param
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
26
|
+
* 按值匹配枚举项,并读取指定的标签字段或 Tag 类型。
|
|
27
|
+
* @param callValue - 当前单元格值
|
|
28
|
+
* @param enumData - 字典列表
|
|
29
|
+
* @param fieldNames - 标签与值的字段名
|
|
30
|
+
* @param type - 过滤类型(目前只有 tag)
|
|
31
|
+
* @returns 匹配项的标签;未匹配时返回 null。查询 Tag 类型时默认返回 info。
|
|
30
32
|
*/
|
|
31
33
|
filterEnum(callValue: unknown, enumData: FaTableEnumColumnCtx[], fieldNames?: {
|
|
32
34
|
label: string;
|
|
33
35
|
value: string;
|
|
34
36
|
}, type?: "tag"): unknown;
|
|
35
37
|
/**
|
|
36
|
-
*
|
|
38
|
+
* 创建按排序条件依次比较行数据的函数,支持点分隔的属性路径。
|
|
37
39
|
*/
|
|
38
40
|
arrayDynamicSort(sortList: PagedSortInput[]): (a: DefaultRow, b: DefaultRow) => number;
|
|
39
41
|
/**
|
|
40
|
-
*
|
|
42
|
+
* 将静态枚举或同步枚举函数的返回值存入映射。
|
|
41
43
|
*/
|
|
42
44
|
setEnumMap(columnEnum: FaTableEnumColumnType, prop: string, enumMap: Map<string, FaTableEnumColumnCtx[]>): void;
|
|
43
45
|
/**
|
|
44
|
-
*
|
|
46
|
+
* 收集叶子列,并补齐列的 show 默认值与枚举映射。
|
|
47
|
+
* @remarks 会修改传入列的 show 属性;嵌套子列不继承本次枚举映射参数。
|
|
45
48
|
*/
|
|
46
49
|
flatColumns(columns: FaTableColumnCtx[], enumMap?: Map<string, FaTableEnumColumnCtx[]>): FaTableColumnCtx[];
|
|
47
50
|
};
|
|
@@ -4,17 +4,18 @@
|
|
|
4
4
|
*/
|
|
5
5
|
const tableUtil = {
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
* @param
|
|
7
|
+
* 将非空数组连接为逗号分隔的文本,空数组返回 null;其他值原样返回。
|
|
8
|
+
* @param callValue - 需要处理的值
|
|
9
9
|
*/
|
|
10
10
|
formatValue(callValue) {
|
|
11
11
|
if (Array.isArray(callValue)) return callValue.length ? callValue.join(` , `) : null;
|
|
12
12
|
return callValue;
|
|
13
13
|
},
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
15
|
+
* 按点分隔的属性路径读取行数据,例如 user.name。
|
|
16
|
+
* @param row - 当前行数据
|
|
17
|
+
* @param prop - 当前 prop
|
|
18
|
+
* @returns 目标属性值;中间节点不是对象或属性不存在时返回 undefined。
|
|
18
19
|
*/
|
|
19
20
|
handleRowAccordingToProp(row, prop) {
|
|
20
21
|
let value = row;
|
|
@@ -25,8 +26,8 @@ const tableUtil = {
|
|
|
25
26
|
return value;
|
|
26
27
|
},
|
|
27
28
|
/**
|
|
28
|
-
*
|
|
29
|
-
* @param
|
|
29
|
+
* 返回点分隔属性路径的最后一级名称。
|
|
30
|
+
* @param prop - 当前 prop
|
|
30
31
|
*/
|
|
31
32
|
handleProp(prop) {
|
|
32
33
|
const propArr = prop.split(".");
|
|
@@ -34,11 +35,12 @@ const tableUtil = {
|
|
|
34
35
|
return propArr.at(-1) ?? prop;
|
|
35
36
|
},
|
|
36
37
|
/**
|
|
37
|
-
*
|
|
38
|
-
* @param
|
|
39
|
-
* @param
|
|
40
|
-
* @param
|
|
41
|
-
* @param
|
|
38
|
+
* 按值匹配枚举项,并读取指定的标签字段或 Tag 类型。
|
|
39
|
+
* @param callValue - 当前单元格值
|
|
40
|
+
* @param enumData - 字典列表
|
|
41
|
+
* @param fieldNames - 标签与值的字段名
|
|
42
|
+
* @param type - 过滤类型(目前只有 tag)
|
|
43
|
+
* @returns 匹配项的标签;未匹配时返回 null。查询 Tag 类型时默认返回 info。
|
|
42
44
|
*/
|
|
43
45
|
filterEnum(callValue, enumData, fieldNames, type) {
|
|
44
46
|
const value = fieldNames?.value ?? "value";
|
|
@@ -48,7 +50,7 @@ const tableUtil = {
|
|
|
48
50
|
return filterData ? filterData[label] : null;
|
|
49
51
|
},
|
|
50
52
|
/**
|
|
51
|
-
*
|
|
53
|
+
* 创建按排序条件依次比较行数据的函数,支持点分隔的属性路径。
|
|
52
54
|
*/
|
|
53
55
|
arrayDynamicSort(sortList) {
|
|
54
56
|
return (a, b) => {
|
|
@@ -56,8 +58,8 @@ const tableUtil = {
|
|
|
56
58
|
const property = condition.enField;
|
|
57
59
|
const order = condition.mode;
|
|
58
60
|
if (!property) continue;
|
|
59
|
-
const aValue = a
|
|
60
|
-
const bValue = b
|
|
61
|
+
const aValue = this.handleRowAccordingToProp(a, property);
|
|
62
|
+
const bValue = this.handleRowAccordingToProp(b, property);
|
|
61
63
|
if (typeof aValue === "string" && typeof bValue === "string") {
|
|
62
64
|
if (order === "ascending") {
|
|
63
65
|
const comparison = aValue.localeCompare(bValue, "zh-CN");
|
|
@@ -78,7 +80,7 @@ const tableUtil = {
|
|
|
78
80
|
};
|
|
79
81
|
},
|
|
80
82
|
/**
|
|
81
|
-
*
|
|
83
|
+
* 将静态枚举或同步枚举函数的返回值存入映射。
|
|
82
84
|
*/
|
|
83
85
|
setEnumMap(columnEnum, prop, enumMap) {
|
|
84
86
|
if (!columnEnum) return;
|
|
@@ -86,7 +88,8 @@ const tableUtil = {
|
|
|
86
88
|
else if (Array.isArray(columnEnum)) enumMap.set(prop, columnEnum);
|
|
87
89
|
},
|
|
88
90
|
/**
|
|
89
|
-
*
|
|
91
|
+
* 收集叶子列,并补齐列的 show 默认值与枚举映射。
|
|
92
|
+
* @remarks 会修改传入列的 show 属性;嵌套子列不继承本次枚举映射参数。
|
|
90
93
|
*/
|
|
91
94
|
flatColumns(columns, enumMap) {
|
|
92
95
|
const flatArr = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.mjs","names":[],"sources":["../../../../src/components/table/utils/table.ts"],"sourcesContent":["import type { PagedSortInput } from \"../src/page.type\";\nimport type { DefaultRow } from \"../src/table.state\";\nimport type { FaTableColumnCtx, FaTableEnumColumnCtx, FaTableEnumColumnType } from \"../src/table.type\";\n\n/**\n * 表格工具类\n */\nexport const tableUtil = {\n\t/**\n\t *
|
|
1
|
+
{"version":3,"file":"table.mjs","names":[],"sources":["../../../../src/components/table/utils/table.ts"],"sourcesContent":["import type { PagedSortInput } from \"../src/page.type\";\nimport type { DefaultRow } from \"../src/table.state\";\nimport type { FaTableColumnCtx, FaTableEnumColumnCtx, FaTableEnumColumnType } from \"../src/table.type\";\n\n/**\n * 表格工具类\n */\nexport const tableUtil = {\n\t/**\n\t * 将非空数组连接为逗号分隔的文本,空数组返回 null;其他值原样返回。\n\t * @param callValue - 需要处理的值\n\t */\n\tformatValue(callValue: unknown): unknown {\n\t\tif (Array.isArray(callValue)) return callValue.length ? callValue.join(` , `) : null;\n\t\treturn callValue;\n\t},\n\t/**\n\t * 按点分隔的属性路径读取行数据,例如 user.name。\n\t * @param row - 当前行数据\n\t * @param prop - 当前 prop\n\t * @returns 目标属性值;中间节点不是对象或属性不存在时返回 undefined。\n\t */\n\thandleRowAccordingToProp(row: DefaultRow, prop: string): unknown {\n\t\tlet value: unknown = row;\n\t\tfor (const item of prop.split(\".\")) {\n\t\t\tif (typeof value !== \"object\" || value === null) return undefined;\n\t\t\tvalue = (value as Record<string, unknown>)[item];\n\t\t}\n\t\treturn value;\n\t},\n\t/**\n\t * 返回点分隔属性路径的最后一级名称。\n\t * @param prop - 当前 prop\n\t */\n\thandleProp(prop: string): string {\n\t\tconst propArr = prop.split(\".\");\n\t\tif (propArr.length === 1) return prop;\n\t\treturn propArr.at(-1) ?? prop;\n\t},\n\t/**\n\t * 按值匹配枚举项,并读取指定的标签字段或 Tag 类型。\n\t * @param callValue - 当前单元格值\n\t * @param enumData - 字典列表\n\t * @param fieldNames - 标签与值的字段名\n\t * @param type - 过滤类型(目前只有 tag)\n\t * @returns 匹配项的标签;未匹配时返回 null。查询 Tag 类型时默认返回 info。\n\t */\n\tfilterEnum(callValue: unknown, enumData: FaTableEnumColumnCtx[], fieldNames?: { label: string; value: string }, type?: \"tag\"): unknown {\n\t\tconst value = fieldNames?.value ?? \"value\";\n\t\tconst label = fieldNames?.label ?? \"label\";\n\t\tconst filterData = enumData.find((item) => item[value] === callValue);\n\t\tif (type === \"tag\") {\n\t\t\treturn filterData?.type ?? \"info\";\n\t\t}\n\t\treturn filterData ? filterData[label] : null;\n\t},\n\t/**\n\t * 创建按排序条件依次比较行数据的函数,支持点分隔的属性路径。\n\t */\n\tarrayDynamicSort(sortList: PagedSortInput[]): (a: DefaultRow, b: DefaultRow) => number {\n\t\treturn (a, b) => {\n\t\t\tif (sortList.length > 0) {\n\t\t\t\tfor (const condition of sortList) {\n\t\t\t\t\tconst property = condition.enField;\n\t\t\t\t\tconst order = condition.mode;\n\t\t\t\t\tif (!property) continue;\n\n\t\t\t\t\tconst aValue = this.handleRowAccordingToProp(a, property);\n\t\t\t\t\tconst bValue = this.handleRowAccordingToProp(b, property);\n\n\t\t\t\t\tif (typeof aValue === \"string\" && typeof bValue === \"string\") {\n\t\t\t\t\t\tif (order === \"ascending\") {\n\t\t\t\t\t\t\tconst comparison = aValue.localeCompare(bValue, \"zh-CN\");\n\t\t\t\t\t\t\tif (comparison !== 0) {\n\t\t\t\t\t\t\t\treturn comparison;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (order === \"descending\") {\n\t\t\t\t\t\t\tconst comparison = bValue.localeCompare(aValue, \"zh-CN\");\n\t\t\t\t\t\t\tif (comparison !== 0) {\n\t\t\t\t\t\t\t\treturn comparison;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (order === \"ascending\") {\n\t\t\t\t\t\t\tif ((aValue as string) < (bValue as string)) return -1;\n\t\t\t\t\t\t\tif ((aValue as string) > (bValue as string)) return 1;\n\t\t\t\t\t\t} else if (order === \"descending\") {\n\t\t\t\t\t\t\tif ((aValue as string) > (bValue as string)) return -1;\n\t\t\t\t\t\t\tif ((aValue as string) < (bValue as string)) return 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn 0;\n\t\t};\n\t},\n\t/**\n\t * 将静态枚举或同步枚举函数的返回值存入映射。\n\t */\n\tsetEnumMap(columnEnum: FaTableEnumColumnType, prop: string, enumMap: Map<string, FaTableEnumColumnCtx[]>): void {\n\t\tif (!columnEnum) return;\n\t\tif (typeof columnEnum === \"function\") {\n\t\t\tenumMap.set(prop, columnEnum());\n\t\t} else if (Array.isArray(columnEnum)) {\n\t\t\tenumMap.set(prop, columnEnum);\n\t\t}\n\t},\n\t/**\n\t * 收集叶子列,并补齐列的 show 默认值与枚举映射。\n\t * @remarks 会修改传入列的 show 属性;嵌套子列不继承本次枚举映射参数。\n\t */\n\tflatColumns(columns: FaTableColumnCtx[], enumMap?: Map<string, FaTableEnumColumnCtx[]>): FaTableColumnCtx[] {\n\t\tconst flatArr: FaTableColumnCtx[] = [];\n\t\tcolumns.forEach((col) => {\n\t\t\tif (col._children?.length) {\n\t\t\t\tflatArr.push(...this.flatColumns(col._children));\n\t\t\t}\n\n\t\t\tflatArr.push(col);\n\n\t\t\t// 给每一项 column 添加 show && filterEnum 默认属性\n\t\t\tcol.show ??= true;\n\t\t\tlet enumKey = col.prop ?? col.search?.key;\n\n\t\t\tif (col.enum && typeof col.enum === \"string\") {\n\t\t\t\tenumKey = col.enum;\n\t\t\t}\n\n\t\t\t// 设置 enumMap\n\t\t\tif (col.enum && enumKey && enumMap) this.setEnumMap(col.enum, enumKey, enumMap);\n\t\t});\n\t\treturn flatArr.filter((item) => !item._children?.length);\n\t},\n};\n"],"mappings":";;;;AAOA,MAAa,YAAY;;;;;CAKxB,YAAY,WAA6B;EACxC,IAAI,MAAM,QAAQ,SAAS,GAAG,OAAO,UAAU,SAAS,UAAU,KAAK,KAAK,IAAI;EAChF,OAAO;CACR;;;;;;;CAOA,yBAAyB,KAAiB,MAAuB;EAChE,IAAI,QAAiB;EACrB,KAAK,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OAAO;IACrD;GAEF;GAGD,OAAO;EACR;CACD;;;;CAIA,WAAW,YAAmC,MAAc,SAAoD;EAC/G,IAAI,CAAC,YAAY;EACjB,IAAI,OAAO,eAAe,YACzB,QAAQ,IAAI,MAAM,WAAW,CAAC;OACxB,IAAI,MAAM,QAAQ,UAAU,GAClC,QAAQ,IAAI,MAAM,UAAU;CAE9B;;;;;CAKA,YAAY,SAA6B,SAAmE;EAC3G,MAAM,UAA8B,CAAC;EACrC,QAAQ,SAAS,QAAQ;GACxB,IAAI,IAAI,WAAW,QAClB,QAAQ,KAAK,GAAG,KAAK,YAAY,IAAI,SAAS,CAAC;GAGhD,QAAQ,KAAK,GAAG;GAGhB,IAAI,SAAS;GACb,IAAI,UAAU,IAAI,QAAQ,IAAI,QAAQ;GAEtC,IAAI,IAAI,QAAQ,OAAO,IAAI,SAAS,UACnC,UAAU,IAAI;GAIf,IAAI,IAAI,QAAQ,WAAW,SAAS,KAAK,WAAW,IAAI,MAAM,SAAS,OAAO;EAC/E,CAAC;EACD,OAAO,QAAQ,QAAQ,SAAS,CAAC,KAAK,WAAW,MAAM;CACxD;AACD"}
|
|
@@ -7,9 +7,9 @@ export default FaTree;
|
|
|
7
7
|
export { faTreeProps, faTreeEmits };
|
|
8
8
|
export type { FaTreeSlots } from "./src/tree";
|
|
9
9
|
export type * from "./src/tree.type";
|
|
10
|
-
/** FaTree
|
|
10
|
+
/** FaTree 暴露的组件实例类型 */
|
|
11
11
|
export type FaTreeInstance = InstanceType<typeof Tree>;
|
|
12
|
-
/** FaTree 的完整 Props
|
|
12
|
+
/** FaTree 的完整 Props 类型 */
|
|
13
13
|
export type FaTreeProps = ExtractPropTypes<typeof faTreeProps>;
|
|
14
|
-
/** FaTree 的 Emits
|
|
14
|
+
/** FaTree 的 Emits 类型 */
|
|
15
15
|
export type FaTreeEmits = typeof faTreeEmits;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["Tree"],"sources":["../../../src/components/tree/index.ts"],"sourcesContent":["import { withInstall } from \"../../utils\";\nimport Tree, { faTreeEmits, faTreeProps } from \"./src/tree\";\nimport type { ExtractPropTypes } from \"vue\";\nimport type { TSXWithInstall } from \"../../utils\";\n\n/** 支持远程加载、筛选和节点操作的树组件。 */\nexport const FaTree: TSXWithInstall<typeof Tree> = withInstall(Tree);\nexport default FaTree;\n\nexport { faTreeProps, faTreeEmits };\nexport type { FaTreeSlots } from \"./src/tree\";\nexport type * from \"./src/tree.type\";\n\n/** FaTree
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["Tree"],"sources":["../../../src/components/tree/index.ts"],"sourcesContent":["import { withInstall } from \"../../utils\";\nimport Tree, { faTreeEmits, faTreeProps } from \"./src/tree\";\nimport type { ExtractPropTypes } from \"vue\";\nimport type { TSXWithInstall } from \"../../utils\";\n\n/** 支持远程加载、筛选和节点操作的树组件。 */\nexport const FaTree: TSXWithInstall<typeof Tree> = withInstall(Tree);\nexport default FaTree;\n\nexport { faTreeProps, faTreeEmits };\nexport type { FaTreeSlots } from \"./src/tree\";\nexport type * from \"./src/tree.type\";\n\n/** FaTree 暴露的组件实例类型 */\nexport type FaTreeInstance = InstanceType<typeof Tree>;\n\n/** FaTree 的完整 Props 类型 */\nexport type FaTreeProps = ExtractPropTypes<typeof faTreeProps>;\n\n/** FaTree 的 Emits 类型 */\nexport type FaTreeEmits = typeof faTreeEmits;\n"],"mappings":";;;;AAMA,MAAa,SAAsC,YAAYA,YAAI"}
|
|
@@ -12,11 +12,11 @@ export interface TreeNode {
|
|
|
12
12
|
}
|
|
13
13
|
/** 树组件的数据集合。 */
|
|
14
14
|
export type TreeData = TreeNodeData[];
|
|
15
|
-
/**
|
|
15
|
+
/** 树节点的唯一键类型 */
|
|
16
16
|
export type TreeKey = string | number;
|
|
17
17
|
/** 树节点的懒加载方法。 */
|
|
18
18
|
export type LoadFunction = (rootNode: TreeNode, loadedCallback: (data: TreeData) => void, stopLoading: () => void) => void;
|
|
19
|
-
/**
|
|
19
|
+
/** 树节点字段映射配置 */
|
|
20
20
|
export interface TreeOptionProps {
|
|
21
21
|
children?: string;
|
|
22
22
|
label?: string | ((data: TreeNodeData, node: TreeNode) => string);
|
|
@@ -6,9 +6,9 @@ export declare const FaTreeSelect: TSXWithInstall<typeof TreeSelect>;
|
|
|
6
6
|
export default FaTreeSelect;
|
|
7
7
|
export { faTreeSelectProps, faTreeSelectEmits };
|
|
8
8
|
export type { FaTreeSelectSlots } from "./src/treeSelect";
|
|
9
|
-
/** FaTreeSelect
|
|
9
|
+
/** FaTreeSelect 暴露的组件实例类型 */
|
|
10
10
|
export type FaTreeSelectInstance = InstanceType<typeof TreeSelect>;
|
|
11
|
-
/** FaTreeSelect 的完整 Props
|
|
11
|
+
/** FaTreeSelect 的完整 Props 类型 */
|
|
12
12
|
export type FaTreeSelectProps = ExtractPropTypes<typeof faTreeSelectProps>;
|
|
13
|
-
/** FaTreeSelect 的 Emits
|
|
13
|
+
/** FaTreeSelect 的 Emits 类型 */
|
|
14
14
|
export type FaTreeSelectEmits = typeof faTreeSelectEmits;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["TreeSelect"],"sources":["../../../src/components/treeSelect/index.ts"],"sourcesContent":["import { withInstall } from \"../../utils\";\nimport TreeSelect, { faTreeSelectEmits, faTreeSelectProps } from \"./src/treeSelect\";\nimport type { ExtractPropTypes } from \"vue\";\nimport type { TSXWithInstall } from \"../../utils\";\n\n/** 组合树结构浏览与选择交互的树选择器组件。 */\nexport const FaTreeSelect: TSXWithInstall<typeof TreeSelect> = withInstall(TreeSelect);\nexport default FaTreeSelect;\n\nexport { faTreeSelectProps, faTreeSelectEmits };\nexport type { FaTreeSelectSlots } from \"./src/treeSelect\";\n\n/** FaTreeSelect
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["TreeSelect"],"sources":["../../../src/components/treeSelect/index.ts"],"sourcesContent":["import { withInstall } from \"../../utils\";\nimport TreeSelect, { faTreeSelectEmits, faTreeSelectProps } from \"./src/treeSelect\";\nimport type { ExtractPropTypes } from \"vue\";\nimport type { TSXWithInstall } from \"../../utils\";\n\n/** 组合树结构浏览与选择交互的树选择器组件。 */\nexport const FaTreeSelect: TSXWithInstall<typeof TreeSelect> = withInstall(TreeSelect);\nexport default FaTreeSelect;\n\nexport { faTreeSelectProps, faTreeSelectEmits };\nexport type { FaTreeSelectSlots } from \"./src/treeSelect\";\n\n/** FaTreeSelect 暴露的组件实例类型 */\nexport type FaTreeSelectInstance = InstanceType<typeof TreeSelect>;\n\n/** FaTreeSelect 的完整 Props 类型 */\nexport type FaTreeSelectProps = ExtractPropTypes<typeof faTreeSelectProps>;\n\n/** FaTreeSelect 的 Emits 类型 */\nexport type FaTreeSelectEmits = typeof faTreeSelectEmits;\n"],"mappings":";;;;AAMA,MAAa,eAAkD,YAAYA,kBAAU"}
|
|
@@ -976,10 +976,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
976
976
|
"onNode-drag-over"?: ((draggingNode: import("element-plus/es/components/tree/src/model/node.mjs").default, dropNode: import("element-plus/es/components/tree/src/model/node.mjs").default, evt: DragEvent) => any) | undefined;
|
|
977
977
|
}>, {
|
|
978
978
|
data: ElSelectorOutput<ElSelectorValue, any>[];
|
|
979
|
-
loading: boolean;
|
|
980
979
|
props: SelectComponentProps;
|
|
981
980
|
offset: number;
|
|
982
981
|
placement: import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<(new (...args: any[]) => "left" | "right" | "top" | "auto" | "bottom" | "auto-start" | "auto-end" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => import("element-plus").Placement) | ((new (...args: any[]) => "left" | "right" | "top" | "auto" | "bottom" | "auto-start" | "auto-end" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => import("element-plus").Placement) | null)[], import("element-plus").Placement, unknown>;
|
|
982
|
+
loading: boolean;
|
|
983
983
|
disabled: boolean;
|
|
984
984
|
modelValue: ElSelectorModelValue;
|
|
985
985
|
autocomplete: string;
|
|
@@ -6,9 +6,9 @@ export declare const FaUpload: TSXWithInstall<typeof Upload>;
|
|
|
6
6
|
export default FaUpload;
|
|
7
7
|
export { faUploadProps, faUploadEmits };
|
|
8
8
|
export type { FaUploadSlots } from "./src/upload";
|
|
9
|
-
/** FaUpload
|
|
9
|
+
/** FaUpload 暴露的组件实例类型 */
|
|
10
10
|
export type FaUploadInstance = InstanceType<typeof Upload>;
|
|
11
|
-
/** FaUpload 的完整 Props
|
|
11
|
+
/** FaUpload 的完整 Props 类型 */
|
|
12
12
|
export type FaUploadProps = ExtractPropTypes<typeof faUploadProps>;
|
|
13
|
-
/** FaUpload 的 Emits
|
|
13
|
+
/** FaUpload 的 Emits 类型 */
|
|
14
14
|
export type FaUploadEmits = typeof faUploadEmits;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["Upload"],"sources":["../../../src/components/upload/index.ts"],"sourcesContent":["import { withInstall } from \"../../utils\";\nimport Upload, { faUploadEmits, faUploadProps } from \"./src/upload\";\nimport type { ExtractPropTypes } from \"vue\";\nimport type { TSXWithInstall } from \"../../utils\";\n\n/** 统一上传校验、进度和文件列表处理的上传组件。 */\nexport const FaUpload: TSXWithInstall<typeof Upload> = withInstall(Upload);\nexport default FaUpload;\n\nexport { faUploadProps, faUploadEmits };\nexport type { FaUploadSlots } from \"./src/upload\";\n\n/** FaUpload
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["Upload"],"sources":["../../../src/components/upload/index.ts"],"sourcesContent":["import { withInstall } from \"../../utils\";\nimport Upload, { faUploadEmits, faUploadProps } from \"./src/upload\";\nimport type { ExtractPropTypes } from \"vue\";\nimport type { TSXWithInstall } from \"../../utils\";\n\n/** 统一上传校验、进度和文件列表处理的上传组件。 */\nexport const FaUpload: TSXWithInstall<typeof Upload> = withInstall(Upload);\nexport default FaUpload;\n\nexport { faUploadProps, faUploadEmits };\nexport type { FaUploadSlots } from \"./src/upload\";\n\n/** FaUpload 暴露的组件实例类型 */\nexport type FaUploadInstance = InstanceType<typeof Upload>;\n\n/** FaUpload 的完整 Props 类型 */\nexport type FaUploadProps = ExtractPropTypes<typeof faUploadProps>;\n\n/** FaUpload 的 Emits 类型 */\nexport type FaUploadEmits = typeof faUploadEmits;\n"],"mappings":";;;;AAMA,MAAa,WAA0C,YAAYA,cAAM"}
|
|
@@ -15,19 +15,24 @@ export declare const uploadUtil: {
|
|
|
15
15
|
/** 判断文件是否符合 HTML accept 规则。 */
|
|
16
16
|
matchesAccept(file: File, accept?: string): boolean;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
* @param url 地址
|
|
20
|
-
* @param file 文件
|
|
21
|
-
* @param fileName 文件名称
|
|
22
|
-
* @param params
|
|
18
|
+
* 使用 multipart/form-data 上传文件。
|
|
19
|
+
* @param url - 地址
|
|
20
|
+
* @param file - 文件
|
|
21
|
+
* @param fileName - 文件名称
|
|
22
|
+
* @param params - 附加表单字段
|
|
23
|
+
* @param request - 请求头、方法与凭据选项
|
|
24
|
+
* @returns 响应正文文本
|
|
25
|
+
* @remarks 地址为空、网络失败或 HTTP 状态失败时,返回的 Promise 被拒绝。
|
|
23
26
|
*/
|
|
24
27
|
uploadFile(url: string, file: File, fileName: string, params?: UploadData, request?: UploadRequestConfig): Promise<string>;
|
|
25
28
|
/**
|
|
26
|
-
*
|
|
27
|
-
* @param
|
|
28
|
-
* @param file 文件
|
|
29
|
-
* @param fileName 文件名称
|
|
30
|
-
* @param params
|
|
29
|
+
* 通过指定接口上传文件。
|
|
30
|
+
* @param api - 接收表单数据并返回上传结果的接口
|
|
31
|
+
* @param file - 文件
|
|
32
|
+
* @param fileName - 文件名称
|
|
33
|
+
* @param params - 附加表单字段
|
|
34
|
+
* @returns 接口返回的上传结果
|
|
35
|
+
* @remarks 接口未提供或调用失败时,返回的 Promise 被拒绝。
|
|
31
36
|
*/
|
|
32
37
|
uploadFileByApi(api: ((formData: FormData) => Promise<string>) | null | undefined, file: File, fileName: string, params?: UploadData): Promise<string>;
|
|
33
38
|
};
|
|
@@ -41,11 +41,14 @@ const uploadUtil = {
|
|
|
41
41
|
});
|
|
42
42
|
},
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
45
|
-
* @param url 地址
|
|
46
|
-
* @param file 文件
|
|
47
|
-
* @param fileName 文件名称
|
|
48
|
-
* @param params
|
|
44
|
+
* 使用 multipart/form-data 上传文件。
|
|
45
|
+
* @param url - 地址
|
|
46
|
+
* @param file - 文件
|
|
47
|
+
* @param fileName - 文件名称
|
|
48
|
+
* @param params - 附加表单字段
|
|
49
|
+
* @param request - 请求头、方法与凭据选项
|
|
50
|
+
* @returns 响应正文文本
|
|
51
|
+
* @remarks 地址为空、网络失败或 HTTP 状态失败时,返回的 Promise 被拒绝。
|
|
49
52
|
*/
|
|
50
53
|
async uploadFile(url, file, fileName, params, request) {
|
|
51
54
|
if (!url) {
|
|
@@ -77,11 +80,13 @@ const uploadUtil = {
|
|
|
77
80
|
}
|
|
78
81
|
},
|
|
79
82
|
/**
|
|
80
|
-
*
|
|
81
|
-
* @param
|
|
82
|
-
* @param file 文件
|
|
83
|
-
* @param fileName 文件名称
|
|
84
|
-
* @param params
|
|
83
|
+
* 通过指定接口上传文件。
|
|
84
|
+
* @param api - 接收表单数据并返回上传结果的接口
|
|
85
|
+
* @param file - 文件
|
|
86
|
+
* @param fileName - 文件名称
|
|
87
|
+
* @param params - 附加表单字段
|
|
88
|
+
* @returns 接口返回的上传结果
|
|
89
|
+
* @remarks 接口未提供或调用失败时,返回的 Promise 被拒绝。
|
|
85
90
|
*/
|
|
86
91
|
async uploadFileByApi(api, file, fileName, params) {
|
|
87
92
|
if (!api) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.mjs","names":[],"sources":["../../../../src/components/upload/utils/upload.ts"],"sourcesContent":["import { ElMessage } from \"element-plus\";\nimport { FaMimeType } from \"../../../constants\";\ntype UploadData = Record<string, string | Blob | [string | Blob, string] | string[]>;\n\ninterface UploadRequestConfig {\n\tmethod?: string;\n\theaders?: HeadersInit;\n\twithCredentials?: boolean;\n}\n\n/** 将 Element Plus 上传附加数据写入 FormData。 */\nconst appendUploadData = (formData: FormData, params: UploadData): void => {\n\tfor (const [key, value] of Object.entries(params)) {\n\t\tif (Array.isArray(value)) {\n\t\t\tif (value.length === 2 && value[0] instanceof Blob && typeof value[1] === \"string\") {\n\t\t\t\tformData.append(key, value[0], value[1]);\n\t\t\t} else {\n\t\t\t\tvalue.forEach((item) => formData.append(key, item));\n\t\t\t}\n\t\t} else {\n\t\t\tformData.append(key, value);\n\t\t}\n\t}\n};\n\nconst FaMimeTypeNames: Record<string, keyof typeof FaMimeType> = {};\n\nfor (const [kName, vAccept] of Object.entries(FaMimeType)) {\n\tvAccept.split(\",\").forEach((tItem) => {\n\t\tFaMimeTypeNames[tItem.trim()] = kName as keyof typeof FaMimeType;\n\t});\n}\n\n/**\n * 上传工具类\n */\nexport const uploadUtil = {\n\t/**\n\t * 识别文件类型\n\t */\n\tdetectFileType(accept: string): string {\n\t\tconst detectTypes = new Set<string>();\n\t\taccept.split(\",\").forEach((mimeType) => {\n\t\t\tconst normalizedMimeType = mimeType.trim();\n\t\t\tif (normalizedMimeType) detectTypes.add(FaMimeTypeNames[normalizedMimeType] ?? normalizedMimeType);\n\t\t});\n\t\treturn Array.from(detectTypes).join(\",\");\n\t},\n\t/** 判断文件是否符合 HTML accept 规则。 */\n\tmatchesAccept(file: File, accept?: string): boolean {\n\t\tif (!accept?.trim()) return true;\n\t\tconst fileName = file.name.toLowerCase();\n\t\tconst fileType = file.type.toLowerCase();\n\t\treturn accept.split(\",\").some((item) => {\n\t\t\tconst rule = item.trim().toLowerCase();\n\t\t\tif (!rule) return false;\n\t\t\tif (rule.startsWith(\".\")) return fileName.endsWith(rule);\n\t\t\tif (rule.endsWith(\"/*\")) return fileType.startsWith(rule.slice(0, -1));\n\t\t\treturn fileType === rule;\n\t\t});\n\t},\n\t/**\n\t *
|
|
1
|
+
{"version":3,"file":"upload.mjs","names":[],"sources":["../../../../src/components/upload/utils/upload.ts"],"sourcesContent":["import { ElMessage } from \"element-plus\";\nimport { FaMimeType } from \"../../../constants\";\ntype UploadData = Record<string, string | Blob | [string | Blob, string] | string[]>;\n\ninterface UploadRequestConfig {\n\tmethod?: string;\n\theaders?: HeadersInit;\n\twithCredentials?: boolean;\n}\n\n/** 将 Element Plus 上传附加数据写入 FormData。 */\nconst appendUploadData = (formData: FormData, params: UploadData): void => {\n\tfor (const [key, value] of Object.entries(params)) {\n\t\tif (Array.isArray(value)) {\n\t\t\tif (value.length === 2 && value[0] instanceof Blob && typeof value[1] === \"string\") {\n\t\t\t\tformData.append(key, value[0], value[1]);\n\t\t\t} else {\n\t\t\t\tvalue.forEach((item) => formData.append(key, item));\n\t\t\t}\n\t\t} else {\n\t\t\tformData.append(key, value);\n\t\t}\n\t}\n};\n\nconst FaMimeTypeNames: Record<string, keyof typeof FaMimeType> = {};\n\nfor (const [kName, vAccept] of Object.entries(FaMimeType)) {\n\tvAccept.split(\",\").forEach((tItem) => {\n\t\tFaMimeTypeNames[tItem.trim()] = kName as keyof typeof FaMimeType;\n\t});\n}\n\n/**\n * 上传工具类\n */\nexport const uploadUtil = {\n\t/**\n\t * 识别文件类型\n\t */\n\tdetectFileType(accept: string): string {\n\t\tconst detectTypes = new Set<string>();\n\t\taccept.split(\",\").forEach((mimeType) => {\n\t\t\tconst normalizedMimeType = mimeType.trim();\n\t\t\tif (normalizedMimeType) detectTypes.add(FaMimeTypeNames[normalizedMimeType] ?? normalizedMimeType);\n\t\t});\n\t\treturn Array.from(detectTypes).join(\",\");\n\t},\n\t/** 判断文件是否符合 HTML accept 规则。 */\n\tmatchesAccept(file: File, accept?: string): boolean {\n\t\tif (!accept?.trim()) return true;\n\t\tconst fileName = file.name.toLowerCase();\n\t\tconst fileType = file.type.toLowerCase();\n\t\treturn accept.split(\",\").some((item) => {\n\t\t\tconst rule = item.trim().toLowerCase();\n\t\t\tif (!rule) return false;\n\t\t\tif (rule.startsWith(\".\")) return fileName.endsWith(rule);\n\t\t\tif (rule.endsWith(\"/*\")) return fileType.startsWith(rule.slice(0, -1));\n\t\t\treturn fileType === rule;\n\t\t});\n\t},\n\t/**\n\t * 使用 multipart/form-data 上传文件。\n\t * @param url - 地址\n\t * @param file - 文件\n\t * @param fileName - 文件名称\n\t * @param params - 附加表单字段\n\t * @param request - 请求头、方法与凭据选项\n\t * @returns 响应正文文本\n\t * @remarks 地址为空、网络失败或 HTTP 状态失败时,返回的 Promise 被拒绝。\n\t */\n\tasync uploadFile(url: string, file: File, fileName: string, params?: UploadData, request?: UploadRequestConfig): Promise<string> {\n\t\tif (!url) {\n\t\t\tconsole.error(\"[Fast:uploadUtil]\", \"文件上传地址为空。\");\n\t\t\tElMessage.error(\"文件上传地址为空!\");\n\t\t\tthrow new Error(\"文件上传地址为空!\");\n\t\t}\n\t\tconst formData = new FormData();\n\t\tformData.append(\"file\", file);\n\t\tformData.append(\"fileName\", fileName);\n\t\tif (params) appendUploadData(formData, params);\n\t\ttry {\n\t\t\tconst response = await fetch(url, {\n\t\t\t\theaders: request?.headers,\n\t\t\t\tmethod: request?.method ?? \"POST\",\n\t\t\t\tcredentials: request?.withCredentials ? \"include\" : \"same-origin\",\n\t\t\t\tbody: formData,\n\t\t\t});\n\t\t\tif (!response.ok) {\n\t\t\t\tconsole.error(\"[Fast:uploadUtil]\", `文件上传失败,HTTP 状态码:${response.status.toString()}。`);\n\t\t\t\tElMessage.error(\"文件上传失败!\");\n\t\t\t\tthrow new Error(\"文件上传失败!\");\n\t\t\t}\n\t\t\treturn await response.text();\n\t\t} catch (error) {\n\t\t\tconsole.error(\"[Fast:uploadUtil]\", \"文件上传失败。\", error);\n\t\t\tElMessage.error(\"文件上传失败!\");\n\t\t\tthrow error instanceof Error ? error : new Error(\"文件上传失败!\");\n\t\t}\n\t},\n\t/**\n\t * 通过指定接口上传文件。\n\t * @param api - 接收表单数据并返回上传结果的接口\n\t * @param file - 文件\n\t * @param fileName - 文件名称\n\t * @param params - 附加表单字段\n\t * @returns 接口返回的上传结果\n\t * @remarks 接口未提供或调用失败时,返回的 Promise 被拒绝。\n\t */\n\tasync uploadFileByApi(\n\t\tapi: ((formData: FormData) => Promise<string>) | null | undefined,\n\t\tfile: File,\n\t\tfileName: string,\n\t\tparams?: UploadData\n\t): Promise<string> {\n\t\tif (!api) {\n\t\t\tconsole.error(\"[Fast:uploadUtil]\", \"文件上传接口为空。\");\n\t\t\tElMessage.error(\"文件上传接口为空!\");\n\t\t\tthrow new Error(\"文件上传接口为空!\");\n\t\t}\n\t\tconst formData = new FormData();\n\t\tformData.append(\"file\", file);\n\t\tformData.append(\"fileName\", fileName);\n\t\tif (params) appendUploadData(formData, params);\n\t\ttry {\n\t\t\treturn await api(formData);\n\t\t} catch (error) {\n\t\t\tconsole.error(\"[Fast:uploadUtil]\", \"文件上传失败。\", error);\n\t\t\tElMessage.error(\"文件上传失败!\");\n\t\t\tthrow error instanceof Error ? error : new Error(\"文件上传失败!\");\n\t\t}\n\t},\n};\n"],"mappings":";;;;AAWA,MAAM,oBAAoB,UAAoB,WAA6B;CAC1E,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAC/C,IAAI,MAAM,QAAQ,KAAK,GAAG;EACzB,IAAI,MAAM,WAAW,KAAK,MAAM,cAAc,QAAQ,OAAO,MAAM,OAAO,UACzE,SAAS,OAAO,KAAK,MAAM,IAAI,MAAM,EAAE;OAEvC,MAAM,SAAS,SAAS,SAAS,OAAO,KAAK,IAAI,CAAC;CAEpD,OACC,SAAS,OAAO,KAAK,KAAK;AAG7B;AAEA,MAAM,kBAA2D,CAAC;AAElE,KAAK,MAAM,CAAC,OAAO,YAAY,OAAO,QAAQ,UAAU,GACvD,QAAQ,MAAM,GAAG,CAAC,CAAC,SAAS,UAAU;CACrC,gBAAgB,MAAM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GACD,IAAI,CAAC,SAAS,IAAI;IACjB,QAAQ,MAAM,qBAAqB,mBAAmB,SAAS,OAAO,SAAS,EAAE,EAAE;IACnF,UAAU,MAAM,SAAS;IACzB,MAAM,IAAI,MAAM,SAAS;GAC1B;GACA,OAAO,MAAM,SAAS,KAAK;EAC5B,SAAS,OAAO;GACf,QAAQ,MAAM,qBAAqB,WAAW,KAAK;GACnD,UAAU,MAAM,SAAS;GACzB,MAAM,iBAAiB,QAAQ,wBAAQ,IAAI,MAAM,SAAS;EAC3D;CACD;;;;;;;;;;CAUA,MAAM,gBACL,KACA,MACA,UACA,QACkB;EAClB,IAAI,CAAC,KAAK;GACT,QAAQ,MAAM,qBAAqB,WAAW;GAC9C,UAAU,MAAM,WAAW;GAC3B,MAAM,IAAI,MAAM,WAAW;EAC5B;EACA,MAAM,WAAW,IAAI,SAAS;EAC9B,SAAS,OAAO,QAAQ,IAAI;EAC5B,SAAS,OAAO,YAAY,QAAQ;EACpC,IAAI,QAAQ,iBAAiB,UAAU,MAAM;EAC7C,IAAI;GACH,OAAO,MAAM,IAAI,QAAQ;EAC1B,SAAS,OAAO;GACf,QAAQ,MAAM,qBAAqB,WAAW,KAAK;GACnD,UAAU,MAAM,SAAS;GACzB,MAAM,iBAAiB,QAAQ,wBAAQ,IAAI,MAAM,SAAS;EAC3D;CACD;AACD"}
|
|
@@ -6,9 +6,9 @@ export declare const FaUploadImage: TSXWithInstall<typeof UploadImage>;
|
|
|
6
6
|
export default FaUploadImage;
|
|
7
7
|
export { faUploadImageProps, faUploadImageEmits };
|
|
8
8
|
export type { FaUploadImageSlots } from "./src/uploadImage";
|
|
9
|
-
/** FaUploadImage
|
|
9
|
+
/** FaUploadImage 暴露的组件实例类型 */
|
|
10
10
|
export type FaUploadImageInstance = InstanceType<typeof UploadImage>;
|
|
11
|
-
/** FaUploadImage 的完整 Props
|
|
11
|
+
/** FaUploadImage 的完整 Props 类型 */
|
|
12
12
|
export type FaUploadImageProps = ExtractPropTypes<typeof faUploadImageProps>;
|
|
13
|
-
/** FaUploadImage 的 Emits
|
|
13
|
+
/** FaUploadImage 的 Emits 类型 */
|
|
14
14
|
export type FaUploadImageEmits = typeof faUploadImageEmits;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["UploadImage"],"sources":["../../../src/components/uploadImage/index.ts"],"sourcesContent":["import { withInstall } from \"../../utils\";\nimport UploadImage, { faUploadImageEmits, faUploadImageProps } from \"./src/uploadImage\";\nimport type { ExtractPropTypes } from \"vue\";\nimport type { TSXWithInstall } from \"../../utils\";\n\n/** 支持预览、校验和状态同步的单图片上传组件。 */\nexport const FaUploadImage: TSXWithInstall<typeof UploadImage> = withInstall(UploadImage);\nexport default FaUploadImage;\n\nexport { faUploadImageProps, faUploadImageEmits };\nexport type { FaUploadImageSlots } from \"./src/uploadImage\";\n\n/** FaUploadImage
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["UploadImage"],"sources":["../../../src/components/uploadImage/index.ts"],"sourcesContent":["import { withInstall } from \"../../utils\";\nimport UploadImage, { faUploadImageEmits, faUploadImageProps } from \"./src/uploadImage\";\nimport type { ExtractPropTypes } from \"vue\";\nimport type { TSXWithInstall } from \"../../utils\";\n\n/** 支持预览、校验和状态同步的单图片上传组件。 */\nexport const FaUploadImage: TSXWithInstall<typeof UploadImage> = withInstall(UploadImage);\nexport default FaUploadImage;\n\nexport { faUploadImageProps, faUploadImageEmits };\nexport type { FaUploadImageSlots } from \"./src/uploadImage\";\n\n/** FaUploadImage 暴露的组件实例类型 */\nexport type FaUploadImageInstance = InstanceType<typeof UploadImage>;\n\n/** FaUploadImage 的完整 Props 类型 */\nexport type FaUploadImageProps = ExtractPropTypes<typeof faUploadImageProps>;\n\n/** FaUploadImage 的 Emits 类型 */\nexport type FaUploadImageEmits = typeof faUploadImageEmits;\n"],"mappings":";;;;AAMA,MAAa,gBAAoD,YAAYA,mBAAW"}
|