intelliwaketssveltekitv25 0.1.187 → 0.1.190
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.
package/dist/Calendar.svelte
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import {
|
|
3
3
|
CleanSubtractNumbers,
|
|
4
|
-
DateComponent,
|
|
4
|
+
DateComponent,
|
|
5
|
+
DateDiff,
|
|
5
6
|
DateOnly,
|
|
6
7
|
DeepEqual,
|
|
7
8
|
GreaterNumber,
|
|
@@ -23,7 +24,7 @@
|
|
|
23
24
|
selectRange = 'Single',
|
|
24
25
|
minYear = 1970,
|
|
25
26
|
maxYear = new Date().getUTCFullYear() + 1,
|
|
26
|
-
maxWidth =
|
|
27
|
+
maxWidth = '20em'
|
|
27
28
|
}: {
|
|
28
29
|
baseDate?: string
|
|
29
30
|
dateRangeString?: TDateRangeString | null
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
if (!applyRangeToSecondDate) {
|
|
62
63
|
applyRangeToSecondDate = true
|
|
63
64
|
let days = !!dateRangeString?.start && !!dateRangeString?.end ? DateDiff(dateRangeString.start, dateRangeString.end, 'day') ?? 0 : 0
|
|
64
|
-
return CreateCustomDateRange(date, DateOnly(date, {days: days}))
|
|
65
|
+
return CreateCustomDateRange(date, DateOnly(date, { days: days }))
|
|
65
66
|
} else {
|
|
66
67
|
applyRangeToSecondDate = false
|
|
67
68
|
return CreateCustomDateRange(dateRangeString?.start ?? date, date)
|
|
@@ -91,21 +92,21 @@
|
|
|
91
92
|
<div
|
|
92
93
|
class="@container text-xs [&_*]:cursor-pointer mx-auto"
|
|
93
94
|
style={!maxWidth ? undefined : `max-width: ${maxWidth}; min-width: 14em;`}>
|
|
94
|
-
<div class="grid grid-cols-[1fr_3fr_2fr_1fr] gap-
|
|
95
|
+
<div class="grid grid-cols-[1fr_3fr_2fr_1fr] gap-1 @min-[25em]:text-lg @min-[35em]:text-xl">
|
|
95
96
|
<button
|
|
96
97
|
class="btnLink"
|
|
97
98
|
onclick={() => setDate(DateOnly(baseDate, selectRange === 'Week' ? {weeks: -1} : {months: -1}), false)}>
|
|
98
99
|
◀
|
|
99
100
|
</button>
|
|
100
101
|
<select
|
|
101
|
-
class="border-none p-0 w-full !bg-transparent dark:text-slate-100 text-center"
|
|
102
|
+
class="border-none p-0 w-full !bg-transparent dark:text-slate-100 text-center text-xs @min-[25em]:text-lg @min-[35em]:text-xl"
|
|
102
103
|
onchange={e => setDate(DateOnly(baseDate, {months: CleanSubtractNumbers(0, e.target?.value, currentMonth)}), false)}>
|
|
103
104
|
{#each MonthNames as month, idx (month)}
|
|
104
105
|
<option value={idx + 1} selected={currentMonth === idx + 1}>{month}</option>
|
|
105
106
|
{/each}
|
|
106
107
|
</select>
|
|
107
108
|
<select
|
|
108
|
-
class="border-none p-0 w-full !bg-transparent dark:text-slate-100 text-center"
|
|
109
|
+
class="border-none p-0 w-full !bg-transparent dark:text-slate-100 text-center text-xs @min-[25em]:text-lg @min-[35em]:text-xl"
|
|
109
110
|
class:bg-transparent={true}
|
|
110
111
|
onchange={e => setDate(DateOnly(baseDate, {years: CleanSubtractNumbers(0, e.target?.value, currentYear)}), false)}>
|
|
111
112
|
{#each years as year (year)}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
|
|
3
3
|
import { CustomRangeName, DefaultRangeStringsReport, type TDateRangeString } from './DateRangeFunctions'
|
|
4
|
-
import { DropDownControl, ListGroupItems, type TListGroupItem } from './index'
|
|
4
|
+
import { CookieCreate, DropDownControl, ListGroupItems, type TListGroupItem } from './index'
|
|
5
5
|
import Calendar from './Calendar.svelte'
|
|
6
|
-
import { DateCompare, DateOnly } from '@solidbasisventures/intelliwaketsfoundation'
|
|
6
|
+
import { DateCompare, DateOnly, ToArray } from '@solidbasisventures/intelliwaketsfoundation'
|
|
7
|
+
import { invalidateAll, invalidate as doInvalidate } from '$app/navigation'
|
|
7
8
|
|
|
8
9
|
let {
|
|
9
10
|
dateRange = $bindable(),
|
|
@@ -11,6 +12,8 @@
|
|
|
11
12
|
controlClass,
|
|
12
13
|
toggleClass,
|
|
13
14
|
bodyClass,
|
|
15
|
+
setCookieName,
|
|
16
|
+
invalidate,
|
|
14
17
|
allowCustom = true,
|
|
15
18
|
show = $bindable(false)
|
|
16
19
|
}: {
|
|
@@ -19,6 +22,8 @@
|
|
|
19
22
|
controlClass?: string
|
|
20
23
|
toggleClass?: string
|
|
21
24
|
bodyClass?: string
|
|
25
|
+
setCookieName?: string
|
|
26
|
+
invalidate?: string | string[] | 'All' | 'app:All' | null
|
|
22
27
|
allowCustom?: boolean
|
|
23
28
|
show?: boolean
|
|
24
29
|
} = $props()
|
|
@@ -29,6 +34,16 @@
|
|
|
29
34
|
selected: dr.name === dateRange.name,
|
|
30
35
|
linkClick: () => {
|
|
31
36
|
dateRange = { ...dr }
|
|
37
|
+
if (setCookieName) {
|
|
38
|
+
CookieCreate(setCookieName, JSON.stringify(dr))
|
|
39
|
+
}
|
|
40
|
+
for (const inv of ToArray(invalidate)) {
|
|
41
|
+
if (inv === 'All' || inv === 'app:All') {
|
|
42
|
+
invalidateAll()
|
|
43
|
+
} else if (inv) {
|
|
44
|
+
doInvalidate(inv)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
32
47
|
show = false
|
|
33
48
|
}
|
|
34
49
|
})),
|
|
@@ -98,9 +113,19 @@
|
|
|
98
113
|
</button>
|
|
99
114
|
</div>
|
|
100
115
|
<div class="text-center">
|
|
101
|
-
<button class="btnLink" onclick={() => {
|
|
116
|
+
<button class="btnLink" onclick={async () => {
|
|
102
117
|
if (customDateRange) {
|
|
103
118
|
dateRange = {...customDateRange}
|
|
119
|
+
if (setCookieName) {
|
|
120
|
+
CookieCreate(setCookieName, JSON.stringify(customDateRange))
|
|
121
|
+
}
|
|
122
|
+
for (const inv of ToArray(invalidate)) {
|
|
123
|
+
if (inv === 'All' || inv === 'app:All') {
|
|
124
|
+
await invalidateAll()
|
|
125
|
+
} else if (inv) {
|
|
126
|
+
await doInvalidate(inv)
|
|
127
|
+
}
|
|
128
|
+
}
|
|
104
129
|
show = false
|
|
105
130
|
}
|
|
106
131
|
}}>
|