Skip to content

Commit 690d811

Browse files
IlyaSurmayvalorkin
authored andcommitted
feat(popover & tooltip): add container classes (#2190)
* feat(tooltip): add containerClass * feat(popover): add containerClass * refactor(popover & tooltip): string setters, no reserved keywords fixes #1707 fixes #1395
1 parent d039a8d commit 690d811

File tree

14 files changed

+97
-11
lines changed

14 files changed

+97
-11
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<button type="button" class="btn btn-primary"
2+
popover="Vivamus sagittis lacus vel augue laoreet rutrum faucibus." containerClass="customClass">
3+
Custom class demo
4+
</button>
5+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'demo-popover-class',
5+
templateUrl: './class.html'
6+
})
7+
export class DemoPopoverClassComponent {
8+
}

demo/src/app/components/+popover/demos/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { DemoPopoverStylingGlobalComponent } from './styling-global/styling-glob
99
import { DemoPopoverStylingLocalComponent } from './styling-local/styling-local';
1010
import { DemoPopoverTriggersCustomComponent } from './triggers-custom/triggers-custom';
1111
import { DemoPopoverTriggersManualComponent } from './triggers-manual/triggers-manual';
12+
import { DemoPopoverClassComponent } from './class/class';
1213

1314
export const DEMO_COMPONENTS = [
1415
DemoPopoverBasicComponent,
@@ -21,7 +22,8 @@ export const DEMO_COMPONENTS = [
2122
DemoPopoverStylingGlobalComponent,
2223
DemoPopoverStylingLocalComponent,
2324
DemoPopoverTriggersCustomComponent,
24-
DemoPopoverTriggersManualComponent
25+
DemoPopoverTriggersManualComponent,
26+
DemoPopoverClassComponent
2527
];
2628

2729
export const DEMOS = {
@@ -68,5 +70,9 @@ export const DEMOS = {
6870
stylingGlobal: {
6971
component: require('!!raw-loader?lang=typescript!./styling-global/styling-global.ts'),
7072
html: require('!!raw-loader?lang=markup!./styling-global/styling-global.html')
73+
},
74+
customClass: {
75+
component: require('!!raw-loader?lang=typescript!./class/class.ts'),
76+
html: require('!!raw-loader?lang=markup!./class/class.html')
7177
}
7278
};

demo/src/app/components/+popover/popover-section.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ let titleDoc = require('html-loader!markdown-loader!./docs/title.md');
2424
<li><a routerLink="." fragment="triggers-custom">Custom triggers</a></li>
2525
<li><a routerLink="." fragment="triggers-manual">Manual triggering</a></li>
2626
<li><a routerLink="." fragment="styling-local">Component level styling</a></li>
27+
<li><a routerLink="." fragment="class">Custom class</a></li>
2728
<!--<li><a routerLink="." fragment="styling-global">Global styling</a></li>-->
2829
</ul>
2930
</li>
@@ -98,7 +99,11 @@ let titleDoc = require('html-loader!markdown-loader!./docs/title.md');
9899
<demo-popover-styling-local></demo-popover-styling-local>
99100
</ng-sample-box>
100101
101-
<!-- todo: add custom class -->
102+
<h2 routerLink="." fragment="class" id="class">Custom class</h2>
103+
<ng-sample-box [ts]="demos.customClass.component" [html]="demos.customClass.html">
104+
<demo-popover-class></demo-popover-class>
105+
</ng-sample-box>
106+
102107
<!--<h2 routerLink="." fragment="styling-global" id="styling-global">Global styling</h2>-->
103108
<!--<ng-sample-box [ts]="demos.stylingGlobal.component" [html]="demos.stylingGlobal.html">-->
104109
<!--<demo-popover-styling-global></demo-popover-styling-global>-->
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<button type="button" class="btn btn-primary"
2+
tooltip="Vivamus sagittis lacus vel augue laoreet rutrum faucibus." containerClass="customClass">
3+
Demo with custom class
4+
</button>
5+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'demo-tooltip-class',
5+
templateUrl: './class.html'
6+
})
7+
export class DemoTooltipClassComponent {
8+
}

demo/src/app/components/+tooltip/demos/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { DemoTooltipStylingLocalComponent } from './styling-local/styling-local'
99
import { DemoTooltipTriggersCustomComponent } from './triggers-custom/triggers-custom';
1010
import { DemoTooltipTriggersManualComponent } from './triggers-manual/triggers-manual';
1111
import { DemoTooltipDynamicHtmlComponent } from './dynamic-html/dynamic-html';
12+
import { DemoTooltipClassComponent } from './class/class';
1213

1314
export const DEMO_COMPONENTS = [
1415
DemoTooltipBasicComponent,
@@ -21,7 +22,8 @@ export const DEMO_COMPONENTS = [
2122
DemoTooltipStylingGlobalComponent,
2223
DemoTooltipStylingLocalComponent,
2324
DemoTooltipTriggersCustomComponent,
24-
DemoTooltipTriggersManualComponent
25+
DemoTooltipTriggersManualComponent,
26+
DemoTooltipClassComponent
2527
];
2628

2729
export const DEMOS = {
@@ -68,5 +70,9 @@ export const DEMOS = {
6870
stylingGlobal: {
6971
component: require('!!raw-loader?lang=typescript!./styling-global/styling-global.ts'),
7072
html: require('!!raw-loader?lang=markup!./styling-global/styling-global.html')
73+
},
74+
customClass: {
75+
component: require('!!raw-loader?lang=typescript!./class/class.ts'),
76+
html: require('!!raw-loader?lang=markup!./class/class.html')
7177
}
7278
};

demo/src/app/components/+tooltip/tooltip-section.component.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ let titleDoc = require('html-loader!markdown-loader!./docs/title.md');
2323
<li><a routerLink="." fragment="triggers-custom">Custom triggers</a></li>
2424
<li><a routerLink="." fragment="triggers-manual">Manual triggering</a></li>
2525
<li><a routerLink="." fragment="styling-local">Component level styling</a></li>
26+
<li><a routerLink="." fragment="custom-class">Custom class</a></li>
2627
</ul>
2728
</li>
2829
<li><a routerLink="." fragment="api-reference">API Reference</a>
@@ -95,6 +96,11 @@ let titleDoc = require('html-loader!markdown-loader!./docs/title.md');
9596
<ng-sample-box [ts]="demos.stylingComponent.component" [html]="demos.stylingComponent.html">
9697
<demo-tooltip-styling-local></demo-tooltip-styling-local>
9798
</ng-sample-box>
99+
100+
<h2 routerLink="." fragment="custom-class" id="custom-class">Custom class</h2>
101+
<ng-sample-box [ts]="demos.customClass.component" [html]="demos.customClass.html">
102+
<demo-tooltip-class></demo-tooltip-class>
103+
</ng-sample-box>
98104
99105
<h2 routerLink="." fragment="api-reference" id="api-reference">API Reference</h2>
100106

demo/src/assets/css/style.css

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,15 @@ pre {
620620
transition: opacity 1s;
621621
}
622622
.tooltip.customClass .tooltip-arrow {
623-
display: none;
623+
border-top-color: #ffff75;
624+
}
625+
626+
/* Specify styling for popover contents */
627+
.popover.customClass, .popover.customClass .popover-content {
628+
background: #94bada;
629+
}
630+
.popover.customClass.top>.arrow:after {
631+
border-top-color: #94bada;
624632
}
625633

626634
.nav-item.customClass {

demo/src/ng-api-doc.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,6 +1007,12 @@ export const ngdoc: any = {
10071007
}
10081008
],
10091009
"returnType": "void"
1010+
},
1011+
{
1012+
"name": "focusOtherModal",
1013+
"description": "<p>Events tricks </p>\n",
1014+
"args": [],
1015+
"returnType": "void"
10101016
}
10111017
]
10121018
},
@@ -1252,6 +1258,11 @@ export const ngdoc: any = {
12521258
"type": "string",
12531259
"description": "<p>A selector specifying the element the popover should be appended to.\nCurrently only supports &quot;body&quot;.</p>\n"
12541260
},
1261+
{
1262+
"name": "containerClass",
1263+
"type": "string",
1264+
"description": "<p>Css class for popover container</p>\n"
1265+
},
12551266
{
12561267
"name": "isOpen",
12571268
"type": "boolean",
@@ -1897,6 +1908,11 @@ export const ngdoc: any = {
18971908
"type": "string",
18981909
"description": "<p>A selector specifying the element the tooltip should be appended to.\nCurrently only supports &quot;body&quot;.</p>\n"
18991910
},
1911+
{
1912+
"name": "containerClass",
1913+
"type": "string",
1914+
"description": "<p>Css class for tooltip container</p>\n"
1915+
},
19001916
{
19011917
"name": "isDisabled",
19021918
"type": "boolean",

0 commit comments

Comments
 (0)