@aziontech/webkit 0.0.1
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/package.json +46 -0
- package/src/core/field-auto-complete/field-auto-complete.vue +121 -0
- package/src/core/field-auto-complete/field-auto-complete.vue.d.ts +107 -0
- package/src/core/field-auto-complete/field-auto-complete.vue.d.ts.map +1 -0
- package/src/core/field-auto-complete/package.json +11 -0
- package/src/core/field-checkbox-block/field-checkbox-block.vue +106 -0
- package/src/core/field-checkbox-block/field-checkbox-block.vue.d.ts +111 -0
- package/src/core/field-checkbox-block/field-checkbox-block.vue.d.ts.map +1 -0
- package/src/core/field-checkbox-block/package.json +11 -0
- package/src/core/field-dropdown/field-dropdown.vue +240 -0
- package/src/core/field-dropdown/field-dropdown.vue.d.ts +203 -0
- package/src/core/field-dropdown/field-dropdown.vue.d.ts.map +1 -0
- package/src/core/field-dropdown/package.json +11 -0
- package/src/core/field-dropdown-icon/field-dropdown-icon.vue +129 -0
- package/src/core/field-dropdown-icon/field-dropdown-icon.vue.d.ts +111 -0
- package/src/core/field-dropdown-icon/field-dropdown-icon.vue.d.ts.map +1 -0
- package/src/core/field-dropdown-icon/package.json +11 -0
- package/src/core/field-dropdown-lazy-loader/field-dropdown-lazy-loader.vue +631 -0
- package/src/core/field-dropdown-lazy-loader/field-dropdown-lazy-loader.vue.d.ts +196 -0
- package/src/core/field-dropdown-lazy-loader/field-dropdown-lazy-loader.vue.d.ts.map +1 -0
- package/src/core/field-dropdown-lazy-loader/package.json +11 -0
- package/src/core/field-dropdown-lazy-loader-dynamic/field-dropdown-lazy-loader-dynamic.vue +426 -0
- package/src/core/field-dropdown-lazy-loader-dynamic/field-dropdown-lazy-loader-dynamic.vue.d.ts +158 -0
- package/src/core/field-dropdown-lazy-loader-dynamic/field-dropdown-lazy-loader-dynamic.vue.d.ts.map +1 -0
- package/src/core/field-dropdown-lazy-loader-dynamic/package.json +11 -0
- package/src/core/field-dropdown-lazy-loader-with-filter/field-dropdown-lazy-loader-with-filter.vue +527 -0
- package/src/core/field-dropdown-lazy-loader-with-filter/field-dropdown-lazy-loader-with-filter.vue.d.ts +203 -0
- package/src/core/field-dropdown-lazy-loader-with-filter/field-dropdown-lazy-loader-with-filter.vue.d.ts.map +1 -0
- package/src/core/field-dropdown-lazy-loader-with-filter/package.json +11 -0
- package/src/core/field-dropdown-multi-select-lazy-loader/field-dropdown-multi-select-lazy-loader.vue +439 -0
- package/src/core/field-dropdown-multi-select-lazy-loader/field-dropdown-multi-select-lazy-loader.vue.d.ts +162 -0
- package/src/core/field-dropdown-multi-select-lazy-loader/field-dropdown-multi-select-lazy-loader.vue.d.ts.map +1 -0
- package/src/core/field-dropdown-multi-select-lazy-loader/package.json +11 -0
- package/src/core/field-group-checkbox/field-group-checkbox.vue +102 -0
- package/src/core/field-group-checkbox/field-group-checkbox.vue.d.ts +87 -0
- package/src/core/field-group-checkbox/field-group-checkbox.vue.d.ts.map +1 -0
- package/src/core/field-group-checkbox/package.json +11 -0
- package/src/core/field-group-radio/field-group-radio.vue +149 -0
- package/src/core/field-group-radio/field-group-radio.vue.d.ts +99 -0
- package/src/core/field-group-radio/field-group-radio.vue.d.ts.map +1 -0
- package/src/core/field-group-radio/package.json +11 -0
- package/src/core/field-group-switch/field-group-switch.vue +121 -0
- package/src/core/field-group-switch/field-group-switch.vue.d.ts +87 -0
- package/src/core/field-group-switch/field-group-switch.vue.d.ts.map +1 -0
- package/src/core/field-group-switch/package.json +11 -0
- package/src/core/field-input-group/field-input-group.vue +111 -0
- package/src/core/field-input-group/field-input-group.vue.d.ts +87 -0
- package/src/core/field-input-group/field-input-group.vue.d.ts.map +1 -0
- package/src/core/field-input-group/package.json +11 -0
- package/src/core/field-multi-select/field-multi-select.vue +167 -0
- package/src/core/field-multi-select/field-multi-select.vue.d.ts +136 -0
- package/src/core/field-multi-select/field-multi-select.vue.d.ts.map +1 -0
- package/src/core/field-multi-select/package.json +11 -0
- package/src/core/field-number/field-number.vue +144 -0
- package/src/core/field-number/field-number.vue.d.ts +132 -0
- package/src/core/field-number/field-number.vue.d.ts.map +1 -0
- package/src/core/field-number/package.json +11 -0
- package/src/core/field-phone-number/field-phone-number.vue +151 -0
- package/src/core/field-phone-number/field-phone-number.vue.d.ts +76 -0
- package/src/core/field-phone-number/field-phone-number.vue.d.ts.map +1 -0
- package/src/core/field-phone-number/package.json +11 -0
- package/src/core/field-phone-number-country/field-phone-number-country.vue +60 -0
- package/src/core/field-phone-number-country/field-phone-number-country.vue.d.ts +18 -0
- package/src/core/field-phone-number-country/field-phone-number-country.vue.d.ts.map +1 -0
- package/src/core/field-phone-number-country/package.json +11 -0
- package/src/core/field-pick-list/field-pick-list.vue +285 -0
- package/src/core/field-pick-list/field-pick-list.vue.d.ts +43 -0
- package/src/core/field-pick-list/field-pick-list.vue.d.ts.map +1 -0
- package/src/core/field-pick-list/package.json +11 -0
- package/src/core/field-radio-block/field-radio-block.vue +108 -0
- package/src/core/field-radio-block/field-radio-block.vue.d.ts +115 -0
- package/src/core/field-radio-block/field-radio-block.vue.d.ts.map +1 -0
- package/src/core/field-radio-block/package.json +11 -0
- package/src/core/field-switch/field-switch.vue +41 -0
- package/src/core/field-switch/field-switch.vue.d.ts +33 -0
- package/src/core/field-switch/field-switch.vue.d.ts.map +1 -0
- package/src/core/field-switch/package.json +11 -0
- package/src/core/field-switch-block/field-switch-block.vue +123 -0
- package/src/core/field-switch-block/field-switch-block.vue.d.ts +123 -0
- package/src/core/field-switch-block/field-switch-block.vue.d.ts.map +1 -0
- package/src/core/field-switch-block/package.json +11 -0
- package/src/core/field-text/field-text.vue +128 -0
- package/src/core/field-text/field-text.vue.d.ts +108 -0
- package/src/core/field-text/field-text.vue.d.ts.map +1 -0
- package/src/core/field-text/package.json +11 -0
- package/src/core/field-text-area/field-text-area.vue +178 -0
- package/src/core/field-text-area/field-text-area.vue.d.ts +142 -0
- package/src/core/field-text-area/field-text-area.vue.d.ts.map +1 -0
- package/src/core/field-text-area/package.json +11 -0
- package/src/core/field-text-icon/field-text-icon.vue +127 -0
- package/src/core/field-text-icon/field-text-icon.vue.d.ts +100 -0
- package/src/core/field-text-icon/field-text-icon.vue.d.ts.map +1 -0
- package/src/core/field-text-icon/package.json +11 -0
- package/src/core/field-text-password/field-text-password.vue +127 -0
- package/src/core/field-text-password/field-text-password.vue.d.ts +108 -0
- package/src/core/field-text-password/field-text-password.vue.d.ts.map +1 -0
- package/src/core/field-text-password/package.json +11 -0
- package/src/core/label/label.vue +35 -0
- package/src/core/label/label.vue.d.ts +24 -0
- package/src/core/label/label.vue.d.ts.map +1 -0
- package/src/core/label/package.json +11 -0
- package/src/core/selector-block/package.json +11 -0
- package/src/core/selector-block/selector-block.vue +128 -0
- package/src/core/selector-block/selector-block.vue.d.ts +99 -0
- package/src/core/selector-block/selector-block.vue.d.ts.map +1 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref, toRef, useAttrs, useSlots } from 'vue'
|
|
3
|
+
import { useField } from 'vee-validate'
|
|
4
|
+
import TextArea from 'primevue/textarea'
|
|
5
|
+
import Skeleton from 'primevue/skeleton'
|
|
6
|
+
import LabelBlock from '../label'
|
|
7
|
+
|
|
8
|
+
const emit = defineEmits(['blur', 'input'])
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
value: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: ''
|
|
13
|
+
},
|
|
14
|
+
name: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true
|
|
17
|
+
},
|
|
18
|
+
label: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true
|
|
21
|
+
},
|
|
22
|
+
placeholder: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: ''
|
|
25
|
+
},
|
|
26
|
+
description: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: ''
|
|
29
|
+
},
|
|
30
|
+
rows: {
|
|
31
|
+
type: [Number, String],
|
|
32
|
+
default: 5
|
|
33
|
+
},
|
|
34
|
+
cols: {
|
|
35
|
+
type: Number,
|
|
36
|
+
default: 30
|
|
37
|
+
},
|
|
38
|
+
autoResize: {
|
|
39
|
+
type: Boolean
|
|
40
|
+
},
|
|
41
|
+
disabled: {
|
|
42
|
+
type: Boolean
|
|
43
|
+
},
|
|
44
|
+
icon: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: ''
|
|
47
|
+
},
|
|
48
|
+
iconPosition: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: 'right'
|
|
51
|
+
},
|
|
52
|
+
sensitive: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false
|
|
55
|
+
},
|
|
56
|
+
aditionalError: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: ''
|
|
59
|
+
},
|
|
60
|
+
loading: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: false
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
const inputRef = ref(null)
|
|
67
|
+
const name = toRef(props, 'name')
|
|
68
|
+
const slots = useSlots()
|
|
69
|
+
const hasDescriptionSlot = !!slots.description
|
|
70
|
+
const {
|
|
71
|
+
value: inputValue,
|
|
72
|
+
errorMessage: veeValidateErrorMessage,
|
|
73
|
+
handleBlur,
|
|
74
|
+
handleChange
|
|
75
|
+
} = useField(name, undefined, {
|
|
76
|
+
initialValue: props.value
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
const attrs = useAttrs()
|
|
80
|
+
|
|
81
|
+
const customTestId = computed(() => {
|
|
82
|
+
const id = attrs['data-testid'] || 'field-text'
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
label: `${id}__label`,
|
|
86
|
+
textarea: `${id}__textarea`,
|
|
87
|
+
description: `${id}__description`,
|
|
88
|
+
error: `${id}__error-message`
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
const iconPositionClass = computed(() => {
|
|
93
|
+
return props.icon ? `p-input-icon-${props.iconPosition}` : ''
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
const onBlur = (event) => {
|
|
97
|
+
handleBlur(event)
|
|
98
|
+
emit('blur', event)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const onChange = (event) => {
|
|
102
|
+
handleChange(event)
|
|
103
|
+
emit('input', event.target.value)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const ROW_HEIGHT_REM = 1.5
|
|
107
|
+
const MIN_HEIGHT_REM = 2.75
|
|
108
|
+
const PADDING_REM = 1.5
|
|
109
|
+
|
|
110
|
+
const textareaHeight = computed(() => {
|
|
111
|
+
const rows = Number(props.rows)
|
|
112
|
+
const height = Math.max(rows * ROW_HEIGHT_REM + PADDING_REM, MIN_HEIGHT_REM)
|
|
113
|
+
return `${height}rem`
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
defineExpose({ inputRef })
|
|
117
|
+
</script>
|
|
118
|
+
|
|
119
|
+
<template>
|
|
120
|
+
<LabelBlock
|
|
121
|
+
:for="props.name"
|
|
122
|
+
:data-testid="customTestId.label"
|
|
123
|
+
:label="props.label"
|
|
124
|
+
:isRequired="attrs.required"
|
|
125
|
+
/>
|
|
126
|
+
<span
|
|
127
|
+
class="w-full"
|
|
128
|
+
:class="iconPositionClass"
|
|
129
|
+
>
|
|
130
|
+
<i
|
|
131
|
+
v-if="props.icon"
|
|
132
|
+
:class="props.icon"
|
|
133
|
+
class="text-color-secondary top-5 right-5"
|
|
134
|
+
/>
|
|
135
|
+
<!-- Skeleton only for textarea input -->
|
|
136
|
+
<Skeleton
|
|
137
|
+
v-if="props.loading"
|
|
138
|
+
width="100%"
|
|
139
|
+
:height="textareaHeight"
|
|
140
|
+
borderRadius="6px"
|
|
141
|
+
/>
|
|
142
|
+
<TextArea
|
|
143
|
+
v-else
|
|
144
|
+
v-bind="sensitive ? { 'data-sentry-mask': '' } : {}"
|
|
145
|
+
v-model="inputValue"
|
|
146
|
+
ref="inputRef"
|
|
147
|
+
type="text"
|
|
148
|
+
class="w-full min-h-[2.75rem]"
|
|
149
|
+
:class="[{ 'p-invalid': aditionalError || veeValidateErrorMessage }, props.class]"
|
|
150
|
+
:id="name"
|
|
151
|
+
:data-testid="customTestId.textarea"
|
|
152
|
+
:name="props.name"
|
|
153
|
+
:disabled="props.disabled"
|
|
154
|
+
:autoResize="props.autoResize"
|
|
155
|
+
:rows="props.rows"
|
|
156
|
+
:cols="props.cols"
|
|
157
|
+
:placeholder="props.placeholder"
|
|
158
|
+
@input="onChange"
|
|
159
|
+
@blur="onBlur"
|
|
160
|
+
/>
|
|
161
|
+
</span>
|
|
162
|
+
<small
|
|
163
|
+
v-if="aditionalError || veeValidateErrorMessage"
|
|
164
|
+
class="p-error text-xs font-normal leading-tight"
|
|
165
|
+
:data-testid="customTestId.error"
|
|
166
|
+
>
|
|
167
|
+
{{ aditionalError || veeValidateErrorMessage }}
|
|
168
|
+
</small>
|
|
169
|
+
<small
|
|
170
|
+
class="text-xs text-color-secondary font-normal leading-5"
|
|
171
|
+
:data-testid="customTestId.description"
|
|
172
|
+
v-if="props.description || hasDescriptionSlot"
|
|
173
|
+
>
|
|
174
|
+
<slot name="description">
|
|
175
|
+
{{ props.description }}
|
|
176
|
+
</slot>
|
|
177
|
+
</small>
|
|
178
|
+
</template>
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
4
|
+
type __VLS_WithSlots<T, S> = T & (new () => {
|
|
5
|
+
$slots: S;
|
|
6
|
+
});
|
|
7
|
+
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
8
|
+
value: {
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
default: string;
|
|
11
|
+
};
|
|
12
|
+
name: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
required: true;
|
|
15
|
+
};
|
|
16
|
+
label: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
required: true;
|
|
19
|
+
};
|
|
20
|
+
placeholder: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
default: string;
|
|
23
|
+
};
|
|
24
|
+
description: {
|
|
25
|
+
type: StringConstructor;
|
|
26
|
+
default: string;
|
|
27
|
+
};
|
|
28
|
+
rows: {
|
|
29
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
30
|
+
default: number;
|
|
31
|
+
};
|
|
32
|
+
cols: {
|
|
33
|
+
type: NumberConstructor;
|
|
34
|
+
default: number;
|
|
35
|
+
};
|
|
36
|
+
autoResize: {
|
|
37
|
+
type: BooleanConstructor;
|
|
38
|
+
};
|
|
39
|
+
disabled: {
|
|
40
|
+
type: BooleanConstructor;
|
|
41
|
+
};
|
|
42
|
+
icon: {
|
|
43
|
+
type: StringConstructor;
|
|
44
|
+
default: string;
|
|
45
|
+
};
|
|
46
|
+
iconPosition: {
|
|
47
|
+
type: StringConstructor;
|
|
48
|
+
default: string;
|
|
49
|
+
};
|
|
50
|
+
sensitive: {
|
|
51
|
+
type: BooleanConstructor;
|
|
52
|
+
default: boolean;
|
|
53
|
+
};
|
|
54
|
+
aditionalError: {
|
|
55
|
+
type: StringConstructor;
|
|
56
|
+
default: string;
|
|
57
|
+
};
|
|
58
|
+
loading: {
|
|
59
|
+
type: BooleanConstructor;
|
|
60
|
+
default: boolean;
|
|
61
|
+
};
|
|
62
|
+
}>, {
|
|
63
|
+
inputRef: import("vue").Ref<null, null>;
|
|
64
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
65
|
+
input: (...args: any[]) => void;
|
|
66
|
+
blur: (...args: any[]) => void;
|
|
67
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
68
|
+
value: {
|
|
69
|
+
type: StringConstructor;
|
|
70
|
+
default: string;
|
|
71
|
+
};
|
|
72
|
+
name: {
|
|
73
|
+
type: StringConstructor;
|
|
74
|
+
required: true;
|
|
75
|
+
};
|
|
76
|
+
label: {
|
|
77
|
+
type: StringConstructor;
|
|
78
|
+
required: true;
|
|
79
|
+
};
|
|
80
|
+
placeholder: {
|
|
81
|
+
type: StringConstructor;
|
|
82
|
+
default: string;
|
|
83
|
+
};
|
|
84
|
+
description: {
|
|
85
|
+
type: StringConstructor;
|
|
86
|
+
default: string;
|
|
87
|
+
};
|
|
88
|
+
rows: {
|
|
89
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
90
|
+
default: number;
|
|
91
|
+
};
|
|
92
|
+
cols: {
|
|
93
|
+
type: NumberConstructor;
|
|
94
|
+
default: number;
|
|
95
|
+
};
|
|
96
|
+
autoResize: {
|
|
97
|
+
type: BooleanConstructor;
|
|
98
|
+
};
|
|
99
|
+
disabled: {
|
|
100
|
+
type: BooleanConstructor;
|
|
101
|
+
};
|
|
102
|
+
icon: {
|
|
103
|
+
type: StringConstructor;
|
|
104
|
+
default: string;
|
|
105
|
+
};
|
|
106
|
+
iconPosition: {
|
|
107
|
+
type: StringConstructor;
|
|
108
|
+
default: string;
|
|
109
|
+
};
|
|
110
|
+
sensitive: {
|
|
111
|
+
type: BooleanConstructor;
|
|
112
|
+
default: boolean;
|
|
113
|
+
};
|
|
114
|
+
aditionalError: {
|
|
115
|
+
type: StringConstructor;
|
|
116
|
+
default: string;
|
|
117
|
+
};
|
|
118
|
+
loading: {
|
|
119
|
+
type: BooleanConstructor;
|
|
120
|
+
default: boolean;
|
|
121
|
+
};
|
|
122
|
+
}>> & Readonly<{
|
|
123
|
+
onInput?: ((...args: any[]) => any) | undefined;
|
|
124
|
+
onBlur?: ((...args: any[]) => any) | undefined;
|
|
125
|
+
}>, {
|
|
126
|
+
value: string;
|
|
127
|
+
placeholder: string;
|
|
128
|
+
description: string;
|
|
129
|
+
disabled: boolean;
|
|
130
|
+
icon: string;
|
|
131
|
+
loading: boolean;
|
|
132
|
+
aditionalError: string;
|
|
133
|
+
sensitive: boolean;
|
|
134
|
+
rows: string | number;
|
|
135
|
+
cols: number;
|
|
136
|
+
autoResize: boolean;
|
|
137
|
+
iconPosition: string;
|
|
138
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
139
|
+
type __VLS_Slots = {
|
|
140
|
+
description?: ((props: {}) => any) | undefined;
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=field-text-area.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-text-area.vue.d.ts","sourceRoot":"","sources":["field-text-area.vue"],"names":[],"mappings":"wBA0gBqB,OAAO,YAAY;;AADxC,4BAA2B,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;qBAEtD,CAAC,EAAE,CAAC;;;AA9DzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6EA2DG"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, toRef, ref, watch } from 'vue'
|
|
3
|
+
import { useField } from 'vee-validate'
|
|
4
|
+
import InputText from 'primevue/inputtext'
|
|
5
|
+
import LabelBlock from '../label'
|
|
6
|
+
const emit = defineEmits(['click-icon'])
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
value: {
|
|
9
|
+
type: String,
|
|
10
|
+
default: ''
|
|
11
|
+
},
|
|
12
|
+
name: {
|
|
13
|
+
type: String,
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
label: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: ''
|
|
19
|
+
},
|
|
20
|
+
placeholder: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: ''
|
|
23
|
+
},
|
|
24
|
+
description: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: ''
|
|
27
|
+
},
|
|
28
|
+
disabled: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
},
|
|
32
|
+
readonly: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false
|
|
35
|
+
},
|
|
36
|
+
icon: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: ''
|
|
39
|
+
},
|
|
40
|
+
iconPosition: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: 'right'
|
|
43
|
+
},
|
|
44
|
+
required: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
const nameInput = toRef(props, 'name')
|
|
51
|
+
|
|
52
|
+
const inputValue = ref(props.value)
|
|
53
|
+
const errorMessage = ref('')
|
|
54
|
+
let handleBlur = () => {}
|
|
55
|
+
let handleChange = () => {}
|
|
56
|
+
|
|
57
|
+
if (!props.disabled) {
|
|
58
|
+
const field = useField(nameInput, undefined, {
|
|
59
|
+
initialValue: props.value
|
|
60
|
+
})
|
|
61
|
+
inputValue.value = field.value
|
|
62
|
+
errorMessage.value = field.errorMessage
|
|
63
|
+
handleBlur = field.handleBlur
|
|
64
|
+
handleChange = field.handleChange
|
|
65
|
+
} else {
|
|
66
|
+
watch(
|
|
67
|
+
() => props.value,
|
|
68
|
+
(newValue) => {
|
|
69
|
+
inputValue.value = newValue
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const iconPositionClass = computed(() => {
|
|
75
|
+
return props.icon ? `p-input-icon-${props.iconPosition}` : ''
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const handleClick = () => {
|
|
79
|
+
emit('click-icon')
|
|
80
|
+
}
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
<template>
|
|
84
|
+
<LabelBlock
|
|
85
|
+
:for="props.name"
|
|
86
|
+
:label="props.label"
|
|
87
|
+
:isRequired="props.required"
|
|
88
|
+
/>
|
|
89
|
+
<span
|
|
90
|
+
class="w-full"
|
|
91
|
+
:class="iconPositionClass"
|
|
92
|
+
>
|
|
93
|
+
<i
|
|
94
|
+
v-if="props.icon"
|
|
95
|
+
:class="props.icon"
|
|
96
|
+
class="text-color-secondary cursor-pointer"
|
|
97
|
+
@click="handleClick"
|
|
98
|
+
/>
|
|
99
|
+
<InputText
|
|
100
|
+
:id="props.name"
|
|
101
|
+
v-model="inputValue"
|
|
102
|
+
:name="props.name"
|
|
103
|
+
:readonly="props.readonly"
|
|
104
|
+
:disabled="props.disabled"
|
|
105
|
+
type="text"
|
|
106
|
+
class="w-full"
|
|
107
|
+
:class="{ 'p-invalid': errorMessage }"
|
|
108
|
+
:placeholder="props.placeholder"
|
|
109
|
+
@input="handleChange"
|
|
110
|
+
@blur="handleBlur"
|
|
111
|
+
v-bind="$attrs"
|
|
112
|
+
/>
|
|
113
|
+
</span>
|
|
114
|
+
|
|
115
|
+
<small
|
|
116
|
+
v-if="errorMessage"
|
|
117
|
+
class="p-error text-xs font-normal leading-tight"
|
|
118
|
+
>
|
|
119
|
+
{{ errorMessage }}
|
|
120
|
+
</small>
|
|
121
|
+
<small
|
|
122
|
+
class="text-xs text-color-secondary font-normal leading-5"
|
|
123
|
+
v-if="props.description"
|
|
124
|
+
>
|
|
125
|
+
{{ props.description }}
|
|
126
|
+
</small>
|
|
127
|
+
</template>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
value: {
|
|
5
|
+
type: StringConstructor;
|
|
6
|
+
default: string;
|
|
7
|
+
};
|
|
8
|
+
name: {
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
required: true;
|
|
11
|
+
};
|
|
12
|
+
label: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
default: string;
|
|
15
|
+
};
|
|
16
|
+
placeholder: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
20
|
+
description: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
default: string;
|
|
23
|
+
};
|
|
24
|
+
disabled: {
|
|
25
|
+
type: BooleanConstructor;
|
|
26
|
+
default: boolean;
|
|
27
|
+
};
|
|
28
|
+
readonly: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
default: boolean;
|
|
31
|
+
};
|
|
32
|
+
icon: {
|
|
33
|
+
type: StringConstructor;
|
|
34
|
+
default: string;
|
|
35
|
+
};
|
|
36
|
+
iconPosition: {
|
|
37
|
+
type: StringConstructor;
|
|
38
|
+
default: string;
|
|
39
|
+
};
|
|
40
|
+
required: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
default: boolean;
|
|
43
|
+
};
|
|
44
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
45
|
+
"click-icon": (...args: any[]) => void;
|
|
46
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
47
|
+
value: {
|
|
48
|
+
type: StringConstructor;
|
|
49
|
+
default: string;
|
|
50
|
+
};
|
|
51
|
+
name: {
|
|
52
|
+
type: StringConstructor;
|
|
53
|
+
required: true;
|
|
54
|
+
};
|
|
55
|
+
label: {
|
|
56
|
+
type: StringConstructor;
|
|
57
|
+
default: string;
|
|
58
|
+
};
|
|
59
|
+
placeholder: {
|
|
60
|
+
type: StringConstructor;
|
|
61
|
+
default: string;
|
|
62
|
+
};
|
|
63
|
+
description: {
|
|
64
|
+
type: StringConstructor;
|
|
65
|
+
default: string;
|
|
66
|
+
};
|
|
67
|
+
disabled: {
|
|
68
|
+
type: BooleanConstructor;
|
|
69
|
+
default: boolean;
|
|
70
|
+
};
|
|
71
|
+
readonly: {
|
|
72
|
+
type: BooleanConstructor;
|
|
73
|
+
default: boolean;
|
|
74
|
+
};
|
|
75
|
+
icon: {
|
|
76
|
+
type: StringConstructor;
|
|
77
|
+
default: string;
|
|
78
|
+
};
|
|
79
|
+
iconPosition: {
|
|
80
|
+
type: StringConstructor;
|
|
81
|
+
default: string;
|
|
82
|
+
};
|
|
83
|
+
required: {
|
|
84
|
+
type: BooleanConstructor;
|
|
85
|
+
default: boolean;
|
|
86
|
+
};
|
|
87
|
+
}>> & Readonly<{
|
|
88
|
+
"onClick-icon"?: ((...args: any[]) => any) | undefined;
|
|
89
|
+
}>, {
|
|
90
|
+
value: string;
|
|
91
|
+
required: boolean;
|
|
92
|
+
label: string;
|
|
93
|
+
placeholder: string;
|
|
94
|
+
description: string;
|
|
95
|
+
disabled: boolean;
|
|
96
|
+
readonly: boolean;
|
|
97
|
+
icon: string;
|
|
98
|
+
iconPosition: string;
|
|
99
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
100
|
+
//# sourceMappingURL=field-text-icon.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-text-icon.vue.d.ts","sourceRoot":"","sources":["field-text-icon.vue"],"names":[],"mappings":"wBAoXqB,OAAO,YAAY;;AA7CxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6EA4CG"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref, toRef, useAttrs, useSlots } from 'vue'
|
|
3
|
+
import { useField } from 'vee-validate'
|
|
4
|
+
import Password from 'primevue/password'
|
|
5
|
+
import LabelBlock from '../label'
|
|
6
|
+
|
|
7
|
+
const emit = defineEmits(['blur', 'input'])
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
value: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: ''
|
|
12
|
+
},
|
|
13
|
+
class: {
|
|
14
|
+
type: String
|
|
15
|
+
},
|
|
16
|
+
name: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: true
|
|
19
|
+
},
|
|
20
|
+
label: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: ''
|
|
23
|
+
},
|
|
24
|
+
placeholder: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: ''
|
|
27
|
+
},
|
|
28
|
+
description: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: ''
|
|
31
|
+
},
|
|
32
|
+
disabled: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false
|
|
35
|
+
},
|
|
36
|
+
readonly: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false
|
|
39
|
+
},
|
|
40
|
+
sensitive: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false
|
|
43
|
+
},
|
|
44
|
+
aditionalError: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: ''
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
const inputPasswordRef = ref(null)
|
|
50
|
+
const name = toRef(props, 'name')
|
|
51
|
+
const slots = useSlots()
|
|
52
|
+
const attrs = useAttrs()
|
|
53
|
+
const hasDescriptionSlot = !!slots.description
|
|
54
|
+
|
|
55
|
+
const customTestId = computed(() => {
|
|
56
|
+
const id = attrs['data-testid'] || 'field-text'
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
label: `${id}__label`,
|
|
60
|
+
input: `${id}__input`,
|
|
61
|
+
description: `${id}__description`,
|
|
62
|
+
error: `${id}__error-message`
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
const {
|
|
67
|
+
value: inputValue,
|
|
68
|
+
errorMessage: veeValidateErrorMessage,
|
|
69
|
+
handleBlur,
|
|
70
|
+
handleChange
|
|
71
|
+
} = useField(name, undefined, {
|
|
72
|
+
initialValue: props.value
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
const onBlur = (event) => {
|
|
76
|
+
handleBlur(event)
|
|
77
|
+
emit('blur', event)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const onChange = (event) => {
|
|
81
|
+
handleChange(event)
|
|
82
|
+
emit('input', event.target.value)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
defineExpose({ inputPasswordRef })
|
|
86
|
+
</script>
|
|
87
|
+
|
|
88
|
+
<template>
|
|
89
|
+
<LabelBlock
|
|
90
|
+
v-if="props.label"
|
|
91
|
+
:for="props.name"
|
|
92
|
+
:data-testid="customTestId.label"
|
|
93
|
+
:label="props.label"
|
|
94
|
+
:isRequired="attrs.required"
|
|
95
|
+
/>
|
|
96
|
+
<Password
|
|
97
|
+
toggleMask
|
|
98
|
+
ref="inputPasswordRef"
|
|
99
|
+
v-model="inputValue"
|
|
100
|
+
:id="name"
|
|
101
|
+
:name="name"
|
|
102
|
+
:readonly="readonly"
|
|
103
|
+
:disabled="disabled"
|
|
104
|
+
:placeholder="props.placeholder"
|
|
105
|
+
:class="[{ 'p-invalid': aditionalError || veeValidateErrorMessage }, props.class]"
|
|
106
|
+
:feedback="false"
|
|
107
|
+
:data-testid="customTestId.input"
|
|
108
|
+
@input="onChange"
|
|
109
|
+
@blur="onBlur"
|
|
110
|
+
/>
|
|
111
|
+
<small
|
|
112
|
+
v-if="aditionalError || veeValidateErrorMessage"
|
|
113
|
+
class="p-error text-xs font-normal leading-tight"
|
|
114
|
+
:data-testid="customTestId.error"
|
|
115
|
+
>
|
|
116
|
+
{{ aditionalError || veeValidateErrorMessage }}
|
|
117
|
+
</small>
|
|
118
|
+
<small
|
|
119
|
+
v-if="props.description || hasDescriptionSlot"
|
|
120
|
+
class="text-xs text-color-secondary font-normal leading-5"
|
|
121
|
+
:data-testid="customTestId.description"
|
|
122
|
+
>
|
|
123
|
+
<slot name="description">
|
|
124
|
+
{{ props.description }}
|
|
125
|
+
</slot>
|
|
126
|
+
</small>
|
|
127
|
+
</template>
|