@alfresco/aca-shared 2.0.1 → 4.0.0-A.2-9920

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 (220) hide show
  1. package/README.md +2 -1
  2. package/{esm2015/alfresco-aca-shared.js → esm2020/alfresco-aca-shared.mjs} +0 -0
  3. package/esm2020/lib/adf-extensions/extensions-data-loader.guard.mjs +74 -0
  4. package/esm2020/lib/components/document-base-page/document-base-page.component.mjs +160 -0
  5. package/esm2020/lib/components/document-base-page/document-base-page.service.mjs +10 -0
  6. package/esm2020/lib/components/generic-error/generic-error.component.mjs +42 -0
  7. package/esm2020/lib/components/generic-error/generic-error.module.mjs +45 -0
  8. package/esm2020/lib/components/info-drawer/info-drawer.component.mjs +124 -0
  9. package/esm2020/lib/components/info-drawer/shared-info-drawer.module.mjs +47 -0
  10. package/esm2020/lib/components/locked-by/locked-by.component.mjs +53 -0
  11. package/esm2020/lib/components/locked-by/locked-by.module.mjs +45 -0
  12. package/esm2020/lib/components/page-layout/page-layout-content.component.mjs +49 -0
  13. package/esm2020/lib/components/page-layout/page-layout-error.component.mjs +41 -0
  14. package/esm2020/lib/components/page-layout/page-layout-header.component.mjs +41 -0
  15. package/esm2020/lib/components/page-layout/page-layout.component.mjs +41 -0
  16. package/esm2020/lib/components/page-layout/page-layout.module.mjs +45 -0
  17. package/esm2020/lib/components/tool-bar/shared-toolbar.module.mjs +47 -0
  18. package/esm2020/lib/components/tool-bar/toolbar-action/toolbar-action.component.mjs +58 -0
  19. package/esm2020/lib/components/tool-bar/toolbar-button/toolbar-button.component.mjs +67 -0
  20. package/esm2020/lib/components/tool-bar/toolbar-menu/toolbar-menu.component.mjs +78 -0
  21. package/esm2020/lib/components/tool-bar/toolbar-menu-item/toolbar-menu-item.component.mjs +69 -0
  22. package/esm2020/lib/directives/contextmenu/contextmenu.directive.mjs +107 -0
  23. package/{esm2015/lib/components/info-drawer/shared-info-drawer.module.js → esm2020/lib/directives/contextmenu/contextmenu.module.mjs} +17 -15
  24. package/esm2020/lib/directives/pagination.directive.mjs +55 -0
  25. package/esm2020/lib/directives/shared.directives.module.mjs +42 -0
  26. package/esm2020/lib/models/modal-configuration.mjs +2 -0
  27. package/{esm2015/lib/models/types.js → esm2020/lib/models/types.mjs} +1 -0
  28. package/{esm2015/lib/models/viewer.rules.js → esm2020/lib/models/viewer.rules.mjs} +2 -1
  29. package/esm2020/lib/routing/shared.guard.mjs +49 -0
  30. package/esm2020/lib/services/alfresco-office-extension.service.mjs +64 -0
  31. package/esm2020/lib/services/app-hook.service.mjs +88 -0
  32. package/esm2020/lib/services/app.extension.service.mjs +453 -0
  33. package/esm2020/lib/services/app.service.mjs +213 -0
  34. package/esm2020/lib/services/content-api.service.mjs +268 -0
  35. package/{esm2015/lib/services/node-permission.service.js → esm2020/lib/services/node-permission.service.mjs} +9 -7
  36. package/esm2020/lib/services/router.extension.service.mjs +106 -0
  37. package/esm2020/lib/shared.module.mjs +49 -0
  38. package/esm2020/lib/testing/lib-testing-module.mjs +118 -0
  39. package/{esm2015/store/actions/contextmenu.actions.js → esm2020/lib/testing/translation.service.mjs} +19 -9
  40. package/{esm2015/lib/utils/node.utils.js → esm2020/lib/utils/node.utils.mjs} +0 -0
  41. package/esm2020/public-api.mjs +63 -0
  42. package/{esm2015/rules/alfresco-aca-shared-rules.js → esm2020/rules/alfresco-aca-shared-rules.mjs} +0 -0
  43. package/esm2020/rules/app.rules.mjs +503 -0
  44. package/esm2020/rules/navigation.rules.mjs +152 -0
  45. package/{esm2015/rules/public-api.js → esm2020/rules/public-api.mjs} +0 -0
  46. package/{esm2015/store/states/app.state.js → esm2020/rules/repository.rules.mjs} +10 -1
  47. package/esm2020/rules/user.rules.mjs +30 -0
  48. package/esm2020/store/actions/app-action-types.mjs +48 -0
  49. package/esm2020/store/actions/app.actions.mjs +135 -0
  50. package/esm2020/store/actions/context-menu-action-types.mjs +29 -0
  51. package/esm2020/store/actions/contextmenu.actions.mjs +32 -0
  52. package/esm2020/store/actions/library.actions.mjs +64 -0
  53. package/{esm2015/store/actions/metadata-aspect.actions.js → esm2020/store/actions/metadata-aspect.actions.mjs} +0 -0
  54. package/esm2020/store/actions/node.actions.mjs +189 -0
  55. package/{esm2015/lib/components/generic-error/generic-error.module.js → esm2020/store/actions/router-action-types.mjs} +9 -15
  56. package/esm2020/store/actions/router.actions.mjs +55 -0
  57. package/esm2020/store/actions/search.actions.mjs +36 -0
  58. package/esm2020/store/actions/snackbar.actions.mjs +58 -0
  59. package/esm2020/store/actions/template-action-types.mjs +32 -0
  60. package/{esm2015/lib/components/generic-error/generic-error.component.js → esm2020/store/actions/template.actions.mjs} +21 -17
  61. package/esm2020/store/actions/upload.actions.mjs +50 -0
  62. package/esm2020/store/actions/viewer.actions.mjs +82 -0
  63. package/{esm2015/store/alfresco-aca-shared-store.js → esm2020/store/alfresco-aca-shared-store.mjs} +0 -0
  64. package/esm2020/store/effects/dialog.effects.mjs +45 -0
  65. package/esm2020/store/effects/router.effects.mjs +117 -0
  66. package/esm2020/store/effects/snackbar.effects.mjs +86 -0
  67. package/{esm2015/store/models/delete-status.model.js → esm2020/store/models/delete-status.model.mjs} +1 -0
  68. package/{esm2015/store/models/deleted-node-info.model.js → esm2020/store/models/deleted-node-info.model.mjs} +1 -0
  69. package/esm2020/store/models/modal-configuration.mjs +2 -0
  70. package/{esm2015/store/models/node-info.model.js → esm2020/store/models/node-info.model.mjs} +1 -0
  71. package/{esm2015/store/models/search-option.model.js → esm2020/store/models/search-option.model.mjs} +0 -0
  72. package/esm2020/store/public-api.mjs +50 -0
  73. package/esm2020/store/selectors/app.selectors.mjs +60 -0
  74. package/esm2020/store/states/app.state.mjs +27 -0
  75. package/esm2020/store/store.module.mjs +43 -0
  76. package/fesm2015/alfresco-aca-shared-rules.mjs +751 -0
  77. package/fesm2015/alfresco-aca-shared-rules.mjs.map +1 -0
  78. package/fesm2015/{alfresco-aca-shared-store.js → alfresco-aca-shared-store.mjs} +302 -276
  79. package/fesm2015/alfresco-aca-shared-store.mjs.map +1 -0
  80. package/fesm2015/alfresco-aca-shared.mjs +2726 -0
  81. package/fesm2015/alfresco-aca-shared.mjs.map +1 -0
  82. package/{fesm2015/alfresco-aca-shared-rules.js → fesm2020/alfresco-aca-shared-rules.mjs} +220 -150
  83. package/fesm2020/alfresco-aca-shared-rules.mjs.map +1 -0
  84. package/fesm2020/alfresco-aca-shared-store.mjs +1406 -0
  85. package/fesm2020/alfresco-aca-shared-store.mjs.map +1 -0
  86. package/fesm2020/alfresco-aca-shared.mjs +2841 -0
  87. package/fesm2020/alfresco-aca-shared.mjs.map +1 -0
  88. package/{alfresco-aca-shared.d.ts → index.d.ts} +1 -0
  89. package/lib/adf-extensions/extensions-data-loader.guard.d.ts +4 -1
  90. package/lib/components/document-base-page/document-base-page.component.d.ts +74 -0
  91. package/lib/components/document-base-page/document-base-page.service.d.ts +5 -0
  92. package/lib/components/generic-error/generic-error.component.d.ts +3 -24
  93. package/lib/components/generic-error/generic-error.module.d.ts +8 -24
  94. package/lib/components/info-drawer/info-drawer.component.d.ts +6 -0
  95. package/lib/components/info-drawer/shared-info-drawer.module.d.ts +11 -24
  96. package/lib/components/locked-by/locked-by.component.d.ts +5 -30
  97. package/lib/components/locked-by/locked-by.module.d.ts +8 -24
  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 +3 -24
  102. package/lib/components/page-layout/page-layout.module.d.ts +9 -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 +7 -2
  105. package/lib/components/tool-bar/toolbar-button/toolbar-button.component.d.ts +5 -25
  106. package/lib/components/tool-bar/toolbar-menu/toolbar-menu.component.d.ts +13 -7
  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 +5 -1
  109. package/lib/directives/contextmenu/contextmenu.module.d.ts +5 -24
  110. package/lib/directives/pagination.directive.d.ts +3 -0
  111. package/lib/directives/shared.directives.module.d.ts +6 -24
  112. package/lib/models/modal-configuration.d.ts +3 -0
  113. package/lib/models/viewer.rules.d.ts +4 -0
  114. package/lib/routing/shared.guard.d.ts +3 -24
  115. package/lib/services/alfresco-office-extension.service.d.ts +11 -0
  116. package/lib/services/app-hook.service.d.ts +55 -0
  117. package/lib/services/app.extension.service.d.ts +30 -45
  118. package/lib/services/app.service.d.ts +42 -6
  119. package/lib/services/content-api.service.d.ts +34 -25
  120. package/lib/services/node-permission.service.d.ts +3 -24
  121. package/lib/services/router.extension.service.d.ts +3 -24
  122. package/lib/shared.module.d.ts +5 -0
  123. package/lib/testing/lib-testing-module.d.ts +43 -0
  124. package/lib/testing/translation.service.d.ts +10 -0
  125. package/package.json +57 -18
  126. package/public-api.d.ts +7 -1
  127. package/rules/app.rules.d.ts +104 -30
  128. package/rules/{alfresco-aca-shared-rules.d.ts → index.d.ts} +1 -0
  129. package/rules/navigation.rules.d.ts +6 -6
  130. package/rules/repository.rules.d.ts +2 -1
  131. package/rules/user.rules.d.ts +1 -1
  132. package/store/actions/app-action-types.d.ts +46 -0
  133. package/store/actions/app.actions.d.ts +19 -18
  134. package/{lib/routing/app.routes.strategy.d.ts → store/actions/context-menu-action-types.d.ts} +2 -15
  135. package/store/actions/contextmenu.actions.d.ts +1 -3
  136. package/store/actions/library.actions.d.ts +3 -1
  137. package/store/actions/node.actions.d.ts +33 -7
  138. package/store/actions/router-action-types.d.ts +31 -0
  139. package/store/actions/router.actions.d.ts +5 -6
  140. package/store/actions/search.actions.d.ts +1 -13
  141. package/store/actions/snackbar.actions.d.ts +8 -11
  142. package/store/actions/template-action-types.d.ts +30 -0
  143. package/store/actions/template.actions.d.ts +1 -6
  144. package/store/actions/upload.actions.d.ts +3 -1
  145. package/store/actions/viewer.actions.d.ts +6 -0
  146. package/store/effects/dialog.effects.d.ts +4 -1
  147. package/store/effects/router.effects.d.ts +11 -29
  148. package/store/effects/snackbar.effects.d.ts +6 -3
  149. package/store/{alfresco-aca-shared-store.d.ts → index.d.ts} +1 -0
  150. package/store/models/modal-configuration.d.ts +3 -0
  151. package/store/public-api.d.ts +4 -0
  152. package/store/selectors/app.selectors.d.ts +6 -1
  153. package/store/states/app.state.d.ts +8 -1
  154. package/store/store.module.d.ts +5 -24
  155. package/alfresco-aca-shared.metadata.json +0 -1
  156. package/bundles/alfresco-aca-shared-rules.umd.js +0 -745
  157. package/bundles/alfresco-aca-shared-rules.umd.js.map +0 -1
  158. package/bundles/alfresco-aca-shared-rules.umd.min.js +0 -125
  159. package/bundles/alfresco-aca-shared-rules.umd.min.js.map +0 -1
  160. package/bundles/alfresco-aca-shared-store.umd.js +0 -1784
  161. package/bundles/alfresco-aca-shared-store.umd.js.map +0 -1
  162. package/bundles/alfresco-aca-shared-store.umd.min.js +0 -462
  163. package/bundles/alfresco-aca-shared-store.umd.min.js.map +0 -1
  164. package/bundles/alfresco-aca-shared.umd.js +0 -2523
  165. package/bundles/alfresco-aca-shared.umd.js.map +0 -1
  166. package/bundles/alfresco-aca-shared.umd.min.js +0 -740
  167. package/bundles/alfresco-aca-shared.umd.min.js.map +0 -1
  168. package/esm2015/lib/adf-extensions/extensions-data-loader.guard.js +0 -74
  169. package/esm2015/lib/components/info-drawer/info-drawer.component.js +0 -105
  170. package/esm2015/lib/components/locked-by/locked-by.component.js +0 -54
  171. package/esm2015/lib/components/locked-by/locked-by.module.js +0 -38
  172. package/esm2015/lib/components/page-layout/page-layout-content.component.js +0 -43
  173. package/esm2015/lib/components/page-layout/page-layout-error.component.js +0 -37
  174. package/esm2015/lib/components/page-layout/page-layout-header.component.js +0 -37
  175. package/esm2015/lib/components/page-layout/page-layout.component.js +0 -44
  176. package/esm2015/lib/components/page-layout/page-layout.module.js +0 -40
  177. package/esm2015/lib/components/tool-bar/shared-toolbar.module.js +0 -42
  178. package/esm2015/lib/components/tool-bar/toolbar-action/toolbar-action.component.js +0 -57
  179. package/esm2015/lib/components/tool-bar/toolbar-button/toolbar-button.component.js +0 -66
  180. package/esm2015/lib/components/tool-bar/toolbar-menu/toolbar-menu.component.js +0 -55
  181. package/esm2015/lib/components/tool-bar/toolbar-menu-item/toolbar-menu-item.component.js +0 -65
  182. package/esm2015/lib/directives/contextmenu/contextmenu.directive.js +0 -97
  183. package/esm2015/lib/directives/contextmenu/contextmenu.module.js +0 -38
  184. package/esm2015/lib/directives/pagination.directive.js +0 -55
  185. package/esm2015/lib/directives/shared.directives.module.js +0 -37
  186. package/esm2015/lib/routing/app.routes.strategy.js +0 -105
  187. package/esm2015/lib/routing/shared.guard.js +0 -50
  188. package/esm2015/lib/services/app.extension.service.js +0 -398
  189. package/esm2015/lib/services/app.service.js +0 -69
  190. package/esm2015/lib/services/content-api.service.js +0 -205
  191. package/esm2015/lib/services/router.extension.service.js +0 -110
  192. package/esm2015/lib/shared.module.js +0 -44
  193. package/esm2015/public-api.js +0 -57
  194. package/esm2015/rules/app.rules.js +0 -420
  195. package/esm2015/rules/navigation.rules.js +0 -164
  196. package/esm2015/rules/repository.rules.js +0 -32
  197. package/esm2015/rules/user.rules.js +0 -32
  198. package/esm2015/store/actions/app.actions.js +0 -130
  199. package/esm2015/store/actions/library.actions.js +0 -63
  200. package/esm2015/store/actions/node.actions.js +0 -161
  201. package/esm2015/store/actions/router.actions.js +0 -56
  202. package/esm2015/store/actions/search.actions.js +0 -54
  203. package/esm2015/store/actions/snackbar.actions.js +0 -61
  204. package/esm2015/store/actions/template.actions.js +0 -54
  205. package/esm2015/store/actions/upload.actions.js +0 -49
  206. package/esm2015/store/actions/viewer.actions.js +0 -75
  207. package/esm2015/store/effects/dialog.effects.js +0 -49
  208. package/esm2015/store/effects/router.effects.js +0 -132
  209. package/esm2015/store/effects/snackbar.effects.js +0 -90
  210. package/esm2015/store/public-api.js +0 -46
  211. package/esm2015/store/selectors/app.selectors.js +0 -80
  212. package/esm2015/store/store.module.js +0 -37
  213. package/fesm2015/alfresco-aca-shared-rules.js.map +0 -1
  214. package/fesm2015/alfresco-aca-shared-store.js.map +0 -1
  215. package/fesm2015/alfresco-aca-shared.js +0 -2167
  216. package/fesm2015/alfresco-aca-shared.js.map +0 -1
  217. package/rules/alfresco-aca-shared-rules.metadata.json +0 -1
  218. package/rules/package.json +0 -11
  219. package/store/alfresco-aca-shared-store.metadata.json +0 -1
  220. package/store/package.json +0 -11
@@ -42,9 +42,7 @@ function isFavorites(context) {
42
42
  * Checks if the activated route is not **Favorites**.
43
43
  * JSON ref: `app.navigation.isNotFavorites`
44
44
  */
45
- function isNotFavorites(context) {
46
- return !isFavorites(context);
47
- }
45
+ const isNotFavorites = (context) => !isFavorites(context);
48
46
  /**
49
47
  * Checks if a **Shared Files** route is activated.
50
48
  * JSON ref: `app.navigation.isSharedFiles`
@@ -57,9 +55,7 @@ function isSharedFiles(context) {
57
55
  * Checks if the activated route is not **Shared Files**.
58
56
  * JSON ref: `app.navigation.isNotSharedFiles`
59
57
  */
60
- function isNotSharedFiles(context) {
61
- return !isSharedFiles(context);
62
- }
58
+ const isNotSharedFiles = (context) => !isSharedFiles(context);
63
59
  /**
64
60
  * Checks if a **Trashcan** route is activated.
65
61
  * JSON ref: `app.navigation.isTrashcan`
@@ -72,9 +68,7 @@ function isTrashcan(context) {
72
68
  * Checks if the activated route is not **Trashcan**.
73
69
  * JSON ref: `app.navigation.isNotTrashcan`
74
70
  */
75
- function isNotTrashcan(context) {
76
- return !isTrashcan(context);
77
- }
71
+ const isNotTrashcan = (context) => !isTrashcan(context);
78
72
  /**
79
73
  * Checks if a **Personal Files** route is activated.
80
74
  * JSON ref: `app.navigation.isPersonalFiles`
@@ -103,9 +97,7 @@ function isLibraries(context) {
103
97
  * Checks if the activated route is neither **Libraries** nor **Library Search Results**.
104
98
  * JSON ref: `app.navigation.isNotLibraries`
105
99
  */
106
- function isNotLibraries(context) {
107
- return !isLibraries(context);
108
- }
100
+ const isNotLibraries = (context) => !isLibraries(context);
109
101
  /**
110
102
  * Checks if a **Recent Files** route is activated.
111
103
  * JSON ref: `app.navigation.isRecentFiles`
@@ -118,15 +110,13 @@ function isRecentFiles(context) {
118
110
  * Checks if the activated route is not **Recent Files**.
119
111
  * JSON ref: `app.navigation.isNotRecentFiles`
120
112
  */
121
- function isNotRecentFiles(context) {
122
- return !isRecentFiles(context);
123
- }
113
+ const isNotRecentFiles = (context) => !isRecentFiles(context);
124
114
  /**
125
115
  * Checks if a **Search Results** route is activated.
126
116
  * JSON ref: `app.navigation.isSearchResults`
127
117
  */
128
118
  function isSearchResults(context /*,
129
- ...args: RuleParameter[]*/) {
119
+ ...args: RuleParameter[]*/) {
130
120
  const { url } = context.navigation;
131
121
  return url && url.startsWith('/search');
132
122
  }
@@ -134,9 +124,7 @@ function isSearchResults(context /*,
134
124
  * Checks if the activated route is not **Search Results**.
135
125
  * JSON ref: `app.navigation.isNotSearchResults`
136
126
  */
137
- function isNotSearchResults(context) {
138
- return !isSearchResults(context);
139
- }
127
+ const isNotSearchResults = (context) => !isSearchResults(context);
140
128
  /**
141
129
  * Checks if a **Shared Preview** route is activated.
142
130
  * JSON ref: `app.navigation.isSharedPreview`
@@ -190,8 +178,10 @@ function isSharedFileViewer(context) {
190
178
  * Checks if the quick share repository option is enabled or not.
191
179
  * JSON ref: `repository.isQuickShareEnabled`
192
180
  */
193
- function hasQuickShareEnabled(context) {
194
- return context.repository.status.isQuickShareEnabled;
181
+ const hasQuickShareEnabled = (context) => context.repository.status.isQuickShareEnabled;
182
+ function isMajorVersionAvailable(context, versionNumber) {
183
+ const majorVersion = context.repository.version?.major ? parseInt(context.repository.version.major, 10) : 0;
184
+ return majorVersion >= parseInt(versionNumber, 10);
195
185
  }
196
186
 
197
187
  /*!
@@ -218,14 +208,95 @@ function hasQuickShareEnabled(context) {
218
208
  * You should have received a copy of the GNU Lesser General Public License
219
209
  * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
220
210
  */
211
+ /**
212
+ * Checks if user is admin.
213
+ * JSON ref: `user.isAdmin`
214
+ */
215
+ const isAdmin = (context) => context.profile.isAdmin;
216
+
217
+ /*!
218
+ * @license
219
+ * Alfresco Example Content Application
220
+ *
221
+ * Copyright (C) 2005 - 2020 Alfresco Software Limited
222
+ *
223
+ * This file is part of the Alfresco Example Content Application.
224
+ * If the software was purchased under a paid Alfresco license, the terms of
225
+ * the paid license agreement will prevail. Otherwise, the software is
226
+ * provided under the following open source license terms:
227
+ *
228
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
229
+ * it under the terms of the GNU Lesser General Public License as published by
230
+ * the Free Software Foundation, either version 3 of the License, or
231
+ * (at your option) any later version.
232
+ *
233
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
234
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
235
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
236
+ * GNU Lesser General Public License for more details.
237
+ *
238
+ * You should have received a copy of the GNU Lesser General Public License
239
+ * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
240
+ */
241
+ /* cspell:disable */
242
+ const supportedExtensions = {
243
+ doc: 'ms-word',
244
+ docx: 'ms-word',
245
+ docm: 'ms-word',
246
+ dot: 'ms-word',
247
+ dotx: 'ms-word',
248
+ dotm: 'ms-word',
249
+ rtf: 'ms-word',
250
+ xls: 'ms-excel',
251
+ xlsx: 'ms-excel',
252
+ xlsb: 'ms-excel',
253
+ xlsm: 'ms-excel',
254
+ xlt: 'ms-excel',
255
+ xltx: 'ms-excel',
256
+ xltm: 'ms-excel',
257
+ xlam: 'ms-excel',
258
+ ppt: 'ms-powerpoint',
259
+ pptx: 'ms-powerpoint',
260
+ pot: 'ms-powerpoint',
261
+ potx: 'ms-powerpoint',
262
+ potm: 'ms-powerpoint',
263
+ pptm: 'ms-powerpoint',
264
+ pps: 'ms-powerpoint',
265
+ ppsx: 'ms-powerpoint',
266
+ ppam: 'ms-powerpoint',
267
+ ppsm: 'ms-powerpoint',
268
+ sldx: 'ms-powerpoint',
269
+ sldm: 'ms-powerpoint',
270
+ vsd: 'ms-visio',
271
+ vss: 'ms-visio',
272
+ vst: 'ms-visio',
273
+ vsdx: 'ms-visio',
274
+ vsdm: 'ms-visio',
275
+ vssx: 'ms-visio',
276
+ vssm: 'ms-visio',
277
+ vstx: 'ms-visio',
278
+ vstm: 'ms-visio'
279
+ };
280
+ /* cspell:enable */
281
+ function getFileExtension(fileName) {
282
+ if (fileName) {
283
+ const match = fileName.match(/\.([^\./\?\#]+)($|\?|\#)/);
284
+ return match ? match[1] : null;
285
+ }
286
+ return null;
287
+ }
288
+ /**
289
+ * Checks if the content plugin is enabled.
290
+ * JSON ref: `app.isContentServiceEnabled`
291
+ */
292
+ const isContentServiceEnabled = () => localStorage && localStorage.getItem('contentService') !== 'false';
221
293
  /**
222
294
  * Checks if user can copy selected node.
223
295
  * JSON ref: `app.canCopyNode`
296
+ *
224
297
  * @param context Rule execution context
225
298
  */
226
- function canCopyNode(context) {
227
- return [hasSelection(context), isNotTrashcan(context), isNotLibraries(context)].every(Boolean);
228
- }
299
+ const canCopyNode = (context) => [hasSelection(context), isNotTrashcan(context), isNotLibraries(context)].every(Boolean);
229
300
  /**
230
301
  * Checks if user can mark selected nodes as **Favorite**.
231
302
  * JSON ref: `app.selection.canAddFavorite`
@@ -256,24 +327,20 @@ function canRemoveFavorite(context) {
256
327
  * Checks if user can share selected file.
257
328
  * JSON ref: `app.selection.file.canShare`
258
329
  */
259
- function canShareFile(context) {
260
- return [context.selection.file, isNotTrashcan(context), hasQuickShareEnabled(context), !isShared(context)].every(Boolean);
261
- }
330
+ const canShareFile = (context) => [context.selection.file, isNotTrashcan(context), hasQuickShareEnabled(context), !isShared(context)].every(Boolean);
262
331
  /**
263
332
  * Checks if user can perform "Join" or "Cancel Join Request" on a library.
264
333
  * JSON ref: `canToggleJoinLibrary`
265
334
  */
266
- function canToggleJoinLibrary(context) {
267
- return [hasLibrarySelected(context), !isPrivateLibrary(context), hasNoLibraryRole(context)].every(Boolean);
268
- }
335
+ const canToggleJoinLibrary = (context) => [hasLibrarySelected(context), !isPrivateLibrary(context), hasNoLibraryRole(context)].every(Boolean) ||
336
+ [hasLibrarySelected(context), isPrivateLibrary(context), hasNoLibraryRole(context), isAdmin(context)].every(Boolean);
269
337
  /**
270
338
  * Checks if user can edit the selected folder.
271
339
  * JSON ref: `canEditFolder`
340
+ *
272
341
  * @param context Rule execution context
273
342
  */
274
- function canEditFolder(context) {
275
- return [canUpdateSelectedFolder(context), isNotTrashcan(context)].every(Boolean);
276
- }
343
+ const canEditFolder = (context) => [canUpdateSelectedFolder(context), isNotTrashcan(context)].every(Boolean);
277
344
  /**
278
345
  * Checks if the selected file is already shared.
279
346
  * JSON ref: `app.selection.file.isShared`
@@ -282,7 +349,7 @@ function isShared(context) {
282
349
  if (isSharedFiles(context) && context.selection.file) {
283
350
  return true;
284
351
  }
285
- if ((isNotTrashcan(context), !context.selection.isEmpty && context.selection.file)) {
352
+ if (isNotTrashcan(context) && !context.selection.isEmpty && context.selection.file) {
286
353
  return !!(context.selection.file.entry && context.selection.file.entry.properties && context.selection.file.entry.properties['qshare:sharedId']);
287
354
  }
288
355
  return false;
@@ -332,9 +399,7 @@ function canUnshareNodes(context) {
332
399
  * Checks if user selected anything.
333
400
  * JSON ref: `app.selection.notEmpty`
334
401
  */
335
- function hasSelection(context) {
336
- return !context.selection.isEmpty;
337
- }
402
+ const hasSelection = (context) => !context.selection.isEmpty;
338
403
  /**
339
404
  * Checks if user can create a new folder with current path.
340
405
  * JSON ref: `app.navigation.folder.canCreate`
@@ -363,9 +428,7 @@ function canUpload(context) {
363
428
  */
364
429
  function canDownloadSelection(context) {
365
430
  if (!context.selection.isEmpty && isNotTrashcan(context)) {
366
- return context.selection.nodes.every((node) => {
367
- return node.entry && (node.entry.isFile || node.entry.isFolder || !!node.entry.nodeId);
368
- });
431
+ return context.selection.nodes.every((node) => node.entry && (node.entry.isFile || node.entry.isFolder || !!node.entry.nodeId));
369
432
  }
370
433
  return false;
371
434
  }
@@ -373,18 +436,12 @@ function canDownloadSelection(context) {
373
436
  * Checks if user has selected a folder.
374
437
  * JSON ref: `app.selection.folder`
375
438
  */
376
- function hasFolderSelected(context) {
377
- const folder = context.selection.folder;
378
- return folder ? true : false;
379
- }
439
+ const hasFolderSelected = (context) => !!context.selection.folder;
380
440
  /**
381
441
  * Checks if user has selected a library (site).
382
442
  * JSON ref: `app.selection.library`
383
443
  */
384
- function hasLibrarySelected(context) {
385
- const library = context.selection.library;
386
- return library ? true : false;
387
- }
444
+ const hasLibrarySelected = (context) => !!context.selection.library;
388
445
  /**
389
446
  * Checks if user has selected a **private** library (site)
390
447
  * JSON ref: `app.selection.isPrivateLibrary`
@@ -405,19 +462,12 @@ function hasLibraryRole(context) {
405
462
  * Checks if the selected library has no **role** property defined.
406
463
  * JSON ref: `app.selection.hasNoLibraryRole`
407
464
  */
408
- function hasNoLibraryRole(context) {
409
- return !hasLibraryRole(context);
410
- }
465
+ const hasNoLibraryRole = (context) => !hasLibraryRole(context);
411
466
  /**
412
467
  * Checks if user has selected a file.
413
468
  * JSON ref: `app.selection.file`
414
469
  */
415
- function hasFileSelected(context) {
416
- if (context && context.selection && context.selection.file) {
417
- return true;
418
- }
419
- return false;
420
- }
470
+ const hasFileSelected = (context) => !!(context && context.selection && context.selection.file);
421
471
  /**
422
472
  * Checks if user can update the first selected node.
423
473
  * JSON ref: `app.selection.first.canUpdate`
@@ -425,13 +475,20 @@ function hasFileSelected(context) {
425
475
  function canUpdateSelectedNode(context) {
426
476
  if (context.selection && !context.selection.isEmpty) {
427
477
  const node = context.selection.first;
428
- if (node.entry.isFile && hasLockedFiles(context)) {
478
+ if (node?.entry.isFile && hasLockedFiles(context)) {
429
479
  return false;
430
480
  }
431
481
  return context.permissions.check(node, ['update']);
432
482
  }
433
483
  return false;
434
484
  }
485
+ function isMultiselection(context) {
486
+ let isMultiNodeSelected = false;
487
+ if (context.selection && !context.selection.isEmpty) {
488
+ isMultiNodeSelected = context.selection.count > 1;
489
+ }
490
+ return isMultiNodeSelected;
491
+ }
435
492
  /**
436
493
  * Checks if user can update the first selected folder.
437
494
  * JSON ref: `app.selection.folder.canUpdate`
@@ -464,39 +521,33 @@ function hasLockedFiles(context) {
464
521
  * Checks if the selected file has **write** or **read-only** locks specified.
465
522
  * JSON ref: `app.selection.file.isLocked`
466
523
  */
467
- function isWriteLocked(context) {
468
- return !!(context &&
469
- context.selection &&
470
- context.selection.file &&
471
- context.selection.file.entry &&
472
- context.selection.file.entry.properties &&
473
- (context.selection.file.entry.properties['cm:lockType'] === 'WRITE_LOCK' ||
474
- context.selection.file.entry.properties['cm:lockType'] === 'READ_ONLY_LOCK'));
475
- }
524
+ const isWriteLocked = (context) => !!(context &&
525
+ context.selection &&
526
+ context.selection.file &&
527
+ context.selection.file.entry &&
528
+ context.selection.file.entry.properties &&
529
+ (context.selection.file.entry.properties['cm:lockType'] === 'WRITE_LOCK' ||
530
+ context.selection.file.entry.properties['cm:lockType'] === 'READ_ONLY_LOCK'));
476
531
  /**
477
532
  * Checks if the selected file has **write** or **read-only** locks specified,
478
533
  * and that current user is the owner of the lock.
479
534
  * JSON ref: `app.selection.file.isLockOwner`
480
535
  */
481
- function isUserWriteLockOwner(context) {
482
- return (isWriteLocked(context) &&
483
- context.selection.file.entry.properties['cm:lockOwner'] &&
484
- context.selection.file.entry.properties['cm:lockOwner'].id === context.profile.id);
485
- }
536
+ const isUserWriteLockOwner = (context) => isWriteLocked(context) &&
537
+ context.selection.file?.entry.properties['cm:lockOwner'] &&
538
+ context.selection.file?.entry.properties['cm:lockOwner'].id === context.profile.id;
486
539
  /**
487
540
  * Checks if user can lock selected file.
488
541
  * JSON ref: `app.selection.file.canLock`
489
542
  */
490
- function canLockFile(context) {
491
- return !isWriteLocked(context) && canUpdateSelectedNode(context);
492
- }
543
+ const canLockFile = (context) => !isWriteLocked(context) && canUpdateSelectedNode(context);
493
544
  /**
494
545
  * Checks if user can unlock selected file.
495
546
  * JSON ref: `app.selection.file.canUnlock`
496
547
  */
497
548
  function canUnlockFile(context) {
498
549
  const { file } = context.selection;
499
- return isWriteLocked(context) && (context.permissions.check(file.entry, ['delete']) || isUserWriteLockOwner(context));
550
+ return isWriteLocked(context) && (context.permissions.check(file?.entry, ['delete']) || isUserWriteLockOwner(context));
500
551
  }
501
552
  /**
502
553
  * Checks if user can upload a new version of the file.
@@ -515,133 +566,152 @@ function canUploadVersion(context) {
515
566
  /**
516
567
  * Checks if user has trashcan item selected.
517
568
  * JSON ref: `isTrashcanItemSelected`
569
+ *
518
570
  * @param context Rule execution context
519
571
  */
520
- function isTrashcanItemSelected(context) {
521
- return [isTrashcan(context), hasSelection(context)].every(Boolean);
522
- }
572
+ const isTrashcanItemSelected = (context) => [isTrashcan(context), hasSelection(context)].every(Boolean);
523
573
  /**
524
574
  * Checks if user can view the file.
525
575
  * JSON ref: `canViewFile`
576
+ *
526
577
  * @param context Rule execution context
527
578
  */
528
- function canViewFile(context) {
529
- return [hasFileSelected(context), isNotTrashcan(context)].every(Boolean);
530
- }
579
+ const canViewFile = (context) => [hasFileSelected(context), isNotTrashcan(context)].every(Boolean);
531
580
  /**
532
581
  * Checks if user can **Leave** selected library.
533
582
  * JSON ref: `canLeaveLibrary`
583
+ *
534
584
  * @param context Rule execution context
535
585
  */
536
- function canLeaveLibrary(context) {
537
- return [hasLibrarySelected(context), hasLibraryRole(context)].every(Boolean);
538
- }
586
+ const canLeaveLibrary = (context) => [hasLibrarySelected(context), hasLibraryRole(context)].every(Boolean);
539
587
  /**
540
588
  * Checks if user can toggle shared link mode.
541
589
  * JSON ref: `canToggleSharedLink`
590
+ *
542
591
  * @param context Rule execution context
543
592
  */
544
- function canToggleSharedLink(context) {
545
- return [hasFileSelected(context), [canShareFile(context), isShared(context)].some(Boolean)].every(Boolean);
546
- }
593
+ const canToggleSharedLink = (context) => [hasFileSelected(context), [canShareFile(context), isShared(context)].some(Boolean)].every(Boolean);
547
594
  /**
548
595
  * Checks if user can show **Info Drawer** for the selected node.
549
596
  * JSON ref: `canShowInfoDrawer`
597
+ *
550
598
  * @param context Rule execution context
551
599
  */
552
- function canShowInfoDrawer(context) {
553
- return [hasSelection(context), isNotLibraries(context), isNotTrashcan(context)].every(Boolean);
554
- }
600
+ const canShowInfoDrawer = (context) => [hasSelection(context), isNotLibraries(context), isNotTrashcan(context)].every(Boolean);
555
601
  /**
556
602
  * Checks if user can manage file versions for the selected node.
557
603
  * JSON ref: `canManageFileVersions`
604
+ *
558
605
  * @param context Rule execution context
559
606
  */
560
- function canManageFileVersions(context) {
561
- return [hasFileSelected(context), isNotTrashcan(context), !hasLockedFiles(context)].every(Boolean);
562
- }
607
+ const canManageFileVersions = (context) => [hasFileSelected(context), isNotTrashcan(context), !hasLockedFiles(context)].every(Boolean);
608
+ /**
609
+ * Checks if user can edit aspects for the selected node.
610
+ * JSON ref: `canEditAspects`
611
+ *
612
+ * @param context Rule execution context
613
+ */
614
+ const canEditAspects = (context) => [
615
+ !isMultiselection(context),
616
+ canUpdateSelectedNode(context),
617
+ !isWriteLocked(context),
618
+ isNotTrashcan(context),
619
+ isMajorVersionAvailable(context, '7')
620
+ ].every(Boolean);
563
621
  /**
564
622
  * Checks if user can manage permissions for the selected node.
565
623
  * JSON ref: `canManagePermissions`
624
+ *
566
625
  * @param context Rule execution context
567
626
  */
568
- function canManagePermissions(context) {
569
- return [canUpdateSelectedNode(context), isNotTrashcan(context)].every(Boolean);
570
- }
627
+ const canManagePermissions = (context) => [canUpdateSelectedNode(context), isNotTrashcan(context)].every(Boolean);
571
628
  /**
572
629
  * Checks if user can toggle **Edit Offline** mode for selected node.
573
630
  * JSON ref: `canToggleEditOffline`
631
+ *
574
632
  * @param context Rule execution context
575
633
  */
576
- function canToggleEditOffline(context) {
577
- return [hasFileSelected(context), isNotTrashcan(context), canLockFile(context) || canUnlockFile(context)].every(Boolean);
578
- }
634
+ const canToggleEditOffline = (context) => [hasFileSelected(context), isNotTrashcan(context), canLockFile(context) || canUnlockFile(context)].every(Boolean);
579
635
  /**
580
636
  * @deprecated Uses workarounds for for recent files and search api issues.
581
637
  * Checks if user can toggle **Favorite** state for a node.
582
638
  * @param context Rule execution context
583
639
  */
584
- function canToggleFavorite(context) {
585
- return [
586
- [canAddFavorite(context), canRemoveFavorite(context)].some(Boolean),
587
- [isRecentFiles(context), isSharedFiles(context), isSearchResults(context), isFavorites(context)].some(Boolean)
588
- ].every(Boolean);
589
- }
590
- /**
591
- * Checks if application should render language picker menu.
592
- * JSON ref: `canShowLanguagePicker`
593
- * @param context Rule execution context
594
- */
595
- function canShowLanguagePicker(context) {
596
- return context.languagePicker;
597
- }
640
+ const canToggleFavorite = (context) => [
641
+ [canAddFavorite(context), canRemoveFavorite(context)].some(Boolean),
642
+ [isRecentFiles(context), isSharedFiles(context), isSearchResults(context), isFavorites(context)].some(Boolean)
643
+ ].every(Boolean);
598
644
  /**
599
645
  * Checks if application should render logout option.
600
646
  * JSON ref: `canShowLogout`
647
+ *
601
648
  * @param context Rule execution context
602
649
  */
603
- function canShowLogout(context) {
604
- return !context.withCredentials;
605
- }
650
+ const canShowLogout = (context) => !context.withCredentials;
606
651
  /**
607
652
  * Checks if user is library manager
608
653
  * JSON ref: `isLibraryManager`
654
+ *
609
655
  * @param context Rule execution context
610
656
  */
611
- function isLibraryManager(context) {
612
- return hasLibrarySelected(context) && context.selection.library.entry && context.selection.library.entry.role === 'SiteManager';
613
- }
614
-
615
- /*!
616
- * @license
617
- * Alfresco Example Content Application
618
- *
619
- * Copyright (C) 2005 - 2020 Alfresco Software Limited
620
- *
621
- * This file is part of the Alfresco Example Content Application.
622
- * If the software was purchased under a paid Alfresco license, the terms of
623
- * the paid license agreement will prevail. Otherwise, the software is
624
- * provided under the following open source license terms:
625
- *
626
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
627
- * it under the terms of the GNU Lesser General Public License as published by
628
- * the Free Software Foundation, either version 3 of the License, or
629
- * (at your option) any later version.
630
- *
631
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
632
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
633
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
634
- * GNU Lesser General Public License for more details.
657
+ const isLibraryManager = (context) => hasLibrarySelected(context) && context.selection.library?.entry.role === 'SiteManager';
658
+ /**
659
+ * Checks if the preview button for search results can be showed
660
+ * JSON ref: `canInfoPreview`
635
661
  *
636
- * You should have received a copy of the GNU Lesser General Public License
637
- * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
662
+ * @param context Rule execution context
638
663
  */
639
- /**
640
- * Checks if user is admin.
641
- * JSON ref: `user.isAdmin`
664
+ const canInfoPreview = (context) => {
665
+ const isSearchResult = isSearchResults(context);
666
+ const isNotMultiselect = !isMultiselection(context);
667
+ const isFileSelected = !hasFolderSelected(context);
668
+ const isPreview$1 = !isPreview(context);
669
+ return isSearchResult && isNotMultiselect && isFileSelected && isPreview$1;
670
+ };
671
+ const showInfoSelectionButton = (context) => isSearchResults(context) && !isPreview(context);
672
+ /**
673
+ * Checks if the file can be opened with MS Office
674
+ * JSON ref: `aos.canOpenWithOffice`
675
+ *
676
+ * @param context Rule execution context
642
677
  */
643
- function isAdmin(context) {
644
- return context.profile.isAdmin;
678
+ function canOpenWithOffice(context) {
679
+ if (context.navigation && context.navigation.url && context.navigation.url.startsWith('/trashcan')) {
680
+ return false;
681
+ }
682
+ if (!context || !context.selection) {
683
+ return false;
684
+ }
685
+ const { file } = context.selection;
686
+ if (!file || !file.entry) {
687
+ return false;
688
+ }
689
+ const extension = getFileExtension(file.entry.name);
690
+ if (!extension || !supportedExtensions[extension]) {
691
+ return false;
692
+ }
693
+ if (!file.entry.properties) {
694
+ return false;
695
+ }
696
+ if (file.entry.isLocked) {
697
+ return false;
698
+ }
699
+ if (file.entry.properties['cm:lockType'] === 'WRITE_LOCK' || file.entry.properties['cm:lockType'] === 'READ_ONLY_LOCK') {
700
+ return false;
701
+ }
702
+ const lockOwner = file.entry.properties['cm:lockOwner'];
703
+ if (lockOwner && lockOwner.id !== context.profile.id) {
704
+ return false;
705
+ }
706
+ // workaround for Shared files
707
+ if (context.navigation && context.navigation.url && context.navigation.url.startsWith('/shared')) {
708
+ if (file.entry.hasOwnProperty('allowableOperationsOnTarget')) {
709
+ return context.permissions.check(file, ['update'], {
710
+ target: 'allowableOperationsOnTarget'
711
+ });
712
+ }
713
+ }
714
+ return context.permissions.check(file, ['update']);
645
715
  }
646
716
 
647
717
  /*!
@@ -673,5 +743,5 @@ function isAdmin(context) {
673
743
  * Generated bundle index. Do not edit.
674
744
  */
675
745
 
676
- export { canAddFavorite, canCopyNode, canCreateFolder, canDeleteSelection, canDownloadSelection, canEditFolder, canLeaveLibrary, canLockFile, canManageFileVersions, canManagePermissions, canRemoveFavorite, canShareFile, canShowInfoDrawer, canShowLanguagePicker, canShowLogout, canToggleEditOffline, canToggleFavorite, canToggleJoinLibrary, canToggleSharedLink, canUnlockFile, canUnshareNodes, canUpdateSelectedFolder, canUpdateSelectedNode, canUpload, canUploadVersion, canViewFile, hasFileSelected, hasFolderSelected, hasLibraryRole, hasLibrarySelected, hasLockedFiles, hasNoLibraryRole, hasQuickShareEnabled, hasSelection, isAdmin, isFavorites, isFavoritesPreview, isLibraries, isLibraryFiles, isLibraryManager, isNotFavorites, isNotLibraries, isNotRecentFiles, isNotSearchResults, isNotSharedFiles, isNotTrashcan, isPersonalFiles, isPreview, isPrivateLibrary, isRecentFiles, isSearchResults, isShared, isSharedFileViewer, isSharedFiles, isSharedPreview, isTrashcan, isTrashcanItemSelected, isUserWriteLockOwner, isWriteLocked };
677
- //# sourceMappingURL=alfresco-aca-shared-rules.js.map
746
+ export { canAddFavorite, canCopyNode, canCreateFolder, canDeleteSelection, canDownloadSelection, canEditAspects, canEditFolder, canInfoPreview, canLeaveLibrary, canLockFile, canManageFileVersions, canManagePermissions, canOpenWithOffice, canRemoveFavorite, canShareFile, canShowInfoDrawer, canShowLogout, canToggleEditOffline, canToggleFavorite, canToggleJoinLibrary, canToggleSharedLink, canUnlockFile, canUnshareNodes, canUpdateSelectedFolder, canUpdateSelectedNode, canUpload, canUploadVersion, canViewFile, getFileExtension, hasFileSelected, hasFolderSelected, hasLibraryRole, hasLibrarySelected, hasLockedFiles, hasNoLibraryRole, hasQuickShareEnabled, hasSelection, isAdmin, isContentServiceEnabled, isFavorites, isFavoritesPreview, isLibraries, isLibraryFiles, isLibraryManager, isMajorVersionAvailable, isMultiselection, isNotFavorites, isNotLibraries, isNotRecentFiles, isNotSearchResults, isNotSharedFiles, isNotTrashcan, isPersonalFiles, isPreview, isPrivateLibrary, isRecentFiles, isSearchResults, isShared, isSharedFileViewer, isSharedFiles, isSharedPreview, isTrashcan, isTrashcanItemSelected, isUserWriteLockOwner, isWriteLocked, showInfoSelectionButton, supportedExtensions };
747
+ //# sourceMappingURL=alfresco-aca-shared-rules.mjs.map