Skip to content

Commit fb33873

Browse files
authored
Add files via upload
1 parent 9985882 commit fb33873

File tree

10 files changed

+485
-0
lines changed

10 files changed

+485
-0
lines changed

grid/overview/angular.json

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"demo": {
7+
"root": "",
8+
"sourceRoot": "src",
9+
"projectType": "application",
10+
"prefix": "app",
11+
"schematics": {},
12+
"architect": {
13+
"build": {
14+
"builder": "@angular-devkit/build-angular:browser",
15+
"options": {
16+
"outputPath": "dist/demo",
17+
"index": "src/index.html",
18+
"main": "src/main.ts",
19+
"polyfills": "src/polyfills.ts",
20+
"tsConfig": "src/tsconfig.app.json",
21+
"assets": [
22+
"src/assets"
23+
],
24+
"styles": [
25+
"./node_modules/smart-webcomponents-angular/source/styles/smart.default.css"
26+
],
27+
"scripts": []
28+
},
29+
"configurations": {
30+
"production": {
31+
"fileReplacements": [
32+
{
33+
"replace": "src/environments/environment.ts",
34+
"with": "src/environments/environment.prod.ts"
35+
}
36+
],
37+
"optimization": true,
38+
"outputHashing": "all",
39+
"sourceMap": false,
40+
"extractCss": true,
41+
"namedChunks": false,
42+
"aot": true,
43+
"extractLicenses": true,
44+
"vendorChunk": false,
45+
"buildOptimizer": true
46+
}
47+
}
48+
},
49+
"serve": {
50+
"builder": "@angular-devkit/build-angular:dev-server",
51+
"options": {
52+
"browserTarget": "demo:build"
53+
},
54+
"configurations": {
55+
"production": {
56+
"browserTarget": "demo:build:production"
57+
}
58+
}
59+
},
60+
"extract-i18n": {
61+
"builder": "@angular-devkit/build-angular:extract-i18n",
62+
"options": {
63+
"browserTarget": "demo:build"
64+
}
65+
},
66+
"test": {
67+
"builder": "@angular-devkit/build-angular:karma",
68+
"options": {
69+
"main": "src/test.ts",
70+
"polyfills": "src/polyfills.ts",
71+
"tsConfig": "src/tsconfig.spec.json",
72+
"karmaConfig": "src/karma.conf.js",
73+
"styles": [
74+
"styles.css"
75+
],
76+
"scripts": [],
77+
"assets": [
78+
"src/favicon.ico",
79+
"src/assets"
80+
]
81+
}
82+
},
83+
"lint": {
84+
"builder": "@angular-devkit/build-angular:tslint",
85+
"options": {
86+
"tsConfig": [
87+
"src/tsconfig.app.json",
88+
"src/tsconfig.spec.json"
89+
],
90+
"exclude": [
91+
"**/node_modules/**"
92+
]
93+
}
94+
}
95+
}
96+
},
97+
"demo-e2e": {
98+
"root": "e2e/",
99+
"projectType": "application",
100+
"architect": {
101+
"e2e": {
102+
"builder": "@angular-devkit/build-angular:protractor",
103+
"options": {
104+
"protractorConfig": "e2e/protractor.conf.js",
105+
"devServerTarget": "demo:serve"
106+
}
107+
},
108+
"lint": {
109+
"builder": "@angular-devkit/build-angular:tslint",
110+
"options": {
111+
"tsConfig": "e2e/tsconfig.e2e.json",
112+
"exclude": [
113+
"**/node_modules/**"
114+
]
115+
}
116+
}
117+
}
118+
}
119+
},
120+
"defaultProject": "demo"
121+
}
122+

grid/overview/package.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"name": "angular-template",
3+
"description": "",
4+
"homepage": "https://stackblitz.com/edit/e8czwv.run",
5+
"dependencies": {
6+
"@angular/animations": "^7.0.0",
7+
"@angular/common": "7.0.0",
8+
"@angular/compiler": "7.0.0",
9+
"@angular/core": "7.0.0",
10+
"@angular/forms": "7.0.0",
11+
"@angular/http": "^7.0.0",
12+
"@angular/platform-browser": "7.0.0",
13+
"@angular/platform-browser-dynamic": "7.0.0",
14+
"@angular/router": "7.0.0",
15+
"core-js": "2.5.7",
16+
"rxjs": "6.3.3",
17+
"zone.js": "0.8.26",
18+
"moment": "2.22.2",
19+
"smart-webcomponents-angular": "7.7.3"
20+
},
21+
"version": "0.0.0",
22+
"license": "MIT",
23+
"scripts": {
24+
"ng": "ng",
25+
"start": "ng serve",
26+
"build": "ng build",
27+
"test": "ng test",
28+
"lint": "ng lint",
29+
"e2e": "ng e2e"
30+
},
31+
"private": true,
32+
"devDependencies": {
33+
"@angular/cli": "7.0.2",
34+
"@angular/compiler-cli": "^7.0.0",
35+
"@angular/language-service": "^7.0.0",
36+
"@types/jasmine": "~2.8.9",
37+
"@types/jasminewd2": "~2.0.5",
38+
"@types/node": "~10.12.0",
39+
"codelyzer": "~4.5.0",
40+
"jasmine-core": "~3.2.1",
41+
"jasmine-spec-reporter": "~4.2.1",
42+
"karma": "~3.1.0",
43+
"karma-chrome-launcher": "~2.2.0",
44+
"karma-cli": "~1.0.1",
45+
"karma-coverage-istanbul-reporter": "^2.0.4",
46+
"karma-jasmine": "~1.1.2",
47+
"karma-jasmine-html-reporter": "^1.3.1",
48+
"protractor": "~5.4.1",
49+
"ts-node": "~7.0.1",
50+
"tslint": "~5.11.0",
51+
"typescript": "~3.1.3"
52+
}
53+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* Add application styles & imports to this file! */
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+

2+
<smart-grid #grid [dataSource]="dataSource" [layout]="layout" [columns]="columns" [selection]=selection [appearance]="appearance" [paging]="paging" [pager]="pager" id="grid"></smart-grid>
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
import { Component, VERSION } from '@angular/core';
2+
import { ViewChild, OnInit, AfterViewInit } from '@angular/core';
3+
import { GridComponent, GridColumn, DataAdapter, Smart } from 'smart-webcomponents-angular/grid';
4+
5+
interface IRowGenerateData {
6+
id: number;
7+
reportsTo: number | null;
8+
available: boolean | null;
9+
firstName: string;
10+
lastName: string;
11+
name: string;
12+
productName: string;
13+
quantity: string | number;
14+
total: string | number;
15+
price: string | number;
16+
date: Date;
17+
leaf: boolean;
18+
}
19+
20+
interface IRowGenerateOrdersData {
21+
id: number | string;
22+
parentid: number | null;
23+
customer: string;
24+
firstName: string;
25+
lastName: string;
26+
name: string;
27+
price: string | number;
28+
quantity: string | number;
29+
total: string | number;
30+
date: Date;
31+
}
32+
33+
interface ITaskGenerateData {
34+
id: number | string;
35+
status: string;
36+
text: string;
37+
tags?: string;
38+
priority?: string;
39+
progress?: number;
40+
checklist?: { text: string, completed: boolean }[];
41+
color?: string;
42+
comments?: { text: string, userId: number | string, time: Date }[];
43+
userId?: number | string;
44+
startDate?: Date;
45+
dueDate?: Date
46+
}
47+
48+
export function GetData(rowscount?: number, last?: number, hasNullValues?: boolean): IRowGenerateData[] {
49+
const data: IRowGenerateData[] = new Array();
50+
51+
if (rowscount === undefined) {
52+
rowscount = 100;
53+
}
54+
55+
let startIndex = 0;
56+
57+
if (last) {
58+
startIndex = rowscount;
59+
rowscount = last - rowscount;
60+
}
61+
62+
const firstNames =
63+
[
64+
'Andrew', 'Nancy', 'Shelley', 'Regina', 'Yoshi', 'Antoni', 'Mayumi', 'Ian', 'Peter', 'Lars', 'Petra', 'Martin', 'Sven', 'Elio', 'Beate', 'Cheryl', 'Michael', 'Guylene'
65+
];
66+
67+
const lastNames =
68+
[
69+
'Fuller', 'Davolio', 'Burke', 'Murphy', 'Nagase', 'Saavedra', 'Ohno', 'Devling', 'Wilson', 'Peterson', 'Winkler', 'Bein', 'Petersen', 'Rossi', 'Vileid', 'Saylor', 'Bjorn', 'Nodier'
70+
];
71+
72+
const productNames =
73+
[
74+
'Black Tea', 'Green Tea', 'Caffe Espresso', 'Doubleshot Espresso', 'Caffe Latte', 'White Chocolate Mocha', 'Caramel Latte', 'Caffe Americano', 'Cappuccino', 'Espresso Truffle', 'Espresso con Panna', 'Peppermint Mocha Twist'
75+
];
76+
77+
const priceValues =
78+
[
79+
'2.25', '1.5', '3.0', '3.3', '4.5', '3.6', '3.8', '2.5', '5.0', '1.75', '3.25', '4.0'
80+
];
81+
82+
for (let i = 0; i < rowscount; i++) {
83+
const row = {} as IRowGenerateData;
84+
85+
const productindex = Math.floor(Math.random() * productNames.length);
86+
const price = parseFloat(priceValues[productindex]);
87+
const quantity = 1 + Math.round(Math.random() * 10);
88+
89+
row.id = startIndex + i;
90+
row.reportsTo = Math.floor(Math.random() * firstNames.length);
91+
92+
if (i % Math.floor(Math.random() * firstNames.length) === 0) {
93+
row.reportsTo = null;
94+
}
95+
96+
row.available = productindex % 2 === 0;
97+
98+
if (hasNullValues === true) {
99+
if (productindex % 2 !== 0) {
100+
const random = Math.floor(Math.random() * rowscount);
101+
row.available = i % random === 0 ? null : false;
102+
}
103+
}
104+
105+
row.firstName = firstNames[Math.floor(Math.random() * firstNames.length)];
106+
row.lastName = lastNames[Math.floor(Math.random() * lastNames.length)];
107+
row.name = row.firstName + ' ' + row.lastName;
108+
row.productName = productNames[productindex];
109+
row.price = price;
110+
row.quantity = quantity;
111+
row.total = price * quantity;
112+
113+
const date = new Date();
114+
date.setFullYear(2016, Math.floor(Math.random() * 11), Math.floor(Math.random() * 27));
115+
date.setHours(0, 0, 0, 0);
116+
row.date = date;
117+
118+
data[i] = row;
119+
}
120+
121+
return data;
122+
}
123+
124+
125+
@Component({
126+
selector: 'my-app',
127+
templateUrl: './app.component.html',
128+
styleUrls: [ './app.component.css' ]
129+
})
130+
export class AppComponent {
131+
name = 'Angular ' + VERSION.major;
132+
133+
@ViewChild('grid', { read: GridComponent, static: false }) grid: GridComponent;
134+
135+
public appearance = {
136+
alternationStart: 0,
137+
alternationCount: 2,
138+
showRowHeader: true,
139+
showRowHeaderFocusIcon: true,
140+
showRowHeaderSelectIcon: true
141+
};
142+
143+
public selection = {
144+
enabled: true,
145+
mode: 'one',
146+
allowRowHeaderSelection: true
147+
};
148+
149+
public pager = {
150+
visible: true
151+
};
152+
153+
public paging = {
154+
enabled: true
155+
};
156+
157+
public layout = {
158+
rowHeight: 'auto',
159+
allowCellsWrap: true
160+
};
161+
162+
dataSource = new Smart.DataAdapter({
163+
dataSource: GetData(1000),
164+
dataFields: [
165+
'id: number',
166+
'firstName: string',
167+
'lastName: string',
168+
'productName: string',
169+
'quantity: number',
170+
'price: number',
171+
'total: number'
172+
]
173+
});
174+
175+
columns: GridColumn[] = [
176+
{ label: 'First Name', dataField: 'firstName' },
177+
{ label: 'Last Name', dataField: 'lastName' },
178+
{ label: 'Product', dataField: 'productName' },
179+
{ label: 'Quantity', dataField: 'quantity', align: 'right', cellsAlign: 'right' },
180+
{ label: 'Unit Price', dataField: 'price', align: 'right', cellsAlign: 'right', cellsFormat: 'c2' },
181+
{ label: 'Total', dataField: 'total', align: 'right', cellsAlign: 'right', cellsFormat: 'c2' }
182+
]
183+
184+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { NgModule } from '@angular/core';
2+
import { BrowserModule } from '@angular/platform-browser';
3+
4+
import { GridModule } from 'smart-webcomponents-angular/grid';
5+
6+
import { AppComponent } from './app.component';
7+
8+
@NgModule({
9+
declarations: [ AppComponent ],
10+
imports: [ BrowserModule, GridModule ],
11+
bootstrap: [ AppComponent ],
12+
entryComponents: [ AppComponent ]
13+
})
14+
15+
export class AppModule { }

grid/overview/src/app/main.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
2+
import { enableProdMode } from '@angular/core';
3+
import { AppModule } from './app.module';
4+
5+
enableProdMode();
6+
platformBrowserDynamic().bootstrapModule(AppModule);

0 commit comments

Comments
 (0)