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
@@ -44,17 +44,17 @@
<input id="address_postal_code" name="postal_code" value="{{ old('postal_code', $address?->postal_code) }}" class="{{ $inputClass }}">
</div>
<div class="wms-select2-field min-w-0">
<div class="wms-select2-field">
<label for="address_country_id" class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200">Country</label>
<select
id="address_country_id"
name="country_id"
data-wms-select2
data-wms-select2="true"
data-placeholder="Search and select country"
class="wms-select2-control"
required
>
<option value="">Search and select country</option>
<option value=""></option>
@foreach ($countries as $country)
<option value="{{ $country->id }}" @selected((int) old('country_id', $address?->country_id) === $country->id)>
{{ $country->display_name ?: $country->common_name ?: $country->name }}
+48 -14
View File
@@ -10074,6 +10074,22 @@ function dataSet(object, key, value) {
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;
@@ -13417,17 +13433,23 @@ function whenThisLinkIsPressed(el, callback) {
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 handler = (e2) => {
@@ -13443,6 +13465,8 @@ function whenThisLinkIsPressed(el, callback) {
el.addEventListener("keydown", (e) => {
if (isNotPlainEnterKey(e))
return;
if (linkShouldBeHandledNatively(el))
return;
e.preventDefault();
callback((whenReleased) => whenReleased());
});
@@ -13465,6 +13489,20 @@ function extractDestinationFromLink(linkEl) {
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;
}
@@ -13923,7 +13961,6 @@ function ignoreAttributes(subject, attributesToRemove) {
var enablePersist = true;
var showProgressBar = true;
var restoreScroll = true;
var autofocus = false;
function navigate_default(Alpine25) {
Alpine25.navigate = (url, options = {}) => {
let { preserveScroll = false } = options;
@@ -13946,7 +13983,7 @@ function navigate_default(Alpine25) {
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);
@@ -13956,8 +13993,6 @@ function navigate_default(Alpine25) {
});
whenThisLinkIsPressed(el, (whenItIsReleased) => {
let destination = extractDestinationFromLink(el);
if (!destination)
return;
prefetchHtml(destination, (html, finalDestination) => {
storeThePrefetchedHtmlForWhenALinkIsClicked(html, destination, finalDestination);
}, () => {
@@ -14005,10 +14040,8 @@ function navigate_default(Alpine25) {
swapCallbacks.forEach((callback) => callback());
afterNewScriptsAreDoneLoading(() => {
andAfterAllThis(() => {
setTimeout(() => {
autofocus && autofocusElementsWithTheAutofocusAttribute();
});
nowInitializeAlpineOnTheNewPage(Alpine25);
autofocusElementsWithTheAutofocusAttribute();
fireEventForOtherLibrariesToHookInto("alpine:navigated");
showProgressBar && finishAndHideProgressBar();
});
@@ -14047,6 +14080,7 @@ function navigate_default(Alpine25) {
fireEventForOtherLibrariesToHookInto("alpine:navigating", {
onSwap: (callback) => swapCallbacks.push(callback)
});
cleanupAlpineElementsOnThePageThatArentInsideAPersistedElement();
updateCurrentPageHtmlInSnapshotCacheForLaterBackButtonClicks(currentPageKey, currentPageUrl);
preventAlpineFromPickingUpDomChanges(Alpine25, (andAfterAllThis) => {
enablePersist && storePersistantElementsForLater((persistedEl) => {
@@ -14063,8 +14097,8 @@ function navigate_default(Alpine25) {
restoreScrollPositionOrScrollToTop();
swapCallbacks.forEach((callback) => callback());
andAfterAllThis(() => {
autofocus && autofocusElementsWithTheAutofocusAttribute();
nowInitializeAlpineOnTheNewPage(Alpine25);
autofocusElementsWithTheAutofocusAttribute();
fireEventForOtherLibrariesToHookInto("alpine:navigated");
});
});
@@ -14229,24 +14263,24 @@ function queryStringUtils() {
if (!search)
return false;
let data = fromQueryString(search, key);
return Object.keys(data).includes(key);
return dataGet(data, key) !== void 0;
},
get(url, key) {
let search = url.search;
if (!search)
return false;
let data = fromQueryString(search, key);
return data[key];
return dataGet(data, key);
},
set(url, key, value) {
let data = fromQueryString(url.search, key);
data[key] = stripNulls(unwrap(value));
dataSet(data, key, stripNulls(unwrap(value)));
url.search = toQueryString(data);
return url;
},
remove(url, key) {
let data = fromQueryString(url.search, key);
delete data[key];
dataDelete(data, key);
url.search = toQueryString(data);
return url;
}
@@ -14301,11 +14335,11 @@ function fromQueryString(search, queryKey) {
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) {
data[key] = value;
} else {
let dotNotatedKey = decodedKey.replaceAll("[", ".").replaceAll("]", "");
insertDotNotatedValueIntoData(dotNotatedKey, value, data);
}
});
File diff suppressed because one or more lines are too long
+48 -14
View File
@@ -5164,6 +5164,22 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
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;
@@ -13853,17 +13869,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 handler = (e2) => {
@@ -13879,6 +13901,8 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
el.addEventListener("keydown", (e) => {
if (isNotPlainEnterKey(e))
return;
if (linkShouldBeHandledNatively(el))
return;
e.preventDefault();
callback((whenReleased) => whenReleased());
});
@@ -13901,6 +13925,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;
}
@@ -14359,7 +14397,6 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
var enablePersist = true;
var showProgressBar = true;
var restoreScroll = true;
var autofocus = false;
function navigate_default(Alpine25) {
Alpine25.navigate = (url, options = {}) => {
let { preserveScroll = false } = options;
@@ -14382,7 +14419,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);
@@ -14392,8 +14429,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);
}, () => {
@@ -14441,10 +14476,8 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
swapCallbacks.forEach((callback) => callback());
afterNewScriptsAreDoneLoading(() => {
andAfterAllThis(() => {
setTimeout(() => {
autofocus && autofocusElementsWithTheAutofocusAttribute();
});
nowInitializeAlpineOnTheNewPage(Alpine25);
autofocusElementsWithTheAutofocusAttribute();
fireEventForOtherLibrariesToHookInto("alpine:navigated");
showProgressBar && finishAndHideProgressBar();
});
@@ -14483,6 +14516,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
fireEventForOtherLibrariesToHookInto("alpine:navigating", {
onSwap: (callback) => swapCallbacks.push(callback)
});
cleanupAlpineElementsOnThePageThatArentInsideAPersistedElement();
updateCurrentPageHtmlInSnapshotCacheForLaterBackButtonClicks(currentPageKey, currentPageUrl);
preventAlpineFromPickingUpDomChanges(Alpine25, (andAfterAllThis) => {
enablePersist && storePersistantElementsForLater((persistedEl) => {
@@ -14499,8 +14533,8 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
restoreScrollPositionOrScrollToTop();
swapCallbacks.forEach((callback) => callback());
andAfterAllThis(() => {
autofocus && autofocusElementsWithTheAutofocusAttribute();
nowInitializeAlpineOnTheNewPage(Alpine25);
autofocusElementsWithTheAutofocusAttribute();
fireEventForOtherLibrariesToHookInto("alpine:navigated");
});
});
@@ -14665,24 +14699,24 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
if (!search)
return false;
let data = fromQueryString(search, key);
return Object.keys(data).includes(key);
return dataGet(data, key) !== void 0;
},
get(url, key) {
let search = url.search;
if (!search)
return false;
let data = fromQueryString(search, key);
return data[key];
return dataGet(data, key);
},
set(url, key, value) {
let data = fromQueryString(url.search, key);
data[key] = stripNulls(unwrap(value));
dataSet(data, key, stripNulls(unwrap(value)));
url.search = toQueryString(data);
return url;
},
remove(url, key) {
let data = fromQueryString(url.search, key);
delete data[key];
dataDelete(data, key);
url.search = toQueryString(data);
return url;
}
@@ -14737,11 +14771,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) {
data[key] = value;
} else {
let dotNotatedKey = decodedKey.replaceAll("[", ".").replaceAll("]", "");
insertDotNotatedValueIntoData(dotNotatedKey, value, data);
}
});
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+48 -14
View File
@@ -9304,6 +9304,22 @@ function dataSet(object, key, value) {
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;
@@ -12647,17 +12663,23 @@ function whenThisLinkIsPressed(el, callback) {
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 handler = (e2) => {
@@ -12673,6 +12695,8 @@ function whenThisLinkIsPressed(el, callback) {
el.addEventListener("keydown", (e) => {
if (isNotPlainEnterKey(e))
return;
if (linkShouldBeHandledNatively(el))
return;
e.preventDefault();
callback((whenReleased) => whenReleased());
});
@@ -12695,6 +12719,20 @@ function extractDestinationFromLink(linkEl) {
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;
}
@@ -13153,7 +13191,6 @@ function ignoreAttributes(subject, attributesToRemove) {
var enablePersist = true;
var showProgressBar = true;
var restoreScroll = true;
var autofocus = false;
function navigate_default(Alpine25) {
Alpine25.navigate = (url, options = {}) => {
let { preserveScroll = false } = options;
@@ -13176,7 +13213,7 @@ function navigate_default(Alpine25) {
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);
@@ -13186,8 +13223,6 @@ function navigate_default(Alpine25) {
});
whenThisLinkIsPressed(el, (whenItIsReleased) => {
let destination = extractDestinationFromLink(el);
if (!destination)
return;
prefetchHtml(destination, (html, finalDestination) => {
storeThePrefetchedHtmlForWhenALinkIsClicked(html, destination, finalDestination);
}, () => {
@@ -13235,10 +13270,8 @@ function navigate_default(Alpine25) {
swapCallbacks.forEach((callback) => callback());
afterNewScriptsAreDoneLoading(() => {
andAfterAllThis(() => {
setTimeout(() => {
autofocus && autofocusElementsWithTheAutofocusAttribute();
});
nowInitializeAlpineOnTheNewPage(Alpine25);
autofocusElementsWithTheAutofocusAttribute();
fireEventForOtherLibrariesToHookInto("alpine:navigated");
showProgressBar && finishAndHideProgressBar();
});
@@ -13277,6 +13310,7 @@ function navigate_default(Alpine25) {
fireEventForOtherLibrariesToHookInto("alpine:navigating", {
onSwap: (callback) => swapCallbacks.push(callback)
});
cleanupAlpineElementsOnThePageThatArentInsideAPersistedElement();
updateCurrentPageHtmlInSnapshotCacheForLaterBackButtonClicks(currentPageKey, currentPageUrl);
preventAlpineFromPickingUpDomChanges(Alpine25, (andAfterAllThis) => {
enablePersist && storePersistantElementsForLater((persistedEl) => {
@@ -13293,8 +13327,8 @@ function navigate_default(Alpine25) {
restoreScrollPositionOrScrollToTop();
swapCallbacks.forEach((callback) => callback());
andAfterAllThis(() => {
autofocus && autofocusElementsWithTheAutofocusAttribute();
nowInitializeAlpineOnTheNewPage(Alpine25);
autofocusElementsWithTheAutofocusAttribute();
fireEventForOtherLibrariesToHookInto("alpine:navigated");
});
});
@@ -13459,24 +13493,24 @@ function queryStringUtils() {
if (!search)
return false;
let data = fromQueryString(search, key);
return Object.keys(data).includes(key);
return dataGet(data, key) !== void 0;
},
get(url, key) {
let search = url.search;
if (!search)
return false;
let data = fromQueryString(search, key);
return data[key];
return dataGet(data, key);
},
set(url, key, value) {
let data = fromQueryString(url.search, key);
data[key] = stripNulls(unwrap(value));
dataSet(data, key, stripNulls(unwrap(value)));
url.search = toQueryString(data);
return url;
},
remove(url, key) {
let data = fromQueryString(url.search, key);
delete data[key];
dataDelete(data, key);
url.search = toQueryString(data);
return url;
}
@@ -13531,11 +13565,11 @@ function fromQueryString(search, queryKey) {
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) {
data[key] = value;
} else {
let dotNotatedKey = decodedKey.replaceAll("[", ".").replaceAll("]", "");
insertDotNotatedValueIntoData(dotNotatedKey, value, data);
}
});
File diff suppressed because one or more lines are too long
+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);
}
});
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,2 +1,2 @@
{"/livewire.js":"4735e441"}
{"/livewire.js":"657d57c2"}
+34 -46
View File
@@ -1,7 +1,16 @@
/* WMS Select2 professional dark theme. */
/* WMS Select2 professional dark theme.
Imported after Select2's own CSS so it overrides the vendor defaults. */
.wms-select2-field {
min-width: 0;
.select2-hidden-accessible {
position: absolute !important;
width: 1px !important;
height: 1px !important;
overflow: hidden !important;
clip: rect(0 0 0 0) !important;
white-space: nowrap !important;
border: 0 !important;
padding: 0 !important;
margin: -1px !important;
}
.wms-select2-field .select2-container,
@@ -14,19 +23,6 @@
margin-top: 0.5rem !important;
}
.wms-select2-field select[data-wms-select2].select2-hidden-accessible,
.wms-select2-field select.wms-select2-control.select2-hidden-accessible {
position: absolute !important;
width: 1px !important;
height: 1px !important;
overflow: hidden !important;
clip: rect(0 0 0 0) !important;
white-space: nowrap !important;
border: 0 !important;
padding: 0 !important;
margin: -1px !important;
}
.select2-container--wms .select2-selection--single {
position: relative !important;
height: 3rem !important;
@@ -35,6 +31,8 @@
border-radius: 0.75rem !important;
background: rgb(9 9 11) !important;
box-shadow: 0 1px 2px rgb(0 0 0 / 0.2) !important;
display: flex !important;
align-items: center !important;
outline: none !important;
transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease !important;
}
@@ -46,7 +44,7 @@
}
.select2-container--wms .select2-selection--single .select2-selection__rendered {
height: 100% !important;
width: 100% !important;
padding: 0 2.75rem 0 1rem !important;
color: rgb(244 244 245) !important;
font-size: 0.875rem !important;
@@ -59,13 +57,12 @@
font-weight: 500 !important;
}
/* Keep the Select2 arrow as a plain chevron, not a boxed button. */
.select2-container--wms .select2-selection--single .select2-selection__arrow {
position: absolute !important;
top: 0 !important;
right: 0.875rem !important;
width: 1.25rem !important;
height: 3rem !important;
width: 1rem !important;
height: 100% !important;
background: transparent !important;
border: 0 !important;
border-radius: 0 !important;
@@ -73,39 +70,35 @@
}
.select2-container--wms .select2-selection--single .select2-selection__arrow b {
position: absolute !important;
left: 50% !important;
top: 50% !important;
width: 0 !important;
height: 0 !important;
margin-left: -4px !important;
margin-top: -2px !important;
border-color: rgb(212 212 216) transparent transparent transparent !important;
border-style: solid !important;
border-width: 5px 4px 0 4px !important;
border-color: rgb(212 212 216) transparent transparent transparent !important;
height: 0 !important;
left: 50% !important;
margin-left: -4px !important;
margin-top: -2px !important;
position: absolute !important;
top: 50% !important;
width: 0 !important;
}
.select2-container--wms.select2-container--open .select2-selection--single .select2-selection__arrow b {
margin-top: -3px !important;
border-width: 0 4px 5px 4px !important;
border-color: transparent transparent rgb(212 212 216) transparent !important;
border-width: 0 4px 5px 4px !important;
}
.select2-container--wms .select2-selection--single .select2-selection__clear {
position: absolute !important;
right: 2.1rem !important;
top: 0 !important;
right: 2.25rem !important;
height: 3rem !important;
width: 1.25rem !important;
margin: 0 !important;
padding: 0 !important;
height: 100% !important;
width: 1rem !important;
background: transparent !important;
border: 0 !important;
border-radius: 0 !important;
box-shadow: none !important;
color: rgb(161 161 170) !important;
font-size: 1.1rem !important;
font-weight: 700 !important;
font-size: 1.125rem !important;
line-height: 3rem !important;
text-align: center !important;
}
@@ -124,26 +117,21 @@
}
.select2-container--wms .select2-search--dropdown {
padding: 0.625rem !important;
padding: 0.75rem !important;
background: rgb(24 24 27) !important;
}
.select2-container--wms .select2-search--dropdown .select2-search__field {
height: 2.5rem !important;
height: 2.75rem !important;
border: 1px solid rgb(63 63 70) !important;
border-radius: 0.75rem !important;
background: rgb(9 9 11) !important;
color: rgb(244 244 245) !important;
padding: 0 0.875rem !important;
font-size: 0.875rem !important;
font-weight: 500 !important;
outline: none !important;
}
.select2-container--wms .select2-search--dropdown .select2-search__field::placeholder {
color: rgb(161 161 170) !important;
}
.select2-container--wms .select2-search--dropdown .select2-search__field:focus {
border-color: rgb(59 130 246) !important;
box-shadow: 0 0 0 3px rgb(59 130 246 / 0.22) !important;
@@ -155,7 +143,7 @@
}
.select2-container--wms .select2-results__option {
padding: 0.7rem 1rem !important;
padding: 0.75rem 1rem !important;
color: rgb(244 244 245) !important;
font-size: 0.875rem !important;
font-weight: 500 !important;
@@ -176,7 +164,7 @@
color: rgb(161 161 170) !important;
}
/* Fallback styling before Select2 initialises, matching WMS inputs. */
/* Matching fallback before Select2 initialises. */
.wms-select2-field > select[data-wms-select2],
.wms-select2-field > select.wms-select2-control {
margin-top: 0.5rem;
+45 -28
View File
@@ -143,9 +143,19 @@ function renderWmsCharts() {
function livewireComponentFor(element) {
const componentRoot = element.closest('[wire\:id]');
if (!element || !window.Livewire) {
return null;
}
if (!componentRoot || !window.Livewire) {
let componentRoot = null;
try {
componentRoot = element.closest('[wire\\:id]');
} catch (error) {
componentRoot = null;
}
if (!componentRoot) {
return null;
}
@@ -167,25 +177,32 @@ function setLivewireProperty(element, model, value) {
*
* @returns {void}
*/
function initialiseSelect2() {
function initialiseSelect2(root = document) {
if (!window.jQuery?.fn?.select2) {
return;
}
$('[data-helpdesk-select2], [data-wms-select2], .wms-select2-control').each(function () {
const $select = $(this);
const $root = root instanceof window.Element ? $(root) : $(document);
const selector = 'select[data-helpdesk-select2], select[data-wms-select2], select.wms-select2-control';
$root.find(selector).add($root.is(selector) ? $root : $()).each(function () {
const select = this;
const $select = $(select);
if ($select.hasClass('select2-hidden-accessible')) {
$select.select2('destroy');
return;
}
const isMultiple = $select.prop('multiple');
const placeholder =
$select.data('placeholder') ||
$select.find('option[value=""]').first().text() ||
(isMultiple ? 'Select options' : 'Select option');
if (!isMultiple && $select.find('option[value=""]').length === 0) {
$select.prepend(new Option('', '', false, false));
}
$select.select2({
theme: 'wms',
width: '100%',
@@ -201,26 +218,9 @@ function initialiseSelect2() {
},
});
$select.off('select2:open.wms-select2');
$select.on('select2:open.wms-select2', function () {
const searchField = document.querySelector('.select2-container--open .select2-search__field');
if (searchField) {
searchField.placeholder = placeholder;
searchField.focus();
}
});
$select.off('change.select2-livewire');
$select.on('change.select2-livewire', function () {
$select.off('change.wms-select2-livewire');
$select.on('change.wms-select2-livewire', function () {
setLivewireProperty(this, this.dataset.wireModel, $select.val());
this.dispatchEvent(
new Event('change', {
bubbles: true,
})
);
});
});
}
@@ -236,11 +236,28 @@ function bootUi() {
}
document.addEventListener('DOMContentLoaded', bootUi);
window.addEventListener('load', bootUi);
window.addEventListener('pageshow', bootUi);
document.addEventListener('livewire:navigated', bootUi);
document.addEventListener('livewire:init', () => {
Livewire.hook('morphed', () => {
initialiseSelect2();
Livewire.hook('morphed', ({ el }) => {
initialiseSelect2(el || document);
});
});
const select2Observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
mutation.addedNodes.forEach((node) => {
if (node instanceof window.Element) {
initialiseSelect2(node);
}
});
});
});
select2Observer.observe(document.documentElement, {
childList: true,
subtree: true,
});