@alfresco/aca-content 4.1.0 → 4.2.0-5542991658
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.
- package/assets/app.extensions.json +3 -3
- package/esm2020/lib/aca-content.module.mjs +2 -2
- package/esm2020/lib/aca-content.routes.mjs +27 -27
- package/esm2020/lib/extensions/core.extensions.module.mjs +2 -3
- package/esm2020/lib/services/node-template.service.mjs +1 -1
- package/esm2020/ms-office/aos-extension.module.mjs +7 -9
- package/esm2020/preview/alfresco-aca-content-preview.mjs +5 -0
- package/esm2020/preview/lib/components/preview.component.mjs +406 -0
- package/esm2020/preview/lib/preview.module.mjs +84 -0
- package/esm2020/preview/public-api.mjs +29 -0
- package/esm2020/viewer/alfresco-aca-content-viewer.mjs +5 -0
- package/esm2020/viewer/lib/components/viewer/viewer.component.mjs +402 -0
- package/esm2020/viewer/lib/viewer.module.mjs +81 -0
- package/esm2020/viewer/public-api.mjs +29 -0
- package/fesm2015/alfresco-aca-content-ms-office.mjs +4 -5
- package/fesm2015/alfresco-aca-content-ms-office.mjs.map +1 -1
- package/fesm2015/alfresco-aca-content-preview.mjs +495 -0
- package/fesm2015/alfresco-aca-content-preview.mjs.map +1 -0
- package/fesm2015/alfresco-aca-content-viewer.mjs +491 -0
- package/fesm2015/alfresco-aca-content-viewer.mjs.map +1 -0
- package/fesm2015/alfresco-aca-content.mjs +28 -86
- package/fesm2015/alfresco-aca-content.mjs.map +1 -1
- package/fesm2020/alfresco-aca-content-ms-office.mjs +4 -5
- package/fesm2020/alfresco-aca-content-ms-office.mjs.map +1 -1
- package/fesm2020/alfresco-aca-content-preview.mjs +511 -0
- package/fesm2020/alfresco-aca-content-preview.mjs.map +1 -0
- package/fesm2020/alfresco-aca-content-viewer.mjs +504 -0
- package/fesm2020/alfresco-aca-content-viewer.mjs.map +1 -0
- package/fesm2020/alfresco-aca-content.mjs +28 -86
- package/fesm2020/alfresco-aca-content.mjs.map +1 -1
- package/lib/services/node-template.service.d.ts +1 -1
- package/ms-office/aos-extension.module.d.ts +1 -2
- package/package.json +21 -5
- package/preview/index.d.ts +5 -0
- package/preview/lib/components/preview.component.d.ts +115 -0
- package/preview/lib/preview.module.d.ts +13 -0
- package/preview/public-api.d.ts +25 -0
- package/viewer/index.d.ts +5 -0
- package/viewer/lib/components/viewer/viewer.component.d.ts +111 -0
- package/viewer/lib/viewer.module.d.ts +13 -0
- package/viewer/public-api.d.ts +25 -0
- package/esm2020/lib/services/content-service-extension.service.mjs +0 -63
- package/lib/services/content-service-extension.service.d.ts +0 -11
|
@@ -7,7 +7,6 @@ import { createEffect, ofType, EffectsModule } from '@ngrx/effects';
|
|
|
7
7
|
import { map } from 'rxjs/operators';
|
|
8
8
|
import * as i1$2 from '@alfresco/adf-extensions';
|
|
9
9
|
import { provideExtensionConfig } from '@alfresco/adf-extensions';
|
|
10
|
-
import * as i3 from '@alfresco/aca-shared';
|
|
11
10
|
|
|
12
11
|
/*!
|
|
13
12
|
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
|
@@ -232,14 +231,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
232
231
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
|
233
232
|
*/
|
|
234
233
|
class AosExtensionModule {
|
|
235
|
-
constructor(extensions, translation
|
|
234
|
+
constructor(extensions, translation) {
|
|
236
235
|
translation.addTranslationFolder('ms-office', 'assets/ms-office');
|
|
237
236
|
extensions.setEvaluators({
|
|
238
|
-
'aos.canOpenWithOffice':
|
|
237
|
+
'aos.canOpenWithOffice': canOpenWithOffice
|
|
239
238
|
});
|
|
240
239
|
}
|
|
241
240
|
}
|
|
242
|
-
AosExtensionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: AosExtensionModule, deps: [{ token: i1$2.ExtensionService }, { token: i1.TranslationService }
|
|
241
|
+
AosExtensionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: AosExtensionModule, deps: [{ token: i1$2.ExtensionService }, { token: i1.TranslationService }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
243
242
|
AosExtensionModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: AosExtensionModule, imports: [i1$1.EffectsFeatureModule] });
|
|
244
243
|
AosExtensionModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: AosExtensionModule, providers: [provideExtensionConfig(['aos.plugin.json'])], imports: [EffectsModule.forFeature([AosEffects])] });
|
|
245
244
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: AosExtensionModule, decorators: [{
|
|
@@ -248,7 +247,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
248
247
|
imports: [EffectsModule.forFeature([AosEffects])],
|
|
249
248
|
providers: [provideExtensionConfig(['aos.plugin.json'])]
|
|
250
249
|
}]
|
|
251
|
-
}], ctorParameters: function () { return [{ type: i1$2.ExtensionService }, { type: i1.TranslationService }
|
|
250
|
+
}], ctorParameters: function () { return [{ type: i1$2.ExtensionService }, { type: i1.TranslationService }]; } });
|
|
252
251
|
|
|
253
252
|
/*!
|
|
254
253
|
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alfresco-aca-content-ms-office.mjs","sources":["../../../../projects/aca-content/ms-office/src/aos-extension.service.ts","../../../../projects/aca-content/ms-office/src/actions/aos.actions.ts","../../../../projects/aca-content/ms-office/src/effects/aos.effects.ts","../../../../projects/aca-content/ms-office/src/aos-extension.module.ts","../../../../projects/aca-content/ms-office/src/public-api.ts","../../../../projects/aca-content/ms-office/src/alfresco-aca-content-ms-office.ts"],"sourcesContent":["/*!\n * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.\n *\n * Alfresco Example Content Application\n *\n * This file is part of the Alfresco Example Content Application.\n * If the software was purchased under a paid Alfresco license, the terms of\n * the paid license agreement will prevail. Otherwise, the software is\n * provided under the following open source license terms:\n *\n * The Alfresco Example Content Application is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * The Alfresco Example Content Application is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public License\n * from Hyland Software. If not, see <http://www.gnu.org/licenses/>.\n */\n\n/* cspell:disable */\nimport { AppConfigService, AuthenticationService, LogService, NotificationService } from '@alfresco/adf-core';\nimport { Injectable } from '@angular/core';\nimport { MinimalNodeEntryEntity } from '@alfresco/js-api';\nimport { getFileExtension, supportedExtensions } from '@alfresco/aca-shared/rules';\n\nexport interface IAosEditOnlineService {\n onActionEditOnlineAos(node: MinimalNodeEntryEntity): void;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AosEditOnlineService implements IAosEditOnlineService {\n constructor(\n private authenticationService: AuthenticationService,\n private appConfigService: AppConfigService,\n private notificationService: NotificationService,\n private logService: LogService\n ) {}\n\n onActionEditOnlineAos(node: MinimalNodeEntryEntity): void {\n if (node && this.isFile(node) && node.properties) {\n if (node.isLocked) {\n // const checkedOut = node.aspectNames.find(\n // (aspect: string) => aspect === 'cm:checkedOut'\n // );\n const checkedOut = node.properties['cm:lockType'] === 'WRITE_LOCK' || node.properties['cm:lockType'] === 'READ_ONLY_LOCK';\n const lockOwner = node.properties['cm:lockOwner'];\n const differentLockOwner = lockOwner.id !== this.authenticationService.getEcmUsername();\n\n if (checkedOut && differentLockOwner) {\n this.onAlreadyLockedNotification(node.id, lockOwner.id);\n } else {\n this.triggerEditOnlineAos(node);\n }\n } else {\n this.triggerEditOnlineAos(node);\n }\n }\n }\n\n private getUserAgent(): string {\n return navigator.userAgent.toLowerCase();\n }\n\n private isWindows(): boolean {\n return this.getUserAgent().indexOf('win') !== -1;\n }\n\n private isMacOs(): boolean {\n return this.getUserAgent().indexOf('mac') !== -1;\n }\n\n private onAlreadyLockedNotification(nodeId: string, lockOwner: string) {\n this.logService.error('Document already locked by another user');\n this.notificationService.showError(`AOS.ERRORS.ALREADY_LOCKED`, null, {\n nodeId,\n lockOwner\n });\n }\n\n private getProtocolForFileExtension(fileExtension: string) {\n return fileExtension && supportedExtensions[fileExtension];\n }\n\n private triggerEditOnlineAos(node: MinimalNodeEntryEntity): void {\n const aosHost = this.appConfigService.get('aosHost');\n let url: string;\n const pathElements = (node.path?.elements || []).map((segment) => segment.name);\n\n if (!pathElements.length) {\n url = `${aosHost}/Company Home/_aos_nodeid/${this.getNodeId(node)}/${encodeURIComponent(node.name)}`;\n }\n\n if (pathElements.length === 1) {\n url = `${aosHost}/${encodeURIComponent(node.name)}`;\n }\n\n if (pathElements.length > 1) {\n const root = pathElements[1];\n url = `${aosHost}/${root}/_aos_nodeid/${this.getNodeId(node)}/${encodeURIComponent(node.name)}`;\n }\n\n const fileExtension = getFileExtension(node.name);\n const protocolHandler = this.getProtocolForFileExtension(fileExtension);\n\n if (protocolHandler === undefined) {\n this.logService.error('Protocol handler missing');\n this.notificationService.showError(`AOS.ERRORS.MISSING_PROTOCOL_HANDLER`, null, { nodeName: node.name });\n return;\n }\n\n if (!this.isWindows() && !this.isMacOs()) {\n this.logService.error('Unsupported platform');\n this.notificationService.showError('AOS.ERRORS.UNSUPPORTED_PLATFORM');\n } else {\n this.openByUrl(protocolHandler, url);\n }\n }\n\n openByUrl(protocolHandler: string, url: string) {\n const finalUrl = protocolHandler + ':ofe%7Cu%7C' + url;\n\n const iframe = document.createElement('iframe');\n iframe.style.display = 'none';\n iframe.src = finalUrl;\n\n document.body.appendChild(iframe);\n\n setTimeout(() => {\n if (iframe) {\n document.body.removeChild(iframe);\n }\n }, 500);\n }\n\n private isFile(node: MinimalNodeEntryEntity): boolean {\n const implicitFile = (node as any).nodeId || (node as any).guid;\n\n return !!implicitFile || node.isFile;\n }\n\n private getNodeId(node: MinimalNodeEntryEntity): string {\n return (node as any).nodeId || (node as any).guid || node.id;\n }\n}\n","/*!\n * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.\n *\n * Alfresco Example Content Application\n *\n * This file is part of the Alfresco Example Content Application.\n * If the software was purchased under a paid Alfresco license, the terms of\n * the paid license agreement will prevail. Otherwise, the software is\n * provided under the following open source license terms:\n *\n * The Alfresco Example Content Application is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * The Alfresco Example Content Application is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public License\n * from Hyland Software. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { Action } from '@ngrx/store';\nimport { MinimalNodeEntryEntity } from '@alfresco/js-api';\n\nexport const AOS_ACTION = 'AOS_ACTION';\n\nexport class AosAction implements Action {\n readonly type = AOS_ACTION;\n constructor(public payload: MinimalNodeEntryEntity) {}\n}\n","/*!\n * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.\n *\n * Alfresco Example Content Application\n *\n * This file is part of the Alfresco Example Content Application.\n * If the software was purchased under a paid Alfresco license, the terms of\n * the paid license agreement will prevail. Otherwise, the software is\n * provided under the following open source license terms:\n *\n * The Alfresco Example Content Application is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * The Alfresco Example Content Application is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public License\n * from Hyland Software. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { Injectable } from '@angular/core';\nimport { Actions, ofType, createEffect } from '@ngrx/effects';\nimport { map } from 'rxjs/operators';\n\nimport { AOS_ACTION, AosAction } from '../actions/aos.actions';\nimport { AosEditOnlineService } from '../aos-extension.service';\n\n@Injectable()\nexport class AosEffects {\n constructor(private actions$: Actions, private aosEditOnlineService: AosEditOnlineService) {}\n\n openOffice$ = createEffect(\n () =>\n this.actions$.pipe(\n ofType<AosAction>(AOS_ACTION),\n map((action) => {\n if (action.payload) {\n this.aosEditOnlineService.onActionEditOnlineAos(action.payload);\n }\n })\n ),\n { dispatch: false }\n );\n}\n","/*!\n * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.\n *\n * Alfresco Example Content Application\n *\n * This file is part of the Alfresco Example Content Application.\n * If the software was purchased under a paid Alfresco license, the terms of\n * the paid license agreement will prevail. Otherwise, the software is\n * provided under the following open source license terms:\n *\n * The Alfresco Example Content Application is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * The Alfresco Example Content Application is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public License\n * from Hyland Software. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { ExtensionService, provideExtensionConfig } from '@alfresco/adf-extensions';\nimport { NgModule } from '@angular/core';\nimport { EffectsModule } from '@ngrx/effects';\nimport { AosEffects } from './effects/aos.effects';\nimport { TranslationService } from '@alfresco/adf-core';\nimport { AlfrescoOfficeExtensionService } from '@alfresco/aca-shared';\nimport { canOpenWithOffice } from '@alfresco/aca-shared/rules';\n\n@NgModule({\n imports: [EffectsModule.forFeature([AosEffects])],\n providers: [provideExtensionConfig(['aos.plugin.json'])]\n})\nexport class AosExtensionModule {\n constructor(extensions: ExtensionService, translation: TranslationService, aosService: AlfrescoOfficeExtensionService) {\n translation.addTranslationFolder('ms-office', 'assets/ms-office');\n extensions.setEvaluators({\n 'aos.canOpenWithOffice': (context) => aosService.isAosPluginEnabled() && canOpenWithOffice(context)\n });\n }\n}\n","/*!\n * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.\n *\n * Alfresco Example Content Application\n *\n * This file is part of the Alfresco Example Content Application.\n * If the software was purchased under a paid Alfresco license, the terms of\n * the paid license agreement will prevail. Otherwise, the software is\n * provided under the following open source license terms:\n *\n * The Alfresco Example Content Application is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * The Alfresco Example Content Application is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public License\n * from Hyland Software. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport * from './aos-extension.service';\nexport * from './actions/aos.actions';\nexport * from './effects/aos.effects';\n\nexport * from './aos-extension.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1","i2.AosEditOnlineService","i2","i4"],"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;AAsBG;MAeU,oBAAoB,CAAA;AAC/B,IAAA,WAAA,CACU,qBAA4C,EAC5C,gBAAkC,EAClC,mBAAwC,EACxC,UAAsB,EAAA;QAHtB,IAAqB,CAAA,qBAAA,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C,OAAO,KAAK,UAAU,CAAC,kBAAkB,EAAE,IAAI,iBAAiB,CAAC,OAAO,CAAC;AACpG,SAAA,CAAC,CAAC;KACJ;;+GANU,kBAAkB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAAD,IAAA,CAAA,gBAAA,EAAA,EAAA,EAAA,KAAA,EAAAE,EAAA,CAAA,kBAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;gHAAlB,kBAAkB,EAAA,OAAA,EAAA,CAAAC,IAAA,CAAA,oBAAA,CAAA,EAAA,CAAA,CAAA;AAAlB,kBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,aAFlB,CAAC,sBAAsB,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAA,OAAA,EAAA,CAD9C,aAAa,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC,CAAA,EAAA,CAAA,CAAA;2FAGrC,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;oBACjD,SAAS,EAAE,CAAC,sBAAsB,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;AACzD,iBAAA,CAAA;;;ACnCD;;;;;;;;;;;;;;;;;;;;;;AAsBG;;ACtBH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"alfresco-aca-content-ms-office.mjs","sources":["../../../../projects/aca-content/ms-office/src/aos-extension.service.ts","../../../../projects/aca-content/ms-office/src/actions/aos.actions.ts","../../../../projects/aca-content/ms-office/src/effects/aos.effects.ts","../../../../projects/aca-content/ms-office/src/aos-extension.module.ts","../../../../projects/aca-content/ms-office/src/public-api.ts","../../../../projects/aca-content/ms-office/src/alfresco-aca-content-ms-office.ts"],"sourcesContent":["/*!\n * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.\n *\n * Alfresco Example Content Application\n *\n * This file is part of the Alfresco Example Content Application.\n * If the software was purchased under a paid Alfresco license, the terms of\n * the paid license agreement will prevail. Otherwise, the software is\n * provided under the following open source license terms:\n *\n * The Alfresco Example Content Application is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * The Alfresco Example Content Application is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public License\n * from Hyland Software. If not, see <http://www.gnu.org/licenses/>.\n */\n\n/* cspell:disable */\nimport { AppConfigService, AuthenticationService, LogService, NotificationService } from '@alfresco/adf-core';\nimport { Injectable } from '@angular/core';\nimport { MinimalNodeEntryEntity } from '@alfresco/js-api';\nimport { getFileExtension, supportedExtensions } from '@alfresco/aca-shared/rules';\n\nexport interface IAosEditOnlineService {\n onActionEditOnlineAos(node: MinimalNodeEntryEntity): void;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AosEditOnlineService implements IAosEditOnlineService {\n constructor(\n private authenticationService: AuthenticationService,\n private appConfigService: AppConfigService,\n private notificationService: NotificationService,\n private logService: LogService\n ) {}\n\n onActionEditOnlineAos(node: MinimalNodeEntryEntity): void {\n if (node && this.isFile(node) && node.properties) {\n if (node.isLocked) {\n // const checkedOut = node.aspectNames.find(\n // (aspect: string) => aspect === 'cm:checkedOut'\n // );\n const checkedOut = node.properties['cm:lockType'] === 'WRITE_LOCK' || node.properties['cm:lockType'] === 'READ_ONLY_LOCK';\n const lockOwner = node.properties['cm:lockOwner'];\n const differentLockOwner = lockOwner.id !== this.authenticationService.getEcmUsername();\n\n if (checkedOut && differentLockOwner) {\n this.onAlreadyLockedNotification(node.id, lockOwner.id);\n } else {\n this.triggerEditOnlineAos(node);\n }\n } else {\n this.triggerEditOnlineAos(node);\n }\n }\n }\n\n private getUserAgent(): string {\n return navigator.userAgent.toLowerCase();\n }\n\n private isWindows(): boolean {\n return this.getUserAgent().indexOf('win') !== -1;\n }\n\n private isMacOs(): boolean {\n return this.getUserAgent().indexOf('mac') !== -1;\n }\n\n private onAlreadyLockedNotification(nodeId: string, lockOwner: string) {\n this.logService.error('Document already locked by another user');\n this.notificationService.showError(`AOS.ERRORS.ALREADY_LOCKED`, null, {\n nodeId,\n lockOwner\n });\n }\n\n private getProtocolForFileExtension(fileExtension: string) {\n return fileExtension && supportedExtensions[fileExtension];\n }\n\n private triggerEditOnlineAos(node: MinimalNodeEntryEntity): void {\n const aosHost = this.appConfigService.get('aosHost');\n let url: string;\n const pathElements = (node.path?.elements || []).map((segment) => segment.name);\n\n if (!pathElements.length) {\n url = `${aosHost}/Company Home/_aos_nodeid/${this.getNodeId(node)}/${encodeURIComponent(node.name)}`;\n }\n\n if (pathElements.length === 1) {\n url = `${aosHost}/${encodeURIComponent(node.name)}`;\n }\n\n if (pathElements.length > 1) {\n const root = pathElements[1];\n url = `${aosHost}/${root}/_aos_nodeid/${this.getNodeId(node)}/${encodeURIComponent(node.name)}`;\n }\n\n const fileExtension = getFileExtension(node.name);\n const protocolHandler = this.getProtocolForFileExtension(fileExtension);\n\n if (protocolHandler === undefined) {\n this.logService.error('Protocol handler missing');\n this.notificationService.showError(`AOS.ERRORS.MISSING_PROTOCOL_HANDLER`, null, { nodeName: node.name });\n return;\n }\n\n if (!this.isWindows() && !this.isMacOs()) {\n this.logService.error('Unsupported platform');\n this.notificationService.showError('AOS.ERRORS.UNSUPPORTED_PLATFORM');\n } else {\n this.openByUrl(protocolHandler, url);\n }\n }\n\n openByUrl(protocolHandler: string, url: string) {\n const finalUrl = protocolHandler + ':ofe%7Cu%7C' + url;\n\n const iframe = document.createElement('iframe');\n iframe.style.display = 'none';\n iframe.src = finalUrl;\n\n document.body.appendChild(iframe);\n\n setTimeout(() => {\n if (iframe) {\n document.body.removeChild(iframe);\n }\n }, 500);\n }\n\n private isFile(node: MinimalNodeEntryEntity): boolean {\n const implicitFile = (node as any).nodeId || (node as any).guid;\n\n return !!implicitFile || node.isFile;\n }\n\n private getNodeId(node: MinimalNodeEntryEntity): string {\n return (node as any).nodeId || (node as any).guid || node.id;\n }\n}\n","/*!\n * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.\n *\n * Alfresco Example Content Application\n *\n * This file is part of the Alfresco Example Content Application.\n * If the software was purchased under a paid Alfresco license, the terms of\n * the paid license agreement will prevail. Otherwise, the software is\n * provided under the following open source license terms:\n *\n * The Alfresco Example Content Application is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * The Alfresco Example Content Application is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public License\n * from Hyland Software. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { Action } from '@ngrx/store';\nimport { MinimalNodeEntryEntity } from '@alfresco/js-api';\n\nexport const AOS_ACTION = 'AOS_ACTION';\n\nexport class AosAction implements Action {\n readonly type = AOS_ACTION;\n constructor(public payload: MinimalNodeEntryEntity) {}\n}\n","/*!\n * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.\n *\n * Alfresco Example Content Application\n *\n * This file is part of the Alfresco Example Content Application.\n * If the software was purchased under a paid Alfresco license, the terms of\n * the paid license agreement will prevail. Otherwise, the software is\n * provided under the following open source license terms:\n *\n * The Alfresco Example Content Application is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * The Alfresco Example Content Application is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public License\n * from Hyland Software. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { Injectable } from '@angular/core';\nimport { Actions, ofType, createEffect } from '@ngrx/effects';\nimport { map } from 'rxjs/operators';\n\nimport { AOS_ACTION, AosAction } from '../actions/aos.actions';\nimport { AosEditOnlineService } from '../aos-extension.service';\n\n@Injectable()\nexport class AosEffects {\n constructor(private actions$: Actions, private aosEditOnlineService: AosEditOnlineService) {}\n\n openOffice$ = createEffect(\n () =>\n this.actions$.pipe(\n ofType<AosAction>(AOS_ACTION),\n map((action) => {\n if (action.payload) {\n this.aosEditOnlineService.onActionEditOnlineAos(action.payload);\n }\n })\n ),\n { dispatch: false }\n );\n}\n","/*!\n * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.\n *\n * Alfresco Example Content Application\n *\n * This file is part of the Alfresco Example Content Application.\n * If the software was purchased under a paid Alfresco license, the terms of\n * the paid license agreement will prevail. Otherwise, the software is\n * provided under the following open source license terms:\n *\n * The Alfresco Example Content Application is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * The Alfresco Example Content Application is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public License\n * from Hyland Software. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { ExtensionService, provideExtensionConfig } from '@alfresco/adf-extensions';\nimport { NgModule } from '@angular/core';\nimport { EffectsModule } from '@ngrx/effects';\nimport { AosEffects } from './effects/aos.effects';\nimport { TranslationService } from '@alfresco/adf-core';\nimport { canOpenWithOffice } from '@alfresco/aca-shared/rules';\n\n@NgModule({\n imports: [EffectsModule.forFeature([AosEffects])],\n providers: [provideExtensionConfig(['aos.plugin.json'])]\n})\nexport class AosExtensionModule {\n constructor(extensions: ExtensionService, translation: TranslationService) {\n translation.addTranslationFolder('ms-office', 'assets/ms-office');\n extensions.setEvaluators({\n 'aos.canOpenWithOffice': canOpenWithOffice\n });\n }\n}\n","/*!\n * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.\n *\n * Alfresco Example Content Application\n *\n * This file is part of the Alfresco Example Content Application.\n * If the software was purchased under a paid Alfresco license, the terms of\n * the paid license agreement will prevail. Otherwise, the software is\n * provided under the following open source license terms:\n *\n * The Alfresco Example Content Application is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * The Alfresco Example Content Application is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public License\n * from Hyland Software. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport * from './aos-extension.service';\nexport * from './actions/aos.actions';\nexport * from './effects/aos.effects';\n\nexport * from './aos-extension.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1","i2.AosEditOnlineService","i2","i3"],"mappings":";;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;AAsBG;MAeU,oBAAoB,CAAA;AAC/B,IAAA,WAAA,CACU,qBAA4C,EAC5C,gBAAkC,EAClC,mBAAwC,EACxC,UAAsB,EAAA;QAHtB,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AAiB;AAC3C,SAAA,CAAC,CAAC;KACJ;;+GANU,kBAAkB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAAD,IAAA,CAAA,gBAAA,EAAA,EAAA,EAAA,KAAA,EAAAE,EAAA,CAAA,kBAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;gHAAlB,kBAAkB,EAAA,OAAA,EAAA,CAAAC,IAAA,CAAA,oBAAA,CAAA,EAAA,CAAA,CAAA;AAAlB,kBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,aAFlB,CAAC,sBAAsB,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAA,OAAA,EAAA,CAD9C,aAAa,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC,CAAA,EAAA,CAAA,CAAA;2FAGrC,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;oBACjD,SAAS,EAAE,CAAC,sBAAsB,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;AACzD,iBAAA,CAAA;;;AClCD;;;;;;;;;;;;;;;;;;;;;;AAsBG;;ACtBH;;AAEG;;;;"}
|
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, ViewEncapsulation, HostListener, NgModule } from '@angular/core';
|
|
3
|
+
import * as i6 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i3 from '@angular/router';
|
|
6
|
+
import { PRIMARY_OUTLET, RouterModule } from '@angular/router';
|
|
7
|
+
import { takeUntil, debounceTime, map } from 'rxjs/operators';
|
|
8
|
+
import * as i2 from '@alfresco/adf-core';
|
|
9
|
+
import { ObjectUtils, CoreModule } from '@alfresco/adf-core';
|
|
10
|
+
import { ViewerActionTypes, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
|
11
|
+
import * as i1 from '@alfresco/aca-shared';
|
|
12
|
+
import { PageComponent, SharedDirectivesModule, SharedToolbarModule, InfoDrawerComponent } from '@alfresco/aca-shared';
|
|
13
|
+
import { from } from 'rxjs';
|
|
14
|
+
import * as i5 from '@ngrx/effects';
|
|
15
|
+
import { ofType } from '@ngrx/effects';
|
|
16
|
+
import * as i4 from '@alfresco/adf-content-services';
|
|
17
|
+
import { ContentModule, ContentDirectiveModule } from '@alfresco/adf-content-services';
|
|
18
|
+
import { ExtensionsModule } from '@alfresco/adf-extensions';
|
|
19
|
+
|
|
20
|
+
/*!
|
|
21
|
+
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
|
22
|
+
*
|
|
23
|
+
* Alfresco Example Content Application
|
|
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
|
+
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
|
42
|
+
*/
|
|
43
|
+
class PreviewComponent extends PageComponent {
|
|
44
|
+
constructor(contentApi, preferences, route, nodesApiService, actions$, location, appHookService) {
|
|
45
|
+
super();
|
|
46
|
+
this.contentApi = contentApi;
|
|
47
|
+
this.preferences = preferences;
|
|
48
|
+
this.route = route;
|
|
49
|
+
this.nodesApiService = nodesApiService;
|
|
50
|
+
this.actions$ = actions$;
|
|
51
|
+
this.location = location;
|
|
52
|
+
this.appHookService = appHookService;
|
|
53
|
+
this.previewLocation = null;
|
|
54
|
+
this.routesSkipNavigation = ['shared', 'recent-files', 'favorites'];
|
|
55
|
+
this.navigateSource = null;
|
|
56
|
+
this.navigationSources = ['favorites', 'libraries', 'personal-files', 'recent-files', 'shared'];
|
|
57
|
+
this.folderId = null;
|
|
58
|
+
this.nodeId = null;
|
|
59
|
+
this.navigateMultiple = false;
|
|
60
|
+
this.openWith = [];
|
|
61
|
+
this.contentExtensions = [];
|
|
62
|
+
this.showRightSide = false;
|
|
63
|
+
this.navigateBackAsClose = false;
|
|
64
|
+
this.simplestMode = false;
|
|
65
|
+
this.recentFileFilters = [
|
|
66
|
+
'TYPE:"content"',
|
|
67
|
+
'-PNAME:"0/wiki"',
|
|
68
|
+
'-TYPE:"app:filelink"',
|
|
69
|
+
'-TYPE:"fm:post"',
|
|
70
|
+
'-TYPE:"cm:thumbnail"',
|
|
71
|
+
'-TYPE:"cm:failedThumbnail"',
|
|
72
|
+
'-TYPE:"cm:rating"',
|
|
73
|
+
'-TYPE:"dl:dataList"',
|
|
74
|
+
'-TYPE:"dl:todoList"',
|
|
75
|
+
'-TYPE:"dl:issue"',
|
|
76
|
+
'-TYPE:"dl:contact"',
|
|
77
|
+
'-TYPE:"dl:eventAgenda"',
|
|
78
|
+
'-TYPE:"dl:event"',
|
|
79
|
+
'-TYPE:"dl:task"',
|
|
80
|
+
'-TYPE:"dl:simpletask"',
|
|
81
|
+
'-TYPE:"dl:meetingAgenda"',
|
|
82
|
+
'-TYPE:"dl:location"',
|
|
83
|
+
'-TYPE:"fm:topic"',
|
|
84
|
+
'-TYPE:"fm:post"',
|
|
85
|
+
'-TYPE:"ia:calendarEvent"',
|
|
86
|
+
'-TYPE:"lnk:link"'
|
|
87
|
+
];
|
|
88
|
+
this.containersSkipNavigation = ['adf-viewer__sidebar', 'cdk-overlay-container', 'adf-image-viewer'];
|
|
89
|
+
}
|
|
90
|
+
ngOnInit() {
|
|
91
|
+
super.ngOnInit();
|
|
92
|
+
from(this.infoDrawerOpened$)
|
|
93
|
+
.pipe(takeUntil(this.onDestroy$))
|
|
94
|
+
.subscribe((val) => {
|
|
95
|
+
this.showRightSide = val;
|
|
96
|
+
});
|
|
97
|
+
this.previewLocation = this.router.url.substr(0, this.router.url.indexOf('/', 1)).replace(/\//g, '');
|
|
98
|
+
const routeData = this.route.snapshot.data;
|
|
99
|
+
this.navigateBackAsClose = !!routeData.navigateBackAsClose;
|
|
100
|
+
this.simplestMode = !!routeData.simplestMode;
|
|
101
|
+
if (routeData.navigateMultiple) {
|
|
102
|
+
this.navigateMultiple = true;
|
|
103
|
+
}
|
|
104
|
+
if (routeData.navigateSource) {
|
|
105
|
+
const source = routeData.navigateSource.toLowerCase();
|
|
106
|
+
if (this.navigationSources.includes(source)) {
|
|
107
|
+
this.navigateSource = routeData.navigateSource;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
this.route.params.subscribe((params) => {
|
|
111
|
+
this.folderId = params.folderId;
|
|
112
|
+
const id = params.nodeId;
|
|
113
|
+
if (id) {
|
|
114
|
+
this.displayNode(id);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
this.subscriptions = this.subscriptions.concat([
|
|
118
|
+
this.appHookService.nodesDeleted.subscribe(() => this.navigateToFileLocation(true)),
|
|
119
|
+
this.uploadService.fileUploadDeleted.subscribe(() => this.navigateToFileLocation(true)),
|
|
120
|
+
this.uploadService.fileUploadComplete.pipe(debounceTime(300)).subscribe((file) => this.nodesApiService.nodeUpdated.next(file.data.entry)),
|
|
121
|
+
this.actions$
|
|
122
|
+
.pipe(ofType(ViewerActionTypes.ClosePreview), map(() => this.navigateToFileLocation(true)))
|
|
123
|
+
.subscribe(() => { })
|
|
124
|
+
]);
|
|
125
|
+
this.extensions
|
|
126
|
+
.getOpenWithActions()
|
|
127
|
+
.pipe(takeUntil(this.onDestroy$))
|
|
128
|
+
.subscribe((actions) => {
|
|
129
|
+
this.openWith = actions;
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
ngOnDestroy() {
|
|
133
|
+
super.ngOnDestroy();
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Loads the particular node into the Viewer
|
|
137
|
+
*
|
|
138
|
+
* @param id Unique identifier for the Node to display
|
|
139
|
+
*/
|
|
140
|
+
async displayNode(id) {
|
|
141
|
+
if (id) {
|
|
142
|
+
try {
|
|
143
|
+
this.node = await this.contentApi.getNodeInfo(id).toPromise();
|
|
144
|
+
this.store.dispatch(new SetSelectedNodesAction([{ entry: this.node }]));
|
|
145
|
+
if (this.node && this.node.isFile) {
|
|
146
|
+
const nearest = await this.getNearestNodes(this.node.id, this.node.parentId);
|
|
147
|
+
this.previousNodeId = nearest.left;
|
|
148
|
+
this.nextNodeId = nearest.right;
|
|
149
|
+
this.nodeId = this.node.id;
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
await this.router.navigate([this.previewLocation, id]);
|
|
153
|
+
}
|
|
154
|
+
catch (err) {
|
|
155
|
+
if (!err || err.status !== 401) {
|
|
156
|
+
await this.router.navigate([this.previewLocation, id]);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
handleKeyboardEvent(event) {
|
|
162
|
+
const key = event.keyCode;
|
|
163
|
+
const rightArrow = 39;
|
|
164
|
+
const leftArrow = 37;
|
|
165
|
+
if (key === rightArrow || key === leftArrow) {
|
|
166
|
+
event.preventDefault();
|
|
167
|
+
event.stopImmediatePropagation();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Handles the visibility change of the Viewer component.
|
|
172
|
+
*
|
|
173
|
+
* @param isVisible Indicator whether Viewer is visible or hidden.
|
|
174
|
+
*/
|
|
175
|
+
onVisibilityChanged(isVisible) {
|
|
176
|
+
const shouldNavigate = !isVisible;
|
|
177
|
+
this.navigateToFileLocation(shouldNavigate);
|
|
178
|
+
}
|
|
179
|
+
navigateToFileLocation(shouldNavigate) {
|
|
180
|
+
if (shouldNavigate) {
|
|
181
|
+
if (this.navigateBackAsClose) {
|
|
182
|
+
this.location.back();
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
const shouldSkipNavigation = this.routesSkipNavigation.includes(this.previewLocation);
|
|
186
|
+
const route = this.getNavigationCommands(this.previewLocation);
|
|
187
|
+
if (!shouldSkipNavigation && this.folderId) {
|
|
188
|
+
route.push(this.folderId);
|
|
189
|
+
}
|
|
190
|
+
this.router.navigate(route);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
/** Handles navigation to a previous document */
|
|
195
|
+
onNavigateBefore(event) {
|
|
196
|
+
if (event.type !== 'click' && this.shouldNavigate(event.target)) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (this.previousNodeId) {
|
|
200
|
+
this.router.navigate(this.getPreviewPath(this.folderId, this.previousNodeId));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/** Handles navigation to a next document */
|
|
204
|
+
onNavigateNext(event) {
|
|
205
|
+
if (event.type !== 'click' && this.shouldNavigate(event.target)) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
if (this.nextNodeId) {
|
|
209
|
+
this.router.navigate(this.getPreviewPath(this.folderId, this.nextNodeId));
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Generates a node preview route based on folder and node IDs.
|
|
214
|
+
*
|
|
215
|
+
* @param folderId Folder ID
|
|
216
|
+
* @param nodeId Node ID
|
|
217
|
+
*/
|
|
218
|
+
getPreviewPath(folderId, nodeId) {
|
|
219
|
+
const route = [this.previewLocation];
|
|
220
|
+
if (folderId) {
|
|
221
|
+
route.push(folderId);
|
|
222
|
+
}
|
|
223
|
+
if (nodeId) {
|
|
224
|
+
route.push('preview', nodeId);
|
|
225
|
+
}
|
|
226
|
+
return route;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Retrieves nearest node information for the given node and folder.
|
|
230
|
+
*
|
|
231
|
+
* @param nodeId Unique identifier of the document node
|
|
232
|
+
* @param folderId Unique identifier of the containing folder node.
|
|
233
|
+
*/
|
|
234
|
+
async getNearestNodes(nodeId, folderId) {
|
|
235
|
+
const empty = {
|
|
236
|
+
left: null,
|
|
237
|
+
right: null
|
|
238
|
+
};
|
|
239
|
+
if (nodeId && folderId) {
|
|
240
|
+
try {
|
|
241
|
+
const ids = await this.getFileIds(this.navigateSource, folderId);
|
|
242
|
+
const idx = ids.indexOf(nodeId);
|
|
243
|
+
if (idx >= 0) {
|
|
244
|
+
return {
|
|
245
|
+
left: ids[idx - 1] || null,
|
|
246
|
+
right: ids[idx + 1] || null
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
return empty;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
catch {
|
|
254
|
+
return empty;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
return empty;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Retrieves a list of node identifiers for the folder and data source.
|
|
263
|
+
*
|
|
264
|
+
* @param source Data source name. Allowed values are: personal-files, libraries, favorites, shared, recent-files.
|
|
265
|
+
* @param folderId Containing folder node identifier for 'personal-files' and 'libraries' sources.
|
|
266
|
+
*/
|
|
267
|
+
async getFileIds(source, folderId) {
|
|
268
|
+
if ((source === 'personal-files' || source === 'libraries') && folderId) {
|
|
269
|
+
const sortKey = this.preferences.get('personal-files.sorting.key') || 'modifiedAt';
|
|
270
|
+
const sortDirection = this.preferences.get('personal-files.sorting.direction') || 'desc';
|
|
271
|
+
const nodes = await this.contentApi
|
|
272
|
+
.getNodeChildren(folderId, {
|
|
273
|
+
// orderBy: `${sortKey} ${sortDirection}`,
|
|
274
|
+
fields: ['id', this.getRootField(sortKey)],
|
|
275
|
+
where: '(isFile=true)'
|
|
276
|
+
})
|
|
277
|
+
.toPromise();
|
|
278
|
+
const entries = nodes.list.entries.map((obj) => obj.entry);
|
|
279
|
+
this.sort(entries, sortKey, sortDirection);
|
|
280
|
+
return entries.map((obj) => obj.id);
|
|
281
|
+
}
|
|
282
|
+
if (source === 'favorites') {
|
|
283
|
+
const nodes = await this.contentApi
|
|
284
|
+
.getFavorites('-me-', {
|
|
285
|
+
where: '(EXISTS(target/file))',
|
|
286
|
+
fields: ['target']
|
|
287
|
+
})
|
|
288
|
+
.toPromise();
|
|
289
|
+
const sortKey = this.preferences.get('favorites.sorting.key') || 'modifiedAt';
|
|
290
|
+
const sortDirection = this.preferences.get('favorites.sorting.direction') || 'desc';
|
|
291
|
+
const files = nodes.list.entries.map((obj) => obj.entry.target.file);
|
|
292
|
+
this.sort(files, sortKey, sortDirection);
|
|
293
|
+
return files.map((f) => f.id);
|
|
294
|
+
}
|
|
295
|
+
if (source === 'shared') {
|
|
296
|
+
const sortingKey = this.preferences.get('shared.sorting.key') || 'modifiedAt';
|
|
297
|
+
const sortingDirection = this.preferences.get('shared.sorting.direction') || 'desc';
|
|
298
|
+
const nodes = await this.contentApi
|
|
299
|
+
.findSharedLinks({
|
|
300
|
+
fields: ['nodeId', this.getRootField(sortingKey)]
|
|
301
|
+
})
|
|
302
|
+
.toPromise();
|
|
303
|
+
const entries = nodes.list.entries.map((obj) => obj.entry);
|
|
304
|
+
this.sort(entries, sortingKey, sortingDirection);
|
|
305
|
+
return entries.map((obj) => obj.nodeId);
|
|
306
|
+
}
|
|
307
|
+
if (source === 'recent-files') {
|
|
308
|
+
const person = await this.contentApi.getPerson('-me-').toPromise();
|
|
309
|
+
const username = person.entry.id;
|
|
310
|
+
const sortingKey = this.preferences.get('recent-files.sorting.key') || 'modifiedAt';
|
|
311
|
+
const sortingDirection = this.preferences.get('recent-files.sorting.direction') || 'desc';
|
|
312
|
+
const query = {
|
|
313
|
+
query: {
|
|
314
|
+
query: '*',
|
|
315
|
+
language: 'afts'
|
|
316
|
+
},
|
|
317
|
+
filterQueries: [
|
|
318
|
+
{ query: `cm:modified:[NOW/DAY-30DAYS TO NOW/DAY+1DAY]` },
|
|
319
|
+
{ query: `cm:modifier:${username} OR cm:creator:${username}` },
|
|
320
|
+
{
|
|
321
|
+
query: this.recentFileFilters.join(' AND ')
|
|
322
|
+
}
|
|
323
|
+
],
|
|
324
|
+
fields: ['id', this.getRootField(sortingKey)],
|
|
325
|
+
include: ['path', 'properties', 'allowableOperations'],
|
|
326
|
+
sort: [
|
|
327
|
+
{
|
|
328
|
+
type: 'FIELD',
|
|
329
|
+
field: 'cm:modified',
|
|
330
|
+
ascending: false
|
|
331
|
+
}
|
|
332
|
+
]
|
|
333
|
+
};
|
|
334
|
+
const nodes = await this.contentApi.search(query).toPromise();
|
|
335
|
+
const entries = nodes.list.entries.map((obj) => obj.entry);
|
|
336
|
+
this.sort(entries, sortingKey, sortingDirection);
|
|
337
|
+
return entries.map((obj) => obj.id);
|
|
338
|
+
}
|
|
339
|
+
return [];
|
|
340
|
+
}
|
|
341
|
+
sort(items, key, direction) {
|
|
342
|
+
const options = {};
|
|
343
|
+
if (key.includes('sizeInBytes') || key === 'name') {
|
|
344
|
+
options.numeric = true;
|
|
345
|
+
}
|
|
346
|
+
items.sort((a, b) => {
|
|
347
|
+
let left = ObjectUtils.getValue(a, key);
|
|
348
|
+
if (left) {
|
|
349
|
+
left = left instanceof Date ? left.valueOf().toString() : left.toString();
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
left = '';
|
|
353
|
+
}
|
|
354
|
+
let right = ObjectUtils.getValue(b, key);
|
|
355
|
+
if (right) {
|
|
356
|
+
right = right instanceof Date ? right.valueOf().toString() : right.toString();
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
right = '';
|
|
360
|
+
}
|
|
361
|
+
return direction === 'asc' ? left.localeCompare(right, undefined, options) : right.localeCompare(left, undefined, options);
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Get the root field name from the property path.
|
|
366
|
+
* Example: 'property1.some.child.property' => 'property1'
|
|
367
|
+
*
|
|
368
|
+
* @param path Property path
|
|
369
|
+
*/
|
|
370
|
+
getRootField(path) {
|
|
371
|
+
if (path) {
|
|
372
|
+
return path.split('.')[0];
|
|
373
|
+
}
|
|
374
|
+
return path;
|
|
375
|
+
}
|
|
376
|
+
getNavigationCommands(url) {
|
|
377
|
+
const urlTree = this.router.parseUrl(url);
|
|
378
|
+
const urlSegmentGroup = urlTree.root.children[PRIMARY_OUTLET];
|
|
379
|
+
if (!urlSegmentGroup) {
|
|
380
|
+
return [url];
|
|
381
|
+
}
|
|
382
|
+
const urlSegments = urlSegmentGroup.segments;
|
|
383
|
+
return urlSegments.reduce(function (acc, item) {
|
|
384
|
+
acc.push(item.path, item.parameters);
|
|
385
|
+
return acc;
|
|
386
|
+
}, []);
|
|
387
|
+
}
|
|
388
|
+
shouldNavigate(element) {
|
|
389
|
+
let currentElement = element.parentElement;
|
|
390
|
+
while (currentElement && !this.isChild(currentElement.classList)) {
|
|
391
|
+
currentElement = currentElement.parentElement;
|
|
392
|
+
}
|
|
393
|
+
return !!currentElement;
|
|
394
|
+
}
|
|
395
|
+
isChild(list) {
|
|
396
|
+
return Array.from(list).some((className) => this.containersSkipNavigation.includes(className));
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
PreviewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PreviewComponent, deps: [{ token: i1.ContentApiService }, { token: i2.UserPreferencesService }, { token: i3.ActivatedRoute }, { token: i4.NodesApiService }, { token: i5.Actions }, { token: i6.Location }, { token: i1.AppHookService }], target: i0.ɵɵFactoryTarget.Component });
|
|
400
|
+
PreviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: PreviewComponent, selector: "app-preview", host: { listeners: { "document:keydown": "handleKeyboardEvent($event)" }, classAttribute: "app-preview" }, usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"nodeId\">\n <adf-alfresco-viewer\n [ngClass]=\"{\n 'right_side--hide': !showRightSide\n }\"\n [nodeId]=\"nodeId\"\n [allowNavigate]=\"navigateMultiple\"\n [allowRightSidebar]=\"true\"\n [allowPrint]=\"false\"\n [showRightSidebar]=\"true\"\n [allowDownload]=\"false\"\n [allowFullScreen]=\"false\"\n [canNavigateBefore]=\"!!previousNodeId\"\n [canNavigateNext]=\"!!nextNodeId\"\n [overlayMode]=\"true\"\n (showViewerChange)=\"onVisibilityChanged($event)\"\n (navigateBefore)=\"onNavigateBefore($event)\"\n (navigateNext)=\"onNavigateNext($event)\"\n >\n <adf-viewer-sidebar *ngIf=\"infoDrawerOpened$ | async\">\n <aca-info-drawer [node]=\"selection.file\"></aca-info-drawer>\n </adf-viewer-sidebar>\n\n <adf-viewer-open-with *ngIf=\"openWith.length\">\n <ng-container *ngFor=\"let action of openWith; trackBy: trackByActionId\">\n <app-toolbar-menu-item [actionRef]=\"action\"></app-toolbar-menu-item>\n </ng-container>\n </adf-viewer-open-with>\n\n <adf-viewer-toolbar-actions *ngIf=\"!simplestMode\">\n <ng-container *ngFor=\"let action of viewerToolbarActions; trackBy: trackByActionId\">\n <aca-toolbar-action [actionRef]=\"action\"></aca-toolbar-action>\n </ng-container>\n </adf-viewer-toolbar-actions>\n </adf-alfresco-viewer>\n</ng-container>\n", styles: [".app-preview{width:100%;height:100%}.adf-viewer-toolbar .adf-toolbar-divider{display:none}.adf-viewer-toolbar-actions{display:flex;flex-direction:row;align-items:center}.adf-viewer-toolbar-actions .adf-toolbar-divider{display:inline}.adf-viewer-toolbar .mat-toolbar>button:last-child{display:none}.adf-alfresco-viewer.right_side--hide .adf-viewer__sidebar__right{width:0}\n"], dependencies: [{ kind: "directive", type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.ViewerSidebarComponent, selector: "adf-viewer-sidebar" }, { kind: "component", type: i2.ViewerOpenWithComponent, selector: "adf-viewer-open-with" }, { kind: "component", type: i2.ViewerToolbarActionsComponent, selector: "adf-viewer-toolbar-actions" }, { kind: "component", type: i4.AlfrescoViewerComponent, selector: "adf-alfresco-viewer", inputs: ["nodeId", "versionId", "sharedLinkId", "showViewer", "maxRetries", "allowGoBack", "showToolbar", "overlayMode", "allowNavigate", "canNavigateBefore", "canNavigateNext", "allowLeftSidebar", "allowRightSidebar", "showRightSidebar", "showLeftSidebar", "allowDownload", "allowPrint", "allowFullScreen", "sidebarRightTemplate", "sidebarLeftTemplate"], outputs: ["invalidSharedLink", "navigateBefore", "navigateNext", "showViewerChange"] }, { kind: "component", type: i1.ToolbarActionComponent, selector: "aca-toolbar-action", inputs: ["data", "type", "color", "actionRef"] }, { kind: "component", type: i1.ToolbarMenuItemComponent, selector: "app-toolbar-menu-item", inputs: ["actionRef", "menuId"] }, { kind: "component", type: i1.InfoDrawerComponent, selector: "aca-info-drawer", inputs: ["nodeId", "node"] }, { kind: "pipe", type: i6.AsyncPipe, name: "async" }], encapsulation: i0.ViewEncapsulation.None });
|
|
401
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PreviewComponent, decorators: [{
|
|
402
|
+
type: Component,
|
|
403
|
+
args: [{ selector: 'app-preview', encapsulation: ViewEncapsulation.None, host: { class: 'app-preview' }, template: "<ng-container *ngIf=\"nodeId\">\n <adf-alfresco-viewer\n [ngClass]=\"{\n 'right_side--hide': !showRightSide\n }\"\n [nodeId]=\"nodeId\"\n [allowNavigate]=\"navigateMultiple\"\n [allowRightSidebar]=\"true\"\n [allowPrint]=\"false\"\n [showRightSidebar]=\"true\"\n [allowDownload]=\"false\"\n [allowFullScreen]=\"false\"\n [canNavigateBefore]=\"!!previousNodeId\"\n [canNavigateNext]=\"!!nextNodeId\"\n [overlayMode]=\"true\"\n (showViewerChange)=\"onVisibilityChanged($event)\"\n (navigateBefore)=\"onNavigateBefore($event)\"\n (navigateNext)=\"onNavigateNext($event)\"\n >\n <adf-viewer-sidebar *ngIf=\"infoDrawerOpened$ | async\">\n <aca-info-drawer [node]=\"selection.file\"></aca-info-drawer>\n </adf-viewer-sidebar>\n\n <adf-viewer-open-with *ngIf=\"openWith.length\">\n <ng-container *ngFor=\"let action of openWith; trackBy: trackByActionId\">\n <app-toolbar-menu-item [actionRef]=\"action\"></app-toolbar-menu-item>\n </ng-container>\n </adf-viewer-open-with>\n\n <adf-viewer-toolbar-actions *ngIf=\"!simplestMode\">\n <ng-container *ngFor=\"let action of viewerToolbarActions; trackBy: trackByActionId\">\n <aca-toolbar-action [actionRef]=\"action\"></aca-toolbar-action>\n </ng-container>\n </adf-viewer-toolbar-actions>\n </adf-alfresco-viewer>\n</ng-container>\n", styles: [".app-preview{width:100%;height:100%}.adf-viewer-toolbar .adf-toolbar-divider{display:none}.adf-viewer-toolbar-actions{display:flex;flex-direction:row;align-items:center}.adf-viewer-toolbar-actions .adf-toolbar-divider{display:inline}.adf-viewer-toolbar .mat-toolbar>button:last-child{display:none}.adf-alfresco-viewer.right_side--hide .adf-viewer__sidebar__right{width:0}\n"] }]
|
|
404
|
+
}], ctorParameters: function () { return [{ type: i1.ContentApiService }, { type: i2.UserPreferencesService }, { type: i3.ActivatedRoute }, { type: i4.NodesApiService }, { type: i5.Actions }, { type: i6.Location }, { type: i1.AppHookService }]; }, propDecorators: { handleKeyboardEvent: [{
|
|
405
|
+
type: HostListener,
|
|
406
|
+
args: ['document:keydown', ['$event']]
|
|
407
|
+
}] } });
|
|
408
|
+
|
|
409
|
+
/*!
|
|
410
|
+
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
|
411
|
+
*
|
|
412
|
+
* Alfresco Example Content Application
|
|
413
|
+
*
|
|
414
|
+
* This file is part of the Alfresco Example Content Application.
|
|
415
|
+
* If the software was purchased under a paid Alfresco license, the terms of
|
|
416
|
+
* the paid license agreement will prevail. Otherwise, the software is
|
|
417
|
+
* provided under the following open source license terms:
|
|
418
|
+
*
|
|
419
|
+
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
|
420
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
421
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
422
|
+
* (at your option) any later version.
|
|
423
|
+
*
|
|
424
|
+
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
|
425
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
426
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
427
|
+
* GNU Lesser General Public License for more details.
|
|
428
|
+
*
|
|
429
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
430
|
+
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
|
431
|
+
*/
|
|
432
|
+
const routes = [
|
|
433
|
+
{
|
|
434
|
+
path: '',
|
|
435
|
+
component: PreviewComponent,
|
|
436
|
+
data: {
|
|
437
|
+
title: 'APP.PREVIEW.TITLE',
|
|
438
|
+
navigateMultiple: true
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
];
|
|
442
|
+
class PreviewModule {
|
|
443
|
+
}
|
|
444
|
+
PreviewModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PreviewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
445
|
+
PreviewModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: PreviewModule, declarations: [PreviewComponent], imports: [CommonModule, i3.RouterModule, i2.CoreModule, ExtensionsModule,
|
|
446
|
+
ContentModule,
|
|
447
|
+
ContentDirectiveModule,
|
|
448
|
+
SharedDirectivesModule,
|
|
449
|
+
ContentDirectiveModule,
|
|
450
|
+
SharedToolbarModule,
|
|
451
|
+
InfoDrawerComponent], exports: [PreviewComponent] });
|
|
452
|
+
PreviewModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PreviewModule, imports: [CommonModule,
|
|
453
|
+
RouterModule.forChild(routes),
|
|
454
|
+
CoreModule.forChild(),
|
|
455
|
+
ExtensionsModule,
|
|
456
|
+
ContentModule,
|
|
457
|
+
ContentDirectiveModule,
|
|
458
|
+
SharedDirectivesModule,
|
|
459
|
+
ContentDirectiveModule,
|
|
460
|
+
SharedToolbarModule,
|
|
461
|
+
InfoDrawerComponent] });
|
|
462
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: PreviewModule, decorators: [{
|
|
463
|
+
type: NgModule,
|
|
464
|
+
args: [{
|
|
465
|
+
imports: [
|
|
466
|
+
CommonModule,
|
|
467
|
+
RouterModule.forChild(routes),
|
|
468
|
+
CoreModule.forChild(),
|
|
469
|
+
ExtensionsModule,
|
|
470
|
+
ContentModule,
|
|
471
|
+
ContentDirectiveModule,
|
|
472
|
+
SharedDirectivesModule,
|
|
473
|
+
ContentDirectiveModule,
|
|
474
|
+
SharedToolbarModule,
|
|
475
|
+
InfoDrawerComponent
|
|
476
|
+
],
|
|
477
|
+
declarations: [PreviewComponent],
|
|
478
|
+
exports: [PreviewComponent]
|
|
479
|
+
}]
|
|
480
|
+
}] });
|
|
481
|
+
|
|
482
|
+
/*!
|
|
483
|
+
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
|
484
|
+
*
|
|
485
|
+
* Alfresco Example Content Application
|
|
486
|
+
*
|
|
487
|
+
* This file is part of the Alfresco Example Content Application.
|
|
488
|
+
* If the software was purchased under a paid Alfresco license, the terms of
|
|
489
|
+
* the paid license agreement will prevail. Otherwise, the software is
|
|
490
|
+
* provided under the following open source license terms:
|
|
491
|
+
*
|
|
492
|
+
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
|
493
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
494
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
495
|
+
* (at your option) any later version.
|
|
496
|
+
*
|
|
497
|
+
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
|
498
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
499
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
500
|
+
* GNU Lesser General Public License for more details.
|
|
501
|
+
*
|
|
502
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
503
|
+
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
|
504
|
+
*/
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Generated bundle index. Do not edit.
|
|
508
|
+
*/
|
|
509
|
+
|
|
510
|
+
export { PreviewComponent, PreviewModule };
|
|
511
|
+
//# sourceMappingURL=alfresco-aca-content-preview.mjs.map
|