@flyanra/vue-core 1.0.1 → 1.2.0
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/types/components/navigation/menu/fly-sidebar/FlySidebar.types.d.ts +14 -1
- package/dist/types/components/navigation/menu/fly-sidebar/FlySidebar.vue.d.ts +10 -4
- package/dist/types/composables/UseLocaleInjector.d.ts +7 -1
- package/dist/types/composables/index.d.ts +3 -1
- package/dist/types/composables/useSidebarActiveIndex.d.ts +66 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/package.json +158 -146
- package/src/components/basic/fly-button/FlyButton.types.ts +28 -28
- package/src/components/basic/fly-button/FlyButton.vue +178 -178
- package/src/components/basic/typography/FlyCollapseTitleRenderer.vue +46 -46
- package/src/components/feedback/tooltip/FlyInfoTooltip.vue +49 -49
- package/src/components/feedback/tooltip/FlyTooltip.element.scss +4 -4
- package/src/components/feedback/tooltip/FlyTooltip.vue +60 -60
- package/src/components/form/form.utils.ts +72 -72
- package/src/components/form/index.ts +6 -6
- package/src/components/form/input-renderers/boolean/FlyBoolean.vue +48 -48
- package/src/components/form/input-renderers/form-item-renderer/FlyFormItemRenderer.vue +48 -48
- package/src/components/form/input-renderers/form-item-renderer/index.ts +4 -4
- package/src/components/form/input-renderers/form-schema-renderer/FlyFormSchemaRenderer.types.ts +3 -3
- package/src/components/form/input-renderers/form-schema-renderer/FlyFormSchemaRenderer.utils.ts +221 -221
- package/src/components/form/input-renderers/form-schema-renderer/FlyFormSchemaRenderer.vue +75 -75
- package/src/components/form/input-renderers/form-schema-renderer/UseFormSchemaRenderer.ts +97 -97
- package/src/components/form/input-renderers/input-renderer/FlyInputRenderer.vue +49 -49
- package/src/components/form/input-renderers/input-renderer/index.ts +4 -4
- package/src/components/form/input-renderers/input-renderer.utils.ts +18 -18
- package/src/components/form/input-renderers/number/FlyNumber.vue +64 -64
- package/src/components/form/input-renderers/regional-tenant-form-renderer/FlyRegionalTenantFormRenderer.types.ts +15 -15
- package/src/components/form/input-renderers/regional-tenant-form-renderer/FlyRegionalTenantFormRenderer.vue +99 -99
- package/src/components/form/input-renderers/select/FlySelect.scss +1 -1
- package/src/components/form/input-renderers/select/FlySelect.utils.ts +37 -37
- package/src/components/form/input-renderers/text/FlyText.vue +70 -70
- package/src/components/form/input-renderers/value-unit/FlyValueUnit.vue +102 -102
- package/src/components/form/input-validators.ts +99 -99
- package/src/components/general/fly-icon-v2/FlyIconV2.types.ts +6 -6
- package/src/components/general/fly-icon-v2/FlyIconV2.vue +17 -17
- package/src/components/general/fly-icon-v2/index.ts +6 -6
- package/src/components/general/index.ts +5 -5
- package/src/components/index.ts +7 -7
- package/src/components/navigation/menu/fly-mini-sidebar/FlyMiniSidebar.types.ts +8 -8
- package/src/components/navigation/menu/fly-mini-sidebar/FlyMiniSidebarItem.vue +55 -55
- package/src/components/navigation/menu/fly-sidebar/FlySidebar.types.ts +49 -36
- package/src/components/navigation/menu/fly-sidebar/FlySidebar.vue +146 -151
- package/src/components/navigation/menu/fly-sidebar/FlySidebarNode.vue +47 -47
- package/src/composables/UseLocaleInjector.ts +37 -0
- package/src/composables/index.ts +4 -0
- package/src/composables/useSidebarActiveIndex.ts +103 -0
- package/src/styles/element/mixins/collapse.scss +61 -61
- package/src/styles/element/overrides/form.scss +121 -121
- package/src/styles/element/overrides/message-box.scss +2 -2
- package/src/styles/element/overrides/radio.scss +2 -2
- package/src/styles/element/overrides/select.scss +9 -9
- package/src/utils/index.ts +2 -0
- package/src/utils/pure-functions.ts +15 -0
- package/src/utils/validators.ts +81 -0
|
@@ -1,178 +1,178 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="fly-button" :class="[{ full }, appButtonClass]">
|
|
3
|
-
<FlyTooltip
|
|
4
|
-
:tooltip="{
|
|
5
|
-
// effect: 'dark',
|
|
6
|
-
content: title,
|
|
7
|
-
placement: tooltip?.placement ?? 'bottom',
|
|
8
|
-
disabled: !!tooltip?.disabled || isEmpty(title)
|
|
9
|
-
}"
|
|
10
|
-
>
|
|
11
|
-
<el-button
|
|
12
|
-
v-bind="additionalButtonBindingValues"
|
|
13
|
-
:class="[{ active, 'aspect-1': aspect1 }]"
|
|
14
|
-
@click="handleClick"
|
|
15
|
-
>
|
|
16
|
-
<FlyIconV2
|
|
17
|
-
v-if="icon && resolvedIconPosition === 'left'"
|
|
18
|
-
:icon="icon"
|
|
19
|
-
:class="[{ 'left-icon': slots.default }]"
|
|
20
|
-
/>
|
|
21
|
-
|
|
22
|
-
<slot></slot>
|
|
23
|
-
|
|
24
|
-
<FlyIconV2
|
|
25
|
-
v-if="icon && resolvedIconPosition === 'right'"
|
|
26
|
-
:icon="icon"
|
|
27
|
-
:class="[{ 'right-icon': slots.default }]"
|
|
28
|
-
/>
|
|
29
|
-
|
|
30
|
-
<span v-if="imageUrl" class="btn-image" :class="[{ 'clip-round': clipRound }]">
|
|
31
|
-
<img :src="imageUrl" />
|
|
32
|
-
</span>
|
|
33
|
-
</el-button>
|
|
34
|
-
</FlyTooltip>
|
|
35
|
-
</div>
|
|
36
|
-
</template>
|
|
37
|
-
|
|
38
|
-
<script lang="ts" setup>
|
|
39
|
-
import { computed, useAttrs, useSlots } from 'vue'
|
|
40
|
-
|
|
41
|
-
import { ElButton } from 'element-plus'
|
|
42
|
-
|
|
43
|
-
import { isEmpty } from 'lodash-es'
|
|
44
|
-
|
|
45
|
-
import FlyTooltip from '../../feedback/tooltip/FlyTooltip.vue'
|
|
46
|
-
import FlyIconV2 from '../../general/fly-icon-v2/FlyIconV2.vue'
|
|
47
|
-
|
|
48
|
-
import './FlyButton.element.scss'
|
|
49
|
-
import type { FlyButtonIconPosition, FlyButtonProps } from './FlyButton.types'
|
|
50
|
-
|
|
51
|
-
const attrs = useAttrs()
|
|
52
|
-
const slots = useSlots()
|
|
53
|
-
const emit = defineEmits(['click'])
|
|
54
|
-
|
|
55
|
-
defineOptions({
|
|
56
|
-
inheritAttrs: false
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
const props = withDefaults(defineProps<FlyButtonProps>(), {
|
|
60
|
-
active: false,
|
|
61
|
-
aspect1: false,
|
|
62
|
-
clipRound: false,
|
|
63
|
-
full: false,
|
|
64
|
-
stop: false,
|
|
65
|
-
tooltip: () => ({
|
|
66
|
-
placement: 'bottom',
|
|
67
|
-
disabled: false
|
|
68
|
-
})
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
const additionalButtonBindingValues = computed(() => {
|
|
72
|
-
const { type, size } = props
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
...attrs,
|
|
76
|
-
size,
|
|
77
|
-
type
|
|
78
|
-
} as object
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
const resolvedIconPosition = computed<FlyButtonIconPosition>(() => props.iconPosition || 'left')
|
|
82
|
-
|
|
83
|
-
function handleClick(e: MouseEvent) {
|
|
84
|
-
/**
|
|
85
|
-
* Stop the event propagation if the stop prop is set to true
|
|
86
|
-
*/
|
|
87
|
-
if (props.stop) {
|
|
88
|
-
e.stopPropagation()
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
emit('click', e)
|
|
92
|
-
}
|
|
93
|
-
</script>
|
|
94
|
-
|
|
95
|
-
<style lang="scss" scoped>
|
|
96
|
-
.fly-button {
|
|
97
|
-
pointer-events: auto;
|
|
98
|
-
|
|
99
|
-
&.full button {
|
|
100
|
-
width: 100%;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
:deep(.el-button) {
|
|
104
|
-
&.active {
|
|
105
|
-
/* 1px ring stile */
|
|
106
|
-
box-shadow: 0 0 0 1px var(--anra-white);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.fly-icon {
|
|
110
|
-
svg {
|
|
111
|
-
width: calc(1em + 2px);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
:deep(.fly-icon.left-icon) {
|
|
117
|
-
padding-inline-end: 0.25rem;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
:deep(.fly-icon.right-icon) {
|
|
121
|
-
padding-inline-start: 0.25rem;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.btn-image {
|
|
125
|
-
display: flex;
|
|
126
|
-
align-items: center;
|
|
127
|
-
justify-content: center;
|
|
128
|
-
position: absolute;
|
|
129
|
-
top: 0;
|
|
130
|
-
left: 0;
|
|
131
|
-
right: 0;
|
|
132
|
-
bottom: 0;
|
|
133
|
-
|
|
134
|
-
&.clip-round {
|
|
135
|
-
-webkit-box-align: stretch;
|
|
136
|
-
align-items: stretch;
|
|
137
|
-
border-radius: 50%;
|
|
138
|
-
box-sizing: content-box;
|
|
139
|
-
display: flex;
|
|
140
|
-
flex-direction: column;
|
|
141
|
-
-webkit-box-pack: center;
|
|
142
|
-
justify-content: center;
|
|
143
|
-
overflow: hidden;
|
|
144
|
-
|
|
145
|
-
img {
|
|
146
|
-
border: 5px solid transparent;
|
|
147
|
-
border-radius: 50%;
|
|
148
|
-
display: flex;
|
|
149
|
-
width: 100%;
|
|
150
|
-
height: 100%;
|
|
151
|
-
flex: 1 1 100%;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
</style>
|
|
157
|
-
|
|
158
|
-
<style lang="scss">
|
|
159
|
-
@use './FlyButton.mixins.scss' as button;
|
|
160
|
-
|
|
161
|
-
.el-button-group {
|
|
162
|
-
display: flex;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
html.dark {
|
|
166
|
-
button.el-button {
|
|
167
|
-
@include button.fly-button-overrides-dark;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
button.el-button {
|
|
172
|
-
position: relative;
|
|
173
|
-
overflow: hidden;
|
|
174
|
-
transition: 0.1s;
|
|
175
|
-
text-wrap: balance;
|
|
176
|
-
@include button.fly-button-overrides;
|
|
177
|
-
}
|
|
178
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="fly-button" :class="[{ full }, appButtonClass]">
|
|
3
|
+
<FlyTooltip
|
|
4
|
+
:tooltip="{
|
|
5
|
+
// effect: 'dark',
|
|
6
|
+
content: title,
|
|
7
|
+
placement: tooltip?.placement ?? 'bottom',
|
|
8
|
+
disabled: !!tooltip?.disabled || isEmpty(title)
|
|
9
|
+
}"
|
|
10
|
+
>
|
|
11
|
+
<el-button
|
|
12
|
+
v-bind="additionalButtonBindingValues"
|
|
13
|
+
:class="[{ active, 'aspect-1': aspect1 }]"
|
|
14
|
+
@click="handleClick"
|
|
15
|
+
>
|
|
16
|
+
<FlyIconV2
|
|
17
|
+
v-if="icon && resolvedIconPosition === 'left'"
|
|
18
|
+
:icon="icon"
|
|
19
|
+
:class="[{ 'left-icon': slots.default }]"
|
|
20
|
+
/>
|
|
21
|
+
|
|
22
|
+
<slot></slot>
|
|
23
|
+
|
|
24
|
+
<FlyIconV2
|
|
25
|
+
v-if="icon && resolvedIconPosition === 'right'"
|
|
26
|
+
:icon="icon"
|
|
27
|
+
:class="[{ 'right-icon': slots.default }]"
|
|
28
|
+
/>
|
|
29
|
+
|
|
30
|
+
<span v-if="imageUrl" class="btn-image" :class="[{ 'clip-round': clipRound }]">
|
|
31
|
+
<img :src="imageUrl" />
|
|
32
|
+
</span>
|
|
33
|
+
</el-button>
|
|
34
|
+
</FlyTooltip>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script lang="ts" setup>
|
|
39
|
+
import { computed, useAttrs, useSlots } from 'vue'
|
|
40
|
+
|
|
41
|
+
import { ElButton } from 'element-plus'
|
|
42
|
+
|
|
43
|
+
import { isEmpty } from 'lodash-es'
|
|
44
|
+
|
|
45
|
+
import FlyTooltip from '../../feedback/tooltip/FlyTooltip.vue'
|
|
46
|
+
import FlyIconV2 from '../../general/fly-icon-v2/FlyIconV2.vue'
|
|
47
|
+
|
|
48
|
+
import './FlyButton.element.scss'
|
|
49
|
+
import type { FlyButtonIconPosition, FlyButtonProps } from './FlyButton.types'
|
|
50
|
+
|
|
51
|
+
const attrs = useAttrs()
|
|
52
|
+
const slots = useSlots()
|
|
53
|
+
const emit = defineEmits(['click'])
|
|
54
|
+
|
|
55
|
+
defineOptions({
|
|
56
|
+
inheritAttrs: false
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const props = withDefaults(defineProps<FlyButtonProps>(), {
|
|
60
|
+
active: false,
|
|
61
|
+
aspect1: false,
|
|
62
|
+
clipRound: false,
|
|
63
|
+
full: false,
|
|
64
|
+
stop: false,
|
|
65
|
+
tooltip: () => ({
|
|
66
|
+
placement: 'bottom',
|
|
67
|
+
disabled: false
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
const additionalButtonBindingValues = computed(() => {
|
|
72
|
+
const { type, size } = props
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
...attrs,
|
|
76
|
+
size,
|
|
77
|
+
type
|
|
78
|
+
} as object
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
const resolvedIconPosition = computed<FlyButtonIconPosition>(() => props.iconPosition || 'left')
|
|
82
|
+
|
|
83
|
+
function handleClick(e: MouseEvent) {
|
|
84
|
+
/**
|
|
85
|
+
* Stop the event propagation if the stop prop is set to true
|
|
86
|
+
*/
|
|
87
|
+
if (props.stop) {
|
|
88
|
+
e.stopPropagation()
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
emit('click', e)
|
|
92
|
+
}
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<style lang="scss" scoped>
|
|
96
|
+
.fly-button {
|
|
97
|
+
pointer-events: auto;
|
|
98
|
+
|
|
99
|
+
&.full button {
|
|
100
|
+
width: 100%;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
:deep(.el-button) {
|
|
104
|
+
&.active {
|
|
105
|
+
/* 1px ring stile */
|
|
106
|
+
box-shadow: 0 0 0 1px var(--anra-white);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.fly-icon {
|
|
110
|
+
svg {
|
|
111
|
+
width: calc(1em + 2px);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
:deep(.fly-icon.left-icon) {
|
|
117
|
+
padding-inline-end: 0.25rem;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
:deep(.fly-icon.right-icon) {
|
|
121
|
+
padding-inline-start: 0.25rem;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.btn-image {
|
|
125
|
+
display: flex;
|
|
126
|
+
align-items: center;
|
|
127
|
+
justify-content: center;
|
|
128
|
+
position: absolute;
|
|
129
|
+
top: 0;
|
|
130
|
+
left: 0;
|
|
131
|
+
right: 0;
|
|
132
|
+
bottom: 0;
|
|
133
|
+
|
|
134
|
+
&.clip-round {
|
|
135
|
+
-webkit-box-align: stretch;
|
|
136
|
+
align-items: stretch;
|
|
137
|
+
border-radius: 50%;
|
|
138
|
+
box-sizing: content-box;
|
|
139
|
+
display: flex;
|
|
140
|
+
flex-direction: column;
|
|
141
|
+
-webkit-box-pack: center;
|
|
142
|
+
justify-content: center;
|
|
143
|
+
overflow: hidden;
|
|
144
|
+
|
|
145
|
+
img {
|
|
146
|
+
border: 5px solid transparent;
|
|
147
|
+
border-radius: 50%;
|
|
148
|
+
display: flex;
|
|
149
|
+
width: 100%;
|
|
150
|
+
height: 100%;
|
|
151
|
+
flex: 1 1 100%;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
</style>
|
|
157
|
+
|
|
158
|
+
<style lang="scss">
|
|
159
|
+
@use './FlyButton.mixins.scss' as button;
|
|
160
|
+
|
|
161
|
+
.el-button-group {
|
|
162
|
+
display: flex;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
html.dark {
|
|
166
|
+
button.el-button {
|
|
167
|
+
@include button.fly-button-overrides-dark;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
button.el-button {
|
|
172
|
+
position: relative;
|
|
173
|
+
overflow: hidden;
|
|
174
|
+
transition: 0.1s;
|
|
175
|
+
text-wrap: balance;
|
|
176
|
+
@include button.fly-button-overrides;
|
|
177
|
+
}
|
|
178
|
+
</style>
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="fly-collapse-title-renderer">
|
|
3
|
-
<div class="fly-collapse-title-renderer__inner">
|
|
4
|
-
<p class="fly-collapse-title-renderer__title">
|
|
5
|
-
{{ t(title) }}
|
|
6
|
-
</p>
|
|
7
|
-
|
|
8
|
-
<slot></slot>
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script lang="ts" setup>
|
|
14
|
-
import { UseLocaleInjector } from '../../../composables/UseLocaleInjector'
|
|
15
|
-
|
|
16
|
-
defineProps<{
|
|
17
|
-
title: string
|
|
18
|
-
}>()
|
|
19
|
-
|
|
20
|
-
const { t } = UseLocaleInjector()
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<style lang="scss" scoped>
|
|
24
|
-
.fly-collapse-title-renderer {
|
|
25
|
-
display: flex;
|
|
26
|
-
gap: 0.25rem;
|
|
27
|
-
align-items: center;
|
|
28
|
-
text-align: left;
|
|
29
|
-
flex-grow: 1;
|
|
30
|
-
|
|
31
|
-
&__inner {
|
|
32
|
-
display: flex;
|
|
33
|
-
padding-left: 0.5rem;
|
|
34
|
-
padding-right: 0.5rem;
|
|
35
|
-
flex-grow: 1;
|
|
36
|
-
align-items: center;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
&__title {
|
|
40
|
-
font-size: 0.875rem;
|
|
41
|
-
line-height: 1.25rem;
|
|
42
|
-
font-weight: 500;
|
|
43
|
-
flex-grow: 1;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="fly-collapse-title-renderer">
|
|
3
|
+
<div class="fly-collapse-title-renderer__inner">
|
|
4
|
+
<p class="fly-collapse-title-renderer__title">
|
|
5
|
+
{{ t(title) }}
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<slot></slot>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script lang="ts" setup>
|
|
14
|
+
import { UseLocaleInjector } from '../../../composables/UseLocaleInjector'
|
|
15
|
+
|
|
16
|
+
defineProps<{
|
|
17
|
+
title: string
|
|
18
|
+
}>()
|
|
19
|
+
|
|
20
|
+
const { t } = UseLocaleInjector()
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<style lang="scss" scoped>
|
|
24
|
+
.fly-collapse-title-renderer {
|
|
25
|
+
display: flex;
|
|
26
|
+
gap: 0.25rem;
|
|
27
|
+
align-items: center;
|
|
28
|
+
text-align: left;
|
|
29
|
+
flex-grow: 1;
|
|
30
|
+
|
|
31
|
+
&__inner {
|
|
32
|
+
display: flex;
|
|
33
|
+
padding-left: 0.5rem;
|
|
34
|
+
padding-right: 0.5rem;
|
|
35
|
+
flex-grow: 1;
|
|
36
|
+
align-items: center;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&__title {
|
|
40
|
+
font-size: 0.875rem;
|
|
41
|
+
line-height: 1.25rem;
|
|
42
|
+
font-weight: 500;
|
|
43
|
+
flex-grow: 1;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span class="fly-info-tooltip">
|
|
3
|
-
<FlyTooltip
|
|
4
|
-
v-if="content"
|
|
5
|
-
:tooltip="{
|
|
6
|
-
content: DOMPurify.sanitize(content)
|
|
7
|
-
}"
|
|
8
|
-
>
|
|
9
|
-
<slot name="trigger">
|
|
10
|
-
<FlyIcon class="tw-cursor-pointer" :icon="mdiInformationSlabBoxOutline" />
|
|
11
|
-
</slot>
|
|
12
|
-
<template #content>
|
|
13
|
-
<!-- eslint-disable-next-line vue/no-v-html -->
|
|
14
|
-
<div v-if="html" v-html="DOMPurify.sanitize(content)"></div>
|
|
15
|
-
<slot v-else></slot>
|
|
16
|
-
</template>
|
|
17
|
-
</FlyTooltip>
|
|
18
|
-
</span>
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
|
-
<script setup lang="ts">
|
|
22
|
-
import { mdiInformationSlabBoxOutline } from '@mdi/js'
|
|
23
|
-
import DOMPurify from 'dompurify'
|
|
24
|
-
|
|
25
|
-
import FlyIcon from '../../general/fly-icon/FlyIcon.vue'
|
|
26
|
-
|
|
27
|
-
import FlyTooltip from './FlyTooltip.vue'
|
|
28
|
-
|
|
29
|
-
defineProps({
|
|
30
|
-
content: {
|
|
31
|
-
type: String,
|
|
32
|
-
default: ''
|
|
33
|
-
},
|
|
34
|
-
html: {
|
|
35
|
-
type: Boolean,
|
|
36
|
-
default: false
|
|
37
|
-
}
|
|
38
|
-
})
|
|
39
|
-
</script>
|
|
40
|
-
|
|
41
|
-
<style lang="scss" scoped>
|
|
42
|
-
.fly-info-tooltip {
|
|
43
|
-
:deep(.app-icon) {
|
|
44
|
-
svg {
|
|
45
|
-
display: inline;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<span class="fly-info-tooltip">
|
|
3
|
+
<FlyTooltip
|
|
4
|
+
v-if="content"
|
|
5
|
+
:tooltip="{
|
|
6
|
+
content: DOMPurify.sanitize(content)
|
|
7
|
+
}"
|
|
8
|
+
>
|
|
9
|
+
<slot name="trigger">
|
|
10
|
+
<FlyIcon class="tw-cursor-pointer" :icon="mdiInformationSlabBoxOutline" />
|
|
11
|
+
</slot>
|
|
12
|
+
<template #content>
|
|
13
|
+
<!-- eslint-disable-next-line vue/no-v-html -->
|
|
14
|
+
<div v-if="html" v-html="DOMPurify.sanitize(content)"></div>
|
|
15
|
+
<slot v-else></slot>
|
|
16
|
+
</template>
|
|
17
|
+
</FlyTooltip>
|
|
18
|
+
</span>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup lang="ts">
|
|
22
|
+
import { mdiInformationSlabBoxOutline } from '@mdi/js'
|
|
23
|
+
import DOMPurify from 'dompurify'
|
|
24
|
+
|
|
25
|
+
import FlyIcon from '../../general/fly-icon/FlyIcon.vue'
|
|
26
|
+
|
|
27
|
+
import FlyTooltip from './FlyTooltip.vue'
|
|
28
|
+
|
|
29
|
+
defineProps({
|
|
30
|
+
content: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: ''
|
|
33
|
+
},
|
|
34
|
+
html: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<style lang="scss" scoped>
|
|
42
|
+
.fly-info-tooltip {
|
|
43
|
+
:deep(.app-icon) {
|
|
44
|
+
svg {
|
|
45
|
+
display: inline;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
</style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@use '../../../styles//element/common.scss' as *;
|
|
2
|
-
|
|
3
|
-
@use 'element-plus/theme-chalk/src/popper.scss' as *;
|
|
4
|
-
@use 'element-plus/theme-chalk/src/tooltip.scss' as *;
|
|
1
|
+
@use '../../../styles//element/common.scss' as *;
|
|
2
|
+
|
|
3
|
+
@use 'element-plus/theme-chalk/src/popper.scss' as *;
|
|
4
|
+
@use 'element-plus/theme-chalk/src/tooltip.scss' as *;
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-tooltip
|
|
3
|
-
v-bind="mergedElProps"
|
|
4
|
-
:popper-class="`fly-tooltip-popper ${popperClasses}`"
|
|
5
|
-
class="fly-tooltip"
|
|
6
|
-
>
|
|
7
|
-
<template v-if="$slots.default">
|
|
8
|
-
<slot></slot>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
|
-
<template v-if="$slots.content" #content>
|
|
12
|
-
<slot name="content"></slot>
|
|
13
|
-
</template>
|
|
14
|
-
</el-tooltip>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<script lang="ts" setup>
|
|
18
|
-
import { computed } from 'vue'
|
|
19
|
-
|
|
20
|
-
import { ElTooltip, type UseTooltipProps } from 'element-plus'
|
|
21
|
-
|
|
22
|
-
import './FlyTooltip.element.scss'
|
|
23
|
-
import type { T_FlyTooltipProps } from './FlyTooltip.types'
|
|
24
|
-
|
|
25
|
-
const props = defineProps<T_FlyTooltipProps>()
|
|
26
|
-
|
|
27
|
-
const mergedElProps = computed<UseTooltipProps>(() => {
|
|
28
|
-
return {
|
|
29
|
-
enterable: false,
|
|
30
|
-
showAfter: 1000,
|
|
31
|
-
...props.tooltip
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
const popperClasses = computed(() => {
|
|
36
|
-
const classes = []
|
|
37
|
-
|
|
38
|
-
if (!mergedElProps.value.enterable) {
|
|
39
|
-
classes.push('fly-tooltip-popper__no-enter')
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return classes.join(' ')
|
|
43
|
-
})
|
|
44
|
-
</script>
|
|
45
|
-
|
|
46
|
-
<style lang="scss">
|
|
47
|
-
@use '../../../styles/mixins/shadows.scss' as shadow;
|
|
48
|
-
|
|
49
|
-
.fly-tooltip-popper {
|
|
50
|
-
@include shadow.shadow-lg;
|
|
51
|
-
max-width: 400px;
|
|
52
|
-
|
|
53
|
-
&__no-enter {
|
|
54
|
-
.fly-tooltip {
|
|
55
|
-
pointer-events: none;
|
|
56
|
-
max-width: 400px;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<el-tooltip
|
|
3
|
+
v-bind="mergedElProps"
|
|
4
|
+
:popper-class="`fly-tooltip-popper ${popperClasses}`"
|
|
5
|
+
class="fly-tooltip"
|
|
6
|
+
>
|
|
7
|
+
<template v-if="$slots.default">
|
|
8
|
+
<slot></slot>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<template v-if="$slots.content" #content>
|
|
12
|
+
<slot name="content"></slot>
|
|
13
|
+
</template>
|
|
14
|
+
</el-tooltip>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script lang="ts" setup>
|
|
18
|
+
import { computed } from 'vue'
|
|
19
|
+
|
|
20
|
+
import { ElTooltip, type UseTooltipProps } from 'element-plus'
|
|
21
|
+
|
|
22
|
+
import './FlyTooltip.element.scss'
|
|
23
|
+
import type { T_FlyTooltipProps } from './FlyTooltip.types'
|
|
24
|
+
|
|
25
|
+
const props = defineProps<T_FlyTooltipProps>()
|
|
26
|
+
|
|
27
|
+
const mergedElProps = computed<UseTooltipProps>(() => {
|
|
28
|
+
return {
|
|
29
|
+
enterable: false,
|
|
30
|
+
showAfter: 1000,
|
|
31
|
+
...props.tooltip
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const popperClasses = computed(() => {
|
|
36
|
+
const classes = []
|
|
37
|
+
|
|
38
|
+
if (!mergedElProps.value.enterable) {
|
|
39
|
+
classes.push('fly-tooltip-popper__no-enter')
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return classes.join(' ')
|
|
43
|
+
})
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<style lang="scss">
|
|
47
|
+
@use '../../../styles/mixins/shadows.scss' as shadow;
|
|
48
|
+
|
|
49
|
+
.fly-tooltip-popper {
|
|
50
|
+
@include shadow.shadow-lg;
|
|
51
|
+
max-width: 400px;
|
|
52
|
+
|
|
53
|
+
&__no-enter {
|
|
54
|
+
.fly-tooltip {
|
|
55
|
+
pointer-events: none;
|
|
56
|
+
max-width: 400px;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
</style>
|