@policystudio/policy-studio-ui-vue 1.1.88 → 1.1.90-access.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/.eslintignore +1 -0
- package/.eslintrc.js +75 -67
- package/.github/workflows/deploy-storybook.yml +5 -5
- package/.nvmrc +1 -0
- package/dist/css/psui_styles_output.css +6617 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.js +106 -0
- package/dist/index.js.map +1 -0
- package/dist/util/GeneralFunctions.d.ts +3 -0
- package/dist/util/GeneralFunctions.js +35 -0
- package/dist/util/GeneralFunctions.js.map +1 -0
- 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/imageLoader.d.ts +6 -0
- package/dist/util/imageLoader.js +52 -0
- package/dist/util/imageLoader.js.map +1 -0
- package/doc/.nvmrc +1 -0
- package/doc/.storybook/PolicyStudio.ts +11 -0
- package/doc/.storybook/main.ts +27 -0
- package/doc/.storybook/manager.ts +7 -0
- package/{.storybook/preview.js → doc/.storybook/preview.ts} +2 -3
- package/doc/package-lock.json +22653 -0
- package/doc/package.json +71 -0
- package/doc/shims-vue.d.ts +6 -0
- package/{src/stories/Accordion.stories.js → doc/src/stories/Accordion.stories.ts} +4 -5
- package/{src/stories/BadgeWithIcon.stories.js → doc/src/stories/BadgeWithIcon.stories.ts} +2 -2
- package/{src/stories/BarChart.stories.js → doc/src/stories/BarChart.stories.ts} +2 -2
- package/{src/stories/Breadcrumb.stories.js → doc/src/stories/Breadcrumb.stories.ts} +2 -5
- package/{src/stories/Button.stories.js → doc/src/stories/Button.stories.ts} +130 -130
- package/{src/stories/CardInfos.stories.js → doc/src/stories/CardInfos.stories.ts} +2 -3
- package/{src/stories/ChartLegend.stories.js → doc/src/stories/ChartLegend.stories.ts} +2 -3
- package/{src/stories/Checkbox.stories.js → doc/src/stories/Checkbox.stories.ts} +2 -2
- package/{src/stories/CheckboxSimple.stories.js → doc/src/stories/CheckboxSimple.stories.ts} +2 -2
- package/{src/stories/Chips.stories.js → doc/src/stories/Chips.stories.ts} +22 -23
- package/{src/stories/ClimateZoneBadge.stories.js → doc/src/stories/ClimateZoneBadge.stories.ts} +3 -2
- package/doc/src/stories/Collapse.stories.ts +46 -0
- package/{src/stories/CostEffectBar.stories.js → doc/src/stories/CostEffectBar.stories.ts} +3 -2
- package/{src/stories/Datatable.stories.js → doc/src/stories/Datatable.stories.ts} +7 -4
- package/{src/stories/DateCardInfo.stories.js → doc/src/stories/DateCardInfo.stories.ts} +2 -6
- package/{src/stories/Dialog.stories.js → doc/src/stories/Dialog.stories.ts} +2 -2
- package/{src/stories/Draggable.stories.js → doc/src/stories/Draggable.stories.ts} +3 -2
- package/{src/stories/Dropdown.stories.js → doc/src/stories/Dropdown.stories.ts} +4 -3
- package/{src/stories/DropdownList.stories.js → doc/src/stories/DropdownList.stories.ts} +4 -2
- package/{src/stories/ElevationSystem.stories.mdx → doc/src/stories/ElevationSystem.mdx} +1 -1
- package/{src/stories/HighlightRippleDot.stories.js → doc/src/stories/HighlightRippleDot.stories.ts} +3 -2
- package/{src/stories/Icon.stories.js → doc/src/stories/Icon.stories.ts} +3 -1
- package/{src/stories/InlineSelector.stories.js → doc/src/stories/InlineSelector.stories.ts} +2 -2
- package/{src/stories/Input.stories.js → doc/src/stories/Input.stories.ts} +7 -4
- package/{src/stories/InputSelect.stories.js → doc/src/stories/InputSelect.stories.ts} +3 -2
- package/{src/stories/InputTextArea.stories.js → doc/src/stories/InputTextArea.stories.ts} +2 -2
- package/{src/stories/Introduction.stories.mdx → doc/src/stories/Introduction.mdx} +101 -101
- package/{src/stories/MiniTag.stories.js → doc/src/stories/MiniTag.stories.ts} +9 -2
- package/{src/stories/ProgressBar.stories.js → doc/src/stories/ProgressBar.stories.ts} +3 -2
- package/{src/stories/RadioButton.stories.js → doc/src/stories/RadioButton.stories.ts} +2 -2
- package/{src/stories/RadioButtonSimple.stories.js → doc/src/stories/RadioButtonSimple.stories.ts} +2 -2
- package/{src/stories/SimpleAlert.stories.js → doc/src/stories/SimpleAlert.stories.ts} +3 -2
- package/{src/stories/Slider.stories.js → doc/src/stories/Slider.stories.ts} +6 -2
- package/{src/stories/Switch.stories.js → doc/src/stories/Switch.stories.ts} +2 -2
- package/{src/stories/TabHeader.stories.js → doc/src/stories/TabHeader.stories.ts} +6 -1
- package/{src/stories/TableResults.stories.js → doc/src/stories/TableResults.stories.ts} +11 -7
- package/{src/stories/TagScope.stories.js → doc/src/stories/TagScope.stories.ts} +3 -2
- package/{src/stories/TestimonialCard.stories.js → doc/src/stories/TestimonialCard.stories.ts} +3 -3
- package/{src/stories/Toast.stories.js → doc/src/stories/Toast.stories.ts} +2 -2
- package/{src/stories/Toggle.stories.js → doc/src/stories/Toggle.stories.ts} +7 -4
- package/{src/stories/Tooltip.stories.js → doc/src/stories/Tooltip.stories.ts} +6 -6
- package/{src/stories/Typography.stories.mdx → doc/src/stories/Typography.mdx} +107 -105
- package/doc/tsconfig.json +17 -0
- package/package.json +43 -39
- package/scripts/gulp.js +11 -0
- package/scripts/kill-port.sh +12 -0
- package/src/App.vue +30 -0
- package/src/assets/scss/base.scss +3 -30
- package/src/assets/scss/components/PsAccordion.scss +2 -2
- package/src/assets/scss/components/PsButton.scss +7 -1
- package/src/assets/scss/components/PsChips.scss +12 -7
- package/src/assets/scss/components/PsCollapse.scss +71 -0
- package/src/assets/scss/components/PsCostEffectBar.scss +4 -4
- package/src/assets/scss/components/PsDataTable.scss +1 -1
- package/src/assets/scss/components/PsDateCardInfo.scss +4 -5
- package/src/assets/scss/components/PsDialog.scss +7 -0
- package/src/assets/scss/components/PsDropdownList.scss +1 -1
- package/src/assets/scss/components/PsInput.scss +9 -0
- package/src/assets/scss/components/PsProgressBar.scss +4 -4
- package/src/assets/scss/components/PsTabHeader.scss +57 -2
- package/src/assets/scss/components/PsTableResults.scss +53 -22
- package/src/assets/scss/components/PsTestimonialCard.scss +1 -1
- package/src/assets/scss/components/PsTooltip.scss +149 -145
- package/src/components/accordion/PsAccordion.vue +20 -21
- package/src/components/accordion/PsAccordionItem.vue +121 -81
- package/src/components/badges-and-tags/PsBadgeWithIcon.vue +37 -36
- package/src/components/badges-and-tags/PsCardInfos.vue +40 -40
- package/src/components/badges-and-tags/PsChartLegend.vue +50 -41
- package/src/components/badges-and-tags/PsClimateZoneBadge.vue +13 -19
- package/src/components/badges-and-tags/PsCostEffectBar.vue +28 -61
- package/src/components/badges-and-tags/PsDateCardInfo.vue +17 -18
- package/src/components/badges-and-tags/PsHighlightRippleDot.vue +4 -3
- 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 +25 -30
- package/src/components/buttons/PsButton.vue +90 -98
- package/src/components/chips/PsChips.vue +118 -103
- package/src/components/collapse/PsCollapse.vue +124 -0
- package/src/components/controls/PsCheckbox.vue +86 -83
- package/src/components/controls/PsCheckboxSimple.vue +97 -97
- package/src/components/controls/PsDraggable.vue +100 -99
- package/src/components/controls/PsInlineSelector.vue +111 -113
- package/src/components/controls/PsRadioButton.vue +72 -60
- package/src/components/controls/PsRadioButtonSimple.vue +81 -77
- package/src/components/controls/PsSlider.vue +190 -181
- package/src/components/controls/PsSwitch.vue +63 -54
- package/src/components/controls/PsToggle.vue +62 -57
- package/src/components/data-graphics/PsBarChart.vue +22 -23
- package/src/components/datatable/PsDataTable.vue +70 -65
- package/src/components/datatable/PsDataTableItem.vue +30 -32
- package/src/components/forms/PsDropdown.vue +173 -166
- package/src/components/forms/PsDropdownList.vue +133 -130
- package/src/components/forms/PsInput.vue +163 -146
- package/src/components/forms/PsInputSelect.vue +121 -100
- package/src/components/forms/PsInputTextArea.vue +84 -74
- package/src/components/navigations/PsBreadcrumb.vue +25 -34
- package/src/components/notifications/PsDialog.vue +67 -60
- package/src/components/notifications/PsSimpleAlert.vue +47 -37
- package/src/components/notifications/PsToast.vue +48 -42
- package/src/components/table-results/PsTableResults.vue +534 -506
- package/src/components/table-results/PsTableResultsBody.vue +69 -68
- package/src/components/table-results/PsTableResultsHead.vue +108 -69
- package/src/components/table-results/PsTableResultsHeadComparison.vue +88 -69
- package/src/components/table-results/PsTableResultsHeadFlexible.vue +112 -72
- package/src/components/table-results/PsTableResultsRow.vue +61 -58
- package/src/components/tabs/PsTabHeader.vue +138 -116
- package/src/components/tooltip/PsDialogTooltip.vue +112 -107
- package/src/components/tooltip/PsRichTooltip.vue +46 -43
- package/src/components/tooltip/PsTooltip.vue +126 -122
- package/src/components/ui/PsDotLoader.vue +6 -10
- package/src/components/ui/PsIcon.vue +149 -134
- package/src/index.ts +159 -0
- package/src/tsconfig.json +12 -0
- package/src/types/index.d.ts +6 -0
- package/src/util/GeneralFunctions.js +16 -7
- package/src/util/directives.ts +24 -0
- package/src/util/imageLoader.js +14 -7
- package/tailwind.config.js +12 -3
- package/tsconfig.json +47 -0
- package/.storybook/PolicyStudio.js +0 -10
- package/.storybook/eventBus.js +0 -3
- package/.storybook/main.js +0 -25
- package/.storybook/manager.js +0 -6
- package/babel.config.js +0 -3
- package/backup-package-lock.json +0 -37194
- package/dist/css/psui_styles.css +0 -110890
- package/postcss.config.js +0 -8
- package/src/components/playground/PsScrollBar.vue +0 -248
- package/src/index.js +0 -167
- package/src/stories/Playground.stories.js +0 -16
- /package/{src → doc/src}/assets/images/multifamily-units.svg +0 -0
- /package/{src → doc/src}/assets/images/policy-studio.svg +0 -0
- /package/{src/contents/ComparisonData.js → doc/src/contents/ComparisonData.ts} +0 -0
- /package/{src/contents/FlexibleData.js → doc/src/contents/FlexibleData.ts} +0 -0
- /package/{src/contents/ResultsData.js → doc/src/contents/ResultsData.ts} +0 -0
- /package/{src/stories/Colors.stories.mdx → doc/src/stories/Colors.mdx} +0 -0
- /package/{src → doc/src}/stories/assets/code-brackets.svg +0 -0
- /package/{src → doc/src}/stories/assets/colors.svg +0 -0
- /package/{src → doc/src}/stories/assets/comments.svg +0 -0
- /package/{src → doc/src}/stories/assets/direction.svg +0 -0
- /package/{src → doc/src}/stories/assets/flow.svg +0 -0
- /package/{src → doc/src}/stories/assets/plugin.svg +0 -0
- /package/{src → doc/src}/stories/assets/repo.svg +0 -0
- /package/{src → doc/src}/stories/assets/stackalt.svg +0 -0
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
<div
|
|
3
|
+
class="psui-el-input"
|
|
4
|
+
:class="[getComponentClass, `layout-${layout}`]"
|
|
5
|
+
>
|
|
4
6
|
<label v-if="label"> {{ label }} </label>
|
|
5
7
|
|
|
6
|
-
<div
|
|
8
|
+
<div
|
|
7
9
|
class="psui-el-input-wrapper"
|
|
8
|
-
@mouseenter="
|
|
9
|
-
@mouseleave="
|
|
10
|
+
@mouseenter="emit('mouseenter', $event)"
|
|
11
|
+
@mouseleave="emit('mouseleave', $event)"
|
|
10
12
|
>
|
|
11
|
-
<div
|
|
12
|
-
|
|
13
|
+
<div
|
|
14
|
+
v-if="$slots.prepend"
|
|
15
|
+
class="psui-el-input-prepend"
|
|
16
|
+
>
|
|
17
|
+
<slot name="prepend" />
|
|
13
18
|
</div>
|
|
14
|
-
<PsRichTooltip
|
|
19
|
+
<PsRichTooltip
|
|
15
20
|
class="psui-w-full"
|
|
16
21
|
css-class="psui-w-48"
|
|
17
22
|
:ignore-dialog="!showTooltip"
|
|
18
23
|
>
|
|
19
|
-
<template
|
|
24
|
+
<template #trigger>
|
|
20
25
|
<input
|
|
21
26
|
:title="title"
|
|
22
27
|
:type="type"
|
|
@@ -28,162 +33,174 @@
|
|
|
28
33
|
:max="maxValue"
|
|
29
34
|
@focus="onInputFocus"
|
|
30
35
|
@blur="onInputBlur"
|
|
31
|
-
@input="
|
|
32
|
-
@keydown="
|
|
33
|
-
@change="
|
|
36
|
+
@input="emit('input', $event)"
|
|
37
|
+
@keydown="emit('keydown', $event)"
|
|
38
|
+
@change="emit('change', $event)"
|
|
34
39
|
v-bind="getAttrs"
|
|
35
|
-
:class="{
|
|
36
|
-
|
|
40
|
+
:class="{ focus: isFocus }"
|
|
41
|
+
>
|
|
37
42
|
</template>
|
|
38
|
-
<template
|
|
43
|
+
<template #content>
|
|
39
44
|
<div class="text-left">
|
|
40
45
|
{{ tooltipText }}
|
|
41
46
|
</div>
|
|
42
47
|
</template>
|
|
43
48
|
</PsRichTooltip>
|
|
44
|
-
<div
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
<div
|
|
50
|
+
v-if="$slots.append || hasError"
|
|
51
|
+
class="psui-el-input-append"
|
|
52
|
+
>
|
|
53
|
+
<span
|
|
54
|
+
v-if="hasError"
|
|
55
|
+
class="material-icons psui-text-red-20 material-icons-sharp"
|
|
56
|
+
>error</span>
|
|
57
|
+
<slot
|
|
58
|
+
name="append"
|
|
59
|
+
/>
|
|
47
60
|
</div>
|
|
48
61
|
</div>
|
|
49
62
|
|
|
50
|
-
|
|
63
|
+
<p
|
|
64
|
+
v-if="hint || (hasError && typeof hasError === 'string')"
|
|
65
|
+
class="psui-el-input-hint"
|
|
66
|
+
>
|
|
51
67
|
{{ typeof hasError === 'string' ? hasError : hint }}
|
|
52
68
|
</p>
|
|
53
|
-
|
|
54
|
-
</div>
|
|
69
|
+
</div>
|
|
55
70
|
</template>
|
|
56
71
|
|
|
57
|
-
<script>
|
|
72
|
+
<script setup>
|
|
58
73
|
import PsRichTooltip from '../tooltip/PsRichTooltip.vue'
|
|
74
|
+
import { ref, computed, useAttrs } from 'vue'
|
|
59
75
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
76
|
+
const props = defineProps({
|
|
77
|
+
/**
|
|
78
|
+
* It set the title and also its tooltip default behavior
|
|
79
|
+
*/
|
|
80
|
+
title: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: '',
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* It sets the type of your button. default: text.
|
|
86
|
+
*/
|
|
87
|
+
type: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: 'text',
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* It sets a placeholder for your button if needed.
|
|
93
|
+
*/
|
|
94
|
+
placeholder: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: '',
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* It sets the label of the input if needed.
|
|
100
|
+
*/
|
|
101
|
+
label: {
|
|
102
|
+
type: String,
|
|
103
|
+
default: '',
|
|
104
|
+
},
|
|
105
|
+
/**
|
|
106
|
+
* It sets a text below the input. See Figma Text fileds & Forms.
|
|
107
|
+
*/
|
|
108
|
+
hint: {
|
|
109
|
+
type: String,
|
|
110
|
+
default: '',
|
|
111
|
+
},
|
|
112
|
+
/**
|
|
113
|
+
* It sets the layout of your button. eg: mini and default.
|
|
114
|
+
*/
|
|
115
|
+
layout: {
|
|
116
|
+
type: String,
|
|
117
|
+
default: 'default',
|
|
118
|
+
validator: (value) => ['default', 'mini'].includes(value),
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
121
|
+
* It sets the value of the button.
|
|
122
|
+
*/
|
|
123
|
+
value: {
|
|
124
|
+
required: true,
|
|
125
|
+
},
|
|
126
|
+
/**
|
|
127
|
+
* It disables the input. All mouse events are disabled.
|
|
128
|
+
*/
|
|
129
|
+
disabled: {
|
|
130
|
+
type: Boolean,
|
|
131
|
+
default: false,
|
|
132
|
+
},
|
|
133
|
+
/**
|
|
134
|
+
* It sets if the input found any error.
|
|
135
|
+
*/
|
|
136
|
+
hasError: {
|
|
137
|
+
type: [String, Boolean],
|
|
138
|
+
default: false,
|
|
139
|
+
},
|
|
140
|
+
/**
|
|
141
|
+
* It sets a active css class based on a boolean property.
|
|
142
|
+
*/
|
|
143
|
+
active: {
|
|
144
|
+
type: Boolean,
|
|
145
|
+
default: false,
|
|
64
146
|
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
* It set the title and also its tooltip default behavior
|
|
68
|
-
*/
|
|
69
|
-
title: {
|
|
70
|
-
type: String,
|
|
71
|
-
default: ''
|
|
72
|
-
},
|
|
73
|
-
/**
|
|
74
|
-
* It sets the type of your button. default: text.
|
|
75
|
-
*/
|
|
76
|
-
type: {
|
|
77
|
-
type: String,
|
|
78
|
-
default: 'text'
|
|
79
|
-
},
|
|
80
|
-
/**
|
|
81
|
-
* It sets a placeholder for your button if needed.
|
|
82
|
-
*/
|
|
83
|
-
placeholder: {
|
|
84
|
-
type: String
|
|
85
|
-
},
|
|
86
|
-
/**
|
|
87
|
-
* It sets the label of the input if needed.
|
|
88
|
-
*/
|
|
89
|
-
label: {
|
|
90
|
-
type: String
|
|
91
|
-
},
|
|
92
|
-
/**
|
|
93
|
-
* It sets a text below the input. See Figma Text fileds & Forms.
|
|
94
|
-
*/
|
|
95
|
-
hint: {
|
|
96
|
-
type: String
|
|
97
|
-
},
|
|
98
|
-
/**
|
|
99
|
-
* It sets the layout of your button. eg: mini and default.
|
|
100
|
-
*/
|
|
101
|
-
layout: {
|
|
102
|
-
type: String,
|
|
103
|
-
default: 'default',
|
|
104
|
-
validator: (value) => ['default', 'mini'].includes(value)
|
|
105
|
-
},
|
|
106
|
-
/**
|
|
107
|
-
* It sets the value of the button.
|
|
108
|
-
*/
|
|
109
|
-
value: {
|
|
110
|
-
required: true,
|
|
111
|
-
},
|
|
112
|
-
/**
|
|
113
|
-
* It disables the input. All mouse events are disabled.
|
|
114
|
-
*/
|
|
115
|
-
disabled: {
|
|
116
|
-
type: Boolean,
|
|
117
|
-
default: false
|
|
118
|
-
},
|
|
119
|
-
/**
|
|
120
|
-
* It sets if the input found any error.
|
|
121
|
-
*/
|
|
122
|
-
hasError: {
|
|
123
|
-
type: [String, Boolean],
|
|
124
|
-
default: false
|
|
125
|
-
},
|
|
126
|
-
/**
|
|
127
|
-
* It sets a active css class based on a boolean property.
|
|
128
|
-
*/
|
|
129
|
-
active: {
|
|
130
|
-
type: Boolean,
|
|
131
|
-
default: false
|
|
132
|
-
},
|
|
133
|
-
minValue: {
|
|
134
|
-
type: null
|
|
135
|
-
},
|
|
136
|
-
maxValue: {
|
|
137
|
-
type: null
|
|
138
|
-
},
|
|
139
|
-
step:{
|
|
140
|
-
type: null
|
|
141
|
-
},
|
|
142
|
-
showTooltip: {
|
|
143
|
-
type: Boolean,
|
|
144
|
-
default: false,
|
|
145
|
-
},
|
|
146
|
-
tooltipText: {
|
|
147
|
-
type: String,
|
|
148
|
-
default: '',
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
data: () => ({
|
|
152
|
-
isFocus: false,
|
|
153
|
-
}),
|
|
154
|
-
computed: {
|
|
155
|
-
getAttrs() {
|
|
156
|
-
const defaultAttrs = {
|
|
157
|
-
autocapitalize: 'sentences',
|
|
158
|
-
autocomplete: 'chrome-off',
|
|
159
|
-
autocorrect: 'off',
|
|
160
|
-
spellcheck: 'spellcheck'
|
|
161
|
-
}
|
|
162
|
-
return { ...defaultAttrs, ...this.$attrs }
|
|
163
|
-
},
|
|
164
|
-
getComponentClass() {
|
|
165
|
-
if (this.disabled) {
|
|
166
|
-
return 'status-disabled'
|
|
167
|
-
} else if (this.hasError) {
|
|
168
|
-
return 'status-error'
|
|
169
|
-
} else if (this.isFocus || this.isTyping || this.active ) {
|
|
170
|
-
return 'status-active'
|
|
171
|
-
} else {
|
|
172
|
-
return 'status-resting'
|
|
173
|
-
}
|
|
174
|
-
},
|
|
147
|
+
minValue: {
|
|
148
|
+
type: null,
|
|
175
149
|
},
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
150
|
+
maxValue: {
|
|
151
|
+
type: null,
|
|
152
|
+
},
|
|
153
|
+
step: {
|
|
154
|
+
type: null,
|
|
155
|
+
},
|
|
156
|
+
showTooltip: {
|
|
157
|
+
type: Boolean,
|
|
158
|
+
default: false,
|
|
159
|
+
},
|
|
160
|
+
tooltipText: {
|
|
161
|
+
type: String,
|
|
162
|
+
default: '',
|
|
163
|
+
},
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
const emit = defineEmits(['focus', 'blur', 'mouseenter', 'mouseleave', 'input', 'keydown', 'change'])
|
|
167
|
+
|
|
168
|
+
const isFocus = ref(false)
|
|
169
|
+
const attrs = useAttrs()
|
|
170
|
+
|
|
171
|
+
const getAttrs = computed(() => {
|
|
172
|
+
const defaultAttrs = {
|
|
173
|
+
autocapitalize: 'sentences',
|
|
174
|
+
autocomplete: 'chrome-off',
|
|
175
|
+
autocorrect: 'off',
|
|
176
|
+
spellcheck: 'spellcheck',
|
|
177
|
+
}
|
|
178
|
+
return { ...defaultAttrs, ...attrs }
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
const getComponentClass = computed(() => {
|
|
182
|
+
if (props.disabled) {
|
|
183
|
+
return 'status-disabled'
|
|
184
|
+
} else if (props.hasError) {
|
|
185
|
+
return 'status-error'
|
|
186
|
+
} else if (isFocus.value || props.active) {
|
|
187
|
+
return 'status-active'
|
|
188
|
+
} else {
|
|
189
|
+
return 'status-resting'
|
|
185
190
|
}
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
const onInputFocus = ($event) => {
|
|
194
|
+
isFocus.value = true
|
|
195
|
+
emit('focus', $event)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const onInputBlur = ($event) => {
|
|
199
|
+
isFocus.value = false
|
|
200
|
+
emit('blur', $event)
|
|
186
201
|
}
|
|
187
202
|
</script>
|
|
188
203
|
|
|
189
|
-
<style>
|
|
204
|
+
<style>
|
|
205
|
+
/* Please, use the file src/assets/scss/components/PsInput.scss */
|
|
206
|
+
</style>
|
|
@@ -1,111 +1,132 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
2
|
+
<div
|
|
3
|
+
class="psui-el-input-select"
|
|
4
|
+
:class="[getComponentClass, { selected: selectedClass }, { disabled: disabled }]"
|
|
5
|
+
>
|
|
6
|
+
<label
|
|
7
|
+
:for="label"
|
|
8
|
+
v-if="label"
|
|
9
|
+
>{{ label }}</label>
|
|
4
10
|
<div class="psui-el-input-select-wrapper">
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
<select
|
|
12
|
+
:name="label"
|
|
13
|
+
:id="label"
|
|
14
|
+
v-model="childValue"
|
|
15
|
+
>
|
|
16
|
+
<option
|
|
17
|
+
value=""
|
|
18
|
+
disabled
|
|
19
|
+
>
|
|
20
|
+
Select
|
|
21
|
+
</option>
|
|
22
|
+
<option
|
|
23
|
+
v-for="item in getItems"
|
|
24
|
+
:value="item[keyValue]"
|
|
25
|
+
:key="item[keyValue]"
|
|
26
|
+
>
|
|
27
|
+
{{ item[keyLabel] }}
|
|
28
|
+
</option>
|
|
29
|
+
</select>
|
|
13
30
|
</div>
|
|
14
|
-
<p
|
|
31
|
+
<p
|
|
32
|
+
v-if="optionalLabel && !disabled && layout !== 'mini'"
|
|
33
|
+
class="psui-el-input-helper"
|
|
34
|
+
>
|
|
35
|
+
{{ optionalLabel }}
|
|
36
|
+
</p>
|
|
15
37
|
</div>
|
|
16
38
|
</template>
|
|
17
39
|
|
|
18
|
-
<script>
|
|
40
|
+
<script setup>
|
|
41
|
+
import { ref, computed } from 'vue'
|
|
19
42
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
items: {
|
|
27
|
-
required: true
|
|
28
|
-
},
|
|
29
|
-
value: {
|
|
30
|
-
default: '',
|
|
31
|
-
required: true
|
|
32
|
-
},
|
|
33
|
-
/**
|
|
34
|
-
* It sets the value label of the select input if needed.
|
|
35
|
-
*/
|
|
36
|
-
label: {
|
|
37
|
-
default: ''
|
|
38
|
-
},
|
|
39
|
-
/**
|
|
40
|
-
* It sets a o optional label below the select input.
|
|
41
|
-
*/
|
|
42
|
-
optionalLabel:{
|
|
43
|
-
default:''
|
|
44
|
-
},
|
|
45
|
-
/**
|
|
46
|
-
* It sets the key label of your items if needed.
|
|
47
|
-
*/
|
|
48
|
-
keyLabel: {
|
|
49
|
-
default: 'label'
|
|
50
|
-
},
|
|
51
|
-
/**
|
|
52
|
-
* It sets the key value of yout items if needed.
|
|
53
|
-
*/
|
|
54
|
-
keyValue: {
|
|
55
|
-
default: 'value'
|
|
56
|
-
},
|
|
57
|
-
/**
|
|
58
|
-
* It disables the select input. All mouse events are disabled.
|
|
59
|
-
*/
|
|
60
|
-
disabled: {
|
|
61
|
-
type: Boolean,
|
|
62
|
-
default: false
|
|
63
|
-
},
|
|
64
|
-
/**
|
|
65
|
-
* It sets the layout of the select input. eg: default and mini.
|
|
66
|
-
*/
|
|
67
|
-
layout:{
|
|
68
|
-
type: String,
|
|
69
|
-
default: 'default',
|
|
70
|
-
validator: (value) => ['default','mini'].includes(value)
|
|
71
|
-
}
|
|
43
|
+
const props = defineProps({
|
|
44
|
+
/**
|
|
45
|
+
* It sets the items which will be rendered within the select input.
|
|
46
|
+
*/
|
|
47
|
+
items: {
|
|
48
|
+
required: true,
|
|
72
49
|
},
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
50
|
+
value: {
|
|
51
|
+
default: '',
|
|
52
|
+
required: true,
|
|
77
53
|
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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),
|
|
109
92
|
},
|
|
110
|
-
}
|
|
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
|
|
106
|
+
},
|
|
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
|
+
})
|
|
111
132
|
</script>
|