countries selection fixed

This commit is contained in:
Mark Gregory
2026-07-07 16:29:16 +01:00
parent ec27834043
commit 2e26a8e11a
14 changed files with 305 additions and 164 deletions
+48 -14
View File
@@ -405,6 +405,22 @@
function isNumeric(subject) {
return !isNaN(parseInt(subject));
}
function dataDelete(object, key) {
let segments = parsePathSegments(key);
if (segments.length === 1) {
if (Array.isArray(object)) {
object.splice(segments[0], 1);
} else {
delete object[segments[0]];
}
return;
}
let firstSegment = segments.shift();
let restOfSegments = segments.join(".");
if (object[firstSegment] !== void 0) {
dataDelete(object[firstSegment], restOfSegments);
}
}
function diff(left, right, diffs = {}, path = "") {
if (left === right)
return diffs;
@@ -12440,17 +12456,23 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
let isNotPlainEnterKey = (e) => e.which !== 13 || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey;
el.addEventListener("click", (e) => {
if (isProgrammaticClick(e)) {
if (linkShouldBeHandledNatively(el))
return;
e.preventDefault();
callback((whenReleased) => whenReleased());
return;
}
if (isNotPlainLeftClick(e))
return;
if (linkShouldBeHandledNatively(el))
return;
e.preventDefault();
});
el.addEventListener("mousedown", (e) => {
if (isNotPlainLeftClick(e))
return;
if (linkShouldBeHandledNatively(el))
return;
e.preventDefault();
callback((whenReleased) => {
let handler4 = (e2) => {
@@ -12466,6 +12488,8 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
el.addEventListener("keydown", (e) => {
if (isNotPlainEnterKey(e))
return;
if (linkShouldBeHandledNatively(el))
return;
e.preventDefault();
callback((whenReleased) => whenReleased());
});
@@ -12488,6 +12512,20 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
function createUrlObjectFromString2(urlString) {
return urlString !== null && new URL(urlString, document.baseURI);
}
function linkShouldBeHandledNatively(linkEl, destination = extractDestinationFromLink(linkEl)) {
if (!destination)
return true;
if (!["http:", "https:"].includes(destination.protocol))
return true;
if (destination.origin !== window.location.origin)
return true;
if (linkEl.hasAttribute("download"))
return true;
let target = linkEl.getAttribute("target")?.trim().toLowerCase();
if (target && target !== "_self")
return true;
return false;
}
function getUriStringFromUrlObject(urlObject) {
return urlObject.pathname + urlObject.search + urlObject.hash;
}
@@ -12944,7 +12982,6 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
var enablePersist = true;
var showProgressBar = true;
var restoreScroll = true;
var autofocus = false;
function navigate_default(Alpine3) {
Alpine3.navigate = (url, options = {}) => {
let { preserveScroll = false } = options;
@@ -12967,7 +13004,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
let preserveScroll = modifiers.includes("preserve-scroll");
shouldPrefetchOnHover && whenThisLinkIsHoveredFor(el, 60, () => {
let destination = extractDestinationFromLink(el);
if (!destination)
if (linkShouldBeHandledNatively(el, destination))
return;
prefetchHtml(destination, (html, finalDestination) => {
storeThePrefetchedHtmlForWhenALinkIsClicked(html, destination, finalDestination);
@@ -12977,8 +13014,6 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
});
whenThisLinkIsPressed(el, (whenItIsReleased) => {
let destination = extractDestinationFromLink(el);
if (!destination)
return;
prefetchHtml(destination, (html, finalDestination) => {
storeThePrefetchedHtmlForWhenALinkIsClicked(html, destination, finalDestination);
}, () => {
@@ -13026,10 +13061,8 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
swapCallbacks.forEach((callback) => callback());
afterNewScriptsAreDoneLoading(() => {
andAfterAllThis(() => {
setTimeout(() => {
autofocus && autofocusElementsWithTheAutofocusAttribute();
});
nowInitializeAlpineOnTheNewPage(Alpine3);
autofocusElementsWithTheAutofocusAttribute();
fireEventForOtherLibrariesToHookInto("alpine:navigated");
showProgressBar && finishAndHideProgressBar();
});
@@ -13068,6 +13101,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
fireEventForOtherLibrariesToHookInto("alpine:navigating", {
onSwap: (callback) => swapCallbacks.push(callback)
});
cleanupAlpineElementsOnThePageThatArentInsideAPersistedElement();
updateCurrentPageHtmlInSnapshotCacheForLaterBackButtonClicks(currentPageKey, currentPageUrl);
preventAlpineFromPickingUpDomChanges(Alpine3, (andAfterAllThis) => {
enablePersist && storePersistantElementsForLater((persistedEl) => {
@@ -13084,8 +13118,8 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
restoreScrollPositionOrScrollToTop();
swapCallbacks.forEach((callback) => callback());
andAfterAllThis(() => {
autofocus && autofocusElementsWithTheAutofocusAttribute();
nowInitializeAlpineOnTheNewPage(Alpine3);
autofocusElementsWithTheAutofocusAttribute();
fireEventForOtherLibrariesToHookInto("alpine:navigated");
});
});
@@ -13250,24 +13284,24 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
if (!search)
return false;
let data2 = fromQueryString(search, key);
return Object.keys(data2).includes(key);
return dataGet(data2, key) !== void 0;
},
get(url, key) {
let search = url.search;
if (!search)
return false;
let data2 = fromQueryString(search, key);
return data2[key];
return dataGet(data2, key);
},
set(url, key, value) {
let data2 = fromQueryString(url.search, key);
data2[key] = stripNulls(unwrap(value));
dataSet(data2, key, stripNulls(unwrap(value)));
url.search = toQueryString(data2);
return url;
},
remove(url, key) {
let data2 = fromQueryString(url.search, key);
delete data2[key];
dataDelete(data2, key);
url.search = toQueryString(data2);
return url;
}
@@ -13322,11 +13356,11 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
return;
value = decodeURIComponent(value.replaceAll("+", "%20"));
let decodedKey = decodeURIComponent(key);
let shouldBeHandledAsArray = decodedKey.includes("[") && decodedKey.startsWith(queryKey);
let dotNotatedKey = decodedKey.replaceAll("[", ".").replaceAll("]", "");
let shouldBeHandledAsArray = decodedKey.includes("[") && (dotNotatedKey === queryKey || dotNotatedKey.startsWith(`${queryKey}.`));
if (!shouldBeHandledAsArray) {
data2[key] = value;
} else {
let dotNotatedKey = decodedKey.replaceAll("[", ".").replaceAll("]", "");
insertDotNotatedValueIntoData(dotNotatedKey, value, data2);
}
});