adminforth 2.27.0-next.12 → 2.27.0-next.14
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/Filters.vue +23 -2
- package/dist/spa/src/components/GroupsTable.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;
|
|
@@ -123,9 +123,9 @@
|
|
|
123
123
|
:min="getFilterMinValue(c.name)"
|
|
124
124
|
:max="getFilterMaxValue(c.name)"
|
|
125
125
|
:valueStart="getFilterItem({ column: c, operator: 'gte' })"
|
|
126
|
-
@update:valueStart="
|
|
126
|
+
@update:valueStart="(val) => rangeChangeHandler((val !== '' && val !== null) ? (c.type === 'decimal' ? String(val) : val) : undefined, c, 'gte')"
|
|
127
127
|
:valueEnd="getFilterItem({ column: c, operator: 'lte' })"
|
|
128
|
-
@update:valueEnd="
|
|
128
|
+
@update:valueEnd="(val) => rangeChangeHandler((val !== '' && val !== null) ? (c.type === 'decimal' ? String(val) : val) : undefined, c, 'lte')"
|
|
129
129
|
/>
|
|
130
130
|
|
|
131
131
|
<div v-else-if="['integer', 'decimal', 'float'].includes(c.type)" class="flex gap-2">
|
|
@@ -275,6 +275,27 @@ const onFilterInput = computed(() => {
|
|
|
275
275
|
}, {});
|
|
276
276
|
});
|
|
277
277
|
|
|
278
|
+
// rangeState is used for cutom range picker, because if we change two values very quickly
|
|
279
|
+
// in filters writes only the last one, because of debounce
|
|
280
|
+
const rangeState = reactive({});
|
|
281
|
+
|
|
282
|
+
const updateRange = (column) => {
|
|
283
|
+
debounce(() => {
|
|
284
|
+
const { gte, lte } = rangeState[column.name];
|
|
285
|
+
|
|
286
|
+
setFilterItem({ column, operator: 'gte', value: gte });
|
|
287
|
+
setFilterItem({ column, operator: 'lte', value: lte });
|
|
288
|
+
}, column?.filterOptions?.debounceTimeMs || 10)();
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function rangeChangeHandler(value, column, operator) {
|
|
292
|
+
if (!rangeState[column.name]) {
|
|
293
|
+
rangeState[column.name] = { gte: null, lte: null };
|
|
294
|
+
}
|
|
295
|
+
rangeState[column.name][operator] = value;
|
|
296
|
+
updateRange(column);
|
|
297
|
+
}
|
|
298
|
+
|
|
278
299
|
const onSearchInput = computed(() => {
|
|
279
300
|
return createSearchInputHandlers(
|
|
280
301
|
props.columns,
|