mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-06-30 18:15:11 +00:00
fix new ts javascript api
This commit is contained in:
parent
16d8c55f62
commit
07f6bb2552
@ -17,25 +17,25 @@
|
||||
|
||||
import {
|
||||
NodePaging,
|
||||
MinimalNodeEntity,
|
||||
MinimalNodeEntryEntity,
|
||||
NodeMinimalEntry,
|
||||
NodeMinimal,
|
||||
PathInfoEntity,
|
||||
ContentInfo,
|
||||
NodePagingList
|
||||
} from '../models/document-library.model';
|
||||
|
||||
export class PageNode extends NodePaging {
|
||||
constructor(entries?: MinimalNodeEntity[]) {
|
||||
constructor(entries?: NodeMinimalEntry[]) {
|
||||
super();
|
||||
this.list = new NodePagingList();
|
||||
this.list.entries = entries || [];
|
||||
}
|
||||
}
|
||||
|
||||
export class FileNode extends MinimalNodeEntity {
|
||||
export class FileNode extends NodeMinimalEntry {
|
||||
constructor(name?: string, mimeType?: string) {
|
||||
super();
|
||||
this.entry = new MinimalNodeEntryEntity();
|
||||
this.entry = new NodeMinimal();
|
||||
this.entry.id = 'file-id';
|
||||
this.entry.isFile = true;
|
||||
this.entry.isFolder = false;
|
||||
@ -46,10 +46,10 @@ export class FileNode extends MinimalNodeEntity {
|
||||
}
|
||||
}
|
||||
|
||||
export class FolderNode extends MinimalNodeEntity {
|
||||
export class FolderNode extends NodeMinimalEntry {
|
||||
constructor(name?: string) {
|
||||
super();
|
||||
this.entry = new MinimalNodeEntryEntity();
|
||||
this.entry = new NodeMinimal();
|
||||
this.entry.id = 'folder-id';
|
||||
this.entry.isFile = false;
|
||||
this.entry.isFolder = true;
|
||||
|
@ -21,7 +21,7 @@ import { DocumentList } from './document-list';
|
||||
import { DocumentListServiceMock } from './../assets/document-list.service.mock';
|
||||
import { ContentActionModel } from '../models/content-action.model';
|
||||
import { FileNode, FolderNode } from '../assets/document-library.model.mock';
|
||||
import { MinimalNodeEntity } from '../models/document-library.model';
|
||||
import { NodeMinimalEntry } from '../models/document-library.model';
|
||||
|
||||
describe('DocumentList', () => {
|
||||
|
||||
@ -131,7 +131,7 @@ describe('DocumentList', () => {
|
||||
documentButton.target = 'document';
|
||||
documentList.actions = [documentButton];
|
||||
|
||||
let node = new MinimalNodeEntity();
|
||||
let node = new NodeMinimalEntry();
|
||||
expect(documentList.getNodeActions(node)).toEqual([]);
|
||||
|
||||
node = new FileNode();
|
||||
|
@ -130,7 +130,7 @@ describe('ShareDataTableAdapter', () => {
|
||||
});
|
||||
|
||||
it('should covert cell value to formatted date', () => {
|
||||
let rawValue = new Date(2015, 6, 15, 21, 43, 11).toString(); // Wed Jul 15 2015 21:43:11 GMT+0100 (BST);
|
||||
let rawValue = new Date(2015, 6, 15, 21, 43, 11); // Wed Jul 15 2015 21:43:11 GMT+0100 (BST);
|
||||
let dateValue = 'Jul 15, 2015, 9:43:11 PM';
|
||||
|
||||
let file = new FileNode();
|
||||
@ -150,7 +150,7 @@ describe('ShareDataTableAdapter', () => {
|
||||
});
|
||||
|
||||
it('should use default date format as fallback', () => {
|
||||
let rawValue = new Date(2015, 6, 15, 21, 43, 11).toString(); // Wed Jul 15 2015 21:43:11 GMT+0100 (BST);
|
||||
let rawValue = new Date(2015, 6, 15, 21, 43, 11); // Wed Jul 15 2015 21:43:11 GMT+0100 (BST);
|
||||
let dateValue = 'Jul 15, 2015, 9:43:11 PM';
|
||||
|
||||
let file = new FileNode();
|
||||
@ -170,7 +170,7 @@ describe('ShareDataTableAdapter', () => {
|
||||
});
|
||||
|
||||
it('should return date value as string', () => {
|
||||
let rawValue = new Date(2015, 6, 15, 21, 43, 11).toString(); // Wed Jul 15 2015 21:43:11 GMT+0100 (BST);
|
||||
let rawValue = new Date(2015, 6, 15, 21, 43, 11); // Wed Jul 15 2015 21:43:11 GMT+0100 (BST);
|
||||
|
||||
let file = new FileNode();
|
||||
file.entry.createdAt = rawValue;
|
||||
@ -190,7 +190,7 @@ describe('ShareDataTableAdapter', () => {
|
||||
it('should log error when having date conversion issues', () => {
|
||||
let dateValue = '[wrong-date]';
|
||||
let file = new FileNode();
|
||||
file.entry.createdAt = dateValue;
|
||||
file.entry.createdAt = <any> dateValue;
|
||||
|
||||
let col = <DataColumn> {
|
||||
key: 'createdAt',
|
||||
|
@ -23,7 +23,7 @@ import {
|
||||
DataRow, DataColumn, DataSorting
|
||||
} from 'ng2-alfresco-datatable';
|
||||
|
||||
import { NodePaging, MinimalNodeEntity } from './../models/document-library.model';
|
||||
import { NodePaging, NodeMinimalEntry } from './../models/document-library.model';
|
||||
import { DocumentListService } from './../services/document-list.service';
|
||||
|
||||
export class ShareDataTableAdapter implements DataTableAdapter, PaginationProvider {
|
||||
@ -305,11 +305,11 @@ export class ShareDataRow implements DataRow {
|
||||
|
||||
isSelected: boolean = false;
|
||||
|
||||
get node(): MinimalNodeEntity {
|
||||
get node(): NodeMinimalEntry {
|
||||
return this.obj;
|
||||
}
|
||||
|
||||
constructor(private obj: MinimalNodeEntity) {
|
||||
constructor(private obj: NodeMinimalEntry) {
|
||||
if (!obj) {
|
||||
throw new Error(ShareDataRow.ERR_OBJECT_NOT_FOUND);
|
||||
}
|
||||
|
@ -17,18 +17,19 @@
|
||||
|
||||
// note: contains only limited subset of available fields
|
||||
|
||||
import { MinimalNodeEntity, MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
|
||||
export class NodePaging {
|
||||
list: NodePagingList;
|
||||
}
|
||||
|
||||
export class NodePagingList {
|
||||
pagination: Pagination;
|
||||
entries: MinimalNodeEntity[];
|
||||
entries: NodeMinimalEntry[];
|
||||
}
|
||||
|
||||
// TODO: rename to NodeMinimalEntry
|
||||
export class MinimalNodeEntity {
|
||||
entry: MinimalNodeEntryEntity;
|
||||
export class NodeMinimalEntry implements MinimalNodeEntity {
|
||||
entry: NodeMinimal;
|
||||
}
|
||||
|
||||
export class Pagination {
|
||||
@ -39,17 +40,16 @@ export class Pagination {
|
||||
maxItems: number;
|
||||
}
|
||||
|
||||
// TODO: rename to NodeMinimal
|
||||
export class MinimalNodeEntryEntity {
|
||||
export class NodeMinimal implements MinimalNodeEntryEntity {
|
||||
id: string;
|
||||
parentId: string;
|
||||
name: string;
|
||||
nodeType: string;
|
||||
isFolder: boolean;
|
||||
isFile: boolean;
|
||||
modifiedAt: string;
|
||||
modifiedAt: Date;
|
||||
modifiedByUser: UserInfo;
|
||||
createdAt: string;
|
||||
createdAt: Date;
|
||||
createdByUser: UserInfo;
|
||||
content: ContentInfo;
|
||||
path: PathInfoEntity;
|
||||
|
Loading…
x
Reference in New Issue
Block a user