From ab90b15ffcbff259eaaf9d024f8750f55db20438 Mon Sep 17 00:00:00 2001 From: chenos Date: Sun, 13 Dec 2020 20:46:40 +0800 Subject: [PATCH] feat: add icon field --- packages/app/src/components/form.fields/registry.ts | 1 + .../src/collections/collections.ts | 4 ++-- packages/plugin-collections/src/interfaces/index.ts | 1 + packages/plugin-collections/src/interfaces/types.ts | 13 ++++++++++++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/app/src/components/form.fields/registry.ts b/packages/app/src/components/form.fields/registry.ts index d6a15d621d..5b1d95f99d 100644 --- a/packages/app/src/components/form.fields/registry.ts +++ b/packages/app/src/components/form.fields/registry.ts @@ -33,6 +33,7 @@ export const setup = () => { month: DatePicker.MonthPicker, week: DatePicker.WeekPicker, string: Input, + icon: Input, textarea: Input.TextArea, number: NumberPicker, percent: Percent, diff --git a/packages/plugin-collections/src/collections/collections.ts b/packages/plugin-collections/src/collections/collections.ts index 77346ed83d..fe172d4f1c 100644 --- a/packages/plugin-collections/src/collections/collections.ts +++ b/packages/plugin-collections/src/collections/collections.ts @@ -52,13 +52,13 @@ export default { }, }, { - interface: 'string', + interface: 'icon', type: 'virtual', name: 'icon', title: '图标', defaultValue: 'TableOutlined', component: { - type: 'string', + type: 'icon', showInTable: true, showInForm: true, showInDetail: true, diff --git a/packages/plugin-collections/src/interfaces/index.ts b/packages/plugin-collections/src/interfaces/index.ts index 2d55c4f175..63361dfcb4 100644 --- a/packages/plugin-collections/src/interfaces/index.ts +++ b/packages/plugin-collections/src/interfaces/index.ts @@ -63,6 +63,7 @@ export const options = [ types.sort, types.password, types.json, + types.icon, ], } ].map(({title, children}: any) => ({ diff --git a/packages/plugin-collections/src/interfaces/types.ts b/packages/plugin-collections/src/interfaces/types.ts index 85886cd8cb..993c331b72 100644 --- a/packages/plugin-collections/src/interfaces/types.ts +++ b/packages/plugin-collections/src/interfaces/types.ts @@ -472,10 +472,21 @@ export const json = { options: { interface: 'json', type: 'json', - dottie: true, + mode: 'replace', // developerMode: true, component: { type: 'hidden', }, }, }; + +export const icon = { + title: '图标', + options: { + interface: 'icon', + type: 'string', + component: { + type: 'icon', + }, + }, +};