From e7b1be00ab1120743d5e1306bf0ffd686359e996 Mon Sep 17 00:00:00 2001 From: wibetter <365533093@qq.com> Date: Wed, 16 Aug 2023 19:16:33 +0800 Subject: [PATCH] =?UTF-8?q?fix(amis-editor):=20chart=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=AE=BD=E9=AB=98=E5=8F=AF=E8=A7=86=E5=8C=96=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis-editor/src/plugin/Chart.tsx | 40 +++++++++++++++++------ packages/amis/src/renderers/Chart.tsx | 4 +-- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/packages/amis-editor/src/plugin/Chart.tsx b/packages/amis-editor/src/plugin/Chart.tsx index eab5cbb59..335e72857 100644 --- a/packages/amis-editor/src/plugin/Chart.tsx +++ b/packages/amis-editor/src/plugin/Chart.tsx @@ -252,7 +252,6 @@ export class ChartPlugin extends BasePlugin { visibleOn: 'data.api.url', pipeIn: defaultValue(true) }), - { name: 'interval', label: tipedLabel( @@ -265,6 +264,15 @@ export class ChartPlugin extends BasePlugin { visibleOn: 'data.api.url', unitOptions: ['ms'] }, + getSchemaTpl('expressionFormulaControl', { + evalMode: false, + label: tipedLabel( + '跟踪表达式', + '如果这个表达式的值有变化时会更新图表,当 config 中用了数据映射时有用' + ), + name: 'trackExpression', + placeholder: '\\${xxx}' + }), { name: 'config', asFormItem: true, @@ -303,15 +311,6 @@ export class ChartPlugin extends BasePlugin { '默认为追加模式,新的配置会跟旧的配置合并,如果勾选将直接完全覆盖' ), name: 'replaceChartOption' - }), - getSchemaTpl('expressionFormulaControl', { - evalMode: false, - label: tipedLabel( - '跟踪表达式', - '如果这个表达式的值有变化时会更新图表,当 config 中用了数据映射时有用' - ), - name: 'trackExpression', - placeholder: '\\${xxx}' }) ] }, @@ -354,6 +353,27 @@ export class ChartPlugin extends BasePlugin { { title: '外观', body: getSchemaTpl('collapseGroup', [ + { + title: '宽高设置', + body: [ + getSchemaTpl('style:widthHeight', { + widthSchema: { + label: tipedLabel( + '宽度', + '默认宽度为父容器宽度,值单位默认为 px,也支持百分比等单位 ,如:100%' + ), + pipeIn: defaultValue('100%') + }, + heightSchema: { + label: tipedLabel( + '高度', + '默认高度为300px,值单位默认为 px,也支持百分比等单位 ,如:100%' + ), + pipeIn: defaultValue('300px') + } + }) + ] + }, ...getSchemaTpl('theme:common', {exclude: ['layout']}) ]) }, diff --git a/packages/amis/src/renderers/Chart.tsx b/packages/amis/src/renderers/Chart.tsx index bae66492f..158285215 100644 --- a/packages/amis/src/renderers/Chart.tsx +++ b/packages/amis/src/renderers/Chart.tsx @@ -94,12 +94,12 @@ export interface ChartSchema extends BaseSchema { /** * 宽度设置 */ - width?: number; + width?: number | string; /** * 高度设置 */ - height?: number; + height?: number | string; /** * 刷新时间