cronapp-framework-mobile-js 2.8.9

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 (510) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/components/crn-QRCode.components.json +54 -0
  4. package/components/crn-anchor.components.json +89 -0
  5. package/components/crn-button-bar.components.json +64 -0
  6. package/components/crn-button.components.json +316 -0
  7. package/components/crn-card.components.json +95 -0
  8. package/components/crn-chart.components.json +56 -0
  9. package/components/crn-chat.components.json +8 -0
  10. package/components/crn-checkbox.components.json +184 -0
  11. package/components/crn-complex-search.components.json +43 -0
  12. package/components/crn-container.components.json +21 -0
  13. package/components/crn-cron-crud.components.json +21 -0
  14. package/components/crn-datasource.components.json +181 -0
  15. package/components/crn-dynamic-file.components.json +85 -0
  16. package/components/crn-dynamic-image.components.json +151 -0
  17. package/components/crn-dynamic-select.components.json +111 -0
  18. package/components/crn-evaluation.components.json +64 -0
  19. package/components/crn-filter-button.components.json +305 -0
  20. package/components/crn-form-template.components.json +11 -0
  21. package/components/crn-header-button.components.json +63 -0
  22. package/components/crn-heading.components.json +109 -0
  23. package/components/crn-icon.components.json +249 -0
  24. package/components/crn-image.components.json +121 -0
  25. package/components/crn-infinite-scroll.components.json +32 -0
  26. package/components/crn-input-button.components.json +189 -0
  27. package/components/crn-input-floating.components.json +179 -0
  28. package/components/crn-input-icon.components.json +171 -0
  29. package/components/crn-input-inline.components.json +182 -0
  30. package/components/crn-input.components.json +169 -0
  31. package/components/crn-ion-content.components.json +24 -0
  32. package/components/crn-ion-footer-bar.components.json +351 -0
  33. package/components/crn-ion-header-bar.components.json +211 -0
  34. package/components/crn-ion-list.components.json +163 -0
  35. package/components/crn-ion-nav-buttons.components.json +63 -0
  36. package/components/crn-ion-segment-item.components.json +65 -0
  37. package/components/crn-ion-segment.components.json +974 -0
  38. package/components/crn-ion-tab-item.components.json +50 -0
  39. package/components/crn-ion-tab.components.json +138 -0
  40. package/components/crn-item-options.components.json +26 -0
  41. package/components/crn-item-select.components.json +69 -0
  42. package/components/crn-item-swipe.components.json +62 -0
  43. package/components/crn-kendo-chat.components.json +88 -0
  44. package/components/crn-label.components.json +113 -0
  45. package/components/crn-list-avatar.components.json +260 -0
  46. package/components/crn-list-icon.components.json +249 -0
  47. package/components/crn-list-item-avatar.components.json +236 -0
  48. package/components/crn-list-item-icon.components.json +260 -0
  49. package/components/crn-list-item-thumbnail.components.json +226 -0
  50. package/components/crn-list-item.components.json +160 -0
  51. package/components/crn-list-simple.components.json +180 -0
  52. package/components/crn-list-swipe.components.json +105 -0
  53. package/components/crn-list-thumbnail.components.json +248 -0
  54. package/components/crn-list.components.json +75 -0
  55. package/components/crn-map.components.json +55 -0
  56. package/components/crn-mobile-menu.components.json +32 -0
  57. package/components/crn-multiselect.components.json +110 -0
  58. package/components/crn-navbar.components.json +105 -0
  59. package/components/crn-option-button.components.json +72 -0
  60. package/components/crn-paragraph.components.json +110 -0
  61. package/components/crn-radio.components.json +90 -0
  62. package/components/crn-radioOption.components.json +23 -0
  63. package/components/crn-range.components.json +106 -0
  64. package/components/crn-rating.components.json +189 -0
  65. package/components/crn-search.components.json +210 -0
  66. package/components/crn-select-options.components.json +17 -0
  67. package/components/crn-select.components.json +93 -0
  68. package/components/crn-slider-item.components.json +137 -0
  69. package/components/crn-slider.components.json +105 -0
  70. package/components/crn-spacer.components.json +21 -0
  71. package/components/crn-start.components.json +10 -0
  72. package/components/crn-tabs-icon-only-item.components.json +85 -0
  73. package/components/crn-tabs-icon-only.components.json +382 -0
  74. package/components/crn-tabs.components.json +36 -0
  75. package/components/crn-textarea.components.json +96 -0
  76. package/components/crn-toggle.components.json +161 -0
  77. package/components/crn-video.components.json +67 -0
  78. package/components/css/app.css +66 -0
  79. package/components/css/background-color.css +121 -0
  80. package/components/css/chatStyle.css +221 -0
  81. package/components/css/color-default.css +83 -0
  82. package/components/css/crn-ion-segment.css +786 -0
  83. package/components/css/icon-size.css +15 -0
  84. package/components/css/multiselect-editor.css +119 -0
  85. package/components/css/tabs-color.css +248 -0
  86. package/components/js/format.min.js +2 -0
  87. package/components/js/jquery.inputmask.bundle.js +3883 -0
  88. package/components/js/jquery.mask.min.js +19 -0
  89. package/components/js/pouchdb.cordova-sqlite.js +5540 -0
  90. package/components/js/qrcode.js +1319 -0
  91. package/components/reports/BOOLEAN.parameter.html +10 -0
  92. package/components/reports/DATE.parameter.html +4 -0
  93. package/components/reports/DOUBLE.parameter.html +4 -0
  94. package/components/reports/FLOAT.parameter.html +4 -0
  95. package/components/reports/INTEGER.parameter.html +4 -0
  96. package/components/reports/LONG.parameter.html +5 -0
  97. package/components/reports/STRING.parameter.html +5 -0
  98. package/components/reports/reports.parameters.html +20 -0
  99. package/components/templates/advanced.list.designtime.html +57 -0
  100. package/components/templates/advanced.list.template.html +1 -0
  101. package/components/templates/anchor.template.html +1 -0
  102. package/components/templates/button-bar.template.html +5 -0
  103. package/components/templates/button-report.template.html +1 -0
  104. package/components/templates/button.template.html +4 -0
  105. package/components/templates/card.template.html +7 -0
  106. package/components/templates/chat.template.html +39 -0
  107. package/components/templates/checkbox.template.html +9 -0
  108. package/components/templates/combobox.designtime.html +12 -0
  109. package/components/templates/combobox.template.html +8 -0
  110. package/components/templates/complexsearch.template.html +7 -0
  111. package/components/templates/crn-ion-segment-item.template.html +6 -0
  112. package/components/templates/crn-ion-segment.template.html +27 -0
  113. package/components/templates/cron-crud.template.html +7 -0
  114. package/components/templates/cron-mobile-menu.designtime.html +10 -0
  115. package/components/templates/div.horizontal.template.html +27 -0
  116. package/components/templates/div.vertical.template.html +11 -0
  117. package/components/templates/dynamic-combobox.template.html +6 -0
  118. package/components/templates/dynamicfile.template.html +8 -0
  119. package/components/templates/dynamicimage.designtime.html +11 -0
  120. package/components/templates/dynamicimage.template.html +9 -0
  121. package/components/templates/evaluation.designtime.html +7 -0
  122. package/components/templates/evaluation.template.html +1 -0
  123. package/components/templates/filterbutton.template.html +3 -0
  124. package/components/templates/floattextinput.designtime.html +4 -0
  125. package/components/templates/floattextinput.template.html +4 -0
  126. package/components/templates/form.template.html +5 -0
  127. package/components/templates/header.template.html +3 -0
  128. package/components/templates/icontextinput.template.html +4 -0
  129. package/components/templates/image.template.html +18 -0
  130. package/components/templates/inlinetextinput.template.html +4 -0
  131. package/components/templates/ion-footer-bar.template.html +9 -0
  132. package/components/templates/ion-header-bar.template.html +13 -0
  133. package/components/templates/ion-tab-item.designtime.html +5 -0
  134. package/components/templates/ion-tab.template.html +8 -0
  135. package/components/templates/item.avatar.template.html +5 -0
  136. package/components/templates/item.icon.template.html +4 -0
  137. package/components/templates/item.options.template.html +14 -0
  138. package/components/templates/item.slider.template.html +4 -0
  139. package/components/templates/item.swipe.template.html +14 -0
  140. package/components/templates/item.template.html +5 -0
  141. package/components/templates/item.thumbnail.template.html +5 -0
  142. package/components/templates/kendo-chat.designtime.html +20 -0
  143. package/components/templates/kendo-chat.template.html +75 -0
  144. package/components/templates/list.avatar.template.html +7 -0
  145. package/components/templates/list.icon.template.html +6 -0
  146. package/components/templates/list.swipe.template.html +16 -0
  147. package/components/templates/list.template.html +5 -0
  148. package/components/templates/list.thumbnail.template.html +7 -0
  149. package/components/templates/maps.designtime.html +1 -0
  150. package/components/templates/maps.template.html +1 -0
  151. package/components/templates/menu.template.html +21 -0
  152. package/components/templates/multiselect.template.html +5 -0
  153. package/components/templates/nav.bar.template.html +5 -0
  154. package/components/templates/publicMenu.template.html +14 -0
  155. package/components/templates/radiogroup-dynamic.template.html +15 -0
  156. package/components/templates/radiogroup.template.html +21 -0
  157. package/components/templates/range.template.html +5 -0
  158. package/components/templates/rating.template.html +9 -0
  159. package/components/templates/search.template.html +6 -0
  160. package/components/templates/slider.template.html +24 -0
  161. package/components/templates/tabs-icon-only.template.html +16 -0
  162. package/components/templates/tabs.template.html +5 -0
  163. package/components/templates/textarea.template.html +1 -0
  164. package/components/templates/textinput.template.html +3 -0
  165. package/components/templates/textinputbutton.template.html +12 -0
  166. package/components/templates/title.template.html +1 -0
  167. package/components/templates/toggle-dynamic.template.html +11 -0
  168. package/components/templates/toggle.template.html +9 -0
  169. package/components/templates/video.designtime.html +2 -0
  170. package/components/templates/video.template.html +1 -0
  171. package/components/templates/views/public/home.view.html +16 -0
  172. package/components/templates/views/public/menu.view.html +20 -0
  173. package/components/upload/upload.html +41 -0
  174. package/cronapp-framework-mobile-js.iml +9 -0
  175. package/css/app.css +306 -0
  176. package/css/cronos.css +55 -0
  177. package/css/custom-ionic.css +195 -0
  178. package/css/groupingOfCss/checkbox.css +75 -0
  179. package/css/groupingOfCss/col.css +728 -0
  180. package/css/groupingOfCss/dynamicImage.css +24 -0
  181. package/css/groupingOfCss/import_groupingOfCss.css +6 -0
  182. package/css/groupingOfCss/login.css +260 -0
  183. package/css/groupingOfCss/qrCodeCronapp.css +4 -0
  184. package/css/groupingOfCss/upload-image.css +68 -0
  185. package/css/old/modal.css +133 -0
  186. package/dist/components/css/app.css +1 -0
  187. package/dist/components/css/background-color.css +1 -0
  188. package/dist/components/css/chatStyle.css +1 -0
  189. package/dist/components/css/color-default.css +1 -0
  190. package/dist/components/css/crn-ion-segment.css +1 -0
  191. package/dist/components/css/icon-size.css +1 -0
  192. package/dist/components/css/multiselect-editor.css +1 -0
  193. package/dist/components/css/tabs-color.css +1 -0
  194. package/dist/components/js/format.min.js +1 -0
  195. package/dist/components/js/jquery.inputmask.bundle.js +3 -0
  196. package/dist/components/js/jquery.mask.min.js +1 -0
  197. package/dist/components/js/pouchdb.cordova-sqlite.js +2 -0
  198. package/dist/components/js/qrcode.js +1 -0
  199. package/dist/components/templates/advanced.list.designtime.html +1 -0
  200. package/dist/components/templates/advanced.list.template.html +1 -0
  201. package/dist/components/templates/anchor.template.html +1 -0
  202. package/dist/components/templates/button-bar.template.html +1 -0
  203. package/dist/components/templates/button-report.template.html +1 -0
  204. package/dist/components/templates/button.template.html +1 -0
  205. package/dist/components/templates/card.template.html +1 -0
  206. package/dist/components/templates/chat.template.html +1 -0
  207. package/dist/components/templates/checkbox.template.html +1 -0
  208. package/dist/components/templates/combobox.designtime.html +1 -0
  209. package/dist/components/templates/combobox.template.html +1 -0
  210. package/dist/components/templates/complexsearch.template.html +1 -0
  211. package/dist/components/templates/crn-ion-segment-item.template.html +1 -0
  212. package/dist/components/templates/crn-ion-segment.template.html +1 -0
  213. package/dist/components/templates/cron-crud.template.html +1 -0
  214. package/dist/components/templates/cron-mobile-menu.designtime.html +1 -0
  215. package/dist/components/templates/div.horizontal.template.html +1 -0
  216. package/dist/components/templates/div.vertical.template.html +1 -0
  217. package/dist/components/templates/dynamic-combobox.template.html +1 -0
  218. package/dist/components/templates/dynamicfile.template.html +1 -0
  219. package/dist/components/templates/dynamicimage.designtime.html +1 -0
  220. package/dist/components/templates/dynamicimage.template.html +1 -0
  221. package/dist/components/templates/evaluation.designtime.html +1 -0
  222. package/dist/components/templates/evaluation.template.html +1 -0
  223. package/dist/components/templates/filterbutton.template.html +1 -0
  224. package/dist/components/templates/floattextinput.designtime.html +1 -0
  225. package/dist/components/templates/floattextinput.template.html +1 -0
  226. package/dist/components/templates/form.template.html +1 -0
  227. package/dist/components/templates/header.template.html +1 -0
  228. package/dist/components/templates/iconinput.template.html +1 -0
  229. package/dist/components/templates/icontextinput.template.html +1 -0
  230. package/dist/components/templates/image.template.html +1 -0
  231. package/dist/components/templates/inlinetextinput.template.html +1 -0
  232. package/dist/components/templates/ion-footer-bar.template.html +1 -0
  233. package/dist/components/templates/ion-header-bar.template.html +1 -0
  234. package/dist/components/templates/ion-tab-item.designtime.html +1 -0
  235. package/dist/components/templates/ion-tab.designtime.html +1 -0
  236. package/dist/components/templates/ion-tab.template.html +1 -0
  237. package/dist/components/templates/item.avatar.template.html +1 -0
  238. package/dist/components/templates/item.icon.template.html +1 -0
  239. package/dist/components/templates/item.options.template.html +1 -0
  240. package/dist/components/templates/item.slider.template.html +1 -0
  241. package/dist/components/templates/item.swipe.template.html +1 -0
  242. package/dist/components/templates/item.template.html +1 -0
  243. package/dist/components/templates/item.thumbnail.template.html +1 -0
  244. package/dist/components/templates/kendo-chat.designtime.html +1 -0
  245. package/dist/components/templates/kendo-chat.template.html +1 -0
  246. package/dist/components/templates/list.avatar.template.html +1 -0
  247. package/dist/components/templates/list.icon.template.html +1 -0
  248. package/dist/components/templates/list.swipe.template.html +1 -0
  249. package/dist/components/templates/list.template.html +1 -0
  250. package/dist/components/templates/list.thumbnail.template.html +1 -0
  251. package/dist/components/templates/maps.designtime.html +1 -0
  252. package/dist/components/templates/maps.template.html +1 -0
  253. package/dist/components/templates/menu.template.html +1 -0
  254. package/dist/components/templates/multiselect.template.html +1 -0
  255. package/dist/components/templates/nav.bar.template.html +1 -0
  256. package/dist/components/templates/publicMenu.template.html +1 -0
  257. package/dist/components/templates/radiogroup-dynamic.template.html +1 -0
  258. package/dist/components/templates/radiogroup.template.html +1 -0
  259. package/dist/components/templates/range.template.html +1 -0
  260. package/dist/components/templates/rating.template.html +1 -0
  261. package/dist/components/templates/search.template.html +1 -0
  262. package/dist/components/templates/slider.template.html +1 -0
  263. package/dist/components/templates/tabs-icon-only.template.html +1 -0
  264. package/dist/components/templates/tabs.template.html +1 -0
  265. package/dist/components/templates/textarea.template.html +1 -0
  266. package/dist/components/templates/textinput.template.html +1 -0
  267. package/dist/components/templates/textinputbutton.template.html +1 -0
  268. package/dist/components/templates/title.template.html +1 -0
  269. package/dist/components/templates/toggle-dynamic.template.html +1 -0
  270. package/dist/components/templates/toggle.template.html +1 -0
  271. package/dist/components/templates/video.designtime.html +1 -0
  272. package/dist/components/templates/video.template.html +1 -0
  273. package/dist/components/templates/views/public/home.view.html +1 -0
  274. package/dist/components/templates/views/public/menu.view.html +1 -0
  275. package/dist/css/app.css +1 -0
  276. package/dist/css/cronos.css +1 -0
  277. package/dist/css/custom-ionic.css +1 -0
  278. package/dist/css/groupingOfCss/checkbox.css +1 -0
  279. package/dist/css/groupingOfCss/col.css +1 -0
  280. package/dist/css/groupingOfCss/dynamicImage.css +1 -0
  281. package/dist/css/groupingOfCss/import_groupingOfCss.css +1 -0
  282. package/dist/css/groupingOfCss/login.css +1 -0
  283. package/dist/css/groupingOfCss/qrCodeCronapp.css +1 -0
  284. package/dist/css/groupingOfCss/upload-image.css +1 -0
  285. package/dist/css/old/modal.css +1 -0
  286. package/dist/i18n/locale_en_us.json +126 -0
  287. package/dist/i18n/locale_pt_br.json +126 -0
  288. package/dist/img/cron-icon/crn-QRCode.svg +1 -0
  289. package/dist/img/cron-icon/crn-anchor.svg +1 -0
  290. package/dist/img/cron-icon/crn-button-bar.svg +1 -0
  291. package/dist/img/cron-icon/crn-button.svg +1 -0
  292. package/dist/img/cron-icon/crn-card.svg +1 -0
  293. package/dist/img/cron-icon/crn-carousel.svg +1 -0
  294. package/dist/img/cron-icon/crn-chart.svg +1 -0
  295. package/dist/img/cron-icon/crn-checkbox.svg +1 -0
  296. package/dist/img/cron-icon/crn-container.svg +1 -0
  297. package/dist/img/cron-icon/crn-cron-crud.svg +1 -0
  298. package/dist/img/cron-icon/crn-datasource.svg +1 -0
  299. package/dist/img/cron-icon/crn-dynamic-file.svg +1 -0
  300. package/dist/img/cron-icon/crn-dynamic-image.svg +1 -0
  301. package/dist/img/cron-icon/crn-enterprise-dynamic-combobox.svg +1 -0
  302. package/dist/img/cron-icon/crn-evaluation.svg +1 -0
  303. package/dist/img/cron-icon/crn-form.svg +1 -0
  304. package/dist/img/cron-icon/crn-header.svg +1 -0
  305. package/dist/img/cron-icon/crn-icon.svg +1 -0
  306. package/dist/img/cron-icon/crn-image.svg +1 -0
  307. package/dist/img/cron-icon/crn-infinite-scroll.svg +1 -0
  308. package/dist/img/cron-icon/crn-input-floating.svg +1 -0
  309. package/dist/img/cron-icon/crn-input-inline.svg +1 -0
  310. package/dist/img/cron-icon/crn-ion-footer-bar.svg +1 -0
  311. package/dist/img/cron-icon/crn-ion-list.svg +1 -0
  312. package/dist/img/cron-icon/crn-item-swipe.svg +1 -0
  313. package/dist/img/cron-icon/crn-kendo-chat.svg +1 -0
  314. package/dist/img/cron-icon/crn-label.svg +1 -0
  315. package/dist/img/cron-icon/crn-list-avatar.svg +1 -0
  316. package/dist/img/cron-icon/crn-list-icon.svg +1 -0
  317. package/dist/img/cron-icon/crn-list-item-avatar.svg +1 -0
  318. package/dist/img/cron-icon/crn-list-item-icon.svg +1 -0
  319. package/dist/img/cron-icon/crn-list-item-thumbnail.svg +1 -0
  320. package/dist/img/cron-icon/crn-list-item.svg +1 -0
  321. package/dist/img/cron-icon/crn-list-swipe.svg +1 -0
  322. package/dist/img/cron-icon/crn-list-thumbnail.svg +1 -0
  323. package/dist/img/cron-icon/crn-list.svg +1 -0
  324. package/dist/img/cron-icon/crn-map.svg +1 -0
  325. package/dist/img/cron-icon/crn-multiselect.svg +1 -0
  326. package/dist/img/cron-icon/crn-paragraph.svg +1 -0
  327. package/dist/img/cron-icon/crn-plugin.svg +1 -0
  328. package/dist/img/cron-icon/crn-radio.svg +1 -0
  329. package/dist/img/cron-icon/crn-radiogroup.svg +1 -0
  330. package/dist/img/cron-icon/crn-range.svg +1 -0
  331. package/dist/img/cron-icon/crn-rating.svg +1 -0
  332. package/dist/img/cron-icon/crn-select.svg +1 -0
  333. package/dist/img/cron-icon/crn-spacer.svg +1 -0
  334. package/dist/img/cron-icon/crn-tabs-icon-only.svg +1 -0
  335. package/dist/img/cron-icon/crn-tabs.svg +1 -0
  336. package/dist/img/cron-icon/crn-text-component.svg +1 -0
  337. package/dist/img/cron-icon/crn-textarea.svg +1 -0
  338. package/dist/img/cron-icon/crn-textinput.svg +1 -0
  339. package/dist/img/cron-icon/crn-textinputbutton.svg +1 -0
  340. package/dist/img/cron-icon/crn-textinputicon.svg +1 -0
  341. package/dist/img/cron-icon/crn-toggle.svg +1 -0
  342. package/dist/img/cron-icon/crn-video.svg +1 -0
  343. package/dist/img/placehold-100x100.png +0 -0
  344. package/dist/img/placehold-900x500.png +0 -0
  345. package/dist/img/qr-code.png +0 -0
  346. package/dist/img/svg-charts.svg +1 -0
  347. package/dist/img/user.svg +1 -0
  348. package/dist/js/LanguageSelectDirective.js +1 -0
  349. package/dist/js/LocaleService.js +1 -0
  350. package/dist/js/app.authentication.js +1 -0
  351. package/dist/js/app.js +1 -0
  352. package/dist/js/controllers.authentication.js +1 -0
  353. package/dist/js/controllers.js +1 -0
  354. package/dist/js/custom.controllers.js +1 -0
  355. package/dist/js/customModules.js +1 -0
  356. package/dist/js/customStateProvider.js +0 -0
  357. package/dist/js/directives.js +1 -0
  358. package/dist/js/filters.js +1 -0
  359. package/dist/js/local-dateformat.directive.js +1 -0
  360. package/dist/js/reports/parameters.controller.js +1 -0
  361. package/dist/js/reports/reports.service.js +1 -0
  362. package/dist/js/services.js +1 -0
  363. package/dist/js/upload.service.js +1 -0
  364. package/gulpfile.js +73 -0
  365. package/i18n/locale_en_us.json +126 -0
  366. package/i18n/locale_pt_br.json +126 -0
  367. package/img/cron-icon/crn-QRCode.svg +38 -0
  368. package/img/cron-icon/crn-anchor.svg +29 -0
  369. package/img/cron-icon/crn-button-bar.svg +1 -0
  370. package/img/cron-icon/crn-button.svg +24 -0
  371. package/img/cron-icon/crn-card.svg +1 -0
  372. package/img/cron-icon/crn-carousel.svg +26 -0
  373. package/img/cron-icon/crn-chart.svg +19 -0
  374. package/img/cron-icon/crn-checkbox.svg +15 -0
  375. package/img/cron-icon/crn-container.svg +1 -0
  376. package/img/cron-icon/crn-cron-crud.svg +28 -0
  377. package/img/cron-icon/crn-datasource.svg +27 -0
  378. package/img/cron-icon/crn-dynamic-file.svg +1 -0
  379. package/img/cron-icon/crn-dynamic-image.svg +25 -0
  380. package/img/cron-icon/crn-enterprise-dynamic-combobox.svg +27 -0
  381. package/img/cron-icon/crn-evaluation.svg +1 -0
  382. package/img/cron-icon/crn-form.svg +24 -0
  383. package/img/cron-icon/crn-header.svg +18 -0
  384. package/img/cron-icon/crn-icon.svg +23 -0
  385. package/img/cron-icon/crn-image.svg +20 -0
  386. package/img/cron-icon/crn-infinite-scroll.svg +1 -0
  387. package/img/cron-icon/crn-input-floating.svg +1 -0
  388. package/img/cron-icon/crn-input-inline.svg +1 -0
  389. package/img/cron-icon/crn-ion-footer-bar.svg +1 -0
  390. package/img/cron-icon/crn-ion-list.svg +1 -0
  391. package/img/cron-icon/crn-item-swipe.svg +15 -0
  392. package/img/cron-icon/crn-kendo-chat.svg +1 -0
  393. package/img/cron-icon/crn-label.svg +1 -0
  394. package/img/cron-icon/crn-list-avatar.svg +1 -0
  395. package/img/cron-icon/crn-list-icon.svg +1 -0
  396. package/img/cron-icon/crn-list-item-avatar.svg +1 -0
  397. package/img/cron-icon/crn-list-item-icon.svg +1 -0
  398. package/img/cron-icon/crn-list-item-thumbnail.svg +1 -0
  399. package/img/cron-icon/crn-list-item.svg +1 -0
  400. package/img/cron-icon/crn-list-swipe.svg +17 -0
  401. package/img/cron-icon/crn-list-thumbnail.svg +17 -0
  402. package/img/cron-icon/crn-list.svg +16 -0
  403. package/img/cron-icon/crn-map.svg +1 -0
  404. package/img/cron-icon/crn-multiselect.svg +1 -0
  405. package/img/cron-icon/crn-paragraph.svg +1 -0
  406. package/img/cron-icon/crn-plugin.svg +44 -0
  407. package/img/cron-icon/crn-radio.svg +21 -0
  408. package/img/cron-icon/crn-radiogroup.svg +25 -0
  409. package/img/cron-icon/crn-range.svg +1 -0
  410. package/img/cron-icon/crn-rating.svg +20 -0
  411. package/img/cron-icon/crn-select.svg +1 -0
  412. package/img/cron-icon/crn-spacer.svg +1 -0
  413. package/img/cron-icon/crn-tabs-icon-only.svg +24 -0
  414. package/img/cron-icon/crn-tabs.svg +17 -0
  415. package/img/cron-icon/crn-text-component.svg +22 -0
  416. package/img/cron-icon/crn-textarea.svg +22 -0
  417. package/img/cron-icon/crn-textinput.svg +23 -0
  418. package/img/cron-icon/crn-textinputbutton.svg +33 -0
  419. package/img/cron-icon/crn-textinputicon.svg +29 -0
  420. package/img/cron-icon/crn-toggle.svg +1 -0
  421. package/img/cron-icon/crn-video.svg +1 -0
  422. package/img/placehold-100x100.png +0 -0
  423. package/img/placehold-900x500.png +0 -0
  424. package/img/qr-code.png +0 -0
  425. package/img/svg-charts.svg +1 -0
  426. package/img/user.svg +18 -0
  427. package/js/LanguageSelectDirective.js +30 -0
  428. package/js/LocaleService.js +59 -0
  429. package/js/app.authentication.js +594 -0
  430. package/js/app.js +349 -0
  431. package/js/controllers.authentication.js +540 -0
  432. package/js/controllers.js +90 -0
  433. package/js/custom.controllers.js +11 -0
  434. package/js/customModules.js +1 -0
  435. package/js/customStateProvider.js +107 -0
  436. package/js/directives.js +2426 -0
  437. package/js/filters.js +47 -0
  438. package/js/local-dateformat.directive.js +15 -0
  439. package/js/reports/parameters.controller.js +86 -0
  440. package/js/reports/reports.service.js +466 -0
  441. package/js/services.js +5 -0
  442. package/js/upload.service.js +165 -0
  443. package/lib/ionic/css/ionic.css +9802 -0
  444. package/lib/ionic/css/ionic.min.css +23 -0
  445. package/lib/ionic/fonts/ionicons.eot +0 -0
  446. package/lib/ionic/fonts/ionicons.svg +2230 -0
  447. package/lib/ionic/fonts/ionicons.ttf +0 -0
  448. package/lib/ionic/fonts/ionicons.woff +0 -0
  449. package/lib/ionic/js/angular/angular-animate.js +4115 -0
  450. package/lib/ionic/js/angular/angular-animate.min.js +56 -0
  451. package/lib/ionic/js/angular/angular-resource.js +768 -0
  452. package/lib/ionic/js/angular/angular-resource.min.js +15 -0
  453. package/lib/ionic/js/angular/angular-sanitize.js +717 -0
  454. package/lib/ionic/js/angular/angular-sanitize.min.js +15 -0
  455. package/lib/ionic/js/angular/angular.js +30714 -0
  456. package/lib/ionic/js/angular/angular.min.js +311 -0
  457. package/lib/ionic/js/angular-ui/angular-ui-router.js +4232 -0
  458. package/lib/ionic/js/angular-ui/angular-ui-router.min.js +7 -0
  459. package/lib/ionic/js/ionic-angular.js +14391 -0
  460. package/lib/ionic/js/ionic-angular.min.js +18 -0
  461. package/lib/ionic/js/ionic.bundle.js +67590 -0
  462. package/lib/ionic/js/ionic.bundle.min.js +472 -0
  463. package/lib/ionic/js/ionic.js +13356 -0
  464. package/lib/ionic/js/ionic.min.js +20 -0
  465. package/lib/ionic/scss/_action-sheet.scss +170 -0
  466. package/lib/ionic/scss/_animations.scss +48 -0
  467. package/lib/ionic/scss/_backdrop.scss +24 -0
  468. package/lib/ionic/scss/_badge.scss +62 -0
  469. package/lib/ionic/scss/_bar.scss +417 -0
  470. package/lib/ionic/scss/_button-bar.scss +92 -0
  471. package/lib/ionic/scss/_button.scss +252 -0
  472. package/lib/ionic/scss/_checkbox.scss +180 -0
  473. package/lib/ionic/scss/_form.scss +327 -0
  474. package/lib/ionic/scss/_grid.scss +159 -0
  475. package/lib/ionic/scss/_items.scss +825 -0
  476. package/lib/ionic/scss/_list.scss +125 -0
  477. package/lib/ionic/scss/_loading.scss +51 -0
  478. package/lib/ionic/scss/_menu.scss +70 -0
  479. package/lib/ionic/scss/_mixins.scss +642 -0
  480. package/lib/ionic/scss/_modal.scss +102 -0
  481. package/lib/ionic/scss/_platform.scss +77 -0
  482. package/lib/ionic/scss/_popover.scss +168 -0
  483. package/lib/ionic/scss/_popup.scss +110 -0
  484. package/lib/ionic/scss/_progress.scss +11 -0
  485. package/lib/ionic/scss/_radio.scss +47 -0
  486. package/lib/ionic/scss/_range.scss +160 -0
  487. package/lib/ionic/scss/_refresher.scss +113 -0
  488. package/lib/ionic/scss/_reset.scss +365 -0
  489. package/lib/ionic/scss/_scaffolding.scss +291 -0
  490. package/lib/ionic/scss/_select.scss +142 -0
  491. package/lib/ionic/scss/_slide-box.scss +71 -0
  492. package/lib/ionic/scss/_slides.scss +529 -0
  493. package/lib/ionic/scss/_spinner.scss +100 -0
  494. package/lib/ionic/scss/_tabs.scss +542 -0
  495. package/lib/ionic/scss/_toggle.scss +198 -0
  496. package/lib/ionic/scss/_transitions.scss +188 -0
  497. package/lib/ionic/scss/_type.scss +166 -0
  498. package/lib/ionic/scss/_util.scss +296 -0
  499. package/lib/ionic/scss/_variables.scss +764 -0
  500. package/lib/ionic/scss/ionic.scss +54 -0
  501. package/lib/ionic/scss/ionicons/_ionicons-font.scss +28 -0
  502. package/lib/ionic/scss/ionicons/_ionicons-icons.scss +1473 -0
  503. package/lib/ionic/scss/ionicons/_ionicons-variables.scss +741 -0
  504. package/lib/ionic/scss/ionicons/ionicons.scss +16 -0
  505. package/lib/ionic/version.json +6 -0
  506. package/lib/kendo/kendo.all.min.js +125 -0
  507. package/lib/kendo/kendo.default-v2.min.css +10 -0
  508. package/lib/notification-mobile.js +57 -0
  509. package/package.json +62 -0
  510. package/postupdate.json +407 -0
@@ -0,0 +1,90 @@
1
+ (function ($app) {
2
+ angular.module('custom.controllers', []);
3
+
4
+ app.controller('HomeController', ['$scope', '$http', '$rootScope', '$state', '$translate', 'Notification','ReportService','$ionicModal', function ($scope, $http, $rootScope, $state, $translate, Notification, ReportService,$ionicModal) {
5
+ $rootScope.http = $http;
6
+ app.registerEventsCronapi($scope, $translate,$ionicModal);
7
+ $scope.Notification = Notification;
8
+
9
+ $rootScope.getReport = function(reportName, params) {
10
+ ReportService.openReport(reportName, params);
11
+ };
12
+
13
+ for(var x in app.userEvents) {
14
+ if (app.userEvents.hasOwnProperty(x)) {
15
+ $scope[x] = app.userEvents[x].bind($scope);
16
+ }
17
+ }
18
+ $scope.message = {};
19
+
20
+ try {
21
+ var contextAfterHomeController = $controller('AfterHomeController', { $scope: $scope });
22
+ app.copyContext(contextAfterHomeController, this, 'AfterHomeController');
23
+ } catch(e) {}
24
+ try { if ($scope.blockly.events.afterHomeRender) $scope.blockly.events.afterHomeRender(); } catch(e) {}
25
+
26
+ }]);
27
+
28
+ app.controller('chatController', [
29
+ '$scope',
30
+ '$state',
31
+ '$ionicPopup',
32
+ '$ionicScrollDelegate',
33
+ '$timeout',
34
+ '$interval',
35
+ '$ionicModal',
36
+ '$translate',
37
+ '$rootScope',
38
+ '$http',
39
+ 'Notification',
40
+ function chatController($scope, $state,$ionicPopup, $ionicScrollDelegate, $timeout, $interval, $ionicModal,$translate,$rootScope,$http, Notification) {
41
+
42
+ app.registerEventsCronapi($scope, $translate);
43
+ $rootScope.http = $http;
44
+ $scope.Notification = Notification;
45
+ for(var x in app.userEvents) {
46
+ if (app.userEvents.hasOwnProperty(x)) {
47
+ $scope[x] = app.userEvents[x].bind($scope);
48
+ }
49
+ }
50
+
51
+ var viewScroll = $ionicScrollDelegate.$getByHandle('userMessageScroll');
52
+ var footerBar; // gets set in $ionicView.enter
53
+ var scroller;
54
+ var txtInput; // ^^^
55
+ $scope.enter = function () {
56
+ $timeout(function () {
57
+ footerBar = document.body.querySelector('.homeView .bar-footer');
58
+ scroller = document.body.querySelector('.homeView .scroll-content');
59
+ txtInput = angular.element(footerBar.querySelector('textarea'));
60
+ }, 0);
61
+ };
62
+ $scope.isEnter = function(e){
63
+ (e.keyCode === 13) ? $timeout(function(){
64
+ e.stopPropagation();
65
+ $('#sendButton').trigger('click')
66
+ },0): null;
67
+ };
68
+ $scope.refreshScroll = function (scrollBottom, timeout) {
69
+ $timeout(function () {
70
+ scrollBottom = scrollBottom || $scope.scrollDown;
71
+ viewScroll.resize();
72
+ if (scrollBottom) {
73
+ viewScroll.scrollBottom(true);
74
+ }
75
+ $scope.checkScroll();
76
+ }, timeout || 1000);
77
+ };
78
+ $scope.scrollDown = true;
79
+ $scope.checkScroll = function () {
80
+ $timeout(function () {
81
+ var currentTop = viewScroll.getScrollPosition().top;
82
+ var maxScrollableDistanceFromTop = viewScroll.getScrollView().__maxScrollTop;
83
+ $scope.scrollDown = (currentTop >= maxScrollableDistanceFromTop);
84
+ $scope.$apply();
85
+ }, 0);
86
+ return true;
87
+ };
88
+ }
89
+ ]);
90
+ } (app));
@@ -0,0 +1,11 @@
1
+ app.controller('AfterLoginController', function($scope) {
2
+ //
3
+ });
4
+
5
+ app.controller('AfterHomeController', function($scope) {
6
+ //
7
+ });
8
+
9
+ app.controller('AfterPageController', function($scope) {
10
+ //
11
+ });
@@ -0,0 +1 @@
1
+ window.customModules = [];
@@ -0,0 +1,107 @@
1
+ /*
2
+ To add your route in the angular, uncomment the code and use this structure
3
+ */
4
+ // window.customStateProvider = function($stateProvider) {
5
+ // $stateProvider
6
+ //
7
+ // .state('login', {
8
+ // url: "",
9
+ // cache: false,
10
+ // controller: 'LoginController',
11
+ // templateUrl: 'views/login.view.html'
12
+ // })
13
+ //
14
+ // .state('main', {
15
+ // url: "/",
16
+ // cache: false,
17
+ // controller: 'LoginController',
18
+ // templateUrl: 'views/login.view.html'
19
+ // })
20
+ //
21
+ // .state('publicRoot', {
22
+ // url: "/public/{name:.*}",
23
+ // cache: false,
24
+ // controller: 'PageController',
25
+ // templateUrl: function (urlattr) {
26
+ // return 'views/public/' + urlattr.name + '.view.html';
27
+ // }
28
+ // })
29
+ //
30
+ // .state('public', {
31
+ // url: "/app/public",
32
+ // cache: false,
33
+ // controller: 'PublicController',
34
+ // templateUrl: 'views/public/menu.view.html'
35
+ // })
36
+ //
37
+ // .state('public.home', {
38
+ // url: "/home",
39
+ // cache: false,
40
+ // views: {
41
+ // 'menuContent': {
42
+ // controller: 'PublicController',
43
+ // templateUrl: 'views/public/home.view.html'
44
+ // }
45
+ // }
46
+ // })
47
+ // .state('public.pages', {
48
+ // url: "/{name:.*}",
49
+ // cache: false,
50
+ // views: {
51
+ // 'menuContent': {
52
+ // controller: 'PageController',
53
+ // templateUrl: function (urlattr) {
54
+ // return 'views/public/' + urlattr.name + '.view.html';
55
+ // }
56
+ // }
57
+ // }
58
+ // })
59
+ //
60
+ // .state('app', {
61
+ // url: "/app",
62
+ // cache: false,
63
+ // controller: 'HomeController',
64
+ // templateUrl: 'plugins/cronapp-framework-mobile-js/dist/components/templates/menu.template.html'
65
+ // })
66
+ //
67
+ // .state('app.home', {
68
+ // url: "/home",
69
+ // cache: false,
70
+ // views: {
71
+ // 'menuContent': {
72
+ // controller: 'HomeController',
73
+ // templateUrl: 'views/logged/home.view.html'
74
+ // }
75
+ // }
76
+ // })
77
+ //
78
+ // .state('app.pages', {
79
+ // url: "/{name:.*}",
80
+ // cache: false,
81
+ // views: {
82
+ // 'menuContent': {
83
+ // controller: 'PageController',
84
+ // templateUrl: function (urlattr) {
85
+ // return 'views/' + urlattr.name + '.view.html';
86
+ // }
87
+ // }
88
+ // }
89
+ // })
90
+ //
91
+ // .state('404', {
92
+ // url: "/error/404",
93
+ // cache: false,
94
+ // controller: 'PageController',
95
+ // templateUrl: function (urlattr) {
96
+ // return 'views/error/404.view.html';
97
+ // }
98
+ // })
99
+ //
100
+ // .state('403', {
101
+ // url: "/error/403",
102
+ // cache: false,
103
+ // controller: 'PageController',
104
+ // templateUrl: function (urlattr) {
105
+ // return 'views/error/403.view.html';
106
+ // }
107
+ // });
@@ -0,0 +1,2426 @@
1
+ window.addEventListener('message', function(event) {
2
+ if (event.data == "reload") {
3
+ window.location.reload();
4
+ }
5
+ else if (event.data == "reload(true)") {
6
+ window.location.reload(true);
7
+ }
8
+ });
9
+
10
+ (function($app) {
11
+
12
+ app.common = {
13
+ generateId: function() {
14
+ var numbersOnly = '0123456789';
15
+ var result = Math.floor((1 + Math.random()) * 0x10000)
16
+ .toString(16)
17
+ .substring(1);
18
+ if (numbersOnly.indexOf(result.substr(0,1)) > -1)
19
+ return this.generateId();
20
+ return result;
21
+ }
22
+ };
23
+
24
+ var isoDate = /(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/;
25
+
26
+ /**
27
+ * Fun��o que retorna o formato que ser� utilizado no componente
28
+ * capturando o valor do atributo format do elemento, para mais formatos
29
+ * consulte os formatos permitidos em http://momentjs.com/docs/#/parsing/string-format/
30
+ *
31
+ */
32
+ var patternFormat = function(element) {
33
+ if (element) {
34
+ return $(element).attr('format') || 'DD/MM/YYYY';
35
+ }
36
+ return 'DD/MM/YYYY';
37
+ };
38
+
39
+ var parsePermission = function(perm) {
40
+ var result = {
41
+ visible: {
42
+ public: true
43
+ },
44
+ enabled: {
45
+ public: true
46
+ }
47
+ }
48
+
49
+ if (perm) {
50
+ var perms = perm.toLowerCase().trim().split(",");
51
+ for (var i=0;i<perms.length;i++) {
52
+ var p = perms[i].trim();
53
+ if (p) {
54
+ var pair = p.split(":");
55
+ if (pair.length == 2) {
56
+ var key = pair[0].trim();
57
+ var value = pair[1].trim();
58
+ if (value) {
59
+ var values = value.split(";");
60
+ var json = {};
61
+ for (var j=0;j<values.length;j++) {
62
+ var v = values[j].trim();
63
+ if (v) {
64
+ json[v] = true;
65
+ }
66
+ }
67
+ result[key] = json;
68
+ }
69
+ }
70
+ }
71
+ }
72
+ }
73
+ return result;
74
+ }
75
+
76
+ app.directive('updateLanguage', function ($rootScope) {
77
+ return {
78
+ link: function (scope, element) {
79
+ let listener = function (event, translationResp) {
80
+ let defaultLang = "en";
81
+ let currentLang = translationResp.language ? translationResp.language.split('_')[0] : null;
82
+ element.attr("lang", currentLang || defaultLang);
83
+ };
84
+ $rootScope.$on('$translateChangeSuccess', listener);
85
+ }
86
+ };
87
+ });
88
+
89
+ app.directive('asDate', maskDirectiveAsDate);
90
+
91
+ app.directive('input', transformText);
92
+
93
+ app.directive('textarea', transformText)
94
+
95
+ .directive('ngDestroy', function() {
96
+ return {
97
+ restrict: 'A',
98
+ link: function(scope, element, attrs, ctrl) {
99
+ element.on('$destroy', function() {
100
+ if (attrs.ngDestroy && attrs.ngDestroy.length > 0)
101
+ if (attrs.ngDestroy.indexOf('app.') > -1 || attrs.ngDestroy.indexOf('blockly.') > -1)
102
+ scope.$eval(attrs.ngDestroy);
103
+ else
104
+ eval(attrs.ngDestroy);
105
+ });
106
+ }
107
+ }
108
+ })
109
+
110
+ .filter('mask',function($translate) {
111
+ return function(value, maskValue, type) {
112
+ maskValue = parseMaskType(maskValue, $translate);
113
+ if (!maskValue)
114
+ return value;
115
+
116
+
117
+ var useUTC;
118
+
119
+ if (type !== undefined) {
120
+ useUTC = type == 'date' || type == 'datetime' || type == 'time';
121
+
122
+ if (!window.fixedTimeZone) {
123
+ useUTC = false;
124
+ }
125
+ } else {
126
+ useUTC = window.fixedTimeZone;
127
+ }
128
+
129
+ if (maskValue.indexOf(";local") > 0) {
130
+ useUTC = false;
131
+ }
132
+
133
+ maskValue = maskValue.replace(';1', '').replace(';0', '').replace(';local', '').trim();
134
+ if ((typeof value == "string" && value.match(isoDate)) || value instanceof Date) {
135
+ if (useUTC) {
136
+ return moment(value).utcOffset(window.timeZoneOffset).format(maskValue);
137
+ } else {
138
+ return moment(value).format(maskValue);
139
+ }
140
+ } else if (typeof value == 'number') {
141
+ return format(maskValue, value);
142
+ } else if (value != undefined && value != null && value != "" && maskValue != '') {
143
+ var input = $("<input type=\"text\">");
144
+ input.mask(maskValue);
145
+ return input.masked(value);
146
+ } else {
147
+ return value;
148
+ }
149
+ };
150
+ })
151
+
152
+ .directive('screenParams', [function() {
153
+ 'use strict';
154
+ return {
155
+ link: function(scope, elem, attrs, ctrl) {
156
+ var screenParams = eval(attrs.screenParams);
157
+ if (screenParams && screenParams.length) {
158
+ screenParams.forEach(function(screenParam) {
159
+ if (scope.params && !scope.params[screenParam.key])
160
+ scope.params[screenParam.key] = screenParam.value || '';
161
+ });
162
+ }
163
+ }
164
+ }
165
+ }])
166
+
167
+ .directive('mask', maskDirectiveMask)
168
+
169
+ .directive('dynamicImage', function($compile, $translate) {
170
+ return {
171
+ restrict: 'A',
172
+ scope: true,
173
+ require: 'ngModel',
174
+ link: function(scope, element, attr) {
175
+ let templateDyn =
176
+ '<div ngf-drop="" ngf-drag-over-class="dragover" class="dynamicImage" >\
177
+ <img role="img" alt="$altText$" style="width: 100%;" ng-if="$ngModel$" data-ng-src="{{$ngModel$.startsWith(\'http\') || ($ngModel$.startsWith(\'/\') && $ngModel$.length < 1000)? $ngModel$ : \'data:image/png;base64,\' + $ngModel$}}">\
178
+ <div class="btn action-button-border" ng-if="!$ngModel$" ngf-drop="" ngf-select="" ngf-change="cronapi.internal.setFile(\'$ngModel$\', $file)" ngf-pattern="\'image/*\'" ngf-max-size="$maxFileSize$">\
179
+ $userHtml$\
180
+ </div>\
181
+ <div aria-label="$closeAriaText$" class="remove-image-button button button-assertive" ng-if="$ngModel$" ng-click="$ngModel$=null">\
182
+ <span class="icon ion-android-close"></span>\
183
+ </div>\
184
+ <div aria-label="$videocamAriaText$" class="button button-positive buttomImage" ng-if="!$ngModel$" ng-click="cronapi.internal.startCamera(\'$ngModel$\',\'$quality$\',\'$allowEdit$\',\'$targetWidth$\',\'$targetHeight$\')">\
185
+ <span class="icon ion-ios-videocam"></span>\
186
+ </div>\
187
+ </div>';
188
+
189
+ const attributes = {
190
+ ngModel: attr.ngModel,
191
+ required: (attr.ngRequired && attr.ngRequired == "true")?"required":"",
192
+ content: element.html(),
193
+ altText: attr.alt ? attr.alt : $translate.instant('Users.view.Picture'),
194
+ closeAriaText: $translate.instant('Home.view.Close'),
195
+ videocamAriaText: $translate.instant('OpenCamera'),
196
+ maxFileSize: attr.maxFileSize ? attr.maxFileSize : "",
197
+ quality: attr.quality ? attr.quality : "60",
198
+ allowEdit: attr.allowEdit ? attr.allowEdit : "false",
199
+ targetWidth: attr.targetWidth ? attr.targetWidth : "640",
200
+ targetHeight: attr.targetHeight ? attr.targetHeight : "480"
201
+ };
202
+
203
+ templateDyn = $(templateDyn
204
+ .split('$ngModel$').join(attributes.ngModel)
205
+ .split('$required$').join(attributes.required)
206
+ .split('$userHtml$').join(attributes.content)
207
+ .split('$maxFileSize$').join(attributes.maxFileSize)
208
+ .split('$altText$').join(attributes.altText)
209
+ .split('$closeAriaText$').join(attributes.closeAriaText)
210
+ .split('$videocamAriaText$').join(attributes.videocamAriaText)
211
+ .split('$quality$').join(attributes.quality)
212
+ .split('$allowEdit$').join(attributes.allowEdit)
213
+ .split('$targetWidth$').join(attributes.targetWidth)
214
+ .split('$targetHeight$').join(attributes.targetHeight)
215
+ );
216
+
217
+ $(element).html(templateDyn);
218
+ $compile(templateDyn)(element.scope());
219
+ }
220
+ }
221
+ })
222
+ .directive('dynamicFile', function($compile, $translate) {
223
+ var template = '';
224
+ return {
225
+ restrict: 'A',
226
+ scope: true,
227
+ require: 'ngModel',
228
+ link: function(scope, element, attr) {
229
+ var s = scope;
230
+ var required = (attr.ngRequired && attr.ngRequired == "true"?"required":"");
231
+ var closeAriaText = $translate.instant('Home.view.Close');
232
+ var splitedNgModel = attr.ngModel.split('.');
233
+ var datasource = splitedNgModel[0];
234
+ var field = splitedNgModel[splitedNgModel.length-1];
235
+ var number = Math.floor((Math.random() * 1000) + 20);
236
+ var content = element.html();
237
+
238
+ var maxFileSize = "";
239
+ if (attr.maxFileSize)
240
+ maxFileSize = attr.maxFileSize;
241
+
242
+ var fileInfo = attr.fileInfo ? `'${attr.fileInfo}'`: 'undefined';
243
+
244
+ var templateDyn = '\
245
+ <div ng-show="!$ngModel$" ngf-drop="" ngf-drag-over-class="dragover">\
246
+ <div class="btn action-button-border" ngf-drop="" ngf-select="" ngf-change="cronapi.internal.uploadFile(\'$ngModel$\', $file, \'uploadprogress$number$\', $fileInfo$)" ngf-max-size="$maxFileSize$">\
247
+ $userHtml$\
248
+ </div>\
249
+ <div class="progress" data-type="bootstrapProgress" id="uploadprogress$number$" style="display:none">\
250
+ <div class="progress-bar" role="progressbar" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" style="width:0%">\
251
+ <span class="sr-only"></span>\
252
+ </div>\
253
+ </div>\
254
+ </div> \
255
+ <div ng-show="$ngModel$" class="upload-image-component-attribute"> \
256
+ <div aria-label="$closeAriaText$" class="button button-assertive" style="float:right;" ng-if="$ngModel$" ng-click="$ngModel$=null"> \
257
+ <span role="img" alt="$closeAriaText$" class="icon ion-android-close"></span> \
258
+ </div> \
259
+ <div> \
260
+ <div ng-bind-html="cronapi.internal.generatePreviewDescriptionByte($ngModel$, $fileInfo$)"></div> \
261
+ <div aria-label="Download" class="button button-positive" ng-click="cronapi.internal.downloadFileEntityMobile($datasource$,\'$field$\', undefined, $fileInfo$)">$lblDownload$</div> \
262
+ </div> \
263
+ </div> \
264
+ ';
265
+ templateDyn = $(templateDyn
266
+ .split('$ngModel$').join(attr.ngModel)
267
+ .split('$datasource$').join(datasource)
268
+ .split('$field$').join(field)
269
+ .split('$number$').join(number)
270
+ .split('$required$').join(required)
271
+ .split('$userHtml$').join(content)
272
+ .split('$maxFileSize$').join(maxFileSize)
273
+ .split('$closeAriaText$').join(closeAriaText)
274
+ .split('$lblDownload$').join($translate.instant('download'))
275
+ .split('$fileInfo$').join(fileInfo)
276
+ );
277
+
278
+ $(element).html(templateDyn);
279
+ $compile(templateDyn)(element.scope());
280
+ }
281
+ }
282
+ })
283
+ .directive('pwCheck', [function() {
284
+ 'use strict';
285
+ return {
286
+ require: 'ngModel',
287
+ link: function(scope, elem, attrs, ctrl) {
288
+ var firstPassword = '#' + attrs.pwCheck;
289
+ elem.add(firstPassword).on('keyup', function() {
290
+ scope.$apply(function() {
291
+ var v = elem.val() === $(firstPassword).val();
292
+ ctrl.$setValidity('pwmatch', v);
293
+ });
294
+ });
295
+ }
296
+ }
297
+ }])
298
+
299
+ .directive('qr', ['$window', function($window){
300
+ return {
301
+ restrict: 'EA',
302
+ require: '^ngModel',
303
+ template: '<canvas ng-hide="image"></canvas><img alt="qr-code" ng-if="image" ng-src="{{canvasImage}}"/>',
304
+ link: function postlink(scope, element, attrs, ngModel){
305
+ if (scope.size === undefined && attrs.size) {
306
+ scope.text = attrs.size;
307
+ }
308
+ var getTypeNumeber = function(){
309
+ return scope.typeNumber || 0;
310
+ };
311
+ var getCorrection = function(){
312
+ var levels = {
313
+ 'L': 1,
314
+ 'M': 0,
315
+ 'Q': 3,
316
+ 'H': 2
317
+ };
318
+ var correctionLevel = scope.correctionLevel || 0;
319
+ return levels[correctionLevel] || 0;
320
+ };
321
+ var getText = function(){
322
+ return ngModel.$modelValue || "";
323
+ };
324
+ var getSize = function(){
325
+ return scope.size || $(element).outerWidth();
326
+ };
327
+ var isNUMBER = function(text){
328
+ var ALLOWEDCHARS = /^[0-9]*$/;
329
+ return ALLOWEDCHARS.test(text);
330
+ };
331
+ var isALPHA_NUM = function(text){
332
+ var ALLOWEDCHARS = /^[0-9A-Z $%*+\-./:]*$/;
333
+ return ALLOWEDCHARS.test(text);
334
+ };
335
+ var is8bit = function(text){
336
+ for (var i = 0; i < text.length; i++) {
337
+ var code = text.charCodeAt(i);
338
+ if (code > 255) {
339
+ return false;
340
+ }
341
+ }
342
+ return true;
343
+ };
344
+ var checkInputMode = function(inputMode, text){
345
+ if (inputMode === 'NUMBER' && !isNUMBER(text)) {
346
+ throw new Error('The `NUMBER` input mode is invalid for text.');
347
+ }
348
+ else if (inputMode === 'ALPHA_NUM' && !isALPHA_NUM(text)) {
349
+ throw new Error('The `ALPHA_NUM` input mode is invalid for text.');
350
+ }
351
+ else if (inputMode === '8bit' && !is8bit(text)) {
352
+ throw new Error('The `8bit` input mode is invalid for text.');
353
+ }
354
+ else if (!is8bit(text)) {
355
+ throw new Error('Input mode is invalid for text.');
356
+ }
357
+ return true;
358
+ };
359
+ var getInputMode = function(text){
360
+ var inputMode = scope.inputMode;
361
+ inputMode = inputMode || (isNUMBER(text) ? 'NUMBER' : undefined);
362
+ inputMode = inputMode || (isALPHA_NUM(text) ? 'ALPHA_NUM' : undefined);
363
+ inputMode = inputMode || (is8bit(text) ? '8bit' : '');
364
+ return checkInputMode(inputMode, text) ? inputMode : '';
365
+ };
366
+ var canvas = element.find('canvas')[0];
367
+ var canvas2D = !!$window.CanvasRenderingContext2D;
368
+ scope.TYPE_NUMBER = getTypeNumeber();
369
+ scope.TEXT = getText();
370
+ scope.CORRECTION = getCorrection();
371
+ scope.SIZE = getSize();
372
+ scope.INPUT_MODE = getInputMode(scope.TEXT);
373
+ scope.canvasImage = '';
374
+ var draw = function(context, qr, modules, tile){
375
+ for (var row = 0; row < modules; row++) {
376
+ for (var col = 0; col < modules; col++) {
377
+ var w = (Math.ceil((col + 1) * tile) - Math.floor(col * tile)),
378
+ h = (Math.ceil((row + 1) * tile) - Math.floor(row * tile));
379
+ context.fillStyle = qr.isDark(row, col) ? '#000' : '#fff';
380
+ context.fillRect(Math.round(col * tile), Math.round(row * tile), w, h);
381
+ }
382
+ }
383
+ };
384
+ var render = function(canvas, value, typeNumber, correction, size, inputMode){
385
+ var trim = /^\s+|\s+$/g;
386
+ var text = value.replace(trim, '');
387
+ var qr = new QRCode(typeNumber, correction, inputMode);
388
+ qr.addData(text);
389
+ qr.make();
390
+ var context = canvas.getContext('2d');
391
+ var modules = qr.getModuleCount();
392
+ var tile = size / modules;
393
+ canvas.width = canvas.height = size;
394
+ if (canvas2D) {
395
+ draw(context, qr, modules, tile);
396
+ scope.canvasImage = canvas.toDataURL() || '';
397
+ }
398
+ };
399
+
400
+ scope.$watch(function(){return ngModel.$modelValue}, function(value, old){
401
+ if (value !== old || value !== scope.TEXT) {
402
+ scope.text = ngModel.$modelValue;
403
+ scope.TEXT = getText();
404
+ scope.INPUT_MODE = getInputMode(scope.TEXT);
405
+ render(canvas, scope.TEXT, scope.TYPE_NUMBER, scope.CORRECTION, scope.SIZE, scope.INPUT_MODE);
406
+ }
407
+ });
408
+ render(canvas, scope.TEXT, scope.TYPE_NUMBER, scope.CORRECTION, scope.SIZE, scope.INPUT_MODE);
409
+ }};
410
+ }])
411
+
412
+ /**
413
+ * Valida��o de campos CPF e CNPJ,
414
+ * para utilizar essa diretiva, adicione o atributo valid com o valor
415
+ * do tipo da valida��o (cpf ou cnpj). Exemplo <input type="text" valid="cpf">
416
+ */
417
+ .directive('valid', function() {
418
+ return {
419
+ require: '^ngModel',
420
+ restrict: 'A',
421
+ link: function(scope, element, attrs, ngModel) {
422
+ var validator = {
423
+ 'cpf': CPF,
424
+ 'cnpj': CNPJ
425
+ };
426
+
427
+ ngModel.$validators[attrs.valid] = function(modelValue, viewValue) {
428
+ var value = modelValue || viewValue;
429
+ var fieldValid = validator[attrs.valid].isValid(value);
430
+ if (!fieldValid) {
431
+ element.scope().$applyAsync(function(){ element[0].setCustomValidity(element[0].dataset['errorMessage']); }) ;
432
+ } else {
433
+ element[0].setCustomValidity("");
434
+ }
435
+ return (fieldValid || !value);
436
+ };
437
+ }
438
+ }
439
+ })
440
+
441
+ .directive('cronappSecurity', function() {
442
+ return {
443
+ restrict: 'A',
444
+ link: function(scope, element, attrs) {
445
+ var roles = [];
446
+ var user = JSON.parse(localStorage.getItem('_u'))
447
+ if (user && user.roles) {
448
+ roles = user.roles.toLowerCase().split(",");
449
+ }
450
+
451
+ var perms = parsePermission(attrs.cronappSecurity);
452
+ var show = false;
453
+ var enabled = false;
454
+ for (var i=0;i<roles.length;i++) {
455
+ var role = roles[i].trim();
456
+ if (role) {
457
+ if (perms.visible[role]) {
458
+ show = true;
459
+ }
460
+ if (perms.enabled[role]) {
461
+ enabled = true;
462
+ }
463
+ }
464
+ }
465
+
466
+ if (!show) {
467
+ $(element).hide();
468
+ }
469
+
470
+ if (!enabled) {
471
+ $(element).find('*').addBack().attr('disabled', true);
472
+ }
473
+ }
474
+ }
475
+ })
476
+
477
+ .directive('cronappStars', [function() {
478
+ 'use strict';
479
+ return {
480
+ restrict: 'A',
481
+ require: 'ngModel',
482
+ link: function(scope, elem, attrs, ngModelCtrl) {
483
+
484
+ var $elem = $(elem);
485
+ var $star = $('<i style="font-size: 200%" class="component-holder ion ion-android-star-outline" style="" xattr-size="" data-component="crn-icon"></i>' );
486
+
487
+ $elem.html("");
488
+ var stars = [];
489
+
490
+ for (var i=1;i<=5;i++) {
491
+ var clonned = $star.clone();
492
+ $elem.append(clonned);
493
+
494
+ clonned.attr("idx", i);
495
+ clonned.click(function() {
496
+ scope.$apply(function() {
497
+ ngModelCtrl.$viewValue = parseInt($(this).attr("idx")); //set new view value
498
+ ngModelCtrl.$commitViewValue();
499
+
500
+ }.bind(this));
501
+ });
502
+
503
+ stars.push(clonned);
504
+ }
505
+
506
+ function changeStars(value) {
507
+ for (var i=1;i<=5;i++) {
508
+ stars[i-1].removeClass('ion-android-star-outline');
509
+ stars[i-1].removeClass('ion-android-star');
510
+ if (i <= value) {
511
+ stars[i-1].addClass('ion-android-star');
512
+ } else {
513
+ stars[i-1].addClass('ion-android-star-outline');
514
+ }
515
+ }
516
+
517
+ return value;
518
+ }
519
+
520
+ ngModelCtrl.$parsers.push(changeStars);
521
+ ngModelCtrl.$formatters.push(changeStars);
522
+
523
+ }
524
+ }
525
+ }])
526
+
527
+ .directive('cronappRating', [function() {
528
+ 'use strict';
529
+ return {
530
+ restrict: 'E',
531
+ require: 'ngModel',
532
+ link: function(scope, elem, attrs, ngModelCtrl) {
533
+
534
+ attrs.theme = $(elem).find('i').attr('xattr-theme');
535
+ attrs.iconOn = $(elem).find('i').attr('class');
536
+
537
+ var $elem = $(elem);
538
+ var starArray = []
539
+
540
+ if(attrs.xattrDefaultValue){
541
+ ngModelCtrl.$viewValue = 0; //set new view value
542
+ ngModelCtrl.$commitViewValue();
543
+ }
544
+
545
+ for (var i=1;i<=5;i++) {
546
+ starArray.push($(elem).find('i').get(i - 1));
547
+ $(starArray[i-1]).addClass(attrs.iconOff || "fa fa-star-o");
548
+ }
549
+
550
+ $elem.html("");
551
+ var stars = [];
552
+
553
+ for (var i=1;i<=5;i++) {
554
+ var clonned = $(starArray[i-1]).clone();
555
+ $elem.append(clonned);
556
+
557
+ clonned.attr("idx", i);
558
+ clonned.click(function() {
559
+ scope.$apply(function() {
560
+ let idx = parseInt($(this).attr("idx"));
561
+ //set new view value or reset the value
562
+ ngModelCtrl.$viewValue = ( ngModelCtrl.$viewValue !== idx ) ? idx : 0;
563
+ ngModelCtrl.$commitViewValue();
564
+
565
+ }.bind(this));
566
+ });
567
+
568
+ stars.push(clonned);
569
+ }
570
+
571
+ function changeStars(value) {
572
+ for (var i=1;i<=5;i++) {
573
+ stars[i-1].removeClass(attrs.iconOff || "ion ion-android-star-outline");
574
+ stars[i-1].removeClass(attrs.iconOn);
575
+ stars[i-1].removeClass(attrs.theme);
576
+ if (i <= value) {
577
+ stars[i-1].addClass(attrs.iconOn);
578
+ stars[i-1].addClass(attrs.theme);
579
+ } else {
580
+ stars[i-1].addClass(attrs.iconOff || "ion ion-android-star-outline");
581
+ stars[i-1].addClass(attrs.theme);
582
+ }
583
+ }
584
+ return value;
585
+ }
586
+ ngModelCtrl.$parsers.push(changeStars);
587
+ ngModelCtrl.$formatters.push(changeStars);
588
+
589
+ }
590
+ }
591
+ }])
592
+
593
+ .directive('ngInitialValue', function($parse) {
594
+ return {
595
+ restrict: 'A',
596
+ require: 'ngModel',
597
+ link: function(scope, element, attrs, ngModelCtrl) {
598
+ if (attrs.ngInitialValue) {
599
+ var modelGetter = $parse(attrs['ngModel']);
600
+ var modelSetter = modelGetter.assign;
601
+ var evaluated;
602
+
603
+ try {
604
+ evaluated = scope.$eval(attrs.ngInitialValue);
605
+ } catch (e) {
606
+ evaluated = attrs.ngInitialValue;
607
+ }
608
+
609
+ // verifica se é um checkbox para transformar para um valor booleano
610
+ if (element[0].type == 'checkbox' && evaluated) {
611
+ evaluated = ('' + evaluated).toLowerCase() == 'true';
612
+ }
613
+
614
+ modelSetter(scope, evaluated);
615
+ }
616
+ }
617
+ }
618
+ })
619
+
620
+ .directive('crnAllowNullValues', [function () {
621
+ return {
622
+ restrict: 'A',
623
+ require: '?ngModel',
624
+ link: function (scope, el, attrs, ctrl) {
625
+ ctrl.$formatters = [];
626
+ ctrl.$parsers = [];
627
+ let falseValue = attrs.ngFalseValue ? attrs.ngFalseValue.split("'").join("") : "false";
628
+ let trueValue = attrs.ngTrueValue ? attrs.ngTrueValue.split("'").join("") : "true";
629
+
630
+ if (attrs.crnAllowNullValues == 'true') {
631
+ ctrl.$render = function () {
632
+ let viewValue = ctrl.$viewValue;
633
+ el.data('checked', viewValue);
634
+ switch (viewValue) {
635
+ case true:
636
+ case trueValue:
637
+ el.removeAttr('indeterminate');
638
+ el.prop('checked', true);
639
+ break;
640
+ case false:
641
+ case falseValue:
642
+ el.removeAttr('indeterminate');
643
+ el.prop('checked', false);
644
+ break;
645
+ default:
646
+ el.attr('indeterminate', true);
647
+ }
648
+ };
649
+ el.bind('click', function () {
650
+ let checked;
651
+ switch (el.data('checked')) {
652
+ case false:
653
+ case falseValue:
654
+ checked = attrs.ngTrueValue ? trueValue : true;
655
+ break;
656
+ default:
657
+ checked = attrs.ngFalseValue ? falseValue : false;
658
+ }
659
+ ctrl.$setViewValue(checked);
660
+ scope.$apply(ctrl.$render);
661
+ });
662
+ } else if (attrs.crnAllowNullValues == 'false'){
663
+ ctrl.$render = function () {
664
+ let viewValue = ctrl.$viewValue;
665
+ if(viewValue === undefined || viewValue === null){
666
+ ctrl.$setViewValue(false);
667
+ viewValue = false;
668
+ }
669
+ el.data('checked', viewValue);
670
+ switch (viewValue) {
671
+ case true:
672
+ case trueValue:
673
+ el.removeAttr('indeterminate');
674
+ el.prop('checked', true);
675
+ break;
676
+ default:
677
+ el.removeAttr('indeterminate');
678
+ el.prop('checked', false);
679
+ break;
680
+ }
681
+ };
682
+ el.bind('click', function () {
683
+ let checked;
684
+ switch (el.data('checked')) {
685
+ case false:
686
+ case falseValue:
687
+ checked = attrs.ngTrueValue ? trueValue : true;
688
+ break;
689
+ default:
690
+ checked = attrs.ngFalseValue ? falseValue : false;
691
+ }
692
+ ctrl.$setViewValue(checked);
693
+ scope.$apply(ctrl.$render);
694
+ });
695
+ }
696
+ }
697
+ };
698
+ }])
699
+
700
+ .directive('cronappFilter', function($compile) {
701
+ var setFilterInButton = function($element, bindedFilter, operator) {
702
+ var fieldset = $element.closest('div');
703
+ if (!fieldset)
704
+ return;
705
+ var button = fieldset.find('button[cronapp-filter]');
706
+ if (!button)
707
+ return;
708
+
709
+ var filters = button.data('filters');
710
+ if (!filters)
711
+ filters = [];
712
+
713
+ var index = -1;
714
+ var ngModel = $element.attr('ng-model');
715
+ $(filters).each(function(idx) {
716
+ if (this.ngModel == ngModel)
717
+ index = idx;
718
+ });
719
+
720
+ if (index > -1)
721
+ filters.splice(index, 1);
722
+
723
+ if (bindedFilter.length > 0) {
724
+ var bindedFilterJson = {
725
+ "ngModel" : ngModel,
726
+ "bindedFilter" : bindedFilter
727
+ };
728
+ filters.push(bindedFilterJson);
729
+ }
730
+ button.data('filters', filters);
731
+ }
732
+
733
+ var makeAutoPostSearch = function($element, bindedFilter, datasource, attrs) {
734
+ var fieldset = $element.closest('div');
735
+ if (fieldset && fieldset.length > 0) {
736
+ var button = fieldset.find('button[cronapp-filter]');
737
+ if (button && button.length > 0) {
738
+ var filters = button.data('filters');
739
+ if (filters && filters.length > 0) {
740
+ bindedFilter = '';
741
+ $(filters).each(function() {
742
+ bindedFilter += this.bindedFilter+";";
743
+ });
744
+ }
745
+ }
746
+ }
747
+ datasource.search(bindedFilter, (attrs.cronappFilterCaseinsensitive=="true"));
748
+ }
749
+
750
+ var inputBehavior = function(scope, element, attrs, ngModelCtrl, $element, typeElement, operator, autopost) {
751
+ var filterTemplate = '';
752
+ var filtersSplited = attrs.cronappFilter.split(';');
753
+ var datasource;
754
+ if (attrs.crnDatasource) {
755
+ datasource = eval(attrs.crnDatasource);
756
+ } else {
757
+ var fieldset = $element.closest('div');
758
+ if (!fieldset)
759
+ return;
760
+ var button = fieldset.find('button[cronapp-filter]');
761
+ if (!button)
762
+ return;
763
+
764
+ if (!button.attr('crn-datasource')) {
765
+ return;
766
+ }
767
+
768
+ datasource = eval(button.attr('crn-datasource'));
769
+ }
770
+
771
+ var isOData = datasource.isOData()
772
+ $(filtersSplited).each(function() {
773
+ if (this.length > 0) {
774
+ if (filterTemplate != "") {
775
+ if (isOData) {
776
+ filterTemplate += " or ";
777
+ } else {
778
+ filterTemplate += ";";
779
+ }
780
+ }
781
+
782
+ if (isOData) {
783
+ if (operator == "=" && typeElement == 'text' && filterTemplate == "") {
784
+ filterTemplate = "substringof({value.lower}, tolower("+this+"))";
785
+ }
786
+ else if (operator == "=") {
787
+ filterTemplate += " substringof({value.lower},tolower("+this+"))";
788
+ }
789
+ else if (operator == "!=") {
790
+ filterTemplate += this + " ne {value}";
791
+ }
792
+ else if (operator == ">") {
793
+ filterTemplate += this + " gt {value}";
794
+ }
795
+ else if (operator == ">=") {
796
+ filterTemplate += this + " ge {value}";
797
+ }
798
+ else if (operator == "<") {
799
+ filterTemplate += this + " lt {value}";
800
+ }
801
+ else if (operator == "<=") {
802
+ filterTemplate += this + " le {value}";
803
+ }
804
+ } else {
805
+ if (typeElement == 'text') {
806
+ filterTemplate += this + '@' + operator + '%{value}%';
807
+ } else {
808
+ filterTemplate += this + operator + '{value}';
809
+ }
810
+ }
811
+ }
812
+ });
813
+ if (filterTemplate.length == 0) {
814
+ if (isOData) {
815
+ filterTemplate = "{value}";
816
+ } else {
817
+ filterTemplate = '%{value}%';
818
+ }
819
+ }
820
+
821
+ if (ngModelCtrl) {
822
+ scope.$watch(attrs.ngModel, function(newVal, oldVal) {
823
+ if (angular.equals(newVal, oldVal)) { return; }
824
+ var eType = $element.data('type') || $element.attr('type');
825
+ var value = ngModelCtrl.$modelValue;
826
+
827
+ if (isOData) {
828
+
829
+ if (value instanceof Date) {
830
+ if (eType == "datetime-local") {
831
+ value = "datetimeoffset'" + value.toISOString() + "'";
832
+ } else {
833
+ value = "datetime'" + value.toISOString().substring(0, 23) + "'";
834
+ }
835
+ }
836
+
837
+ else if (typeof value == "number") {
838
+ value = value;
839
+ }
840
+
841
+ else if (typeof value == "boolean") {
842
+ value = value;
843
+ } else {
844
+ value = "'" + value + "'";
845
+ }
846
+
847
+ } else {
848
+ if (value instanceof Date) {
849
+ value = value.toISOString();
850
+ if (eType == "date") {
851
+ value = value + "@@date";
852
+ }
853
+ else if (eType == "time" || eType == "time-local") {
854
+ value = value + "@@time";
855
+ }
856
+ else {
857
+ value = value + "@@datetime";
858
+ }
859
+ }
860
+
861
+ else if (typeof value == "number") {
862
+ value = value + "@@number";
863
+ }
864
+
865
+ else if (typeof value == "boolean") {
866
+ value = value + "@@boolean";
867
+ }
868
+
869
+ }
870
+ var bindedFilter = filterTemplate.split('{value}').join(value);
871
+ if (typeof value == 'string') {
872
+ bindedFilter = bindedFilter.split('{value.lower}').join(value.toLowerCase());
873
+ } else {
874
+ bindedFilter = bindedFilter.split('{value.lower}').join(value);
875
+ }
876
+ if (ngModelCtrl.$viewValue.length == 0)
877
+ bindedFilter = '';
878
+
879
+ setFilterInButton($element, bindedFilter, operator);
880
+ if (autopost)
881
+ makeAutoPostSearch($element, bindedFilter, datasource, attrs);
882
+
883
+ });
884
+ }
885
+ else {
886
+ if (typeElement == 'text') {
887
+ $element.on("keyup", function() {
888
+ var datasource = eval(attrs.crnDatasource);
889
+ var value = undefined;
890
+ if (ngModelCtrl && ngModelCtrl != undefined)
891
+ value = ngModelCtrl.$viewValue;
892
+ else
893
+ value = this.value;
894
+ var bindedFilter = filterTemplate.split('{value}').join(value);
895
+ if (this.value.length == 0)
896
+ bindedFilter = '';
897
+
898
+ setFilterInButton($element, bindedFilter, operator);
899
+ if (autopost)
900
+ makeAutoPostSearch($element, bindedFilter, datasource, attrs);
901
+ });
902
+ }
903
+ else {
904
+ $element.on("change", function() {
905
+ var datasource = eval(attrs.crnDatasource);
906
+ var value = undefined;
907
+ var typeElement = $(this).attr('type');
908
+ if (attrs.asDate != undefined)
909
+ typeElement = 'date';
910
+
911
+ if (ngModelCtrl && ngModelCtrl != undefined) {
912
+ value = ngModelCtrl.$viewValue;
913
+ }
914
+ else {
915
+ if (typeElement == 'checkbox')
916
+ value = $(this).is(':checked');
917
+ else if (typeElement == 'date') {
918
+ value = this.value;
919
+ if (this.value.length > 0) {
920
+ var momentDate = moment(this.value, patternFormat(this));
921
+ value = momentDate.toDate().toISOString();
922
+ }
923
+ }
924
+ else
925
+ value = this.value;
926
+ }
927
+ var bindedFilter = filterTemplate.split('{value}').join(value);
928
+ if (value.toString().length == 0)
929
+ bindedFilter = '';
930
+
931
+ setFilterInButton($element, bindedFilter, operator);
932
+ if (autopost)
933
+ makeAutoPostSearch($element, bindedFilter, datasource, attrs);
934
+ });
935
+ }
936
+ }
937
+ }
938
+
939
+ var forceDisableDatasource = function(datasourceName, scope) {
940
+ var disableDatasource = setInterval(function() {
941
+ try {
942
+ var datasourceInstance = eval(datasourceName);
943
+ if (datasourceInstance) {
944
+ $(document).ready(function() {
945
+ var time = 0;
946
+ var intervalForceDisable = setInterval(function() {
947
+ if (time < 10) {
948
+ scope.$apply(function () {
949
+ datasourceInstance.enabled = false;
950
+ datasourceInstance.data = [];
951
+ });
952
+ time++;
953
+ }
954
+ else
955
+ clearInterval(intervalForceDisable);
956
+ }, 20);
957
+ });
958
+ clearInterval(disableDatasource);
959
+ }
960
+ }
961
+ catch(e) {
962
+ //try again, until render
963
+ }
964
+ },10);
965
+ }
966
+
967
+ var buttonBehavior = function(scope, element, attrs, ngModelCtrl, $element, typeElement, operator, autopost) {
968
+ var datasourceName = '';
969
+ if (attrs.crnDatasource)
970
+ datasourceName = attrs.crnDatasource;
971
+ else
972
+ datasourceName = $element.parent().attr('crn-datasource');
973
+
974
+ var datasource = eval(datasourceName);
975
+ var isOData = datasource.isOData()
976
+
977
+ var requiredFilter = attrs.requiredFilter && attrs.requiredFilter.toString() == "true";
978
+ if (requiredFilter) {
979
+ this.forceDisableDatasource(datasourceName, scope);
980
+ }
981
+
982
+ $element.on('click', function() {
983
+ var $this = $(this);
984
+ var filters = $this.data('filters');
985
+ if (datasourceName && datasourceName.length > 0 && filters) {
986
+ var bindedFilter = '';
987
+ $(filters).each(function() {
988
+ if (bindedFilter != '') {
989
+ bindedFilter += (isOData?" and ":";");
990
+ }
991
+ bindedFilter += this.bindedFilter;
992
+ });
993
+
994
+ var datasourceToFilter = eval(datasourceName);
995
+
996
+ if (requiredFilter) {
997
+ datasourceToFilter.enabled = bindedFilter.length > 0;
998
+ if (datasourceToFilter.enabled) {
999
+ datasourceToFilter.search(bindedFilter, (attrs.cronappFilterCaseinsensitive=="true"));
1000
+ }
1001
+ else {
1002
+ scope.$apply(function () {
1003
+ datasourceToFilter.data = [];
1004
+ });
1005
+ }
1006
+ }
1007
+ else
1008
+ datasourceToFilter.search(bindedFilter, (attrs.cronappFilterCaseinsensitive=="true"));
1009
+ }
1010
+ });
1011
+ }
1012
+
1013
+ return {
1014
+ restrict: 'A',
1015
+ require: '?ngModel',
1016
+ link: function(scope, element, attrs, ngModelCtrl) {
1017
+ var $element = $(element);
1018
+ var typeElement = $element.data('type') || $element.attr('type');
1019
+ if (attrs.asDate != undefined)
1020
+ typeElement = 'date';
1021
+
1022
+ var operator = '=';
1023
+ if (attrs.cronappFilterOperator && attrs.cronappFilterOperator.length > 0)
1024
+ operator = attrs.cronappFilterOperator;
1025
+
1026
+ var autopost = true;
1027
+ if (attrs.cronappFilterAutopost && attrs.cronappFilterAutopost == "false")
1028
+ autopost = false;
1029
+
1030
+ //Correção para aceitar datasources fora de ordem
1031
+ setTimeout(function() {
1032
+ if ($element[0].tagName == "INPUT")
1033
+ inputBehavior(scope, element, attrs, ngModelCtrl, $element, typeElement, operator, autopost);
1034
+ else
1035
+ buttonBehavior(scope, element, attrs, ngModelCtrl, $element, typeElement, operator, autopost);
1036
+ }, 100);
1037
+ }
1038
+ }
1039
+ })
1040
+
1041
+ .directive('cronList', ['$compile', '$parse', function($compile, $parse){
1042
+ 'use strict';
1043
+
1044
+ const defaultAdvancedTemplate =
1045
+ "<ion-list type=\"\" can-swipe=\"listCanSwipe\">\n" +
1046
+ " <ion-item ng-class=\"{'cron-list-selected' : isChecked(rowData)}\" class=\"item {{options.editableButtonClass}} {{options.iconClassPosition}} {{options.imageClassPosition}}\" ng-repeat=\"rowData in datasource\">\n" +
1047
+ " <ul ng-if=\"options.allowMultiselect\" class=\"checkbox-group component-holder {{'cron-list-multiselect-' + options.imageType}}\" data-component=\"crn-checkbox\"><label class=\"checkbox\"><input ng-checked=\"isChecked(rowData);\" type=\"checkbox\"></label></ul>\n" +
1048
+ " <img alt='Thumbnail' ng-if=\"options.imageType !== 'do-not-show' && rowData[options.fields.image]\" \n" +
1049
+ " ng-src=\"{{options.isImageFromDropbox ? '' : 'data:image/png;base64,'}}{{rowData[options.fields.image]}}\" class=\"{{options.imageToClassPosition}}\">\n" +
1050
+ " <div class=\"{{options.xattrTextPosition}} {{options.textToClassPosition}}\">\n" +
1051
+ " <h2 ng-if=\"rowData[options.fields.field0]\">{{rowData[options.fields.field0]|mask:options.fields.mask0:options.fields.type0}}</h2>\n" +
1052
+ " <p class=\"dark\" ng-if=\"rowData[options.fields.field1]\">{{rowData[options.fields.field1]|mask:options.fields.mask1:options.fields.type1}}</p>\n" +
1053
+ " <p class=\"dark\" ng-if=\"rowData[options.fields.field2]\">{{rowData[options.fields.field2]|mask:options.fields.mask2:options.fields.type2}}</p>\n" +
1054
+ " <p class=\"dark\" ng-if=\"rowData[options.fields.field3]\">{{rowData[options.fields.field3]|mask:options.fields.mask3:options.fields.type3}}</p>\n" +
1055
+ " <p class=\"dark\" ng-if=\"rowData[options.fields.field4]\">{{rowData[options.fields.field4]|mask:options.fields.mask4:options.fields.type4}}</p>\n" +
1056
+ " <p class=\"dark\" ng-if=\"rowData[options.fields.field5]\">{{rowData[options.fields.field5]|mask:options.fields.mask5:options.fields.type5}}</p>\n" +
1057
+ " <i ng-if=\"options.icon\" class=\"{{options.icon}}\" xattr-theme=\"dark\"></i>\n" +
1058
+ " </div>\n" +
1059
+ " </ion-item>\n" +
1060
+ "</ion-list>\n" +
1061
+ "<ion-infinite-scroll></ion-infinite-scroll>\n";
1062
+
1063
+ const defaultSearchTemplate =
1064
+ "<div class=\"item item-input-inset\">\n" +
1065
+ " <div class=\"item-input-wrapper\">\n" +
1066
+ " <i class=\"icon ion-search placeholder-icon\"></i>\n" +
1067
+ " <input aria-label=\"{{'template.crud.search' | translate}}\" type=\"text\" ng-model=\"vars.searchableList[options.randomModel]\" cronapp-filter=\"{{options.filterFields}}\" cronapp-filter-operator=\"\" cronapp-filter-caseinsensitive=\"false\"\n" +
1068
+ " cronapp-filter-autopost=\"true\" crn-datasource=\"{{options.dataSourceScreen.name}}\" placeholder=\"{{\'template.crud.search\' | translate}}\">\n" +
1069
+ " </div>\n" +
1070
+ " <button ng-if=\"showButton()\" ng-click=\"limparSelecao()\"\n" +
1071
+ " class=\"button-small cron-list-button-clean button button-inline button-positive component-holder\">\n" +
1072
+ " <span cron-list-button-text>Limpar Seleção</span></button>\n" +
1073
+ "</div>";
1074
+
1075
+ var getExpression = function(dataSourceName) {
1076
+ return 'rowData in '.concat(dataSourceName).concat('.data');
1077
+ }
1078
+
1079
+ var buildFormat = function(column) {
1080
+ var result = '';
1081
+
1082
+ result = ' | mask: "' + column.type + '"';
1083
+ if(column.format){
1084
+ result = ' | mask: "' + column.format + '":"'+column.type+'"';
1085
+ }
1086
+
1087
+ return result;
1088
+ }
1089
+
1090
+ var getEditCommand = function(dataSourceName) {
1091
+ return dataSourceName + '.startEditing(rowData)';
1092
+ }
1093
+
1094
+ var getCronappSecurity = function(column) {
1095
+ if (column.security)
1096
+ return `cronapp-security="${column.security}"`;
1097
+ return "";
1098
+ }
1099
+
1100
+ var addDefaultButton = function(dataSourceName, column) {
1101
+ const EDIT_TEMPLATE = '<ion-option-button ' + getCronappSecurity(column) + ' class="button-positive ion-edit button-edit" ng-click="' + getEditCommand(dataSourceName) + '"><span>&nbsp;{{"Permission.view.Edit" | translate}}</span></ion-option-button>';
1102
+ const DELETE_TEMPLATE = '<ion-option-button ' + getCronappSecurity(column) + ' class="button-assertive ion-trash-a button-delete" ng-click="' + dataSourceName + '.remove(rowData)"><span>&nbsp;{{"Permission.view.Remove" | translate}}</span></ion-option-button>';
1103
+
1104
+ if (column.command == 'edit|destroy') {
1105
+ return EDIT_TEMPLATE.concat(DELETE_TEMPLATE);
1106
+ } else if (column.command == 'edit') {
1107
+ return EDIT_TEMPLATE;
1108
+ } else if (column.command == 'destroy') {
1109
+ return DELETE_TEMPLATE;
1110
+ }
1111
+ }
1112
+
1113
+ var encodeHTML = function(value) {
1114
+ return value.replace(/&/g, '&amp;')
1115
+ .replace(/</g, '&lt;')
1116
+ .replace(/>/g, '&gt;')
1117
+ .replace(/"/g, '&quot;')
1118
+ .replace(/'/g, '&apos;');
1119
+ }
1120
+
1121
+ var generateBlocklyCall = function(blocklyInfo) {
1122
+ var call;
1123
+ if (blocklyInfo.type == "client") {
1124
+ var splitedClass = blocklyInfo.blocklyClass.split('/');
1125
+ var blocklyName = splitedClass[splitedClass.length-1];
1126
+ call = "blockly.js.blockly." + blocklyName;
1127
+ call += "." + blocklyInfo.blocklyMethod;
1128
+ var params = "()";
1129
+ if (blocklyInfo.blocklyParams.length > 0) {
1130
+ params = "(";
1131
+ blocklyInfo.blocklyParams.forEach(function(p) {
1132
+ params += (p.value ? encodeHTML(p.value) : "''") + ",";
1133
+ }.bind(this))
1134
+ params = params.substr(0, params.length - 1);
1135
+ params += ")";
1136
+ }
1137
+ call += params;
1138
+ } else if (blocklyInfo.type == "server") {
1139
+ var blocklyName = blocklyInfo.blocklyClass + ':' + blocklyInfo.blocklyMethod;
1140
+ call = "cronapi.util.makeCallServerBlocklyAsync('"+blocklyName+"',null,null,";
1141
+ if (blocklyInfo.blocklyParams.length > 0) {
1142
+ blocklyInfo.blocklyParams.forEach(function(p) {
1143
+ call += (p.value ? encodeHTML(p.value) : "''") + ",";
1144
+ }.bind(this))
1145
+ }
1146
+ call = call.substr(0, call.length - 1);
1147
+ call += ")";
1148
+ }
1149
+
1150
+ return call;
1151
+ }
1152
+
1153
+ var addBlockly = function(column) {
1154
+ return '<ion-option-button class="button-dark ' + getCronappSecurity(column) + ' ion-navigate" ng-click="'
1155
+ + generateBlocklyCall(column.blocklyInfo)
1156
+ + '"></ion-option-button>';
1157
+ }
1158
+
1159
+ var isImage = function(fieldName, schemaFields) {
1160
+ for (var i = 0; i < schemaFields.length; i++) {
1161
+ var field = schemaFields[i];
1162
+ if (fieldName == field.name) {
1163
+ return (field.type == 'Binary');
1164
+ }
1165
+ }
1166
+
1167
+ return false;
1168
+ }
1169
+
1170
+ var addCustomButton = function(column) {
1171
+ return `<ion-option-button ${getCronappSecurity(column)} class="button-dark ${column.iconClass}" ng-click="listButtonClick($index, rowData, '${window.stringToJs(column.execute)}', $event)">${column.label}</ion-option-button> `
1172
+ }
1173
+
1174
+ return {
1175
+ restrict: 'E',
1176
+ require: '?ngModel',
1177
+ scope: true,
1178
+ priority: 9999998,
1179
+ terminal: true,
1180
+ link: function(scope, element, attrs, ngModelCtrl) {
1181
+
1182
+ var optionsList = {};
1183
+ var dataSourceName = '';
1184
+ var buttons = '';
1185
+
1186
+ try {
1187
+ optionsList = JSON.parse(attrs.options);
1188
+ dataSourceName = optionsList.dataSourceScreen.name;
1189
+ var dataSource = eval(optionsList.dataSourceScreen.name);
1190
+ var imageDirection = optionsList.imagePosition ? optionsList.imagePosition : "left";
1191
+ var iconDirection = optionsList.iconPosition ? optionsList.iconPosition : "right";
1192
+ var bothDirection = imageDirection === 'left' && iconDirection === 'left' ? 'left' : (imageDirection === 'right' && iconDirection === 'right' ? 'right' : '');
1193
+ var checkboxTemplate = '';
1194
+ var modelArrayToInsert = [];
1195
+ var isKey = false;
1196
+ scope.options = optionsList;
1197
+
1198
+ if(attrs['ngModel']){
1199
+ var modelGetter = $parse(attrs['ngModel']);
1200
+ var modelSetter = modelGetter.assign;
1201
+
1202
+ if(optionsList.allowMultiselect){
1203
+
1204
+ scope.verifyIsKey = function(rowData){
1205
+ isKey = false;
1206
+ if(optionsList.fieldType && optionsList.fieldType === "key"){
1207
+ rowData = this.changeRowDataField(rowData);
1208
+ isKey = true;
1209
+ }
1210
+ return rowData;
1211
+ }
1212
+
1213
+ scope.limparSelecao = function(){
1214
+ modelSetter(scope, []);
1215
+ }
1216
+
1217
+ scope.isChecked = function(rowData) {
1218
+ let hasObject = false;
1219
+ modelArrayToInsert = modelGetter(scope);
1220
+ rowData = scope.verifyIsKey(rowData);
1221
+ hasObject = scope.hasObjectChecked(isKey, rowData, null, event);
1222
+ scope.isSelected = hasObject;
1223
+ return hasObject;
1224
+ }
1225
+
1226
+ scope.hasObjectChecked = function(isKey, rowData, fn, event){
1227
+ let hasObject = false;
1228
+ if(Array.isArray(modelArrayToInsert)){
1229
+ if(isKey && typeof rowData !== "object"){
1230
+ modelArrayToInsert.forEach((el, idx) => {
1231
+ if(rowData === el){
1232
+ hasObject = true;
1233
+ }
1234
+ });
1235
+ }
1236
+ else{
1237
+ modelArrayToInsert.forEach((el, idx) => {
1238
+ if(dataSource.objectIsEquals(rowData, el)){
1239
+ hasObject = true;
1240
+ }
1241
+ });
1242
+ }
1243
+ }
1244
+ return hasObject;
1245
+ }
1246
+
1247
+ scope.checkboxButtonClick = function(idx, rowData, fn, event) {
1248
+ let hasObject = false;
1249
+ let currentTarget = $(event.currentTarget);
1250
+ let checkedSize = currentTarget.find('input[type=checkbox]:checked').length;
1251
+ modelArrayToInsert = modelGetter(scope);
1252
+ if(!Array.isArray(modelArrayToInsert)){
1253
+ modelArrayToInsert = [];
1254
+ }
1255
+ if(!$(event.target).is('input[type=checkbox]') && !fn){
1256
+ if(checkedSize > 0){
1257
+ currentTarget.find("input[type=checkbox]").prop('checked', false);
1258
+ }
1259
+ else{
1260
+ currentTarget.find("input[type=checkbox]").prop('checked', true);
1261
+ }
1262
+ }
1263
+ let currentCheckbox = $(event.currentTarget).find('input[type=checkbox]');
1264
+ rowData = scope.verifyIsKey(rowData);
1265
+ if($(currentCheckbox).is(':checked')){
1266
+ hasObject = scope.hasObjectChecked(isKey, rowData, fn, event);
1267
+ if(!hasObject){
1268
+ modelArrayToInsert.push(rowData);
1269
+ }
1270
+ }
1271
+ else{
1272
+ if(isKey && typeof rowData !== "object"){
1273
+ modelArrayToInsert.forEach((el, idx) => {
1274
+ if(rowData === el){
1275
+ modelArrayToInsert.splice(idx, 1);
1276
+ }
1277
+ });
1278
+ }
1279
+ else{
1280
+ modelArrayToInsert.forEach((el, idx) => {
1281
+ if(dataSource.objectIsEquals(rowData, el)){
1282
+ modelArrayToInsert.splice(idx, 1);
1283
+ }
1284
+ });
1285
+ }
1286
+ }
1287
+ modelSetter(scope, modelArrayToInsert);
1288
+ event.stopPropagation();
1289
+ }
1290
+ }
1291
+ else{
1292
+ scope.setRowDataModel = function(idx, rowData, fn, event) {
1293
+ if(optionsList.fieldType && optionsList.fieldType === "key"){
1294
+ rowData = this.changeRowDataField(rowData);
1295
+ }
1296
+ modelSetter(scope, rowData);
1297
+ }
1298
+ }
1299
+
1300
+ scope.changeRowDataField = function(rowData){
1301
+ rowData = dataSource.getKeyValues(rowData);
1302
+ var keys = Object.keys(rowData);
1303
+ if(keys.length === 1){
1304
+ rowData = rowData[keys];
1305
+ }
1306
+ return rowData;
1307
+ }
1308
+ }
1309
+
1310
+ scope.listButtonClick = function(idx, rowData, fn, event) {
1311
+ if (event.target.tagName == 'INPUT') {
1312
+ return;
1313
+ }
1314
+
1315
+ dataSource.goTo(rowData);
1316
+
1317
+ var consolidated = {
1318
+ item: rowData,
1319
+ index: idx
1320
+ }
1321
+
1322
+ var contextVars = {
1323
+ 'currentData': dataSource.data,
1324
+ 'datasource': dataSource,
1325
+ 'selectedIndex': idx,
1326
+ 'index': idx,
1327
+ 'selectedRow': rowData,
1328
+ 'consolidated': consolidated,
1329
+ 'item': rowData,
1330
+ 'selectedKeys': dataSource.getKeyValues(dataSource.active, true)
1331
+ };
1332
+
1333
+ scope.$eval(fn, contextVars);
1334
+
1335
+ event.preventDefault();
1336
+ event.stopPropagation();
1337
+ }
1338
+
1339
+ var searchableField = null;
1340
+ var isNativeEdit = false;
1341
+ var addedImage = false;
1342
+
1343
+ scope.options = optionsList;
1344
+ scope.options.fields = {};
1345
+ scope.options.isImageFromDropbox = false;
1346
+ scope.options.editableButtonClass = "";
1347
+ scope.options.itemContentClass = "";
1348
+ scope.options.itemSimple = "";
1349
+ scope.options.filterFields = "";
1350
+ scope.options.randomModel = Math.floor(Math.random() * (9000)) + 1000;
1351
+ if(!optionsList.imagePosition) scope.options.imagePosition = "left";
1352
+ if(!optionsList.iconPosition) scope.options.iconPosition = "right";
1353
+ if(!optionsList.imageType) scope.options.imageType = "avatar";
1354
+ var imageDirection = optionsList.imagePosition ? optionsList.imagePosition : "left";
1355
+ var iconDirection = optionsList.iconPosition ? optionsList.iconPosition : "right";
1356
+ var bothDirection = imageDirection === 'left' && iconDirection === 'left' ? 'left' : (imageDirection === 'right' && iconDirection === 'right' ? 'right' : '');
1357
+ var visibleColumns = [];
1358
+
1359
+ for (var i = 0; i < optionsList.columns.length; i++) {
1360
+ var column = optionsList.columns[i];
1361
+ if (column.visible) {
1362
+ visibleColumns.push(optionsList.columns[i]);
1363
+ }
1364
+ }
1365
+
1366
+ for (var i = 0; i < visibleColumns.length; i++) {
1367
+ var column = visibleColumns[i];
1368
+ if (column.field && column.dataType == 'Database') {
1369
+ scope.options.fields["security" + i] = column.security;
1370
+ scope.options.fields["field" + i] = column.field;
1371
+ scope.options.fields["type" + i] = column.type;
1372
+ scope.options.fields["mask" + i] = column.format;
1373
+ if (!addedImage && isImage(column.field, optionsList.dataSourceScreen.entityDataSource.schemaFields) && optionsList.imageType !== "do-not-show"){
1374
+ scope.options.fields["image"] = column.field;
1375
+ delete scope.options.fields["field" + i];
1376
+ addedImage = true;
1377
+ scope.options.isImageFromDropbox = false;
1378
+ }
1379
+ else if(!addedImage && (column.type == 'image')){
1380
+ scope.options.fields["image"] = column.field;
1381
+ delete scope.options.fields["field" + i];
1382
+ addedImage = true;
1383
+ scope.options.isImageFromDropbox = true;
1384
+ }
1385
+ else{
1386
+ if (column.filterable) {
1387
+ searchableField = (searchableField != null) ? searchableField + ';' + column.field : column.field;
1388
+ }
1389
+ }
1390
+ }
1391
+ else if (column.dataType == 'Command' || column.dataType == 'Blockly' || column.dataType == 'Customized'){
1392
+ scope.options.editableButtonClass = "item-complex item-right-editable";
1393
+ if(column.dataType == 'Command'){
1394
+ scope.options.fields["field" + i] = column.field;
1395
+ buttons = buttons.concat(addDefaultButton(dataSourceName, column));
1396
+ if ((column.command == 'edit') || (column.command == 'edit|destroy')) {
1397
+ isNativeEdit = true;
1398
+ }
1399
+ } else if (column.dataType == 'Blockly') {
1400
+ buttons = buttons.concat(addBlockly(column));
1401
+ } else if (column.dataType == 'Customized') {
1402
+ buttons = buttons.concat(addCustomButton(column));
1403
+ }
1404
+ }
1405
+ }
1406
+ } catch(err) {
1407
+ console.log('CronList invalid configuration! ' + err);
1408
+ }
1409
+
1410
+ if(!scope.options.editableButtonClass && !addedImage){
1411
+ scope.options.itemContentClass = "item-content"
1412
+ scope.options.itemSimple = "item-simple"
1413
+ }
1414
+ else if(!scope.options.editableButtonClass && addedImage){
1415
+ scope.options.itemContentClass = "item-content"
1416
+ scope.options.editableButtonClass = "item-complex";
1417
+ scope.options.itemSimple = ""
1418
+ }
1419
+
1420
+ if(scope.options.fields.image && scope.options.imageType != 'do-not-show'){
1421
+ scope.options.imageClassPosition = "item-" + scope.options.imageType + '-' + scope.options.imagePosition;
1422
+ }
1423
+
1424
+ if(!addedImage){
1425
+ scope.options.imageType = "do-not-show"
1426
+ }
1427
+
1428
+ if(scope.options.icon && scope.options.iconPosition && scope.options.imageType){
1429
+ scope.options.iconClassPosition = "item-icon-" + scope.options.iconPosition;
1430
+ }
1431
+
1432
+ if(bothDirection && scope.options.icon && scope.options.imagePosition && scope.options.imageType){
1433
+ scope.options.imageToClassPosition = "image-to-" + scope.options.imagePosition + '-' + scope.options.imageType;
1434
+ scope.options.textToClassPosition = "text-to-" + scope.options.iconPosition + '-' + scope.options.imageType;
1435
+ }
1436
+
1437
+ if(!scope.options.advancedTemplate){
1438
+ scope.options.advancedTemplate = defaultAdvancedTemplate;
1439
+ }
1440
+
1441
+ if(!scope.options.searchTemplate){
1442
+ scope.options.searchTemplate = defaultSearchTemplate
1443
+ }
1444
+
1445
+ var templateDyn = null;
1446
+ if (searchableField) {
1447
+ scope.options.filterFields = searchableField;
1448
+ templateDyn = scope.options.searchTemplate + scope.options.advancedTemplate;
1449
+ } else {
1450
+ templateDyn = scope.options.advancedTemplate;
1451
+ }
1452
+
1453
+ for (let index = 0; index < visibleColumns.length; index++) {
1454
+ let column = visibleColumns[index];
1455
+ if (column.field && column.dataType === 'Database' && scope.options.fields[`security${index}`]) {
1456
+ let find = `ng-if="rowData[options.fields.field${index}]"`;
1457
+ let toReplace = `${find} cronapp-security="${scope.options.fields['security' + index]}"`;
1458
+ templateDyn = templateDyn.replace(find, toReplace);
1459
+ }
1460
+ }
1461
+ templateDyn = $(templateDyn);
1462
+
1463
+ scope.options.xattrTextPosition = attrs.xattrTextPosition;
1464
+
1465
+ templateDyn.attr("type", optionsList.listType);
1466
+ $(element).replaceWith(templateDyn);
1467
+ var $element = templateDyn;
1468
+
1469
+ var ionItem = $element.find('ion-item');
1470
+ if($(ionItem).attr('ng-repeat') === "rowData in datasource"){
1471
+ ionItem.attr('ng-repeat', getExpression(dataSourceName));
1472
+ }
1473
+
1474
+ if (isNativeEdit) {
1475
+ ionItem.attr('ng-click', getEditCommand(dataSourceName));
1476
+ }
1477
+
1478
+ var ngClickAttrTemplate = "";
1479
+ var ngClickAttrTemplateCheckbox = "";
1480
+
1481
+ if(optionsList.allowMultiselect){
1482
+ if(attrs['ngModel']){
1483
+ ngClickAttrTemplateCheckbox = "checkboxButtonClick($index, rowData, \'"+window.stringToJs(attrs.ngClick)+"\', $event);"
1484
+ }
1485
+ checkboxTemplate = $element.find('ul');
1486
+ if(attrs.ngClick){
1487
+ checkboxTemplate = $(checkboxTemplate).attr('ng-click', ngClickAttrTemplateCheckbox).get(0).outerHTML;
1488
+ ngClickAttrTemplate = ngClickAttrTemplate + "listButtonClick($index, rowData, \'"+window.stringToJs(attrs.ngClick)+"\', $event);";
1489
+ }
1490
+ ionItem.attr('ng-click', ngClickAttrTemplateCheckbox + ngClickAttrTemplate);
1491
+ }
1492
+ else{
1493
+ if(attrs['ngModel']){
1494
+ ngClickAttrTemplate = "setRowDataModel($index, rowData, \'"+window.stringToJs(attrs.ngClick)+"\', $event);";
1495
+ }
1496
+ if(attrs.ngClick){
1497
+ ngClickAttrTemplate = ngClickAttrTemplate + "listButtonClick($index, rowData, \'"+window.stringToJs(attrs.ngClick)+"\', $event);";
1498
+ }
1499
+ ionItem.attr('ng-click', ngClickAttrTemplate);
1500
+ }
1501
+
1502
+ const attrsExcludeds = ['options','ng-repeat','ng-click'];
1503
+ const filteredItems = Object.values(attrs.$attr).filter(function(item) {
1504
+ return !attrsExcludeds.includes(item);
1505
+ })
1506
+ for( let o in filteredItems){
1507
+ ionItem.attr(filteredItems[o], attrs[o]);
1508
+ }
1509
+
1510
+ ionItem.append(buttons);
1511
+
1512
+ var firstScroll = true;
1513
+ scope.nextPageInfinite = function() {
1514
+ if ($element.find('ion-item').length < dataSource.data.length || dataSource.data.length == 0) {
1515
+ scope.$broadcast('scroll.infiniteScrollComplete');
1516
+ return;
1517
+ }
1518
+
1519
+ if ($element.find('ion-item').length == dataSource.data.length) {
1520
+ if (!firstScroll) {
1521
+ dataSource.nextPage(function() {
1522
+ scope.$broadcast('scroll.infiniteScrollComplete');
1523
+ });
1524
+ } else {
1525
+ scope.$broadcast('scroll.infiniteScrollComplete');
1526
+ firstScroll = false;
1527
+ }
1528
+ }
1529
+ }
1530
+
1531
+ var infiniteScroll = $element.filter(function( index ) {
1532
+ return $(this).is('ion-infinite-scroll');
1533
+ });
1534
+
1535
+ infiniteScroll.attr('on-infinite', 'nextPageInfinite()');
1536
+ infiniteScroll.attr('distance', '1%');
1537
+
1538
+ scope.showButton = function() {
1539
+ if (optionsList.allowMultiselect) {
1540
+ var model = modelGetter(scope);
1541
+ if (model !== null && model !== undefined) {
1542
+ return model.length > 0;
1543
+ }
1544
+ }
1545
+ return false;
1546
+ }
1547
+
1548
+ $compile(templateDyn, null, 9999998)(scope);
1549
+ }
1550
+ }
1551
+ }])
1552
+
1553
+ .directive('cronInfiniteScroll', ['$compile', function($compile){
1554
+ 'use strict';
1555
+ return {
1556
+ restrict: 'EA',
1557
+ link: function(scope, element, attrs) {
1558
+ var dataSource = attrs.cronInfiniteScroll ? eval(attrs.cronInfiniteScroll) : attrs.crnDatasource ? eval(attrs.crnDatasource): undefined;
1559
+ if (dataSource) {
1560
+ scope.nextPageInfinite = function() {
1561
+ dataSource.nextPage();
1562
+ scope.$broadcast('scroll.infiniteScrollComplete');
1563
+ }
1564
+
1565
+ var templateDyn = $('<ion-infinite-scroll></ion-infinite-scroll>');
1566
+ $(element).html(templateDyn);
1567
+
1568
+ var infiniteScroll = $(element).find('ion-infinite-scroll');
1569
+ infiniteScroll.attr('on-infinite', 'nextPageInfinite()');
1570
+ infiniteScroll.attr('distance', '1%');
1571
+
1572
+ $compile(templateDyn)(element.scope());
1573
+ }
1574
+ }
1575
+ }
1576
+ }])
1577
+
1578
+ .filter('raw',function($translate) {
1579
+ return function(o) {
1580
+ if (o != null && o !== undefined) {
1581
+ if (typeof o == 'number') {
1582
+ return o + "";
1583
+ }
1584
+ if (typeof o == 'boolean') {
1585
+ return o + "";
1586
+ }
1587
+ if (o instanceof Date) {
1588
+ var dt = "datetimeoffset'" + o.toISOString() + "'";
1589
+ }
1590
+ else {
1591
+ if (o.length >= 10 && o.match(ISO_PATTERN)) {
1592
+ return "datetimeoffset'" + o + "'";
1593
+ } else {
1594
+ return "'" + o + "'";
1595
+ }
1596
+ }
1597
+ } else {
1598
+ return "";
1599
+ }
1600
+ }
1601
+ })
1602
+
1603
+ .directive('xkeyField', ['$compile', function($compile){
1604
+ 'use strict';
1605
+ return {
1606
+ restrict: 'A',
1607
+ link: function(scope, element, attrs) {
1608
+ if (attrs.xkeyField && attrs.xdisplayField) {
1609
+ var dataSource = '';
1610
+ if (attrs.crnDatasource) {
1611
+ dataSource = attrs.crnDatasource;
1612
+ }
1613
+
1614
+ element.removeAttr('xkey-field');
1615
+ element.removeAttr('xdisplay-field');
1616
+ element.append('<option ng-repeat="opt in ' + dataSource + '.data" value="{{opt.' + attrs.xkeyField + '}}">{{opt.' + attrs.xdisplayField + '}}</option>');
1617
+
1618
+ $compile($(element))(scope);
1619
+ }
1620
+ }
1621
+ }
1622
+ }])
1623
+
1624
+ .directive('cronMobileMenu', ['$compile', '$translate', function($compile, $translate){
1625
+ 'use strict';
1626
+
1627
+ var populateMenu = function(menuOptions) {
1628
+ var template = '';
1629
+ if (menuOptions && menuOptions!= null && menuOptions.subMenuOptions && menuOptions.subMenuOptions != null && Array.isArray(menuOptions.subMenuOptions)){
1630
+ menuOptions.subMenuOptions.forEach(function(menu) {
1631
+ var security = (menu.security && menu.security != null) ? ' cronapp-security="' + menu.security + '" ' : '';
1632
+ var action = (menu.action && menu.action != null) ? ' ng-click="' + menu.action + '" ' : '';
1633
+ var hide = (menu.hide && menu.hide != null) ? ' ng-hide="' + menu.hide + '" ' : '';
1634
+ var iconClass = (menu.iconClass && menu.iconClass != null) ? menu.iconClass : '';
1635
+ var imagePosition = (menu.imagePosition && menu.imagePosition != null) ? 'item-icon-' + menu.imagePosition : '';
1636
+ var textPosition = (menu.textPosition && menu.textPosition != null) ? 'text-' + menu.textPosition : '';
1637
+ var contentTheme = (menu.contentTheme && menu.contentTheme != null) ? menu.contentTheme : '';
1638
+ var iconTheme = (menu.iconTheme && menu.iconTheme != null) ? menu.iconTheme : '';
1639
+ var title = $translate.instant(menu.title);
1640
+
1641
+ template = template + '\
1642
+ <a menu-close="" class="item ' + imagePosition + '" ' + action + security + hide + '> \
1643
+ <i class="' + iconClass + ' ' + iconTheme + '" style="font-size: 150%"></i> \
1644
+ <div class="item-content ' + textPosition + '"> \
1645
+ <h2 class="' + contentTheme + '">' + title + '</h2> \
1646
+ </div> \
1647
+ </a> ';
1648
+ })
1649
+ }
1650
+ return template;
1651
+ }
1652
+
1653
+ return {
1654
+ restrict: 'EA',
1655
+ link: function(scope, element, attrs) {
1656
+ var TEMPLATE_MAIN = '<ul class="nav navbar-nav" style="float:none"></ul>';
1657
+ var options = {};
1658
+ try {
1659
+ options = JSON.parse(attrs.options);
1660
+ } catch(e) {
1661
+ console.log('CronMobileMenu: Invalid configuration!')
1662
+ }
1663
+
1664
+ var main = $(TEMPLATE_MAIN);
1665
+ var menus = populateMenu(options);
1666
+ main.append(menus);
1667
+
1668
+ var newElement = angular.element(main);
1669
+ element.html('');
1670
+ element.append(main);
1671
+ element.attr('id' , null);
1672
+ $compile(newElement)(scope);
1673
+ }
1674
+ }
1675
+ }])
1676
+
1677
+ .directive('srcLazy', function($compile){
1678
+ 'use strict';
1679
+ return {
1680
+ restrict: 'A',
1681
+ link: function(scope, element, attrs) {
1682
+ var $element = $(element);
1683
+
1684
+ setTimeout(function() {
1685
+ if ($element.is(':appeared')) {
1686
+ element.attr('src', attrs.srcLazy);
1687
+ return;
1688
+ }
1689
+
1690
+ if (!attrs.srcLazyPreview) {
1691
+ $element.css('visibility', 'hidden');
1692
+ } else {
1693
+ $element.attr('src', attrs.srcLazyPreview);
1694
+ }
1695
+
1696
+ $element.appear();
1697
+
1698
+ $element.on('appear', function(event, $all_appeared_elements) {
1699
+ if (!$element.attr('src-lazy')) {
1700
+ return;
1701
+ }
1702
+ if (!attrs.srcLazyPreview) {
1703
+ $element.css('visibility', 'visible');
1704
+ }
1705
+ console.log(attrs.srcLazy);
1706
+ $element.attr('src', attrs.srcLazy);
1707
+ $element.attr('src-lazy', '');
1708
+ });
1709
+ },100);
1710
+
1711
+ scope.$on('$destroy', function() {
1712
+ $element.appearStop();
1713
+ });
1714
+ }
1715
+ }
1716
+ })
1717
+
1718
+ .directive('cronMap', function ($compile) {
1719
+ return {
1720
+ restrict: 'AE',
1721
+ replace: true,
1722
+ link: function (scope, element, attrs) {
1723
+
1724
+ var component = element.find('.cronMap')[0];
1725
+ $compile(component)(element.scope());
1726
+
1727
+ var componentOptions = element.find('.cronMapIframe')[0];
1728
+ $compile(componentOptions)(element.scope());
1729
+
1730
+ var $templateDyn = "";
1731
+ var src = attrs.src;
1732
+ var width = attrs.width;
1733
+ var height = attrs.height;
1734
+ $templateDyn = `<iframe class="cronMapIframe" src="${src}" width="${width}" height="${height}" style="border:0;" allowfullscreen="" loading="lazy"></iframe>`;
1735
+
1736
+ element.html($templateDyn);
1737
+ $compile($templateDyn)(element.scope());
1738
+ }
1739
+ }
1740
+ })
1741
+
1742
+ .directive('cronVideo', function ($compile) {
1743
+ return {
1744
+ restrict: 'AE',
1745
+ replace: true,
1746
+ link: function (scope, element, attrs) {
1747
+
1748
+ var component = element.find('.cronVideo')[0];
1749
+ $compile(component)(element.scope());
1750
+
1751
+ var componentOptions = element.find('.cronVideoIframe')[0];
1752
+ $compile(componentOptions)(element.scope());
1753
+
1754
+ var $templateDyn = "";
1755
+ var src = attrs.src;
1756
+ var width = attrs.width;
1757
+ var height = attrs.height;
1758
+ var title = attrs.title;
1759
+ $templateDyn = `<iframe class="cronVideoIframe" src="${src}" width="${width}" height="${height}" title="${title}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen> </iframe>`;
1760
+
1761
+ element.html($templateDyn);
1762
+ $compile($templateDyn)(element.scope());
1763
+ }
1764
+ }
1765
+ });
1766
+
1767
+ app.directive("kendoChat", function ($compile, $timeout) {
1768
+ return {
1769
+ restrict: "E",
1770
+ link: function (scope, element, attrs) {
1771
+ let onPostMessage = attrs.ngOnPostMessage;
1772
+ let onSendMessage = attrs.ngOnSendMessage;
1773
+ let onTypingEnd = attrs.ngOnTypingEnd;
1774
+ let onTypingStart = attrs.ngOnTypingStart;
1775
+ let onActionClick = attrs.ngOnActionClick;
1776
+ let chatUserId = attrs.chatUserId;
1777
+ let chatUsername = attrs.chatUsername;
1778
+ let chatUserImage = attrs.chatUserImage;
1779
+ let chatPlaceholder = attrs.chatPlaceholder;
1780
+
1781
+ let loggedUserInfo = (localStorage.getItem('_u') !== undefined) ? JSON.parse(localStorage.getItem('_u')) : null;
1782
+
1783
+ let defaultUserId = window.navigator.userAgent;
1784
+ let defaultUserName = '';
1785
+
1786
+ if (loggedUserInfo && loggedUserInfo.user) {
1787
+ defaultUserName = loggedUserInfo.user.name;
1788
+ }
1789
+
1790
+ let chatElement = $("<div></div>");
1791
+
1792
+ chatElement.kendoChat({
1793
+ messages: {
1794
+ placeholder: chatPlaceholder,
1795
+ },
1796
+ user: {
1797
+ id: chatUserId || defaultUserId,
1798
+ name: chatUsername || defaultUserName,
1799
+ iconUrl: chatUserImage,
1800
+ },
1801
+ });
1802
+
1803
+ chat = chatElement.data("kendoChat");
1804
+
1805
+ //Binding Chat Events
1806
+ chat.bind("post", (msg) => {
1807
+ if (onPostMessage) {
1808
+ try {
1809
+ let contextVars = {
1810
+ chatMessage: msg,
1811
+ };
1812
+ scope.$eval(onPostMessage, contextVars);
1813
+ } catch (e) {
1814
+ console.error(e);
1815
+ }
1816
+ }
1817
+ });
1818
+
1819
+ chat.bind("sendMessage", (msg) => {
1820
+ if (onSendMessage) {
1821
+ try {
1822
+ let contextVars = {
1823
+ chatMessage: msg,
1824
+ };
1825
+ scope.$eval(onSendMessage, contextVars);
1826
+ } catch (e) {
1827
+ console.error(e);
1828
+ }
1829
+ }
1830
+ });
1831
+
1832
+ chat.bind("typingStart", (msg) => {
1833
+ if (onTypingStart) {
1834
+ try {
1835
+ let contextVars = {
1836
+ chatMessage: msg,
1837
+ };
1838
+ scope.$eval(onTypingStart, contextVars);
1839
+ } catch (e) {
1840
+ console.error(e);
1841
+ }
1842
+ }
1843
+ });
1844
+
1845
+ chat.bind("typingEnd", (msg) => {
1846
+ if (onTypingEnd) {
1847
+ try {
1848
+ let contextVars = {
1849
+ chatMessage: msg,
1850
+ };
1851
+ scope.$eval(onTypingEnd, contextVars);
1852
+ } catch (e) {
1853
+ console.error(e);
1854
+ }
1855
+ }
1856
+ });
1857
+
1858
+ chat.bind("actionClick", (msg) => {
1859
+ if (onActionClick) {
1860
+ try {
1861
+ let contextVars = {
1862
+ chatMessage: msg,
1863
+ };
1864
+ scope.$eval(onActionClick, contextVars);
1865
+ } catch (e) {
1866
+ console.error(e);
1867
+ }
1868
+ }
1869
+ });
1870
+
1871
+ element.empty().append(chatElement);
1872
+
1873
+ function fitChatHeightToWindow() {
1874
+ let chatElement = $('.k-chat');
1875
+ chatElement.height($(window).height() - chatElement.offset().top);
1876
+ }
1877
+
1878
+ $(window).resize(() => {
1879
+ fitChatHeightToWindow();
1880
+ });
1881
+
1882
+ $timeout(() => {
1883
+ fitChatHeightToWindow();
1884
+ });
1885
+ },
1886
+ };
1887
+ });
1888
+
1889
+ }(app));
1890
+
1891
+ (function ($) {
1892
+ var selectors = [];
1893
+
1894
+ var checkLock = false;
1895
+ var defaults = {
1896
+ interval: 250,
1897
+ force_process: false
1898
+ };
1899
+ var $window = $(window);
1900
+
1901
+ var $priorAppeared = [];
1902
+
1903
+ function isAppeared() {
1904
+ return $(this).is(':appeared');
1905
+ }
1906
+
1907
+ function isNotTriggered() {
1908
+ return !$(this).data('_appear_triggered');
1909
+ }
1910
+
1911
+ function process() {
1912
+ checkLock = false;
1913
+
1914
+ for (var index = 0, selectorsLength = selectors.length; index < selectorsLength; index++) {
1915
+ var $appeared = $(selectors[index]).filter(isAppeared);
1916
+
1917
+ $appeared
1918
+ .filter(isNotTriggered)
1919
+ .data('_appear_triggered', true)
1920
+ .trigger('appear', [$appeared]);
1921
+
1922
+ if ($priorAppeared[index]) {
1923
+ var $disappeared = $priorAppeared[index].not($appeared);
1924
+ $disappeared
1925
+ .data('_appear_triggered', false)
1926
+ .trigger('disappear', [$disappeared]);
1927
+ }
1928
+ $priorAppeared[index] = $appeared;
1929
+ }
1930
+ }
1931
+
1932
+ function addSelector(selector) {
1933
+ selectors.push(selector);
1934
+ $priorAppeared.push();
1935
+ }
1936
+
1937
+ $.expr.pseudos.appeared = $.expr.createPseudo(function (_arg) {
1938
+ return function (element) {
1939
+ var $element = $(element);
1940
+
1941
+ var windowLeft = $window.scrollLeft();
1942
+ var windowTop = $window.scrollTop();
1943
+ var offset = $element.offset();
1944
+ var left = offset.left;
1945
+ var top = offset.top;
1946
+
1947
+ if (top + $element.height() >= windowTop &&
1948
+ top - ($element.data('appear-top-offset') || 0) <= windowTop + $window.height() &&
1949
+ left + $element.width() >= windowLeft &&
1950
+ left - ($element.data('appear-left-offset') || 0) <= windowLeft + $window.width()) {
1951
+ return true;
1952
+ }
1953
+ return false;
1954
+ };
1955
+ });
1956
+
1957
+ $.fn.extend({
1958
+ appear: function (selector, options) {
1959
+ $.appear(this, options);
1960
+ return this;
1961
+ }
1962
+ });
1963
+
1964
+ $.fn.extend({
1965
+ appearStop: function (selector, options) {
1966
+ $.appearStop(this, options);
1967
+ return this;
1968
+ }
1969
+ });
1970
+
1971
+ $.extend({
1972
+ appearStop: function (selector, options) {
1973
+ var idx = -1;
1974
+ for (i = 0;i<selectors.length;i++) {
1975
+ if (selectors[i].get(0) == selector.get(0)) {
1976
+ idx = i;
1977
+ break;
1978
+ }
1979
+ }
1980
+ if (idx != -1) {
1981
+ selectors.splice(idx);
1982
+ }
1983
+ },
1984
+ appear: function (selector, options) {
1985
+ var opts = $.extend({}, defaults, options || {});
1986
+ var $ionContent = $("ion-content");
1987
+
1988
+ if (!$ionContent.length) {
1989
+ return;
1990
+ }
1991
+
1992
+ if (!$ionContent.get(0).checkBinded) {
1993
+ var onCheck = function () {
1994
+ if (checkLock) {
1995
+ return;
1996
+ }
1997
+ checkLock = true;
1998
+
1999
+ setTimeout(process, opts.interval);
2000
+ };
2001
+
2002
+ $ionContent.scroll(onCheck).resize(onCheck);
2003
+ $ionContent.get(0).checkBinded = true;
2004
+ }
2005
+
2006
+ if (opts.force_process) {
2007
+ setTimeout(process, opts.interval);
2008
+ }
2009
+
2010
+ addSelector(selector);
2011
+ }
2012
+ });
2013
+ }(function () {
2014
+ if (typeof module !== 'undefined') {
2015
+ // Node
2016
+ return require('jquery');
2017
+ }
2018
+ return jQuery;
2019
+ }()));
2020
+
2021
+ function maskDirectiveAsDate($compile, $translate, $parse) {
2022
+ return maskDirective($compile, $translate, 'as-date', $parse);
2023
+ }
2024
+
2025
+ function maskDirectiveMask($compile, $translate, $parse) {
2026
+ return maskDirective($compile, $translate, 'mask', $parse);
2027
+ }
2028
+
2029
+ function maskDirective($compile, $translate, attrName, $parse) {
2030
+ return {
2031
+ restrict: 'A',
2032
+ require: '?ngModel',
2033
+ link: function (scope, element, attrs, ngModelCtrl) {
2034
+
2035
+ var modelGetter = $parse(attrs['ngModel']);
2036
+ var modelSetter = modelGetter.assign;
2037
+
2038
+ if(attrName == 'as-date' && attrs.mask !== undefined)
2039
+ return;
2040
+
2041
+ var $element = $(element);
2042
+
2043
+ var type = $element.attr("type");
2044
+
2045
+ if (type == "checkbox" || type == "password")
2046
+ return;
2047
+
2048
+ $element.data("type", type);
2049
+
2050
+ $element.attr("type", "text");
2051
+
2052
+ if (ngModelCtrl) {
2053
+ ngModelCtrl.$formatters = [];
2054
+ ngModelCtrl.$parsers = [];
2055
+ }
2056
+
2057
+ if (attrs.asDate !== undefined && type == 'text')
2058
+ type = "date";
2059
+
2060
+ var textMask = true;
2061
+
2062
+ var removeMask = false;
2063
+
2064
+ var attrMask = attrs.mask || attrs.format;
2065
+
2066
+ if (!attrMask) {
2067
+ attrMask = parseMaskType(type, $translate);
2068
+ } else {
2069
+ attrMask = parseMaskType(attrMask, $translate);
2070
+ }
2071
+
2072
+ if (attrMask.endsWith(";0")) {
2073
+ removeMask = true;
2074
+ }
2075
+
2076
+ var mask = attrMask.replace(';1', '').replace(';0', '').replace(';local', '').trim();
2077
+
2078
+ var keyboard = attrs.keyboard;
2079
+ var keyboardDecimalChar = $translate.instant('keyboardDecimalChar') && $translate.instant('keyboardDecimalChar').length == 1 ? $translate.instant('keyboardDecimalChar') : ',';
2080
+
2081
+ if (keyboard) {
2082
+ parseKeyboardType(keyboard, keyboardDecimalChar, $element)
2083
+ }
2084
+
2085
+ if (mask == undefined || mask.length == 0) {
2086
+ return;
2087
+ }
2088
+
2089
+ if (type == 'date' || type == 'datetime' || type == 'datetime-local' || type == 'month' || type == 'time' || type == 'time-local' || type == 'week') {
2090
+ var useUTC = type == 'date' || type == 'datetime' || type == 'time';
2091
+
2092
+ if (!window.fixedTimeZone) {
2093
+ useUTC = false;
2094
+ }
2095
+
2096
+ if(type == 'date'){
2097
+ mask = moment.HTML5_FMT.DATE;
2098
+ $element.attr("type", "date");
2099
+ }
2100
+ else if(type == 'month'){
2101
+ mask = moment.HTML5_FMT.MONTH;
2102
+ $element.attr("type", "month");
2103
+ }else if( type == 'week'){
2104
+ mask = moment.HTML5_FMT.WEEK;
2105
+ $element.attr("type", "week");
2106
+ }else if( type == 'datetime' || type == 'datetime-local' ){
2107
+ mask = moment.HTML5_FMT.DATETIME_LOCAL;
2108
+ $element.attr("type", "datetime-local");
2109
+ }else if( type == 'time' || type == 'time-local' ){
2110
+ mask = moment.HTML5_FMT.TIME;
2111
+ $element.attr("type", "time");
2112
+ }
2113
+
2114
+ if (ngModelCtrl) {
2115
+ ngModelCtrl.$formatters.push(function (value) {
2116
+
2117
+ if(value){
2118
+ if(useUTC){
2119
+ return moment(value).utcOffset(window.timeZoneOffset).format(mask);
2120
+ }
2121
+ return moment(value).format(mask);
2122
+ }else{
2123
+ return null;
2124
+ }
2125
+ });
2126
+
2127
+ ngModelCtrl.$parsers.push(function (value) {
2128
+ if (value) {
2129
+ if(useUTC){
2130
+ return moment(value, mask).utcOffset(window.timeZoneOffset, true).toDate();
2131
+ }
2132
+ return moment(value,mask).toDate();
2133
+ }
2134
+ return new Date(value);
2135
+ });
2136
+ }
2137
+
2138
+ } else if (type == 'number' || type == 'money' || type == 'integer' || type == 'money-decimal') {
2139
+ removeMask = true;
2140
+ textMask = false;
2141
+
2142
+ var currency = mask.trim().replace(/\./g, '').replace(/\,/g, '').replace(/#/g, '').replace(/0/g, '').replace(/9/g, '');
2143
+
2144
+ if (!keyboard) {
2145
+ if(type == 'integer' || type == 'money-decimal') {
2146
+ keyboard = "integer"
2147
+ } else {
2148
+ keyboard = "number";
2149
+ }
2150
+ }
2151
+
2152
+ var prefix = '';
2153
+ var suffix = '';
2154
+ var thousands = '';
2155
+ var decimal = ',';
2156
+ var precision = 0;
2157
+
2158
+ if (mask.startsWith(currency)) {
2159
+ prefix = currency;
2160
+ }
2161
+ else if (mask.endsWith(currency)) {
2162
+ suffix = currency;
2163
+ }
2164
+
2165
+ var pureMask = mask.trim().replace(prefix, '').replace(suffix, '').trim();
2166
+
2167
+ if (pureMask.startsWith("#.")) {
2168
+ thousands = '.';
2169
+ }
2170
+ else if (pureMask.startsWith("#,")) {
2171
+ thousands = ',';
2172
+ }
2173
+
2174
+ var dMask = null;
2175
+
2176
+ if (pureMask.indexOf(",0") != -1) {
2177
+ decimal = ',';
2178
+ dMask = ",0";
2179
+ }
2180
+ else if (pureMask.indexOf(".0") != -1) {
2181
+ decimal = '.';
2182
+ dMask = ".0";
2183
+ }
2184
+
2185
+ if (dMask != null) {
2186
+ var strD = pureMask.substring(pureMask.indexOf(dMask) + 1);
2187
+ precision = strD.length;
2188
+ }
2189
+
2190
+ var inputmaskType = 'numeric';
2191
+
2192
+ if (precision == 0){
2193
+ inputmaskType = 'integer';
2194
+ }
2195
+
2196
+ var ipOptions = {
2197
+ 'rightAlign': (type == 'money' || type == 'money-decimal'),
2198
+ 'unmaskAsNumber': true,
2199
+ 'allowMinus': (type == 'money' || type == 'money-decimal') ? false : true,
2200
+ 'prefix': prefix,
2201
+ 'suffix': suffix,
2202
+ 'radixPoint': decimal,
2203
+ 'digits': precision,
2204
+ 'numericInput' : (type == 'money-decimal')
2205
+ };
2206
+
2207
+ if (thousands) {
2208
+ ipOptions['autoGroup'] = true;
2209
+ ipOptions['groupSeparator'] = thousands;
2210
+ }
2211
+
2212
+ if(type == 'money-decimal'){
2213
+ inputmaskType = 'currency';
2214
+ }
2215
+
2216
+ $(element).inputmask(inputmaskType, ipOptions);
2217
+
2218
+ useInputMaskPlugin(element, ngModelCtrl, scope, modelSetter, mask);
2219
+ }
2220
+ else if (type == 'text' || type == 'tel') {
2221
+
2222
+ if (!keyboard) {
2223
+ if(type == 'tel') {
2224
+ keyboard = "tel"
2225
+ }
2226
+ }
2227
+
2228
+ if(!attrs.maskPlaceholder){
2229
+ $element.mask(mask);
2230
+ useMaskPlugin(element, ngModelCtrl, scope, modelSetter, removeMask);
2231
+ }
2232
+ else{
2233
+ options = {};
2234
+ options['placeholder'] = attrs.maskPlaceholder
2235
+ $(element).inputmask(mask, options);
2236
+ $(element).off('keypress');
2237
+ if(removeMask){
2238
+ useInputMaskPlugin(element, ngModelCtrl, scope, modelSetter, mask);
2239
+ }
2240
+ }
2241
+
2242
+ }
2243
+ else if(type == 'email' || type == 'password' || type == 'search'){
2244
+ if (!keyboard) {
2245
+ keyboard = type;
2246
+ }
2247
+ }
2248
+
2249
+ if (keyboard) {
2250
+ parseKeyboardType(keyboard, keyboardDecimalChar, $element)
2251
+ }
2252
+ }
2253
+ }
2254
+ }
2255
+
2256
+ function useInputMaskPlugin(element, ngModelCtrl, scope, modelSetter, mask){
2257
+ //Forçando um set no model no evento de keyup.
2258
+ var $element = $(element);
2259
+ var unmaskedvalue = function(event) {
2260
+ var rawValue = $(this).inputmask('unmaskedvalue');
2261
+ $(this).data('rawvalue',rawValue);
2262
+ element._ignoreFormatter = true;
2263
+ scope.safeApply(function(){
2264
+ modelSetter(scope, rawValue);
2265
+ });
2266
+ };
2267
+
2268
+ $(element).off('keypress');
2269
+ $(element).on('keyup', unmaskedvalue);
2270
+
2271
+ if (ngModelCtrl) {
2272
+ ngModelCtrl.$formatters.push(function (value) {
2273
+ //Ignorar a formatação pela máscara na primeira vez
2274
+ if (element._ignoreFormatter) {
2275
+ element._ignoreFormatter = false;
2276
+ return $(element).val();
2277
+ }
2278
+ element._ignoreFormatter = false;
2279
+ if (value != undefined && value != null && value !== '') {
2280
+ return format(mask, value);
2281
+ }
2282
+ return null;
2283
+ });
2284
+ ngModelCtrl.$parsers.push(function (value) {
2285
+ if (value != undefined && value != null && value !== '') {
2286
+ var unmaskedvalue = $element.inputmask('unmaskedvalue');
2287
+ if (unmaskedvalue !== '')
2288
+ return unmaskedvalue;
2289
+ }
2290
+ return null;
2291
+ });
2292
+ }
2293
+ }
2294
+
2295
+ function useMaskPlugin(element, ngModelCtrl, scope, modelSetter, removeMask){
2296
+ var $element = $(element);
2297
+ var unmaskedvalue = function() {
2298
+ if (removeMask)
2299
+ $(this).data('rawvalue',$(this).cleanVal());
2300
+ }
2301
+
2302
+ $(element).on('keydown', unmaskedvalue).on('keyup', unmaskedvalue);
2303
+
2304
+ if (removeMask && ngModelCtrl) {
2305
+ ngModelCtrl.$formatters.push(function (value) {
2306
+ if (value) {
2307
+ return $element.masked(value);
2308
+ }
2309
+
2310
+ return null;
2311
+ });
2312
+
2313
+ ngModelCtrl.$parsers.push(function (value) {
2314
+ if (value) {
2315
+ return $element.cleanVal();
2316
+ }
2317
+
2318
+ return null;
2319
+ });
2320
+ }
2321
+ }
2322
+
2323
+ function parseKeyboardType(keyboard, keyboardDecimalChar, $element) {
2324
+ if(keyboard == 'integer' || keyboard == 'number' || keyboard == 'tel') {
2325
+ $element.attr('pattern', "\\d*");
2326
+ $element.attr('inputmode', "decimal");
2327
+ }
2328
+ if(keyboard == 'tel' || keyboard == 'email' || keyboard == 'search' || keyboard == 'password'){
2329
+ $element.attr('type', keyboard);
2330
+ }
2331
+ if(cordova.platformId === "ios" && keyboard == 'number') {
2332
+ $element.attr('decimal', "true");
2333
+ $element.attr('allow-multiple-decimals', "true");
2334
+ $element.attr('decimal-char', keyboardDecimalChar);
2335
+ }
2336
+ }
2337
+
2338
+ function parseMaskType(type, $translate) {
2339
+ if (type == "datetime" || type == "datetime-local") {
2340
+ type = $translate.instant('Format.DateTime');
2341
+ if (type == 'Format.DateTime')
2342
+ type = 'DD/MM/YYYY HH:mm:ss'
2343
+ }
2344
+
2345
+ else if (type == "date") {
2346
+ type = $translate.instant('Format.Date');
2347
+ if (type == 'Format.Date')
2348
+ type = 'DD/MM/YYYY'
2349
+ }
2350
+
2351
+ else if (type == "time" || type == "time-local") {
2352
+ type = $translate.instant('Format.Hour');
2353
+ if (type == 'Format.Hour')
2354
+ type = 'HH:mm:ss'
2355
+ }
2356
+
2357
+ else if (type == "month") {
2358
+ type = 'MMMM';
2359
+ }
2360
+
2361
+ else if (type == "number") {
2362
+ type = $translate.instant('Format.Decimal');
2363
+ if (type == 'Format.Decimal')
2364
+ type = '0,00'
2365
+ }
2366
+
2367
+ else if (type == "money" || type == "money-decimal") {
2368
+ type = $translate.instant('Format.Money');
2369
+ if (type == 'Format.Money')
2370
+ type = '#.#00,00'
2371
+ }
2372
+
2373
+ else if (type == "integer") {
2374
+ type = '0';
2375
+ }
2376
+
2377
+ else if (type == "week") {
2378
+ type = 'dddd';
2379
+ }
2380
+
2381
+ else if (type == "tel") {
2382
+ type = '(99) 99999-9999;0';
2383
+ }
2384
+
2385
+ else if (type == "text") {
2386
+ type = '';
2387
+ }
2388
+
2389
+ else if (type == "string") {
2390
+ type = '';
2391
+ }
2392
+
2393
+ return type;
2394
+ }
2395
+
2396
+ function transformText() {
2397
+ return {
2398
+ restrict: 'E',
2399
+ require: '?ngModel',
2400
+ link: function(scope, elem, attrs, ngModelCtrl) {
2401
+
2402
+ let textTransform = function(element, value) {
2403
+ if (element && value && (typeof value === 'string' || value instanceof String)) {
2404
+ if(element.css('text-transform') === 'uppercase'){
2405
+ return value.toUpperCase();
2406
+ } else if(element.css('text-transform') === 'lowercase'){
2407
+ return value.toLowerCase();
2408
+ }
2409
+ }
2410
+ return value
2411
+ };
2412
+
2413
+ if (ngModelCtrl) {
2414
+ ngModelCtrl.$formatters.push(function (result) {
2415
+ return textTransform(elem,result)
2416
+ });
2417
+
2418
+ ngModelCtrl.$parsers.push(function (result) {
2419
+ return textTransform(elem,result)
2420
+ });
2421
+ }
2422
+ }
2423
+ }
2424
+ }
2425
+
2426
+