@avakhula/ui 0.0.23 → 0.0.25
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/dist/index.js +1628 -1600
- package/dist/index.umd.cjs +23 -13
- package/package.json +1 -1
- package/src/App.vue +11 -0
- package/src/components/Pagination/Pagination.vue +0 -1
- package/src/directives/tooltip/tooltip.js +50 -0
- package/src/index.js +1 -0
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -21,9 +21,16 @@
|
|
|
21
21
|
<button @click="changeValueInProps">Change value in props</button>
|
|
22
22
|
|
|
23
23
|
<ib-checkbox @input="test1" class="hello" />
|
|
24
|
+
|
|
25
|
+
<ib-button style="margin-bottom: 20px;" v-tooltip="'test'" >HOVER ME</ib-button>
|
|
26
|
+
<ib-button style="margin-bottom: 20px;" v-tooltip="'second test'" >HOVER ME</ib-button>
|
|
27
|
+
|
|
24
28
|
</template>
|
|
25
29
|
|
|
26
30
|
<script>
|
|
31
|
+
import IbButton from "./components/Button/Button.vue"
|
|
32
|
+
import { TooltipDirective as Tooltip} from "./directives/tooltip/tooltip"
|
|
33
|
+
|
|
27
34
|
import IbSelect from "./components/TreeSelect/Select.vue";
|
|
28
35
|
import IbCheckbox from "./components/Form/Checkbox/Checkbox.vue";
|
|
29
36
|
import IbPagination from "./components/Pagination/Pagination.vue";
|
|
@@ -85,12 +92,16 @@ export default {
|
|
|
85
92
|
test: testData[0].id,
|
|
86
93
|
};
|
|
87
94
|
},
|
|
95
|
+
directives: {
|
|
96
|
+
Tooltip,
|
|
97
|
+
},
|
|
88
98
|
watch: {
|
|
89
99
|
test(val) {
|
|
90
100
|
console.log("test", val);
|
|
91
101
|
},
|
|
92
102
|
},
|
|
93
103
|
components: {
|
|
104
|
+
IbButton,
|
|
94
105
|
IbSelect,
|
|
95
106
|
IbCheckbox,
|
|
96
107
|
IbPagination,
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// import { createApp, h } from "vue";
|
|
2
|
+
import IbTooltip from "../../components/Tooltip/Tooltip.vue";
|
|
3
|
+
import { createApp } from "vue";
|
|
4
|
+
|
|
5
|
+
export const TooltipDirective = {
|
|
6
|
+
mounted(el, binding) {
|
|
7
|
+
let tooltipInstance = null;
|
|
8
|
+
const tooltipContainer = document.createElement("div");
|
|
9
|
+
|
|
10
|
+
el.addEventListener("mouseenter", () => {
|
|
11
|
+
const tooltipContainerStyles = `
|
|
12
|
+
position: absolute;
|
|
13
|
+
top: 0px;
|
|
14
|
+
left: 0px;
|
|
15
|
+
`;
|
|
16
|
+
tooltipContainer.setAttribute("style", tooltipContainerStyles);
|
|
17
|
+
|
|
18
|
+
document.body.appendChild(tooltipContainer);
|
|
19
|
+
tooltipInstance = createApp(IbTooltip, {
|
|
20
|
+
text: binding.value,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
tooltipInstance.mount(tooltipContainer);
|
|
24
|
+
tooltipContainer.firstChild.setAttribute("style", "display: block");
|
|
25
|
+
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
if (tooltipContainer.firstChild) {
|
|
28
|
+
const { top, left, width } = el.getBoundingClientRect();
|
|
29
|
+
const { width: tooltipWidth, height: tooltipHeight } =
|
|
30
|
+
tooltipContainer.firstChild.getBoundingClientRect();
|
|
31
|
+
|
|
32
|
+
const tooltipStyles = `
|
|
33
|
+
left: ${left + width / 2 - tooltipWidth / 2}px!important;
|
|
34
|
+
top: ${top - tooltipHeight - 5}px!important;
|
|
35
|
+
bottom: auto!important;
|
|
36
|
+
right: auto!important;
|
|
37
|
+
transform: none!important;
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
tooltipContainer.firstChild.setAttribute("style", tooltipStyles);
|
|
41
|
+
}
|
|
42
|
+
}, 100);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
el.addEventListener("mouseleave", () => {
|
|
46
|
+
tooltipInstance.unmount();
|
|
47
|
+
document.body.removeChild(tooltipContainer);
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
};
|
package/src/index.js
CHANGED