iobroker.vis2-materialdesign 0.1.0

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 (164) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +198 -0
  3. package/admin/admin.d.ts +93 -0
  4. package/admin/i18n/de.json +985 -0
  5. package/admin/i18n/en.json +985 -0
  6. package/admin/i18n/es.json +985 -0
  7. package/admin/i18n/fr.json +985 -0
  8. package/admin/i18n/it.json +985 -0
  9. package/admin/i18n/nl.json +985 -0
  10. package/admin/i18n/pl.json +985 -0
  11. package/admin/i18n/pt.json +985 -0
  12. package/admin/i18n/ru.json +985 -0
  13. package/admin/i18n/uk.json +985 -0
  14. package/admin/i18n/zh-cn.json +985 -0
  15. package/admin/img/info-big.png +0 -0
  16. package/admin/index_m.html +456 -0
  17. package/admin/index_m.js +1018 -0
  18. package/admin/lib/clipboard-polyfill.promise.js +16 -0
  19. package/admin/lib/colors.json +1304 -0
  20. package/admin/lib/colorsDark.json +1304 -0
  21. package/admin/lib/defaultcolors.json +22 -0
  22. package/admin/lib/defaultcolorsDark.json +22 -0
  23. package/admin/lib/defaultfontSizes.json +14 -0
  24. package/admin/lib/defaultfonts.json +14 -0
  25. package/admin/lib/fontSizes.json +380 -0
  26. package/admin/lib/fonts.json +386 -0
  27. package/admin/lib/monolith.min.css +1 -0
  28. package/admin/lib/pickr.min.js +5 -0
  29. package/admin/materialdesign-widgets-click-sound.mp3 +0 -0
  30. package/admin/style.css +31 -0
  31. package/admin/tsconfig.json +9 -0
  32. package/admin/vis-materialdesign.png +0 -0
  33. package/admin/vis-materialdesign_16_9.png +0 -0
  34. package/admin/words.js +11949 -0
  35. package/io-package.json +184 -0
  36. package/package.json +71 -0
  37. package/widgets/materialdesign/css/widgets.css +7174 -0
  38. package/widgets/materialdesign/css/widgets.min.css +1 -0
  39. package/widgets/materialdesign/img/IoBroker_Logo.png +0 -0
  40. package/widgets/materialdesign/img/bar_chart.png +0 -0
  41. package/widgets/materialdesign/img/calendar.png +0 -0
  42. package/widgets/materialdesign/img/pie_chart.png +0 -0
  43. package/widgets/materialdesign/img/prev_alerts.png +0 -0
  44. package/widgets/materialdesign/img/prev_autocomplete.png +0 -0
  45. package/widgets/materialdesign/img/prev_color_schemes.png +0 -0
  46. package/widgets/materialdesign/img/prev_dialog_view.png +0 -0
  47. package/widgets/materialdesign/img/prev_grid_views.png +0 -0
  48. package/widgets/materialdesign/img/prev_icon.png +0 -0
  49. package/widgets/materialdesign/img/prev_iconlist.png +0 -0
  50. package/widgets/materialdesign/img/prev_input.png +0 -0
  51. package/widgets/materialdesign/img/prev_json_chart.png +0 -0
  52. package/widgets/materialdesign/img/prev_line_history_chart.png +0 -0
  53. package/widgets/materialdesign/img/prev_list.png +0 -0
  54. package/widgets/materialdesign/img/prev_masonry_views.png +0 -0
  55. package/widgets/materialdesign/img/prev_select_bool.png +0 -0
  56. package/widgets/materialdesign/img/prev_select_value.png +0 -0
  57. package/widgets/materialdesign/img/prev_table.png +0 -0
  58. package/widgets/materialdesign/img/prev_top_app_bar_nav_drawer.png +0 -0
  59. package/widgets/materialdesign/img/prev_version.png +0 -0
  60. package/widgets/materialdesign/img/preview.jpg +0 -0
  61. package/widgets/materialdesign/js/materialdesign.js +56 -0
  62. package/widgets/materialdesign/js/widgets/materialdesign.00.helper.js +1229 -0
  63. package/widgets/materialdesign/js/widgets/materialdesign.00.vue.helper.js +710 -0
  64. package/widgets/materialdesign/js/widgets/materialdesign.alerts.js +177 -0
  65. package/widgets/materialdesign/js/widgets/materialdesign.autocomplete.js +263 -0
  66. package/widgets/materialdesign/js/widgets/materialdesign.button.js +1617 -0
  67. package/widgets/materialdesign/js/widgets/materialdesign.calendar.js +472 -0
  68. package/widgets/materialdesign/js/widgets/materialdesign.card.js +276 -0
  69. package/widgets/materialdesign/js/widgets/materialdesign.chart.bar.js +389 -0
  70. package/widgets/materialdesign/js/widgets/materialdesign.chart.helper.js +494 -0
  71. package/widgets/materialdesign/js/widgets/materialdesign.chart.json.js +621 -0
  72. package/widgets/materialdesign/js/widgets/materialdesign.chart.line.js +552 -0
  73. package/widgets/materialdesign/js/widgets/materialdesign.chart.pie.js +380 -0
  74. package/widgets/materialdesign/js/widgets/materialdesign.checkbox.js +281 -0
  75. package/widgets/materialdesign/js/widgets/materialdesign.colorschemes.js +129 -0
  76. package/widgets/materialdesign/js/widgets/materialdesign.dialog.js +384 -0
  77. package/widgets/materialdesign/js/widgets/materialdesign.iconList.js +873 -0
  78. package/widgets/materialdesign/js/widgets/materialdesign.list.js +503 -0
  79. package/widgets/materialdesign/js/widgets/materialdesign.materialdesignicons.js +7055 -0
  80. package/widgets/materialdesign/js/widgets/materialdesign.progress.js +413 -0
  81. package/widgets/materialdesign/js/widgets/materialdesign.roundslider.js +267 -0
  82. package/widgets/materialdesign/js/widgets/materialdesign.select.js +243 -0
  83. package/widgets/materialdesign/js/widgets/materialdesign.slider.js +363 -0
  84. package/widgets/materialdesign/js/widgets/materialdesign.switch.js +284 -0
  85. package/widgets/materialdesign/js/widgets/materialdesign.table.js +688 -0
  86. package/widgets/materialdesign/js/widgets/materialdesign.textfield.js +260 -0
  87. package/widgets/materialdesign/js/widgets/materialdesign.topappbarnav.js +747 -0
  88. package/widgets/materialdesign/js/widgets/materialdesign.value.js +369 -0
  89. package/widgets/materialdesign/js/widgets/materialdesign.views.js +827 -0
  90. package/widgets/materialdesign/js/widgets/materialdesign.viseditor.js +1088 -0
  91. package/widgets/materialdesign/js/widgets.min.js +1 -0
  92. package/widgets/materialdesign/lib/Chart.css +47 -0
  93. package/widgets/materialdesign/lib/Chart.js +16151 -0
  94. package/widgets/materialdesign/lib/VueTheMask.umd.js +556 -0
  95. package/widgets/materialdesign/lib/chartjs-plugin-datalabels.js +1385 -0
  96. package/widgets/materialdesign/lib/chroma.js +3225 -0
  97. package/widgets/materialdesign/lib/fonts/material-design-icons/materialdesignicons-webfont.ttf +0 -0
  98. package/widgets/materialdesign/lib/fonts/material-design-icons/materialdesignicons.css +27457 -0
  99. package/widgets/materialdesign/lib/fonts/material-design-icons/materialdesignicons.min.css +1 -0
  100. package/widgets/materialdesign/lib/fonts/material-icons/MaterialIcons-Regular.ttf +0 -0
  101. package/widgets/materialdesign/lib/fonts/material-icons/material-icons.css +31 -0
  102. package/widgets/materialdesign/lib/he.js +345 -0
  103. package/widgets/materialdesign/lib/jquery.initialize.js +156 -0
  104. package/widgets/materialdesign/lib/jquery.knob.js +820 -0
  105. package/widgets/materialdesign/lib/jquery.mobile-events.js +940 -0
  106. package/widgets/materialdesign/lib/material-components-web.css +10011 -0
  107. package/widgets/materialdesign/lib/material-components-web.js +22651 -0
  108. package/widgets/materialdesign/lib/math.js +41 -0
  109. package/widgets/materialdesign/lib/moment-duration-format.js +1737 -0
  110. package/widgets/materialdesign/lib/myUnderscore.js +1695 -0
  111. package/widgets/materialdesign/lib/raw/moment-with-locales.min.js +28 -0
  112. package/widgets/materialdesign/lib/raw/round-slider.js +271 -0
  113. package/widgets/materialdesign/lib/raw/sentry/bundle.min.js +3 -0
  114. package/widgets/materialdesign/lib/raw/sentry/captureconsole.min.js +2 -0
  115. package/widgets/materialdesign/lib/raw/sentry/dedupe.min.js +2 -0
  116. package/widgets/materialdesign/lib/svg-inject.js +697 -0
  117. package/widgets/materialdesign/lib/vue.js +11965 -0
  118. package/widgets/materialdesign/lib/vuetify.js +43729 -0
  119. package/widgets/materialdesign/lib.min.css +1 -0
  120. package/widgets/materialdesign/lib.min.js +6285 -0
  121. package/widgets/materialdesign.html +1063 -0
  122. package/widgets/vis2-materialdesign/assets/MaterialDesignButtonAdition-BOasvewn.js +1 -0
  123. package/widgets/vis2-materialdesign/assets/MaterialDesignButtonAditionVertical-CfxLrjtz.js +1 -0
  124. package/widgets/vis2-materialdesign/assets/MaterialDesignButtonLink-DFOHalVe.js +1 -0
  125. package/widgets/vis2-materialdesign/assets/MaterialDesignButtonLinkVertical-bLBc2Zj6.js +1 -0
  126. package/widgets/vis2-materialdesign/assets/MaterialDesignButtonNavigation-loocTeHA.js +1 -0
  127. package/widgets/vis2-materialdesign/assets/MaterialDesignButtonNavigationVertical-wKivh3mz.js +1 -0
  128. package/widgets/vis2-materialdesign/assets/MaterialDesignButtonState-DyuzNIZY.js +1 -0
  129. package/widgets/vis2-materialdesign/assets/MaterialDesignButtonStateMulti-D9YVumU3.js +1 -0
  130. package/widgets/vis2-materialdesign/assets/MaterialDesignButtonStateMultiVertical-J7SUuXNA.js +1 -0
  131. package/widgets/vis2-materialdesign/assets/MaterialDesignButtonStateVertical-EhVri-Bj.js +1 -0
  132. package/widgets/vis2-materialdesign/assets/MaterialDesignButtonToggle-CLxaT9SA.js +1 -0
  133. package/widgets/vis2-materialdesign/assets/MaterialDesignButtonToggleVertical-4zI4T-cI.js +1 -0
  134. package/widgets/vis2-materialdesign/assets/MaterialDesignButtons-BHDA55zY.js +1 -0
  135. package/widgets/vis2-materialdesign/assets/MaterialDesignCheckbox-Dwl43BB6.js +1 -0
  136. package/widgets/vis2-materialdesign/assets/MaterialDesignIcon-07Jl1QSv.js +1 -0
  137. package/widgets/vis2-materialdesign/assets/MaterialDesignIconButtonAdition-DkyLUAuu.js +1 -0
  138. package/widgets/vis2-materialdesign/assets/MaterialDesignIconButtonLink-CFh_41FT.js +1 -0
  139. package/widgets/vis2-materialdesign/assets/MaterialDesignIconButtonNavigation-CLvhcORZ.js +1 -0
  140. package/widgets/vis2-materialdesign/assets/MaterialDesignIconButtonSlider-TfUJKNib.js +1 -0
  141. package/widgets/vis2-materialdesign/assets/MaterialDesignIconButtonState-Con_l2iN.js +1 -0
  142. package/widgets/vis2-materialdesign/assets/MaterialDesignIconButtonStateMulti-DuakGd7h.js +1 -0
  143. package/widgets/vis2-materialdesign/assets/MaterialDesignIconButtonToggle-B3Yxo-Ii.js +1 -0
  144. package/widgets/vis2-materialdesign/assets/MaterialDesignSwitch-BPSYRrDe.js +1 -0
  145. package/widgets/vis2-materialdesign/assets/MaterialDesignValue-D5sJ-iyi.js +1 -0
  146. package/widgets/vis2-materialdesign/assets/_virtual_mf-localSharedImportMap___mfe_internal__vis2MaterialDesignWidgets-BFI0756z.js +1 -0
  147. package/widgets/vis2-materialdesign/assets/_virtual_mf___mfe_internal__vis2MaterialDesignWidgets__loadShare__react__loadShare__.js-4V-ZaKyJ.js +1 -0
  148. package/widgets/vis2-materialdesign/assets/_virtual_mf___mfe_internal__vis2MaterialDesignWidgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-Eu2aWCKd.js +1 -0
  149. package/widgets/vis2-materialdesign/assets/_virtual_mf___mfe_internal__vis2MaterialDesignWidgets__loadShare__react_mf_2_dom__loadShare__.js-D3wyrTEe.js +8 -0
  150. package/widgets/vis2-materialdesign/assets/hostInit-CP4jqDxy.js +1 -0
  151. package/widgets/vis2-materialdesign/assets/index-jMDUG1V1.js +1 -0
  152. package/widgets/vis2-materialdesign/assets/mf-entry-bootstrap-0-5bdbe7bd.js +35 -0
  153. package/widgets/vis2-materialdesign/assets/rolldown-runtime-CNC7AqOf.js +1 -0
  154. package/widgets/vis2-materialdesign/assets/translations-CYT3A7CQ.js +1 -0
  155. package/widgets/vis2-materialdesign/assets/virtualExposes-BFTZrXtp.js +1 -0
  156. package/widgets/vis2-materialdesign/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__vis2MaterialDesignWidgets__customWidgets_js-BOvf1QCd.js +4 -0
  157. package/widgets/vis2-materialdesign/assets/virtual_mf-exposes-ssr___mfe_internal__vis2MaterialDesignWidgets__customWidgets_js-vY7qHvFF.js +2 -0
  158. package/widgets/vis2-materialdesign/assets/virtual_mf-exposes___mfe_internal__vis2MaterialDesignWidgets__customWidgets_js-C28iDRsy.js +2 -0
  159. package/widgets/vis2-materialdesign/assets/vite-preload-helper-DuG8C5Si.js +1 -0
  160. package/widgets/vis2-materialdesign/assets/widgetUtils-D_-xivaB.js +1 -0
  161. package/widgets/vis2-materialdesign/customWidgets.js +1 -0
  162. package/widgets/vis2-materialdesign/customWidgets.ssr.js +1 -0
  163. package/widgets/vis2-materialdesign/materialdesign-widgets-click-sound.mp3 +0 -0
  164. package/widgets/vis2-materialdesign/mf-stats.json +1 -0
@@ -0,0 +1,1088 @@
1
+ /*
2
+ ioBroker.vis vis-materialdesign Widget-Set
3
+
4
+ Copyright 2019 Scrounger scrounger@gmx.net
5
+ */
6
+ "use strict";
7
+
8
+ let myMdwMaterialDesignIconsList = [];
9
+
10
+ vis.binds.materialdesign.viseditor = {
11
+ themeChangeHandler: async function () {
12
+ let oldDarkTheme = await myMdwHelper.getStateAsync('vis-materialdesign.0.colors.darkTheme');
13
+ let oldLastChange = await myMdwHelper.getStateAsync('vis-materialdesign.0.lastchange');
14
+ let lastTap = new Date().getTime();
15
+
16
+ // $('#panel_body').on('tapstart', async function () {
17
+ $('#vis_container, .tab_attr.ui-widget-content').on('mouseenter', async function() {
18
+ if (new Date().getTime() - lastTap > 2000) {
19
+ let darkTheme = await myMdwHelper.getStateAsync('vis-materialdesign.0.colors.darkTheme');
20
+ let lastChange = await myMdwHelper.getStateAsync('vis-materialdesign.0.lastchange');
21
+
22
+ if (oldDarkTheme.val !== darkTheme.val || oldLastChange.lc !== lastChange.lc) {
23
+ myMdwHelper.bindCssThemeVariables();
24
+ oldDarkTheme = darkTheme;
25
+ oldLastChange = lastChange;
26
+ }
27
+
28
+ lastTap = new Date().getTime();
29
+ }
30
+ });
31
+ },
32
+ manualLink: function (widAttr, data) {
33
+ try {
34
+ let url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#iobrokervis-materialdesign';
35
+
36
+ if (data) {
37
+
38
+ if (data[1] === 'materialdesignicon') {
39
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#material-design-icons-and-images'
40
+ }
41
+
42
+ if (data[1] === 'value') {
43
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#value'
44
+ }
45
+
46
+ if (data[1] === vis.binds.materialdesign.button.types.navigation.default) {
47
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#navigation'
48
+ }
49
+
50
+ if (data[1] === vis.binds.materialdesign.button.types.link.default) {
51
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#link'
52
+ }
53
+
54
+ if (data[1] === vis.binds.materialdesign.button.types.state.default) {
55
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#state'
56
+ }
57
+
58
+ if (data[1] === vis.binds.materialdesign.button.types.multiState.default) {
59
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#multi-state'
60
+ }
61
+
62
+ if (data[1] === vis.binds.materialdesign.button.types.addition.default) {
63
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#addition'
64
+ }
65
+
66
+ if (data[1] === vis.binds.materialdesign.button.types.toggle.default) {
67
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#toggle'
68
+ }
69
+
70
+ if (data[1] === vis.binds.materialdesign.button.types.navigation.vertical) {
71
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#navigation-1'
72
+ }
73
+
74
+ if (data[1] === vis.binds.materialdesign.button.types.link.vertical) {
75
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#link-1'
76
+ }
77
+
78
+ if (data[1] === vis.binds.materialdesign.button.types.state.vertical) {
79
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#state-1'
80
+ }
81
+
82
+ if (data[1] === vis.binds.materialdesign.button.types.multiState.vertical) {
83
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#multi-state-1'
84
+ }
85
+
86
+ if (data[1] === vis.binds.materialdesign.button.types.addition.vertical) {
87
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#addition-1'
88
+ }
89
+
90
+ if (data[1] === vis.binds.materialdesign.button.types.toggle.vertical) {
91
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#toggle-1'
92
+ }
93
+
94
+ if (data[1] === vis.binds.materialdesign.button.types.navigation.icon) {
95
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#navigation-2'
96
+ }
97
+
98
+ if (data[1] === vis.binds.materialdesign.button.types.link.icon) {
99
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#link-2'
100
+ }
101
+
102
+ if (data[1] === vis.binds.materialdesign.button.types.state.icon) {
103
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#state-2'
104
+ }
105
+
106
+ if (data[1] === vis.binds.materialdesign.button.types.multiState.icon) {
107
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#multi-state-2'
108
+ }
109
+
110
+ if (data[1] === vis.binds.materialdesign.button.types.addition.icon) {
111
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#addition-2'
112
+ }
113
+
114
+ if (data[1] === vis.binds.materialdesign.button.types.toggle.icon) {
115
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#toggle-2'
116
+ }
117
+
118
+ if (data[1] === 'card') {
119
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#card'
120
+ }
121
+
122
+ if (data[1] === 'topAppBar') {
123
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#top-app-bar'
124
+ }
125
+
126
+ if (data[1] === 'topAppBarSubMenu') {
127
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#submenu'
128
+ }
129
+
130
+ if (data[1] === 'barChart') {
131
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#bar-chart'
132
+ }
133
+
134
+ if (data[1] === 'pieChart') {
135
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#pie-chart'
136
+ }
137
+
138
+ if (data[1] === 'lineHistoryChart') {
139
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#line-history-chart'
140
+ }
141
+
142
+ if (data[1] === 'jsonChart') {
143
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#json-chart'
144
+ }
145
+
146
+ if (data[1] === 'list') {
147
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#list'
148
+ }
149
+
150
+ if (data[1] === 'iconList') {
151
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#iconList'
152
+ }
153
+
154
+ if (data[1] === 'progress') {
155
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#progress'
156
+ }
157
+
158
+ if (data[1] === 'progressCircular') {
159
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#progress-circular'
160
+ }
161
+
162
+ if (data[1] === 'slider') {
163
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#slider'
164
+ }
165
+
166
+ if (data[1] === 'sliderRound') {
167
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#slider-round'
168
+ }
169
+
170
+ if (data[1] === 'switch') {
171
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#switch'
172
+ }
173
+
174
+ if (data[1] === 'checkbox') {
175
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#checkbox'
176
+ }
177
+
178
+ if (data[1] === 'input') {
179
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#text-input'
180
+ }
181
+
182
+ if (data[1] === 'select') {
183
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#select'
184
+ }
185
+
186
+ if (data[1] === 'autocomplete') {
187
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#autocomplete'
188
+ }
189
+
190
+ if (data[1] === 'table') {
191
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#table'
192
+ }
193
+
194
+ if (data[1] === 'columnViews') {
195
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#column-views'
196
+ }
197
+
198
+ if (data[1] === 'alerts') {
199
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#alerts'
200
+ }
201
+
202
+ if (data[1] === 'masonry') {
203
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#masonry-views'
204
+ }
205
+
206
+ if (data[1] === 'grid') {
207
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#grid-views'
208
+ }
209
+
210
+ if (data[1] === 'calendar') {
211
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#calendar'
212
+ }
213
+
214
+ if (data[1] === 'dialogView') {
215
+ url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#dialog'
216
+ }
217
+ }
218
+
219
+ return { input: `<a target="_blank" href="${url}">${_('readme')}</a>` }
220
+
221
+ } catch (ex) {
222
+ console.error(`[manualLink]: error: ${ex.message}, stack: ${ex.stack}`);
223
+ }
224
+ },
225
+ questionsAndAnswers: function (widAttr, data) {
226
+ let url = 'https://github.com/Scrounger/ioBroker.vis-materialdesign#questions-and-answers-about-the-widgets';
227
+
228
+ if (vis.language === 'de') {
229
+ if (data[1] === 'alerts') {
230
+ url = 'https://forum.iobroker.net/topic/29663/material-design-widgets-alerts-widget'
231
+ }
232
+
233
+ if (data[1] === 'card') {
234
+ url = 'https://forum.iobroker.net/topic/42176/material-design-widgets-html-card-widget'
235
+ }
236
+
237
+ if (data[1] === 'buttons') {
238
+ url = 'https://forum.iobroker.net/topic/29664/material-design-widgets-buttons-widget'
239
+ }
240
+
241
+ if (data[1] === 'calendar') {
242
+ url = 'https://forum.iobroker.net/topic/29600/material-design-widgets-calendar-widget'
243
+ }
244
+
245
+ if (data[1] === 'checkboxSwitch') {
246
+ url = 'https://forum.iobroker.net/topic/29667/material-design-widgets-checkbox-switch-widget'
247
+ }
248
+
249
+ if (data[1] === 'input') {
250
+ url = 'https://forum.iobroker.net/topic/29666/material-design-widgets-input-select-autocompl'
251
+ }
252
+
253
+ if (data[1] === 'value') {
254
+ url = 'https://forum.iobroker.net/topic/42181/material-design-widgets-value-widget'
255
+ }
256
+
257
+ if (data[1] === 'barChart') {
258
+ url = 'https://forum.iobroker.net/topic/42177/material-design-widgets-bar-chart-widget'
259
+ }
260
+
261
+ if (data[1] === 'pieChart') {
262
+ url = 'https://forum.iobroker.net/topic/42178/material-design-widgets-pie-chart-widget'
263
+ }
264
+
265
+ if (data[1] === 'lineHistoryChart') {
266
+ url = 'https://forum.iobroker.net/topic/29662/material-design-widgets-line-history-chart-widget'
267
+ }
268
+
269
+ if (data[1] === 'list') {
270
+ url = 'https://forum.iobroker.net/topic/29665/material-design-widgets-list-widget'
271
+ }
272
+
273
+ if (data[1] === 'iconList') {
274
+ url = 'https://forum.iobroker.net/topic/30331/material-design-widgets-iconlist-widget'
275
+ }
276
+
277
+ if (data[1] === 'progress') {
278
+ url = 'https://forum.iobroker.net/topic/33623/material-design-widgets-progress-widget'
279
+ }
280
+
281
+ if (data[1] === 'masonry') {
282
+ url = 'https://forum.iobroker.net/topic/29621/material-design-widgets-masonry-views-widget'
283
+ }
284
+
285
+ if (data[1] === 'slider') {
286
+ url = 'https://forum.iobroker.net/topic/29661/material-design-widgets-slider-widget'
287
+ }
288
+
289
+ if (data[1] === 'table') {
290
+ url = 'https://forum.iobroker.net/topic/29658/material-design-widgets-table-widget'
291
+ }
292
+
293
+ if (data[1] === 'topAppBar') {
294
+ url = 'https://forum.iobroker.net/topic/29660/material-design-widgets-top-app-bar-widget'
295
+ }
296
+
297
+ if (data[1] === 'grid') {
298
+ url = 'https://forum.iobroker.net/topic/29916/material-design-widgets-grid-views-widget'
299
+ }
300
+
301
+ if (data[1] === 'dialogView') {
302
+ url = 'https://forum.iobroker.net/topic/31870/material-design-widgets-dialog-view-widget'
303
+ }
304
+
305
+ if (data[1] === 'jsonChart') {
306
+ url = 'https://forum.iobroker.net/topic/31871/material-design-widgets-json-chart-widget'
307
+ }
308
+
309
+ if (data[1] === 'progress') {
310
+ url = 'https://forum.iobroker.net/topic/33623/material-design-widgets-progress-widget'
311
+ }
312
+ }
313
+
314
+ return { input: `<a target="_blank" href="${url}">${_('readme')}</a>` }
315
+ },
316
+ bmc: function (widAttr) {
317
+ return { input: `<a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VWAXSTS634G88&source=url">${_('buymeacoffee')}</a>` }
318
+ },
319
+ onlineExample: function (widAttr) {
320
+ return { input: `<a target="_blank" href="https://github.com/Scrounger/ioBroker.vis-materialdesign#online-example-project">${_('linkOnlineExampleProject')}</a>` }
321
+ },
322
+ visibilityCondition: function (widAttr) {
323
+ return vis.editSelect(widAttr, ['==', '!=', '<=', '>=', '<', '>', 'consist', 'not consist', 'exist', 'not exist'], true);
324
+ },
325
+ imagesAndMaterialDesignIcons: function (widAttr) {
326
+ try {
327
+ var that = vis;
328
+
329
+ let line = {
330
+ // autocomplete for material icons
331
+ input: '<input type="text" id="inspect_' + widAttr + '" class="vis-edit-textbox"/>',
332
+ init: function (_wid_attr, data) {
333
+ $(this).autocomplete({
334
+ minLength: 0,
335
+ source: function (request, response) {
336
+
337
+ if (vis.editMode && myMdwMaterialDesignIconsList.length === 0) {
338
+ myMdwMaterialDesignIconsList = vis.binds.materialdesign.materialdesignicons.getList();
339
+ }
340
+
341
+ var _data = $.grep(myMdwMaterialDesignIconsList, function (value) {
342
+ return value.toLowerCase().includes(request.term.toLowerCase());
343
+ });
344
+
345
+ response(_data);
346
+ },
347
+ select: function (event, ui) {
348
+ $(this).val(ui.item.value);
349
+ $(this).trigger('change', ui.item.value);
350
+ }
351
+ }).focus(function () {
352
+ // Show dropdown menu
353
+ $(this).autocomplete('search', '');
354
+ }).autocomplete('instance')._renderItem = function (ul, item) {
355
+
356
+ return $('<li>')
357
+ .append(`
358
+ <div style="display: flex; align-items: center;">
359
+ <span class="mdi mdi-${item.label}" style="width: 40px; font-size: 24px; color: #44739e;"></span>
360
+ <label>${item.label}</label>
361
+ </div>
362
+ `)
363
+ .appendTo(ul);
364
+ };
365
+ }
366
+ };
367
+
368
+ if ($.fm) {
369
+ // button for image dialog
370
+ line.button = {
371
+ icon: 'ui-icon-note',
372
+ text: false,
373
+ title: _('Select image'),
374
+ click: function (/*event*/) {
375
+ var wdata = $(this).data('wdata');
376
+ var defPath = ('/' + (that.conn.namespace ? that.conn.namespace + '/' : '') + that.projectPrefix + 'img/');
377
+
378
+ var allowedFileExtensions = ['gif', 'png', 'bmp', 'jpg', 'jpeg', 'tif', 'svg'];
379
+
380
+ var current = that.widgets[wdata.widgets[0]].data[wdata.attr];
381
+ //workaround, that some widgets calling direct the img/picure.png without /vis/
382
+ if (allowedFileExtensions.some(function (v) { return current.indexOf(`.${v}`) >= 0; })) {
383
+ if (current && current.substring(0, 4) === 'img/') {
384
+ current = '/vis/' + current;
385
+ }
386
+ } else {
387
+ current = defPath;
388
+ }
389
+
390
+ $.fm({
391
+ lang: that.language,
392
+ defaultPath: defPath,
393
+ path: current || defPath,
394
+ uploadDir: '/' + (that.conn.namespace ? that.conn.namespace + '/' : ''),
395
+ fileFilter: allowedFileExtensions,
396
+ folderFilter: false,
397
+ mode: 'open',
398
+ view: 'prev',
399
+ userArg: wdata,
400
+ conn: that.conn,
401
+ zindex: 1001
402
+ }, function (_data, userData) {
403
+ var src = _data.path + _data.file;
404
+ $('#inspect_' + wdata.attr).val(src).trigger('change');
405
+ });
406
+ }
407
+ };
408
+ }
409
+ return line;
410
+
411
+ } catch (ex) {
412
+ console.error(`imagesAndMaterialDesignIcons: error: ${ex.message}, stack: ${ex.stack}`);
413
+ }
414
+ },
415
+ materialDesignIcons: function (widAttr) {
416
+ try {
417
+ var that = vis;
418
+
419
+ let line = {
420
+ // autocomplete for material icons
421
+ input: '<input type="text" id="inspect_' + widAttr + '" class="vis-edit-textbox"/>',
422
+ init: function (_wid_attr, data) {
423
+ $(this).autocomplete({
424
+ minLength: 0,
425
+ source: function (request, response) {
426
+
427
+ if (vis.editMode && myMdwMaterialDesignIconsList.length === 0) {
428
+ myMdwMaterialDesignIconsList = vis.binds.materialdesign.materialdesignicons.getList();
429
+ }
430
+
431
+ var _data = $.grep(myMdwMaterialDesignIconsList, function (value) {
432
+ return value.toLowerCase().includes(request.term.toLowerCase());
433
+ });
434
+
435
+ response(_data);
436
+ },
437
+ select: function (event, ui) {
438
+ $(this).val(ui.item.value);
439
+ $(this).trigger('change', ui.item.value);
440
+ }
441
+ }).focus(function () {
442
+ // Show dropdown menu
443
+ $(this).autocomplete('search', '');
444
+ }).autocomplete('instance')._renderItem = function (ul, item) {
445
+
446
+ return $('<li>')
447
+ .append(`
448
+ <div style="display: flex; align-items: center;">
449
+ <span class="mdi mdi-${item.label}" style="width: 40px; font-size: 24px; color: #44739e;"></span>
450
+ <label>${item.label}</label>
451
+ </div>
452
+ `)
453
+ .appendTo(ul);
454
+ };
455
+ }
456
+ };
457
+ return line;
458
+
459
+ } catch (ex) {
460
+ console.error(`materialDesignIcons: error: ${ex.message}, stack: ${ex.stack}`);
461
+ }
462
+ },
463
+ exportData: function (widAttr, data) {
464
+ try {
465
+ var that = vis;
466
+ let type = data[1];
467
+
468
+ // Select
469
+ var line = {
470
+ input: '<button id="inspect_' + widAttr + '" style="width: 100%;">' + _(widAttr) + '</button>',
471
+ init: function (w, data) {
472
+ $(this).button().click(function () {
473
+ $(this).val(true).trigger('change');
474
+
475
+ var wdata = $(this).data('wdata');
476
+ var data = {};
477
+ if (that.config['dialog-edit-text']) {
478
+ data = JSON.parse(that.config['dialog-edit-text']);
479
+ }
480
+ var editor = ace.edit('dialog-edit-text-textarea');
481
+ var changed = false;
482
+
483
+ var view = that.activeView;
484
+ let dialogText = 'Please select only one Widget to see the Widget data!';
485
+ if (that.activeWidgets.length === 1) {
486
+ let attrNames = []
487
+ let widgetAttrs = that.findCommonAttributes(view, that.activeWidgets)
488
+
489
+
490
+ let objectForDev = {};
491
+ let objectForDevString = "";
492
+ let strTableForDev = `<details><table><thead><tr>
493
+ <th>Property</th>
494
+ <th>Description</th>
495
+ <th>Type</th>
496
+ <th>Values</th>
497
+ </tr></thead><tbody>`;
498
+
499
+
500
+ for (const attr in widgetAttrs) {
501
+ strTableForDev = strTableForDev +
502
+ `<tr>
503
+ <td colspan="4" style="background: #44739e; color: white; border-color: #44739e;"><i><b>${_('group_' + attr)}</b></i></td>
504
+ </tr>
505
+ `
506
+ objectForDevString = objectForDevString + `\n// ${_('group_' + attr)}\n`
507
+ for (const prop in widgetAttrs[attr]) {
508
+ attrNames.push(prop);
509
+
510
+ // for documentation and object creation
511
+ let ausnahmen = ["manual", "questionsAndAnswers", "donate", "onlineExampleProject", "exportData", "useTheme"]
512
+ if (!ausnahmen.includes(prop)) {
513
+ objectForDev[prop] = `obj.${prop}`;
514
+
515
+ let valExample = '';
516
+ if (widgetAttrs[attr][prop].type === 'select') {
517
+ valExample = widgetAttrs[attr][prop].options !== null && Array.isArray(widgetAttrs[attr][prop].options) ? widgetAttrs[attr][prop].options.join(" | ") : '';
518
+ } else if (widgetAttrs[attr][prop].type === 'checkbox') {
519
+ valExample = "false | true";
520
+ } else if (widgetAttrs[attr][prop].type === 'color') {
521
+ valExample = "hex(#44739e), rgb(20, 50, 200), rgba(20, 50, 200, 0.5)";
522
+ }
523
+
524
+ strTableForDev = strTableForDev +
525
+ `<tr>
526
+ <td>${prop}</td>
527
+ <td>${_(prop)}</td>
528
+ <td>${widgetAttrs[attr][prop].type ? widgetAttrs[attr][prop].type.replace('color', 'string').replace('slider', 'number').replace('select', 'string').replace('checkbox', 'boolean').replace('id', 'string').replace('html', 'string').replace("undefined", 'string').replace("fontname", "string").replace("custom", "string") : 'string'}</td>
529
+ <td>${valExample}</td>
530
+ </tr>
531
+ `
532
+ objectForDevString = objectForDevString + `${prop}: obj.${prop},\n`
533
+ }
534
+ }
535
+ }
536
+ strTableForDev = strTableForDev + `</tbody></table></details>`
537
+ if (Object.keys(objectForDev).length > 0) {
538
+ console.log(objectForDevString);
539
+ console.log(objectForDev);
540
+ console.log(strTableForDev);
541
+ }
542
+
543
+ let widget = that.views[view].widgets[that.activeWidgets[0]];
544
+ let style = widget.style;
545
+
546
+ let widgetData = Object.assign(
547
+ {
548
+ type: type,
549
+ width: style.width,
550
+ height: style.height
551
+ },
552
+ widget.data);
553
+
554
+ for (var attr in widgetData) {
555
+ if ((!attrNames.includes(attr) || attr === 'exportData' || attr === 'generateHtmlControl') && attr !== 'type' && attr !== 'width' && attr !== 'height') {
556
+ delete widgetData[attr];
557
+ }
558
+
559
+ if ((type === 'select' || type === 'autocomplete') && attr === 'jsonStringObject' && widgetData['listDataMethod'] === 'jsonStringObject') {
560
+ if (!widgetData[attr].startsWith('{') && !widgetData[attr].endsWith("}")) {
561
+ widgetData[attr] = JSON.parse(widgetData[attr]);
562
+ }
563
+ }
564
+ }
565
+
566
+ dialogText = JSON.stringify(widgetData, null, "\t");
567
+ }
568
+
569
+ $('#dialog-edit-text').dialog({
570
+ autoOpen: true,
571
+ width: data.width || 800,
572
+ height: data.height || 600,
573
+ modal: true,
574
+ resize: function () {
575
+ editor.resize();
576
+ },
577
+ open: function (event) {
578
+ $(event.target).parent().find('.ui-dialog-titlebar-close .ui-button-text').html('');
579
+ $(this).parent().css({ 'z-index': 1000 });
580
+ if (data.top !== undefined) {
581
+ if (data.top >= 0) {
582
+ $(this).parent().css({ top: data.top });
583
+ } else {
584
+ $(this).parent().css({ top: 0 });
585
+ }
586
+ }
587
+ if (data.left !== undefined) {
588
+ if (data.left >= 0) {
589
+ $(this).parent().css({ left: data.left });
590
+ } else {
591
+ $(this).parent().css({ left: 0 });
592
+ }
593
+ }
594
+ editor.getSession().setMode('ace/mode/html');
595
+ editor.setOptions({
596
+ enableBasicAutocompletion: true,
597
+ enableLiveAutocompletion: true
598
+ });
599
+ editor.$blockScrolling = Infinity;
600
+ editor.getSession().setUseWrapMode(true);
601
+ editor.setValue(dialogText);
602
+ editor.navigateFileEnd();
603
+ editor.focus();
604
+ editor.getSession().on('change', function () {
605
+ changed = false;
606
+ });
607
+ },
608
+ beforeClose: function () {
609
+ // dummy
610
+ },
611
+ buttons: [
612
+ {
613
+ text: _('Close'),
614
+ click: function () {
615
+ $(this).dialog('close');
616
+ }
617
+ }
618
+ ]
619
+ }).show();
620
+ });
621
+ }
622
+ };
623
+ return line;
624
+
625
+ } catch (ex) {
626
+ console.error(`exportData: error: ${ex.message}, stack: ${ex.stack}`);
627
+ }
628
+ },
629
+ generateHtmlControl: function (widAttr, data) {
630
+ try {
631
+ var that = vis;
632
+
633
+ let clazz = data[1];
634
+ let type = data[2];
635
+
636
+ // Select
637
+ var line = {
638
+ input: '<button id="inspect_' + widAttr + '" style="width: 100%;">' + _(widAttr) + '</button>',
639
+ init: function (w, data) {
640
+ $(this).button().click(function () {
641
+ $(this).val(true).trigger('change');
642
+
643
+ var wdata = $(this).data('wdata');
644
+ var data = {};
645
+ if (that.config['dialog-edit-text']) {
646
+ data = JSON.parse(that.config['dialog-edit-text']);
647
+ }
648
+ var editor = ace.edit('dialog-edit-text-textarea');
649
+ var changed = false;
650
+
651
+ var view = that.activeView;
652
+ if (that.activeWidgets.length === 1) {
653
+ let attrNames = []
654
+ let widgetAttrs = that.findCommonAttributes(view, that.activeWidgets)
655
+
656
+ let objectForDev = {};
657
+ let objectForDevString = "";
658
+ let strTableForDev = '<table>' + '\n' +
659
+ '\t' + '<thead>' + '\n' +
660
+ '\t\t' + '<tr>' + '\n' +
661
+ '\t\t\t' + '<th>Property</th>' + '\n' +
662
+ '\t\t\t' + '<th>Description</th>' + '\n' +
663
+ '\t\t\t' + '<th>Type</th>' + '\n' +
664
+ '\t\t\t' + '<th>Values</th>' + '\n' +
665
+ '\t\t' + '</tr>' + '\n' +
666
+ '\t' + '</thead>' + '\n' +
667
+ '\t' + '<tbody>' + '\n';
668
+
669
+ if (type) {
670
+ strTableForDev = strTableForDev +
671
+ '\t\t' + '<tr>' + '\n' +
672
+ '\t\t\t' + `<td>mdw-type</td>` + '\n' +
673
+ '\t\t\t' + `<td>${_('mdwType')}</td>` + '\n' +
674
+ '\t\t\t' + `<td>string</td>` + '\n' +
675
+ '\t\t\t' + `<td>${type}</td>` + '\n' +
676
+ '\t\t' + '</tr>' + '\n';
677
+ }
678
+
679
+ objectForDevString = objectForDevString + `wid: widgetId,\n`;
680
+
681
+ for (const attr in widgetAttrs) {
682
+
683
+ if (!attr.includes('_§')) {
684
+ strTableForDev = strTableForDev +
685
+ '\t\t' + '<tr>' + '\n' +
686
+ '\t\t\t' + `<td colspan="4" style="background: #44739e; color: white; border-color: #44739e;"><i><b><br>${_('group_' + attr)}</b></i></td>` + '\n' +
687
+ '\t\t' + '</tr>' + '\n';
688
+
689
+ objectForDevString = objectForDevString + `\n// ${_('group_' + attr)}\n`
690
+ } else {
691
+ if (attr.includes('_§0')) {
692
+ strTableForDev = strTableForDev +
693
+ '\t\t' + '<tr>' + '\n' +
694
+ '\t\t\t' + `<td colspan="4" style="background: #44739e; color: white; border-color: #44739e;"><i><b><br>${_('group_' + attr.replace('_§0', ''))} [x]</b></i></td>` + '\n' +
695
+ '\t\t' + '</tr>' + '\n';
696
+
697
+ objectForDevString = objectForDevString + `\n// ${_('group_' + attr.replace('_§0', ''))} [x]\n`
698
+ }
699
+ }
700
+
701
+ for (const prop in widgetAttrs[attr]) {
702
+ attrNames.push(prop);
703
+
704
+ // for documentation and object creation
705
+ let ausnahmen = ["manual", "questionsAndAnswers", "donate", "onlineExampleProject", "exportData", "useTheme", "generateHtmlControl"]
706
+ if (!ausnahmen.includes(prop)) {
707
+ objectForDev[prop] = `obj.${prop}`;
708
+
709
+ let valExample = '';
710
+ if (widgetAttrs[attr][prop].type === 'select') {
711
+ valExample = widgetAttrs[attr][prop].options !== null && Array.isArray(widgetAttrs[attr][prop].options) ? widgetAttrs[attr][prop].options.join(" | ") : '';
712
+ } else if (widgetAttrs[attr][prop].type === 'checkbox') {
713
+ valExample = "false | true";
714
+ } else if (widgetAttrs[attr][prop].type === 'color') {
715
+ valExample = "hex(#44739e), rgb(20, 50, 200), rgba(20, 50, 200, 0.5)";
716
+ }
717
+
718
+ if (isNaN(prop.slice(-1))) {
719
+ strTableForDev = strTableForDev +
720
+ '\t\t' + '<tr>' + '\n' +
721
+ '\t\t\t' + `<td>mdw-${prop}</td>` + '\n' +
722
+ '\t\t\t' + `<td>${_(prop)}</td>` + '\n' +
723
+ '\t\t\t' + `<td>${widgetAttrs[attr][prop].type ? widgetAttrs[attr][prop].type.replace('color', 'string').replace('slider', 'number').replace('select', 'string').replace('checkbox', 'boolean').replace('id', 'string').replace('html', 'string').replace("undefined", 'string').replace("fontname", "string").replace("custom", "string") : 'string'}</td>` + '\n' +
724
+ '\t\t\t' + `<td>${valExample}` + '\n' +
725
+ '\t\t' + '</tr>' + '\n';
726
+ } else {
727
+ if (parseInt(prop.slice(-1)) === 0) {
728
+ strTableForDev = strTableForDev +
729
+ '\t\t' + '<tr>' + '\n' +
730
+ '\t\t\t' + `<td>mdw-${prop.replace('0', '')}[x]</td>` + '\n' +
731
+ '\t\t\t' + `<td>${_(prop.replace('0', ''))}</td>` + '\n' +
732
+ '\t\t\t' + `<td>${widgetAttrs[attr][prop].type ? widgetAttrs[attr][prop].type.replace('color', 'string').replace('slider', 'number').replace('select', 'string').replace('checkbox', 'boolean').replace('id', 'string').replace('html', 'string').replace("undefined", 'string').replace("fontname", "string").replace("custom", "string") : 'string'}</td>` + '\n' +
733
+ '\t\t\t' + `<td>${valExample}` + '\n' +
734
+ '\t\t' + '</tr>' + '\n';
735
+ }
736
+ }
737
+
738
+ if (prop.includes("-")) {
739
+ objectForDevString = objectForDevString + `"${prop}": obj["${prop}"],\n`
740
+ } else {
741
+ objectForDevString = objectForDevString + `${prop}: obj.${prop},\n`
742
+ }
743
+ }
744
+ }
745
+ }
746
+ strTableForDev = strTableForDev +
747
+ '\t' + '</tbody>' + '\n' +
748
+ '</table>';
749
+
750
+ if (Object.keys(objectForDev).length > 0) {
751
+ console.log(objectForDevString);
752
+ // console.log(objectForDev);
753
+ console.log(strTableForDev);
754
+ }
755
+
756
+ let widget = that.views[view].widgets[that.activeWidgets[0]];
757
+ let style = widget.style;
758
+
759
+ let widgetData = {};
760
+
761
+ if (type) {
762
+ widgetData.type = type;
763
+ }
764
+
765
+ widgetData = Object.assign(
766
+ widgetData,
767
+ {
768
+ type: type,
769
+ width: style.width,
770
+ height: style.height
771
+ },
772
+ widget.data);
773
+
774
+ for (var attr in widgetData) {
775
+ if ((!attrNames.includes(attr) || attr === 'exportData' || attr === 'generateHtmlControl') && attr !== 'type' && attr !== 'width' && attr !== 'height') {
776
+ delete widgetData[attr];
777
+ }
778
+
779
+ if ((type === 'select' || type === 'autocomplete') && attr === 'jsonStringObject' && widgetData['listDataMethod'] === 'jsonStringObject') {
780
+ if (!widgetData[attr].startsWith('{') && !widgetData[attr].endsWith("}")) {
781
+ widgetData[attr] = JSON.parse(widgetData[attr]);
782
+ }
783
+ }
784
+ }
785
+
786
+ let dialogText = vis.binds.materialdesign[clazz].getHtmlConstructor(widgetData, type);
787
+
788
+ // dialogText = dialogText + JSON.stringify(widgetData, null, "\t");
789
+
790
+ $('#dialog-edit-text').dialog({
791
+ autoOpen: true,
792
+ width: data.width || 800,
793
+ height: data.height || 600,
794
+ modal: true,
795
+ resize: function () {
796
+ editor.resize();
797
+ },
798
+ open: function (event) {
799
+ $(event.target).parent().find('.ui-dialog-titlebar-close .ui-button-text').html('');
800
+ $(this).parent().css({ 'z-index': 1000 });
801
+ if (data.top !== undefined) {
802
+ if (data.top >= 0) {
803
+ $(this).parent().css({ top: data.top });
804
+ } else {
805
+ $(this).parent().css({ top: 0 });
806
+ }
807
+ }
808
+ if (data.left !== undefined) {
809
+ if (data.left >= 0) {
810
+ $(this).parent().css({ left: data.left });
811
+ } else {
812
+ $(this).parent().css({ left: 0 });
813
+ }
814
+ }
815
+ editor.getSession().setMode('ace/mode/html');
816
+ editor.setOptions({
817
+ enableBasicAutocompletion: true,
818
+ enableLiveAutocompletion: true
819
+ });
820
+ editor.$blockScrolling = Infinity;
821
+ editor.getSession().setUseWrapMode(true);
822
+ editor.setValue(dialogText);
823
+ editor.navigateFileEnd();
824
+ editor.focus();
825
+ editor.getSession().on('change', function () {
826
+ changed = false;
827
+ });
828
+ },
829
+ beforeClose: function () {
830
+ // dummy
831
+ },
832
+ buttons: [
833
+ {
834
+ text: _('Close'),
835
+ click: function () {
836
+ $(this).dialog('close');
837
+ }
838
+ }
839
+ ]
840
+ }).show();
841
+
842
+ } else {
843
+ that.confirmMessage(_('Please select only one Widget!'), _('attention'), null, 400, function (result) {
844
+ });
845
+ }
846
+ });
847
+ }
848
+ };
849
+ return line;
850
+
851
+ } catch (ex) {
852
+ console.error(`generateHtmlControl: error: ${ex.message}, stack: ${ex.stack}`);
853
+ }
854
+ },
855
+ permissionGroupSelector: function (widAttr, data) {
856
+ try {
857
+ let that = vis;
858
+
859
+ let line = {
860
+ input: '<select multiple="multiple" id="inspect_' + widAttr + '" class="select-groups"></select>',
861
+ init: function (_wid_attr, data) {
862
+ $(this).html('');
863
+
864
+ let view = that.activeView;
865
+ let viewDiv = that.activeViewDiv;
866
+ let groups = that.getUserGroups();
867
+ let widGroups = that.findCommonValue(view, that.activeWidgets, widAttr);
868
+ if (widGroups && !(widGroups instanceof Array)) widGroups = widGroups.values;
869
+ widGroups = widGroups || [];
870
+ for (let g in groups) {
871
+ let val = g.substring('system.group.'.length);
872
+ $(this).append('<option value="' + val + '" ' + ((widGroups.indexOf(val) !== -1) ? 'selected' : '') + '>' + (groups[g] && groups[g].common ? groups[g].common.name || val : val) + '</option>');
873
+ }
874
+
875
+ $(this).multiselect({
876
+ maxWidth: 180,
877
+ height: 260,
878
+ noneSelectedText: _('All groups'),
879
+ selectedText: function (numChecked, numTotal, checkedItems) {
880
+ let text = '';
881
+ for (var i = 0; i < checkedItems.length; i++) {
882
+ text += (!text ? '' : ',') + checkedItems[i].title;
883
+ }
884
+ return text;
885
+ },
886
+ multiple: true,
887
+ checkAllText: _('Check all'),
888
+ uncheckAllText: _('Uncheck all'),
889
+ close: function () {
890
+ if ($(this).data('changed')) {
891
+ $(this).data('changed', false);
892
+ that.save(viewDiv, view);
893
+ }
894
+ }
895
+ //noneSelectedText: _("Select options")
896
+ }).change(function () {
897
+ $(this).data('changed', true);
898
+ }).data('changed', false);
899
+
900
+ $(this).next().css('width', '100%');
901
+ }
902
+ }
903
+
904
+ return line;
905
+ } catch (ex) {
906
+ console.error(`permissionGroupSelector: error: ${ex.message}, stack: ${ex.stack}`);
907
+ }
908
+ },
909
+ useTheme: function (widAttr, data) {
910
+ try {
911
+ var that = vis;
912
+ let theme = data[1] ? data[1] : undefined;
913
+
914
+ // options = {min: ?,max: ?,step: ?}
915
+ // Select
916
+ var line = {
917
+ input: '<button id="inspect_' + widAttr + '" style="width: 100%;">' + _(widAttr) + '</button>',
918
+ init: function (w, data) {
919
+ $(this).button().click(function () {
920
+ let widgetName = vis.binds.materialdesign.viseditor.getWidgetDataVisName(null, that.activeWidgets[0]);
921
+
922
+ if (that.activeWidgets.length === 1) {
923
+ that.confirmMessage(_('all colors, fonts and font sizes of the widget will be overridden - do you want to continue?'), _('attention'), null, 700, function (result) {
924
+ if (result) {
925
+
926
+ // prevent too much recursion
927
+ let oidToRestore = undefined;
928
+ let $oid = $(`#inspect_oid`);
929
+ if ($oid.length > 0) {
930
+ oidToRestore = $oid.val();
931
+ $oid.val('').trigger('change');
932
+ }
933
+
934
+ setTimeout(function () {
935
+ let themeTypesList = ['colors', 'fonts', 'fontSizes'];
936
+
937
+ for (const themeType of themeTypesList) {
938
+ that.conn.readFile(`/vis-materialdesign.admin/lib/${themeType}.json`, async function (err, data) {
939
+ if (!err) {
940
+ let list = JSON.parse(data).filter(function (x) {
941
+ let splitted = x.widget.split(', ');
942
+ return splitted.includes(widgetName);
943
+ });
944
+
945
+ for (const obj of list) {
946
+ let inspect = $(`#inspect_${obj.desc}`);
947
+
948
+ if (inspect && inspect.length > 0) {
949
+ await setElementValue(inspect, themeType, obj.id, theme);
950
+ // let mdwThemeOid = generateMdwThemeOid(themeType, obj.id);
951
+
952
+ // console.warn(obj.desc);
953
+ // console.warn(await getStateValue(themeType, obj.id, 'light'));
954
+
955
+
956
+ // if (inspect.val() !== mdwThemeOid) {
957
+ // inspect.val(mdwThemeOid).trigger('change');
958
+ // }
959
+ } else {
960
+ // wir haben ein Element mit count
961
+ inspect = $(`input[id^='inspect_${obj.desc}']`);
962
+
963
+ if (inspect && inspect.length > 0) {
964
+ inspect.each(async function (i, el) {
965
+
966
+ // Prüfen ob am Ende der id wirklich nur eine number ist
967
+ if (!isNaN(parseFloat(el.id.replace(`inspect_${obj.desc}`, '')))) {
968
+ let $el = $(el);
969
+ await setElementValue($el, themeType, obj.id, theme);
970
+
971
+
972
+ // let mdwThemeOid = generateMdwThemeOid(themeType, obj.id);
973
+
974
+ // console.warn(obj.desc);
975
+ // console.warn(await getStateValue(themeType, obj.id, 'light'));
976
+
977
+
978
+ // if ($el.val() !== mdwThemeOid) {
979
+ // $el.val(mdwThemeOid).trigger('change');
980
+ // }
981
+ }
982
+ });
983
+ }
984
+ }
985
+ }
986
+ } else {
987
+ console.error(`useTheme: error loading ${themeType}.json, error: ${err}`);
988
+ }
989
+
990
+ if (themeType === themeTypesList[themeTypesList.length - 1]) {
991
+ if (oidToRestore) {
992
+ $(`#inspect_oid`).val(oidToRestore).trigger('change');
993
+ }
994
+ }
995
+ });
996
+ }
997
+ }, 100);
998
+ }
999
+ });
1000
+
1001
+ function generateBinding(themeType, id) {
1002
+ if (themeType === 'colors') {
1003
+ return `{mode:vis-materialdesign.0.colors.darkTheme;light:vis-materialdesign.0.colors.light.${id.replace('light.', '')};dark:vis-materialdesign.0.colors.dark.${id.replace('light.', '')}; mode === "true" ? dark : light}`;
1004
+ } else {
1005
+ return `{vis-materialdesign.0.${themeType}.${id}}`;
1006
+ }
1007
+ }
1008
+
1009
+ function generateMdwThemeOid(themeType, id) {
1010
+ if (themeType === 'colors') {
1011
+ return `#mdwTheme:vis-materialdesign.0.${themeType}.${id.replace('light.', '')}`;
1012
+ } else {
1013
+ return `#mdwTheme:vis-materialdesign.0.${themeType}.${id}`;
1014
+ }
1015
+ }
1016
+
1017
+ function generateCssThemeVar(themeType, id) {
1018
+ if (themeType === 'colors') {
1019
+ return `var(--materialdesign-widget-theme-color-${id.replace('light.', '').replace('dark.', '').replace(/\./g, '-').replace(/_/g, '-')})`;
1020
+ } else if (themeType === 'fonts') {
1021
+ return `var(--materialdesign-widget-theme-font-${id.replace(/\./g, '-').replace(/_/g, '-')})`;
1022
+ } else {
1023
+ return `var(--materialdesign-widget-theme-font-size-${id.replace(/\./g, '-').replace(/_/g, '-')})`;
1024
+ }
1025
+ }
1026
+
1027
+ async function getStateValue(themeType, id, theme) {
1028
+ let stateId = `vis-materialdesign.0.${themeType}.${id}`;
1029
+
1030
+ if (theme === 'dark') {
1031
+ stateId = `vis-materialdesign.0.${themeType}.${id.replace('light.', 'dark.')}`;
1032
+ }
1033
+
1034
+ let state = await myMdwHelper.getStateAsync(stateId);
1035
+
1036
+ if (state) {
1037
+ return state.val;
1038
+ } else {
1039
+ console.warn(`useTheme: state '${stateId}' is undefined!`);
1040
+ return '';
1041
+ }
1042
+ }
1043
+
1044
+ async function setElementValue(element, themeType, id, theme) {
1045
+ if (!theme) {
1046
+ let mdwThemeOid = generateCssThemeVar(themeType, id);
1047
+
1048
+ if (element.val() !== mdwThemeOid) {
1049
+ element.val(mdwThemeOid).trigger('change');
1050
+ }
1051
+ } else {
1052
+ let val = await getStateValue(themeType, id, theme);
1053
+
1054
+ if (element.val() !== val) {
1055
+ element.val(val).trigger('change');
1056
+ }
1057
+ }
1058
+ }
1059
+ } else {
1060
+ that.confirmMessage(_('Please select only one Widget!'), _('attention'), null, 400, function (result) {
1061
+ });
1062
+ }
1063
+ });
1064
+ }
1065
+ };
1066
+ return line;
1067
+
1068
+ } catch (ex) {
1069
+ console.error(`useTheme: error: ${ex.message}, stack: ${ex.stack}`);
1070
+ }
1071
+ },
1072
+ getWidgetDataVisName: function (view, widget) {
1073
+ if (view && !widget) {
1074
+ widget = view;
1075
+ view = null;
1076
+ }
1077
+ if (!view || !vis.views[view]) view = vis.getViewOfWidget(widget);
1078
+ var widgetData = vis.views[view].widgets[widget];
1079
+ if (widgetData) {
1080
+ return $('#' + widgetData.tpl).attr('data-vis-name');
1081
+ }
1082
+ return undefined;
1083
+ },
1084
+ };
1085
+
1086
+ if (vis.editMode) {
1087
+ myMdwMaterialDesignIconsList = vis.binds.materialdesign.materialdesignicons.getList();
1088
+ }