Upgrade document list to angular 2.0.0-rc.1

This commit is contained in:
Denys Vuika
2016-06-14 05:37:46 +01:00
parent 2ab2b5bbb0
commit fe9e8cdc43
22 changed files with 121 additions and 112 deletions

View File

@@ -11,7 +11,15 @@
<link rel="stylesheet" href="node_modules/material-design-icons/iconfont/material-icons.css">
<!-- 1. Load libraries -->
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<!-- IE required polyfills, in this exact order -->
<!--
<script src="node_modules/es6-shim/es6-shim.min.js"></script>
<script src="node_modules/systemjs/dist/system-polyfills.js"></script>
<script src="node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script>
@@ -21,6 +29,7 @@
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="node_modules/angular2/bundles/router.dev.js"></script>
<script src="node_modules/angular2/bundles/http.dev.js"></script>
-->
<!-- Additional Alfresco libraries -->
<script src="node_modules/alfresco-js-api/bundle.js"></script>

View File

@@ -16,15 +16,27 @@
},
"license": "Apache-2.0",
"dependencies": {
"angular2": "2.0.0-beta.15",
"es6-promise": "3.0.2",
"es6-shim": "0.35.0",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.2",
"@angular/common": "2.0.0-rc.1",
"@angular/compiler": "2.0.0-rc.1",
"@angular/core": "2.0.0-rc.1",
"@angular/http": "2.0.0-rc.1",
"@angular/platform-browser": "2.0.0-rc.1",
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
"@angular/router": "2.0.0-rc.1",
"@angular/router-deprecated": "2.0.0-rc.1",
"@angular/upgrade": "2.0.0-rc.1",
"systemjs": "0.19.27",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12",
"angular2-in-memory-web-api": "0.0.11",
"material-design-icons": "^2.2.3",
"material-design-lite": "^1.1.3",
"zone.js": "0.6.10",
"ng2-alfresco-documentlist": "^0.1.16"
"ng2-alfresco-documentlist": "^0.1.16",
"alfresco-js-api": "^0.1.0",
"ng2-translate": "2.1.0"
},
"devDependencies": {
"browser-sync": "^2.10.0",
@@ -32,7 +44,7 @@
"concurrently": "^2.0.0",
"tslint": "^3.8.1",
"typescript": "^1.8.10",
"typings": "^0.7.12"
"typings": "^1.0.4"
},
"keywords": [
"angular2",

View File

@@ -15,9 +15,9 @@
* limitations under the License.
*/
import { Component, OnInit } from 'angular2/core';
import { bootstrap } from 'angular2/platform/browser';
import { HTTP_PROVIDERS } from 'angular2/http';
import { Component, OnInit } from '@angular/core';
import { bootstrap } from '@angular/platform-browser-dynamic';
import { HTTP_PROVIDERS } from '@angular/http';
import {
ALFRESCO_CORE_PROVIDERS,

View File

@@ -1,48 +1,55 @@
/**
* @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.
* System configuration for Angular 2 samples
* Adjust as necessary for your application needs.
*/
(function(global) {
// map tells the System loader where to look for things
var map = {
'app': 'dist', // 'dist',
'@angular': 'node_modules/@angular',
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
'rxjs': 'node_modules/rxjs',
'ng2-translate': 'node_modules/ng2-translate',
'ng2-alfresco-core': 'node_modules/ng2-alfresco-core',
'ng2-alfresco-documentlist': 'node_modules/ng2-alfresco-documentlist',
'rxjs': 'node_modules/rxjs',
'angular2' : 'node_modules/angular2',
'app': 'dist/main'
'ng2-alfresco-documentlist': 'node_modules/ng2-alfresco-documentlist'
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'app': { format: 'register', defaultExtension: 'js' },
'app': { main: 'main.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' },
'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },
'ng2-translate': { defaultExtension: 'js' },
'ng2-alfresco-core': { defaultExtension: 'js' },
'ng2-alfresco-documentlist': { defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' },
'angular2': { defaultExtension: 'js' }
'ng2-alfresco-documentlist': { defaultExtension: 'js' }
};
var ngPackageNames = [
'common',
'compiler',
'core',
'http',
'platform-browser',
'platform-browser-dynamic',
'router',
'router-deprecated',
'upgrade'
];
// Individual files (~300 requests):
function packIndex(pkgName) {
packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' };
}
// Bundled (~40 requests):
function packUmd(pkgName) {
packages['@angular/'+pkgName] = { main: pkgName + '.umd.js', defaultExtension: 'js' };
}
// Most environments should use UMD; some (Karma) need the individual index files
var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
// Add package entries for angular packages
ngPackageNames.forEach(setPackageConfig);
var config = {
defaultJSExtensions: true,
map: map,
packages: packages
};
System.config(config);
})(this);

View File

@@ -54,16 +54,25 @@
"alfresco"
],
"dependencies": {
"angular2": "2.0.0-beta.15",
"es6-module-loader": "^0.17.8",
"es6-shim": "^0.35.0",
"ng2-alfresco-core": "^0.1.0",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.2",
"systemjs": "0.19.26",
"@angular/common": "2.0.0-rc.1",
"@angular/compiler": "2.0.0-rc.1",
"@angular/core": "2.0.0-rc.1",
"@angular/http": "2.0.0-rc.1",
"@angular/platform-browser": "2.0.0-rc.1",
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
"@angular/router": "2.0.0-rc.1",
"@angular/router-deprecated": "2.0.0-rc.1",
"@angular/upgrade": "2.0.0-rc.1",
"systemjs": "0.19.27",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12",
"angular2-in-memory-web-api": "0.0.11",
"ng2-alfresco-core": "^0.1.0",
"alfresco-js-api": "^0.1.0",
"ng2-translate": "1.11.1"
"ng2-translate": "2.1.0"
},
"devDependencies": {
"concurrently": "^2.1.0",

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import {Component} from 'angular2/core';
import {Component} from '@angular/core';
import {DocumentList} from './document-list';
import {ContentActionModel} from './../models/content-action.model';

View File

@@ -20,8 +20,8 @@ import {
describe,
expect,
beforeEach
} from 'angular2/testing';
import {EventEmitter} from 'angular2/core';
} from '@angular/core/testing';
import {EventEmitter} from '@angular/core';
import {DocumentList} from './document-list';
import {AlfrescoServiceMock} from '../assets/alfresco.service.mock';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import {Component, OnInit, OnChanges, Input, Output, EventEmitter} from 'angular2/core';
import {Component, OnInit, OnChanges, Input, Output, EventEmitter} from '@angular/core';
import {ContentActionModel} from './../models/content-action.model';
import {ContentActionList} from './content-action-list';
import {DocumentActionsService} from '../services/document-actions.service';

View File

@@ -20,7 +20,7 @@ import {
describe,
expect,
beforeEach
} from 'angular2/testing';
} from '@angular/core/testing';
import {DocumentList} from './document-list';
import {AlfrescoServiceMock} from '../assets/alfresco.service.mock';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import {Component} from 'angular2/core';
import {Component} from '@angular/core';
import {DocumentList} from './document-list';
import {ContentColumnModel} from './../models/content-column.model';

View File

@@ -20,7 +20,7 @@ import {
describe,
expect,
beforeEach
} from 'angular2/testing';
} from '@angular/core/testing';
import {DocumentList} from './document-list';
import {ContentColumn} from './content-column';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, OnInit, Input, OnChanges } from 'angular2/core';
import { Component, OnInit, Input, OnChanges } from '@angular/core';
import { ContentColumnList } from './content-column-list';
import { ContentColumnModel } from './../models/content-column.model';

View File

@@ -1,5 +1,5 @@
<ol *ngIf="breadcrumb" data-automation-id="breadcrumb" class="breadcrumb">
<li *ngFor="#r of route; #last = last" [class.active]="last" [ngSwitch]="last">
<li *ngFor="let r of route; let last = last" [class.active]="last" [ngSwitch]="last">
<span *ngSwitchWhen="true">{{r.name}}</span>
<a *ngSwitchDefault href="#" [attr.data-automation-id]="'breadcrumb_' + r.name" (click)="goToRoute(r, $event)">{{r.name}}</a>
</li>
@@ -9,7 +9,7 @@
<tr>
<!-- Columns -->
<th class="mdl-data-table__cell--non-numeric non-selectable {{col.cssClass}}"
*ngFor="#col of columns"
*ngFor="let col of columns"
[class.column-header]="col.title"
[attr.data-automation-id]="'auto_id_' + col.source"
[class.mdl-data-table__header--sorted-ascending]="sorting.key === col.source && sorting.direction === 'asc'"
@@ -37,10 +37,10 @@
</td>
</tr>
<tr *ngFor="#content of folder.list.entries; #idx = index"
<tr *ngFor="let content of folder.list.entries; let idx = index"
[attr.data-automation-id]="getObjectValue(content.entry, 'name')">
<!-- Columns -->
<td *ngFor="#col of columns" [ngSwitch]="col.type"
<td *ngFor="let col of columns" [ngSwitch]="col.type"
class="mdl-data-table__cell--non-numeric non-selectable data-cell {{col.cssClass}}"
(click)="onItemClick(content, $event)"
(dblclick)="onItemDblClick(content, $event)"
@@ -61,7 +61,7 @@
<td *ngIf="content.entry.isFolder">
<!-- action buttons -->
<button class="mdl-button mdl-js-button mdl-button--icon"
*ngFor="#action of getContentActions('folder', 'button')"
*ngFor="let action of getContentActions('folder', 'button')"
(click)="executeContentAction(content, action)">
<i class="material-icons">{{action.icon}}</i>
</button>
@@ -74,7 +74,7 @@
[attr.for]="'folder_action_menu_' + idx">
<li class="mdl-menu__item"
[attr.data-automation-id]="action.title"
*ngFor="#action of getContentActions('folder', 'menu')"
*ngFor="let action of getContentActions('folder', 'menu')"
(click)="executeContentAction(content, action)">
{{action.title}}
</li>
@@ -84,7 +84,7 @@
<td *ngIf="!content.entry.isFolder">
<!-- action buttons -->
<button class="mdl-button mdl-js-button mdl-button--icon"
*ngFor="#action of getContentActions('document', 'button')"
*ngFor="let action of getContentActions('document', 'button')"
(click)="executeContentAction(content, action)">
<i class="material-icons">{{action.icon}}</i>
</button>
@@ -97,7 +97,7 @@
[attr.for]="'document_action_menu_' + idx">
<li class="mdl-menu__item"
[attr.data-automation-id]="action.title"
*ngFor="#action of getContentActions('document', 'menu')"
*ngFor="let action of getContentActions('document', 'menu')"
(click)="executeContentAction(content, action)">
{{action.title}}
</li>

View File

@@ -20,7 +20,7 @@ import {
describe,
expect,
beforeEach
} from 'angular2/testing';
} from '@angular/core/testing';
import { DocumentList } from './document-list';
import { ContentColumnModel } from '../models/content-column.model';

View File

@@ -25,8 +25,8 @@ import {
AfterViewChecked,
OnChanges,
TemplateRef
} from 'angular2/core';
import { DatePipe } from 'angular2/common';
} from '@angular/core';
import { DatePipe } from '@angular/common';
import { Subject } from 'rxjs/Rx';
import { CONTEXT_MENU_DIRECTIVES } from 'ng2-alfresco-core/dist/ng2-alfresco-core';
import { AlfrescoService } from './../services/alfresco.service';
@@ -92,7 +92,7 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit,
actions: ContentActionModel[] = [];
columns: ContentColumnModel[] = [];
emptyFolderTemplate: TemplateRef;
emptyFolderTemplate: TemplateRef<any>;
private _folder: NodePaging;
@@ -469,9 +469,7 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit,
if (col.type === 'date') {
let datePipe = new DatePipe();
if (datePipe.supports(value)) {
// TODO: to be changed to plan non-array value post angular2 beta.15
let pattern = col.format ? [col.format] : [];
return datePipe.transform(value, pattern);
return datePipe.transform(value, col.format);
}
}

View File

@@ -21,7 +21,7 @@ import {
TemplateRef,
OnInit,
AfterContentInit
} from 'angular2/core';
} from '@angular/core';
import { DocumentList } from './document-list';
@Directive({

View File

@@ -15,8 +15,8 @@
* limitations under the License.
*/
import { Injectable } from 'angular2/core';
import { Response } from 'angular2/http';
import { Injectable } from '@angular/core';
import { Response } from '@angular/http';
import { Observable } from 'rxjs/Rx';
import { NodePaging, MinimalNodeEntity } from './../models/document-library.model';
import {

View File

@@ -1,26 +0,0 @@
/*!
* @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.
*/
/*
import {Injectable} from 'angular2/core';
import {Subject} from 'rxjs/Rx';
@Injectable()
export class ContextMenuService {
public show: Subject<{event: MouseEvent, obj: any[]}> = new Subject();
}
*/

View File

@@ -20,7 +20,7 @@ import {
describe,
expect,
beforeEach
} from 'angular2/testing';
} from '@angular/core/testing';
import {ContentActionHandler} from '../models/content-action.model';
import {DocumentActionsService} from './document-actions.service';
import {AlfrescoServiceMock} from '../assets/alfresco.service.mock';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import {Injectable} from 'angular2/core';
import {Injectable} from '@angular/core';
import {ContentActionHandler} from '../models/content-action.model';
import {AlfrescoService} from './alfresco.service';
import {

View File

@@ -20,7 +20,7 @@ import {
describe,
expect,
beforeEach
} from 'angular2/testing';
} from '@angular/core/testing';
import {FolderActionsService} from './folder-actions.service';
import {ContentActionHandler} from '../models/content-action.model';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import {Injectable} from 'angular2/core';
import {Injectable} from '@angular/core';
import {ContentActionHandler} from '../models/content-action.model';
import {AlfrescoService} from './alfresco.service';