Skip to content

Commit

Permalink
Merge branch 'development' into feat-datepicker-forms
Browse files Browse the repository at this point in the history
Conflicts:
	src/datepicker/bs-datepicker.module.ts
  • Loading branch information
IlyaSurmay committed Sep 7, 2017
2 parents f2a5c20 + 33198c6 commit 0f74e3f
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 35 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ Best way to quickly integrate <a href="https://getbootstrap.com/">Bootstrap 3</a

ngx-bootstrap contains all core (and not only) Bootstrap components powered by Angular. So you don't need to include original JS components, but we are using markup and css provided by Bootstrap.

Additionally to allow reach experience while working with Dates we are using [moment.js](http://momentjs.com/), de facto base date manipulation library at the moment.

# Installation instructions

Install `ngx-bootstrap` from `npm`
Expand Down
10 changes: 0 additions & 10 deletions docs/getting-started/angular-seed.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@
{
name:'ngx-bootstrap/*',
path:'node_modules/ngx-bootstrap/bundles/ngx-bootstrap.umd.min.js'
},

// mandatory dependency for ngx-bootstrap datepicker
{
name:'moment',
path:'node_modules/moment',
packageMeta:{
main: 'moment.js',
defaultExtension: 'js'
}
}
];
this.addPackagesBundles(additionalPackages);
Expand Down
2 changes: 2 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ module.exports = function (config) {
configuration.plugins.push(require('karma-sauce-launcher'));
configuration.reporters.push('saucelabs');
configuration.sauceLabs = {
startConnect: false,
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER,
verbose: true,
testName: 'ng2-bootstrap unit tests',
recordScreenshots: false,
Expand Down
20 changes: 10 additions & 10 deletions src/datepicker/bs-datepicker.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@ import { BsCalendarLayoutComponent } from './themes/bs/bs-calendar-layout.compon
import { BsDatepickerInputDirective } from './bs-datepicker-input.directive';
import { BsDaterangepickerInputDirective } from './bs-daterangepicker-input.directive';

import { warnOnce } from '../utils/warn-once';

const _exports = [
BsDatepickerContainerComponent,
BsDaterangepickerContainerComponent,
BsDatepickerContainerComponent,
BsDaterangepickerContainerComponent,

BsDatepickerComponent,
BsDatepickerInputDirective,
BsDatepickerComponent,
BsDatepickerInputDirective,

BsDaterangepickerInputDirective,
BsDaterangepickerComponent
]
BsDaterangepickerInputDirective,
BsDaterangepickerComponent
];

@NgModule({
imports: [CommonModule],
Expand All @@ -55,11 +57,9 @@ const _exports = [
})
export class BsDatepickerModule {
constructor() {
if (isDevMode()) {
console.warn(`BsDatepickerModule is under development,
warnOnce(`BsDatepickerModule is under development,
BREAKING CHANGES are possible,
PLEASE, read changelog`);
}
}

static forRoot(): ModuleWithProviders {
Expand Down
4 changes: 3 additions & 1 deletion src/ng2-bootstrap.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
console.warn('DEPRECATED: please replace import of `ng2-bootstrap/ng2-bootstrap` with `ng2-bootstrap`');
import { warnOnce } from './utils/warn-once';

warnOnce('DEPRECATED: please replace import of `ng2-bootstrap/ng2-bootstrap` with `ng2-bootstrap`');
export * from './index';
25 changes: 13 additions & 12 deletions src/tooltip/tooltip.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { TooltipContainerComponent } from './tooltip-container.component';
import { TooltipConfig } from './tooltip.config';
import { ComponentLoaderFactory, ComponentLoader } from '../component-loader';
import { OnChange } from '../utils/decorators';
import { warnOnce } from '../utils/warn-once';

@Directive({
selector: '[tooltip], [tooltipHtml]',
Expand Down Expand Up @@ -68,50 +69,50 @@ export class TooltipDirective implements OnInit, OnDestroy {
/** @deprecated - please use `tooltip` instead */
@Input('tooltipHtml')
public set htmlContent(value: string | TemplateRef<any>) {
console.warn('tooltipHtml was deprecated, please use `tooltip` instead');
warnOnce('tooltipHtml was deprecated, please use `tooltip` instead');
this.tooltip = value;
}

/** @deprecated - please use `placement` instead */
@Input('tooltipPlacement')
public set _placement(value: string) {
console.warn('tooltipPlacement was deprecated, please use `placement` instead');
warnOnce('tooltipPlacement was deprecated, please use `placement` instead');
this.placement = value;
}

/** @deprecated - please use `isOpen` instead*/
@Input('tooltipIsOpen')
public set _isOpen(value: boolean) {
console.warn('tooltipIsOpen was deprecated, please use `isOpen` instead');
warnOnce('tooltipIsOpen was deprecated, please use `isOpen` instead');
this.isOpen = value;
}

public get _isOpen(): boolean {
console.warn('tooltipIsOpen was deprecated, please use `isOpen` instead');
warnOnce('tooltipIsOpen was deprecated, please use `isOpen` instead');
return this.isOpen;
}

/** @deprecated - please use `isDisabled` instead */
@Input('tooltipEnable')
public set _enable(value: boolean) {
console.warn('tooltipEnable was deprecated, please use `isDisabled` instead');
warnOnce('tooltipEnable was deprecated, please use `isDisabled` instead');
this.isDisabled = value === true;
}

public get _enable(): boolean {
console.warn('tooltipEnable was deprecated, please use `isDisabled` instead');
warnOnce('tooltipEnable was deprecated, please use `isDisabled` instead');
return this.isDisabled === true;
}

/** @deprecated - please use `container="body"` instead */
@Input('tooltipAppendToBody')
public set _appendToBody(value: boolean) {
console.warn('tooltipAppendToBody was deprecated, please use `container="body"` instead');
warnOnce('tooltipAppendToBody was deprecated, please use `container="body"` instead');
this.container = value ? 'body' : this.container;
}

public get _appendToBody(): boolean {
console.warn('tooltipAppendToBody was deprecated, please use `container="body"` instead');
warnOnce('tooltipAppendToBody was deprecated, please use `container="body"` instead');
return this.container === 'body';
}

Expand All @@ -121,13 +122,13 @@ export class TooltipDirective implements OnInit, OnDestroy {
/** @deprecated - will replaced with customClass */
@Input('tooltipClass')
public set _popupClass(value: string) {
console.warn('tooltipClass deprecated');
warnOnce('tooltipClass deprecated');
}

/** @deprecated - removed */
@Input('tooltipContext')
public set _tooltipContext(value: any) {
console.warn('tooltipContext deprecated');
warnOnce('tooltipContext deprecated');
}

/** @deprecated */
Expand All @@ -139,12 +140,12 @@ export class TooltipDirective implements OnInit, OnDestroy {
/** @deprecated - please use `triggers` instead */
@Input('tooltipTrigger')
public get _tooltipTrigger(): string|Array<string> {
console.warn('tooltipTrigger was deprecated, please use `triggers` instead');
warnOnce('tooltipTrigger was deprecated, please use `triggers` instead');
return this.triggers;
};

public set _tooltipTrigger(value: string|Array<string>) {
console.warn('tooltipTrigger was deprecated, please use `triggers` instead');
warnOnce('tooltipTrigger was deprecated, please use `triggers` instead');
this.triggers = (value || '').toString();
};

Expand Down
14 changes: 14 additions & 0 deletions src/utils/warn-once.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { isDevMode } from '@angular/core';

const _messagesHash: { [key: string]: boolean } = {};
const _hideMsg = !isDevMode() || typeof console === 'undefined' || !console.warn;

export function warnOnce(msg: string): void {
if (_hideMsg || msg in _messagesHash) {
return;
}

_messagesHash[msg] = true;
/*tslint:disable-next-line*/
console.warn(msg);
}

0 comments on commit 0f74e3f

Please sign in to comment.