Add support for dynamic themes

This commit is contained in:
Art Lowel
2021-02-25 15:04:32 +01:00
parent 70dac6bc8f
commit 5a6e4b1278
224 changed files with 3429 additions and 1017 deletions

View File

@@ -339,7 +339,6 @@ dspace-angular
├── tslint.json * TSLint (https://palantir.github.io/tslint/) configuration ├── tslint.json * TSLint (https://palantir.github.io/tslint/) configuration
├── typedoc.json * TYPEDOC configuration ├── typedoc.json * TYPEDOC configuration
├── webpack * Webpack (https://webpack.github.io/) config directory ├── webpack * Webpack (https://webpack.github.io/) config directory
│   ├── helpers.js *
│   ├── webpack.aot.js * Webpack (https://webpack.github.io/) config for AoT build │   ├── webpack.aot.js * Webpack (https://webpack.github.io/) config for AoT build
│   ├── webpack.client.js * Webpack (https://webpack.github.io/) config for client build │   ├── webpack.client.js * Webpack (https://webpack.github.io/) config for client build
│   ├── webpack.common.js * │   ├── webpack.common.js *

View File

@@ -17,6 +17,7 @@
"build": { "build": {
"builder": "@angular-builders/custom-webpack:browser", "builder": "@angular-builders/custom-webpack:browser",
"options": { "options": {
"extractCss": true,
"preserveSymlinks": true, "preserveSymlinks": true,
"customWebpackConfig": { "customWebpackConfig": {
"path": "./webpack/webpack.browser.ts", "path": "./webpack/webpack.browser.ts",
@@ -46,7 +47,16 @@
"src/robots.txt" "src/robots.txt"
], ],
"styles": [ "styles": [
"src/styles.scss" {
"input": "src/styles/base-theme.scss",
"inject": false,
"bundleName": "base-theme"
},
{
"input": "src/themes/custom/styles/theme.scss",
"inject": false,
"bundleName": "custom-theme"
}
], ],
"scripts": [] "scripts": []
}, },
@@ -116,7 +126,11 @@
"src/assets" "src/assets"
], ],
"styles": [ "styles": [
"src/styles.scss" {
"input": "src/styles/base-theme.scss",
"inject": false,
"bundleName": "base-theme"
}
], ],
"scripts": [] "scripts": []
} }

View File

@@ -20,7 +20,9 @@
"serve": "ts-node --project ./tsconfig.ts-node.json scripts/serve.ts", "serve": "ts-node --project ./tsconfig.ts-node.json scripts/serve.ts",
"start:dev": "npm-run-all --parallel config:dev:watch serve", "start:dev": "npm-run-all --parallel config:dev:watch serve",
"start:prod": "yarn run build:prod && yarn run serve:ssr", "start:prod": "yarn run build:prod && yarn run serve:ssr",
"analyze": "webpack-bundle-analyzer dist/browser/stats.json",
"build": "ng build", "build": "ng build",
"build:stats": "ng build --stats-json",
"build:prod": "yarn run build:ssr", "build:prod": "yarn run build:ssr",
"build:ssr": "yarn run build:client-and-server-bundles && yarn run compile:server", "build:ssr": "yarn run build:client-and-server-bundles && yarn run compile:server",
"build:client-and-server-bundles": "ng build --prod && ng run dspace-angular:server:production --bundleDependencies true", "build:client-and-server-bundles": "ng build --prod && ng run dspace-angular:server:production --bundleDependencies true",
@@ -179,7 +181,7 @@
"tslint": "^6.1.3", "tslint": "^6.1.3",
"typescript": "~4.0.5", "typescript": "~4.0.5",
"webpack": "^4.44.2", "webpack": "^4.44.2",
"webpack-bundle-analyzer": "^3.3.2", "webpack-bundle-analyzer": "^4.4.0",
"webpack-cli": "^4.2.0", "webpack-cli": "^4.2.0",
"webpack-node-externals": "1.7.2" "webpack-node-externals": "1.7.2"
} }

View File

@@ -1,7 +1,7 @@
module.exports = { module.exports = {
plugins: [ plugins: [
require('postcss-import')(), require('postcss-import')(),
require('postcss-cssnext')(), require('postcss-preset-env')(),
require('postcss-apply')(), require('postcss-apply')(),
require('postcss-responsive-type')() require('postcss-responsive-type')()
] ]

View File

@@ -1,22 +0,0 @@
const syncBuildDir = require('copyfiles');
const path = require('path');
const {
projectRoot,
theme,
themePath,
} = require('../webpack/helpers');
const projectDepth = projectRoot('./').split(path.sep).length;
let callback;
if (theme !== null && theme !== undefined) {
callback = () => {
syncBuildDir([path.join(themePath, '**/*'), 'build'], { up: projectDepth + 2 }, () => {})
}
}
else {
callback = () => {};
}
syncBuildDir([projectRoot('src/**/*'), 'build'], { up: projectDepth + 1 }, callback);

View File

@@ -16,6 +16,8 @@ import { RouterTestingModule } from '@angular/router/testing';
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model'; import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
import { ItemAdminSearchResultGridElementComponent } from './item-admin-search-result-grid-element.component'; import { ItemAdminSearchResultGridElementComponent } from './item-admin-search-result-grid-element.component';
import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/remote-data.utils'; import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/remote-data.utils';
import { getMockThemeService } from '../../../../../shared/mocks/theme-service.mock';
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
describe('ItemAdminSearchResultGridElementComponent', () => { describe('ItemAdminSearchResultGridElementComponent', () => {
let component: ItemAdminSearchResultGridElementComponent; let component: ItemAdminSearchResultGridElementComponent;
@@ -29,6 +31,8 @@ describe('ItemAdminSearchResultGridElementComponent', () => {
} }
}; };
const mockThemeService = getMockThemeService();
function init() { function init() {
id = '780b2588-bda5-4112-a1cd-0b15000a5339'; id = '780b2588-bda5-4112-a1cd-0b15000a5339';
searchResult = new ItemSearchResult(); searchResult = new ItemSearchResult();
@@ -50,6 +54,7 @@ describe('ItemAdminSearchResultGridElementComponent', () => {
providers: [ providers: [
{ provide: TruncatableService, useValue: mockTruncatableService }, { provide: TruncatableService, useValue: mockTruncatableService },
{ provide: BitstreamDataService, useValue: mockBitstreamDataService }, { provide: BitstreamDataService, useValue: mockBitstreamDataService },
{ provide: ThemeService, useValue: mockThemeService },
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}) })

View File

@@ -12,6 +12,7 @@ import { TruncatableService } from '../../../../../shared/truncatable/truncatabl
import { BitstreamDataService } from '../../../../../core/data/bitstream-data.service'; import { BitstreamDataService } from '../../../../../core/data/bitstream-data.service';
import { GenericConstructor } from '../../../../../core/shared/generic-constructor'; import { GenericConstructor } from '../../../../../core/shared/generic-constructor';
import { ListableObjectDirective } from '../../../../../shared/object-collection/shared/listable-object/listable-object.directive'; import { ListableObjectDirective } from '../../../../../shared/object-collection/shared/listable-object/listable-object.directive';
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
@listableObjectComponent(ItemSearchResult, ViewMode.GridElement, Context.AdminSearch) @listableObjectComponent(ItemSearchResult, ViewMode.GridElement, Context.AdminSearch)
@Component({ @Component({
@@ -29,6 +30,7 @@ export class ItemAdminSearchResultGridElementComponent extends SearchResultGridE
constructor(protected truncatableService: TruncatableService, constructor(protected truncatableService: TruncatableService,
protected bitstreamDataService: BitstreamDataService, protected bitstreamDataService: BitstreamDataService,
private themeService: ThemeService,
private componentFactoryResolver: ComponentFactoryResolver private componentFactoryResolver: ComponentFactoryResolver
) { ) {
super(truncatableService, bitstreamDataService); super(truncatableService, bitstreamDataService);
@@ -63,6 +65,6 @@ export class ItemAdminSearchResultGridElementComponent extends SearchResultGridE
* @returns {GenericConstructor<Component>} * @returns {GenericConstructor<Component>}
*/ */
private getComponent(): GenericConstructor<Component> { private getComponent(): GenericConstructor<Component> {
return getListableObjectComponent(this.object.getRenderTypes(), ViewMode.GridElement, undefined); return getListableObjectComponent(this.object.getRenderTypes(), ViewMode.GridElement, undefined, this.themeService.getThemeName());
} }
} }

View File

@@ -1,12 +1,12 @@
$icon-z-index: 10;
:host { :host {
--ds-icon-z-index: 10;
left: 0; left: 0;
top: 0; top: 0;
height: 100vh; height: 100vh;
flex: 1 1 auto; flex: 1 1 auto;
nav { nav {
background-color: $admin-sidebar-bg; background-color: var(--ds-admin-sidebar-bg);
height: 100%; height: 100%;
flex-direction: column; flex-direction: column;
> div { > div {
@@ -19,12 +19,12 @@ $icon-z-index: 10;
} }
&.inactive ::ng-deep .sidebar-collapsible { &.inactive ::ng-deep .sidebar-collapsible {
margin-left: -#{$sidebar-items-width}; margin-left: calc(-1 * var(--ds-sidebar-items-width));
} }
.navbar-nav { .navbar-nav {
.admin-menu-header { .admin-menu-header {
background-color: $admin-sidebar-header-bg; background-color: var(--ds-admin-sidebar-header-bg);
.logo-wrapper { .logo-wrapper {
img { img {
height: 20px; height: 20px;
@@ -43,29 +43,29 @@ $icon-z-index: 10;
.sidebar-section { .sidebar-section {
display: flex; display: flex;
align-content: stretch; align-content: stretch;
background-color: $admin-sidebar-bg; background-color: var(--ds-admin-sidebar-bg);
.nav-item { .nav-item {
padding-top: $spacer; padding-top: var(--bs-spacer);
padding-bottom: $spacer; padding-bottom: var(--bs-spacer);
} }
.shortcut-icon { .shortcut-icon {
padding-left: $icon-padding; padding-left: var(--ds-icon-padding);
padding-right: $icon-padding; padding-right: var(--ds-icon-padding);
} }
.shortcut-icon, .icon-wrapper { .shortcut-icon, .icon-wrapper {
background-color: inherit; background-color: inherit;
z-index: $icon-z-index; z-index: var(--ds-icon-z-index);
} }
.sidebar-collapsible { .sidebar-collapsible {
width: $sidebar-items-width; width: var(--ds-sidebar-items-width);
position: relative; position: relative;
a { a {
padding-right: $spacer; padding-right: var(--bs-spacer);
width: 100%; width: 100%;
} }
} }
&.active > .sidebar-collapsible > .nav-link { &.active > .sidebar-collapsible > .nav-link {
color: $navbar-dark-active-color; color: var(--bs-navbar-dark-active-color);
} }
} }
} }
@@ -73,4 +73,4 @@ $icon-z-index: 10;
} }
} }

View File

@@ -1,13 +1,13 @@
:host ::ng-deep { :host ::ng-deep {
.fa-chevron-right { .fa-chevron-right {
padding-left: $spacer/2; padding-left: calc(var(--bs-spacer) / 2);
font-size: 0.5rem; font-size: 0.5rem;
line-height: 3; line-height: 3;
} }
.sidebar-sub-level-items { .sidebar-sub-level-items {
list-style: disc; list-style: disc;
color: $navbar-dark-color; color: var(--bs-navbar-dark-color);
overflow: hidden; overflow: hidden;
} }

View File

@@ -19,6 +19,8 @@ import { BitstreamDataService } from '../../../../../core/data/bitstream-data.se
import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/remote-data.utils'; import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/remote-data.utils';
import { getMockLinkService } from '../../../../../shared/mocks/link-service.mock'; import { getMockLinkService } from '../../../../../shared/mocks/link-service.mock';
import { of as observableOf } from 'rxjs'; import { of as observableOf } from 'rxjs';
import { getMockThemeService } from '../../../../../shared/mocks/theme-service.mock';
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
describe('WorkflowItemAdminWorkflowGridElementComponent', () => { describe('WorkflowItemAdminWorkflowGridElementComponent', () => {
let component: WorkflowItemSearchResultAdminWorkflowGridElementComponent; let component: WorkflowItemSearchResultAdminWorkflowGridElementComponent;
@@ -28,6 +30,7 @@ describe('WorkflowItemAdminWorkflowGridElementComponent', () => {
let itemRD$; let itemRD$;
let linkService; let linkService;
let object; let object;
let themeService;
function init() { function init() {
itemRD$ = createSuccessfulRemoteDataObject$(new Item()); itemRD$ = createSuccessfulRemoteDataObject$(new Item());
@@ -37,6 +40,7 @@ describe('WorkflowItemAdminWorkflowGridElementComponent', () => {
wfi.item = itemRD$; wfi.item = itemRD$;
object.indexableObject = wfi; object.indexableObject = wfi;
linkService = getMockLinkService(); linkService = getMockLinkService();
themeService = getMockThemeService();
} }
beforeEach(waitForAsync(() => { beforeEach(waitForAsync(() => {
@@ -51,6 +55,7 @@ describe('WorkflowItemAdminWorkflowGridElementComponent', () => {
], ],
providers: [ providers: [
{ provide: LinkService, useValue: linkService }, { provide: LinkService, useValue: linkService },
{ provide: ThemeService, useValue: themeService },
{ {
provide: TruncatableService, useValue: { provide: TruncatableService, useValue: {
isCollapsed: () => observableOf(true), isCollapsed: () => observableOf(true),

View File

@@ -1,7 +1,10 @@
import { Component, ComponentFactoryResolver, ElementRef, ViewChild } from '@angular/core'; import { Component, ComponentFactoryResolver, ElementRef, ViewChild } from '@angular/core';
import { Item } from '../../../../../core/shared/item.model'; import { Item } from '../../../../../core/shared/item.model';
import { ViewMode } from '../../../../../core/shared/view-mode.model'; import { ViewMode } from '../../../../../core/shared/view-mode.model';
import { getListableObjectComponent, listableObjectComponent } from '../../../../../shared/object-collection/shared/listable-object/listable-object.decorator'; import {
getListableObjectComponent,
listableObjectComponent
} from '../../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
import { Context } from '../../../../../core/shared/context.model'; import { Context } from '../../../../../core/shared/context.model';
import { SearchResultGridElementComponent } from '../../../../../shared/object-grid/search-result-grid-element/search-result-grid-element.component'; import { SearchResultGridElementComponent } from '../../../../../shared/object-grid/search-result-grid-element/search-result-grid-element.component';
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service'; import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
@@ -13,9 +16,13 @@ import { Observable } from 'rxjs';
import { LinkService } from '../../../../../core/cache/builders/link.service'; import { LinkService } from '../../../../../core/cache/builders/link.service';
import { followLink } from '../../../../../shared/utils/follow-link-config.model'; import { followLink } from '../../../../../shared/utils/follow-link-config.model';
import { RemoteData } from '../../../../../core/data/remote-data'; import { RemoteData } from '../../../../../core/data/remote-data';
import { getAllSucceededRemoteData, getRemoteDataPayload } from '../../../../../core/shared/operators'; import {
getAllSucceededRemoteData,
getRemoteDataPayload
} from '../../../../../core/shared/operators';
import { take } from 'rxjs/operators'; import { take } from 'rxjs/operators';
import { WorkflowItemSearchResult } from '../../../../../shared/object-collection/shared/workflow-item-search-result.model'; import { WorkflowItemSearchResult } from '../../../../../shared/object-collection/shared/workflow-item-search-result.model';
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
@listableObjectComponent(WorkflowItemSearchResult, ViewMode.GridElement, Context.AdminWorkflowSearch) @listableObjectComponent(WorkflowItemSearchResult, ViewMode.GridElement, Context.AdminWorkflowSearch)
@Component({ @Component({
@@ -51,6 +58,7 @@ export class WorkflowItemSearchResultAdminWorkflowGridElementComponent extends S
private componentFactoryResolver: ComponentFactoryResolver, private componentFactoryResolver: ComponentFactoryResolver,
private linkService: LinkService, private linkService: LinkService,
protected truncatableService: TruncatableService, protected truncatableService: TruncatableService,
private themeService: ThemeService,
protected bitstreamDataService: BitstreamDataService protected bitstreamDataService: BitstreamDataService
) { ) {
super(truncatableService, bitstreamDataService); super(truncatableService, bitstreamDataService);
@@ -92,7 +100,7 @@ export class WorkflowItemSearchResultAdminWorkflowGridElementComponent extends S
* @returns {GenericConstructor<Component>} * @returns {GenericConstructor<Component>}
*/ */
private getComponent(item: Item): GenericConstructor<Component> { private getComponent(item: Item): GenericConstructor<Component> {
return getListableObjectComponent(item.getRenderTypes(), ViewMode.GridElement, undefined); return getListableObjectComponent(item.getRenderTypes(), ViewMode.GridElement, undefined, this.themeService.getThemeName());
} }
} }

View File

@@ -2,7 +2,7 @@
::ng-deep { ::ng-deep {
.switch { .switch {
position: absolute; position: absolute;
top: $spacer*2.5; top: calc(var(--bs-spacer) * 2.5);
} }
} }
} }

View File

@@ -6,17 +6,21 @@ describe('CollectionPageResolver', () => {
describe('resolve', () => { describe('resolve', () => {
let resolver: CollectionPageResolver; let resolver: CollectionPageResolver;
let collectionService: any; let collectionService: any;
let store: any;
const uuid = '1234-65487-12354-1235'; const uuid = '1234-65487-12354-1235';
beforeEach(() => { beforeEach(() => {
collectionService = { collectionService = {
findById: (id: string) => createSuccessfulRemoteDataObject$({ id }) findById: (id: string) => createSuccessfulRemoteDataObject$({ id })
}; };
resolver = new CollectionPageResolver(collectionService); store = jasmine.createSpyObj('store', {
dispatch: {},
});
resolver = new CollectionPageResolver(collectionService, store);
}); });
it('should resolve a collection with the correct id', (done) => { it('should resolve a collection with the correct id', (done) => {
resolver.resolve({ params: { id: uuid } } as any, undefined) resolver.resolve({ params: { id: uuid } } as any, { url: 'current-url' } as any)
.pipe(first()) .pipe(first())
.subscribe( .subscribe(
(resolved) => { (resolved) => {

View File

@@ -4,15 +4,31 @@ import { Collection } from '../core/shared/collection.model';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { CollectionDataService } from '../core/data/collection-data.service'; import { CollectionDataService } from '../core/data/collection-data.service';
import { RemoteData } from '../core/data/remote-data'; import { RemoteData } from '../core/data/remote-data';
import { followLink } from '../shared/utils/follow-link-config.model'; import { followLink, FollowLinkConfig } from '../shared/utils/follow-link-config.model';
import { getFirstCompletedRemoteData } from '../core/shared/operators'; import { getFirstCompletedRemoteData } from '../core/shared/operators';
import { Store } from '@ngrx/store';
import { ResolvedAction } from '../core/resolving/resolver.actions';
/**
* The self links defined in this list are expected to be requested somewhere in the near future
* Requesting them as embeds will limit the number of requests
*/
export const COLLECTION_PAGE_LINKS_TO_FOLLOW: FollowLinkConfig<Collection>[] = [
followLink('parentCommunity', undefined, true, true, true,
followLink('parentCommunity')
),
followLink('logo')
];
/** /**
* This class represents a resolver that requests a specific collection before the route is activated * This class represents a resolver that requests a specific collection before the route is activated
*/ */
@Injectable() @Injectable()
export class CollectionPageResolver implements Resolve<RemoteData<Collection>> { export class CollectionPageResolver implements Resolve<RemoteData<Collection>> {
constructor(private collectionService: CollectionDataService) { constructor(
private collectionService: CollectionDataService,
private store: Store<any>
) {
} }
/** /**
@@ -23,8 +39,19 @@ export class CollectionPageResolver implements Resolve<RemoteData<Collection>> {
* or an error if something went wrong * or an error if something went wrong
*/ */
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<RemoteData<Collection>> { resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<RemoteData<Collection>> {
return this.collectionService.findById(route.params.id, true, false, followLink('logo')).pipe( const collectionRD$ = this.collectionService.findById(
route.params.id,
true,
false,
...COLLECTION_PAGE_LINKS_TO_FOLLOW
).pipe(
getFirstCompletedRemoteData() getFirstCompletedRemoteData()
); );
collectionRD$.subscribe((collectionRD: RemoteData<Collection>) => {
this.store.dispatch(new ResolvedAction(state.url, collectionRD.payload));
});
return collectionRD$;
} }
} }

View File

@@ -6,17 +6,21 @@ describe('CommunityPageResolver', () => {
describe('resolve', () => { describe('resolve', () => {
let resolver: CommunityPageResolver; let resolver: CommunityPageResolver;
let communityService: any; let communityService: any;
let store: any;
const uuid = '1234-65487-12354-1235'; const uuid = '1234-65487-12354-1235';
beforeEach(() => { beforeEach(() => {
communityService = { communityService = {
findById: (id: string) => createSuccessfulRemoteDataObject$({ id }) findById: (id: string) => createSuccessfulRemoteDataObject$({ id })
}; };
resolver = new CommunityPageResolver(communityService); store = jasmine.createSpyObj('store', {
dispatch: {},
});
resolver = new CommunityPageResolver(communityService, store);
}); });
it('should resolve a community with the correct id', (done) => { it('should resolve a community with the correct id', (done) => {
resolver.resolve({ params: { id: uuid } } as any, undefined) resolver.resolve({ params: { id: uuid } } as any, { url: 'current-url' } as any)
.pipe(first()) .pipe(first())
.subscribe( .subscribe(
(resolved) => { (resolved) => {

View File

@@ -4,15 +4,31 @@ import { Observable } from 'rxjs';
import { RemoteData } from '../core/data/remote-data'; import { RemoteData } from '../core/data/remote-data';
import { Community } from '../core/shared/community.model'; import { Community } from '../core/shared/community.model';
import { CommunityDataService } from '../core/data/community-data.service'; import { CommunityDataService } from '../core/data/community-data.service';
import { followLink } from '../shared/utils/follow-link-config.model'; import { followLink, FollowLinkConfig } from '../shared/utils/follow-link-config.model';
import { getFirstCompletedRemoteData } from '../core/shared/operators'; import { getFirstCompletedRemoteData } from '../core/shared/operators';
import { ResolvedAction } from '../core/resolving/resolver.actions';
import { Store } from '@ngrx/store';
/**
* The self links defined in this list are expected to be requested somewhere in the near future
* Requesting them as embeds will limit the number of requests
*/
export const COMMUNITY_PAGE_LINKS_TO_FOLLOW: FollowLinkConfig<Community>[] = [
followLink('logo'),
followLink('subcommunities'),
followLink('collections'),
followLink('parentCommunity')
];
/** /**
* This class represents a resolver that requests a specific community before the route is activated * This class represents a resolver that requests a specific community before the route is activated
*/ */
@Injectable() @Injectable()
export class CommunityPageResolver implements Resolve<RemoteData<Community>> { export class CommunityPageResolver implements Resolve<RemoteData<Community>> {
constructor(private communityService: CommunityDataService) { constructor(
private communityService: CommunityDataService,
private store: Store<any>
) {
} }
/** /**
@@ -23,15 +39,19 @@ export class CommunityPageResolver implements Resolve<RemoteData<Community>> {
* or an error if something went wrong * or an error if something went wrong
*/ */
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<RemoteData<Community>> { resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<RemoteData<Community>> {
return this.communityService.findById( const communityRD$ = this.communityService.findById(
route.params.id, route.params.id,
true, true,
false, false,
followLink('logo'), ...COMMUNITY_PAGE_LINKS_TO_FOLLOW
followLink('subcommunities'),
followLink('collections')
).pipe( ).pipe(
getFirstCompletedRemoteData(), getFirstCompletedRemoteData(),
); );
communityRD$.subscribe((communityRD: RemoteData<Community>) => {
this.store.dispatch(new ResolvedAction(state.url, communityRD.payload));
});
return communityRD$;
} }
} }

View File

@@ -18,11 +18,14 @@ import { PageInfo } from '../../core/shared/page-info.model';
import { HostWindowService } from '../../shared/host-window.service'; import { HostWindowService } from '../../shared/host-window.service';
import { HostWindowServiceStub } from '../../shared/testing/host-window-service.stub'; import { HostWindowServiceStub } from '../../shared/testing/host-window-service.stub';
import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service'; import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service';
import { getMockThemeService } from '../../shared/mocks/theme-service.mock';
import { ThemeService } from '../../shared/theme-support/theme.service';
describe('CommunityPageSubCollectionList Component', () => { describe('CommunityPageSubCollectionList Component', () => {
let comp: CommunityPageSubCollectionListComponent; let comp: CommunityPageSubCollectionListComponent;
let fixture: ComponentFixture<CommunityPageSubCollectionListComponent>; let fixture: ComponentFixture<CommunityPageSubCollectionListComponent>;
let collectionDataServiceStub: any; let collectionDataServiceStub: any;
let themeService;
let subCollList = []; let subCollList = [];
const collections = [Object.assign(new Community(), { const collections = [Object.assign(new Community(), {
@@ -110,6 +113,8 @@ describe('CommunityPageSubCollectionList Component', () => {
} }
}; };
themeService = getMockThemeService();
beforeEach(waitForAsync(() => { beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
@@ -124,6 +129,7 @@ describe('CommunityPageSubCollectionList Component', () => {
{ provide: CollectionDataService, useValue: collectionDataServiceStub }, { provide: CollectionDataService, useValue: collectionDataServiceStub },
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) }, { provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
{ provide: SelectableListService, useValue: {} }, { provide: SelectableListService, useValue: {} },
{ provide: ThemeService, useValue: themeService },
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).compileComponents(); }).compileComponents();

View File

@@ -18,11 +18,14 @@ import { HostWindowService } from '../../shared/host-window.service';
import { HostWindowServiceStub } from '../../shared/testing/host-window-service.stub'; import { HostWindowServiceStub } from '../../shared/testing/host-window-service.stub';
import { CommunityDataService } from '../../core/data/community-data.service'; import { CommunityDataService } from '../../core/data/community-data.service';
import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service'; import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service';
import { getMockThemeService } from '../../shared/mocks/theme-service.mock';
import { ThemeService } from '../../shared/theme-support/theme.service';
describe('CommunityPageSubCommunityListComponent Component', () => { describe('CommunityPageSubCommunityListComponent Component', () => {
let comp: CommunityPageSubCommunityListComponent; let comp: CommunityPageSubCommunityListComponent;
let fixture: ComponentFixture<CommunityPageSubCommunityListComponent>; let fixture: ComponentFixture<CommunityPageSubCommunityListComponent>;
let communityDataServiceStub: any; let communityDataServiceStub: any;
let themeService;
let subCommList = []; let subCommList = [];
const subcommunities = [Object.assign(new Community(), { const subcommunities = [Object.assign(new Community(), {
@@ -111,6 +114,8 @@ describe('CommunityPageSubCommunityListComponent Component', () => {
} }
}; };
themeService = getMockThemeService();
beforeEach(waitForAsync(() => { beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
@@ -125,6 +130,7 @@ describe('CommunityPageSubCommunityListComponent Component', () => {
{ provide: CommunityDataService, useValue: communityDataServiceStub }, { provide: CommunityDataService, useValue: communityDataServiceStub },
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) }, { provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
{ provide: SelectableListService, useValue: {} }, { provide: SelectableListService, useValue: {} },
{ provide: ThemeService, useValue: themeService },
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).compileComponents(); }).compileComponents();

View File

@@ -1,7 +1,7 @@
:host { :host {
display: block; display: block;
margin-top: -$content-spacing; margin-top: calc(-1 * var(--ds-content-spacing));
margin-bottom: -$content-spacing; margin-bottom: calc(-1 * var(--ds-content-spacing));
} }
.display-3 { .display-3 {
@@ -11,4 +11,4 @@
.dspace-logo { .dspace-logo {
height: 110px; height: 110px;
width: 110px; width: 110px;
} }

View File

@@ -1,4 +1,4 @@
import { Component } from '@angular/core'; import { Component, } from '@angular/core';
@Component({ @Component({
selector: 'ds-home-news', selector: 'ds-home-news',
@@ -10,5 +10,4 @@ import { Component } from '@angular/core';
* Component to render the news section on the home page * Component to render the news section on the home page
*/ */
export class HomeNewsComponent { export class HomeNewsComponent {
} }

View File

@@ -0,0 +1,27 @@
import { Component } from '@angular/core';
import { ThemedComponent } from '../../shared/theme-support/themed.component';
import { HomeNewsComponent } from './home-news.component';
@Component({
selector: 'ds-themed-home-news',
styleUrls: [],
templateUrl: '../../shared/theme-support/themed.component.html',
})
/**
* Component to render the news section on the home page
*/
export class ThemedHomeNewsComponent extends ThemedComponent<HomeNewsComponent> {
protected getComponentName(): string {
return 'HomeNewsComponent';
}
protected importThemedComponent(themeName: string): Promise<any> {
return import(`../../../themes/${themeName}/app/+home-page/home-news/home-news.component`);
}
protected importUnthemedComponent(): Promise<any> {
return import(`./home-news.component`);
}
}

View File

@@ -1,17 +1,17 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { HomePageComponent } from './home-page.component';
import { HomePageResolver } from './home-page.resolver'; import { HomePageResolver } from './home-page.resolver';
import { MenuItemType } from '../shared/menu/initial-menus-state'; import { MenuItemType } from '../shared/menu/initial-menus-state';
import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model'; import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model';
import { ThemedHomePageComponent } from './themed-home-page.component';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ {
path: '', path: '',
component: HomePageComponent, component: ThemedHomePageComponent,
pathMatch: 'full', pathMatch: 'full',
data: { data: {
title: 'home.title', title: 'home.title',

View File

@@ -1,4 +1,4 @@
<ds-home-news></ds-home-news> <ds-themed-home-news></ds-themed-home-news>
<div class="container"> <div class="container">
<ng-container *ngIf="(site$ | async) as site"> <ng-container *ngIf="(site$ | async) as site">
<ds-view-tracker [object]="site"></ds-view-tracker> <ds-view-tracker [object]="site"></ds-view-tracker>

View File

@@ -10,7 +10,7 @@ import { Site } from '../core/shared/site.model';
templateUrl: './home-page.component.html' templateUrl: './home-page.component.html'
}) })
export class HomePageComponent implements OnInit { export class HomePageComponent implements OnInit {
testInput = 'Bingo!';
site$: Observable<Site>; site$: Observable<Site>;
constructor( constructor(
@@ -23,4 +23,8 @@ export class HomePageComponent implements OnInit {
map((data) => data.site as Site), map((data) => data.site as Site),
); );
} }
onOutput(event: string) {
console.log('testOutput:', event);
}
} }

View File

@@ -7,6 +7,16 @@ import { HomePageRoutingModule } from './home-page-routing.module';
import { HomePageComponent } from './home-page.component'; import { HomePageComponent } from './home-page.component';
import { TopLevelCommunityListComponent } from './top-level-community-list/top-level-community-list.component'; import { TopLevelCommunityListComponent } from './top-level-community-list/top-level-community-list.component';
import { StatisticsModule } from '../statistics/statistics.module'; import { StatisticsModule } from '../statistics/statistics.module';
import { ThemedHomeNewsComponent } from './home-news/themed-home-news.component';
import { ThemedHomePageComponent } from './themed-home-page.component';
const DECLARATIONS = [
HomePageComponent,
ThemedHomePageComponent,
TopLevelCommunityListComponent,
ThemedHomeNewsComponent,
HomeNewsComponent,
];
@NgModule({ @NgModule({
imports: [ imports: [
@@ -16,10 +26,11 @@ import { StatisticsModule } from '../statistics/statistics.module';
StatisticsModule.forRoot() StatisticsModule.forRoot()
], ],
declarations: [ declarations: [
HomePageComponent, ...DECLARATIONS,
TopLevelCommunityListComponent, ],
HomeNewsComponent, exports: [
] ...DECLARATIONS,
],
}) })
export class HomePageModule { export class HomePageModule {

View File

@@ -0,0 +1,26 @@
import { ThemedComponent } from '../shared/theme-support/themed.component';
import { HomePageComponent } from './home-page.component';
import { Component } from '@angular/core';
@Component({
selector: 'ds-themed-home-page',
styleUrls: [],
templateUrl: '../shared/theme-support/themed.component.html',
})
export class ThemedHomePageComponent extends ThemedComponent<HomePageComponent> {
protected inAndOutputNames: (keyof HomePageComponent & keyof this)[];
protected getComponentName(): string {
return 'HomePageComponent';
}
protected importThemedComponent(themeName: string): Promise<any> {
return import(`../../themes/${themeName}/app/+home-page/home-page.component`);
}
protected importUnthemedComponent(): Promise<any> {
return import(`./home-page.component`);
}
}

View File

@@ -18,11 +18,14 @@ import { HostWindowService } from '../../shared/host-window.service';
import { HostWindowServiceStub } from '../../shared/testing/host-window-service.stub'; import { HostWindowServiceStub } from '../../shared/testing/host-window-service.stub';
import { CommunityDataService } from '../../core/data/community-data.service'; import { CommunityDataService } from '../../core/data/community-data.service';
import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service'; import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service';
import { getMockThemeService } from '../../shared/mocks/theme-service.mock';
import { ThemeService } from '../../shared/theme-support/theme.service';
describe('TopLevelCommunityList Component', () => { describe('TopLevelCommunityList Component', () => {
let comp: TopLevelCommunityListComponent; let comp: TopLevelCommunityListComponent;
let fixture: ComponentFixture<TopLevelCommunityListComponent>; let fixture: ComponentFixture<TopLevelCommunityListComponent>;
let communityDataServiceStub: any; let communityDataServiceStub: any;
let themeService;
const topCommList = [Object.assign(new Community(), { const topCommList = [Object.assign(new Community(), {
id: '123456789-1', id: '123456789-1',
@@ -101,6 +104,8 @@ describe('TopLevelCommunityList Component', () => {
} }
}; };
themeService = getMockThemeService();
beforeEach(waitForAsync(() => { beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
@@ -115,6 +120,7 @@ describe('TopLevelCommunityList Component', () => {
{ provide: CommunityDataService, useValue: communityDataServiceStub }, { provide: CommunityDataService, useValue: communityDataServiceStub },
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) }, { provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
{ provide: SelectableListService, useValue: {} }, { provide: SelectableListService, useValue: {} },
{ provide: ThemeService, useValue: themeService },
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).compileComponents(); }).compileComponents();

View File

@@ -1,3 +1,3 @@
.btn { .btn {
min-width: $edit-item-button-min-width; min-width: var(--ds-edit-item-button-min-width);
} }

View File

@@ -1,19 +1,19 @@
.header-row { .header-row {
color: $table-dark-color; color: var(--bs-table-dark-color);
background-color: $table-dark-bg; background-color: var(--bs-table-dark-bg);
border-color: $table-dark-border-color; border-color: var(--bs-table-dark-border-color);
} }
.bundle-row { .bundle-row {
color: $table-head-color; color: var(--bs-table-head-color);
background-color: $table-head-bg; background-color: var(--bs-table-head-bg);
border-color: $table-border-color; border-color: var(--bs-table-border-color);
} }
.row-element { .row-element {
padding: 12px; padding: 12px;
padding: 0.75em; padding: 0.75em;
border-bottom: $table-border-width solid $table-border-color; border-bottom: var(--bs-table-border-width) solid var(--bs-table-border-color);
} }
.drag-handle { .drag-handle {

View File

@@ -1,13 +1,13 @@
.btn[disabled] { .btn[disabled] {
color: $gray-600; color: var(--bs-gray-600);
border-color: $gray-600; border-color: var(--bs-gray-600);
z-index: 0; // prevent border colors jumping on hover z-index: 0; // prevent border colors jumping on hover
} }
.metadata-field { .metadata-field {
width: $edit-item-metadata-field-width; width: var(--ds-edit-item-metadata-field-width);
} }
.language-field { .language-field {
width: $edit-item-language-field-width; width: var(--ds-edit-item-language-field-width);
} }

View File

@@ -1,20 +1,20 @@
.button-row { .button-row {
.btn { .btn {
margin-right: 0.5 * $spacer; margin-right: calc(0.5 * var(--bs-spacer));
&:last-child { &:last-child {
margin-right: 0; margin-right: 0;
} }
@media screen and (min-width: map-get($grid-breakpoints, sm)) { @media screen and (min-width: var(--ds-grid-breakpoints-sm)) {
min-width: $edit-item-button-min-width; min-width: var(--ds-edit-item-button-min-width);
} }
} }
&.top .btn { &.top .btn {
margin-top: $spacer/2; margin-top: calc(var(--bs-spacer) / 2);
margin-bottom: $spacer/2; margin-bottom: calc(var(--bs-spacer) / 2);
} }
} }

View File

@@ -1,10 +1,10 @@
.relationship-row:not(.alert) { .relationship-row:not(.alert) {
padding: $alert-padding-y 0; padding: var(--bs-alert-padding-y) 0;
} }
.relationship-row.alert { .relationship-row.alert {
margin-left: -$alert-padding-x; margin-left: calc(-1 * var(--bs-alert-padding-x));
margin-right: -$alert-padding-x; margin-right: calc(-1 * var(--bs-alert-padding-x));
margin-top: -1px; margin-top: -1px;
margin-bottom: -1px; margin-bottom: -1px;
} }

View File

@@ -1,6 +1,6 @@
.btn[disabled] { .btn[disabled] {
color: $gray-600; color: var(--bs-gray-600);
border-color: $gray-600; border-color: var(--bs-gray-600);
z-index: 0; // prevent border colors jumping on hover z-index: 0; // prevent border colors jumping on hover
} }

View File

@@ -1,19 +1,19 @@
.button-row { .button-row {
.btn { .btn {
margin-right: 0.5 * $spacer; margin-right: calc(0.5 * var(--bs-spacer));
&:last-child { &:last-child {
margin-right: 0; margin-right: 0;
} }
@media screen and (min-width: map-get($grid-breakpoints, sm)) { @media screen and (min-width: var(--ds-grid-breakpoints-sm)) {
min-width: $edit-item-button-min-width; min-width: var(--ds-edit-item-button-min-width);
} }
} }
&.top .btn { &.top .btn {
margin-top: $spacer/2; margin-top: calc(var(--bs-spacer) / 2);
margin-bottom: $spacer/2; margin-bottom: calc(var(--bs-spacer) / 2);
} }

View File

@@ -1,5 +1,5 @@
@media screen and (min-width: map-get($grid-breakpoints, md)) { @media screen and (min-width: var(--ds-grid-breakpoints-md)) {
dt { dt {
text-align: right; text-align: right;
} }
} }

View File

@@ -32,6 +32,26 @@ const ENTRY_COMPONENTS = [
UntypedItemComponent UntypedItemComponent
]; ];
const DECLARATIONS = [
ItemPageComponent,
FullItemPageComponent,
MetadataUriValuesComponent,
ItemPageAuthorFieldComponent,
ItemPageDateFieldComponent,
ItemPageAbstractFieldComponent,
ItemPageUriFieldComponent,
ItemPageTitleFieldComponent,
ItemPageFieldComponent,
FileSectionComponent,
CollectionsComponent,
FullFileSectionComponent,
PublicationComponent,
UntypedItemComponent,
ItemComponent,
UploadBitstreamComponent,
AbstractIncrementalListComponent,
];
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, CommonModule,
@@ -43,23 +63,10 @@ const ENTRY_COMPONENTS = [
ResearchEntitiesModule.withEntryComponents() ResearchEntitiesModule.withEntryComponents()
], ],
declarations: [ declarations: [
ItemPageComponent, ...DECLARATIONS
FullItemPageComponent, ],
MetadataUriValuesComponent, exports: [
ItemPageAuthorFieldComponent, ...DECLARATIONS
ItemPageDateFieldComponent,
ItemPageAbstractFieldComponent,
ItemPageUriFieldComponent,
ItemPageTitleFieldComponent,
ItemPageFieldComponent,
FileSectionComponent,
CollectionsComponent,
FullFileSectionComponent,
PublicationComponent,
UntypedItemComponent,
ItemComponent,
UploadBitstreamComponent,
AbstractIncrementalListComponent,
] ]
}) })
export class ItemPageModule { export class ItemPageModule {

View File

@@ -7,9 +7,18 @@ import { Item } from '../core/shared/item.model';
import { followLink, FollowLinkConfig } from '../shared/utils/follow-link-config.model'; import { followLink, FollowLinkConfig } from '../shared/utils/follow-link-config.model';
import { FindListOptions } from '../core/data/request.models'; import { FindListOptions } from '../core/data/request.models';
import { getFirstCompletedRemoteData } from '../core/shared/operators'; import { getFirstCompletedRemoteData } from '../core/shared/operators';
import { Store } from '@ngrx/store';
import { ResolvedAction } from '../core/resolving/resolver.actions';
/**
* The self links defined in this list are expected to be requested somewhere in the near future
* Requesting them as embeds will limit the number of requests
*/
export const ITEM_PAGE_LINKS_TO_FOLLOW: FollowLinkConfig<Item>[] = [ export const ITEM_PAGE_LINKS_TO_FOLLOW: FollowLinkConfig<Item>[] = [
followLink('owningCollection'), followLink('owningCollection', undefined, true, true, true,
followLink('parentCommunity', undefined, true, true, true,
followLink('parentCommunity'))
),
followLink('bundles', new FindListOptions(), true, true, true, followLink('bitstreams')), followLink('bundles', new FindListOptions(), true, true, true, followLink('bitstreams')),
followLink('relationships'), followLink('relationships'),
followLink('version', undefined, true, true, true, followLink('versionhistory')), followLink('version', undefined, true, true, true, followLink('versionhistory')),
@@ -20,7 +29,10 @@ export const ITEM_PAGE_LINKS_TO_FOLLOW: FollowLinkConfig<Item>[] = [
*/ */
@Injectable() @Injectable()
export class ItemPageResolver implements Resolve<RemoteData<Item>> { export class ItemPageResolver implements Resolve<RemoteData<Item>> {
constructor(private itemService: ItemDataService) { constructor(
private itemService: ItemDataService,
private store: Store<any>
) {
} }
/** /**
@@ -31,12 +43,18 @@ export class ItemPageResolver implements Resolve<RemoteData<Item>> {
* or an error if something went wrong * or an error if something went wrong
*/ */
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<RemoteData<Item>> { resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<RemoteData<Item>> {
return this.itemService.findById(route.params.id, const itemRD$ = this.itemService.findById(route.params.id,
true, true,
false, false,
...ITEM_PAGE_LINKS_TO_FOLLOW ...ITEM_PAGE_LINKS_TO_FOLLOW
).pipe( ).pipe(
getFirstCompletedRemoteData(), getFirstCompletedRemoteData(),
); );
itemRD$.subscribe((itemRD: RemoteData<Item>) => {
this.store.dispatch(new ResolvedAction(state.url, itemRD.payload));
});
return itemRD$;
} }
} }

View File

@@ -1,4 +1,4 @@
.login-logo { .login-logo {
height: $login-logo-height; height: var(--ds-login-logo-height);
width: $login-logo-width; width: var(--ds-login-logo-width);
} }

View File

@@ -6,5 +6,5 @@
} }
::ng-deep .search-controls { ::ng-deep .search-controls {
margin-bottom: $spacer; margin-bottom: var(--bs-spacer);
} }

View File

@@ -5,6 +5,7 @@ import { Item } from './core/shared/item.model';
import { getCommunityPageRoute } from './+community-page/community-page-routing-paths'; import { getCommunityPageRoute } from './+community-page/community-page-routing-paths';
import { getCollectionPageRoute } from './+collection-page/collection-page-routing-paths'; import { getCollectionPageRoute } from './+collection-page/collection-page-routing-paths';
import { getItemPageRoute } from './+item-page/item-page-routing-paths'; import { getItemPageRoute } from './+item-page/item-page-routing-paths';
import { hasValue } from './shared/empty.util';
export const BITSTREAM_MODULE_PATH = 'bitstreams'; export const BITSTREAM_MODULE_PATH = 'bitstreams';
@@ -45,13 +46,15 @@ export function getWorkflowItemModuleRoute() {
} }
export function getDSORoute(dso: DSpaceObject): string { export function getDSORoute(dso: DSpaceObject): string {
switch ((dso as any).type) { if (hasValue(dso)) {
case Community.type.value: switch ((dso as any).type) {
return getCommunityPageRoute(dso.uuid); case Community.type.value:
case Collection.type.value: return getCommunityPageRoute(dso.uuid);
return getCollectionPageRoute(dso.uuid); case Collection.type.value:
case Item.type.value: return getCollectionPageRoute(dso.uuid);
return getItemPageRoute(dso.uuid); case Item.type.value:
return getItemPageRoute(dso.uuid);
}
} }
} }

View File

@@ -1,30 +1 @@
<div class="outer-wrapper" *ngIf="isNotAuthBlocking$ | async; else authLoader"> <ds-themed-root [isNotAuthBlocking]="isNotAuthBlocking$ | async" [isLoading]="isLoading$ | async"></ds-themed-root>
<ds-admin-sidebar></ds-admin-sidebar>
<div class="inner-wrapper" [@slideSidebarPadding]="{
value: (!(sidebarVisible | async) ? 'hidden' : (slideSidebarOver | async) ? 'shown' : 'expanded'),
params: {collapsedSidebarWidth: (collapsedSidebarWidth | async), totalSidebarWidth: (totalSidebarWidth | async)}
}">
<ds-header-navbar-wrapper></ds-header-navbar-wrapper>
<ds-notifications-board
[options]="notificationOptions">
</ds-notifications-board>
<main class="main-content">
<div class="container">
<ds-breadcrumbs></ds-breadcrumbs>
</div>
<div class="container" *ngIf="isLoading$ | async">
<ds-loading message="{{'loading.default' | translate}}"></ds-loading>
</div>
<router-outlet></router-outlet>
</main>
<ds-footer></ds-footer>
</div>
</div>
<ng-template #authLoader>
<div class="text-center ds-full-screen-loader d-flex align-items-center flex-column justify-content-center">
<ds-loading [showMessage]="false"></ds-loading>
</div>
</ng-template>

View File

@@ -1,53 +0,0 @@
@import '../styles/helpers/font_awesome_imports.scss';
@import '../../node_modules/bootstrap/scss/bootstrap.scss';
@import '../../node_modules/nouislider/distribute/nouislider.min';
html {
position: relative;
min-height: 100%;
}
body {
overflow-x: hidden;
}
// Sticky Footer
.outer-wrapper {
display: flex;
margin: 0;
}
.inner-wrapper {
flex: 1 1 auto;
flex-flow: column nowrap;
display: flex;
min-height: 100vh;
flex-direction: column;
width: 100%;
position: relative;
}
.main-content {
z-index: $main-z-index;
flex: 1 1 100%;
margin-top: $content-spacing;
margin-bottom: $content-spacing;
}
.alert.hide {
padding: 0;
margin: 0;
}
ds-header-navbar-wrapper {
z-index: $nav-z-index;
}
ds-admin-sidebar {
position: fixed;
z-index: $sidebar-z-index;
}
.ds-full-screen-loader {
height: 100vh;
}

View File

@@ -5,12 +5,12 @@ import {
Component, Component,
HostListener, HostListener,
Inject, Inject,
OnInit, Optional, OnInit,
ViewEncapsulation Optional,
} from '@angular/core'; } from '@angular/core';
import { NavigationCancel, NavigationEnd, NavigationStart, Router } from '@angular/router'; import { NavigationCancel, NavigationEnd, NavigationStart, Router } from '@angular/router';
import { BehaviorSubject, combineLatest as combineLatestObservable, Observable, of } from 'rxjs'; import { BehaviorSubject, Observable, of } from 'rxjs';
import { select, Store } from '@ngrx/store'; import { select, Store } from '@ngrx/store';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { Angulartics2GoogleAnalytics } from 'angulartics2/ga'; import { Angulartics2GoogleAnalytics } from 'angulartics2/ga';
@@ -23,25 +23,25 @@ import { isAuthenticationBlocking } from './core/auth/selectors';
import { AuthService } from './core/auth/auth.service'; import { AuthService } from './core/auth/auth.service';
import { CSSVariableService } from './shared/sass-helper/sass-helper.service'; import { CSSVariableService } from './shared/sass-helper/sass-helper.service';
import { MenuService } from './shared/menu/menu.service'; import { MenuService } from './shared/menu/menu.service';
import { MenuID } from './shared/menu/initial-menus-state';
import { slideSidebarPadding } from './shared/animations/slide';
import { HostWindowService } from './shared/host-window.service'; import { HostWindowService } from './shared/host-window.service';
import { Theme } from '../config/theme.inferface'; import { ThemeConfig } from '../config/theme.model';
import { Angulartics2DSpace } from './statistics/angulartics/dspace-provider'; import { Angulartics2DSpace } from './statistics/angulartics/dspace-provider';
import { environment } from '../environments/environment'; import { environment } from '../environments/environment';
import { models } from './core/core.module'; import { models } from './core/core.module';
import { LocaleService } from './core/locale/locale.service'; import { LocaleService } from './core/locale/locale.service';
import { hasValue } from './shared/empty.util'; import { hasValue, isNotEmpty } from './shared/empty.util';
import { KlaroService } from './shared/cookies/klaro.service'; import { KlaroService } from './shared/cookies/klaro.service';
import {GoogleAnalyticsService} from './statistics/google-analytics.service'; import { GoogleAnalyticsService } from './statistics/google-analytics.service';
import { DOCUMENT } from '@angular/common';
import { ThemeService } from './shared/theme-support/theme.service';
import { BASE_THEME_NAME } from './shared/theme-support/theme.constants';
import { DEFAULT_THEME_CONFIG } from './shared/theme-support/theme.effects';
@Component({ @Component({
selector: 'ds-app', selector: 'ds-app',
templateUrl: './app.component.html', templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'], styleUrls: ['./app.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
animations: [slideSidebarPadding]
}) })
export class AppComponent implements OnInit, AfterViewInit { export class AppComponent implements OnInit, AfterViewInit {
isLoading$: BehaviorSubject<boolean> = new BehaviorSubject(true); isLoading$: BehaviorSubject<boolean> = new BehaviorSubject(true);
@@ -49,7 +49,7 @@ export class AppComponent implements OnInit, AfterViewInit {
slideSidebarOver: Observable<boolean>; slideSidebarOver: Observable<boolean>;
collapsedSidebarWidth: Observable<string>; collapsedSidebarWidth: Observable<string>;
totalSidebarWidth: Observable<string>; totalSidebarWidth: Observable<string>;
theme: Observable<Theme> = of({} as any); theme: Observable<ThemeConfig> = of({} as any);
notificationOptions = environment.notifications; notificationOptions = environment.notifications;
models; models;
@@ -60,6 +60,8 @@ export class AppComponent implements OnInit, AfterViewInit {
constructor( constructor(
@Inject(NativeWindowService) private _window: NativeWindowRef, @Inject(NativeWindowService) private _window: NativeWindowRef,
@Inject(DOCUMENT) private document: any,
private themeService: ThemeService,
private translate: TranslateService, private translate: TranslateService,
private store: Store<HostWindowState>, private store: Store<HostWindowState>,
private metadata: MetadataService, private metadata: MetadataService,
@@ -77,6 +79,17 @@ export class AppComponent implements OnInit, AfterViewInit {
/* Use models object so all decorators are actually called */ /* Use models object so all decorators are actually called */
this.models = models; this.models = models;
this.themeService.getThemeName$().subscribe((themeName: string) => {
if (hasValue(themeName)) {
this.setThemeCss(themeName);
} else if (hasValue(DEFAULT_THEME_CONFIG)) {
this.setThemeCss(DEFAULT_THEME_CONFIG.name);
} else {
this.setThemeCss(BASE_THEME_NAME);
}
});
// Load all the languages that are defined as active from the config file // Load all the languages that are defined as active from the config file
translate.addLangs(environment.languages.filter((LangConfig) => LangConfig.active === true).map((a) => a.code)); translate.addLangs(environment.languages.filter((LangConfig) => LangConfig.active === true).map((a) => a.code));
@@ -116,17 +129,6 @@ export class AppComponent implements OnInit, AfterViewInit {
const color: string = environment.production ? 'red' : 'green'; const color: string = environment.production ? 'red' : 'green';
console.info(`Environment: %c${env}`, `color: ${color}; font-weight: bold;`); console.info(`Environment: %c${env}`, `color: ${color}; font-weight: bold;`);
this.dispatchWindowSize(this._window.nativeWindow.innerWidth, this._window.nativeWindow.innerHeight); this.dispatchWindowSize(this._window.nativeWindow.innerWidth, this._window.nativeWindow.innerHeight);
this.sidebarVisible = this.menuService.isMenuVisible(MenuID.ADMIN);
this.collapsedSidebarWidth = this.cssService.getVariable('collapsedSidebarWidth');
this.totalSidebarWidth = this.cssService.getVariable('totalSidebarWidth');
const sidebarCollapsed = this.menuService.isMenuCollapsed(MenuID.ADMIN);
this.slideSidebarOver = combineLatestObservable(sidebarCollapsed, this.windowService.isXsOrSm())
.pipe(
map(([collapsed, mobile]) => collapsed || mobile)
);
} }
private storeCSSVariables() { private storeCSSVariables() {
@@ -177,4 +179,34 @@ export class AppComponent implements OnInit, AfterViewInit {
this.cookiesService.initialize(); this.cookiesService.initialize();
} }
} }
/**
* Update the theme css file in <head>
*
* @param themeName The name of the new theme
* @private
*/
private setThemeCss(themeName: string): void {
const head = this.document.getElementsByTagName('head')[0];
// Array.from to ensure we end up with an array, not an HTMLCollection, which would be
// automatically updated if we add nodes later
const currentThemeLinks = Array.from(this.document.getElementsByClassName('theme-css'));
const link = this.document.createElement('link');
link.setAttribute('rel', 'stylesheet');
link.setAttribute('type', 'text/css');
link.setAttribute('class', 'theme-css');
link.setAttribute('href', `/${encodeURIComponent(themeName)}-theme.css`);
// wait for the new css to download before removing the old one to prevent a
// flash of unstyled content
link.onload = () => {
if (isNotEmpty(currentThemeLinks)) {
currentThemeLinks.forEach((currentThemeLink: any) => {
if (hasValue(currentThemeLink)) {
currentThemeLink.remove();
}
});
}
};
head.appendChild(link);
}
} }

View File

@@ -3,11 +3,13 @@ import { NotificationsEffects } from './shared/notifications/notifications.effec
import { NavbarEffects } from './navbar/navbar.effects'; import { NavbarEffects } from './navbar/navbar.effects';
import { SidebarEffects } from './shared/sidebar/sidebar-effects.service'; import { SidebarEffects } from './shared/sidebar/sidebar-effects.service';
import { RelationshipEffects } from './shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects'; import { RelationshipEffects } from './shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects';
import { ThemeEffects } from './shared/theme-support/theme.effects';
export const appEffects = [ export const appEffects = [
StoreEffects, StoreEffects,
NavbarEffects, NavbarEffects,
NotificationsEffects, NotificationsEffects,
SidebarEffects, SidebarEffects,
ThemeEffects,
RelationshipEffects RelationshipEffects
]; ];

View File

@@ -43,6 +43,9 @@ import { ForbiddenComponent } from './forbidden/forbidden.component';
import { AuthInterceptor } from './core/auth/auth.interceptor'; import { AuthInterceptor } from './core/auth/auth.interceptor';
import { LocaleInterceptor } from './core/locale/locale.interceptor'; import { LocaleInterceptor } from './core/locale/locale.interceptor';
import { XsrfInterceptor } from './core/xsrf/xsrf.interceptor'; import { XsrfInterceptor } from './core/xsrf/xsrf.interceptor';
import { RootComponent } from './root/root.component';
import { ThemedRootComponent } from './root/themed-root.component';
import { ThemedEntryComponentModule } from '../themes/themed-entry-component.module';
export function getBase() { export function getBase() {
return environment.ui.nameSpace; return environment.ui.nameSpace;
@@ -65,6 +68,7 @@ const IMPORTS = [
EffectsModule.forRoot(appEffects), EffectsModule.forRoot(appEffects),
StoreModule.forRoot(appReducers, storeModuleConfig), StoreModule.forRoot(appReducers, storeModuleConfig),
StoreRouterConnectingModule.forRoot(), StoreRouterConnectingModule.forRoot(),
ThemedEntryComponentModule.withEntryComponents(),
]; ];
IMPORTS.push( IMPORTS.push(
@@ -120,6 +124,8 @@ const PROVIDERS = [
const DECLARATIONS = [ const DECLARATIONS = [
AppComponent, AppComponent,
RootComponent,
ThemedRootComponent,
HeaderComponent, HeaderComponent,
HeaderNavbarWrapperComponent, HeaderNavbarWrapperComponent,
AdminSidebarComponent, AdminSidebarComponent,
@@ -135,7 +141,6 @@ const DECLARATIONS = [
]; ];
const EXPORTS = [ const EXPORTS = [
AppComponent
]; ];
@NgModule({ @NgModule({
@@ -150,7 +155,8 @@ const EXPORTS = [
...DECLARATIONS, ...DECLARATIONS,
], ],
exports: [ exports: [
...EXPORTS ...EXPORTS,
...DECLARATIONS,
] ]
}) })
export class AppModule { export class AppModule {

View File

@@ -12,7 +12,10 @@ import {
metadataRegistryReducer, metadataRegistryReducer,
MetadataRegistryState MetadataRegistryState
} from './+admin/admin-registries/metadata-registry/metadata-registry.reducers'; } from './+admin/admin-registries/metadata-registry/metadata-registry.reducers';
import { CommunityListReducer, CommunityListState } from './community-list-page/community-list.reducer'; import {
CommunityListReducer,
CommunityListState
} from './community-list-page/community-list.reducer';
import { hasValue } from './shared/empty.util'; import { hasValue } from './shared/empty.util';
import { import {
NameVariantListsState, NameVariantListsState,
@@ -20,19 +23,32 @@ import {
} from './shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.reducer'; } from './shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.reducer';
import { formReducer, FormState } from './shared/form/form.reducer'; import { formReducer, FormState } from './shared/form/form.reducer';
import { menusReducer, MenusState } from './shared/menu/menu.reducer'; import { menusReducer, MenusState } from './shared/menu/menu.reducer';
import { notificationsReducer, NotificationsState } from './shared/notifications/notifications.reducers'; import {
notificationsReducer,
NotificationsState
} from './shared/notifications/notifications.reducers';
import { import {
selectableListReducer, selectableListReducer,
SelectableListsState SelectableListsState
} from './shared/object-list/selectable-list/selectable-list.reducer'; } from './shared/object-list/selectable-list/selectable-list.reducer';
import { ObjectSelectionListState, objectSelectionReducer } from './shared/object-select/object-select.reducer'; import {
ObjectSelectionListState,
objectSelectionReducer
} from './shared/object-select/object-select.reducer';
import { cssVariablesReducer, CSSVariablesState } from './shared/sass-helper/sass-helper.reducer'; import { cssVariablesReducer, CSSVariablesState } from './shared/sass-helper/sass-helper.reducer';
import { hostWindowReducer, HostWindowState } from './shared/search/host-window.reducer'; import { hostWindowReducer, HostWindowState } from './shared/search/host-window.reducer';
import { filterReducer, SearchFiltersState } from './shared/search/search-filters/search-filter/search-filter.reducer'; import {
import { sidebarFilterReducer, SidebarFiltersState } from './shared/sidebar/filter/sidebar-filter.reducer'; filterReducer,
SearchFiltersState
} from './shared/search/search-filters/search-filter/search-filter.reducer';
import {
sidebarFilterReducer,
SidebarFiltersState
} from './shared/sidebar/filter/sidebar-filter.reducer';
import { sidebarReducer, SidebarState } from './shared/sidebar/sidebar.reducer'; import { sidebarReducer, SidebarState } from './shared/sidebar/sidebar.reducer';
import { truncatableReducer, TruncatablesState } from './shared/truncatable/truncatable.reducer'; import { truncatableReducer, TruncatablesState } from './shared/truncatable/truncatable.reducer';
import { ThemeState, themeReducer } from './shared/theme-support/theme.reducer';
export interface AppState { export interface AppState {
router: fromRouter.RouterReducerState; router: fromRouter.RouterReducerState;
@@ -45,6 +61,7 @@ export interface AppState {
searchFilter: SearchFiltersState; searchFilter: SearchFiltersState;
truncatable: TruncatablesState; truncatable: TruncatablesState;
cssVariables: CSSVariablesState; cssVariables: CSSVariablesState;
theme: ThemeState;
menus: MenusState; menus: MenusState;
objectSelection: ObjectSelectionListState; objectSelection: ObjectSelectionListState;
selectableLists: SelectableListsState; selectableLists: SelectableListsState;
@@ -65,6 +82,7 @@ export const appReducers: ActionReducerMap<AppState> = {
searchFilter: filterReducer, searchFilter: filterReducer,
truncatable: truncatableReducer, truncatable: truncatableReducer,
cssVariables: cssVariablesReducer, cssVariables: cssVariablesReducer,
theme: themeReducer,
menus: menusReducer, menus: menusReducer,
objectSelection: objectSelectionReducer, objectSelection: objectSelectionReducer,
selectableLists: selectableListReducer, selectableLists: selectableListReducer,

View File

@@ -3,7 +3,8 @@ import { DSOBreadcrumbsService } from './dso-breadcrumbs.service';
import { DSOBreadcrumbResolver } from './dso-breadcrumb.resolver'; import { DSOBreadcrumbResolver } from './dso-breadcrumb.resolver';
import { Collection } from '../shared/collection.model'; import { Collection } from '../shared/collection.model';
import { CollectionDataService } from '../data/collection-data.service'; import { CollectionDataService } from '../data/collection-data.service';
import { followLink, FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
import { COLLECTION_PAGE_LINKS_TO_FOLLOW } from '../../+collection-page/collection-page.resolver';
/** /**
* The class that resolves the BreadcrumbConfig object for a Collection * The class that resolves the BreadcrumbConfig object for a Collection
@@ -22,10 +23,6 @@ export class CollectionBreadcrumbResolver extends DSOBreadcrumbResolver<Collecti
* Requesting them as embeds will limit the number of requests * Requesting them as embeds will limit the number of requests
*/ */
get followLinks(): FollowLinkConfig<Collection>[] { get followLinks(): FollowLinkConfig<Collection>[] {
return [ return COLLECTION_PAGE_LINKS_TO_FOLLOW;
followLink('parentCommunity', undefined, true, true, true,
followLink('parentCommunity')
)
];
} }
} }

View File

@@ -3,7 +3,8 @@ import { DSOBreadcrumbsService } from './dso-breadcrumbs.service';
import { DSOBreadcrumbResolver } from './dso-breadcrumb.resolver'; import { DSOBreadcrumbResolver } from './dso-breadcrumb.resolver';
import { CommunityDataService } from '../data/community-data.service'; import { CommunityDataService } from '../data/community-data.service';
import { Community } from '../shared/community.model'; import { Community } from '../shared/community.model';
import { followLink, FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
import { COMMUNITY_PAGE_LINKS_TO_FOLLOW } from '../../+community-page/community-page.resolver';
/** /**
* The class that resolves the BreadcrumbConfig object for a Community * The class that resolves the BreadcrumbConfig object for a Community
@@ -22,8 +23,6 @@ export class CommunityBreadcrumbResolver extends DSOBreadcrumbResolver<Community
* Requesting them as embeds will limit the number of requests * Requesting them as embeds will limit the number of requests
*/ */
get followLinks(): FollowLinkConfig<Community>[] { get followLinks(): FollowLinkConfig<Community>[] {
return [ return COMMUNITY_PAGE_LINKS_TO_FOLLOW;
followLink('parentCommunity')
];
} }
} }

View File

@@ -28,7 +28,7 @@ export class DSOBreadcrumbsService implements BreadcrumbsService<ChildHALResourc
/** /**
* Method to recursively calculate the breadcrumbs * Method to recursively calculate the breadcrumbs
* This method returns the name and url of the key and all its parent DSO's recursively, top down * This method returns the name and url of the key and all its parent DSOs recursively, top down
* @param key The key (a DSpaceObject) used to resolve the breadcrumb * @param key The key (a DSpaceObject) used to resolve the breadcrumb
* @param url The url to use as a link for this breadcrumb * @param url The url to use as a link for this breadcrumb
*/ */

View File

@@ -20,7 +20,7 @@ export class DSONameService {
* *
* With only two exceptions those solutions seem overkill for now. * With only two exceptions those solutions seem overkill for now.
*/ */
private factories = { private readonly factories = {
Person: (dso: DSpaceObject): string => { Person: (dso: DSpaceObject): string => {
return `${dso.firstMetadataValue('person.familyName')}, ${dso.firstMetadataValue('person.givenName')}`; return `${dso.firstMetadataValue('person.familyName')}, ${dso.firstMetadataValue('person.givenName')}`;
}, },

View File

@@ -3,7 +3,8 @@ import { DSOBreadcrumbsService } from './dso-breadcrumbs.service';
import { ItemDataService } from '../data/item-data.service'; import { ItemDataService } from '../data/item-data.service';
import { Item } from '../shared/item.model'; import { Item } from '../shared/item.model';
import { DSOBreadcrumbResolver } from './dso-breadcrumb.resolver'; import { DSOBreadcrumbResolver } from './dso-breadcrumb.resolver';
import { followLink, FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
import { ITEM_PAGE_LINKS_TO_FOLLOW } from '../../+item-page/item-page.resolver';
/** /**
* The class that resolves the BreadcrumbConfig object for an Item * The class that resolves the BreadcrumbConfig object for an Item
@@ -22,13 +23,6 @@ export class ItemBreadcrumbResolver extends DSOBreadcrumbResolver<Item> {
* Requesting them as embeds will limit the number of requests * Requesting them as embeds will limit the number of requests
*/ */
get followLinks(): FollowLinkConfig<Item>[] { get followLinks(): FollowLinkConfig<Item>[] {
return [ return ITEM_PAGE_LINKS_TO_FOLLOW;
followLink('owningCollection', undefined, true, true, true,
followLink('parentCommunity', undefined, true, true, true,
followLink('parentCommunity'))
),
followLink('bundles'),
followLink('relationships')
];
} }
} }

View File

@@ -3,7 +3,15 @@ import { hasNoValue, hasValue, isNotEmpty } from '../../../shared/empty.util';
import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model'; import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
import { GenericConstructor } from '../../shared/generic-constructor'; import { GenericConstructor } from '../../shared/generic-constructor';
import { HALResource } from '../../shared/hal-resource.model'; import { HALResource } from '../../shared/hal-resource.model';
import { getDataServiceFor, getLinkDefinition, getLinkDefinitions, LinkDefinition } from './build-decorators'; import {
getDataServiceFor,
getLinkDefinition,
getLinkDefinitions,
LinkDefinition
} from './build-decorators';
import { RemoteData } from '../../data/remote-data';
import { Observable } from 'rxjs/internal/Observable';
import { EMPTY } from 'rxjs';
/** /**
* A Service to handle the resolving and removing * A Service to handle the resolving and removing
@@ -33,12 +41,14 @@ export class LinkService {
} }
/** /**
* Resolve the given {@link FollowLinkConfig} for the given model * Resolve the given {@link FollowLinkConfig} for the given model and return the result. This does
* not attach the link result to the property on the model. Useful when you're working with a
* readonly object
* *
* @param model the {@link HALResource} to resolve the link for * @param model the {@link HALResource} to resolve the link for
* @param linkToFollow the {@link FollowLinkConfig} to resolve * @param linkToFollow the {@link FollowLinkConfig} to resolve
*/ */
public resolveLink<T extends HALResource>(model, linkToFollow: FollowLinkConfig<T>): T { public resolveLinkWithoutAttaching<T extends HALResource, U extends HALResource>(model, linkToFollow: FollowLinkConfig<T>): Observable<RemoteData<U>> {
const matchingLinkDef = getLinkDefinition(model.constructor, linkToFollow.name); const matchingLinkDef = getLinkDefinition(model.constructor, linkToFollow.name);
if (hasNoValue(matchingLinkDef)) { if (hasNoValue(matchingLinkDef)) {
@@ -61,9 +71,9 @@ export class LinkService {
try { try {
if (matchingLinkDef.isList) { if (matchingLinkDef.isList) {
model[linkToFollow.name] = service.findAllByHref(href, linkToFollow.findListOptions, linkToFollow.useCachedVersionIfAvailable, linkToFollow.reRequestOnStale, ...linkToFollow.linksToFollow); return service.findAllByHref(href, linkToFollow.findListOptions, linkToFollow.useCachedVersionIfAvailable, linkToFollow.reRequestOnStale, ...linkToFollow.linksToFollow);
} else { } else {
model[linkToFollow.name] = service.findByHref(href, linkToFollow.useCachedVersionIfAvailable, linkToFollow.reRequestOnStale, ...linkToFollow.linksToFollow); return service.findByHref(href, linkToFollow.useCachedVersionIfAvailable, linkToFollow.reRequestOnStale, ...linkToFollow.linksToFollow);
} }
} catch (e) { } catch (e) {
console.error(`Something went wrong when using @dataService(${matchingLinkDef.resourceType.value}) ${hasValue(service) ? '' : '(undefined) '}to resolve link ${linkToFollow.name} at ${href}`); console.error(`Something went wrong when using @dataService(${matchingLinkDef.resourceType.value}) ${hasValue(service) ? '' : '(undefined) '}to resolve link ${linkToFollow.name} at ${href}`);
@@ -71,6 +81,18 @@ export class LinkService {
} }
} }
} }
return EMPTY;
}
/**
* Resolve the given {@link FollowLinkConfig} for the given model and return the model with the
* link property attached.
*
* @param model the {@link HALResource} to resolve the link for
* @param linkToFollow the {@link FollowLinkConfig} to resolve
*/
public resolveLink<T extends HALResource>(model, linkToFollow: FollowLinkConfig<T>): T {
model[linkToFollow.name] = this.resolveLinkWithoutAttaching(model, linkToFollow);
return model; return model;
} }

View File

@@ -13,9 +13,14 @@ import { RestRequestMethod } from '../data/rest-request-method';
import { DSpaceObject } from '../shared/dspace-object.model'; import { DSpaceObject } from '../shared/dspace-object.model';
import { ApplyPatchObjectCacheAction } from './object-cache.actions'; import { ApplyPatchObjectCacheAction } from './object-cache.actions';
import { ObjectCacheService } from './object-cache.service'; import { ObjectCacheService } from './object-cache.service';
import { CommitSSBAction, EmptySSBAction, ServerSyncBufferActionTypes } from './server-sync-buffer.actions'; import {
CommitSSBAction,
EmptySSBAction,
ServerSyncBufferActionTypes
} from './server-sync-buffer.actions';
import { ServerSyncBufferEffects } from './server-sync-buffer.effects'; import { ServerSyncBufferEffects } from './server-sync-buffer.effects';
import { storeModuleConfig } from '../../app.reducer'; import { storeModuleConfig } from '../../app.reducer';
import { NoOpAction } from '../../shared/ngrx/no-op.action';
describe('ServerSyncBufferEffects', () => { describe('ServerSyncBufferEffects', () => {
let ssbEffects: ServerSyncBufferEffects; let ssbEffects: ServerSyncBufferEffects;
@@ -143,7 +148,7 @@ describe('ServerSyncBufferEffects', () => {
payload: { method: RestRequestMethod.PATCH } payload: { method: RestRequestMethod.PATCH }
} }
}); });
const expected = cold('b', { b: { type: 'NO_ACTION' } }); const expected = cold('b', { b: new NoOpAction() });
expect(ssbEffects.commitServerSyncBuffer).toBeObservable(expected); expect(ssbEffects.commitServerSyncBuffer).toBeObservable(expected);
}); });

View File

@@ -21,6 +21,7 @@ import { RestRequestMethod } from '../data/rest-request-method';
import { environment } from '../../../environments/environment'; import { environment } from '../../../environments/environment';
import { ObjectCacheEntry } from './object-cache.reducer'; import { ObjectCacheEntry } from './object-cache.reducer';
import { Operation } from 'fast-json-patch'; import { Operation } from 'fast-json-patch';
import { NoOpAction } from '../../shared/ngrx/no-op.action';
@Injectable() @Injectable()
export class ServerSyncBufferEffects { export class ServerSyncBufferEffects {
@@ -80,7 +81,7 @@ export class ServerSyncBufferEffects {
switchMap((array) => [...array, new EmptySSBAction(action.payload)]) switchMap((array) => [...array, new EmptySSBAction(action.payload)])
); );
} else { } else {
return observableOf({ type: 'NO_ACTION' }); return observableOf(new NoOpAction());
} }
}) })
); );

View File

@@ -11,10 +11,14 @@ import {
RemoveFieldUpdateAction, RemoveFieldUpdateAction,
RemoveObjectUpdatesAction RemoveObjectUpdatesAction
} from './object-updates.actions'; } from './object-updates.actions';
import { INotification, Notification } from '../../../shared/notifications/models/notification.model'; import {
INotification,
Notification
} from '../../../shared/notifications/models/notification.model';
import { NotificationType } from '../../../shared/notifications/models/notification-type'; import { NotificationType } from '../../../shared/notifications/models/notification-type';
import { filter } from 'rxjs/operators'; import { filter } from 'rxjs/operators';
import { hasValue } from '../../../shared/empty.util'; import { hasValue } from '../../../shared/empty.util';
import { NoOpAction } from '../../../shared/ngrx/no-op.action';
describe('ObjectUpdatesEffects', () => { describe('ObjectUpdatesEffects', () => {
let updatesEffects: ObjectUpdatesEffects; let updatesEffects: ObjectUpdatesEffects;
@@ -97,7 +101,7 @@ describe('ObjectUpdatesEffects', () => {
actions = hot('a', { a: new DiscardObjectUpdatesAction(testURL, infoNotification) }); actions = hot('a', { a: new DiscardObjectUpdatesAction(testURL, infoNotification) });
actions = hot('b', { b: new ReinstateObjectUpdatesAction(testURL) }); actions = hot('b', { b: new ReinstateObjectUpdatesAction(testURL) });
updatesEffects.removeAfterDiscardOrReinstateOnUndo$.subscribe((t) => { updatesEffects.removeAfterDiscardOrReinstateOnUndo$.subscribe((t) => {
expect(t).toEqual({ type: 'NO_ACTION' }); expect(t).toEqual(new NoOpAction());
} }
); );
}); });

View File

@@ -3,7 +3,8 @@ import { Actions, Effect, ofType } from '@ngrx/effects';
import { import {
DiscardObjectUpdatesAction, DiscardObjectUpdatesAction,
ObjectUpdatesAction, ObjectUpdatesAction,
ObjectUpdatesActionTypes, RemoveAllObjectUpdatesAction, ObjectUpdatesActionTypes,
RemoveAllObjectUpdatesAction,
RemoveObjectUpdatesAction RemoveObjectUpdatesAction
} from './object-updates.actions'; } from './object-updates.actions';
import { delay, filter, map, switchMap, take, tap } from 'rxjs/operators'; import { delay, filter, map, switchMap, take, tap } from 'rxjs/operators';
@@ -17,6 +18,7 @@ import {
RemoveNotificationAction RemoveNotificationAction
} from '../../../shared/notifications/notifications.actions'; } from '../../../shared/notifications/notifications.actions';
import { Action } from '@ngrx/store'; import { Action } from '@ngrx/store';
import { NoOpAction } from '../../../shared/ngrx/no-op.action';
/** /**
* NGRX effects for ObjectUpdatesActions * NGRX effects for ObjectUpdatesActions
@@ -111,7 +113,7 @@ export class ObjectUpdatesEffects {
map((updateAction: ObjectUpdatesAction) => { map((updateAction: ObjectUpdatesAction) => {
if (updateAction.type === ObjectUpdatesActionTypes.REINSTATE) { if (updateAction.type === ObjectUpdatesActionTypes.REINSTATE) {
// If someone reinstated, do nothing, just let the reinstating happen // If someone reinstated, do nothing, just let the reinstating happen
return { type: 'NO_ACTION' }; return new NoOpAction();
} }
// If someone performed another action, assume the user does not want to reinstate and remove all changes // If someone performed another action, assume the user does not want to reinstate and remove all changes
return removeAction; return removeAction;

View File

@@ -8,6 +8,7 @@ import { Item } from '../shared/item.model';
import { AddToIndexAction } from './index.actions'; import { AddToIndexAction } from './index.actions';
import { IndexName } from './index.reducer'; import { IndexName } from './index.reducer';
import { provideMockStore } from '@ngrx/store/testing'; import { provideMockStore } from '@ngrx/store/testing';
import { NoOpAction } from '../../shared/ngrx/no-op.action';
describe('ObjectUpdatesEffects', () => { describe('ObjectUpdatesEffects', () => {
let indexEffects: UUIDIndexEffects; let indexEffects: UUIDIndexEffects;
@@ -79,14 +80,14 @@ describe('ObjectUpdatesEffects', () => {
it('should emit NO_ACTION when a AddToObjectCacheAction without an alternativeLink is dispatched', () => { it('should emit NO_ACTION when a AddToObjectCacheAction without an alternativeLink is dispatched', () => {
action = new AddToObjectCacheAction(objectToCache, timeCompleted, msToLive, requestUUID, undefined); action = new AddToObjectCacheAction(objectToCache, timeCompleted, msToLive, requestUUID, undefined);
actions = hot('--a-', { a: action }); actions = hot('--a-', { a: action });
const expected = cold('--b-', { b: { type: 'NO_ACTION' } }); const expected = cold('--b-', { b: new NoOpAction() });
expect(indexEffects.addAlternativeObjectLink$).toBeObservable(expected); expect(indexEffects.addAlternativeObjectLink$).toBeObservable(expected);
}); });
it('should emit NO_ACTION when a AddToObjectCacheAction with an alternativeLink that\'s the same as the objectToCache\'s selfLink is dispatched', () => { it('should emit NO_ACTION when a AddToObjectCacheAction with an alternativeLink that\'s the same as the objectToCache\'s selfLink is dispatched', () => {
action = new AddToObjectCacheAction(objectToCache, timeCompleted, msToLive, requestUUID, objectToCache._links.self.href); action = new AddToObjectCacheAction(objectToCache, timeCompleted, msToLive, requestUUID, objectToCache._links.self.href);
actions = hot('--a-', { a: action }); actions = hot('--a-', { a: action });
const expected = cold('--b-', { b: { type: 'NO_ACTION' } }); const expected = cold('--b-', { b: new NoOpAction() });
expect(indexEffects.addAlternativeObjectLink$).toBeObservable(expected); expect(indexEffects.addAlternativeObjectLink$).toBeObservable(expected);
}); });
}); });

View File

@@ -19,6 +19,7 @@ import { RestRequestMethod } from '../data/rest-request-method';
import { getUrlWithoutEmbedParams, uuidFromHrefSelector } from './index.selectors'; import { getUrlWithoutEmbedParams, uuidFromHrefSelector } from './index.selectors';
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
import { CoreState } from '../core.reducers'; import { CoreState } from '../core.reducers';
import { NoOpAction } from '../../shared/ngrx/no-op.action';
@Injectable() @Injectable()
export class UUIDIndexEffects { export class UUIDIndexEffects {
@@ -53,7 +54,7 @@ export class UUIDIndexEffects {
selfLink selfLink
); );
} else { } else {
return { type: 'NO_ACTION' }; return new NoOpAction();
} }
}) })
); );

View File

@@ -0,0 +1,27 @@
import { type } from '../../shared/ngrx/type';
import { Action } from '@ngrx/store';
import { DSpaceObject } from '../shared/dspace-object.model';
export const ResolverActionTypes = {
RESOLVED: type('dspace/resolver/RESOLVED')
};
/**
* An action that indicates a route object has been resolved.
*
* It isn't used in a reducer for now. Its purpose is to be able to be notified that an object
* has been resolved in an effect.
*/
export class ResolvedAction implements Action {
type = ResolverActionTypes.RESOLVED;
payload: {
url: string,
dso: DSpaceObject
};
constructor(url: string, dso: DSpaceObject) {
this.payload = { url, dso };
}
}
export type ResolverAction = ResolvedAction;

View File

@@ -3,7 +3,7 @@
*/ */
export enum Context { export enum Context {
Undefined = 'undefined', Any = 'undefined',
ItemPage = 'itemPage', ItemPage = 'itemPage',
Search = 'search', Search = 'search',
Workflow = 'workflow', Workflow = 'workflow',

View File

@@ -1,5 +1,3 @@
$submission-relationship-thumbnail-width: 80px;
.person-thumbnail { .person-thumbnail {
width: $submission-relationship-thumbnail-width; width: var(--ds-submission-relationship-thumbnail-width);
} }

View File

@@ -1,5 +1,3 @@
$submission-relationship-thumbnail-width: 80px;
.person-thumbnail { .person-thumbnail {
width: $submission-relationship-thumbnail-width; width: var(--ds-submission-relationship-thumbnail-width);
} }

View File

@@ -1,40 +1,42 @@
$footer-bg: $gray-100; :host {
$footer-border: 1px solid darken($footer-bg, 10%); --ds-footer-bg: var(--bs-gray-100);
$footer-padding: $spacer * 1.5; --ds-footer-border: 1px solid var(--bs-gray-300);
$footer-logo-height: 55px; --ds-footer-padding: calc(var(--bs-spacer) * 1.5);
--ds-footer-logo-height: 55px;
.footer { .footer {
background-color: $footer-bg; background-color: var(--ds-footer-bg);
border-top: $footer-border; border-top: var(--ds-footer-border);
text-align: center; text-align: center;
padding: $footer-padding; padding: var(--ds-footer-padding);
padding-bottom: $spacer; padding-bottom: var(--bs-spacer);
p { p {
margin: 0; margin: 0;
} }
img { img {
height: $footer-logo-height; height: var(--ds-footer-logo-height);
} }
ul { ul {
padding-top: $spacer * 0.5; padding-top: calc(var(--bs-spacer) * 0.5);
li { li {
display: inline-flex; display: inline-flex;
a { a {
padding: 0 $spacer/2; padding: 0 calc(var(--bs-spacer) / 2);
color: inherit color: inherit
}
&:not(:last-child) {
&:after {
content: '';
border-right: 1px map-get($theme-colors, secondary) solid;
}
}
} }
&:not(:last-child) {
&:after {
content: '';
border-right: 1px var(--bs-secondary) solid;
}
}
}
} }
}
} }

View File

@@ -1,7 +1,7 @@
@media screen and (max-width: map-get($grid-breakpoints, md)) { @media screen and (max-width: var(--ds-grid-breakpoints-md)) {
:host.open { :host.open {
background-color: $white; background-color: var(--bs-white);
top: 0; top: 0;
position: sticky; position: sticky;
} }
} }

View File

@@ -1,7 +1,7 @@
.navbar-brand img { .navbar-brand img {
height: $header-logo-height; height: var(--ds-header-logo-height);
@media screen and (max-width: map-get($grid-breakpoints, sm)) { @media screen and (max-width: var(--ds-grid-breakpoints-sm)) {
height: $header-logo-height-xs; height: var(--ds-header-logo-height-xs);
} }
} }
.navbar-toggler .navbar-toggler-icon { .navbar-toggler .navbar-toggler-icon {
@@ -11,10 +11,10 @@
.navbar ::ng-deep { .navbar ::ng-deep {
a { a {
color: $header-icon-color; color: var(--ds-header-icon-color);
&:hover, &focus { &:hover, &focus {
color: darken($header-icon-color, 15%); color: var(--ds-header-icon-color-hover);
} }
} }
} }

View File

@@ -4,18 +4,18 @@
border-top-left-radius: 0; border-top-left-radius: 0;
border-top-right-radius: 0; border-top-right-radius: 0;
::ng-deep a.nav-link { ::ng-deep a.nav-link {
padding-right: $spacer; padding-right: var(--bs-spacer);
padding-left: $spacer; padding-left: var(--bs-spacer);
white-space: nowrap; white-space: nowrap;
} }
} }
/** Mobile menu styling **/ /** Mobile menu styling **/
@media screen and (max-width: map-get($grid-breakpoints, md)) { @media screen and (max-width: var(--ds-grid-breakpoints-md)) {
.dropdown-toggle { .dropdown-toggle {
&:after { &:after {
float: right; float: right;
margin-top: $spacer/2; margin-top: calc(var(--bs-spacer) / 2);
} }
} }
.dropdown-menu { .dropdown-menu {

View File

@@ -1,13 +1,13 @@
nav.navbar { nav.navbar {
border-bottom: 1px $gray-400 solid; border-bottom: 1px var(--bs-gray-400) solid;
align-items: baseline; align-items: baseline;
} }
/** Mobile menu styling **/ /** Mobile menu styling **/
@media screen and (max-width: map-get($grid-breakpoints, md)) { @media screen and (max-width: var(--ds-grid-breakpoints-md)) {
.navbar { .navbar {
width: 100%; width: 100%;
background-color: $white; background-color: var(--bs-white);
position: absolute; position: absolute;
overflow: hidden; overflow: hidden;
height: 0; height: 0;
@@ -17,19 +17,19 @@ nav.navbar {
} }
} }
@media screen and (min-width: map-get($grid-breakpoints, md)) { @media screen and (min-width: var(--ds-grid-breakpoints-md)) {
.reset-padding-md { .reset-padding-md {
margin-left: -$spacer/2; margin-left: -calc(var(--bs-spacer) / 2);
margin-right: -$spacer/2; margin-right: -calc(var(--bs-spacer) / 2);
} }
} }
/* TODO remove when https://github.com/twbs/bootstrap/issues/24726 is fixed */ /* TODO remove when https://github.com/twbs/bootstrap/issues/24726 is fixed */
.navbar-expand-md.navbar-container { .navbar-expand-md.navbar-container {
@media screen and (max-width: map-get($grid-breakpoints, md)) { @media screen and (max-width: var(--ds-grid-breakpoints-md)) {
> .container { > .container {
padding: 0 $spacer; padding: 0 var(--bs-spacer);
} }
padding: 0; padding: 0;
} }
} }

View File

@@ -85,5 +85,4 @@ export class NavbarComponent extends MenuComponent {
}))); })));
} }
} }

View File

@@ -12,6 +12,7 @@ import {
import { MenuID } from '../shared/menu/initial-menus-state'; import { MenuID } from '../shared/menu/initial-menus-state';
import { MenuService } from '../shared/menu/menu.service'; import { MenuService } from '../shared/menu/menu.service';
import { MenuState } from '../shared/menu/menu.reducer'; import { MenuState } from '../shared/menu/menu.reducer';
import { NoOpAction } from '../shared/ngrx/no-op.action';
@Injectable() @Injectable()
export class NavbarEffects { export class NavbarEffects {
@@ -51,7 +52,7 @@ export class NavbarEffects {
return new CollapseMenuAction(MenuID.PUBLIC); return new CollapseMenuAction(MenuID.PUBLIC);
} }
} }
return { type: 'NO_ACTION' }; return new NoOpAction();
})); }));
}) })
); );

View File

@@ -9,6 +9,7 @@ import { NavbarSectionComponent } from './navbar-section/navbar-section.componen
import { ExpandableNavbarSectionComponent } from './expandable-navbar-section/expandable-navbar-section.component'; import { ExpandableNavbarSectionComponent } from './expandable-navbar-section/expandable-navbar-section.component';
import { NavbarComponent } from './navbar.component'; import { NavbarComponent } from './navbar.component';
import { MenuModule } from '../shared/menu/menu.module'; import { MenuModule } from '../shared/menu/menu.module';
import { FormsModule } from '@angular/forms';
const effects = [ const effects = [
NavbarEffects NavbarEffects
@@ -24,6 +25,7 @@ const ENTRY_COMPONENTS = [
imports: [ imports: [
CommonModule, CommonModule,
MenuModule, MenuModule,
FormsModule,
EffectsModule.forFeature(effects), EffectsModule.forFeature(effects),
CoreModule.forRoot() CoreModule.forRoot()
], ],

View File

@@ -0,0 +1,30 @@
<div class="outer-wrapper" *ngIf="isNotAuthBlocking; else authLoader">
<ds-admin-sidebar></ds-admin-sidebar>
<div class="inner-wrapper" [@slideSidebarPadding]="{
value: (!(sidebarVisible | async) ? 'hidden' : (slideSidebarOver | async) ? 'shown' : 'expanded'),
params: {collapsedSidebarWidth: (collapsedSidebarWidth | async), totalSidebarWidth: (totalSidebarWidth | async)}
}">
<ds-header-navbar-wrapper></ds-header-navbar-wrapper>
<ds-notifications-board
[options]="notificationOptions">
</ds-notifications-board>
<main class="main-content">
<div class="container">
<ds-breadcrumbs></ds-breadcrumbs>
</div>
<div class="container" *ngIf="isLoading">
<ds-loading message="{{'loading.default' | translate}}"></ds-loading>
</div>
<router-outlet></router-outlet>
</main>
<ds-footer></ds-footer>
</div>
</div>
<ng-template #authLoader>
<div class="text-center ds-full-screen-loader d-flex align-items-center flex-column justify-content-center">
<ds-loading [showMessage]="false"></ds-loading>
</div>
</ng-template>

View File

@@ -0,0 +1,77 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RootComponent } from './root.component';
import { CommonModule } from '@angular/common';
import { StoreModule } from '@ngrx/store';
import { authReducer } from '../core/auth/auth.reducer';
import { storeModuleConfig } from '../app.reducer';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateLoaderMock } from '../shared/mocks/translate-loader.mock';
import { NativeWindowRef, NativeWindowService } from '../core/services/window.service';
import { MetadataService } from '../core/metadata/metadata.service';
import { MetadataServiceMock } from '../shared/mocks/metadata-service.mock';
import { Angulartics2GoogleAnalytics } from 'angulartics2/ga';
import { AngularticsProviderMock } from '../shared/mocks/angulartics-provider.service.mock';
import { Angulartics2DSpace } from '../statistics/angulartics/dspace-provider';
import { AuthService } from '../core/auth/auth.service';
import { AuthServiceMock } from '../shared/mocks/auth.service.mock';
import { ActivatedRoute, Router } from '@angular/router';
import { RouterMock } from '../shared/mocks/router.mock';
import { MockActivatedRoute } from '../shared/mocks/active-router.mock';
import { MenuService } from '../shared/menu/menu.service';
import { CSSVariableService } from '../shared/sass-helper/sass-helper.service';
import { CSSVariableServiceStub } from '../shared/testing/css-variable-service.stub';
import { HostWindowService } from '../shared/host-window.service';
import { HostWindowServiceStub } from '../shared/testing/host-window-service.stub';
import { LocaleService } from '../core/locale/locale.service';
import { provideMockStore } from '@ngrx/store/testing';
import { RouteService } from '../core/services/route.service';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { MenuServiceStub } from '../shared/testing/menu-service.stub';
describe('RootComponent', () => {
let component: RootComponent;
let fixture: ComponentFixture<RootComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
CommonModule,
StoreModule.forRoot(authReducer, storeModuleConfig),
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useClass: TranslateLoaderMock
}
}),
],
declarations: [RootComponent], // declare the test component
providers: [
{ provide: NativeWindowService, useValue: new NativeWindowRef() },
{ provide: MetadataService, useValue: new MetadataServiceMock() },
{ provide: Angulartics2GoogleAnalytics, useValue: new AngularticsProviderMock() },
{ provide: Angulartics2DSpace, useValue: new AngularticsProviderMock() },
{ provide: AuthService, useValue: new AuthServiceMock() },
{ provide: Router, useValue: new RouterMock() },
{ provide: ActivatedRoute, useValue: new MockActivatedRoute() },
{ provide: MenuService, useValue: new MenuServiceStub() },
{ provide: CSSVariableService, useClass: CSSVariableServiceStub },
{ provide: HostWindowService, useValue: new HostWindowServiceStub(800) },
{ provide: LocaleService, useValue: {} },
provideMockStore({ core: { auth: { loading: false } } } as any),
RootComponent,
RouteService
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(RootComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,79 @@
import { map } from 'rxjs/operators';
import { Component, Inject, OnInit, Optional, Input } from '@angular/core';
import { Router } from '@angular/router';
import { combineLatest as combineLatestObservable, Observable, of } from 'rxjs';
import { Store } from '@ngrx/store';
import { TranslateService } from '@ngx-translate/core';
import { Angulartics2GoogleAnalytics } from 'angulartics2/ga';
import { MetadataService } from '../core/metadata/metadata.service';
import { HostWindowState } from '../shared/search/host-window.reducer';
import { NativeWindowRef, NativeWindowService } from '../core/services/window.service';
import { AuthService } from '../core/auth/auth.service';
import { CSSVariableService } from '../shared/sass-helper/sass-helper.service';
import { MenuService } from '../shared/menu/menu.service';
import { MenuID } from '../shared/menu/initial-menus-state';
import { HostWindowService } from '../shared/host-window.service';
import { ThemeConfig } from '../../config/theme.model';
import { Angulartics2DSpace } from '../statistics/angulartics/dspace-provider';
import { environment } from '../../environments/environment';
import { LocaleService } from '../core/locale/locale.service';
import { KlaroService } from '../shared/cookies/klaro.service';
import { slideSidebarPadding } from '../shared/animations/slide';
@Component({
selector: 'ds-root',
templateUrl: './root.component.html',
styleUrls: ['./root.component.scss'],
animations: [slideSidebarPadding],
})
export class RootComponent implements OnInit {
sidebarVisible: Observable<boolean>;
slideSidebarOver: Observable<boolean>;
collapsedSidebarWidth: Observable<string>;
totalSidebarWidth: Observable<string>;
theme: Observable<ThemeConfig> = of({} as any);
notificationOptions = environment.notifications;
models;
/**
* Whether or not the authentication is currently blocking the UI
*/
@Input() isNotAuthBlocking: boolean;
/**
* Whether or not the the application is loading;
*/
@Input() isLoading: boolean;
constructor(
@Inject(NativeWindowService) private _window: NativeWindowRef,
private translate: TranslateService,
private store: Store<HostWindowState>,
private metadata: MetadataService,
private angulartics2GoogleAnalytics: Angulartics2GoogleAnalytics,
private angulartics2DSpace: Angulartics2DSpace,
private authService: AuthService,
private router: Router,
private cssService: CSSVariableService,
private menuService: MenuService,
private windowService: HostWindowService,
private localeService: LocaleService,
@Optional() private cookiesService: KlaroService
) {
}
ngOnInit() {
this.sidebarVisible = this.menuService.isMenuVisible(MenuID.ADMIN);
this.collapsedSidebarWidth = this.cssService.getVariable('collapsedSidebarWidth');
this.totalSidebarWidth = this.cssService.getVariable('totalSidebarWidth');
const sidebarCollapsed = this.menuService.isMenuCollapsed(MenuID.ADMIN);
this.slideSidebarOver = combineLatestObservable(sidebarCollapsed, this.windowService.isXsOrSm())
.pipe(
map(([collapsed, mobile]) => collapsed || mobile)
);
}
}

View File

@@ -0,0 +1,35 @@
import { ThemedComponent } from '../shared/theme-support/themed.component';
import { RootComponent } from './root.component';
import { Component, Input } from '@angular/core';
@Component({
selector: 'ds-themed-root',
styleUrls: [],
templateUrl: '../shared/theme-support/themed.component.html',
})
export class ThemedRootComponent extends ThemedComponent<RootComponent> {
/**
* Whether or not the authentication is currently blocking the UI
*/
@Input() isNotAuthBlocking: boolean;
/**
* Whether or not the the application is loading;
*/
@Input() isLoading: boolean;
protected inAndOutputNames: (keyof RootComponent & keyof this)[] = ['isLoading', 'isNotAuthBlocking'];
protected getComponentName(): string {
return 'RootComponent';
}
protected importThemedComponent(themeName: string): Promise<any> {
return import(`../../themes/${themeName}/app/root/root.component`);
}
protected importUnthemedComponent(): Promise<any> {
return import(`./root.component`);
}
}

View File

@@ -1,5 +1,5 @@
input[type="text"] { input[type="text"] {
margin-top: -0.5 * $font-size-base; margin-top: calc(-0.5 * var(--bs-font-size-base));
&:focus { &:focus {
background-color: rgba(255, 255, 255, 0.5) !important; background-color: rgba(255, 255, 255, 0.5) !important;
@@ -16,7 +16,7 @@ a.submit-icon {
@media screen and (max-width: map-get($grid-breakpoints, sm)) { @media screen and (max-width: var(--ds-grid-breakpoints-sm)) {
#query:focus { #query:focus {
max-width: 250px !important; max-width: 250px !important;
width: 40vw !important; width: 40vw !important;

View File

@@ -1,5 +1,5 @@
.chip-selected { .chip-selected {
background-color: map-get($theme-colors, info) !important; background-color: var(--bs-info) !important;
} }
.chip-label { .chip-label {

View File

@@ -1,15 +1,15 @@
.scrollable-menu { .scrollable-menu {
height: auto; height: auto;
max-height: $dropdown-menu-max-height; max-height: var(--ds-dropdown-menu-max-height);
overflow-x: hidden; overflow-x: hidden;
} }
.collection-item { .collection-item {
border-bottom: $dropdown-border-width solid $dropdown-border-color; border-bottom: var(--bs-dropdown-border-width) solid var(--bs-dropdown-border-color);
} }
#collectionControlsDropdownMenu { #collectionControlsDropdownMenu {
outline: 0; outline: 0;
left: 0 !important; left: 0 !important;
box-shadow: $btn-focus-box-shadow; box-shadow: var(--bs-btn-focus-box-shadow);
} }

View File

@@ -1,3 +1,3 @@
.btn-dark { .btn-dark {
background-color: $admin-sidebar-bg; background-color: var(--ds-admin-sidebar-bg);
} }

View File

@@ -1,5 +1,5 @@
.scrollable-menu { .scrollable-menu {
height: auto; height: auto;
max-height: $dso-selector-list-max-height; max-height: var(--ds-dso-selector-list-max-height);
overflow-x: hidden; overflow-x: hidden;
} }

View File

@@ -1,5 +1,5 @@
.ds-base-drop-zone { .ds-base-drop-zone {
border: 2px dashed $gray-600; border: 2px dashed var(--bs-gray-600);
} }
.ds-document-drop-zone { .ds-document-drop-zone {
@@ -9,21 +9,21 @@
} }
.ds-document-drop-zone-active { .ds-document-drop-zone-active {
z-index: $drop-zone-area-z-index !important; z-index: var(--ds-drop-zone-area-z-index) !important;
} }
.ds-document-drop-zone-inner { .ds-document-drop-zone-inner {
background-color: rgba($white, 0.7); background-color: rgba(255, 255, 255, 0.7);
z-index: $drop-zone-area-inner-z-index; z-index: var(--ds-drop-zone-area-inner-z-index);
top: 0; top: 0;
left: 0; left: 0;
} }
.ds-document-drop-zone-inner-content { .ds-document-drop-zone-inner-content {
border: 4px dashed map-get($theme-colors, primary); border: 4px dashed var(--bs-primary);
z-index: $drop-zone-area-inner-z-index; z-index: var(--ds-drop-zone-area-inner-z-index);
} }
.ds-document-drop-zone-inner-content p { .ds-document-drop-zone-inner-content p {
font-size: ($font-size-lg * 2.5); font-size: calc(var(--bs-font-size-lg) * 2.5);
} }

View File

@@ -1,3 +1,3 @@
span.text-contents{ span.text-contents{
padding: $btn-padding-y 0; padding: var(--bs-btn-padding-y) 0;
} }

View File

@@ -1,3 +1,3 @@
span.text-contents{ span.text-contents{
padding: $btn-padding-y 0; padding: var(--bs-btn-padding-y) 0;
} }

View File

@@ -5,16 +5,16 @@
} }
.cdk-drag { .cdk-drag {
margin-left: -(2 * $spacer); margin-left: calc(-2 * var(--bs-spacer));
margin-right: -(0.5 * $spacer); margin-right: calc(-0.5 * var(--bs-spacer));
padding-right: (0.5 * $spacer); padding-right: calc(0.5 * var(--bs-spacer));
.drag-icon { .drag-icon {
visibility: hidden; visibility: hidden;
width: (2 * $spacer); width: calc(2 * var(--bs-spacer));
color: $gray-600; color: var(--bs-gray-600);
margin: $btn-padding-y 0; margin: var(--bs-btn-padding-y) 0;
line-height: $btn-line-height; line-height: var(--bs-btn-line-height);
text-indent: 0.5 * $spacer text-indent: calc(0.5 * var(--bs-spacer))
} }
&:hover, &:focus { &:hover, &:focus {
@@ -37,7 +37,7 @@
.cdk-drag-preview { .cdk-drag-preview {
background-color: white; background-color: white;
border-radius: $border-radius-sm; border-radius: var(--bs-border-radius-sm);
margin-left: 0; margin-left: 0;
box-shadow: 0 5px 5px 0px rgba(0, 0, 0, 0.2), box-shadow: 0 5px 5px 0px rgba(0, 0, 0, 0.2),
0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 8px 10px 1px rgba(0, 0, 0, 0.14),

View File

@@ -5,7 +5,7 @@
:host ::ng-deep .dropdown-menu { :host ::ng-deep .dropdown-menu {
left: 0 !important; left: 0 !important;
width: 100% !important; width: 100% !important;
max-height: $dropdown-menu-max-height; max-height: var(--ds-dropdown-menu-max-height);
overflow-y: auto !important; overflow-y: auto !important;
overflow-x: hidden; overflow-x: hidden;
} }
@@ -14,8 +14,8 @@
:host ::ng-deep .dropdown-item:active, :host ::ng-deep .dropdown-item:active,
:host ::ng-deep .dropdown-item:focus, :host ::ng-deep .dropdown-item:focus,
:host ::ng-deep .dropdown-item:hover { :host ::ng-deep .dropdown-item:hover {
color: $dropdown-link-hover-color !important; color: var(--bs-dropdown-link-hover-color) !important;
background-color: $dropdown-link-hover-bg !important; background-color: var(--bs-dropdown-link-hover-bg) !important;
} }
div { div {
@@ -23,5 +23,5 @@ div {
} }
.lookup-item { .lookup-item {
border-bottom: $dropdown-border-width solid $dropdown-border-color; border-bottom: var(--bs-dropdown-border-width) solid var(--bs-dropdown-border-color);
} }

View File

@@ -1,20 +1,20 @@
:host ::ng-deep .dropdown-menu { :host ::ng-deep .dropdown-menu {
width: 100% !important; width: 100% !important;
max-height: $dropdown-menu-max-height; max-height: var(--ds-dropdown-menu-max-height);
overflow-y: auto !important; overflow-y: auto !important;
overflow-x: hidden; overflow-x: hidden;
} }
:host ::ng-deep .dropdown-item { :host ::ng-deep .dropdown-item {
border-bottom: $dropdown-border-width solid $dropdown-border-color; border-bottom: var(--bs-dropdown-border-width) solid var(--bs-dropdown-border-color);
} }
:host ::ng-deep .dropdown-item.active, :host ::ng-deep .dropdown-item.active,
:host ::ng-deep .dropdown-item:active, :host ::ng-deep .dropdown-item:active,
:host ::ng-deep .dropdown-item:focus, :host ::ng-deep .dropdown-item:focus,
:host ::ng-deep .dropdown-item:hover { :host ::ng-deep .dropdown-item:hover {
color: $dropdown-link-hover-color !important; color: var(--bs-dropdown-link-hover-color) !important;
background-color: $dropdown-link-hover-bg !important; background-color: var(--bs-dropdown-link-hover-bg) !important;
} }
.treeview .modal-body { .treeview .modal-body {

View File

@@ -2,25 +2,25 @@
.scrollable-menu { .scrollable-menu {
height: auto; height: auto;
max-height: $dropdown-menu-max-height; max-height: var(--ds-dropdown-menu-max-height);
overflow-x: hidden; overflow-x: hidden;
} }
.collection-item { .collection-item {
border-bottom: $dropdown-border-width solid $dropdown-border-color; border-bottom: var(--bs-dropdown-border-width) solid var(--bs-dropdown-border-color);
} }
.scrollable-dropdown-loading { .scrollable-dropdown-loading {
background-color: map-get($theme-colors, primary); background-color: var(--bs-primary);
color: white; color: white;
height: $spacer * 2 !important; height: calc(var(--bs-spacer) * 2) !important;
line-height: $spacer * 2; line-height: calc(var(--bs-spacer) * 2);
position: sticky; position: sticky;
bottom: 0; bottom: 0;
} }
.scrollable-dropdown-menu { .scrollable-dropdown-menu {
left: 0 !important; left: 0 !important;
margin-bottom: $spacer; margin-bottom: var(--bs-spacer);
z-index: 1000; z-index: 1000;
} }

View File

@@ -10,19 +10,19 @@
:host ::ng-deep .dropdown-menu { :host ::ng-deep .dropdown-menu {
width: 100% !important; width: 100% !important;
max-height: $dropdown-menu-max-height; max-height: var(--ds-dropdown-menu-max-height);
overflow-y: scroll; overflow-y: scroll;
overflow-x: hidden; overflow-x: hidden;
left: 0 !important; left: 0 !important;
margin-top: $spacer !important; margin-top: var(--bs-spacer) !important;
} }
:host ::ng-deep .dropdown-item.active, :host ::ng-deep .dropdown-item.active,
:host ::ng-deep .dropdown-item:active, :host ::ng-deep .dropdown-item:active,
:host ::ng-deep .dropdown-item:focus, :host ::ng-deep .dropdown-item:focus,
:host ::ng-deep .dropdown-item:hover { :host ::ng-deep .dropdown-item:hover {
color: $dropdown-link-hover-color !important; color: var(--bs-dropdown-link-hover-color) !important;
background-color: $dropdown-link-hover-bg !important; background-color: var(--bs-dropdown-link-hover-bg) !important;
} }
.tag-input { .tag-input {

View File

@@ -1,3 +1,3 @@
.position-absolute { .position-absolute {
right: $spacer; right: var(--bs-spacer);
} }

View File

@@ -5,7 +5,7 @@
} }
.ds-form-input-btn { .ds-form-input-btn {
border: $input-btn-border-width solid $input-border-color; border: var(--bs-input-btn-border-width) solid var(--bs-input-border-color);
border-top-left-radius: 0; border-top-left-radius: 0;
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
border-left: 0; border-left: 0;
@@ -36,9 +36,9 @@
/* add padding */ /* add padding */
.left-addon input { .left-addon input {
padding-left: $spacer * 2.25; padding-left: calc(var(--bs-spacer) * 2.25);
} }
.right-addon input { .right-addon input {
padding-right: $spacer * 2.25; padding-right: calc(var(--bs-spacer) * 2.25);
} }

View File

@@ -4,7 +4,7 @@
.dropdown-item { .dropdown-item {
white-space: normal; white-space: normal;
word-break: break-word; word-break: break-word;
padding: $input-padding-y $input-padding-x; padding: var(--bs-input-padding-y) var(--bs-input-padding-x);
&:focus { &:focus {
outline: none; outline: none;
} }

View File

@@ -1,18 +1,18 @@
:host ::ng-deep .card { :host ::ng-deep .card {
margin-bottom: $submission-sections-margin-bottom; margin-bottom: var(--ds-submission-sections-margin-bottom);
overflow: unset; overflow: unset;
} }
.section-focus { .section-focus {
border-radius: $border-radius; border-radius: var(--bs-border-radius);
box-shadow: $btn-focus-box-shadow; box-shadow: var(--bs-btn-focus-box-shadow);
} }
// TODO to remove the following when upgrading @ng-bootstrap // TODO to remove the following when upgrading @ng-bootstrap
:host ::ng-deep .card:first-of-type { :host ::ng-deep .card:first-of-type {
border-bottom: $card-border-width solid $card-border-color !important; border-bottom: var(--bs-card-border-width) solid var(--bs-card-border-color) !important;
border-bottom-left-radius: $card-border-radius !important; border-bottom-left-radius: var(--bs-card-border-radius) !important;
border-bottom-right-radius: $card-border-radius !important; border-bottom-right-radius: var(--bs-card-border-radius) !important;
} }
:host ::ng-deep .card-header button { :host ::ng-deep .card-header button {

View File

@@ -6,6 +6,7 @@ import { GenericConstructor } from '../../core/shared/generic-constructor';
import { MetadataRepresentationListElementComponent } from '../object-list/metadata-representation-list-element/metadata-representation-list-element.component'; import { MetadataRepresentationListElementComponent } from '../object-list/metadata-representation-list-element/metadata-representation-list-element.component';
import { MetadataRepresentationDirective } from './metadata-representation.directive'; import { MetadataRepresentationDirective } from './metadata-representation.directive';
import { hasValue } from '../empty.util'; import { hasValue } from '../empty.util';
import { ThemeService } from '../theme-support/theme.service';
@Component({ @Component({
selector: 'ds-metadata-representation-loader', selector: 'ds-metadata-representation-loader',
@@ -42,7 +43,10 @@ export class MetadataRepresentationLoaderComponent implements OnInit {
*/ */
@ViewChild(MetadataRepresentationDirective, {static: true}) mdRepDirective: MetadataRepresentationDirective; @ViewChild(MetadataRepresentationDirective, {static: true}) mdRepDirective: MetadataRepresentationDirective;
constructor(private componentFactoryResolver: ComponentFactoryResolver) { constructor(
private componentFactoryResolver: ComponentFactoryResolver,
private themeService: ThemeService
) {
} }
/** /**
@@ -64,6 +68,6 @@ export class MetadataRepresentationLoaderComponent implements OnInit {
* @returns {string} * @returns {string}
*/ */
private getComponent(): GenericConstructor<MetadataRepresentationListElementComponent> { private getComponent(): GenericConstructor<MetadataRepresentationListElementComponent> {
return getMetadataRepresentationComponent(this.mdRepresentation.itemType, this.mdRepresentation.representationType, this.context); return getMetadataRepresentationComponent(this.mdRepresentation.itemType, this.mdRepresentation.representationType, this.context, this.themeService.getThemeName());
} }
} }

View File

@@ -6,15 +6,17 @@ export const map = new Map();
export const DEFAULT_ENTITY_TYPE = 'Publication'; export const DEFAULT_ENTITY_TYPE = 'Publication';
export const DEFAULT_REPRESENTATION_TYPE = MetadataRepresentationType.PlainText; export const DEFAULT_REPRESENTATION_TYPE = MetadataRepresentationType.PlainText;
export const DEFAULT_CONTEXT = Context.Undefined; export const DEFAULT_CONTEXT = Context.Any;
export const DEFAULT_THEME = '*';
/** /**
* Decorator function to store metadata representation mapping * Decorator function to store metadata representation mapping
* @param entityType The entity type the component represents * @param entityType The entity type the component represents
* @param mdRepresentationType The metadata representation type the component represents * @param mdRepresentationType The metadata representation type the component represents
* @param context The optional context the component represents * @param context The optional context the component represents
* @param theme The optional theme for the component
*/ */
export function metadataRepresentationComponent(entityType: string, mdRepresentationType: MetadataRepresentationType, context: Context = DEFAULT_CONTEXT) { export function metadataRepresentationComponent(entityType: string, mdRepresentationType: MetadataRepresentationType, context: Context = DEFAULT_CONTEXT, theme = DEFAULT_THEME) {
return function decorator(component: any) { return function decorator(component: any) {
if (hasNoValue(map.get(entityType))) { if (hasNoValue(map.get(entityType))) {
map.set(entityType, new Map()); map.set(entityType, new Map());
@@ -23,10 +25,14 @@ export function metadataRepresentationComponent(entityType: string, mdRepresenta
map.get(entityType).set(mdRepresentationType, new Map()); map.get(entityType).set(mdRepresentationType, new Map());
} }
if (hasValue(map.get(entityType).get(mdRepresentationType).get(context))) { if (hasNoValue(map.get(entityType).get(mdRepresentationType).get(context))) {
map.get(entityType).get(mdRepresentationType).set(context, new Map());
}
if (hasValue(map.get(entityType).get(mdRepresentationType).get(context).get(theme))) {
throw new Error(`There can't be more than one component to render Entity of type "${entityType}" in MetadataRepresentation "${mdRepresentationType}" with context "${context}"`); throw new Error(`There can't be more than one component to render Entity of type "${entityType}" in MetadataRepresentation "${mdRepresentationType}" with context "${context}"`);
} }
map.get(entityType).get(mdRepresentationType).set(context, component); map.get(entityType).get(mdRepresentationType).get(context).set(theme, component);
}; };
} }
@@ -35,22 +41,32 @@ export function metadataRepresentationComponent(entityType: string, mdRepresenta
* @param entityType The entity type to match * @param entityType The entity type to match
* @param mdRepresentationType The metadata representation to match * @param mdRepresentationType The metadata representation to match
* @param context The context to match * @param context The context to match
* @param theme the theme to match
*/ */
export function getMetadataRepresentationComponent(entityType: string, mdRepresentationType: MetadataRepresentationType, context: Context = DEFAULT_CONTEXT) { export function getMetadataRepresentationComponent(entityType: string, mdRepresentationType: MetadataRepresentationType, context: Context = DEFAULT_CONTEXT, theme = DEFAULT_THEME) {
const mapForEntity = map.get(entityType); const mapForEntity = map.get(entityType);
if (hasValue(mapForEntity)) { if (hasValue(mapForEntity)) {
const entityAndMDRepMap = mapForEntity.get(mdRepresentationType); const entityAndMDRepMap = mapForEntity.get(mdRepresentationType);
if (hasValue(entityAndMDRepMap)) { if (hasValue(entityAndMDRepMap)) {
if (hasValue(entityAndMDRepMap.get(context))) { const contextMap = entityAndMDRepMap.get(context);
return entityAndMDRepMap.get(context); if (hasValue(contextMap)) {
if (hasValue(contextMap.get(theme))) {
return contextMap.get(theme);
}
if (hasValue(contextMap.get(DEFAULT_THEME))) {
return contextMap.get(DEFAULT_THEME);
}
} }
if (hasValue(entityAndMDRepMap.get(DEFAULT_CONTEXT))) { if (hasValue(entityAndMDRepMap.get(DEFAULT_CONTEXT)) &&
return entityAndMDRepMap.get(DEFAULT_CONTEXT); hasValue(entityAndMDRepMap.get(DEFAULT_CONTEXT).get(DEFAULT_THEME))) {
return entityAndMDRepMap.get(DEFAULT_CONTEXT).get(DEFAULT_THEME);
} }
} }
if (hasValue(mapForEntity.get(DEFAULT_REPRESENTATION_TYPE))) { if (hasValue(mapForEntity.get(DEFAULT_REPRESENTATION_TYPE)) &&
return mapForEntity.get(DEFAULT_REPRESENTATION_TYPE).get(DEFAULT_CONTEXT); hasValue(mapForEntity.get(DEFAULT_REPRESENTATION_TYPE).get(DEFAULT_CONTEXT)) &&
hasValue(mapForEntity.get(DEFAULT_REPRESENTATION_TYPE).get(DEFAULT_CONTEXT).get(DEFAULT_THEME))) {
return mapForEntity.get(DEFAULT_REPRESENTATION_TYPE).get(DEFAULT_CONTEXT).get(DEFAULT_THEME);
} }
} }
return map.get(DEFAULT_ENTITY_TYPE).get(DEFAULT_REPRESENTATION_TYPE).get(DEFAULT_CONTEXT); return map.get(DEFAULT_ENTITY_TYPE).get(DEFAULT_REPRESENTATION_TYPE).get(DEFAULT_CONTEXT).get(DEFAULT_THEME);
} }

View File

@@ -0,0 +1,7 @@
import { ThemeService } from '../theme-support/theme.service';
export function getMockThemeService(): ThemeService {
return jasmine.createSpyObj('themeService', {
getThemeName: 'base'
});
}

View File

@@ -0,0 +1,14 @@
import { Action } from '@ngrx/store';
import { type } from './type';
export const NO_OP_ACTION_TYPE = type('dspace/ngrx/NO_OP_ACTION');
/**
* An action to use when nothing needs to happen, but you're forced to dispatch an action anyway.
* e.g. an effect that needs to do something if a certain check succeeds, and nothing otherwise.
*
* It should not be used in any reducer or listened for in any effect.
*/
export class NoOpAction implements Action {
public readonly type = NO_OP_ACTION_TYPE;
}

View File

@@ -1,6 +1,6 @@
.alert { .alert {
display: inline-block; display: inline-block;
min-width: $modal-sm; min-width: var(--bs-modal-sm);
text-align: left; text-align: left;
} }
@@ -19,14 +19,14 @@
} }
.alert-success .notification-progress-loader span { .alert-success .notification-progress-loader span {
background: darken(adjust-hue(map-get($theme-colors, success), -10), 10%); background: var(--ds-notification-bg-success);
} }
.alert-danger .notification-progress-loader span { .alert-danger .notification-progress-loader span {
background: darken(adjust-hue(map-get($theme-colors, danger), -10), 10%); background: var(--ds-notification-bg-danger);
} }
.alert-info .notification-progress-loader span { .alert-info .notification-progress-loader span {
background: darken(adjust-hue(map-get($theme-colors, info), -10), 10%); background: var(--ds-notification-bg-info);
} }
.alert-warning .notification-progress-loader span { .alert-warning .notification-progress-loader span {
background: darken(adjust-hue(map-get($theme-colors, warning), -10), 10%); background: var(--ds-notification-bg-warning);
} }

View File

@@ -1,5 +1,5 @@
.notifications-wrapper { .notifications-wrapper {
z-index: $zindex-popover; z-index: var(--bs-zindex-popover);
text-align: right; text-align: right;
@include word-wrap; @include word-wrap;
.notification { .notification {
@@ -37,7 +37,7 @@
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
} }
@media screen and (max-width: map-get($grid-breakpoints, sm)) { @media screen and (max-width: var(--ds-grid-breakpoints-sm)) {
.notifications-wrapper { .notifications-wrapper {
width: auto; width: auto;
left: 0; left: 0;

View File

@@ -1,4 +1,11 @@
import { Component, ComponentFactoryResolver, ElementRef, Input, OnInit, ViewChild } from '@angular/core'; import {
Component,
ComponentFactoryResolver,
ElementRef,
Input,
OnInit,
ViewChild
} from '@angular/core';
import { ListableObject } from '../listable-object.model'; import { ListableObject } from '../listable-object.model';
import { ViewMode } from '../../../../core/shared/view-mode.model'; import { ViewMode } from '../../../../core/shared/view-mode.model';
import { Context } from '../../../../core/shared/context.model'; import { Context } from '../../../../core/shared/context.model';
@@ -7,6 +14,7 @@ import { GenericConstructor } from '../../../../core/shared/generic-constructor'
import { ListableObjectDirective } from './listable-object.directive'; import { ListableObjectDirective } from './listable-object.directive';
import { CollectionElementLinkType } from '../../collection-element-link.type'; import { CollectionElementLinkType } from '../../collection-element-link.type';
import { hasValue } from '../../../empty.util'; import { hasValue } from '../../../empty.util';
import { ThemeService } from '../../../theme-support/theme.service';
@Component({ @Component({
selector: 'ds-listable-object-component-loader', selector: 'ds-listable-object-component-loader',
@@ -83,7 +91,10 @@ export class ListableObjectComponentLoaderComponent implements OnInit {
*/ */
withdrawnBadge = false; withdrawnBadge = false;
constructor(private componentFactoryResolver: ComponentFactoryResolver) { constructor(
private componentFactoryResolver: ComponentFactoryResolver,
private themeService: ThemeService
) {
} }
/** /**
@@ -132,6 +143,6 @@ export class ListableObjectComponentLoaderComponent implements OnInit {
* @returns {GenericConstructor<Component>} * @returns {GenericConstructor<Component>}
*/ */
private getComponent(): GenericConstructor<Component> { private getComponent(): GenericConstructor<Component> {
return getListableObjectComponent(this.object.getRenderTypes(), this.viewMode, this.context); return getListableObjectComponent(this.object.getRenderTypes(), this.viewMode, this.context, this.themeService.getThemeName());
} }
} }

Some files were not shown because too many files have changed in this diff Show More