@poirazis/supercomponents-shared 1.1.8 → 1.2.1
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/index.js +21180 -40125
- package/dist/index.umd.cjs +19 -26
- package/dist/style.css +1 -1
- package/package.json +5 -5
- package/src/index.js +4 -0
- package/src/index.ts +3 -0
- package/src/lib/Actions/index.js +3 -3
- package/src/lib/Actions/position_dropdown.js +14 -7
- package/src/lib/SuperButton/SuperButton.svelte +34 -3
- package/src/lib/SuperField/SuperField.svelte +0 -11
- package/src/lib/SuperForm/InnerForm.svelte +1 -1
- package/src/lib/SuperList/SuperList.svelte +2 -2
- package/src/lib/SuperList/drag-handle.svelte +8 -8
- package/src/lib/SuperPopover/SuperPopover.svelte +2 -2
- package/src/lib/SuperTable/SuperTable.css +8 -3
- package/src/lib/SuperTable/SuperTable.svelte +3 -3
- package/src/lib/SuperTable/controls/PaginationLimitOffset.svelte +2 -0
- package/src/lib/SuperTable/controls/SelectionColumn.svelte +18 -49
- package/src/lib/SuperTable/controls/SuperTableWelcome.svelte +1 -1
- package/src/lib/SuperTable/overlays/AddNewRowOverlay.svelte +3 -3
- package/src/lib/SuperTable/overlays/EmptyResultSetOverlay.svelte +1 -1
- package/src/lib/SuperTable/overlays/ScrollbarsOverlay.svelte +43 -43
- package/src/lib/SuperTableCells/CellAttachmentExpanded.svelte +1 -1
- package/src/lib/SuperTableCells/CellAttachmentSlider.svelte +2 -3
- package/src/lib/SuperTableCells/CellBoolean.svelte +1 -1
- package/src/lib/SuperTableCells/CellColor.svelte +7 -7
- package/src/lib/SuperTableCells/CellCommon.css +1 -1
- package/src/lib/SuperTableCells/CellIcon.svelte +7 -7
- package/src/lib/SuperTableCells/CellJSON.svelte +2 -2
- package/src/lib/SuperTableCells/CellLink.svelte +50 -43
- package/src/lib/SuperTableCells/CellLinkAdvanced.svelte +2 -16
- package/src/lib/SuperTableCells/CellLinkPickerSelect.svelte +10 -11
- package/src/lib/SuperTableCells/CellLinkPickerTree.svelte +4 -2
- package/src/lib/SuperTableCells/CellNumber.svelte +24 -5
- package/src/lib/SuperTableCells/CellOptions.svelte +20 -34
- package/src/lib/SuperTableCells/CellOptionsAdvanced.svelte +5 -5
- package/src/lib/SuperTableCells/CellSQLLink.svelte +24 -36
- package/src/lib/SuperTableCells/CellSQLLinkPicker.svelte +9 -9
- package/src/lib/SuperTableCells/CellString.svelte +3 -3
- package/src/lib/SuperTableCells/CellStringMask.svelte +1 -1
- package/src/lib/SuperTableCells/CellTags.svelte +151 -108
- package/src/lib/SuperTableCells/JSDOC_GUIDE.md +163 -3
- package/src/lib/SuperTableCells/types.js +141 -192
- package/src/lib/SuperTableColumn/SuperTableColumn.svelte +1 -1
- package/src/lib/SuperTableColumn/parts/SuperColumnHeader.svelte +2 -2
- package/src/lib/SuperTableColumn/parts/SuperColumnRow.svelte +5 -3
- package/src/lib/SuperTabs/SuperTabs.svelte +2 -2
- package/src/lib/SuperTree/SuperTree.svelte +84 -38
- package/src/lib/UI/elements/Checkbox.svelte +36 -6
- package/src/lib/UI/elements/IconButton.svelte +115 -0
- package/src/lib/UI/elements/Tooltip.svelte +65 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { createEventDispatcher } from "svelte";
|
|
2
|
+
import { createEventDispatcher, onDestroy } from "svelte";
|
|
3
|
+
import Tooltip from "../UI/elements/Tooltip.svelte";
|
|
3
4
|
const dispatch = createEventDispatcher();
|
|
4
5
|
|
|
5
6
|
export let tree;
|
|
@@ -13,40 +14,70 @@
|
|
|
13
14
|
? $selectedGroups.includes(tree.id)
|
|
14
15
|
: !!$selectedNodes.find((x) => x.id == tree.id);
|
|
15
16
|
|
|
17
|
+
$: if (hasSelectedDescendant(tree.children || [])) open = true;
|
|
18
|
+
|
|
16
19
|
let labelElement;
|
|
17
|
-
|
|
20
|
+
let tooltipShow = false;
|
|
21
|
+
let tooltipTimer;
|
|
22
|
+
|
|
23
|
+
$: isOverflowing =
|
|
24
|
+
labelElement && labelElement.scrollWidth > labelElement.clientWidth;
|
|
25
|
+
|
|
18
26
|
$: tooltip = isOverflowing ? tree.label || "Not Set" : null;
|
|
19
27
|
|
|
28
|
+
const showTooltip = () => {
|
|
29
|
+
if (!tooltip) return;
|
|
30
|
+
if (tooltipTimer) clearTimeout(tooltipTimer);
|
|
31
|
+
tooltipTimer = setTimeout(() => {
|
|
32
|
+
tooltipShow = true;
|
|
33
|
+
}, 750);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const hideTooltip = () => {
|
|
37
|
+
if (tooltipTimer) {
|
|
38
|
+
clearTimeout(tooltipTimer);
|
|
39
|
+
tooltipTimer = null;
|
|
40
|
+
}
|
|
41
|
+
tooltipShow = false;
|
|
42
|
+
};
|
|
43
|
+
|
|
20
44
|
const toggleOpen = (e) => {
|
|
21
45
|
if (tree.disabled) return;
|
|
46
|
+
if (open && hasSelectedDescendant(tree.children || [])) return;
|
|
22
47
|
open = !open;
|
|
23
48
|
dispatch("nodeClick", { id: tree.id, label: tree.label });
|
|
24
49
|
};
|
|
25
50
|
|
|
26
51
|
// Recursion
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
52
|
+
const hasSelectedDescendant = (children) => {
|
|
53
|
+
if (!children || !children.length) return false;
|
|
54
|
+
for (let child of children) {
|
|
55
|
+
if (
|
|
56
|
+
child.isGroup
|
|
57
|
+
? $selectedGroups.includes(child.id)
|
|
58
|
+
: $selectedNodes.some((node) => node.id === child.id)
|
|
59
|
+
) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
if (hasSelectedDescendant(child.children)) {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
37
65
|
}
|
|
38
|
-
return
|
|
66
|
+
return false;
|
|
39
67
|
};
|
|
40
68
|
|
|
41
69
|
const toggleNode = (e) => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
});
|
|
70
|
+
dispatch("nodeSelect", {
|
|
71
|
+
id: tree.id,
|
|
72
|
+
label: tree.label,
|
|
73
|
+
row: tree.row,
|
|
74
|
+
group: tree.group,
|
|
75
|
+
});
|
|
49
76
|
};
|
|
77
|
+
|
|
78
|
+
onDestroy(() => {
|
|
79
|
+
if (tooltipTimer) clearTimeout(tooltipTimer);
|
|
80
|
+
});
|
|
50
81
|
</script>
|
|
51
82
|
|
|
52
83
|
<!-- svelte-ignore a11y-missing-attribute -->
|
|
@@ -58,28 +89,33 @@
|
|
|
58
89
|
class:is-disabled={tree.disabled}
|
|
59
90
|
class:is-open={open}
|
|
60
91
|
>
|
|
61
|
-
<div
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
style:z-index={1}
|
|
71
|
-
style:font-size={"16px"}
|
|
72
|
-
on:mousedown|self|preventDefault|stopPropagation={toggleOpen}
|
|
73
|
-
/>
|
|
74
|
-
{/if}
|
|
92
|
+
<div class="spectrum-TreeView-itemLink" style:padding-right={"0.5rem"}>
|
|
93
|
+
<i
|
|
94
|
+
class={"ri-arrow-right-s-line"}
|
|
95
|
+
class:open
|
|
96
|
+
class:is-disabled={tree.children.length == 0 || tree.disabled}
|
|
97
|
+
style:font-size={"16px"}
|
|
98
|
+
style:z-index={"1"}
|
|
99
|
+
on:mousedown|stopPropagation={toggleOpen}
|
|
100
|
+
></i>
|
|
75
101
|
<div
|
|
76
|
-
style:z-index={2}
|
|
77
102
|
style:width={"100%"}
|
|
78
|
-
|
|
103
|
+
style:z-index={"1"}
|
|
104
|
+
on:mousedown|stopPropagation|preventDefault={toggleNode}
|
|
79
105
|
>
|
|
80
|
-
<
|
|
81
|
-
|
|
106
|
+
<div
|
|
107
|
+
class="spectrum-TreeView-itemLabel"
|
|
108
|
+
style:padding-left={"0.25rem"}
|
|
109
|
+
style:z-index={"10"}
|
|
110
|
+
style:text-overflow={"ellipsis"}
|
|
111
|
+
style:overflow={"hidden"}
|
|
112
|
+
style:white-space={"nowrap"}
|
|
113
|
+
bind:this={labelElement}
|
|
114
|
+
on:mouseenter={showTooltip}
|
|
115
|
+
on:mouseleave={hideTooltip}
|
|
82
116
|
>
|
|
117
|
+
{tree.label || "Not Set"}
|
|
118
|
+
</div>
|
|
83
119
|
</div>
|
|
84
120
|
|
|
85
121
|
{#if selected}
|
|
@@ -91,6 +127,10 @@
|
|
|
91
127
|
{/if}
|
|
92
128
|
</div>
|
|
93
129
|
|
|
130
|
+
{#if tooltip}
|
|
131
|
+
<Tooltip anchor={labelElement} content={tooltip} show={tooltipShow} />
|
|
132
|
+
{/if}
|
|
133
|
+
|
|
94
134
|
{#if tree.children?.length}
|
|
95
135
|
<ul class="spectrum-TreeView">
|
|
96
136
|
{#each tree.children as node, idx}
|
|
@@ -119,11 +159,17 @@
|
|
|
119
159
|
align-items: center;
|
|
120
160
|
gap: 0.25rem;
|
|
121
161
|
max-height: 1.75rem;
|
|
162
|
+
padding: 0.25rem 0.5rem;
|
|
122
163
|
}
|
|
123
164
|
|
|
124
165
|
i {
|
|
125
166
|
transition: all 130ms;
|
|
126
167
|
}
|
|
168
|
+
|
|
169
|
+
i.is-disabled {
|
|
170
|
+
opacity: 0.3;
|
|
171
|
+
pointer-events: none;
|
|
172
|
+
}
|
|
127
173
|
.open {
|
|
128
174
|
transform: rotate(90deg);
|
|
129
175
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
export let checked: boolean = false;
|
|
6
6
|
export let partial: boolean = false;
|
|
7
7
|
export let disabled: boolean = false;
|
|
8
|
+
export let hovered: boolean = false;
|
|
8
9
|
|
|
9
10
|
function toggle() {
|
|
10
11
|
if (disabled) return;
|
|
@@ -15,11 +16,11 @@
|
|
|
15
16
|
|
|
16
17
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
17
18
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
18
|
-
<button class:checked on:click={toggle}>
|
|
19
|
+
<button class:checked class:disabled class:hovered on:click={toggle}>
|
|
19
20
|
{#if checked}
|
|
20
|
-
<i class="ph ph-check"
|
|
21
|
+
<i class="ph ph-check"></i>
|
|
21
22
|
{:else if partial}
|
|
22
|
-
<i class="ph ph-minus"
|
|
23
|
+
<i class="ph ph-minus"></i>
|
|
23
24
|
{/if}
|
|
24
25
|
</button>
|
|
25
26
|
|
|
@@ -30,20 +31,49 @@
|
|
|
30
31
|
display: flex;
|
|
31
32
|
align-items: center;
|
|
32
33
|
justify-content: center;
|
|
33
|
-
width:
|
|
34
|
-
height:
|
|
34
|
+
width: 0.85rem;
|
|
35
|
+
height: 0.85rem;
|
|
35
36
|
border-radius: 0.25rem;
|
|
36
37
|
border: 1px solid var(--spectrum-global-color-gray-500);
|
|
37
38
|
background-color: var(--spectrum-global-color-gray-50);
|
|
39
|
+
transition: all 0.1s ease-in-out;
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
button.checked {
|
|
41
43
|
border-color: var(--spectrum-global-color-gray-700);
|
|
42
44
|
}
|
|
43
45
|
|
|
46
|
+
button.disabled {
|
|
47
|
+
cursor: not-allowed;
|
|
48
|
+
background-color: var(--spectrum-global-color-gray-200);
|
|
49
|
+
border-color: var(--spectrum-global-color-gray-300);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
button:hover:not(.disabled),
|
|
53
|
+
button.hovered:not(.disabled) {
|
|
54
|
+
border: 1px solid var(--spectrum-global-color-gray-600);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
button:active {
|
|
58
|
+
background-color: var(--spectrum-global-color-blue-100);
|
|
59
|
+
}
|
|
60
|
+
button:focus {
|
|
61
|
+
border: 1px solid var(--spectrum-global-color-gray-700);
|
|
62
|
+
}
|
|
63
|
+
|
|
44
64
|
i {
|
|
45
|
-
font-size: 0.
|
|
65
|
+
font-size: 0.65rem;
|
|
46
66
|
font-weight: 700;
|
|
47
67
|
color: var(--spectrum-global-color-gray-700);
|
|
68
|
+
animation: scaleIn 0.13s ease-out;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@keyframes scaleIn {
|
|
72
|
+
from {
|
|
73
|
+
transform: scale(0);
|
|
74
|
+
}
|
|
75
|
+
to {
|
|
76
|
+
transform: scale(1);
|
|
77
|
+
}
|
|
48
78
|
}
|
|
49
79
|
</style>
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createEventDispatcher, onDestroy } from "svelte";
|
|
3
|
+
import Tooltip from "./Tooltip.svelte";
|
|
4
|
+
|
|
5
|
+
const dispatch = createEventDispatcher();
|
|
6
|
+
|
|
7
|
+
export let icon: string;
|
|
8
|
+
export let disabled: boolean = false;
|
|
9
|
+
export let size: "small" | "medium" | "large" = "medium";
|
|
10
|
+
export let tooltip: string | undefined = undefined;
|
|
11
|
+
export let variant: "primary" | "secondary" | "warning" | "danger" =
|
|
12
|
+
"primary";
|
|
13
|
+
|
|
14
|
+
let buttonElement: HTMLButtonElement;
|
|
15
|
+
let tooltipShow = false;
|
|
16
|
+
let tooltipTimer: number | undefined;
|
|
17
|
+
|
|
18
|
+
const showTooltip = () => {
|
|
19
|
+
if (tooltipTimer) clearTimeout(tooltipTimer);
|
|
20
|
+
tooltipTimer = setTimeout(() => {
|
|
21
|
+
tooltipShow = true;
|
|
22
|
+
}, 750); // delay
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const hideTooltip = () => {
|
|
26
|
+
if (tooltipTimer) {
|
|
27
|
+
clearTimeout(tooltipTimer);
|
|
28
|
+
tooltipTimer = undefined;
|
|
29
|
+
}
|
|
30
|
+
tooltipShow = false;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
onDestroy(() => {
|
|
34
|
+
if (tooltipTimer) clearTimeout(tooltipTimer);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
function handleClick() {
|
|
38
|
+
if (disabled) return;
|
|
39
|
+
dispatch("click");
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<!-- svelte-ignore a11y_consider_explicit_label -->
|
|
44
|
+
<button
|
|
45
|
+
bind:this={buttonElement}
|
|
46
|
+
class="icon-button {size} {variant}"
|
|
47
|
+
class:disabled
|
|
48
|
+
on:click={handleClick}
|
|
49
|
+
on:mouseenter={tooltip ? showTooltip : undefined}
|
|
50
|
+
on:mouseleave={tooltip ? hideTooltip : undefined}
|
|
51
|
+
>
|
|
52
|
+
<i class="ph ph-{icon}"></i>
|
|
53
|
+
</button>
|
|
54
|
+
|
|
55
|
+
{#if tooltip}
|
|
56
|
+
<Tooltip anchor={buttonElement} content={tooltip} show={tooltipShow} />
|
|
57
|
+
{/if}
|
|
58
|
+
|
|
59
|
+
<style>
|
|
60
|
+
.icon-button {
|
|
61
|
+
all: unset;
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
border-radius: 0.25rem;
|
|
67
|
+
transition: all 0.1s ease-in-out;
|
|
68
|
+
background-color: transparent;
|
|
69
|
+
border: 1px solid transparent;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.icon-button:hover:not(.disabled) {
|
|
73
|
+
background-color: var(--spectrum-global-color-gray-200);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.icon-button:active:not(.disabled) {
|
|
77
|
+
background-color: var(--spectrum-global-color-gray-300);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.icon-button.disabled {
|
|
81
|
+
cursor: not-allowed;
|
|
82
|
+
opacity: 0.5;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.icon-button.small {
|
|
86
|
+
width: 1.5rem;
|
|
87
|
+
height: 1.5rem;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.icon-button.medium {
|
|
91
|
+
width: 2rem;
|
|
92
|
+
height: 2rem;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.icon-button.large {
|
|
96
|
+
width: 2.5rem;
|
|
97
|
+
height: 2.5rem;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.icon-button.small i {
|
|
101
|
+
font-size: 0.9rem;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.icon-button.medium i {
|
|
105
|
+
font-size: 1rem;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.icon-button.large i {
|
|
109
|
+
font-size: 1.25rem;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.icon-button.warning {
|
|
113
|
+
color: var(--spectrum-global-color-red-400);
|
|
114
|
+
}
|
|
115
|
+
</style>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import SuperPopover from "../../SuperPopover/SuperPopover.svelte";
|
|
3
|
+
import { onDestroy } from "svelte";
|
|
4
|
+
|
|
5
|
+
export let anchor;
|
|
6
|
+
export let content;
|
|
7
|
+
export let show = false;
|
|
8
|
+
export let delay = 750;
|
|
9
|
+
export let align = "top";
|
|
10
|
+
|
|
11
|
+
let timer;
|
|
12
|
+
let isHovered = false;
|
|
13
|
+
|
|
14
|
+
const startTimer = () => {
|
|
15
|
+
if (timer) clearTimeout(timer);
|
|
16
|
+
timer = setTimeout(() => {
|
|
17
|
+
show = true;
|
|
18
|
+
}, delay);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const clearTimer = () => {
|
|
22
|
+
if (timer) {
|
|
23
|
+
clearTimeout(timer);
|
|
24
|
+
timer = null;
|
|
25
|
+
}
|
|
26
|
+
show = false;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const handleMouseEnter = () => {
|
|
30
|
+
isHovered = true;
|
|
31
|
+
startTimer();
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const handleMouseLeave = () => {
|
|
35
|
+
isHovered = false;
|
|
36
|
+
clearTimer();
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
onDestroy(() => {
|
|
40
|
+
clearTimer();
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
{#if show}
|
|
45
|
+
<SuperPopover {anchor} {align} open={show} dismissible={false} animate={true}>
|
|
46
|
+
<div class="tooltip-content">
|
|
47
|
+
{content}
|
|
48
|
+
</div>
|
|
49
|
+
</SuperPopover>
|
|
50
|
+
{/if}
|
|
51
|
+
|
|
52
|
+
<style>
|
|
53
|
+
.tooltip-content {
|
|
54
|
+
padding: 8px 12px;
|
|
55
|
+
font-size: 12px;
|
|
56
|
+
line-height: 1.4;
|
|
57
|
+
color: var(--spectrum-global-color-gray-900);
|
|
58
|
+
background-color: var(--spectrum-global-color-gray-50);
|
|
59
|
+
border: 1px solid var(--spectrum-global-color-gray-300);
|
|
60
|
+
border-radius: 4px;
|
|
61
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
62
|
+
max-width: 200px;
|
|
63
|
+
word-wrap: break-word;
|
|
64
|
+
}
|
|
65
|
+
</style>
|