@ajf/material 13.0.0-next.2 → 13.0.0-rc.1

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 (450) hide show
  1. package/barcode/barcode-module.d.ts +11 -21
  2. package/barcode/barcode.d.ts +3 -0
  3. package/barcode/barcode_public_index.d.ts +4 -0
  4. package/barcode/index.d.ts +19 -1
  5. package/barcode/package.json +6 -6
  6. package/calendar/calendar-module.d.ts +10 -21
  7. package/calendar/calendar.d.ts +3 -0
  8. package/calendar/calendar_public_index.d.ts +4 -0
  9. package/calendar/index.d.ts +19 -1
  10. package/calendar/package.json +6 -6
  11. package/checkbox-group/checkbox-group-item.d.ts +3 -0
  12. package/checkbox-group/checkbox-group-module.d.ts +9 -21
  13. package/checkbox-group/checkbox-group_public_index.d.ts +4 -0
  14. package/checkbox-group/index.d.ts +19 -1
  15. package/checkbox-group/package.json +6 -6
  16. package/esm2020/barcode/barcode-module.mjs +63 -0
  17. package/esm2020/barcode/barcode.mjs +51 -0
  18. package/esm2020/barcode/barcode_public_index.mjs +5 -0
  19. package/esm2020/barcode/index.mjs +23 -0
  20. package/{esm2015/barcode/public-api.js → esm2020/barcode/public-api.mjs} +0 -0
  21. package/esm2020/calendar/calendar-module.mjs +43 -0
  22. package/esm2020/calendar/calendar.mjs +49 -0
  23. package/esm2020/calendar/calendar_public_index.mjs +5 -0
  24. package/esm2020/calendar/index.mjs +23 -0
  25. package/{esm2015/calendar/public-api.js → esm2020/calendar/public-api.mjs} +0 -0
  26. package/esm2020/checkbox-group/checkbox-group-item.mjs +51 -0
  27. package/esm2020/checkbox-group/checkbox-group-module.mjs +42 -0
  28. package/esm2020/checkbox-group/checkbox-group_public_index.mjs +5 -0
  29. package/{esm2015/report-builder/image-filter.js → esm2020/checkbox-group/index.mjs} +2 -11
  30. package/{esm2015/checkbox-group/public-api.js → esm2020/checkbox-group/public-api.mjs} +0 -0
  31. package/esm2020/form-builder/branch-line.mjs +68 -0
  32. package/{esm2015/form-builder/choices-origin-data-source.js → esm2020/form-builder/choices-origin-data-source.mjs} +1 -1
  33. package/esm2020/form-builder/choices-origin-editor-dialog.mjs +40 -0
  34. package/esm2020/form-builder/choices-origin-editor.mjs +83 -0
  35. package/esm2020/form-builder/condition-editor-dialog.mjs +38 -0
  36. package/esm2020/form-builder/condition-editor.mjs +147 -0
  37. package/esm2020/form-builder/form-builder-module.mjs +179 -0
  38. package/esm2020/form-builder/form-builder-service.mjs +766 -0
  39. package/{esm2015/form-builder/form-builder-utils.js → esm2020/form-builder/form-builder-utils.mjs} +4 -3
  40. package/esm2020/form-builder/form-builder.mjs +180 -0
  41. package/esm2020/form-builder/form-builder_public_index.mjs +5 -0
  42. package/esm2020/form-builder/index.mjs +23 -0
  43. package/esm2020/form-builder/node-entry.mjs +260 -0
  44. package/esm2020/form-builder/node-properties.mjs +960 -0
  45. package/esm2020/form-builder/node-type-entry.mjs +46 -0
  46. package/{esm2015/form-builder/operations.js → esm2020/form-builder/operations.mjs} +0 -0
  47. package/{esm2015/form-builder/public-api.js → esm2020/form-builder/public-api.mjs} +0 -0
  48. package/esm2020/form-builder/string-identifier-dialog.mjs +79 -0
  49. package/esm2020/form-builder/validation-condition-editor-dialog.mjs +41 -0
  50. package/esm2020/form-builder/warning-condition-editor-dialog.mjs +41 -0
  51. package/esm2020/forms/barcode-field.mjs +45 -0
  52. package/esm2020/forms/boolean-field.mjs +45 -0
  53. package/esm2020/forms/date-field.mjs +45 -0
  54. package/esm2020/forms/date-input-field.mjs +67 -0
  55. package/esm2020/forms/empty-field.mjs +43 -0
  56. package/esm2020/forms/field-service.mjs +116 -0
  57. package/esm2020/forms/field-warning-dialog.mjs +34 -0
  58. package/esm2020/forms/field.mjs +42 -0
  59. package/esm2020/forms/form.mjs +51 -0
  60. package/esm2020/forms/forms-module.mjs +208 -0
  61. package/esm2020/forms/forms_public_index.mjs +5 -0
  62. package/esm2020/forms/index.mjs +23 -0
  63. package/esm2020/forms/input-field.mjs +46 -0
  64. package/esm2020/forms/multiple-choice-field.mjs +54 -0
  65. package/{esm2015/forms/public-api.js → esm2020/forms/public-api.mjs} +0 -0
  66. package/esm2020/forms/range-field.mjs +46 -0
  67. package/esm2020/forms/single-choice-field.mjs +53 -0
  68. package/esm2020/forms/table-field.mjs +45 -0
  69. package/esm2020/forms/text-field.mjs +47 -0
  70. package/esm2020/forms/time-field.mjs +45 -0
  71. package/esm2020/forms/video-url-field.mjs +50 -0
  72. package/esm2020/forms/warning-alert-service.mjs +22 -0
  73. package/esm2020/image/image-module.mjs +40 -0
  74. package/esm2020/image/image.mjs +40 -0
  75. package/esm2020/image/image_public_index.mjs +5 -0
  76. package/esm2020/image/index.mjs +23 -0
  77. package/{esm2015/image/public-api.js → esm2020/image/public-api.mjs} +0 -0
  78. package/{esm2015/index.js → esm2020/index.mjs} +0 -0
  79. package/{esm2015/monaco-editor/auto-complete-item-model.js → esm2020/monaco-editor/auto-complete-item-model.mjs} +0 -0
  80. package/{esm2015/monaco-editor/autocomplete-singleton-model.js → esm2020/monaco-editor/autocomplete-singleton-model.mjs} +3 -2
  81. package/{esm2015/monaco-editor/editor-language-model.js → esm2020/monaco-editor/editor-language-model.mjs} +0 -0
  82. package/{esm2015/monaco-editor/editor-options-model.js → esm2020/monaco-editor/editor-options-model.mjs} +1 -1
  83. package/{esm2015/monaco-editor/editor-scrollbar-options.js → esm2020/monaco-editor/editor-scrollbar-options.mjs} +0 -0
  84. package/{esm2015/monaco-editor/editor-theme.js → esm2020/monaco-editor/editor-theme.mjs} +0 -0
  85. package/esm2020/monaco-editor/index.mjs +23 -0
  86. package/esm2020/monaco-editor/monaco-editor-module.mjs +37 -0
  87. package/esm2020/monaco-editor/monaco-editor.mjs +451 -0
  88. package/esm2020/monaco-editor/monaco-editor_public_index.mjs +5 -0
  89. package/{esm2015/monaco-editor/public-api.js → esm2020/monaco-editor/public-api.mjs} +0 -0
  90. package/esm2020/node-icon/index.mjs +23 -0
  91. package/esm2020/node-icon/node-icon-module.mjs +40 -0
  92. package/esm2020/node-icon/node-icon.mjs +35 -0
  93. package/esm2020/node-icon/node-icon_public_index.mjs +5 -0
  94. package/{esm2015/node-icon/public-api.js → esm2020/node-icon/public-api.mjs} +0 -0
  95. package/esm2020/page-slider/index.mjs +23 -0
  96. package/esm2020/page-slider/page-slider-module.mjs +59 -0
  97. package/esm2020/page-slider/page-slider.mjs +42 -0
  98. package/esm2020/page-slider/page-slider_public_index.mjs +5 -0
  99. package/{esm2015/page-slider/public-api.js → esm2020/page-slider/public-api.mjs} +0 -0
  100. package/esm2020/reports/chart-widget.mjs +38 -0
  101. package/esm2020/reports/formula-widget.mjs +37 -0
  102. package/esm2020/reports/image-container-widget.mjs +41 -0
  103. package/esm2020/reports/image-widget.mjs +37 -0
  104. package/esm2020/reports/index.mjs +23 -0
  105. package/{esm2015/reports/layout-widget.js → esm2020/reports/layout-widget.mjs} +0 -0
  106. package/esm2020/reports/map-widget.mjs +37 -0
  107. package/esm2020/reports/page-break-widget.mjs +37 -0
  108. package/{esm2015/reports/public-api.js → esm2020/reports/public-api.mjs} +0 -0
  109. package/esm2020/reports/report.mjs +39 -0
  110. package/esm2020/reports/reports-module.mjs +112 -0
  111. package/esm2020/reports/reports_public_index.mjs +5 -0
  112. package/esm2020/reports/table-widget.mjs +38 -0
  113. package/esm2020/reports/text-widget.mjs +38 -0
  114. package/esm2020/reports/widget.mjs +102 -0
  115. package/{esm2015/report-builder/operations.js → esm2020/time/index.mjs} +2 -2
  116. package/{esm2015/time/public-api.js → esm2020/time/public-api.mjs} +0 -0
  117. package/esm2020/time/time-module.mjs +41 -0
  118. package/esm2020/time/time.mjs +45 -0
  119. package/esm2020/time/time_public_index.mjs +5 -0
  120. package/fesm2015/barcode.mjs +162 -0
  121. package/fesm2015/barcode.mjs.map +1 -0
  122. package/fesm2015/calendar.mjs +138 -0
  123. package/fesm2015/calendar.mjs.map +1 -0
  124. package/fesm2015/checkbox-group.mjs +142 -0
  125. package/fesm2015/checkbox-group.mjs.map +1 -0
  126. package/fesm2015/form-builder.mjs +2922 -0
  127. package/fesm2015/form-builder.mjs.map +1 -0
  128. package/fesm2015/forms.mjs +1011 -0
  129. package/fesm2015/forms.mjs.map +1 -0
  130. package/fesm2015/image.mjs +127 -0
  131. package/fesm2015/image.mjs.map +1 -0
  132. package/fesm2015/{material.js → material.mjs} +1 -1
  133. package/{bundles/material.umd.js.map → fesm2015/material.mjs.map} +1 -1
  134. package/fesm2015/{monaco-editor.js → monaco-editor.mjs} +179 -124
  135. package/fesm2015/monaco-editor.mjs.map +1 -0
  136. package/fesm2015/node-icon.mjs +123 -0
  137. package/fesm2015/node-icon.mjs.map +1 -0
  138. package/fesm2015/page-slider.mjs +147 -0
  139. package/fesm2015/page-slider.mjs.map +1 -0
  140. package/fesm2015/reports.mjs +551 -0
  141. package/fesm2015/reports.mjs.map +1 -0
  142. package/fesm2015/time.mjs +133 -0
  143. package/fesm2015/time.mjs.map +1 -0
  144. package/fesm2020/barcode.mjs +162 -0
  145. package/fesm2020/barcode.mjs.map +1 -0
  146. package/fesm2020/calendar.mjs +138 -0
  147. package/fesm2020/calendar.mjs.map +1 -0
  148. package/fesm2020/checkbox-group.mjs +140 -0
  149. package/fesm2020/checkbox-group.mjs.map +1 -0
  150. package/fesm2020/form-builder.mjs +2921 -0
  151. package/fesm2020/form-builder.mjs.map +1 -0
  152. package/fesm2020/forms.mjs +985 -0
  153. package/fesm2020/forms.mjs.map +1 -0
  154. package/fesm2020/image.mjs +127 -0
  155. package/fesm2020/image.mjs.map +1 -0
  156. package/{report-builder/image-filter.d.ts → fesm2020/material.mjs} +9 -4
  157. package/fesm2020/material.mjs.map +1 -0
  158. package/fesm2020/monaco-editor.mjs +826 -0
  159. package/fesm2020/monaco-editor.mjs.map +1 -0
  160. package/fesm2020/node-icon.mjs +123 -0
  161. package/fesm2020/node-icon.mjs.map +1 -0
  162. package/fesm2020/page-slider.mjs +147 -0
  163. package/fesm2020/page-slider.mjs.map +1 -0
  164. package/fesm2020/reports.mjs +551 -0
  165. package/fesm2020/reports.mjs.map +1 -0
  166. package/fesm2020/time.mjs +133 -0
  167. package/fesm2020/time.mjs.map +1 -0
  168. package/form-builder/branch-line.d.ts +3 -0
  169. package/form-builder/choices-origin-editor-dialog.d.ts +3 -0
  170. package/form-builder/choices-origin-editor.d.ts +3 -0
  171. package/form-builder/condition-editor-dialog.d.ts +3 -0
  172. package/form-builder/condition-editor.d.ts +3 -0
  173. package/form-builder/form-builder-module.d.ts +41 -21
  174. package/form-builder/form-builder-service.d.ts +3 -0
  175. package/form-builder/form-builder.d.ts +3 -0
  176. package/form-builder/form-builder_public_index.d.ts +4 -0
  177. package/form-builder/index.d.ts +19 -12
  178. package/form-builder/node-entry.d.ts +3 -0
  179. package/form-builder/node-properties.d.ts +3 -0
  180. package/form-builder/node-type-entry.d.ts +3 -0
  181. package/form-builder/package.json +6 -6
  182. package/form-builder/string-identifier-dialog.d.ts +3 -0
  183. package/form-builder/validation-condition-editor-dialog.d.ts +3 -0
  184. package/form-builder/warning-condition-editor-dialog.d.ts +3 -0
  185. package/forms/barcode-field.d.ts +3 -0
  186. package/forms/boolean-field.d.ts +3 -0
  187. package/forms/date-field.d.ts +3 -0
  188. package/forms/date-input-field.d.ts +3 -0
  189. package/forms/empty-field.d.ts +3 -0
  190. package/forms/field-service.d.ts +3 -0
  191. package/forms/field-warning-dialog.d.ts +3 -21
  192. package/forms/field.d.ts +3 -0
  193. package/forms/form.d.ts +3 -0
  194. package/forms/forms-module.d.ts +43 -21
  195. package/forms/forms_public_index.d.ts +4 -0
  196. package/forms/index.d.ts +19 -5
  197. package/forms/input-field.d.ts +3 -0
  198. package/forms/multiple-choice-field.d.ts +3 -0
  199. package/forms/package.json +6 -6
  200. package/forms/range-field.d.ts +3 -0
  201. package/forms/single-choice-field.d.ts +3 -0
  202. package/forms/table-field.d.ts +3 -0
  203. package/forms/text-field.d.ts +3 -0
  204. package/forms/time-field.d.ts +3 -0
  205. package/forms/video-url-field.d.ts +3 -0
  206. package/forms/warning-alert-service.d.ts +3 -0
  207. package/image/image-module.d.ts +7 -21
  208. package/image/image.d.ts +3 -0
  209. package/image/image_public_index.d.ts +4 -0
  210. package/image/index.d.ts +19 -1
  211. package/image/package.json +6 -6
  212. package/monaco-editor/index.d.ts +19 -1
  213. package/monaco-editor/monaco-editor-module.d.ts +5 -21
  214. package/monaco-editor/monaco-editor.d.ts +3 -0
  215. package/monaco-editor/monaco-editor_public_index.d.ts +4 -0
  216. package/monaco-editor/package.json +6 -6
  217. package/node-icon/index.d.ts +19 -1
  218. package/node-icon/node-icon-module.d.ts +7 -21
  219. package/node-icon/node-icon.d.ts +3 -0
  220. package/node-icon/node-icon_public_index.d.ts +4 -0
  221. package/node-icon/package.json +6 -6
  222. package/package.json +111 -11
  223. package/page-slider/index.d.ts +19 -1
  224. package/page-slider/package.json +6 -6
  225. package/page-slider/page-slider-module.d.ts +10 -21
  226. package/page-slider/page-slider.d.ts +3 -0
  227. package/page-slider/page-slider_public_index.d.ts +4 -0
  228. package/reports/chart-widget.d.ts +3 -0
  229. package/reports/formula-widget.d.ts +3 -0
  230. package/reports/image-container-widget.d.ts +3 -0
  231. package/reports/image-widget.d.ts +3 -0
  232. package/reports/index.d.ts +19 -1
  233. package/reports/map-widget.d.ts +3 -0
  234. package/reports/package.json +6 -6
  235. package/reports/page-break-widget.d.ts +3 -0
  236. package/reports/report.d.ts +3 -0
  237. package/reports/reports-module.d.ts +24 -21
  238. package/reports/reports_public_index.d.ts +4 -0
  239. package/reports/table-widget.d.ts +3 -0
  240. package/reports/text-widget.d.ts +3 -0
  241. package/reports/widget.d.ts +9 -0
  242. package/time/index.d.ts +19 -1
  243. package/time/package.json +6 -6
  244. package/time/time-module.d.ts +8 -21
  245. package/time/time.d.ts +3 -0
  246. package/time/time_public_index.d.ts +4 -0
  247. package/barcode/index.metadata.json +0 -1
  248. package/bundles/material-barcode.umd.js +0 -433
  249. package/bundles/material-barcode.umd.js.map +0 -1
  250. package/bundles/material-calendar.umd.js +0 -435
  251. package/bundles/material-calendar.umd.js.map +0 -1
  252. package/bundles/material-checkbox-group.umd.js +0 -432
  253. package/bundles/material-checkbox-group.umd.js.map +0 -1
  254. package/bundles/material-form-builder.umd.js +0 -3558
  255. package/bundles/material-form-builder.umd.js.map +0 -1
  256. package/bundles/material-forms.umd.js +0 -968
  257. package/bundles/material-forms.umd.js.map +0 -1
  258. package/bundles/material-image.umd.js +0 -420
  259. package/bundles/material-image.umd.js.map +0 -1
  260. package/bundles/material-monaco-editor.umd.js +0 -755
  261. package/bundles/material-monaco-editor.umd.js.map +0 -1
  262. package/bundles/material-node-icon.umd.js +0 -415
  263. package/bundles/material-node-icon.umd.js.map +0 -1
  264. package/bundles/material-page-slider.umd.js +0 -424
  265. package/bundles/material-page-slider.umd.js.map +0 -1
  266. package/bundles/material-report-builder.umd.js +0 -5814
  267. package/bundles/material-report-builder.umd.js.map +0 -1
  268. package/bundles/material-reports.umd.js +0 -731
  269. package/bundles/material-reports.umd.js.map +0 -1
  270. package/bundles/material-time.umd.js +0 -424
  271. package/bundles/material-time.umd.js.map +0 -1
  272. package/bundles/material.umd.js +0 -40
  273. package/calendar/index.metadata.json +0 -1
  274. package/checkbox-group/index.metadata.json +0 -1
  275. package/esm2015/barcode/barcode-module.js +0 -50
  276. package/esm2015/barcode/barcode.externs.js +0 -6
  277. package/esm2015/barcode/barcode.js +0 -52
  278. package/esm2015/barcode/index.js +0 -5
  279. package/esm2015/calendar/calendar-module.js +0 -48
  280. package/esm2015/calendar/calendar.externs.js +0 -6
  281. package/esm2015/calendar/calendar.js +0 -55
  282. package/esm2015/calendar/index.js +0 -5
  283. package/esm2015/checkbox-group/checkbox-group-item.js +0 -51
  284. package/esm2015/checkbox-group/checkbox-group-module.js +0 -47
  285. package/esm2015/checkbox-group/checkbox-group.externs.js +0 -6
  286. package/esm2015/checkbox-group/index.js +0 -5
  287. package/esm2015/form-builder/branch-line.js +0 -73
  288. package/esm2015/form-builder/choices-origin-editor-dialog.js +0 -57
  289. package/esm2015/form-builder/choices-origin-editor.js +0 -78
  290. package/esm2015/form-builder/condition-editor-dialog.js +0 -59
  291. package/esm2015/form-builder/condition-editor.js +0 -143
  292. package/esm2015/form-builder/form-builder-module.js +0 -96
  293. package/esm2015/form-builder/form-builder-service.js +0 -764
  294. package/esm2015/form-builder/form-builder.externs.js +0 -6
  295. package/esm2015/form-builder/form-builder.js +0 -187
  296. package/esm2015/form-builder/index.js +0 -16
  297. package/esm2015/form-builder/node-entry.js +0 -245
  298. package/esm2015/form-builder/node-properties.js +0 -968
  299. package/esm2015/form-builder/node-type-entry.js +0 -50
  300. package/esm2015/form-builder/string-identifier-dialog.js +0 -94
  301. package/esm2015/form-builder/validation-condition-editor-dialog.js +0 -59
  302. package/esm2015/form-builder/warning-condition-editor-dialog.js +0 -59
  303. package/esm2015/forms/barcode-field.js +0 -43
  304. package/esm2015/forms/boolean-field.js +0 -43
  305. package/esm2015/forms/date-field.js +0 -43
  306. package/esm2015/forms/date-input-field.js +0 -65
  307. package/esm2015/forms/empty-field.js +0 -43
  308. package/esm2015/forms/field-service.js +0 -115
  309. package/esm2015/forms/field-warning-dialog.js +0 -32
  310. package/esm2015/forms/field.js +0 -45
  311. package/esm2015/forms/form.js +0 -46
  312. package/esm2015/forms/forms-module.js +0 -107
  313. package/esm2015/forms/forms.externs.js +0 -6
  314. package/esm2015/forms/index.js +0 -9
  315. package/esm2015/forms/input-field.js +0 -43
  316. package/esm2015/forms/multiple-choice-field.js +0 -44
  317. package/esm2015/forms/range-field.js +0 -45
  318. package/esm2015/forms/single-choice-field.js +0 -44
  319. package/esm2015/forms/table-field.js +0 -43
  320. package/esm2015/forms/text-field.js +0 -43
  321. package/esm2015/forms/time-field.js +0 -43
  322. package/esm2015/forms/video-url-field.js +0 -47
  323. package/esm2015/forms/warning-alert-service.js +0 -42
  324. package/esm2015/image/image-module.js +0 -42
  325. package/esm2015/image/image.externs.js +0 -6
  326. package/esm2015/image/image.js +0 -44
  327. package/esm2015/image/index.js +0 -5
  328. package/esm2015/material.externs.js +0 -0
  329. package/esm2015/monaco-editor/index.js +0 -5
  330. package/esm2015/monaco-editor/monaco-editor-module.js +0 -36
  331. package/esm2015/monaco-editor/monaco-editor.externs.js +0 -6
  332. package/esm2015/monaco-editor/monaco-editor.js +0 -389
  333. package/esm2015/node-icon/index.js +0 -5
  334. package/esm2015/node-icon/node-icon-module.js +0 -42
  335. package/esm2015/node-icon/node-icon.externs.js +0 -6
  336. package/esm2015/node-icon/node-icon.js +0 -35
  337. package/esm2015/page-slider/index.js +0 -5
  338. package/esm2015/page-slider/page-slider-module.js +0 -49
  339. package/esm2015/page-slider/page-slider.externs.js +0 -6
  340. package/esm2015/page-slider/page-slider.js +0 -44
  341. package/esm2015/report-builder/column.js +0 -97
  342. package/esm2015/report-builder/condition-editor.js +0 -159
  343. package/esm2015/report-builder/content.js +0 -255
  344. package/esm2015/report-builder/custom-widget-dialog.js +0 -51
  345. package/esm2015/report-builder/custom-widget-toolbar-button.js +0 -70
  346. package/esm2015/report-builder/custom-widgets-toolbar.js +0 -124
  347. package/esm2015/report-builder/forms-analyzer-dialog.js +0 -315
  348. package/esm2015/report-builder/forms-analyzer.js +0 -264
  349. package/esm2015/report-builder/image-group.js +0 -106
  350. package/esm2015/report-builder/index.js +0 -25
  351. package/esm2015/report-builder/models.js +0 -23
  352. package/esm2015/report-builder/properties.js +0 -765
  353. package/esm2015/report-builder/public-api.js +0 -26
  354. package/esm2015/report-builder/quill-editor.js +0 -299
  355. package/esm2015/report-builder/renderer-widget.js +0 -238
  356. package/esm2015/report-builder/report-builder-drag-data.js +0 -23
  357. package/esm2015/report-builder/report-builder-module.js +0 -114
  358. package/esm2015/report-builder/report-builder-service.js +0 -1685
  359. package/esm2015/report-builder/report-builder.externs.js +0 -6
  360. package/esm2015/report-builder/report-builder.js +0 -69
  361. package/esm2015/report-builder/theme-color-dialog.js +0 -90
  362. package/esm2015/report-builder/theme-color.js +0 -215
  363. package/esm2015/report-builder/tokens.js +0 -24
  364. package/esm2015/report-builder/toolbar-dialog.js +0 -56
  365. package/esm2015/report-builder/toolbar.js +0 -90
  366. package/esm2015/report-builder/utils.js +0 -48
  367. package/esm2015/report-builder/widget-toolbar-button.js +0 -47
  368. package/esm2015/report-builder/widgets-row-buttons.js +0 -133
  369. package/esm2015/report-builder/widgets-toolbar.js +0 -79
  370. package/esm2015/reports/chart-widget.js +0 -41
  371. package/esm2015/reports/formula-widget.js +0 -41
  372. package/esm2015/reports/image-container-widget.js +0 -43
  373. package/esm2015/reports/image-widget.js +0 -41
  374. package/esm2015/reports/index.js +0 -5
  375. package/esm2015/reports/map-widget.js +0 -41
  376. package/esm2015/reports/page-break-widget.js +0 -41
  377. package/esm2015/reports/report.js +0 -41
  378. package/esm2015/reports/reports-module.js +0 -79
  379. package/esm2015/reports/reports.externs.js +0 -6
  380. package/esm2015/reports/table-widget.js +0 -41
  381. package/esm2015/reports/text-widget.js +0 -41
  382. package/esm2015/reports/widget.js +0 -120
  383. package/esm2015/time/index.js +0 -5
  384. package/esm2015/time/time-module.js +0 -44
  385. package/esm2015/time/time.externs.js +0 -6
  386. package/esm2015/time/time.js +0 -46
  387. package/fesm2015/barcode.js +0 -129
  388. package/fesm2015/barcode.js.map +0 -1
  389. package/fesm2015/calendar.js +0 -128
  390. package/fesm2015/calendar.js.map +0 -1
  391. package/fesm2015/checkbox-group.js +0 -124
  392. package/fesm2015/checkbox-group.js.map +0 -1
  393. package/fesm2015/form-builder.js +0 -2987
  394. package/fesm2015/form-builder.js.map +0 -1
  395. package/fesm2015/forms.js +0 -923
  396. package/fesm2015/forms.js.map +0 -1
  397. package/fesm2015/image.js +0 -113
  398. package/fesm2015/image.js.map +0 -1
  399. package/fesm2015/material.js.map +0 -1
  400. package/fesm2015/monaco-editor.js.map +0 -1
  401. package/fesm2015/node-icon.js +0 -104
  402. package/fesm2015/node-icon.js.map +0 -1
  403. package/fesm2015/page-slider.js +0 -119
  404. package/fesm2015/page-slider.js.map +0 -1
  405. package/fesm2015/report-builder.js +0 -5332
  406. package/fesm2015/report-builder.js.map +0 -1
  407. package/fesm2015/reports.js +0 -560
  408. package/fesm2015/reports.js.map +0 -1
  409. package/fesm2015/time.js +0 -116
  410. package/fesm2015/time.js.map +0 -1
  411. package/form-builder/index.metadata.json +0 -1
  412. package/forms/index.metadata.json +0 -1
  413. package/image/index.metadata.json +0 -1
  414. package/monaco-editor/index.metadata.json +0 -1
  415. package/node-icon/index.metadata.json +0 -1
  416. package/page-slider/index.metadata.json +0 -1
  417. package/report-builder/_report-builder.scss +0 -0
  418. package/report-builder/column.d.ts +0 -63
  419. package/report-builder/condition-editor.d.ts +0 -67
  420. package/report-builder/content.d.ts +0 -142
  421. package/report-builder/custom-widget-dialog.d.ts +0 -31
  422. package/report-builder/custom-widget-toolbar-button.d.ts +0 -45
  423. package/report-builder/custom-widgets-toolbar.d.ts +0 -71
  424. package/report-builder/forms-analyzer-dialog.d.ts +0 -91
  425. package/report-builder/forms-analyzer.d.ts +0 -102
  426. package/report-builder/image-group.d.ts +0 -69
  427. package/report-builder/index.d.ts +0 -24
  428. package/report-builder/index.metadata.json +0 -1
  429. package/report-builder/models.d.ts +0 -43
  430. package/report-builder/operations.d.ts +0 -45
  431. package/report-builder/package.json +0 -9
  432. package/report-builder/properties.d.ts +0 -365
  433. package/report-builder/public-api.d.ts +0 -26
  434. package/report-builder/quill-editor.d.ts +0 -113
  435. package/report-builder/renderer-widget.d.ts +0 -80
  436. package/report-builder/report-builder-drag-data.d.ts +0 -32
  437. package/report-builder/report-builder-module.d.ts +0 -23
  438. package/report-builder/report-builder-service.d.ts +0 -722
  439. package/report-builder/report-builder.d.ts +0 -36
  440. package/report-builder/theme-color-dialog.d.ts +0 -42
  441. package/report-builder/theme-color.d.ts +0 -108
  442. package/report-builder/tokens.d.ts +0 -24
  443. package/report-builder/toolbar-dialog.d.ts +0 -30
  444. package/report-builder/toolbar.d.ts +0 -48
  445. package/report-builder/utils.d.ts +0 -29
  446. package/report-builder/widget-toolbar-button.d.ts +0 -28
  447. package/report-builder/widgets-row-buttons.d.ts +0 -57
  448. package/report-builder/widgets-toolbar.d.ts +0 -44
  449. package/reports/index.metadata.json +0 -1
  450. package/time/index.metadata.json +0 -1
@@ -1,2987 +0,0 @@
1
- import { AjfTranslocoModule } from '@ajf/core/transloco';
2
- import { AjfMonacoEditor, AjfMonacoEditorModule } from '@ajf/material/monaco-editor';
3
- import { AjfNodeIconModule } from '@ajf/material/node-icon';
4
- import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
5
- import { CommonModule } from '@angular/common';
6
- import { Component, ViewEncapsulation, ChangeDetectionStrategy, ElementRef, Renderer2, Input, EventEmitter, Injectable, ViewChild, ChangeDetectorRef, ViewChildren, NgModule } from '@angular/core';
7
- import { Validators, FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';
8
- import { MatAutocompleteModule } from '@angular/material/autocomplete';
9
- import { MatButtonModule } from '@angular/material/button';
10
- import { MatCardModule } from '@angular/material/card';
11
- import { MatCheckboxModule } from '@angular/material/checkbox';
12
- import { MatChipsModule } from '@angular/material/chips';
13
- import { MatDialogRef, MatDialog, MatDialogModule } from '@angular/material/dialog';
14
- import { MatExpansionModule } from '@angular/material/expansion';
15
- import { MatFormFieldModule } from '@angular/material/form-field';
16
- import { MatIconModule } from '@angular/material/icon';
17
- import { MatInputModule } from '@angular/material/input';
18
- import { MatListModule } from '@angular/material/list';
19
- import { MatMenuModule } from '@angular/material/menu';
20
- import { MatSelectModule } from '@angular/material/select';
21
- import { MatSidenavModule } from '@angular/material/sidenav';
22
- import { MatSlideToggleModule } from '@angular/material/slide-toggle';
23
- import { MatSliderModule } from '@angular/material/slider';
24
- import { MatTableDataSource, MatTableModule } from '@angular/material/table';
25
- import { MatToolbarModule } from '@angular/material/toolbar';
26
- import { MatTooltipModule } from '@angular/material/tooltip';
27
- import { isChoicesFixedOrigin, isContainerNode, AjfNodeType, AjfFieldType, createField, createContainerNode, createForm, createChoicesFixedOrigin, isSlidesNode, isFieldWithChoices, isRepeatingContainerNode, isField, createValidationGroup, notEmptyValidation, minValidation, maxValidation, minDigitsValidation, maxDigitsValidation, createValidation, createWarningGroup, notEmptyWarning, createWarning, AjfValidationService, isNumberField } from '@ajf/core/forms';
28
- import { DataSource } from '@angular/cdk/collections';
29
- import { BehaviorSubject, Subject, Subscription, combineLatest } from 'rxjs';
30
- import { filter, map, scan, publishReplay, refCount, withLatestFrom, shareReplay, sample, distinctUntilChanged } from 'rxjs/operators';
31
- import { createCondition, alwaysCondition, createFormula, AjfExpressionUtils, neverCondition } from '@ajf/core/models';
32
- import { deepCopy } from '@ajf/core/utils';
33
- import { ENTER, COMMA } from '@angular/cdk/keycodes';
34
-
35
- /**
36
- * @license
37
- * Copyright (C) Gnucoop soc. coop.
38
- *
39
- * This file is part of the Advanced JSON forms (ajf).
40
- *
41
- * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
42
- * modify it under the terms of the GNU Affero General Public License as
43
- * published by the Free Software Foundation, either version 3 of the License,
44
- * or (at your option) any later version.
45
- *
46
- * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
47
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
48
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
49
- * General Public License for more details.
50
- *
51
- * You should have received a copy of the GNU Affero General Public License
52
- * along with Advanced JSON forms (ajf).
53
- * If not, see http://www.gnu.org/licenses/.
54
- *
55
- */
56
- class AjfFbBranchLine {
57
- constructor(_el, _renderer) {
58
- this._el = _el;
59
- this._renderer = _renderer;
60
- this._offset = 0;
61
- this._height = 0;
62
- }
63
- set offset(offset) {
64
- this._offset = offset;
65
- this._updateOffset();
66
- }
67
- set color(color) {
68
- this._color = color;
69
- this._updateColor();
70
- }
71
- set height(height) {
72
- this._height = height;
73
- this._updateHeight();
74
- }
75
- _updateHeight() {
76
- const height = `${Math.max(0, this._height - 25)}px`;
77
- this._renderer.setStyle(this._el.nativeElement, 'height', height);
78
- }
79
- _updateOffset() {
80
- const margin = `${this._offset * 4}px`;
81
- this._renderer.setStyle(this._el.nativeElement, 'margin-top', margin);
82
- this._renderer.setStyle(this._el.nativeElement, 'margin-left', margin);
83
- }
84
- _updateColor() {
85
- this._renderer.setStyle(this._el.nativeElement, 'border-color', this._color);
86
- }
87
- }
88
- AjfFbBranchLine.decorators = [
89
- { type: Component, args: [{
90
- selector: 'ajf-fb-branch-line',
91
- template: "",
92
- encapsulation: ViewEncapsulation.None,
93
- changeDetection: ChangeDetectionStrategy.OnPush,
94
- styles: ["ajf-fb-branch-line{display:block;position:absolute;top:25px;left:25px;width:25px;border-top:2px solid;border-left:2px solid;border-top-left-radius:6px;transition:height .5s ease-in-out}\n"]
95
- },] }
96
- ];
97
- AjfFbBranchLine.ctorParameters = () => [
98
- { type: ElementRef },
99
- { type: Renderer2 }
100
- ];
101
- AjfFbBranchLine.propDecorators = {
102
- offset: [{ type: Input }],
103
- color: [{ type: Input }],
104
- height: [{ type: Input }]
105
- };
106
-
107
- /**
108
- * @license
109
- * Copyright (C) Gnucoop soc. coop.
110
- *
111
- * This file is part of the Advanced JSON forms (ajf).
112
- *
113
- * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
114
- * modify it under the terms of the GNU Affero General Public License as
115
- * published by the Free Software Foundation, either version 3 of the License,
116
- * or (at your option) any later version.
117
- *
118
- * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
119
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
120
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
121
- * General Public License for more details.
122
- *
123
- * You should have received a copy of the GNU Affero General Public License
124
- * along with Advanced JSON forms (ajf).
125
- * If not, see http://www.gnu.org/licenses/.
126
- *
127
- */
128
- class ChoicesOriginDataSource extends DataSource {
129
- constructor() {
130
- super();
131
- this._choices = new BehaviorSubject([]);
132
- this._choicesObs = this._choices;
133
- }
134
- connect() {
135
- return this._choicesObs;
136
- }
137
- disconnect() { }
138
- updateChoices(choices) {
139
- this._choices.next(choices);
140
- }
141
- }
142
-
143
- /**
144
- * @license
145
- * Copyright (C) Gnucoop soc. coop.
146
- *
147
- * This file is part of the Advanced JSON forms (ajf).
148
- *
149
- * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
150
- * modify it under the terms of the GNU Affero General Public License as
151
- * published by the Free Software Foundation, either version 3 of the License,
152
- * or (at your option) any later version.
153
- *
154
- * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
155
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
156
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
157
- * General Public License for more details.
158
- *
159
- * You should have received a copy of the GNU Affero General Public License
160
- * along with Advanced JSON forms (ajf).
161
- * If not, see http://www.gnu.org/licenses/.
162
- *
163
- */
164
- class AjfFbChoicesOriginEditor {
165
- constructor() {
166
- this._displayedColumns = ['label', 'value', 'delete'];
167
- this.editing = {};
168
- this._choices = new ChoicesOriginDataSource();
169
- this._choicesArr = [];
170
- }
171
- get displayedColumns() {
172
- return this._displayedColumns;
173
- }
174
- get choicesOrigin() {
175
- return this._choicesOrigin;
176
- }
177
- set choicesOrigin(choicesOrigin) {
178
- this._choicesOrigin = choicesOrigin;
179
- this.name = choicesOrigin.name;
180
- this.label = choicesOrigin.label;
181
- this.canEditChoices = isChoicesFixedOrigin(choicesOrigin);
182
- this._choicesArr = choicesOrigin.choices;
183
- this._choices.updateChoices(this._choicesArr);
184
- }
185
- get choices() {
186
- return this._choices;
187
- }
188
- get choicesArr() {
189
- return this._choicesArr;
190
- }
191
- updateValue(evt, cell, _value, rowIdx) {
192
- this.editing[rowIdx + '-' + cell] = false;
193
- this._choicesArr[rowIdx][cell] = evt.target.value;
194
- this._choices.updateChoices(this._choicesArr);
195
- }
196
- deleteRow(rowIdx) {
197
- this._choicesArr.splice(rowIdx, 1);
198
- this._choices.updateChoices(this._choicesArr);
199
- }
200
- addRow() {
201
- this._choicesArr.push({ label: '', value: '' });
202
- this._choices.updateChoices(this._choicesArr);
203
- }
204
- }
205
- AjfFbChoicesOriginEditor.decorators = [
206
- { type: Component, args: [{
207
- selector: 'ajf-fb-choices-origin-editor',
208
- template: "<div>\n <mat-form-field>\n <input matInput [(ngModel)]=\"name\" [placeholder]=\"'Name' | transloco\" />\n </mat-form-field>\n <mat-form-field>\n <input matInput [(ngModel)]=\"label\" [placeholder]=\"'Label' | transloco\" />\n </mat-form-field>\n <ng-template [ngIf]=\"canEditChoices\">\n <button (click)=\"addRow()\" mat-button>\n <mat-icon>add</mat-icon>\n <span>{{'Add value'|transloco}}</span>\n </button>\n <mat-table [dataSource]=\"choices\">\n <ng-container matColumnDef=\"label\">\n <mat-header-cell *matHeaderCellDef\n >{{'Label'|transloco}}</mat-header-cell\n >\n <mat-cell *matCellDef=\"let row; let idx = index\">\n <input matInput [(ngModel)]=\"row.label\" type=\"text\" />\n </mat-cell>\n </ng-container>\n <ng-container matColumnDef=\"value\">\n <mat-header-cell *matHeaderCellDef\n >{{'Value'|transloco}}</mat-header-cell\n >\n <mat-cell *matCellDef=\"let row; let idx = index\">\n <input matInput [(ngModel)]=\"row.value\" type=\"text\" />\n </mat-cell>\n </ng-container>\n <ng-container matColumnDef=\"delete\">\n <mat-header-cell *matHeaderCellDef\n >{{'Delete'|transloco}}</mat-header-cell\n >\n <mat-cell *matCellDef=\"let row; let idx = index\">\n <mat-icon (click)=\"deleteRow(idx)\">{{'delete'|transloco}}</mat-icon>\n </mat-cell>\n </ng-container>\n\n <mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns;\"></mat-row>\n </mat-table>\n </ng-template>\n</div>\n",
209
- encapsulation: ViewEncapsulation.None,
210
- changeDetection: ChangeDetectionStrategy.OnPush,
211
- styles: ["ajf-fb-choices-origin-editor mat-form-field+mat-form-field{margin-left:1em}ajf-fb-choices-origin-editor mat-table{max-height:300px}ajf-fb-choices-origin-editor mat-table mat-icon{cursor:pointer}\n"]
212
- },] }
213
- ];
214
- AjfFbChoicesOriginEditor.propDecorators = {
215
- choicesOrigin: [{ type: Input }]
216
- };
217
-
218
- /**
219
- * @license
220
- * Copyright (C) Gnucoop soc. coop.
221
- *
222
- * This file is part of the Advanced JSON forms (ajf).
223
- *
224
- * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
225
- * modify it under the terms of the GNU Affero General Public License as
226
- * published by the Free Software Foundation, either version 3 of the License,
227
- * or (at your option) any later version.
228
- *
229
- * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
230
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
231
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
232
- * General Public License for more details.
233
- *
234
- * You should have received a copy of the GNU Affero General Public License
235
- * along with Advanced JSON forms (ajf).
236
- * If not, see http://www.gnu.org/licenses/.
237
- *
238
- */
239
- function getNodeContainer(c, node) {
240
- if (c.nodes.indexOf(node) > -1) {
241
- return c;
242
- }
243
- const cns = c.nodes.filter(n => isContainerNode(n));
244
- const len = cns.length;
245
- for (let i = 0; i < len; i++) {
246
- const cn = getNodeContainer(cns[i], node);
247
- if (cn != null) {
248
- return cn;
249
- }
250
- }
251
- return null;
252
- }
253
- function buildFormBuilderNodesSubtree(nodes, parent, ignoreConditionalBranches = false) {
254
- const entries = nodes.filter(n => n.parent === parent.id)
255
- .sort((n1, n2) => n1.parentNode - n2.parentNode)
256
- .map(n => {
257
- const children = buildFormBuilderNodesSubtree(nodes, n);
258
- if (children.length === 0) {
259
- children.push({ parent: n, parentNode: 0 });
260
- }
261
- return {
262
- node: n,
263
- children,
264
- content: buildFormBuilderNodesContent(nodes, n)
265
- };
266
- });
267
- if (!ignoreConditionalBranches) {
268
- const entriesNum = entries.length;
269
- const cbs = parent.conditionalBranches.length;
270
- for (let i = entriesNum; i < cbs; i++) {
271
- entries.push({ parent: parent, parentNode: i });
272
- }
273
- }
274
- return entries;
275
- }
276
- function buildFormBuilderNodesContent(_nodes, node) {
277
- if (isContainerNode(node)) {
278
- return buildFormBuilderNodesSubtree(node.nodes, node, true);
279
- }
280
- return [];
281
- }
282
- function flattenNodes(nodes) {
283
- let flatNodes = [];
284
- nodes.forEach((node) => {
285
- if (isContainerNode(node)) {
286
- flatNodes = flatNodes.concat(flattenNodes(node.nodes));
287
- }
288
- flatNodes.push(node);
289
- });
290
- return flatNodes;
291
- }
292
- function getDescendants(flatNodes, parentNode, branch = null) {
293
- return branch != null ?
294
- flatNodes.filter(n => n.parent === parentNode.id && n.parentNode === branch) :
295
- flatNodes.filter(n => n.parent === parentNode.id);
296
- }
297
- function removeNodes(nodes, ids) {
298
- const len = nodes.length;
299
- for (let i = 0; i < len; i++) {
300
- const node = nodes[i];
301
- if (isContainerNode(node)) {
302
- const container = node;
303
- container.nodes = removeNodes(container.nodes, ids);
304
- }
305
- }
306
- return nodes.filter(n => ids.indexOf(n.id) === -1);
307
- }
308
- function deleteNodeSubtree(nodes, parentNode, branch = null) {
309
- const flatNodes = flattenNodes(nodes);
310
- let delNodes = [];
311
- let descendants = getDescendants(flatNodes, parentNode, branch);
312
- const len = descendants.length;
313
- for (let i = 0; i < len; i++) {
314
- delNodes = delNodes.concat(getDescendants(flatNodes, descendants[i]));
315
- }
316
- delNodes = delNodes.concat(descendants);
317
- return removeNodes(nodes, delNodes.map(n => n.id));
318
- }
319
- let nodeUniqueId = 0;
320
- class AjfFormBuilderService {
321
- constructor() {
322
- this._availableNodeTypes = [
323
- {
324
- label: 'Slide',
325
- icon: { fontSet: 'ajf-icon', fontIcon: 'field-slide' },
326
- nodeType: { node: AjfNodeType.AjfSlide },
327
- isSlide: true
328
- },
329
- {
330
- label: 'Repeating slide',
331
- icon: { fontSet: 'ajf-icon', fontIcon: 'field-repeatingslide' },
332
- nodeType: { node: AjfNodeType.AjfRepeatingSlide },
333
- isSlide: true
334
- },
335
- {
336
- label: 'String',
337
- icon: { fontSet: 'ajf-icon', fontIcon: 'field-string' },
338
- nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.String }
339
- },
340
- {
341
- label: 'Text',
342
- icon: { fontSet: 'ajf-icon', fontIcon: 'field-text' },
343
- nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.Text }
344
- },
345
- {
346
- label: 'Number',
347
- icon: { fontSet: 'ajf-icon', fontIcon: 'field-number' },
348
- nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.Number }
349
- },
350
- {
351
- label: 'Boolean',
352
- icon: { fontSet: 'ajf-icon', fontIcon: 'field-boolean' },
353
- nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.Boolean }
354
- },
355
- {
356
- label: 'Single choice',
357
- icon: { fontSet: 'ajf-icon', fontIcon: 'field-singlechoice' },
358
- nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.SingleChoice }
359
- },
360
- {
361
- label: 'Multiple choice',
362
- icon: { fontSet: 'ajf-icon', fontIcon: 'field-multiplechoice' },
363
- nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.MultipleChoice }
364
- },
365
- {
366
- label: 'Formula',
367
- icon: { fontSet: 'ajf-icon', fontIcon: 'field-formula' },
368
- nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.Formula }
369
- },
370
- {
371
- label: 'Date',
372
- icon: { fontSet: 'ajf-icon', fontIcon: 'field-date' },
373
- nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.Date }
374
- },
375
- {
376
- label: 'Date input',
377
- icon: { fontSet: 'ajf-icon', fontIcon: 'field-dateinput' },
378
- nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.DateInput }
379
- },
380
- {
381
- label: 'Time',
382
- icon: { fontSet: 'ajf-icon', fontIcon: 'field-time' },
383
- nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.Time }
384
- },
385
- {
386
- label: 'Table',
387
- icon: { fontSet: 'ajf-icon', fontIcon: 'field-table' },
388
- nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.Table }
389
- },
390
- {
391
- label: 'Range',
392
- icon: { fontSet: 'ajf-icon', fontIcon: 'field-range' },
393
- nodeType: { node: AjfNodeType.AjfField, field: AjfFieldType.Range }
394
- }
395
- ];
396
- this._form = new BehaviorSubject(null);
397
- this._formObs = this._form;
398
- /**
399
- * A list of the ids of the dropLists connected to the source list.
400
- */
401
- this._connectedDropLists = new BehaviorSubject([]);
402
- this._editedNodeEntry = new BehaviorSubject(null);
403
- this._editedNodeEntryObs = this._editedNodeEntry;
404
- this._editedCondition = new BehaviorSubject(null);
405
- this._editedConditionObs = this._editedCondition;
406
- this._editedChoicesOrigin = new BehaviorSubject(null);
407
- this._editedChoicesOriginObs = this._editedChoicesOrigin;
408
- this._beforeNodesUpdate = new EventEmitter();
409
- this._beforeNodesUpdateObs = this._beforeNodesUpdate;
410
- this._afterNodeUpdate = new EventEmitter();
411
- this._afterNodeUpdateObs = this._afterNodeUpdate;
412
- this._nodesUpdates = new Subject();
413
- this._attachmentsOriginsUpdates = new Subject();
414
- this._choicesOriginsUpdates = new Subject();
415
- this._stringIdentifierUpdates = new Subject();
416
- this._saveNodeEntryEvent = new EventEmitter();
417
- this._deleteNodeEntryEvent = new EventEmitter();
418
- /**
419
- * Event fired when the position of a node in a tree changes.
420
- */
421
- this._moveNodeEntryEvent = new EventEmitter();
422
- /**
423
- * Subscribes to the moveNodeEntryEvent event emitter;
424
- */
425
- this._moveNodeSub = Subscription.EMPTY;
426
- this._initChoicesOriginsStreams();
427
- this._initAttachmentsOriginsStreams();
428
- this._initStringIdentifierStreams();
429
- this._initNodesStreams();
430
- this._initFormStreams();
431
- this._initSaveNode();
432
- this._initMoveNode();
433
- this._initDeleteNode();
434
- }
435
- /**
436
- * Available node types
437
- *
438
- * @readonly
439
- * @memberOf AjfFormBuilderService
440
- */
441
- get availableNodeTypes() {
442
- return this._availableNodeTypes;
443
- }
444
- /**
445
- * Current edited form stream
446
- *
447
- * @readonly
448
- * @memberOf AjfFormBuilderService
449
- */
450
- get form() {
451
- return this._formObs;
452
- }
453
- get attachmentsOrigins() {
454
- return this._attachmentsOrigins;
455
- }
456
- get choicesOrigins() {
457
- return this._choicesOrigins;
458
- }
459
- get stringIdentifier() {
460
- return this._stringIdentifier;
461
- }
462
- get nodes() {
463
- return this._nodes;
464
- }
465
- get flatNodes() {
466
- return this._flatNodes;
467
- }
468
- get flatFields() {
469
- return this._flatFields;
470
- }
471
- get nodeEntriesTree() {
472
- return this._nodeEntriesTree;
473
- }
474
- get connectedDropLists() {
475
- return this._connectedDropLists;
476
- }
477
- get editedNodeEntry() {
478
- return this._editedNodeEntryObs;
479
- }
480
- get editedCondition() {
481
- return this._editedConditionObs;
482
- }
483
- get editedChoicesOrigin() {
484
- return this._editedChoicesOriginObs;
485
- }
486
- get beforeNodesUpdate() {
487
- return this._beforeNodesUpdateObs;
488
- }
489
- get afterNodeUpdate() {
490
- return this._afterNodeUpdateObs;
491
- }
492
- /**
493
- * Sets the current edited form
494
- *
495
- * @param form
496
- *
497
- * @memberOf AjfFormBuilderService
498
- */
499
- setForm(form) {
500
- if (form !== this._form.getValue()) {
501
- this._form.next(form);
502
- }
503
- }
504
- editNodeEntry(nodeEntry) {
505
- this._editedNodeEntry.next(nodeEntry);
506
- }
507
- editCondition(condition) {
508
- this._editedCondition.next(condition);
509
- }
510
- saveCurrentCondition(condition) {
511
- let c = this._editedCondition.getValue();
512
- if (c == null) {
513
- return;
514
- }
515
- c.condition = condition;
516
- this._editedCondition.next(null);
517
- }
518
- cancelConditionEdit() {
519
- this._editedChoicesOrigin.next(null);
520
- }
521
- assignListId(node, empty = false) {
522
- if (node.nodeType === AjfNodeType.AjfSlide || node.nodeType === AjfNodeType.AjfRepeatingSlide) {
523
- const listId = empty ? `empty_fields_list_${node.id}` : `fields_list_${node.id}`;
524
- if (this._connectedDropLists.value.indexOf(listId) == -1) {
525
- this._connectDropList(listId);
526
- }
527
- return listId;
528
- }
529
- return '';
530
- }
531
- insertNode(nodeType, parent, parentNode, inContent = false, insertInIndex = 0) {
532
- var _a;
533
- let node;
534
- const id = ++nodeUniqueId;
535
- const isFieldNode = ((_a = nodeType.nodeType) === null || _a === void 0 ? void 0 : _a.field) != null;
536
- if (isFieldNode) {
537
- node = createField({
538
- id,
539
- nodeType: AjfNodeType.AjfField,
540
- fieldType: nodeType.nodeType.field,
541
- parent: parent.id,
542
- parentNode,
543
- name: '',
544
- });
545
- }
546
- else {
547
- node = createContainerNode({
548
- id,
549
- nodeType: nodeType.nodeType.node,
550
- parent: 0,
551
- parentNode,
552
- name: '',
553
- nodes: [],
554
- });
555
- }
556
- this._beforeNodesUpdate.emit();
557
- this._nodesUpdates.next((nodes) => {
558
- const cn = isContainerNode(parent) && inContent ?
559
- parent :
560
- getNodeContainer({ nodes }, parent);
561
- if (!isFieldNode) {
562
- let newNodes = nodes.slice(0);
563
- newNodes.splice(insertInIndex, 0, node);
564
- newNodes = this._updateNodesList(0, newNodes);
565
- return newNodes;
566
- }
567
- else {
568
- let newNodes = cn.nodes.slice(0);
569
- newNodes.splice(insertInIndex, 0, node);
570
- newNodes = this._updateNodesList(cn.id, newNodes);
571
- cn.nodes = newNodes;
572
- }
573
- return nodes;
574
- });
575
- }
576
- saveNodeEntry(properties) {
577
- this._saveNodeEntryEvent.emit(properties);
578
- }
579
- cancelNodeEntryEdit() {
580
- this._editedNodeEntry.next(null);
581
- }
582
- deleteNodeEntry(nodeEntry) {
583
- this._deleteNodeEntryEvent.next(nodeEntry);
584
- }
585
- /**
586
- * Triggers the moveNode event when a node is moved in the formbuilder.
587
- * @param nodeEntry The node to be moved.
588
- */
589
- moveNodeEntry(nodeEntry, from, to) {
590
- const moveEvent = { nodeEntry: nodeEntry, fromIndex: from, toIndex: to };
591
- this._moveNodeEntryEvent.next(moveEvent);
592
- }
593
- getCurrentForm() {
594
- return combineLatest([
595
- this.form, this._nodesWithoutChoiceOrigins, this.attachmentsOrigins,
596
- this.choicesOrigins, this.stringIdentifier
597
- ])
598
- .pipe(filter(([form]) => form != null), map(([form, nodes, attachmentsOrigins, choicesOrigins, stringIdentifier]) => {
599
- return createForm({
600
- choicesOrigins: choicesOrigins.slice(0),
601
- attachmentsOrigins: attachmentsOrigins.slice(0),
602
- stringIdentifier: (stringIdentifier || []).slice(0),
603
- nodes: nodes.slice(0),
604
- supplementaryInformations: form.supplementaryInformations,
605
- });
606
- }));
607
- }
608
- editChoicesOrigin(choicesOrigin) {
609
- this._editedChoicesOrigin.next(choicesOrigin);
610
- }
611
- createChoicesOrigin() {
612
- this._editedChoicesOrigin.next(createChoicesFixedOrigin({ name: '' }));
613
- }
614
- cancelChoicesOriginEdit() {
615
- this._editedChoicesOrigin.next(null);
616
- }
617
- saveChoicesOrigin(params) {
618
- const choicesOrigin = this._editedChoicesOrigin.getValue();
619
- if (choicesOrigin != null) {
620
- choicesOrigin.label = params.label;
621
- choicesOrigin.name = params.name;
622
- if (isChoicesFixedOrigin(choicesOrigin)) {
623
- choicesOrigin.choices = params.choices;
624
- }
625
- this._choicesOriginsUpdates.next((choicesOrigins) => {
626
- const idx = choicesOrigins.indexOf(choicesOrigin);
627
- if (idx > -1) {
628
- choicesOrigins = [
629
- ...choicesOrigins.slice(0, idx),
630
- choicesOrigin,
631
- ...choicesOrigins.slice(idx + 1),
632
- ];
633
- }
634
- else {
635
- choicesOrigins = [...choicesOrigins, choicesOrigin];
636
- }
637
- return choicesOrigins;
638
- });
639
- }
640
- this._editedChoicesOrigin.next(null);
641
- }
642
- saveStringIdentifier(identifier) {
643
- this._stringIdentifierUpdates.next(() => [...identifier]);
644
- }
645
- _buildFormBuilderNodesTree(nodes) {
646
- this._updateNodesList(0, nodes);
647
- const rootNodes = nodes.filter(n => n.nodeType == AjfNodeType.AjfSlide || n.nodeType == AjfNodeType.AjfRepeatingSlide);
648
- if (rootNodes.length === 0) {
649
- return [null];
650
- }
651
- const rootNode = rootNodes[0];
652
- if (isSlidesNode(rootNode)) {
653
- const tree = [];
654
- tree.push({
655
- node: rootNode,
656
- container: null,
657
- children: buildFormBuilderNodesSubtree(nodes, rootNode),
658
- content: buildFormBuilderNodesContent(nodes, rootNode)
659
- });
660
- return tree;
661
- }
662
- throw new Error('Invalid form definition');
663
- }
664
- /**
665
- * Adds the id of a dropList to be connected with the FormBuilder source list.
666
- * @param listId The id of the list to connect.
667
- */
668
- _connectDropList(listId) {
669
- let connectedLists = this._connectedDropLists.value.slice(0);
670
- this._connectedDropLists.next([...connectedLists, listId]);
671
- }
672
- _findMaxNodeId(nodes, _curMaxId = 0) {
673
- let maxId = 0;
674
- nodes.forEach((n) => {
675
- maxId = Math.max(maxId, n.id);
676
- if (isContainerNode(n)) {
677
- maxId = Math.max(maxId, this._findMaxNodeId(n.nodes));
678
- }
679
- });
680
- return maxId;
681
- }
682
- _initFormStreams() {
683
- this._form.subscribe((form) => {
684
- nodeUniqueId = 0;
685
- if (form != null && form.nodes != null && form.nodes.length > 0) {
686
- nodeUniqueId = this._findMaxNodeId(form.nodes);
687
- }
688
- this._nodesUpdates.next((_nodes) => {
689
- return form != null && form.nodes != null ? form.nodes.slice(0) : [];
690
- });
691
- this._attachmentsOriginsUpdates.next((_attachmentsOrigins) => {
692
- return form != null && form.attachmentsOrigins != null ?
693
- form.attachmentsOrigins.slice(0) :
694
- [];
695
- });
696
- this._choicesOriginsUpdates.next((_choicesOrigins) => {
697
- return form != null && form.choicesOrigins != null ? form.choicesOrigins.slice(0) : [];
698
- });
699
- this._stringIdentifierUpdates.next((_) => {
700
- return form != null && form.stringIdentifier != null ? form.stringIdentifier.slice(0) :
701
- [];
702
- });
703
- });
704
- }
705
- _initChoicesOriginsStreams() {
706
- this._choicesOrigins =
707
- this._choicesOriginsUpdates
708
- .pipe(scan((choicesOrigins, op) => {
709
- return op(choicesOrigins);
710
- }, []), publishReplay(1), refCount());
711
- }
712
- _initAttachmentsOriginsStreams() {
713
- this._attachmentsOrigins = this._attachmentsOriginsUpdates.pipe(scan((attachmentsOrigins, op) => {
714
- return op(attachmentsOrigins);
715
- }, []), publishReplay(1), refCount());
716
- }
717
- _initStringIdentifierStreams() {
718
- this._stringIdentifier = this._stringIdentifierUpdates.pipe(scan((stringIdentifier, op) => {
719
- return op(stringIdentifier);
720
- }, []), publishReplay(1), refCount());
721
- }
722
- _initNodesStreams() {
723
- this._nodes = this._nodesUpdates
724
- .pipe(scan((nodes, op) => {
725
- return op(nodes);
726
- }, []), publishReplay(1), refCount());
727
- this._nodesWithoutChoiceOrigins =
728
- this._nodes.pipe(map(slides => slides.map(slide => {
729
- slide.nodes = slide.nodes.map((node) => {
730
- if (isFieldWithChoices(node)) {
731
- const fwc = deepCopy(node);
732
- if (fwc && fwc.choices) {
733
- delete fwc.choices;
734
- }
735
- if (fwc && fwc.choicesOrigin) {
736
- delete fwc.choicesOrigin;
737
- }
738
- return fwc;
739
- }
740
- return node;
741
- });
742
- return slide;
743
- })));
744
- this._flatNodes = this._nodes.pipe(map((nodes) => flattenNodes(nodes)), publishReplay(1), refCount());
745
- this._flatFields = this._flatNodes.pipe(map((nodes) => nodes.filter(n => !isContainerNode(n))), publishReplay(1), refCount());
746
- this._nodeEntriesTree = this._nodes.pipe(map(nodes => this._buildFormBuilderNodesTree(nodes)), publishReplay(1), refCount());
747
- }
748
- _initSaveNode() {
749
- this._saveNodeEntryEvent
750
- .pipe(withLatestFrom(this.editedNodeEntry, this.choicesOrigins, this.attachmentsOrigins), filter(([_, nodeEntry]) => nodeEntry != null), map(([properties, ne]) => {
751
- this._beforeNodesUpdate.emit();
752
- const nodeEntry = ne;
753
- const origNode = nodeEntry.node;
754
- const node = deepCopy(origNode);
755
- node.id = nodeEntry.node.id;
756
- node.name = properties.name;
757
- node.label = properties.label;
758
- node.visibility = properties.visibility != null ?
759
- createCondition({ condition: properties.visibility }) :
760
- null;
761
- const oldConditionalBranches = node.conditionalBranches.length;
762
- node.conditionalBranches = properties.conditionalBranches != null ?
763
- properties.conditionalBranches.map((condition) => createCondition({ condition })) :
764
- [alwaysCondition()];
765
- const newConditionalBranches = node.conditionalBranches.length;
766
- if (isRepeatingContainerNode(node)) {
767
- const repNode = node;
768
- repNode.formulaReps = properties.formulaReps != null ?
769
- createFormula({ formula: properties.formulaReps }) :
770
- undefined;
771
- repNode.minReps = properties.minReps;
772
- repNode.maxReps = properties.maxReps;
773
- }
774
- if (isField(node)) {
775
- const field = node;
776
- field.description = properties.description;
777
- field.defaultValue = properties.defaultValue;
778
- field.formula = properties.formula != null ?
779
- createFormula({ formula: properties.formula }) :
780
- undefined;
781
- const forceValue = properties.value;
782
- const notEmpty = properties.notEmpty;
783
- const validationConditions = properties.validationConditions;
784
- let minValue = parseInt(properties.minValue, 10);
785
- let maxValue = parseInt(properties.maxValue, 10);
786
- let minDigits = parseInt(properties.minDigits, 10);
787
- let maxDigits = parseInt(properties.maxDigits, 10);
788
- if (isNaN(minValue)) {
789
- minValue = null;
790
- }
791
- if (isNaN(maxValue)) {
792
- maxValue = null;
793
- }
794
- if (isNaN(minDigits)) {
795
- minDigits = null;
796
- }
797
- if (isNaN(maxDigits)) {
798
- maxDigits = null;
799
- }
800
- if (forceValue != null || notEmpty != null ||
801
- (validationConditions != null && validationConditions.length > 0) ||
802
- minValue != null || maxValue != null || minDigits != null ||
803
- maxDigits != null) {
804
- const validation = field.validation || createValidationGroup({});
805
- validation.forceValue = forceValue;
806
- validation.notEmpty = notEmpty ? notEmptyValidation() : undefined;
807
- validation.minValue = minValue != null ? minValidation(minValue) : undefined;
808
- validation.maxValue = maxValue != null ? maxValidation(maxValue) : undefined;
809
- validation.minDigits =
810
- minDigits != null ? minDigitsValidation(minDigits) : undefined;
811
- validation.maxDigits =
812
- maxDigits != null ? maxDigitsValidation(maxDigits) : undefined;
813
- validation.conditions =
814
- (validationConditions ||
815
- []).map((c) => createValidation({
816
- condition: c.condition,
817
- errorMessage: c.errorMessage
818
- }));
819
- field.validation = validation;
820
- }
821
- else {
822
- field.validation = undefined;
823
- }
824
- const notEmptyWarn = properties.notEmptyWarning;
825
- const warningConditions = properties.warningConditions;
826
- if (notEmptyWarn != null ||
827
- (warningConditions != null && warningConditions.length > 0)) {
828
- const warning = field.warning || createWarningGroup({});
829
- warning.notEmpty = notEmptyWarn ? notEmptyWarning() : undefined;
830
- warning.conditions =
831
- (warningConditions ||
832
- []).map((w) => createWarning({
833
- condition: w.condition,
834
- warningMessage: w.warningMessage
835
- }));
836
- field.warning = warning;
837
- }
838
- else {
839
- field.warning = undefined;
840
- }
841
- field.nextSlideCondition = properties.nextSlideCondition != null ?
842
- createCondition({ condition: properties.nextSlideCondition }) :
843
- undefined;
844
- field.size = properties.size;
845
- field.defaultValue = properties.defaultValue;
846
- if (isFieldWithChoices(field)) {
847
- const fwc = field;
848
- fwc.choicesOriginRef = properties.choicesOriginRef;
849
- fwc.forceExpanded = properties.forceExpanded;
850
- fwc.forceNarrow = properties.forceNarrow;
851
- fwc.triggerConditions = (properties.triggerConditions ||
852
- []).map((t) => createCondition({ condition: t }));
853
- }
854
- }
855
- this._editedNodeEntry.next(null);
856
- return (nodes) => {
857
- let cn = getNodeContainer({ nodes }, origNode);
858
- if (cn != null) {
859
- // TODO: @trik check this, was always true?
860
- // if (cn instanceof AjfNode) {
861
- const replaceNodes = cn.nodes === nodes;
862
- const idx = cn.nodes.indexOf(origNode);
863
- let newNodes = cn.nodes.slice(0, idx);
864
- newNodes.push(node);
865
- newNodes = newNodes.concat(cn.nodes.slice(idx + 1));
866
- cn.nodes = newNodes;
867
- if (replaceNodes) {
868
- nodes = newNodes;
869
- }
870
- else {
871
- nodes = nodes.slice(0);
872
- }
873
- // } else {
874
- // const idx = nodes.indexOf(origNode);
875
- // nodes = nodes.slice(0, idx).concat([node]).concat(nodes.slice(idx + 1));
876
- // }
877
- if (newConditionalBranches < oldConditionalBranches) {
878
- for (let i = newConditionalBranches; i < oldConditionalBranches; i++) {
879
- nodes = deleteNodeSubtree(nodes, node, i);
880
- }
881
- }
882
- }
883
- return nodes;
884
- };
885
- }))
886
- .subscribe(this._nodesUpdates);
887
- }
888
- _initDeleteNode() {
889
- this._deleteNodeEntryEvent
890
- .pipe(map((nodeEntry) => {
891
- this._beforeNodesUpdate.emit();
892
- return (nodes) => {
893
- const node = nodeEntry.node;
894
- let cn = getNodeContainer({ nodes }, node);
895
- if (cn != null) {
896
- const replaceNodes = cn.nodes === nodes;
897
- const idx = cn.nodes.indexOf(node);
898
- let newNodes = cn.nodes.slice(0, idx);
899
- newNodes = newNodes.concat(cn.nodes.slice(idx + 1));
900
- cn.nodes = newNodes;
901
- if (replaceNodes) {
902
- nodes = newNodes;
903
- }
904
- else {
905
- nodes = nodes.slice(0);
906
- }
907
- }
908
- return nodes;
909
- };
910
- }))
911
- .subscribe(this._nodesUpdates);
912
- }
913
- /**
914
- * Initializes the subscription to the moveNodeEntryEvent.
915
- */
916
- _initMoveNode() {
917
- this._moveNodeSub.unsubscribe();
918
- this._moveNodeSub =
919
- this._moveNodeEntryEvent
920
- .pipe(map((moveEvent) => {
921
- this._beforeNodesUpdate.emit();
922
- return (nodes) => {
923
- const nodeEntry = moveEvent.nodeEntry;
924
- const node = nodeEntry.node;
925
- let cn = getNodeContainer({ nodes }, node);
926
- let newNodes = nodes;
927
- if (cn != null) {
928
- const replaceNodes = cn.nodes === nodes;
929
- newNodes = cn.nodes;
930
- moveItemInArray(newNodes, moveEvent.fromIndex, moveEvent.toIndex);
931
- newNodes = this._updateNodesList(cn.id, newNodes);
932
- cn.nodes = newNodes;
933
- if (replaceNodes) {
934
- nodes = newNodes;
935
- }
936
- else {
937
- nodes = nodes.slice(0);
938
- }
939
- }
940
- return nodes;
941
- };
942
- }))
943
- .subscribe(this._nodesUpdates);
944
- }
945
- /**
946
- * Updates the "id" and "parent" fields of a modified or rearranged list of nodes.
947
- * @param containerId The id of the parent container of the list.
948
- * @param nodesList The list of nodes to be updated.
949
- */
950
- _updateNodesList(containerId, nodesList) {
951
- if (!nodesList.length) {
952
- return [];
953
- }
954
- const contId = containerId != undefined ? containerId : 0;
955
- for (let idx = 0; idx < nodesList.length; idx++) {
956
- let currentNode = nodesList[idx];
957
- currentNode.id = (contId * 1000) + idx + 1;
958
- currentNode.parent = idx == 0 ? contId : (contId * 1000) + idx;
959
- if (currentNode.nodeType == AjfNodeType.AjfSlide ||
960
- currentNode.nodeType == AjfNodeType.AjfRepeatingSlide) {
961
- const currentSlide = currentNode;
962
- if (currentSlide.nodes) {
963
- this._updateNodesList(currentSlide.id, currentSlide.nodes);
964
- }
965
- }
966
- }
967
- return nodesList;
968
- }
969
- }
970
- AjfFormBuilderService.decorators = [
971
- { type: Injectable }
972
- ];
973
- AjfFormBuilderService.ctorParameters = () => [];
974
-
975
- /**
976
- * @license
977
- * Copyright (C) Gnucoop soc. coop.
978
- *
979
- * This file is part of the Advanced JSON forms (ajf).
980
- *
981
- * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
982
- * modify it under the terms of the GNU Affero General Public License as
983
- * published by the Free Software Foundation, either version 3 of the License,
984
- * or (at your option) any later version.
985
- *
986
- * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
987
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
988
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
989
- * General Public License for more details.
990
- *
991
- * You should have received a copy of the GNU Affero General Public License
992
- * along with Advanced JSON forms (ajf).
993
- * If not, see http://www.gnu.org/licenses/.
994
- *
995
- */
996
- class AjfFbChoicesOriginEditorDialog {
997
- constructor(_service) {
998
- this._service = _service;
999
- this._choicesOrigin =
1000
- this._service.editedChoicesOrigin.pipe(filter(c => c != null), map(c => c));
1001
- }
1002
- get choicesOrigin() {
1003
- return this._choicesOrigin;
1004
- }
1005
- saveChoicesOrigin() {
1006
- this._service.saveChoicesOrigin({ label: this.editor.label, name: this.editor.name, choices: this.editor.choicesArr });
1007
- }
1008
- cancelChoicesOriginEdit() {
1009
- this._service.cancelChoicesOriginEdit();
1010
- }
1011
- }
1012
- AjfFbChoicesOriginEditorDialog.decorators = [
1013
- { type: Component, args: [{
1014
- selector: 'ajf-fb-choices-origin-editor-dialog',
1015
- template: "<h3 matDialogTitle>{{'Edit choices origin'|transloco}}</h3>\n<mat-dialog-content>\n <ajf-fb-choices-origin-editor\n *ngIf=\"choicesOrigin|async as co\"\n [choicesOrigin]=\"co!\"\n ></ajf-fb-choices-origin-editor>\n</mat-dialog-content>\n<mat-dialog-actions>\n <button mat-button (click)=\"saveChoicesOrigin()\">{{'Save'|transloco}}</button>\n <button mat-button (click)=\"cancelChoicesOriginEdit()\">\n {{'Close'|transloco}}\n </button>\n</mat-dialog-actions>\n",
1016
- encapsulation: ViewEncapsulation.None,
1017
- changeDetection: ChangeDetectionStrategy.OnPush,
1018
- styles: ["\n"]
1019
- },] }
1020
- ];
1021
- AjfFbChoicesOriginEditorDialog.ctorParameters = () => [
1022
- { type: AjfFormBuilderService }
1023
- ];
1024
- AjfFbChoicesOriginEditorDialog.propDecorators = {
1025
- editor: [{ type: ViewChild, args: [AjfFbChoicesOriginEditor, { static: false },] }]
1026
- };
1027
-
1028
- /**
1029
- * @license
1030
- * Copyright (C) Gnucoop soc. coop.
1031
- *
1032
- * This file is part of the Advanced JSON forms (ajf).
1033
- *
1034
- * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
1035
- * modify it under the terms of the GNU Affero General Public License as
1036
- * published by the Free Software Foundation, either version 3 of the License,
1037
- * or (at your option) any later version.
1038
- *
1039
- * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
1040
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1041
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
1042
- * General Public License for more details.
1043
- *
1044
- * You should have received a copy of the GNU Affero General Public License
1045
- * along with Advanced JSON forms (ajf).
1046
- * If not, see http://www.gnu.org/licenses/.
1047
- *
1048
- */
1049
- class AjfFbConditionEditor {
1050
- constructor(_) { }
1051
- get fields() {
1052
- return this._fields;
1053
- }
1054
- set fields(fields) {
1055
- this._fields = fields;
1056
- this._updateVariables();
1057
- }
1058
- insertVariable(variable) {
1059
- if (this.monacoEditor != null && this.monacoEditor.editor != null) {
1060
- const editor = this.monacoEditor.editor;
1061
- let value = editor.getValue().split('\n');
1062
- let position = editor.getPosition();
1063
- const ln = position.lineNumber - 1;
1064
- let line = value[ln];
1065
- let col = position.column - 1;
1066
- line = line.substring(0, col) + variable + line.substring(col);
1067
- value[ln] = line;
1068
- position.column += variable.length;
1069
- this.monacoEditor.value = value.join('\n');
1070
- editor.setPosition(position);
1071
- editor.focus();
1072
- this.editedValue = editor.getValue();
1073
- }
1074
- }
1075
- onEditorInit() {
1076
- monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({ noSemanticValidation: false, noSyntaxValidation: false });
1077
- monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
1078
- target: monaco.languages.typescript.ScriptTarget.ES2015,
1079
- allowNonTsExtensions: true,
1080
- allowJs: true,
1081
- module: monaco.languages.typescript.ModuleKind.None
1082
- });
1083
- try {
1084
- monaco.languages.typescript.javascriptDefaults.addExtraLib('', 'condition-editor-variables.d.ts');
1085
- }
1086
- catch (e) {
1087
- monaco.languages.typescript.javascriptDefaults._extraLibs['condition-editor-variables.d.ts'] =
1088
- '';
1089
- }
1090
- try {
1091
- monaco.languages.typescript.javascriptDefaults.addExtraLib('', 'condition-editor-functions.d.ts');
1092
- }
1093
- catch (e) {
1094
- monaco.languages.typescript.javascriptDefaults._extraLibs['condition-editor-functions.d.ts'] =
1095
- '';
1096
- }
1097
- this._updateVariables();
1098
- this._updateFunctions();
1099
- }
1100
- _updateVariables() {
1101
- if (this._fields == null) {
1102
- return;
1103
- }
1104
- try {
1105
- monaco.languages.typescript.javascriptDefaults._extraLibs['condition-editor-variables.d.ts'] =
1106
- this._fields
1107
- .map((field) => {
1108
- return `declare const ${field.name}: ${this._fieldVarType(field.fieldType)};`;
1109
- })
1110
- .join('\n');
1111
- }
1112
- catch (e) {
1113
- }
1114
- }
1115
- _updateFunctions() {
1116
- try {
1117
- monaco.languages.typescript.javascriptDefaults._extraLibs['condition-editor-functions.d.ts'] =
1118
- AjfExpressionUtils.UTIL_FUNCTIONS;
1119
- }
1120
- catch (e) {
1121
- }
1122
- }
1123
- _fieldVarType(fieldType) {
1124
- switch (fieldType) {
1125
- case AjfFieldType.Boolean:
1126
- return 'boolean';
1127
- case AjfFieldType.Date:
1128
- case AjfFieldType.DateInput:
1129
- case AjfFieldType.Time:
1130
- return 'Date';
1131
- case AjfFieldType.Empty:
1132
- return 'void';
1133
- case AjfFieldType.Formula:
1134
- return 'number';
1135
- case AjfFieldType.MultipleChoice:
1136
- case AjfFieldType.SingleChoice:
1137
- return 'any';
1138
- case AjfFieldType.Number:
1139
- return 'number';
1140
- case AjfFieldType.Table:
1141
- return 'Array';
1142
- case AjfFieldType.String:
1143
- case AjfFieldType.Text:
1144
- return 'string';
1145
- }
1146
- return null;
1147
- }
1148
- }
1149
- AjfFbConditionEditor.decorators = [
1150
- { type: Component, args: [{
1151
- selector: 'ajf-condition-editor',
1152
- template: "<div class=\"ajf-editor\">\n <ajf-monaco-editor\n (init)=\"onEditorInit()\"\n (valueChange)=\"editedValue = $event\"\n [value]=\"condition\" language=\"javascript\"></ajf-monaco-editor>\n</div>\n<div class=\"ajf-editor-panel\">\n <ng-container *ngIf=\"fields as curFields\">\n <mat-nav-list dense *ngIf=\"curFields!.length > 0\">\n <a mat-list-item\n (click)=\"insertVariable(field.name)\"\n [matTooltip]=\"field.label\"\n *ngFor=\"let field of curFields!\">\n <ajf-node-icon [node]=\"field\"></ajf-node-icon>\n {{ field.name }}\n </a>\n </mat-nav-list>\n </ng-container>\n</div>\n",
1153
- changeDetection: ChangeDetectionStrategy.OnPush,
1154
- encapsulation: ViewEncapsulation.None,
1155
- styles: ["ajf-condition-editor{display:flex;flex-direction:row;align-items:stretch;max-height:512px}ajf-condition-editor .ajf-editor{flex:.75 0 auto;display:flex;flex-direction:row;align-items:stretch}ajf-condition-editor .ajf-editor monaco-editor{flex:1 0 auto;min-width:512px;min-height:256px}ajf-condition-editor .ajf-editor-panel{flex:.25 0 auto;overflow-y:auto}ajf-condition-editor ajf-monaco-editor{min-width:400px}\n"]
1156
- },] }
1157
- ];
1158
- AjfFbConditionEditor.ctorParameters = () => [
1159
- { type: AjfValidationService }
1160
- ];
1161
- AjfFbConditionEditor.propDecorators = {
1162
- monacoEditor: [{ type: ViewChild, args: [AjfMonacoEditor, { static: true },] }],
1163
- fields: [{ type: Input }],
1164
- condition: [{ type: Input }]
1165
- };
1166
-
1167
- /**
1168
- * @license
1169
- * Copyright (C) Gnucoop soc. coop.
1170
- *
1171
- * This file is part of the Advanced JSON forms (ajf).
1172
- *
1173
- * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
1174
- * modify it under the terms of the GNU Affero General Public License as
1175
- * published by the Free Software Foundation, either version 3 of the License,
1176
- * or (at your option) any later version.
1177
- *
1178
- * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
1179
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1180
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
1181
- * General Public License for more details.
1182
- *
1183
- * You should have received a copy of the GNU Affero General Public License
1184
- * along with Advanced JSON forms (ajf).
1185
- * If not, see http://www.gnu.org/licenses/.
1186
- *
1187
- */
1188
- class AjfFbConditionEditorDialog {
1189
- constructor(service, dialogRef) {
1190
- this.dialogRef = dialogRef;
1191
- this._fields = service.flatFields.pipe(map((fields) => fields.sort((f1, f2) => f1.name.localeCompare(f2.name))));
1192
- }
1193
- get fields() {
1194
- return this._fields;
1195
- }
1196
- saveCondition() {
1197
- if (this.editor == null) {
1198
- return;
1199
- }
1200
- const newValue = this.editor.editedValue;
1201
- this.dialogRef.close(newValue);
1202
- }
1203
- }
1204
- AjfFbConditionEditorDialog.decorators = [
1205
- { type: Component, args: [{
1206
- selector: 'ajf-condition-editor-dialog',
1207
- template: "<h3 matDialogTitle>{{'Edit condition'|transloco}}</h3>\n<mat-dialog-content>\n <ajf-condition-editor\n *ngIf=\"fields|async as curFields\"\n [fields]=\"curFields!\"\n [condition]=\"condition\"\n ></ajf-condition-editor>\n</mat-dialog-content>\n<mat-dialog-actions>\n <button mat-button (click)=\"saveCondition()\">{{'Save'|transloco}}</button>\n <button mat-button matDialogClose>{{'Close'|transloco}}</button>\n</mat-dialog-actions>\n",
1208
- encapsulation: ViewEncapsulation.None,
1209
- changeDetection: ChangeDetectionStrategy.OnPush,
1210
- styles: ["ajf-condition-editor-dialog mat-dialog-content{overflow:visible}\n"]
1211
- },] }
1212
- ];
1213
- AjfFbConditionEditorDialog.ctorParameters = () => [
1214
- { type: AjfFormBuilderService },
1215
- { type: MatDialogRef }
1216
- ];
1217
- AjfFbConditionEditorDialog.propDecorators = {
1218
- editor: [{ type: ViewChild, args: [AjfFbConditionEditor, { static: false },] }]
1219
- };
1220
-
1221
- /**
1222
- * @license
1223
- * Copyright (C) Gnucoop soc. coop.
1224
- *
1225
- * This file is part of the Advanced JSON forms (ajf).
1226
- *
1227
- * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
1228
- * modify it under the terms of the GNU Affero General Public License as
1229
- * published by the Free Software Foundation, either version 3 of the License,
1230
- * or (at your option) any later version.
1231
- *
1232
- * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
1233
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1234
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
1235
- * General Public License for more details.
1236
- *
1237
- * You should have received a copy of the GNU Affero General Public License
1238
- * along with Advanced JSON forms (ajf).
1239
- * If not, see http://www.gnu.org/licenses/.
1240
- *
1241
- */
1242
- /**
1243
- * Triggers when a field or slide node is moved or inserted by drag&dropping in the formbuilder.
1244
- * @param event The drop event.
1245
- * @param fbService The AjfFormBuilderService.
1246
- * @param nodeEntry The current nodeEntry, if present.
1247
- * @param content True if the current nodeEntry contains other nodeEntries.
1248
- */
1249
- function onDropProcess(event, fbService, nodeEntry, content = false) {
1250
- const itemData = event.item.data;
1251
- const containerId = event.container.id;
1252
- if (!itemData.node) {
1253
- if (nodeEntry == null && containerId === 'slides-list') {
1254
- fbService.insertNode(itemData, null, 0, content, event.currentIndex);
1255
- return;
1256
- }
1257
- const emptySlot = content ? { parent: nodeEntry.node, parentNode: 0 } :
1258
- nodeEntry;
1259
- fbService.insertNode(itemData, emptySlot.parent, emptySlot.parentNode, content, event.currentIndex);
1260
- return;
1261
- }
1262
- const previousIndex = event.previousIndex;
1263
- const currentIndex = event.currentIndex;
1264
- fbService.moveNodeEntry(event.item.data, previousIndex, currentIndex);
1265
- }
1266
- /**
1267
- * Disables the drag&drop of Slide items.
1268
- * @param item The dragged item.
1269
- */
1270
- function disableSlideDropPredicate(item) {
1271
- return !item.data.isSlide;
1272
- }
1273
- /**
1274
- * Disables the drag&drop of Field items.
1275
- * @param item The dragged item.
1276
- */
1277
- function disableFieldDropPredicate(item) {
1278
- if (!item.data.isSlide) {
1279
- return false;
1280
- }
1281
- return true;
1282
- }
1283
-
1284
- /**
1285
- * @license
1286
- * Copyright (C) Gnucoop soc. coop.
1287
- *
1288
- * This file is part of the Advanced JSON forms (ajf).
1289
- *
1290
- * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
1291
- * modify it under the terms of the GNU Affero General Public License as
1292
- * published by the Free Software Foundation, either version 3 of the License,
1293
- * or (at your option) any later version.
1294
- *
1295
- * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
1296
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1297
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
1298
- * General Public License for more details.
1299
- *
1300
- * You should have received a copy of the GNU Affero General Public License
1301
- * along with Advanced JSON forms (ajf).
1302
- * If not, see http://www.gnu.org/licenses/.
1303
- *
1304
- */
1305
- class AjfFbStringIdentifierDialogComponent {
1306
- constructor(_service, _cdr) {
1307
- this._service = _service;
1308
- this._cdr = _cdr;
1309
- this.dataSource = new MatTableDataSource();
1310
- this.displayedColumns = ['label', 'value', 'show', 'delete'];
1311
- this.separatorKeysCodes = [ENTER, COMMA];
1312
- this._stringIdentifierSub = Subscription.EMPTY;
1313
- this._stringIdentifierSub = _service.stringIdentifier.subscribe(identifier => {
1314
- this.dataSource.data = [...identifier];
1315
- });
1316
- this.fields$ = _service.flatFields.pipe(map(fields => fields.sort((f1, f2) => f1.name.localeCompare(f2.name))
1317
- .map(f => f.name)
1318
- .filter(f => f.length > 0)), shareReplay(1));
1319
- }
1320
- addRow() {
1321
- this.dataSource.data = [...this.dataSource.data, { label: '', value: [], show: undefined }];
1322
- }
1323
- deleteRow(rowIdx) {
1324
- this.dataSource.data = [
1325
- ...this.dataSource.data.slice(0, rowIdx),
1326
- ...this.dataSource.data.slice(rowIdx + 1),
1327
- ];
1328
- }
1329
- addValue(row, evt, valueInput) {
1330
- if (evt.value.length === 0) {
1331
- return;
1332
- }
1333
- row.value = [...row.value, evt.value];
1334
- valueInput.value = '';
1335
- this._cdr.markForCheck();
1336
- }
1337
- removeValue(row, value) {
1338
- const idx = row.value.indexOf(value);
1339
- if (idx > -1) {
1340
- row.value = [
1341
- ...row.value.slice(0, idx),
1342
- ...row.value.slice(idx + 1),
1343
- ];
1344
- this._cdr.markForCheck();
1345
- }
1346
- }
1347
- ngOnDestroy() {
1348
- this._stringIdentifierSub.unsubscribe();
1349
- }
1350
- saveStringIdentifier() {
1351
- this._service.saveStringIdentifier(this.dataSource.data);
1352
- }
1353
- selected(row, evt) {
1354
- row.value = [...row.value, evt.option.value];
1355
- this._cdr.markForCheck();
1356
- }
1357
- }
1358
- AjfFbStringIdentifierDialogComponent.decorators = [
1359
- { type: Component, args: [{
1360
- selector: 'ajf-fb-string-identifier-dialog',
1361
- template: "<h3 matDialogTitle>{{'Edit identifier'|transloco}}</h3>\n<mat-dialog-content>\n <button (click)=\"addRow()\" mat-button>\n <mat-icon>add</mat-icon>\n <span>{{'Add value'|transloco}}</span>\n </button>\n <mat-table [dataSource]=\"dataSource\">\n <ng-container matColumnDef=\"label\">\n <mat-header-cell *matHeaderCellDef>{{'Label'|transloco}}</mat-header-cell>\n <mat-cell *matCellDef=\"let row; let idx = index\">\n <mat-form-field>\n <input\n matInput\n [placeholder]=\"'Label'|transloco\"\n autofocus\n [(ngModel)]=\"row.label\"\n />\n </mat-form-field>\n </mat-cell>\n </ng-container>\n <ng-container matColumnDef=\"value\">\n <mat-header-cell *matHeaderCellDef>{{'Value'|transloco}}</mat-header-cell>\n <mat-cell *matCellDef=\"let row; let idx = index\">\n <mat-form-field>\n <mat-chip-list #chipList>\n <mat-chip\n *ngFor=\"let field of row.value\"\n (removed)=\"removeValue(row, field)\"\n >\n {{ field }}\n <mat-icon matChipRemove>cancel</mat-icon>\n </mat-chip>\n </mat-chip-list>\n <input\n #valueInput\n [ngModel]=\"row.value\"\n [matAutocomplete]=\"valueAc\"\n [matChipInputFor]=\"chipList\"\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\n [matChipInputAddOnBlur]=\"true\"\n (matChipInputTokenEnd)=\"addValue(row, $event, valueInput)\"\n [placeholder]=\"'Value'|transloco\"\n />\n <mat-autocomplete\n #valueAc=\"matAutocomplete\"\n (optionSelected)=\"selected(row, $event)\"\n >\n <mat-option *ngFor=\"let field of fields$ | async\" [value]=\"field\"\n >{{field}}</mat-option\n >\n </mat-autocomplete>\n </mat-form-field>\n </mat-cell>\n </ng-container>\n <ng-container matColumnDef=\"show\">\n <mat-header-cell *matHeaderCellDef>{{'Show'|transloco}}</mat-header-cell>\n <mat-cell *matCellDef=\"let row; let idx = index\">\n <mat-form-field>\n <mat-select matNativeControl [(ngModel)]=\"row.show\">\n <mat-option value=\"all\">{{'All'|transloco}}</mat-option>\n <mat-option value=\"first\">{{'First'|transloco}}</mat-option>\n <mat-option value=\"last\">{{'Last'|transloco}}</mat-option>\n </mat-select>\n </mat-form-field>\n </mat-cell>\n </ng-container>\n <ng-container matColumnDef=\"delete\">\n <mat-header-cell *matHeaderCellDef\n >{{'Delete'|transloco}}</mat-header-cell\n >\n <mat-cell *matCellDef=\"let row; let idx = index\">\n <mat-icon (click)=\"deleteRow(idx)\">delete</mat-icon>\n </mat-cell>\n </ng-container>\n\n <mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns;\"></mat-row>\n </mat-table>\n</mat-dialog-content>\n<mat-dialog-actions>\n <button mat-button matDialogClose (click)=\"saveStringIdentifier()\">\n {{'Save'|transloco}}\n </button>\n</mat-dialog-actions>\n",
1362
- changeDetection: ChangeDetectionStrategy.OnPush,
1363
- encapsulation: ViewEncapsulation.None,
1364
- styles: ["\n"]
1365
- },] }
1366
- ];
1367
- AjfFbStringIdentifierDialogComponent.ctorParameters = () => [
1368
- { type: AjfFormBuilderService },
1369
- { type: ChangeDetectorRef }
1370
- ];
1371
-
1372
- /**
1373
- * @license
1374
- * Copyright (C) Gnucoop soc. coop.
1375
- *
1376
- * This file is part of the Advanced JSON forms (ajf).
1377
- *
1378
- * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
1379
- * modify it under the terms of the GNU Affero General Public License as
1380
- * published by the Free Software Foundation, either version 3 of the License,
1381
- * or (at your option) any later version.
1382
- *
1383
- * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
1384
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1385
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
1386
- * General Public License for more details.
1387
- *
1388
- * You should have received a copy of the GNU Affero General Public License
1389
- * along with Advanced JSON forms (ajf).
1390
- * If not, see http://www.gnu.org/licenses/.
1391
- *
1392
- */
1393
- class AjfFormBuilder {
1394
- constructor(_service, _dialog) {
1395
- this._service = _service;
1396
- this._dialog = _dialog;
1397
- this._globalExpanded = false;
1398
- /**
1399
- * The list of the ids of all the dropLists connected to the formbuilder source list.
1400
- */
1401
- this._connectedDropLists = this._service.connectedDropLists;
1402
- this._vc = new EventEmitter();
1403
- this._init = false;
1404
- this._editConditionSub = Subscription.EMPTY;
1405
- this._beforeNodesUpdateSub = Subscription.EMPTY;
1406
- this._editChoicesOriginSub = Subscription.EMPTY;
1407
- this._stringIdentifierSub = Subscription.EMPTY;
1408
- this._nodeTypes = _service.availableNodeTypes;
1409
- this._nodeEntriesTree = _service.nodeEntriesTree;
1410
- this._choicesOrigins = _service.choicesOrigins;
1411
- this._editConditionSub =
1412
- this._service.editedCondition.subscribe((condition) => {
1413
- if (this._editConditionDialog != null) {
1414
- this._editConditionDialog.close();
1415
- this._editConditionDialog = null;
1416
- }
1417
- if (condition != null) {
1418
- this._editConditionDialog =
1419
- this._dialog.open(AjfFbConditionEditorDialog, { disableClose: true });
1420
- }
1421
- });
1422
- this._editChoicesOriginSub =
1423
- this._service.editedChoicesOrigin.subscribe((choicesOrigin) => {
1424
- if (this._editChoicesOriginDialog != null) {
1425
- this._editChoicesOriginDialog.close();
1426
- this._editChoicesOriginDialog = null;
1427
- }
1428
- if (choicesOrigin != null) {
1429
- this._editChoicesOriginDialog =
1430
- this._dialog.open(AjfFbChoicesOriginEditorDialog, { disableClose: true });
1431
- }
1432
- });
1433
- this._beforeNodesUpdateSub = this._service.beforeNodesUpdate.subscribe(() => {
1434
- if (this.designerCont == null) {
1435
- return;
1436
- }
1437
- this._lastScrollTop = this.designerCont.nativeElement.scrollTop;
1438
- });
1439
- this.nodeEntriesTree.pipe(sample(this._vc)).subscribe(() => {
1440
- if (this.designerCont == null) {
1441
- return;
1442
- }
1443
- this.designerCont.nativeElement.scrollTop = this._lastScrollTop;
1444
- });
1445
- this._stringIdentifierSub = this._service.stringIdentifier.subscribe(() => { });
1446
- }
1447
- get form() {
1448
- return this._form;
1449
- }
1450
- set form(form) {
1451
- if (this._form !== form) {
1452
- this._form = form;
1453
- if (this._init) {
1454
- this._setCurrentForm();
1455
- }
1456
- }
1457
- }
1458
- get nodeTypes() {
1459
- return this._nodeTypes;
1460
- }
1461
- get nodeEntriesTree() {
1462
- return this._nodeEntriesTree;
1463
- }
1464
- get choicesOrigins() {
1465
- return this._choicesOrigins;
1466
- }
1467
- get isGlobalExpanded() {
1468
- return this._globalExpanded;
1469
- }
1470
- get connectedDropLists() {
1471
- return this._connectedDropLists;
1472
- }
1473
- ngAfterViewChecked() {
1474
- this._vc.emit();
1475
- }
1476
- ngAfterContentInit() {
1477
- this._setCurrentForm();
1478
- this._init = true;
1479
- }
1480
- ngOnDestroy() {
1481
- this._editConditionSub.unsubscribe();
1482
- this._beforeNodesUpdateSub.unsubscribe();
1483
- this._editChoicesOriginSub.unsubscribe();
1484
- this._stringIdentifierSub.unsubscribe();
1485
- this._service.setForm(null);
1486
- }
1487
- createChoicesOrigin() {
1488
- this._service.createChoicesOrigin();
1489
- }
1490
- disableDrop() {
1491
- return false;
1492
- }
1493
- disableFieldDrop(item) {
1494
- return disableFieldDropPredicate(item);
1495
- }
1496
- /**
1497
- * Triggers when a field or slide node is moved or inserted by drag&dropping in the formbuilder.
1498
- * @param event The drop event.
1499
- * @param content True if the current nodeEntry contains other nodeEntries.
1500
- */
1501
- onDrop(event, content = false) {
1502
- onDropProcess(event, this._service, null, content);
1503
- }
1504
- editChoicesOrigin(choicesOrigin) {
1505
- this._service.editChoicesOrigin(choicesOrigin);
1506
- }
1507
- editStringIdentifier() {
1508
- if (this._stringIdentifierDialog != null) {
1509
- this._stringIdentifierDialog.close();
1510
- this._stringIdentifierDialog = null;
1511
- }
1512
- this._stringIdentifierDialog = this._dialog.open(AjfFbStringIdentifierDialogComponent, { disableClose: true, width: '60%', height: '60%' });
1513
- }
1514
- expandAll() {
1515
- this._globalExpanded = true;
1516
- }
1517
- collapseAll() {
1518
- this._globalExpanded = false;
1519
- }
1520
- expandToggle(evt) {
1521
- if (evt.checked) {
1522
- this.expandAll();
1523
- }
1524
- else {
1525
- this.collapseAll();
1526
- }
1527
- }
1528
- _setCurrentForm() {
1529
- this._service.setForm(this._form);
1530
- }
1531
- }
1532
- AjfFormBuilder.decorators = [
1533
- { type: Component, args: [{
1534
- selector: 'ajf-form-builder',
1535
- template: "<mat-toolbar>\n <button mat-icon-button (click)=\"leftSidenav.toggle()\">\n <mat-icon>add_box</mat-icon>\n </button>\n <button mat-button [matMenuTriggerFor]=\"choicesMenu\">\n {{'Choices'|transloco}}\n </button>\n <button mat-button (click)=\"editStringIdentifier()\">\n {{'Identifier'|transloco}}\n </button>\n <button\n mat-icon-button\n aria-label=\"Collapsed\"\n matTooltip=\"Keep slides collapsed\"\n >\n <mat-icon>unfold_less</mat-icon>\n </button>\n <mat-slide-toggle\n color=\"primary\"\n (change)=\"expandToggle($event)\"\n ></mat-slide-toggle>\n <button\n mat-icon-button\n aria-label=\"Expanded\"\n matTooltip=\"Keep slides expanded\"\n >\n <mat-icon>unfold_more</mat-icon>\n </button>\n <mat-menu #choicesMenu>\n <button (click)=\"createChoicesOrigin()\" mat-menu-item>\n {{'New..'|transloco}}\n </button>\n <ng-container *ngIf=\"choicesOrigins|async as cos\">\n <button\n *ngFor=\"let choicesOrigin of cos\"\n (click)=\"editChoicesOrigin(choicesOrigin)\"\n mat-menu-item\n >\n {{ (choicesOrigin.label || choicesOrigin.name)| transloco }}\n </button>\n </ng-container>\n </mat-menu>\n <span class=\"ajf-spacer\"></span>\n <button mat-icon-button (click)=\"rightSidenav.toggle()\">\n <mat-icon>settings</mat-icon>\n </button>\n</mat-toolbar>\n<mat-drawer-container cdkDropListGroup>\n <mat-drawer #leftSidenav position=\"start\" mode=\"over\">\n <div\n #sourceDropList\n cdkDropList\n [cdkDropListConnectedTo]=\"(connectedDropLists|async)!\"\n [cdkDropListEnterPredicate]=\"disableDrop\"\n [cdkDropListData]=\"nodeTypes\"\n >\n <ajf-fb-node-type-entry\n *ngFor=\"let nodeType of nodeTypes\"\n cdkDrag\n [cdkDragData]=\"nodeType\"\n (cdkDragStarted)=\"leftSidenav.close()\"\n [nodeType]=\"nodeType\"\n ></ajf-fb-node-type-entry>\n </div>\n </mat-drawer>\n <mat-drawer #rightSidenav position=\"end\" mode=\"side\" [opened]=\"true\">\n <ajf-fb-node-properties></ajf-fb-node-properties>\n </mat-drawer>\n <div #designer class=\"ajf-designer\">\n <ajf-fb-node-entry\n id=\"slides-list\"\n cdkDropList\n (cdkDropListDropped)=\"onDrop($event)\"\n [cdkDropListEnterPredicate]=\"disableFieldDrop\"\n *ngFor=\"let nodeEntry of (nodeEntriesTree|async); let isFirst = first\"\n [isExpanded]=\"isGlobalExpanded\"\n [isFirst]=\"isFirst\"\n [nodeEntry]=\"nodeEntry\"\n ></ajf-fb-node-entry>\n </div>\n</mat-drawer-container>\n",
1536
- changeDetection: ChangeDetectionStrategy.OnPush,
1537
- encapsulation: ViewEncapsulation.None,
1538
- styles: ["ajf-form-builder{display:flex;position:relative;min-height:300px;flex-direction:column;align-items:stretch}ajf-form-builder mat-toolbar mat-menu div[mat-menu-item]>button[mat-button]{flex:1 0 auto}ajf-form-builder mat-toolbar mat-menu div[mat-menu-item]>button[mat-icon-button]{flex:0 0 auto}ajf-form-builder mat-drawer-container{flex:1}ajf-form-builder mat-drawer-container mat-drawer{max-width:20%}ajf-form-builder mat-drawer-container .ajf-designer{padding:1em}ajf-form-builder mat-toolbar .ajf-spacer{flex:1 1 auto}\n"]
1539
- },] }
1540
- ];
1541
- AjfFormBuilder.ctorParameters = () => [
1542
- { type: AjfFormBuilderService },
1543
- { type: MatDialog }
1544
- ];
1545
- AjfFormBuilder.propDecorators = {
1546
- designerCont: [{ type: ViewChild, args: ['designer', { static: true },] }],
1547
- form: [{ type: Input }]
1548
- };
1549
-
1550
- /**
1551
- * @license
1552
- * Copyright (C) Gnucoop soc. coop.
1553
- *
1554
- * This file is part of the Advanced JSON forms (ajf).
1555
- *
1556
- * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
1557
- * modify it under the terms of the GNU Affero General Public License as
1558
- * published by the Free Software Foundation, either version 3 of the License,
1559
- * or (at your option) any later version.
1560
- *
1561
- * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
1562
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1563
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
1564
- * General Public License for more details.
1565
- *
1566
- * You should have received a copy of the GNU Affero General Public License
1567
- * along with Advanced JSON forms (ajf).
1568
- * If not, see http://www.gnu.org/licenses/.
1569
- *
1570
- */
1571
- const branchColors = [
1572
- '#F44336',
1573
- '#4CAF50',
1574
- '#3F51B5',
1575
- '#FFC107',
1576
- '#795548', // BROWN
1577
- ];
1578
- class AjfFbNodeEntry {
1579
- constructor(_service) {
1580
- this._service = _service;
1581
- this._hasContent = false;
1582
- this._isFirst = false;
1583
- this._isNodeEntry = false;
1584
- this._isExpanded = false;
1585
- this._level = 0;
1586
- this._isDraggable = true;
1587
- this._branchColors = branchColors.slice(0);
1588
- this._dropZones = ['fbdz-node'];
1589
- this._slideDropZones = ['fbdz-slide'];
1590
- this._originOffset = 0;
1591
- this._originLeftMargin = '0';
1592
- this._firstBranchColor = branchColors[0];
1593
- this._branchLinesSubscription = Subscription.EMPTY;
1594
- this._childEntriesSubscription = Subscription.EMPTY;
1595
- this._currentEditedNode = this._service.editedNodeEntry;
1596
- }
1597
- get hasContent() {
1598
- return this._hasContent;
1599
- }
1600
- get isFirst() {
1601
- return this._isFirst;
1602
- }
1603
- set isFirst(isFirst) {
1604
- this._isFirst = isFirst;
1605
- }
1606
- get isNodeEntry() {
1607
- return this._isNodeEntry;
1608
- }
1609
- get isExpanded() {
1610
- return this._isExpanded;
1611
- }
1612
- set isExpanded(exp) {
1613
- this._isExpanded = exp;
1614
- setTimeout(() => this._updateBranchHeights(), 400);
1615
- }
1616
- get nodeEntry() {
1617
- return this._nodeEntry;
1618
- }
1619
- set nodeEntry(nodeEntry) {
1620
- this._nodeEntry = nodeEntry;
1621
- if (nodeEntry != null && nodeEntry.node !== void 0) {
1622
- const ne = nodeEntry;
1623
- this._isNodeEntry = true;
1624
- const node = ne.node;
1625
- this._hasContent = node != null && isContainerNode(node);
1626
- }
1627
- else {
1628
- this._isNodeEntry = false;
1629
- this._hasContent = false;
1630
- }
1631
- }
1632
- get level() {
1633
- return this._level;
1634
- }
1635
- set level(value) {
1636
- this._level = value;
1637
- }
1638
- get isDraggable() {
1639
- return this._isDraggable;
1640
- }
1641
- set isDraggable(draggable) {
1642
- this._isDraggable = draggable;
1643
- }
1644
- get realNodeEntry() {
1645
- return this._nodeEntry;
1646
- }
1647
- get branchColors() {
1648
- return this._branchColors;
1649
- }
1650
- get dropZones() {
1651
- return this._dropZones;
1652
- }
1653
- get slideDropZones() {
1654
- return this._slideDropZones;
1655
- }
1656
- get originOffset() {
1657
- return this._originOffset;
1658
- }
1659
- set originOffset(originOffset) {
1660
- this._originOffset = originOffset;
1661
- this._originLeftMargin = `${this._originOffset * 4}px`;
1662
- }
1663
- get originLeftMargin() {
1664
- return this._originLeftMargin;
1665
- }
1666
- get firstBranchColor() {
1667
- return this._firstBranchColor;
1668
- }
1669
- set firstBranchColor(firstBranchColor) {
1670
- const idx = branchColors.indexOf(firstBranchColor);
1671
- if (idx > 0) {
1672
- this._firstBranchColor = firstBranchColor;
1673
- this._branchColors = branchColors.slice(idx).concat(branchColors.slice(0, idx));
1674
- }
1675
- else {
1676
- this._firstBranchColor = branchColors[0];
1677
- this._branchColors = branchColors.slice(0);
1678
- }
1679
- }
1680
- get currentEditedNode() {
1681
- return this._currentEditedNode;
1682
- }
1683
- onResize() { }
1684
- edit(evt) {
1685
- evt.stopPropagation();
1686
- if (this.nodeEntry == null || !this.isNodeEntry) {
1687
- return;
1688
- }
1689
- this._service.editNodeEntry(this.nodeEntry);
1690
- }
1691
- delete(evt) {
1692
- evt.stopPropagation();
1693
- if (this.nodeEntry == null || !this.isNodeEntry) {
1694
- return;
1695
- }
1696
- this._service.deleteNodeEntry(this.nodeEntry);
1697
- }
1698
- isLastNode() {
1699
- if (!this.realNodeEntry || !this.realNodeEntry.children) {
1700
- return false;
1701
- }
1702
- return !this.realNodeEntry.children[0].children;
1703
- }
1704
- isSlide(node) {
1705
- return isSlidesNode(node);
1706
- }
1707
- ngAfterViewInit() {
1708
- setTimeout(() => this._updateBranchHeights());
1709
- this._childEntriesSubscription = this.childEntries.changes.subscribe(() => {
1710
- this._updateBranchHeights();
1711
- });
1712
- }
1713
- ngOnDestroy() {
1714
- this._branchLinesSubscription.unsubscribe();
1715
- this._childEntriesSubscription.unsubscribe();
1716
- }
1717
- /**
1718
- * Triggers when a field or slide node is moved or inserted by drag&dropping in the formbuilder.
1719
- * @param event The drop event.
1720
- * @param content True if the current nodeEntry contains other nodeEntries.
1721
- */
1722
- onDrop(event, content = false) {
1723
- onDropProcess(event, this._service, this._nodeEntry, content);
1724
- }
1725
- /**
1726
- * Assigns a progressive id to the dropList, to connect it to the FormBuilder source list.
1727
- * @param empty True if the list is marked as empty.
1728
- */
1729
- assignId(empty = false) {
1730
- return this._service.assignListId(this.realNodeEntry.node, empty);
1731
- }
1732
- disableSlideDrop(item) {
1733
- return disableSlideDropPredicate(item);
1734
- }
1735
- disableFieldDrop(item) {
1736
- return disableFieldDropPredicate(item);
1737
- }
1738
- emptyAreaDropPredicate() {
1739
- return (item, _drop) => {
1740
- if (this._level > 0) {
1741
- return !item.data.isSlide;
1742
- }
1743
- return item.data.isSlide || false;
1744
- };
1745
- }
1746
- _updateBranchHeights() {
1747
- if (this.nodeEntry == null || !this.isNodeEntry || this.branchLines == null ||
1748
- this.childEntries == null) {
1749
- return;
1750
- }
1751
- const nodeEntry = this.nodeEntry;
1752
- const branchLines = this.branchLines.toArray();
1753
- const sliceIdx = nodeEntry.content != null ? nodeEntry.content.length : 0;
1754
- const childEntries = this.childEntries.toArray().slice(sliceIdx);
1755
- if (branchLines.length != childEntries.length) {
1756
- return;
1757
- }
1758
- branchLines.forEach((bl, idx) => {
1759
- const ce = childEntries[idx];
1760
- bl.height = ce.nativeElement.offsetTop;
1761
- });
1762
- }
1763
- }
1764
- AjfFbNodeEntry.decorators = [
1765
- { type: Component, args: [{
1766
- selector: 'ajf-fb-node-entry',
1767
- template: "<ng-container *ngIf=\"nodeEntry != null ; else rootEmpty\">\n <ng-template [ngIf]=\"isNodeEntry && !isLastNode()\">\n <ajf-fb-branch-line\n *ngFor=\"let childNodeEntry of realNodeEntry.children; let idx = index\"\n [offset]=\"idx\"\n [color]=\"branchColors[idx]\"\n ></ajf-fb-branch-line>\n </ng-template>\n\n <div\n class=\"mat-card-container\"\n [class.ajf-highlight]=\"(currentEditedNode|async) == nodeEntry\"\n >\n <div\n *ngIf=\"!isFirst\"\n class=\"ajf-origin-line\"\n [style.margin-left]=\"originLeftMargin\"\n [style.border-color]=\"firstBranchColor\"\n ></div>\n <ng-template [ngIf]=\"isNodeEntry\">\n <ng-container *ngIf=\"!isDraggable; else draggable\">\n <mat-card>\n <ng-container *ngTemplateOutlet=\"cardTitle\"></ng-container>\n <ng-container *ngTemplateOutlet=\"cardContent\"></ng-container>\n </mat-card>\n </ng-container>\n\n <ng-template #draggable>\n <mat-card cdkDrag [cdkDragData]=\"realNodeEntry\" class=\"ajf-draggable-box\">\n <ng-container\n *ngIf=\"isSlide(realNodeEntry.node); else fieldPanel\"\n >\n <ng-container *ngTemplateOutlet=\"slidePanel\"></ng-container>\n </ng-container>\n </mat-card>\n </ng-template>\n\n <ng-template #slidePanel>\n <mat-expansion-panel\n [expanded]=\"isExpanded\"\n (opened)=\"isExpanded = true\"\n (closed)=\"isExpanded = false\"\n class=\"mat-elevation-z\"\n >\n <mat-expansion-panel-header>\n <ng-container *ngTemplateOutlet=\"cardTitle\"></ng-container>\n </mat-expansion-panel-header>\n <ng-container *ngTemplateOutlet=\"cardContent\"></ng-container>\n </mat-expansion-panel>\n </ng-template>\n\n <ng-template #fieldPanel>\n <ng-container *ngTemplateOutlet=\"cardTitle\"></ng-container>\n <ng-container *ngTemplateOutlet=\"cardContent\"></ng-container>\n </ng-template>\n\n <ng-template #cardTitle>\n <div class=\"ajf-title-row\">\n <ajf-node-icon [node]=\"realNodeEntry.node\"></ajf-node-icon>\n <span\n class=\"ajf-title\"\n [innerHTML]=\"(realNodeEntry.node.label || realNodeEntry.node.name) | transloco\"\n ></span>\n <span\n *ngIf=\"realNodeEntry.node.visibility && realNodeEntry.node.visibility?.condition !== 'true'\"\n class=\"ajf-visibility-condition\"\n [innerHTML]=\"'Condition: (' + realNodeEntry.node.visibility?.condition + ')'\"\n >\n </span>\n <span class=\"ajf-actions\">\n <button\n [disabled]=\"(currentEditedNode|async) == nodeEntry\"\n (click)=\"edit($event)\"\n mat-icon-button\n >\n <mat-icon>edit</mat-icon>\n </button>\n <button\n [disabled]=\"(currentEditedNode|async) == null\"\n (click)=\"delete($event)\"\n mat-icon-button\n >\n <mat-icon>delete</mat-icon>\n </button>\n </span>\n </div>\n </ng-template>\n\n <ng-template #cardContent>\n <div *ngIf=\"hasContent\">\n <ajf-fb-node-entry\n cdkDropList\n class=\"ajf-fields-list\"\n *ngFor=\"let contentEntry of realNodeEntry.content; let isFirstChild = first; let idx = index\"\n [id]=\"assignId()\"\n [level]=\"level + 1\"\n [isFirst]=\"isFirstChild\"\n [firstBranchColor]=\"branchColors[idx]\"\n [nodeEntry]=\"contentEntry\"\n [cdkDropListEnterPredicate]=\"disableSlideDrop\"\n (cdkDropListDropped)=\"onDrop($event, true)\"\n [isExpanded]=\"isExpanded\"\n ></ajf-fb-node-entry>\n <mat-card\n class=\"ajf-empty\"\n *ngIf=\"realNodeEntry.content.length === 0\"\n cdkDropList\n [id]=\"assignId(true)\"\n [cdkDropListEnterPredicate]=\"disableSlideDrop\"\n (cdkDropListDropped)=\"onDrop($event, true)\"\n ><mat-card-title>Drop your fields here</mat-card-title></mat-card\n >\n </div>\n </ng-template>\n </ng-template>\n </div>\n\n <ng-template [ngIf]=\"isNodeEntry\">\n <ng-container\n *ngFor=\"let childNodeEntry of realNodeEntry.children; let idx = index\"\n >\n <ajf-fb-node-entry\n *ngIf=\"!isLastNode()\"\n [level]=\"level\"\n [originOffset]=\"idx\"\n [firstBranchColor]=\"branchColors[idx]\"\n [nodeEntry]=\"childNodeEntry\"\n [isExpanded]=\"isExpanded\"\n ></ajf-fb-node-entry>\n </ng-container>\n </ng-template>\n</ng-container>\n\n<ng-template #rootEmpty>\n <div class=\"mat-card-container\">\n <mat-card\n class=\"ajf-empty\"\n cdkDropList\n [cdkDropListEnterPredicate]=\"emptyAreaDropPredicate()\"\n (cdkDropListDropped)=\"onDrop($event)\"\n ><mat-card-title>Drop your slides here</mat-card-title>\n </mat-card>\n </div>\n</ng-template>\n",
1768
- host: { '(window.resize)': 'onResize()' },
1769
- encapsulation: ViewEncapsulation.None,
1770
- changeDetection: ChangeDetectionStrategy.OnPush,
1771
- styles: ["ajf-fb-node-entry{display:block;position:relative}ajf-fb-node-entry .mat-card-container{position:relative}ajf-fb-node-entry .mat-card-container .ajf-origin-line{position:absolute;top:0;left:25px;width:25px;height:25px;border-bottom:2px solid;border-left:2px solid;border-bottom-left-radius:.5em}ajf-fb-node-entry .mat-card-container mat-card{margin-left:50px;padding:.5em 1em;margin-top:.2em;margin-bottom:.2em;background-color:#fff}ajf-fb-node-entry .mat-card-container mat-card .ajf-title-row{display:flex;flex:1 1 auto;flex-direction:row;align-items:center}ajf-fb-node-entry .mat-card-container mat-card .ajf-title-row>.ajf-title{flex:1 1 auto}ajf-fb-node-entry .mat-card-container mat-card .ajf-title-row>.ajf-visibility-condition{flex:1 1 auto;font-size:10px;color:#999}ajf-fb-node-entry .mat-card-container mat-card .ajf-title-row>.ajf-actions{flex:0 0 auto;white-space:nowrap}ajf-fb-node-entry .mat-card-container mat-card.ajf-empty{line-height:36px;border:2px dashed;box-shadow:none;box-sizing:border-box;text-align:center;color:#ccc}ajf-fb-node-entry .mat-card-container mat-card.ajf-draggable-box{padding:20px 10px;border-bottom:solid 1px #ccc;border-right:solid 1px #ccc;color:rgba(0,0,0,.87);box-sizing:border-box;cursor:move;background:#fff;font-size:14px}ajf-fb-node-entry .mat-card-container.ajf-highlight>mat-card{background-color:#fff9c4}ajf-fb-node-entry.ajf-fields-list{max-width:80%;min-height:60px;display:block;background:#fff;border-radius:4px;overflow:hidden}ajf-fb-node-entry .cdk-drag-placeholder{opacity:0;min-height:60px}ajf-fb-node-entry .ajf-fields-list.cdk-drop-list-dragging .ajf-draggable-box:not(.cdk-drag-placeholder),ajf-fb-node-entry .cdk-drag-animating{transition:transform 250ms cubic-bezier(0, 0, 0.2, 1)}\n"]
1772
- },] }
1773
- ];
1774
- AjfFbNodeEntry.ctorParameters = () => [
1775
- { type: AjfFormBuilderService }
1776
- ];
1777
- AjfFbNodeEntry.propDecorators = {
1778
- branchLines: [{ type: ViewChildren, args: [AjfFbBranchLine,] }],
1779
- childEntries: [{ type: ViewChildren, args: [AjfFbNodeEntry, { read: ElementRef },] }],
1780
- isFirst: [{ type: Input }],
1781
- isExpanded: [{ type: Input }],
1782
- nodeEntry: [{ type: Input }],
1783
- level: [{ type: Input }],
1784
- isDraggable: [{ type: Input }],
1785
- originOffset: [{ type: Input }],
1786
- firstBranchColor: [{ type: Input }]
1787
- };
1788
-
1789
- /**
1790
- * @license
1791
- * Copyright (C) Gnucoop soc. coop.
1792
- *
1793
- * This file is part of the Advanced JSON forms (ajf).
1794
- *
1795
- * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
1796
- * modify it under the terms of the GNU Affero General Public License as
1797
- * published by the Free Software Foundation, either version 3 of the License,
1798
- * or (at your option) any later version.
1799
- *
1800
- * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
1801
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1802
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
1803
- * General Public License for more details.
1804
- *
1805
- * You should have received a copy of the GNU Affero General Public License
1806
- * along with Advanced JSON forms (ajf).
1807
- * If not, see http://www.gnu.org/licenses/.
1808
- *
1809
- */
1810
- class AjfFbValidationConditionEditorDialog {
1811
- constructor(service, dialogRef) {
1812
- this.dialogRef = dialogRef;
1813
- this._fields = service.flatFields.pipe(map((fields) => fields.sort((f1, f2) => f1.name.localeCompare(f2.name))));
1814
- }
1815
- get fields() {
1816
- return this._fields;
1817
- }
1818
- saveCondition() {
1819
- if (this.editor == null) {
1820
- return;
1821
- }
1822
- const newValue = this.editor.editedValue;
1823
- this.dialogRef.close({ condition: newValue, errorMessage: this.errorMessage });
1824
- }
1825
- }
1826
- AjfFbValidationConditionEditorDialog.decorators = [
1827
- { type: Component, args: [{
1828
- selector: 'ajf-fb-validation-condition-editor-dialog',
1829
- template: "<h3 matDialogTitle>{{'Edit condition'|transloco}}</h3>\n<mat-dialog-content>\n <mat-form-field>\n <input\n matInput\n [(ngModel)]=\"errorMessage\"\n [placeholder]=\"'Error message'|transloco\"\n />\n </mat-form-field>\n <ajf-condition-editor\n *ngIf=\"fields|async as curFields\"\n [fields]=\"curFields!\"\n [condition]=\"condition\"\n ></ajf-condition-editor>\n</mat-dialog-content>\n<mat-dialog-actions>\n <button mat-button (click)=\"saveCondition()\">{{'Save'|transloco}}</button>\n <button mat-button matDialogClose>{{'Close'|transloco}}</button>\n</mat-dialog-actions>\n",
1830
- encapsulation: ViewEncapsulation.None,
1831
- changeDetection: ChangeDetectionStrategy.OnPush,
1832
- styles: ["ajf-fb-validation-condition-editor-dialog mat-dialog-content{overflow:visible}\n"]
1833
- },] }
1834
- ];
1835
- AjfFbValidationConditionEditorDialog.ctorParameters = () => [
1836
- { type: AjfFormBuilderService },
1837
- { type: MatDialogRef }
1838
- ];
1839
- AjfFbValidationConditionEditorDialog.propDecorators = {
1840
- editor: [{ type: ViewChild, args: [AjfFbConditionEditor, { static: false },] }]
1841
- };
1842
-
1843
- /**
1844
- * @license
1845
- * Copyright (C) Gnucoop soc. coop.
1846
- *
1847
- * This file is part of the Advanced JSON forms (ajf).
1848
- *
1849
- * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
1850
- * modify it under the terms of the GNU Affero General Public License as
1851
- * published by the Free Software Foundation, either version 3 of the License,
1852
- * or (at your option) any later version.
1853
- *
1854
- * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
1855
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1856
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
1857
- * General Public License for more details.
1858
- *
1859
- * You should have received a copy of the GNU Affero General Public License
1860
- * along with Advanced JSON forms (ajf).
1861
- * If not, see http://www.gnu.org/licenses/.
1862
- *
1863
- */
1864
- class AjfFbWarningConditionEditorDialog {
1865
- constructor(service, dialogRef) {
1866
- this.dialogRef = dialogRef;
1867
- this._fields = service.flatFields.pipe(map((fields) => fields.sort((f1, f2) => f1.name.localeCompare(f2.name))));
1868
- }
1869
- get fields() {
1870
- return this._fields;
1871
- }
1872
- saveCondition() {
1873
- if (this.editor == null) {
1874
- return;
1875
- }
1876
- const newValue = this.editor.editedValue;
1877
- this.dialogRef.close({ condition: newValue, warningMessage: this.warningMessage });
1878
- }
1879
- }
1880
- AjfFbWarningConditionEditorDialog.decorators = [
1881
- { type: Component, args: [{
1882
- selector: 'ajf-fb-warning-condition-editor-dialog',
1883
- template: "<h3 matDialogTitle>{{'Edit condition'|transloco}}</h3>\n<mat-dialog-content>\n <mat-form-field>\n <input\n matInput\n [(ngModel)]=\"warningMessage\"\n [placeholder]=\"'Warning message' | transloco\"\n />\n </mat-form-field>\n <ajf-condition-editor\n *ngIf=\"fields|async as curFields\"\n [fields]=\"curFields!\"\n [condition]=\"condition\"\n ></ajf-condition-editor>\n</mat-dialog-content>\n<mat-dialog-actions>\n <button mat-button (click)=\"saveCondition()\">{{'Save'|transloco}}</button>\n <button mat-button matDialogClose>{{'Close'|transloco}}</button>\n</mat-dialog-actions>\n",
1884
- encapsulation: ViewEncapsulation.None,
1885
- changeDetection: ChangeDetectionStrategy.OnPush,
1886
- styles: ["ajf-fb-warning-condition-editor-dialog mat-dialog-content{overflow:visible}\n"]
1887
- },] }
1888
- ];
1889
- AjfFbWarningConditionEditorDialog.ctorParameters = () => [
1890
- { type: AjfFormBuilderService },
1891
- { type: MatDialogRef }
1892
- ];
1893
- AjfFbWarningConditionEditorDialog.propDecorators = {
1894
- editor: [{ type: ViewChild, args: [AjfFbConditionEditor, { static: false },] }]
1895
- };
1896
-
1897
- /**
1898
- * @license
1899
- * Copyright (C) Gnucoop soc. coop.
1900
- *
1901
- * This file is part of the Advanced JSON forms (ajf).
1902
- *
1903
- * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
1904
- * modify it under the terms of the GNU Affero General Public License as
1905
- * published by the Free Software Foundation, either version 3 of the License,
1906
- * or (at your option) any later version.
1907
- *
1908
- * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
1909
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1910
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
1911
- * General Public License for more details.
1912
- *
1913
- * You should have received a copy of the GNU Affero General Public License
1914
- * along with Advanced JSON forms (ajf).
1915
- * If not, see http://www.gnu.org/licenses/.
1916
- *
1917
- */
1918
- function checkRepsValidity(c) {
1919
- const minReps = c.value.minReps;
1920
- const maxReps = c.value.maxReps;
1921
- if (minReps != null && maxReps != null && minReps > maxReps) {
1922
- return { reps: 'Min repetions cannot be greater than max repetitions' };
1923
- }
1924
- return null;
1925
- }
1926
- function checkValueLimitsValidity(c) {
1927
- const minValue = c.value.minValue;
1928
- const maxValue = c.value.maxValue;
1929
- if (minValue != null && maxValue != null && minValue > maxValue) {
1930
- return { valueLimit: 'Min value cannot be greater than max value' };
1931
- }
1932
- return null;
1933
- }
1934
- function checkDigitsValidity(c) {
1935
- const minDigits = c.value.minDigits;
1936
- const maxDigits = c.value.maxDigits;
1937
- if (minDigits != null && maxDigits != null && minDigits > maxDigits) {
1938
- return { digits: 'Min digits cannot be greater than max digits' };
1939
- }
1940
- return null;
1941
- }
1942
- class AjfFbNodeProperties {
1943
- constructor(_cdr, _service, _dialog, _fb) {
1944
- this._cdr = _cdr;
1945
- this._service = _service;
1946
- this._dialog = _dialog;
1947
- this._fb = _fb;
1948
- this._fieldSizes = [
1949
- { label: 'Normal', value: 'normal' }, { label: 'Small', value: 'small' },
1950
- { label: 'Smaller', value: 'smaller' }, { label: 'Tiny', value: 'tiny' },
1951
- { label: 'Mini', value: 'mini' }
1952
- ];
1953
- this._choicesOrigins = [];
1954
- this._conditionalBranches = [];
1955
- this._validationConditions = [];
1956
- this._warningConditions = [];
1957
- this.isRepeatingContainerNode = (nodeEntry) => {
1958
- return nodeEntry != null && isRepeatingContainerNode(nodeEntry.node);
1959
- };
1960
- this._visibilityOptSub = Subscription.EMPTY;
1961
- this._visibilitySub = Subscription.EMPTY;
1962
- this._conditionalBranchesSub = Subscription.EMPTY;
1963
- this._formulaRepsSub = Subscription.EMPTY;
1964
- this._choicesFilterSub = Subscription.EMPTY;
1965
- this._formulaSub = Subscription.EMPTY;
1966
- this._forceValueSub = Subscription.EMPTY;
1967
- this._validationConditionsSub = Subscription.EMPTY;
1968
- this._warningConditionsSub = Subscription.EMPTY;
1969
- this._nextSlideConditionSub = Subscription.EMPTY;
1970
- this._choicesOriginsSub = Subscription.EMPTY;
1971
- this._triggerConditionsSub = Subscription.EMPTY;
1972
- this._editConditionDialogSub = Subscription.EMPTY;
1973
- this._editValidationConditionDialogSub = Subscription.EMPTY;
1974
- this._editWarningConditionDialogSub = Subscription.EMPTY;
1975
- this._editVisibilityEvt = new EventEmitter();
1976
- this._editVisibilitySub = Subscription.EMPTY;
1977
- this._editConditionalBranchEvt = new EventEmitter();
1978
- this._editConditionalBranchSub = Subscription.EMPTY;
1979
- this._editFormulaRepsEvt = new EventEmitter();
1980
- this._editFormulaRepsSub = Subscription.EMPTY;
1981
- this._editChoicesFilterEvt = new EventEmitter();
1982
- this._editChoicesFilterSub = Subscription.EMPTY;
1983
- this._editFormulaEvt = new EventEmitter();
1984
- this._editFormulaSub = Subscription.EMPTY;
1985
- this._editForceValueEvt = new EventEmitter();
1986
- this._editForceValueSub = Subscription.EMPTY;
1987
- this._editValidationConditionEvt = new EventEmitter();
1988
- this._editValidationConditionSub = Subscription.EMPTY;
1989
- this._addValidationConditionEvt = new EventEmitter();
1990
- this._addValidationConditionSub = Subscription.EMPTY;
1991
- this._removeValidationConditionEvt = new EventEmitter();
1992
- this._removeValidationConditionSub = Subscription.EMPTY;
1993
- this._editWarningConditionEvt = new EventEmitter();
1994
- this._editWarningConditionSub = Subscription.EMPTY;
1995
- this._addWarningConditionEvt = new EventEmitter();
1996
- this._addWarningConditionSub = Subscription.EMPTY;
1997
- this._removeWarningConditionEvt = new EventEmitter();
1998
- this._removeWarningConditionSub = Subscription.EMPTY;
1999
- this._editNextSlideConditionEvt = new EventEmitter();
2000
- this._editNextSlideConditionSub = Subscription.EMPTY;
2001
- this._editTriggerConditionEvt = new EventEmitter();
2002
- this._editTriggerConditionSub = Subscription.EMPTY;
2003
- this._addTriggerConditionEvt = new EventEmitter();
2004
- this._addTriggerConditionSub = Subscription.EMPTY;
2005
- this._removeTriggerConditionEvt = new EventEmitter();
2006
- this._removeTriggerConditionSub = Subscription.EMPTY;
2007
- this._saveEvt = new EventEmitter();
2008
- this._saveSub = Subscription.EMPTY;
2009
- this._nodeEntry = _service.editedNodeEntry;
2010
- this._choicesOriginsSub =
2011
- _service.choicesOrigins.subscribe((c) => this._choicesOrigins = c || []);
2012
- this._enabled = this._nodeEntry.pipe(map((n) => n != null));
2013
- this._initForm();
2014
- this._initVisibilityEdit();
2015
- this._initConditionalBranchEdit();
2016
- this._initFormulaRepsEdit();
2017
- this._initChoicesFilterEdit();
2018
- this._initFormulaEdit();
2019
- this._initForceValueEdit();
2020
- this._initValidationConditionEdit();
2021
- this._initAddValidationCondition();
2022
- this._initRemoveValidationCondition();
2023
- this._initWarningConditionEdit();
2024
- this._initAddWarningCondition();
2025
- this._initRemoveWarningCondition();
2026
- this._initNextSlideConditionEdit();
2027
- this._initTriggerConditionEdit();
2028
- this._initAddTriggerCondition();
2029
- this._initRemoveTriggerCondition();
2030
- this._initSave();
2031
- }
2032
- get fieldSizes() {
2033
- return this._fieldSizes;
2034
- }
2035
- get nodeEntry() {
2036
- return this._nodeEntry;
2037
- }
2038
- get choicesOrigins() {
2039
- return this._choicesOrigins;
2040
- }
2041
- get enabled() {
2042
- return this._enabled;
2043
- }
2044
- get propertiesForm() {
2045
- return this._propertiesForm;
2046
- }
2047
- get hasChoices() {
2048
- return this._hasChoices;
2049
- }
2050
- get curVisibility() {
2051
- return this._curVisibility;
2052
- }
2053
- get curFormulaReps() {
2054
- return this._curFormulaReps;
2055
- }
2056
- get curChoicesFilter() {
2057
- return this._curChoicesFilter;
2058
- }
2059
- get curForceValue() {
2060
- return this._curForceValue;
2061
- }
2062
- get curFormula() {
2063
- return this._curFormula;
2064
- }
2065
- get conditionalBranches() {
2066
- return this._conditionalBranches;
2067
- }
2068
- get validationConditions() {
2069
- return this._validationConditions;
2070
- }
2071
- get warningConditions() {
2072
- return this._warningConditions;
2073
- }
2074
- get nextSlideCondition() {
2075
- return this._nextSlideCondition;
2076
- }
2077
- get triggerConditions() {
2078
- return this._triggerConditions;
2079
- }
2080
- editVisibility() {
2081
- this._editVisibilityEvt.emit();
2082
- }
2083
- editConditionalBranch(idx) {
2084
- if (idx < 0 || idx >= this._conditionalBranches.length) {
2085
- return;
2086
- }
2087
- this._editConditionalBranchEvt.emit(idx);
2088
- }
2089
- editFormulaReps() {
2090
- this._editFormulaRepsEvt.emit();
2091
- }
2092
- editChoicesFilter() {
2093
- this._editChoicesFilterEvt.emit();
2094
- }
2095
- editFormula() {
2096
- this._editFormulaEvt.emit();
2097
- }
2098
- editForceValue() {
2099
- this._editForceValueEvt.emit();
2100
- }
2101
- editValidationCondition(idx) {
2102
- if (idx < 0 || idx >= this._validationConditions.length) {
2103
- return;
2104
- }
2105
- this._editValidationConditionEvt.emit(idx);
2106
- }
2107
- addValidationCondition() {
2108
- this._addValidationConditionEvt.emit();
2109
- }
2110
- removeValidationCondition(idx) {
2111
- if (idx < 0 || idx >= this._validationConditions.length) {
2112
- return;
2113
- }
2114
- this._removeValidationConditionEvt.emit(idx);
2115
- }
2116
- editWarningCondition(idx) {
2117
- if (idx < 0 || idx >= this._warningConditions.length) {
2118
- return;
2119
- }
2120
- this._editWarningConditionEvt.emit(idx);
2121
- }
2122
- addWarningCondition() {
2123
- this._addWarningConditionEvt.emit();
2124
- }
2125
- removeWarningCondition(idx) {
2126
- if (idx < 0 || idx >= this._warningConditions.length) {
2127
- return;
2128
- }
2129
- this._removeWarningConditionEvt.emit(idx);
2130
- }
2131
- editNextSlideCondition() {
2132
- this._editNextSlideConditionEvt.emit();
2133
- }
2134
- editTriggerCondition(idx) {
2135
- if (idx < 0 || idx >= this._triggerConditions.length) {
2136
- return;
2137
- }
2138
- this._editTriggerConditionEvt.emit(idx);
2139
- }
2140
- addTriggerCondition() {
2141
- this._addTriggerConditionEvt.emit();
2142
- }
2143
- removeTriggerCondition(idx) {
2144
- if (idx < 0 || idx >= this._triggerConditions.length) {
2145
- return;
2146
- }
2147
- this._removeTriggerConditionEvt.emit(idx);
2148
- }
2149
- isField(nodeEntry) {
2150
- return nodeEntry != null && isField(nodeEntry.node);
2151
- }
2152
- isNumericField(node) {
2153
- return isField(node) && isNumberField(node);
2154
- }
2155
- isFieldWithChoices(node) {
2156
- return isField(node) && isFieldWithChoices(node);
2157
- }
2158
- save() {
2159
- this._saveEvt.emit();
2160
- }
2161
- cancel() {
2162
- this._service.cancelNodeEntryEdit();
2163
- }
2164
- ngOnDestroy() {
2165
- this._choicesOriginsSub.unsubscribe();
2166
- this._visibilityOptSub.unsubscribe();
2167
- this._visibilitySub.unsubscribe();
2168
- this._formulaRepsSub.unsubscribe();
2169
- this._choicesFilterSub.unsubscribe();
2170
- this._formulaSub.unsubscribe();
2171
- this._forceValueSub.unsubscribe();
2172
- this._validationConditionsSub.unsubscribe();
2173
- this._warningConditionsSub.unsubscribe();
2174
- this._triggerConditionsSub.unsubscribe();
2175
- this._editConditionDialogSub.unsubscribe();
2176
- this._editValidationConditionDialogSub.unsubscribe();
2177
- this._editWarningConditionDialogSub.unsubscribe();
2178
- this._editChoicesFilterSub.unsubscribe();
2179
- this._editConditionalBranchSub.unsubscribe();
2180
- this._editVisibilitySub.unsubscribe();
2181
- this._editFormulaRepsSub.unsubscribe();
2182
- this._editFormulaSub.unsubscribe();
2183
- this._editForceValueSub.unsubscribe();
2184
- this._editValidationConditionSub.unsubscribe();
2185
- this._editWarningConditionSub.unsubscribe();
2186
- this._nextSlideConditionSub.unsubscribe();
2187
- this._addTriggerConditionSub.unsubscribe();
2188
- this._addValidationConditionSub.unsubscribe();
2189
- this._addWarningConditionSub.unsubscribe();
2190
- this._editNextSlideConditionSub.unsubscribe();
2191
- this._editTriggerConditionSub.unsubscribe();
2192
- this._removeTriggerConditionSub.unsubscribe();
2193
- this._removeValidationConditionSub.unsubscribe();
2194
- this._removeWarningConditionSub.unsubscribe();
2195
- this._saveSub.unsubscribe();
2196
- }
2197
- _initSave() {
2198
- this._saveSub = this._saveEvt
2199
- .pipe(withLatestFrom(this.propertiesForm))
2200
- .subscribe(([_, formGroup]) => {
2201
- const fg = formGroup;
2202
- const val = Object.assign(Object.assign({}, fg.value), { conditionalBranches: this._conditionalBranches });
2203
- this._service.saveNodeEntry(val);
2204
- });
2205
- }
2206
- _initForm() {
2207
- this._propertiesForm = this._nodeEntry.pipe(filter((n) => n != null), map((n) => {
2208
- if (this._visibilityOptSub != null) {
2209
- this._visibilityOptSub.unsubscribe();
2210
- }
2211
- if (this._visibilitySub != null) {
2212
- this._visibilitySub.unsubscribe();
2213
- }
2214
- if (this._conditionalBranchesSub != null) {
2215
- this._conditionalBranchesSub.unsubscribe();
2216
- }
2217
- n = n;
2218
- const visibility = n.node.visibility != null ? n.node.visibility.condition : null;
2219
- const visibilityOpt = n.node.visibility != null ? this._guessVisibilityOpt(n.node.visibility) : null;
2220
- let controls = {
2221
- name: [n.node.name, Validators.required],
2222
- label: n.node.label,
2223
- visibilityOpt: [visibilityOpt, Validators.required],
2224
- visibility: [visibility, Validators.required],
2225
- conditionalBranchesNum: n.node.conditionalBranches.length
2226
- };
2227
- const validators = [];
2228
- if (isRepeatingContainerNode(n.node)) {
2229
- const rn = n.node;
2230
- const formulaReps = rn.formulaReps != null ? rn.formulaReps.formula : null;
2231
- controls.formulaReps = [formulaReps, Validators.required];
2232
- controls.minReps = rn.minReps;
2233
- controls.maxReps = rn.maxReps;
2234
- this._curFormulaReps = formulaReps;
2235
- validators.push(checkRepsValidity);
2236
- }
2237
- if (this.isField(n)) {
2238
- const field = n.node;
2239
- let forceValue = null;
2240
- let notEmpty = false;
2241
- let validationConditions = [];
2242
- if (field.validation != null) {
2243
- if (field.validation.forceValue != null) {
2244
- forceValue = field.validation.forceValue.condition;
2245
- }
2246
- notEmpty = field.validation.notEmpty != null;
2247
- validationConditions = (field.validation.conditions || []).map(c => {
2248
- return { condition: c.condition, errorMessage: c.errorMessage };
2249
- });
2250
- }
2251
- let notEmptyW = false;
2252
- let warningConditions = [];
2253
- if (field.warning != null) {
2254
- notEmptyW = field.warning.notEmpty != null;
2255
- warningConditions = (field.warning.conditions || []).map(w => {
2256
- return { condition: w.condition, warningMessage: w.warningMessage };
2257
- });
2258
- }
2259
- const formula = field.formula != null ? field.formula.formula : null;
2260
- controls.description = field.description;
2261
- controls.defaultValue = field.defaultValue;
2262
- controls.hint = field.hint;
2263
- controls.size = field.size;
2264
- controls.formula = formula;
2265
- controls.forceValue = forceValue;
2266
- controls.notEmpty = notEmpty;
2267
- controls.validationConditions = [validationConditions, []];
2268
- controls.notEmptyWarning = notEmptyW;
2269
- controls.warningConditions = [warningConditions, []];
2270
- controls.nextSlideCondition = [field.nextSlideCondition];
2271
- this._curForceValue = forceValue;
2272
- this._curFormula = formula;
2273
- this._validationConditions = validationConditions;
2274
- this._warningConditions = warningConditions;
2275
- }
2276
- if (this.isNumericField(n.node)) {
2277
- const numField = n.node;
2278
- let minValue;
2279
- let maxValue;
2280
- let minDigits;
2281
- let maxDigits;
2282
- if (numField.validation != null) {
2283
- if (numField.validation.minValue != null) {
2284
- minValue = (numField.validation.minValue.condition || '').replace('$value >= ', '');
2285
- }
2286
- if (numField.validation.maxValue != null) {
2287
- maxValue = (numField.validation.maxValue.condition || '').replace('$value <= ', '');
2288
- }
2289
- if (numField.validation.minDigits != null) {
2290
- minDigits = (numField.validation.minDigits.condition ||
2291
- '').replace('$value.toString().length >= ', '');
2292
- }
2293
- if (numField.validation.maxDigits != null) {
2294
- maxDigits = (numField.validation.maxDigits.condition ||
2295
- '').replace('$value.toString().length <= ', '');
2296
- }
2297
- }
2298
- controls.minValue = minValue;
2299
- controls.maxValue = maxValue;
2300
- controls.minDigits = minDigits;
2301
- controls.maxDigits = maxDigits;
2302
- validators.push(checkValueLimitsValidity);
2303
- validators.push(checkDigitsValidity);
2304
- }
2305
- if (this.isFieldWithChoices(n.node)) {
2306
- const fieldWithChoices = n.node;
2307
- let triggerConditions = (fieldWithChoices.triggerConditions || []).map((c) => c.condition);
2308
- controls.choicesOriginRef = fieldWithChoices.choicesOriginRef;
2309
- controls.choicesFilter = fieldWithChoices.choicesFilter != null ?
2310
- fieldWithChoices.choicesFilter.formula :
2311
- null;
2312
- controls.forceExpanded = fieldWithChoices.forceExpanded;
2313
- controls.forceNarrow = fieldWithChoices.forceNarrow;
2314
- controls.triggerConditions = triggerConditions;
2315
- this._triggerConditions = triggerConditions;
2316
- }
2317
- const fg = this._fb.group(controls);
2318
- fg.setValidators(validators);
2319
- this._conditionalBranches = n.node.conditionalBranches.map(c => c.condition);
2320
- this._curVisibility = n.node.visibility != null ? n.node.visibility.condition : null;
2321
- this._handleConditionalBranchesChange(fg);
2322
- this._handleVisibilityChange(fg);
2323
- this._handleFormulaRepsChange(fg);
2324
- this._handleChoicesFilterChange(fg);
2325
- this._handleFormulaChange(fg);
2326
- this._handleForceValueChange(fg);
2327
- this._handleValidationCondtionsChange(fg);
2328
- this._handleWarningCondtionsChange(fg);
2329
- this._handleNextSlideConditionChange(fg);
2330
- this._handleTriggerCondtionsChange(fg);
2331
- return fg;
2332
- }), publishReplay(1), refCount());
2333
- }
2334
- _destroyConditionDialog() {
2335
- if (this._editConditionDialogSub != null) {
2336
- this._editConditionDialogSub.unsubscribe();
2337
- this._editConditionDialogSub = Subscription.EMPTY;
2338
- }
2339
- if (this._editConditionDialog != null) {
2340
- this._editConditionDialog.close();
2341
- this._editConditionDialog = null;
2342
- }
2343
- }
2344
- _destroyValidationConditionDialog() {
2345
- if (this._editValidationConditionDialogSub != null) {
2346
- this._editValidationConditionDialogSub.unsubscribe();
2347
- this._editValidationConditionDialogSub = Subscription.EMPTY;
2348
- }
2349
- if (this._editValidationConditionDialog != null) {
2350
- this._editValidationConditionDialog.close();
2351
- this._editValidationConditionDialog = null;
2352
- }
2353
- }
2354
- _destroyWarningConditionDialog() {
2355
- if (this._editWarningConditionDialogSub != null) {
2356
- this._editWarningConditionDialogSub.unsubscribe();
2357
- this._editWarningConditionDialogSub = Subscription.EMPTY;
2358
- }
2359
- if (this._editWarningConditionDialog != null) {
2360
- this._editWarningConditionDialog.close();
2361
- this._editWarningConditionDialog = null;
2362
- }
2363
- }
2364
- _initRemoveTriggerCondition() {
2365
- this._removeTriggerConditionSub = this._removeTriggerConditionEvt
2366
- .pipe(withLatestFrom(this._propertiesForm))
2367
- .subscribe(([vcIdx, formGroup]) => {
2368
- if (formGroup == null) {
2369
- return;
2370
- }
2371
- const fg = formGroup;
2372
- const ctrl = fg.controls['triggerConditions'];
2373
- let vcs = (ctrl.value || []).slice(0);
2374
- if (vcIdx < 0 || vcIdx >= vcs.length) {
2375
- return;
2376
- }
2377
- vcs.splice(vcIdx, 1);
2378
- ctrl.setValue(vcs);
2379
- });
2380
- }
2381
- _initAddTriggerCondition() {
2382
- this._addTriggerConditionSub = this._addTriggerConditionEvt
2383
- .pipe(withLatestFrom(this._propertiesForm))
2384
- .subscribe(([_, formGroup]) => {
2385
- if (formGroup == null) {
2386
- return;
2387
- }
2388
- const fg = formGroup;
2389
- const ctrl = fg.controls['triggerConditions'];
2390
- let vcs = (ctrl.value || []).slice(0);
2391
- vcs.push('');
2392
- ctrl.setValue(vcs);
2393
- });
2394
- }
2395
- _initTriggerConditionEdit() {
2396
- this._editConditionDialogSub = Subscription.EMPTY;
2397
- this._cdr.markForCheck();
2398
- this._editTriggerConditionSub =
2399
- this._editTriggerConditionEvt
2400
- .pipe(withLatestFrom(this._propertiesForm))
2401
- .subscribe(([vcIdx, fg]) => {
2402
- this._destroyConditionDialog();
2403
- if (vcIdx < 0 || vcIdx >= this._triggerConditions.length || fg == null) {
2404
- return;
2405
- }
2406
- this._editConditionDialog = this._dialog.open(AjfFbConditionEditorDialog);
2407
- const cmp = this._editConditionDialog.componentInstance;
2408
- cmp.condition = this._triggerConditions[vcIdx];
2409
- this._editConditionDialogSub =
2410
- this._editConditionDialog.afterClosed().subscribe((cond) => {
2411
- if (cond !== void 0) {
2412
- this._triggerConditions[vcIdx] = cond;
2413
- }
2414
- this._editConditionDialogSub.unsubscribe();
2415
- this._editConditionDialogSub = Subscription.EMPTY;
2416
- this._cdr.markForCheck();
2417
- });
2418
- });
2419
- }
2420
- _initRemoveWarningCondition() {
2421
- this._removeWarningConditionSub = this._removeWarningConditionEvt
2422
- .pipe(withLatestFrom(this._propertiesForm))
2423
- .subscribe(([vcIdx, formGroup]) => {
2424
- if (formGroup == null) {
2425
- return;
2426
- }
2427
- const fg = formGroup;
2428
- const ctrl = fg.controls['warningConditions'];
2429
- let vcs = (ctrl.value || []).slice(0);
2430
- if (vcIdx < 0 || vcIdx >= vcs.length) {
2431
- return;
2432
- }
2433
- vcs.splice(vcIdx, 1);
2434
- ctrl.setValue(vcs);
2435
- });
2436
- }
2437
- _initAddWarningCondition() {
2438
- this._addWarningConditionSub = this._addWarningConditionEvt
2439
- .pipe(withLatestFrom(this._propertiesForm))
2440
- .subscribe(([_, formGroup]) => {
2441
- if (formGroup == null) {
2442
- return;
2443
- }
2444
- const fg = formGroup;
2445
- const ctrl = fg.controls['warningConditions'];
2446
- let vcs = (ctrl.value || []).slice(0);
2447
- vcs.push({ condition: '', errorMessage: '' });
2448
- ctrl.setValue(vcs);
2449
- });
2450
- }
2451
- _initWarningConditionEdit() {
2452
- this._editWarningConditionSub =
2453
- this._editWarningConditionEvt
2454
- .pipe(withLatestFrom(this._propertiesForm))
2455
- .subscribe(([vcIdx, fg]) => {
2456
- this._destroyWarningConditionDialog();
2457
- if (vcIdx < 0 || vcIdx >= this._warningConditions.length || fg == null) {
2458
- return;
2459
- }
2460
- this._editWarningConditionDialog =
2461
- this._dialog.open(AjfFbWarningConditionEditorDialog);
2462
- const cmp = this._editWarningConditionDialog.componentInstance;
2463
- const w = this._warningConditions[vcIdx];
2464
- cmp.condition = w.condition;
2465
- cmp.warningMessage = w.warningMessage;
2466
- this._editWarningConditionDialogSub =
2467
- this._editWarningConditionDialog.afterClosed().subscribe((cond) => {
2468
- if (cond !== void 0) {
2469
- this._warningConditions[vcIdx] = cond;
2470
- }
2471
- this._editWarningConditionDialogSub.unsubscribe();
2472
- this._editWarningConditionDialogSub = Subscription.EMPTY;
2473
- this._cdr.markForCheck();
2474
- });
2475
- });
2476
- }
2477
- _initRemoveValidationCondition() {
2478
- this._removeValidationConditionSub = this._removeValidationConditionEvt
2479
- .pipe(withLatestFrom(this._propertiesForm))
2480
- .subscribe(([vcIdx, formGroup]) => {
2481
- if (formGroup == null) {
2482
- return;
2483
- }
2484
- const fg = formGroup;
2485
- const ctrl = fg.controls['validationConditions'];
2486
- let vcs = (ctrl.value || []).slice(0);
2487
- if (vcIdx < 0 || vcIdx >= vcs.length) {
2488
- return;
2489
- }
2490
- vcs.splice(vcIdx, 1);
2491
- ctrl.setValue(vcs);
2492
- });
2493
- }
2494
- _initAddValidationCondition() {
2495
- this._addValidationConditionSub = this._addValidationConditionEvt
2496
- .pipe(withLatestFrom(this._propertiesForm))
2497
- .subscribe(([_, formGroup]) => {
2498
- if (formGroup == null) {
2499
- return;
2500
- }
2501
- const fg = formGroup;
2502
- const ctrl = fg.controls['validationConditions'];
2503
- let vcs = (ctrl.value || []).slice(0);
2504
- vcs.push({ condition: '', errorMessage: '' });
2505
- ctrl.setValue(vcs);
2506
- });
2507
- }
2508
- _initValidationConditionEdit() {
2509
- this._editValidationConditionSub =
2510
- this._editValidationConditionEvt
2511
- .pipe(withLatestFrom(this._propertiesForm))
2512
- .subscribe(([vcIdx, fg]) => {
2513
- this._destroyValidationConditionDialog();
2514
- if (vcIdx < 0 || vcIdx >= this._validationConditions.length || fg == null) {
2515
- return;
2516
- }
2517
- this._editValidationConditionDialog =
2518
- this._dialog.open(AjfFbValidationConditionEditorDialog);
2519
- const cmp = this._editValidationConditionDialog.componentInstance;
2520
- const v = this._validationConditions[vcIdx];
2521
- cmp.condition = v.condition;
2522
- cmp.errorMessage = v.errorMessage;
2523
- this._editValidationConditionDialogSub =
2524
- this._editValidationConditionDialog.afterClosed().subscribe((cond) => {
2525
- if (cond !== void 0) {
2526
- this._validationConditions[vcIdx] = cond;
2527
- }
2528
- this._editValidationConditionDialogSub.unsubscribe();
2529
- this._editValidationConditionDialogSub = Subscription.EMPTY;
2530
- this._cdr.markForCheck();
2531
- });
2532
- });
2533
- }
2534
- _initForceValueEdit() {
2535
- this._editForceValueSub =
2536
- this._editForceValueEvt
2537
- .pipe(withLatestFrom(this._propertiesForm))
2538
- .subscribe(([_, formGroup]) => {
2539
- this._destroyConditionDialog();
2540
- if (formGroup == null) {
2541
- return;
2542
- }
2543
- const fg = formGroup;
2544
- const ctrl = fg.controls['forceValue'];
2545
- this._editConditionDialog = this._dialog.open(AjfFbConditionEditorDialog);
2546
- this._editConditionDialog.componentInstance.condition = ctrl.value;
2547
- this._editConditionDialogSub =
2548
- this._editConditionDialog.afterClosed().subscribe((cond) => {
2549
- if (cond !== void 0) {
2550
- ctrl.setValue(cond);
2551
- }
2552
- this._editConditionDialogSub.unsubscribe();
2553
- this._editConditionDialogSub = Subscription.EMPTY;
2554
- this._cdr.markForCheck();
2555
- });
2556
- });
2557
- }
2558
- _initNextSlideConditionEdit() {
2559
- this._editNextSlideConditionSub =
2560
- this._editNextSlideConditionEvt
2561
- .pipe(withLatestFrom(this._propertiesForm))
2562
- .subscribe(([_, formGroup]) => {
2563
- this._destroyConditionDialog();
2564
- if (formGroup == null) {
2565
- return;
2566
- }
2567
- const fg = formGroup;
2568
- const ctrl = fg.controls['nextSlideCondition'];
2569
- this._editConditionDialog = this._dialog.open(AjfFbConditionEditorDialog);
2570
- this._editConditionDialog.componentInstance.condition = ctrl.value;
2571
- this._editConditionDialogSub =
2572
- this._editConditionDialog.afterClosed().subscribe((cond) => {
2573
- if (cond !== void 0) {
2574
- ctrl.setValue(cond);
2575
- }
2576
- this._editConditionDialogSub.unsubscribe();
2577
- this._editConditionDialogSub = Subscription.EMPTY;
2578
- this._cdr.markForCheck();
2579
- });
2580
- });
2581
- }
2582
- _initFormulaEdit() {
2583
- this._editConditionDialogSub = Subscription.EMPTY;
2584
- this._cdr.markForCheck();
2585
- this._editFormulaSub =
2586
- this._editFormulaEvt
2587
- .pipe(withLatestFrom(this._propertiesForm))
2588
- .subscribe(([_, formGroup]) => {
2589
- this._destroyConditionDialog();
2590
- if (formGroup == null) {
2591
- return;
2592
- }
2593
- const fg = formGroup;
2594
- const ctrl = fg.controls['formula'];
2595
- this._editConditionDialog = this._dialog.open(AjfFbConditionEditorDialog);
2596
- this._editConditionDialog.componentInstance.condition = ctrl.value;
2597
- this._editConditionDialogSub =
2598
- this._editConditionDialog.afterClosed().subscribe((cond) => {
2599
- if (cond !== void 0) {
2600
- ctrl.setValue(cond);
2601
- }
2602
- this._editConditionDialogSub.unsubscribe();
2603
- this._editConditionDialogSub = Subscription.EMPTY;
2604
- this._cdr.markForCheck();
2605
- });
2606
- });
2607
- }
2608
- _initFormulaRepsEdit() {
2609
- this._editFormulaRepsSub =
2610
- this._editFormulaRepsEvt
2611
- .pipe(withLatestFrom(this._propertiesForm))
2612
- .subscribe(([_, formGroup]) => {
2613
- this._destroyConditionDialog();
2614
- if (formGroup == null) {
2615
- return;
2616
- }
2617
- const fg = formGroup;
2618
- const ctrl = fg.controls['formulaReps'];
2619
- this._editConditionDialog = this._dialog.open(AjfFbConditionEditorDialog);
2620
- this._editConditionDialog.componentInstance.condition = ctrl.value;
2621
- this._editConditionDialogSub =
2622
- this._editConditionDialog.afterClosed().subscribe((cond) => {
2623
- if (cond !== void 0) {
2624
- ctrl.setValue(cond);
2625
- }
2626
- this._editConditionDialogSub.unsubscribe();
2627
- this._editConditionDialogSub = Subscription.EMPTY;
2628
- this._cdr.markForCheck();
2629
- });
2630
- });
2631
- }
2632
- _initChoicesFilterEdit() {
2633
- this._editChoicesFilterSub =
2634
- this._editChoicesFilterEvt
2635
- .pipe(withLatestFrom(this._propertiesForm))
2636
- .subscribe(([_, formGroup]) => {
2637
- this._destroyConditionDialog();
2638
- if (formGroup == null) {
2639
- return;
2640
- }
2641
- const fg = formGroup;
2642
- const ctrl = fg.controls['choicesFilter'];
2643
- this._editConditionDialog = this._dialog.open(AjfFbConditionEditorDialog);
2644
- this._editConditionDialog.componentInstance.condition = ctrl.value;
2645
- this._editConditionDialogSub =
2646
- this._editConditionDialog.afterClosed().subscribe((cond) => {
2647
- if (cond !== void 0) {
2648
- ctrl.setValue(cond);
2649
- }
2650
- this._editConditionDialogSub.unsubscribe();
2651
- this._editConditionDialogSub = Subscription.EMPTY;
2652
- this._cdr.markForCheck();
2653
- });
2654
- });
2655
- }
2656
- _initConditionalBranchEdit() {
2657
- this._editConditionalBranchSub =
2658
- this._editConditionalBranchEvt
2659
- .pipe(withLatestFrom(this._propertiesForm))
2660
- .subscribe(([cbIdx, fg]) => {
2661
- this._destroyConditionDialog();
2662
- if (cbIdx < 0 || cbIdx >= this._conditionalBranches.length || fg == null) {
2663
- return;
2664
- }
2665
- this._editConditionDialog = this._dialog.open(AjfFbConditionEditorDialog);
2666
- this._editConditionDialog.componentInstance.condition =
2667
- this._conditionalBranches[cbIdx];
2668
- this._editConditionDialogSub =
2669
- this._editConditionDialog.afterClosed().subscribe((cond) => {
2670
- if (cond !== void 0) {
2671
- this._conditionalBranches[cbIdx] = cond;
2672
- }
2673
- this._editConditionDialogSub.unsubscribe();
2674
- this._editConditionDialogSub = Subscription.EMPTY;
2675
- this._cdr.markForCheck();
2676
- });
2677
- });
2678
- }
2679
- _initVisibilityEdit() {
2680
- this._editVisibilitySub =
2681
- this._editVisibilityEvt
2682
- .pipe(withLatestFrom(this._propertiesForm))
2683
- .subscribe(([_, formGroup]) => {
2684
- this._destroyConditionDialog();
2685
- if (formGroup == null) {
2686
- return;
2687
- }
2688
- const fg = formGroup;
2689
- const ctrl = fg.controls['visibility'];
2690
- const condition = ctrl.value;
2691
- this._editConditionDialog = this._dialog.open(AjfFbConditionEditorDialog);
2692
- this._editConditionDialog.componentInstance.condition = condition;
2693
- this._editConditionDialogSub =
2694
- this._editConditionDialog.afterClosed().subscribe((cond) => {
2695
- if (cond !== void 0) {
2696
- ctrl.setValue(cond);
2697
- }
2698
- this._editConditionDialogSub.unsubscribe();
2699
- this._editConditionDialogSub = Subscription.EMPTY;
2700
- this._cdr.markForCheck();
2701
- });
2702
- });
2703
- }
2704
- _handleTriggerCondtionsChange(fg) {
2705
- this._triggerConditionsSub = fg.valueChanges
2706
- .pipe(distinctUntilChanged((v1, v2) => JSON.stringify(v1.triggerConditions) ===
2707
- JSON.stringify(v2.triggerConditions)))
2708
- .subscribe((v) => {
2709
- this._triggerConditions = v.triggerConditions;
2710
- this._cdr.markForCheck();
2711
- });
2712
- }
2713
- _handleWarningCondtionsChange(fg) {
2714
- this._warningConditionsSub = fg.valueChanges
2715
- .pipe(distinctUntilChanged((v1, v2) => JSON.stringify(v1.warningConditions) ===
2716
- JSON.stringify(v2.warningConditions)))
2717
- .subscribe((v) => {
2718
- this._warningConditions = v.warningConditions;
2719
- this._cdr.markForCheck();
2720
- });
2721
- }
2722
- _handleValidationCondtionsChange(fg) {
2723
- this._validationConditionsSub =
2724
- fg.valueChanges
2725
- .pipe(distinctUntilChanged((v1, v2) => JSON.stringify(v1.validationConditions) ===
2726
- JSON.stringify(v2.validationConditions)))
2727
- .subscribe((v) => {
2728
- this._validationConditions = v.validationConditions;
2729
- this._cdr.markForCheck();
2730
- });
2731
- }
2732
- _handleForceValueChange(fg) {
2733
- this._forceValueSub =
2734
- fg.valueChanges.pipe(distinctUntilChanged((v1, v2) => v1.forceValue === v2.forceValue))
2735
- .subscribe((v) => {
2736
- this._curForceValue = v.forceValue;
2737
- this._cdr.markForCheck();
2738
- });
2739
- }
2740
- _handleNextSlideConditionChange(fg) {
2741
- this._formulaSub =
2742
- fg.valueChanges
2743
- .pipe(distinctUntilChanged((v1, v2) => v1.nextSlideCondition === v2.nextSlideCondition))
2744
- .subscribe((v) => {
2745
- this._nextSlideCondition = v.nextSlideCondition;
2746
- this._cdr.markForCheck();
2747
- });
2748
- this._formulaSub =
2749
- fg.valueChanges
2750
- .pipe(distinctUntilChanged((v1, v2) => v1.nextSlideCondition === v2.nextSlideCondition))
2751
- .subscribe((v) => {
2752
- this._nextSlideCondition = v.nextSlideCondition;
2753
- this._cdr.markForCheck();
2754
- });
2755
- }
2756
- _handleFormulaChange(fg) {
2757
- this._formulaSub =
2758
- fg.valueChanges.pipe(distinctUntilChanged((v1, v2) => v1.formula === v2.formula))
2759
- .subscribe((v) => {
2760
- this._curFormula = v.formula;
2761
- this._cdr.markForCheck();
2762
- });
2763
- }
2764
- _handleFormulaRepsChange(fg) {
2765
- this._formulaRepsSub =
2766
- fg.valueChanges.pipe(distinctUntilChanged((v1, v2) => v1.formulaReps === v2.formulaReps))
2767
- .subscribe((v) => {
2768
- this._curFormulaReps = v.formulaReps;
2769
- this._cdr.markForCheck();
2770
- });
2771
- }
2772
- _handleChoicesFilterChange(fg) {
2773
- this._choicesFilterSub =
2774
- fg.valueChanges
2775
- .pipe(distinctUntilChanged((v1, v2) => v1.choicesFilter === v2.choicesFilter))
2776
- .subscribe((v) => {
2777
- this._curChoicesFilter = v.choicesFilter;
2778
- this._cdr.markForCheck();
2779
- });
2780
- }
2781
- _handleConditionalBranchesChange(fg) {
2782
- this._conditionalBranchesSub =
2783
- fg.valueChanges
2784
- .pipe(distinctUntilChanged((v1, v2) => v1.conditionalBranchesNum === v2.conditionalBranchesNum))
2785
- .subscribe((v) => {
2786
- const cbNum = v.conditionalBranchesNum;
2787
- const curCbNum = this._conditionalBranches.length;
2788
- if (curCbNum < cbNum) {
2789
- let newCbs = [];
2790
- for (let i = curCbNum; i < cbNum; i++) {
2791
- newCbs.push(alwaysCondition().condition);
2792
- }
2793
- this._conditionalBranches = this._conditionalBranches.concat(newCbs);
2794
- }
2795
- else if (curCbNum > cbNum) {
2796
- this._conditionalBranches.splice(0, curCbNum - cbNum);
2797
- }
2798
- this._cdr.markForCheck();
2799
- });
2800
- }
2801
- _handleVisibilityChange(fg) {
2802
- this._visibilitySub =
2803
- fg.valueChanges
2804
- .pipe(distinctUntilChanged((v1, v2) => v1.visibilityOpt === v2.visibilityOpt))
2805
- .subscribe((v) => {
2806
- const visibilityOpt = v.visibilityOpt;
2807
- let newCondition;
2808
- switch (visibilityOpt) {
2809
- case 'always':
2810
- newCondition = alwaysCondition().condition;
2811
- break;
2812
- case 'never':
2813
- newCondition = neverCondition().condition;
2814
- break;
2815
- default:
2816
- newCondition = null;
2817
- }
2818
- this._curVisibility = newCondition;
2819
- fg.controls['visibility'].setValue(newCondition);
2820
- });
2821
- this._visibilitySub = fg.valueChanges
2822
- .pipe(filter(v => v.visibilityOpt === 'condition'), distinctUntilChanged((v1, v2) => v1.visibility === v2.visibility))
2823
- .subscribe(v => {
2824
- this._curVisibility = v.visibility;
2825
- this._cdr.markForCheck();
2826
- });
2827
- }
2828
- _guessVisibilityOpt(condition) {
2829
- if (condition.condition.localeCompare(alwaysCondition().condition) === 0) {
2830
- return 'always';
2831
- }
2832
- if (condition.condition.localeCompare(neverCondition().condition) === 0) {
2833
- return 'never';
2834
- }
2835
- return 'condition';
2836
- }
2837
- }
2838
- AjfFbNodeProperties.decorators = [
2839
- { type: Component, args: [{
2840
- selector: 'ajf-fb-node-properties',
2841
- template: "<div\n [style.display]=\"(enabled|async) ? 'none' : 'block'\"\n class=\"ajf-disabled-overlay\"\n></div>\n<div class=\"ajf-header\">\n <h3>{{'Properties'|transloco}}</h3>\n <mat-icon (click)=\"save()\">save</mat-icon>\n <mat-icon (click)=\"cancel()\">cancel</mat-icon>\n</div>\n<ng-container *ngIf=\"nodeEntry|async as ne\">\n <ng-container *ngIf=\"propertiesForm|async as pf\">\n <form [formGroup]=\"pf!\" novalidate>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input\n matInput\n formControlName=\"name\"\n [placeholder]=\"'Name' | transloco\"\n />\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input\n matInput\n formControlName=\"label\"\n [placeholder]=\"'Label' | transloco\"\n />\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <mat-label>{{'Visibility'|transloco}}</mat-label>\n <mat-select\n formControlName=\"visibilityOpt\"\n [placeholder]=\"'Visible' | transloco\"\n >\n <mat-option value=\"always\">{{'Always'|transloco}}</mat-option>\n <mat-option value=\"never\">{{'Never'|transloco}}</mat-option>\n <mat-option value=\"condition\"\n >{{'Condition...'|transloco}}</mat-option\n >\n </mat-select>\n </mat-form-field>\n <button\n (click)=\"editVisibility()\"\n [disabled]=\"pf!.value.visibilityOpt != 'condition'\"\n mat-raised-button\n [matTooltip]=\"curVisibility || ''\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span>{{ curVisibility }}</span>\n </div>\n </button>\n </div>\n <div class=\"ajf-prop\">\n <div><label>{{'Branches'|transloco}}</label></div>\n <div>\n <mat-slider\n formControlName=\"conditionalBranchesNum\"\n thumbLabel\n tickInterval=\"auto\"\n min=\"1\"\n max=\"5\"\n step=\"1\"\n ></mat-slider>\n </div>\n <div *ngFor=\"let branch of conditionalBranches; let idx = index\">\n <button\n (click)=\"editConditionalBranch(idx)\"\n mat-raised-button\n [matTooltip]=\"branch\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span>{{ branch }}</span>\n </div>\n </button>\n </div>\n </div>\n <ng-template [ngIf]=\"isRepeatingContainerNode(ne)\">\n <div class=\"ajf-prop\">\n <div><label>{{'Repetitions'|transloco}}</label></div>\n <div>\n <button\n (click)=\"editFormulaReps()\"\n mat-raised-button\n [matTooltip]=\"curFormulaReps || ''\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span>{{ curFormulaReps }}</span>\n </div>\n </button>\n </div>\n <div><label>{{'Min repetitions'|transloco}}</label></div>\n <div>\n <mat-slider\n formControlName=\"minReps\"\n thumbLabel\n tickInterval=\"auto\"\n min=\"1\"\n max=\"5\"\n step=\"1\"\n ></mat-slider>\n </div>\n <div><label>{{'Max repetitions'|transloco}}</label></div>\n <div>\n <mat-slider\n formControlName=\"maxReps\"\n thumbLabel\n tickInterval=\"auto\"\n min=\"1\"\n max=\"5\"\n step=\"1\"\n ></mat-slider>\n </div>\n </div>\n </ng-template>\n <ng-template [ngIf]=\"isField(ne)\">\n <div class=\"ajf-prop\">\n <mat-form-field>\n <mat-label>{{'Field size'|transloco}}</mat-label>\n <mat-select\n formControlName=\"size\"\n [placeholder]=\"'Size' | transloco\"\n >\n <mat-option\n *ngFor=\"let fieldSize of fieldSizes\"\n [value]=\"fieldSize.value\"\n >\n {{ fieldSize.label|transloco }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input\n matInput\n formControlName=\"hint\"\n [placeholder]=\"'Hint' | transloco\"\n />\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <textarea\n matInput\n formControlName=\"description\"\n [placeholder]=\"'Description' | transloco\"\n ></textarea>\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input\n matInput\n formControlName=\"defaultValue\"\n [placeholder]=\"'Default value' | transloco\"\n />\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <div><label>{{'Formula'|transloco}}</label></div>\n <div>\n <button\n (click)=\"editFormula()\"\n mat-raised-button\n [matTooltip]=\"curFormula || ''\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span>{{ curFormula }}</span>\n </div>\n </button>\n </div>\n </div>\n <!-- <div class=\"ajf-prop\">\n <div><label>{{'Force value'|translco}}</label></div>\n <div>\n <button (click)=\"editForceValue()\" mat-raised-button [matTooltip]=\"curForceValue\">\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span>{{ curForceValue }}</span>\n </div>\n </button>\n </div>\n </div> -->\n <div class=\"ajf-prop\">\n <mat-checkbox formControlName=\"notEmpty\"\n >{{'Not empty'|transloco}}</mat-checkbox\n >\n </div>\n <ng-template [ngIf]=\"isNumericField(ne!.node)\">\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input\n matInput\n formControlName=\"minValue\"\n [placeholder]=\"'Min value' | transloco\"\n />\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input\n matInput\n formControlName=\"maxValue\"\n [placeholder]=\"'Max value' | transloco\"\n />\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input\n matInput\n formControlName=\"minDigits\"\n [placeholder]=\"'Min digits' | transloco\"\n />\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <mat-form-field>\n <input\n matInput\n formControlName=\"maxDigits\"\n [placeholder]=\"'Max digits' | transloco\"\n />\n </mat-form-field>\n </div>\n </ng-template>\n <div class=\"ajf-prop\">\n <div class=\"ajf-header\">\n <label>{{ 'Validation' | transloco }}</label>\n <mat-icon class=\"ajf-pointer\" (click)=\"addValidationCondition()\"\n >add_circle_outline</mat-icon\n >\n </div>\n <div\n *ngIf=\"validationConditions == null || validationConditions.length == 0\"\n class=\"ajf-validation-row ajf-emph\"\n >\n {{'No conditions'|transloco}}\n </div>\n <div\n class=\"ajf-validation-row\"\n *ngFor=\"let validationCondition of validationConditions; let idx = index\"\n >\n <button\n (click)=\"editValidationCondition(idx)\"\n mat-raised-button\n [matTooltip]=\"validationCondition.condition\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span>{{ validationCondition.condition }}</span>\n </div>\n </button>\n <mat-icon\n class=\"ajf-pointer\"\n (click)=\"removeValidationCondition(idx)\"\n >remove_circle_outline</mat-icon\n >\n </div>\n </div>\n <div class=\"ajf-prop\">\n <mat-checkbox formControlName=\"notEmptyWarning\"\n >{{'Not empty warning'|transloco}}</mat-checkbox\n >\n </div>\n <div class=\"ajf-prop\">\n <div class=\"ajf-header\">\n <label>{{'Warnings'|transloco}}</label>\n <mat-icon class=\"ajf-pointer\" (click)=\"addWarningCondition()\"\n >add_circle_outline</mat-icon\n >\n </div>\n <div\n *ngIf=\"warningConditions == null || warningConditions.length == 0\"\n class=\"ajf-validation-row ajf-emph\"\n >\n {{'No warnings'|transloco}}\n </div>\n <div\n class=\"ajf-validation-row\"\n *ngFor=\"let warningCondition of warningConditions; let idx = index\"\n >\n <button\n (click)=\"editWarningCondition(idx)\"\n mat-raised-button\n [matTooltip]=\"warningCondition.condition\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span>{{ warningCondition.condition }}</span>\n </div>\n </button>\n <mat-icon class=\"ajf-pointer\" (click)=\"removeWarningCondition(idx)\"\n >remove_circle_outline</mat-icon\n >\n </div>\n </div>\n <div class=\"ajf-prop\">\n <div><label>{{'Go to next slide condition'|transloco}}</label></div>\n <div>\n <button\n (click)=\"editNextSlideCondition()\"\n mat-raised-button\n [matTooltip]=\"nextSlideCondition\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span>{{ nextSlideCondition }}</span>\n </div>\n </button>\n </div>\n </div>\n <ng-template [ngIf]=\"isFieldWithChoices(ne!.node)\">\n <div class=\"ajf-prop\">\n <mat-form-field>\n <mat-label>{{'Choices origins'|transloco}}</mat-label>\n <mat-select\n formControlName=\"choicesOriginRef\"\n [placeholder]=\"'Choices' | transloco\"\n >\n <mat-option\n *ngFor=\"let choicesOrigin of choicesOrigins\"\n [value]=\"choicesOrigin.name\"\n >\n {{ (choicesOrigin.label || choicesOrigin.name)|transloco }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"ajf-prop\">\n <div><label>{{'Choices filter'|transloco}}</label></div>\n <div>\n <button\n (click)=\"editChoicesFilter()\"\n mat-raised-button\n [matTooltip]=\"curChoicesFilter\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span>{{ curChoicesFilter }}</span>\n </div>\n </button>\n </div>\n </div>\n <div class=\"ajf-prop\">\n <mat-checkbox formControlName=\"forceExpanded\"\n >{{'Force expanded selection'|transloco}}</mat-checkbox\n >\n </div>\n <div class=\"ajf-prop\">\n <mat-checkbox formControlName=\"forceNarrow\"\n >{{'Force narrow selection'|transloco}}</mat-checkbox\n >\n </div>\n <div class=\"ajf-prop\">\n <div class=\"ajf-header\">\n <label>{{'Trigger selection'|transloco}}</label>\n <mat-icon class=\"ajf-pointer\" (click)=\"addTriggerCondition()\"\n >add_circle_outline</mat-icon\n >\n </div>\n <div\n *ngIf=\"triggerConditions == null || triggerConditions.length == 0\"\n class=\"ajf-validation-row ajf-emph\"\n >\n {{'No trigger condition'|transloco}}\n </div>\n <div\n class=\"ajf-validation-row\"\n *ngFor=\"let triggerCondition of triggerConditions; let idx = index\"\n >\n <button\n (click)=\"editTriggerCondition(idx)\"\n mat-raised-button\n [matTooltip]=\"triggerCondition\"\n >\n <div class=\"ajf-icon-cont\">\n <mat-icon>edit</mat-icon>\n <span>{{ triggerCondition }}</span>\n </div>\n </button>\n <mat-icon class=\"pointer\" (click)=\"removeTriggerCondition(idx)\"\n >remove_circle_outline</mat-icon\n >\n </div>\n </div>\n </ng-template>\n </ng-template>\n </form>\n </ng-container>\n</ng-container>\n",
2842
- encapsulation: ViewEncapsulation.None,
2843
- changeDetection: ChangeDetectionStrategy.OnPush,
2844
- styles: ["ajf-fb-node-properties{display:block;padding:1em;position:relative}ajf-fb-node-properties mat-icon{cursor:pointer}ajf-fb-node-properties .ajf-header{display:flex;flex-direction:row;align-items:center;flex-wrap:nowrap}ajf-fb-node-properties .ajf-header>h3,ajf-fb-node-properties .ajf-header>label{flex:1 0 auto;margin-right:.5em}ajf-fb-node-properties .ajf-header>mat-icon{flex:0 0 auto;margin-left:.5em}ajf-fb-node-properties .ajf-disabled-overlay{position:absolute;top:0;right:0;bottom:0;left:0;opacity:.4;background-color:#fff}ajf-fb-node-properties .ajf-emph{font-style:italic}ajf-fb-node-properties [mat-raised-button]{margin:.5em 0}ajf-fb-node-properties [mat-raised-button].ajf-pointer{cursor:pointer}ajf-fb-node-properties [mat-raised-button] .ajf-icon-cont{display:flex;flex-direction:row;align-items:center}ajf-fb-node-properties [mat-raised-button] .ajf-icon-cont span{flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;display:block;min-height:36px}ajf-fb-node-properties .ajf-validation-row{margin:.5em 0;display:flex;flex-direction:row;align-items:center}ajf-fb-node-properties .ajf-validation-row button{flex:1 1 auto}ajf-fb-node-properties .ajf-validation-row mat-icon{flex:0 0 auto}ajf-fb-node-properties .ajf-prop{margin:.5em 0}ajf-fb-node-properties mat-form-field,ajf-fb-node-properties mat-slider,ajf-fb-node-properties [mat-raised-button]{width:100%}\n"]
2845
- },] }
2846
- ];
2847
- AjfFbNodeProperties.ctorParameters = () => [
2848
- { type: ChangeDetectorRef },
2849
- { type: AjfFormBuilderService },
2850
- { type: MatDialog },
2851
- { type: FormBuilder }
2852
- ];
2853
-
2854
- /**
2855
- * @license
2856
- * Copyright (C) Gnucoop soc. coop.
2857
- *
2858
- * This file is part of the Advanced JSON forms (ajf).
2859
- *
2860
- * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
2861
- * modify it under the terms of the GNU Affero General Public License as
2862
- * published by the Free Software Foundation, either version 3 of the License,
2863
- * or (at your option) any later version.
2864
- *
2865
- * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
2866
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2867
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
2868
- * General Public License for more details.
2869
- *
2870
- * You should have received a copy of the GNU Affero General Public License
2871
- * along with Advanced JSON forms (ajf).
2872
- * If not, see http://www.gnu.org/licenses/.
2873
- *
2874
- */
2875
- class AjfFbNodeTypeEntry {
2876
- constructor(_cdr) {
2877
- this._cdr = _cdr;
2878
- }
2879
- get nodeType() {
2880
- return this._nodeType;
2881
- }
2882
- set nodeType(nodeType) {
2883
- this._nodeType = nodeType;
2884
- this._cdr.markForCheck();
2885
- }
2886
- }
2887
- AjfFbNodeTypeEntry.decorators = [
2888
- { type: Component, args: [{
2889
- selector: 'ajf-fb-node-type-entry',
2890
- template: "<ng-container *ngIf=\"nodeType\">\n <mat-icon\n [fontSet]=\"nodeType.icon.fontSet\" [fontIcon]=\"nodeType.icon.fontIcon\"></mat-icon>\n {{ nodeType.label }}\n</ng-container>\n",
2891
- encapsulation: ViewEncapsulation.None,
2892
- changeDetection: ChangeDetectionStrategy.OnPush,
2893
- styles: ["ajf-fb-node-type-entry{display:block;padding:1em 1.5em}ajf-fb-node-type-entry mat-icon{vertical-align:middle}\n"]
2894
- },] }
2895
- ];
2896
- AjfFbNodeTypeEntry.ctorParameters = () => [
2897
- { type: ChangeDetectorRef }
2898
- ];
2899
- AjfFbNodeTypeEntry.propDecorators = {
2900
- nodeType: [{ type: Input }]
2901
- };
2902
-
2903
- /**
2904
- * @license
2905
- * Copyright (C) Gnucoop soc. coop.
2906
- *
2907
- * This file is part of the Advanced JSON forms (ajf).
2908
- *
2909
- * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
2910
- * modify it under the terms of the GNU Affero General Public License as
2911
- * published by the Free Software Foundation, either version 3 of the License,
2912
- * or (at your option) any later version.
2913
- *
2914
- * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
2915
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2916
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
2917
- * General Public License for more details.
2918
- *
2919
- * You should have received a copy of the GNU Affero General Public License
2920
- * along with Advanced JSON forms (ajf).
2921
- * If not, see http://www.gnu.org/licenses/.
2922
- *
2923
- */
2924
- class AjfFormBuilderModule {
2925
- }
2926
- AjfFormBuilderModule.decorators = [
2927
- { type: NgModule, args: [{
2928
- imports: [
2929
- AjfMonacoEditorModule, AjfNodeIconModule, CommonModule, DragDropModule,
2930
- FormsModule, MatAutocompleteModule, MatButtonModule, MatCardModule,
2931
- MatCheckboxModule, MatChipsModule, MatDialogModule, MatFormFieldModule,
2932
- MatIconModule, MatInputModule, MatListModule, MatMenuModule,
2933
- MatSelectModule, MatSidenavModule, MatSliderModule, MatTableModule,
2934
- MatToolbarModule, MatTooltipModule, ReactiveFormsModule, AjfTranslocoModule,
2935
- MatExpansionModule, MatSlideToggleModule,
2936
- ],
2937
- declarations: [
2938
- AjfFbBranchLine,
2939
- AjfFbChoicesOriginEditor,
2940
- AjfFbChoicesOriginEditorDialog,
2941
- AjfFbConditionEditor,
2942
- AjfFbConditionEditorDialog,
2943
- AjfFbNodeEntry,
2944
- AjfFbNodeProperties,
2945
- AjfFbNodeTypeEntry,
2946
- AjfFbStringIdentifierDialogComponent,
2947
- AjfFbValidationConditionEditorDialog,
2948
- AjfFbWarningConditionEditorDialog,
2949
- AjfFormBuilder,
2950
- ],
2951
- exports: [
2952
- AjfFormBuilder,
2953
- ],
2954
- providers: [
2955
- AjfFormBuilderService,
2956
- ],
2957
- },] }
2958
- ];
2959
-
2960
- /**
2961
- * @license
2962
- * Copyright (C) Gnucoop soc. coop.
2963
- *
2964
- * This file is part of the Advanced JSON forms (ajf).
2965
- *
2966
- * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
2967
- * modify it under the terms of the GNU Affero General Public License as
2968
- * published by the Free Software Foundation, either version 3 of the License,
2969
- * or (at your option) any later version.
2970
- *
2971
- * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
2972
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2973
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
2974
- * General Public License for more details.
2975
- *
2976
- * You should have received a copy of the GNU Affero General Public License
2977
- * along with Advanced JSON forms (ajf).
2978
- * If not, see http://www.gnu.org/licenses/.
2979
- *
2980
- */
2981
-
2982
- /**
2983
- * Generated bundle index. Do not edit.
2984
- */
2985
-
2986
- export { AjfFormBuilder, AjfFormBuilderModule, AjfFormBuilderService, disableFieldDropPredicate, disableSlideDropPredicate, flattenNodes, onDropProcess, AjfFbBranchLine as ɵgc_ajf_src_material_form_builder_form_builder_a, AjfFbChoicesOriginEditor as ɵgc_ajf_src_material_form_builder_form_builder_b, AjfFbChoicesOriginEditorDialog as ɵgc_ajf_src_material_form_builder_form_builder_c, AjfFbConditionEditor as ɵgc_ajf_src_material_form_builder_form_builder_d, AjfFbConditionEditorDialog as ɵgc_ajf_src_material_form_builder_form_builder_e, AjfFbNodeEntry as ɵgc_ajf_src_material_form_builder_form_builder_f, AjfFbNodeProperties as ɵgc_ajf_src_material_form_builder_form_builder_g, AjfFbNodeTypeEntry as ɵgc_ajf_src_material_form_builder_form_builder_h, AjfFbStringIdentifierDialogComponent as ɵgc_ajf_src_material_form_builder_form_builder_i, AjfFbValidationConditionEditorDialog as ɵgc_ajf_src_material_form_builder_form_builder_j, AjfFbWarningConditionEditorDialog as ɵgc_ajf_src_material_form_builder_form_builder_k };
2987
- //# sourceMappingURL=form-builder.js.map