@avakhula/ui 0.0.207 → 0.0.208
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/.eslintrc.cjs +13 -14
- package/dist/index.js +4605 -4639
- package/dist/index.umd.cjs +66 -76
- package/dist/style.css +1 -1
- package/package.json +11 -11
- package/src/App.vue +122 -21
- package/src/components/Accordion/Accordion.scss +1 -4
- package/src/components/Accordion/Accordion.vue +17 -5
- package/src/components/Alert/alert.scss +0 -1
- package/src/components/Alert/constants.js +0 -1
- package/src/components/Avatar/Avatar.vue +9 -17
- package/src/components/Dropdown/Dropdown.vue +5 -2
- package/src/components/Form/Checkbox/Checkbox.vue +49 -43
- package/src/components/Form/Input/Input.vue +1 -1
- package/src/components/Form/Radio/Radio.vue +7 -1
- package/src/components/Form/Toggle/Toggle.vue +4 -1
- package/src/components/Modal/Modal.vue +8 -5
- package/src/components/ProgressBar/ProgressBar.vue +8 -1
- package/src/components/Sorting/Sorting.stories.js +1 -1
- package/src/components/Sorting/Sorting.vue +25 -55
- package/src/components/Sorting/sorting.scss +1 -1
- package/src/components/Tooltip/Tooltip.vue +11 -95
- package/src/components/TreeSelect/Option.vue +12 -4
- package/src/components/TreeSelect/Select.vue +41 -37
- package/src/components/TreeSelect/scss/option.scss +0 -4
- package/src/directives/tooltip/TooltipController.js +16 -115
- package/src/directives/tooltip/tooltip.js +9 -24
- package/src/directives/tooltip/tooltip.stories.js +3 -76
- package/src/helpers/removeEvents.js +2 -2
- package/TODO +0 -12
|
@@ -8,46 +8,32 @@
|
|
|
8
8
|
}"
|
|
9
9
|
v-if="view === sortingTypesView.TABLE_VIEW"
|
|
10
10
|
>
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
<button class="sorting-label" type="button">
|
|
12
|
+
{{ title }}
|
|
13
|
+
<ib-tooltip
|
|
14
|
+
v-if="tooltipText"
|
|
15
|
+
:text="tooltipText"
|
|
16
|
+
:position="tooltipPosition"
|
|
17
17
|
>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<ib-toggle-tip
|
|
22
|
-
v-if="hasToggleTip"
|
|
23
|
-
:is-open="isOpenToggleTip"
|
|
24
|
-
:title="toggleTipTitle"
|
|
25
|
-
@close="isOpenToggleTip = false"
|
|
26
|
-
>
|
|
27
|
-
<slot name="toggleTipBody"></slot>
|
|
28
|
-
<template #buttons>
|
|
29
|
-
<slot name="toggleTipButtons"></slot>
|
|
30
|
-
</template>
|
|
31
|
-
</ib-toggle-tip>
|
|
32
|
-
</div>
|
|
33
|
-
|
|
34
|
-
<ib-icon-button
|
|
35
|
-
v-tooltip="tooltipIconText"
|
|
36
|
-
kind="white"
|
|
37
|
-
size="s"
|
|
38
|
-
@click="clickHandler"
|
|
39
|
-
>
|
|
18
|
+
</ib-tooltip>
|
|
19
|
+
</button>
|
|
20
|
+
<ib-icon-button kind="white" size="s" @click="clickHandler">
|
|
40
21
|
<ion-icon :name="iconType"></ion-icon>
|
|
22
|
+
<ib-tooltip
|
|
23
|
+
v-if="tooltipIconSorting"
|
|
24
|
+
:text="tooltipIconSorting"
|
|
25
|
+
:position="tooltipPosition"
|
|
26
|
+
>
|
|
27
|
+
</ib-tooltip>
|
|
41
28
|
</ib-icon-button>
|
|
42
29
|
</div>
|
|
43
30
|
|
|
44
31
|
<button
|
|
45
32
|
v-else
|
|
46
|
-
v-tooltip:[tooltipPosition]="tooltipText"
|
|
47
33
|
class="sorting-button"
|
|
48
34
|
type="button"
|
|
49
|
-
@click="clickHandler"
|
|
50
35
|
:aria-label="sort"
|
|
36
|
+
@click="clickHandler"
|
|
51
37
|
:class="{
|
|
52
38
|
active: currentTypeSort,
|
|
53
39
|
disabled: disable,
|
|
@@ -55,6 +41,12 @@
|
|
|
55
41
|
>
|
|
56
42
|
{{ title }}
|
|
57
43
|
<ib-icon v-if="iconType" :name="iconType"></ib-icon>
|
|
44
|
+
<ib-tooltip
|
|
45
|
+
v-if="tooltipText"
|
|
46
|
+
:text="tooltipText"
|
|
47
|
+
:position="tooltipPosition"
|
|
48
|
+
>
|
|
49
|
+
</ib-tooltip>
|
|
58
50
|
</button>
|
|
59
51
|
</div>
|
|
60
52
|
</template>
|
|
@@ -62,9 +54,9 @@
|
|
|
62
54
|
<script>
|
|
63
55
|
import IbIcon from "../Icon.vue";
|
|
64
56
|
import IbIconButton from "../IconButton/IconButton.vue";
|
|
65
|
-
import
|
|
57
|
+
import IbTooltip from "../Tooltip/Tooltip.vue";
|
|
66
58
|
import { typesSorting, typesSortingView } from "./constants.js";
|
|
67
|
-
|
|
59
|
+
|
|
68
60
|
export default {
|
|
69
61
|
name: "IbSorting",
|
|
70
62
|
props: {
|
|
@@ -77,9 +69,6 @@ export default {
|
|
|
77
69
|
tooltipIconSorting: {
|
|
78
70
|
type: String,
|
|
79
71
|
},
|
|
80
|
-
toggleTipTitle: {
|
|
81
|
-
type: String,
|
|
82
|
-
},
|
|
83
72
|
title: {
|
|
84
73
|
type: String,
|
|
85
74
|
default: "",
|
|
@@ -110,7 +99,6 @@ export default {
|
|
|
110
99
|
},
|
|
111
100
|
data() {
|
|
112
101
|
return {
|
|
113
|
-
isOpenToggleTip: false,
|
|
114
102
|
sortingTypes: typesSorting,
|
|
115
103
|
sortingTypesView: typesSortingView,
|
|
116
104
|
currentTypeSort: this.sort,
|
|
@@ -144,29 +132,11 @@ export default {
|
|
|
144
132
|
}
|
|
145
133
|
return null;
|
|
146
134
|
},
|
|
147
|
-
tooltipIconText() {
|
|
148
|
-
if (this.currentTypeSort === this.sortingTypes.TYPE_ASC) {
|
|
149
|
-
return lang("sort_descending", this.langComponents?.COMPONENT_SELECT);
|
|
150
|
-
} else if (this.currentTypeSort === this.sortingTypes.TYPE_DESC) {
|
|
151
|
-
return lang("reset_sorting", this.langComponents?.COMPONENT_SELECT);
|
|
152
|
-
} else if (this.view !== this.sortingTypesView.GRID_VIEW) {
|
|
153
|
-
return lang("sort_ascending", this.langComponents?.COMPONENT_SELECT);
|
|
154
|
-
}
|
|
155
|
-
return "";
|
|
156
|
-
},
|
|
157
|
-
hasToggleTip() {
|
|
158
|
-
return (
|
|
159
|
-
this.toggleTipTitle &&
|
|
160
|
-
this.$slots.toggleTipBody &&
|
|
161
|
-
this.$slots.toggleTipButtons
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
135
|
},
|
|
165
|
-
directives: { Tooltip },
|
|
166
136
|
components: {
|
|
167
137
|
IbIcon,
|
|
168
138
|
IbIconButton,
|
|
169
|
-
|
|
139
|
+
IbTooltip,
|
|
170
140
|
},
|
|
171
141
|
};
|
|
172
142
|
</script>
|
|
@@ -53,7 +53,17 @@ export default {
|
|
|
53
53
|
padding: 10px;
|
|
54
54
|
max-width: 240px;
|
|
55
55
|
box-shadow: $ib-shadow-1;
|
|
56
|
-
|
|
56
|
+
|
|
57
|
+
&::after {
|
|
58
|
+
content: "";
|
|
59
|
+
width: 100%;
|
|
60
|
+
height: calc(100% + 5px);
|
|
61
|
+
position: absolute;
|
|
62
|
+
left: 0;
|
|
63
|
+
right: 0;
|
|
64
|
+
bottom: -5px;
|
|
65
|
+
z-index: -1;
|
|
66
|
+
}
|
|
57
67
|
|
|
58
68
|
&.ib-tooltip-large {
|
|
59
69
|
box-shadow: $ib-shadow-2;
|
|
@@ -66,99 +76,5 @@ export default {
|
|
|
66
76
|
p {
|
|
67
77
|
@include Ib-H4-regular;
|
|
68
78
|
}
|
|
69
|
-
|
|
70
|
-
&::before {
|
|
71
|
-
content: "";
|
|
72
|
-
width: 0;
|
|
73
|
-
height: 0;
|
|
74
|
-
border-style: solid;
|
|
75
|
-
border-width: 4px 4px 0 4px;
|
|
76
|
-
border-color: #fff transparent transparent transparent;
|
|
77
|
-
position: absolute;
|
|
78
|
-
transform: none !important;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
&.top-left {
|
|
82
|
-
&::before {
|
|
83
|
-
bottom: -4px;
|
|
84
|
-
right: 10px;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
&.top-center {
|
|
88
|
-
&::before {
|
|
89
|
-
bottom: -4px;
|
|
90
|
-
right: 50%;
|
|
91
|
-
transform: translateX(50%) !important;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
&.top-right {
|
|
95
|
-
&::before {
|
|
96
|
-
bottom: -4px;
|
|
97
|
-
left: 10px;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
&.right-top {
|
|
101
|
-
&::before {
|
|
102
|
-
left: -6px;
|
|
103
|
-
bottom: 10px;
|
|
104
|
-
transform: rotate(90deg) !important;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
&.right-center {
|
|
108
|
-
&::before {
|
|
109
|
-
left: -8px;
|
|
110
|
-
top: 50%;
|
|
111
|
-
transform: rotate(90deg) translateY(-50%) !important;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
&.right-bottom {
|
|
115
|
-
&::before {
|
|
116
|
-
top: 10px;
|
|
117
|
-
left: -6px;
|
|
118
|
-
transform: rotate(90deg) !important;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
&.bottom-left {
|
|
122
|
-
&::before {
|
|
123
|
-
top: -4px;
|
|
124
|
-
right: 10px;
|
|
125
|
-
transform: rotate(180deg) !important;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
&.bottom-center {
|
|
129
|
-
&::before {
|
|
130
|
-
top: -4px;
|
|
131
|
-
right: 50%;
|
|
132
|
-
transform: rotate(180deg) translateX(-50%) !important;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
&.bottom-right {
|
|
136
|
-
&::before {
|
|
137
|
-
top: -4px;
|
|
138
|
-
left: 10px;
|
|
139
|
-
transform: rotate(180deg) !important;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
&.left-top {
|
|
143
|
-
&::before {
|
|
144
|
-
right: -6px;
|
|
145
|
-
bottom: 10px;
|
|
146
|
-
transform: rotate(-90deg) !important;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
&.left-center {
|
|
150
|
-
&::before {
|
|
151
|
-
right: -8px;
|
|
152
|
-
top: 50%;
|
|
153
|
-
transform: rotate(-90deg) translateY(-50%) !important;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
&.left-bottom {
|
|
157
|
-
&::before {
|
|
158
|
-
top: 10px;
|
|
159
|
-
right: -6px;
|
|
160
|
-
transform: rotate(-90deg) !important;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
79
|
}
|
|
164
80
|
</style>
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<li>
|
|
3
3
|
<div
|
|
4
|
-
v-tooltip="showTooltip ? option.title : ''"
|
|
5
4
|
class="tree-select-option"
|
|
5
|
+
tabindex="0"
|
|
6
|
+
role="option"
|
|
7
|
+
:aria-selected="isChecked"
|
|
8
|
+
:aria-label="option.title"
|
|
9
|
+
:id="'option-' + id"
|
|
6
10
|
:class="{
|
|
7
11
|
'tree-select-option-checked': isChecked,
|
|
8
12
|
'tree-select-option-margin': hasVisibleChildren,
|
|
@@ -11,9 +15,11 @@
|
|
|
11
15
|
'is-not-multiple': !isMultiple,
|
|
12
16
|
'tree-select-option-toggle': this.isToggle && this.isMultiple,
|
|
13
17
|
}"
|
|
14
|
-
tabindex="0"
|
|
15
18
|
@keydown.self="onKeydown"
|
|
19
|
+
@focus="$emit('onFocus', `option-${id}`)"
|
|
16
20
|
>
|
|
21
|
+
<ib-tooltip v-if="showTooltip" :text="option.title"></ib-tooltip>
|
|
22
|
+
|
|
17
23
|
<ib-icon-button
|
|
18
24
|
:disabled-focus="true"
|
|
19
25
|
kind="ghost"
|
|
@@ -36,7 +42,9 @@
|
|
|
36
42
|
ref="component"
|
|
37
43
|
tabindex="-1"
|
|
38
44
|
v-show="showInput"
|
|
45
|
+
disable-focus
|
|
39
46
|
:is="component"
|
|
47
|
+
:aria-label="option.title"
|
|
40
48
|
:name="actualName"
|
|
41
49
|
:value="option.id"
|
|
42
50
|
:id="'input' + id"
|
|
@@ -109,7 +117,7 @@ import Toggle from "../Form/Toggle/Toggle.vue";
|
|
|
109
117
|
import List from "../List.vue";
|
|
110
118
|
import IbIcon from "../Icon.vue";
|
|
111
119
|
import IbIconButton from "../IconButton/IconButton.vue";
|
|
112
|
-
import
|
|
120
|
+
import IbTooltip from "../Tooltip/Tooltip.vue";
|
|
113
121
|
import multiLineOverflows from "../../helpers/multiLineOverflows";
|
|
114
122
|
import {
|
|
115
123
|
SPACE_KEY_CODE,
|
|
@@ -321,8 +329,8 @@ export default {
|
|
|
321
329
|
IbIcon,
|
|
322
330
|
List,
|
|
323
331
|
IbIconButton,
|
|
332
|
+
IbTooltip,
|
|
324
333
|
},
|
|
325
|
-
directives: { Tooltip },
|
|
326
334
|
};
|
|
327
335
|
</script>
|
|
328
336
|
<style lang="scss">
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
:disabled="isLoading"
|
|
9
9
|
:is-resizable="isResizable"
|
|
10
10
|
:vertical="vertical"
|
|
11
|
-
@close="onClose"
|
|
12
11
|
ref="dropdown"
|
|
12
|
+
@close="onClose"
|
|
13
|
+
@open="isOpen = true"
|
|
13
14
|
>
|
|
14
15
|
<template v-if="hasTrigger" v-slot:trigger>
|
|
15
16
|
<slot v-bind:selected-count="selectedKeys.length" name="trigger"></slot>
|
|
@@ -23,8 +24,10 @@
|
|
|
23
24
|
ref="combobox"
|
|
24
25
|
@click.prevent
|
|
25
26
|
@blur="onBlur"
|
|
27
|
+
@keyup.down="comboboxKeyupDown"
|
|
28
|
+
@keyup.up="comboboxKeyupDown"
|
|
26
29
|
:aria-label="ariaLabel"
|
|
27
|
-
:aria-
|
|
30
|
+
:aria-activedescendant="focusedOptionId"
|
|
28
31
|
:class="{
|
|
29
32
|
'tree-choice-opened': isOpened,
|
|
30
33
|
'has-clear-button': !showClearButton,
|
|
@@ -61,22 +64,16 @@
|
|
|
61
64
|
</template>
|
|
62
65
|
|
|
63
66
|
<template v-slot:body>
|
|
64
|
-
<!-- here -->
|
|
65
67
|
<div
|
|
66
68
|
class="tree-drop"
|
|
67
69
|
:class="{ 'not-tree-child': !hasTreeChildren }"
|
|
68
|
-
:style="
|
|
70
|
+
:style="{
|
|
71
|
+
width: 'auto',
|
|
72
|
+
position: 'absolute',
|
|
73
|
+
left: -size.left + 'px',
|
|
74
|
+
right: -size.right + 'px',
|
|
75
|
+
}"
|
|
69
76
|
>
|
|
70
|
-
<!-- :style="
|
|
71
|
-
!feetContentSize
|
|
72
|
-
? {
|
|
73
|
-
width: 'auto',
|
|
74
|
-
position: 'absolute',
|
|
75
|
-
left: -size.left + 'px',
|
|
76
|
-
right: -size.right + 'px',
|
|
77
|
-
}
|
|
78
|
-
: ''
|
|
79
|
-
" -->
|
|
80
77
|
<div
|
|
81
78
|
v-if="isResizable"
|
|
82
79
|
class="ib-dropdown-resizer ib-dropdown-resizer-left"
|
|
@@ -111,18 +108,25 @@
|
|
|
111
108
|
<ib-input
|
|
112
109
|
class="tree-search"
|
|
113
110
|
v-if="showSearch"
|
|
111
|
+
ref="search"
|
|
114
112
|
:show-icon="true"
|
|
115
113
|
:value="filterString"
|
|
114
|
+
:aria-label="
|
|
115
|
+
searchPlaceholderText
|
|
116
|
+
? searchPlaceholderText
|
|
117
|
+
: actualStrings.searchPlaceholder"
|
|
116
118
|
:placeholder="
|
|
117
119
|
searchPlaceholderText
|
|
118
120
|
? searchPlaceholderText
|
|
119
121
|
: actualStrings.searchPlaceholder
|
|
120
122
|
"
|
|
121
123
|
@input="filter($event, actualOptions)"
|
|
124
|
+
@keyup.down="inputKeyupDown"
|
|
122
125
|
></ib-input>
|
|
123
126
|
|
|
124
127
|
<list
|
|
125
128
|
ref="list"
|
|
129
|
+
role="listbox"
|
|
126
130
|
:class="{ 'tree-select-list': true, 'has-hierarchy': hasHierarchy }"
|
|
127
131
|
>
|
|
128
132
|
<div
|
|
@@ -191,10 +195,11 @@
|
|
|
191
195
|
:parent-auto-check="false"
|
|
192
196
|
:is-multiple="isMultiple"
|
|
193
197
|
:is-bookmarkable="false"
|
|
194
|
-
@check="manageAll"
|
|
195
198
|
:uid="uid"
|
|
196
199
|
:only-end-nodes="onlyEndNodes"
|
|
197
200
|
:show-input="showInputs"
|
|
201
|
+
@check="manageAll"
|
|
202
|
+
@on-focus="(id) => focusedOptionId = id"
|
|
198
203
|
></select-option>
|
|
199
204
|
</template>
|
|
200
205
|
|
|
@@ -220,12 +225,13 @@
|
|
|
220
225
|
:parent-auto-check="parentAutoCheck"
|
|
221
226
|
:is-multiple="isMultiple"
|
|
222
227
|
:is-bookmarkable="isBookmarkable"
|
|
223
|
-
@check="registerCheck"
|
|
224
|
-
@toggle-bookmark="toggleBookmark"
|
|
225
228
|
:uid="uid"
|
|
226
229
|
:only-end-nodes="onlyEndNodes"
|
|
227
230
|
:html-title="htmlOptionTitle"
|
|
228
231
|
:show-input="showInputs"
|
|
232
|
+
@check="registerCheck"
|
|
233
|
+
@toggle-bookmark="toggleBookmark"
|
|
234
|
+
@on-focus="(id) => focusedOptionId = id"
|
|
229
235
|
></select-option>
|
|
230
236
|
</slot>
|
|
231
237
|
</template>
|
|
@@ -273,9 +279,6 @@ export default {
|
|
|
273
279
|
type: Boolean,
|
|
274
280
|
default: false,
|
|
275
281
|
},
|
|
276
|
-
menuSize: {
|
|
277
|
-
type: [String, Number],
|
|
278
|
-
},
|
|
279
282
|
initialSize: {
|
|
280
283
|
left: 0,
|
|
281
284
|
right: 0,
|
|
@@ -507,9 +510,11 @@ export default {
|
|
|
507
510
|
actualOptions: [],
|
|
508
511
|
actualBookmarkedOptions: {},
|
|
509
512
|
selected: [],
|
|
513
|
+
isOpen: false,
|
|
510
514
|
allOptionsIsChecked: true,
|
|
511
515
|
hasTreeChildren: false,
|
|
512
516
|
uid: `f${(~~(Math.random() * 1e8)).toString(16)}`,
|
|
517
|
+
focusedOptionId: '',
|
|
513
518
|
actualStrings: {
|
|
514
519
|
...{
|
|
515
520
|
searchPlaceholder: lang(
|
|
@@ -555,14 +560,28 @@ export default {
|
|
|
555
560
|
methods: {
|
|
556
561
|
onBlur() {
|
|
557
562
|
setTimeout(() => {
|
|
558
|
-
if (!this.
|
|
563
|
+
if (!this.isOpen) {
|
|
559
564
|
this.$emit("blur");
|
|
560
565
|
}
|
|
561
566
|
}, 200);
|
|
562
567
|
},
|
|
568
|
+
inputKeyupDown() {
|
|
569
|
+
this.focusOnFirstOptions();
|
|
570
|
+
},
|
|
571
|
+
comboboxKeyupDown() {
|
|
572
|
+
if (this.showSearch) {
|
|
573
|
+
this.$refs.search.focus();
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
this.focusOnFirstOptions();
|
|
578
|
+
},
|
|
563
579
|
focus() {
|
|
564
580
|
this.$refs.combobox.focus();
|
|
565
581
|
},
|
|
582
|
+
focusOnFirstOptions() {
|
|
583
|
+
this.$refs.list.$el.querySelector('[tabindex]:not(hidden)').focus();
|
|
584
|
+
},
|
|
566
585
|
startResizing(prop) {
|
|
567
586
|
this.resizingProp = prop;
|
|
568
587
|
},
|
|
@@ -867,6 +886,7 @@ export default {
|
|
|
867
886
|
this.filter(this.filterString, options);
|
|
868
887
|
},
|
|
869
888
|
onClose() {
|
|
889
|
+
this.isOpen = false;
|
|
870
890
|
this.filter("", this.actualOptions);
|
|
871
891
|
|
|
872
892
|
if (this.isMultiple) {
|
|
@@ -884,22 +904,6 @@ export default {
|
|
|
884
904
|
hasEmptyMessage() {
|
|
885
905
|
return !!this.$slots.emptyMessage;
|
|
886
906
|
},
|
|
887
|
-
treeDropPos() {
|
|
888
|
-
if (this.menuSize) {
|
|
889
|
-
return {
|
|
890
|
-
width: this.menuSize + "px",
|
|
891
|
-
maxWidth: this.menuSize + "px",
|
|
892
|
-
minWidth: this.menuSize + "px",
|
|
893
|
-
};
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
return {
|
|
897
|
-
width: "auto",
|
|
898
|
-
position: "absolute",
|
|
899
|
-
left: -this.size.left + "px",
|
|
900
|
-
right: -this.size.right + "px",
|
|
901
|
-
};
|
|
902
|
-
},
|
|
903
907
|
hasHierarchy() {
|
|
904
908
|
return this.actualOptions.some((option) => {
|
|
905
909
|
return option.children;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createApp } from "vue";
|
|
2
|
-
import { popoverPosition } from "../../components/Popover/constants";
|
|
3
2
|
import IbTooltip from "../../components/Tooltip/Tooltip.vue";
|
|
4
3
|
import generateUID from "../../helpers/generateUID";
|
|
5
4
|
|
|
@@ -26,8 +25,8 @@ export default class Tooltip {
|
|
|
26
25
|
this.uuid = "tooltip_" + generateUID();
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
createTooltip(el, text
|
|
30
|
-
if (!text
|
|
28
|
+
createTooltip(el, text) {
|
|
29
|
+
if (!text.length) {
|
|
31
30
|
return;
|
|
32
31
|
}
|
|
33
32
|
|
|
@@ -47,135 +46,37 @@ export default class Tooltip {
|
|
|
47
46
|
text: text,
|
|
48
47
|
alwaysVisible: true,
|
|
49
48
|
for: this.uuid,
|
|
50
|
-
class: this.getClassList(position),
|
|
51
49
|
});
|
|
52
50
|
|
|
53
51
|
this.tooltipInstance.mount(this.tooltipContainer);
|
|
54
52
|
|
|
55
53
|
setTimeout(() => {
|
|
56
54
|
if (this.tooltipContainer?.firstChild) {
|
|
57
|
-
el.setAttribute("describedby", this.uuid);
|
|
55
|
+
el.setAttribute("aria-describedby", this.uuid);
|
|
56
|
+
const { top, left, width } = el.getBoundingClientRect();
|
|
57
|
+
const { width: tooltipWidth, height: tooltipHeight } =
|
|
58
|
+
this.tooltipContainer.firstChild.getBoundingClientRect();
|
|
59
|
+
const scrollTop = document.documentElement.scrollTop;
|
|
60
|
+
|
|
61
|
+
const tooltipStyles = `
|
|
62
|
+
left: ${left + width / 2 - tooltipWidth / 2}px!important;
|
|
63
|
+
top: ${top - tooltipHeight + scrollTop - 5}px!important;
|
|
64
|
+
bottom: auto!important;
|
|
65
|
+
right: auto!important;
|
|
66
|
+
transform: none!important;
|
|
67
|
+
`;
|
|
58
68
|
|
|
59
|
-
const tooltipStyles = this.getPositionStyle(el, position);
|
|
60
69
|
this.tooltipContainer.firstChild.setAttribute("style", tooltipStyles);
|
|
61
70
|
}
|
|
62
71
|
}, 100);
|
|
63
72
|
}
|
|
64
73
|
|
|
65
74
|
destroyTooltip(el) {
|
|
66
|
-
el?.removeAttribute("describedby");
|
|
75
|
+
el?.removeAttribute("aria-describedby");
|
|
67
76
|
this.uuid = null;
|
|
68
77
|
this.tooltipInstance?.unmount();
|
|
69
78
|
this.tooltipInstance = null;
|
|
70
79
|
this.tooltipContainer?.remove();
|
|
71
80
|
this.tooltipContainer = null;
|
|
72
81
|
}
|
|
73
|
-
|
|
74
|
-
getPositionStyle(el, position) {
|
|
75
|
-
const { top, bottom, left, right, width, height } = el.getBoundingClientRect();
|
|
76
|
-
const { width: tooltipWidth, height: tooltipHeight } =
|
|
77
|
-
this.tooltipContainer.firstChild.getBoundingClientRect();
|
|
78
|
-
|
|
79
|
-
const scrollTop = document.documentElement.scrollTop;
|
|
80
|
-
|
|
81
|
-
let styles = `
|
|
82
|
-
bottom: auto!important;
|
|
83
|
-
right: auto!important;
|
|
84
|
-
transform: none!important;
|
|
85
|
-
`;
|
|
86
|
-
|
|
87
|
-
switch (position) {
|
|
88
|
-
case "bottomCenter":
|
|
89
|
-
styles =
|
|
90
|
-
styles +
|
|
91
|
-
`left: ${left + width / 2 - tooltipWidth / 2}px!important;
|
|
92
|
-
top: ${bottom + scrollTop + 5}px!important;`;
|
|
93
|
-
break;
|
|
94
|
-
case "bottomLeft":
|
|
95
|
-
styles =
|
|
96
|
-
styles +
|
|
97
|
-
`left: ${right - tooltipWidth - width / 2 + 14}px!important;
|
|
98
|
-
top: ${bottom + scrollTop + 5}px!important;`;
|
|
99
|
-
break;
|
|
100
|
-
case "bottomRight":
|
|
101
|
-
styles =
|
|
102
|
-
styles +
|
|
103
|
-
`left: ${left + width / 2 - 14}px!important;
|
|
104
|
-
top: ${bottom + scrollTop + 5}px!important;`;
|
|
105
|
-
break;
|
|
106
|
-
case "topLeft":
|
|
107
|
-
styles =
|
|
108
|
-
styles +
|
|
109
|
-
`left: ${right - tooltipWidth - width / 2 + 14}px!important;
|
|
110
|
-
top: ${top - tooltipHeight + scrollTop - 5}px!important;`;
|
|
111
|
-
break;
|
|
112
|
-
case "topRight":
|
|
113
|
-
styles =
|
|
114
|
-
styles +
|
|
115
|
-
`left: ${left + width / 2 - 14}px!important;
|
|
116
|
-
top: ${top - tooltipHeight + scrollTop - 5}px!important;`;
|
|
117
|
-
break;
|
|
118
|
-
case "leftTop":
|
|
119
|
-
styles =
|
|
120
|
-
styles +
|
|
121
|
-
`left: ${left - tooltipWidth - 5}px!important;
|
|
122
|
-
top: ${
|
|
123
|
-
bottom - tooltipHeight - height / 2 + scrollTop + 12
|
|
124
|
-
}px!important`;
|
|
125
|
-
break;
|
|
126
|
-
case "leftCenter":
|
|
127
|
-
styles =
|
|
128
|
-
styles +
|
|
129
|
-
`left: ${left - tooltipWidth - 5}px!important;
|
|
130
|
-
top: ${
|
|
131
|
-
bottom + scrollTop - tooltipHeight / 2 - height / 2
|
|
132
|
-
}px!important;`;
|
|
133
|
-
break;
|
|
134
|
-
case "leftBottom":
|
|
135
|
-
styles =
|
|
136
|
-
styles +
|
|
137
|
-
`left: ${left - tooltipWidth - 5}px!important;
|
|
138
|
-
top: ${bottom + scrollTop - height / 2 - 12}px!important;`;
|
|
139
|
-
break;
|
|
140
|
-
case "rightTop":
|
|
141
|
-
styles =
|
|
142
|
-
styles +
|
|
143
|
-
`left: ${right + 5}px!important;
|
|
144
|
-
top: ${
|
|
145
|
-
bottom - tooltipHeight - height / 2 + scrollTop + 12
|
|
146
|
-
}px!important`;
|
|
147
|
-
break;
|
|
148
|
-
case "rightCenter":
|
|
149
|
-
styles =
|
|
150
|
-
styles +
|
|
151
|
-
`left: ${right + 5}px!important;
|
|
152
|
-
top: ${
|
|
153
|
-
bottom + scrollTop - tooltipHeight / 2 - height / 2
|
|
154
|
-
}px!important;`;
|
|
155
|
-
break;
|
|
156
|
-
|
|
157
|
-
case "rightBottom":
|
|
158
|
-
styles =
|
|
159
|
-
styles +
|
|
160
|
-
`left: ${right + 5}px!important;
|
|
161
|
-
top: ${bottom + scrollTop - height / 2 - 12}px!important`;
|
|
162
|
-
break;
|
|
163
|
-
default:
|
|
164
|
-
styles =
|
|
165
|
-
styles +
|
|
166
|
-
`left: ${left + width / 2 - tooltipWidth / 2}px!important;
|
|
167
|
-
top: ${top - tooltipHeight + scrollTop - 5}px!important`;
|
|
168
|
-
break;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return styles;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
getClassList(position) {
|
|
175
|
-
if (!position) {
|
|
176
|
-
return popoverPosition.topCenter;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return popoverPosition[position];
|
|
180
|
-
}
|
|
181
82
|
}
|