@cloudron/pankow 3.5.0 → 3.5.2
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/components/Checkbox.vue
CHANGED
|
@@ -8,6 +8,10 @@ const props = defineProps({
|
|
|
8
8
|
required: {
|
|
9
9
|
type: Boolean,
|
|
10
10
|
default: false,
|
|
11
|
+
},
|
|
12
|
+
multiline: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: false
|
|
11
15
|
}
|
|
12
16
|
});
|
|
13
17
|
|
|
@@ -24,7 +28,7 @@ const displayValue = computed({
|
|
|
24
28
|
});
|
|
25
29
|
|
|
26
30
|
const isValid = computed(() => {
|
|
27
|
-
if (!props.required) return
|
|
31
|
+
if (!props.required) return false;
|
|
28
32
|
if (model.value === null) return true; // treat masked as satisfying "required"
|
|
29
33
|
return !!model.value;
|
|
30
34
|
});
|
|
@@ -32,7 +36,8 @@ const isValid = computed(() => {
|
|
|
32
36
|
</script>
|
|
33
37
|
|
|
34
38
|
<template>
|
|
35
|
-
<input class="pankow-masked-input" :value="displayValue" :required="isValid" @input="displayValue = $event.target.value" @focus="$event.target.select()" />
|
|
39
|
+
<input v-if="!multiline" class="pankow-masked-input" :value="displayValue" :required="isValid" @input="displayValue = $event.target.value" @focus="$event.target.select()" />
|
|
40
|
+
<textarea v-else :rows="rows" :cols="cols" :required="isValid" :value="displayValue" @input="displayValue = $event.target.value" @focus="$event.target.select()"></textarea>
|
|
36
41
|
</template>
|
|
37
42
|
|
|
38
43
|
<style>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
|
|
3
3
|
import { ref, useTemplateRef, onMounted, computed, watch } from 'vue';
|
|
4
|
-
import Button from './Button.vue';
|
|
5
4
|
import Menu from './Menu.vue';
|
|
6
5
|
import Icon from './Icon.vue';
|
|
7
6
|
|
|
@@ -40,7 +39,7 @@ const props = defineProps({
|
|
|
40
39
|
},
|
|
41
40
|
});
|
|
42
41
|
|
|
43
|
-
const emits = defineEmits(['select']);
|
|
42
|
+
const emits = defineEmits(['select', 'close']);
|
|
44
43
|
|
|
45
44
|
const model = defineModel();
|
|
46
45
|
|
|
@@ -117,6 +116,7 @@ const menuModel = computed(() => {
|
|
|
117
116
|
|
|
118
117
|
function onMenuClosed() {
|
|
119
118
|
elem.value.focus();
|
|
119
|
+
emits('close');
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
function onClick(event) {
|
|
@@ -134,11 +134,7 @@ function onOpen(event) {
|
|
|
134
134
|
|
|
135
135
|
function onClose(event) {
|
|
136
136
|
menu.value.close();
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
function onClosed() {
|
|
140
|
-
// restores the focus
|
|
141
|
-
elem.value.focus();
|
|
137
|
+
emits('close');
|
|
142
138
|
}
|
|
143
139
|
|
|
144
140
|
onMounted(() => {
|
|
@@ -149,6 +145,12 @@ onMounted(() => {
|
|
|
149
145
|
|
|
150
146
|
<template>
|
|
151
147
|
<div class="pankow-multiselect" :class="{ 'pankow-multiselect-disabled': disabled }" ref="elem" tabindex="0" @click="onClick" @keydown.enter="onOpen" @keydown.down.stop="onOpen" @keydown.up.stop="onOpen" @keydown.esc.stop="onClose">
|
|
148
|
+
<!-- native select for required and accessibility handling -->
|
|
149
|
+
<select v-model="selected" :required="$attrs['required']" style="display: none">
|
|
150
|
+
<option value=""></option>
|
|
151
|
+
<option v-for="item in options" :value="optionKey ? item[optionKey] : item">{{ optionKey }} - {{ item[optionLabel] }}</option>
|
|
152
|
+
</select>
|
|
153
|
+
|
|
152
154
|
<Menu ref="menu" :model="menuModel" :close-on-activation="false" @close="onMenuClosed" :search-threshold="searchThreshold"></Menu>
|
|
153
155
|
{{ buttonLabel }}
|
|
154
156
|
<Icon icon="fa-solid fa-chevron-down" class="pankow-button-icon-right-with-text" />
|
|
@@ -162,8 +162,14 @@ onMounted(() => {
|
|
|
162
162
|
|
|
163
163
|
<template>
|
|
164
164
|
<div class="pankow-singleselect" :class="{ 'pankow-singleselect-disabled': disabled }" ref="elem" tabindex="0" @click="onClick" @keydown.enter="onOpen" @keydown.down.stop.prevent="onSelectNext" @keydown.up.stop.prevent="onSelectPrev" @keydown.esc.stop="onClose" @keydown.stop="onKeyDown($event)">
|
|
165
|
+
<!-- native select for required and accessibility handling -->
|
|
166
|
+
<select v-model="selectedKey" :required="$attrs['required']" style="display: none">
|
|
167
|
+
<option value=""></option>
|
|
168
|
+
<option v-for="item in options" :value="optionKey ? item[optionKey] : item">{{ item[optionLabel] }}</option>
|
|
169
|
+
</select>
|
|
170
|
+
|
|
165
171
|
<Menu ref="menu" :model="menuModel" :search-threshold="searchThreshold" :close-on-activation="true" @close="onMenuClosed"/>
|
|
166
|
-
<span>
|
|
172
|
+
<span class="pankow-singleselect-label">
|
|
167
173
|
<Icon v-if="selected ? selected.icon : false" :icon="selected.icon" style="margin-right: 6px" />
|
|
168
174
|
{{ selected ? selected[optionLabel] : placeholder }}
|
|
169
175
|
</span>
|
|
@@ -193,6 +199,7 @@ onMounted(() => {
|
|
|
193
199
|
transition: background-color 250ms;
|
|
194
200
|
min-width: 100px;
|
|
195
201
|
white-space: nowrap;
|
|
202
|
+
overflow: hidden;
|
|
196
203
|
}
|
|
197
204
|
|
|
198
205
|
@media (prefers-color-scheme: dark) {
|
|
@@ -216,4 +223,9 @@ onMounted(() => {
|
|
|
216
223
|
border-color: var(--pankow-input-border-color);
|
|
217
224
|
}
|
|
218
225
|
|
|
226
|
+
.pankow-singleselect-label {
|
|
227
|
+
overflow: hidden;
|
|
228
|
+
text-overflow: ellipsis;
|
|
229
|
+
}
|
|
230
|
+
|
|
219
231
|
</style>
|
package/components/TextInput.vue
CHANGED