@dereekb/dbx-form 11.1.8 → 12.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 (248) hide show
  1. package/calendar/lib/calendar.module.d.ts +1 -14
  2. package/calendar/lib/calendar.schedule.selection.cell.component.d.ts +8 -5
  3. package/calendar/lib/calendar.schedule.selection.component.d.ts +13 -10
  4. package/calendar/lib/calendar.schedule.selection.d.ts +6 -6
  5. package/calendar/lib/calendar.schedule.selection.days.component.d.ts +1 -1
  6. package/calendar/lib/calendar.schedule.selection.days.form.component.d.ts +1 -1
  7. package/calendar/lib/calendar.schedule.selection.dialog.button.component.d.ts +4 -4
  8. package/calendar/lib/calendar.schedule.selection.dialog.component.d.ts +5 -5
  9. package/calendar/lib/calendar.schedule.selection.popover.button.component.d.ts +4 -2
  10. package/calendar/lib/calendar.schedule.selection.popover.component.d.ts +1 -1
  11. package/calendar/lib/calendar.schedule.selection.popover.content.component.d.ts +1 -1
  12. package/calendar/lib/calendar.schedule.selection.range.component.d.ts +19 -17
  13. package/calendar/lib/calendar.schedule.selection.store.d.ts +2 -2
  14. package/calendar/lib/calendar.schedule.selection.store.provide.d.ts +1 -1
  15. package/calendar/lib/calendar.schedule.selection.toggle.button.component.d.ts +8 -12
  16. package/calendar/lib/field/schedule/calendar.schedule.field.component.d.ts +22 -22
  17. package/calendar/lib/field/schedule/calendar.schedule.module.d.ts +2 -10
  18. package/esm2022/calendar/lib/calendar.module.mjs +19 -101
  19. package/esm2022/calendar/lib/calendar.schedule.selection.cell.component.mjs +27 -28
  20. package/esm2022/calendar/lib/calendar.schedule.selection.component.mjs +38 -55
  21. package/esm2022/calendar/lib/calendar.schedule.selection.days.component.mjs +17 -13
  22. package/esm2022/calendar/lib/calendar.schedule.selection.days.form.component.mjs +11 -12
  23. package/esm2022/calendar/lib/calendar.schedule.selection.dialog.button.component.mjs +18 -21
  24. package/esm2022/calendar/lib/calendar.schedule.selection.dialog.component.mjs +12 -9
  25. package/esm2022/calendar/lib/calendar.schedule.selection.mjs +3 -2
  26. package/esm2022/calendar/lib/calendar.schedule.selection.popover.button.component.mjs +22 -18
  27. package/esm2022/calendar/lib/calendar.schedule.selection.popover.component.mjs +12 -9
  28. package/esm2022/calendar/lib/calendar.schedule.selection.popover.content.component.mjs +13 -10
  29. package/esm2022/calendar/lib/calendar.schedule.selection.range.component.mjs +52 -70
  30. package/esm2022/calendar/lib/calendar.schedule.selection.store.mjs +5 -5
  31. package/esm2022/calendar/lib/calendar.schedule.selection.store.provide.mjs +9 -8
  32. package/esm2022/calendar/lib/calendar.schedule.selection.toggle.button.component.mjs +48 -50
  33. package/esm2022/calendar/lib/field/schedule/calendar.schedule.field.component.mjs +17 -14
  34. package/esm2022/calendar/lib/field/schedule/calendar.schedule.module.mjs +8 -40
  35. package/esm2022/lib/form/action/form.action.directive.mjs +58 -55
  36. package/esm2022/lib/form/action/form.action.module.mjs +9 -9
  37. package/esm2022/lib/form/action/transition/form.action.transition.module.mjs +9 -8
  38. package/esm2022/lib/form/action/transition/form.action.transition.safety.directive.mjs +14 -11
  39. package/esm2022/lib/form/form.mjs +1 -1
  40. package/esm2022/lib/form/form.module.mjs +4 -4
  41. package/esm2022/lib/form/io/form.changes.directive.mjs +11 -16
  42. package/esm2022/lib/form/io/form.input.directive.mjs +24 -38
  43. package/esm2022/lib/form/io/form.io.module.mjs +15 -9
  44. package/esm2022/lib/form/io/form.loading.directive.mjs +22 -42
  45. package/esm2022/lib/form.module.mjs +4 -4
  46. package/esm2022/lib/form.providers.mjs +32 -0
  47. package/esm2022/lib/formly/field/checklist/checklist.field.mjs +5 -5
  48. package/esm2022/lib/formly/field/checklist/checklist.item.field.component.mjs +51 -47
  49. package/esm2022/lib/formly/field/checklist/checklist.item.field.content.default.component.mjs +41 -29
  50. package/esm2022/lib/formly/field/checklist/checklist.item.field.mjs +3 -3
  51. package/esm2022/lib/formly/field/checklist/checklist.item.field.module.mjs +8 -45
  52. package/esm2022/lib/formly/field/checklist/checklist.item.mjs +1 -1
  53. package/esm2022/lib/formly/field/component/component.field.component.mjs +11 -8
  54. package/esm2022/lib/formly/field/component/component.field.module.mjs +8 -14
  55. package/esm2022/lib/formly/field/field.mjs +1 -1
  56. package/esm2022/lib/formly/field/form.field.module.mjs +4 -4
  57. package/esm2022/lib/formly/field/selection/list/list.field.component.mjs +17 -14
  58. package/esm2022/lib/formly/field/selection/list/list.field.module.mjs +8 -58
  59. package/esm2022/lib/formly/field/selection/pickable/pickable.chip.field.component.mjs +17 -13
  60. package/esm2022/lib/formly/field/selection/pickable/pickable.field.directive.mjs +16 -16
  61. package/esm2022/lib/formly/field/selection/pickable/pickable.field.module.mjs +8 -68
  62. package/esm2022/lib/formly/field/selection/pickable/pickable.list.field.component.mjs +71 -54
  63. package/esm2022/lib/formly/field/selection/pickable/pickable.util.mjs +2 -2
  64. package/esm2022/lib/formly/field/selection/searchable/searchable.chip.field.component.mjs +21 -16
  65. package/esm2022/lib/formly/field/selection/searchable/searchable.field.autocomplete.item.component.mjs +51 -49
  66. package/esm2022/lib/formly/field/selection/searchable/searchable.field.directive.mjs +35 -27
  67. package/esm2022/lib/formly/field/selection/searchable/searchable.field.mjs +1 -1
  68. package/esm2022/lib/formly/field/selection/searchable/searchable.field.module.mjs +8 -65
  69. package/esm2022/lib/formly/field/selection/searchable/searchable.mjs +1 -1
  70. package/esm2022/lib/formly/field/selection/searchable/searchable.text.field.component.mjs +48 -30
  71. package/esm2022/lib/formly/field/selection/searchable/text.chip.field.mjs +2 -2
  72. package/esm2022/lib/formly/field/selection/selection.field.mjs +1 -1
  73. package/esm2022/lib/formly/field/selection/selection.mjs +1 -1
  74. package/esm2022/lib/formly/field/selection/selection.module.mjs +4 -4
  75. package/esm2022/lib/formly/field/selection/sourceselect/sourceselect.field.component.mjs +20 -21
  76. package/esm2022/lib/formly/field/selection/sourceselect/sourceselect.field.module.mjs +6 -73
  77. package/esm2022/lib/formly/field/selection/sourceselect/sourceselect.mjs +1 -1
  78. package/esm2022/lib/formly/field/texteditor/texteditor.field.component.mjs +37 -22
  79. package/esm2022/lib/formly/field/texteditor/texteditor.field.mjs +2 -2
  80. package/esm2022/lib/formly/field/texteditor/texteditor.field.module.mjs +8 -33
  81. package/esm2022/lib/formly/field/value/array/array.field.component.mjs +72 -50
  82. package/esm2022/lib/formly/field/value/array/array.field.module.mjs +8 -44
  83. package/esm2022/lib/formly/field/value/boolean/boolean.field.mjs +2 -2
  84. package/esm2022/lib/formly/field/value/boolean/boolean.field.module.mjs +4 -4
  85. package/esm2022/lib/formly/field/value/date/date.field.module.mjs +5 -9
  86. package/esm2022/lib/formly/field/value/date/date.value.mjs +1 -1
  87. package/esm2022/lib/formly/field/value/date/datetime.field.component.mjs +8 -8
  88. package/esm2022/lib/formly/field/value/date/datetime.field.service.mjs +4 -4
  89. package/esm2022/lib/formly/field/value/date/datetime.mjs +1 -1
  90. package/esm2022/lib/formly/field/value/date/fixeddaterange.field.component.mjs +8 -8
  91. package/esm2022/lib/formly/field/value/number/number.field.mjs +1 -1
  92. package/esm2022/lib/formly/field/value/number/number.field.module.mjs +4 -4
  93. package/esm2022/lib/formly/field/value/phone/phone.field.component.mjs +4 -4
  94. package/esm2022/lib/formly/field/value/phone/phone.field.module.mjs +4 -4
  95. package/esm2022/lib/formly/field/value/text/text.address.field.mjs +1 -1
  96. package/esm2022/lib/formly/field/value/text/text.field.mjs +1 -1
  97. package/esm2022/lib/formly/field/value/text/text.field.module.mjs +4 -4
  98. package/esm2022/lib/formly/field/value/value.module.mjs +4 -4
  99. package/esm2022/lib/formly/field/wrapper/autotouch.wrapper.component.mjs +9 -7
  100. package/esm2022/lib/formly/field/wrapper/expand.wrapper.component.mjs +19 -24
  101. package/esm2022/lib/formly/field/wrapper/expand.wrapper.delegate.mjs +7 -4
  102. package/esm2022/lib/formly/field/wrapper/flex.wrapper.component.mjs +11 -8
  103. package/esm2022/lib/formly/field/wrapper/form.wrapper.module.mjs +8 -39
  104. package/esm2022/lib/formly/field/wrapper/index.mjs +2 -1
  105. package/esm2022/lib/formly/field/wrapper/info.wrapper.component.mjs +19 -16
  106. package/esm2022/lib/formly/field/wrapper/section.wrapper.component.mjs +11 -7
  107. package/esm2022/lib/formly/field/wrapper/style.wrapper.component.mjs +16 -11
  108. package/esm2022/lib/formly/field/wrapper/subsection.wrapper.component.mjs +11 -8
  109. package/esm2022/lib/formly/field/wrapper/toggle.wrapper.component.mjs +21 -17
  110. package/esm2022/lib/formly/field/wrapper/working.wrapper.component.mjs +11 -8
  111. package/esm2022/lib/formly/field/wrapper/wrapper.mjs +1 -1
  112. package/esm2022/lib/formly/form/form.form.module.mjs +4 -4
  113. package/esm2022/lib/formly/form/search.form.component.mjs +4 -4
  114. package/esm2022/lib/formly/formly.component.template.mjs +29 -0
  115. package/esm2022/lib/formly/formly.context.directive.mjs +6 -5
  116. package/esm2022/lib/formly/formly.context.mjs +12 -8
  117. package/esm2022/lib/formly/formly.directive.mjs +29 -44
  118. package/esm2022/lib/formly/formly.form.component.mjs +24 -18
  119. package/esm2022/lib/formly/formly.module.mjs +10 -14
  120. package/esm2022/lib/formly/index.mjs +2 -1
  121. package/esm2022/lib/formly/template/login.mjs +1 -1
  122. package/esm2022/lib/formly/template/timezone.mjs +1 -1
  123. package/esm2022/lib/index.mjs +2 -1
  124. package/esm2022/lib/layout/form.layout.module.mjs +4 -4
  125. package/esm2022/lib/layout/form.spacer.component.mjs +3 -3
  126. package/esm2022/lib/validator/available.mjs +1 -1
  127. package/esm2022/lib/validator/boolean.mjs +1 -1
  128. package/esm2022/lib/validator/field.mjs +2 -2
  129. package/esm2022/lib/validator/number.mjs +1 -1
  130. package/esm2022/lib/validator/phone.mjs +1 -1
  131. package/esm2022/mapbox/lib/field/latlng/latlng.field.component.mjs +65 -47
  132. package/esm2022/mapbox/lib/field/latlng/latlng.field.marker.component.mjs +13 -10
  133. package/esm2022/mapbox/lib/field/latlng/latlng.module.mjs +10 -43
  134. package/esm2022/mapbox/lib/field/zoom/zoom.field.component.mjs +32 -26
  135. package/esm2022/mapbox/lib/field/zoom/zoom.module.mjs +8 -36
  136. package/esm2022/mapbox/lib/mapbox.module.mjs +4 -4
  137. package/fesm2022/dereekb-dbx-form-calendar.mjs +340 -457
  138. package/fesm2022/dereekb-dbx-form-calendar.mjs.map +1 -1
  139. package/fesm2022/dereekb-dbx-form-mapbox.mjs +114 -141
  140. package/fesm2022/dereekb-dbx-form-mapbox.mjs.map +1 -1
  141. package/fesm2022/dereekb-dbx-form.mjs +935 -1106
  142. package/fesm2022/dereekb-dbx-form.mjs.map +1 -1
  143. package/lib/extension/calendar/_calendar.scss +3 -3
  144. package/lib/form/_form.scss +3 -3
  145. package/lib/form/action/form.action.directive.d.ts +35 -16
  146. package/lib/form/action/form.action.module.d.ts +4 -3
  147. package/lib/form/action/transition/form.action.transition.module.d.ts +4 -2
  148. package/lib/form/action/transition/form.action.transition.safety.directive.d.ts +4 -2
  149. package/lib/form/io/form.changes.directive.d.ts +3 -4
  150. package/lib/form/io/form.input.directive.d.ts +7 -10
  151. package/lib/form/io/form.io.module.d.ts +8 -2
  152. package/lib/form/io/form.loading.directive.d.ts +10 -11
  153. package/lib/form.providers.d.ts +8 -0
  154. package/lib/formly/_formly.scss +3 -3
  155. package/lib/formly/field/checklist/_checklist.scss +3 -3
  156. package/lib/formly/field/checklist/checklist.field.d.ts +7 -7
  157. package/lib/formly/field/checklist/checklist.item.d.ts +7 -9
  158. package/lib/formly/field/checklist/checklist.item.field.component.d.ts +19 -18
  159. package/lib/formly/field/checklist/checklist.item.field.content.default.component.d.ts +5 -5
  160. package/lib/formly/field/checklist/checklist.item.field.d.ts +1 -1
  161. package/lib/formly/field/checklist/checklist.item.field.module.d.ts +3 -11
  162. package/lib/formly/field/component/_component.scss +3 -3
  163. package/lib/formly/field/component/component.field.component.d.ts +1 -1
  164. package/lib/formly/field/component/component.field.module.d.ts +2 -4
  165. package/lib/formly/field/field.d.ts +8 -5
  166. package/lib/formly/field/selection/list/_list.scss +3 -3
  167. package/lib/formly/field/selection/list/list.field.component.d.ts +7 -5
  168. package/lib/formly/field/selection/list/list.field.module.d.ts +2 -12
  169. package/lib/formly/field/selection/pickable/_pickable.scss +3 -3
  170. package/lib/formly/field/selection/pickable/pickable.chip.field.component.d.ts +1 -1
  171. package/lib/formly/field/selection/pickable/pickable.field.directive.d.ts +25 -23
  172. package/lib/formly/field/selection/pickable/pickable.field.module.d.ts +2 -13
  173. package/lib/formly/field/selection/pickable/pickable.list.field.component.d.ts +15 -14
  174. package/lib/formly/field/selection/searchable/_searchable.scss +3 -3
  175. package/lib/formly/field/selection/searchable/searchable.chip.field.component.d.ts +4 -4
  176. package/lib/formly/field/selection/searchable/searchable.d.ts +3 -3
  177. package/lib/formly/field/selection/searchable/searchable.field.autocomplete.item.component.d.ts +8 -12
  178. package/lib/formly/field/selection/searchable/searchable.field.directive.d.ts +30 -25
  179. package/lib/formly/field/selection/searchable/searchable.field.module.d.ts +2 -13
  180. package/lib/formly/field/selection/searchable/searchable.text.field.component.d.ts +6 -8
  181. package/lib/formly/field/selection/selection.d.ts +5 -5
  182. package/lib/formly/field/selection/sourceselect/_sourceselect.scss +3 -3
  183. package/lib/formly/field/selection/sourceselect/sourceselect.d.ts +1 -1
  184. package/lib/formly/field/selection/sourceselect/sourceselect.field.component.d.ts +5 -3
  185. package/lib/formly/field/selection/sourceselect/sourceselect.field.module.d.ts +2 -17
  186. package/lib/formly/field/texteditor/_texteditor.scss +9 -9
  187. package/lib/formly/field/texteditor/texteditor.field.component.d.ts +5 -4
  188. package/lib/formly/field/texteditor/texteditor.field.module.d.ts +2 -8
  189. package/lib/formly/field/value/array/_array.scss +5 -5
  190. package/lib/formly/field/value/array/array.field.component.d.ts +16 -18
  191. package/lib/formly/field/value/array/array.field.d.ts +8 -5
  192. package/lib/formly/field/value/array/array.field.module.d.ts +2 -10
  193. package/lib/formly/field/value/boolean/_boolean.scss +3 -3
  194. package/lib/formly/field/value/date/_date.scss +5 -5
  195. package/lib/formly/field/value/date/date.field.module.d.ts +8 -9
  196. package/lib/formly/field/value/date/datetime.field.service.d.ts +1 -1
  197. package/lib/formly/field/value/date/fixeddaterange.field.component.d.ts +13 -13
  198. package/lib/formly/field/value/number/_number.scss +2 -2
  199. package/lib/formly/field/value/phone/_phone.scss +6 -6
  200. package/lib/formly/field/value/phone/phone.field.component.d.ts +6 -5
  201. package/lib/formly/field/value/text/_text.scss +3 -3
  202. package/lib/formly/field/wrapper/_wrapper.scss +3 -3
  203. package/lib/formly/field/wrapper/autotouch.wrapper.component.d.ts +1 -1
  204. package/lib/formly/field/wrapper/expand.wrapper.component.d.ts +1 -1
  205. package/lib/formly/field/wrapper/expand.wrapper.delegate.d.ts +2 -0
  206. package/lib/formly/field/wrapper/flex.wrapper.component.d.ts +4 -4
  207. package/lib/formly/field/wrapper/form.wrapper.module.d.ts +2 -8
  208. package/lib/formly/field/wrapper/index.d.ts +1 -0
  209. package/lib/formly/field/wrapper/info.wrapper.component.d.ts +2 -2
  210. package/lib/formly/field/wrapper/section.wrapper.component.d.ts +1 -1
  211. package/lib/formly/field/wrapper/style.wrapper.component.d.ts +5 -3
  212. package/lib/formly/field/wrapper/subsection.wrapper.component.d.ts +1 -1
  213. package/lib/formly/field/wrapper/toggle.wrapper.component.d.ts +2 -1
  214. package/lib/formly/field/wrapper/working.wrapper.component.d.ts +2 -2
  215. package/lib/formly/form/_form.scss +3 -3
  216. package/lib/formly/formly.component.template.d.ts +19 -0
  217. package/lib/formly/formly.context.d.ts +11 -7
  218. package/lib/formly/formly.context.directive.d.ts +2 -2
  219. package/lib/formly/formly.directive.d.ts +10 -10
  220. package/lib/formly/formly.form.component.d.ts +18 -13
  221. package/lib/formly/formly.module.d.ts +1 -1
  222. package/lib/formly/index.d.ts +1 -0
  223. package/lib/index.d.ts +1 -0
  224. package/lib/layout/_layout.scss +3 -3
  225. package/lib/style/_all-typography.scss +1 -1
  226. package/lib/style/_theming.scss +1 -1
  227. package/mapbox/lib/field/latlng/latlng.field.component.d.ts +25 -23
  228. package/mapbox/lib/field/latlng/latlng.field.marker.component.d.ts +2 -1
  229. package/mapbox/lib/field/latlng/latlng.module.d.ts +2 -11
  230. package/mapbox/lib/field/zoom/zoom.field.component.d.ts +13 -13
  231. package/mapbox/lib/field/zoom/zoom.module.d.ts +3 -10
  232. package/package.json +10 -11
  233. package/mapbox/esm2022/dereekb-dbx-form-mapbox.mjs +0 -5
  234. package/mapbox/esm2022/index.mjs +0 -3
  235. package/mapbox/esm2022/lib/field/index.mjs +0 -3
  236. package/mapbox/esm2022/lib/field/latlng/index.mjs +0 -5
  237. package/mapbox/esm2022/lib/field/latlng/latlng.field.component.mjs +0 -244
  238. package/mapbox/esm2022/lib/field/latlng/latlng.field.marker.component.mjs +0 -31
  239. package/mapbox/esm2022/lib/field/latlng/latlng.field.mjs +0 -35
  240. package/mapbox/esm2022/lib/field/latlng/latlng.module.mjs +0 -59
  241. package/mapbox/esm2022/lib/field/zoom/index.mjs +0 -4
  242. package/mapbox/esm2022/lib/field/zoom/zoom.field.component.mjs +0 -140
  243. package/mapbox/esm2022/lib/field/zoom/zoom.field.mjs +0 -23
  244. package/mapbox/esm2022/lib/field/zoom/zoom.module.mjs +0 -57
  245. package/mapbox/esm2022/lib/mapbox.module.mjs +0 -16
  246. package/mapbox/fesm2022/dereekb-dbx-form-mapbox.mjs +0 -566
  247. package/mapbox/fesm2022/dereekb-dbx-form-mapbox.mjs.map +0 -1
  248. package/mapbox/package.json +0 -21
@@ -1,566 +0,0 @@
1
- import { formlyField, propsAndConfigForFieldConfig, DEFAULT_LAT_LNG_TEXT_FIELD_PLACEHOLDER, validatorsForFieldConfig, DEFAULT_LAT_LNG_TEXT_FIELD_PATTERN_MESSAGE } from '@dereekb/dbx-form';
2
- import { LAT_LNG_PATTERN, isSameLatLngPoint, isDefaultLatLngPoint, isValidLatLngPoint, latLngStringFunction, latLngPointFunction, latLngPoint } from '@dereekb/util';
3
- import { CompactContextStore, mapCompactModeObs, DbxTextModule } from '@dereekb/dbx-web';
4
- import * as i0 from '@angular/core';
5
- import { inject, Component, ChangeDetectionStrategy, NgZone, Injector, NgModule } from '@angular/core';
6
- import { FieldType } from '@ngx-formly/material';
7
- import { combineLatest, map, shareReplay, BehaviorSubject, of, switchMap, startWith, distinctUntilChanged, skipWhile, filter, skip, throttleTime, first } from 'rxjs';
8
- import { SubscriptionObject, filterMaybe, asObservableFromGetter } from '@dereekb/rxjs';
9
- import { GeolocationService } from '@ng-web-apis/geolocation';
10
- import * as i1 from '@dereekb/dbx-web/mapbox';
11
- import { DbxMapboxInjectionStore, DbxMapboxMapStore, provideMapboxStoreIfParentIsUnavailable, DbxMapboxModule, DbxMapboxService, mapboxZoomLevel, MAPBOX_MIN_ZOOM_LEVEL, MAPBOX_MAX_ZOOM_LEVEL } from '@dereekb/dbx-web/mapbox';
12
- import * as i1$1 from '@angular/common';
13
- import { CommonModule } from '@angular/common';
14
- import * as i2 from '@angular/material/icon';
15
- import { MatIconModule } from '@angular/material/icon';
16
- import * as i3 from '@angular/material/button';
17
- import { MatButtonModule } from '@angular/material/button';
18
- import * as i3$1 from '@angular/forms';
19
- import { FormsModule, ReactiveFormsModule } from '@angular/forms';
20
- import * as i6 from '@angular/material/input';
21
- import { MatInputModule } from '@angular/material/input';
22
- import * as i7 from '@angular/material/form-field';
23
- import * as i8 from 'ngx-mapbox-gl';
24
- import { NgxMapboxGLModule } from 'ngx-mapbox-gl';
25
- import * as i1$2 from '@ngx-formly/core';
26
- import { FormlyModule } from '@ngx-formly/core';
27
-
28
- function mapboxLatLngField(config = {}) {
29
- const { key = 'latLng', latLngConfig, showMap, zoom, recenterTime, showCenterButton, setCenterOnLocationSet, selectLocationOnMapDrag, selectLocationOnMapClick, markerConfig } = config;
30
- const classGetter = 'dbx-mat-form-field-disable-underline';
31
- const fieldConfig = {
32
- ...formlyField({
33
- key,
34
- type: 'mapbox-latlng-picker',
35
- ...propsAndConfigForFieldConfig(config, {
36
- classGetter,
37
- label: config.label ?? 'Location',
38
- placeholder: DEFAULT_LAT_LNG_TEXT_FIELD_PLACEHOLDER,
39
- pattern: LAT_LNG_PATTERN,
40
- autocomplete: false,
41
- showMap,
42
- zoom,
43
- latLngConfig,
44
- recenterTime,
45
- selectLocationOnMapDrag,
46
- selectLocationOnMapClick,
47
- showCenterButton,
48
- setCenterOnLocationSet,
49
- markerConfig
50
- })
51
- }),
52
- ...validatorsForFieldConfig({
53
- messages: {
54
- pattern: DEFAULT_LAT_LNG_TEXT_FIELD_PATTERN_MESSAGE
55
- }
56
- })
57
- };
58
- return fieldConfig;
59
- }
60
-
61
- class DbxFormMapboxLatLngFieldMarkerComponent {
62
- fieldComponent = inject(DbxFormMapboxLatLngFieldComponent);
63
- marker$ = combineLatest([this.fieldComponent.latLng$, this.fieldComponent.markerConfig$]).pipe(map(([latLng, markerConfig]) => {
64
- if (markerConfig !== false) {
65
- return { latLng, ...markerConfig };
66
- }
67
- else {
68
- return undefined;
69
- }
70
- }), shareReplay(1));
71
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DbxFormMapboxLatLngFieldMarkerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
72
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DbxFormMapboxLatLngFieldMarkerComponent, selector: "ng-component", ngImport: i0, template: `
73
- <dbx-mapbox-marker [marker]="marker$ | async"></dbx-mapbox-marker>
74
- `, isInline: true, dependencies: [{ kind: "component", type: i1.DbxMapboxMarkerComponent, selector: "dbx-mapbox-marker", inputs: ["marker"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
75
- }
76
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DbxFormMapboxLatLngFieldMarkerComponent, decorators: [{
77
- type: Component,
78
- args: [{
79
- template: `
80
- <dbx-mapbox-marker [marker]="marker$ | async"></dbx-mapbox-marker>
81
- `,
82
- changeDetection: ChangeDetectionStrategy.OnPush
83
- }]
84
- }] });
85
-
86
- const DEFAULT_DBX_FORM_MAPBOX_LAT_LNG_FIELD_INJECTION_KEY = 'DbxFormMapboxLatLngFieldComponent';
87
- const DEFAULT_DBX_FORM_MAPBOX_LAT_LNG_MARKER_CONFIG = {
88
- icon: 'pin_drop'
89
- };
90
- /*
91
- TODO: Re-add menu for picking a new location, including using the current location.
92
- <button mat-icon-button (click)="useCurrentLocation()" [disabled]="isReadonlyOrDisabled || (useCurrentLocationDisabled$ | async)">
93
- <mat-icon>my_location</mat-icon>
94
- </button>
95
- */
96
- class DbxFormMapboxLatLngFieldComponent extends FieldType {
97
- _geolocationService = inject(GeolocationService);
98
- compact = inject(CompactContextStore, { optional: true });
99
- dbxMapboxInjectionStore = inject(DbxMapboxInjectionStore, { optional: true });
100
- dbxMapboxMapStore = inject(DbxMapboxMapStore);
101
- ngZone = inject(NgZone);
102
- injector = inject(Injector);
103
- _latLngStringFunction;
104
- _latLngPointFunction;
105
- compactClass$ = mapCompactModeObs(this.compact?.mode$, {
106
- compact: 'dbx-mapbox-input-field-compact'
107
- });
108
- _useCurrentLocationDisabled = new BehaviorSubject(false);
109
- useCurrentLocationDisabled$ = this._useCurrentLocationDisabled.asObservable();
110
- _sub = new SubscriptionObject();
111
- _geoSub = new SubscriptionObject();
112
- _centerSub = new SubscriptionObject();
113
- _flyToCenterSub = new SubscriptionObject();
114
- _clickSub = new SubscriptionObject();
115
- _zoom = new BehaviorSubject(12);
116
- _markerConfig = new BehaviorSubject(of(DEFAULT_DBX_FORM_MAPBOX_LAT_LNG_MARKER_CONFIG));
117
- _formControlObs = new BehaviorSubject(undefined);
118
- formControl$ = this._formControlObs.pipe(filterMaybe());
119
- value$ = this.formControl$.pipe(switchMap((control) => control.valueChanges.pipe(startWith(control.value))), shareReplay(1));
120
- latLng$ = this.value$.pipe(filterMaybe(), map((x) => this._latLngPointFunction(x)), distinctUntilChanged(isSameLatLngPoint), shareReplay(1));
121
- nonZeroLatLng$ = this.latLng$.pipe(
122
- /**
123
- * Center observable passed to the store. Do not pass invalid points.
124
- *
125
- * Also skip any initial 0,0 values so the center doesn't potentially "whip" from 0,0 to a final loaded value.
126
- */
127
- skipWhile(isDefaultLatLngPoint), filter(isValidLatLngPoint));
128
- zoom$ = this._zoom.asObservable();
129
- markerConfig$ = this._markerConfig.asObservable().pipe(switchMap((x) => x), shareReplay(1));
130
- get zoom() {
131
- return Math.min(this.field.props.zoom || 12, 18);
132
- }
133
- get formGroupName() {
134
- return this.field.key;
135
- }
136
- get formGroup() {
137
- return this.form;
138
- }
139
- get label() {
140
- return this.field.props?.label;
141
- }
142
- get description() {
143
- return this.props.description;
144
- }
145
- get isReadonlyOrDisabled() {
146
- return this.props.readonly || this.disabled;
147
- }
148
- get showMap() {
149
- return this.field.props.showMap ?? true;
150
- }
151
- get selectLocationOnMapDrag() {
152
- return this.field.props.selectLocationOnMapDrag ?? true;
153
- }
154
- get selectLocationOnMapClick() {
155
- return this.field.props.selectLocationOnMapClick ?? false;
156
- }
157
- get setCenterOnLocationSet() {
158
- return this.field.props.setCenterOnLocationSet ?? true;
159
- }
160
- get showCenterButton() {
161
- return !this.selectLocationOnMapDrag && this.props.showCenterButton !== false;
162
- }
163
- get recenterTime() {
164
- return this.field.props.recenterTime || 10 * 1000;
165
- }
166
- get useCurrentLocationDisabled() {
167
- return this._useCurrentLocationDisabled;
168
- }
169
- get mapInjectionKey() {
170
- return this.field.props.mapInjectionKey;
171
- }
172
- get markerConfig() {
173
- return this.field.props.markerConfig;
174
- }
175
- ngOnInit() {
176
- const latLngPointConfig = { ...this.field.props.latLngConfig, wrap: this.field.props.latLngConfig?.wrap || false, validate: this.field.props.latLngConfig?.validate || false, precisionRounding: this.field.props.latLngConfig?.precisionRounding ?? 'round' };
177
- this._latLngStringFunction = latLngStringFunction(latLngPointConfig);
178
- this._latLngPointFunction = latLngPointFunction(latLngPointConfig);
179
- this._formControlObs.next(this.formControl);
180
- this._zoom.next(this.zoom);
181
- if (this.setCenterOnLocationSet) {
182
- this._centerSub.subscription = this.dbxMapboxMapStore.setCenter(this.nonZeroLatLng$);
183
- }
184
- if (this.showMap) {
185
- // Set zoom only if showMap is true
186
- this.dbxMapboxMapStore.setZoom(this.zoom$);
187
- // recenter periodically
188
- if (this.recenterTime > 0) {
189
- this._flyToCenterSub.subscription = this.dbxMapboxMapStore.center$.pipe(skip(1), throttleTime(this.recenterTime, undefined, { leading: false, trailing: true })).subscribe(() => {
190
- this.flyToMarker();
191
- });
192
- }
193
- }
194
- else {
195
- // use the center of the map to set locations
196
- if (this.selectLocationOnMapDrag) {
197
- this._sub.subscription = this.dbxMapboxMapStore.center$.subscribe((center) => {
198
- this.dbxMapboxMapStore.centerGivenMargin$.pipe(first()).subscribe(() => {
199
- if (!this.isReadonlyOrDisabled) {
200
- this.ngZone.run(() => {
201
- this.setValue(center);
202
- });
203
- }
204
- });
205
- });
206
- }
207
- // enable selecting the location on a map click
208
- if (this.selectLocationOnMapClick) {
209
- this._clickSub.subscription = this.dbxMapboxMapStore.clickEvent$.subscribe((x) => {
210
- if (x?.type === 'click') {
211
- this.setValue(x.lngLat);
212
- }
213
- });
214
- }
215
- }
216
- if (this.props.readonly) {
217
- this.formControl.disable();
218
- }
219
- // Add the marker to the injection store for display
220
- if (this.dbxMapboxInjectionStore) {
221
- if (this.markerConfig != null) {
222
- this._markerConfig.next(this.markerConfig === false ? of(false) : asObservableFromGetter(this.markerConfig, this));
223
- }
224
- this.dbxMapboxInjectionStore.addInjectionConfig({
225
- key: this.mapInjectionKey || DEFAULT_DBX_FORM_MAPBOX_LAT_LNG_FIELD_INJECTION_KEY,
226
- injectionConfig: {
227
- componentClass: DbxFormMapboxLatLngFieldMarkerComponent,
228
- providers: [{ provide: DbxFormMapboxLatLngFieldComponent, useValue: this }]
229
- }
230
- });
231
- }
232
- }
233
- ngOnDestroy() {
234
- super.ngOnDestroy();
235
- this._zoom.complete();
236
- this._markerConfig.complete();
237
- this._formControlObs.complete();
238
- this._sub.destroy();
239
- this._geoSub.destroy();
240
- this._centerSub.destroy();
241
- this._flyToCenterSub.destroy();
242
- this._clickSub.destroy();
243
- }
244
- flyToMarker() {
245
- this.dbxMapboxMapStore.easeTo(this.nonZeroLatLng$.pipe(first(), map((x) => ({ center: x }))));
246
- }
247
- useCurrentLocation() {
248
- this._geoSub.subscription = this._geolocationService.pipe(first()).subscribe({
249
- next: (position) => {
250
- if (position) {
251
- const { latitude: lat, longitude: lng } = position.coords;
252
- this.setValue({ lat, lng });
253
- }
254
- },
255
- error: () => {
256
- this._useCurrentLocationDisabled.next(true);
257
- }
258
- });
259
- }
260
- onMarkerDragEnd(marker) {
261
- this.setValue(marker.getLngLat());
262
- }
263
- setValue(latLng) {
264
- this.formControl.setValue(latLng ? this._latLngStringFunction(latLng) : latLng);
265
- this.formControl.markAsTouched();
266
- this.formControl.markAsDirty();
267
- }
268
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DbxFormMapboxLatLngFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
269
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DbxFormMapboxLatLngFieldComponent, selector: "ng-component", providers: [provideMapboxStoreIfParentIsUnavailable()], usesInheritance: true, ngImport: i0, template: `
270
- <div class="dbx-mapbox-input-field" [ngClass]="(compactClass$ | async) ?? ''" [formGroup]="formGroup">
271
- <div *ngIf="showMap" class="dbx-mapbox-input-field-map">
272
- <mgl-map dbxMapboxMap>
273
- <mgl-marker [lngLat]="(latLng$ | async) || [0, 0]" [draggable]="!isReadonlyOrDisabled" (markerDragEnd)="onMarkerDragEnd($event)"></mgl-marker>
274
- </mgl-map>
275
- </div>
276
- <div class="dbx-mapbox-input-field-input">
277
- <button *ngIf="showCenterButton" mat-icon-button (click)="flyToMarker()">
278
- <mat-icon>my_location</mat-icon>
279
- </button>
280
- <mat-form-field class="dbx-mapbox-input-field-input-field">
281
- <mat-label>Coordinates</mat-label>
282
- <input type="text" matInput [placeholder]="placeholder" [formControl]="formControl" />
283
- <mat-hint class="dbx-hint dbx-warn" *ngIf="useCurrentLocationDisabled$ | async">Could not access your current location.</mat-hint>
284
- </mat-form-field>
285
- </div>
286
- </div>
287
- `, isInline: true, styles: [".dbx-mapbox-input-field .dbx-mapbox-input-field-map{height:220px;width:100%}.dbx-mapbox-input-field .dbx-mapbox-input-field-map mgl-map{height:100%;width:100%}.dbx-mapbox-input-field .dbx-mapbox-input-field-input{display:flex;align-items:center}.dbx-mapbox-input-field .dbx-mapbox-input-field-input .dbx-mapbox-input-field-input-field{width:calc(100% - 40px)}.dbx-mapbox-input-field-compact .dbx-latlng-field-input{min-height:120px;height:300px;max-height:calc(var(--vh100) * .5)}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i1.DbxMapboxMapDirective, selector: "[dbxMapboxMap]" }, { kind: "directive", type: i3$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]" }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", 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"] }, { kind: "component", type: i7.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i7.MatLabel, selector: "mat-label" }, { kind: "directive", type: i7.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "component", type: i8.MapComponent, selector: "mgl-map", inputs: ["accessToken", "collectResourceTiming", "crossSourceCollisions", "customMapboxApiUrl", "fadeDuration", "hash", "refreshExpiredTiles", "failIfMajorPerformanceCaveat", "bearingSnap", "interactive", "pitchWithRotate", "clickTolerance", "attributionControl", "logoPosition", "maxTileCacheSize", "localIdeographFontFamily", "preserveDrawingBuffer", "trackResize", "transformRequest", "bounds", "antialias", "locale", "cooperativeGestures", "minZoom", "maxZoom", "minPitch", "maxPitch", "scrollZoom", "dragRotate", "touchPitch", "touchZoomRotate", "doubleClickZoom", "keyboard", "dragPan", "boxZoom", "style", "center", "maxBounds", "zoom", "bearing", "pitch", "fitBoundsOptions", "renderWorldCopies", "projection", "movingMethod", "movingOptions", "fitBounds", "fitScreenCoordinates", "centerWithPanTo", "panToOptions", "cursorStyle"], outputs: ["mapResize", "mapRemove", "mapMouseDown", "mapMouseUp", "mapMouseMove", "mapClick", "mapDblClick", "mapMouseOver", "mapMouseOut", "mapContextMenu", "mapTouchStart", "mapTouchEnd", "mapTouchMove", "mapTouchCancel", "mapWheel", "moveStart", "move", "moveEnd", "mapDragStart", "mapDrag", "mapDragEnd", "zoomStart", "zoomEvt", "zoomEnd", "rotateStart", "rotate", "rotateEnd", "pitchStart", "pitchEvt", "pitchEnd", "boxZoomStart", "boxZoomEnd", "boxZoomCancel", "webGlContextLost", "webGlContextRestored", "mapLoad", "mapCreate", "idle", "render", "mapError", "data", "styleData", "sourceData", "dataLoading", "styleDataLoading", "sourceDataLoading", "styleImageMissing", "resize", "remove", "mouseDown", "mouseUp", "mouseMove", "click", "dblClick", "mouseOver", "mouseOut", "contextMenu", "touchStart", "touchEnd", "touchMove", "touchCancel", "wheel", "dragStart", "drag", "dragEnd", "load", "error"] }, { kind: "component", type: i8.MarkerComponent, selector: "mgl-marker", inputs: ["offset", "anchor", "clickTolerance", "feature", "lngLat", "draggable", "popupShown", "className", "pitchAlignment", "rotationAlignment"], outputs: ["markerDragStart", "markerDragEnd", "markerDrag", "dragStart", "dragEnd", "drag"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }] });
288
- }
289
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DbxFormMapboxLatLngFieldComponent, decorators: [{
290
- type: Component,
291
- args: [{ template: `
292
- <div class="dbx-mapbox-input-field" [ngClass]="(compactClass$ | async) ?? ''" [formGroup]="formGroup">
293
- <div *ngIf="showMap" class="dbx-mapbox-input-field-map">
294
- <mgl-map dbxMapboxMap>
295
- <mgl-marker [lngLat]="(latLng$ | async) || [0, 0]" [draggable]="!isReadonlyOrDisabled" (markerDragEnd)="onMarkerDragEnd($event)"></mgl-marker>
296
- </mgl-map>
297
- </div>
298
- <div class="dbx-mapbox-input-field-input">
299
- <button *ngIf="showCenterButton" mat-icon-button (click)="flyToMarker()">
300
- <mat-icon>my_location</mat-icon>
301
- </button>
302
- <mat-form-field class="dbx-mapbox-input-field-input-field">
303
- <mat-label>Coordinates</mat-label>
304
- <input type="text" matInput [placeholder]="placeholder" [formControl]="formControl" />
305
- <mat-hint class="dbx-hint dbx-warn" *ngIf="useCurrentLocationDisabled$ | async">Could not access your current location.</mat-hint>
306
- </mat-form-field>
307
- </div>
308
- </div>
309
- `, providers: [provideMapboxStoreIfParentIsUnavailable()], styles: [".dbx-mapbox-input-field .dbx-mapbox-input-field-map{height:220px;width:100%}.dbx-mapbox-input-field .dbx-mapbox-input-field-map mgl-map{height:100%;width:100%}.dbx-mapbox-input-field .dbx-mapbox-input-field-input{display:flex;align-items:center}.dbx-mapbox-input-field .dbx-mapbox-input-field-input .dbx-mapbox-input-field-input-field{width:calc(100% - 40px)}.dbx-mapbox-input-field-compact .dbx-latlng-field-input{min-height:120px;height:300px;max-height:calc(var(--vh100) * .5)}\n"] }]
310
- }] });
311
-
312
- class DbxFormMapboxLatLngModule {
313
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DbxFormMapboxLatLngModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
314
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: DbxFormMapboxLatLngModule, declarations: [DbxFormMapboxLatLngFieldComponent, DbxFormMapboxLatLngFieldMarkerComponent], imports: [CommonModule,
315
- MatIconModule,
316
- MatButtonModule,
317
- DbxTextModule,
318
- DbxMapboxModule,
319
- FormsModule,
320
- ReactiveFormsModule,
321
- MatInputModule, i1$2.FormlyModule, NgxMapboxGLModule], exports: [DbxFormMapboxLatLngFieldMarkerComponent] });
322
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DbxFormMapboxLatLngModule, imports: [CommonModule,
323
- MatIconModule,
324
- MatButtonModule,
325
- DbxTextModule,
326
- DbxMapboxModule,
327
- FormsModule,
328
- ReactiveFormsModule,
329
- MatInputModule,
330
- FormlyModule.forChild({
331
- types: [{ name: 'mapbox-latlng-picker', component: DbxFormMapboxLatLngFieldComponent, wrappers: ['style', 'form-field'] }]
332
- }),
333
- NgxMapboxGLModule] });
334
- }
335
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DbxFormMapboxLatLngModule, decorators: [{
336
- type: NgModule,
337
- args: [{
338
- imports: [
339
- CommonModule,
340
- MatIconModule,
341
- MatButtonModule,
342
- DbxTextModule,
343
- DbxMapboxModule,
344
- FormsModule,
345
- ReactiveFormsModule,
346
- MatInputModule,
347
- FormlyModule.forChild({
348
- types: [{ name: 'mapbox-latlng-picker', component: DbxFormMapboxLatLngFieldComponent, wrappers: ['style', 'form-field'] }]
349
- }),
350
- NgxMapboxGLModule
351
- ],
352
- declarations: [DbxFormMapboxLatLngFieldComponent, DbxFormMapboxLatLngFieldMarkerComponent],
353
- exports: [DbxFormMapboxLatLngFieldMarkerComponent]
354
- }]
355
- }] });
356
-
357
- function mapboxZoomField(config = {}) {
358
- const { key = 'zoom', showMap, center, minZoom, maxZoom, zoomStep } = config;
359
- const classGetter = 'dbx-mat-form-field-disable-underline';
360
- const fieldConfig = {
361
- ...formlyField({
362
- key,
363
- type: 'mapbox-zoom-picker',
364
- ...propsAndConfigForFieldConfig(config, {
365
- classGetter,
366
- label: config.label ?? 'Zoom',
367
- autocomplete: false,
368
- showMap,
369
- center,
370
- minZoom,
371
- maxZoom,
372
- zoomStep
373
- })
374
- })
375
- };
376
- return fieldConfig;
377
- }
378
-
379
- class DbxFormMapboxZoomFieldComponent extends FieldType {
380
- compact = inject(CompactContextStore, { optional: true });
381
- dbxMapboxService = inject(DbxMapboxService);
382
- dbxMapboxMapStore = inject(DbxMapboxMapStore);
383
- ngZone = inject(NgZone);
384
- _undoZoomLimit = false;
385
- compactClass$ = mapCompactModeObs(this.compact?.mode$, {
386
- compact: 'dbx-mapbox-input-field-compact'
387
- });
388
- _sub = new SubscriptionObject();
389
- _center = new BehaviorSubject(undefined);
390
- _formControlObs = new BehaviorSubject(undefined);
391
- formControl$ = this._formControlObs.pipe(filterMaybe());
392
- value$ = this.formControl$.pipe(switchMap((control) => control.valueChanges.pipe(startWith(control.value))), shareReplay(1));
393
- zoom$ = this.value$.pipe(filterMaybe(), shareReplay(1));
394
- center$ = this._center.pipe(filterMaybe());
395
- get center() {
396
- return this.field.props.center || latLngPoint(this.dbxMapboxService.defaultCenter);
397
- }
398
- get formGroupName() {
399
- return this.field.key;
400
- }
401
- get formGroup() {
402
- return this.form;
403
- }
404
- get label() {
405
- return this.field.props?.label;
406
- }
407
- get description() {
408
- return this.props.description;
409
- }
410
- get isReadonlyOrDisabled() {
411
- return this.props.readonly || this.disabled;
412
- }
413
- get showMap() {
414
- return this.field.props.showMap ?? true;
415
- }
416
- get lockMapToZoomLevels() {
417
- return this.field.props.lockMapToZoomLevels ?? false;
418
- }
419
- get minZoom() {
420
- return mapboxZoomLevel(this.field.props.minZoom || MAPBOX_MIN_ZOOM_LEVEL);
421
- }
422
- get maxZoom() {
423
- return mapboxZoomLevel(this.field.props.maxZoom || MAPBOX_MAX_ZOOM_LEVEL);
424
- }
425
- get zoomStep() {
426
- return mapboxZoomLevel(this.field.props.zoomStep || 1);
427
- }
428
- ngOnInit() {
429
- this._formControlObs.next(this.formControl);
430
- this._center.next(this.center);
431
- // set/sync props for error messages
432
- this.props.min = this.minZoom;
433
- this.props.max = this.maxZoom;
434
- this.dbxMapboxMapStore.setZoom(this.zoom$);
435
- // Set center only if showMap is false.
436
- if (this.showMap) {
437
- this.dbxMapboxMapStore.setCenter(this.center$);
438
- }
439
- if (this.props.readonly) {
440
- this.formControl.disable();
441
- if (this.showMap) {
442
- this.dbxMapboxMapStore.setZoomDisabled();
443
- }
444
- }
445
- else if (this.lockMapToZoomLevels) {
446
- // set zoom limits on the map
447
- this.dbxMapboxMapStore.setZoomRange({ min: this.minZoom, max: this.maxZoom });
448
- // flat to undo them later if not using the same map
449
- this._undoZoomLimit = !this.showMap;
450
- }
451
- this._sub.subscription = this.dbxMapboxMapStore.zoom$.subscribe((zoom) => {
452
- if (!this.isReadonlyOrDisabled) {
453
- this.ngZone.run(() => {
454
- this.setValue(zoom);
455
- });
456
- }
457
- });
458
- }
459
- ngOnDestroy() {
460
- super.ngOnDestroy();
461
- this._formControlObs.complete();
462
- this._center.complete();
463
- this._sub.destroy();
464
- if (!this._undoZoomLimit) {
465
- this.dbxMapboxMapStore.setZoomRange({});
466
- }
467
- }
468
- setValue(zoom) {
469
- this.formControl.setValue(zoom);
470
- this.formControl.markAsTouched();
471
- this.formControl.markAsDirty();
472
- }
473
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DbxFormMapboxZoomFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
474
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DbxFormMapboxZoomFieldComponent, selector: "ng-component", providers: [provideMapboxStoreIfParentIsUnavailable()], usesInheritance: true, ngImport: i0, template: `
475
- <div class="dbx-mapbox-input-field" [ngClass]="(compactClass$ | async) ?? ''" [formGroup]="formGroup">
476
- <div *ngIf="showMap" class="dbx-mapbox-input-field-map">
477
- <mgl-map dbxMapboxMap></mgl-map>
478
- </div>
479
- <div class="dbx-mapbox-input-field-input">
480
- <mat-form-field class="dbx-mapbox-input-field-input-field">
481
- <mat-label>Zoom Level</mat-label>
482
- <input type="number" matInput [min]="minZoom" [max]="maxZoom" [step]="zoomStep" [placeholder]="placeholder" [formControl]="formControl" />
483
- </mat-form-field>
484
- </div>
485
- </div>
486
- `, isInline: true, styles: [".dbx-mapbox-input-field .dbx-mapbox-input-field-map{height:220px;width:100%}.dbx-mapbox-input-field .dbx-mapbox-input-field-map mgl-map{height:100%;width:100%}.dbx-mapbox-input-field .dbx-mapbox-input-field-input{display:flex;align-items:center}.dbx-mapbox-input-field .dbx-mapbox-input-field-input .dbx-mapbox-input-field-input-field{width:calc(100% - 40px)}.dbx-mapbox-input-field-compact .dbx-latlng-field-input{min-height:120px;height:300px;max-height:calc(var(--vh100) * .5)}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.DbxMapboxMapDirective, selector: "[dbxMapboxMap]" }, { kind: "directive", type: i3$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]" }, { kind: "directive", type: i3$1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3$1.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i3$1.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i3$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", 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"] }, { kind: "component", type: i7.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i7.MatLabel, selector: "mat-label" }, { kind: "component", type: i8.MapComponent, selector: "mgl-map", inputs: ["accessToken", "collectResourceTiming", "crossSourceCollisions", "customMapboxApiUrl", "fadeDuration", "hash", "refreshExpiredTiles", "failIfMajorPerformanceCaveat", "bearingSnap", "interactive", "pitchWithRotate", "clickTolerance", "attributionControl", "logoPosition", "maxTileCacheSize", "localIdeographFontFamily", "preserveDrawingBuffer", "trackResize", "transformRequest", "bounds", "antialias", "locale", "cooperativeGestures", "minZoom", "maxZoom", "minPitch", "maxPitch", "scrollZoom", "dragRotate", "touchPitch", "touchZoomRotate", "doubleClickZoom", "keyboard", "dragPan", "boxZoom", "style", "center", "maxBounds", "zoom", "bearing", "pitch", "fitBoundsOptions", "renderWorldCopies", "projection", "movingMethod", "movingOptions", "fitBounds", "fitScreenCoordinates", "centerWithPanTo", "panToOptions", "cursorStyle"], outputs: ["mapResize", "mapRemove", "mapMouseDown", "mapMouseUp", "mapMouseMove", "mapClick", "mapDblClick", "mapMouseOver", "mapMouseOut", "mapContextMenu", "mapTouchStart", "mapTouchEnd", "mapTouchMove", "mapTouchCancel", "mapWheel", "moveStart", "move", "moveEnd", "mapDragStart", "mapDrag", "mapDragEnd", "zoomStart", "zoomEvt", "zoomEnd", "rotateStart", "rotate", "rotateEnd", "pitchStart", "pitchEvt", "pitchEnd", "boxZoomStart", "boxZoomEnd", "boxZoomCancel", "webGlContextLost", "webGlContextRestored", "mapLoad", "mapCreate", "idle", "render", "mapError", "data", "styleData", "sourceData", "dataLoading", "styleDataLoading", "sourceDataLoading", "styleImageMissing", "resize", "remove", "mouseDown", "mouseUp", "mouseMove", "click", "dblClick", "mouseOver", "mouseOut", "contextMenu", "touchStart", "touchEnd", "touchMove", "touchCancel", "wheel", "dragStart", "drag", "dragEnd", "load", "error"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }] });
487
- }
488
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DbxFormMapboxZoomFieldComponent, decorators: [{
489
- type: Component,
490
- args: [{ template: `
491
- <div class="dbx-mapbox-input-field" [ngClass]="(compactClass$ | async) ?? ''" [formGroup]="formGroup">
492
- <div *ngIf="showMap" class="dbx-mapbox-input-field-map">
493
- <mgl-map dbxMapboxMap></mgl-map>
494
- </div>
495
- <div class="dbx-mapbox-input-field-input">
496
- <mat-form-field class="dbx-mapbox-input-field-input-field">
497
- <mat-label>Zoom Level</mat-label>
498
- <input type="number" matInput [min]="minZoom" [max]="maxZoom" [step]="zoomStep" [placeholder]="placeholder" [formControl]="formControl" />
499
- </mat-form-field>
500
- </div>
501
- </div>
502
- `, providers: [provideMapboxStoreIfParentIsUnavailable()], styles: [".dbx-mapbox-input-field .dbx-mapbox-input-field-map{height:220px;width:100%}.dbx-mapbox-input-field .dbx-mapbox-input-field-map mgl-map{height:100%;width:100%}.dbx-mapbox-input-field .dbx-mapbox-input-field-input{display:flex;align-items:center}.dbx-mapbox-input-field .dbx-mapbox-input-field-input .dbx-mapbox-input-field-input-field{width:calc(100% - 40px)}.dbx-mapbox-input-field-compact .dbx-latlng-field-input{min-height:120px;height:300px;max-height:calc(var(--vh100) * .5)}\n"] }]
503
- }] });
504
-
505
- class DbxFormMapboxZoomModule {
506
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DbxFormMapboxZoomModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
507
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: DbxFormMapboxZoomModule, declarations: [DbxFormMapboxZoomFieldComponent], imports: [CommonModule,
508
- MatIconModule,
509
- MatButtonModule,
510
- DbxTextModule,
511
- DbxMapboxModule,
512
- FormsModule,
513
- ReactiveFormsModule,
514
- MatInputModule, i1$2.FormlyModule, NgxMapboxGLModule] });
515
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DbxFormMapboxZoomModule, imports: [CommonModule,
516
- MatIconModule,
517
- MatButtonModule,
518
- DbxTextModule,
519
- DbxMapboxModule,
520
- FormsModule,
521
- ReactiveFormsModule,
522
- MatInputModule,
523
- FormlyModule.forChild({
524
- types: [{ name: 'mapbox-zoom-picker', component: DbxFormMapboxZoomFieldComponent, wrappers: ['style', 'form-field'] }]
525
- }),
526
- NgxMapboxGLModule] });
527
- }
528
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DbxFormMapboxZoomModule, decorators: [{
529
- type: NgModule,
530
- args: [{
531
- imports: [
532
- CommonModule,
533
- MatIconModule,
534
- MatButtonModule,
535
- DbxTextModule,
536
- DbxMapboxModule,
537
- FormsModule,
538
- ReactiveFormsModule,
539
- MatInputModule,
540
- FormlyModule.forChild({
541
- types: [{ name: 'mapbox-zoom-picker', component: DbxFormMapboxZoomFieldComponent, wrappers: ['style', 'form-field'] }]
542
- }),
543
- NgxMapboxGLModule
544
- ],
545
- declarations: [DbxFormMapboxZoomFieldComponent]
546
- }]
547
- }] });
548
-
549
- class DbxFormMapboxModule {
550
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DbxFormMapboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
551
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: DbxFormMapboxModule, exports: [DbxFormMapboxLatLngModule, DbxFormMapboxZoomModule] });
552
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DbxFormMapboxModule, imports: [DbxFormMapboxLatLngModule, DbxFormMapboxZoomModule] });
553
- }
554
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DbxFormMapboxModule, decorators: [{
555
- type: NgModule,
556
- args: [{
557
- exports: [DbxFormMapboxLatLngModule, DbxFormMapboxZoomModule]
558
- }]
559
- }] });
560
-
561
- /**
562
- * Generated bundle index. Do not edit.
563
- */
564
-
565
- export { DEFAULT_DBX_FORM_MAPBOX_LAT_LNG_FIELD_INJECTION_KEY, DEFAULT_DBX_FORM_MAPBOX_LAT_LNG_MARKER_CONFIG, DbxFormMapboxLatLngFieldComponent, DbxFormMapboxLatLngFieldMarkerComponent, DbxFormMapboxLatLngModule, DbxFormMapboxModule, DbxFormMapboxZoomFieldComponent, DbxFormMapboxZoomModule, mapboxLatLngField, mapboxZoomField };
566
- //# sourceMappingURL=dereekb-dbx-form-mapbox.mjs.map