mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
support ordering of document list columns (#1799)
This commit is contained in:
@@ -111,6 +111,63 @@ describe('AppExtensionService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('documentList', () => {
|
||||
it('should support column orders', () => {
|
||||
applyConfig({
|
||||
$id: 'test',
|
||||
$name: 'test',
|
||||
$version: '1.0.0',
|
||||
$license: 'MIT',
|
||||
$vendor: 'Good company',
|
||||
$runtime: '1.5.0',
|
||||
features: {
|
||||
documentList: {
|
||||
files: [
|
||||
{
|
||||
id: 'app.files.thumbnail',
|
||||
key: '$thumbnail',
|
||||
type: 'image',
|
||||
order: 10
|
||||
},
|
||||
{
|
||||
id: 'app.files.name',
|
||||
key: 'name',
|
||||
title: 'APP.DOCUMENT_LIST.COLUMNS.NAME',
|
||||
type: 'text',
|
||||
order: 20
|
||||
}
|
||||
],
|
||||
libraries: [
|
||||
{
|
||||
id: 'app.libraries.thumbnail',
|
||||
key: '$thumbnail',
|
||||
type: 'image',
|
||||
order: 20
|
||||
},
|
||||
{
|
||||
id: 'app.libraries.name',
|
||||
key: 'title',
|
||||
title: 'APP.DOCUMENT_LIST.COLUMNS.NAME',
|
||||
type: 'text',
|
||||
order: 10
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const { files, libraries } = service.documentListPresets;
|
||||
|
||||
expect(files.length).toBe(2);
|
||||
expect(files[0].id).toBe('app.files.thumbnail');
|
||||
expect(files[1].id).toBe('app.files.name');
|
||||
|
||||
expect(libraries.length).toBe(2);
|
||||
expect(libraries[0].id).toBe('app.libraries.name');
|
||||
expect(libraries[1].id).toBe('app.libraries.thumbnail');
|
||||
});
|
||||
});
|
||||
|
||||
describe('actions', () => {
|
||||
beforeEach(() => {
|
||||
applyConfig({
|
||||
|
@@ -195,8 +195,11 @@ export class AppExtensionService implements RuleContext {
|
||||
return this.loader.getElements<NavBarGroupRef>(config, 'features.navbar');
|
||||
}
|
||||
|
||||
protected getDocumentListPreset(config: ExtensionConfig, key: string) {
|
||||
return this.loader.getElements<DocumentListPresetRef>(config, `features.documentList.${key}`).filter((entry) => !entry.disabled);
|
||||
protected getDocumentListPreset(config: ExtensionConfig, key: string): DocumentListPresetRef[] {
|
||||
return this.loader
|
||||
.getElements<DocumentListPresetRef>(config, `features.documentList.${key}`)
|
||||
.filter((entry) => !entry.disabled)
|
||||
.sort(sortByOrder);
|
||||
}
|
||||
|
||||
getApplicationNavigation(elements): Array<NavBarGroupRef> {
|
||||
|
Reference in New Issue
Block a user