adminforth 4.7.5 → 4.8.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/dist/modules/styles.js +4 -4
- package/dist/spa/package.json +1 -0
- package/dist/spa/src/afcl/Calendar.vue +211 -0
- package/dist/spa/src/afcl/DateField.vue +257 -0
- package/dist/spa/src/afcl/DatePicker.vue +103 -245
- package/dist/spa/src/afcl/TimeField.vue +52 -0
- package/dist/spa/src/afcl/pickerStyles.ts +25 -0
- package/dist/spa/src/afcl/shadowRoot.ts +1 -2
- package/dist/spa/src/components/ColumnValueInput.vue +9 -7
- package/dist/spa/src/components/ColumnValueInputWrapper.vue +1 -1
- package/dist/spa/src/components/CustomDateRangePicker.vue +47 -165
- package/dist/spa/src/components/Filters.vue +7 -4
- package/dist/spa/src/components/GroupsTable.vue +23 -43
- package/dist/spa/src/components/ShowTable.vue +21 -31
- package/dist/spa/src/utils/dateUtils.ts +33 -21
- package/dist/spa/src/views/CreateEditSkeleton.vue +6 -17
- package/dist/spa/src/views/ShowView.vue +14 -24
- package/dist/spa/tailwind.config.js +1 -1
- package/package.json +1 -1
|
@@ -1,290 +1,148 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<IconClock class="w-4 h-4 text-lightDatePickerIcon dark:text-darkDatePickerIcon bg-lightDatePickerButtonBackground dark:bg-darkDatePickerButtonBackground"/>
|
|
26
|
-
</div>
|
|
27
|
-
<input v-model="startTime" type="time" id="start-time" step="1"
|
|
28
|
-
class="af-pick-time-button bg-lightDatePickerButtonBackground border border-lightDatePickerButtonBorder text-lightDatePickerButtonText text-sm rounded-default block w-full px-2.5 py-1.5 leading-5 shadow-customLight focus:outline-none focus:ring-[3px] focus:ring-lightInputFocusRing focus:border-lightInputFocusBorder dark:focus:ring-darkInputFocusRing dark:focus:border-darkInputFocusBorder dark:bg-darkInputBackground dark:border-darkInputBorder dark:placeholder-darkInputPlaceholderText dark:text-darkDatePickerButtonText focus:ring-lightInputFocusRing focus:border-lightInputFocusBorder dark:focus:ring-darkInputFocusRing dark:focus:border-darkInputFocusBorder"
|
|
29
|
-
value="00:00" :disabled="readonly" required/>
|
|
30
|
-
</div>
|
|
31
|
-
</div>
|
|
32
|
-
</div>
|
|
33
|
-
|
|
34
|
-
<button type="button"
|
|
35
|
-
class="text-lightDatePickerExpandText dark:text-darkDatePickerExpandText text-[13px] font-medium hover:underline p-0 inline-flex items-center gap-0.5 mb-2"
|
|
36
|
-
:class="{hidden: column.type !== 'datetime'}"
|
|
37
|
-
@click="toggleTimeInputs">{{ showTimeInputs ? $t('Hide time') : $t('Show time') }}
|
|
38
|
-
<IconChevronDown class="w-4 h-4" :class="{'rotate-180': showTimeInputs}"/>
|
|
39
|
-
</button>
|
|
2
|
+
<div class="afcl-datepicker" :class="{ 'opacity-50': readonly }">
|
|
3
|
+
<label v-if="label" :for="dateInputId" class="block mb-2 text-sm font-medium text-lightDatePickerButtonText dark:text-darkDatePickerButtonText">{{ label }}</label>
|
|
4
|
+
<div class="flex flex-wrap gap-1.5">
|
|
5
|
+
<DateField
|
|
6
|
+
v-if="fieldsType !== 'time'"
|
|
7
|
+
ref="dateField"
|
|
8
|
+
v-model="date"
|
|
9
|
+
class="w-40"
|
|
10
|
+
inputClass="af-pick-date-button"
|
|
11
|
+
:inputId="dateInputId"
|
|
12
|
+
:placeholder="$t('Select date')"
|
|
13
|
+
:disabled="readonly"
|
|
14
|
+
:autoHide="autoHide"
|
|
15
|
+
/>
|
|
16
|
+
<TimeField
|
|
17
|
+
v-if="fieldsType !== 'date'"
|
|
18
|
+
ref="timeField"
|
|
19
|
+
v-model="time"
|
|
20
|
+
class="w-36"
|
|
21
|
+
inputClass="af-pick-time-button"
|
|
22
|
+
:step="1"
|
|
23
|
+
:disabled="readonly"
|
|
24
|
+
/>
|
|
40
25
|
</div>
|
|
41
26
|
</div>
|
|
42
27
|
</template>
|
|
43
|
-
<script setup>
|
|
44
|
-
import {ref, computed,
|
|
45
|
-
import dayjs from 'dayjs';
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
import
|
|
49
|
-
import
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
column:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
},
|
|
67
|
-
autoHide: {
|
|
68
|
-
type: Boolean,
|
|
69
|
-
},
|
|
70
|
-
readonly: {
|
|
71
|
-
type: Boolean,
|
|
72
|
-
},
|
|
28
|
+
<script setup lang="ts">
|
|
29
|
+
import { ref, computed, watch, useId, getCurrentInstance } from 'vue';
|
|
30
|
+
import dayjs, { type Dayjs } from 'dayjs';
|
|
31
|
+
|
|
32
|
+
import { PICKER_DAY_FORMAT } from '@/utils/dateUtils';
|
|
33
|
+
import DateField from './DateField.vue';
|
|
34
|
+
import TimeField from './TimeField.vue';
|
|
35
|
+
|
|
36
|
+
type DatePickerType = 'date' | 'datetime' | 'time';
|
|
37
|
+
|
|
38
|
+
const props = withDefaults(defineProps<{
|
|
39
|
+
// date, time, or both side by side
|
|
40
|
+
type?: DatePickerType,
|
|
41
|
+
label?: string,
|
|
42
|
+
// closes the calendar once a day is picked
|
|
43
|
+
autoHide?: boolean,
|
|
44
|
+
readonly?: boolean,
|
|
45
|
+
/** @deprecated use `type`, removed in the next major version */
|
|
46
|
+
column?: { type: DatePickerType },
|
|
47
|
+
/** @deprecated use `v-model`, removed in the next major version */
|
|
48
|
+
valueStart?: string,
|
|
49
|
+
}>(), {
|
|
50
|
+
type: 'date',
|
|
73
51
|
});
|
|
74
52
|
|
|
75
|
-
const emit = defineEmits
|
|
53
|
+
const emit = defineEmits<{
|
|
54
|
+
/** @deprecated use `v-model`, removed in the next major version */
|
|
55
|
+
'update:valueStart': [value: string | undefined],
|
|
56
|
+
}>();
|
|
76
57
|
|
|
77
|
-
|
|
58
|
+
// "2026-10-14" for date, an ISO string in UTC for datetime, "14:20:00" for time
|
|
59
|
+
const model = defineModel<string>();
|
|
78
60
|
|
|
79
|
-
|
|
61
|
+
// TODO next major: remove column and valueStart with their warnings
|
|
62
|
+
// the props and listeners the parent passed, to tell v-model:valueStart from v-model
|
|
63
|
+
const parentProps = getCurrentInstance()!.vnode.props ?? {};
|
|
64
|
+
const usesValueStart = ['valueStart', 'value-start', 'onUpdate:valueStart'].some((key) => key in parentProps);
|
|
65
|
+
if (props.column) {
|
|
66
|
+
console.warn('AFCL DatePicker: the "column" prop is deprecated and will be removed in the next major version, pass type="date|datetime|time" instead');
|
|
67
|
+
}
|
|
68
|
+
if (usesValueStart) {
|
|
69
|
+
console.warn('AFCL DatePicker: "valueStart" is deprecated and will be removed in the next major version, use v-model instead');
|
|
70
|
+
}
|
|
80
71
|
|
|
81
|
-
const
|
|
72
|
+
const fieldsType = computed(() => props.column?.type ?? props.type);
|
|
73
|
+
const current = computed(() => usesValueStart ? props.valueStart : model.value);
|
|
82
74
|
|
|
83
|
-
|
|
75
|
+
function setValue(value: string | undefined) {
|
|
76
|
+
if (usesValueStart) {
|
|
77
|
+
emit('update:valueStart', value);
|
|
78
|
+
} else {
|
|
79
|
+
model.value = value;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
84
82
|
|
|
85
|
-
const
|
|
83
|
+
const dateField = ref<InstanceType<typeof DateField>>();
|
|
84
|
+
const timeField = ref<InstanceType<typeof TimeField>>();
|
|
85
|
+
const dateInputId = useId();
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
const date = ref<string | null>(null);
|
|
88
88
|
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
const time = ref('');
|
|
90
|
+
|
|
91
|
+
const value = computed(() => {
|
|
92
|
+
if (fieldsType.value === 'time') {
|
|
93
|
+
return formatTime(time.value);
|
|
92
94
|
}
|
|
93
|
-
|
|
94
|
-
if (!
|
|
95
|
+
|
|
96
|
+
if (!date.value) {
|
|
95
97
|
return;
|
|
96
98
|
}
|
|
97
99
|
|
|
98
|
-
let
|
|
100
|
+
let value = dayjs(date.value);
|
|
99
101
|
|
|
100
|
-
if (
|
|
101
|
-
return
|
|
102
|
+
if (fieldsType.value === 'date') {
|
|
103
|
+
return value.format('YYYY-MM-DD');
|
|
102
104
|
}
|
|
103
105
|
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
+
if (time.value) {
|
|
107
|
+
value = addTimeToDate(formatTime(time.value), value)
|
|
106
108
|
}
|
|
107
109
|
|
|
108
|
-
return
|
|
110
|
+
return value.utc().toISOString();
|
|
109
111
|
})
|
|
110
112
|
|
|
111
|
-
|
|
112
|
-
if (!
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
} else if (
|
|
116
|
-
|
|
113
|
+
function updateFromModel() {
|
|
114
|
+
if (!current.value) {
|
|
115
|
+
date.value = null;
|
|
116
|
+
time.value = '';
|
|
117
|
+
} else if (fieldsType.value === 'time') {
|
|
118
|
+
time.value = current.value;
|
|
117
119
|
} else {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
startTime.value = dayjs(props.valueStart).format('HH:mm:ss')
|
|
120
|
+
const value = dayjs(current.value);
|
|
121
|
+
date.value = value.format(PICKER_DAY_FORMAT);
|
|
122
|
+
time.value = value.format('HH:mm:ss');
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
|
|
125
|
-
|
|
126
|
-
datepickerReady = initDatepickers();
|
|
127
|
-
updateFromProps();
|
|
126
|
+
watch(current, updateFromModel, { immediate: true });
|
|
128
127
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
});
|
|
128
|
+
watch(value, () => {
|
|
129
|
+
setValue(value.value);
|
|
132
130
|
})
|
|
133
131
|
|
|
134
|
-
|
|
135
|
-
emit('update:valueStart', start.value)
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
const teleportTarget = useTeleportTarget();
|
|
139
|
-
|
|
140
|
-
async function initDatepickers() {
|
|
141
|
-
const LS_LANG_KEY = `afLanguage`;
|
|
142
|
-
const options = {format: FLEXIBLE_DATEPICKER_FORMAT, language: localStorage.getItem(LS_LANG_KEY)};
|
|
143
|
-
|
|
144
|
-
if (props.autoHide) {
|
|
145
|
-
options.autohide = true;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const { default: Datepicker } = await import(
|
|
149
|
-
'flowbite-datepicker/Datepicker'
|
|
150
|
-
);
|
|
151
|
-
|
|
152
|
-
datepickerObject.value = new Datepicker(datepickerStartEl.value, options);
|
|
153
|
-
// the calendar goes to body and takes only a selector of the document for another container
|
|
154
|
-
if (teleportTarget instanceof HTMLElement) {
|
|
155
|
-
datepickerObject.value.config.container = teleportTarget;
|
|
156
|
-
teleportTarget.appendChild(datepickerObject.value.picker.element);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
addChangeDateListener();
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
function addChangeDateListener() {
|
|
163
|
-
datepickerStartEl.value.addEventListener('changeDate', setStartDate)
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function removeChangeDateListener() {
|
|
167
|
-
datepickerStartEl.value.removeEventListener('changeDate', setStartDate);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
function destroyDatepickerElement() {
|
|
171
|
-
datepickerObject.value.destroy();
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
function setStartDate(event) {
|
|
175
|
-
startDate.value = event.detail.date
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
function formatTime(time) {
|
|
132
|
+
function formatTime(time: string) {
|
|
179
133
|
return time.split(':').map(Number).length === 2 ? time + ':00' : time;
|
|
180
134
|
}
|
|
181
135
|
|
|
182
|
-
function addTimeToDate(time, date) {
|
|
136
|
+
function addTimeToDate(time: string, date: Dayjs) {
|
|
183
137
|
const [hours, minutes, seconds] = time.split(':').map(Number)
|
|
184
138
|
return date.hour(hours).minute(minutes).second(seconds)
|
|
185
139
|
}
|
|
186
140
|
|
|
187
|
-
const toggleTimeInputs = () => {
|
|
188
|
-
showTimeInputs.value = !showTimeInputs.value
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
onBeforeUnmount(() => {
|
|
192
|
-
removeChangeDateListener();
|
|
193
|
-
destroyDatepickerElement();
|
|
194
|
-
});
|
|
195
|
-
|
|
196
141
|
function focus() {
|
|
197
|
-
|
|
142
|
+
(fieldsType.value === 'time' ? timeField : dateField).value!.focus();
|
|
198
143
|
}
|
|
199
144
|
|
|
200
145
|
defineExpose({
|
|
201
146
|
focus,
|
|
202
147
|
});
|
|
203
148
|
</script>
|
|
204
|
-
|
|
205
|
-
<style lang="css" scoped>
|
|
206
|
-
|
|
207
|
-
:global(.datepicker-controls button svg),
|
|
208
|
-
:global(.datepicker-controls button) {
|
|
209
|
-
@apply text-lightDatePickerCalendarText;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
:global( .datepicker-dropdown ),
|
|
213
|
-
:global( .datepicker-picker ) {
|
|
214
|
-
@apply !bg-lightDatePickerCalendarBackground
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
:global(.datepicker-controls button:hover) {
|
|
218
|
-
@apply bg-lightDatePickerCalendarArrowButtonBackgroundHover;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
:global(.datepicker-controls button) {
|
|
222
|
-
@apply ring-lightDatePickerCalendarArrowButtonFocusRing bg-lightDatePickerCalendarArrowButtonBackground;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
:global(.datepicker-controls button:focus) {
|
|
226
|
-
@apply ring-lightDatePickerCalendarArrowButtonFocusRing;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
:global(.days-of-week span) {
|
|
230
|
-
@apply text-lightDatePickerCalendarDaysOfWeekText;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
:global(.datepicker-grid span) {
|
|
234
|
-
@apply text-lightDatePickerCalendarDateButtonText;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
:global(.datepicker-grid span:hover:not(.selected)) {
|
|
238
|
-
@apply bg-lightDatePickerCalendarDateButtonBackgroundHover;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
:global(.datepicker-grid .selected ) {
|
|
242
|
-
@apply text-lightDatePickerCalendarDateActiveButtonText bg-lightDatePickerCalendarDateActiveButtonBackground;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
:global(.dark .datepicker-controls button svg),
|
|
253
|
-
:global(.dark .datepicker-controls button) {
|
|
254
|
-
@apply text-darkDatePickerCalendarMainText;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
:global(.dark .datepicker-dropdown),
|
|
258
|
-
:global(.dark .datepicker-picker) {
|
|
259
|
-
@apply !bg-darkDatePickerCalendarBackground;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
:global(.dark .datepicker-controls button:hover) {
|
|
263
|
-
@apply bg-darkDatePickerCalendarArrowButtonBackgroundHover;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
:global(.dark .datepicker-controls button) {
|
|
267
|
-
@apply ring-darkDatePickerCalendarArrowButtonFocusRing bg-darkDatePickerCalendarArrowButtonBackground;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
:global(.dark .datepicker-controls button) {
|
|
271
|
-
@apply ring-darkDatePickerCalendarArrowButtonFocusRing;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
:global(.dark .days-of-week span) {
|
|
275
|
-
@apply text-darkDatePickerCalendarDaysOfWeekText;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
:global(.dark .datepicker-grid span) {
|
|
279
|
-
@apply text-darkDatePickerCalendarDateButtonText;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
:global(.dark .datepicker-grid span:hover:not(.selected)) {
|
|
283
|
-
@apply bg-darkDatePickerCalendarDateButtonBackgroundHover;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
:global(.dark .datepicker-grid .selected) {
|
|
287
|
-
@apply text-darkDatePickerCalendarDateActiveButtonText
|
|
288
|
-
bg-darkDatePickerCalendarDateActiveButtonBackground;
|
|
289
|
-
}
|
|
290
|
-
</style>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="afcl-time-field relative">
|
|
3
|
+
<input
|
|
4
|
+
ref="inputEl"
|
|
5
|
+
v-model="model"
|
|
6
|
+
type="time"
|
|
7
|
+
:step="step"
|
|
8
|
+
:disabled="disabled"
|
|
9
|
+
class="afcl-time-field-input relative w-full ps-8 pe-2.5"
|
|
10
|
+
:class="[PICKER_TEXT_CLASSES, PICKER_BOX_CLASSES, inputClass]"
|
|
11
|
+
/>
|
|
12
|
+
<!-- after the input, which is positioned for the picker indicator and would cover the icon -->
|
|
13
|
+
<IconClock :class="PICKER_ICON_CLASSES" aria-hidden="true" />
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup lang="ts">
|
|
18
|
+
import { ref } from 'vue';
|
|
19
|
+
import { IconClock } from '@iconify-prerendered/vue-lucide';
|
|
20
|
+
import { PICKER_BOX_CLASSES, PICKER_ICON_CLASSES, PICKER_TEXT_CLASSES } from './pickerStyles';
|
|
21
|
+
|
|
22
|
+
defineProps<{
|
|
23
|
+
// 1 shows seconds
|
|
24
|
+
step?: number,
|
|
25
|
+
disabled?: boolean,
|
|
26
|
+
inputClass?: string,
|
|
27
|
+
}>();
|
|
28
|
+
|
|
29
|
+
// "HH:mm" or "HH:mm:ss", empty when no time is set
|
|
30
|
+
const model = defineModel<string>({ required: true });
|
|
31
|
+
|
|
32
|
+
const inputEl = ref<HTMLInputElement>();
|
|
33
|
+
|
|
34
|
+
defineExpose({
|
|
35
|
+
focus: () => inputEl.value!.focus(),
|
|
36
|
+
});
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<style>
|
|
40
|
+
/* the clock icon on the left opens the time picker of Chromium: its own indicator lies over the icon, invisible */
|
|
41
|
+
.afcl-time-field-input::-webkit-calendar-picker-indicator {
|
|
42
|
+
position: absolute;
|
|
43
|
+
inset-inline-start: 0;
|
|
44
|
+
top: 0;
|
|
45
|
+
width: 2rem;
|
|
46
|
+
height: 100%;
|
|
47
|
+
margin: 0;
|
|
48
|
+
padding: 0;
|
|
49
|
+
opacity: 0;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
}
|
|
52
|
+
</style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// the fields of DatePicker and of the date range filter: date, time and the box around both halves of a range.
|
|
2
|
+
// focus-within instead of focus, so the same box works on an input and on a wrapper of inputs
|
|
3
|
+
|
|
4
|
+
export const PICKER_BOX_CLASSES = `
|
|
5
|
+
h-[34px] rounded-default border shadow-customLight transition-colors focus-within:ring-[3px]
|
|
6
|
+
bg-lightDatePickerButtonBackground border-lightDatePickerButtonBorder hover:border-lightInputBorderHover
|
|
7
|
+
focus-within:ring-lightInputFocusRing focus-within:border-lightInputFocusBorder
|
|
8
|
+
dark:bg-darkDatePickerButtonBackground dark:border-darkDatePickerButtonBorder dark:hover:border-darkInputBorderHover
|
|
9
|
+
dark:focus-within:ring-darkInputFocusRing dark:focus-within:border-darkInputFocusBorder
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
// the box keeps the focus look while the keyboard is inside its calendar
|
|
13
|
+
export const PICKER_BOX_OPEN_CLASSES = `
|
|
14
|
+
ring-[3px] ring-lightInputFocusRing border-lightInputFocusBorder dark:ring-darkInputFocusRing dark:border-darkInputFocusBorder
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
export const PICKER_TEXT_CLASSES = `
|
|
18
|
+
text-sm leading-5 tabular-nums focus:outline-none disabled:cursor-not-allowed
|
|
19
|
+
text-lightDatePickerButtonText placeholder-lightDatePickerPlaceHolder
|
|
20
|
+
dark:text-darkDatePickerButtonText dark:placeholder-darkDatePickerPlaceHolder
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
export const PICKER_ICON_CLASSES = `
|
|
24
|
+
absolute inset-y-0 start-2.5 my-auto w-4 h-4 pointer-events-none text-lightDatePickerIcon dark:text-darkDatePickerIcon
|
|
25
|
+
`;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { inject, type InjectionKey } from 'vue';
|
|
2
2
|
|
|
3
3
|
// AFCL also renders inside a shadow root (the live examples of the docs): popups, modals and tooltips go to an
|
|
4
|
-
// element of that root instead of body, or they lose the styles of the root
|
|
5
|
-
// DatePicker places its calendar relative to it
|
|
4
|
+
// element of that root instead of body, or they lose the styles of the root
|
|
6
5
|
|
|
7
6
|
export const AFCL_TELEPORT_TARGET: InjectionKey<string | HTMLElement> = Symbol('afclTeleportTarget');
|
|
8
7
|
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
v-else-if="column.foreignResource"
|
|
20
20
|
ref="input"
|
|
21
21
|
:key="`select-${column.name}-${source}-${column.foreignResource?.name || column.foreignResource?.table || ''}`"
|
|
22
|
-
class="w-full min-w-24"
|
|
22
|
+
class="w-full min-w-24 max-w-xs"
|
|
23
23
|
:options="formatSelectOptions(columnOptions[column.name] || [], column)"
|
|
24
24
|
:searchDisabled="!column.foreignResource.searchableFields"
|
|
25
25
|
@scroll-near-end="loadMoreOptions && loadMoreOptions(column.name)"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
<Select
|
|
46
46
|
v-else-if="column.enum"
|
|
47
47
|
ref="input"
|
|
48
|
-
class="w-full min-w-24"
|
|
48
|
+
class="w-full min-w-24 max-w-xs"
|
|
49
49
|
:options="formatSelectOptions(column.enum, column)"
|
|
50
50
|
teleportToBody
|
|
51
51
|
:modelValue="value"
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
<Select
|
|
57
57
|
v-else-if="(type || column.type) === 'boolean'"
|
|
58
58
|
ref="input"
|
|
59
|
-
class="w-full min-w-24"
|
|
59
|
+
class="w-full min-w-24 max-w-xs"
|
|
60
60
|
:options="getBooleanOptions(column)"
|
|
61
61
|
teleportToBody
|
|
62
62
|
:modelValue="value"
|
|
@@ -83,10 +83,10 @@
|
|
|
83
83
|
<DatePicker
|
|
84
84
|
v-else-if="['datetime', 'date', 'time'].includes(type || column.type)"
|
|
85
85
|
ref="input"
|
|
86
|
-
:
|
|
87
|
-
:
|
|
86
|
+
:type="type || column.type"
|
|
87
|
+
:modelValue="value"
|
|
88
88
|
auto-hide
|
|
89
|
-
@update:
|
|
89
|
+
@update:modelValue="$emit('update:modelValue', $event)"
|
|
90
90
|
:readonly="(column.editReadonly && source === 'edit') || readonly"
|
|
91
91
|
/>
|
|
92
92
|
<Input
|
|
@@ -120,6 +120,7 @@
|
|
|
120
120
|
/>
|
|
121
121
|
<Textarea
|
|
122
122
|
v-else-if="['text', 'richtext'].includes(type || column.type)"
|
|
123
|
+
class="max-w-2xl"
|
|
123
124
|
:placeholder="$t('Text')"
|
|
124
125
|
:modelValue="value"
|
|
125
126
|
@update:modelValue="$emit('update:modelValue', $event)"
|
|
@@ -127,6 +128,7 @@
|
|
|
127
128
|
/>
|
|
128
129
|
<Textarea
|
|
129
130
|
v-else-if="['json'].includes(type || column.type)"
|
|
131
|
+
class="max-w-2xl"
|
|
130
132
|
:placeholder="$t('Text')"
|
|
131
133
|
:modelValue="value"
|
|
132
134
|
@update:modelValue="$emit('update:modelValue', $event)"
|
|
@@ -135,7 +137,7 @@
|
|
|
135
137
|
v-else
|
|
136
138
|
ref="input"
|
|
137
139
|
:type="!column.masked || unmasked[column.name] ? 'text' : 'password'"
|
|
138
|
-
class="w-full"
|
|
140
|
+
class="w-full max-w-xl"
|
|
139
141
|
:fullWidth="true"
|
|
140
142
|
:placeholder="$t('Text')"
|
|
141
143
|
:prefix="column.inputPrefix"
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
/>
|
|
57
57
|
<div v-if="columnsWithErrors && columnsWithErrors[column.name] && validatingMode && !isValidating" class="af-invalid-field-message mt-1 text-xs text-lightInputErrorColor dark:text-darkInputErrorColor">{{ columnsWithErrors[column.name] }}</div>
|
|
58
58
|
<Spinner v-if="shouldWeShowSpinner" class="w-4 mt-1"/>
|
|
59
|
-
<div v-if="column.editingNote && column.editingNote[mode]" class="mt-1 text-xs text-
|
|
59
|
+
<div v-if="column.editingNote && column.editingNote[mode]" class="mt-1 text-xs text-lightInputIconColor dark:text-darkInputIconColor">{{ column.editingNote[mode] }}</div>
|
|
60
60
|
</template>
|
|
61
61
|
|
|
62
62
|
<script setup lang="ts">
|