@cloudron/pankow 4.1.5 → 4.1.7
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.
|
@@ -16,10 +16,12 @@ const rejectLabel = ref('No');
|
|
|
16
16
|
const rejectStyle = ref('');
|
|
17
17
|
const isPrompt = ref(false);
|
|
18
18
|
const isMultiValue = ref(false);
|
|
19
|
+
const autoCloseOnConfirm = ref(true);
|
|
19
20
|
const value = ref([]);
|
|
20
21
|
const required = ref([]);
|
|
21
22
|
const placeholder = ref('');
|
|
22
23
|
const internalId = ref(uuidv4());
|
|
24
|
+
const confirmBusy = ref(false);
|
|
23
25
|
|
|
24
26
|
const dialog = useTemplateRef('dialog');
|
|
25
27
|
|
|
@@ -46,6 +48,8 @@ function reset() {
|
|
|
46
48
|
rejectStyle.value = '';
|
|
47
49
|
isPrompt.value = false;
|
|
48
50
|
isMultiValue.value = false;
|
|
51
|
+
autoCloseOnConfirm.value = true;
|
|
52
|
+
confirmBusy.value = false;
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
function info(options) {
|
|
@@ -81,6 +85,8 @@ function confirm(options) {
|
|
|
81
85
|
if (options.confirmStyle) confirmStyle.value = options.confirmStyle;
|
|
82
86
|
if (options.rejectStyle) rejectStyle.value = options.rejectStyle;
|
|
83
87
|
|
|
88
|
+
if (typeof options.autoCloseOnConfirm !== 'undefined') autoCloseOnConfirm.value = !!options.autoCloseOnConfirm;
|
|
89
|
+
|
|
84
90
|
dialog.value.open();
|
|
85
91
|
|
|
86
92
|
return new Promise((resolve, reject) => {
|
|
@@ -117,28 +123,41 @@ function prompt(options) {
|
|
|
117
123
|
});
|
|
118
124
|
}
|
|
119
125
|
|
|
126
|
+
function close() {
|
|
127
|
+
dialog.value.close();
|
|
128
|
+
confirmBusy.value = false;
|
|
129
|
+
}
|
|
130
|
+
|
|
120
131
|
function onConfirmed() {
|
|
121
132
|
if (!isFormValid.value) return;
|
|
122
133
|
|
|
123
|
-
|
|
124
|
-
|
|
134
|
+
const result = isPrompt.value ? (isMultiValue.value ? value.value : value.value[0]) : true;
|
|
135
|
+
|
|
136
|
+
resolver(result);
|
|
137
|
+
|
|
138
|
+
if (!result || autoCloseOnConfirm.value) {
|
|
139
|
+
dialog.value.close();
|
|
140
|
+
} else {
|
|
141
|
+
confirmBusy.value = true;
|
|
142
|
+
}
|
|
125
143
|
}
|
|
126
144
|
|
|
127
145
|
function onRejected() {
|
|
146
|
+
close();
|
|
128
147
|
resolver(isPrompt.value ? null : false);
|
|
129
|
-
dialog.value.close();
|
|
130
148
|
}
|
|
131
149
|
|
|
132
150
|
defineExpose({
|
|
133
151
|
info,
|
|
134
152
|
confirm,
|
|
135
153
|
prompt,
|
|
154
|
+
close,
|
|
136
155
|
});
|
|
137
156
|
|
|
138
157
|
</script>
|
|
139
158
|
|
|
140
159
|
<template>
|
|
141
|
-
<Dialog ref="dialog" :title="title" :confirm-active="isFormValid" :confirm-label="confirmLabel" :rejectLabel="rejectLabel" :rejectStyle="rejectStyle" :confirmStyle="confirmStyle" @confirm="onConfirmed()" @close="onRejected()" :z-index="2003">
|
|
160
|
+
<Dialog ref="dialog" :title="title" :confirm-active="isFormValid" :confirm-busy="confirmBusy" :confirm-label="confirmLabel" :rejectLabel="rejectLabel" :rejectStyle="rejectStyle" :confirmStyle="confirmStyle" @confirm="onConfirmed()" @close="onRejected()" :z-index="2003">
|
|
142
161
|
<div v-if="isPrompt" class="pankow-input-dialog-prompt" v-for="(msg, index) in message">
|
|
143
162
|
<label :for="internalId+index" v-html="msg"></label>
|
|
144
163
|
<PasswordInput :id="internalId+index" v-if="type[index] === 'password'" v-model="value[index]" :placeholder="placeholder[index]" @keydown.enter="onConfirmed()"/>
|
|
@@ -10,6 +10,7 @@ const props = defineProps({
|
|
|
10
10
|
type: String,
|
|
11
11
|
default: 'Select'
|
|
12
12
|
},
|
|
13
|
+
id: String,
|
|
13
14
|
optionLabel: {
|
|
14
15
|
type: String,
|
|
15
16
|
default: 'label'
|
|
@@ -173,7 +174,7 @@ watchEffect(handleDefaultSelect);
|
|
|
173
174
|
<template>
|
|
174
175
|
<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)">
|
|
175
176
|
<!-- native select for required and accessibility handling -->
|
|
176
|
-
<select v-model="selectedKey" ref="nativeSelect" :required="$attrs['required']" style="display: none">
|
|
177
|
+
<select v-model="selectedKey" :id="id" ref="nativeSelect" :required="$attrs['required']" style="display: none">
|
|
177
178
|
<option value=""></option>
|
|
178
179
|
<option v-for="item in options" :value="optionKey ? item[optionKey] : item">{{ item[optionLabel] }}</option>
|
|
179
180
|
</select>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudron/pankow",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "4.1.
|
|
4
|
+
"version": "4.1.7",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"types": "types/index.d.ts",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"@vitejs/plugin-vue": "^6.0.5",
|
|
34
34
|
"highlight.js": "^11.11.1",
|
|
35
35
|
"typescript": "^5.9.3",
|
|
36
|
-
"vite": "^8.0.
|
|
36
|
+
"vite": "^8.0.1",
|
|
37
37
|
"vue": "^3.5.30",
|
|
38
|
-
"vue-router": "^5.0.
|
|
38
|
+
"vue-router": "^5.0.4"
|
|
39
39
|
}
|
|
40
40
|
}
|