@likable-hair/svelte 0.0.55 → 0.0.58
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/dates/Calendar.svelte +3 -2
- package/dates/Calendar.svelte.d.ts +1 -0
- package/dates/utils.js +0 -1
- package/dialogs/Dialog.svelte +13 -3
- 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/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?: {
|
package/dates/Calendar.svelte
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script >import { onMount } from 'svelte';
|
|
2
2
|
import { fly } from 'svelte/transition';
|
|
3
3
|
import { getDateRowsStats, getDaysNames } from './utils';
|
|
4
|
-
export let selectedDate = undefined, visibleMonth = new Date().getMonth(), visibleYear = new Date().getFullYear(), locale = 'it', showExtraMonthDays = true, showHeader = true, height = "100%", width = "100%", dayWidth = '30px', dayHeight = '30px', dayHoverColor = '#c9c8c873', daySelectedColor = '#adadad', selectedTextColor = "black", dayBackgroundColor = undefined, animationDuration = 200;
|
|
4
|
+
export let selectedDate = undefined, visibleMonth = new Date().getMonth(), visibleYear = new Date().getFullYear(), locale = 'it', showExtraMonthDays = true, showHeader = true, height = "100%", width = "100%", dayWidth = '30px', dayHeight = '30px', dayHoverColor = '#c9c8c873', daySelectedColor = '#adadad', selectedTextColor = "black", gridGap = "1px", dayBackgroundColor = undefined, animationDuration = 200;
|
|
5
5
|
onMount(() => {
|
|
6
6
|
});
|
|
7
7
|
import { createEventDispatcher } from 'svelte';
|
|
@@ -26,6 +26,7 @@ function handleDayClick(dateStat, extraMonth) {
|
|
|
26
26
|
<div
|
|
27
27
|
in:fly="{{delay: animationDuration, duration: animationDuration, y: 30}}"
|
|
28
28
|
out:fly|local="{{duration: animationDuration, y: -30}}"
|
|
29
|
+
style:gap={gridGap}
|
|
29
30
|
class="grid-layout"
|
|
30
31
|
>
|
|
31
32
|
{#if showHeader}
|
|
@@ -80,7 +81,7 @@ function handleDayClick(dateStat, extraMonth) {
|
|
|
80
81
|
.grid-layout {
|
|
81
82
|
display: grid;
|
|
82
83
|
grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
|
|
83
|
-
|
|
84
|
+
height: 100%;
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
.day-slot {
|
package/dates/utils.js
CHANGED
package/dialogs/Dialog.svelte
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<script >import {
|
|
1
|
+
<script >import { browser } from "$app/env";
|
|
2
|
+
import { beforeUpdate } from "svelte";
|
|
2
3
|
export let open = false, overlayOpacity = "30%", overlayColor = "#282828";
|
|
3
4
|
let zIndex = 50, localOpen = open;
|
|
4
5
|
beforeUpdate(() => {
|
|
@@ -12,6 +13,15 @@ beforeUpdate(() => {
|
|
|
12
13
|
});
|
|
13
14
|
zIndex = maxZIndex + 2;
|
|
14
15
|
}
|
|
16
|
+
document.body.style.overflow = 'hidden';
|
|
17
|
+
}
|
|
18
|
+
else if (!open) {
|
|
19
|
+
if (browser) {
|
|
20
|
+
let otherDialogs = document.querySelectorAll("[data-dialog=true]");
|
|
21
|
+
if (otherDialogs.length <= 1) {
|
|
22
|
+
document.body.style.overflow = 'auto';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
15
25
|
}
|
|
16
26
|
localOpen = open;
|
|
17
27
|
});
|
|
@@ -33,14 +43,14 @@ function handleOverlayClick() {
|
|
|
33
43
|
style:justify-content="space-between"
|
|
34
44
|
class="overlay-container"
|
|
35
45
|
class:overlay-container-active={localOpen}
|
|
36
|
-
on:touchmove|preventDefault={() => {}}
|
|
37
|
-
on:wheel|preventDefault={() => {}}
|
|
38
46
|
>
|
|
39
47
|
<div
|
|
40
48
|
style:background-color={overlayColor}
|
|
41
49
|
class="overlay"
|
|
42
50
|
class:overlay-active={localOpen}
|
|
43
51
|
on:click={handleOverlayClick}
|
|
52
|
+
on:touchmove|preventDefault={() => {}}
|
|
53
|
+
on:wheel|preventDefault={() => {}}
|
|
44
54
|
></div>
|
|
45
55
|
{#if localOpen }
|
|
46
56
|
<div
|
|
@@ -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;
|