mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-859] add codelyzer in core and datatable (#2056)
* add codelyzer in core and datatable * add codelyzer in the main build * order imports * fix import in test * fix import test * import reorder form * tasklist and processlist import reorder
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
* [DataColumn Properties](#datacolumn-properties)
|
||||
* [DataTable Events](#datatable-events)
|
||||
* [DataTable DOM Events](#datatable-dom-events)
|
||||
* [Default Empty content template](#default-empty-content-template)
|
||||
* [Custom Empty content template](#custom-empty-content-template)
|
||||
* [Default Empty content template](#default-empty-content-template)
|
||||
* [Loading content template](#loading-content-template)
|
||||
* [Column Templates](#column-templates)
|
||||
* [Events](#events)
|
||||
|
@@ -42,7 +42,8 @@ module.exports = {
|
||||
loader: 'tslint-loader',
|
||||
options: {
|
||||
emitErrors: true,
|
||||
failOnHint: true
|
||||
failOnHint: true,
|
||||
fix: true
|
||||
},
|
||||
exclude: [/node_modules/, /bundles/, /dist/, /demo/]
|
||||
},
|
||||
@@ -74,7 +75,7 @@ module.exports = {
|
||||
emitErrors: true,
|
||||
licenseFile: path.resolve(__dirname, './assets/license_header.txt')
|
||||
},
|
||||
exclude: [/node_modules/, /bundles/, /dist/, /demo/, /rendering-queue.services.ts/ ],
|
||||
exclude: [/node_modules/, /bundles/, /dist/, /demo/, /rendering-queue.services.ts/],
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
|
||||
@@ -132,9 +133,9 @@ module.exports = {
|
||||
}
|
||||
}),
|
||||
new webpack.LoaderOptionsPlugin({
|
||||
htmlLoader: {
|
||||
minimize: false // workaround for ng2
|
||||
}
|
||||
htmlLoader: {
|
||||
minimize: false // workaround for ng2
|
||||
}
|
||||
})
|
||||
],
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { NgModule, ModuleWithProviders } from '@angular/core';
|
||||
import { ModuleWithProviders, NgModule } from '@angular/core';
|
||||
import { CoreModule } from 'ng2-alfresco-core';
|
||||
import { MaterialModule } from './src/material.module';
|
||||
|
||||
@@ -23,25 +23,25 @@ export * from './src/data/index';
|
||||
|
||||
export { DataTableCellComponent } from './src/components/datatable/datatable-cell.component';
|
||||
export { DataTableComponent } from './src/components/datatable/datatable.component';
|
||||
export { AdfEmptyList } from './src/components/datatable/adf-empty-list.component';
|
||||
export { AdfEmptyListComponent } from './src/components/datatable/adf-empty-list.component';
|
||||
export { PaginationComponent } from './src/components/pagination/pagination.component';
|
||||
export { DataCellEvent, DataCellEventModel } from './src/components/datatable/data-cell.event';
|
||||
export { DataRowActionEvent, DataRowActionModel } from './src/components/datatable/data-row-action.event';
|
||||
|
||||
import { DataTableComponent } from './src/components/datatable/datatable.component';
|
||||
import { AdfEmptyList } from './src/components/datatable/adf-empty-list.component';
|
||||
import { NoContentTemplateComponent } from './src/directives/no-content-template.component';
|
||||
import { LoadingContentTemplateComponent } from './src/directives/loading-template.component';
|
||||
import { PaginationComponent } from './src/components/pagination/pagination.component';
|
||||
import { AdfEmptyListComponent } from './src/components/datatable/adf-empty-list.component';
|
||||
import { DataTableCellComponent } from './src/components/datatable/datatable-cell.component';
|
||||
import { DataTableComponent } from './src/components/datatable/datatable.component';
|
||||
import { PaginationComponent } from './src/components/pagination/pagination.component';
|
||||
import { LoadingContentTemplateDirective } from './src/directives/loading-template.directive';
|
||||
import { NoContentTemplateDirective } from './src/directives/no-content-template.directive';
|
||||
|
||||
export function directives() {
|
||||
return [
|
||||
DataTableComponent,
|
||||
AdfEmptyList,
|
||||
AdfEmptyListComponent,
|
||||
DataTableCellComponent,
|
||||
NoContentTemplateComponent,
|
||||
LoadingContentTemplateComponent,
|
||||
NoContentTemplateDirective,
|
||||
LoadingContentTemplateDirective,
|
||||
PaginationComponent
|
||||
];
|
||||
}
|
||||
|
4283
ng2-components/ng2-alfresco-datatable/package-lock.json
generated
4283
ng2-components/ng2-alfresco-datatable/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -60,6 +60,7 @@
|
||||
"@types/node": "6.0.45",
|
||||
"angular2-template-loader": "0.6.2",
|
||||
"autoprefixer": "6.5.4",
|
||||
"codelyzer": "3.1.2",
|
||||
"copy-webpack-plugin": "4.0.1",
|
||||
"css-loader": "0.23.1",
|
||||
"css-to-string-loader": "0.1.2",
|
||||
|
@@ -15,13 +15,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { CoreModule } from 'ng2-alfresco-core';
|
||||
import { AdfEmptyList } from './adf-empty-list.component';
|
||||
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
||||
import { AdfEmptyListComponent } from './adf-empty-list.component';
|
||||
|
||||
describe('AdfEmptyListComponent', () => {
|
||||
let component: AdfEmptyList;
|
||||
let fixture: ComponentFixture<AdfEmptyList>;
|
||||
describe('AdfEmptyListComponentComponent', () => {
|
||||
let component: AdfEmptyListComponent;
|
||||
let fixture: ComponentFixture<AdfEmptyListComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
@@ -29,11 +29,11 @@ describe('AdfEmptyListComponent', () => {
|
||||
CoreModule.forRoot()
|
||||
],
|
||||
declarations: [
|
||||
AdfEmptyList
|
||||
AdfEmptyListComponent
|
||||
]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(AdfEmptyList);
|
||||
fixture = TestBed.createComponent(AdfEmptyListComponent);
|
||||
component = fixture.componentInstance;
|
||||
}));
|
||||
|
||||
|
@@ -22,7 +22,7 @@ import { Component, Input } from '@angular/core';
|
||||
styleUrls: ['./adf-empty-list.component.css'],
|
||||
templateUrl: './adf-empty-list.component.html'
|
||||
})
|
||||
export class AdfEmptyList {
|
||||
export class AdfEmptyListComponent {
|
||||
|
||||
@Input()
|
||||
emptyListImageUrl: string = require('../../assets/images/empty_doc_lib.svg');
|
||||
|
@@ -15,15 +15,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, Input, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { DataTableAdapter, DataColumn, DataRow } from '../../data/datatable-adapter';
|
||||
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
|
||||
import { DataColumn, DataRow, DataTableAdapter } from '../../data/datatable-adapter';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-datatable-cell, alfresco-datatable-cell',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
template: '<ng-container>{{value}}</ng-container>'
|
||||
})
|
||||
export class DataTableCellComponent {
|
||||
export class DataTableCellComponent implements OnInit {
|
||||
|
||||
@Input()
|
||||
data: DataTableAdapter;
|
||||
|
@@ -40,7 +40,7 @@
|
||||
<!-- Actions (left) -->
|
||||
<td *ngIf="actions && actionsPosition === 'left'" class="alfresco-datatable__actions-cell">
|
||||
<button [id]="'action_menu_' + idx" alfresco-mdl-button class="mdl-button--icon"
|
||||
[attr.data-automation-id]="actions_menu">
|
||||
[attr.data-automation-id]="'action_menu_' + idx">
|
||||
<i class="material-icons">more_vert</i>
|
||||
</button>
|
||||
<ul alfresco-mdl-menu class="mdl-menu--bottom-left"
|
||||
@@ -103,7 +103,7 @@
|
||||
<!-- Actions (right) -->
|
||||
<td *ngIf="actions && actionsPosition === 'right'" class="alfresco-datatable__actions-cell">
|
||||
<button [id]="'action_menu_' + idx" alfresco-mdl-button class="mdl-button--icon"
|
||||
[attr.data-automation-id]="actions_menu">
|
||||
[attr.data-automation-id]="'action_menu_' + idx">
|
||||
<i class="material-icons">more_vert</i>
|
||||
</button>
|
||||
<ul alfresco-mdl-menu class="mdl-menu--bottom-right"
|
||||
|
@@ -16,18 +16,18 @@
|
||||
*/
|
||||
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MdCheckboxChange, MdCheckboxModule } from '@angular/material';
|
||||
import { CoreModule } from 'ng2-alfresco-core';
|
||||
import { MdCheckboxModule, MdCheckboxChange } from '@angular/material';
|
||||
import { DataTableComponent } from './datatable.component';
|
||||
import { DataTableCellComponent } from './datatable-cell.component';
|
||||
import {
|
||||
DataRow,
|
||||
DataColumn,
|
||||
DataRow,
|
||||
DataSorting,
|
||||
ObjectDataTableAdapter,
|
||||
ObjectDataColumn
|
||||
ObjectDataColumn,
|
||||
ObjectDataTableAdapter
|
||||
} from './../../data/index';
|
||||
import { DataTableCellComponent } from './datatable-cell.component';
|
||||
import { DataTableComponent } from './datatable.component';
|
||||
|
||||
describe('DataTable', () => {
|
||||
|
||||
|
@@ -16,16 +16,16 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
Component, OnChanges, DoCheck, IterableDiffers, SimpleChange, SimpleChanges, Input,
|
||||
Output, EventEmitter, ElementRef, TemplateRef, AfterContentInit, ContentChild, Optional
|
||||
AfterContentInit, AfterViewInit, Component, ContentChild, DoCheck, ElementRef, EventEmitter, Input,
|
||||
IterableDiffers, OnChanges, Optional, Output, SimpleChange, SimpleChanges, TemplateRef
|
||||
} from '@angular/core';
|
||||
import { DataTableAdapter, DataRow, DataColumn, DataSorting, DataRowEvent } from '../../data/datatable-adapter';
|
||||
import { ObjectDataTableAdapter, ObjectDataRow } from '../../data/object-datatable-adapter';
|
||||
import { MdCheckboxChange } from '@angular/material';
|
||||
import { DataColumnListComponent } from 'ng2-alfresco-core';
|
||||
import { Observable, Observer } from 'rxjs/Rx';
|
||||
import { DataColumn, DataRow, DataRowEvent, DataSorting, DataTableAdapter } from '../../data/datatable-adapter';
|
||||
import { ObjectDataRow, ObjectDataTableAdapter } from '../../data/object-datatable-adapter';
|
||||
import { DataCellEvent } from './data-cell.event';
|
||||
import { DataRowActionEvent } from './data-row-action.event';
|
||||
import { DataColumnListComponent } from 'ng2-alfresco-core';
|
||||
import { MdCheckboxChange } from '@angular/material';
|
||||
import { Observable, Observer } from 'rxjs/Rx';
|
||||
|
||||
declare var componentHandler;
|
||||
|
||||
@@ -34,7 +34,7 @@ declare var componentHandler;
|
||||
styleUrls: ['./datatable.component.css'],
|
||||
templateUrl: './datatable.component.html'
|
||||
})
|
||||
export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck {
|
||||
export class DataTableComponent implements AfterContentInit, AfterViewInit, OnChanges, DoCheck {
|
||||
|
||||
@ContentChild(DataColumnListComponent) columnList: DataColumnListComponent;
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<div class="mdl-paging">
|
||||
<span class="mdl-paging__per-page">
|
||||
<span class="mdl-paging__per-page-label">Rows per page:</span>
|
||||
<span class="mdl-paging__per-page-value" [attr.data-automation-id]="'rows_per_page_' + pageSize">{{pagination.maxItems}}</span>
|
||||
<span class="mdl-paging__per-page-value" >{{pagination.maxItems}}</span>
|
||||
|
||||
<md-menu #appMenu="mdMenu" for="pageSizePicker">
|
||||
<div *ngFor="let size of supportedPageSizes"
|
||||
@@ -16,12 +16,12 @@
|
||||
<span class="mdl-paging__count">{{summary}}</span>
|
||||
<button (click)="showPrevPage()"
|
||||
[disabled]="!prevPageAvail()"
|
||||
alfresco-mdl-button class="mdl-button--icon mdl-paging__prev" [attr.data-automation-id]="prev_page">
|
||||
alfresco-mdl-button class="mdl-button--icon mdl-paging__prev">
|
||||
<i class="material-icons">keyboard_arrow_left</i>
|
||||
</button>
|
||||
<button (click)="showNextPage()"
|
||||
[disabled]="!nextPageAvail()"
|
||||
alfresco-mdl-button class="mdl-button--icon mdl-paging__next" [attr.data-automation-id]="next_page">
|
||||
alfresco-mdl-button class="mdl-button--icon mdl-paging__next">
|
||||
<i class="material-icons">keyboard_arrow_right</i>
|
||||
</button>
|
||||
</div>
|
||||
|
@@ -15,10 +15,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { PaginationComponent } from '../pagination/pagination.component';
|
||||
import { PaginationData } from '../../models/pagination.data';
|
||||
import { Injector, SimpleChange } from '@angular/core';
|
||||
import { getTestBed, TestBed } from '@angular/core/testing';
|
||||
import { PaginationData } from '../../models/pagination.data';
|
||||
import { PaginationComponent } from '../pagination/pagination.component';
|
||||
|
||||
describe('PaginationComponent', () => {
|
||||
let injector: Injector;
|
||||
|
@@ -15,9 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { SimpleChanges, OnChanges, EventEmitter, Output, Component, Input, OnInit } from '@angular/core';
|
||||
import { PaginationData } from '../../models/pagination.data';
|
||||
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
|
||||
import { Pagination } from 'alfresco-js-api';
|
||||
import { PaginationData } from '../../models/pagination.data';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-pagination, alfresco-pagination',
|
||||
@@ -28,7 +28,7 @@ export class PaginationComponent implements OnInit, OnChanges {
|
||||
|
||||
static DEFAULT_PAGE_SIZE: number = 20;
|
||||
|
||||
private summary: string = '';
|
||||
summary: string = '';
|
||||
|
||||
@Input()
|
||||
supportedPageSizes: number[] = [5, 10, 20, 50, 100];
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { DataColumn, DataRow, DataSorting } from './datatable-adapter';
|
||||
import { ObjectDataTableAdapter, ObjectDataRow, ObjectDataColumn } from './object-datatable-adapter';
|
||||
import { ObjectDataColumn, ObjectDataRow, ObjectDataTableAdapter } from './object-datatable-adapter';
|
||||
|
||||
describe('ObjectDataTableAdapter', () => {
|
||||
|
||||
|
@@ -15,10 +15,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { TemplateRef } from '@angular/core';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { TemplateRef } from '@angular/core';
|
||||
import { ObjectUtils } from 'ng2-alfresco-core';
|
||||
import { DataTableAdapter, DataRow, DataColumn, DataSorting } from './datatable-adapter';
|
||||
import { DataColumn, DataRow, DataSorting, DataTableAdapter } from './datatable-adapter';
|
||||
|
||||
declare var require: any;
|
||||
|
||||
|
@@ -15,27 +15,27 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { LoadingContentTemplateComponent } from './loading-template.component';
|
||||
import { Injector } from '@angular/core';
|
||||
import { getTestBed, TestBed } from '@angular/core/testing';
|
||||
import { DataTableComponent } from '../components/datatable/datatable.component';
|
||||
import { LoadingContentTemplateDirective } from './loading-template.directive';
|
||||
|
||||
describe('LoadingContentTemplateComponent', () => {
|
||||
describe('LoadingContentTemplateDirective', () => {
|
||||
let injector: Injector;
|
||||
let loadingContentTemplateComponent: LoadingContentTemplateComponent;
|
||||
let loadingContentTemplateDirective: LoadingContentTemplateDirective;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
LoadingContentTemplateComponent,
|
||||
LoadingContentTemplateDirective,
|
||||
DataTableComponent
|
||||
]
|
||||
});
|
||||
injector = getTestBed();
|
||||
loadingContentTemplateComponent = injector.get(LoadingContentTemplateComponent);
|
||||
loadingContentTemplateDirective = injector.get(LoadingContentTemplateDirective);
|
||||
});
|
||||
|
||||
it('is defined', () => {
|
||||
expect(loadingContentTemplateComponent).toBeDefined();
|
||||
expect(loadingContentTemplateDirective).toBeDefined();
|
||||
});
|
||||
});
|
@@ -15,13 +15,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Directive, ContentChild, TemplateRef, AfterContentInit } from '@angular/core';
|
||||
import { AfterContentInit, ContentChild, Directive, TemplateRef } from '@angular/core';
|
||||
import { DataTableComponent } from '../components/datatable/datatable.component';
|
||||
|
||||
@Directive({
|
||||
selector: 'loading-content-template'
|
||||
})
|
||||
export class LoadingContentTemplateComponent implements AfterContentInit {
|
||||
export class LoadingContentTemplateDirective implements AfterContentInit {
|
||||
|
||||
@ContentChild(TemplateRef)
|
||||
template: any;
|
@@ -15,27 +15,27 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { NoContentTemplateComponent } from './no-content-template.component';
|
||||
import { Injector } from '@angular/core';
|
||||
import { getTestBed, TestBed } from '@angular/core/testing';
|
||||
import { DataTableComponent } from '../components/datatable/datatable.component';
|
||||
import { NoContentTemplateDirective } from './no-content-template.directive';
|
||||
|
||||
describe('NoContentTemplateComponent', () => {
|
||||
describe('NoContentTemplateDirective', () => {
|
||||
let injector: Injector;
|
||||
let noContentTemplateComponent: NoContentTemplateComponent;
|
||||
let noContentTemplateDirective: NoContentTemplateDirective;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
NoContentTemplateComponent,
|
||||
NoContentTemplateDirective,
|
||||
DataTableComponent
|
||||
]
|
||||
});
|
||||
injector = getTestBed();
|
||||
noContentTemplateComponent = injector.get(NoContentTemplateComponent);
|
||||
noContentTemplateDirective = injector.get(NoContentTemplateDirective);
|
||||
});
|
||||
|
||||
it('is defined', () => {
|
||||
expect(noContentTemplateComponent).toBeDefined();
|
||||
expect(noContentTemplateDirective).toBeDefined();
|
||||
});
|
||||
});
|
@@ -15,13 +15,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Directive, ContentChild, TemplateRef, AfterContentInit } from '@angular/core';
|
||||
import { AfterContentInit, ContentChild, Directive, TemplateRef } from '@angular/core';
|
||||
import { DataTableComponent } from '../components/datatable/datatable.component';
|
||||
|
||||
@Directive({
|
||||
selector: 'no-content-template'
|
||||
})
|
||||
export class NoContentTemplateComponent implements AfterContentInit {
|
||||
export class NoContentTemplateDirective implements AfterContentInit {
|
||||
|
||||
@ContentChild(TemplateRef)
|
||||
template: any;
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { NgModule } from '@angular/core';
|
||||
import { MdCheckboxModule, MdMenuModule, MdIconModule, MdButtonModule } from '@angular/material';
|
||||
import { MdButtonModule, MdCheckboxModule, MdIconModule, MdMenuModule } from '@angular/material';
|
||||
|
||||
export function modules() {
|
||||
return [
|
||||
|
@@ -1,4 +1,7 @@
|
||||
{
|
||||
"rulesDirectory": [
|
||||
"node_modules/codelyzer"
|
||||
],
|
||||
"rules": {
|
||||
"align": [
|
||||
true,
|
||||
@@ -105,14 +108,50 @@
|
||||
"allow-leading-underscore",
|
||||
"ban-keywords"
|
||||
],
|
||||
"callable-types": true,
|
||||
"import-blacklist": [
|
||||
true,
|
||||
"rxjs"
|
||||
],
|
||||
"import-spacing": true,
|
||||
"interface-over-type-literal": true,
|
||||
"member-access": false,
|
||||
"no-empty-interface": true,
|
||||
"no-string-literal": false,
|
||||
"no-string-throw": true,
|
||||
"prefer-const": false,
|
||||
"typeof-compare": true,
|
||||
"unified-signatures": true,
|
||||
"whitespace": [
|
||||
true,
|
||||
"check-branch",
|
||||
"check-decl",
|
||||
"check-operator",
|
||||
"check-separator",
|
||||
"check-type",
|
||||
"check-module",
|
||||
"check-decl"
|
||||
]
|
||||
"check-type"
|
||||
],
|
||||
"directive-selector": [
|
||||
true,
|
||||
"attribute",
|
||||
"app",
|
||||
"camelCase"
|
||||
],
|
||||
"component-selector": [
|
||||
true,
|
||||
"element",
|
||||
"app",
|
||||
"kebab-case"
|
||||
],
|
||||
"ordered-imports": true,
|
||||
"use-input-property-decorator": true,
|
||||
"use-output-property-decorator": true,
|
||||
"use-host-property-decorator": true,
|
||||
"use-life-cycle-interface": true,
|
||||
"use-pipe-transform-interface": true,
|
||||
"component-class-suffix": true,
|
||||
"directive-class-suffix": true,
|
||||
"no-access-missing-member": true,
|
||||
"templates-use-public": true,
|
||||
"invoke-injectable": true
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user