@ajf/material 13.0.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (350) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +6 -0
  3. package/barcode/_barcode.scss +0 -0
  4. package/barcode/barcode-module.d.ts +23 -0
  5. package/barcode/barcode.d.ts +30 -0
  6. package/barcode/index.d.ts +4 -0
  7. package/barcode/index.metadata.json +1 -0
  8. package/barcode/package.json +9 -0
  9. package/barcode/public-api.d.ts +23 -0
  10. package/bundles/material-barcode.umd.js +433 -0
  11. package/bundles/material-barcode.umd.js.map +1 -0
  12. package/bundles/material-calendar.umd.js +435 -0
  13. package/bundles/material-calendar.umd.js.map +1 -0
  14. package/bundles/material-checkbox-group.umd.js +432 -0
  15. package/bundles/material-checkbox-group.umd.js.map +1 -0
  16. package/bundles/material-form-builder.umd.js +3558 -0
  17. package/bundles/material-form-builder.umd.js.map +1 -0
  18. package/bundles/material-forms.umd.js +968 -0
  19. package/bundles/material-forms.umd.js.map +1 -0
  20. package/bundles/material-image.umd.js +420 -0
  21. package/bundles/material-image.umd.js.map +1 -0
  22. package/bundles/material-monaco-editor.umd.js +755 -0
  23. package/bundles/material-monaco-editor.umd.js.map +1 -0
  24. package/bundles/material-node-icon.umd.js +415 -0
  25. package/bundles/material-node-icon.umd.js.map +1 -0
  26. package/bundles/material-page-slider.umd.js +424 -0
  27. package/bundles/material-page-slider.umd.js.map +1 -0
  28. package/bundles/material-report-builder.umd.js +5814 -0
  29. package/bundles/material-report-builder.umd.js.map +1 -0
  30. package/bundles/material-reports.umd.js +731 -0
  31. package/bundles/material-reports.umd.js.map +1 -0
  32. package/bundles/material-time.umd.js +424 -0
  33. package/bundles/material-time.umd.js.map +1 -0
  34. package/bundles/material.umd.js +40 -0
  35. package/bundles/material.umd.js.map +1 -0
  36. package/calendar/_calendar.scss +0 -0
  37. package/calendar/calendar-module.d.ts +23 -0
  38. package/calendar/calendar.d.ts +30 -0
  39. package/calendar/index.d.ts +4 -0
  40. package/calendar/index.metadata.json +1 -0
  41. package/calendar/package.json +9 -0
  42. package/calendar/public-api.d.ts +23 -0
  43. package/checkbox-group/_checkbox-group.scss +0 -0
  44. package/checkbox-group/checkbox-group-item.d.ts +25 -0
  45. package/checkbox-group/checkbox-group-module.d.ts +23 -0
  46. package/checkbox-group/index.d.ts +4 -0
  47. package/checkbox-group/index.metadata.json +1 -0
  48. package/checkbox-group/package.json +9 -0
  49. package/checkbox-group/public-api.d.ts +23 -0
  50. package/esm2015/barcode/barcode-module.js +50 -0
  51. package/esm2015/barcode/barcode.externs.js +6 -0
  52. package/esm2015/barcode/barcode.js +52 -0
  53. package/esm2015/barcode/index.js +5 -0
  54. package/esm2015/barcode/public-api.js +24 -0
  55. package/esm2015/calendar/calendar-module.js +48 -0
  56. package/esm2015/calendar/calendar.externs.js +6 -0
  57. package/esm2015/calendar/calendar.js +55 -0
  58. package/esm2015/calendar/index.js +5 -0
  59. package/esm2015/calendar/public-api.js +24 -0
  60. package/esm2015/checkbox-group/checkbox-group-item.js +51 -0
  61. package/esm2015/checkbox-group/checkbox-group-module.js +47 -0
  62. package/esm2015/checkbox-group/checkbox-group.externs.js +6 -0
  63. package/esm2015/checkbox-group/index.js +5 -0
  64. package/esm2015/checkbox-group/public-api.js +24 -0
  65. package/esm2015/form-builder/branch-line.js +73 -0
  66. package/esm2015/form-builder/choices-origin-data-source.js +38 -0
  67. package/esm2015/form-builder/choices-origin-editor-dialog.js +57 -0
  68. package/esm2015/form-builder/choices-origin-editor.js +78 -0
  69. package/esm2015/form-builder/condition-editor-dialog.js +59 -0
  70. package/esm2015/form-builder/condition-editor.js +143 -0
  71. package/esm2015/form-builder/form-builder-module.js +96 -0
  72. package/esm2015/form-builder/form-builder-service.js +764 -0
  73. package/esm2015/form-builder/form-builder-utils.js +63 -0
  74. package/esm2015/form-builder/form-builder.externs.js +6 -0
  75. package/esm2015/form-builder/form-builder.js +187 -0
  76. package/esm2015/form-builder/index.js +16 -0
  77. package/esm2015/form-builder/node-entry.js +245 -0
  78. package/esm2015/form-builder/node-properties.js +968 -0
  79. package/esm2015/form-builder/node-type-entry.js +50 -0
  80. package/esm2015/form-builder/operations.js +23 -0
  81. package/esm2015/form-builder/public-api.js +26 -0
  82. package/esm2015/form-builder/string-identifier-dialog.js +94 -0
  83. package/esm2015/form-builder/validation-condition-editor-dialog.js +59 -0
  84. package/esm2015/form-builder/warning-condition-editor-dialog.js +59 -0
  85. package/esm2015/forms/barcode-field.js +43 -0
  86. package/esm2015/forms/boolean-field.js +43 -0
  87. package/esm2015/forms/date-field.js +43 -0
  88. package/esm2015/forms/date-input-field.js +65 -0
  89. package/esm2015/forms/empty-field.js +43 -0
  90. package/esm2015/forms/field-service.js +115 -0
  91. package/esm2015/forms/field-warning-dialog.js +32 -0
  92. package/esm2015/forms/field.js +45 -0
  93. package/esm2015/forms/form.js +46 -0
  94. package/esm2015/forms/forms-module.js +107 -0
  95. package/esm2015/forms/forms.externs.js +6 -0
  96. package/esm2015/forms/index.js +9 -0
  97. package/esm2015/forms/input-field.js +43 -0
  98. package/esm2015/forms/multiple-choice-field.js +44 -0
  99. package/esm2015/forms/public-api.js +37 -0
  100. package/esm2015/forms/range-field.js +45 -0
  101. package/esm2015/forms/single-choice-field.js +44 -0
  102. package/esm2015/forms/table-field.js +43 -0
  103. package/esm2015/forms/text-field.js +43 -0
  104. package/esm2015/forms/time-field.js +43 -0
  105. package/esm2015/forms/video-url-field.js +47 -0
  106. package/esm2015/forms/warning-alert-service.js +42 -0
  107. package/esm2015/image/image-module.js +42 -0
  108. package/esm2015/image/image.externs.js +6 -0
  109. package/esm2015/image/image.js +44 -0
  110. package/esm2015/image/index.js +5 -0
  111. package/esm2015/image/public-api.js +24 -0
  112. package/esm2015/index.js +28 -0
  113. package/esm2015/material.externs.js +0 -0
  114. package/esm2015/monaco-editor/auto-complete-item-model.js +44 -0
  115. package/esm2015/monaco-editor/autocomplete-singleton-model.js +134 -0
  116. package/esm2015/monaco-editor/editor-language-model.js +60 -0
  117. package/esm2015/monaco-editor/editor-options-model.js +27 -0
  118. package/esm2015/monaco-editor/editor-scrollbar-options.js +23 -0
  119. package/esm2015/monaco-editor/editor-theme.js +30 -0
  120. package/esm2015/monaco-editor/index.js +5 -0
  121. package/esm2015/monaco-editor/monaco-editor-module.js +36 -0
  122. package/esm2015/monaco-editor/monaco-editor.externs.js +6 -0
  123. package/esm2015/monaco-editor/monaco-editor.js +389 -0
  124. package/esm2015/monaco-editor/public-api.js +24 -0
  125. package/esm2015/node-icon/index.js +5 -0
  126. package/esm2015/node-icon/node-icon-module.js +42 -0
  127. package/esm2015/node-icon/node-icon.externs.js +6 -0
  128. package/esm2015/node-icon/node-icon.js +35 -0
  129. package/esm2015/node-icon/public-api.js +24 -0
  130. package/esm2015/page-slider/index.js +5 -0
  131. package/esm2015/page-slider/page-slider-module.js +49 -0
  132. package/esm2015/page-slider/page-slider.externs.js +6 -0
  133. package/esm2015/page-slider/page-slider.js +44 -0
  134. package/esm2015/page-slider/public-api.js +24 -0
  135. package/esm2015/report-builder/column.js +97 -0
  136. package/esm2015/report-builder/condition-editor.js +159 -0
  137. package/esm2015/report-builder/content.js +255 -0
  138. package/esm2015/report-builder/custom-widget-dialog.js +51 -0
  139. package/esm2015/report-builder/custom-widget-toolbar-button.js +70 -0
  140. package/esm2015/report-builder/custom-widgets-toolbar.js +124 -0
  141. package/esm2015/report-builder/forms-analyzer-dialog.js +315 -0
  142. package/esm2015/report-builder/forms-analyzer.js +264 -0
  143. package/esm2015/report-builder/image-filter.js +32 -0
  144. package/esm2015/report-builder/image-group.js +106 -0
  145. package/esm2015/report-builder/index.js +25 -0
  146. package/esm2015/report-builder/models.js +23 -0
  147. package/esm2015/report-builder/operations.js +23 -0
  148. package/esm2015/report-builder/properties.js +765 -0
  149. package/esm2015/report-builder/public-api.js +26 -0
  150. package/esm2015/report-builder/quill-editor.js +299 -0
  151. package/esm2015/report-builder/renderer-widget.js +238 -0
  152. package/esm2015/report-builder/report-builder-drag-data.js +23 -0
  153. package/esm2015/report-builder/report-builder-module.js +114 -0
  154. package/esm2015/report-builder/report-builder-service.js +1685 -0
  155. package/esm2015/report-builder/report-builder.externs.js +6 -0
  156. package/esm2015/report-builder/report-builder.js +69 -0
  157. package/esm2015/report-builder/theme-color-dialog.js +90 -0
  158. package/esm2015/report-builder/theme-color.js +215 -0
  159. package/esm2015/report-builder/tokens.js +24 -0
  160. package/esm2015/report-builder/toolbar-dialog.js +56 -0
  161. package/esm2015/report-builder/toolbar.js +90 -0
  162. package/esm2015/report-builder/utils.js +48 -0
  163. package/esm2015/report-builder/widget-toolbar-button.js +47 -0
  164. package/esm2015/report-builder/widgets-row-buttons.js +133 -0
  165. package/esm2015/report-builder/widgets-toolbar.js +79 -0
  166. package/esm2015/reports/chart-widget.js +41 -0
  167. package/esm2015/reports/formula-widget.js +41 -0
  168. package/esm2015/reports/image-container-widget.js +43 -0
  169. package/esm2015/reports/image-widget.js +41 -0
  170. package/esm2015/reports/index.js +5 -0
  171. package/esm2015/reports/layout-widget.js +22 -0
  172. package/esm2015/reports/map-widget.js +41 -0
  173. package/esm2015/reports/page-break-widget.js +41 -0
  174. package/esm2015/reports/public-api.js +33 -0
  175. package/esm2015/reports/report.js +41 -0
  176. package/esm2015/reports/reports-module.js +79 -0
  177. package/esm2015/reports/reports.externs.js +6 -0
  178. package/esm2015/reports/table-widget.js +41 -0
  179. package/esm2015/reports/text-widget.js +41 -0
  180. package/esm2015/reports/widget.js +120 -0
  181. package/esm2015/time/index.js +5 -0
  182. package/esm2015/time/public-api.js +24 -0
  183. package/esm2015/time/time-module.js +44 -0
  184. package/esm2015/time/time.externs.js +6 -0
  185. package/esm2015/time/time.js +46 -0
  186. package/fesm2015/barcode.js +129 -0
  187. package/fesm2015/barcode.js.map +1 -0
  188. package/fesm2015/calendar.js +128 -0
  189. package/fesm2015/calendar.js.map +1 -0
  190. package/fesm2015/checkbox-group.js +124 -0
  191. package/fesm2015/checkbox-group.js.map +1 -0
  192. package/fesm2015/form-builder.js +2987 -0
  193. package/fesm2015/form-builder.js.map +1 -0
  194. package/fesm2015/forms.js +923 -0
  195. package/fesm2015/forms.js.map +1 -0
  196. package/fesm2015/image.js +113 -0
  197. package/fesm2015/image.js.map +1 -0
  198. package/fesm2015/material.js +30 -0
  199. package/fesm2015/material.js.map +1 -0
  200. package/fesm2015/monaco-editor.js +741 -0
  201. package/fesm2015/monaco-editor.js.map +1 -0
  202. package/fesm2015/node-icon.js +104 -0
  203. package/fesm2015/node-icon.js.map +1 -0
  204. package/fesm2015/page-slider.js +119 -0
  205. package/fesm2015/page-slider.js.map +1 -0
  206. package/fesm2015/report-builder.js +5332 -0
  207. package/fesm2015/report-builder.js.map +1 -0
  208. package/fesm2015/reports.js +560 -0
  209. package/fesm2015/reports.js.map +1 -0
  210. package/fesm2015/time.js +116 -0
  211. package/fesm2015/time.js.map +1 -0
  212. package/form-builder/_form-builder.scss +0 -0
  213. package/form-builder/branch-line.d.ts +36 -0
  214. package/form-builder/choices-origin-data-source.d.ts +35 -0
  215. package/form-builder/choices-origin-editor-dialog.d.ts +34 -0
  216. package/form-builder/choices-origin-editor.d.ts +43 -0
  217. package/form-builder/condition-editor-dialog.d.ts +35 -0
  218. package/form-builder/condition-editor.d.ts +37 -0
  219. package/form-builder/form-builder-module.d.ts +23 -0
  220. package/form-builder/form-builder-service.d.ts +191 -0
  221. package/form-builder/form-builder-utils.d.ts +41 -0
  222. package/form-builder/form-builder.d.ts +78 -0
  223. package/form-builder/index.d.ts +15 -0
  224. package/form-builder/index.metadata.json +1 -0
  225. package/form-builder/node-entry.d.ts +93 -0
  226. package/form-builder/node-properties.d.ts +184 -0
  227. package/form-builder/node-type-entry.d.ts +30 -0
  228. package/form-builder/operations.d.ts +31 -0
  229. package/form-builder/package.json +9 -0
  230. package/form-builder/public-api.d.ts +25 -0
  231. package/form-builder/string-identifier-dialog.d.ts +45 -0
  232. package/form-builder/validation-condition-editor-dialog.d.ts +36 -0
  233. package/form-builder/warning-condition-editor-dialog.d.ts +36 -0
  234. package/forms/_forms.scss +0 -0
  235. package/forms/barcode-field.d.ts +27 -0
  236. package/forms/boolean-field.d.ts +27 -0
  237. package/forms/date-field.d.ts +27 -0
  238. package/forms/date-input-field.d.ts +34 -0
  239. package/forms/empty-field.d.ts +27 -0
  240. package/forms/field-service.d.ts +25 -0
  241. package/forms/field-warning-dialog.d.ts +24 -0
  242. package/forms/field.d.ts +30 -0
  243. package/forms/form.d.ts +36 -0
  244. package/forms/forms-module.d.ts +25 -0
  245. package/forms/index.d.ts +8 -0
  246. package/forms/index.metadata.json +1 -0
  247. package/forms/input-field.d.ts +27 -0
  248. package/forms/multiple-choice-field.d.ts +27 -0
  249. package/forms/package.json +9 -0
  250. package/forms/public-api.d.ts +36 -0
  251. package/forms/range-field.d.ts +28 -0
  252. package/forms/single-choice-field.d.ts +27 -0
  253. package/forms/table-field.d.ts +27 -0
  254. package/forms/text-field.d.ts +27 -0
  255. package/forms/time-field.d.ts +27 -0
  256. package/forms/video-url-field.d.ts +29 -0
  257. package/forms/warning-alert-service.d.ts +29 -0
  258. package/image/_image.scss +0 -0
  259. package/image/image-module.d.ts +23 -0
  260. package/image/image.d.ts +27 -0
  261. package/image/index.d.ts +4 -0
  262. package/image/index.metadata.json +1 -0
  263. package/image/package.json +9 -0
  264. package/image/public-api.d.ts +23 -0
  265. package/index.d.ts +22 -0
  266. package/monaco-editor/_monaco-editor.scss +0 -0
  267. package/monaco-editor/auto-complete-item-model.d.ts +35 -0
  268. package/monaco-editor/autocomplete-singleton-model.d.ts +55 -0
  269. package/monaco-editor/editor-language-model.d.ts +59 -0
  270. package/monaco-editor/editor-options-model.d.ts +334 -0
  271. package/monaco-editor/editor-scrollbar-options.d.ts +83 -0
  272. package/monaco-editor/editor-theme.d.ts +29 -0
  273. package/monaco-editor/index.d.ts +4 -0
  274. package/monaco-editor/index.metadata.json +1 -0
  275. package/monaco-editor/monaco-editor-module.d.ts +23 -0
  276. package/monaco-editor/monaco-editor.d.ts +152 -0
  277. package/monaco-editor/package.json +9 -0
  278. package/monaco-editor/public-api.d.ts +23 -0
  279. package/node-icon/_node-icon.scss +0 -0
  280. package/node-icon/index.d.ts +4 -0
  281. package/node-icon/index.metadata.json +1 -0
  282. package/node-icon/node-icon-module.d.ts +23 -0
  283. package/node-icon/node-icon.d.ts +24 -0
  284. package/node-icon/package.json +9 -0
  285. package/node-icon/public-api.d.ts +23 -0
  286. package/package.json +38 -0
  287. package/page-slider/_page-slider.scss +0 -0
  288. package/page-slider/index.d.ts +4 -0
  289. package/page-slider/index.metadata.json +1 -0
  290. package/page-slider/package.json +9 -0
  291. package/page-slider/page-slider-module.d.ts +23 -0
  292. package/page-slider/page-slider.d.ts +30 -0
  293. package/page-slider/public-api.d.ts +23 -0
  294. package/report-builder/_report-builder.scss +0 -0
  295. package/report-builder/column.d.ts +63 -0
  296. package/report-builder/condition-editor.d.ts +67 -0
  297. package/report-builder/content.d.ts +142 -0
  298. package/report-builder/custom-widget-dialog.d.ts +31 -0
  299. package/report-builder/custom-widget-toolbar-button.d.ts +45 -0
  300. package/report-builder/custom-widgets-toolbar.d.ts +71 -0
  301. package/report-builder/forms-analyzer-dialog.d.ts +91 -0
  302. package/report-builder/forms-analyzer.d.ts +102 -0
  303. package/report-builder/image-filter.d.ts +25 -0
  304. package/report-builder/image-group.d.ts +69 -0
  305. package/report-builder/index.d.ts +24 -0
  306. package/report-builder/index.metadata.json +1 -0
  307. package/report-builder/models.d.ts +43 -0
  308. package/report-builder/operations.d.ts +45 -0
  309. package/report-builder/package.json +9 -0
  310. package/report-builder/properties.d.ts +365 -0
  311. package/report-builder/public-api.d.ts +26 -0
  312. package/report-builder/quill-editor.d.ts +113 -0
  313. package/report-builder/renderer-widget.d.ts +80 -0
  314. package/report-builder/report-builder-drag-data.d.ts +32 -0
  315. package/report-builder/report-builder-module.d.ts +23 -0
  316. package/report-builder/report-builder-service.d.ts +722 -0
  317. package/report-builder/report-builder.d.ts +36 -0
  318. package/report-builder/theme-color-dialog.d.ts +42 -0
  319. package/report-builder/theme-color.d.ts +108 -0
  320. package/report-builder/tokens.d.ts +24 -0
  321. package/report-builder/toolbar-dialog.d.ts +30 -0
  322. package/report-builder/toolbar.d.ts +48 -0
  323. package/report-builder/utils.d.ts +29 -0
  324. package/report-builder/widget-toolbar-button.d.ts +28 -0
  325. package/report-builder/widgets-row-buttons.d.ts +57 -0
  326. package/report-builder/widgets-toolbar.d.ts +44 -0
  327. package/reports/_reports.scss +0 -0
  328. package/reports/chart-widget.d.ts +26 -0
  329. package/reports/formula-widget.d.ts +26 -0
  330. package/reports/image-container-widget.d.ts +28 -0
  331. package/reports/image-widget.d.ts +26 -0
  332. package/reports/index.d.ts +4 -0
  333. package/reports/index.metadata.json +1 -0
  334. package/reports/layout-widget.d.ts +21 -0
  335. package/reports/map-widget.d.ts +26 -0
  336. package/reports/package.json +9 -0
  337. package/reports/page-break-widget.d.ts +26 -0
  338. package/reports/public-api.d.ts +32 -0
  339. package/reports/report.d.ts +26 -0
  340. package/reports/reports-module.d.ts +23 -0
  341. package/reports/table-widget.d.ts +26 -0
  342. package/reports/text-widget.d.ts +26 -0
  343. package/reports/widget.d.ts +40 -0
  344. package/time/_time.scss +0 -0
  345. package/time/index.d.ts +4 -0
  346. package/time/index.metadata.json +1 -0
  347. package/time/package.json +9 -0
  348. package/time/public-api.d.ts +23 -0
  349. package/time/time-module.d.ts +23 -0
  350. package/time/time.d.ts +28 -0
@@ -0,0 +1,3558 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@ajf/core/transloco'), require('@ajf/material/monaco-editor'), require('@ajf/material/node-icon'), require('@angular/cdk/drag-drop'), require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material/autocomplete'), require('@angular/material/button'), require('@angular/material/card'), require('@angular/material/checkbox'), require('@angular/material/chips'), require('@angular/material/dialog'), require('@angular/material/expansion'), require('@angular/material/form-field'), require('@angular/material/icon'), require('@angular/material/input'), require('@angular/material/list'), require('@angular/material/menu'), require('@angular/material/select'), require('@angular/material/sidenav'), require('@angular/material/slide-toggle'), require('@angular/material/slider'), require('@angular/material/table'), require('@angular/material/toolbar'), require('@angular/material/tooltip'), require('@ajf/core/forms'), require('@angular/cdk/collections'), require('rxjs'), require('rxjs/operators'), require('@ajf/core/models'), require('@ajf/core/utils'), require('@angular/cdk/keycodes')) :
3
+ typeof define === 'function' && define.amd ? define('@ajf/material/form-builder', ['exports', '@ajf/core/transloco', '@ajf/material/monaco-editor', '@ajf/material/node-icon', '@angular/cdk/drag-drop', '@angular/common', '@angular/core', '@angular/forms', '@angular/material/autocomplete', '@angular/material/button', '@angular/material/card', '@angular/material/checkbox', '@angular/material/chips', '@angular/material/dialog', '@angular/material/expansion', '@angular/material/form-field', '@angular/material/icon', '@angular/material/input', '@angular/material/list', '@angular/material/menu', '@angular/material/select', '@angular/material/sidenav', '@angular/material/slide-toggle', '@angular/material/slider', '@angular/material/table', '@angular/material/toolbar', '@angular/material/tooltip', '@ajf/core/forms', '@angular/cdk/collections', 'rxjs', 'rxjs/operators', '@ajf/core/models', '@ajf/core/utils', '@angular/cdk/keycodes'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ajf = global.ajf || {}, global.ajf.material = global.ajf.material || {}, global.ajf.material.formBuilder = {}), global.ajf.core.transloco, global.ajf.material.monacoEditor, global.ajf.material.nodeIcon, global.ng.cdk.dragDrop, global.ng.common, global.ng.core, global.ng.forms, global.ng.material.autocomplete, global.ng.material.button, global.ng.material.card, global.ng.material.checkbox, global.ng.material.chips, global.ng.material.dialog, global.ng.material.expansionPanel, global.ng.material.formField, global.ng.material.icon, global.ng.material.input, global.ng.material.list, global.ng.material.menu, global.ng.material.select, global.ng.material.sidenav, global.ng.material.slideToggle, global.ng.material.slider, global.ng.material.table, global.ng.material.toolbar, global.ng.material.tooltip, global.ajf.core.forms, global.ng.cdk.collections, global.rxjs, global.rxjs.operators, global.ajf.core.models, global.ajf.core.utils, global.ng.cdk.keycodes));
5
+ }(this, (function (exports, transloco, monacoEditor, nodeIcon, dragDrop, common, core, forms$1, autocomplete, button, card, checkbox, chips, dialog, expansion, formField, icon, input, list, menu, select, sidenav, slideToggle, slider, table, toolbar, tooltip, forms, collections, rxjs, operators, models, utils, keycodes) { 'use strict';
6
+
7
+ /**
8
+ * @license
9
+ * Copyright (C) Gnucoop soc. coop.
10
+ *
11
+ * This file is part of the Advanced JSON forms (ajf).
12
+ *
13
+ * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
14
+ * modify it under the terms of the GNU Affero General Public License as
15
+ * published by the Free Software Foundation, either version 3 of the License,
16
+ * or (at your option) any later version.
17
+ *
18
+ * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
19
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
21
+ * General Public License for more details.
22
+ *
23
+ * You should have received a copy of the GNU Affero General Public License
24
+ * along with Advanced JSON forms (ajf).
25
+ * If not, see http://www.gnu.org/licenses/.
26
+ *
27
+ */
28
+ var AjfFbBranchLine = /** @class */ (function () {
29
+ function AjfFbBranchLine(_el, _renderer) {
30
+ this._el = _el;
31
+ this._renderer = _renderer;
32
+ this._offset = 0;
33
+ this._height = 0;
34
+ }
35
+ Object.defineProperty(AjfFbBranchLine.prototype, "offset", {
36
+ set: function (offset) {
37
+ this._offset = offset;
38
+ this._updateOffset();
39
+ },
40
+ enumerable: false,
41
+ configurable: true
42
+ });
43
+ Object.defineProperty(AjfFbBranchLine.prototype, "color", {
44
+ set: function (color) {
45
+ this._color = color;
46
+ this._updateColor();
47
+ },
48
+ enumerable: false,
49
+ configurable: true
50
+ });
51
+ Object.defineProperty(AjfFbBranchLine.prototype, "height", {
52
+ set: function (height) {
53
+ this._height = height;
54
+ this._updateHeight();
55
+ },
56
+ enumerable: false,
57
+ configurable: true
58
+ });
59
+ AjfFbBranchLine.prototype._updateHeight = function () {
60
+ var height = Math.max(0, this._height - 25) + "px";
61
+ this._renderer.setStyle(this._el.nativeElement, 'height', height);
62
+ };
63
+ AjfFbBranchLine.prototype._updateOffset = function () {
64
+ var margin = this._offset * 4 + "px";
65
+ this._renderer.setStyle(this._el.nativeElement, 'margin-top', margin);
66
+ this._renderer.setStyle(this._el.nativeElement, 'margin-left', margin);
67
+ };
68
+ AjfFbBranchLine.prototype._updateColor = function () {
69
+ this._renderer.setStyle(this._el.nativeElement, 'border-color', this._color);
70
+ };
71
+ return AjfFbBranchLine;
72
+ }());
73
+ AjfFbBranchLine.decorators = [
74
+ { type: core.Component, args: [{
75
+ selector: 'ajf-fb-branch-line',
76
+ template: "",
77
+ encapsulation: core.ViewEncapsulation.None,
78
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
79
+ 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"]
80
+ },] }
81
+ ];
82
+ AjfFbBranchLine.ctorParameters = function () { return [
83
+ { type: core.ElementRef },
84
+ { type: core.Renderer2 }
85
+ ]; };
86
+ AjfFbBranchLine.propDecorators = {
87
+ offset: [{ type: core.Input }],
88
+ color: [{ type: core.Input }],
89
+ height: [{ type: core.Input }]
90
+ };
91
+
92
+ /*! *****************************************************************************
93
+ Copyright (c) Microsoft Corporation.
94
+
95
+ Permission to use, copy, modify, and/or distribute this software for any
96
+ purpose with or without fee is hereby granted.
97
+
98
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
99
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
100
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
101
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
102
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
103
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
104
+ PERFORMANCE OF THIS SOFTWARE.
105
+ ***************************************************************************** */
106
+ /* global Reflect, Promise */
107
+ var extendStatics = function (d, b) {
108
+ extendStatics = Object.setPrototypeOf ||
109
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
110
+ function (d, b) { for (var p in b)
111
+ if (Object.prototype.hasOwnProperty.call(b, p))
112
+ d[p] = b[p]; };
113
+ return extendStatics(d, b);
114
+ };
115
+ function __extends(d, b) {
116
+ if (typeof b !== "function" && b !== null)
117
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
118
+ extendStatics(d, b);
119
+ function __() { this.constructor = d; }
120
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
121
+ }
122
+ var __assign = function () {
123
+ __assign = Object.assign || function __assign(t) {
124
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
125
+ s = arguments[i];
126
+ for (var p in s)
127
+ if (Object.prototype.hasOwnProperty.call(s, p))
128
+ t[p] = s[p];
129
+ }
130
+ return t;
131
+ };
132
+ return __assign.apply(this, arguments);
133
+ };
134
+ function __rest(s, e) {
135
+ var t = {};
136
+ for (var p in s)
137
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
138
+ t[p] = s[p];
139
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
140
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
141
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
142
+ t[p[i]] = s[p[i]];
143
+ }
144
+ return t;
145
+ }
146
+ function __decorate(decorators, target, key, desc) {
147
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
148
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
149
+ r = Reflect.decorate(decorators, target, key, desc);
150
+ else
151
+ for (var i = decorators.length - 1; i >= 0; i--)
152
+ if (d = decorators[i])
153
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
154
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
155
+ }
156
+ function __param(paramIndex, decorator) {
157
+ return function (target, key) { decorator(target, key, paramIndex); };
158
+ }
159
+ function __metadata(metadataKey, metadataValue) {
160
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
161
+ return Reflect.metadata(metadataKey, metadataValue);
162
+ }
163
+ function __awaiter(thisArg, _arguments, P, generator) {
164
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
165
+ return new (P || (P = Promise))(function (resolve, reject) {
166
+ function fulfilled(value) { try {
167
+ step(generator.next(value));
168
+ }
169
+ catch (e) {
170
+ reject(e);
171
+ } }
172
+ function rejected(value) { try {
173
+ step(generator["throw"](value));
174
+ }
175
+ catch (e) {
176
+ reject(e);
177
+ } }
178
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
179
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
180
+ });
181
+ }
182
+ function __generator(thisArg, body) {
183
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
184
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
185
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
186
+ function verb(n) { return function (v) { return step([n, v]); }; }
187
+ function step(op) {
188
+ if (f)
189
+ throw new TypeError("Generator is already executing.");
190
+ while (_)
191
+ try {
192
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
193
+ return t;
194
+ if (y = 0, t)
195
+ op = [op[0] & 2, t.value];
196
+ switch (op[0]) {
197
+ case 0:
198
+ case 1:
199
+ t = op;
200
+ break;
201
+ case 4:
202
+ _.label++;
203
+ return { value: op[1], done: false };
204
+ case 5:
205
+ _.label++;
206
+ y = op[1];
207
+ op = [0];
208
+ continue;
209
+ case 7:
210
+ op = _.ops.pop();
211
+ _.trys.pop();
212
+ continue;
213
+ default:
214
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
215
+ _ = 0;
216
+ continue;
217
+ }
218
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
219
+ _.label = op[1];
220
+ break;
221
+ }
222
+ if (op[0] === 6 && _.label < t[1]) {
223
+ _.label = t[1];
224
+ t = op;
225
+ break;
226
+ }
227
+ if (t && _.label < t[2]) {
228
+ _.label = t[2];
229
+ _.ops.push(op);
230
+ break;
231
+ }
232
+ if (t[2])
233
+ _.ops.pop();
234
+ _.trys.pop();
235
+ continue;
236
+ }
237
+ op = body.call(thisArg, _);
238
+ }
239
+ catch (e) {
240
+ op = [6, e];
241
+ y = 0;
242
+ }
243
+ finally {
244
+ f = t = 0;
245
+ }
246
+ if (op[0] & 5)
247
+ throw op[1];
248
+ return { value: op[0] ? op[1] : void 0, done: true };
249
+ }
250
+ }
251
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
252
+ if (k2 === undefined)
253
+ k2 = k;
254
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
255
+ }) : (function (o, m, k, k2) {
256
+ if (k2 === undefined)
257
+ k2 = k;
258
+ o[k2] = m[k];
259
+ });
260
+ function __exportStar(m, o) {
261
+ for (var p in m)
262
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
263
+ __createBinding(o, m, p);
264
+ }
265
+ function __values(o) {
266
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
267
+ if (m)
268
+ return m.call(o);
269
+ if (o && typeof o.length === "number")
270
+ return {
271
+ next: function () {
272
+ if (o && i >= o.length)
273
+ o = void 0;
274
+ return { value: o && o[i++], done: !o };
275
+ }
276
+ };
277
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
278
+ }
279
+ function __read(o, n) {
280
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
281
+ if (!m)
282
+ return o;
283
+ var i = m.call(o), r, ar = [], e;
284
+ try {
285
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
286
+ ar.push(r.value);
287
+ }
288
+ catch (error) {
289
+ e = { error: error };
290
+ }
291
+ finally {
292
+ try {
293
+ if (r && !r.done && (m = i["return"]))
294
+ m.call(i);
295
+ }
296
+ finally {
297
+ if (e)
298
+ throw e.error;
299
+ }
300
+ }
301
+ return ar;
302
+ }
303
+ /** @deprecated */
304
+ function __spread() {
305
+ for (var ar = [], i = 0; i < arguments.length; i++)
306
+ ar = ar.concat(__read(arguments[i]));
307
+ return ar;
308
+ }
309
+ /** @deprecated */
310
+ function __spreadArrays() {
311
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
312
+ s += arguments[i].length;
313
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
314
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
315
+ r[k] = a[j];
316
+ return r;
317
+ }
318
+ function __spreadArray(to, from, pack) {
319
+ if (pack || arguments.length === 2)
320
+ for (var i = 0, l = from.length, ar; i < l; i++) {
321
+ if (ar || !(i in from)) {
322
+ if (!ar)
323
+ ar = Array.prototype.slice.call(from, 0, i);
324
+ ar[i] = from[i];
325
+ }
326
+ }
327
+ return to.concat(ar || Array.prototype.slice.call(from));
328
+ }
329
+ function __await(v) {
330
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
331
+ }
332
+ function __asyncGenerator(thisArg, _arguments, generator) {
333
+ if (!Symbol.asyncIterator)
334
+ throw new TypeError("Symbol.asyncIterator is not defined.");
335
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
336
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
337
+ function verb(n) { if (g[n])
338
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
339
+ function resume(n, v) { try {
340
+ step(g[n](v));
341
+ }
342
+ catch (e) {
343
+ settle(q[0][3], e);
344
+ } }
345
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
346
+ function fulfill(value) { resume("next", value); }
347
+ function reject(value) { resume("throw", value); }
348
+ function settle(f, v) { if (f(v), q.shift(), q.length)
349
+ resume(q[0][0], q[0][1]); }
350
+ }
351
+ function __asyncDelegator(o) {
352
+ var i, p;
353
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
354
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
355
+ }
356
+ function __asyncValues(o) {
357
+ if (!Symbol.asyncIterator)
358
+ throw new TypeError("Symbol.asyncIterator is not defined.");
359
+ var m = o[Symbol.asyncIterator], i;
360
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
361
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
362
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
363
+ }
364
+ function __makeTemplateObject(cooked, raw) {
365
+ if (Object.defineProperty) {
366
+ Object.defineProperty(cooked, "raw", { value: raw });
367
+ }
368
+ else {
369
+ cooked.raw = raw;
370
+ }
371
+ return cooked;
372
+ }
373
+ ;
374
+ var __setModuleDefault = Object.create ? (function (o, v) {
375
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
376
+ }) : function (o, v) {
377
+ o["default"] = v;
378
+ };
379
+ function __importStar(mod) {
380
+ if (mod && mod.__esModule)
381
+ return mod;
382
+ var result = {};
383
+ if (mod != null)
384
+ for (var k in mod)
385
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
386
+ __createBinding(result, mod, k);
387
+ __setModuleDefault(result, mod);
388
+ return result;
389
+ }
390
+ function __importDefault(mod) {
391
+ return (mod && mod.__esModule) ? mod : { default: mod };
392
+ }
393
+ function __classPrivateFieldGet(receiver, state, kind, f) {
394
+ if (kind === "a" && !f)
395
+ throw new TypeError("Private accessor was defined without a getter");
396
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
397
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
398
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
399
+ }
400
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
401
+ if (kind === "m")
402
+ throw new TypeError("Private method is not writable");
403
+ if (kind === "a" && !f)
404
+ throw new TypeError("Private accessor was defined without a setter");
405
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
406
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
407
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
408
+ }
409
+
410
+ var ChoicesOriginDataSource = /** @class */ (function (_super) {
411
+ __extends(ChoicesOriginDataSource, _super);
412
+ function ChoicesOriginDataSource() {
413
+ var _this = _super.call(this) || this;
414
+ _this._choices = new rxjs.BehaviorSubject([]);
415
+ _this._choicesObs = _this._choices;
416
+ return _this;
417
+ }
418
+ ChoicesOriginDataSource.prototype.connect = function () {
419
+ return this._choicesObs;
420
+ };
421
+ ChoicesOriginDataSource.prototype.disconnect = function () { };
422
+ ChoicesOriginDataSource.prototype.updateChoices = function (choices) {
423
+ this._choices.next(choices);
424
+ };
425
+ return ChoicesOriginDataSource;
426
+ }(collections.DataSource));
427
+
428
+ /**
429
+ * @license
430
+ * Copyright (C) Gnucoop soc. coop.
431
+ *
432
+ * This file is part of the Advanced JSON forms (ajf).
433
+ *
434
+ * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
435
+ * modify it under the terms of the GNU Affero General Public License as
436
+ * published by the Free Software Foundation, either version 3 of the License,
437
+ * or (at your option) any later version.
438
+ *
439
+ * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
440
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
441
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
442
+ * General Public License for more details.
443
+ *
444
+ * You should have received a copy of the GNU Affero General Public License
445
+ * along with Advanced JSON forms (ajf).
446
+ * If not, see http://www.gnu.org/licenses/.
447
+ *
448
+ */
449
+ var AjfFbChoicesOriginEditor = /** @class */ (function () {
450
+ function AjfFbChoicesOriginEditor() {
451
+ this._displayedColumns = ['label', 'value', 'delete'];
452
+ this.editing = {};
453
+ this._choices = new ChoicesOriginDataSource();
454
+ this._choicesArr = [];
455
+ }
456
+ Object.defineProperty(AjfFbChoicesOriginEditor.prototype, "displayedColumns", {
457
+ get: function () {
458
+ return this._displayedColumns;
459
+ },
460
+ enumerable: false,
461
+ configurable: true
462
+ });
463
+ Object.defineProperty(AjfFbChoicesOriginEditor.prototype, "choicesOrigin", {
464
+ get: function () {
465
+ return this._choicesOrigin;
466
+ },
467
+ set: function (choicesOrigin) {
468
+ this._choicesOrigin = choicesOrigin;
469
+ this.name = choicesOrigin.name;
470
+ this.label = choicesOrigin.label;
471
+ this.canEditChoices = forms.isChoicesFixedOrigin(choicesOrigin);
472
+ this._choicesArr = choicesOrigin.choices;
473
+ this._choices.updateChoices(this._choicesArr);
474
+ },
475
+ enumerable: false,
476
+ configurable: true
477
+ });
478
+ Object.defineProperty(AjfFbChoicesOriginEditor.prototype, "choices", {
479
+ get: function () {
480
+ return this._choices;
481
+ },
482
+ enumerable: false,
483
+ configurable: true
484
+ });
485
+ Object.defineProperty(AjfFbChoicesOriginEditor.prototype, "choicesArr", {
486
+ get: function () {
487
+ return this._choicesArr;
488
+ },
489
+ enumerable: false,
490
+ configurable: true
491
+ });
492
+ AjfFbChoicesOriginEditor.prototype.updateValue = function (evt, cell, _value, rowIdx) {
493
+ this.editing[rowIdx + '-' + cell] = false;
494
+ this._choicesArr[rowIdx][cell] = evt.target.value;
495
+ this._choices.updateChoices(this._choicesArr);
496
+ };
497
+ AjfFbChoicesOriginEditor.prototype.deleteRow = function (rowIdx) {
498
+ this._choicesArr.splice(rowIdx, 1);
499
+ this._choices.updateChoices(this._choicesArr);
500
+ };
501
+ AjfFbChoicesOriginEditor.prototype.addRow = function () {
502
+ this._choicesArr.push({ label: '', value: '' });
503
+ this._choices.updateChoices(this._choicesArr);
504
+ };
505
+ return AjfFbChoicesOriginEditor;
506
+ }());
507
+ AjfFbChoicesOriginEditor.decorators = [
508
+ { type: core.Component, args: [{
509
+ selector: 'ajf-fb-choices-origin-editor',
510
+ 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",
511
+ encapsulation: core.ViewEncapsulation.None,
512
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
513
+ 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"]
514
+ },] }
515
+ ];
516
+ AjfFbChoicesOriginEditor.propDecorators = {
517
+ choicesOrigin: [{ type: core.Input }]
518
+ };
519
+
520
+ function getNodeContainer(c, node) {
521
+ if (c.nodes.indexOf(node) > -1) {
522
+ return c;
523
+ }
524
+ var cns = c.nodes.filter(function (n) { return forms.isContainerNode(n); });
525
+ var len = cns.length;
526
+ for (var i = 0; i < len; i++) {
527
+ var cn = getNodeContainer(cns[i], node);
528
+ if (cn != null) {
529
+ return cn;
530
+ }
531
+ }
532
+ return null;
533
+ }
534
+ function buildFormBuilderNodesSubtree(nodes, parent, ignoreConditionalBranches) {
535
+ if (ignoreConditionalBranches === void 0) { ignoreConditionalBranches = false; }
536
+ var entries = nodes.filter(function (n) { return n.parent === parent.id; })
537
+ .sort(function (n1, n2) { return n1.parentNode - n2.parentNode; })
538
+ .map(function (n) {
539
+ var children = buildFormBuilderNodesSubtree(nodes, n);
540
+ if (children.length === 0) {
541
+ children.push({ parent: n, parentNode: 0 });
542
+ }
543
+ return {
544
+ node: n,
545
+ children: children,
546
+ content: buildFormBuilderNodesContent(nodes, n)
547
+ };
548
+ });
549
+ if (!ignoreConditionalBranches) {
550
+ var entriesNum = entries.length;
551
+ var cbs = parent.conditionalBranches.length;
552
+ for (var i = entriesNum; i < cbs; i++) {
553
+ entries.push({ parent: parent, parentNode: i });
554
+ }
555
+ }
556
+ return entries;
557
+ }
558
+ function buildFormBuilderNodesContent(_nodes, node) {
559
+ if (forms.isContainerNode(node)) {
560
+ return buildFormBuilderNodesSubtree(node.nodes, node, true);
561
+ }
562
+ return [];
563
+ }
564
+ function flattenNodes(nodes) {
565
+ var flatNodes = [];
566
+ nodes.forEach(function (node) {
567
+ if (forms.isContainerNode(node)) {
568
+ flatNodes = flatNodes.concat(flattenNodes(node.nodes));
569
+ }
570
+ flatNodes.push(node);
571
+ });
572
+ return flatNodes;
573
+ }
574
+ function getDescendants(flatNodes, parentNode, branch) {
575
+ if (branch === void 0) { branch = null; }
576
+ return branch != null ?
577
+ flatNodes.filter(function (n) { return n.parent === parentNode.id && n.parentNode === branch; }) :
578
+ flatNodes.filter(function (n) { return n.parent === parentNode.id; });
579
+ }
580
+ function removeNodes(nodes, ids) {
581
+ var len = nodes.length;
582
+ for (var i = 0; i < len; i++) {
583
+ var node = nodes[i];
584
+ if (forms.isContainerNode(node)) {
585
+ var container = node;
586
+ container.nodes = removeNodes(container.nodes, ids);
587
+ }
588
+ }
589
+ return nodes.filter(function (n) { return ids.indexOf(n.id) === -1; });
590
+ }
591
+ function deleteNodeSubtree(nodes, parentNode, branch) {
592
+ if (branch === void 0) { branch = null; }
593
+ var flatNodes = flattenNodes(nodes);
594
+ var delNodes = [];
595
+ var descendants = getDescendants(flatNodes, parentNode, branch);
596
+ var len = descendants.length;
597
+ for (var i = 0; i < len; i++) {
598
+ delNodes = delNodes.concat(getDescendants(flatNodes, descendants[i]));
599
+ }
600
+ delNodes = delNodes.concat(descendants);
601
+ return removeNodes(nodes, delNodes.map(function (n) { return n.id; }));
602
+ }
603
+ var nodeUniqueId = 0;
604
+ var AjfFormBuilderService = /** @class */ (function () {
605
+ function AjfFormBuilderService() {
606
+ this._availableNodeTypes = [
607
+ {
608
+ label: 'Slide',
609
+ icon: { fontSet: 'ajf-icon', fontIcon: 'field-slide' },
610
+ nodeType: { node: forms.AjfNodeType.AjfSlide },
611
+ isSlide: true
612
+ },
613
+ {
614
+ label: 'Repeating slide',
615
+ icon: { fontSet: 'ajf-icon', fontIcon: 'field-repeatingslide' },
616
+ nodeType: { node: forms.AjfNodeType.AjfRepeatingSlide },
617
+ isSlide: true
618
+ },
619
+ {
620
+ label: 'String',
621
+ icon: { fontSet: 'ajf-icon', fontIcon: 'field-string' },
622
+ nodeType: { node: forms.AjfNodeType.AjfField, field: forms.AjfFieldType.String }
623
+ },
624
+ {
625
+ label: 'Text',
626
+ icon: { fontSet: 'ajf-icon', fontIcon: 'field-text' },
627
+ nodeType: { node: forms.AjfNodeType.AjfField, field: forms.AjfFieldType.Text }
628
+ },
629
+ {
630
+ label: 'Number',
631
+ icon: { fontSet: 'ajf-icon', fontIcon: 'field-number' },
632
+ nodeType: { node: forms.AjfNodeType.AjfField, field: forms.AjfFieldType.Number }
633
+ },
634
+ {
635
+ label: 'Boolean',
636
+ icon: { fontSet: 'ajf-icon', fontIcon: 'field-boolean' },
637
+ nodeType: { node: forms.AjfNodeType.AjfField, field: forms.AjfFieldType.Boolean }
638
+ },
639
+ {
640
+ label: 'Single choice',
641
+ icon: { fontSet: 'ajf-icon', fontIcon: 'field-singlechoice' },
642
+ nodeType: { node: forms.AjfNodeType.AjfField, field: forms.AjfFieldType.SingleChoice }
643
+ },
644
+ {
645
+ label: 'Multiple choice',
646
+ icon: { fontSet: 'ajf-icon', fontIcon: 'field-multiplechoice' },
647
+ nodeType: { node: forms.AjfNodeType.AjfField, field: forms.AjfFieldType.MultipleChoice }
648
+ },
649
+ {
650
+ label: 'Formula',
651
+ icon: { fontSet: 'ajf-icon', fontIcon: 'field-formula' },
652
+ nodeType: { node: forms.AjfNodeType.AjfField, field: forms.AjfFieldType.Formula }
653
+ },
654
+ {
655
+ label: 'Date',
656
+ icon: { fontSet: 'ajf-icon', fontIcon: 'field-date' },
657
+ nodeType: { node: forms.AjfNodeType.AjfField, field: forms.AjfFieldType.Date }
658
+ },
659
+ {
660
+ label: 'Date input',
661
+ icon: { fontSet: 'ajf-icon', fontIcon: 'field-dateinput' },
662
+ nodeType: { node: forms.AjfNodeType.AjfField, field: forms.AjfFieldType.DateInput }
663
+ },
664
+ {
665
+ label: 'Time',
666
+ icon: { fontSet: 'ajf-icon', fontIcon: 'field-time' },
667
+ nodeType: { node: forms.AjfNodeType.AjfField, field: forms.AjfFieldType.Time }
668
+ },
669
+ {
670
+ label: 'Table',
671
+ icon: { fontSet: 'ajf-icon', fontIcon: 'field-table' },
672
+ nodeType: { node: forms.AjfNodeType.AjfField, field: forms.AjfFieldType.Table }
673
+ },
674
+ {
675
+ label: 'Range',
676
+ icon: { fontSet: 'ajf-icon', fontIcon: 'field-range' },
677
+ nodeType: { node: forms.AjfNodeType.AjfField, field: forms.AjfFieldType.Range }
678
+ }
679
+ ];
680
+ this._form = new rxjs.BehaviorSubject(null);
681
+ this._formObs = this._form;
682
+ /**
683
+ * A list of the ids of the dropLists connected to the source list.
684
+ */
685
+ this._connectedDropLists = new rxjs.BehaviorSubject([]);
686
+ this._editedNodeEntry = new rxjs.BehaviorSubject(null);
687
+ this._editedNodeEntryObs = this._editedNodeEntry;
688
+ this._editedCondition = new rxjs.BehaviorSubject(null);
689
+ this._editedConditionObs = this._editedCondition;
690
+ this._editedChoicesOrigin = new rxjs.BehaviorSubject(null);
691
+ this._editedChoicesOriginObs = this._editedChoicesOrigin;
692
+ this._beforeNodesUpdate = new core.EventEmitter();
693
+ this._beforeNodesUpdateObs = this._beforeNodesUpdate;
694
+ this._afterNodeUpdate = new core.EventEmitter();
695
+ this._afterNodeUpdateObs = this._afterNodeUpdate;
696
+ this._nodesUpdates = new rxjs.Subject();
697
+ this._attachmentsOriginsUpdates = new rxjs.Subject();
698
+ this._choicesOriginsUpdates = new rxjs.Subject();
699
+ this._stringIdentifierUpdates = new rxjs.Subject();
700
+ this._saveNodeEntryEvent = new core.EventEmitter();
701
+ this._deleteNodeEntryEvent = new core.EventEmitter();
702
+ /**
703
+ * Event fired when the position of a node in a tree changes.
704
+ */
705
+ this._moveNodeEntryEvent = new core.EventEmitter();
706
+ /**
707
+ * Subscribes to the moveNodeEntryEvent event emitter;
708
+ */
709
+ this._moveNodeSub = rxjs.Subscription.EMPTY;
710
+ this._initChoicesOriginsStreams();
711
+ this._initAttachmentsOriginsStreams();
712
+ this._initStringIdentifierStreams();
713
+ this._initNodesStreams();
714
+ this._initFormStreams();
715
+ this._initSaveNode();
716
+ this._initMoveNode();
717
+ this._initDeleteNode();
718
+ }
719
+ Object.defineProperty(AjfFormBuilderService.prototype, "availableNodeTypes", {
720
+ /**
721
+ * Available node types
722
+ *
723
+ * @readonly
724
+ * @memberOf AjfFormBuilderService
725
+ */
726
+ get: function () {
727
+ return this._availableNodeTypes;
728
+ },
729
+ enumerable: false,
730
+ configurable: true
731
+ });
732
+ Object.defineProperty(AjfFormBuilderService.prototype, "form", {
733
+ /**
734
+ * Current edited form stream
735
+ *
736
+ * @readonly
737
+ * @memberOf AjfFormBuilderService
738
+ */
739
+ get: function () {
740
+ return this._formObs;
741
+ },
742
+ enumerable: false,
743
+ configurable: true
744
+ });
745
+ Object.defineProperty(AjfFormBuilderService.prototype, "attachmentsOrigins", {
746
+ get: function () {
747
+ return this._attachmentsOrigins;
748
+ },
749
+ enumerable: false,
750
+ configurable: true
751
+ });
752
+ Object.defineProperty(AjfFormBuilderService.prototype, "choicesOrigins", {
753
+ get: function () {
754
+ return this._choicesOrigins;
755
+ },
756
+ enumerable: false,
757
+ configurable: true
758
+ });
759
+ Object.defineProperty(AjfFormBuilderService.prototype, "stringIdentifier", {
760
+ get: function () {
761
+ return this._stringIdentifier;
762
+ },
763
+ enumerable: false,
764
+ configurable: true
765
+ });
766
+ Object.defineProperty(AjfFormBuilderService.prototype, "nodes", {
767
+ get: function () {
768
+ return this._nodes;
769
+ },
770
+ enumerable: false,
771
+ configurable: true
772
+ });
773
+ Object.defineProperty(AjfFormBuilderService.prototype, "flatNodes", {
774
+ get: function () {
775
+ return this._flatNodes;
776
+ },
777
+ enumerable: false,
778
+ configurable: true
779
+ });
780
+ Object.defineProperty(AjfFormBuilderService.prototype, "flatFields", {
781
+ get: function () {
782
+ return this._flatFields;
783
+ },
784
+ enumerable: false,
785
+ configurable: true
786
+ });
787
+ Object.defineProperty(AjfFormBuilderService.prototype, "nodeEntriesTree", {
788
+ get: function () {
789
+ return this._nodeEntriesTree;
790
+ },
791
+ enumerable: false,
792
+ configurable: true
793
+ });
794
+ Object.defineProperty(AjfFormBuilderService.prototype, "connectedDropLists", {
795
+ get: function () {
796
+ return this._connectedDropLists;
797
+ },
798
+ enumerable: false,
799
+ configurable: true
800
+ });
801
+ Object.defineProperty(AjfFormBuilderService.prototype, "editedNodeEntry", {
802
+ get: function () {
803
+ return this._editedNodeEntryObs;
804
+ },
805
+ enumerable: false,
806
+ configurable: true
807
+ });
808
+ Object.defineProperty(AjfFormBuilderService.prototype, "editedCondition", {
809
+ get: function () {
810
+ return this._editedConditionObs;
811
+ },
812
+ enumerable: false,
813
+ configurable: true
814
+ });
815
+ Object.defineProperty(AjfFormBuilderService.prototype, "editedChoicesOrigin", {
816
+ get: function () {
817
+ return this._editedChoicesOriginObs;
818
+ },
819
+ enumerable: false,
820
+ configurable: true
821
+ });
822
+ Object.defineProperty(AjfFormBuilderService.prototype, "beforeNodesUpdate", {
823
+ get: function () {
824
+ return this._beforeNodesUpdateObs;
825
+ },
826
+ enumerable: false,
827
+ configurable: true
828
+ });
829
+ Object.defineProperty(AjfFormBuilderService.prototype, "afterNodeUpdate", {
830
+ get: function () {
831
+ return this._afterNodeUpdateObs;
832
+ },
833
+ enumerable: false,
834
+ configurable: true
835
+ });
836
+ /**
837
+ * Sets the current edited form
838
+ *
839
+ * @param form
840
+ *
841
+ * @memberOf AjfFormBuilderService
842
+ */
843
+ AjfFormBuilderService.prototype.setForm = function (form) {
844
+ if (form !== this._form.getValue()) {
845
+ this._form.next(form);
846
+ }
847
+ };
848
+ AjfFormBuilderService.prototype.editNodeEntry = function (nodeEntry) {
849
+ this._editedNodeEntry.next(nodeEntry);
850
+ };
851
+ AjfFormBuilderService.prototype.editCondition = function (condition) {
852
+ this._editedCondition.next(condition);
853
+ };
854
+ AjfFormBuilderService.prototype.saveCurrentCondition = function (condition) {
855
+ var c = this._editedCondition.getValue();
856
+ if (c == null) {
857
+ return;
858
+ }
859
+ c.condition = condition;
860
+ this._editedCondition.next(null);
861
+ };
862
+ AjfFormBuilderService.prototype.cancelConditionEdit = function () {
863
+ this._editedChoicesOrigin.next(null);
864
+ };
865
+ AjfFormBuilderService.prototype.assignListId = function (node, empty) {
866
+ if (empty === void 0) { empty = false; }
867
+ if (node.nodeType === forms.AjfNodeType.AjfSlide || node.nodeType === forms.AjfNodeType.AjfRepeatingSlide) {
868
+ var listId = empty ? "empty_fields_list_" + node.id : "fields_list_" + node.id;
869
+ if (this._connectedDropLists.value.indexOf(listId) == -1) {
870
+ this._connectDropList(listId);
871
+ }
872
+ return listId;
873
+ }
874
+ return '';
875
+ };
876
+ AjfFormBuilderService.prototype.insertNode = function (nodeType, parent, parentNode, inContent, insertInIndex) {
877
+ var _this = this;
878
+ if (inContent === void 0) { inContent = false; }
879
+ if (insertInIndex === void 0) { insertInIndex = 0; }
880
+ var _a;
881
+ var node;
882
+ var id = ++nodeUniqueId;
883
+ var isFieldNode = ((_a = nodeType.nodeType) === null || _a === void 0 ? void 0 : _a.field) != null;
884
+ if (isFieldNode) {
885
+ node = forms.createField({
886
+ id: id,
887
+ nodeType: forms.AjfNodeType.AjfField,
888
+ fieldType: nodeType.nodeType.field,
889
+ parent: parent.id,
890
+ parentNode: parentNode,
891
+ name: '',
892
+ });
893
+ }
894
+ else {
895
+ node = forms.createContainerNode({
896
+ id: id,
897
+ nodeType: nodeType.nodeType.node,
898
+ parent: 0,
899
+ parentNode: parentNode,
900
+ name: '',
901
+ nodes: [],
902
+ });
903
+ }
904
+ this._beforeNodesUpdate.emit();
905
+ this._nodesUpdates.next(function (nodes) {
906
+ var cn = forms.isContainerNode(parent) && inContent ?
907
+ parent :
908
+ getNodeContainer({ nodes: nodes }, parent);
909
+ if (!isFieldNode) {
910
+ var newNodes = nodes.slice(0);
911
+ newNodes.splice(insertInIndex, 0, node);
912
+ newNodes = _this._updateNodesList(0, newNodes);
913
+ return newNodes;
914
+ }
915
+ else {
916
+ var newNodes = cn.nodes.slice(0);
917
+ newNodes.splice(insertInIndex, 0, node);
918
+ newNodes = _this._updateNodesList(cn.id, newNodes);
919
+ cn.nodes = newNodes;
920
+ }
921
+ return nodes;
922
+ });
923
+ };
924
+ AjfFormBuilderService.prototype.saveNodeEntry = function (properties) {
925
+ this._saveNodeEntryEvent.emit(properties);
926
+ };
927
+ AjfFormBuilderService.prototype.cancelNodeEntryEdit = function () {
928
+ this._editedNodeEntry.next(null);
929
+ };
930
+ AjfFormBuilderService.prototype.deleteNodeEntry = function (nodeEntry) {
931
+ this._deleteNodeEntryEvent.next(nodeEntry);
932
+ };
933
+ /**
934
+ * Triggers the moveNode event when a node is moved in the formbuilder.
935
+ * @param nodeEntry The node to be moved.
936
+ */
937
+ AjfFormBuilderService.prototype.moveNodeEntry = function (nodeEntry, from, to) {
938
+ var moveEvent = { nodeEntry: nodeEntry, fromIndex: from, toIndex: to };
939
+ this._moveNodeEntryEvent.next(moveEvent);
940
+ };
941
+ AjfFormBuilderService.prototype.getCurrentForm = function () {
942
+ return rxjs.combineLatest([
943
+ this.form, this._nodesWithoutChoiceOrigins, this.attachmentsOrigins,
944
+ this.choicesOrigins, this.stringIdentifier
945
+ ])
946
+ .pipe(operators.filter(function (_b) {
947
+ var _c = __read(_b, 1), form = _c[0];
948
+ return form != null;
949
+ }), operators.map(function (_b) {
950
+ var _c = __read(_b, 5), form = _c[0], nodes = _c[1], attachmentsOrigins = _c[2], choicesOrigins = _c[3], stringIdentifier = _c[4];
951
+ return forms.createForm({
952
+ choicesOrigins: choicesOrigins.slice(0),
953
+ attachmentsOrigins: attachmentsOrigins.slice(0),
954
+ stringIdentifier: (stringIdentifier || []).slice(0),
955
+ nodes: nodes.slice(0),
956
+ supplementaryInformations: form.supplementaryInformations,
957
+ });
958
+ }));
959
+ };
960
+ AjfFormBuilderService.prototype.editChoicesOrigin = function (choicesOrigin) {
961
+ this._editedChoicesOrigin.next(choicesOrigin);
962
+ };
963
+ AjfFormBuilderService.prototype.createChoicesOrigin = function () {
964
+ this._editedChoicesOrigin.next(forms.createChoicesFixedOrigin({ name: '' }));
965
+ };
966
+ AjfFormBuilderService.prototype.cancelChoicesOriginEdit = function () {
967
+ this._editedChoicesOrigin.next(null);
968
+ };
969
+ AjfFormBuilderService.prototype.saveChoicesOrigin = function (params) {
970
+ var choicesOrigin = this._editedChoicesOrigin.getValue();
971
+ if (choicesOrigin != null) {
972
+ choicesOrigin.label = params.label;
973
+ choicesOrigin.name = params.name;
974
+ if (forms.isChoicesFixedOrigin(choicesOrigin)) {
975
+ choicesOrigin.choices = params.choices;
976
+ }
977
+ this._choicesOriginsUpdates.next(function (choicesOrigins) {
978
+ var idx = choicesOrigins.indexOf(choicesOrigin);
979
+ if (idx > -1) {
980
+ choicesOrigins = __spreadArray(__spreadArray(__spreadArray([], __read(choicesOrigins.slice(0, idx))), [
981
+ choicesOrigin
982
+ ]), __read(choicesOrigins.slice(idx + 1)));
983
+ }
984
+ else {
985
+ choicesOrigins = __spreadArray(__spreadArray([], __read(choicesOrigins)), [choicesOrigin]);
986
+ }
987
+ return choicesOrigins;
988
+ });
989
+ }
990
+ this._editedChoicesOrigin.next(null);
991
+ };
992
+ AjfFormBuilderService.prototype.saveStringIdentifier = function (identifier) {
993
+ this._stringIdentifierUpdates.next(function () { return __spreadArray([], __read(identifier)); });
994
+ };
995
+ AjfFormBuilderService.prototype._buildFormBuilderNodesTree = function (nodes) {
996
+ this._updateNodesList(0, nodes);
997
+ var rootNodes = nodes.filter(function (n) { return n.nodeType == forms.AjfNodeType.AjfSlide || n.nodeType == forms.AjfNodeType.AjfRepeatingSlide; });
998
+ if (rootNodes.length === 0) {
999
+ return [null];
1000
+ }
1001
+ var rootNode = rootNodes[0];
1002
+ if (forms.isSlidesNode(rootNode)) {
1003
+ var tree = [];
1004
+ tree.push({
1005
+ node: rootNode,
1006
+ container: null,
1007
+ children: buildFormBuilderNodesSubtree(nodes, rootNode),
1008
+ content: buildFormBuilderNodesContent(nodes, rootNode)
1009
+ });
1010
+ return tree;
1011
+ }
1012
+ throw new Error('Invalid form definition');
1013
+ };
1014
+ /**
1015
+ * Adds the id of a dropList to be connected with the FormBuilder source list.
1016
+ * @param listId The id of the list to connect.
1017
+ */
1018
+ AjfFormBuilderService.prototype._connectDropList = function (listId) {
1019
+ var connectedLists = this._connectedDropLists.value.slice(0);
1020
+ this._connectedDropLists.next(__spreadArray(__spreadArray([], __read(connectedLists)), [listId]));
1021
+ };
1022
+ AjfFormBuilderService.prototype._findMaxNodeId = function (nodes, _curMaxId) {
1023
+ var _this = this;
1024
+ if (_curMaxId === void 0) { _curMaxId = 0; }
1025
+ var maxId = 0;
1026
+ nodes.forEach(function (n) {
1027
+ maxId = Math.max(maxId, n.id);
1028
+ if (forms.isContainerNode(n)) {
1029
+ maxId = Math.max(maxId, _this._findMaxNodeId(n.nodes));
1030
+ }
1031
+ });
1032
+ return maxId;
1033
+ };
1034
+ AjfFormBuilderService.prototype._initFormStreams = function () {
1035
+ var _this = this;
1036
+ this._form.subscribe(function (form) {
1037
+ nodeUniqueId = 0;
1038
+ if (form != null && form.nodes != null && form.nodes.length > 0) {
1039
+ nodeUniqueId = _this._findMaxNodeId(form.nodes);
1040
+ }
1041
+ _this._nodesUpdates.next(function (_nodes) {
1042
+ return form != null && form.nodes != null ? form.nodes.slice(0) : [];
1043
+ });
1044
+ _this._attachmentsOriginsUpdates.next(function (_attachmentsOrigins) {
1045
+ return form != null && form.attachmentsOrigins != null ?
1046
+ form.attachmentsOrigins.slice(0) :
1047
+ [];
1048
+ });
1049
+ _this._choicesOriginsUpdates.next(function (_choicesOrigins) {
1050
+ return form != null && form.choicesOrigins != null ? form.choicesOrigins.slice(0) : [];
1051
+ });
1052
+ _this._stringIdentifierUpdates.next(function (_) {
1053
+ return form != null && form.stringIdentifier != null ? form.stringIdentifier.slice(0) :
1054
+ [];
1055
+ });
1056
+ });
1057
+ };
1058
+ AjfFormBuilderService.prototype._initChoicesOriginsStreams = function () {
1059
+ this._choicesOrigins =
1060
+ this._choicesOriginsUpdates
1061
+ .pipe(operators.scan(function (choicesOrigins, op) {
1062
+ return op(choicesOrigins);
1063
+ }, []), operators.publishReplay(1), operators.refCount());
1064
+ };
1065
+ AjfFormBuilderService.prototype._initAttachmentsOriginsStreams = function () {
1066
+ this._attachmentsOrigins = this._attachmentsOriginsUpdates.pipe(operators.scan(function (attachmentsOrigins, op) {
1067
+ return op(attachmentsOrigins);
1068
+ }, []), operators.publishReplay(1), operators.refCount());
1069
+ };
1070
+ AjfFormBuilderService.prototype._initStringIdentifierStreams = function () {
1071
+ this._stringIdentifier = this._stringIdentifierUpdates.pipe(operators.scan(function (stringIdentifier, op) {
1072
+ return op(stringIdentifier);
1073
+ }, []), operators.publishReplay(1), operators.refCount());
1074
+ };
1075
+ AjfFormBuilderService.prototype._initNodesStreams = function () {
1076
+ var _this = this;
1077
+ this._nodes = this._nodesUpdates
1078
+ .pipe(operators.scan(function (nodes, op) {
1079
+ return op(nodes);
1080
+ }, []), operators.publishReplay(1), operators.refCount());
1081
+ this._nodesWithoutChoiceOrigins =
1082
+ this._nodes.pipe(operators.map(function (slides) { return slides.map(function (slide) {
1083
+ slide.nodes = slide.nodes.map(function (node) {
1084
+ if (forms.isFieldWithChoices(node)) {
1085
+ var fwc = utils.deepCopy(node);
1086
+ if (fwc && fwc.choices) {
1087
+ delete fwc.choices;
1088
+ }
1089
+ if (fwc && fwc.choicesOrigin) {
1090
+ delete fwc.choicesOrigin;
1091
+ }
1092
+ return fwc;
1093
+ }
1094
+ return node;
1095
+ });
1096
+ return slide;
1097
+ }); }));
1098
+ this._flatNodes = this._nodes.pipe(operators.map(function (nodes) { return flattenNodes(nodes); }), operators.publishReplay(1), operators.refCount());
1099
+ this._flatFields = this._flatNodes.pipe(operators.map(function (nodes) { return nodes.filter(function (n) { return !forms.isContainerNode(n); }); }), operators.publishReplay(1), operators.refCount());
1100
+ this._nodeEntriesTree = this._nodes.pipe(operators.map(function (nodes) { return _this._buildFormBuilderNodesTree(nodes); }), operators.publishReplay(1), operators.refCount());
1101
+ };
1102
+ AjfFormBuilderService.prototype._initSaveNode = function () {
1103
+ var _this = this;
1104
+ this._saveNodeEntryEvent
1105
+ .pipe(operators.withLatestFrom(this.editedNodeEntry, this.choicesOrigins, this.attachmentsOrigins), operators.filter(function (_b) {
1106
+ var _c = __read(_b, 2), _ = _c[0], nodeEntry = _c[1];
1107
+ return nodeEntry != null;
1108
+ }), operators.map(function (_b) {
1109
+ var _c = __read(_b, 2), properties = _c[0], ne = _c[1];
1110
+ _this._beforeNodesUpdate.emit();
1111
+ var nodeEntry = ne;
1112
+ var origNode = nodeEntry.node;
1113
+ var node = utils.deepCopy(origNode);
1114
+ node.id = nodeEntry.node.id;
1115
+ node.name = properties.name;
1116
+ node.label = properties.label;
1117
+ node.visibility = properties.visibility != null ?
1118
+ models.createCondition({ condition: properties.visibility }) :
1119
+ null;
1120
+ var oldConditionalBranches = node.conditionalBranches.length;
1121
+ node.conditionalBranches = properties.conditionalBranches != null ?
1122
+ properties.conditionalBranches.map(function (condition) { return models.createCondition({ condition: condition }); }) :
1123
+ [models.alwaysCondition()];
1124
+ var newConditionalBranches = node.conditionalBranches.length;
1125
+ if (forms.isRepeatingContainerNode(node)) {
1126
+ var repNode = node;
1127
+ repNode.formulaReps = properties.formulaReps != null ?
1128
+ models.createFormula({ formula: properties.formulaReps }) :
1129
+ undefined;
1130
+ repNode.minReps = properties.minReps;
1131
+ repNode.maxReps = properties.maxReps;
1132
+ }
1133
+ if (forms.isField(node)) {
1134
+ var field = node;
1135
+ field.description = properties.description;
1136
+ field.defaultValue = properties.defaultValue;
1137
+ field.formula = properties.formula != null ?
1138
+ models.createFormula({ formula: properties.formula }) :
1139
+ undefined;
1140
+ var forceValue = properties.value;
1141
+ var notEmpty = properties.notEmpty;
1142
+ var validationConditions = properties.validationConditions;
1143
+ var minValue = parseInt(properties.minValue, 10);
1144
+ var maxValue = parseInt(properties.maxValue, 10);
1145
+ var minDigits = parseInt(properties.minDigits, 10);
1146
+ var maxDigits = parseInt(properties.maxDigits, 10);
1147
+ if (isNaN(minValue)) {
1148
+ minValue = null;
1149
+ }
1150
+ if (isNaN(maxValue)) {
1151
+ maxValue = null;
1152
+ }
1153
+ if (isNaN(minDigits)) {
1154
+ minDigits = null;
1155
+ }
1156
+ if (isNaN(maxDigits)) {
1157
+ maxDigits = null;
1158
+ }
1159
+ if (forceValue != null || notEmpty != null ||
1160
+ (validationConditions != null && validationConditions.length > 0) ||
1161
+ minValue != null || maxValue != null || minDigits != null ||
1162
+ maxDigits != null) {
1163
+ var validation = field.validation || forms.createValidationGroup({});
1164
+ validation.forceValue = forceValue;
1165
+ validation.notEmpty = notEmpty ? forms.notEmptyValidation() : undefined;
1166
+ validation.minValue = minValue != null ? forms.minValidation(minValue) : undefined;
1167
+ validation.maxValue = maxValue != null ? forms.maxValidation(maxValue) : undefined;
1168
+ validation.minDigits =
1169
+ minDigits != null ? forms.minDigitsValidation(minDigits) : undefined;
1170
+ validation.maxDigits =
1171
+ maxDigits != null ? forms.maxDigitsValidation(maxDigits) : undefined;
1172
+ validation.conditions =
1173
+ (validationConditions ||
1174
+ []).map(function (c) { return forms.createValidation({
1175
+ condition: c.condition,
1176
+ errorMessage: c.errorMessage
1177
+ }); });
1178
+ field.validation = validation;
1179
+ }
1180
+ else {
1181
+ field.validation = undefined;
1182
+ }
1183
+ var notEmptyWarn = properties.notEmptyWarning;
1184
+ var warningConditions = properties.warningConditions;
1185
+ if (notEmptyWarn != null ||
1186
+ (warningConditions != null && warningConditions.length > 0)) {
1187
+ var warning = field.warning || forms.createWarningGroup({});
1188
+ warning.notEmpty = notEmptyWarn ? forms.notEmptyWarning() : undefined;
1189
+ warning.conditions =
1190
+ (warningConditions ||
1191
+ []).map(function (w) { return forms.createWarning({
1192
+ condition: w.condition,
1193
+ warningMessage: w.warningMessage
1194
+ }); });
1195
+ field.warning = warning;
1196
+ }
1197
+ else {
1198
+ field.warning = undefined;
1199
+ }
1200
+ field.nextSlideCondition = properties.nextSlideCondition != null ?
1201
+ models.createCondition({ condition: properties.nextSlideCondition }) :
1202
+ undefined;
1203
+ field.size = properties.size;
1204
+ field.defaultValue = properties.defaultValue;
1205
+ if (forms.isFieldWithChoices(field)) {
1206
+ var fwc = field;
1207
+ fwc.choicesOriginRef = properties.choicesOriginRef;
1208
+ fwc.forceExpanded = properties.forceExpanded;
1209
+ fwc.forceNarrow = properties.forceNarrow;
1210
+ fwc.triggerConditions = (properties.triggerConditions ||
1211
+ []).map(function (t) { return models.createCondition({ condition: t }); });
1212
+ }
1213
+ }
1214
+ _this._editedNodeEntry.next(null);
1215
+ return function (nodes) {
1216
+ var cn = getNodeContainer({ nodes: nodes }, origNode);
1217
+ if (cn != null) {
1218
+ // TODO: @trik check this, was always true?
1219
+ // if (cn instanceof AjfNode) {
1220
+ var replaceNodes = cn.nodes === nodes;
1221
+ var idx = cn.nodes.indexOf(origNode);
1222
+ var newNodes = cn.nodes.slice(0, idx);
1223
+ newNodes.push(node);
1224
+ newNodes = newNodes.concat(cn.nodes.slice(idx + 1));
1225
+ cn.nodes = newNodes;
1226
+ if (replaceNodes) {
1227
+ nodes = newNodes;
1228
+ }
1229
+ else {
1230
+ nodes = nodes.slice(0);
1231
+ }
1232
+ // } else {
1233
+ // const idx = nodes.indexOf(origNode);
1234
+ // nodes = nodes.slice(0, idx).concat([node]).concat(nodes.slice(idx + 1));
1235
+ // }
1236
+ if (newConditionalBranches < oldConditionalBranches) {
1237
+ for (var i = newConditionalBranches; i < oldConditionalBranches; i++) {
1238
+ nodes = deleteNodeSubtree(nodes, node, i);
1239
+ }
1240
+ }
1241
+ }
1242
+ return nodes;
1243
+ };
1244
+ }))
1245
+ .subscribe(this._nodesUpdates);
1246
+ };
1247
+ AjfFormBuilderService.prototype._initDeleteNode = function () {
1248
+ var _this = this;
1249
+ this._deleteNodeEntryEvent
1250
+ .pipe(operators.map(function (nodeEntry) {
1251
+ _this._beforeNodesUpdate.emit();
1252
+ return function (nodes) {
1253
+ var node = nodeEntry.node;
1254
+ var cn = getNodeContainer({ nodes: nodes }, node);
1255
+ if (cn != null) {
1256
+ var replaceNodes = cn.nodes === nodes;
1257
+ var idx = cn.nodes.indexOf(node);
1258
+ var newNodes = cn.nodes.slice(0, idx);
1259
+ newNodes = newNodes.concat(cn.nodes.slice(idx + 1));
1260
+ cn.nodes = newNodes;
1261
+ if (replaceNodes) {
1262
+ nodes = newNodes;
1263
+ }
1264
+ else {
1265
+ nodes = nodes.slice(0);
1266
+ }
1267
+ }
1268
+ return nodes;
1269
+ };
1270
+ }))
1271
+ .subscribe(this._nodesUpdates);
1272
+ };
1273
+ /**
1274
+ * Initializes the subscription to the moveNodeEntryEvent.
1275
+ */
1276
+ AjfFormBuilderService.prototype._initMoveNode = function () {
1277
+ var _this = this;
1278
+ this._moveNodeSub.unsubscribe();
1279
+ this._moveNodeSub =
1280
+ this._moveNodeEntryEvent
1281
+ .pipe(operators.map(function (moveEvent) {
1282
+ _this._beforeNodesUpdate.emit();
1283
+ return function (nodes) {
1284
+ var nodeEntry = moveEvent.nodeEntry;
1285
+ var node = nodeEntry.node;
1286
+ var cn = getNodeContainer({ nodes: nodes }, node);
1287
+ var newNodes = nodes;
1288
+ if (cn != null) {
1289
+ var replaceNodes = cn.nodes === nodes;
1290
+ newNodes = cn.nodes;
1291
+ dragDrop.moveItemInArray(newNodes, moveEvent.fromIndex, moveEvent.toIndex);
1292
+ newNodes = _this._updateNodesList(cn.id, newNodes);
1293
+ cn.nodes = newNodes;
1294
+ if (replaceNodes) {
1295
+ nodes = newNodes;
1296
+ }
1297
+ else {
1298
+ nodes = nodes.slice(0);
1299
+ }
1300
+ }
1301
+ return nodes;
1302
+ };
1303
+ }))
1304
+ .subscribe(this._nodesUpdates);
1305
+ };
1306
+ /**
1307
+ * Updates the "id" and "parent" fields of a modified or rearranged list of nodes.
1308
+ * @param containerId The id of the parent container of the list.
1309
+ * @param nodesList The list of nodes to be updated.
1310
+ */
1311
+ AjfFormBuilderService.prototype._updateNodesList = function (containerId, nodesList) {
1312
+ if (!nodesList.length) {
1313
+ return [];
1314
+ }
1315
+ var contId = containerId != undefined ? containerId : 0;
1316
+ for (var idx = 0; idx < nodesList.length; idx++) {
1317
+ var currentNode = nodesList[idx];
1318
+ currentNode.id = (contId * 1000) + idx + 1;
1319
+ currentNode.parent = idx == 0 ? contId : (contId * 1000) + idx;
1320
+ if (currentNode.nodeType == forms.AjfNodeType.AjfSlide ||
1321
+ currentNode.nodeType == forms.AjfNodeType.AjfRepeatingSlide) {
1322
+ var currentSlide = currentNode;
1323
+ if (currentSlide.nodes) {
1324
+ this._updateNodesList(currentSlide.id, currentSlide.nodes);
1325
+ }
1326
+ }
1327
+ }
1328
+ return nodesList;
1329
+ };
1330
+ return AjfFormBuilderService;
1331
+ }());
1332
+ AjfFormBuilderService.decorators = [
1333
+ { type: core.Injectable }
1334
+ ];
1335
+ AjfFormBuilderService.ctorParameters = function () { return []; };
1336
+
1337
+ /**
1338
+ * @license
1339
+ * Copyright (C) Gnucoop soc. coop.
1340
+ *
1341
+ * This file is part of the Advanced JSON forms (ajf).
1342
+ *
1343
+ * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
1344
+ * modify it under the terms of the GNU Affero General Public License as
1345
+ * published by the Free Software Foundation, either version 3 of the License,
1346
+ * or (at your option) any later version.
1347
+ *
1348
+ * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
1349
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1350
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
1351
+ * General Public License for more details.
1352
+ *
1353
+ * You should have received a copy of the GNU Affero General Public License
1354
+ * along with Advanced JSON forms (ajf).
1355
+ * If not, see http://www.gnu.org/licenses/.
1356
+ *
1357
+ */
1358
+ var AjfFbChoicesOriginEditorDialog = /** @class */ (function () {
1359
+ function AjfFbChoicesOriginEditorDialog(_service) {
1360
+ this._service = _service;
1361
+ this._choicesOrigin =
1362
+ this._service.editedChoicesOrigin.pipe(operators.filter(function (c) { return c != null; }), operators.map(function (c) { return c; }));
1363
+ }
1364
+ Object.defineProperty(AjfFbChoicesOriginEditorDialog.prototype, "choicesOrigin", {
1365
+ get: function () {
1366
+ return this._choicesOrigin;
1367
+ },
1368
+ enumerable: false,
1369
+ configurable: true
1370
+ });
1371
+ AjfFbChoicesOriginEditorDialog.prototype.saveChoicesOrigin = function () {
1372
+ this._service.saveChoicesOrigin({ label: this.editor.label, name: this.editor.name, choices: this.editor.choicesArr });
1373
+ };
1374
+ AjfFbChoicesOriginEditorDialog.prototype.cancelChoicesOriginEdit = function () {
1375
+ this._service.cancelChoicesOriginEdit();
1376
+ };
1377
+ return AjfFbChoicesOriginEditorDialog;
1378
+ }());
1379
+ AjfFbChoicesOriginEditorDialog.decorators = [
1380
+ { type: core.Component, args: [{
1381
+ selector: 'ajf-fb-choices-origin-editor-dialog',
1382
+ 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",
1383
+ encapsulation: core.ViewEncapsulation.None,
1384
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
1385
+ styles: ["\n"]
1386
+ },] }
1387
+ ];
1388
+ AjfFbChoicesOriginEditorDialog.ctorParameters = function () { return [
1389
+ { type: AjfFormBuilderService }
1390
+ ]; };
1391
+ AjfFbChoicesOriginEditorDialog.propDecorators = {
1392
+ editor: [{ type: core.ViewChild, args: [AjfFbChoicesOriginEditor, { static: false },] }]
1393
+ };
1394
+
1395
+ /**
1396
+ * @license
1397
+ * Copyright (C) Gnucoop soc. coop.
1398
+ *
1399
+ * This file is part of the Advanced JSON forms (ajf).
1400
+ *
1401
+ * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
1402
+ * modify it under the terms of the GNU Affero General Public License as
1403
+ * published by the Free Software Foundation, either version 3 of the License,
1404
+ * or (at your option) any later version.
1405
+ *
1406
+ * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
1407
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1408
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
1409
+ * General Public License for more details.
1410
+ *
1411
+ * You should have received a copy of the GNU Affero General Public License
1412
+ * along with Advanced JSON forms (ajf).
1413
+ * If not, see http://www.gnu.org/licenses/.
1414
+ *
1415
+ */
1416
+ var AjfFbConditionEditor = /** @class */ (function () {
1417
+ function AjfFbConditionEditor(_) {
1418
+ }
1419
+ Object.defineProperty(AjfFbConditionEditor.prototype, "fields", {
1420
+ get: function () {
1421
+ return this._fields;
1422
+ },
1423
+ set: function (fields) {
1424
+ this._fields = fields;
1425
+ this._updateVariables();
1426
+ },
1427
+ enumerable: false,
1428
+ configurable: true
1429
+ });
1430
+ AjfFbConditionEditor.prototype.insertVariable = function (variable) {
1431
+ if (this.monacoEditor != null && this.monacoEditor.editor != null) {
1432
+ var editor = this.monacoEditor.editor;
1433
+ var value = editor.getValue().split('\n');
1434
+ var position = editor.getPosition();
1435
+ var ln = position.lineNumber - 1;
1436
+ var line = value[ln];
1437
+ var col = position.column - 1;
1438
+ line = line.substring(0, col) + variable + line.substring(col);
1439
+ value[ln] = line;
1440
+ position.column += variable.length;
1441
+ this.monacoEditor.value = value.join('\n');
1442
+ editor.setPosition(position);
1443
+ editor.focus();
1444
+ this.editedValue = editor.getValue();
1445
+ }
1446
+ };
1447
+ AjfFbConditionEditor.prototype.onEditorInit = function () {
1448
+ monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({ noSemanticValidation: false, noSyntaxValidation: false });
1449
+ monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
1450
+ target: monaco.languages.typescript.ScriptTarget.ES2015,
1451
+ allowNonTsExtensions: true,
1452
+ allowJs: true,
1453
+ module: monaco.languages.typescript.ModuleKind.None
1454
+ });
1455
+ try {
1456
+ monaco.languages.typescript.javascriptDefaults.addExtraLib('', 'condition-editor-variables.d.ts');
1457
+ }
1458
+ catch (e) {
1459
+ monaco.languages.typescript.javascriptDefaults._extraLibs['condition-editor-variables.d.ts'] =
1460
+ '';
1461
+ }
1462
+ try {
1463
+ monaco.languages.typescript.javascriptDefaults.addExtraLib('', 'condition-editor-functions.d.ts');
1464
+ }
1465
+ catch (e) {
1466
+ monaco.languages.typescript.javascriptDefaults._extraLibs['condition-editor-functions.d.ts'] =
1467
+ '';
1468
+ }
1469
+ this._updateVariables();
1470
+ this._updateFunctions();
1471
+ };
1472
+ AjfFbConditionEditor.prototype._updateVariables = function () {
1473
+ var _this = this;
1474
+ if (this._fields == null) {
1475
+ return;
1476
+ }
1477
+ try {
1478
+ monaco.languages.typescript.javascriptDefaults._extraLibs['condition-editor-variables.d.ts'] =
1479
+ this._fields
1480
+ .map(function (field) {
1481
+ return "declare const " + field.name + ": " + _this._fieldVarType(field.fieldType) + ";";
1482
+ })
1483
+ .join('\n');
1484
+ }
1485
+ catch (e) {
1486
+ }
1487
+ };
1488
+ AjfFbConditionEditor.prototype._updateFunctions = function () {
1489
+ try {
1490
+ monaco.languages.typescript.javascriptDefaults._extraLibs['condition-editor-functions.d.ts'] =
1491
+ models.AjfExpressionUtils.UTIL_FUNCTIONS;
1492
+ }
1493
+ catch (e) {
1494
+ }
1495
+ };
1496
+ AjfFbConditionEditor.prototype._fieldVarType = function (fieldType) {
1497
+ switch (fieldType) {
1498
+ case forms.AjfFieldType.Boolean:
1499
+ return 'boolean';
1500
+ case forms.AjfFieldType.Date:
1501
+ case forms.AjfFieldType.DateInput:
1502
+ case forms.AjfFieldType.Time:
1503
+ return 'Date';
1504
+ case forms.AjfFieldType.Empty:
1505
+ return 'void';
1506
+ case forms.AjfFieldType.Formula:
1507
+ return 'number';
1508
+ case forms.AjfFieldType.MultipleChoice:
1509
+ case forms.AjfFieldType.SingleChoice:
1510
+ return 'any';
1511
+ case forms.AjfFieldType.Number:
1512
+ return 'number';
1513
+ case forms.AjfFieldType.Table:
1514
+ return 'Array';
1515
+ case forms.AjfFieldType.String:
1516
+ case forms.AjfFieldType.Text:
1517
+ return 'string';
1518
+ }
1519
+ return null;
1520
+ };
1521
+ return AjfFbConditionEditor;
1522
+ }());
1523
+ AjfFbConditionEditor.decorators = [
1524
+ { type: core.Component, args: [{
1525
+ selector: 'ajf-condition-editor',
1526
+ 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",
1527
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
1528
+ encapsulation: core.ViewEncapsulation.None,
1529
+ 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"]
1530
+ },] }
1531
+ ];
1532
+ AjfFbConditionEditor.ctorParameters = function () { return [
1533
+ { type: forms.AjfValidationService }
1534
+ ]; };
1535
+ AjfFbConditionEditor.propDecorators = {
1536
+ monacoEditor: [{ type: core.ViewChild, args: [monacoEditor.AjfMonacoEditor, { static: true },] }],
1537
+ fields: [{ type: core.Input }],
1538
+ condition: [{ type: core.Input }]
1539
+ };
1540
+
1541
+ /**
1542
+ * @license
1543
+ * Copyright (C) Gnucoop soc. coop.
1544
+ *
1545
+ * This file is part of the Advanced JSON forms (ajf).
1546
+ *
1547
+ * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
1548
+ * modify it under the terms of the GNU Affero General Public License as
1549
+ * published by the Free Software Foundation, either version 3 of the License,
1550
+ * or (at your option) any later version.
1551
+ *
1552
+ * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
1553
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1554
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
1555
+ * General Public License for more details.
1556
+ *
1557
+ * You should have received a copy of the GNU Affero General Public License
1558
+ * along with Advanced JSON forms (ajf).
1559
+ * If not, see http://www.gnu.org/licenses/.
1560
+ *
1561
+ */
1562
+ var AjfFbConditionEditorDialog = /** @class */ (function () {
1563
+ function AjfFbConditionEditorDialog(service, dialogRef) {
1564
+ this.dialogRef = dialogRef;
1565
+ this._fields = service.flatFields.pipe(operators.map(function (fields) { return fields.sort(function (f1, f2) { return f1.name.localeCompare(f2.name); }); }));
1566
+ }
1567
+ Object.defineProperty(AjfFbConditionEditorDialog.prototype, "fields", {
1568
+ get: function () {
1569
+ return this._fields;
1570
+ },
1571
+ enumerable: false,
1572
+ configurable: true
1573
+ });
1574
+ AjfFbConditionEditorDialog.prototype.saveCondition = function () {
1575
+ if (this.editor == null) {
1576
+ return;
1577
+ }
1578
+ var newValue = this.editor.editedValue;
1579
+ this.dialogRef.close(newValue);
1580
+ };
1581
+ return AjfFbConditionEditorDialog;
1582
+ }());
1583
+ AjfFbConditionEditorDialog.decorators = [
1584
+ { type: core.Component, args: [{
1585
+ selector: 'ajf-condition-editor-dialog',
1586
+ 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",
1587
+ encapsulation: core.ViewEncapsulation.None,
1588
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
1589
+ styles: ["ajf-condition-editor-dialog mat-dialog-content{overflow:visible}\n"]
1590
+ },] }
1591
+ ];
1592
+ AjfFbConditionEditorDialog.ctorParameters = function () { return [
1593
+ { type: AjfFormBuilderService },
1594
+ { type: dialog.MatDialogRef }
1595
+ ]; };
1596
+ AjfFbConditionEditorDialog.propDecorators = {
1597
+ editor: [{ type: core.ViewChild, args: [AjfFbConditionEditor, { static: false },] }]
1598
+ };
1599
+
1600
+ /**
1601
+ * @license
1602
+ * Copyright (C) Gnucoop soc. coop.
1603
+ *
1604
+ * This file is part of the Advanced JSON forms (ajf).
1605
+ *
1606
+ * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
1607
+ * modify it under the terms of the GNU Affero General Public License as
1608
+ * published by the Free Software Foundation, either version 3 of the License,
1609
+ * or (at your option) any later version.
1610
+ *
1611
+ * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
1612
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1613
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
1614
+ * General Public License for more details.
1615
+ *
1616
+ * You should have received a copy of the GNU Affero General Public License
1617
+ * along with Advanced JSON forms (ajf).
1618
+ * If not, see http://www.gnu.org/licenses/.
1619
+ *
1620
+ */
1621
+ /**
1622
+ * Triggers when a field or slide node is moved or inserted by drag&dropping in the formbuilder.
1623
+ * @param event The drop event.
1624
+ * @param fbService The AjfFormBuilderService.
1625
+ * @param nodeEntry The current nodeEntry, if present.
1626
+ * @param content True if the current nodeEntry contains other nodeEntries.
1627
+ */
1628
+ function onDropProcess(event, fbService, nodeEntry, content) {
1629
+ if (content === void 0) { content = false; }
1630
+ var itemData = event.item.data;
1631
+ var containerId = event.container.id;
1632
+ if (!itemData.node) {
1633
+ if (nodeEntry == null && containerId === 'slides-list') {
1634
+ fbService.insertNode(itemData, null, 0, content, event.currentIndex);
1635
+ return;
1636
+ }
1637
+ var emptySlot = content ? { parent: nodeEntry.node, parentNode: 0 } :
1638
+ nodeEntry;
1639
+ fbService.insertNode(itemData, emptySlot.parent, emptySlot.parentNode, content, event.currentIndex);
1640
+ return;
1641
+ }
1642
+ var previousIndex = event.previousIndex;
1643
+ var currentIndex = event.currentIndex;
1644
+ fbService.moveNodeEntry(event.item.data, previousIndex, currentIndex);
1645
+ }
1646
+ /**
1647
+ * Disables the drag&drop of Slide items.
1648
+ * @param item The dragged item.
1649
+ */
1650
+ function disableSlideDropPredicate(item) {
1651
+ return !item.data.isSlide;
1652
+ }
1653
+ /**
1654
+ * Disables the drag&drop of Field items.
1655
+ * @param item The dragged item.
1656
+ */
1657
+ function disableFieldDropPredicate(item) {
1658
+ if (!item.data.isSlide) {
1659
+ return false;
1660
+ }
1661
+ return true;
1662
+ }
1663
+
1664
+ var AjfFbStringIdentifierDialogComponent = /** @class */ (function () {
1665
+ function AjfFbStringIdentifierDialogComponent(_service, _cdr) {
1666
+ var _this = this;
1667
+ this._service = _service;
1668
+ this._cdr = _cdr;
1669
+ this.dataSource = new table.MatTableDataSource();
1670
+ this.displayedColumns = ['label', 'value', 'show', 'delete'];
1671
+ this.separatorKeysCodes = [keycodes.ENTER, keycodes.COMMA];
1672
+ this._stringIdentifierSub = rxjs.Subscription.EMPTY;
1673
+ this._stringIdentifierSub = _service.stringIdentifier.subscribe(function (identifier) {
1674
+ _this.dataSource.data = __spreadArray([], __read(identifier));
1675
+ });
1676
+ this.fields$ = _service.flatFields.pipe(operators.map(function (fields) { return fields.sort(function (f1, f2) { return f1.name.localeCompare(f2.name); })
1677
+ .map(function (f) { return f.name; })
1678
+ .filter(function (f) { return f.length > 0; }); }), operators.shareReplay(1));
1679
+ }
1680
+ AjfFbStringIdentifierDialogComponent.prototype.addRow = function () {
1681
+ this.dataSource.data = __spreadArray(__spreadArray([], __read(this.dataSource.data)), [{ label: '', value: [], show: undefined }]);
1682
+ };
1683
+ AjfFbStringIdentifierDialogComponent.prototype.deleteRow = function (rowIdx) {
1684
+ this.dataSource.data = __spreadArray(__spreadArray([], __read(this.dataSource.data.slice(0, rowIdx))), __read(this.dataSource.data.slice(rowIdx + 1)));
1685
+ };
1686
+ AjfFbStringIdentifierDialogComponent.prototype.addValue = function (row, evt, valueInput) {
1687
+ if (evt.value.length === 0) {
1688
+ return;
1689
+ }
1690
+ row.value = __spreadArray(__spreadArray([], __read(row.value)), [evt.value]);
1691
+ valueInput.value = '';
1692
+ this._cdr.markForCheck();
1693
+ };
1694
+ AjfFbStringIdentifierDialogComponent.prototype.removeValue = function (row, value) {
1695
+ var idx = row.value.indexOf(value);
1696
+ if (idx > -1) {
1697
+ row.value = __spreadArray(__spreadArray([], __read(row.value.slice(0, idx))), __read(row.value.slice(idx + 1)));
1698
+ this._cdr.markForCheck();
1699
+ }
1700
+ };
1701
+ AjfFbStringIdentifierDialogComponent.prototype.ngOnDestroy = function () {
1702
+ this._stringIdentifierSub.unsubscribe();
1703
+ };
1704
+ AjfFbStringIdentifierDialogComponent.prototype.saveStringIdentifier = function () {
1705
+ this._service.saveStringIdentifier(this.dataSource.data);
1706
+ };
1707
+ AjfFbStringIdentifierDialogComponent.prototype.selected = function (row, evt) {
1708
+ row.value = __spreadArray(__spreadArray([], __read(row.value)), [evt.option.value]);
1709
+ this._cdr.markForCheck();
1710
+ };
1711
+ return AjfFbStringIdentifierDialogComponent;
1712
+ }());
1713
+ AjfFbStringIdentifierDialogComponent.decorators = [
1714
+ { type: core.Component, args: [{
1715
+ selector: 'ajf-fb-string-identifier-dialog',
1716
+ 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",
1717
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
1718
+ encapsulation: core.ViewEncapsulation.None,
1719
+ styles: ["\n"]
1720
+ },] }
1721
+ ];
1722
+ AjfFbStringIdentifierDialogComponent.ctorParameters = function () { return [
1723
+ { type: AjfFormBuilderService },
1724
+ { type: core.ChangeDetectorRef }
1725
+ ]; };
1726
+
1727
+ /**
1728
+ * @license
1729
+ * Copyright (C) Gnucoop soc. coop.
1730
+ *
1731
+ * This file is part of the Advanced JSON forms (ajf).
1732
+ *
1733
+ * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
1734
+ * modify it under the terms of the GNU Affero General Public License as
1735
+ * published by the Free Software Foundation, either version 3 of the License,
1736
+ * or (at your option) any later version.
1737
+ *
1738
+ * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
1739
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1740
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
1741
+ * General Public License for more details.
1742
+ *
1743
+ * You should have received a copy of the GNU Affero General Public License
1744
+ * along with Advanced JSON forms (ajf).
1745
+ * If not, see http://www.gnu.org/licenses/.
1746
+ *
1747
+ */
1748
+ var AjfFormBuilder = /** @class */ (function () {
1749
+ function AjfFormBuilder(_service, _dialog) {
1750
+ var _this = this;
1751
+ this._service = _service;
1752
+ this._dialog = _dialog;
1753
+ this._globalExpanded = false;
1754
+ /**
1755
+ * The list of the ids of all the dropLists connected to the formbuilder source list.
1756
+ */
1757
+ this._connectedDropLists = this._service.connectedDropLists;
1758
+ this._vc = new core.EventEmitter();
1759
+ this._init = false;
1760
+ this._editConditionSub = rxjs.Subscription.EMPTY;
1761
+ this._beforeNodesUpdateSub = rxjs.Subscription.EMPTY;
1762
+ this._editChoicesOriginSub = rxjs.Subscription.EMPTY;
1763
+ this._stringIdentifierSub = rxjs.Subscription.EMPTY;
1764
+ this._nodeTypes = _service.availableNodeTypes;
1765
+ this._nodeEntriesTree = _service.nodeEntriesTree;
1766
+ this._choicesOrigins = _service.choicesOrigins;
1767
+ this._editConditionSub =
1768
+ this._service.editedCondition.subscribe(function (condition) {
1769
+ if (_this._editConditionDialog != null) {
1770
+ _this._editConditionDialog.close();
1771
+ _this._editConditionDialog = null;
1772
+ }
1773
+ if (condition != null) {
1774
+ _this._editConditionDialog =
1775
+ _this._dialog.open(AjfFbConditionEditorDialog, { disableClose: true });
1776
+ }
1777
+ });
1778
+ this._editChoicesOriginSub =
1779
+ this._service.editedChoicesOrigin.subscribe(function (choicesOrigin) {
1780
+ if (_this._editChoicesOriginDialog != null) {
1781
+ _this._editChoicesOriginDialog.close();
1782
+ _this._editChoicesOriginDialog = null;
1783
+ }
1784
+ if (choicesOrigin != null) {
1785
+ _this._editChoicesOriginDialog =
1786
+ _this._dialog.open(AjfFbChoicesOriginEditorDialog, { disableClose: true });
1787
+ }
1788
+ });
1789
+ this._beforeNodesUpdateSub = this._service.beforeNodesUpdate.subscribe(function () {
1790
+ if (_this.designerCont == null) {
1791
+ return;
1792
+ }
1793
+ _this._lastScrollTop = _this.designerCont.nativeElement.scrollTop;
1794
+ });
1795
+ this.nodeEntriesTree.pipe(operators.sample(this._vc)).subscribe(function () {
1796
+ if (_this.designerCont == null) {
1797
+ return;
1798
+ }
1799
+ _this.designerCont.nativeElement.scrollTop = _this._lastScrollTop;
1800
+ });
1801
+ this._stringIdentifierSub = this._service.stringIdentifier.subscribe(function () { });
1802
+ }
1803
+ Object.defineProperty(AjfFormBuilder.prototype, "form", {
1804
+ get: function () {
1805
+ return this._form;
1806
+ },
1807
+ set: function (form) {
1808
+ if (this._form !== form) {
1809
+ this._form = form;
1810
+ if (this._init) {
1811
+ this._setCurrentForm();
1812
+ }
1813
+ }
1814
+ },
1815
+ enumerable: false,
1816
+ configurable: true
1817
+ });
1818
+ Object.defineProperty(AjfFormBuilder.prototype, "nodeTypes", {
1819
+ get: function () {
1820
+ return this._nodeTypes;
1821
+ },
1822
+ enumerable: false,
1823
+ configurable: true
1824
+ });
1825
+ Object.defineProperty(AjfFormBuilder.prototype, "nodeEntriesTree", {
1826
+ get: function () {
1827
+ return this._nodeEntriesTree;
1828
+ },
1829
+ enumerable: false,
1830
+ configurable: true
1831
+ });
1832
+ Object.defineProperty(AjfFormBuilder.prototype, "choicesOrigins", {
1833
+ get: function () {
1834
+ return this._choicesOrigins;
1835
+ },
1836
+ enumerable: false,
1837
+ configurable: true
1838
+ });
1839
+ Object.defineProperty(AjfFormBuilder.prototype, "isGlobalExpanded", {
1840
+ get: function () {
1841
+ return this._globalExpanded;
1842
+ },
1843
+ enumerable: false,
1844
+ configurable: true
1845
+ });
1846
+ Object.defineProperty(AjfFormBuilder.prototype, "connectedDropLists", {
1847
+ get: function () {
1848
+ return this._connectedDropLists;
1849
+ },
1850
+ enumerable: false,
1851
+ configurable: true
1852
+ });
1853
+ AjfFormBuilder.prototype.ngAfterViewChecked = function () {
1854
+ this._vc.emit();
1855
+ };
1856
+ AjfFormBuilder.prototype.ngAfterContentInit = function () {
1857
+ this._setCurrentForm();
1858
+ this._init = true;
1859
+ };
1860
+ AjfFormBuilder.prototype.ngOnDestroy = function () {
1861
+ this._editConditionSub.unsubscribe();
1862
+ this._beforeNodesUpdateSub.unsubscribe();
1863
+ this._editChoicesOriginSub.unsubscribe();
1864
+ this._stringIdentifierSub.unsubscribe();
1865
+ this._service.setForm(null);
1866
+ };
1867
+ AjfFormBuilder.prototype.createChoicesOrigin = function () {
1868
+ this._service.createChoicesOrigin();
1869
+ };
1870
+ AjfFormBuilder.prototype.disableDrop = function () {
1871
+ return false;
1872
+ };
1873
+ AjfFormBuilder.prototype.disableFieldDrop = function (item) {
1874
+ return disableFieldDropPredicate(item);
1875
+ };
1876
+ /**
1877
+ * Triggers when a field or slide node is moved or inserted by drag&dropping in the formbuilder.
1878
+ * @param event The drop event.
1879
+ * @param content True if the current nodeEntry contains other nodeEntries.
1880
+ */
1881
+ AjfFormBuilder.prototype.onDrop = function (event, content) {
1882
+ if (content === void 0) { content = false; }
1883
+ onDropProcess(event, this._service, null, content);
1884
+ };
1885
+ AjfFormBuilder.prototype.editChoicesOrigin = function (choicesOrigin) {
1886
+ this._service.editChoicesOrigin(choicesOrigin);
1887
+ };
1888
+ AjfFormBuilder.prototype.editStringIdentifier = function () {
1889
+ if (this._stringIdentifierDialog != null) {
1890
+ this._stringIdentifierDialog.close();
1891
+ this._stringIdentifierDialog = null;
1892
+ }
1893
+ this._stringIdentifierDialog = this._dialog.open(AjfFbStringIdentifierDialogComponent, { disableClose: true, width: '60%', height: '60%' });
1894
+ };
1895
+ AjfFormBuilder.prototype.expandAll = function () {
1896
+ this._globalExpanded = true;
1897
+ };
1898
+ AjfFormBuilder.prototype.collapseAll = function () {
1899
+ this._globalExpanded = false;
1900
+ };
1901
+ AjfFormBuilder.prototype.expandToggle = function (evt) {
1902
+ if (evt.checked) {
1903
+ this.expandAll();
1904
+ }
1905
+ else {
1906
+ this.collapseAll();
1907
+ }
1908
+ };
1909
+ AjfFormBuilder.prototype._setCurrentForm = function () {
1910
+ this._service.setForm(this._form);
1911
+ };
1912
+ return AjfFormBuilder;
1913
+ }());
1914
+ AjfFormBuilder.decorators = [
1915
+ { type: core.Component, args: [{
1916
+ selector: 'ajf-form-builder',
1917
+ 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",
1918
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
1919
+ encapsulation: core.ViewEncapsulation.None,
1920
+ 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"]
1921
+ },] }
1922
+ ];
1923
+ AjfFormBuilder.ctorParameters = function () { return [
1924
+ { type: AjfFormBuilderService },
1925
+ { type: dialog.MatDialog }
1926
+ ]; };
1927
+ AjfFormBuilder.propDecorators = {
1928
+ designerCont: [{ type: core.ViewChild, args: ['designer', { static: true },] }],
1929
+ form: [{ type: core.Input }]
1930
+ };
1931
+
1932
+ /**
1933
+ * @license
1934
+ * Copyright (C) Gnucoop soc. coop.
1935
+ *
1936
+ * This file is part of the Advanced JSON forms (ajf).
1937
+ *
1938
+ * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
1939
+ * modify it under the terms of the GNU Affero General Public License as
1940
+ * published by the Free Software Foundation, either version 3 of the License,
1941
+ * or (at your option) any later version.
1942
+ *
1943
+ * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
1944
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1945
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
1946
+ * General Public License for more details.
1947
+ *
1948
+ * You should have received a copy of the GNU Affero General Public License
1949
+ * along with Advanced JSON forms (ajf).
1950
+ * If not, see http://www.gnu.org/licenses/.
1951
+ *
1952
+ */
1953
+ var branchColors = [
1954
+ '#F44336',
1955
+ '#4CAF50',
1956
+ '#3F51B5',
1957
+ '#FFC107',
1958
+ '#795548', // BROWN
1959
+ ];
1960
+ var AjfFbNodeEntry = /** @class */ (function () {
1961
+ function AjfFbNodeEntry(_service) {
1962
+ this._service = _service;
1963
+ this._hasContent = false;
1964
+ this._isFirst = false;
1965
+ this._isNodeEntry = false;
1966
+ this._isExpanded = false;
1967
+ this._level = 0;
1968
+ this._isDraggable = true;
1969
+ this._branchColors = branchColors.slice(0);
1970
+ this._dropZones = ['fbdz-node'];
1971
+ this._slideDropZones = ['fbdz-slide'];
1972
+ this._originOffset = 0;
1973
+ this._originLeftMargin = '0';
1974
+ this._firstBranchColor = branchColors[0];
1975
+ this._branchLinesSubscription = rxjs.Subscription.EMPTY;
1976
+ this._childEntriesSubscription = rxjs.Subscription.EMPTY;
1977
+ this._currentEditedNode = this._service.editedNodeEntry;
1978
+ }
1979
+ Object.defineProperty(AjfFbNodeEntry.prototype, "hasContent", {
1980
+ get: function () {
1981
+ return this._hasContent;
1982
+ },
1983
+ enumerable: false,
1984
+ configurable: true
1985
+ });
1986
+ Object.defineProperty(AjfFbNodeEntry.prototype, "isFirst", {
1987
+ get: function () {
1988
+ return this._isFirst;
1989
+ },
1990
+ set: function (isFirst) {
1991
+ this._isFirst = isFirst;
1992
+ },
1993
+ enumerable: false,
1994
+ configurable: true
1995
+ });
1996
+ Object.defineProperty(AjfFbNodeEntry.prototype, "isNodeEntry", {
1997
+ get: function () {
1998
+ return this._isNodeEntry;
1999
+ },
2000
+ enumerable: false,
2001
+ configurable: true
2002
+ });
2003
+ Object.defineProperty(AjfFbNodeEntry.prototype, "isExpanded", {
2004
+ get: function () {
2005
+ return this._isExpanded;
2006
+ },
2007
+ set: function (exp) {
2008
+ var _this = this;
2009
+ this._isExpanded = exp;
2010
+ setTimeout(function () { return _this._updateBranchHeights(); }, 400);
2011
+ },
2012
+ enumerable: false,
2013
+ configurable: true
2014
+ });
2015
+ Object.defineProperty(AjfFbNodeEntry.prototype, "nodeEntry", {
2016
+ get: function () {
2017
+ return this._nodeEntry;
2018
+ },
2019
+ set: function (nodeEntry) {
2020
+ this._nodeEntry = nodeEntry;
2021
+ if (nodeEntry != null && nodeEntry.node !== void 0) {
2022
+ var ne = nodeEntry;
2023
+ this._isNodeEntry = true;
2024
+ var node = ne.node;
2025
+ this._hasContent = node != null && forms.isContainerNode(node);
2026
+ }
2027
+ else {
2028
+ this._isNodeEntry = false;
2029
+ this._hasContent = false;
2030
+ }
2031
+ },
2032
+ enumerable: false,
2033
+ configurable: true
2034
+ });
2035
+ Object.defineProperty(AjfFbNodeEntry.prototype, "level", {
2036
+ get: function () {
2037
+ return this._level;
2038
+ },
2039
+ set: function (value) {
2040
+ this._level = value;
2041
+ },
2042
+ enumerable: false,
2043
+ configurable: true
2044
+ });
2045
+ Object.defineProperty(AjfFbNodeEntry.prototype, "isDraggable", {
2046
+ get: function () {
2047
+ return this._isDraggable;
2048
+ },
2049
+ set: function (draggable) {
2050
+ this._isDraggable = draggable;
2051
+ },
2052
+ enumerable: false,
2053
+ configurable: true
2054
+ });
2055
+ Object.defineProperty(AjfFbNodeEntry.prototype, "realNodeEntry", {
2056
+ get: function () {
2057
+ return this._nodeEntry;
2058
+ },
2059
+ enumerable: false,
2060
+ configurable: true
2061
+ });
2062
+ Object.defineProperty(AjfFbNodeEntry.prototype, "branchColors", {
2063
+ get: function () {
2064
+ return this._branchColors;
2065
+ },
2066
+ enumerable: false,
2067
+ configurable: true
2068
+ });
2069
+ Object.defineProperty(AjfFbNodeEntry.prototype, "dropZones", {
2070
+ get: function () {
2071
+ return this._dropZones;
2072
+ },
2073
+ enumerable: false,
2074
+ configurable: true
2075
+ });
2076
+ Object.defineProperty(AjfFbNodeEntry.prototype, "slideDropZones", {
2077
+ get: function () {
2078
+ return this._slideDropZones;
2079
+ },
2080
+ enumerable: false,
2081
+ configurable: true
2082
+ });
2083
+ Object.defineProperty(AjfFbNodeEntry.prototype, "originOffset", {
2084
+ get: function () {
2085
+ return this._originOffset;
2086
+ },
2087
+ set: function (originOffset) {
2088
+ this._originOffset = originOffset;
2089
+ this._originLeftMargin = this._originOffset * 4 + "px";
2090
+ },
2091
+ enumerable: false,
2092
+ configurable: true
2093
+ });
2094
+ Object.defineProperty(AjfFbNodeEntry.prototype, "originLeftMargin", {
2095
+ get: function () {
2096
+ return this._originLeftMargin;
2097
+ },
2098
+ enumerable: false,
2099
+ configurable: true
2100
+ });
2101
+ Object.defineProperty(AjfFbNodeEntry.prototype, "firstBranchColor", {
2102
+ get: function () {
2103
+ return this._firstBranchColor;
2104
+ },
2105
+ set: function (firstBranchColor) {
2106
+ var idx = branchColors.indexOf(firstBranchColor);
2107
+ if (idx > 0) {
2108
+ this._firstBranchColor = firstBranchColor;
2109
+ this._branchColors = branchColors.slice(idx).concat(branchColors.slice(0, idx));
2110
+ }
2111
+ else {
2112
+ this._firstBranchColor = branchColors[0];
2113
+ this._branchColors = branchColors.slice(0);
2114
+ }
2115
+ },
2116
+ enumerable: false,
2117
+ configurable: true
2118
+ });
2119
+ Object.defineProperty(AjfFbNodeEntry.prototype, "currentEditedNode", {
2120
+ get: function () {
2121
+ return this._currentEditedNode;
2122
+ },
2123
+ enumerable: false,
2124
+ configurable: true
2125
+ });
2126
+ AjfFbNodeEntry.prototype.onResize = function () { };
2127
+ AjfFbNodeEntry.prototype.edit = function (evt) {
2128
+ evt.stopPropagation();
2129
+ if (this.nodeEntry == null || !this.isNodeEntry) {
2130
+ return;
2131
+ }
2132
+ this._service.editNodeEntry(this.nodeEntry);
2133
+ };
2134
+ AjfFbNodeEntry.prototype.delete = function (evt) {
2135
+ evt.stopPropagation();
2136
+ if (this.nodeEntry == null || !this.isNodeEntry) {
2137
+ return;
2138
+ }
2139
+ this._service.deleteNodeEntry(this.nodeEntry);
2140
+ };
2141
+ AjfFbNodeEntry.prototype.isLastNode = function () {
2142
+ if (!this.realNodeEntry || !this.realNodeEntry.children) {
2143
+ return false;
2144
+ }
2145
+ return !this.realNodeEntry.children[0].children;
2146
+ };
2147
+ AjfFbNodeEntry.prototype.isSlide = function (node) {
2148
+ return forms.isSlidesNode(node);
2149
+ };
2150
+ AjfFbNodeEntry.prototype.ngAfterViewInit = function () {
2151
+ var _this = this;
2152
+ setTimeout(function () { return _this._updateBranchHeights(); });
2153
+ this._childEntriesSubscription = this.childEntries.changes.subscribe(function () {
2154
+ _this._updateBranchHeights();
2155
+ });
2156
+ };
2157
+ AjfFbNodeEntry.prototype.ngOnDestroy = function () {
2158
+ this._branchLinesSubscription.unsubscribe();
2159
+ this._childEntriesSubscription.unsubscribe();
2160
+ };
2161
+ /**
2162
+ * Triggers when a field or slide node is moved or inserted by drag&dropping in the formbuilder.
2163
+ * @param event The drop event.
2164
+ * @param content True if the current nodeEntry contains other nodeEntries.
2165
+ */
2166
+ AjfFbNodeEntry.prototype.onDrop = function (event, content) {
2167
+ if (content === void 0) { content = false; }
2168
+ onDropProcess(event, this._service, this._nodeEntry, content);
2169
+ };
2170
+ /**
2171
+ * Assigns a progressive id to the dropList, to connect it to the FormBuilder source list.
2172
+ * @param empty True if the list is marked as empty.
2173
+ */
2174
+ AjfFbNodeEntry.prototype.assignId = function (empty) {
2175
+ if (empty === void 0) { empty = false; }
2176
+ return this._service.assignListId(this.realNodeEntry.node, empty);
2177
+ };
2178
+ AjfFbNodeEntry.prototype.disableSlideDrop = function (item) {
2179
+ return disableSlideDropPredicate(item);
2180
+ };
2181
+ AjfFbNodeEntry.prototype.disableFieldDrop = function (item) {
2182
+ return disableFieldDropPredicate(item);
2183
+ };
2184
+ AjfFbNodeEntry.prototype.emptyAreaDropPredicate = function () {
2185
+ var _this = this;
2186
+ return function (item, _drop) {
2187
+ if (_this._level > 0) {
2188
+ return !item.data.isSlide;
2189
+ }
2190
+ return item.data.isSlide || false;
2191
+ };
2192
+ };
2193
+ AjfFbNodeEntry.prototype._updateBranchHeights = function () {
2194
+ if (this.nodeEntry == null || !this.isNodeEntry || this.branchLines == null ||
2195
+ this.childEntries == null) {
2196
+ return;
2197
+ }
2198
+ var nodeEntry = this.nodeEntry;
2199
+ var branchLines = this.branchLines.toArray();
2200
+ var sliceIdx = nodeEntry.content != null ? nodeEntry.content.length : 0;
2201
+ var childEntries = this.childEntries.toArray().slice(sliceIdx);
2202
+ if (branchLines.length != childEntries.length) {
2203
+ return;
2204
+ }
2205
+ branchLines.forEach(function (bl, idx) {
2206
+ var ce = childEntries[idx];
2207
+ bl.height = ce.nativeElement.offsetTop;
2208
+ });
2209
+ };
2210
+ return AjfFbNodeEntry;
2211
+ }());
2212
+ AjfFbNodeEntry.decorators = [
2213
+ { type: core.Component, args: [{
2214
+ selector: 'ajf-fb-node-entry',
2215
+ 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",
2216
+ host: { '(window.resize)': 'onResize()' },
2217
+ encapsulation: core.ViewEncapsulation.None,
2218
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
2219
+ 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"]
2220
+ },] }
2221
+ ];
2222
+ AjfFbNodeEntry.ctorParameters = function () { return [
2223
+ { type: AjfFormBuilderService }
2224
+ ]; };
2225
+ AjfFbNodeEntry.propDecorators = {
2226
+ branchLines: [{ type: core.ViewChildren, args: [AjfFbBranchLine,] }],
2227
+ childEntries: [{ type: core.ViewChildren, args: [AjfFbNodeEntry, { read: core.ElementRef },] }],
2228
+ isFirst: [{ type: core.Input }],
2229
+ isExpanded: [{ type: core.Input }],
2230
+ nodeEntry: [{ type: core.Input }],
2231
+ level: [{ type: core.Input }],
2232
+ isDraggable: [{ type: core.Input }],
2233
+ originOffset: [{ type: core.Input }],
2234
+ firstBranchColor: [{ type: core.Input }]
2235
+ };
2236
+
2237
+ /**
2238
+ * @license
2239
+ * Copyright (C) Gnucoop soc. coop.
2240
+ *
2241
+ * This file is part of the Advanced JSON forms (ajf).
2242
+ *
2243
+ * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
2244
+ * modify it under the terms of the GNU Affero General Public License as
2245
+ * published by the Free Software Foundation, either version 3 of the License,
2246
+ * or (at your option) any later version.
2247
+ *
2248
+ * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
2249
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2250
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
2251
+ * General Public License for more details.
2252
+ *
2253
+ * You should have received a copy of the GNU Affero General Public License
2254
+ * along with Advanced JSON forms (ajf).
2255
+ * If not, see http://www.gnu.org/licenses/.
2256
+ *
2257
+ */
2258
+ var AjfFbValidationConditionEditorDialog = /** @class */ (function () {
2259
+ function AjfFbValidationConditionEditorDialog(service, dialogRef) {
2260
+ this.dialogRef = dialogRef;
2261
+ this._fields = service.flatFields.pipe(operators.map(function (fields) { return fields.sort(function (f1, f2) { return f1.name.localeCompare(f2.name); }); }));
2262
+ }
2263
+ Object.defineProperty(AjfFbValidationConditionEditorDialog.prototype, "fields", {
2264
+ get: function () {
2265
+ return this._fields;
2266
+ },
2267
+ enumerable: false,
2268
+ configurable: true
2269
+ });
2270
+ AjfFbValidationConditionEditorDialog.prototype.saveCondition = function () {
2271
+ if (this.editor == null) {
2272
+ return;
2273
+ }
2274
+ var newValue = this.editor.editedValue;
2275
+ this.dialogRef.close({ condition: newValue, errorMessage: this.errorMessage });
2276
+ };
2277
+ return AjfFbValidationConditionEditorDialog;
2278
+ }());
2279
+ AjfFbValidationConditionEditorDialog.decorators = [
2280
+ { type: core.Component, args: [{
2281
+ selector: 'ajf-fb-validation-condition-editor-dialog',
2282
+ 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",
2283
+ encapsulation: core.ViewEncapsulation.None,
2284
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
2285
+ styles: ["ajf-fb-validation-condition-editor-dialog mat-dialog-content{overflow:visible}\n"]
2286
+ },] }
2287
+ ];
2288
+ AjfFbValidationConditionEditorDialog.ctorParameters = function () { return [
2289
+ { type: AjfFormBuilderService },
2290
+ { type: dialog.MatDialogRef }
2291
+ ]; };
2292
+ AjfFbValidationConditionEditorDialog.propDecorators = {
2293
+ editor: [{ type: core.ViewChild, args: [AjfFbConditionEditor, { static: false },] }]
2294
+ };
2295
+
2296
+ /**
2297
+ * @license
2298
+ * Copyright (C) Gnucoop soc. coop.
2299
+ *
2300
+ * This file is part of the Advanced JSON forms (ajf).
2301
+ *
2302
+ * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
2303
+ * modify it under the terms of the GNU Affero General Public License as
2304
+ * published by the Free Software Foundation, either version 3 of the License,
2305
+ * or (at your option) any later version.
2306
+ *
2307
+ * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
2308
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2309
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
2310
+ * General Public License for more details.
2311
+ *
2312
+ * You should have received a copy of the GNU Affero General Public License
2313
+ * along with Advanced JSON forms (ajf).
2314
+ * If not, see http://www.gnu.org/licenses/.
2315
+ *
2316
+ */
2317
+ var AjfFbWarningConditionEditorDialog = /** @class */ (function () {
2318
+ function AjfFbWarningConditionEditorDialog(service, dialogRef) {
2319
+ this.dialogRef = dialogRef;
2320
+ this._fields = service.flatFields.pipe(operators.map(function (fields) { return fields.sort(function (f1, f2) { return f1.name.localeCompare(f2.name); }); }));
2321
+ }
2322
+ Object.defineProperty(AjfFbWarningConditionEditorDialog.prototype, "fields", {
2323
+ get: function () {
2324
+ return this._fields;
2325
+ },
2326
+ enumerable: false,
2327
+ configurable: true
2328
+ });
2329
+ AjfFbWarningConditionEditorDialog.prototype.saveCondition = function () {
2330
+ if (this.editor == null) {
2331
+ return;
2332
+ }
2333
+ var newValue = this.editor.editedValue;
2334
+ this.dialogRef.close({ condition: newValue, warningMessage: this.warningMessage });
2335
+ };
2336
+ return AjfFbWarningConditionEditorDialog;
2337
+ }());
2338
+ AjfFbWarningConditionEditorDialog.decorators = [
2339
+ { type: core.Component, args: [{
2340
+ selector: 'ajf-fb-warning-condition-editor-dialog',
2341
+ 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",
2342
+ encapsulation: core.ViewEncapsulation.None,
2343
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
2344
+ styles: ["ajf-fb-warning-condition-editor-dialog mat-dialog-content{overflow:visible}\n"]
2345
+ },] }
2346
+ ];
2347
+ AjfFbWarningConditionEditorDialog.ctorParameters = function () { return [
2348
+ { type: AjfFormBuilderService },
2349
+ { type: dialog.MatDialogRef }
2350
+ ]; };
2351
+ AjfFbWarningConditionEditorDialog.propDecorators = {
2352
+ editor: [{ type: core.ViewChild, args: [AjfFbConditionEditor, { static: false },] }]
2353
+ };
2354
+
2355
+ function checkRepsValidity(c) {
2356
+ var minReps = c.value.minReps;
2357
+ var maxReps = c.value.maxReps;
2358
+ if (minReps != null && maxReps != null && minReps > maxReps) {
2359
+ return { reps: 'Min repetions cannot be greater than max repetitions' };
2360
+ }
2361
+ return null;
2362
+ }
2363
+ function checkValueLimitsValidity(c) {
2364
+ var minValue = c.value.minValue;
2365
+ var maxValue = c.value.maxValue;
2366
+ if (minValue != null && maxValue != null && minValue > maxValue) {
2367
+ return { valueLimit: 'Min value cannot be greater than max value' };
2368
+ }
2369
+ return null;
2370
+ }
2371
+ function checkDigitsValidity(c) {
2372
+ var minDigits = c.value.minDigits;
2373
+ var maxDigits = c.value.maxDigits;
2374
+ if (minDigits != null && maxDigits != null && minDigits > maxDigits) {
2375
+ return { digits: 'Min digits cannot be greater than max digits' };
2376
+ }
2377
+ return null;
2378
+ }
2379
+ var AjfFbNodeProperties = /** @class */ (function () {
2380
+ function AjfFbNodeProperties(_cdr, _service, _dialog, _fb) {
2381
+ var _this = this;
2382
+ this._cdr = _cdr;
2383
+ this._service = _service;
2384
+ this._dialog = _dialog;
2385
+ this._fb = _fb;
2386
+ this._fieldSizes = [
2387
+ { label: 'Normal', value: 'normal' }, { label: 'Small', value: 'small' },
2388
+ { label: 'Smaller', value: 'smaller' }, { label: 'Tiny', value: 'tiny' },
2389
+ { label: 'Mini', value: 'mini' }
2390
+ ];
2391
+ this._choicesOrigins = [];
2392
+ this._conditionalBranches = [];
2393
+ this._validationConditions = [];
2394
+ this._warningConditions = [];
2395
+ this.isRepeatingContainerNode = function (nodeEntry) {
2396
+ return nodeEntry != null && forms.isRepeatingContainerNode(nodeEntry.node);
2397
+ };
2398
+ this._visibilityOptSub = rxjs.Subscription.EMPTY;
2399
+ this._visibilitySub = rxjs.Subscription.EMPTY;
2400
+ this._conditionalBranchesSub = rxjs.Subscription.EMPTY;
2401
+ this._formulaRepsSub = rxjs.Subscription.EMPTY;
2402
+ this._choicesFilterSub = rxjs.Subscription.EMPTY;
2403
+ this._formulaSub = rxjs.Subscription.EMPTY;
2404
+ this._forceValueSub = rxjs.Subscription.EMPTY;
2405
+ this._validationConditionsSub = rxjs.Subscription.EMPTY;
2406
+ this._warningConditionsSub = rxjs.Subscription.EMPTY;
2407
+ this._nextSlideConditionSub = rxjs.Subscription.EMPTY;
2408
+ this._choicesOriginsSub = rxjs.Subscription.EMPTY;
2409
+ this._triggerConditionsSub = rxjs.Subscription.EMPTY;
2410
+ this._editConditionDialogSub = rxjs.Subscription.EMPTY;
2411
+ this._editValidationConditionDialogSub = rxjs.Subscription.EMPTY;
2412
+ this._editWarningConditionDialogSub = rxjs.Subscription.EMPTY;
2413
+ this._editVisibilityEvt = new core.EventEmitter();
2414
+ this._editVisibilitySub = rxjs.Subscription.EMPTY;
2415
+ this._editConditionalBranchEvt = new core.EventEmitter();
2416
+ this._editConditionalBranchSub = rxjs.Subscription.EMPTY;
2417
+ this._editFormulaRepsEvt = new core.EventEmitter();
2418
+ this._editFormulaRepsSub = rxjs.Subscription.EMPTY;
2419
+ this._editChoicesFilterEvt = new core.EventEmitter();
2420
+ this._editChoicesFilterSub = rxjs.Subscription.EMPTY;
2421
+ this._editFormulaEvt = new core.EventEmitter();
2422
+ this._editFormulaSub = rxjs.Subscription.EMPTY;
2423
+ this._editForceValueEvt = new core.EventEmitter();
2424
+ this._editForceValueSub = rxjs.Subscription.EMPTY;
2425
+ this._editValidationConditionEvt = new core.EventEmitter();
2426
+ this._editValidationConditionSub = rxjs.Subscription.EMPTY;
2427
+ this._addValidationConditionEvt = new core.EventEmitter();
2428
+ this._addValidationConditionSub = rxjs.Subscription.EMPTY;
2429
+ this._removeValidationConditionEvt = new core.EventEmitter();
2430
+ this._removeValidationConditionSub = rxjs.Subscription.EMPTY;
2431
+ this._editWarningConditionEvt = new core.EventEmitter();
2432
+ this._editWarningConditionSub = rxjs.Subscription.EMPTY;
2433
+ this._addWarningConditionEvt = new core.EventEmitter();
2434
+ this._addWarningConditionSub = rxjs.Subscription.EMPTY;
2435
+ this._removeWarningConditionEvt = new core.EventEmitter();
2436
+ this._removeWarningConditionSub = rxjs.Subscription.EMPTY;
2437
+ this._editNextSlideConditionEvt = new core.EventEmitter();
2438
+ this._editNextSlideConditionSub = rxjs.Subscription.EMPTY;
2439
+ this._editTriggerConditionEvt = new core.EventEmitter();
2440
+ this._editTriggerConditionSub = rxjs.Subscription.EMPTY;
2441
+ this._addTriggerConditionEvt = new core.EventEmitter();
2442
+ this._addTriggerConditionSub = rxjs.Subscription.EMPTY;
2443
+ this._removeTriggerConditionEvt = new core.EventEmitter();
2444
+ this._removeTriggerConditionSub = rxjs.Subscription.EMPTY;
2445
+ this._saveEvt = new core.EventEmitter();
2446
+ this._saveSub = rxjs.Subscription.EMPTY;
2447
+ this._nodeEntry = _service.editedNodeEntry;
2448
+ this._choicesOriginsSub =
2449
+ _service.choicesOrigins.subscribe(function (c) { return _this._choicesOrigins = c || []; });
2450
+ this._enabled = this._nodeEntry.pipe(operators.map(function (n) { return n != null; }));
2451
+ this._initForm();
2452
+ this._initVisibilityEdit();
2453
+ this._initConditionalBranchEdit();
2454
+ this._initFormulaRepsEdit();
2455
+ this._initChoicesFilterEdit();
2456
+ this._initFormulaEdit();
2457
+ this._initForceValueEdit();
2458
+ this._initValidationConditionEdit();
2459
+ this._initAddValidationCondition();
2460
+ this._initRemoveValidationCondition();
2461
+ this._initWarningConditionEdit();
2462
+ this._initAddWarningCondition();
2463
+ this._initRemoveWarningCondition();
2464
+ this._initNextSlideConditionEdit();
2465
+ this._initTriggerConditionEdit();
2466
+ this._initAddTriggerCondition();
2467
+ this._initRemoveTriggerCondition();
2468
+ this._initSave();
2469
+ }
2470
+ Object.defineProperty(AjfFbNodeProperties.prototype, "fieldSizes", {
2471
+ get: function () {
2472
+ return this._fieldSizes;
2473
+ },
2474
+ enumerable: false,
2475
+ configurable: true
2476
+ });
2477
+ Object.defineProperty(AjfFbNodeProperties.prototype, "nodeEntry", {
2478
+ get: function () {
2479
+ return this._nodeEntry;
2480
+ },
2481
+ enumerable: false,
2482
+ configurable: true
2483
+ });
2484
+ Object.defineProperty(AjfFbNodeProperties.prototype, "choicesOrigins", {
2485
+ get: function () {
2486
+ return this._choicesOrigins;
2487
+ },
2488
+ enumerable: false,
2489
+ configurable: true
2490
+ });
2491
+ Object.defineProperty(AjfFbNodeProperties.prototype, "enabled", {
2492
+ get: function () {
2493
+ return this._enabled;
2494
+ },
2495
+ enumerable: false,
2496
+ configurable: true
2497
+ });
2498
+ Object.defineProperty(AjfFbNodeProperties.prototype, "propertiesForm", {
2499
+ get: function () {
2500
+ return this._propertiesForm;
2501
+ },
2502
+ enumerable: false,
2503
+ configurable: true
2504
+ });
2505
+ Object.defineProperty(AjfFbNodeProperties.prototype, "hasChoices", {
2506
+ get: function () {
2507
+ return this._hasChoices;
2508
+ },
2509
+ enumerable: false,
2510
+ configurable: true
2511
+ });
2512
+ Object.defineProperty(AjfFbNodeProperties.prototype, "curVisibility", {
2513
+ get: function () {
2514
+ return this._curVisibility;
2515
+ },
2516
+ enumerable: false,
2517
+ configurable: true
2518
+ });
2519
+ Object.defineProperty(AjfFbNodeProperties.prototype, "curFormulaReps", {
2520
+ get: function () {
2521
+ return this._curFormulaReps;
2522
+ },
2523
+ enumerable: false,
2524
+ configurable: true
2525
+ });
2526
+ Object.defineProperty(AjfFbNodeProperties.prototype, "curChoicesFilter", {
2527
+ get: function () {
2528
+ return this._curChoicesFilter;
2529
+ },
2530
+ enumerable: false,
2531
+ configurable: true
2532
+ });
2533
+ Object.defineProperty(AjfFbNodeProperties.prototype, "curForceValue", {
2534
+ get: function () {
2535
+ return this._curForceValue;
2536
+ },
2537
+ enumerable: false,
2538
+ configurable: true
2539
+ });
2540
+ Object.defineProperty(AjfFbNodeProperties.prototype, "curFormula", {
2541
+ get: function () {
2542
+ return this._curFormula;
2543
+ },
2544
+ enumerable: false,
2545
+ configurable: true
2546
+ });
2547
+ Object.defineProperty(AjfFbNodeProperties.prototype, "conditionalBranches", {
2548
+ get: function () {
2549
+ return this._conditionalBranches;
2550
+ },
2551
+ enumerable: false,
2552
+ configurable: true
2553
+ });
2554
+ Object.defineProperty(AjfFbNodeProperties.prototype, "validationConditions", {
2555
+ get: function () {
2556
+ return this._validationConditions;
2557
+ },
2558
+ enumerable: false,
2559
+ configurable: true
2560
+ });
2561
+ Object.defineProperty(AjfFbNodeProperties.prototype, "warningConditions", {
2562
+ get: function () {
2563
+ return this._warningConditions;
2564
+ },
2565
+ enumerable: false,
2566
+ configurable: true
2567
+ });
2568
+ Object.defineProperty(AjfFbNodeProperties.prototype, "nextSlideCondition", {
2569
+ get: function () {
2570
+ return this._nextSlideCondition;
2571
+ },
2572
+ enumerable: false,
2573
+ configurable: true
2574
+ });
2575
+ Object.defineProperty(AjfFbNodeProperties.prototype, "triggerConditions", {
2576
+ get: function () {
2577
+ return this._triggerConditions;
2578
+ },
2579
+ enumerable: false,
2580
+ configurable: true
2581
+ });
2582
+ AjfFbNodeProperties.prototype.editVisibility = function () {
2583
+ this._editVisibilityEvt.emit();
2584
+ };
2585
+ AjfFbNodeProperties.prototype.editConditionalBranch = function (idx) {
2586
+ if (idx < 0 || idx >= this._conditionalBranches.length) {
2587
+ return;
2588
+ }
2589
+ this._editConditionalBranchEvt.emit(idx);
2590
+ };
2591
+ AjfFbNodeProperties.prototype.editFormulaReps = function () {
2592
+ this._editFormulaRepsEvt.emit();
2593
+ };
2594
+ AjfFbNodeProperties.prototype.editChoicesFilter = function () {
2595
+ this._editChoicesFilterEvt.emit();
2596
+ };
2597
+ AjfFbNodeProperties.prototype.editFormula = function () {
2598
+ this._editFormulaEvt.emit();
2599
+ };
2600
+ AjfFbNodeProperties.prototype.editForceValue = function () {
2601
+ this._editForceValueEvt.emit();
2602
+ };
2603
+ AjfFbNodeProperties.prototype.editValidationCondition = function (idx) {
2604
+ if (idx < 0 || idx >= this._validationConditions.length) {
2605
+ return;
2606
+ }
2607
+ this._editValidationConditionEvt.emit(idx);
2608
+ };
2609
+ AjfFbNodeProperties.prototype.addValidationCondition = function () {
2610
+ this._addValidationConditionEvt.emit();
2611
+ };
2612
+ AjfFbNodeProperties.prototype.removeValidationCondition = function (idx) {
2613
+ if (idx < 0 || idx >= this._validationConditions.length) {
2614
+ return;
2615
+ }
2616
+ this._removeValidationConditionEvt.emit(idx);
2617
+ };
2618
+ AjfFbNodeProperties.prototype.editWarningCondition = function (idx) {
2619
+ if (idx < 0 || idx >= this._warningConditions.length) {
2620
+ return;
2621
+ }
2622
+ this._editWarningConditionEvt.emit(idx);
2623
+ };
2624
+ AjfFbNodeProperties.prototype.addWarningCondition = function () {
2625
+ this._addWarningConditionEvt.emit();
2626
+ };
2627
+ AjfFbNodeProperties.prototype.removeWarningCondition = function (idx) {
2628
+ if (idx < 0 || idx >= this._warningConditions.length) {
2629
+ return;
2630
+ }
2631
+ this._removeWarningConditionEvt.emit(idx);
2632
+ };
2633
+ AjfFbNodeProperties.prototype.editNextSlideCondition = function () {
2634
+ this._editNextSlideConditionEvt.emit();
2635
+ };
2636
+ AjfFbNodeProperties.prototype.editTriggerCondition = function (idx) {
2637
+ if (idx < 0 || idx >= this._triggerConditions.length) {
2638
+ return;
2639
+ }
2640
+ this._editTriggerConditionEvt.emit(idx);
2641
+ };
2642
+ AjfFbNodeProperties.prototype.addTriggerCondition = function () {
2643
+ this._addTriggerConditionEvt.emit();
2644
+ };
2645
+ AjfFbNodeProperties.prototype.removeTriggerCondition = function (idx) {
2646
+ if (idx < 0 || idx >= this._triggerConditions.length) {
2647
+ return;
2648
+ }
2649
+ this._removeTriggerConditionEvt.emit(idx);
2650
+ };
2651
+ AjfFbNodeProperties.prototype.isField = function (nodeEntry) {
2652
+ return nodeEntry != null && forms.isField(nodeEntry.node);
2653
+ };
2654
+ AjfFbNodeProperties.prototype.isNumericField = function (node) {
2655
+ return forms.isField(node) && forms.isNumberField(node);
2656
+ };
2657
+ AjfFbNodeProperties.prototype.isFieldWithChoices = function (node) {
2658
+ return forms.isField(node) && forms.isFieldWithChoices(node);
2659
+ };
2660
+ AjfFbNodeProperties.prototype.save = function () {
2661
+ this._saveEvt.emit();
2662
+ };
2663
+ AjfFbNodeProperties.prototype.cancel = function () {
2664
+ this._service.cancelNodeEntryEdit();
2665
+ };
2666
+ AjfFbNodeProperties.prototype.ngOnDestroy = function () {
2667
+ this._choicesOriginsSub.unsubscribe();
2668
+ this._visibilityOptSub.unsubscribe();
2669
+ this._visibilitySub.unsubscribe();
2670
+ this._formulaRepsSub.unsubscribe();
2671
+ this._choicesFilterSub.unsubscribe();
2672
+ this._formulaSub.unsubscribe();
2673
+ this._forceValueSub.unsubscribe();
2674
+ this._validationConditionsSub.unsubscribe();
2675
+ this._warningConditionsSub.unsubscribe();
2676
+ this._triggerConditionsSub.unsubscribe();
2677
+ this._editConditionDialogSub.unsubscribe();
2678
+ this._editValidationConditionDialogSub.unsubscribe();
2679
+ this._editWarningConditionDialogSub.unsubscribe();
2680
+ this._editChoicesFilterSub.unsubscribe();
2681
+ this._editConditionalBranchSub.unsubscribe();
2682
+ this._editVisibilitySub.unsubscribe();
2683
+ this._editFormulaRepsSub.unsubscribe();
2684
+ this._editFormulaSub.unsubscribe();
2685
+ this._editForceValueSub.unsubscribe();
2686
+ this._editValidationConditionSub.unsubscribe();
2687
+ this._editWarningConditionSub.unsubscribe();
2688
+ this._nextSlideConditionSub.unsubscribe();
2689
+ this._addTriggerConditionSub.unsubscribe();
2690
+ this._addValidationConditionSub.unsubscribe();
2691
+ this._addWarningConditionSub.unsubscribe();
2692
+ this._editNextSlideConditionSub.unsubscribe();
2693
+ this._editTriggerConditionSub.unsubscribe();
2694
+ this._removeTriggerConditionSub.unsubscribe();
2695
+ this._removeValidationConditionSub.unsubscribe();
2696
+ this._removeWarningConditionSub.unsubscribe();
2697
+ this._saveSub.unsubscribe();
2698
+ };
2699
+ AjfFbNodeProperties.prototype._initSave = function () {
2700
+ var _this = this;
2701
+ this._saveSub = this._saveEvt
2702
+ .pipe(operators.withLatestFrom(this.propertiesForm))
2703
+ .subscribe(function (_a) {
2704
+ var _b = __read(_a, 2), _ = _b[0], formGroup = _b[1];
2705
+ var fg = formGroup;
2706
+ var val = Object.assign(Object.assign({}, fg.value), { conditionalBranches: _this._conditionalBranches });
2707
+ _this._service.saveNodeEntry(val);
2708
+ });
2709
+ };
2710
+ AjfFbNodeProperties.prototype._initForm = function () {
2711
+ var _this = this;
2712
+ this._propertiesForm = this._nodeEntry.pipe(operators.filter(function (n) { return n != null; }), operators.map(function (n) {
2713
+ if (_this._visibilityOptSub != null) {
2714
+ _this._visibilityOptSub.unsubscribe();
2715
+ }
2716
+ if (_this._visibilitySub != null) {
2717
+ _this._visibilitySub.unsubscribe();
2718
+ }
2719
+ if (_this._conditionalBranchesSub != null) {
2720
+ _this._conditionalBranchesSub.unsubscribe();
2721
+ }
2722
+ n = n;
2723
+ var visibility = n.node.visibility != null ? n.node.visibility.condition : null;
2724
+ var visibilityOpt = n.node.visibility != null ? _this._guessVisibilityOpt(n.node.visibility) : null;
2725
+ var controls = {
2726
+ name: [n.node.name, forms$1.Validators.required],
2727
+ label: n.node.label,
2728
+ visibilityOpt: [visibilityOpt, forms$1.Validators.required],
2729
+ visibility: [visibility, forms$1.Validators.required],
2730
+ conditionalBranchesNum: n.node.conditionalBranches.length
2731
+ };
2732
+ var validators = [];
2733
+ if (forms.isRepeatingContainerNode(n.node)) {
2734
+ var rn = n.node;
2735
+ var formulaReps = rn.formulaReps != null ? rn.formulaReps.formula : null;
2736
+ controls.formulaReps = [formulaReps, forms$1.Validators.required];
2737
+ controls.minReps = rn.minReps;
2738
+ controls.maxReps = rn.maxReps;
2739
+ _this._curFormulaReps = formulaReps;
2740
+ validators.push(checkRepsValidity);
2741
+ }
2742
+ if (_this.isField(n)) {
2743
+ var field = n.node;
2744
+ var forceValue = null;
2745
+ var notEmpty = false;
2746
+ var validationConditions = [];
2747
+ if (field.validation != null) {
2748
+ if (field.validation.forceValue != null) {
2749
+ forceValue = field.validation.forceValue.condition;
2750
+ }
2751
+ notEmpty = field.validation.notEmpty != null;
2752
+ validationConditions = (field.validation.conditions || []).map(function (c) {
2753
+ return { condition: c.condition, errorMessage: c.errorMessage };
2754
+ });
2755
+ }
2756
+ var notEmptyW = false;
2757
+ var warningConditions = [];
2758
+ if (field.warning != null) {
2759
+ notEmptyW = field.warning.notEmpty != null;
2760
+ warningConditions = (field.warning.conditions || []).map(function (w) {
2761
+ return { condition: w.condition, warningMessage: w.warningMessage };
2762
+ });
2763
+ }
2764
+ var formula = field.formula != null ? field.formula.formula : null;
2765
+ controls.description = field.description;
2766
+ controls.defaultValue = field.defaultValue;
2767
+ controls.hint = field.hint;
2768
+ controls.size = field.size;
2769
+ controls.formula = formula;
2770
+ controls.forceValue = forceValue;
2771
+ controls.notEmpty = notEmpty;
2772
+ controls.validationConditions = [validationConditions, []];
2773
+ controls.notEmptyWarning = notEmptyW;
2774
+ controls.warningConditions = [warningConditions, []];
2775
+ controls.nextSlideCondition = [field.nextSlideCondition];
2776
+ _this._curForceValue = forceValue;
2777
+ _this._curFormula = formula;
2778
+ _this._validationConditions = validationConditions;
2779
+ _this._warningConditions = warningConditions;
2780
+ }
2781
+ if (_this.isNumericField(n.node)) {
2782
+ var numField = n.node;
2783
+ var minValue = void 0;
2784
+ var maxValue = void 0;
2785
+ var minDigits = void 0;
2786
+ var maxDigits = void 0;
2787
+ if (numField.validation != null) {
2788
+ if (numField.validation.minValue != null) {
2789
+ minValue = (numField.validation.minValue.condition || '').replace('$value >= ', '');
2790
+ }
2791
+ if (numField.validation.maxValue != null) {
2792
+ maxValue = (numField.validation.maxValue.condition || '').replace('$value <= ', '');
2793
+ }
2794
+ if (numField.validation.minDigits != null) {
2795
+ minDigits = (numField.validation.minDigits.condition ||
2796
+ '').replace('$value.toString().length >= ', '');
2797
+ }
2798
+ if (numField.validation.maxDigits != null) {
2799
+ maxDigits = (numField.validation.maxDigits.condition ||
2800
+ '').replace('$value.toString().length <= ', '');
2801
+ }
2802
+ }
2803
+ controls.minValue = minValue;
2804
+ controls.maxValue = maxValue;
2805
+ controls.minDigits = minDigits;
2806
+ controls.maxDigits = maxDigits;
2807
+ validators.push(checkValueLimitsValidity);
2808
+ validators.push(checkDigitsValidity);
2809
+ }
2810
+ if (_this.isFieldWithChoices(n.node)) {
2811
+ var fieldWithChoices = n.node;
2812
+ var triggerConditions = (fieldWithChoices.triggerConditions || []).map(function (c) { return c.condition; });
2813
+ controls.choicesOriginRef = fieldWithChoices.choicesOriginRef;
2814
+ controls.choicesFilter = fieldWithChoices.choicesFilter != null ?
2815
+ fieldWithChoices.choicesFilter.formula :
2816
+ null;
2817
+ controls.forceExpanded = fieldWithChoices.forceExpanded;
2818
+ controls.forceNarrow = fieldWithChoices.forceNarrow;
2819
+ controls.triggerConditions = triggerConditions;
2820
+ _this._triggerConditions = triggerConditions;
2821
+ }
2822
+ var fg = _this._fb.group(controls);
2823
+ fg.setValidators(validators);
2824
+ _this._conditionalBranches = n.node.conditionalBranches.map(function (c) { return c.condition; });
2825
+ _this._curVisibility = n.node.visibility != null ? n.node.visibility.condition : null;
2826
+ _this._handleConditionalBranchesChange(fg);
2827
+ _this._handleVisibilityChange(fg);
2828
+ _this._handleFormulaRepsChange(fg);
2829
+ _this._handleChoicesFilterChange(fg);
2830
+ _this._handleFormulaChange(fg);
2831
+ _this._handleForceValueChange(fg);
2832
+ _this._handleValidationCondtionsChange(fg);
2833
+ _this._handleWarningCondtionsChange(fg);
2834
+ _this._handleNextSlideConditionChange(fg);
2835
+ _this._handleTriggerCondtionsChange(fg);
2836
+ return fg;
2837
+ }), operators.publishReplay(1), operators.refCount());
2838
+ };
2839
+ AjfFbNodeProperties.prototype._destroyConditionDialog = function () {
2840
+ if (this._editConditionDialogSub != null) {
2841
+ this._editConditionDialogSub.unsubscribe();
2842
+ this._editConditionDialogSub = rxjs.Subscription.EMPTY;
2843
+ }
2844
+ if (this._editConditionDialog != null) {
2845
+ this._editConditionDialog.close();
2846
+ this._editConditionDialog = null;
2847
+ }
2848
+ };
2849
+ AjfFbNodeProperties.prototype._destroyValidationConditionDialog = function () {
2850
+ if (this._editValidationConditionDialogSub != null) {
2851
+ this._editValidationConditionDialogSub.unsubscribe();
2852
+ this._editValidationConditionDialogSub = rxjs.Subscription.EMPTY;
2853
+ }
2854
+ if (this._editValidationConditionDialog != null) {
2855
+ this._editValidationConditionDialog.close();
2856
+ this._editValidationConditionDialog = null;
2857
+ }
2858
+ };
2859
+ AjfFbNodeProperties.prototype._destroyWarningConditionDialog = function () {
2860
+ if (this._editWarningConditionDialogSub != null) {
2861
+ this._editWarningConditionDialogSub.unsubscribe();
2862
+ this._editWarningConditionDialogSub = rxjs.Subscription.EMPTY;
2863
+ }
2864
+ if (this._editWarningConditionDialog != null) {
2865
+ this._editWarningConditionDialog.close();
2866
+ this._editWarningConditionDialog = null;
2867
+ }
2868
+ };
2869
+ AjfFbNodeProperties.prototype._initRemoveTriggerCondition = function () {
2870
+ this._removeTriggerConditionSub = this._removeTriggerConditionEvt
2871
+ .pipe(operators.withLatestFrom(this._propertiesForm))
2872
+ .subscribe(function (_a) {
2873
+ var _b = __read(_a, 2), vcIdx = _b[0], formGroup = _b[1];
2874
+ if (formGroup == null) {
2875
+ return;
2876
+ }
2877
+ var fg = formGroup;
2878
+ var ctrl = fg.controls['triggerConditions'];
2879
+ var vcs = (ctrl.value || []).slice(0);
2880
+ if (vcIdx < 0 || vcIdx >= vcs.length) {
2881
+ return;
2882
+ }
2883
+ vcs.splice(vcIdx, 1);
2884
+ ctrl.setValue(vcs);
2885
+ });
2886
+ };
2887
+ AjfFbNodeProperties.prototype._initAddTriggerCondition = function () {
2888
+ this._addTriggerConditionSub = this._addTriggerConditionEvt
2889
+ .pipe(operators.withLatestFrom(this._propertiesForm))
2890
+ .subscribe(function (_a) {
2891
+ var _b = __read(_a, 2), _ = _b[0], formGroup = _b[1];
2892
+ if (formGroup == null) {
2893
+ return;
2894
+ }
2895
+ var fg = formGroup;
2896
+ var ctrl = fg.controls['triggerConditions'];
2897
+ var vcs = (ctrl.value || []).slice(0);
2898
+ vcs.push('');
2899
+ ctrl.setValue(vcs);
2900
+ });
2901
+ };
2902
+ AjfFbNodeProperties.prototype._initTriggerConditionEdit = function () {
2903
+ var _this = this;
2904
+ this._editConditionDialogSub = rxjs.Subscription.EMPTY;
2905
+ this._cdr.markForCheck();
2906
+ this._editTriggerConditionSub =
2907
+ this._editTriggerConditionEvt
2908
+ .pipe(operators.withLatestFrom(this._propertiesForm))
2909
+ .subscribe(function (_a) {
2910
+ var _b = __read(_a, 2), vcIdx = _b[0], fg = _b[1];
2911
+ _this._destroyConditionDialog();
2912
+ if (vcIdx < 0 || vcIdx >= _this._triggerConditions.length || fg == null) {
2913
+ return;
2914
+ }
2915
+ _this._editConditionDialog = _this._dialog.open(AjfFbConditionEditorDialog);
2916
+ var cmp = _this._editConditionDialog.componentInstance;
2917
+ cmp.condition = _this._triggerConditions[vcIdx];
2918
+ _this._editConditionDialogSub =
2919
+ _this._editConditionDialog.afterClosed().subscribe(function (cond) {
2920
+ if (cond !== void 0) {
2921
+ _this._triggerConditions[vcIdx] = cond;
2922
+ }
2923
+ _this._editConditionDialogSub.unsubscribe();
2924
+ _this._editConditionDialogSub = rxjs.Subscription.EMPTY;
2925
+ _this._cdr.markForCheck();
2926
+ });
2927
+ });
2928
+ };
2929
+ AjfFbNodeProperties.prototype._initRemoveWarningCondition = function () {
2930
+ this._removeWarningConditionSub = this._removeWarningConditionEvt
2931
+ .pipe(operators.withLatestFrom(this._propertiesForm))
2932
+ .subscribe(function (_a) {
2933
+ var _b = __read(_a, 2), vcIdx = _b[0], formGroup = _b[1];
2934
+ if (formGroup == null) {
2935
+ return;
2936
+ }
2937
+ var fg = formGroup;
2938
+ var ctrl = fg.controls['warningConditions'];
2939
+ var vcs = (ctrl.value || []).slice(0);
2940
+ if (vcIdx < 0 || vcIdx >= vcs.length) {
2941
+ return;
2942
+ }
2943
+ vcs.splice(vcIdx, 1);
2944
+ ctrl.setValue(vcs);
2945
+ });
2946
+ };
2947
+ AjfFbNodeProperties.prototype._initAddWarningCondition = function () {
2948
+ this._addWarningConditionSub = this._addWarningConditionEvt
2949
+ .pipe(operators.withLatestFrom(this._propertiesForm))
2950
+ .subscribe(function (_a) {
2951
+ var _b = __read(_a, 2), _ = _b[0], formGroup = _b[1];
2952
+ if (formGroup == null) {
2953
+ return;
2954
+ }
2955
+ var fg = formGroup;
2956
+ var ctrl = fg.controls['warningConditions'];
2957
+ var vcs = (ctrl.value || []).slice(0);
2958
+ vcs.push({ condition: '', errorMessage: '' });
2959
+ ctrl.setValue(vcs);
2960
+ });
2961
+ };
2962
+ AjfFbNodeProperties.prototype._initWarningConditionEdit = function () {
2963
+ var _this = this;
2964
+ this._editWarningConditionSub =
2965
+ this._editWarningConditionEvt
2966
+ .pipe(operators.withLatestFrom(this._propertiesForm))
2967
+ .subscribe(function (_a) {
2968
+ var _b = __read(_a, 2), vcIdx = _b[0], fg = _b[1];
2969
+ _this._destroyWarningConditionDialog();
2970
+ if (vcIdx < 0 || vcIdx >= _this._warningConditions.length || fg == null) {
2971
+ return;
2972
+ }
2973
+ _this._editWarningConditionDialog =
2974
+ _this._dialog.open(AjfFbWarningConditionEditorDialog);
2975
+ var cmp = _this._editWarningConditionDialog.componentInstance;
2976
+ var w = _this._warningConditions[vcIdx];
2977
+ cmp.condition = w.condition;
2978
+ cmp.warningMessage = w.warningMessage;
2979
+ _this._editWarningConditionDialogSub =
2980
+ _this._editWarningConditionDialog.afterClosed().subscribe(function (cond) {
2981
+ if (cond !== void 0) {
2982
+ _this._warningConditions[vcIdx] = cond;
2983
+ }
2984
+ _this._editWarningConditionDialogSub.unsubscribe();
2985
+ _this._editWarningConditionDialogSub = rxjs.Subscription.EMPTY;
2986
+ _this._cdr.markForCheck();
2987
+ });
2988
+ });
2989
+ };
2990
+ AjfFbNodeProperties.prototype._initRemoveValidationCondition = function () {
2991
+ this._removeValidationConditionSub = this._removeValidationConditionEvt
2992
+ .pipe(operators.withLatestFrom(this._propertiesForm))
2993
+ .subscribe(function (_a) {
2994
+ var _b = __read(_a, 2), vcIdx = _b[0], formGroup = _b[1];
2995
+ if (formGroup == null) {
2996
+ return;
2997
+ }
2998
+ var fg = formGroup;
2999
+ var ctrl = fg.controls['validationConditions'];
3000
+ var vcs = (ctrl.value || []).slice(0);
3001
+ if (vcIdx < 0 || vcIdx >= vcs.length) {
3002
+ return;
3003
+ }
3004
+ vcs.splice(vcIdx, 1);
3005
+ ctrl.setValue(vcs);
3006
+ });
3007
+ };
3008
+ AjfFbNodeProperties.prototype._initAddValidationCondition = function () {
3009
+ this._addValidationConditionSub = this._addValidationConditionEvt
3010
+ .pipe(operators.withLatestFrom(this._propertiesForm))
3011
+ .subscribe(function (_a) {
3012
+ var _b = __read(_a, 2), _ = _b[0], formGroup = _b[1];
3013
+ if (formGroup == null) {
3014
+ return;
3015
+ }
3016
+ var fg = formGroup;
3017
+ var ctrl = fg.controls['validationConditions'];
3018
+ var vcs = (ctrl.value || []).slice(0);
3019
+ vcs.push({ condition: '', errorMessage: '' });
3020
+ ctrl.setValue(vcs);
3021
+ });
3022
+ };
3023
+ AjfFbNodeProperties.prototype._initValidationConditionEdit = function () {
3024
+ var _this = this;
3025
+ this._editValidationConditionSub =
3026
+ this._editValidationConditionEvt
3027
+ .pipe(operators.withLatestFrom(this._propertiesForm))
3028
+ .subscribe(function (_a) {
3029
+ var _b = __read(_a, 2), vcIdx = _b[0], fg = _b[1];
3030
+ _this._destroyValidationConditionDialog();
3031
+ if (vcIdx < 0 || vcIdx >= _this._validationConditions.length || fg == null) {
3032
+ return;
3033
+ }
3034
+ _this._editValidationConditionDialog =
3035
+ _this._dialog.open(AjfFbValidationConditionEditorDialog);
3036
+ var cmp = _this._editValidationConditionDialog.componentInstance;
3037
+ var v = _this._validationConditions[vcIdx];
3038
+ cmp.condition = v.condition;
3039
+ cmp.errorMessage = v.errorMessage;
3040
+ _this._editValidationConditionDialogSub =
3041
+ _this._editValidationConditionDialog.afterClosed().subscribe(function (cond) {
3042
+ if (cond !== void 0) {
3043
+ _this._validationConditions[vcIdx] = cond;
3044
+ }
3045
+ _this._editValidationConditionDialogSub.unsubscribe();
3046
+ _this._editValidationConditionDialogSub = rxjs.Subscription.EMPTY;
3047
+ _this._cdr.markForCheck();
3048
+ });
3049
+ });
3050
+ };
3051
+ AjfFbNodeProperties.prototype._initForceValueEdit = function () {
3052
+ var _this = this;
3053
+ this._editForceValueSub =
3054
+ this._editForceValueEvt
3055
+ .pipe(operators.withLatestFrom(this._propertiesForm))
3056
+ .subscribe(function (_a) {
3057
+ var _b = __read(_a, 2), _ = _b[0], formGroup = _b[1];
3058
+ _this._destroyConditionDialog();
3059
+ if (formGroup == null) {
3060
+ return;
3061
+ }
3062
+ var fg = formGroup;
3063
+ var ctrl = fg.controls['forceValue'];
3064
+ _this._editConditionDialog = _this._dialog.open(AjfFbConditionEditorDialog);
3065
+ _this._editConditionDialog.componentInstance.condition = ctrl.value;
3066
+ _this._editConditionDialogSub =
3067
+ _this._editConditionDialog.afterClosed().subscribe(function (cond) {
3068
+ if (cond !== void 0) {
3069
+ ctrl.setValue(cond);
3070
+ }
3071
+ _this._editConditionDialogSub.unsubscribe();
3072
+ _this._editConditionDialogSub = rxjs.Subscription.EMPTY;
3073
+ _this._cdr.markForCheck();
3074
+ });
3075
+ });
3076
+ };
3077
+ AjfFbNodeProperties.prototype._initNextSlideConditionEdit = function () {
3078
+ var _this = this;
3079
+ this._editNextSlideConditionSub =
3080
+ this._editNextSlideConditionEvt
3081
+ .pipe(operators.withLatestFrom(this._propertiesForm))
3082
+ .subscribe(function (_a) {
3083
+ var _b = __read(_a, 2), _ = _b[0], formGroup = _b[1];
3084
+ _this._destroyConditionDialog();
3085
+ if (formGroup == null) {
3086
+ return;
3087
+ }
3088
+ var fg = formGroup;
3089
+ var ctrl = fg.controls['nextSlideCondition'];
3090
+ _this._editConditionDialog = _this._dialog.open(AjfFbConditionEditorDialog);
3091
+ _this._editConditionDialog.componentInstance.condition = ctrl.value;
3092
+ _this._editConditionDialogSub =
3093
+ _this._editConditionDialog.afterClosed().subscribe(function (cond) {
3094
+ if (cond !== void 0) {
3095
+ ctrl.setValue(cond);
3096
+ }
3097
+ _this._editConditionDialogSub.unsubscribe();
3098
+ _this._editConditionDialogSub = rxjs.Subscription.EMPTY;
3099
+ _this._cdr.markForCheck();
3100
+ });
3101
+ });
3102
+ };
3103
+ AjfFbNodeProperties.prototype._initFormulaEdit = function () {
3104
+ var _this = this;
3105
+ this._editConditionDialogSub = rxjs.Subscription.EMPTY;
3106
+ this._cdr.markForCheck();
3107
+ this._editFormulaSub =
3108
+ this._editFormulaEvt
3109
+ .pipe(operators.withLatestFrom(this._propertiesForm))
3110
+ .subscribe(function (_a) {
3111
+ var _b = __read(_a, 2), _ = _b[0], formGroup = _b[1];
3112
+ _this._destroyConditionDialog();
3113
+ if (formGroup == null) {
3114
+ return;
3115
+ }
3116
+ var fg = formGroup;
3117
+ var ctrl = fg.controls['formula'];
3118
+ _this._editConditionDialog = _this._dialog.open(AjfFbConditionEditorDialog);
3119
+ _this._editConditionDialog.componentInstance.condition = ctrl.value;
3120
+ _this._editConditionDialogSub =
3121
+ _this._editConditionDialog.afterClosed().subscribe(function (cond) {
3122
+ if (cond !== void 0) {
3123
+ ctrl.setValue(cond);
3124
+ }
3125
+ _this._editConditionDialogSub.unsubscribe();
3126
+ _this._editConditionDialogSub = rxjs.Subscription.EMPTY;
3127
+ _this._cdr.markForCheck();
3128
+ });
3129
+ });
3130
+ };
3131
+ AjfFbNodeProperties.prototype._initFormulaRepsEdit = function () {
3132
+ var _this = this;
3133
+ this._editFormulaRepsSub =
3134
+ this._editFormulaRepsEvt
3135
+ .pipe(operators.withLatestFrom(this._propertiesForm))
3136
+ .subscribe(function (_a) {
3137
+ var _b = __read(_a, 2), _ = _b[0], formGroup = _b[1];
3138
+ _this._destroyConditionDialog();
3139
+ if (formGroup == null) {
3140
+ return;
3141
+ }
3142
+ var fg = formGroup;
3143
+ var ctrl = fg.controls['formulaReps'];
3144
+ _this._editConditionDialog = _this._dialog.open(AjfFbConditionEditorDialog);
3145
+ _this._editConditionDialog.componentInstance.condition = ctrl.value;
3146
+ _this._editConditionDialogSub =
3147
+ _this._editConditionDialog.afterClosed().subscribe(function (cond) {
3148
+ if (cond !== void 0) {
3149
+ ctrl.setValue(cond);
3150
+ }
3151
+ _this._editConditionDialogSub.unsubscribe();
3152
+ _this._editConditionDialogSub = rxjs.Subscription.EMPTY;
3153
+ _this._cdr.markForCheck();
3154
+ });
3155
+ });
3156
+ };
3157
+ AjfFbNodeProperties.prototype._initChoicesFilterEdit = function () {
3158
+ var _this = this;
3159
+ this._editChoicesFilterSub =
3160
+ this._editChoicesFilterEvt
3161
+ .pipe(operators.withLatestFrom(this._propertiesForm))
3162
+ .subscribe(function (_a) {
3163
+ var _b = __read(_a, 2), _ = _b[0], formGroup = _b[1];
3164
+ _this._destroyConditionDialog();
3165
+ if (formGroup == null) {
3166
+ return;
3167
+ }
3168
+ var fg = formGroup;
3169
+ var ctrl = fg.controls['choicesFilter'];
3170
+ _this._editConditionDialog = _this._dialog.open(AjfFbConditionEditorDialog);
3171
+ _this._editConditionDialog.componentInstance.condition = ctrl.value;
3172
+ _this._editConditionDialogSub =
3173
+ _this._editConditionDialog.afterClosed().subscribe(function (cond) {
3174
+ if (cond !== void 0) {
3175
+ ctrl.setValue(cond);
3176
+ }
3177
+ _this._editConditionDialogSub.unsubscribe();
3178
+ _this._editConditionDialogSub = rxjs.Subscription.EMPTY;
3179
+ _this._cdr.markForCheck();
3180
+ });
3181
+ });
3182
+ };
3183
+ AjfFbNodeProperties.prototype._initConditionalBranchEdit = function () {
3184
+ var _this = this;
3185
+ this._editConditionalBranchSub =
3186
+ this._editConditionalBranchEvt
3187
+ .pipe(operators.withLatestFrom(this._propertiesForm))
3188
+ .subscribe(function (_a) {
3189
+ var _b = __read(_a, 2), cbIdx = _b[0], fg = _b[1];
3190
+ _this._destroyConditionDialog();
3191
+ if (cbIdx < 0 || cbIdx >= _this._conditionalBranches.length || fg == null) {
3192
+ return;
3193
+ }
3194
+ _this._editConditionDialog = _this._dialog.open(AjfFbConditionEditorDialog);
3195
+ _this._editConditionDialog.componentInstance.condition =
3196
+ _this._conditionalBranches[cbIdx];
3197
+ _this._editConditionDialogSub =
3198
+ _this._editConditionDialog.afterClosed().subscribe(function (cond) {
3199
+ if (cond !== void 0) {
3200
+ _this._conditionalBranches[cbIdx] = cond;
3201
+ }
3202
+ _this._editConditionDialogSub.unsubscribe();
3203
+ _this._editConditionDialogSub = rxjs.Subscription.EMPTY;
3204
+ _this._cdr.markForCheck();
3205
+ });
3206
+ });
3207
+ };
3208
+ AjfFbNodeProperties.prototype._initVisibilityEdit = function () {
3209
+ var _this = this;
3210
+ this._editVisibilitySub =
3211
+ this._editVisibilityEvt
3212
+ .pipe(operators.withLatestFrom(this._propertiesForm))
3213
+ .subscribe(function (_a) {
3214
+ var _b = __read(_a, 2), _ = _b[0], formGroup = _b[1];
3215
+ _this._destroyConditionDialog();
3216
+ if (formGroup == null) {
3217
+ return;
3218
+ }
3219
+ var fg = formGroup;
3220
+ var ctrl = fg.controls['visibility'];
3221
+ var condition = ctrl.value;
3222
+ _this._editConditionDialog = _this._dialog.open(AjfFbConditionEditorDialog);
3223
+ _this._editConditionDialog.componentInstance.condition = condition;
3224
+ _this._editConditionDialogSub =
3225
+ _this._editConditionDialog.afterClosed().subscribe(function (cond) {
3226
+ if (cond !== void 0) {
3227
+ ctrl.setValue(cond);
3228
+ }
3229
+ _this._editConditionDialogSub.unsubscribe();
3230
+ _this._editConditionDialogSub = rxjs.Subscription.EMPTY;
3231
+ _this._cdr.markForCheck();
3232
+ });
3233
+ });
3234
+ };
3235
+ AjfFbNodeProperties.prototype._handleTriggerCondtionsChange = function (fg) {
3236
+ var _this = this;
3237
+ this._triggerConditionsSub = fg.valueChanges
3238
+ .pipe(operators.distinctUntilChanged(function (v1, v2) { return JSON.stringify(v1.triggerConditions) ===
3239
+ JSON.stringify(v2.triggerConditions); }))
3240
+ .subscribe(function (v) {
3241
+ _this._triggerConditions = v.triggerConditions;
3242
+ _this._cdr.markForCheck();
3243
+ });
3244
+ };
3245
+ AjfFbNodeProperties.prototype._handleWarningCondtionsChange = function (fg) {
3246
+ var _this = this;
3247
+ this._warningConditionsSub = fg.valueChanges
3248
+ .pipe(operators.distinctUntilChanged(function (v1, v2) { return JSON.stringify(v1.warningConditions) ===
3249
+ JSON.stringify(v2.warningConditions); }))
3250
+ .subscribe(function (v) {
3251
+ _this._warningConditions = v.warningConditions;
3252
+ _this._cdr.markForCheck();
3253
+ });
3254
+ };
3255
+ AjfFbNodeProperties.prototype._handleValidationCondtionsChange = function (fg) {
3256
+ var _this = this;
3257
+ this._validationConditionsSub =
3258
+ fg.valueChanges
3259
+ .pipe(operators.distinctUntilChanged(function (v1, v2) { return JSON.stringify(v1.validationConditions) ===
3260
+ JSON.stringify(v2.validationConditions); }))
3261
+ .subscribe(function (v) {
3262
+ _this._validationConditions = v.validationConditions;
3263
+ _this._cdr.markForCheck();
3264
+ });
3265
+ };
3266
+ AjfFbNodeProperties.prototype._handleForceValueChange = function (fg) {
3267
+ var _this = this;
3268
+ this._forceValueSub =
3269
+ fg.valueChanges.pipe(operators.distinctUntilChanged(function (v1, v2) { return v1.forceValue === v2.forceValue; }))
3270
+ .subscribe(function (v) {
3271
+ _this._curForceValue = v.forceValue;
3272
+ _this._cdr.markForCheck();
3273
+ });
3274
+ };
3275
+ AjfFbNodeProperties.prototype._handleNextSlideConditionChange = function (fg) {
3276
+ var _this = this;
3277
+ this._formulaSub =
3278
+ fg.valueChanges
3279
+ .pipe(operators.distinctUntilChanged(function (v1, v2) { return v1.nextSlideCondition === v2.nextSlideCondition; }))
3280
+ .subscribe(function (v) {
3281
+ _this._nextSlideCondition = v.nextSlideCondition;
3282
+ _this._cdr.markForCheck();
3283
+ });
3284
+ this._formulaSub =
3285
+ fg.valueChanges
3286
+ .pipe(operators.distinctUntilChanged(function (v1, v2) { return v1.nextSlideCondition === v2.nextSlideCondition; }))
3287
+ .subscribe(function (v) {
3288
+ _this._nextSlideCondition = v.nextSlideCondition;
3289
+ _this._cdr.markForCheck();
3290
+ });
3291
+ };
3292
+ AjfFbNodeProperties.prototype._handleFormulaChange = function (fg) {
3293
+ var _this = this;
3294
+ this._formulaSub =
3295
+ fg.valueChanges.pipe(operators.distinctUntilChanged(function (v1, v2) { return v1.formula === v2.formula; }))
3296
+ .subscribe(function (v) {
3297
+ _this._curFormula = v.formula;
3298
+ _this._cdr.markForCheck();
3299
+ });
3300
+ };
3301
+ AjfFbNodeProperties.prototype._handleFormulaRepsChange = function (fg) {
3302
+ var _this = this;
3303
+ this._formulaRepsSub =
3304
+ fg.valueChanges.pipe(operators.distinctUntilChanged(function (v1, v2) { return v1.formulaReps === v2.formulaReps; }))
3305
+ .subscribe(function (v) {
3306
+ _this._curFormulaReps = v.formulaReps;
3307
+ _this._cdr.markForCheck();
3308
+ });
3309
+ };
3310
+ AjfFbNodeProperties.prototype._handleChoicesFilterChange = function (fg) {
3311
+ var _this = this;
3312
+ this._choicesFilterSub =
3313
+ fg.valueChanges
3314
+ .pipe(operators.distinctUntilChanged(function (v1, v2) { return v1.choicesFilter === v2.choicesFilter; }))
3315
+ .subscribe(function (v) {
3316
+ _this._curChoicesFilter = v.choicesFilter;
3317
+ _this._cdr.markForCheck();
3318
+ });
3319
+ };
3320
+ AjfFbNodeProperties.prototype._handleConditionalBranchesChange = function (fg) {
3321
+ var _this = this;
3322
+ this._conditionalBranchesSub =
3323
+ fg.valueChanges
3324
+ .pipe(operators.distinctUntilChanged(function (v1, v2) { return v1.conditionalBranchesNum === v2.conditionalBranchesNum; }))
3325
+ .subscribe(function (v) {
3326
+ var cbNum = v.conditionalBranchesNum;
3327
+ var curCbNum = _this._conditionalBranches.length;
3328
+ if (curCbNum < cbNum) {
3329
+ var newCbs = [];
3330
+ for (var i = curCbNum; i < cbNum; i++) {
3331
+ newCbs.push(models.alwaysCondition().condition);
3332
+ }
3333
+ _this._conditionalBranches = _this._conditionalBranches.concat(newCbs);
3334
+ }
3335
+ else if (curCbNum > cbNum) {
3336
+ _this._conditionalBranches.splice(0, curCbNum - cbNum);
3337
+ }
3338
+ _this._cdr.markForCheck();
3339
+ });
3340
+ };
3341
+ AjfFbNodeProperties.prototype._handleVisibilityChange = function (fg) {
3342
+ var _this = this;
3343
+ this._visibilitySub =
3344
+ fg.valueChanges
3345
+ .pipe(operators.distinctUntilChanged(function (v1, v2) { return v1.visibilityOpt === v2.visibilityOpt; }))
3346
+ .subscribe(function (v) {
3347
+ var visibilityOpt = v.visibilityOpt;
3348
+ var newCondition;
3349
+ switch (visibilityOpt) {
3350
+ case 'always':
3351
+ newCondition = models.alwaysCondition().condition;
3352
+ break;
3353
+ case 'never':
3354
+ newCondition = models.neverCondition().condition;
3355
+ break;
3356
+ default:
3357
+ newCondition = null;
3358
+ }
3359
+ _this._curVisibility = newCondition;
3360
+ fg.controls['visibility'].setValue(newCondition);
3361
+ });
3362
+ this._visibilitySub = fg.valueChanges
3363
+ .pipe(operators.filter(function (v) { return v.visibilityOpt === 'condition'; }), operators.distinctUntilChanged(function (v1, v2) { return v1.visibility === v2.visibility; }))
3364
+ .subscribe(function (v) {
3365
+ _this._curVisibility = v.visibility;
3366
+ _this._cdr.markForCheck();
3367
+ });
3368
+ };
3369
+ AjfFbNodeProperties.prototype._guessVisibilityOpt = function (condition) {
3370
+ if (condition.condition.localeCompare(models.alwaysCondition().condition) === 0) {
3371
+ return 'always';
3372
+ }
3373
+ if (condition.condition.localeCompare(models.neverCondition().condition) === 0) {
3374
+ return 'never';
3375
+ }
3376
+ return 'condition';
3377
+ };
3378
+ return AjfFbNodeProperties;
3379
+ }());
3380
+ AjfFbNodeProperties.decorators = [
3381
+ { type: core.Component, args: [{
3382
+ selector: 'ajf-fb-node-properties',
3383
+ 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",
3384
+ encapsulation: core.ViewEncapsulation.None,
3385
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
3386
+ 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"]
3387
+ },] }
3388
+ ];
3389
+ AjfFbNodeProperties.ctorParameters = function () { return [
3390
+ { type: core.ChangeDetectorRef },
3391
+ { type: AjfFormBuilderService },
3392
+ { type: dialog.MatDialog },
3393
+ { type: forms$1.FormBuilder }
3394
+ ]; };
3395
+
3396
+ /**
3397
+ * @license
3398
+ * Copyright (C) Gnucoop soc. coop.
3399
+ *
3400
+ * This file is part of the Advanced JSON forms (ajf).
3401
+ *
3402
+ * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
3403
+ * modify it under the terms of the GNU Affero General Public License as
3404
+ * published by the Free Software Foundation, either version 3 of the License,
3405
+ * or (at your option) any later version.
3406
+ *
3407
+ * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
3408
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3409
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
3410
+ * General Public License for more details.
3411
+ *
3412
+ * You should have received a copy of the GNU Affero General Public License
3413
+ * along with Advanced JSON forms (ajf).
3414
+ * If not, see http://www.gnu.org/licenses/.
3415
+ *
3416
+ */
3417
+ var AjfFbNodeTypeEntry = /** @class */ (function () {
3418
+ function AjfFbNodeTypeEntry(_cdr) {
3419
+ this._cdr = _cdr;
3420
+ }
3421
+ Object.defineProperty(AjfFbNodeTypeEntry.prototype, "nodeType", {
3422
+ get: function () {
3423
+ return this._nodeType;
3424
+ },
3425
+ set: function (nodeType) {
3426
+ this._nodeType = nodeType;
3427
+ this._cdr.markForCheck();
3428
+ },
3429
+ enumerable: false,
3430
+ configurable: true
3431
+ });
3432
+ return AjfFbNodeTypeEntry;
3433
+ }());
3434
+ AjfFbNodeTypeEntry.decorators = [
3435
+ { type: core.Component, args: [{
3436
+ selector: 'ajf-fb-node-type-entry',
3437
+ 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",
3438
+ encapsulation: core.ViewEncapsulation.None,
3439
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
3440
+ styles: ["ajf-fb-node-type-entry{display:block;padding:1em 1.5em}ajf-fb-node-type-entry mat-icon{vertical-align:middle}\n"]
3441
+ },] }
3442
+ ];
3443
+ AjfFbNodeTypeEntry.ctorParameters = function () { return [
3444
+ { type: core.ChangeDetectorRef }
3445
+ ]; };
3446
+ AjfFbNodeTypeEntry.propDecorators = {
3447
+ nodeType: [{ type: core.Input }]
3448
+ };
3449
+
3450
+ /**
3451
+ * @license
3452
+ * Copyright (C) Gnucoop soc. coop.
3453
+ *
3454
+ * This file is part of the Advanced JSON forms (ajf).
3455
+ *
3456
+ * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
3457
+ * modify it under the terms of the GNU Affero General Public License as
3458
+ * published by the Free Software Foundation, either version 3 of the License,
3459
+ * or (at your option) any later version.
3460
+ *
3461
+ * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
3462
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3463
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
3464
+ * General Public License for more details.
3465
+ *
3466
+ * You should have received a copy of the GNU Affero General Public License
3467
+ * along with Advanced JSON forms (ajf).
3468
+ * If not, see http://www.gnu.org/licenses/.
3469
+ *
3470
+ */
3471
+ var AjfFormBuilderModule = /** @class */ (function () {
3472
+ function AjfFormBuilderModule() {
3473
+ }
3474
+ return AjfFormBuilderModule;
3475
+ }());
3476
+ AjfFormBuilderModule.decorators = [
3477
+ { type: core.NgModule, args: [{
3478
+ imports: [
3479
+ monacoEditor.AjfMonacoEditorModule, nodeIcon.AjfNodeIconModule, common.CommonModule, dragDrop.DragDropModule,
3480
+ forms$1.FormsModule, autocomplete.MatAutocompleteModule, button.MatButtonModule, card.MatCardModule,
3481
+ checkbox.MatCheckboxModule, chips.MatChipsModule, dialog.MatDialogModule, formField.MatFormFieldModule,
3482
+ icon.MatIconModule, input.MatInputModule, list.MatListModule, menu.MatMenuModule,
3483
+ select.MatSelectModule, sidenav.MatSidenavModule, slider.MatSliderModule, table.MatTableModule,
3484
+ toolbar.MatToolbarModule, tooltip.MatTooltipModule, forms$1.ReactiveFormsModule, transloco.AjfTranslocoModule,
3485
+ expansion.MatExpansionModule, slideToggle.MatSlideToggleModule,
3486
+ ],
3487
+ declarations: [
3488
+ AjfFbBranchLine,
3489
+ AjfFbChoicesOriginEditor,
3490
+ AjfFbChoicesOriginEditorDialog,
3491
+ AjfFbConditionEditor,
3492
+ AjfFbConditionEditorDialog,
3493
+ AjfFbNodeEntry,
3494
+ AjfFbNodeProperties,
3495
+ AjfFbNodeTypeEntry,
3496
+ AjfFbStringIdentifierDialogComponent,
3497
+ AjfFbValidationConditionEditorDialog,
3498
+ AjfFbWarningConditionEditorDialog,
3499
+ AjfFormBuilder,
3500
+ ],
3501
+ exports: [
3502
+ AjfFormBuilder,
3503
+ ],
3504
+ providers: [
3505
+ AjfFormBuilderService,
3506
+ ],
3507
+ },] }
3508
+ ];
3509
+
3510
+ /**
3511
+ * @license
3512
+ * Copyright (C) Gnucoop soc. coop.
3513
+ *
3514
+ * This file is part of the Advanced JSON forms (ajf).
3515
+ *
3516
+ * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
3517
+ * modify it under the terms of the GNU Affero General Public License as
3518
+ * published by the Free Software Foundation, either version 3 of the License,
3519
+ * or (at your option) any later version.
3520
+ *
3521
+ * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
3522
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3523
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
3524
+ * General Public License for more details.
3525
+ *
3526
+ * You should have received a copy of the GNU Affero General Public License
3527
+ * along with Advanced JSON forms (ajf).
3528
+ * If not, see http://www.gnu.org/licenses/.
3529
+ *
3530
+ */
3531
+
3532
+ /**
3533
+ * Generated bundle index. Do not edit.
3534
+ */
3535
+
3536
+ exports.AjfFormBuilder = AjfFormBuilder;
3537
+ exports.AjfFormBuilderModule = AjfFormBuilderModule;
3538
+ exports.AjfFormBuilderService = AjfFormBuilderService;
3539
+ exports.disableFieldDropPredicate = disableFieldDropPredicate;
3540
+ exports.disableSlideDropPredicate = disableSlideDropPredicate;
3541
+ exports.flattenNodes = flattenNodes;
3542
+ exports.onDropProcess = onDropProcess;
3543
+ exports.ɵgc_ajf_src_material_form_builder_form_builder_a = AjfFbBranchLine;
3544
+ exports.ɵgc_ajf_src_material_form_builder_form_builder_b = AjfFbChoicesOriginEditor;
3545
+ exports.ɵgc_ajf_src_material_form_builder_form_builder_c = AjfFbChoicesOriginEditorDialog;
3546
+ exports.ɵgc_ajf_src_material_form_builder_form_builder_d = AjfFbConditionEditor;
3547
+ exports.ɵgc_ajf_src_material_form_builder_form_builder_e = AjfFbConditionEditorDialog;
3548
+ exports.ɵgc_ajf_src_material_form_builder_form_builder_f = AjfFbNodeEntry;
3549
+ exports.ɵgc_ajf_src_material_form_builder_form_builder_g = AjfFbNodeProperties;
3550
+ exports.ɵgc_ajf_src_material_form_builder_form_builder_h = AjfFbNodeTypeEntry;
3551
+ exports.ɵgc_ajf_src_material_form_builder_form_builder_i = AjfFbStringIdentifierDialogComponent;
3552
+ exports.ɵgc_ajf_src_material_form_builder_form_builder_j = AjfFbValidationConditionEditorDialog;
3553
+ exports.ɵgc_ajf_src_material_form_builder_form_builder_k = AjfFbWarningConditionEditorDialog;
3554
+
3555
+ Object.defineProperty(exports, '__esModule', { value: true });
3556
+
3557
+ })));
3558
+ //# sourceMappingURL=material-form-builder.umd.js.map