mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
add presets document list in an external model (#2420)
This commit is contained in:
parent
07c0c1c593
commit
ea29213178
@ -23,6 +23,7 @@ import { MinimalNodeEntity, MinimalNodeEntryEntity, NodePaging, Pagination, Pers
|
|||||||
import { AlfrescoApiService, AppConfigService, DataColumnListComponent } from 'ng2-alfresco-core';
|
import { AlfrescoApiService, AppConfigService, DataColumnListComponent } from 'ng2-alfresco-core';
|
||||||
import { DataCellEvent, DataColumn, DataRowActionEvent, DataSorting, DataTableComponent, ObjectDataColumn } from 'ng2-alfresco-datatable';
|
import { DataCellEvent, DataColumn, DataRowActionEvent, DataSorting, DataTableComponent, ObjectDataColumn } from 'ng2-alfresco-datatable';
|
||||||
import { Observable, Subject } from 'rxjs/Rx';
|
import { Observable, Subject } from 'rxjs/Rx';
|
||||||
|
import { presetsDefaultModel } from '../models/preset.model';
|
||||||
import { ImageResolver, RowFilter, ShareDataRow, ShareDataTableAdapter } from './../data/share-datatable-adapter';
|
import { ImageResolver, RowFilter, ShareDataRow, ShareDataTableAdapter } from './../data/share-datatable-adapter';
|
||||||
import { ContentActionModel } from './../models/content-action.model';
|
import { ContentActionModel } from './../models/content-action.model';
|
||||||
import { PermissionStyleModel } from './../models/permissions-style.model';
|
import { PermissionStyleModel } from './../models/permissions-style.model';
|
||||||
@ -802,236 +803,14 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
|
|||||||
}
|
}
|
||||||
|
|
||||||
private loadLayoutPresets(): void {
|
private loadLayoutPresets(): void {
|
||||||
let presets = {
|
|
||||||
'-trashcan-': [
|
|
||||||
{
|
|
||||||
key: '$thumbnail',
|
|
||||||
type: 'image',
|
|
||||||
srTitle: 'ADF-DOCUMENT-LIST.LAYOUT.THUMBNAIL',
|
|
||||||
sortable: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'name',
|
|
||||||
type: 'text',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.NAME',
|
|
||||||
cssClass: 'full-width ellipsis-cell',
|
|
||||||
sortable: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'path',
|
|
||||||
type: 'location',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.LOCATION',
|
|
||||||
format: this.locationFormat,
|
|
||||||
sortable: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'content.sizeInBytes',
|
|
||||||
type: 'fileSize',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.SIZE',
|
|
||||||
sortable: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'archivedAt',
|
|
||||||
type: 'date',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.DELETED_ON',
|
|
||||||
format: 'timeAgo',
|
|
||||||
sortable: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'archivedByUser.displayName',
|
|
||||||
type: 'text',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.DELETED_BY',
|
|
||||||
sortable: true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
'-sites-': [
|
|
||||||
{
|
|
||||||
key: '$thumbnail',
|
|
||||||
type: 'image',
|
|
||||||
srTitle: 'ADF-DOCUMENT-LIST.LAYOUT.THUMBNAIL',
|
|
||||||
sortable: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'title',
|
|
||||||
type: 'text',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.NAME',
|
|
||||||
cssClass: 'full-width ellipsis-cell',
|
|
||||||
sortable: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'visibility',
|
|
||||||
type: 'text',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.STATUS',
|
|
||||||
sortable: true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
'-favorites-': [
|
|
||||||
{
|
|
||||||
key: '$thumbnail',
|
|
||||||
type: 'image',
|
|
||||||
srTitle: 'ADF-DOCUMENT-LIST.LAYOUT.THUMBNAIL',
|
|
||||||
sortable: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'name',
|
|
||||||
type: 'text',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.NAME',
|
|
||||||
cssClass: 'full-width ellipsis-cell',
|
|
||||||
sortable: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'path',
|
|
||||||
type: 'location',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.LOCATION',
|
|
||||||
format: this.locationFormat,
|
|
||||||
sortable: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'content.sizeInBytes',
|
|
||||||
type: 'fileSize',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.SIZE',
|
|
||||||
sortable: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'modifiedAt',
|
|
||||||
type: 'date',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.MODIFIED_ON',
|
|
||||||
format: 'timeAgo',
|
|
||||||
sortable: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'modifiedByUser.displayName',
|
|
||||||
type: 'text',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.MODIFIED_BY',
|
|
||||||
sortable: true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
'-recent-': [
|
|
||||||
{
|
|
||||||
key: '$thumbnail',
|
|
||||||
type: 'image',
|
|
||||||
srTitle: 'ADF-DOCUMENT-LIST.LAYOUT.THUMBNAIL',
|
|
||||||
sortable: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'name',
|
|
||||||
type: 'text',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.NAME',
|
|
||||||
cssClass: 'full-width ellipsis-cell',
|
|
||||||
sortable: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'path',
|
|
||||||
type: 'location',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.LOCATION',
|
|
||||||
cssClass: 'ellipsis-cell',
|
|
||||||
format: this.locationFormat,
|
|
||||||
sortable: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'content.sizeInBytes',
|
|
||||||
type: 'fileSize',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.SIZE',
|
|
||||||
sortable: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'modifiedAt',
|
|
||||||
type: 'date',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.MODIFIED_ON',
|
|
||||||
format: 'timeAgo',
|
|
||||||
sortable: true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
'-sharedlinks-': [
|
|
||||||
{
|
|
||||||
key: '$thumbnail',
|
|
||||||
type: 'image',
|
|
||||||
srTitle: 'ADF-DOCUMENT-LIST.LAYOUT.THUMBNAIL',
|
|
||||||
sortable: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'name',
|
|
||||||
type: 'text',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.NAME',
|
|
||||||
cssClass: 'full-width ellipsis-cell',
|
|
||||||
sortable: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'path',
|
|
||||||
type: 'location',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.LOCATION',
|
|
||||||
cssClass: 'ellipsis-cell',
|
|
||||||
format: this.locationFormat,
|
|
||||||
sortable: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'content.sizeInBytes',
|
|
||||||
type: 'fileSize',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.SIZE',
|
|
||||||
sortable: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'modifiedAt',
|
|
||||||
type: 'date',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.MODIFIED_ON',
|
|
||||||
format: 'timeAgo',
|
|
||||||
sortable: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'modifiedByUser.displayName',
|
|
||||||
type: 'text',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.MODIFIED_BY',
|
|
||||||
sortable: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'sharedByUser.displayName',
|
|
||||||
type: 'text',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.SHARED_BY',
|
|
||||||
sortable: true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
'default': [
|
|
||||||
{
|
|
||||||
key: '$thumbnail',
|
|
||||||
type: 'image',
|
|
||||||
srTitle: 'ADF-DOCUMENT-LIST.LAYOUT.THUMBNAIL',
|
|
||||||
sortable: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'name',
|
|
||||||
type: 'text',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.NAME',
|
|
||||||
cssClass: 'full-width ellipsis-cell',
|
|
||||||
sortable: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'content.sizeInBytes',
|
|
||||||
type: 'fileSize',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.SIZE',
|
|
||||||
sortable: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'modifiedAt',
|
|
||||||
type: 'date',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.MODIFIED_ON',
|
|
||||||
format: 'timeAgo',
|
|
||||||
sortable: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'modifiedByUser.displayName',
|
|
||||||
type: 'text',
|
|
||||||
title: 'ADF-DOCUMENT-LIST.LAYOUT.MODIFIED_BY',
|
|
||||||
sortable: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
|
|
||||||
const externalSettings = this.appConfig.get('document-list.presets', null);
|
const externalSettings = this.appConfig.get('document-list.presets', null);
|
||||||
|
|
||||||
if (externalSettings) {
|
if (externalSettings) {
|
||||||
presets = Object.assign({}, presets, externalSettings);
|
this.layoutPresets = Object.assign({}, presetsDefaultModel, externalSettings);
|
||||||
|
} else {
|
||||||
|
this.layoutPresets = presetsDefaultModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.layoutPresets = presets;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private getLayoutPreset(name: string = 'default'): DataColumn[] {
|
private getLayoutPreset(name: string = 'default'): DataColumn[] {
|
||||||
|
@ -0,0 +1,240 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2016 Alfresco Software, Ltd.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export let presetsDefaultModel = {
|
||||||
|
'-trashcan-': [
|
||||||
|
{
|
||||||
|
key: '$thumbnail',
|
||||||
|
type: 'image',
|
||||||
|
srTitle: 'ADF-DOCUMENT-LIST.LAYOUT.THUMBNAIL',
|
||||||
|
sortable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'name',
|
||||||
|
type: 'text',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.NAME',
|
||||||
|
cssClass: 'full-width ellipsis-cell',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'path',
|
||||||
|
type: 'location',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.LOCATION',
|
||||||
|
format: this.locationFormat,
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'content.sizeInBytes',
|
||||||
|
type: 'fileSize',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.SIZE',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'archivedAt',
|
||||||
|
type: 'date',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.DELETED_ON',
|
||||||
|
format: 'timeAgo',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'archivedByUser.displayName',
|
||||||
|
type: 'text',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.DELETED_BY',
|
||||||
|
sortable: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'-sites-': [
|
||||||
|
{
|
||||||
|
key: '$thumbnail',
|
||||||
|
type: 'image',
|
||||||
|
srTitle: 'ADF-DOCUMENT-LIST.LAYOUT.THUMBNAIL',
|
||||||
|
sortable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'title',
|
||||||
|
type: 'text',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.NAME',
|
||||||
|
cssClass: 'full-width ellipsis-cell',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'visibility',
|
||||||
|
type: 'text',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.STATUS',
|
||||||
|
sortable: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'-favorites-': [
|
||||||
|
{
|
||||||
|
key: '$thumbnail',
|
||||||
|
type: 'image',
|
||||||
|
srTitle: 'ADF-DOCUMENT-LIST.LAYOUT.THUMBNAIL',
|
||||||
|
sortable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'name',
|
||||||
|
type: 'text',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.NAME',
|
||||||
|
cssClass: 'full-width ellipsis-cell',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'path',
|
||||||
|
type: 'location',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.LOCATION',
|
||||||
|
format: this.locationFormat,
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'content.sizeInBytes',
|
||||||
|
type: 'fileSize',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.SIZE',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'modifiedAt',
|
||||||
|
type: 'date',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.MODIFIED_ON',
|
||||||
|
format: 'timeAgo',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'modifiedByUser.displayName',
|
||||||
|
type: 'text',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.MODIFIED_BY',
|
||||||
|
sortable: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'-recent-': [
|
||||||
|
{
|
||||||
|
key: '$thumbnail',
|
||||||
|
type: 'image',
|
||||||
|
srTitle: 'ADF-DOCUMENT-LIST.LAYOUT.THUMBNAIL',
|
||||||
|
sortable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'name',
|
||||||
|
type: 'text',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.NAME',
|
||||||
|
cssClass: 'full-width ellipsis-cell',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'path',
|
||||||
|
type: 'location',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.LOCATION',
|
||||||
|
cssClass: 'ellipsis-cell',
|
||||||
|
format: this.locationFormat,
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'content.sizeInBytes',
|
||||||
|
type: 'fileSize',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.SIZE',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'modifiedAt',
|
||||||
|
type: 'date',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.MODIFIED_ON',
|
||||||
|
format: 'timeAgo',
|
||||||
|
sortable: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'-sharedlinks-': [
|
||||||
|
{
|
||||||
|
key: '$thumbnail',
|
||||||
|
type: 'image',
|
||||||
|
srTitle: 'ADF-DOCUMENT-LIST.LAYOUT.THUMBNAIL',
|
||||||
|
sortable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'name',
|
||||||
|
type: 'text',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.NAME',
|
||||||
|
cssClass: 'full-width ellipsis-cell',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'path',
|
||||||
|
type: 'location',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.LOCATION',
|
||||||
|
cssClass: 'ellipsis-cell',
|
||||||
|
format: this.locationFormat,
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'content.sizeInBytes',
|
||||||
|
type: 'fileSize',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.SIZE',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'modifiedAt',
|
||||||
|
type: 'date',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.MODIFIED_ON',
|
||||||
|
format: 'timeAgo',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'modifiedByUser.displayName',
|
||||||
|
type: 'text',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.MODIFIED_BY',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'sharedByUser.displayName',
|
||||||
|
type: 'text',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.SHARED_BY',
|
||||||
|
sortable: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'default': [
|
||||||
|
{
|
||||||
|
key: '$thumbnail',
|
||||||
|
type: 'image',
|
||||||
|
srTitle: 'ADF-DOCUMENT-LIST.LAYOUT.THUMBNAIL',
|
||||||
|
sortable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'name',
|
||||||
|
type: 'text',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.NAME',
|
||||||
|
cssClass: 'full-width ellipsis-cell',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'content.sizeInBytes',
|
||||||
|
type: 'fileSize',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.SIZE',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'modifiedAt',
|
||||||
|
type: 'date',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.MODIFIED_ON',
|
||||||
|
format: 'timeAgo',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'modifiedByUser.displayName',
|
||||||
|
type: 'text',
|
||||||
|
title: 'ADF-DOCUMENT-LIST.LAYOUT.MODIFIED_BY',
|
||||||
|
sortable: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user