From ee3f45b8d2fe391f0e20cbc500905d511d2860af Mon Sep 17 00:00:00 2001 From: tooeast Date: Fri, 12 Aug 2022 10:28:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=89=80=E6=9C=89=20icon-picker=20?= =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E4=B8=BA=20icon-select,=E7=94=A8=E4=BA=8E?= =?UTF-8?q?=E7=88=B1=E9=80=9F=E6=90=AD=20icon=20=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I9e2fcbabb92760666412b8edb0165554c248315a --- .../amis-editor/src/component/BaseControl.ts | 8 ++--- packages/amis-editor/src/plugin/Avatar.tsx | 8 ++--- .../amis-editor/src/plugin/Breadcrumb.tsx | 8 ++--- .../amis-editor/src/plugin/CollapseGroup.tsx | 8 ++--- .../src/plugin/Form/InputTable.tsx | 36 +++++++------------ packages/amis-editor/src/plugin/Nav.tsx | 8 ++--- packages/amis-editor/src/tpl/common.tsx | 24 ++++++------- 7 files changed, 38 insertions(+), 62 deletions(-) diff --git a/packages/amis-editor/src/component/BaseControl.ts b/packages/amis-editor/src/component/BaseControl.ts index 4038d4245..044a70067 100644 --- a/packages/amis-editor/src/component/BaseControl.ts +++ b/packages/amis-editor/src/component/BaseControl.ts @@ -482,12 +482,10 @@ export function remarkTpl(config: { } ] }, - { + getSchemaTpl('icon', { name: 'icon', - label: '图标', - type: 'icon-picker', - className: 'fix-icon-picker-overflow' - }, + label: '图标' + }), { name: 'className', label: 'CSS 类名', diff --git a/packages/amis-editor/src/plugin/Avatar.tsx b/packages/amis-editor/src/plugin/Avatar.tsx index c69d98e2c..c9969528b 100644 --- a/packages/amis-editor/src/plugin/Avatar.tsx +++ b/packages/amis-editor/src/plugin/Avatar.tsx @@ -96,13 +96,11 @@ export class AvatarPlugin extends BasePlugin { className: 'ae-ExtendMore mb-3', body: [ // 图标 - { - label: '图标', + getSchemaTpl('icon', { name: 'icon', - type: 'icon-picker', - className: 'fix-icon-picker-overflow', + label: '图标', visibleOn: 'data.showtype === "icon"' - }, + }), // 图片 getSchemaTpl('valueFormula', { rendererSchema: { diff --git a/packages/amis-editor/src/plugin/Breadcrumb.tsx b/packages/amis-editor/src/plugin/Breadcrumb.tsx index 48d2fe2e7..bc50ccb4c 100644 --- a/packages/amis-editor/src/plugin/Breadcrumb.tsx +++ b/packages/amis-editor/src/plugin/Breadcrumb.tsx @@ -73,12 +73,10 @@ export class BreadcrumbPlugin extends BasePlugin { name: 'href', placeholder: '链接' }, - { + getSchemaTpl('icon', { name: 'icon', - label: '图标', - type: 'icon-picker', - className: 'fix-icon-picker-overflow' - } + label: '图标' + }) ] } ] diff --git a/packages/amis-editor/src/plugin/CollapseGroup.tsx b/packages/amis-editor/src/plugin/CollapseGroup.tsx index 8fa5ec299..f5b3258d1 100644 --- a/packages/amis-editor/src/plugin/CollapseGroup.tsx +++ b/packages/amis-editor/src/plugin/CollapseGroup.tsx @@ -96,18 +96,16 @@ export class CollapseGroupPlugin extends BasePlugin { autoFocus: false, form: { body: [ - { - label: '图标', + getSchemaTpl('icon', { name: 'expandIcon', - type: 'icon-picker', - className: 'fix-icon-picker-overflow', + label: '图标', pipeIn: (value: any) => value?.icon, pipeOut: (value: any) => ({ type: 'icon', vendor: '', icon: value }) - } + }) ] }, pipeIn: (value: string) => { diff --git a/packages/amis-editor/src/plugin/Form/InputTable.tsx b/packages/amis-editor/src/plugin/Form/InputTable.tsx index 8089cc9ed..7e814e280 100644 --- a/packages/amis-editor/src/plugin/Form/InputTable.tsx +++ b/packages/amis-editor/src/plugin/Form/InputTable.tsx @@ -189,13 +189,11 @@ export class TableControlPlugin extends BasePlugin { visibleOn: 'data.addable', pipeIn: defaultValue('') }, - { + getSchemaTpl('icon', { name: 'addBtnIcon', label: '增加按钮图标', - type: 'icon-picker', - className: 'fix-icon-picker-overflow', visibleOn: 'data.addable' - }, + }), getSchemaTpl('api', { name: 'addApi', label: '新增时提交的 API', @@ -212,13 +210,11 @@ export class TableControlPlugin extends BasePlugin { visibleOn: 'data.removable', pipeIn: defaultValue('') }, - { + getSchemaTpl('icon', { name: 'deleteBtnIcon', label: '删除按钮图标', - type: 'icon-picker', - className: 'fix-icon-picker-overflow', visibleOn: 'data.removable' - }, + }), getSchemaTpl('api', { name: 'deleteApi', label: '删除时提交的 API', @@ -235,13 +231,11 @@ export class TableControlPlugin extends BasePlugin { visibleOn: 'data.editable', pipeIn: defaultValue('') }, - { + getSchemaTpl('icon', { name: 'editBtnIcon', label: '编辑按钮图标', - type: 'icon-picker', - className: 'fix-icon-picker-overflow', visibleOn: 'data.editable' - }, + }), getSchemaTpl('switch', { label: '是否可复制', name: 'copyable' @@ -253,13 +247,11 @@ export class TableControlPlugin extends BasePlugin { visibleOn: 'data.copyable', pipeIn: defaultValue('') }, - { + getSchemaTpl('icon', { name: 'copyBtnIcon', label: '复制按钮图标', - type: 'icon-picker', - className: 'fix-icon-picker-overflow', visibleOn: 'data.copyable' - }, + }), getSchemaTpl('api', { name: 'updateApi', label: '修改时提交的 API', @@ -272,13 +264,11 @@ export class TableControlPlugin extends BasePlugin { visibleOn: 'data.editable', pipeIn: defaultValue('') }, - { + getSchemaTpl('icon', { name: 'confirmBtnIcon', label: '确认编辑按钮图标', - type: 'icon-picker', - className: 'fix-icon-picker-overflow', visibleOn: 'data.editable' - }, + }), { type: 'input-text', name: 'cancelBtnLabel', @@ -286,13 +276,11 @@ export class TableControlPlugin extends BasePlugin { visibleOn: 'data.editable', pipeIn: defaultValue('') }, - { + getSchemaTpl('icon', { name: 'cancelBtnIcon', label: '取消编辑按钮图标', - type: 'icon-picker', - className: 'fix-icon-picker-overflow', visibleOn: 'data.editable' - }, + }), getSchemaTpl('switch', { label: '是否可拖拽排序', name: 'draggable' diff --git a/packages/amis-editor/src/plugin/Nav.tsx b/packages/amis-editor/src/plugin/Nav.tsx index 57bcb7fb4..28a6ffe25 100644 --- a/packages/amis-editor/src/plugin/Nav.tsx +++ b/packages/amis-editor/src/plugin/Nav.tsx @@ -66,12 +66,10 @@ export class NavPlugin extends BasePlugin { required: true }, - { - type: 'icon-picker', + getSchemaTpl('icon', { name: 'icon', - label: '图标', - className: 'fix-icon-picker-overflow' - }, + label: '图标' + }), { type: 'group', diff --git a/packages/amis-editor/src/tpl/common.tsx b/packages/amis-editor/src/tpl/common.tsx index 756a8dcd7..681d27517 100644 --- a/packages/amis-editor/src/tpl/common.tsx +++ b/packages/amis-editor/src/tpl/common.tsx @@ -478,9 +478,8 @@ setSchemaTpl('expression', { setSchemaTpl('icon', { label: '图标', - type: 'icon-picker', + type: 'icon-select', name: 'icon', - className: 'fix-icon-picker-overflow', placeholder: '点击选择图标', clearable: true, description: '' @@ -642,15 +641,15 @@ setSchemaTpl('visible', { expressionName: 'visibleOn' }); - // 新版配置面板兼容 [可见] 状态 setSchemaTpl('newVisible', { - type: 'ae-StatusControl', - label: '可见', - mode: 'normal', - name: 'visible', - expressionName: 'visibleOn', - visibleOn:"data.visible || data.visible === false || data.visibleOn !== undefined" + type: 'ae-StatusControl', + label: '可见', + mode: 'normal', + name: 'visible', + expressionName: 'visibleOn', + visibleOn: + 'data.visible || data.visible === false || data.visibleOn !== undefined' }); setSchemaTpl('hidden', { @@ -996,7 +995,7 @@ setSchemaTpl('app-page-args', { type: 'ae-DataMappingControl', name: 'params', label: '页面参数', - schema: {"type": "object", "properties":{}}, + schema: {type: 'object', properties: {}}, mode: 'horizontal' }); @@ -1004,14 +1003,13 @@ setSchemaTpl( 'iconLink', (schema: {name: 'icon' | 'rightIcon'; visibleOn: boolean}) => { const {name, visibleOn} = schema; - return { + return getSchemaTpl('icon', { name: name, visibleOn, label: '图标', - type: 'icon-picker', placeholder: '点击选择图标', clearable: true, description: '' - }; + }); } );