ngx-edu-sharing-ui 0.7.0 → 9.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (367) hide show
  1. package/assets/scss/mixins.scss +4 -1
  2. package/assets/scss/variables.scss +3 -0
  3. package/esm2022/lib/actionbar/actionbar.component.mjs +188 -0
  4. package/esm2022/lib/common/edu-sharing-ui-common.module.mjs +134 -0
  5. package/esm2022/lib/directives/border-box-observer.directive.mjs +71 -0
  6. package/esm2022/lib/directives/check-text-overflow.directive.mjs +65 -0
  7. package/esm2022/lib/directives/drag-nodes/drag-nodes.mjs +14 -0
  8. package/esm2022/lib/directives/drag-nodes/nodes-drag-source.directive.mjs +79 -0
  9. package/esm2022/lib/directives/drag-nodes/nodes-drag.directive.mjs +49 -0
  10. package/esm2022/lib/directives/drag-nodes/nodes-drop-target.directive.mjs +105 -0
  11. package/esm2022/lib/directives/focus-state.directive.mjs +44 -0
  12. package/esm2022/lib/directives/icon.directive.mjs +139 -0
  13. package/esm2022/lib/dropdown/dropdown.component.mjs +70 -0
  14. package/esm2022/lib/edu-sharing-ui-configuration.mjs +41 -0
  15. package/esm2022/lib/edu-sharing-ui.module.mjs +78 -0
  16. package/esm2022/lib/list-items/available-widgets.mjs +27 -0
  17. package/esm2022/lib/list-items/format-duration.pipe.mjs +20 -0
  18. package/esm2022/lib/list-items/list-base/list-base.component.mjs +46 -0
  19. package/esm2022/lib/list-items/list-collection-info/list-collection-info.component.mjs +29 -0
  20. package/esm2022/lib/list-items/list-counts/list-counts.component.mjs +54 -0
  21. package/esm2022/lib/list-items/list-items.module.mjs +50 -0
  22. package/esm2022/lib/list-items/list-node-license/list-node-license.component.mjs +41 -0
  23. package/esm2022/lib/list-items/list-node-replication-source/list-node-replication-source.component.mjs +47 -0
  24. package/esm2022/lib/list-items/list-node-workflow/list-node-workflow.component.mjs +24 -0
  25. package/esm2022/lib/list-items/list-text/list-text.component.mjs +106 -0
  26. package/esm2022/lib/list-items/list-widget.mjs +49 -0
  27. package/esm2022/lib/list-items/node-row/node-row.component.mjs +24 -0
  28. package/esm2022/lib/list-items/node-source.pipe.mjs +49 -0
  29. package/esm2022/lib/node-entries/combined-data-source.mjs +41 -0
  30. package/esm2022/lib/node-entries/custom-templates-data-source.mjs +7 -0
  31. package/esm2022/lib/node-entries/drag-preview/drag-preview.component.mjs +21 -0
  32. package/esm2022/lib/node-entries/entries-model.mjs +23 -0
  33. package/esm2022/lib/node-entries/items-cap.mjs +47 -0
  34. package/esm2022/lib/node-entries/list-item-label.pipe.mjs +34 -0
  35. package/esm2022/lib/node-entries/node-cache.mjs +65 -0
  36. package/esm2022/lib/node-entries/node-data-source-remote.mjs +4 -0
  37. package/esm2022/lib/node-entries/node-data-source.mjs +115 -0
  38. package/esm2022/lib/node-entries/node-entries-card/node-entries-card.component.mjs +131 -0
  39. package/esm2022/lib/node-entries/node-entries-card-grid/node-entries-card-grid.component.mjs +307 -0
  40. package/esm2022/lib/node-entries/node-entries-card-small/node-entries-card-small.component.mjs +45 -0
  41. package/esm2022/lib/node-entries/node-entries-global-options/node-entries-global-options.component.mjs +23 -0
  42. package/esm2022/lib/node-entries/node-entries-global.service.mjs +58 -0
  43. package/esm2022/lib/node-entries/node-entries-table/column-chooser/column-chooser.component.mjs +42 -0
  44. package/esm2022/lib/node-entries/node-entries-table/node-entries-table.component.mjs +290 -0
  45. package/esm2022/lib/node-entries/node-entries-templates.service.mjs +11 -0
  46. package/esm2022/lib/node-entries/node-entries-wrapper.component.mjs +324 -0
  47. package/esm2022/lib/node-entries/node-entries.component.mjs +131 -0
  48. package/esm2022/lib/node-entries/node-entries.module.mjs +161 -0
  49. package/esm2022/lib/node-entries/node-rating/node-rating.component.mjs +102 -0
  50. package/esm2022/lib/node-entries/node-stats-badges/node-stats-badges.component.mjs +48 -0
  51. package/esm2022/lib/node-entries/node-type-badge/node-type-badge.component.mjs +36 -0
  52. package/esm2022/lib/node-entries/option-button/option-button.component.mjs +62 -0
  53. package/esm2022/lib/node-entries/preview-image/preview-image.component.mjs +53 -0
  54. package/esm2022/lib/node-entries/sort-select-panel/sort-select-panel.component.mjs +41 -0
  55. package/esm2022/lib/node-url/node-url.component.mjs +128 -0
  56. package/esm2022/lib/pipes/file-size.pipe.mjs +31 -0
  57. package/esm2022/lib/pipes/format-date.pipe.mjs +38 -0
  58. package/esm2022/lib/pipes/node-icon.pipe.mjs +18 -0
  59. package/esm2022/lib/pipes/node-image-size.pipe.mjs +24 -0
  60. package/esm2022/lib/pipes/node-image.pipe.mjs +55 -0
  61. package/esm2022/lib/pipes/node-person-name.pipe.mjs +50 -0
  62. package/esm2022/lib/pipes/node-title.pipe.mjs +19 -0
  63. package/esm2022/lib/pipes/option-tooltip.pipe.mjs +33 -0
  64. package/esm2022/lib/pipes/replace-chars.pipe.mjs +29 -0
  65. package/esm2022/lib/pipes/vcard-name.pipe.mjs +19 -0
  66. package/esm2022/lib/services/abstract/app.service.mjs +3 -0
  67. package/esm2022/lib/services/abstract/keyboard-shortcuts.service.mjs +10 -0
  68. package/esm2022/lib/services/abstract/options-helper.service.mjs +3 -0
  69. package/esm2022/lib/services/abstract/toast.service.mjs +3 -0
  70. package/esm2022/lib/services/accessibility.service.mjs +73 -0
  71. package/esm2022/lib/services/local-events.service.mjs +36 -0
  72. package/esm2022/lib/services/node-entries.service.mjs +137 -0
  73. package/esm2022/lib/services/node-helper.service.mjs +234 -0
  74. package/esm2022/lib/services/nodes-drag-drop.service.mjs +155 -0
  75. package/esm2022/lib/services/options-helper-data.service.mjs +134 -0
  76. package/esm2022/lib/services/repo-url.service.mjs +49 -0
  77. package/esm2022/lib/services/temporary-storage.service.mjs +48 -0
  78. package/esm2022/lib/services/ui.service.mjs +162 -0
  79. package/esm2022/lib/sort-dropdown/sort-dropdown.component.mjs +50 -0
  80. package/esm2022/lib/spinner/spinner.component.mjs +18 -0
  81. package/esm2022/lib/translations/fallback-translation-handler.mjs +6 -0
  82. package/esm2022/lib/translations/languages.mjs +5 -0
  83. package/esm2022/lib/translations/translation-loader.mjs +149 -0
  84. package/esm2022/lib/translations/translation-source.mjs +11 -0
  85. package/esm2022/lib/translations/translations.module.mjs +67 -0
  86. package/esm2022/lib/translations/translations.service.mjs +171 -0
  87. package/esm2022/lib/types/accessibillity.mjs +19 -0
  88. package/esm2022/lib/types/api-models.mjs +2 -0
  89. package/esm2022/lib/types/drag-drop.mjs +2 -0
  90. package/esm2022/lib/types/keyboard-shortcuts.mjs +11 -0
  91. package/esm2022/lib/types/list-item.mjs +41 -0
  92. package/esm2022/lib/types/option-item.mjs +174 -0
  93. package/esm2022/lib/types/workflow.mjs +25 -0
  94. package/esm2022/lib/util/DateHelper.mjs +200 -0
  95. package/esm2022/lib/util/VCard.mjs +278 -0
  96. package/esm2022/lib/util/color-helper.mjs +124 -0
  97. package/esm2022/lib/util/duration-helper.mjs +102 -0
  98. package/esm2022/lib/util/functions.mjs +13 -0
  99. package/esm2022/lib/util/helper.mjs +64 -0
  100. package/esm2022/lib/util/isNumeric.mjs +11 -0
  101. package/esm2022/lib/util/rest-helper.mjs +33 -0
  102. package/esm2022/lib/util/ui-animation.mjs +146 -0
  103. package/esm2022/lib/util/ui-constants.mjs +21 -0
  104. package/esm2022/module.mjs +76 -0
  105. package/esm2022/ngx-edu-sharing-ui.mjs +5 -0
  106. package/fesm2022/ngx-edu-sharing-ui.mjs +6509 -0
  107. package/fesm2022/ngx-edu-sharing-ui.mjs.map +1 -0
  108. package/index.d.ts +5 -0
  109. package/lib/actionbar/actionbar.component.d.ts +74 -0
  110. package/lib/common/edu-sharing-ui-common.module.d.ts +32 -0
  111. package/lib/directives/border-box-observer.directive.d.ts +31 -0
  112. package/lib/directives/check-text-overflow.directive.d.ts +20 -0
  113. package/lib/directives/drag-nodes/drag-nodes.d.ts +16 -0
  114. package/lib/directives/drag-nodes/nodes-drag-source.directive.d.ts +37 -0
  115. package/lib/directives/drag-nodes/nodes-drag.directive.d.ts +17 -0
  116. package/lib/directives/drag-nodes/nodes-drop-target.directive.d.ts +22 -0
  117. package/lib/directives/focus-state.directive.d.ts +14 -0
  118. package/lib/directives/icon.directive.d.ts +46 -0
  119. package/lib/dropdown/dropdown.component.d.ts +40 -0
  120. package/lib/edu-sharing-ui-configuration.d.ts +11 -0
  121. package/lib/edu-sharing-ui.module.d.ts +19 -0
  122. package/lib/list-items/available-widgets.d.ts +13 -0
  123. package/lib/list-items/format-duration.pipe.d.ts +10 -0
  124. package/lib/list-items/list-base/list-base.component.d.ts +18 -0
  125. package/lib/list-items/list-collection-info/list-collection-info.component.d.ts +14 -0
  126. package/lib/list-items/list-counts/list-counts.component.d.ts +13 -0
  127. package/lib/list-items/list-items.module.d.ts +20 -0
  128. package/lib/list-items/list-node-license/list-node-license.component.d.ts +20 -0
  129. package/lib/list-items/list-node-replication-source/list-node-replication-source.component.d.ts +22 -0
  130. package/lib/list-items/list-node-workflow/list-node-workflow.component.d.ts +12 -0
  131. package/lib/list-items/list-text/list-text.component.d.ts +28 -0
  132. package/lib/list-items/list-widget.d.ts +32 -0
  133. package/lib/list-items/node-row/node-row.component.d.ts +12 -0
  134. package/lib/list-items/node-source.pipe.d.ts +16 -0
  135. package/lib/node-entries/combined-data-source.d.ts +19 -0
  136. package/{src/lib/node-entries/custom-templates-data-source.ts → lib/node-entries/custom-templates-data-source.d.ts} +2 -2
  137. package/lib/node-entries/drag-preview/drag-preview.component.d.ts +11 -0
  138. package/{src/lib/node-entries/entries-model.ts → lib/node-entries/entries-model.d.ts} +19 -47
  139. package/lib/node-entries/items-cap.d.ts +17 -0
  140. package/lib/node-entries/list-item-label.pipe.d.ts +14 -0
  141. package/lib/node-entries/node-cache.d.ts +17 -0
  142. package/{src/lib/node-entries/node-data-source-remote.ts → lib/node-entries/node-data-source-remote.d.ts} +2 -12
  143. package/lib/node-entries/node-data-source.d.ts +42 -0
  144. package/lib/node-entries/node-entries-card/node-entries-card.component.d.ts +45 -0
  145. package/lib/node-entries/node-entries-card-grid/node-entries-card-grid.component.d.ts +92 -0
  146. package/lib/node-entries/node-entries-card-small/node-entries-card-small.component.d.ts +23 -0
  147. package/lib/node-entries/node-entries-global-options/node-entries-global-options.component.d.ts +12 -0
  148. package/lib/node-entries/node-entries-global.service.d.ts +50 -0
  149. package/lib/node-entries/node-entries-table/column-chooser/column-chooser.component.d.ts +17 -0
  150. package/lib/node-entries/node-entries-table/node-entries-table.component.d.ts +76 -0
  151. package/{src/lib/node-entries/node-entries-templates.service.ts → lib/node-entries/node-entries-templates.service.d.ts} +6 -9
  152. package/lib/node-entries/node-entries-wrapper.component.d.ts +129 -0
  153. package/lib/node-entries/node-entries.component.d.ts +32 -0
  154. package/lib/node-entries/node-entries.module.d.ts +43 -0
  155. package/lib/node-entries/node-rating/node-rating.component.d.ts +26 -0
  156. package/lib/node-entries/node-stats-badges/node-stats-badges.component.d.ts +17 -0
  157. package/lib/node-entries/node-type-badge/node-type-badge.component.d.ts +21 -0
  158. package/lib/node-entries/option-button/option-button.component.d.ts +11 -0
  159. package/lib/node-entries/preview-image/preview-image.component.d.ts +22 -0
  160. package/lib/node-entries/sort-select-panel/sort-select-panel.component.d.ts +16 -0
  161. package/lib/node-url/node-url.component.d.ts +51 -0
  162. package/lib/pipes/file-size.pipe.d.ts +10 -0
  163. package/lib/pipes/format-date.pipe.d.ts +21 -0
  164. package/lib/pipes/node-icon.pipe.d.ts +11 -0
  165. package/lib/pipes/node-image-size.pipe.d.ts +8 -0
  166. package/lib/pipes/node-image.pipe.d.ts +28 -0
  167. package/lib/pipes/node-person-name.pipe.d.ts +10 -0
  168. package/lib/pipes/node-title.pipe.d.ts +11 -0
  169. package/lib/pipes/option-tooltip.pipe.d.ts +12 -0
  170. package/lib/pipes/replace-chars.pipe.d.ts +10 -0
  171. package/lib/pipes/vcard-name.pipe.d.ts +10 -0
  172. package/{src/lib/services/abstract/app.service.ts → lib/services/abstract/app.service.d.ts} +1 -1
  173. package/lib/services/abstract/keyboard-shortcuts.service.d.ts +11 -0
  174. package/lib/services/abstract/options-helper.service.d.ts +10 -0
  175. package/{src/lib/services/abstract/toast.service.ts → lib/services/abstract/toast.service.d.ts} +1 -2
  176. package/lib/services/accessibility.service.d.ts +18 -0
  177. package/{src/lib/services/local-events.service.ts → lib/services/local-events.service.d.ts} +7 -10
  178. package/lib/services/node-entries.service.d.ts +69 -0
  179. package/lib/services/node-helper.service.d.ts +56 -0
  180. package/lib/services/nodes-drag-drop.service.d.ts +41 -0
  181. package/lib/services/options-helper-data.service.d.ts +75 -0
  182. package/lib/services/repo-url.service.d.ts +25 -0
  183. package/lib/services/temporary-storage.service.d.ts +35 -0
  184. package/lib/services/ui.service.d.ts +41 -0
  185. package/lib/sort-dropdown/sort-dropdown.component.d.ts +15 -0
  186. package/lib/spinner/spinner.component.d.ts +7 -0
  187. package/lib/translations/fallback-translation-handler.d.ts +4 -0
  188. package/lib/translations/languages.d.ts +4 -0
  189. package/lib/translations/translation-loader.d.ts +51 -0
  190. package/{src/lib/translations/translation-source.ts → lib/translations/translation-source.d.ts} +4 -4
  191. package/lib/translations/translations.module.d.ts +15 -0
  192. package/lib/translations/translations.service.d.ts +30 -0
  193. package/lib/types/accessibillity.d.ts +15 -0
  194. package/{src/lib/types/drag-drop.ts → lib/types/drag-drop.d.ts} +0 -3
  195. package/lib/types/keyboard-shortcuts.d.ts +10 -0
  196. package/lib/types/list-item.d.ts +55 -0
  197. package/lib/types/option-item.d.ts +236 -0
  198. package/lib/types/workflow.d.ts +14 -0
  199. package/lib/util/DateHelper.d.ts +44 -0
  200. package/lib/util/VCard.d.ts +66 -0
  201. package/lib/util/color-helper.d.ts +25 -0
  202. package/lib/util/duration-helper.d.ts +14 -0
  203. package/lib/util/functions.d.ts +4 -0
  204. package/lib/util/helper.d.ts +20 -0
  205. package/lib/util/isNumeric.d.ts +5 -0
  206. package/lib/util/rest-helper.d.ts +10 -0
  207. package/lib/util/ui-animation.d.ts +39 -0
  208. package/lib/util/ui-constants.d.ts +18 -0
  209. package/{src/module.ts → module.d.ts} +0 -4
  210. package/package.json +23 -9
  211. package/.browserslistrc +0 -16
  212. package/.eslintrc.json +0 -44
  213. package/karma.conf.js +0 -42
  214. package/ng-package.json +0 -10
  215. package/src/lib/actionbar/actionbar.component.html +0 -59
  216. package/src/lib/actionbar/actionbar.component.scss +0 -123
  217. package/src/lib/actionbar/actionbar.component.ts +0 -174
  218. package/src/lib/common/edu-sharing-ui-common.module.ts +0 -80
  219. package/src/lib/directives/border-box-observer.directive.ts +0 -75
  220. package/src/lib/directives/check-text-overflow.directive.ts +0 -61
  221. package/src/lib/directives/drag-nodes/drag-nodes.ts +0 -32
  222. package/src/lib/directives/drag-nodes/nodes-drag-source.directive.ts +0 -79
  223. package/src/lib/directives/drag-nodes/nodes-drag.directive.ts +0 -43
  224. package/src/lib/directives/drag-nodes/nodes-drop-target.directive.ts +0 -116
  225. package/src/lib/directives/focus-state.directive.ts +0 -34
  226. package/src/lib/directives/icon.directive.ts +0 -142
  227. package/src/lib/directives/nodes-drop-target-legacy.directive.ts +0 -155
  228. package/src/lib/dropdown/dropdown.component.html +0 -32
  229. package/src/lib/dropdown/dropdown.component.scss +0 -67
  230. package/src/lib/dropdown/dropdown.component.ts +0 -71
  231. package/src/lib/edu-sharing-ui-configuration.ts +0 -47
  232. package/src/lib/edu-sharing-ui.module.ts +0 -49
  233. package/src/lib/list-items/available-widgets.ts +0 -30
  234. package/src/lib/list-items/format-duration.pipe.ts +0 -17
  235. package/src/lib/list-items/list-base/list-base.component.html +0 -52
  236. package/src/lib/list-items/list-base/list-base.component.ts +0 -44
  237. package/src/lib/list-items/list-collection-info/list-collection-info.component.html +0 -48
  238. package/src/lib/list-items/list-collection-info/list-collection-info.component.scss +0 -8
  239. package/src/lib/list-items/list-collection-info/list-collection-info.component.ts +0 -24
  240. package/src/lib/list-items/list-counts/list-counts.component.html +0 -1
  241. package/src/lib/list-items/list-counts/list-counts.component.scss +0 -3
  242. package/src/lib/list-items/list-counts/list-counts.component.ts +0 -59
  243. package/src/lib/list-items/list-items.module.ts +0 -33
  244. package/src/lib/list-items/list-node-license/list-node-license.component.html +0 -8
  245. package/src/lib/list-items/list-node-license/list-node-license.component.ts +0 -47
  246. package/src/lib/list-items/list-node-replication-source/list-node-replication-source.component.html +0 -11
  247. package/src/lib/list-items/list-node-replication-source/list-node-replication-source.component.ts +0 -60
  248. package/src/lib/list-items/list-node-workflow/list-node-workflow.component.html +0 -3
  249. package/src/lib/list-items/list-node-workflow/list-node-workflow.component.ts +0 -21
  250. package/src/lib/list-items/list-text/list-text.component.html +0 -176
  251. package/src/lib/list-items/list-text/list-text.component.scss +0 -3
  252. package/src/lib/list-items/list-text/list-text.component.ts +0 -107
  253. package/src/lib/list-items/list-widget.ts +0 -52
  254. package/src/lib/list-items/node-row/node-row.component.html +0 -31
  255. package/src/lib/list-items/node-row/node-row.component.scss +0 -50
  256. package/src/lib/list-items/node-row/node-row.component.ts +0 -16
  257. package/src/lib/list-items/node-source.pipe.ts +0 -48
  258. package/src/lib/node-entries/combined-data-source.ts +0 -51
  259. package/src/lib/node-entries/drag-preview/drag-preview.component.html +0 -6
  260. package/src/lib/node-entries/drag-preview/drag-preview.component.scss +0 -35
  261. package/src/lib/node-entries/drag-preview/drag-preview.component.ts +0 -15
  262. package/src/lib/node-entries/items-cap.ts +0 -54
  263. package/src/lib/node-entries/list-item-label.pipe.ts +0 -28
  264. package/src/lib/node-entries/mixins.scss +0 -23
  265. package/src/lib/node-entries/node-cache.spec.ts +0 -199
  266. package/src/lib/node-entries/node-cache.ts +0 -81
  267. package/src/lib/node-entries/node-data-source.ts +0 -148
  268. package/src/lib/node-entries/node-entries-card/node-entries-card.component.html +0 -167
  269. package/src/lib/node-entries/node-entries-card/node-entries-card.component.scss +0 -28
  270. package/src/lib/node-entries/node-entries-card/node-entries-card.component.ts +0 -132
  271. package/src/lib/node-entries/node-entries-card/node-entries-card.main.scss +0 -261
  272. package/src/lib/node-entries/node-entries-card-grid/node-entries-card-grid.component.html +0 -205
  273. package/src/lib/node-entries/node-entries-card-grid/node-entries-card-grid.component.scss +0 -181
  274. package/src/lib/node-entries/node-entries-card-grid/node-entries-card-grid.component.ts +0 -361
  275. package/src/lib/node-entries/node-entries-card-small/node-entries-card-small.component.html +0 -100
  276. package/src/lib/node-entries/node-entries-card-small/node-entries-card-small.component.scss +0 -46
  277. package/src/lib/node-entries/node-entries-card-small/node-entries-card-small.component.ts +0 -40
  278. package/src/lib/node-entries/node-entries-global-options/node-entries-global-options.component.html +0 -23
  279. package/src/lib/node-entries/node-entries-global-options/node-entries-global-options.component.scss +0 -58
  280. package/src/lib/node-entries/node-entries-global-options/node-entries-global-options.component.ts +0 -16
  281. package/src/lib/node-entries/node-entries-global.service.ts +0 -79
  282. package/src/lib/node-entries/node-entries-table/column-chooser/column-chooser.component.html +0 -25
  283. package/src/lib/node-entries/node-entries-table/column-chooser/column-chooser.component.scss +0 -32
  284. package/src/lib/node-entries/node-entries-table/column-chooser/column-chooser.component.ts +0 -31
  285. package/src/lib/node-entries/node-entries-table/node-entries-table.component.html +0 -270
  286. package/src/lib/node-entries/node-entries-table/node-entries-table.component.scss +0 -169
  287. package/src/lib/node-entries/node-entries-table/node-entries-table.component.ts +0 -333
  288. package/src/lib/node-entries/node-entries-wrapper.component.ts +0 -363
  289. package/src/lib/node-entries/node-entries.component.html +0 -33
  290. package/src/lib/node-entries/node-entries.component.scss +0 -13
  291. package/src/lib/node-entries/node-entries.component.ts +0 -151
  292. package/src/lib/node-entries/node-entries.module.ts +0 -93
  293. package/src/lib/node-entries/node-rating/node-rating.component.html +0 -53
  294. package/src/lib/node-entries/node-rating/node-rating.component.scss +0 -31
  295. package/src/lib/node-entries/node-rating/node-rating.component.ts +0 -105
  296. package/src/lib/node-entries/node-stats-badges/node-stats-badges.component.html +0 -39
  297. package/src/lib/node-entries/node-stats-badges/node-stats-badges.component.scss +0 -44
  298. package/src/lib/node-entries/node-stats-badges/node-stats-badges.component.ts +0 -43
  299. package/src/lib/node-entries/node-type-badge/node-type-badge.component.html +0 -31
  300. package/src/lib/node-entries/node-type-badge/node-type-badge.component.scss +0 -5
  301. package/src/lib/node-entries/node-type-badge/node-type-badge.component.ts +0 -36
  302. package/src/lib/node-entries/option-button/option-button.component.ts +0 -42
  303. package/src/lib/node-entries/preview-image/preview-image.component.html +0 -19
  304. package/src/lib/node-entries/preview-image/preview-image.component.scss +0 -31
  305. package/src/lib/node-entries/preview-image/preview-image.component.ts +0 -47
  306. package/src/lib/node-entries/sort-select-panel/sort-select-panel.component.html +0 -27
  307. package/src/lib/node-entries/sort-select-panel/sort-select-panel.component.scss +0 -9
  308. package/src/lib/node-entries/sort-select-panel/sort-select-panel.component.ts +0 -26
  309. package/src/lib/node-url/node-url.component.html +0 -66
  310. package/src/lib/node-url/node-url.component.scss +0 -32
  311. package/src/lib/node-url/node-url.component.ts +0 -136
  312. package/src/lib/pipes/file-size.pipe.ts +0 -24
  313. package/src/lib/pipes/format-date.pipe.ts +0 -39
  314. package/src/lib/pipes/node-icon.pipe.ts +0 -11
  315. package/src/lib/pipes/node-image-size.pipe.ts +0 -18
  316. package/src/lib/pipes/node-image.pipe.ts +0 -71
  317. package/src/lib/pipes/node-person-name.pipe.ts +0 -41
  318. package/src/lib/pipes/node-title.pipe.ts +0 -12
  319. package/src/lib/pipes/option-tooltip.pipe.ts +0 -32
  320. package/src/lib/pipes/replace-chars.pipe.ts +0 -21
  321. package/src/lib/pipes/vcard-name.pipe.ts +0 -11
  322. package/src/lib/services/abstract/keyboard-shortcuts.service.ts +0 -10
  323. package/src/lib/services/abstract/options-helper.service.ts +0 -29
  324. package/src/lib/services/accessibility.service.ts +0 -101
  325. package/src/lib/services/node-entries.service.ts +0 -172
  326. package/src/lib/services/node-helper.service.ts +0 -239
  327. package/src/lib/services/nodes-drag-drop.service.ts +0 -165
  328. package/src/lib/services/options-helper-data.service.ts +0 -186
  329. package/src/lib/services/repo-url.service.ts +0 -46
  330. package/src/lib/services/temporary-storage.service.ts +0 -58
  331. package/src/lib/services/ui.service.ts +0 -182
  332. package/src/lib/sort-dropdown/sort-dropdown.component.html +0 -22
  333. package/src/lib/sort-dropdown/sort-dropdown.component.scss +0 -47
  334. package/src/lib/sort-dropdown/sort-dropdown.component.ts +0 -42
  335. package/src/lib/spinner/spinner.component.html +0 -14
  336. package/src/lib/spinner/spinner.component.scss +0 -141
  337. package/src/lib/spinner/spinner.component.ts +0 -12
  338. package/src/lib/translations/README.md +0 -44
  339. package/src/lib/translations/fallback-translation-handler.ts +0 -7
  340. package/src/lib/translations/languages.ts +0 -6
  341. package/src/lib/translations/translation-loader.spec.ts +0 -352
  342. package/src/lib/translations/translation-loader.ts +0 -189
  343. package/src/lib/translations/translations.module.ts +0 -49
  344. package/src/lib/translations/translations.service.spec.ts +0 -152
  345. package/src/lib/translations/translations.service.ts +0 -188
  346. package/src/lib/types/accessibillity.ts +0 -15
  347. package/src/lib/types/keyboard-shortcuts.ts +0 -29
  348. package/src/lib/types/list-item.ts +0 -67
  349. package/src/lib/types/option-item.ts +0 -247
  350. package/src/lib/types/workflow.ts +0 -35
  351. package/src/lib/util/DateHelper.spec.ts +0 -112
  352. package/src/lib/util/DateHelper.ts +0 -197
  353. package/src/lib/util/VCard.ts +0 -277
  354. package/src/lib/util/color-helper.ts +0 -125
  355. package/src/lib/util/duration-helper.spec.ts +0 -35
  356. package/src/lib/util/duration-helper.ts +0 -98
  357. package/src/lib/util/functions.ts +0 -15
  358. package/src/lib/util/helper.ts +0 -60
  359. package/src/lib/util/isNumeric.ts +0 -13
  360. package/src/lib/util/rest-helper.ts +0 -28
  361. package/src/lib/util/ui-animation.ts +0 -154
  362. package/src/lib/util/ui-constants.ts +0 -20
  363. package/src/test.ts +0 -28
  364. package/tsconfig.lib.json +0 -15
  365. package/tsconfig.lib.prod.json +0 -10
  366. package/tsconfig.spec.json +0 -17
  367. /package/{src/lib/types/api-models.ts → lib/types/api-models.d.ts} +0 -0
@@ -1,32 +0,0 @@
1
- @import '../../../assets/scss/mixins';
2
-
3
- :host {
4
- // Draw focus highlight above content background
5
- position: relative;
6
- // Make `overflow: hidden` for ripples work for `a`
7
- display: flex;
8
- & > * {
9
- flex-grow: 1;
10
- }
11
- > a {
12
- text-decoration: none;
13
- }
14
- }
15
-
16
- // Handle keyboard focus.
17
- //
18
- // If doing this here becomes a problem, consider introducing an input parameter to disable this.
19
- .cdk-keyboard-focused {
20
- @include setGlobalKeyboardFocus();
21
- }
22
-
23
- button {
24
- background-color: unset;
25
- border: unset;
26
- padding: unset;
27
- text-align: unset;
28
- }
29
-
30
- div.node-url-wrapper {
31
- cursor: pointer;
32
- }
@@ -1,136 +0,0 @@
1
- import {
2
- AfterViewInit,
3
- Component,
4
- ElementRef,
5
- EventEmitter,
6
- Input,
7
- Output,
8
- ViewChild,
9
- } from '@angular/core';
10
- import { Node } from 'ngx-edu-sharing-api';
11
- import { NodeHelperService } from '../services/node-helper.service';
12
-
13
- // TODO: Decide if providing focus highlights and ripples with this component is a good idea. When
14
- // using `app-node-url` for cards, we might need highlights and ripples for the whole card while
15
- // `app-node-url` should only wrap the title since links with lots of content confuse screen
16
- // readers.
17
-
18
- const NODE_URL_TAG_NAME = 'es-node-url';
19
-
20
- @Component({
21
- selector: NODE_URL_TAG_NAME,
22
- templateUrl: 'node-url.component.html',
23
- styleUrls: ['node-url.component.scss'],
24
- })
25
- export class NodeUrlComponent implements AfterViewInit {
26
- @ViewChild('link') link: ElementRef<HTMLAnchorElement>;
27
-
28
- @Input() node: Node;
29
- @Input() nodes: Node[];
30
- @Input() target: string;
31
- @Input() scope: string;
32
- /**
33
- * custom query params to include
34
- */
35
- @Input() queryParams: { [key: string]: string | number | boolean } = {};
36
- /**
37
- * link: a element
38
- * button: button element
39
- * wrapper: div element with behavior "like" a link
40
- */
41
- @Input() mode: 'link' | 'button' | 'wrapper' = 'link';
42
- @Input() disabled = false;
43
- /**
44
- * Show the ripple effect even when disabled.
45
- *
46
- * @deprecated Temporary workaround for list-table, which *sometimes* uses it's on click
47
- * bindings.
48
- */
49
- @Input() alwaysRipple = false;
50
- @Input('aria-describedby') ariaDescribedby: string;
51
- @Input('aria-label') ariaLabel = true;
52
-
53
- @Output() buttonClick = new EventEmitter<MouseEvent>();
54
-
55
- /**
56
- * Whether this instance of `NodeUrl` is nested inside another `NodeUrl`.
57
- */
58
- // We use nested `NodeUrl`s for a11y where we have a `NodeUrl` in wrapper mode to maximize
59
- // clickable area and one in link mode that only contains the title. We only want the outmost
60
- // `NodeUrl` to apply the ripple effect.
61
- //
62
- // Note that nesting `NodeUrl`s is only necessary when we want to provide hover effects on parts
63
- // of the outer `NodeUrl`. If we don't need that, it would be easier to attach a pseudo `:after`
64
- // element to the inner `NodeUrl` that expands its click area.
65
- isNested: boolean;
66
-
67
- constructor(
68
- private nodeHelper: NodeHelperService,
69
- private elementRef: ElementRef<HTMLElement>,
70
- ) {}
71
-
72
- ngAfterViewInit(): void {
73
- setTimeout(() => {
74
- this.isNested = this.getIsNested();
75
- });
76
- }
77
-
78
- getState() {
79
- return {
80
- scope: this.scope,
81
- };
82
- }
83
-
84
- get(mode: 'routerLink' | 'queryParams'): any {
85
- const result: any = this.nodeHelper.getNodeLink(mode, this.node);
86
- if (mode === 'queryParams' && this.queryParams) {
87
- Object.keys(this.queryParams).forEach((k) => (result[k] = this.queryParams[k]));
88
- }
89
- return result;
90
- }
91
-
92
- focus(): void {
93
- this.link.nativeElement.focus();
94
- }
95
-
96
- clickWrapper(event: MouseEvent) {
97
- const eventCopy = copyClickEvent(event);
98
- this.link.nativeElement.dispatchEvent(eventCopy);
99
- event.preventDefault();
100
- }
101
-
102
- private getIsNested(): boolean {
103
- let ancestor = this.elementRef.nativeElement.parentElement;
104
- while (ancestor) {
105
- if (ancestor.tagName === NODE_URL_TAG_NAME.toUpperCase()) {
106
- return true;
107
- }
108
- ancestor = ancestor.parentElement;
109
- }
110
- return false;
111
- }
112
- }
113
-
114
- function copyClickEvent(event: MouseEvent): MouseEvent {
115
- // On Firefox, a middle click via neither the 'click', nor the 'auxclick' event cause a new tab
116
- // to be opened when triggered programmatically. As a workaround, we simulate a ctrl click
117
- // instead of a middle click. This matches Firefox's defaults, but we cannot account for
118
- // changed middle-click behavior.
119
- if (event.type === 'auxclick' && event.button === 1 && isFirefox()) {
120
- return copyClickEvent({ ...event, type: 'click', ctrlKey: true, button: 0 });
121
- }
122
- // It would seem better to use `event.type` instead of hard-coding 'click', but that doesn't
123
- // have the desired effect for non-click events when dispatched.
124
- return new MouseEvent('click', {
125
- cancelable: true,
126
- button: event.button,
127
- ctrlKey: event.ctrlKey,
128
- shiftKey: event.shiftKey,
129
- altKey: event.altKey,
130
- metaKey: event.metaKey,
131
- });
132
- }
133
-
134
- function isFirefox(): boolean {
135
- return navigator.userAgent.includes('Firefox');
136
- }
@@ -1,24 +0,0 @@
1
- import { PipeTransform, Pipe } from '@angular/core';
2
- import { TranslateService } from '@ngx-translate/core';
3
-
4
- @Pipe({ name: 'formatSize' })
5
- export class FormatSizePipe implements PipeTransform {
6
- constructor(private translate: TranslateService) {}
7
-
8
- transform(value: any, args: string[] = null): string {
9
- let names = ['bytes', 'KB', 'MB', 'GB', 'TB'];
10
- let i = 0;
11
- if (isNaN(value)) return value;
12
- if (value == null) value = 0;
13
- while (value >= 1024 && i < names.length) {
14
- value /= 1024;
15
- i++;
16
- }
17
- //return value+" "+names[i];
18
- return (
19
- value.toLocaleString(this.translate.currentLang, { maximumFractionDigits: 1 }) +
20
- ' ' +
21
- names[i]
22
- );
23
- }
24
- }
@@ -1,39 +0,0 @@
1
- import { Pipe, PipeTransform } from '@angular/core';
2
- import { TranslateService } from '@ngx-translate/core';
3
- import * as rxjs from 'rxjs';
4
- import { Observable } from 'rxjs';
5
- import { map } from 'rxjs/operators';
6
- import { DateHelper, FormatOptions } from '../util/DateHelper';
7
-
8
- @Pipe({ name: 'formatDate' })
9
- export class FormatDatePipe implements PipeTransform {
10
- constructor(private translate: TranslateService) {}
11
-
12
- transform(
13
- value: Date | number | string,
14
- args?: { time?: boolean; date?: boolean; relative?: boolean },
15
- ): string;
16
- transform(
17
- value: Date | number | string,
18
- args: { time?: boolean; date?: boolean; relative?: boolean; async: true },
19
- ): Observable<string>;
20
- transform(
21
- value: Date | number | string,
22
- args: { time?: boolean; date?: boolean; relative?: boolean; async?: boolean } = null,
23
- ): string | Observable<string> {
24
- if (!value) {
25
- return args?.async ? rxjs.of('') : '';
26
- }
27
- let options = new FormatOptions();
28
- if (args && args.time != null) options.showAlwaysTime = args.time;
29
- if (args && args.date != null) options.showDate = args.date;
30
- if (args && args.relative !== null) options.useRelativeLabels = args.relative;
31
- if (args?.async) {
32
- return this.translate
33
- .get('dummy') // Wait for the translation service to be ready
34
- .pipe(map(() => DateHelper.formatDate(this.translate, value, options)));
35
- } else {
36
- return DateHelper.formatDate(this.translate, value, options);
37
- }
38
- }
39
- }
@@ -1,11 +0,0 @@
1
- import { Pipe, PipeTransform } from '@angular/core';
2
- import { Node } from 'ngx-edu-sharing-api';
3
- import { RepoUrlService } from '../services/repo-url.service';
4
-
5
- @Pipe({ name: 'esNodeIcon' })
6
- export class NodeIconPipe implements PipeTransform {
7
- constructor(private repoUrlService: RepoUrlService) {}
8
- transform(node: Node) {
9
- return this.repoUrlService.getRepoUrl(node.iconURL, node);
10
- }
11
- }
@@ -1,18 +0,0 @@
1
- import { PipeTransform, Pipe } from '@angular/core';
2
- import { Node, RestConstants } from 'ngx-edu-sharing-api';
3
-
4
- @Pipe({ name: 'NodeImageSize' })
5
- export class NodeImageSizePipe implements PipeTransform {
6
- transform(node: Node, args: any = null): string {
7
- const width = parseFloat(node.properties[RestConstants.CCM_PROP_WIDTH]?.[0]);
8
- const height = parseFloat(node.properties[RestConstants.CCM_PROP_HEIGHT]?.[0]);
9
- const megapixel = Math.round((width * height) / 1000000);
10
- if (width && height) {
11
- if (megapixel > 1) {
12
- return megapixel + ' Megapixel';
13
- }
14
- return Math.round(width) + 'x' + Math.round(height);
15
- }
16
- return '';
17
- }
18
- }
@@ -1,71 +0,0 @@
1
- import { Pipe, PipeTransform } from '@angular/core';
2
- import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
3
- import { NetworkService } from 'ngx-edu-sharing-api';
4
- import * as rxjs from 'rxjs';
5
- import { Observable } from 'rxjs';
6
- import { map, switchMap } from 'rxjs/operators';
7
- import { NodeHelperService } from '../services/node-helper.service';
8
- import { Node } from 'ngx-edu-sharing-api';
9
- import { RepoUrlService } from '../services/repo-url.service';
10
- import { RestConstants } from 'ngx-edu-sharing-api';
11
-
12
- interface NodeImagePreferences {
13
- crop?: boolean;
14
- maxWidth?: number;
15
- maxHeight?: number;
16
- width?: number;
17
- height?: number;
18
- }
19
-
20
- @Pipe({ name: 'esNodeImage' })
21
- export class NodeImagePipe implements PipeTransform {
22
- constructor(
23
- private nodeHelper: NodeHelperService,
24
- private sanitizer: DomSanitizer,
25
- private repoUrlService: RepoUrlService,
26
- private networkApi: NetworkService,
27
- ) {}
28
-
29
- transform(node: Node, preferences: NodeImagePreferences): Observable<SafeResourceUrl> {
30
- if (this.nodeHelper.isNodeCollection(node) && node.preview.isIcon) {
31
- return null;
32
- } else if (node.preview.data) {
33
- return rxjs.of(
34
- this.sanitizer.bypassSecurityTrustResourceUrl(
35
- 'data:' + node.preview.mimetype + ';base64,' + node.preview.data,
36
- ),
37
- );
38
- } else {
39
- return this.getPreviewUrl(node, preferences);
40
- }
41
- }
42
-
43
- private getPreviewUrl(node: Node, preferences: NodeImagePreferences): Observable<string> {
44
- return this.isEduSharingNode(node).pipe(
45
- switchMap(async (isEduSharingNode) => {
46
- let url = await this.repoUrlService.getRepoUrl(node.preview.url, node);
47
- if (isEduSharingNode) {
48
- url += Object.entries(preferences)
49
- .map(([key, value]) => `&${key}=${value}`)
50
- .join('');
51
- }
52
- return url;
53
- }),
54
- );
55
- }
56
-
57
- private isEduSharingNode(node: Node): Observable<boolean> {
58
- return rxjs
59
- .forkJoin([
60
- this.networkApi.isFromHomeRepository(node),
61
- this.networkApi.getRepositoryOfNode(node),
62
- ])
63
- .pipe(
64
- map(
65
- ([isFromHomeRepository, repository]) =>
66
- isFromHomeRepository ||
67
- repository?.repositoryType === RestConstants.REPOSITORY_TYPE_ALFRESCO,
68
- ),
69
- );
70
- }
71
- }
@@ -1,41 +0,0 @@
1
- import { Pipe, PipeTransform } from '@angular/core';
2
- import { ConfigService, Person } from 'ngx-edu-sharing-api';
3
-
4
- @Pipe({ name: 'nodePersonName' })
5
- export class NodePersonNamePipe implements PipeTransform {
6
- constructor(private config: ConfigService) {}
7
- transform(person: Person | any, args: any = null): string {
8
- let field = this.config.instant('userDisplayName', 'fullName');
9
- if (person == null) return null;
10
- if (field == 'authorityName') {
11
- if (person.authorityName == null) field = 'fullName';
12
- else return person.authorityName;
13
- }
14
- if (field == 'fullName') {
15
- if (person.profile) {
16
- return (
17
- (person.profile.firstName ? person.profile.firstName : '') +
18
- ' ' +
19
- (person.profile.lastName ? person.profile.lastName : '')
20
- ).trim();
21
- }
22
- return (
23
- (person.firstName ? person.firstName : '') +
24
- ' ' +
25
- (person.lastName ? person.lastName : '')
26
- ).trim();
27
- }
28
- if (field == 'firstName' || field == 'lastName') {
29
- if (person.profile) {
30
- return person.profile[field];
31
- }
32
- return person[field];
33
- }
34
- if (field == 'email') {
35
- if (person.profile && person.profile.email) return person.profile.email;
36
- if (person.email == null) return person.mailbox;
37
- return person.email;
38
- }
39
- return person[field];
40
- }
41
- }
@@ -1,12 +0,0 @@
1
- import { PipeTransform, Pipe } from '@angular/core';
2
- import { TranslateService } from '@ngx-translate/core';
3
- import { Node } from 'ngx-edu-sharing-api';
4
- import { RestHelper } from '../util/rest-helper';
5
-
6
- @Pipe({ name: 'nodeTitle' })
7
- export class NodeTitlePipe implements PipeTransform {
8
- transform(node: Node, args: string[] = null): string {
9
- return RestHelper.getTitle(node);
10
- }
11
- constructor(private translate: TranslateService) {}
12
- }
@@ -1,32 +0,0 @@
1
- import { Pipe, PipeTransform } from '@angular/core';
2
- import { TranslateService } from '@ngx-translate/core';
3
- import { OptionItem } from '../types/option-item';
4
-
5
- @Pipe({ name: 'optionTooltip' })
6
- export class OptionTooltipPipe implements PipeTransform {
7
- constructor(private translate: TranslateService) {}
8
-
9
- transform(option: OptionItem, args: string[] = null): string {
10
- return (
11
- this.translate.instant(option.name) +
12
- (option.keyboardShortcut ? ' (' + this.getKeyInfo(option) + ')' : '')
13
- );
14
- }
15
-
16
- getKeyInfo(option: OptionItem) {
17
- if (!option.keyboardShortcut) {
18
- return '';
19
- }
20
- const modifiers = [];
21
- if (option.keyboardShortcut.modifiers?.includes('Shift')) {
22
- modifiers.push(this.translate.instant('KEY_MODIFIER.SHIFT'));
23
- }
24
- if (option.keyboardShortcut.modifiers?.includes('Ctrl/Cmd')) {
25
- modifiers.push(this.translate.instant('KEY_MODIFIER.CTRL'));
26
- }
27
- return (
28
- (modifiers.length ? modifiers.join(' + ') + ' + ' : '') +
29
- option.keyboardShortcut.keyCode.replace('Key', '')
30
- );
31
- }
32
- }
@@ -1,21 +0,0 @@
1
- import { Pipe, PipeTransform } from '@angular/core';
2
- import { TranslateService } from '@ngx-translate/core';
3
-
4
- @Pipe({ name: 'replaceChars' })
5
- export class ReplaceCharsPipe implements PipeTransform {
6
- transform(value: string, args: any): string {
7
- let i = 0;
8
- if (!Array.isArray(args.search)) {
9
- args.search = [args.search];
10
- }
11
- if (args.replace && !Array.isArray(args.replace)) {
12
- args.replace = [args.replace];
13
- }
14
- for (let arg of args.search) {
15
- value = value.split(arg).join(args.replace ? args.replace[i] : '');
16
- i++;
17
- }
18
- return value;
19
- }
20
- constructor(private translate: TranslateService) {}
21
- }
@@ -1,11 +0,0 @@
1
- import { Pipe, PipeTransform } from '@angular/core';
2
- import { TranslateService } from '@ngx-translate/core';
3
- import { VCard } from '../util/VCard';
4
-
5
- @Pipe({ name: 'vcardName' })
6
- export class VCardNamePipe implements PipeTransform {
7
- constructor(private translate: TranslateService) {}
8
- transform(authority: string, args: string[] = null): string {
9
- return authority ? new VCard(authority).getDisplayName() : '';
10
- }
11
- }
@@ -1,10 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { KeyboardShortcut } from '../../types/keyboard-shortcuts';
3
- import { Observable } from 'rxjs';
4
-
5
- @Injectable()
6
- export abstract class KeyboardShortcutsService {
7
- abstract register(shortcuts: KeyboardShortcut[], { until }: { until: Observable<void> }): void;
8
-
9
- abstract shouldIgnoreShortcut(event: KeyboardEvent): boolean;
10
- }
@@ -1,29 +0,0 @@
1
- import { OptionData, OptionsHelperComponents } from '../options-helper-data.service';
2
- import { OptionItem, Target } from '../../types/option-item';
3
- import { Node } from 'ngx-edu-sharing-api';
4
-
5
- export abstract class OptionsHelperService {
6
- abstract wrapOptionCallbacks(data: OptionData): OptionData;
7
-
8
- abstract refreshComponents(
9
- components: OptionsHelperComponents,
10
- data: OptionData,
11
- refreshListOptions: boolean,
12
- ): void;
13
-
14
- abstract getAvailableOptions(
15
- target: Target,
16
- objects: Node[],
17
- components: OptionsHelperComponents,
18
- data: OptionData,
19
- ): OptionItem[];
20
-
21
- abstract pasteNode(components: OptionsHelperComponents, data: OptionData, nodes: Node[]): void;
22
-
23
- abstract filterOptions(
24
- options: OptionItem[],
25
- target: Target,
26
- data: OptionData,
27
- objects: Node[] | any,
28
- ): OptionItem[];
29
- }
@@ -1,101 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import * as rxjs from 'rxjs';
3
- import { Observable } from 'rxjs';
4
- import { first, map } from 'rxjs/operators';
5
- import { AccessibilitySettings } from '../types/accessibillity';
6
- import { SessionStorageService } from 'ngx-edu-sharing-api';
7
-
8
- @Injectable({
9
- providedIn: 'root',
10
- })
11
- export class AccessibilityService {
12
- private static readonly STORAGE_PREFIX = 'accessibility_';
13
-
14
- constructor(private storage: SessionStorageService) {}
15
-
16
- async set(accessibilitySettings: Partial<AccessibilitySettings>): Promise<void> {
17
- const currentValues = await this.observeAll().pipe(first()).toPromise();
18
- const values = Object.entries(accessibilitySettings)
19
- .filter(
20
- ([key, value]) =>
21
- // check if value has been modified
22
- (currentValues as any)[key] !== value,
23
- )
24
- .reduce((acc, [key, value]) => {
25
- acc[AccessibilityService.STORAGE_PREFIX + key] = value;
26
- return acc;
27
- }, {} as { [key: string]: any });
28
- if (Object.keys(values).length > 0) {
29
- return this.storage.setValues(values);
30
- }
31
- }
32
-
33
- observe<K extends keyof AccessibilitySettings>(key: K): Observable<AccessibilitySettings[K]>;
34
- observe<K extends keyof AccessibilitySettings>(
35
- keys: K[],
36
- ): Observable<Pick<AccessibilitySettings, K>>;
37
- observe(): Observable<AccessibilitySettings>;
38
- observe<K extends keyof AccessibilitySettings>(
39
- keyOrKeys?: K | K[],
40
- ): Observable<AccessibilitySettings[K] | Pick<AccessibilitySettings, K>> {
41
- if (typeof keyOrKeys === 'string') {
42
- return this.observeSingle(keyOrKeys);
43
- } else if (Array.isArray(keyOrKeys)) {
44
- return this.observeMultiple(keyOrKeys);
45
- } else {
46
- return this.observeAll();
47
- }
48
- }
49
-
50
- private observeSingle<K extends keyof AccessibilitySettings>(
51
- key: K,
52
- ): Observable<AccessibilitySettings[K]> {
53
- const defaultValues = new AccessibilitySettings();
54
- return this.storage.observe(AccessibilityService.STORAGE_PREFIX + key, defaultValues[key]);
55
- }
56
-
57
- private observeMultiple<K extends keyof AccessibilitySettings>(
58
- keys: K[],
59
- ): Observable<Pick<AccessibilitySettings, K>> {
60
- const defaultValues = new AccessibilitySettings();
61
- return combineLatest(
62
- keys.reduce((acc, key) => {
63
- acc[key] = this.storage.observe(
64
- AccessibilityService.STORAGE_PREFIX + key,
65
- defaultValues[key],
66
- );
67
- return acc;
68
- }, {} as { [key in keyof AccessibilitySettings]: Observable<AccessibilitySettings[key]> }),
69
- );
70
- }
71
-
72
- private observeAll(): Observable<AccessibilitySettings> {
73
- return this.observeMultiple(
74
- Object.keys(new AccessibilitySettings()) as Array<keyof AccessibilitySettings>,
75
- );
76
- }
77
- }
78
-
79
- /**
80
- * Rxjs.combineLatest on objects instead of arrays.
81
- *
82
- * This is a standard function in Rxjs 7, but we wrap it here for Rxjs 6.
83
- */
84
- function combineLatest<T, K extends keyof T>(sources: {
85
- [key in K]: Observable<T[key]>;
86
- }): Observable<T> {
87
- return rxjs
88
- .combineLatest(
89
- Object.entries(sources).map(([key, source]) =>
90
- (source as Observable<T[K]>).pipe(map((result) => ({ key, result }))),
91
- ),
92
- )
93
- .pipe(
94
- map((results) =>
95
- results.reduce((acc, { key, result }) => {
96
- acc[key as K] = result;
97
- return acc;
98
- }, {} as T),
99
- ),
100
- );
101
- }