UNPKG

syber-lowcode-business-materials

Version:
112 lines (111 loc) 2.39 kB
//字体样式配置 function getFontSet(parentKeyName, hideInput, hideColor) { if (hideInput === void 0) { hideInput = false; } if (hideColor === void 0) { hideColor = false; } var items = []; if (!hideInput) { items.push({ name: parentKeyName + '.text', title: '文本', supportVariable: false, setter: { componentName: "StringSetter", props: { placeholder: "请选择文案", maxLength: 50 } } }); } if (!hideColor) { items.push({ name: parentKeyName + '.color', title: '字体颜色', supportVariable: false, setter: 'ColorSetter' }); } items = items.concat([{ name: parentKeyName, title: '字体大小', supportVariable: false, setter: { componentName: 'ObjectSetter', props: { config: { items: distanceSet("fontSize", "sizeUnit", ["px", "rem"]) } } } }, { name: parentKeyName, title: '字体样式', supportVariable: false, setter: { componentName: 'ObjectSetter', props: { config: { items: [{ title: "加粗", name: 'fontBold', supportVariable: false, defaultValue: false, setter: 'BoolSetter' }, { title: "倾斜", name: 'fontItalic', supportVariable: false, defaultValue: false, setter: 'BoolSetter' }] } } } }]); return items; } //数值 + 单位的选择 function distanceSet(valueField, unitField, unitArray) { if (unitArray === void 0) { unitArray = ['px', '%']; } return [{ title: "数值", name: valueField, supportVariable: false, setter: { componentName: 'NumberSetter', props: { min: 12, max: 100, step: 1 }, initialValue: 18 } }, { title: "单位", name: unitField, supportVariable: false, setter: { componentName: "SelectSetter", props: { options: unitArray.map(function (item) { return { title: item, value: item }; }) }, initialValue: unitArray[0] } }]; } export default { getFontSet: getFontSet, distanceSet: distanceSet }; export { getFontSet, distanceSet };