@policystudio/policy-studio-ui-vue 1.1.90-beta.12 → 1.1.90-beta.17
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/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/index.js +0 -114
- package/dist/index.js.map +0 -1
- 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/dist/util/GeneralFunctions.js +0 -29
- package/dist/util/GeneralFunctions.js.map +0 -1
- package/dist/util/imageLoader.js +0 -52
- package/dist/util/imageLoader.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,22 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="psui-el-input"
|
|
4
|
-
:class="[getComponentClass, `layout-${layout}`]"
|
|
5
|
-
>
|
|
2
|
+
<div
|
|
3
|
+
class="psui-el-input"
|
|
4
|
+
:class="[getComponentClass, `layout-${layout}`]"
|
|
5
|
+
>
|
|
6
6
|
<label v-if="label"> {{ label }} </label>
|
|
7
7
|
|
|
8
|
-
<div
|
|
8
|
+
<div
|
|
9
9
|
class="psui-el-input-wrapper"
|
|
10
|
-
@mouseenter="
|
|
11
|
-
@mouseleave="
|
|
10
|
+
@mouseenter="emit('mouseenter', $event)"
|
|
11
|
+
@mouseleave="emit('mouseleave', $event)"
|
|
12
12
|
>
|
|
13
|
-
<div
|
|
14
|
-
v-if="$slots.prepend"
|
|
15
|
-
class="psui-el-input-prepend"
|
|
13
|
+
<div
|
|
14
|
+
v-if="$slots.prepend"
|
|
15
|
+
class="psui-el-input-prepend"
|
|
16
16
|
>
|
|
17
17
|
<slot name="prepend" />
|
|
18
18
|
</div>
|
|
19
|
-
<PsRichTooltip
|
|
19
|
+
<PsRichTooltip
|
|
20
20
|
class="psui-w-full"
|
|
21
21
|
css-class="psui-w-48"
|
|
22
22
|
:ignore-dialog="!showTooltip"
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
:max="maxValue"
|
|
34
34
|
@focus="onInputFocus"
|
|
35
35
|
@blur="onInputBlur"
|
|
36
|
-
@input="
|
|
37
|
-
@keydown="
|
|
38
|
-
@change="
|
|
36
|
+
@input="emit('input', $event)"
|
|
37
|
+
@keydown="emit('keydown', $event)"
|
|
38
|
+
@change="emit('change', $event)"
|
|
39
39
|
v-bind="getAttrs"
|
|
40
|
-
:class="{
|
|
40
|
+
:class="{ focus: isFocus }"
|
|
41
41
|
>
|
|
42
42
|
</template>
|
|
43
43
|
<template #content>
|
|
@@ -46,160 +46,162 @@
|
|
|
46
46
|
</div>
|
|
47
47
|
</template>
|
|
48
48
|
</PsRichTooltip>
|
|
49
|
-
<div
|
|
50
|
-
v-if="$slots.append || hasError"
|
|
51
|
-
class="psui-el-input-append"
|
|
49
|
+
<div
|
|
50
|
+
v-if="$slots.append || hasError"
|
|
51
|
+
class="psui-el-input-append"
|
|
52
52
|
>
|
|
53
|
-
<span
|
|
54
|
-
v-if="hasError"
|
|
55
|
-
class="material-icons psui-text-red-20 material-icons-sharp"
|
|
53
|
+
<span
|
|
54
|
+
v-if="hasError"
|
|
55
|
+
class="material-icons psui-text-red-20 material-icons-sharp"
|
|
56
56
|
>error</span>
|
|
57
|
-
<slot
|
|
58
|
-
v-else
|
|
59
|
-
name="append"
|
|
57
|
+
<slot
|
|
58
|
+
v-else
|
|
59
|
+
name="append"
|
|
60
60
|
/>
|
|
61
61
|
</div>
|
|
62
62
|
</div>
|
|
63
63
|
|
|
64
|
-
<p
|
|
65
|
-
v-if="hint || (hasError && typeof hasError === 'string')"
|
|
66
|
-
class="psui-el-input-hint"
|
|
64
|
+
<p
|
|
65
|
+
v-if="hint || (hasError && typeof hasError === 'string')"
|
|
66
|
+
class="psui-el-input-hint"
|
|
67
67
|
>
|
|
68
68
|
{{ typeof hasError === 'string' ? hasError : hint }}
|
|
69
|
-
</p>
|
|
69
|
+
</p>
|
|
70
70
|
</div>
|
|
71
71
|
</template>
|
|
72
72
|
|
|
73
|
-
<script>
|
|
73
|
+
<script setup>
|
|
74
74
|
import PsRichTooltip from '../tooltip/PsRichTooltip.vue'
|
|
75
|
+
import { defineProps, ref, computed, useAttrs, defineEmits } from 'vue'
|
|
75
76
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
const props = defineProps({
|
|
78
|
+
/**
|
|
79
|
+
* It set the title and also its tooltip default behavior
|
|
80
|
+
*/
|
|
81
|
+
title: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: '',
|
|
80
84
|
},
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
default: ''
|
|
88
|
-
},
|
|
89
|
-
/**
|
|
90
|
-
* It sets the type of your button. default: text.
|
|
91
|
-
*/
|
|
92
|
-
type: {
|
|
93
|
-
type: String,
|
|
94
|
-
default: 'text'
|
|
95
|
-
},
|
|
96
|
-
/**
|
|
97
|
-
* It sets a placeholder for your button if needed.
|
|
98
|
-
*/
|
|
99
|
-
placeholder: {
|
|
100
|
-
type: String
|
|
101
|
-
},
|
|
102
|
-
/**
|
|
103
|
-
* It sets the label of the input if needed.
|
|
104
|
-
*/
|
|
105
|
-
label: {
|
|
106
|
-
type: String
|
|
107
|
-
},
|
|
108
|
-
/**
|
|
109
|
-
* It sets a text below the input. See Figma Text fileds & Forms.
|
|
110
|
-
*/
|
|
111
|
-
hint: {
|
|
112
|
-
type: String
|
|
113
|
-
},
|
|
114
|
-
/**
|
|
115
|
-
* It sets the layout of your button. eg: mini and default.
|
|
116
|
-
*/
|
|
117
|
-
layout: {
|
|
118
|
-
type: String,
|
|
119
|
-
default: 'default',
|
|
120
|
-
validator: (value) => ['default', 'mini'].includes(value)
|
|
121
|
-
},
|
|
122
|
-
/**
|
|
123
|
-
* It sets the value of the button.
|
|
124
|
-
*/
|
|
125
|
-
value: {
|
|
126
|
-
required: true,
|
|
127
|
-
},
|
|
128
|
-
/**
|
|
129
|
-
* It disables the input. All mouse events are disabled.
|
|
130
|
-
*/
|
|
131
|
-
disabled: {
|
|
132
|
-
type: Boolean,
|
|
133
|
-
default: false
|
|
134
|
-
},
|
|
135
|
-
/**
|
|
136
|
-
* It sets if the input found any error.
|
|
137
|
-
*/
|
|
138
|
-
hasError: {
|
|
139
|
-
type: [String, Boolean],
|
|
140
|
-
default: false
|
|
141
|
-
},
|
|
142
|
-
/**
|
|
143
|
-
* It sets a active css class based on a boolean property.
|
|
144
|
-
*/
|
|
145
|
-
active: {
|
|
146
|
-
type: Boolean,
|
|
147
|
-
default: false
|
|
148
|
-
},
|
|
149
|
-
minValue: {
|
|
150
|
-
type: null
|
|
151
|
-
},
|
|
152
|
-
maxValue: {
|
|
153
|
-
type: null
|
|
154
|
-
},
|
|
155
|
-
step:{
|
|
156
|
-
type: null
|
|
157
|
-
},
|
|
158
|
-
showTooltip: {
|
|
159
|
-
type: Boolean,
|
|
160
|
-
default: false,
|
|
161
|
-
},
|
|
162
|
-
tooltipText: {
|
|
163
|
-
type: String,
|
|
164
|
-
default: '',
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
data: () => ({
|
|
168
|
-
isFocus: false,
|
|
169
|
-
}),
|
|
170
|
-
computed: {
|
|
171
|
-
getAttrs() {
|
|
172
|
-
const defaultAttrs = {
|
|
173
|
-
autocapitalize: 'sentences',
|
|
174
|
-
autocomplete: 'chrome-off',
|
|
175
|
-
autocorrect: 'off',
|
|
176
|
-
spellcheck: 'spellcheck'
|
|
177
|
-
}
|
|
178
|
-
return { ...defaultAttrs, ...this.$attrs }
|
|
179
|
-
},
|
|
180
|
-
getComponentClass() {
|
|
181
|
-
if (this.disabled) {
|
|
182
|
-
return 'status-disabled'
|
|
183
|
-
} else if (this.hasError) {
|
|
184
|
-
return 'status-error'
|
|
185
|
-
} else if (this.isFocus || this.isTyping || this.active ) {
|
|
186
|
-
return 'status-active'
|
|
187
|
-
} else {
|
|
188
|
-
return 'status-resting'
|
|
189
|
-
}
|
|
190
|
-
},
|
|
85
|
+
/**
|
|
86
|
+
* It sets the type of your button. default: text.
|
|
87
|
+
*/
|
|
88
|
+
type: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: 'text',
|
|
191
91
|
},
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
92
|
+
/**
|
|
93
|
+
* It sets a placeholder for your button if needed.
|
|
94
|
+
*/
|
|
95
|
+
placeholder: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: '',
|
|
98
|
+
},
|
|
99
|
+
/**
|
|
100
|
+
* It sets the label of the input if needed.
|
|
101
|
+
*/
|
|
102
|
+
label: {
|
|
103
|
+
type: String,
|
|
104
|
+
default: '',
|
|
105
|
+
},
|
|
106
|
+
/**
|
|
107
|
+
* It sets a text below the input. See Figma Text fileds & Forms.
|
|
108
|
+
*/
|
|
109
|
+
hint: {
|
|
110
|
+
type: String,
|
|
111
|
+
default: '',
|
|
112
|
+
},
|
|
113
|
+
/**
|
|
114
|
+
* It sets the layout of your button. eg: mini and default.
|
|
115
|
+
*/
|
|
116
|
+
layout: {
|
|
117
|
+
type: String,
|
|
118
|
+
default: 'default',
|
|
119
|
+
validator: (value) => ['default', 'mini'].includes(value),
|
|
120
|
+
},
|
|
121
|
+
/**
|
|
122
|
+
* It sets the value of the button.
|
|
123
|
+
*/
|
|
124
|
+
value: {
|
|
125
|
+
required: true,
|
|
126
|
+
},
|
|
127
|
+
/**
|
|
128
|
+
* It disables the input. All mouse events are disabled.
|
|
129
|
+
*/
|
|
130
|
+
disabled: {
|
|
131
|
+
type: Boolean,
|
|
132
|
+
default: false,
|
|
133
|
+
},
|
|
134
|
+
/**
|
|
135
|
+
* It sets if the input found any error.
|
|
136
|
+
*/
|
|
137
|
+
hasError: {
|
|
138
|
+
type: [String, Boolean],
|
|
139
|
+
default: false,
|
|
140
|
+
},
|
|
141
|
+
/**
|
|
142
|
+
* It sets a active css class based on a boolean property.
|
|
143
|
+
*/
|
|
144
|
+
active: {
|
|
145
|
+
type: Boolean,
|
|
146
|
+
default: false,
|
|
147
|
+
},
|
|
148
|
+
minValue: {
|
|
149
|
+
type: null,
|
|
150
|
+
},
|
|
151
|
+
maxValue: {
|
|
152
|
+
type: null,
|
|
153
|
+
},
|
|
154
|
+
step: {
|
|
155
|
+
type: null,
|
|
156
|
+
},
|
|
157
|
+
showTooltip: {
|
|
158
|
+
type: Boolean,
|
|
159
|
+
default: false,
|
|
160
|
+
},
|
|
161
|
+
tooltipText: {
|
|
162
|
+
type: String,
|
|
163
|
+
default: '',
|
|
164
|
+
},
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
const emit = defineEmits(['focus', 'blur', 'mouseenter', 'mouseleave', 'input', 'keydown', 'change'])
|
|
168
|
+
|
|
169
|
+
const isFocus = ref(false)
|
|
170
|
+
const attrs = useAttrs()
|
|
171
|
+
|
|
172
|
+
const getAttrs = computed(() => {
|
|
173
|
+
const defaultAttrs = {
|
|
174
|
+
autocapitalize: 'sentences',
|
|
175
|
+
autocomplete: 'chrome-off',
|
|
176
|
+
autocorrect: 'off',
|
|
177
|
+
spellcheck: 'spellcheck',
|
|
201
178
|
}
|
|
179
|
+
return { ...defaultAttrs, ...attrs }
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
const getComponentClass = computed(() => {
|
|
183
|
+
if (props.disabled) {
|
|
184
|
+
return 'status-disabled'
|
|
185
|
+
} else if (props.hasError) {
|
|
186
|
+
return 'status-error'
|
|
187
|
+
} else if (isFocus.value || props.active) {
|
|
188
|
+
return 'status-active'
|
|
189
|
+
} else {
|
|
190
|
+
return 'status-resting'
|
|
191
|
+
}
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
const onInputFocus = ($event) => {
|
|
195
|
+
isFocus.value = true
|
|
196
|
+
emit('focus', $event)
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const onInputBlur = ($event) => {
|
|
200
|
+
isFocus.value = false
|
|
201
|
+
emit('blur', $event)
|
|
202
202
|
}
|
|
203
203
|
</script>
|
|
204
204
|
|
|
205
|
-
<style>
|
|
205
|
+
<style>
|
|
206
|
+
/* Please, use the file src/assets/scss/components/PsInput.scss */
|
|
207
|
+
</style>
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
class="psui-el-input-select"
|
|
4
|
-
:class="[getComponentClass, {
|
|
4
|
+
:class="[getComponentClass, { selected: selectedClass }, { disabled: disabled }]"
|
|
5
5
|
>
|
|
6
6
|
<label
|
|
7
7
|
:for="label"
|
|
8
8
|
v-if="label"
|
|
9
9
|
>{{ label }}</label>
|
|
10
10
|
<div class="psui-el-input-select-wrapper">
|
|
11
|
-
<select
|
|
11
|
+
<select
|
|
12
12
|
:name="label"
|
|
13
|
-
:id="label"
|
|
13
|
+
:id="label"
|
|
14
14
|
v-model="childValue"
|
|
15
15
|
>
|
|
16
16
|
<option
|
|
@@ -37,97 +37,96 @@
|
|
|
37
37
|
</div>
|
|
38
38
|
</template>
|
|
39
39
|
|
|
40
|
-
<script>
|
|
40
|
+
<script setup>
|
|
41
|
+
import { defineProps, ref, computed, defineEmits } from 'vue'
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
items: {
|
|
49
|
-
required: true
|
|
50
|
-
},
|
|
51
|
-
value: {
|
|
52
|
-
default: '',
|
|
53
|
-
required: true
|
|
54
|
-
},
|
|
55
|
-
/**
|
|
56
|
-
* It sets the value label of the select input if needed.
|
|
57
|
-
*/
|
|
58
|
-
label: {
|
|
59
|
-
default: ''
|
|
60
|
-
},
|
|
61
|
-
/**
|
|
62
|
-
* It sets a o optional label below the select input.
|
|
63
|
-
*/
|
|
64
|
-
optionalLabel:{
|
|
65
|
-
default:''
|
|
66
|
-
},
|
|
67
|
-
/**
|
|
68
|
-
* It sets the key label of your items if needed.
|
|
69
|
-
*/
|
|
70
|
-
keyLabel: {
|
|
71
|
-
default: 'label'
|
|
72
|
-
},
|
|
73
|
-
/**
|
|
74
|
-
* It sets the key value of yout items if needed.
|
|
75
|
-
*/
|
|
76
|
-
keyValue: {
|
|
77
|
-
default: 'value'
|
|
78
|
-
},
|
|
79
|
-
/**
|
|
80
|
-
* It disables the select input. All mouse events are disabled.
|
|
81
|
-
*/
|
|
82
|
-
disabled: {
|
|
83
|
-
type: Boolean,
|
|
84
|
-
default: false
|
|
85
|
-
},
|
|
86
|
-
/**
|
|
87
|
-
* It sets the layout of the select input. eg: default and mini.
|
|
88
|
-
*/
|
|
89
|
-
layout:{
|
|
90
|
-
type: String,
|
|
91
|
-
default: 'default',
|
|
92
|
-
validator: (value) => ['default','mini'].includes(value)
|
|
93
|
-
}
|
|
43
|
+
const props = defineProps({
|
|
44
|
+
/**
|
|
45
|
+
* It sets the items which will be rendered within the select input.
|
|
46
|
+
*/
|
|
47
|
+
items: {
|
|
48
|
+
required: true,
|
|
94
49
|
},
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
50
|
+
value: {
|
|
51
|
+
default: '',
|
|
52
|
+
required: true,
|
|
99
53
|
},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
54
|
+
/**
|
|
55
|
+
* It sets the value label of the select input if needed.
|
|
56
|
+
*/
|
|
57
|
+
label: {
|
|
58
|
+
default: '',
|
|
59
|
+
},
|
|
60
|
+
/**
|
|
61
|
+
* It sets a o optional label below the select input.
|
|
62
|
+
*/
|
|
63
|
+
optionalLabel: {
|
|
64
|
+
default: '',
|
|
65
|
+
},
|
|
66
|
+
/**
|
|
67
|
+
* It sets the key label of your items if needed.
|
|
68
|
+
*/
|
|
69
|
+
keyLabel: {
|
|
70
|
+
default: 'label',
|
|
71
|
+
},
|
|
72
|
+
/**
|
|
73
|
+
* It sets the key value of yout items if needed.
|
|
74
|
+
*/
|
|
75
|
+
keyValue: {
|
|
76
|
+
default: 'value',
|
|
77
|
+
},
|
|
78
|
+
/**
|
|
79
|
+
* It disables the select input. All mouse events are disabled.
|
|
80
|
+
*/
|
|
81
|
+
disabled: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: false,
|
|
84
|
+
},
|
|
85
|
+
/**
|
|
86
|
+
* It sets the layout of the select input. eg: default and mini.
|
|
87
|
+
*/
|
|
88
|
+
layout: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: 'default',
|
|
91
|
+
validator: (value) => ['default', 'mini'].includes(value),
|
|
92
|
+
},
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
const emit = defineEmits('input', 'change')
|
|
96
|
+
|
|
97
|
+
const selectedClass = ref(false)
|
|
98
|
+
|
|
99
|
+
const getComponentClass = computed(() => {
|
|
100
|
+
return `layout-${props.layout}`
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
const childValue = computed({
|
|
104
|
+
get() {
|
|
105
|
+
return props.value
|
|
131
106
|
},
|
|
132
|
-
|
|
107
|
+
set(value) {
|
|
108
|
+
if (isString.value) return emit('input', value)
|
|
109
|
+
const finded = find(props.items, { [props.keyValue]: value })
|
|
110
|
+
emit('input', value)
|
|
111
|
+
emit('change', finded)
|
|
112
|
+
selectedClass.value = true
|
|
113
|
+
},
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
const isString = computed(() => {
|
|
117
|
+
return props.items.length > 0 && typeof props.items[0] === 'string'
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
const getItems = computed(() => {
|
|
121
|
+
if (props.items.length > 0 && typeof props.items[0] === 'string') {
|
|
122
|
+
return props.items.map((item) => {
|
|
123
|
+
return {
|
|
124
|
+
[props.keyLabel]: item,
|
|
125
|
+
[props.keyValue]: item,
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
} else {
|
|
129
|
+
return props.items
|
|
130
|
+
}
|
|
131
|
+
})
|
|
133
132
|
</script>
|