@likable-hair/svelte 0.0.54 → 0.0.57
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/common/SimpleTable.svelte +61 -70
- package/common/SimpleTable.svelte.d.ts +1 -1
- package/forms/Autocomplete.svelte +2 -2
- package/forms/Autocomplete.svelte.d.ts +1 -0
- package/media/DescriptiveAvatar.svelte +14 -12
- package/media/DescriptiveAvatar.svelte.d.ts +3 -1
- package/navigation/TabSwitcher.svelte +4 -2
- package/package.json +1 -1
|
@@ -4,79 +4,70 @@
|
|
|
4
4
|
export let headers = undefined, items = undefined, backgroundColor = "rgba(255,255,255,0)", headerColor = "rgba(0,0,0,0.05)", rowSeparatorColor = headerColor, headerHeight = "30px", rowHeight = "70px", minWidth = undefined, height = "100%", width = "100%";
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
|
-
{#if !!items && Array.isArray(items)
|
|
7
|
+
{#if !!items && Array.isArray(items)}
|
|
8
8
|
<div class="container" style:height style:width>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
{#if $$slots.appendLastColumn}
|
|
54
|
-
<td>
|
|
55
|
-
<slot name="appendLastColumn" index={i} item={item}></slot>
|
|
56
|
-
</td>
|
|
57
|
-
{/if}
|
|
58
|
-
</tr>
|
|
59
|
-
{/each}
|
|
60
|
-
</tbody>
|
|
61
|
-
</table>
|
|
9
|
+
<table
|
|
10
|
+
style:background-color={backgroundColor}
|
|
11
|
+
style:width="100%"
|
|
12
|
+
style:min-width={minWidth}
|
|
13
|
+
>
|
|
14
|
+
<thead style:background-color={headerColor} style:height={headerHeight}>
|
|
15
|
+
{#each headers as head}
|
|
16
|
+
<th style:width={head.width} style:min-width={head.minWidth}>
|
|
17
|
+
{head.label}
|
|
18
|
+
</th>
|
|
19
|
+
{/each}
|
|
20
|
+
{#if $$slots.appendLastColumn}
|
|
21
|
+
<th />
|
|
22
|
+
{/if}
|
|
23
|
+
</thead>
|
|
24
|
+
<tbody>
|
|
25
|
+
{#each items as item, i}
|
|
26
|
+
<tr style:border-color={rowSeparatorColor} style:height={rowHeight}>
|
|
27
|
+
{#each headers as header, j}
|
|
28
|
+
<td>
|
|
29
|
+
{#if header.type == "custom"}
|
|
30
|
+
<slot
|
|
31
|
+
name="customColumn"
|
|
32
|
+
index={i}
|
|
33
|
+
columnIndex={j}
|
|
34
|
+
{header}
|
|
35
|
+
{item}
|
|
36
|
+
/>
|
|
37
|
+
{:else if header.type == "date"}
|
|
38
|
+
{dateToString(item[header.value], "dayAndHours", "it")}
|
|
39
|
+
{:else}
|
|
40
|
+
{item[header.value]}
|
|
41
|
+
{/if}
|
|
42
|
+
</td>
|
|
43
|
+
{/each}
|
|
44
|
+
{#if $$slots.appendLastColumn}
|
|
45
|
+
<td>
|
|
46
|
+
<slot name="appendLastColumn" index={i} {item} />
|
|
47
|
+
</td>
|
|
48
|
+
{/if}
|
|
49
|
+
</tr>
|
|
50
|
+
{/each}
|
|
51
|
+
</tbody>
|
|
52
|
+
</table>
|
|
62
53
|
</div>
|
|
63
54
|
{/if}
|
|
64
55
|
|
|
65
56
|
<style>
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
57
|
+
table {
|
|
58
|
+
border-collapse: collapse;
|
|
59
|
+
width: 100%;
|
|
60
|
+
}
|
|
61
|
+
th {
|
|
62
|
+
text-align: start;
|
|
63
|
+
padding-left: 10px;
|
|
64
|
+
min-width: 100px;
|
|
65
|
+
}
|
|
66
|
+
td {
|
|
67
|
+
padding-left: 10px;
|
|
68
|
+
}
|
|
69
|
+
tr:not(:first-child) {
|
|
70
|
+
border: solid;
|
|
71
|
+
border-width: 2px 0;
|
|
72
|
+
}
|
|
82
73
|
</style>
|
|
@@ -2,7 +2,7 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
export declare type Header = {
|
|
3
3
|
value: string;
|
|
4
4
|
label: string;
|
|
5
|
-
type:
|
|
5
|
+
type: "boolean" | "string" | "number" | "date" | "custom";
|
|
6
6
|
width?: string;
|
|
7
7
|
minWidth?: string;
|
|
8
8
|
data?: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script context="module" ></script>
|
|
2
2
|
|
|
3
|
-
<script >export let values = [], items, searchFunction = undefined, multiple = false, disabled = false, width = "auto", maxWidth = undefined,
|
|
3
|
+
<script >export let values = [], items, searchFunction = undefined, multiple = false, disabled = false, width = "auto", height = "auto", maxWidth = undefined,
|
|
4
4
|
// textfield
|
|
5
5
|
textFieldLabel = "", textFieldPlaceholder = "", textFieldColor = null, textFieldVariant = 'boxed', textFieldMaxWidth = "min(100px, 90%)", textFieldMinWidth = undefined, textFieldHeight = "auto", textFieldTextColor = "black", textFieldBorderWeight = "2px", textFieldBorderRadius = "5px", textFieldBorderColor = null, textFieldFocusBorderColor = null, textFieldFocusedBoxShadow = undefined, textFieldBackgroundColor = null, textFieldPadding = undefined, textFieldPaddingLeft = undefined, textFieldPaddingRight = undefined, textFieldPaddingBottom = undefined, textFieldPaddingTop = undefined, textFieldFontSize = undefined,
|
|
6
6
|
// menu
|
|
@@ -21,7 +21,6 @@ function unselect(item) {
|
|
|
21
21
|
}
|
|
22
22
|
function toggle(item) {
|
|
23
23
|
const alreadyPresent = values.findIndex((i) => i.value === item.value) != -1;
|
|
24
|
-
console.log(item, alreadyPresent);
|
|
25
24
|
if (alreadyPresent)
|
|
26
25
|
unselect(item);
|
|
27
26
|
else
|
|
@@ -94,6 +93,7 @@ import Menu from '../common/Menu.svelte';
|
|
|
94
93
|
bind:this={activator}
|
|
95
94
|
style:width={width}
|
|
96
95
|
style:max-width={maxWidth}
|
|
96
|
+
style:height={height}
|
|
97
97
|
style:opacity={disabled ? '50%' : '100%'}
|
|
98
98
|
on:click={handleContainerClick}
|
|
99
99
|
>
|
|
@@ -43,18 +43,20 @@ import Avatar from "./Avatar.svelte";
|
|
|
43
43
|
class="descriptive-avatar-container"
|
|
44
44
|
>
|
|
45
45
|
<div class="avatar-container">
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
<slot name="avatar">
|
|
47
|
+
<Avatar
|
|
48
|
+
src={src}
|
|
49
|
+
width={width}
|
|
50
|
+
maxWidth={maxWidth}
|
|
51
|
+
minWidth={minWidth}
|
|
52
|
+
height={height}
|
|
53
|
+
maxHeight={maxHeight}
|
|
54
|
+
minHeight={minHeight}
|
|
55
|
+
borderRadius={borderRadius}
|
|
56
|
+
lazyLoaded={lazyLoaded}
|
|
57
|
+
referrerpolicy={referrerpolicy}
|
|
58
|
+
></Avatar>
|
|
59
|
+
</slot>
|
|
58
60
|
</div>
|
|
59
61
|
<div
|
|
60
62
|
style:margin-left={!reverse && direction === 'row' ? avatarSpacing : undefined}
|
|
@@ -20,7 +20,9 @@ declare const __propDef: {
|
|
|
20
20
|
events: {
|
|
21
21
|
[evt: string]: CustomEvent<any>;
|
|
22
22
|
};
|
|
23
|
-
slots: {
|
|
23
|
+
slots: {
|
|
24
|
+
avatar: {};
|
|
25
|
+
};
|
|
24
26
|
};
|
|
25
27
|
export declare type DescriptiveAvatarProps = typeof __propDef.props;
|
|
26
28
|
export declare type DescriptiveAvatarEvents = typeof __propDef.events;
|
|
@@ -23,8 +23,10 @@ function handleTabClick(clickedTab, nativeEvent) {
|
|
|
23
23
|
}
|
|
24
24
|
function setBookmarkPosition() {
|
|
25
25
|
let tabButton = tabButtons[selected];
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
if (!!tabButton) {
|
|
27
|
+
bookmarkWidth = tabButton.offsetWidth - 10;
|
|
28
|
+
bookmarkLeft = tabButton.offsetLeft + 5;
|
|
29
|
+
}
|
|
28
30
|
}
|
|
29
31
|
$: if (!!selected)
|
|
30
32
|
setBookmarkPosition();
|