fuma 2.0.43 → 2.0.45
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.
|
@@ -6,17 +6,24 @@
|
|
|
6
6
|
import { FormControl, type InputProps } from './index.js'
|
|
7
7
|
import { USE_COERCE_DATE } from '../../utils/constant.js'
|
|
8
8
|
|
|
9
|
-
type $$Props = InputProps<Date | null | undefined>
|
|
9
|
+
type $$Props = InputProps<Date | null | undefined> & { noTime?: boolean }
|
|
10
10
|
export let value: Date | null | undefined = undefined
|
|
11
11
|
export let input: HTMLInputAttributes = {}
|
|
12
|
+
export let noPreserveTime = false
|
|
12
13
|
$: ({ class: inputClass = '', ...inputProps } = input)
|
|
13
14
|
|
|
14
15
|
const dispatch = createEventDispatcher<{ input: Date | null }>()
|
|
15
16
|
|
|
16
17
|
const handleInput: FormEventHandler<HTMLInputElement> = ({ currentTarget }) => {
|
|
17
18
|
const newValue = currentTarget.valueAsDate
|
|
18
|
-
if (newValue
|
|
19
|
-
|
|
19
|
+
if (noPreserveTime) newValue?.setHours(0, 0, 0, 0)
|
|
20
|
+
else
|
|
21
|
+
newValue?.setHours(
|
|
22
|
+
value?.getHours() || 0,
|
|
23
|
+
value?.getMinutes() || 0,
|
|
24
|
+
value?.getSeconds() || 0,
|
|
25
|
+
0
|
|
26
|
+
)
|
|
20
27
|
value = newValue
|
|
21
28
|
dispatch('input', value)
|
|
22
29
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
2
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
3
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
4
|
$$bindings?: Bindings;
|
|
@@ -12,7 +12,30 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
12
12
|
};
|
|
13
13
|
z_$$bindings?: Bindings;
|
|
14
14
|
}
|
|
15
|
-
declare const InputDate: $$__sveltets_2_IsomorphicComponent<
|
|
15
|
+
declare const InputDate: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
class?: string;
|
|
17
|
+
classLabel?: string;
|
|
18
|
+
key?: string;
|
|
19
|
+
label?: import("svelte").Snippet | string;
|
|
20
|
+
labelAppend?: import("svelte").Snippet | null;
|
|
21
|
+
error?: string;
|
|
22
|
+
hint?: string;
|
|
23
|
+
prefix?: string | number;
|
|
24
|
+
prefixFor?: string | number;
|
|
25
|
+
enhanceDisabled?: boolean;
|
|
26
|
+
labelPosition?: "top" | "left" | "right";
|
|
27
|
+
children?: import("svelte").Snippet<[{
|
|
28
|
+
key: string;
|
|
29
|
+
}]> | undefined;
|
|
30
|
+
} & {
|
|
31
|
+
input?: HTMLInputAttributes;
|
|
32
|
+
inputElement?: HTMLInputElement;
|
|
33
|
+
classWrapper?: string;
|
|
34
|
+
value?: Date | null | undefined;
|
|
35
|
+
bindWithParams?: boolean;
|
|
36
|
+
} & {
|
|
37
|
+
noTime?: boolean;
|
|
38
|
+
}, {
|
|
16
39
|
focus: FocusEvent;
|
|
17
40
|
blur: FocusEvent;
|
|
18
41
|
input: CustomEvent<Date | null>;
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
<div class="contents" slot="activator">
|
|
108
108
|
<FormControl {key} {label} {error} class={klass}>
|
|
109
109
|
{#snippet children({ key })}
|
|
110
|
-
<label class="input" class:hidden={item}>
|
|
110
|
+
<label class="input w-full" class:hidden={item}>
|
|
111
111
|
<svelte:component this={Icon} class="h-5 w-5 shrink-0 opacity-70" />
|
|
112
112
|
<input
|
|
113
113
|
type="text"
|