@cloudron/pankow 3.5.16 → 3.5.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/components/Checkbox.vue
CHANGED
|
@@ -17,7 +17,7 @@ const internalId = uuidv4();
|
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
19
|
<span class="pankow-checkbox">
|
|
20
|
-
<input :id="id || internalId" class="pankow-checkbox-input" type="checkbox" v-model="model" :disabled="disabled" @input="$emit('update:modelValue', $event.target.checked)"/>
|
|
20
|
+
<input :id="id || internalId" class="pankow-checkbox-input" type="checkbox" v-model="model" :disabled="disabled" :required="$attrs['required']" @input="$emit('update:modelValue', $event.target.checked)"/>
|
|
21
21
|
<slot>
|
|
22
22
|
<label :for="id || internalId" class="pankow-checkbox-input-label">
|
|
23
23
|
{{ label }}
|
|
@@ -85,7 +85,8 @@ const menuModel = computed(() => {
|
|
|
85
85
|
emits('select', selected.value);
|
|
86
86
|
|
|
87
87
|
// let the browser know about the changes
|
|
88
|
-
|
|
88
|
+
// multi selects work different than single, we set the value of the first selected item only to react to required
|
|
89
|
+
nativeSelect.value.value = selected.value.length ? selected.value[0] : null;
|
|
89
90
|
nativeSelect.value.dispatchEvent(new Event('input', { bubbles: true }));
|
|
90
91
|
nativeSelect.value.dispatchEvent(new Event('change', { bubbles: true }));
|
|
91
92
|
}
|
|
@@ -120,6 +121,10 @@ const menuModel = computed(() => {
|
|
|
120
121
|
return ret;
|
|
121
122
|
});
|
|
122
123
|
|
|
124
|
+
function isSelected(item) {
|
|
125
|
+
return selected.value.indexOf(props.optionKey ? item[props.optionKey] : item) !== -1;
|
|
126
|
+
}
|
|
127
|
+
|
|
123
128
|
function onClick(event) {
|
|
124
129
|
if (props.disabled) return;
|
|
125
130
|
|
|
@@ -153,7 +158,7 @@ onMounted(() => {
|
|
|
153
158
|
<!-- native select for required and accessibility handling -->
|
|
154
159
|
<select ref="nativeSelect" :required="$attrs['required']" multiple style="display: none">
|
|
155
160
|
<option value=""></option>
|
|
156
|
-
<option v-for="item in options" :value="optionKey ? item[optionKey] : item">{{ optionKey }} - {{ item[optionLabel] }}</option>
|
|
161
|
+
<option v-for="item in options" :value="optionKey ? item[optionKey] : item" :selected="isSelected(item) ? true : null">{{ optionKey }} - {{ item[optionLabel] }}</option>
|
|
157
162
|
</select>
|
|
158
163
|
|
|
159
164
|
<Menu ref="menu" :model="menuModel" :close-on-activation="false" @close="onClose" :search-threshold="searchThreshold"></Menu>
|
|
@@ -107,7 +107,6 @@ function onOpen(event) {
|
|
|
107
107
|
|
|
108
108
|
function onClose(event = null) {
|
|
109
109
|
if (menu.value.isOpen) {
|
|
110
|
-
if (event) event.stopPropagation();
|
|
111
110
|
elem.value.focus();
|
|
112
111
|
menu.value.close();
|
|
113
112
|
emits('close');
|
|
@@ -154,6 +153,8 @@ function onKeyDown(event) {
|
|
|
154
153
|
});
|
|
155
154
|
|
|
156
155
|
if (found !== -1) selectIndex(found);
|
|
156
|
+
|
|
157
|
+
event.stopPropagation();
|
|
157
158
|
}
|
|
158
159
|
|
|
159
160
|
function handleDefaultSelect() {
|
|
@@ -170,7 +171,7 @@ watchEffect(handleDefaultSelect);
|
|
|
170
171
|
</script>
|
|
171
172
|
|
|
172
173
|
<template>
|
|
173
|
-
<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
|
|
174
|
+
<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="onKeyDown($event)">
|
|
174
175
|
<!-- native select for required and accessibility handling -->
|
|
175
176
|
<select v-model="selectedKey" ref="nativeSelect" :required="$attrs['required']" style="display: none">
|
|
176
177
|
<option value=""></option>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudron/pankow",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "3.5.
|
|
4
|
+
"version": "3.5.17",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"types": "types/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@vitejs/plugin-vue": "^6.0.2",
|
|
26
26
|
"typescript": "^5.9.3",
|
|
27
|
-
"vite": "^7.2.
|
|
27
|
+
"vite": "^7.2.7",
|
|
28
28
|
"vue": "^3.5.25"
|
|
29
29
|
}
|
|
30
30
|
}
|