intelliwaketssveltekitv25 0.1.122 → 0.1.124
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/DisplayHTML.svelte
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang='ts'>
|
|
2
2
|
import { IncludesHTML, ReplaceLinks, TextToHTML } from '@solidbasisventures/intelliwaketsfoundation'
|
|
3
|
+
import type { Snippet } from 'svelte'
|
|
3
4
|
|
|
4
5
|
let {
|
|
5
6
|
value,
|
|
@@ -9,7 +10,7 @@
|
|
|
9
10
|
*/
|
|
10
11
|
noLinkReplace = false
|
|
11
12
|
}: {
|
|
12
|
-
value: string | null | undefined
|
|
13
|
+
value: string | null | undefined | Snippet
|
|
13
14
|
anchorClasses?: string
|
|
14
15
|
/**
|
|
15
16
|
* Use the noLinkReplace property to not try to change a URL into an anchor link
|
|
@@ -17,15 +18,23 @@
|
|
|
17
18
|
noLinkReplace?: boolean
|
|
18
19
|
} = $props()
|
|
19
20
|
|
|
20
|
-
let
|
|
21
|
+
let isSnippet = $derived(!!value && typeof value === 'function')
|
|
21
22
|
|
|
22
|
-
let
|
|
23
|
+
let valueLink = $derived(isSnippet ? null : ((noLinkReplace ? (value ?? '') : ReplaceLinks(TextToHTML((value ?? '').toString()), anchorClasses)) ?? '').toString())
|
|
24
|
+
|
|
25
|
+
let isHTML = $derived(!isSnippet && IncludesHTML((valueLink ?? '').toString()))
|
|
23
26
|
</script>
|
|
24
27
|
|
|
25
|
-
{#if
|
|
26
|
-
{#if
|
|
27
|
-
{@
|
|
28
|
+
{#if !!value}
|
|
29
|
+
{#if typeof value === 'function'}
|
|
30
|
+
{@render value()}
|
|
28
31
|
{:else}
|
|
29
|
-
{valueLink}
|
|
32
|
+
{#if valueLink}
|
|
33
|
+
{#if isHTML}
|
|
34
|
+
{@html valueLink}
|
|
35
|
+
{:else}
|
|
36
|
+
{valueLink}
|
|
37
|
+
{/if}
|
|
38
|
+
{/if}
|
|
30
39
|
{/if}
|
|
31
40
|
{/if}
|
|
@@ -42,9 +42,13 @@
|
|
|
42
42
|
empty?: Snippet
|
|
43
43
|
} = $props()
|
|
44
44
|
|
|
45
|
+
function titleString(title: string | null | undefined | Snippet): string | null {
|
|
46
|
+
return (typeof title === 'string') ? title : null
|
|
47
|
+
}
|
|
48
|
+
|
|
45
49
|
function pathFromItem(modalItem: TListGroupItem): string {
|
|
46
50
|
return modalItem.href ??
|
|
47
|
-
(ToPascalCase((modalItem.title ?? '').toString()) + (modalItem.value ? `:${modalItem.value}` : ''))
|
|
51
|
+
(ToPascalCase((titleString(modalItem.title) ?? '').toString()) + (modalItem.value ? `:${modalItem.value}` : ''))
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
type TGroupItemPath = TListGroupItem & {
|
|
@@ -96,7 +100,7 @@
|
|
|
96
100
|
}
|
|
97
101
|
|
|
98
102
|
function getKey(listItem: TListGroupItem) {
|
|
99
|
-
return listItem.key ?? `${listItem.value ?? 'v'}:${listItem.title ?? listItem.paneName ?? 't'}:${listItem.sub_title ?? 'st'}:${listItem.badgeValue ?? 'bv'}:${listItem.rightText ?? 'rt'}}`
|
|
103
|
+
return listItem.key ?? `${listItem.value ?? 'v'}:${titleString(listItem.title) ?? listItem.paneName ?? 't'}:${titleString(listItem.sub_title) ?? 'st'}:${listItem.badgeValue ?? 'bv'}:${listItem.rightText ?? 'rt'}}`
|
|
100
104
|
}
|
|
101
105
|
|
|
102
106
|
function sectionClick(section: string) {
|
|
@@ -130,19 +134,20 @@
|
|
|
130
134
|
{:else}
|
|
131
135
|
{#each subItems as listItem, idx (getKey(listItem))}
|
|
132
136
|
{#if listItem?.section && listItem.section !== subItems[idx - 1]?.section}
|
|
133
|
-
<li
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
137
|
+
<li
|
|
138
|
+
class='listGroupHeader block w-full select-none font-bold p-1 cursor-pointer sticky top-0 bg-primary-main text-white'
|
|
139
|
+
class:mt-4={rounded}
|
|
140
|
+
class:overflow-x-hidden={wrapText || ellipses}
|
|
141
|
+
class:whitespace-nowrap={!wrapText}
|
|
142
|
+
class:mt-1={idx > 0}
|
|
143
|
+
class:roundedListGroupItem={rounded}
|
|
144
|
+
class:rounded-lg={rounded}
|
|
145
|
+
class:px-2={rounded}
|
|
146
|
+
title={listItem.hover_title}
|
|
147
|
+
role='menuitem'
|
|
148
|
+
tabindex={-1}
|
|
149
|
+
onkeydown={e => doKeyExecute(e, () => sectionClick(listItem.section ?? ""))}
|
|
150
|
+
onclick={() => sectionClick(listItem?.section ?? "")}>
|
|
146
151
|
<DisplayHTML noLinkReplace={listItem.noLinkReplace ?? noLinkReplace}
|
|
147
152
|
value={listItem.section} />
|
|
148
153
|
</li>
|
|
@@ -229,7 +234,7 @@
|
|
|
229
234
|
<Icon fw
|
|
230
235
|
scale={!listItem.bigIcon ? 1 : 2}
|
|
231
236
|
{...listItem.faProps}
|
|
232
|
-
class={`mr-2 inline-block ${!listItem.bigIcon ? '' : 'ml-2'} ${listItem.faProps.class ?? ''}`.trim()}/>
|
|
237
|
+
class={`mr-2 inline-block ${!listItem.bigIcon ? '' : 'ml-2'} ${listItem.faProps.class ?? ''}`.trim()} />
|
|
233
238
|
{/if}
|
|
234
239
|
{#if !!listItem.icon}
|
|
235
240
|
<Icon fw
|
|
@@ -241,10 +246,10 @@
|
|
|
241
246
|
<div class='overflow-hidden'
|
|
242
247
|
class:whitespace-nowrap={!wrapText}
|
|
243
248
|
class:text-ellipsis={!wrapText && ellipses}
|
|
244
|
-
title={!ellipses ? undefined : listItem.title}>
|
|
249
|
+
title={!ellipses ? undefined : titleString(listItem.title) ?? undefined}>
|
|
245
250
|
<DisplayHTML noLinkReplace={listItem.noLinkReplace ?? noLinkReplace}
|
|
246
251
|
value={listItem.title} />
|
|
247
|
-
{#if listItem.sub_title && !rounded}
|
|
252
|
+
{#if !!titleString(listItem.sub_title) && !rounded}
|
|
248
253
|
<div class='text-sm font-thin'>
|
|
249
254
|
<DisplayHTML noLinkReplace={listItem.noLinkReplace ?? noLinkReplace}
|
|
250
255
|
value={listItem.sub_title} />
|
|
@@ -278,7 +283,7 @@
|
|
|
278
283
|
|
|
279
284
|
<!-- row 2 -->
|
|
280
285
|
<div class:col-span-3={!listItem.bigIcon} class:col-span-2={listItem.bigIcon}>
|
|
281
|
-
{#if listItem.sub_title && rounded}
|
|
286
|
+
{#if !!titleString(listItem.sub_title) && rounded}
|
|
282
287
|
<div class='text-sm font-light text-gray-700 text-justify mt-0.5'>
|
|
283
288
|
<DisplayHTML noLinkReplace={listItem.noLinkReplace ?? noLinkReplace}
|
|
284
289
|
value={listItem.sub_title} />
|
|
@@ -313,10 +318,10 @@
|
|
|
313
318
|
<div class='overflow-hidden'
|
|
314
319
|
class:whitespace-nowrap={!wrapText}
|
|
315
320
|
class:text-ellipsis={!wrapText && ellipses}
|
|
316
|
-
title={!ellipses ? undefined : listItem.title}>
|
|
321
|
+
title={!ellipses ? undefined : titleString(listItem.title) ?? undefined}>
|
|
317
322
|
<DisplayHTML noLinkReplace={listItem.noLinkReplace ?? noLinkReplace}
|
|
318
323
|
value={listItem.title} />
|
|
319
|
-
{#if listItem.sub_title}
|
|
324
|
+
{#if !!titleString(listItem.sub_title)}
|
|
320
325
|
<div class='text-sm font-thin'>
|
|
321
326
|
<DisplayHTML noLinkReplace={listItem.noLinkReplace ?? noLinkReplace}
|
|
322
327
|
value={listItem.sub_title} />
|