Commit 6739b4833a4fb6022d4a53076f27af423939072a

Authored by ww
1 parent 78a4c22f

feat: add control component panel

... ... @@ -316,7 +316,7 @@ mxscript(drawDevUrl + 'js/diagramly/sidebar/thingskit/Sidebar-Engine.js');
316 316 // 基础元件
317 317 mxscript(drawDevUrl + 'js/diagramly/sidebar/thingskit/Sidebar-Basic-Components.js');
318 318 // 控制元件
319   -mxscript(drawDevUrl + 'js/diagramly/sidebar/thingskit/Sidebar-Controller-Components.js');
  319 +mxscript(drawDevUrl + 'js/diagramly/sidebar/thingskit/Sidebar-Control-Components.js');
320 320 // 阀门
321 321 mxscript(drawDevUrl + 'js/diagramly/sidebar/thingskit/Sidebar-Valve.js');
322 322 // 风机
... ...
... ... @@ -26,7 +26,7 @@
26 26 *
27 27 */
28 28 // Sidebar.prototype.defaultEntries = 'component;fan;engine;valve;controller;light;button;conduit;instrument;sewage;air;filters;pumps;factoryFacilities;flowMeter;foodProcessing;heater;industrial;plant;power;processCooling;processHeating;sink;';
29   - Sidebar.prototype.defaultEntries = 'component;fan;engine;valve;controller;light;button;conduit;instrument;sewage;factoryFacilities;flowMeter;industrial;sink;';
  29 + Sidebar.prototype.defaultEntries = 'component;fan;engine;valve;control;light;button;conduit;instrument;sewage;factoryFacilities;flowMeter;industrial;sink;';
30 30
31 31 /**
32 32 * Library definitions
... ... @@ -284,9 +284,10 @@
284 284 Sidebar.prototype.configuration = [
285 285 { id: 'general', libs: ['general', 'misc', 'advanced'] },
286 286 //加入自定义图形ID
287   - { id: 'fan' }, { id: 'engine' }, { id: 'valve' }, { id: 'component' }, { id: 'controller' }, { id: 'sewage' }, { id: 'conduit' }, { id: 'light' }, { id: 'instrument' }, { id: 'button' },
  287 + { id: 'fan' }, { id: 'engine' }, { id: 'valve' }, { id: 'component' }, { id: 'control' }, { id: 'sewage' }, { id: 'conduit' }, { id: 'light' }, { id: 'instrument' }, { id: 'button' },
288 288 { id: 'air' }, { id: 'filters' }, { id: 'pumps' }, { id: 'factoryFacilities' }, { id: 'flowMeter' }, { id: 'foodProcessing' }, { id: 'heater' }, { id: 'industrial' }, { id: 'plant' }, { id: 'power' }, { id: 'processCooling' }, { id: 'processHeating' }, { id: 'sink' },
289 289
  290 +
290 291 { id: 'uml' }, { id: 'uml25' }, { id: 'search' }, { id: 'er' },
291 292 { id: 'azure2', prefix: 'azure2', libs: ['AI Machine Learning', 'Analytics', 'App Services', 'Azure Stack', 'Azure VMware Solution', 'Blockchain', 'Compute', 'Containers', 'CXP', 'Databases', 'DevOps', 'General', 'Identity', 'Integration', 'Internet of Things', 'Intune', 'IoT', 'Management Governance', 'Migrate', 'Mixed Reality', 'Monitor', 'Networking', 'Other', 'Preview', 'Security', 'Storage', 'Web'] },
292 293 { id: 'ios', prefix: 'ios', libs: [''/*prefix is library*/, '7icons', '7ui'] },
... ... @@ -1171,8 +1172,8 @@
1171 1172 // thingskit components
1172 1173 // 基础原件
1173 1174 this.addBasicComponentsPalette();
1174   - // 控制原价
1175   - // this.addControllerComponentsPalette();
  1175 + // 控制元件
  1176 + this.addControlComponentsPalette();
1176 1177 // 发动机
1177 1178 this.addEnginePalette();
1178 1179 // 阀门
... ...
  1 +
  2 +(function () {
  3 + // Adds Atlassian shapes
  4 + // Control Component 控制元件
  5 + Sidebar.prototype.addControlComponentsPalette = function () {
  6 + const { COMPONENT_TYPE } = this.enumCellBasicAttribute
  7 + const { DEFAULT } = this.enumComponentType
  8 + const gn = 'mxgraph.control';
  9 + const dt = 'control';
  10 + const label = '控制元件'
  11 + const width = 66;
  12 + const height = 74;
  13 + const staticPath = '/thingskit-drawio/img/lib/thingskit/'
  14 + const prefix = 'image;image=img/lib/thingskit/'
  15 + const defaultStyle = ';imageAspect=0;'
  16 + this.setCurrentSearchEntryLibrary(dt);
  17 +
  18 + // 自定义属性
  19 + const cellAttribute = {
  20 + [COMPONENT_TYPE]: DEFAULT
  21 + }
  22 +
  23 + const graphPathLib = [
  24 + { name: '风机1.png', path: 'fan/风机1.png' },
  25 + { name: '风机2.png', path: 'fan/风机2.png' },
  26 + { name: '风机3.png', path: 'fan/风机3.png' },
  27 + { name: '风机4.png', path: 'fan/风机4.png' },
  28 + { name: '风机5.gif', path: 'fan/风机5.gif' },
  29 + { name: '风机6.gif', path: 'fan/风机6.gif' },
  30 + { name: '风机7.gif', path: 'fan/风机7.gif' },
  31 + { name: '风机8.png', path: 'fan/风机8.png' },
  32 + ]
  33 +
  34 + const lib = graphPathLib.map(item => {
  35 + item.staticPath = staticPath + item.path
  36 + return item
  37 + })
  38 +
  39 + const fns = graphPathLib.map(item => {
  40 + return this.addEntry(this.getTagsForStencil(gn, item.name, dt).join(' '), mxUtils.bind(this, function () {
  41 + const cell = new mxCell('', new mxGeometry(0, 0, width, height), `${prefix}${item.path}${defaultStyle}`);
  42 + cell.setVertex(true)
  43 + this.setCellAttributes(cell, cellAttribute)
  44 + return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, item.name);
  45 + }));
  46 + })
  47 +
  48 + this.setVariableImageLib(dt, label, lib)
  49 +
  50 + this.addPaletteFunctions(dt, label, false, fns);
  51 +
  52 + this.setCurrentSearchEntryLibrary();
  53 + };
  54 +})();
... ...
1   -(function()
2   -{
3   - // Adds Atlassian shapes
4   - // 控制元件
5   - Sidebar.prototype.addControllerComponentsPalette = function()
6   - {
7   - this.setCurrentSearchEntryLibrary('controller');
8   -
9   - var fns = [
10   - this.createVertexTemplateEntry('text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;', 100, 40, 'Title', 'Title', null, null, 'text heading title'),
11   - this.createEdgeTemplateEntry('shape=filledEdge;rounded=1;fixDash=1;endArrow=none;strokeWidth=10;fillColor=#BAFDFF;edgeStyle=orthogonalEdgeStyle;flowAnimation=1;strokeColor=#6666FF;endFill=1;metaEdit=0;backgroundOutline=0;', 60, 40, '', '线条')
12   - ];
13   -
14   - this.addPaletteFunctions('controller', '控制元件', false, fns);
15   - this.setCurrentSearchEntryLibrary();
16   - };
17   -})();