Skip to content

Commit

Permalink
feat(package): drop support of ng v2 and add support of ng v4 and v5 (#…
Browse files Browse the repository at this point in the history
…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 (#2357)

- Removed duplicate export

* fix(weeks): change calculation of week number (#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
  • Loading branch information
valorkin authored Sep 14, 2017
1 parent 101fb20 commit 31c5f62
Show file tree
Hide file tree
Showing 409 changed files with 9,953 additions and 6,921 deletions.
12 changes: 11 additions & 1 deletion .angular-cli.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "ngx-bootstrap"
},
Expand All @@ -12,13 +13,17 @@
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "../../scripts/test.ts",
"tsconfig": "tsconfig.json",
"testTsconfig": "../../src/tsconfig.spec.json",
"prefix": "",
"mobile": false,
"serviceWorker": true,
"styles": [
"../../src/datepicker/bs-datepicker.scss"
"../../src/datepicker/bs-datepicker.scss",
"assets/css/style.css",
"assets/css/prettify-angulario.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
Expand All @@ -35,6 +40,11 @@
"config": "protractor.conf.js"
}
},
"lint": [
{
"project": "../tslint.json"
}
],
"test": {
"karma": {
"config": "karma.conf.js"
Expand Down
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": true,
"parser": "typescript"
}
19 changes: 12 additions & 7 deletions demo/src/app/api-docs/analytics/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
* @copyright ng-bootstrap
*/
import { Injectable } from '@angular/core';
import { Router, NavigationEnd } from '@angular/router';
import { NavigationEnd, Router } from '@angular/router';
import { Location } from '@angular/common';

import 'rxjs/add/operator/filter';

declare const ga: any;

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

/**
* Intended to be called only once. Subscribes to router events and sends a page view
* after each ended navigation event.
* Intended to be called only once. Subscribes to router events and sends a
* page view after each ended navigation event.
*/
public trackPageViews(): void {
if (!this._enabled) {
Expand All @@ -38,7 +39,7 @@ export class Analytics {
.filter((event: any) => event instanceof NavigationEnd)
.subscribe(() => {
if (typeof ga !== 'undefined') {
ga('send', {hitType: 'pageview', page: this._location.path()});
ga('send', { hitType: 'pageview', page: this._location.path() });
}
});
}
Expand All @@ -51,7 +52,11 @@ export class Analytics {
return;
}
if (typeof ga !== 'undefined') {
ga('send', {hitType: 'event', eventCategory: category, eventAction: action});
ga('send', {
hitType: 'event',
eventCategory: category,
eventAction: action
});
}
}
}
14 changes: 7 additions & 7 deletions demo/src/app/api-docs/api-doc-class/api-doc-class.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<h3>
<a (click)="trackSourceClick()"
href="https://github.com/valor-software/ngx-bootstrap/tree/development/{{apiDocs.fileName}}"
target="_blank">{{apiDocs.className}}</a>
target="_blank" rel="noopener">{{apiDocs.className}}</a>
</h3>
<p [innerHtml]="apiDocs.description"></p>

<template [ngIf]="apiDocs.properties && apiDocs.properties.length">
<ng-template [ngIf]="apiDocs.properties && apiDocs.properties.length">
<section>
<h3 id="inputs">Properties</h3>
<table class="table table-sm table-hover">
Expand All @@ -15,18 +15,18 @@ <h3 id="inputs">Properties</h3>
<td class="col-xs-3"><code>{{prop.name}}</code></td>
<td class="col-xs-9">
<div><i>Type: </i><code>{{ prop.type }}</code></div>
<template [ngIf]="prop.defaultValue">
<ng-template [ngIf]="prop.defaultValue">
<div><i>Default value: </i><code>{{prop.defaultValue || '-'}}</code></div>
</template>
</ng-template>
<div><span [innerHtml]="prop.description"></span></div>
</td>
</tr>
</tbody>
</table>
</section>
</template>
</ng-template>

<template [ngIf]="apiDocs.methods && apiDocs.methods.length">
<ng-template [ngIf]="apiDocs.methods && apiDocs.methods.length">
<section>
<h3 id="methods">Methods</h3>
<table class="table table-sm table-hover">
Expand All @@ -43,6 +43,6 @@ <h3 id="methods">Methods</h3>
</tbody>
</table>
</section>
</template>
</ng-template>
</div>
<hr/>
19 changes: 10 additions & 9 deletions demo/src/app/api-docs/api-doc-config/api-doc-config.component.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<div (click)="trackSourceClick()" class="api-doc-component">
<h3>
<a href="https://github.com/valor-software/ngx-bootstrap/tree/development/{{apiDocs.fileName}}" target="_blank">{{apiDocs.className}}</a>
<a href="https://github.com/valor-software/ngx-bootstrap/tree/development/{{apiDocs.fileName}}"
target="_blank" rel="noopener">{{apiDocs.className}}</a>
</h3>
<p [innerHtml]="apiDocs.description"></p>

<template [ngIf]="apiDocs.properties && apiDocs.properties.length">
<ng-template [ngIf]="apiDocs.properties && apiDocs.properties.length">
<section>
<h3 id="inputs">Properties</h3>
<table class="table table-sm table-hover">
Expand All @@ -13,26 +14,26 @@ <h3 id="inputs">Properties</h3>
<td class="col-xs-3"><code>{{prop.name}}</code></td>
<td class="col-xs-9">
<div><i>Type: </i><code>{{ prop.type }}</code></div>
<template [ngIf]="prop.defaultValue">
<ng-template [ngIf]="prop.defaultValue">
<div><i>Default value: </i><code>{{prop.defaultValue || '-'}}</code></div>
</template>
</ng-template>
<div [innerHtml]="prop.description"></div>
</td>
</tr>
</tbody>
</table>
</section>
</template>
<!--<template [ngIf]="apiDocs.properties && apiDocs.properties.length">
</ng-template>
<!--<ng-template [ngIf]="apiDocs.properties && apiDocs.properties.length">
<section>
<h3 id="inputs">Properties</h3>
<p>
<template ngFor let-property [ngForOf]="apiDocs.properties">
<ng-template ngFor let-property [ngForOf]="apiDocs.properties">
<code>{{ property.name }}</code>
</template>
</ng-template>
<i>&mdash; Documentation available in {{ directiveName }}</i>
</p>
</section>
</template>-->
</ng-template>-->
</div>
<hr/>
18 changes: 9 additions & 9 deletions demo/src/app/api-docs/api-doc/api-doc.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="api-doc-component">
<h3>
<a (click)="trackSourceClick()" href="https://github.com/valor-software/ngx-bootstrap/tree/development/{{apiDocs.fileName}}" target="_blank">{{apiDocs.className}}</a>
<a (click)="trackSourceClick()" href="https://github.com/valor-software/ngx-bootstrap/tree/development/{{apiDocs.fileName}}" target="_blank" rel="noopener">{{apiDocs.className}}</a>
</h3>
<p [innerHtml]="apiDocs.description"></p>
<table class="table table-sm table-hover">
Expand All @@ -16,7 +16,7 @@ <h3>
</tbody>
</table>

<template [ngIf]="apiDocs.inputs.length">
<ng-template [ngIf]="apiDocs.inputs.length">
<section>
<h3 id="inputs">Inputs</h3>
<table class="table table-sm table-hover">
Expand All @@ -25,21 +25,21 @@ <h3 id="inputs">Inputs</h3>
<td class="col-xs-3"><code>{{input.name}}</code></td>
<td class="col-xs-9">
<div><i>Type: </i><code>{{ input.type }}</code></div>
<template [ngIf]="defaultInputValue(input) || hasConfigProperty(input)">
<ng-template [ngIf]="defaultInputValue(input) || hasConfigProperty(input)">
<div>
<span><i>Default value: </i><code>{{ defaultInputValue(input) || '-' }}</code></span>
<span *ngIf="hasConfigProperty(input)">&mdash; initialized from {{ configServiceName }} service</span>
</div>
</template>
</ng-template>
<div [innerHtml]="input.description"></div>
</td>
</tr>
</tbody>
</table>
</section>
</template>
</ng-template>

<template [ngIf]="apiDocs.outputs.length">
<ng-template [ngIf]="apiDocs.outputs.length">
<section>
<h3 id="outputs">Outputs</h3>
<table class="table table-sm table-hover">
Expand All @@ -51,9 +51,9 @@ <h3 id="outputs">Outputs</h3>
</tbody>
</table>
</section>
</template>
</ng-template>

<template [ngIf]="apiDocs.methods.length && apiDocs.exportAs">
<ng-template [ngIf]="apiDocs.methods.length && apiDocs.exportAs">
<section>
<h3 id="methods">Methods</h3>
<table class="table table-sm table-hover">
Expand All @@ -69,6 +69,6 @@ <h3 id="methods">Methods</h3>
</tbody>
</table>
</section>
</template>
</ng-template>
</div>
<hr/>
25 changes: 19 additions & 6 deletions demo/src/app/api-docs/api-doc/api-doc.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
*/
import { Component, ChangeDetectionStrategy, Input } from '@angular/core';
import {
PropertyDesc, DirectiveDesc, InputDesc, MethodDesc, ClassDesc, signature,
PropertyDesc,
DirectiveDesc,
InputDesc,
MethodDesc,
ClassDesc,
signature,
NgApiDoc
} from '../api-docs.model';
import { Analytics } from '../analytics/analytics';
Expand Down Expand Up @@ -32,7 +37,11 @@ export class NgApiDocComponent {
if (configApiDocs) {
this.apiDocs.inputs.forEach(
(input: InputDesc) =>
this._configProperties[input.name] = this._findInputConfigProperty(configApiDocs, input));
(this._configProperties[input.name] = this._findInputConfigProperty(
configApiDocs,
input
))
);
}
}

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

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

private _findInputConfigProperty(configApiDocs: ClassDesc, input: InputDesc): PropertyDesc {
return configApiDocs.properties
.filter((prop:PropertyDesc) => prop.name === input.name)[0];
private _findInputConfigProperty(
configApiDocs: ClassDesc,
input: InputDesc
): PropertyDesc {
return configApiDocs.properties.filter(
(prop: PropertyDesc) => prop.name === input.name
)[0];
}
}
10 changes: 5 additions & 5 deletions demo/src/app/api-docs/api-docs.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ export interface ArgumentDesc {
type: string;
}

export interface InputDesc extends PropertyDesc {
}
export interface InputDesc extends PropertyDesc {}

export interface OutputDesc extends PropertyDesc {
}
export interface OutputDesc extends PropertyDesc {}

/**
* :D
Expand All @@ -50,6 +48,8 @@ export class NgApiDoc {
}

export function signature(method: MethodDesc): string {
const args = method.args.map((arg:ArgumentDesc) => `${arg.name}: ${arg.type}`).join(', ');
const args = method.args
.map((arg: ArgumentDesc) => `${arg.name}: ${arg.type}`)
.join(', ');
return `${method.name}(${args})`;
}
26 changes: 19 additions & 7 deletions demo/src/app/api-docs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,28 @@ import { TabsModule } from 'ngx-bootstrap/tabs';
export { NgApiDoc } from './api-docs.model';
export { Analytics } from './analytics/analytics';
export { NgApiDocComponent } from './api-doc/api-doc.component';
export { NgApiDocClassComponent } from './api-doc-class/api-doc-class.component';
export { NgApiDocConfigComponent } from './api-doc-config/api-doc-config.component';
export {
NgApiDocClassComponent
} from './api-doc-class/api-doc-class.component';
export {
NgApiDocConfigComponent
} from './api-doc-config/api-doc-config.component';
export { SampleBoxComponent } from './sample-box/sample-box.component';

@NgModule({
imports: [CommonModule, TabsModule],
declarations: [NgApiDocComponent, NgApiDocClassComponent,
NgApiDocConfigComponent, SampleBoxComponent],
exports: [NgApiDocComponent, NgApiDocClassComponent, NgApiDocConfigComponent, SampleBoxComponent],
declarations: [
NgApiDocComponent,
NgApiDocClassComponent,
NgApiDocConfigComponent,
SampleBoxComponent
],
exports: [
NgApiDocComponent,
NgApiDocClassComponent,
NgApiDocConfigComponent,
SampleBoxComponent
],
providers: [Analytics]
})
export class NgApiDocModule {
}
export class NgApiDocModule {}
Loading

0 comments on commit 31c5f62

Please sign in to comment.