intelliwaketssveltekitv25 0.1.186 → 0.1.189

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.
@@ -1,18 +1,29 @@
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(),
10
11
  dateRanges = DefaultRangeStringsReport(),
12
+ controlClass,
13
+ toggleClass,
14
+ bodyClass,
15
+ setCookieName,
16
+ invalidate,
11
17
  allowCustom = true,
12
18
  show = $bindable(false)
13
19
  }: {
14
20
  dateRange: TDateRangeString
15
21
  dateRanges?: TDateRangeString[]
22
+ controlClass?: string
23
+ toggleClass?: string
24
+ bodyClass?: string
25
+ setCookieName?: string
26
+ invalidate?: string | string[] | 'All' | 'app:All' | null
16
27
  allowCustom?: boolean
17
28
  show?: boolean
18
29
  } = $props()
@@ -23,6 +34,16 @@
23
34
  selected: dr.name === dateRange.name,
24
35
  linkClick: () => {
25
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
+ }
26
47
  show = false
27
48
  }
28
49
  })),
@@ -54,10 +75,13 @@
54
75
  </script>
55
76
 
56
77
  <DropDownControl
78
+ {controlClass}
79
+ {toggleClass}
80
+ {bodyClass}
57
81
  bind:show>
58
82
  {#snippet toggle()}
59
83
  <div class="inputControl whitespace-nowrap relative pr-6 cursor-pointer [&_*]:cursor-pointer">
60
- {dateRange.name !== CustomRangeName ? dateRange.name : `${DateOnly(dateRange.start, {formatLocale: true})} to ${DateOnly(dateRange.end, {formatLocale: true})}`}
84
+ {dateRange.name !== CustomRangeName ? dateRange.name : `${DateOnly(dateRange.start, { formatLocale: true })} to ${DateOnly(dateRange.end, { formatLocale: true })}`}
61
85
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"
62
86
  class="inline-block h-4 absolute top-1/2 right-1 -translate-y-1/2 ">
63
87
  <path
@@ -89,9 +113,19 @@
89
113
  </button>
90
114
  </div>
91
115
  <div class="text-center">
92
- <button class="btnLink" onclick={() => {
116
+ <button class="btnLink" onclick={async () => {
93
117
  if (customDateRange) {
94
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
+ }
95
129
  show = false
96
130
  }
97
131
  }}>
@@ -2,6 +2,11 @@ import { type TDateRangeString } from './DateRangeFunctions';
2
2
  type $$ComponentProps = {
3
3
  dateRange: TDateRangeString;
4
4
  dateRanges?: TDateRangeString[];
5
+ controlClass?: string;
6
+ toggleClass?: string;
7
+ bodyClass?: string;
8
+ setCookieName?: string;
9
+ invalidate?: string | string[] | 'All' | 'app:All' | null;
5
10
  allowCustom?: boolean;
6
11
  show?: boolean;
7
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelliwaketssveltekitv25",
3
- "version": "0.1.186",
3
+ "version": "0.1.189",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.ts",