修复 booleanOrKeyword,不过似乎还有问题

This commit is contained in:
wuduoyi 2020-10-30 18:13:16 +08:00
parent 766131c91b
commit fd0e0b5477
2 changed files with 18 additions and 9 deletions

View File

@ -311,7 +311,14 @@ export const formatter = (label: string) => {
* selectedMode 便
* @param label
*/
export const selectedMode = (label: string) => {};
export const selectedMode = (label: string) => {
return booleanOrKeyword(
'selectedMode',
`${label}选择的模式`,
'改变模式类型',
['single', 'multiple']
);
};
/**
* padding
@ -438,13 +445,13 @@ export const keywordOrNumber = (
};
/**
*
*
* @param name
* @param label
* @param labelForSwitch
* @param keywordList
*/
export const keywordOrBoolean = (
export const booleanOrKeyword = (
name: string,
label: string,
labelForSwitch: string,
@ -460,29 +467,29 @@ export const keywordOrBoolean = (
name: name,
pipeIn: (value: any, data) => {
if (typeof data[name] === 'undefined') {
return false;
return true;
}
return typeof data[name] !== 'string';
},
pipeOut: (value: any, oldValue: any, data: any) => {
if (value) {
return defaultBoolean;
} else {
return keywordList[0];
} else {
return defaultBoolean;
}
}
},
{
type: 'switch',
name: name,
visibleOn: `typeof(data.${name}) === 'boolean'`,
visibleOn: `typeof(data.${name}) === 'undefined' || typeof(data.${name}) === 'boolean'`,
label: label
},
{
type: 'select',
name: name,
label: label,
visibleOn: `typeof(data.${name}) === 'undefined' || typeof(data.${name}) === 'string'`,
visibleOn: `typeof(data.${name}) === 'string'`,
options: keywordList
}
]

View File

@ -17,6 +17,7 @@ import {
select,
viewport,
formatter,
selectedMode,
createHierarchy
} from './Common';
@ -44,7 +45,8 @@ export default {
number('itemWidth', '图例标记的图形宽度'),
number('itemHeight', '图例标记的图形高度'),
trueSwitch('symbolKeepAspect', '是否在缩放时保持该图形的长宽比'),
formatter('图例')
formatter('图例'),
selectedMode('图例')
])
])
]