Commit f1f34de64402376f95d3478c582df428186aa139

Authored by xp.Huang
2 parents cc5bbe36 2618f8ee

Merge branch 'ww' into 'main'

feat: implement variable image

See merge request huang/thingskit-drawio!22

7.17 KB | W: | H:

36.2 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
... ... @@ -126,4 +126,12 @@ class ConfigurationNodeApi {
126 126 return defHttp.get(`/plugins/telemetry/DEVICE/${deviceId}/values/attributes?keys=active`)
127 127 }
128 128
  129 + /**
  130 + * @description 上传图片
  131 + * @param data
  132 + * @returns {*}
  133 + */
  134 + static uploadImg(data){
  135 + return defHttp.post('/yt/oss/upload', data)
  136 + }
129 137 }
... ...
1   -(function()
2   -{
  1 +(function () {
3 2 /**
4 3 * Download from following URL as TSV and convert using https://jgraph.github.io/drawio-tools/tools/convert.html:
5 4 * https://docs.google.com/spreadsheets/d/1sAL1zn-UtmJtKPH4cLApGjRX-TRSJa5dYdfZ9NKYfRs
... ... @@ -12,24 +11,24 @@
12 11 * copy the output of searchFileData from the browser console to the variable below.
13 12 */
14 13 Sidebar.prototype.searchIndexData = '7Z1rU+M40Kh/zVbN+wEq98vHkHDbJUxeHGDrfFEpjkh0cKwc2R6G/fVHchKGKMwuRo7Usr21xQyBzUaPW62+qfuP9tkf3bM/Go0ofg2I+POP5kB+t8Rr8kdztPq54Hi9PMWcs5fodCD/QCP2Ev7RPFvGq0D8Sl389QfhMfVxcINnJJiwiMaUiV8ZzVgcs9W7XxgEdCF/ELO1eDWKOXsmj3QeL8VrjbdXhixgXLzyR6NZS/8RP5EfrTEUX182H7Jb23y73Hzb726+pfO3NWw+89t/F9DZBz/qjuRPsxK4IU+xdQK7JS/3gZghcEcXy5IjuF9bX7+lTXBGwjjdAyglYR2DIgZGMaQboeIgdgNMCL2mGQhDHAQsicXhmMwCAoRF245+2LH43wTPgZCwtDV2JMDsjo4iET1DHJbkB2chEAj9zh6EjiGzYUi5nwSYQ6GwvyU6fTMU/kxW6xO6FQVUt49hXxj6VjA0yoohtSJxO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zClB13CBYMCtn9J96gxXABk78Z3eErw9O+CQ+R6WvBUDzSXzOnL5K9137zm+Kz5XKSnC3WDf4nLm7r9ygtp5I3+BzpQlgF1zINMXnSgNA9eiwfvLeh0RAQncMOzp20H7C6IEsqexe4tSdOAWilfjfDxKcDjinP2Q7/ItA1rRFjvA7mHvyFQ9ErF8LHHtB5zhyJVOu3oL7it2SA7Hbc1d45XDS5sFL7PGlI8h2MmUb2aMjvPKoa86Bl+fMlgTCiyXVlsyIrNqSmXg9EnfsCqW1knG74gwvFnjhTL2dYoYZN1zP3KlxUkXrK16SJis+Ixx5S3cGuO/r+6+1idNjRnASvyIPB+6kUjvWoTH2jAbhXNoWAg91S+aUM9O4SpNNue7Ep8OuTC9XujN8bZSLJrJoSV29JvGlWgc9XAzHaLh053aTWh78pcmHesgSzknov6Lzn/4Sh+4YaIqsGbdnh0kkFuBKJFa10b6STdbCNWIvYRRjyl0lZlzARpyGz2nMnyXi0KSumGk7X8neqTnaJkumLHHm6GxYPjrPA/JDXmt1hFdHNc2M+wLnkfjUDhFTL1J/paIjH2BIngWuUFNOAfP78o3avTOOpmKamd+aCWeOsOopVxSMB7LPf1JnQthKAMO4RXYlzFc/cQVXu2f7iLxiMXEl1qOW+tiBha7DJ8ZXTl1wUZquGz8hr1crKl6ukGVA9kvK3LmNYTvl+x5awxFobdvVUXIIhzPx624Od/U0aUVxml+SIR9HK437X7njrUVtnEQkWblCK4eeFlq0bhmaYC4Di64Qs51V2uJy5qTs5jAGJxdgrpyS1k2LiSSDvj8J8198QmeLyixsTYfOyTzam+vBEpIlPpwjuLq2I2OytMeZZKUiW8ZtMM+p1K7tOzZTKryiGI2xv6TOtKDsWY8nbrFNEu4vceQKN+t7c5qEoTNxWOsJkfu1W2Uqii7Tk6726P8D';
15   -
  14 +
16 15 /**
17 16 * Overrides gear image URL.
18 17 */
19 18 Sidebar.prototype.gearImage = GRAPH_IMAGE_PATH + '/clipart/Gear_128x128.png';
20   -
  19 +
21 20 /**
22 21 * Aliases for IDs in the libs parameter.
23 22 */
24   - Sidebar.prototype.libAliases = {'aws2': 'aws3', 'gcp' : 'gcp2'};
25   -
  23 + Sidebar.prototype.libAliases = { 'aws2': 'aws3', 'gcp': 'gcp2' };
  24 +
26 25 /**
27   - *
  26 + *
28 27 */
29 28 Sidebar.prototype.defaultEntries = 'component;fan;engine;valve;controller;light;button;conduit;instrument;sewage';
30   -
  29 +
31 30 /**
32   - * Library definitions
  31 + * Library definitions
33 32 */
34 33 Sidebar.prototype.signs = ['Animals', 'Food', 'Healthcare', 'Nature', 'People', 'Safety', 'Science', 'Sports', 'Tech', 'Transportation', 'Travel'];
35 34
... ... @@ -38,48 +37,48 @@
38 37 Sidebar.prototype.allied_telesis = ['Buildings', 'Computer and Terminals', 'Media Converters', 'Security', 'Storage', 'Switch', 'Wireless'];
39 38
40 39 Sidebar.prototype.gcp = ['Cards', 'Big Data', 'Compute', 'Developer Tools', 'Extras', 'Identity and Security', 'Machine Learning', 'Management Tools', 'Networking', 'Storage Databases'];
41   -
  40 +
42 41 Sidebar.prototype.gcp2 = ['Paths', 'Zones', 'Service Cards', 'Compute', 'API Management', 'Security', 'Data Analytics', 'Data Transfer', 'Cloud AI', 'Internet of Things', 'Databases', 'Storage', 'Management Tools', 'Networking', 'Developer Tools', 'Expanded Product Cards', 'User Device Cards', 'Product Cards', 'General Icons', 'Icons AI Machine Learning', 'Icons Compute', 'Icons Data Analytics', 'Icons Management Tools', 'Icons Networking', 'Icons Developer Tools', 'Icons API Management', 'Icons Internet of Things', 'Icons Databases', 'Icons Storage', 'Icons Security', 'Icons Migration', 'Icons Hybrid and Multi Cloud'];
43   -
  42 +
44 43 Sidebar.prototype.gcpicons = ['AI and Machine Learning', 'API Management', 'Compute', 'Data Analytics', 'Databases', 'Developer Tools', 'Expanded Product Card Icons', 'Generic', 'Hybrid and Multi Cloud', 'Security', 'Internet of Things', 'Management Tools', 'Migration', 'Networking', 'Open Source Icons', 'Storage'];
45   -
46   - Sidebar.prototype.rack = ['General', 'APC', 'Cisco', 'Dell', 'F5', 'HP', 'HPE Aruba Gateways Controllers', 'HPE Aruba Security', 'HPE Aruba Switches', 'IBM', 'Oracle'];
47   -
48   - Sidebar.prototype.pids = ['Agitators', 'Apparatus Elements', 'Centrifuges', 'Compressors', 'Compressors ISO', 'Crushers Grinding',
49   - 'Driers', 'Engines', 'Feeders', 'Filters', 'Fittings', 'Flow Sensors', 'Heat Exchangers', 'Instruments', 'Misc',
50   - 'Mixers', 'Piping', 'Pumps', 'Pumps DIN', 'Pumps ISO', 'Separators', 'Shaping Machines', 'Valves', 'Vessels'];
  44 +
  45 + Sidebar.prototype.rack = ['General', 'APC', 'Cisco', 'Dell', 'F5', 'HP', 'HPE Aruba Gateways Controllers', 'HPE Aruba Security', 'HPE Aruba Switches', 'IBM', 'Oracle'];
  46 +
  47 + Sidebar.prototype.pids = ['Agitators', 'Apparatus Elements', 'Centrifuges', 'Compressors', 'Compressors ISO', 'Crushers Grinding',
  48 + 'Driers', 'Engines', 'Feeders', 'Filters', 'Fittings', 'Flow Sensors', 'Heat Exchangers', 'Instruments', 'Misc',
  49 + 'Mixers', 'Piping', 'Pumps', 'Pumps DIN', 'Pumps ISO', 'Separators', 'Shaping Machines', 'Valves', 'Vessels'];
51 50
52 51 Sidebar.prototype.cisco = ['Buildings', 'Computers and Peripherals', 'Controllers and Modules', 'Directors', 'Hubs and Gateways', 'Misc',
53   - 'Modems and Phones', 'People', 'Routers', 'Security', 'Servers', 'Storage', 'Switches', 'Wireless'];
54   -
  52 + 'Modems and Phones', 'People', 'Routers', 'Security', 'Servers', 'Storage', 'Switches', 'Wireless'];
  53 +
55 54 Sidebar.prototype.cisco19 = ['LAN Switching', 'Routing WAN', 'Network Management', 'Data Center', 'Wireless LAN', 'Collaboration', 'Security Clouds Connectors', 'Endpoint Client Device Icons', 'DNA SD Access', 'SD WAN Viptela', 'ETA Stealthwatch', 'SAFE'];
56 55
57 56 Sidebar.prototype.cisco_safe = ['Architecture', 'Business Icons', 'Capability', 'Design', 'IoT Things Icons', 'People Places Things Icons', 'Security Icons', 'Technology Icons', 'Threat'];
58   -
59   - Sidebar.prototype.sysml = ['Model Elements', 'Blocks', 'Ports and Flows', 'Constraint Blocks', 'Activities', 'Interactions', 'State Machines',
60   - 'Use Cases', 'Allocations', 'Requirements', 'Profiles', 'Stereotypes'];
61 57
62   - Sidebar.prototype.eip = ['Message Construction', 'Message Routing', 'Message Transformation', 'Messaging Channels', 'Messaging Endpoints',
63   - 'Messaging Systems', 'System Management'];
  58 + Sidebar.prototype.sysml = ['Model Elements', 'Blocks', 'Ports and Flows', 'Constraint Blocks', 'Activities', 'Interactions', 'State Machines',
  59 + 'Use Cases', 'Allocations', 'Requirements', 'Profiles', 'Stereotypes'];
  60 +
  61 + Sidebar.prototype.eip = ['Message Construction', 'Message Routing', 'Message Transformation', 'Messaging Channels', 'Messaging Endpoints',
  62 + 'Messaging Systems', 'System Management'];
64 63
65   - Sidebar.prototype.gmdl = ['Bottom Navigation', 'Bottom Sheets', 'Buttons', 'Cards', 'Chips', 'Dialogs', 'Dividers', 'Grid Lists', 'Icons', 'Lists', 'Menus', 'Misc', 'Pickers',
66   - 'Selection Controls', 'Sliders', 'Steppers', 'Tabs', 'Text Fields'];
  64 + Sidebar.prototype.gmdl = ['Bottom Navigation', 'Bottom Sheets', 'Buttons', 'Cards', 'Chips', 'Dialogs', 'Dividers', 'Grid Lists', 'Icons', 'Lists', 'Menus', 'Misc', 'Pickers',
  65 + 'Selection Controls', 'Sliders', 'Steppers', 'Tabs', 'Text Fields'];
67 66
68   - Sidebar.prototype.aws2 = ['Analytics', 'Application Services', 'Compute', 'Database', 'Developer Tools', 'Enterprise Applications', 'Game Development', 'General', 'Internet of Things',
69   - 'Management Tools', 'Mobile Services', 'Networking', 'On-Demand Workforce', 'SDKs', 'Security and Identity', 'Storage and Content Delivery', 'Groups'];
  67 + Sidebar.prototype.aws2 = ['Analytics', 'Application Services', 'Compute', 'Database', 'Developer Tools', 'Enterprise Applications', 'Game Development', 'General', 'Internet of Things',
  68 + 'Management Tools', 'Mobile Services', 'Networking', 'On-Demand Workforce', 'SDKs', 'Security and Identity', 'Storage and Content Delivery', 'Groups'];
  69 +
  70 + Sidebar.prototype.aws3 = ['Analytics', 'Application Services', 'Artificial Intelligence', 'Business Productivity', 'Compute', 'Contact Center', 'Database', 'Desktop and App Streaming', 'Developer Tools',
  71 + 'Game Development', 'General', 'Groups', 'Internet of Things',
  72 + 'Management Tools', 'Messaging', 'Migration', 'Mobile Services', 'Networking and Content Delivery', 'On Demand Workforce', 'SDKs', 'Security Identity and Compliance', 'Storage'];
70 73
71   - Sidebar.prototype.aws3 = ['Analytics', 'Application Services', 'Artificial Intelligence', 'Business Productivity', 'Compute', 'Contact Center', 'Database', 'Desktop and App Streaming', 'Developer Tools',
72   - 'Game Development', 'General', 'Groups', 'Internet of Things',
73   - 'Management Tools', 'Messaging', 'Migration', 'Mobile Services', 'Networking and Content Delivery', 'On Demand Workforce', 'SDKs', 'Security Identity and Compliance', 'Storage'];
74   -
75 74 Sidebar.prototype.aws4b = ['Arrows', 'General Resources', 'Illustrations', 'Groups Light', 'Groups Dark', 'Analytics', 'Application Integration', 'AR VR', 'Cost Management', 'Business Productivity', 'Compute', 'Customer Engagement',
76   - 'Database', 'Desktop App Streaming', 'Developer Tools', 'Game Development', 'Internet of Things', 'IoT Things', 'IoT Resources', 'Machine Learning', 'Management Tools',
77   - 'Media Services', 'Migration', 'Mobile Services', 'Network Content Delivery', 'Security Identity Compliance', 'Storage'];
78   -
79   - Sidebar.prototype.aws4 = ['Arrows', 'General Resources', 'Illustrations', 'Groups', 'Analytics', 'Application Integration', 'AR VR', 'Cost Management', 'Blockchain',
80   - 'Business Applications', 'Compute', 'Containers', 'Customer Enablement', 'Customer Engagement',
81   - 'Database', 'Developer Tools', 'End User Computing', 'Front End Web Mobile', 'Game Tech', 'Internet of Things', 'IoT Things', 'IoT Resources', 'Machine Learning', 'Management Governance',
82   - 'Media Services', 'Migration Transfer', 'Network Content Delivery', 'Quantum Technologies', 'Robotics', 'Satellite', 'Serverless', 'Security Identity Compliance', 'Storage'];
  75 + 'Database', 'Desktop App Streaming', 'Developer Tools', 'Game Development', 'Internet of Things', 'IoT Things', 'IoT Resources', 'Machine Learning', 'Management Tools',
  76 + 'Media Services', 'Migration', 'Mobile Services', 'Network Content Delivery', 'Security Identity Compliance', 'Storage'];
  77 +
  78 + Sidebar.prototype.aws4 = ['Arrows', 'General Resources', 'Illustrations', 'Groups', 'Analytics', 'Application Integration', 'AR VR', 'Cost Management', 'Blockchain',
  79 + 'Business Applications', 'Compute', 'Containers', 'Customer Enablement', 'Customer Engagement',
  80 + 'Database', 'Developer Tools', 'End User Computing', 'Front End Web Mobile', 'Game Tech', 'Internet of Things', 'IoT Things', 'IoT Resources', 'Machine Learning', 'Management Governance',
  81 + 'Media Services', 'Migration Transfer', 'Network Content Delivery', 'Quantum Technologies', 'Robotics', 'Satellite', 'Serverless', 'Security Identity Compliance', 'Storage'];
83 82
84 83 Sidebar.prototype.office = ['Clouds', 'Communications', 'Concepts', 'Databases', 'Devices', 'Security', 'Servers', 'Services', 'Sites', 'Users'];
85 84
... ... @@ -94,7 +93,7 @@
94 93 * Description of custom libraries, see https://www.diagrams.net/doc/faq/configure-diagram-editor
95 94 */
96 95 Sidebar.prototype.customEntries = null;
97   -
  96 +
98 97 /**
99 98 * Array of strings for the built-in libraries to be enabled in the more shapes dialog. Null means all,
100 99 * empty array means none, possible keys are listed for the libs parameter at
... ... @@ -105,92 +104,165 @@
105 104 * https://www.diagrams.net/doc/faq/supported-url-parameters
106 105 */
107 106 Sidebar.prototype.enabledLibraries = null;
108   -
  107 +
109 108 /**
110 109 * Maximum number of custom libraries to preload into the search index.
111 110 */
112 111 Sidebar.prototype.maxPreloadCount = 20;
113 112
114 113 /**
  114 + * @description TODO thingsKit 在Sidebar 原型中新增图库信息
  115 + * @type {Map<any, any>}
  116 + */
  117 + Sidebar.prototype.variableImageLib = new Map()
  118 +
  119 + /**
  120 + * @description TODO thingsKit 设置图库信息
  121 + * @param key
  122 + * @param label
  123 + * @param lib
  124 + */
  125 + Sidebar.prototype.setVariableImageLib = function (key, label, lib) {
  126 + this.variableImageLib.set(key, { label, key, lib })
  127 + }
  128 +
  129 + /**
  130 + * @description TODO thingsKit 通过key获取图库中某个类别
  131 + * @param key
  132 + * @returns {{}|*}
  133 + */
  134 + Sidebar.prototype.getVariableImageLib = function (key) {
  135 + return this.variableImageLib.get(key)
  136 + }
  137 +
  138 + /**
  139 + * @description TODO thingsKit 取所有图库信息
  140 + * @returns {*[]}
  141 + */
  142 + Sidebar.prototype.getAllVariableImageLib = function () {
  143 + const arr = []
  144 + for (const value of this.variableImageLib.values()) {
  145 + arr.push(value)
  146 + }
  147 + return arr
  148 + }
  149 +
  150 + /**
  151 + * @description TODO thingsKit 设置cell attributes
  152 + */
  153 + Sidebar.prototype.setCellAttributes = function (cell, attribute) {
  154 + if (Object.prototype.toString.call(attribute) === '[object Object]') {
  155 + Object.keys(attribute).forEach(key => {
  156 + this.graph.setAttributeForCell(cell, key, attribute[key])
  157 + })
  158 + }
  159 + }
  160 +
  161 + /**
  162 + * @description 枚举cell的基本属性
  163 + */
  164 + Sidebar.prototype.enumCellBasicAttribute = {
  165 +
  166 + /**
  167 + * @description 组件类型
  168 + */
  169 + COMPONENT_TYPE: 'componentType'
  170 + }
  171 +
  172 + /**
  173 + * @description 枚举组件类型
  174 + */
  175 + Sidebar.prototype.enumComponentType = {
  176 + /**
  177 + * @description 变量图片类型
  178 + */
  179 + VAR_IMAGE: 'variableImage',
  180 +
  181 + /**
  182 + * @description 图表类型
  183 + */
  184 + CHARTS: 'charts'
  185 + }
  186 +
  187 +
  188 + /**
115 189 * 各图形库里面要加载的图形
116 190 */
117   - Sidebar.prototype.configuration = [{id: 'general', libs: ['general', 'misc', 'advanced']},
118   - //加入自定义图形ID
119   - {id:'fan'},{id:'engine'},{id:'valve'},{id:'component'},{id:'controller'},{id:'sewage'},{id:'conduit'},{id: 'light'},{id: 'instrument'},{id: 'button'},
120   - {id: 'uml'}, {id: 'uml25'}, {id: 'search'}, {id: 'er'},
121   - {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']},
122   - {id: 'ios', prefix: 'ios', libs: [''/*prefix is library*/, '7icons', '7ui']},
123   - {id: 'android', prefix: 'android', libs: [''/*prefix is library*/]}, {id: 'aws3d'},
124   - {id: 'flowchart'}, {id: 'basic'}, {id: 'infographic'}, {id: 'arrows'}, {id: 'arrows2'}, {id: 'lean_mapping'}, {id: 'citrix'}, {id: 'azure'}, {id: 'network'}, {id: 'vvd'},
125   - {id: 'sitemap'}, {id:'c4'}, {id: 'dfd'}, {id: 'threatModeling'}, {id : 'kubernetes'}, {id : 'cisco19', prefix: 'cisco19', libs: Sidebar.prototype.cisco19},
126   - {id: 'mscae', prefix: 'mscae', libs: ['Companies', 'EnterpriseFlat', 'IntuneFlat', 'OMSFlat', 'System CenterFlat', 'AI and ML Service', 'Analytics Service', 'Compute Service', 'Compute Service VM', 'Container Service', 'Databases Service', 'DevOps Service', 'General Service', 'Identity Service', 'Integration Service', 'Internet of Things Service', 'Intune Service', 'Management and Governance Service', 'Management and Governance Service Media', 'Migrate Service', 'Mixed Reality Service', 'Mobile Service', 'Networking Service', 'Other Category Service', 'Security Service', 'Storage Service', 'Web Service']},
127   - {id: 'active_directory'},
128   - {id: 'bpmn2', prefix: 'bpmn2', libs: ['General', 'Tasks', 'Choreographies', 'Events', 'Gateways']},
129   - {id: 'clipart', prefix: null, libs: ['computer', 'finance', 'clipart', 'networking', 'people', 'telco']},
130   - {id: 'ibm', prefix: 'ibm', libs: Sidebar.prototype.ibm},
131   - {id: 'allied_telesis', prefix: 'allied_telesis', libs: Sidebar.prototype.allied_telesis},
132   - {id: 'cumulus', libs: ['cumulus']},
133   - {id: 'eip', prefix: 'eip', libs: Sidebar.prototype.eip},
134   - {id: 'mockups', prefix: 'mockup', libs: ['Buttons', 'Containers', 'Forms', 'Graphics', 'Markup', 'Misc', 'Navigation', 'Text']},
135   - {id: 'pid2', prefix: 'pid2', libs: ['Agitators', 'Apparatus Elements', 'Centrifuges', 'Compressors', 'Compressors ISO', 'Crushers Grinding',
136   - 'Driers', 'Engines', 'Feeders', 'Filters', 'Fittings', 'Flow Sensors', 'Heat Exchangers', 'Instruments', 'Misc',
137   - 'Mixers', 'Piping', 'Pumps', 'Pumps DIN', 'Pumps ISO', 'Separators', 'Shaping Machines', 'Valves', 'Vessels']},
138   - {id: 'signs', prefix: 'signs', libs: Sidebar.prototype.signs},
139   - {id: 'gcp', prefix: 'gcp', libs: Sidebar.prototype.gcp},
140   - {id: 'gcp2', prefix: 'gcp2', libs: Sidebar.prototype.gcp2},
141   - {id: 'gcpicons', prefix: 'gcpicons', libs: Sidebar.prototype.gcpicons},
142   - {id: 'rack', prefix: 'rack', libs: Sidebar.prototype.rack},
143   - {id: 'electrical', prefix: 'electrical', libs: Sidebar.prototype.electrical},
144   - {id: 'aws2', prefix: 'aws2', libs: Sidebar.prototype.aws2},
145   - {id: 'aws3', prefix: 'aws3', libs: Sidebar.prototype.aws3},
146   - {id: 'aws4b', prefix: 'aws4b', libs: Sidebar.prototype.aws4b},
147   - {id: 'aws4', prefix: 'aws4', libs: Sidebar.prototype.aws4},
148   - {id: 'pid', prefix: 'pid', libs: Sidebar.prototype.pids},
149   - {id: 'cisco', prefix: 'cisco', libs: Sidebar.prototype.cisco},
150   - {id: 'cisco_safe', prefix: 'cisco_safe', libs: Sidebar.prototype.cisco_safe},
151   - {id: 'office', prefix: 'office', libs: Sidebar.prototype.office},
152   - {id: 'veeam', prefix: 'veeam', libs: Sidebar.prototype.veeam},
153   - {id: 'veeam2', prefix: 'veeam2', libs: Sidebar.prototype.veeam2},
154   - {id: 'cabinets', libs: ['cabinets']},
155   - {id: 'floorplan', libs: ['floorplan']},
156   - {id: 'bootstrap', libs: ['bootstrap']},
157   - {id: 'atlassian', libs: ['atlassian']},
158   - {id: 'fluid_power', libs: ['fluid_power']},
159   - {id: 'gmdl', prefix: 'gmdl', libs: Sidebar.prototype.gmdl},
160   - {id: 'archimate3', prefix: 'archimate3', libs: Sidebar.prototype.archimate3},
161   - {id: 'archimate', libs: ['archimate']},
162   - {id: 'webicons', libs: ['webicons', 'weblogos']},
163   - {id: 'sysml', prefix: 'sysml', libs: Sidebar.prototype.sysml}];
164   -
  191 + Sidebar.prototype.configuration = [
  192 + { id: 'general', libs: ['general', 'misc', 'advanced'] },
  193 + //加入自定义图形ID
  194 + { id: 'fan' }, { id: 'engine' }, { id: 'valve' }, { id: 'component' }, { id: 'controller' }, { id: 'sewage' }, { id: 'conduit' }, { id: 'light' }, { id: 'instrument' }, { id: 'button' },
  195 + { id: 'uml' }, { id: 'uml25' }, { id: 'search' }, { id: 'er' },
  196 + { 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'] },
  197 + { id: 'ios', prefix: 'ios', libs: [''/*prefix is library*/, '7icons', '7ui'] },
  198 + { id: 'android', prefix: 'android', libs: [''/*prefix is library*/] }, { id: 'aws3d' },
  199 + { id: 'flowchart' }, { id: 'basic' }, { id: 'infographic' }, { id: 'arrows' }, { id: 'arrows2' }, { id: 'lean_mapping' }, { id: 'citrix' }, { id: 'azure' }, { id: 'network' }, { id: 'vvd' },
  200 + { id: 'sitemap' }, { id: 'c4' }, { id: 'dfd' }, { id: 'threatModeling' }, { id: 'kubernetes' }, { id: 'cisco19', prefix: 'cisco19', libs: Sidebar.prototype.cisco19 },
  201 + { id: 'mscae', prefix: 'mscae', libs: ['Companies', 'EnterpriseFlat', 'IntuneFlat', 'OMSFlat', 'System CenterFlat', 'AI and ML Service', 'Analytics Service', 'Compute Service', 'Compute Service VM', 'Container Service', 'Databases Service', 'DevOps Service', 'General Service', 'Identity Service', 'Integration Service', 'Internet of Things Service', 'Intune Service', 'Management and Governance Service', 'Management and Governance Service Media', 'Migrate Service', 'Mixed Reality Service', 'Mobile Service', 'Networking Service', 'Other Category Service', 'Security Service', 'Storage Service', 'Web Service'] },
  202 + { id: 'active_directory' },
  203 + { id: 'bpmn2', prefix: 'bpmn2', libs: ['General', 'Tasks', 'Choreographies', 'Events', 'Gateways'] },
  204 + { id: 'clipart', prefix: null, libs: ['computer', 'finance', 'clipart', 'networking', 'people', 'telco'] },
  205 + { id: 'ibm', prefix: 'ibm', libs: Sidebar.prototype.ibm },
  206 + { id: 'allied_telesis', prefix: 'allied_telesis', libs: Sidebar.prototype.allied_telesis },
  207 + { id: 'cumulus', libs: ['cumulus'] },
  208 + { id: 'eip', prefix: 'eip', libs: Sidebar.prototype.eip },
  209 + { id: 'mockups', prefix: 'mockup', libs: ['Buttons', 'Containers', 'Forms', 'Graphics', 'Markup', 'Misc', 'Navigation', 'Text'] },
  210 + {
  211 + id: 'pid2', prefix: 'pid2', libs: ['Agitators', 'Apparatus Elements', 'Centrifuges', 'Compressors', 'Compressors ISO', 'Crushers Grinding',
  212 + 'Driers', 'Engines', 'Feeders', 'Filters', 'Fittings', 'Flow Sensors', 'Heat Exchangers', 'Instruments', 'Misc',
  213 + 'Mixers', 'Piping', 'Pumps', 'Pumps DIN', 'Pumps ISO', 'Separators', 'Shaping Machines', 'Valves', 'Vessels']
  214 + },
  215 + { id: 'signs', prefix: 'signs', libs: Sidebar.prototype.signs },
  216 + { id: 'gcp', prefix: 'gcp', libs: Sidebar.prototype.gcp },
  217 + { id: 'gcp2', prefix: 'gcp2', libs: Sidebar.prototype.gcp2 },
  218 + { id: 'gcpicons', prefix: 'gcpicons', libs: Sidebar.prototype.gcpicons },
  219 + { id: 'rack', prefix: 'rack', libs: Sidebar.prototype.rack },
  220 + { id: 'electrical', prefix: 'electrical', libs: Sidebar.prototype.electrical },
  221 + { id: 'aws2', prefix: 'aws2', libs: Sidebar.prototype.aws2 },
  222 + { id: 'aws3', prefix: 'aws3', libs: Sidebar.prototype.aws3 },
  223 + { id: 'aws4b', prefix: 'aws4b', libs: Sidebar.prototype.aws4b },
  224 + { id: 'aws4', prefix: 'aws4', libs: Sidebar.prototype.aws4 },
  225 + { id: 'pid', prefix: 'pid', libs: Sidebar.prototype.pids },
  226 + { id: 'cisco', prefix: 'cisco', libs: Sidebar.prototype.cisco },
  227 + { id: 'cisco_safe', prefix: 'cisco_safe', libs: Sidebar.prototype.cisco_safe },
  228 + { id: 'office', prefix: 'office', libs: Sidebar.prototype.office },
  229 + { id: 'veeam', prefix: 'veeam', libs: Sidebar.prototype.veeam },
  230 + { id: 'veeam2', prefix: 'veeam2', libs: Sidebar.prototype.veeam2 },
  231 + { id: 'cabinets', libs: ['cabinets'] },
  232 + { id: 'floorplan', libs: ['floorplan'] },
  233 + { id: 'bootstrap', libs: ['bootstrap'] },
  234 + { id: 'atlassian', libs: ['atlassian'] },
  235 + { id: 'fluid_power', libs: ['fluid_power'] },
  236 + { id: 'gmdl', prefix: 'gmdl', libs: Sidebar.prototype.gmdl },
  237 + { id: 'archimate3', prefix: 'archimate3', libs: Sidebar.prototype.archimate3 },
  238 + { id: 'archimate', libs: ['archimate'] },
  239 + { id: 'webicons', libs: ['webicons', 'weblogos'] },
  240 + { id: 'sysml', prefix: 'sysml', libs: Sidebar.prototype.sysml }];
  241 +
165 242 /**
166 243 * Removes disabled libraries from search results.
167 244 */
168 245 var sidebarAddEntry = Sidebar.prototype.addEntry;
169 246
170   - Sidebar.prototype.addEntry = function(tags, fn)
171   - {
  247 + Sidebar.prototype.addEntry = function (tags, fn) {
172 248 if (this.currentSearchEntryLibrary != null && this.enabledLibraries != null &&
173   - mxUtils.indexOf(this.enabledLibraries, this.currentSearchEntryLibrary.id) < 0)
174   - {
  249 + mxUtils.indexOf(this.enabledLibraries, this.currentSearchEntryLibrary.id) < 0) {
175 250 return fn;
176 251 }
177   - else
178   - {
  252 + else {
179 253 return sidebarAddEntry.apply(this, arguments);
180   - }
  254 + }
181 255 };
182 256
183 257 /**
184 258 * Refreshes scratchpad.
185 259 */
186 260 var sidebarRefresh = Sidebar.prototype.refresh;
187   - Sidebar.prototype.refresh = function()
188   - {
  261 + Sidebar.prototype.refresh = function () {
189 262 var ui = this.editorUi;
190 263 sidebarRefresh.apply(this, arguments);
191 264
192   - if (ui.scratchpad != null)
193   - {
  265 + if (ui.scratchpad != null) {
194 266 ui.loadLibrary(new StorageLibrary(ui,
195 267 ui.scratchpad.getData(),
196 268 '.scratchpad'));
... ... @@ -201,37 +273,30 @@
201 273 * Adds hint for quick tutorial video for certain search terms.
202 274 */
203 275 var siderbarInsertSearchHint = Sidebar.prototype.insertSearchHint;
204   -
205   - Sidebar.prototype.insertSearchHint = function(div, searchTerm, count, page, results, len, more, terms)
206   - {
207   - if (terms != null && page == 1)
208   - {
  276 +
  277 + Sidebar.prototype.insertSearchHint = function (div, searchTerm, count, page, results, len, more, terms) {
  278 + if (terms != null && page == 1) {
209 279 var hintText = null;
210   -
  280 +
211 281 // Adds hint for text inserts
212   - if (mxUtils.indexOf(terms, 'text') >= 0)
213   - {
  282 + if (mxUtils.indexOf(terms, 'text') >= 0) {
214 283 hintText = 'Double click anywhere in the diagram to insert text.';
215 284 }
216   - else
217   - {
  285 + else {
218 286 // Checks if any of the following keywords are in the search terms
219 287 var words = ['line', 'lines', 'arrow', 'arrows', 'connect', 'connection', 'connections',
220   - 'connector', 'connectors', 'curve', 'curves', 'link', 'links', 'directed',
221   - 'directional', 'bidirectional'];
222   -
223   - for (var i = 0; i < words.length; i++)
224   - {
225   - if (mxUtils.indexOf(terms, words[i]) >= 0)
226   - {
  288 + 'connector', 'connectors', 'curve', 'curves', 'link', 'links', 'directed',
  289 + 'directional', 'bidirectional'];
  290 +
  291 + for (var i = 0; i < words.length; i++) {
  292 + if (mxUtils.indexOf(terms, words[i]) >= 0) {
227 293 hintText = 'Need help with connections?';
228 294 break;
229 295 }
230 296 }
231 297 }
232   -
233   - if (hintText != null && !this.hideSearchHint)
234   - {
  298 +
  299 + if (hintText != null && !this.hideSearchHint) {
235 300 var link = document.createElement('a');
236 301 link.setAttribute('href', 'https://youtu.be/Z0D96ZikMkc');
237 302 link.setAttribute('target', '_blank');
... ... @@ -240,7 +305,7 @@
240 305 'border:1px solid black !important;text-align:center;white-space:normal;' +
241 306 'padding:6px 0px 6px 0px !important;margin:4px 4px 8px 2px;font-size:12px;';
242 307 mxUtils.write(link, hintText);
243   -
  308 +
244 309 // Adds close button
245 310 var img = document.createElement('img');
246 311 img.setAttribute('src', Dialog.prototype.closeImage);
... ... @@ -250,48 +315,43 @@
250 315 img.style.cursor = 'default';
251 316 img.style.top = '1px';
252 317 img.style.right = '0px';
253   -
254   - mxEvent.addListener(img, 'click', mxUtils.bind(this, function(evt)
255   - {
  318 +
  319 + mxEvent.addListener(img, 'click', mxUtils.bind(this, function (evt) {
256 320 link.parentNode.removeChild(link);
257 321 this.hideSearchHint = true;
258 322 mxEvent.consume(evt);
259 323 }));
260   -
  324 +
261 325 link.appendChild(img);
262 326 div.appendChild(link);
263   -
  327 +
264 328 // Shows hint only once
265 329 this.hideSearchHint = true;
266 330 }
267 331 }
268   -
  332 +
269 333 siderbarInsertSearchHint.apply(this, arguments);
270 334 };
271 335
272 336 /**
273 337 * Toggle palette.
274 338 */
275   - Sidebar.prototype.togglePalettes = function(prefix, ids)
276   - {
  339 + Sidebar.prototype.togglePalettes = function (prefix, ids) {
277 340 this.showPalettes(prefix, ids);
278 341 };
279 342
280 343 /**
281 344 * Toggle palette.
282 345 */
283   - Sidebar.prototype.togglePalette = function(id)
284   - {
  346 + Sidebar.prototype.togglePalette = function (id) {
285 347 this.showPalette(id);
286 348 };
287   -
  349 +
288 350 /**
289 351 * Shows or hides palettes.
290 352 */
291   - Sidebar.prototype.showPalettes = function(prefix, ids, visible)
292   - {
293   - for (var i = 0; i < ids.length; i++)
294   - {
  353 + Sidebar.prototype.showPalettes = function (prefix, ids, visible) {
  354 + for (var i = 0; i < ids.length; i++) {
295 355 this.showPalette(prefix + ids[i], visible);
296 356 }
297 357 };
... ... @@ -299,197 +359,160 @@
299 359 /**
300 360 * Shows or hides a palette.
301 361 */
302   - Sidebar.prototype.showPalette = function(id, visible)
303   - {
  362 + Sidebar.prototype.showPalette = function (id, visible) {
304 363 var elts = this.palettes[id];
305   -
306   - if (elts != null)
307   - {
  364 +
  365 + if (elts != null) {
308 366 var vis = (visible != null) ? ((visible) ? 'block' : 'none') : (elts[0].style.display == 'none') ? 'block' : 'none';
309   -
310   - for (var i = 0; i < elts.length; i++)
311   - {
  367 +
  368 + for (var i = 0; i < elts.length; i++) {
312 369 elts[i].style.display = vis;
313 370 }
314 371 }
315   -
  372 +
316 373 return elts;
317 374 };
318   -
  375 +
319 376 /**
320   - *
  377 + *
321 378 */
322   - Sidebar.prototype.getConfigurationById = function(id)
323   - {
324   - for (var i = 0; i < this.configuration.length; i++)
325   - {
326   - if (this.configuration[i].id == id)
327   - {
  379 + Sidebar.prototype.getConfigurationById = function (id) {
  380 + for (var i = 0; i < this.configuration.length; i++) {
  381 + if (this.configuration[i].id == id) {
328 382 return this.configuration[i];
329 383 }
330 384 }
331   -
332   - if (this.customEntries != null)
333   - {
334   - for (var i = 0; i < this.customEntries.length; i++)
335   - {
  385 +
  386 + if (this.customEntries != null) {
  387 + for (var i = 0; i < this.customEntries.length; i++) {
336 388 var section = this.customEntries[i];
337   -
338   - for (var j = 0; j < section.entries.length; j++)
339   - {
  389 +
  390 + for (var j = 0; j < section.entries.length; j++) {
340 391 var entry = section.entries[j];
341   -
342   - if (entry.id == id)
343   - {
344   - return {id: entry.id, libs: entry.libs};
  392 +
  393 + if (entry.id == id) {
  394 + return { id: entry.id, libs: entry.libs };
345 395 }
346 396 }
347 397 }
348 398 }
349   -
  399 +
350 400 return null;
351 401 };
352   -
  402 +
353 403 /**
354   - *
  404 + *
355 405 */
356   - Sidebar.prototype.isEntryVisible = function(key)
357   - {
358   - if (key == '.scratchpad')
359   - {
  406 + Sidebar.prototype.isEntryVisible = function (key) {
  407 + if (key == '.scratchpad') {
360 408 return this.editorUi.scratchpad != null;
361 409 }
362   - else
363   - {
  410 + else {
364 411 var config = this.getConfigurationById(key);
365   -
366   - if (config != null)
367   - {
  412 +
  413 + if (config != null) {
368 414 var id = (config.libs != null) ? ((config.prefix || '') + config.libs[0]) : key;
369 415 var elts = this.palettes[id];
370 416
371   - if (elts != null)
372   - {
  417 + if (elts != null) {
373 418 return elts[0].style.display != 'none';
374 419 }
375 420 }
376   -
377   - if (this.customEntries != null)
378   - {
379   - for (var i = 0; i < this.customEntries.length; i++)
380   - {
  421 +
  422 + if (this.customEntries != null) {
  423 + for (var i = 0; i < this.customEntries.length; i++) {
381 424 var section = this.customEntries[i];
382   -
383   - for (var j = 0; j < section.entries.length; j++)
384   - {
  425 +
  426 + for (var j = 0; j < section.entries.length; j++) {
385 427 var entry = section.entries[j];
386   -
387   - if (entry.id == key)
388   - {
389   - if (entry.libs != null && entry.libs.length > 0)
390   - {
  428 +
  429 + if (entry.id == key) {
  430 + if (entry.libs != null && entry.libs.length > 0) {
391 431 var elts = this.palettes[entry.id + '.0'];
392   -
393   - if (elts != null)
394   - {
  432 +
  433 + if (elts != null) {
395 434 return elts[0].style.display != 'none';
396 435 }
397 436 }
398   -
  437 +
399 438 break;
400 439 }
401 440 }
402 441 }
403 442 }
404   -
  443 +
405 444 return false;
406 445 }
407 446 };
408 447
409 448 /**
410   - *
  449 + *
411 450 */
412   - Sidebar.prototype.showEntries = function(entries, remember, force)
413   - {
  451 + Sidebar.prototype.showEntries = function (entries, remember, force) {
414 452 var all = [];
415   -
416   - if (remember)
417   - {
  453 +
  454 + if (remember) {
418 455 mxSettings.setLibraries(entries);
419 456 mxSettings.save();
420 457 }
421   -
422   - if (entries != null && (force || entries.length > 0))
423   - {
  458 +
  459 + if (entries != null && (force || entries.length > 0)) {
424 460 all.push(entries);
425 461 }
426   - else
427   - {
  462 + else {
428 463 var done = false;
429   -
430   - if (urlParams['libs'] != null && urlParams['libs'].length > 0)
431   - {
  464 +
  465 + if (urlParams['libs'] != null && urlParams['libs'].length > 0) {
432 466 all.push(decodeURIComponent(urlParams['libs']));
433 467 done = this.editorUi.getServiceName() == 'draw.io';
434 468 }
435   -
  469 +
436 470 // Libs parameter overrides configuration for online app so that
437 471 // links can be created to show just the specifies libraries
438   - if (!done)
439   - {
440   - if (mxSettings != null && mxSettings.settings != null)
441   - {
  472 + if (!done) {
  473 + if (mxSettings != null && mxSettings.settings != null) {
442 474 all.push(mxSettings.getLibraries());
443 475 }
444   - else
445   - {
  476 + else {
446 477 all.push(this.defaultEntries);
447 478 }
448 479 }
449 480 }
450   -
  481 +
451 482 // Merges array of semicolon separated strings into a single array
452 483 var temp = all.join(';').split(';');
453 484
454 485 // Resolves aliases and creates lookup
455 486 var visible = {};
456   -
457   - for (var i = 0; i < temp.length; i++)
458   - {
459   - visible[this.libAliases[temp[i]] || temp[i]] = true;
  487 +
  488 + for (var i = 0; i < temp.length; i++) {
  489 + visible[this.libAliases[temp[i]] || temp[i]] = true;
460 490 }
461   -
462   - for (var i = 0; i < this.configuration.length; i++)
463   - {
  491 +
  492 + for (var i = 0; i < this.configuration.length; i++) {
464 493 // Search has separate switch in Extras menu
465   - if (this.configuration[i].id != 'search')
466   - {
  494 + if (this.configuration[i].id != 'search') {
467 495 this.showPalettes(this.configuration[i].prefix || '',
468 496 this.configuration[i].libs || [this.configuration[i].id],
469 497 visible[this.configuration[i].id] == true);
470 498
471 499 }
472 500 }
473   -
474   - if (this.customEntries != null)
475   - {
476   - for (var i = 0; i < this.customEntries.length; i++)
477   - {
  501 +
  502 + if (this.customEntries != null) {
  503 + for (var i = 0; i < this.customEntries.length; i++) {
478 504 var section = this.customEntries[i];
479   -
480   - for (var j = 0; j < section.entries.length; j++)
481   - {
  505 +
  506 + for (var j = 0; j < section.entries.length; j++) {
482 507 var entry = section.entries[j];
483   -
484   - if (entry.libs != null && entry.libs.length > 0)
485   - {
  508 +
  509 + if (entry.libs != null && entry.libs.length > 0) {
486 510 var libs = [];
487   -
488   - for (var k = 0; k < entry.libs.length; k++)
489   - {
  511 +
  512 + for (var k = 0; k < entry.libs.length; k++) {
490 513 libs.push(entry.id + '.' + k);
491 514 }
492   -
  515 +
493 516 this.showPalettes('', libs, visible[entry.id]);
494 517 }
495 518 }
... ... @@ -500,8 +523,7 @@
500 523 /**
501 524 * Overrides the sidebar init.
502 525 */
503   - Sidebar.prototype.init = function()
504   - {
  526 + Sidebar.prototype.init = function () {
505 527 // Defines all entries for the sidebar. This is used in the MoreShapes dialog. Create screenshots using the savesidebar URL parameter and
506 528 // http://www.alderg.com/merge.html for creating a vertical stack of PNG images if multiple sidebars are part of an entry.
507 529 //更多图形里面的加载,可以加载自己定义的图形库,同时要提供对应的图片
... ... @@ -512,127 +534,122 @@
512 534 // {title: mxResources.get('flowchart'), id: 'flowchart', image: IMAGE_PATH + '/sidebar-flowchart.png'}];
513 535 //更多图形,显示出来的的标题跟id,同时包括图片
514 536 var thingskitEntries = [
515   - {title:"风机",id:'fan',image:IMAGE_PATH + '/thingskit/风机.png'},
516   - {title:"发动机",id:'engine',image:IMAGE_PATH + '/thingskit/发动机.png'},
517   - {title:"阀门",id:'valve',image:IMAGE_PATH + '/thingskit/阀门.png'},
518   - {title:"基础组件",id:'component',image:IMAGE_PATH + '/thingskit/基础元件.png'},
519   - {title: "污水处理",id:'sewage',image: IMAGE_PATH + '/thingskit/污水处理.png'},
520   - {title: "管道",id:'conduit',image: IMAGE_PATH + '/thingskit/管道.png'},
521   - {title: "灯",id:'light',image: IMAGE_PATH + '/thingskit/灯.png'},
522   - {title: "按钮",id:'button',image: IMAGE_PATH + '/thingskit/按钮.png'},
523   - {title: "仪表",id:'instrument',image: IMAGE_PATH + '/thingskit/仪表.png'},
  537 + { title: "风机", id: 'fan', image: IMAGE_PATH + '/thingskit/风机.png' },
  538 + { title: "发动机", id: 'engine', image: IMAGE_PATH + '/thingskit/发动机.png' },
  539 + { title: "阀门", id: 'valve', image: IMAGE_PATH + '/thingskit/阀门.png' },
  540 + { title: "基础组件", id: 'component', image: IMAGE_PATH + '/thingskit/基础元件.png' },
  541 + { title: "污水处理", id: 'sewage', image: IMAGE_PATH + '/thingskit/污水处理.png' },
  542 + { title: "管道", id: 'conduit', image: IMAGE_PATH + '/thingskit/管道.png' },
  543 + { title: "灯", id: 'light', image: IMAGE_PATH + '/thingskit/灯.png' },
  544 + { title: "按钮", id: 'button', image: IMAGE_PATH + '/thingskit/按钮.png' },
  545 + { title: "仪表", id: 'instrument', image: IMAGE_PATH + '/thingskit/仪表.png' },
524 546 ];
525   - if (urlParams['sketch'] == '1')
526   - {
527   - stdEntries = [{title: mxResources.get('searchShapes'), id: 'search'},
528   - {title: mxResources.get('scratchpad'), id: '.scratchpad'}].
  547 + if (urlParams['sketch'] == '1') {
  548 + stdEntries = [{ title: mxResources.get('searchShapes'), id: 'search' },
  549 + { title: mxResources.get('scratchpad'), id: '.scratchpad' }].
529 550 concat(stdEntries);
530 551 }
531 552
532 553 this.entries = [
533   - // {title: mxResources.get('standard'), entries: stdEntries},
534   - {title: '通用', entries: thingskitEntries},
535   - // 注释掉软件
536   - // {title: mxResources.get('software'),
537   - // entries: [{title: 'Active Directory', id: 'active_directory', image: IMAGE_PATH + '/sidebar-active_directory.png'},
538   - // {title: mxResources.get('android'), id: 'android', image: IMAGE_PATH + '/sidebar-android.png'},
539   - // {title: 'Atlassian', id: 'atlassian', image: IMAGE_PATH + '/sidebar-atlassian.png'},
540   - // {title: mxResources.get('bootstrap'), id: 'bootstrap', image: IMAGE_PATH + '/sidebar-bootstrap.png'},
541   - // {title: 'C4', id: 'c4', image: IMAGE_PATH + '/sidebar-c4.png'},
542   - // {title: 'Data Flow Diagram', id: 'dfd', image: IMAGE_PATH + '/sidebar-dfd.png'},
543   - // {title: mxResources.get('entityRelation'), id: 'er', image: IMAGE_PATH + '/sidebar-er.png'},
544   - // {title: mxResources.get('ios'), id: 'ios', image: IMAGE_PATH + '/sidebar-ios.png'},
545   - // {title: mxResources.get('mockups'), id: 'mockups', image: IMAGE_PATH + '/sidebar-mockups.png'},
546   - // {title: 'Sitemap', id: 'sitemap', image: IMAGE_PATH + '/sidebar-sitemap.png'},
547   - // {title: mxResources.get('uml') + ' 2.5', id: 'uml25', image: IMAGE_PATH + '/sidebar-uml25.png'},
548   - // {title: mxResources.get('uml'), id: 'uml', image: IMAGE_PATH + '/sidebar-uml.png'}]},
549   - // 注释掉网络
550   - // {title: mxResources.get('networking'),
551   - // entries: [{title: 'Allied Telesis', id: 'allied_telesis', image: IMAGE_PATH + '/sidebar-allied_telesis.png'},
552   - // {title: 'AWS17', id: 'aws3', image: IMAGE_PATH + '/sidebar-aws3.png'},
553   - // {title: 'AWS18', id: 'aws4b', image: IMAGE_PATH + '/sidebar-aws4b.png'},
554   - // {title: 'AWS19', id: 'aws4', image: IMAGE_PATH + '/sidebar-aws4.png'},
555   - // // TODO: Add isometric containers
556   - // {title: mxResources.get('aws3d'), id: 'aws3d', image: IMAGE_PATH + '/sidebar-aws3d.png'},
557   - // {title: mxResources.get('azure'), id: 'azure2', image: IMAGE_PATH + '/sidebar-azure.png'},
558   - // {title: 'Cloud & Enterprise', id: 'mscae', image: IMAGE_PATH + '/sidebar-mscae.png'},
559   - // {title: mxResources.get('cisco'), id: 'cisco', image: IMAGE_PATH + '/sidebar-cisco.png'},
560   - // {title: 'Cisco19', id: 'cisco19', image: IMAGE_PATH + '/sidebar-cisco19.png'},
561   - // {title: 'Cisco Safe', id: 'cisco_safe', image: IMAGE_PATH + '/sidebar-cisco_safe.png'},
562   - // {title: 'Cumulus', id: 'cumulus', image: IMAGE_PATH + '/sidebar-cumulus.png'},
563   - // {title: 'Citrix', id: 'citrix', image: IMAGE_PATH + '/sidebar-citrix.png'},
564   - // {title: 'Google Cloud Platform', id: 'gcp2', image: IMAGE_PATH + '/sidebar-gcp2.png'},
565   - // {title: 'GCP Icons', id: 'gcpicons', image: IMAGE_PATH + '/sidebar-gcpicons.png'},
566   - // {title: 'IBM', id: 'ibm', image: IMAGE_PATH + '/sidebar-ibm.png'},
567   - // {title: 'Kubernetes', id: 'kubernetes', image: IMAGE_PATH + '/sidebar-kubernetes.png'},
568   - // {title: 'Network', id: 'network', image: IMAGE_PATH + '/sidebar-network.png'},
569   - // {title: 'Office', id: 'office', image: IMAGE_PATH + '/sidebar-office.png'},
570   - // {title: mxResources.get('rack'), id: 'rack', image: IMAGE_PATH + '/sidebar-rack.png'},
571   - // {title: 'Veeam', id: 'veeam2', image: IMAGE_PATH + '/sidebar-veeam.png'},
572   - // {title: 'VMware', id: 'vvd', image: IMAGE_PATH + '/sidebar-vvd.png'}]},
573   - // 注释掉商务
574   - // {title: mxResources.get('business'),
575   - // entries: [{title: 'ArchiMate 3.0', id: 'archimate3', image: IMAGE_PATH + '/sidebar-archimate3.png'},
576   - // {title: mxResources.get('archiMate21'), id: 'archimate', image: IMAGE_PATH + '/sidebar-archimate.png'},
577   - // {title: mxResources.get('bpmn') + ' 2.0', id: 'bpmn2', image: IMAGE_PATH + '/sidebar-bpmn.png'},
578   - // {title: mxResources.get('sysml'), id: 'sysml', image: IMAGE_PATH + '/sidebar-sysml.png'},
579   - // {title: 'Value Stream Mapping', id: 'lean_mapping', image: IMAGE_PATH + '/sidebar-leanmapping.png'}]},
580   - {title: mxResources.get('other'),
581   - entries: [{title: mxResources.get('cabinets'), id: 'cabinets', image: IMAGE_PATH + '/sidebar-cabinets.png'},
582   - {title: 'Infographic', id: 'infographic', image: IMAGE_PATH + '/sidebar-infographic.png'},
583   - {title: mxResources.get('eip'), id: 'eip', image: IMAGE_PATH + '/sidebar-eip.png'},
584   - {title: mxResources.get('electrical'), id: 'electrical', image: IMAGE_PATH + '/sidebar-electrical.png'},
585   - {title: mxResources.get('floorplans'), id: 'floorplan', image: IMAGE_PATH + '/sidebar-floorplans.png'},
586   - {title: 'Fluid Power (ISO 1219)', id: 'fluid_power', image: IMAGE_PATH + '/sidebar-fluid_power.png'},
587   - {title: mxResources.get('gmdl'), id: 'gmdl', image: IMAGE_PATH + '/sidebar-gmdl.png'},
588   - {title: mxResources.get('procEng'), id: 'pid', image: IMAGE_PATH + '/sidebar-pid.png'},
589   - {title: 'Threat Modeling', id: 'threatModeling', image: IMAGE_PATH + '/sidebar-threatmodeling.png'},
590   - {title: 'Web Icons', id: 'webicons', image: IMAGE_PATH + '/sidebar-webIcons.png'},
591   - {title: mxResources.get('signs'), id: 'signs', image: IMAGE_PATH + '/sidebar-signs.png'}]}];
  554 + // {title: mxResources.get('standard'), entries: stdEntries},
  555 + { title: '通用', entries: thingskitEntries },
  556 + // 注释掉软件
  557 + // {title: mxResources.get('software'),
  558 + // entries: [{title: 'Active Directory', id: 'active_directory', image: IMAGE_PATH + '/sidebar-active_directory.png'},
  559 + // {title: mxResources.get('android'), id: 'android', image: IMAGE_PATH + '/sidebar-android.png'},
  560 + // {title: 'Atlassian', id: 'atlassian', image: IMAGE_PATH + '/sidebar-atlassian.png'},
  561 + // {title: mxResources.get('bootstrap'), id: 'bootstrap', image: IMAGE_PATH + '/sidebar-bootstrap.png'},
  562 + // {title: 'C4', id: 'c4', image: IMAGE_PATH + '/sidebar-c4.png'},
  563 + // {title: 'Data Flow Diagram', id: 'dfd', image: IMAGE_PATH + '/sidebar-dfd.png'},
  564 + // {title: mxResources.get('entityRelation'), id: 'er', image: IMAGE_PATH + '/sidebar-er.png'},
  565 + // {title: mxResources.get('ios'), id: 'ios', image: IMAGE_PATH + '/sidebar-ios.png'},
  566 + // {title: mxResources.get('mockups'), id: 'mockups', image: IMAGE_PATH + '/sidebar-mockups.png'},
  567 + // {title: 'Sitemap', id: 'sitemap', image: IMAGE_PATH + '/sidebar-sitemap.png'},
  568 + // {title: mxResources.get('uml') + ' 2.5', id: 'uml25', image: IMAGE_PATH + '/sidebar-uml25.png'},
  569 + // {title: mxResources.get('uml'), id: 'uml', image: IMAGE_PATH + '/sidebar-uml.png'}]},
  570 + // 注释掉网络
  571 + // {title: mxResources.get('networking'),
  572 + // entries: [{title: 'Allied Telesis', id: 'allied_telesis', image: IMAGE_PATH + '/sidebar-allied_telesis.png'},
  573 + // {title: 'AWS17', id: 'aws3', image: IMAGE_PATH + '/sidebar-aws3.png'},
  574 + // {title: 'AWS18', id: 'aws4b', image: IMAGE_PATH + '/sidebar-aws4b.png'},
  575 + // {title: 'AWS19', id: 'aws4', image: IMAGE_PATH + '/sidebar-aws4.png'},
  576 + // // TODO: Add isometric containers
  577 + // {title: mxResources.get('aws3d'), id: 'aws3d', image: IMAGE_PATH + '/sidebar-aws3d.png'},
  578 + // {title: mxResources.get('azure'), id: 'azure2', image: IMAGE_PATH + '/sidebar-azure.png'},
  579 + // {title: 'Cloud & Enterprise', id: 'mscae', image: IMAGE_PATH + '/sidebar-mscae.png'},
  580 + // {title: mxResources.get('cisco'), id: 'cisco', image: IMAGE_PATH + '/sidebar-cisco.png'},
  581 + // {title: 'Cisco19', id: 'cisco19', image: IMAGE_PATH + '/sidebar-cisco19.png'},
  582 + // {title: 'Cisco Safe', id: 'cisco_safe', image: IMAGE_PATH + '/sidebar-cisco_safe.png'},
  583 + // {title: 'Cumulus', id: 'cumulus', image: IMAGE_PATH + '/sidebar-cumulus.png'},
  584 + // {title: 'Citrix', id: 'citrix', image: IMAGE_PATH + '/sidebar-citrix.png'},
  585 + // {title: 'Google Cloud Platform', id: 'gcp2', image: IMAGE_PATH + '/sidebar-gcp2.png'},
  586 + // {title: 'GCP Icons', id: 'gcpicons', image: IMAGE_PATH + '/sidebar-gcpicons.png'},
  587 + // {title: 'IBM', id: 'ibm', image: IMAGE_PATH + '/sidebar-ibm.png'},
  588 + // {title: 'Kubernetes', id: 'kubernetes', image: IMAGE_PATH + '/sidebar-kubernetes.png'},
  589 + // {title: 'Network', id: 'network', image: IMAGE_PATH + '/sidebar-network.png'},
  590 + // {title: 'Office', id: 'office', image: IMAGE_PATH + '/sidebar-office.png'},
  591 + // {title: mxResources.get('rack'), id: 'rack', image: IMAGE_PATH + '/sidebar-rack.png'},
  592 + // {title: 'Veeam', id: 'veeam2', image: IMAGE_PATH + '/sidebar-veeam.png'},
  593 + // {title: 'VMware', id: 'vvd', image: IMAGE_PATH + '/sidebar-vvd.png'}]},
  594 + // 注释掉商务
  595 + // {title: mxResources.get('business'),
  596 + // entries: [{title: 'ArchiMate 3.0', id: 'archimate3', image: IMAGE_PATH + '/sidebar-archimate3.png'},
  597 + // {title: mxResources.get('archiMate21'), id: 'archimate', image: IMAGE_PATH + '/sidebar-archimate.png'},
  598 + // {title: mxResources.get('bpmn') + ' 2.0', id: 'bpmn2', image: IMAGE_PATH + '/sidebar-bpmn.png'},
  599 + // {title: mxResources.get('sysml'), id: 'sysml', image: IMAGE_PATH + '/sidebar-sysml.png'},
  600 + // {title: 'Value Stream Mapping', id: 'lean_mapping', image: IMAGE_PATH + '/sidebar-leanmapping.png'}]},
  601 + {
  602 + title: mxResources.get('other'),
  603 + entries: [{ title: mxResources.get('cabinets'), id: 'cabinets', image: IMAGE_PATH + '/sidebar-cabinets.png' },
  604 + { title: 'Infographic', id: 'infographic', image: IMAGE_PATH + '/sidebar-infographic.png' },
  605 + { title: mxResources.get('eip'), id: 'eip', image: IMAGE_PATH + '/sidebar-eip.png' },
  606 + { title: mxResources.get('electrical'), id: 'electrical', image: IMAGE_PATH + '/sidebar-electrical.png' },
  607 + { title: mxResources.get('floorplans'), id: 'floorplan', image: IMAGE_PATH + '/sidebar-floorplans.png' },
  608 + { title: 'Fluid Power (ISO 1219)', id: 'fluid_power', image: IMAGE_PATH + '/sidebar-fluid_power.png' },
  609 + { title: mxResources.get('gmdl'), id: 'gmdl', image: IMAGE_PATH + '/sidebar-gmdl.png' },
  610 + { title: mxResources.get('procEng'), id: 'pid', image: IMAGE_PATH + '/sidebar-pid.png' },
  611 + { title: 'Threat Modeling', id: 'threatModeling', image: IMAGE_PATH + '/sidebar-threatmodeling.png' },
  612 + { title: 'Web Icons', id: 'webicons', image: IMAGE_PATH + '/sidebar-webIcons.png' },
  613 + { title: mxResources.get('signs'), id: 'signs', image: IMAGE_PATH + '/sidebar-signs.png' }]
  614 + }];
592 615
593 616 // Uses search.xml index file instead (faster load times)
594 617 this.addStencilsToIndex = false;
595   -
  618 +
596 619 // Contains additional tags for shapes
597 620 this.shapetags = {};
598 621
599 622 // Adds tags from compressed text file for improved searches
600   - if (this.tagIndex != null)
601   - {
  623 + if (this.tagIndex != null) {
602 624 this.addTagIndex(Graph.decompress(this.tagIndex));
603   - this.tagIndex = null;
  625 + this.tagIndex = null;
604 626 }
605   -
  627 +
606 628 this.initPalettes();
607 629 }
608   -
  630 +
609 631 /**
610 632 * Overridden to add image export via servlet
611 633 */
612   - if (urlParams['savesidebar'] == '1')
613   - {
614   - Sidebar.prototype.addFoldingHandler = function(title, content, funct)
615   - {
  634 + if (urlParams['savesidebar'] == '1') {
  635 + Sidebar.prototype.addFoldingHandler = function (title, content, funct) {
616 636 var initialized = false;
617   -
  637 +
618 638 // Avoids mixed content warning in IE6-8
619   - if (!mxClient.IS_IE || document.documentMode >= 8)
620   - {
  639 + if (!mxClient.IS_IE || document.documentMode >= 8) {
621 640 title.style.backgroundImage = (content.style.display == 'none') ?
622 641 'url(\'' + this.collapsedImage + '\')' : 'url(\'' + this.expandedImage + '\')';
623 642 }
624   -
  643 +
625 644 title.style.backgroundRepeat = 'no-repeat';
626 645 title.style.backgroundPosition = '0% 50%';
627   -
  646 +
628 647 var btn = document.createElement('button');
629 648 btn.style.marginLeft = '4px';
630 649 mxUtils.write(btn, 'Save');
631   -
632   - mxEvent.addListener(title, 'click', mxUtils.bind(this, function(evt)
633   - {
634   - if (mxEvent.getSource(evt).nodeName == 'BUTTON')
635   - {
  650 +
  651 + mxEvent.addListener(title, 'click', mxUtils.bind(this, function (evt) {
  652 + if (mxEvent.getSource(evt).nodeName == 'BUTTON') {
636 653 var title2 = title.cloneNode(true);
637 654 title2.style.backgroundImage = '';
638 655 title2.style.textDecoration = 'none';
... ... @@ -642,209 +659,177 @@
642 659 title2.style.width = '456px';
643 660 title2.style.backgroundColor = '#ffffff';
644 661 title2.style.paddingLeft = '6px';
645   -
  662 +
646 663 var btn2 = title2.getElementsByTagName('button')[0];
647 664 btn2.parentNode.removeChild(btn2);
648   -
  665 +
649 666 var clone = content.cloneNode(true);
650 667 clone.style.backgroundColor = '#ffffff';
651 668 clone.style.borderColor = 'transparent';
652 669 clone.style.width = '456px';
653   -
  670 +
654 671 var parser = new DOMParser();
655 672 var doc = parser.parseFromString('<body style="background:#ffffff;font-family:Helvetica,Arial;">' +
656   - title2.outerHTML + clone.outerHTML + '</body>', 'text/html');
657   -
658   - this.editorUi.editor.convertImages(doc.documentElement, mxUtils.bind(this, function(body)
659   - {
  673 + title2.outerHTML + clone.outerHTML + '</body>', 'text/html');
  674 +
  675 + this.editorUi.editor.convertImages(doc.documentElement, mxUtils.bind(this, function (body) {
660 676 var html = '<!DOCTYPE html><html><head><link rel="stylesheet" type="text/css" ' +
661 677 'href="https://www.draw.io/styles/grapheditor.css"></head>' +
662 678 mxUtils.getXml(body) + '</html>';
663   -
  679 +
664 680 clone.style.position = 'absolute';
665 681 window.document.body.appendChild(clone);
666 682 var h = clone.clientHeight + 18;
667 683 clone.parentNode.removeChild(clone);
668   -
669   - this.editorUi.confirm('Image data created', mxUtils.bind(this, function()
670   - {
671   - new mxXmlRequest(EXPORT_URL, 'w=456&h=' + h + '&html=' + encodeURIComponent(
672   - Graph.compress(html))).simulate(document, '_blank');
  684 +
  685 + this.editorUi.confirm('Image data created', mxUtils.bind(this, function () {
  686 + new mxXmlRequest(EXPORT_URL, 'w=456&h=' + h + '&html=' + encodeURIComponent(
  687 + Graph.compress(html))).simulate(document, '_blank');
673 688 }), null, mxResources.get('save'), mxResources.get('cancel'));
674 689 }));
675   -
  690 +
676 691 return;
677 692 }
678   -
679   - if (content.style.display == 'none')
680   - {
681   - if (!initialized)
682   - {
  693 +
  694 + if (content.style.display == 'none') {
  695 + if (!initialized) {
683 696 initialized = true;
684   -
685   - if (funct != null)
686   - {
687   - if (btn.parentNode != null)
688   - {
  697 +
  698 + if (funct != null) {
  699 + if (btn.parentNode != null) {
689 700 btn.parentNode.removeChild(btn);
690 701 }
691   -
  702 +
692 703 // Wait cursor does not show up on Mac
693 704 title.style.cursor = 'wait';
694 705 var prev = title.innerHTML;
695 706 title.innerHTML = mxResources.get('loading') + '...';
696   -
697   - window.setTimeout(function()
698   - {
  707 +
  708 + window.setTimeout(function () {
699 709 funct(content);
700 710 title.style.cursor = '';
701 711 title.innerHTML = prev;
702 712 title.appendChild(btn);
703 713 }, 0);
704 714 }
705   - else
706   - {
  715 + else {
707 716 title.appendChild(btn);
708 717 }
709 718 }
710   - else
711   - {
  719 + else {
712 720 title.appendChild(btn);
713 721 }
714   -
  722 +
715 723 title.style.backgroundImage = 'url(\'' + this.expandedImage + '\')';
716 724 content.style.display = 'block';
717 725 }
718   - else
719   - {
  726 + else {
720 727 title.style.backgroundImage = 'url(\'' + this.collapsedImage + '\')';
721 728 content.style.display = 'none';
722   -
723   - if (btn.parentNode != null)
724   - {
  729 +
  730 + if (btn.parentNode != null) {
725 731 btn.parentNode.removeChild(btn);
726 732 }
727 733 }
728   -
  734 +
729 735 mxEvent.consume(evt);
730 736 }));
731 737 };
732 738 };
733   -
  739 +
734 740 /**
735 741 * Overridden to use shapetags to improve search results.
736 742 */
737   - Sidebar.prototype.extractShapeStyle = function(style)
738   - {
739   - if (style != null && style.substring(0, 6) == 'shape=')
740   - {
  743 + Sidebar.prototype.extractShapeStyle = function (style) {
  744 + if (style != null && style.substring(0, 6) == 'shape=') {
741 745 var semi = style.indexOf(';');
742   -
743   - if (semi < 0)
744   - {
  746 +
  747 + if (semi < 0) {
745 748 semi = style.length;
746 749 }
747   -
  750 +
748 751 return style.substring(6, semi);
749 752 }
750   -
  753 +
751 754 return null;
752 755 };
753   -
  756 +
754 757 /**
755 758 * Overridden to use shapetags to improve search results.
756 759 */
757 760 var sidebarGetTagsForStencil = Sidebar.prototype.getTagsForStencil;
758   -
759   - Sidebar.prototype.getTagsForStencil = function(pkg, stc, moreTags)
760   - {
  761 +
  762 + Sidebar.prototype.getTagsForStencil = function (pkg, stc, moreTags) {
761 763 var tags = sidebarGetTagsForStencil.apply(this, arguments);
762   -
  764 +
763 765 // Adds tags from tags file
764   - if (this.shapetags != null)
765   - {
  766 + if (this.shapetags != null) {
766 767 pkg = pkg.toLowerCase();
767 768 stc = stc.toLowerCase();
768   -
769   - if (this.shapetags[pkg] != null)
770   - {
  769 +
  770 + if (this.shapetags[pkg] != null) {
771 771 tags.push(this.shapetags[pkg]);
772 772 }
773   -
  773 +
774 774 stc = pkg + '.' + stc;
775   -
776   - if (this.shapetags[stc] != null)
777   - {
  775 +
  776 + if (this.shapetags[stc] != null) {
778 777 tags.push(this.shapetags[stc]);
779 778 }
780 779 }
781 780
782 781 return tags;
783 782 };
784   -
  783 +
785 784 /**
786 785 * Overrides the sidebar init.
787 786 */
788   - Sidebar.prototype.addTagIndex = function(text)
789   - {
  787 + Sidebar.prototype.addTagIndex = function (text) {
790 788 var lines = text.split('\n');
791   -
792   - for (var i = 0; i < lines.length; i++)
793   - {
794   - if (lines[i] != null)
795   - {
  789 +
  790 + for (var i = 0; i < lines.length; i++) {
  791 + if (lines[i] != null) {
796 792 var tags = lines[i].split('\t');
797   -
798   - if (tags.length > 1)
799   - {
  793 +
  794 + if (tags.length > 1) {
800 795 var key = tags[0].toLowerCase().replace(' ', '_');
801 796 var value = mxUtils.trim(tags.slice(1, tags.length).join(' ').toLowerCase());
802   -
803   - if (value.length > 0)
804   - {
  797 +
  798 + if (value.length > 0) {
805 799 this.shapetags[key] = value;
806 800 }
807 801 }
808 802 }
809 803 }
810 804 };
811   -
  805 +
812 806 /**
813 807 * Adds shape search UI.
814 808 */
815   - Sidebar.prototype.showPopupMenuForEntry = function(elt, libs, evt)
816   - {
817   - if (libs != null && libs.length > 0)
818   - {
  809 + Sidebar.prototype.showPopupMenuForEntry = function (elt, libs, evt) {
  810 + if (libs != null && libs.length > 0) {
819 811 var offset = mxUtils.getOffset(elt);
820   -
821   - this.editorUi.showPopupMenu(mxUtils.bind(this, function(menu, parent)
822   - {
823   - menu.addItem(mxResources.get('openLibrary'), null, mxUtils.bind(this, function()
824   - {
825   - for (var i = 0; i < libs.length; i++)
826   - {
827   - (mxUtils.bind(this, function(lib)
828   - {
  812 +
  813 + this.editorUi.showPopupMenu(mxUtils.bind(this, function (menu, parent) {
  814 + menu.addItem(mxResources.get('openLibrary'), null, mxUtils.bind(this, function () {
  815 + for (var i = 0; i < libs.length; i++) {
  816 + (mxUtils.bind(this, function (lib) {
829 817 var config = this.getConfigurationById(lib.id);
830   -
831   - if (config != null)
832   - {
  818 +
  819 + if (config != null) {
833 820 this.showPalettes(config.prefix || '', config.libs || [config.id], true);
834 821 var elts = this.showPalette(libs[i].lib || libs[i].id, true);
835   -
  822 +
836 823 if (elts != null && elts.length > 1 && elts[1].firstChild != null &&
837 824 (elts[1].firstChild.firstChild == null ||
838   - elts[1].firstChild.style.display == 'none'))
839   - {
  825 + elts[1].firstChild.style.display == 'none')) {
840 826 elts[0].click();
841 827 }
842   -
843   - window.setTimeout(function()
844   - {
  828 +
  829 + window.setTimeout(function () {
845 830 elts[1].scrollIntoView(true);
846 831 }, 0);
847   -
  832 +
848 833 mxEvent.consume(evt);
849 834 }
850 835 }))(libs[i]);
... ... @@ -857,38 +842,31 @@
857 842 /**
858 843 * Overrides the sidebar init.
859 844 */
860   - Sidebar.prototype.addSearchIndex = function(shapes)
861   - {
862   - if (shapes != null)
863   - {
864   - for (var i = 0; i < shapes.length; i++)
865   - {
866   - if (shapes[i].style != null)
867   - {
  845 + Sidebar.prototype.addSearchIndex = function (shapes) {
  846 + if (shapes != null) {
  847 + for (var i = 0; i < shapes.length; i++) {
  848 + if (shapes[i].style != null) {
868 849 var style = shapes[i].style;
869 850 var shapeStyle = this.extractShapeStyle(style);
870   -
871   - if (shapeStyle != null)
872   - {
  851 +
  852 + if (shapeStyle != null) {
873 853 var lastDot = shapeStyle.lastIndexOf('.');
874   -
875   - if (lastDot > 0)
876   - {
  854 +
  855 + if (lastDot > 0) {
877 856 var pkg = shapeStyle.substring(0, lastDot);
878 857 var stc = shapeStyle.substring(lastDot + 1, shapeStyle.length);
879 858 var tags = this.getTagsForStencil(pkg, stc, shapes[i].tags);
880   -
  859 +
881 860 // TODO: Use shapetags for programmatic stencils
882   - if (tags != null)
883   - {
  861 + if (tags != null) {
884 862 // Converts stencil name to lowercase
885 863 var semi = style.indexOf(';');
886 864 style = 'shape=' + pkg + '.' + stc.toLowerCase() + ';' +
887 865 ((semi < 0) ? '' : style.substring(semi + 1));
888 866 this.setCurrentSearchEntryLibrary(shapes[i].id, shapes[i].lib);
889 867 this.createVertexTemplateEntry(style, parseInt(shapes[i].w),
890   - parseInt(shapes[i].h), '', stc.replace(/_/g, ' '),
891   - null, null, this.filterTags(tags.join(' ')));
  868 + parseInt(shapes[i].h), '', stc.replace(/_/g, ' '),
  869 + null, null, this.filterTags(tags.join(' ')));
892 870 this.setCurrentSearchEntryLibrary();
893 871 }
894 872 }
... ... @@ -897,12 +875,11 @@
897 875 }
898 876 }
899 877 };
900   -
  878 +
901 879 /**
902 880 * Overrides the sidebar init.
903 881 */
904   - Sidebar.prototype.initPalettes = function()
905   - {
  882 + Sidebar.prototype.initPalettes = function () {
906 883 var imgDir = GRAPH_IMAGE_PATH;
907 884 var dir = STENCIL_PATH;
908 885 var signs = this.signs;
... ... @@ -910,38 +887,31 @@
910 887 var pids = this.pids;
911 888 var cisco = this.cisco;
912 889 var sysml = this.sysml;
913   -
914   - if (urlParams['createindex'] == '1')
915   - {
  890 +
  891 + if (urlParams['createindex'] == '1') {
916 892 this.createdSearchIndex = [];
917 893 }
918 894
919 895 this.addSearchPalette(true);
920   -
  896 +
921 897 // Adds custom sections first
922   - if (this.customEntries != null)
923   - {
  898 + if (this.customEntries != null) {
924 899 var preloadCount = 0;
925   -
926   - for (var i = 0; i < this.customEntries.length; i++)
927   - {
  900 +
  901 + for (var i = 0; i < this.customEntries.length; i++) {
928 902 var section = this.customEntries[i];
929   -
930   - for (var j = 0; j < section.entries.length; j++)
931   - {
  903 +
  904 + for (var j = 0; j < section.entries.length; j++) {
932 905 var entry = section.entries[j];
933   -
934   - for (var k = 0; k < entry.libs.length; k++)
935   - {
936   - (mxUtils.bind(this, function(lib)
937   - {
  906 +
  907 + for (var k = 0; k < entry.libs.length; k++) {
  908 + (mxUtils.bind(this, function (lib) {
938 909 var data = null;
939 910 var error = null;
940 911 var content = null;
941 912 var title = null;
942   -
943   - var showError = mxUtils.bind(this, function(err, c)
944   - {
  913 +
  914 + var showError = mxUtils.bind(this, function (err, c) {
945 915 var div = document.createElement('span');
946 916 div.style.paddingBottom = '6px';
947 917 div.style.paddingTop = '6px';
... ... @@ -950,144 +920,118 @@
950 920 c.innerHTML = '<img align="top" src="' + mxGraph.prototype.warningImage.src + '"/> ';
951 921 c.appendChild(div);
952 922 });
953   -
954   - var barrier = mxUtils.bind(this, function()
955   - {
956   - if (content != null && title != null)
957   - {
958   - if (error != null)
959   - {
  923 +
  924 + var barrier = mxUtils.bind(this, function () {
  925 + if (content != null && title != null) {
  926 + if (error != null) {
960 927 content.style.display = 'block';
961 928 title.innerHTML = '';
962 929 mxUtils.write(title, this.editorUi.getResource(lib.title));
963 930 showError(error, content);
964 931 }
965   - else if (data != null)
966   - {
  932 + else if (data != null) {
967 933 this.editorUi.addLibraryEntries(data, content);
968 934 content.style.display = 'block';
969 935 title.innerHTML = '';
970 936 mxUtils.write(title, this.editorUi.getResource(lib.title));
971 937 }
972   - else
973   - {
  938 + else {
974 939 content.style.display = 'none';
975 940 title.innerHTML = '';
976 941 mxUtils.write(title, mxResources.get('loading') + '...');
977 942 }
978 943 }
979 944 });
980   -
981   - if (lib.data == null && lib.url != null && (!lib.preload && preloadCount >= this.maxPreloadCount))
982   - {
  945 +
  946 + if (lib.data == null && lib.url != null && (!lib.preload && preloadCount >= this.maxPreloadCount)) {
983 947 this.addPalette(entry.id + '.' + k, this.editorUi.getResource(lib.title),
984   - false, mxUtils.bind(this, function(content, title)
985   - {
986   - var dataLoaded = mxUtils.bind(this, function(images)
987   - {
988   - this.setCurrentSearchEntryLibrary(entry.id, entry.id + '.' + k);
989   - this.addEntries(images);
990   - this.setCurrentSearchEntryLibrary();
991   - this.editorUi.addLibraryEntries(images, content);
992   - });
993   -
994   - content.style.display = 'none';
995   - title.innerHTML = '';
996   - mxUtils.write(title, mxResources.get('loading') + '...');
997   -
998   - var url = lib.url;
999   -
1000   - if (!this.editorUi.editor.isCorsEnabledForUrl(url))
1001   - {
1002   - url = PROXY_URL + '?url=' + encodeURIComponent(url);
1003   - }
1004   -
1005   - this.editorUi.editor.loadUrl(url, mxUtils.bind(this, function(data)
1006   - {
1007   - content.style.display = 'block';
  948 + false, mxUtils.bind(this, function (content, title) {
  949 + var dataLoaded = mxUtils.bind(this, function (images) {
  950 + this.setCurrentSearchEntryLibrary(entry.id, entry.id + '.' + k);
  951 + this.addEntries(images);
  952 + this.setCurrentSearchEntryLibrary();
  953 + this.editorUi.addLibraryEntries(images, content);
  954 + });
  955 +
  956 + content.style.display = 'none';
1008 957 title.innerHTML = '';
1009   - mxUtils.write(title, this.editorUi.getResource(lib.title));
  958 + mxUtils.write(title, mxResources.get('loading') + '...');
  959 +
  960 + var url = lib.url;
  961 +
  962 + if (!this.editorUi.editor.isCorsEnabledForUrl(url)) {
  963 + url = PROXY_URL + '?url=' + encodeURIComponent(url);
  964 + }
1010 965
1011   - try
1012   - {
1013   - var doc = mxUtils.parseXml(data);
1014   -
1015   - if (doc.documentElement.nodeName == 'mxlibrary')
1016   - {
1017   - var images = JSON.parse(mxUtils.getTextContent(doc.documentElement));
1018   - dataLoaded(images);
  966 + this.editorUi.editor.loadUrl(url, mxUtils.bind(this, function (data) {
  967 + content.style.display = 'block';
  968 + title.innerHTML = '';
  969 + mxUtils.write(title, this.editorUi.getResource(lib.title));
  970 +
  971 + try {
  972 + var doc = mxUtils.parseXml(data);
  973 +
  974 + if (doc.documentElement.nodeName == 'mxlibrary') {
  975 + var images = JSON.parse(mxUtils.getTextContent(doc.documentElement));
  976 + dataLoaded(images);
  977 + }
  978 + else {
  979 + showError(mxResources.get('notALibraryFile'), content);
  980 + }
1019 981 }
1020   - else
1021   - {
1022   - showError(mxResources.get('notALibraryFile'), content);
  982 + catch (e) {
  983 + showError(mxResources.get('error') + ': ' + e.message, content);
1023 984 }
1024   - }
1025   - catch (e)
1026   - {
1027   - showError(mxResources.get('error') + ': ' + e.message, content);
1028   - }
  985 + }));
1029 986 }));
1030   - }));
1031 987 }
1032   - else
1033   - {
  988 + else {
1034 989 this.addPalette(entry.id + '.' + k, this.editorUi.getResource(lib.title),
1035   - false, mxUtils.bind(this, function(c, t)
1036   - {
1037   - content = c;
1038   - title = t;
1039   - barrier();
1040   - }));
1041   -
1042   - if (lib.data != null)
1043   - {
  990 + false, mxUtils.bind(this, function (c, t) {
  991 + content = c;
  992 + title = t;
  993 + barrier();
  994 + }));
  995 +
  996 + if (lib.data != null) {
1044 997 this.setCurrentSearchEntryLibrary(entry.id, entry.id + '.' + k);
1045 998 this.addEntries(lib.data);
1046 999 this.setCurrentSearchEntryLibrary();
1047 1000 data = lib.data;
1048 1001 barrier();
1049 1002 }
1050   - else if (lib.url != null)
1051   - {
1052   - preloadCount++;
  1003 + else if (lib.url != null) {
  1004 + preloadCount++;
1053 1005 var url = lib.url;
1054   -
1055   - if (!this.editorUi.editor.isCorsEnabledForUrl(url))
1056   - {
  1006 +
  1007 + if (!this.editorUi.editor.isCorsEnabledForUrl(url)) {
1057 1008 url = PROXY_URL + '?url=' + encodeURIComponent(url);
1058 1009 }
1059   -
1060   - this.editorUi.editor.loadUrl(url, mxUtils.bind(this, function(temp)
1061   - {
1062   - try
1063   - {
  1010 +
  1011 + this.editorUi.editor.loadUrl(url, mxUtils.bind(this, function (temp) {
  1012 + try {
1064 1013 var doc = mxUtils.parseXml(temp);
1065   -
1066   - if (doc.documentElement.nodeName == 'mxlibrary')
1067   - {
  1014 +
  1015 + if (doc.documentElement.nodeName == 'mxlibrary') {
1068 1016 data = JSON.parse(mxUtils.getTextContent(doc.documentElement));
1069 1017 this.addEntries(data);
1070 1018 barrier();
1071 1019 }
1072   - else
1073   - {
  1020 + else {
1074 1021 error = mxResources.get('notALibraryFile');
1075 1022 barrier();
1076 1023 }
1077 1024 }
1078   - catch (e)
1079   - {
  1025 + catch (e) {
1080 1026 error = mxResources.get('error') + ': ' + e.message;
1081 1027 barrier();
1082 1028 }
1083   - }), mxUtils.bind(this, function(e)
1084   - {
  1029 + }), mxUtils.bind(this, function (e) {
1085 1030 error = (e != null && e.message != null) ? e.message : e;
1086 1031 barrier();
1087 1032 }));
1088 1033 }
1089   - else
1090   - {
  1034 + else {
1091 1035 error = mxResources.get('invalidInput');
1092 1036 barrier();
1093 1037 }
... ... @@ -1143,7 +1087,7 @@
1143 1087 'Server_Rack', 'Server_Rack_Empty', 'Server_Rack_Partial',
1144 1088 'Server_Tower', 'Software', 'Stylus', 'Touch', 'USB_Hub',
1145 1089 'Virtual_Application', 'Virtual_Machine', 'Virus',
1146   - 'Workstation' ], [ 'Antivirus', 'Data Filtering', 'Database',
  1090 + 'Workstation'], ['Antivirus', 'Data Filtering', 'Database',
1147 1091 'Database Add', 'Database Minus', 'Database Move Stack',
1148 1092 'Database Remove', 'Fujitsu Tablet', 'Harddrive', 'IBMTablet',
1149 1093 'iMac', 'iPad', 'Laptop', 'MacBook', 'Mainframe', 'Monitor',
... ... @@ -1155,7 +1099,7 @@
1155 1099
1156 1100 this.setCurrentSearchEntryLibrary('clipart', 'finance');
1157 1101 this.addImagePalette('finance', 'Clipart / Finance', imgDir
1158   - + '/lib/clip_art/finance/', '_128x128.png', [ 'Arrow_Down',
  1102 + + '/lib/clip_art/finance/', '_128x128.png', ['Arrow_Down',
1159 1103 'Arrow_Up', 'Coins', 'Credit_Card', 'Dollar', 'Graph',
1160 1104 'Pie_Chart', 'Piggy_Bank', 'Safe', 'Shopping_Cart',
1161 1105 'Stock_Down', 'Stock_Up'], ['Arrow_Down', 'Arrow Up',
... ... @@ -1164,11 +1108,11 @@
1164 1108
1165 1109 this.setCurrentSearchEntryLibrary('clipart', 'clipart');
1166 1110 this.addImagePalette('clipart', 'Clipart / Various', imgDir
1167   - + '/lib/clip_art/general/', '_128x128.png', [ 'Battery_0',
  1111 + + '/lib/clip_art/general/', '_128x128.png', ['Battery_0',
1168 1112 'Battery_100', 'Battery_50', 'Battery_75', 'Battery_allstates',
1169 1113 'Bluetooth', 'Earth_globe', 'Empty_Folder', 'Full_Folder',
1170 1114 'Gear', 'Keys', 'Lock', 'Mouse_Pointer', 'Plug', 'Ships_Wheel',
1171   - 'Star', 'Tire' ], [ 'Battery 0%', 'Battery 100%', 'Battery 50%',
  1115 + 'Star', 'Tire'], ['Battery 0%', 'Battery 100%', 'Battery 50%',
1172 1116 'Battery 75%', 'Battery', 'Bluetooth', 'Globe',
1173 1117 'Empty Folder', 'Full Folder', 'Gear', 'Keys', 'Lock', 'Mousepointer',
1174 1118 'Plug', 'Ships Wheel', 'Star', 'Tire']);
... ... @@ -1176,14 +1120,14 @@
1176 1120 this.setCurrentSearchEntryLibrary('clipart', 'networking');
1177 1121 this.addImagePalette('networking', 'Clipart / Networking', imgDir
1178 1122 + '/lib/clip_art/networking/', '_128x128.png', ['Bridge',
1179   - 'Certificate', 'Certificate_Off', 'Cloud', 'Cloud_Computer',
1180   - 'Cloud_Computer_Private', 'Cloud_Rack', 'Cloud_Rack_Private',
1181   - 'Cloud_Server', 'Cloud_Server_Private', 'Cloud_Storage',
1182   - 'Concentrator', 'Email', 'Firewall_02', 'Firewall',
1183   - 'Firewall-page1', 'Ip_Camera', 'Modem',
1184   - 'power_distribution_unit', 'Print_Server',
1185   - 'Print_Server_Wireless', 'Repeater', 'Router', 'Router_Icon',
1186   - 'Switch', 'UPS', 'Wireless_Router', 'Wireless_Router_N'],
  1123 + 'Certificate', 'Certificate_Off', 'Cloud', 'Cloud_Computer',
  1124 + 'Cloud_Computer_Private', 'Cloud_Rack', 'Cloud_Rack_Private',
  1125 + 'Cloud_Server', 'Cloud_Server_Private', 'Cloud_Storage',
  1126 + 'Concentrator', 'Email', 'Firewall_02', 'Firewall',
  1127 + 'Firewall-page1', 'Ip_Camera', 'Modem',
  1128 + 'power_distribution_unit', 'Print_Server',
  1129 + 'Print_Server_Wireless', 'Repeater', 'Router', 'Router_Icon',
  1130 + 'Switch', 'UPS', 'Wireless_Router', 'Wireless_Router_N'],
1187 1131 ['Bridge', 'Certificate', 'Certificate Off', 'Cloud', 'Cloud Computer',
1188 1132 'Cloud Computer Private', 'Cloud Rack', 'Cloud Rack Private',
1189 1133 'Cloud Server', 'Cloud Server Private', 'Cloud Storage',
... ... @@ -1192,10 +1136,12 @@
1192 1136 'Power Distribution Unit', 'Print Server',
1193 1137 'Print Server Wireless', 'Repeater', 'Router', 'Router Icon',
1194 1138 'Switch', 'UPS', 'Wireless Router', 'Wireless Router N'],
1195   - {'Wireless_Router': 'wireless router switch wap wifi access point wlan',
  1139 + {
  1140 + 'Wireless_Router': 'wireless router switch wap wifi access point wlan',
1196 1141 'Wireless_Router_N': 'wireless router switch wap wifi access point wlan',
1197 1142 'Router': 'router switch',
1198   - 'Router_Icon': 'router switch'});
  1143 + 'Router_Icon': 'router switch'
  1144 + });
1199 1145
1200 1146 this.setCurrentSearchEntryLibrary('clipart', 'people');
1201 1147 this.addImagePalette('people', 'Clipart / People', imgDir
... ... @@ -1226,8 +1172,8 @@
1226 1172 this.setCurrentSearchEntryLibrary('clipart', 'telco');
1227 1173 this.addImagePalette('telco', 'Clipart / Telecommunication', imgDir
1228 1174 + '/lib/clip_art/telecommunication/', '_128x128.png', [
1229   - 'BlackBerry', 'Cellphone', 'HTC_smartphone', 'iPhone',
1230   - 'Palm_Treo', 'Signal_tower_off', 'Signal_tower_on' ],
  1175 + 'BlackBerry', 'Cellphone', 'HTC_smartphone', 'iPhone',
  1176 + 'Palm_Treo', 'Signal_tower_off', 'Signal_tower_on'],
1231 1177 ['BlackBerry', 'Cellphone', 'HTC smartphone', 'iPhone',
1232 1178 'Palm Treo', 'Signaltower off', 'Signaltower on']);
1233 1179 this.setCurrentSearchEntryLibrary();
... ... @@ -1287,46 +1233,41 @@
1287 1233 this.addSignsPalette(signs, dir);
1288 1234 // LATER: Check if conflicts with restore libs after loading file
1289 1235 this.showEntries();
1290   -
1291   - if (this.createdSearchIndex != null)
1292   - {
  1236 +
  1237 + if (this.createdSearchIndex != null) {
1293 1238 console.log('searchFileData', Graph.compress(JSON.stringify(this.createdSearchIndex)));
1294 1239 }
1295 1240 };
1296   -
  1241 +
1297 1242 /**
1298 1243 * Overridden to manually create search index for stencil files which are not pre-loaded
1299 1244 * and no entries are created programmatically.
1300 1245 */
1301   - if (urlParams['createindex'] == '1')
1302   - {
  1246 + if (urlParams['createindex'] == '1') {
1303 1247 var sidebarAddStencilPalette = Sidebar.prototype.addStencilPalette;
1304   -
1305   - Sidebar.prototype.addStencilPalette = function(id, title, stencilFile, style, ignore, onInit, scale, tags, customFns, groupId)
1306   - {
  1248 +
  1249 + Sidebar.prototype.addStencilPalette = function (id, title, stencilFile, style, ignore, onInit, scale, tags, customFns, groupId) {
1307 1250 sidebarAddStencilPalette.apply(this, arguments);
1308 1251 scale = (scale != null) ? scale : 1;
1309   -
  1252 +
1310 1253 // Used for creating index
1311   - mxStencilRegistry.loadStencilSet(stencilFile, mxUtils.bind(this, function(packageName, stencilName, displayName, w, h)
1312   - {
1313   - if (this.createdSearchIndex != null && ignore == null || mxUtils.indexOf(ignore, stencilName) < 0)
1314   - {
1315   - var entry = {style: 'shape=' + packageName + stencilName + style,
1316   - w: Math.round(w * scale), h: Math.round(h * scale)};
  1254 + mxStencilRegistry.loadStencilSet(stencilFile, mxUtils.bind(this, function (packageName, stencilName, displayName, w, h) {
  1255 + if (this.createdSearchIndex != null && ignore == null || mxUtils.indexOf(ignore, stencilName) < 0) {
  1256 + var entry = {
  1257 + style: 'shape=' + packageName + stencilName + style,
  1258 + w: Math.round(w * scale), h: Math.round(h * scale)
  1259 + };
1317 1260 var tmpTags = (tags != null) ? tags[stencilName] : null;
1318   -
1319   - if (tmpTags != null)
1320   - {
  1261 +
  1262 + if (tmpTags != null) {
1321 1263 entry.tags = tmpTags;
1322 1264 }
1323   -
1324   - if (groupId != null)
1325   - {
  1265 +
  1266 + if (groupId != null) {
1326 1267 entry.id = groupId;
1327 1268 entry.lib = id;
1328 1269 }
1329   -
  1270 +
1330 1271 this.createdSearchIndex.push(entry);
1331 1272 }
1332 1273 }), true);
... ... @@ -1336,27 +1277,21 @@
1336 1277 /**
1337 1278 * Extracs icons from the search result.
1338 1279 */
1339   - Sidebar.prototype.extractIconsFromResponse = function(res, results)
1340   - {
1341   - for (var i = 0; i < res.icons.length; i++)
1342   - {
  1280 + Sidebar.prototype.extractIconsFromResponse = function (res, results) {
  1281 + for (var i = 0; i < res.icons.length; i++) {
1343 1282 var sizes = res.icons[i].raster_sizes;
1344 1283 var index = sizes.length - 1;
1345   -
1346   - while (index > 0 && sizes[index].size > 128)
1347   - {
  1284 +
  1285 + while (index > 0 && sizes[index].size > 128) {
1348 1286 index--;
1349 1287 }
1350 1288
1351 1289 var size = sizes[index].size;
1352 1290 var url = sizes[index].formats[0].preview_url;
1353 1291
1354   - if (size != null && url != null)
1355   - {
1356   - (mxUtils.bind(this, function(s, u)
1357   - {
1358   - results.push(mxUtils.bind(this, function()
1359   - {
  1292 + if (size != null && url != null) {
  1293 + (mxUtils.bind(this, function (s, u) {
  1294 + results.push(mxUtils.bind(this, function () {
1360 1295 return this.createVertexTemplate('shape=image;html=1;verticalAlign=top;' +
1361 1296 'verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;imageAspect=0;' +
1362 1297 'aspect=fixed;image=' + u, s, s, '');
... ... @@ -1365,84 +1300,68 @@
1365 1300 }
1366 1301 }
1367 1302 };
1368   -
  1303 +
1369 1304 /**
1370 1305 * Adds server icon results to local search results
1371 1306 */
1372 1307 var sidebarSearchEntries = Sidebar.prototype.searchEntries;
1373   -
1374   - Sidebar.prototype.searchEntries = function(searchTerms, count, page, success, error)
1375   - {
  1308 +
  1309 + Sidebar.prototype.searchEntries = function (searchTerms, count, page, success, error) {
1376 1310 var succ = success;
1377   -
  1311 +
1378 1312 // Lazy-load indices
1379   - if (this.searchIndexData != null)
1380   - {
  1313 + if (this.searchIndexData != null) {
1381 1314 this.addSearchIndex(JSON.parse(Graph.decompress(this.searchIndexData)));
1382 1315 this.searchIndexData = null;
1383 1316 }
1384   -
1385   - if (ICONSEARCH_PATH != null)
1386   - {
1387   - success = mxUtils.bind(this, function(results, len, more, terms)
1388   - {
1389   - if (!this.editorUi.isOffline() && results.length <= count / 4)
1390   - {
  1317 +
  1318 + if (ICONSEARCH_PATH != null) {
  1319 + success = mxUtils.bind(this, function (results, len, more, terms) {
  1320 + if (!this.editorUi.isOffline() && results.length <= count / 4) {
1391 1321 var pg = page - Math.ceil((len - count / 4) / count);
1392   -
  1322 +
1393 1323 mxUtils.get(ICONSEARCH_PATH + '?q=' + encodeURIComponent(searchTerms) +
1394   - '&p=' + pg + '&c=' + count, mxUtils.bind(this, function(req)
1395   - {
1396   - try
1397   - {
1398   - // Ignore response if nothing or error returned
1399   - if (req.getStatus() >= 200 && req.getStatus() <= 299 &&
1400   - req.getText() != null && req.getText().length > 0)
1401   - {
1402   - try
1403   - {
1404   - var res = JSON.parse(req.getText());
1405   -
1406   - if (res == null || res.icons == null)
1407   - {
1408   - succ(results, len, false, terms);
1409   - this.editorUi.handleError(res);
  1324 + '&p=' + pg + '&c=' + count, mxUtils.bind(this, function (req) {
  1325 + try {
  1326 + // Ignore response if nothing or error returned
  1327 + if (req.getStatus() >= 200 && req.getStatus() <= 299 &&
  1328 + req.getText() != null && req.getText().length > 0) {
  1329 + try {
  1330 + var res = JSON.parse(req.getText());
  1331 +
  1332 + if (res == null || res.icons == null) {
  1333 + succ(results, len, false, terms);
  1334 + this.editorUi.handleError(res);
  1335 + }
  1336 + else {
  1337 + this.extractIconsFromResponse(res, results);
  1338 + succ(results, (page - 1) * count + results.length, res.icons.length == count, terms);
  1339 + }
1410 1340 }
1411   - else
1412   - {
1413   - this.extractIconsFromResponse(res, results);
1414   - succ(results, (page - 1) * count + results.length, res.icons.length == count, terms);
  1341 + catch (e) {
  1342 + succ(results, len, false, terms);
  1343 + this.editorUi.handleError(e);
1415 1344 }
1416 1345 }
1417   - catch (e)
1418   - {
  1346 + else {
1419 1347 succ(results, len, false, terms);
1420   - this.editorUi.handleError(e);
1421 1348 }
1422 1349 }
1423   - else
1424   - {
  1350 + catch (e) {
1425 1351 succ(results, len, false, terms);
  1352 + this.editorUi.handleError(e);
1426 1353 }
1427   - }
1428   - catch (e)
1429   - {
1430   - succ(results, len, false, terms);
1431   - this.editorUi.handleError(e);
1432   - }
1433   - },
1434   - function()
1435   - {
1436   - succ(results, len, false, terms);
1437   - }));
  1354 + },
  1355 + function () {
  1356 + succ(results, len, false, terms);
  1357 + }));
1438 1358 }
1439   - else
1440   - {
  1359 + else {
1441 1360 succ(results, len, more || !this.editorUi.isOffline(), terms);
1442 1361 }
1443 1362 });
1444 1363 }
1445   -
  1364 +
1446 1365 sidebarSearchEntries.apply(this, arguments);
1447 1366 };
1448 1367
... ... @@ -1450,27 +1369,22 @@
1450 1369 * Adds a click handler for inserting the cell as target for dangling edge.
1451 1370 */
1452 1371 var sidebarItemClicked = Sidebar.prototype.itemClicked;
1453   -
1454   - Sidebar.prototype.itemClicked = function(cells, ds, evt)
1455   - {
  1372 +
  1373 + Sidebar.prototype.itemClicked = function (cells, ds, evt) {
1456 1374 var graph = this.editorUi.editor.graph;
1457 1375 var handled = false;
1458   -
1459   - if (cells != null && graph.getSelectionCount() == 1 && graph.getModel().isVertex(cells[0]))
1460   - {
  1376 +
  1377 + if (cells != null && graph.getSelectionCount() == 1 && graph.getModel().isVertex(cells[0])) {
1461 1378 var target = graph.cloneCell(cells[0]);
1462   -
  1379 +
1463 1380 // Inserts cell as target of selected edge if not connected
1464 1381 if (graph.getModel().isEdge(graph.getSelectionCell()) && graph.getModel().getTerminal(graph.getSelectionCell(), false) == null &&
1465   - graph.getModel().isVertex(target))
1466   - {
  1382 + graph.getModel().isVertex(target)) {
1467 1383 graph.getModel().beginUpdate();
1468   - try
1469   - {
  1384 + try {
1470 1385 var edgeState = graph.view.getState(graph.getSelectionCell());
1471   -
1472   - if (edgeState != null)
1473   - {
  1386 +
  1387 + if (edgeState != null) {
1474 1388 var tr = graph.view.translate;
1475 1389 var s = graph.view.scale;
1476 1390 var pt = edgeState.absolutePoints[edgeState.absolutePoints.length - 1];
... ... @@ -1478,32 +1392,28 @@
1478 1392 target.geometry.x = pt.x / s - tr.x - target.geometry.width / 2;
1479 1393 target.geometry.y = pt.y / s - tr.y - target.geometry.height / 2;
1480 1394 }
1481   -
  1395 +
1482 1396 graph.addCell(target);
1483 1397 graph.getModel().setTerminal(graph.getSelectionCell(), target, false);
1484   -
1485   - if (evt == null || !mxEvent.isShiftDown(evt))
1486   - {
  1398 +
  1399 + if (evt == null || !mxEvent.isShiftDown(evt)) {
1487 1400 graph.fireEvent(new mxEventObject('cellsInserted', 'cells', [target]));
1488 1401 }
1489 1402 }
1490   - catch (e)
1491   - {
  1403 + catch (e) {
1492 1404 this.editorUi.handleError(e);
1493 1405 }
1494   - finally
1495   - {
  1406 + finally {
1496 1407 graph.getModel().endUpdate();
1497 1408 }
1498   -
  1409 +
1499 1410 graph.scrollCellToVisible(target);
1500 1411 graph.setSelectionCell(target);
1501 1412 handled = true;
1502 1413 }
1503 1414 }
1504   -
1505   - if (!handled)
1506   - {
  1415 +
  1416 + if (!handled) {
1507 1417 sidebarItemClicked.apply(this, arguments);
1508 1418 }
1509 1419 };
... ...
... ... @@ -8,13 +8,20 @@
8 8 this.createVertexTemplateEntry('text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;', 100, 40, '变量', '变量', null, null, '变量'),
9 9 this.createEdgeTemplateEntry('shape=filledEdge;rounded=1;fixDash=1;endArrow=none;strokeWidth=10;fillColor=none;edgeStyle=orthogonalEdgeStyle;flowAnimation=1;strokeColor=#6666FF;endFill=1;metaEdit=0;backgroundOutline=0;', 60, 40, '', '线条'),
10 10 this.addEntry('real time', mxUtils.bind(this, function () {
11   - const template = `<div class="thingKit-component__real-time"><div class="real-time__date">%currentDate%</div> <div style="font-size:30px" class="real-time__now">%date{HH:MM:ss}%</div></div>`
  11 + // const template = `<div class="thingKit-component__real-time"><div class="real-time__date">%currentDate%</div> <div style="font-size:30px" class="real-time__now">%date{HH:MM:ss}%</div></div>`
  12 + const template = `<div class="thingKit-component__real-time"><div class="real-time__date"></div> <div style="font-size:30px" class="real-time__now">时间</div></div>`
12 13 const cell = new mxCell(template, new mxGeometry(0, 0, 180, 60), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;');
13 14 cell.vertex = true;
14 15 this.graph.setAttributeForCell(cell, 'placeholders', '1');
15 16 this.graph.setAttributeForCell(cell, 'currentDate', currentDate);
16   - return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, 'realTime');
  17 + return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, '实时时间');
17 18 })),
  19 + this.addEntry(this.getTagsForStencil('mxgraph.basic', '变量图片', 'basic').join(' '), mxUtils.bind(this, function () {
  20 + const cell = new mxCell('', new mxGeometry(0, 0, 194, 95), 'image;image=images/thingskit/img-placeholder.png;imageAspect=0;');
  21 + cell.setVertex(true)
  22 + this.setCellAttributes(cell, { componentType: 'variableImage' })
  23 + return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, '变量图片');
  24 + }))
18 25 ];
19 26
20 27 this.addPaletteFunctions('component', '基础元件', true, fns);
... ... @@ -31,4 +38,19 @@
31 38 var day = date.getDay();
32 39 return year + '年' + month + '月' + dates + '日 ' + arr[day];
33 40 }
  41 +
  42 + /**
  43 + * @description 初始化实时事件组件
  44 + */
  45 + function initRealTimeComponent() {
  46 + RAFSetInterval(() => {
  47 + const allTimeNode = document.querySelectorAll('.thingKit-component__real-time .real-time__now')
  48 + for (const time of allTimeNode) {
  49 + const date = new Date()
  50 + time.innerHTML = `${date.getHours() < 10 ? '0' : ''}${date.getHours()}:${date.getMinutes() < 10 ? '0' : ''}${date.getMinutes()}:${date.getSeconds() < 10 ? '0' : ''}${date.getSeconds()}`
  51 + }
  52 + }, 1000)
  53 + }
  54 +
  55 + initRealTimeComponent()
34 56 })();
... ...
... ... @@ -21,12 +21,12 @@
21 21 this.addEntry('line chart', mxUtils.bind(this, function () {
22 22 const id = self.generatorChartsId()
23 23 const cell = self.generatorCell(id, enumConst.CHART_IMG_PLACEHOLDER_SIZE, enumConst.CHART_IMG_PLACEHOLDER_SIZE, enumChartType.LINE_CHART)
24   - return this.createVertexTemplateFromCells([ cell ], cell.geometry.width, cell.geometry.height, '折线图');
  24 + return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, '折线图');
25 25 })),
26 26 this.addEntry('bar chart', mxUtils.bind(this, function () {
27 27 const id = self.generatorChartsId()
28 28 const cell = self.generatorCell(id, enumConst.CHART_IMG_PLACEHOLDER_SIZE, enumConst.CHART_IMG_PLACEHOLDER_SIZE, enumChartType.BAR_CHART, '/thingskit-drawio/images/thingskit/bar-chart.png')
29   - return this.createVertexTemplateFromCells([ cell ], cell.geometry.width, cell.geometry.height, '柱状图');
  29 + return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, '柱状图');
30 30 })),
31 31 ];
32 32
... ... @@ -43,7 +43,7 @@
43 43
44 44 /**
45 45 * @description Sidebar 类型枚举
46   - * @type {{CHART_CELL_DEFAULT_WIDTH: number, CHART_CELL_HEIGHT: string, CHART_CELL_DEFAULT_HEIGHT: number, CHART_TYPE_KEY: string, CHART_CELL_WIDTH: string, CHART_COMP: string, CHART_CELL_ID: string, CHART_CONTAINER_ID_PREFIX: string, CHART_IMG_PLACEHOLDER_SIZE: number, COMPONENTS_TYPE_KEY: string, CHART_CONTAINER_CLS: string}}
  46 + * @type {{CHART_CELL_DEFAULT_WIDTH: number, CHART_CELL_HEIGHT: string, CHART_CELL_DEFAULT_HEIGHT: number, CHART_TYPE_KEY: string, CHART_CELL_WIDTH: string, CHART_COMP: string, CHART_CELL_ID: string, CHART_CONTAINER_ID_PREFIX: string, CHART_IMG_PLACEHOLDER_SIZE: number, COMPONENT_TYPE_KEY: string, CHART_CONTAINER_CLS: string}}
47 47 */
48 48 Sidebar.prototype.enumConst = {
49 49
... ... @@ -70,7 +70,7 @@
70 70 /**
71 71 * @description cell 类型是否为 charts
72 72 */
73   - CHART_COMP: 'charts',
  73 + CHART_COMP: Sidebar.prototype.enumComponentType.CHARTS,
74 74
75 75 /**
76 76 * @description cell id key
... ... @@ -80,7 +80,7 @@
80 80 /**
81 81 * @description 组件类型 key
82 82 */
83   - COMPONENTS_TYPE_KEY: 'componentsType',
  83 + COMPONENT_TYPE_KEY: Sidebar.prototype.enumCellBasicAttribute.COMPONENT_TYPE,
84 84
85 85 /**
86 86 * @description 图表容器 class name
... ... @@ -121,14 +121,14 @@
121 121 return {
122 122 xAxis: {
123 123 type: 'category',
124   - data: [ 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun' ],
  124 + data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
125 125 },
126 126 yAxis: {
127 127 type: 'value',
128 128 },
129 129 series: [
130 130 {
131   - data: [ 150, 230, 224, 218, 135, 147, 260 ],
  131 + data: [150, 230, 224, 218, 135, 147, 260],
132 132 type: 'line',
133 133 },
134 134 ],
... ... @@ -138,14 +138,14 @@
138 138 return {
139 139 xAxis: {
140 140 type: 'category',
141   - data: [ 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun' ],
  141 + data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
142 142 },
143 143 yAxis: {
144 144 type: 'value',
145 145 },
146 146 series: [
147 147 {
148   - data: [ 120, 200, 150, 80, 70, 110, 130 ],
  148 + data: [120, 200, 150, 80, 70, 110, 130],
149 149 type: 'bar',
150 150 showBackground: true,
151 151 backgroundStyle: {
... ... @@ -170,7 +170,7 @@
170 170 const enumConst = this.enumConst
171 171 const cell = new mxCell(this.createChartsNode(id, width, height, placeholderPath), new mxGeometry(0, 0, width, height), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;');
172 172 cell.setVertex(true)
173   - this.graph.setAttributeForCell(cell, enumConst.COMPONENTS_TYPE_KEY, 'charts');
  173 + this.graph.setAttributeForCell(cell, enumConst.COMPONENT_TYPE_KEY, 'charts');
174 174 this.graph.setAttributeForCell(cell, enumConst.CHART_CELL_ID, id);
175 175 this.graph.setAttributeForCell(cell, enumConst.CHART_CELL_WIDTH, width)
176 176 this.graph.setAttributeForCell(cell, enumConst.CHART_CELL_HEIGHT, height)
... ... @@ -185,7 +185,7 @@
185 185 */
186 186 Sidebar.prototype.generatorChartsId = function () {
187 187 const enumConst = Sidebar.prototype.enumConst
188   - return `${ enumConst.CHART_CONTAINER_ID_PREFIX }${ Date.now() }`
  188 + return `${enumConst.CHART_CONTAINER_ID_PREFIX}${Date.now()}`
189 189 }
190 190
191 191 /**
... ... @@ -197,7 +197,7 @@
197 197 * @returns {string}
198 198 */
199 199 Sidebar.prototype.createChartsNode = function (id, width = 400, height = 400, placeholderPath = '/thingskit-drawio/images/thingskit/line-chart.png') {
200   - return `<div class="echarts__instance" style="width: ${ width }px; height: ${ height }px" id="${ id }"><img src="${ placeholderPath }" alt=""></div>`
  200 + return `<div class="echarts__instance" style="width: ${width}px; height: ${height}px" id="${id}"><img src="${placeholderPath}" alt=""></div>`
201 201 }
202 202
203 203 /**
... ... @@ -207,8 +207,8 @@
207 207 */
208 208 Sidebar.prototype.isChartCell = function (cell) {
209 209 const enumConst = Sidebar.prototype.enumConst
210   - const componentsType = cell.getAttribute(enumConst.COMPONENTS_TYPE_KEY)
211   - return !!(componentsType && componentsType === enumConst.CHART_COMP)
  210 + const componentType = cell.getAttribute(enumConst.COMPONENT_TYPE_KEY)
  211 + return !!(componentType && componentType === enumConst.CHART_COMP)
212 212 }
213 213
214 214 /**
... ... @@ -222,8 +222,8 @@
222 222 const chartOptionMapping = this.chartOptionMapping
223 223 const chartsInstanceMapping = this.chartsInstanceMapping
224 224 const chartDom = document.getElementById(id);
225   - chartDom.style.width = `${ width }px`
226   - chartDom.style.height = `${ height }px`
  225 + chartDom.style.width = `${width}px`
  226 + chartDom.style.height = `${height}px`
227 227 const myChart = echarts.init(chartDom);
228 228 const option = chartOptionMapping[chartType] ? chartOptionMapping[chartType]() : {}
229 229 option && myChart.setOption(option);
... ... @@ -304,8 +304,8 @@
304 304 const { width, height } = rect
305 305 const id = self.getCellId(cell)
306 306 const chartDom = document.getElementById(id)
307   - chartDom.style.width = `${ width }px`
308   - chartDom.style.height = `${ height }px`
  307 + chartDom.style.width = `${width}px`
  308 + chartDom.style.height = `${height}px`
309 309 self.graph.setAttributeForCell(cell, enumConst.CHART_CELL_WIDTH, width)
310 310 self.graph.setAttributeForCell(cell, enumConst.CHART_CELL_HEIGHT, height)
311 311 const instance = chartsInstanceMapping.get(id)
... ... @@ -338,7 +338,7 @@
338 338 if (validateFlag) {
339 339 const cell = self.generatorCell(id, enumConst.CHART_CELL_DEFAULT_WIDTH, enumConst.CHART_CELL_DEFAULT_HEIGHT, chartType)
340 340 const _arguments = Array.prototype.slice.call(arguments, 0)
341   - _arguments.splice(1, 1, [ cell ])
  341 + _arguments.splice(1, 1, [cell])
342 342 createTooltip.apply(this, _arguments)
343 343 } else {
344 344 createTooltip.apply(this, arguments)
... ... @@ -366,7 +366,7 @@
366 366 domIdMapping.set(chartInstanceId, { width, height, chartType })
367 367 }
368 368 }
369   - const chartsDomList = document.querySelectorAll(`.${ enumConst.CHART_CONTAINER_CLS }`)
  369 + const chartsDomList = document.querySelectorAll(`.${enumConst.CHART_CONTAINER_CLS}`)
370 370 for (const chartDom of chartsDomList) {
371 371 const id = chartDom.getAttribute('id')
372 372 if (!domIdMapping.has(id)) {
... ...
1   -(function()
2   -{
  1 +(function () {
3 2 // Adds Atlassian shapes
4   - // 发动机
5   - Sidebar.prototype.addEnginePalette = function()
6   - {
7   - var gn = 'mxgraph.engine';
8   - var dt = 'engine ';
9   - this.setCurrentSearchEntryLibrary('engine');
  3 + // engine 发动机
  4 + Sidebar.prototype.addEnginePalette = function () {
  5 + const gn = 'mxgraph.engine';
  6 + const dt = 'engine';
  7 + const label = '发动机'
  8 + const width = 66;
  9 + const height = 74;
  10 + const staticPath = '/thingskit-drawio/img/lib/thingskit/'
  11 + const prefix = 'image;image=img/lib/thingskit/'
  12 + const defaultStyle = ';imageAspect=0;'
  13 + this.setCurrentSearchEntryLibrary(dt);
10 14
11   - var fns = [
12   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/engine/3-D 发动机.svg;imageAspect=0;',
13   - 66, 66, '', '3-D 发动机', null, null, this.getTagsForStencil(gn, '3-D 发动机', dt).join(' ')),
14   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/engine/步进电机驱动器.svg;imageAspect=0;',
15   - 64, 74, '', '步进电机驱动器', null, null, this.getTagsForStencil(gn, '步进电机驱动器', dt).join(' ')),
16   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/engine/伺服电机.svg;imageAspect=0;',
17   - 64, 74, '', '伺服电机', null, null, this.getTagsForStencil(gn, '伺服电机', dt).join(' ')),
18   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/engine/伺服电机2.svg;imageAspect=0;',
19   - 64, 74, '', '伺服电机2', null, null, this.getTagsForStencil(gn, '伺服电机2', dt).join(' ')),
20   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/engine/促动器.svg;imageAspect=0;',
21   - 64, 74, '', '促动机', null, null, this.getTagsForStencil(gn, '促动器', dt).join(' ')),
22   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/engine/发动机 1.svg;imageAspect=0;',
23   - 64, 74, '', '发动机 1', null, null, this.getTagsForStencil(gn, '发动机 1', dt).join(' ')),
24   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/engine/发动机 2.svg;imageAspect=0;',
25   - 64, 74, '', '发动机 2', null, null, this.getTagsForStencil(gn, '发动机 2', dt).join(' ')),
26   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/engine/发动机 3.svg;imageAspect=0;',
27   - 64, 74, '', '发动机 3', null, null, this.getTagsForStencil(gn, '发动机 3', dt).join(' ')),
28   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/engine/发动机 4.svg;imageAspect=0;',
29   - 64, 74, '', '发动机 4', null, null, this.getTagsForStencil(gn, '发动机 4', dt).join(' ')),
30   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/engine/防爆电动机.svg;imageAspect=0;',
31   - 64, 74, '', '防爆电动机', null, null, this.getTagsForStencil(gn, '防爆电动机', dt).join(' ')),
32   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/engine/工业标准发动机.svg;imageAspect=0;',
33   - 64, 74, '', '工业标准发动机', null, null, this.getTagsForStencil(gn, '工业标准发动机', dt).join(' ')),
34   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/engine/减速器.svg;imageAspect=0;',
35   - 64, 74, '', '减速器', null, null, this.getTagsForStencil(gn, '减速器', dt).join(' ')),
36   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/engine/简单马达.svg;imageAspect=0;',
37   - 64, 74, '', '简单马达', null, null, this.getTagsForStencil(gn, '简单马达', dt).join(' ')),
38   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/engine/气压制动器.svg;imageAspect=0;',
39   - 64, 74, '', '气压制动器', null, null, this.getTagsForStencil(gn, '气压制动器', dt).join(' ')),
40   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/engine/无刷电机.svg;imageAspect=0;',
41   - 64, 74, '', '无刷电机', null, null, this.getTagsForStencil(gn, '无刷电机', dt).join(' ')),
42   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/engine/制动马达.svg;imageAspect=0;',
43   - 64, 74, '', '制动马达', null, null, this.getTagsForStencil(gn, '制动马达', dt).join(' ')),
44   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/engine/智能马达.svg;imageAspect=0;',
45   - 64, 74, '', '智能马达', null, null, this.getTagsForStencil(gn, '智能马达', dt).join(' ')),
46   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/engine/轴角编码器.svg;imageAspect=0;',
47   - 64, 74, '', '轴角编码器', null, null, this.getTagsForStencil(gn, '轴角编码器', dt).join(' ')),
  15 + // 自定义属性
  16 + const cellAttribute = {}
  17 +
  18 + const graphPathLib = [
  19 + { name: '3-D 发动机.svg', path: 'engine/3-D 发动机.svg' },
  20 + { name: '伺服电机.svg', path: 'engine/伺服电机.svg' },
  21 + { name: '伺服电机2.svg', path: 'engine/伺服电机2.svg' },
  22 + { name: '促动器.svg', path: 'engine/促动器.svg' },
  23 + { name: '减速器.svg', path: 'engine/减速器.svg' },
  24 + { name: '制动马达.svg', path: 'engine/制动马达.svg' },
  25 + { name: '发动机 1.svg', path: 'engine/发动机 1.svg' },
  26 + { name: '发动机 2.svg', path: 'engine/发动机 2.svg' },
  27 + { name: '发动机 3.svg', path: 'engine/发动机 3.svg' },
  28 + { name: '发动机 4.svg', path: 'engine/发动机 4.svg' },
  29 + { name: '工业标准发动机.svg', path: 'engine/工业标准发动机.svg' },
  30 + { name: '无刷电机.svg', path: 'engine/无刷电机.svg' },
  31 + { name: '智能马达.svg', path: 'engine/智能马达.svg' },
  32 + { name: '步进电机驱动器.svg', path: 'engine/步进电机驱动器.svg' },
  33 + { name: '气压制动器.svg', path: 'engine/气压制动器.svg' },
  34 + { name: '简单马达.svg', path: 'engine/简单马达.svg' },
  35 + { name: '轴角编码器.svg', path: 'engine/轴角编码器.svg' },
  36 + { name: '防爆电动机.svg', path: 'engine/防爆电动机.svg' },
  37 + ]
  38 +
  39 + const lib = graphPathLib.map(item => {
  40 + item.staticPath = staticPath + item.path
  41 + return item
  42 + })
  43 +
  44 + const fns = graphPathLib.map(item => {
  45 + return this.addEntry(this.getTagsForStencil(gn, item.name, dt).join(' '), mxUtils.bind(this, function () {
  46 + const cell = new mxCell('', new mxGeometry(0, 0, width, height), `${ prefix }${ item.path }${ defaultStyle }`);
  47 + cell.setVertex(true)
  48 + this.setCellAttributes(cell, cellAttribute)
  49 + return this.createVertexTemplateFromCells([ cell ], cell.geometry.width, cell.geometry.height, item.name);
  50 + }));
  51 + })
  52 +
  53 + this.setVariableImageLib(dt, label, lib)
  54 +
  55 + this.addPaletteFunctions(dt, label, false, fns);
48 56
49   - ];
50   - this.addPaletteFunctions('engine', '发动机', false, fns);
51 57 this.setCurrentSearchEntryLibrary();
52 58 };
53 59 })();
... ...
1   -(function()
2   -{
  1 +
  2 +(function () {
3 3 // Adds Atlassian shapes
4   - // 风机
5   - Sidebar.prototype.addFanPalette = function()
6   - {
7   - var gn = 'mxgraph.fan';
8   - var dt = 'fan';
9   - var width = 66;
10   - var height = 74;
11   - this.setCurrentSearchEntryLibrary('fan');
  4 + // fan
  5 + Sidebar.prototype.addFanPalette = function () {
  6 + const gn = 'mxgraph.fan';
  7 + const dt = 'fan';
  8 + const label = '风机'
  9 + const width = 66;
  10 + const height = 74;
  11 + const staticPath = '/thingskit-drawio/img/lib/thingskit/'
  12 + const prefix = 'image;image=img/lib/thingskit/'
  13 + const defaultStyle = ';imageAspect=0;'
  14 + this.setCurrentSearchEntryLibrary(dt);
  15 +
  16 + const graphPathLib = [
  17 + { name: '风机1.png', path: 'fan/风机1.png' },
  18 + { name: '风机2.png', path: 'fan/风机2.png' },
  19 + { name: '风机3.png', path: 'fan/风机3.png' },
  20 + { name: '风机4.png', path: 'fan/风机4.png' },
  21 + { name: '风机5.gif', path: 'fan/风机5.gif' },
  22 + { name: '风机6.gif', path: 'fan/风机6.gif' },
  23 + { name: '风机7.gif', path: 'fan/风机7.gif' },
  24 + { name: '风机8.png', path: 'fan/风机8.png' },
  25 + ]
  26 +
  27 + const lib = graphPathLib.map(item => {
  28 + item.staticPath = staticPath + item.path
  29 + return item
  30 + })
  31 +
  32 + const fns = graphPathLib.map(item => {
  33 + return this.createVertexTemplateEntry(`${ prefix }${ item.path }${ defaultStyle }`, width, height, '', item.name, null, null, this.getTagsForStencil(gn, item.name, dt).join(' '))
  34 + })
12 35
13   - var fns = [
14   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/fan/风机1.png;imageAspect=0;',
15   - width, height, '', '风机1', null, null, this.getTagsForStencil(gn, '风机1', dt).join(' ')),
16   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/fan/风机2.png;imageAspect=0;',
17   - width, height, '', '风机2', null, null, this.getTagsForStencil(gn, '风机2', dt).join(' ')),
18   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/fan/风机3.png;imageAspect=0;',
19   - width, height, '', '风机3', null, null, this.getTagsForStencil(gn, '风机3', dt).join(' ')),
20   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/fan/风机4.png;imageAspect=0;',
21   - width, height, '', '风机4', null, null, this.getTagsForStencil(gn, '风机4', dt).join(' ')),
22   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/fan/风机5.gif;imageAspect=0;',
23   - width, height, '', '风机5', null, null, this.getTagsForStencil(gn, '风机5', dt).join(' ')),
24   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/fan/风机6.gif;imageAspect=0;',
25   - width, height, '', '风机6', null, null, this.getTagsForStencil(gn, '风机6', dt).join(' ')),
26   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/fan/风机7.gif;imageAspect=0;',
27   - width, height, '', '风机7', null, null, this.getTagsForStencil(gn, '风机7', dt).join(' ')),
28   - this.createVertexTemplateEntry('image;image=img/lib/thingskit/fan/风机8.png;imageAspect=0;',
29   - width, height, '', '风机8', null, null, this.getTagsForStencil(gn, '风机8', dt).join(' ')),
30   - ];
  36 + this.setVariableImageLib(dt, label, lib)
31 37
32   - this.addPalette('fan', '风机', false, mxUtils.bind(this, function(content)
33   - {
34   - for (var i = 0; i < fns.length; i++)
35   - {
36   - content.appendChild(fns[i](content));
37   - }
38   - }));
  38 + this.addPaletteFunctions(dt, label, false, fns);
39 39
40 40 this.setCurrentSearchEntryLibrary();
41 41 };
... ...
... ... @@ -704,9 +704,9 @@ BaseFormatPanel.prototype.installInputHandler = function (
704 704 new mxEventObject(
705 705 "styleChanged",
706 706 "keys",
707   - [ key ],
  707 + [key],
708 708 "values",
709   - [ value ],
  709 + [value],
710 710 "cells",
711 711 cells,
712 712 ),
... ... @@ -1087,9 +1087,9 @@ BaseFormatPanel.prototype.createCellOption = function (
1087 1087 new mxEventObject(
1088 1088 "styleChanged",
1089 1089 "keys",
1090   - [ key ],
  1090 + [key],
1091 1091 "values",
1092   - [ value ],
  1092 + [value],
1093 1093 "cells",
1094 1094 temp,
1095 1095 ),
... ... @@ -1344,9 +1344,9 @@ BaseFormatPanel.prototype.createCellColorOption = function (
1344 1344 new mxEventObject(
1345 1345 "styleChanged",
1346 1346 "keys",
1347   - [ colorKey ],
  1347 + [colorKey],
1348 1348 "values",
1349   - [ color ],
  1349 + [color],
1350 1350 "cells",
1351 1351 cells,
1352 1352 ),
... ... @@ -1523,9 +1523,9 @@ BaseFormatPanel.prototype.createRelativeOption = function (
1523 1523 new mxEventObject(
1524 1524 "styleChanged",
1525 1525 "keys",
1526   - [ key ],
  1526 + [key],
1527 1527 "values",
1528   - [ value ],
  1528 + [value],
1529 1529 "cells",
1530 1530 cells,
1531 1531 ),
... ... @@ -1885,9 +1885,9 @@ ArrangePanel.prototype.addTable = function (div) {
1885 1885 var count = 0;
1886 1886
1887 1887 if (ss.mergeCell != null) {
1888   - count += this.addActions(div, [ "mergeCells" ]);
  1888 + count += this.addActions(div, ["mergeCells"]);
1889 1889 } else if (ss.style["colspan"] > 1 || ss.style["rowspan"] > 1) {
1890   - count += this.addActions(div, [ "unmergeCells" ]);
  1890 + count += this.addActions(div, ["unmergeCells"]);
1891 1891 }
1892 1892
1893 1893 if (count > 0) {
... ... @@ -1904,8 +1904,8 @@ ArrangePanel.prototype.addTable = function (div) {
1904 1904 *
1905 1905 */
1906 1906 ArrangePanel.prototype.addLayerOps = function (div) {
1907   - this.addActions(div, [ "toFront", "toBack" ]);
1908   - this.addActions(div, [ "bringForward", "sendBackward" ]);
  1907 + this.addActions(div, ["toFront", "toBack"]);
  1908 + this.addActions(div, ["bringForward", "sendBackward"]);
1909 1909
1910 1910 return div;
1911 1911 };
... ... @@ -1925,8 +1925,8 @@ ArrangePanel.prototype.addGroupOps = function (div) {
1925 1925
1926 1926 if (!ss.cell && !ss.row) {
1927 1927 count +=
1928   - this.addActions(div, [ "group", "ungroup", "copySize", "pasteSize" ]) +
1929   - this.addActions(div, [ "removeFromGroup" ]);
  1928 + this.addActions(div, ["group", "ungroup", "copySize", "pasteSize"]) +
  1929 + this.addActions(div, ["removeFromGroup"]);
1930 1930 }
1931 1931
1932 1932 var copyBtn = null;
... ... @@ -2023,7 +2023,7 @@ ArrangePanel.prototype.addGroupOps = function (div) {
2023 2023 }
2024 2024
2025 2025 if (graph.getSelectionCount() == 1) {
2026   - count += this.addActions(div, [ "editData", "editLink" ]);
  2026 + count += this.addActions(div, ["editData", "editLink"]);
2027 2027 }
2028 2028
2029 2029 if (count == 0) {
... ... @@ -2103,12 +2103,12 @@ ArrangePanel.prototype.addAlign = function (div) {
2103 2103 stylePanel,
2104 2104 );
2105 2105
2106   - this.styleButtons([ left, center, right, top, middle, bottom ]);
  2106 + this.styleButtons([left, center, right, top, middle, bottom]);
2107 2107 right.style.marginRight = "10px";
2108 2108 }
2109 2109
2110 2110 div.appendChild(stylePanel);
2111   - this.addActions(div, [ "snapToGrid" ]);
  2111 + this.addActions(div, ["snapToGrid"]);
2112 2112
2113 2113 return div;
2114 2114 };
... ... @@ -2797,9 +2797,9 @@ ArrangePanel.prototype.addEdgeGeometry = function (container) {
2797 2797 new mxEventObject(
2798 2798 "styleChanged",
2799 2799 "keys",
2800   - [ "width" ],
  2800 + ["width"],
2801 2801 "values",
2802   - [ value ],
  2802 + [value],
2803 2803 "cells",
2804 2804 cells,
2805 2805 ),
... ... @@ -3030,7 +3030,7 @@ TextFormatPanel.prototype.addFont = function (container) {
3030 3030 var stylePanel2 = stylePanel.cloneNode(false);
3031 3031 stylePanel2.style.marginLeft = "-3px";
3032 3032 var fontStyleItems = this.editorUi.toolbar.addItems(
3033   - [ "bold", "italic", "underline" ],
  3033 + ["bold", "italic", "underline"],
3034 3034 stylePanel2,
3035 3035 true,
3036 3036 );
... ... @@ -3057,7 +3057,7 @@ TextFormatPanel.prototype.addFont = function (container) {
3057 3057 );
3058 3058
3059 3059 var verticalItem = this.editorUi.toolbar.addItems(
3060   - [ "vertical" ],
  3060 + ["vertical"],
3061 3061 stylePanel2,
3062 3062 true,
3063 3063 )[0];
... ... @@ -3065,7 +3065,7 @@ TextFormatPanel.prototype.addFont = function (container) {
3065 3065 container.appendChild(stylePanel2);
3066 3066
3067 3067 this.styleButtons(fontStyleItems);
3068   - this.styleButtons([ verticalItem ]);
  3068 + this.styleButtons([verticalItem]);
3069 3069
3070 3070 var stylePanel3 = stylePanel.cloneNode(false);
3071 3071 stylePanel3.style.marginLeft = "-3px";
... ... @@ -3088,9 +3088,9 @@ TextFormatPanel.prototype.addFont = function (container) {
3088 3088 new mxEventObject(
3089 3089 "styleChanged",
3090 3090 "keys",
3091   - [ mxConstants.STYLE_ALIGN ],
  3091 + [mxConstants.STYLE_ALIGN],
3092 3092 "values",
3093   - [ mxConstants.ALIGN_LEFT ],
  3093 + [mxConstants.ALIGN_LEFT],
3094 3094 "cells",
3095 3095 ss.cells,
3096 3096 ),
... ... @@ -3098,8 +3098,8 @@ TextFormatPanel.prototype.addFont = function (container) {
3098 3098 }
3099 3099 : callFn(
3100 3100 this.editorUi.menus.createStyleChangeFunction(
3101   - [ mxConstants.STYLE_ALIGN ],
3102   - [ mxConstants.ALIGN_LEFT ],
  3101 + [mxConstants.STYLE_ALIGN],
  3102 + [mxConstants.ALIGN_LEFT],
3103 3103 ),
3104 3104 ),
3105 3105 stylePanel3,
... ... @@ -3114,9 +3114,9 @@ TextFormatPanel.prototype.addFont = function (container) {
3114 3114 new mxEventObject(
3115 3115 "styleChanged",
3116 3116 "keys",
3117   - [ mxConstants.STYLE_ALIGN ],
  3117 + [mxConstants.STYLE_ALIGN],
3118 3118 "values",
3119   - [ mxConstants.ALIGN_CENTER ],
  3119 + [mxConstants.ALIGN_CENTER],
3120 3120 "cells",
3121 3121 ss.cells,
3122 3122 ),
... ... @@ -3124,8 +3124,8 @@ TextFormatPanel.prototype.addFont = function (container) {
3124 3124 }
3125 3125 : callFn(
3126 3126 this.editorUi.menus.createStyleChangeFunction(
3127   - [ mxConstants.STYLE_ALIGN ],
3128   - [ mxConstants.ALIGN_CENTER ],
  3127 + [mxConstants.STYLE_ALIGN],
  3128 + [mxConstants.ALIGN_CENTER],
3129 3129 ),
3130 3130 ),
3131 3131 stylePanel3,
... ... @@ -3140,9 +3140,9 @@ TextFormatPanel.prototype.addFont = function (container) {
3140 3140 new mxEventObject(
3141 3141 "styleChanged",
3142 3142 "keys",
3143   - [ mxConstants.STYLE_ALIGN ],
  3143 + [mxConstants.STYLE_ALIGN],
3144 3144 "values",
3145   - [ mxConstants.ALIGN_RIGHT ],
  3145 + [mxConstants.ALIGN_RIGHT],
3146 3146 "cells",
3147 3147 ss.cells,
3148 3148 ),
... ... @@ -3150,14 +3150,14 @@ TextFormatPanel.prototype.addFont = function (container) {
3150 3150 }
3151 3151 : callFn(
3152 3152 this.editorUi.menus.createStyleChangeFunction(
3153   - [ mxConstants.STYLE_ALIGN ],
3154   - [ mxConstants.ALIGN_RIGHT ],
  3153 + [mxConstants.STYLE_ALIGN],
  3154 + [mxConstants.ALIGN_RIGHT],
3155 3155 ),
3156 3156 ),
3157 3157 stylePanel3,
3158 3158 );
3159 3159
3160   - this.styleButtons([ left, center, right ]);
  3160 + this.styleButtons([left, center, right]);
3161 3161
3162 3162 // Quick hack for strikethrough
3163 3163 // TODO: Add translations and toggle state
... ... @@ -3170,14 +3170,14 @@ TextFormatPanel.prototype.addFont = function (container) {
3170 3170 },
3171 3171 stylePanel2,
3172 3172 );
3173   - this.styleButtons([ strike ]);
  3173 + this.styleButtons([strike]);
3174 3174
3175 3175 strike.firstChild.style.background =
3176 3176 "url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PGRlZnM+PHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjR2MjRIMFYweiIvPjwvZGVmcz48Y2xpcFBhdGggaWQ9ImIiPjx1c2UgeGxpbms6aHJlZj0iI2EiIG92ZXJmbG93PSJ2aXNpYmxlIi8+PC9jbGlwUGF0aD48cGF0aCBjbGlwLXBhdGg9InVybCgjYikiIGZpbGw9IiMwMTAxMDEiIGQ9Ik03LjI0IDguNzVjLS4yNi0uNDgtLjM5LTEuMDMtLjM5LTEuNjcgMC0uNjEuMTMtMS4xNi40LTEuNjcuMjYtLjUuNjMtLjkzIDEuMTEtMS4yOS40OC0uMzUgMS4wNS0uNjMgMS43LS44My42Ni0uMTkgMS4zOS0uMjkgMi4xOC0uMjkuODEgMCAxLjU0LjExIDIuMjEuMzQuNjYuMjIgMS4yMy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NS0uMTEtLjExLS4yMy0uMTctLjMzSDIxeiIvPjwvc3ZnPg==)";
3177 3177 strike.firstChild.style.backgroundPosition = "2px 2px";
3178 3178 strike.firstChild.style.backgroundSize = "18px 18px";
3179 3179
3180   - this.styleButtons([ strike ]);
  3180 + this.styleButtons([strike]);
3181 3181 }
3182 3182
3183 3183 var top = this.editorUi.toolbar.addButton(
... ... @@ -3185,8 +3185,8 @@ TextFormatPanel.prototype.addFont = function (container) {
3185 3185 mxResources.get("top"),
3186 3186 callFn(
3187 3187 this.editorUi.menus.createStyleChangeFunction(
3188   - [ mxConstants.STYLE_VERTICAL_ALIGN ],
3189   - [ mxConstants.ALIGN_TOP ],
  3188 + [mxConstants.STYLE_VERTICAL_ALIGN],
  3189 + [mxConstants.ALIGN_TOP],
3190 3190 ),
3191 3191 ),
3192 3192 stylePanel3,
... ... @@ -3196,8 +3196,8 @@ TextFormatPanel.prototype.addFont = function (container) {
3196 3196 mxResources.get("middle"),
3197 3197 callFn(
3198 3198 this.editorUi.menus.createStyleChangeFunction(
3199   - [ mxConstants.STYLE_VERTICAL_ALIGN ],
3200   - [ mxConstants.ALIGN_MIDDLE ],
  3199 + [mxConstants.STYLE_VERTICAL_ALIGN],
  3200 + [mxConstants.ALIGN_MIDDLE],
3201 3201 ),
3202 3202 ),
3203 3203 stylePanel3,
... ... @@ -3207,14 +3207,14 @@ TextFormatPanel.prototype.addFont = function (container) {
3207 3207 mxResources.get("bottom"),
3208 3208 callFn(
3209 3209 this.editorUi.menus.createStyleChangeFunction(
3210   - [ mxConstants.STYLE_VERTICAL_ALIGN ],
3211   - [ mxConstants.ALIGN_BOTTOM ],
  3210 + [mxConstants.STYLE_VERTICAL_ALIGN],
  3211 + [mxConstants.ALIGN_BOTTOM],
3212 3212 ),
3213 3213 ),
3214 3214 stylePanel3,
3215 3215 );
3216 3216
3217   - this.styleButtons([ top, middle, bottom ]);
  3217 + this.styleButtons([top, middle, bottom]);
3218 3218
3219 3219 container.appendChild(stylePanel3);
3220 3220
... ... @@ -3441,7 +3441,7 @@ TextFormatPanel.prototype.addFont = function (container) {
3441 3441
3442 3442 // NOTE: For automatic we use the value null since automatic
3443 3443 // requires the text to be non formatted and non-wrapped
3444   - var dirs = [ "automatic", "leftToRight", "rightToLeft" ];
  3444 + var dirs = ["automatic", "leftToRight", "rightToLeft"];
3445 3445 var dirSet = {
3446 3446 automatic: null,
3447 3447 leftToRight: mxConstants.TEXT_DIRECTION_LTR,
... ... @@ -3568,9 +3568,9 @@ TextFormatPanel.prototype.addFont = function (container) {
3568 3568 new mxEventObject(
3569 3569 "styleChanged",
3570 3570 "keys",
3571   - [ mxConstants.STYLE_FONTSIZE ],
  3571 + [mxConstants.STYLE_FONTSIZE],
3572 3572 "values",
3573   - [ fontSize ],
  3573 + [fontSize],
3574 3574 "cells",
3575 3575 ss.cells,
3576 3576 ),
... ... @@ -3696,9 +3696,9 @@ TextFormatPanel.prototype.addFont = function (container) {
3696 3696 new mxEventObject(
3697 3697 "styleChanged",
3698 3698 "keys",
3699   - [ mxConstants.STYLE_LABEL_BACKGROUNDCOLOR ],
  3699 + [mxConstants.STYLE_LABEL_BACKGROUNDCOLOR],
3700 3700 "values",
3701   - [ color ],
  3701 + [color],
3702 3702 "cells",
3703 3703 ss.cells,
3704 3704 ),
... ... @@ -3775,9 +3775,9 @@ TextFormatPanel.prototype.addFont = function (container) {
3775 3775 new mxEventObject(
3776 3776 "styleChanged",
3777 3777 "keys",
3778   - [ mxConstants.STYLE_FONTCOLOR ],
  3778 + [mxConstants.STYLE_FONTCOLOR],
3779 3779 "values",
3780   - [ color ],
  3780 + [color],
3781 3781 "cells",
3782 3782 ss.cells,
3783 3783 ),
... ... @@ -3829,9 +3829,9 @@ TextFormatPanel.prototype.addFont = function (container) {
3829 3829 new mxEventObject(
3830 3830 "styleChanged",
3831 3831 "keys",
3832   - [ mxConstants.STYLE_FONTCOLOR ],
  3832 + [mxConstants.STYLE_FONTCOLOR],
3833 3833 "values",
3834   - [ color ],
  3834 + [color],
3835 3835 "cells",
3836 3836 ss.cells,
3837 3837 ),
... ... @@ -4029,7 +4029,7 @@ TextFormatPanel.prototype.addFont = function (container) {
4029 4029 while (
4030 4030 node != null &&
4031 4031 node.nodeType != mxConstants.NODETYPE_ELEMENT
4032   - ) {
  4032 + ) {
4033 4033 node = node.parentNode;
4034 4034 }
4035 4035
... ... @@ -4083,7 +4083,7 @@ TextFormatPanel.prototype.addFont = function (container) {
4083 4083 var insertPanel = stylePanel.cloneNode(false);
4084 4084 insertPanel.style.paddingLeft = "0px";
4085 4085 var insertBtns = this.editorUi.toolbar.addItems(
4086   - [ "link", "image" ],
  4086 + ["link", "image"],
4087 4087 insertPanel,
4088 4088 true,
4089 4089 );
... ... @@ -4754,7 +4754,7 @@ TextFormatPanel.prototype.addFont = function (container) {
4754 4754 tableCell =
4755 4755 currentTable == null
4756 4756 ? null
4757   - : graph.getParentByNames(node, [ "TD", "TH" ], currentTable);
  4757 + : graph.getParentByNames(node, ["TD", "TH"], currentTable);
4758 4758 tableWrapper.style.display = currentTable != null ? "" : "none";
4759 4759
4760 4760 if (document.activeElement != input) {
... ... @@ -4878,11 +4878,12 @@ DataFormatPanel.prototype.addDataFont = function (container) {
4878 4878 const graph = editor.graph;
4879 4879 const ss = ui.getSelectionState();
4880 4880 const vertices = ss.vertices || []
4881   -
4882   - console.log(Sidebar.prototype)
  4881 + const sidebarInstance = ui.sidebar
4883 4882 // console.log(this.editorUi)
4884 4883 console.log(vertices)
  4884 + console.log(ui)
4885 4885
  4886 + const hasModifyNotSave = editor.status
4886 4887
4887 4888 // console.log(vertices[0]?.get('bindType'))
4888 4889 /**
... ... @@ -4899,7 +4900,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
4899 4900 const graphId = vertices[0].id;
4900 4901
4901 4902 // 解构全局属性layui要用到的模块
4902   - const { layer, form, jquery: $ } = layui;
  4903 + const { layer, form, jquery: $, colorpicker, upload, element } = layui;
4903 4904
4904 4905 const CONTAINER_FILTER = 'containerFilter'
4905 4906 $(container).addClass('layui-form').attr('lay-filter', CONTAINER_FILTER)
... ... @@ -4941,13 +4942,25 @@ DataFormatPanel.prototype.addDataFont = function (container) {
4941 4942 let currentNodeData = null
4942 4943
4943 4944 /**
  4945 + * @description 保存页面信息
  4946 + */
  4947 + async function autoSaveGraphInfo() {
  4948 + if (!hasModifyNotSave) return
  4949 + ui.actions.get(
  4950 + (ui.currentFile.mode == null || !ui.currentFile.isEditable())
  4951 + ? 'saveAs'
  4952 + : 'save')
  4953 + .funct();
  4954 + }
  4955 +
  4956 + /**
4944 4957 * @description 获取弹出层绑定信息
4945   - * @param {'DOWN' | 'UP' | 'SINGLE' | 'DOUBLE' | 'DISPLAY' | 'FLASH' | 'ROTATE'} type - 类型
  4958 + * @param {'DOWN' | 'UP' | 'SINGLE' | 'DOUBLE' | 'DISPLAY' | 'FLASH' | 'ROTATE' | 'IMAGE'} type - 类型
4946 4959 * @param {'event' | 'act' } category - 类别
4947 4960 */
4948 4961 function getLayerBindInfo(category, type) {
4949 4962 if (currentNodeData) {
4950   - return currentNodeData[category]?.find(item => item.type === type)
  4963 + return currentNodeData[category]?.find(item => item.type === type) || {}
4951 4964 }
4952 4965 return {}
4953 4966 }
... ... @@ -4956,6 +4969,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
4956 4969 ACT: 'act',
4957 4970 EVENT: 'event',
4958 4971 DATA_SOURCE: 'dataSources',
  4972 + FUNCTION: 'function',
4959 4973 }
4960 4974
4961 4975 const enumInteractionType = {
... ... @@ -4969,6 +4983,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
4969 4983 DISPLAY: 'DISPLAY',
4970 4984 FLASH: 'FLASH',
4971 4985 ROTATE: 'ROTATE',
  4986 + IMAGE: 'IMAGE',
4972 4987 }
4973 4988
4974 4989
... ... @@ -5011,8 +5026,21 @@ DataFormatPanel.prototype.addDataFont = function (container) {
5011 5026 type: enumDynamicEffectType.ROTATE,
5012 5027 category: enumCategory.ACT,
5013 5028 },
  5029 + {
  5030 + label: '设置变量值图片',
  5031 + type: enumDynamicEffectType.IMAGE,
  5032 + category: enumCategory.ACT,
  5033 + },
5014 5034 ];
5015 5035
  5036 + // const functionList = [
  5037 + // {
  5038 + // label: '设置变量值图片',
  5039 + // type: enumFunctionType.VAR_IMAGE,
  5040 + // category: enumCategory.FUNCTION,
  5041 + // },
  5042 + // ]
  5043 +
5016 5044 const enumDataSourceConst = {
5017 5045 ORG_ID: 'orgId',
5018 5046 DEVICE_ID: 'deviceId',
... ... @@ -5021,18 +5049,22 @@ DataFormatPanel.prototype.addDataFont = function (container) {
5021 5049 GATEWAY: 'GATEWAY',
5022 5050 }
5023 5051
5024   - let echoRefreshFn = null
  5052 + /**
  5053 + * @description 刷新页面
  5054 + */
  5055 + function echoRefreshFn() {
  5056 + }
5025 5057
5026 5058
5027 5059 // 获取url的请求参数函数
5028 5060 function getRequest() {
5029   - var url = location.search; //获取url中"?"符后的字串
5030   - var theRequest = new Object();
  5061 + let url = location.search; //获取url中"?"符后的字串
  5062 + let theRequest = new Object();
5031 5063 if (url.indexOf("?") != -1) {
5032 5064 var str = url.substring(1);
5033   - strs = str.split("&");
5034   - for (var i = 0; i < strs.length; i++) {
5035   - theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
  5065 + string = str.split("&");
  5066 + for (var i = 0; i < string.length; i++) {
  5067 + theRequest[string[i].split("=")[0]] = decodeURI(string[i].split("=")[1]);
5036 5068 }
5037 5069 }
5038 5070 return theRequest;
... ... @@ -5064,6 +5096,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
5064 5096 createInteractionPanel()
5065 5097 createDynamicEffectPanel()
5066 5098 createSubmitPanel()
  5099 + UseLayUi.nextTick(() => form.render())
5067 5100 }
5068 5101
5069 5102 initNode();
... ... @@ -5074,36 +5107,11 @@ DataFormatPanel.prototype.addDataFont = function (container) {
5074 5107 */
5075 5108 async function getNodeBindInfo() {
5076 5109 const { id } = nodeInfo
5077   - const [ err, res ] = await to(ConfigurationNodeApi.getConfigurationInfo('NODE', id))
  5110 + const [err, res] = await to(ConfigurationNodeApi.getConfigurationInfo('NODE', id))
5078 5111 currentNodeData = res
5079 5112 if (echoRefreshFn && typeof echoRefreshFn === 'function') echoRefreshFn()
5080 5113 }
5081 5114
5082   -
5083   - /**
5084   - * @description 生成数据交互面板
5085   - * @returns {Array}
5086   - */
5087   - function generateDataEventNode() {
5088   - const eventList = []
5089   - const eventNodeCls = 'interaction__container'
5090   - for (const item of interactionList) {
5091   - const checkbox = UseLayUi.createCheckBox({
5092   - dataSource: item,
5093   - layFilter: item.type,
5094   - valueField: 'type',
5095   - labelField: 'label',
5096   - })
5097   - const template = `
5098   - <div class="${ eventNodeCls }">
5099   - ${ checkbox }
5100   - <i id="${ item.type }"></i>
5101   - </div>`
5102   - eventList.push(template)
5103   - }
5104   - return eventList
5105   - }
5106   -
5107 5115 /**
5108 5116 * @description 生成操作节点
5109 5117 * @param {object[]} list
... ... @@ -5114,14 +5122,14 @@ DataFormatPanel.prototype.addDataFont = function (container) {
5114 5122 for (const item of list) {
5115 5123 const checkbox = UseLayUi.createCheckBox({
5116 5124 dataSource: item,
5117   - layFilter: item.checkboxName,
  5125 + layFilter: item.type,
5118 5126 valueField: 'type',
5119 5127 labelField: 'label',
5120 5128 })
5121 5129 const template = `
5122   - <div class="${ eventNodeCls }">
5123   - ${ checkbox }
5124   - <i id="${ item.type }"></i>
  5130 + <div class="${eventNodeCls}">
  5131 + <div>${checkbox}</div>
  5132 + <i id="${item.type}"></i>
5125 5133 </div>`
5126 5134 eventList.push(template)
5127 5135 }
... ... @@ -5132,230 +5140,293 @@ DataFormatPanel.prototype.addDataFont = function (container) {
5132 5140 /**
5133 5141 * @description 创建数据源模块
5134 5142 */
5135   - function createDataSourcePanel() {
5136   - const enumActionEl = {
5137   - ORG_EL: 'dataSourceOrg',
5138   - DEVICE_EL: 'dataSourceDevice',
5139   - SLAVE_DEVICE_EL: 'dataSourceSlaveDevice',
5140   - ATTR_EL: 'dataSourceAttr',
5141   - }
  5143 + // function createDataSourcePanel() {
  5144 + // const enumActionEl = {
  5145 + // ORG_EL: 'dataSourceOrg',
  5146 + // DEVICE_EL: 'dataSourceDevice',
  5147 + // SLAVE_DEVICE_EL: 'dataSourceSlaveDevice',
  5148 + // ATTR_EL: 'dataSourceAttr',
  5149 + // }
  5150 + //
  5151 + // const fragment = document.createDocumentFragment()
  5152 + // const defaultPanel = createPanel()
  5153 + // const title = createTitle('数据源')
  5154 + // let orgPanel, devicePanel, slaveDevicePanel, attrsPanel;
  5155 + // $(title).addClass('override__title--default')
  5156 + // $(defaultPanel).addClass('override__panel--default')
  5157 + //
  5158 + // /**
  5159 + // * @description 设备列表
  5160 + // */
  5161 + // let deviceList = []
  5162 + //
  5163 + //
  5164 + // /**
  5165 + // * @description 生成组织选择
  5166 + // */
  5167 + // async function generatorOrgTres() {
  5168 + // orgPanel = defaultPanel.cloneNode(false)
  5169 + // const orgContainer = `<div id="${ enumActionEl.ORG_EL }"></div>`
  5170 + // $(orgPanel).append(orgContainer)
  5171 + //
  5172 + // const [ err, res ] = await to(ConfigurationNodeApi.getOrgTree())
  5173 + // if (err) return
  5174 + // treeList = res
  5175 + //
  5176 + // UseLayUi.createTreeSelect({
  5177 + // elem: `#${ enumActionEl.ORG_EL }`,
  5178 + // layFilter: enumDataSourceConst.ORG_ID,
  5179 + // className: 'data-source__org--override',
  5180 + // label: '组织',
  5181 + // singleUsage: false,
  5182 + // treeProps: {
  5183 + // data: treeList,
  5184 + // onlyIconControl: true,
  5185 + // click(node) {
  5186 + // currentCheckedOrgNode = node.data.id
  5187 + // getDevicesByOrgId(node.data.id)
  5188 + // },
  5189 + // },
  5190 + // })
  5191 + // }
  5192 + //
  5193 + //
  5194 + // /**
  5195 + // * @description 生成设备选择器
  5196 + // */
  5197 + // function generatorDeviceSelect() {
  5198 + // devicePanel = defaultPanel.cloneNode(false)
  5199 + // const deviceSelect = UseLayUi.createSelect({
  5200 + // label: '设备',
  5201 + // layFilter: enumDataSourceConst.DEVICE_ID,
  5202 + // className: 'data-panel__select',
  5203 + // })
  5204 + // $(devicePanel).attr('id', enumActionEl.DEVICE_EL).append(deviceSelect)
  5205 + // }
  5206 + //
  5207 + // /**
  5208 + // * @description 生成从设备选择器
  5209 + // */
  5210 + // function generatorSlaveDevice() {
  5211 + // slaveDevicePanel = defaultPanel.cloneNode(false)
  5212 + // const slaveDeviceSelect = UseLayUi.createSelect({
  5213 + // label: '子设备',
  5214 + // layFilter: enumDataSourceConst.SLAVE_DEVICE_ID,
  5215 + // className: 'data-panel__select',
  5216 + // onClick(data) {
  5217 + // const { value } = data
  5218 + // getAttrByDeviceId(value)
  5219 + // },
  5220 + // })
  5221 + // $(slaveDevicePanel).css({ display: 'none' }).attr('id', enumActionEl.SLAVE_DEVICE_EL).append(slaveDeviceSelect)
  5222 + // }
  5223 + //
  5224 + // /**
  5225 + // * @description 生成属性选择器
  5226 + // */
  5227 + // function generatorAttrSelect() {
  5228 + // attrsPanel = defaultPanel.cloneNode(false)
  5229 + // const attrsSelect = UseLayUi.createSelect({
  5230 + // label: '属性',
  5231 + // layFilter: enumDataSourceConst.ATTR,
  5232 + // className: 'data-panel__select',
  5233 + // })
  5234 + // $(attrsPanel).attr('id', enumActionEl.ATTR_EL).append(attrsSelect)
  5235 + //
  5236 + // }
  5237 + //
  5238 + //
  5239 + // /**
  5240 + // * @description 根据组织ID获取设备
  5241 + // */
  5242 + // async function getDevicesByOrgId(organizationId) {
  5243 + // if (organizationId) {
  5244 + // const items = deviceList = await ConfigurationNodeApi.getMasterDevice(organizationId);
  5245 + // $(`#${ enumActionEl.DEVICE_EL }`).find('select').html(UseLayUi.generateOptionTemplate({ dataSource: items }))
  5246 + // form.render('select', CONTAINER_FILTER)
  5247 + // }
  5248 + // }
  5249 + //
  5250 + // /**
  5251 + // * @description 通过主设备ID获取从设备
  5252 + // */
  5253 + // async function getSlaveDeviceByMasterDeviceId(orgId, deviceId) {
  5254 + // if (deviceId && currentCheckedOrgNode) {
  5255 + // const items = await ConfigurationNodeApi.getSlaveDevice(orgId, deviceId);
  5256 + // $(`#${ enumActionEl.SLAVE_DEVICE_EL }`).find('select').html(UseLayUi.generateOptionTemplate({ dataSource: items }))
  5257 + // form.render('select', CONTAINER_FILTER)
  5258 + // }
  5259 + // }
  5260 + //
  5261 + // /**
  5262 + // * @description 根据设备ID获取属性
  5263 + // */
  5264 + // async function getAttrByDeviceId(tbDeviceId) {
  5265 + // if (tbDeviceId) {
  5266 + // const [ err, res ] = await to(ConfigurationNodeApi.getDeviceAttr(tbDeviceId))
  5267 + // $(`#${ enumActionEl.ATTR_EL }`).find('select').html(UseLayUi.generateOptionTemplate({ dataSource: res }))
  5268 + // form.render('select', CONTAINER_FILTER)
  5269 + // }
  5270 + // }
  5271 + //
  5272 + //
  5273 + // /**
  5274 + // * @description 数据回显
  5275 + // */
  5276 + // async function echoData() {
  5277 + //
  5278 + // echoRefreshFn = () => {
  5279 + // echoDataSource()
  5280 + // echoActionType()
  5281 + // form.render(null, CONTAINER_FILTER)
  5282 + // }
  5283 + //
  5284 + // await getNodeBindInfo()
  5285 + //
  5286 + //
  5287 + // function echoDataSource() {
  5288 + // const { dataSources = [] } = currentNodeData || {}
  5289 + // const [ dataSource = {} ] = dataSources
  5290 + // const { orgId, deviceId, slaveDeviceId, attr } = dataSource
  5291 + // const queue = []
  5292 + // if (orgId) {
  5293 + // currentCheckedOrgNode = orgId
  5294 + // queue.push(getDevicesByOrgId(orgId))
  5295 + // }
  5296 + // if (slaveDeviceId) {
  5297 + // queue.push(getSlaveDeviceByMasterDeviceId(orgId, deviceId))
  5298 + // $(`#${ enumActionEl.SLAVE_DEVICE_EL }`).css({ display: 'block' })
  5299 + // queue.push(getAttrByDeviceId(slaveDeviceId))
  5300 + // } else {
  5301 + // queue.push(getAttrByDeviceId(deviceId))
  5302 + // }
  5303 + // Promise.all(queue)
  5304 + // .finally(() => {
  5305 + // const orgNode = UseLayUi.findTreeObjectByField(treeList, currentCheckedOrgNode)
  5306 + // $(`#${ enumActionEl.ORG_EL } input[name="${ enumDataSourceConst.ORG_ID }"]`).parent().find('span').html(orgNode?.name)
  5307 + // form.val(CONTAINER_FILTER, {
  5308 + // orgId,
  5309 + // deviceId,
  5310 + // slaveDeviceId,
  5311 + // attr,
  5312 + // })
  5313 + // })
  5314 + // }
  5315 + //
  5316 + // async function echoActionType() {
  5317 + // const act = currentNodeData.act ?? []
  5318 + // const event = currentNodeData.event ?? []
  5319 + // const actionType = {}
  5320 + // for (const item of act) {
  5321 + // if (!item.condition || !item.condition?.length) {
  5322 + // $(`.interaction__container input[name="${ item.type }"]`).attr('disabled', true)
  5323 + // } else {
  5324 + // $(`.interaction__container input[name="${ item.type }"]`).attr('disabled', false)
  5325 + // }
  5326 + // actionType[item.type] = item.enabled
  5327 + // }
  5328 + // for (const item of event) {
  5329 + // if (!item.content) {
  5330 + // $(`.interaction__container input[name="${ item.type }"]`).attr('disabled', true)
  5331 + // } else {
  5332 + // $(`.interaction__container input[name="${ item.type }"]`).attr('disabled', false)
  5333 + // }
  5334 + // actionType[item.type] = item.enabled
  5335 + // }
  5336 + // form.val(CONTAINER_FILTER, actionType)
  5337 + // }
  5338 + // }
  5339 + //
  5340 + // function mount() {
  5341 + // generatorOrgTres()
  5342 + // generatorDeviceSelect()
  5343 + // generatorSlaveDevice()
  5344 + // generatorAttrSelect()
  5345 + // echoData()
  5346 + //
  5347 + // $(fragment).append(title).append(orgPanel).append(devicePanel).append(slaveDevicePanel).append(attrsPanel)
  5348 + //
  5349 + // $(container).append(fragment)
  5350 + //
  5351 + // }
  5352 + //
  5353 + // mount()
  5354 + //
  5355 + // }
5142 5356
  5357 + /**
  5358 + * @description 创建数据面板
  5359 + */
  5360 + function createDataSourcePanel() {
5143 5361 const fragment = document.createDocumentFragment()
5144 5362 const defaultPanel = createPanel()
5145 5363 const title = createTitle('数据源')
5146   - let orgPanel, devicePanel, slaveDevicePanel, attrsPanel;
5147   - $(title).addClass('override__title--default')
5148 5364 $(defaultPanel).addClass('override__panel--default')
5149   -
5150   - /**
5151   - * @description 设备列表
5152   - */
5153   - let deviceList = []
5154   -
5155   -
5156   - /**
5157   - * @description 生成组织选择
5158   - */
5159   - async function generatorOrgTres() {
5160   - orgPanel = defaultPanel.cloneNode(false)
5161   - const orgContainer = `<div id="${ enumActionEl.ORG_EL }"></div>`
5162   - $(orgPanel).append(orgContainer)
5163   -
5164   - const [ err, res ] = await to(ConfigurationNodeApi.getOrgTree())
5165   - if (err) return
5166   - treeList = res
5167   -
5168   - UseLayUi.createTreeSelect({
5169   - elem: `#${ enumActionEl.ORG_EL }`,
5170   - layFilter: enumDataSourceConst.ORG_ID,
5171   - className: 'data-source__org--override',
5172   - label: '组织',
5173   - singleUsage: false,
5174   - treeProps: {
5175   - data: treeList,
5176   - onlyIconControl: true,
5177   - click(node) {
5178   - currentCheckedOrgNode = node.data.id
5179   - getDevicesByOrgId(node.data.id)
5180   - },
5181   - },
5182   - })
5183   - }
5184   -
5185   - /**
5186   - * @description 生成设备选择器
5187   - */
5188   - function generatorDeviceSelect() {
5189   - devicePanel = defaultPanel.cloneNode(false)
5190   - const deviceSelect = UseLayUi.createSelect({
5191   - label: '设备',
5192   - layFilter: enumDataSourceConst.DEVICE_ID,
5193   - className: 'data-panel__select',
5194   - onClick(data) {
5195   - const { value } = data
5196   - const selected = deviceList.find(item => item.id === value)
5197   - if (selected.deviceType === enumDataSourceConst.GATEWAY) {
5198   - $(`#${ enumActionEl.SLAVE_DEVICE_EL }`).css({ display: 'block' })
5199   - getSlaveDeviceByMasterDeviceId(currentCheckedOrgNode, selected.id)
5200   - } else {
5201   - $(`#${ enumActionEl.SLAVE_DEVICE_EL }`).css({ display: 'none' })
5202   - getAttrByDeviceId(selected.id)
5203   - }
5204   - },
5205   - })
5206   - $(devicePanel).attr('id', enumActionEl.DEVICE_EL).append(deviceSelect)
5207   - }
5208   -
5209   - /**
5210   - * @description 生成从设备选择器
5211   - */
5212   - function generatorSlaveDevice() {
5213   - slaveDevicePanel = defaultPanel.cloneNode(false)
5214   - const slaveDeviceSelect = UseLayUi.createSelect({
5215   - label: '子设备',
5216   - layFilter: enumDataSourceConst.SLAVE_DEVICE_ID,
5217   - className: 'data-panel__select',
5218   - onClick(data) {
5219   - const { value } = data
5220   - getAttrByDeviceId(value)
5221   - },
5222   - })
5223   - $(slaveDevicePanel).css({ display: 'none' }).attr('id', enumActionEl.SLAVE_DEVICE_EL).append(slaveDeviceSelect)
5224   - }
5225   -
5226   - /**
5227   - * @description 生成属性选择器
5228   - */
5229   - function generatorAttrSelect() {
5230   - attrsPanel = defaultPanel.cloneNode(false)
5231   - const attrsSelect = UseLayUi.createSelect({
5232   - label: '属性',
5233   - layFilter: enumDataSourceConst.ATTR,
5234   - className: 'data-panel__select',
5235   - })
5236   - $(attrsPanel).attr('id', enumActionEl.ATTR_EL).append(attrsSelect)
5237   -
5238   - }
5239   -
5240   -
5241   - /**
5242   - * @description 根据组织ID获取设备
5243   - */
5244   - async function getDevicesByOrgId(organizationId) {
5245   - if (organizationId) {
5246   - const items = deviceList = await ConfigurationNodeApi.getMasterDevice(organizationId);
5247   - $(`#${ enumActionEl.DEVICE_EL }`).find('select').html(UseLayUi.generateOptionTemplate({ dataSource: items }))
5248   - form.render('select', CONTAINER_FILTER)
5249   - }
5250   - }
5251   -
5252   - /**
5253   - * @description 通过主设备ID获取从设备
5254   - */
5255   - async function getSlaveDeviceByMasterDeviceId(orgId, deviceId) {
5256   - if (deviceId && currentCheckedOrgNode) {
5257   - const items = await ConfigurationNodeApi.getSlaveDevice(orgId, deviceId);
5258   - $(`#${ enumActionEl.SLAVE_DEVICE_EL }`).find('select').html(UseLayUi.generateOptionTemplate({ dataSource: items }))
5259   - form.render('select', CONTAINER_FILTER)
5260   - }
5261   - }
5262   -
5263   - /**
5264   - * @description 根据设备ID获取属性
5265   - */
5266   - async function getAttrByDeviceId(tbDeviceId) {
5267   - if (tbDeviceId) {
5268   - const [ err, res ] = await to(ConfigurationNodeApi.getDeviceAttr(tbDeviceId))
5269   - $(`#${ enumActionEl.ATTR_EL }`).find('select').html(UseLayUi.generateOptionTemplate({ dataSource: res }))
5270   - form.render('select', CONTAINER_FILTER)
5271   - }
5272   - }
  5365 + $(title).css({ padding: '6px 0 6px 6px' })
5273 5366
5274 5367
5275   - /**
5276   - * @description 数据回显
5277   - */
5278   - async function echoData() {
  5368 + async function mount() {
  5369 + const { component, echoDataSource } = generatorDataSourceComponent({ validate: false })
  5370 + $(fragment).append(title).append(component)
  5371 + $(container).append(fragment)
5279 5372
5280   - echoRefreshFn = () => {
5281   - echoDataSource()
  5373 + /**
  5374 + * @description 回显数据
  5375 + * @type {Function}
  5376 + */
  5377 + const refreshFn = echoRefreshFn
  5378 + echoRefreshFn = function () {
  5379 + refreshFn.apply(this)
  5380 + const { dataSources: [dataSource] = [] } = currentNodeData || {}
  5381 + echoDataSource(dataSource)
5282 5382 echoActionType()
5283 5383 form.render(null, CONTAINER_FILTER)
5284 5384 }
5285 5385
5286 5386 await getNodeBindInfo()
  5387 + }
5287 5388
5288   -
5289   - function echoDataSource() {
5290   - const { dataSources = [] } = currentNodeData || {}
5291   - const [ dataSource = {} ] = dataSources
5292   - const { orgId, deviceId, slaveDeviceId, attr } = dataSource
5293   - const queue = []
5294   - if (orgId) {
5295   - currentCheckedOrgNode = orgId
5296   - queue.push(getDevicesByOrgId(orgId))
5297   - }
5298   - if (slaveDeviceId) {
5299   - queue.push(getSlaveDeviceByMasterDeviceId(orgId, deviceId))
5300   - $(`#${ enumActionEl.SLAVE_DEVICE_EL }`).css({ display: 'block' })
5301   - queue.push(getAttrByDeviceId(slaveDeviceId))
  5389 + async function echoActionType() {
  5390 + const act = currentNodeData.act ?? []
  5391 + const event = currentNodeData.event ?? []
  5392 + const actionType = {}
  5393 + for (const item of act) {
  5394 + if (!item.condition || !item.condition?.length) {
  5395 + $(`.interaction__container input[name="${item.type}"]`).attr('disabled', true)
5302 5396 } else {
5303   - queue.push(getAttrByDeviceId(deviceId))
  5397 + $(`.interaction__container input[name="${item.type}"]`).attr('disabled', false)
5304 5398 }
5305   - Promise.all(queue)
5306   - .finally(() => {
5307   - const orgNode = UseLayUi.findTreeObjectByField(treeList, currentCheckedOrgNode)
5308   - $(`#${ enumActionEl.ORG_EL } input[name="${ enumDataSourceConst.ORG_ID }"]`).parent().find('span').html(orgNode?.name)
5309   - form.val(CONTAINER_FILTER, {
5310   - orgId,
5311   - deviceId,
5312   - slaveDeviceId,
5313   - attr,
5314   - })
5315   - })
  5399 + actionType[item.type] = item.enabled
5316 5400 }
5317   -
5318   - async function echoActionType() {
5319   - const act = currentNodeData.act ?? []
5320   - const event = currentNodeData.event ?? []
5321   - const actionType = {}
5322   - for (const item of act) {
5323   - if (!item.condition || !item.condition?.length) {
5324   - $(`.interaction__container input[name="${ item.type }"]`).attr('disabled', true)
5325   - } else {
5326   - $(`.interaction__container input[name="${ item.type }"]`).attr('disabled', false)
5327   - }
5328   - actionType[item.type] = item.enabled
5329   - }
5330   - for (const item of event) {
5331   - if (!item.content) {
5332   - $(`.interaction__container input[name="${ item.type }"]`).attr('disabled', true)
5333   - } else {
5334   - $(`.interaction__container input[name="${ item.type }"]`).attr('disabled', false)
5335   - }
5336   - actionType[item.type] = item.enabled
  5401 + for (const item of event) {
  5402 + if (!item.content) {
  5403 + $(`.interaction__container input[name="${item.type}"]`).attr('disabled', true)
  5404 + } else {
  5405 + $(`.interaction__container input[name="${item.type}"]`).attr('disabled', false)
5337 5406 }
5338   - form.val(CONTAINER_FILTER, actionType)
  5407 + actionType[item.type] = item.enabled
5339 5408 }
5340   - }
5341   -
5342   - function mount() {
5343   - generatorOrgTres()
5344   - generatorDeviceSelect()
5345   - generatorSlaveDevice()
5346   - generatorAttrSelect()
5347   - echoData()
5348   -
5349   - $(fragment).append(title).append(orgPanel).append(devicePanel).append(slaveDevicePanel).append(attrsPanel)
5350   -
5351   - $(container).append(fragment)
5352   -
  5409 + form.val(CONTAINER_FILTER, actionType)
5353 5410 }
5354 5411
5355 5412 mount()
5356   -
5357 5413 }
5358 5414
  5415 + // /**
  5416 + // * @description 创建功能模块
  5417 + // */
  5418 + // function createFunctionPanel() {
  5419 + // const fragment = document.createDocumentFragment()
  5420 + // const title = createTitle('功能')
  5421 + // $(title).addClass('override__title--default')
  5422 + // fragment.append(title)
  5423 + // generateActionEventNode(functionList).forEach(item => {
  5424 + // const panel = createPanel()
  5425 + // $(panel).addClass('override__panel--default').append(item)
  5426 + // $(fragment).append(panel)
  5427 + // })
  5428 + // $(container).append(fragment)
  5429 + // }
5359 5430
5360 5431 /**
5361 5432 * @description 创建数据交互模块
... ... @@ -5365,16 +5436,11 @@ DataFormatPanel.prototype.addDataFont = function (container) {
5365 5436 const title = createTitle('数据交互')
5366 5437 $(title).addClass('override__title--default')
5367 5438 fragment.append(title)
5368   - generateDataEventNode().forEach(item => {
  5439 + generateActionEventNode(interactionList).forEach(item => {
5369 5440 const panel = createPanel()
5370 5441 $(panel).addClass('override__panel--default').append(item)
5371 5442 $(fragment).append(panel)
5372 5443 })
5373   - // Object.keys(enumInteractionType).forEach(key => {
5374   - // form.on(`checkbox(${ key })`, event => {
5375   - // const isChecked = $(event.othis).hasClass('layui-form-checked')
5376   - // })
5377   - // })
5378 5444 $(container).append(fragment)
5379 5445 }
5380 5446
... ... @@ -5419,7 +5485,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
5419 5485 [enumDataSourceConst.ATTR]: field[enumDataSourceConst.ATTR],
5420 5486 },
5421 5487 }
5422   - const allType = [ ...interactionList, ...dynamicEffectList ]
  5488 + const allType = [...interactionList, ...dynamicEffectList]
5423 5489 for (const item of allType) {
5424 5490 if (field[item.type] === ENABLED_FLAG) {
5425 5491 const enableItem = currentNodeData[item.category].find(each => each.type === item.type)
... ... @@ -5435,7 +5501,8 @@ DataFormatPanel.prototype.addDataFont = function (container) {
5435 5501 })
5436 5502 }
5437 5503 }
5438   - const [ err, res ] = await to(ConfigurationNodeApi.updateNodeInfo(value))
  5504 + await to(autoSaveGraphInfo())
  5505 + const [err, res] = await to(ConfigurationNodeApi.updateNodeInfo(value))
5439 5506 if (err) return
5440 5507 UseLayUi.successMsg()
5441 5508 await getNodeBindInfo()
... ... @@ -5444,320 +5511,299 @@ DataFormatPanel.prototype.addDataFont = function (container) {
5444 5511 }
5445 5512
5446 5513 /**
5447   - * @description 处理数据交互 - down || up 按下与抬起
  5514 + * @description 处理设置变量图片
5448 5515 */
5449   - function handleDownOrUpEvent(event) {
5450   -
5451   - if (!currentCheckedOrgNode) {
5452   - layer.msg('请先选择组织')
5453   - return
5454   - }
5455   - // 事件类型
5456   - const enumEventType = {
5457   - DOWN: "按下",
5458   - UP: "抬起",
5459   - SINGLE: "单击",
5460   - DOUBLE: "双击",
5461   - };
  5516 + function handleSettingVarImage(event) {
5462 5517
5463 5518 const enumActionEl = {
5464 5519 /**
5465   - * @description 表体节点
  5520 + * @description layer 保存按钮
5466 5521 */
5467   - DEVICE_DATA_BODY_EL: 'deviceDataTbody',
  5522 + LAYER_SUBMIT_FILTER: 'varImageLayerFilter',
5468 5523
5469 5524 /**
5470   - * @description 删除行节点
  5525 + * @description 上传图片layer 按钮控制
5471 5526 */
5472   - DEL_ROW_EL: 'deleteRow',
  5527 + IMAGE_LAYER_FILTER: 'uploadImageLayerFilter',
5473 5528
5474 5529 /**
5475   - * @description 增加行节点
  5530 + * @description 行控制
5476 5531 */
5477   - ADD_ROW_EL: 'addRow',
  5532 + ROW_FILTER: 'varImageTableRowFilter',
5478 5533
5479 5534 /**
5480   - * @descripton
  5535 + * @description 颜色控制
5481 5536 */
5482   - ROW_FILTER: 'interactionRowFilter',
  5537 + COLOR_PICKER_FILTER: 'varImageTableColorPickerFilter',
5483 5538
5484 5539 /**
5485   - * @description json editor
  5540 + * @description 最小值控制
5486 5541 */
5487   - EDITOR_JSON: 'editor__json-',
  5542 + MIN_FILTER: 'varImageTableMinFilter',
5488 5543
5489 5544 /**
5490   - * @description 弹出层保存 filter
  5545 + * @description 最大值控制
5491 5546 */
5492   - LAYER_SUBMIT_FILTER: 'interactionLayerSubmit',
  5547 + MAX_FILTER: 'varImageTableMaxFilter',
5493 5548
5494 5549 /**
5495   - * @description ace builder
  5550 + * @description 表体
5496 5551 */
5497   - JSON: 'ace__builder-json',
5498   - }
  5552 + TABLE_BODY_EL: 'variableImageTable',
5499 5553
  5554 + /**
  5555 + * @description 添加行控制
  5556 + */
  5557 + ADD_ROW_EL: 'variableImageTableAddRow',
5500 5558
5501   - /**
5502   - * @description 所有设备选项
5503   - * @type {*[]}
5504   - */
5505   - let allDeviceOptions = []
  5559 + /**
  5560 + * @description 设置图片控制
  5561 + */
  5562 + SET_IMG_EL: 'variableImageTableSetImgEl',
5506 5563
5507   - let addRowNumber = 0
  5564 + /**
  5565 + * @description 预览区域控制
  5566 + */
  5567 + PREVIEW_IMG_CONTAINER: 'img__container',
5508 5568
5509   - const getRowFilter = (rowNumber) => `${ enumActionEl.ROW_FILTER }${ rowNumber }`
  5569 + /**
  5570 + * @description 删除图片控制
  5571 + */
  5572 + DEL_PREVIEW_IMG: 'img__delete',
  5573 +
  5574 + /**
  5575 + * @description 删除行控制
  5576 + */
  5577 + DEL_ROW_EL: 'variableImageTableDelRow',
  5578 +
  5579 + /**
  5580 + * @description
  5581 + */
  5582 + DATA_SOURCE_COMP_EL: 'varImgDataSourceEl',
  5583 + }
5510 5584
5511   - /**
5512   - * @description 枚举常量
5513   - * @enum DEVICE
5514   - */
5515 5585 const enumConst = {
  5586 +
5516 5587 /**
5517   - * @description 设备
  5588 + * @description 最小值
5518 5589 */
5519   - DEVICE: 'deviceId',
  5590 + MIN: 'min',
  5591 +
5520 5592 /**
5521   - * @description 子设备
  5593 + * @description 最大值
5522 5594 */
5523   - SLAVE_DEVICE: 'slaveDeviceId',
  5595 + MAX: 'max',
  5596 +
5524 5597 /**
5525   - * @description 变量
  5598 + * @description 图片字段 key
5526 5599 */
5527   - ATTR: 'attr',
  5600 + IMAGE: 'image',
  5601 +
5528 5602 /**
5529   - * @description 下发值
  5603 + * @description 颜色
5530 5604 */
5531   - VALUE: 'value',
  5605 + COLOR: 'color',
5532 5606
5533 5607 /**
5534   - * @description 方式
  5608 + * @description 图片来源
5535 5609 */
5536   - WAY: 'way',
  5610 + IMAGE_ORIGIN: 'imageOrigin',
  5611 +
  5612 + /**
  5613 + * @description 图库图形类别
  5614 + */
  5615 + IMAGE_GALLERY_CATEGORY: 'category',
  5616 +
  5617 + /**
  5618 + * @description 图表图形路径
  5619 + */
  5620 + IMAGE_GALLERY_IMAGE_PATH: 'imagePath',
5537 5621 }
5538 5622
5539   - const sendInstructionWay = {
5540   - ONE_WAR: 'oneway',
5541   - TWO_WAY: 'twoway',
  5623 + let addRowNumber = 0
  5624 +
  5625 + let getDataSourceValue = () => {
5542 5626 }
5543 5627
  5628 + const getRowFilter = (rowNumber) => `${enumActionEl.ROW_FILTER}${rowNumber}`
  5629 +
  5630 + const getColorPickerFilter = (rowNumber) => `${enumActionEl.COLOR_PICKER_FILTER}${rowNumber}`
  5631 +
5544 5632 /**
5545   - * @description 创建回显数据 查询出所有网关设备和直连设备
  5633 + * @description 监听表格中的事件
5546 5634 */
5547   - async function getMaterDevice() {
5548   - if (!currentCheckedOrgNode) return
5549   - const [ err, res ] = await to(ConfigurationNodeApi.getMasterDevice(currentCheckedOrgNode))
5550   - allDeviceOptions = res
5551   - }
5552   -
5553   - function createEditor(el, datum = {}) {
5554   - const editor = ace.edit(el, {
5555   - maxLines: 10, // 最大行数,超过会自动出现滚动条
5556   - minLines: 5, // 最小行数,还未到最大行数时,编辑器会自动伸缩大小
5557   - fontSize: 14, // 编辑器内字体大小
5558   - tabSize: 2, // 制表符设置为 4 个空格大小
5559   - });
5560   - editor.session.setMode("ace/mode/json");
5561   - editor.getSession().on('change', (event, editor) => {
5562   - $(`#${ el }`).parent().find(`textarea[name="${ enumConst.VALUE }"]`).val(editor.getValue())
5563   - })
5564   - editor.setValue(datum[enumConst.VALUE] ? datum[enumConst.VALUE] : "{}")
5565   - }
5566   -
5567   - function addRecord(datum) {
5568   - const content = `
5569   - <tr class="layui-form" lay-filter="${ getRowFilter(addRowNumber) }">
5570   - <td>
5571   - <select name="${ enumConst.DEVICE }" lay-filter="${ enumConst.DEVICE }" lay-verType="tips" lay-verify="required"></select>
5572   - </td>
5573   - <td>
5574   - <select name="${ enumConst.SLAVE_DEVICE }" lay-filter="${ enumConst.SLAVE_DEVICE }" lay-verType="tips"></select>
5575   - </td>
5576   - <td>
5577   - <form action="" style="display: flex">
5578   - <div class="override__radio-default">
5579   - <input id="${ getRowFilter(addRowNumber) }${ sendInstructionWay.ONE_WAR }" type="radio" name="${ enumConst.WAY }" lay-ignore value="${ sendInstructionWay.ONE_WAR }" title="单向" checked="">
5580   - <label for="${ getRowFilter(addRowNumber) }${ sendInstructionWay.ONE_WAR }" class="override__radio-label">单向</label>
5581   - </div>
5582   - <div class="override__radio-default">
5583   - <input id="${ getRowFilter(addRowNumber) }${ sendInstructionWay.TWO_WAY }" type="radio" name="${ enumConst.WAY }" lay-ignore value="${ sendInstructionWay.TWO_WAY }" title="双向">
5584   - <label for="${ getRowFilter(addRowNumber) }${ sendInstructionWay.TWO_WAY }" class="override__radio-label">双向</label>
5585   - </div>
5586   - </form>
5587   - </td>
5588   - <td class="${ enumActionEl.JSON }">
5589   - <div style="width: 100%;height: 100%;">
5590   - <div id="${ enumActionEl.EDITOR_JSON }${ addRowNumber }"></div>
5591   - <textarea style="display: none" name="${ enumConst.VALUE }" placeholder="请输入命令" lay-verType="tips" class="layui-textarea"></textarea>
5592   - </div>
5593   - </td>
5594   - <td>
5595   - <button type="button" class="layui-btn layui-btn-primary layui-border-red ${ enumActionEl.DEL_ROW_EL }">删除</button>
5596   - </td>
5597   - </tr>
5598   - `
5599   - $(`#${ enumActionEl.DEVICE_DATA_BODY_EL }`).append(content)
5600   - setDeviceOptions(addRowNumber)
5601   - createEditor(`${ enumActionEl.EDITOR_JSON }${ addRowNumber }`, datum)
5602   - form.render('select', getRowFilter(addRowNumber))
5603   - addRowNumber++
5604   - }
5605   -
5606   - /**
5607   - * @description 更新变量选项
5608   - */
5609   - async function updateVariableOptions(data) {
5610   - if (!data.value) return
5611   - const [ err, res ] = await to(ConfigurationNodeApi.getDeviceAttr(data.value))
5612   - if (!res) return
5613   - const generateOption = UseLayUi.generateOptionTemplate({ dataSource: res })
5614   - $(data.elem).parents('tr').find(`select[name="${ enumConst.ATTR }"]`).html(generateOption)
5615   - form.render('select')
5616   - }
5617   -
5618   - /**
5619   - * @description 选择设备监听事件
5620   - */
5621   - function createSelectDeviceListenEvent() {
5622   - form.on(`select(${ enumConst.DEVICE })`, async (data) => {
5623   - const isGATEWAY = allDeviceOptions.find(item => item.id === data.value)?.deviceType === "GATEWAY"
5624   - // 网关设备请求子设备
5625   - if (isGATEWAY && data.value) {
5626   - const [ err, res ] = await to(ConfigurationNodeApi.getSlaveDevice(currentCheckedOrgNode, data.value))
5627   - if (!res) return
5628   - const generateOption = UseLayUi.generateOptionTemplate({ dataSource: res })
5629   - $(data.elem).parents('tr').find(`select[name="${ enumConst.SLAVE_DEVICE }"]`).html(generateOption)
5630   - }
5631   - // else {
5632   - // updateVariableOptions(data)
5633   - // }
5634   - form.render('select')
5635   - })
5636   - // form.on(`select(${ enumConst.SLAVE_DEVICE })`, (data) => {
5637   - // updateVariableOptions(data)
5638   - // })
  5635 + function generatorEventListen() {
  5636 + createInputListener()
  5637 + createAddRowEvent()
  5638 + createDelRowEvent()
  5639 + createSetImgEvent()
  5640 + createDelPreviewImgEvent()
5639 5641 }
5640 5642
5641 5643 /**
5642 5644 * @description 删除行
5643 5645 */
5644   - function createDeleteRowListenEvent() {
5645   - $(`.${ enumActionEl.DEL_ROW_EL }`).click((event) => {
5646   - // $(event.target).parents('tr').find('editor')
  5646 + function createDelRowEvent() {
  5647 + $(`#${enumActionEl.TABLE_BODY_EL}`).on('click', `.${enumActionEl.DEL_ROW_EL}`, (event) => {
5647 5648 $(event.target).parents('tr').remove()
5648 5649 })
5649 5650 }
5650 5651
5651 5652 /**
5652   - * @description 新增行
  5653 + * @description 添加行事件
5653 5654 */
5654   - function createAddRowListenEvent() {
5655   - $(`#${ enumActionEl.ADD_ROW_EL }`).click(() => {
  5655 + function createAddRowEvent() {
  5656 + $(`#${enumActionEl.ADD_ROW_EL}`).on('click', () => {
5656 5657 addRecord()
5657   - const generateOption = UseLayUi.generateOptionTemplate({ dataSource: allDeviceOptions })
5658   - $(`#${ enumActionEl.DEVICE_DATA_BODY_EL } tr`).last().find(`select[name="${ enumConst.DEVICE }"]`).html(generateOption)
5659   - createDeleteRowListenEvent()
5660   - form.render('select')
5661 5658 })
5662 5659 }
5663 5660
5664 5661 /**
5665   - * @description 设置设备选项
  5662 + * @description 删除已选择的变量图片
5666 5663 */
5667   - function setDeviceOptions(row) {
5668   - const generateOption = UseLayUi.generateOptionTemplate({ dataSource: allDeviceOptions })
5669   - $(`#${ enumActionEl.DEVICE_DATA_BODY_EL } tr[lay-filter="${ getRowFilter(row) }"]`).find(`select[name="${ enumConst.DEVICE }"]`).html(generateOption)
  5664 + function createDelPreviewImgEvent() {
  5665 + $(`#${enumActionEl.TABLE_BODY_EL}`).on('click', `.${enumActionEl.DEL_PREVIEW_IMG}`, (event) => {
  5666 + $(event.target)
  5667 + .parents(`div.${enumActionEl.PREVIEW_IMG_CONTAINER}`).find('img').attr('src', '')
  5668 + const rowFilter = $(event.target).parents(`tr`).attr('lay-filter')
  5669 + form.val(rowFilter, {
  5670 + [enumConst.IMAGE_ORIGIN]: null,
  5671 + [enumConst.IMAGE_GALLERY_CATEGORY]: null,
  5672 + [enumConst.IMAGE_GALLERY_IMAGE_PATH]: null,
  5673 + })
  5674 + })
5670 5675 }
5671 5676
5672 5677 /**
5673   - * @description 生成事件监听
  5678 + * @description 选择图片
5674 5679 */
5675   - function generatorEventListen() {
5676   - createSelectDeviceListenEvent()
5677   - createDeleteRowListenEvent()
5678   - createAddRowListenEvent()
  5680 + function createSetImgEvent() {
  5681 + $(`#${enumActionEl.TABLE_BODY_EL}`).on('click', `.${enumActionEl.SET_IMG_EL}`, (event) => {
  5682 + if ($(event.target).hasClass(enumActionEl.DEL_PREVIEW_IMG)) return
  5683 + const rowFilter = $(event.target).parents('tr').attr('lay-filter')
  5684 + // createUploadImgLayer(rowFilter)
  5685 + generatorUploadLayerComponent((imageState) => {
  5686 +
  5687 + $(`#${enumActionEl.TABLE_BODY_EL}`)
  5688 + .find(`tr[lay-filter="${rowFilter}"]`)
  5689 + .find('img').attr('src', imageState[enumConst.IMAGE_GALLERY_IMAGE_PATH])
  5690 +
  5691 + form.val(rowFilter, {
  5692 + [enumConst.IMAGE_ORIGIN]: imageState[enumConst.IMAGE_ORIGIN],
  5693 + [enumConst.IMAGE_GALLERY_CATEGORY]: imageState[enumConst.IMAGE_GALLERY_CATEGORY],
  5694 + [enumConst.IMAGE_GALLERY_IMAGE_PATH]: imageState[enumConst.IMAGE_GALLERY_IMAGE_PATH],
  5695 + })
  5696 + })
  5697 + })
5679 5698 }
5680 5699
5681 5700 /**
5682   - * @description 挂载选项 根据行号 key 挂载option
5683   - * @param row 行号
5684   - * @param key select name
5685   - * @param data 数据源
  5701 + * @description 创建输入验证
5686 5702 */
5687   - function mountSelectOptions(row, key, data) {
5688   - const generateOption = UseLayUi.generateOptionTemplate({ dataSource: data })
5689   - $(`#${ enumActionEl.DEVICE_DATA_BODY_EL }`).find(`tr[lay-filter="${ getRowFilter(row) }"] select[name="${ key }"]`).html(generateOption)
  5703 + function createInputListener() {
  5704 + $(`#${enumActionEl.TABLE_BODY_EL}`)
  5705 + .on('input', `.${enumActionEl.MIN_FILTER}`, event => {
  5706 + const minVal = $(event.target).val()
  5707 + const maxVal = $(event.target).parents('tr').find(`input.${enumActionEl.MAX_FILTER}`).val()
  5708 + if (maxVal !== '' && Number(minVal) > Number(maxVal)) {
  5709 + layer.tips('输入值大于最大值', $(event.target), {
  5710 + tips: 1,
  5711 + });
  5712 + }
  5713 + })
  5714 + .on('input', `.${enumActionEl.MAX_FILTER}`, event => {
  5715 + const maxVal = $(event.target).val()
  5716 + const minVal = $(event.target).parents('tr').find(`input.${enumActionEl.MIN_FILTER}`).val()
  5717 + if (minVal !== '' && Number(maxVal) < Number(minVal)) {
  5718 + layer.tips('输入值小于最小值', $(event.target), {
  5719 + tips: 1,
  5720 + });
  5721 + }
  5722 + })
5690 5723 }
5691 5724
5692 5725 /**
5693   - * @description 根据主设备ID获取从设备
  5726 + * @description 添加记录
5694 5727 */
5695   - async function getSlaveDeviceByMasterDevice(deviceId, row) {
5696   - const res = await ConfigurationNodeApi.getSlaveDevice(currentCheckedOrgNode, deviceId)
5697   - mountSelectOptions(row, enumConst.SLAVE_DEVICE, res)
  5728 + function addRecord() {
  5729 + const rowFormFilter = getRowFilter(addRowNumber)
  5730 + const content = `
  5731 + <tr class="layui-form" lay-filter="${rowFormFilter}">
  5732 + <td>
  5733 + <div class="layui-form-item">
  5734 + <input class="layui-input ${enumActionEl.MIN_FILTER}" autocomplete="off" type="number" name="${enumConst.MIN}" lay-filter="${enumConst.MIN}" lay-verType="tips" lay-verify="required" />
  5735 + </div>
  5736 + </td>
  5737 + <td>
  5738 + <div class="layui-form-item">
  5739 + <input class="layui-input ${enumActionEl.MAX_FILTER}"" autocomplete="off" type="number" name="${enumConst.MAX}" lay-filter="${enumConst.MAX}" lay-verType="tips" lay-verify="required" />
  5740 + </div>
  5741 + </td>
  5742 + <td>
  5743 + <div class="${enumActionEl.SET_IMG_EL}">
  5744 + <input name="${enumConst.IMAGE_GALLERY_CATEGORY}" type="text" style="display: none">
  5745 + <input name="${enumConst.IMAGE_GALLERY_IMAGE_PATH}" type="text" style="display: none">
  5746 + <input name="${enumConst.IMAGE_ORIGIN}" type="text" style="display: none">
  5747 + <div class="${enumActionEl.PREVIEW_IMG_CONTAINER}">
  5748 + <img src="" alt="">
  5749 + <div class="${enumActionEl.DEL_PREVIEW_IMG}">x</div>
  5750 + <div class="add__button">+</div>
  5751 + </div>
  5752 + </div>
  5753 + </td>
  5754 +<!-- <td>-->
  5755 +<!-- <div style="display: flex">-->
  5756 +<!-- <input class="layui-input" style="border-width: 1px; border-right: none;" autocomplete="off" ype="number" name="${enumConst.COLOR}" lay-filter="${enumConst.COLOR}" lay-verType="tips" lay-verify="required" />-->
  5757 +<!-- <div id="${getColorPickerFilter(addRowNumber)}"></div>-->
  5758 +<!-- </div>-->
  5759 +<!-- </td>-->
  5760 + <td style="text-align: center">
  5761 + <button type="button" class="layui-btn layui-btn-primary layui-border-red ${enumActionEl.DEL_ROW_EL}">删除</button>
  5762 + </td>
  5763 + </tr>
  5764 + `
  5765 + $(`#${enumActionEl.TABLE_BODY_EL}`).append(content)
  5766 + // colorpicker.render({
  5767 + // elem: $(`#${getColorPickerFilter(addRowNumber)}`),
  5768 + // done(color) {
  5769 + // $(`#${enumActionEl.TABLE_BODY_EL} tr[lay-filter="${rowFormFilter}"]`).find(`input[lay-filter="${enumConst.COLOR}"]`).val(color)
  5770 + // },
  5771 + // predefine: true,
  5772 + // });
  5773 + form.render()
  5774 + addRowNumber++
5698 5775 }
5699 5776
5700   - /**
5701   - * @description 根据设备ID获取设备属性
5702   - */
5703   - async function getDeviceAttrByDeviceId(deviceId, row) {
5704   - const res = await ConfigurationNodeApi.getDeviceAttr(deviceId)
5705   - mountSelectOptions(row, enumConst.ATTR, res)
5706   - }
5707 5777
5708 5778 /**
5709   - * @description 回显表单数据
  5779 + * @description 回显数据
5710 5780 */
5711 5781 function echoFormData(info) {
5712   - const { content: { data = [] } = {} } = info
5713   - data.forEach((datum, index) => echoEachData(datum, index))
  5782 + const { condition = [] } = info
  5783 + condition.forEach((item, index) => {
  5784 + addRecord()
  5785 + const rowFilter = getRowFilter(index)
  5786 + $(`#${enumActionEl.TABLE_BODY_EL}`).find(`tr[lay-filter="${rowFilter}"] .${enumActionEl.PREVIEW_IMG_CONTAINER}>img`).attr('src', item[enumConst.IMAGE_GALLERY_IMAGE_PATH])
  5787 + form.val(rowFilter, { ...item })
  5788 + })
5714 5789 }
5715 5790
5716 5791 /**
5717   - * @description 回显每条数据
  5792 + * @description 验证最大最小值
  5793 + * @param tableData
  5794 + * @returns {boolean}
5718 5795 */
5719   - function echoEachData(datum = {}, row) {
5720   - addRecord(datum)
5721   - const deviceId = datum[enumConst.DEVICE]
5722   - const slaveDeviceId = datum[enumConst.SLAVE_DEVICE]
5723   - const queue = []
5724   -
5725   - if (slaveDeviceId) {
5726   - queue.push(() => getSlaveDeviceByMasterDevice(deviceId, row))
5727   - // queue.push(() => getDeviceAttrByDeviceId(slaveDeviceId, row))
5728   - }
5729   - // else {
5730   - // queue.push(() => getDeviceAttrByDeviceId(deviceId, row))
5731   - // }
5732   -
5733   - Promise
5734   - .all(queue.map(item => item()))
5735   - .finally(() => {
5736   - form.val(getRowFilter(row), datum)
5737   - })
5738   - }
5739   -
5740   - function isJson(string) {
5741   - if (typeof string === 'string') {
5742   - try {
5743   - const obj = JSON.parse(string)
5744   - if (typeof obj === 'object' && obj !== null) {
5745   - return true
5746   - }
5747   - } catch (e) {
5748   - return false
5749   - }
5750   - }
5751   - return false
5752   - }
5753   -
5754 5796 function validate(tableData) {
5755 5797 let validateFlag = true
5756 5798 for (let i = 0; i < tableData.length; i++) {
5757   - const { value } = tableData[i]
5758   - if (!isJson(value)) {
  5799 + const { min, max } = tableData[i]
  5800 + if (Number(min) > Number(max)) {
  5801 + validateFlag = false
  5802 + layer.tips('输入值大于最大值', $(`#${enumActionEl.TABLE_BODY_EL} tr`).eq(i).find(`input[name="${enumConst.MIN}"]`))
  5803 + break
  5804 + } else if (Number(max) < Number(min)) {
5759 5805 validateFlag = false
5760   - layer.tips('下发值不正确', $(`#${ enumActionEl.DEVICE_DATA_BODY_EL } tr`).eq(i).find(`td.${ enumActionEl.JSON }`), { tips: 1 })
  5806 + layer.tips('输入值小于最小值', $(`#${enumActionEl.TABLE_BODY_EL} tr`).eq(i).find(`input[name="${enumConst.MAX}"]`))
5761 5807 break
5762 5808 }
5763 5809 }
... ... @@ -5765,85 +5811,60 @@ DataFormatPanel.prototype.addDataFont = function (container) {
5765 5811 }
5766 5812
5767 5813 /**
5768   - * @description 保存
  5814 + * @description
5769 5815 */
5770 5816 async function submit(callback) {
5771 5817 const data = Array.from({ length: addRowNumber }).map((_, row) => form.val(getRowFilter(row))).filter(item => Object.keys(item).length)
5772 5818 if (!validate(data)) return
5773   - const formModal = {
  5819 + const formVal = getDataSourceValue()
  5820 + const formModel = {
5774 5821 configurationId,
5775 5822 contentId: currentPageId.id,
  5823 + ...formVal,
5776 5824 id: graphId,
5777   - content: {
5778   - data,
5779   - },
  5825 + condition: data,
5780 5826 type: event.data.type,
5781   - };
5782   - const [ err, res ] = await to(ConfigurationNodeApi.updateNodeEvent(formModal))
  5827 + }
  5828 + await to(autoSaveGraphInfo())
  5829 + const [err, res] = await to(ConfigurationNodeApi.updateNodeAct(formModel))
5783 5830 if (err) return
5784 5831 UseLayUi.successMsg()
5785 5832 callback()
5786 5833 }
5787 5834
5788   - /**
5789   - * @description 创建弹出层表单
5790   - * @param event
5791   - */
5792 5835 function createLayerForm(type) {
5793 5836 const content = `
5794   - <form class="layui-form" lay-filter="formModal">
5795   - <div style="width:400px">
5796   - <div class="layui-form-item">
5797   - <label class="layui-form-label">事件</label>
5798   - <div class="layui-input-block">
5799   - <input type="text" name="event" class="layui-input" value="${ enumEventType[type] }" disabled>
5800   - </div>
5801   - </div>
5802   - <div class="layui-form-item">
5803   - <label class="layui-form-label">动作</label>
5804   - <div class="layui-input-block">
5805   - <select name="action" lay-verify="required">
5806   - <option value="0" selected>给变量赋值</option>
5807   - </select>
5808   - </div>
5809   - </div>
5810   - <div class="layui-form-item">
5811   - <label class="layui-form-label">类型</label>
5812   - <div class="layui-input-block">
5813   - <input type="radio" name="type" value="1" title="联网设备" checked>
5814   - <input type="radio" name="type" value="2" title="产品/场景" disabled>
5815   - </div>
5816   - </div>
5817   - </div>
5818   - </form>
5819   - <div class="override__table">
  5837 + <div style="width: 300px; padding: 20px 0 0 20px;" id="${enumActionEl.DATA_SOURCE_COMP_EL}"></div>
  5838 + <div class="override__table" style="padding: 0 20px">
5820 5839 <table class="layui-table" >
5821 5840 <thead>
5822   - <tr>
5823   - <th style="text-align:center">选择设备</th>
5824   - <th style="text-align:center">选择子设备</th>
5825   - <th style="text-align:center">单向 / 双向</th>
5826   - <th style="text-align:center">下发值</th>
5827   - <th style="text-align:center">操作</th>
5828   - </tr>
  5841 + <tr>
  5842 + <th style="text-align:center">最小值(<=)</th>
  5843 + <th style="text-align:center">最大值(>=)</th>
  5844 + <th style="text-align:center">对应图片</th>
  5845 +<!-- <th style="text-align:center">对应的颜色</th>-->
  5846 + <th style="text-align:center">操作</th>
  5847 + </tr>
5829 5848 </thead>
5830   - <tbody id="${ enumActionEl.DEVICE_DATA_BODY_EL }"></tbody>
  5849 + <tbody id="${enumActionEl.TABLE_BODY_EL}"></tbody>
5831 5850 </table>
5832   - <div style="display:flex;justify-content:center;">
5833   - <button type="button" class="layui-btn layui-btn-primary layui-border-blue" id="${ enumActionEl.ADD_ROW_EL }">添加一条</button>
5834   - </div>
5835   - </div>`
  5851 + </div>
  5852 + <div style="display:flex;justify-content:center;">
  5853 + <button type="button" class="layui-btn layui-btn-primary layui-border-blue" id="${enumActionEl.ADD_ROW_EL}">添加一条</button>
  5854 + </div>
  5855 + `
5836 5856
5837 5857 layer.open({
5838   - title: '创建交互',
  5858 + title: '变量值图片功能',
  5859 + type: 1,
5839 5860 content,
5840 5861 skin: 'event-layer__override',
5841   - // area: ["1100px", "700px"],
5842   - area: '1200px',
5843   - btn: [ "保存", "取消" ],
5844   - shade: [ "0.7", "#fafafa" ],
  5862 + area: '700px',
  5863 + btn: ["保存", "取消"],
  5864 + shade: ["0.7", "#fafafa"],
  5865 + offset: '100px',
5845 5866 yes(index) {
5846   - form.on(`submit(${ enumActionEl.LAYER_SUBMIT_FILTER })`, data => {
  5867 + form.on(`submit(${enumActionEl.LAYER_SUBMIT_FILTER})`, data => {
5847 5868 submit(() => {
5848 5869 layer.close(index)
5849 5870 getNodeBindInfo()
... ... @@ -5858,15 +5879,18 @@ DataFormatPanel.prototype.addDataFont = function (container) {
5858 5879 'lay-submit': '',
5859 5880 'lay-filter': enumActionEl.LAYER_SUBMIT_FILTER,
5860 5881 })
5861   - await getMaterDevice()
5862   - const info = getLayerBindInfo('event', type)
5863   - if (!info) {
  5882 + const { component, echoDataSource, getValue } = generatorDataSourceComponent()
  5883 + getDataSourceValue = getValue
  5884 + $(`#${enumActionEl.DATA_SOURCE_COMP_EL}`).append(component)
  5885 + const info = getLayerBindInfo('act', type)
  5886 + const { condition = [] } = info
  5887 + if (!condition.length) {
5864 5888 addRecord()
5865 5889 } else {
  5890 + echoDataSource(info)
5866 5891 echoFormData(info)
5867 5892 }
5868 5893 generatorEventListen()
5869   - form.render()
5870 5894 },
5871 5895 })
5872 5896 }
... ... @@ -5875,10 +5899,15 @@ DataFormatPanel.prototype.addDataFont = function (container) {
5875 5899 }
5876 5900
5877 5901 /**
5878   - * @description 处理单击 or 双击事件
  5902 + * @description 处理数据交互 - down || up 按下与抬起
5879 5903 */
5880   - function handleClickOrDbClick(event) {
  5904 + function handleDownOrUpEvent(event) {
5881 5905
  5906 + // if (!currentCheckedOrgNode) {
  5907 + // layer.msg('请先选择组织')
  5908 + // return
  5909 + // }
  5910 + // 事件类型
5882 5911 const enumEventType = {
5883 5912 DOWN: "按下",
5884 5913 UP: "抬起",
... ... @@ -5886,26 +5915,536 @@ DataFormatPanel.prototype.addDataFont = function (container) {
5886 5915 DOUBLE: "双击",
5887 5916 };
5888 5917
5889   - /**
5890   - * @description
5891   - */
5892   - const enumConst = {
5893   - EVENT: 'event',
5894   - ACTION: 'actionType',
5895   - PAGE_VALUE: 'pageValue',
5896   - LINK_VALUE: 'linkValue',
5897   - }
  5918 + const enumActionEl = {
5898 5919
5899   - /**
5900   - * @description 动作类型
5901   - */
5902   - const enumActionType = {
5903   - PAGE: 'PAGE',
5904   - LINK: 'LINK',
5905   - PROPS: 'PROPS',
5906   - }
  5920 + /**
  5921 + * @description 表单控制 filter
  5922 + */
  5923 + FORM_FILTER: 'interactionFormFilter',
5907 5924
5908   - const enumGetValue = {
  5925 + /**
  5926 + * @description 表体节点
  5927 + */
  5928 + DEVICE_DATA_BODY_EL: 'deviceDataTbody',
  5929 +
  5930 + /**
  5931 + * @description 删除行节点
  5932 + */
  5933 + DEL_ROW_EL: 'deleteRow',
  5934 +
  5935 + /**
  5936 + * @description 增加行节点
  5937 + */
  5938 + ADD_ROW_EL: 'addRow',
  5939 +
  5940 + /**
  5941 + * @descripton
  5942 + */
  5943 + ROW_FILTER: 'interactionRowFilter',
  5944 +
  5945 + /**
  5946 + * @description json editor
  5947 + */
  5948 + EDITOR_JSON: 'editor__json-',
  5949 +
  5950 + /**
  5951 + * @description 弹出层保存 filter
  5952 + */
  5953 + LAYER_SUBMIT_FILTER: 'interactionLayerSubmit',
  5954 +
  5955 + /**
  5956 + * @description ace builder
  5957 + */
  5958 + JSON: 'ace__builder-json',
  5959 +
  5960 + /**
  5961 + * @description 组织树节点
  5962 + */
  5963 + ORG_EL: 'interactionOrgTree',
  5964 + }
  5965 +
  5966 +
  5967 + /**
  5968 + * @description 所有设备选项
  5969 + * @type {{id: string, name: string, deviceType: string}[]}
  5970 + */
  5971 + let allDeviceOptions = []
  5972 +
  5973 + let addRowNumber = 0
  5974 +
  5975 + /**
  5976 + * @description 组织id
  5977 + * @type {null}
  5978 + */
  5979 + let orgId = null
  5980 +
  5981 + const getRowFilter = (rowNumber) => `${enumActionEl.ROW_FILTER}${rowNumber}`
  5982 +
  5983 + /**
  5984 + * @description 枚举常量
  5985 + * @enum DEVICE
  5986 + */
  5987 + const enumConst = {
  5988 + /**
  5989 + * @description 设备
  5990 + */
  5991 + DEVICE: 'deviceId',
  5992 + /**
  5993 + * @description 子设备
  5994 + */
  5995 + SLAVE_DEVICE: 'slaveDeviceId',
  5996 + /**
  5997 + * @description 变量
  5998 + */
  5999 + ATTR: 'attr',
  6000 + /**
  6001 + * @description 下发值
  6002 + */
  6003 + VALUE: 'value',
  6004 +
  6005 + /**
  6006 + * @description 方式
  6007 + */
  6008 + WAY: 'way',
  6009 +
  6010 + /**
  6011 + * @description 组织id
  6012 + */
  6013 + ORG_ID: 'orgId',
  6014 + }
  6015 +
  6016 + const sendInstructionWay = {
  6017 + ONE_WAR: 'oneway',
  6018 + TWO_WAY: 'twoway',
  6019 + }
  6020 +
  6021 + /**
  6022 + * @description 创建回显数据 查询出所有网关设备和直连设备
  6023 + */
  6024 + async function getMaterDevice() {
  6025 + if (!orgId) return
  6026 + const [err, res] = await to(ConfigurationNodeApi.getMasterDevice(orgId))
  6027 + allDeviceOptions = res
  6028 + const generateOption = UseLayUi.generateOptionTemplate({ dataSource: res })
  6029 + $(`#${enumActionEl.DEVICE_DATA_BODY_EL}`).find(`select[name="${enumConst.DEVICE}"]`).html(generateOption)
  6030 + UseLayUi.nextTick(() => form.render('select'))
  6031 + }
  6032 +
  6033 + /**
  6034 + * @description 创建JSON编辑器
  6035 + * @param el
  6036 + * @param datum
  6037 + */
  6038 + function createEditor(el, datum = {}) {
  6039 + const editor = ace.edit(el, {
  6040 + maxLines: 10, // 最大行数,超过会自动出现滚动条
  6041 + minLines: 5, // 最小行数,还未到最大行数时,编辑器会自动伸缩大小
  6042 + fontSize: 14, // 编辑器内字体大小
  6043 + tabSize: 2, // 制表符设置为 4 个空格大小
  6044 + });
  6045 + editor.session.setMode("ace/mode/json");
  6046 + editor.getSession().on('change', (event, editor) => {
  6047 + $(`#${el}`).parent().find(`textarea[name="${enumConst.VALUE}"]`).val(editor.getValue())
  6048 + })
  6049 + editor.setValue(datum[enumConst.VALUE] ? datum[enumConst.VALUE] : "{}")
  6050 + }
  6051 +
  6052 + /**
  6053 + * @description 创建组织树
  6054 + */
  6055 + function createOrgTreeSelect() {
  6056 + UseLayUi.createTreeSelect({
  6057 + elem: `#${enumActionEl.ORG_EL}`,
  6058 + layFilter: enumConst.ORG_ID,
  6059 + label: '组织',
  6060 + singleUsage: false,
  6061 + layVerify: 'required',
  6062 + layVerType: 'tips',
  6063 + treeProps: {
  6064 + data: treeList,
  6065 + onlyIconControl: true,
  6066 + click(node) {
  6067 + orgId = node.data.id
  6068 + getMaterDevice()
  6069 + },
  6070 + },
  6071 + })
  6072 + }
  6073 +
  6074 + /**
  6075 + * @description 添加行
  6076 + * @param datum
  6077 + */
  6078 + function addRecord(datum) {
  6079 + const content = `
  6080 + <tr class="layui-form" lay-filter="${getRowFilter(addRowNumber)}">
  6081 + <td>
  6082 + <select name="${enumConst.DEVICE}" lay-filter="${enumConst.DEVICE}" lay-verType="tips" lay-verify="required"></select>
  6083 + </td>
  6084 + <td>
  6085 + <select name="${enumConst.SLAVE_DEVICE}" lay-filter="${enumConst.SLAVE_DEVICE}" lay-verType="tips"></select>
  6086 + </td>
  6087 + <td>
  6088 + <form action="" style="display: flex">
  6089 + <div class="override__radio-default">
  6090 + <input id="${getRowFilter(addRowNumber)}${sendInstructionWay.ONE_WAR}" type="radio" name="${enumConst.WAY}" lay-ignore value="${sendInstructionWay.ONE_WAR}" title="单向" checked="">
  6091 + <label for="${getRowFilter(addRowNumber)}${sendInstructionWay.ONE_WAR}" class="override__radio-label">单向</label>
  6092 + </div>
  6093 + <div class="override__radio-default">
  6094 + <input id="${getRowFilter(addRowNumber)}${sendInstructionWay.TWO_WAY}" type="radio" name="${enumConst.WAY}" lay-ignore value="${sendInstructionWay.TWO_WAY}" title="双向">
  6095 + <label for="${getRowFilter(addRowNumber)}${sendInstructionWay.TWO_WAY}" class="override__radio-label">双向</label>
  6096 + </div>
  6097 + </form>
  6098 + </td>
  6099 + <td class="${enumActionEl.JSON}">
  6100 + <div style="width: 100%;height: 100%;">
  6101 + <div id="${enumActionEl.EDITOR_JSON}${addRowNumber}"></div>
  6102 + <textarea style="display: none" name="${enumConst.VALUE}" placeholder="请输入命令" lay-verType="tips" class="layui-textarea"></textarea>
  6103 + </div>
  6104 + </td>
  6105 + <td>
  6106 + <button type="button" class="layui-btn layui-btn-primary layui-border-red ${enumActionEl.DEL_ROW_EL}">删除</button>
  6107 + </td>
  6108 + </tr>
  6109 + `
  6110 + $(`#${enumActionEl.DEVICE_DATA_BODY_EL}`).append(content)
  6111 + setDeviceOptions(addRowNumber)
  6112 + createEditor(`${enumActionEl.EDITOR_JSON}${addRowNumber}`, datum)
  6113 + form.render('select', getRowFilter(addRowNumber))
  6114 + addRowNumber++
  6115 + }
  6116 +
  6117 + /**
  6118 + * @description 更新变量选项
  6119 + */
  6120 + async function updateVariableOptions(data) {
  6121 + if (!data.value) return
  6122 + const [err, res] = await to(ConfigurationNodeApi.getDeviceAttr(data.value))
  6123 + if (!res) return
  6124 + const generateOption = UseLayUi.generateOptionTemplate({ dataSource: res })
  6125 + $(data.elem).parents('tr').find(`select[name="${enumConst.ATTR}"]`).html(generateOption)
  6126 + form.render('select')
  6127 + }
  6128 +
  6129 + /**
  6130 + * @description 选择设备监听事件
  6131 + */
  6132 + function createSelectDeviceListenEvent() {
  6133 + form.on(`select(${enumConst.DEVICE})`, async (data) => {
  6134 + const filter = $(data.elem).parents('tr').attr('lay-filter')
  6135 + form.val(filter, {
  6136 + [enumConst.SLAVE_DEVICE]: null,
  6137 + })
  6138 + const isGATEWAY = allDeviceOptions.find(item => item.id === data.value)?.deviceType === "GATEWAY"
  6139 + // 网关设备请求子设备
  6140 + if (orgId && isGATEWAY && data.value) {
  6141 + const [err, res] = await to(ConfigurationNodeApi.getSlaveDevice(orgId, data.value))
  6142 + if (!res) return
  6143 + const generateOption = UseLayUi.generateOptionTemplate({ dataSource: res })
  6144 + $(data.elem).parents('tr').find(`select[name="${enumConst.SLAVE_DEVICE}"]`).html(generateOption)
  6145 + }
  6146 + // else {
  6147 + // updateVariableOptions(data)
  6148 + // }
  6149 + UseLayUi.nextTick(() => form.render(`select`, filter))
  6150 + })
  6151 + // form.on(`select(${ enumConst.SLAVE_DEVICE })`, (data) => {
  6152 + // updateVariableOptions(data)
  6153 + // })
  6154 + }
  6155 +
  6156 + /**
  6157 + * @description 删除行
  6158 + */
  6159 + function createDeleteRowListenEvent() {
  6160 + $(`.${enumActionEl.DEL_ROW_EL}`).on('click', (event) => {
  6161 + // $(event.target).parents('tr').find('editor')
  6162 + $(event.target).parents('tr').remove()
  6163 + })
  6164 + }
  6165 +
  6166 + /**
  6167 + * @description 新增行
  6168 + */
  6169 + function createAddRowListenEvent() {
  6170 + $(`#${enumActionEl.ADD_ROW_EL}`).on('click', () => {
  6171 + addRecord()
  6172 + const generateOption = UseLayUi.generateOptionTemplate({ dataSource: allDeviceOptions })
  6173 + $(`#${enumActionEl.DEVICE_DATA_BODY_EL} tr`).last().find(`select[name="${enumConst.DEVICE}"]`).html(generateOption)
  6174 + createDeleteRowListenEvent()
  6175 + form.render('select')
  6176 + })
  6177 + }
  6178 +
  6179 + /**
  6180 + * @description 设置设备选项
  6181 + */
  6182 + function setDeviceOptions(row) {
  6183 + const generateOption = UseLayUi.generateOptionTemplate({ dataSource: allDeviceOptions })
  6184 + $(`#${enumActionEl.DEVICE_DATA_BODY_EL} tr[lay-filter="${getRowFilter(row)}"]`).find(`select[name="${enumConst.DEVICE}"]`).html(generateOption)
  6185 + }
  6186 +
  6187 + /**
  6188 + * @description 生成事件监听
  6189 + */
  6190 + function generatorEventListen() {
  6191 + createSelectDeviceListenEvent()
  6192 + createDeleteRowListenEvent()
  6193 + createAddRowListenEvent()
  6194 + }
  6195 +
  6196 + /**
  6197 + * @description 挂载选项 根据行号 key 挂载option
  6198 + * @param row 行号
  6199 + * @param key select name
  6200 + * @param data 数据源
  6201 + */
  6202 + function mountSelectOptions(row, key, data) {
  6203 + const generateOption = UseLayUi.generateOptionTemplate({ dataSource: data })
  6204 + $(`#${enumActionEl.DEVICE_DATA_BODY_EL}`).find(`tr[lay-filter="${getRowFilter(row)}"] select[name="${key}"]`).html(generateOption)
  6205 + }
  6206 +
  6207 + /**
  6208 + * @description 根据主设备ID获取从设备
  6209 + */
  6210 + async function getSlaveDeviceByMasterDevice(deviceId, row) {
  6211 + const res = await ConfigurationNodeApi.getSlaveDevice(orgId, deviceId)
  6212 + mountSelectOptions(row, enumConst.SLAVE_DEVICE, res)
  6213 + }
  6214 +
  6215 + /**
  6216 + * @description 根据设备ID获取设备属性
  6217 + */
  6218 + async function getDeviceAttrByDeviceId(deviceId, row) {
  6219 + const res = await ConfigurationNodeApi.getDeviceAttr(deviceId)
  6220 + mountSelectOptions(row, enumConst.ATTR, res)
  6221 + }
  6222 +
  6223 + /**
  6224 + * @description 回显表单数据
  6225 + */
  6226 + function echoFormData(info) {
  6227 + const { content: { data = [] } = {}, orgId } = info
  6228 + echoOrgTree(orgId)
  6229 + data.forEach((datum, index) => echoEachData(datum, index))
  6230 + }
  6231 +
  6232 + /**
  6233 + * @description 回显组织树
  6234 + */
  6235 + function echoOrgTree(id) {
  6236 + const node = UseLayUi.findTreeObjectByField(treeList, id)
  6237 + $(`#${enumActionEl.ORG_EL}`).find(`input[name="${enumConst.ORG_ID}"]`).parent().find('span').html(node?.name)
  6238 + }
  6239 +
  6240 + /**
  6241 + * @description 回显每条数据
  6242 + */
  6243 + function echoEachData(datum = {}, row) {
  6244 + addRecord(datum)
  6245 + const deviceId = datum[enumConst.DEVICE]
  6246 + const slaveDeviceId = datum[enumConst.SLAVE_DEVICE]
  6247 + const queue = []
  6248 +
  6249 + if (slaveDeviceId) {
  6250 + queue.push(() => getSlaveDeviceByMasterDevice(deviceId, row))
  6251 + // queue.push(() => getDeviceAttrByDeviceId(slaveDeviceId, row))
  6252 + }
  6253 + // else {
  6254 + // queue.push(() => getDeviceAttrByDeviceId(deviceId, row))
  6255 + // }
  6256 +
  6257 + Promise
  6258 + .all(queue.map(item => item()))
  6259 + .finally(() => {
  6260 + form.val(getRowFilter(row), datum)
  6261 + })
  6262 + }
  6263 +
  6264 + function isJson(string) {
  6265 + if (typeof string === 'string') {
  6266 + try {
  6267 + const obj = JSON.parse(string)
  6268 + if (typeof obj === 'object' && obj !== null) {
  6269 + return true
  6270 + }
  6271 + } catch (e) {
  6272 + return false
  6273 + }
  6274 + }
  6275 + return false
  6276 + }
  6277 +
  6278 + /**
  6279 + * @description 表单验证
  6280 + * @param tableData
  6281 + * @returns {boolean}
  6282 + */
  6283 + function validate(tableData) {
  6284 + let validateFlag = true
  6285 +
  6286 + const formModel = form.val(enumActionEl.FORM_FILTER)
  6287 + if (!formModel[enumConst.ORG_ID]) return false
  6288 +
  6289 + for (let i = 0; i < tableData.length; i++) {
  6290 + const { value } = tableData[i]
  6291 + if (!isJson(value)) {
  6292 + validateFlag = false
  6293 + layer.tips('下发值不正确', $(`#${enumActionEl.DEVICE_DATA_BODY_EL} tr`).eq(i).find(`td.${enumActionEl.JSON}`), { tips: 1 })
  6294 + break
  6295 + }
  6296 + }
  6297 + return validateFlag
  6298 + }
  6299 +
  6300 + /**
  6301 + * @description 保存
  6302 + */
  6303 + async function submit(callback) {
  6304 + const data = Array.from({ length: addRowNumber }).map((_, row) => form.val(getRowFilter(row))).filter(item => Object.keys(item).length)
  6305 + if (!validate(data)) return
  6306 + const formModal = {
  6307 + configurationId,
  6308 + orgId,
  6309 + contentId: currentPageId.id,
  6310 + id: graphId,
  6311 + content: {
  6312 + data,
  6313 + },
  6314 + type: event.data.type,
  6315 + };
  6316 + await to(autoSaveGraphInfo())
  6317 + const [err, res] = await to(ConfigurationNodeApi.updateNodeEvent(formModal))
  6318 + if (err) return
  6319 + UseLayUi.successMsg()
  6320 + callback()
  6321 + }
  6322 +
  6323 + /**
  6324 + * @description 创建弹出层表单
  6325 + * @param event
  6326 + */
  6327 + function createLayerForm(type) {
  6328 + const content = `
  6329 + <form class="layui-form" lay-filter="${enumActionEl.FORM_FILTER}">
  6330 + <div style="width:400px">
  6331 + <div class="layui-form-item">
  6332 + <label class="layui-form-label">事件</label>
  6333 + <div class="layui-input-block">
  6334 + <input type="text" name="event" class="layui-input" value="${enumEventType[type]}" disabled>
  6335 + </div>
  6336 + </div>
  6337 + <div class="layui-form-item">
  6338 + <label class="layui-form-label">动作</label>
  6339 + <div class="layui-input-block">
  6340 + <select name="action" lay-verify="required">
  6341 + <option value="0" selected>给变量赋值</option>
  6342 + </select>
  6343 + </div>
  6344 + </div>
  6345 + <div class="layui-form-item">
  6346 + <label class="layui-form-label">类型</label>
  6347 + <div class="layui-input-block">
  6348 + <input type="radio" name="type" value="1" title="联网设备" checked>
  6349 + <input type="radio" name="type" value="2" title="产品/场景" disabled>
  6350 + </div>
  6351 + </div>
  6352 + <div id="${enumActionEl.ORG_EL}"></div>
  6353 + </div>
  6354 + </form>
  6355 + <div class="override__table">
  6356 + <table class="layui-table" >
  6357 + <thead>
  6358 + <tr>
  6359 + <th style="text-align:center">选择设备</th>
  6360 + <th style="text-align:center">选择子设备</th>
  6361 + <th style="text-align:center">单向 / 双向</th>
  6362 + <th style="text-align:center">下发值</th>
  6363 + <th style="text-align:center">操作</th>
  6364 + </tr>
  6365 + </thead>
  6366 + <tbody id="${enumActionEl.DEVICE_DATA_BODY_EL}"></tbody>
  6367 + </table>
  6368 + <div style="display:flex;justify-content:center;">
  6369 + <button type="button" class="layui-btn layui-btn-primary layui-border-blue" id="${enumActionEl.ADD_ROW_EL}">添加一条</button>
  6370 + </div>
  6371 + </div>`
  6372 +
  6373 + layer.open({
  6374 + title: '创建交互',
  6375 + content,
  6376 + skin: 'event-layer__override',
  6377 + // area: ["1100px", "700px"],
  6378 + area: '1100px',
  6379 + offset: '100px',
  6380 + btn: ["保存", "取消"],
  6381 + shade: ["0.7", "#fafafa"],
  6382 + yes(index) {
  6383 + form.on(`submit(${enumActionEl.LAYER_SUBMIT_FILTER})`, data => {
  6384 + submit(() => {
  6385 + layer.close(index)
  6386 + getNodeBindInfo()
  6387 + })
  6388 + })
  6389 + },
  6390 + but2(index, layero) {
  6391 + return false
  6392 + },
  6393 + async success(layero, index) {
  6394 + $(layero).addClass('layui-form').find('.layui-layer-btn0').attr({
  6395 + 'lay-submit': '',
  6396 + 'lay-filter': enumActionEl.LAYER_SUBMIT_FILTER,
  6397 + })
  6398 + createOrgTreeSelect()
  6399 + const info = getLayerBindInfo('event', type)
  6400 + const { content: { data = [] } = {} } = info
  6401 + if (!info || !data.length) {
  6402 + addRecord()
  6403 + } else {
  6404 + await getMaterDevice()
  6405 + echoFormData(info)
  6406 + }
  6407 + generatorEventListen()
  6408 + form.render()
  6409 + },
  6410 + })
  6411 + }
  6412 +
  6413 + createLayerForm(event.data.type)
  6414 + }
  6415 +
  6416 + /**
  6417 + * @description 处理单击 or 双击事件
  6418 + */
  6419 + function handleClickOrDbClick(event) {
  6420 +
  6421 + const enumEventType = {
  6422 + DOWN: "按下",
  6423 + UP: "抬起",
  6424 + SINGLE: "单击",
  6425 + DOUBLE: "双击",
  6426 + };
  6427 +
  6428 + /**
  6429 + * @description
  6430 + */
  6431 + const enumConst = {
  6432 + EVENT: 'event',
  6433 + ACTION: 'actionType',
  6434 + PAGE_VALUE: 'pageValue',
  6435 + LINK_VALUE: 'linkValue',
  6436 + }
  6437 +
  6438 + /**
  6439 + * @description 动作类型
  6440 + */
  6441 + const enumActionType = {
  6442 + PAGE: 'PAGE',
  6443 + LINK: 'LINK',
  6444 + PROPS: 'PROPS',
  6445 + }
  6446 +
  6447 + const enumGetValue = {
5909 6448 [enumActionType.PAGE]: enumConst.PAGE_VALUE,
5910 6449 [enumActionType.LINK]: enumConst.LINK_VALUE,
5911 6450 }
... ... @@ -5947,8 +6486,8 @@ DataFormatPanel.prototype.addDataFont = function (container) {
5947 6486 [enumGetValue[content.type]]: content.value,
5948 6487 }
5949 6488 if (content.type === enumActionType.PAGE) {
5950   - $(`#${ enumActionEl.PAGE_EL_ID }`).css({ display: 'block' })
5951   - $(`#${ enumActionEl.LINK_EL_ID }`).css({ display: 'none' })
  6489 + $(`#${enumActionEl.PAGE_EL_ID}`).css({ display: 'block' })
  6490 + $(`#${enumActionEl.LINK_EL_ID}`).css({ display: 'none' })
5952 6491 }
5953 6492 form.val(enumActionEl.FORM_FILTER, val)
5954 6493 }
... ... @@ -5968,7 +6507,8 @@ DataFormatPanel.prototype.addDataFont = function (container) {
5968 6507 value: formVal[enumGetValue[formVal[enumConst.ACTION]]],
5969 6508 },
5970 6509 }
5971   - const [ err ] = await to(ConfigurationNodeApi.updateNodeEvent(data))
  6510 + await to(autoSaveGraphInfo())
  6511 + const [err] = await to(ConfigurationNodeApi.updateNodeEvent(data))
5972 6512 if (err) return
5973 6513 UseLayUi.successMsg()
5974 6514 callback()
... ... @@ -5994,523 +6534,897 @@ DataFormatPanel.prototype.addDataFont = function (container) {
5994 6534 return UseLayUi.generateOptionTemplate({ dataSource: options, addPlaceholderOption: false })
5995 6535 }
5996 6536
5997   - function generatorEventListen() {
5998   - form.on(`select(${ enumActionEl.ACTION_SELECT_FILTER })`, (data) => {
5999   - const { value } = data
6000   - if (value === enumActionType.PAGE) {
6001   - $(`#${ enumActionEl.LINK_EL_ID }`).css({ display: 'none' })
6002   - $(`#${ enumActionEl.PAGE_EL_ID }`).css({ display: 'block' })
6003   - } else if (value === enumActionType.LINK) {
6004   - $(`#${ enumActionEl.PAGE_EL_ID }`).css({ display: 'none' })
6005   - $(`#${ enumActionEl.LINK_EL_ID }`).css({ display: 'block' })
6006   - }
6007   - })
  6537 + function generatorEventListen() {
  6538 + form.on(`select(${enumActionEl.ACTION_SELECT_FILTER})`, (data) => {
  6539 + const { value } = data
  6540 + if (value === enumActionType.PAGE) {
  6541 + $(`#${enumActionEl.LINK_EL_ID}`).css({ display: 'none' })
  6542 + $(`#${enumActionEl.PAGE_EL_ID}`).css({ display: 'block' })
  6543 + } else if (value === enumActionType.LINK) {
  6544 + $(`#${enumActionEl.PAGE_EL_ID}`).css({ display: 'none' })
  6545 + $(`#${enumActionEl.LINK_EL_ID}`).css({ display: 'block' })
  6546 + }
  6547 + })
  6548 + }
  6549 +
  6550 + /**
  6551 + * @description 创建弹窗表单
  6552 + */
  6553 + function createLayerForm(type) {
  6554 +
  6555 + const content = `
  6556 + <form class="layui-form" lay-filter="${enumActionEl.FORM_FILTER}">
  6557 + <div style="width:400px">
  6558 + <div class="layui-form-item">
  6559 + <label class="layui-form-label">事件</label>
  6560 + <div class="layui-input-block">
  6561 + <input type="text" name="${enumConst.EVENT}" disabled class="layui-input" value="${enumEventType[type]}">
  6562 + </div>
  6563 + </div>
  6564 + <div class="layui-form-item">
  6565 + <label class="layui-form-label">动作</label>
  6566 + <div class="layui-input-block">
  6567 + <select name="${enumConst.ACTION}" lay-verType="tips" lay-verify="required" lay-filter="${enumActionEl.ACTION_SELECT_FILTER}">
  6568 + ${generatorActionOptions()}
  6569 + </select>
  6570 + </div>
  6571 + </div>
  6572 + <div class="layui-form-item" id="${enumActionEl.LINK_EL_ID}">
  6573 + <label class="layui-form-label">链接</label>
  6574 + <div class="layui-input-block">
  6575 + <input type="text" lay-verType="tips" name="${enumConst.LINK_VALUE}" class="layui-input">
  6576 + </div>
  6577 + </div>
  6578 + <div class="layui-form-item" id="${enumActionEl.PAGE_EL_ID}" style="display:none">
  6579 + <label class="layui-form-label">页面</label>
  6580 + <div class="layui-input-block">
  6581 + <select name="${enumConst.PAGE_VALUE}" lay-verType="tips" id="pageSelect">
  6582 + ${generatorPageOptions()}
  6583 + </select>
  6584 + </div>
  6585 + </div>
  6586 + </div>
  6587 + </form>
  6588 + `
  6589 +
  6590 + layer.open({
  6591 + title: "创建交互",
  6592 + content,
  6593 + area: ["800px", "500px"],
  6594 + btn: ["保存", "取消"],
  6595 + yes(index) {
  6596 + form.on(`submit(${enumActionEl.LAYER_SUBMIT_FILTER})`, data => {
  6597 + submit(() => {
  6598 + layer.close(index)
  6599 + getNodeBindInfo()
  6600 + })
  6601 + })
  6602 + },
  6603 + btn2(index) {
  6604 + layer.close(index);
  6605 + },
  6606 + success(layero) {
  6607 + $(layero).addClass('layui-form').find('.layui-layer-btn0').attr({
  6608 + 'lay-submit': '',
  6609 + 'lay-filter': enumActionEl.LAYER_SUBMIT_FILTER,
  6610 + })
  6611 + generatorEventListen()
  6612 + const info = getLayerBindInfo('event', type)
  6613 + form.render(null, enumActionEl.FORM_FILTER)
  6614 + if (info) echoFormData(info)
  6615 + },
  6616 + shade: ["0.7", "#fafafa"],
  6617 + });
  6618 + }
  6619 +
  6620 + createLayerForm(event.data.type)
  6621 + }
  6622 +
  6623 + /**
  6624 + * @description 处理数据动效
  6625 + */
  6626 + function handleDataDynamicEffect(event) {
  6627 +
  6628 + const IS_DISPLAY = event.data.type === 'DISPLAY'
  6629 +
  6630 + const enumEventType = {
  6631 + FLASH: '闪烁',
  6632 + DISPLAY: '显示/隐藏',
  6633 + ROTATE: '旋转',
  6634 + }
  6635 +
  6636 + const enumActionEl = {
  6637 + ROW_FILTER: 'dataDynamicEffectRowFilter',
  6638 + FORM_FILTER: 'dataDynamicEffectFormFilter',
  6639 + TABLE_BODY_EL: 'dataDynamicEffectTbody',
  6640 + TYPE_EL: 'dataDynamicEffectType',
  6641 + DEL_BTN_EL: 'dataDynamicEffectDelBtn',
  6642 + ADD_BTN_EL: 'dataDynamicEffectAddBtn',
  6643 + DISPLAY_SWITCH_EL: 'visibleOrHidden',
  6644 + LAYER_SUBMIT_FILTER: 'dynamicEffectLayerFilter',
  6645 + MIN_FILTER: 'dynamicEffectMinFilter',
  6646 + MAX_FILTER: 'dynamicEffectMaxFilter',
  6647 + DATA_SOURCE_COMP_EL: 'dynamicDataSourceCompEl',
  6648 + }
  6649 +
  6650 + const getRowFilter = (rowNumber) => `${enumActionEl.ROW_FILTER}${rowNumber}`
  6651 +
  6652 + /**
  6653 + * @description
  6654 + */
  6655 + const enumConst = {
  6656 + MIN: 'min',
  6657 + MAX: 'max',
  6658 + TYPE: 'type',
  6659 + ORG_ID: 'orgId',
  6660 + DEVICE_ID: 'deviceId',
  6661 + SLAVE_DEVICE_ID: 'slaveDeviceId',
  6662 + ATTR: 'attr',
  6663 + GATEWAY: 'GATEWAY',
  6664 + }
  6665 +
  6666 + const enumDisplayType = HandleDynamicEffect.enumDisplayType
  6667 +
  6668 + /**
  6669 + * @description
  6670 + */
  6671 + let addRowNumber = 0
  6672 +
  6673 + function generatorDisplayOptions() {
  6674 + const options = [
  6675 + { name: '显示', id: enumDisplayType.SHOW },
  6676 + { name: '隐藏', id: enumDisplayType.HIDDEN },
  6677 + ]
  6678 + const template = UseLayUi.generateOptionTemplate({ dataSource: options })
  6679 + return `
  6680 + <div class="layui-form-item" style="margin-bottom: 0px">
  6681 + <div class="layui-input-block" style="margin-left: 0px;">
  6682 + <select name="${enumConst.TYPE}" lay-verType="tips" lay-verify="required">${template}</select>
  6683 + </div>
  6684 + </div>
  6685 + `
  6686 + }
  6687 +
  6688 + /**
  6689 + * @description 添加一条记录
  6690 + */
  6691 + function addRecord() {
  6692 + const content = `
  6693 + <tr class="layui-form" lay-filter="${getRowFilter(addRowNumber)}">
  6694 + ${IS_DISPLAY && `<td>${generatorDisplayOptions()}</td>`}
  6695 + <td>
  6696 + <input autocomplete="off" lay-verType="tips" lay-verify="required" type="number" name="${enumConst.MIN}" class="layui-input ${enumActionEl.MIN_FILTER}">
  6697 + </td>
  6698 + <td>
  6699 + <input autocomplete="off" lay-verType="tips" lay-verify="required" type="number" name="${enumConst.MAX}" class="layui-input ${enumActionEl.MAX_FILTER}">
  6700 + </td>
  6701 + <td style="text-align: center;">
  6702 + <button type="button" class="layui-btn layui-btn-primary layui-border-red ${enumActionEl.DEL_BTN_EL}">删除</button>
  6703 + </td>
  6704 + </tr>
  6705 + `
  6706 + addRowNumber++
  6707 + $(`#${enumActionEl.TABLE_BODY_EL}`).append(content)
  6708 + if (IS_DISPLAY) {
  6709 + form.render()
  6710 + }
  6711 + }
  6712 +
  6713 + /**
  6714 + * @description 创建添加记录事件
  6715 + */
  6716 + function createAddRowListenEvent() {
  6717 + $(`#${enumActionEl.ADD_BTN_EL}`).on('click', () => {
  6718 + addRecord()
  6719 + createDeleteRowListenEvent()
  6720 + })
  6721 + }
  6722 +
  6723 + /**
  6724 + * @description 创建删除行事件
  6725 + */
  6726 + function createDeleteRowListenEvent() {
  6727 + $(`.${enumActionEl.DEL_BTN_EL}`).on('click', (event) => {
  6728 + $(event.target).parents('tr').remove()
  6729 + })
  6730 + }
  6731 +
  6732 +
  6733 + /**
  6734 + * @description 创建输入监听
  6735 + */
  6736 + function createInputListener() {
  6737 + $(`#${enumActionEl.TABLE_BODY_EL}`)
  6738 + .on('input', `.${enumActionEl.MIN_FILTER}`, event => {
  6739 + const minVal = $(event.target).val()
  6740 + const maxVal = $(event.target).parents('tr').find(`input.${enumActionEl.MAX_FILTER}`).val()
  6741 + if (maxVal !== '' && Number(minVal) > Number(maxVal)) {
  6742 + layer.tips('输入值大于最大值', $(event.target), {
  6743 + tips: 1,
  6744 + });
  6745 + }
  6746 + })
  6747 + .on('input', `.${enumActionEl.MAX_FILTER}`, event => {
  6748 + const maxVal = $(event.target).val()
  6749 + const minVal = $(event.target).parents('tr').find(`input.${enumActionEl.MIN_FILTER}`).val()
  6750 + if (minVal !== '' && Number(maxVal) < Number(minVal)) {
  6751 + layer.tips('输入值小于最小值', $(event.target), {
  6752 + tips: 1,
  6753 + });
  6754 + }
  6755 + })
  6756 + }
  6757 +
  6758 + /**
  6759 + * @description 创建事件监听
  6760 + */
  6761 + function createEventListen() {
  6762 + createInputListener()
  6763 + createAddRowListenEvent()
  6764 + createDeleteRowListenEvent()
  6765 + }
  6766 +
  6767 + /**
  6768 + * @description 回显数据
  6769 + */
  6770 + function echoData(info) {
  6771 + const { condition = [] } = info
  6772 + echoEachData(condition)
  6773 + }
  6774 +
  6775 + /**
  6776 + * @description 回显行数据
  6777 + */
  6778 + function echoEachData(condition = []) {
  6779 + condition.forEach((item, index) => {
  6780 + addRecord()
  6781 + form.val(getRowFilter(index), { ...item })
  6782 + })
  6783 + }
  6784 +
  6785 + function validate(tableData) {
  6786 + let validateFlag = true
  6787 + for (let i = 0; i < tableData.length; i++) {
  6788 + const { min, max } = tableData[i]
  6789 + if (Number(min) > Number(max)) {
  6790 + validateFlag = false
  6791 + layer.tips('输入值大于最大值', $(`#${enumActionEl.TABLE_BODY_EL} tr`).eq(i).find(`input[name="${enumConst.MIN}"]`), { tips: 1 })
  6792 + break
  6793 + } else if (Number(max) < Number(min)) {
  6794 + validateFlag = false
  6795 + layer.tips('输入值小于最小值', $(`#${enumActionEl.TABLE_BODY_EL} tr`).eq(i).find(`input[name="${enumConst.MAX}"]`), { tips: 1 })
  6796 + break
  6797 + }
  6798 + }
  6799 + return validateFlag
  6800 + }
  6801 +
  6802 + async function submit(callback) {
  6803 + const tableData = Array.from({ length: addRowNumber }).map((_, index) => form.val(getRowFilter(index))).filter(obj => Object.keys(obj).length)
  6804 + if (!validate(tableData)) return
  6805 + const formVal = form.val(enumActionEl.FORM_FILTER)
  6806 + const formModel = {
  6807 + configurationId,
  6808 + contentId: currentPageId.id,
  6809 + ...formVal,
  6810 + id: graphId,
  6811 + condition: tableData,
  6812 + type: event.data.type,
  6813 + }
  6814 + await to(autoSaveGraphInfo())
  6815 + const [err, res] = await to(ConfigurationNodeApi.updateNodeAct(formModel))
  6816 + if (err) return
  6817 + UseLayUi.successMsg()
  6818 + callback()
  6819 + }
  6820 +
  6821 + function isExistInArea(min, max, value) {
  6822 + return Number(value) >= Number(min) && Number(value) <= Number(max)
6008 6823 }
6009 6824
6010   - /**
6011   - * @description 创建弹窗表单
6012   - */
6013 6825 function createLayerForm(type) {
6014   -
6015 6826 const content = `
6016   - <form class="layui-form" lay-filter="${ enumActionEl.FORM_FILTER }">
6017   - <div style="width:400px">
6018   - <div class="layui-form-item">
6019   - <label class="layui-form-label">事件</label>
6020   - <div class="layui-input-block">
6021   - <input type="text" name="${ enumConst.EVENT }" disabled class="layui-input" value="${ enumEventType[type] }">
6022   - </div>
6023   - </div>
6024   - <div class="layui-form-item">
6025   - <label class="layui-form-label">动作</label>
6026   - <div class="layui-input-block">
6027   - <select name="${ enumConst.ACTION }" lay-verType="tips" lay-verify="required" lay-filter="${ enumActionEl.ACTION_SELECT_FILTER }">
6028   - ${ generatorActionOptions() }
6029   - </select>
6030   - </div>
6031   - </div>
6032   - <div class="layui-form-item" id="${ enumActionEl.LINK_EL_ID }">
6033   - <label class="layui-form-label">链接</label>
6034   - <div class="layui-input-block">
6035   - <input type="text" lay-verType="tips" name="${ enumConst.LINK_VALUE }" class="layui-input">
  6827 + <form class="layui-form" lay-filter="${enumActionEl.FORM_FILTER}">
  6828 + <div style="width:400px">
  6829 + <div class="layui-form-item">
  6830 + <label class="layui-form-label">类型</label>
  6831 + <div class="layui-input-block">
  6832 + <input type="radio" name="type" value="1" title="联网设备" checked>
  6833 + <input type="radio" name="type" value="2" title="产品/场景" disabled>
  6834 + </div>
6036 6835 </div>
  6836 +
  6837 + <div id="${enumActionEl.DATA_SOURCE_COMP_EL}"></div>
  6838 +
6037 6839 </div>
6038   - <div class="layui-form-item" id="${ enumActionEl.PAGE_EL_ID }" style="display:none">
6039   - <label class="layui-form-label">页面</label>
6040   - <div class="layui-input-block">
6041   - <select name="${ enumConst.PAGE_VALUE }" lay-verType="tips" id="pageSelect">
6042   - ${ generatorPageOptions() }
6043   - </select>
6044   - </div>
  6840 + </form>
  6841 + <div class="override__table">
  6842 + <table class="layui-table" >
  6843 + <thead>
  6844 + <tr>
  6845 + ${IS_DISPLAY ? '<th style="text-align:center">类型</th>' : ''}
  6846 + <th style="text-align:center">最小值(<=)</th>
  6847 + <th style="text-align:center">最大值(>=)</th>
  6848 + <th style="text-align:center">操作</th>
  6849 + </tr>
  6850 + </thead>
  6851 + <tbody id="${enumActionEl.TABLE_BODY_EL}"></tbody>
  6852 + </table>
  6853 + <div style="display:flex;justify-content:center;">
  6854 + <button type="button" class="layui-btn layui-btn-primary layui-border-blue" id="${enumActionEl.ADD_BTN_EL}">添加一条</button>
6045 6855 </div>
6046 6856 </div>
6047   - </form>
6048   - `
  6857 + `
6049 6858
6050 6859 layer.open({
6051   - title: "创建交互",
  6860 + title: enumEventType[type],
6052 6861 content,
6053   - area: [ "800px", "500px" ],
6054   - btn: [ "保存", "取消" ],
  6862 + skin: 'event-layer__override',
  6863 + btn: ['保存', '取消'],
  6864 + offset: '100px',
  6865 + area: IS_DISPLAY ? '1000px' : '800PX',
  6866 + success(layero) {
  6867 + $(layero).addClass('layui-form').find('.layui-layer-btn0').attr({
  6868 + 'lay-submit': '',
  6869 + 'lay-filter': enumActionEl.LAYER_SUBMIT_FILTER,
  6870 + })
  6871 + const {
  6872 + component,
  6873 + echoDataSource,
  6874 + } = generatorDataSourceComponent({ overrideClass: 'dynamic-effect__data-source-comp--override' })
  6875 + $(`#${enumActionEl.DATA_SOURCE_COMP_EL}`).append(component)
  6876 + const info = getLayerBindInfo('act', type)
  6877 + const { condition = [] } = info
  6878 + if (info && condition.length) {
  6879 + echoDataSource(info)
  6880 + echoData(info)
  6881 + } else {
  6882 + addRecord()
  6883 + }
  6884 + createEventListen()
  6885 + form.render()
  6886 + },
6055 6887 yes(index) {
6056   - form.on(`submit(${ enumActionEl.LAYER_SUBMIT_FILTER })`, data => {
  6888 + form.on(`submit(${enumActionEl.LAYER_SUBMIT_FILTER})`, data => {
6057 6889 submit(() => {
6058 6890 layer.close(index)
6059 6891 getNodeBindInfo()
6060 6892 })
6061 6893 })
6062 6894 },
6063   - btn2(index) {
6064   - layer.close(index);
6065   - },
6066   - success(layero) {
6067   - $(layero).addClass('layui-form').find('.layui-layer-btn0').attr({
6068   - 'lay-submit': '',
6069   - 'lay-filter': enumActionEl.LAYER_SUBMIT_FILTER,
6070   - })
6071   - generatorEventListen()
6072   - const info = getLayerBindInfo('event', type)
6073   - form.render(null, enumActionEl.FORM_FILTER)
6074   - if (info) echoFormData(info)
  6895 + btn2() {
  6896 +
6075 6897 },
6076   - shade: [ "0.7", "#fafafa" ],
6077   - });
  6898 + })
6078 6899 }
6079 6900
6080 6901 createLayerForm(event.data.type)
  6902 +
6081 6903 }
6082 6904
6083 6905 /**
6084   - * @description 处理数据动效
  6906 + * @description 生成数据源组件
  6907 + * @param {object} options
  6908 + * @param {string} [options.overrideClass = ''] options.overrideClass
  6909 + * @param {boolean} [options.validate = true ] options.validate
6085 6910 */
6086   - function handleDataDynamicEffect(event) {
6087   -
6088   - const IS_DISPLAY = event.data.type === 'DISPLAY'
6089   -
6090   - const enumEventType = {
6091   - FLASH: '闪烁',
6092   - DISPLAY: '显示/隐藏',
6093   - ROTATE: '旋转',
6094   - }
6095   -
6096   - const enumActionEl = {
6097   - ROW_FILTER: 'dataDynamicEffectRowFilter',
6098   - FORM_FILTER: 'dataDynamicEffectFormFilter',
6099   - TABLE_BODY_EL: 'dataDynamicEffectTbody',
6100   - TYPE_EL: 'dataDynamicEffectType',
6101   - ORG_EL: 'dataDynamicEffectOrg',
6102   - ORG_FILTER: 'dataDynamicEffectOrgFilter',
6103   - DEVICE_EL: 'dataDynamicEffectDevice',
6104   - SLAVE_DEVICE_EL: 'dataDynamicEffectSlaveDevice',
6105   - ATTR_EL: 'dataDynamicEffectAtt',
6106   - DEL_BTN_EL: 'dataDynamicEffectDelBtn',
6107   - ADD_BTN_EL: 'dataDynamicEffectAddBtn',
6108   - DISPLAY_SWITCH_EL: 'visibleOrHidden',
6109   - LAYER_SUBMIT_FILTER: 'dynamicEffectLayerFilter',
6110   - MIN_FILTER: 'dynamicEffectMinFilter',
6111   - MAX_FILTER: 'dynamicEffectMaxFilter',
6112   - }
  6911 + function generatorDataSourceComponent(options = {}) {
  6912 + const { overrideClass = '', validate = true } = options
  6913 + const componentFilter = `data-source__component-filter-${Date.now()}`
  6914 + const componentId = `data-source__component-${Date.now()}`
6113 6915
6114   - const getRowFilter = (rowNumber) => `${ enumActionEl.ROW_FILTER }${ rowNumber }`
  6916 + const validateRule = validate ? { layVerify: 'required', layVerType: 'tips' } : {}
6115 6917
6116   - /**
6117   - * @description
6118   - */
6119   - const enumConst = {
6120   - MIN: 'min',
6121   - MAX: 'max',
6122   - TYPE: 'type',
  6918 + const enumDataSourceConst = {
6123 6919 ORG_ID: 'orgId',
6124 6920 DEVICE_ID: 'deviceId',
6125 6921 SLAVE_DEVICE_ID: 'slaveDeviceId',
6126 6922 ATTR: 'attr',
6127 6923 GATEWAY: 'GATEWAY',
6128 6924 }
  6925 + /**
  6926 + * @description
  6927 + * @type {{id: string, deviceType: string, name: string}[]}
  6928 + */
  6929 + let deviceList = []
  6930 +
  6931 + const component = document.createElement('div')
  6932 +
  6933 + $(component)
  6934 + .addClass(`layui-form data-source__component-style ${overrideClass}`)
  6935 + .attr({
  6936 + id: componentId,
  6937 + 'lay-filter': componentFilter,
  6938 + })
  6939 +
  6940 + init()
  6941 +
  6942 + function init() {
  6943 + generatorOrgTres()
  6944 + generatorDeviceSelect()
  6945 + generatorSlaveDevice()
  6946 + generatorAttrSelect()
  6947 + }
6129 6948
6130   - const enumDisplayType = HandleDynamicEffect.enumDisplayType
6131 6949
6132 6950 /**
6133   - * @description 设备列表
  6951 + * @description 根据组织ID获取设备
6134 6952 */
6135   - let deviceList = []
  6953 + async function getDevicesByOrgId(organizationId) {
  6954 + if (organizationId) {
  6955 + const items = deviceList = await ConfigurationNodeApi.getMasterDevice(organizationId);
  6956 + $(`#${componentId} `).find(`select[name="${enumDataSourceConst.DEVICE_ID}"]`).html(UseLayUi.generateOptionTemplate({ dataSource: items }))
  6957 + form.render('select', componentFilter)
  6958 + }
  6959 + }
6136 6960
6137 6961 /**
6138   - * @description 当前组织ID
6139   - * @type {null | string}
  6962 + * @description 通过主设备ID获取从设备
6140 6963 */
6141   - let currentOrgId = null
  6964 + async function getSlaveDeviceByMasterDeviceId(orgId, deviceId) {
  6965 + if (deviceId && currentCheckedOrgNode) {
  6966 + const items = await ConfigurationNodeApi.getSlaveDevice(orgId, deviceId);
  6967 + $(`#${componentId} `).find(`select[name="${enumDataSourceConst.SLAVE_DEVICE_ID}"]`).html(UseLayUi.generateOptionTemplate({ dataSource: items }))
  6968 + form.render('select', componentFilter)
  6969 + }
  6970 + }
6142 6971
6143 6972 /**
6144   - * @description
  6973 + * @description 根据设备ID获取属性
6145 6974 */
6146   - let addRowNumber = 0
  6975 + async function getAttrByDeviceId(tbDeviceId) {
  6976 + if (tbDeviceId) {
  6977 + const [err, res] = await to(ConfigurationNodeApi.getDeviceAttr(tbDeviceId))
  6978 + $(`#${componentId} `).find(`select[name="${enumDataSourceConst.ATTR}"]`).html(UseLayUi.generateOptionTemplate({ dataSource: res }))
  6979 + form.render('select', componentFilter)
  6980 + }
  6981 + }
6147 6982
6148 6983
6149 6984 /**
6150   - * @description 生成组织下拉树
  6985 + * @description 生成组织选择
6151 6986 */
6152   - function generatorOrgTreeSelect() {
  6987 + async function generatorOrgTres() {
  6988 + const orgContainerId = `data-source__component--org-${Date.now()}`
  6989 + const orgContainer = `<div id="${orgContainerId}"></div>`
  6990 + $(component).append(orgContainer)
  6991 +
  6992 + const [err, res] = await to(ConfigurationNodeApi.getOrgTree())
  6993 + if (err) return
  6994 + treeList = res
  6995 +
6153 6996 UseLayUi.createTreeSelect({
6154   - elem: `#${ enumActionEl.ORG_EL }`,
6155   - layFilter: enumConst.ORG_ID,
  6997 + elem: `#${orgContainerId}`,
  6998 + layFilter: enumDataSourceConst.ORG_ID,
6156 6999 label: '组织',
6157 7000 singleUsage: false,
  7001 + className: 'data-source__component-select',
  7002 + ...validateRule,
6158 7003 treeProps: {
6159 7004 data: treeList,
6160 7005 onlyIconControl: true,
6161 7006 click(node) {
6162   - currentOrgId = node.data.id
6163   - getDeviceByOrg(node.data.id)
  7007 + form.val(componentFilter, {
  7008 + [enumDataSourceConst.DEVICE_ID]: null,
  7009 + [enumDataSourceConst.SLAVE_DEVICE_ID]: null,
  7010 + [enumDataSourceConst.ATTR]: null,
  7011 + })
  7012 + getDevicesByOrgId(node.data.id)
6164 7013 },
6165 7014 },
6166 7015 })
6167 7016 }
6168 7017
  7018 + /**
  7019 + * @description 生成设备选择器
  7020 + */
  7021 + function generatorDeviceSelect() {
  7022 + const deviceSelect = UseLayUi.createSelect({
  7023 + label: '设备',
  7024 + bindValueFiled: enumDataSourceConst.DEVICE_ID,
  7025 + layFilter: `${componentFilter}--${enumDataSourceConst.DEVICE_ID}`,
  7026 + className: 'data-source__component-select',
  7027 + ...validateRule,
  7028 + onClick(data) {
  7029 + const { value } = data
  7030 + const selected = deviceList.find(item => item.id === value)
  7031 + form.val(componentFilter, {
  7032 + [enumDataSourceConst.SLAVE_DEVICE_ID]: null,
  7033 + [enumDataSourceConst.ATTR]: null,
  7034 + })
  7035 + if (selected.deviceType === enumDataSourceConst.GATEWAY) {
  7036 + $(`#${componentId}`).find(`select[name="${enumDataSourceConst.SLAVE_DEVICE_ID}"]`)
  7037 + .attr('lay-verify', 'required').attr('lay-verType', 'tips')
  7038 + .parentsUntil(`#${componentId}`).show()
  7039 + getSlaveDeviceByMasterDeviceId(currentCheckedOrgNode, selected.id)
  7040 + } else {
  7041 + $(`#${componentId}`).find(`select[name="${enumDataSourceConst.SLAVE_DEVICE_ID}"]`)
  7042 + .attr('lay-verify', '').attr('lay-verType', 'tips')
  7043 + .parentsUntil(`#${componentId}`).hide()
  7044 + getAttrByDeviceId(selected.id)
  7045 + }
  7046 + },
  7047 + })
  7048 + $(component).append(deviceSelect)
  7049 + }
  7050 +
  7051 + /**
  7052 + * @description 生成从设备选择器
  7053 + */
  7054 + function generatorSlaveDevice() {
  7055 + const slaveDeviceSelect = UseLayUi.createSelect({
  7056 + label: '子设备',
  7057 + bindValueFiled: enumDataSourceConst.SLAVE_DEVICE_ID,
  7058 + layFilter: `${componentFilter}--${enumDataSourceConst.SLAVE_DEVICE_ID}`,
  7059 + className: 'data-source__component-select',
  7060 + onClick(data) {
  7061 + const { value } = data
  7062 + form.val(componentFilter, {
  7063 + [enumDataSourceConst.ATTR]: null,
  7064 + })
  7065 + getAttrByDeviceId(value)
  7066 + },
  7067 + })
  7068 + $(component).append(slaveDeviceSelect)
  7069 + }
  7070 +
  7071 + /**
  7072 + * @description 生成属性选择器
  7073 + */
  7074 + function generatorAttrSelect() {
  7075 + const attrsSelect = UseLayUi.createSelect({
  7076 + label: '属性',
  7077 + bindValueFiled: enumDataSourceConst.ATTR,
  7078 + layFilter: `${componentFilter}--${enumDataSourceConst.ATTR}`,
  7079 + className: 'data-source__component-select',
  7080 + ...validateRule,
  7081 + })
  7082 + $(component).append(attrsSelect)
  7083 + }
  7084 +
  7085 + /**
  7086 + * @description 回显数据
  7087 + * @param {{orgId: string, deviceId: string, slaveDeviceId?: string, attr: string}} dataSource
  7088 + */
  7089 + function echoDataSource(dataSource = {}) {
  7090 + const { orgId, deviceId, slaveDeviceId, attr } = dataSource
  7091 + const queue = []
  7092 + if (orgId) {
  7093 + currentCheckedOrgNode = orgId
  7094 + queue.push(getDevicesByOrgId(orgId))
  7095 + }
  7096 + if (slaveDeviceId) {
  7097 + queue.push(getSlaveDeviceByMasterDeviceId(orgId, deviceId))
  7098 + $(`#${componentId}`).find(`select[name="${enumDataSourceConst.SLAVE_DEVICE_ID}"]`).parentsUntil(`#${componentId}`).show()
  7099 + queue.push(getAttrByDeviceId(slaveDeviceId))
  7100 + } else {
  7101 + $(`#${componentId}`).find(`select[name="${enumDataSourceConst.SLAVE_DEVICE_ID}"]`).parentsUntil(`#${componentId}`).hide()
  7102 + queue.push(getAttrByDeviceId(deviceId))
  7103 + }
  7104 + Promise.all(queue)
  7105 + .finally(() => {
  7106 + const orgNode = UseLayUi.findTreeObjectByField(treeList, currentCheckedOrgNode)
  7107 + $(`#${componentId} input[name="${enumDataSourceConst.ORG_ID}"]`).parent().find('span').html(orgNode?.name)
  7108 + form.val(componentFilter, {
  7109 + orgId,
  7110 + deviceId,
  7111 + slaveDeviceId,
  7112 + attr,
  7113 + })
  7114 + })
  7115 + }
  7116 +
  7117 + function getValue() {
  7118 + return form.val(componentFilter)
  7119 + }
  7120 +
  7121 + return { component, getValue, componentId, componentFilter, echoDataSource }
  7122 + }
  7123 +
  7124 + /**
  7125 + * @description 生成上传弹出层组件
  7126 + */
  7127 + function generatorUploadLayerComponent(callback) {
  7128 +
  7129 + const enumActionEl = {
  7130 + /**
  7131 + * @description 图片选中区域节点
  7132 + */
  7133 + IMG_SELECT_CONTAINER_EL: 'imgSelectContainerEl',
  7134 +
  7135 + /**
  7136 + * @description 切换图片来源控制
  7137 + */
  7138 + SWITCH_IMG_ORIGIN_FILTER: 'switchImgOriginFilter',
  7139 +
  7140 + /**
  7141 + * @description 图片选中侧边栏节点
  7142 + */
  7143 + VAR_IMG_CONTAINER_SIDEBAR: 'var-image__container-sidebar',
  7144 +
  7145 + /**
  7146 + * @description 图库图形选择区域
  7147 + */
  7148 + VAR_IMG_CONTAINER_CONTENT: 'var-image__container-content',
  7149 +
  7150 + /**
  7151 + * @description 图库图形项
  7152 + */
  7153 + VAR_IMG_ITEM: 'var-image__img-item',
  7154 +
  7155 + /**
  7156 + * @description 图库图形选中控制
  7157 + */
  7158 + VAR_IMG_ITEM_CHECKED: 'var-image__img-item--checked',
  7159 +
  7160 + /**
  7161 + * @description 图库图形类别节点
  7162 + */
  7163 + VAR_IMG_CATEGORY: 'var-image__category',
  7164 +
  7165 + /**
  7166 + * @description 图库图形类别选择状态
  7167 + */
  7168 + VAR_IMG_CATEGORY_CHECKED: 'var-image__category--checked',
6169 7169
6170   - /**
6171   - * @description 通过组织获取设备
6172   - */
6173   - async function getDeviceByOrg(id) {
6174   - if (!id) return
6175   - const [ err, res ] = await to(ConfigurationNodeApi.getMasterDevice(id))
6176   - if (!res) return
6177   - deviceList = res
6178   - const template = UseLayUi.generateOptionTemplate({ dataSource: res })
6179   - $(`#${ enumActionEl.DEVICE_EL } select`).html(template)
6180   - form.render('select', enumActionEl.FORM_FILTER)
6181   - }
  7170 + /**
  7171 + * @description 本地上传图片节点
  7172 + */
  7173 + UPLOAD_LOCAL_FILE_EL: 'var-image__container--local',
6182 7174
6183   - /**
6184   - * @description 通过主设备ID获取从设备
6185   - */
6186   - async function getSlaveDeviceByMasterDevice(orgId, id) {
6187   - if (!orgId || !id) return
6188   - const [ err, res ] = await to(ConfigurationNodeApi.getSlaveDevice(orgId, id))
6189   - if (res) {
6190   - const template = UseLayUi.generateOptionTemplate({ dataSource: res })
6191   - $(`#${ enumActionEl.SLAVE_DEVICE_EL } select`).html(template)
6192   - form.render('select', enumActionEl.FORM_FILTER)
6193   - }
6194   - }
  7175 + /**
  7176 + * @description 本地上传图片状态
  7177 + */
  7178 + IMAGE_UPLOAD_STATE_EL: 'var-image__upload-state',
6195 7179
6196   - /**
6197   - * @description 通过设备ID获取设备属性
6198   - */
6199   - async function getAttrsByDevice(id) {
6200   - if (!id) return
6201   - const [ err, res ] = await to(ConfigurationNodeApi.getDeviceAttr(id))
6202   - if (res) {
6203   - const template = UseLayUi.generateOptionTemplate({ dataSource: res })
6204   - $(`#${ enumActionEl.ATTR_EL } select`).html(template)
6205   - // form.render('select')
6206   - form.render('select', enumActionEl.FORM_FILTER)
6207   - }
  7180 + /**
  7181 + * @description 预览图片状态
  7182 + */
  7183 + IMAGE_PREVIEW_EL: 'preview__img--preview',
  7184 +
  7185 + /**
  7186 + * @description 本地图片上传删除按钮
  7187 + */
  7188 + IMAGE_DEL_PREVIEW_EL: 'var-image__del-icon',
6208 7189 }
6209 7190
6210   - function generatorDisplayOptions() {
6211   - const options = [
6212   - { name: '显示', id: enumDisplayType.SHOW },
6213   - { name: '隐藏', id: enumDisplayType.HIDDEN },
6214   - ]
6215   - const template = UseLayUi.generateOptionTemplate({ dataSource: options })
6216   - return `
6217   - <div class="layui-form-item" style="margin-bottom: 0px">
6218   - <div class="layui-input-block" style="margin-left: 0px;">
6219   - <select name="${ enumConst.TYPE }" lay-verify="required">${ template }</select>
6220   - </div>
6221   - </div>
6222   - `
  7191 + const enumConst = {
  7192 + /**
  7193 + * @description 图片来源
  7194 + */
  7195 + IMAGE_ORIGIN: 'imageOrigin',
  7196 +
  7197 + /**
  7198 + * @description 图库图形类别
  7199 + */
  7200 + IMAGE_GALLERY_CATEGORY: 'category',
  7201 +
  7202 + /**
  7203 + * @description 图表图形路径
  7204 + */
  7205 + IMAGE_GALLERY_IMAGE_PATH: 'imagePath',
6223 7206 }
6224 7207
6225 7208 /**
6226   - * @description 添加一条记录
  7209 + * @description 图片来源枚举类型
6227 7210 */
6228   - function addRecord() {
6229   - const content = `
6230   - <tr class="layui-form" lay-filter="${ getRowFilter(addRowNumber) }">
6231   - ${ IS_DISPLAY && `<td>${ generatorDisplayOptions() }</td>` }
6232   - <td>
6233   - <input lay-verType="tips" lay-verify="required" type="number" name="${ enumConst.MIN }" class="layui-input ${ enumActionEl.MIN_FILTER }">
6234   - </td>
6235   - <td>
6236   - <input lay-verType="tips" lay-verify="required" type="number" name="${ enumConst.MAX }" class="layui-input ${ enumActionEl.MAX_FILTER }">
6237   - </td>
6238   - <td style="text-align: center;">
6239   - <button type="button" class="layui-btn layui-btn-primary layui-border-red ${ enumActionEl.DEL_BTN_EL }">删除</button>
6240   - </td>
6241   - </tr>
6242   - `
6243   - addRowNumber++
6244   - $(`#${ enumActionEl.TABLE_BODY_EL }`).append(content)
6245   - if (IS_DISPLAY) {
6246   - // form.render(null, getRowFilter(addRowNumber))
6247   - form.render()
6248   - }
  7211 + const enumImageOriginType = {
  7212 + LOCAL: 'local',
  7213 + GALLERY: 'gallery',
6249 7214 }
6250 7215
  7216 + let imageState = {}
  7217 +
6251 7218 /**
6252   - * @description 创建添加记录事件
  7219 + * @description 设置选中样式
  7220 + * @param event
  7221 + * @param nodeClass
  7222 + * @param styleClass
6253 7223 */
6254   - function createAddRowListenEvent() {
6255   - $(`#${ enumActionEl.ADD_BTN_EL }`).click(() => {
6256   - addRecord()
6257   - createDeleteRowListenEvent()
  7224 + function setImageSelectedStyle(event, nodeClass, styleClass) {
  7225 + if (!$(event.target).hasClass(nodeClass)) return
  7226 + $(`.${nodeClass}`).each(function () {
  7227 + $(this).removeClass(styleClass)
6258 7228 })
  7229 + $(event.target).addClass(styleClass)
6259 7230 }
6260 7231
6261 7232 /**
6262   - * @description 创建删除行事件
  7233 + * @description 切换图库图形
  7234 + * @param event
6263 7235 */
6264   - function createDeleteRowListenEvent() {
6265   - $(`.${ enumActionEl.DEL_BTN_EL }`).click((event) => {
6266   - $(event.target).parents('tr').remove()
6267   - })
  7236 + function switchGalleryLib(event) {
  7237 + const key = $(event.target).attr(enumConst.IMAGE_GALLERY_CATEGORY)
  7238 + const category = sidebarInstance.getVariableImageLib(key)
  7239 + if (key && category) {
  7240 + $(`#${enumActionEl.VAR_IMG_CONTAINER_CONTENT}`).html(
  7241 + category.lib.reduce((prev, next) => prev + `<div class="${enumActionEl.VAR_IMG_ITEM}" title="${next.name}"><img src="${next.staticPath}" alt=""></div>`, ''),
  7242 + )
  7243 + }
6268 7244 }
6269 7245
6270 7246 /**
6271   - * @description 创建下拉联动事件
  7247 + * @description 图片来源事件监听
6272 7248 */
6273   - function createSelectLinkageListenEvent() {
6274   - form.on(`select(${ enumActionEl.DEVICE_EL })`, (data) => {
6275   - const { value } = data
6276   - const selected = deviceList.find(item => item.id === value)
6277   - if (selected.deviceType === enumConst.GATEWAY) {
6278   - $(`#${ enumActionEl.SLAVE_DEVICE_EL }`).css({ display: 'block' })
6279   - getSlaveDeviceByMasterDevice(currentOrgId, selected.id)
6280   - } else {
6281   - $(`#${ enumActionEl.SLAVE_DEVICE_EL }`).css({ display: 'none' })
6282   - getAttrsByDevice(selected.id)
6283   - }
  7249 + function generatorSelectImgEventListener() {
  7250 + $(`#${enumActionEl.VAR_IMG_CONTAINER_CONTENT}`).on('click', event => {
  7251 + setImageSelectedStyle(event, enumActionEl.VAR_IMG_ITEM, enumActionEl.VAR_IMG_ITEM_CHECKED)
  7252 + imageState[enumConst.IMAGE_GALLERY_IMAGE_PATH] = $(event.target).find('img').attr('src')
6284 7253 })
6285   -
6286   - form.on(`select(${ enumActionEl.SLAVE_DEVICE_EL })`, (data) => {
6287   - getAttrsByDevice(data.value)
  7254 + $(`#${enumActionEl.VAR_IMG_CONTAINER_SIDEBAR}`).on('click', event => {
  7255 + setImageSelectedStyle(event, enumActionEl.VAR_IMG_CATEGORY, enumActionEl.VAR_IMG_CATEGORY_CHECKED)
  7256 + imageState[enumConst.IMAGE_GALLERY_CATEGORY] = $(event.target).attr(enumConst.IMAGE_GALLERY_CATEGORY)
  7257 + imageState[enumConst.IMAGE_GALLERY_IMAGE_PATH] = null
  7258 + switchGalleryLib(event)
6288 7259 })
6289 7260 }
6290 7261
6291   - /**
6292   - * @description 创建输入监听
6293   - */
6294   - function createInputListener() {
6295   - $(`#${ enumActionEl.TABLE_BODY_EL }`)
6296   - .on('input', `.${ enumActionEl.MIN_FILTER }`, event => {
6297   - const minVal = $(event.target).val()
6298   - const maxVal = $(event.target).parents('tr').find(`input.${ enumActionEl.MAX_FILTER }`).val()
6299   - if (maxVal !== '' && Number(minVal) > Number(maxVal)) {
6300   - layer.tips('输入值大于最大值', $(event.target), {
6301   - tips: 1,
6302   - });
6303   - }
6304   - })
6305   - .on('input', `.${ enumActionEl.MAX_FILTER }`, event => {
6306   - const maxVal = $(event.target).val()
6307   - const minVal = $(event.target).parents('tr').find(`input.${ enumActionEl.MIN_FILTER }`).val()
6308   - if (minVal !== '' && Number(maxVal) < Number(minVal)) {
6309   - layer.tips('输入值小于最小值', $(event.target), {
6310   - tips: 1,
6311   - });
6312   - }
6313   - })
6314   - }
6315 7262
6316 7263 /**
6317   - * @description 创建事件监听
  7264 + * @description 创建本地图片上传区域
6318 7265 */
6319   - function createEventListen() {
6320   - createInputListener()
6321   - createSelectLinkageListenEvent()
6322   - createAddRowListenEvent()
6323   - createDeleteRowListenEvent()
  7266 + function createLocalFileContainer() {
  7267 + return `
  7268 + <div id="${enumActionEl.UPLOAD_LOCAL_FILE_EL}" class="layui-upload">
  7269 + <div class="preview__img">
  7270 + <img src="" class="layui-upload-img" id="${enumActionEl.IMAGE_PREVIEW_EL}">
  7271 + <div class="var_image__add-icon">+</div>
  7272 + <div class="var-image__del-icon">x</div>
  7273 + </div>
  7274 + <div class="layui-upload-list"></div>
  7275 + </div>
  7276 + <div id="${enumActionEl.IMAGE_UPLOAD_STATE_EL}"></div>
  7277 + <div style="margin-top: 30px;">图片格式支持png、jpg(jpeg)、gif, 大小不能超过5M</div>
  7278 + `
6324 7279 }
6325 7280
6326 7281 /**
6327   - * @description 回显数据
6328   - */
6329   - function echoData(info) {
6330   - const { slaveDeviceId, deviceId, attr, orgId, condition = [] } = info
6331   - echoEachData(condition)
6332   - echoOrgTree(orgId)
6333   - const queue = []
6334   - if (orgId) {
6335   - queue.push(getDeviceByOrg(orgId))
6336   - }
6337   - if (slaveDeviceId) {
6338   - $(`#${ enumActionEl.SLAVE_DEVICE_EL }`).css({ display: 'block' })
6339   - queue.push(getSlaveDeviceByMasterDevice(orgId, deviceId))
6340   - queue.push(getAttrsByDevice(slaveDeviceId))
6341   - } else {
6342   - queue.push(getAttrsByDevice(deviceId))
6343   - }
6344   - Promise.all(queue).finally(() => {
6345   - form.val(enumActionEl.FORM_FILTER, { slaveDeviceId, deviceId, attr, orgId })
6346   - })
  7282 + * @description 创建图库图形上传区域
  7283 + */
  7284 + function createGalleryFileContainer() {
  7285 + const category = sidebarInstance.getAllVariableImageLib()
  7286 + const defaultShow = category[0] || { lib: [] }
  7287 + return `
  7288 + <div class="var-image__container--gallery">
  7289 + <div id="${enumActionEl.VAR_IMG_CONTAINER_SIDEBAR}">
  7290 + ${category.reduce((prev, next) => prev + `<div class="${enumActionEl.VAR_IMG_CATEGORY}" ${enumConst.IMAGE_GALLERY_CATEGORY}="${next.key}">${next.label}</div>`, '')}
  7291 + </div>
  7292 + <div id="${enumActionEl.VAR_IMG_CONTAINER_CONTENT}">
  7293 + ${defaultShow.lib.reduce((prev, next) => prev + `<div class="${enumActionEl.VAR_IMG_ITEM}" title="${next.name}"><img src="${next.staticPath}" alt=""></div>`, '')}
  7294 + </div>
  7295 + </div>
  7296 + `
6347 7297 }
6348 7298
6349 7299 /**
6350   - * @description 回显行数据
  7300 + * @description 上传
6351 7301 */
6352   - function echoEachData(condition = []) {
6353   - condition.forEach((item, index) => {
6354   - addRecord()
6355   - form.val(getRowFilter(index), { ...item })
  7302 + function uploadFileEvent() {
  7303 + $(`.${enumActionEl.IMAGE_DEL_PREVIEW_EL}`).on('click', (event) => {
  7304 + event.stopPropagation()
  7305 + $(`#${enumActionEl.IMAGE_PREVIEW_EL}`).attr('src', '')
  7306 + imageState[enumConst.IMAGE_GALLERY_IMAGE_PATH] = null
6356 7307 })
  7308 + upload.render({
  7309 + elem: `#${enumActionEl.UPLOAD_LOCAL_FILE_EL}`,
  7310 + auto: false,
  7311 + size: 1024 * 5,
  7312 + url: '/yt/oss/upload',
  7313 + method: 'post',
  7314 + choose(obj) {
  7315 + obj.preview(async function (index, file, result) {
  7316 + const formData = new FormData()
  7317 + formData.set('file', file)
  7318 + const [err, res] = await to(ConfigurationNodeApi.uploadImg(formData))
  7319 + if (!err) {
  7320 + $(`#${enumActionEl.IMAGE_PREVIEW_EL}`).attr('src', result)
  7321 + const { fileStaticUri = '' } = res
  7322 + imageState[enumConst.IMAGE_GALLERY_IMAGE_PATH] = fileStaticUri
  7323 + }
  7324 + });
  7325 + },
  7326 + });
6357 7327 }
6358 7328
6359 7329 /**
6360   - * @description 回显组织树
  7330 + * @description 切换
6361 7331 */
6362   - function echoOrgTree(id) {
6363   - const node = UseLayUi.findTreeObjectByField(treeList, id)
6364   - $(`#${ enumActionEl.ORG_EL }`).find(`input[name="${ enumConst.ORG_ID }"]`).parent().find('span').html(node?.name)
6365   - }
6366   -
6367   - function validate(tableData) {
6368   - let validateFlag = true
6369   - for (let i = 0; i < tableData.length; i++) {
6370   - const { min, max } = tableData[i]
6371   - if (Number(min) > Number(max)) {
6372   - validateFlag = false
6373   - layer.tips('输入值大于最大值', $(`#${ enumActionEl.TABLE_BODY_EL } tr`).eq(i).find(`input[name="${ enumConst.MIN }"]`), { tips: 1 })
6374   - break
6375   - } else if (Number(max) < Number(min)) {
6376   - validateFlag = false
6377   - layer.tips('输入值小于最小值', $(`#${ enumActionEl.TABLE_BODY_EL } tr`).eq(i).find(`input[name="${ enumConst.MAX }"]`), { tips: 1 })
6378   - break
  7332 + function switchUploadImgTypeEventListener() {
  7333 + form.on(`radio(${enumActionEl.SWITCH_IMG_ORIGIN_FILTER})`, event => {
  7334 + const { value } = event
  7335 + console.log('event', event)
  7336 + imageState = {}
  7337 + if (value === enumImageOriginType.LOCAL) {
  7338 + $(`#${enumActionEl.IMG_SELECT_CONTAINER_EL}`).html(createLocalFileContainer())
  7339 + imageState[enumConst.IMAGE_ORIGIN] = enumImageOriginType.LOCAL
  7340 + uploadFileEvent()
  7341 + } else if (value === enumImageOriginType.GALLERY) {
  7342 + $(`#${enumActionEl.IMG_SELECT_CONTAINER_EL}`).html(createGalleryFileContainer())
  7343 + const defaultChecked = $(`.${enumActionEl.VAR_IMG_CATEGORY}`).eq(0)
  7344 + defaultChecked.addClass(enumActionEl.VAR_IMG_CATEGORY_CHECKED)
  7345 + imageState[enumConst.IMAGE_GALLERY_CATEGORY] = defaultChecked.attr(enumConst.IMAGE_GALLERY_CATEGORY)
  7346 + imageState[enumConst.IMAGE_ORIGIN] = enumImageOriginType.GALLERY
  7347 + generatorSelectImgEventListener()
6379 7348 }
6380   - }
6381   - return validateFlag
  7349 + })
6382 7350 }
6383 7351
6384   - async function submit(callback) {
6385   - const tableData = Array.from({ length: addRowNumber }).map((_, index) => form.val(getRowFilter(index))).filter(obj => Object.keys(obj).length)
6386   - if (!validate(tableData)) return
6387   - const formVal = form.val(enumActionEl.FORM_FILTER)
6388   - const formModel = {
6389   - configurationId,
6390   - contentId: currentPageId.id,
6391   - ...formVal,
6392   - id: graphId,
6393   - condition: tableData,
6394   - type: event.data.type,
6395   - }
6396   - const [ err, res ] = await to(ConfigurationNodeApi.updateNodeAct(formModel))
6397   - if (err) return
6398   - UseLayUi.successMsg()
6399   - callback()
6400   - }
6401 7352
6402   - function isExistInArea(min, max, value) {
6403   - return Number(value) >= Number(min) && Number(value) <= Number(max)
  7353 + /**
  7354 + * @description 初始化并设置默认值
  7355 + */
  7356 + function initSelectImg() {
  7357 + switchUploadImgTypeEventListener()
  7358 + uploadFileEvent()
  7359 + imageState[enumConst.IMAGE_ORIGIN] = enumImageOriginType.LOCAL
  7360 + form.render()
6404 7361 }
6405 7362
6406   -
6407   - function createLayerForm(type) {
  7363 + /**
  7364 + * @description 创建上传图片layer
  7365 + */
  7366 + function createUploadImgLayer() {
6408 7367 const content = `
6409   - <form class="layui-form" lay-filter="${ enumActionEl.FORM_FILTER }">
6410   - <div style="width:400px">
6411   - <div class="layui-form-item">
6412   - <label class="layui-form-label">类型</label>
6413   - <div class="layui-input-block">
6414   - <input type="radio" name="type" value="1" title="联网设备" checked>
6415   - <input type="radio" name="type" value="2" title="产品/场景" disabled>
6416   - </div>
6417   - </div>
6418   -
6419   - <div id="${ enumActionEl.ORG_EL }">组织</div>
6420   -
6421   - <div class="layui-form-item" id="${ enumActionEl.DEVICE_EL }">
6422   - <label class="layui-form-label">设备</label>
6423   - <div class="layui-input-block">
6424   - <select name="${ enumConst.DEVICE_ID }" lay-verType="tips" lay-verify="required" lay-filter="${ enumActionEl.DEVICE_EL }">
6425   - </select>
6426   - </div>
6427   - </div>
6428   -
6429   - <div class="layui-form-item" id="${ enumActionEl.SLAVE_DEVICE_EL }" style="display: none">
6430   - <label class="layui-form-label">子设备</label>
6431   - <div class="layui-input-block">
6432   - <select name="${ enumConst.SLAVE_DEVICE_ID }" lay-verType="tips" lay-filter="${ enumActionEl.SLAVE_DEVICE_EL }">
6433   - </select>
6434   - </div>
6435   - </div>
6436   -
6437   - <div class="layui-form-item" id="${ enumActionEl.ATTR_EL }">
6438   - <label class="layui-form-label">属性</label>
6439   - <div class="layui-input-block">
6440   - <select name="${ enumConst.ATTR }" lay-verType="tips" lay-verify="required" lay-filter="${ enumActionEl.ATTR_EL }"></select>
6441   - </div>
6442   - </div>
6443   - </div>
6444   - </form>
6445   - <div class="override__table">
6446   - <table class="layui-table" >
6447   - <thead>
6448   - <tr>
6449   - ${ IS_DISPLAY ? '<th style="text-align:center">类型</th>' : '' }
6450   - <th style="text-align:center">最小值(<=)</th>
6451   - <th style="text-align:center">最大值(>=)</th>
6452   - <th style="text-align:center">操作</th>
6453   - </tr>
6454   - </thead>
6455   - <tbody id="${ enumActionEl.TABLE_BODY_EL }"></tbody>
6456   - </table>
6457   - <div style="display:flex;justify-content:center;">
6458   - <button type="button" class="layui-btn layui-btn-primary layui-border-blue" id="${ enumActionEl.ADD_BTN_EL }">添加一条</button>
6459   - </div>
6460   - </div>
6461   - `
  7368 + <div class="layui-form">
  7369 + <div class="layui-form-item">
  7370 + <div class="var-image__radio">
  7371 + <input type="radio" lay-filter="${enumActionEl.SWITCH_IMG_ORIGIN_FILTER}" name="${enumConst.IMAGE}" value="${enumImageOriginType.LOCAL}" title="本地图片" checked="">
  7372 + <input type="radio" lay-filter="${enumActionEl.SWITCH_IMG_ORIGIN_FILTER}" name="${enumConst.IMAGE}" value="${enumImageOriginType.GALLERY}" title="图库图形">
  7373 + </div>
  7374 + </div>
  7375 + </div>
  7376 + <div id="${enumActionEl.IMG_SELECT_CONTAINER_EL}">
  7377 + ${createLocalFileContainer()}
  7378 + </div>
  7379 + `
6462 7380
6463 7381 layer.open({
6464   - title: enumEventType[type],
  7382 + title: '图片',
  7383 + type: 1,
6465 7384 content,
6466 7385 skin: 'event-layer__override',
6467   - btn: [ '保存', '取消' ],
6468   - area: IS_DISPLAY ? '1000px' : '800PX',
6469   - success(layero) {
  7386 + area: '600px',
  7387 + btn: ["应用", "取消"],
  7388 + shade: ["0.7", "#fafafa"],
  7389 + yes(index) {
  7390 + layer.close(index)
  7391 + if (callback && typeof callback === 'function') callback(imageState)
  7392 + },
  7393 + but2(index, layero) {
  7394 + imageState = {}
  7395 + layer.close(index)
  7396 + },
  7397 + zIndex: layer.zIndex,
  7398 + async success(layero, index) {
  7399 + layer.setTop(layero);
6470 7400 $(layero).addClass('layui-form').find('.layui-layer-btn0').attr({
6471 7401 'lay-submit': '',
6472   - 'lay-filter': enumActionEl.LAYER_SUBMIT_FILTER,
6473   - })
6474   - generatorOrgTreeSelect()
6475   - const info = getLayerBindInfo('act', type)
6476   - if (info) {
6477   - echoData(info)
6478   - } else {
6479   - addRecord()
6480   - }
6481   - createEventListen()
6482   - form.render()
6483   - },
6484   - yes(index) {
6485   - form.on(`submit(${ enumActionEl.LAYER_SUBMIT_FILTER })`, data => {
6486   - submit(() => {
6487   - layer.close(index)
6488   - getNodeBindInfo()
6489   - })
  7402 + 'lay-filter': enumActionEl.IMAGE_LAYER_FILTER,
6490 7403 })
6491   - },
6492   - btn2() {
6493   -
  7404 + initSelectImg()
6494 7405 },
6495 7406 })
6496 7407 }
6497 7408
6498   - createLayerForm(event.data.type)
  7409 + createUploadImgLayer()
6499 7410
  7411 + return { record: imageState }
6500 7412 }
6501 7413
6502 7414 // 异步设置此处才能生效 -- 设置默认select和样式和初始化侧边栏生成组件和事件绑定
6503 7415 setTimeout(() => {
6504 7416
6505 7417 // TODO 数据交互事件
6506   - $(`#${ enumInteractionType.DOWN }`).click({ type: enumInteractionType.DOWN }, handleDownOrUpEvent);
6507   - $(`#${ enumInteractionType.UP }`).click({ type: enumInteractionType.UP }, handleDownOrUpEvent);
6508   - $(`#${ enumInteractionType.SINGLE }`).click({ type: enumInteractionType.SINGLE }, handleClickOrDbClick);
6509   - $(`#${ enumInteractionType.DOUBLE }`).click({ type: enumInteractionType.DOUBLE }, handleClickOrDbClick);
  7418 + $(`#${enumDynamicEffectType.IMAGE}`).click({ type: enumDynamicEffectType.IMAGE }, handleSettingVarImage);
  7419 +
  7420 + $(`#${enumInteractionType.DOWN}`).click({ type: enumInteractionType.DOWN }, handleDownOrUpEvent);
  7421 + $(`#${enumInteractionType.UP}`).click({ type: enumInteractionType.UP }, handleDownOrUpEvent);
  7422 + $(`#${enumInteractionType.SINGLE}`).click({ type: enumInteractionType.SINGLE }, handleClickOrDbClick);
  7423 + $(`#${enumInteractionType.DOUBLE}`).click({ type: enumInteractionType.DOUBLE }, handleClickOrDbClick);
6510 7424 // 数据动效事件
6511   - $(`#${ enumDynamicEffectType.FLASH }`).click({ type: enumDynamicEffectType.FLASH }, handleDataDynamicEffect);
6512   - $(`#${ enumDynamicEffectType.DISPLAY }`).click({ type: enumDynamicEffectType.DISPLAY }, handleDataDynamicEffect);
6513   - $(`#${ enumDynamicEffectType.ROTATE }`).click({ type: enumDynamicEffectType.ROTATE }, handleDataDynamicEffect);
  7425 + $(`#${enumDynamicEffectType.FLASH}`).click({ type: enumDynamicEffectType.FLASH }, handleDataDynamicEffect);
  7426 + $(`#${enumDynamicEffectType.DISPLAY}`).click({ type: enumDynamicEffectType.DISPLAY }, handleDataDynamicEffect);
  7427 + $(`#${enumDynamicEffectType.ROTATE}`).click({ type: enumDynamicEffectType.ROTATE }, handleDataDynamicEffect);
6514 7428 });
6515 7429 };
6516 7430
... ... @@ -6848,9 +7762,9 @@ StyleFormatPanel.prototype.addFill = function (container) {
6848 7762 var tmpColor = mxUtils.getValue(ss.style, fillKey, null);
6849 7763 gradientPanel.style.display =
6850 7764 tmpColor != null &&
6851   - tmpColor != mxConstants.NONE &&
6852   - ss.fill &&
6853   - ss.style.shape != "image"
  7765 + tmpColor != mxConstants.NONE &&
  7766 + ss.fill &&
  7767 + ss.style.shape != "image"
6854 7768 ? ""
6855 7769 : "none";
6856 7770
... ... @@ -6912,7 +7826,7 @@ StyleFormatPanel.prototype.addFill = function (container) {
6912 7826 fillStyleSelect.style.display = ss.style.sketch == "1" ? "" : "none";
6913 7827 gradientPanel.style.display =
6914 7828 !ss.containsImage &&
6915   - (ss.style.sketch != "1" || fillStyle == "solid" || fillStyle == "auto")
  7829 + (ss.style.sketch != "1" || fillStyle == "solid" || fillStyle == "auto")
6916 7830 ? ""
6917 7831 : "none";
6918 7832 }
... ... @@ -6936,9 +7850,9 @@ StyleFormatPanel.prototype.addFill = function (container) {
6936 7850 new mxEventObject(
6937 7851 "styleChanged",
6938 7852 "keys",
6939   - [ mxConstants.STYLE_GRADIENT_DIRECTION ],
  7853 + [mxConstants.STYLE_GRADIENT_DIRECTION],
6940 7854 "values",
6941   - [ gradientSelect.value ],
  7855 + [gradientSelect.value],
6942 7856 "cells",
6943 7857 ss.cells,
6944 7858 ),
... ... @@ -6952,9 +7866,9 @@ StyleFormatPanel.prototype.addFill = function (container) {
6952 7866 new mxEventObject(
6953 7867 "styleChanged",
6954 7868 "keys",
6955   - [ "fillStyle" ],
  7869 + ["fillStyle"],
6956 7870 "values",
6957   - [ fillStyleSelect.value ],
  7871 + [fillStyleSelect.value],
6958 7872 "cells",
6959 7873 ss.cells,
6960 7874 ),
... ... @@ -7030,7 +7944,7 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7030 7944 styleSelect.style.border = "1px solid rgb(160, 160, 160)";
7031 7945 styleSelect.style.borderRadius = "4px";
7032 7946
7033   - var styles = [ "sharp", "rounded", "curved" ];
  7947 + var styles = ["sharp", "rounded", "curved"];
7034 7948
7035 7949 for (var i = 0; i < styles.length; i++) {
7036 7950 var styleOption = document.createElement("option");
... ... @@ -7042,14 +7956,14 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7042 7956 mxEvent.addListener(styleSelect, "change", function (evt) {
7043 7957 graph.getModel().beginUpdate();
7044 7958 try {
7045   - var keys = [ mxConstants.STYLE_ROUNDED, mxConstants.STYLE_CURVED ];
  7959 + var keys = [mxConstants.STYLE_ROUNDED, mxConstants.STYLE_CURVED];
7046 7960 // Default for rounded is 1
7047   - var values = [ "0", null ];
  7961 + var values = ["0", null];
7048 7962
7049 7963 if (styleSelect.value == "rounded") {
7050   - values = [ "1", null ];
  7964 + values = ["1", null];
7051 7965 } else if (styleSelect.value == "curved") {
7052   - values = [ null, "1" ];
  7966 + values = [null, "1"];
7053 7967 }
7054 7968
7055 7969 for (var i = 0; i < keys.length; i++) {
... ... @@ -7150,36 +8064,36 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7150 8064 menu,
7151 8065 75,
7152 8066 "solid",
7153   - [ mxConstants.STYLE_DASHED, mxConstants.STYLE_DASH_PATTERN ],
7154   - [ null, null ],
  8067 + [mxConstants.STYLE_DASHED, mxConstants.STYLE_DASH_PATTERN],
  8068 + [null, null],
7155 8069 ).setAttribute("title", mxResources.get("solid"));
7156 8070 addItem(
7157 8071 menu,
7158 8072 75,
7159 8073 "dashed",
7160   - [ mxConstants.STYLE_DASHED, mxConstants.STYLE_DASH_PATTERN ],
7161   - [ "1", null ],
  8074 + [mxConstants.STYLE_DASHED, mxConstants.STYLE_DASH_PATTERN],
  8075 + ["1", null],
7162 8076 ).setAttribute("title", mxResources.get("dashed"));
7163 8077 addItem(
7164 8078 menu,
7165 8079 75,
7166 8080 "dotted",
7167   - [ mxConstants.STYLE_DASHED, mxConstants.STYLE_DASH_PATTERN ],
7168   - [ "1", "1 1" ],
  8081 + [mxConstants.STYLE_DASHED, mxConstants.STYLE_DASH_PATTERN],
  8082 + ["1", "1 1"],
7169 8083 ).setAttribute("title", mxResources.get("dotted") + " (1)");
7170 8084 addItem(
7171 8085 menu,
7172 8086 75,
7173 8087 "dotted",
7174   - [ mxConstants.STYLE_DASHED, mxConstants.STYLE_DASH_PATTERN ],
7175   - [ "1", "1 2" ],
  8088 + [mxConstants.STYLE_DASHED, mxConstants.STYLE_DASH_PATTERN],
  8089 + ["1", "1 2"],
7176 8090 ).setAttribute("title", mxResources.get("dotted") + " (2)");
7177 8091 addItem(
7178 8092 menu,
7179 8093 75,
7180 8094 "dotted",
7181   - [ mxConstants.STYLE_DASHED, mxConstants.STYLE_DASH_PATTERN ],
7182   - [ "1", "1 4" ],
  8095 + [mxConstants.STYLE_DASHED, mxConstants.STYLE_DASH_PATTERN],
  8096 + ["1", "1 4"],
7183 8097 ).setAttribute("title", mxResources.get("dotted") + " (3)");
7184 8098 }),
7185 8099 );
... ... @@ -7203,7 +8117,7 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7203 8117 mxConstants.STYLE_ENDSIZE,
7204 8118 "width",
7205 8119 ],
7206   - [ null, null, null, null ],
  8120 + [null, null, null, null],
7207 8121 "geIcon geSprite geSprite-connection",
7208 8122 null,
7209 8123 true,
... ... @@ -7219,7 +8133,7 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7219 8133 mxConstants.STYLE_ENDSIZE,
7220 8134 "width",
7221 8135 ],
7222   - [ "link", null, null, null ],
  8136 + ["link", null, null, null],
7223 8137 "geIcon geSprite geSprite-linkedge",
7224 8138 null,
7225 8139 true,
... ... @@ -7235,7 +8149,7 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7235 8149 mxConstants.STYLE_ENDSIZE,
7236 8150 "width",
7237 8151 ],
7238   - [ "flexArrow", null, null, null ],
  8152 + ["flexArrow", null, null, null],
7239 8153 "geIcon geSprite geSprite-arrow",
7240 8154 null,
7241 8155 true,
... ... @@ -7251,7 +8165,7 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7251 8165 mxConstants.STYLE_ENDSIZE,
7252 8166 "width",
7253 8167 ],
7254   - [ "arrow", null, null, null ],
  8168 + ["arrow", null, null, null],
7255 8169 "geIcon geSprite geSprite-simplearrow",
7256 8170 null,
7257 8171 true,
... ... @@ -7270,36 +8184,36 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7270 8184 menu,
7271 8185 33,
7272 8186 "solid",
7273   - [ mxConstants.STYLE_DASHED, mxConstants.STYLE_DASH_PATTERN ],
7274   - [ null, null ],
  8187 + [mxConstants.STYLE_DASHED, mxConstants.STYLE_DASH_PATTERN],
  8188 + [null, null],
7275 8189 ).setAttribute("title", mxResources.get("solid"));
7276 8190 addItem(
7277 8191 menu,
7278 8192 33,
7279 8193 "dashed",
7280   - [ mxConstants.STYLE_DASHED, mxConstants.STYLE_DASH_PATTERN ],
7281   - [ "1", null ],
  8194 + [mxConstants.STYLE_DASHED, mxConstants.STYLE_DASH_PATTERN],
  8195 + ["1", null],
7282 8196 ).setAttribute("title", mxResources.get("dashed"));
7283 8197 addItem(
7284 8198 menu,
7285 8199 33,
7286 8200 "dotted",
7287   - [ mxConstants.STYLE_DASHED, mxConstants.STYLE_DASH_PATTERN ],
7288   - [ "1", "1 1" ],
  8201 + [mxConstants.STYLE_DASHED, mxConstants.STYLE_DASH_PATTERN],
  8202 + ["1", "1 1"],
7289 8203 ).setAttribute("title", mxResources.get("dotted") + " (1)");
7290 8204 addItem(
7291 8205 menu,
7292 8206 33,
7293 8207 "dotted",
7294   - [ mxConstants.STYLE_DASHED, mxConstants.STYLE_DASH_PATTERN ],
7295   - [ "1", "1 2" ],
  8208 + [mxConstants.STYLE_DASHED, mxConstants.STYLE_DASH_PATTERN],
  8209 + ["1", "1 2"],
7296 8210 ).setAttribute("title", mxResources.get("dotted") + " (2)");
7297 8211 addItem(
7298 8212 menu,
7299 8213 33,
7300 8214 "dotted",
7301   - [ mxConstants.STYLE_DASHED, mxConstants.STYLE_DASH_PATTERN ],
7302   - [ "1", "1 4" ],
  8215 + [mxConstants.STYLE_DASHED, mxConstants.STYLE_DASH_PATTERN],
  8216 + ["1", "1 4"],
7303 8217 ).setAttribute("title", mxResources.get("dotted") + " (3)");
7304 8218 }),
7305 8219 );
... ... @@ -7335,9 +8249,9 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7335 8249 new mxEventObject(
7336 8250 "styleChanged",
7337 8251 "keys",
7338   - [ mxConstants.STYLE_STROKEWIDTH ],
  8252 + [mxConstants.STYLE_STROKEWIDTH],
7339 8253 "values",
7340   - [ value ],
  8254 + [value],
7341 8255 "cells",
7342 8256 ss.cells,
7343 8257 ),
... ... @@ -7359,9 +8273,9 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7359 8273 new mxEventObject(
7360 8274 "styleChanged",
7361 8275 "keys",
7362   - [ mxConstants.STYLE_STROKEWIDTH ],
  8276 + [mxConstants.STYLE_STROKEWIDTH],
7363 8277 "values",
7364   - [ value ],
  8278 + [value],
7365 8279 "cells",
7366 8280 ss.cells,
7367 8281 ),
... ... @@ -7407,7 +8321,7 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7407 8321 mxConstants.STYLE_CURVED,
7408 8322 mxConstants.STYLE_NOEDGESTYLE,
7409 8323 ],
7410   - [ null, null, null ],
  8324 + [null, null, null],
7411 8325 "geIcon geSprite geSprite-straight",
7412 8326 null,
7413 8327 true,
... ... @@ -7422,7 +8336,7 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7422 8336 mxConstants.STYLE_CURVED,
7423 8337 mxConstants.STYLE_NOEDGESTYLE,
7424 8338 ],
7425   - [ "orthogonalEdgeStyle", null, null ],
  8339 + ["orthogonalEdgeStyle", null, null],
7426 8340 "geIcon geSprite geSprite-orthogonal",
7427 8341 null,
7428 8342 true,
... ... @@ -7438,7 +8352,7 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7438 8352 mxConstants.STYLE_CURVED,
7439 8353 mxConstants.STYLE_NOEDGESTYLE,
7440 8354 ],
7441   - [ "elbowEdgeStyle", null, null, null ],
  8355 + ["elbowEdgeStyle", null, null, null],
7442 8356 "geIcon geSprite geSprite-horizontalelbow",
7443 8357 null,
7444 8358 true,
... ... @@ -7454,7 +8368,7 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7454 8368 mxConstants.STYLE_CURVED,
7455 8369 mxConstants.STYLE_NOEDGESTYLE,
7456 8370 ],
7457   - [ "elbowEdgeStyle", "vertical", null, null ],
  8371 + ["elbowEdgeStyle", "vertical", null, null],
7458 8372 "geIcon geSprite geSprite-verticalelbow",
7459 8373 null,
7460 8374 true,
... ... @@ -7470,7 +8384,7 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7470 8384 mxConstants.STYLE_CURVED,
7471 8385 mxConstants.STYLE_NOEDGESTYLE,
7472 8386 ],
7473   - [ "isometricEdgeStyle", null, null, null ],
  8387 + ["isometricEdgeStyle", null, null, null],
7474 8388 "geIcon geSprite geSprite-horizontalisometric",
7475 8389 null,
7476 8390 true,
... ... @@ -7486,7 +8400,7 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7486 8400 mxConstants.STYLE_CURVED,
7487 8401 mxConstants.STYLE_NOEDGESTYLE,
7488 8402 ],
7489   - [ "isometricEdgeStyle", "vertical", null, null ],
  8403 + ["isometricEdgeStyle", "vertical", null, null],
7490 8404 "geIcon geSprite geSprite-verticalisometric",
7491 8405 null,
7492 8406 true,
... ... @@ -7503,7 +8417,7 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7503 8417 mxConstants.STYLE_CURVED,
7504 8418 mxConstants.STYLE_NOEDGESTYLE,
7505 8419 ],
7506   - [ "orthogonalEdgeStyle", "1", null ],
  8420 + ["orthogonalEdgeStyle", "1", null],
7507 8421 "geIcon geSprite geSprite-curved",
7508 8422 null,
7509 8423 true,
... ... @@ -7520,7 +8434,7 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7520 8434 mxConstants.STYLE_CURVED,
7521 8435 mxConstants.STYLE_NOEDGESTYLE,
7522 8436 ],
7523   - [ "entityRelationEdgeStyle", null, null ],
  8437 + ["entityRelationEdgeStyle", null, null],
7524 8438 "geIcon geSprite geSprite-entity",
7525 8439 null,
7526 8440 true,
... ... @@ -7544,8 +8458,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7544 8458 var item = this.editorUi.menus.edgeStyleChange(
7545 8459 menu,
7546 8460 "",
7547   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7548   - [ mxConstants.NONE, 0 ],
  8461 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8462 + [mxConstants.NONE, 0],
7549 8463 "geIcon",
7550 8464 null,
7551 8465 false,
... ... @@ -7562,8 +8476,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7562 8476 this.editorUi.menus.edgeStyleChange(
7563 8477 menu,
7564 8478 "",
7565   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7566   - [ mxConstants.ARROW_CLASSIC, 1 ],
  8479 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8480 + [mxConstants.ARROW_CLASSIC, 1],
7567 8481 null,
7568 8482 null,
7569 8483 false,
... ... @@ -7574,8 +8488,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7574 8488 this.editorUi.menus.edgeStyleChange(
7575 8489 menu,
7576 8490 "",
7577   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7578   - [ mxConstants.ARROW_CLASSIC_THIN, 1 ],
  8491 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8492 + [mxConstants.ARROW_CLASSIC_THIN, 1],
7579 8493 null,
7580 8494 null,
7581 8495 false,
... ... @@ -7586,8 +8500,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7586 8500 this.editorUi.menus.edgeStyleChange(
7587 8501 menu,
7588 8502 "",
7589   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7590   - [ mxConstants.ARROW_OPEN, 0 ],
  8503 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8504 + [mxConstants.ARROW_OPEN, 0],
7591 8505 null,
7592 8506 null,
7593 8507 false,
... ... @@ -7598,8 +8512,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7598 8512 this.editorUi.menus.edgeStyleChange(
7599 8513 menu,
7600 8514 "",
7601   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7602   - [ mxConstants.ARROW_OPEN_THIN, 0 ],
  8515 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8516 + [mxConstants.ARROW_OPEN_THIN, 0],
7603 8517 null,
7604 8518 null,
7605 8519 false,
... ... @@ -7610,8 +8524,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7610 8524 this.editorUi.menus.edgeStyleChange(
7611 8525 menu,
7612 8526 "",
7613   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7614   - [ "openAsync", 0 ],
  8527 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8528 + ["openAsync", 0],
7615 8529 null,
7616 8530 null,
7617 8531 false,
... ... @@ -7622,8 +8536,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7622 8536 this.editorUi.menus.edgeStyleChange(
7623 8537 menu,
7624 8538 "",
7625   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7626   - [ mxConstants.ARROW_BLOCK, 1 ],
  8539 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8540 + [mxConstants.ARROW_BLOCK, 1],
7627 8541 null,
7628 8542 null,
7629 8543 false,
... ... @@ -7634,8 +8548,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7634 8548 this.editorUi.menus.edgeStyleChange(
7635 8549 menu,
7636 8550 "",
7637   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7638   - [ mxConstants.ARROW_BLOCK_THIN, 1 ],
  8551 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8552 + [mxConstants.ARROW_BLOCK_THIN, 1],
7639 8553 null,
7640 8554 null,
7641 8555 false,
... ... @@ -7646,8 +8560,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7646 8560 this.editorUi.menus.edgeStyleChange(
7647 8561 menu,
7648 8562 "",
7649   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7650   - [ "async", 1 ],
  8563 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8564 + ["async", 1],
7651 8565 null,
7652 8566 null,
7653 8567 false,
... ... @@ -7658,8 +8572,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7658 8572 this.editorUi.menus.edgeStyleChange(
7659 8573 menu,
7660 8574 "",
7661   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7662   - [ mxConstants.ARROW_OVAL, 1 ],
  8575 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8576 + [mxConstants.ARROW_OVAL, 1],
7663 8577 null,
7664 8578 null,
7665 8579 false,
... ... @@ -7670,8 +8584,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7670 8584 this.editorUi.menus.edgeStyleChange(
7671 8585 menu,
7672 8586 "",
7673   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7674   - [ mxConstants.ARROW_DIAMOND, 1 ],
  8587 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8588 + [mxConstants.ARROW_DIAMOND, 1],
7675 8589 null,
7676 8590 null,
7677 8591 false,
... ... @@ -7682,8 +8596,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7682 8596 this.editorUi.menus.edgeStyleChange(
7683 8597 menu,
7684 8598 "",
7685   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7686   - [ mxConstants.ARROW_DIAMOND_THIN, 1 ],
  8599 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8600 + [mxConstants.ARROW_DIAMOND_THIN, 1],
7687 8601 null,
7688 8602 null,
7689 8603 false,
... ... @@ -7694,8 +8608,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7694 8608 this.editorUi.menus.edgeStyleChange(
7695 8609 menu,
7696 8610 "",
7697   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7698   - [ mxConstants.ARROW_CLASSIC, 0 ],
  8611 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8612 + [mxConstants.ARROW_CLASSIC, 0],
7699 8613 null,
7700 8614 null,
7701 8615 false,
... ... @@ -7706,8 +8620,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7706 8620 this.editorUi.menus.edgeStyleChange(
7707 8621 menu,
7708 8622 "",
7709   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7710   - [ mxConstants.ARROW_CLASSIC_THIN, 0 ],
  8623 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8624 + [mxConstants.ARROW_CLASSIC_THIN, 0],
7711 8625 null,
7712 8626 null,
7713 8627 false,
... ... @@ -7718,8 +8632,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7718 8632 this.editorUi.menus.edgeStyleChange(
7719 8633 menu,
7720 8634 "",
7721   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7722   - [ mxConstants.ARROW_BLOCK, 0 ],
  8635 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8636 + [mxConstants.ARROW_BLOCK, 0],
7723 8637 null,
7724 8638 null,
7725 8639 false,
... ... @@ -7730,8 +8644,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7730 8644 this.editorUi.menus.edgeStyleChange(
7731 8645 menu,
7732 8646 "",
7733   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7734   - [ mxConstants.ARROW_BLOCK_THIN, 0 ],
  8647 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8648 + [mxConstants.ARROW_BLOCK_THIN, 0],
7735 8649 null,
7736 8650 null,
7737 8651 false,
... ... @@ -7742,8 +8656,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7742 8656 this.editorUi.menus.edgeStyleChange(
7743 8657 menu,
7744 8658 "",
7745   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7746   - [ "async", 0 ],
  8659 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8660 + ["async", 0],
7747 8661 null,
7748 8662 null,
7749 8663 false,
... ... @@ -7754,8 +8668,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7754 8668 this.editorUi.menus.edgeStyleChange(
7755 8669 menu,
7756 8670 "",
7757   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7758   - [ mxConstants.ARROW_OVAL, 0 ],
  8671 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8672 + [mxConstants.ARROW_OVAL, 0],
7759 8673 null,
7760 8674 null,
7761 8675 false,
... ... @@ -7766,8 +8680,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7766 8680 this.editorUi.menus.edgeStyleChange(
7767 8681 menu,
7768 8682 "",
7769   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7770   - [ mxConstants.ARROW_DIAMOND, 0 ],
  8683 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8684 + [mxConstants.ARROW_DIAMOND, 0],
7771 8685 null,
7772 8686 null,
7773 8687 false,
... ... @@ -7778,8 +8692,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7778 8692 this.editorUi.menus.edgeStyleChange(
7779 8693 menu,
7780 8694 "",
7781   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7782   - [ mxConstants.ARROW_DIAMOND_THIN, 0 ],
  8695 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8696 + [mxConstants.ARROW_DIAMOND_THIN, 0],
7783 8697 null,
7784 8698 null,
7785 8699 false,
... ... @@ -7790,8 +8704,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7790 8704 this.editorUi.menus.edgeStyleChange(
7791 8705 menu,
7792 8706 "",
7793   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7794   - [ "box", 0 ],
  8707 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8708 + ["box", 0],
7795 8709 null,
7796 8710 null,
7797 8711 false,
... ... @@ -7802,8 +8716,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7802 8716 this.editorUi.menus.edgeStyleChange(
7803 8717 menu,
7804 8718 "",
7805   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7806   - [ "halfCircle", 0 ],
  8719 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8720 + ["halfCircle", 0],
7807 8721 null,
7808 8722 null,
7809 8723 false,
... ... @@ -7814,8 +8728,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7814 8728 this.editorUi.menus.edgeStyleChange(
7815 8729 menu,
7816 8730 "",
7817   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7818   - [ "dash", 0 ],
  8731 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8732 + ["dash", 0],
7819 8733 null,
7820 8734 null,
7821 8735 false,
... ... @@ -7826,8 +8740,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7826 8740 this.editorUi.menus.edgeStyleChange(
7827 8741 menu,
7828 8742 "",
7829   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7830   - [ "cross", 0 ],
  8743 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8744 + ["cross", 0],
7831 8745 null,
7832 8746 null,
7833 8747 false,
... ... @@ -7838,8 +8752,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7838 8752 this.editorUi.menus.edgeStyleChange(
7839 8753 menu,
7840 8754 "",
7841   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7842   - [ "circlePlus", 0 ],
  8755 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8756 + ["circlePlus", 0],
7843 8757 null,
7844 8758 null,
7845 8759 false,
... ... @@ -7850,8 +8764,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7850 8764 this.editorUi.menus.edgeStyleChange(
7851 8765 menu,
7852 8766 "",
7853   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7854   - [ "circle", 1 ],
  8767 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8768 + ["circle", 1],
7855 8769 null,
7856 8770 null,
7857 8771 false,
... ... @@ -7862,8 +8776,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7862 8776 this.editorUi.menus.edgeStyleChange(
7863 8777 menu,
7864 8778 "",
7865   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7866   - [ "baseDash", 0 ],
  8779 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8780 + ["baseDash", 0],
7867 8781 null,
7868 8782 null,
7869 8783 false,
... ... @@ -7874,8 +8788,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7874 8788 this.editorUi.menus.edgeStyleChange(
7875 8789 menu,
7876 8790 "",
7877   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7878   - [ "ERone", 0 ],
  8791 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8792 + ["ERone", 0],
7879 8793 null,
7880 8794 null,
7881 8795 false,
... ... @@ -7886,8 +8800,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7886 8800 this.editorUi.menus.edgeStyleChange(
7887 8801 menu,
7888 8802 "",
7889   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7890   - [ "ERmandOne", 0 ],
  8803 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8804 + ["ERmandOne", 0],
7891 8805 null,
7892 8806 null,
7893 8807 false,
... ... @@ -7898,8 +8812,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7898 8812 this.editorUi.menus.edgeStyleChange(
7899 8813 menu,
7900 8814 "",
7901   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7902   - [ "ERmany", 0 ],
  8815 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8816 + ["ERmany", 0],
7903 8817 null,
7904 8818 null,
7905 8819 false,
... ... @@ -7910,8 +8824,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7910 8824 this.editorUi.menus.edgeStyleChange(
7911 8825 menu,
7912 8826 "",
7913   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7914   - [ "ERoneToMany", 0 ],
  8827 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8828 + ["ERoneToMany", 0],
7915 8829 null,
7916 8830 null,
7917 8831 false,
... ... @@ -7922,8 +8836,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7922 8836 this.editorUi.menus.edgeStyleChange(
7923 8837 menu,
7924 8838 "",
7925   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7926   - [ "ERzeroToOne", 0 ],
  8839 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8840 + ["ERzeroToOne", 0],
7927 8841 null,
7928 8842 null,
7929 8843 false,
... ... @@ -7934,8 +8848,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7934 8848 this.editorUi.menus.edgeStyleChange(
7935 8849 menu,
7936 8850 "",
7937   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7938   - [ "ERzeroToMany", 0 ],
  8851 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8852 + ["ERzeroToMany", 0],
7939 8853 null,
7940 8854 null,
7941 8855 false,
... ... @@ -7946,8 +8860,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7946 8860 this.editorUi.menus.edgeStyleChange(
7947 8861 menu,
7948 8862 "",
7949   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7950   - [ "doubleBlock", 0 ],
  8863 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8864 + ["doubleBlock", 0],
7951 8865 null,
7952 8866 null,
7953 8867 false,
... ... @@ -7958,8 +8872,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7958 8872 this.editorUi.menus.edgeStyleChange(
7959 8873 menu,
7960 8874 "",
7961   - [ mxConstants.STYLE_STARTARROW, "startFill" ],
7962   - [ "doubleBlock", 1 ],
  8875 + [mxConstants.STYLE_STARTARROW, "startFill"],
  8876 + ["doubleBlock", 1],
7963 8877 null,
7964 8878 null,
7965 8879 false,
... ... @@ -7971,8 +8885,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
7971 8885 .edgeStyleChange(
7972 8886 menu,
7973 8887 "",
7974   - [ mxConstants.STYLE_STARTARROW ],
7975   - [ mxConstants.ARROW_BLOCK ],
  8888 + [mxConstants.STYLE_STARTARROW],
  8889 + [mxConstants.ARROW_BLOCK],
7976 8890 "geIcon geSprite geSprite-startblocktrans",
7977 8891 null,
7978 8892 false,
... ... @@ -8008,8 +8922,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8008 8922 var item = this.editorUi.menus.edgeStyleChange(
8009 8923 menu,
8010 8924 "",
8011   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8012   - [ mxConstants.NONE, 0 ],
  8925 + [mxConstants.STYLE_ENDARROW, "endFill"],
  8926 + [mxConstants.NONE, 0],
8013 8927 "geIcon",
8014 8928 null,
8015 8929 false,
... ... @@ -8026,8 +8940,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8026 8940 this.editorUi.menus.edgeStyleChange(
8027 8941 menu,
8028 8942 "",
8029   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8030   - [ mxConstants.ARROW_CLASSIC, 1 ],
  8943 + [mxConstants.STYLE_ENDARROW, "endFill"],
  8944 + [mxConstants.ARROW_CLASSIC, 1],
8031 8945 null,
8032 8946 null,
8033 8947 false,
... ... @@ -8039,8 +8953,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8039 8953 this.editorUi.menus.edgeStyleChange(
8040 8954 menu,
8041 8955 "",
8042   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8043   - [ mxConstants.ARROW_CLASSIC_THIN, 1 ],
  8956 + [mxConstants.STYLE_ENDARROW, "endFill"],
  8957 + [mxConstants.ARROW_CLASSIC_THIN, 1],
8044 8958 null,
8045 8959 null,
8046 8960 false,
... ... @@ -8052,8 +8966,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8052 8966 this.editorUi.menus.edgeStyleChange(
8053 8967 menu,
8054 8968 "",
8055   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8056   - [ mxConstants.ARROW_OPEN, 0 ],
  8969 + [mxConstants.STYLE_ENDARROW, "endFill"],
  8970 + [mxConstants.ARROW_OPEN, 0],
8057 8971 null,
8058 8972 null,
8059 8973 false,
... ... @@ -8065,8 +8979,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8065 8979 this.editorUi.menus.edgeStyleChange(
8066 8980 menu,
8067 8981 "",
8068   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8069   - [ mxConstants.ARROW_OPEN_THIN, 0 ],
  8982 + [mxConstants.STYLE_ENDARROW, "endFill"],
  8983 + [mxConstants.ARROW_OPEN_THIN, 0],
8070 8984 null,
8071 8985 null,
8072 8986 false,
... ... @@ -8078,8 +8992,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8078 8992 this.editorUi.menus.edgeStyleChange(
8079 8993 menu,
8080 8994 "",
8081   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8082   - [ "openAsync", 0 ],
  8995 + [mxConstants.STYLE_ENDARROW, "endFill"],
  8996 + ["openAsync", 0],
8083 8997 null,
8084 8998 null,
8085 8999 false,
... ... @@ -8091,8 +9005,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8091 9005 this.editorUi.menus.edgeStyleChange(
8092 9006 menu,
8093 9007 "",
8094   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8095   - [ mxConstants.ARROW_BLOCK, 1 ],
  9008 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9009 + [mxConstants.ARROW_BLOCK, 1],
8096 9010 null,
8097 9011 null,
8098 9012 false,
... ... @@ -8104,8 +9018,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8104 9018 this.editorUi.menus.edgeStyleChange(
8105 9019 menu,
8106 9020 "",
8107   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8108   - [ mxConstants.ARROW_BLOCK_THIN, 1 ],
  9021 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9022 + [mxConstants.ARROW_BLOCK_THIN, 1],
8109 9023 null,
8110 9024 null,
8111 9025 false,
... ... @@ -8117,8 +9031,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8117 9031 this.editorUi.menus.edgeStyleChange(
8118 9032 menu,
8119 9033 "",
8120   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8121   - [ "async", 1 ],
  9034 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9035 + ["async", 1],
8122 9036 null,
8123 9037 null,
8124 9038 false,
... ... @@ -8130,8 +9044,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8130 9044 this.editorUi.menus.edgeStyleChange(
8131 9045 menu,
8132 9046 "",
8133   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8134   - [ mxConstants.ARROW_OVAL, 1 ],
  9047 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9048 + [mxConstants.ARROW_OVAL, 1],
8135 9049 null,
8136 9050 null,
8137 9051 false,
... ... @@ -8143,8 +9057,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8143 9057 this.editorUi.menus.edgeStyleChange(
8144 9058 menu,
8145 9059 "",
8146   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8147   - [ mxConstants.ARROW_DIAMOND, 1 ],
  9060 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9061 + [mxConstants.ARROW_DIAMOND, 1],
8148 9062 null,
8149 9063 null,
8150 9064 false,
... ... @@ -8156,8 +9070,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8156 9070 this.editorUi.menus.edgeStyleChange(
8157 9071 menu,
8158 9072 "",
8159   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8160   - [ mxConstants.ARROW_DIAMOND_THIN, 1 ],
  9073 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9074 + [mxConstants.ARROW_DIAMOND_THIN, 1],
8161 9075 null,
8162 9076 null,
8163 9077 false,
... ... @@ -8169,8 +9083,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8169 9083 this.editorUi.menus.edgeStyleChange(
8170 9084 menu,
8171 9085 "",
8172   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8173   - [ mxConstants.ARROW_CLASSIC, 0 ],
  9086 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9087 + [mxConstants.ARROW_CLASSIC, 0],
8174 9088 null,
8175 9089 null,
8176 9090 false,
... ... @@ -8182,8 +9096,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8182 9096 this.editorUi.menus.edgeStyleChange(
8183 9097 menu,
8184 9098 "",
8185   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8186   - [ mxConstants.ARROW_CLASSIC_THIN, 0 ],
  9099 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9100 + [mxConstants.ARROW_CLASSIC_THIN, 0],
8187 9101 null,
8188 9102 null,
8189 9103 false,
... ... @@ -8195,8 +9109,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8195 9109 this.editorUi.menus.edgeStyleChange(
8196 9110 menu,
8197 9111 "",
8198   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8199   - [ mxConstants.ARROW_BLOCK, 0 ],
  9112 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9113 + [mxConstants.ARROW_BLOCK, 0],
8200 9114 null,
8201 9115 null,
8202 9116 false,
... ... @@ -8208,8 +9122,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8208 9122 this.editorUi.menus.edgeStyleChange(
8209 9123 menu,
8210 9124 "",
8211   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8212   - [ mxConstants.ARROW_BLOCK_THIN, 0 ],
  9125 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9126 + [mxConstants.ARROW_BLOCK_THIN, 0],
8213 9127 null,
8214 9128 null,
8215 9129 false,
... ... @@ -8221,8 +9135,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8221 9135 this.editorUi.menus.edgeStyleChange(
8222 9136 menu,
8223 9137 "",
8224   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8225   - [ "async", 0 ],
  9138 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9139 + ["async", 0],
8226 9140 null,
8227 9141 null,
8228 9142 false,
... ... @@ -8234,8 +9148,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8234 9148 this.editorUi.menus.edgeStyleChange(
8235 9149 menu,
8236 9150 "",
8237   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8238   - [ mxConstants.ARROW_OVAL, 0 ],
  9151 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9152 + [mxConstants.ARROW_OVAL, 0],
8239 9153 null,
8240 9154 null,
8241 9155 false,
... ... @@ -8247,8 +9161,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8247 9161 this.editorUi.menus.edgeStyleChange(
8248 9162 menu,
8249 9163 "",
8250   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8251   - [ mxConstants.ARROW_DIAMOND, 0 ],
  9164 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9165 + [mxConstants.ARROW_DIAMOND, 0],
8252 9166 null,
8253 9167 null,
8254 9168 false,
... ... @@ -8260,8 +9174,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8260 9174 this.editorUi.menus.edgeStyleChange(
8261 9175 menu,
8262 9176 "",
8263   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8264   - [ mxConstants.ARROW_DIAMOND_THIN, 0 ],
  9177 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9178 + [mxConstants.ARROW_DIAMOND_THIN, 0],
8265 9179 null,
8266 9180 null,
8267 9181 false,
... ... @@ -8273,8 +9187,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8273 9187 this.editorUi.menus.edgeStyleChange(
8274 9188 menu,
8275 9189 "",
8276   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8277   - [ "box", 0 ],
  9190 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9191 + ["box", 0],
8278 9192 null,
8279 9193 null,
8280 9194 false,
... ... @@ -8286,8 +9200,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8286 9200 this.editorUi.menus.edgeStyleChange(
8287 9201 menu,
8288 9202 "",
8289   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8290   - [ "halfCircle", 0 ],
  9203 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9204 + ["halfCircle", 0],
8291 9205 null,
8292 9206 null,
8293 9207 false,
... ... @@ -8299,8 +9213,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8299 9213 this.editorUi.menus.edgeStyleChange(
8300 9214 menu,
8301 9215 "",
8302   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8303   - [ "dash", 0 ],
  9216 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9217 + ["dash", 0],
8304 9218 null,
8305 9219 null,
8306 9220 false,
... ... @@ -8312,8 +9226,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8312 9226 this.editorUi.menus.edgeStyleChange(
8313 9227 menu,
8314 9228 "",
8315   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8316   - [ "cross", 0 ],
  9229 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9230 + ["cross", 0],
8317 9231 null,
8318 9232 null,
8319 9233 false,
... ... @@ -8325,8 +9239,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8325 9239 this.editorUi.menus.edgeStyleChange(
8326 9240 menu,
8327 9241 "",
8328   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8329   - [ "circlePlus", 0 ],
  9242 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9243 + ["circlePlus", 0],
8330 9244 null,
8331 9245 null,
8332 9246 false,
... ... @@ -8338,8 +9252,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8338 9252 this.editorUi.menus.edgeStyleChange(
8339 9253 menu,
8340 9254 "",
8341   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8342   - [ "circle", 0 ],
  9255 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9256 + ["circle", 0],
8343 9257 null,
8344 9258 null,
8345 9259 false,
... ... @@ -8351,8 +9265,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8351 9265 this.editorUi.menus.edgeStyleChange(
8352 9266 menu,
8353 9267 "",
8354   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8355   - [ "baseDash", 0 ],
  9268 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9269 + ["baseDash", 0],
8356 9270 null,
8357 9271 null,
8358 9272 false,
... ... @@ -8364,8 +9278,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8364 9278 this.editorUi.menus.edgeStyleChange(
8365 9279 menu,
8366 9280 "",
8367   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8368   - [ "ERone", 0 ],
  9281 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9282 + ["ERone", 0],
8369 9283 null,
8370 9284 null,
8371 9285 false,
... ... @@ -8377,8 +9291,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8377 9291 this.editorUi.menus.edgeStyleChange(
8378 9292 menu,
8379 9293 "",
8380   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8381   - [ "ERmandOne", 0 ],
  9294 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9295 + ["ERmandOne", 0],
8382 9296 null,
8383 9297 null,
8384 9298 false,
... ... @@ -8390,8 +9304,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8390 9304 this.editorUi.menus.edgeStyleChange(
8391 9305 menu,
8392 9306 "",
8393   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8394   - [ "ERmany", 0 ],
  9307 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9308 + ["ERmany", 0],
8395 9309 null,
8396 9310 null,
8397 9311 false,
... ... @@ -8403,8 +9317,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8403 9317 this.editorUi.menus.edgeStyleChange(
8404 9318 menu,
8405 9319 "",
8406   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8407   - [ "ERoneToMany", 0 ],
  9320 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9321 + ["ERoneToMany", 0],
8408 9322 null,
8409 9323 null,
8410 9324 false,
... ... @@ -8416,8 +9330,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8416 9330 this.editorUi.menus.edgeStyleChange(
8417 9331 menu,
8418 9332 "",
8419   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8420   - [ "ERzeroToOne", 0 ],
  9333 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9334 + ["ERzeroToOne", 0],
8421 9335 null,
8422 9336 null,
8423 9337 false,
... ... @@ -8429,8 +9343,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8429 9343 this.editorUi.menus.edgeStyleChange(
8430 9344 menu,
8431 9345 "",
8432   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8433   - [ "ERzeroToMany", 0 ],
  9346 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9347 + ["ERzeroToMany", 0],
8434 9348 null,
8435 9349 null,
8436 9350 false,
... ... @@ -8442,8 +9356,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8442 9356 this.editorUi.menus.edgeStyleChange(
8443 9357 menu,
8444 9358 "",
8445   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8446   - [ "doubleBlock", 0 ],
  9359 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9360 + ["doubleBlock", 0],
8447 9361 null,
8448 9362 null,
8449 9363 false,
... ... @@ -8455,8 +9369,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8455 9369 this.editorUi.menus.edgeStyleChange(
8456 9370 menu,
8457 9371 "",
8458   - [ mxConstants.STYLE_ENDARROW, "endFill" ],
8459   - [ "doubleBlock", 1 ],
  9372 + [mxConstants.STYLE_ENDARROW, "endFill"],
  9373 + ["doubleBlock", 1],
8460 9374 null,
8461 9375 null,
8462 9376 false,
... ... @@ -8469,8 +9383,8 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8469 9383 .edgeStyleChange(
8470 9384 menu,
8471 9385 "",
8472   - [ mxConstants.STYLE_ENDARROW ],
8473   - [ mxConstants.ARROW_BLOCK ],
  9386 + [mxConstants.STYLE_ENDARROW],
  9387 + [mxConstants.ARROW_BLOCK],
8474 9388 "geIcon geSprite geSprite-endblocktrans",
8475 9389 null,
8476 9390 false,
... ... @@ -8693,14 +9607,14 @@ StyleFormatPanel.prototype.addStroke = function (container) {
8693 9607 edgeStyleDiv.className =
8694 9608 "geSprite " +
8695 9609 (mxUtils.getValue(ss.style, mxConstants.STYLE_ELBOW, null) ==
8696   - "vertical"
  9610 + "vertical"
8697 9611 ? "geSprite-verticalelbow"
8698 9612 : "geSprite-horizontalelbow");
8699 9613 } else if (es == "isometricEdgeStyle") {
8700 9614 edgeStyleDiv.className =
8701 9615 "geSprite " +
8702 9616 (mxUtils.getValue(ss.style, mxConstants.STYLE_ELBOW, null) ==
8703   - "vertical"
  9617 + "vertical"
8704 9618 ? "geSprite-verticalisometric"
8705 9619 : "geSprite-horizontalisometric");
8706 9620 } else {
... ... @@ -8957,7 +9871,7 @@ StyleFormatPanel.prototype.addLineJumps = function (container) {
8957 9871 styleSelect.style.border = "1px solid rgb(160, 160, 160)";
8958 9872 styleSelect.style.borderRadius = "4px";
8959 9873
8960   - var styles = [ "none", "arc", "gap", "sharp", "line" ];
  9874 + var styles = ["none", "arc", "gap", "sharp", "line"];
8961 9875
8962 9876 for (var i = 0; i < styles.length; i++) {
8963 9877 var styleOption = document.createElement("option");
... ... @@ -8974,9 +9888,9 @@ StyleFormatPanel.prototype.addLineJumps = function (container) {
8974 9888 new mxEventObject(
8975 9889 "styleChanged",
8976 9890 "keys",
8977   - [ "jumpStyle" ],
  9891 + ["jumpStyle"],
8978 9892 "values",
8979   - [ styleSelect.value ],
  9893 + [styleSelect.value],
8980 9894 "cells",
8981 9895 ss.cells,
8982 9896 ),
... ... @@ -9126,7 +10040,7 @@ StyleFormatPanel.prototype.addStyleOps = function (div) {
9126 10040 div.style.paddingTop = "10px";
9127 10041 div.style.paddingBottom = "10px";
9128 10042
9129   - this.addActions(div, [ "setAsDefaultStyle" ]);
  10043 + this.addActions(div, ["setAsDefaultStyle"]);
9130 10044
9131 10045 return div;
9132 10046 };
... ... @@ -9327,7 +10241,7 @@ DiagramStylePanel.prototype.addView = function (div) {
9327 10241 labelBackgroundColor:
9328 10242 graphStyle != null ? graphStyle.background : null,
9329 10243 },
9330   - [ cells[i] ],
  10244 + [cells[i]],
9331 10245 );
9332 10246 }
9333 10247
... ... @@ -9503,7 +10417,7 @@ DiagramStylePanel.prototype.addView = function (div) {
9503 10417 v1,
9504 10418 "edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;endSize=5;strokeWidth=2;",
9505 10419 );
9506   - e1.geometry.points = [ new mxPoint(32, 70) ];
  10420 + e1.geometry.points = [new mxPoint(32, 70)];
9507 10421 e1.geometry.offset = new mxPoint(0, 8);
9508 10422 } finally {
9509 10423 graph2.model.endUpdate();
... ... @@ -10252,8 +11166,8 @@ DiagramFormatPanel.prototype.addPaperSize = function (div) {
10252 11166 * Adds the label menu items to the given menu and parent.
10253 11167 */
10254 11168 DiagramFormatPanel.prototype.addStyleOps = function (div) {
10255   - this.addActions(div, [ "editData" ]);
10256   - this.addActions(div, [ "clearDefaultStyle" ]);
  11169 + this.addActions(div, ["editData"]);
  11170 + this.addActions(div, ["clearDefaultStyle"]);
10257 11171
10258 11172 return div;
10259 11173 };
... ... @@ -10281,7 +11195,7 @@ class UseLayUi {
10281 11195 return result === '[object Function]' || result === '[object AsyncFunction]'
10282 11196 }
10283 11197
10284   - static dynamicAttr = (attr, value) => value ? `${ attr }="${ value }"` : ''
  11198 + static dynamicAttr = (attr, value) => value ? `${attr}="${value}"` : ''
10285 11199
10286 11200 /**
10287 11201 * @description format data source to tree structure
... ... @@ -10301,7 +11215,7 @@ class UseLayUi {
10301 11215 if (next[childrenField] && next[childrenField].length) {
10302 11216 children = fn(next.children)
10303 11217 }
10304   - return [ ...prev, { children, ...customSetValue(next) } ]
  11218 + return [...prev, { children, ...customSetValue(next) }]
10305 11219 }, [])
10306 11220 }
10307 11221 return fn(data)
... ... @@ -10350,9 +11264,9 @@ class UseLayUi {
10350 11264 let { renderFn } = options
10351 11265 renderFn = renderFn || ((record) => {
10352 11266 if (typeof record === 'object') {
10353   - return `<option value="${ record[valueField] }" ${ record.disabled ? 'disabled=""' : '' }>${ record[labelField] }</option>`
  11267 + return `<option value="${record[valueField]}" ${record.disabled ? 'disabled=""' : ''}>${record[labelField]}</option>`
10354 11268 } else {
10355   - return `<option value="${ record }">${ record }</option>`
  11269 + return `<option value="${record}">${record}</option>`
10356 11270 }
10357 11271 })
10358 11272 const optionsList = dataSource.map(renderFn)
... ... @@ -10366,8 +11280,8 @@ class UseLayUi {
10366 11280 */
10367 11281 static createSingleUseFormItem(content, props = '') {
10368 11282 return `
10369   - <div class="layui-form" ${ props }>
10370   - ${ content }
  11283 + <div class="layui-form" ${props}>
  11284 + ${content}
10371 11285 </div>
10372 11286 `
10373 11287 }
... ... @@ -10388,7 +11302,9 @@ class UseLayUi {
10388 11302 /**
10389 11303 * @description create layui single select template
10390 11304 * @param {string} [options.layFilter] options.layFilter
  11305 + * @param {string} [options.bindValueFiled] options.bindValueFiled
10391 11306 * @param {string} [options.layVerify] options.layVerify
  11307 + * @param {string} [options.layVerType] options.layVerType
10392 11308 * @param {Function} [options.renderFn] options.renderFn
10393 11309 * @param {Array} [options.dataSource = []] options.dataSource
10394 11310 * @param {string} [options.valueField = id] options.valueField
... ... @@ -10404,7 +11320,9 @@ class UseLayUi {
10404 11320 const {
10405 11321 elem,
10406 11322 layFilter,
  11323 + bindValueFiled,
10407 11324 layVerify,
  11325 + layVerType,
10408 11326 renderFn,
10409 11327 dataSource = [],
10410 11328 valueField = 'id',
... ... @@ -10429,7 +11347,7 @@ class UseLayUi {
10429 11347 return dataSource.map(record => renderFn(record))
10430 11348 }
10431 11349 return formatDataSource(dataSource).map(record => {
10432   - return `<option value="${ record[valueField] }" ${ record.disable ? 'disabled=""' : '' }>${ record[labelField] }</option>`
  11350 + return `<option value="${record[valueField]}" ${record.disable ? 'disabled=""' : ''}>${record[labelField]}</option>`
10433 11351 })
10434 11352 }
10435 11353
... ... @@ -10440,7 +11358,7 @@ class UseLayUi {
10440 11358 }
10441 11359
10442 11360 if (layFilter) {
10443   - form.on(`select(${ layFilter })`, (data) => {
  11361 + form.on(`select(${layFilter})`, (data) => {
10444 11362 if (onClick && this.isFunction(onClick)) {
10445 11363 onClick(data)
10446 11364 }
... ... @@ -10448,11 +11366,11 @@ class UseLayUi {
10448 11366 }
10449 11367
10450 11368 let template = `
10451   - <div class="layui-form-item ${ className }">
10452   - <label class="layui-form-label">${ label }</label>
  11369 + <div class="layui-form-item ${className}">
  11370 + <label class="layui-form-label">${label}</label>
10453 11371 <div class="layui-input-block">
10454   - <select name="${ layFilter }" ${ this.dynamicAttr('lay-filter', layFilter) } ${ this.dynamicAttr('lay-verify', layVerify) }>
10455   - ${ generateOptionTemplate(dataSource) }
  11372 + <select name="${bindValueFiled}" ${this.dynamicAttr('lay-filter', layFilter)} ${this.dynamicAttr('lay-verify', layVerify)} ${this.dynamicAttr('lay-verType', layVerType)}>
  11373 + ${generateOptionTemplate(dataSource)}
10456 11374 </select>
10457 11375 </div>
10458 11376 </div>`
... ... @@ -10464,7 +11382,7 @@ class UseLayUi {
10464 11382 form.render('select', layFilter)
10465 11383 }
10466 11384
10467   - template = singleUsage ? UseLayUi.createSingleUseFormItem(template, this.dynamicAttr('lay-filter', layFilter)) : template
  11385 + template = singleUsage ? UseLayUi.createSingleUseFormItem(template, '') : template
10468 11386
10469 11387
10470 11388 function mount() {
... ... @@ -10490,6 +11408,8 @@ class UseLayUi {
10490 11408 * @param {boolean} [options.singleUsage = true] options.singleUsage
10491 11409 * @param {Function} [options.customSetTree = ((record) => ({ id: record.id, title: record.name }))] options.customSetTree
10492 11410 * @param {boolean} [options.autoFormatDataSource = true] options.autoFormatDataSource
  11411 + * @param {string} [options.layVerify] options.layVerify
  11412 + * @param {string} [options.layVerType] options.layVerType
10493 11413 * @param {Function} [options.treeProps.onReady] options.treeProps.onReady
10494 11414 */
10495 11415 static createTreeSelect(options) {
... ... @@ -10509,23 +11429,25 @@ class UseLayUi {
10509 11429 labelField = 'name',
10510 11430 valueField = 'id',
10511 11431 childrenField = 'children',
  11432 + layVerify,
  11433 + layVerType,
10512 11434 } = options
10513 11435
10514 11436 let { data = [], click, onReady } = treeProps
10515 11437
10516 11438 let template = `
10517   - <div class="layui-form-item ${ CLASS_NAME } ${ className }">
10518   - <label class="layui-form-label">${ label }</label>
  11439 + <div class="layui-form-item ${CLASS_NAME} ${className}">
  11440 + <label class="layui-form-label">${label}</label>
10519 11441 <div class="layui-input-block">
10520   - <div class="layui-unselect layui-form-select ${ SELECT_CLS }">
  11442 + <div class="layui-unselect layui-form-select ${SELECT_CLS}">
10521 11443 <div class="layui-select-title">
10522 11444 <span class="layui-input layui-unselect">请选择</span>
10523   - <input type="hidden" name="${ layFilter }">
  11445 + <input ${this.dynamicAttr('lay-verify', layVerify)} ${this.dynamicAttr('lay-verType', layVerType)} type="text" style="visibility: hidden; position: absolute; top: 0" name="${layFilter}">
10524 11446 <i class="layui-edge"></i>
10525 11447 </div>
10526 11448 <dl class="layui-anim layui-anim-upbit">
10527 11449 <dd>
10528   - <ul id="${ layFilter }"></ul>
  11450 + <ul class="tree-select__tree-mount"></ul>
10529 11451 </dd>
10530 11452 </dl>
10531 11453 </div>
... ... @@ -10543,7 +11465,7 @@ class UseLayUi {
10543 11465 $(elem)
10544 11466 .find('.layui-form-select').removeClass('layui-form-selected').end()
10545 11467 .find(".layui-select-title span").html(title).end()
10546   - .find(`input:hidden[name='${ layFilter }']`).val(id);
  11468 + .find(`input[name='${layFilter}']`).val(id);
10547 11469 }
10548 11470
10549 11471 // init mount
... ... @@ -10556,7 +11478,7 @@ class UseLayUi {
10556 11478 tree.render({
10557 11479 ...treeProps,
10558 11480 ...(autoFormatDataSource ? { data: UseLayUi.formatTreeDataSource(data, customSetTree, valueField, labelField, childrenField) } : {}),
10559   - elem: $(elem).find(`#${ layFilter }`),
  11481 + elem: $(elem).find('.tree-select__tree-mount'),
10560 11482 click(node) {
10561 11483 setValue(node.data)
10562 11484 if (UseLayUi.isFunction(click)) click(node)
... ... @@ -10564,10 +11486,9 @@ class UseLayUi {
10564 11486 })
10565 11487
10566 11488 // focus
10567   - $(`.${ SELECT_CLS }`)
  11489 + $(`.${SELECT_CLS}`).off('click')
10568 11490 .on("click", ".layui-select-title", function (e) {
10569   - $(".layui-form-select").not($(this).parents(".layui-form-select")).removeClass("layui-form-selected");
10570   - $(this).parents(`.${ SELECT_CLS }`).toggleClass("layui-form-selected");
  11491 + $(this).parents(`.${SELECT_CLS}`).toggleClass("layui-form-selected");
10571 11492 layui.stope(e);
10572 11493 })
10573 11494 .on('click', '.layui-anim', (e) => {
... ... @@ -10578,15 +11499,16 @@ class UseLayUi {
10578 11499 })
10579 11500
10580 11501 // blur
10581   - $(document)
10582   - .on("click", function (e) {
10583   - const target = e.target
10584   - const parentNode = document.getElementById(layFilter)
10585   - if (!parentNode) return
10586   - const showClose = UseLayUi.isInNode(parentNode, target, true)
10587   - if (showClose) return
10588   - $(`.${ SELECT_CLS }`).removeClass("layui-form-selected")
10589   - });
  11502 + // $(document)
  11503 + // .on("click", function (e) {
  11504 + // const target = e.target
  11505 + // const parentNode = $(`.${CLASS_NAME} .tree-select__tree-mount`)
  11506 + // if (!parentNode) return
  11507 + // console.log($.contains(parentNode, target))
  11508 + // // const showClose = UseLayUi.isInNode(parentNode, target, true)
  11509 + // // if (showClose) return
  11510 + // // $(`.${ SELECT_CLS }`).removeClass("layui-form-selected")
  11511 + // });
10590 11512
10591 11513 if (UseLayUi.isFunction(onReady)) {
10592 11514 onReady(setValue)
... ... @@ -10616,27 +11538,27 @@ class UseLayUi {
10616 11538 } = options
10617 11539 customSetValue = customSetValue || ((record) => ({ value: record.id, title: record.name }))
10618 11540 if (!Array.isArray(dataSource)) {
10619   - dataSource = [ dataSource ]
  11541 + dataSource = [dataSource]
10620 11542 }
10621 11543
10622 11544 function createOptions(dataSource) {
10623 11545 return dataSource.map((record) => {
10624 11546 return `<input
10625   - type="checkbox" lay-skin="${ laySkin }"
10626   - ${ UseLayUi.dynamicAttr('name', record[valueField]) }
10627   - ${ UseLayUi.dynamicAttr('title', record[labelField]) }
10628   - ${ UseLayUi.dynamicAttr('lay-filter', layFilter) }
10629   - ${ UseLayUi.dynamicAttr('lay-verify', layVerify) }
10630   - ${ UseLayUi.dynamicAttr('checked', record[checkedField]) }
  11547 + type="checkbox" lay-skin="${laySkin}"
  11548 + ${UseLayUi.dynamicAttr('name', record[valueField])}
  11549 + ${UseLayUi.dynamicAttr('title', record[labelField])}
  11550 + ${UseLayUi.dynamicAttr('lay-filter', layFilter)}
  11551 + ${UseLayUi.dynamicAttr('lay-verify', layVerify)}
  11552 + ${UseLayUi.dynamicAttr('checked', record[checkedField])}
10631 11553 >`
10632 11554 })
10633 11555 }
10634 11556
10635 11557 let template = `
10636   - <div class="layui-form-item ${ CLASS_NAME }" >
10637   - <label class="layui-form-label">${ label }</label>
  11558 + <div class="layui-form-item ${CLASS_NAME}" >
  11559 + <label class="layui-form-label">${label}</label>
10638 11560 <div class="layui-input-block">
10639   - ${ createOptions(dataSource).join('') }
  11561 + ${createOptions(dataSource).join('')}
10640 11562 </div>
10641 11563 </div>
10642 11564 `
... ... @@ -10646,7 +11568,7 @@ class UseLayUi {
10646 11568 if (!elem) return template
10647 11569 $(elem).empty()
10648 11570 $(elem).append(template)
10649   - form.on(`checkbox(${ layFilter })`, (data) => {
  11571 + form.on(`checkbox(${layFilter})`, (data) => {
10650 11572 onChange && (onChange(data))
10651 11573 })
10652 11574 form.render()
... ... @@ -10721,13 +11643,13 @@ class UseLayUi {
10721 11643 */
10722 11644 function to(promise, errorExt) {
10723 11645 return promise
10724   - .then((data) => [ null, data ])
  11646 + .then((data) => [null, data])
10725 11647 .catch((err) => {
10726 11648 if (errorExt) {
10727 11649 const parsedError = Object.assign({}, err, errorExt)
10728   - return [ parsedError, undefined ]
  11650 + return [parsedError, undefined]
10729 11651 }
10730   - return [ err, undefined ]
  11652 + return [err, undefined]
10731 11653 })
10732 11654 }
10733 11655
... ... @@ -10757,7 +11679,7 @@ class EventCenter {
10757 11679 this.eventStack.get(eventName).push(callback)
10758 11680 return
10759 11681 }
10760   - this.eventStack.set(eventName, [ callback ])
  11682 + this.eventStack.set(eventName, [callback])
10761 11683 }
10762 11684
10763 11685 /**
... ... @@ -11218,7 +12140,7 @@ class DispatchCenter {
11218 12140 async getContentDataNode() {
11219 12141 const { node: { id } = {} } = this.currentPage
11220 12142 if (!id) return
11221   - const [ err, res ] = await to(ConfigurationNodeApi.getConfigurationInfo('CONTENT', id))
  12143 + const [err, res] = await to(ConfigurationNodeApi.getConfigurationInfo('CONTENT', id))
11222 12144 const { dataSources, event, act } = this.contentData = res
11223 12145 const tsSubCmds = this.generatorDataSourceMapping(dataSources)
11224 12146 this.sendMessageToGetRealTimeData({ tsSubCmds })
... ... @@ -11268,6 +12190,7 @@ class DispatchCenter {
11268 12190 * @description 分发事件
11269 12191 */
11270 12192 publishEvent(eventName, data, message, event, ws) {
  12193 + data = data ? data : {}
11271 12194 Object.keys(data).forEach(() => {
11272 12195 this.eventBus.emit(eventName, message, event, ws)
11273 12196 })
... ... @@ -11284,7 +12207,7 @@ class DispatchCenter {
11284 12207 this.eventBus.on(eventName, (message) => {
11285 12208 this.updatePage(() => {
11286 12209 const { data } = message
11287   - const [ [ timespan, value ] ] = data[key]
  12210 + const [[timespan, value]] = data[key]
11288 12211 node.setValue(value)
11289 12212 }, node)
11290 12213 })
... ... @@ -11413,7 +12336,7 @@ class HandleDataInteraction {
11413 12336 if (eventName === mxEvent.MOUSE_UP) {
11414 12337 this.handleMouseUpEvent(eventName, event, sender)
11415 12338 }
11416   - graphFireMouseEvent.apply(this.graph, [ eventName, event, sender ]);
  12339 + graphFireMouseEvent.apply(this.graph, [eventName, event, sender]);
11417 12340 };
11418 12341
11419 12342 DispatchCenter.eventListenerIsExist = true
... ... @@ -11494,7 +12417,7 @@ class HandleDataInteraction {
11494 12417 sendInstruction(list = []) {
11495 12418 const queue = []
11496 12419 const fn = async (way, deviceId, data) => {
11497   - const [ err, res = {} ] = await to(ConfigurationNodeApi.deviceIsOnLine(deviceId))
  12420 + const [err, res = {}] = await to(ConfigurationNodeApi.deviceIsOnLine(deviceId))
11498 12421 const { value } = res
11499 12422 if (value) {
11500 12423 await to(ConfigurationNodeApi.sendInstruction(way, deviceId, data))
... ... @@ -11527,10 +12450,13 @@ class HandleDataInteraction {
11527 12450 * @description 跳转页面
11528 12451 */
11529 12452 jumpPage(page) {
11530   - this.editorUi.handleCustomLink(`data:page/id,${ page }`)
  12453 + this.editorUi.handleCustomLink(`data:page/id,${page}`)
11531 12454 }
11532 12455 }
11533 12456
  12457 +/**
  12458 + * @description 处理数据
  12459 + */
11534 12460 class HandleDynamicEffect {
11535 12461
11536 12462 /**
... ... @@ -11571,6 +12497,7 @@ class HandleDynamicEffect {
11571 12497 FLASH: 'FLASH',
11572 12498 DISPLAY: 'DISPLAY',
11573 12499 ROTATE: 'ROTATE',
  12500 + IMAGE: 'IMAGE',
11574 12501 }
11575 12502
11576 12503 static enumDisplayType = {
... ... @@ -11640,7 +12567,7 @@ class HandleDynamicEffect {
11640 12567
11641 12568 tsSubCmds.push(this.generatorMessage(slaveDeviceId ? slaveDeviceId : deviceId, cmdId, attr))
11642 12569
11643   - this.subscribeEvent(cmdId, this.dispatch(type), attr)
  12570 + this.subscribeEvent(cmdId, this.dispatch(type))
11644 12571 })
11645 12572 this.sendMsg({ tsSubCmds })
11646 12573 }
... ... @@ -11697,6 +12624,9 @@ class HandleDynamicEffect {
11697 12624 case HandleDynamicEffect.enumActType.FLASH:
11698 12625 invoke = this.flash.bind(this)
11699 12626 break
  12627 + case HandleDynamicEffect.enumActType.IMAGE:
  12628 + invoke = this.varImage.bind(this)
  12629 + break
11700 12630 }
11701 12631 return invoke
11702 12632 }
... ... @@ -11706,7 +12636,7 @@ class HandleDynamicEffect {
11706 12636 * @param message
11707 12637 * @param attr
11708 12638 */
11709   - rotate(message, attr) {
  12639 + rotate(message) {
11710 12640 const { subscriptionId, data } = message
11711 12641 const node = this.getNodeByCmdId(subscriptionId)
11712 12642 const { flag } = this.validate(subscriptionId, DispatchCenter.enumDynamicEffectType.ROTATE, data)
... ... @@ -11716,7 +12646,7 @@ class HandleDynamicEffect {
11716 12646 deg += 20
11717 12647 let style = node.getStyle()
11718 12648 const reg = /rotation=(-?)\w+(;?)/g
11719   - style = style.replace(reg, `rotation=${ deg }`)
  12649 + style = style.replace(reg, `rotation=${deg}`)
11720 12650 node.setStyle(style)
11721 12651 this.graph.updateCellStyles(style, node)
11722 12652 }
... ... @@ -11733,7 +12663,7 @@ class HandleDynamicEffect {
11733 12663 * @param message
11734 12664 * @param attr
11735 12665 */
11736   - display(message, attr) {
  12666 + display(message) {
11737 12667 const { subscriptionId, data = {} } = message
11738 12668 const { flag, condition } = this.validate(subscriptionId, HandleDynamicEffect.enumActType.DISPLAY, data)
11739 12669 if (!flag) return
... ... @@ -11757,7 +12687,7 @@ class HandleDynamicEffect {
11757 12687 * @param message
11758 12688 * @param attr
11759 12689 */
11760   - flash(message, attr) {
  12690 + flash(message) {
11761 12691 const { subscriptionId, data } = message
11762 12692 const node = this.getNodeByCmdId(subscriptionId)
11763 12693 const { flag, condition } = this.validate(subscriptionId, HandleDynamicEffect.enumActType.FLASH, data)
... ... @@ -11777,6 +12707,23 @@ class HandleDynamicEffect {
11777 12707 }
11778 12708
11779 12709 /**
  12710 + * @description 处理变量图片
  12711 + */
  12712 + varImage(message) {
  12713 + const { subscriptionId, data } = message
  12714 + const node = this.getNodeByCmdId(subscriptionId)
  12715 + const { flag, condition } = this.validate(subscriptionId, HandleDynamicEffect.enumActType.IMAGE, data)
  12716 + if (flag && node) {
  12717 + const { imagePath } = condition
  12718 + this.insertOnceUpdateFn(
  12719 + node,
  12720 + () => {
  12721 + node.setStyle(`image;image=${imagePath};imageAspect=0;`)
  12722 + })
  12723 + }
  12724 + }
  12725 +
  12726 + /**
11780 12727 * @description 验证是否满足条件列表中的任意一条
11781 12728 * @param subscriptionId
11782 12729 * @param type
... ... @@ -11788,7 +12735,7 @@ class HandleDynamicEffect {
11788 12735 const result = { condition: {}, flag: false }
11789 12736 for (let i = 0; i < condition.length; i++) {
11790 12737 const { min, max } = condition[i]
11791   - const [ timespan, realValue ] = value[attr][0]
  12738 + const [timespan, realValue] = value[attr][0]
11792 12739 result.flag = this.isExistInArea(min, max, realValue)
11793 12740 if (result.flag) {
11794 12741 result.condition = condition[i]
... ... @@ -11880,7 +12827,6 @@ class UpdateQueue {
11880 12827 this.graph.getModel().endUpdate()
11881 12828 }
11882 12829 }
11883   - console.log('enter')
11884 12830 const cleanFn = RAFSetInterval(callback, time)
11885 12831 this.timeQueue.set(time, cleanFn)
11886 12832 }
... ... @@ -12011,22 +12957,3 @@ function RAFSetInterval(callback, time) {
12011 12957 }
12012 12958
12013 12959
12014   -function globalInit() {
12015   - init()
12016   -
12017   - function init() {
12018   - initRealTime()
12019   - }
12020   -
12021   - function initRealTime() {
12022   - RAFSetInterval(() => {
12023   - const allTimeNode = document.querySelectorAll('.thingKit-component__real-time .real-time__now')
12024   - for (const time of allTimeNode) {
12025   - const date = new Date()
12026   - time.innerHTML = `${ date.getHours() < 10 ? '0' : '' }${ date.getHours() }:${ date.getMinutes() < 10 ? '0' : '' }${ date.getMinutes() }:${ date.getSeconds() < 10 ? '0' : '' }${ date.getSeconds() }`
12027   - }
12028   - }, 1000)
12029   - }
12030   -}
12031   -
12032   -globalInit()
\ No newline at end of file
... ...
... ... @@ -17,10 +17,6 @@
17 17 display: flex;
18 18 }
19 19
20   -.mxWindowPane .data-panel__select label{
21   - flex: 0 0 50px;
22   -}
23   -
24 20
25 21 /* */
26 22 .override__panel--default {
... ... @@ -52,32 +48,41 @@
52 48 background-image: url(../images/edit20.png);
53 49 }
54 50
55   -
56   -/* ========= 数据源部分 ============ */
57   -.data-source__select-container {
58   - display: flex;
59   - align-items: center;
60   - overflow: visible !important;
61   - padding: 8px 0 8px 14px !important;
62   - margin-left: 0;
  51 +/* ==== 数据源组件样式 ==== */
  52 +.data-source__component-style {
  53 + padding: 10px;
63 54 }
64 55
65   -.data-panel__select {
66   - display: flex;
67   - margin-bottom: 0;
  56 +.data-source__component-style > div {
  57 + margin-bottom: 10px;
68 58 }
69 59
70   -.data-panel__select .layui-form-label {
  60 +.data-source__component-select > .layui-form-label {
  61 + float: left;
  62 + display: block;
71 63 padding: 9px 10px 9px 0;
72   - width: 50px !important;
  64 + width: 60px;
  65 + font-weight: 400;
  66 + line-height: 20px;
  67 + text-align: right;
73 68 box-sizing: border-box;
74 69 }
75 70
76   -.data-panel__select .layui-input-block {
77   - flex: auto;
  71 +.data-source__component-select > .layui-input-block {
  72 + margin-left: 60px;
  73 + min-height: 36px;
  74 +}
  75 +
  76 +/* ========= 数据源部分 ============ */
  77 +.data-source__select-container {
  78 + display: flex;
  79 + align-items: center;
  80 + overflow: visible !important;
  81 + padding: 8px 0 8px 14px !important;
78 82 margin-left: 0;
79 83 }
80 84
  85 +
81 86 .data-source__submit-panel {
82 87 display: flex;
83 88 padding: 10px !important;
... ... @@ -85,23 +90,6 @@
85 90 flex-direction: column-reverse;
86 91 }
87 92
88   -.data-source__org--override {
89   - margin-bottom: 0px !important;
90   - display: flex !important;
91   -}
92   -
93   -.data-source__org--override .layui-form-label {
94   - width: 50px !important;
95   - padding: 9px 10px 9px 0;
96   - box-sizing: border-box;
97   -
98   -}
99   -
100   -.data-source__org--override .layui-input-block {
101   - margin-left: 0px !important;
102   - flex: auto !important;
103   -}
104   -
105 93 /* ============ event layer 事件弹窗 ====================== */
106 94 .event-layer__override .layui-layer-content {
107 95 overflow: visible !important;
... ... @@ -161,7 +149,7 @@
161 149 }
162 150
163 151 .override__table thead {
164   - width: calc(100% - 1rem) !important;
  152 + width: calc(100% - 14px) !important;
165 153 }
166 154
167 155 .override__table tbody {
... ... @@ -247,4 +235,227 @@
247 235
248 236 .override__radio-default input[type="radio"] + .override__radio-label:empty:before {
249 237 margin-right: 0;
250   -}
\ No newline at end of file
  238 +}
  239 +
  240 +/* ======= 图片上传 ====== */
  241 +
  242 +.variableImageTableSetImgEl {
  243 + width: 70px;
  244 + height: 70px;
  245 + position: relative;
  246 + border: 1px solid #f2f2f2;
  247 + color: #d3d2d2;
  248 + cursor: pointer;
  249 +}
  250 +
  251 +.variableImageTableSetImgEl .add__button {
  252 + font-size: 50px;
  253 + text-align: center;
  254 + width: 100%;
  255 + height: 70px;
  256 + line-height: 70px;
  257 + color: #d3d2d2;
  258 + display: none;
  259 +}
  260 +
  261 +.variableImageTableSetImgEl .img__delete {
  262 + position: absolute;
  263 + top: 0;
  264 + width: 8px;
  265 + height: 8px;
  266 + right: 0;
  267 + line-height: 8px;
  268 + cursor: pointer;
  269 +}
  270 +
  271 +.variableImageTableSetImgEl .img__delete:hover {
  272 + color: #5FB878;
  273 +}
  274 +
  275 +.variableImageTableSetImgEl img {
  276 + position: absolute;
  277 + width: 80%;
  278 + height: 80%;
  279 + top: 10%;
  280 + left: 10%;
  281 +}
  282 +
  283 +.variableImageTableSetImgEl img[src=''] {
  284 + opacity: 0;
  285 +}
  286 +
  287 +.variableImageTableSetImgEl img[src=''] ~ .add__button {
  288 + display: block;
  289 +}
  290 +
  291 +.variableImageTableSetImgEl img[src=''] ~ .img__delete {
  292 + display: none;
  293 +}
  294 +
  295 +.var-image__radio {
  296 + padding: 0 20px;
  297 +}
  298 +
  299 +#imgSelectContainerEl {
  300 + color: #666;
  301 + padding: 10px 20px;
  302 +}
  303 +
  304 +#var-image__upload--local {
  305 + width: 100px;
  306 + height: 100px;
  307 + border: 1px solid #F0F0F0;
  308 + margin-bottom: 20px;
  309 + cursor: pointer;
  310 +}
  311 +
  312 +.var-image__container--local {
  313 + padding: 10px 20px;
  314 +}
  315 +
  316 +.var-image__container--gallery {
  317 + display: flex;
  318 + padding: 10px 20px;
  319 +}
  320 +
  321 +#var-image__container-sidebar {
  322 + display: flex;
  323 + flex-direction: column;
  324 + flex: 0 0 150px;
  325 + height: 200px;
  326 + overflow-y: auto;
  327 + margin-right: 5px;
  328 + border: 1px solid #F2F2F2;
  329 +}
  330 +
  331 +.var-image__category {
  332 + height: 20px;
  333 + padding: 10px;
  334 + cursor: pointer;
  335 +}
  336 +
  337 +#var-image__container-content {
  338 + display: flex;
  339 + flex: 0 0 400px;
  340 + flex-wrap: wrap;
  341 + height: 200px;
  342 + overflow: auto;
  343 + justify-content: start;
  344 + align-content: flex-start;
  345 + border: 1px solid #F2F2F2;
  346 +}
  347 +
  348 +.var-image__img-item {
  349 + flex: 0 0 70px;
  350 + height: 70px;
  351 + box-sizing: border-box;
  352 + overflow: hidden;
  353 + margin: 10px;
  354 + padding: 5px;
  355 + cursor: pointer;
  356 +}
  357 +
  358 +.var-image__img-item img {
  359 + width: 100%;
  360 + height: 100%;
  361 + cursor: pointer;
  362 + pointer-events: none;
  363 +}
  364 +
  365 +.var-image__img-item:hover {
  366 + border: 2px solid #5FB878;
  367 +}
  368 +
  369 +.var-image__category--checked {
  370 + background-color: #F2F2F2;
  371 + color: #5FB878;
  372 +}
  373 +
  374 +.var-image__img-item--checked {
  375 + border: 2px solid #5FB878;
  376 +}
  377 +
  378 +#var-image__container--local {
  379 + position: relative;
  380 + cursor: pointer;
  381 + width: 100px;
  382 + height: 100px;
  383 +}
  384 +
  385 +#var-image__container--local .preview__img {
  386 + width: 100%;
  387 + height: 100%;
  388 +}
  389 +
  390 +#preview__img--preview {
  391 + position: absolute;
  392 + top: 10%;
  393 + left: 10%;
  394 + width: 80%;
  395 + height: 80%;
  396 +}
  397 +
  398 +
  399 +#var-image__container--local {
  400 + border: 1px solid #d3d2d2;
  401 +}
  402 +
  403 +#var-image__container--local .var-image__del-icon {
  404 + position: absolute;
  405 + top: 0;
  406 + right: 0;
  407 + width: 8px;
  408 + height: 8px;
  409 + line-height: 8px;
  410 + color: #D3D2D2;
  411 + display: block;
  412 + user-select: none;
  413 +}
  414 +
  415 +#var-image__container--local .var-image__del-icon:hover {
  416 + color: #5FB878;
  417 +}
  418 +
  419 +#var-image__container--local .var_image__add-icon {
  420 + position: absolute;
  421 + top: 0;
  422 + line-height: 100px;
  423 + width: 100%;
  424 + text-align: center;
  425 + font-size: 50px;
  426 + color: #d3d2d2;
  427 + display: none;
  428 +}
  429 +
  430 +#var-image__container--local img[src=""] + .var_image__add-icon {
  431 + display: block;
  432 +}
  433 +
  434 +#var-image__container--local img[src=""] ~ .var-image__del-icon {
  435 + display: none;
  436 +}
  437 +
  438 +#var-image__container--local img[src=""] {
  439 + opacity: 0;
  440 +}
  441 +
  442 +/* ===== 数据动效 */
  443 +.dynamic-effect__data-source-comp--override {
  444 + padding: 0;
  445 +}
  446 +
  447 +.dynamic-effect__data-source-comp--override .data-source__component-select > .layui-form-label {
  448 + float: left;
  449 + display: block;
  450 + padding: 9px 15px;
  451 + width: 80px;
  452 + font-weight: 400;
  453 + line-height: 20px;
  454 + text-align: right;
  455 + box-sizing: content-box;
  456 +}
  457 +
  458 +.dynamic-effect__data-source-comp--override .data-source__component-select > .layui-input-block {
  459 + margin-left: 110px;
  460 + min-height: 36px;
  461 +}
... ...