btv-base-controls 0.1.29 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/btv-base-controls.mjs +5 -0
- package/esm2022/lib/basic.module.mjs +64 -0
- package/esm2022/lib/blink-message/blink-message.component.mjs +54 -0
- package/esm2022/lib/btv-icon-button/btv-counter-button.mjs +47 -0
- package/esm2022/lib/btv-icon-button/btv-icon-button.component.mjs +91 -0
- package/esm2022/lib/btv-progress/btv-progress.component.mjs +71 -0
- package/esm2022/lib/btv-search/btv-search.component.mjs +82 -0
- package/esm2022/lib/btv-search/index.mjs +2 -0
- package/esm2022/lib/busy-indicator/busy-indicator.component.mjs +16 -0
- package/esm2022/lib/custom-tool-tip/custom-tool-tip.component.mjs +34 -0
- package/esm2022/lib/custom-tool-tip/tool-tip-renderer.directive.mjs +113 -0
- package/esm2022/lib/illustration/illustration.component.mjs +17 -0
- package/esm2022/lib/wm-avatar/avatar.component.mjs +175 -0
- package/esm2022/lib/wm-back-btn/wm-back-btn.component.mjs +26 -0
- package/esm2022/lib/wm-beta-text/wm-beta-text.component.mjs +19 -0
- package/esm2022/lib/wm-info/info-models.mjs +14 -0
- package/esm2022/lib/wm-info/wm-info.component.mjs +239 -0
- package/esm2022/lib/wm-info-card/wm-info-card.component.mjs +23 -0
- package/esm2022/lib/wm-no-content/wm-no-content.component.mjs +30 -0
- package/esm2022/lib/wm-panel-bar/wm-panel-bar.component.mjs +81 -0
- package/esm2022/lib/wm-scalable-div/scalable-div.component.mjs +105 -0
- package/esm2022/lib/wm-spinner/wm-spinner.component.mjs +135 -0
- package/esm2022/lib/wm-state-icon/wm-state-icon.component.mjs +18 -0
- package/esm2022/lib/wm-tag/wm-tag.component.mjs +28 -0
- package/esm2022/lib/wm-tamplate-image/wm-template-image.component.mjs +71 -0
- package/esm2022/lib/wm-toggle/wm-toggle.component.mjs +31 -0
- package/esm2022/models/guidExtension.mjs +15 -0
- package/esm2022/public-api.mjs +28 -0
- package/fesm2022/btv-base-controls.mjs +1503 -0
- package/fesm2022/btv-base-controls.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/basic.module.d.ts +33 -0
- package/lib/blink-message/blink-message.component.d.ts +20 -0
- package/lib/btv-icon-button/btv-counter-button.d.ts +12 -0
- package/lib/btv-icon-button/btv-icon-button.component.d.ts +32 -0
- package/lib/btv-progress/btv-progress.component.d.ts +20 -0
- package/lib/btv-search/btv-search.component.d.ts +31 -0
- package/{src/lib/btv-search/index.ts → lib/btv-search/index.d.ts} +1 -1
- package/lib/busy-indicator/busy-indicator.component.d.ts +7 -0
- package/lib/custom-tool-tip/custom-tool-tip.component.d.ts +35 -0
- package/lib/custom-tool-tip/tool-tip-renderer.directive.d.ts +49 -0
- package/lib/illustration/illustration.component.d.ts +10 -0
- package/lib/wm-avatar/avatar.component.d.ts +63 -0
- package/lib/wm-back-btn/wm-back-btn.component.d.ts +10 -0
- package/lib/wm-beta-text/wm-beta-text.component.d.ts +7 -0
- package/lib/wm-info/info-models.d.ts +21 -0
- package/lib/wm-info/wm-info.component.d.ts +34 -0
- package/lib/wm-info-card/wm-info-card.component.d.ts +9 -0
- package/lib/wm-no-content/wm-no-content.component.d.ts +11 -0
- package/lib/wm-panel-bar/wm-panel-bar.component.d.ts +26 -0
- package/lib/wm-scalable-div/scalable-div.component.d.ts +24 -0
- package/lib/wm-spinner/wm-spinner.component.d.ts +37 -0
- package/lib/wm-state-icon/wm-state-icon.component.d.ts +9 -0
- package/lib/wm-tag/wm-tag.component.d.ts +10 -0
- package/lib/wm-tamplate-image/wm-template-image.component.d.ts +49 -0
- package/lib/wm-toggle/wm-toggle.component.d.ts +11 -0
- package/models/guidExtension.d.ts +5 -0
- package/package.json +24 -10
- package/public-api.d.ts +24 -0
- package/.browserslistrc +0 -16
- package/karma.conf.js +0 -44
- package/ng-package.json +0 -7
- package/src/assets/icon/state-icons.png +0 -0
- package/src/assets/theme/wmGlobals.scss +0 -181
- package/src/lib/basic.module.ts +0 -48
- package/src/lib/blink-message/blink-message.component.html +0 -1
- package/src/lib/blink-message/blink-message.component.scss +0 -4
- package/src/lib/blink-message/blink-message.component.ts +0 -54
- package/src/lib/btv-icon-button/btv-counter-button.html +0 -18
- package/src/lib/btv-icon-button/btv-counter-button.ts +0 -34
- package/src/lib/btv-icon-button/btv-icon-button.component.ts +0 -64
- package/src/lib/btv-icon-button/btv-icon-button.html +0 -14
- package/src/lib/btv-icon-button/btv-icon-button.scss +0 -124
- package/src/lib/btv-icon-button/index.ts +0 -1
- package/src/lib/btv-progress/btv-progress.component.ts +0 -65
- package/src/lib/btv-progress/btv-progress.html +0 -11
- package/src/lib/btv-progress/btv-progress.scss +0 -24
- package/src/lib/btv-search/btv-search.component.ts +0 -78
- package/src/lib/btv-search/btv-search.html +0 -15
- package/src/lib/btv-search/btv-search.scss +0 -97
- package/src/lib/busy-indicator/busy-indicator.component.ts +0 -13
- package/src/lib/busy-indicator/busy-indicator.html +0 -6
- package/src/lib/busy-indicator/busy-indicator.scss +0 -86
- package/src/lib/custom-tool-tip/custom-tool-tip.component.html +0 -9
- package/src/lib/custom-tool-tip/custom-tool-tip.component.scss +0 -47
- package/src/lib/custom-tool-tip/custom-tool-tip.component.ts +0 -44
- package/src/lib/custom-tool-tip/tool-tip-renderer.directive.ts +0 -111
- package/src/lib/illustration/illustration.component.html +0 -412
- package/src/lib/illustration/illustration.component.scss +0 -48
- package/src/lib/illustration/illustration.component.ts +0 -21
- package/src/lib/wm-avatar/avatar.component.ts +0 -179
- package/src/lib/wm-avatar/avatar.html +0 -13
- package/src/lib/wm-avatar/avatar.scss +0 -3
- package/src/lib/wm-back-btn/wm-back-btn.component.ts +0 -19
- package/src/lib/wm-back-btn/wm-back-btn.html +0 -7
- package/src/lib/wm-back-btn/wm-back-btn.scss +0 -51
- package/src/lib/wm-beta-text/wm-beta-text.component.html +0 -1
- package/src/lib/wm-beta-text/wm-beta-text.component.scss +0 -44
- package/src/lib/wm-beta-text/wm-beta-text.component.ts +0 -14
- package/src/lib/wm-info/info-models.ts +0 -22
- package/src/lib/wm-info/wm-info.component.ts +0 -238
- package/src/lib/wm-info/wm-info.html +0 -19
- package/src/lib/wm-info/wm-info.scss +0 -64
- package/src/lib/wm-info-card/wm-info-card.component.ts +0 -14
- package/src/lib/wm-info-card/wm-info-card.html +0 -13
- package/src/lib/wm-info-card/wm-info-card.scss +0 -56
- package/src/lib/wm-no-content/wm-no-content.component.ts +0 -17
- package/src/lib/wm-no-content/wm-no-content.html +0 -13
- package/src/lib/wm-no-content/wm-no-content.scss +0 -60
- package/src/lib/wm-panel-bar/wm-panel-bar.component.ts +0 -60
- package/src/lib/wm-panel-bar/wm-panel-bar.html +0 -43
- package/src/lib/wm-panel-bar/wm-panel-bar.scss +0 -114
- package/src/lib/wm-scalable-div/scalable-div.component.ts +0 -106
- package/src/lib/wm-scalable-div/scalable-div.html +0 -1
- package/src/lib/wm-scalable-div/scalable-div.scss +0 -11
- package/src/lib/wm-spinner/wm-spinner.component.ts +0 -129
- package/src/lib/wm-spinner/wm-spinner.html +0 -37
- package/src/lib/wm-spinner/wm-spinner.scss +0 -72
- package/src/lib/wm-state-icon/wm-state-icon.component.html +0 -4
- package/src/lib/wm-state-icon/wm-state-icon.component.scss +0 -26
- package/src/lib/wm-state-icon/wm-state-icon.component.ts +0 -18
- package/src/lib/wm-tag/wm-tag.component.html +0 -8
- package/src/lib/wm-tag/wm-tag.component.scss +0 -48
- package/src/lib/wm-tag/wm-tag.component.ts +0 -17
- package/src/lib/wm-tamplate-image/wm-template-image.component.ts +0 -56
- package/src/lib/wm-tamplate-image/wm-template-image.html +0 -3
- package/src/lib/wm-tamplate-image/wm-template-image.scss +0 -31
- package/src/lib/wm-toggle/wm-toggle.component.ts +0 -20
- package/src/lib/wm-toggle/wm-toggle.html +0 -5
- package/src/lib/wm-toggle/wm-toggle.scss +0 -33
- package/src/models/guidExtension.ts +0 -16
- package/src/public-api.ts +0 -29
- package/src/test.ts +0 -15
- package/tsconfig.lib.json +0 -15
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { Component, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Output, ViewChild } from '@angular/core';
|
|
2
|
-
import { fromEvent, Subscription } from 'rxjs';
|
|
3
|
-
import { debounceTime, distinctUntilChanged, map } from 'rxjs/operators';
|
|
4
|
-
|
|
5
|
-
export class ViewState {
|
|
6
|
-
get isLaptop() { return window.innerWidth <= 1440; }
|
|
7
|
-
get isMobile() { return window.innerWidth <= 1024; }
|
|
8
|
-
get isPhone() { return window.innerWidth <= 767; }
|
|
9
|
-
public isWidthLessOrEqualTo(width: number) { return window.innerWidth <= width; }
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@Component({
|
|
13
|
-
selector: 'btv-search',
|
|
14
|
-
styleUrls: ['./btv-search.scss'],
|
|
15
|
-
templateUrl: './btv-search.html'
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
export class BtvSearch implements OnInit, OnDestroy {
|
|
19
|
-
@Input() widthAuto: boolean = false;
|
|
20
|
-
@Input() isSmall: boolean = false;
|
|
21
|
-
@Input() searchRight: string;
|
|
22
|
-
@Input() placeholder: string = 'Search';
|
|
23
|
-
@Input() keepExpanded: boolean = false;
|
|
24
|
-
searchFocus: boolean = false;
|
|
25
|
-
view: ViewState = new ViewState();
|
|
26
|
-
@ViewChild('searchBox', { static: true }) box: ElementRef;
|
|
27
|
-
@Output() searchTextChange: EventEmitter<string> = new EventEmitter<string>();
|
|
28
|
-
public expanded: boolean;
|
|
29
|
-
private _searchSubscription: Subscription;
|
|
30
|
-
|
|
31
|
-
private _searchText: string;
|
|
32
|
-
|
|
33
|
-
@Input() set searchText(value: string) {
|
|
34
|
-
if (value === this._searchText) return;
|
|
35
|
-
this._searchText = value;
|
|
36
|
-
if (value) {
|
|
37
|
-
this.expanded = true;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
get searchText(): string {
|
|
42
|
-
return this._searchText || '';
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
constructor() {
|
|
46
|
-
this.expanded = false;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
ngOnInit() {
|
|
50
|
-
let box = this.box.nativeElement;
|
|
51
|
-
let observable = fromEvent(box, 'keyup').pipe(
|
|
52
|
-
debounceTime(400),
|
|
53
|
-
distinctUntilChanged(),
|
|
54
|
-
map(x => <string>(<any>x).target.value)
|
|
55
|
-
);
|
|
56
|
-
this._searchSubscription = observable.subscribe(it => {
|
|
57
|
-
this.searchTextChange.emit(it);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
ngOnDestroy(): void {
|
|
62
|
-
if (this._searchSubscription) this._searchSubscription.unsubscribe();
|
|
63
|
-
}
|
|
64
|
-
toggleSearch() {
|
|
65
|
-
this.expanded = !this.expanded;
|
|
66
|
-
if (this.box && this.expanded) {
|
|
67
|
-
this.box.nativeElement.focus();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
onFocusOut() {
|
|
72
|
-
if (!this.box.nativeElement.value && this.expanded && !this.keepExpanded) {
|
|
73
|
-
this.expanded = false;
|
|
74
|
-
}
|
|
75
|
-
this.searchFocus = false;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<div class="wm-search flex-row" [ngClass]="{'search-reverse': searchRight == 'right', 'always-opened': keepExpanded, 'small': isSmall}">
|
|
2
|
-
<div class="search-icon inline-col" [ngClass]="{'search-toggle-disabled': keepExpanded || !searchFocus}"
|
|
3
|
-
(click)="toggleSearch()">
|
|
4
|
-
<wm-template-image class="marginXA" icon="search" [light]="(!expanded && !searchFocus) || keepExpanded">
|
|
5
|
-
</wm-template-image>
|
|
6
|
-
</div>
|
|
7
|
-
<div class="search-wrap flex-col"
|
|
8
|
-
[ngClass]="{'search-open': keepExpanded || expanded, 'search-focused': (expanded && searchFocus) || (keepExpanded && searchFocus),
|
|
9
|
-
'width-auto': widthAuto}">
|
|
10
|
-
<input class="search-field" #searchBox
|
|
11
|
-
[value]="searchText"
|
|
12
|
-
[placeholder]="placeholder"
|
|
13
|
-
(focus)="searchFocus = true" (focusout)="onFocusOut()">
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
@import './../../assets/theme/wmGlobals.scss';
|
|
2
|
-
|
|
3
|
-
.wm-search,
|
|
4
|
-
.search-wrap,
|
|
5
|
-
.search-field {
|
|
6
|
-
box-sizing: border-box;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.wm-search {
|
|
10
|
-
&:hover {
|
|
11
|
-
border-color: var(--brandColor);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.wm-search {
|
|
16
|
-
background: var(--pageBackgroundColor);
|
|
17
|
-
height: 36px;
|
|
18
|
-
max-width: 280px;
|
|
19
|
-
border-radius: 4px;
|
|
20
|
-
align-items: center;
|
|
21
|
-
flex: 1 0 100%;
|
|
22
|
-
flex-shrink: 0;
|
|
23
|
-
border: 1px solid var(--secondaryHover);
|
|
24
|
-
|
|
25
|
-
&.small {
|
|
26
|
-
max-width: 140px;
|
|
27
|
-
.search-open {
|
|
28
|
-
width:auto;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.search-icon {
|
|
34
|
-
width: 36px;
|
|
35
|
-
height: 100%;
|
|
36
|
-
flex-shrink: 0;
|
|
37
|
-
cursor: pointer;
|
|
38
|
-
|
|
39
|
-
&.search-toggle-disabled {
|
|
40
|
-
cursor: text;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.search-wrap {
|
|
45
|
-
width: 0px;
|
|
46
|
-
height: 100%;
|
|
47
|
-
color: var(--mediumFontColor);
|
|
48
|
-
direction: ltr;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.search-open {
|
|
52
|
-
width: 280px;
|
|
53
|
-
max-width: 100%;
|
|
54
|
-
flex-grow: 1;
|
|
55
|
-
flex-shrink: 1;
|
|
56
|
-
&.width-auto {
|
|
57
|
-
width: auto;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.search-open:hover,
|
|
62
|
-
.search-focused {
|
|
63
|
-
color: var(--strongFontColor);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
.search-field {
|
|
68
|
-
width: 100%;
|
|
69
|
-
height: 100%;
|
|
70
|
-
color: inherit;
|
|
71
|
-
text-indent: 0.1em;
|
|
72
|
-
font-size: $fontSize + 2;
|
|
73
|
-
padding: 0;
|
|
74
|
-
background-color: transparent;
|
|
75
|
-
border: none;
|
|
76
|
-
outline: none;
|
|
77
|
-
padding: 0px 8px 0 0;
|
|
78
|
-
|
|
79
|
-
&::placeholder {
|
|
80
|
-
color: var(--disabledTextColor);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.search-reverse {
|
|
86
|
-
display: flex;
|
|
87
|
-
flex-direction: row-reverse;
|
|
88
|
-
|
|
89
|
-
.search-wrap {
|
|
90
|
-
direction: rtl;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.search-field {
|
|
94
|
-
direction: ltr;
|
|
95
|
-
padding: 0px 8px;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Component({
|
|
4
|
-
selector: 'wm-busy-indicator',
|
|
5
|
-
styleUrls: ['./busy-indicator.scss'],
|
|
6
|
-
templateUrl: './busy-indicator.html',
|
|
7
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
8
|
-
})
|
|
9
|
-
export class BusyIndicatorComponent {
|
|
10
|
-
|
|
11
|
-
@Input() public busy: boolean;
|
|
12
|
-
@Input() public long: boolean;
|
|
13
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
@import './../../assets/theme/wmGlobals.scss';
|
|
2
|
-
.load-snake-wrap {
|
|
3
|
-
width: 120px;
|
|
4
|
-
height: 12px;
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
align-self: flex-end;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.snake-field {
|
|
10
|
-
display: block;
|
|
11
|
-
width: 100%;
|
|
12
|
-
height: 2px;
|
|
13
|
-
background: #22252C;
|
|
14
|
-
top: 5px;
|
|
15
|
-
position: relative;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.snake {
|
|
19
|
-
display: inline-block;
|
|
20
|
-
width: 80px;
|
|
21
|
-
height: 2px;
|
|
22
|
-
background: #7F868C;
|
|
23
|
-
animation-play-state: running;
|
|
24
|
-
position: relative;
|
|
25
|
-
top: -9px;
|
|
26
|
-
animation: snakeMove 2s linear 0s infinite;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.snake-shadow {
|
|
30
|
-
display: inline-block;
|
|
31
|
-
width: 40px;
|
|
32
|
-
height: 8px;
|
|
33
|
-
position: absolute;
|
|
34
|
-
margin-top: -3px;
|
|
35
|
-
animation: rotate 2s linear 0s infinite;
|
|
36
|
-
animation-play-state: running;
|
|
37
|
-
border-radius: 25%;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.long-snake-wrap {
|
|
41
|
-
width: 400px;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.longSnake {
|
|
45
|
-
animation: snakeLongMove 3s linear 0s infinite;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.longRotate {
|
|
49
|
-
animation: rotate 3s linear 0s infinite;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@keyframes snakeMove {
|
|
53
|
-
0% {
|
|
54
|
-
left: -80px;
|
|
55
|
-
}
|
|
56
|
-
50% {
|
|
57
|
-
left: 200px;
|
|
58
|
-
}
|
|
59
|
-
100% {
|
|
60
|
-
left: -200px;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
@keyframes snakeLongMove {
|
|
65
|
-
0% {
|
|
66
|
-
left: -80px;
|
|
67
|
-
}
|
|
68
|
-
50% {
|
|
69
|
-
left: 440px;
|
|
70
|
-
}
|
|
71
|
-
100% {
|
|
72
|
-
left: -200px;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
@keyframes rotate {
|
|
77
|
-
0% {
|
|
78
|
-
background: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(152, 141, 103, 0.4) 100%);
|
|
79
|
-
right: 0px;
|
|
80
|
-
}
|
|
81
|
-
100% {
|
|
82
|
-
background: linear-gradient(to left, rgba(0, 0, 0, 0) 0%, rgba(152, 141, 103, 0.4) 100%);
|
|
83
|
-
left: 0px;
|
|
84
|
-
right: unset;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
@import './../../assets/theme/wmGlobals.scss';
|
|
2
|
-
|
|
3
|
-
.tooltip-container {
|
|
4
|
-
position: relative;
|
|
5
|
-
box-sizing: border-box;
|
|
6
|
-
box-shadow: 0px 16px 16px -1px rgb(5 29 57 / 10%);
|
|
7
|
-
border-radius: 4px;
|
|
8
|
-
-webkit-appearance: none;
|
|
9
|
-
|
|
10
|
-
&:before {
|
|
11
|
-
content: '';
|
|
12
|
-
display: block;
|
|
13
|
-
width: 0;
|
|
14
|
-
height: 0;
|
|
15
|
-
border-style: solid;
|
|
16
|
-
border-width: 6px;
|
|
17
|
-
border-color: transparent;
|
|
18
|
-
left: 50%;
|
|
19
|
-
bottom: -12px;
|
|
20
|
-
margin-left: -6.0625px;
|
|
21
|
-
border-top-color: var(--pageBackgroundColor);
|
|
22
|
-
position: absolute;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.mat-tooltip {
|
|
27
|
-
font-family: $fontFamily;
|
|
28
|
-
margin: 0;
|
|
29
|
-
transform-origin: center top;
|
|
30
|
-
box-shadow: none;
|
|
31
|
-
background: var(--pageBackgroundColor);
|
|
32
|
-
color: var(--strongFontColor);
|
|
33
|
-
border-radius: 2px;
|
|
34
|
-
z-index: 1001;
|
|
35
|
-
border-style: solid;
|
|
36
|
-
border-width: 0;
|
|
37
|
-
padding: 5px 5px 5px 6px;
|
|
38
|
-
background-repeat: repeat-x;
|
|
39
|
-
min-width: 20px;
|
|
40
|
-
text-align: center;
|
|
41
|
-
font-size: 14px;
|
|
42
|
-
transform: scale(1)!important;
|
|
43
|
-
|
|
44
|
-
&.mat-tooltip-show {
|
|
45
|
-
animation:none
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Component, OnInit, Input, TemplateRef } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This component will be used to show custom tooltip
|
|
5
|
-
*
|
|
6
|
-
* This component will be rendered using OverlayModule of angular material
|
|
7
|
-
* This component will be rendered by directive on an Overlay
|
|
8
|
-
*
|
|
9
|
-
* CONSUMER will not be using this component directly
|
|
10
|
-
* This component will be hosted in an overlay by ToolTipRenderer directive
|
|
11
|
-
* This component exposes two properties. These two properties will be filled by ToolTipRenderer directive
|
|
12
|
-
* 1. text - This is a simple string which is to be shown in the tooltip; This will be injected in the ToolTipRenderer directive
|
|
13
|
-
* by the consumer
|
|
14
|
-
* 2. contentTemplate - This gives finer control on the content to be shown in the tooltip
|
|
15
|
-
*
|
|
16
|
-
* NOTE - ONLY one should be specified; If BOTH are specified then "template" will be rendered and "text" will be ignored
|
|
17
|
-
*/
|
|
18
|
-
@Component({
|
|
19
|
-
selector: 'app-custom-tool-tip',
|
|
20
|
-
templateUrl: './custom-tool-tip.component.html',
|
|
21
|
-
styleUrls: ['./custom-tool-tip.component.scss']
|
|
22
|
-
})
|
|
23
|
-
export class CustomToolTipComponent implements OnInit {
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* This is simple text which is to be shown in the tooltip
|
|
27
|
-
*/
|
|
28
|
-
@Input() text: string;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* This provides finer control on the content to be visible on the tooltip
|
|
32
|
-
* This template will be injected in McToolTipRenderer directive in the consumer template
|
|
33
|
-
* <ng-template #template>
|
|
34
|
-
* content.....
|
|
35
|
-
* </ng-template>
|
|
36
|
-
*/
|
|
37
|
-
@Input() contentTemplate: TemplateRef<any>;
|
|
38
|
-
|
|
39
|
-
constructor() { }
|
|
40
|
-
|
|
41
|
-
ngOnInit() {
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { Directive, Input, TemplateRef, ElementRef, OnInit, HostListener, ComponentRef } from '@angular/core';
|
|
2
|
-
import { ConnectionPositionPair, Overlay, OverlayRef } from '@angular/cdk/overlay';
|
|
3
|
-
import { CustomToolTipComponent } from './custom-tool-tip.component';
|
|
4
|
-
import { ComponentPortal } from '@angular/cdk/portal';
|
|
5
|
-
|
|
6
|
-
@Directive({
|
|
7
|
-
selector: '[customToolTip]'
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
export class ToolTipRendererDirective implements OnInit {
|
|
11
|
-
/**
|
|
12
|
-
* This will be used to show tooltip or not
|
|
13
|
-
* This can be used to show the tooltip conditionally
|
|
14
|
-
*/
|
|
15
|
-
@Input() showToolTip: boolean = true;
|
|
16
|
-
|
|
17
|
-
//If this is specified then specified text will be shown in the tooltip
|
|
18
|
-
@Input(`customToolTip`) text: string;
|
|
19
|
-
|
|
20
|
-
//If this is specified then specified template will be rendered in the tooltip
|
|
21
|
-
@Input() contentTemplate: TemplateRef<any>;
|
|
22
|
-
private _overlayRef: OverlayRef;
|
|
23
|
-
@Input() customAnchor?: any;
|
|
24
|
-
@Input() useCustom?: boolean = false;
|
|
25
|
-
|
|
26
|
-
constructor(private _overlay: Overlay,
|
|
27
|
-
private _elementRef: ElementRef) { }
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Init life cycle event handler
|
|
31
|
-
*/
|
|
32
|
-
ngOnInit() { }
|
|
33
|
-
|
|
34
|
-
get refElement() {
|
|
35
|
-
if (this.useCustom || this.customAnchor) return this.customAnchor;
|
|
36
|
-
return this._elementRef;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* This method will be called whenever mouse enters in the Host element
|
|
40
|
-
* i.e. where this directive is applied
|
|
41
|
-
* This method will show the tooltip by instantiating the McToolTipComponent and attaching to the overlay
|
|
42
|
-
*/
|
|
43
|
-
@HostListener('mousemove', ['$event'])
|
|
44
|
-
show() {
|
|
45
|
-
if (this.refElement) this.closeToolTip();
|
|
46
|
-
if (!this.showToolTip || (this.useCustom && !this.customAnchor)) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const positionPairs: ConnectionPositionPair[] = [
|
|
51
|
-
new ConnectionPositionPair(
|
|
52
|
-
{ originX: 'center', originY: 'top' },
|
|
53
|
-
{ overlayX: 'center', overlayY: 'bottom' }, 0, 0,
|
|
54
|
-
'mat-tooltip-panel-above'),
|
|
55
|
-
new ConnectionPositionPair(
|
|
56
|
-
{ originX: 'center', originY: 'bottom' },
|
|
57
|
-
{ overlayX: 'center', overlayY: 'top' }, 0, 0,
|
|
58
|
-
'mat-tooltip-panel-below')
|
|
59
|
-
|
|
60
|
-
];
|
|
61
|
-
const positionStrategy = this._overlay.position()
|
|
62
|
-
.flexibleConnectedTo(this.refElement)
|
|
63
|
-
.withPositions(positionPairs)
|
|
64
|
-
.withFlexibleDimensions(true)
|
|
65
|
-
.withPush(true);
|
|
66
|
-
|
|
67
|
-
this._overlayRef = this._overlay.create({
|
|
68
|
-
panelClass: 'mat-tooltip-panel',
|
|
69
|
-
scrollStrategy: this._overlay.scrollStrategies.close(),
|
|
70
|
-
positionStrategy
|
|
71
|
-
});
|
|
72
|
-
// attach the component if it has not already attached to the overlay
|
|
73
|
-
if (this._overlayRef && !this._overlayRef.hasAttached()) {
|
|
74
|
-
const content = new ComponentPortal(CustomToolTipComponent);
|
|
75
|
-
// todo check this
|
|
76
|
-
const tooltipRef: ComponentRef<CustomToolTipComponent> = this._overlayRef.attach(content) as any;
|
|
77
|
-
tooltipRef.instance.text = this.text;
|
|
78
|
-
tooltipRef.instance.contentTemplate = this.contentTemplate;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* This method will be called when mouse goes out of the host element
|
|
84
|
-
* i.e. where this directive is applied
|
|
85
|
-
* This method will close the tooltip by detaching the overlay from the view
|
|
86
|
-
*/
|
|
87
|
-
@HostListener('mouseleave')
|
|
88
|
-
hide() {
|
|
89
|
-
this.closeToolTip();
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Destroy lifecycle event handler
|
|
94
|
-
* This method will make sure to close the tooltip
|
|
95
|
-
* It will be needed in case when app is navigating to different page
|
|
96
|
-
* and user is still seeing the tooltip; In that case we do not want to hang around the
|
|
97
|
-
* tooltip after the page [on which tooltip visible] is destroyed
|
|
98
|
-
*/
|
|
99
|
-
ngOnDestroy() {
|
|
100
|
-
this.closeToolTip();
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* This method will close the tooltip by detaching the component from the overlay
|
|
105
|
-
*/
|
|
106
|
-
private closeToolTip() {
|
|
107
|
-
if (this._overlayRef) {
|
|
108
|
-
this._overlayRef.detach();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|