提交 2c10c6f8 编写于 作者: C Catouse

- delete flowchart files.

上级 3ed3efcb
if ($.zui.FlowChart) {
var textGenerator = function(elementType) {
if (!elementType.newElementsCounter) {
elementType.newElementsCounter = 1;
}
return elementType.name.substring(4) + '_' + (elementType.newElementsCounter++);
};
var renderInOut = function($node, elementType, options) {
var that = this;
if (elementType.hasPorts()) {
that.renderPorts(options);
}
var style = options.style;
var shapeStyle = options.shapeStyle;
$node.css(style);
var size = {
width: $node.outerWidth(),
height: $node.outerHeight(),
};
var $shape = $node.children('.flowchart-shape');
if (!$shape.length) {
$shape = $('<svg class="flowchart-shape" style="position: absolute; top: 0; left: 0; right: 0; bottom: 0"><polygon /></svg>').appendTo($node);
}
var $polygon = $shape.children('polygon');
$polygon.css($.zui.FlowChart.convertCssToSvgStyle(shapeStyle));
var points = [[0, 0], [size.width - 20, 0], [size.width, size.height / 2], [size.width - 20, size.height], [0, size.height]];
var pointsStr = [];
points.forEach(function(point) {
pointsStr.push($.isArray(point) ? point.join(',') : point);
});
$polygon.attr('points', pointsStr.join(' '));
$shape.css(size).show();
};
var createPorts = function(ins, outs) {
if (typeof ins === 'string') {
ins = ins.split(',');
}
ins.unshift('-');
if (typeof outs === 'string') {
outs = outs.split(',');
}
outs.unshift('-');
return {
top: null,
bottom: null,
left: ins.map(function(name) {
if (name === '-') {
return {
name: '',
space: 1
};
}
return {
name: name,
rest: name.indexOf('*') > -1,
restInitialCount: 2,
maxLinkCount: 1,
direction: 'in',
free: false
};
}),
right: outs.map(function(name) {
if (name === '-') {
return {
name: '',
space: 1
};
}
return {
name: name,
rest: name.indexOf('*') > -1,
restInitialCount: 2,
maxLinkCount: 1,
direction: 'out',
free: false
};
})
};
};
var newElementsCounter = {};
var createModelType = function(name, ins, outs) {
return {
displayName: name,
ports: createPorts(ins, outs),
type: 'rectangle',
portLineLength: 8,
style: {borderRadius: 0},
textStyle: {padding: 0, minWidth: 120},
text: textGenerator,
fbdModel: true
};
};
var types = {
FBD_AND: createModelType('', 'I*', 'Q'),
FBD_OR: createModelType('', 'I*', 'Q'),
FBD_NOT: createModelType('', 'I', 'Q'),
FBD_SET: createModelType('设置', 'I1,I2', 'Q'),
FBD_XOR: createModelType('异或', 'I1,I2', 'Q'),
FBD_XNOR: createModelType('同或', 'I1,I2', 'Q'),
FBD_EQ: createModelType('等于', 'I1,I2', 'Q'),
FBD_NE: createModelType('不等于', 'I1,I2', 'Q'),
FBD_GT: createModelType('大于', 'I1,I2', 'Q'),
FBD_GE: createModelType('大于等于', 'I1,I2', 'Q'),
FBD_LT: createModelType('小于', 'I1,I2', 'Q'),
FBD_LE: createModelType('小于等于', 'I1,I2', 'Q'),
FBD_ADD: createModelType('', 'I*', 'Q'),
FBD_SUB: createModelType('', 'I1,I2', 'Q'),
FBD_MUL: createModelType('', 'I*', 'Q'),
FBD_DIV: createModelType('', 'I1,I2', 'Q'),
FBD_MOD: createModelType('求余', 'I1,I2', 'Q'),
FBD_ABS: createModelType('绝对值', 'I', 'Q'),
FBD_EXP: createModelType('平方', 'I', 'Q'),
FBD_EXPT: createModelType('N次方', 'I', 'Q'),
FBD_SQRT: createModelType('根号', 'I1,I2', 'Q'),
FBD_LN: createModelType('自然对数', 'I', 'Q'),
FBD_LOG: createModelType('10对数', 'I', 'Q'),
FBD_MAX: createModelType('最大值', 'I*', 'Q'),
FBD_MIN: createModelType('最小值', 'I*', 'Q'),
FBD_LIMIN: createModelType('限制', 'MI,IN,MX', 'Q'),
FBD_SEL: createModelType('选择', 'G,IN0,IN1', 'Q'),
FBD_TON: createModelType('上升沿延时', 'IN,PT', 'Q,ET'),
FBD_TOF: createModelType('下降沿延时', 'IN,PT', 'Q,ET'),
FBD_TP: createModelType('脉冲', 'IN,PT', 'Q,ET'),
FBD_RS: createModelType('锁存器RS', 'SET,RESET', 'Q'),
FBD_SR: createModelType('锁存器SR', 'SET,RESET', 'Q'),
FBD_RTRIG: createModelType('上升沿', 'CLK', 'Q'),
FBD_FTRIG: createModelType('下降沿', 'CLK', 'Q'),
FBD_CTU: createModelType('上升沿计数', 'CU,RESET,PV', 'Q,CV'),
FBD_CTD: createModelType('下降沿计数', 'CU,RESET,PV', 'Q,CV'),
FBD_CTUD: createModelType('递增递减计数器', 'CU,CD,RESET,LOAD,PV', 'QU,QD,CV'),
FBD_INPUT: {
displayName: '输入模块',
ports: {
left: null,
top: null,
bottom: null,
right: [{
name: 'in',
maxLinkCount: 1,
direction: 'in',
}]
},
style: {borderRadius: 0, borderWidth: 0},
textStyle: {padding: '5px 20px 5px 9px', minHeight: '30px', minWidth: 100},
shapeStyle: {fill: '#fff', strokeWidth: 1, stroke: '#333'},
type: 'rectangle',
portLineLength: 10,
render: renderInOut,
text: function(elementType) {
if (!newElementsCounter[elementType.name]) {
newElementsCounter[elementType.name] = 1;
}
return elementType.displayName.toUpperCase() + (newElementsCounter[elementType.name]++);
},
},
FBD_OUTPUT: {
displayName: '输出模块',
ports: {
right: null,
top: null,
bottom: null,
left: [{
name: 'out',
maxLinkCount: 1,
direction: 'out',
}]
},
style: {borderRadius: 0, borderWidth: 0},
textStyle: {padding: '5px 20px 5px 9px', minHeight: '30px', minWidth: 100},
shapeStyle: {fill: '#fff', strokeWidth: 1, stroke: '#333'},
type: 'rectangle',
portLineLength: 10,
render: renderInOut,
text: function(elementType) {
if (!newElementsCounter[elementType.name]) {
newElementsCounter[elementType.name] = 1;
}
return elementType.displayName.toUpperCase() + (newElementsCounter[elementType.name]++);
},
}
};
var defaultOptions = {
elementTypes: types
};
$.zui.FlowChart.addPlugin('fbd', {
defaultOptions: defaultOptions,
onRenderNode: function($node, node) {
if (node.elementType.fbdModel) {
$node.attr('data-model-name', node.elementType.displayName).addClass('flowchart-fbd-model');
}
},
style: [
'#{id} .flowchart-contextmenu {min-width: 360px}',
'#{id} .flowchart-contextmenu .col-xs-4 {width: 25%}',
'#{id} .flowchart-fbd-model {align-items: flex-start!important;}',
'#{id} .flowchart-fbd-model:before {content: attr(data-model-name); position: absolute; left: 0; right: 0; top: 0; text-align: center}',
'#{id} .flowchart-fbd-model.flowchart-active.flowchart-element-focused {box-shadow: none!important}',
'#{id} .flowchart-fbd-model.flowchart-element-focused .flowchart-text {box-shadow: 0 0 0 2px {activeColor}!important; min-height: 20px!important}',
'#{id} .flowchart-fbd-model .flowchart-text {top: -20px}',
'#{id} .flowchart-fbd-model .flowchart-port-left:before {content: attr(data-name); position: absolute; display: block; left: 100%; padding-left: 5px}',
'#{id} .flowchart-fbd-model .flowchart-port-right:before {content: attr(data-name); position: absolute; display: block; right: 100%; padding-right: 5px}',
'#{id} .flowchart-fbd-model .flowchart-port-rest-holder.flowchart-port-left:before, #{id} .flowchart-fbd-model .flowchart-port-rest-holder.flowchart-port-right:before {opacity: .5; content: "+"; font-size: 18px; font-weight: bold; line-height: 20px; font-family: monospace;}',
'#{id} .flowchart-fbd-model .flowchart-port-rest-holder:hover {color: {activeColor}; cursor: pointer}',
'#{id} .flowchart-fbd-model .flowchart-port-rest-holder.flowchart-port-left:hover:before, #{id} .flowchart-fbd-model .flowchart-port-rest-holder.flowchart-port-right:hover:before {opacity: 1}',
'#{id} .flowchart-fbd-model .flowchart-port-rest-holder.flowchart-port-left {width: 0!important; left: 0!important}',
'#{id} .flowchart-fbd-model .flowchart-port-rest-holder.flowchart-port-right {width: 0!important; right: 0!important}',
'#{id} .flowchart-fbd-model .flowchart-port-rest-holder .flowchart-port-line, #{id} .flowchart-fbd-model .flowchart-port-rest-holder .flowchart-port-dot {display: none}'
].join('\n')
});
}
if ($.zui.FlowChart) {
var textGenerator = function(elementType) {
if (!elementType.newElementsCounter) {
elementType.newElementsCounter = 1;
}
return elementType.name.substring(4) + '_' + (elementType.newElementsCounter++);
};
var types = {
FSM_InitState: {
beginType: true,
width: 32,
height: 32,
type: 'dot',
displayName: 'FSM初始状态',
text: textGenerator,
portLineLength: 1,
shapeStyle: {background: '#888'},
},
FSM_EndState: {
endType: true,
width: 32,
height: 32,
type: 'dot',
shapeStyle: {background: '#888', boxShadow: 'inset 0 0 0 2px #fff'},
text: textGenerator,
portLineLength: 1,
displayName: 'FSM结束状态',
},
FSM_State: {
type: 'box',
portLineLength: 1,
text: textGenerator,
displayName: 'FSM简单状态'
},
FSM_VirState: {
type: 'box',
portLineLength: 1,
shapeStyle: {borderStyle: 'dashed'},
text: textGenerator,
displayName: 'FSM虚拟状态',
},
// FSM_ConStates: {
// type: 'box',
// portLineLength: 1,
// shapeStyle: {borderStyle: 'dotted'},
// text: textGenerator,
// displayName: 'FSM并发组合状态',
// },
// FSM_SerStates: {
// type: 'box',
// portLineLength: 1,
// shapeStyle: {borderStyle: 'dotted'},
// text: textGenerator,
// displayName: 'FSM顺序组合状态',
// },
FSM_Action: {
type: 'relation',
lineStyle: 'solid',
lineShape: 'bessel',
text: textGenerator,
displayName: 'FSM动作转换1'
},
FSM_Action1: {
type: 'relation',
lineStyle: 'solid',
lineShape: 'arc',
lineColor: '#1797cd',
text: textGenerator,
displayName: 'FSM动作转换2'
},
FSM_VirAction: {
type: 'relation',
lineStyle: 'dashed',
lineShape: 'bessel',
text: textGenerator,
displayName: 'FSM虚拟转换',
},
FSM_SelectState: {
type: 'diamond',
portLineLength: 1,
text: textGenerator,
displayName: 'FSM选择状态',
},
FSM_ActState: {
type: 'box',
portLineLength: 1,
shapeStyle: {paddingLeft: 30},
text: textGenerator,
displayName: 'FSM实际状态',
},
FSM_ActionBran: {
type: 'rectangle',
portLineLength: 6,
displayName: 'FSM分叉',
text: textGenerator,
ports: {
top: null,
left: [{
name: 'in',
free: false,
space: 1.5,
maxLinkCount: 1
}],
bottom: null,
right: [{
name: 'out1',
free: false,
space: 1.5,
maxLinkCount: 1
}, {
name: 'out2',
free: false,
space: 1.5,
maxLinkCount: 1
}]
},
style: {width: 20},
textStyle: {padding: 0, top: '100%', position: 'absolute'},
render: function($node, elementType, options) {
var that = this;
var flowChart = that.flowChart;
if (elementType.hasPorts()) {
that.renderPorts(options);
}
var style = $.extend(options.style, options.shapeStyle);
$node.css(style);
var size = {
width: $node.outerWidth(),
height: $node.outerHeight(),
};
var $shape = $node.children('.flowchart-shape');
if (!$shape.length) {
$shape = $('<svg class="flowchart-shape" style="position: absolute; top: 0; left: 0; right: 0; bottom: 0"><line class="line-1" /><line class="line-2" /></svg>').appendTo($node);
}
var svgStyle = $.zui.FlowChart.convertCssToSvgStyle(style);
var markerEnd = 'url(#' + flowChart.initArrowMarker(8, svgStyle.stroke) + ')';
var strokeWidth = svgStyle['stroke-width'];
$shape.attr(size).children('.line-1').attr({
class: 'line-1',
x1: 0,
y1: (size.height - strokeWidth) / 2,
x2: size.width,
y2: (size.height / 2 - strokeWidth) / 2,
stroke: svgStyle.stroke,
'stroke-width': strokeWidth,
'marker-end': markerEnd
});
$shape.children('.line-2').attr({
class: 'line-2',
x1: 0,
y1: (size.height - strokeWidth) / 2,
x2: size.width,
y2: size.height / 2 + (size.height / 2 - strokeWidth) / 2,
stroke: svgStyle.stroke,
'stroke-width': strokeWidth,
'marker-end': markerEnd
});
}
},
FSM_ActionComb: {
type: 'rectangle',
portLineLength: 6,
displayName: 'FSM合并',
text: textGenerator,
ports: {
top: null,
left: [{
name: 'in1',
free: false,
maxLinkCount: 1,
direction: 'in',
space: 1.5,
}, {
name: 'in2',
free: false,
maxLinkCount: 1,
direction: 'in',
space: 1.5,
}],
bottom: null,
right: [{
name: 'out',
free: false,
maxLinkCount: 1,
direction: 'out',
space: 1.5,
}]
},
style: {width: 20},
textStyle: {padding: 0, top: '100%', position: 'absolute'},
render: function($node, elementType, options) {
var that = this;
var flowChart = that.flowChart;
if (elementType.hasPorts()) {
that.renderPorts(options);
}
var style = $.extend(options.style, options.shapeStyle);
$node.css(style);
var size = {
width: $node.outerWidth(),
height: $node.outerHeight(),
};
var $shape = $node.children('.flowchart-shape');
if (!$shape.length) {
$shape = $('<svg class="flowchart-shape" style="position: absolute; top: 0; left: 0; right: 0; bottom: 0"><line class="line-1" /><line class="line-2" /></svg>').appendTo($node);
}
var svgStyle = $.zui.FlowChart.convertCssToSvgStyle(style);
var markerEnd = 'url(#' + flowChart.initArrowMarker(8, svgStyle.stroke) + ')';
var strokeWidth = svgStyle['stroke-width'];
$shape.attr(size).children('.line-1').attr({
class: 'line-1',
x1: 0,
y1: (size.height / 2 - strokeWidth) / 2,
x2: size.width,
y2: (size.height - strokeWidth) / 2,
stroke: svgStyle.stroke,
'stroke-width': strokeWidth,
'marker-end': markerEnd
});
$shape.children('.line-2').attr({
class: 'line-2',
x1: 0,
y1: size.height / 2 + (size.height / 2 - strokeWidth) / 2,
x2: size.width,
y2: (size.height - strokeWidth) / 2,
stroke: svgStyle.stroke,
'stroke-width': strokeWidth,
'marker-end': markerEnd
});
}
}
};
var defaultOptions = {
elementTypes: types,
defaultRelationType: 'FSM_Action',
defaultActionType: 'FSM_State',
quickAddActionType: 'FSM_State'
};
$.zui.FlowChart.addPlugin('fsm', {
defaultOptions: defaultOptions,
style: [
'.flowchart-contextmenu .col-xs-4 {width: 25%}',
'#{id} .flowchart-element-fsm_fork, #{id} .flowchart-element-fsm_merge {align-items: flex-start!important;}',
'#{id} .flowchart-element-FSM_ActState:before {content: " "; position: absolute; width: 30px; height: 30px; top: 4px; left: 4px; background: #888; border-radius: 50%; border: 1px solid #333}'
].join('\n')
});
}
此差异已折叠。
if ($.zui.FlowChart) {
var indexSeed = 1;
$.zui.FlowChartElement.prototype.getVariables = function() {
var vars = this.getData('vars');
if (!vars) {
return [];
}
var varsList = [];
$.each(vars, function(name, variable) {
varsList.push($.extend({name: name}, variable));
});
varsList.sort(function(var1, var2) {
return var1.index - var2.index;
});
return varsList;
};
$.zui.FlowChartElement.prototype.getVariable = function(varName) {
var vars = this.getData('vars');
if (!vars) {
return null;
}
var varData = vars[varName];
return varData ? $.extend({name: varName}, varData) : null;
};
$.zui.FlowChartElement.prototype.setVariable = function(varName, varData) {
var vars = this.getData('vars');
if (!vars) {
vars = {};
}
var newVars = {};
if (typeof varName === 'object') {
$.each(varName, function(name, value) {
newVars[name] = varData ? $.extend({index: indexSeed++}, value) : {value: value, index: indexSeed++};
});
} else {
newVars[varName] = {value: varData, index: indexSeed++};
}
if (this.flowChart.callCallback('beforeSetVariable', [newVars, this]) === false) {
return;
}
this.setData('vars', $.extend(true, vars, newVars));
this.flowChart.callCallback('afterSetVariable', [newVars, this]);
};
$.zui.FlowChartElement.prototype.setVariableObject = function(varName, varObject) {
if (typeof varObject !== 'object') {
throw new Error('FlowChart: The param "varObject" must be an object like "{value: 123}".');
}
var varData = {};
varData[varName] = varObject;
this.setVariable(varData, true);
};
$.zui.FlowChartElement.prototype.removeVariable = function(varName) {
var vars = this.getData('vars');
if (vars) {
delete vars[varName];
}
};
$.zui.FlowChart.prototype.checkTypeCanAddVariable = function(typeName, varName, varData) {
if (this.typesCanAddVariablesFunc) {
return this.typesCanAddVariablesFunc(typeName, varName, varData);
} else if (this.typesCanAddVariablesMap) {
return this.typesCanAddVariablesMap[typeName.toLowerCase()];
}
return false;
};
$.zui.FlowChart.addPlugin('var', {
defaultOptions: {
addVariablesFromDrop: true,
typesCanAddVariables: function(type) {
var typeLowerCase = type.toLowerCase();
return typeLowerCase.indexOf('fsm_') === 0 || typeLowerCase.indexOf('fbd_') === 0;
},
onDrop: function(e) {
var that = this;
var newVarData = e.originalEvent.dataTransfer.getData('newVar');
if (newVarData) {
e.preventDefault();
var $target = $(e.target).closest('.flowchart-element');
if ($target.length) {
var element = that.getElement($target.data('id'));
if (element) {
try {
newVarData = $.parseJSON(newVarData);
} catch (e) {
console.error('FlowChart: Cannot get correct "newVarData" data from drop event\'s dataTransfer.', newVarData);
}
if (newVarData && typeof newVarData === 'object' && newVarData.var) {
var varName = newVarData.var;
delete newVarData.var;
if (that.checkTypeCanAddVariable(element.type, varName, newVarData)) {
element.setVariableObject(varName, newVarData);
} else {
console.warn('FlowChart: Cannot add variable to the target element.', element);
}
} else {
console.warn('FlowChart: Data format error in "newVarData" data from drop event\'s dataTransfer.', newVarData);
}
} else {
console.warn('FlowChart: Cannot add variable to the target element not in flowchart.', element);
}
}
return false;
}
}
},
style: [
'#{id}.flowchart-drag-var-start.flowchart-drag-over .flowchart-can-add-var.flowchart-node {box-shadow: 0 0 4px 1px {activeColor}!important}'
].join('\n'),
onRenderNode: function($node, node) {
$node.toggleClass('flowchart-can-add-var', !!this.checkTypeCanAddVariable(node.type));
},
onRenderRelation: function($relation, relation) {
$relation.toggleClass('flowchart-can-add-var', !!this.checkTypeCanAddVariable(relation.type));
},
onCreate: function() {
var that = this;
var options = that.options;
var typesCanAddVariables = options.typesCanAddVariables;
if (typeof typesCanAddVariables === 'string') {
typesCanAddVariables = typesCanAddVariables.split(',');
}
if ($.isArray(typesCanAddVariables)) {
var typesCanAddVariablesMap = {};
typesCanAddVariables.forEach(function(type) {
typesCanAddVariablesMap[$.trim(type).toLowerCase()] = 1;
});
that.typesCanAddVariablesMap = typesCanAddVariablesMap;
} else if (typeof typesCanAddVariables === 'function') {
that.typesCanAddVariablesFunc = typesCanAddVariables;
}
if (options.addVariablesFromDrop) {
if (typeof options.addVariablesFromDrop === 'string') {
var $dragElements = $(options.addVariablesFromDrop);
var handDragStart = function(e) {
var elementData = $(e.target).data();
if (elementData.var) {
e.originalEvent.dataTransfer.setData('newVar', JSON.stringify(elementData));
that.$container.addClass('flowchart-drag-var-start');
}
};
var handleDragEnd = function(e) {
that.$container.removeClass('flowchart-drag-var-start').removeClass('flowchart-drag-over');
};
if ($dragElements.is('[draggable="true"]')) {
$dragElements.on('dragstart', handDragStart).on('dragend', handleDragEnd);
} else {
$dragElements.on('dragstart', '[draggable="true"]', handDragStart).on('dragend', '[draggable="true"]', handleDragEnd);
}
}
}
}
});
}
此差异已折叠。
此差异已折叠。
......@@ -1323,17 +1323,6 @@
"ver": "1.4.0",
"require": ["icons"]
},
"flowchart": {
"name": "流程图",
"src": {
"js": ["~/flowchart.js"]
},
"ver": "1.9.2",
"dpds": ["array"],
"hidden": true,
"babel": true,
"ignoreDpds": false
},
"clipboard": {
"name": "clipboard",
"src": {
......@@ -1539,7 +1528,7 @@
},
"seperate": {
"title": "Seperate bundles",
"bundles": ["jquery", "calendar", "kindeditor", "datetimepicker", "chosen", "chosenicons", "imgcutter", "datatable", "datagrid", "ieonly", "chart", "array", "hotkey", "board", "tabs", "migrate1.2", "clipboard", "prettify", "sortable", "selectable", "colorpicker", "colorset.js", "imgready", "dashboard", "bootbox", "ueditor", "uploader", "treemap", "ajaxFake", "markdoc", "contextmenu", "flowchart"]
"bundles": ["jquery", "calendar", "kindeditor", "datetimepicker", "chosen", "chosenicons", "imgcutter", "datatable", "datagrid", "ieonly", "chart", "array", "hotkey", "board", "tabs", "migrate1.2", "clipboard", "prettify", "sortable", "selectable", "colorpicker", "colorset.js", "imgready", "dashboard", "bootbox", "ueditor", "uploader", "treemap", "ajaxFake", "markdoc", "contextmenu"]
},
"dist": {
"title": "Dist bundles",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册