diff --git a/demo/src/app/app.module.ts b/demo/src/app/app.module.ts index b0268a1f76..437503825d 100644 --- a/demo/src/app/app.module.ts +++ b/demo/src/app/app.module.ts @@ -20,6 +20,7 @@ import { DemoDatepickerModule } from './components/datepicker'; import { DemoDropdownModule } from './components/dropdown'; import { DemoModalModule } from './components/modal'; import { DemoPaginationModule } from './components/pagination'; +import { DemoPopoverModule } from './components/popover/index'; import { DemoProgressbarModule } from './components/progressbar'; import { DemoRatingModule } from './components/rating'; import { DemoTabsModule } from './components/tabs'; @@ -55,6 +56,7 @@ import { ngdoc } from '../ng-api-doc'; DemoDropdownModule, DemoModalModule, DemoPaginationModule, + DemoPopoverModule, DemoProgressbarModule, DemoRatingModule, DemoTabsModule, diff --git a/demo/src/app/app.routing.ts b/demo/src/app/app.routing.ts index a3ea93f306..5c9b66e696 100644 --- a/demo/src/app/app.routing.ts +++ b/demo/src/app/app.routing.ts @@ -14,6 +14,7 @@ import { TabsSectionComponent } from './components/tabs/tabs-section.component'; import { TimepickerSectionComponent } from './components/timepicker/timepicker-section.component'; import { TooltipSectionComponent } from './components/tooltip/tooltip-section.component'; import { TypeaheadSectionComponent } from './components/typeahead/typeahead-section.component'; +import { PopoverSectionComponent } from './components/popover/popover-section.component'; export const routes = [ { @@ -66,6 +67,11 @@ export const routes = [ data: ['Pagination'], component: PaginationSectionComponent }, + { + path: 'popover', + data: ['Popover'], + component: PopoverSectionComponent + }, { path: 'progressbar', data: ['Progressbar'], diff --git a/demo/src/app/components/popover/demos/basic/basic.html b/demo/src/app/components/popover/demos/basic/basic.html new file mode 100644 index 0000000000..44745424d5 --- /dev/null +++ b/demo/src/app/components/popover/demos/basic/basic.html @@ -0,0 +1,5 @@ + + diff --git a/demo/src/app/components/popover/demos/basic/basic.ts b/demo/src/app/components/popover/demos/basic/basic.ts new file mode 100644 index 0000000000..5cad47c7c2 --- /dev/null +++ b/demo/src/app/components/popover/demos/basic/basic.ts @@ -0,0 +1,8 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'demo-popover-basic', + templateUrl: './basic.html' +}) +export class DemoPopoverBasicComponent { +} diff --git a/demo/src/app/components/popover/demos/config/config.html b/demo/src/app/components/popover/demos/config/config.html new file mode 100644 index 0000000000..2beb90485a --- /dev/null +++ b/demo/src/app/components/popover/demos/config/config.html @@ -0,0 +1,4 @@ + diff --git a/demo/src/app/components/popover/demos/config/config.ts b/demo/src/app/components/popover/demos/config/config.ts new file mode 100644 index 0000000000..c976e9e586 --- /dev/null +++ b/demo/src/app/components/popover/demos/config/config.ts @@ -0,0 +1,16 @@ +import { Component } from '@angular/core'; +import { PopoverConfig } from 'ng2-bootstrap'; + +// such override allows to keep some initial values + +export function getAlertConfig(): PopoverConfig { + return Object.assign(new PopoverConfig(), {placement: 'right', container: 'body', triggers: 'focus'}); +} + +@Component({ + selector: 'demo-popover-config', + templateUrl: './config.html', + providers: [{provide: PopoverConfig, useFactory: getAlertConfig}] +}) +export class DemoPopoverConfigComponent { +} diff --git a/demo/src/app/components/popover/demos/container/container.html b/demo/src/app/components/popover/demos/container/container.html new file mode 100644 index 0000000000..ea31a92817 --- /dev/null +++ b/demo/src/app/components/popover/demos/container/container.html @@ -0,0 +1,13 @@ +
diff --git a/demo/src/app/components/popover/demos/container/container.ts b/demo/src/app/components/popover/demos/container/container.ts new file mode 100644 index 0000000000..c333dab876 --- /dev/null +++ b/demo/src/app/components/popover/demos/container/container.ts @@ -0,0 +1,8 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'demo-popover-container', + templateUrl: './container.html' +}) +export class DemoPopoverContainerComponent { +} diff --git a/demo/src/app/components/popover/demos/dismiss/dismiss.html b/demo/src/app/components/popover/demos/dismiss/dismiss.html new file mode 100644 index 0000000000..cd23716e5b --- /dev/null +++ b/demo/src/app/components/popover/demos/dismiss/dismiss.html @@ -0,0 +1,7 @@ + + diff --git a/demo/src/app/components/popover/demos/dismiss/dismiss.ts b/demo/src/app/components/popover/demos/dismiss/dismiss.ts new file mode 100644 index 0000000000..290f8e6226 --- /dev/null +++ b/demo/src/app/components/popover/demos/dismiss/dismiss.ts @@ -0,0 +1,8 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'demo-popover-dismiss', + templateUrl: './dismiss.html' +}) +export class DemoPopoverDismissComponent { +} diff --git a/demo/src/app/components/popover/demos/dynamic-html/dynamic-html.html b/demo/src/app/components/popover/demos/dynamic-html/dynamic-html.html new file mode 100644 index 0000000000..39e77290c9 --- /dev/null +++ b/demo/src/app/components/popover/demos/dynamic-html/dynamic-html.html @@ -0,0 +1,5 @@ +Here we go: + diff --git a/demo/src/app/components/popover/demos/dynamic-html/dynamic-html.ts b/demo/src/app/components/popover/demos/dynamic-html/dynamic-html.ts new file mode 100644 index 0000000000..5c7ec1d670 --- /dev/null +++ b/demo/src/app/components/popover/demos/dynamic-html/dynamic-html.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'demo-popover-dynamic-html', + templateUrl: './dynamic-html.html' +}) +export class DemoPopoverDynamicHtmlComponent { + public html:string = ` +Never trust not sanitized HTML!!!`; +} diff --git a/demo/src/app/components/popover/demos/dynamic/dynamic.html b/demo/src/app/components/popover/demos/dynamic/dynamic.html new file mode 100644 index 0000000000..2055488dc6 --- /dev/null +++ b/demo/src/app/components/popover/demos/dynamic/dynamic.html @@ -0,0 +1,10 @@ + + +Just another: {{content}} + diff --git a/demo/src/app/components/popover/demos/dynamic/dynamic.ts b/demo/src/app/components/popover/demos/dynamic/dynamic.ts new file mode 100644 index 0000000000..0f16e18d90 --- /dev/null +++ b/demo/src/app/components/popover/demos/dynamic/dynamic.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'demo-popover-dynamic', + templateUrl: './dynamic.html' +}) +export class DemoPopoverDynamicComponent { + public title:string = 'Welcome word'; + public content: string = 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus.'; +} diff --git a/demo/src/app/components/popover/demos/four-directions/four-directions.html b/demo/src/app/components/popover/demos/four-directions/four-directions.html new file mode 100644 index 0000000000..20131853d9 --- /dev/null +++ b/demo/src/app/components/popover/demos/four-directions/four-directions.html @@ -0,0 +1,27 @@ + + + + + + + diff --git a/demo/src/app/components/popover/demos/four-directions/four-directions.ts b/demo/src/app/components/popover/demos/four-directions/four-directions.ts new file mode 100644 index 0000000000..26ca5d1d79 --- /dev/null +++ b/demo/src/app/components/popover/demos/four-directions/four-directions.ts @@ -0,0 +1,8 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'demo-popover-four-directions', + templateUrl: './four-directions.html' +}) +export class DemoPopoverFourDirectionsComponent { +} diff --git a/demo/src/app/components/popover/demos/index.ts b/demo/src/app/components/popover/demos/index.ts new file mode 100644 index 0000000000..d1080911ca --- /dev/null +++ b/demo/src/app/components/popover/demos/index.ts @@ -0,0 +1,48 @@ +import { DemoPopoverBasicComponent } from './basic/basic'; +import { DemoPopoverFourDirectionsComponent } from './four-directions/four-directions'; +import { DemoPopoverDismissComponent } from './dismiss/dismiss'; +import { DemoPopoverDynamicComponent } from './dynamic/dynamic'; +import { DemoPopoverDynamicHtmlComponent } from './dynamic-html/dynamic-html'; +import { DemoPopoverContainerComponent } from './container/container'; +import { DemoPopoverConfigComponent } from './config/config'; + +export const DEMO_COMPONENTS = [ + DemoPopoverBasicComponent, + DemoPopoverFourDirectionsComponent, + DemoPopoverDismissComponent, + DemoPopoverDynamicComponent, + DemoPopoverDynamicHtmlComponent, + DemoPopoverContainerComponent, + DemoPopoverConfigComponent +]; + +export const DEMOS = { + basic: { + component: require('!!raw?lang=typescript!./basic/basic.ts'), + html: require('!!raw?lang=markup!./basic/basic.html') + }, + forDirections: { + component: require('!!raw?lang=typescript!./four-directions/four-directions.ts'), + html: require('!!raw?lang=markup!./four-directions/four-directions.html') + }, + dismiss: { + component: require('!!raw?lang=typescript!./dismiss/dismiss.ts'), + html: require('!!raw?lang=markup!./dismiss/dismiss.html') + }, + dynamic: { + component: require('!!raw?lang=typescript!./dynamic/dynamic.ts'), + html: require('!!raw?lang=markup!./dynamic/dynamic.html') + }, + dynamicHtml: { + component: require('!!raw?lang=typescript!./dynamic-html/dynamic-html.ts'), + html: require('!!raw?lang=markup!./dynamic-html/dynamic-html.html') + }, + container: { + component: require('!!raw?lang=typescript!./container/container.ts'), + html: require('!!raw?lang=markup!./container/container.html') + }, + config: { + component: require('!!raw?lang=typescript!./config/config.ts'), + html: require('!!raw?lang=markup!./config/config.html') + } +}; diff --git a/demo/src/app/components/popover/demos/styling-global/styling-global.html b/demo/src/app/components/popover/demos/styling-global/styling-global.html new file mode 100644 index 0000000000..94be687165 --- /dev/null +++ b/demo/src/app/components/popover/demos/styling-global/styling-global.html @@ -0,0 +1,10 @@ + +Add small overlay content, like those found in iOS, to any element for housing secondary information.
+ +Use the focus
trigger to dismiss popovers on the next click that the user makes.
Popover content can contain any html template. Just create <template #myId>
with any
+ html allowed by Angular, and provide template ref (#myId
) as popover content.
By using small trick you can display any dynamic html, which you got from ajax request for example.
+When you have some styles on a parent element that interfere with a popover, you’ll want to specify a container="body"
so that the popover’s HTML will be appended to body. This will help to avoid rendering problems in more complex components (like our input groups, button groups, etc) or inside elements with overflow: hidden