cd-icon-picker 0.1.5 → 0.1.7

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/IconPicker.vue +13 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cd-icon-picker",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Vue 3 icon picker supporting TDesign & RemixIcon, with custom SVG via :diy-icon.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -103,7 +103,7 @@ const props = defineProps({
103
103
  type: { type: String as PropType<'remix' | 'tdesign' | 'custom'>, default: 'remix' },
104
104
  });
105
105
 
106
- 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']);
107
107
 
108
108
  // dialog 不需要 attach/placement
109
109
 
@@ -145,11 +145,18 @@ const displayValue = computed({
145
145
  },
146
146
  });
147
147
 
148
+ watch(
149
+ () => props.type,
150
+ v => {
151
+ sourceType.value = (v as any) || 'remix';
152
+ },
153
+ { immediate: true },
154
+ );
155
+
148
156
  watchEffect(() => {
149
- sourceType.value = (props.type as any) || sourceType.value;
150
157
  let v = props.value || '';
151
- if (sourceType.value === 'remix' && v && !/-line$|-filled$/.test(v)) {
152
- v = v + (styleType.value === 'filled' ? '-filled' : '-line');
158
+ if (sourceType.value === 'remix' && v && !/-line$|-fill$/.test(v)) {
159
+ v = v + (styleType.value === 'filled' ? '-fill' : '-line');
153
160
  }
154
161
  currentSelect.value = v;
155
162
  });
@@ -191,8 +198,8 @@ const filteredIcons = computed(() => {
191
198
  }
192
199
 
193
200
  if (sourceType.value === 'remix') {
194
- const suffix = useFill ? '-filled' : '-line';
195
- list = list.map(n => (/-line$|-filled$/.test(n) ? n : `${n}${suffix}`));
201
+ const suffix = useFill ? '-fill' : '-line';
202
+ list = list.map(n => (/-line$|-fill$/.test(n) ? n : `${n}${suffix}`));
196
203
  }
197
204
 
198
205
  return searchText.value ? list.filter(i => i.includes(searchText.value)) : list;