@robot-admin/naive-ui-components 0.6.8 → 0.6.10
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/dist/{C_Breadcrumb-B5PGpP5m.css.map → C_Breadcrumb-BiH0d9AI.css.map} +1 -1
- package/dist/{C_Breadcrumb-Cay7qluL.css.map → C_Breadcrumb-Bqqrl8nX.css.map} +1 -1
- package/dist/C_Breadcrumb.css +8 -2
- package/dist/C_Breadcrumb.js.map +1 -1
- package/dist/C_Breadcrumb2.js.map +1 -1
- package/dist/C_Icon.js.map +1 -1
- package/dist/C_Icon2.js +1 -1
- package/dist/C_Icon2.js.map +1 -1
- package/dist/C_Language.js.map +1 -1
- package/dist/C_Language2.js +1 -1
- package/dist/C_Language2.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants2.d.ts +1 -1
- package/dist/constants3.d.ts +3 -3
- package/dist/constants4.d.ts +4 -4
- package/dist/data.d.ts +2 -2
- package/dist/index11.vue.d.ts +1 -1
- package/dist/index13.vue.d.ts +3 -3
- package/dist/index15.vue.d.ts +1 -1
- package/dist/index16.vue.d.ts +1 -1
- package/dist/index17.vue.d.ts +1 -1
- package/dist/index19.vue.d.ts +2 -2
- package/dist/index2.vue.d.ts +3 -3
- package/dist/index7.vue.d.ts +1 -1
- package/dist/index9.vue.d.ts +1 -1
- package/dist/style.css +9 -3
- package/dist/useCalendarEvents.d.ts +1 -1
- package/dist/useCollapsePanel.d.ts +5 -5
- package/dist/useCropperCore.d.ts +5 -5
- package/dist/useDraggableLayout.d.ts +2 -2
- package/dist/useDynamicFormState.d.ts +4 -4
- package/dist/useEdgeInteraction.d.ts +2 -2
- package/dist/useFullscreen.d.ts +2 -2
- package/dist/useInfiniteScroll.d.ts +2 -2
- package/dist/useModalEdit.d.ts +2 -2
- package/dist/useQRCode.d.ts +3 -3
- package/dist/useSignatureHistory.d.ts +2 -2
- package/dist/useSplitResize.d.ts +5 -5
- package/dist/useTimeSelection.d.ts +2 -2
- package/dist/useTreeOperations.d.ts +3 -3
- package/dist/useWorkflowValidation.d.ts +2 -2
- package/package.json +1 -1
package/dist/C_Icon2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"C_Icon2.js","names":["type","clickable","loading","title","ariaLabel","name","size","color","componentProps","svgPath","viewBox","alt","fallbackIcon"],"sources":["../src/hooks/useImage/index.ts","../src/components/C_Icon/index.vue","../src/components/C_Icon/index.vue","../src/components/C_Icon/index.vue"],"sourcesContent":["/**\n * @description: 图片路径解析函数(组件库版本)\n * 在组件库中,图片路径由宿主应用管理。\n * 如果传入的是完整 URL(http/https/data:)则直接返回;\n * 否则可通过 imageResolver 配置自定义解析逻辑。\n * @param {string} imagePath 图片路径或完整 URL\n * @param {Function} resolver 可选的自定义解析器\n * @return {Promise<string>} 处理后图片路径\n */\nexport const useImage = async (\n imagePath: string,\n resolver?: (path: string) => string | Promise<string>,\n): Promise<string> => {\n if (!imagePath) return \"\";\n\n // 完整 URL 直接返回\n if (\n imagePath.startsWith(\"http://\") ||\n imagePath.startsWith(\"https://\") ||\n imagePath.startsWith(\"data:\") ||\n imagePath.startsWith(\"blob:\") ||\n imagePath.startsWith(\"/\")\n ) {\n return imagePath;\n }\n\n // 如果提供了自定义解析器,使用自定义解析器\n if (resolver) {\n try {\n return await resolver(imagePath);\n } catch (e) {\n console.error(`[useImage] 自定义解析器处理失败: ${imagePath}`, e);\n return \"\";\n }\n }\n\n // 默认:直接返回路径(宿主应用应保证路径可访问)\n return imagePath;\n};\n\n/**\n * @description: 同步版本的图片路径处理函数\n * @param {string} imagePath 图片路径或完整 URL\n * @return {string} 图片URL\n */\nexport const useImageSync = (imagePath: string): string => {\n if (!imagePath) return \"\";\n\n // 完整 URL 直接返回\n if (\n imagePath.startsWith(\"http://\") ||\n imagePath.startsWith(\"https://\") ||\n imagePath.startsWith(\"data:\") ||\n imagePath.startsWith(\"blob:\") ||\n imagePath.startsWith(\"/\")\n ) {\n return imagePath;\n }\n\n return imagePath;\n};\n","/* unplugin-vue-components disabled */<!--\n * @Author: ChenYu ycyplus@gmail.com\n * @Date: 2025-05-14\n * @Description: 支持多种图标使用方式,默认使用Iconify图标,统一错误处理\n * @Migration: naive-ui-components 组件库迁移版本\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\n-->\n<template>\n <div\n ref=\"iconRef\"\n class=\"c-icon\"\n :class=\"[\n `c-icon--${type}`,\n {\n 'c-icon--clickable': clickable,\n 'c-icon--loading': loading,\n 'c-icon--error': hasError,\n },\n ]\"\n :style=\"rootStyle\"\n :title=\"title || iconDisplayName\"\n :aria-label=\"ariaLabel || iconDisplayName\"\n :role=\"clickable ? 'button' : 'img'\"\n :tabindex=\"clickable ? 0 : -1\"\n @click=\"handleClick\"\n @keydown=\"handleKeydown\"\n >\n <!-- 方式1:Iconify图标(默认方式) -->\n <Icon\n v-if=\"\n (type === 'iconify' || !type) && !hasError && typeof name === 'string'\n \"\n :icon=\"name\"\n :width=\"size\"\n :height=\"size\"\n :color=\"color\"\n :style=\"iconStyle\"\n @error=\"() => handleError('iconify', 'Iconify图标加载失败')\"\n />\n\n <!-- 方式2:UnoCSS图标 -->\n <div\n v-else-if=\"type === 'unocss' && !hasError && typeof name === 'string'\"\n :class=\"[name, iconClasses]\"\n :style=\"iconStyle\"\n @error=\"() => handleError('unocss', 'UnoCSS图标渲染失败')\"\n />\n\n <!-- 方式3:组件挂载方式 -->\n <component\n v-else-if=\"type === 'component' && resolvedComponent && !hasError\"\n :is=\"resolvedComponent\"\n :style=\"iconStyle\"\n v-bind=\"componentProps\"\n @error=\"() => handleError('component', '组件图标渲染失败')\"\n />\n\n <!-- 方式4:SVG路径方式 -->\n <svg\n v-else-if=\"type === 'svg' && svgPath && !hasError\"\n :width=\"size\"\n :height=\"size\"\n :viewBox=\"viewBox\"\n :style=\"iconStyle\"\n :fill=\"color\"\n @error=\"() => handleError('svg', 'SVG图标渲染失败')\"\n >\n <path\n :d=\"svgPath\"\n :fill=\"color\"\n />\n </svg>\n\n <!-- 方式5:图片方式 - 修复异步加载 -->\n <img\n v-else-if=\"type === 'image' && imageSrc && !hasError && !imageLoading\"\n :src=\"imageSrc\"\n :alt=\"alt || iconDisplayName\"\n :width=\"size\"\n :height=\"size\"\n style=\"display: inline-block; vertical-align: middle\"\n @error=\"() => handleError('image', '图片图标加载失败')\"\n @load=\"handleImageLoad\"\n />\n\n <!-- 图片加载状态 -->\n <div\n v-if=\"(loading || imageLoading) && !hasError\"\n class=\"c-icon__loading\"\n :style=\"iconStyle\"\n >\n <div class=\"c-icon__spinner\" />\n </div>\n\n <!-- 统一错误状态显示 -->\n <Icon\n v-else-if=\"hasError && fallbackIcon\"\n :icon=\"fallbackIcon\"\n :width=\"size\"\n :height=\"size\"\n :color=\"color\"\n :style=\"iconStyle\"\n />\n <div\n v-else-if=\"hasError\"\n class=\"c-icon__error\"\n :style=\"iconStyle\"\n :title=\"`图标解析失败: ${iconDisplayName} (${errorMessage})`\"\n >\n ⚠️\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import { Icon } from '@iconify/vue'\n import { useImage } from '../../hooks/useImage'\n import { computed, nextTick, onMounted, readonly, ref, watch } from 'vue'\n\n export interface IconProps {\n /** 图标名称/路径/组件实例 */\n name: string | any\n /** 图标类型 */\n type?: 'iconify' | 'unocss' | 'component' | 'svg' | 'image'\n /** 图标颜色 */\n color?: string\n /** 图标大小(px) */\n size?: number | string\n /** SVG路径数据(仅type=svg时使用) */\n svgPath?: string\n /** SVG viewBox(仅type=svg时使用) */\n viewBox?: string\n /** 图片alt属性(仅type=image时使用) */\n alt?: string\n /** 是否可点击 */\n clickable?: boolean\n /** 加载状态 */\n loading?: boolean\n /** 错误时的回退图标 */\n fallbackIcon?: string\n /** 工具提示 */\n title?: string\n /** 无障碍标签 */\n ariaLabel?: string\n /** 自定义样式类 */\n customClass?: string\n /** 旋转角度 */\n rotate?: number\n /** 是否翻转 */\n flip?: 'horizontal' | 'vertical' | 'both'\n /** 传递给组件的额外属性(仅type=component时使用) */\n componentProps?: Record<string, any>\n }\n\n const props = withDefaults(defineProps<IconProps>(), {\n name: undefined,\n type: 'iconify',\n color: 'currentColor',\n size: 18,\n svgPath: '',\n viewBox: '0 0 24 24',\n alt: '',\n clickable: false,\n loading: false,\n fallbackIcon: '',\n title: '',\n ariaLabel: '',\n customClass: '',\n rotate: 0,\n flip: undefined,\n componentProps: () => ({}),\n })\n\n const emit = defineEmits<{\n click: [event: MouseEvent]\n error: [type: string, error?: any]\n load: []\n }>()\n\n const iconRef = ref<HTMLElement>()\n const hasError = ref(false)\n const errorMessage = ref('')\n const imageSrc = ref<string>('') // 存储异步加载的图片URL\n const imageLoading = ref(false) // 图片加载状态\n\n // 计算根元素样式\n const rootStyle = computed(() => ({\n fontSize: typeof props.size === 'number' ? `${props.size}px` : props.size,\n color: props.color,\n cursor: props.clickable ? 'pointer' : 'default',\n }))\n\n // 计算图标样式\n const iconStyle = computed(() => {\n const style: Record<string, any> = {\n display: 'inline-flex',\n justifyContent: 'center',\n alignItems: 'center',\n width: typeof props.size === 'number' ? `${props.size}px` : props.size,\n height: typeof props.size === 'number' ? `${props.size}px` : props.size,\n }\n\n // 旋转\n if (props.rotate) {\n style.transform = `rotate(${props.rotate}deg)`\n }\n\n // 翻转\n if (props.flip) {\n const scaleX =\n props.flip === 'horizontal' || props.flip === 'both' ? -1 : 1\n const scaleY = props.flip === 'vertical' || props.flip === 'both' ? -1 : 1\n style.transform = `${\n style.transform || ''\n } scaleX(${scaleX}) scaleY(${scaleY})`.trim()\n }\n\n return style\n })\n\n // 获取图标名称用于显示\n const iconDisplayName = computed(() => {\n if (typeof props.name === 'string') {\n return props.name\n }\n if (props.name && props.name.__name) {\n return props.name.__name\n }\n if (props.name && props.name.name) {\n return props.name.name\n }\n return 'Component Icon'\n })\n\n // 图标类名\n const iconClasses = computed(() => [\n props.customClass,\n {\n 'c-icon__rotatable': props.rotate !== 0,\n 'c-icon__flippable': !!props.flip,\n },\n ])\n\n // 解析组件名称(纯计算属性,无副作用)\n const resolvedComponent = computed(() => {\n if (props.type !== 'component' || !props.name) return null\n return props.name\n })\n\n // 统一错误处理函数\n const handleError = (type: string, message: string, originalError?: any) => {\n console.warn(`[C_Icon] ${message}:`, iconDisplayName.value, originalError)\n errorMessage.value = message\n imageLoading.value = false // 错误时停止加载状态\n emit('error', type, originalError)\n\n // 如果有回退图标,尝试切换为 fallback Iconify 图标\n if (props.fallbackIcon && !hasError.value) {\n hasError.value = false\n // 将 name 重写为 fallbackIcon 并重置状态\n // 因为 props 不可变,通过模板中的 fallback 分支渲染\n return\n }\n\n hasError.value = true\n }\n\n // 处理点击事件\n const handleClick = (event: MouseEvent) => {\n if (!props.clickable || props.loading) return\n emit('click', event)\n }\n\n // 处理键盘事件\n const handleKeydown = (event: KeyboardEvent) => {\n if (!props.clickable || props.loading) return\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n emit('click', event as any)\n }\n }\n\n // 处理图片加载成功\n const handleImageLoad = () => {\n imageLoading.value = false\n emit('load')\n }\n\n // 异步加载图片 - 修复关键函数\n const loadImageSrc = async () => {\n if (props.type !== 'image' || typeof props.name !== 'string') {\n imageSrc.value = ''\n return\n }\n\n // 如果是完整URL,直接设置\n if (\n props.name.startsWith('http://') ||\n props.name.startsWith('https://') ||\n props.name.startsWith('//') ||\n props.name.startsWith('/')\n ) {\n imageSrc.value = props.name\n return\n }\n\n // 其他情况都当作本地图片处理\n try {\n imageLoading.value = true\n const imageUrl = await useImage(props.name)\n if (imageUrl) {\n imageSrc.value = imageUrl\n } else {\n handleError('image', '图片路径解析失败')\n }\n } catch (error) {\n handleError('image', '图片加载失败', error)\n } finally {\n imageLoading.value = false\n }\n }\n\n // 验证规则映射\n const validationRules = {\n iconify: (): string | null => {\n if (!props.name.includes(':')) {\n console.warn(\n '[C_Icon] Iconify图标名称格式应为 \"prefix:name\",如 \"mdi:home\"'\n )\n }\n return null\n },\n unocss: (): string | null => {\n if (typeof props.name !== 'string' || !props.name.startsWith('i-')) {\n console.warn('[C_Icon] UnoCSS图标名称应以 \"i-\" 开头')\n }\n return null\n },\n component: (): string | null =>\n !resolvedComponent.value ? '无法解析组件' : null,\n svg: (): string | null => (!props.svgPath ? 'SVG路径不能为空' : null),\n image: (): string | null => {\n // 对于image类型,异步验证在loadImageSrc中处理\n return null\n },\n }\n\n // 验证配置\n const validateProps = () => {\n hasError.value = false\n errorMessage.value = ''\n\n // 基础验证\n if (!props.name) {\n return handleError('validation', '图标名称不能为空')\n }\n\n // 类型验证\n const validator = validationRules[props.type]\n if (!validator) {\n return handleError('type', '不支持的图标类型')\n }\n\n const errorMsg = validator()\n if (errorMsg) {\n handleError(props.type, errorMsg)\n }\n\n // 如果是图片类型,异步加载图片\n if (props.type === 'image') {\n loadImageSrc()\n }\n }\n\n // 监听关键属性变化\n watch(\n () => [props.name, props.type, props.svgPath],\n () => {\n nextTick(validateProps)\n },\n { immediate: true }\n )\n\n // 组件挂载后:仅对非 image 类型触发 load 事件(watch immediate 已完成验证)\n onMounted(() => {\n if (!hasError.value && props.type !== 'image') {\n emit('load')\n }\n })\n\n // 暴露方法给父组件\n defineExpose({\n /** 重新验证配置 */\n validate: validateProps,\n /** 是否有错误 */\n hasError: readonly(hasError),\n /** 错误信息 */\n errorMessage: readonly(errorMessage),\n /** DOM引用 */\n el: iconRef,\n })\n</script>\n","/* unplugin-vue-components disabled */<!--\n * @Author: ChenYu ycyplus@gmail.com\n * @Date: 2025-05-14\n * @Description: 支持多种图标使用方式,默认使用Iconify图标,统一错误处理\n * @Migration: naive-ui-components 组件库迁移版本\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\n-->\n<template>\n <div\n ref=\"iconRef\"\n class=\"c-icon\"\n :class=\"[\n `c-icon--${type}`,\n {\n 'c-icon--clickable': clickable,\n 'c-icon--loading': loading,\n 'c-icon--error': hasError,\n },\n ]\"\n :style=\"rootStyle\"\n :title=\"title || iconDisplayName\"\n :aria-label=\"ariaLabel || iconDisplayName\"\n :role=\"clickable ? 'button' : 'img'\"\n :tabindex=\"clickable ? 0 : -1\"\n @click=\"handleClick\"\n @keydown=\"handleKeydown\"\n >\n <!-- 方式1:Iconify图标(默认方式) -->\n <Icon\n v-if=\"\n (type === 'iconify' || !type) && !hasError && typeof name === 'string'\n \"\n :icon=\"name\"\n :width=\"size\"\n :height=\"size\"\n :color=\"color\"\n :style=\"iconStyle\"\n @error=\"() => handleError('iconify', 'Iconify图标加载失败')\"\n />\n\n <!-- 方式2:UnoCSS图标 -->\n <div\n v-else-if=\"type === 'unocss' && !hasError && typeof name === 'string'\"\n :class=\"[name, iconClasses]\"\n :style=\"iconStyle\"\n @error=\"() => handleError('unocss', 'UnoCSS图标渲染失败')\"\n />\n\n <!-- 方式3:组件挂载方式 -->\n <component\n v-else-if=\"type === 'component' && resolvedComponent && !hasError\"\n :is=\"resolvedComponent\"\n :style=\"iconStyle\"\n v-bind=\"componentProps\"\n @error=\"() => handleError('component', '组件图标渲染失败')\"\n />\n\n <!-- 方式4:SVG路径方式 -->\n <svg\n v-else-if=\"type === 'svg' && svgPath && !hasError\"\n :width=\"size\"\n :height=\"size\"\n :viewBox=\"viewBox\"\n :style=\"iconStyle\"\n :fill=\"color\"\n @error=\"() => handleError('svg', 'SVG图标渲染失败')\"\n >\n <path\n :d=\"svgPath\"\n :fill=\"color\"\n />\n </svg>\n\n <!-- 方式5:图片方式 - 修复异步加载 -->\n <img\n v-else-if=\"type === 'image' && imageSrc && !hasError && !imageLoading\"\n :src=\"imageSrc\"\n :alt=\"alt || iconDisplayName\"\n :width=\"size\"\n :height=\"size\"\n style=\"display: inline-block; vertical-align: middle\"\n @error=\"() => handleError('image', '图片图标加载失败')\"\n @load=\"handleImageLoad\"\n />\n\n <!-- 图片加载状态 -->\n <div\n v-if=\"(loading || imageLoading) && !hasError\"\n class=\"c-icon__loading\"\n :style=\"iconStyle\"\n >\n <div class=\"c-icon__spinner\" />\n </div>\n\n <!-- 统一错误状态显示 -->\n <Icon\n v-else-if=\"hasError && fallbackIcon\"\n :icon=\"fallbackIcon\"\n :width=\"size\"\n :height=\"size\"\n :color=\"color\"\n :style=\"iconStyle\"\n />\n <div\n v-else-if=\"hasError\"\n class=\"c-icon__error\"\n :style=\"iconStyle\"\n :title=\"`图标解析失败: ${iconDisplayName} (${errorMessage})`\"\n >\n ⚠️\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import { Icon } from '@iconify/vue'\n import { useImage } from '../../hooks/useImage'\n import { computed, nextTick, onMounted, readonly, ref, watch } from 'vue'\n\n export interface IconProps {\n /** 图标名称/路径/组件实例 */\n name: string | any\n /** 图标类型 */\n type?: 'iconify' | 'unocss' | 'component' | 'svg' | 'image'\n /** 图标颜色 */\n color?: string\n /** 图标大小(px) */\n size?: number | string\n /** SVG路径数据(仅type=svg时使用) */\n svgPath?: string\n /** SVG viewBox(仅type=svg时使用) */\n viewBox?: string\n /** 图片alt属性(仅type=image时使用) */\n alt?: string\n /** 是否可点击 */\n clickable?: boolean\n /** 加载状态 */\n loading?: boolean\n /** 错误时的回退图标 */\n fallbackIcon?: string\n /** 工具提示 */\n title?: string\n /** 无障碍标签 */\n ariaLabel?: string\n /** 自定义样式类 */\n customClass?: string\n /** 旋转角度 */\n rotate?: number\n /** 是否翻转 */\n flip?: 'horizontal' | 'vertical' | 'both'\n /** 传递给组件的额外属性(仅type=component时使用) */\n componentProps?: Record<string, any>\n }\n\n const props = withDefaults(defineProps<IconProps>(), {\n name: undefined,\n type: 'iconify',\n color: 'currentColor',\n size: 18,\n svgPath: '',\n viewBox: '0 0 24 24',\n alt: '',\n clickable: false,\n loading: false,\n fallbackIcon: '',\n title: '',\n ariaLabel: '',\n customClass: '',\n rotate: 0,\n flip: undefined,\n componentProps: () => ({}),\n })\n\n const emit = defineEmits<{\n click: [event: MouseEvent]\n error: [type: string, error?: any]\n load: []\n }>()\n\n const iconRef = ref<HTMLElement>()\n const hasError = ref(false)\n const errorMessage = ref('')\n const imageSrc = ref<string>('') // 存储异步加载的图片URL\n const imageLoading = ref(false) // 图片加载状态\n\n // 计算根元素样式\n const rootStyle = computed(() => ({\n fontSize: typeof props.size === 'number' ? `${props.size}px` : props.size,\n color: props.color,\n cursor: props.clickable ? 'pointer' : 'default',\n }))\n\n // 计算图标样式\n const iconStyle = computed(() => {\n const style: Record<string, any> = {\n display: 'inline-flex',\n justifyContent: 'center',\n alignItems: 'center',\n width: typeof props.size === 'number' ? `${props.size}px` : props.size,\n height: typeof props.size === 'number' ? `${props.size}px` : props.size,\n }\n\n // 旋转\n if (props.rotate) {\n style.transform = `rotate(${props.rotate}deg)`\n }\n\n // 翻转\n if (props.flip) {\n const scaleX =\n props.flip === 'horizontal' || props.flip === 'both' ? -1 : 1\n const scaleY = props.flip === 'vertical' || props.flip === 'both' ? -1 : 1\n style.transform = `${\n style.transform || ''\n } scaleX(${scaleX}) scaleY(${scaleY})`.trim()\n }\n\n return style\n })\n\n // 获取图标名称用于显示\n const iconDisplayName = computed(() => {\n if (typeof props.name === 'string') {\n return props.name\n }\n if (props.name && props.name.__name) {\n return props.name.__name\n }\n if (props.name && props.name.name) {\n return props.name.name\n }\n return 'Component Icon'\n })\n\n // 图标类名\n const iconClasses = computed(() => [\n props.customClass,\n {\n 'c-icon__rotatable': props.rotate !== 0,\n 'c-icon__flippable': !!props.flip,\n },\n ])\n\n // 解析组件名称(纯计算属性,无副作用)\n const resolvedComponent = computed(() => {\n if (props.type !== 'component' || !props.name) return null\n return props.name\n })\n\n // 统一错误处理函数\n const handleError = (type: string, message: string, originalError?: any) => {\n console.warn(`[C_Icon] ${message}:`, iconDisplayName.value, originalError)\n errorMessage.value = message\n imageLoading.value = false // 错误时停止加载状态\n emit('error', type, originalError)\n\n // 如果有回退图标,尝试切换为 fallback Iconify 图标\n if (props.fallbackIcon && !hasError.value) {\n hasError.value = false\n // 将 name 重写为 fallbackIcon 并重置状态\n // 因为 props 不可变,通过模板中的 fallback 分支渲染\n return\n }\n\n hasError.value = true\n }\n\n // 处理点击事件\n const handleClick = (event: MouseEvent) => {\n if (!props.clickable || props.loading) return\n emit('click', event)\n }\n\n // 处理键盘事件\n const handleKeydown = (event: KeyboardEvent) => {\n if (!props.clickable || props.loading) return\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n emit('click', event as any)\n }\n }\n\n // 处理图片加载成功\n const handleImageLoad = () => {\n imageLoading.value = false\n emit('load')\n }\n\n // 异步加载图片 - 修复关键函数\n const loadImageSrc = async () => {\n if (props.type !== 'image' || typeof props.name !== 'string') {\n imageSrc.value = ''\n return\n }\n\n // 如果是完整URL,直接设置\n if (\n props.name.startsWith('http://') ||\n props.name.startsWith('https://') ||\n props.name.startsWith('//') ||\n props.name.startsWith('/')\n ) {\n imageSrc.value = props.name\n return\n }\n\n // 其他情况都当作本地图片处理\n try {\n imageLoading.value = true\n const imageUrl = await useImage(props.name)\n if (imageUrl) {\n imageSrc.value = imageUrl\n } else {\n handleError('image', '图片路径解析失败')\n }\n } catch (error) {\n handleError('image', '图片加载失败', error)\n } finally {\n imageLoading.value = false\n }\n }\n\n // 验证规则映射\n const validationRules = {\n iconify: (): string | null => {\n if (!props.name.includes(':')) {\n console.warn(\n '[C_Icon] Iconify图标名称格式应为 \"prefix:name\",如 \"mdi:home\"'\n )\n }\n return null\n },\n unocss: (): string | null => {\n if (typeof props.name !== 'string' || !props.name.startsWith('i-')) {\n console.warn('[C_Icon] UnoCSS图标名称应以 \"i-\" 开头')\n }\n return null\n },\n component: (): string | null =>\n !resolvedComponent.value ? '无法解析组件' : null,\n svg: (): string | null => (!props.svgPath ? 'SVG路径不能为空' : null),\n image: (): string | null => {\n // 对于image类型,异步验证在loadImageSrc中处理\n return null\n },\n }\n\n // 验证配置\n const validateProps = () => {\n hasError.value = false\n errorMessage.value = ''\n\n // 基础验证\n if (!props.name) {\n return handleError('validation', '图标名称不能为空')\n }\n\n // 类型验证\n const validator = validationRules[props.type]\n if (!validator) {\n return handleError('type', '不支持的图标类型')\n }\n\n const errorMsg = validator()\n if (errorMsg) {\n handleError(props.type, errorMsg)\n }\n\n // 如果是图片类型,异步加载图片\n if (props.type === 'image') {\n loadImageSrc()\n }\n }\n\n // 监听关键属性变化\n watch(\n () => [props.name, props.type, props.svgPath],\n () => {\n nextTick(validateProps)\n },\n { immediate: true }\n )\n\n // 组件挂载后:仅对非 image 类型触发 load 事件(watch immediate 已完成验证)\n onMounted(() => {\n if (!hasError.value && props.type !== 'image') {\n emit('load')\n }\n })\n\n // 暴露方法给父组件\n defineExpose({\n /** 重新验证配置 */\n validate: validateProps,\n /** 是否有错误 */\n hasError: readonly(hasError),\n /** 错误信息 */\n errorMessage: readonly(errorMessage),\n /** DOM引用 */\n el: iconRef,\n })\n</script>\n","<!--\n * @Author: ChenYu ycyplus@gmail.com\n * @Date: 2025-05-14\n * @Description: 支持多种图标使用方式,默认使用Iconify图标,统一错误处理\n * @Migration: naive-ui-components 组件库迁移版本\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\n-->\n<template>\n <div\n ref=\"iconRef\"\n class=\"c-icon\"\n :class=\"[\n `c-icon--${type}`,\n {\n 'c-icon--clickable': clickable,\n 'c-icon--loading': loading,\n 'c-icon--error': hasError,\n },\n ]\"\n :style=\"rootStyle\"\n :title=\"title || iconDisplayName\"\n :aria-label=\"ariaLabel || iconDisplayName\"\n :role=\"clickable ? 'button' : 'img'\"\n :tabindex=\"clickable ? 0 : -1\"\n @click=\"handleClick\"\n @keydown=\"handleKeydown\"\n >\n <!-- 方式1:Iconify图标(默认方式) -->\n <Icon\n v-if=\"\n (type === 'iconify' || !type) && !hasError && typeof name === 'string'\n \"\n :icon=\"name\"\n :width=\"size\"\n :height=\"size\"\n :color=\"color\"\n :style=\"iconStyle\"\n @error=\"() => handleError('iconify', 'Iconify图标加载失败')\"\n />\n\n <!-- 方式2:UnoCSS图标 -->\n <div\n v-else-if=\"type === 'unocss' && !hasError && typeof name === 'string'\"\n :class=\"[name, iconClasses]\"\n :style=\"iconStyle\"\n @error=\"() => handleError('unocss', 'UnoCSS图标渲染失败')\"\n />\n\n <!-- 方式3:组件挂载方式 -->\n <component\n v-else-if=\"type === 'component' && resolvedComponent && !hasError\"\n :is=\"resolvedComponent\"\n :style=\"iconStyle\"\n v-bind=\"componentProps\"\n @error=\"() => handleError('component', '组件图标渲染失败')\"\n />\n\n <!-- 方式4:SVG路径方式 -->\n <svg\n v-else-if=\"type === 'svg' && svgPath && !hasError\"\n :width=\"size\"\n :height=\"size\"\n :viewBox=\"viewBox\"\n :style=\"iconStyle\"\n :fill=\"color\"\n @error=\"() => handleError('svg', 'SVG图标渲染失败')\"\n >\n <path\n :d=\"svgPath\"\n :fill=\"color\"\n />\n </svg>\n\n <!-- 方式5:图片方式 - 修复异步加载 -->\n <img\n v-else-if=\"type === 'image' && imageSrc && !hasError && !imageLoading\"\n :src=\"imageSrc\"\n :alt=\"alt || iconDisplayName\"\n :width=\"size\"\n :height=\"size\"\n style=\"display: inline-block; vertical-align: middle\"\n @error=\"() => handleError('image', '图片图标加载失败')\"\n @load=\"handleImageLoad\"\n />\n\n <!-- 图片加载状态 -->\n <div\n v-if=\"(loading || imageLoading) && !hasError\"\n class=\"c-icon__loading\"\n :style=\"iconStyle\"\n >\n <div class=\"c-icon__spinner\" />\n </div>\n\n <!-- 统一错误状态显示 -->\n <Icon\n v-else-if=\"hasError && fallbackIcon\"\n :icon=\"fallbackIcon\"\n :width=\"size\"\n :height=\"size\"\n :color=\"color\"\n :style=\"iconStyle\"\n />\n <div\n v-else-if=\"hasError\"\n class=\"c-icon__error\"\n :style=\"iconStyle\"\n :title=\"`图标解析失败: ${iconDisplayName} (${errorMessage})`\"\n >\n ⚠️\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import { Icon } from '@iconify/vue'\n import { useImage } from '../../hooks/useImage'\n import { computed, nextTick, onMounted, readonly, ref, watch } from 'vue'\n\n export interface IconProps {\n /** 图标名称/路径/组件实例 */\n name: string | any\n /** 图标类型 */\n type?: 'iconify' | 'unocss' | 'component' | 'svg' | 'image'\n /** 图标颜色 */\n color?: string\n /** 图标大小(px) */\n size?: number | string\n /** SVG路径数据(仅type=svg时使用) */\n svgPath?: string\n /** SVG viewBox(仅type=svg时使用) */\n viewBox?: string\n /** 图片alt属性(仅type=image时使用) */\n alt?: string\n /** 是否可点击 */\n clickable?: boolean\n /** 加载状态 */\n loading?: boolean\n /** 错误时的回退图标 */\n fallbackIcon?: string\n /** 工具提示 */\n title?: string\n /** 无障碍标签 */\n ariaLabel?: string\n /** 自定义样式类 */\n customClass?: string\n /** 旋转角度 */\n rotate?: number\n /** 是否翻转 */\n flip?: 'horizontal' | 'vertical' | 'both'\n /** 传递给组件的额外属性(仅type=component时使用) */\n componentProps?: Record<string, any>\n }\n\n const props = withDefaults(defineProps<IconProps>(), {\n name: undefined,\n type: 'iconify',\n color: 'currentColor',\n size: 18,\n svgPath: '',\n viewBox: '0 0 24 24',\n alt: '',\n clickable: false,\n loading: false,\n fallbackIcon: '',\n title: '',\n ariaLabel: '',\n customClass: '',\n rotate: 0,\n flip: undefined,\n componentProps: () => ({}),\n })\n\n const emit = defineEmits<{\n click: [event: MouseEvent]\n error: [type: string, error?: any]\n load: []\n }>()\n\n const iconRef = ref<HTMLElement>()\n const hasError = ref(false)\n const errorMessage = ref('')\n const imageSrc = ref<string>('') // 存储异步加载的图片URL\n const imageLoading = ref(false) // 图片加载状态\n\n // 计算根元素样式\n const rootStyle = computed(() => ({\n fontSize: typeof props.size === 'number' ? `${props.size}px` : props.size,\n color: props.color,\n cursor: props.clickable ? 'pointer' : 'default',\n }))\n\n // 计算图标样式\n const iconStyle = computed(() => {\n const style: Record<string, any> = {\n display: 'inline-flex',\n justifyContent: 'center',\n alignItems: 'center',\n width: typeof props.size === 'number' ? `${props.size}px` : props.size,\n height: typeof props.size === 'number' ? `${props.size}px` : props.size,\n }\n\n // 旋转\n if (props.rotate) {\n style.transform = `rotate(${props.rotate}deg)`\n }\n\n // 翻转\n if (props.flip) {\n const scaleX =\n props.flip === 'horizontal' || props.flip === 'both' ? -1 : 1\n const scaleY = props.flip === 'vertical' || props.flip === 'both' ? -1 : 1\n style.transform = `${\n style.transform || ''\n } scaleX(${scaleX}) scaleY(${scaleY})`.trim()\n }\n\n return style\n })\n\n // 获取图标名称用于显示\n const iconDisplayName = computed(() => {\n if (typeof props.name === 'string') {\n return props.name\n }\n if (props.name && props.name.__name) {\n return props.name.__name\n }\n if (props.name && props.name.name) {\n return props.name.name\n }\n return 'Component Icon'\n })\n\n // 图标类名\n const iconClasses = computed(() => [\n props.customClass,\n {\n 'c-icon__rotatable': props.rotate !== 0,\n 'c-icon__flippable': !!props.flip,\n },\n ])\n\n // 解析组件名称(纯计算属性,无副作用)\n const resolvedComponent = computed(() => {\n if (props.type !== 'component' || !props.name) return null\n return props.name\n })\n\n // 统一错误处理函数\n const handleError = (type: string, message: string, originalError?: any) => {\n console.warn(`[C_Icon] ${message}:`, iconDisplayName.value, originalError)\n errorMessage.value = message\n imageLoading.value = false // 错误时停止加载状态\n emit('error', type, originalError)\n\n // 如果有回退图标,尝试切换为 fallback Iconify 图标\n if (props.fallbackIcon && !hasError.value) {\n hasError.value = false\n // 将 name 重写为 fallbackIcon 并重置状态\n // 因为 props 不可变,通过模板中的 fallback 分支渲染\n return\n }\n\n hasError.value = true\n }\n\n // 处理点击事件\n const handleClick = (event: MouseEvent) => {\n if (!props.clickable || props.loading) return\n emit('click', event)\n }\n\n // 处理键盘事件\n const handleKeydown = (event: KeyboardEvent) => {\n if (!props.clickable || props.loading) return\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n emit('click', event as any)\n }\n }\n\n // 处理图片加载成功\n const handleImageLoad = () => {\n imageLoading.value = false\n emit('load')\n }\n\n // 异步加载图片 - 修复关键函数\n const loadImageSrc = async () => {\n if (props.type !== 'image' || typeof props.name !== 'string') {\n imageSrc.value = ''\n return\n }\n\n // 如果是完整URL,直接设置\n if (\n props.name.startsWith('http://') ||\n props.name.startsWith('https://') ||\n props.name.startsWith('//') ||\n props.name.startsWith('/')\n ) {\n imageSrc.value = props.name\n return\n }\n\n // 其他情况都当作本地图片处理\n try {\n imageLoading.value = true\n const imageUrl = await useImage(props.name)\n if (imageUrl) {\n imageSrc.value = imageUrl\n } else {\n handleError('image', '图片路径解析失败')\n }\n } catch (error) {\n handleError('image', '图片加载失败', error)\n } finally {\n imageLoading.value = false\n }\n }\n\n // 验证规则映射\n const validationRules = {\n iconify: (): string | null => {\n if (!props.name.includes(':')) {\n console.warn(\n '[C_Icon] Iconify图标名称格式应为 \"prefix:name\",如 \"mdi:home\"'\n )\n }\n return null\n },\n unocss: (): string | null => {\n if (typeof props.name !== 'string' || !props.name.startsWith('i-')) {\n console.warn('[C_Icon] UnoCSS图标名称应以 \"i-\" 开头')\n }\n return null\n },\n component: (): string | null =>\n !resolvedComponent.value ? '无法解析组件' : null,\n svg: (): string | null => (!props.svgPath ? 'SVG路径不能为空' : null),\n image: (): string | null => {\n // 对于image类型,异步验证在loadImageSrc中处理\n return null\n },\n }\n\n // 验证配置\n const validateProps = () => {\n hasError.value = false\n errorMessage.value = ''\n\n // 基础验证\n if (!props.name) {\n return handleError('validation', '图标名称不能为空')\n }\n\n // 类型验证\n const validator = validationRules[props.type]\n if (!validator) {\n return handleError('type', '不支持的图标类型')\n }\n\n const errorMsg = validator()\n if (errorMsg) {\n handleError(props.type, errorMsg)\n }\n\n // 如果是图片类型,异步加载图片\n if (props.type === 'image') {\n loadImageSrc()\n }\n }\n\n // 监听关键属性变化\n watch(\n () => [props.name, props.type, props.svgPath],\n () => {\n nextTick(validateProps)\n },\n { immediate: true }\n )\n\n // 组件挂载后:仅对非 image 类型触发 load 事件(watch immediate 已完成验证)\n onMounted(() => {\n if (!hasError.value && props.type !== 'image') {\n emit('load')\n }\n })\n\n // 暴露方法给父组件\n defineExpose({\n /** 重新验证配置 */\n validate: validateProps,\n /** 是否有错误 */\n hasError: readonly(hasError),\n /** 错误信息 */\n errorMessage: readonly(errorMess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EAAGE,EAAAA,QACH,KAAMF,EAAAA,iCAMEP,EAAAA,OAAI,SAAgB,EAAA,OAAQ,CAAK,EAAA,OAAQ,CAAK,EAAA,OAAA,GAAA,CAD3D,EASE,EAAA,CAAA,IAAA,EAAA,CAAA,CAVF,EAAA,sBAA0B,CAC1B,EASE,MAAA,CAPC,IAAK,EAAA,MACL,IAAKW,EAAAA,KAAO,EAAA,MACZ,MAAOL,EAAAA,KACP,OAAQA,EAAAA,KACT,MAAA,CAAA,QAAA,eAAA,iBAAA,SAAqD,CACpD,QAAK,AAAA,EAAA,SAAQ,EAAW,QAAA,WAAA,CACxB,OAAM,mCAGT,EAAA,WAAe,EAENJ,EAAAA,SAAW,EAAA,QAAY,CAAM,EAAA,OAAA,GAAA,CADtC,EAMM,MAAA,OAJJ,MAAM,kBACL,MAAK,EAAE,EAAA,MAAS,UAEjB,EAA+B,MAAA,CAA1B,MAAM,kBAAiB,CAAA,KAAA,GAAA,CAAA,CAAA,EAAA,EAKjB,EAAA,OAAYU,EAAAA,cAAAA,GAAAA,CADzB,EAOE,EAAA,CAAA,IAAA,EAAA,CAAA,CARF,EAAA,aAAiB,CACjB,EAOE,EAAA,EAAA,CAAA,CALC,KAAMA,EAAAA,aACN,MAAON,EAAAA,KACP,OAAQA,EAAAA,KACR,MAAOC,EAAAA,MACP,MAAK,EAAE,EAAA,MAAS,4DAGN,EAAA,OAAA,GAAA,CADb,EAOM,MAAA,OALJ,MAAM,gBACL,MAAK,EAAE,EAAA,MAAS,CAChB,MAAK,WAAa,EAAA,MAAe,IAAK,EAAA,MAAY,IACpD,OAED,GAAA,EAAA,EAAA,EAAA,OAAA,GAAA"}
|
|
1
|
+
{"version":3,"file":"C_Icon2.js","names":["type","clickable","loading","title","ariaLabel","name","size","color","componentProps","svgPath","viewBox","alt","fallbackIcon"],"sources":["../src/hooks/useImage/index.ts","../src/components/C_Icon/index.vue","../src/components/C_Icon/index.vue","../src/components/C_Icon/index.vue"],"sourcesContent":["/**\n * @description: 图片路径解析函数(组件库版本)\n * 在组件库中,图片路径由宿主应用管理。\n * 如果传入的是完整 URL(http/https/data:)则直接返回;\n * 否则可通过 imageResolver 配置自定义解析逻辑。\n * @param {string} imagePath 图片路径或完整 URL\n * @param {Function} resolver 可选的自定义解析器\n * @return {Promise<string>} 处理后图片路径\n */\nexport const useImage = async (\n imagePath: string,\n resolver?: (path: string) => string | Promise<string>,\n): Promise<string> => {\n if (!imagePath) return \"\";\n\n // 完整 URL 直接返回\n if (\n imagePath.startsWith(\"http://\") ||\n imagePath.startsWith(\"https://\") ||\n imagePath.startsWith(\"data:\") ||\n imagePath.startsWith(\"blob:\") ||\n imagePath.startsWith(\"/\")\n ) {\n return imagePath;\n }\n\n // 如果提供了自定义解析器,使用自定义解析器\n if (resolver) {\n try {\n return await resolver(imagePath);\n } catch (e) {\n console.error(`[useImage] 自定义解析器处理失败: ${imagePath}`, e);\n return \"\";\n }\n }\n\n // 默认:直接返回路径(宿主应用应保证路径可访问)\n return imagePath;\n};\n\n/**\n * @description: 同步版本的图片路径处理函数\n * @param {string} imagePath 图片路径或完整 URL\n * @return {string} 图片URL\n */\nexport const useImageSync = (imagePath: string): string => {\n if (!imagePath) return \"\";\n\n // 完整 URL 直接返回\n if (\n imagePath.startsWith(\"http://\") ||\n imagePath.startsWith(\"https://\") ||\n imagePath.startsWith(\"data:\") ||\n imagePath.startsWith(\"blob:\") ||\n imagePath.startsWith(\"/\")\n ) {\n return imagePath;\n }\n\n return imagePath;\n};\n","/* unplugin-vue-components disabled */<!--\n * @Author: ChenYu ycyplus@gmail.com\n * @Date: 2025-05-14\n * @Description: 支持多种图标使用方式,默认使用Iconify图标,统一错误处理\n * @Migration: naive-ui-components 组件库迁移版本\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\n-->\n<template>\n <div\n ref=\"iconRef\"\n class=\"c-icon\"\n :class=\"[\n `c-icon--${type}`,\n {\n 'c-icon--clickable': clickable,\n 'c-icon--loading': loading,\n 'c-icon--error': hasError,\n },\n ]\"\n :style=\"rootStyle\"\n :title=\"title || undefined\"\n :aria-label=\"ariaLabel || iconDisplayName\"\n :role=\"clickable ? 'button' : 'img'\"\n :tabindex=\"clickable ? 0 : -1\"\n @click=\"handleClick\"\n @keydown=\"handleKeydown\"\n >\n <!-- 方式1:Iconify图标(默认方式) -->\n <Icon\n v-if=\"\n (type === 'iconify' || !type) && !hasError && typeof name === 'string'\n \"\n :icon=\"name\"\n :width=\"size\"\n :height=\"size\"\n :color=\"color\"\n :style=\"iconStyle\"\n @error=\"() => handleError('iconify', 'Iconify图标加载失败')\"\n />\n\n <!-- 方式2:UnoCSS图标 -->\n <div\n v-else-if=\"type === 'unocss' && !hasError && typeof name === 'string'\"\n :class=\"[name, iconClasses]\"\n :style=\"iconStyle\"\n @error=\"() => handleError('unocss', 'UnoCSS图标渲染失败')\"\n />\n\n <!-- 方式3:组件挂载方式 -->\n <component\n v-else-if=\"type === 'component' && resolvedComponent && !hasError\"\n :is=\"resolvedComponent\"\n :style=\"iconStyle\"\n v-bind=\"componentProps\"\n @error=\"() => handleError('component', '组件图标渲染失败')\"\n />\n\n <!-- 方式4:SVG路径方式 -->\n <svg\n v-else-if=\"type === 'svg' && svgPath && !hasError\"\n :width=\"size\"\n :height=\"size\"\n :viewBox=\"viewBox\"\n :style=\"iconStyle\"\n :fill=\"color\"\n @error=\"() => handleError('svg', 'SVG图标渲染失败')\"\n >\n <path\n :d=\"svgPath\"\n :fill=\"color\"\n />\n </svg>\n\n <!-- 方式5:图片方式 - 修复异步加载 -->\n <img\n v-else-if=\"type === 'image' && imageSrc && !hasError && !imageLoading\"\n :src=\"imageSrc\"\n :alt=\"alt || iconDisplayName\"\n :width=\"size\"\n :height=\"size\"\n style=\"display: inline-block; vertical-align: middle\"\n @error=\"() => handleError('image', '图片图标加载失败')\"\n @load=\"handleImageLoad\"\n />\n\n <!-- 图片加载状态 -->\n <div\n v-if=\"(loading || imageLoading) && !hasError\"\n class=\"c-icon__loading\"\n :style=\"iconStyle\"\n >\n <div class=\"c-icon__spinner\" />\n </div>\n\n <!-- 统一错误状态显示 -->\n <Icon\n v-else-if=\"hasError && fallbackIcon\"\n :icon=\"fallbackIcon\"\n :width=\"size\"\n :height=\"size\"\n :color=\"color\"\n :style=\"iconStyle\"\n />\n <div\n v-else-if=\"hasError\"\n class=\"c-icon__error\"\n :style=\"iconStyle\"\n :title=\"`图标解析失败: ${iconDisplayName} (${errorMessage})`\"\n >\n ⚠️\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import { Icon } from '@iconify/vue'\n import { useImage } from '../../hooks/useImage'\n import { computed, nextTick, onMounted, readonly, ref, watch } from 'vue'\n\n export interface IconProps {\n /** 图标名称/路径/组件实例 */\n name: string | any\n /** 图标类型 */\n type?: 'iconify' | 'unocss' | 'component' | 'svg' | 'image'\n /** 图标颜色 */\n color?: string\n /** 图标大小(px) */\n size?: number | string\n /** SVG路径数据(仅type=svg时使用) */\n svgPath?: string\n /** SVG viewBox(仅type=svg时使用) */\n viewBox?: string\n /** 图片alt属性(仅type=image时使用) */\n alt?: string\n /** 是否可点击 */\n clickable?: boolean\n /** 加载状态 */\n loading?: boolean\n /** 错误时的回退图标 */\n fallbackIcon?: string\n /** 工具提示 */\n title?: string\n /** 无障碍标签 */\n ariaLabel?: string\n /** 自定义样式类 */\n customClass?: string\n /** 旋转角度 */\n rotate?: number\n /** 是否翻转 */\n flip?: 'horizontal' | 'vertical' | 'both'\n /** 传递给组件的额外属性(仅type=component时使用) */\n componentProps?: Record<string, any>\n }\n\n const props = withDefaults(defineProps<IconProps>(), {\n name: undefined,\n type: 'iconify',\n color: 'currentColor',\n size: 18,\n svgPath: '',\n viewBox: '0 0 24 24',\n alt: '',\n clickable: false,\n loading: false,\n fallbackIcon: '',\n title: '',\n ariaLabel: '',\n customClass: '',\n rotate: 0,\n flip: undefined,\n componentProps: () => ({}),\n })\n\n const emit = defineEmits<{\n click: [event: MouseEvent]\n error: [type: string, error?: any]\n load: []\n }>()\n\n const iconRef = ref<HTMLElement>()\n const hasError = ref(false)\n const errorMessage = ref('')\n const imageSrc = ref<string>('') // 存储异步加载的图片URL\n const imageLoading = ref(false) // 图片加载状态\n\n // 计算根元素样式\n const rootStyle = computed(() => ({\n fontSize: typeof props.size === 'number' ? `${props.size}px` : props.size,\n color: props.color,\n cursor: props.clickable ? 'pointer' : 'inherit',\n }))\n\n // 计算图标样式\n const iconStyle = computed(() => {\n const style: Record<string, any> = {\n display: 'inline-flex',\n justifyContent: 'center',\n alignItems: 'center',\n width: typeof props.size === 'number' ? `${props.size}px` : props.size,\n height: typeof props.size === 'number' ? `${props.size}px` : props.size,\n }\n\n // 旋转\n if (props.rotate) {\n style.transform = `rotate(${props.rotate}deg)`\n }\n\n // 翻转\n if (props.flip) {\n const scaleX =\n props.flip === 'horizontal' || props.flip === 'both' ? -1 : 1\n const scaleY = props.flip === 'vertical' || props.flip === 'both' ? -1 : 1\n style.transform = `${\n style.transform || ''\n } scaleX(${scaleX}) scaleY(${scaleY})`.trim()\n }\n\n return style\n })\n\n // 获取图标名称用于显示\n const iconDisplayName = computed(() => {\n if (typeof props.name === 'string') {\n return props.name\n }\n if (props.name && props.name.__name) {\n return props.name.__name\n }\n if (props.name && props.name.name) {\n return props.name.name\n }\n return 'Component Icon'\n })\n\n // 图标类名\n const iconClasses = computed(() => [\n props.customClass,\n {\n 'c-icon__rotatable': props.rotate !== 0,\n 'c-icon__flippable': !!props.flip,\n },\n ])\n\n // 解析组件名称(纯计算属性,无副作用)\n const resolvedComponent = computed(() => {\n if (props.type !== 'component' || !props.name) return null\n return props.name\n })\n\n // 统一错误处理函数\n const handleError = (type: string, message: string, originalError?: any) => {\n console.warn(`[C_Icon] ${message}:`, iconDisplayName.value, originalError)\n errorMessage.value = message\n imageLoading.value = false // 错误时停止加载状态\n emit('error', type, originalError)\n\n // 如果有回退图标,尝试切换为 fallback Iconify 图标\n if (props.fallbackIcon && !hasError.value) {\n hasError.value = false\n // 将 name 重写为 fallbackIcon 并重置状态\n // 因为 props 不可变,通过模板中的 fallback 分支渲染\n return\n }\n\n hasError.value = true\n }\n\n // 处理点击事件\n const handleClick = (event: MouseEvent) => {\n if (!props.clickable || props.loading) return\n emit('click', event)\n }\n\n // 处理键盘事件\n const handleKeydown = (event: KeyboardEvent) => {\n if (!props.clickable || props.loading) return\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n emit('click', event as any)\n }\n }\n\n // 处理图片加载成功\n const handleImageLoad = () => {\n imageLoading.value = false\n emit('load')\n }\n\n // 异步加载图片 - 修复关键函数\n const loadImageSrc = async () => {\n if (props.type !== 'image' || typeof props.name !== 'string') {\n imageSrc.value = ''\n return\n }\n\n // 如果是完整URL,直接设置\n if (\n props.name.startsWith('http://') ||\n props.name.startsWith('https://') ||\n props.name.startsWith('//') ||\n props.name.startsWith('/')\n ) {\n imageSrc.value = props.name\n return\n }\n\n // 其他情况都当作本地图片处理\n try {\n imageLoading.value = true\n const imageUrl = await useImage(props.name)\n if (imageUrl) {\n imageSrc.value = imageUrl\n } else {\n handleError('image', '图片路径解析失败')\n }\n } catch (error) {\n handleError('image', '图片加载失败', error)\n } finally {\n imageLoading.value = false\n }\n }\n\n // 验证规则映射\n const validationRules = {\n iconify: (): string | null => {\n if (!props.name.includes(':')) {\n console.warn(\n '[C_Icon] Iconify图标名称格式应为 \"prefix:name\",如 \"mdi:home\"'\n )\n }\n return null\n },\n unocss: (): string | null => {\n if (typeof props.name !== 'string' || !props.name.startsWith('i-')) {\n console.warn('[C_Icon] UnoCSS图标名称应以 \"i-\" 开头')\n }\n return null\n },\n component: (): string | null =>\n !resolvedComponent.value ? '无法解析组件' : null,\n svg: (): string | null => (!props.svgPath ? 'SVG路径不能为空' : null),\n image: (): string | null => {\n // 对于image类型,异步验证在loadImageSrc中处理\n return null\n },\n }\n\n // 验证配置\n const validateProps = () => {\n hasError.value = false\n errorMessage.value = ''\n\n // 基础验证\n if (!props.name) {\n return handleError('validation', '图标名称不能为空')\n }\n\n // 类型验证\n const validator = validationRules[props.type]\n if (!validator) {\n return handleError('type', '不支持的图标类型')\n }\n\n const errorMsg = validator()\n if (errorMsg) {\n handleError(props.type, errorMsg)\n }\n\n // 如果是图片类型,异步加载图片\n if (props.type === 'image') {\n loadImageSrc()\n }\n }\n\n // 监听关键属性变化\n watch(\n () => [props.name, props.type, props.svgPath],\n () => {\n nextTick(validateProps)\n },\n { immediate: true }\n )\n\n // 组件挂载后:仅对非 image 类型触发 load 事件(watch immediate 已完成验证)\n onMounted(() => {\n if (!hasError.value && props.type !== 'image') {\n emit('load')\n }\n })\n\n // 暴露方法给父组件\n defineExpose({\n /** 重新验证配置 */\n validate: validateProps,\n /** 是否有错误 */\n hasError: readonly(hasError),\n /** 错误信息 */\n errorMessage: readonly(errorMessage),\n /** DOM引用 */\n el: iconRef,\n })\n</script>\n","/* unplugin-vue-components disabled */<!--\n * @Author: ChenYu ycyplus@gmail.com\n * @Date: 2025-05-14\n * @Description: 支持多种图标使用方式,默认使用Iconify图标,统一错误处理\n * @Migration: naive-ui-components 组件库迁移版本\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\n-->\n<template>\n <div\n ref=\"iconRef\"\n class=\"c-icon\"\n :class=\"[\n `c-icon--${type}`,\n {\n 'c-icon--clickable': clickable,\n 'c-icon--loading': loading,\n 'c-icon--error': hasError,\n },\n ]\"\n :style=\"rootStyle\"\n :title=\"title || undefined\"\n :aria-label=\"ariaLabel || iconDisplayName\"\n :role=\"clickable ? 'button' : 'img'\"\n :tabindex=\"clickable ? 0 : -1\"\n @click=\"handleClick\"\n @keydown=\"handleKeydown\"\n >\n <!-- 方式1:Iconify图标(默认方式) -->\n <Icon\n v-if=\"\n (type === 'iconify' || !type) && !hasError && typeof name === 'string'\n \"\n :icon=\"name\"\n :width=\"size\"\n :height=\"size\"\n :color=\"color\"\n :style=\"iconStyle\"\n @error=\"() => handleError('iconify', 'Iconify图标加载失败')\"\n />\n\n <!-- 方式2:UnoCSS图标 -->\n <div\n v-else-if=\"type === 'unocss' && !hasError && typeof name === 'string'\"\n :class=\"[name, iconClasses]\"\n :style=\"iconStyle\"\n @error=\"() => handleError('unocss', 'UnoCSS图标渲染失败')\"\n />\n\n <!-- 方式3:组件挂载方式 -->\n <component\n v-else-if=\"type === 'component' && resolvedComponent && !hasError\"\n :is=\"resolvedComponent\"\n :style=\"iconStyle\"\n v-bind=\"componentProps\"\n @error=\"() => handleError('component', '组件图标渲染失败')\"\n />\n\n <!-- 方式4:SVG路径方式 -->\n <svg\n v-else-if=\"type === 'svg' && svgPath && !hasError\"\n :width=\"size\"\n :height=\"size\"\n :viewBox=\"viewBox\"\n :style=\"iconStyle\"\n :fill=\"color\"\n @error=\"() => handleError('svg', 'SVG图标渲染失败')\"\n >\n <path\n :d=\"svgPath\"\n :fill=\"color\"\n />\n </svg>\n\n <!-- 方式5:图片方式 - 修复异步加载 -->\n <img\n v-else-if=\"type === 'image' && imageSrc && !hasError && !imageLoading\"\n :src=\"imageSrc\"\n :alt=\"alt || iconDisplayName\"\n :width=\"size\"\n :height=\"size\"\n style=\"display: inline-block; vertical-align: middle\"\n @error=\"() => handleError('image', '图片图标加载失败')\"\n @load=\"handleImageLoad\"\n />\n\n <!-- 图片加载状态 -->\n <div\n v-if=\"(loading || imageLoading) && !hasError\"\n class=\"c-icon__loading\"\n :style=\"iconStyle\"\n >\n <div class=\"c-icon__spinner\" />\n </div>\n\n <!-- 统一错误状态显示 -->\n <Icon\n v-else-if=\"hasError && fallbackIcon\"\n :icon=\"fallbackIcon\"\n :width=\"size\"\n :height=\"size\"\n :color=\"color\"\n :style=\"iconStyle\"\n />\n <div\n v-else-if=\"hasError\"\n class=\"c-icon__error\"\n :style=\"iconStyle\"\n :title=\"`图标解析失败: ${iconDisplayName} (${errorMessage})`\"\n >\n ⚠️\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import { Icon } from '@iconify/vue'\n import { useImage } from '../../hooks/useImage'\n import { computed, nextTick, onMounted, readonly, ref, watch } from 'vue'\n\n export interface IconProps {\n /** 图标名称/路径/组件实例 */\n name: string | any\n /** 图标类型 */\n type?: 'iconify' | 'unocss' | 'component' | 'svg' | 'image'\n /** 图标颜色 */\n color?: string\n /** 图标大小(px) */\n size?: number | string\n /** SVG路径数据(仅type=svg时使用) */\n svgPath?: string\n /** SVG viewBox(仅type=svg时使用) */\n viewBox?: string\n /** 图片alt属性(仅type=image时使用) */\n alt?: string\n /** 是否可点击 */\n clickable?: boolean\n /** 加载状态 */\n loading?: boolean\n /** 错误时的回退图标 */\n fallbackIcon?: string\n /** 工具提示 */\n title?: string\n /** 无障碍标签 */\n ariaLabel?: string\n /** 自定义样式类 */\n customClass?: string\n /** 旋转角度 */\n rotate?: number\n /** 是否翻转 */\n flip?: 'horizontal' | 'vertical' | 'both'\n /** 传递给组件的额外属性(仅type=component时使用) */\n componentProps?: Record<string, any>\n }\n\n const props = withDefaults(defineProps<IconProps>(), {\n name: undefined,\n type: 'iconify',\n color: 'currentColor',\n size: 18,\n svgPath: '',\n viewBox: '0 0 24 24',\n alt: '',\n clickable: false,\n loading: false,\n fallbackIcon: '',\n title: '',\n ariaLabel: '',\n customClass: '',\n rotate: 0,\n flip: undefined,\n componentProps: () => ({}),\n })\n\n const emit = defineEmits<{\n click: [event: MouseEvent]\n error: [type: string, error?: any]\n load: []\n }>()\n\n const iconRef = ref<HTMLElement>()\n const hasError = ref(false)\n const errorMessage = ref('')\n const imageSrc = ref<string>('') // 存储异步加载的图片URL\n const imageLoading = ref(false) // 图片加载状态\n\n // 计算根元素样式\n const rootStyle = computed(() => ({\n fontSize: typeof props.size === 'number' ? `${props.size}px` : props.size,\n color: props.color,\n cursor: props.clickable ? 'pointer' : 'inherit',\n }))\n\n // 计算图标样式\n const iconStyle = computed(() => {\n const style: Record<string, any> = {\n display: 'inline-flex',\n justifyContent: 'center',\n alignItems: 'center',\n width: typeof props.size === 'number' ? `${props.size}px` : props.size,\n height: typeof props.size === 'number' ? `${props.size}px` : props.size,\n }\n\n // 旋转\n if (props.rotate) {\n style.transform = `rotate(${props.rotate}deg)`\n }\n\n // 翻转\n if (props.flip) {\n const scaleX =\n props.flip === 'horizontal' || props.flip === 'both' ? -1 : 1\n const scaleY = props.flip === 'vertical' || props.flip === 'both' ? -1 : 1\n style.transform = `${\n style.transform || ''\n } scaleX(${scaleX}) scaleY(${scaleY})`.trim()\n }\n\n return style\n })\n\n // 获取图标名称用于显示\n const iconDisplayName = computed(() => {\n if (typeof props.name === 'string') {\n return props.name\n }\n if (props.name && props.name.__name) {\n return props.name.__name\n }\n if (props.name && props.name.name) {\n return props.name.name\n }\n return 'Component Icon'\n })\n\n // 图标类名\n const iconClasses = computed(() => [\n props.customClass,\n {\n 'c-icon__rotatable': props.rotate !== 0,\n 'c-icon__flippable': !!props.flip,\n },\n ])\n\n // 解析组件名称(纯计算属性,无副作用)\n const resolvedComponent = computed(() => {\n if (props.type !== 'component' || !props.name) return null\n return props.name\n })\n\n // 统一错误处理函数\n const handleError = (type: string, message: string, originalError?: any) => {\n console.warn(`[C_Icon] ${message}:`, iconDisplayName.value, originalError)\n errorMessage.value = message\n imageLoading.value = false // 错误时停止加载状态\n emit('error', type, originalError)\n\n // 如果有回退图标,尝试切换为 fallback Iconify 图标\n if (props.fallbackIcon && !hasError.value) {\n hasError.value = false\n // 将 name 重写为 fallbackIcon 并重置状态\n // 因为 props 不可变,通过模板中的 fallback 分支渲染\n return\n }\n\n hasError.value = true\n }\n\n // 处理点击事件\n const handleClick = (event: MouseEvent) => {\n if (!props.clickable || props.loading) return\n emit('click', event)\n }\n\n // 处理键盘事件\n const handleKeydown = (event: KeyboardEvent) => {\n if (!props.clickable || props.loading) return\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n emit('click', event as any)\n }\n }\n\n // 处理图片加载成功\n const handleImageLoad = () => {\n imageLoading.value = false\n emit('load')\n }\n\n // 异步加载图片 - 修复关键函数\n const loadImageSrc = async () => {\n if (props.type !== 'image' || typeof props.name !== 'string') {\n imageSrc.value = ''\n return\n }\n\n // 如果是完整URL,直接设置\n if (\n props.name.startsWith('http://') ||\n props.name.startsWith('https://') ||\n props.name.startsWith('//') ||\n props.name.startsWith('/')\n ) {\n imageSrc.value = props.name\n return\n }\n\n // 其他情况都当作本地图片处理\n try {\n imageLoading.value = true\n const imageUrl = await useImage(props.name)\n if (imageUrl) {\n imageSrc.value = imageUrl\n } else {\n handleError('image', '图片路径解析失败')\n }\n } catch (error) {\n handleError('image', '图片加载失败', error)\n } finally {\n imageLoading.value = false\n }\n }\n\n // 验证规则映射\n const validationRules = {\n iconify: (): string | null => {\n if (!props.name.includes(':')) {\n console.warn(\n '[C_Icon] Iconify图标名称格式应为 \"prefix:name\",如 \"mdi:home\"'\n )\n }\n return null\n },\n unocss: (): string | null => {\n if (typeof props.name !== 'string' || !props.name.startsWith('i-')) {\n console.warn('[C_Icon] UnoCSS图标名称应以 \"i-\" 开头')\n }\n return null\n },\n component: (): string | null =>\n !resolvedComponent.value ? '无法解析组件' : null,\n svg: (): string | null => (!props.svgPath ? 'SVG路径不能为空' : null),\n image: (): string | null => {\n // 对于image类型,异步验证在loadImageSrc中处理\n return null\n },\n }\n\n // 验证配置\n const validateProps = () => {\n hasError.value = false\n errorMessage.value = ''\n\n // 基础验证\n if (!props.name) {\n return handleError('validation', '图标名称不能为空')\n }\n\n // 类型验证\n const validator = validationRules[props.type]\n if (!validator) {\n return handleError('type', '不支持的图标类型')\n }\n\n const errorMsg = validator()\n if (errorMsg) {\n handleError(props.type, errorMsg)\n }\n\n // 如果是图片类型,异步加载图片\n if (props.type === 'image') {\n loadImageSrc()\n }\n }\n\n // 监听关键属性变化\n watch(\n () => [props.name, props.type, props.svgPath],\n () => {\n nextTick(validateProps)\n },\n { immediate: true }\n )\n\n // 组件挂载后:仅对非 image 类型触发 load 事件(watch immediate 已完成验证)\n onMounted(() => {\n if (!hasError.value && props.type !== 'image') {\n emit('load')\n }\n })\n\n // 暴露方法给父组件\n defineExpose({\n /** 重新验证配置 */\n validate: validateProps,\n /** 是否有错误 */\n hasError: readonly(hasError),\n /** 错误信息 */\n errorMessage: readonly(errorMessage),\n /** DOM引用 */\n el: iconRef,\n })\n</script>\n","<!--\n * @Author: ChenYu ycyplus@gmail.com\n * @Date: 2025-05-14\n * @Description: 支持多种图标使用方式,默认使用Iconify图标,统一错误处理\n * @Migration: naive-ui-components 组件库迁移版本\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\n-->\n<template>\n <div\n ref=\"iconRef\"\n class=\"c-icon\"\n :class=\"[\n `c-icon--${type}`,\n {\n 'c-icon--clickable': clickable,\n 'c-icon--loading': loading,\n 'c-icon--error': hasError,\n },\n ]\"\n :style=\"rootStyle\"\n :title=\"title || undefined\"\n :aria-label=\"ariaLabel || iconDisplayName\"\n :role=\"clickable ? 'button' : 'img'\"\n :tabindex=\"clickable ? 0 : -1\"\n @click=\"handleClick\"\n @keydown=\"handleKeydown\"\n >\n <!-- 方式1:Iconify图标(默认方式) -->\n <Icon\n v-if=\"\n (type === 'iconify' || !type) && !hasError && typeof name === 'string'\n \"\n :icon=\"name\"\n :width=\"size\"\n :height=\"size\"\n :color=\"color\"\n :style=\"iconStyle\"\n @error=\"() => handleError('iconify', 'Iconify图标加载失败')\"\n />\n\n <!-- 方式2:UnoCSS图标 -->\n <div\n v-else-if=\"type === 'unocss' && !hasError && typeof name === 'string'\"\n :class=\"[name, iconClasses]\"\n :style=\"iconStyle\"\n @error=\"() => handleError('unocss', 'UnoCSS图标渲染失败')\"\n />\n\n <!-- 方式3:组件挂载方式 -->\n <component\n v-else-if=\"type === 'component' && resolvedComponent && !hasError\"\n :is=\"resolvedComponent\"\n :style=\"iconStyle\"\n v-bind=\"componentProps\"\n @error=\"() => handleError('component', '组件图标渲染失败')\"\n />\n\n <!-- 方式4:SVG路径方式 -->\n <svg\n v-else-if=\"type === 'svg' && svgPath && !hasError\"\n :width=\"size\"\n :height=\"size\"\n :viewBox=\"viewBox\"\n :style=\"iconStyle\"\n :fill=\"color\"\n @error=\"() => handleError('svg', 'SVG图标渲染失败')\"\n >\n <path\n :d=\"svgPath\"\n :fill=\"color\"\n />\n </svg>\n\n <!-- 方式5:图片方式 - 修复异步加载 -->\n <img\n v-else-if=\"type === 'image' && imageSrc && !hasError && !imageLoading\"\n :src=\"imageSrc\"\n :alt=\"alt || iconDisplayName\"\n :width=\"size\"\n :height=\"size\"\n style=\"display: inline-block; vertical-align: middle\"\n @error=\"() => handleError('image', '图片图标加载失败')\"\n @load=\"handleImageLoad\"\n />\n\n <!-- 图片加载状态 -->\n <div\n v-if=\"(loading || imageLoading) && !hasError\"\n class=\"c-icon__loading\"\n :style=\"iconStyle\"\n >\n <div class=\"c-icon__spinner\" />\n </div>\n\n <!-- 统一错误状态显示 -->\n <Icon\n v-else-if=\"hasError && fallbackIcon\"\n :icon=\"fallbackIcon\"\n :width=\"size\"\n :height=\"size\"\n :color=\"color\"\n :style=\"iconStyle\"\n />\n <div\n v-else-if=\"hasError\"\n class=\"c-icon__error\"\n :style=\"iconStyle\"\n :title=\"`图标解析失败: ${iconDisplayName} (${errorMessage})`\"\n >\n ⚠️\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import { Icon } from '@iconify/vue'\n import { useImage } from '../../hooks/useImage'\n import { computed, nextTick, onMounted, readonly, ref, watch } from 'vue'\n\n export interface IconProps {\n /** 图标名称/路径/组件实例 */\n name: string | any\n /** 图标类型 */\n type?: 'iconify' | 'unocss' | 'component' | 'svg' | 'image'\n /** 图标颜色 */\n color?: string\n /** 图标大小(px) */\n size?: number | string\n /** SVG路径数据(仅type=svg时使用) */\n svgPath?: string\n /** SVG viewBox(仅type=svg时使用) */\n viewBox?: string\n /** 图片alt属性(仅type=image时使用) */\n alt?: string\n /** 是否可点击 */\n clickable?: boolean\n /** 加载状态 */\n loading?: boolean\n /** 错误时的回退图标 */\n fallbackIcon?: string\n /** 工具提示 */\n title?: string\n /** 无障碍标签 */\n ariaLabel?: string\n /** 自定义样式类 */\n customClass?: string\n /** 旋转角度 */\n rotate?: number\n /** 是否翻转 */\n flip?: 'horizontal' | 'vertical' | 'both'\n /** 传递给组件的额外属性(仅type=component时使用) */\n componentProps?: Record<string, any>\n }\n\n const props = withDefaults(defineProps<IconProps>(), {\n name: undefined,\n type: 'iconify',\n color: 'currentColor',\n size: 18,\n svgPath: '',\n viewBox: '0 0 24 24',\n alt: '',\n clickable: false,\n loading: false,\n fallbackIcon: '',\n title: '',\n ariaLabel: '',\n customClass: '',\n rotate: 0,\n flip: undefined,\n componentProps: () => ({}),\n })\n\n const emit = defineEmits<{\n click: [event: MouseEvent]\n error: [type: string, error?: any]\n load: []\n }>()\n\n const iconRef = ref<HTMLElement>()\n const hasError = ref(false)\n const errorMessage = ref('')\n const imageSrc = ref<string>('') // 存储异步加载的图片URL\n const imageLoading = ref(false) // 图片加载状态\n\n // 计算根元素样式\n const rootStyle = computed(() => ({\n fontSize: typeof props.size === 'number' ? `${props.size}px` : props.size,\n color: props.color,\n cursor: props.clickable ? 'pointer' : 'inherit',\n }))\n\n // 计算图标样式\n const iconStyle = computed(() => {\n const style: Record<string, any> = {\n display: 'inline-flex',\n justifyContent: 'center',\n alignItems: 'center',\n width: typeof props.size === 'number' ? `${props.size}px` : props.size,\n height: typeof props.size === 'number' ? `${props.size}px` : props.size,\n }\n\n // 旋转\n if (props.rotate) {\n style.transform = `rotate(${props.rotate}deg)`\n }\n\n // 翻转\n if (props.flip) {\n const scaleX =\n props.flip === 'horizontal' || props.flip === 'both' ? -1 : 1\n const scaleY = props.flip === 'vertical' || props.flip === 'both' ? -1 : 1\n style.transform = `${\n style.transform || ''\n } scaleX(${scaleX}) scaleY(${scaleY})`.trim()\n }\n\n return style\n })\n\n // 获取图标名称用于显示\n const iconDisplayName = computed(() => {\n if (typeof props.name === 'string') {\n return props.name\n }\n if (props.name && props.name.__name) {\n return props.name.__name\n }\n if (props.name && props.name.name) {\n return props.name.name\n }\n return 'Component Icon'\n })\n\n // 图标类名\n const iconClasses = computed(() => [\n props.customClass,\n {\n 'c-icon__rotatable': props.rotate !== 0,\n 'c-icon__flippable': !!props.flip,\n },\n ])\n\n // 解析组件名称(纯计算属性,无副作用)\n const resolvedComponent = computed(() => {\n if (props.type !== 'component' || !props.name) return null\n return props.name\n })\n\n // 统一错误处理函数\n const handleError = (type: string, message: string, originalError?: any) => {\n console.warn(`[C_Icon] ${message}:`, iconDisplayName.value, originalError)\n errorMessage.value = message\n imageLoading.value = false // 错误时停止加载状态\n emit('error', type, originalError)\n\n // 如果有回退图标,尝试切换为 fallback Iconify 图标\n if (props.fallbackIcon && !hasError.value) {\n hasError.value = false\n // 将 name 重写为 fallbackIcon 并重置状态\n // 因为 props 不可变,通过模板中的 fallback 分支渲染\n return\n }\n\n hasError.value = true\n }\n\n // 处理点击事件\n const handleClick = (event: MouseEvent) => {\n if (!props.clickable || props.loading) return\n emit('click', event)\n }\n\n // 处理键盘事件\n const handleKeydown = (event: KeyboardEvent) => {\n if (!props.clickable || props.loading) return\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n emit('click', event as any)\n }\n }\n\n // 处理图片加载成功\n const handleImageLoad = () => {\n imageLoading.value = false\n emit('load')\n }\n\n // 异步加载图片 - 修复关键函数\n const loadImageSrc = async () => {\n if (props.type !== 'image' || typeof props.name !== 'string') {\n imageSrc.value = ''\n return\n }\n\n // 如果是完整URL,直接设置\n if (\n props.name.startsWith('http://') ||\n props.name.startsWith('https://') ||\n props.name.startsWith('//') ||\n props.name.startsWith('/')\n ) {\n imageSrc.value = props.name\n return\n }\n\n // 其他情况都当作本地图片处理\n try {\n imageLoading.value = true\n const imageUrl = await useImage(props.name)\n if (imageUrl) {\n imageSrc.value = imageUrl\n } else {\n handleError('image', '图片路径解析失败')\n }\n } catch (error) {\n handleError('image', '图片加载失败', error)\n } finally {\n imageLoading.value = false\n }\n }\n\n // 验证规则映射\n const validationRules = {\n iconify: (): string | null => {\n if (!props.name.includes(':')) {\n console.warn(\n '[C_Icon] Iconify图标名称格式应为 \"prefix:name\",如 \"mdi:home\"'\n )\n }\n return null\n },\n unocss: (): string | null => {\n if (typeof props.name !== 'string' || !props.name.startsWith('i-')) {\n console.warn('[C_Icon] UnoCSS图标名称应以 \"i-\" 开头')\n }\n return null\n },\n component: (): string | null =>\n !resolvedComponent.value ? '无法解析组件' : null,\n svg: (): string | null => (!props.svgPath ? 'SVG路径不能为空' : null),\n image: (): string | null => {\n // 对于image类型,异步验证在loadImageSrc中处理\n return null\n },\n }\n\n // 验证配置\n const validateProps = () => {\n hasError.value = false\n errorMessage.value = ''\n\n // 基础验证\n if (!props.name) {\n return handleError('validation', '图标名称不能为空')\n }\n\n // 类型验证\n const validator = validationRules[props.type]\n if (!validator) {\n return handleError('type', '不支持的图标类型')\n }\n\n const errorMsg = validator()\n if (errorMsg) {\n handleError(props.type, errorMsg)\n }\n\n // 如果是图片类型,异步加载图片\n if (props.type === 'image') {\n loadImageSrc()\n }\n }\n\n // 监听关键属性变化\n watch(\n () => [props.name, props.type, props.svgPath],\n () => {\n nextTick(validateProps)\n },\n { immediate: true }\n )\n\n // 组件挂载后:仅对非 image 类型触发 load 事件(watch immediate 已完成验证)\n onMounted(() => {\n if (!hasError.value && props.type !== 'image') {\n emit('load')\n }\n })\n\n // 暴露方法给父组件\n defineExpose({\n /** 重新验证配置 */\n validate: validateProps,\n /** 是否有错误 */\n hasError: readonly(hasError),\n /** 错误信息 */\n errorMessage: readonly(errorMessage),\n /** DOM引用 */\n el: iconRef,\n })\n</script>\n"],"mappings":"8XASA,MAAa,EAAW,MACtB,EACA,IACoB,CACpB,GAAI,CAAC,EAAW,MAAO,GAGvB,GACE,EAAU,WAAW,UAAU,EAC/B,EAAU,WAAW,WAAW,EAChC,EAAU,WAAW,QAAQ,EAC7B,EAAU,WAAW,QAAQ,EAC7B,EAAU,WAAW,IAAI,CAEzB,OAAO,EAIT,GAAI,EACF,GAAI,CACF,OAAO,MAAM,EAAS,EAAU,OACzB,EAAG,CAEV,OADA,QAAQ,MAAM,0B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,EAAA,SAAQ,EAAW,QAAA,WAAA,CACxB,OAAM,mCAGT,EAAA,WAAe,EAENJ,EAAAA,SAAW,EAAA,QAAY,CAAM,EAAA,OAAA,GAAA,CADtC,EAMM,MAAA,OAJJ,MAAM,kBACL,MAAK,EAAE,EAAA,MAAS,UAEjB,EAA+B,MAAA,CAA1B,MAAM,kBAAiB,CAAA,KAAA,GAAA,CAAA,CAAA,EAAA,EAKjB,EAAA,OAAYU,EAAAA,cAAAA,GAAAA,CADzB,EAOE,EAAA,CAAA,IAAA,EAAA,CAAA,CARF,EAAA,aAAiB,CACjB,EAOE,EAAA,EAAA,CAAA,CALC,KAAMA,EAAAA,aACN,MAAON,EAAAA,KACP,OAAQA,EAAAA,KACR,MAAOC,EAAAA,MACP,MAAK,EAAE,EAAA,MAAS,4DAGN,EAAA,OAAA,GAAA,CADb,EAOM,MAAA,OALJ,MAAM,gBACL,MAAK,EAAE,EAAA,MAAS,CAChB,MAAK,WAAa,EAAA,MAAe,IAAK,EAAA,MAAY,IACpD,OAED,GAAA,EAAA,EAAA,EAAA,OAAA,GAAA"}
|
package/dist/C_Language.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"C_Language.js","names":["modelValue"],"sources":["../src/components/C_Language/index.vue","../src/components/C_Language/index.vue","../src/components/C_Language/index.vue"],"sourcesContent":["/* unplugin-vue-components disabled */<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-11-19\r\n * @Description: 语言切换组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <
|
|
1
|
+
{"version":3,"file":"C_Language.js","names":["modelValue"],"sources":["../src/components/C_Language/index.vue","../src/components/C_Language/index.vue","../src/components/C_Language/index.vue"],"sourcesContent":["/* unplugin-vue-components disabled */<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-11-19\r\n * @Description: 语言切换组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <NDropdown\r\n size=\"small\"\r\n trigger=\"hover\"\r\n :options=\"finalOptions\"\r\n :value=\"modelValue\"\r\n @select=\"handleLanguageChange\"\r\n >\r\n <NButton text>\r\n <div class=\"flex items-center\">\r\n <C_Icon\r\n name=\"mdi:language\"\r\n :size=\"18\"\r\n :title=\"tooltipText\"\r\n />\r\n </div>\r\n </NButton>\r\n </NDropdown>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\n import { computed, h } from 'vue'\r\n import { NDropdown, NButton } from 'naive-ui'\r\n import C_Icon from '../C_Icon/index.vue'\r\n\r\n defineOptions({ name: 'C_Language' })\r\n\r\n export interface LanguageOption {\r\n key: string\r\n label: string\r\n iconClass?: string\r\n }\r\n\r\n const props = withDefaults(\r\n defineProps<{\r\n modelValue?: string\r\n options?: LanguageOption[]\r\n /** Tooltip 文案,默认 \"语言切换\" */\r\n tooltip?: string\r\n }>(),\r\n {\r\n modelValue: 'zh-cn',\r\n tooltip: '语言切换',\r\n options: () => [\r\n { key: 'zh-cn', label: '简体中文', iconClass: 'mdi:alpha-c' },\r\n { key: 'en', label: 'English', iconClass: 'mdi:alpha-u' },\r\n { key: 'ja', label: '日本語', iconClass: 'mdi:alpha-j' },\r\n { key: 'ko', label: '한국어', iconClass: 'mdi:alpha-k' },\r\n ],\r\n }\r\n )\r\n\r\n const emit = defineEmits<{\r\n 'update:modelValue': [key: string]\r\n change: [key: string]\r\n }>()\r\n\r\n /** 当前语言显示名 */\r\n const currentLabel = computed(() => {\r\n const opt = props.options.find(o => o.key === props.modelValue)\r\n return opt?.label ?? props.modelValue\r\n })\r\n\r\n const tooltipText = computed(() => `${props.tooltip} (${currentLabel.value})`)\r\n\r\n const finalOptions = computed(() =>\r\n props.options.map(opt => ({\r\n key: opt.key,\r\n label: opt.label,\r\n icon: opt.iconClass\r\n ? () => h(C_Icon, { name: opt.iconClass, size: 16 })\r\n : undefined,\r\n }))\r\n )\r\n\r\n const handleLanguageChange = (key: string) => {\r\n if (key === props.modelValue) return\r\n emit('update:modelValue', key)\r\n emit('change', key)\r\n }\r\n</script>\r\n","/* unplugin-vue-components disabled */<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-11-19\r\n * @Description: 语言切换组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <NDropdown\r\n size=\"small\"\r\n trigger=\"hover\"\r\n :options=\"finalOptions\"\r\n :value=\"modelValue\"\r\n @select=\"handleLanguageChange\"\r\n >\r\n <NButton text>\r\n <div class=\"flex items-center\">\r\n <C_Icon\r\n name=\"mdi:language\"\r\n :size=\"18\"\r\n :title=\"tooltipText\"\r\n />\r\n </div>\r\n </NButton>\r\n </NDropdown>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\n import { computed, h } from 'vue'\r\n import { NDropdown, NButton } from 'naive-ui'\r\n import C_Icon from '../C_Icon/index.vue'\r\n\r\n defineOptions({ name: 'C_Language' })\r\n\r\n export interface LanguageOption {\r\n key: string\r\n label: string\r\n iconClass?: string\r\n }\r\n\r\n const props = withDefaults(\r\n defineProps<{\r\n modelValue?: string\r\n options?: LanguageOption[]\r\n /** Tooltip 文案,默认 \"语言切换\" */\r\n tooltip?: string\r\n }>(),\r\n {\r\n modelValue: 'zh-cn',\r\n tooltip: '语言切换',\r\n options: () => [\r\n { key: 'zh-cn', label: '简体中文', iconClass: 'mdi:alpha-c' },\r\n { key: 'en', label: 'English', iconClass: 'mdi:alpha-u' },\r\n { key: 'ja', label: '日本語', iconClass: 'mdi:alpha-j' },\r\n { key: 'ko', label: '한국어', iconClass: 'mdi:alpha-k' },\r\n ],\r\n }\r\n )\r\n\r\n const emit = defineEmits<{\r\n 'update:modelValue': [key: string]\r\n change: [key: string]\r\n }>()\r\n\r\n /** 当前语言显示名 */\r\n const currentLabel = computed(() => {\r\n const opt = props.options.find(o => o.key === props.modelValue)\r\n return opt?.label ?? props.modelValue\r\n })\r\n\r\n const tooltipText = computed(() => `${props.tooltip} (${currentLabel.value})`)\r\n\r\n const finalOptions = computed(() =>\r\n props.options.map(opt => ({\r\n key: opt.key,\r\n label: opt.label,\r\n icon: opt.iconClass\r\n ? () => h(C_Icon, { name: opt.iconClass, size: 16 })\r\n : undefined,\r\n }))\r\n )\r\n\r\n const handleLanguageChange = (key: string) => {\r\n if (key === props.modelValue) return\r\n emit('update:modelValue', key)\r\n emit('change', key)\r\n }\r\n</script>\r\n","<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-11-19\r\n * @Description: 语言切换组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <NDropdown\r\n size=\"small\"\r\n trigger=\"hover\"\r\n :options=\"finalOptions\"\r\n :value=\"modelValue\"\r\n @select=\"handleLanguageChange\"\r\n >\r\n <NButton text>\r\n <div class=\"flex items-center\">\r\n <C_Icon\r\n name=\"mdi:language\"\r\n :size=\"18\"\r\n :title=\"tooltipText\"\r\n />\r\n </div>\r\n </NButton>\r\n </NDropdown>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\n import { computed, h } from 'vue'\r\n import { NDropdown, NButton } from 'naive-ui'\r\n import C_Icon from '../C_Icon/index.vue'\r\n\r\n defineOptions({ name: 'C_Language' })\r\n\r\n export interface LanguageOption {\r\n key: string\r\n label: string\r\n iconClass?: string\r\n }\r\n\r\n const props = withDefaults(\r\n defineProps<{\r\n modelValue?: string\r\n options?: LanguageOption[]\r\n /** Tooltip 文案,默认 \"语言切换\" */\r\n tooltip?: string\r\n }>(),\r\n {\r\n modelValue: 'zh-cn',\r\n tooltip: '语言切换',\r\n options: () => [\r\n { key: 'zh-cn', label: '简体中文', iconClass: 'mdi:alpha-c' },\r\n { key: 'en', label: 'English', iconClass: 'mdi:alpha-u' },\r\n { key: 'ja', label: '日本語', iconClass: 'mdi:alpha-j' },\r\n { key: 'ko', label: '한국어', iconClass: 'mdi:alpha-k' },\r\n ],\r\n }\r\n )\r\n\r\n const emit = defineEmits<{\r\n 'update:modelValue': [key: string]\r\n change: [key: string]\r\n }>()\r\n\r\n /** 当前语言显示名 */\r\n const currentLabel = computed(() => {\r\n const opt = props.options.find(o => o.key === props.modelValue)\r\n return opt?.label ?? props.modelValue\r\n })\r\n\r\n const tooltipText = computed(() => `${props.tooltip} (${currentLabel.value})`)\r\n\r\n const finalOptions = computed(() =>\r\n props.options.map(opt => ({\r\n key: opt.key,\r\n label: opt.label,\r\n icon: opt.iconClass\r\n ? () => h(C_Icon, { name: opt.iconClass, size: 16 })\r\n : undefined,\r\n }))\r\n )\r\n\r\n const handleLanguageChange = (key: string) => {\r\n if (key === props.modelValue) return\r\n emit('update:modelValue', key)\r\n emit('change', key)\r\n }\r\n</script>\r\n"],"mappings":"mhBEwCE,IAAM,EAAQ,EAmBR,EAAO,EAMP,GAAA,EAAA,EAAA,cACQ,EAAM,QAAQ,KAAK,GAAK,EAAE,MAAQ,EAAM,WAAW,EACnD,OAAS,EAAM,WAC3B,CAEI,GAAA,EAAA,EAAA,cAA6B,GAAG,EAAM,QAAQ,IAAI,EAAa,MAAM,GAAG,CAExE,GAAA,EAAA,EAAA,cACJ,EAAM,QAAQ,IAAI,IAAQ,CACxB,IAAK,EAAI,IACT,MAAO,EAAI,MACX,KAAM,EAAI,eAAA,EAAA,EAAA,GACE,EAAA,EAAQ,CAAE,KAAM,EAAI,UAAW,KAAM,GAAI,CAAC,CAClD,IAAA,GACL,EAAE,CACJ,CAEK,EAAwB,GAAgB,CACxC,IAAQ,EAAM,aAClB,EAAK,oBAAqB,EAAI,CAC9B,EAAK,SAAU,EAAI,iEA7DT,EAAA,UAAA,CAAA,CAfV,KAAK,QACL,QAAQ,QACP,QAAS,EAAA,MACT,MAAOA,EAAAA,WACP,SAAQ,8BAUC,EAAA,EAAA,EAAA,cAAA,EAAA,EAAA,OAAA,EAAA,QAAA,CAAA,CARD,KAAA,GAAI,CAAA,2BAOL,EAAA,EAAA,EAAA,oBAAA,MANN,EAMM,EAAA,EAAA,EAAA,aADF,EAAA,EAAA,CAHA,KAAK,eACJ,KAAM,GACN,MAAO,EAAA"}
|
package/dist/C_Language2.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./C_Icon2.js";import{NButton as t,NDropdown as n
|
|
1
|
+
import{t as e}from"./C_Icon2.js";import{NButton as t,NDropdown as n}from"naive-ui";import{computed as r,createBlock as i,createElementVNode as a,createVNode as o,defineComponent as s,h as c,openBlock as l,unref as u,withCtx as d}from"vue";const f={class:`flex items-center`};var p=s({name:`C_Language`,__name:`index`,props:{modelValue:{default:`zh-cn`},options:{default:()=>[{key:`zh-cn`,label:`简体中文`,iconClass:`mdi:alpha-c`},{key:`en`,label:`English`,iconClass:`mdi:alpha-u`},{key:`ja`,label:`日本語`,iconClass:`mdi:alpha-j`},{key:`ko`,label:`한국어`,iconClass:`mdi:alpha-k`}]},tooltip:{default:`语言切换`}},emits:[`update:modelValue`,`change`],setup(s,{emit:p}){let m=s,h=p,g=r(()=>m.options.find(e=>e.key===m.modelValue)?.label??m.modelValue),_=r(()=>`${m.tooltip} (${g.value})`),v=r(()=>m.options.map(t=>({key:t.key,label:t.label,icon:t.iconClass?()=>c(e,{name:t.iconClass,size:16}):void 0}))),y=e=>{e!==m.modelValue&&(h(`update:modelValue`,e),h(`change`,e))};return(r,s)=>(l(),i(u(n),{size:`small`,trigger:`hover`,options:v.value,value:r.modelValue,onSelect:y},{default:d(()=>[o(u(t),{text:``},{default:d(()=>[a(`div`,f,[o(e,{name:`mdi:language`,size:18,title:_.value},null,8,[`title`])])]),_:1})]),_:1},8,[`options`,`value`]))}});export{p as t};
|
|
2
2
|
//# sourceMappingURL=C_Language2.js.map
|
package/dist/C_Language2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"C_Language2.js","names":["modelValue"],"sources":["../src/components/C_Language/index.vue","../src/components/C_Language/index.vue","../src/components/C_Language/index.vue"],"sourcesContent":["/* unplugin-vue-components disabled */<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-11-19\r\n * @Description: 语言切换组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <
|
|
1
|
+
{"version":3,"file":"C_Language2.js","names":["modelValue"],"sources":["../src/components/C_Language/index.vue","../src/components/C_Language/index.vue","../src/components/C_Language/index.vue"],"sourcesContent":["/* unplugin-vue-components disabled */<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-11-19\r\n * @Description: 语言切换组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <NDropdown\r\n size=\"small\"\r\n trigger=\"hover\"\r\n :options=\"finalOptions\"\r\n :value=\"modelValue\"\r\n @select=\"handleLanguageChange\"\r\n >\r\n <NButton text>\r\n <div class=\"flex items-center\">\r\n <C_Icon\r\n name=\"mdi:language\"\r\n :size=\"18\"\r\n :title=\"tooltipText\"\r\n />\r\n </div>\r\n </NButton>\r\n </NDropdown>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\n import { computed, h } from 'vue'\r\n import { NDropdown, NButton } from 'naive-ui'\r\n import C_Icon from '../C_Icon/index.vue'\r\n\r\n defineOptions({ name: 'C_Language' })\r\n\r\n export interface LanguageOption {\r\n key: string\r\n label: string\r\n iconClass?: string\r\n }\r\n\r\n const props = withDefaults(\r\n defineProps<{\r\n modelValue?: string\r\n options?: LanguageOption[]\r\n /** Tooltip 文案,默认 \"语言切换\" */\r\n tooltip?: string\r\n }>(),\r\n {\r\n modelValue: 'zh-cn',\r\n tooltip: '语言切换',\r\n options: () => [\r\n { key: 'zh-cn', label: '简体中文', iconClass: 'mdi:alpha-c' },\r\n { key: 'en', label: 'English', iconClass: 'mdi:alpha-u' },\r\n { key: 'ja', label: '日本語', iconClass: 'mdi:alpha-j' },\r\n { key: 'ko', label: '한국어', iconClass: 'mdi:alpha-k' },\r\n ],\r\n }\r\n )\r\n\r\n const emit = defineEmits<{\r\n 'update:modelValue': [key: string]\r\n change: [key: string]\r\n }>()\r\n\r\n /** 当前语言显示名 */\r\n const currentLabel = computed(() => {\r\n const opt = props.options.find(o => o.key === props.modelValue)\r\n return opt?.label ?? props.modelValue\r\n })\r\n\r\n const tooltipText = computed(() => `${props.tooltip} (${currentLabel.value})`)\r\n\r\n const finalOptions = computed(() =>\r\n props.options.map(opt => ({\r\n key: opt.key,\r\n label: opt.label,\r\n icon: opt.iconClass\r\n ? () => h(C_Icon, { name: opt.iconClass, size: 16 })\r\n : undefined,\r\n }))\r\n )\r\n\r\n const handleLanguageChange = (key: string) => {\r\n if (key === props.modelValue) return\r\n emit('update:modelValue', key)\r\n emit('change', key)\r\n }\r\n</script>\r\n","/* unplugin-vue-components disabled */<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-11-19\r\n * @Description: 语言切换组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <NDropdown\r\n size=\"small\"\r\n trigger=\"hover\"\r\n :options=\"finalOptions\"\r\n :value=\"modelValue\"\r\n @select=\"handleLanguageChange\"\r\n >\r\n <NButton text>\r\n <div class=\"flex items-center\">\r\n <C_Icon\r\n name=\"mdi:language\"\r\n :size=\"18\"\r\n :title=\"tooltipText\"\r\n />\r\n </div>\r\n </NButton>\r\n </NDropdown>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\n import { computed, h } from 'vue'\r\n import { NDropdown, NButton } from 'naive-ui'\r\n import C_Icon from '../C_Icon/index.vue'\r\n\r\n defineOptions({ name: 'C_Language' })\r\n\r\n export interface LanguageOption {\r\n key: string\r\n label: string\r\n iconClass?: string\r\n }\r\n\r\n const props = withDefaults(\r\n defineProps<{\r\n modelValue?: string\r\n options?: LanguageOption[]\r\n /** Tooltip 文案,默认 \"语言切换\" */\r\n tooltip?: string\r\n }>(),\r\n {\r\n modelValue: 'zh-cn',\r\n tooltip: '语言切换',\r\n options: () => [\r\n { key: 'zh-cn', label: '简体中文', iconClass: 'mdi:alpha-c' },\r\n { key: 'en', label: 'English', iconClass: 'mdi:alpha-u' },\r\n { key: 'ja', label: '日本語', iconClass: 'mdi:alpha-j' },\r\n { key: 'ko', label: '한국어', iconClass: 'mdi:alpha-k' },\r\n ],\r\n }\r\n )\r\n\r\n const emit = defineEmits<{\r\n 'update:modelValue': [key: string]\r\n change: [key: string]\r\n }>()\r\n\r\n /** 当前语言显示名 */\r\n const currentLabel = computed(() => {\r\n const opt = props.options.find(o => o.key === props.modelValue)\r\n return opt?.label ?? props.modelValue\r\n })\r\n\r\n const tooltipText = computed(() => `${props.tooltip} (${currentLabel.value})`)\r\n\r\n const finalOptions = computed(() =>\r\n props.options.map(opt => ({\r\n key: opt.key,\r\n label: opt.label,\r\n icon: opt.iconClass\r\n ? () => h(C_Icon, { name: opt.iconClass, size: 16 })\r\n : undefined,\r\n }))\r\n )\r\n\r\n const handleLanguageChange = (key: string) => {\r\n if (key === props.modelValue) return\r\n emit('update:modelValue', key)\r\n emit('change', key)\r\n }\r\n</script>\r\n","<!--\r\n * @Author: ChenYu ycyplus@gmail.com\r\n * @Date: 2025-11-19\r\n * @Description: 语言切换组件\r\n * @Migration: naive-ui-components 组件库迁移版本\r\n * Copyright (c) 2025 by CHENY, All Rights Reserved.\r\n-->\r\n<template>\r\n <NDropdown\r\n size=\"small\"\r\n trigger=\"hover\"\r\n :options=\"finalOptions\"\r\n :value=\"modelValue\"\r\n @select=\"handleLanguageChange\"\r\n >\r\n <NButton text>\r\n <div class=\"flex items-center\">\r\n <C_Icon\r\n name=\"mdi:language\"\r\n :size=\"18\"\r\n :title=\"tooltipText\"\r\n />\r\n </div>\r\n </NButton>\r\n </NDropdown>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\n import { computed, h } from 'vue'\r\n import { NDropdown, NButton } from 'naive-ui'\r\n import C_Icon from '../C_Icon/index.vue'\r\n\r\n defineOptions({ name: 'C_Language' })\r\n\r\n export interface LanguageOption {\r\n key: string\r\n label: string\r\n iconClass?: string\r\n }\r\n\r\n const props = withDefaults(\r\n defineProps<{\r\n modelValue?: string\r\n options?: LanguageOption[]\r\n /** Tooltip 文案,默认 \"语言切换\" */\r\n tooltip?: string\r\n }>(),\r\n {\r\n modelValue: 'zh-cn',\r\n tooltip: '语言切换',\r\n options: () => [\r\n { key: 'zh-cn', label: '简体中文', iconClass: 'mdi:alpha-c' },\r\n { key: 'en', label: 'English', iconClass: 'mdi:alpha-u' },\r\n { key: 'ja', label: '日本語', iconClass: 'mdi:alpha-j' },\r\n { key: 'ko', label: '한국어', iconClass: 'mdi:alpha-k' },\r\n ],\r\n }\r\n )\r\n\r\n const emit = defineEmits<{\r\n 'update:modelValue': [key: string]\r\n change: [key: string]\r\n }>()\r\n\r\n /** 当前语言显示名 */\r\n const currentLabel = computed(() => {\r\n const opt = props.options.find(o => o.key === props.modelValue)\r\n return opt?.label ?? props.modelValue\r\n })\r\n\r\n const tooltipText = computed(() => `${props.tooltip} (${currentLabel.value})`)\r\n\r\n const finalOptions = computed(() =>\r\n props.options.map(opt => ({\r\n key: opt.key,\r\n label: opt.label,\r\n icon: opt.iconClass\r\n ? () => h(C_Icon, { name: opt.iconClass, size: 16 })\r\n : undefined,\r\n }))\r\n )\r\n\r\n const handleLanguageChange = (key: string) => {\r\n if (key === props.modelValue) return\r\n emit('update:modelValue', key)\r\n emit('change', key)\r\n }\r\n</script>\r\n"],"mappings":"8oBEwCE,IAAM,EAAQ,EAmBR,EAAO,EAMP,EAAe,MACP,EAAM,QAAQ,KAAK,GAAK,EAAE,MAAQ,EAAM,WAAW,EACnD,OAAS,EAAM,WAC3B,CAEI,EAAc,MAAe,GAAG,EAAM,QAAQ,IAAI,EAAa,MAAM,GAAG,CAExE,EAAe,MACnB,EAAM,QAAQ,IAAI,IAAQ,CACxB,IAAK,EAAI,IACT,MAAO,EAAI,MACX,KAAM,EAAI,cACA,EAAE,EAAQ,CAAE,KAAM,EAAI,UAAW,KAAM,GAAI,CAAC,CAClD,IAAA,GACL,EAAE,CACJ,CAEK,EAAwB,GAAgB,CACxC,IAAQ,EAAM,aAClB,EAAK,oBAAqB,EAAI,CAC9B,EAAK,SAAU,EAAI,qBA7ErB,EAgBY,EAAA,EAAA,CAAA,CAfV,KAAK,QACL,QAAQ,QACP,QAAS,EAAA,MACT,MAAOA,EAAAA,WACP,SAAQ,kBAUC,CARV,EAQU,EAAA,EAAA,CAAA,CARD,KAAA,GAAI,CAAA,eAOL,CANN,EAMM,MANN,EAMM,CALJ,EAIE,EAAA,CAHA,KAAK,eACJ,KAAM,GACN,MAAO,EAAA"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -119,8 +119,8 @@ declare const __VLS_export: vue.DefineComponent<CronProps, {
|
|
|
119
119
|
"onValidation-change"?: ((result: CronValidation) => any) | undefined;
|
|
120
120
|
}>, {
|
|
121
121
|
modelValue: string;
|
|
122
|
-
disabled: boolean;
|
|
123
122
|
height: string | number;
|
|
123
|
+
disabled: boolean;
|
|
124
124
|
showPreview: boolean;
|
|
125
125
|
previewCount: number;
|
|
126
126
|
showTemplates: boolean;
|
package/dist/constants2.d.ts
CHANGED
|
@@ -121,9 +121,9 @@ declare const __VLS_export: vue.DefineComponent<FormulaEditorProps, FormulaEdito
|
|
|
121
121
|
"onValidation-change"?: ((result: FormulaValidation) => any) | undefined;
|
|
122
122
|
}>, {
|
|
123
123
|
modelValue: string;
|
|
124
|
+
height: string | number;
|
|
124
125
|
placeholder: string;
|
|
125
126
|
disabled: boolean;
|
|
126
|
-
height: string | number;
|
|
127
127
|
showPreview: boolean;
|
|
128
128
|
variables: FormulaVariable[];
|
|
129
129
|
functions: FormulaFunction[];
|
package/dist/constants3.d.ts
CHANGED
|
@@ -168,11 +168,11 @@ declare const __VLS_export: vue.DefineComponent<NotificationCenterProps, Notific
|
|
|
168
168
|
onNewMessage?: ((message: NotificationMessage) => any) | undefined;
|
|
169
169
|
onNavigate?: ((url: string) => any) | undefined;
|
|
170
170
|
}>, {
|
|
171
|
-
pageSize: number;
|
|
172
|
-
storageKey: string;
|
|
173
171
|
desktopNotification: boolean;
|
|
174
172
|
maxBadgeCount: number;
|
|
175
173
|
pollingInterval: number;
|
|
174
|
+
pageSize: number;
|
|
175
|
+
storageKey: string;
|
|
176
176
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
177
177
|
declare const _default: typeof __VLS_export;
|
|
178
178
|
//#endregion
|
|
@@ -217,7 +217,7 @@ declare function useNotificationCore(props: NotificationCenterProps): {
|
|
|
217
217
|
actionText?: string | undefined;
|
|
218
218
|
extra?: Record<string, unknown> | undefined;
|
|
219
219
|
}[]>;
|
|
220
|
-
activeCategory: vue.Ref<"all" |
|
|
220
|
+
activeCategory: vue.Ref<NotificationCategory | "all", NotificationCategory | "all">;
|
|
221
221
|
loading: vue.Ref<boolean, boolean>;
|
|
222
222
|
total: vue.Ref<number, number>;
|
|
223
223
|
page: vue.Ref<number, number>;
|
package/dist/constants4.d.ts
CHANGED
|
@@ -197,30 +197,30 @@ type __VLS_Slots = {} & {
|
|
|
197
197
|
};
|
|
198
198
|
declare const __VLS_base: vue.DefineComponent<UploadProps, UploadExpose, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
|
|
199
199
|
change: (fileList: UploadFileItem[]) => any;
|
|
200
|
-
success: (file: UploadFileItem, response: any) => any;
|
|
201
200
|
error: (file: UploadFileItem, error: Error) => any;
|
|
201
|
+
success: (file: UploadFileItem, response: any) => any;
|
|
202
202
|
progress: (file: UploadFileItem, percent: number) => any;
|
|
203
203
|
remove: (file: UploadFileItem) => any;
|
|
204
204
|
finish: (fileList: UploadFileItem[]) => any;
|
|
205
205
|
exceed: (files: File[], fileList: UploadFileItem[]) => any;
|
|
206
206
|
}, string, vue.PublicProps, Readonly<UploadProps> & Readonly<{
|
|
207
207
|
onChange?: ((fileList: UploadFileItem[]) => any) | undefined;
|
|
208
|
-
onSuccess?: ((file: UploadFileItem, response: any) => any) | undefined;
|
|
209
208
|
onError?: ((file: UploadFileItem, error: Error) => any) | undefined;
|
|
209
|
+
onSuccess?: ((file: UploadFileItem, response: any) => any) | undefined;
|
|
210
210
|
onProgress?: ((file: UploadFileItem, percent: number) => any) | undefined;
|
|
211
211
|
onRemove?: ((file: UploadFileItem) => any) | undefined;
|
|
212
212
|
onFinish?: ((fileList: UploadFileItem[]) => any) | undefined;
|
|
213
213
|
onExceed?: ((files: File[], fileList: UploadFileItem[]) => any) | undefined;
|
|
214
214
|
}>, {
|
|
215
|
+
data: Record<string, any>;
|
|
215
216
|
disabled: boolean;
|
|
216
217
|
multiple: boolean;
|
|
217
218
|
draggable: boolean;
|
|
218
|
-
data: Record<string, any>;
|
|
219
|
-
maxSize: number;
|
|
220
219
|
action: string;
|
|
221
220
|
headers: Record<string, string>;
|
|
222
221
|
directory: boolean;
|
|
223
222
|
accept: string;
|
|
223
|
+
maxSize: number;
|
|
224
224
|
maxCount: number;
|
|
225
225
|
pasteable: boolean;
|
|
226
226
|
chunked: boolean;
|
package/dist/data.d.ts
CHANGED
|
@@ -24,10 +24,10 @@ declare const __VLS_export: vue.DefineComponent<__VLS_Props, {}, {}, {}, {}, vue
|
|
|
24
24
|
}>, {
|
|
25
25
|
height: string;
|
|
26
26
|
center: [number, number];
|
|
27
|
-
zoom: number;
|
|
28
27
|
markers: MapMarker$1[];
|
|
29
|
-
mapType: "osm" | "amap";
|
|
30
28
|
amapKey: string;
|
|
29
|
+
zoom: number;
|
|
30
|
+
mapType: "osm" | "amap";
|
|
31
31
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
32
32
|
declare const _default: typeof __VLS_export;
|
|
33
33
|
//#endregion
|
package/dist/index11.vue.d.ts
CHANGED
|
@@ -55,12 +55,12 @@ declare const __VLS_export: vue.DefineComponent<IconProps, {
|
|
|
55
55
|
color: string;
|
|
56
56
|
loading: boolean;
|
|
57
57
|
flip: "horizontal" | "vertical" | "both";
|
|
58
|
+
clickable: boolean;
|
|
58
59
|
title: string;
|
|
59
60
|
rotate: number;
|
|
60
61
|
svgPath: string;
|
|
61
62
|
viewBox: string;
|
|
62
63
|
alt: string;
|
|
63
|
-
clickable: boolean;
|
|
64
64
|
fallbackIcon: string;
|
|
65
65
|
ariaLabel: string;
|
|
66
66
|
customClass: string;
|
package/dist/index13.vue.d.ts
CHANGED
|
@@ -59,11 +59,9 @@ declare const __VLS_export: vue.DefineComponent<Props, {
|
|
|
59
59
|
"onMax-length-exceeded"?: ((currentLength: number, maxLength: number) => any) | undefined;
|
|
60
60
|
}>, {
|
|
61
61
|
modelValue: string;
|
|
62
|
+
height: string | number;
|
|
62
63
|
placeholder: string;
|
|
63
64
|
disabled: boolean;
|
|
64
|
-
height: string | number;
|
|
65
|
-
isDark: boolean;
|
|
66
|
-
autoSave: boolean;
|
|
67
65
|
mode: "edit" | "editable" | "preview";
|
|
68
66
|
tocNavPosition: "left" | "right";
|
|
69
67
|
defaultFullscreen: boolean;
|
|
@@ -73,7 +71,9 @@ declare const __VLS_export: vue.DefineComponent<Props, {
|
|
|
73
71
|
rightToolbar: string;
|
|
74
72
|
maxLength: number;
|
|
75
73
|
showWordCount: boolean;
|
|
74
|
+
autoSave: boolean;
|
|
76
75
|
autoSaveInterval: number;
|
|
76
|
+
isDark: boolean;
|
|
77
77
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
78
78
|
declare const _default: typeof __VLS_export;
|
|
79
79
|
//#endregion
|
package/dist/index15.vue.d.ts
CHANGED
|
@@ -35,8 +35,8 @@ type __VLS_Slots = {} & {
|
|
|
35
35
|
};
|
|
36
36
|
declare const __VLS_base: vue.DefineComponent<Props, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
37
37
|
status: "default" | "success" | "error" | "warning" | "info";
|
|
38
|
-
strokeWidth: number;
|
|
39
38
|
time: number;
|
|
39
|
+
strokeWidth: number;
|
|
40
40
|
percentage: number | number[];
|
|
41
41
|
isAnimation: boolean;
|
|
42
42
|
indicatorPlacement: "inside" | "outside";
|
package/dist/index16.vue.d.ts
CHANGED
|
@@ -23,9 +23,9 @@ declare const __VLS_export: vue.DefineComponent<__VLS_Props, {}, {}, {}, {}, vue
|
|
|
23
23
|
onChange?: ((args_0: number) => any) | undefined;
|
|
24
24
|
"onUpdate:current"?: ((args_0: number) => any) | undefined;
|
|
25
25
|
}>, {
|
|
26
|
+
current: number;
|
|
26
27
|
direction: "horizontal" | "vertical";
|
|
27
28
|
clickable: boolean;
|
|
28
|
-
current: number;
|
|
29
29
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
30
30
|
declare const _default: typeof __VLS_export;
|
|
31
31
|
//#endregion
|
package/dist/index17.vue.d.ts
CHANGED
|
@@ -76,10 +76,10 @@ declare const __VLS_export: vue.DefineComponent<__VLS_Props, {
|
|
|
76
76
|
onClose?: ((fallbackPath: string) => any) | undefined;
|
|
77
77
|
onCloseAll?: (() => any) | undefined;
|
|
78
78
|
}>, {
|
|
79
|
+
persistKey: string;
|
|
79
80
|
homePath: string;
|
|
80
81
|
homeTitle: string;
|
|
81
82
|
homeIcon: string;
|
|
82
|
-
persistKey: string;
|
|
83
83
|
contextMenuLabels: ContextMenuLabels;
|
|
84
84
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
85
85
|
declare const _default: typeof __VLS_export;
|
package/dist/index19.vue.d.ts
CHANGED
|
@@ -647,11 +647,11 @@ declare const __VLS_export: vue.DefineComponent<Props, {
|
|
|
647
647
|
onTaskClick?: ((task: GanttTask, event: Event) => any) | undefined;
|
|
648
648
|
onTaskChange?: ((task: GanttTask, changes: any) => any) | undefined;
|
|
649
649
|
}>, {
|
|
650
|
+
data: GanttTask[];
|
|
651
|
+
height: string | number;
|
|
650
652
|
theme: "light" | "dark";
|
|
651
653
|
options: GanttOptions;
|
|
652
|
-
height: string | number;
|
|
653
654
|
title: string;
|
|
654
|
-
data: GanttTask[];
|
|
655
655
|
showToolbar: boolean;
|
|
656
656
|
preset: GanttPreset;
|
|
657
657
|
showFullscreenButton: boolean;
|
package/dist/index2.vue.d.ts
CHANGED
|
@@ -20,16 +20,16 @@ declare const __VLS_export: vue.DefineComponent<Props, {}, {}, {}, {}, vue.Compo
|
|
|
20
20
|
}, string, vue.PublicProps, Readonly<Props> & Readonly<{
|
|
21
21
|
onError?: ((error: Error) => any) | undefined;
|
|
22
22
|
}>, {
|
|
23
|
-
|
|
23
|
+
format: "CODE128" | "CODE39" | "EAN13" | "EAN8" | "UPC" | "ITF14" | "MSI" | "pharmacode";
|
|
24
24
|
width: number;
|
|
25
25
|
height: number;
|
|
26
|
-
fontSize: number;
|
|
27
|
-
format: "CODE128" | "CODE39" | "EAN13" | "EAN8" | "UPC" | "ITF14" | "MSI" | "pharmacode";
|
|
28
26
|
showText: boolean;
|
|
27
|
+
fontSize: number;
|
|
29
28
|
textPosition: "bottom" | "top";
|
|
30
29
|
lineColor: string;
|
|
31
30
|
background: string;
|
|
32
31
|
showBorder: boolean;
|
|
32
|
+
label: string;
|
|
33
33
|
showLabel: boolean;
|
|
34
34
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
35
35
|
declare const _default: typeof __VLS_export;
|
package/dist/index7.vue.d.ts
CHANGED
|
@@ -34,11 +34,11 @@ declare const __VLS_export: vue.DefineComponent<Props, {
|
|
|
34
34
|
onFullscreen?: ((isFullscreen: boolean) => any) | undefined;
|
|
35
35
|
}>, {
|
|
36
36
|
trim: boolean;
|
|
37
|
-
wordWrap: boolean;
|
|
38
37
|
code: string;
|
|
39
38
|
language: string;
|
|
40
39
|
showHeader: boolean;
|
|
41
40
|
showLineNumbers: boolean;
|
|
41
|
+
wordWrap: boolean;
|
|
42
42
|
showFullscreen: boolean;
|
|
43
43
|
autoLoadLanguage: boolean;
|
|
44
44
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
package/dist/index9.vue.d.ts
CHANGED
|
@@ -29,10 +29,10 @@ declare const __VLS_export: vue.DefineComponent<Props, {
|
|
|
29
29
|
"onEditor-change"?: ((html: string) => any) | undefined;
|
|
30
30
|
}>, {
|
|
31
31
|
modelValue: string;
|
|
32
|
+
height: number;
|
|
32
33
|
placeholder: string;
|
|
33
34
|
disabled: boolean;
|
|
34
35
|
theme: "light" | "dark";
|
|
35
|
-
height: number;
|
|
36
36
|
readonly: boolean;
|
|
37
37
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
38
38
|
declare const _default: typeof __VLS_export;
|