diff --git a/projects/aca-content/assets/i18n/en.json b/projects/aca-content/assets/i18n/en.json index caac8bf51..c4c280e38 100644 --- a/projects/aca-content/assets/i18n/en.json +++ b/projects/aca-content/assets/i18n/en.json @@ -82,8 +82,6 @@ "TITLE": "Details" }, "NEW_MENU": { - "LABEL": "New", - "TOOLTIP": "Add new files and folders, or create a new File Library", "MENU_ITEMS": { "CREATE_FOLDER": "Create Folder", "UPLOAD_FILE": "Upload File", diff --git a/projects/aca-content/src/lib/aca-content.module.ts b/projects/aca-content/src/lib/aca-content.module.ts index 487beffe6..82730db2d 100644 --- a/projects/aca-content/src/lib/aca-content.module.ts +++ b/projects/aca-content/src/lib/aca-content.module.ts @@ -50,7 +50,6 @@ import { DirectivesModule } from './directives/directives.module'; import { ContextMenuModule } from './components/context-menu/context-menu.module'; import { ExtensionService, ExtensionsModule } from '@alfresco/adf-extensions'; import { AppToolbarModule } from './components/toolbar/toolbar.module'; -import { AppCreateMenuModule } from './components/create-menu/create-menu.module'; import { AppSidenavModule } from './components/sidenav/sidenav.module'; import { AppCommonModule } from './components/common/common.module'; import { AppSearchInputModule } from './components/search/search-input.module'; @@ -115,7 +114,6 @@ import { UserMenuComponent } from './components/sidenav/user-menu/user-menu.comp AppInfoDrawerModule, AppToolbarModule, AppSidenavModule, - AppCreateMenuModule, DocumentListCustomComponentsModule, AppSearchInputModule, AppSearchResultsModule, diff --git a/projects/aca-content/src/lib/components/create-menu/create-menu.component.html b/projects/aca-content/src/lib/components/create-menu/create-menu.component.html deleted file mode 100644 index 23a2f943a..000000000 --- a/projects/aca-content/src/lib/components/create-menu/create-menu.component.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - -
- -
-
diff --git a/projects/aca-content/src/lib/components/create-menu/create-menu.component.scss b/projects/aca-content/src/lib/components/create-menu/create-menu.component.scss deleted file mode 100644 index 3ec6aea15..000000000 --- a/projects/aca-content/src/lib/components/create-menu/create-menu.component.scss +++ /dev/null @@ -1,97 +0,0 @@ -.app-create-menu { - .mat-stroked-button { - width: 100%; - height: 37.5px; - border-radius: 4px; - font-size: var(--new-button-font-size); - font-weight: normal; - text-transform: uppercase; - margin-top: 10px; - - .mat-icon { - width: 24px; - height: 25px; - } - - &__text { - width: 100%; - height: 20px; - text-align: left; - } - - &:not(.app-create-menu-secondary-button) { - background-color: var(--theme-accent-color); - color: var(--theme-accent-color-default-contrast); - margin-top: 0; - - .mat-icon { - color: var(--theme-accent-color-default-contrast); - } - } - } - - &__root-menu { - max-width: 290px !important; - width: 290px; - display: flex; - align-items: center; - justify-content: center; - - & > .mat-menu-content { - width: 100%; - } - } - - .app-create-menu--icon { - &__sub-menu { - .mat-menu-item { - display: flex; - flex-direction: row; - align-items: center; - font-size: var(--theme-button-font-size); - color: var(--theme-secondary-text-color); - line-height: 48px; - box-shadow: none; - transform: none; - transition: unset; - font-weight: normal; - - &:hover { - color: var(--theme-primary-color); - } - } - - .mat-menu-item[disabled], - .mat-menu-item[disabled]:hover { - color: var(--theme-text-disabled-color); - - .mat-icon { - color: var(--theme-text-disabled-color); - } - } - } - } - - &--collapsed { - outline: none; - color: var(--theme-secondary-text-color); - cursor: pointer; - margin: 0; - border: none; - background: none; - - &:not(.app-create-menu-secondary-button) { - .app-create-menu--icon { - color: var(--theme-accent-color); - } - - &:hover { - color: var(--theme-accent-color); - } - } - } -} - -.app-create-menu:focus { - outline: none; -} diff --git a/projects/aca-content/src/lib/components/create-menu/create-menu.component.spec.ts b/projects/aca-content/src/lib/components/create-menu/create-menu.component.spec.ts deleted file mode 100644 index 67f548172..000000000 --- a/projects/aca-content/src/lib/components/create-menu/create-menu.component.spec.ts +++ /dev/null @@ -1,155 +0,0 @@ -/*! - * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * Alfresco Example Content Application - * - * This file is part of the Alfresco Example Content Application. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * The Alfresco Example Content Application is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Alfresco Example Content Application is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * from Hyland Software. If not, see . - */ - -import { CreateMenuComponent } from './create-menu.component'; -import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { AppCreateMenuModule } from './create-menu.module'; -import { OverlayContainer, OverlayModule } from '@angular/cdk/overlay'; -import { AppExtensionService } from '@alfresco/aca-shared'; -import { By } from '@angular/platform-browser'; -import { AppTestingModule } from '../../testing/app-testing.module'; -import { MatMenuModule } from '@angular/material/menu'; -import { MatButtonModule } from '@angular/material/button'; -import { of } from 'rxjs'; -import { ContentActionRef, ContentActionType } from '@alfresco/adf-extensions'; - -describe('CreateMenuComponent', () => { - let fixture: ComponentFixture; - let extensionService: AppExtensionService; - let getCreateActionsSpy: jasmine.Spy; - - const getContentActionRef = (): ContentActionRef => ({ - id: 'id', - type: ContentActionType.button, - title: 'ACTION_TITLE', - disabled: false, - actions: { - click: 'ACTION_CLICK' - } - }); - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [AppTestingModule, AppCreateMenuModule, OverlayModule, MatMenuModule, MatButtonModule] - }); - - extensionService = TestBed.inject(AppExtensionService); - getCreateActionsSpy = spyOn(extensionService, 'getCreateActions'); - getCreateActionsSpy.and.returnValue( - of([ - { - id: 'action1', - type: ContentActionType.button, - title: 'action one' - } - ]) - ); - - spyOn(extensionService, 'getMainAction').and.returnValue(of(getContentActionRef())); - - fixture = TestBed.createComponent(CreateMenuComponent); - }); - - async function clickMenu() { - fixture.detectChanges(); - await fixture.whenStable(); - - const button: HTMLButtonElement = fixture.debugElement.query(By.css('[data-automation-id="create-button"]')).nativeElement; - button.click(); - - fixture.detectChanges(); - await fixture.whenStable(); - } - - it('should render collapsed button', async () => { - fixture.componentInstance.expanded = false; - fixture.detectChanges(); - await fixture.whenStable(); - - const button: HTMLButtonElement = fixture.debugElement.query(By.css('[data-automation-id="create-button"]')).nativeElement; - const isCollapsed = button.classList.contains('app-create-menu--collapsed'); - - expect(isCollapsed).toBe(true); - }); - - it('should render expanded button', async () => { - fixture.componentInstance.expanded = true; - fixture.detectChanges(); - await fixture.whenStable(); - - const button: HTMLButtonElement = fixture.debugElement.query(By.css('[data-automation-id="create-button"]')).nativeElement; - const isCollapsed = button.classList.contains('app-create-menu--collapsed'); - - expect(isCollapsed).toBe(false); - }); - - it('should render custom actions', async () => { - await clickMenu(); - - const menuItems = fixture.debugElement.queryAll(By.css('.app-toolbar-menu-item')); - expect(menuItems.length).toBe(1); - - const label: HTMLSpanElement = (menuItems[0].nativeElement as HTMLButtonElement).querySelector('[data-automation-id="menu-item-title"]'); - expect(label.innerText).toBe('action one'); - }); - - it('should render sub-menus', async () => { - getCreateActionsSpy.and.returnValue( - of([ - { - id: 'level1', - type: ContentActionType.menu, - title: 'level one', - children: [ - { - id: 'level2', - type: ContentActionType.button, - title: 'level two' - } - ] - } - ]) - ); - - await clickMenu(); - - const level1 = fixture.debugElement.query(By.css('#level1')).nativeElement as HTMLButtonElement; - level1.click(); - - const overlayContainer = TestBed.inject(OverlayContainer); - const level2 = overlayContainer.getContainerElement().querySelector('#level2'); - - expect(level2).not.toBeNull(); - }); - - it('should recognise if main button is present', async () => { - fixture.detectChanges(); - await fixture.whenStable(); - - const button: HTMLButtonElement = fixture.debugElement.query(By.css('[data-automation-id="create-button"]')).nativeElement; - const isSecondaryButton = button.classList.contains('app-create-menu-secondary-button'); - - expect(isSecondaryButton).toBeTrue(); - }); -}); diff --git a/projects/aca-content/src/lib/components/create-menu/create-menu.component.ts b/projects/aca-content/src/lib/components/create-menu/create-menu.component.ts deleted file mode 100644 index 4ebad443b..000000000 --- a/projects/aca-content/src/lib/components/create-menu/create-menu.component.ts +++ /dev/null @@ -1,75 +0,0 @@ -/*! - * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * Alfresco Example Content Application - * - * This file is part of the Alfresco Example Content Application. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * The Alfresco Example Content Application is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Alfresco Example Content Application is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * from Hyland Software. If not, see . - */ - -import { Component, Input, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core'; -import { ContentActionRef } from '@alfresco/adf-extensions'; -import { takeUntil } from 'rxjs/operators'; -import { Subject } from 'rxjs'; -import { AppExtensionService } from '@alfresco/aca-shared'; - -@Component({ - selector: 'app-create-menu', - templateUrl: './create-menu.component.html', - styleUrls: ['./create-menu.component.scss'], - encapsulation: ViewEncapsulation.None, - host: { class: 'app-create-menu' } -}) -export class CreateMenuComponent implements OnInit, OnDestroy { - createActions: Array = []; - onDestroy$: Subject = new Subject(); - isMainActionPresent: boolean; - - @Input() - showLabel: boolean; - - @Input() - expanded: boolean; - - constructor(private extensions: AppExtensionService) {} - - ngOnInit() { - this.extensions - .getCreateActions() - .pipe(takeUntil(this.onDestroy$)) - .subscribe((createActions) => { - this.createActions = createActions; - }); - - this.extensions - .getMainAction() - .pipe(takeUntil(this.onDestroy$)) - .subscribe((mainAction) => { - this.isMainActionPresent = !!mainAction; - }); - } - - ngOnDestroy() { - this.onDestroy$.next(true); - this.onDestroy$.complete(); - } - - trackByActionId(_: number, obj: ContentActionRef): string { - return obj.id; - } -} diff --git a/projects/aca-content/src/lib/components/create-menu/create-menu.module.ts b/projects/aca-content/src/lib/components/create-menu/create-menu.module.ts deleted file mode 100644 index 7c51e08fc..000000000 --- a/projects/aca-content/src/lib/components/create-menu/create-menu.module.ts +++ /dev/null @@ -1,36 +0,0 @@ -/*! - * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * Alfresco Example Content Application - * - * This file is part of the Alfresco Example Content Application. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * The Alfresco Example Content Application is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Alfresco Example Content Application is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * from Hyland Software. If not, see . - */ - -import { NgModule } from '@angular/core'; -import { CreateMenuComponent } from './create-menu.component'; -import { CommonModule } from '@angular/common'; -import { CoreModule } from '@alfresco/adf-core'; -import { AppToolbarModule } from '../toolbar/toolbar.module'; - -@NgModule({ - imports: [CommonModule, CoreModule.forChild(), AppToolbarModule], - declarations: [CreateMenuComponent], - exports: [CreateMenuComponent] -}) -export class AppCreateMenuModule {} diff --git a/projects/aca-content/src/lib/components/dl-custom-components/tags-column/tags-column.component.spec.ts b/projects/aca-content/src/lib/components/dl-custom-components/tags-column/tags-column.component.spec.ts new file mode 100644 index 000000000..917bb97f8 --- /dev/null +++ b/projects/aca-content/src/lib/components/dl-custom-components/tags-column/tags-column.component.spec.ts @@ -0,0 +1,57 @@ +/*! + * Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved. + * + * Alfresco Example Content Application + * + * This file is part of the Alfresco Example Content Application. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * The Alfresco Example Content Application is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * The Alfresco Example Content Application is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * from Hyland Software. If not, see . + */ + +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { TagsColumnComponent } from './tags-column.component'; +import { ChangeDetectorRef } from '@angular/core'; + +describe('TagsColumnComponent', () => { + let fixture: ComponentFixture; + let component: TagsColumnComponent; + let changeDetector: ChangeDetectorRef; + + beforeEach(() => { + TestBed.configureTestingModule({ + declarations: [TagsColumnComponent], + providers: [{ provide: ChangeDetectorRef, useValue: { detectChanges() {} } }] + }); + + changeDetector = TestBed.inject(ChangeDetectorRef); + fixture = TestBed.createComponent(TagsColumnComponent); + component = fixture.componentInstance; + component.context = { row: { id: '0' } }; + }); + + it('should return nodeId from the row', () => { + const row: any = { id: 'test1' }; + expect(component.getNodeId(row)).toBe('test1'); + }); + + it('should force change detection on tags loading', () => { + spyOn(changeDetector, 'detectChanges'); + component = new TagsColumnComponent(changeDetector); + component.onTagsLoaded(); + expect(changeDetector.detectChanges).toHaveBeenCalled(); + }); +}); diff --git a/projects/aca-content/src/lib/components/sidenav/sidenav.module.ts b/projects/aca-content/src/lib/components/sidenav/sidenav.module.ts index 218e71a80..7b9e49a8d 100644 --- a/projects/aca-content/src/lib/components/sidenav/sidenav.module.ts +++ b/projects/aca-content/src/lib/components/sidenav/sidenav.module.ts @@ -23,7 +23,6 @@ */ import { NgModule } from '@angular/core'; -import { AppCreateMenuModule } from '../create-menu/create-menu.module'; import { CoreModule } from '@alfresco/adf-core'; import { RouterModule } from '@angular/router'; import { ExtensionsModule } from '@alfresco/adf-extensions'; @@ -39,7 +38,7 @@ import { SharedToolbarModule } from '@alfresco/aca-shared'; import { UserMenuComponent } from './user-menu/user-menu.component'; @NgModule({ - imports: [CoreModule.forChild(), ExtensionsModule.forChild(), RouterModule, AppCreateMenuModule, SharedToolbarModule], + imports: [CoreModule.forChild(), ExtensionsModule.forChild(), RouterModule, SharedToolbarModule], declarations: [ MenuPanelDirective, ExpansionPanelDirective, diff --git a/projects/aca-content/src/lib/components/view-profile/view-profile.component.scss b/projects/aca-content/src/lib/components/view-profile/view-profile.component.scss index c6670ff68..00d6a8553 100644 --- a/projects/aca-content/src/lib/components/view-profile/view-profile.component.scss +++ b/projects/aca-content/src/lib/components/view-profile/view-profile.component.scss @@ -86,7 +86,7 @@ app-view-profile { border: 2px solid var(--theme-blue-button-color) !important; border-radius: 6px; outline: none !important; - box-shadow: 0 0 2px (--theme-blue-button-color); + box-shadow: 0 0 2px var(--theme-blue-button-color); } .app-general-edit { diff --git a/projects/aca-shared/src/lib/components/info-drawer/shared-info-drawer.module.ts b/projects/aca-shared/src/lib/components/info-drawer/shared-info-drawer.module.ts index 1f15394cf..7332ec438 100644 --- a/projects/aca-shared/src/lib/components/info-drawer/shared-info-drawer.module.ts +++ b/projects/aca-shared/src/lib/components/info-drawer/shared-info-drawer.module.ts @@ -30,9 +30,10 @@ import { ExtensionsModule } from '@alfresco/adf-extensions'; import { MatProgressBarModule } from '@angular/material/progress-bar'; import { SharedToolbarModule } from '../tool-bar/shared-toolbar.module'; import { TranslateModule } from '@ngx-translate/core'; +import { A11yModule } from '@angular/cdk/a11y'; @NgModule({ - imports: [CommonModule, InfoDrawerModule, MatProgressBarModule, ExtensionsModule, ToolbarModule, SharedToolbarModule, TranslateModule], + imports: [CommonModule, InfoDrawerModule, MatProgressBarModule, ExtensionsModule, ToolbarModule, SharedToolbarModule, TranslateModule, A11yModule], declarations: [InfoDrawerComponent], exports: [InfoDrawerComponent] })