sveltacular 0.0.8 → 0.0.10
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/images/icon.svelte +28 -0
- package/dist/images/icon.svelte.d.ts +17 -0
- package/dist/images/image.svelte +63 -36
- package/dist/images/image.svelte.d.ts +8 -3
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/navigation/app-bar/app-bar.svelte +10 -4
- package/dist/navigation/app-bar/app-logo.svelte +7 -0
- package/dist/navigation/app-bar/app-logo.svelte.d.ts +18 -0
- package/dist/navigation/app-bar/app-nav-item.svelte +30 -0
- package/dist/navigation/app-bar/app-nav-item.svelte.d.ts +19 -0
- package/dist/navigation/app-bar/app-nav.svelte +57 -0
- package/dist/navigation/app-bar/app-nav.svelte.d.ts +20 -0
- package/dist/navigation/breadcrumbs/breadcrumbs.svelte +21 -5
- package/dist/navigation/breadcrumbs/breadcrumbs.svelte.d.ts +2 -1
- package/dist/tables/data-grid.svelte +41 -21
- package/dist/types/data.d.ts +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script>export let href;
|
|
2
|
+
export let color = "rgb(0, 0, 0)";
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<span style={`--icon-path: url("${href}"); --icon-color: ${color};`} />
|
|
6
|
+
|
|
7
|
+
<style>span {
|
|
8
|
+
display: block;
|
|
9
|
+
background-color: var(--icon-color, rgb(0, 0, 0));
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
-moz-mask-size: contain;
|
|
13
|
+
-moz-mask-image: var(--icon-path);
|
|
14
|
+
-moz-mask-repeat: no-repeat;
|
|
15
|
+
-moz-mask-position: center;
|
|
16
|
+
-ms-mask-size: contain;
|
|
17
|
+
-ms-mask-image: var(--icon-path);
|
|
18
|
+
-ms-mask-repeat: no-repeat;
|
|
19
|
+
-ms-mask-position: center;
|
|
20
|
+
-webkit-mask-size: contain;
|
|
21
|
+
-webkit-mask-image: var(--icon-path);
|
|
22
|
+
-webkit-mask-repeat: no-repeat;
|
|
23
|
+
-webkit-mask-position: center;
|
|
24
|
+
mask-size: contain;
|
|
25
|
+
mask-image: var(--icon-path);
|
|
26
|
+
mask-repeat: no-repeat;
|
|
27
|
+
mask-position: center;
|
|
28
|
+
}</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
href: string;
|
|
5
|
+
color?: string | undefined;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export type IconProps = typeof __propDef.props;
|
|
13
|
+
export type IconEvents = typeof __propDef.events;
|
|
14
|
+
export type IconSlots = typeof __propDef.slots;
|
|
15
|
+
export default class Icon extends SvelteComponent<IconProps, IconEvents, IconSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
package/dist/images/image.svelte
CHANGED
|
@@ -1,16 +1,31 @@
|
|
|
1
|
-
<script>export let
|
|
1
|
+
<script>export let src = "";
|
|
2
2
|
export let alt = "";
|
|
3
|
+
export let href = void 0;
|
|
4
|
+
export let align = "center";
|
|
5
|
+
$:
|
|
6
|
+
sources = Array.isArray(src) ? src : typeof src === "string" ? [{ url: src }] : [src];
|
|
3
7
|
$:
|
|
4
8
|
finalSource = sources[sources.length - 1];
|
|
5
9
|
</script>
|
|
6
10
|
|
|
7
|
-
<div>
|
|
8
|
-
|
|
9
|
-
{
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
<div class={align}>
|
|
12
|
+
{#if href}
|
|
13
|
+
<a {href}>
|
|
14
|
+
<picture>
|
|
15
|
+
{#each sources as source}
|
|
16
|
+
<source srcset={source.url} media={source.media} />
|
|
17
|
+
{/each}
|
|
18
|
+
<img src={finalSource.url} {alt} />
|
|
19
|
+
</picture>
|
|
20
|
+
</a>
|
|
21
|
+
{:else}
|
|
22
|
+
<picture>
|
|
23
|
+
{#each sources as source}
|
|
24
|
+
<source srcset={source.url} media={source.media} />
|
|
25
|
+
{/each}
|
|
26
|
+
<img src={finalSource.url} {alt} />
|
|
27
|
+
</picture>
|
|
28
|
+
{/if}
|
|
14
29
|
{#if $$slots.default}
|
|
15
30
|
<div class="caption">
|
|
16
31
|
<slot />
|
|
@@ -18,31 +33,43 @@ $:
|
|
|
18
33
|
{/if}
|
|
19
34
|
</div>
|
|
20
35
|
|
|
21
|
-
<style>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
<style>div {
|
|
37
|
+
position: relative;
|
|
38
|
+
width: 100%;
|
|
39
|
+
height: 100%;
|
|
40
|
+
}
|
|
41
|
+
div .caption {
|
|
42
|
+
position: absolute;
|
|
43
|
+
bottom: 0;
|
|
44
|
+
left: 0;
|
|
45
|
+
right: 0;
|
|
46
|
+
padding: 1rem;
|
|
47
|
+
background: rgba(0, 0, 0, 0.5);
|
|
48
|
+
color: white;
|
|
49
|
+
}
|
|
50
|
+
div picture {
|
|
51
|
+
display: block;
|
|
52
|
+
width: 100%;
|
|
53
|
+
height: 100%;
|
|
54
|
+
max-width: 100%;
|
|
55
|
+
max-height: 100%;
|
|
56
|
+
object-fit: contain;
|
|
57
|
+
object-position: center;
|
|
58
|
+
}
|
|
59
|
+
div img {
|
|
60
|
+
display: block;
|
|
61
|
+
width: 100%;
|
|
62
|
+
height: 100%;
|
|
63
|
+
max-width: 100%;
|
|
64
|
+
max-height: 100%;
|
|
65
|
+
object-fit: contain;
|
|
66
|
+
object-position: center;
|
|
67
|
+
}
|
|
68
|
+
div.left picture,
|
|
69
|
+
div.left img {
|
|
70
|
+
object-position: left;
|
|
71
|
+
}
|
|
72
|
+
div.right picture,
|
|
73
|
+
div.right img {
|
|
74
|
+
object-position: right;
|
|
75
|
+
}</style>
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
|
|
4
|
+
src?: string | {
|
|
5
5
|
url: string;
|
|
6
|
-
media?: string;
|
|
7
|
-
}
|
|
6
|
+
media?: string | undefined;
|
|
7
|
+
} | {
|
|
8
|
+
url: string;
|
|
9
|
+
media?: string | undefined;
|
|
10
|
+
}[] | undefined;
|
|
8
11
|
alt?: string | undefined;
|
|
12
|
+
href?: string | undefined;
|
|
13
|
+
align?: "center" | "left" | "right" | undefined;
|
|
9
14
|
};
|
|
10
15
|
events: {
|
|
11
16
|
[evt: string]: CustomEvent<any>;
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { default as Pill } from './generic/pill/pill.svelte';
|
|
|
21
21
|
export { default as Scorecard } from './generic/scorecard/scorecard.svelte';
|
|
22
22
|
export { default as Overlay } from './generic/overlay.svelte';
|
|
23
23
|
export { default as Image } from './images/image.svelte';
|
|
24
|
+
export { default as Icon } from './images/icon.svelte';
|
|
24
25
|
export { default as Menu } from './generic/menu/menu.svelte';
|
|
25
26
|
export { default as Date } from './generic/date/date.svelte';
|
|
26
27
|
export { default as Panel } from './generic/panel/panel.svelte';
|
|
@@ -43,6 +44,9 @@ export { default as Breadcrumbs } from './navigation/breadcrumbs/breadcrumbs.sve
|
|
|
43
44
|
export { default as SideBar } from './navigation/side-bar/side-bar.svelte';
|
|
44
45
|
export { default as TabGroup } from './navigation/tabs/tab-group.svelte';
|
|
45
46
|
export { default as Tab } from './navigation/tabs/tab.svelte';
|
|
47
|
+
export { default as AppLogo } from './navigation/app-bar/app-logo.svelte';
|
|
48
|
+
export { default as AppNav } from './navigation/app-bar/app-nav.svelte';
|
|
49
|
+
export { default as AppNavItem } from './navigation/app-bar/app-nav-item.svelte';
|
|
46
50
|
export { default as DataGrid } from './tables/data-grid.svelte';
|
|
47
51
|
export { default as Table } from './tables/table.svelte';
|
|
48
52
|
export { default as TableBody } from './tables/table-body.svelte';
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ export { default as Pill } from './generic/pill/pill.svelte';
|
|
|
23
23
|
export { default as Scorecard } from './generic/scorecard/scorecard.svelte';
|
|
24
24
|
export { default as Overlay } from './generic/overlay.svelte';
|
|
25
25
|
export { default as Image } from './images/image.svelte';
|
|
26
|
+
export { default as Icon } from './images/icon.svelte';
|
|
26
27
|
export { default as Menu } from './generic/menu/menu.svelte';
|
|
27
28
|
export { default as Date } from './generic/date/date.svelte';
|
|
28
29
|
export { default as Panel } from './generic/panel/panel.svelte';
|
|
@@ -48,6 +49,9 @@ export { default as Breadcrumbs } from './navigation/breadcrumbs/breadcrumbs.sve
|
|
|
48
49
|
export { default as SideBar } from './navigation/side-bar/side-bar.svelte';
|
|
49
50
|
export { default as TabGroup } from './navigation/tabs/tab-group.svelte';
|
|
50
51
|
export { default as Tab } from './navigation/tabs/tab.svelte';
|
|
52
|
+
export { default as AppLogo } from './navigation/app-bar/app-logo.svelte';
|
|
53
|
+
export { default as AppNav } from './navigation/app-bar/app-nav.svelte';
|
|
54
|
+
export { default as AppNavItem } from './navigation/app-bar/app-nav-item.svelte';
|
|
51
55
|
// Tables
|
|
52
56
|
export { default as DataGrid } from './tables/data-grid.svelte';
|
|
53
57
|
export { default as Table } from './tables/table.svelte';
|
|
@@ -9,10 +9,12 @@ export let padding = "md";
|
|
|
9
9
|
</header>
|
|
10
10
|
|
|
11
11
|
<style>header {
|
|
12
|
-
display:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
width: 100%;
|
|
16
|
+
background: var(--nav-bg, #fff);
|
|
17
|
+
color: var(--nav-fg, #000);
|
|
16
18
|
position: absolute;
|
|
17
19
|
top: 0;
|
|
18
20
|
left: 0;
|
|
@@ -50,4 +52,8 @@ header.padding-lg {
|
|
|
50
52
|
}
|
|
51
53
|
header.padding-xl {
|
|
52
54
|
padding: 1.5rem;
|
|
55
|
+
}
|
|
56
|
+
header.isTransparent {
|
|
57
|
+
background: transparent;
|
|
58
|
+
color: inherit;
|
|
53
59
|
}</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
src: string;
|
|
5
|
+
alt: string;
|
|
6
|
+
href: string;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
};
|
|
13
|
+
export type AppLogoProps = typeof __propDef.props;
|
|
14
|
+
export type AppLogoEvents = typeof __propDef.events;
|
|
15
|
+
export type AppLogoSlots = typeof __propDef.slots;
|
|
16
|
+
export default class AppLogo extends SvelteComponent<AppLogoProps, AppLogoEvents, AppLogoSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script>export let href;
|
|
2
|
+
export let title;
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<a {href}>
|
|
6
|
+
{#if $$slots.default}
|
|
7
|
+
<div class="icon">
|
|
8
|
+
<slot />
|
|
9
|
+
</div>
|
|
10
|
+
{/if}
|
|
11
|
+
<div class="title">{title}</div>
|
|
12
|
+
</a>
|
|
13
|
+
|
|
14
|
+
<style>a {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
gap: 0.2rem;
|
|
18
|
+
align-items: center;
|
|
19
|
+
height: 100%;
|
|
20
|
+
color: var(--nav-link-color, black);
|
|
21
|
+
text-decoration: none;
|
|
22
|
+
}
|
|
23
|
+
a:hover {
|
|
24
|
+
color: var(--nav-link-hover-color, black);
|
|
25
|
+
text-decoration: underline;
|
|
26
|
+
}
|
|
27
|
+
a .icon {
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 1.5rem;
|
|
30
|
+
}</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
href: string;
|
|
5
|
+
title: string;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {
|
|
11
|
+
default: {};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export type AppNavItemProps = typeof __propDef.props;
|
|
15
|
+
export type AppNavItemEvents = typeof __propDef.events;
|
|
16
|
+
export type AppNavItemSlots = typeof __propDef.slots;
|
|
17
|
+
export default class AppNavItem extends SvelteComponent<AppNavItemProps, AppNavItemEvents, AppNavItemSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script>export let grow = false;
|
|
2
|
+
export let align = "right";
|
|
3
|
+
export let spacing = "medium";
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<nav class="{grow ? 'grow' : ''} {align} {spacing}">
|
|
7
|
+
<slot />
|
|
8
|
+
</nav>
|
|
9
|
+
|
|
10
|
+
<style>
|
|
11
|
+
nav {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-grow: 0;
|
|
14
|
+
gap: 1rem;
|
|
15
|
+
margin: 1rem;
|
|
16
|
+
width: 100%;
|
|
17
|
+
|
|
18
|
+
&.grow {
|
|
19
|
+
flex-grow: 1;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&.left {
|
|
23
|
+
justify-content: left;
|
|
24
|
+
align-items: left;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&.center {
|
|
28
|
+
justify-content: center;
|
|
29
|
+
align-items: center;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.right {
|
|
33
|
+
justify-content: right;
|
|
34
|
+
align-items: right;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.none {
|
|
38
|
+
gap: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&.tight {
|
|
42
|
+
gap: 0.5rem;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&.medium {
|
|
46
|
+
gap: 1rem;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&.loose {
|
|
50
|
+
gap: 2rem;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&.spread {
|
|
54
|
+
justify-content: space-evenly;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
grow?: boolean | undefined;
|
|
5
|
+
align?: "center" | "left" | "right" | undefined;
|
|
6
|
+
spacing?: "none" | "medium" | "tight" | "loose" | "spread" | undefined;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {
|
|
12
|
+
default: {};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export type AppNavProps = typeof __propDef.props;
|
|
16
|
+
export type AppNavEvents = typeof __propDef.events;
|
|
17
|
+
export type AppNavSlots = typeof __propDef.slots;
|
|
18
|
+
export default class AppNav extends SvelteComponent<AppNavProps, AppNavEvents, AppNavSlots> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -3,9 +3,15 @@ import AngleRightIcon from "../../icons/angle-right-icon.svelte";
|
|
|
3
3
|
import HomeIcon from "../../icons/home-icon.svelte";
|
|
4
4
|
export let homeUrl = null;
|
|
5
5
|
export let crumbs = [];
|
|
6
|
+
export let size = "md";
|
|
7
|
+
const getCrumLabel = (crumb) => {
|
|
8
|
+
if (typeof crumb === "string")
|
|
9
|
+
return crumb;
|
|
10
|
+
return crumb.label;
|
|
11
|
+
};
|
|
6
12
|
</script>
|
|
7
13
|
|
|
8
|
-
<nav>
|
|
14
|
+
<nav class={size}>
|
|
9
15
|
{#if homeUrl}
|
|
10
16
|
<li class="icon">
|
|
11
17
|
<Link href={homeUrl} display="block">
|
|
@@ -14,8 +20,8 @@ export let crumbs = [];
|
|
|
14
20
|
</li>
|
|
15
21
|
{/if}
|
|
16
22
|
{#each crumbs as crumb, i}
|
|
17
|
-
{#if typeof crumb === 'string'}
|
|
18
|
-
<li>{crumb}</li>
|
|
23
|
+
{#if typeof crumb === 'string' || !crumb.href}
|
|
24
|
+
<li>{getCrumLabel(crumb)}</li>
|
|
19
25
|
{:else}
|
|
20
26
|
<li>
|
|
21
27
|
<Link href={crumb.href}>
|
|
@@ -44,13 +50,23 @@ nav li {
|
|
|
44
50
|
align-items: center;
|
|
45
51
|
vertical-align: middle;
|
|
46
52
|
margin-left: 0.5rem;
|
|
47
|
-
font-size: 0.75rem;
|
|
48
53
|
color: rgba(255, 255, 255, 0.5);
|
|
49
|
-
min-width: 12px;
|
|
50
54
|
}
|
|
51
55
|
nav li:first-child {
|
|
52
56
|
margin-left: 0;
|
|
53
57
|
}
|
|
54
58
|
nav li.icon {
|
|
55
59
|
padding-top: 2px;
|
|
60
|
+
}
|
|
61
|
+
nav.sm li {
|
|
62
|
+
font-size: 0.75rem;
|
|
63
|
+
min-width: 12px;
|
|
64
|
+
}
|
|
65
|
+
nav.md li {
|
|
66
|
+
font-size: 0.875rem;
|
|
67
|
+
min-width: 14px;
|
|
68
|
+
}
|
|
69
|
+
nav.lg li {
|
|
70
|
+
font-size: 1rem;
|
|
71
|
+
min-width: 16px;
|
|
56
72
|
}</style>
|
|
@@ -4,8 +4,9 @@ declare const __propDef: {
|
|
|
4
4
|
homeUrl?: string | null | undefined;
|
|
5
5
|
crumbs?: (string | {
|
|
6
6
|
label: string;
|
|
7
|
-
href
|
|
7
|
+
href?: string | undefined;
|
|
8
8
|
})[] | undefined;
|
|
9
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
9
10
|
};
|
|
10
11
|
events: {
|
|
11
12
|
[evt: string]: CustomEvent<any>;
|
|
@@ -64,31 +64,41 @@ $:
|
|
|
64
64
|
</TableHeaderRow>
|
|
65
65
|
</TableHeader>
|
|
66
66
|
<TableBody>
|
|
67
|
-
{#
|
|
67
|
+
{#if rows.length == 0}
|
|
68
68
|
<TableRow>
|
|
69
|
-
{
|
|
70
|
-
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
<TableCell colspan={colCount}>
|
|
70
|
+
<div class="empty">
|
|
71
|
+
<Text>No data</Text>
|
|
72
|
+
</div>
|
|
73
|
+
</TableCell>
|
|
74
|
+
</TableRow>
|
|
75
|
+
{:else}
|
|
76
|
+
{#each rows as row}
|
|
77
|
+
<TableRow>
|
|
78
|
+
{#each cols as col}
|
|
79
|
+
{#if !col.hide}
|
|
80
|
+
<TableCell type={col.type || typeof row[col.key]}>
|
|
81
|
+
{#if col.link}
|
|
82
|
+
<a href={col.link(row, col.key)}>{format(row, col.key)}</a>
|
|
83
|
+
{:else}
|
|
84
|
+
{format(row, col.key)}
|
|
85
|
+
{/if}
|
|
86
|
+
</TableCell>
|
|
87
|
+
{/if}
|
|
88
|
+
{/each}
|
|
89
|
+
{#if hasActionRow}
|
|
90
|
+
<TableCell type="actions">
|
|
91
|
+
{#if editRow}
|
|
92
|
+
<button on:click={() => clickEdit(row)}>Edit</button>
|
|
93
|
+
{/if}
|
|
94
|
+
{#if deleteRow}
|
|
95
|
+
<button on:click={() => clickDelete(row)}>Delete</button>
|
|
76
96
|
{/if}
|
|
77
97
|
</TableCell>
|
|
78
98
|
{/if}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
{#if editRow}
|
|
83
|
-
<button on:click={() => clickEdit(row)}>Edit</button>
|
|
84
|
-
{/if}
|
|
85
|
-
{#if deleteRow}
|
|
86
|
-
<button on:click={() => clickDelete(row)}>Delete</button>
|
|
87
|
-
{/if}
|
|
88
|
-
</TableCell>
|
|
89
|
-
{/if}
|
|
90
|
-
</TableRow>
|
|
91
|
-
{/each}
|
|
99
|
+
</TableRow>
|
|
100
|
+
{/each}
|
|
101
|
+
{/if}
|
|
92
102
|
</TableBody>
|
|
93
103
|
{#if pagination}
|
|
94
104
|
<TableFooter>
|
|
@@ -102,3 +112,13 @@ $:
|
|
|
102
112
|
</TableFooter>
|
|
103
113
|
{/if}
|
|
104
114
|
</Table>
|
|
115
|
+
|
|
116
|
+
<style>
|
|
117
|
+
.empty {
|
|
118
|
+
text-align: center;
|
|
119
|
+
padding: 2rem;
|
|
120
|
+
text-transform: uppercase;
|
|
121
|
+
color: rgba(100, 100, 100, 0.5);
|
|
122
|
+
letter-spacing: 0.2rem;
|
|
123
|
+
}
|
|
124
|
+
</style>
|
package/dist/types/data.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export type DataRow = Record<string, unknown>;
|
|
2
|
-
export type DataCol = {
|
|
2
|
+
export type DataCol<T extends DataRow = DataRow> = {
|
|
3
3
|
key: string;
|
|
4
4
|
label: string;
|
|
5
5
|
type?: string;
|
|
6
|
-
format?: (row:
|
|
7
|
-
link?: (row:
|
|
6
|
+
format?: (row: T, key: keyof T) => string;
|
|
7
|
+
link?: (row: T, key: keyof T) => string;
|
|
8
8
|
hide?: boolean;
|
|
9
9
|
};
|
|
10
10
|
export type Pagination = {
|