@cloudron/pankow 4.1.15 → 4.2.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/components/Dialog.vue +6 -3
- package/components/InputGroup.vue +1 -0
- package/components/MultiSelect.vue +5 -1
- package/components/SingleSelect.vue +30 -5
- package/components/TableView.vue +0 -1
- package/fetcher.js +17 -0
- package/package.json +5 -5
- package/types/fetcher.d.ts +10 -5
package/components/Dialog.vue
CHANGED
|
@@ -62,13 +62,16 @@ const mergedStyle = computed(() => {
|
|
|
62
62
|
const visible = ref(false);
|
|
63
63
|
const dialog = useTemplateRef('dialog');
|
|
64
64
|
const dialogBody = useTemplateRef('dialogBody');
|
|
65
|
+
const confirmButton = useTemplateRef('confirmButton');
|
|
65
66
|
|
|
66
67
|
async function open() {
|
|
67
68
|
visible.value = true;
|
|
68
69
|
|
|
69
|
-
// try to focus some form elements else just the dialog
|
|
70
|
+
// try to focus some form elements, else confirm button, else just the dialog
|
|
70
71
|
await nextTick();
|
|
71
|
-
const focusElement = dialogBody.value.querySelector('input:not([disabled]):not([readonly]):not([style*="display:none"]):not([style*="display: none"])')
|
|
72
|
+
const focusElement = dialogBody.value.querySelector('input:not([disabled]):not([readonly]):not([style*="display:none"]):not([style*="display: none"])')
|
|
73
|
+
|| confirmButton.value?.$el
|
|
74
|
+
|| dialog.value;
|
|
72
75
|
focusElement.focus();
|
|
73
76
|
}
|
|
74
77
|
|
|
@@ -125,7 +128,7 @@ defineExpose({ open, close });
|
|
|
125
128
|
<Button :[alternateStyle]="!!alternateStyle" @click="onAlternateAction" v-show="alternateLabel" :loading="alternateBusy" :disabled="alternateBusy || !alternateActive">{{ alternateLabel }}</Button>
|
|
126
129
|
<div style="flex-grow: 1;"></div>
|
|
127
130
|
<Button :[rejectStyle]="!!rejectStyle" @click="onReject" v-show="rejectLabel" :disabled="!rejectActive">{{ rejectLabel }}</Button>
|
|
128
|
-
<Button :[confirmStyle]="!!confirmStyle" @click="onConfirm" v-show="confirmLabel" :loading="confirmBusy" :disabled="confirmBusy || !confirmActive">{{ confirmLabel }}</Button>
|
|
131
|
+
<Button ref="confirmButton" :[confirmStyle]="!!confirmStyle" @click="onConfirm" v-show="confirmLabel" :loading="confirmBusy" :disabled="confirmBusy || !confirmActive">{{ confirmLabel }}</Button>
|
|
129
132
|
</div>
|
|
130
133
|
<Icon v-if="showX" class="pankow-dialog-x-close" icon="fa-solid fa-xmark" style="cursor: pointer;" @click="onReject"/>
|
|
131
134
|
</div>
|
|
@@ -37,6 +37,10 @@ const props = defineProps({
|
|
|
37
37
|
type: Number,
|
|
38
38
|
default: Infinity,
|
|
39
39
|
},
|
|
40
|
+
showDropdown: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: true
|
|
43
|
+
},
|
|
40
44
|
});
|
|
41
45
|
|
|
42
46
|
const emits = defineEmits(['select', 'close']);
|
|
@@ -167,7 +171,7 @@ onMounted(() => {
|
|
|
167
171
|
|
|
168
172
|
<Menu ref="menu" :model="menuModel" :close-on-activation="false" @close="onClose" :search-threshold="searchThreshold"></Menu>
|
|
169
173
|
{{ buttonLabel }}
|
|
170
|
-
<Icon icon="fa-solid fa-chevron-down" class="pankow-button-icon-right-with-text" />
|
|
174
|
+
<Icon v-show="showDropdown" icon="fa-solid fa-chevron-down" class="pankow-button-icon-right-with-text" />
|
|
171
175
|
</div>
|
|
172
176
|
</template>
|
|
173
177
|
|
|
@@ -31,6 +31,10 @@ const props = defineProps({
|
|
|
31
31
|
type: Number,
|
|
32
32
|
default: Infinity,
|
|
33
33
|
},
|
|
34
|
+
showDropdown: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: true
|
|
37
|
+
},
|
|
34
38
|
});
|
|
35
39
|
|
|
36
40
|
const emits = defineEmits(['select', 'close']);
|
|
@@ -181,10 +185,10 @@ watchEffect(handleDefaultSelect);
|
|
|
181
185
|
|
|
182
186
|
<Menu ref="menu" :model="menuModel" :search-threshold="searchThreshold" :close-on-activation="true" @close="onClose"/>
|
|
183
187
|
<span class="pankow-singleselect-label">
|
|
184
|
-
<Icon v-if="selected ? selected.icon : false" :icon="selected.icon"
|
|
185
|
-
{{ selected ? selected[optionLabel] : placeholder }}
|
|
188
|
+
<Icon v-if="selected ? selected.icon : false" :icon="selected.icon" class="pankow-singleselect-label-icon" />
|
|
189
|
+
<span class="pankow-singleselect-label-text">{{ selected ? selected[optionLabel] : placeholder }}</span>
|
|
186
190
|
</span>
|
|
187
|
-
<Icon icon="fa-solid fa-chevron-down" class="pankow-button-icon-right-with-text" />
|
|
191
|
+
<Icon v-show="showDropdown" icon="fa-solid fa-chevron-down" class="pankow-button-icon-right-with-text" />
|
|
188
192
|
</div>
|
|
189
193
|
</template>
|
|
190
194
|
|
|
@@ -208,8 +212,8 @@ watchEffect(handleDefaultSelect);
|
|
|
208
212
|
text-decoration: none;
|
|
209
213
|
cursor: pointer;
|
|
210
214
|
transition: background-color 250ms;
|
|
211
|
-
min-width:
|
|
212
|
-
|
|
215
|
+
min-width: 0;
|
|
216
|
+
max-width: 100%;
|
|
213
217
|
overflow: hidden;
|
|
214
218
|
}
|
|
215
219
|
|
|
@@ -235,8 +239,29 @@ watchEffect(handleDefaultSelect);
|
|
|
235
239
|
}
|
|
236
240
|
|
|
237
241
|
.pankow-singleselect-label {
|
|
242
|
+
display: flex;
|
|
243
|
+
align-items: center;
|
|
244
|
+
min-width: 0;
|
|
245
|
+
flex: 1 1 auto;
|
|
246
|
+
overflow: hidden;
|
|
247
|
+
text-align: start;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.pankow-singleselect-label-icon {
|
|
251
|
+
margin-right: 6px;
|
|
252
|
+
flex-shrink: 0;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.pankow-singleselect-label-text {
|
|
256
|
+
min-width: 0;
|
|
257
|
+
flex: 1 1 auto;
|
|
238
258
|
overflow: hidden;
|
|
239
259
|
text-overflow: ellipsis;
|
|
260
|
+
white-space: nowrap;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.pankow-singleselect > .pankow-button-icon-right-with-text {
|
|
264
|
+
flex-shrink: 0;
|
|
240
265
|
}
|
|
241
266
|
|
|
242
267
|
</style>
|
package/components/TableView.vue
CHANGED
package/fetcher.js
CHANGED
|
@@ -5,6 +5,18 @@ const globalOptions = {
|
|
|
5
5
|
errorHook: null,
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Low-level HTTP helper. `options` is merged into the native `fetch()` init object
|
|
10
|
+
* (after {@link globalOptions}), so you may pass e.g. `{ signal: abortController.signal }`
|
|
11
|
+
* to cancel the request.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} uri
|
|
14
|
+
* @param {string} method
|
|
15
|
+
* @param {Object} headers
|
|
16
|
+
* @param {Object} query Plain key/value map serialized as the URL query string
|
|
17
|
+
* @param {Object|FormData|null} body
|
|
18
|
+
* @param {RequestInit} [options] Extra fetch options; `signal` is supported for cancellation
|
|
19
|
+
*/
|
|
8
20
|
async function request(uri, method, headers, query, body, options) {
|
|
9
21
|
let response, responseBody;
|
|
10
22
|
|
|
@@ -52,22 +64,27 @@ async function request(uri, method, headers, query, body, options) {
|
|
|
52
64
|
return { status: response.status, body: responseBody };
|
|
53
65
|
}
|
|
54
66
|
|
|
67
|
+
/** @param {RequestInit} [options] Merged into `fetch()`; use `{ signal }` to abort. */
|
|
55
68
|
async function head(uri, query = {}, options = {}) {
|
|
56
69
|
return await request(uri, 'HEAD', {}, query, null, options);
|
|
57
70
|
}
|
|
58
71
|
|
|
72
|
+
/** @param {RequestInit} [options] Merged into `fetch()`; use `{ signal }` to abort. */
|
|
59
73
|
async function get(uri, query = {}, options = {}) {
|
|
60
74
|
return await request(uri, 'GET', {}, query, null, options);
|
|
61
75
|
}
|
|
62
76
|
|
|
77
|
+
/** @param {RequestInit} [options] Merged into `fetch()`; use `{ signal }` to abort. */
|
|
63
78
|
async function post(uri, body, query = {}, options = {}) {
|
|
64
79
|
return await request(uri, 'POST', {}, query, body, options);
|
|
65
80
|
}
|
|
66
81
|
|
|
82
|
+
/** @param {RequestInit} [options] Merged into `fetch()`; use `{ signal }` to abort. */
|
|
67
83
|
async function put(uri, body, query = {}, options = {}) {
|
|
68
84
|
return await request(uri, 'PUT', {}, query, body, options);
|
|
69
85
|
}
|
|
70
86
|
|
|
87
|
+
/** @param {RequestInit} [options] Merged into `fetch()`; use `{ signal }` to abort. */
|
|
71
88
|
async function del(uri, body, query = {}, options = {}) {
|
|
72
89
|
return await request(uri, 'DELETE', {}, query, body, options);
|
|
73
90
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudron/pankow",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"types": "types/index.d.ts",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@highlightjs/vue-plugin": "^2.1.0",
|
|
33
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
33
|
+
"@vitejs/plugin-vue": "^6.0.7",
|
|
34
34
|
"highlight.js": "^11.11.1",
|
|
35
35
|
"typescript": "^6.0.3",
|
|
36
|
-
"vite": "^8.0.
|
|
37
|
-
"vue": "^3.5.
|
|
38
|
-
"vue-router": "^5.0.
|
|
36
|
+
"vite": "^8.0.14",
|
|
37
|
+
"vue": "^3.5.35",
|
|
38
|
+
"vue-router": "^5.0.7"
|
|
39
39
|
}
|
|
40
40
|
}
|
package/types/fetcher.d.ts
CHANGED
|
@@ -13,23 +13,28 @@ declare namespace globalOptions {
|
|
|
13
13
|
let redirect: string;
|
|
14
14
|
let errorHook: null;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
/** @param {RequestInit} [options] Merged into `fetch()`; use `{ signal }` to abort. */
|
|
17
|
+
declare function head(uri: any, query?: {}, options?: RequestInit): Promise<{
|
|
17
18
|
status: number;
|
|
18
19
|
body: any;
|
|
19
20
|
}>;
|
|
20
|
-
|
|
21
|
+
/** @param {RequestInit} [options] Merged into `fetch()`; use `{ signal }` to abort. */
|
|
22
|
+
declare function get(uri: any, query?: {}, options?: RequestInit): Promise<{
|
|
21
23
|
status: number;
|
|
22
24
|
body: any;
|
|
23
25
|
}>;
|
|
24
|
-
|
|
26
|
+
/** @param {RequestInit} [options] Merged into `fetch()`; use `{ signal }` to abort. */
|
|
27
|
+
declare function post(uri: any, body: any, query?: {}, options?: RequestInit): Promise<{
|
|
25
28
|
status: number;
|
|
26
29
|
body: any;
|
|
27
30
|
}>;
|
|
28
|
-
|
|
31
|
+
/** @param {RequestInit} [options] Merged into `fetch()`; use `{ signal }` to abort. */
|
|
32
|
+
declare function put(uri: any, body: any, query?: {}, options?: RequestInit): Promise<{
|
|
29
33
|
status: number;
|
|
30
34
|
body: any;
|
|
31
35
|
}>;
|
|
32
|
-
|
|
36
|
+
/** @param {RequestInit} [options] Merged into `fetch()`; use `{ signal }` to abort. */
|
|
37
|
+
declare function del(uri: any, body: any, query?: {}, options?: RequestInit): Promise<{
|
|
33
38
|
status: number;
|
|
34
39
|
body: any;
|
|
35
40
|
}>;
|