diff --git a/demo-shell-ng2/app/components/datatable/datatable-demo.component.html b/demo-shell-ng2/app/components/datatable/datatable-demo.component.html index 9bcf32654a..2f90bb4f18 100644 --- a/demo-shell-ng2/app/components/datatable/datatable-demo.component.html +++ b/demo-shell-ng2/app/components/datatable/datatable-demo.component.html @@ -8,6 +8,11 @@
+ + + + +
+ + `, + styles: [ + ':host > .container {padding: 10px}', + '.p-10 { padding: 10px; }' + ], + directives: [ALFRESCO_DATATABLE_DIRECTIVES] +}) +class DataTableDemo { + + multiselect: boolean = false; + data: ObjectDataTableAdapter; + + private _imageUrl: string = 'http://placehold.it/140x100'; + private _createdBy: any = { + name: 'Denys Vuika', + email: 'denys.vuika@alfresco.com' + }; + + constructor() { + this.reset(); + } + + reset() { + this.data = new ObjectDataTableAdapter( + [ + {id: 1, name: 'Name 1', createdBy: this._createdBy, icon: 'material-icons://folder_open'}, + {id: 2, name: 'Name 2', createdBy: this._createdBy, icon: 'material-icons://accessibility'}, + {id: 3, name: 'Name 3', createdBy: this._createdBy, icon: 'material-icons://alarm'}, + {id: 4, name: 'Image 1', createdBy: this._createdBy, icon: this._imageUrl} + ], + [ + {type: 'image', key: 'icon', title: '', srTitle: 'Thumbnail'}, + {type: 'text', key: 'id', title: 'Id', sortable: true}, + {type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true}, + {type: 'text', key: 'createdBy.name', title: 'Created By', sortable: true} + ] + ); + + this.data.setSorting(new DataSorting('id', 'asc')); + } + + addRow() { + let id = this.data.getRows().length + 1; + let row = new ObjectDataRow({ + id: id, + name: 'Name ' + id, + icon: 'material-icons://extension', + createdBy: this._createdBy + }); + this.data.getRows().push(row); + this.data.sort(); + } + + replaceRows() { + let objects = [ + {id: 10, name: 'Name 10', createdBy: this._createdBy, icon: 'material-icons://face'}, + {id: 11, name: 'Name 11', createdBy: this._createdBy, icon: 'material-icons://language'}, + {id: 12, name: 'Name 12', createdBy: this._createdBy, icon: 'material-icons://pets'}, + {id: 13, name: 'Image 13', createdBy: this._createdBy, icon: this._imageUrl} + ]; + let rows = objects.map(obj => new ObjectDataRow(obj)); + this.data.setRows(rows); + } + + replaceColumns() { + let schema = [ + { type: 'text', key: 'id', title: 'Id', sortable: true }, + { type: 'text', key: 'name', title: 'Name', sortable: true, cssClass: 'full-width name-column' } + ]; + let columns = schema.map(col => new ObjectDataColumn(col)); + this.data.setColumns(columns); + } +} + +bootstrap(DataTableDemo, []); diff --git a/ng2-components/ng2-alfresco-datatable/demo/tsconfig.json b/ng2-components/ng2-alfresco-datatable/demo/tsconfig.json new file mode 100644 index 0000000000..f6761b5218 --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/demo/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "target": "ES5", + "module": "system", + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "sourceMap": true, + "removeComments": true, + "declaration": true, + "outDir": "dist" + }, + "exclude": [ + "dist", + "node_modules", + "typings/main", + "typings/main.d.ts" + ] +} diff --git a/ng2-components/ng2-alfresco-datatable/demo/tslint.json b/ng2-components/ng2-alfresco-datatable/demo/tslint.json new file mode 100644 index 0000000000..8c48e76469 --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/demo/tslint.json @@ -0,0 +1,124 @@ +{ + "rules": { + "align": [ + true, + "parameters", + "arguments", + "statements" + ], + "ban": false, + "class-name": true, + "comment-format": [ + true, + "check-space", + "check-lowercase" + ], + "curly": true, + "eofline": true, + "forin": true, + "indent": [ + true, + "spaces" + ], + "interface-name": false, + "jsdoc-format": true, + "label-position": true, + "label-undefined": true, + "max-line-length": [ + true, + 140 + ], + "member-ordering": [ + true, + "public-before-private", + "static-before-instance", + "variables-before-functions" + ], + "no-any": false, + "no-arg": true, + "no-bitwise": true, + "no-conditional-assignment": true, + "no-consecutive-blank-lines": false, + "no-console": [ + true, + "debug", + "info", + "time", + "timeEnd", + "trace" + ], + "no-construct": true, + "no-constructor-vars": false, + "no-debugger": true, + "no-duplicate-key": true, + "no-duplicate-variable": true, + "no-empty": true, + "no-eval": true, + "no-inferrable-types": false, + "no-internal-module": true, + "no-require-imports": true, + "no-shadowed-variable": true, + "no-switch-case-fall-through": true, + "no-trailing-whitespace": true, + "no-unreachable": true, + "no-unused-expression": true, + "no-unused-variable": true, + "no-use-before-declare": true, + "no-var-keyword": true, + "no-var-requires": true, + "object-literal-sort-keys": false, + "one-line": [ + true, + "check-open-brace", + "check-catch", + "check-else", + "check-whitespace" + ], + "quotemark": [ + true, + "single", + "avoid-escape" + ], + "radix": true, + "semicolon": true, + "switch-default": true, + "trailing-comma": [ + true, + { + "multiline": "never", + "singleline": "never" + } + ], + "triple-equals": [ + true, + "allow-null-check" + ], + "typedef": false, + "typedef-whitespace": [ + true, + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + } + ], + "use-strict": false, + "variable-name": [ + true, + "check-format", + "allow-leading-underscore", + "ban-keywords" + ], + "whitespace": [ + true, + "check-branch", + "check-operator", + "check-separator", + "check-type", + "check-module", + "check-decl" + ] + } +} diff --git a/ng2-components/ng2-alfresco-datatable/demo/typings.json b/ng2-components/ng2-alfresco-datatable/demo/typings.json new file mode 100644 index 0000000000..39a2ebcc56 --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/demo/typings.json @@ -0,0 +1,9 @@ +{ + "name": "angular2-testing", + "dependencies": {}, + "devDependencies": {}, + "ambientDependencies": { + "es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#4de74cb527395c13ba20b438c3a7a419ad931f1c", + "jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#dd638012d63e069f2c99d06ef4dcc9616a943ee4" + } +} diff --git a/ng2-components/ng2-alfresco-documentlist/demo/README.md b/ng2-components/ng2-alfresco-documentlist/demo/README.md index b2f1f84151..3dbe6c7a0b 100644 --- a/ng2-components/ng2-alfresco-documentlist/demo/README.md +++ b/ng2-components/ng2-alfresco-documentlist/demo/README.md @@ -1,4 +1,4 @@ -# Document List demo +# DocumentList demo Install: