From 2db02ce2baf738177303cbe4dbddc1f06ab2b4e6 Mon Sep 17 00:00:00 2001 From: yxh01132861 Date: Wed, 18 Oct 2023 09:39:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/ScaleSelector/demos/default.tsx | 12 ++++++------ .../components/ScaleSelector/index.tsx | 12 +++++++----- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/li-p2/src/LayerAttribute/components/ScaleSelector/demos/default.tsx b/packages/li-p2/src/LayerAttribute/components/ScaleSelector/demos/default.tsx index 81113244..73aa2ff4 100644 --- a/packages/li-p2/src/LayerAttribute/components/ScaleSelector/demos/default.tsx +++ b/packages/li-p2/src/LayerAttribute/components/ScaleSelector/demos/default.tsx @@ -111,18 +111,18 @@ const schema = { type: 'object', properties: { fillColorScale: { - type: 'string', - title: '颜色划分----', + type: 'number', + title: '颜色划分', default: { - type: 'cat', - domain: [5, 5.6, undefined, 5.7, undefined, 7.9, undefined, 5.8], - colors: ['#63759a', '#e61486'], + type: 'threshold', + domain: [5, 5.6, 5.7], + colors: ['#63759a', '#e61486', '#f00', '#0f0'], }, 'x-decorator': 'FormItem', 'x-component': 'ScaleSelector', 'x-component-props': { placeholder: '请选择', - type: 'string', //选择的筛选字段的类型 + type: 'number', //选择的筛选字段的类型 dataset: { min: 5, max: 7.9, diff --git a/packages/li-p2/src/LayerAttribute/components/ScaleSelector/index.tsx b/packages/li-p2/src/LayerAttribute/components/ScaleSelector/index.tsx index dd0233ee..ade358fd 100644 --- a/packages/li-p2/src/LayerAttribute/components/ScaleSelector/index.tsx +++ b/packages/li-p2/src/LayerAttribute/components/ScaleSelector/index.tsx @@ -82,11 +82,13 @@ const Internal = (props: ScaleSelectorProps) => { if (checked) { setType(THRESHOLD); setCustomOpen(true); - const _defaultValue = getDefault(fieldType, dataset, defaultColors); - // @ts-ignore - props?.onChange({ - ..._defaultValue, - }); + if (!defaultValue.list) { + const _defaultValue = getDefault(fieldType, dataset, defaultColors); + // @ts-ignore + props?.onChange({ + ..._defaultValue, + }); + } } else { setCustomOpen(false); if (props.onChange) {