@flexem/fc-gui 3.0.0-alpha.16 → 3.0.0-alpha.160

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (567) hide show
  1. package/CHANGELOG.md +492 -69
  2. package/README.md +4 -4
  3. package/assets/img/alert.svg +18 -18
  4. package/assets/img/black_first_page.png +0 -0
  5. package/assets/img/black_last_page.png +0 -0
  6. package/assets/img/black_next_page.png +0 -0
  7. package/assets/img/black_previous_page.png +0 -0
  8. package/assets/img/first_page.svg +19 -19
  9. package/assets/img/last_page.svg +19 -19
  10. package/assets/img/next_page.svg +14 -14
  11. package/assets/img/previous_page.svg +14 -14
  12. package/bundles/@flexem/fc-gui.umd.js +25472 -20764
  13. package/bundles/@flexem/fc-gui.umd.js.map +1 -1
  14. package/bundles/@flexem/fc-gui.umd.min.js +5 -5
  15. package/bundles/@flexem/fc-gui.umd.min.js.map +1 -1
  16. package/communication/index.d.ts +1 -1
  17. package/communication/index.js +1 -1
  18. package/communication/variable/index.d.ts +5 -5
  19. package/communication/variable/index.js +4 -4
  20. package/communication/variable/variable-communicator.d.ts +16 -12
  21. package/communication/variable/variable-definition.d.ts +10 -10
  22. package/communication/variable/variable-definition.js +14 -14
  23. package/communication/variable/variable-state-enum.d.ts +8 -7
  24. package/communication/variable/variable-state-enum.js +9 -8
  25. package/communication/variable/variable-state-enum.metadata.json +1 -1
  26. package/communication/variable/variable-state.d.ts +6 -6
  27. package/communication/variable/variable-state.js +6 -6
  28. package/communication/variable/variable-value.d.ts +11 -8
  29. package/communication/variable/variable-value.js +11 -8
  30. package/communication/variable/variable-value.metadata.json +1 -1
  31. package/config/alarm/alarm.store.d.ts +6 -0
  32. package/config/alarm/alarm.store.js +0 -0
  33. package/config/alarm/alarm.store.metadata.json +1 -0
  34. package/config/alarm/get-alarms-args.d.ts +12 -0
  35. package/config/alarm/get-alarms-args.js +13 -0
  36. package/config/alarm/get-alarms-args.metadata.json +1 -0
  37. package/config/alarm/index.d.ts +2 -0
  38. package/config/alarm/index.js +1 -0
  39. package/config/alarm/index.metadata.json +1 -0
  40. package/config/config-store.d.ts +17 -15
  41. package/config/graph/graph-result.d.ts +9 -9
  42. package/config/graph/graph-result.js +13 -13
  43. package/config/graph/graph-store.d.ts +9 -9
  44. package/config/graph/graph-type.d.ts +4 -4
  45. package/config/graph/graph-type.js +5 -5
  46. package/config/graph/graph.d.ts +6 -6
  47. package/config/graph/graph.js +6 -6
  48. package/config/gui-feature-config.d.ts +3 -0
  49. package/config/gui-feature-config.js +3 -0
  50. package/config/gui-feature-config.metadata.json +1 -0
  51. package/config/history-data/get-history-data-args.d.ts +22 -22
  52. package/config/history-data/get-history-data-args.js +21 -21
  53. package/config/history-data/historical-curve.time-range.d.ts +18 -18
  54. package/config/history-data/historical-curve.time-range.js +19 -19
  55. package/config/history-data/history-data-value.d.ts +6 -6
  56. package/config/history-data/history-data-value.js +6 -6
  57. package/config/history-data/history-data.model.d.ts +7 -7
  58. package/config/history-data/history-data.model.js +7 -7
  59. package/config/history-data/history-data.store.d.ts +10 -10
  60. package/config/history-data/index.d.ts +4 -4
  61. package/config/history-data/index.js +3 -3
  62. package/config/image/image-store.d.ts +6 -6
  63. package/config/index.d.ts +12 -10
  64. package/config/index.js +8 -6
  65. package/config/index.metadata.json +1 -1
  66. package/config/variable/get-variable-name-args.d.ts +6 -6
  67. package/config/variable/get-variable-name-args.js +7 -7
  68. package/config/variable/index.d.ts +2 -2
  69. package/config/variable/index.js +1 -1
  70. package/config/variable/variable-store.d.ts +8 -7
  71. package/config/view/view-store.d.ts +20 -20
  72. package/config/view/view.model.d.ts +4 -4
  73. package/config/view/view.model.js +5 -5
  74. package/core/index.d.ts +1 -1
  75. package/core/index.js +1 -1
  76. package/core/stringifying-map.d.ts +11 -11
  77. package/core/stringifying-map.js +24 -24
  78. package/core/stringifying-set.d.ts +10 -10
  79. package/core/stringifying-set.js +21 -21
  80. package/elements/air-quality/air-quality-element.d.ts +31 -0
  81. package/elements/air-quality/air-quality-element.js +194 -0
  82. package/elements/air-quality/air-quality-element.metadata.json +1 -0
  83. package/elements/alarm/alarm-element.d.ts +69 -0
  84. package/elements/alarm/alarm-element.js +497 -0
  85. package/elements/alarm/alarm-element.metadata.json +1 -0
  86. package/elements/bar-graph-element.d.ts +29 -21
  87. package/elements/bar-graph-element.js +244 -114
  88. package/elements/bar-graph-element.metadata.json +1 -1
  89. package/elements/base/base-element.d.ts +11 -11
  90. package/elements/base/base-element.js +9 -9
  91. package/elements/base/conditional-control-element.d.ts +16 -16
  92. package/elements/base/conditional-control-element.js +87 -87
  93. package/elements/base/conditional-display-element.d.ts +24 -24
  94. package/elements/base/conditional-display-element.js +86 -86
  95. package/elements/base/conditional-dynamic-display-element.d.ts +26 -26
  96. package/elements/base/conditional-dynamic-display-element.js +142 -142
  97. package/elements/base/conditional-enable-element.d.ts +21 -21
  98. package/elements/base/conditional-enable-element.js +100 -100
  99. package/elements/base/index.d.ts +3 -3
  100. package/elements/base/index.js +3 -3
  101. package/elements/base/readable-element.d.ts +20 -15
  102. package/elements/base/readable-element.js +122 -58
  103. package/elements/base/readable-element.metadata.json +1 -1
  104. package/elements/base/state-control-element.d.ts +26 -24
  105. package/elements/base/state-control-element.js +196 -180
  106. package/elements/character-display/character-display-element.d.ts +35 -35
  107. package/elements/character-display/character-display-element.js +312 -311
  108. package/elements/character-display/character-display-element.metadata.json +1 -1
  109. package/elements/datetime-display/datetime-display-element.d.ts +22 -21
  110. package/elements/datetime-display/datetime-display-element.js +140 -132
  111. package/elements/datetime-display/datetime-display-element.metadata.json +1 -1
  112. package/elements/datetime-display/time-zone-select-json.d.ts +8 -0
  113. package/elements/datetime-display/time-zone-select-json.js +558 -0
  114. package/elements/historical-curve/historical-curve-element-status.d.ts +6 -6
  115. package/elements/historical-curve/historical-curve-element-status.js +7 -7
  116. package/elements/historical-curve/historical-curve.element.d.ts +96 -59
  117. package/elements/historical-curve/historical-curve.element.js +990 -364
  118. package/elements/historical-curve/historical-curve.element.metadata.json +1 -1
  119. package/elements/historical-curve/historical-curve.element.option.d.ts +13 -13
  120. package/elements/historical-curve/historical-curve.time-period.d.ts +4 -4
  121. package/elements/main-element.d.ts +46 -45
  122. package/elements/main-element.js +373 -307
  123. package/elements/main-element.metadata.json +1 -1
  124. package/elements/meter-element.d.ts +26 -20
  125. package/elements/meter-element.js +139 -70
  126. package/elements/meter-element.metadata.json +1 -1
  127. package/elements/numerical-display/numerical-display-element.d.ts +60 -41
  128. package/elements/numerical-display/numerical-display-element.js +476 -361
  129. package/elements/numerical-display/numerical-display-element.metadata.json +1 -1
  130. package/elements/per-view-variable-communicator.d.ts +20 -17
  131. package/elements/per-view-variable-communicator.js +59 -45
  132. package/elements/per-view-variable-communicator.metadata.json +1 -1
  133. package/elements/pipe/pipe-element.d.ts +19 -19
  134. package/elements/pipe/pipe-element.js +141 -141
  135. package/elements/ring-graph/ring-graph-element.d.ts +31 -19
  136. package/elements/ring-graph/ring-graph-element.js +250 -89
  137. package/elements/ring-graph/ring-graph-element.metadata.json +1 -1
  138. package/elements/scroll-alarm/scroll-alarm-element.d.ts +74 -0
  139. package/elements/scroll-alarm/scroll-alarm-element.js +761 -0
  140. package/elements/scroll-alarm/scroll-alarm-element.metadata.json +1 -0
  141. package/elements/shared/graph/graph-state-element.d.ts +28 -27
  142. package/elements/shared/graph/graph-state-element.js +139 -110
  143. package/elements/shared/graph/graph-state-element.metadata.json +1 -1
  144. package/elements/shared/math-utils.d.ts +2 -2
  145. package/elements/shared/math-utils.js +14 -14
  146. package/elements/shared/text/text-element.d.ts +22 -8
  147. package/elements/shared/text/text-element.js +106 -68
  148. package/elements/shared/text/text-element.metadata.json +1 -1
  149. package/elements/shared/text/text-state-element.d.ts +58 -23
  150. package/elements/shared/text/text-state-element.js +286 -136
  151. package/elements/shared/text/text-state-element.metadata.json +1 -1
  152. package/elements/shared/text/text-state.model.d.ts +5 -5
  153. package/elements/shared/text/text-utils.d.ts +5 -5
  154. package/elements/shared/text/text-utils.js +45 -45
  155. package/elements/static-elements/hyperlink-element.d.ts +40 -14
  156. package/elements/static-elements/hyperlink-element.js +197 -48
  157. package/elements/static-elements/hyperlink-element.metadata.json +1 -1
  158. package/elements/static-elements/image-element.d.ts +14 -14
  159. package/elements/static-elements/image-element.js +41 -41
  160. package/elements/static-elements/text-element.d.ts +42 -16
  161. package/elements/static-elements/text-element.js +205 -55
  162. package/elements/static-elements/text-element.metadata.json +1 -1
  163. package/elements/switch-indicator-light/bit-indicator-light-operator.d.ts +21 -20
  164. package/elements/switch-indicator-light/bit-indicator-light-operator.js +85 -78
  165. package/elements/switch-indicator-light/bit-indicator-light-operator.metadata.json +1 -1
  166. package/elements/switch-indicator-light/bit-switch-operator.d.ts +19 -19
  167. package/elements/switch-indicator-light/bit-switch-operator.js +107 -107
  168. package/elements/switch-indicator-light/current-stateId-value.d.ts +6 -6
  169. package/elements/switch-indicator-light/current-stateId-value.js +8 -8
  170. package/elements/switch-indicator-light/indicator-light-operator.d.ts +8 -8
  171. package/elements/switch-indicator-light/switch-indicator-light-element.d.ts +48 -39
  172. package/elements/switch-indicator-light/switch-indicator-light-element.js +302 -251
  173. package/elements/switch-indicator-light/switch-indicator-light-element.metadata.json +1 -1
  174. package/elements/switch-indicator-light/switch-operator.d.ts +6 -6
  175. package/elements/switch-indicator-light/word-indicator-light-operator.d.ts +19 -18
  176. package/elements/switch-indicator-light/word-indicator-light-operator.js +72 -65
  177. package/elements/switch-indicator-light/word-indicator-light-operator.metadata.json +1 -1
  178. package/elements/switch-indicator-light/word-switch-operator.d.ts +18 -18
  179. package/elements/switch-indicator-light/word-switch-operator.js +75 -75
  180. package/elements/table/table-element.d.ts +9 -9
  181. package/elements/table/table-element.js +6 -6
  182. package/elements/vector-graphics/ellipse-element.d.ts +9 -9
  183. package/elements/vector-graphics/ellipse-element.js +6 -6
  184. package/elements/vector-graphics/poly-line-element.d.ts +12 -12
  185. package/elements/vector-graphics/poly-line-element.js +19 -19
  186. package/elements/vector-graphics/polygon-element.d.ts +12 -12
  187. package/elements/vector-graphics/polygon-element.js +19 -19
  188. package/elements/vector-graphics/rectangle-element.d.ts +9 -9
  189. package/elements/vector-graphics/rectangle-element.js +6 -6
  190. package/elements/vector-graphics/sector-element.d.ts +9 -9
  191. package/elements/vector-graphics/sector-element.js +6 -6
  192. package/elements/vector-graphics/straight-line-element.d.ts +12 -12
  193. package/elements/vector-graphics/straight-line-element.js +19 -19
  194. package/elements/video/video-element.d.ts +37 -27
  195. package/elements/video/video-element.js +258 -160
  196. package/elements/video/video-element.metadata.json +1 -1
  197. package/elements/view-operation/view-operation.element.d.ts +62 -36
  198. package/elements/view-operation/view-operation.element.js +348 -194
  199. package/elements/view-operation/view-operation.element.metadata.json +1 -1
  200. package/elements/weather/weater-element.d.ts +38 -38
  201. package/elements/weather/weater-element.js +237 -238
  202. package/gui/gui-context.d.ts +33 -16
  203. package/gui/gui-host.d.ts +50 -50
  204. package/gui/gui-host.js +173 -173
  205. package/gui/gui-view.d.ts +45 -42
  206. package/gui/gui-view.js +265 -204
  207. package/gui/gui-view.metadata.json +1 -1
  208. package/gui/gui.component.d.ts +45 -42
  209. package/gui/gui.component.html +3 -3
  210. package/gui/gui.component.js +240 -227
  211. package/gui/gui.component.metadata.json +1 -1
  212. package/gui/interfaces/gui-options.d.ts +6 -6
  213. package/gui.module.d.ts +2 -2
  214. package/gui.module.js +78 -78
  215. package/localization/index.d.ts +2 -2
  216. package/localization/index.js +2 -2
  217. package/localization/localization.service.d.ts +62 -51
  218. package/localization/localization.service.js +61 -50
  219. package/localization/localization.service.metadata.json +1 -1
  220. package/localization/localization.service.zh_CN.d.ts +2 -2
  221. package/localization/localization.service.zh_CN.js +59 -48
  222. package/localization/localization.service.zh_CN.metadata.json +1 -1
  223. package/logger/console-logger.service.d.ts +13 -13
  224. package/logger/console-logger.service.js +38 -38
  225. package/logger/index.d.ts +2 -2
  226. package/logger/index.js +2 -2
  227. package/logger/logger.service.d.ts +14 -14
  228. package/logger/logger.service.js +2 -2
  229. package/modal/alert/alert-modal.component.d.ts +10 -10
  230. package/modal/alert/alert-modal.component.html +11 -11
  231. package/modal/alert/alert-modal.component.js +38 -38
  232. package/modal/alert/alert-modal.component.less +59 -59
  233. package/modal/confirm-operation/confirm-operation-modal.component.d.ts +10 -10
  234. package/modal/confirm-operation/confirm-operation-modal.component.html +16 -16
  235. package/modal/confirm-operation/confirm-operation-modal.component.js +41 -41
  236. package/modal/confirm-operation/confirm-operation-modal.component.less +58 -58
  237. package/modal/verify-password/verify-password-modal.component.d.ts +18 -18
  238. package/modal/verify-password/verify-password-modal.component.html +22 -22
  239. package/modal/verify-password/verify-password-modal.component.js +66 -66
  240. package/modal/verify-password/verify-password-modal.component.less +65 -65
  241. package/modal/write-character/write-character-modal-args.d.ts +7 -7
  242. package/modal/write-character/write-character-modal-args.js +8 -8
  243. package/modal/write-character/write-character-modal.component.d.ts +25 -25
  244. package/modal/write-character/write-character-modal.component.html +21 -21
  245. package/modal/write-character/write-character-modal.component.js +74 -74
  246. package/modal/write-character/write-character-modal.component.less +49 -49
  247. package/modal/write-value/write-value-modal-args.d.ts +16 -12
  248. package/modal/write-value/write-value-modal-args.js +14 -12
  249. package/modal/write-value/write-value-modal-args.metadata.json +1 -1
  250. package/modal/write-value/write-value-modal.component.d.ts +60 -54
  251. package/modal/write-value/write-value-modal.component.html +26 -21
  252. package/modal/write-value/write-value-modal.component.js +279 -204
  253. package/modal/write-value/write-value-modal.component.less +56 -56
  254. package/modal/write-value/write-value-modal.component.metadata.json +1 -1
  255. package/modal/write-value/write-value-model-result.d.ts +3 -3
  256. package/model/air-quality/air-quality-info.d.ts +23 -0
  257. package/model/air-quality/air-quality-info.js +4 -0
  258. package/model/air-quality/air-quality-info.metadata.json +1 -0
  259. package/model/air-quality/air-quality.model.d.ts +7 -0
  260. package/model/air-quality/air-quality.model.js +0 -0
  261. package/model/air-quality/air-quality.model.metadata.json +1 -0
  262. package/model/alarm/alarm.model.d.ts +13 -0
  263. package/model/alarm/alarm.model.js +0 -0
  264. package/model/alarm/alarm.model.metadata.json +1 -0
  265. package/model/bar-graph/FontStyleData.d.ts +7 -7
  266. package/model/bar-graph/bar-graph-direction.d.ts +6 -6
  267. package/model/bar-graph/bar-graph-direction.js +7 -7
  268. package/model/bar-graph/bar-graph.d.ts +26 -22
  269. package/model/base/base-element-model.d.ts +5 -5
  270. package/model/base/base-element-model.js +2 -2
  271. package/model/base/conditional-control-model.d.ts +6 -6
  272. package/model/base/conditional-display-model.d.ts +9 -9
  273. package/model/base/conditional-dynamic-display-model.d.ts +13 -13
  274. package/model/base/conditional-enable-model.d.ts +9 -9
  275. package/model/base/font-setting-model.d.ts +29 -8
  276. package/model/base/font-setting-model.metadata.json +1 -1
  277. package/model/base/index.d.ts +7 -7
  278. package/model/base/index.js +1 -1
  279. package/model/base/readable-model.d.ts +14 -10
  280. package/model/base/security-model.d.ts +6 -6
  281. package/model/character-display/character-display.d.ts +19 -19
  282. package/model/datetime-display/date-format-type.d.ts +5 -5
  283. package/model/datetime-display/date-format-type.js +6 -6
  284. package/model/datetime-display/datetime-display-settings.d.ts +17 -17
  285. package/model/datetime-display/datetime-display.d.ts +21 -20
  286. package/model/datetime-display/datetime-separator-type.d.ts +6 -6
  287. package/model/datetime-display/datetime-separator-type.js +7 -7
  288. package/model/datetime-display/time-format-type.d.ts +4 -4
  289. package/model/datetime-display/time-format-type.js +5 -5
  290. package/model/historical-curve/curve-type.d.ts +5 -5
  291. package/model/historical-curve/curve-type.js +6 -6
  292. package/model/historical-curve/historical-curve-axis-settings.d.ts +17 -6
  293. package/model/historical-curve/historical-curve-axis-settings.js +5 -0
  294. package/model/historical-curve/historical-curve-axis-settings.metadata.json +1 -1
  295. package/model/historical-curve/historical-curve-chanel.model.d.ts +22 -14
  296. package/model/historical-curve/historical-curve.data-settings.d.ts +9 -9
  297. package/model/historical-curve/historical-curve.display-settings.d.ts +19 -19
  298. package/model/historical-curve/historical-curve.model.d.ts +8 -8
  299. package/model/historical-curve/index.d.ts +4 -4
  300. package/model/hyperlink/hyperlink.model.d.ts +8 -8
  301. package/model/image/image-fill-type.d.ts +4 -4
  302. package/model/image/image-fill-type.js +5 -5
  303. package/model/image/image.d.ts +9 -9
  304. package/model/index.d.ts +15 -15
  305. package/model/index.js +8 -8
  306. package/model/meter/meter.d.ts +17 -13
  307. package/model/numerical-display/index.d.ts +8 -8
  308. package/model/numerical-display/index.js +2 -2
  309. package/model/numerical-display/numerical-display.d.ts +29 -29
  310. package/model/numerical-display/numerical-operation-settings.d.ts +6 -6
  311. package/model/numerical-display/numerical-operation-type.d.ts +4 -4
  312. package/model/numerical-display/numerical-operation-type.js +5 -5
  313. package/model/numerical-display/numerical-operation.d.ts +19 -11
  314. package/model/numerical-display/proportional-conversion.d.ts +4 -4
  315. package/model/numerical-display/type-settings.d.ts +6 -6
  316. package/model/numerical-display/zoom.d.ts +4 -4
  317. package/model/pipe/flow-direction-type.d.ts +4 -4
  318. package/model/pipe/flow-direction-type.js +5 -5
  319. package/model/pipe/index.d.ts +2 -2
  320. package/model/pipe/index.js +1 -1
  321. package/model/pipe/pipe.d.ts +17 -17
  322. package/model/poly-line/poly-line-model.d.ts +4 -4
  323. package/model/polygon/polygon-model.d.ts +4 -4
  324. package/model/ring-graph/ring-graph.model.d.ts +33 -25
  325. package/model/scroll-alarm/scroll-alarm.model.d.ts +21 -0
  326. package/model/scroll-alarm/scroll-alarm.model.js +0 -0
  327. package/model/scroll-alarm/scroll-alarm.model.metadata.json +1 -0
  328. package/model/settings/background/view-background-fill-type.d.ts +5 -5
  329. package/model/settings/background/view-background-fill-type.js +6 -6
  330. package/model/settings/background/view-background.model.d.ts +8 -8
  331. package/model/settings/index.d.ts +3 -3
  332. package/model/settings/index.js +2 -2
  333. package/model/settings/popup/view-popup-backdrop-type.d.ts +4 -4
  334. package/model/settings/popup/view-popup-backdrop-type.js +5 -5
  335. package/model/settings/popup/view-popup-location-type.d.ts +4 -4
  336. package/model/settings/popup/view-popup-location-type.js +5 -5
  337. package/model/settings/popup/view-popup-setting.model.d.ts +17 -17
  338. package/model/settings/popup/view-popup-setting.model.js +2 -2
  339. package/model/settings/view-settings.model.d.ts +6 -6
  340. package/model/shared/alarm/alarm-range.model.d.ts +6 -6
  341. package/model/shared/arc.model.d.ts +4 -4
  342. package/model/shared/binary.d.ts +7 -7
  343. package/model/shared/binary.js +37 -37
  344. package/model/shared/condition/bit-condition-item-observer.d.ts +14 -14
  345. package/model/shared/condition/bit-condition-item-observer.js +53 -53
  346. package/model/shared/condition/bit-condition-logic.d.ts +4 -4
  347. package/model/shared/condition/bit-condition-logic.js +5 -5
  348. package/model/shared/condition/bit-condition-model.d.ts +8 -8
  349. package/model/shared/condition/bit-condition.d.ts +4 -4
  350. package/model/shared/condition/condition-control-result-value.d.ts +5 -5
  351. package/model/shared/condition/condition-helper.d.ts +4 -4
  352. package/model/shared/condition/condition-helper.js +22 -22
  353. package/model/shared/condition/condition-item-model.d.ts +10 -10
  354. package/model/shared/condition/condition-item-observer.d.ts +12 -12
  355. package/model/shared/condition/condition-item-observer.js +14 -14
  356. package/model/shared/condition/condition-items-observer.d.ts +5 -5
  357. package/model/shared/condition/condition-items-result-observer.d.ts +16 -16
  358. package/model/shared/condition/condition-items-result-observer.js +87 -87
  359. package/model/shared/condition/condition-model.d.ts +6 -6
  360. package/model/shared/condition/condition-type.d.ts +4 -4
  361. package/model/shared/condition/condition-type.js +5 -5
  362. package/model/shared/condition/convert-condition-model.d.ts +5 -5
  363. package/model/shared/condition/index.d.ts +11 -11
  364. package/model/shared/condition/index.js +4 -4
  365. package/model/shared/condition/relation-condition-result-state.d.ts +6 -6
  366. package/model/shared/condition/relation-condition-result-state.js +8 -8
  367. package/model/shared/condition/relation-condition-result.d.ts +8 -8
  368. package/model/shared/condition/relation-condition-result.js +7 -7
  369. package/model/shared/condition/relation-type.d.ts +5 -5
  370. package/model/shared/condition/relation-type.js +6 -6
  371. package/model/shared/condition/relational-operator.d.ts +8 -8
  372. package/model/shared/condition/relational-operator.js +9 -9
  373. package/model/shared/condition/variable-value-logic-model.d.ts +11 -11
  374. package/model/shared/condition/variable-value-type.d.ts +4 -4
  375. package/model/shared/condition/variable-value-type.js +5 -5
  376. package/model/shared/condition/word-condition-item-observer.d.ts +21 -21
  377. package/model/shared/condition/word-condition-item-observer.js +165 -165
  378. package/model/shared/condition/word-condition-model.d.ts +8 -8
  379. package/model/shared/condition/word-condition.d.ts +5 -5
  380. package/model/shared/data-type/display-data-type.d.ts +5 -5
  381. package/model/shared/data-type/display-data-type.js +6 -6
  382. package/model/shared/data-type/fbox-data-type.d.ts +15 -15
  383. package/model/shared/data-type/fbox-data-type.js +16 -16
  384. package/model/shared/data-type/fcloud-data-Type.d.ts +8 -8
  385. package/model/shared/data-type/fcloud-data-Type.js +9 -9
  386. package/model/shared/dynamic-display/dynamic-behavior-type.d.ts +5 -5
  387. package/model/shared/dynamic-display/dynamic-behavior-type.js +6 -6
  388. package/model/shared/dynamic-display/dynamic-display-behavior-model.d.ts +5 -5
  389. package/model/shared/dynamic-display/dynamic-display-model.d.ts +10 -10
  390. package/model/shared/dynamic-display/dynamic-display-result-model.d.ts +7 -7
  391. package/model/shared/dynamic-display/dynamic-display-result-model.js +7 -7
  392. package/model/shared/dynamic-display/dynamic-display.d.ts +11 -11
  393. package/model/shared/dynamic-display/dynamic-display.js +35 -35
  394. package/model/shared/graph/custom-style.d.ts +14 -14
  395. package/model/shared/graph/graph-setting.d.ts +10 -10
  396. package/model/shared/index.d.ts +8 -8
  397. package/model/shared/index.js +3 -3
  398. package/model/shared/point.model.d.ts +4 -4
  399. package/model/shared/rotation/rotation-behavior-model.d.ts +4 -4
  400. package/model/shared/rotation/rotation-behavior.d.ts +9 -9
  401. package/model/shared/rotation/rotation-behavior.js +101 -101
  402. package/model/shared/rotation/rotation-direction-type.d.ts +4 -4
  403. package/model/shared/rotation/rotation-direction-type.js +5 -5
  404. package/model/shared/rotation/rotation-model.d.ts +14 -14
  405. package/model/shared/rotation/rotation-observer-model.d.ts +4 -4
  406. package/model/shared/rotation/rotation-observer.d.ts +11 -11
  407. package/model/shared/rotation/rotation-observer.js +28 -28
  408. package/model/shared/scale/scale-mark.model.d.ts +6 -6
  409. package/model/shared/scale/scale-model.d.ts +20 -20
  410. package/model/shared/size.model.d.ts +7 -7
  411. package/model/shared/size.model.js +12 -12
  412. package/model/shared/state/index.d.ts +1 -1
  413. package/model/shared/state/index.js +1 -1
  414. package/model/shared/state/state.d.ts +9 -8
  415. package/model/shared/state/state.js +10 -9
  416. package/model/shared/state/state.metadata.json +1 -1
  417. package/model/shared/text/font.d.ts +10 -10
  418. package/model/shared/text/index.d.ts +2 -2
  419. package/model/shared/text/text.d.ts +8 -5
  420. package/model/shared/translation/translation-behavior-model.d.ts +4 -4
  421. package/model/shared/translation/translation-behavior.d.ts +12 -12
  422. package/model/shared/translation/translation-behavior.js +63 -63
  423. package/model/shared/translation/translation-direction-type.d.ts +4 -4
  424. package/model/shared/translation/translation-direction-type.js +5 -5
  425. package/model/shared/translation/translation-model.d.ts +12 -12
  426. package/model/shared/translation/translation-observer-model.d.ts +4 -4
  427. package/model/shared/translation/translation-observer.d.ts +10 -10
  428. package/model/shared/translation/translation-observer.js +27 -27
  429. package/model/shared/variable/variable-identifier.model.d.ts +5 -5
  430. package/model/shared/variable/variable-name.model.d.ts +5 -5
  431. package/model/straight-line/straight-line-model.d.ts +4 -4
  432. package/model/switch-indicator-light/bit-indicator-light-settings.d.ts +8 -8
  433. package/model/switch-indicator-light/bit-switch-operation.d.ts +6 -6
  434. package/model/switch-indicator-light/bit-switch-operation.js +7 -7
  435. package/model/switch-indicator-light/bit-switch-settings.d.ts +11 -11
  436. package/model/switch-indicator-light/fault-flicker.d.ts +5 -5
  437. package/model/switch-indicator-light/flicker.d.ts +5 -5
  438. package/model/switch-indicator-light/flicker.js +6 -6
  439. package/model/switch-indicator-light/index.d.ts +14 -14
  440. package/model/switch-indicator-light/index.js +5 -5
  441. package/model/switch-indicator-light/indicator-light-fault-flicker.d.ts +5 -5
  442. package/model/switch-indicator-light/indicator-light-settings.d.ts +7 -7
  443. package/model/switch-indicator-light/indicator-light-type.d.ts +4 -4
  444. package/model/switch-indicator-light/indicator-light-type.js +5 -5
  445. package/model/switch-indicator-light/switch-indicator-light.d.ts +35 -33
  446. package/model/switch-indicator-light/switch-indicator-state.d.ts +8 -8
  447. package/model/switch-indicator-light/switch-settings.d.ts +7 -7
  448. package/model/switch-indicator-light/switch-type.d.ts +4 -4
  449. package/model/switch-indicator-light/switch-type.js +5 -5
  450. package/model/switch-indicator-light/word-indicator-light-settings.d.ts +6 -6
  451. package/model/switch-indicator-light/word-switch-operation.d.ts +5 -5
  452. package/model/switch-indicator-light/word-switch-operation.js +6 -6
  453. package/model/switch-indicator-light/word-switch-settings.d.ts +13 -13
  454. package/model/table/table-model.d.ts +9 -9
  455. package/model/text/text.model.d.ts +7 -7
  456. package/model/video/video.model.d.ts +8 -8
  457. package/model/view-operation/index.d.ts +2 -2
  458. package/model/view-operation/index.js +1 -1
  459. package/model/view-operation/view-operation-element.model.d.ts +25 -19
  460. package/model/view-operation/view-operation-type.d.ts +18 -18
  461. package/model/view-operation/view-operation-type.js +19 -19
  462. package/model/weather/weather-info.d.ts +11 -11
  463. package/model/weather/weather-info.js +2 -2
  464. package/model/weather/weather.model.d.ts +7 -7
  465. package/package.json +1 -1
  466. package/public_api.d.ts +14 -14
  467. package/public_api.js +12 -11
  468. package/remote/communication/variable/remote-variable-communicator.d.ts +59 -30
  469. package/remote/communication/variable/remote-variable-communicator.js +395 -215
  470. package/remote/communication/variable/remote-variable-communicator.metadata.json +1 -1
  471. package/remote/communication/variable/remote-variable-protocol.d.ts +18 -13
  472. package/remote/config/graph/get-released-graph-state-result.d.ts +6 -6
  473. package/remote/config/graph/get-released-graph-states.d.ts +4 -4
  474. package/remote/config/graph/graph-state-key.d.ts +6 -6
  475. package/remote/config/graph/graph-state-result.d.ts +5 -5
  476. package/remote/config/graph/graph-state.d.ts +4 -4
  477. package/remote/config/graph/remote-graph-protocol.d.ts +11 -11
  478. package/remote/config/graph/remote-graph-store.d.ts +16 -16
  479. package/remote/config/graph/remote-graph-store.js +101 -101
  480. package/remote/config/image/remote-image-protocol.d.ts +4 -4
  481. package/remote/config/image/remote-image-store.d.ts +8 -8
  482. package/remote/config/image/remote-image-store.js +19 -19
  483. package/remote/config/view/remote-view-protocol.d.ts +8 -8
  484. package/remote/config/view/remote-view-store.d.ts +13 -13
  485. package/remote/config/view/remote-view-store.js +39 -39
  486. package/remote/config/view/view-result.d.ts +4 -4
  487. package/remote/index.d.ts +14 -14
  488. package/remote/index.js +4 -4
  489. package/security/index.d.ts +1 -1
  490. package/security/security-checker.d.ts +3 -3
  491. package/service/index.d.ts +8 -4
  492. package/service/index.js +1 -0
  493. package/service/index.metadata.json +1 -1
  494. package/service/language.service.d.ts +37 -0
  495. package/service/language.service.js +0 -0
  496. package/service/language.service.metadata.json +1 -0
  497. package/service/operation-record/create-operation-record-args.d.ts +5 -5
  498. package/service/operation-record/index.d.ts +3 -3
  499. package/service/operation-record/operation-record.service.d.ts +4 -4
  500. package/service/operation-record/variable-option.model.d.ts +5 -5
  501. package/service/permission-checker.d.ts +3 -3
  502. package/service/released-variable/index.d.ts +1 -0
  503. package/service/released-variable/index.js +0 -0
  504. package/service/released-variable/index.metadata.json +1 -0
  505. package/service/released-variable/released-variable.service.d.ts +4 -0
  506. package/service/released-variable/released-variable.service.js +0 -0
  507. package/service/released-variable/released-variable.service.metadata.json +1 -0
  508. package/service/system-text-library.service.d.ts +77 -0
  509. package/service/system-text-library.service.js +29 -0
  510. package/service/system-text-library.service.metadata.json +1 -0
  511. package/service/text-library.service.d.ts +49 -0
  512. package/service/text-library.service.js +0 -0
  513. package/service/text-library.service.metadata.json +1 -0
  514. package/service/video/index.d.ts +2 -2
  515. package/service/video/video-url.d.ts +4 -4
  516. package/service/video/video.service.d.ts +4 -4
  517. package/service/weather.service.d.ts +4 -3
  518. package/settings/display-mode.d.ts +10 -10
  519. package/settings/display-mode.js +11 -11
  520. package/settings/global-settings.d.ts +7 -7
  521. package/settings/global-settings.js +13 -13
  522. package/settings/index.d.ts +3 -3
  523. package/settings/index.js +3 -3
  524. package/settings/view-resize-mode.d.ts +10 -10
  525. package/settings/view-resize-mode.js +11 -11
  526. package/shared/config-is-empty-error.d.ts +3 -3
  527. package/shared/config-is-empty-error.js +7 -7
  528. package/shared/disposable.d.ts +3 -3
  529. package/shared/graph-extended-style.d.ts +4 -4
  530. package/shared/gui-consts.d.ts +33 -30
  531. package/shared/gui-consts.js +33 -30
  532. package/shared/gui-consts.metadata.json +1 -1
  533. package/shared/index.d.ts +5 -5
  534. package/shared/index.js +3 -3
  535. package/shared/operation-helper.d.ts +6 -6
  536. package/shared/operation-helper.js +38 -38
  537. package/utils/access-permission.d.ts +5 -5
  538. package/utils/access-permission.js +6 -6
  539. package/utils/access-permission.service.d.ts +11 -11
  540. package/utils/access-permission.service.js +30 -30
  541. package/utils/auto-focus.directive.d.ts +6 -6
  542. package/utils/auto-focus.directive.js +27 -27
  543. package/utils/bs-modal-drag.directive.d.ts +7 -7
  544. package/utils/bs-modal-drag.directive.js +38 -38
  545. package/utils/data-type/data-type.service.d.ts +57 -57
  546. package/utils/data-type/data-type.service.js +155 -155
  547. package/utils/data-type/fbox-data-type.service.d.ts +54 -54
  548. package/utils/data-type/fbox-data-type.service.js +300 -260
  549. package/utils/data-type/fcloud-data-type.service.d.ts +55 -55
  550. package/utils/data-type/fcloud-data-type.service.js +203 -203
  551. package/utils/fraction-digit.service.d.ts +41 -41
  552. package/utils/fraction-digit.service.js +133 -133
  553. package/utils/graph-util.d.ts +5 -5
  554. package/utils/graph-util.js +19 -19
  555. package/utils/guid.d.ts +6 -6
  556. package/utils/guid.js +27 -27
  557. package/utils/index.d.ts +7 -7
  558. package/utils/index.js +7 -7
  559. package/utils/numerical-operation-type.d.ts +4 -4
  560. package/utils/numerical-operation-type.js +5 -5
  561. package/utils/numerical-operation.service.d.ts +17 -17
  562. package/utils/numerical-operation.service.js +201 -177
  563. package/utils/variable-util.d.ts +5 -5
  564. package/utils/variable-util.js +11 -11
  565. package/view/popup-view.service.d.ts +7 -7
  566. package/view/view.service.d.ts +6 -6
  567. package/view/view.service.js +20 -20
@@ -1,311 +1,312 @@
1
- import { GraphType } from '../../config';
2
- import { LOGGER_SERVICE_TOKEN } from '../../logger';
3
- import { AlertModalComponent } from '../../modal/alert/alert-modal.component';
4
- import { ConfirmOperationModalComponent } from '../../modal/confirm-operation/confirm-operation-modal.component';
5
- import { WriteCharacterModalArgs } from '../../modal/write-character/write-character-modal-args';
6
- import { WriteCharacterModalComponent } from '../../modal/write-character/write-character-modal.component';
7
- import { State } from '../../model';
8
- import { AccessPermissionService, GraphUtil } from '../../utils';
9
- import { ReadableElement } from '../base/readable-element';
10
- import { VerifyPasswordModalComponent } from '../../modal/verify-password/verify-password-modal.component';
11
- import { VariableUtil } from '../../utils/variable-util';
12
- import { TextElementModal } from '../shared/text/text-element';
13
- export class CharacterDisplayElement extends ReadableElement {
14
- constructor(element, injector, modalService, variableCommunicator, graphStore, permissionChecker, operationRecordService, securityChecker, variableStore, localization, signalRAppId) {
15
- super(element, permissionChecker, variableCommunicator, variableStore, localization, signalRAppId);
16
- this.modalService = modalService;
17
- this.graphStore = graphStore;
18
- this.operationRecordService = operationRecordService;
19
- this.securityChecker = securityChecker;
20
- this.displayValue = '';
21
- this.graphs = new Map();
22
- this.logger = injector.get(LOGGER_SERVICE_TOKEN);
23
- this.accessPermissionService = injector.get(AccessPermissionService);
24
- this.initElement();
25
- this.initClickEvent();
26
- }
27
- get readVariableName() {
28
- if (!this.model) {
29
- throw new Error('Model cannot be null');
30
- }
31
- if (null == this.model.version || this.model.version < 1) {
32
- return this.model.readVariableName;
33
- }
34
- else {
35
- const variable = this.model.readVariable;
36
- if (!variable) {
37
- return undefined;
38
- }
39
- return VariableUtil.getConvertedVariableName(this.variableStore, variable);
40
- }
41
- }
42
- get writeVariableName() {
43
- if (!this.model) {
44
- throw new Error('Model cannot be null');
45
- }
46
- if (null == this.model.version) {
47
- if (this.model.isSameVariable) {
48
- return this.model.readVariableName;
49
- }
50
- else {
51
- return this.model.writeVariableName;
52
- }
53
- }
54
- else {
55
- const variable = this.model.writeVariable;
56
- if (!variable) {
57
- return undefined;
58
- }
59
- return VariableUtil.getConvertedVariableName(this.variableStore, variable);
60
- }
61
- }
62
- updateVariableValue(value) {
63
- const valueText = this.getVariableValueText(value);
64
- // filter control character
65
- this.displayValue = valueText.replace(/[\u0000-\u001F]|[\u007F-\u00A0]/g, '');
66
- this.updateDisplayValue(this.displayValue);
67
- }
68
- changeStates() {
69
- super.changeStates();
70
- if (this.state === State.Normal || this.state === State.Disable) {
71
- this.updateDisplayValue(this.displayValue);
72
- }
73
- else {
74
- this.updateDisplayValue('');
75
- }
76
- }
77
- updateDisplayValue(text) {
78
- const textElement = this.$element.find('foreignObject').find('i');
79
- if (textElement) {
80
- textElement.text(text);
81
- }
82
- }
83
- getVariableValueText(value) {
84
- return this.characterDisplayText(this.model.isPassword, value);
85
- }
86
- characterDisplayText(isPassword, value) {
87
- let displayText = '';
88
- if (null == value || value.toString().trim().length <= 0) {
89
- return displayText;
90
- }
91
- displayText = value.toString();
92
- if (isPassword) {
93
- displayText = '*'.repeat(displayText.length);
94
- }
95
- return displayText;
96
- }
97
- initElement() {
98
- const { rootElement } = this;
99
- rootElement.selectAll('*').remove();
100
- const label = this.model.label;
101
- let width = null, height = null;
102
- if (this.model.size) {
103
- width = this.model.size.width;
104
- height = this.model.size.height;
105
- }
106
- if (!width || !height) {
107
- width = 60;
108
- height = 38;
109
- }
110
- rootElement.append('rect').attr('id', 'StateFrame').attr('width', width).attr('height', height).attr('fill', 'transparent');
111
- this.initVariableText(width, height);
112
- let translateX = '';
113
- if (this.model.showVariableText) {
114
- translateX = `translate(${width * 7 / 11},0)`;
115
- width = width * 4 / 11;
116
- }
117
- else {
118
- translateX = 'translate(0,0)';
119
- }
120
- if (this.model.useGraph) {
121
- rootElement.append('image')
122
- .attr('width', width)
123
- .attr('height', height)
124
- .attr('preserveAspectRatio', 'none')
125
- .attr('fill', 'none')
126
- .attr('crossorigin', 'anonymous')
127
- .attr('transform', translateX);
128
- }
129
- const font = label.font;
130
- if (!font) {
131
- throw new Error('font missing.');
132
- }
133
- const textElement = rootElement.append('foreignObject')
134
- .attr('width', width)
135
- .attr('height', height)
136
- .attr('fill', 'none')
137
- .attr('transform', translateX);
138
- const bodyElement = textElement.append('xhtml:div')
139
- .attr('class', 'svgBody')
140
- .html('<div></div>');
141
- const divElement = bodyElement.select('div')
142
- .style('height', height + 'px')
143
- .style('overflow', 'hidden')
144
- .style('display', 'flex')
145
- .style('align-items', 'center');
146
- const iElement = divElement.append('i');
147
- iElement.style('word-break', 'break-all')
148
- .style('text-align', font.textAlign)
149
- .style('alignment-baseline', 'central')
150
- .style('transform', `translate(${width / 2},${height / 2})`).text(label.content)
151
- .style('color', font.color)
152
- .style('font-size', font.fontSize)
153
- .style('font-style', 'normal')
154
- .style('width', '100%');
155
- if (font.fontStyle) {
156
- const fontStyle = font.fontStyle.split(' ');
157
- const isBold = $.inArray('bold', fontStyle);
158
- const italic = $.inArray('Italic', fontStyle);
159
- const fontFamily = fontStyle.pop();
160
- if (isBold >= 0) {
161
- iElement.style('font-weight', 'bold');
162
- }
163
- if (italic >= 0) {
164
- iElement.style('font-style', 'italic');
165
- }
166
- iElement.style('font-family', fontFamily ? fontFamily + ',msyh' : 'msyh');
167
- }
168
- if (font.isUnderline) {
169
- iElement.style('text-decoration', 'underline');
170
- }
171
- if (this.model.useGraph) {
172
- if (this.graphs.has(0)) {
173
- const graph = this.graphs.get(0);
174
- // 已经发出过图形请求,不再重复请求。
175
- if (graph == null) {
176
- return;
177
- }
178
- this.changeGraph(graph);
179
- }
180
- else {
181
- // 标记,防止重复请求图形。
182
- this.graphs.set(0, null);
183
- this.graphStore.getGraph(this.model.graphSetting.id, 0, GraphUtil.getExtendedStyle(this.model.graphSetting, 0))
184
- .subscribe(graphResult => {
185
- this.graphs.set(0, graphResult);
186
- this.changeGraph(graphResult);
187
- });
188
- }
189
- }
190
- }
191
- initVariableText(width, height) {
192
- if (!this.model.showVariableText) {
193
- return;
194
- }
195
- const font = {
196
- isUnderline: this.model.variableText.font.isUnderline,
197
- isBold: this.model.variableText.font.isBold,
198
- isItalic: this.model.variableText.font.isItalic,
199
- fontSize: this.model.variableText.font.fontSize,
200
- fontFamily: this.model.variableText.font.fontFamily,
201
- color: this.model.variableText.font.color,
202
- textAlign: this.model.variableText.font.textAlign
203
- };
204
- const textElement = new TextElementModal(this.model.variableText.content + ':', font, width * 7 / 11, height, true);
205
- this.$element.append(textElement.Element);
206
- }
207
- initClickEvent() {
208
- if (!this.writeVariableName || !this.accessPermissionService.canWrite(this.model.accessPermission)) {
209
- return;
210
- }
211
- this.rootElement.style('cursor', 'hand');
212
- setTimeout(() => {
213
- const elementBox = this.$element[0].getBBox();
214
- this.$element.find('rect').attr('width', elementBox.width);
215
- this.$element.find('rect').attr('height', elementBox.height);
216
- }, 0);
217
- this.$element.click(__ => {
218
- if (!this.isInitialized) {
219
- return;
220
- }
221
- if (!this.isEnable) {
222
- const message = !this.isGrantedPermission ? this.localization.permissiontip : this.localization.conditionIsNotMetTip;
223
- const modalRef = this.modalService.show(AlertModalComponent, { initialState: { alermMessage: message }, backdrop: 'static', class: 'gui-modal-dialog-position', animated: false });
224
- const onClosedSub = modalRef.content.onClosed.subscribe(() => {
225
- modalRef.hide();
226
- onClosedSub.unsubscribe();
227
- });
228
- return;
229
- }
230
- if (this.model.useSecurity) {
231
- const modalRef = this.modalService.show(ConfirmOperationModalComponent, {
232
- backdrop: 'static', class: 'gui-modal-dialog-position', animated: false
233
- });
234
- const onClosedSub = modalRef.content.onClosed.subscribe(result => {
235
- modalRef.hide();
236
- onClosedSub.unsubscribe();
237
- if (result) {
238
- this.checkElementPassword();
239
- }
240
- });
241
- }
242
- else {
243
- this.checkElementPassword();
244
- }
245
- });
246
- }
247
- checkElementPassword() {
248
- if (this.model.enablePassword) {
249
- const modalRef = this.modalService.show(VerifyPasswordModalComponent, { initialState: { securityChecker: this.securityChecker }, backdrop: 'static', class: 'gui-modal-dialog-position', animated: false });
250
- const onClosedSub = modalRef.content.onClosed.subscribe(result => {
251
- modalRef.hide();
252
- onClosedSub.unsubscribe();
253
- if (result) {
254
- this.doWriteCharacterValue();
255
- }
256
- });
257
- }
258
- else {
259
- this.doWriteCharacterValue();
260
- }
261
- }
262
- doWriteCharacterValue() {
263
- if (null == this.writeVariableName) {
264
- return;
265
- }
266
- const args = new WriteCharacterModalArgs(this.writeVariableName, this.model.isPassword, this.model.charCount, this.displayValue);
267
- const modalRef = this.modalService.show(WriteCharacterModalComponent, {
268
- initialState: { args: args }, backdrop: 'static', class: 'gui-modal-dialog-position', animated: false
269
- });
270
- const onClosedSub = modalRef.content.onClosed.subscribe(result => {
271
- modalRef.hide();
272
- onClosedSub.unsubscribe();
273
- if (result) {
274
- this.variableCommunicator.write(this.writeVariableName, result.value).subscribe();
275
- this.recordOperation(result.value);
276
- }
277
- });
278
- }
279
- recordOperation(newValue) {
280
- if (this.model.isRecordOperation || this.model.isRecordOperation === undefined) {
281
- this.operationRecordService.record({
282
- variableOptionModel: {
283
- variableName: this.writeVariableName,
284
- originValue: this.displayValue,
285
- newValue: newValue
286
- },
287
- operationDescription: this.model.operationDescription
288
- });
289
- }
290
- }
291
- changeGraph(graphResult) {
292
- if (!graphResult.failed) {
293
- const graph = graphResult.graph;
294
- switch (graph.graphType) {
295
- case GraphType.Image:
296
- this.rootElement.select('image').attr('xlink:href', graph.source);
297
- break;
298
- case GraphType.SVG:
299
- this.rootElement.select('image').attr('xlink:href', graph.source);
300
- break;
301
- default:
302
- this.logger.error(new Error(`Unknown graph ${graph.graphType}.`));
303
- this.rootElement.select('image').attr('xlink:href', null);
304
- break;
305
- }
306
- }
307
- else {
308
- this.rootElement.select('image').attr('xlink:href', null);
309
- }
310
- }
311
- }
1
+ import { GraphType } from '../../config';
2
+ import { GuiFeatureConfig } from '../../config';
3
+ import { LOGGER_SERVICE_TOKEN } from '../../logger';
4
+ import { AlertModalComponent } from '../../modal/alert/alert-modal.component';
5
+ import { ConfirmOperationModalComponent } from '../../modal/confirm-operation/confirm-operation-modal.component';
6
+ import { WriteCharacterModalArgs } from '../../modal/write-character/write-character-modal-args';
7
+ import { WriteCharacterModalComponent } from '../../modal/write-character/write-character-modal.component';
8
+ import { State } from '../../model';
9
+ import { AccessPermissionService, GraphUtil } from '../../utils';
10
+ import { ReadableElement } from '../base/readable-element';
11
+ import { VerifyPasswordModalComponent } from '../../modal/verify-password/verify-password-modal.component';
12
+ import { VariableUtil } from '../../utils/variable-util';
13
+ import { TextElementModal } from '../shared/text/text-element';
14
+ export class CharacterDisplayElement extends ReadableElement {
15
+ constructor(element, injector, modalService, variableCommunicator, graphStore, permissionChecker, operationRecordService, securityChecker, variableStore, localization, signalRAppId) {
16
+ super(element, permissionChecker, variableCommunicator, variableStore, localization, signalRAppId);
17
+ this.modalService = modalService;
18
+ this.graphStore = graphStore;
19
+ this.operationRecordService = operationRecordService;
20
+ this.securityChecker = securityChecker;
21
+ this.displayValue = '';
22
+ this.graphs = new Map();
23
+ this.logger = injector.get(LOGGER_SERVICE_TOKEN);
24
+ this.accessPermissionService = injector.get(AccessPermissionService);
25
+ this.initElement();
26
+ this.initClickEvent();
27
+ }
28
+ get readVariableName() {
29
+ if (!this.model) {
30
+ throw new Error('Model cannot be null');
31
+ }
32
+ if (null == this.model.version || this.model.version < 1) {
33
+ return this.model.readVariableName;
34
+ }
35
+ else {
36
+ const variable = this.model.readVariable;
37
+ if (!variable) {
38
+ return undefined;
39
+ }
40
+ return VariableUtil.getConvertedVariableName(this.variableStore, variable);
41
+ }
42
+ }
43
+ get writeVariableName() {
44
+ if (!this.model) {
45
+ throw new Error('Model cannot be null');
46
+ }
47
+ if (null == this.model.version) {
48
+ if (this.model.isSameVariable) {
49
+ return this.model.readVariableName;
50
+ }
51
+ else {
52
+ return this.model.writeVariableName;
53
+ }
54
+ }
55
+ else {
56
+ const variable = this.model.writeVariable;
57
+ if (!variable) {
58
+ return undefined;
59
+ }
60
+ return VariableUtil.getConvertedVariableName(this.variableStore, variable);
61
+ }
62
+ }
63
+ updateVariableValue(value) {
64
+ const valueText = this.getVariableValueText(value);
65
+ // filter control character
66
+ this.displayValue = valueText.replace(/[\u0000-\u001F]|[\u007F-\u00A0]/g, '');
67
+ this.updateDisplayValue(this.displayValue);
68
+ }
69
+ changeStates() {
70
+ super.changeStates();
71
+ if (this.state === State.Normal || this.state === State.Disable || (GuiFeatureConfig.isOfflineDisplayEnabled && this.state === State.Offline)) {
72
+ this.updateDisplayValue(this.displayValue);
73
+ }
74
+ else {
75
+ this.updateDisplayValue('');
76
+ }
77
+ }
78
+ updateDisplayValue(text) {
79
+ const textElement = this.$element.find('foreignObject').find('i');
80
+ if (textElement) {
81
+ textElement.text(text);
82
+ }
83
+ }
84
+ getVariableValueText(value) {
85
+ return this.characterDisplayText(this.model.isPassword, value);
86
+ }
87
+ characterDisplayText(isPassword, value) {
88
+ let displayText = '';
89
+ if (null == value || value.toString().trim().length <= 0) {
90
+ return displayText;
91
+ }
92
+ displayText = value.toString();
93
+ if (isPassword) {
94
+ displayText = '*'.repeat(displayText.length);
95
+ }
96
+ return displayText;
97
+ }
98
+ initElement() {
99
+ const { rootElement } = this;
100
+ rootElement.selectAll('*').remove();
101
+ const label = this.model.label;
102
+ let width = null, height = null;
103
+ if (this.model.size) {
104
+ width = this.model.size.width;
105
+ height = this.model.size.height;
106
+ }
107
+ if (!width || !height) {
108
+ width = 60;
109
+ height = 38;
110
+ }
111
+ rootElement.append('rect').attr('id', 'StateFrame').attr('width', width).attr('height', height).attr('fill', 'transparent');
112
+ this.initVariableText(width, height);
113
+ let translateX = '';
114
+ if (this.model.showVariableText) {
115
+ translateX = `translate(${width * 7 / 11},0)`;
116
+ width = width * 4 / 11;
117
+ }
118
+ else {
119
+ translateX = 'translate(0,0)';
120
+ }
121
+ if (this.model.useGraph) {
122
+ rootElement.append('image')
123
+ .attr('width', width)
124
+ .attr('height', height)
125
+ .attr('preserveAspectRatio', 'none')
126
+ .attr('fill', 'none')
127
+ .attr('crossorigin', 'anonymous')
128
+ .attr('transform', translateX);
129
+ }
130
+ const font = label.font;
131
+ if (!font) {
132
+ throw new Error('font missing.');
133
+ }
134
+ const textElement = rootElement.append('foreignObject')
135
+ .attr('width', width)
136
+ .attr('height', height)
137
+ .attr('fill', 'none')
138
+ .attr('transform', translateX);
139
+ const bodyElement = textElement.append('xhtml:div')
140
+ .attr('class', 'svgBody')
141
+ .html('<div></div>');
142
+ const divElement = bodyElement.select('div')
143
+ .style('height', height + 'px')
144
+ .style('overflow', 'hidden')
145
+ .style('display', 'flex')
146
+ .style('align-items', 'center');
147
+ const iElement = divElement.append('i');
148
+ iElement.style('word-break', 'break-all')
149
+ .style('text-align', font.textAlign)
150
+ .style('alignment-baseline', 'central')
151
+ .style('transform', `translate(${width / 2},${height / 2})`).text(label.content)
152
+ .style('color', font.color)
153
+ .style('font-size', font.fontSize)
154
+ .style('font-style', 'normal')
155
+ .style('width', '100%');
156
+ if (font.fontStyle) {
157
+ const fontStyle = font.fontStyle.split(' ');
158
+ const isBold = $.inArray('bold', fontStyle);
159
+ const italic = $.inArray('Italic', fontStyle);
160
+ const fontFamily = fontStyle.pop();
161
+ if (isBold >= 0) {
162
+ iElement.style('font-weight', 'bold');
163
+ }
164
+ if (italic >= 0) {
165
+ iElement.style('font-style', 'italic');
166
+ }
167
+ iElement.style('font-family', fontFamily ? fontFamily + ',msyh' : 'msyh');
168
+ }
169
+ if (font.isUnderline) {
170
+ iElement.style('text-decoration', 'underline');
171
+ }
172
+ if (this.model.useGraph) {
173
+ if (this.graphs.has(0)) {
174
+ const graph = this.graphs.get(0);
175
+ // 已经发出过图形请求,不再重复请求。
176
+ if (graph == null) {
177
+ return;
178
+ }
179
+ this.changeGraph(graph);
180
+ }
181
+ else {
182
+ // 标记,防止重复请求图形。
183
+ this.graphs.set(0, null);
184
+ this.graphStore.getGraph(this.model.graphSetting.id, 0, GraphUtil.getExtendedStyle(this.model.graphSetting, 0))
185
+ .subscribe(graphResult => {
186
+ this.graphs.set(0, graphResult);
187
+ this.changeGraph(graphResult);
188
+ });
189
+ }
190
+ }
191
+ }
192
+ initVariableText(width, height) {
193
+ if (!this.model.showVariableText) {
194
+ return;
195
+ }
196
+ const font = {
197
+ isUnderline: this.model.variableText.font.isUnderline,
198
+ isBold: this.model.variableText.font.isBold,
199
+ isItalic: this.model.variableText.font.isItalic,
200
+ fontSize: this.model.variableText.font.fontSize,
201
+ fontFamily: this.model.variableText.font.fontFamily,
202
+ color: this.model.variableText.font.color,
203
+ textAlign: this.model.variableText.font.textAlign
204
+ };
205
+ const textElement = new TextElementModal(this.model.variableText.content + ':', font, width * 7 / 11, height, true);
206
+ this.$element.append(textElement.Element);
207
+ }
208
+ initClickEvent() {
209
+ if (!this.writeVariableName || !this.accessPermissionService.canWrite(this.model.accessPermission)) {
210
+ return;
211
+ }
212
+ this.rootElement.style('cursor', 'hand');
213
+ setTimeout(() => {
214
+ const elementBox = this.$element[0].getBBox();
215
+ this.$element.find('rect').attr('width', elementBox.width);
216
+ this.$element.find('rect').attr('height', elementBox.height);
217
+ }, 0);
218
+ this.$element.click(__ => {
219
+ if (!this.isInitialized) {
220
+ return;
221
+ }
222
+ if (!this.isEnable) {
223
+ const message = !this.isGrantedPermission ? this.localization.permissiontip : this.localization.conditionIsNotMetTip;
224
+ const modalRef = this.modalService.show(AlertModalComponent, { initialState: { alermMessage: message }, backdrop: 'static', class: 'gui-modal-dialog-position', animated: false });
225
+ const onClosedSub = modalRef.content.onClosed.subscribe(() => {
226
+ modalRef.hide();
227
+ onClosedSub.unsubscribe();
228
+ });
229
+ return;
230
+ }
231
+ if (this.model.useSecurity) {
232
+ const modalRef = this.modalService.show(ConfirmOperationModalComponent, {
233
+ backdrop: 'static', class: 'gui-modal-dialog-position', animated: false
234
+ });
235
+ const onClosedSub = modalRef.content.onClosed.subscribe(result => {
236
+ modalRef.hide();
237
+ onClosedSub.unsubscribe();
238
+ if (result) {
239
+ this.checkElementPassword();
240
+ }
241
+ });
242
+ }
243
+ else {
244
+ this.checkElementPassword();
245
+ }
246
+ });
247
+ }
248
+ checkElementPassword() {
249
+ if (this.model.enablePassword) {
250
+ const modalRef = this.modalService.show(VerifyPasswordModalComponent, { initialState: { securityChecker: this.securityChecker }, backdrop: 'static', class: 'gui-modal-dialog-position', animated: false });
251
+ const onClosedSub = modalRef.content.onClosed.subscribe(result => {
252
+ modalRef.hide();
253
+ onClosedSub.unsubscribe();
254
+ if (result) {
255
+ this.doWriteCharacterValue();
256
+ }
257
+ });
258
+ }
259
+ else {
260
+ this.doWriteCharacterValue();
261
+ }
262
+ }
263
+ doWriteCharacterValue() {
264
+ if (null == this.writeVariableName) {
265
+ return;
266
+ }
267
+ const args = new WriteCharacterModalArgs(this.writeVariableName, this.model.isPassword, this.model.charCount, this.displayValue);
268
+ const modalRef = this.modalService.show(WriteCharacterModalComponent, {
269
+ initialState: { args: args }, backdrop: 'static', class: 'gui-modal-dialog-position', animated: false
270
+ });
271
+ const onClosedSub = modalRef.content.onClosed.subscribe(result => {
272
+ modalRef.hide();
273
+ onClosedSub.unsubscribe();
274
+ if (result) {
275
+ this.variableCommunicator.write(this.writeVariableName, result.value).subscribe();
276
+ this.recordOperation(result.value);
277
+ }
278
+ });
279
+ }
280
+ recordOperation(newValue) {
281
+ if (this.model.isRecordOperation || this.model.isRecordOperation === undefined) {
282
+ this.operationRecordService.record({
283
+ variableOptionModel: {
284
+ variableName: this.writeVariableName,
285
+ originValue: this.displayValue,
286
+ newValue: newValue
287
+ },
288
+ operationDescription: this.model.operationDescription
289
+ });
290
+ }
291
+ }
292
+ changeGraph(graphResult) {
293
+ if (!graphResult.failed) {
294
+ const graph = graphResult.graph;
295
+ switch (graph.graphType) {
296
+ case GraphType.Image:
297
+ this.rootElement.select('image').attr('xlink:href', graph.source);
298
+ break;
299
+ case GraphType.SVG:
300
+ this.rootElement.select('image').attr('xlink:href', graph.source);
301
+ break;
302
+ default:
303
+ this.logger.error(new Error(`Unknown graph ${graph.graphType}.`));
304
+ this.rootElement.select('image').attr('xlink:href', null);
305
+ break;
306
+ }
307
+ }
308
+ else {
309
+ this.rootElement.select('image').attr('xlink:href', null);
310
+ }
311
+ }
312
+ }