adminforth 4.7.5 → 4.9.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.
@@ -1,26 +1,173 @@
1
1
  <template>
2
- <JsonViewer
3
- class="afcl-json-viewer min-w-[6rem]"
4
- :value="value"
5
- :expandDepth="expandDepth"
6
- copyable
7
- sort
8
- :theme="currentTheme"
9
- />
2
+ <div v-if="inline" ref="rootEl" class="afcl-json-viewer afcl-json-viewer-inline inline-flex min-w-0 max-w-xs" :style="{ anchorName }">
3
+ <button
4
+ type="button"
5
+ class="afcl-json-viewer-trigger inline-flex items-center gap-1.5 min-w-0 -mx-1 px-1 rounded font-mono text-xs leading-5 text-left hover:bg-lightSecondaryDarken dark:hover:bg-darkSecondaryLighten focus:outline-none focus-visible:ring-[3px] focus-visible:ring-lightFocusRing dark:focus-visible:ring-darkFocusRing"
6
+ :aria-expanded="isOpen"
7
+ @click.stop="isOpen = !isOpen"
8
+ >
9
+ <span class="truncate"><span v-for="(token, i) in preview" :key="i" :class="JSON_TOKEN_CLASSES[token.kind]">{{ token.text }}</span></span>
10
+ <span v-if="sizeLabel" :class="JSON_SIZE_CLASSES">{{ sizeLabel }}</span>
11
+ </button>
12
+ <teleport :to="teleportTarget" v-if="isOpen">
13
+ <div
14
+ ref="popoverEl"
15
+ popover="manual"
16
+ role="dialog"
17
+ :style="{ positionAnchor: anchorName }"
18
+ class="afcl-json-viewer-popover w-[28rem] max-w-[calc(100vw-2rem)] max-h-96 overflow-auto py-2.5 pl-1.5 pr-2.5 rounded-lg bg-lightDropdownOptionsBackground shadow-popover dark:bg-darkDropdownOptionsBackground dark:shadow-darkPopover"
19
+ >
20
+ <JsonViewer :value="value" :expandDepth="expandDepth" />
21
+ </div>
22
+ </teleport>
23
+ </div>
24
+ <div v-else ref="viewerEl" class="afcl-json-viewer group relative flex items-start gap-2 font-mono text-xs leading-5">
25
+ <span ref="charEl" class="invisible absolute" aria-hidden="true">0</span>
26
+ <div class="min-w-0">
27
+ <JsonViewerNode :value="value" :depth="0" :last="true" :expandDepth="expandDepth" :lineWidth="lineWidth" />
28
+ </div>
29
+ <button
30
+ type="button"
31
+ class="afcl-json-viewer-copy flex items-center justify-center w-6 h-6 -mt-0.5 shrink-0 rounded-md text-lightInputIconColor hover:text-lightShowTableBodyText hover:bg-lightSecondaryDarken dark:text-darkInputIconColor dark:hover:text-darkShowTableBodyText dark:hover:bg-darkSecondaryLighten opacity-0 group-hover:opacity-100 focus-visible:opacity-100 focus:outline-none focus-visible:ring-[3px] focus-visible:ring-lightFocusRing dark:focus-visible:ring-darkFocusRing"
32
+ :aria-label="t('Copy JSON')"
33
+ @click="copy"
34
+ >
35
+ <IconCheck v-if="copied" class="w-3.5 h-3.5" />
36
+ <IconCopy v-else class="w-3.5 h-3.5" />
37
+ </button>
38
+ </div>
10
39
  </template>
11
40
 
12
41
  <script setup lang="ts">
13
- import { computed, defineAsyncComponent } from 'vue'
14
- import { useCoreStore } from '@/stores/core'
15
- import "vue3-json-viewer/dist/vue3-json-viewer.css";
42
+ import { computed, nextTick, onBeforeUnmount, ref, useId, watch } from 'vue';
43
+ import { useI18n } from 'vue-i18n';
44
+ import { IconCheck, IconCopy } from '@iconify-prerendered/vue-lucide';
45
+ import { useElementSize } from '@vueuse/core';
46
+ import JsonViewerNode from './JsonViewerNode.vue';
47
+ import { useTeleportTarget } from './shadowRoot';
48
+ import {
49
+ JSON_LINE_WIDTH,
50
+ JSON_PREVIEW_DEPTH,
51
+ JSON_PREVIEW_LENGTH,
52
+ JSON_SIZE_CLASSES,
53
+ JSON_TOKEN_CLASSES,
54
+ inlineJsonTokens,
55
+ isJsonContainer,
56
+ jsonEntries,
57
+ jsonSizeLabel,
58
+ } from './jsonFormat';
16
59
 
17
- defineProps<{
18
- value: any
19
- expandDepth?: number
20
- }>()
60
+ const OFFSET = 6;
61
+ const COPIED_MS = 1500;
62
+ // the gutter of chevrons (16px), the gap and the copy button (8px + 24px)
63
+ const CHROME_PX = 48;
64
+ const SUPPORTS_ANCHOR = CSS.supports('anchor-name: --a');
21
65
 
22
- const JsonViewer = defineAsyncComponent(() => import('vue3-json-viewer').then(module => module.JsonViewer))
23
- const coreStore = useCoreStore()
66
+ const props = withDefaults(defineProps<{
67
+ value: unknown,
68
+ // nodes deeper than this open folded: 0 folds the root, 1 shows the root keys with their values folded
69
+ expandDepth?: number,
70
+ // one line which opens the whole value in a popover, for table cells
71
+ inline?: boolean,
72
+ }>(), {
73
+ expandDepth: 1,
74
+ inline: false,
75
+ });
24
76
 
25
- const currentTheme = computed(() => (coreStore.theme === 'dark' ? 'dark' : 'light'))
77
+ const { t } = useI18n();
78
+ const teleportTarget = useTeleportTarget();
79
+ const anchorName = `--afcl-json-viewer-${useId()}`;
80
+
81
+ const rootEl = ref<HTMLElement>();
82
+ const popoverEl = ref<HTMLElement>();
83
+ const isOpen = ref(false);
84
+ const copied = ref(false);
85
+
86
+ const viewerEl = ref<HTMLElement>();
87
+ const charEl = ref<HTMLElement>();
88
+ const { width: viewerWidth } = useElementSize(viewerEl);
89
+
90
+ // a line holds JSON_LINE_WIDTH characters or as many as fit next to the chevrons and the copy button
91
+ const lineWidth = computed(() => viewerWidth.value
92
+ ? Math.min(JSON_LINE_WIDTH, Math.floor((viewerWidth.value - CHROME_PX) / charEl.value!.getBoundingClientRect().width))
93
+ : JSON_LINE_WIDTH);
94
+
95
+ const preview = computed(() => inlineJsonTokens(props.value, JSON_PREVIEW_DEPTH, JSON_PREVIEW_LENGTH));
96
+ // a single item is readable from the preview itself, so the size shows from two
97
+ const sizeLabel = computed(() => isJsonContainer(props.value) && jsonEntries(props.value).length > 1
98
+ ? jsonSizeLabel(t, props.value)
99
+ : null);
100
+
101
+ async function copy() {
102
+ await navigator.clipboard.writeText(JSON.stringify(props.value, null, 2));
103
+ copied.value = true;
104
+ setTimeout(() => {
105
+ copied.value = false;
106
+ }, COPIED_MS);
107
+ }
108
+
109
+ function onDocumentMousedown(e: MouseEvent) {
110
+ // inside a shadow root e.target is the host, composedPath() starts at the clicked element
111
+ const target = e.composedPath()[0] as Node;
112
+ if (!rootEl.value!.contains(target) && !popoverEl.value!.contains(target)) {
113
+ isOpen.value = false;
114
+ }
115
+ }
116
+
117
+ function onDocumentKeydown(e: KeyboardEvent) {
118
+ if (e.key === 'Escape') {
119
+ isOpen.value = false;
120
+ }
121
+ }
122
+
123
+ // Safari before 26 and Firefox before 147 have no CSS anchor positioning
124
+ function placeByRect() {
125
+ const trigger = rootEl.value!.getBoundingClientRect();
126
+ const el = popoverEl.value!;
127
+ const { width, height } = el.getBoundingClientRect();
128
+ const fitsBelow = trigger.bottom + OFFSET + height <= window.innerHeight;
129
+ el.style.top = `${fitsBelow ? trigger.bottom + OFFSET : trigger.top - OFFSET - height}px`;
130
+ el.style.left = `${Math.min(Math.max(trigger.left, 0), window.innerWidth - width)}px`;
131
+ }
132
+
133
+ function removeListeners() {
134
+ document.removeEventListener('mousedown', onDocumentMousedown);
135
+ document.removeEventListener('keydown', onDocumentKeydown);
136
+ window.removeEventListener('scroll', placeByRect, true);
137
+ window.removeEventListener('resize', placeByRect);
138
+ }
139
+
140
+ watch(isOpen, async (opened) => {
141
+ if (!opened) {
142
+ removeListeners();
143
+ return;
144
+ }
145
+ await nextTick();
146
+ popoverEl.value!.showPopover();
147
+ document.addEventListener('mousedown', onDocumentMousedown);
148
+ document.addEventListener('keydown', onDocumentKeydown);
149
+ if (!SUPPORTS_ANCHOR) {
150
+ placeByRect();
151
+ window.addEventListener('scroll', placeByRect, true);
152
+ window.addEventListener('resize', placeByRect);
153
+ }
154
+ });
155
+
156
+ onBeforeUnmount(removeListeners);
26
157
  </script>
158
+
159
+ <style>
160
+ /* popover puts the value into the top layer, so no z-index and no clipping by overflow of the table */
161
+ .afcl-json-viewer-popover {
162
+ inset: auto;
163
+ margin: 0;
164
+ }
165
+
166
+ @supports (anchor-name: --a) {
167
+ .afcl-json-viewer-popover {
168
+ position-area: bottom span-right;
169
+ position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
170
+ margin-top: 6px;
171
+ }
172
+ }
173
+ </style>
@@ -0,0 +1,102 @@
1
+ <template>
2
+ <div v-if="line" class="flex">
3
+ <span class="w-4 shrink-0"></span>
4
+ <span :class="TEXT_CLASSES" :style="indent"><span v-for="(token, i) in line" :key="i" :class="JSON_TOKEN_CLASSES[token.kind]">{{ token.text }}</span></span>
5
+ </div>
6
+ <div v-else>
7
+ <div class="flex">
8
+ <button
9
+ type="button"
10
+ class="afcl-json-viewer-toggle flex items-center justify-center w-4 h-5 shrink-0 rounded text-lightInputPlaceholderText hover:text-lightInputIconColor hover:bg-lightSecondaryDarken dark:text-darkInputPlaceholderText dark:hover:text-darkInputIconColor dark:hover:bg-darkSecondaryLighten focus:outline-none focus-visible:ring-[3px] focus-visible:ring-lightFocusRing dark:focus-visible:ring-darkFocusRing"
11
+ :aria-expanded="!folded"
12
+ :aria-label="folded ? t('Expand') : t('Collapse')"
13
+ @click="folded = !folded"
14
+ >
15
+ <IconChevronRight class="w-3 h-3 transition-transform motion-reduce:transition-none" :class="{ 'rotate-90': !folded }" />
16
+ </button>
17
+ <!-- a folded node keeps one line: the preview gets the width which the key and the size leave -->
18
+ <span class="flex items-center min-w-0 flex-1 whitespace-pre" :style="indent">
19
+ <span v-for="(token, i) in keyTokens" :key="i" class="shrink-0" :class="JSON_TOKEN_CLASSES[token.kind]">{{ token.text }}</span>
20
+ <template v-if="folded">
21
+ <button
22
+ type="button"
23
+ class="afcl-json-viewer-preview min-w-0 max-w-[52ch] truncate rounded text-left hover:bg-lightSecondaryDarken dark:hover:bg-darkSecondaryLighten focus:outline-none focus-visible:ring-[3px] focus-visible:ring-lightFocusRing dark:focus-visible:ring-darkFocusRing"
24
+ @click="folded = false"
25
+ ><span v-for="(token, i) in preview" :key="i" :class="JSON_TOKEN_CLASSES[token.kind]">{{ token.text }}</span></button>
26
+ <span v-if="!last" :class="JSON_TOKEN_CLASSES.punct">,</span>
27
+ <span class="ml-1.5" :class="JSON_SIZE_CLASSES">{{ sizeLabel }}</span>
28
+ </template>
29
+ <span v-else :class="JSON_TOKEN_CLASSES.punct">{{ brackets[0] }}</span>
30
+ </span>
31
+ </div>
32
+ <template v-if="!folded">
33
+ <JsonViewerNode
34
+ v-for="([key, item], i) in entries"
35
+ :key="i"
36
+ :value="item"
37
+ :keyName="key"
38
+ :depth="depth + 1"
39
+ :last="i === entries.length - 1"
40
+ :expandDepth="expandDepth"
41
+ :lineWidth="lineWidth"
42
+ />
43
+ <div class="flex">
44
+ <span class="w-4 shrink-0"></span>
45
+ <span :class="TEXT_CLASSES" :style="indent"><span :class="JSON_TOKEN_CLASSES.punct">{{ brackets[1] }}{{ last ? '' : ',' }}</span></span>
46
+ </div>
47
+ </template>
48
+ </div>
49
+ </template>
50
+
51
+ <script setup lang="ts">
52
+ import { computed, ref } from 'vue';
53
+ import { useI18n } from 'vue-i18n';
54
+ import { IconChevronRight } from '@iconify-prerendered/vue-lucide';
55
+ import {
56
+ JSON_PREVIEW_DEPTH,
57
+ JSON_PREVIEW_LENGTH,
58
+ JSON_SIZE_CLASSES,
59
+ JSON_TOKEN_CLASSES,
60
+ inlineJsonTokens,
61
+ isJsonContainer,
62
+ jsonBrackets,
63
+ jsonEntries,
64
+ jsonKeyTokens,
65
+ jsonSizeLabel,
66
+ jsonTokensLength,
67
+ type JsonToken,
68
+ } from './jsonFormat';
69
+
70
+ const TEXT_CLASSES = 'min-w-0 flex-1 whitespace-pre-wrap break-words';
71
+
72
+ const props = defineProps<{
73
+ value: unknown,
74
+ keyName?: string,
75
+ depth: number,
76
+ last: boolean,
77
+ expandDepth: number,
78
+ // characters which fit in a line of the viewer
79
+ lineWidth: number,
80
+ }>();
81
+
82
+ const { t } = useI18n();
83
+
84
+ const indent = computed(() => ({ paddingLeft: `${props.depth * 2}ch` }));
85
+ const keyTokens = computed(() => jsonKeyTokens(props.keyName));
86
+
87
+ // the node in one line when it fits the width, otherwise null and the node breaks by keys
88
+ const line = computed<JsonToken[] | null>(() => {
89
+ const comma: JsonToken[] = props.last ? [] : [{ kind: 'punct', text: ',' }];
90
+ const tokens = [...keyTokens.value, ...inlineJsonTokens(props.value, Infinity, props.lineWidth), ...comma];
91
+ const fits = !isJsonContainer(props.value) || jsonTokensLength(tokens) + props.depth * 2 <= props.lineWidth;
92
+ return fits ? tokens : null;
93
+ });
94
+
95
+ const container = computed(() => props.value as object);
96
+ const entries = computed(() => jsonEntries(container.value));
97
+ const brackets = computed(() => jsonBrackets(container.value));
98
+ const preview = computed(() => inlineJsonTokens(props.value, JSON_PREVIEW_DEPTH, JSON_PREVIEW_LENGTH));
99
+ const sizeLabel = computed(() => jsonSizeLabel(t, container.value));
100
+
101
+ const folded = ref(props.depth >= props.expandDepth);
102
+ </script>
@@ -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,85 @@
1
+ export type JsonTokenKind = 'key' | 'string' | 'number' | 'literal' | 'punct';
2
+ export type JsonToken = { kind: JsonTokenKind, text: string };
3
+ export type JsonEntry = [key: string | undefined, value: unknown];
4
+
5
+ // a node which fits in a line with its indent and key stays on one line, like in Prettier;
6
+ // a line holds this many characters, fewer when the viewer is narrower
7
+ export const JSON_LINE_WIDTH = 60;
8
+ // a folded node and the inline viewer show the value up to two levels deep and cut after this many characters
9
+ export const JSON_PREVIEW_DEPTH = 2;
10
+ export const JSON_PREVIEW_LENGTH = 200;
11
+
12
+ export const JSON_TOKEN_CLASSES: Record<JsonTokenKind, string> = {
13
+ key: 'text-lightShowTableBodyText dark:text-darkShowTableBodyText',
14
+ string: 'text-lightPrimary dark:text-darkPrimary',
15
+ number: 'text-lightWarning dark:text-darkWarning',
16
+ literal: 'italic text-lightInputIconColor dark:text-darkInputIconColor',
17
+ punct: 'text-lightInputPlaceholderText dark:text-darkInputPlaceholderText',
18
+ };
19
+
20
+ export const JSON_SIZE_CLASSES = 'inline-flex items-center shrink-0 h-[18px] px-1.5 rounded-full font-sans text-[11px] font-medium whitespace-nowrap align-[1px] bg-lightSecondaryDarken text-lightInputIconColor dark:bg-darkSecondaryLighten dark:text-darkInputIconColor';
21
+
22
+ export function isJsonContainer(value: unknown): value is object {
23
+ return typeof value === 'object' && value !== null;
24
+ }
25
+
26
+ export function jsonEntries(value: object): JsonEntry[] {
27
+ return Array.isArray(value) ? value.map((item) => [undefined, item]) : Object.entries(value);
28
+ }
29
+
30
+ export function jsonBrackets(value: object): [string, string] {
31
+ return Array.isArray(value) ? ['[', ']'] : ['{', '}'];
32
+ }
33
+
34
+ export function jsonKeyTokens(key: string | undefined): JsonToken[] {
35
+ return key === undefined ? [] : [{ kind: 'key', text: JSON.stringify(key) }, { kind: 'punct', text: ': ' }];
36
+ }
37
+
38
+ export function jsonSizeLabel(t: (message: string, plural: number) => string, value: object): string {
39
+ const size = jsonEntries(value).length;
40
+ return Array.isArray(value) ? t('{count} item | {count} items', size) : t('{count} key | {count} keys', size);
41
+ }
42
+
43
+ export function jsonTokensLength(tokens: JsonToken[]): number {
44
+ return tokens.reduce((sum, token) => sum + token.text.length, 0);
45
+ }
46
+
47
+ // the value in one line as JSON.stringify prints it, with a space after "," and ":";
48
+ // containers deeper than maxDepth become {…}, the walk stops once the text is longer than maxLength
49
+ export function inlineJsonTokens(value: unknown, maxDepth = Infinity, maxLength = Infinity): JsonToken[] {
50
+ const tokens: JsonToken[] = [];
51
+ let length = 0;
52
+
53
+ const push = (kind: JsonTokenKind, text: string) => {
54
+ tokens.push({ kind, text });
55
+ length += text.length;
56
+ };
57
+
58
+ const walk = (node: unknown, depth: number) => {
59
+ if (!isJsonContainer(node)) {
60
+ push(typeof node === 'string' ? 'string' : typeof node === 'number' ? 'number' : 'literal', JSON.stringify(node));
61
+ return;
62
+ }
63
+ const [open, close] = jsonBrackets(node);
64
+ const entries = jsonEntries(node);
65
+ if (entries.length && depth >= maxDepth) {
66
+ push('punct', `${open}…${close}`);
67
+ return;
68
+ }
69
+ push('punct', open);
70
+ for (const [index, [key, item]] of entries.entries()) {
71
+ if (length > maxLength) {
72
+ return;
73
+ }
74
+ if (index) {
75
+ push('punct', ', ');
76
+ }
77
+ jsonKeyTokens(key).forEach((token) => push(token.kind, token.text));
78
+ walk(item, depth + 1);
79
+ }
80
+ push('punct', close);
81
+ };
82
+
83
+ walk(value, 0);
84
+ return tokens;
85
+ }
@@ -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. The element is positioned,
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
- :column="column"
87
- :valueStart="value"
86
+ :type="type || column.type"
87
+ :modelValue="value"
88
88
  auto-hide
89
- @update:valueStart="$emit('update:modelValue', $event)"
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-lightFormFieldTextColor dark:text-darkFormFieldTextColor">{{ column.editingNote[mode] }}</div>
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">