cd-icon-picker 0.1.4 → 0.1.6

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/index.ts CHANGED
@@ -11,4 +11,4 @@ const install = (app: App) => {
11
11
 
12
12
  export { Icon, IconPicker, SvgIcon, install };
13
13
 
14
- export default { install };
14
+ export default IconPicker;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cd-icon-picker",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Vue 3 icon picker supporting TDesign & RemixIcon, with custom SVG via :diy-icon.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -15,7 +15,16 @@
15
15
  </template>
16
16
  </t-input>
17
17
 
18
- <t-dialog v-model:visible="visible" header="选择图标" width="940px" :close-on-esc-keydown="true" :close-on-overlay-click="true" @confirm="handleConfirm" @cancel="handleCancel">
18
+ <t-dialog v-model:visible="visible" width="940px" :close-on-esc-keydown="true" :close-on-overlay-click="true" @confirm="handleConfirm" @cancel="handleCancel">
19
+ <template #header>
20
+ <div class="cd-picker-header">
21
+ 当前图标
22
+ <span v-if="isSvgMode && currentSelect">
23
+ <SvgIcon :name="currentSelect" :prefix="svgPrefix" :size="20" />
24
+ </span>
25
+ <Icon :icon="currentSelect || defaultIcon" :size="20" v-else />
26
+ </div>
27
+ </template>
19
28
  <div class="cd-picker-body">
20
29
  <div class="cd-picker-sidebar">
21
30
  <div class="cd-picker-section">
@@ -94,7 +103,7 @@ const props = defineProps({
94
103
  type: { type: String as PropType<'remix' | 'tdesign' | 'custom'>, default: 'remix' },
95
104
  });
96
105
 
97
- const emit = defineEmits(['change', 'update:value', 'update:tdesign', 'update:remixicon', 'update:svg']);
106
+ const emit = defineEmits(['change', 'update:value', 'update:tdesign', 'update:remixicon', 'update:svg', 'update:type']);
98
107
 
99
108
  // dialog 不需要 attach/placement
100
109
 
@@ -136,8 +145,15 @@ const displayValue = computed({
136
145
  },
137
146
  });
138
147
 
148
+ watch(
149
+ () => props.type,
150
+ v => {
151
+ sourceType.value = (v as any) || 'remix';
152
+ },
153
+ { immediate: true },
154
+ );
155
+
139
156
  watchEffect(() => {
140
- sourceType.value = (props.type as any) || sourceType.value;
141
157
  let v = props.value || '';
142
158
  if (sourceType.value === 'remix' && v && !/-line$|-filled$/.test(v)) {
143
159
  v = v + (styleType.value === 'filled' ? '-filled' : '-line');