runeforge 0.0.35 → 0.0.36
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.
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
const datePopId = $props.id();
|
|
34
34
|
const dateAnchorName = `--date-anchor-${datePopId}`;
|
|
35
35
|
let datePopoverEl: HTMLElement | undefined = $state();
|
|
36
|
+
let calendarDateEl: (HTMLElement & { value: string }) | undefined = $state();
|
|
36
37
|
|
|
37
38
|
const name = $derived(readonly ? undefined : field.attribute);
|
|
38
39
|
const labelText = $derived(fieldLabel(field));
|
|
@@ -72,6 +73,22 @@
|
|
|
72
73
|
);
|
|
73
74
|
const isMultiValued = $derived(field.type === 'multiselect' || field.type === 'tree');
|
|
74
75
|
|
|
76
|
+
// cally's `change` event doesn't bubble, so the usual `onchange={...}` prop
|
|
77
|
+
// never fires — Svelte 5 delegates events like `change` to a listener on
|
|
78
|
+
// a shared ancestor, which only ever sees events that bubble up to it.
|
|
79
|
+
// Attaching directly on the element (same fix ColumnFilter's date-range
|
|
80
|
+
// picker already uses) sidesteps delegation entirely.
|
|
81
|
+
$effect(() => {
|
|
82
|
+
if (!calendarDateEl) return;
|
|
83
|
+
function handler() {
|
|
84
|
+
if (fieldDisabled) return;
|
|
85
|
+
record[field.attribute] = calendarDateEl!.value;
|
|
86
|
+
datePopoverEl?.hidePopover();
|
|
87
|
+
}
|
|
88
|
+
calendarDateEl.addEventListener('change', handler);
|
|
89
|
+
return () => calendarDateEl?.removeEventListener('change', handler);
|
|
90
|
+
});
|
|
91
|
+
|
|
75
92
|
$effect(() => {
|
|
76
93
|
if (!field.dependentOptions || isMultiValued) return;
|
|
77
94
|
const current = record[field.attribute];
|
|
@@ -193,12 +210,8 @@
|
|
|
193
210
|
>
|
|
194
211
|
<calendar-date
|
|
195
212
|
class="cally"
|
|
213
|
+
bind:this={calendarDateEl}
|
|
196
214
|
value={String(record[field.attribute] ?? '')}
|
|
197
|
-
onchange={(e: Event) => {
|
|
198
|
-
if (fieldDisabled) return;
|
|
199
|
-
record[field.attribute] = (e.currentTarget as HTMLElement & { value: string }).value;
|
|
200
|
-
datePopoverEl?.hidePopover();
|
|
201
|
-
}}
|
|
202
215
|
>
|
|
203
216
|
<svg
|
|
204
217
|
aria-label={strings.previous}
|