diff --git a/src/lib/components/SveltyPicker.svelte b/src/lib/components/SveltyPicker.svelte index 0ce8565..12f3ada 100644 --- a/src/lib/components/SveltyPicker.svelte +++ b/src/lib/components/SveltyPicker.svelte @@ -50,18 +50,11 @@ * ce_displayElement?: HTMLInputElement|null, * positionResolver?: Function, * onChange?: (value: string|string[]|null) => void, - * onDateChange?: (prop: { - * value: string|string[]|null, - * dateValue: Date|Date[]|null, - * displayValue: string, - * valueFormat: string, - * displayFormat: string | null, - * event: 'date'|'hour'|'minute'|'datetime' - * }) => void, + * onDateChange?: (prop: import('$lib/types/internal.js').DateChange) => void, * onCancel?: () => void, * onBlur?: () => void, * onInput?: (currentValue: string|null) => void, - * actionRow?: import('svelte').Snippet<[ + * actionRow?: import('svelte').Snippet<[props: { * autocloseSupported: boolean, * todayBtnClasses: string, * clearBtnClasses: string, @@ -72,8 +65,9 @@ * isTodayDisabled: boolean|null, * i18n: import('$lib/i18n/index.js').i18nType, * currentMode: string - * ]>} - * } */ + * } ]>, + * children?: import('svelte').Snippet + * }} */ let { inputId = '', name = "date", @@ -114,7 +108,8 @@ onCancel, onInput, onBlur, - actionRow = action_row + actionRow = action_row, + children } = $props(); if (isRange && Array.isArray(value) === false) console.warn('[svelty-picker] value property must be an array for range picker'); @@ -584,7 +579,18 @@ $effect(() => watch_formats(format, displayFormat)); -{#snippet action_row(autocloseSupported, todayBtnClasses, clearBtnClasses, onCancel, onConfirm, onClear, onToday, isTodayDisabled, i18n, currentMode)} +{#snippet action_row({ + autocloseSupported, + todayBtnClasses, + clearBtnClasses, + onCancel, + onConfirm, + onClear, + onToday, + isTodayDisabled, + i18n, + currentMode +})} {#if !autocloseSupported || true}
{#if !autocloseSupported} @@ -632,7 +638,15 @@ {/if} {/snippet} - +
+ + +
{#if !ce_displayElement} {#if !pickerOnly} @@ -652,12 +666,13 @@ oninput={manualInput ? onManualInput : () => {}} onfocus={onInputFocus} onblur={onInputBlur} - onclick={onInputClick} onkeydown={onKeyDown} use:inputAction={inputActionParams} /> {/if} {/if} + {@render children?.()} +
{#if pickerVisible && isFocused }
{/each}
- {@render actionRow(autocloseSupported, todayBtnClasses, clearBtnClasses, onCancelFn, onConfirm, onClear, onToday, isTodayDisabled, i18n, currentMode)} + {@render actionRow({ autocloseSupported, todayBtnClasses, clearBtnClasses, onCancel: onCancelFn, onConfirm, onClear, onToday, isTodayDisabled, i18n, currentMode })}
{/if} -
+