intelliwaketssveltekitv25 0.1.187 → 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,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
  }}>
@@ -5,6 +5,8 @@ type $$ComponentProps = {
5
5
  controlClass?: string;
6
6
  toggleClass?: string;
7
7
  bodyClass?: string;
8
+ setCookieName?: string;
9
+ invalidate?: string | string[] | 'All' | 'app:All' | null;
8
10
  allowCustom?: boolean;
9
11
  show?: boolean;
10
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelliwaketssveltekitv25",
3
- "version": "0.1.187",
3
+ "version": "0.1.189",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.ts",