@pocketprep/ui-kit 3.1.3 → 3.1.5
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/@pocketprep/ui-kit.js +87 -72
- package/dist/@pocketprep/ui-kit.js.map +1 -1
- package/dist/@pocketprep/ui-kit.umd.cjs +1 -1
- package/dist/@pocketprep/ui-kit.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/lib/components/Controls/SegmentControl.vue +6 -2
- package/lib/components/Tooltips/OverflowTooltip.vue +30 -13
- package/package.json +1 -1
|
@@ -33,9 +33,9 @@ import { Component, Vue, Prop, Emit } from 'vue-facing-decorator'
|
|
|
33
33
|
export default class SegmentControl extends Vue {
|
|
34
34
|
@Prop({ default: 'Option 1' }) option1!: string
|
|
35
35
|
@Prop({ default: 'Option 2' }) option2!: string
|
|
36
|
-
@Prop({ default: 1 }) defaultOption!:
|
|
36
|
+
@Prop({ default: 1 }) defaultOption!: number
|
|
37
37
|
|
|
38
|
-
activeOption =
|
|
38
|
+
activeOption = 1
|
|
39
39
|
|
|
40
40
|
@Emit('change')
|
|
41
41
|
toggleOption () {
|
|
@@ -48,6 +48,10 @@ export default class SegmentControl extends Vue {
|
|
|
48
48
|
this.activeOption = option
|
|
49
49
|
return option
|
|
50
50
|
}
|
|
51
|
+
|
|
52
|
+
created () {
|
|
53
|
+
this.activeOption = this.defaultOption
|
|
54
|
+
}
|
|
51
55
|
}
|
|
52
56
|
</script>
|
|
53
57
|
|
|
@@ -7,14 +7,23 @@
|
|
|
7
7
|
>
|
|
8
8
|
<slot />
|
|
9
9
|
</Tooltip>
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
<template v-if="id">
|
|
11
|
+
<div
|
|
12
|
+
:ref="`content_${id}`"
|
|
13
|
+
class="uikit-overflow-tooltip__content"
|
|
14
|
+
@mouseenter="showTooltip = true"
|
|
15
|
+
@mouseleave="showTooltip = false"
|
|
16
|
+
>
|
|
17
|
+
<slot />
|
|
18
|
+
</div>
|
|
19
|
+
<div
|
|
20
|
+
v-if="!measurementComplete"
|
|
21
|
+
:ref="`content_fullwidth_${id}`"
|
|
22
|
+
class="uikit-overflow-tooltip__content uikit-overflow-tooltip__content--full-width"
|
|
23
|
+
>
|
|
24
|
+
<slot />
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
18
27
|
</div>
|
|
19
28
|
</template>
|
|
20
29
|
|
|
@@ -30,16 +39,20 @@ import Tooltip from '../Tooltips/Tooltip.vue'
|
|
|
30
39
|
export default class OverflowTooltip extends Vue {
|
|
31
40
|
showTooltip = false
|
|
32
41
|
textOverflows = false
|
|
42
|
+
measurementComplete = false
|
|
43
|
+
id: string | null = null
|
|
44
|
+
created () {
|
|
45
|
+
this.id = (this as unknown as { _uid: string })._uid
|
|
46
|
+
}
|
|
33
47
|
|
|
34
48
|
mounted () {
|
|
35
|
-
const content = this.$refs[
|
|
36
|
-
|
|
49
|
+
const content = this.$refs[`content_${this.id}`] as HTMLElement
|
|
50
|
+
const contentFullWidth = this.$refs[`content_fullwidth_${this.id}`] as HTMLElement
|
|
37
51
|
this.$nextTick(() => {
|
|
38
52
|
const truncatedWidth = content.getBoundingClientRect().width
|
|
39
|
-
|
|
40
|
-
const fullWidth = content.getBoundingClientRect().width
|
|
41
|
-
content.style.display = 'block'
|
|
53
|
+
const fullWidth = contentFullWidth.getBoundingClientRect().width
|
|
42
54
|
this.textOverflows = truncatedWidth < fullWidth
|
|
55
|
+
this.measurementComplete = true
|
|
43
56
|
})
|
|
44
57
|
}
|
|
45
58
|
}
|
|
@@ -57,6 +70,10 @@ export default class OverflowTooltip extends Vue {
|
|
|
57
70
|
overflow: hidden;
|
|
58
71
|
text-overflow: ellipsis;
|
|
59
72
|
white-space: nowrap;
|
|
73
|
+
|
|
74
|
+
&--full-width {
|
|
75
|
+
display: inline;
|
|
76
|
+
}
|
|
60
77
|
}
|
|
61
78
|
|
|
62
79
|
&__tooltip {
|