sveltacular 0.0.48 → 0.0.50
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/README.md +31 -31
- package/dist/forms/bool-box/bool-box.svelte +3 -3
- package/dist/forms/button/button.svelte +7 -7
- package/dist/forms/check-box/check-box-group.svelte +14 -14
- package/dist/forms/check-box/check-box.svelte +23 -23
- package/dist/forms/combo/new-or-existing-combo.svelte +56 -56
- package/dist/forms/date-box/date-box.svelte +19 -19
- package/dist/forms/file-area/file-area.svelte +31 -31
- package/dist/forms/file-box/file-box.svelte +23 -23
- package/dist/forms/form-field.svelte +7 -7
- package/dist/forms/form-footer.svelte +15 -15
- package/dist/forms/form-header.svelte +9 -9
- package/dist/forms/form-label.svelte +5 -5
- package/dist/forms/form-section.svelte +14 -14
- package/dist/forms/form.svelte +7 -7
- package/dist/forms/info-box/info-box.svelte +19 -19
- package/dist/forms/list-box/list-box.svelte +45 -45
- package/dist/forms/list-box/list-box.svelte.d.ts +2 -2
- package/dist/forms/money-box/money-box.svelte +5 -5
- package/dist/forms/number-box/number-box.svelte +29 -29
- package/dist/forms/phone-box/phone-box.svelte +50 -50
- package/dist/forms/radio-group/radio-box.svelte +15 -15
- package/dist/forms/radio-group/radio-group.svelte +12 -12
- package/dist/forms/switch-box/switch-box.svelte +16 -16
- package/dist/forms/text-area/text-area.svelte +10 -10
- package/dist/forms/text-box/text-box.svelte +34 -34
- package/dist/forms/url-box/url-box.svelte +14 -14
- package/dist/generic/address/address.svelte +40 -0
- package/dist/generic/address/address.svelte.d.ts +20 -0
- package/dist/generic/card/card-container.svelte +7 -7
- package/dist/generic/card/card.svelte +10 -10
- package/dist/generic/date/date-time.svelte +3 -3
- package/dist/generic/divider/divider.svelte +3 -3
- package/dist/generic/dot/dot.svelte +5 -5
- package/dist/generic/email/email.svelte +30 -0
- package/dist/generic/email/email.svelte.d.ts +16 -0
- package/dist/generic/empty/empty.svelte +14 -14
- package/dist/generic/header/header.svelte +17 -17
- package/dist/generic/link/link.svelte +13 -13
- package/dist/generic/menu/menu.svelte +39 -39
- package/dist/generic/menu/menu.svelte.d.ts +1 -1
- package/dist/generic/notice/notice.svelte +25 -25
- package/dist/generic/overlay.svelte +8 -8
- package/dist/generic/panel/panel.svelte +10 -10
- package/dist/generic/phone/phone.svelte +56 -0
- package/dist/generic/phone/phone.svelte.d.ts +17 -0
- package/dist/generic/pill/pill.svelte +7 -7
- package/dist/generic/scorecard/scorecard.svelte +10 -10
- package/dist/generic/section/section.svelte +10 -10
- package/dist/helpers/capitalize.d.ts +4 -0
- package/dist/helpers/capitalize.js +13 -0
- package/dist/helpers/navigate-to.js +15 -3
- package/dist/helpers/nobr.d.ts +4 -0
- package/dist/helpers/nobr.js +4 -0
- package/dist/helpers/split-new-lines.d.ts +4 -0
- package/dist/helpers/split-new-lines.js +4 -0
- package/dist/helpers/ucfirst.d.ts +1 -0
- package/dist/helpers/ucfirst.js +3 -0
- package/dist/icons/angle-right-icon.svelte +11 -11
- package/dist/icons/angle-up-icon.svelte +9 -9
- package/dist/icons/check-icon.svelte +15 -15
- package/dist/icons/envelope-icon.svelte +8 -0
- package/dist/icons/envelope-icon.svelte.d.ts +23 -0
- package/dist/icons/folder-open-icon.svelte +12 -12
- package/dist/icons/hamburger-icon.svelte +15 -15
- package/dist/icons/home-icon.svelte +7 -7
- package/dist/icons/link-icon.svelte +15 -15
- package/dist/icons/mobile-phone-icon.svelte +5 -0
- package/dist/icons/mobile-phone-icon.svelte.d.ts +23 -0
- package/dist/icons/phone-icon.svelte +9 -0
- package/dist/icons/phone-icon.svelte.d.ts +23 -0
- package/dist/icons/svg-icon.svelte +5 -5
- package/dist/icons/upload-icon.svelte +9 -9
- package/dist/images/icon.svelte +5 -5
- package/dist/images/image.svelte +28 -28
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/layout/flex-col.svelte +7 -7
- package/dist/layout/flex-item.svelte +7 -7
- package/dist/layout/flex-row.svelte +10 -10
- package/dist/layout/grid.svelte +17 -17
- package/dist/modals/alert.svelte +24 -24
- package/dist/modals/confirm.svelte +27 -27
- package/dist/modals/dialog-body.svelte +5 -5
- package/dist/modals/dialog-close-button.svelte +7 -7
- package/dist/modals/dialog-footer.svelte +9 -9
- package/dist/modals/dialog-header.svelte +5 -5
- package/dist/modals/dialog-window.svelte +9 -9
- package/dist/modals/modal.svelte +12 -12
- package/dist/modals/prompt.svelte +29 -29
- package/dist/navigation/accordian/accordian.svelte +17 -17
- package/dist/navigation/app-bar/app-bar.svelte +7 -7
- package/dist/navigation/app-bar/app-branding.svelte +18 -18
- package/dist/navigation/app-bar/app-logo.svelte +11 -11
- package/dist/navigation/app-bar/app-nav-item.svelte +14 -14
- package/dist/navigation/app-bar/app-nav.svelte +12 -12
- package/dist/navigation/breadcrumbs/breadcrumbs.svelte +25 -25
- package/dist/navigation/pagination/pagination.svelte +27 -27
- package/dist/navigation/side-bar/side-bar.svelte +10 -10
- package/dist/navigation/tabs/tab-group.svelte +20 -20
- package/dist/navigation/tabs/tab.svelte +20 -10
- package/dist/navigation/tabs/tab.svelte.d.ts +1 -0
- package/dist/navigation/wizard/wizard-step.svelte +12 -12
- package/dist/navigation/wizard/wizard.svelte +27 -27
- package/dist/placeholders/loading.svelte +9 -9
- package/dist/placeholders/progress.svelte +9 -9
- package/dist/placeholders/skeleton-text.svelte +13 -13
- package/dist/tables/data-grid.svelte +80 -80
- package/dist/tables/table-body.svelte +3 -3
- package/dist/tables/table-caption.svelte +5 -5
- package/dist/tables/table-cell.svelte +7 -7
- package/dist/tables/table-footer-cell.svelte +21 -21
- package/dist/tables/table-footer-row.svelte +3 -3
- package/dist/tables/table-footer.svelte +13 -13
- package/dist/tables/table-header-cell.svelte +7 -7
- package/dist/tables/table-header-row.svelte +4 -4
- package/dist/tables/table-header.svelte +14 -14
- package/dist/tables/table-row.svelte +16 -16
- package/dist/tables/table.svelte +11 -11
- package/dist/timeline/timeline-item.svelte +26 -26
- package/dist/timeline/timeline.svelte +5 -5
- package/dist/types/form.d.ts +1 -1
- package/dist/typography/code-block.svelte +7 -7
- package/dist/typography/headline.svelte +19 -19
- package/dist/typography/paragraph.svelte +13 -13
- package/dist/typography/subtitle.svelte +7 -7
- package/dist/typography/text.svelte +7 -7
- package/package.json +101 -101
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<script>import Overlay from "../../generic/overlay.svelte";
|
|
2
2
|
export let open = false;
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
|
-
<div class:open>
|
|
6
|
-
<Overlay show={open} />
|
|
7
|
-
<aside>
|
|
8
|
-
<slot />
|
|
9
|
-
</aside>
|
|
10
|
-
</div>
|
|
11
|
-
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<div class:open>
|
|
6
|
+
<Overlay show={open} />
|
|
7
|
+
<aside>
|
|
8
|
+
<slot />
|
|
9
|
+
</aside>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
12
|
<style>div aside {
|
|
13
13
|
width: 300px;
|
|
14
14
|
padding: 0;
|
|
@@ -33,4 +33,4 @@ div.open {
|
|
|
33
33
|
}
|
|
34
34
|
div.open aside {
|
|
35
35
|
left: 0;
|
|
36
|
-
}</style>
|
|
36
|
+
}</style>
|
|
@@ -19,25 +19,25 @@ const ctx = {
|
|
|
19
19
|
register
|
|
20
20
|
};
|
|
21
21
|
setContext(tabContext, ctx);
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<section class="tab-group {style}">
|
|
25
|
-
<div class="tab-head">
|
|
26
|
-
<nav>
|
|
27
|
-
{#each $tabs as tab}
|
|
28
|
-
<li class={$active == tab.id ? 'active' : 'inactive'}>
|
|
29
|
-
<button on:click={() => selectTab(tab.id)}>
|
|
30
|
-
{tab.name}
|
|
31
|
-
</button>
|
|
32
|
-
</li>
|
|
33
|
-
{/each}
|
|
34
|
-
</nav>
|
|
35
|
-
</div>
|
|
36
|
-
<div class="tab-content">
|
|
37
|
-
<slot />
|
|
38
|
-
</div>
|
|
39
|
-
</section>
|
|
40
|
-
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<section class="tab-group {style}">
|
|
25
|
+
<div class="tab-head">
|
|
26
|
+
<nav>
|
|
27
|
+
{#each $tabs as tab}
|
|
28
|
+
<li class={$active == tab.id ? 'active' : 'inactive'}>
|
|
29
|
+
<button on:click={() => selectTab(tab.id)}>
|
|
30
|
+
{tab.name}
|
|
31
|
+
</button>
|
|
32
|
+
</li>
|
|
33
|
+
{/each}
|
|
34
|
+
</nav>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="tab-content">
|
|
37
|
+
<slot />
|
|
38
|
+
</div>
|
|
39
|
+
</section>
|
|
40
|
+
|
|
41
41
|
<style>.tab-head {
|
|
42
42
|
height: 2rem;
|
|
43
43
|
position: relative;
|
|
@@ -154,4 +154,4 @@ setContext(tabContext, ctx);
|
|
|
154
154
|
.overline .inactive button {
|
|
155
155
|
border-style: none;
|
|
156
156
|
color: var(--tab-overline-fg, rgb(180, 180, 180));
|
|
157
|
-
}</style>
|
|
157
|
+
}</style>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<script>import { createEventDispatcher, getContext, onDestroy } from "svelte";
|
|
2
2
|
import { tabContext } from "./tab-context.js";
|
|
3
|
-
import { uniqueId } from "../../index.js";
|
|
3
|
+
import { navigateTo, uniqueId } from "../../index.js";
|
|
4
|
+
import Loading from "../../placeholders/loading.svelte";
|
|
4
5
|
export let title;
|
|
6
|
+
export let href = void 0;
|
|
5
7
|
export let active = false;
|
|
6
8
|
const dispatch = createEventDispatcher();
|
|
7
9
|
const ctx = getContext(tabContext);
|
|
@@ -10,19 +12,27 @@ const id = uniqueId();
|
|
|
10
12
|
ctx.register(id, title, active);
|
|
11
13
|
const unsubscribe = ctx.active.subscribe((selectedId) => {
|
|
12
14
|
active = selectedId === id;
|
|
15
|
+
if (active && href) {
|
|
16
|
+
console.log("Navigating to", href);
|
|
17
|
+
navigateTo(href);
|
|
18
|
+
}
|
|
13
19
|
});
|
|
14
20
|
onDestroy(() => unsubscribe());
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<article class:active>
|
|
18
|
-
{#if active}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<article class:active>
|
|
24
|
+
{#if active}
|
|
25
|
+
{#if $$slots.default}
|
|
26
|
+
<slot />
|
|
27
|
+
{:else}
|
|
28
|
+
<Loading />
|
|
29
|
+
{/if}
|
|
30
|
+
{/if}
|
|
31
|
+
</article>
|
|
32
|
+
|
|
23
33
|
<style>article {
|
|
24
34
|
display: none;
|
|
25
35
|
}
|
|
26
36
|
article.active {
|
|
27
37
|
display: block;
|
|
28
|
-
}</style>
|
|
38
|
+
}</style>
|
|
@@ -9,17 +9,17 @@ $:
|
|
|
9
9
|
isCurrentStep = $state.currentStep === step;
|
|
10
10
|
$:
|
|
11
11
|
errors = $state.errors;
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<div class="step {isCurrentStep ? 'current' : ''}">
|
|
15
|
-
{#if errors.length}
|
|
16
|
-
<div class="errors">
|
|
17
|
-
<Notice style="error" size="md">{errors.join(' ')}</Notice>
|
|
18
|
-
</div>
|
|
19
|
-
{/if}
|
|
20
|
-
<slot />
|
|
21
|
-
</div>
|
|
22
|
-
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<div class="step {isCurrentStep ? 'current' : ''}">
|
|
15
|
+
{#if errors.length}
|
|
16
|
+
<div class="errors">
|
|
17
|
+
<Notice style="error" size="md">{errors.join(' ')}</Notice>
|
|
18
|
+
</div>
|
|
19
|
+
{/if}
|
|
20
|
+
<slot />
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
23
|
<style>.step {
|
|
24
24
|
display: none;
|
|
25
25
|
}
|
|
@@ -31,4 +31,4 @@ $:
|
|
|
31
31
|
display: flex;
|
|
32
32
|
flex-direction: column;
|
|
33
33
|
gap: 1rem;
|
|
34
|
-
}</style>
|
|
34
|
+
}</style>
|
|
@@ -82,32 +82,32 @@ $:
|
|
|
82
82
|
subtitle = steps[currentStep];
|
|
83
83
|
$:
|
|
84
84
|
total = Object.values(steps).length;
|
|
85
|
-
</script>
|
|
86
|
-
|
|
87
|
-
<section class:disabled>
|
|
88
|
-
<Header {title} {subtitle} {level} />
|
|
89
|
-
<div class="content">
|
|
90
|
-
<slot />
|
|
91
|
-
</div>
|
|
92
|
-
<footer>
|
|
93
|
-
<div>
|
|
94
|
-
{#if !isFirstStep}
|
|
95
|
-
<Button type="button" style="secondary" on:click={previous} {disabled}>Previous</Button>
|
|
96
|
-
{/if}
|
|
97
|
-
</div>
|
|
98
|
-
<div>
|
|
99
|
-
<div>Step {currentStep} of {total}</div>
|
|
100
|
-
</div>
|
|
101
|
-
<div>
|
|
102
|
-
{#if isLastStep}
|
|
103
|
-
<Button type="submit" style="primary" on:click={done} {disabled}>Done</Button>
|
|
104
|
-
{:else}
|
|
105
|
-
<Button type="button" style="primary" on:click={next} {disabled}>Next</Button>
|
|
106
|
-
{/if}
|
|
107
|
-
</div>
|
|
108
|
-
</footer>
|
|
109
|
-
</section>
|
|
110
|
-
|
|
85
|
+
</script>
|
|
86
|
+
|
|
87
|
+
<section class:disabled>
|
|
88
|
+
<Header {title} {subtitle} {level} />
|
|
89
|
+
<div class="content">
|
|
90
|
+
<slot />
|
|
91
|
+
</div>
|
|
92
|
+
<footer>
|
|
93
|
+
<div>
|
|
94
|
+
{#if !isFirstStep}
|
|
95
|
+
<Button type="button" style="secondary" on:click={previous} {disabled}>Previous</Button>
|
|
96
|
+
{/if}
|
|
97
|
+
</div>
|
|
98
|
+
<div>
|
|
99
|
+
<div>Step {currentStep} of {total}</div>
|
|
100
|
+
</div>
|
|
101
|
+
<div>
|
|
102
|
+
{#if isLastStep}
|
|
103
|
+
<Button type="submit" style="primary" on:click={done} {disabled}>Done</Button>
|
|
104
|
+
{:else}
|
|
105
|
+
<Button type="button" style="primary" on:click={next} {disabled}>Next</Button>
|
|
106
|
+
{/if}
|
|
107
|
+
</div>
|
|
108
|
+
</footer>
|
|
109
|
+
</section>
|
|
110
|
+
|
|
111
111
|
<style>section.disabled {
|
|
112
112
|
opacity: 0.5;
|
|
113
113
|
}
|
|
@@ -121,4 +121,4 @@ footer {
|
|
|
121
121
|
}
|
|
122
122
|
footer div {
|
|
123
123
|
width: 100%;
|
|
124
|
-
}</style>
|
|
124
|
+
}</style>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script>export let type = "spinner";
|
|
2
|
-
</script>
|
|
3
|
-
|
|
4
|
-
<div class={type}>
|
|
5
|
-
<span>
|
|
6
|
-
<slot />
|
|
7
|
-
</span>
|
|
8
|
-
</div>
|
|
9
|
-
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<div class={type}>
|
|
5
|
+
<span>
|
|
6
|
+
<slot />
|
|
7
|
+
</span>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
10
|
<style>div {
|
|
11
11
|
text-align: center;
|
|
12
12
|
}
|
|
@@ -53,4 +53,4 @@ div.block {
|
|
|
53
53
|
opacity: 1;
|
|
54
54
|
transform: scale(1);
|
|
55
55
|
}
|
|
56
|
-
}</style>
|
|
56
|
+
}</style>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script>export let value = 0;
|
|
2
|
-
</script>
|
|
3
|
-
|
|
4
|
-
<div class="progress-bar" style="--progress-value: {value}%">
|
|
5
|
-
<div class="progress">
|
|
6
|
-
<div class="progress-value">{value}%</div>
|
|
7
|
-
</div>
|
|
8
|
-
</div>
|
|
9
|
-
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<div class="progress-bar" style="--progress-value: {value}%">
|
|
5
|
+
<div class="progress">
|
|
6
|
+
<div class="progress-value">{value}%</div>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
10
|
<style>.progress-bar {
|
|
11
11
|
height: 2rem;
|
|
12
12
|
background-color: var(--base-color-fg, #ccc);
|
|
@@ -33,4 +33,4 @@
|
|
|
33
33
|
line-height: 1.5rem;
|
|
34
34
|
padding: 0 0.5rem;
|
|
35
35
|
text-shadow: 0 0 0.5rem rgba(0, 0, 0, 0.5);
|
|
36
|
-
}</style>
|
|
36
|
+
}</style>
|
|
@@ -3,16 +3,16 @@ export let min = 50;
|
|
|
3
3
|
export let max = 100;
|
|
4
4
|
$:
|
|
5
5
|
width = randomInt(min, max);
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<div style="width: {width}%" />
|
|
9
|
-
|
|
10
|
-
<style>
|
|
11
|
-
div {
|
|
12
|
-
height: 1rem;
|
|
13
|
-
background-color: var(--base-color-fg, #ccc);
|
|
14
|
-
opacity: 0.5;
|
|
15
|
-
border-radius: 1rem;
|
|
16
|
-
margin-bottom: 1rem;
|
|
17
|
-
}
|
|
18
|
-
</style>
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<div style="width: {width}%" />
|
|
9
|
+
|
|
10
|
+
<style>
|
|
11
|
+
div {
|
|
12
|
+
height: 1rem;
|
|
13
|
+
background-color: var(--base-color-fg, #ccc);
|
|
14
|
+
opacity: 0.5;
|
|
15
|
+
border-radius: 1rem;
|
|
16
|
+
margin-bottom: 1rem;
|
|
17
|
+
}
|
|
18
|
+
</style>
|
|
@@ -74,85 +74,85 @@ $:
|
|
|
74
74
|
totalPages = pagination && rows ? calculateTotalPages() : 1;
|
|
75
75
|
$:
|
|
76
76
|
filteredRows = rows && pagination ? filterRows() : rows;
|
|
77
|
-
</script>
|
|
78
|
-
|
|
79
|
-
<Table>
|
|
80
|
-
{#if caption}
|
|
81
|
-
<TableCaption>{caption}</TableCaption>
|
|
82
|
-
{/if}
|
|
83
|
-
<TableHeader>
|
|
84
|
-
<TableHeaderRow>
|
|
85
|
-
{#each cols as col}
|
|
86
|
-
{#if !col.hide}
|
|
87
|
-
<TableHeaderCell type={getColType(col)} width={col.width}>{col.label}</TableHeaderCell>
|
|
88
|
-
{/if}
|
|
89
|
-
{/each}
|
|
90
|
-
{#if hasActionRow}
|
|
91
|
-
<TableHeaderCell type="string" />
|
|
92
|
-
{/if}
|
|
93
|
-
</TableHeaderRow>
|
|
94
|
-
</TableHeader>
|
|
95
|
-
<TableBody>
|
|
96
|
-
{#if !filteredRows?.length}
|
|
97
|
-
<TableRow>
|
|
98
|
-
<TableCell colspan={colCount}>
|
|
99
|
-
<div class="empty">
|
|
100
|
-
{#if rows === undefined}
|
|
101
|
-
<Loading />
|
|
102
|
-
{:else}
|
|
103
|
-
<Empty>
|
|
104
|
-
<FolderOpenIcon />
|
|
105
|
-
</Empty>
|
|
106
|
-
{/if}
|
|
107
|
-
</div>
|
|
108
|
-
</TableCell>
|
|
109
|
-
</TableRow>
|
|
110
|
-
{:else}
|
|
111
|
-
{#each filteredRows as row}
|
|
112
|
-
<TableRow>
|
|
113
|
-
{#each cols as col}
|
|
114
|
-
{#if !col.hide}
|
|
115
|
-
<TableCell type={col.type || typeof row[col.key]} width={col.width}>
|
|
116
|
-
{#if col.link}
|
|
117
|
-
<a href={col.link(row, col.key)}>{format(row, col.key)}</a>
|
|
118
|
-
{:else}
|
|
119
|
-
{format(row, col.key)}
|
|
120
|
-
{/if}
|
|
121
|
-
</TableCell>
|
|
122
|
-
{/if}
|
|
123
|
-
{/each}
|
|
124
|
-
{#if hasActionRow}
|
|
125
|
-
<TableCell type="actions">
|
|
126
|
-
{#if editRow}
|
|
127
|
-
<button type="button" on:click={() => clickEdit(row)}>Edit</button>
|
|
128
|
-
{/if}
|
|
129
|
-
{#if deleteRow}
|
|
130
|
-
<button type="button" on:click={() => clickDelete(row)}>Delete</button>
|
|
131
|
-
{/if}
|
|
132
|
-
</TableCell>
|
|
133
|
-
{/if}
|
|
134
|
-
</TableRow>
|
|
135
|
-
{/each}
|
|
136
|
-
{/if}
|
|
137
|
-
</TableBody>
|
|
138
|
-
{#if pagination}
|
|
139
|
-
<TableFooter>
|
|
140
|
-
<TableFooterRow>
|
|
141
|
-
<TableFooterCell colspan={colCount}>
|
|
142
|
-
<Pagination
|
|
143
|
-
currentPage={pagination.page}
|
|
144
|
-
{totalPages}
|
|
145
|
-
style="flat"
|
|
146
|
-
size="sm"
|
|
147
|
-
align="center"
|
|
148
|
-
on:page={changePage}
|
|
149
|
-
/>
|
|
150
|
-
</TableFooterCell>
|
|
151
|
-
</TableFooterRow>
|
|
152
|
-
</TableFooter>
|
|
153
|
-
{/if}
|
|
154
|
-
</Table>
|
|
155
|
-
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<Table>
|
|
80
|
+
{#if caption}
|
|
81
|
+
<TableCaption>{caption}</TableCaption>
|
|
82
|
+
{/if}
|
|
83
|
+
<TableHeader>
|
|
84
|
+
<TableHeaderRow>
|
|
85
|
+
{#each cols as col}
|
|
86
|
+
{#if !col.hide}
|
|
87
|
+
<TableHeaderCell type={getColType(col)} width={col.width}>{col.label}</TableHeaderCell>
|
|
88
|
+
{/if}
|
|
89
|
+
{/each}
|
|
90
|
+
{#if hasActionRow}
|
|
91
|
+
<TableHeaderCell type="string" />
|
|
92
|
+
{/if}
|
|
93
|
+
</TableHeaderRow>
|
|
94
|
+
</TableHeader>
|
|
95
|
+
<TableBody>
|
|
96
|
+
{#if !filteredRows?.length}
|
|
97
|
+
<TableRow>
|
|
98
|
+
<TableCell colspan={colCount}>
|
|
99
|
+
<div class="empty">
|
|
100
|
+
{#if rows === undefined}
|
|
101
|
+
<Loading />
|
|
102
|
+
{:else}
|
|
103
|
+
<Empty>
|
|
104
|
+
<FolderOpenIcon />
|
|
105
|
+
</Empty>
|
|
106
|
+
{/if}
|
|
107
|
+
</div>
|
|
108
|
+
</TableCell>
|
|
109
|
+
</TableRow>
|
|
110
|
+
{:else}
|
|
111
|
+
{#each filteredRows as row}
|
|
112
|
+
<TableRow>
|
|
113
|
+
{#each cols as col}
|
|
114
|
+
{#if !col.hide}
|
|
115
|
+
<TableCell type={col.type || typeof row[col.key]} width={col.width}>
|
|
116
|
+
{#if col.link}
|
|
117
|
+
<a href={col.link(row, col.key)}>{format(row, col.key)}</a>
|
|
118
|
+
{:else}
|
|
119
|
+
{format(row, col.key)}
|
|
120
|
+
{/if}
|
|
121
|
+
</TableCell>
|
|
122
|
+
{/if}
|
|
123
|
+
{/each}
|
|
124
|
+
{#if hasActionRow}
|
|
125
|
+
<TableCell type="actions">
|
|
126
|
+
{#if editRow}
|
|
127
|
+
<button type="button" on:click={() => clickEdit(row)}>Edit</button>
|
|
128
|
+
{/if}
|
|
129
|
+
{#if deleteRow}
|
|
130
|
+
<button type="button" on:click={() => clickDelete(row)}>Delete</button>
|
|
131
|
+
{/if}
|
|
132
|
+
</TableCell>
|
|
133
|
+
{/if}
|
|
134
|
+
</TableRow>
|
|
135
|
+
{/each}
|
|
136
|
+
{/if}
|
|
137
|
+
</TableBody>
|
|
138
|
+
{#if pagination}
|
|
139
|
+
<TableFooter>
|
|
140
|
+
<TableFooterRow>
|
|
141
|
+
<TableFooterCell colspan={colCount}>
|
|
142
|
+
<Pagination
|
|
143
|
+
currentPage={pagination.page}
|
|
144
|
+
{totalPages}
|
|
145
|
+
style="flat"
|
|
146
|
+
size="sm"
|
|
147
|
+
align="center"
|
|
148
|
+
on:page={changePage}
|
|
149
|
+
/>
|
|
150
|
+
</TableFooterCell>
|
|
151
|
+
</TableFooterRow>
|
|
152
|
+
</TableFooter>
|
|
153
|
+
{/if}
|
|
154
|
+
</Table>
|
|
155
|
+
|
|
156
156
|
<style>.empty {
|
|
157
157
|
padding: 2rem;
|
|
158
158
|
text-transform: uppercase;
|
|
@@ -176,4 +176,4 @@ button {
|
|
|
176
176
|
}
|
|
177
177
|
button:hover {
|
|
178
178
|
text-decoration: underline;
|
|
179
|
-
}</style>
|
|
179
|
+
}</style>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<tbody>
|
|
2
|
-
<slot />
|
|
3
|
-
</tbody>
|
|
1
|
+
<tbody>
|
|
2
|
+
<slot />
|
|
3
|
+
</tbody>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<caption>
|
|
2
|
-
<slot />
|
|
3
|
-
</caption>
|
|
4
|
-
|
|
1
|
+
<caption>
|
|
2
|
+
<slot />
|
|
3
|
+
</caption>
|
|
4
|
+
|
|
5
5
|
<style>caption {
|
|
6
6
|
padding: 0.5rem 0.75rem;
|
|
7
7
|
font-weight: 600;
|
|
@@ -11,4 +11,4 @@
|
|
|
11
11
|
text-transform: uppercase;
|
|
12
12
|
font-family: sans-serif;
|
|
13
13
|
text-shadow: 1px 1px 1px black;
|
|
14
|
-
}</style>
|
|
14
|
+
}</style>
|
|
@@ -3,12 +3,12 @@ export let type = void 0;
|
|
|
3
3
|
export let width = void 0;
|
|
4
4
|
$:
|
|
5
5
|
styleProperties = [`width: ${width ? width : "auto"}`];
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<td {colspan} class={type} style={styleProperties.join('; ')}>
|
|
9
|
-
<slot />
|
|
10
|
-
</td>
|
|
11
|
-
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<td {colspan} class={type} style={styleProperties.join('; ')}>
|
|
9
|
+
<slot />
|
|
10
|
+
</td>
|
|
11
|
+
|
|
12
12
|
<style>td {
|
|
13
13
|
padding-left: 0.5rem;
|
|
14
14
|
font-size: 0.9rem;
|
|
@@ -26,4 +26,4 @@ td.actions {
|
|
|
26
26
|
}
|
|
27
27
|
td:last-child {
|
|
28
28
|
padding-right: 0.5rem;
|
|
29
|
-
}</style>
|
|
29
|
+
}</style>
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
<script>export let colspan = 1;
|
|
2
|
-
</script>
|
|
3
|
-
|
|
4
|
-
<td {colspan}>
|
|
5
|
-
<div>
|
|
6
|
-
<slot />
|
|
7
|
-
</div>
|
|
8
|
-
</td>
|
|
9
|
-
|
|
10
|
-
<style>
|
|
11
|
-
td {
|
|
12
|
-
font-size: 0.8rem;
|
|
13
|
-
font-family: sans-serif;
|
|
14
|
-
text-shadow: 1px 1px 1px black;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
div {
|
|
18
|
-
display: flex;
|
|
19
|
-
justify-content: center;
|
|
20
|
-
align-items: center;
|
|
21
|
-
}
|
|
22
|
-
</style>
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<td {colspan}>
|
|
5
|
+
<div>
|
|
6
|
+
<slot />
|
|
7
|
+
</div>
|
|
8
|
+
</td>
|
|
9
|
+
|
|
10
|
+
<style>
|
|
11
|
+
td {
|
|
12
|
+
font-size: 0.8rem;
|
|
13
|
+
font-family: sans-serif;
|
|
14
|
+
text-shadow: 1px 1px 1px black;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
div {
|
|
18
|
+
display: flex;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
align-items: center;
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<tr>
|
|
2
|
-
<slot />
|
|
3
|
-
</tr>
|
|
1
|
+
<tr>
|
|
2
|
+
<slot />
|
|
3
|
+
</tr>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<tfoot>
|
|
2
|
-
<slot />
|
|
3
|
-
</tfoot>
|
|
4
|
-
|
|
5
|
-
<style>
|
|
6
|
-
tfoot {
|
|
7
|
-
background: var(--table-footer-bg, #333);
|
|
8
|
-
color: var(--table-footer-fg, #fff);
|
|
9
|
-
border-top: solid 0.1rem var(--table-footer-border, #000);
|
|
10
|
-
border-bottom: solid 0.1rem var(--table-footer-border, #000);
|
|
11
|
-
font-size: 0.8rem;
|
|
12
|
-
}
|
|
13
|
-
</style>
|
|
1
|
+
<tfoot>
|
|
2
|
+
<slot />
|
|
3
|
+
</tfoot>
|
|
4
|
+
|
|
5
|
+
<style>
|
|
6
|
+
tfoot {
|
|
7
|
+
background: var(--table-footer-bg, #333);
|
|
8
|
+
color: var(--table-footer-fg, #fff);
|
|
9
|
+
border-top: solid 0.1rem var(--table-footer-border, #000);
|
|
10
|
+
border-bottom: solid 0.1rem var(--table-footer-border, #000);
|
|
11
|
+
font-size: 0.8rem;
|
|
12
|
+
}
|
|
13
|
+
</style>
|
|
@@ -8,12 +8,12 @@ $:
|
|
|
8
8
|
"overflow: hidden",
|
|
9
9
|
`width: ${width ? width : "auto"}`
|
|
10
10
|
];
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<th {colspan} class={type} style={styleProperties.join('; ')}>
|
|
14
|
-
<slot />
|
|
15
|
-
</th>
|
|
16
|
-
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<th {colspan} class={type} style={styleProperties.join('; ')}>
|
|
14
|
+
<slot />
|
|
15
|
+
</th>
|
|
16
|
+
|
|
17
17
|
<style>th {
|
|
18
18
|
padding-left: 0.5rem;
|
|
19
19
|
font-size: 0.8rem;
|
|
@@ -33,4 +33,4 @@ th.boolean {
|
|
|
33
33
|
}
|
|
34
34
|
th:last-child {
|
|
35
35
|
padding-right: 0.5rem;
|
|
36
|
-
}</style>
|
|
36
|
+
}</style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<tr>
|
|
2
|
-
<slot />
|
|
3
|
-
</tr>
|
|
4
|
-
|
|
1
|
+
<tr>
|
|
2
|
+
<slot />
|
|
3
|
+
</tr>
|
|
4
|
+
|