fuma 0.3.48 → 0.3.49
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.
|
@@ -3,59 +3,61 @@ import { slide } from "svelte/transition";
|
|
|
3
3
|
import { mdiChevronRight } from "@mdi/js";
|
|
4
4
|
import { Icon } from "../icon/index.js";
|
|
5
5
|
import { urlParam } from "../../store/index.js";
|
|
6
|
+
import { goto } from "$app/navigation";
|
|
6
7
|
export let value;
|
|
7
8
|
let klass = "";
|
|
8
9
|
export { klass as class };
|
|
10
|
+
export let classHeader = "";
|
|
11
|
+
export let classBody = "";
|
|
12
|
+
export let classTitle = "";
|
|
13
|
+
export let classSubtitle = "";
|
|
9
14
|
$:
|
|
10
15
|
isOpen = $urlParam.hasValue("section", value);
|
|
11
|
-
let
|
|
16
|
+
let section;
|
|
12
17
|
let timeout;
|
|
13
|
-
function handleClick() {
|
|
18
|
+
async function handleClick() {
|
|
19
|
+
await goto($urlParam.toggle({ section: value }), { noScroll: true, keepFocus: true });
|
|
20
|
+
if (!section)
|
|
21
|
+
return;
|
|
22
|
+
const bound = section.getBoundingClientRect();
|
|
23
|
+
window.scrollTo({ top: bound.top, behavior: "smooth" });
|
|
14
24
|
timeout = setTimeout(() => {
|
|
15
|
-
|
|
16
|
-
return;
|
|
17
|
-
const bound = card.getBoundingClientRect();
|
|
18
|
-
window.scrollTo({ top: bound.top, behavior: "smooth" });
|
|
19
|
-
}, 250);
|
|
25
|
+
}, 225);
|
|
20
26
|
}
|
|
21
27
|
onDestroy(() => {
|
|
22
28
|
clearTimeout(timeout);
|
|
23
29
|
});
|
|
24
30
|
</script>
|
|
25
31
|
|
|
26
|
-
<
|
|
27
|
-
<div
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<div class="flex gap-2">
|
|
39
|
-
<div class="title min-w-0 overflow-hidden text-ellipsis">
|
|
40
|
-
<slot name="title" />
|
|
41
|
-
</div>
|
|
42
|
-
<Icon
|
|
43
|
-
path={mdiChevronRight}
|
|
44
|
-
class="ml-auto transition-transform {isOpen ? 'rotate-90' : ''}"
|
|
45
|
-
/>
|
|
32
|
+
<section class="card bordered border bg-base-100 shadow-md {klass}" bind:this={section}>
|
|
33
|
+
<div
|
|
34
|
+
id={value}
|
|
35
|
+
tabindex="0"
|
|
36
|
+
class="min-w-0 grow cursor-pointer p-2 sm:px-5 sm:py-3 {classHeader}"
|
|
37
|
+
role="link"
|
|
38
|
+
on:click={handleClick}
|
|
39
|
+
on:keydown={(e) => e.key === ' ' && handleClick()}
|
|
40
|
+
>
|
|
41
|
+
<div class="flex gap-2">
|
|
42
|
+
<div class="min-w-0 overflow-hidden text-ellipsis font-medium {classTitle}">
|
|
43
|
+
<slot name="title" />
|
|
46
44
|
</div>
|
|
45
|
+
<Icon
|
|
46
|
+
path={mdiChevronRight}
|
|
47
|
+
class="ml-auto opacity-80 transition-transform {isOpen ? 'rotate-90' : ''}"
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
47
50
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
</a>
|
|
51
|
+
{#if $$slots.subtitle}
|
|
52
|
+
<div class="text-sm {classSubtitle}">
|
|
53
|
+
<slot name="subtitle" />
|
|
54
|
+
</div>
|
|
55
|
+
{/if}
|
|
54
56
|
</div>
|
|
55
57
|
|
|
56
58
|
{#if isOpen}
|
|
57
|
-
<div class="card-body p-4 pt-0 md:p-8 md:pt-0" transition:slide={{ duration: 200 }}>
|
|
59
|
+
<div class="card-body p-4 pt-0 md:p-8 md:pt-0 {classBody}" transition:slide={{ duration: 200 }}>
|
|
58
60
|
<slot />
|
|
59
61
|
</div>
|
|
60
62
|
{/if}
|
|
61
|
-
</
|
|
63
|
+
</section>
|
|
@@ -3,12 +3,15 @@ declare const __propDef: {
|
|
|
3
3
|
props: {
|
|
4
4
|
value: string;
|
|
5
5
|
class?: string | undefined;
|
|
6
|
+
classHeader?: string | undefined;
|
|
7
|
+
classBody?: string | undefined;
|
|
8
|
+
classTitle?: string | undefined;
|
|
9
|
+
classSubtitle?: string | undefined;
|
|
6
10
|
};
|
|
7
11
|
events: {
|
|
8
12
|
[evt: string]: CustomEvent<any>;
|
|
9
13
|
};
|
|
10
14
|
slots: {
|
|
11
|
-
logo: {};
|
|
12
15
|
title: {};
|
|
13
16
|
subtitle: {};
|
|
14
17
|
default: {};
|
|
@@ -34,7 +34,6 @@ async function initTimePicker() {
|
|
|
34
34
|
setup: (picker2) => {
|
|
35
35
|
picker2.on("selected", (date1, date2) => {
|
|
36
36
|
const start = `${getAbsoluteDate(date1.dateInstance)}T${getAbsoluteTime(period?.start)}`;
|
|
37
|
-
console.log(start);
|
|
38
37
|
period = {
|
|
39
38
|
start: /* @__PURE__ */ new Date(
|
|
40
39
|
`${getAbsoluteDate(date1.dateInstance)}T${getAbsoluteTime(period?.start)}`
|
|
@@ -43,7 +42,6 @@ async function initTimePicker() {
|
|
|
43
42
|
`${getAbsoluteDate(date2.dateInstance)}T${getAbsoluteTime(period?.end, "23:59:00")}`
|
|
44
43
|
)
|
|
45
44
|
};
|
|
46
|
-
console.log(period);
|
|
47
45
|
dispatch("change", period);
|
|
48
46
|
});
|
|
49
47
|
}
|
|
@@ -53,7 +51,6 @@ const getAbsoluteDate = (date) => [date.getFullYear(), date.getMonth() + 1, date
|
|
|
53
51
|
const getAbsoluteTime = (date, defaultTime = "00:00:00") => {
|
|
54
52
|
if (!date)
|
|
55
53
|
return defaultTime;
|
|
56
|
-
console.log(date.getHours());
|
|
57
54
|
return [date.getHours(), date.getMinutes(), date.getSeconds()].map((n) => n.toString().padStart(2, "0")).join(":");
|
|
58
55
|
};
|
|
59
56
|
</script>
|