@likable-hair/svelte 3.1.41 → 3.1.43
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.
|
@@ -62,14 +62,18 @@ function handleInputChange(event) {
|
|
|
62
62
|
}
|
|
63
63
|
}, 30);
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
if (!!selectedYear) {
|
|
67
|
-
mask.value = selectedYear.toString();
|
|
68
|
-
}
|
|
65
|
+
function handleYearClick(ev) {
|
|
69
66
|
dispatch("year-click", {
|
|
70
67
|
year: ev.detail.year
|
|
71
68
|
});
|
|
72
69
|
}
|
|
70
|
+
function handleYearChange(ev) {
|
|
71
|
+
if (!!selectedYear) {
|
|
72
|
+
mask.value = selectedYear.toString();
|
|
73
|
+
} else {
|
|
74
|
+
mask.value = "";
|
|
75
|
+
}
|
|
76
|
+
}
|
|
73
77
|
$:
|
|
74
78
|
if (!!selectedYear) {
|
|
75
79
|
setTimeout(() => {
|
|
@@ -139,7 +143,8 @@ $:
|
|
|
139
143
|
>
|
|
140
144
|
<YearSelector
|
|
141
145
|
bind:selectedYear={selectedYear}
|
|
142
|
-
on:click={
|
|
146
|
+
on:click={handleYearClick}
|
|
147
|
+
on:change={handleYearChange}
|
|
143
148
|
{disabled}
|
|
144
149
|
></YearSelector>
|
|
145
150
|
</div>
|
|
@@ -162,7 +167,8 @@ $:
|
|
|
162
167
|
>
|
|
163
168
|
<YearSelector
|
|
164
169
|
bind:selectedYear={selectedYear}
|
|
165
|
-
on:click={
|
|
170
|
+
on:click={handleYearClick}
|
|
171
|
+
on:change={handleYearChange}
|
|
166
172
|
{disabled}
|
|
167
173
|
selectableYears={[...Array((maxYearInRange - minYearInRange) + 1).keys()].map((v) => {
|
|
168
174
|
return minYearInRange + v
|
|
@@ -108,7 +108,7 @@ function calcScrollY(elem) {
|
|
|
108
108
|
while (!!parent) {
|
|
109
109
|
scroll += parent.scrollTop;
|
|
110
110
|
let parentPosition = getComputedStyle(parent).position;
|
|
111
|
-
if (parentPosition === "absolute" || parentPosition === "fixed")
|
|
111
|
+
if (parentPosition === "absolute" || parentPosition === "fixed" || parentPosition === "relative")
|
|
112
112
|
break;
|
|
113
113
|
parent = parent.parentElement;
|
|
114
114
|
}
|
|
@@ -121,7 +121,7 @@ $:
|
|
|
121
121
|
while (!!parent) {
|
|
122
122
|
let parentPosition = getComputedStyle(parent).position;
|
|
123
123
|
parent.addEventListener("scroll", refreshMenuPosition);
|
|
124
|
-
if (parentPosition == "absolute" || parentPosition == "fixed")
|
|
124
|
+
if (parentPosition == "absolute" || parentPosition == "fixed" || parentPosition === "relative")
|
|
125
125
|
break;
|
|
126
126
|
parent = parent.parentElement;
|
|
127
127
|
}
|
|
@@ -204,7 +204,7 @@ $:
|
|
|
204
204
|
function getPositionedAncestor(elem) {
|
|
205
205
|
if (!elem)
|
|
206
206
|
return null;
|
|
207
|
-
if (["fixed", "absolute", "sticky"].includes(getComputedStyle(elem).position))
|
|
207
|
+
if (["fixed", "absolute", "sticky", "relative"].includes(getComputedStyle(elem).position))
|
|
208
208
|
return elem;
|
|
209
209
|
return getPositionedAncestor(elem.parentElement);
|
|
210
210
|
}
|
|
@@ -224,7 +224,7 @@ function getParentInstanceFromViewport(activatorParent) {
|
|
|
224
224
|
const computedStyle = getComputedStyle(currentParent);
|
|
225
225
|
const position = computedStyle.position;
|
|
226
226
|
const display = computedStyle.display;
|
|
227
|
-
if ((position === "fixed" || position === "absolute") && display === "flex") {
|
|
227
|
+
if ((position === "fixed" || position === "absolute" || position === "relative") && display === "flex") {
|
|
228
228
|
const boundingClientRect = activatorParent.getBoundingClientRect();
|
|
229
229
|
top = top + boundingClientRect.top;
|
|
230
230
|
left = left + boundingClientRect.left;
|
|
@@ -14,11 +14,18 @@ onMount(() => {
|
|
|
14
14
|
});
|
|
15
15
|
const dispatch = createEventDispatcher();
|
|
16
16
|
function handleYearClick(year) {
|
|
17
|
-
selectedYear
|
|
18
|
-
|
|
17
|
+
if (selectedYear === year) {
|
|
18
|
+
selectedYear = void 0;
|
|
19
|
+
} else {
|
|
20
|
+
selectedYear = year;
|
|
21
|
+
scrollAtCenter(container, targetButtons[selectedYear], "smooth");
|
|
22
|
+
}
|
|
19
23
|
dispatch("click", {
|
|
20
24
|
year
|
|
21
25
|
});
|
|
26
|
+
dispatch("change", {
|
|
27
|
+
year: selectedYear
|
|
28
|
+
});
|
|
22
29
|
}
|
|
23
30
|
import Button from "../buttons/Button.svelte";
|
|
24
31
|
</script>
|