From acf4070de01b7cb86002fb26d726fc7f46e696b7 Mon Sep 17 00:00:00 2001 From: liaoxuezhi <2betop.cn@gmail.com> Date: Mon, 15 May 2023 15:26:05 +0800 Subject: [PATCH] chore: expose getIconNames Close: #6831 (#6870) --- packages/amis-ui/src/components/icons.tsx | 4 ++++ packages/amis-ui/src/components/index.tsx | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/amis-ui/src/components/icons.tsx b/packages/amis-ui/src/components/icons.tsx index 78e2f9a43..3f5d93c1d 100644 --- a/packages/amis-ui/src/components/icons.tsx +++ b/packages/amis-ui/src/components/icons.tsx @@ -118,6 +118,10 @@ const iconFactory: { [propName: string]: React.ElementType<{}>; } = {}; +export function getIconNames() { + return Object.keys(iconFactory); +} + export function getIcon(key: string) { return iconFactory[key]; } diff --git a/packages/amis-ui/src/components/index.tsx b/packages/amis-ui/src/components/index.tsx index b3d3fffb3..83dd8ad13 100644 --- a/packages/amis-ui/src/components/index.tsx +++ b/packages/amis-ui/src/components/index.tsx @@ -76,7 +76,7 @@ import PickerContainer from './PickerContainer'; import InputJSONSchema from './json-schema'; import {Badge, withBadge} from './Badge'; import type {BadgeObject} from './Badge'; -import {getIcon, Icon, registerIcon} from './icons'; +import {getIcon, getIconNames, Icon, registerIcon} from './icons'; import {withRemoteConfig} from './WithRemoteConfig'; import type {RemoteOptionsProps} from './WithRemoteConfig'; import ConditionBuilder from './condition-builder'; @@ -224,6 +224,7 @@ export { UserSelect, UserTabSelect, getIcon, + getIconNames, registerIcon, Badge, HeadCellDropDown,