@policystudio/policy-studio-ui-vue 1.1.90-beta.12 → 1.1.90-beta.18
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.js +2 -1
- package/.github/workflows/deploy-storybook.yml +4 -4
- package/.nvmrc +1 -0
- package/dist/css/psui_styles_output.css +6986 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +53 -63
- package/dist/index.js.map +1 -1
- package/dist/util/GeneralFunctions.d.ts +3 -0
- package/dist/util/GeneralFunctions.js.map +1 -1
- package/dist/util/directives.d.ts +1 -0
- package/dist/util/directives.js +22 -0
- package/dist/util/directives.js.map +1 -0
- package/dist/util/eventBus.d.ts +7 -0
- package/dist/util/eventBus.js +8 -0
- package/dist/util/eventBus.js.map +1 -0
- package/dist/util/imageLoader.d.ts +6 -0
- package/dist/util/imageLoader.js.map +1 -1
- package/package.json +9 -23
- package/src/assets/scss/components/PsDataTable.scss +1 -1
- package/src/components/accordion/PsAccordionItem.vue +75 -75
- package/src/components/badges-and-tags/PsBadgeWithIcon.vue +31 -34
- package/src/components/badges-and-tags/PsCardInfos.vue +40 -41
- package/src/components/badges-and-tags/PsChartLegend.vue +47 -51
- package/src/components/badges-and-tags/PsClimateZoneBadge.vue +14 -19
- package/src/components/badges-and-tags/PsCostEffectBar.vue +24 -56
- package/src/components/badges-and-tags/PsDateCardInfo.vue +17 -18
- package/src/components/badges-and-tags/PsHighlightRippleDot.vue +3 -2
- package/src/components/badges-and-tags/PsMiniTag.vue +39 -41
- package/src/components/badges-and-tags/PsProgressBar.vue +72 -68
- package/src/components/badges-and-tags/PsTagScope.vue +17 -22
- package/src/components/badges-and-tags/PsTestimonialCard.vue +20 -26
- package/src/components/buttons/PsButton.vue +61 -62
- package/src/components/chips/PsChips.vue +98 -101
- package/src/components/controls/PsCheckbox.vue +84 -84
- package/src/components/controls/PsCheckboxSimple.vue +95 -95
- package/src/components/controls/PsDraggable.vue +53 -55
- package/src/components/controls/PsInlineSelector.vue +99 -99
- package/src/components/controls/PsRadioButton.vue +59 -58
- package/src/components/controls/PsRadioButtonSimple.vue +79 -75
- package/src/components/controls/PsSlider.vue +185 -176
- package/src/components/controls/PsSwitch.vue +51 -52
- package/src/components/controls/PsToggle.vue +53 -50
- package/src/components/data-graphics/PsBarChart.vue +19 -21
- package/src/components/datatable/PsDataTable.vue +56 -60
- package/src/components/datatable/PsDataTableItem.vue +14 -28
- package/src/components/forms/PsDropdown.vue +164 -162
- package/src/components/forms/PsDropdownList.vue +132 -129
- package/src/components/forms/PsInput.vue +155 -153
- package/src/components/forms/PsInputSelect.vue +91 -92
- package/src/components/forms/PsInputTextArea.vue +71 -71
- package/src/components/navigations/PsBreadcrumb.vue +26 -34
- package/src/components/notifications/PsDialog.vue +57 -56
- package/src/components/notifications/PsSimpleAlert.vue +28 -29
- package/src/components/notifications/PsToast.vue +40 -39
- package/src/components/table-results/PsTableResults.vue +452 -458
- package/src/components/table-results/PsTableResultsBody.vue +66 -67
- package/src/components/table-results/PsTableResultsHead.vue +62 -56
- package/src/components/table-results/PsTableResultsHeadComparison.vue +62 -56
- package/src/components/table-results/PsTableResultsHeadFlexible.vue +63 -56
- package/src/components/table-results/PsTableResultsRow.vue +55 -56
- package/src/components/tabs/PsTabHeader.vue +106 -100
- package/src/components/tooltip/PsDialogTooltip.vue +96 -101
- package/src/components/tooltip/PsRichTooltip.vue +42 -45
- package/src/components/tooltip/PsTooltip.vue +111 -116
- package/src/components/ui/PsDotLoader.vue +1 -5
- package/src/components/ui/PsIcon.vue +126 -129
- package/src/index.ts +57 -71
- package/src/tsconfig.json +12 -0
- package/src/{shims-vue.d.ts → types/index.d.ts} +0 -5
- package/src/util/{GeneralFunctions.ts → GeneralFunctions.js} +0 -3
- package/src/util/directives.ts +24 -0
- package/src/util/eventBus.js +10 -0
- package/src/util/{imageLoader.ts → imageLoader.js} +7 -8
- package/tailwind.config.js +1 -1
- package/tsconfig.json +15 -17
- package/.storybook/PolicyStudio.ts +0 -11
- package/.storybook/eventBus.ts +0 -26
- package/.storybook/main.ts +0 -21
- package/.storybook/manager.ts +0 -7
- package/.storybook/preview.ts +0 -17
- package/dist/contents/ComparisonData.js +0 -376
- package/dist/contents/ComparisonData.js.map +0 -1
- package/dist/contents/FlexibleData.js +0 -501
- package/dist/contents/FlexibleData.js.map +0 -1
- package/dist/contents/ResultsData.js +0 -530
- package/dist/contents/ResultsData.js.map +0 -1
- package/dist/css/psui_styles.css +0 -4647
- package/dist/stories/Accordion.stories.js +0 -56
- package/dist/stories/Accordion.stories.js.map +0 -1
- package/dist/stories/BadgeWithIcon.stories.js +0 -28
- package/dist/stories/BadgeWithIcon.stories.js.map +0 -1
- package/dist/stories/BarChart.stories.js +0 -16
- package/dist/stories/BarChart.stories.js.map +0 -1
- package/dist/stories/Breadcrumb.stories.js +0 -21
- package/dist/stories/Breadcrumb.stories.js.map +0 -1
- package/dist/stories/Button.stories.js +0 -44
- package/dist/stories/Button.stories.js.map +0 -1
- package/dist/stories/CardInfos.stories.js +0 -13
- package/dist/stories/CardInfos.stories.js.map +0 -1
- package/dist/stories/ChartLegend.stories.js +0 -13
- package/dist/stories/ChartLegend.stories.js.map +0 -1
- package/dist/stories/Checkbox.stories.js +0 -44
- package/dist/stories/Checkbox.stories.js.map +0 -1
- package/dist/stories/CheckboxSimple.stories.js +0 -48
- package/dist/stories/CheckboxSimple.stories.js.map +0 -1
- package/dist/stories/Chips.stories.js +0 -27
- package/dist/stories/Chips.stories.js.map +0 -1
- package/dist/stories/ClimateZoneBadge.stories.js +0 -15
- package/dist/stories/ClimateZoneBadge.stories.js.map +0 -1
- package/dist/stories/CostEffectBar.stories.js +0 -21
- package/dist/stories/CostEffectBar.stories.js.map +0 -1
- package/dist/stories/Datatable.stories.js +0 -45
- package/dist/stories/Datatable.stories.js.map +0 -1
- package/dist/stories/DateCardInfo.stories.js +0 -18
- package/dist/stories/DateCardInfo.stories.js.map +0 -1
- package/dist/stories/Dialog.stories.js +0 -127
- package/dist/stories/Dialog.stories.js.map +0 -1
- package/dist/stories/Draggable.stories.js +0 -20
- package/dist/stories/Draggable.stories.js.map +0 -1
- package/dist/stories/Dropdown.stories.js +0 -98
- package/dist/stories/Dropdown.stories.js.map +0 -1
- package/dist/stories/DropdownList.stories.js +0 -208
- package/dist/stories/DropdownList.stories.js.map +0 -1
- package/dist/stories/Header.stories.js +0 -39
- package/dist/stories/Header.stories.js.map +0 -1
- package/dist/stories/HighlightRippleDot.stories.js +0 -13
- package/dist/stories/HighlightRippleDot.stories.js.map +0 -1
- package/dist/stories/Icon.stories.js +0 -19
- package/dist/stories/Icon.stories.js.map +0 -1
- package/dist/stories/InlineSelector.stories.js +0 -16
- package/dist/stories/InlineSelector.stories.js.map +0 -1
- package/dist/stories/Input.stories.js +0 -235
- package/dist/stories/Input.stories.js.map +0 -1
- package/dist/stories/InputSelect.stories.js +0 -28
- package/dist/stories/InputSelect.stories.js.map +0 -1
- package/dist/stories/InputTextArea.stories.js +0 -23
- package/dist/stories/InputTextArea.stories.js.map +0 -1
- package/dist/stories/MiniTag.stories.js +0 -44
- package/dist/stories/MiniTag.stories.js.map +0 -1
- package/dist/stories/Playground.stories.js +0 -14
- package/dist/stories/Playground.stories.js.map +0 -1
- package/dist/stories/ProgressBar.stories.js +0 -21
- package/dist/stories/ProgressBar.stories.js.map +0 -1
- package/dist/stories/RadioButton.stories.js +0 -36
- package/dist/stories/RadioButton.stories.js.map +0 -1
- package/dist/stories/RadioButtonSimple.stories.js +0 -40
- package/dist/stories/RadioButtonSimple.stories.js.map +0 -1
- package/dist/stories/SimpleAlert.stories.js +0 -19
- package/dist/stories/SimpleAlert.stories.js.map +0 -1
- package/dist/stories/Slider.stories.js +0 -70
- package/dist/stories/Slider.stories.js.map +0 -1
- package/dist/stories/Switch.stories.js +0 -35
- package/dist/stories/Switch.stories.js.map +0 -1
- package/dist/stories/TabHeader.stories.js +0 -48
- package/dist/stories/TabHeader.stories.js.map +0 -1
- package/dist/stories/TableResults.stories.js +0 -717
- package/dist/stories/TableResults.stories.js.map +0 -1
- package/dist/stories/TagScope.stories.js +0 -16
- package/dist/stories/TagScope.stories.js.map +0 -1
- package/dist/stories/TestimonialCard.stories.js +0 -24
- package/dist/stories/TestimonialCard.stories.js.map +0 -1
- package/dist/stories/Toast.stories.js +0 -51
- package/dist/stories/Toast.stories.js.map +0 -1
- package/dist/stories/Toggle.stories.js +0 -42
- package/dist/stories/Toggle.stories.js.map +0 -1
- package/dist/stories/Tooltip.stories.js +0 -108
- package/dist/stories/Tooltip.stories.js.map +0 -1
- package/postcss.config.js +0 -8
- package/src/assets/images/multifamily-units.svg +0 -10
- package/src/assets/images/policy-studio.svg +0 -15
- package/src/components/playground/PsScrollBar.vue +0 -320
- package/src/contents/ComparisonData.ts +0 -378
- package/src/contents/FlexibleData.ts +0 -502
- package/src/contents/ResultsData.ts +0 -531
- package/src/stories/Accordion.stories.ts +0 -59
- package/src/stories/BadgeWithIcon.stories.ts +0 -31
- package/src/stories/BarChart.stories.ts +0 -17
- package/src/stories/Breadcrumb.stories.ts +0 -22
- package/src/stories/Button.stories.ts +0 -48
- package/src/stories/Button.vue +0 -59
- package/src/stories/CardInfos.stories.ts +0 -15
- package/src/stories/ChartLegend.stories.ts +0 -15
- package/src/stories/Checkbox.stories.ts +0 -45
- package/src/stories/CheckboxSimple.stories.ts +0 -49
- package/src/stories/Chips.stories.ts +0 -33
- package/src/stories/ClimateZoneBadge.stories.ts +0 -18
- package/src/stories/Colors.mdx +0 -70
- package/src/stories/CostEffectBar.stories.ts +0 -24
- package/src/stories/Datatable.stories.ts +0 -53
- package/src/stories/DateCardInfo.stories.ts +0 -20
- package/src/stories/Dialog.stories.ts +0 -131
- package/src/stories/Draggable.stories.ts +0 -23
- package/src/stories/Dropdown.stories.ts +0 -100
- package/src/stories/DropdownList.stories.ts +0 -213
- package/src/stories/ElevationSystem.mdx +0 -41
- package/src/stories/Header.stories.ts +0 -42
- package/src/stories/Header.vue +0 -77
- package/src/stories/HighlightRippleDot.stories.ts +0 -16
- package/src/stories/Icon.stories.ts +0 -23
- package/src/stories/InlineSelector.stories.ts +0 -18
- package/src/stories/Input.stories.ts +0 -243
- package/src/stories/InputSelect.stories.ts +0 -31
- package/src/stories/InputTextArea.stories.ts +0 -25
- package/src/stories/Introduction.mdx +0 -211
- package/src/stories/MiniTag.stories.ts +0 -59
- package/src/stories/Playground.stories.ts +0 -16
- package/src/stories/ProgressBar.stories.ts +0 -24
- package/src/stories/RadioButton.stories.ts +0 -40
- package/src/stories/RadioButtonSimple.stories.ts +0 -43
- package/src/stories/SimpleAlert.stories.ts +0 -22
- package/src/stories/Slider.stories.ts +0 -79
- package/src/stories/Switch.stories.ts +0 -39
- package/src/stories/TabHeader.stories.ts +0 -57
- package/src/stories/TableResults.stories.ts +0 -728
- package/src/stories/TagScope.stories.ts +0 -17
- package/src/stories/TestimonialCard.stories.ts +0 -27
- package/src/stories/Toast.stories.ts +0 -52
- package/src/stories/Toggle.stories.ts +0 -48
- package/src/stories/Tooltip.stories.ts +0 -114
- package/src/stories/Typography.mdx +0 -212
- package/src/stories/assets/code-brackets.svg +0 -1
- package/src/stories/assets/colors.svg +0 -1
- package/src/stories/assets/comments.svg +0 -1
- package/src/stories/assets/direction.svg +0 -1
- package/src/stories/assets/flow.svg +0 -1
- package/src/stories/assets/plugin.svg +0 -1
- package/src/stories/assets/repo.svg +0 -1
- package/src/stories/assets/stackalt.svg +0 -1
- package/src/stories/button.css +0 -30
- package/src/stories/header.css +0 -32
- package/webpack.config.js +0 -36
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
ref="
|
|
2
|
+
<div
|
|
3
|
+
ref="PsTooltip"
|
|
4
4
|
class="psui-el-tooltip"
|
|
5
|
-
@mouseenter="open"
|
|
6
|
-
@mouseleave="close"
|
|
5
|
+
@mouseenter="open"
|
|
6
|
+
@mouseleave="close"
|
|
7
7
|
>
|
|
8
8
|
<div
|
|
9
|
-
ref="
|
|
9
|
+
ref="PsTooltipTrigger"
|
|
10
10
|
class="psui-el-tooltip-trigger"
|
|
11
11
|
>
|
|
12
12
|
<slot name="trigger" />
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
|
-
<div
|
|
16
|
-
class="psui-el-tooltip-wrapper"
|
|
17
|
-
>
|
|
15
|
+
<div class="psui-el-tooltip-wrapper">
|
|
18
16
|
<div
|
|
19
17
|
role="menu"
|
|
20
|
-
ref="
|
|
18
|
+
ref="PsTooltipDialog"
|
|
21
19
|
class="psui-el-tooltip-dialog"
|
|
22
20
|
:class="cssClass"
|
|
23
21
|
>
|
|
@@ -41,125 +39,122 @@
|
|
|
41
39
|
</div>
|
|
42
40
|
</template>
|
|
43
41
|
|
|
44
|
-
<script>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* It disables the dialog section.
|
|
56
|
-
*/
|
|
57
|
-
ignoreDialog: {
|
|
58
|
-
type: Boolean,
|
|
59
|
-
default: false,
|
|
60
|
-
},
|
|
61
|
-
/**
|
|
62
|
-
* It sets the layout of the tooltip if needed. Usefull when using rich or dialog tooltip.
|
|
63
|
-
*/
|
|
64
|
-
layout: {
|
|
65
|
-
type: String,
|
|
66
|
-
},
|
|
67
|
-
/**
|
|
68
|
-
* It sets a additional styling if needed.
|
|
69
|
-
*/
|
|
70
|
-
cssClass: {
|
|
71
|
-
type: String,
|
|
72
|
-
},
|
|
73
|
-
/**
|
|
74
|
-
* It sets the vertical position.
|
|
75
|
-
*/
|
|
76
|
-
position: {
|
|
77
|
-
type: String,
|
|
78
|
-
default: 'bottom',
|
|
79
|
-
validator: (value)=> ['bottom','top', 'custom'].includes(value)
|
|
80
|
-
},
|
|
81
|
-
/**
|
|
82
|
-
* It sets the custom positions.
|
|
83
|
-
*/
|
|
84
|
-
customPosition: {
|
|
85
|
-
type: String,
|
|
86
|
-
default: '',
|
|
87
|
-
}
|
|
42
|
+
<script setup>
|
|
43
|
+
import { defineProps, defineEmits, ref, computed, onMounted, onBeforeUnmount } from 'vue'
|
|
44
|
+
|
|
45
|
+
const props = defineProps({
|
|
46
|
+
/**
|
|
47
|
+
* It sets the title of the tooltip if needed.
|
|
48
|
+
*/
|
|
49
|
+
title: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: '',
|
|
88
52
|
},
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
53
|
+
/**
|
|
54
|
+
* It disables the dialog section.
|
|
55
|
+
*/
|
|
56
|
+
ignoreDialog: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: false,
|
|
96
59
|
},
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
60
|
+
/**
|
|
61
|
+
* It sets the layout of the tooltip if needed. Usefull when using rich or dialog tooltip.
|
|
62
|
+
*/
|
|
63
|
+
layout: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: '',
|
|
101
66
|
},
|
|
102
|
-
|
|
103
|
-
|
|
67
|
+
/**
|
|
68
|
+
* It sets a additional styling if needed.
|
|
69
|
+
*/
|
|
70
|
+
cssClass: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: '',
|
|
104
73
|
},
|
|
105
|
-
|
|
106
|
-
|
|
74
|
+
/**
|
|
75
|
+
* It sets the vertical position.
|
|
76
|
+
*/
|
|
77
|
+
position: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: 'bottom',
|
|
80
|
+
validator: (value) => ['bottom', 'top', 'custom'].includes(value),
|
|
107
81
|
},
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
82
|
+
/**
|
|
83
|
+
* It sets the custom positions.
|
|
84
|
+
*/
|
|
85
|
+
customPosition: {
|
|
86
|
+
type: String,
|
|
87
|
+
default: '',
|
|
88
|
+
},
|
|
89
|
+
})
|
|
116
90
|
|
|
117
|
-
|
|
118
|
-
this.updatePosition()
|
|
119
|
-
}, 10)
|
|
120
|
-
},
|
|
121
|
-
close() {
|
|
122
|
-
if (this.show && this.$refs.dialog) {
|
|
123
|
-
this.$emit('close')
|
|
124
|
-
this.show = false
|
|
91
|
+
const emit = defineEmits(['show', 'close'])
|
|
125
92
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const trigger = this.$refs.tooltiptrigger
|
|
93
|
+
const show = ref(false)
|
|
94
|
+
// const closingTimeout = ref(null)
|
|
95
|
+
const PsTooltip = ref(null)
|
|
96
|
+
const PsTooltipTrigger = ref(null)
|
|
97
|
+
const PsTooltipDialog = ref(null)
|
|
132
98
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
99
|
+
const getComponentClass = computed(() => {
|
|
100
|
+
return `layout-${props.layout}`
|
|
101
|
+
})
|
|
136
102
|
|
|
137
|
-
|
|
103
|
+
onMounted(() => {
|
|
104
|
+
document.addEventListener('resize', updatePosition)
|
|
105
|
+
})
|
|
138
106
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
dialog.style.left = `${rectTrigger.x + 10}px`
|
|
143
|
-
} else if (rectDialog.width >= rectTrigger.width && this.position != 'custom') {
|
|
144
|
-
dialog.style.left = `${rectTrigger.x - ((rectDialog.width - rectTrigger.width)/2)}px`
|
|
145
|
-
} else {
|
|
146
|
-
dialog.style.left = `${rectTrigger.x + ((rectTrigger.width - rectDialog.width)/2)}px`
|
|
147
|
-
}
|
|
107
|
+
onBeforeUnmount(() => {
|
|
108
|
+
document.removeEventListener('resize', updatePosition)
|
|
109
|
+
})
|
|
148
110
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
111
|
+
const open = () => {
|
|
112
|
+
if (show.value || props.ignoreDialog) return
|
|
113
|
+
emit('show')
|
|
114
|
+
show.value = true
|
|
115
|
+
const dialog = PsTooltipDialog.value
|
|
116
|
+
dialog.style.display = 'block'
|
|
117
|
+
dialog.style.opacity = 0
|
|
118
|
+
setTimeout(() => {
|
|
119
|
+
updatePosition()
|
|
120
|
+
}, 10)
|
|
121
|
+
}
|
|
152
122
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
123
|
+
const close = () => {
|
|
124
|
+
const dialog = PsTooltipDialog.value
|
|
125
|
+
if (show.value && dialog) {
|
|
126
|
+
emit('close')
|
|
127
|
+
show.value = false
|
|
128
|
+
dialog.style.display = 'none'
|
|
129
|
+
}
|
|
130
|
+
}
|
|
158
131
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
132
|
+
const updatePosition = () => {
|
|
133
|
+
const dialog = PsTooltipDialog.value
|
|
134
|
+
const trigger = PsTooltipTrigger.value
|
|
135
|
+
const rectDialog = dialog.getBoundingClientRect()
|
|
136
|
+
const rectTrigger = trigger.getBoundingClientRect()
|
|
137
|
+
const windowWidth = document.documentElement.clientWidth
|
|
138
|
+
dialog.style.top = `${rectTrigger.y + rectTrigger.height + 8}px`
|
|
139
|
+
if (rectTrigger.x + rectDialog.width + 20 > windowWidth) {
|
|
140
|
+
dialog.style.left = `${windowWidth - rectDialog.width - 30}px`
|
|
141
|
+
} else if (rectTrigger.x - rectDialog.width < 0) {
|
|
142
|
+
dialog.style.left = `${rectTrigger.x + 10}px`
|
|
143
|
+
} else if (rectDialog.width >= rectTrigger.width && props.position != 'custom') {
|
|
144
|
+
dialog.style.left = `${rectTrigger.x - (rectDialog.width - rectTrigger.width) / 2}px`
|
|
145
|
+
} else {
|
|
146
|
+
dialog.style.left = `${rectTrigger.x + (rectTrigger.width - rectDialog.width) / 2}px`
|
|
147
|
+
}
|
|
148
|
+
if (props.position == 'top') {
|
|
149
|
+
dialog.style.top = `${rectTrigger.y - rectDialog.height - 10}px`
|
|
150
|
+
}
|
|
151
|
+
if (props.position == 'custom') {
|
|
152
|
+
dialog.style = props.customPosition
|
|
153
|
+
dialog.style.display = 'block'
|
|
154
|
+
dialog.style.position = 'absolute'
|
|
155
|
+
}
|
|
156
|
+
setTimeout(() => {
|
|
157
|
+
dialog.style.opacity = 100
|
|
158
|
+
}, 100)
|
|
164
159
|
}
|
|
165
160
|
</script>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :style="{display: display}">
|
|
2
|
+
<div :style="{ display: display }">
|
|
3
3
|
<span
|
|
4
4
|
v-if="getIconType === 'material-icons'"
|
|
5
5
|
class="material-icons-round"
|
|
6
6
|
:class="[getIconClasses]"
|
|
7
|
-
:style="{ fontSize: `${size}px`}"
|
|
7
|
+
:style="{ fontSize: `${size}px` }"
|
|
8
8
|
>
|
|
9
9
|
{{ getIcon }}
|
|
10
10
|
</span>
|
|
@@ -24,140 +24,137 @@
|
|
|
24
24
|
</div>
|
|
25
25
|
</template>
|
|
26
26
|
|
|
27
|
-
<script>
|
|
28
|
-
import tailwindConfig from '../../../tailwind.config'
|
|
29
|
-
import imageLoader from '../../util/imageLoader'
|
|
30
|
-
export default {
|
|
31
|
-
name: 'AppIcon',
|
|
32
|
-
props: {
|
|
33
|
-
/**
|
|
34
|
-
* It sets the text key to get the svg icon in Google Fonts. Make sure to get the correct description of your icon on https://fonts.google.com/.
|
|
35
|
-
*/
|
|
36
|
-
icon: {
|
|
37
|
-
type: String,
|
|
38
|
-
default: 'more_horiz'
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* It sets the type of the icon.
|
|
43
|
-
*/
|
|
44
|
-
type: {
|
|
45
|
-
type: String,
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* It sets the style of the icon.
|
|
50
|
-
*/
|
|
51
|
-
iconClasses: {
|
|
52
|
-
type: String,
|
|
53
|
-
default: null
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* It sets the size of the icon.
|
|
58
|
-
*/
|
|
59
|
-
size: {
|
|
60
|
-
type: [Number, String],
|
|
61
|
-
default: 24
|
|
62
|
-
},
|
|
27
|
+
<script setup>
|
|
28
|
+
import tailwindConfig from '../../../tailwind.config.js'
|
|
29
|
+
import imageLoader from '../../util/imageLoader.js'
|
|
63
30
|
|
|
64
|
-
|
|
65
|
-
* It sets fill property of the icon.
|
|
66
|
-
*/
|
|
67
|
-
stroke: {
|
|
68
|
-
type: String,
|
|
69
|
-
default: null
|
|
70
|
-
},
|
|
31
|
+
import { defineProps, ref, computed, watch, onMounted } from 'vue'
|
|
71
32
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* It sets the color of the icon.
|
|
82
|
-
*/
|
|
83
|
-
color: {
|
|
84
|
-
type: String,
|
|
85
|
-
default: null,
|
|
86
|
-
validator: value => {
|
|
87
|
-
return value?.includes('psui-text-') &&
|
|
88
|
-
typeof(tailwindConfig.theme.colors[value.replace('psui-text-', '')]) != 'undefined' ||
|
|
89
|
-
typeof(tailwindConfig.theme.colors[value]) != 'undefined'
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* It set a animation icon if needed.
|
|
95
|
-
*/
|
|
96
|
-
loaderIcon: {
|
|
97
|
-
type: String,
|
|
98
|
-
default: 'hourglass_top'
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* It sets a error when the icon is not available.
|
|
103
|
-
*/
|
|
104
|
-
loaderErrorIcon: {
|
|
105
|
-
type: String,
|
|
106
|
-
default: 'more_horiz'
|
|
107
|
-
}
|
|
33
|
+
const props = defineProps({
|
|
34
|
+
/**
|
|
35
|
+
* It sets the text key to get the svg icon in Google Fonts. Make sure to get the correct description of your icon on https://fonts.google.com/.
|
|
36
|
+
*/
|
|
37
|
+
icon: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'more_horiz',
|
|
108
40
|
},
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
41
|
+
/**
|
|
42
|
+
* It sets the type of the icon.
|
|
43
|
+
*/
|
|
44
|
+
type: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: '',
|
|
114
47
|
},
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
48
|
+
/**
|
|
49
|
+
* It sets the style of the icon.
|
|
50
|
+
*/
|
|
51
|
+
iconClasses: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: null,
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* It sets the size of the icon.
|
|
57
|
+
*/
|
|
58
|
+
size: {
|
|
59
|
+
type: [Number, String],
|
|
60
|
+
default: 24,
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* It sets fill property of the icon.
|
|
64
|
+
*/
|
|
65
|
+
stroke: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: null,
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* It sets fill property display of the icon.
|
|
71
|
+
*/
|
|
72
|
+
display: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: 'contents',
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* It sets the color of the icon.
|
|
78
|
+
*/
|
|
79
|
+
color: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: null,
|
|
82
|
+
validator: (value) => {
|
|
83
|
+
return (
|
|
84
|
+
(value?.includes('psui-text-') && typeof tailwindConfig.theme.colors[value.replace('psui-text-', '')] != 'undefined') ||
|
|
85
|
+
typeof tailwindConfig.theme.colors[value] != 'undefined'
|
|
86
|
+
)
|
|
135
87
|
},
|
|
136
|
-
getColor() {
|
|
137
|
-
if(this.getIconType === 'material-icons') return this.color
|
|
138
|
-
return tailwindConfig.theme.colors[this.color.replace('psui-text-', '')] || tailwindConfig.theme.colors[this.color]
|
|
139
|
-
}
|
|
140
88
|
},
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
89
|
+
/**
|
|
90
|
+
* It set a animation icon if needed.
|
|
91
|
+
*/
|
|
92
|
+
loaderIcon: {
|
|
93
|
+
type: String,
|
|
94
|
+
default: 'hourglass_top',
|
|
145
95
|
},
|
|
146
|
-
|
|
147
|
-
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* It sets a error when the icon is not available.
|
|
99
|
+
*/
|
|
100
|
+
loaderErrorIcon: {
|
|
101
|
+
type: String,
|
|
102
|
+
default: 'more_horiz',
|
|
148
103
|
},
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
const finishedImageLoad = ref(false)
|
|
107
|
+
const imageLoadError = ref(false)
|
|
108
|
+
|
|
109
|
+
const getIconType = computed(() => {
|
|
110
|
+
if (imageLoadError.value || !finishedImageLoad.value) return 'material-icons'
|
|
111
|
+
if (props.type) return props.type
|
|
112
|
+
if (!props.icon?.includes('/')) return 'material-icons'
|
|
113
|
+
if (!props.icon?.includes('.svg')) return 'url'
|
|
114
|
+
return 'svg'
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
const getIcon = computed(() => {
|
|
118
|
+
if (!props.icon?.includes('/')) return props.icon ? props.icon : props.loaderErrorIcon
|
|
119
|
+
if (!finishedImageLoad.value && !imageLoadError.value && props.loaderIcon) return props.loaderIcon
|
|
120
|
+
if (imageLoadError.value) return props.loaderErrorIcon
|
|
121
|
+
return props.icon ? props.icon : props.loaderErrorIcon
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
const getIconClasses = computed(() => {
|
|
125
|
+
if (props.iconClasses) return props.iconClasses
|
|
126
|
+
return `${props.color}`
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
// const getHeight = computed(() => {
|
|
130
|
+
// return props.height
|
|
131
|
+
// })
|
|
132
|
+
|
|
133
|
+
const getColor = computed(() => {
|
|
134
|
+
if (getIconType.value === 'material-icons') return props.color
|
|
135
|
+
return tailwindConfig.theme.colors[props.color.replace('psui-text-', '')] || tailwindConfig.theme.colors[props.color]
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
watch(
|
|
139
|
+
() => props.icon,
|
|
140
|
+
() => {
|
|
141
|
+
loadImage()
|
|
161
142
|
}
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
onMounted(() => {
|
|
146
|
+
if (props.icon?.includes('/')) loadImage()
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
const loadImage = () => {
|
|
150
|
+
finishedImageLoad.value = false
|
|
151
|
+
imageLoadError.value = false
|
|
152
|
+
imageLoader({ imageUrl: props.icon, returnsBase64: false })
|
|
153
|
+
.then(() => {
|
|
154
|
+
finishedImageLoad.value = true
|
|
155
|
+
})
|
|
156
|
+
.catch(() => {
|
|
157
|
+
imageLoadError.value = true
|
|
158
|
+
})
|
|
162
159
|
}
|
|
163
|
-
</script>
|
|
160
|
+
</script>
|