igniteui-cli 12.0.0-beta.0 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "igniteui-cli",
3
- "version": "12.0.0-beta.0",
3
+ "version": "12.0.0",
4
4
  "description": "CLI tool for creating Ignite UI projects",
5
5
  "keywords": [
6
6
  "CLI",
@@ -72,8 +72,8 @@
72
72
  "all": true
73
73
  },
74
74
  "dependencies": {
75
- "@igniteui/angular-templates": "~16.0.1200-beta.0",
76
- "@igniteui/cli-core": "~12.0.0-beta.0",
75
+ "@igniteui/angular-templates": "~16.0.1200",
76
+ "@igniteui/cli-core": "~12.0.0",
77
77
  "chalk": "^2.3.2",
78
78
  "fs-extra": "^3.0.1",
79
79
  "glob": "^7.1.2",
@@ -101,6 +101,5 @@
101
101
  }
102
102
  }
103
103
  }
104
- },
105
- "defaultProject": "$(dash-name)"
104
+ }
106
105
  }
@@ -21,7 +21,3 @@ getTestBed().initTestEnvironment(
21
21
  teardown: { destroyAfterEach: false }
22
22
  }
23
23
  );
24
- // Then we find all the tests.
25
- const context = require.context('./', true, /\.spec\.ts$/);
26
- // And load the modules.
27
- context.keys().map(context);
@@ -11,6 +11,7 @@ class IgcDockManagerTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUI
11
11
  this.projectType = "igc-ts";
12
12
  this.name = "Dock Manager";
13
13
  this.description = "Dock Manager with most functionalities and docking options";
14
+ this.packages = ["igniteui-dockmanager@~1.12.4"];
14
15
  }
15
16
  addClassDeclaration(mainModule, projPath, name, modulePath) {
16
17
  // not applicable with custom module
@@ -11,6 +11,10 @@ class IgcFinancialChartTemplate extends IgniteUIForWebComponentsTemplate_1.Ignit
11
11
  this.projectType = "igc-ts";
12
12
  this.name = "Financial Chart";
13
13
  this.description = "IgcFinancialChart";
14
+ this.packages = [
15
+ "igniteui-webcomponents-core@~4.2.5",
16
+ "igniteui-webcomponents-charts@~4.2.5"
17
+ ];
14
18
  }
15
19
  addClassDeclaration(mainModule, projPath, name, modulePath) {
16
20
  // not applicable with custom module
@@ -11,6 +11,12 @@ class IgcGridTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIForWebC
11
11
  this.projectType = "igc-ts";
12
12
  this.name = "Grid";
13
13
  this.description = "IgcGrid with local data";
14
+ this.packages = [
15
+ "igniteui-webcomponents-core@~4.2.5",
16
+ "igniteui-webcomponents-grids@~4.2.5",
17
+ "igniteui-webcomponents-inputs@~4.2.5",
18
+ "igniteui-webcomponents-layouts@~4.2.5"
19
+ ];
14
20
  }
15
21
  addClassDeclaration(mainModule, projPath, name, modulePath) {
16
22
  // not applicable with custom module
@@ -3,7 +3,7 @@ import { customElement } from 'lit/decorators.js';
3
3
  import {
4
4
  EditModeType,
5
5
  GridActivationMode,
6
- GridSelectionMode,
6
+ DataGridSelectionMode,
7
7
  IgcDataGridComponent,
8
8
  IgcDataGridModule,
9
9
  IgcGridCellValueChangingEventArgs,
@@ -193,7 +193,7 @@ export default class $(ClassName) extends LitElement {
193
193
  if (grid !== null) {
194
194
  grid.dataSource = this.data;
195
195
  grid.activationMode = GridActivationMode.Cell;
196
- grid.selectionMode = GridSelectionMode.SingleCell;
196
+ grid.selectionMode = DataGridSelectionMode.SingleCell;
197
197
  grid.editMode = EditModeType.Cell;
198
198
  grid.cellValueChanging = onCellValueChanging;
199
199
  }
@@ -0,0 +1,545 @@
1
+ /* eslint-disable no-param-reassign */
2
+ export class NwindDataItem {
3
+ public constructor(init: Partial<NwindDataItem>) {
4
+ Object.assign(this, init);
5
+ }
6
+
7
+ ProductID: number = 0;
8
+ ProductName: string = "";
9
+ SupplierID: number = 0;
10
+ CategoryID: number = 0;
11
+ QuantityPerUnit: string = "";
12
+ UnitPrice: number = 0;
13
+ UnitsInStock: number = 0;
14
+ UnitsOnOrder: number = 0;
15
+ ReorderLevel: number = 0;
16
+ Discontinued: boolean = false;
17
+ OrderDate: string = "";
18
+ Rating: number = 0;
19
+ Locations: NwindDataItem_LocationsItem[] = [];
20
+
21
+ }
22
+ export class NwindDataItem_LocationsItem {
23
+ public constructor(init: Partial<NwindDataItem_LocationsItem>) {
24
+ Object.assign(this, init);
25
+ }
26
+
27
+ Shop: string = "";
28
+ LastInventory: string = "";
29
+
30
+ }
31
+ export class NwindData extends Array<NwindDataItem> {
32
+ public constructor() {
33
+ super();
34
+ this.push(new NwindDataItem(
35
+ {
36
+ ProductID: 1,
37
+ ProductName: `Chai`,
38
+ SupplierID: 1,
39
+ CategoryID: 1,
40
+ QuantityPerUnit: `10 boxes x 20 bags`,
41
+ UnitPrice: 18,
42
+ UnitsInStock: 39,
43
+ UnitsOnOrder: 30,
44
+ ReorderLevel: 10,
45
+ Discontinued: false,
46
+ OrderDate: `2012-02-12`,
47
+ Rating: 5,
48
+ Locations: [
49
+ new NwindDataItem_LocationsItem(
50
+ {
51
+ Shop: `Fun-Tasty Co.`,
52
+ LastInventory: `06/12/2018`
53
+ }),
54
+ new NwindDataItem_LocationsItem(
55
+ {
56
+ Shop: `Farmer Market`,
57
+ LastInventory: `04/04/2018`
58
+ })]
59
+
60
+ }));
61
+ this.push(new NwindDataItem(
62
+ {
63
+ ProductID: 2,
64
+ ProductName: `Chang`,
65
+ SupplierID: 1,
66
+ CategoryID: 1,
67
+ QuantityPerUnit: `24 - 12 oz bottles`,
68
+ UnitPrice: 19,
69
+ UnitsInStock: 17,
70
+ UnitsOnOrder: 40,
71
+ ReorderLevel: 25,
72
+ Discontinued: true,
73
+ OrderDate: `2003-03-17`,
74
+ Rating: 5,
75
+ Locations: [
76
+ new NwindDataItem_LocationsItem(
77
+ {
78
+ Shop: `Super Market`,
79
+ LastInventory: `09/09/2018`
80
+ })]
81
+
82
+ }));
83
+ this.push(new NwindDataItem(
84
+ {
85
+ ProductID: 3,
86
+ ProductName: `Aniseed Syrup`,
87
+ SupplierID: 1,
88
+ CategoryID: 2,
89
+ QuantityPerUnit: `12 - 550 ml bottles`,
90
+ UnitPrice: 10,
91
+ UnitsInStock: 13,
92
+ UnitsOnOrder: 70,
93
+ ReorderLevel: 25,
94
+ Discontinued: false,
95
+ OrderDate: `2006-03-17`,
96
+ Rating: 3,
97
+ Locations: [
98
+ new NwindDataItem_LocationsItem(
99
+ {
100
+ Shop: `Farmer Market`,
101
+ LastInventory: `04/04/2018`
102
+ }),
103
+ new NwindDataItem_LocationsItem(
104
+ {
105
+ Shop: `Street Market`,
106
+ LastInventory: `12/12/2018`
107
+ }),
108
+ new NwindDataItem_LocationsItem(
109
+ {
110
+ Shop: `24/7 Market`,
111
+ LastInventory: `11/11/2018`
112
+ })]
113
+
114
+ }));
115
+ this.push(new NwindDataItem(
116
+ {
117
+ ProductID: 4,
118
+ ProductName: `Chef Antons Cajun Seasoning`,
119
+ SupplierID: 2,
120
+ CategoryID: 2,
121
+ QuantityPerUnit: `48 - 6 oz jars`,
122
+ UnitPrice: 22,
123
+ UnitsInStock: 53,
124
+ UnitsOnOrder: 30,
125
+ ReorderLevel: 0,
126
+ Discontinued: false,
127
+ OrderDate: `2016-03-17`,
128
+ Rating: 3,
129
+ Locations: [
130
+ new NwindDataItem_LocationsItem(
131
+ {
132
+ Shop: `Fun-Tasty Co.`,
133
+ LastInventory: `06/12/2018`
134
+ }),
135
+ new NwindDataItem_LocationsItem(
136
+ {
137
+ Shop: `Farmer Market`,
138
+ LastInventory: `04/04/2018`
139
+ }),
140
+ new NwindDataItem_LocationsItem(
141
+ {
142
+ Shop: `Street Market`,
143
+ LastInventory: `12/12/2018`
144
+ })]
145
+
146
+ }));
147
+ this.push(new NwindDataItem(
148
+ {
149
+ ProductID: 5,
150
+ ProductName: `Chef Antons Gumbo Mix`,
151
+ SupplierID: 2,
152
+ CategoryID: 2,
153
+ QuantityPerUnit: `36 boxes`,
154
+ UnitPrice: 21.35,
155
+ UnitsInStock: 0,
156
+ UnitsOnOrder: 30,
157
+ ReorderLevel: 0,
158
+ Discontinued: true,
159
+ OrderDate: `2011-11-11`,
160
+ Rating: 5,
161
+ Locations: [
162
+ new NwindDataItem_LocationsItem(
163
+ {
164
+ Shop: `Super Market`,
165
+ LastInventory: `09/09/2018`
166
+ })]
167
+
168
+ }));
169
+ this.push(new NwindDataItem(
170
+ {
171
+ ProductID: 6,
172
+ ProductName: `Grandmas Boysenberry Spread`,
173
+ SupplierID: 3,
174
+ CategoryID: 2,
175
+ QuantityPerUnit: `12 - 8 oz jars`,
176
+ UnitPrice: 25,
177
+ UnitsInStock: 0,
178
+ UnitsOnOrder: 30,
179
+ ReorderLevel: 25,
180
+ Discontinued: false,
181
+ OrderDate: `2017-12-17`,
182
+ Rating: 4,
183
+ Locations: [
184
+ new NwindDataItem_LocationsItem(
185
+ {
186
+ Shop: `Super Market`,
187
+ LastInventory: `09/09/2018`
188
+ })]
189
+
190
+ }));
191
+ this.push(new NwindDataItem(
192
+ {
193
+ ProductID: 7,
194
+ ProductName: `Uncle Bobs Organic Dried Pears`,
195
+ SupplierID: 3,
196
+ CategoryID: 7,
197
+ QuantityPerUnit: `12 - 1 lb pkgs.`,
198
+ UnitPrice: 30,
199
+ UnitsInStock: 150,
200
+ UnitsOnOrder: 30,
201
+ ReorderLevel: 10,
202
+ Discontinued: false,
203
+ OrderDate: `2016-07-17`,
204
+ Rating: 5,
205
+ Locations: [
206
+ new NwindDataItem_LocationsItem(
207
+ {
208
+ Shop: `Fun-Tasty Co.`,
209
+ LastInventory: `06/12/2018`
210
+ }),
211
+ new NwindDataItem_LocationsItem(
212
+ {
213
+ Shop: `Farmer Market`,
214
+ LastInventory: `04/04/2018`
215
+ }),
216
+ new NwindDataItem_LocationsItem(
217
+ {
218
+ Shop: `Street Market`,
219
+ LastInventory: `12/12/2018`
220
+ })]
221
+
222
+ }));
223
+ this.push(new NwindDataItem(
224
+ {
225
+ ProductID: 8,
226
+ ProductName: `Northwoods Cranberry Sauce`,
227
+ SupplierID: 3,
228
+ CategoryID: 2,
229
+ QuantityPerUnit: `12 - 12 oz jars`,
230
+ UnitPrice: 40,
231
+ UnitsInStock: 6,
232
+ UnitsOnOrder: 30,
233
+ ReorderLevel: 0,
234
+ Discontinued: false,
235
+ OrderDate: `2018-01-17`,
236
+ Rating: 4,
237
+ Locations: [
238
+ new NwindDataItem_LocationsItem(
239
+ {
240
+ Shop: `Fun-Tasty Co.`,
241
+ LastInventory: `06/12/2018`
242
+ }),
243
+ new NwindDataItem_LocationsItem(
244
+ {
245
+ Shop: `Farmer Market`,
246
+ LastInventory: `04/04/2018`
247
+ })]
248
+
249
+ }));
250
+ this.push(new NwindDataItem(
251
+ {
252
+ ProductID: 9,
253
+ ProductName: `Mishi Kobe Niku`,
254
+ SupplierID: 4,
255
+ CategoryID: 6,
256
+ QuantityPerUnit: `18 - 500 g pkgs.`,
257
+ UnitPrice: 97,
258
+ UnitsInStock: 29,
259
+ UnitsOnOrder: 30,
260
+ ReorderLevel: 0,
261
+ Discontinued: true,
262
+ OrderDate: `2010-02-17`,
263
+ Rating: 4,
264
+ Locations: [
265
+ new NwindDataItem_LocationsItem(
266
+ {
267
+ Shop: `Farmer Market`,
268
+ LastInventory: `04/04/2018`
269
+ })]
270
+
271
+ }));
272
+ this.push(new NwindDataItem(
273
+ {
274
+ ProductID: 10,
275
+ ProductName: `Ikura`,
276
+ SupplierID: 4,
277
+ CategoryID: 8,
278
+ QuantityPerUnit: `12 - 200 ml jars`,
279
+ UnitPrice: 31,
280
+ UnitsInStock: 31,
281
+ UnitsOnOrder: 30,
282
+ ReorderLevel: 0,
283
+ Discontinued: false,
284
+ OrderDate: `2008-05-17`,
285
+ Rating: 3,
286
+ Locations: [
287
+ new NwindDataItem_LocationsItem(
288
+ {
289
+ Shop: `Wall Market`,
290
+ LastInventory: `12/06/2018`
291
+ })]
292
+
293
+ }));
294
+ this.push(new NwindDataItem(
295
+ {
296
+ ProductID: 11,
297
+ ProductName: `Queso Cabrales`,
298
+ SupplierID: 5,
299
+ CategoryID: 4,
300
+ QuantityPerUnit: `1 kg pkg.`,
301
+ UnitPrice: 21,
302
+ UnitsInStock: 22,
303
+ UnitsOnOrder: 30,
304
+ ReorderLevel: 30,
305
+ Discontinued: false,
306
+ OrderDate: `2009-01-17`,
307
+ Rating: 5,
308
+ Locations: [
309
+ new NwindDataItem_LocationsItem(
310
+ {
311
+ Shop: `Fun-Tasty Co.`,
312
+ LastInventory: `06/12/2018`
313
+ }),
314
+ new NwindDataItem_LocationsItem(
315
+ {
316
+ Shop: `Farmer Market`,
317
+ LastInventory: `04/04/2018`
318
+ })]
319
+
320
+ }));
321
+ this.push(new NwindDataItem(
322
+ {
323
+ ProductID: 12,
324
+ ProductName: `Queso Manchego La Pastora`,
325
+ SupplierID: 5,
326
+ CategoryID: 4,
327
+ QuantityPerUnit: `10 - 500 g pkgs.`,
328
+ UnitPrice: 38,
329
+ UnitsInStock: 86,
330
+ UnitsOnOrder: 30,
331
+ ReorderLevel: 0,
332
+ Discontinued: false,
333
+ OrderDate: `2015-11-17`,
334
+ Rating: 3,
335
+ Locations: [
336
+ new NwindDataItem_LocationsItem(
337
+ {
338
+ Shop: `Farmer Market`,
339
+ LastInventory: `04/04/2018`
340
+ })]
341
+
342
+ }));
343
+ this.push(new NwindDataItem(
344
+ {
345
+ ProductID: 13,
346
+ ProductName: `Konbu`,
347
+ SupplierID: 6,
348
+ CategoryID: 8,
349
+ QuantityPerUnit: `2 kg box`,
350
+ UnitPrice: 6,
351
+ UnitsInStock: 24,
352
+ UnitsOnOrder: 30,
353
+ ReorderLevel: 5,
354
+ Discontinued: false,
355
+ OrderDate: `2015-03-17`,
356
+ Rating: 2,
357
+ Locations: [
358
+ new NwindDataItem_LocationsItem(
359
+ {
360
+ Shop: `Super Market`,
361
+ LastInventory: `09/09/2018`
362
+ })]
363
+
364
+ }));
365
+ this.push(new NwindDataItem(
366
+ {
367
+ ProductID: 14,
368
+ ProductName: `Tofu`,
369
+ SupplierID: 6,
370
+ CategoryID: 7,
371
+ QuantityPerUnit: `40 - 100 g pkgs.`,
372
+ UnitPrice: 23.25,
373
+ UnitsInStock: 35,
374
+ UnitsOnOrder: 30,
375
+ ReorderLevel: 0,
376
+ Discontinued: false,
377
+ OrderDate: `2017-06-17`,
378
+ Rating: 4,
379
+ Locations: [
380
+ new NwindDataItem_LocationsItem(
381
+ {
382
+ Shop: `Farmer Market`,
383
+ LastInventory: `04/04/2018`
384
+ }),
385
+ new NwindDataItem_LocationsItem(
386
+ {
387
+ Shop: `Street Market`,
388
+ LastInventory: `12/12/2018`
389
+ })]
390
+
391
+ }));
392
+ this.push(new NwindDataItem(
393
+ {
394
+ ProductID: 15,
395
+ ProductName: `Genen Shouyu`,
396
+ SupplierID: 6,
397
+ CategoryID: 2,
398
+ QuantityPerUnit: `24 - 250 ml bottles`,
399
+ UnitPrice: 15.5,
400
+ UnitsInStock: 39,
401
+ UnitsOnOrder: 30,
402
+ ReorderLevel: 5,
403
+ Discontinued: false,
404
+ OrderDate: `2014-03-17`,
405
+ Rating: 4,
406
+ Locations: [
407
+ new NwindDataItem_LocationsItem(
408
+ {
409
+ Shop: `Local Market`,
410
+ LastInventory: `07/03/2018`
411
+ }),
412
+ new NwindDataItem_LocationsItem(
413
+ {
414
+ Shop: `Wall Market`,
415
+ LastInventory: `12/06/2018`
416
+ })]
417
+
418
+ }));
419
+ this.push(new NwindDataItem(
420
+ {
421
+ ProductID: 16,
422
+ ProductName: `Pavlova`,
423
+ SupplierID: 7,
424
+ CategoryID: 3,
425
+ QuantityPerUnit: `32 - 500 g boxes`,
426
+ UnitPrice: 17.45,
427
+ UnitsInStock: 29,
428
+ UnitsOnOrder: 30,
429
+ ReorderLevel: 10,
430
+ Discontinued: false,
431
+ OrderDate: `2018-03-28`,
432
+ Rating: 2,
433
+ Locations: [
434
+ new NwindDataItem_LocationsItem(
435
+ {
436
+ Shop: `Farmer Market`,
437
+ LastInventory: `04/04/2018`
438
+ }),
439
+ new NwindDataItem_LocationsItem(
440
+ {
441
+ Shop: `Street Market`,
442
+ LastInventory: `12/12/2018`
443
+ }),
444
+ new NwindDataItem_LocationsItem(
445
+ {
446
+ Shop: `24/7 Market`,
447
+ LastInventory: `11/11/2018`
448
+ })]
449
+
450
+ }));
451
+ this.push(new NwindDataItem(
452
+ {
453
+ ProductID: 17,
454
+ ProductName: `Alice Mutton`,
455
+ SupplierID: 7,
456
+ CategoryID: 6,
457
+ QuantityPerUnit: `20 - 1 kg tins`,
458
+ UnitPrice: 39,
459
+ UnitsInStock: 0,
460
+ UnitsOnOrder: 30,
461
+ ReorderLevel: 0,
462
+ Discontinued: true,
463
+ OrderDate: `2015-08-17`,
464
+ Rating: 2,
465
+ Locations: [
466
+ new NwindDataItem_LocationsItem(
467
+ {
468
+ Shop: `Farmer Market`,
469
+ LastInventory: `04/04/2018`
470
+ })]
471
+
472
+ }));
473
+ this.push(new NwindDataItem(
474
+ {
475
+ ProductID: 18,
476
+ ProductName: `Carnarvon Tigers`,
477
+ SupplierID: 7,
478
+ CategoryID: 8,
479
+ QuantityPerUnit: `16 kg pkg.`,
480
+ UnitPrice: 62.5,
481
+ UnitsInStock: 42,
482
+ UnitsOnOrder: 30,
483
+ ReorderLevel: 0,
484
+ Discontinued: false,
485
+ OrderDate: `2005-09-27`,
486
+ Rating: 2,
487
+ Locations: [
488
+ new NwindDataItem_LocationsItem(
489
+ {
490
+ Shop: `24/7 Market`,
491
+ LastInventory: `11/11/2018`
492
+ }),
493
+ new NwindDataItem_LocationsItem(
494
+ {
495
+ Shop: `Super Market`,
496
+ LastInventory: `09/09/2018`
497
+ })]
498
+
499
+ }));
500
+ this.push(new NwindDataItem(
501
+ {
502
+ ProductID: 19,
503
+ ProductName: `Teatime Chocolate Biscuits`,
504
+ SupplierID: 8,
505
+ CategoryID: 3,
506
+ QuantityPerUnit: ``,
507
+ UnitPrice: 9.2,
508
+ UnitsInStock: 25,
509
+ UnitsOnOrder: 30,
510
+ ReorderLevel: 5,
511
+ Discontinued: false,
512
+ OrderDate: `2001-03-17`,
513
+ Rating: 2,
514
+ Locations: [
515
+ new NwindDataItem_LocationsItem(
516
+ {
517
+ Shop: `Local Market`,
518
+ LastInventory: `07/03/2018`
519
+ })]
520
+
521
+ }));
522
+ this.push(new NwindDataItem(
523
+ {
524
+ ProductID: 20,
525
+ ProductName: `Sir Rodneys Marmalade`,
526
+ SupplierID: 8,
527
+ CategoryID: 3,
528
+ QuantityPerUnit: `4 - 100 ml jars`,
529
+ UnitPrice: 4.5,
530
+ UnitsInStock: 40,
531
+ UnitsOnOrder: 30,
532
+ ReorderLevel: 0,
533
+ Discontinued: false,
534
+ OrderDate: `2005-03-17`,
535
+ Rating: 5,
536
+ Locations: [
537
+ new NwindDataItem_LocationsItem(
538
+ {
539
+ Shop: `Super Market`,
540
+ LastInventory: `09/09/2018`
541
+ })]
542
+
543
+ }));
544
+ }
545
+ }
@@ -1,26 +1,20 @@
1
1
  import { css, html, LitElement } from 'lit';
2
2
  import { customElement } from 'lit/decorators.js';
3
+ import 'igniteui-webcomponents-grids/grids/combined';
3
4
  import {
4
- IgcDataGridComponent,
5
- IgcDataGridModule,
6
- IgcColumnGroupDescription,
7
- IgcColumnSummaryDescription,
8
- IgcGridColumnOptionsModule
9
- } from 'igniteui-webcomponents-grids';
5
+ IgcGridComponent,
6
+ IgcColumnComponent,
7
+ } from 'igniteui-webcomponents-grids/grids';
10
8
  import {
11
- ModuleManager, IgcProvideCalculatorEventArgs, SummaryOperand, SummaryCalculator,
12
- DefaultSummaryResult, IDataSource, ISummaryResult,
9
+ ComponentRenderer,
10
+ WebGridDescriptionModule,
13
11
  } from 'igniteui-webcomponents-core';
14
- import { DataGridSharedData } from './DataGridSharedData';
15
-
16
- ModuleManager.register(
17
- IgcDataGridModule,
18
- IgcGridColumnOptionsModule,
19
- );
12
+ import {
13
+ NwindData,
14
+ } from './NwindData';
20
15
 
21
16
  @customElement('app-$(path)')
22
17
  export default class $(ClassName) extends LitElement {
23
- data: any[] = DataGridSharedData.getEmployees();
24
18
 
25
19
  static styles = css`
26
20
  :host {
@@ -33,151 +27,41 @@ export default class $(ClassName) extends LitElement {
33
27
 
34
28
  render() {
35
29
  return html`
30
+ <link rel="stylesheet" href="./node_modules/igniteui-webcomponents-grids/grids/themes/light/bootstrap.css">
36
31
  <div class="container sample">
37
- <igc-data-grid
38
- id="grid"
39
- height="calc(100% - 3rem)"
40
- width="100%"
41
- summary-scope="Root"
42
- group-summary-display-mode="RowTop"
43
- auto-generate-columns="false"
44
- is-group-collapsable="true"
45
- group-header-display-mode="combined"
46
- is-column-options-enabled="true"
47
- default-column-min-width="100"
48
- >
49
- <igc-numeric-column field="ProductID" header-text="ID" horizontal-alignment="center" ></igc-numeric-column>
50
- <igc-text-column field="ProductName" header-text="Product" width="*>160"></igc-text-column>
51
- <igc-numeric-column positive-prefix="$" field="BundlePrice" show-grouping-separator="true" header-text="Price" ></igc-numeric-column>
52
- <igc-numeric-column field="OrderItems" header-text="Order Items" width="*>135"></igc-numeric-column>
53
- <igc-numeric-column field="OrderValue" show-grouping-separator="true" header-text="Order Totals" positive-prefix="$" width="*>195"></igc-numeric-column>
54
- <igc-date-time-column field="OrderDate" header-text="Order Date" horizontal-alignment="right" width="*>180"></igc-date-time-column>
55
- <igc-numeric-column field="Profit" show-grouping-separator="true" header-text="Profit" positive-prefix="$" width="*>165"></igc-numeric-column>
56
- <igc-text-column field="Countries" header-text="Country" width="*>115"></igc-text-column>
57
- </igc-data-grid>
32
+ <div class="container fill">
33
+ <igc-grid auto-generate="false" name="grid" id="grid" primary-key="ProductID">
34
+ <igc-column name="ProductID" id="ProductID" field="ProductID"></igc-column>
35
+ <igc-column name="ProductName" id="ProductName" field="ProductName" header="Product Name" has-summary="true"></igc-column>
36
+ <igc-column name="UnitPrice" id="UnitPrice" field="UnitPrice" header="Unit Price" has-summary="true"></igc-column>
37
+ <igc-column name="UnitsInStock" id="UnitsInStock" field="UnitsInStock" header="Units In Stock" has-summary="true" data-type="number"></igc-column>
38
+ <igc-column name="Discontinued" id="Discontinued" field="Discontinued" header="Discontinued"></igc-column>
39
+ <igc-column name="OrderDate" id="OrderDate" field="OrderDate" header="Order Date" has-summary="true" data-type="date"></igc-column>
40
+ </igc-grid>
58
41
  </div>
42
+ </div>
59
43
  `;
60
44
  }
61
45
 
62
46
  firstUpdated() {
63
- const grid = this.shadowRoot?.getElementById('grid') as IgcDataGridComponent;
64
-
65
- // Custom Calculator - calculates the count for all USA.
66
- class CustomDomestic extends SummaryCalculator {
67
- get displayName(): string {
68
- return 'USA';
69
- }
70
-
71
- public usCountries: number = 0;
72
-
73
- public beginCalculation(a: IDataSource, b: string): void {
74
- super.beginCalculation(a, b);
75
- this.usCountries = 0;
76
- }
77
-
78
- public endCalculation(): ISummaryResult {
79
- return new DefaultSummaryResult(this.propertyName, SummaryOperand.Custom, this.usCountries);
80
- }
81
-
82
- public aggregate(a: any): void {
83
- if (a.Countries === 'USA') {
84
- this.usCountries += 1;
85
- }
86
- }
47
+ const grid = this.shadowRoot?.getElementById('grid') as IgcGridComponent;
48
+ const nwindData = NwindData;
49
+
50
+ const productID = this.shadowRoot?.getElementById('ProductID') as IgcColumnComponent;
51
+ const productName = this.shadowRoot?.getElementById('ProductName') as IgcColumnComponent;
52
+ const unitPrice = this.shadowRoot?.getElementById('UnitPrice') as IgcColumnComponent;
53
+ const unitsInStock = this.shadowRoot?.getElementById('UnitsInStock') as IgcColumnComponent;
54
+ const discontinued = this.shadowRoot?.getElementById('Discontinued') as IgcColumnComponent;
55
+ const orderDate = this.shadowRoot?.getElementById('OrderDate') as IgcColumnComponent;
56
+
57
+ grid.data = new nwindData();
58
+
59
+ const _componentRenderer = new ComponentRenderer();
60
+ const renderer = (_componentRenderer: ComponentRenderer) => {
61
+ const context = _componentRenderer.context;
62
+ WebGridDescriptionModule.register(context);
63
+ return _componentRenderer;
87
64
  }
88
-
89
- const onProvideCalculator = (s: IgcColumnSummaryDescription,
90
- e: IgcProvideCalculatorEventArgs) => {
91
- e.calculator = new CustomDomestic();
92
- };
93
-
94
- const onLoad = () => {
95
- const productGroup = new IgcColumnGroupDescription();
96
- productGroup.field = 'ProductName';
97
- productGroup.displayName = 'ProductName';
98
- grid.groupDescriptions.add(productGroup);
99
-
100
- const productCount = new IgcColumnSummaryDescription();
101
- productCount.field = 'ProductName';
102
- productCount.operand = SummaryOperand.Count;
103
- grid.summaryDescriptions.add(productCount);
104
-
105
- const priceMin = new IgcColumnSummaryDescription();
106
- priceMin.field = 'BundlePrice';
107
- priceMin.operand = SummaryOperand.Min;
108
- priceMin.formatOverride = new Intl.NumberFormat('en-EN', {
109
- style: 'currency', currency: 'USD', minimumFractionDigits: 0, maximumFractionDigits: 0,
110
- });
111
- grid.summaryDescriptions.add(priceMin);
112
-
113
- const priceMax = new IgcColumnSummaryDescription();
114
- priceMax.field = 'BundlePrice';
115
- priceMax.operand = SummaryOperand.Max;
116
- priceMax.formatOverride = new Intl.NumberFormat('en-EN', {
117
- style: 'currency', currency: 'USD', minimumFractionDigits: 0, maximumFractionDigits: 0,
118
- });
119
- grid.summaryDescriptions.add(priceMax);
120
-
121
- const orderSum = new IgcColumnSummaryDescription();
122
- orderSum.field = 'OrderItems';
123
- orderSum.operand = SummaryOperand.Sum;
124
- grid.summaryDescriptions.add(orderSum);
125
-
126
- const orderValueSum = new IgcColumnSummaryDescription();
127
- orderValueSum.field = 'OrderValue';
128
- orderValueSum.operand = SummaryOperand.Sum;
129
- orderValueSum.formatOverride = new Intl.NumberFormat('en-EN', {
130
- style: 'currency', currency: 'USD', minimumFractionDigits: 0, maximumFractionDigits: 0,
131
- });
132
- grid.summaryDescriptions.add(orderValueSum);
133
-
134
- const orderValueAvg = new IgcColumnSummaryDescription();
135
- orderValueAvg.field = 'OrderValue';
136
- orderValueAvg.operand = SummaryOperand.Average;
137
- orderValueAvg.formatOverride = new Intl.NumberFormat('en-EN', {
138
- style: 'currency', currency: 'USD', minimumFractionDigits: 0, maximumFractionDigits: 0,
139
- });
140
- grid.summaryDescriptions.add(orderValueAvg);
141
-
142
- const orderDateMin = new IgcColumnSummaryDescription();
143
- orderDateMin.field = 'OrderDate';
144
- orderDateMin.operand = SummaryOperand.Min;
145
- orderDateMin.calculatorDisplayName = 'First';
146
- orderDateMin.formatOverride = new Intl.DateTimeFormat('en-EN');
147
- grid.summaryDescriptions.add(orderDateMin);
148
-
149
- const orderDateMax = new IgcColumnSummaryDescription();
150
- orderDateMax.field = 'OrderDate';
151
- orderDateMax.operand = SummaryOperand.Max;
152
- orderDateMax.calculatorDisplayName = 'Last';
153
- orderDateMax.formatOverride = new Intl.DateTimeFormat('en-EN');
154
- grid.summaryDescriptions.add(orderDateMax);
155
-
156
- const sum1 = new IgcColumnSummaryDescription();
157
- sum1.field = 'Profit';
158
- sum1.operand = SummaryOperand.Sum;
159
- sum1.formatOverride = new Intl.NumberFormat('en-EN', {
160
- style: 'currency', currency: 'USD', minimumFractionDigits: 0, maximumFractionDigits: 0,
161
- });
162
- grid.summaryDescriptions.add(sum1);
163
-
164
- const avg2 = new IgcColumnSummaryDescription();
165
- avg2.field = 'Profit';
166
- avg2.operand = SummaryOperand.Average;
167
- avg2.formatOverride = new Intl.NumberFormat('en-EN', {
168
- style: 'currency', currency: 'USD', minimumFractionDigits: 0, maximumFractionDigits: 0,
169
- });
170
- grid.summaryDescriptions.add(avg2);
171
-
172
- const countries = new IgcColumnSummaryDescription();
173
- countries.field = 'Countries';
174
- countries.operand = SummaryOperand.Custom;
175
- countries.provideCalculator = onProvideCalculator;
176
- grid.summaryDescriptions.add(countries);
177
- };
178
-
179
- grid.dataSource = DataGridSharedData.getSales();
180
-
181
- onLoad();
65
+ renderer(_componentRenderer);
182
66
  }
183
67
  }
@@ -11,6 +11,10 @@ class IgcLinearGaugeTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUI
11
11
  this.projectType = "igc-ts";
12
12
  this.name = "Linear Gauge";
13
13
  this.description = "IgcLinearGauge";
14
+ this.packages = [
15
+ "igniteui-webcomponents-core@~4.2.5",
16
+ "igniteui-webcomponents-gauges@~4.2.5"
17
+ ];
14
18
  }
15
19
  addClassDeclaration(mainModule, projPath, name, modulePath) {
16
20
  // not applicable with custom module
@@ -11,6 +11,10 @@ class IgcLinearProgressComponent extends IgniteUIForWebComponentsTemplate_1.Igni
11
11
  this.projectType = "igc-ts";
12
12
  this.name = "Linear Progress";
13
13
  this.description = "Basic Linear Progress";
14
+ this.packages = [
15
+ "igniteui-webcomponents-core@~4.2.5",
16
+ "igniteui-webcomponents-charts@~4.2.5"
17
+ ];
14
18
  }
15
19
  addClassDeclaration(mainModule, projPath, name, modulePath) {
16
20
  // not applicable with custom module
@@ -11,6 +11,10 @@ class IgcPieChartTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIFor
11
11
  this.projectType = "igc-ts";
12
12
  this.name = "Pie Chart";
13
13
  this.description = "IgcPieChart with local data";
14
+ this.packages = [
15
+ "igniteui-webcomponents-core@~4.2.5",
16
+ "igniteui-webcomponents-charts@~4.2.5"
17
+ ];
14
18
  }
15
19
  addClassDeclaration(mainModule, projPath, name, modulePath) {
16
20
  // not applicable with custom module
@@ -22,7 +22,8 @@
22
22
  "dependencies": {
23
23
  "@vaadin/router": "^1.7.4",
24
24
  "lit": "^2.6.1",
25
- "typescript": "^4.9.4"
25
+ "typescript": "^4.9.4",
26
+ "igniteui-webcomponents": "4.2.0"
26
27
  },
27
28
  "devDependencies": {
28
29
  "@babel/preset-env": "^7.20.2",
@@ -16,6 +16,10 @@ export default {
16
16
  format: 'es',
17
17
  dir: 'dist',
18
18
  },
19
+ onwarn: function(warning) {
20
+ // Skip https://rollupjs.org/troubleshooting/#error-this-is-undefined
21
+ if ( warning.code === 'THIS_IS_UNDEFINED' ) { return; }
22
+ },
19
23
  preserveEntrySignatures: false,
20
24
 
21
25
  plugins: [
@@ -38,6 +42,7 @@ export default {
38
42
  importMetaAssets(),
39
43
  /** Compile JS to a lower language target */
40
44
  babel({
45
+ compact: true,
41
46
  babelHelpers: 'bundled',
42
47
  presets: [
43
48
  [
@@ -11,6 +11,10 @@ class IgcradialGaugeTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUI
11
11
  this.projectType = "igc-ts";
12
12
  this.name = "Radial Gauge";
13
13
  this.description = "IgcRadialGauge";
14
+ this.packages = [
15
+ "igniteui-webcomponents-core@~4.2.5",
16
+ "igniteui-webcomponents-gauges@~4.2.5"
17
+ ];
14
18
  }
15
19
  addClassDeclaration(mainModule, projPath, name, modulePath) {
16
20
  // not applicable with custom module
@@ -11,6 +11,12 @@ class IgcTreeTemplate extends IgniteUIForWebComponentsTemplate_1.IgniteUIForWebC
11
11
  this.projectType = "igc-ts";
12
12
  this.name = "Tree";
13
13
  this.description = "basic IgcTree";
14
+ this.packages = [
15
+ "igniteui-webcomponents-core@~4.2.5",
16
+ "igniteui-webcomponents-grids@~4.2.5",
17
+ "igniteui-webcomponents-inputs@~4.2.5",
18
+ "igniteui-webcomponents-layouts@~4.2.5"
19
+ ];
14
20
  }
15
21
  addClassDeclaration(mainModule, projPath, name, modulePath) {
16
22
  // not applicable with custom module
@@ -1,297 +0,0 @@
1
- /* eslint-disable no-param-reassign */
2
- export class DataGridSharedData {
3
- public static getEmployees(count?: number): any[] {
4
- if (count === undefined) {
5
- count = 250;
6
- }
7
-
8
- const employees: any[] = [];
9
- let maleCount: number = 0;
10
- let femaleCount: number = 0;
11
- for (let i = 0; i < count; i += 1) {
12
- const age: number = Math.round(this.getRandomNumber(20, 40));
13
- const gender: string = this.getRandomGender();
14
- const firstName: string = this.getRandomNameFirst(gender);
15
- const lastName: string = this.getRandomNameLast();
16
- const street: string = this.getRandomStreet();
17
- const country: string = this.getRandomItem(this.countries);
18
- const city: string = this.getRandomCity(country);
19
- const generation = `${Math.floor(age / 10) * 10}s`;
20
- const email: string = `${firstName.toLowerCase()}@${this.getRandomItem(this.emails)}`;
21
- const website: string = `${firstName.toLowerCase()}-${this.getRandomItem(this.websites)}`;
22
- let photoPath: any;
23
-
24
- if (gender === 'male') {
25
- maleCount += 1;
26
- if (maleCount > 26) {
27
- maleCount = 1;
28
- }
29
- photoPath = this.getPhotoMale(maleCount);
30
- } else {
31
- femaleCount += 1;
32
- if (femaleCount > 24) {
33
- femaleCount = 1;
34
- }
35
- photoPath = this.getPhotoFemale(femaleCount);
36
- }
37
-
38
- const person: any = {};
39
- person.Address = `${street},${city}`;
40
- person.Age = age;
41
- person.Birthday = this.getBirthday(age);
42
- person.City = city;
43
- person.Country = country;
44
- person.CountryFlag = this.getCountryFlag(country);
45
- person.Email = email;
46
- person.FirstName = firstName;
47
- person.Gender = this.getGenderPhoto(gender);
48
- person.Generation = generation;
49
- person.ID = this.pad(i + 1, 5);
50
- person.LastName = lastName;
51
- person.Name = `${firstName} ${lastName}`;
52
- person.Phone = this.getRandomPhone();
53
- person.Photo = photoPath;
54
- person.Street = street;
55
- person.Salary = this.getRandomNumber(40, 200) * 1000;
56
- person.Sales = this.getRandomNumber(200, 980) * 1000;
57
- person.Website = website;
58
- person.Productivity = this.getProductivity();
59
-
60
- if (person.Salary < 50000) {
61
- person.Income = 'Low';
62
- } else if (person.Salary < 100000) {
63
- person.Income = 'Average';
64
- } else {
65
- person.Income = 'High';
66
- }
67
-
68
- employees.push(person);
69
- }
70
- return employees;
71
- }
72
-
73
- public static getProductivity(weekCount?: number): any[] {
74
- if (weekCount === undefined) {
75
- weekCount = 52;
76
- }
77
- const productivity: any[] = [];
78
- for (let w = 0; w < weekCount; w += 1) {
79
- const value = this.getRandomNumber(-50, 50);
80
- productivity.push({ Value: value, Week: w });
81
- }
82
- return productivity;
83
- }
84
-
85
- public static getSales(count?: number): any[] {
86
- if (count === undefined) {
87
- count = 250;
88
- }
89
-
90
- const names: string[] = [
91
- 'Intel CPU', 'AMD CPU',
92
- 'NVIDIA GPU', 'GIGABYTE GPU', 'Asus GPU', 'AMD GPU', 'MSI GPU',
93
- 'Corsair Memory', 'Patriot Memory', 'Skill Memory',
94
- 'Samsung HDD', 'WD HDD', 'Seagate HDD', 'Intel HDD',
95
- 'Samsung SSD', 'WD SSD', 'Seagate SSD', 'Intel SSD',
96
- 'Samsung Monitor', 'Asus Monitor', 'LG Monitor', 'HP Monitor'];
97
- const countries: string[] = ['USA', 'UK', 'France', 'Canada', 'Poland', 'Japan', 'Germany'];
98
- const status: string[] = ['Packing', 'Shipped', 'Delivered'];
99
- const sales: any[] = [];
100
-
101
- for (let i = 0; i < count; i += 1) {
102
- const price = this.getRandomNumber(100, 900);
103
- const items = this.getRandomNumber(10, 80);
104
- const value = price * items;
105
- const margin = this.getRandomNumber(3, 10);
106
- const profit = Math.round((price * (margin / 100)) * items);
107
- const country = this.getRandomItem(countries);
108
- sales.push({
109
- BundlePrice: price,
110
- ProductPrice: price,
111
- Margin: margin,
112
- OrderDate: this.getRandomDate(new Date(2012, 0, 1), new Date()),
113
- OrderItems: items,
114
- OrderValue: value, // Math.round(value / 1000) + ',' + Math.round(value % 1000),
115
- ProductID: 1001 + i,
116
- ProductName: this.getRandomItem(names),
117
- Profit: profit,
118
- Countries: country,
119
- CountryFlag: this.getCountryFlag(country),
120
- Status: this.getRandomItem(status),
121
- });
122
- }
123
- return sales;
124
- }
125
-
126
- public static getHouses(count?: number): any[] {
127
- if (count === undefined) {
128
- count = 250;
129
- }
130
-
131
- const houses: any[] = [];
132
- const property: string[] = ['Townhouse', 'Single', 'Condo', 'Villa'];
133
- const emails: string[] = ['estates.com', 'remax.com', 'zillow.com', 'realtor.com', 'coldwell.com'];
134
- const countries: string[] = ['USA', 'UK', 'France', 'Canada', 'Poland', 'Japan', 'Germany'];
135
-
136
- for (let i = 0; i < count; i += 1) {
137
- const year: number = this.getRandomNumber(1950, 2015);
138
- const age: number = 2020 - year;
139
-
140
- const gender: string = this.getRandomGender();
141
- const firstName: string = this.getRandomNameFirst(gender);
142
- const lastName: string = this.getRandomNameLast();
143
- const initials = firstName.substr(0, 1).toLowerCase();
144
- const email: string = `${initials + lastName.toLowerCase()}@${this.getRandomItem(emails)}`;
145
-
146
- const street: string = this.getRandomStreet();
147
- const country: string = this.getRandomItem(countries);
148
- const city: string = this.getRandomCity(country);
149
-
150
- houses.push({
151
- Address: `${street},${city}`,
152
- Age: age,
153
- Agent: `${firstName} ${lastName}`,
154
- Area: this.getRandomNumber(50, 300),
155
- Baths: this.getRandomNumber(1, 3),
156
- Built: year,
157
- City: city,
158
- Country: country,
159
- CountryFlag: this.getCountryFlag(country),
160
- Email: email,
161
- ID: this.pad(i + 1, 5),
162
- Phone: this.getRandomPhone(),
163
- Price: this.getRandomNumber(210, 900) * 1000,
164
- Property: this.getRandomItem(property),
165
- Rooms: this.getRandomNumber(2, 5),
166
- SaleDate: this.getRandomDate(new Date(2015, 0, 1), new Date()),
167
- Street: street,
168
- });
169
- }
170
- return houses;
171
- }
172
-
173
- private static websites: string[] = ['.com', '.gov', '.edu', '.org'];
174
-
175
- private static emails: string[] = ['gmail.com', 'yahoo.com', 'twitter.com'];
176
-
177
- private static genders: string[] = ['male', 'female'];
178
-
179
- private static maleNames: string[] = ['Kyle', 'Oscar', 'Ralph', 'Mike', 'Bill', 'Frank', 'Howard', 'Jack', 'Larry', 'Pete', 'Steve', 'Vince', 'Mark', 'Alex', 'Max', 'Brian', 'Chris', 'Andrew', 'Martin', 'Mike', 'Steve', 'Glenn', 'Bruce'];
180
-
181
- private static femaleNames: string[] = ['Gina', 'Irene', 'Katie', 'Brenda', 'Casey', 'Fiona', 'Holly', 'Kate', 'Liz', 'Pamela', 'Nelly', 'Marisa', 'Monica', 'Anna', 'Jessica', 'Sofia', 'Isabella', 'Margo', 'Jane', 'Audrey', 'Sally', 'Melanie', 'Greta', 'Aurora', 'Sally'];
182
-
183
- private static lastNames: string[] = ['Adams', 'Crowley', 'Ellis', 'Martinez', 'Irvine', 'Maxwell', 'Clark', 'Owens', 'Rooney', 'Lincoln', 'Thomas', 'Spacey', 'MOrgan', 'King', 'Newton', 'Fitzgerald', 'Holmes', 'Jefferson', 'Landry', 'Berry', 'Perez', 'Spencer', 'Starr', 'Carter', 'Edwards', 'Stark', 'Johnson', 'Fitz', 'Chief', 'Blanc', 'Perry', 'Stone', 'Williams', 'Lane', 'Jobs', 'Adams', 'Power', 'Tesla'];
184
-
185
- private static countries: string[] = ['USA', 'UK', 'France', 'Canada', 'Poland'];
186
-
187
- private static citiesUS: string[] = ['New York', 'Los Angeles', 'Miami', 'San Francisco', 'San Diego', 'Las Vegas'];
188
-
189
- private static citiesUK: string[] = ['London', 'Liverpool', 'Manchester'];
190
-
191
- private static citiesFR: string[] = ['Paris', 'Marseille', 'Lyon'];
192
-
193
- private static citiesCA: string[] = ['Toronto', 'Vancouver', 'Montreal'];
194
-
195
- private static citiesPL: string[] = ['Krakow', 'Warsaw', 'Wroclaw', 'Gdansk'];
196
-
197
- private static citiesJP: string[] = ['Tokyo', 'Osaka', 'Kyoto', 'Yokohama'];
198
-
199
- private static citiesGR: string[] = ['Berlin', 'Bonn', 'Cologne', 'Munich', 'Hamburg'];
200
-
201
- private static roadSuffixes: string[] = ['Road', 'Street', 'Way'];
202
-
203
- private static roadNames: string[] = ['Main', 'Garden', 'Broad', 'Oak', 'Cedar', 'Park', 'Pine', 'Elm', 'Market', 'Hill'];
204
-
205
- private static getRandomNumber(min: number, max: number): number {
206
- return Math.round(min + Math.random() * (max - min));
207
- }
208
-
209
- private static getRandomItem(array: any[]): any {
210
- const index = Math.round(this.getRandomNumber(0, array.length - 1));
211
- return array[index];
212
- }
213
-
214
- private static getRandomDate(start: Date, end: Date) {
215
- return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));
216
- }
217
-
218
- private static getRandomPhone(): string {
219
- const phoneCode = this.getRandomNumber(100, 900);
220
- const phoneNum1 = this.getRandomNumber(100, 900);
221
- const phoneNum2 = this.getRandomNumber(1000, 9000);
222
- const phone = `${phoneCode}-${phoneNum1}-${phoneNum2}`;
223
- return phone;
224
- }
225
-
226
- private static getRandomGender(): string {
227
- return this.getRandomItem(this.genders);
228
- }
229
-
230
- private static getRandomNameLast(): string {
231
- return this.getRandomItem(this.lastNames);
232
- }
233
-
234
- private static getRandomNameFirst(gender: string): string {
235
- if (gender === 'male') {
236
- return this.getRandomItem(this.maleNames);
237
- }
238
-
239
- return this.getRandomItem(this.femaleNames);
240
- }
241
-
242
- private static getRandomCity(country: string): string {
243
- if (country === 'Canada') {
244
- return this.getRandomItem(this.citiesCA);
245
- } if (country === 'France') {
246
- return this.getRandomItem(this.citiesFR);
247
- } if (country === 'Poland') {
248
- return this.getRandomItem(this.citiesPL);
249
- } if (country === 'USA') {
250
- return this.getRandomItem(this.citiesUS);
251
- } if (country === 'Japan') {
252
- return this.getRandomItem(this.citiesJP);
253
- } if (country === 'Germany') {
254
- return this.getRandomItem(this.citiesGR);
255
- } // if (country === 'United Kingdom')
256
- return this.getRandomItem(this.citiesUK);
257
- }
258
-
259
- private static getRandomStreet(): string {
260
- const num = Math.round(this.getRandomNumber(100, 300)).toString();
261
- const road = this.getRandomItem(this.roadNames);
262
- const suffix = this.getRandomItem(this.roadSuffixes);
263
- return `${num} ${road} ${suffix}`;
264
- }
265
-
266
- private static getBirthday(age: number): Date {
267
- const today: Date = new Date();
268
- const year: number = today.getFullYear() - age;
269
- const month: number = this.getRandomNumber(0, 8);
270
- const day: number = this.getRandomNumber(10, 27);
271
- return new Date(year, month, day);
272
- }
273
-
274
- private static getPhotoMale(id: number): string {
275
- return `https://static.infragistics.com/xplatform/images/people//GUY${this.pad(id, 2)}.png`;
276
- }
277
-
278
- private static getPhotoFemale(id: number): string {
279
- return `https://static.infragistics.com/xplatform/images/people/GIRL${this.pad(id, 2)}.png`;
280
- }
281
-
282
- private static getGenderPhoto(gender: string): string {
283
- return `https://static.infragistics.com/xplatform/images/genders/${gender}.png`;
284
- }
285
-
286
- private static getCountryFlag(country: string): string {
287
- return `https://static.infragistics.com/xplatform/images/flags/${country}.png`;
288
- }
289
-
290
- private static pad(num: number, size: number) {
291
- let s = `${num}`;
292
- while (s.length < size) {
293
- s = `0${s}`;
294
- }
295
- return s;
296
- }
297
- }