fix: keep admin icons local
This commit is contained in:
@@ -16,6 +16,43 @@ interface IconifyResponse {
|
||||
|
||||
const PENDING_REQUESTS: Recordable<Promise<string[]>> = {};
|
||||
|
||||
const LOCAL_ICONS_MAP: Recordable<string[]> = {
|
||||
carbon: [
|
||||
'carbon:agent-detached',
|
||||
'carbon:align-box-middle-right',
|
||||
'carbon:align-vertical-top',
|
||||
'carbon:arrange',
|
||||
'carbon:arrange-horizontal',
|
||||
'carbon:checkmark',
|
||||
'carbon:chevron-down',
|
||||
'carbon:circle-dash',
|
||||
'carbon:close',
|
||||
'carbon:edit',
|
||||
'carbon:email',
|
||||
'carbon:renew',
|
||||
'carbon:reset',
|
||||
'carbon:user-multiple',
|
||||
],
|
||||
ep: [
|
||||
'ep:caret-right',
|
||||
'ep:delete',
|
||||
'ep:edit',
|
||||
'ep:plus',
|
||||
'ep:refresh',
|
||||
],
|
||||
lucide: [
|
||||
'lucide:bot',
|
||||
'lucide:check-square',
|
||||
'lucide:layout-grid',
|
||||
'lucide:library-big',
|
||||
'lucide:list',
|
||||
'lucide:megaphone',
|
||||
'lucide:square-check-big',
|
||||
'lucide:square-user',
|
||||
'lucide:workflow',
|
||||
],
|
||||
};
|
||||
|
||||
/**
|
||||
* 通过Iconify接口获取图标集数据。
|
||||
* 同一时间多个图标选择器同时请求同一个图标集时,实际上只会发起一次请求(所有请求共享同一份结果)。
|
||||
@@ -24,6 +61,10 @@ const PENDING_REQUESTS: Recordable<Promise<string[]>> = {};
|
||||
* @returns 图标集中包含的所有图标名称
|
||||
*/
|
||||
export async function fetchIconsData(prefix: string): Promise<string[]> {
|
||||
if (LOCAL_ICONS_MAP[prefix]) {
|
||||
ICONS_MAP[prefix] = LOCAL_ICONS_MAP[prefix];
|
||||
return ICONS_MAP[prefix];
|
||||
}
|
||||
if (Reflect.has(ICONS_MAP, prefix) && ICONS_MAP[prefix]) {
|
||||
return ICONS_MAP[prefix];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user