From 2fa57649bb244d997a5ae61c63ef0ccf4e2ce45d Mon Sep 17 00:00:00 2001 From: ShadyNagy Date: Mon, 3 Aug 2020 20:30:14 +0200 Subject: [PATCH] Scroll Move Added. --- .../Pages/ScrollbarController.razor | 16 +- .../Constants/JSInteropConstants.cs | 28 ++ .../Content/js/blazor-javascript-utilities.js | 340 ++++++++++++++- .../js/blazor-javascript-utilities.js.map | 2 +- .../Content/js/scroll-controller.js | 328 +++++++++++++++ .../Content/js/scroll-controller.js.map | 2 +- .../Content/js/storage.js | 11 +- .../Content/js/storage.js.map | 2 +- .../Content/ts/blazor-javascript-utilities.ts | 389 +++++++++++++++++- .../Content/ts/scroll-controller.ts | 378 ++++++++++++++++- .../Content/ts/storage.ts | 11 +- .../BlazorScrollController.cs | 197 ++++++++- .../IBlazorScrollController.cs | 40 ++ .../ISyncBlazorScrollController.cs | 34 +- .../BlazorScrollController/ScrollBehaviors.cs | 12 + .../BlazorScrollController/ScrollBlocks.cs | 14 + ...hadyNagy.Blazor.JavaScriptUtilities.csproj | 6 +- .../blazor-javascript-utilities.min.js | 2 +- .../wwwroot/scroll-controller.min.js | 2 +- .../wwwroot/storage.min.js | 2 +- 20 files changed, 1782 insertions(+), 34 deletions(-) create mode 100644 src/ShadyNagy.Blazor.JavaScriptUtilities/Services/BlazorScrollController/ScrollBehaviors.cs create mode 100644 src/ShadyNagy.Blazor.JavaScriptUtilities/Services/BlazorScrollController/ScrollBlocks.cs diff --git a/samples/blazor-sample/Pages/ScrollbarController.razor b/samples/blazor-sample/Pages/ScrollbarController.razor index 908d90c..6a2a87e 100644 --- a/samples/blazor-sample/Pages/ScrollbarController.razor +++ b/samples/blazor-sample/Pages/ScrollbarController.razor @@ -2,7 +2,7 @@ @inject IBlazorScrollController BlazorScrollController -
+
@@ -11,6 +11,10 @@ + + + +
@code @@ -44,4 +48,14 @@ { await BlazorScrollController.ShowBodyScrollOverflowAsync(ScrollType.Both); } + + private async Task ScrollToTop() + { + await BlazorScrollController.ScrollToBodyTopAsync(ScrollBehaviors.Auto); + } + + private async Task ScrollToBottom() + { + await BlazorScrollController.ScrollToBodyBottomAsync( ScrollBehaviors.Auto); + } } diff --git a/src/ShadyNagy.Blazor.JavaScriptUtilities/Constants/JSInteropConstants.cs b/src/ShadyNagy.Blazor.JavaScriptUtilities/Constants/JSInteropConstants.cs index 25dfcba..14b32e7 100644 --- a/src/ShadyNagy.Blazor.JavaScriptUtilities/Constants/JSInteropConstants.cs +++ b/src/ShadyNagy.Blazor.JavaScriptUtilities/Constants/JSInteropConstants.cs @@ -18,6 +18,34 @@ internal static class ScrollController internal static string ShowScrollOverflowByTag => "showScrollOverflowByTag"; internal static string HideScrollOverflowByClass => "hideScrollOverflowByClass"; internal static string ShowScrollOverflowByClass => "showScrollOverflowByClass"; + internal static string ScrollTo => "mainScrollTo"; + internal static string ScrollVToElementById => "scrollVToElementById"; + internal static string ScrollVToElementByTag => "scrollVToElementByTag"; + internal static string ScrollVToElementByClass => "scrollVToElementByClass"; + internal static string ScrollHToElementById => "scrollHToElementById"; + internal static string ScrollHToElementByTag => "scrollHToElementByTag"; + internal static string ScrollHToElementByClass => "scrollHToElementByClass"; + internal static string ScrollElementToByTagName => "scrollElementToByTagName"; + internal static string ScrollElementToByElementId => "scrollElementToByElementId"; + internal static string ScrollElementToByClassName => "scrollElementToByClassName"; + internal static string GetScrollHeightByElementId => "getScrollHeightByElementId"; + internal static string GetScrollHeightByTagName => "getScrollHeightByTagName"; + internal static string GetScrollHeightByClassName => "getScrollHeightByClassName"; + internal static string GetScrollWidthByElementId => "getScrollWidthByElementId"; + internal static string GetScrollWidthByTagName => "getScrollWidthByTagName"; + internal static string GetScrollWidthByClassName => "getScrollWidthByClassName"; + internal static string GetScrollLeftByElementId => "getScrollLeftByElementId"; + internal static string GetScrollLeftByTagName => "getScrollLeftByTagName"; + internal static string GetScrollLeftByClassName => "getScrollLeftByClassName"; + internal static string GetScrollTopByElementId => "getScrollTopByElementId"; + internal static string GetScrollTopByTagName => "getScrollTopByTagName"; + internal static string GetScrollTopByClassName => "getScrollTopByClassName"; + internal static string SetScrollLeftByElementId => "setScrollLeftByElementId"; + internal static string SetScrollLeftByTagName => "setScrollLeftByTagName"; + internal static string SetScrollLeftByClassName => "setScrollLeftByClassName"; + internal static string SetScrollTopByElementId => "setScrollTopByElementId"; + internal static string SetScrollTopByTagName => "setScrollTopByTagName"; + internal static string SetScrollTopByClassName => "setScrollTopByClassName"; } internal static class Storage diff --git a/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/blazor-javascript-utilities.js b/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/blazor-javascript-utilities.js index c70baa1..466ce5f 100644 --- a/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/blazor-javascript-utilities.js +++ b/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/blazor-javascript-utilities.js @@ -1,4 +1,54 @@ -/* ==================================================================ScrollController================================================================== */ +function createOptions(top, left, behavior = 'auto') { + return { + top: top, + left: left, + behavior: behavior + }; +} +function createScrollIntoViewOptions(behavior = 'auto', block = 'start', inline = 'nearest') { + return { + behavior: behavior, + block: block, + inline: inline + }; +} +function getElementByTagName(tagName) { + if (tagName === "body") { + return document.body; + } + else { + const elements = document.getElementsByTagName(tagName); + for (let i = 0; i < elements.length; i++) { + return elements[i]; + } + } + return new HTMLElement(); +} +function getElementByClassName(className) { + const elements = document.getElementsByClassName(className); + for (let i = 0; i < elements.length; i++) { + return elements[i]; + } + return new HTMLElement(); +} +function scrollHeightElement(element) { + return element.scrollHeight; +} +function scrollWidthElement(element) { + return element.scrollTop; +} +function setScrollLeftElement(element, value) { + element.scrollLeft = value; +} +function setScrollTopElement(element, value) { + element.scrollTop = value; +} +function getScrollLeftElement(element) { + return element.scrollLeft; +} +function getScrollTopElement(element) { + return element.scrollTop; +} function hide(element, scrollType) { if (scrollType === 1) { element.classList.add("blazor-javascript-v-no-overflow"); @@ -73,6 +123,283 @@ function hideBodyScrollOverflow(scrollType) { function showBodyScrollOverflow(scrollType) { show(document.body, scrollType); } +function mainScrollTo(top = 0, left = 0, behavior = 'auto') { + try { + const options = createOptions(top, left, behavior); + window.scroll(options); + return true; + } + catch (e) { + return false; + } +} +function scrollVToElementById(elementId, behavior = 'auto', block = 'start') { + try { + let element = document.getElementById(elementId); + const options = createScrollIntoViewOptions(behavior, block, undefined); + element.scrollIntoView(options); + return true; + } + catch (e) { + return false; + } +} +function scrollVToElementByTag(tagName, behavior = 'auto', block = 'start') { + try { + let element = getElementByTagName(tagName); + const options = createScrollIntoViewOptions(behavior, block, undefined); + element.scrollIntoView(options); + return true; + } + catch (e) { + return false; + } +} +function scrollVToElementByClass(className, behavior = 'auto', block = 'start') { + try { + let element = getElementByClassName(className); + const options = createScrollIntoViewOptions(behavior, block, undefined); + element.scrollIntoView(options); + return true; + } + catch (e) { + return false; + } +} +function scrollHToElementById(elementId, behavior = 'auto', inline = 'nearest') { + try { + let element = document.getElementById(elementId); + const options = createScrollIntoViewOptions(behavior, undefined, inline); + element.scrollIntoView(options); + return true; + } + catch (e) { + return false; + } +} +function scrollHToElementByTag(tagName, behavior = 'auto', inline = 'nearest') { + try { + let element = getElementByTagName(tagName); + const options = createScrollIntoViewOptions(behavior, undefined, inline); + element.scrollIntoView(options); + return true; + } + catch (e) { + return false; + } +} +function scrollHToElementByClass(className, behavior = 'auto', inline = 'nearest') { + try { + let element = getElementByClassName(className); + const options = createScrollIntoViewOptions(behavior, undefined, inline); + element.scrollIntoView(options); + return true; + } + catch (e) { + return false; + } +} +function scrollElementToByElementId(elementId, top = 0, left = 0, behavior = 'auto') { + try { + let element = document.getElementById(elementId); + const options = createOptions(top, left, behavior); + element.scroll(options); + return true; + } + catch (e) { + return false; + } +} +function scrollElementToByTagName(tagName, top = 0, left = 0, behavior = 'auto') { + try { + let element = getElementByTagName(tagName); + const options = createOptions(top, left, behavior); + element.scroll(options); + return true; + } + catch (e) { + return false; + } +} +function scrollElementToByClassName(className, top = 0, left = 0, behavior = 'auto') { + try { + let element = getElementByClassName(className); + const options = createOptions(top, left, behavior); + element.scroll(options); + return true; + } + catch (e) { + return false; + } +} +function getScrollHeightByElementId(elementId) { + try { + let element = document.getElementById(elementId); + return scrollHeightElement(element); + } + catch (e) { + return 0; + } +} +function getScrollHeightByTagName(tagName) { + try { + let element = getElementByTagName(tagName); + return scrollHeightElement(element); + } + catch (e) { + return 0; + } +} +function getScrollHeightByClassName(className) { + try { + let element = getElementByClassName(className); + return scrollHeightElement(element); + } + catch (e) { + return 0; + } +} +function getScrollWidthByElementId(elementId) { + try { + let element = document.getElementById(elementId); + return scrollWidthElement(element); + } + catch (e) { + return 0; + } +} +function getScrollWidthByTagName(tagName) { + try { + let element = getElementByTagName(tagName); + return scrollWidthElement(element); + } + catch (e) { + return 0; + } +} +function getScrollWidthByClassName(className) { + try { + let element = getElementByClassName(className); + return scrollWidthElement(element); + } + catch (e) { + return 0; + } +} +function getScrollLeftByElementId(elementId) { + try { + let element = document.getElementById(elementId); + return getScrollLeftElement(element); + } + catch (e) { + return 0; + } +} +function getScrollLeftByTagName(tagName) { + try { + let element = getElementByTagName(tagName); + return getScrollLeftElement(element); + } + catch (e) { + return 0; + } +} +function getScrollLeftByClassName(className) { + try { + let element = getElementByClassName(className); + return getScrollLeftElement(element); + } + catch (e) { + return 0; + } +} +function getScrollTopByElementId(elementId) { + try { + let element = document.getElementById(elementId); + return getScrollTopElement(element); + } + catch (e) { + return 0; + } +} +function getScrollTopByTagName(tagName) { + try { + let element = getElementByTagName(tagName); + return getScrollTopElement(element); + } + catch (e) { + return 0; + } +} +function getScrollTopByClassName(className) { + try { + let element = getElementByClassName(className); + return getScrollTopElement(element); + } + catch (e) { + return 0; + } +} +function setScrollLeftByElementId(elementId, value) { + try { + let element = document.getElementById(elementId); + setScrollLeftElement(element, value); + return true; + } + catch (e) { + return false; + } +} +function setScrollLeftByTagName(tagName, value) { + try { + let element = getElementByTagName(tagName); + setScrollLeftElement(element, value); + return true; + } + catch (e) { + return false; + } +} +function setScrollLeftByClassName(className, value) { + try { + let element = getElementByClassName(className); + setScrollLeftElement(element, value); + return true; + } + catch (e) { + return false; + } +} +function setScrollTopByElementId(elementId, value) { + try { + let element = document.getElementById(elementId); + setScrollTopElement(element, value); + return true; + } + catch (e) { + return false; + } +} +function setScrollTopByTagName(tagName, value) { + try { + let element = getElementByTagName(tagName); + setScrollTopElement(element, value); + return true; + } + catch (e) { + return false; + } +} +function setScrollTopByClassName(className, value) { + try { + let element = getElementByClassName(className); + setScrollTopElement(element, value); + return true; + } + catch (e) { + return false; + } +} /* ==================================================================Cookie================================================================== */ function getCookie(cname) { const name = cname + '='; @@ -221,11 +548,12 @@ function storageGetAll(type) { } function storageListener(componentInstance) { window.addEventListener('storage', (e) => { - let result; - result.key = e.key; - result.oldValue = e.oldValue; - result.newValue = e.newValue; - result.url = e.url; + let result = { + key: e.key, + oldValue: e.oldValue, + newValue: e.newValue, + url: e.url + }; componentInstance.invokeMethodAsync('StorageChange', JSON.stringify(result)); }); } diff --git a/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/blazor-javascript-utilities.js.map b/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/blazor-javascript-utilities.js.map index 8a631f8..21b46c6 100644 --- a/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/blazor-javascript-utilities.js.map +++ b/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/blazor-javascript-utilities.js.map @@ -1 +1 @@ -{"version":3,"file":"blazor-javascript-utilities.js","sourceRoot":"","sources":["../ts/blazor-javascript-utilities.ts"],"names":[],"mappings":"AAEA,0JAA0J;AAC1J,SAAS,IAAI,CAAC,OAAoB,EAAE,UAAkB;IAClD,IAAI,UAAU,KAAK,CAAC,EAAE;QAClB,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;KAC5D;SAAM,IAAI,UAAU,KAAK,CAAC,EAAE;QACzB,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,iCAAi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AAC;QACjC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAElC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAClC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;gBACV,SAAS;aACZ;YACD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;SAC/E;QAED,OAAO,MAAM,CAAC;KACjB;IACD,OAAO,CAAC,EAAE;QACN,OAAO,EAAE,CAAC;KACb;AACL,CAAC;AAED,SAAS,eAAe,CAAC,iBAAsB;IAC3C,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAC7B,CAAC,CAAC,EAAE,EAAE;QACF,IAAI,MAAuB,CAAC;QAC5B,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC;QACnB,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC;QAC7B,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC;QAC7B,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC;QACnB,iBAAiB,CAAC,iBAAiB,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IACjF,CAAC,CAAC,CAAC;AACX,CAAC;AASD,8IAA8I"} \ No newline at end of file +{"version":3,"file":"blazor-javascript-utilities.js","sourceRoot":"","sources":["../ts/blazor-javascript-utilities.ts"],"names":[],"mappings":"AAeA,SAAS,aAAa,CAAC,GAAW,EAAE,IAAY,EAAE,WAA8B,MAAM;IAClF,OAAuB;QACnB,GAAG,EAAE,GAAG;QACR,IAAI,EAAE,IAAI;QACV,QAAQ,EA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AC,QAAQ,EAAE,GAAG,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;SAC/E;QAED,OAAO,MAAM,CAAC;KACjB;IACD,OAAO,CAAC,EAAE;QACN,OAAO,EAAE,CAAC;KACb;AACL,CAAC;AAED,SAAS,eAAe,CAAC,iBAAsB;IAC3C,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAC7B,CAAC,CAAC,EAAE,EAAE;QACF,IAAI,MAAM,GAAoB;YAC1B,GAAG,EAAE,CAAC,CAAC,GAAG;YACV,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,GAAG,EAAE,CAAC,CAAC,GAAG;SACb,CAAA;QACD,iBAAiB,CAAC,iBAAiB,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IACjF,CAAC,CAAC,CAAC;AACX,CAAC;AASD,8IAA8I"} \ No newline at end of file diff --git a/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/scroll-controller.js b/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/scroll-controller.js index e1c9472..645c5c0 100644 --- a/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/scroll-controller.js +++ b/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/scroll-controller.js @@ -1,3 +1,54 @@ +function createOptions(top, left, behavior = 'auto') { + return { + top: top, + left: left, + behavior: behavior + }; +} +function createScrollIntoViewOptions(behavior = 'auto', block = 'start', inline = 'nearest') { + return { + behavior: behavior, + block: block, + inline: inline + }; +} +function getElementByTagName(tagName) { + if (tagName === "body") { + return document.body; + } + else { + const elements = document.getElementsByTagName(tagName); + for (let i = 0; i < elements.length; i++) { + return elements[i]; + } + } + return new HTMLElement(); +} +function getElementByClassName(className) { + const elements = document.getElementsByClassName(className); + for (let i = 0; i < elements.length; i++) { + return elements[i]; + } + return new HTMLElement(); +} +function scrollHeightElement(element) { + return element.scrollHeight; +} +function scrollWidthElement(element) { + return element.scrollTop; +} +function setScrollLeftElement(element, value) { + element.scrollLeft = value; +} +function setScrollTopElement(element, value) { + element.scrollTop = value; +} +function getScrollLeftElement(element) { + return element.scrollLeft; +} +function getScrollTopElement(element) { + return element.scrollTop; +} function hide(element, scrollType) { if (scrollType === 1) { element.classList.add("blazor-javascript-v-no-overflow"); @@ -72,4 +123,281 @@ function hideBodyScrollOverflow(scrollType) { function showBodyScrollOverflow(scrollType) { show(document.body, scrollType); } +function mainScrollTo(top = 0, left = 0, behavior = 'auto') { + try { + const options = createOptions(top, left, behavior); + window.scroll(options); + return true; + } + catch (e) { + return false; + } +} +function scrollVToElementById(elementId, behavior = 'auto', block = 'start') { + try { + let element = document.getElementById(elementId); + const options = createScrollIntoViewOptions(behavior, block, undefined); + element.scrollIntoView(options); + return true; + } + catch (e) { + return false; + } +} +function scrollVToElementByTag(tagName, behavior = 'auto', block = 'start') { + try { + let element = getElementByTagName(tagName); + const options = createScrollIntoViewOptions(behavior, block, undefined); + element.scrollIntoView(options); + return true; + } + catch (e) { + return false; + } +} +function scrollVToElementByClass(className, behavior = 'auto', block = 'start') { + try { + let element = getElementByClassName(className); + const options = createScrollIntoViewOptions(behavior, block, undefined); + element.scrollIntoView(options); + return true; + } + catch (e) { + return false; + } +} +function scrollHToElementById(elementId, behavior = 'auto', inline = 'nearest') { + try { + let element = document.getElementById(elementId); + const options = createScrollIntoViewOptions(behavior, undefined, inline); + element.scrollIntoView(options); + return true; + } + catch (e) { + return false; + } +} +function scrollHToElementByTag(tagName, behavior = 'auto', inline = 'nearest') { + try { + let element = getElementByTagName(tagName); + const options = createScrollIntoViewOptions(behavior, undefined, inline); + element.scrollIntoView(options); + return true; + } + catch (e) { + return false; + } +} +function scrollHToElementByClass(className, behavior = 'auto', inline = 'nearest') { + try { + let element = getElementByClassName(className); + const options = createScrollIntoViewOptions(behavior, undefined, inline); + element.scrollIntoView(options); + return true; + } + catch (e) { + return false; + } +} +function scrollElementToByElementId(elementId, top = 0, left = 0, behavior = 'auto') { + try { + let element = document.getElementById(elementId); + const options = createOptions(top, left, behavior); + element.scroll(options); + return true; + } + catch (e) { + return false; + } +} +function scrollElementToByTagName(tagName, top = 0, left = 0, behavior = 'auto') { + try { + let element = getElementByTagName(tagName); + const options = createOptions(top, left, behavior); + element.scroll(options); + return true; + } + catch (e) { + return false; + } +} +function scrollElementToByClassName(className, top = 0, left = 0, behavior = 'auto') { + try { + let element = getElementByClassName(className); + const options = createOptions(top, left, behavior); + element.scroll(options); + return true; + } + catch (e) { + return false; + } +} +function getScrollHeightByElementId(elementId) { + try { + let element = document.getElementById(elementId); + return scrollHeightElement(element); + } + catch (e) { + return 0; + } +} +function getScrollHeightByTagName(tagName) { + try { + let element = getElementByTagName(tagName); + return scrollHeightElement(element); + } + catch (e) { + return 0; + } +} +function getScrollHeightByClassName(className) { + try { + let element = getElementByClassName(className); + return scrollHeightElement(element); + } + catch (e) { + return 0; + } +} +function getScrollWidthByElementId(elementId) { + try { + let element = document.getElementById(elementId); + return scrollWidthElement(element); + } + catch (e) { + return 0; + } +} +function getScrollWidthByTagName(tagName) { + try { + let element = getElementByTagName(tagName); + return scrollWidthElement(element); + } + catch (e) { + return 0; + } +} +function getScrollWidthByClassName(className) { + try { + let element = getElementByClassName(className); + return scrollWidthElement(element); + } + catch (e) { + return 0; + } +} +function getScrollLeftByElementId(elementId) { + try { + let element = document.getElementById(elementId); + return getScrollLeftElement(element); + } + catch (e) { + return 0; + } +} +function getScrollLeftByTagName(tagName) { + try { + let element = getElementByTagName(tagName); + return getScrollLeftElement(element); + } + catch (e) { + return 0; + } +} +function getScrollLeftByClassName(className) { + try { + let element = getElementByClassName(className); + return getScrollLeftElement(element); + } + catch (e) { + return 0; + } +} +function getScrollTopByElementId(elementId) { + try { + let element = document.getElementById(elementId); + return getScrollTopElement(element); + } + catch (e) { + return 0; + } +} +function getScrollTopByTagName(tagName) { + try { + let element = getElementByTagName(tagName); + return getScrollTopElement(element); + } + catch (e) { + return 0; + } +} +function getScrollTopByClassName(className) { + try { + let element = getElementByClassName(className); + return getScrollTopElement(element); + } + catch (e) { + return 0; + } +} +function setScrollLeftByElementId(elementId, value) { + try { + let element = document.getElementById(elementId); + setScrollLeftElement(element, value); + return true; + } + catch (e) { + return false; + } +} +function setScrollLeftByTagName(tagName, value) { + try { + let element = getElementByTagName(tagName); + setScrollLeftElement(element, value); + return true; + } + catch (e) { + return false; + } +} +function setScrollLeftByClassName(className, value) { + try { + let element = getElementByClassName(className); + setScrollLeftElement(element, value); + return true; + } + catch (e) { + return false; + } +} +function setScrollTopByElementId(elementId, value) { + try { + let element = document.getElementById(elementId); + setScrollTopElement(element, value); + return true; + } + catch (e) { + return false; + } +} +function setScrollTopByTagName(tagName, value) { + try { + let element = getElementByTagName(tagName); + setScrollTopElement(element, value); + return true; + } + catch (e) { + return false; + } +} +function setScrollTopByClassName(className, value) { + try { + let element = getElementByClassName(className); + setScrollTopElement(element, value); + return true; + } + catch (e) { + return false; + } +} //# sourceMappingURL=scroll-controller.js.map \ No newline at end of file diff --git a/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/scroll-controller.js.map b/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/scroll-controller.js.map index 33843a7..4edd446 100644 --- a/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/scroll-controller.js.map +++ b/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/scroll-controller.js.map @@ -1 +1 @@ -{"version":3,"file":"scroll-controller.js","sourceRoot":"","sources":["../ts/scroll-controller.ts"],"names":[],"mappings":"AAEA,SAAS,IAAI,CAAC,OAAoB,EAAE,UAAkB;IAClD,IAAI,UAAU,KAAK,CAAC,EAAE;QAClB,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;KAC5D;SAAM,IAAI,UAAU,KAAK,CAAC,EAAE;QACzB,OAAO,CA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blazor.JavaScriptUtilities/Content/js/storage.js index 57c9a41..b7dfef0 100644 --- a/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/storage.js +++ b/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/storage.js @@ -126,11 +126,12 @@ function storageGetAll(type) { } function storageListener(componentInstance) { window.addEventListener('storage', (e) => { - let result; - result.key = e.key; - result.oldValue = e.oldValue; - result.newValue = e.newValue; - result.url = e.url; + let result = { + key: e.key, + oldValue: e.oldValue, + newValue: e.newValue, + url: e.url + }; componentInstance.invokeMethodAsync('StorageChange', JSON.stringify(result)); }); } diff --git a/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/storage.js.map b/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/storage.js.map index 328f68a..6070ed6 100644 --- a/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/storage.js.map +++ b/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/js/storage.js.map @@ -1 +1 @@ -{"version":3,"file":"storage.js","sourceRoot":"","sources":["../ts/storage.ts"],"names":[],"mappings":"AAEA,SAAS,UAAU,CAAC,IAAY;IAC5B,IAAI;QACA,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,gBAAgB,EAAE;YACzC,OAAO,cAAc,CAAC;SACzB;aAAM,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,cAAc,EAAE;YAC9C,OAAO,YAAY,CAAC;SACvB;aAAM;YACH,OAAO,IAAI,CAAC;SACf;KACJ;IAAC,OAAO,CAAC,EAAE;QACR,OAAO,IAAI,CAAC;KACf;AACL,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY;IAClC,IAAI,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,OAAO,KAAK,IAAI,EAAE;QAClB,OAAO,KAAK,CAAC;KAChB;IACD,IAAI;QACA,MAAM,CAAC,GAAG,kBAAkB,CAAC;QAC7B,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,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,IAAI,OAAO,KAAK,IAAI,EAAE;YAClB,OAAO,EAAE,CAAC;SACb;QAED,IAAI,MAAM,GAAG,IAAI,KAAK,EAAU,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAElC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAClC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;gBACV,SAAS;aACZ;YACD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;SAC/E;QAED,OAAO,MAAM,CAAC;KACjB;IACD,OAAO,CAAC,EAAE;QACN,OAAO,EAAE,CAAC;KACb;AACL,CAAC;AAED,SAAS,eAAe,CAAC,iBAAsB;IAC3C,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAC7B,CAAC,CAAC,EAAE,EAAE;QACF,IAAI,MAAM,GAAoB;YAC1B,GAAG,EAAE,CAAC,CAAC,GAAG;YACV,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,GAAG,EAAE,CAAC,CAAC,GAAG;SACb,CAAA;QACD,iBAAiB,CAAC,iBAAiB,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IACjF,CAAC,CAAC,CAAC;AACX,CAAC"} \ No newline at end of file diff --git a/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/ts/blazor-javascript-utilities.ts b/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/ts/blazor-javascript-utilities.ts index 4db6c33..d6fc892 100644 --- a/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/ts/blazor-javascript-utilities.ts +++ b/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/ts/blazor-javascript-utilities.ts @@ -1,6 +1,83 @@ export { }; /* ==================================================================ScrollController================================================================== */ +interface IScrollOptions { + top: number; + left: number; + behavior: 'auto' | 'smooth'; +} + +interface IScrollIntoViewOptions { + behavior: 'auto' | 'smooth'; + block: 'start' | 'center' | 'end' | 'nearest'; + inline: 'start' | 'center' | 'end' | 'nearest'; +} + +function createOptions(top: number, left: number, behavior: 'auto' | 'smooth' = 'auto') { + return { + top: top, + left: left, + behavior: behavior + }; +} + +function createScrollIntoViewOptions( + behavior: 'auto' | 'smooth' = 'auto', + block: 'start' | 'center' | 'end' | 'nearest' = 'start', + inline: 'start' | 'center' | 'end' | 'nearest' = 'nearest') { + return { + behavior: behavior, + block: block, + inline: inline + }; +} + +function getElementByTagName(tagName: string) { + if (tagName === "body") { + return document.body; + } else { + const elements = document.getElementsByTagName(tagName) as HTMLCollectionOf; + for (let i = 0; i < elements.length; i++) { + return elements[i]; + } + } + + return new HTMLElement(); +} + +function getElementByClassName(className: string) { + const elements = document.getElementsByClassName(className) as HTMLCollectionOf; + for (let i = 0; i < elements.length; i++) { + return elements[i]; + } + + return new HTMLElement(); +} + +function scrollHeightElement(element: HTMLElement): number { + return element.scrollHeight; +} + +function scrollWidthElement(element: HTMLElement): number { + return element.scrollTop; +} + +function setScrollLeftElement(element: HTMLElement, value: number) { + element.scrollLeft = value; +} + +function setScrollTopElement(element: HTMLElement, value: number) { + element.scrollTop = value; +} + +function getScrollLeftElement(element: HTMLElement): number { + return element.scrollLeft; +} + +function getScrollTopElement(element: HTMLElement): number { + return element.scrollTop; +} + function hide(element: HTMLElement, scrollType: number) { if (scrollType === 1) { element.classList.add("blazor-javascript-v-no-overflow"); @@ -75,6 +152,307 @@ function showBodyScrollOverflow(scrollType: number) { show(document.body, scrollType); } +function mainScrollTo(top = 0, left = 0, behavior: 'auto' | 'smooth' = 'auto') { + try { + const options = createOptions(top, left, behavior); + window.scroll(options); + return true; + } catch (e) { + return false; + } +} + +function scrollVToElementById(elementId: string, behavior: 'auto' | 'smooth' = 'auto', block: 'start' | 'center' | 'end' | 'nearest' = 'start') { + try { + let element = document.getElementById(elementId); + const options = createScrollIntoViewOptions(behavior, block, undefined); + element.scrollIntoView(options); + return true; + } catch (e) { + return false; + } +} + +function scrollVToElementByTag(tagName: string, behavior: 'auto' | 'smooth' = 'auto', block: 'start' | 'center' | 'end' | 'nearest' = 'start') { + try { + let element = getElementByTagName(tagName); + const options = createScrollIntoViewOptions(behavior, block, undefined); + element.scrollIntoView(options); + return true; + } catch (e) { + return false; + } +} + +function scrollVToElementByClass(className: string, behavior: 'auto' | 'smooth' = 'auto', block: 'start' | 'center' | 'end' | 'nearest' = 'start') { + try { + let element = getElementByClassName(className); + const options = createScrollIntoViewOptions(behavior, block, undefined); + element.scrollIntoView(options); + return true; + } catch (e) { + return false; + } +} + +function scrollHToElementById(elementId: string, behavior: 'auto' | 'smooth' = 'auto', inline: 'start' | 'center' | 'end' | 'nearest' = 'nearest') { + try { + let element = document.getElementById(elementId); + const options = createScrollIntoViewOptions(behavior, undefined, inline); + element.scrollIntoView(options); + return true; + } catch (e) { + return false; + } +} + +function scrollHToElementByTag(tagName: string, behavior: 'auto' | 'smooth' = 'auto', inline: 'start' | 'center' | 'end' | 'nearest' = 'nearest') { + try { + let element = getElementByTagName(tagName); + const options = createScrollIntoViewOptions(behavior, undefined, inline); + element.scrollIntoView(options); + return true; + } catch (e) { + return false; + } +} + +function scrollHToElementByClass(className: string, behavior: 'auto' | 'smooth' = 'auto', inline: 'start' | 'center' | 'end' | 'nearest' = 'nearest') { + try { + let element = getElementByClassName(className); + const options = createScrollIntoViewOptions(behavior, undefined, inline); + element.scrollIntoView(options); + return true; + } catch (e) { + return false; + } +} + +function scrollElementToByElementId(elementId: string, top = 0, left = 0, behavior: 'auto' | 'smooth' = 'auto') { + try { + let element = document.getElementById(elementId); + const options = createOptions(top, left, behavior); + element.scroll(options); + return true; + } catch (e) { + return false; + } +} + +function scrollElementToByTagName(tagName: string, top = 0, left = 0, behavior: 'auto' | 'smooth' = 'auto') { + try { + let element = getElementByTagName(tagName); + const options = createOptions(top, left, behavior); + element.scroll(options); + return true; + } catch (e) { + return false; + } +} + +function scrollElementToByClassName(className: string, top = 0, left = 0, behavior: 'auto' | 'smooth' = 'auto') { + try { + let element = getElementByClassName(className); + const options = createOptions(top, left, behavior); + element.scroll(options); + return true; + } catch (e) { + return false; + } +} + +function getScrollHeightByElementId(elementId: string): number { + try { + let element = document.getElementById(elementId); + + return scrollHeightElement(element); + } catch (e) { + return 0; + } +} + +function getScrollHeightByTagName(tagName: string): number { + try { + let element = getElementByTagName(tagName); + + return scrollHeightElement(element); + } catch (e) { + return 0; + } +} + +function getScrollHeightByClassName(className: string): number { + try { + let element = getElementByClassName(className); + + return scrollHeightElement(element); + } catch (e) { + return 0; + } +} + +function getScrollWidthByElementId(elementId: string): number { + try { + let element = document.getElementById(elementId); + + return scrollWidthElement(element); + } catch (e) { + return 0; + } +} + +function getScrollWidthByTagName(tagName: string): number { + try { + let element = getElementByTagName(tagName); + + return scrollWidthElement(element); + } catch (e) { + return 0; + } +} + +function getScrollWidthByClassName(className: string): number { + try { + let element = getElementByClassName(className); + + return scrollWidthElement(element); + } catch (e) { + return 0; + } +} + +function getScrollLeftByElementId(elementId: string): number { + try { + let element = document.getElementById(elementId); + + return getScrollLeftElement(element); + } catch (e) { + return 0; + } +} + +function getScrollLeftByTagName(tagName: string): number { + try { + let element = getElementByTagName(tagName); + + return getScrollLeftElement(element); + } catch (e) { + return 0; + } +} + +function getScrollLeftByClassName(className: string): number { + try { + let element = getElementByClassName(className); + + return getScrollLeftElement(element); + } catch (e) { + return 0; + } +} + +function getScrollTopByElementId(elementId: string): number { + try { + let element = document.getElementById(elementId); + + return getScrollTopElement(element); + } catch (e) { + return 0; + } +} + +function getScrollTopByTagName(tagName: string): number { + try { + let element = getElementByTagName(tagName); + + return getScrollTopElement(element); + } catch (e) { + return 0; + } +} + +function getScrollTopByClassName(className: string): number { + try { + let element = getElementByClassName(className); + + return getScrollTopElement(element); + } catch (e) { + return 0; + } +} + +function setScrollLeftByElementId(elementId: string, value: number) { + try { + let element = document.getElementById(elementId); + + setScrollLeftElement(element, value); + + return true; + } catch (e) { + return false; + } +} + +function setScrollLeftByTagName(tagName: string, value: number) { + try { + let element = getElementByTagName(tagName); + + setScrollLeftElement(element, value); + + return true; + } catch (e) { + return false; + } +} + +function setScrollLeftByClassName(className: string, value: number) { + try { + let element = getElementByClassName(className); + + setScrollLeftElement(element, value); + + return true; + } catch (e) { + return false; + } +} + +function setScrollTopByElementId(elementId: string, value: number) { + try { + let element = document.getElementById(elementId); + + setScrollTopElement(element, value); + + return true; + } catch (e) { + return false; + } +} + +function setScrollTopByTagName(tagName: string, value: number) { + try { + let element = getElementByTagName(tagName); + + setScrollTopElement(element, value); + + return true; + } catch (e) { + return false; + } +} + +function setScrollTopByClassName(className: string, value: number) { + try { + let element = getElementByClassName(className); + + setScrollTopElement(element, value); + + return true; + } catch (e) { + return false; + } +} + /* ==================================================================Cookie================================================================== */ function getCookie(cname: string) { @@ -243,11 +621,12 @@ function storageGetAll(type: string) { function storageListener(componentInstance: any) { window.addEventListener('storage', (e) => { - let result: IStorageChanged; - result.key = e.key; - result.oldValue = e.oldValue; - result.newValue = e.newValue; - result.url = e.url; + let result = { + key: e.key, + oldValue: e.oldValue, + newValue: e.newValue, + url: e.url + } componentInstance.invokeMethodAsync('StorageChange', JSON.stringify(result)); }); } diff --git a/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/ts/scroll-controller.ts b/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/ts/scroll-controller.ts index d32f968..fde60bb 100644 --- a/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/ts/scroll-controller.ts +++ b/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/ts/scroll-controller.ts @@ -1,4 +1,80 @@ export { }; +interface IScrollOptions { + top: number; + left: number; + behavior: 'auto' | 'smooth'; +} + +interface IScrollIntoViewOptions { + behavior: 'auto' | 'smooth'; + block: 'start' | 'center' | 'end' | 'nearest'; + inline: 'start' | 'center' | 'end' | 'nearest'; +} + +function createOptions(top: number, left: number, behavior: 'auto' | 'smooth' = 'auto') { + return { + top: top, + left: left, + behavior: behavior + }; +} + +function createScrollIntoViewOptions( + behavior: 'auto' | 'smooth' = 'auto', + block: 'start' | 'center' | 'end' | 'nearest' = 'start', + inline: 'start' | 'center' | 'end' | 'nearest' = 'nearest') { + return { + behavior: behavior, + block: block, + inline: inline + }; +} + +function getElementByTagName(tagName: string) { + if (tagName === "body") { + return document.body; + } else { + const elements = document.getElementsByTagName(tagName) as HTMLCollectionOf; + for (let i = 0; i < elements.length; i++) { + return elements[i]; + } + } + + return new HTMLElement(); +} + +function getElementByClassName(className: string) { + const elements = document.getElementsByClassName(className) as HTMLCollectionOf; + for (let i = 0; i < elements.length; i++) { + return elements[i]; + } + + return new HTMLElement(); +} + +function scrollHeightElement(element: HTMLElement): number { + return element.scrollHeight; +} + +function scrollWidthElement(element: HTMLElement): number { + return element.scrollTop; +} + +function setScrollLeftElement(element: HTMLElement, value: number) { + element.scrollLeft = value; +} + +function setScrollTopElement(element: HTMLElement, value: number) { + element.scrollTop = value; +} + +function getScrollLeftElement(element: HTMLElement): number { + return element.scrollLeft; +} + +function getScrollTopElement(element: HTMLElement): number { + return element.scrollTop; +} function hide(element: HTMLElement, scrollType: number) { if (scrollType === 1) { @@ -55,7 +131,7 @@ function showScrollOverflowByTag(tagName: string, scrollType: number) { } } -function showScrollOverflowByClass(className: string, scrollType: number){ +function showScrollOverflowByClass(className: string, scrollType: number) { if (className === "body") { show(document.body, scrollType); } else { @@ -74,3 +150,303 @@ function showBodyScrollOverflow(scrollType: number) { show(document.body, scrollType); } +function mainScrollTo(top = 0, left = 0, behavior: 'auto' | 'smooth' = 'auto') { + try { + const options = createOptions(top, left, behavior); + window.scroll(options); + return true; + } catch (e) { + return false; + } +} + +function scrollVToElementById(elementId: string, behavior: 'auto' | 'smooth' = 'auto', block: 'start' | 'center' | 'end' | 'nearest' = 'start') { + try { + let element = document.getElementById(elementId); + const options = createScrollIntoViewOptions(behavior, block, undefined); + element.scrollIntoView(options); + return true; + } catch (e) { + return false; + } +} + +function scrollVToElementByTag(tagName: string, behavior: 'auto' | 'smooth' = 'auto', block: 'start' | 'center' | 'end' | 'nearest' = 'start') { + try { + let element = getElementByTagName(tagName); + const options = createScrollIntoViewOptions(behavior, block, undefined); + element.scrollIntoView(options); + return true; + } catch (e) { + return false; + } +} + +function scrollVToElementByClass(className: string, behavior: 'auto' | 'smooth' = 'auto', block: 'start' | 'center' | 'end' | 'nearest' = 'start') { + try { + let element = getElementByClassName(className); + const options = createScrollIntoViewOptions(behavior, block, undefined); + element.scrollIntoView(options); + return true; + } catch (e) { + return false; + } +} + +function scrollHToElementById(elementId: string, behavior: 'auto' | 'smooth' = 'auto', inline: 'start' | 'center' | 'end' | 'nearest' = 'nearest') { + try { + let element = document.getElementById(elementId); + const options = createScrollIntoViewOptions(behavior, undefined, inline); + element.scrollIntoView(options); + return true; + } catch (e) { + return false; + } +} + +function scrollHToElementByTag(tagName: string, behavior: 'auto' | 'smooth' = 'auto', inline: 'start' | 'center' | 'end' | 'nearest' = 'nearest') { + try { + let element = getElementByTagName(tagName); + const options = createScrollIntoViewOptions(behavior, undefined, inline); + element.scrollIntoView(options); + return true; + } catch (e) { + return false; + } +} + +function scrollHToElementByClass(className: string, behavior: 'auto' | 'smooth' = 'auto', inline: 'start' | 'center' | 'end' | 'nearest' = 'nearest') { + try { + let element = getElementByClassName(className); + const options = createScrollIntoViewOptions(behavior, undefined, inline); + element.scrollIntoView(options); + return true; + } catch (e) { + return false; + } +} + +function scrollElementToByElementId(elementId: string, top = 0, left = 0, behavior: 'auto' | 'smooth' = 'auto') { + try { + let element = document.getElementById(elementId); + const options = createOptions(top, left, behavior); + element.scroll(options); + return true; + } catch (e) { + return false; + } +} + +function scrollElementToByTagName(tagName: string, top = 0, left = 0, behavior: 'auto' | 'smooth' = 'auto') { + try { + let element = getElementByTagName(tagName); + const options = createOptions(top, left, behavior); + element.scroll(options); + return true; + } catch (e) { + return false; + } +} + +function scrollElementToByClassName(className: string, top = 0, left = 0, behavior: 'auto' | 'smooth' = 'auto') { + try { + let element = getElementByClassName(className); + const options = createOptions(top, left, behavior); + element.scroll(options); + return true; + } catch (e) { + return false; + } +} + +function getScrollHeightByElementId(elementId: string): number { + try { + let element = document.getElementById(elementId); + + return scrollHeightElement(element); + } catch (e) { + return 0; + } +} + +function getScrollHeightByTagName(tagName: string): number { + try { + let element = getElementByTagName(tagName); + + return scrollHeightElement(element); + } catch (e) { + return 0; + } +} + +function getScrollHeightByClassName(className: string): number { + try { + let element = getElementByClassName(className); + + return scrollHeightElement(element); + } catch (e) { + return 0; + } +} + +function getScrollWidthByElementId(elementId: string): number { + try { + let element = document.getElementById(elementId); + + return scrollWidthElement(element); + } catch (e) { + return 0; + } +} + +function getScrollWidthByTagName(tagName: string): number { + try { + let element = getElementByTagName(tagName); + + return scrollWidthElement(element); + } catch (e) { + return 0; + } +} + +function getScrollWidthByClassName(className: string): number { + try { + let element = getElementByClassName(className); + + return scrollWidthElement(element); + } catch (e) { + return 0; + } +} + +function getScrollLeftByElementId(elementId: string): number { + try { + let element = document.getElementById(elementId); + + return getScrollLeftElement(element); + } catch (e) { + return 0; + } +} + +function getScrollLeftByTagName(tagName: string): number { + try { + let element = getElementByTagName(tagName); + + return getScrollLeftElement(element); + } catch (e) { + return 0; + } +} + +function getScrollLeftByClassName(className: string): number { + try { + let element = getElementByClassName(className); + + return getScrollLeftElement(element); + } catch (e) { + return 0; + } +} + +function getScrollTopByElementId(elementId: string): number { + try { + let element = document.getElementById(elementId); + + return getScrollTopElement(element); + } catch (e) { + return 0; + } +} + +function getScrollTopByTagName(tagName: string): number { + try { + let element = getElementByTagName(tagName); + + return getScrollTopElement(element); + } catch (e) { + return 0; + } +} + +function getScrollTopByClassName(className: string): number { + try { + let element = getElementByClassName(className); + + return getScrollTopElement(element); + } catch (e) { + return 0; + } +} + +function setScrollLeftByElementId(elementId: string, value: number) { + try { + let element = document.getElementById(elementId); + + setScrollLeftElement(element, value); + + return true; + } catch (e) { + return false; + } +} + +function setScrollLeftByTagName(tagName: string, value: number) { + try { + let element = getElementByTagName(tagName); + + setScrollLeftElement(element, value); + + return true; + } catch (e) { + return false; + } +} + +function setScrollLeftByClassName(className: string, value: number) { + try { + let element = getElementByClassName(className); + + setScrollLeftElement(element, value); + + return true; + } catch (e) { + return false; + } +} + +function setScrollTopByElementId(elementId: string, value: number) { + try { + let element = document.getElementById(elementId); + + setScrollTopElement(element, value); + + return true; + } catch (e) { + return false; + } +} + +function setScrollTopByTagName(tagName: string, value: number) { + try { + let element = getElementByTagName(tagName); + + setScrollTopElement(element, value); + + return true; + } catch (e) { + return false; + } +} + +function setScrollTopByClassName(className: string, value: number) { + try { + let element = getElementByClassName(className); + + setScrollTopElement(element, value); + + return true; + } catch (e) { + return false; + } +} \ No newline at end of file diff --git a/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/ts/storage.ts b/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/ts/storage.ts index 4685689..38852a2 100644 --- a/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/ts/storage.ts +++ b/src/ShadyNagy.Blazor.JavaScriptUtilities/Content/ts/storage.ts @@ -144,11 +144,12 @@ function storageGetAll(type: string) { function storageListener(componentInstance: any) { window.addEventListener('storage', (e) => { - let result: IStorageChanged; - result.key = e.key; - result.oldValue = e.oldValue; - result.newValue = e.newValue; - result.url = e.url; + let result = { + key: e.key, + oldValue: e.oldValue, + newValue: e.newValue, + url: e.url + } componentInstance.invokeMethodAsync('StorageChange', JSON.stringify(result)); }); } diff --git a/src/ShadyNagy.Blazor.JavaScriptUtilities/Services/BlazorScrollController/BlazorScrollController.cs b/src/ShadyNagy.Blazor.JavaScriptUtilities/Services/BlazorScrollController/BlazorScrollController.cs index 7b6fdfa..3473d66 100644 --- a/src/ShadyNagy.Blazor.JavaScriptUtilities/Services/BlazorScrollController/BlazorScrollController.cs +++ b/src/ShadyNagy.Blazor.JavaScriptUtilities/Services/BlazorScrollController/BlazorScrollController.cs @@ -4,7 +4,7 @@ namespace ShadyNagy.Blazor.JavaScriptUtilities.Services { - public class BlazorScrollController: IBlazorScrollController, ISyncBlazorScrollController + public class BlazorScrollController : IBlazorScrollController, ISyncBlazorScrollController { private readonly IJSRuntime _jsRuntime; private readonly IJSInProcessRuntime _jsInProcessRuntime; @@ -45,6 +45,105 @@ public async Task ShowBodyScrollOverflowAsync(ScrollType scrollType) await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.ShowScrollOverflowByTag, "body", scrollType); } + public async Task ScrollToAsync(int top, int left, string behavior = "auto") => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.ScrollTo, top, left, behavior); + + public async Task ScrollVToElementByIdAsync(string elementId, string behavior = "auto", string block = "start") => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.ScrollVToElementById, elementId, behavior, block); + + public async Task ScrollVToElementByTagAsync(string tagName, string behavior = "auto", string block = "start") => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.ScrollVToElementByTag, tagName, behavior, block); + + public async Task ScrollVToElementByClassAsync(string className, string behavior = "auto", string block = "start") => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.ScrollVToElementByClass, className, behavior, block); + + public async Task ScrollHToElementByIdAsync(string elementId, string behavior = "auto", string inline = "nearest") => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.ScrollHToElementById, elementId, behavior, inline); + + public async Task ScrollHToElementByTagAsync(string tagName, string behavior = "auto", string inline = "nearest") => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.ScrollHToElementByTag, tagName, behavior, inline); + + public async Task ScrollHToElementByClassAsync(string className, string behavior = "auto", string inline = "nearest") => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.ScrollHToElementByClass, className, behavior, inline); + + + public async Task ScrollToBodyAsync(string behavior = "auto", string block = "start") => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.ScrollVToElementByTag, "body", behavior, block); + + public async Task ScrollToBodyTopAsync(string behavior = "auto") => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.ScrollVToElementByTag, "body", behavior, ScrollBlocks.Start); + + public async Task ScrollToBodyBottomAsync(string behavior = "auto") => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.ScrollVToElementByTag, "body", behavior, ScrollBlocks.End); + + public async Task ScrollElementToByElementIdAsync(string elementId, int top, int left, string behavior = "auto") => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.ScrollElementToByElementId, elementId, top, left, behavior); + + public async Task ScrollElementToByTagNameAsync(string tagName, int top, int left, string behavior = "auto") => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.ScrollElementToByTagName, tagName, top, left, behavior); + + public async Task ScrollElementToByClassNameAsync(string className, int top, int left, string behavior = "auto") => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.ScrollElementToByClassName, className, top, left, behavior); + + public async Task ScrollBodyToAsync(int top, int left, string behavior = "auto") => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.ScrollElementToByTagName, "body", top, left, behavior); + + public async Task GetScrollHeightByElementIdAsync(string elementId) => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.GetScrollHeightByElementId, elementId); + + public async Task GetScrollHeightByTagNameAsync(string tagName) => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.GetScrollHeightByTagName, tagName); + + public async Task GetScrollHeightByClassNameAsync(string className) => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.GetScrollHeightByClassName, className); + + public async Task GetScrollWidthByElementIdAsync(string elementId) => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.GetScrollWidthByElementId, elementId); + + public async Task GetScrollWidthByTagNameAsync(string tagName) => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.GetScrollWidthByTagName, tagName); + + public async Task GetScrollWidthByClassNameAsync(string className) => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.GetScrollWidthByClassName, className); + + public async Task GetScrollLeftByElementIdAsync(string elementId) => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.GetScrollLeftByElementId, elementId); + + public async Task GetScrollLeftByTagNameAsync(string tagName) => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.GetScrollLeftByTagName, tagName); + + public async Task GetScrollLeftByClassNameAsync(string className) => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.GetScrollLeftByClassName, className); + + public async Task GetScrollTopByElementIdAsync(string elementId) => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.GetScrollTopByElementId, elementId); + + public async Task GetScrollTopByTagNameAsync(string tagName) => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.GetScrollTopByTagName, tagName); + + public async Task GetScrollTopByClassNameAsync(string className) => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.GetScrollTopByClassName, className); + + public async Task SetScrollLeftByElementIdAsync(string elementId, int value) => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.SetScrollLeftByElementId, elementId, value); + + public async Task SetScrollLeftByTagNameAsync(string tagName, int value) => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.SetScrollLeftByTagName, tagName, value); + + public async Task SetScrollLeftByClassNameAsync(string className, int value) => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.SetScrollLeftByClassName, className, value); + + public async Task SetScrollTopByElementIdAsync(string elementId, int value) => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.SetScrollTopByElementId, elementId, value); + + public async Task SetScrollTopByTagNameAsync(string tagName, int value) => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.SetScrollTopByTagName, tagName, value); + + public async Task SetScrollTopByClassNameAsync(string className, int value) => + await _jsRuntime.InvokeAsync(JSInteropConstants.ScrollController.SetScrollTopByClassName, className, value); + + + public void HideScrollOverflowByTag(string tagName, ScrollType scrollType) { _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.HideScrollOverflowByTag, tagName, scrollType); @@ -74,5 +173,101 @@ public void ShowBodyScrollOverflow(ScrollType scrollType) { _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.ShowScrollOverflowByTag, "body", scrollType); } + + public bool ScrollTo(int top, int left, string behavior = "auto") => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.ScrollTo, top, left, behavior); + + public bool ScrollVToElementById(string elementId, string behavior = "auto", string block = "start") => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.ScrollVToElementById, elementId, behavior, block); + + public bool ScrollVToElementByTag(string tagName, string behavior = "auto", string block = "start") => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.ScrollVToElementByTag, tagName, behavior, block); + + public bool ScrollVToElementByClass(string className, string behavior = "auto", string block = "start") => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.ScrollVToElementByClass, className, behavior, block); + + public bool ScrollHToElementById(string elementId, string behavior = "auto", string inline = "nearest") => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.ScrollHToElementById, elementId, behavior, inline); + + public bool ScrollHToElementByTag(string tagName, string behavior = "auto", string inline = "nearest") => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.ScrollHToElementByTag, tagName, behavior, inline); + + public bool ScrollHToElementByClass(string className, string behavior = "auto", string inline = "nearest") => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.ScrollHToElementByClass, className, behavior, inline); + + public bool ScrollToBody(string behavior = "auto", string block = "start") => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.ScrollVToElementByTag, "body", behavior, block); + + public bool ScrollToBodyTop(string behavior = "auto") => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.ScrollVToElementByTag, "body", behavior, ScrollBlocks.Start); + + public bool ScrollToBodyBottom(string behavior = "auto") => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.ScrollVToElementByTag, "body", behavior, ScrollBlocks.End); + + public bool ScrollElementToByElementId(string elementId, int top, int left, string behavior = "auto") => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.ScrollElementToByElementId, elementId, top, left, behavior); + + public bool ScrollElementToByTagName(string tagName, int top, int left, string behavior = "auto") => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.ScrollElementToByTagName, tagName, top, left, behavior); + + public bool ScrollElementToByClassName(string className, int top, int left, string behavior = "auto") => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.ScrollElementToByClassName, className, top, left, behavior); + + public bool ScrollBodyTo(int top, int left, string behavior = "auto") => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.ScrollElementToByTagName, "body", top, left, behavior); + + public int GetScrollHeightByElementId(string elementId) => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.GetScrollHeightByElementId, elementId); + + public int GetScrollHeightByTagName(string tagName) => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.GetScrollHeightByTagName, tagName); + + public int GetScrollHeightByClassName(string className) => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.GetScrollHeightByClassName, className); + + public int GetScrollWidthByElementId(string elementId) => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.GetScrollWidthByElementId, elementId); + + public int GetScrollWidthByTagName(string tagName) => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.GetScrollWidthByTagName, tagName); + + public int GetScrollWidthByClassName(string className) => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.GetScrollWidthByClassName, className); + + public int GetScrollLeftByElementId(string elementId) => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.GetScrollLeftByElementId, elementId); + + public int GetScrollLeftByTagName(string tagName) => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.GetScrollLeftByTagName, tagName); + + public int GetScrollLeftByClassName(string className) => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.GetScrollLeftByClassName, className); + + public int GetScrollTopByElementId(string elementId) => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.GetScrollTopByElementId, elementId); + + public int GetScrollTopByTagName(string tagName) => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.GetScrollTopByTagName, tagName); + + public int GetScrollTopByClassName(string className) => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.GetScrollTopByClassName, className); + + public bool SetScrollLeftByElementId(string elementId, int value) => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.SetScrollLeftByElementId, elementId, value); + + public bool SetScrollLeftByTagName(string tagName, int value) => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.SetScrollLeftByTagName, tagName, value); + + public bool SetScrollLeftByClassName(string className, int value) => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.SetScrollLeftByClassName, className, value); + + public bool SetScrollTopByElementId(string elementId, int value) => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.SetScrollTopByElementId, elementId, value); + + public bool SetScrollTopByTagName(string tagName, int value) => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.SetScrollTopByTagName, tagName, value); + + public bool SetScrollTopByClassName(string className, int value) => + _jsInProcessRuntime.Invoke(JSInteropConstants.ScrollController.SetScrollTopByClassName, className, value); } } diff --git a/src/ShadyNagy.Blazor.JavaScriptUtilities/Services/BlazorScrollController/IBlazorScrollController.cs b/src/ShadyNagy.Blazor.JavaScriptUtilities/Services/BlazorScrollController/IBlazorScrollController.cs index 0417b83..59cff3e 100644 --- a/src/ShadyNagy.Blazor.JavaScriptUtilities/Services/BlazorScrollController/IBlazorScrollController.cs +++ b/src/ShadyNagy.Blazor.JavaScriptUtilities/Services/BlazorScrollController/IBlazorScrollController.cs @@ -11,5 +11,45 @@ public interface IBlazorScrollController Task ShowScrollOverflowByClassAsync(string className, ScrollType scrollType); Task HideBodyScrollOverflowAsync(ScrollType scrollType); Task ShowBodyScrollOverflowAsync(ScrollType scrollType); + Task ScrollToAsync(int top, int left, string behavior = "auto"); + + + + Task ScrollVToElementByIdAsync(string elementId, string behavior = "auto", string block = "start"); + Task ScrollVToElementByTagAsync(string tagName, string behavior = "auto", string block = "start"); + Task ScrollVToElementByClassAsync(string className, string behavior = "auto", string block = "start"); + Task ScrollHToElementByIdAsync(string elementId, string behavior = "auto", string inline = "nearest"); + Task ScrollHToElementByTagAsync(string tagName, string behavior = "auto", string inline = "nearest"); + Task ScrollHToElementByClassAsync(string className, string behavior = "auto", string inline = "nearest"); + + Task ScrollToBodyAsync(string behavior = "auto", string block = "start"); + Task ScrollToBodyTopAsync(string behavior = "auto"); + Task ScrollToBodyBottomAsync(string behavior = "auto"); + + + + Task ScrollElementToByElementIdAsync(string elementId, int top, int left, string behavior = "auto"); + Task ScrollElementToByTagNameAsync(string tagName, int top, int left, string behavior = "auto"); + Task ScrollElementToByClassNameAsync(string className, int top, int left, string behavior = "auto"); + Task ScrollBodyToAsync(int top, int left, string behavior = "auto"); + Task GetScrollHeightByElementIdAsync(string elementId); + Task GetScrollHeightByTagNameAsync(string tagName); + Task GetScrollHeightByClassNameAsync(string className); + Task GetScrollWidthByElementIdAsync(string elementId); + Task GetScrollWidthByTagNameAsync(string tagName); + Task GetScrollWidthByClassNameAsync(string className); + Task GetScrollLeftByElementIdAsync(string elementId); + Task GetScrollLeftByTagNameAsync(string tagName); + Task GetScrollLeftByClassNameAsync(string className); + Task GetScrollTopByElementIdAsync(string elementId); + Task GetScrollTopByTagNameAsync(string tagName); + Task GetScrollTopByClassNameAsync(string className); + Task SetScrollLeftByElementIdAsync(string elementId, int value); + Task SetScrollLeftByTagNameAsync(string tagName, int value); + Task SetScrollLeftByClassNameAsync(string className, int value); + Task SetScrollTopByElementIdAsync(string elementId, int value); + Task SetScrollTopByTagNameAsync(string tagName, int value); + Task SetScrollTopByClassNameAsync(string className, int value); + } } diff --git a/src/ShadyNagy.Blazor.JavaScriptUtilities/Services/BlazorScrollController/ISyncBlazorScrollController.cs b/src/ShadyNagy.Blazor.JavaScriptUtilities/Services/BlazorScrollController/ISyncBlazorScrollController.cs index 3c782f6..fbf2c8c 100644 --- a/src/ShadyNagy.Blazor.JavaScriptUtilities/Services/BlazorScrollController/ISyncBlazorScrollController.cs +++ b/src/ShadyNagy.Blazor.JavaScriptUtilities/Services/BlazorScrollController/ISyncBlazorScrollController.cs @@ -2,7 +2,7 @@ namespace ShadyNagy.Blazor.JavaScriptUtilities.Services { - public interface ISyncBlazorScrollController + interface ISyncBlazorScrollController { void HideScrollOverflowByTag(string tagName, ScrollType scrollType); void ShowScrollOverflowByTag(string tagName, ScrollType scrollType); @@ -10,5 +10,37 @@ public interface ISyncBlazorScrollController void ShowScrollOverflowByClass(string className, ScrollType scrollType); void HideBodyScrollOverflow(ScrollType scrollType); void ShowBodyScrollOverflow(ScrollType scrollType); + bool ScrollTo(int top, int left, string behavior = "auto"); + bool ScrollVToElementById(string elementId, string behavior = "auto", string block = "start"); + bool ScrollVToElementByTag(string tagName, string behavior = "auto", string block = "start"); + bool ScrollVToElementByClass(string className, string behavior = "auto", string block = "start"); + bool ScrollHToElementById(string elementId, string behavior = "auto", string inline = "nearest"); + bool ScrollHToElementByTag(string tagName, string behavior = "auto", string inline = "nearest"); + bool ScrollHToElementByClass(string className, string behavior = "auto", string inline = "nearest"); + bool ScrollToBody(string behavior = "auto", string block = "start"); + bool ScrollToBodyTop(string behavior = "auto"); + bool ScrollToBodyBottom(string behavior = "auto"); + bool ScrollElementToByElementId(string elementId, int top, int left, string behavior = "auto"); + bool ScrollElementToByTagName(string tagName, int top, int left, string behavior = "auto"); + bool ScrollElementToByClassName(string className, int top, int left, string behavior = "auto"); + bool ScrollBodyTo(int top, int left, string behavior = "auto"); + int GetScrollHeightByElementId(string elementId); + int GetScrollHeightByTagName(string tagName); + int GetScrollHeightByClassName(string className); + int GetScrollWidthByElementId(string elementId); + int GetScrollWidthByTagName(string tagName); + int GetScrollWidthByClassName(string className); + int GetScrollLeftByElementId(string elementId); + int GetScrollLeftByTagName(string tagName); + int GetScrollLeftByClassName(string className); + int GetScrollTopByElementId(string elementId); + int GetScrollTopByTagName(string tagName); + int GetScrollTopByClassName(string className); + bool SetScrollLeftByElementId(string elementId, int value); + bool SetScrollLeftByTagName(string tagName, int value); + bool SetScrollLeftByClassName(string className, int value); + bool SetScrollTopByElementId(string elementId, int value); + bool SetScrollTopByTagName(string tagName, int value); + bool SetScrollTopByClassName(string className, int value); } } diff --git a/src/ShadyNagy.Blazor.JavaScriptUtilities/Services/BlazorScrollController/ScrollBehaviors.cs b/src/ShadyNagy.Blazor.JavaScriptUtilities/Services/BlazorScrollController/ScrollBehaviors.cs new file mode 100644 index 0000000..1ce869a --- /dev/null +++ b/src/ShadyNagy.Blazor.JavaScriptUtilities/Services/BlazorScrollController/ScrollBehaviors.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ShadyNagy.Blazor.JavaScriptUtilities.Services +{ + public static class ScrollBehaviors + { + public static string Auto = "auto"; + public static string Smooth = "smooth"; + } +} diff --git a/src/ShadyNagy.Blazor.JavaScriptUtilities/Services/BlazorScrollController/ScrollBlocks.cs b/src/ShadyNagy.Blazor.JavaScriptUtilities/Services/BlazorScrollController/ScrollBlocks.cs new file mode 100644 index 0000000..437a681 --- /dev/null +++ b/src/ShadyNagy.Blazor.JavaScriptUtilities/Services/BlazorScrollController/ScrollBlocks.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ShadyNagy.Blazor.JavaScriptUtilities.Services +{ + public static class ScrollBlocks + { + public static string Start = "start"; + public static string Center = "center"; + public static string End = "end"; + public static string Nearest = "nearest"; + } +} diff --git a/src/ShadyNagy.Blazor.JavaScriptUtilities/ShadyNagy.Blazor.JavaScriptUtilities.csproj b/src/ShadyNagy.Blazor.JavaScriptUtilities/ShadyNagy.Blazor.JavaScriptUtilities.csproj index a65f8cd..8a2678b 100644 --- a/src/ShadyNagy.Blazor.JavaScriptUtilities/ShadyNagy.Blazor.JavaScriptUtilities.csproj +++ b/src/ShadyNagy.Blazor.JavaScriptUtilities/ShadyNagy.Blazor.JavaScriptUtilities.csproj @@ -12,8 +12,8 @@ ShadyNagy.com Blazor JavaScript Utilities. Blazor JavaScript Utilities. - 1.0.7 - Session Storage Added. + 1.0.8 + Scroll Move Added. ShadyNagy.Blazor.JavaScriptUtilities strict Copyright 2019 - 2020 (c) Shady Nagy. All rights reserved. @@ -23,7 +23,7 @@ https://github.com/ShadyNagy/Blazor.JavaScriptUtilities git https://github.com/ShadyNagy/Blazor.JavaScriptUtilities - Blazor,JavaScript,Utilities;Razor;Components;ASP.NET Core;CSharp;Web;LocalSotage;Local Storage;local storage;session storage;Sesssion Storage;SessionStorage;Scrollbar;cookie;cookies;Cookie;Cookies + Blazor,JavaScript,Utilities;Razor;Components;ASP.NET Core;CSharp;Web;LocalSotage;Local Storage;local storage;session storage;Sesssion Storage;SessionStorage;Scrollbar;cookie;cookies;Cookie;Cookies;scrollbar;scroll;scroll move;scroll top;scroll bottom icon.png MIT true diff --git a/src/ShadyNagy.Blazor.JavaScriptUtilities/wwwroot/blazor-javascript-utilities.min.js b/src/ShadyNagy.Blazor.JavaScriptUtilities/wwwroot/blazor-javascript-utilities.min.js index 7fd31e0..acb24bd 100644 --- a/src/ShadyNagy.Blazor.JavaScriptUtilities/wwwroot/blazor-javascript-utilities.min.js +++ b/src/ShadyNagy.Blazor.JavaScriptUtilities/wwwroot/blazor-javascript-utilities.min.js @@ -1 +1 @@ -function hide(n,t){t===1?n.classList.add("blazor-javascript-v-no-overflow"):t===2?n.classList.add("blazor-javascript-h-no-overflow"):(n.classList.add("blazor-javascript-v-no-overflow"),n.classList.add("blazor-javascript-h-no-overflow"))}function show(n,t){t===1?n.classList.remove("blazor-javascript-v-no-overflow"):t===2?n.classList.remove("blazor-javascript-h-no-overflow"):(n.classList.remove("blazor-javascript-v-no-overflow"),n.classList.remove("blazor-javascript-h-no-overflow"))}function hideScrollOverflowByTag(n,t){if(n==="body")hide(document.body,t);else{const i=document.getElementsByTagName(n);for(let n=0;n{let i;i.key=t.key;i.oldValue=t.oldValue;i.newValue=t.newValue;i.url=t.url;n.invokeMethodAsync("StorageChange",JSON.stringify(i))})} \ No newline at end of file +function createOptions(n,t,i="auto"){return{top:n,left:t,behavior:i}}function createScrollIntoViewOptions(n="auto",t="start",i="nearest"){return{behavior:n,block:t,inline:i}}function getElementByTagName(n){if(n==="body")return document.body;const t=document.getElementsByTagName(n);for(let n=0;n{let i={key:t.key,oldValue:t.oldValue,newValue:t.newValue,url:t.url};n.invokeMethodAsync("StorageChange",JSON.stringify(i))})} \ No newline at end of file diff --git a/src/ShadyNagy.Blazor.JavaScriptUtilities/wwwroot/scroll-controller.min.js b/src/ShadyNagy.Blazor.JavaScriptUtilities/wwwroot/scroll-controller.min.js index e14c570..aeda548 100644 --- a/src/ShadyNagy.Blazor.JavaScriptUtilities/wwwroot/scroll-controller.min.js +++ b/src/ShadyNagy.Blazor.JavaScriptUtilities/wwwroot/scroll-controller.min.js @@ -1 +1 @@ -function hide(n,t){t===1?n.classList.add("blazor-javascript-v-no-overflow"):t===2?n.classList.add("blazor-javascript-h-no-overflow"):(n.classList.add("blazor-javascript-v-no-overflow"),n.classList.add("blazor-javascript-h-no-overflow"))}function show(n,t){t===1?n.classList.remove("blazor-javascript-v-no-overflow"):t===2?n.classList.remove("blazor-javascript-h-no-overflow"):(n.classList.remove("blazor-javascript-v-no-overflow"),n.classList.remove("blazor-javascript-h-no-overflow"))}function hideScrollOverflowByTag(n,t){if(n==="body")hide(document.body,t);else{const i=document.getElementsByTagName(n);for(let n=0;n{let i;i.key=t.key;i.oldValue=t.oldValue;i.newValue=t.newValue;i.url=t.url;n.invokeMethodAsync("StorageChange",JSON.stringify(i))})} \ No newline at end of file +function getStorage(n){try{return n.toLowerCase()==="sessionstorage"?sessionStorage:n.toLowerCase()==="localstorage"?localStorage:null}catch(t){return null}}function storageAvailable(n){let t=getStorage(n);if(t===null)return!1;try{const n="__storage_test__";return t.setItem(n,n),t.removeItem(n),!0}catch(i){return i instanceof DOMException&&(i.code===22||i.code===1014||i.name==="QuotaExceededError"||i.name==="NS_ERROR_DOM_QUOTA_REACHED")&&t&&t.length!==0}}function storageSet(n,t,i){try{let r=getStorage(n);return r===null?!1:(r.setItem(t,i),!0)}catch(r){return!1}}function storageGet(n,t){try{let i=getStorage(n);return i===null?"":i.getItem(t)}catch(i){return""}}function storageRemove(n,t){try{let i=getStorage(n);return i===null?!1:i.length<=0||i.getItem(t)===undefined?!1:(localStorage.removeItem(t),!0)}catch(i){return!1}}function storageCount(n){try{let t=getStorage(n);return t===null?0:t.length<=0?0:t.length}catch(t){return 0}}function storageClear(n){try{let t=getStorage(n);return t===null?!1:(t.clear(),!0)}catch(t){return!1}}function storageGetAll(n){try{let i=getStorage(n);if(i===null)return[];let r=[];const t=Object.keys(i);for(let n=0;n{let i={key:t.key,oldValue:t.oldValue,newValue:t.newValue,url:t.url};n.invokeMethodAsync("StorageChange",JSON.stringify(i))})} \ No newline at end of file