@cainiaofe/cn-ui-lowcode
Version:
139 lines (136 loc) • 4.08 kB
JavaScript
import { Bundle } from '@ali/visualengine';
import React from 'react';
import Icon from './logo.tsx';
import {
getArraySetterSnippet,
getCnSelectSetter,
getMixedSetterSnippet,
getObjectSetterSnippet,
} from '@/common/manager/setter-snippet';
import { getJSExpressionPrototype } from '@/common/manager/common-style';
import { getStatusDataSource } from '@/common/util/prototype-util';
import { getItemListByPosition } from '@/common/util/util';
import { DisplayPosition } from '@/common/manager/position/display-position';
const CnFormatBundle = Bundle.createPrototype({
title: '格式化文本(CnFormat)',
componentName: 'CnFormat',
category: '信息展示',
icon: Icon,
docUrl:
'https://cone.cainiao-inc.com/market/awesome?business=internationality&id=3313',
isContainer: true,
canHovering: true,
canSelecting: true,
canDragging: true,
enableCopy: true,
snippets: [
{
screenshot:
'https://img.alicdn.com/imgextra/i4/O1CN01SWmTZ124PT13qvuzQ_!!6000000007383-0-tps-720-236.jpg',
label: 'CnFormat',
schema: {
componentName: 'CnFormat',
props: {},
},
},
],
configure: [
{
name: 'isCnFormat',
title: 'isCnFormat',
initialValue: true,
display: 'none',
},
{
name: '_context',
title: '上下文',
initialValue: {
type: 'JSExpression',
value: 'this',
},
display: 'none',
},
{
name: 'title',
title: '组件名称',
display: 'inline',
initialValue: '格式化文本',
setter: 'StringSetter',
},
{
title: '展示文本',
name: 'formatSchema',
display:'plain',
setter: {
componentName: 'ArraySetter',
props: {
mode: 'list',
itemSetter: {
componentName: 'ObjectSetter',
// initialValue: {
// "type": "JSFunction",
// "value": "() => {return {primaryKey: String(Math.floor(Math.random() * 10000)),children: \"Title\",optType:\"link\" };}"
// },
initialValue: {
value:'文本',
format:'text',
mock:'一段新的文本'
},
props: {
config: {
items: [
{
title: '内容',
name: 'value',
isRequired: true,
setter: getMixedSetterSnippet({
setters: [
{
title: '纯文本',
componentName: 'CnI18nSetter',
},
// {
// title: '绑定指标卡请求的数据',
// componentName: 'NumberSetter'
// },
getJSExpressionPrototype({
type: 'formatValue',
}),
],
}),
},
{
title: '类型',
name: 'format',
isRequired: true,
setter:{
componentName: 'CnSelectSetter',
props: () => {
return {
options: getItemListByPosition({
position: DisplayPosition.cnFormat,
componentMap: {},
}),
selectProps: {
hasClear: true,
},
};
},
},
},
{
title: 'mock数据',
name: 'mock',
isRequired: true,
setter:'StringSetter',
},
],
},
},
},
},
},
}
],
});
export default CnFormatBundle;