Refactor demo shell as CLI project (#2501)

* split interfaces

* angular cli demo refactoring

* fix test import

* fix demo script

* fix demo script

* fix demo script

* fix demo script
This commit is contained in:
Mario Romano
2017-10-22 00:02:41 +01:00
committed by Eugenio Romano
parent 9ac0c06acd
commit 167336f245
184 changed files with 3898 additions and 3832 deletions

View File

@@ -16,7 +16,8 @@
*/
import { BaseEvent } from 'ng2-alfresco-core';
import { DataColumn, DataRow } from '../../data/datatable-adapter';
import { DataColumn } from '../../data/data-column.model';
import { DataRow } from '../../data/data-row.model';
export class DataCellEvent extends BaseEvent<DataCellEventModel> {

View File

@@ -16,7 +16,7 @@
*/
import { BaseEvent } from 'ng2-alfresco-core';
import { DataRow } from '../../data/datatable-adapter';
import { DataRow } from '../../data/data-row.model';
export class DataRowActionEvent extends BaseEvent<DataRowActionModel> {

View File

@@ -16,7 +16,9 @@
*/
import { ChangeDetectionStrategy, Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
import { DataColumn, DataRow, DataTableAdapter } from '../../data/datatable-adapter';
import { DataColumn } from '../../data/data-column.model';
import { DataRow } from '../../data/data-row.model';
import { DataTableAdapter } from '../../data/datatable-adapter';
@Component({
selector: 'adf-datatable-cell, alfresco-datatable-cell',

View File

@@ -22,7 +22,12 @@ import {
import { MatCheckboxChange } from '@angular/material';
import { DataColumnListComponent } from 'ng2-alfresco-core';
import { Observable, Observer, Subscription } from 'rxjs/Rx';
import { DataColumn, DataRow, DataRowEvent, DataSorting, DataTableAdapter } from '../../data/datatable-adapter';
import { DataColumn } from '../../data/data-column.model';
import { DataRowEvent } from '../../data/data-row-event.model';
import { DataRow } from '../../data/data-row.model';
import { DataSorting } from '../../data/data-sorting.model';
import { 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';

View File

@@ -0,0 +1,30 @@
/*!
* @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 { TemplateRef } from '@angular/core';
export interface DataColumn {
key: string;
type: string; // text|image|date
format?: string;
sortable?: boolean;
title?: string;
srTitle?: string;
cssClass?: string;
template?: TemplateRef<any>;
formatTooltip?: Function;
}

View File

@@ -0,0 +1,32 @@
/*!
* @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 { BaseUIEvent } from 'ng2-alfresco-core';
import { DataRow } from './data-row.model';
export class DataRowEvent extends BaseUIEvent<DataRow> {
sender: any;
constructor(value: DataRow, domEvent: Event, sender?: any) {
super();
this.value = value;
this.event = domEvent;
this.sender = sender;
}
}

View File

@@ -0,0 +1,24 @@
/*!
* @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.
*/
export interface DataRow {
isSelected: boolean;
isDropTarget?: boolean;
cssClass?: string;
hasValue(key: string): boolean;
getValue(key: string): any;
}

View File

@@ -0,0 +1,23 @@
/*!
* @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.
*/
export class DataSorting {
constructor(
public key?: string,
public direction?: string) {
}
}

View File

@@ -15,8 +15,9 @@
* limitations under the License.
*/
import { TemplateRef } from '@angular/core';
import { BaseUIEvent } from 'ng2-alfresco-core';
import { DataColumn } from './data-column.model';
import { DataRow } from './data-row.model';
import { DataSorting } from './data-sorting.model';
export interface DataTableAdapter {
selectedRow: DataRow;
@@ -29,43 +30,3 @@ export interface DataTableAdapter {
setSorting(sorting: DataSorting): void;
sort(key?: string, direction?: string): void;
}
export interface DataRow {
isSelected: boolean;
isDropTarget?: boolean;
cssClass?: string;
hasValue(key: string): boolean;
getValue(key: string): any;
}
export interface DataColumn {
key: string;
type: string; // text|image|date
format?: string;
sortable?: boolean;
title?: string;
srTitle?: string;
cssClass?: string;
template?: TemplateRef<any>;
formatTooltip?: Function;
}
export class DataSorting {
constructor(
public key?: string,
public direction?: string) {
}
}
export class DataRowEvent extends BaseUIEvent<DataRow> {
sender: any;
constructor(value: DataRow, domEvent: Event, sender?: any) {
super();
this.value = value;
this.event = domEvent;
this.sender = sender;
}
}

View File

@@ -15,5 +15,9 @@
* limitations under the License.
*/
export { DataColumn, DataRow, DataRowEvent, DataSorting, DataTableAdapter } from './datatable-adapter';
export { DataTableAdapter } from './datatable-adapter';
export { ObjectDataColumn, ObjectDataRow, ObjectDataTableAdapter } from './object-datatable-adapter';
export { DataRow } from './data-row.model';
export { DataRowEvent } from './data-row-event.model';
export { DataColumn } from './data-column.model';
export { DataSorting } from './data-sorting.model';

View File

@@ -15,7 +15,9 @@
* limitations under the License.
*/
import { DataColumn, DataRow, DataSorting } from './datatable-adapter';
import { DataColumn } from './data-column.model';
import { DataRow } from './data-row.model';
import { DataSorting } from './data-sorting.model';
import { ObjectDataColumn, ObjectDataRow, ObjectDataTableAdapter } from './object-datatable-adapter';
describe('ObjectDataTableAdapter', () => {

View File

@@ -19,7 +19,10 @@ import { DatePipe } from '@angular/common';
import { TemplateRef } from '@angular/core';
import { ObjectUtils, TimeAgoPipe } from 'ng2-alfresco-core';
import { DataColumn, DataRow, DataSorting, DataTableAdapter } from './datatable-adapter';
import { DataColumn } from './data-column.model';
import { DataRow } from './data-row.model';
import { DataSorting } from './data-sorting.model';
import { DataTableAdapter } from './datatable-adapter';
// Simple implementation of the DataTableAdapter interface.
export class ObjectDataTableAdapter implements DataTableAdapter {