Commit 9b6bda81 authored by 李纪文's avatar 李纪文

feat: 组态实时值增加单位设置

parent d4cfd50a
......@@ -1289,10 +1289,10 @@ const ConfigurationView = (props) => {
const padding = v ? v.split(',') : null;
return padding
? new go.Margin(
padding[0] * 1 || 0,
padding[1] * 1 || 0,
padding[2] * 1 || 0,
padding[3] * 1 || 0,
padding?.[0] * 1 || 0,
padding?.[1] * 1 || 0,
padding?.[2] * 1 || 0,
padding?.[3] * 1 || 0,
)
: 0;
}).makeTwoWay(),
......@@ -1915,35 +1915,77 @@ const ConfigurationView = (props) => {
new go.Binding('angle').makeTwoWay(),
roleVisibleBinding(), // 绑定角色可见
goJS(
go.Shape,
'RoundedRectanglePlus',
{ name: 'SHAPE', strokeWidth: 10, stroke: '#000000', parameter1: 0 },
new go.Binding('fill', 'fillColor'),
new go.Binding('stroke'),
new go.Binding('strokeWidth'),
new go.Binding('parameter1', 'radius').makeTwoWay(),
new go.Binding('desiredSize', 'size', go.Size.parse).makeTwoWay(go.Size.stringify),
),
goJS(
go.TextBlock,
textStyle(),
{
maxSize: new go.Size(NaN, NaN),
minSize: new go.Size(NaN, 1),
wrap: go.TextBlock.WrapFit,
textAlign: 'center',
editable: true,
font: 'bold 12px Helvetica, Arial, sans-serif',
stroke: '#454545',
flip: go.GraphObject.None,
},
new go.Binding('text', 'showVal'),
new go.Binding('font', 'fontStyle'),
new go.Binding('stroke', 'fontStroke'),
new go.Binding('textAlign', 'fontAlign'),
new go.Binding('maxSize', 'textSize'),
new go.Binding('minSize', 'textSize'),
new go.Binding('flip', 'flip'),
go.Panel,
'Horizontal',
goJS(
go.Panel,
'Auto',
goJS(
go.Shape,
'RoundedRectanglePlus',
{ name: 'SHAPE', strokeWidth: 10, stroke: '#000000', parameter1: 0 },
new go.Binding('fill', 'fillColor'),
new go.Binding('stroke'),
new go.Binding('strokeWidth'),
new go.Binding('parameter1', 'radius').makeTwoWay(),
new go.Binding('desiredSize', 'size', go.Size.parse).makeTwoWay(go.Size.stringify),
),
goJS(
go.TextBlock,
textStyle(),
{
maxSize: new go.Size(NaN, NaN),
minSize: new go.Size(NaN, 1),
wrap: go.TextBlock.WrapFit,
textAlign: 'center',
editable: true,
font: 'bold 12px Helvetica, Arial, sans-serif',
stroke: '#454545',
flip: go.GraphObject.None,
},
new go.Binding('text', 'showVal'),
new go.Binding('font', 'fontStyle'),
new go.Binding('stroke', 'fontStroke'),
new go.Binding('textAlign', 'fontAlign'),
new go.Binding('maxSize', 'textSize'),
new go.Binding('minSize', 'textSize'),
new go.Binding('flip', 'flip'),
),
),
goJS(
go.TextBlock,
textStyle(),
{
wrap: go.TextBlock.WrapFit,
textAlign: 'center',
editable: false,
font: 'normal 10px Helvetica,Arial,sans-serif',
stroke: '#ffffff',
},
new go.Binding('text', 'unitText'),
new go.Binding('font', '', (v) => {
return `normal ${v?.unitSize || 10}pt ${
v?.unitStyle || 'Helvetica,Arial,sans-serif'
}`;
}),
new go.Binding('stroke', 'unitColor'),
new go.Binding('visible', '', (v) => {
return (v?.unitSwitch && !!v?.unitText) || false;
}),
new go.Binding('margin', '', (v) => {
const unitGap = v?.unitGap || '0,0,0,5';
if (unitGap && isNumber(unitGap)) return unitGap;
const margin = unitGap?.split(',') || null;
return margin
? new go.Margin(
margin?.[0] * 1 || 0,
margin?.[1] * 1 || 0,
margin?.[2] * 1 || 0,
margin?.[3] * 1 || 0,
)
: 0;
}),
),
),
{
click(e, node) {
......
......@@ -1856,10 +1856,10 @@ const ConfigurationView = (props) => {
const padding = v ? v.split(',') : null;
return padding
? new go.Margin(
padding[0] * 1 || 0,
padding[1] * 1 || 0,
padding[2] * 1 || 0,
padding[3] * 1 || 0,
padding?.[0] * 1 || 0,
padding?.[1] * 1 || 0,
padding?.[2] * 1 || 0,
padding?.[3] * 1 || 0,
)
: 0;
}).makeTwoWay(),
......@@ -2532,35 +2532,77 @@ const ConfigurationView = (props) => {
new go.Binding('angle').makeTwoWay(),
roleVisibleBinding(), // 绑定角色可见
goJS(
go.Shape,
'RoundedRectanglePlus',
{ name: 'SHAPE', strokeWidth: 10, stroke: '#000000', parameter1: 0 },
new go.Binding('fill', 'fillColor'),
new go.Binding('stroke'),
new go.Binding('strokeWidth'),
new go.Binding('parameter1', 'radius').makeTwoWay(),
new go.Binding('desiredSize', 'size', go.Size.parse).makeTwoWay(go.Size.stringify),
),
goJS(
go.TextBlock,
textStyle(),
{
maxSize: new go.Size(NaN, NaN),
minSize: new go.Size(NaN, 1),
wrap: go.TextBlock.WrapFit,
textAlign: 'center',
editable: true,
font: 'bold 12px Helvetica, Arial, sans-serif',
stroke: '#454545',
flip: go.GraphObject.None,
},
new go.Binding('text', 'showVal'),
new go.Binding('font', 'fontStyle'),
new go.Binding('stroke', 'fontStroke'),
new go.Binding('textAlign', 'fontAlign'),
new go.Binding('maxSize', 'textSize'),
new go.Binding('minSize', 'textSize'),
new go.Binding('flip', 'flip'),
go.Panel,
'Horizontal',
goJS(
go.Panel,
'Auto',
goJS(
go.Shape,
'RoundedRectanglePlus',
{ name: 'SHAPE', strokeWidth: 10, stroke: '#000000', parameter1: 0 },
new go.Binding('fill', 'fillColor'),
new go.Binding('stroke'),
new go.Binding('strokeWidth'),
new go.Binding('parameter1', 'radius').makeTwoWay(),
new go.Binding('desiredSize', 'size', go.Size.parse).makeTwoWay(go.Size.stringify),
),
goJS(
go.TextBlock,
textStyle(),
{
maxSize: new go.Size(NaN, NaN),
minSize: new go.Size(NaN, 1),
wrap: go.TextBlock.WrapFit,
textAlign: 'center',
editable: true,
font: 'bold 12px Helvetica, Arial, sans-serif',
stroke: '#454545',
flip: go.GraphObject.None,
},
new go.Binding('text', 'showVal'),
new go.Binding('font', 'fontStyle'),
new go.Binding('stroke', 'fontStroke'),
new go.Binding('textAlign', 'fontAlign'),
new go.Binding('maxSize', 'textSize'),
new go.Binding('minSize', 'textSize'),
new go.Binding('flip', 'flip'),
),
),
goJS(
go.TextBlock,
textStyle(),
{
wrap: go.TextBlock.WrapFit,
textAlign: 'center',
editable: false,
font: 'normal 10px Helvetica,Arial,sans-serif',
stroke: '#ffffff',
},
new go.Binding('text', 'unitText'),
new go.Binding('font', '', (v) => {
return `normal ${v?.unitSize || 10}pt ${
v?.unitStyle || 'Helvetica,Arial,sans-serif'
}`;
}),
new go.Binding('stroke', 'unitColor'),
new go.Binding('visible', '', (v) => {
return (v?.unitSwitch && !!v?.unitText) || false;
}),
new go.Binding('margin', '', (v) => {
const unitGap = v?.unitGap || '0,0,0,5';
if (unitGap && isNumber(unitGap)) return unitGap;
const margin = unitGap?.split(',') || null;
return margin
? new go.Margin(
margin?.[0] * 1 || 0,
margin?.[1] * 1 || 0,
margin?.[2] * 1 || 0,
margin?.[3] * 1 || 0,
)
: 0;
}),
),
),
{
click(e, node) {
......
......@@ -1862,10 +1862,10 @@ const ConfigurationView = (props) => {
const padding = v ? v.split(',') : null;
return padding
? new go.Margin(
padding[0] * 1 || 0,
padding[1] * 1 || 0,
padding[2] * 1 || 0,
padding[3] * 1 || 0,
padding?.[0] * 1 || 0,
padding?.[1] * 1 || 0,
padding?.[2] * 1 || 0,
padding?.[3] * 1 || 0,
)
: 0;
}).makeTwoWay(),
......@@ -2538,35 +2538,77 @@ const ConfigurationView = (props) => {
new go.Binding('angle').makeTwoWay(),
roleVisibleBinding(), // 绑定角色可见
goJS(
go.Shape,
'RoundedRectanglePlus',
{ name: 'SHAPE', strokeWidth: 10, stroke: '#000000', parameter1: 0 },
new go.Binding('fill', 'fillColor'),
new go.Binding('stroke'),
new go.Binding('strokeWidth'),
new go.Binding('parameter1', 'radius').makeTwoWay(),
new go.Binding('desiredSize', 'size', go.Size.parse).makeTwoWay(go.Size.stringify),
),
goJS(
go.TextBlock,
textStyle(),
{
maxSize: new go.Size(NaN, NaN),
minSize: new go.Size(NaN, 1),
wrap: go.TextBlock.WrapFit,
textAlign: 'center',
editable: true,
font: 'bold 12px Helvetica, Arial, sans-serif',
stroke: '#454545',
flip: go.GraphObject.None,
},
new go.Binding('text', 'showVal'),
new go.Binding('font', 'fontStyle'),
new go.Binding('stroke', 'fontStroke'),
new go.Binding('textAlign', 'fontAlign'),
new go.Binding('maxSize', 'textSize'),
new go.Binding('minSize', 'textSize'),
new go.Binding('flip', 'flip'),
go.Panel,
'Horizontal',
goJS(
go.Panel,
'Auto',
goJS(
go.Shape,
'RoundedRectanglePlus',
{ name: 'SHAPE', strokeWidth: 10, stroke: '#000000', parameter1: 0 },
new go.Binding('fill', 'fillColor'),
new go.Binding('stroke'),
new go.Binding('strokeWidth'),
new go.Binding('parameter1', 'radius').makeTwoWay(),
new go.Binding('desiredSize', 'size', go.Size.parse).makeTwoWay(go.Size.stringify),
),
goJS(
go.TextBlock,
textStyle(),
{
maxSize: new go.Size(NaN, NaN),
minSize: new go.Size(NaN, 1),
wrap: go.TextBlock.WrapFit,
textAlign: 'center',
editable: true,
font: 'bold 12px Helvetica, Arial, sans-serif',
stroke: '#454545',
flip: go.GraphObject.None,
},
new go.Binding('text', 'showVal'),
new go.Binding('font', 'fontStyle'),
new go.Binding('stroke', 'fontStroke'),
new go.Binding('textAlign', 'fontAlign'),
new go.Binding('maxSize', 'textSize'),
new go.Binding('minSize', 'textSize'),
new go.Binding('flip', 'flip'),
),
),
goJS(
go.TextBlock,
textStyle(),
{
wrap: go.TextBlock.WrapFit,
textAlign: 'center',
editable: false,
font: 'normal 10px Helvetica,Arial,sans-serif',
stroke: '#ffffff',
},
new go.Binding('text', 'unitText'),
new go.Binding('font', '', (v) => {
return `normal ${v?.unitSize || 10}pt ${
v?.unitStyle || 'Helvetica,Arial,sans-serif'
}`;
}),
new go.Binding('stroke', 'unitColor'),
new go.Binding('visible', '', (v) => {
return (v?.unitSwitch && !!v?.unitText) || false;
}),
new go.Binding('margin', '', (v) => {
const unitGap = v?.unitGap || '0,0,0,5';
if (unitGap && isNumber(unitGap)) return unitGap;
const margin = unitGap?.split(',') || null;
return margin
? new go.Margin(
margin?.[0] * 1 || 0,
margin?.[1] * 1 || 0,
margin?.[2] * 1 || 0,
margin?.[3] * 1 || 0,
)
: 0;
}),
),
),
{
click(e, node) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment