@dereekb/dbx-form 0.0.1 → 1.0.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 (239) hide show
  1. package/{src/_index.scss → _index.scss} +8 -0
  2. package/esm2020/lib/form/action/form.action.directive.mjs +42 -40
  3. package/esm2020/lib/form/action/form.action.module.mjs +6 -6
  4. package/esm2020/lib/form/action/index.mjs +2 -1
  5. package/esm2020/lib/form/action/transition/form.action.transition.module.mjs +26 -0
  6. package/esm2020/lib/form/action/transition/form.action.transition.safety.directive.mjs +40 -0
  7. package/esm2020/lib/form/action/transition/index.mjs +3 -0
  8. package/esm2020/lib/form/form.mjs +11 -4
  9. package/esm2020/lib/form/form.module.mjs +13 -24
  10. package/esm2020/lib/form/index.mjs +2 -4
  11. package/esm2020/lib/form/io/form.changes.directive.mjs +34 -0
  12. package/esm2020/lib/form/io/form.input.directive.mjs +49 -0
  13. package/esm2020/lib/form/io/form.io.module.mjs +36 -0
  14. package/esm2020/lib/form/io/form.loading.directive.mjs +52 -0
  15. package/esm2020/lib/form/io/index.mjs +5 -0
  16. package/esm2020/lib/form.module.mjs +25 -0
  17. package/esm2020/lib/formly/config/index.mjs +2 -0
  18. package/esm2020/lib/formly/config/validation.mjs +22 -0
  19. package/esm2020/lib/formly/field/checklist/checklist.field.mjs +105 -0
  20. package/esm2020/lib/formly/field/checklist/checklist.item.field.component.mjs +28 -30
  21. package/esm2020/lib/formly/field/checklist/checklist.item.field.content.default.component.mjs +1 -1
  22. package/esm2020/lib/formly/field/checklist/checklist.item.field.mjs +8 -112
  23. package/esm2020/lib/formly/field/checklist/index.mjs +2 -1
  24. package/esm2020/lib/formly/field/component/component.field.component.mjs +7 -7
  25. package/esm2020/lib/formly/field/component/component.field.mjs +4 -2
  26. package/esm2020/lib/formly/field/field.mjs +35 -2
  27. package/esm2020/lib/formly/field/form.field.module.mjs +44 -0
  28. package/esm2020/lib/formly/field/index.mjs +3 -1
  29. package/esm2020/lib/formly/field/selection/index.mjs +2 -1
  30. package/esm2020/lib/formly/field/selection/pickable/index.mjs +2 -1
  31. package/esm2020/lib/formly/field/selection/pickable/pickable.chip.field.component.mjs +14 -12
  32. package/esm2020/lib/formly/field/selection/pickable/pickable.field.directive.mjs +40 -31
  33. package/esm2020/lib/formly/field/selection/pickable/pickable.field.mjs +39 -0
  34. package/esm2020/lib/formly/field/selection/pickable/pickable.field.module.mjs +22 -13
  35. package/esm2020/lib/formly/field/selection/pickable/pickable.list.field.component.mjs +75 -16
  36. package/esm2020/lib/formly/field/selection/searchable/searchable.chip.field.component.mjs +32 -15
  37. package/esm2020/lib/formly/field/selection/searchable/searchable.field.autocomplete.item.component.mjs +64 -50
  38. package/esm2020/lib/formly/field/selection/searchable/searchable.field.directive.mjs +69 -53
  39. package/esm2020/lib/formly/field/selection/searchable/searchable.field.mjs +30 -7
  40. package/esm2020/lib/formly/field/selection/searchable/searchable.field.module.mjs +8 -10
  41. package/esm2020/lib/formly/field/selection/searchable/searchable.mjs +1 -1
  42. package/esm2020/lib/formly/field/selection/searchable/searchable.text.field.component.mjs +35 -11
  43. package/esm2020/lib/formly/field/selection/searchable/text.chip.field.mjs +1 -1
  44. package/esm2020/lib/formly/field/selection/selection.mjs +1 -1
  45. package/esm2020/lib/formly/field/selection/selection.module.mjs +28 -0
  46. package/esm2020/lib/formly/field/texteditor/index.mjs +4 -0
  47. package/esm2020/lib/formly/field/texteditor/texteditor.field.component.mjs +90 -0
  48. package/esm2020/lib/formly/field/texteditor/texteditor.field.mjs +20 -0
  49. package/esm2020/lib/formly/field/texteditor/texteditor.field.module.mjs +59 -0
  50. package/esm2020/lib/formly/field/value/array/array.field.component.mjs +87 -51
  51. package/esm2020/lib/formly/field/value/array/array.field.mjs +20 -0
  52. package/esm2020/lib/formly/field/value/array/array.field.module.mjs +25 -7
  53. package/esm2020/lib/formly/field/value/array/index.mjs +2 -1
  54. package/esm2020/lib/formly/field/value/boolean/boolean.field.mjs +11 -20
  55. package/esm2020/lib/formly/field/value/date/date.field.module.mjs +9 -6
  56. package/esm2020/lib/formly/field/value/date/datetime.field.component.mjs +74 -44
  57. package/esm2020/lib/formly/field/value/date/datetime.field.mjs +36 -0
  58. package/esm2020/lib/formly/field/value/date/index.mjs +2 -2
  59. package/esm2020/lib/formly/field/value/enum/enum.field.mjs +1 -1
  60. package/esm2020/lib/formly/field/value/enum/enum.field.module.mjs +16 -0
  61. package/esm2020/lib/formly/field/value/enum/index.mjs +2 -1
  62. package/esm2020/lib/formly/field/value/hidden.field.mjs +1 -1
  63. package/esm2020/lib/formly/field/value/index.mjs +2 -1
  64. package/esm2020/lib/formly/field/value/phone/phone.field.component.mjs +13 -33
  65. package/esm2020/lib/formly/field/value/phone/phone.field.mjs +50 -52
  66. package/esm2020/lib/formly/field/value/phone/phone.field.module.mjs +15 -7
  67. package/esm2020/lib/formly/field/value/text/index.mjs +2 -1
  68. package/esm2020/lib/formly/field/value/text/text.additional.field.mjs +81 -0
  69. package/esm2020/lib/formly/field/value/text/text.address.field.mjs +16 -23
  70. package/esm2020/lib/formly/field/value/text/text.field.mjs +11 -110
  71. package/esm2020/lib/formly/field/value/text/text.field.module.mjs +9 -4
  72. package/esm2020/lib/formly/field/value/value.module.mjs +44 -0
  73. package/esm2020/lib/formly/field/wrapper/autotouch.wrapper.component.mjs +1 -1
  74. package/esm2020/lib/formly/field/wrapper/expandable.wrapper.component.mjs +12 -56
  75. package/esm2020/lib/formly/field/wrapper/expandable.wrapper.delegate.mjs +58 -0
  76. package/esm2020/lib/formly/field/wrapper/flex.wrapper.component.mjs +18 -8
  77. package/esm2020/lib/formly/field/wrapper/form.wrapper.module.mjs +43 -30
  78. package/esm2020/lib/formly/field/wrapper/index.mjs +3 -3
  79. package/esm2020/lib/formly/field/wrapper/info.wrapper.component.mjs +16 -16
  80. package/esm2020/lib/formly/field/wrapper/section.wrapper.component.mjs +17 -23
  81. package/esm2020/lib/formly/field/wrapper/style.wrapper.component.mjs +43 -0
  82. package/esm2020/lib/formly/field/wrapper/subsection.wrapper.component.mjs +17 -23
  83. package/esm2020/lib/formly/field/wrapper/toggle.wrapper.component.mjs +16 -20
  84. package/esm2020/lib/formly/field/wrapper/wrapper.mjs +81 -0
  85. package/esm2020/lib/formly/formly.context.directive.mjs +38 -0
  86. package/esm2020/lib/formly/formly.context.mjs +45 -70
  87. package/esm2020/lib/formly/formly.directive.mjs +9 -6
  88. package/esm2020/lib/formly/formly.form.component.mjs +127 -0
  89. package/esm2020/lib/formly/formly.module.mjs +11 -12
  90. package/esm2020/lib/formly/index.mjs +4 -2
  91. package/esm2020/lib/index.mjs +2 -1
  92. package/fesm2015/dereekb-dbx-form.mjs +1603 -898
  93. package/fesm2015/dereekb-dbx-form.mjs.map +1 -1
  94. package/fesm2020/dereekb-dbx-form.mjs +1650 -880
  95. package/fesm2020/dereekb-dbx-form.mjs.map +1 -1
  96. package/{src/lib → lib}/form/_form.scss +0 -0
  97. package/lib/form/action/form.action.directive.d.ts +3 -3
  98. package/lib/form/action/form.action.module.d.ts +4 -4
  99. package/lib/form/action/index.d.ts +1 -0
  100. package/lib/form/action/transition/form.action.transition.module.d.ts +8 -0
  101. package/lib/form/action/transition/form.action.transition.safety.directive.d.ts +20 -0
  102. package/lib/form/action/transition/index.d.ts +2 -0
  103. package/lib/form/form.d.ts +30 -19
  104. package/lib/form/form.module.d.ts +4 -5
  105. package/lib/form/index.d.ts +1 -3
  106. package/lib/form/{form.changes.directive.d.ts → io/form.changes.directive.d.ts} +1 -1
  107. package/lib/form/{form.input.directive.d.ts → io/form.input.directive.d.ts} +3 -3
  108. package/lib/form/io/form.io.module.d.ts +10 -0
  109. package/lib/form/io/form.loading.directive.d.ts +19 -0
  110. package/lib/form/io/index.d.ts +4 -0
  111. package/lib/form.module.d.ts +9 -0
  112. package/{src/lib → lib}/formly/_formly.scss +0 -0
  113. package/lib/formly/config/index.d.ts +1 -0
  114. package/lib/formly/config/validation.d.ts +19 -0
  115. package/{src/lib → lib}/formly/field/_field.scss +0 -0
  116. package/lib/formly/field/checklist/_checklist.scss +76 -0
  117. package/lib/formly/field/checklist/checklist.field.d.ts +45 -0
  118. package/lib/formly/field/checklist/checklist.item.field.component.d.ts +13 -12
  119. package/lib/formly/field/checklist/checklist.item.field.content.default.component.d.ts +1 -1
  120. package/lib/formly/field/checklist/checklist.item.field.d.ts +3 -47
  121. package/lib/formly/field/checklist/index.d.ts +1 -0
  122. package/{src/lib → lib}/formly/field/component/_component.scss +0 -0
  123. package/lib/formly/field/component/component.field.component.d.ts +6 -2
  124. package/lib/formly/field/field.d.ts +17 -3
  125. package/{src/lib → lib}/formly/field/fields_TODO.scss +0 -0
  126. package/lib/formly/field/form.field.module.d.ts +13 -0
  127. package/lib/formly/field/index.d.ts +2 -0
  128. package/{src/lib → lib}/formly/field/selection/_selection.scss +0 -0
  129. package/lib/formly/field/selection/index.d.ts +1 -0
  130. package/{src/lib → lib}/formly/field/selection/pickable/_pickable.scss +10 -1
  131. package/lib/formly/field/selection/pickable/index.d.ts +1 -0
  132. package/lib/formly/field/selection/pickable/pickable.chip.field.component.d.ts +3 -3
  133. package/lib/formly/field/selection/pickable/pickable.field.d.ts +13 -0
  134. package/lib/formly/field/selection/pickable/pickable.field.directive.d.ts +17 -13
  135. package/lib/formly/field/selection/pickable/pickable.field.module.d.ts +1 -1
  136. package/lib/formly/field/selection/pickable/pickable.list.field.component.d.ts +27 -3
  137. package/lib/formly/field/selection/searchable/_searchable.scss +59 -0
  138. package/lib/formly/field/selection/searchable/searchable.chip.field.component.d.ts +7 -1
  139. package/lib/formly/field/selection/searchable/searchable.d.ts +6 -8
  140. package/lib/formly/field/selection/searchable/searchable.field.autocomplete.item.component.d.ts +20 -14
  141. package/lib/formly/field/selection/searchable/searchable.field.d.ts +20 -11
  142. package/lib/formly/field/selection/searchable/searchable.field.directive.d.ts +33 -24
  143. package/lib/formly/field/selection/searchable/searchable.field.module.d.ts +1 -1
  144. package/lib/formly/field/selection/searchable/searchable.text.field.component.d.ts +11 -1
  145. package/lib/formly/field/selection/searchable/text.chip.field.d.ts +2 -2
  146. package/lib/formly/field/selection/selection.d.ts +1 -0
  147. package/lib/formly/field/selection/selection.module.d.ts +9 -0
  148. package/lib/formly/field/texteditor/_texteditor.scss +98 -0
  149. package/lib/formly/field/texteditor/index.d.ts +3 -0
  150. package/lib/formly/field/texteditor/texteditor.field.component.d.ts +26 -0
  151. package/lib/formly/field/texteditor/texteditor.field.d.ts +7 -0
  152. package/lib/formly/field/texteditor/texteditor.field.module.d.ts +14 -0
  153. package/{src/lib → lib}/formly/field/value/_value.scss +0 -0
  154. package/lib/formly/field/value/array/_array.scss +73 -0
  155. package/lib/formly/field/value/array/array.field.component.d.ts +22 -11
  156. package/lib/formly/field/value/array/array.field.d.ts +9 -0
  157. package/lib/formly/field/value/array/array.field.module.d.ts +6 -3
  158. package/lib/formly/field/value/array/index.d.ts +1 -0
  159. package/{src/lib → lib}/formly/field/value/boolean/_boolean.scss +0 -0
  160. package/lib/formly/field/value/boolean/boolean.field.d.ts +5 -5
  161. package/lib/formly/field/value/date/_date.scss +79 -0
  162. package/lib/formly/field/value/date/date.field.module.d.ts +2 -1
  163. package/lib/formly/field/value/date/datetime.field.component.d.ts +16 -13
  164. package/lib/formly/field/value/date/datetime.field.d.ts +14 -0
  165. package/lib/formly/field/value/date/index.d.ts +1 -1
  166. package/{src/lib → lib}/formly/field/value/enum/_enum.scss +0 -0
  167. package/lib/formly/field/value/enum/enum.field.d.ts +2 -2
  168. package/lib/formly/field/value/enum/enum.field.module.d.ts +6 -0
  169. package/lib/formly/field/value/enum/index.d.ts +1 -0
  170. package/lib/formly/field/value/hidden.field.d.ts +2 -2
  171. package/lib/formly/field/value/index.d.ts +1 -0
  172. package/lib/formly/field/value/phone/_phone.scss +55 -0
  173. package/lib/formly/field/value/phone/phone.field.component.d.ts +8 -14
  174. package/lib/formly/field/value/phone/phone.field.d.ts +20 -18
  175. package/lib/formly/field/value/phone/phone.field.module.d.ts +10 -8
  176. package/{src/lib → lib}/formly/field/value/text/_text.scss +0 -0
  177. package/lib/formly/field/value/text/index.d.ts +1 -0
  178. package/lib/formly/field/value/text/text.additional.field.d.ts +19 -0
  179. package/lib/formly/field/value/text/text.address.field.d.ts +8 -9
  180. package/lib/formly/field/value/text/text.field.d.ts +5 -33
  181. package/lib/formly/field/value/text/text.field.module.d.ts +3 -2
  182. package/lib/formly/field/value/value.module.d.ts +13 -0
  183. package/{src/lib → lib}/formly/field/wrapper/_wrapper.scss +15 -2
  184. package/lib/formly/field/wrapper/autotouch.wrapper.component.d.ts +2 -2
  185. package/lib/formly/field/wrapper/expandable.wrapper.component.d.ts +8 -37
  186. package/lib/formly/field/wrapper/expandable.wrapper.delegate.d.ts +36 -0
  187. package/lib/formly/field/wrapper/flex.wrapper.component.d.ts +19 -4
  188. package/lib/formly/field/wrapper/form.wrapper.module.d.ts +10 -8
  189. package/lib/formly/field/wrapper/index.d.ts +2 -2
  190. package/lib/formly/field/wrapper/info.wrapper.component.d.ts +9 -9
  191. package/lib/formly/field/wrapper/section.wrapper.component.d.ts +16 -5
  192. package/lib/formly/field/wrapper/style.wrapper.component.d.ts +22 -0
  193. package/lib/formly/field/wrapper/subsection.wrapper.component.d.ts +16 -5
  194. package/lib/formly/field/wrapper/toggle.wrapper.component.d.ts +6 -14
  195. package/lib/formly/field/wrapper/wrapper.d.ts +34 -0
  196. package/{src/lib → lib}/formly/form_TODO.scss +0 -0
  197. package/lib/formly/formly.context.d.ts +14 -22
  198. package/lib/formly/formly.context.directive.d.ts +17 -0
  199. package/lib/formly/formly.directive.d.ts +7 -3
  200. package/lib/formly/formly.form.component.d.ts +35 -0
  201. package/lib/formly/formly.module.d.ts +7 -6
  202. package/lib/formly/index.d.ts +3 -1
  203. package/lib/index.d.ts +1 -0
  204. package/{src/lib → lib}/layout/_layout.scss +0 -0
  205. package/{src/lib → lib}/style/_all-core.scss +0 -0
  206. package/{src/lib → lib}/style/_all-theme.scss +0 -0
  207. package/{src/lib → lib}/style/_all-typography.scss +0 -0
  208. package/{src/lib → lib}/style/_config.scss +0 -0
  209. package/{src/lib → lib}/style/_core.scss +0 -0
  210. package/{src/lib → lib}/style/_mixin.scss +0 -0
  211. package/{src/lib → lib}/style/_theming.scss +0 -0
  212. package/{src/lib → lib}/style/_variables.scss +0 -0
  213. package/package.json +14 -14
  214. package/esm2020/lib/form/form.changes.directive.mjs +0 -33
  215. package/esm2020/lib/form/form.input.directive.mjs +0 -49
  216. package/esm2020/lib/form/loading/form.loading.directive.mjs +0 -52
  217. package/esm2020/lib/form/loading/index.mjs +0 -2
  218. package/esm2020/lib/formly/field/value/date/date.field.mjs +0 -36
  219. package/esm2020/lib/formly/field/wrapper/flex.wrapper.layout.mjs +0 -20
  220. package/esm2020/lib/formly/field/wrapper/toggle.wrapper.mjs +0 -10
  221. package/esm2020/lib/formly/formly.component.mjs +0 -134
  222. package/lib/form/loading/form.loading.directive.d.ts +0 -19
  223. package/lib/form/loading/index.d.ts +0 -1
  224. package/lib/formly/field/value/date/date.field.d.ts +0 -13
  225. package/lib/formly/field/wrapper/flex.wrapper.layout.d.ts +0 -10
  226. package/lib/formly/field/wrapper/toggle.wrapper.d.ts +0 -7
  227. package/lib/formly/formly.component.d.ts +0 -36
  228. package/src/lib/formly/field/checklist/_checklist.scss +0 -26
  229. package/src/lib/formly/field/checklist/checklist.item_TODO.scss +0 -57
  230. package/src/lib/formly/field/selection/generic_TODO.scss +0 -36
  231. package/src/lib/formly/field/selection/searchable/_searchable.scss +0 -26
  232. package/src/lib/formly/field/texteditor/_texteditor.scss +0 -26
  233. package/src/lib/formly/field/texteditor/texteditor_TODO.scss +0 -32
  234. package/src/lib/formly/field/value/array/_array.scss +0 -26
  235. package/src/lib/formly/field/value/date/_date.scss +0 -26
  236. package/src/lib/formly/field/value/date/date_TODO.scss +0 -27
  237. package/src/lib/formly/field/value/phone/_phone.scss +0 -26
  238. package/src/lib/formly/field/value/phone/phone_TODO.scss +0 -10
  239. package/src/lib/formly/field/wrapper/wrapper_TODO.scss +0 -34
@@ -1,54 +1,62 @@
1
- import { MatDialogModule } from '@angular/material/dialog';
2
1
  import * as i0 from '@angular/core';
3
- import { forwardRef, Directive, Host, Input, NgModule, EventEmitter, Output, Component, ViewContainerRef, ViewChild } from '@angular/core';
2
+ import { forwardRef, Directive, Host, Input, NgModule, EventEmitter, Output, Component, ViewChild, InjectionToken, Inject, Optional } from '@angular/core';
4
3
  import * as i5 from '@angular/common';
5
4
  import { CommonModule } from '@angular/common';
6
- import { isPast, addSeconds, isSameMinute, isSameDay, startOfDay, addMinutes } from 'date-fns';
7
- import { of, combineLatest, BehaviorSubject, mergeMap, shareReplay as shareReplay$1, switchMap as switchMap$1, startWith, map as map$1, debounceTime as debounceTime$1, distinctUntilChanged as distinctUntilChanged$1, filter as filter$1, first as first$1, Subject, interval, merge } from 'rxjs';
8
- import { switchMap, first, catchError, filter, map, distinctUntilChanged, shareReplay, delay, startWith as startWith$1, debounceTime, mergeMap as mergeMap$1, tap, throttleTime } from 'rxjs/operators';
5
+ import * as i4 from '@angular/material/dialog';
6
+ import { MatDialogModule } from '@angular/material/dialog';
7
+ import * as i3 from '@uirouter/core';
9
8
  import * as i2 from '@dereekb/dbx-core';
10
- import { AbstractSubscriptionDirective, DbxInjectedComponentModule, DbxDatePipeModule } from '@dereekb/dbx-core';
11
- import { LockSet, SubscriptionObject, switchMapMaybeObs, filterMaybe, beginLoading, mapLoadingStateResults, successResult, LoadingStateContextInstance } from '@dereekb/rxjs';
9
+ import { AbstractSubscriptionDirective, safeDetectChanges, DbxInjectedComponentModule, DbxDatePipeModule, mergeDbxInjectedComponentConfigs, tapDetectChanges } from '@dereekb/dbx-core';
10
+ import * as i1$1 from '@dereekb/dbx-web';
11
+ import { DbxActionTransitionSafetyDirective, DbxTextModule, DbxFlexLayoutModule, DbxSectionLayoutModule, DbxAnchorModule, AbstractDbxSelectionListWrapperDirective, DEFAULT_LIST_WRAPPER_DIRECTIVE_TEMPLATE, AbstractSelectionValueListViewDirective, mapItemValuesToValueListItemConfig, ProvideDbxListView, AbstractDbxSelectionValueListViewItemComponent, DbxLoadingModule, DbxButtonModule, DbxListLayoutModule, mapCompactModeObs, DbxBarLayoutModule } from '@dereekb/dbx-web';
12
+ import { isPast, addSeconds, isSameMinute, startOfDay, isSameDay, addMinutes } from 'date-fns';
13
+ import { exhaustMap, of, combineLatest, filter as filter$1, mergeMap, first as first$1, delay, BehaviorSubject, switchMap as switchMap$1, shareReplay as shareReplay$1, startWith, map as map$1, debounceTime, distinctUntilChanged as distinctUntilChanged$1, Subject, skipWhile, interval, merge, throttleTime as throttleTime$1 } from 'rxjs';
14
+ import { switchMap, first, catchError, filter, map, distinctUntilChanged, shareReplay, delay as delay$1, debounceTime as debounceTime$1, startWith as startWith$1, tap, throttleTime } from 'rxjs/operators';
15
+ import { LockSet, SubscriptionObject, switchMapMaybeObs, filterMaybe, switchMapMaybeDefault, asObservable, beginLoading, mapLoadingStateResults, successResult, ListLoadingStateContextInstance, isListLoadingStateEmpty, LoadingStateContextInstance, skipFirstMaybe, scanCount } from '@dereekb/rxjs';
12
16
  import * as i1$4 from '@ngx-formly/core';
13
17
  import { FieldType, FieldWrapper, FormlyModule, FieldArrayType } from '@ngx-formly/core';
14
18
  import * as i1 from '@angular/material/checkbox';
15
19
  import { MatCheckboxModule } from '@angular/material/checkbox';
16
- import * as i1$1 from '@dereekb/dbx-web';
17
- import { DbxTextModule, DbxAnchorModule, DbxLoadingModule, DbxButtonModule } from '@dereekb/dbx-web';
18
20
  import * as i2$1 from '@angular/material/icon';
19
21
  import { MatIconModule } from '@angular/material/icon';
20
- import * as i3 from '@angular/forms';
22
+ import * as i4$1 from '@angular/forms';
21
23
  import { FormsModule, ReactiveFormsModule, FormControl, Validators, FormGroup } from '@angular/forms';
22
- import * as i2$2 from '@angular/material/core';
24
+ import * as i6 from '@angular/material/core';
23
25
  import { MatRippleModule, MatNativeDateModule } from '@angular/material/core';
24
26
  import * as i1$2 from '@angular/material/button';
25
27
  import { MatButtonModule } from '@angular/material/button';
26
28
  import * as i3$1 from '@angular/flex-layout/flex';
27
29
  import { FlexLayoutModule } from '@angular/flex-layout';
28
- import { hasValueOrNotEmpty, addPlusPrefixToNumber, convertMaybeToArray, makeValuesGroupMap, findUnique, separateValues, arrayToMap, concatArraysUnique } from '@dereekb/util';
30
+ import { objectIsEmpty, mergeObjects, filterFromPOJO, addPlusPrefixToNumber, convertMaybeToArray, makeValuesGroupMap, findUnique, mergeIntoArray, lastValue, separateValues, arrayToMap, getValueFromObjectOrGetter } from '@dereekb/util';
29
31
  import * as i1$3 from '@angular/material/slide-toggle';
30
32
  import { MatSlideToggleModule } from '@angular/material/slide-toggle';
31
- import * as i6 from '@angular/material/input';
32
- import { MatInputModule } from '@angular/material/input';
33
- import * as i5$1 from '@angular/material/chips';
33
+ import * as i2$2 from '@angular/flex-layout/extended';
34
+ import * as i6$1 from '@angular/material/input';
35
+ import { MatInputModule, MatInput } from '@angular/material/input';
36
+ import { FieldType as FieldType$1, FormlyMaterialModule } from '@ngx-formly/material';
37
+ import { camelCase } from 'change-case';
38
+ import * as i1$5 from '@angular/material/chips';
34
39
  import { MatChipsModule } from '@angular/material/chips';
35
- import * as i4 from '@angular/material/form-field';
36
- import { MatFormFieldModule } from '@angular/material/form-field';
37
- import * as i1$5 from '@angular/material/autocomplete';
40
+ import * as i4$2 from '@angular/material/divider';
41
+ import { MatDividerModule } from '@angular/material/divider';
42
+ import * as i4$3 from '@angular/material/autocomplete';
38
43
  import { MatAutocompleteModule } from '@angular/material/autocomplete';
39
- import * as i2$3 from '@angular/material/list';
40
44
  import { MatListModule } from '@angular/material/list';
41
- import { camelCase } from 'change-case';
45
+ import * as i3$2 from '@angular/material/form-field';
46
+ import { MatFormFieldModule } from '@angular/material/form-field';
42
47
  import { ENTER, COMMA } from '@angular/cdk/keycodes';
43
- import * as i3$2 from '@angular/material/divider';
44
- import { MatDividerModule } from '@angular/material/divider';
45
- import { guessCurrentTimezone, toReadableTimeString, utcDayForDate, readableTimeStringToDate, DateTimeMinuteInstance } from '@dereekb/date';
46
- import * as i4$1 from '@angular/material/datepicker';
48
+ import { skipUntilTimeElapsedAfterLastEmission, guessCurrentTimezone, toReadableTimeString, utcDayForDate, readableTimeStringToDate, DateTimeMinuteInstance } from '@dereekb/date';
49
+ import * as i2$3 from 'ngx-editor';
50
+ import { Editor, NgxEditorModule } from 'ngx-editor';
51
+ import * as i5$1 from '@angular/cdk/drag-drop';
52
+ import { DragDropModule } from '@angular/cdk/drag-drop';
53
+ import * as i4$4 from '@angular/material/datepicker';
47
54
  import { MatDatepickerModule } from '@angular/material/datepicker';
48
55
  import * as i5$2 from '@angular/material/menu';
49
56
  import { MatMenuModule } from '@angular/material/menu';
50
- import * as i2$4 from 'ngx-mat-intl-tel-input';
57
+ import * as i1$6 from 'ngx-mat-intl-tel-input';
51
58
  import { NgxMatIntlTelInputModule } from 'ngx-mat-intl-tel-input';
59
+ import { FormlyMatFormFieldModule } from '@ngx-formly/material/form-field';
52
60
  import { cloneDeep } from 'lodash';
53
61
  import { FormlyMatToggleModule } from '@ngx-formly/material/toggle';
54
62
 
@@ -58,18 +66,25 @@ import { FormlyMatToggleModule } from '@ngx-formly/material/toggle';
58
66
  var DbxFormState;
59
67
  (function (DbxFormState) {
60
68
  DbxFormState[DbxFormState["INITIALIZING"] = -1] = "INITIALIZING";
61
- DbxFormState[DbxFormState["INCOMPLETE"] = 0] = "INCOMPLETE";
62
- DbxFormState[DbxFormState["COMPLETE"] = 1] = "COMPLETE";
63
- DbxFormState[DbxFormState["RESET"] = 2] = "RESET";
69
+ DbxFormState[DbxFormState["RESET"] = 0] = "RESET";
70
+ DbxFormState[DbxFormState["USED"] = 1] = "USED";
64
71
  })(DbxFormState || (DbxFormState = {}));
65
72
  /**
66
73
  * Form that has an event stream, value, and state items.
67
74
  */
68
75
  class DbxForm {
69
76
  }
77
+ class DbxMutableForm extends DbxForm {
78
+ }
70
79
  function ProvideDbxForm(sourceType) {
71
80
  return [{ provide: DbxForm, useExisting: forwardRef(() => sourceType) }];
72
81
  }
82
+ function ProvideDbxMutableForm(sourceType) {
83
+ return [
84
+ ...ProvideDbxForm(sourceType),
85
+ { provide: DbxMutableForm, useExisting: forwardRef(() => sourceType) }
86
+ ];
87
+ }
73
88
 
74
89
  const APP_ACTION_FORM_DISABLED_KEY = 'actionForm';
75
90
  /**
@@ -93,23 +108,24 @@ class DbxActionFormDirective {
93
108
  }
94
109
  ngOnInit() {
95
110
  // Pass data from the form to the source when triggered.
96
- this._triggeredSub.subscription = this.source.triggered$.pipe(switchMap(() => {
111
+ this._triggeredSub.subscription = this.source.triggered$.pipe(switchMap(() => this.form.stream$.pipe(first(), exhaustMap(({ isComplete }) => {
97
112
  const doNothing = {}; // nothing, form not complete
98
- if (this.form.isComplete) {
99
- const value = this.form.value;
100
- return this.preCheckReadyValue(value).pipe(first(), switchMap((canContinue) => {
113
+ let obs;
114
+ if (isComplete) {
115
+ obs = this.form.getValue().pipe(first(), exhaustMap((value) => this.preCheckReadyValue(value).pipe(first(), switchMap((canContinue) => {
101
116
  if (canContinue) {
102
117
  return this.readyValue(value).pipe(first());
103
118
  }
104
119
  else {
105
120
  return of(doNothing);
106
121
  }
107
- }), catchError((error) => of({ error })));
122
+ }), catchError((error) => of({ error })))));
108
123
  }
109
124
  else {
110
- return of(doNothing);
125
+ obs = of(doNothing);
111
126
  }
112
- })).subscribe((result) => {
127
+ return obs;
128
+ })))).subscribe((result) => {
113
129
  if (result.reject) {
114
130
  this.source.reject(result.reject);
115
131
  }
@@ -122,34 +138,35 @@ class DbxActionFormDirective {
122
138
  });
123
139
  // Update the enabled/disabled state
124
140
  this._isCompleteSub.subscription = this.form.stream$.pipe(filter((x) => x.state !== DbxFormState.INITIALIZING), switchMap((event) => {
125
- // Use both changes count and whether or not something was in the past to guage whether or not the item has been touched.
126
- // Angular Form's untouched is whether or not focus has been lost but we can still recieve value updates.
127
- // More than a certain amount of updates implies that it is being typed into.
128
- const isProbablyTouched = !event.untouched ||
129
- ((event.changesCount ?? 0) > 3 && isPast(addSeconds(event.lastResetAt ?? new Date(), 2)));
130
- // console.log('Event: ', event, isProbablyTouched);
131
- const value = this.form.value;
132
- let validatorObs;
133
- const initialIsValidCheck = event.isComplete;
134
- if (initialIsValidCheck) {
135
- validatorObs = (this.appActionFormValidator) ? this.appActionFormValidator(value) : of(true);
136
- }
137
- else {
138
- validatorObs = of(false);
139
- }
140
- let modifiedObs;
141
- const isConsideredModified = (event.pristine === false && isProbablyTouched);
142
- if (isConsideredModified) {
143
- modifiedObs = (this.appActionFormModified) ? this.appActionFormModified(value) : of(true);
144
- }
145
- else {
146
- modifiedObs = of(false);
147
- }
148
- return combineLatest([
149
- validatorObs,
150
- modifiedObs
151
- ]).pipe(first(), map(([valid, modified]) => ({ valid, modified, event })));
152
- })).subscribe(({ valid, modified, event }) => {
141
+ return this.form.getValue().pipe(first(), exhaustMap((value) => {
142
+ // Use both changes count and whether or not something was in the past to guage whether or not the item has been touched.
143
+ // Angular Form's untouched is whether or not focus has been lost but we can still recieve value updates.
144
+ // More than a certain amount of updates implies that it is being typed into.
145
+ const isProbablyTouched = !event.untouched ||
146
+ ((event.changesCount ?? 0) > 3 && isPast(addSeconds(event.lastResetAt ?? new Date(), 2)));
147
+ let validatorObs;
148
+ const initialIsValidCheck = event.isComplete;
149
+ if (initialIsValidCheck) {
150
+ validatorObs = (this.appActionFormValidator) ? this.appActionFormValidator(value) : of(true);
151
+ }
152
+ else {
153
+ validatorObs = of(false);
154
+ }
155
+ let modifiedObs;
156
+ const isConsideredModified = (event.pristine === false && isProbablyTouched);
157
+ if (isConsideredModified) {
158
+ modifiedObs = (this.appActionFormModified) ? this.appActionFormModified(value) : of(true);
159
+ }
160
+ else {
161
+ modifiedObs = of(false);
162
+ }
163
+ return combineLatest([
164
+ validatorObs,
165
+ modifiedObs
166
+ ]).pipe(first(), map(([valid, modified]) => ({ valid, modified, value, event })));
167
+ }));
168
+ })).subscribe(({ valid, modified, value, event }) => {
169
+ // console.log('x: ', value, event, valid, modified);
153
170
  // Update Modified State
154
171
  this.source.setIsModified(modified);
155
172
  // Disable if the form is not yet complete/valid.
@@ -177,14 +194,14 @@ class DbxActionFormDirective {
177
194
  return of({ value });
178
195
  }
179
196
  }
180
- DbxActionFormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxActionFormDirective, deps: [{ token: DbxForm, host: true }, { token: i2.ActionContextStoreSourceInstance }], target: i0.ɵɵFactoryTarget.Directive });
197
+ DbxActionFormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxActionFormDirective, deps: [{ token: DbxMutableForm, host: true }, { token: i2.ActionContextStoreSourceInstance }], target: i0.ɵɵFactoryTarget.Directive });
181
198
  DbxActionFormDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: DbxActionFormDirective, selector: "[dbxActionForm]", inputs: { appActionFormValidator: "appActionFormValidator", appActionFormModified: "appActionFormModified" }, ngImport: i0 });
182
199
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxActionFormDirective, decorators: [{
183
200
  type: Directive,
184
201
  args: [{
185
202
  selector: '[dbxActionForm]'
186
203
  }]
187
- }], ctorParameters: function () { return [{ type: DbxForm, decorators: [{
204
+ }], ctorParameters: function () { return [{ type: DbxMutableForm, decorators: [{
188
205
  type: Host
189
206
  }] }, { type: i2.ActionContextStoreSourceInstance }]; }, propDecorators: { appActionFormValidator: [{
190
207
  type: Input
@@ -192,16 +209,67 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
192
209
  type: Input
193
210
  }] } });
194
211
 
195
- class DbxFormlyActionModule {
212
+ /**
213
+ * Extension of DbxActionTransitionSafetyDirective that forces the form to update first.
214
+ *
215
+ * NOTE: Only works with UIRouter
216
+ */
217
+ class DbxActionFormSafetyDirective extends DbxActionTransitionSafetyDirective {
218
+ constructor(appActionForm, source, transitionService, viewContainerRef, dialog) {
219
+ super(source, transitionService, viewContainerRef, dialog);
220
+ this.appActionForm = appActionForm;
221
+ }
222
+ _handleOnBeforeTransition(transition) {
223
+ this.appActionForm.form.forceFormUpdate();
224
+ return super._handleOnBeforeTransition(transition);
225
+ }
226
+ }
227
+ DbxActionFormSafetyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxActionFormSafetyDirective, deps: [{ token: DbxActionFormDirective, host: true }, { token: i2.ActionContextStoreSourceInstance }, { token: i3.TransitionService }, { token: i0.ViewContainerRef }, { token: i4.MatDialog }], target: i0.ɵɵFactoryTarget.Directive });
228
+ DbxActionFormSafetyDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: DbxActionFormSafetyDirective, selector: "[dbxActionFormSafety]", inputs: { inputSafetyType: ["dbxActionFormSafety", "inputSafetyType"] }, usesInheritance: true, ngImport: i0 });
229
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxActionFormSafetyDirective, decorators: [{
230
+ type: Directive,
231
+ args: [{
232
+ selector: '[dbxActionFormSafety]',
233
+ }]
234
+ }], ctorParameters: function () { return [{ type: DbxActionFormDirective, decorators: [{
235
+ type: Host
236
+ }] }, { type: i2.ActionContextStoreSourceInstance }, { type: i3.TransitionService }, { type: i0.ViewContainerRef }, { type: i4.MatDialog }]; }, propDecorators: { inputSafetyType: [{
237
+ type: Input,
238
+ args: ['dbxActionFormSafety']
239
+ }] } });
240
+
241
+ class DbxFormActionTransitionModule {
242
+ }
243
+ DbxFormActionTransitionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormActionTransitionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
244
+ DbxFormActionTransitionModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormActionTransitionModule, declarations: [DbxActionFormSafetyDirective], imports: [CommonModule], exports: [DbxActionFormSafetyDirective] });
245
+ DbxFormActionTransitionModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormActionTransitionModule, imports: [[
246
+ CommonModule
247
+ ]] });
248
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormActionTransitionModule, decorators: [{
249
+ type: NgModule,
250
+ args: [{
251
+ imports: [
252
+ CommonModule
253
+ ],
254
+ declarations: [
255
+ DbxActionFormSafetyDirective
256
+ ],
257
+ exports: [
258
+ DbxActionFormSafetyDirective
259
+ ]
260
+ }]
261
+ }] });
262
+
263
+ class DbxFormActionModule {
196
264
  }
197
- DbxFormlyActionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormlyActionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
198
- DbxFormlyActionModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormlyActionModule, declarations: [DbxActionFormDirective], imports: [CommonModule,
265
+ DbxFormActionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormActionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
266
+ DbxFormActionModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormActionModule, declarations: [DbxActionFormDirective], imports: [CommonModule,
199
267
  MatDialogModule], exports: [DbxActionFormDirective] });
200
- DbxFormlyActionModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormlyActionModule, imports: [[
268
+ DbxFormActionModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormActionModule, imports: [[
201
269
  CommonModule,
202
270
  MatDialogModule
203
271
  ]] });
204
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormlyActionModule, decorators: [{
272
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormActionModule, decorators: [{
205
273
  type: NgModule,
206
274
  args: [{
207
275
  imports: [
@@ -220,7 +288,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
220
288
  /**
221
289
  * Used with a FormComponent to set the value from a LoadingState when the value is available.
222
290
  */
223
- class DbxFormLoadingPairSourceDirective extends AbstractSubscriptionDirective {
291
+ class DbxFormLoadingSourceDirective extends AbstractSubscriptionDirective {
224
292
  constructor(form) {
225
293
  super();
226
294
  this.form = form;
@@ -248,18 +316,18 @@ class DbxFormLoadingPairSourceDirective extends AbstractSubscriptionDirective {
248
316
  this.sub = subscription;
249
317
  }
250
318
  }
251
- DbxFormLoadingPairSourceDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormLoadingPairSourceDirective, deps: [{ token: DbxForm, host: true }], target: i0.ɵɵFactoryTarget.Directive });
252
- DbxFormLoadingPairSourceDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: DbxFormLoadingPairSourceDirective, selector: "[dbxFormLoadingPairSource]", inputs: { obs: ["dbxFormLoadingPairSource", "obs"] }, usesInheritance: true, ngImport: i0 });
253
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormLoadingPairSourceDirective, decorators: [{
319
+ DbxFormLoadingSourceDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormLoadingSourceDirective, deps: [{ token: DbxMutableForm, host: true }], target: i0.ɵɵFactoryTarget.Directive });
320
+ DbxFormLoadingSourceDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: DbxFormLoadingSourceDirective, selector: "[dbxFormLoadingSource]", inputs: { obs: ["dbxFormLoadingSource", "obs"] }, usesInheritance: true, ngImport: i0 });
321
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormLoadingSourceDirective, decorators: [{
254
322
  type: Directive,
255
323
  args: [{
256
- selector: '[dbxFormLoadingPairSource]'
324
+ selector: '[dbxFormLoadingSource]'
257
325
  }]
258
- }], ctorParameters: function () { return [{ type: DbxForm, decorators: [{
326
+ }], ctorParameters: function () { return [{ type: DbxMutableForm, decorators: [{
259
327
  type: Host
260
328
  }] }]; }, propDecorators: { obs: [{
261
329
  type: Input,
262
- args: ['dbxFormLoadingPairSource']
330
+ args: ['dbxFormLoadingSource']
263
331
  }] } });
264
332
 
265
333
  /**
@@ -272,8 +340,8 @@ class DbxFormValueChangesDirective extends AbstractSubscriptionDirective {
272
340
  this.dbxFormValueChange = new EventEmitter();
273
341
  }
274
342
  ngOnInit() {
275
- this.sub = this.form.stream$.subscribe((x) => {
276
- this.dbxFormValueChange.next(this.form.value);
343
+ this.sub = this.form.stream$.pipe(filter$1(x => x.isComplete), mergeMap(() => this.form.getValue().pipe(first$1())), delay(0)).subscribe((value) => {
344
+ this.dbxFormValueChange.next(value);
277
345
  });
278
346
  }
279
347
  }
@@ -318,32 +386,32 @@ class DbxFormSourceDirective extends AbstractSubscriptionDirective {
318
386
  this.sub = subscription;
319
387
  }
320
388
  }
321
- DbxFormSourceDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormSourceDirective, deps: [{ token: DbxForm, host: true }], target: i0.ɵɵFactoryTarget.Directive });
389
+ DbxFormSourceDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormSourceDirective, deps: [{ token: DbxMutableForm, host: true }], target: i0.ɵɵFactoryTarget.Directive });
322
390
  DbxFormSourceDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: DbxFormSourceDirective, selector: "[dbxFormSource]", inputs: { obs: ["dbxFormSource", "obs"] }, usesInheritance: true, ngImport: i0 });
323
391
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormSourceDirective, decorators: [{
324
392
  type: Directive,
325
393
  args: [{
326
394
  selector: '[dbxFormSource]'
327
395
  }]
328
- }], ctorParameters: function () { return [{ type: DbxForm, decorators: [{
396
+ }], ctorParameters: function () { return [{ type: DbxMutableForm, decorators: [{
329
397
  type: Host
330
398
  }] }]; }, propDecorators: { obs: [{
331
399
  type: Input,
332
400
  args: ['dbxFormSource']
333
401
  }] } });
334
402
 
335
- class DbxFormModule {
403
+ class DbxFormIoModule {
336
404
  }
337
- DbxFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
338
- DbxFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormModule, declarations: [DbxFormSourceDirective,
405
+ DbxFormIoModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormIoModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
406
+ DbxFormIoModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormIoModule, declarations: [DbxFormSourceDirective,
339
407
  DbxFormValueChangesDirective,
340
- DbxFormLoadingPairSourceDirective], imports: [CommonModule], exports: [DbxFormSourceDirective,
408
+ DbxFormLoadingSourceDirective], imports: [CommonModule], exports: [DbxFormSourceDirective,
341
409
  DbxFormValueChangesDirective,
342
- DbxFormLoadingPairSourceDirective] });
343
- DbxFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormModule, imports: [[
410
+ DbxFormLoadingSourceDirective] });
411
+ DbxFormIoModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormIoModule, imports: [[
344
412
  CommonModule
345
413
  ]] });
346
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormModule, decorators: [{
414
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormIoModule, decorators: [{
347
415
  type: NgModule,
348
416
  args: [{
349
417
  imports: [
@@ -352,16 +420,58 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
352
420
  declarations: [
353
421
  DbxFormSourceDirective,
354
422
  DbxFormValueChangesDirective,
355
- DbxFormLoadingPairSourceDirective
423
+ DbxFormLoadingSourceDirective
356
424
  ],
357
425
  exports: [
358
426
  DbxFormSourceDirective,
359
427
  DbxFormValueChangesDirective,
360
- DbxFormLoadingPairSourceDirective
428
+ DbxFormLoadingSourceDirective
429
+ ]
430
+ }]
431
+ }] });
432
+
433
+ class DbxFormModule {
434
+ }
435
+ DbxFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
436
+ DbxFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormModule, exports: [DbxFormActionTransitionModule,
437
+ DbxFormActionModule,
438
+ DbxFormIoModule] });
439
+ DbxFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormModule, imports: [DbxFormActionTransitionModule,
440
+ DbxFormActionModule,
441
+ DbxFormIoModule] });
442
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormModule, decorators: [{
443
+ type: NgModule,
444
+ args: [{
445
+ exports: [
446
+ DbxFormActionTransitionModule,
447
+ DbxFormActionModule,
448
+ DbxFormIoModule
361
449
  ]
362
450
  }]
363
451
  }] });
364
452
 
453
+ function minLengthValidationMessage(err, field) {
454
+ return `Should have atleast ${field.templateOptions.minLength} characters`;
455
+ }
456
+ function maxLengthValidationMessage(err, field) {
457
+ return `This value should be less than ${field.templateOptions.maxLength} characters`;
458
+ }
459
+ function minValidationMessage(err, field) {
460
+ return `This value should be more than ${field.templateOptions.min}`;
461
+ }
462
+ function maxValidationMessage(err, field) {
463
+ return `This value should be less than ${field.templateOptions.max}`;
464
+ }
465
+ const REQUIRED_VALIDATION_MESSAGE = { name: 'required', message: 'This field is required' };
466
+ const MIN_LENGTH_VALIDATION_MESSAGE = { name: 'minlength', message: minLengthValidationMessage };
467
+ const MAX_LENGTH_VALIDATION_MESSAGE = { name: 'maxlength', message: maxLengthValidationMessage };
468
+ const MIN_VALIDATION_MESSAGE = { name: 'min', message: minValidationMessage };
469
+ const MAX_VALIDATION_MESSAGE = { name: 'max', message: maxValidationMessage };
470
+ const INVALID_PHONE_NUMBER_MESSAGE = { name: 'validatePhoneNumber', message: 'This is not a valid phone number.' };
471
+ function defaultValidationMessages() {
472
+ return [REQUIRED_VALIDATION_MESSAGE, MIN_LENGTH_VALIDATION_MESSAGE, MAX_LENGTH_VALIDATION_MESSAGE, MIN_VALIDATION_MESSAGE, MAX_VALIDATION_MESSAGE, INVALID_PHONE_NUMBER_MESSAGE];
473
+ }
474
+
365
475
  // MARK: Default
366
476
  class DbxDefaultChecklistItemFieldDisplayComponent {
367
477
  get label() {
@@ -408,7 +518,7 @@ class DbxChecklistItemFieldComponent extends FieldType {
408
518
  get formGroup() {
409
519
  return this.form;
410
520
  }
411
- get checkboxFieldKey() {
521
+ get formControlName() {
412
522
  return this.key;
413
523
  }
414
524
  get label() {
@@ -420,92 +530,88 @@ class DbxChecklistItemFieldComponent extends FieldType {
420
530
  get required() {
421
531
  return this.field.templateOptions?.required;
422
532
  }
533
+ get checklistField() {
534
+ return this.field.checklistField;
535
+ }
423
536
  get errors() {
424
537
  return this.field.formControl?.errors;
425
538
  }
426
539
  get componentClass() {
427
- return this.field.componentClass ?? DbxDefaultChecklistItemFieldDisplayComponent;
540
+ return this.checklistField.componentClass ?? DbxDefaultChecklistItemFieldDisplayComponent;
428
541
  }
429
542
  ngOnInit() {
430
- this._displayContent.next(this.field.displayContentObs);
543
+ this._displayContent.next(this.checklistField.displayContentObs);
431
544
  }
432
545
  ngOnDestroy() {
433
546
  this._displayContent.complete();
434
547
  }
435
548
  }
436
549
  DbxChecklistItemFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxChecklistItemFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
437
- DbxChecklistItemFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxChecklistItemFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div class=\"dbx-checklist-item-wrapper\" [formGroup]=\"formGroup\">\n <div *ngIf=\"label\" class=\"dbx-checklist-item-label\">{{ label }}</div>\n <div class=\"dbx-checklist-item\">\n <div class=\"dbx-checklist-item-check\">\n <mat-checkbox [formControlName]=\"checkboxFieldKey\"></mat-checkbox>\n </div>\n <div class=\"dbx-checklist-item-content-wrapper\">\n <dbx-anchor [block]=\"true\" [anchor]=\"anchor$ | async\">\n <div class=\"dbx-checklist-item-content\" matRipple [matRippleDisabled]=\"(rippleDisabled$ | async) ?? false\">\n <dbx-checklist-item-content-component></dbx-checklist-item-content-component>\n <span class=\"spacer\"></span>\n <mat-icon>navigate_next</mat-icon>\n </div>\n </dbx-anchor>\n </div>\n </div>\n <div *ngIf=\"description\" class=\"dbx-hint\">{{ description }}</div>\n</div>\n", components: [{ type: i0.forwardRef(function () { return i1.MatCheckbox; }), selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i0.forwardRef(function () { return i1$1.DbxAnchorComponent; }), selector: "dbx-anchor, [dbx-anchor]", inputs: ["block"] }, { type: i0.forwardRef(function () { return DbxChecklistItemContentComponent; }), selector: "dbx-checklist-item-content-component" }, { type: i0.forwardRef(function () { return i2$1.MatIcon; }), selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i0.forwardRef(function () { return i3.NgControlStatusGroup; }), selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i0.forwardRef(function () { return i3.FormGroupDirective; }), selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i0.forwardRef(function () { return i5.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i0.forwardRef(function () { return i3.NgControlStatus; }), selector: "[formControlName],[ngModel],[formControl]" }, { type: i0.forwardRef(function () { return i3.FormControlName; }), selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i0.forwardRef(function () { return i2$2.MatRipple; }), selector: "[mat-ripple], [matRipple]", inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"], exportAs: ["matRipple"] }], pipes: { "async": i0.forwardRef(function () { return i5.AsyncPipe; }) } });
550
+ DbxChecklistItemFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxChecklistItemFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div class=\"dbx-checklist-item-wrapper\" [formGroup]=\"formGroup\">\n <div *ngIf=\"label\" class=\"dbx-checklist-item-label\">{{ label }}</div>\n <div class=\"dbx-checklist-item\">\n <div class=\"dbx-checklist-item-check\">\n <mat-checkbox [formControlName]=\"formControlName\"></mat-checkbox>\n </div>\n <div class=\"dbx-checklist-item-content-wrapper\">\n <dbx-anchor [block]=\"true\" [anchor]=\"anchor$ | async\">\n <div class=\"dbx-checklist-item-content\" matRipple [matRippleDisabled]=\"(rippleDisabled$ | async) ?? false\">\n <dbx-checklist-item-content-component></dbx-checklist-item-content-component>\n <span class=\"spacer\"></span>\n <mat-icon *ngIf=\"!(rippleDisabled$ | async)\">navigate_next</mat-icon>\n </div>\n </dbx-anchor>\n </div>\n </div>\n <div *ngIf=\"description\" class=\"dbx-hint\">{{ description }}</div>\n</div>\n", components: [{ type: i0.forwardRef(function () { return i1.MatCheckbox; }), selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i0.forwardRef(function () { return i1$1.DbxAnchorComponent; }), selector: "dbx-anchor, [dbx-anchor]", inputs: ["block"] }, { type: i0.forwardRef(function () { return DbxChecklistItemContentComponent; }), selector: "dbx-checklist-item-content-component" }, { type: i0.forwardRef(function () { return i2$1.MatIcon; }), selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i0.forwardRef(function () { return i4$1.NgControlStatusGroup; }), selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i0.forwardRef(function () { return i4$1.FormGroupDirective; }), selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i0.forwardRef(function () { return i5.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i0.forwardRef(function () { return i4$1.NgControlStatus; }), selector: "[formControlName],[ngModel],[formControl]" }, { type: i0.forwardRef(function () { return i4$1.FormControlName; }), selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i0.forwardRef(function () { return i6.MatRipple; }), selector: "[mat-ripple], [matRipple]", inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"], exportAs: ["matRipple"] }], pipes: { "async": i0.forwardRef(function () { return i5.AsyncPipe; }) } });
438
551
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxChecklistItemFieldComponent, decorators: [{
439
552
  type: Component,
440
- args: [{ template: "<div class=\"dbx-checklist-item-wrapper\" [formGroup]=\"formGroup\">\n <div *ngIf=\"label\" class=\"dbx-checklist-item-label\">{{ label }}</div>\n <div class=\"dbx-checklist-item\">\n <div class=\"dbx-checklist-item-check\">\n <mat-checkbox [formControlName]=\"checkboxFieldKey\"></mat-checkbox>\n </div>\n <div class=\"dbx-checklist-item-content-wrapper\">\n <dbx-anchor [block]=\"true\" [anchor]=\"anchor$ | async\">\n <div class=\"dbx-checklist-item-content\" matRipple [matRippleDisabled]=\"(rippleDisabled$ | async) ?? false\">\n <dbx-checklist-item-content-component></dbx-checklist-item-content-component>\n <span class=\"spacer\"></span>\n <mat-icon>navigate_next</mat-icon>\n </div>\n </dbx-anchor>\n </div>\n </div>\n <div *ngIf=\"description\" class=\"dbx-hint\">{{ description }}</div>\n</div>\n" }]
553
+ args: [{ template: "<div class=\"dbx-checklist-item-wrapper\" [formGroup]=\"formGroup\">\n <div *ngIf=\"label\" class=\"dbx-checklist-item-label\">{{ label }}</div>\n <div class=\"dbx-checklist-item\">\n <div class=\"dbx-checklist-item-check\">\n <mat-checkbox [formControlName]=\"formControlName\"></mat-checkbox>\n </div>\n <div class=\"dbx-checklist-item-content-wrapper\">\n <dbx-anchor [block]=\"true\" [anchor]=\"anchor$ | async\">\n <div class=\"dbx-checklist-item-content\" matRipple [matRippleDisabled]=\"(rippleDisabled$ | async) ?? false\">\n <dbx-checklist-item-content-component></dbx-checklist-item-content-component>\n <span class=\"spacer\"></span>\n <mat-icon *ngIf=\"!(rippleDisabled$ | async)\">navigate_next</mat-icon>\n </div>\n </dbx-anchor>\n </div>\n </div>\n <div *ngIf=\"description\" class=\"dbx-hint\">{{ description }}</div>\n</div>\n" }]
441
554
  }] });
442
555
  class DbxChecklistItemContentComponent extends AbstractSubscriptionDirective {
443
- constructor(checklistItemFieldComponent, resolver, ngZone) {
556
+ constructor(checklistItemFieldComponent, cdRef) {
444
557
  super();
445
558
  this.checklistItemFieldComponent = checklistItemFieldComponent;
446
- this.resolver = resolver;
447
- this.ngZone = ngZone;
448
- this.displayContent$ = this.checklistItemFieldComponent.displayContent$;
449
- this.isLoading$ = this.checklistItemFieldComponent.displayContent$;
559
+ this.cdRef = cdRef;
450
560
  }
451
561
  ngOnInit() {
452
- this.contentRef.clear();
453
- const componentClass = this.checklistItemFieldComponent.componentClass;
454
- const componentRef = this.contentRef.createComponent(componentClass);
455
- this.sub = this.checklistItemFieldComponent.displayContent$.subscribe((x) => {
456
- this.ngZone.run(() => componentRef.instance.displayContent = x);
457
- });
562
+ this.config = {
563
+ componentClass: this.checklistItemFieldComponent.componentClass,
564
+ init: (instance) => {
565
+ this.checklistItemFieldComponent.displayContent$.subscribe((x) => {
566
+ instance.displayContent = x;
567
+ safeDetectChanges(this.cdRef);
568
+ });
569
+ }
570
+ };
458
571
  }
459
572
  }
460
- DbxChecklistItemContentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxChecklistItemContentComponent, deps: [{ token: DbxChecklistItemFieldComponent }, { token: i0.ComponentFactoryResolver }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
461
- DbxChecklistItemContentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxChecklistItemContentComponent, selector: "dbx-checklist-item-content-component", viewQueries: [{ propertyName: "contentRef", first: true, predicate: ["content"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0, template: `
462
- <ng-template #content></ng-template>
463
- `, isInline: true });
573
+ DbxChecklistItemContentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxChecklistItemContentComponent, deps: [{ token: DbxChecklistItemFieldComponent }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
574
+ DbxChecklistItemContentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxChecklistItemContentComponent, selector: "dbx-checklist-item-content-component", usesInheritance: true, ngImport: i0, template: `<dbx-injected-content [config]="config"></dbx-injected-content>`, isInline: true, components: [{ type: i2.DbxInjectedComponent, selector: "dbx-injected-content, [dbx-injected-content]", inputs: ["config", "template"] }] });
464
575
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxChecklistItemContentComponent, decorators: [{
465
576
  type: Component,
466
577
  args: [{
467
578
  selector: 'dbx-checklist-item-content-component',
468
- template: `
469
- <ng-template #content></ng-template>
470
- `
579
+ template: `<dbx-injected-content [config]="config"></dbx-injected-content>`
471
580
  }]
472
- }], ctorParameters: function () { return [{ type: DbxChecklistItemFieldComponent }, { type: i0.ComponentFactoryResolver }, { type: i0.NgZone }]; }, propDecorators: { contentRef: [{
473
- type: ViewChild,
474
- args: ['content', { static: true, read: ViewContainerRef }]
475
- }] } });
581
+ }], ctorParameters: function () { return [{ type: DbxChecklistItemFieldComponent }, { type: i0.ChangeDetectorRef }]; } });
476
582
 
477
- class FormInfoSectionWrapperComponent extends FieldWrapper {
478
- get infoSection() {
479
- return this.to.infoSection;
583
+ class DbxFormInfoWrapperComponent extends FieldWrapper {
584
+ get infoWrapper() {
585
+ return this.to.infoWrapper;
480
586
  }
481
587
  onInfoClick() {
482
- this.infoSection.onInfoClick();
588
+ this.infoWrapper.onInfoClick();
483
589
  }
484
590
  }
485
- FormInfoSectionWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: FormInfoSectionWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
486
- FormInfoSectionWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: FormInfoSectionWrapperComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
487
- <div class="form-info-section" fxLayout="row">
488
- <div class="form-info-section-content" fxFlex="grow">
591
+ DbxFormInfoWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormInfoWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
592
+ DbxFormInfoWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxFormInfoWrapperComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
593
+ <div class="dbx-form-info-wrapper" fxLayout="row">
594
+ <div class="dbx-form-info-wrapper-content" fxFlex="grow">
489
595
  <ng-container #fieldComponent></ng-container>
490
596
  </div>
491
- <div class="form-info-section-info" fxFlex="noshrink" fxLayout="column" fxLayoutAlign="center center">
492
- <button mat-icon-button [attr.aria-label]="'show info button for ' + to.label || 'section'"
597
+ <div class="dbx-form-info-wrapper-info" fxFlex="noshrink" fxLayout="column" fxLayoutAlign="center center">
598
+ <button mat-icon-button [attr.aria-label]="'show info button for ' + (to.label || 'section')"
493
599
  (click)="onInfoClick()">
494
600
  <mat-icon>info</mat-icon>
495
601
  </button>
496
602
  </div>
497
603
  </div>
498
604
  `, isInline: true, components: [{ type: i1$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i3$1.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { type: i3$1.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { type: i3$1.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }] });
499
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: FormInfoSectionWrapperComponent, decorators: [{
605
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormInfoWrapperComponent, decorators: [{
500
606
  type: Component,
501
607
  args: [{
502
608
  template: `
503
- <div class="form-info-section" fxLayout="row">
504
- <div class="form-info-section-content" fxFlex="grow">
609
+ <div class="dbx-form-info-wrapper" fxLayout="row">
610
+ <div class="dbx-form-info-wrapper-content" fxFlex="grow">
505
611
  <ng-container #fieldComponent></ng-container>
506
612
  </div>
507
- <div class="form-info-section-info" fxFlex="noshrink" fxLayout="column" fxLayoutAlign="center center">
508
- <button mat-icon-button [attr.aria-label]="'show info button for ' + to.label || 'section'"
613
+ <div class="dbx-form-info-wrapper-info" fxFlex="noshrink" fxLayout="column" fxLayoutAlign="center center">
614
+ <button mat-icon-button [attr.aria-label]="'show info button for ' + (to.label || 'section')"
509
615
  (click)="onInfoClick()">
510
616
  <mat-icon>info</mat-icon>
511
617
  </button>
@@ -515,93 +621,92 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
515
621
  }]
516
622
  }] });
517
623
 
518
- class FormSectionWrapperComponent extends FieldWrapper {
519
- get description() {
520
- return this.to.description;
624
+ class DbxFormSectionWrapperComponent extends FieldWrapper {
625
+ get header() {
626
+ return this.to.sectionWrapper?.header;
627
+ }
628
+ get hint() {
629
+ return this.to.sectionWrapper?.hint;
521
630
  }
522
631
  }
523
- FormSectionWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: FormSectionWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
524
- FormSectionWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: FormSectionWrapperComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
525
- <div class="form-section">
526
- <h3>{{ to.label }}</h3>
527
- <div class="form-section-content">
528
- <ng-container #fieldComponent></ng-container>
529
- </div>
530
- <dbx-hint *ngIf="description">{{ description }}</dbx-hint>
531
- </div>
532
- `, isInline: true, components: [{ type: i1$1.DbxHintComponent, selector: "dbx-hint" }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
533
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: FormSectionWrapperComponent, decorators: [{
632
+ DbxFormSectionWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormSectionWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
633
+ DbxFormSectionWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxFormSectionWrapperComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
634
+ <dbx-section [header]="header" [hint]="hint">
635
+ <ng-container #fieldComponent></ng-container>
636
+ </dbx-section>
637
+ `, isInline: true, components: [{ type: i1$1.DbxSectionComponent, selector: "dbx-section", inputs: ["elevated"] }] });
638
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormSectionWrapperComponent, decorators: [{
534
639
  type: Component,
535
640
  args: [{
536
641
  template: `
537
- <div class="form-section">
538
- <h3>{{ to.label }}</h3>
539
- <div class="form-section-content">
540
- <ng-container #fieldComponent></ng-container>
541
- </div>
542
- <dbx-hint *ngIf="description">{{ description }}</dbx-hint>
543
- </div>
642
+ <dbx-section [header]="header" [hint]="hint">
643
+ <ng-container #fieldComponent></ng-container>
644
+ </dbx-section>
544
645
  `
545
646
  }]
546
647
  }] });
547
648
 
548
- class FormFlexWrapperComponent extends FieldWrapper {
649
+ class DbxFormFlexWrapperComponent extends FieldWrapper {
650
+ get flexWrapper() {
651
+ return this.to.flexWrapper;
652
+ }
653
+ get breakpoint() {
654
+ return this.flexWrapper?.breakpoint;
655
+ }
656
+ get relative() {
657
+ return this.flexWrapper?.relative ?? false;
658
+ }
549
659
  }
550
- FormFlexWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: FormFlexWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
551
- FormFlexWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: FormFlexWrapperComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
552
- <div class="form-flex-section">
660
+ DbxFormFlexWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFlexWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
661
+ DbxFormFlexWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxFormFlexWrapperComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
662
+ <div class="dbx-form-flex-section" dbxFlexGroup [content]="false" [relative]="relative" [breakpoint]="breakpoint">
553
663
  <ng-container #fieldComponent></ng-container>
554
664
  </div>
555
- `, isInline: true });
556
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: FormFlexWrapperComponent, decorators: [{
665
+ `, isInline: true, directives: [{ type: i1$1.DbxFlexGroupDirective, selector: "[dbxFlexGroup]", inputs: ["content", "relative", "breakpoint"] }] });
666
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFlexWrapperComponent, decorators: [{
557
667
  type: Component,
558
668
  args: [{
559
669
  template: `
560
- <div class="form-flex-section">
670
+ <div class="dbx-form-flex-section" dbxFlexGroup [content]="false" [relative]="relative" [breakpoint]="breakpoint">
561
671
  <ng-container #fieldComponent></ng-container>
562
672
  </div>
563
673
  `
564
674
  }]
565
675
  }] });
566
676
 
567
- class FormSubsectionWrapperComponent extends FieldWrapper {
568
- get description() {
569
- return this.to.description;
677
+ class DbxFormSubsectionWrapperComponent extends FieldWrapper {
678
+ get header() {
679
+ return this.to.subsectionWrapper?.header;
680
+ }
681
+ get hint() {
682
+ return this.to.subsectionWrapper?.hint;
570
683
  }
571
684
  }
572
- FormSubsectionWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: FormSubsectionWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
573
- FormSubsectionWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: FormSubsectionWrapperComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
574
- <div class="form-section form-subsection">
575
- <h4>{{ to.label }}</h4>
576
- <div class="form-section-content">
577
- <ng-container #fieldComponent></ng-container>
578
- </div>
579
- <dbx-hint *ngIf="description"><small>{{ description }}</small></dbx-hint>
580
- </div>
581
- `, isInline: true, components: [{ type: i1$1.DbxHintComponent, selector: "dbx-hint" }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
582
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: FormSubsectionWrapperComponent, decorators: [{
685
+ DbxFormSubsectionWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormSubsectionWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
686
+ DbxFormSubsectionWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxFormSubsectionWrapperComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
687
+ <dbx-subsection [header]="header" [hint]="hint">
688
+ <ng-container #fieldComponent></ng-container>
689
+ </dbx-subsection>
690
+ `, isInline: true, components: [{ type: i1$1.DbxSubSectionComponent, selector: "dbx-subsection" }] });
691
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormSubsectionWrapperComponent, decorators: [{
583
692
  type: Component,
584
693
  args: [{
585
694
  template: `
586
- <div class="form-section form-subsection">
587
- <h4>{{ to.label }}</h4>
588
- <div class="form-section-content">
589
- <ng-container #fieldComponent></ng-container>
590
- </div>
591
- <dbx-hint *ngIf="description"><small>{{ description }}</small></dbx-hint>
592
- </div>
695
+ <dbx-subsection [header]="header" [hint]="hint">
696
+ <ng-container #fieldComponent></ng-container>
697
+ </dbx-subsection>
593
698
  `
594
699
  }]
595
700
  }] });
596
701
 
597
- const DEFAULT_HAS_VALUE_FN = hasValueOrNotEmpty;
702
+ const DEFAULT_HAS_VALUE_FN = (x) => !objectIsEmpty(x);
598
703
  class AbstractFormExpandableSectionWrapperDirective extends FieldWrapper {
599
704
  constructor() {
600
705
  super(...arguments);
601
706
  this._formControlObs = new BehaviorSubject(undefined);
602
707
  this.formControl$ = this._formControlObs.pipe(filterMaybe());
603
708
  this._toggleOpen = new BehaviorSubject(undefined);
604
- this.show$ = this._toggleOpen.pipe(mergeMap((toggleOpen) => {
709
+ this.show$ = this._toggleOpen.pipe(switchMap$1((toggleOpen) => {
605
710
  if (toggleOpen != null) {
606
711
  return of(toggleOpen);
607
712
  }
@@ -614,13 +719,20 @@ class AbstractFormExpandableSectionWrapperDirective extends FieldWrapper {
614
719
  }), shareReplay$1(1))));
615
720
  }
616
721
  get expandableSection() {
617
- return this.to.expandableSection;
722
+ return this.to.expandWrapper;
618
723
  }
619
724
  get hasValueFn() {
620
725
  return this.expandableSection?.hasValueFn ?? DEFAULT_HAS_VALUE_FN;
621
726
  }
622
727
  get expandLabel() {
623
- return this.expandableSection?.expandLabel ?? this.field?.templateOptions?.label ?? String(this.field?.key);
728
+ let label = this.expandableSection?.expandLabel ?? this.field?.templateOptions?.label;
729
+ if (label == null) {
730
+ const firstFieldGroup = this.field.fieldGroup?.[0];
731
+ if (firstFieldGroup) {
732
+ label = firstFieldGroup.templateOptions?.label ?? firstFieldGroup.key;
733
+ }
734
+ }
735
+ return label;
624
736
  }
625
737
  open() {
626
738
  this._toggleOpen.next(true);
@@ -638,23 +750,27 @@ AbstractFormExpandableSectionWrapperDirective.ɵdir = i0.ɵɵngDeclareDirective(
638
750
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AbstractFormExpandableSectionWrapperDirective, decorators: [{
639
751
  type: Directive
640
752
  }] });
753
+
641
754
  /**
642
755
  * Section that is expandable by a button until a value is set, or the button is pressed.
643
756
  */
644
- class FormExpandableSectionWrapperComponent extends AbstractFormExpandableSectionWrapperDirective {
757
+ class DbxFormExpandWrapperComponent extends AbstractFormExpandableSectionWrapperDirective {
758
+ get buttonType() {
759
+ return this.expandableSection?.buttonType ?? 'button';
760
+ }
645
761
  }
646
- FormExpandableSectionWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: FormExpandableSectionWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
647
- FormExpandableSectionWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: FormExpandableSectionWrapperComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
762
+ DbxFormExpandWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormExpandWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
763
+ DbxFormExpandWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxFormExpandWrapperComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
648
764
  <ng-container [ngSwitch]="show$ | async">
649
765
  <ng-container *ngSwitchCase="true">
650
766
  <ng-container #fieldComponent></ng-container>
651
767
  </ng-container>
652
768
  <ng-container *ngSwitchCase="false">
653
- <span class="form-expandable-section-button" (click)="open()">{{ expandLabel }}</span>
769
+ <span class="dbx-form-expandable-section-button" (click)="open()">{{ expandLabel }}</span>
654
770
  </ng-container>
655
771
  </ng-container>
656
772
  `, isInline: true, directives: [{ type: i5.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i5.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }], pipes: { "async": i5.AsyncPipe } });
657
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: FormExpandableSectionWrapperComponent, decorators: [{
773
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormExpandWrapperComponent, decorators: [{
658
774
  type: Component,
659
775
  args: [{
660
776
  template: `
@@ -663,7 +779,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
663
779
  <ng-container #fieldComponent></ng-container>
664
780
  </ng-container>
665
781
  <ng-container *ngSwitchCase="false">
666
- <span class="form-expandable-section-button" (click)="open()">{{ expandLabel }}</span>
782
+ <span class="dbx-form-expandable-section-button" (click)="open()">{{ expandLabel }}</span>
667
783
  </ng-container>
668
784
  </ng-container>
669
785
  `
@@ -675,7 +791,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
675
791
  */
676
792
  class AutoTouchFieldWrapperComponent extends FieldWrapper {
677
793
  ngOnInit() {
678
- this.formControl.valueChanges.pipe(delay(200)).subscribe(() => {
794
+ this.formControl.valueChanges.pipe(delay$1(200)).subscribe(() => {
679
795
  if (!this.formControl.pristine && this.formControl.untouched) {
680
796
  this.formControl.markAsTouched();
681
797
  this.formControl.updateValueAndValidity();
@@ -695,45 +811,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
695
811
  /**
696
812
  * Section that is expandable by a button until a value is set, or the button is pressed.
697
813
  */
698
- class FormToggleSectionWrapperComponent extends AbstractFormExpandableSectionWrapperDirective {
814
+ class DbxFormToggleWrapperComponent extends AbstractFormExpandableSectionWrapperDirective {
699
815
  constructor() {
700
816
  super(...arguments);
701
- this.$slideLabel = this._toggleOpen.pipe(switchMap(x => {
702
- if (this.toggleSection?.toggleLabelObs) {
703
- return this.toggleSection?.toggleLabelObs(x);
817
+ this.slideLabel$ = this._toggleOpen.pipe(switchMap$1(x => {
818
+ if (this.expandableSection?.toggleLabelObs) {
819
+ return this.expandableSection?.toggleLabelObs(x);
704
820
  }
705
821
  else {
706
822
  return of(this.expandLabel);
707
823
  }
708
- }), shareReplay(1));
709
- }
710
- get toggleSection() {
711
- return this.to.toggleSection;
824
+ }), shareReplay$1(1));
712
825
  }
713
826
  onToggleChange() {
714
- this.show$.pipe(first()).subscribe((show) => {
827
+ this.show$.pipe(first$1()).subscribe((show) => {
715
828
  this._toggleOpen.next(!show);
716
829
  });
717
830
  }
718
831
  }
719
- FormToggleSectionWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: FormToggleSectionWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
720
- FormToggleSectionWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: FormToggleSectionWrapperComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
721
- <div class="form-toggle-wrapper" [ngSwitch]="show$ | async">
722
- <div class="form-toggle-wrapper-toggle">
723
- <mat-slide-toggle [checked]="show$ | async" (toggleChange)="onToggleChange()">{{ $slideLabel | async }}</mat-slide-toggle>
832
+ DbxFormToggleWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormToggleWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
833
+ DbxFormToggleWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxFormToggleWrapperComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
834
+ <div class="dbx-form-toggle-wrapper" [ngSwitch]="show$ | async">
835
+ <div class="dbx-form-toggle-wrapper-toggle">
836
+ <mat-slide-toggle [checked]="show$ | async" (toggleChange)="onToggleChange()">{{ slideLabel$ | async }}</mat-slide-toggle>
724
837
  </div>
725
838
  <ng-container *ngSwitchCase="true">
726
839
  <ng-container #fieldComponent></ng-container>
727
840
  </ng-container>
728
841
  </div>
729
842
  `, isInline: true, components: [{ type: i1$3.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["disabled", "disableRipple", "color", "tabIndex", "name", "id", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "checked"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }], directives: [{ type: i5.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i5.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }], pipes: { "async": i5.AsyncPipe } });
730
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: FormToggleSectionWrapperComponent, decorators: [{
843
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormToggleWrapperComponent, decorators: [{
731
844
  type: Component,
732
845
  args: [{
733
846
  template: `
734
- <div class="form-toggle-wrapper" [ngSwitch]="show$ | async">
735
- <div class="form-toggle-wrapper-toggle">
736
- <mat-slide-toggle [checked]="show$ | async" (toggleChange)="onToggleChange()">{{ $slideLabel | async }}</mat-slide-toggle>
847
+ <div class="dbx-form-toggle-wrapper" [ngSwitch]="show$ | async">
848
+ <div class="dbx-form-toggle-wrapper-toggle">
849
+ <mat-slide-toggle [checked]="show$ | async" (toggleChange)="onToggleChange()">{{ slideLabel$ | async }}</mat-slide-toggle>
737
850
  </div>
738
851
  <ng-container *ngSwitchCase="true">
739
852
  <ng-container #fieldComponent></ng-container>
@@ -743,16 +856,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
743
856
  }]
744
857
  }] });
745
858
 
859
+ class DbxFormStyleWrapperComponent extends FieldWrapper {
860
+ constructor() {
861
+ super(...arguments);
862
+ this._style = new BehaviorSubject(undefined);
863
+ this.style$ = this._style.pipe(switchMapMaybeDefault(''), shareReplay$1(1));
864
+ }
865
+ get styleWrapper() {
866
+ return this.field.styleWrapper;
867
+ }
868
+ get styleGetter() {
869
+ return this.styleWrapper.style;
870
+ }
871
+ ngOnInit() {
872
+ this._style.next(asObservable(this.styleGetter));
873
+ }
874
+ ngOnDestroy() {
875
+ this._style.complete();
876
+ }
877
+ }
878
+ DbxFormStyleWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormStyleWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
879
+ DbxFormStyleWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxFormStyleWrapperComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
880
+ <div [ngClass]="(style$ | async) ?? ''">
881
+ <ng-container #fieldComponent></ng-container>
882
+ </div>
883
+ `, isInline: true, directives: [{ type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2$2.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }], pipes: { "async": i5.AsyncPipe } });
884
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormStyleWrapperComponent, decorators: [{
885
+ type: Component,
886
+ args: [{
887
+ template: `
888
+ <div [ngClass]="(style$ | async) ?? ''">
889
+ <ng-container #fieldComponent></ng-container>
890
+ </div>
891
+ `
892
+ }]
893
+ }] });
894
+
746
895
  class DbxFormFormlyWrapperModule {
747
896
  }
748
897
  DbxFormFormlyWrapperModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyWrapperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
749
898
  DbxFormFormlyWrapperModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyWrapperModule, declarations: [AutoTouchFieldWrapperComponent,
750
- FormSectionWrapperComponent,
751
- FormSubsectionWrapperComponent,
752
- FormInfoSectionWrapperComponent,
753
- FormExpandableSectionWrapperComponent,
754
- FormToggleSectionWrapperComponent], imports: [CommonModule,
899
+ DbxFormSectionWrapperComponent,
900
+ DbxFormSubsectionWrapperComponent,
901
+ DbxFormInfoWrapperComponent,
902
+ DbxFormExpandWrapperComponent,
903
+ DbxFormToggleWrapperComponent,
904
+ DbxFormFlexWrapperComponent,
905
+ DbxFormStyleWrapperComponent], imports: [CommonModule,
755
906
  DbxTextModule,
907
+ DbxFlexLayoutModule,
908
+ DbxSectionLayoutModule,
756
909
  MatButtonModule,
757
910
  MatSlideToggleModule,
758
911
  MatIconModule,
@@ -760,6 +913,8 @@ DbxFormFormlyWrapperModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.
760
913
  DbxFormFormlyWrapperModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyWrapperModule, imports: [[
761
914
  CommonModule,
762
915
  DbxTextModule,
916
+ DbxFlexLayoutModule,
917
+ DbxSectionLayoutModule,
763
918
  MatButtonModule,
764
919
  MatSlideToggleModule,
765
920
  MatIconModule,
@@ -767,12 +922,13 @@ DbxFormFormlyWrapperModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
767
922
  FormlyModule.forChild({
768
923
  wrappers: [
769
924
  { name: 'autotouch', component: AutoTouchFieldWrapperComponent },
770
- { name: 'expandable', component: FormExpandableSectionWrapperComponent },
771
- { name: 'toggle', component: FormToggleSectionWrapperComponent },
772
- { name: 'section', component: FormSectionWrapperComponent },
773
- { name: 'subsection', component: FormSubsectionWrapperComponent },
774
- { name: 'info', component: FormInfoSectionWrapperComponent },
775
- { name: 'flex', component: FormFlexWrapperComponent }
925
+ { name: 'expandable', component: DbxFormExpandWrapperComponent },
926
+ { name: 'toggle', component: DbxFormToggleWrapperComponent },
927
+ { name: 'section', component: DbxFormSectionWrapperComponent },
928
+ { name: 'subsection', component: DbxFormSubsectionWrapperComponent },
929
+ { name: 'info', component: DbxFormInfoWrapperComponent },
930
+ { name: 'flex', component: DbxFormFlexWrapperComponent },
931
+ { name: 'style', component: DbxFormStyleWrapperComponent }
776
932
  ]
777
933
  })
778
934
  ]] });
@@ -782,6 +938,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
782
938
  imports: [
783
939
  CommonModule,
784
940
  DbxTextModule,
941
+ DbxFlexLayoutModule,
942
+ DbxSectionLayoutModule,
785
943
  MatButtonModule,
786
944
  MatSlideToggleModule,
787
945
  MatIconModule,
@@ -789,22 +947,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
789
947
  FormlyModule.forChild({
790
948
  wrappers: [
791
949
  { name: 'autotouch', component: AutoTouchFieldWrapperComponent },
792
- { name: 'expandable', component: FormExpandableSectionWrapperComponent },
793
- { name: 'toggle', component: FormToggleSectionWrapperComponent },
794
- { name: 'section', component: FormSectionWrapperComponent },
795
- { name: 'subsection', component: FormSubsectionWrapperComponent },
796
- { name: 'info', component: FormInfoSectionWrapperComponent },
797
- { name: 'flex', component: FormFlexWrapperComponent }
950
+ { name: 'expandable', component: DbxFormExpandWrapperComponent },
951
+ { name: 'toggle', component: DbxFormToggleWrapperComponent },
952
+ { name: 'section', component: DbxFormSectionWrapperComponent },
953
+ { name: 'subsection', component: DbxFormSubsectionWrapperComponent },
954
+ { name: 'info', component: DbxFormInfoWrapperComponent },
955
+ { name: 'flex', component: DbxFormFlexWrapperComponent },
956
+ { name: 'style', component: DbxFormStyleWrapperComponent }
798
957
  ]
799
958
  })
800
959
  ],
801
960
  declarations: [
802
961
  AutoTouchFieldWrapperComponent,
803
- FormSectionWrapperComponent,
804
- FormSubsectionWrapperComponent,
805
- FormInfoSectionWrapperComponent,
806
- FormExpandableSectionWrapperComponent,
807
- FormToggleSectionWrapperComponent
962
+ DbxFormSectionWrapperComponent,
963
+ DbxFormSubsectionWrapperComponent,
964
+ DbxFormInfoWrapperComponent,
965
+ DbxFormExpandWrapperComponent,
966
+ DbxFormToggleWrapperComponent,
967
+ DbxFormFlexWrapperComponent,
968
+ DbxFormStyleWrapperComponent
808
969
  ],
809
970
  exports: []
810
971
  }]
@@ -886,10 +1047,42 @@ function formlyField(fieldConfig) {
886
1047
  }
887
1048
  return fieldConfig;
888
1049
  }
1050
+ function templateOptionsForFieldConfig(fieldConfig, override) {
1051
+ const templateOptions = templateOptionsValueForFieldConfig(fieldConfig, override);
1052
+ return {
1053
+ templateOptions
1054
+ };
1055
+ }
1056
+ function templateOptionsValueForFieldConfig(fieldConfig, override) {
1057
+ const { label, placeholder, required, readonly, description, autocomplete } = mergeObjects([fieldConfig, override], { keysFilter: ['label', 'placeholder', 'required', 'readonly', 'description', 'autocomplete'] });
1058
+ const attributes = mergeObjects([fieldConfig.attributes, override?.attributes]);
1059
+ const result = filterFromPOJO({
1060
+ ...override,
1061
+ label,
1062
+ placeholder,
1063
+ required,
1064
+ readonly,
1065
+ description,
1066
+ attributes
1067
+ });
1068
+ // Apply autocomplete
1069
+ if (autocomplete != null) {
1070
+ if (autocomplete === false) {
1071
+ result.attributes = {
1072
+ ...result.attributes,
1073
+ ...disableFormlyFieldAutofillAttributes()
1074
+ };
1075
+ }
1076
+ else {
1077
+ result.attributes['autocomplete'] = autocomplete;
1078
+ }
1079
+ }
1080
+ return result;
1081
+ }
889
1082
  /**
890
1083
  * Returns configuration for a formlyField that will disable autofill/autocomplete for a field.
891
1084
  */
892
- function disableFormlyFieldAutofill() {
1085
+ function disableFormlyFieldAutofillAttributes() {
893
1086
  // https://stackoverflow.com/questions/15738259/disabling-chrome-autofill
894
1087
  return {
895
1088
  name: 'password',
@@ -897,20 +1090,20 @@ function disableFormlyFieldAutofill() {
897
1090
  };
898
1091
  }
899
1092
 
900
- function checklistItemField({ key, label = '', placeholder = '', displayContentObs, componentClass, required = false }) {
1093
+ function checklistItemField(config) {
1094
+ const { key, displayContentObs, componentClass } = config;
901
1095
  const fieldConfig = formlyField({
902
1096
  key,
903
1097
  type: 'checklistitem',
904
- templateOptions: {
905
- label,
906
- placeholder,
907
- required
1098
+ checklistField: {
1099
+ displayContentObs,
1100
+ componentClass
908
1101
  },
909
- displayContentObs,
910
- componentClass
1102
+ ...templateOptionsForFieldConfig(config)
911
1103
  });
912
1104
  return fieldConfig;
913
1105
  }
1106
+
914
1107
  /**
915
1108
  * Used for building a set of configurations for a data-type object that has as second object that is used as a checklist.
916
1109
  */
@@ -1015,22 +1208,22 @@ class ChecklistItemFieldDataSetBuilder {
1015
1208
  class AbstractFormComponentFieldWrappedComponent {
1016
1209
  }
1017
1210
  class FormComponentFieldComponent extends FieldType {
1018
- constructor() {
1019
- super();
1020
- }
1021
1211
  get config() {
1022
1212
  return this._config;
1023
1213
  }
1214
+ get componentField() {
1215
+ return this.field.componentField;
1216
+ }
1024
1217
  ngOnInit() {
1025
1218
  this._config = {
1026
- componentClass: this.field.componentClass,
1219
+ componentClass: this.componentField.componentClass,
1027
1220
  init: (instance) => {
1028
1221
  instance.field = this;
1029
1222
  }
1030
1223
  };
1031
1224
  }
1032
1225
  }
1033
- FormComponentFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: FormComponentFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1226
+ FormComponentFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: FormComponentFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1034
1227
  FormComponentFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: FormComponentFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
1035
1228
  <div class="form-wrapped-component" dbx-injected-content [config]="config"></div>
1036
1229
  `, isInline: true, components: [{ type: i2.DbxInjectedComponent, selector: "dbx-injected-content, [dbx-injected-content]", inputs: ["config", "template"] }] });
@@ -1041,7 +1234,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
1041
1234
  <div class="form-wrapped-component" dbx-injected-content [config]="config"></div>
1042
1235
  `
1043
1236
  }]
1044
- }], ctorParameters: function () { return []; } });
1237
+ }] });
1045
1238
 
1046
1239
  class DbxFormFormlyComponentFieldModule {
1047
1240
  }
@@ -1081,33 +1274,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
1081
1274
  function componentField({ componentClass }) {
1082
1275
  return {
1083
1276
  type: 'component',
1084
- componentClass
1277
+ componentField: {
1278
+ componentClass
1279
+ }
1085
1280
  };
1086
1281
  }
1087
1282
 
1088
1283
  /**
1089
1284
  * Used for picking pre-set values using items as the presentation.
1090
1285
  */
1091
- class AbstractDbxPickableItemFieldDirective extends FieldType {
1286
+ class AbstractDbxPickableItemFieldDirective extends FieldType$1 {
1092
1287
  constructor() {
1093
1288
  super(...arguments);
1094
1289
  this.inputCtrl = new FormControl('');
1095
1290
  this._formControlObs = new BehaviorSubject(undefined);
1096
1291
  this.formControl$ = this._formControlObs.pipe(filterMaybe());
1097
1292
  this._displayHashMap = new BehaviorSubject(new Map());
1098
- this.filterInputValue$ = this.inputCtrl.valueChanges.pipe(startWith$1(undefined));
1099
- this.filterInputValueString$ = this.filterInputValue$.pipe(debounceTime(200), distinctUntilChanged(), shareReplay(1));
1100
- this.loadResultsDisplayValuesState$ = this.formControl$.pipe(first(), switchMap(() => this.loadValuesFn().pipe(switchMap((x) => this.loadDisplayValuesForFieldValues(x)), startWith$1(beginLoading()))), shareReplay(1));
1101
- this._formControlValue = this.formControl$.pipe(switchMap(control => control.valueChanges.pipe(startWith$1(control.value), shareReplay(1))));
1102
- this.loadResultsDisplayValues$ = this.loadResultsDisplayValuesState$.pipe(map(x => x?.value ?? []));
1293
+ this.filterInputValue$ = this.inputCtrl.valueChanges.pipe(startWith(undefined));
1294
+ this.filterInputValueString$ = this.filterInputValue$.pipe(debounceTime(200), distinctUntilChanged$1(), shareReplay$1(1));
1295
+ this.loadResultsDisplayValuesState$ = this.formControl$.pipe(first$1(), switchMap$1(() => this.loadValuesFn().pipe(switchMap$1((x) => this.loadDisplayValuesForFieldValues(x)), startWith(beginLoading()))), shareReplay$1(1));
1296
+ this._formControlValue = this.formControl$.pipe(switchMap$1(control => control.valueChanges.pipe(startWith(control.value), shareReplay$1(1))));
1297
+ this.loadResultsDisplayValues$ = this.loadResultsDisplayValuesState$.pipe(map$1(x => x?.value ?? []));
1103
1298
  /**
1104
1299
  * Current values in the form control.
1105
1300
  */
1106
- this.values$ = this._formControlValue.pipe(map(convertMaybeToArray), shareReplay(1));
1301
+ this.values$ = this._formControlValue.pipe(map$1(convertMaybeToArray), shareReplay$1(1));
1107
1302
  /**
1108
1303
  * Current values with their display value.
1109
1304
  */
1110
- this.displayValuesState$ = combineLatest([this.loadResultsDisplayValues$, this.values$]).pipe(switchMap(([displayValues, currentValues]) => {
1305
+ this.displayValuesState$ = combineLatest([this.loadResultsDisplayValues$, this.values$]).pipe(switchMap$1(([displayValues, currentValues]) => {
1111
1306
  const displayValuesMap = makeValuesGroupMap(displayValues, (x) => this.hashForValue(x.value));
1112
1307
  const valuesNotInDisplayMap = [];
1113
1308
  currentValues.forEach((x) => {
@@ -1118,7 +1313,7 @@ class AbstractDbxPickableItemFieldDirective extends FieldType {
1118
1313
  }
1119
1314
  });
1120
1315
  if (valuesNotInDisplayMap.length) {
1121
- return this.loadDisplayValuesForValues(valuesNotInDisplayMap).pipe(map(x => mapLoadingStateResults(x, {
1316
+ return this.loadDisplayValuesForValues(valuesNotInDisplayMap).pipe(map$1(x => mapLoadingStateResults(x, {
1122
1317
  mapValue: (loadedValues) => {
1123
1318
  loadedValues.forEach(x => x.isUnknown = x.isUnknown ?? true); // Assign unknown flag.
1124
1319
  return ([...displayValues, ...loadedValues]);
@@ -1132,70 +1327,77 @@ class AbstractDbxPickableItemFieldDirective extends FieldType {
1132
1327
  /**
1133
1328
  * Results to be displayed if filtered.
1134
1329
  */
1135
- this.filteredSearchResultsState$ = this.loadResultsDisplayValues$.pipe(switchMap((values) => this.filterInputValueString$.pipe(switchMap(text => combineLatest([this._filterValues(text, values), this.displayValuesState$]).pipe(map(([values, displayState]) => mapLoadingStateResults(displayState, {
1330
+ this.filteredSearchResultsState$ = this.loadResultsDisplayValues$.pipe(switchMap$1((values) => this.filterInputValueString$.pipe(switchMap$1(text => combineLatest([this._filterValues(text, values), this.displayValuesState$]).pipe(map$1(([values, displayState]) => mapLoadingStateResults(displayState, {
1136
1331
  mapValue: (displayValues) => {
1137
1332
  const valueHashSet = new Set(values.map(x => this.hashForValue(x)));
1138
1333
  return displayValues.filter(x => !x.isUnknown && valueHashSet.has(x._hash));
1139
1334
  }
1140
- })))))), shareReplay(1));
1141
- this.filteredSearchResults$ = this.filteredSearchResultsState$.pipe(map(x => x?.value), filterMaybe(), shareReplay(1));
1142
- this.items$ = combineLatest([this.filteredSearchResults$, this.values$]).pipe(map(([displayValues, values]) => {
1335
+ })), startWith(beginLoading()))))), shareReplay$1(1));
1336
+ this.filteredSearchResults$ = this.filteredSearchResultsState$.pipe(map$1(x => x?.value), filterMaybe(), shareReplay$1(1));
1337
+ this.items$ = combineLatest([this.filteredSearchResults$, this.values$]).pipe(map$1(([displayValues, values]) => {
1143
1338
  const selectedHashValuesSet = new Set(values.map(x => this.hashForValue(x)));
1144
- let items = displayValues.map((x) => ({ display: x, selected: selectedHashValuesSet.has(x._hash) }));
1339
+ let items = displayValues.map((x) => ({ value: x, selected: selectedHashValuesSet.has(x._hash) }));
1145
1340
  if (this.sortItems) {
1146
1341
  items = this.sortItems(items);
1147
1342
  }
1148
1343
  return items;
1149
- }), shareReplay(1));
1150
- this.itemsLoadingState$ = this.loadResultsDisplayValues$.pipe(switchMap(x => this.items$.pipe(first(), map(x => successResult(x)), startWith$1(beginLoading()), shareReplay(1))));
1344
+ }), shareReplay$1(1));
1345
+ this.itemsLoadingState$ = this.loadResultsDisplayValues$.pipe(switchMap$1(x => this.items$.pipe(first$1(), map$1(x => successResult(x)), startWith(beginLoading()), shareReplay$1(1))));
1151
1346
  /**
1152
1347
  * Context used for managing the loading of items, or when the current results change.
1153
1348
  */
1154
- this.context = new LoadingStateContextInstance({ obs: this.itemsLoadingState$, showLoadingOnNoValue: false });
1155
- this.filterItemsLoadingState$ = this.items$.pipe(map(x => successResult(x)), startWith$1(beginLoading()), shareReplay(1));
1349
+ this.context = new ListLoadingStateContextInstance({ obs: this.itemsLoadingState$, showLoadingOnNoValue: false });
1350
+ this.filterItemsLoadingState$ = this.items$.pipe(map$1(x => successResult(x)), startWith(beginLoading()), shareReplay$1(1));
1156
1351
  /**
1157
1352
  * Context used for searching/filtering.
1158
1353
  */
1159
- this.filterResultsContext = new LoadingStateContextInstance({ obs: this.loadResultsDisplayValuesState$, showLoadingOnNoValue: true });
1354
+ this.filterResultsContext = new ListLoadingStateContextInstance({ obs: this.filteredSearchResultsState$, showLoadingOnNoValue: true });
1355
+ this.noItemsAvailable$ = this.filterItemsLoadingState$.pipe(isListLoadingStateEmpty(), distinctUntilChanged$1());
1356
+ }
1357
+ get readonly() {
1358
+ return this.field.templateOptions?.readonly;
1359
+ }
1360
+ get isReadonlyOrDisabled() {
1361
+ return this.readonly || this.disabled;
1362
+ }
1363
+ get pickableField() {
1364
+ return this.field.pickableField;
1160
1365
  }
1161
1366
  get multiSelect() {
1162
- return this.field.multiSelect ?? true;
1367
+ return this.pickableField.multiSelect ?? true;
1163
1368
  }
1164
1369
  get asArrayValue() {
1165
- return this.field.asArrayValue ?? true;
1370
+ return this.pickableField.asArrayValue ?? true;
1166
1371
  }
1167
1372
  get filterLabel() {
1168
- return this.field.filterLabel;
1169
- }
1170
- get readonly() {
1171
- return this.field.templateOptions?.readonly;
1373
+ return this.pickableField.filterLabel;
1172
1374
  }
1173
- get required() {
1174
- return this.field.templateOptions?.required;
1375
+ get name() {
1376
+ return this.field.name ?? (camelCase(this.label ?? this.key));
1175
1377
  }
1176
- get placeholder() {
1177
- return this.field.templateOptions?.placeholder ?? '';
1378
+ get label() {
1379
+ return this.field.templateOptions?.label;
1178
1380
  }
1179
- get description() {
1180
- return this.field.templateOptions?.description;
1381
+ get autocomplete() {
1382
+ return this.field.templateOptions?.attributes?.['autocomplete'] ?? this.key;
1181
1383
  }
1182
1384
  get sortItems() {
1183
- return this.field.sortItems;
1385
+ return this.pickableField.sortItems;
1184
1386
  }
1185
1387
  get hashForValue() {
1186
- return this.field.hashForValue ?? ((x) => x);
1388
+ return this.pickableField.hashForValue ?? ((x) => x);
1187
1389
  }
1188
1390
  get displayForValue() {
1189
- return this.field.displayForValue;
1391
+ return this.pickableField.displayForValue;
1190
1392
  }
1191
1393
  get showFilterInput() {
1192
- return Boolean(this.field.filterValues);
1394
+ return Boolean(this.pickableField.filterValues);
1193
1395
  }
1194
1396
  get filterValuesFn() {
1195
- return this.field.filterValues ?? ((_, x) => of(x.map(y => y.value)));
1397
+ return this.pickableField.filterValues ?? ((_, x) => of(x.map(y => y.value)));
1196
1398
  }
1197
1399
  get skipFilterFnOnEmpty() {
1198
- return this.field.skipFilterFnOnEmpty ?? true;
1400
+ return this.pickableField.skipFilterFnOnEmpty ?? true;
1199
1401
  }
1200
1402
  get _filterValues() {
1201
1403
  let fn;
@@ -1217,25 +1419,25 @@ class AbstractDbxPickableItemFieldDirective extends FieldType {
1217
1419
  return fn;
1218
1420
  }
1219
1421
  get showTextFilter() {
1220
- return this.field.showTextFilter ?? Boolean(this.field.filterValues);
1422
+ return this.pickableField.showTextFilter ?? Boolean(this.pickableField.filterValues);
1221
1423
  }
1222
1424
  get loadValuesFn() {
1223
- return this.field.loadValues;
1425
+ return this.pickableField.loadValues;
1224
1426
  }
1225
1427
  get values() {
1226
1428
  return this._getValueOnFormControl(this.formControl.value) ?? [];
1227
1429
  }
1228
1430
  get footerConfig() {
1229
- return this.field.footerConfig;
1431
+ return this.pickableField.footerConfig;
1230
1432
  }
1231
1433
  loadDisplayValuesForValues(values) {
1232
1434
  return this.loadDisplayValuesForFieldValues(values.map((value) => ({ value })));
1233
1435
  }
1234
1436
  loadDisplayValuesForFieldValues(values) {
1235
- return this.getDisplayValuesForFieldValues(values).pipe(map((displayValues) => ({ loading: false, model: displayValues })), startWith$1({ loading: true }), shareReplay(1));
1437
+ return this.getDisplayValuesForFieldValues(values).pipe(map$1((displayValues) => successResult(displayValues)), startWith(beginLoading()), shareReplay$1(1));
1236
1438
  }
1237
1439
  getDisplayValuesForFieldValues(values) {
1238
- return this._displayHashMap.pipe(mergeMap$1((displayMap) => {
1440
+ return this._displayHashMap.pipe(mergeMap((displayMap) => {
1239
1441
  const mappingResult = values
1240
1442
  .map(x => [x, this.hashForValue(x.value)])
1241
1443
  .map(([x, hash], i) => [i, hash, x, displayMap.get(hash)]);
@@ -1244,7 +1446,7 @@ class AbstractDbxPickableItemFieldDirective extends FieldType {
1244
1446
  if (needsDisplay.length > 0) {
1245
1447
  // Go get the display value.
1246
1448
  const displayValuesObs = this.displayForValue(needsDisplay.map(x => x[2]));
1247
- return displayValuesObs.pipe(first(), map((displayResults) => {
1449
+ return displayValuesObs.pipe(first$1(), map$1((displayResults) => {
1248
1450
  const displayResultsWithHash = displayResults.map((x) => {
1249
1451
  x._hash = this.hashForValue(x.value);
1250
1452
  return x;
@@ -1267,13 +1469,15 @@ class AbstractDbxPickableItemFieldDirective extends FieldType {
1267
1469
  }));
1268
1470
  }
1269
1471
  ngOnInit() {
1472
+ super.ngOnInit();
1270
1473
  this._formControlObs.next(this.formControl);
1271
1474
  // Focus after finished loading for the first time.
1272
- this.context.loading$.pipe(delay(10), filter(x => x), first()).subscribe(() => {
1475
+ this.context.loading$.pipe(delay(10), filter$1(x => x), first$1()).subscribe(() => {
1273
1476
  this.filterMatInput?.focus();
1274
1477
  });
1275
1478
  }
1276
1479
  ngOnDestroy() {
1480
+ super.ngOnDestroy();
1277
1481
  this._displayHashMap.complete();
1278
1482
  this._formControlObs.complete();
1279
1483
  this.filterResultsContext.destroy();
@@ -1323,48 +1527,111 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
1323
1527
  /**
1324
1528
  * Used for picking pre-set values using chips as the presentation.
1325
1529
  */
1326
- class DbxPickableChipFieldComponent extends AbstractDbxPickableItemFieldDirective {
1530
+ class DbxPickableChipListFieldComponent extends AbstractDbxPickableItemFieldDirective {
1327
1531
  itemClicked(item) {
1328
- if (item.selected) {
1329
- this.removeValue(item.display.value);
1330
- }
1331
- else {
1332
- this.addValue(item.display.value);
1532
+ if (!item.disabled && !this.isReadonlyOrDisabled) {
1533
+ if (item.selected) {
1534
+ this.removeValue(item.value.value);
1535
+ }
1536
+ else {
1537
+ this.addValue(item.value.value);
1538
+ }
1333
1539
  }
1334
1540
  }
1335
1541
  }
1336
- DbxPickableChipFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxPickableChipFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1337
- DbxPickableChipFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxPickableChipFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div class=\"dbx-pickable-item-field\">\n <dbx-loading [context]=\"context\">\n <ng-container *ngIf=\"showFilterInput\">\n <ng-container *ngTemplateOutlet=\"filterTemplate\"></ng-container>\n </ng-container>\n <div class=\"dbx-pickable-item-field-chips\">\n <!-- TODO: Add back aria-label [attr.aria-label]=\"'email ' + emailParticipantsType\" -->\n <mat-chip-list [selectable]=\"!readonly\" [disabled]=\"readonly\" #chipList>\n <mat-chip *ngFor=\"let item of items$ | async\" (click)=\"itemClicked(item)\" [selected]=\"item.selected\">\n <span class=\"s-chip-label\">{{ item.display.label }}</span>\n </mat-chip>\n </mat-chip-list>\n <dbx-injected-content [config]=\"footerConfig\"></dbx-injected-content>\n </div>\n </dbx-loading>\n</div>\n\n<!-- Filter Input -->\n<ng-template #filterTemplate>\n <div class=\"dbx-pickable-item-field-filter\">\n <mat-form-field class=\"dbx-pickable-item-field-filter-field\" appearance=\"fill\">\n <mat-label>{{ filterLabel }}</mat-label>\n <input name=\"filter items\" #filterMatInput=\"matInput\" matInput [placeholder]=\"placeholder\"\n [formControl]=\"inputCtrl\">\n </mat-form-field>\n <div class=\"searchable-field-form-loading\">\n <dbx-loading [linear]=\"true\" [context]=\"filterResultsContext\"></dbx-loading>\n </div>\n </div>\n</ng-template>\n", components: [{ type: i1$1.DbxLoadingComponent, selector: "dbx-loading", inputs: ["show", "text", "mode", "color", "diameter", "linear", "context", "loading", "error"] }, { type: i5$1.MatChipList, selector: "mat-chip-list", inputs: ["errorStateMatcher", "multiple", "compareWith", "value", "required", "placeholder", "disabled", "aria-orientation", "selectable", "tabIndex"], outputs: ["change", "valueChange"], exportAs: ["matChipList"] }, { type: i2.DbxInjectedComponent, selector: "dbx-injected-content, [dbx-injected-content]", inputs: ["config", "template"] }, { type: i4.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5$1.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["color", "disableRipple", "tabIndex", "selected", "value", "selectable", "disabled", "removable"], outputs: ["selectionChange", "destroyed", "removed"], exportAs: ["matChip"] }, { type: i4.MatLabel, selector: "mat-label" }, { type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], pipes: { "async": i5.AsyncPipe } });
1338
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxPickableChipFieldComponent, decorators: [{
1542
+ DbxPickableChipListFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxPickableChipListFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1543
+ DbxPickableChipListFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxPickableChipListFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div class=\"dbx-pickable-item-field\">\n <dbx-loading [context]=\"context\" [linear]=\"true\">\n <ng-container *ngIf=\"showFilterInput\">\n <ng-container *ngTemplateOutlet=\"filterTemplate\"></ng-container>\n </ng-container>\n <!-- Content -->\n <div class=\"dbx-pickable-item-field-chips\">\n <mat-chip-list [required]=\"required\" [selectable]=\"!isReadonlyOrDisabled\" #chipList>\n <mat-chip *ngFor=\"let item of items$ | async\" (click)=\"itemClicked(item)\" [selected]=\"item.selected\"\n [disabled]=\"isReadonlyOrDisabled || item.disabled\">\n <span class=\"dbx-chip-label\">{{ item.value.label }}</span>\n <span class=\"dbx-chip-sublabel\" *ngIf=\"item.value.sublabel\">{{ item.value.sublabel }}</span>\n </mat-chip>\n </mat-chip-list>\n <dbx-injected-content [config]=\"footerConfig\"></dbx-injected-content>\n </div>\n </dbx-loading>\n</div>\n\n<!-- Filter Input -->\n<ng-template #filterTemplate>\n <div class=\"dbx-pickable-item-field-filter\">\n <div class=\"dbx-label\">{{ filterLabel }}</div>\n <input [name]=\"name\" autocomplete=\"{{ autocomplete }}\" #filterMatInput=\"matInput\" matInput\n [placeholder]=\"placeholder\" [formControl]=\"inputCtrl\">\n <mat-divider></mat-divider>\n <dbx-loading [linear]=\"true\" [context]=\"filterResultsContext\"></dbx-loading>\n <!-- No items found. -->\n <p *ngIf=\"noItemsAvailable$ | async\" class=\"dbx-label\">No items match this filter.</p>\n </div>\n</ng-template>\n", components: [{ type: i1$1.DbxLoadingComponent, selector: "dbx-loading", inputs: ["show", "text", "mode", "color", "diameter", "linear", "context", "loading", "error"] }, { type: i1$5.MatChipList, selector: "mat-chip-list", inputs: ["errorStateMatcher", "multiple", "compareWith", "value", "required", "placeholder", "disabled", "aria-orientation", "selectable", "tabIndex"], outputs: ["change", "valueChange"], exportAs: ["matChipList"] }, { type: i2.DbxInjectedComponent, selector: "dbx-injected-content, [dbx-injected-content]", inputs: ["config", "template"] }, { type: i4$2.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1$5.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["color", "disableRipple", "tabIndex", "selected", "value", "selectable", "disabled", "removable"], outputs: ["selectionChange", "destroyed", "removed"], exportAs: ["matChip"] }, { type: i6$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i4$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], pipes: { "async": i5.AsyncPipe } });
1544
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxPickableChipListFieldComponent, decorators: [{
1339
1545
  type: Component,
1340
- args: [{ template: "<div class=\"dbx-pickable-item-field\">\n <dbx-loading [context]=\"context\">\n <ng-container *ngIf=\"showFilterInput\">\n <ng-container *ngTemplateOutlet=\"filterTemplate\"></ng-container>\n </ng-container>\n <div class=\"dbx-pickable-item-field-chips\">\n <!-- TODO: Add back aria-label [attr.aria-label]=\"'email ' + emailParticipantsType\" -->\n <mat-chip-list [selectable]=\"!readonly\" [disabled]=\"readonly\" #chipList>\n <mat-chip *ngFor=\"let item of items$ | async\" (click)=\"itemClicked(item)\" [selected]=\"item.selected\">\n <span class=\"s-chip-label\">{{ item.display.label }}</span>\n </mat-chip>\n </mat-chip-list>\n <dbx-injected-content [config]=\"footerConfig\"></dbx-injected-content>\n </div>\n </dbx-loading>\n</div>\n\n<!-- Filter Input -->\n<ng-template #filterTemplate>\n <div class=\"dbx-pickable-item-field-filter\">\n <mat-form-field class=\"dbx-pickable-item-field-filter-field\" appearance=\"fill\">\n <mat-label>{{ filterLabel }}</mat-label>\n <input name=\"filter items\" #filterMatInput=\"matInput\" matInput [placeholder]=\"placeholder\"\n [formControl]=\"inputCtrl\">\n </mat-form-field>\n <div class=\"searchable-field-form-loading\">\n <dbx-loading [linear]=\"true\" [context]=\"filterResultsContext\"></dbx-loading>\n </div>\n </div>\n</ng-template>\n" }]
1546
+ args: [{ template: "<div class=\"dbx-pickable-item-field\">\n <dbx-loading [context]=\"context\" [linear]=\"true\">\n <ng-container *ngIf=\"showFilterInput\">\n <ng-container *ngTemplateOutlet=\"filterTemplate\"></ng-container>\n </ng-container>\n <!-- Content -->\n <div class=\"dbx-pickable-item-field-chips\">\n <mat-chip-list [required]=\"required\" [selectable]=\"!isReadonlyOrDisabled\" #chipList>\n <mat-chip *ngFor=\"let item of items$ | async\" (click)=\"itemClicked(item)\" [selected]=\"item.selected\"\n [disabled]=\"isReadonlyOrDisabled || item.disabled\">\n <span class=\"dbx-chip-label\">{{ item.value.label }}</span>\n <span class=\"dbx-chip-sublabel\" *ngIf=\"item.value.sublabel\">{{ item.value.sublabel }}</span>\n </mat-chip>\n </mat-chip-list>\n <dbx-injected-content [config]=\"footerConfig\"></dbx-injected-content>\n </div>\n </dbx-loading>\n</div>\n\n<!-- Filter Input -->\n<ng-template #filterTemplate>\n <div class=\"dbx-pickable-item-field-filter\">\n <div class=\"dbx-label\">{{ filterLabel }}</div>\n <input [name]=\"name\" autocomplete=\"{{ autocomplete }}\" #filterMatInput=\"matInput\" matInput\n [placeholder]=\"placeholder\" [formControl]=\"inputCtrl\">\n <mat-divider></mat-divider>\n <dbx-loading [linear]=\"true\" [context]=\"filterResultsContext\"></dbx-loading>\n <!-- No items found. -->\n <p *ngIf=\"noItemsAvailable$ | async\" class=\"dbx-label\">No items match this filter.</p>\n </div>\n</ng-template>\n" }]
1341
1547
  }] });
1342
1548
 
1343
1549
  /**
1344
1550
  * Used for picking pre-set values using a selection list as the presentation.
1345
1551
  */
1346
1552
  class DbxPickableListFieldComponent extends AbstractDbxPickableItemFieldDirective {
1347
- matSelectionChanged(selection) {
1348
- const options = selection.source.selectedOptions.selected;
1349
- const items = options.map(x => {
1350
- const { value, selected, disabled } = x;
1351
- return ({ item: value, selected, disabled });
1352
- });
1353
- this.setValues(items.map(x => x.item.display.value));
1553
+ onSelectionChange(event) {
1554
+ const items = event.items;
1555
+ const values = items.map(x => x.value.value);
1556
+ this.setValues(values);
1354
1557
  }
1355
1558
  }
1356
1559
  DbxPickableListFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxPickableListFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1357
- DbxPickableListFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxPickableListFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div class=\"dbx-pickable-item-field\">\n <dbx-loading [context]=\"context\">\n <ng-container *ngIf=\"showFilterInput\">\n <ng-container *ngTemplateOutlet=\"filterTemplate\"></ng-container>\n </ng-container>\n <div class=\"dbx-model-list dbx-pickable-item-field-list\">\n <mat-selection-list [multiple]=\"multiSelect\" (selectionChange)=\"matSelectionChanged($event)\">\n <mat-list-option *ngFor=\"let item of items$ | async\" [selected]=\"item.selected\" [value]=\"item\">\n <p>{{ item.display.label }}</p>\n </mat-list-option>\n </mat-selection-list>\n <dbx-injected-content [config]=\"footerConfig\"></dbx-injected-content>\n </div>\n </dbx-loading>\n</div>\n\n<!-- Filter Input -->\n<ng-template #filterTemplate>\n <div class=\"dbx-pickable-item-field-filter\">\n <mat-form-field class=\"dbx-pickable-item-field-filter-field\" appearance=\"fill\">\n <mat-label>{{ filterLabel }}</mat-label>\n <input name=\"filter items\" #filterMatInput=\"matInput\" matInput [placeholder]=\"placeholder\"\n [formControl]=\"inputCtrl\">\n </mat-form-field>\n <div class=\"searchable-field-form-loading\">\n <dbx-loading [linear]=\"true\" [context]=\"filterResultsContext\"></dbx-loading>\n </div>\n </div>\n</ng-template>\n", components: [{ type: i1$1.DbxLoadingComponent, selector: "dbx-loading", inputs: ["show", "text", "mode", "color", "diameter", "linear", "context", "loading", "error"] }, { type: i2$3.MatSelectionList, selector: "mat-selection-list", inputs: ["disableRipple", "tabIndex", "color", "compareWith", "disabled", "multiple"], outputs: ["selectionChange"], exportAs: ["matSelectionList"] }, { type: i2$3.MatListOption, selector: "mat-list-option", inputs: ["disableRipple", "checkboxPosition", "color", "value", "disabled", "selected"], outputs: ["selectedChange"], exportAs: ["matListOption"] }, { type: i2.DbxInjectedComponent, selector: "dbx-injected-content, [dbx-injected-content]", inputs: ["config", "template"] }, { type: i4.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4.MatLabel, selector: "mat-label" }, { type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], pipes: { "async": i5.AsyncPipe } });
1560
+ DbxPickableListFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxPickableListFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div class=\"dbx-pickable-item-field\">\n <dbx-loading [context]=\"context\">\n <ng-container *ngIf=\"showFilterInput\">\n <ng-container *ngTemplateOutlet=\"filterTemplate\"></ng-container>\n </ng-container>\n <!-- Content -->\n <div class=\"dbx-pickable-item-field-list\">\n <div class=\"dbx-pickable-item-field-list-content\">\n <dbx-form-pickable-item-field-item-list [disabled]=\"isReadonlyOrDisabled\" [state$]=\"filterItemsLoadingState$\"\n (selectionChange)=\"onSelectionChange($event)\">\n </dbx-form-pickable-item-field-item-list>\n </div>\n <dbx-injected-content [config]=\"footerConfig\"></dbx-injected-content>\n </div>\n </dbx-loading>\n</div>\n\n<!-- Filter Input -->\n<ng-template #filterTemplate>\n <div class=\"dbx-pickable-item-field-filter\">\n <div class=\"dbx-label\">{{ filterLabel }}</div>\n <input [name]=\"name\" autocomplete=\"{{ autocomplete }}\" #filterMatInput=\"matInput\" matInput\n [placeholder]=\"placeholder\" [formControl]=\"inputCtrl\">\n <mat-divider></mat-divider>\n <dbx-loading [linear]=\"true\" [context]=\"filterResultsContext\"></dbx-loading>\n <!-- No items found. -->\n <p *ngIf=\"noItemsAvailable$ | async\" class=\"dbx-label\">No items match this filter.</p>\n </div>\n</ng-template>\n", components: [{ type: i0.forwardRef(function () { return i1$1.DbxLoadingComponent; }), selector: "dbx-loading", inputs: ["show", "text", "mode", "color", "diameter", "linear", "context", "loading", "error"] }, { type: i0.forwardRef(function () { return DbxPickableListFieldItemListComponent; }), selector: "dbx-form-pickable-item-field-item-list" }, { type: i0.forwardRef(function () { return i2.DbxInjectedComponent; }), selector: "dbx-injected-content, [dbx-injected-content]", inputs: ["config", "template"] }, { type: i0.forwardRef(function () { return i4$2.MatDivider; }), selector: "mat-divider", inputs: ["vertical", "inset"] }], directives: [{ type: i0.forwardRef(function () { return i5.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i0.forwardRef(function () { return i5.NgTemplateOutlet; }), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i0.forwardRef(function () { return i6$1.MatInput; }), selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i0.forwardRef(function () { return i4$1.DefaultValueAccessor; }), selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i0.forwardRef(function () { return i4$1.NgControlStatus; }), selector: "[formControlName],[ngModel],[formControl]" }, { type: i0.forwardRef(function () { return i4$1.FormControlDirective; }), selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], pipes: { "async": i0.forwardRef(function () { return i5.AsyncPipe; }) } });
1358
1561
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxPickableListFieldComponent, decorators: [{
1359
1562
  type: Component,
1360
- args: [{ template: "<div class=\"dbx-pickable-item-field\">\n <dbx-loading [context]=\"context\">\n <ng-container *ngIf=\"showFilterInput\">\n <ng-container *ngTemplateOutlet=\"filterTemplate\"></ng-container>\n </ng-container>\n <div class=\"dbx-model-list dbx-pickable-item-field-list\">\n <mat-selection-list [multiple]=\"multiSelect\" (selectionChange)=\"matSelectionChanged($event)\">\n <mat-list-option *ngFor=\"let item of items$ | async\" [selected]=\"item.selected\" [value]=\"item\">\n <p>{{ item.display.label }}</p>\n </mat-list-option>\n </mat-selection-list>\n <dbx-injected-content [config]=\"footerConfig\"></dbx-injected-content>\n </div>\n </dbx-loading>\n</div>\n\n<!-- Filter Input -->\n<ng-template #filterTemplate>\n <div class=\"dbx-pickable-item-field-filter\">\n <mat-form-field class=\"dbx-pickable-item-field-filter-field\" appearance=\"fill\">\n <mat-label>{{ filterLabel }}</mat-label>\n <input name=\"filter items\" #filterMatInput=\"matInput\" matInput [placeholder]=\"placeholder\"\n [formControl]=\"inputCtrl\">\n </mat-form-field>\n <div class=\"searchable-field-form-loading\">\n <dbx-loading [linear]=\"true\" [context]=\"filterResultsContext\"></dbx-loading>\n </div>\n </div>\n</ng-template>\n" }]
1563
+ args: [{ template: "<div class=\"dbx-pickable-item-field\">\n <dbx-loading [context]=\"context\">\n <ng-container *ngIf=\"showFilterInput\">\n <ng-container *ngTemplateOutlet=\"filterTemplate\"></ng-container>\n </ng-container>\n <!-- Content -->\n <div class=\"dbx-pickable-item-field-list\">\n <div class=\"dbx-pickable-item-field-list-content\">\n <dbx-form-pickable-item-field-item-list [disabled]=\"isReadonlyOrDisabled\" [state$]=\"filterItemsLoadingState$\"\n (selectionChange)=\"onSelectionChange($event)\">\n </dbx-form-pickable-item-field-item-list>\n </div>\n <dbx-injected-content [config]=\"footerConfig\"></dbx-injected-content>\n </div>\n </dbx-loading>\n</div>\n\n<!-- Filter Input -->\n<ng-template #filterTemplate>\n <div class=\"dbx-pickable-item-field-filter\">\n <div class=\"dbx-label\">{{ filterLabel }}</div>\n <input [name]=\"name\" autocomplete=\"{{ autocomplete }}\" #filterMatInput=\"matInput\" matInput\n [placeholder]=\"placeholder\" [formControl]=\"inputCtrl\">\n <mat-divider></mat-divider>\n <dbx-loading [linear]=\"true\" [context]=\"filterResultsContext\"></dbx-loading>\n <!-- No items found. -->\n <p *ngIf=\"noItemsAvailable$ | async\" class=\"dbx-label\">No items match this filter.</p>\n </div>\n</ng-template>\n" }]
1564
+ }] });
1565
+ // MARK: Selection List
1566
+ class DbxPickableListFieldItemListComponent extends AbstractDbxSelectionListWrapperDirective {
1567
+ constructor() {
1568
+ super({
1569
+ componentClass: DbxPickableListFieldItemListViewComponent
1570
+ });
1571
+ }
1572
+ }
1573
+ DbxPickableListFieldItemListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxPickableListFieldItemListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1574
+ DbxPickableListFieldItemListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxPickableListFieldItemListComponent, selector: "dbx-form-pickable-item-field-item-list", usesInheritance: true, ngImport: i0, template: "\n<dbx-list [state$]=\"state$\" [config]=\"config$ | async\" [disabled]=\"disabled\">\n <ng-content top select=\"[top]\"></ng-content>\n <ng-content bottom select=\"[bottom]\"></ng-content>\n <ng-content empty select=\"[empty]\"></ng-content>\n</dbx-list>\n", isInline: true, components: [{ type: i1$1.DbxListComponent, selector: "dbx-list", inputs: ["padded", "state$", "config", "disabled"], outputs: ["contentScrolled"] }], pipes: { "async": i5.AsyncPipe } });
1575
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxPickableListFieldItemListComponent, decorators: [{
1576
+ type: Component,
1577
+ args: [{
1578
+ selector: 'dbx-form-pickable-item-field-item-list',
1579
+ template: DEFAULT_LIST_WRAPPER_DIRECTIVE_TEMPLATE
1580
+ }]
1581
+ }], ctorParameters: function () { return []; } });
1582
+ /**
1583
+ * NOTE: Values input are PickableItemFieldItem<T>, but output values are PickableValueFieldDisplayValue<T>.
1584
+ */
1585
+ class DbxPickableListFieldItemListViewComponent extends AbstractSelectionValueListViewDirective {
1586
+ constructor(dbxPickableListFieldComponent) {
1587
+ super();
1588
+ this.dbxPickableListFieldComponent = dbxPickableListFieldComponent;
1589
+ this.config = {
1590
+ componentClass: DbxPickableListFieldItemListViewItemComponent
1591
+ };
1592
+ this.items$ = this.values$.pipe(
1593
+ // NOTE: This causes the "value" to be a PickableValueFieldDisplayValue<T>, which means we emit PickableValueFieldDisplayValue<T> to DbxPickableListFieldComponent.
1594
+ map$1(x => mapItemValuesToValueListItemConfig(this.config, x)), shareReplay$1(1));
1595
+ }
1596
+ get multiple() {
1597
+ return this.dbxPickableListFieldComponent.multiSelect;
1598
+ }
1599
+ }
1600
+ DbxPickableListFieldItemListViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxPickableListFieldItemListViewComponent, deps: [{ token: DbxPickableListFieldComponent }], target: i0.ɵɵFactoryTarget.Component });
1601
+ DbxPickableListFieldItemListViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxPickableListFieldItemListViewComponent, selector: "ng-component", providers: ProvideDbxListView(DbxPickableListFieldItemListViewComponent), usesInheritance: true, ngImport: i0, template: `<dbx-selection-list-view-content [multiple]="multiple" [items]="items$ | async"></dbx-selection-list-view-content>`, isInline: true, components: [{ type: i1$1.DbxSelectionValueListItemViewComponent, selector: "dbx-selection-list-view-content", inputs: ["multiple", "items"] }], pipes: { "async": i5.AsyncPipe } });
1602
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxPickableListFieldItemListViewComponent, decorators: [{
1603
+ type: Component,
1604
+ args: [{
1605
+ template: `<dbx-selection-list-view-content [multiple]="multiple" [items]="items$ | async"></dbx-selection-list-view-content>`,
1606
+ providers: ProvideDbxListView(DbxPickableListFieldItemListViewComponent)
1607
+ }]
1608
+ }], ctorParameters: function () { return [{ type: DbxPickableListFieldComponent }]; } });
1609
+ class DbxPickableListFieldItemListViewItemComponent extends AbstractDbxSelectionValueListViewItemComponent {
1610
+ get label() {
1611
+ return this.value.label;
1612
+ }
1613
+ }
1614
+ DbxPickableListFieldItemListViewItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxPickableListFieldItemListViewItemComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1615
+ DbxPickableListFieldItemListViewItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxPickableListFieldItemListViewItemComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
1616
+ <p>{{ label }}</p>
1617
+ `, isInline: true });
1618
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxPickableListFieldItemListViewItemComponent, decorators: [{
1619
+ type: Component,
1620
+ args: [{
1621
+ template: `
1622
+ <p>{{ label }}</p>
1623
+ `
1624
+ }]
1361
1625
  }] });
1362
1626
 
1363
1627
  class DbxFormFormlyPickableFieldModule {
1364
1628
  }
1365
1629
  DbxFormFormlyPickableFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyPickableFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1366
- DbxFormFormlyPickableFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyPickableFieldModule, declarations: [DbxPickableChipFieldComponent,
1367
- DbxPickableListFieldComponent], imports: [CommonModule,
1630
+ DbxFormFormlyPickableFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyPickableFieldModule, declarations: [DbxPickableChipListFieldComponent,
1631
+ DbxPickableListFieldComponent,
1632
+ DbxPickableListFieldItemListComponent,
1633
+ DbxPickableListFieldItemListViewComponent,
1634
+ DbxPickableListFieldItemListViewItemComponent], imports: [CommonModule,
1368
1635
  DbxTextModule,
1369
1636
  DbxLoadingModule,
1370
1637
  DbxButtonModule,
@@ -1379,7 +1646,8 @@ DbxFormFormlyPickableFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion:
1379
1646
  DbxAnchorModule,
1380
1647
  MatChipsModule,
1381
1648
  MatIconModule,
1382
- DbxInjectedComponentModule, i1$4.FormlyModule] });
1649
+ DbxInjectedComponentModule,
1650
+ DbxListLayoutModule, i1$4.FormlyModule] });
1383
1651
  DbxFormFormlyPickableFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyPickableFieldModule, imports: [[
1384
1652
  CommonModule,
1385
1653
  DbxTextModule,
@@ -1397,10 +1665,11 @@ DbxFormFormlyPickableFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion:
1397
1665
  MatChipsModule,
1398
1666
  MatIconModule,
1399
1667
  DbxInjectedComponentModule,
1668
+ DbxListLayoutModule,
1400
1669
  FormlyModule.forChild({
1401
1670
  types: [
1402
- { name: 'pickablechipfield', component: DbxPickableChipFieldComponent },
1403
- { name: 'pickablelistfield', component: DbxPickableListFieldComponent },
1671
+ { name: 'pickablechipfield', component: DbxPickableChipListFieldComponent, wrappers: ['form-field'] },
1672
+ { name: 'pickablelistfield', component: DbxPickableListFieldComponent, wrappers: ['form-field'] },
1404
1673
  ]
1405
1674
  })
1406
1675
  ]] });
@@ -1424,98 +1693,150 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
1424
1693
  MatChipsModule,
1425
1694
  MatIconModule,
1426
1695
  DbxInjectedComponentModule,
1696
+ DbxListLayoutModule,
1427
1697
  FormlyModule.forChild({
1428
1698
  types: [
1429
- { name: 'pickablechipfield', component: DbxPickableChipFieldComponent },
1430
- { name: 'pickablelistfield', component: DbxPickableListFieldComponent },
1699
+ { name: 'pickablechipfield', component: DbxPickableChipListFieldComponent, wrappers: ['form-field'] },
1700
+ { name: 'pickablelistfield', component: DbxPickableListFieldComponent, wrappers: ['form-field'] },
1431
1701
  ]
1432
1702
  })
1433
1703
  ],
1434
1704
  declarations: [
1435
- DbxPickableChipFieldComponent,
1436
- DbxPickableListFieldComponent
1705
+ DbxPickableChipListFieldComponent,
1706
+ DbxPickableListFieldComponent,
1707
+ DbxPickableListFieldItemListComponent,
1708
+ DbxPickableListFieldItemListViewComponent,
1709
+ DbxPickableListFieldItemListViewItemComponent
1437
1710
  ],
1438
1711
  exports: []
1439
1712
  }]
1440
1713
  }] });
1441
1714
 
1715
+ function filterPickableItemFieldValuesByLabel(filterText, values) {
1716
+ let filteredValues;
1717
+ if (filterText) {
1718
+ const searchString = filterText.toLocaleLowerCase();
1719
+ filteredValues = values.filter(x => x.label.toLocaleLowerCase().indexOf(searchString) !== -1);
1720
+ }
1721
+ else {
1722
+ filteredValues = values;
1723
+ }
1724
+ return of(filteredValues.map(x => x.value));
1725
+ }
1726
+ function sortPickableItemsByLabel(chips) {
1727
+ return chips.sort((a, b) => a.value.label.localeCompare(b.value.label));
1728
+ }
1729
+ function pickableItemChipField(config) {
1730
+ const { key } = config;
1731
+ return formlyField({
1732
+ key,
1733
+ type: 'pickablechipfield',
1734
+ ...templateOptionsForFieldConfig(config, {
1735
+ autocomplete: false
1736
+ }),
1737
+ pickableField: config
1738
+ });
1739
+ }
1740
+ function pickableItemListField(config) {
1741
+ const { key } = config;
1742
+ return formlyField({
1743
+ key,
1744
+ type: 'pickablelistfield',
1745
+ ...templateOptionsForFieldConfig(config, {
1746
+ autocomplete: false
1747
+ }),
1748
+ pickableField: config
1749
+ });
1750
+ }
1751
+
1752
+ const DBX_SEARCHABLE_FIELD_COMPONENT_DATA = new InjectionToken('DbxSearchableField');
1442
1753
  class DbxSearchableFieldAutocompleteItemComponent {
1443
- ngOnInit() {
1444
- this.content.clear();
1445
- const componentClass = this.displayValue?.componentClass;
1446
- if (componentClass) {
1447
- const componentRef = this.content.createComponent(componentClass);
1448
- componentRef.instance.displayValue = this.displayValue;
1449
- }
1754
+ constructor() {
1755
+ this._displayValue = new BehaviorSubject(undefined);
1756
+ this.displayValue$ = this._displayValue.pipe(filterMaybe(), shareReplay$1(1));
1757
+ this.config$ = this.displayValue$.pipe(map$1(x => {
1758
+ const config = {
1759
+ ...x.display,
1760
+ providers: mergeIntoArray([{
1761
+ provide: DBX_SEARCHABLE_FIELD_COMPONENT_DATA,
1762
+ useValue: x
1763
+ }], x.display.providers)
1764
+ };
1765
+ return config;
1766
+ }));
1767
+ this.anchor$ = this.displayValue$.pipe(map$1(x => x.anchor));
1768
+ }
1769
+ set displayValue(displayValue) {
1770
+ this._displayValue.next(displayValue);
1771
+ }
1772
+ ngOnDestroy() {
1773
+ this._displayValue.complete();
1450
1774
  }
1451
1775
  }
1452
1776
  DbxSearchableFieldAutocompleteItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxSearchableFieldAutocompleteItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1453
- DbxSearchableFieldAutocompleteItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxSearchableFieldAutocompleteItemComponent, selector: "dbx-searchable-field-autocomplete-item", inputs: { displayValue: "displayValue" }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: `
1454
- <ng-template #content></ng-template>
1455
- `, isInline: true });
1777
+ DbxSearchableFieldAutocompleteItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxSearchableFieldAutocompleteItemComponent, selector: "dbx-searchable-field-autocomplete-item", inputs: { displayValue: "displayValue" }, ngImport: i0, template: `
1778
+ <dbx-anchor [block]="true" [anchor]="anchor$ | async">
1779
+ <dbx-injected-content [config]="config$ | async"></dbx-injected-content>
1780
+ </dbx-anchor>
1781
+ `, isInline: true, components: [{ type: i1$1.DbxAnchorComponent, selector: "dbx-anchor, [dbx-anchor]", inputs: ["block"] }, { type: i2.DbxInjectedComponent, selector: "dbx-injected-content, [dbx-injected-content]", inputs: ["config", "template"] }], pipes: { "async": i5.AsyncPipe } });
1456
1782
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxSearchableFieldAutocompleteItemComponent, decorators: [{
1457
1783
  type: Component,
1458
1784
  args: [{
1459
1785
  selector: 'dbx-searchable-field-autocomplete-item',
1460
1786
  template: `
1461
- <ng-template #content></ng-template>
1787
+ <dbx-anchor [block]="true" [anchor]="anchor$ | async">
1788
+ <dbx-injected-content [config]="config$ | async"></dbx-injected-content>
1789
+ </dbx-anchor>
1462
1790
  `
1463
1791
  }]
1464
- }], propDecorators: { content: [{
1465
- type: ViewChild,
1466
- args: ['content', { static: true, read: ViewContainerRef }]
1467
- }], displayValue: [{
1792
+ }], propDecorators: { displayValue: [{
1468
1793
  type: Input
1469
1794
  }] } });
1470
1795
  // MARK: Default
1471
- class DbxDefaultSearchableFieldDisplayComponent {
1796
+ class AbstractDbxSearchableFieldDisplayDirective {
1797
+ constructor(displayValue) {
1798
+ this.displayValue = displayValue;
1799
+ }
1472
1800
  }
1473
- DbxDefaultSearchableFieldDisplayComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxDefaultSearchableFieldDisplayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1474
- DbxDefaultSearchableFieldDisplayComponentcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxDefaultSearchableFieldDisplayComponent, selector: "dbx-default-searchable-field-display", inputs: { displayValue: "displayValue" }, ngImport: i0, template: `
1475
- <span class="s-chip-label">{{ displayValue.label }}</span>
1476
- <span class="s-chip-sublabel" *ngIf="displayValue.sublabel">({{ displayValue.sublabel }})</span>
1477
- `, isInline: true, directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1801
+ AbstractDbxSearchableFieldDisplayDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AbstractDbxSearchableFieldDisplayDirective, deps: [{ token: DBX_SEARCHABLE_FIELD_COMPONENT_DATA }], target: i0.ɵɵFactoryTarget.Directive });
1802
+ AbstractDbxSearchableFieldDisplayDirectivedir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: AbstractDbxSearchableFieldDisplayDirective, ngImport: i0 });
1803
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AbstractDbxSearchableFieldDisplayDirective, decorators: [{
1804
+ type: Directive
1805
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1806
+ type: Inject,
1807
+ args: [DBX_SEARCHABLE_FIELD_COMPONENT_DATA]
1808
+ }] }]; } });
1809
+ class DbxDefaultSearchableFieldDisplayComponent extends AbstractDbxSearchableFieldDisplayDirective {
1810
+ }
1811
+ DbxDefaultSearchableFieldDisplayComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxDefaultSearchableFieldDisplayComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1812
+ DbxDefaultSearchableFieldDisplayComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxDefaultSearchableFieldDisplayComponent, selector: "dbx-default-searchable-field-display", usesInheritance: true, ngImport: i0, template: `
1813
+ <div class="dbx-default-searchable-field-display">
1814
+ <span class="dbx-chip-label">{{ displayValue.label }}</span>
1815
+ <span class="dbx-chip-sublabel" *ngIf="displayValue.sublabel">({{ displayValue.sublabel }})</span>
1816
+ </div>
1817
+ `, isInline: true, directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1478
1818
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxDefaultSearchableFieldDisplayComponent, decorators: [{
1479
1819
  type: Component,
1480
1820
  args: [{
1481
1821
  selector: 'dbx-default-searchable-field-display',
1482
1822
  template: `
1483
- <span class="s-chip-label">{{ displayValue.label }}</span>
1484
- <span class="s-chip-sublabel" *ngIf="displayValue.sublabel">({{ displayValue.sublabel }})</span>
1485
- `
1486
- }]
1487
- }], propDecorators: { displayValue: [{
1488
- type: Input
1489
- }] } });
1490
- class DbxDefaultSearchableAnchorFieldDisplayComponent {
1491
- }
1492
- DbxDefaultSearchableAnchorFieldDisplayComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxDefaultSearchableAnchorFieldDisplayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1493
- DbxDefaultSearchableAnchorFieldDisplayComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxDefaultSearchableAnchorFieldDisplayComponent, selector: "ng-component", inputs: { displayValue: "displayValue" }, ngImport: i0, template: `
1494
- <dbx-anchor [block]="true" [anchor]="displayValue?.anchor">
1495
- <dbx-default-searchable-field-display [displayValue]="displayValue"></dbx-default-searchable-field-display>
1496
- </dbx-anchor>
1497
- `, isInline: true, components: [{ type: i1$1.DbxAnchorComponent, selector: "dbx-anchor, [dbx-anchor]", inputs: ["block"] }, { type: DbxDefaultSearchableFieldDisplayComponent, selector: "dbx-default-searchable-field-display", inputs: ["displayValue"] }] });
1498
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxDefaultSearchableAnchorFieldDisplayComponent, decorators: [{
1499
- type: Component,
1500
- args: [{
1501
- template: `
1502
- <dbx-anchor [block]="true" [anchor]="displayValue?.anchor">
1503
- <dbx-default-searchable-field-display [displayValue]="displayValue"></dbx-default-searchable-field-display>
1504
- </dbx-anchor>
1823
+ <div class="dbx-default-searchable-field-display">
1824
+ <span class="dbx-chip-label">{{ displayValue.label }}</span>
1825
+ <span class="dbx-chip-sublabel" *ngIf="displayValue.sublabel">({{ displayValue.sublabel }})</span>
1826
+ </div>
1505
1827
  `
1506
1828
  }]
1507
- }], propDecorators: { displayValue: [{
1508
- type: Input
1509
- }] } });
1829
+ }] });
1510
1830
 
1511
1831
  /**
1512
1832
  * Abstract searchable field that provides a feature for searching for values, and for displaying values using Observables.
1513
1833
  *
1514
1834
  * Display values are cached for performance.
1515
1835
  */
1516
- class AbstractDbxSearchableValueFieldDirective extends FieldType {
1517
- constructor() {
1518
- super(...arguments);
1836
+ class AbstractDbxSearchableValueFieldDirective extends FieldType$1 {
1837
+ constructor(cdRef) {
1838
+ super();
1839
+ this.cdRef = cdRef;
1519
1840
  /**
1520
1841
  * Whether or not to set/get values as an array.
1521
1842
  */
@@ -1524,15 +1845,13 @@ class AbstractDbxSearchableValueFieldDirective extends FieldType {
1524
1845
  this._formControlObs = new BehaviorSubject(undefined);
1525
1846
  this.formControl$ = this._formControlObs.pipe(filterMaybe());
1526
1847
  this._displayHashMap = new BehaviorSubject(new Map());
1527
- this.inputValue$ = this.inputCtrl.valueChanges.pipe();
1528
- this.inputValueString$ = this.inputValue$.pipe(debounceTime$1(200), distinctUntilChanged$1());
1529
- this.searchResultsState$ = this.inputValueString$.pipe(filter$1((text) => Boolean(text || this.searchOnEmptyText) && Boolean(this.search)),
1530
- // TODO: Consider caching search text/results.
1531
- switchMap$1((text) => this.search(text).pipe(switchMap$1((x) => this.loadDisplayValuesForFieldValues(x)),
1848
+ this.inputValue$ = this.inputCtrl.valueChanges.pipe(startWith(this.inputCtrl.value));
1849
+ this.inputValueString$ = this.inputValue$.pipe(debounceTime(200), distinctUntilChanged$1());
1850
+ this.searchResultsState$ = this.inputValueString$.pipe(switchMap$1((text) => ((text || this.searchOnEmptyText) ? this.search(text ?? '') : of([])).pipe(switchMap$1((x) => this.loadDisplayValuesForFieldValues(x)),
1532
1851
  // Return begin loading to setup the loading state.
1533
1852
  startWith(beginLoading()))), shareReplay$1(1));
1534
1853
  this.singleValueSyncSubscription = new SubscriptionObject();
1535
- this.searchContext = new LoadingStateContextInstance({ obs: this.searchResultsState$, showLoadingOnNoValue: true });
1854
+ this.searchContext = new LoadingStateContextInstance({ obs: this.searchResultsState$, showLoadingOnNoValue: false });
1536
1855
  this.searchResults$ = this.searchResultsState$.pipe(map$1(x => x?.value ?? []));
1537
1856
  this._formControlValue = this.formControl$.pipe(switchMap$1(control => control.valueChanges.pipe(startWith(control.value), shareReplay$1(1))));
1538
1857
  this.values$ = this._formControlValue.pipe(map$1(convertMaybeToArray), shareReplay$1(1));
@@ -1548,53 +1867,50 @@ class AbstractDbxSearchableValueFieldDirective extends FieldType {
1548
1867
  get readonly() {
1549
1868
  return this.field.templateOptions?.readonly;
1550
1869
  }
1551
- get searchOnEmptyText() {
1552
- return this.field.searchOnEmptyText ?? false;
1870
+ get searchableField() {
1871
+ return this.field.searchableField;
1553
1872
  }
1554
- get required() {
1555
- return this.field.templateOptions?.required;
1873
+ get searchOnEmptyText() {
1874
+ return this.searchableField.searchOnEmptyText ?? false;
1556
1875
  }
1557
1876
  get autocomplete() {
1558
1877
  return this.field.templateOptions?.attributes?.['autocomplete'] ?? this.key;
1559
1878
  }
1560
- get placeholder() {
1561
- return this.field.templateOptions?.placeholder ?? '';
1562
- }
1563
- get description() {
1564
- return this.field.description ?? this.field.templateOptions?.description;
1565
- }
1566
1879
  get hashForValue() {
1567
- return this.field.hashForValue ?? ((x) => x);
1880
+ return this.searchableField.hashForValue ?? ((x) => x);
1568
1881
  }
1569
1882
  get displayForValue() {
1570
- return this.field.displayForValue;
1883
+ return this.searchableField.displayForValue;
1571
1884
  }
1572
1885
  get useAnchor() {
1573
- return this.field.useAnchor;
1886
+ return this.searchableField.useAnchor;
1574
1887
  }
1575
1888
  get anchorForValue() {
1576
- return this.field.anchorForValue;
1889
+ return this.searchableField.anchorForValue;
1577
1890
  }
1578
- get componentClass() {
1579
- return this.field.componentClass;
1891
+ get display() {
1892
+ return this.searchableField.display;
1580
1893
  }
1581
1894
  get search() {
1582
- return this.field.search;
1895
+ return this.searchableField.search;
1583
1896
  }
1584
1897
  get values() {
1585
1898
  return this._getValueOnFormControl(this.formControl.value) ?? [];
1586
1899
  }
1587
1900
  get allowStringValues() {
1588
- return this.allowStringValues ?? Boolean(this.convertStringValue);
1901
+ return this.searchableField.allowStringValues ?? Boolean(this.convertStringValue);
1589
1902
  }
1590
1903
  get convertStringValue() {
1591
- return this.field.convertStringValue;
1904
+ return this.searchableField.convertStringValue;
1905
+ }
1906
+ get showClearValue() {
1907
+ return this.searchableField.showClearValue ?? true;
1592
1908
  }
1593
1909
  loadDisplayValuesForValues(values) {
1594
1910
  return this.loadDisplayValuesForFieldValues(values.map((value) => ({ value })));
1595
1911
  }
1596
1912
  loadDisplayValuesForFieldValues(values) {
1597
- return this.getDisplayValuesForFieldValues(values).pipe(map$1((displayValues) => ({ loading: false, model: displayValues })), startWith({ loading: true }), shareReplay$1(1));
1913
+ return this.getDisplayValuesForFieldValues(values).pipe(map$1((displayValues) => successResult(displayValues)), startWith(beginLoading()), shareReplay$1(1));
1598
1914
  }
1599
1915
  getDisplayValuesForFieldValues(values) {
1600
1916
  return this._displayHashMap.pipe(mergeMap((displayMap) => {
@@ -1603,16 +1919,20 @@ class AbstractDbxSearchableValueFieldDirective extends FieldType {
1603
1919
  .map(([x, hash], i) => [i, hash, x, displayMap.get(hash)]);
1604
1920
  const hasDisplay = mappingResult.filter(x => Boolean(x[3]));
1605
1921
  const needsDisplay = mappingResult.filter(x => !x[3]);
1922
+ let obs;
1606
1923
  if (needsDisplay.length > 0) {
1607
1924
  // Go get the display value.
1608
1925
  const displayValuesObs = this.displayForValue(needsDisplay.map(x => x[2]));
1609
- const componentClass = this.componentClass ?? this.defaultComponentClass;
1926
+ const defaultDisplay = mergeDbxInjectedComponentConfigs([this.defaultDisplay, this.display]);
1610
1927
  const anchorForValue = this.useAnchor && this.anchorForValue;
1611
- return displayValuesObs.pipe(first$1(), map$1((displayResults) => {
1612
- // Assign the default component classes.
1928
+ obs = displayValuesObs.pipe(first$1(), map$1((displayResults) => {
1929
+ // Assign the default component classes to complete configuration.
1613
1930
  displayResults.forEach(x => {
1614
- if (!x.componentClass) {
1615
- x.componentClass = componentClass;
1931
+ if (!x.display) {
1932
+ x.display = defaultDisplay;
1933
+ }
1934
+ else {
1935
+ x.display = mergeDbxInjectedComponentConfigs([defaultDisplay, x.display]);
1616
1936
  }
1617
1937
  if (!x.anchor && anchorForValue) {
1618
1938
  x.anchor = anchorForValue(x);
@@ -1631,22 +1951,22 @@ class AbstractDbxSearchableValueFieldDirective extends FieldType {
1631
1951
  }
1632
1952
  else {
1633
1953
  // If all display values are hashed return that.
1634
- return of(hasDisplay.map(x => x[3]));
1954
+ obs = of(hasDisplay.map(x => x[3]));
1635
1955
  }
1956
+ return obs;
1636
1957
  }));
1637
1958
  }
1638
1959
  ngOnInit() {
1960
+ super.ngOnInit();
1639
1961
  this._formControlObs.next(this.formControl);
1640
- if (this.field.textInputValidator) {
1641
- this.inputCtrl.setValidators(this.field.textInputValidator);
1962
+ if (this.searchableField.textInputValidator) {
1963
+ this.inputCtrl.setValidators(this.searchableField.textInputValidator);
1642
1964
  }
1643
- if (!this.defaultComponentClass) {
1644
- if (this.useAnchor) {
1645
- this.defaultComponentClass = DbxDefaultSearchableAnchorFieldDisplayComponent;
1646
- }
1647
- else {
1648
- this.defaultComponentClass = DbxDefaultSearchableFieldDisplayComponent;
1649
- }
1965
+ if (!this.defaultDisplay?.componentClass) {
1966
+ this.defaultDisplay = {
1967
+ ...this.defaultDisplay,
1968
+ componentClass: DbxDefaultSearchableFieldDisplayComponent
1969
+ };
1650
1970
  }
1651
1971
  if (this.multiSelect === false) {
1652
1972
  this.singleValueSyncSubscription.subscription = this.displayValues$.subscribe((x) => {
@@ -1657,6 +1977,7 @@ class AbstractDbxSearchableValueFieldDirective extends FieldType {
1657
1977
  }
1658
1978
  }
1659
1979
  ngOnDestroy() {
1980
+ super.ngOnDestroy();
1660
1981
  this._displayHashMap.complete();
1661
1982
  this._formControlObs.complete();
1662
1983
  this.searchContext.destroy();
@@ -1670,7 +1991,7 @@ class AbstractDbxSearchableValueFieldDirective extends FieldType {
1670
1991
  this.inputCtrl.setValue(value.label);
1671
1992
  }
1672
1993
  _addWithTextValue(text) {
1673
- if (!this.field.allowStringValues) {
1994
+ if (!this.searchableField.allowStringValues) {
1674
1995
  return;
1675
1996
  }
1676
1997
  if (text) {
@@ -1692,6 +2013,17 @@ class AbstractDbxSearchableValueFieldDirective extends FieldType {
1692
2013
  removeWithDisplayValue(displayValue) {
1693
2014
  this.removeValue(displayValue.value);
1694
2015
  }
2016
+ _tryAddCurrentInputValue() {
2017
+ let addedValue = false;
2018
+ if (this.allowStringValues) {
2019
+ const value = this.inputCtrl.value;
2020
+ if ((value || '').trim()) {
2021
+ this._addWithTextValue(value);
2022
+ addedValue = true;
2023
+ }
2024
+ }
2025
+ return addedValue;
2026
+ }
1695
2027
  addValue(value) {
1696
2028
  this.textInput.nativeElement.value = '';
1697
2029
  this.inputCtrl.setValue(null);
@@ -1708,6 +2040,9 @@ class AbstractDbxSearchableValueFieldDirective extends FieldType {
1708
2040
  }
1709
2041
  this.setValues(values);
1710
2042
  }
2043
+ clearValues() {
2044
+ this.setValues([]);
2045
+ }
1711
2046
  setValues(values) {
1712
2047
  // Use to filter non-unique values.
1713
2048
  if (this.hashForValue) {
@@ -1721,17 +2056,17 @@ class AbstractDbxSearchableValueFieldDirective extends FieldType {
1721
2056
  return value;
1722
2057
  }
1723
2058
  _setValueOnFormControl(values) {
1724
- const value = (this.multiSelect) ? values : values?.[0];
2059
+ const value = (this.multiSelect) ? values : lastValue(values); // pick last value, as the last value added is the newest value.
1725
2060
  this.formControl.setValue(value);
1726
2061
  this.formControl.markAsDirty();
1727
2062
  this.formControl.markAsTouched();
1728
2063
  }
1729
2064
  }
1730
- AbstractDbxSearchableValueFieldDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AbstractDbxSearchableValueFieldDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2065
+ AbstractDbxSearchableValueFieldDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AbstractDbxSearchableValueFieldDirective, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
1731
2066
  AbstractDbxSearchableValueFieldDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: AbstractDbxSearchableValueFieldDirective, viewQueries: [{ propertyName: "textInput", first: true, predicate: ["textInput"], descendants: true }], usesInheritance: true, ngImport: i0 });
1732
2067
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AbstractDbxSearchableValueFieldDirective, decorators: [{
1733
2068
  type: Directive
1734
- }], propDecorators: { textInput: [{
2069
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { textInput: [{
1735
2070
  type: ViewChild,
1736
2071
  args: ['textInput']
1737
2072
  }] } });
@@ -1739,6 +2074,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
1739
2074
  class DbxSearchableChipFieldComponent extends AbstractDbxSearchableValueFieldDirective {
1740
2075
  constructor() {
1741
2076
  super(...arguments);
2077
+ this._blur = new Subject();
2078
+ this._blurSub = new SubscriptionObject();
1742
2079
  this.separatorKeysCodes = [ENTER, COMMA];
1743
2080
  }
1744
2081
  selected(event) {
@@ -1746,9 +2083,7 @@ class DbxSearchableChipFieldComponent extends AbstractDbxSearchableValueFieldDir
1746
2083
  }
1747
2084
  tabPressedOnInput(event) {
1748
2085
  if (event?.key?.toLowerCase() === 'tab') {
1749
- const value = this.inputCtrl.value;
1750
- if ((value || '').trim()) {
1751
- this._addWithTextValue(value);
2086
+ if (this._tryAddCurrentInputValue()) {
1752
2087
  event.preventDefault();
1753
2088
  event.stopImmediatePropagation();
1754
2089
  return false;
@@ -1760,15 +2095,36 @@ class DbxSearchableChipFieldComponent extends AbstractDbxSearchableValueFieldDir
1760
2095
  const text = event.value ?? this.inputCtrl.value;
1761
2096
  return this._addWithTextValue(text);
1762
2097
  }
2098
+ ngOnInit() {
2099
+ super.ngOnInit();
2100
+ // Only try and add the text item as a value if a value wasn't just added (for example, clicking a value).
2101
+ this._blurSub.subscription = this._blur.pipe(skipUntilTimeElapsedAfterLastEmission(this.values$, 100)).subscribe(() => {
2102
+ this._tryAddCurrentInputValue();
2103
+ });
2104
+ }
2105
+ ngOnDestroy() {
2106
+ super.ngOnDestroy();
2107
+ this._blur.complete();
2108
+ this._blurSub.destroy();
2109
+ }
2110
+ onBlur() {
2111
+ this._blur.next();
2112
+ }
1763
2113
  }
1764
2114
  DbxSearchableChipFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxSearchableChipFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1765
- DbxSearchableChipFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxSearchableChipFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div class=\"dbx-searchable-field\">\n <!-- Autocomplete -->\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"selected($event)\">\n <mat-option *ngFor=\"let displayValue of (searchResults$ | async)\" [value]=\"displayValue\">\n <dbx-searchable-field-autocomplete-item [displayValue]=\"displayValue\">\n </dbx-searchable-field-autocomplete-item>\n </mat-option>\n </mat-autocomplete>\n <!-- Template -->\n <ng-template #content>\n <mat-form-field class=\"dbx-searchable-field-form-field\">\n <mat-label>{{ label }}</mat-label>\n <!-- TODO: Add back aria-label [attr.aria-label]=\"'email ' + emailParticipantsType\" -->\n <mat-chip-list [required]=\"required\" [disabled]=\"readonly\" #chipList>\n <mat-chip *ngFor=\"let displayValue of displayValues$ | async\" [removable]=\"true\"\n (removed)=\"removeWithDisplayValue(displayValue)\">\n <span class=\"s-chip-label\">{{ displayValue.label }}</span>\n <span class=\"s-chip-sublabel\" *ngIf=\"displayValue.sublabel\">({{ displayValue.sublabel }})</span>\n <mat-icon *ngIf=\"!readonly\" matChipRemove>cancel</mat-icon>\n </mat-chip>\n <input #textInput [name]=\"name\" [placeholder]=\"placeholder\" [formControl]=\"inputCtrl\" [matAutocomplete]=\"auto\"\n autocomplete=\"{{ autocomplete }}\" [matChipInputFor]=\"chipList\" (keydown)=\"tabPressedOnInput($event)\"\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\" (matChipInputTokenEnd)=\"addChip($event)\">\n </mat-chip-list>\n <mat-hint *ngIf=\"description\">{{ description }}</mat-hint>\n </mat-form-field>\n <div class=\"searchable-field-form-loading\">\n <dbx-loading [linear]=\"true\" [context]=\"searchContext\"></dbx-loading>\n </div>\n </ng-template>\n <!-- View -->\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n</div>\n", components: [{ type: i1$5.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { type: i2$2.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: DbxSearchableFieldAutocompleteItemComponent, selector: "dbx-searchable-field-autocomplete-item", inputs: ["displayValue"] }, { type: i4.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i5$1.MatChipList, selector: "mat-chip-list", inputs: ["errorStateMatcher", "multiple", "compareWith", "value", "required", "placeholder", "disabled", "aria-orientation", "selectable", "tabIndex"], outputs: ["change", "valueChange"], exportAs: ["matChipList"] }, { type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i1$1.DbxLoadingComponent, selector: "dbx-loading", inputs: ["show", "text", "mode", "color", "diameter", "linear", "context", "loading", "error"] }], directives: [{ type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4.MatLabel, selector: "mat-label" }, { type: i5$1.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["color", "disableRipple", "tabIndex", "selected", "value", "selectable", "disabled", "removable"], outputs: ["selectionChange", "destroyed", "removed"], exportAs: ["matChip"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$1.MatChipRemove, selector: "[matChipRemove]" }, { type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1$5.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { type: i5$1.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i4.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "async": i5.AsyncPipe } });
2115
+ DbxSearchableChipFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxSearchableChipFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div class=\"dbx-searchable-field\">\n <!-- View -->\n <mat-chip-list [selectable]=\"!readonly\" [required]=\"required\" [disabled]=\"readonly\" #chipList>\n <mat-chip *ngFor=\"let displayValue of displayValues$ | async\" [removable]=\"true\"\n (removed)=\"removeWithDisplayValue(displayValue)\">\n <span class=\"dbx-chip-label\">{{ displayValue.label }}</span>\n <span class=\"dbx-chip-sublabel\" *ngIf=\"displayValue.sublabel\">{{ displayValue.sublabel }}</span>\n <mat-icon *ngIf=\"!readonly\" matChipRemove>cancel</mat-icon>\n </mat-chip>\n <input #textInput [name]=\"name\" [placeholder]=\"placeholder\" [formControl]=\"inputCtrl\" [matAutocomplete]=\"auto\"\n autocomplete=\"{{ autocomplete }}\" [matAutocompleteDisabled]=\"readonly\" [matChipInputFor]=\"chipList\" (keydown)=\"tabPressedOnInput($event)\"\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\" (matChipInputTokenEnd)=\"addChip($event)\" (blur)=\"onBlur()\">\n </mat-chip-list>\n <div class=\"searchable-field-form-loading\">\n <dbx-loading [linear]=\"true\" [context]=\"searchContext\"></dbx-loading>\n </div>\n</div>\n\n<!-- Autocomplete -->\n<mat-autocomplete class=\"dbx-searchable-text-field-autocomplete\" #auto=\"matAutocomplete\"\n (optionSelected)=\"selected($event)\">\n <mat-option *ngFor=\"let displayValue of (searchResults$ | async)\" [value]=\"displayValue\">\n <dbx-searchable-field-autocomplete-item [displayValue]=\"displayValue\">\n </dbx-searchable-field-autocomplete-item>\n </mat-option>\n</mat-autocomplete>\n", components: [{ type: i1$5.MatChipList, selector: "mat-chip-list", inputs: ["errorStateMatcher", "multiple", "compareWith", "value", "required", "placeholder", "disabled", "aria-orientation", "selectable", "tabIndex"], outputs: ["change", "valueChange"], exportAs: ["matChipList"] }, { type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i1$1.DbxLoadingComponent, selector: "dbx-loading", inputs: ["show", "text", "mode", "color", "diameter", "linear", "context", "loading", "error"] }, { type: i4$3.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { type: i6.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: DbxSearchableFieldAutocompleteItemComponent, selector: "dbx-searchable-field-autocomplete-item", inputs: ["displayValue"] }], directives: [{ type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1$5.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["color", "disableRipple", "tabIndex", "selected", "value", "selectable", "disabled", "removable"], outputs: ["selectionChange", "destroyed", "removed"], exportAs: ["matChip"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$5.MatChipRemove, selector: "[matChipRemove]" }, { type: i4$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4$3.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { type: i1$5.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], pipes: { "async": i5.AsyncPipe } });
1766
2116
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxSearchableChipFieldComponent, decorators: [{
1767
2117
  type: Component,
1768
- args: [{ template: "<div class=\"dbx-searchable-field\">\n <!-- Autocomplete -->\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"selected($event)\">\n <mat-option *ngFor=\"let displayValue of (searchResults$ | async)\" [value]=\"displayValue\">\n <dbx-searchable-field-autocomplete-item [displayValue]=\"displayValue\">\n </dbx-searchable-field-autocomplete-item>\n </mat-option>\n </mat-autocomplete>\n <!-- Template -->\n <ng-template #content>\n <mat-form-field class=\"dbx-searchable-field-form-field\">\n <mat-label>{{ label }}</mat-label>\n <!-- TODO: Add back aria-label [attr.aria-label]=\"'email ' + emailParticipantsType\" -->\n <mat-chip-list [required]=\"required\" [disabled]=\"readonly\" #chipList>\n <mat-chip *ngFor=\"let displayValue of displayValues$ | async\" [removable]=\"true\"\n (removed)=\"removeWithDisplayValue(displayValue)\">\n <span class=\"s-chip-label\">{{ displayValue.label }}</span>\n <span class=\"s-chip-sublabel\" *ngIf=\"displayValue.sublabel\">({{ displayValue.sublabel }})</span>\n <mat-icon *ngIf=\"!readonly\" matChipRemove>cancel</mat-icon>\n </mat-chip>\n <input #textInput [name]=\"name\" [placeholder]=\"placeholder\" [formControl]=\"inputCtrl\" [matAutocomplete]=\"auto\"\n autocomplete=\"{{ autocomplete }}\" [matChipInputFor]=\"chipList\" (keydown)=\"tabPressedOnInput($event)\"\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\" (matChipInputTokenEnd)=\"addChip($event)\">\n </mat-chip-list>\n <mat-hint *ngIf=\"description\">{{ description }}</mat-hint>\n </mat-form-field>\n <div class=\"searchable-field-form-loading\">\n <dbx-loading [linear]=\"true\" [context]=\"searchContext\"></dbx-loading>\n </div>\n </ng-template>\n <!-- View -->\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n</div>\n" }]
2118
+ args: [{ template: "<div class=\"dbx-searchable-field\">\n <!-- View -->\n <mat-chip-list [selectable]=\"!readonly\" [required]=\"required\" [disabled]=\"readonly\" #chipList>\n <mat-chip *ngFor=\"let displayValue of displayValues$ | async\" [removable]=\"true\"\n (removed)=\"removeWithDisplayValue(displayValue)\">\n <span class=\"dbx-chip-label\">{{ displayValue.label }}</span>\n <span class=\"dbx-chip-sublabel\" *ngIf=\"displayValue.sublabel\">{{ displayValue.sublabel }}</span>\n <mat-icon *ngIf=\"!readonly\" matChipRemove>cancel</mat-icon>\n </mat-chip>\n <input #textInput [name]=\"name\" [placeholder]=\"placeholder\" [formControl]=\"inputCtrl\" [matAutocomplete]=\"auto\"\n autocomplete=\"{{ autocomplete }}\" [matAutocompleteDisabled]=\"readonly\" [matChipInputFor]=\"chipList\" (keydown)=\"tabPressedOnInput($event)\"\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\" (matChipInputTokenEnd)=\"addChip($event)\" (blur)=\"onBlur()\">\n </mat-chip-list>\n <div class=\"searchable-field-form-loading\">\n <dbx-loading [linear]=\"true\" [context]=\"searchContext\"></dbx-loading>\n </div>\n</div>\n\n<!-- Autocomplete -->\n<mat-autocomplete class=\"dbx-searchable-text-field-autocomplete\" #auto=\"matAutocomplete\"\n (optionSelected)=\"selected($event)\">\n <mat-option *ngFor=\"let displayValue of (searchResults$ | async)\" [value]=\"displayValue\">\n <dbx-searchable-field-autocomplete-item [displayValue]=\"displayValue\">\n </dbx-searchable-field-autocomplete-item>\n </mat-option>\n</mat-autocomplete>\n" }]
1769
2119
  }] });
1770
2120
 
1771
- function makeMetaFilterSearchableFieldValueDisplayFn(loadMetaForValues, makeDisplayForValues) {
2121
+ /**
2122
+ * Used to create a SearchableValueFieldDisplayFn function that will retrieve the metadata for items that are missing their metadata so they can be displayed properly.
2123
+ *
2124
+ * @param param0
2125
+ * @returns
2126
+ */
2127
+ function makeMetaFilterSearchableFieldValueDisplayFn({ loadMetaForValues, makeDisplayForValues }) {
1772
2128
  return (values) => {
1773
2129
  const { included: loaded, excluded: needLoading } = separateValues(values, (x) => Boolean(x.meta));
1774
2130
  let allValues;
@@ -1793,19 +2149,36 @@ function makeMetaFilterSearchableFieldValueDisplayFn(loadMetaForValues, makeDisp
1793
2149
  else {
1794
2150
  allValues = of(loaded);
1795
2151
  }
1796
- return allValues.pipe(map((x) => makeDisplayForValues(x)));
2152
+ return allValues.pipe(switchMap$1((x) => makeDisplayForValues(x)));
1797
2153
  };
1798
2154
  }
2155
+ function searchableStringChipField(config) {
2156
+ return searchableChipField({
2157
+ ...config,
2158
+ allowStringValues: true
2159
+ });
2160
+ }
1799
2161
  function searchableChipField(config) {
2162
+ const { key, placeholder } = config;
1800
2163
  return formlyField({
2164
+ key,
1801
2165
  type: 'searchablechipfield',
1802
- ...config
2166
+ ...templateOptionsForFieldConfig(config, {
2167
+ placeholder: placeholder ?? 'Add...',
2168
+ autocomplete: false
2169
+ }),
2170
+ searchableField: config
1803
2171
  });
1804
2172
  }
1805
2173
  function searchableTextField(config) {
2174
+ const { key } = config;
1806
2175
  return formlyField({
2176
+ key,
1807
2177
  type: 'searchabletextfield',
1808
- ...config
2178
+ ...templateOptionsForFieldConfig(config, {
2179
+ autocomplete: false
2180
+ }),
2181
+ searchableField: config
1809
2182
  });
1810
2183
  }
1811
2184
 
@@ -1815,7 +2188,29 @@ function searchableTextField(config) {
1815
2188
  class DbxSearchableTextFieldComponent extends AbstractDbxSearchableValueFieldDirective {
1816
2189
  constructor() {
1817
2190
  super(...arguments);
2191
+ this.selectedDisplayValue$ = this.displayValues$.pipe(map$1(x => x[0]), shareReplay$1(1), tapDetectChanges(this.cdRef));
2192
+ this.hasValue$ = this.selectedDisplayValue$.pipe(map$1(x => Boolean(x)));
2193
+ this.showSelectedDisplayValue$ = this.selectedDisplayValue$.pipe(map$1(x => this.showSelectedValue && Boolean(x)), distinctUntilChanged$1(), shareReplay$1(1), tapDetectChanges(this.cdRef));
1818
2194
  this.multiSelect = false;
2195
+ this._clearInputSub = new SubscriptionObject();
2196
+ }
2197
+ get searchableField() {
2198
+ return this.field.searchableField;
2199
+ }
2200
+ get showSelectedValue() {
2201
+ return this.searchableField.showSelectedValue ?? !this.allowStringValues; // Show the selected value only if string values are allowed.
2202
+ }
2203
+ ngOnInit() {
2204
+ super.ngOnInit();
2205
+ this._clearInputSub.subscription = this.inputValue$.pipe(skipWhile((x) => !x)).subscribe((x) => {
2206
+ if (!x) {
2207
+ // this.clearValues();
2208
+ }
2209
+ });
2210
+ }
2211
+ ngOnDestroy() {
2212
+ super.ngOnDestroy();
2213
+ this._clearInputSub.destroy();
1819
2214
  }
1820
2215
  selected(event) {
1821
2216
  const e = event;
@@ -1823,10 +2218,10 @@ class DbxSearchableTextFieldComponent extends AbstractDbxSearchableValueFieldDir
1823
2218
  }
1824
2219
  }
1825
2220
  DbxSearchableTextFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxSearchableTextFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1826
- DbxSearchableTextFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxSearchableTextFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div class=\"dbx-searchable-text-field\">\n <!-- Autocomplete -->\n <mat-autocomplete #auto (optionSelected)=\"selected($event)\">\n <mat-option *ngFor=\"let displayValue of (searchResults$ | async)\" [value]=\"displayValue\">\n <dbx-searchable-field-autocomplete-item [displayValue]=\"displayValue\">\n </dbx-searchable-field-autocomplete-item>\n </mat-option>\n </mat-autocomplete>\n <!-- Template -->\n <ng-template #content>\n <mat-form-field class=\"dbx-searchable-field-form-field\">\n <mat-label>{{ label }}</mat-label>\n <input type=\"search\" [name]=\"name\" matInput #textInput [placeholder]=\"placeholder\" [formControl]=\"inputCtrl\" [matAutocomplete]=\"auto\"\n autocomplete=\"{{ autocomplete }}\">\n <mat-hint *ngIf=\"description\">{{ description }}</mat-hint>\n </mat-form-field>\n <div class=\"searchable-field-form-loading\">\n <dbx-loading [linear]=\"true\" [context]=\"searchContext\"></dbx-loading>\n </div>\n </ng-template>\n <!-- View -->\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n</div>\n", components: [{ type: i1$5.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { type: i2$2.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: DbxSearchableFieldAutocompleteItemComponent, selector: "dbx-searchable-field-autocomplete-item", inputs: ["displayValue"] }, { type: i4.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i1$1.DbxLoadingComponent, selector: "dbx-loading", inputs: ["show", "text", "mode", "color", "diameter", "linear", "context", "loading", "error"] }], directives: [{ type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4.MatLabel, selector: "mat-label" }, { type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1$5.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "async": i5.AsyncPipe } });
2221
+ DbxSearchableTextFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxSearchableTextFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div class=\"dbx-searchable-text-field\"\n [ngClass]=\"{ 'dbx-searchable-text-field-has-value': (hasValue$ | async), 'dbx-searchable-text-field-show-value': showSelectedValue }\">\n <!-- Result View -->\n <div class=\"dbx-searchable-text-field-value mat-option mat-option-text\" *ngIf=\"showSelectedDisplayValue$ | async\">\n <dbx-searchable-field-autocomplete-item [displayValue]=\"(selectedDisplayValue$ | async)!\">\n </dbx-searchable-field-autocomplete-item>\n </div>\n <div class=\"dbx-searchable-text-field-input\">\n <div class=\"dbx-label\">Search</div>\n <!-- View -->\n <input type=\"search\" [name]=\"name\" matInput #textInput [placeholder]=\"placeholder\" [formControl]=\"inputCtrl\"\n [matAutocomplete]=\"auto\" [matAutocompleteDisabled]=\"readonly\" autocomplete=\"{{ autocomplete }}\">\n <div class=\"searchable-field-form-loading\">\n <dbx-loading [linear]=\"true\" [context]=\"searchContext\"></dbx-loading>\n </div>\n </div>\n</div>\n\n<!-- Autocomplete -->\n<mat-autocomplete class=\"dbx-searchable-text-field-autocomplete\" #auto (optionSelected)=\"selected($event)\">\n <mat-option *ngFor=\"let displayValue of (searchResults$ | async)\" [value]=\"displayValue\">\n <dbx-searchable-field-autocomplete-item [displayValue]=\"displayValue\">\n </dbx-searchable-field-autocomplete-item>\n </mat-option>\n <!-- Add/Pick String Value -->\n <mat-option *ngIf=\"allowStringValues && (inputValue$ | async)\" [value]=\"{ value: (inputValue$ | async) }\">\n <p class=\"dbx-clear-hint text-center\">\"{{ inputValue$ | async }}\"</p>\n </mat-option>\n <!-- Show clear value -->\n <mat-option *ngIf=\"showClearValue && (hasValue$ | async)\" value=\"\">\n <p class=\"dbx-clear-hint text-center\">Clear</p>\n </mat-option>\n</mat-autocomplete>\n", components: [{ type: DbxSearchableFieldAutocompleteItemComponent, selector: "dbx-searchable-field-autocomplete-item", inputs: ["displayValue"] }, { type: i1$1.DbxLoadingComponent, selector: "dbx-loading", inputs: ["show", "text", "mode", "color", "diameter", "linear", "context", "loading", "error"] }, { type: i4$3.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { type: i6.MatOption, selector: "mat-option", exportAs: ["matOption"] }], directives: [{ type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i4$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4$3.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i5.AsyncPipe } });
1827
2222
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxSearchableTextFieldComponent, decorators: [{
1828
2223
  type: Component,
1829
- args: [{ template: "<div class=\"dbx-searchable-text-field\">\n <!-- Autocomplete -->\n <mat-autocomplete #auto (optionSelected)=\"selected($event)\">\n <mat-option *ngFor=\"let displayValue of (searchResults$ | async)\" [value]=\"displayValue\">\n <dbx-searchable-field-autocomplete-item [displayValue]=\"displayValue\">\n </dbx-searchable-field-autocomplete-item>\n </mat-option>\n </mat-autocomplete>\n <!-- Template -->\n <ng-template #content>\n <mat-form-field class=\"dbx-searchable-field-form-field\">\n <mat-label>{{ label }}</mat-label>\n <input type=\"search\" [name]=\"name\" matInput #textInput [placeholder]=\"placeholder\" [formControl]=\"inputCtrl\" [matAutocomplete]=\"auto\"\n autocomplete=\"{{ autocomplete }}\">\n <mat-hint *ngIf=\"description\">{{ description }}</mat-hint>\n </mat-form-field>\n <div class=\"searchable-field-form-loading\">\n <dbx-loading [linear]=\"true\" [context]=\"searchContext\"></dbx-loading>\n </div>\n </ng-template>\n <!-- View -->\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n</div>\n" }]
2224
+ args: [{ template: "<div class=\"dbx-searchable-text-field\"\n [ngClass]=\"{ 'dbx-searchable-text-field-has-value': (hasValue$ | async), 'dbx-searchable-text-field-show-value': showSelectedValue }\">\n <!-- Result View -->\n <div class=\"dbx-searchable-text-field-value mat-option mat-option-text\" *ngIf=\"showSelectedDisplayValue$ | async\">\n <dbx-searchable-field-autocomplete-item [displayValue]=\"(selectedDisplayValue$ | async)!\">\n </dbx-searchable-field-autocomplete-item>\n </div>\n <div class=\"dbx-searchable-text-field-input\">\n <div class=\"dbx-label\">Search</div>\n <!-- View -->\n <input type=\"search\" [name]=\"name\" matInput #textInput [placeholder]=\"placeholder\" [formControl]=\"inputCtrl\"\n [matAutocomplete]=\"auto\" [matAutocompleteDisabled]=\"readonly\" autocomplete=\"{{ autocomplete }}\">\n <div class=\"searchable-field-form-loading\">\n <dbx-loading [linear]=\"true\" [context]=\"searchContext\"></dbx-loading>\n </div>\n </div>\n</div>\n\n<!-- Autocomplete -->\n<mat-autocomplete class=\"dbx-searchable-text-field-autocomplete\" #auto (optionSelected)=\"selected($event)\">\n <mat-option *ngFor=\"let displayValue of (searchResults$ | async)\" [value]=\"displayValue\">\n <dbx-searchable-field-autocomplete-item [displayValue]=\"displayValue\">\n </dbx-searchable-field-autocomplete-item>\n </mat-option>\n <!-- Add/Pick String Value -->\n <mat-option *ngIf=\"allowStringValues && (inputValue$ | async)\" [value]=\"{ value: (inputValue$ | async) }\">\n <p class=\"dbx-clear-hint text-center\">\"{{ inputValue$ | async }}\"</p>\n </mat-option>\n <!-- Show clear value -->\n <mat-option *ngIf=\"showClearValue && (hasValue$ | async)\" value=\"\">\n <p class=\"dbx-clear-hint text-center\">Clear</p>\n </mat-option>\n</mat-autocomplete>\n" }]
1830
2225
  }] });
1831
2226
 
1832
2227
  class DbxFormFormlySearchableFieldModule {
@@ -1835,8 +2230,7 @@ DbxFormFormlySearchableFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion:
1835
2230
  DbxFormFormlySearchableFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlySearchableFieldModule, declarations: [DbxSearchableChipFieldComponent,
1836
2231
  DbxSearchableTextFieldComponent,
1837
2232
  DbxSearchableFieldAutocompleteItemComponent,
1838
- DbxDefaultSearchableFieldDisplayComponent,
1839
- DbxDefaultSearchableAnchorFieldDisplayComponent], imports: [CommonModule,
2233
+ DbxDefaultSearchableFieldDisplayComponent], imports: [CommonModule,
1840
2234
  DbxTextModule,
1841
2235
  DbxLoadingModule,
1842
2236
  DbxButtonModule,
@@ -1872,8 +2266,8 @@ DbxFormFormlySearchableFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion
1872
2266
  DbxInjectedComponentModule,
1873
2267
  FormlyModule.forChild({
1874
2268
  types: [
1875
- { name: 'searchablechipfield', component: DbxSearchableChipFieldComponent },
1876
- { name: 'searchabletextfield', component: DbxSearchableTextFieldComponent }
2269
+ { name: 'searchablechipfield', component: DbxSearchableChipFieldComponent, wrappers: ['form-field'] },
2270
+ { name: 'searchabletextfield', component: DbxSearchableTextFieldComponent, wrappers: ['form-field'] },
1877
2271
  ]
1878
2272
  })
1879
2273
  ]] });
@@ -1899,8 +2293,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
1899
2293
  DbxInjectedComponentModule,
1900
2294
  FormlyModule.forChild({
1901
2295
  types: [
1902
- { name: 'searchablechipfield', component: DbxSearchableChipFieldComponent },
1903
- { name: 'searchabletextfield', component: DbxSearchableTextFieldComponent }
2296
+ { name: 'searchablechipfield', component: DbxSearchableChipFieldComponent, wrappers: ['form-field'] },
2297
+ { name: 'searchabletextfield', component: DbxSearchableTextFieldComponent, wrappers: ['form-field'] },
1904
2298
  ]
1905
2299
  })
1906
2300
  ],
@@ -1908,8 +2302,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
1908
2302
  DbxSearchableChipFieldComponent,
1909
2303
  DbxSearchableTextFieldComponent,
1910
2304
  DbxSearchableFieldAutocompleteItemComponent,
1911
- DbxDefaultSearchableFieldDisplayComponent,
1912
- DbxDefaultSearchableAnchorFieldDisplayComponent
2305
+ DbxDefaultSearchableFieldDisplayComponent
1913
2306
  ],
1914
2307
  exports: [
1915
2308
  DbxSearchableChipFieldComponent,
@@ -1931,18 +2324,187 @@ function chipTextField(config) {
1931
2324
  });
1932
2325
  }
1933
2326
 
1934
- class DbxFormRepeatTypeComponent extends FieldArrayType {
1935
- get repeatSection() {
1936
- return this.to.repeatSection ?? {};
2327
+ class DbxFormFormlySelectionModule {
2328
+ }
2329
+ DbxFormFormlySelectionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlySelectionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2330
+ DbxFormFormlySelectionModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlySelectionModule, imports: [CommonModule], exports: [DbxFormFormlyPickableFieldModule,
2331
+ DbxFormFormlySearchableFieldModule] });
2332
+ DbxFormFormlySelectionModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlySelectionModule, imports: [[
2333
+ CommonModule
2334
+ ], DbxFormFormlyPickableFieldModule,
2335
+ DbxFormFormlySearchableFieldModule] });
2336
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlySelectionModule, decorators: [{
2337
+ type: NgModule,
2338
+ args: [{
2339
+ imports: [
2340
+ CommonModule
2341
+ ],
2342
+ declarations: [],
2343
+ exports: [
2344
+ DbxFormFormlyPickableFieldModule,
2345
+ DbxFormFormlySearchableFieldModule
2346
+ ]
2347
+ }]
2348
+ }] });
2349
+
2350
+ class DbxTextEditorFieldComponent extends FieldType$1 {
2351
+ constructor(compact) {
2352
+ super();
2353
+ this.compact = compact;
2354
+ this._sub = new SubscriptionObject();
2355
+ this.compactClass$ = mapCompactModeObs(this.compact?.mode$, {
2356
+ compact: 'dbx-texteditor-field-compact'
2357
+ });
2358
+ }
2359
+ get formGroupName() {
2360
+ return this.field.key;
2361
+ }
2362
+ get formGroup() {
2363
+ return this.form;
2364
+ }
2365
+ get editor() {
2366
+ return this._editor;
2367
+ }
2368
+ get label() {
2369
+ return this.field.templateOptions?.label;
2370
+ }
2371
+ get description() {
2372
+ return this.to.description;
2373
+ }
2374
+ ngOnInit() {
2375
+ super.ngOnInit();
2376
+ this._editor = new Editor({});
2377
+ // Watch for value changes every second and update the pristine level.
2378
+ this._sub.subscription = this.editor.valueChanges.pipe(debounceTime$1(100), filter(_ => this.editor.view.hasFocus())).subscribe(() => {
2379
+ this.formControl.updateValueAndValidity();
2380
+ this.formControl.markAsDirty();
2381
+ });
2382
+ }
2383
+ ngOnDestroy() {
2384
+ super.ngOnDestroy();
2385
+ if (this.editor) {
2386
+ this.editor.destroy();
2387
+ delete this._editor;
2388
+ }
2389
+ this._sub.destroy();
2390
+ }
2391
+ }
2392
+ DbxTextEditorFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxTextEditorFieldComponent, deps: [{ token: i1$1.CompactContextStore, optional: true }], target: i0.ɵɵFactoryTarget.Component });
2393
+ DbxTextEditorFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxTextEditorFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
2394
+ <div class="dbx-texteditor-field" [ngClass]="(compactClass$ | async) ?? ''" [formGroup]="formGroup">
2395
+ <dbx-label *ngIf="label">{{ label }}</dbx-label>
2396
+ <div class="dbx-texteditor-field-input">
2397
+ <ngx-editor [editor]="editor" outputFormat="html" [placeholder]="placeholder" [formControlName]="formGroupName"></ngx-editor>
2398
+ </div>
2399
+ <div class="dbx-texteditor-field-menu">
2400
+ <ngx-editor-menu [editor]="editor"></ngx-editor-menu>
2401
+ </div>
2402
+ <div>
2403
+ <dbx-hint *ngIf="description">{{ description }}</dbx-hint>
2404
+ </div>
2405
+ </div>
2406
+ `, isInline: true, components: [{ type: i1$1.DbxLabelComponent, selector: "dbx-label" }, { type: i2$3.NgxEditorComponent, selector: "ngx-editor", inputs: ["editor", "outputFormat", "placeholder"], outputs: ["focusOut", "focusIn"] }, { type: i2$3.MenuComponent, selector: "ngx-editor-menu", inputs: ["toolbar", "colorPresets", "disabled", "editor", "customMenuRef", "dropdownPlacement"] }, { type: i1$1.DbxHintComponent, selector: "dbx-hint" }], directives: [{ type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }], pipes: { "async": i5.AsyncPipe } });
2407
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxTextEditorFieldComponent, decorators: [{
2408
+ type: Component,
2409
+ args: [{
2410
+ template: `
2411
+ <div class="dbx-texteditor-field" [ngClass]="(compactClass$ | async) ?? ''" [formGroup]="formGroup">
2412
+ <dbx-label *ngIf="label">{{ label }}</dbx-label>
2413
+ <div class="dbx-texteditor-field-input">
2414
+ <ngx-editor [editor]="editor" outputFormat="html" [placeholder]="placeholder" [formControlName]="formGroupName"></ngx-editor>
2415
+ </div>
2416
+ <div class="dbx-texteditor-field-menu">
2417
+ <ngx-editor-menu [editor]="editor"></ngx-editor-menu>
2418
+ </div>
2419
+ <div>
2420
+ <dbx-hint *ngIf="description">{{ description }}</dbx-hint>
2421
+ </div>
2422
+ </div>
2423
+ `
2424
+ }]
2425
+ }], ctorParameters: function () { return [{ type: i1$1.CompactContextStore, decorators: [{
2426
+ type: Optional
2427
+ }] }]; } });
2428
+
2429
+ class DbxFormFormlyTextEditorFieldModule {
2430
+ }
2431
+ DbxFormFormlyTextEditorFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyTextEditorFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2432
+ DbxFormFormlyTextEditorFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyTextEditorFieldModule, declarations: [DbxTextEditorFieldComponent], imports: [CommonModule,
2433
+ DbxTextModule,
2434
+ FormsModule,
2435
+ ReactiveFormsModule,
2436
+ NgxEditorModule,
2437
+ MatFormFieldModule,
2438
+ MatInputModule, i1$4.FormlyModule] });
2439
+ DbxFormFormlyTextEditorFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyTextEditorFieldModule, imports: [[
2440
+ CommonModule,
2441
+ DbxTextModule,
2442
+ FormsModule,
2443
+ ReactiveFormsModule,
2444
+ NgxEditorModule,
2445
+ MatFormFieldModule,
2446
+ MatInputModule,
2447
+ FormlyModule.forChild({
2448
+ types: [
2449
+ { name: 'texteditor', component: DbxTextEditorFieldComponent }
2450
+ ]
2451
+ })
2452
+ ]] });
2453
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyTextEditorFieldModule, decorators: [{
2454
+ type: NgModule,
2455
+ args: [{
2456
+ imports: [
2457
+ CommonModule,
2458
+ DbxTextModule,
2459
+ FormsModule,
2460
+ ReactiveFormsModule,
2461
+ NgxEditorModule,
2462
+ MatFormFieldModule,
2463
+ MatInputModule,
2464
+ FormlyModule.forChild({
2465
+ types: [
2466
+ { name: 'texteditor', component: DbxTextEditorFieldComponent }
2467
+ ]
2468
+ })
2469
+ ],
2470
+ declarations: [
2471
+ DbxTextEditorFieldComponent
2472
+ ],
2473
+ exports: []
2474
+ }]
2475
+ }] });
2476
+
2477
+ function textEditorField(config) {
2478
+ const { key, minLength, maxLength } = config;
2479
+ const fieldConfig = formlyField({
2480
+ key,
2481
+ type: 'texteditor',
2482
+ defaultValue: '',
2483
+ modelOptions: {
2484
+ // https://formly.dev/examples/validation/async-validation-update-on
2485
+ // Set to trigger value update on blurs with the form. However, the value is set internally too.
2486
+ updateOn: 'blur'
2487
+ },
2488
+ ...templateOptionsForFieldConfig(config, {
2489
+ minLength,
2490
+ maxLength
2491
+ })
2492
+ });
2493
+ return fieldConfig;
2494
+ }
2495
+
2496
+ class DbxFormRepeatArrayTypeComponent extends FieldArrayType {
2497
+ get repeatArrayField() {
2498
+ return this.field.repeatArrayField;
1937
2499
  }
1938
- get itemLabel() {
1939
- return this.repeatSection.itemLabel ?? '#';
2500
+ get label() {
2501
+ return this.field.templateOptions.label ?? this.field.key;
1940
2502
  }
1941
2503
  get addText() {
1942
- return this.repeatSection.addText ?? 'Add';
2504
+ return this.repeatArrayField.addText ?? 'Add';
1943
2505
  }
1944
2506
  get removeText() {
1945
- return this.repeatSection.removeText ?? 'Remove';
2507
+ return this.repeatArrayField.removeText ?? 'Remove';
1946
2508
  }
1947
2509
  get max() {
1948
2510
  return this.field.templateOptions?.maxLength;
@@ -1959,53 +2521,86 @@ class DbxFormRepeatTypeComponent extends FieldArrayType {
1959
2521
  return (this.count < max);
1960
2522
  }
1961
2523
  }
1962
- }
1963
- DbxFormRepeatTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormRepeatTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1964
- DbxFormRepeatTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxFormRepeatTypeComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
1965
- <div class="form-repeat-section">
1966
- <!-- Fields -->
1967
- <div class="form-repeat-section-fields">
1968
- <ng-container *ngFor="let field of field.fieldGroup; let i = index; let last = last;">
1969
- <div class="form-repeat-section-field">
1970
- <div>
1971
- <h4><span>{{ itemLabel }}</span><span>{{ i + 1 }}</span></h4>
1972
- <dbx-button-spacer></dbx-button-spacer>
1973
- <button mat-button color="warn" (click)="remove(i)">{{ removeText }}</button>
2524
+ /**
2525
+ * Moves the target index up one value.
2526
+ *
2527
+ * @param index
2528
+ */
2529
+ moveUp(index) {
2530
+ if (index === 0) {
2531
+ return;
2532
+ }
2533
+ this.swapIndexes(index, index - 1);
2534
+ }
2535
+ moveDown(index) {
2536
+ this.swapIndexes(index, index + 1);
2537
+ }
2538
+ swapIndexes(currentIndex, targetIndex) {
2539
+ const array = this.model;
2540
+ const targetValue = array[currentIndex];
2541
+ if (!targetValue) {
2542
+ return;
2543
+ }
2544
+ this.remove(currentIndex);
2545
+ this.add(targetIndex, targetValue);
2546
+ }
2547
+ drop(event) {
2548
+ this.swapIndexes(event.previousIndex, event.currentIndex);
2549
+ }
2550
+ labelForItem(field) {
2551
+ return getValueFromObjectOrGetter(this.repeatArrayField.labelForField ?? '', field);
2552
+ }
2553
+ }
2554
+ DbxFormRepeatArrayTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormRepeatArrayTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2555
+ DbxFormRepeatArrayTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxFormRepeatArrayTypeComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
2556
+ <div class="dbx-form-repeat-array">
2557
+ <dbx-subsection [header]="label">
2558
+ <!-- Fields -->
2559
+ <div class="dbx-form-repeat-array-fields" cdkDropList (cdkDropListDropped)="drop($event)">
2560
+ <div class="dbx-form-repeat-array-field" cdkDrag cdkDragLockAxis="y" *ngFor="let field of field.fieldGroup; let i = index; let last = last;">
2561
+ <div class="example-custom-placeholder" *cdkDragPlaceholder></div>
2562
+ <dbx-bar>
2563
+ <button cdkDragHandle mat-flat-button><mat-icon>drag_handle</mat-icon></button>
2564
+ <dbx-button-spacer></dbx-button-spacer>
2565
+ <h4><span class="repeat-array-number">{{ i + 1 }}</span><span>{{ labelForItem(field) }}</span></h4>
2566
+ <span class="dbx-spacer"></span>
2567
+ <button mat-flat-button color="warn" (click)="remove(i)">{{ removeText }}</button>
2568
+ </dbx-bar>
2569
+ <formly-field class="dbx-form-repeat-array-field-content" [field]="field"></formly-field>
1974
2570
  </div>
1975
- <formly-field [field]="field"></formly-field>
1976
- </div>
1977
- <mat-divider [inset]="true" *ngIf="!last"></mat-divider>
1978
- </ng-container>
1979
- </div>
1980
- <!-- Add Button -->
1981
- <div class="form-repeat-section-footer">
1982
- <button *ngIf="canAdd" mat-button (click)="add()">{{ addText }}</button>
1983
- </div>
2571
+ </div>
2572
+ <!-- Add Button -->
2573
+ <div class="dbx-form-repeat-array-footer">
2574
+ <button *ngIf="canAdd" mat-raised-button (click)="add()">{{ addText }}</button>
2575
+ </div>
2576
+ </dbx-subsection>
1984
2577
  </div>
1985
- `, isInline: true, components: [{ type: i1$1.DbxButtonSpacerComponent, selector: "dbx-button-spacer" }, { type: i1$4.FormlyField, selector: "formly-field", inputs: ["field"] }, { type: i3$2.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }], directives: [{ type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1986
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormRepeatTypeComponent, decorators: [{
2578
+ `, isInline: true, components: [{ type: i1$1.DbxSubSectionComponent, selector: "dbx-subsection" }, { type: i1$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i1$1.DbxButtonSpacerComponent, selector: "dbx-button-spacer" }, { type: i1$4.FormlyField, selector: "formly-field", inputs: ["field"] }], directives: [{ type: i5$1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { type: i5$1.CdkDragPlaceholder, selector: "ng-template[cdkDragPlaceholder]", inputs: ["data"] }, { type: i1$1.DbxBarDirective, selector: "dbx-bar", inputs: ["color"] }, { type: i5$1.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
2579
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormRepeatArrayTypeComponent, decorators: [{
1987
2580
  type: Component,
1988
2581
  args: [{
1989
2582
  template: `
1990
- <div class="form-repeat-section">
1991
- <!-- Fields -->
1992
- <div class="form-repeat-section-fields">
1993
- <ng-container *ngFor="let field of field.fieldGroup; let i = index; let last = last;">
1994
- <div class="form-repeat-section-field">
1995
- <div>
1996
- <h4><span>{{ itemLabel }}</span><span>{{ i + 1 }}</span></h4>
1997
- <dbx-button-spacer></dbx-button-spacer>
1998
- <button mat-button color="warn" (click)="remove(i)">{{ removeText }}</button>
2583
+ <div class="dbx-form-repeat-array">
2584
+ <dbx-subsection [header]="label">
2585
+ <!-- Fields -->
2586
+ <div class="dbx-form-repeat-array-fields" cdkDropList (cdkDropListDropped)="drop($event)">
2587
+ <div class="dbx-form-repeat-array-field" cdkDrag cdkDragLockAxis="y" *ngFor="let field of field.fieldGroup; let i = index; let last = last;">
2588
+ <div class="example-custom-placeholder" *cdkDragPlaceholder></div>
2589
+ <dbx-bar>
2590
+ <button cdkDragHandle mat-flat-button><mat-icon>drag_handle</mat-icon></button>
2591
+ <dbx-button-spacer></dbx-button-spacer>
2592
+ <h4><span class="repeat-array-number">{{ i + 1 }}</span><span>{{ labelForItem(field) }}</span></h4>
2593
+ <span class="dbx-spacer"></span>
2594
+ <button mat-flat-button color="warn" (click)="remove(i)">{{ removeText }}</button>
2595
+ </dbx-bar>
2596
+ <formly-field class="dbx-form-repeat-array-field-content" [field]="field"></formly-field>
1999
2597
  </div>
2000
- <formly-field [field]="field"></formly-field>
2001
- </div>
2002
- <mat-divider [inset]="true" *ngIf="!last"></mat-divider>
2003
- </ng-container>
2004
- </div>
2005
- <!-- Add Button -->
2006
- <div class="form-repeat-section-footer">
2007
- <button *ngIf="canAdd" mat-button (click)="add()">{{ addText }}</button>
2008
- </div>
2598
+ </div>
2599
+ <!-- Add Button -->
2600
+ <div class="dbx-form-repeat-array-footer">
2601
+ <button *ngIf="canAdd" mat-raised-button (click)="add()">{{ addText }}</button>
2602
+ </div>
2603
+ </dbx-subsection>
2009
2604
  </div>
2010
2605
  `
2011
2606
  }]
@@ -2014,20 +2609,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
2014
2609
  class DbxFormFormlyArrayFieldModule {
2015
2610
  }
2016
2611
  DbxFormFormlyArrayFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyArrayFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2017
- DbxFormFormlyArrayFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyArrayFieldModule, declarations: [DbxFormRepeatTypeComponent], imports: [CommonModule,
2612
+ DbxFormFormlyArrayFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyArrayFieldModule, declarations: [DbxFormRepeatArrayTypeComponent], imports: [CommonModule,
2018
2613
  MatFormFieldModule,
2019
2614
  ReactiveFormsModule,
2020
2615
  MatDividerModule,
2616
+ MatButtonModule,
2617
+ MatIconModule,
2618
+ DragDropModule,
2619
+ DbxSectionLayoutModule,
2620
+ DbxBarLayoutModule,
2021
2621
  DbxButtonModule, i1$4.FormlyModule] });
2022
2622
  DbxFormFormlyArrayFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyArrayFieldModule, imports: [[
2023
2623
  CommonModule,
2024
2624
  MatFormFieldModule,
2025
2625
  ReactiveFormsModule,
2026
2626
  MatDividerModule,
2627
+ MatButtonModule,
2628
+ MatIconModule,
2629
+ DragDropModule,
2630
+ DbxSectionLayoutModule,
2631
+ DbxBarLayoutModule,
2027
2632
  DbxButtonModule,
2028
2633
  FormlyModule.forChild({
2029
2634
  types: [
2030
- { name: 'repeat', component: DbxFormRepeatTypeComponent }
2635
+ { name: 'repeatarray', component: DbxFormRepeatArrayTypeComponent }
2031
2636
  ]
2032
2637
  })
2033
2638
  ]] });
@@ -2039,20 +2644,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
2039
2644
  MatFormFieldModule,
2040
2645
  ReactiveFormsModule,
2041
2646
  MatDividerModule,
2647
+ MatButtonModule,
2648
+ MatIconModule,
2649
+ DragDropModule,
2650
+ DbxSectionLayoutModule,
2651
+ DbxBarLayoutModule,
2042
2652
  DbxButtonModule,
2043
2653
  FormlyModule.forChild({
2044
2654
  types: [
2045
- { name: 'repeat', component: DbxFormRepeatTypeComponent }
2655
+ { name: 'repeatarray', component: DbxFormRepeatArrayTypeComponent }
2046
2656
  ]
2047
2657
  })
2048
2658
  ],
2049
2659
  declarations: [
2050
- DbxFormRepeatTypeComponent
2660
+ DbxFormRepeatArrayTypeComponent
2051
2661
  ],
2052
2662
  exports: []
2053
2663
  }]
2054
2664
  }] });
2055
2665
 
2666
+ function repeatArrayField(config) {
2667
+ const { key, repeatFieldGroup, maxLength, addText, removeText, labelForField } = config;
2668
+ return formlyField({
2669
+ key,
2670
+ type: 'repeatarray',
2671
+ repeatArrayField: {
2672
+ labelForField,
2673
+ addText,
2674
+ removeText,
2675
+ },
2676
+ ...templateOptionsForFieldConfig(config, {
2677
+ maxLength
2678
+ }),
2679
+ fieldArray: {
2680
+ fieldGroup: repeatFieldGroup
2681
+ }
2682
+ });
2683
+ }
2684
+
2056
2685
  class DbxFormFormlyBooleanFieldModule {
2057
2686
  }
2058
2687
  DbxFormFormlyBooleanFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyBooleanFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
@@ -2067,33 +2696,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
2067
2696
  }]
2068
2697
  }] });
2069
2698
 
2070
- function toggleField({ key, label, description, defaultValue, required, readonly }) {
2699
+ function toggleField(config) {
2700
+ const { key, defaultValue } = config;
2071
2701
  return formlyField({
2072
2702
  key,
2073
2703
  type: 'toggle',
2074
2704
  wrappers: ['autotouch', 'form-field'],
2075
2705
  defaultValue: defaultValue ?? false,
2076
- templateOptions: {
2077
- label,
2078
- description,
2079
- required,
2080
- readonly
2081
- }
2706
+ ...templateOptionsForFieldConfig(config)
2082
2707
  });
2083
2708
  }
2084
- function checkboxField({ key, label = '', placeholder = '', defaultValue, required, readonly, autocomplete }) {
2085
- return {
2709
+ function checkboxField(config) {
2710
+ const { key, defaultValue } = config;
2711
+ return formlyField({
2086
2712
  key,
2087
2713
  type: 'checkbox',
2088
- defaultValue,
2089
- templateOptions: {
2090
- label,
2091
- placeholder,
2092
- required,
2093
- readonly,
2094
- autocomplete
2095
- },
2096
- };
2714
+ defaultValue: defaultValue ?? false,
2715
+ ...templateOptionsForFieldConfig(config)
2716
+ });
2097
2717
  }
2098
2718
  /*
2099
2719
  export function acceptTermsField({ key = 'accept', label = 'Accept Terms', description = 'In order to proceed, please accept terms', required = true }
@@ -2131,7 +2751,7 @@ var DateTimeFieldTimeMode;
2131
2751
  */
2132
2752
  DateTimeFieldTimeMode["NONE"] = "none";
2133
2753
  })(DateTimeFieldTimeMode || (DateTimeFieldTimeMode = {}));
2134
- class DbxDateTimeFieldComponent extends FieldType {
2754
+ class DbxDateTimeFieldComponent extends FieldType$1 {
2135
2755
  constructor(cdRef) {
2136
2756
  super();
2137
2757
  this.cdRef = cdRef;
@@ -2148,7 +2768,7 @@ class DbxDateTimeFieldComponent extends FieldType {
2148
2768
  * Used to trigger/display visual updates (specifically on timeDistance, etc.).
2149
2769
  */
2150
2770
  this.displayValue$ = interval(10 * 1000).pipe(startWith$1(0), map(_ => new Date().getMinutes()), distinctUntilChanged(), tap((_) => this.cdRef.markForCheck()), switchMap(_ => this.value$), shareReplay(1));
2151
- this.timeString$ = this.value$.pipe(filter(x => Boolean(x)), map((x) => {
2771
+ this.timeString$ = this.value$.pipe(filterMaybe(), map((x) => {
2152
2772
  const timezone = guessCurrentTimezone();
2153
2773
  const timeString = toReadableTimeString(x, timezone);
2154
2774
  return timeString;
@@ -2163,72 +2783,90 @@ class DbxDateTimeFieldComponent extends FieldType {
2163
2783
  this.fullDay$ = this.fullDayControl$.pipe(switchMap(control => control.valueChanges.pipe(startWith$1(control.value))));
2164
2784
  this.showTimeInput$ = this.fullDay$.pipe(map(x => !x && this.timeMode !== DateTimeFieldTimeMode.NONE));
2165
2785
  this.showAddTime$ = this.showTimeInput$.pipe(map(x => !x && this.timeMode === DateTimeFieldTimeMode.OPTIONAL), shareReplay(1));
2166
- this.date$ = this._date.pipe(distinctUntilChanged((a, b) => isSameDay(a, b)));
2167
- this.dateValue$ = merge(this.value$.pipe(startWith$1(undefined)), this.date$).pipe(filterMaybe(), map((x) => startOfDay(x)), distinctUntilChanged((a, b) => isSameDay(a, b)), shareReplay(1));
2168
- this.timeInput$ = this._updateTime.pipe(debounceTime(5), map(x => this.timeInputCtrl.value), distinctUntilChanged());
2169
- this.config$ = this._config.pipe(switchMapMaybeObs(), shareReplay(1));
2786
+ this.date$ = this._date.asObservable();
2787
+ this.dateValue$ = merge(this.value$.pipe(startWith$1(undefined)), this.date$).pipe(map((x) => (x) ? startOfDay(x) : x), distinctUntilChanged((a, b) => Boolean(a && b) && isSameDay(a, b)), shareReplay(1));
2788
+ this.timeInput$ = this._updateTime.pipe(debounceTime$1(5), map(_ => this.timeInputCtrl.value), distinctUntilChanged());
2789
+ this.config$ = this._config.pipe(switchMapMaybeDefault(), shareReplay(1));
2170
2790
  this.rawDateTime$ = combineLatest([
2171
- this.dateValue$.pipe(filterMaybe()),
2791
+ this.dateValue$,
2172
2792
  this.timeInput$.pipe(startWith$1(null)),
2173
2793
  this.fullDay$
2174
2794
  ]).pipe(map(([date, timeString, fullDay]) => {
2175
2795
  let result;
2176
- if (fullDay) {
2177
- if (this.field.fullDayInUTC) {
2178
- result = utcDayForDate(date);
2796
+ if (date) {
2797
+ if (fullDay) {
2798
+ if (this.dateTimeField.fullDayInUTC) {
2799
+ result = utcDayForDate(date);
2800
+ }
2801
+ else {
2802
+ result = startOfDay(date);
2803
+ }
2804
+ }
2805
+ else if (timeString) {
2806
+ result = readableTimeStringToDate(timeString, {
2807
+ date,
2808
+ useSystemTimezone: true
2809
+ }) ?? date;
2179
2810
  }
2180
2811
  else {
2181
- result = startOfDay(date);
2812
+ result = date;
2182
2813
  }
2183
2814
  }
2184
- else if (timeString) {
2185
- result = readableTimeStringToDate(timeString, {
2186
- date,
2187
- useSystemTimezone: true
2188
- });
2189
- }
2190
2815
  return result;
2191
- }), filterMaybe(), distinctUntilChanged((a, b) => isSameMinute(a, b)), shareReplay(1));
2816
+ }), distinctUntilChanged((a, b) => Boolean(a && b) && isSameMinute(a, b)), shareReplay(1));
2192
2817
  this.timeOutput$ = combineLatest([
2193
2818
  this.rawDateTime$,
2194
2819
  this._offset,
2195
2820
  this.config$.pipe(distinctUntilChanged()),
2196
- ]).pipe(throttleTime(10, undefined, { leading: false, trailing: true }), distinctUntilChanged((current, next) => current[0] === next[0] && next[1] === 0), tap(([_, stepsOffset]) => (stepsOffset) ? this._offset.next(0) : 0), map(([date, stepsOffset, config]) => {
2197
- const instance = new DateTimeMinuteInstance({
2198
- date,
2199
- ...config,
2200
- roundDownToMinute: true
2201
- });
2202
- date = instance.limit(date);
2203
- const minutes = stepsOffset * 5;
2204
- date = addMinutes(date, minutes);
2821
+ ]).pipe(throttleTime(40, undefined, { leading: false, trailing: true }), distinctUntilChanged((current, next) => current[0] === next[0] && next[1] === 0), tap(([_, stepsOffset]) => (stepsOffset) ? this._offset.next(0) : 0), map(([date, stepsOffset, config]) => {
2822
+ if (date != null) {
2823
+ const instance = new DateTimeMinuteInstance({
2824
+ date,
2825
+ ...config,
2826
+ roundDownToMinute: true
2827
+ });
2828
+ date = instance.limit(date);
2829
+ const minutes = stepsOffset * 5;
2830
+ date = addMinutes(date, minutes);
2831
+ }
2205
2832
  return date;
2206
- }), distinctUntilChanged((a, b) => a && b && isSameMinute(a, b)));
2833
+ }), distinctUntilChanged((a, b) => Boolean(a && b) && isSameMinute(a, b)), shareReplay(1));
2834
+ }
2835
+ get dateOnly() {
2836
+ return this.timeMode === DateTimeFieldTimeMode.NONE;
2837
+ }
2838
+ get dateTimeField() {
2839
+ return this.field.dateTimeField;
2207
2840
  }
2208
2841
  get timeOnly() {
2209
- return this.field.timeOnly;
2842
+ return this.dateTimeField.timeOnly;
2210
2843
  }
2211
2844
  get showDateInput() {
2212
2845
  return !this.timeOnly;
2213
2846
  }
2214
2847
  get timeMode() {
2215
- return (this.timeOnly) ? DateTimeFieldTimeMode.REQUIRED : (this.field.timeMode ?? DateTimeFieldTimeMode.REQUIRED);
2848
+ return (this.timeOnly) ? DateTimeFieldTimeMode.REQUIRED : (this.dateTimeField.timeMode ?? DateTimeFieldTimeMode.REQUIRED);
2216
2849
  }
2217
2850
  get description() {
2218
2851
  return this.field.templateOptions?.description;
2219
2852
  }
2220
2853
  ngOnInit() {
2854
+ super.ngOnInit();
2221
2855
  this._formControlObs.next(this.formControl);
2222
- this._config.next(this.field.getConfigObs?.());
2223
- this._sub.subscription = this.timeOutput$.subscribe((value) => {
2856
+ this._config.next(this.dateTimeField.getConfigObs?.());
2857
+ this._sub.subscription = this.timeOutput$.pipe(skipFirstMaybe()).subscribe((value) => {
2224
2858
  this.formControl.setValue(value);
2225
2859
  this.formControl.markAsDirty();
2226
2860
  this.formControl.markAsTouched();
2227
2861
  });
2228
2862
  this._valueSub.subscription = this.timeString$.subscribe((x) => {
2863
+ // Skip events where the timeInput value is cleared.
2864
+ if (!this.timeInputCtrl.value && x === '12:00AM') {
2865
+ return;
2866
+ }
2229
2867
  this.timeInputCtrl.setValue(x);
2230
2868
  });
2231
- const isFullDayField = this.field.fullDayFieldName;
2869
+ const isFullDayField = this.dateTimeField.fullDayFieldName;
2232
2870
  let fullDayFieldCtrl;
2233
2871
  if (isFullDayField) {
2234
2872
  fullDayFieldCtrl = this.form.get(isFullDayField);
@@ -2242,7 +2880,7 @@ class DbxDateTimeFieldComponent extends FieldType {
2242
2880
  fullDayFieldCtrl = this._fullDayInputCtrl;
2243
2881
  }
2244
2882
  this._fullDayControlObs.next(fullDayFieldCtrl);
2245
- switch (this.field.timeMode) {
2883
+ switch (this.dateTimeField.timeMode) {
2246
2884
  case DateTimeFieldTimeMode.OPTIONAL:
2247
2885
  break;
2248
2886
  case DateTimeFieldTimeMode.NONE:
@@ -2254,6 +2892,7 @@ class DbxDateTimeFieldComponent extends FieldType {
2254
2892
  }
2255
2893
  }
2256
2894
  ngOnDestroy() {
2895
+ super.ngOnDestroy();
2257
2896
  this._formControlObs.complete();
2258
2897
  this._date.complete();
2259
2898
  this._updateTime.complete();
@@ -2261,6 +2900,12 @@ class DbxDateTimeFieldComponent extends FieldType {
2261
2900
  this._sub.destroy();
2262
2901
  this._valueSub.destroy();
2263
2902
  }
2903
+ dateTextChanged(e) {
2904
+ const value = this.dateInput.value;
2905
+ if (value == null) {
2906
+ this._date.next(undefined);
2907
+ }
2908
+ }
2264
2909
  datePicked(event) {
2265
2910
  const date = event.value;
2266
2911
  if (date) {
@@ -2316,11 +2961,14 @@ class DbxDateTimeFieldComponent extends FieldType {
2316
2961
  }
2317
2962
  }
2318
2963
  DbxDateTimeFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxDateTimeFieldComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2319
- DbxDateTimeFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxDateTimeFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div class=\"dbx-datetime-field\" fxLayout=\"row wrap\" fxLayout.xs=\"column wrap\" fxLayoutAlign=\"space-evenly stretch\">\n <!-- Date -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" fxFlex=\"50\" *ngIf=\"showDateInput\">\n <ng-container *ngTemplateOutlet=\"dateInputTemplate\"></ng-container>\n </div>\n <!-- Time -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"showDateInput ? 50 : 100\">\n <ng-container *ngIf=\"showTimeInput$ | async\">\n <ng-container *ngTemplateOutlet=\"timeMenuAndInputTemplate\"></ng-container>\n </ng-container>\n <div class=\"add-time-button-wrapper\" *ngIf=\"showAddTime$ | async\">\n <button mat-button class=\"add-time-button\" (click)=\"addTime()\">\n <mat-icon>timer</mat-icon> Add Time\n </button>\n </div>\n </div>\n <div class=\"dbx-datetime-row dbx-datetime-hint-row\" fxFlex=\"100\">\n <div class=\"dbx-hint\" [ngSwitch]=\"fullDay$ | async\">\n <small *ngSwitchCase=\"true\"><b class=\"dbx-ok\">All Day</b> {{ dateValue$ | async | date:'fullDate' }}\n ({{ dateValue$ | async | dateDistance }})</small>\n <small *ngSwitchCase=\"false\">\n <ng-container *ngIf=\"value$ | async\"><b class=\"dbx-ok\">At</b> {{ displayValue$ | async | date:'medium' }}\n ({{ displayValue$ | async | timeDistance }})</ng-container>\n </small>\n </div>\n <div class=\"dbx-small dbx-label\" *ngIf=\"description\">\n {{ description }}\n </div>\n </div>\n</div>\n\n<!-- Date Input Template -->\n<ng-template #dateInputTemplate>\n <button mat-icon-button (click)=\"picker.open()\">\n <mat-icon>calendar_today</mat-icon>\n </button>\n <mat-form-field class=\"dbx-datetime-row-field\">\n <mat-label>Date</mat-label>\n <input matInput [matDatepicker]=\"picker\" (dateChange)=\"datePicked($event)\" [value]=\"dateValue$ | async\">\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n</ng-template>\n\n<!-- Time Menu/Input Template -->\n<ng-template #timeMenuAndInputTemplate>\n <button mat-icon-button [matMenuTriggerFor]=\"timemenu\" aria-label=\"opens the time menu\">\n <mat-icon>timer</mat-icon>\n </button>\n <mat-menu #timemenu=\"matMenu\">\n <ng-container *ngIf=\"timeMode === 'optional'\">\n <button mat-menu-item (click)=\"removeTime()\">\n <span>Remove Time</span>\n </button>\n <mat-divider></mat-divider>\n </ng-container>\n <button mat-menu-item (click)=\"setTime('12:00AM')\">\n <span>Midnight</span>\n </button>\n <button mat-menu-item (click)=\"setTime('6:00AM')\">\n <span>6:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('8:00AM')\">\n <span>8:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('10:00AM')\">\n <span>10:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('12:00PM')\">\n <span>Noon</span>\n </button>\n <button mat-menu-item (click)=\"setTime('2:00PM')\">\n <span>2:00PM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('5:00PM')\">\n <span>5:00PM</span>\n </button>\n </mat-menu>\n <mat-form-field class=\"dbx-datetime-row-field\">\n <mat-label>Time</mat-label>\n <input #timeInput matInput [formControl]=\"timeInputCtrl\" (focus)=\"focusTime()\" (focusout)=\"focusOutTime()\"\n (keydown)=\"keydownOnInput($event)\">\n </mat-form-field>\n</ng-template>\n", components: [{ type: i1$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i4.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i4$1.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { type: i5$2.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { type: i5$2.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { type: i3$2.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }], directives: [{ type: i3$1.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { type: i3$1.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$1.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i5.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i5.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i4.MatLabel, selector: "mat-label" }, { type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i4$1.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { type: i5$2.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }, { type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], pipes: { "async": i5.AsyncPipe, "date": i5.DatePipe, "dateDistance": i2.DateDistancePipe, "timeDistance": i2.TimeDistancePipe } });
2964
+ DbxDateTimeFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxDateTimeFieldComponent, selector: "ng-component", viewQueries: [{ propertyName: "dateInput", first: true, predicate: ["dateInput"], descendants: true, read: MatInput }], usesInheritance: true, ngImport: i0, template: "<div class=\"dbx-datetime-field\" fxLayout=\"row wrap\" fxLayout.xs=\"column wrap\" fxLayoutAlign=\"space-evenly stretch\">\n <!-- Date -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"dateOnly ? '100' : '50'\" *ngIf=\"showDateInput\">\n <ng-container *ngTemplateOutlet=\"dateInputTemplate\"></ng-container>\n </div>\n <!-- Time -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"showDateInput ? '50' : '100'\">\n <ng-container *ngIf=\"showTimeInput$ | async\">\n <ng-container *ngTemplateOutlet=\"timeMenuAndInputTemplate\"></ng-container>\n </ng-container>\n <div class=\"add-time-button-wrapper\" *ngIf=\"showAddTime$ | async\">\n <button mat-button class=\"add-time-button\" ngClass.lt-sm=\"add-time-button-full\" (click)=\"addTime()\">\n <mat-icon>timer</mat-icon> Add Time\n </button>\n </div>\n </div>\n <div class=\"dbx-datetime-row dbx-datetime-hint-row\" fxFlex=\"100\">\n <div class=\"dbx-hint\" [ngSwitch]=\"fullDay$ | async\">\n <small *ngSwitchCase=\"true\"><b class=\"dbx-ok\">All Day</b> {{ dateValue$ | async | date:'fullDate' }}\n ({{ dateValue$ | async | dateDistance }})</small>\n <small *ngSwitchCase=\"false\">\n <ng-container *ngIf=\"value$ | async\"><b class=\"dbx-ok\">At</b> {{ displayValue$ | async | date:'medium' }}\n ({{ displayValue$ | async | timeDistance }})</ng-container>\n </small>\n </div>\n </div>\n</div>\n\n<!-- Date Input Template -->\n<ng-template #dateInputTemplate>\n <button mat-icon-button (click)=\"picker.open()\">\n <mat-icon>calendar_today</mat-icon>\n </button>\n <mat-form-field class=\"dbx-datetime-row-field\">\n <mat-label>Date</mat-label>\n <input #dateInput matInput [matDatepicker]=\"picker\" (change)=\"dateTextChanged($event)\"\n (dateChange)=\"datePicked($event)\" [value]=\"dateValue$ | async\">\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n</ng-template>\n\n<!-- Time Menu/Input Template -->\n<ng-template #timeMenuAndInputTemplate>\n <button mat-icon-button [matMenuTriggerFor]=\"timemenu\" aria-label=\"opens the time menu\">\n <mat-icon>timer</mat-icon>\n </button>\n <mat-menu #timemenu=\"matMenu\">\n <ng-container *ngIf=\"timeMode === 'optional'\">\n <button mat-menu-item (click)=\"removeTime()\">\n <span>Remove Time</span>\n </button>\n <mat-divider></mat-divider>\n </ng-container>\n <button mat-menu-item (click)=\"setTime('12:00AM')\">\n <span>Midnight</span>\n </button>\n <button mat-menu-item (click)=\"setTime('6:00AM')\">\n <span>6:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('8:00AM')\">\n <span>8:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('10:00AM')\">\n <span>10:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('12:00PM')\">\n <span>Noon</span>\n </button>\n <button mat-menu-item (click)=\"setTime('2:00PM')\">\n <span>2:00PM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('5:00PM')\">\n <span>5:00PM</span>\n </button>\n </mat-menu>\n <mat-form-field class=\"dbx-datetime-row-field\">\n <mat-label>Time</mat-label>\n <input #timeInput matInput [formControl]=\"timeInputCtrl\" (focus)=\"focusTime()\" (focusout)=\"focusOutTime()\"\n (keydown)=\"keydownOnInput($event)\">\n </mat-form-field>\n</ng-template>\n", components: [{ type: i1$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3$2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i4$4.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { type: i5$2.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { type: i5$2.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { type: i4$2.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }], directives: [{ type: i3$1.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { type: i3$1.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$1.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2$2.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { type: i5.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i5.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i3$2.MatLabel, selector: "mat-label" }, { type: i6$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i4$4.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { type: i5$2.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }, { type: i4$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], pipes: { "async": i5.AsyncPipe, "date": i5.DatePipe, "dateDistance": i2.DateDistancePipe, "timeDistance": i2.TimeDistancePipe } });
2320
2965
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxDateTimeFieldComponent, decorators: [{
2321
2966
  type: Component,
2322
- args: [{ template: "<div class=\"dbx-datetime-field\" fxLayout=\"row wrap\" fxLayout.xs=\"column wrap\" fxLayoutAlign=\"space-evenly stretch\">\n <!-- Date -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" fxFlex=\"50\" *ngIf=\"showDateInput\">\n <ng-container *ngTemplateOutlet=\"dateInputTemplate\"></ng-container>\n </div>\n <!-- Time -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"showDateInput ? 50 : 100\">\n <ng-container *ngIf=\"showTimeInput$ | async\">\n <ng-container *ngTemplateOutlet=\"timeMenuAndInputTemplate\"></ng-container>\n </ng-container>\n <div class=\"add-time-button-wrapper\" *ngIf=\"showAddTime$ | async\">\n <button mat-button class=\"add-time-button\" (click)=\"addTime()\">\n <mat-icon>timer</mat-icon> Add Time\n </button>\n </div>\n </div>\n <div class=\"dbx-datetime-row dbx-datetime-hint-row\" fxFlex=\"100\">\n <div class=\"dbx-hint\" [ngSwitch]=\"fullDay$ | async\">\n <small *ngSwitchCase=\"true\"><b class=\"dbx-ok\">All Day</b> {{ dateValue$ | async | date:'fullDate' }}\n ({{ dateValue$ | async | dateDistance }})</small>\n <small *ngSwitchCase=\"false\">\n <ng-container *ngIf=\"value$ | async\"><b class=\"dbx-ok\">At</b> {{ displayValue$ | async | date:'medium' }}\n ({{ displayValue$ | async | timeDistance }})</ng-container>\n </small>\n </div>\n <div class=\"dbx-small dbx-label\" *ngIf=\"description\">\n {{ description }}\n </div>\n </div>\n</div>\n\n<!-- Date Input Template -->\n<ng-template #dateInputTemplate>\n <button mat-icon-button (click)=\"picker.open()\">\n <mat-icon>calendar_today</mat-icon>\n </button>\n <mat-form-field class=\"dbx-datetime-row-field\">\n <mat-label>Date</mat-label>\n <input matInput [matDatepicker]=\"picker\" (dateChange)=\"datePicked($event)\" [value]=\"dateValue$ | async\">\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n</ng-template>\n\n<!-- Time Menu/Input Template -->\n<ng-template #timeMenuAndInputTemplate>\n <button mat-icon-button [matMenuTriggerFor]=\"timemenu\" aria-label=\"opens the time menu\">\n <mat-icon>timer</mat-icon>\n </button>\n <mat-menu #timemenu=\"matMenu\">\n <ng-container *ngIf=\"timeMode === 'optional'\">\n <button mat-menu-item (click)=\"removeTime()\">\n <span>Remove Time</span>\n </button>\n <mat-divider></mat-divider>\n </ng-container>\n <button mat-menu-item (click)=\"setTime('12:00AM')\">\n <span>Midnight</span>\n </button>\n <button mat-menu-item (click)=\"setTime('6:00AM')\">\n <span>6:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('8:00AM')\">\n <span>8:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('10:00AM')\">\n <span>10:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('12:00PM')\">\n <span>Noon</span>\n </button>\n <button mat-menu-item (click)=\"setTime('2:00PM')\">\n <span>2:00PM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('5:00PM')\">\n <span>5:00PM</span>\n </button>\n </mat-menu>\n <mat-form-field class=\"dbx-datetime-row-field\">\n <mat-label>Time</mat-label>\n <input #timeInput matInput [formControl]=\"timeInputCtrl\" (focus)=\"focusTime()\" (focusout)=\"focusOutTime()\"\n (keydown)=\"keydownOnInput($event)\">\n </mat-form-field>\n</ng-template>\n" }]
2323
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
2967
+ args: [{ template: "<div class=\"dbx-datetime-field\" fxLayout=\"row wrap\" fxLayout.xs=\"column wrap\" fxLayoutAlign=\"space-evenly stretch\">\n <!-- Date -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"dateOnly ? '100' : '50'\" *ngIf=\"showDateInput\">\n <ng-container *ngTemplateOutlet=\"dateInputTemplate\"></ng-container>\n </div>\n <!-- Time -->\n <div class=\"dbx-datetime-row\" fxFlex.lt-sm=\"100\" [fxFlex]=\"showDateInput ? '50' : '100'\">\n <ng-container *ngIf=\"showTimeInput$ | async\">\n <ng-container *ngTemplateOutlet=\"timeMenuAndInputTemplate\"></ng-container>\n </ng-container>\n <div class=\"add-time-button-wrapper\" *ngIf=\"showAddTime$ | async\">\n <button mat-button class=\"add-time-button\" ngClass.lt-sm=\"add-time-button-full\" (click)=\"addTime()\">\n <mat-icon>timer</mat-icon> Add Time\n </button>\n </div>\n </div>\n <div class=\"dbx-datetime-row dbx-datetime-hint-row\" fxFlex=\"100\">\n <div class=\"dbx-hint\" [ngSwitch]=\"fullDay$ | async\">\n <small *ngSwitchCase=\"true\"><b class=\"dbx-ok\">All Day</b> {{ dateValue$ | async | date:'fullDate' }}\n ({{ dateValue$ | async | dateDistance }})</small>\n <small *ngSwitchCase=\"false\">\n <ng-container *ngIf=\"value$ | async\"><b class=\"dbx-ok\">At</b> {{ displayValue$ | async | date:'medium' }}\n ({{ displayValue$ | async | timeDistance }})</ng-container>\n </small>\n </div>\n </div>\n</div>\n\n<!-- Date Input Template -->\n<ng-template #dateInputTemplate>\n <button mat-icon-button (click)=\"picker.open()\">\n <mat-icon>calendar_today</mat-icon>\n </button>\n <mat-form-field class=\"dbx-datetime-row-field\">\n <mat-label>Date</mat-label>\n <input #dateInput matInput [matDatepicker]=\"picker\" (change)=\"dateTextChanged($event)\"\n (dateChange)=\"datePicked($event)\" [value]=\"dateValue$ | async\">\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n</ng-template>\n\n<!-- Time Menu/Input Template -->\n<ng-template #timeMenuAndInputTemplate>\n <button mat-icon-button [matMenuTriggerFor]=\"timemenu\" aria-label=\"opens the time menu\">\n <mat-icon>timer</mat-icon>\n </button>\n <mat-menu #timemenu=\"matMenu\">\n <ng-container *ngIf=\"timeMode === 'optional'\">\n <button mat-menu-item (click)=\"removeTime()\">\n <span>Remove Time</span>\n </button>\n <mat-divider></mat-divider>\n </ng-container>\n <button mat-menu-item (click)=\"setTime('12:00AM')\">\n <span>Midnight</span>\n </button>\n <button mat-menu-item (click)=\"setTime('6:00AM')\">\n <span>6:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('8:00AM')\">\n <span>8:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('10:00AM')\">\n <span>10:00AM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('12:00PM')\">\n <span>Noon</span>\n </button>\n <button mat-menu-item (click)=\"setTime('2:00PM')\">\n <span>2:00PM</span>\n </button>\n <button mat-menu-item (click)=\"setTime('5:00PM')\">\n <span>5:00PM</span>\n </button>\n </mat-menu>\n <mat-form-field class=\"dbx-datetime-row-field\">\n <mat-label>Time</mat-label>\n <input #timeInput matInput [formControl]=\"timeInputCtrl\" (focus)=\"focusTime()\" (focusout)=\"focusOutTime()\"\n (keydown)=\"keydownOnInput($event)\">\n </mat-form-field>\n</ng-template>\n" }]
2968
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { dateInput: [{
2969
+ type: ViewChild,
2970
+ args: ['dateInput', { read: MatInput }]
2971
+ }] } });
2324
2972
 
2325
2973
  class DbxFormFormlyDateFieldModule {
2326
2974
  }
@@ -2338,7 +2986,7 @@ DbxFormFormlyDateFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.
2338
2986
  DbxDatePipeModule,
2339
2987
  MatChipsModule,
2340
2988
  MatIconModule,
2341
- FlexLayoutModule, i1$4.FormlyModule] });
2989
+ FlexLayoutModule, i1$4.FormlyModule], exports: [DbxFormFormlyWrapperModule] });
2342
2990
  DbxFormFormlyDateFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyDateFieldModule, imports: [[
2343
2991
  CommonModule,
2344
2992
  FormsModule,
@@ -2356,10 +3004,10 @@ DbxFormFormlyDateFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.
2356
3004
  FlexLayoutModule,
2357
3005
  FormlyModule.forChild({
2358
3006
  types: [
2359
- { name: 'datetime', component: DbxDateTimeFieldComponent }
3007
+ { name: 'datetime', component: DbxDateTimeFieldComponent, wrappers: ['style', 'form-field'] }
2360
3008
  ]
2361
3009
  })
2362
- ]] });
3010
+ ], DbxFormFormlyWrapperModule] });
2363
3011
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyDateFieldModule, decorators: [{
2364
3012
  type: NgModule,
2365
3013
  args: [{
@@ -2380,14 +3028,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
2380
3028
  FlexLayoutModule,
2381
3029
  FormlyModule.forChild({
2382
3030
  types: [
2383
- { name: 'datetime', component: DbxDateTimeFieldComponent }
3031
+ { name: 'datetime', component: DbxDateTimeFieldComponent, wrappers: ['style', 'form-field'] }
2384
3032
  ]
2385
3033
  })
2386
3034
  ],
2387
3035
  declarations: [
2388
3036
  DbxDateTimeFieldComponent
2389
3037
  ],
2390
- exports: []
3038
+ exports: [
3039
+ DbxFormFormlyWrapperModule
3040
+ ]
2391
3041
  }]
2392
3042
  }] });
2393
3043
 
@@ -2405,22 +3055,22 @@ function timeOnlyField(config) {
2405
3055
  timeOnly: true
2406
3056
  });
2407
3057
  }
2408
- function dateTimeField({ key, label = '', placeholder = '', description = '', timeMode = DateTimeFieldTimeMode.REQUIRED, fullDayFieldName, getConfigObs, timeOnly = false, required = false }) {
3058
+ function dateTimeField(config) {
3059
+ const { key = 'date', timeMode = DateTimeFieldTimeMode.REQUIRED, fullDayFieldName, getConfigObs, timeOnly = false } = config;
2409
3060
  const fieldConfig = formlyField({
2410
3061
  key,
2411
3062
  type: 'datetime',
2412
- timeMode: (timeOnly) ? DateTimeFieldTimeMode.REQUIRED : timeMode,
2413
- fullDayFieldName,
2414
- getConfigObs,
2415
- timeOnly,
2416
- templateOptions: {
2417
- label,
2418
- placeholder,
2419
- required,
2420
- description
3063
+ dateTimeField: {
3064
+ timeMode: (timeOnly) ? DateTimeFieldTimeMode.REQUIRED : timeMode,
3065
+ fullDayFieldName,
3066
+ getConfigObs,
3067
+ timeOnly,
2421
3068
  },
3069
+ ...templateOptionsForFieldConfig(config),
3070
+ styleWrapper: {
3071
+ style: 'dbx-datetime-parent-form-field'
3072
+ }
2422
3073
  });
2423
- // TODO: Add configuration...
2424
3074
  return fieldConfig;
2425
3075
  }
2426
3076
 
@@ -2441,60 +3091,59 @@ function staticEnumField({ key, label = '', placeholder = '', description, multi
2441
3091
  return fieldConfig;
2442
3092
  }
2443
3093
 
2444
- // TODO: Finish dynamic.enum before adding in
2445
-
2446
- const DEFAULT_PREFERRED_COUNTRIES = ['us'];
2447
- class DbxInternationalPhoneFieldComponent extends FieldType {
2448
- get fieldInputKey() {
2449
- return this.key;
2450
- }
2451
- get fieldFormGroup() {
2452
- return this.form;
2453
- }
2454
- get label() {
2455
- return this.field.templateOptions.label;
2456
- }
2457
- get placeholder() {
2458
- return this.field.templateOptions.placeholder;
2459
- }
2460
- get description() {
2461
- return this.field.templateOptions.description;
3094
+ class DbxFormFormlyEnumFieldModule {
3095
+ }
3096
+ DbxFormFormlyEnumFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyEnumFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3097
+ DbxFormFormlyEnumFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyEnumFieldModule });
3098
+ DbxFormFormlyEnumFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyEnumFieldModule, imports: [[]] });
3099
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyEnumFieldModule, decorators: [{
3100
+ type: NgModule,
3101
+ args: [{
3102
+ imports: [],
3103
+ declarations: [],
3104
+ exports: []
3105
+ }]
3106
+ }] });
3107
+
3108
+ // TODO: Finish dynamic.enum before adding in
3109
+
3110
+ const DEFAULT_PREFERRED_COUNTRIES = ['us'];
3111
+ class DbxPhoneFieldComponent extends FieldType$1 {
3112
+ get phoneField() {
3113
+ return this.field.phoneField;
2462
3114
  }
2463
3115
  get preferredCountries() {
2464
- return this.field.preferredCountries ?? DEFAULT_PREFERRED_COUNTRIES;
3116
+ return this.phoneField.preferredCountries ?? DEFAULT_PREFERRED_COUNTRIES;
2465
3117
  }
2466
3118
  get onlyCountries() {
2467
- return this.field.onlyCountries ?? [];
2468
- }
2469
- get required() {
2470
- return this.field.templateOptions.required ?? false;
2471
- }
2472
- get errors() {
2473
- return this.field.formControl?.errors;
3119
+ return this.phoneField.onlyCountries ?? [];
2474
3120
  }
2475
3121
  }
2476
- DbxInternationalPhoneFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxInternationalPhoneFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2477
- DbxInternationalPhoneFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxInternationalPhoneFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div class=\"dbx-international-phone-field\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field class=\"dbx-international-phone-form-field\">\n <ngx-mat-intl-tel-input [required]=\"required\" [preferredCountries]=\"preferredCountries\" [enablePlaceholder]=\"false\"\n name=\"phone\" [formControlName]=\"fieldInputKey\">\n </ngx-mat-intl-tel-input>\n <mat-error *ngIf=\"errors?.['required']\">Required Field</mat-error>\n <mat-error *ngIf=\"errors?.['validatePhoneNumber']\">Invalid Number</mat-error>\n <mat-hint>{{ description }}</mat-hint>\n </mat-form-field>\n</div>\n", components: [{ type: i4.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i2$4.NgxMatIntlTelInputComponent, selector: "ngx-mat-intl-tel-input", inputs: ["preferredCountries", "enablePlaceholder", "inputPlaceholder", "cssClass", "name", "onlyCountries", "errorStateMatcher", "enableSearch", "searchPlaceholder", "describedBy", "format", "placeholder", "required", "disabled"], outputs: ["countryChanged"] }], directives: [{ type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.MatError, selector: "mat-error", inputs: ["id"] }, { type: i4.MatHint, selector: "mat-hint", inputs: ["align", "id"] }] });
2478
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxInternationalPhoneFieldComponent, decorators: [{
3122
+ DbxPhoneFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxPhoneFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3123
+ DbxPhoneFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxPhoneFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<ngx-mat-intl-tel-input class=\"dbx-form-phone-field\" [required]=\"required\" [preferredCountries]=\"preferredCountries\"\n [enablePlaceholder]=\"false\" name=\"phone\" [formControl]=\"formControl\">\n</ngx-mat-intl-tel-input>\n", components: [{ type: i1$6.NgxMatIntlTelInputComponent, selector: "ngx-mat-intl-tel-input", inputs: ["preferredCountries", "enablePlaceholder", "inputPlaceholder", "cssClass", "name", "onlyCountries", "errorStateMatcher", "enableSearch", "searchPlaceholder", "describedBy", "format", "placeholder", "required", "disabled"], outputs: ["countryChanged"] }], directives: [{ type: i4$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] });
3124
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxPhoneFieldComponent, decorators: [{
2479
3125
  type: Component,
2480
- args: [{ template: "<div class=\"dbx-international-phone-field\" [formGroup]=\"fieldFormGroup\">\n <mat-form-field class=\"dbx-international-phone-form-field\">\n <ngx-mat-intl-tel-input [required]=\"required\" [preferredCountries]=\"preferredCountries\" [enablePlaceholder]=\"false\"\n name=\"phone\" [formControlName]=\"fieldInputKey\">\n </ngx-mat-intl-tel-input>\n <mat-error *ngIf=\"errors?.['required']\">Required Field</mat-error>\n <mat-error *ngIf=\"errors?.['validatePhoneNumber']\">Invalid Number</mat-error>\n <mat-hint>{{ description }}</mat-hint>\n </mat-form-field>\n</div>\n" }]
3126
+ args: [{ template: "<ngx-mat-intl-tel-input class=\"dbx-form-phone-field\" [required]=\"required\" [preferredCountries]=\"preferredCountries\"\n [enablePlaceholder]=\"false\" name=\"phone\" [formControl]=\"formControl\">\n</ngx-mat-intl-tel-input>\n" }]
2481
3127
  }] });
2482
3128
 
2483
3129
  class DbxFormFormlyPhoneFieldModule {
2484
3130
  }
2485
3131
  DbxFormFormlyPhoneFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyPhoneFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2486
- DbxFormFormlyPhoneFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyPhoneFieldModule, declarations: [DbxInternationalPhoneFieldComponent], imports: [CommonModule,
3132
+ DbxFormFormlyPhoneFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyPhoneFieldModule, declarations: [DbxPhoneFieldComponent], imports: [CommonModule,
2487
3133
  MatInputModule,
3134
+ MatFormFieldModule,
2488
3135
  FormsModule,
2489
3136
  NgxMatIntlTelInputModule,
2490
3137
  ReactiveFormsModule,
2491
3138
  MatAutocompleteModule,
2492
3139
  MatChipsModule,
2493
3140
  MatIconModule,
2494
- FlexLayoutModule, i1$4.FormlyModule] });
3141
+ FlexLayoutModule,
3142
+ FormlyMatFormFieldModule, i1$4.FormlyModule] });
2495
3143
  DbxFormFormlyPhoneFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyPhoneFieldModule, imports: [[
2496
3144
  CommonModule,
2497
3145
  MatInputModule,
3146
+ MatFormFieldModule,
2498
3147
  FormsModule,
2499
3148
  NgxMatIntlTelInputModule,
2500
3149
  ReactiveFormsModule,
@@ -2502,9 +3151,10 @@ DbxFormFormlyPhoneFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12
2502
3151
  MatChipsModule,
2503
3152
  MatIconModule,
2504
3153
  FlexLayoutModule,
3154
+ FormlyMatFormFieldModule,
2505
3155
  FormlyModule.forChild({
2506
3156
  types: [
2507
- { name: 'intphone', component: DbxInternationalPhoneFieldComponent }
3157
+ { name: 'intphone', component: DbxPhoneFieldComponent, wrappers: ['form-field'] }
2508
3158
  ]
2509
3159
  })
2510
3160
  ]] });
@@ -2514,6 +3164,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
2514
3164
  imports: [
2515
3165
  CommonModule,
2516
3166
  MatInputModule,
3167
+ MatFormFieldModule,
2517
3168
  FormsModule,
2518
3169
  NgxMatIntlTelInputModule,
2519
3170
  ReactiveFormsModule,
@@ -2521,60 +3172,190 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
2521
3172
  MatChipsModule,
2522
3173
  MatIconModule,
2523
3174
  FlexLayoutModule,
3175
+ FormlyMatFormFieldModule,
2524
3176
  FormlyModule.forChild({
2525
3177
  types: [
2526
- { name: 'intphone', component: DbxInternationalPhoneFieldComponent }
3178
+ { name: 'intphone', component: DbxPhoneFieldComponent, wrappers: ['form-field'] }
2527
3179
  ]
2528
3180
  })
2529
3181
  ],
2530
3182
  declarations: [
2531
- DbxInternationalPhoneFieldComponent
3183
+ DbxPhoneFieldComponent
2532
3184
  ],
2533
3185
  exports: []
2534
3186
  }]
2535
3187
  }] });
2536
3188
 
2537
- const PHONE_LABEL_MAX_LENGTH = 100;
2538
- const ADDRESS_COUNTRY_MAX_LENGTH = 80;
2539
- const ADDRESS_CITY_MAX_LENGTH = 80;
2540
- const ADDRESS_STATE_MAX_LENGTH = 80;
2541
- const ADDRESS_ZIP_MAX_LENGTH = 20;
2542
- const LABEL_STRING_MAX_LENGTH = 100;
2543
- const SEARCH_STRING_MAX_LENGTH = 100;
2544
- function textField({ key, label = '', placeholder = '', required = false, attributes, readonly, autocomplete, minLength, maxLength, pattern }) {
3189
+ const EXPANDABLE_WRAPPER_KEY = 'expandable';
3190
+ const TOGGLE_WRAPPER_KEY = 'toggle';
3191
+ const SECTION_WRAPPER_KEY = 'section';
3192
+ const SUBSECTION_WRAPPER_KEY = 'subsection';
3193
+ const INFO_WRAPPER_KEY = 'info';
3194
+ const FLEX_WRAPPER_KEY = 'flex';
3195
+ const STYLE_WRAPPER_KEY = 'style';
3196
+ function addWrapperToFormlyFieldConfig(fieldConfig, wrapperKey, wrapperTemplateOptionsConfig) {
3197
+ fieldConfig.templateOptions = {
3198
+ ...fieldConfig.templateOptions,
3199
+ ...wrapperTemplateOptionsConfig
3200
+ };
3201
+ return {
3202
+ wrappers: [wrapperKey],
3203
+ templateOptions: wrapperTemplateOptionsConfig,
3204
+ fieldGroup: [fieldConfig]
3205
+ };
3206
+ }
3207
+ function expandWrapper(fieldConfig, expandWrapper) {
3208
+ return addWrapperToFormlyFieldConfig(fieldConfig, EXPANDABLE_WRAPPER_KEY, {
3209
+ expandWrapper
3210
+ });
3211
+ }
3212
+ function toggleWrapper(fieldConfig, expandWrapper) {
3213
+ return addWrapperToFormlyFieldConfig(fieldConfig, TOGGLE_WRAPPER_KEY, {
3214
+ expandWrapper
3215
+ });
3216
+ }
3217
+ function sectionWrapper(fieldConfig, sectionWrapper) {
3218
+ return addWrapperToFormlyFieldConfig(fieldConfig, SECTION_WRAPPER_KEY, {
3219
+ sectionWrapper
3220
+ });
3221
+ }
3222
+ function subsectionWrapper(fieldConfig, subsectionWrapper) {
3223
+ return addWrapperToFormlyFieldConfig(fieldConfig, SUBSECTION_WRAPPER_KEY, {
3224
+ subsectionWrapper
3225
+ });
3226
+ }
3227
+ function infoWrapper(fieldConfig, infoWrapper) {
3228
+ return addWrapperToFormlyFieldConfig(fieldConfig, INFO_WRAPPER_KEY, {
3229
+ infoWrapper
3230
+ });
3231
+ }
3232
+ function styleWrapper(fieldConfig, styleWrapper) {
3233
+ return addWrapperToFormlyFieldConfig(fieldConfig, STYLE_WRAPPER_KEY, {
3234
+ styleWrapper
3235
+ });
3236
+ }
3237
+ function checkIsFieldFlexLayoutGroupFieldConfig(input) {
3238
+ if (input.field != null) {
3239
+ return true;
3240
+ }
3241
+ else {
3242
+ return false;
3243
+ }
3244
+ }
3245
+ function flexLayoutWrapper(fieldConfigs, { relative, breakpoint, size: defaultSize = 2 } = {}) {
3246
+ return {
3247
+ wrappers: ['flex'],
3248
+ fieldGroupClassName: 'dbx-flex-group',
3249
+ // fieldGroupClassName: 'field-layout-group',
3250
+ templateOptions: {
3251
+ flexWrapper: {
3252
+ breakpoint,
3253
+ relative
3254
+ }
3255
+ },
3256
+ fieldGroup: fieldConfigs.map((inputConfig) => {
3257
+ const fieldConfig = checkIsFieldFlexLayoutGroupFieldConfig(inputConfig) ? inputConfig : {
3258
+ field: inputConfig
3259
+ };
3260
+ const { field, size = defaultSize } = fieldConfig;
3261
+ const className = `dbx-flex-${size}`;
3262
+ return {
3263
+ ...field,
3264
+ className
3265
+ };
3266
+ })
3267
+ };
3268
+ }
3269
+
3270
+ function textField(config) {
3271
+ const { key, pattern, minLength, maxLength = 1000 } = config;
2545
3272
  return formlyField({
2546
3273
  key,
2547
3274
  type: 'input',
2548
- templateOptions: {
2549
- label,
2550
- placeholder,
2551
- required,
3275
+ ...templateOptionsForFieldConfig(config, {
2552
3276
  minLength,
2553
3277
  maxLength,
2554
- pattern,
2555
- readonly,
2556
- attributes: {
2557
- ...attributes,
2558
- ...(autocomplete) ? { autocomplete } : undefined
2559
- }
2560
- }
3278
+ pattern
3279
+ })
2561
3280
  });
2562
3281
  }
2563
- function textAreaField({ key, label = '', placeholder = '', rows = 3, required = false, minLength, maxLength = 1000, attributes }) {
3282
+ function textAreaField(config) {
3283
+ const { key, rows = 3, minLength, maxLength = 1000 } = config;
2564
3284
  return formlyField({
2565
3285
  key,
2566
3286
  type: 'textarea',
2567
- templateOptions: {
2568
- label,
2569
- placeholder,
2570
- required,
3287
+ ...templateOptionsForFieldConfig(config, {
2571
3288
  rows,
2572
3289
  minLength,
2573
3290
  maxLength,
2574
- attributes
3291
+ })
3292
+ });
3293
+ }
3294
+
3295
+ function phoneField(config = {}) {
3296
+ const { key = 'phone', preferredCountries, onlyCountries } = config;
3297
+ const fieldConfig = formlyField({
3298
+ key,
3299
+ type: 'intphone',
3300
+ phoneField: {
3301
+ preferredCountries,
3302
+ onlyCountries
3303
+ },
3304
+ ...templateOptionsForFieldConfig(config)
3305
+ });
3306
+ return fieldConfig;
3307
+ }
3308
+ /**
3309
+ * Puts a phone and
3310
+ * @param param0
3311
+ * @returns
3312
+ */
3313
+ function wrappedPhoneAndLabelField({ phoneField: phone, labelField: label } = {}) {
3314
+ return flexLayoutWrapper([
3315
+ {
3316
+ field: phoneField(phone),
3317
+ size: 2
3318
+ },
3319
+ {
3320
+ field: textField({
3321
+ key: 'label',
3322
+ label: 'Label',
3323
+ autocomplete: 'phone-label',
3324
+ ...label
3325
+ }),
3326
+ size: 4
2575
3327
  }
3328
+ ], { relative: true });
3329
+ }
3330
+ function phoneAndLabelSectionField({ key, header = 'Phone Number', hint, phoneField, labelField } = {}) {
3331
+ return sectionWrapper({
3332
+ key,
3333
+ fieldGroup: [wrappedPhoneAndLabelField({ phoneField, labelField })]
3334
+ }, {
3335
+ header,
3336
+ hint
3337
+ });
3338
+ }
3339
+ function phoneListField(repeatConfig = {}) {
3340
+ const { key = 'phones', label = 'Phone Numbers', addText = 'Add Phone Number', removeText = 'Remove Phone Number', repeatFieldGroup, phoneAndLabel } = repeatConfig;
3341
+ return repeatArrayField({
3342
+ ...repeatConfig,
3343
+ key,
3344
+ label,
3345
+ addText,
3346
+ removeText,
3347
+ repeatFieldGroup: repeatFieldGroup ?? [wrappedPhoneAndLabelField(phoneAndLabel)]
2576
3348
  });
2577
3349
  }
3350
+ ;
3351
+
3352
+ const PHONE_LABEL_MAX_LENGTH = 100;
3353
+ const ADDRESS_COUNTRY_MAX_LENGTH = 80;
3354
+ const ADDRESS_CITY_MAX_LENGTH = 80;
3355
+ const ADDRESS_STATE_MAX_LENGTH = 80;
3356
+ const ADDRESS_ZIP_MAX_LENGTH = 20;
3357
+ const LABEL_STRING_MAX_LENGTH = 100;
3358
+ const SEARCH_STRING_MAX_LENGTH = 100;
2578
3359
  function nameField({ key = 'name', label = 'Name', placeholder = 'John Doe', required = false, minLength, maxLength, attributes } = {}) {
2579
3360
  return textField({
2580
3361
  key,
@@ -2586,7 +3367,7 @@ function nameField({ key = 'name', label = 'Name', placeholder = 'John Doe', req
2586
3367
  attributes
2587
3368
  });
2588
3369
  }
2589
- function emailField({ key = 'email', label = 'Email Address', placeholder = 'person@email.com', description = '', required = false, readonly = false }) {
3370
+ function emailField({ key = 'email', label = 'Email Address', placeholder = 'person@email.com', description = '', required = false, readonly = false } = {}) {
2590
3371
  return formlyField({
2591
3372
  key,
2592
3373
  type: 'input',
@@ -2597,11 +3378,6 @@ function emailField({ key = 'email', label = 'Email Address', placeholder = 'per
2597
3378
  required,
2598
3379
  readonly
2599
3380
  },
2600
- validation: {
2601
- messages: {
2602
- required: `Email is required.`
2603
- }
2604
- },
2605
3381
  validators: {
2606
3382
  email: {
2607
3383
  expression: (c) => !Validators.email(c),
@@ -2610,7 +3386,7 @@ function emailField({ key = 'email', label = 'Email Address', placeholder = 'per
2610
3386
  },
2611
3387
  });
2612
3388
  }
2613
- function cityField({ key = 'city', required = false }) {
3389
+ function cityField({ key = 'city', required = false } = {}) {
2614
3390
  return textField({
2615
3391
  key,
2616
3392
  label: 'City',
@@ -2620,124 +3396,37 @@ function cityField({ key = 'city', required = false }) {
2620
3396
  maxLength: ADDRESS_CITY_MAX_LENGTH
2621
3397
  });
2622
3398
  }
2623
- function stateField({ key = 'state', required = false }) {
3399
+ function stateField({ key = 'state', required = false } = {}) {
2624
3400
  return textField({
2625
3401
  key,
2626
3402
  label: 'State',
2627
3403
  placeholder: '',
2628
3404
  required,
2629
- attributes: {
2630
- autocomplete: 'state'
2631
- },
3405
+ autocomplete: 'state',
2632
3406
  maxLength: ADDRESS_STATE_MAX_LENGTH
2633
3407
  });
2634
3408
  }
2635
- function countryField({ key = 'country', required = false }) {
3409
+ function countryField({ key = 'country', required = false } = {}) {
2636
3410
  return textField({
2637
3411
  key,
2638
3412
  label: 'Country',
2639
3413
  placeholder: '',
2640
3414
  required,
2641
- attributes: {
2642
- autocomplete: 'country'
2643
- },
3415
+ autocomplete: 'country',
2644
3416
  maxLength: ADDRESS_COUNTRY_MAX_LENGTH
2645
3417
  });
2646
3418
  }
2647
- function zipCodeField({ key = 'zip', required = false }) {
3419
+ function zipCodeField({ key = 'zip', required = false } = {}) {
2648
3420
  return textField({
2649
3421
  key,
2650
3422
  label: 'Zip Code',
2651
3423
  placeholder: '',
2652
3424
  required,
2653
- attributes: {
2654
- autocomplete: 'postal-code'
2655
- },
3425
+ autocomplete: 'postal-code',
2656
3426
  maxLength: ADDRESS_ZIP_MAX_LENGTH
2657
3427
  });
2658
3428
  }
2659
3429
 
2660
- function flexLayoutWrapper(fieldConfigs, { size: defaultSize = 2, retainSizeOnSmallScreen } = {}) {
2661
- const defaultRetainSizeOnSmallScreen = retainSizeOnSmallScreen;
2662
- return {
2663
- wrappers: ['flex'],
2664
- fieldGroupClassName: 'form-flex-section-group',
2665
- // fieldGroupClassName: 'field-layout-group',
2666
- fieldGroup: fieldConfigs.map((config) => {
2667
- const { field, size = defaultSize, retainSizeOnSmallScreen = defaultRetainSizeOnSmallScreen } = config;
2668
- let className = `form-flex-${size}`;
2669
- if (retainSizeOnSmallScreen != false) {
2670
- className = className + ' form-flex-responsive';
2671
- }
2672
- return {
2673
- ...field,
2674
- className
2675
- };
2676
- })
2677
- };
2678
- }
2679
-
2680
- function internationalPhoneField({ key, label = '', placeholder = '', required = false }) {
2681
- const fieldConfig = formlyField({
2682
- key,
2683
- type: 'intphone',
2684
- templateOptions: {
2685
- label,
2686
- placeholder,
2687
- required
2688
- }
2689
- });
2690
- // TODO: Add configuration...
2691
- return fieldConfig;
2692
- }
2693
- function phoneAndLabelFields({ phoneField: phone, labelField: label }) {
2694
- return [
2695
- flexLayoutWrapper([
2696
- {
2697
- field: internationalPhoneField({ key: 'phone', ...phone })
2698
- },
2699
- {
2700
- field: textField({
2701
- key: 'label',
2702
- label: 'Label',
2703
- autocomplete: 'phone-label',
2704
- ...label
2705
- })
2706
- }
2707
- ])
2708
- ];
2709
- }
2710
- function phoneAndLabelFieldGroup({ key = 'phone', label = 'Phone Number', required, phoneField, labelField }) {
2711
- return {
2712
- key,
2713
- wrappers: ['section'],
2714
- templateOptions: {
2715
- label,
2716
- required
2717
- },
2718
- fieldGroup: phoneAndLabelFields({ phoneField, labelField })
2719
- };
2720
- }
2721
- function phoneListField({ key = 'phones', label = 'Phone Numbers', repeatSection, required = false, maxPhones = 6, phoneField, labelField }) {
2722
- return {
2723
- key,
2724
- type: 'repeat',
2725
- wrappers: ['section'],
2726
- templateOptions: {
2727
- label,
2728
- required,
2729
- repeatSection: repeatSection ?? {
2730
- addText: 'Add Phone Number',
2731
- removeText: 'Remove Phone Number'
2732
- },
2733
- maxLength: maxPhones
2734
- },
2735
- fieldArray: {
2736
- fieldGroup: phoneAndLabelFields({ phoneField, labelField })
2737
- }
2738
- };
2739
- }
2740
-
2741
3430
  const ADDRESS_LINE_MAX_LENGTH = 100;
2742
3431
  function addressFormlyFields() {
2743
3432
  return [
@@ -2765,10 +3454,10 @@ function addressFormlyFields() {
2765
3454
  field: zipCodeField({})
2766
3455
  }, {
2767
3456
  field: countryField({})
2768
- }])
3457
+ }], { size: 1, relative: true })
2769
3458
  ];
2770
3459
  }
2771
- function addressField({ key = 'address', required = false }) {
3460
+ function addressField({ key = 'address', required = false } = {}) {
2772
3461
  return {
2773
3462
  key,
2774
3463
  wrappers: ['section'],
@@ -2780,36 +3469,31 @@ function addressField({ key = 'address', required = false }) {
2780
3469
  fieldGroup: addressFormlyFields()
2781
3470
  };
2782
3471
  }
2783
- function addressListField({ key = 'addresses', required = false, maxAddresses = 6 }) {
2784
- return {
3472
+ function addressListField({ key = 'addresses', required = false, maxAddresses = 6 } = {}) {
3473
+ return repeatArrayField({
2785
3474
  key,
2786
- type: 'repeat',
2787
- wrappers: ['section'],
2788
- templateOptions: {
2789
- label: 'Addresses',
2790
- placeholder: '',
2791
- required,
2792
- repeatSection: {
2793
- addText: 'Add Address',
2794
- removeText: 'Remove Address'
2795
- },
2796
- maxLength: maxAddresses
2797
- },
2798
- fieldArray: {
2799
- fieldGroup: addressFormlyFields()
2800
- }
2801
- };
3475
+ label: 'Addresses',
3476
+ labelForField: 'Address',
3477
+ addText: 'Add Address',
3478
+ removeText: 'Remove Address',
3479
+ maxLength: maxAddresses,
3480
+ repeatFieldGroup: addressFormlyFields()
3481
+ });
2802
3482
  }
2803
3483
 
2804
3484
  class DbxFormFormlyTextFieldModule {
2805
3485
  }
2806
3486
  DbxFormFormlyTextFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyTextFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2807
- DbxFormFormlyTextFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyTextFieldModule, exports: [DbxFormFormlyWrapperModule] });
2808
- DbxFormFormlyTextFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyTextFieldModule, imports: [[], DbxFormFormlyWrapperModule] });
3487
+ DbxFormFormlyTextFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyTextFieldModule, imports: [FormlyMaterialModule], exports: [DbxFormFormlyWrapperModule] });
3488
+ DbxFormFormlyTextFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyTextFieldModule, imports: [[
3489
+ FormlyMaterialModule
3490
+ ], DbxFormFormlyWrapperModule] });
2809
3491
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyTextFieldModule, decorators: [{
2810
3492
  type: NgModule,
2811
3493
  args: [{
2812
- imports: [],
3494
+ imports: [
3495
+ FormlyMaterialModule
3496
+ ],
2813
3497
  declarations: [],
2814
3498
  exports: [
2815
3499
  DbxFormFormlyWrapperModule
@@ -2824,14 +3508,75 @@ function hiddenField({ key, required = false }) {
2824
3508
  });
2825
3509
  }
2826
3510
 
2827
- function addToggleWrapperToField({ fieldConfig, toggleSection = {} }) {
2828
- fieldConfig.wrappers = concatArraysUnique(fieldConfig.wrappers, ['toggle']);
2829
- fieldConfig.templateOptions = {
2830
- ...fieldConfig.templateOptions,
2831
- toggleSection
2832
- };
2833
- return fieldConfig;
2834
- }
3511
+ class DbxFormFormlyValueModule {
3512
+ }
3513
+ DbxFormFormlyValueModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyValueModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3514
+ DbxFormFormlyValueModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyValueModule, imports: [CommonModule], exports: [DbxFormFormlyArrayFieldModule,
3515
+ DbxFormFormlyBooleanFieldModule,
3516
+ DbxFormFormlyDateFieldModule,
3517
+ DbxFormFormlyEnumFieldModule,
3518
+ DbxFormFormlyPhoneFieldModule,
3519
+ DbxFormFormlyTextFieldModule] });
3520
+ DbxFormFormlyValueModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyValueModule, imports: [[
3521
+ CommonModule
3522
+ ], DbxFormFormlyArrayFieldModule,
3523
+ DbxFormFormlyBooleanFieldModule,
3524
+ DbxFormFormlyDateFieldModule,
3525
+ DbxFormFormlyEnumFieldModule,
3526
+ DbxFormFormlyPhoneFieldModule,
3527
+ DbxFormFormlyTextFieldModule] });
3528
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyValueModule, decorators: [{
3529
+ type: NgModule,
3530
+ args: [{
3531
+ imports: [
3532
+ CommonModule
3533
+ ],
3534
+ declarations: [],
3535
+ exports: [
3536
+ DbxFormFormlyArrayFieldModule,
3537
+ DbxFormFormlyBooleanFieldModule,
3538
+ DbxFormFormlyDateFieldModule,
3539
+ DbxFormFormlyEnumFieldModule,
3540
+ DbxFormFormlyPhoneFieldModule,
3541
+ DbxFormFormlyTextFieldModule
3542
+ ]
3543
+ }]
3544
+ }] });
3545
+
3546
+ class DbxFormFormlyFieldModule {
3547
+ }
3548
+ DbxFormFormlyFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3549
+ DbxFormFormlyFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyFieldModule, imports: [CommonModule], exports: [DbxFormFormlyChecklistItemFieldModule,
3550
+ DbxFormFormlyComponentFieldModule,
3551
+ DbxFormFormlySelectionModule,
3552
+ DbxFormFormlyTextEditorFieldModule,
3553
+ DbxFormFormlyValueModule,
3554
+ DbxFormFormlyWrapperModule] });
3555
+ DbxFormFormlyFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyFieldModule, imports: [[
3556
+ CommonModule
3557
+ ], DbxFormFormlyChecklistItemFieldModule,
3558
+ DbxFormFormlyComponentFieldModule,
3559
+ DbxFormFormlySelectionModule,
3560
+ DbxFormFormlyTextEditorFieldModule,
3561
+ DbxFormFormlyValueModule,
3562
+ DbxFormFormlyWrapperModule] });
3563
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormFormlyFieldModule, decorators: [{
3564
+ type: NgModule,
3565
+ args: [{
3566
+ imports: [
3567
+ CommonModule
3568
+ ],
3569
+ declarations: [],
3570
+ exports: [
3571
+ DbxFormFormlyChecklistItemFieldModule,
3572
+ DbxFormFormlyComponentFieldModule,
3573
+ DbxFormFormlySelectionModule,
3574
+ DbxFormFormlyTextEditorFieldModule,
3575
+ DbxFormFormlyValueModule,
3576
+ DbxFormFormlyWrapperModule
3577
+ ]
3578
+ }]
3579
+ }] });
2835
3580
 
2836
3581
  /**
2837
3582
  * Allows a directive to provide a formly context and form.
@@ -2840,10 +3585,8 @@ function ProvideFormlyContext() {
2840
3585
  return [{
2841
3586
  provide: DbxFormlyContext,
2842
3587
  useClass: DbxFormlyContext
2843
- }, {
2844
- provide: DbxForm,
2845
- useExisting: DbxFormlyContext
2846
- }];
3588
+ },
3589
+ ...ProvideDbxMutableForm(DbxFormlyContext)];
2847
3590
  }
2848
3591
  /**
2849
3592
  * DbxForm Instance that registers a delegate and manages the state of that form/delegate.
@@ -2851,94 +3594,72 @@ function ProvideFormlyContext() {
2851
3594
  class DbxFormlyContext {
2852
3595
  constructor() {
2853
3596
  this.lockSet = new LockSet();
2854
- this._disabled = false;
2855
- this._delegate = DbxFormlyContext.EMPTY_DELEGATE;
2856
- this._streamSubject = new BehaviorSubject(of(DbxFormlyContext.INITIAL_STATE));
2857
- this._stream$ = this._streamSubject.pipe(mergeMap$1((stream) => stream));
3597
+ this._fields = new BehaviorSubject(undefined);
3598
+ this._initialValue = new BehaviorSubject(undefined);
3599
+ this._disabled = new BehaviorSubject(false);
3600
+ this._delegate = new BehaviorSubject(undefined);
3601
+ this.fields$ = this._fields.pipe(filterMaybe());
3602
+ this.stream$ = this._delegate.pipe(distinctUntilChanged$1(), switchMap$1(x => (x) ? x.stream$ : of(DbxFormlyContext.INITIAL_STATE)), shareReplay$1(1));
2858
3603
  }
2859
3604
  destroy() {
2860
- this._streamSubject.complete();
2861
- }
2862
- get isDestroyed() {
2863
- return this._streamSubject.isStopped;
3605
+ this.lockSet.destroyOnNextUnlock(() => {
3606
+ this._fields.complete();
3607
+ this._initialValue.complete();
3608
+ this._disabled.complete();
3609
+ this._delegate.complete();
3610
+ });
2864
3611
  }
2865
3612
  setDelegate(delegate) {
2866
- this._delegate = delegate ?? DbxFormlyContext.EMPTY_DELEGATE;
2867
- this._streamSubject.next(this._delegate.stream$);
2868
- this._delegate.setFields(this._fields);
2869
- this._delegate.setValue(this._initialValue);
2870
- this._delegate.setDisabled(this._disabled);
3613
+ if (delegate !== this._delegate.value) {
3614
+ if (delegate != null) {
3615
+ delegate.init({
3616
+ fields: this.fields$,
3617
+ initialValue: this._initialValue.value,
3618
+ initialDisabled: this._disabled.value
3619
+ });
3620
+ }
3621
+ this._delegate.next(delegate);
3622
+ }
2871
3623
  }
2872
3624
  clearDelegate(delegate) {
2873
- if (this._delegate === delegate && !this.isDestroyed) {
3625
+ if (delegate === this._delegate.value) {
2874
3626
  this.setDelegate(undefined);
2875
3627
  }
2876
3628
  }
2877
3629
  get fields() {
2878
- return this._fields;
3630
+ return this._fields.value;
2879
3631
  }
2880
3632
  set fields(fields) {
2881
- this._fields = fields;
2882
- this._delegate.setFields(this._fields);
3633
+ this._fields.next(fields);
2883
3634
  }
2884
3635
  // MARK: FormComponent
2885
- get isComplete() {
2886
- return this._delegate.isComplete;
2887
- }
2888
- get state() {
2889
- return this._delegate.state;
2890
- }
2891
- get stream$() {
2892
- return this._stream$;
2893
- }
2894
- get value() {
2895
- return this._delegate.getValue();
3636
+ getValue() {
3637
+ return this._delegate.pipe(filterMaybe(), switchMap$1(x => x.getValue()), shareReplay$1(1));
2896
3638
  }
2897
3639
  setValue(value) {
2898
- this._initialValue = value;
2899
- this._delegate.setValue(value);
3640
+ this._initialValue.next(value);
3641
+ if (this._delegate.value) {
3642
+ this._delegate.value.setValue(value);
3643
+ }
2900
3644
  }
2901
3645
  isDisabled() {
2902
- return this._delegate.isDisabled();
3646
+ return this._disabled.value;
2903
3647
  }
2904
3648
  setDisabled(disabled = true) {
2905
- this._disabled = disabled;
2906
- this._delegate.setDisabled(disabled);
3649
+ this._disabled.next(disabled);
2907
3650
  }
2908
3651
  resetForm() {
2909
- this._delegate.resetForm();
3652
+ if (this._delegate.value) {
3653
+ this._delegate.value.resetForm();
3654
+ }
2910
3655
  }
2911
3656
  forceFormUpdate() {
2912
- this._delegate.forceFormUpdate();
3657
+ if (this._delegate.value) {
3658
+ this._delegate.value.forceFormUpdate();
3659
+ }
2913
3660
  }
2914
3661
  }
2915
3662
  DbxFormlyContext.INITIAL_STATE = { isComplete: false, state: DbxFormState.INITIALIZING };
2916
- DbxFormlyContext.EMPTY_DELEGATE = {
2917
- isComplete: false,
2918
- state: DbxFormState.INITIALIZING,
2919
- stream$: of(DbxFormlyContext.INITIAL_STATE),
2920
- setFields(fields) {
2921
- // Do nothing.
2922
- },
2923
- getValue() {
2924
- return undefined;
2925
- },
2926
- setValue(value) {
2927
- // Do nothing.
2928
- },
2929
- resetForm() {
2930
- // Do nothing.
2931
- },
2932
- forceFormUpdate() {
2933
- // Do nothing.
2934
- },
2935
- isDisabled() {
2936
- return false;
2937
- },
2938
- setDisabled(disabled) {
2939
- // Do nothing.
2940
- }
2941
- };
2942
3663
 
2943
3664
  /**
2944
3665
  * Abstract component for wrapping a form.
@@ -2958,11 +3679,14 @@ class AbstractFormlyFormDirective {
2958
3679
  }
2959
3680
  // Utility Functions
2960
3681
  getValue() {
2961
- return this.context.value;
3682
+ return this.context.getValue();
2962
3683
  }
2963
3684
  setValue(value) {
2964
3685
  this.context.setValue(value);
2965
3686
  }
3687
+ resetForm() {
3688
+ this.context.resetForm();
3689
+ }
2966
3690
  clearValue() {
2967
3691
  this.setValue({});
2968
3692
  }
@@ -2996,7 +3720,7 @@ class AbstractAsyncFormlyFormDirective extends AbstractFormlyFormDirective {
2996
3720
  this._fieldsSub = new SubscriptionObject();
2997
3721
  }
2998
3722
  ngOnInit() {
2999
- this._fieldsSub.subscription = this.fields$.subscribe((fields) => {
3723
+ this._fieldsSub.subscription = this.fields$.pipe(distinctUntilChanged$1()).subscribe((fields) => {
3000
3724
  this.context.fields = fields;
3001
3725
  });
3002
3726
  }
@@ -3014,7 +3738,7 @@ class AbstractConfigAsyncFormlyFormDirective extends AbstractAsyncFormlyFormDire
3014
3738
  constructor() {
3015
3739
  super(...arguments);
3016
3740
  this._config = new BehaviorSubject(undefined);
3017
- this.config$ = this._config.asObservable();
3741
+ this.config$ = this._config.pipe(filterMaybe(), shareReplay$1(1));
3018
3742
  }
3019
3743
  get config() {
3020
3744
  return this._config.value;
@@ -3035,54 +3759,91 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
3035
3759
  type: Input
3036
3760
  }] } });
3037
3761
 
3038
- class DbxFormlyComponent extends AbstractSubscriptionDirective {
3039
- constructor(context, ngZone) {
3762
+ /**
3763
+ * Provides an DbxFormlyContext and has an input for fields.
3764
+ */
3765
+ class DbxFormlyFieldsContextDirective extends AbstractAsyncFormlyFormDirective {
3766
+ constructor() {
3767
+ super(...arguments);
3768
+ this._fields = new BehaviorSubject(undefined);
3769
+ this.fields$ = this._fields.asObservable();
3770
+ }
3771
+ get fields() {
3772
+ return this._fields.value;
3773
+ }
3774
+ set fields(fields) {
3775
+ this._fields.next(fields);
3776
+ }
3777
+ ngOnDestroy() {
3778
+ super.ngOnDestroy();
3779
+ this._fields.complete();
3780
+ }
3781
+ }
3782
+ DbxFormlyFieldsContextDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormlyFieldsContextDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
3783
+ DbxFormlyFieldsContextDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: DbxFormlyFieldsContextDirective, selector: "[dbxFormlyFields]", inputs: { fields: ["dbxFormlyFields", "fields"] }, providers: ProvideFormlyContext(), usesInheritance: true, ngImport: i0 });
3784
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormlyFieldsContextDirective, decorators: [{
3785
+ type: Directive,
3786
+ args: [{
3787
+ selector: '[dbxFormlyFields]',
3788
+ providers: ProvideFormlyContext()
3789
+ }]
3790
+ }], propDecorators: { fields: [{
3791
+ type: Input,
3792
+ args: ['dbxFormlyFields']
3793
+ }] } });
3794
+
3795
+ /**
3796
+ * Used for rending a form from a DbxFormlyContext.
3797
+ */
3798
+ class DbxFormlyFormComponent extends AbstractSubscriptionDirective {
3799
+ constructor(context) {
3040
3800
  super();
3041
3801
  this.context = context;
3042
- this.ngZone = ngZone;
3043
- this._changesCount = 0;
3044
- this._fields = [];
3802
+ this._fields = new BehaviorSubject(undefined);
3045
3803
  this._events = new BehaviorSubject({ isComplete: false, state: DbxFormState.INITIALIZING });
3804
+ this._reset = new BehaviorSubject(new Date());
3805
+ this._forceUpdate = new Subject();
3046
3806
  this.form = new FormGroup({});
3047
3807
  this.model = {};
3048
3808
  this.options = {};
3809
+ this.fields$ = this._fields.pipe(switchMapMaybeObs(), distinctUntilChanged$1(), shareReplay$1(1));
3810
+ this.stream$ = this._reset.pipe(switchMap$1((lastResetAt) => this.form.valueChanges.pipe(startWith(0), distinctUntilChanged$1(), throttleTime$1(50, undefined, { leading: true, trailing: true }), scanCount(), map$1((changesSinceLastResetCount) => {
3811
+ const isReset = changesSinceLastResetCount === 1;
3812
+ const complete = this.form.valid;
3813
+ const nextState = {
3814
+ isComplete: complete,
3815
+ state: (isReset) ? DbxFormState.RESET : DbxFormState.USED,
3816
+ untouched: this.form.untouched,
3817
+ pristine: this.form.pristine,
3818
+ changesCount: changesSinceLastResetCount,
3819
+ lastResetAt,
3820
+ isDisabled: this.disabled
3821
+ };
3822
+ return nextState;
3823
+ }))), shareReplay$1(1));
3049
3824
  }
3050
3825
  ngOnInit() {
3051
3826
  this.context.setDelegate(this);
3052
- this.sub = this.form.valueChanges.pipe(startWith$1(this.form.value), distinctUntilChanged(), debounceTime(50)).subscribe((_) => this._updateForChange());
3053
3827
  }
3054
3828
  ngOnDestroy() {
3055
3829
  this.context.lockSet.onNextUnlock(() => {
3056
3830
  super.ngOnDestroy();
3057
3831
  this.context.clearDelegate(this);
3058
3832
  this._events.complete();
3833
+ this._fields.complete();
3834
+ this._reset.complete();
3835
+ this._forceUpdate.complete();
3059
3836
  });
3060
3837
  }
3061
- get fields() {
3062
- return this._fields;
3063
- }
3064
3838
  // MARK: Delegate
3065
- get isComplete() {
3066
- return this._events.value.isComplete;
3067
- }
3068
- get state() {
3069
- return this._events.value.state;
3070
- }
3071
- get stream$() {
3072
- return this._events.asObservable();
3073
- }
3074
- setFields(fields) {
3075
- this._fields = fields;
3839
+ init(initialize) {
3840
+ this._fields.next(initialize.fields);
3076
3841
  }
3077
3842
  getValue() {
3078
- return this.form.value; // this.model
3843
+ return of(this.form.value);
3079
3844
  }
3080
3845
  setValue(value) {
3081
- /*
3082
- if (value === this.model) {
3083
- return; // Ignore the same value being set.
3084
- }
3085
- */
3846
+ // console.log('set value: ', value);
3086
3847
  this.model = cloneDeep(value);
3087
3848
  if (this.options.updateInitialValue) {
3088
3849
  this.options.updateInitialValue();
@@ -3091,8 +3852,6 @@ class DbxFormlyComponent extends AbstractSubscriptionDirective {
3091
3852
  // Re-mark as untouched and pristine.
3092
3853
  this.form.markAsUntouched();
3093
3854
  this.form.markAsPristine();
3094
- this._lastResetAt = new Date();
3095
- this._changesCount = 0;
3096
3855
  // After updating the value, if the form is still untouched mark it as pristine again.
3097
3856
  // Sometimes the values get marked as changed and break pristine before a user has time to interact.
3098
3857
  setTimeout(() => {
@@ -3106,60 +3865,52 @@ class DbxFormlyComponent extends AbstractSubscriptionDirective {
3106
3865
  this.options.resetModel();
3107
3866
  }
3108
3867
  }
3109
- isDisabled() {
3868
+ get disabled() {
3110
3869
  return this.form.disabled;
3111
3870
  }
3112
3871
  setDisabled(disabled = true) {
3113
- // console.log('setting disabled: ', disabled);
3114
- if (disabled) {
3115
- this.form.disable();
3116
- }
3117
- else {
3118
- this.form.enable();
3872
+ if (disabled !== this.disabled) {
3873
+ if (disabled) {
3874
+ this.form.disable({ emitEvent: true });
3875
+ }
3876
+ else {
3877
+ this.form.enable({ emitEvent: true });
3878
+ }
3119
3879
  }
3120
3880
  }
3121
3881
  // MARK: Update
3122
3882
  forceFormUpdate() {
3123
- this._updateForChange();
3124
- }
3125
- _updateForChange() {
3126
- const complete = this.form.valid;
3127
- this._changesCount += 1;
3128
- const nextState = {
3129
- isComplete: complete,
3130
- state: (complete) ? DbxFormState.COMPLETE : DbxFormState.INCOMPLETE,
3131
- untouched: this.form.untouched,
3132
- pristine: this.form.pristine,
3133
- changesCount: this._changesCount,
3134
- lastResetAt: this._lastResetAt
3135
- };
3136
- this._events.next(nextState);
3883
+ this._forceUpdate.next();
3137
3884
  }
3138
3885
  }
3139
- DbxFormlyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormlyComponent, deps: [{ token: DbxFormlyContext }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
3140
- DbxFormlyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxFormlyComponent, selector: "dbx-formly", exportAs: ["formly"], usesInheritance: true, ngImport: i0, template: `
3886
+ DbxFormlyFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormlyFormComponent, deps: [{ token: DbxFormlyContext }], target: i0.ɵɵFactoryTarget.Component });
3887
+ DbxFormlyFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: DbxFormlyFormComponent, selector: "dbx-formly", host: { classAttribute: "dbx-formly" }, providers: ProvideDbxMutableForm(DbxFormlyFormComponent), exportAs: ["formly"], usesInheritance: true, ngImport: i0, template: `
3141
3888
  <form [formGroup]="form" class="dbx-formly">
3142
- <formly-form [form]="form" [fields]="fields" [model]="model"></formly-form>
3889
+ <formly-form [form]="form" [fields]="(fields$ | async) ?? []" [model]="model"></formly-form>
3143
3890
  </form>
3144
- `, isInline: true, components: [{ type: i1$4.FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }], directives: [{ type: i3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] });
3145
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormlyComponent, decorators: [{
3891
+ `, isInline: true, components: [{ type: i1$4.FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }], directives: [{ type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }], pipes: { "async": i5.AsyncPipe } });
3892
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormlyFormComponent, decorators: [{
3146
3893
  type: Component,
3147
3894
  args: [{
3148
3895
  selector: 'dbx-formly',
3149
3896
  exportAs: 'formly',
3150
3897
  template: `
3151
3898
  <form [formGroup]="form" class="dbx-formly">
3152
- <formly-form [form]="form" [fields]="fields" [model]="model"></formly-form>
3899
+ <formly-form [form]="form" [fields]="(fields$ | async) ?? []" [model]="model"></formly-form>
3153
3900
  </form>
3154
3901
  `,
3155
- // TODO: styleUrls: ['./form.scss'],
3902
+ providers: ProvideDbxMutableForm(DbxFormlyFormComponent),
3903
+ host: {
3904
+ 'class': 'dbx-formly'
3905
+ }
3156
3906
  }]
3157
- }], ctorParameters: function () { return [{ type: DbxFormlyContext }, { type: i0.NgZone }]; } });
3907
+ }], ctorParameters: function () { return [{ type: DbxFormlyContext }]; } });
3158
3908
 
3159
3909
  class DbxFormlyModule {
3160
3910
  }
3161
3911
  DbxFormlyModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormlyModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3162
- DbxFormlyModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormlyModule, declarations: [DbxFormlyComponent], imports: [CommonModule,
3912
+ DbxFormlyModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormlyModule, declarations: [DbxFormlyFormComponent,
3913
+ DbxFormlyFieldsContextDirective], imports: [CommonModule,
3163
3914
  FormsModule,
3164
3915
  ReactiveFormsModule,
3165
3916
  FormlyModule,
@@ -3167,9 +3918,9 @@ DbxFormlyModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
3167
3918
  // Modules (?)
3168
3919
  FormsModule,
3169
3920
  ReactiveFormsModule,
3170
- // DbxFormWrapperModule, // todo!
3171
3921
  // Directives
3172
- DbxFormlyComponent] });
3922
+ DbxFormlyFormComponent,
3923
+ DbxFormlyFieldsContextDirective] });
3173
3924
  DbxFormlyModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormlyModule, imports: [[
3174
3925
  CommonModule,
3175
3926
  FormsModule,
@@ -3191,17 +3942,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
3191
3942
  FormlyMatToggleModule
3192
3943
  ],
3193
3944
  declarations: [
3194
- DbxFormlyComponent,
3195
- // FormComponentFieldComponent
3945
+ DbxFormlyFormComponent,
3946
+ DbxFormlyFieldsContextDirective
3196
3947
  ],
3197
3948
  exports: [
3198
3949
  // Modules (?)
3199
3950
  FormsModule,
3200
3951
  ReactiveFormsModule,
3201
- // DbxFormWrapperModule, // todo!
3202
3952
  // Directives
3203
- DbxFormlyComponent,
3204
- // FormComponentFieldComponent
3953
+ DbxFormlyFormComponent,
3954
+ DbxFormlyFieldsContextDirective
3205
3955
  ]
3206
3956
  }]
3207
3957
  }] });
@@ -3281,9 +4031,29 @@ function IsInRange(min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER)
3281
4031
  };
3282
4032
  }
3283
4033
 
4034
+ class DbxFormExtensionModule {
4035
+ }
4036
+ DbxFormExtensionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormExtensionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4037
+ DbxFormExtensionModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormExtensionModule, exports: [DbxFormModule,
4038
+ DbxFormlyModule,
4039
+ DbxFormFormlyFieldModule] });
4040
+ DbxFormExtensionModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormExtensionModule, imports: [DbxFormModule,
4041
+ DbxFormlyModule,
4042
+ DbxFormFormlyFieldModule] });
4043
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: DbxFormExtensionModule, decorators: [{
4044
+ type: NgModule,
4045
+ args: [{
4046
+ exports: [
4047
+ DbxFormModule,
4048
+ DbxFormlyModule,
4049
+ DbxFormFormlyFieldModule
4050
+ ]
4051
+ }]
4052
+ }] });
4053
+
3284
4054
  /**
3285
4055
  * Generated bundle index. Do not edit.
3286
4056
  */
3287
4057
 
3288
- export { ADDRESS_CITY_MAX_LENGTH, ADDRESS_COUNTRY_MAX_LENGTH, ADDRESS_LINE_MAX_LENGTH, ADDRESS_STATE_MAX_LENGTH, ADDRESS_ZIP_MAX_LENGTH, APP_ACTION_FORM_DISABLED_KEY, AbstractAsyncFormlyFormDirective, AbstractConfigAsyncFormlyFormDirective, AbstractDbxPickableItemFieldDirective, AbstractDbxSearchableValueFieldDirective, AbstractFormComponentFieldWrappedComponent, AbstractFormExpandableSectionWrapperDirective, AbstractFormlyFormDirective, AbstractSyncFormlyFormDirective, AutoTouchFieldWrapperComponent, ChecklistItemFieldDataSetBuilder, DEFAULT_HAS_VALUE_FN, DEFAULT_PREFERRED_COUNTRIES, DOMAIN_NAME_REGEX, DateTimeFieldTimeMode, DbxActionFormDirective, DbxChecklistItemContentComponent, DbxChecklistItemFieldComponent, DbxDateTimeFieldComponent, DbxDefaultChecklistItemFieldDisplayComponent, DbxDefaultSearchableAnchorFieldDisplayComponent, DbxDefaultSearchableFieldDisplayComponent, DbxForm, DbxFormFormlyArrayFieldModule, DbxFormFormlyBooleanFieldModule, DbxFormFormlyChecklistItemFieldModule, DbxFormFormlyComponentFieldModule, DbxFormFormlyDateFieldModule, DbxFormFormlyPhoneFieldModule, DbxFormFormlyPickableFieldModule, DbxFormFormlySearchableFieldModule, DbxFormFormlyTextFieldModule, DbxFormFormlyWrapperModule, DbxFormLayoutModule, DbxFormLoadingPairSourceDirective, DbxFormModule, DbxFormRepeatTypeComponent, DbxFormSourceDirective, DbxFormSpacerComponent, DbxFormState, DbxFormValueChangesDirective, DbxFormlyActionModule, DbxFormlyComponent, DbxFormlyContext, DbxFormlyModule, DbxInternationalPhoneFieldComponent, DbxPickableChipFieldComponent, DbxPickableListFieldComponent, DbxSearchableChipFieldComponent, DbxSearchableFieldAutocompleteItemComponent, DbxSearchableTextFieldComponent, FormComponentFieldComponent, FormExpandableSectionWrapperComponent, FormFlexWrapperComponent, FormInfoSectionWrapperComponent, FormSectionWrapperComponent, FormSubsectionWrapperComponent, FormToggleSectionWrapperComponent, IsDomain, IsInRange, IsTruthy, LABEL_STRING_MAX_LENGTH, PHONE_LABEL_MAX_LENGTH, ProvideDbxForm, ProvideFormlyContext, SEARCH_STRING_MAX_LENGTH, TAKE_NEXT_UPCOMING_TIME_CONFIG_OBS, addToggleWrapperToField, addressField, addressFormlyFields, addressListField, checkboxField, checklistItemField, chipTextField, cityField, componentField, countryField, dateTimeField, disableFormlyFieldAutofill, emailField, flexLayoutWrapper, formlyField, hiddenField, internationalPhoneField, makeMetaFilterSearchableFieldValueDisplayFn, nameField, phoneAndLabelFieldGroup, phoneAndLabelFields, phoneListField, searchableChipField, searchableTextField, stateField, staticEnumField, textAreaField, textField, timeOnlyField, toggleField, zipCodeField };
4058
+ export { ADDRESS_CITY_MAX_LENGTH, ADDRESS_COUNTRY_MAX_LENGTH, ADDRESS_LINE_MAX_LENGTH, ADDRESS_STATE_MAX_LENGTH, ADDRESS_ZIP_MAX_LENGTH, APP_ACTION_FORM_DISABLED_KEY, AbstractAsyncFormlyFormDirective, AbstractConfigAsyncFormlyFormDirective, AbstractDbxPickableItemFieldDirective, AbstractDbxSearchableFieldDisplayDirective, AbstractDbxSearchableValueFieldDirective, AbstractFormComponentFieldWrappedComponent, AbstractFormExpandableSectionWrapperDirective, AbstractFormlyFormDirective, AbstractSyncFormlyFormDirective, AutoTouchFieldWrapperComponent, ChecklistItemFieldDataSetBuilder, DBX_SEARCHABLE_FIELD_COMPONENT_DATA, DEFAULT_HAS_VALUE_FN, DEFAULT_PREFERRED_COUNTRIES, DOMAIN_NAME_REGEX, DateTimeFieldTimeMode, DbxActionFormDirective, DbxActionFormSafetyDirective, DbxChecklistItemContentComponent, DbxChecklistItemFieldComponent, DbxDateTimeFieldComponent, DbxDefaultChecklistItemFieldDisplayComponent, DbxDefaultSearchableFieldDisplayComponent, DbxForm, DbxFormActionModule, DbxFormActionTransitionModule, DbxFormExpandWrapperComponent, DbxFormExtensionModule, DbxFormFlexWrapperComponent, DbxFormFormlyArrayFieldModule, DbxFormFormlyBooleanFieldModule, DbxFormFormlyChecklistItemFieldModule, DbxFormFormlyComponentFieldModule, DbxFormFormlyDateFieldModule, DbxFormFormlyEnumFieldModule, DbxFormFormlyFieldModule, DbxFormFormlyPhoneFieldModule, DbxFormFormlyPickableFieldModule, DbxFormFormlySearchableFieldModule, DbxFormFormlySelectionModule, DbxFormFormlyTextEditorFieldModule, DbxFormFormlyTextFieldModule, DbxFormFormlyValueModule, DbxFormFormlyWrapperModule, DbxFormInfoWrapperComponent, DbxFormIoModule, DbxFormLayoutModule, DbxFormLoadingSourceDirective, DbxFormModule, DbxFormRepeatArrayTypeComponent, DbxFormSectionWrapperComponent, DbxFormSourceDirective, DbxFormSpacerComponent, DbxFormState, DbxFormSubsectionWrapperComponent, DbxFormToggleWrapperComponent, DbxFormValueChangesDirective, DbxFormlyContext, DbxFormlyFieldsContextDirective, DbxFormlyFormComponent, DbxFormlyModule, DbxMutableForm, DbxPhoneFieldComponent, DbxPickableChipListFieldComponent, DbxPickableListFieldComponent, DbxPickableListFieldItemListComponent, DbxPickableListFieldItemListViewComponent, DbxPickableListFieldItemListViewItemComponent, DbxSearchableChipFieldComponent, DbxSearchableFieldAutocompleteItemComponent, DbxSearchableTextFieldComponent, DbxTextEditorFieldComponent, EXPANDABLE_WRAPPER_KEY, FLEX_WRAPPER_KEY, FormComponentFieldComponent, INFO_WRAPPER_KEY, INVALID_PHONE_NUMBER_MESSAGE, IsDomain, IsInRange, IsTruthy, LABEL_STRING_MAX_LENGTH, MAX_LENGTH_VALIDATION_MESSAGE, MAX_VALIDATION_MESSAGE, MIN_LENGTH_VALIDATION_MESSAGE, MIN_VALIDATION_MESSAGE, PHONE_LABEL_MAX_LENGTH, ProvideDbxForm, ProvideDbxMutableForm, ProvideFormlyContext, REQUIRED_VALIDATION_MESSAGE, SEARCH_STRING_MAX_LENGTH, SECTION_WRAPPER_KEY, STYLE_WRAPPER_KEY, SUBSECTION_WRAPPER_KEY, TAKE_NEXT_UPCOMING_TIME_CONFIG_OBS, TOGGLE_WRAPPER_KEY, addWrapperToFormlyFieldConfig, addressField, addressFormlyFields, addressListField, checkIsFieldFlexLayoutGroupFieldConfig, checkboxField, checklistItemField, chipTextField, cityField, componentField, countryField, dateTimeField, defaultValidationMessages, disableFormlyFieldAutofillAttributes, emailField, expandWrapper, filterPickableItemFieldValuesByLabel, flexLayoutWrapper, formlyField, hiddenField, infoWrapper, makeMetaFilterSearchableFieldValueDisplayFn, maxLengthValidationMessage, maxValidationMessage, minLengthValidationMessage, minValidationMessage, nameField, phoneAndLabelSectionField, phoneField, phoneListField, pickableItemChipField, pickableItemListField, repeatArrayField, searchableChipField, searchableStringChipField, searchableTextField, sectionWrapper, sortPickableItemsByLabel, stateField, staticEnumField, styleWrapper, subsectionWrapper, templateOptionsForFieldConfig, templateOptionsValueForFieldConfig, textAreaField, textEditorField, textField, timeOnlyField, toggleField, toggleWrapper, wrappedPhoneAndLabelField, zipCodeField };
3289
4059
  //# sourceMappingURL=dereekb-dbx-form.mjs.map