Upgrade DataTable to angular 2.0.0-rc.1

This commit is contained in:
Denys Vuika
2016-06-14 06:22:07 +01:00
parent 5bb011564e
commit a6cff4f235
10 changed files with 83 additions and 75 deletions

View File

@@ -11,16 +11,12 @@
<link rel="stylesheet" href="node_modules/material-design-icons/iconfont/material-icons.css"> <link rel="stylesheet" href="node_modules/material-design-icons/iconfont/material-icons.css">
<!-- 1. Load libraries --> <!-- 1. Load libraries -->
<!-- IE required polyfills, in this exact order --> <!-- 1. Load libraries -->
<script src="node_modules/es6-shim/es6-shim.min.js"></script> <!-- Polyfill(s) for older browsers -->
<script src="node_modules/systemjs/dist/system-polyfills.js"></script> <script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script> <script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script> <script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script> <script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<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>
<script src="systemjs.config.js"></script> <script src="systemjs.config.js"></script>
<script> <script>

View File

@@ -22,14 +22,24 @@
}, },
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"angular2": "2.0.0-beta.15", "@angular/common": "2.0.0-rc.1",
"es6-promise": "3.0.2", "@angular/compiler": "2.0.0-rc.1",
"es6-shim": "0.35.0", "@angular/core": "2.0.0-rc.1",
"reflect-metadata": "0.1.2", "@angular/http": "2.0.0-rc.1",
"rxjs": "5.0.0-beta.2", "@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-icons": "^2.2.3",
"material-design-lite": "^1.1.3", "material-design-lite": "^1.1.3",
"zone.js": "0.6.10",
"ng2-alfresco-datatable": "^0.1.0" "ng2-alfresco-datatable": "^0.1.0"
}, },
"devDependencies": { "devDependencies": {
@@ -37,7 +47,7 @@
"concurrently": "^2.0.0", "concurrently": "^2.0.0",
"tslint": "^3.8.1", "tslint": "^3.8.1",
"typescript": "^1.8.10", "typescript": "^1.8.10",
"typings": "^0.7.12", "typings": "^1.0.4",
"wsrv": "^0.1.0" "wsrv": "^0.1.0"
}, },
"keywords": [ "keywords": [

View File

@@ -15,8 +15,8 @@
* limitations under the License. * limitations under the License.
*/ */
import { Component } from 'angular2/core'; import { Component } from '@angular/core';
import { bootstrap } from 'angular2/platform/browser'; import { bootstrap } from '@angular/platform-browser-dynamic';
import { import {
ALFRESCO_DATATABLE_DIRECTIVES, ALFRESCO_DATATABLE_DIRECTIVES,
ObjectDataTableAdapter, ObjectDataTableAdapter,

View File

@@ -1,44 +1,51 @@
/** /**
* @license * System configuration for Angular 2 samples
* Copyright 2016 Alfresco Software, Ltd. * Adjust as necessary for your application needs.
*
* 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.
*/ */
(function(global) {
(function (global) {
// map tells the System loader where to look for things // map tells the System loader where to look for things
var map = { var map = {
'ng2-alfresco-datatable': 'node_modules/ng2-alfresco-datatable', 'app': 'dist', // 'dist',
'rxjs': 'node_modules/rxjs', '@angular': 'node_modules/@angular',
'angular2' : 'node_modules/angular2', 'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
'app': 'dist/main' 'rxjs': 'node_modules/rxjs',
};
'ng2-alfresco-datatable': 'node_modules/ng2-alfresco-datatable'
};
// packages tells the System loader how to load when no filename and/or no extension // packages tells the System loader how to load when no filename and/or no extension
var packages = { var packages = {
'app': { format: 'register', defaultExtension: 'js' }, 'app': { main: 'main.js', defaultExtension: 'js' },
'ng2-alfresco-datatable': { defaultExtension: 'js' }, 'rxjs': { defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' }, 'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },
'angular2': { defaultExtension: 'js' }
};
'ng2-alfresco-datatable': { 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 = { var config = {
defaultJSExtensions: true,
map: map, map: map,
packages: packages packages: packages
}; };
System.config(config); System.config(config);
})(this); })(this);

View File

@@ -48,13 +48,21 @@
"alfresco" "alfresco"
], ],
"dependencies": { "dependencies": {
"angular2": "2.0.0-beta.15", "@angular/common": "2.0.0-rc.1",
"systemjs": "0.19.26", "@angular/compiler": "2.0.0-rc.1",
"es6-shim": "^0.35.0", "@angular/core": "2.0.0-rc.1",
"reflect-metadata": "0.1.2", "@angular/http": "2.0.0-rc.1",
"rxjs": "5.0.0-beta.2", "@angular/platform-browser": "2.0.0-rc.1",
"zone.js": "^0.6.12", "@angular/platform-browser-dynamic": "2.0.0-rc.1",
"es6-module-loader": "^0.17.8" "@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"
}, },
"peerDependencies": { "peerDependencies": {
"material-design-icons": "^2.2.3", "material-design-icons": "^2.2.3",
@@ -76,7 +84,7 @@
"traceur": "^0.0.91", "traceur": "^0.0.91",
"tslint": "^3.8.1", "tslint": "^3.8.1",
"typescript": "^1.8.10", "typescript": "^1.8.10",
"typings": "^0.7.12", "typings": "^1.0.4",
"wsrv": "^0.1.0" "wsrv": "^0.1.0"
}, },
"license-check-config": { "license-check-config": {

View File

@@ -14,7 +14,7 @@
</label> </label>
</th> </th>
<th class="mdl-data-table__cell--non-numeric non-selectable {{col.cssClass}}" <th class="mdl-data-table__cell--non-numeric non-selectable {{col.cssClass}}"
*ngFor="#col of data.getColumns()" *ngFor="let col of data.getColumns()"
[class.column-header]="col.title" [class.column-header]="col.title"
[class.mdl-data-table__header--sorted-ascending]="isColumnSorted(col, 'asc')" [class.mdl-data-table__header--sorted-ascending]="isColumnSorted(col, 'asc')"
[class.mdl-data-table__header--sorted-descending]="isColumnSorted(col, 'desc')" [class.mdl-data-table__header--sorted-descending]="isColumnSorted(col, 'desc')"
@@ -30,7 +30,7 @@
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="#row of data.getRows(); #idx = index"> <tr *ngFor="let row of data.getRows(); let idx = index">
<td *ngIf="multiselect"> <td *ngIf="multiselect">
<label <label
class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect mdl-data-table__select" class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect mdl-data-table__select"
@@ -39,7 +39,7 @@
<input type="checkbox" [attr.id]="'row[' + idx + ']'" class="mdl-checkbox__input" [(ngModel)]="row.isSelected" /> <input type="checkbox" [attr.id]="'row[' + idx + ']'" class="mdl-checkbox__input" [(ngModel)]="row.isSelected" />
</label> </label>
</td> </td>
<td *ngFor="#col of data.getColumns()" [ngSwitch]="col.type" <td *ngFor="let col of data.getColumns()" [ngSwitch]="col.type"
class="mdl-data-table__cell--non-numeric non-selectable data-cell {{col.cssClass}}" class="mdl-data-table__cell--non-numeric non-selectable data-cell {{col.cssClass}}"
(click)="onRowClick(row, $event)" (dblclick)="onRowDblClick(row, $event)"> (click)="onRowClick(row, $event)" (dblclick)="onRowDblClick(row, $event)">
<div *ngSwitchWhen="'image'"> <div *ngSwitchWhen="'image'">

View File

@@ -20,7 +20,7 @@ import {
describe, describe,
expect, expect,
beforeEach beforeEach
} from 'angular2/testing'; } from '@angular/core/testing';
import { DataTableComponent } from './datatable.component'; import { DataTableComponent } from './datatable.component';
import { import {

View File

@@ -23,7 +23,7 @@ import {
Output, Output,
EventEmitter, EventEmitter,
AfterViewChecked AfterViewChecked
} from 'angular2/core'; } from '@angular/core';
import { import {
DataTableAdapter, DataTableAdapter,

View File

@@ -19,7 +19,7 @@ import {
it, it,
describe, describe,
expect expect
} from 'angular2/testing'; } from '@angular/core/testing';
import { import {
DataColumn, DataColumn,

View File

@@ -18,19 +18,6 @@
<script src="node_modules/reflect-metadata/Reflect.js"></script> <script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.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>
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<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 --> <!-- Additional Alfresco libraries -->
<script src="node_modules/alfresco-js-api/bundle.js"></script> <script src="node_modules/alfresco-js-api/bundle.js"></script>