@milaboratories/uikit 2.10.26 → 2.10.28
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/.turbo/turbo-build.log +40 -41
- package/.turbo/turbo-formatter$colon$check.log +2 -2
- package/.turbo/turbo-linter$colon$check.log +2 -2
- package/.turbo/turbo-types$colon$check.log +1 -1
- package/CHANGELOG.md +12 -0
- package/dist/components/DataTable/TableComponent.vue.js +16 -17
- package/dist/components/DataTable/TableComponent.vue.js.map +1 -1
- package/dist/components/PlAccordion/ExpandTransition.vue3.js +2 -2
- package/dist/components/PlAccordion/PlAccordionSection.vue2.js +2 -2
- package/dist/components/PlAutocomplete/PlAutocomplete.vue.js +33 -33
- package/dist/components/PlAutocompleteMulti/PlAutocompleteMulti.vue.js +17 -17
- package/dist/components/PlBtnGroup/PlBtnGroup.vue.js +17 -17
- package/dist/components/PlCheckboxGroup/PlCheckboxGroup.vue.js +12 -12
- package/dist/components/PlChip/PlChip.vue.js +8 -8
- package/dist/components/PlDropdown/PlDropdown.vue.js +27 -27
- package/dist/components/PlDropdownLegacy/PlDropdownLegacy.vue.js +39 -39
- package/dist/components/PlDropdownMulti/PlDropdownMulti.vue.js +20 -20
- package/dist/components/PlFileDialog/PlFileDialog.vue.d.ts +3 -1
- package/dist/components/PlFileDialog/PlFileDialog.vue.d.ts.map +1 -1
- package/dist/components/PlFileDialog/Remote.vue.d.ts +3 -1
- package/dist/components/PlFileDialog/Remote.vue.d.ts.map +1 -1
- package/dist/components/PlFileDialog/Remote.vue.js +80 -76
- package/dist/components/PlFileDialog/Remote.vue.js.map +1 -1
- package/dist/components/PlFileDialog/Shortcuts.vue.d.ts +4 -1
- package/dist/components/PlFileDialog/Shortcuts.vue.d.ts.map +1 -1
- package/dist/components/PlFileDialog/Shortcuts.vue2.js +18 -14
- package/dist/components/PlFileDialog/Shortcuts.vue2.js.map +1 -1
- package/dist/components/PlFileInput/PlFileInput.vue.js +17 -17
- package/dist/components/PlLogView/PlLogView.vue.js +22 -22
- package/dist/components/PlNumberField/PlNumberField.vue.js +8 -8
- package/dist/components/PlSearchField/PlSearchField.vue.d.ts +28 -4
- package/dist/components/PlSearchField/PlSearchField.vue.d.ts.map +1 -1
- package/dist/components/PlSearchField/PlSearchField.vue2.js +40 -30
- package/dist/components/PlSearchField/PlSearchField.vue2.js.map +1 -1
- package/dist/components/PlSlideModal/PlPureSlideModal.vue.js +3 -4
- package/dist/components/PlSlideModal/PlPureSlideModal.vue.js.map +1 -1
- package/dist/components/PlTabs/Tab.vue.d.ts +42 -12
- package/dist/components/PlTabs/Tab.vue.d.ts.map +1 -1
- package/dist/components/PlTabs/Tab.vue.js +6 -6
- package/dist/components/PlTextArea/PlTextArea.vue.js +22 -22
- package/dist/components/PlTextField/PlTextField.vue.js +14 -14
- package/dist/components/PlTooltip/PlTooltip.vue.d.ts +30 -3
- package/dist/components/PlTooltip/PlTooltip.vue.d.ts.map +1 -1
- package/dist/components/PlTooltip/PlTooltip.vue.js +7 -110
- package/dist/components/PlTooltip/PlTooltip.vue.js.map +1 -1
- package/dist/components/PlTooltip/PlTooltip.vue2.js +132 -2
- package/dist/components/PlTooltip/PlTooltip.vue2.js.map +1 -1
- package/dist/components/PlTooltip/PlTooltip.vue3.js +26 -0
- package/dist/components/PlTooltip/PlTooltip.vue3.js.map +1 -0
- package/dist/components/Slider.vue.d.ts +1 -1
- package/dist/components/Slider.vue.d.ts.map +1 -1
- package/dist/components/Slider.vue.js +21 -21
- package/dist/components/SliderRange.vue.d.ts +1 -1
- package/dist/components/SliderRange.vue.d.ts.map +1 -1
- package/dist/components/SliderRange.vue.js +31 -31
- package/dist/components/SliderRangeTriple.vue.d.ts +1 -1
- package/dist/components/SliderRangeTriple.vue.d.ts.map +1 -1
- package/dist/components/SliderRangeTriple.vue.js +23 -23
- package/dist/index.js +1 -1
- package/dist/utils/DoubleContour.vue2.js +23 -0
- package/dist/utils/DoubleContour.vue2.js.map +1 -0
- package/package.json +3 -3
- package/src/assets/base.scss +4 -1
- package/src/assets/mixins.scss +1 -2
- package/src/assets/utils.scss +1 -1
- package/src/components/PlFileDialog/Remote.vue +5 -3
- package/src/components/PlFileDialog/Shortcuts.vue +5 -1
- package/src/components/PlSearchField/PlSearchField.vue +22 -17
- package/src/components/PlTooltip/PlTooltip.vue +228 -33
- package/dist/components/PlTooltip/Beak.vue.d.ts +0 -3
- package/dist/components/PlTooltip/Beak.vue.d.ts.map +0 -1
- package/dist/components/PlTooltip/Beak.vue.js +0 -23
- package/dist/components/PlTooltip/Beak.vue.js.map +0 -1
- package/dist/components/PlTooltip/useTooltipPosition.d.ts +0 -12
- package/dist/components/PlTooltip/useTooltipPosition.d.ts.map +0 -1
- package/dist/components/PlTooltip/useTooltipPosition.js +0 -18
- package/dist/components/PlTooltip/useTooltipPosition.js.map +0 -1
- package/src/components/PlTooltip/Beak.vue +0 -12
- package/src/components/PlTooltip/pl-tooltip.scss +0 -117
- package/src/components/PlTooltip/useTooltipPosition.ts +0 -59
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineComponent as t, createElementBlock as r, openBlock as n, normalizeClass as s, createElementVNode as a, normalizeProps as l, guardReactiveProps as i, renderSlot as u } from "vue";
|
|
2
|
+
const d = {
|
|
3
|
+
inheritAttrs: !1
|
|
4
|
+
}, m = /* @__PURE__ */ t({
|
|
5
|
+
...d,
|
|
6
|
+
__name: "DoubleContour",
|
|
7
|
+
props: {
|
|
8
|
+
groupPosition: { default: void 0 }
|
|
9
|
+
},
|
|
10
|
+
setup(o) {
|
|
11
|
+
return (e, c) => (n(), r("div", {
|
|
12
|
+
class: s(["double-contour", { [o.groupPosition]: !0 }])
|
|
13
|
+
}, [
|
|
14
|
+
a("div", l(i(e.$attrs)), [
|
|
15
|
+
u(e.$slots, "default")
|
|
16
|
+
], 16)
|
|
17
|
+
], 2));
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
m as default
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=DoubleContour.vue2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DoubleContour.vue2.js","sources":["../../src/utils/DoubleContour.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nwithDefaults(\n defineProps<{\n groupPosition?:\n | \"top\"\n | \"bottom\"\n | \"left\"\n | \"right\"\n | \"top-left\"\n | \"top-right\"\n | \"bottom-left\"\n | \"bottom-right\"\n | \"middle\";\n }>(),\n {\n groupPosition: undefined,\n },\n);\n</script>\n\n<script lang=\"ts\">\nexport default {\n inheritAttrs: false,\n};\n</script>\n\n<template>\n <div class=\"double-contour\" :class=\"{ [groupPosition]: true }\">\n <div v-bind=\"$attrs\">\n <slot />\n </div>\n </div>\n</template>\n<style>\n.double-contour {\n &.top > div {\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n }\n}\n.double-contour {\n &.bottom > div {\n border-top-right-radius: 0;\n border-top-left-radius: 0;\n }\n}\n.double-contour {\n &.left > div {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n }\n}\n.double-contour {\n &.right > div {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n }\n}\n.double-contour {\n &.top-left > div {\n border-top-right-radius: 0;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n}\n.double-contour {\n &.top-right > div {\n border-bottom-right-radius: 0;\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n}\n.double-contour {\n &.bottom-left > div {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n border-top-left-radius: 0;\n }\n}\n.double-contour {\n &.bottom-right > div {\n border-top-right-radius: 0;\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n }\n}\n.double-contour {\n &.middle > div {\n border-radius: 0;\n }\n}\n</style>\n"],"names":["__default__","_createElementBlock","_normalizeClass","__props","_createElementVNode","$attrs","_renderSlot","_ctx"],"mappings":";AAqBA,MAAAA,IAAe;AAAA,EACb,cAAc;AAChB;;;;;;;2BAIEC,EAIM,OAAA;AAAA,MAJD,OAAKC,EAAA,CAAC,kBAAgB,EAAA,CAAYC,EAAA,aAAa,GAAA,IAAA,CAAA;AAAA,IAAA;MAClDC,EAEM,WAFOC,EAAAA,MAAM,CAAA,GAAA;AAAA,QACjBC,EAAQC,EAAA,QAAA,SAAA;AAAA,MAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/uikit",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.28",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"resize-observer-polyfill": "^1.5.1",
|
|
33
33
|
"sortablejs": "^1.15.6",
|
|
34
34
|
"vue": "^3.5.24",
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
35
|
+
"@milaboratories/helpers": "1.13.5",
|
|
36
|
+
"@platforma-sdk/model": "1.55.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@vitest/coverage-istanbul": "^4.0.16",
|
package/src/assets/base.scss
CHANGED
|
@@ -143,11 +143,14 @@ body,
|
|
|
143
143
|
box-sizing: border-box;
|
|
144
144
|
position: relative;
|
|
145
145
|
background-size: cover;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
html,
|
|
149
|
+
#app {
|
|
146
150
|
overflow: hidden;
|
|
147
151
|
}
|
|
148
152
|
|
|
149
153
|
body {
|
|
150
|
-
overflow: hidden;
|
|
151
154
|
display: flex;
|
|
152
155
|
flex-direction: column;
|
|
153
156
|
height: 100%;
|
package/src/assets/mixins.scss
CHANGED
package/src/assets/utils.scss
CHANGED
|
@@ -3,7 +3,7 @@ import { useEventListener } from "../../composition/useEventListener";
|
|
|
3
3
|
import type { ImportedFiles } from "../../types";
|
|
4
4
|
import { between, notEmpty, tapIf } from "@milaboratories/helpers";
|
|
5
5
|
import { getRawPlatformaInstance, type StorageHandle } from "@platforma-sdk/model";
|
|
6
|
-
import { computed, onMounted, reactive, toRef, watch } from "vue";
|
|
6
|
+
import { computed, onMounted, reactive, ref, toRef, watch } from "vue";
|
|
7
7
|
import { PlDropdown } from "../PlDropdown";
|
|
8
8
|
import { PlIcon16 } from "../PlIcon16";
|
|
9
9
|
import Shortcuts from "./Shortcuts.vue";
|
|
@@ -273,6 +273,8 @@ defineExpose({
|
|
|
273
273
|
});
|
|
274
274
|
|
|
275
275
|
onMounted(loadAvailableStorages);
|
|
276
|
+
|
|
277
|
+
const lsContainerRef = ref<HTMLElement | undefined>();
|
|
276
278
|
</script>
|
|
277
279
|
|
|
278
280
|
<template>
|
|
@@ -289,7 +291,7 @@ onMounted(loadAvailableStorages);
|
|
|
289
291
|
<PlSearchField v-model="data.search" label="Search in folder" clearable />
|
|
290
292
|
</div>
|
|
291
293
|
</div>
|
|
292
|
-
<div :class="style['ls-container']">
|
|
294
|
+
<div :class="style['ls-container']" ref="lsContainerRef">
|
|
293
295
|
<div :class="style['ls-head']">
|
|
294
296
|
<div :class="style['breadcrumbs']">
|
|
295
297
|
<template v-for="(s, i) in breadcrumbs" :key="i">
|
|
@@ -299,7 +301,7 @@ onMounted(loadAvailableStorages);
|
|
|
299
301
|
</div>
|
|
300
302
|
<div :class="style.selected">
|
|
301
303
|
<span>Selected: {{ selectedFiles.length }}</span>
|
|
302
|
-
<Shortcuts />
|
|
304
|
+
<Shortcuts :container="lsContainerRef" />
|
|
303
305
|
</div>
|
|
304
306
|
</div>
|
|
305
307
|
<div v-if="data.currentLoadingPath !== undefined" class="ls-loader">
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { PlTooltip } from "../PlTooltip";
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
container?: "body" | HTMLElement;
|
|
6
|
+
}>();
|
|
3
7
|
</script>
|
|
4
8
|
|
|
5
9
|
<template>
|
|
6
|
-
<PlTooltip class="info" position="
|
|
10
|
+
<PlTooltip class="info" position="bottom" max-width="420px" :container="container">
|
|
7
11
|
<template #tooltip>
|
|
8
12
|
<span :class="$style.title">Shortcuts</span>
|
|
9
13
|
|
|
@@ -2,47 +2,52 @@
|
|
|
2
2
|
import { PlIcon16 } from "../PlIcon16";
|
|
3
3
|
import { PlIcon24 } from "../PlIcon24";
|
|
4
4
|
import { computed } from "vue";
|
|
5
|
+
import PlTooltip from "../PlTooltip/PlTooltip.vue";
|
|
5
6
|
|
|
6
|
-
const
|
|
7
|
+
const model = defineModel<string>({ required: true });
|
|
7
8
|
|
|
8
9
|
const props = defineProps<{
|
|
9
10
|
modelValue?: string;
|
|
10
11
|
clearable?: boolean;
|
|
11
12
|
placeholder?: string;
|
|
12
13
|
disabled?: boolean;
|
|
14
|
+
helper?: string;
|
|
15
|
+
}>();
|
|
16
|
+
const slots = defineSlots<{
|
|
17
|
+
helper: () => unknown;
|
|
13
18
|
}>();
|
|
14
19
|
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
return props.modelValue ?? "";
|
|
18
|
-
},
|
|
19
|
-
set(v) {
|
|
20
|
-
emit("update:modelValue", v);
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const nonEmpty = computed(() => !!props.modelValue);
|
|
20
|
+
const nonEmpty = computed(() => model.value != null && model.value.length > 0);
|
|
21
|
+
const hasHelper = computed(() => props.helper != null || slots.helper != null);
|
|
25
22
|
|
|
26
|
-
const clear = () =>
|
|
23
|
+
const clear = () => (model.value = "");
|
|
27
24
|
</script>
|
|
28
25
|
|
|
29
26
|
<template>
|
|
30
|
-
<div ref="root"
|
|
27
|
+
<div ref="root" :class="$style.component">
|
|
31
28
|
<PlIcon24 name="search" />
|
|
32
29
|
<input
|
|
33
30
|
ref="input"
|
|
34
|
-
v-model="
|
|
35
|
-
:disabled="disabled"
|
|
36
|
-
:placeholder="placeholder || 'Find...'"
|
|
31
|
+
v-model="model"
|
|
32
|
+
:disabled="props.disabled"
|
|
33
|
+
:placeholder="props.placeholder || 'Find...'"
|
|
37
34
|
type="text"
|
|
38
35
|
spellcheck="false"
|
|
39
36
|
/>
|
|
40
37
|
<PlIcon16
|
|
41
|
-
v-if="clearable && nonEmpty"
|
|
38
|
+
v-if="props.clearable && nonEmpty"
|
|
42
39
|
:class="$style.clear"
|
|
43
40
|
name="delete-clear"
|
|
44
41
|
@click.stop="clear"
|
|
45
42
|
/>
|
|
43
|
+
|
|
44
|
+
<PlTooltip v-if="hasHelper" class="info" position="bottom">
|
|
45
|
+
<template #tooltip>
|
|
46
|
+
<slot name="helper">
|
|
47
|
+
{{ props.helper }}
|
|
48
|
+
</slot>
|
|
49
|
+
</template>
|
|
50
|
+
</PlTooltip>
|
|
46
51
|
</div>
|
|
47
52
|
</template>
|
|
48
53
|
|
|
@@ -6,13 +6,11 @@ export default {
|
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<script lang="ts" setup>
|
|
9
|
-
import "
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { uniqueId } from "@milaboratories/helpers";
|
|
10
|
+
import { onUnmounted, reactive, ref, watch } from "vue";
|
|
11
|
+
import { tMap } from "./global";
|
|
12
12
|
import * as utils from "../../helpers/utils";
|
|
13
13
|
import { useClickOutside } from "../../composition/useClickOutside";
|
|
14
|
-
import Beak from "./Beak.vue";
|
|
15
|
-
import { tMap } from "./global";
|
|
16
14
|
|
|
17
15
|
const emit = defineEmits(["tooltip:close"]);
|
|
18
16
|
|
|
@@ -31,7 +29,7 @@ const props = withDefaults(
|
|
|
31
29
|
/**
|
|
32
30
|
* Tooltip position
|
|
33
31
|
*/
|
|
34
|
-
position?: "top
|
|
32
|
+
position?: "top" | "left" | "bottom" | "right" | "top-left";
|
|
35
33
|
/**
|
|
36
34
|
* external prop to hide tooltips
|
|
37
35
|
*/
|
|
@@ -40,6 +38,11 @@ const props = withDefaults(
|
|
|
40
38
|
* The gap in pixels between the tooltip and the target element
|
|
41
39
|
*/
|
|
42
40
|
gap?: number;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The minimum offset in pixels from the edge of the screen to the tooltip
|
|
44
|
+
*/
|
|
45
|
+
offsetToTheEdge?: number;
|
|
43
46
|
/**
|
|
44
47
|
* base html element for tooltip
|
|
45
48
|
*/
|
|
@@ -48,14 +51,25 @@ const props = withDefaults(
|
|
|
48
51
|
* Max width (css value) of the tooltip container (default is 300px)
|
|
49
52
|
*/
|
|
50
53
|
maxWidth?: string;
|
|
54
|
+
/**
|
|
55
|
+
* The container to insert the tooltip to (body by default)
|
|
56
|
+
*/
|
|
57
|
+
container?: "body" | HTMLElement;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the tooltip is shown on hover (default is true); otherwise, it is shown when hide is set to false
|
|
60
|
+
*/
|
|
61
|
+
hoverable?: boolean;
|
|
51
62
|
}>(),
|
|
52
63
|
{
|
|
53
64
|
openDelay: 100,
|
|
54
65
|
closeDelay: 1000,
|
|
55
66
|
gap: 8,
|
|
67
|
+
offsetToTheEdge: 8,
|
|
56
68
|
position: "top",
|
|
57
69
|
element: "div",
|
|
58
70
|
maxWidth: "300px",
|
|
71
|
+
container: "body",
|
|
72
|
+
hoverable: true,
|
|
59
73
|
},
|
|
60
74
|
);
|
|
61
75
|
|
|
@@ -80,8 +94,6 @@ watch(
|
|
|
80
94
|
|
|
81
95
|
let clearTimeout = () => {};
|
|
82
96
|
|
|
83
|
-
const dispatchAdjust = utils.throttle(() => window.dispatchEvent(new CustomEvent("adjust")), 1000);
|
|
84
|
-
|
|
85
97
|
const showTooltip = () => {
|
|
86
98
|
data.open = true;
|
|
87
99
|
|
|
@@ -98,12 +110,10 @@ const closeTooltip = () => {
|
|
|
98
110
|
};
|
|
99
111
|
|
|
100
112
|
const onOver = async () => {
|
|
101
|
-
if (props.hide) {
|
|
113
|
+
if (props.hide || !props.hoverable) {
|
|
102
114
|
return;
|
|
103
115
|
}
|
|
104
116
|
|
|
105
|
-
dispatchAdjust();
|
|
106
|
-
|
|
107
117
|
data.over = true;
|
|
108
118
|
|
|
109
119
|
clearTimeout();
|
|
@@ -116,6 +126,10 @@ const onOver = async () => {
|
|
|
116
126
|
};
|
|
117
127
|
|
|
118
128
|
const onLeave = () => {
|
|
129
|
+
if (!props.hoverable) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
119
133
|
data.over = false;
|
|
120
134
|
clearTimeout = utils.timeout(() => {
|
|
121
135
|
if (!data.over) {
|
|
@@ -129,6 +143,8 @@ watch(
|
|
|
129
143
|
(hide) => {
|
|
130
144
|
if (hide) {
|
|
131
145
|
closeTooltip();
|
|
146
|
+
} else if (!props.hoverable) {
|
|
147
|
+
showTooltip();
|
|
132
148
|
}
|
|
133
149
|
},
|
|
134
150
|
);
|
|
@@ -136,21 +152,17 @@ watch(
|
|
|
136
152
|
const rootRef = ref<HTMLElement | undefined>();
|
|
137
153
|
const tooltip = ref<HTMLElement | undefined>();
|
|
138
154
|
|
|
139
|
-
const style = useTooltipPosition(rootRef, toRef(props));
|
|
140
|
-
|
|
141
155
|
useClickOutside([rootRef, tooltip], () => closeTooltip());
|
|
142
156
|
|
|
143
|
-
const tooltipStyle = computed(() => ({
|
|
144
|
-
"--pl-tooltip-max-width": props.maxWidth,
|
|
145
|
-
}));
|
|
146
|
-
|
|
147
157
|
onUnmounted(() => {
|
|
148
158
|
tMap.delete(tKey);
|
|
149
159
|
});
|
|
160
|
+
const anchorName = `--anchor-${uniqueId()}`;
|
|
150
161
|
</script>
|
|
151
162
|
|
|
152
163
|
<template>
|
|
153
164
|
<component
|
|
165
|
+
:class="$style.plTooltipAnchorWrapper"
|
|
154
166
|
:is="element"
|
|
155
167
|
v-bind="$attrs"
|
|
156
168
|
ref="rootRef"
|
|
@@ -158,24 +170,207 @@ onUnmounted(() => {
|
|
|
158
170
|
@mouseover="onOver"
|
|
159
171
|
@mouseleave="onLeave"
|
|
160
172
|
>
|
|
173
|
+
<!-- anchor element here -->
|
|
161
174
|
<slot />
|
|
162
|
-
<
|
|
163
|
-
<
|
|
164
|
-
<div
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
175
|
+
<Transition name="pl-tooltip-fade">
|
|
176
|
+
<Teleport v-if="$slots['tooltip'] && data.tooltipOpen" :to="container">
|
|
177
|
+
<div
|
|
178
|
+
:class="[
|
|
179
|
+
$style.plTooltipContainer,
|
|
180
|
+
{
|
|
181
|
+
[$style.top]: props.position === 'top',
|
|
182
|
+
[$style.bottom]: props.position === 'bottom',
|
|
183
|
+
[$style.left]: props.position === 'left',
|
|
184
|
+
[$style.right]: props.position === 'right',
|
|
185
|
+
[$style.topLeft]: props.position === 'top-left',
|
|
186
|
+
},
|
|
187
|
+
]"
|
|
188
|
+
:style="{
|
|
189
|
+
'--anchorName': anchorName,
|
|
190
|
+
'--gap': gap + 'px',
|
|
191
|
+
'--offsetToTheEdge': offsetToTheEdge + 'px',
|
|
192
|
+
'--plTooltipMaxWidth': maxWidth,
|
|
193
|
+
}"
|
|
194
|
+
>
|
|
195
|
+
<div :class="$style.plTooltipBox" @click.stop>
|
|
196
|
+
<div
|
|
197
|
+
ref="tooltip"
|
|
198
|
+
:class="[$style.plTooltipContent, position]"
|
|
199
|
+
@mouseover="onOver"
|
|
200
|
+
@mouseleave="onLeave"
|
|
201
|
+
>
|
|
202
|
+
<!-- should be one line -->
|
|
203
|
+
<div><slot name="tooltip" /></div>
|
|
204
|
+
</div>
|
|
176
205
|
</div>
|
|
206
|
+
<div :class="$style.plTooltipBeak" />
|
|
177
207
|
</div>
|
|
178
|
-
</
|
|
179
|
-
</
|
|
208
|
+
</Teleport>
|
|
209
|
+
</Transition>
|
|
180
210
|
</component>
|
|
181
211
|
</template>
|
|
212
|
+
|
|
213
|
+
<style module>
|
|
214
|
+
.plTooltipAnchorWrapper {
|
|
215
|
+
display: inline-block;
|
|
216
|
+
}
|
|
217
|
+
/* just to set anchor-name for the anchor */
|
|
218
|
+
.plTooltipAnchorWrapper > :first-child {
|
|
219
|
+
--anchorName: v-bind("anchorName");
|
|
220
|
+
anchor-name: var(--anchorName);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.plTooltipAnchorWrapper:global(.info) {
|
|
224
|
+
--anchorName: v-bind("anchorName");
|
|
225
|
+
anchor-name: var(--anchorName);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.plTooltipContainer {
|
|
229
|
+
--plTooltipMaxWidth: 300px;
|
|
230
|
+
--gap: 8px;
|
|
231
|
+
--tailWidth: 8px;
|
|
232
|
+
--tailHeight: calc(var(--gap) + 2px);
|
|
233
|
+
|
|
234
|
+
--tailClipTop: polygon(
|
|
235
|
+
0 0,
|
|
236
|
+
100% 0,
|
|
237
|
+
100% calc(100% - var(--gap)),
|
|
238
|
+
50% calc(100% - 3px),
|
|
239
|
+
0 calc(100% - var(--gap))
|
|
240
|
+
);
|
|
241
|
+
--tailClipBottom: polygon(0 100%, 100% 100%, 100% var(--gap), 50% 3px, 0 var(--gap));
|
|
242
|
+
--tailClipLeft: polygon(0 0, 0 100%, 2px 100%, calc(100% - 3px) 50%, 2px 0);
|
|
243
|
+
--tailClipRight: polygon(100% 0, 100% 100%, calc(100% - 2px) 100%, 3px 50%, calc(100% - 2px) 0);
|
|
244
|
+
|
|
245
|
+
z-index: var(--z-tooltip);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.plTooltipContent {
|
|
249
|
+
display: inline-block;
|
|
250
|
+
padding: 8px 12px 9px 12px;
|
|
251
|
+
background: var(--tooltip-bg);
|
|
252
|
+
border-radius: 6px;
|
|
253
|
+
width: max-content;
|
|
254
|
+
word-break: normal;
|
|
255
|
+
max-width: var(--plTooltipMaxWidth);
|
|
256
|
+
color: #fff;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.plTooltipBox {
|
|
260
|
+
position: absolute;
|
|
261
|
+
position-anchor: var(--anchorName);
|
|
262
|
+
z-index: 1;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.plTooltipBeak {
|
|
266
|
+
position: absolute;
|
|
267
|
+
position-anchor: var(--anchorName);
|
|
268
|
+
z-index: 0;
|
|
269
|
+
background: var(--tooltip-bg);
|
|
270
|
+
width: var(--tailWidth);
|
|
271
|
+
height: var(--tailHeight);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/* top */
|
|
275
|
+
.plTooltipContainer.top .plTooltipBox {
|
|
276
|
+
position-area: top;
|
|
277
|
+
bottom: var(--gap);
|
|
278
|
+
left: var(--offsetToTheEdge);
|
|
279
|
+
right: var(--offsetToTheEdge);
|
|
280
|
+
}
|
|
281
|
+
.plTooltipContainer.top .plTooltipBeak {
|
|
282
|
+
position-area: top;
|
|
283
|
+
bottom: 0;
|
|
284
|
+
left: calc(anchor(var(--anchorName) center) - var(--tailWidth) / 2);
|
|
285
|
+
clip-path: var(--tailClipTop);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/* bottom */
|
|
289
|
+
.plTooltipContainer.bottom .plTooltipBox {
|
|
290
|
+
position-area: bottom;
|
|
291
|
+
top: var(--gap);
|
|
292
|
+
left: var(--offsetToTheEdge);
|
|
293
|
+
right: var(--offsetToTheEdge);
|
|
294
|
+
}
|
|
295
|
+
.plTooltipContainer.bottom .plTooltipBeak {
|
|
296
|
+
position-area: bottom;
|
|
297
|
+
top: 0;
|
|
298
|
+
left: calc(anchor(var(--anchorName) center) - var(--tailWidth) / 2);
|
|
299
|
+
clip-path: var(--tailClipBottom);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/* left */
|
|
303
|
+
.plTooltipContainer.left .plTooltipBox {
|
|
304
|
+
position-area: left;
|
|
305
|
+
right: var(--gap);
|
|
306
|
+
top: var(--offsetToTheEdge);
|
|
307
|
+
bottom: var(--offsetToTheEdge);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.plTooltipContainer.left .plTooltipBeak {
|
|
311
|
+
position-area: left;
|
|
312
|
+
right: 0;
|
|
313
|
+
top: calc(anchor(var(--anchorName) center) - var(--tailWidth) / 2);
|
|
314
|
+
width: var(--tailHeight);
|
|
315
|
+
height: var(--tailWidth);
|
|
316
|
+
clip-path: var(--tailClipLeft);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/* right */
|
|
320
|
+
.plTooltipContainer.right .plTooltipBox {
|
|
321
|
+
position-area: right;
|
|
322
|
+
left: var(--gap);
|
|
323
|
+
top: var(--offsetToTheEdge);
|
|
324
|
+
bottom: var(--offsetToTheEdge);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.plTooltipContainer.right .plTooltipBeak {
|
|
328
|
+
position-area: right;
|
|
329
|
+
left: 0;
|
|
330
|
+
top: calc(anchor(var(--anchorName) center) - var(--tailWidth) / 2);
|
|
331
|
+
width: var(--tailHeight);
|
|
332
|
+
height: var(--tailWidth);
|
|
333
|
+
clip-path: var(--tailClipRight);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/* top left */
|
|
337
|
+
.plTooltipContainer.topLeft .plTooltipBox {
|
|
338
|
+
position-area: top;
|
|
339
|
+
bottom: var(--gap);
|
|
340
|
+
left: anchor(var(--anchorName) left);
|
|
341
|
+
}
|
|
342
|
+
.plTooltipContainer.topLeft .plTooltipBeak {
|
|
343
|
+
position-area: top;
|
|
344
|
+
bottom: 0;
|
|
345
|
+
left: calc(anchor(var(--anchorName) center) - var(--tailWidth) / 2);
|
|
346
|
+
clip-path: var(--tailClipTop);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
:global(.pl-tooltip-fade-leave-active),
|
|
350
|
+
:global(.pl-tooltip-fade-enter-active) {
|
|
351
|
+
z-index: var(--z-tooltip);
|
|
352
|
+
transition: opacity 0.2s ease-in-out;
|
|
353
|
+
}
|
|
354
|
+
:global(.pl-tooltip-fade-enter-from),
|
|
355
|
+
:global(.pl-tooltip-fade-leave-to) {
|
|
356
|
+
opacity: 0;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.plTooltipContent a {
|
|
360
|
+
color: var(--tooltip-link-color);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.plTooltipContent p {
|
|
364
|
+
margin-bottom: 8px;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.plTooltipContent ul,
|
|
368
|
+
.plTooltipContent li {
|
|
369
|
+
margin-left: 6px;
|
|
370
|
+
padding-left: 6px;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.plTooltipContent li {
|
|
374
|
+
margin-bottom: 4px;
|
|
375
|
+
}
|
|
376
|
+
</style>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, SVGSVGElement>;
|
|
2
|
-
export default _default;
|
|
3
|
-
//# sourceMappingURL=Beak.vue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Beak.vue.d.ts","sourceRoot":"","sources":["../../../src/components/PlTooltip/Beak.vue"],"names":[],"mappings":";AA2DA,wBAMG"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { createElementBlock as t, openBlock as o, createElementVNode as n } from "vue";
|
|
2
|
-
import r from "../../_virtual/_plugin-vue_export-helper.js";
|
|
3
|
-
const l = {}, s = {
|
|
4
|
-
class: "beak",
|
|
5
|
-
width: "5",
|
|
6
|
-
height: "9",
|
|
7
|
-
viewBox: "0 0 3 8",
|
|
8
|
-
fill: "none",
|
|
9
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
10
|
-
};
|
|
11
|
-
function c(i, e) {
|
|
12
|
-
return o(), t("svg", s, [...e[0] || (e[0] = [
|
|
13
|
-
n("path", {
|
|
14
|
-
d: "M4.00222 8.00933L0 4.00711L4.00222 0.00488281L4.00222 8.00933Z",
|
|
15
|
-
fill: "#24223D"
|
|
16
|
-
}, null, -1)
|
|
17
|
-
])]);
|
|
18
|
-
}
|
|
19
|
-
const m = /* @__PURE__ */ r(l, [["render", c]]);
|
|
20
|
-
export {
|
|
21
|
-
m as default
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=Beak.vue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Beak.vue.js","sources":["../../../src/components/PlTooltip/Beak.vue"],"sourcesContent":["<template>\n <svg\n class=\"beak\"\n width=\"5\"\n height=\"9\"\n viewBox=\"0 0 3 8\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M4.00222 8.00933L0 4.00711L4.00222 0.00488281L4.00222 8.00933Z\" fill=\"#24223D\" />\n </svg>\n</template>\n"],"names":["_hoisted_1","_sfc_render","_ctx","_cache","_openBlock","_createElementBlock","_createElementVNode"],"mappings":";;cAEIA,IAAY;AAAA,EACZ,OAAM;AAAA,EACN;EACA;EACA,SAAK;AAAA,EACL;;;AANF,SAAAC,EAAAC,GAAAC,GAAA;SAQEC,EAAA,GAA0FC,EAAA,OAAAL,GAAA,CAAA,GAAAG,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA;AAAA,IAApFG,EAAE,QAAA;AAAA,MAAiE,GAAA;AAAA;;;;;"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Ref } from 'vue';
|
|
2
|
-
type Options = {
|
|
3
|
-
position: "top-left" | "right" | "left" | "top" | "southwest";
|
|
4
|
-
gap: number;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* A custom hook that calculates and returns the CSS style needed to position a tooltip
|
|
8
|
-
* relative to a target HTML element based on the specified position and gap.
|
|
9
|
-
*/
|
|
10
|
-
export declare function useTooltipPosition(el: Ref<HTMLElement | undefined>, optionsRef: Ref<Options>): import('vue').ComputedRef<string>;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=useTooltipPosition.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTooltipPosition.d.ts","sourceRoot":"","sources":["../../../src/components/PlTooltip/useTooltipPosition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,GAAG,EAAc,MAAM,KAAK,CAAC;AAIrD,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,WAAW,CAAC;IAC9D,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,GAAG,CAAC,WAAW,GAAG,SAAS,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,OAAO,CAAC,qCA6C5F"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ref as u, computed as h, unref as s } from "vue";
|
|
2
|
-
import { useElementPosition as x } from "../../composition/usePosition.js";
|
|
3
|
-
function d(r, n) {
|
|
4
|
-
const e = u();
|
|
5
|
-
return x(r, (t) => {
|
|
6
|
-
e.value = t;
|
|
7
|
-
}), h(() => {
|
|
8
|
-
const t = s(e), p = s(n), o = p.position ?? "top", f = p.gap ?? 8;
|
|
9
|
-
if (!t)
|
|
10
|
-
return "";
|
|
11
|
-
const i = t.offsetY + Math.floor(t.height / 2), l = t.offsetX + Math.floor(t.width / 2);
|
|
12
|
-
return o === "top-left" ? `left: ${t.offsetX}px; top: ${t.offsetY - f}px;` : o === "top" ? `left: ${l}px; top: ${t.offsetY - f}px;` : o === "right" ? `left: ${t.offsetX + t.width + f}px; top: ${i}px;` : o === "left" ? `right: ${t.scrollWidth - t.x + f}px; top: ${i}px;` : o === "southwest" ? `left: ${t.offsetX + t.width}px; top: ${t.offsetY + t.height + f}px;` : "";
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
export {
|
|
16
|
-
d as useTooltipPosition
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=useTooltipPosition.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTooltipPosition.js","sources":["../../../src/components/PlTooltip/useTooltipPosition.ts"],"sourcesContent":["import { computed, type Ref, ref, unref } from \"vue\";\nimport { useElementPosition } from \"../../composition/usePosition\";\nimport type { ElementPosition } from \"../../types\";\n\ntype Options = {\n position: \"top-left\" | \"right\" | \"left\" | \"top\" | \"southwest\";\n gap: number;\n};\n\n/**\n * A custom hook that calculates and returns the CSS style needed to position a tooltip\n * relative to a target HTML element based on the specified position and gap.\n */\nexport function useTooltipPosition(el: Ref<HTMLElement | undefined>, optionsRef: Ref<Options>) {\n const posRef = ref<ElementPosition>();\n\n useElementPosition(el, (v) => {\n posRef.value = v;\n });\n\n return computed(() => {\n const pos = unref(posRef);\n\n const options = unref(optionsRef);\n\n const position = options.position ?? \"top\";\n\n const gap = options.gap ?? 8;\n\n if (!pos) {\n return \"\";\n }\n\n const offsetMiddleY = pos.offsetY + Math.floor(pos.height / 2);\n const offsetMiddleX = pos.offsetX + Math.floor(pos.width / 2);\n\n if (position === \"top-left\") {\n return `left: ${pos.offsetX}px; top: ${pos.offsetY - gap}px;`;\n }\n\n if (position === \"top\") {\n return `left: ${offsetMiddleX}px; top: ${pos.offsetY - gap}px;`;\n }\n\n if (position === \"right\") {\n return `left: ${pos.offsetX + pos.width + gap}px; top: ${offsetMiddleY}px;`;\n }\n\n if (position === \"left\") {\n return `right: ${pos.scrollWidth - pos.x + gap}px; top: ${offsetMiddleY}px;`;\n }\n\n if (position === \"southwest\") {\n return `left: ${pos.offsetX + pos.width}px; top: ${pos.offsetY + pos.height + gap}px;`;\n }\n\n return \"\";\n });\n}\n"],"names":["useTooltipPosition","el","optionsRef","posRef","ref","useElementPosition","v","computed","pos","unref","options","position","gap","offsetMiddleY","offsetMiddleX"],"mappings":";;AAaO,SAASA,EAAmBC,GAAkCC,GAA0B;AAC7F,QAAMC,IAASC,EAAA;AAEf,SAAAC,EAAmBJ,GAAI,CAACK,MAAM;AAC5B,IAAAH,EAAO,QAAQG;AAAA,EACjB,CAAC,GAEMC,EAAS,MAAM;AACpB,UAAMC,IAAMC,EAAMN,CAAM,GAElBO,IAAUD,EAAMP,CAAU,GAE1BS,IAAWD,EAAQ,YAAY,OAE/BE,IAAMF,EAAQ,OAAO;AAE3B,QAAI,CAACF;AACH,aAAO;AAGT,UAAMK,IAAgBL,EAAI,UAAU,KAAK,MAAMA,EAAI,SAAS,CAAC,GACvDM,IAAgBN,EAAI,UAAU,KAAK,MAAMA,EAAI,QAAQ,CAAC;AAE5D,WAAIG,MAAa,aACR,SAASH,EAAI,OAAO,YAAYA,EAAI,UAAUI,CAAG,QAGtDD,MAAa,QACR,SAASG,CAAa,YAAYN,EAAI,UAAUI,CAAG,QAGxDD,MAAa,UACR,SAASH,EAAI,UAAUA,EAAI,QAAQI,CAAG,YAAYC,CAAa,QAGpEF,MAAa,SACR,UAAUH,EAAI,cAAcA,EAAI,IAAII,CAAG,YAAYC,CAAa,QAGrEF,MAAa,cACR,SAASH,EAAI,UAAUA,EAAI,KAAK,YAAYA,EAAI,UAAUA,EAAI,SAASI,CAAG,QAG5E;AAAA,EACT,CAAC;AACH;"}
|