Skip to content

Commit 31c5f62

Browse files
authored
feat(package): drop support of ng v2 and add support of ng v4 and v5 (valor-software#2602)
BREAKING CHANGES: - dropped support of ng v2 * feat(package): upgrading ng v4 * feat(package): dropped support of ng v2 * chore(datepicker): initial commit * chore(package): beta.6 * fix(datepicker): for ng v4 * chore(core): after merge fix * fix(demo): fix carousel demo error * fix(tests): add matchers, fix fn output type in draggable service * chore(package): upgraded angular dependencies * 2.0.0-beta.3 * chore(changelog): update * chore(package): fixed missing moment dependecy * fix(index.ts): fix merge issue in root index.ts (valor-software#2357) - Removed duplicate export * fix(weeks): change calculation of week number (valor-software#2368) * feat(package): theme switching upgraded * chore(package): version bump * chore(package): we need more dependencies * chore(package): prettier applied * chore(package): splitted html from .ts components * chore(package): applying tslint * chore(package): tslint apply
1 parent 101fb20 commit 31c5f62

File tree

409 files changed

+9953
-6921
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

409 files changed

+9953
-6921
lines changed

.angular-cli.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
23
"project": {
34
"name": "ngx-bootstrap"
45
},
@@ -12,13 +13,17 @@
1213
],
1314
"index": "index.html",
1415
"main": "main.ts",
16+
"polyfills": "polyfills.ts",
1517
"test": "../../scripts/test.ts",
1618
"tsconfig": "tsconfig.json",
1719
"testTsconfig": "../../src/tsconfig.spec.json",
1820
"prefix": "",
1921
"mobile": false,
22+
"serviceWorker": true,
2023
"styles": [
21-
"../../src/datepicker/bs-datepicker.scss"
24+
"../../src/datepicker/bs-datepicker.scss",
25+
"assets/css/style.css",
26+
"assets/css/prettify-angulario.css"
2227
],
2328
"scripts": [],
2429
"environmentSource": "environments/environment.ts",
@@ -35,6 +40,11 @@
3540
"config": "protractor.conf.js"
3641
}
3742
},
43+
"lint": [
44+
{
45+
"project": "../tslint.json"
46+
}
47+
],
3848
"test": {
3949
"karma": {
4050
"config": "karma.conf.js"

.prettierrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"printWidth": 120,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": true,
7+
"trailingComma": "none",
8+
"bracketSpacing": true,
9+
"parser": "typescript"
10+
}

demo/src/app/api-docs/analytics/analytics.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33
* @copyright ng-bootstrap
44
*/
55
import { Injectable } from '@angular/core';
6-
import { Router, NavigationEnd } from '@angular/router';
6+
import { NavigationEnd, Router } from '@angular/router';
77
import { Location } from '@angular/common';
88

99
import 'rxjs/add/operator/filter';
1010

1111
declare const ga: any;
1212

1313
/**
14-
* Simple Google Analytics service. Note that all its methods don't do anything unless the app
15-
* is deployed on ng-bootstrap.github.io. This avoids sending events and page views during development.
14+
* Simple Google Analytics service. Note that all its methods don't do anything
15+
* unless the app is deployed on ng-bootstrap.github.io. This avoids sending
16+
* events and page views during development.
1617
*/
1718
@Injectable()
1819
export class Analytics {
@@ -27,8 +28,8 @@ export class Analytics {
2728
}
2829

2930
/**
30-
* Intended to be called only once. Subscribes to router events and sends a page view
31-
* after each ended navigation event.
31+
* Intended to be called only once. Subscribes to router events and sends a
32+
* page view after each ended navigation event.
3233
*/
3334
public trackPageViews(): void {
3435
if (!this._enabled) {
@@ -38,7 +39,7 @@ export class Analytics {
3839
.filter((event: any) => event instanceof NavigationEnd)
3940
.subscribe(() => {
4041
if (typeof ga !== 'undefined') {
41-
ga('send', {hitType: 'pageview', page: this._location.path()});
42+
ga('send', { hitType: 'pageview', page: this._location.path() });
4243
}
4344
});
4445
}
@@ -51,7 +52,11 @@ export class Analytics {
5152
return;
5253
}
5354
if (typeof ga !== 'undefined') {
54-
ga('send', {hitType: 'event', eventCategory: category, eventAction: action});
55+
ga('send', {
56+
hitType: 'event',
57+
eventCategory: category,
58+
eventAction: action
59+
});
5560
}
5661
}
5762
}

demo/src/app/api-docs/api-doc-class/api-doc-class.component.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
<h3>
33
<a (click)="trackSourceClick()"
44
href="https://github.com/valor-software/ngx-bootstrap/tree/development/{{apiDocs.fileName}}"
5-
target="_blank">{{apiDocs.className}}</a>
5+
target="_blank" rel="noopener">{{apiDocs.className}}</a>
66
</h3>
77
<p [innerHtml]="apiDocs.description"></p>
88

9-
<template [ngIf]="apiDocs.properties && apiDocs.properties.length">
9+
<ng-template [ngIf]="apiDocs.properties && apiDocs.properties.length">
1010
<section>
1111
<h3 id="inputs">Properties</h3>
1212
<table class="table table-sm table-hover">
@@ -15,18 +15,18 @@ <h3 id="inputs">Properties</h3>
1515
<td class="col-xs-3"><code>{{prop.name}}</code></td>
1616
<td class="col-xs-9">
1717
<div><i>Type: </i><code>{{ prop.type }}</code></div>
18-
<template [ngIf]="prop.defaultValue">
18+
<ng-template [ngIf]="prop.defaultValue">
1919
<div><i>Default value: </i><code>{{prop.defaultValue || '-'}}</code></div>
20-
</template>
20+
</ng-template>
2121
<div><span [innerHtml]="prop.description"></span></div>
2222
</td>
2323
</tr>
2424
</tbody>
2525
</table>
2626
</section>
27-
</template>
27+
</ng-template>
2828

29-
<template [ngIf]="apiDocs.methods && apiDocs.methods.length">
29+
<ng-template [ngIf]="apiDocs.methods && apiDocs.methods.length">
3030
<section>
3131
<h3 id="methods">Methods</h3>
3232
<table class="table table-sm table-hover">
@@ -43,6 +43,6 @@ <h3 id="methods">Methods</h3>
4343
</tbody>
4444
</table>
4545
</section>
46-
</template>
46+
</ng-template>
4747
</div>
4848
<hr/>
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<div (click)="trackSourceClick()" class="api-doc-component">
22
<h3>
3-
<a href="https://github.com/valor-software/ngx-bootstrap/tree/development/{{apiDocs.fileName}}" target="_blank">{{apiDocs.className}}</a>
3+
<a href="https://github.com/valor-software/ngx-bootstrap/tree/development/{{apiDocs.fileName}}"
4+
target="_blank" rel="noopener">{{apiDocs.className}}</a>
45
</h3>
56
<p [innerHtml]="apiDocs.description"></p>
67

7-
<template [ngIf]="apiDocs.properties && apiDocs.properties.length">
8+
<ng-template [ngIf]="apiDocs.properties && apiDocs.properties.length">
89
<section>
910
<h3 id="inputs">Properties</h3>
1011
<table class="table table-sm table-hover">
@@ -13,26 +14,26 @@ <h3 id="inputs">Properties</h3>
1314
<td class="col-xs-3"><code>{{prop.name}}</code></td>
1415
<td class="col-xs-9">
1516
<div><i>Type: </i><code>{{ prop.type }}</code></div>
16-
<template [ngIf]="prop.defaultValue">
17+
<ng-template [ngIf]="prop.defaultValue">
1718
<div><i>Default value: </i><code>{{prop.defaultValue || '-'}}</code></div>
18-
</template>
19+
</ng-template>
1920
<div [innerHtml]="prop.description"></div>
2021
</td>
2122
</tr>
2223
</tbody>
2324
</table>
2425
</section>
25-
</template>
26-
<!--<template [ngIf]="apiDocs.properties && apiDocs.properties.length">
26+
</ng-template>
27+
<!--<ng-template [ngIf]="apiDocs.properties && apiDocs.properties.length">
2728
<section>
2829
<h3 id="inputs">Properties</h3>
2930
<p>
30-
<template ngFor let-property [ngForOf]="apiDocs.properties">
31+
<ng-template ngFor let-property [ngForOf]="apiDocs.properties">
3132
<code>{{ property.name }}</code>
32-
</template>
33+
</ng-template>
3334
<i>&mdash; Documentation available in {{ directiveName }}</i>
3435
</p>
3536
</section>
36-
</template>-->
37+
</ng-template>-->
3738
</div>
3839
<hr/>

demo/src/app/api-docs/api-doc/api-doc.component.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="api-doc-component">
22
<h3>
3-
<a (click)="trackSourceClick()" href="https://github.com/valor-software/ngx-bootstrap/tree/development/{{apiDocs.fileName}}" target="_blank">{{apiDocs.className}}</a>
3+
<a (click)="trackSourceClick()" href="https://github.com/valor-software/ngx-bootstrap/tree/development/{{apiDocs.fileName}}" target="_blank" rel="noopener">{{apiDocs.className}}</a>
44
</h3>
55
<p [innerHtml]="apiDocs.description"></p>
66
<table class="table table-sm table-hover">
@@ -16,7 +16,7 @@ <h3>
1616
</tbody>
1717
</table>
1818

19-
<template [ngIf]="apiDocs.inputs.length">
19+
<ng-template [ngIf]="apiDocs.inputs.length">
2020
<section>
2121
<h3 id="inputs">Inputs</h3>
2222
<table class="table table-sm table-hover">
@@ -25,21 +25,21 @@ <h3 id="inputs">Inputs</h3>
2525
<td class="col-xs-3"><code>{{input.name}}</code></td>
2626
<td class="col-xs-9">
2727
<div><i>Type: </i><code>{{ input.type }}</code></div>
28-
<template [ngIf]="defaultInputValue(input) || hasConfigProperty(input)">
28+
<ng-template [ngIf]="defaultInputValue(input) || hasConfigProperty(input)">
2929
<div>
3030
<span><i>Default value: </i><code>{{ defaultInputValue(input) || '-' }}</code></span>
3131
<span *ngIf="hasConfigProperty(input)">&mdash; initialized from {{ configServiceName }} service</span>
3232
</div>
33-
</template>
33+
</ng-template>
3434
<div [innerHtml]="input.description"></div>
3535
</td>
3636
</tr>
3737
</tbody>
3838
</table>
3939
</section>
40-
</template>
40+
</ng-template>
4141

42-
<template [ngIf]="apiDocs.outputs.length">
42+
<ng-template [ngIf]="apiDocs.outputs.length">
4343
<section>
4444
<h3 id="outputs">Outputs</h3>
4545
<table class="table table-sm table-hover">
@@ -51,9 +51,9 @@ <h3 id="outputs">Outputs</h3>
5151
</tbody>
5252
</table>
5353
</section>
54-
</template>
54+
</ng-template>
5555

56-
<template [ngIf]="apiDocs.methods.length && apiDocs.exportAs">
56+
<ng-template [ngIf]="apiDocs.methods.length && apiDocs.exportAs">
5757
<section>
5858
<h3 id="methods">Methods</h3>
5959
<table class="table table-sm table-hover">
@@ -69,6 +69,6 @@ <h3 id="methods">Methods</h3>
6969
</tbody>
7070
</table>
7171
</section>
72-
</template>
72+
</ng-template>
7373
</div>
7474
<hr/>

demo/src/app/api-docs/api-doc/api-doc.component.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
*/
55
import { Component, ChangeDetectionStrategy, Input } from '@angular/core';
66
import {
7-
PropertyDesc, DirectiveDesc, InputDesc, MethodDesc, ClassDesc, signature,
7+
PropertyDesc,
8+
DirectiveDesc,
9+
InputDesc,
10+
MethodDesc,
11+
ClassDesc,
12+
signature,
813
NgApiDoc
914
} from '../api-docs.model';
1015
import { Analytics } from '../analytics/analytics';
@@ -32,7 +37,11 @@ export class NgApiDocComponent {
3237
if (configApiDocs) {
3338
this.apiDocs.inputs.forEach(
3439
(input: InputDesc) =>
35-
this._configProperties[input.name] = this._findInputConfigProperty(configApiDocs, input));
40+
(this._configProperties[input.name] = this._findInputConfigProperty(
41+
configApiDocs,
42+
input
43+
))
44+
);
3645
}
3746
}
3847

@@ -43,7 +52,7 @@ export class NgApiDocComponent {
4352
* Object which contains, for each input name of the directive, the corresponding property of the associated config
4453
* service (if any)
4554
*/
46-
private _configProperties: {[propertyName: string]: PropertyDesc};
55+
private _configProperties: { [propertyName: string]: PropertyDesc };
4756
private _analytics: Analytics;
4857
private docs: NgApiDoc;
4958

@@ -77,8 +86,12 @@ export class NgApiDocComponent {
7786
this._analytics.trackEvent('Source File View', this.apiDocs.className);
7887
}
7988

80-
private _findInputConfigProperty(configApiDocs: ClassDesc, input: InputDesc): PropertyDesc {
81-
return configApiDocs.properties
82-
.filter((prop:PropertyDesc) => prop.name === input.name)[0];
89+
private _findInputConfigProperty(
90+
configApiDocs: ClassDesc,
91+
input: InputDesc
92+
): PropertyDesc {
93+
return configApiDocs.properties.filter(
94+
(prop: PropertyDesc) => prop.name === input.name
95+
)[0];
8396
}
8497
}

demo/src/app/api-docs/api-docs.model.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,9 @@ export interface ArgumentDesc {
3636
type: string;
3737
}
3838

39-
export interface InputDesc extends PropertyDesc {
40-
}
39+
export interface InputDesc extends PropertyDesc {}
4140

42-
export interface OutputDesc extends PropertyDesc {
43-
}
41+
export interface OutputDesc extends PropertyDesc {}
4442

4543
/**
4644
* :D
@@ -50,6 +48,8 @@ export class NgApiDoc {
5048
}
5149

5250
export function signature(method: MethodDesc): string {
53-
const args = method.args.map((arg:ArgumentDesc) => `${arg.name}: ${arg.type}`).join(', ');
51+
const args = method.args
52+
.map((arg: ArgumentDesc) => `${arg.name}: ${arg.type}`)
53+
.join(', ');
5454
return `${method.name}(${args})`;
5555
}

demo/src/app/api-docs/index.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,28 @@ import { TabsModule } from 'ngx-bootstrap/tabs';
1515
export { NgApiDoc } from './api-docs.model';
1616
export { Analytics } from './analytics/analytics';
1717
export { NgApiDocComponent } from './api-doc/api-doc.component';
18-
export { NgApiDocClassComponent } from './api-doc-class/api-doc-class.component';
19-
export { NgApiDocConfigComponent } from './api-doc-config/api-doc-config.component';
18+
export {
19+
NgApiDocClassComponent
20+
} from './api-doc-class/api-doc-class.component';
21+
export {
22+
NgApiDocConfigComponent
23+
} from './api-doc-config/api-doc-config.component';
2024
export { SampleBoxComponent } from './sample-box/sample-box.component';
2125

2226
@NgModule({
2327
imports: [CommonModule, TabsModule],
24-
declarations: [NgApiDocComponent, NgApiDocClassComponent,
25-
NgApiDocConfigComponent, SampleBoxComponent],
26-
exports: [NgApiDocComponent, NgApiDocClassComponent, NgApiDocConfigComponent, SampleBoxComponent],
28+
declarations: [
29+
NgApiDocComponent,
30+
NgApiDocClassComponent,
31+
NgApiDocConfigComponent,
32+
SampleBoxComponent
33+
],
34+
exports: [
35+
NgApiDocComponent,
36+
NgApiDocClassComponent,
37+
NgApiDocConfigComponent,
38+
SampleBoxComponent
39+
],
2740
providers: [Analytics]
2841
})
29-
export class NgApiDocModule {
30-
}
42+
export class NgApiDocModule {}

0 commit comments

Comments
 (0)