@alfresco/aca-shared 2.0.1 → 4.0.0-4895381898

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (248) hide show
  1. package/README.md +7 -6
  2. package/esm2020/lib/adf-extensions/extensions-data-loader.guard.mjs +73 -0
  3. package/esm2020/lib/components/document-base-page/document-base-page.component.mjs +176 -0
  4. package/esm2020/lib/components/document-base-page/document-base-page.service.mjs +26 -0
  5. package/esm2020/lib/components/generic-error/generic-error.component.mjs +41 -0
  6. package/esm2020/lib/components/generic-error/generic-error.module.mjs +44 -0
  7. package/esm2020/lib/components/info-drawer/info-drawer.component.mjs +123 -0
  8. package/esm2020/lib/components/info-drawer/shared-info-drawer.module.mjs +46 -0
  9. package/esm2020/lib/components/locked-by/locked-by.component.mjs +52 -0
  10. package/esm2020/lib/components/locked-by/locked-by.module.mjs +44 -0
  11. package/esm2020/lib/components/open-in-app/open-in-app.component.mjs +58 -0
  12. package/esm2020/lib/components/page-layout/page-layout-content.component.mjs +48 -0
  13. package/esm2020/lib/components/page-layout/page-layout-error.component.mjs +40 -0
  14. package/esm2020/lib/components/page-layout/page-layout-header.component.mjs +40 -0
  15. package/esm2020/lib/components/page-layout/page-layout.component.mjs +57 -0
  16. package/esm2020/lib/components/page-layout/page-layout.module.mjs +47 -0
  17. package/esm2020/lib/components/tool-bar/shared-toolbar.module.mjs +46 -0
  18. package/esm2020/lib/components/tool-bar/toolbar-action/toolbar-action.component.mjs +59 -0
  19. package/esm2020/lib/components/tool-bar/toolbar-button/toolbar-button.component.mjs +69 -0
  20. package/esm2020/lib/components/tool-bar/toolbar-menu/toolbar-menu.component.mjs +82 -0
  21. package/esm2020/lib/components/tool-bar/toolbar-menu-item/toolbar-menu-item.component.mjs +68 -0
  22. package/esm2020/lib/directives/contextmenu/contextmenu.directive.mjs +106 -0
  23. package/esm2020/lib/directives/contextmenu/contextmenu.module.mjs +42 -0
  24. package/esm2020/lib/directives/pagination.directive.mjs +54 -0
  25. package/esm2020/lib/directives/shared.directives.module.mjs +41 -0
  26. package/esm2020/lib/models/modal-configuration.mjs +25 -0
  27. package/esm2020/lib/models/types.mjs +25 -0
  28. package/esm2020/lib/models/viewer.rules.mjs +25 -0
  29. package/esm2020/lib/routing/shared.guard.mjs +48 -0
  30. package/esm2020/lib/services/aca-file-auto-download.service.mjs +55 -0
  31. package/esm2020/lib/services/aca-mobile-app-switcher.service.mjs +107 -0
  32. package/esm2020/lib/services/alfresco-office-extension.service.mjs +63 -0
  33. package/esm2020/lib/services/app-hook.service.mjs +87 -0
  34. package/esm2020/lib/services/app.extension.service.mjs +444 -0
  35. package/esm2020/lib/services/app.service.mjs +223 -0
  36. package/esm2020/lib/services/content-api.service.mjs +266 -0
  37. package/esm2020/lib/services/node-permission.service.mjs +89 -0
  38. package/esm2020/lib/services/router.extension.service.mjs +105 -0
  39. package/esm2020/lib/shared.module.mjs +54 -0
  40. package/esm2020/lib/testing/lib-testing-module.mjs +115 -0
  41. package/esm2020/lib/utils/node.utils.mjs +42 -0
  42. package/esm2020/public-api.mjs +62 -0
  43. package/esm2020/rules/app.rules.mjs +526 -0
  44. package/esm2020/rules/navigation.rules.mjs +156 -0
  45. package/esm2020/rules/public-api.mjs +28 -0
  46. package/esm2020/rules/repository.rules.mjs +33 -0
  47. package/esm2020/rules/user.rules.mjs +29 -0
  48. package/esm2020/store/actions/app-action-types.mjs +46 -0
  49. package/esm2020/store/actions/app.actions.mjs +128 -0
  50. package/esm2020/store/actions/context-menu-action-types.mjs +28 -0
  51. package/esm2020/store/actions/contextmenu.actions.mjs +31 -0
  52. package/esm2020/store/actions/library.actions.mjs +63 -0
  53. package/esm2020/store/actions/metadata-aspect.actions.mjs +31 -0
  54. package/esm2020/store/actions/node.actions.mjs +188 -0
  55. package/esm2020/store/actions/router-action-types.mjs +32 -0
  56. package/esm2020/store/actions/router.actions.mjs +54 -0
  57. package/esm2020/store/actions/search.actions.mjs +41 -0
  58. package/esm2020/store/actions/snackbar.actions.mjs +57 -0
  59. package/esm2020/store/actions/template-action-types.mjs +31 -0
  60. package/esm2020/store/actions/template.actions.mjs +47 -0
  61. package/esm2020/store/actions/upload.actions.mjs +49 -0
  62. package/esm2020/store/actions/viewer.actions.mjs +81 -0
  63. package/esm2020/store/effects/dialog.effects.mjs +44 -0
  64. package/esm2020/store/effects/router.effects.mjs +116 -0
  65. package/esm2020/store/effects/snackbar.effects.mjs +85 -0
  66. package/esm2020/store/models/delete-status.model.mjs +25 -0
  67. package/esm2020/store/models/deleted-node-info.model.mjs +25 -0
  68. package/esm2020/store/models/modal-configuration.mjs +25 -0
  69. package/esm2020/store/models/node-info.model.mjs +25 -0
  70. package/esm2020/store/models/search-option.model.mjs +30 -0
  71. package/esm2020/store/public-api.mjs +49 -0
  72. package/esm2020/store/selectors/app.selectors.mjs +56 -0
  73. package/esm2020/store/states/app.state.mjs +26 -0
  74. package/esm2020/store/store.module.mjs +42 -0
  75. package/fesm2015/alfresco-aca-shared-rules.mjs +775 -0
  76. package/fesm2015/alfresco-aca-shared-rules.mjs.map +1 -0
  77. package/fesm2015/{alfresco-aca-shared-store.js → alfresco-aca-shared-store.mjs} +395 -396
  78. package/fesm2015/alfresco-aca-shared-store.mjs.map +1 -0
  79. package/fesm2015/alfresco-aca-shared.mjs +2902 -0
  80. package/fesm2015/alfresco-aca-shared.mjs.map +1 -0
  81. package/{fesm2015/alfresco-aca-shared-rules.js → fesm2020/alfresco-aca-shared-rules.mjs} +274 -180
  82. package/fesm2020/alfresco-aca-shared-rules.mjs.map +1 -0
  83. package/fesm2020/alfresco-aca-shared-store.mjs +1376 -0
  84. package/fesm2020/alfresco-aca-shared-store.mjs.map +1 -0
  85. package/fesm2020/alfresco-aca-shared.mjs +3049 -0
  86. package/fesm2020/alfresco-aca-shared.mjs.map +1 -0
  87. package/{alfresco-aca-shared.d.ts → index.d.ts} +1 -0
  88. package/lib/adf-extensions/extensions-data-loader.guard.d.ts +9 -7
  89. package/lib/components/document-base-page/document-base-page.component.d.ts +76 -0
  90. package/lib/components/document-base-page/document-base-page.service.d.ts +28 -0
  91. package/lib/components/generic-error/generic-error.component.d.ts +3 -24
  92. package/lib/components/generic-error/generic-error.module.d.ts +8 -24
  93. package/lib/components/info-drawer/info-drawer.component.d.ts +11 -6
  94. package/lib/components/info-drawer/shared-info-drawer.module.d.ts +11 -24
  95. package/lib/components/locked-by/locked-by.component.d.ts +5 -30
  96. package/lib/components/locked-by/locked-by.module.d.ts +8 -24
  97. package/lib/components/open-in-app/open-in-app.component.d.ts +16 -0
  98. package/lib/components/page-layout/page-layout-content.component.d.ts +3 -24
  99. package/lib/components/page-layout/page-layout-error.component.d.ts +3 -24
  100. package/lib/components/page-layout/page-layout-header.component.d.ts +3 -24
  101. package/lib/components/page-layout/page-layout.component.d.ts +18 -7
  102. package/lib/components/page-layout/page-layout.module.d.ts +12 -24
  103. package/lib/components/tool-bar/shared-toolbar.module.d.ts +11 -24
  104. package/lib/components/tool-bar/toolbar-action/toolbar-action.component.d.ts +16 -8
  105. package/lib/components/tool-bar/toolbar-button/toolbar-button.component.d.ts +10 -25
  106. package/lib/components/tool-bar/toolbar-menu/toolbar-menu.component.d.ts +23 -13
  107. package/lib/components/tool-bar/toolbar-menu-item/toolbar-menu-item.component.d.ts +7 -27
  108. package/lib/directives/contextmenu/contextmenu.directive.d.ts +10 -7
  109. package/lib/directives/contextmenu/contextmenu.module.d.ts +5 -24
  110. package/lib/directives/pagination.directive.d.ts +8 -6
  111. package/lib/directives/shared.directives.module.d.ts +6 -24
  112. package/lib/models/modal-configuration.d.ts +26 -0
  113. package/lib/models/types.d.ts +5 -6
  114. package/lib/models/viewer.rules.d.ts +9 -6
  115. package/lib/routing/shared.guard.d.ts +5 -26
  116. package/lib/services/aca-file-auto-download.service.d.ts +13 -0
  117. package/lib/services/aca-mobile-app-switcher.service.d.ts +48 -0
  118. package/lib/services/alfresco-office-extension.service.d.ts +11 -0
  119. package/lib/services/app-hook.service.d.ts +55 -0
  120. package/lib/services/app.extension.service.d.ts +30 -45
  121. package/lib/services/app.service.d.ts +51 -12
  122. package/lib/services/content-api.service.d.ts +34 -25
  123. package/lib/services/node-permission.service.d.ts +3 -24
  124. package/lib/services/router.extension.service.d.ts +3 -24
  125. package/lib/shared.module.d.ts +15 -6
  126. package/lib/testing/lib-testing-module.d.ts +41 -0
  127. package/lib/utils/node.utils.d.ts +5 -6
  128. package/package.json +60 -18
  129. package/public-api.d.ts +12 -7
  130. package/rules/app.rules.d.ts +128 -36
  131. package/rules/{alfresco-aca-shared-rules.d.ts → index.d.ts} +1 -0
  132. package/rules/navigation.rules.d.ts +12 -12
  133. package/rules/public-api.d.ts +5 -6
  134. package/rules/repository.rules.d.ts +7 -7
  135. package/rules/user.rules.d.ts +6 -7
  136. package/store/actions/app-action-types.d.ts +44 -0
  137. package/store/actions/app.actions.d.ts +24 -29
  138. package/store/actions/context-menu-action-types.d.ts +26 -0
  139. package/store/actions/contextmenu.actions.d.ts +6 -9
  140. package/store/actions/library.actions.d.ts +8 -7
  141. package/store/actions/metadata-aspect.actions.d.ts +5 -6
  142. package/store/actions/node.actions.d.ts +38 -13
  143. package/store/actions/router-action-types.d.ts +30 -0
  144. package/store/actions/router.actions.d.ts +10 -12
  145. package/store/actions/search.actions.d.ts +11 -19
  146. package/store/actions/snackbar.actions.d.ts +13 -17
  147. package/store/actions/template-action-types.d.ts +29 -0
  148. package/store/actions/template.actions.d.ts +6 -12
  149. package/store/actions/upload.actions.d.ts +8 -7
  150. package/store/actions/viewer.actions.d.ts +11 -6
  151. package/store/effects/dialog.effects.d.ts +9 -7
  152. package/store/effects/router.effects.d.ts +11 -29
  153. package/store/effects/snackbar.effects.d.ts +11 -9
  154. package/store/{alfresco-aca-shared-store.d.ts → index.d.ts} +1 -0
  155. package/store/models/delete-status.model.d.ts +5 -6
  156. package/store/models/deleted-node-info.model.d.ts +5 -6
  157. package/store/models/modal-configuration.d.ts +26 -0
  158. package/store/models/node-info.model.d.ts +5 -6
  159. package/store/models/search-option.model.d.ts +5 -6
  160. package/store/public-api.d.ts +9 -6
  161. package/store/selectors/app.selectors.d.ts +10 -9
  162. package/store/states/app.state.d.ts +12 -9
  163. package/store/store.module.d.ts +5 -24
  164. package/alfresco-aca-shared.metadata.json +0 -1
  165. package/bundles/alfresco-aca-shared-rules.umd.js +0 -745
  166. package/bundles/alfresco-aca-shared-rules.umd.js.map +0 -1
  167. package/bundles/alfresco-aca-shared-rules.umd.min.js +0 -125
  168. package/bundles/alfresco-aca-shared-rules.umd.min.js.map +0 -1
  169. package/bundles/alfresco-aca-shared-store.umd.js +0 -1784
  170. package/bundles/alfresco-aca-shared-store.umd.js.map +0 -1
  171. package/bundles/alfresco-aca-shared-store.umd.min.js +0 -462
  172. package/bundles/alfresco-aca-shared-store.umd.min.js.map +0 -1
  173. package/bundles/alfresco-aca-shared.umd.js +0 -2523
  174. package/bundles/alfresco-aca-shared.umd.js.map +0 -1
  175. package/bundles/alfresco-aca-shared.umd.min.js +0 -740
  176. package/bundles/alfresco-aca-shared.umd.min.js.map +0 -1
  177. package/esm2015/lib/adf-extensions/extensions-data-loader.guard.js +0 -74
  178. package/esm2015/lib/components/generic-error/generic-error.component.js +0 -44
  179. package/esm2015/lib/components/generic-error/generic-error.module.js +0 -39
  180. package/esm2015/lib/components/info-drawer/info-drawer.component.js +0 -105
  181. package/esm2015/lib/components/info-drawer/shared-info-drawer.module.js +0 -41
  182. package/esm2015/lib/components/locked-by/locked-by.component.js +0 -54
  183. package/esm2015/lib/components/locked-by/locked-by.module.js +0 -38
  184. package/esm2015/lib/components/page-layout/page-layout-content.component.js +0 -43
  185. package/esm2015/lib/components/page-layout/page-layout-error.component.js +0 -37
  186. package/esm2015/lib/components/page-layout/page-layout-header.component.js +0 -37
  187. package/esm2015/lib/components/page-layout/page-layout.component.js +0 -44
  188. package/esm2015/lib/components/page-layout/page-layout.module.js +0 -40
  189. package/esm2015/lib/components/tool-bar/shared-toolbar.module.js +0 -42
  190. package/esm2015/lib/components/tool-bar/toolbar-action/toolbar-action.component.js +0 -57
  191. package/esm2015/lib/components/tool-bar/toolbar-button/toolbar-button.component.js +0 -66
  192. package/esm2015/lib/components/tool-bar/toolbar-menu/toolbar-menu.component.js +0 -55
  193. package/esm2015/lib/components/tool-bar/toolbar-menu-item/toolbar-menu-item.component.js +0 -65
  194. package/esm2015/lib/directives/contextmenu/contextmenu.directive.js +0 -97
  195. package/esm2015/lib/directives/contextmenu/contextmenu.module.js +0 -38
  196. package/esm2015/lib/directives/pagination.directive.js +0 -55
  197. package/esm2015/lib/directives/shared.directives.module.js +0 -37
  198. package/esm2015/lib/models/types.js +0 -25
  199. package/esm2015/lib/models/viewer.rules.js +0 -25
  200. package/esm2015/lib/routing/app.routes.strategy.js +0 -105
  201. package/esm2015/lib/routing/shared.guard.js +0 -50
  202. package/esm2015/lib/services/app.extension.service.js +0 -398
  203. package/esm2015/lib/services/app.service.js +0 -69
  204. package/esm2015/lib/services/content-api.service.js +0 -205
  205. package/esm2015/lib/services/node-permission.service.js +0 -88
  206. package/esm2015/lib/services/router.extension.service.js +0 -110
  207. package/esm2015/lib/shared.module.js +0 -44
  208. package/esm2015/lib/utils/node.utils.js +0 -34
  209. package/esm2015/public-api.js +0 -57
  210. package/esm2015/rules/app.rules.js +0 -420
  211. package/esm2015/rules/navigation.rules.js +0 -164
  212. package/esm2015/rules/public-api.js +0 -29
  213. package/esm2015/rules/repository.rules.js +0 -32
  214. package/esm2015/rules/user.rules.js +0 -32
  215. package/esm2015/store/actions/app.actions.js +0 -130
  216. package/esm2015/store/actions/contextmenu.actions.js +0 -35
  217. package/esm2015/store/actions/library.actions.js +0 -63
  218. package/esm2015/store/actions/metadata-aspect.actions.js +0 -32
  219. package/esm2015/store/actions/node.actions.js +0 -161
  220. package/esm2015/store/actions/router.actions.js +0 -56
  221. package/esm2015/store/actions/search.actions.js +0 -54
  222. package/esm2015/store/actions/snackbar.actions.js +0 -61
  223. package/esm2015/store/actions/template.actions.js +0 -54
  224. package/esm2015/store/actions/upload.actions.js +0 -49
  225. package/esm2015/store/actions/viewer.actions.js +0 -75
  226. package/esm2015/store/effects/dialog.effects.js +0 -49
  227. package/esm2015/store/effects/router.effects.js +0 -132
  228. package/esm2015/store/effects/snackbar.effects.js +0 -90
  229. package/esm2015/store/models/delete-status.model.js +0 -25
  230. package/esm2015/store/models/deleted-node-info.model.js +0 -25
  231. package/esm2015/store/models/node-info.model.js +0 -25
  232. package/esm2015/store/models/search-option.model.js +0 -31
  233. package/esm2015/store/public-api.js +0 -46
  234. package/esm2015/store/selectors/app.selectors.js +0 -80
  235. package/esm2015/store/states/app.state.js +0 -25
  236. package/esm2015/store/store.module.js +0 -37
  237. package/fesm2015/alfresco-aca-shared-rules.js.map +0 -1
  238. package/fesm2015/alfresco-aca-shared-store.js.map +0 -1
  239. package/fesm2015/alfresco-aca-shared.js +0 -2167
  240. package/fesm2015/alfresco-aca-shared.js.map +0 -1
  241. package/lib/routing/app.routes.strategy.d.ts +0 -40
  242. package/rules/alfresco-aca-shared-rules.metadata.json +0 -1
  243. package/rules/package.json +0 -11
  244. package/store/alfresco-aca-shared-store.metadata.json +0 -1
  245. package/store/package.json +0 -11
  246. /package/{esm2015/alfresco-aca-shared.js → esm2020/alfresco-aca-shared.mjs} +0 -0
  247. /package/{esm2015/rules/alfresco-aca-shared-rules.js → esm2020/rules/alfresco-aca-shared-rules.mjs} +0 -0
  248. /package/{esm2015/store/alfresco-aca-shared-store.js → esm2020/store/alfresco-aca-shared-store.mjs} +0 -0
@@ -1,2167 +0,0 @@
1
- import { InjectionToken, ɵɵdefineInjectable, ɵɵinject, Injectable, Inject, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, HostBinding, NgModule, ViewChild, HostListener, ChangeDetectorRef, Directive } from '@angular/core';
2
- import { of, forkJoin, BehaviorSubject, from, Subject } from 'rxjs';
3
- import { map, catchError, takeUntil, debounceTime } from 'rxjs/operators';
4
- import { CommonModule } from '@angular/common';
5
- import { MatIconModule, MatIconRegistry } from '@angular/material/icon';
6
- import { TranslateModule } from '@ngx-translate/core';
7
- import { __awaiter } from 'tslib';
8
- import { Store } from '@ngrx/store';
9
- import { DomSanitizer } from '@angular/platform-browser';
10
- import { getRuleContext, getLanguagePickerState, getAppSelection, SetInfoDrawerStateAction, ToggleInfoDrawerAction, ContextMenu, isQuickShareEnabled } from '@alfresco/aca-shared/store';
11
- import { sortByOrder, reduceEmptyMenus, mergeObjects, ContentActionType, reduceSeparators, ExtensionLoaderService, ExtensionService, ExtensionsModule } from '@alfresco/adf-extensions';
12
- import { AuthenticationService, AppConfigService, LogService, CoreModule, AlfrescoApiService, UserPreferencesService, InfoDrawerModule, ToolbarModule, PaginationComponent } from '@alfresco/adf-core';
13
- import '@angular/material/menu';
14
- import '@alfresco/js-api';
15
- import { MatProgressBarModule } from '@angular/material/progress-bar';
16
- import { RouteReuseStrategy, Router } from '@angular/router';
17
- import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
18
-
19
- /*!
20
- * @license
21
- * Alfresco Example Content Application
22
- *
23
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
24
- *
25
- * This file is part of the Alfresco Example Content Application.
26
- * If the software was purchased under a paid Alfresco license, the terms of
27
- * the paid license agreement will prevail. Otherwise, the software is
28
- * provided under the following open source license terms:
29
- *
30
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
31
- * it under the terms of the GNU Lesser General Public License as published by
32
- * the Free Software Foundation, either version 3 of the License, or
33
- * (at your option) any later version.
34
- *
35
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
36
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
37
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38
- * GNU Lesser General Public License for more details.
39
- *
40
- * You should have received a copy of the GNU Lesser General Public License
41
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
42
- */
43
- function DefaultExtensionLoaderFactory() {
44
- return [];
45
- }
46
- const EXTENSION_DATA_LOADERS = new InjectionToken('EXTENSION_DATA_LOADERS', {
47
- providedIn: 'root',
48
- factory: DefaultExtensionLoaderFactory
49
- });
50
- class ExtensionsDataLoaderGuard {
51
- constructor(extensionDataLoaders) {
52
- this.extensionDataLoaders = extensionDataLoaders;
53
- this.invoked = false;
54
- }
55
- canActivate(route) {
56
- if (!this.invoked) {
57
- this.invoked = true;
58
- if (!this.extensionDataLoaders.length) {
59
- return of(true);
60
- }
61
- const dataLoaderCallbacks = this.extensionDataLoaders.map((callback) => callback(route));
62
- // Undocumented forkJoin behaviour/bug:
63
- // https://github.com/ReactiveX/rxjs/issues/3246
64
- // So all callbacks need to emit before completion, otherwise forkJoin will short circuit
65
- return forkJoin(...dataLoaderCallbacks).pipe(map(() => true), catchError((e) => {
66
- // tslint:disable-next-line
67
- console.error('Some of the extension data loader guards has been errored.');
68
- // tslint:disable-next-line
69
- console.error(e);
70
- return of(true);
71
- }));
72
- }
73
- else {
74
- return of(true);
75
- }
76
- }
77
- canActivateChild() {
78
- return of(true);
79
- }
80
- }
81
- ExtensionsDataLoaderGuard.ɵprov = ɵɵdefineInjectable({ factory: function ExtensionsDataLoaderGuard_Factory() { return new ExtensionsDataLoaderGuard(ɵɵinject(EXTENSION_DATA_LOADERS)); }, token: ExtensionsDataLoaderGuard, providedIn: "root" });
82
- ExtensionsDataLoaderGuard.decorators = [
83
- { type: Injectable, args: [{ providedIn: 'root' },] }
84
- ];
85
- ExtensionsDataLoaderGuard.ctorParameters = () => [
86
- { type: Array, decorators: [{ type: Inject, args: [EXTENSION_DATA_LOADERS,] }] }
87
- ];
88
-
89
- /*!
90
- * @license
91
- * Alfresco Example Content Application
92
- *
93
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
94
- *
95
- * This file is part of the Alfresco Example Content Application.
96
- * If the software was purchased under a paid Alfresco license, the terms of
97
- * the paid license agreement will prevail. Otherwise, the software is
98
- * provided under the following open source license terms:
99
- *
100
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
101
- * it under the terms of the GNU Lesser General Public License as published by
102
- * the Free Software Foundation, either version 3 of the License, or
103
- * (at your option) any later version.
104
- *
105
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
106
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
107
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
108
- * GNU Lesser General Public License for more details.
109
- *
110
- * You should have received a copy of the GNU Lesser General Public License
111
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
112
- */
113
- class PageLayoutContentComponent {
114
- constructor() {
115
- this.scrollable = false;
116
- }
117
- }
118
- PageLayoutContentComponent.decorators = [
119
- { type: Component, args: [{
120
- selector: 'aca-page-layout-content',
121
- template: `<ng-content></ng-content>`,
122
- encapsulation: ViewEncapsulation.None,
123
- changeDetection: ChangeDetectionStrategy.OnPush,
124
- host: { class: 'aca-page-layout-content' }
125
- },] }
126
- ];
127
- PageLayoutContentComponent.propDecorators = {
128
- scrollable: [{ type: Input }, { type: HostBinding, args: ['class.scrollable',] }]
129
- };
130
-
131
- /*!
132
- * @license
133
- * Alfresco Example Content Application
134
- *
135
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
136
- *
137
- * This file is part of the Alfresco Example Content Application.
138
- * If the software was purchased under a paid Alfresco license, the terms of
139
- * the paid license agreement will prevail. Otherwise, the software is
140
- * provided under the following open source license terms:
141
- *
142
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
143
- * it under the terms of the GNU Lesser General Public License as published by
144
- * the Free Software Foundation, either version 3 of the License, or
145
- * (at your option) any later version.
146
- *
147
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
148
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
149
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
150
- * GNU Lesser General Public License for more details.
151
- *
152
- * You should have received a copy of the GNU Lesser General Public License
153
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
154
- */
155
- class PageLayoutErrorComponent {
156
- }
157
- PageLayoutErrorComponent.decorators = [
158
- { type: Component, args: [{
159
- selector: 'aca-page-layout-error',
160
- template: `<ng-content></ng-content>`,
161
- encapsulation: ViewEncapsulation.None,
162
- changeDetection: ChangeDetectionStrategy.OnPush,
163
- host: { class: 'aca-page-layout-error' }
164
- },] }
165
- ];
166
-
167
- /*!
168
- * @license
169
- * Alfresco Example Content Application
170
- *
171
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
172
- *
173
- * This file is part of the Alfresco Example Content Application.
174
- * If the software was purchased under a paid Alfresco license, the terms of
175
- * the paid license agreement will prevail. Otherwise, the software is
176
- * provided under the following open source license terms:
177
- *
178
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
179
- * it under the terms of the GNU Lesser General Public License as published by
180
- * the Free Software Foundation, either version 3 of the License, or
181
- * (at your option) any later version.
182
- *
183
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
184
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
185
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
186
- * GNU Lesser General Public License for more details.
187
- *
188
- * You should have received a copy of the GNU Lesser General Public License
189
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
190
- */
191
- class PageLayoutHeaderComponent {
192
- }
193
- PageLayoutHeaderComponent.decorators = [
194
- { type: Component, args: [{
195
- selector: 'aca-page-layout-header',
196
- template: '<ng-content></ng-content>',
197
- encapsulation: ViewEncapsulation.None,
198
- changeDetection: ChangeDetectionStrategy.OnPush,
199
- host: { class: 'aca-page-layout-header' }
200
- },] }
201
- ];
202
-
203
- /*!
204
- * @license
205
- * Alfresco Example Content Application
206
- *
207
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
208
- *
209
- * This file is part of the Alfresco Example Content Application.
210
- * If the software was purchased under a paid Alfresco license, the terms of
211
- * the paid license agreement will prevail. Otherwise, the software is
212
- * provided under the following open source license terms:
213
- *
214
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
215
- * it under the terms of the GNU Lesser General Public License as published by
216
- * the Free Software Foundation, either version 3 of the License, or
217
- * (at your option) any later version.
218
- *
219
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
220
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
221
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
222
- * GNU Lesser General Public License for more details.
223
- *
224
- * You should have received a copy of the GNU Lesser General Public License
225
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
226
- */
227
- class PageLayoutComponent {
228
- constructor() {
229
- this.hasError = false;
230
- }
231
- }
232
- PageLayoutComponent.decorators = [
233
- { type: Component, args: [{
234
- selector: 'aca-page-layout',
235
- template: "<ng-content select=\"aca-page-layout-header\"></ng-content>\n<ng-content select=\"aca-page-layout-error\" *ngIf=\"hasError\"></ng-content>\n<ng-content select=\"aca-page-layout-content\" *ngIf=\"!hasError\"></ng-content>\n",
236
- encapsulation: ViewEncapsulation.None,
237
- host: { class: 'aca-page-layout' },
238
- changeDetection: ChangeDetectionStrategy.OnPush,
239
- styles: [".aca-page-layout{display:flex;flex:1;flex-direction:column;height:100%;min-height:0;overflow:hidden}.aca-page-layout .aca-page-layout-header{align-items:center;background:#fafafa;border-bottom:1px solid var(--theme-border-color,rgba(0,0,0,.07));display:flex;flex:0 0 65px;flex-basis:48px;padding:0 24px}.aca-page-layout .aca-page-layout-content,.aca-page-layout .aca-page-layout-error{display:flex;flex:1;flex-direction:row;height:100%;overflow:hidden}.aca-page-layout .main-content{display:flex;flex:1;flex-direction:column;height:100%;min-height:0;overflow:hidden}.aca-page-layout .scrollable,.aca-page-layout .scrollable .main-content{overflow:auto!important}.aca-page-layout .sidebar{display:block;height:100%;max-width:350px;overflow-y:scroll;width:350px}[dir=rtl] .aca-page-layout .main-content{border-left:1px solid var(--theme-border-color,rgba(0,0,0,.07))}[dir=ltr] .aca-page-layout .main-content{border-right:1px solid var(--theme-border-color,rgba(0,0,0,.07))}"]
240
- },] }
241
- ];
242
- PageLayoutComponent.propDecorators = {
243
- hasError: [{ type: Input }]
244
- };
245
-
246
- /*!
247
- * @license
248
- * Alfresco Example Content Application
249
- *
250
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
251
- *
252
- * This file is part of the Alfresco Example Content Application.
253
- * If the software was purchased under a paid Alfresco license, the terms of
254
- * the paid license agreement will prevail. Otherwise, the software is
255
- * provided under the following open source license terms:
256
- *
257
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
258
- * it under the terms of the GNU Lesser General Public License as published by
259
- * the Free Software Foundation, either version 3 of the License, or
260
- * (at your option) any later version.
261
- *
262
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
263
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
264
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
265
- * GNU Lesser General Public License for more details.
266
- *
267
- * You should have received a copy of the GNU Lesser General Public License
268
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
269
- */
270
- class PageLayoutModule {
271
- }
272
- PageLayoutModule.decorators = [
273
- { type: NgModule, args: [{
274
- imports: [CommonModule],
275
- declarations: [PageLayoutContentComponent, PageLayoutErrorComponent, PageLayoutHeaderComponent, PageLayoutComponent],
276
- exports: [PageLayoutContentComponent, PageLayoutErrorComponent, PageLayoutHeaderComponent, PageLayoutComponent]
277
- },] }
278
- ];
279
-
280
- /*!
281
- * @license
282
- * Alfresco Example Content Application
283
- *
284
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
285
- *
286
- * This file is part of the Alfresco Example Content Application.
287
- * If the software was purchased under a paid Alfresco license, the terms of
288
- * the paid license agreement will prevail. Otherwise, the software is
289
- * provided under the following open source license terms:
290
- *
291
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
292
- * it under the terms of the GNU Lesser General Public License as published by
293
- * the Free Software Foundation, either version 3 of the License, or
294
- * (at your option) any later version.
295
- *
296
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
297
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
298
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
299
- * GNU Lesser General Public License for more details.
300
- *
301
- * You should have received a copy of the GNU Lesser General Public License
302
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
303
- */
304
- class LockedByComponent {
305
- constructor() { }
306
- ngOnInit() {
307
- this.node = this.context.row.node;
308
- }
309
- writeLockedBy() {
310
- return (this.node && this.node.entry.properties && this.node.entry.properties['cm:lockOwner'] && this.node.entry.properties['cm:lockOwner'].displayName);
311
- }
312
- }
313
- LockedByComponent.decorators = [
314
- { type: Component, args: [{
315
- selector: 'aca-locked-by',
316
- template: `
317
- <mat-icon class="locked_by--icon">lock</mat-icon>
318
- <span class="locked_by--name">{{ writeLockedBy() }}</span>
319
- `,
320
- changeDetection: ChangeDetectionStrategy.OnPush,
321
- encapsulation: ViewEncapsulation.None,
322
- host: {
323
- class: 'aca-locked-by'
324
- },
325
- styles: [".aca-locked-by{align-items:center;color:var(--theme-text-color,rgba(0,0,0,.54));display:flex;padding:0 10px}.aca-locked-by .locked_by--icon{font-size:14px;height:14px;width:14px}.aca-locked-by .locked_by--name{font-size:12px;padding:0 2px}"]
326
- },] }
327
- ];
328
- LockedByComponent.ctorParameters = () => [];
329
- LockedByComponent.propDecorators = {
330
- context: [{ type: Input }]
331
- };
332
-
333
- /*!
334
- * @license
335
- * Alfresco Example Content Application
336
- *
337
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
338
- *
339
- * This file is part of the Alfresco Example Content Application.
340
- * If the software was purchased under a paid Alfresco license, the terms of
341
- * the paid license agreement will prevail. Otherwise, the software is
342
- * provided under the following open source license terms:
343
- *
344
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
345
- * it under the terms of the GNU Lesser General Public License as published by
346
- * the Free Software Foundation, either version 3 of the License, or
347
- * (at your option) any later version.
348
- *
349
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
350
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
351
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
352
- * GNU Lesser General Public License for more details.
353
- *
354
- * You should have received a copy of the GNU Lesser General Public License
355
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
356
- */
357
- class LockedByModule {
358
- }
359
- LockedByModule.decorators = [
360
- { type: NgModule, args: [{
361
- imports: [CommonModule, MatIconModule],
362
- declarations: [LockedByComponent],
363
- exports: [LockedByComponent]
364
- },] }
365
- ];
366
-
367
- /*!
368
- * @license
369
- * Alfresco Example Content Application
370
- *
371
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
372
- *
373
- * This file is part of the Alfresco Example Content Application.
374
- * If the software was purchased under a paid Alfresco license, the terms of
375
- * the paid license agreement will prevail. Otherwise, the software is
376
- * provided under the following open source license terms:
377
- *
378
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
379
- * it under the terms of the GNU Lesser General Public License as published by
380
- * the Free Software Foundation, either version 3 of the License, or
381
- * (at your option) any later version.
382
- *
383
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
384
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
385
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
386
- * GNU Lesser General Public License for more details.
387
- *
388
- * You should have received a copy of the GNU Lesser General Public License
389
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
390
- */
391
- class GenericErrorComponent {
392
- constructor() {
393
- this.text = 'APP.MESSAGES.ERRORS.MISSING_CONTENT';
394
- }
395
- }
396
- GenericErrorComponent.decorators = [
397
- { type: Component, args: [{
398
- selector: 'aca-generic-error',
399
- template: "<mat-icon>error</mat-icon>\n<p class=\"generic-error__title\">\n {{ text | translate }}\n</p>\n",
400
- encapsulation: ViewEncapsulation.None,
401
- changeDetection: ChangeDetectionStrategy.OnPush,
402
- host: { class: 'aca-generic-error' },
403
- styles: [".aca-generic-error{align-items:center;color:var(--theme-text-color,rgba(0,0,0,.54));display:flex;flex-direction:column;height:100%;justify-content:center;width:100%}.aca-generic-error__title{font-size:16px}.aca-generic-error mat-icon{color:var(--theme-warn-color,#f44336);font-size:52px;height:52px;width:52px}"]
404
- },] }
405
- ];
406
- GenericErrorComponent.propDecorators = {
407
- text: [{ type: Input }]
408
- };
409
-
410
- /*!
411
- * @license
412
- * Alfresco Example Content Application
413
- *
414
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
415
- *
416
- * This file is part of the Alfresco Example Content Application.
417
- * If the software was purchased under a paid Alfresco license, the terms of
418
- * the paid license agreement will prevail. Otherwise, the software is
419
- * provided under the following open source license terms:
420
- *
421
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
422
- * it under the terms of the GNU Lesser General Public License as published by
423
- * the Free Software Foundation, either version 3 of the License, or
424
- * (at your option) any later version.
425
- *
426
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
427
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
428
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
429
- * GNU Lesser General Public License for more details.
430
- *
431
- * You should have received a copy of the GNU Lesser General Public License
432
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
433
- */
434
- class GenericErrorModule {
435
- }
436
- GenericErrorModule.decorators = [
437
- { type: NgModule, args: [{
438
- imports: [CommonModule, MatIconModule, TranslateModule.forChild()],
439
- declarations: [GenericErrorComponent],
440
- exports: [GenericErrorComponent]
441
- },] }
442
- ];
443
-
444
- /*!
445
- * @license
446
- * Alfresco Example Content Application
447
- *
448
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
449
- *
450
- * This file is part of the Alfresco Example Content Application.
451
- * If the software was purchased under a paid Alfresco license, the terms of
452
- * the paid license agreement will prevail. Otherwise, the software is
453
- * provided under the following open source license terms:
454
- *
455
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
456
- * it under the terms of the GNU Lesser General Public License as published by
457
- * the Free Software Foundation, either version 3 of the License, or
458
- * (at your option) any later version.
459
- *
460
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
461
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
462
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
463
- * GNU Lesser General Public License for more details.
464
- *
465
- * You should have received a copy of the GNU Lesser General Public License
466
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
467
- */
468
- class NodePermissionService {
469
- constructor() {
470
- this.defaultOptions = {
471
- operation: NodePermissionService.DEFAULT_OPERATION,
472
- target: null
473
- };
474
- }
475
- check(source, permissions, options) {
476
- const opts = Object.assign({}, this.defaultOptions, options || {});
477
- if (!source) {
478
- return false;
479
- }
480
- if (Array.isArray(source)) {
481
- source = source.filter((item) => item);
482
- if (source.length > 0) {
483
- return source.every((node) => this.isOperationAllowed(node, permissions, opts));
484
- }
485
- return false;
486
- }
487
- else {
488
- return this.isOperationAllowed(source, permissions, opts);
489
- }
490
- }
491
- isOperationAllowed(node, permissions, options) {
492
- const allowableOperations = this.getAllowableOperations(node, options.target);
493
- if (allowableOperations.length) {
494
- if (options.operation === NodePermissionService.DEFAULT_OPERATION) {
495
- return permissions.some((permission) => allowableOperations.includes(permission));
496
- }
497
- else {
498
- return permissions.every((permission) => allowableOperations.includes(permission));
499
- }
500
- }
501
- return false;
502
- }
503
- getAllowableOperations(node, property) {
504
- let entry;
505
- if ('entry' in node) {
506
- entry = node.entry;
507
- }
508
- else {
509
- entry = node;
510
- }
511
- if (property) {
512
- return entry[property] || [];
513
- }
514
- if ('allowableOperationsOnTarget' in entry) {
515
- return entry.allowableOperationsOnTarget || [];
516
- }
517
- else {
518
- return entry.allowableOperations || [];
519
- }
520
- }
521
- }
522
- NodePermissionService.DEFAULT_OPERATION = 'OR';
523
- NodePermissionService.ɵprov = ɵɵdefineInjectable({ factory: function NodePermissionService_Factory() { return new NodePermissionService(); }, token: NodePermissionService, providedIn: "root" });
524
- NodePermissionService.decorators = [
525
- { type: Injectable, args: [{
526
- providedIn: 'root'
527
- },] }
528
- ];
529
-
530
- class AppExtensionService {
531
- constructor(auth, store, loader, extensions, permissions, appConfig, matIconRegistry, sanitizer, logger) {
532
- this.auth = auth;
533
- this.store = store;
534
- this.loader = loader;
535
- this.extensions = extensions;
536
- this.permissions = permissions;
537
- this.appConfig = appConfig;
538
- this.matIconRegistry = matIconRegistry;
539
- this.sanitizer = sanitizer;
540
- this.logger = logger;
541
- this._references = new BehaviorSubject([]);
542
- this.headerActions = [];
543
- this.toolbarActions = [];
544
- this.viewerToolbarActions = [];
545
- this.sharedLinkViewerToolbarActions = [];
546
- this.contextMenuActions = [];
547
- this.openWithActions = [];
548
- this.createActions = [];
549
- this.navbar = [];
550
- this.sidebarTabs = [];
551
- this.sidebarActions = [];
552
- this.viewerRules = {};
553
- this.userActions = [];
554
- this.settingGroups = [];
555
- this.documentListPresets = {
556
- files: [],
557
- libraries: [],
558
- favoriteLibraries: [],
559
- shared: [],
560
- recent: [],
561
- favorites: [],
562
- trashcan: [],
563
- searchLibraries: []
564
- };
565
- this.references$ = this._references.asObservable();
566
- this.store.select(getRuleContext).subscribe((result) => {
567
- this.selection = result.selection;
568
- this.navigation = result.navigation;
569
- this.profile = result.profile;
570
- this.repository = result.repository;
571
- });
572
- this.store.select(getLanguagePickerState).subscribe((result) => {
573
- this.languagePicker = result;
574
- });
575
- }
576
- load() {
577
- return __awaiter(this, void 0, void 0, function* () {
578
- const config = yield this.extensions.load();
579
- this.setup(config);
580
- });
581
- }
582
- setup(config) {
583
- if (!config) {
584
- this.logger.error('Extension configuration not found');
585
- return;
586
- }
587
- this.settingGroups = this.loader.getElements(config, 'settings');
588
- this.headerActions = this.loader.getContentActions(config, 'features.header');
589
- this.sidebarActions = this.loader.getContentActions(config, 'features.sidebar.toolbar');
590
- this.toolbarActions = this.loader.getContentActions(config, 'features.toolbar');
591
- this.viewerToolbarActions = this.loader.getContentActions(config, 'features.viewer.toolbarActions');
592
- this.sharedLinkViewerToolbarActions = this.loader.getContentActions(config, 'features.viewer.shared.toolbarActions');
593
- this.contextMenuActions = this.loader.getContentActions(config, 'features.contextMenu');
594
- this.openWithActions = this.loader.getContentActions(config, 'features.viewer.openWith');
595
- this.createActions = this.loader.getElements(config, 'features.create');
596
- this.navbar = this.loadNavBar(config);
597
- this.sidebarTabs = this.loader.getElements(config, 'features.sidebar.tabs');
598
- this.userActions = this.loader.getContentActions(config, 'features.userActions');
599
- this.contentMetadata = this.loadContentMetadata(config);
600
- this.documentListPresets = {
601
- files: this.getDocumentListPreset(config, 'files'),
602
- libraries: this.getDocumentListPreset(config, 'libraries'),
603
- favoriteLibraries: this.getDocumentListPreset(config, 'favoriteLibraries'),
604
- shared: this.getDocumentListPreset(config, 'shared'),
605
- recent: this.getDocumentListPreset(config, 'recent'),
606
- favorites: this.getDocumentListPreset(config, 'favorites'),
607
- trashcan: this.getDocumentListPreset(config, 'trashcan'),
608
- searchLibraries: this.getDocumentListPreset(config, 'search-libraries')
609
- };
610
- this.withCredentials = this.appConfig.get('auth.withCredentials', false);
611
- if (config.features && config.features.viewer) {
612
- this.viewerRules = config.features.viewer['rules'] || {};
613
- }
614
- this.registerIcons(config);
615
- const references = (config.$references || []).filter((entry) => typeof entry === 'object').map((entry) => entry);
616
- this._references.next(references);
617
- }
618
- registerIcons(config) {
619
- const icons = this.loader.getElements(config, 'features.icons').filter((entry) => !entry.disabled);
620
- for (const icon of icons) {
621
- const [ns, id] = icon.id.split(':');
622
- const value = icon.value;
623
- if (!value) {
624
- console.warn(`Missing icon value for "${icon.id}".`);
625
- }
626
- else if (!ns || !id) {
627
- console.warn(`Incorrect icon id format: "${icon.id}".`);
628
- }
629
- else {
630
- this.matIconRegistry.addSvgIconInNamespace(ns, id, this.sanitizer.bypassSecurityTrustResourceUrl(value));
631
- }
632
- }
633
- }
634
- loadNavBar(config) {
635
- return this.loader.getElements(config, 'features.navbar');
636
- }
637
- getDocumentListPreset(config, key) {
638
- return this.loader.getElements(config, `features.documentList.${key}`).filter((entry) => !entry.disabled);
639
- }
640
- getApplicationNavigation(elements) {
641
- return elements
642
- .filter((group) => this.filterVisible(group))
643
- .map((group) => {
644
- return Object.assign(Object.assign({}, group), { items: (group.items || [])
645
- .filter((entry) => !entry.disabled)
646
- .filter((item) => this.filterVisible(item))
647
- .sort(sortByOrder)
648
- .map((item) => {
649
- if (item.children && item.children.length > 0) {
650
- item.children = item.children
651
- .filter((entry) => !entry.disabled)
652
- .filter((child) => this.filterVisible(child))
653
- .sort(sortByOrder)
654
- .map((child) => {
655
- if (child.component) {
656
- return Object.assign({}, child);
657
- }
658
- if (!child.click) {
659
- const childRouteRef = this.extensions.getRouteById(child.route);
660
- const childUrl = `/${childRouteRef ? childRouteRef.path : child.route}`;
661
- return Object.assign(Object.assign({}, child), { url: childUrl });
662
- }
663
- return Object.assign(Object.assign({}, child), { action: child.click });
664
- });
665
- return Object.assign({}, item);
666
- }
667
- if (item.component) {
668
- return Object.assign({}, item);
669
- }
670
- if (!item.click) {
671
- const routeRef = this.extensions.getRouteById(item.route);
672
- const url = `/${routeRef ? routeRef.path : item.route}`;
673
- return Object.assign(Object.assign({}, item), { url });
674
- }
675
- return Object.assign(Object.assign({}, item), { action: item.click });
676
- })
677
- .reduce(reduceEmptyMenus, []) });
678
- });
679
- }
680
- loadContentMetadata(config) {
681
- const elements = this.loader.getElements(config, 'features.content-metadata-presets');
682
- if (!elements.length) {
683
- return null;
684
- }
685
- let presets = {};
686
- presets = this.filterDisabled(mergeObjects(presets, ...elements));
687
- try {
688
- this.appConfig.config['content-metadata'] = { presets };
689
- }
690
- catch (error) {
691
- this.logger.error(error, '- could not change content-metadata from app.config -');
692
- }
693
- return { presets };
694
- }
695
- filterDisabled(object) {
696
- if (Array.isArray(object)) {
697
- return object.filter((item) => !item.disabled).map((item) => this.filterDisabled(item));
698
- }
699
- else if (typeof object === 'object') {
700
- if (!object.disabled) {
701
- Object.keys(object).forEach((prop) => {
702
- object[prop] = this.filterDisabled(object[prop]);
703
- });
704
- return object;
705
- }
706
- }
707
- else {
708
- return object;
709
- }
710
- }
711
- getNavigationGroups() {
712
- return this.navbar;
713
- }
714
- getSidebarTabs() {
715
- return this.sidebarTabs.filter((action) => this.filterVisible(action));
716
- }
717
- getCreateActions() {
718
- return this.createActions
719
- .filter((action) => this.filterVisible(action))
720
- .map((action) => this.copyAction(action))
721
- .map((action) => this.buildMenu(action))
722
- .map((action) => {
723
- let disabled = false;
724
- if (action.rules && action.rules.enabled) {
725
- disabled = !this.extensions.evaluateRule(action.rules.enabled, this);
726
- }
727
- return Object.assign(Object.assign({}, action), { disabled });
728
- });
729
- }
730
- buildMenu(actionRef) {
731
- if (actionRef.type === ContentActionType.menu && actionRef.children && actionRef.children.length > 0) {
732
- const children = actionRef.children.filter((action) => this.filterVisible(action)).map((action) => this.buildMenu(action));
733
- actionRef.children = children
734
- .map((action) => {
735
- let disabled = false;
736
- if (action.rules && action.rules.enabled) {
737
- disabled = !this.extensions.evaluateRule(action.rules.enabled, this);
738
- }
739
- return Object.assign(Object.assign({}, action), { disabled });
740
- })
741
- .sort(sortByOrder)
742
- .reduce(reduceEmptyMenus, [])
743
- .reduce(reduceSeparators, []);
744
- }
745
- return actionRef;
746
- }
747
- getAllowedActions(actions) {
748
- return (actions || [])
749
- .filter((action) => this.filterVisible(action))
750
- .map((action) => {
751
- if (action.type === ContentActionType.menu) {
752
- const copy = this.copyAction(action);
753
- if (copy.children && copy.children.length > 0) {
754
- copy.children = copy.children
755
- .filter((entry) => !entry.disabled)
756
- .filter((childAction) => this.filterVisible(childAction))
757
- .sort(sortByOrder)
758
- .reduce(reduceSeparators, []);
759
- }
760
- return copy;
761
- }
762
- return action;
763
- })
764
- .reduce(reduceEmptyMenus, [])
765
- .reduce(reduceSeparators, []);
766
- }
767
- getAllowedSidebarActions() {
768
- return this.getAllowedActions(this.sidebarActions);
769
- }
770
- getAllowedToolbarActions() {
771
- return this.getAllowedActions(this.toolbarActions);
772
- }
773
- getViewerToolbarActions() {
774
- return this.getAllowedActions(this.viewerToolbarActions);
775
- }
776
- getSharedLinkViewerToolbarActions() {
777
- return this.getAllowedActions(this.sharedLinkViewerToolbarActions);
778
- }
779
- getHeaderActions() {
780
- return this.headerActions
781
- .filter((action) => this.filterVisible(action))
782
- .map((action) => {
783
- if (action.type === ContentActionType.menu) {
784
- const copy = this.copyAction(action);
785
- if (copy.children && copy.children.length > 0) {
786
- copy.children = copy.children
787
- .filter((childAction) => this.filterVisible(childAction))
788
- .sort(sortByOrder)
789
- .reduce(reduceEmptyMenus, [])
790
- .reduce(reduceSeparators, []);
791
- }
792
- return copy;
793
- }
794
- return action;
795
- })
796
- .sort(sortByOrder)
797
- .reduce(reduceEmptyMenus, [])
798
- .reduce(reduceSeparators, []);
799
- }
800
- getAllowedContextMenuActions() {
801
- return this.getAllowedActions(this.contextMenuActions);
802
- }
803
- getUserActions() {
804
- return this.userActions.filter((action) => this.filterVisible(action)).sort(sortByOrder);
805
- }
806
- getSettingsGroups() {
807
- return this.settingGroups.filter((group) => this.filterVisible(group));
808
- }
809
- copyAction(action) {
810
- return Object.assign(Object.assign({}, action), { children: (action.children || []).map((child) => this.copyAction(child)) });
811
- }
812
- filterVisible(action) {
813
- if (action && action.rules && action.rules.visible) {
814
- return this.extensions.evaluateRule(action.rules.visible, this);
815
- }
816
- return true;
817
- }
818
- isViewerExtensionDisabled(extension) {
819
- if (extension) {
820
- if (extension.disabled) {
821
- return true;
822
- }
823
- if (extension.rules && extension.rules.disabled) {
824
- return this.extensions.evaluateRule(extension.rules.disabled, this);
825
- }
826
- }
827
- return false;
828
- }
829
- runActionById(id) {
830
- const action = this.extensions.getActionById(id);
831
- if (action) {
832
- const { type, payload } = action;
833
- const context = {
834
- selection: this.selection
835
- };
836
- const expression = this.extensions.runExpression(payload, context);
837
- this.store.dispatch({ type, payload: expression });
838
- }
839
- else {
840
- this.store.dispatch({ type: id });
841
- }
842
- }
843
- // todo: move to ADF/RuleService
844
- isRuleDefined(ruleId) {
845
- return ruleId && this.getEvaluator(ruleId) ? true : false;
846
- }
847
- // todo: move to ADF/RuleService
848
- evaluateRule(ruleId, ...args) {
849
- const evaluator = this.getEvaluator(ruleId);
850
- if (evaluator) {
851
- return evaluator(this, ...args);
852
- }
853
- return false;
854
- }
855
- getEvaluator(key) {
856
- return this.extensions.getEvaluator(key);
857
- }
858
- canPreviewNode(node) {
859
- const rules = this.viewerRules;
860
- if (this.isRuleDefined(rules.canPreview)) {
861
- const canPreview = this.evaluateRule(rules.canPreview, node);
862
- if (!canPreview) {
863
- return false;
864
- }
865
- }
866
- return true;
867
- }
868
- }
869
- AppExtensionService.ɵprov = ɵɵdefineInjectable({ factory: function AppExtensionService_Factory() { return new AppExtensionService(ɵɵinject(AuthenticationService), ɵɵinject(Store), ɵɵinject(ExtensionLoaderService), ɵɵinject(ExtensionService), ɵɵinject(NodePermissionService), ɵɵinject(AppConfigService), ɵɵinject(MatIconRegistry), ɵɵinject(DomSanitizer), ɵɵinject(LogService)); }, token: AppExtensionService, providedIn: "root" });
870
- AppExtensionService.decorators = [
871
- { type: Injectable, args: [{
872
- providedIn: 'root'
873
- },] }
874
- ];
875
- AppExtensionService.ctorParameters = () => [
876
- { type: AuthenticationService },
877
- { type: Store },
878
- { type: ExtensionLoaderService },
879
- { type: ExtensionService },
880
- { type: NodePermissionService },
881
- { type: AppConfigService },
882
- { type: MatIconRegistry },
883
- { type: DomSanitizer },
884
- { type: LogService }
885
- ];
886
-
887
- /*!
888
- * @license
889
- * Alfresco Example Content Application
890
- *
891
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
892
- *
893
- * This file is part of the Alfresco Example Content Application.
894
- * If the software was purchased under a paid Alfresco license, the terms of
895
- * the paid license agreement will prevail. Otherwise, the software is
896
- * provided under the following open source license terms:
897
- *
898
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
899
- * it under the terms of the GNU Lesser General Public License as published by
900
- * the Free Software Foundation, either version 3 of the License, or
901
- * (at your option) any later version.
902
- *
903
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
904
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
905
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
906
- * GNU Lesser General Public License for more details.
907
- *
908
- * You should have received a copy of the GNU Lesser General Public License
909
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
910
- */
911
- class ToolbarMenuItemComponent {
912
- constructor(extensions) {
913
- this.extensions = extensions;
914
- }
915
- runAction() {
916
- if (this.hasClickAction(this.actionRef)) {
917
- this.extensions.runActionById(this.actionRef.actions.click);
918
- }
919
- }
920
- hasClickAction(actionRef) {
921
- if (actionRef && actionRef.actions && actionRef.actions.click) {
922
- return true;
923
- }
924
- return false;
925
- }
926
- trackById(_, obj) {
927
- return obj.id;
928
- }
929
- }
930
- ToolbarMenuItemComponent.decorators = [
931
- { type: Component, args: [{
932
- selector: 'app-toolbar-menu-item',
933
- template: "<ng-container [ngSwitch]=\"actionRef.type\">\n <ng-container *ngSwitchCase=\"'menu'\">\n <button\n mat-menu-item\n role=\"menuitem\"\n [disabled]=\"actionRef.disabled\"\n [matMenuTriggerFor]=\"childMenu\"\n >\n <adf-icon [value]=\"actionRef.icon\"></adf-icon>\n <span>{{ actionRef.title | translate }}</span>\n </button>\n\n <mat-menu #childMenu=\"matMenu\" class=\"app-create-menu__sub-menu\">\n <ng-container\n *ngFor=\"let child of actionRef.children; trackBy: trackById\"\n >\n <app-toolbar-menu-item [actionRef]=\"child\"></app-toolbar-menu-item>\n </ng-container>\n </mat-menu>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'separator'\">\n <mat-divider></mat-divider>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'custom'\">\n <adf-dynamic-component [id]=\"actionRef.component\"></adf-dynamic-component>\n </ng-container>\n\n <ng-container *ngSwitchDefault>\n <button\n [id]=\"actionRef.id\"\n role=\"menuItem\"\n mat-menu-item\n [role]=\"'menuItem'\"\n color=\"primary\"\n [disabled]=\"actionRef.disabled\"\n [attr.title]=\"\n (actionRef.disabled\n ? actionRef['description-disabled']\n : actionRef.description || actionRef.title) | translate\n \"\n (click)=\"runAction()\"\n >\n <adf-icon [value]=\"actionRef.icon\"></adf-icon>\n <span>{{ actionRef.title | translate }}</span>\n </button>\n </ng-container>\n</ng-container>\n",
934
- encapsulation: ViewEncapsulation.None,
935
- host: { class: 'app-toolbar-menu-item' },
936
- styles: [`
937
- .app-toolbar-menu-item:last-child > .mat-divider-horizontal {
938
- display: none;
939
- }
940
- `]
941
- },] }
942
- ];
943
- ToolbarMenuItemComponent.ctorParameters = () => [
944
- { type: AppExtensionService }
945
- ];
946
- ToolbarMenuItemComponent.propDecorators = {
947
- actionRef: [{ type: Input }]
948
- };
949
-
950
- /*!
951
- * @license
952
- * Alfresco Example Content Application
953
- *
954
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
955
- *
956
- * This file is part of the Alfresco Example Content Application.
957
- * If the software was purchased under a paid Alfresco license, the terms of
958
- * the paid license agreement will prevail. Otherwise, the software is
959
- * provided under the following open source license terms:
960
- *
961
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
962
- * it under the terms of the GNU Lesser General Public License as published by
963
- * the Free Software Foundation, either version 3 of the License, or
964
- * (at your option) any later version.
965
- *
966
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
967
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
968
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
969
- * GNU Lesser General Public License for more details.
970
- *
971
- * You should have received a copy of the GNU Lesser General Public License
972
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
973
- */
974
- class ToolbarMenuComponent {
975
- constructor() {
976
- this.color = '';
977
- }
978
- handleKeydownEscape() {
979
- this.matTrigger.closeMenu();
980
- }
981
- get hasChildren() {
982
- return this.actionRef && this.actionRef.children && this.actionRef.children.length > 0;
983
- }
984
- trackById(_, obj) {
985
- return obj.id;
986
- }
987
- }
988
- ToolbarMenuComponent.decorators = [
989
- { type: Component, args: [{
990
- selector: 'app-toolbar-menu',
991
- template: "<button\n [id]=\"actionRef.id\"\n [color]=\"color\"\n mat-icon-button\n [attr.aria-label]=\"actionRef.description || actionRef.title | translate\"\n [attr.title]=\"actionRef.description || actionRef.title | translate\"\n [matMenuTriggerFor]=\"menu\"\n #matTrigger=\"matMenuTrigger\"\n>\n <adf-icon [value]=\"actionRef.icon\"></adf-icon>\n</button>\n\n<mat-menu #menu=\"matMenu\" [overlapTrigger]=\"false\">\n <ng-container *ngFor=\"let child of actionRef.children; trackBy: trackById\">\n <ng-container [ngSwitch]=\"child.type\">\n <ng-container *ngSwitchCase=\"'custom'\">\n <adf-dynamic-component [id]=\"child.component\" [data]=\"child.data\"></adf-dynamic-component>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <app-toolbar-menu-item [actionRef]=\"child\"></app-toolbar-menu-item>\n </ng-container>\n </ng-container>\n </ng-container>\n</mat-menu>\n",
992
- encapsulation: ViewEncapsulation.None,
993
- host: { class: 'app-toolbar-menu' }
994
- },] }
995
- ];
996
- ToolbarMenuComponent.propDecorators = {
997
- actionRef: [{ type: Input }],
998
- color: [{ type: Input }],
999
- matTrigger: [{ type: ViewChild, args: ['matTrigger',] }],
1000
- handleKeydownEscape: [{ type: HostListener, args: ['document:keydown.Escape',] }]
1001
- };
1002
-
1003
- /*!
1004
- * @license
1005
- * Alfresco Example Content Application
1006
- *
1007
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
1008
- *
1009
- * This file is part of the Alfresco Example Content Application.
1010
- * If the software was purchased under a paid Alfresco license, the terms of
1011
- * the paid license agreement will prevail. Otherwise, the software is
1012
- * provided under the following open source license terms:
1013
- *
1014
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
1015
- * it under the terms of the GNU Lesser General Public License as published by
1016
- * the Free Software Foundation, either version 3 of the License, or
1017
- * (at your option) any later version.
1018
- *
1019
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
1020
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1021
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1022
- * GNU Lesser General Public License for more details.
1023
- *
1024
- * You should have received a copy of the GNU Lesser General Public License
1025
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
1026
- */
1027
- class ToolbarActionComponent {
1028
- constructor(cd) {
1029
- this.cd = cd;
1030
- this.type = 'icon-button';
1031
- this.color = '';
1032
- }
1033
- // todo: review after ADF 2.6
1034
- // preview component : change detection workaround for children without input
1035
- ngDoCheck() {
1036
- if (this.actionRef.id.includes('app.viewer')) {
1037
- this.cd.markForCheck();
1038
- }
1039
- }
1040
- }
1041
- ToolbarActionComponent.decorators = [
1042
- { type: Component, args: [{
1043
- selector: 'aca-toolbar-action',
1044
- template: "<ng-container [ngSwitch]=\"actionRef.type\">\n <ng-container *ngSwitchCase=\"'default'\">\n <app-toolbar-button [type]=\"type\" [actionRef]=\"actionRef\" [color]=\"color\">\n </app-toolbar-button>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'button'\">\n <app-toolbar-button [type]=\"type\" [actionRef]=\"actionRef\" [color]=\"color\">\n </app-toolbar-button>\n </ng-container>\n\n <adf-toolbar-divider\n *ngSwitchCase=\"'separator'\"\n [id]=\"actionRef.id\"\n ></adf-toolbar-divider>\n\n <ng-container *ngSwitchCase=\"'menu'\">\n <app-toolbar-menu [actionRef]=\"actionRef\" [color]=\"color\">\n </app-toolbar-menu>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'custom'\">\n <adf-dynamic-component\n [data]=\"actionRef.data\"\n [id]=\"actionRef.component\"\n ></adf-dynamic-component>\n </ng-container>\n</ng-container>\n",
1045
- encapsulation: ViewEncapsulation.None,
1046
- changeDetection: ChangeDetectionStrategy.OnPush,
1047
- host: { class: 'aca-toolbar-action' }
1048
- },] }
1049
- ];
1050
- ToolbarActionComponent.ctorParameters = () => [
1051
- { type: ChangeDetectorRef }
1052
- ];
1053
- ToolbarActionComponent.propDecorators = {
1054
- type: [{ type: Input }],
1055
- color: [{ type: Input }],
1056
- actionRef: [{ type: Input }]
1057
- };
1058
-
1059
- /*!
1060
- * @license
1061
- * Alfresco Example Content Application
1062
- *
1063
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
1064
- *
1065
- * This file is part of the Alfresco Example Content Application.
1066
- * If the software was purchased under a paid Alfresco license, the terms of
1067
- * the paid license agreement will prevail. Otherwise, the software is
1068
- * provided under the following open source license terms:
1069
- *
1070
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
1071
- * it under the terms of the GNU Lesser General Public License as published by
1072
- * the Free Software Foundation, either version 3 of the License, or
1073
- * (at your option) any later version.
1074
- *
1075
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
1076
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1077
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1078
- * GNU Lesser General Public License for more details.
1079
- *
1080
- * You should have received a copy of the GNU Lesser General Public License
1081
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
1082
- */
1083
- var ToolbarButtonType;
1084
- (function (ToolbarButtonType) {
1085
- ToolbarButtonType["ICON_BUTTON"] = "icon-button";
1086
- ToolbarButtonType["MENU_ITEM"] = "menu-item";
1087
- })(ToolbarButtonType || (ToolbarButtonType = {}));
1088
- class ToolbarButtonComponent {
1089
- constructor(extensions) {
1090
- this.extensions = extensions;
1091
- this.type = ToolbarButtonType.ICON_BUTTON;
1092
- this.color = '';
1093
- }
1094
- runAction() {
1095
- if (this.hasClickAction(this.actionRef)) {
1096
- this.extensions.runActionById(this.actionRef.actions.click);
1097
- }
1098
- }
1099
- hasClickAction(actionRef) {
1100
- if (actionRef && actionRef.actions && actionRef.actions.click) {
1101
- return true;
1102
- }
1103
- return false;
1104
- }
1105
- }
1106
- ToolbarButtonComponent.decorators = [
1107
- { type: Component, args: [{
1108
- selector: 'app-toolbar-button',
1109
- template: "<ng-container [ngSwitch]=\"type\">\n <ng-container *ngSwitchCase=\"'icon-button'\">\n <button\n [id]=\"actionRef.id\"\n mat-icon-button\n [color]=\"color\"\n [attr.aria-label]=\"actionRef.description || actionRef.title | translate\"\n [attr.title]=\"actionRef.description || actionRef.title | translate\"\n (click)=\"runAction()\"\n >\n <adf-icon [value]=\"actionRef.icon\"></adf-icon>\n </button>\n </ng-container>\n <ng-container *ngSwitchCase=\"'menu-item'\">\n <app-toolbar-menu-item [actionRef]=\"actionRef\"></app-toolbar-menu-item>\n </ng-container>\n</ng-container>\n",
1110
- encapsulation: ViewEncapsulation.None,
1111
- host: { class: 'app-toolbar-button' }
1112
- },] }
1113
- ];
1114
- ToolbarButtonComponent.ctorParameters = () => [
1115
- { type: AppExtensionService }
1116
- ];
1117
- ToolbarButtonComponent.propDecorators = {
1118
- type: [{ type: Input }],
1119
- color: [{ type: Input }],
1120
- actionRef: [{ type: Input }]
1121
- };
1122
-
1123
- /*!
1124
- * @license
1125
- * Alfresco Example Content Application
1126
- *
1127
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
1128
- *
1129
- * This file is part of the Alfresco Example Content Application.
1130
- * If the software was purchased under a paid Alfresco license, the terms of
1131
- * the paid license agreement will prevail. Otherwise, the software is
1132
- * provided under the following open source license terms:
1133
- *
1134
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
1135
- * it under the terms of the GNU Lesser General Public License as published by
1136
- * the Free Software Foundation, either version 3 of the License, or
1137
- * (at your option) any later version.
1138
- *
1139
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
1140
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1141
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1142
- * GNU Lesser General Public License for more details.
1143
- *
1144
- * You should have received a copy of the GNU Lesser General Public License
1145
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
1146
- */
1147
- class SharedToolbarModule {
1148
- }
1149
- SharedToolbarModule.decorators = [
1150
- { type: NgModule, args: [{
1151
- imports: [CommonModule, CoreModule, ExtensionsModule],
1152
- declarations: [ToolbarButtonComponent, ToolbarActionComponent, ToolbarMenuItemComponent, ToolbarMenuComponent],
1153
- exports: [ToolbarButtonComponent, ToolbarActionComponent, ToolbarMenuItemComponent, ToolbarMenuComponent]
1154
- },] }
1155
- ];
1156
-
1157
- /*!
1158
- * @license
1159
- * Alfresco Example Content Application
1160
- *
1161
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
1162
- *
1163
- * This file is part of the Alfresco Example Content Application.
1164
- * If the software was purchased under a paid Alfresco license, the terms of
1165
- * the paid license agreement will prevail. Otherwise, the software is
1166
- * provided under the following open source license terms:
1167
- *
1168
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
1169
- * it under the terms of the GNU Lesser General Public License as published by
1170
- * the Free Software Foundation, either version 3 of the License, or
1171
- * (at your option) any later version.
1172
- *
1173
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
1174
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1175
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1176
- * GNU Lesser General Public License for more details.
1177
- *
1178
- * You should have received a copy of the GNU Lesser General Public License
1179
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
1180
- */
1181
- class ContentApiService {
1182
- constructor(api, preferences) {
1183
- this.api = api;
1184
- this.preferences = preferences;
1185
- }
1186
- /**
1187
- * Moves a node to the trashcan.
1188
- * @param nodeId ID of the target node
1189
- * @param options Optional parameters supported by JS-API
1190
- * @returns Empty result that notifies when the deletion is complete
1191
- */
1192
- deleteNode(nodeId, options = {}) {
1193
- return from(this.api.nodesApi.deleteNode(nodeId, options));
1194
- }
1195
- /**
1196
- * Gets the stored information about a node.
1197
- * @param nodeId ID of the target node
1198
- * @param options Optional parameters supported by JS-API
1199
- * @returns Node information
1200
- */
1201
- getNode(nodeId, options = {}) {
1202
- const defaults = {
1203
- include: ['path', 'properties', 'allowableOperations', 'permissions', 'definition']
1204
- };
1205
- const queryOptions = Object.assign(defaults, options);
1206
- return from(this.api.nodesApi.getNode(nodeId, queryOptions));
1207
- }
1208
- getNodeInfo(nodeId, options) {
1209
- const defaults = {
1210
- include: ['isFavorite', 'allowableOperations', 'path', 'definition']
1211
- };
1212
- const queryOptions = Object.assign(defaults, options || {});
1213
- return from(this.api.nodesApi.getNodeInfo(nodeId, queryOptions));
1214
- }
1215
- /**
1216
- * Gets the items contained in a folder node.
1217
- * @param nodeId ID of the target node
1218
- * @param options Optional parameters supported by JS-API
1219
- * @returns List of child items from the folder
1220
- */
1221
- getNodeChildren(nodeId, options = {}) {
1222
- const defaults = {
1223
- maxItems: this.preferences.paginationSize,
1224
- skipCount: 0,
1225
- include: ['isLocked', 'path', 'properties', 'allowableOperations', 'permissions']
1226
- };
1227
- const queryOptions = Object.assign(defaults, options);
1228
- return from(this.api.nodesApi.getNodeChildren(nodeId, queryOptions));
1229
- }
1230
- deleteSharedLink(linkId) {
1231
- return from(this.api.sharedLinksApi.deleteSharedLink(linkId));
1232
- }
1233
- getDeletedNodes(options = {}) {
1234
- const defaults = {
1235
- include: ['path']
1236
- };
1237
- const queryOptions = Object.assign(defaults, options);
1238
- return from(this.api.nodesApi.getDeletedNodes(queryOptions));
1239
- }
1240
- restoreNode(nodeId) {
1241
- return from(this.api.nodesApi.restoreNode(nodeId));
1242
- }
1243
- purgeDeletedNode(nodeId) {
1244
- return from(this.api.nodesApi.purgeDeletedNode(nodeId));
1245
- }
1246
- /**
1247
- * Gets information about a user identified by their username.
1248
- * @param personId ID of the target user
1249
- * @returns User information
1250
- */
1251
- getPerson(personId, options) {
1252
- return from(this.api.peopleApi.getPerson(personId, options));
1253
- }
1254
- /**
1255
- * Copy a node to destination node
1256
- *
1257
- * @param nodeId The id of the node to be copied
1258
- * @param targetParentId The id of the folder-node where the node have to be copied to
1259
- * @param name The new name for the copy that would be added on the destination folder
1260
- */
1261
- copyNode(nodeId, targetParentId, name, opts) {
1262
- return from(this.api.nodesApi.copyNode(nodeId, { targetParentId, name }, opts));
1263
- }
1264
- /**
1265
- * Gets product information for Content Services.
1266
- * @returns ProductVersionModel containing product details
1267
- */
1268
- getRepositoryInformation() {
1269
- return from(this.api.getInstance().discovery.discoveryApi.getRepositoryInformation());
1270
- }
1271
- getFavorites(personId, opts) {
1272
- return from(this.api.favoritesApi.getFavorites(personId, opts));
1273
- }
1274
- getFavoriteLibraries(personId = '-me-', opts) {
1275
- return this.getFavorites(personId, Object.assign(Object.assign({}, opts), { where: '(EXISTS(target/site))' })).pipe(map((response) => {
1276
- return {
1277
- list: {
1278
- entries: response.list.entries.map(({ entry }) => {
1279
- entry.target.site.createdAt = entry.createdAt;
1280
- return {
1281
- entry: entry.target.site
1282
- };
1283
- }),
1284
- pagination: response.list.pagination
1285
- }
1286
- };
1287
- }));
1288
- }
1289
- findSharedLinks(opts) {
1290
- return from(this.api.sharedLinksApi.findSharedLinks(opts));
1291
- }
1292
- getSharedLinkContent(sharedId, attachment) {
1293
- return this.api.contentApi.getSharedLinkContentUrl(sharedId, attachment);
1294
- }
1295
- search(request) {
1296
- return from(this.api.searchApi.search(request));
1297
- }
1298
- getContentUrl(nodeId, attachment) {
1299
- return this.api.contentApi.getContentUrl(nodeId, attachment);
1300
- }
1301
- getVersionContentUrl(nodeId, versionId, attachment) {
1302
- return this.api.contentApi.getVersionContentUrl(nodeId, versionId, attachment);
1303
- }
1304
- deleteSite(siteId, opts) {
1305
- return from(this.api.sitesApi.deleteSite(siteId, opts));
1306
- }
1307
- leaveSite(siteId) {
1308
- return from(this.api.sitesApi.removeSiteMember(siteId, '-me-'));
1309
- }
1310
- createSite(siteBody, opts) {
1311
- return from(this.api.sitesApi.createSite(siteBody, opts));
1312
- }
1313
- getSite(siteId, opts) {
1314
- return from(this.api.sitesApi.getSite(siteId, opts));
1315
- }
1316
- updateLibrary(siteId, siteBody) {
1317
- return from(this.api.sitesApi.updateSite(siteId, siteBody));
1318
- }
1319
- addFavorite(nodes) {
1320
- const payload = nodes.map((node) => {
1321
- const { isFolder, nodeId, id } = node.entry;
1322
- const siteId = node.entry['guid'];
1323
- const type = siteId ? 'site' : isFolder ? 'folder' : 'file';
1324
- const guid = siteId || nodeId || id;
1325
- return {
1326
- target: {
1327
- [type]: {
1328
- guid
1329
- }
1330
- }
1331
- };
1332
- });
1333
- return from(this.api.favoritesApi.addFavorite('-me-', payload));
1334
- }
1335
- removeFavorite(nodes) {
1336
- return from(Promise.all(nodes.map((node) => {
1337
- const id = node.entry.nodeId || node.entry.id;
1338
- return this.api.favoritesApi.removeFavoriteSite('-me-', id);
1339
- })));
1340
- }
1341
- unlockNode(nodeId, opts) {
1342
- return this.api.nodesApi.unlockNode(nodeId, opts);
1343
- }
1344
- }
1345
- ContentApiService.ɵprov = ɵɵdefineInjectable({ factory: function ContentApiService_Factory() { return new ContentApiService(ɵɵinject(AlfrescoApiService), ɵɵinject(UserPreferencesService)); }, token: ContentApiService, providedIn: "root" });
1346
- ContentApiService.decorators = [
1347
- { type: Injectable, args: [{
1348
- providedIn: 'root'
1349
- },] }
1350
- ];
1351
- ContentApiService.ctorParameters = () => [
1352
- { type: AlfrescoApiService },
1353
- { type: UserPreferencesService }
1354
- ];
1355
-
1356
- /*!
1357
- * @license
1358
- * Alfresco Example Content Application
1359
- *
1360
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
1361
- *
1362
- * This file is part of the Alfresco Example Content Application.
1363
- * If the software was purchased under a paid Alfresco license, the terms of
1364
- * the paid license agreement will prevail. Otherwise, the software is
1365
- * provided under the following open source license terms:
1366
- *
1367
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
1368
- * it under the terms of the GNU Lesser General Public License as published by
1369
- * the Free Software Foundation, either version 3 of the License, or
1370
- * (at your option) any later version.
1371
- *
1372
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
1373
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1374
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1375
- * GNU Lesser General Public License for more details.
1376
- *
1377
- * You should have received a copy of the GNU Lesser General Public License
1378
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
1379
- */
1380
- class InfoDrawerComponent {
1381
- constructor(store, contentApi, extensions) {
1382
- this.store = store;
1383
- this.contentApi = contentApi;
1384
- this.extensions = extensions;
1385
- this.isLoading = false;
1386
- this.tabs = [];
1387
- this.actions = [];
1388
- this.onDestroy$ = new Subject();
1389
- }
1390
- onEscapeKeyboardEvent() {
1391
- this.close();
1392
- }
1393
- ngOnInit() {
1394
- this.tabs = this.extensions.getSidebarTabs();
1395
- this.store
1396
- .select(getAppSelection)
1397
- .pipe(takeUntil(this.onDestroy$))
1398
- .subscribe(() => {
1399
- this.actions = this.extensions.getAllowedSidebarActions();
1400
- });
1401
- }
1402
- ngOnDestroy() {
1403
- this.onDestroy$.next(true);
1404
- this.onDestroy$.complete();
1405
- this.store.dispatch(new SetInfoDrawerStateAction(false));
1406
- }
1407
- ngOnChanges() {
1408
- if (this.node) {
1409
- if (this.node['isLibrary']) {
1410
- return this.setDisplayNode(this.node);
1411
- }
1412
- const entry = this.node.entry;
1413
- const id = entry.nodeId || entry.id;
1414
- return this.loadNodeInfo(id);
1415
- }
1416
- }
1417
- trackByActionId(_, action) {
1418
- return action.id;
1419
- }
1420
- close() {
1421
- this.store.dispatch(new ToggleInfoDrawerAction());
1422
- }
1423
- loadNodeInfo(nodeId) {
1424
- if (nodeId) {
1425
- this.isLoading = true;
1426
- this.contentApi.getNodeInfo(nodeId).subscribe((entity) => {
1427
- this.setDisplayNode(entity);
1428
- this.isLoading = false;
1429
- }, () => (this.isLoading = false));
1430
- }
1431
- }
1432
- setDisplayNode(node) {
1433
- this.displayNode = node;
1434
- }
1435
- }
1436
- InfoDrawerComponent.decorators = [
1437
- { type: Component, args: [{
1438
- selector: 'aca-info-drawer',
1439
- template: "<div *ngIf=\"isLoading\">\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n</div>\n<ng-container *ngIf=\"!isLoading && !!displayNode\">\n <adf-info-drawer\n [title]=\"'APP.INFO_DRAWER.TITLE'\"\n cdkTrapFocus\n cdkTrapFocusAutoCapture\n >\n <adf-toolbar class=\"adf-toolbar--inline\" info-drawer-buttons>\n <ng-container *ngFor=\"let entry of actions; trackBy: trackByActionId\">\n <aca-toolbar-action [actionRef]=\"entry\"></aca-toolbar-action>\n </ng-container>\n </adf-toolbar>\n\n <adf-info-drawer-tab\n *ngFor=\"let tab of tabs\"\n [icon]=\"tab.icon\"\n [label]=\"tab.title\"\n >\n <adf-dynamic-tab\n [node]=\"displayNode\"\n [id]=\"tab.component\"\n [attr.data-automation-id]=\"tab.component\"\n >\n </adf-dynamic-tab>\n </adf-info-drawer-tab>\n </adf-info-drawer>\n</ng-container>\n"
1440
- },] }
1441
- ];
1442
- InfoDrawerComponent.ctorParameters = () => [
1443
- { type: Store },
1444
- { type: ContentApiService },
1445
- { type: AppExtensionService }
1446
- ];
1447
- InfoDrawerComponent.propDecorators = {
1448
- nodeId: [{ type: Input }],
1449
- node: [{ type: Input }],
1450
- onEscapeKeyboardEvent: [{ type: HostListener, args: ['keydown.escape',] }]
1451
- };
1452
-
1453
- /*!
1454
- * @license
1455
- * Alfresco Example Content Application
1456
- *
1457
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
1458
- *
1459
- * This file is part of the Alfresco Example Content Application.
1460
- * If the software was purchased under a paid Alfresco license, the terms of
1461
- * the paid license agreement will prevail. Otherwise, the software is
1462
- * provided under the following open source license terms:
1463
- *
1464
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
1465
- * it under the terms of the GNU Lesser General Public License as published by
1466
- * the Free Software Foundation, either version 3 of the License, or
1467
- * (at your option) any later version.
1468
- *
1469
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
1470
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1471
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1472
- * GNU Lesser General Public License for more details.
1473
- *
1474
- * You should have received a copy of the GNU Lesser General Public License
1475
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
1476
- */
1477
- class SharedInfoDrawerModule {
1478
- }
1479
- SharedInfoDrawerModule.decorators = [
1480
- { type: NgModule, args: [{
1481
- imports: [CommonModule, InfoDrawerModule, MatProgressBarModule, ExtensionsModule, ToolbarModule, SharedToolbarModule],
1482
- declarations: [InfoDrawerComponent],
1483
- exports: [InfoDrawerComponent]
1484
- },] }
1485
- ];
1486
-
1487
- /*!
1488
- * @license
1489
- * Alfresco Example Content Application
1490
- *
1491
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
1492
- *
1493
- * This file is part of the Alfresco Example Content Application.
1494
- * If the software was purchased under a paid Alfresco license, the terms of
1495
- * the paid license agreement will prevail. Otherwise, the software is
1496
- * provided under the following open source license terms:
1497
- *
1498
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
1499
- * it under the terms of the GNU Lesser General Public License as published by
1500
- * the Free Software Foundation, either version 3 of the License, or
1501
- * (at your option) any later version.
1502
- *
1503
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
1504
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1505
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1506
- * GNU Lesser General Public License for more details.
1507
- *
1508
- * You should have received a copy of the GNU Lesser General Public License
1509
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
1510
- */
1511
- class ContextActionsDirective {
1512
- constructor(store) {
1513
- this.store = store;
1514
- this.execute$ = new Subject();
1515
- this.onDestroy$ = new Subject();
1516
- // tslint:disable-next-line:no-input-rename
1517
- this.enabled = true;
1518
- }
1519
- onContextMenuEvent(event) {
1520
- if (event) {
1521
- event.preventDefault();
1522
- if (this.enabled) {
1523
- const target = this.getTarget(event);
1524
- if (target) {
1525
- this.execute(event, target);
1526
- }
1527
- }
1528
- }
1529
- }
1530
- ngOnInit() {
1531
- this.execute$.pipe(debounceTime(300), takeUntil(this.onDestroy$)).subscribe((event) => {
1532
- this.store.dispatch(new ContextMenu(event));
1533
- });
1534
- }
1535
- ngOnDestroy() {
1536
- this.onDestroy$.next(true);
1537
- this.onDestroy$.complete();
1538
- }
1539
- execute(event, target) {
1540
- if (!this.isSelected(target)) {
1541
- target.dispatchEvent(new MouseEvent('click'));
1542
- }
1543
- this.execute$.next(event);
1544
- }
1545
- getTarget(event) {
1546
- const target = event.target;
1547
- return this.findAncestor(target, 'adf-datatable-cell');
1548
- }
1549
- isSelected(target) {
1550
- if (!target) {
1551
- return false;
1552
- }
1553
- return this.findAncestor(target, 'adf-datatable-row').classList.contains('adf-is-selected');
1554
- }
1555
- findAncestor(el, className) {
1556
- if (el.classList.contains(className)) {
1557
- return el;
1558
- }
1559
- // tslint:disable-next-line:curly
1560
- while ((el = el.parentElement) && !el.classList.contains(className))
1561
- ;
1562
- return el;
1563
- }
1564
- }
1565
- ContextActionsDirective.decorators = [
1566
- { type: Directive, args: [{
1567
- selector: '[acaContextActions]',
1568
- exportAs: 'acaContextActions'
1569
- },] }
1570
- ];
1571
- ContextActionsDirective.ctorParameters = () => [
1572
- { type: Store }
1573
- ];
1574
- ContextActionsDirective.propDecorators = {
1575
- enabled: [{ type: Input, args: ['acaContextEnable',] }],
1576
- onContextMenuEvent: [{ type: HostListener, args: ['contextmenu', ['$event'],] }]
1577
- };
1578
-
1579
- /*!
1580
- * @license
1581
- * Alfresco Example Content Application
1582
- *
1583
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
1584
- *
1585
- * This file is part of the Alfresco Example Content Application.
1586
- * If the software was purchased under a paid Alfresco license, the terms of
1587
- * the paid license agreement will prevail. Otherwise, the software is
1588
- * provided under the following open source license terms:
1589
- *
1590
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
1591
- * it under the terms of the GNU Lesser General Public License as published by
1592
- * the Free Software Foundation, either version 3 of the License, or
1593
- * (at your option) any later version.
1594
- *
1595
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
1596
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1597
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1598
- * GNU Lesser General Public License for more details.
1599
- *
1600
- * You should have received a copy of the GNU Lesser General Public License
1601
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
1602
- */
1603
- /**
1604
- * @deprecated in 1.11.0, use SharedDirectivesModule instead.
1605
- */
1606
- class ContextActionsModule {
1607
- }
1608
- ContextActionsModule.decorators = [
1609
- { type: NgModule, args: [{
1610
- declarations: [ContextActionsDirective],
1611
- exports: [ContextActionsDirective]
1612
- },] }
1613
- ];
1614
-
1615
- /*!
1616
- * @license
1617
- * Alfresco Example Content Application
1618
- *
1619
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
1620
- *
1621
- * This file is part of the Alfresco Example Content Application.
1622
- * If the software was purchased under a paid Alfresco license, the terms of
1623
- * the paid license agreement will prevail. Otherwise, the software is
1624
- * provided under the following open source license terms:
1625
- *
1626
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
1627
- * it under the terms of the GNU Lesser General Public License as published by
1628
- * the Free Software Foundation, either version 3 of the License, or
1629
- * (at your option) any later version.
1630
- *
1631
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
1632
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1633
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1634
- * GNU Lesser General Public License for more details.
1635
- *
1636
- * You should have received a copy of the GNU Lesser General Public License
1637
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
1638
- */
1639
- class PaginationDirective {
1640
- constructor(pagination, preferences, config) {
1641
- this.pagination = pagination;
1642
- this.preferences = preferences;
1643
- this.config = config;
1644
- this.subscriptions = [];
1645
- }
1646
- ngOnInit() {
1647
- this.pagination.supportedPageSizes = this.config.get('pagination.supportedPageSizes');
1648
- this.subscriptions.push(this.pagination.changePageSize.subscribe((event) => {
1649
- this.preferences.paginationSize = event.maxItems;
1650
- }));
1651
- }
1652
- ngOnDestroy() {
1653
- this.subscriptions.forEach((subscription) => subscription.unsubscribe());
1654
- this.subscriptions = [];
1655
- }
1656
- }
1657
- PaginationDirective.decorators = [
1658
- { type: Directive, args: [{
1659
- selector: '[acaPagination]'
1660
- },] }
1661
- ];
1662
- PaginationDirective.ctorParameters = () => [
1663
- { type: PaginationComponent },
1664
- { type: UserPreferencesService },
1665
- { type: AppConfigService }
1666
- ];
1667
-
1668
- /*!
1669
- * @license
1670
- * Alfresco Example Content Application
1671
- *
1672
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
1673
- *
1674
- * This file is part of the Alfresco Example Content Application.
1675
- * If the software was purchased under a paid Alfresco license, the terms of
1676
- * the paid license agreement will prevail. Otherwise, the software is
1677
- * provided under the following open source license terms:
1678
- *
1679
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
1680
- * it under the terms of the GNU Lesser General Public License as published by
1681
- * the Free Software Foundation, either version 3 of the License, or
1682
- * (at your option) any later version.
1683
- *
1684
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
1685
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1686
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1687
- * GNU Lesser General Public License for more details.
1688
- *
1689
- * You should have received a copy of the GNU Lesser General Public License
1690
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
1691
- */
1692
- class SharedDirectivesModule {
1693
- }
1694
- SharedDirectivesModule.decorators = [
1695
- { type: NgModule, args: [{
1696
- imports: [ContextActionsModule],
1697
- declarations: [PaginationDirective],
1698
- exports: [PaginationDirective, ContextActionsModule]
1699
- },] }
1700
- ];
1701
-
1702
- /*!
1703
- * @license
1704
- * Alfresco Example Content Application
1705
- *
1706
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
1707
- *
1708
- * This file is part of the Alfresco Example Content Application.
1709
- * If the software was purchased under a paid Alfresco license, the terms of
1710
- * the paid license agreement will prevail. Otherwise, the software is
1711
- * provided under the following open source license terms:
1712
- *
1713
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
1714
- * it under the terms of the GNU Lesser General Public License as published by
1715
- * the Free Software Foundation, either version 3 of the License, or
1716
- * (at your option) any later version.
1717
- *
1718
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
1719
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1720
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1721
- * GNU Lesser General Public License for more details.
1722
- *
1723
- * You should have received a copy of the GNU Lesser General Public License
1724
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
1725
- */
1726
-
1727
- /*!
1728
- * @license
1729
- * Alfresco Example Content Application
1730
- *
1731
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
1732
- *
1733
- * This file is part of the Alfresco Example Content Application.
1734
- * If the software was purchased under a paid Alfresco license, the terms of
1735
- * the paid license agreement will prevail. Otherwise, the software is
1736
- * provided under the following open source license terms:
1737
- *
1738
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
1739
- * it under the terms of the GNU Lesser General Public License as published by
1740
- * the Free Software Foundation, either version 3 of the License, or
1741
- * (at your option) any later version.
1742
- *
1743
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
1744
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1745
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1746
- * GNU Lesser General Public License for more details.
1747
- *
1748
- * You should have received a copy of the GNU Lesser General Public License
1749
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
1750
- */
1751
-
1752
- /*!
1753
- * @license
1754
- * Alfresco Example Content Application
1755
- *
1756
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
1757
- *
1758
- * This file is part of the Alfresco Example Content Application.
1759
- * If the software was purchased under a paid Alfresco license, the terms of
1760
- * the paid license agreement will prevail. Otherwise, the software is
1761
- * provided under the following open source license terms:
1762
- *
1763
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
1764
- * it under the terms of the GNU Lesser General Public License as published by
1765
- * the Free Software Foundation, either version 3 of the License, or
1766
- * (at your option) any later version.
1767
- *
1768
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
1769
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1770
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1771
- * GNU Lesser General Public License for more details.
1772
- *
1773
- * You should have received a copy of the GNU Lesser General Public License
1774
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
1775
- */
1776
- class AppRouteReuseStrategy {
1777
- constructor() {
1778
- this.routeCache = new Map();
1779
- }
1780
- resetCache() {
1781
- this.routeCache.forEach((value) => {
1782
- this.deactivateComponent(value.handle);
1783
- });
1784
- this.routeCache.clear();
1785
- }
1786
- deactivateComponent(handle) {
1787
- if (!handle) {
1788
- return;
1789
- }
1790
- const componentRef = handle['componentRef'];
1791
- if (componentRef) {
1792
- componentRef.destroy();
1793
- }
1794
- }
1795
- shouldReuseRoute(future, curr) {
1796
- const ret = future.routeConfig === curr.routeConfig;
1797
- if (ret) {
1798
- this.addRedirectsRecursively(future); // update redirects
1799
- }
1800
- return ret;
1801
- }
1802
- shouldDetach(route) {
1803
- const data = this.getRouteData(route);
1804
- return data && data.reuse;
1805
- }
1806
- store(route, handle) {
1807
- const url = this.getFullRouteUrl(route);
1808
- const data = this.getRouteData(route);
1809
- this.routeCache.set(url, { handle, data });
1810
- this.addRedirectsRecursively(route);
1811
- }
1812
- shouldAttach(route) {
1813
- const url = this.getFullRouteUrl(route);
1814
- return this.routeCache.has(url);
1815
- }
1816
- retrieve(route) {
1817
- const url = this.getFullRouteUrl(route);
1818
- const data = this.getRouteData(route);
1819
- return data && data.reuse && this.routeCache.has(url) ? this.routeCache.get(url).handle : null;
1820
- }
1821
- addRedirectsRecursively(route) {
1822
- const config = route.routeConfig;
1823
- if (config) {
1824
- if (!config.loadChildren) {
1825
- const routeFirstChild = route.firstChild;
1826
- const routeFirstChildUrl = routeFirstChild ? this.getRouteUrlPaths(routeFirstChild).join('/') : '';
1827
- const childConfigs = config.children;
1828
- if (childConfigs) {
1829
- const childConfigWithRedirect = childConfigs.find((c) => c.path === '' && !!c.redirectTo);
1830
- if (childConfigWithRedirect) {
1831
- childConfigWithRedirect.redirectTo = routeFirstChildUrl;
1832
- }
1833
- }
1834
- }
1835
- route.children.forEach((childRoute) => this.addRedirectsRecursively(childRoute));
1836
- }
1837
- }
1838
- getFullRouteUrl(route) {
1839
- return this.getFullRouteUrlPaths(route).filter(Boolean).join('/');
1840
- }
1841
- getFullRouteUrlPaths(route) {
1842
- const paths = this.getRouteUrlPaths(route);
1843
- return route.parent ? [...this.getFullRouteUrlPaths(route.parent), ...paths] : paths;
1844
- }
1845
- getRouteUrlPaths(route) {
1846
- return route.url.map((urlSegment) => urlSegment.path);
1847
- }
1848
- getRouteData(route) {
1849
- return route.routeConfig && route.routeConfig.data;
1850
- }
1851
- }
1852
- AppRouteReuseStrategy.decorators = [
1853
- { type: Injectable }
1854
- ];
1855
-
1856
- /*!
1857
- * @license
1858
- * Alfresco Example Content Application
1859
- *
1860
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
1861
- *
1862
- * This file is part of the Alfresco Example Content Application.
1863
- * If the software was purchased under a paid Alfresco license, the terms of
1864
- * the paid license agreement will prevail. Otherwise, the software is
1865
- * provided under the following open source license terms:
1866
- *
1867
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
1868
- * it under the terms of the GNU Lesser General Public License as published by
1869
- * the Free Software Foundation, either version 3 of the License, or
1870
- * (at your option) any later version.
1871
- *
1872
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
1873
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1874
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1875
- * GNU Lesser General Public License for more details.
1876
- *
1877
- * You should have received a copy of the GNU Lesser General Public License
1878
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
1879
- */
1880
- class AppSharedRuleGuard {
1881
- constructor(store) {
1882
- this.isQuickShareEnabled$ = store.select(isQuickShareEnabled);
1883
- }
1884
- canActivate(_) {
1885
- return this.isQuickShareEnabled$;
1886
- }
1887
- canActivateChild(route) {
1888
- return this.canActivate(route);
1889
- }
1890
- }
1891
- AppSharedRuleGuard.ɵprov = ɵɵdefineInjectable({ factory: function AppSharedRuleGuard_Factory() { return new AppSharedRuleGuard(ɵɵinject(Store)); }, token: AppSharedRuleGuard, providedIn: "root" });
1892
- AppSharedRuleGuard.decorators = [
1893
- { type: Injectable, args: [{
1894
- providedIn: 'root'
1895
- },] }
1896
- ];
1897
- AppSharedRuleGuard.ctorParameters = () => [
1898
- { type: Store }
1899
- ];
1900
-
1901
- /*!
1902
- * @license
1903
- * Alfresco Example Content Application
1904
- *
1905
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
1906
- *
1907
- * This file is part of the Alfresco Example Content Application.
1908
- * If the software was purchased under a paid Alfresco license, the terms of
1909
- * the paid license agreement will prevail. Otherwise, the software is
1910
- * provided under the following open source license terms:
1911
- *
1912
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
1913
- * it under the terms of the GNU Lesser General Public License as published by
1914
- * the Free Software Foundation, either version 3 of the License, or
1915
- * (at your option) any later version.
1916
- *
1917
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
1918
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1919
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1920
- * GNU Lesser General Public License for more details.
1921
- *
1922
- * You should have received a copy of the GNU Lesser General Public License
1923
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
1924
- */
1925
- class AppService {
1926
- constructor(auth, config, searchQueryBuilderService, routeStrategy) {
1927
- this.config = config;
1928
- this.ready = new BehaviorSubject(auth.isLoggedIn() || this.withCredentials);
1929
- this.ready$ = this.ready.asObservable();
1930
- auth.onLogin.subscribe(() => {
1931
- routeStrategy.resetCache();
1932
- this.ready.next(true);
1933
- });
1934
- auth.onLogout.subscribe(() => {
1935
- searchQueryBuilderService.resetToDefaults();
1936
- routeStrategy.resetCache();
1937
- });
1938
- }
1939
- /**
1940
- * Whether `withCredentials` mode is enabled.
1941
- * Usually means that `Kerberos` mode is used.
1942
- */
1943
- get withCredentials() {
1944
- return this.config.get('auth.withCredentials', false);
1945
- }
1946
- }
1947
- AppService.ɵprov = ɵɵdefineInjectable({ factory: function AppService_Factory() { return new AppService(ɵɵinject(AuthenticationService), ɵɵinject(AppConfigService), ɵɵinject(SearchQueryBuilderService), ɵɵinject(RouteReuseStrategy)); }, token: AppService, providedIn: "root" });
1948
- AppService.decorators = [
1949
- { type: Injectable, args: [{
1950
- providedIn: 'root'
1951
- },] }
1952
- ];
1953
- AppService.ctorParameters = () => [
1954
- { type: AuthenticationService },
1955
- { type: AppConfigService },
1956
- { type: SearchQueryBuilderService },
1957
- { type: AppRouteReuseStrategy, decorators: [{ type: Inject, args: [RouteReuseStrategy,] }] }
1958
- ];
1959
-
1960
- /*!
1961
- * @license
1962
- * Alfresco Example Content Application
1963
- *
1964
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
1965
- *
1966
- * This file is part of the Alfresco Example Content Application.
1967
- * If the software was purchased under a paid Alfresco license, the terms of
1968
- * the paid license agreement will prevail. Otherwise, the software is
1969
- * provided under the following open source license terms:
1970
- *
1971
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
1972
- * it under the terms of the GNU Lesser General Public License as published by
1973
- * the Free Software Foundation, either version 3 of the License, or
1974
- * (at your option) any later version.
1975
- *
1976
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
1977
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1978
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1979
- * GNU Lesser General Public License for more details.
1980
- *
1981
- * You should have received a copy of the GNU Lesser General Public License
1982
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
1983
- */
1984
- class RouterExtensionService {
1985
- constructor(router, extensions) {
1986
- this.router = router;
1987
- this.extensions = extensions;
1988
- this.defaults = {
1989
- layout: 'app.layout.main',
1990
- auth: ['app.auth']
1991
- };
1992
- }
1993
- mapExtensionRoutes() {
1994
- const routesWithoutParent = [];
1995
- this.getApplicationRoutes().forEach((extensionRoute) => {
1996
- if (this.extensionRouteHasChild(extensionRoute)) {
1997
- const parentRoute = this.findRoute(extensionRoute.parentRoute);
1998
- if (parentRoute) {
1999
- this.convertExtensionRouteToRoute(extensionRoute);
2000
- parentRoute.children.unshift(extensionRoute);
2001
- }
2002
- }
2003
- else {
2004
- routesWithoutParent.push(extensionRoute);
2005
- }
2006
- });
2007
- this.router.config.unshift(...routesWithoutParent);
2008
- }
2009
- getApplicationRoutes() {
2010
- return this.extensions.routes.map((route) => {
2011
- const guards = this.extensions.getAuthGuards(route.auth && route.auth.length > 0 ? route.auth : this.defaults.auth);
2012
- return {
2013
- path: route.path,
2014
- component: this.getComponentById(route.layout || this.defaults.layout),
2015
- canActivateChild: guards,
2016
- canActivate: guards,
2017
- parentRoute: route.parentRoute,
2018
- children: [
2019
- ...(route['children']
2020
- ? route['children'].map(({ path, component, outlet, data }) => {
2021
- return {
2022
- path,
2023
- outlet,
2024
- data,
2025
- component: this.getComponentById(component)
2026
- };
2027
- })
2028
- : []),
2029
- {
2030
- path: '',
2031
- component: this.getComponentById(route.component),
2032
- data: route.data
2033
- }
2034
- ]
2035
- };
2036
- });
2037
- }
2038
- getComponentById(id) {
2039
- return this.extensions.getComponentById(id);
2040
- }
2041
- extensionRouteHasChild(route) {
2042
- return route.parentRoute !== undefined;
2043
- }
2044
- convertExtensionRouteToRoute(extensionRoute) {
2045
- delete extensionRoute.parentRoute;
2046
- delete extensionRoute.component;
2047
- }
2048
- findRoute(parentRoute) {
2049
- const routeIndex = this.router.config.findIndex((route) => route.path === parentRoute);
2050
- return this.router.config[routeIndex];
2051
- }
2052
- }
2053
- RouterExtensionService.ɵprov = ɵɵdefineInjectable({ factory: function RouterExtensionService_Factory() { return new RouterExtensionService(ɵɵinject(Router), ɵɵinject(ExtensionService)); }, token: RouterExtensionService, providedIn: "root" });
2054
- RouterExtensionService.decorators = [
2055
- { type: Injectable, args: [{
2056
- providedIn: 'root'
2057
- },] }
2058
- ];
2059
- RouterExtensionService.ctorParameters = () => [
2060
- { type: Router },
2061
- { type: ExtensionService }
2062
- ];
2063
-
2064
- /*!
2065
- * @license
2066
- * Alfresco Example Content Application
2067
- *
2068
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
2069
- *
2070
- * This file is part of the Alfresco Example Content Application.
2071
- * If the software was purchased under a paid Alfresco license, the terms of
2072
- * the paid license agreement will prevail. Otherwise, the software is
2073
- * provided under the following open source license terms:
2074
- *
2075
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
2076
- * it under the terms of the GNU Lesser General Public License as published by
2077
- * the Free Software Foundation, either version 3 of the License, or
2078
- * (at your option) any later version.
2079
- *
2080
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
2081
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2082
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2083
- * GNU Lesser General Public License for more details.
2084
- *
2085
- * You should have received a copy of the GNU Lesser General Public License
2086
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
2087
- */
2088
- function isLocked(node) {
2089
- const { entry } = node;
2090
- return ((entry && entry.isLocked) ||
2091
- (entry.properties && (entry.properties['cm:lockType'] === 'READ_ONLY_LOCK' || entry.properties['cm:lockType'] === 'WRITE_LOCK')));
2092
- }
2093
- function isLibrary(node) {
2094
- const { entry } = node;
2095
- return (entry.guid && entry.id && entry.preset && entry.title && entry.visibility) || entry.nodeType === 'st:site';
2096
- }
2097
-
2098
- /*!
2099
- * @license
2100
- * Alfresco Example Content Application
2101
- *
2102
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
2103
- *
2104
- * This file is part of the Alfresco Example Content Application.
2105
- * If the software was purchased under a paid Alfresco license, the terms of
2106
- * the paid license agreement will prevail. Otherwise, the software is
2107
- * provided under the following open source license terms:
2108
- *
2109
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
2110
- * it under the terms of the GNU Lesser General Public License as published by
2111
- * the Free Software Foundation, either version 3 of the License, or
2112
- * (at your option) any later version.
2113
- *
2114
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
2115
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2116
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2117
- * GNU Lesser General Public License for more details.
2118
- *
2119
- * You should have received a copy of the GNU Lesser General Public License
2120
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
2121
- */
2122
- class SharedModule {
2123
- static forRoot() {
2124
- return {
2125
- ngModule: SharedModule,
2126
- providers: [ContentApiService, NodePermissionService, AppService]
2127
- };
2128
- }
2129
- }
2130
- SharedModule.decorators = [
2131
- { type: NgModule, args: [{
2132
- imports: [ContextActionsModule],
2133
- exports: [ContextActionsModule]
2134
- },] }
2135
- ];
2136
-
2137
- /*!
2138
- * @license
2139
- * Alfresco Example Content Application
2140
- *
2141
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
2142
- *
2143
- * This file is part of the Alfresco Example Content Application.
2144
- * If the software was purchased under a paid Alfresco license, the terms of
2145
- * the paid license agreement will prevail. Otherwise, the software is
2146
- * provided under the following open source license terms:
2147
- *
2148
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
2149
- * it under the terms of the GNU Lesser General Public License as published by
2150
- * the Free Software Foundation, either version 3 of the License, or
2151
- * (at your option) any later version.
2152
- *
2153
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
2154
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2155
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2156
- * GNU Lesser General Public License for more details.
2157
- *
2158
- * You should have received a copy of the GNU Lesser General Public License
2159
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
2160
- */
2161
-
2162
- /**
2163
- * Generated bundle index. Do not edit.
2164
- */
2165
-
2166
- export { AppExtensionService, AppRouteReuseStrategy, AppService, AppSharedRuleGuard, ContentApiService, ContextActionsDirective, ContextActionsModule, DefaultExtensionLoaderFactory, EXTENSION_DATA_LOADERS, ExtensionsDataLoaderGuard, GenericErrorComponent, GenericErrorModule, InfoDrawerComponent, LockedByComponent, LockedByModule, NodePermissionService, PageLayoutComponent, PageLayoutContentComponent, PageLayoutErrorComponent, PageLayoutHeaderComponent, PageLayoutModule, PaginationDirective, RouterExtensionService, SharedDirectivesModule, SharedInfoDrawerModule, SharedModule, SharedToolbarModule, ToolbarActionComponent, ToolbarButtonComponent, ToolbarButtonType, ToolbarMenuComponent, ToolbarMenuItemComponent, isLibrary, isLocked };
2167
- //# sourceMappingURL=alfresco-aca-shared.js.map