geonetwork-ui 2.3.0-dev.3d65a13b → 2.3.0-dev.3efe236f

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 (328) hide show
  1. package/esm2022/index.mjs +2 -1
  2. package/esm2022/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.mjs +6 -2
  3. package/esm2022/libs/api/repository/src/lib/gn4/auth/avatar.service.interface.mjs +1 -1
  4. package/esm2022/libs/api/repository/src/lib/gn4/auth/gravatar.service.mjs +12 -1
  5. package/esm2022/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.mjs +36 -3
  6. package/esm2022/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.mjs +19 -7
  7. package/esm2022/libs/common/domain/src/lib/model/record/index.mjs +2 -1
  8. package/esm2022/libs/common/domain/src/lib/model/record/user-feedbacks.model.mjs +2 -0
  9. package/esm2022/libs/common/domain/src/lib/model/user/index.mjs +2 -0
  10. package/esm2022/libs/common/domain/src/lib/platform.service.interface.mjs +1 -1
  11. package/esm2022/libs/data-access/gn4/src/openapi/api/records.api.service.mjs +35 -7
  12. package/esm2022/libs/data-access/gn4/src/openapi/model/models.mjs +1 -2
  13. package/esm2022/libs/feature/editor/src/index.mjs +2 -2
  14. package/esm2022/libs/feature/editor/src/lib/+state/editor.facade.mjs +6 -2
  15. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-array/form-field-array.component.mjs +11 -0
  16. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-file/form-field-file.component.mjs +28 -0
  17. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-object/form-field-object.component.mjs +11 -0
  18. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.mjs +45 -0
  19. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-simple/form-field-simple.component.mjs +50 -0
  20. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.mjs +11 -0
  21. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-temporal-extent/form-field-temporal-extent.component.mjs +11 -0
  22. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.mjs +107 -0
  23. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field.model.mjs +2 -0
  24. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/index.mjs +10 -0
  25. package/esm2022/libs/feature/editor/src/lib/components/record-form/record-form.component.mjs +29 -0
  26. package/esm2022/libs/feature/editor/src/lib/components/wizard-field/wizard-field.component.mjs +1 -1
  27. package/esm2022/libs/feature/editor/src/lib/feature-editor.module.mjs +10 -10
  28. package/esm2022/libs/feature/editor/src/lib/models/fields.model.mjs +1 -1
  29. package/esm2022/libs/feature/map/src/lib/add-layer-from-file/add-layer-from-file.component.mjs +3 -3
  30. package/esm2022/libs/feature/map/src/lib/add-layer-from-ogc-api/add-layer-from-ogc-api.component.mjs +1 -1
  31. package/esm2022/libs/feature/map/src/lib/add-layer-from-wfs/add-layer-from-wfs.component.mjs +1 -1
  32. package/esm2022/libs/feature/map/src/lib/add-layer-from-wms/add-layer-from-wms.component.mjs +1 -1
  33. package/esm2022/libs/feature/notifications/src/index.mjs +4 -0
  34. package/esm2022/libs/feature/notifications/src/lib/feature-notifications.module.mjs +18 -0
  35. package/esm2022/libs/feature/notifications/src/lib/notification.model.mjs +2 -0
  36. package/esm2022/libs/feature/notifications/src/lib/notifications-container/notifications-container.component.mjs +49 -0
  37. package/esm2022/libs/feature/notifications/src/lib/notifications.service.mjs +29 -0
  38. package/esm2022/libs/feature/record/src/lib/feature-record.module.mjs +4 -4
  39. package/esm2022/libs/feature/record/src/lib/state/mdview.actions.mjs +22 -4
  40. package/esm2022/libs/feature/record/src/lib/state/mdview.effects.mjs +37 -10
  41. package/esm2022/libs/feature/record/src/lib/state/mdview.facade.mjs +22 -7
  42. package/esm2022/libs/feature/record/src/lib/state/mdview.reducer.mjs +52 -17
  43. package/esm2022/libs/feature/record/src/lib/state/mdview.selectors.mjs +18 -3
  44. package/esm2022/libs/feature/router/src/lib/default/state/router.effects.mjs +2 -2
  45. package/esm2022/libs/feature/search/src/lib/results-table/results-table.component.mjs +3 -3
  46. package/esm2022/libs/ui/catalog/src/lib/organisation-preview/organisation-preview.component.mjs +3 -3
  47. package/esm2022/libs/ui/elements/src/index.mjs +15 -15
  48. package/esm2022/libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.mjs +5 -5
  49. package/esm2022/libs/ui/elements/src/lib/markdown-editor/markdown-editor.component.mjs +45 -0
  50. package/esm2022/libs/ui/elements/src/lib/metadata-info/metadata-info.component.mjs +3 -3
  51. package/esm2022/libs/ui/elements/src/lib/notification/notification.component.mjs +34 -0
  52. package/esm2022/libs/ui/elements/src/lib/record-api-form/record-api-form.component.mjs +3 -3
  53. package/esm2022/libs/ui/elements/src/lib/thumbnail/thumbnail.component.mjs +4 -3
  54. package/esm2022/libs/ui/elements/src/lib/ui-elements.module.mjs +14 -5
  55. package/esm2022/libs/ui/elements/src/lib/user-feedback-item/time-since.pipe.mjs +59 -0
  56. package/esm2022/libs/ui/elements/src/lib/user-feedback-item/user-feedback-item.component.mjs +62 -0
  57. package/esm2022/libs/ui/inputs/src/index.mjs +1 -2
  58. package/esm2022/libs/ui/inputs/src/lib/button/button.component.mjs +2 -1
  59. package/esm2022/libs/ui/inputs/src/lib/files-drop/files-drop.directive.mjs +59 -0
  60. package/esm2022/libs/ui/inputs/src/lib/image-input/image-input.component.mjs +183 -0
  61. package/esm2022/libs/ui/inputs/src/lib/text-area/text-area.component.mjs +27 -4
  62. package/esm2022/libs/ui/inputs/src/lib/text-input/text-input.component.mjs +19 -3
  63. package/esm2022/libs/ui/inputs/src/lib/ui-inputs.module.mjs +10 -23
  64. package/esm2022/libs/ui/layout/src/index.mjs +6 -5
  65. package/esm2022/libs/ui/layout/src/lib/form-field-wrapper/form-field-wrapper.component.mjs +18 -0
  66. package/esm2022/libs/util/shared/src/lib/utils/bytes-convert.mjs +4 -0
  67. package/esm2022/libs/util/shared/src/lib/utils/image-resize.mjs +60 -0
  68. package/esm2022/libs/util/shared/src/lib/utils/index.mjs +8 -6
  69. package/esm2022/translations/de.json +33 -0
  70. package/esm2022/translations/en.json +33 -0
  71. package/esm2022/translations/es.json +33 -0
  72. package/esm2022/translations/fr.json +33 -0
  73. package/esm2022/translations/it.json +33 -0
  74. package/esm2022/translations/nl.json +33 -0
  75. package/esm2022/translations/pt.json +33 -0
  76. package/fesm2022/geonetwork-ui.mjs +2168 -1119
  77. package/fesm2022/geonetwork-ui.mjs.map +1 -1
  78. package/index.d.ts +1 -0
  79. package/index.d.ts.map +1 -1
  80. package/index.ts +1 -0
  81. package/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.d.ts.map +1 -1
  82. package/libs/api/repository/src/lib/gn4/auth/avatar.service.interface.d.ts +1 -0
  83. package/libs/api/repository/src/lib/gn4/auth/avatar.service.interface.d.ts.map +1 -1
  84. package/libs/api/repository/src/lib/gn4/auth/gravatar.service.d.ts +1 -0
  85. package/libs/api/repository/src/lib/gn4/auth/gravatar.service.d.ts.map +1 -1
  86. package/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.d.ts +6 -2
  87. package/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.d.ts.map +1 -1
  88. package/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.d.ts +9 -6
  89. package/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.d.ts.map +1 -1
  90. package/libs/common/domain/src/lib/model/record/index.d.ts +1 -0
  91. package/libs/common/domain/src/lib/model/record/index.d.ts.map +1 -1
  92. package/libs/common/domain/src/lib/model/record/user-feedbacks.model.d.ts +15 -0
  93. package/libs/common/domain/src/lib/model/record/user-feedbacks.model.d.ts.map +1 -0
  94. package/libs/common/domain/src/lib/model/user/index.d.ts +2 -0
  95. package/libs/common/domain/src/lib/model/user/index.d.ts.map +1 -0
  96. package/libs/common/domain/src/lib/platform.service.interface.d.ts +3 -0
  97. package/libs/common/domain/src/lib/platform.service.interface.d.ts.map +1 -1
  98. package/libs/data-access/gn4/src/openapi/api/records.api.service.d.ts +9 -5
  99. package/libs/data-access/gn4/src/openapi/api/records.api.service.d.ts.map +1 -1
  100. package/libs/data-access/gn4/src/openapi/model/models.d.ts +0 -1
  101. package/libs/data-access/gn4/src/openapi/model/models.d.ts.map +1 -1
  102. package/libs/feature/editor/src/index.d.ts +1 -1
  103. package/libs/feature/editor/src/index.d.ts.map +1 -1
  104. package/libs/feature/editor/src/lib/+state/editor.facade.d.ts +8 -5
  105. package/libs/feature/editor/src/lib/+state/editor.facade.d.ts.map +1 -1
  106. package/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-array/form-field-array.component.d.ts +1 -1
  107. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-array/form-field-array.component.d.ts.map +1 -0
  108. package/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-file/form-field-file.component.d.ts +1 -1
  109. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-file/form-field-file.component.d.ts.map +1 -0
  110. package/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-object/form-field-object.component.d.ts +1 -1
  111. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-object/form-field-object.component.d.ts.map +1 -0
  112. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.d.ts +16 -0
  113. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.d.ts.map +1 -0
  114. package/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-simple/form-field-simple.component.d.ts +2 -2
  115. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-simple/form-field-simple.component.d.ts.map +1 -0
  116. package/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-spatial-extent/form-field-spatial-extent.component.d.ts +1 -1
  117. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.d.ts.map +1 -0
  118. package/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-temporal-extent/form-field-temporal-extent.component.d.ts +1 -1
  119. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-temporal-extent/form-field-temporal-extent.component.d.ts.map +1 -0
  120. package/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field.component.d.ts +9 -4
  121. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.d.ts.map +1 -0
  122. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field.model.d.ts.map +1 -0
  123. package/libs/feature/editor/src/lib/components/record-form/form-field/index.d.ts.map +1 -0
  124. package/libs/feature/editor/src/lib/{record-form → components/record-form}/record-form.component.d.ts +3 -3
  125. package/libs/feature/editor/src/lib/components/record-form/record-form.component.d.ts.map +1 -0
  126. package/libs/feature/editor/src/lib/feature-editor.module.d.ts +1 -1
  127. package/libs/feature/editor/src/lib/feature-editor.module.d.ts.map +1 -1
  128. package/libs/feature/editor/src/lib/models/fields.model.d.ts +1 -1
  129. package/libs/feature/notifications/src/index.d.ts +4 -0
  130. package/libs/feature/notifications/src/index.d.ts.map +1 -0
  131. package/libs/feature/notifications/src/lib/feature-notifications.module.d.ts +7 -0
  132. package/libs/feature/notifications/src/lib/feature-notifications.module.d.ts.map +1 -0
  133. package/libs/feature/notifications/src/lib/notification.model.d.ts +7 -0
  134. package/libs/feature/notifications/src/lib/notification.model.d.ts.map +1 -0
  135. package/libs/feature/notifications/src/lib/notifications-container/notifications-container.component.d.ts +12 -0
  136. package/libs/feature/notifications/src/lib/notifications-container/notifications-container.component.d.ts.map +1 -0
  137. package/libs/feature/notifications/src/lib/notifications.service.d.ts +15 -0
  138. package/libs/feature/notifications/src/lib/notifications.service.d.ts.map +1 -0
  139. package/libs/feature/record/src/lib/feature-record.module.d.ts.map +1 -1
  140. package/libs/feature/record/src/lib/state/mdview.actions.d.ts +40 -6
  141. package/libs/feature/record/src/lib/state/mdview.actions.d.ts.map +1 -1
  142. package/libs/feature/record/src/lib/state/mdview.effects.d.ts +24 -4
  143. package/libs/feature/record/src/lib/state/mdview.effects.d.ts.map +1 -1
  144. package/libs/feature/record/src/lib/state/mdview.facade.d.ts +14 -4
  145. package/libs/feature/record/src/lib/state/mdview.facade.d.ts.map +1 -1
  146. package/libs/feature/record/src/lib/state/mdview.reducer.d.ts +8 -5
  147. package/libs/feature/record/src/lib/state/mdview.reducer.d.ts.map +1 -1
  148. package/libs/feature/record/src/lib/state/mdview.selectors.d.ts +12 -9
  149. package/libs/feature/record/src/lib/state/mdview.selectors.d.ts.map +1 -1
  150. package/libs/ui/elements/src/index.d.ts +14 -14
  151. package/libs/ui/elements/src/index.d.ts.map +1 -1
  152. package/libs/ui/elements/src/lib/markdown-editor/markdown-editor.component.d.ts +13 -0
  153. package/libs/ui/elements/src/lib/markdown-editor/markdown-editor.component.d.ts.map +1 -0
  154. package/libs/ui/elements/src/lib/notification/notification.component.d.ts +13 -0
  155. package/libs/ui/elements/src/lib/notification/notification.component.d.ts.map +1 -0
  156. package/libs/ui/elements/src/lib/thumbnail/thumbnail.component.d.ts +1 -1
  157. package/libs/ui/elements/src/lib/thumbnail/thumbnail.component.d.ts.map +1 -1
  158. package/libs/ui/elements/src/lib/ui-elements.module.d.ts +10 -8
  159. package/libs/ui/elements/src/lib/ui-elements.module.d.ts.map +1 -1
  160. package/libs/ui/elements/src/lib/user-feedback-item/time-since.pipe.d.ts +11 -0
  161. package/libs/ui/elements/src/lib/user-feedback-item/time-since.pipe.d.ts.map +1 -0
  162. package/libs/ui/elements/src/lib/user-feedback-item/user-feedback-item.component.d.ts +22 -0
  163. package/libs/ui/elements/src/lib/user-feedback-item/user-feedback-item.component.d.ts.map +1 -0
  164. package/libs/ui/inputs/src/index.d.ts +0 -1
  165. package/libs/ui/inputs/src/index.d.ts.map +1 -1
  166. package/libs/ui/inputs/src/lib/button/button.component.d.ts.map +1 -1
  167. package/libs/ui/inputs/src/lib/files-drop/files-drop.directive.d.ts +14 -0
  168. package/libs/ui/inputs/src/lib/files-drop/files-drop.directive.d.ts.map +1 -0
  169. package/libs/ui/inputs/src/lib/image-input/image-input.component.d.ts +44 -0
  170. package/libs/ui/inputs/src/lib/image-input/image-input.component.d.ts.map +1 -0
  171. package/libs/ui/inputs/src/lib/text-area/text-area.component.d.ts +7 -1
  172. package/libs/ui/inputs/src/lib/text-area/text-area.component.d.ts.map +1 -1
  173. package/libs/ui/inputs/src/lib/text-input/text-input.component.d.ts +4 -1
  174. package/libs/ui/inputs/src/lib/text-input/text-input.component.d.ts.map +1 -1
  175. package/libs/ui/inputs/src/lib/ui-inputs.module.d.ts +26 -33
  176. package/libs/ui/inputs/src/lib/ui-inputs.module.d.ts.map +1 -1
  177. package/libs/ui/layout/src/index.d.ts +5 -4
  178. package/libs/ui/layout/src/index.d.ts.map +1 -1
  179. package/libs/ui/layout/src/lib/form-field-wrapper/form-field-wrapper.component.d.ts +8 -0
  180. package/libs/ui/layout/src/lib/form-field-wrapper/form-field-wrapper.component.d.ts.map +1 -0
  181. package/libs/util/shared/src/lib/utils/bytes-convert.d.ts +2 -0
  182. package/libs/util/shared/src/lib/utils/bytes-convert.d.ts.map +1 -0
  183. package/libs/util/shared/src/lib/utils/image-resize.d.ts +3 -0
  184. package/libs/util/shared/src/lib/utils/image-resize.d.ts.map +1 -0
  185. package/libs/util/shared/src/lib/utils/index.d.ts +7 -5
  186. package/libs/util/shared/src/lib/utils/index.d.ts.map +1 -1
  187. package/package.json +1 -1
  188. package/src/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.ts +7 -1
  189. package/src/libs/api/repository/src/lib/gn4/auth/avatar.service.interface.ts +1 -0
  190. package/src/libs/api/repository/src/lib/gn4/auth/gravatar.service.ts +12 -1
  191. package/src/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.ts +51 -1
  192. package/src/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts +34 -7
  193. package/src/libs/common/domain/src/lib/model/record/index.ts +1 -0
  194. package/src/libs/common/domain/src/lib/model/record/user-feedbacks.model.ts +15 -0
  195. package/src/libs/common/domain/src/lib/platform.service.interface.ts +3 -0
  196. package/src/libs/common/fixtures/src/index.ts +8 -6
  197. package/src/libs/common/fixtures/src/lib/records.fixtures.ts +1 -1
  198. package/src/libs/common/fixtures/src/lib/user-feedbacks.fixtures.ts +83 -0
  199. package/src/libs/data-access/gn4/src/openapi/api/records.api.service.ts +43 -12
  200. package/src/libs/data-access/gn4/src/openapi/model/models.ts +0 -1
  201. package/src/libs/data-access/gn4/src/spec.yaml +1 -1
  202. package/src/libs/feature/editor/src/index.ts +1 -1
  203. package/src/libs/feature/editor/src/lib/+state/editor.facade.ts +8 -1
  204. package/src/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.html +8 -0
  205. package/src/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.ts +70 -0
  206. package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-array/form-field-array.component.ts +1 -0
  207. package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-file/form-field-file.component.ts +4 -1
  208. package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-object/form-field-object.component.ts +1 -0
  209. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.html +20 -0
  210. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.ts +44 -0
  211. package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-simple/form-field-simple.component.ts +4 -1
  212. package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-spatial-extent/form-field-spatial-extent.component.ts +1 -0
  213. package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-temporal-extent/form-field-temporal-extent.component.ts +1 -0
  214. package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field.component.html +28 -4
  215. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts +121 -0
  216. package/src/libs/feature/editor/src/lib/components/record-form/record-form.component.css +0 -0
  217. package/src/libs/feature/editor/src/lib/{record-form → components/record-form}/record-form.component.html +1 -0
  218. package/src/libs/feature/editor/src/lib/{record-form → components/record-form}/record-form.component.ts +4 -4
  219. package/src/libs/feature/editor/src/lib/feature-editor.module.ts +9 -9
  220. package/src/libs/feature/editor/src/lib/models/fields.model.ts +1 -1
  221. package/src/libs/feature/map/src/lib/add-layer-from-file/add-layer-from-file.component.html +1 -1
  222. package/src/libs/feature/notifications/src/index.ts +3 -0
  223. package/src/libs/feature/notifications/src/lib/feature-notifications.module.ts +10 -0
  224. package/src/libs/feature/notifications/src/lib/notification.model.ts +6 -0
  225. package/src/libs/feature/notifications/src/lib/notifications-container/notifications-container.component.css +0 -0
  226. package/src/libs/feature/notifications/src/lib/notifications-container/notifications-container.component.html +17 -0
  227. package/src/libs/feature/notifications/src/lib/notifications-container/notifications-container.component.ts +44 -0
  228. package/src/libs/feature/notifications/src/lib/notifications.service.ts +27 -0
  229. package/src/libs/feature/record/src/lib/feature-record.module.ts +5 -2
  230. package/src/libs/feature/record/src/lib/state/mdview.actions.ts +51 -6
  231. package/src/libs/feature/record/src/lib/state/mdview.effects.ts +82 -7
  232. package/src/libs/feature/record/src/lib/state/mdview.facade.ts +49 -8
  233. package/src/libs/feature/record/src/lib/state/mdview.reducer.ts +81 -24
  234. package/src/libs/feature/record/src/lib/state/mdview.selectors.ts +40 -10
  235. package/src/libs/feature/router/src/lib/default/state/router.effects.ts +2 -2
  236. package/src/libs/feature/search/src/lib/results-table/results-table.component.html +3 -3
  237. package/src/libs/ui/catalog/src/lib/organisation-preview/organisation-preview.component.html +5 -5
  238. package/src/libs/ui/elements/src/index.ts +14 -14
  239. package/src/libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.html +1 -1
  240. package/src/libs/ui/elements/src/lib/markdown-editor/markdown-editor.component.css +0 -5
  241. package/src/libs/ui/elements/src/lib/markdown-editor/markdown-editor.component.html +0 -21
  242. package/src/libs/ui/elements/src/lib/markdown-editor/markdown-editor.component.ts +1 -14
  243. package/src/libs/ui/elements/src/lib/notification/notification.component.css +0 -0
  244. package/src/libs/ui/elements/src/lib/notification/notification.component.html +52 -0
  245. package/src/libs/ui/elements/src/lib/notification/notification.component.ts +31 -0
  246. package/src/libs/ui/elements/src/lib/record-api-form/record-api-form.component.html +1 -1
  247. package/src/libs/ui/elements/src/lib/thumbnail/thumbnail.component.ts +5 -3
  248. package/src/libs/ui/elements/src/lib/ui-elements.module.ts +6 -1
  249. package/src/libs/ui/elements/src/lib/user-feedback-item/time-since.pipe.ts +54 -0
  250. package/src/libs/ui/elements/src/lib/user-feedback-item/user-feedback-item.component.css +0 -0
  251. package/src/libs/ui/elements/src/lib/user-feedback-item/user-feedback-item.component.html +75 -0
  252. package/src/libs/ui/elements/src/lib/user-feedback-item/user-feedback-item.component.ts +63 -0
  253. package/src/libs/ui/inputs/src/index.ts +0 -1
  254. package/src/libs/ui/inputs/src/lib/button/button.component.ts +1 -1
  255. package/src/libs/ui/inputs/src/lib/files-drop/files-drop.directive.ts +45 -0
  256. package/src/libs/ui/inputs/src/lib/image-input/image-input.component.css +0 -0
  257. package/src/libs/ui/inputs/src/lib/image-input/image-input.component.html +146 -0
  258. package/src/libs/ui/inputs/src/lib/image-input/image-input.component.ts +193 -0
  259. package/src/libs/ui/inputs/src/lib/text-area/text-area.component.html +2 -1
  260. package/src/libs/ui/inputs/src/lib/text-area/text-area.component.ts +29 -0
  261. package/src/libs/ui/inputs/src/lib/text-input/text-input.component.html +1 -1
  262. package/src/libs/ui/inputs/src/lib/text-input/text-input.component.ts +16 -1
  263. package/src/libs/ui/inputs/src/lib/ui-inputs.module.ts +3 -19
  264. package/src/libs/ui/layout/src/index.ts +5 -4
  265. package/src/libs/ui/layout/src/lib/form-field-wrapper/form-field-wrapper.component.css +0 -0
  266. package/src/libs/ui/layout/src/lib/form-field-wrapper/form-field-wrapper.component.html +18 -0
  267. package/src/libs/ui/layout/src/lib/form-field-wrapper/form-field-wrapper.component.ts +16 -0
  268. package/src/libs/util/shared/src/lib/utils/bytes-convert.ts +3 -0
  269. package/src/libs/util/shared/src/lib/utils/image-resize.ts +72 -0
  270. package/src/libs/util/shared/src/lib/utils/index.ts +7 -5
  271. package/tailwind.base.css +36 -0
  272. package/translations/de.json +33 -0
  273. package/translations/en.json +33 -0
  274. package/translations/es.json +33 -0
  275. package/translations/fr.json +33 -0
  276. package/translations/it.json +33 -0
  277. package/translations/nl.json +33 -0
  278. package/translations/pt.json +33 -0
  279. package/translations/sk.json +33 -0
  280. package/esm2022/libs/data-access/gn4/src/openapi/model/inlineObject3.api.model.mjs +0 -13
  281. package/esm2022/libs/feature/editor/src/lib/record-form/record-form.component.mjs +0 -30
  282. package/esm2022/libs/ui/inputs/src/lib/form-field/form-field-array/form-field-array.component.mjs +0 -11
  283. package/esm2022/libs/ui/inputs/src/lib/form-field/form-field-file/form-field-file.component.mjs +0 -27
  284. package/esm2022/libs/ui/inputs/src/lib/form-field/form-field-object/form-field-object.component.mjs +0 -11
  285. package/esm2022/libs/ui/inputs/src/lib/form-field/form-field-rich/form-field-rich.component.mjs +0 -27
  286. package/esm2022/libs/ui/inputs/src/lib/form-field/form-field-simple/form-field-simple.component.mjs +0 -49
  287. package/esm2022/libs/ui/inputs/src/lib/form-field/form-field-spatial-extent/form-field-spatial-extent.component.mjs +0 -11
  288. package/esm2022/libs/ui/inputs/src/lib/form-field/form-field-temporal-extent/form-field-temporal-extent.component.mjs +0 -11
  289. package/esm2022/libs/ui/inputs/src/lib/form-field/form-field.component.mjs +0 -76
  290. package/esm2022/libs/ui/inputs/src/lib/form-field/form-field.model.mjs +0 -2
  291. package/esm2022/libs/ui/inputs/src/lib/form-field/index.mjs +0 -10
  292. package/libs/data-access/gn4/src/openapi/model/inlineObject3.api.model.d.ts +0 -18
  293. package/libs/data-access/gn4/src/openapi/model/inlineObject3.api.model.d.ts.map +0 -1
  294. package/libs/feature/editor/src/lib/record-form/record-form.component.d.ts.map +0 -1
  295. package/libs/ui/inputs/src/lib/form-field/form-field-array/form-field-array.component.d.ts.map +0 -1
  296. package/libs/ui/inputs/src/lib/form-field/form-field-file/form-field-file.component.d.ts.map +0 -1
  297. package/libs/ui/inputs/src/lib/form-field/form-field-object/form-field-object.component.d.ts.map +0 -1
  298. package/libs/ui/inputs/src/lib/form-field/form-field-rich/form-field-rich.component.d.ts +0 -11
  299. package/libs/ui/inputs/src/lib/form-field/form-field-rich/form-field-rich.component.d.ts.map +0 -1
  300. package/libs/ui/inputs/src/lib/form-field/form-field-simple/form-field-simple.component.d.ts.map +0 -1
  301. package/libs/ui/inputs/src/lib/form-field/form-field-spatial-extent/form-field-spatial-extent.component.d.ts.map +0 -1
  302. package/libs/ui/inputs/src/lib/form-field/form-field-temporal-extent/form-field-temporal-extent.component.d.ts.map +0 -1
  303. package/libs/ui/inputs/src/lib/form-field/form-field.component.d.ts.map +0 -1
  304. package/libs/ui/inputs/src/lib/form-field/form-field.model.d.ts.map +0 -1
  305. package/libs/ui/inputs/src/lib/form-field/index.d.ts.map +0 -1
  306. package/src/libs/data-access/gn4/src/openapi/model/inlineObject3.api.model.ts +0 -18
  307. package/src/libs/ui/inputs/src/lib/form-field/form-field-rich/form-field-rich.component.html +0 -11
  308. package/src/libs/ui/inputs/src/lib/form-field/form-field-rich/form-field-rich.component.ts +0 -15
  309. package/src/libs/ui/inputs/src/lib/form-field/form-field.component.ts +0 -80
  310. /package/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field.model.d.ts +0 -0
  311. /package/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/index.d.ts +0 -0
  312. /package/src/libs/feature/editor/src/lib/{record-form/record-form.component.css → components/overview-upload/overview-upload.component.css} +0 -0
  313. /package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-array/form-field-array.component.css +0 -0
  314. /package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-array/form-field-array.component.html +0 -0
  315. /package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-file/form-field-file.component.css +0 -0
  316. /package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-file/form-field-file.component.html +0 -0
  317. /package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-object/form-field-object.component.css +0 -0
  318. /package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-object/form-field-object.component.html +0 -0
  319. /package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-rich/form-field-rich.component.css +0 -0
  320. /package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-simple/form-field-simple.component.css +0 -0
  321. /package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-simple/form-field-simple.component.html +0 -0
  322. /package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-spatial-extent/form-field-spatial-extent.component.css +0 -0
  323. /package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-spatial-extent/form-field-spatial-extent.component.html +0 -0
  324. /package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-temporal-extent/form-field-temporal-extent.component.css +0 -0
  325. /package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field-temporal-extent/form-field-temporal-extent.component.html +0 -0
  326. /package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field.component.css +0 -0
  327. /package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/form-field.model.ts +0 -0
  328. /package/src/libs/{ui/inputs/src/lib → feature/editor/src/lib/components/record-form}/form-field/index.ts +0 -0
@@ -1,3 +1,4 @@
1
+ import { CommonModule } from '@angular/common'
1
2
  import {
2
3
  ChangeDetectionStrategy,
3
4
  Component,
@@ -18,20 +19,21 @@ export const THUMBNAIL_PLACEHOLDER = new InjectionToken<string>(
18
19
  'thumbnail-placeholder'
19
20
  )
20
21
 
22
+ type FitOptions = 'cover' | 'contain' | 'scale-down'
21
23
  type ThumbnailImageObject = {
22
24
  url: string
23
- fit?: 'cover' | 'contain' | 'scale-down'
25
+ fit?: FitOptions
24
26
  }
25
27
 
26
28
  const DEFAULT_PLACEHOLDER =
27
29
  'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH5gkNDCUFYjA1nwAAA1pJREFUeNrtnW2TmjAURh8CLlTdrmun///3tZ22+zLuYlehH7jsMGogwRiiec4MM44K6D3x3hAwAIQQQgghhJDYSM5cPwNQAMgBpACUg22GTg2gArAD8A9AKY+9CsgALAF8YRsGALwDeAWw9yGgALCKoKWP+WU8iwxjUsudLBj83sZciIiPSwhoWz7pJ5dUZFQXlEXOZ/DNeTBt3JnhBpc9aacGsOn0BuoIUk3b+5trGnEC4B7Ak4sUlInRU+wB/JbgVxG18KrTBc01EmYmcTFJQUVPy/9zTh/4BthLDOqeenB2DdBtZBN58LsSNpcUoEtTJWM/GIvMhQDde9j6h2OhXAjo6/2Q/lgkLgSQC0IBFEABZEKyiaQv5AAv7fSlS+lPVxRwOXTnEtoTPAs04yfRHGMoz8F/HOiaJfKeggLc78dmOHsVS33y9SUXsDuLlsg6FOAw/fhYhwI0pJ7WoQASpoC9p3UoQEPpaR0K0LCB3fB1e6KfAhxRweAKgQ5PsQxJ+CzCJYC/A7+EWt4TzVCE77GgEsBPHA/G7QBswcE4b+noVRZ2QxkCCqAAQgEUQCiAAggFUAChAAogFEABhAJcfT9FAdOxQuB/ML9lAfdo/qWYy2MK8EiO5mrrliUCvdIudAEzWWzQzWuxwjRnAK9WwAzAWhZTCe3l7cryNQrQBL/txZhKGGrlwc36ogIPfvdzfhuQsDDM80EVZXUFwe+mEJ2EOwBfLfYTTFFWVxL8Qwl3nedSye1jjhEyCjAPflfCWiScU1iDKMrqyoJ/KOFxRDf1sCg/xCxgTPC7EnIHn6GYsiirKw2+ayYryorBn7YoKwb/qCgntywg1OBPdqSsGPyTRXnp07gvPgD8AAl6KIICCAVQAAlLwOg5MSNi9NyqJgKqAHpQoZNZxs5KgG7SDN7AZzgWOxcCtprn5/wVfLb+uWXsrASUPXlvHbmETGKQjBVgMitVJTuaaQS2t/GoEMeE3onEor2jlK4RvwN4G1u9T4n6zp6PMTWAXzCYdCq12OCOhdeYZzT3mIErAW1Fr+HmNOAt82KSesYIAJoRzR2aIVumo+Ms8WwT/HOOZlM0Y+Zzxv2zp/gCTzfzPOyGtdfgp7LEcDvbvSxbWXg/HUIIIYQQQogx/wHLoX7NoCMFPwAAAABJRU5ErkJggg=='
28
30
 
29
- type FitOptions = 'cover' | 'contain' | 'scale-down'
30
-
31
31
  @Component({
32
32
  selector: 'gn-ui-thumbnail',
33
33
  templateUrl: './thumbnail.component.html',
34
34
  changeDetection: ChangeDetectionStrategy.OnPush,
35
+ standalone: true,
36
+ imports: [CommonModule],
35
37
  })
36
38
  export class ThumbnailComponent implements OnInit, OnChanges {
37
39
  @Input() thumbnailUrl: string | string[]
@@ -31,6 +31,8 @@ import { MaxLinesComponent } from './max-lines/max-lines.component'
31
31
  import { RecordApiFormComponent } from './record-api-form/record-api-form.component'
32
32
  import { MarkdownParserComponent } from './markdown-parser/markdown-parser.component'
33
33
  import { ImageOverlayPreviewComponent } from './image-overlay-preview/image-overlay-preview.component'
34
+ import { UserFeedbackItemComponent } from './user-feedback-item/user-feedback-item.component'
35
+ import { TimeSincePipe } from './user-feedback-item/time-since.pipe'
34
36
 
35
37
  @NgModule({
36
38
  imports: [
@@ -46,6 +48,8 @@ import { ImageOverlayPreviewComponent } from './image-overlay-preview/image-over
46
48
  FormsModule,
47
49
  NgOptimizedImage,
48
50
  MarkdownParserComponent,
51
+ ThumbnailComponent,
52
+ TimeSincePipe,
49
53
  ],
50
54
  declarations: [
51
55
  MetadataInfoComponent,
@@ -61,13 +65,13 @@ import { ImageOverlayPreviewComponent } from './image-overlay-preview/image-over
61
65
  MetadataQualityItemComponent,
62
66
  SearchResultsErrorComponent,
63
67
  PaginationComponent,
64
- ThumbnailComponent,
65
68
  AvatarComponent,
66
69
  UserPreviewComponent,
67
70
  GnUiLinkifyDirective,
68
71
  PaginationButtonsComponent,
69
72
  MaxLinesComponent,
70
73
  RecordApiFormComponent,
74
+ UserFeedbackItemComponent,
71
75
  ImageOverlayPreviewComponent,
72
76
  ],
73
77
  exports: [
@@ -91,6 +95,7 @@ import { ImageOverlayPreviewComponent } from './image-overlay-preview/image-over
91
95
  MaxLinesComponent,
92
96
  RecordApiFormComponent,
93
97
  MarkdownParserComponent,
98
+ UserFeedbackItemComponent,
94
99
  ImageOverlayPreviewComponent,
95
100
  ],
96
101
  })
@@ -0,0 +1,54 @@
1
+ import { Pipe, PipeTransform } from '@angular/core'
2
+ import { TranslateService } from '@ngx-translate/core'
3
+ import { formatDistance } from 'date-fns'
4
+ import { de, enUS, es, fr, it, nl, pt, sk } from 'date-fns/locale'
5
+
6
+ @Pipe({
7
+ name: 'timeSince',
8
+ standalone: true,
9
+ })
10
+ export class TimeSincePipe implements PipeTransform {
11
+ constructor(private translate: TranslateService) {}
12
+
13
+ transform(value: Date): string {
14
+ if (isNaN(value.getTime())) {
15
+ throw new Error('Invalid Date')
16
+ }
17
+
18
+ const maintenant = new Date()
19
+ let locale: Locale
20
+
21
+ switch (this.translate.currentLang) {
22
+ case 'fr':
23
+ locale = fr
24
+ break
25
+ case 'de':
26
+ locale = de
27
+ break
28
+ case 'es':
29
+ locale = es
30
+ break
31
+ case 'it':
32
+ locale = it
33
+ break
34
+ case 'nl':
35
+ locale = nl
36
+ break
37
+ case 'pt':
38
+ locale = pt
39
+ break
40
+ case 'sk':
41
+ locale = sk
42
+ break
43
+ case 'en':
44
+ default:
45
+ locale = enUS
46
+ break
47
+ }
48
+
49
+ return formatDistance(value, maintenant, {
50
+ addSuffix: true,
51
+ locale: locale,
52
+ })
53
+ }
54
+ }
@@ -0,0 +1,75 @@
1
+ <div
2
+ *ngIf="userFeedbackParent.published"
3
+ class="flex flex-col bg-white rounded w-full"
4
+ [ngClass]="[isAnAnswer ? 'ps-4 ' : 'p-4']"
5
+ >
6
+ <div class="flex flex-row">
7
+ <div class="avatar">
8
+ <img
9
+ class="rounded-full"
10
+ [src]="userFeedbackParent.avatarUrl"
11
+ alt="avatar"
12
+ />
13
+ </div>
14
+ <div class="p-4 flex flex-col">
15
+ <span>{{ userFeedbackParent.authorName }}</span>
16
+ <span> {{ userFeedbackParent.date | timeSince }}</span>
17
+ </div>
18
+ </div>
19
+ <div data-cy="commentText" class="mt-4 whitespace-pre-line">
20
+ {{ userFeedbackParent.comment }}
21
+ </div>
22
+ <div
23
+ class="w-full"
24
+ *ngFor="let userFeedBacksAnswer of userFeedBacksAnswers; let last = last"
25
+ >
26
+ <hr class="-mx-4 my-6" />
27
+ <gn-ui-user-feedback-item
28
+ [userFeedbackParent]="userFeedBacksAnswer"
29
+ [isLastComment]="last"
30
+ ></gn-ui-user-feedback-item>
31
+ </div>
32
+
33
+ <div *ngIf="isActiveUserEditor" class="mt-2 flex flex-col">
34
+ <hr class="-mx-4 my-4" />
35
+ <div
36
+ id="new-comment-buttons"
37
+ class="flex flex-row gap-2 items-center justify-end"
38
+ >
39
+ <gn-ui-text-area
40
+ [disabled]="isAddUserFeedbackLoading"
41
+ [(value)]="newAnswer"
42
+ (valueChange)="onNewAnswerValueChange()"
43
+ (keyup.control.enter)="publishNewAnswer()"
44
+ [placeholder]="
45
+ 'record.metadata.userFeedbacks.newAnswer.placeholder' | translate
46
+ "
47
+ class="grow"
48
+ extraClass="bg-transparent border-0 placeholder-primary-darker text-primary-darker h-9"
49
+ ></gn-ui-text-area>
50
+ <div *ngIf="!isAnswerEmpty" class="flex flex-row justify-end">
51
+ <gn-ui-button
52
+ [disabled]="isAddUserFeedbackLoading"
53
+ [type]="'outline'"
54
+ (buttonClick)="publishNewAnswer()"
55
+ [title]="
56
+ 'record.metadata.userFeedbacks.newAnswer.buttonTitle' | translate
57
+ "
58
+ extraClass="!p-[0.5em] text-primary-darker border-primary-darker h-9"
59
+ >
60
+ <mat-icon
61
+ class="material-symbols-outlined"
62
+ *ngIf="!isAddUserFeedbackLoading"
63
+ >
64
+ send
65
+ </mat-icon>
66
+ <ng-container *ngIf="isAddUserFeedbackLoading">
67
+ <div class="flex justify-center w-full">
68
+ <gn-ui-spinning-loader></gn-ui-spinning-loader>
69
+ </div>
70
+ </ng-container>
71
+ </gn-ui-button>
72
+ </div>
73
+ </div>
74
+ </div>
75
+ </div>
@@ -0,0 +1,63 @@
1
+ import {
2
+ ChangeDetectionStrategy,
3
+ Component,
4
+ EventEmitter,
5
+ Input,
6
+ OnInit,
7
+ Output,
8
+ } from '@angular/core'
9
+ import {
10
+ UserFeedback,
11
+ UserFeedbackViewModel,
12
+ } from '../../../../../../libs/common/domain/src/lib/model/record'
13
+ import { UserModel } from '../../../../../../libs/common/domain/src/lib/model/user'
14
+
15
+ @Component({
16
+ selector: 'gn-ui-user-feedback-item',
17
+ templateUrl: './user-feedback-item.component.html',
18
+ styleUrls: ['./user-feedback-item.component.css'],
19
+ changeDetection: ChangeDetectionStrategy.OnPush,
20
+ })
21
+ export class UserFeedbackItemComponent implements OnInit {
22
+ @Input() userFeedbackParent: UserFeedbackViewModel
23
+ @Input() userFeedBacksAnswers: UserFeedbackViewModel[]
24
+ @Input() isActiveUserEditor: boolean
25
+ @Input() activeUser: UserModel
26
+ @Input() isLastComment: boolean
27
+ @Input() isAddUserFeedbackLoading: boolean
28
+
29
+ @Output() newUserFeedbackAnswer = new EventEmitter<UserFeedback>()
30
+
31
+ isAnAnswer = false
32
+ newAnswer = ''
33
+ isAnswerEmpty = true
34
+
35
+ ngOnInit(): void {
36
+ this.isAnAnswer = !!this.userFeedbackParent.parentUuid
37
+ }
38
+
39
+ onNewAnswerValueChange() {
40
+ this.isAnswerEmpty = this.newAnswer.length === 0
41
+ }
42
+
43
+ publishNewAnswer() {
44
+ if (this.newAnswer.trim() === '') return
45
+
46
+ const newAnswer: UserFeedback = {
47
+ ...this.userFeedbackParent,
48
+ uuid: undefined,
49
+ published: true,
50
+ comment: this.newAnswer,
51
+ parentUuid: this.userFeedbackParent.uuid,
52
+ authorUserId: this.activeUser?.id,
53
+ authorEmail: this.activeUser?.email,
54
+ date: new Date(),
55
+ authorName: `${this.activeUser?.name} ${this.activeUser?.surname}`,
56
+ }
57
+
58
+ this.newUserFeedbackAnswer.emit(newAnswer)
59
+
60
+ this.newAnswer = ''
61
+ this.onNewAnswerValueChange()
62
+ }
63
+ }
@@ -11,7 +11,6 @@ export * from './lib/button/button.component'
11
11
  export * from './lib/viewport-intersector/viewport-intersector.component'
12
12
  export * from './lib/check-toggle/check-toggle.component'
13
13
  export * from './lib/ui-inputs.module'
14
- export * from './lib/form-field'
15
14
  export * from './lib/copy-text-button/copy-text-button.component'
16
15
  export * from './lib/drag-and-drop-file-input/drag-and-drop-file-input.component'
17
16
  export * from './lib/navigation-button/navigation-button.component'
@@ -15,7 +15,7 @@ import { propagateToDocumentOnly } from '../../../../../../libs/util/shared/src'
15
15
  standalone: true,
16
16
  })
17
17
  export class ButtonComponent {
18
- private btnClass: string
18
+ private btnClass = 'gn-ui-btn-default'
19
19
 
20
20
  @Input() set type(
21
21
  value: 'primary' | 'secondary' | 'default' | 'outline' | 'light'
@@ -0,0 +1,45 @@
1
+ import { Directive, HostListener, Output, EventEmitter } from '@angular/core'
2
+
3
+ @Directive({
4
+ selector: '[gnUiFilesDrop]',
5
+ standalone: true,
6
+ })
7
+ export class FilesDropDirective {
8
+ @Output() dragFilesOver: EventEmitter<boolean> = new EventEmitter()
9
+ @Output() dropFiles: EventEmitter<File[]> = new EventEmitter()
10
+
11
+ dragEnterCounter = 0
12
+
13
+ @HostListener('dragenter', ['$event'])
14
+ _onDragEnter(event: DragEvent) {
15
+ event.preventDefault()
16
+ this.dragEnterCounter++
17
+ this.dragFilesOver.emit(true)
18
+ }
19
+
20
+ @HostListener('dragover', ['$event'])
21
+ _onDragOver(event: DragEvent) {
22
+ event.preventDefault()
23
+ }
24
+
25
+ @HostListener('dragleave', ['$event'])
26
+ _onDragLeave(event: DragEvent) {
27
+ event.preventDefault()
28
+ this.dragEnterCounter = Math.max(0, this.dragEnterCounter - 1)
29
+ if (this.dragEnterCounter === 0) {
30
+ this.dragFilesOver.emit(false)
31
+ }
32
+ }
33
+
34
+ @HostListener('drop', ['$event'])
35
+ _onDrop(event: DragEvent) {
36
+ event.preventDefault()
37
+ this.dragEnterCounter = 0
38
+ this.dragFilesOver.emit(false)
39
+
40
+ const files = Array.from(event.dataTransfer.files)
41
+ if (files.length > 0) {
42
+ this.dropFiles.emit(files)
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,146 @@
1
+ <ng-container *ngIf="previewUrl; then withImage; else withoutImage">
2
+ </ng-container>
3
+
4
+ <ng-template #withImage>
5
+ <div class="w-full h-full flex flex-col gap-2">
6
+ <div class="flex-1 group relative">
7
+ <img
8
+ class="w-full h-full object-cover border-2 border-gray-300 rounded-lg"
9
+ [alt]="altText"
10
+ loading="lazy"
11
+ [src]="previewUrl"
12
+ />
13
+ <gn-ui-button
14
+ [extraClass]="
15
+ 'bg-gray-200 absolute right-2 bottom-2 invisible group-hover:visible'
16
+ "
17
+ (buttonClick)="handleDelete()"
18
+ >
19
+ <mat-icon class="material-symbols-outlined">delete</mat-icon>
20
+ </gn-ui-button>
21
+ </div>
22
+ <input
23
+ *ngIf="showAltTextInput"
24
+ type="text"
25
+ class="py-3 px-2 border-2 border-gray-300 rounded-lg text-sm font-medium"
26
+ [placeholder]="'input.image.altTextPlaceholder' | translate"
27
+ [value]="altText"
28
+ (change)="handleAltTextChange($event)"
29
+ />
30
+ <div class="flex flex-row gap-2">
31
+ <gn-ui-button
32
+ [extraClass]="'bg-gray-200 font-bold'"
33
+ (buttonClick)="handleDelete()"
34
+ >
35
+ <mat-icon class="material-symbols-outlined me-1">delete</mat-icon>
36
+ {{ 'input.image.delete' | translate }}
37
+ </gn-ui-button>
38
+ <gn-ui-button
39
+ *ngIf="!showAltTextInput"
40
+ [extraClass]="'bg-gray-200 font-bold'"
41
+ (buttonClick)="toggleAltTextInput()"
42
+ >
43
+ <mat-icon class="material-symbols-outlined me-1">add</mat-icon>
44
+ {{ 'input.image.displayAltTextInput' | translate }}
45
+ </gn-ui-button>
46
+ </div>
47
+ </div>
48
+ </ng-template>
49
+
50
+ <ng-template #withoutImage>
51
+ <div class="w-full h-full flex flex-col gap-2">
52
+ <label
53
+ gnUiFilesDrop
54
+ class="block flex-1 border-2 border-dashed border-gray-300 rounded-lg p-6 flex flex-col items-center justify-center gap-4"
55
+ (dragFilesOver)="handleDragFilesOver($event)"
56
+ (dropFiles)="handleDropFiles($event)"
57
+ >
58
+ <div class="w-14 h-14 rounded-md bg-gray-200 grid">
59
+ <mat-icon
60
+ *ngIf="!dragFilesOver && !uploadProgress && !uploadError"
61
+ class="material-symbols-outlined place-self-center text-blue-500"
62
+ >image</mat-icon
63
+ >
64
+ <mat-icon
65
+ *ngIf="dragFilesOver && !uploadProgress && !uploadError"
66
+ class="material-symbols-outlined place-self-center text-blue-500"
67
+ >add_box</mat-icon
68
+ >
69
+ <div *ngIf="uploadProgress">
70
+ <mat-progress-spinner
71
+ class="place-self-center"
72
+ [diameter]="56"
73
+ [mode]="'determinate'"
74
+ [value]="uploadProgress"
75
+ ></mat-progress-spinner>
76
+ <span
77
+ class="text-sm font-medium relative inline-block width-[30px] bottom-[40px] left-[15px]"
78
+ >
79
+ {{ uploadProgress }}%
80
+ </span>
81
+ </div>
82
+ <mat-icon
83
+ *ngIf="uploadError"
84
+ class="material-symbols-outlined place-self-center text-rose-500"
85
+ >broken_image</mat-icon
86
+ >
87
+ </div>
88
+ <div class="flex flex-col items-center gap-1">
89
+ <p class="font-medium">{{ getPrimaryText() | translate }}</p>
90
+ <p
91
+ class="text-sm"
92
+ [class]="
93
+ uploadProgress || uploadError
94
+ ? 'font-bold text-blue-500 cursor-pointer'
95
+ : 'font-medium text-gray-500'
96
+ "
97
+ (click)="handleSecondaryTextClick()"
98
+ >
99
+ {{ getSecondaryText() | translate }}
100
+ </p>
101
+ </div>
102
+ <input
103
+ type="file"
104
+ class="hidden"
105
+ (change)="handleFileInput($event)"
106
+ [disabled]="showUrlInput || uploadProgress || uploadError"
107
+ />
108
+ </label>
109
+ <div *ngIf="!showUrlInput" class="flex-none">
110
+ <gn-ui-button
111
+ [extraClass]="'bg-gray-200 font-bold'"
112
+ (buttonClick)="displayUrlInput()"
113
+ >
114
+ <mat-icon class="material-symbols-outlined me-1">link</mat-icon>
115
+ {{ 'input.image.displayUrlInput' | translate }}
116
+ </gn-ui-button>
117
+ </div>
118
+ <div *ngIf="showUrlInput" class="flex-none flex flex-col gap-2">
119
+ <div class="h-2"></div>
120
+ <div class="flex gap-2 items-center">
121
+ <div class="flex-1 flex rounded-lg">
122
+ <span
123
+ class="material-symbols-outlined px-4 inline-flex items-center min-w-fit rounded-s-lg border-2 border-e-0 border-gray-300"
124
+ >link</span
125
+ >
126
+ <input
127
+ type="text"
128
+ class="py-3 ps-1 block w-full border-2 border-s-0 border-e-0 border-gray-300 text-sm font-medium"
129
+ placeholder="https://exemple.com/image.jpg"
130
+ (change)="handleUrlChange($event)"
131
+ />
132
+ <gn-ui-button
133
+ class="px-1 inline-flex items-center min-w-fit rounded-e-lg border-2 border-s-0 border-gray-300 text-white"
134
+ [extraClass]="
135
+ urlInputValue && !downloadError ? 'bg-blue-500' : 'bg-gray-500'
136
+ "
137
+ [disabled]="!urlInputValue || downloadError"
138
+ (buttonClick)="downloadUrl()"
139
+ >
140
+ <mat-icon class="material-symbols-outlined">arrow_upward</mat-icon>
141
+ </gn-ui-button>
142
+ </div>
143
+ </div>
144
+ </div>
145
+ </div>
146
+ </ng-template>
@@ -0,0 +1,193 @@
1
+ import { CommonModule } from '@angular/common'
2
+ import { HttpClient } from '@angular/common/http'
3
+ import {
4
+ ChangeDetectionStrategy,
5
+ ChangeDetectorRef,
6
+ Component,
7
+ EventEmitter,
8
+ Input,
9
+ Output,
10
+ } from '@angular/core'
11
+ import { MatIconModule } from '@angular/material/icon'
12
+ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'
13
+ import { downgradeImage, megabytesToBytes } from '../../../../../../libs/util/shared/src'
14
+ import { firstValueFrom } from 'rxjs'
15
+ import { ButtonComponent } from '../button/button.component'
16
+ import { FilesDropDirective } from '../files-drop/files-drop.directive'
17
+ import { TranslateModule } from '@ngx-translate/core'
18
+ import { marker } from '@biesbjerg/ngx-translate-extract-marker'
19
+
20
+ @Component({
21
+ selector: 'gn-ui-image-input',
22
+ templateUrl: './image-input.component.html',
23
+ styleUrls: ['./image-input.component.css'],
24
+ changeDetection: ChangeDetectionStrategy.OnPush,
25
+ standalone: true,
26
+ imports: [
27
+ CommonModule,
28
+ ButtonComponent,
29
+ MatIconModule,
30
+ FilesDropDirective,
31
+ MatProgressSpinnerModule,
32
+ TranslateModule,
33
+ ],
34
+ })
35
+ export class ImageInputComponent {
36
+ @Input() maxSizeMB: number
37
+ @Input() previewUrl?: string
38
+ @Input() altText?: string
39
+ @Input() uploadProgress?: number
40
+ @Input() uploadError?: boolean
41
+ @Output() fileChange: EventEmitter<File> = new EventEmitter()
42
+ @Output() urlChange: EventEmitter<string> = new EventEmitter()
43
+ @Output() uploadCancel: EventEmitter<void> = new EventEmitter()
44
+ @Output() delete: EventEmitter<void> = new EventEmitter()
45
+ @Output() altTextChange: EventEmitter<string> = new EventEmitter()
46
+
47
+ dragFilesOver = false
48
+ showUrlInput = false
49
+ downloadError = false
50
+ showAltTextInput = false
51
+
52
+ urlInputValue?: string
53
+ lastUploadType?: 'file' | 'url'
54
+ lastUploadContent?: string | File
55
+
56
+ constructor(private http: HttpClient, private cd: ChangeDetectorRef) {}
57
+
58
+ getPrimaryText() {
59
+ if (this.uploadError) {
60
+ return marker('input.image.uploadErrorLabel')
61
+ }
62
+ if (this.uploadProgress) {
63
+ return marker('input.image.uploadProgressLabel')
64
+ }
65
+ return marker('input.image.selectFileLabel')
66
+ }
67
+
68
+ getSecondaryText() {
69
+ if (this.uploadError) {
70
+ return marker('input.image.uploadErrorRetry')
71
+ }
72
+ if (this.uploadProgress) {
73
+ return marker('input.image.uploadProgressCancel')
74
+ }
75
+ return marker('input.image.dropFileLabel')
76
+ }
77
+
78
+ handleDragFilesOver(dragFilesOver: boolean) {
79
+ if (!this.showUrlInput) {
80
+ this.dragFilesOver = dragFilesOver
81
+ this.cd.markForCheck()
82
+ }
83
+ }
84
+
85
+ handleDropFiles(files: File[]) {
86
+ if (!this.showUrlInput) {
87
+ const validFiles = this.filterTypeImage(files)
88
+ if (validFiles.length > 0) {
89
+ this.resizeAndEmit(validFiles[0])
90
+ }
91
+ }
92
+ }
93
+
94
+ handleFileInput(event: Event) {
95
+ const inputFiles = Array.from((event.target as HTMLInputElement).files)
96
+ const validFiles = this.filterTypeImage(inputFiles)
97
+ if (validFiles.length > 0) {
98
+ this.resizeAndEmit(validFiles[0])
99
+ }
100
+ }
101
+
102
+ displayUrlInput() {
103
+ this.uploadCancel.emit()
104
+ this.showUrlInput = true
105
+ }
106
+
107
+ handleUrlChange(event: Event) {
108
+ this.downloadError = false
109
+ this.urlInputValue = (event.target as HTMLInputElement).value
110
+ }
111
+
112
+ async downloadUrl() {
113
+ const name = this.urlInputValue.split('/').pop()
114
+
115
+ try {
116
+ const response = await firstValueFrom(
117
+ this.http.head(this.urlInputValue, { observe: 'response' })
118
+ )
119
+ if (
120
+ response.headers.get('content-type')?.startsWith('image/') &&
121
+ parseInt(response.headers.get('content-length')) <
122
+ megabytesToBytes(this.maxSizeMB)
123
+ ) {
124
+ this.http.get(this.urlInputValue, { responseType: 'blob' }).subscribe({
125
+ next: (blob) => {
126
+ this.cd.markForCheck()
127
+ const file = new File([blob], name)
128
+ this.fileChange.emit(file)
129
+ },
130
+ error: () => {
131
+ this.downloadError = true
132
+ this.cd.markForCheck()
133
+ this.urlChange.emit(this.urlInputValue)
134
+ },
135
+ })
136
+ }
137
+ } catch {
138
+ this.downloadError = true
139
+ this.cd.markForCheck()
140
+ return
141
+ }
142
+ }
143
+
144
+ handleSecondaryTextClick() {
145
+ if (this.uploadError) {
146
+ this.handleRetry()
147
+ } else if (this.uploadProgress) {
148
+ this.handleCancel()
149
+ }
150
+ }
151
+
152
+ handleCancel() {
153
+ this.uploadCancel.emit()
154
+ }
155
+
156
+ handleRetry() {
157
+ switch (this.lastUploadType) {
158
+ case 'file':
159
+ this.fileChange.emit(this.lastUploadContent as File)
160
+ break
161
+ case 'url':
162
+ this.urlChange.emit(this.lastUploadContent as string)
163
+ break
164
+ }
165
+ }
166
+
167
+ handleDelete() {
168
+ this.delete.emit()
169
+ }
170
+
171
+ toggleAltTextInput() {
172
+ this.showAltTextInput = !this.showAltTextInput
173
+ }
174
+
175
+ handleAltTextChange(event: Event) {
176
+ const input = event.target as HTMLInputElement
177
+ this.altTextChange.emit(input.value)
178
+ }
179
+
180
+ private filterTypeImage(files: File[]) {
181
+ return files.filter((file) => {
182
+ return file.type.startsWith('image/')
183
+ })
184
+ }
185
+
186
+ private resizeAndEmit(imageToResize: File) {
187
+ const maxSizeBytes = megabytesToBytes(this.maxSizeMB)
188
+ downgradeImage(imageToResize, maxSizeBytes).then((resizedImage) => {
189
+ const fileToEmit = new File([resizedImage], imageToResize.name)
190
+ this.fileChange.emit(fileToEmit)
191
+ })
192
+ }
193
+ }
@@ -2,11 +2,12 @@
2
2
  <textarea
3
3
  #input
4
4
  name="textArea"
5
+ [disabled]="disabled"
5
6
  [placeholder]="placeholder"
6
7
  [value]="value"
7
8
  (change)="handleChange($event)"
8
9
  (input)="handleChange($event)"
9
- class="w-full pt-2 pl-2 resize-none border border-gray-800 rounded italic leading-tight focus:outline-none focus:bg-background focus:border-primary"
10
+ [class]="classList"
10
11
  [attr.required]="required || null"
11
12
  ></textarea>
12
13
  </div>