Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 图层属性面板颜色映射 scale 添加 #78

Merged
merged 7 commits into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/components/LayerAttribute/BubbleLayerStyle/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const bubbleLayerStyleFlatToConfig = (style: Record<string, any>) => {
? {
field: style.fillColorField,
value: style.fillColorRibbon,
scale: { type: style.fillColorScale },
}
: style.fillColor,
opacity: style.fillColorOpacity,
Expand Down Expand Up @@ -45,6 +46,7 @@ export const bubbleLayerStyleConfigToFlat = (styleConfig: BubbleLayerStyleAttrib
const config = {
fillColorField: typeof fillColor === 'object' ? fillColor?.field : undefined,
fillColorRibbon: typeof fillColor === 'object' ? fillColor?.value : undefined,
fillColorScale: typeof fillColor === 'object' ? fillColor?.scale?.type : undefined,
fillColor: typeof fillColor !== 'object' ? fillColor : undefined,
fillColorOpacity: opacity,
strokeColor: strokeColor,
Expand Down
2 changes: 2 additions & 0 deletions src/components/LayerAttribute/ChoroplethLayerStyle/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const choroplethLayerStyleFlatToConfig = (style: Record<string, any>) =>
? {
field: style.fillColorField,
value: style.fillColorRibbon,
scale: { type: style.fillColorScale },
}
: style.fillColor,
opacity: style.fillColorOpacity,
Expand Down Expand Up @@ -39,6 +40,7 @@ export const choroplethLayerStyleConfigToFlat = (styleConfig: ChoroplethLayerSty
const config = {
fillColorField: typeof fillColor === 'object' ? fillColor?.field : undefined,
fillColorRibbon: typeof fillColor === 'object' ? fillColor?.value : undefined,
fillColorScale: typeof fillColor === 'object' ? fillColor?.scale?.type : undefined,
fillColor: typeof fillColor !== 'object' ? fillColor : undefined,
fillColorOpacity: opacity,
strokeColor: strokeColor,
Expand Down
3 changes: 3 additions & 0 deletions src/components/LayerAttribute/LineLayerStyle/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const lineLayerStyleFlatToConfig = (style: Record<string, any>) => {
? {
field: style.fillColorField,
value: style.fillColorRibbon,
scale: { type: style.fillColorScale },
}
: style.fillColor,
style: {
Expand Down Expand Up @@ -46,6 +47,8 @@ export const lineLayerStyleConfigToFlat = (styleConfig: LineLayerStyleAttributeV
fillColor: typeof color !== 'object' ? color : undefined,
fillColorField: typeof color === 'object' ? color?.field : undefined,
fillColorRibbon: typeof color === 'object' ? color?.value : undefined,
fillColorScale: typeof color === 'object' ? color?.scale?.type : undefined,

fillColorOpacity: style?.opacity,

lineType: style?.lineType,
Expand Down
8 changes: 4 additions & 4 deletions src/components/LayerAttribute/LineLayerStyle/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ export default (fieldList: FieldSelectOptionType[] = [], ribbonList: string[][]
enum: [...fieldList],
},

fillColorType: {
fillColorScale: {
type: 'string',
title: '颜色划分',
default: 'geometric',
default: 'quantize',
enum: [
{
label: '等比',
value: 'geometric',
value: 'quantize',
},
{
label: '等分',
value: 'uniform',
value: 'quantile',
},
],
'x-decorator': 'FormItem',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { FieldSelectOptionType } from '../types';

export default (fieldList: FieldSelectOptionType[] = [], ribbonList: string[][] = []) => {
export default (fieldList: FieldSelectOptionType[] = [], ribbonList: string[][] = [], collapseTitle?: string) => {
return {
type: 'void',
'x-component': 'FormCollapse',
Expand All @@ -14,7 +14,7 @@ export default (fieldList: FieldSelectOptionType[] = [], ribbonList: string[][]
type: 'void',
'x-component': 'FormCollapse.CollapsePanel',
'x-component-props': {
header: '填充颜色',
header: collapseTitle ? collapseTitle : '填充颜色',
},
properties: {
fillColorField: {
Expand All @@ -32,18 +32,18 @@ export default (fieldList: FieldSelectOptionType[] = [], ribbonList: string[][]
enum: [...fieldList],
},

fillColorType: {
fillColorScale: {
type: 'string',
title: '颜色划分',
default: 'geometric',
default: 'quantize',
enum: [
{
label: '等比',
value: 'geometric',
value: 'quantize',
},
{
label: '等分',
value: 'uniform',
value: 'quantile',
},
],
'x-decorator': 'FormItem',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { FieldSelectOptionType } from '../types';

export default (fieldList: FieldSelectOptionType[] = []) => {
export default (fieldList: FieldSelectOptionType[] = [], collapseTitle?: string) => {
return {
type: 'void',
'x-component': 'FormCollapse',
Expand All @@ -14,7 +14,7 @@ export default (fieldList: FieldSelectOptionType[] = []) => {
type: 'void',
'x-component': 'FormCollapse.CollapsePanel',
'x-component-props': {
header: '填充半径',
header: collapseTitle ? collapseTitle : '填充半径',
},

properties: {
Expand Down