adminforth 2.27.0-next.13 → 2.27.0-next.15
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/dist/spa/src/afcl/Select.vue +5 -1
- package/dist/spa/src/components/ColumnValueInput.vue +16 -3
- package/dist/spa/src/components/ColumnValueInputWrapper.vue +1 -1
- package/dist/spa/src/components/GroupsTable.vue +1 -1
- package/dist/spa/src/components/ThreeDotsMenu.vue +1 -1
- package/package.json +1 -1
|
@@ -159,6 +159,10 @@ const props = defineProps({
|
|
|
159
159
|
type: String,
|
|
160
160
|
default: '',
|
|
161
161
|
},
|
|
162
|
+
disableTogleOfSelectedItem: {
|
|
163
|
+
type: Boolean,
|
|
164
|
+
default: false,
|
|
165
|
+
}
|
|
162
166
|
});
|
|
163
167
|
|
|
164
168
|
const emit = defineEmits(['update:modelValue', 'scroll-near-end', 'search']);
|
|
@@ -314,7 +318,7 @@ const removeClickListener = () => {
|
|
|
314
318
|
};
|
|
315
319
|
|
|
316
320
|
const toogleItem = (item: any) => {
|
|
317
|
-
if (selectedItems.value.includes(item)) {
|
|
321
|
+
if (selectedItems.value.includes(item) && !props.disableTogleOfSelectedItem) {
|
|
318
322
|
selectedItems.value = selectedItems.value.filter(i => i.value !== item.value);
|
|
319
323
|
} else {
|
|
320
324
|
if (!props.multiple) {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
ref="input"
|
|
21
21
|
:key="`select-${column.name}-${source}-${column.foreignResource?.name || column.foreignResource?.table || ''}`"
|
|
22
22
|
class="w-full min-w-24"
|
|
23
|
-
:options="columnOptions[column.name] || []"
|
|
23
|
+
:options="formatSelectOptions(columnOptions[column.name] || [], column)"
|
|
24
24
|
:searchDisabled="!column.foreignResource.searchableFields"
|
|
25
25
|
@scroll-near-end="loadMoreOptions && loadMoreOptions(column.name)"
|
|
26
26
|
@search="(searchTerm) => {
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
:modelValue="value"
|
|
34
34
|
:readonly="(column.editReadonly && source === 'edit') || readonly"
|
|
35
35
|
@update:modelValue="$emit('update:modelValue', $event)"
|
|
36
|
+
disableTogleOfSelectedItem
|
|
36
37
|
>
|
|
37
38
|
<template #extra-item v-if="columnLoadingState && columnLoadingState[column.name]?.loading">
|
|
38
39
|
<div class="text-center text-gray-400 dark:text-gray-300 py-2 flex items-center justify-center gap-2">
|
|
@@ -45,11 +46,12 @@
|
|
|
45
46
|
v-else-if="column.enum"
|
|
46
47
|
ref="input"
|
|
47
48
|
class="w-full min-w-24"
|
|
48
|
-
:options="column.enum"
|
|
49
|
+
:options="formatSelectOptions(column.enum, column)"
|
|
49
50
|
teleportToBody
|
|
50
51
|
:modelValue="value"
|
|
51
52
|
:readonly="(column.editReadonly && source === 'edit') || readonly"
|
|
52
53
|
@update:modelValue="$emit('update:modelValue', $event)"
|
|
54
|
+
disableTogleOfSelectedItem
|
|
53
55
|
/>
|
|
54
56
|
<Select
|
|
55
57
|
v-else-if="(type || column.type) === 'boolean'"
|
|
@@ -60,6 +62,7 @@
|
|
|
60
62
|
:modelValue="value"
|
|
61
63
|
:readonly="(column.editReadonly && source === 'edit') || readonly"
|
|
62
64
|
@update:modelValue="$emit('update:modelValue', $event)"
|
|
65
|
+
disableTogleOfSelectedItem
|
|
63
66
|
/>
|
|
64
67
|
<Input
|
|
65
68
|
v-else-if="['integer'].includes(type || column.type)"
|
|
@@ -188,7 +191,7 @@
|
|
|
188
191
|
type?: string,
|
|
189
192
|
value: any,
|
|
190
193
|
currentValues: any,
|
|
191
|
-
mode:
|
|
194
|
+
mode: 'create' | 'edit',
|
|
192
195
|
columnOptions: any,
|
|
193
196
|
unmasked: any,
|
|
194
197
|
deletable?: boolean,
|
|
@@ -218,6 +221,16 @@ const input = ref<HTMLInputElement | null>(null);
|
|
|
218
221
|
return options;
|
|
219
222
|
};
|
|
220
223
|
|
|
224
|
+
const formatSelectOptions = (options: any, column: any) => {
|
|
225
|
+
const optionsToReturn = options;
|
|
226
|
+
if (!column.required[props.mode] && !column.isArray?.enabled) {
|
|
227
|
+
if (!optionsToReturn.some((option: any) => option.value === null)) {
|
|
228
|
+
optionsToReturn.push({ label: t('Unset'), value: null });
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return optionsToReturn;
|
|
232
|
+
};
|
|
233
|
+
|
|
221
234
|
function onFocusHandler(event:FocusEvent, column:any, source:string, ) {
|
|
222
235
|
const focusedInput = event.target as HTMLInputElement;
|
|
223
236
|
if(!focusedInput) return;
|
|
@@ -212,7 +212,7 @@ onUnmounted(() => {
|
|
|
212
212
|
</script>
|
|
213
213
|
|
|
214
214
|
<style lang="scss" scoped>
|
|
215
|
-
.wrapper
|
|
215
|
+
.wrapper {
|
|
216
216
|
@apply px-4 py-2
|
|
217
217
|
hover:text-lightThreeDotsMenuBodyTextHover hover:bg-lightThreeDotsMenuBodyBackgroundHover
|
|
218
218
|
dark:hover:bg-darkThreeDotsMenuBodyBackgroundHover dark:hover:text-darkThreeDotsMenuBodyTextHover
|