Skip to content

Commit

Permalink
Deploying to gh-pages from @ 5f1d3d4 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
anmcgrath committed May 18, 2024
1 parent b9420c5 commit 506ef3d
Show file tree
Hide file tree
Showing 20 changed files with 40 additions and 22 deletions.
54 changes: 36 additions & 18 deletions _content/BlazorDatasheet/js/virtualize.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,26 @@
return this.findScrollableAncestor(parent)
}

getScrollOffsetSizes(el, parent) {
getViewportInfo(wholeSheetEl) {
let parent = this.findScrollableAncestor(wholeSheetEl) || document.documentElement
// how much of the element has disappeared above the parent's scroll area?
// if the parent is an element, it is equal to scroll height
// otherwise if the parent is the document, it is equal to the top of the document - top of element.
let docRect = document.documentElement.getBoundingClientRect()
let elRect = el.getBoundingClientRect()
let wholeSheetRect = wholeSheetEl.getBoundingClientRect()

let scrollTop = parent === document ? Math.max(0, -elRect.top) : parent.scrollTop
let scrollLeft = parent === document ? Math.max(0, -elRect.left) : parent.scrollLeft
let scrollTop = parent === document.documentElement ? Math.max(0, -wholeSheetRect.top) : parent.scrollTop
let scrollLeft = parent === document.documentElement ? Math.max(0, -wholeSheetRect.left) : parent.scrollLeft

// if the parent is the document, the client height is the visible height of the element in the window
// otherwise it is the height of the parent
let clientHeight = parent === document ? window.innerHeight : parent.clientHeight
let clientWidth = parent === document ? window.innerWidth : parent.clientWidth
let clientHeight = parent === document.documentElement ? window.innerHeight : parent.clientHeight
let clientWidth = parent === document.documentElement ? window.innerWidth : parent.clientWidth

// scroll height/width is always the height/width of the element
let scrollHeight = elRect.height
let scrollWidth = elRect.width

let scrollHeight = wholeSheetRect.height
let scrollWidth = wholeSheetRect.width
return {
scrollWidth: scrollWidth,
scrollHeight: scrollHeight,
scrollLeft: scrollLeft,
scrollTop: scrollTop,
containerWidth: clientWidth,
Expand All @@ -63,8 +61,9 @@
topHandlerMutMap = {}
bottomHandlerMutMap = {}
interactionMap = {}
resizeMap = {}

addVirtualisationHandlers(dotNetHelper, el, dotnetHandlerName, fillerLeft, fillerTop, fillerRight, fillerBottom) {
addVirtualisationHandlers(dotNetHelper, el, dotnetScrollHandlerName, fillerLeft, fillerTop, fillerRight, fillerBottom) {

// return initial scroll event to render the sheet
let parent = this.findScrollableAncestor(el)
Expand All @@ -75,8 +74,10 @@
// fixes scroll jankiness with chrome and firefox.
(parent ?? document.documentElement).style.overflowAnchor = 'none'

let offset = this.getScrollOffsetSizes(el, parent || document.documentElement)
dotNetHelper.invokeMethodAsync(dotnetHandlerName, offset);
let getViewPort = this.getViewportInfo.bind(this)

let offset = getViewPort(el)
dotNetHelper.invokeMethodAsync(dotnetScrollHandlerName, offset);

let self = this
let observer = new IntersectionObserver((entries, observer) => {
Expand All @@ -87,8 +88,8 @@
entries[i].target.getBoundingClientRect().height <= 0)
continue

let offset = self.getScrollOffsetSizes(el, parent || document.documentElement)
dotNetHelper.invokeMethodAsync(dotnetHandlerName, offset);
let offset = getViewPort(el)
dotNetHelper.invokeMethodAsync(dotnetScrollHandlerName, offset);
}

}, {root: parent, threshold: 0})
Expand All @@ -107,6 +108,21 @@

}

/***
* @param {DOMRect} rect1
* @param {DOMRect} rect2
* @returns {DOMRect}
*/
rectIntersection(rect1, rect2) {
let left = Math.max(rect1.left, rect2.left)
let right = Math.min(rect1.right, rect2.right)
if (right <= left)
return null
let top = Math.max(rect1.top, rect2.top)
let bottom = Math.min(rect1.bottom, rect2.bottom)
return new DOMRect(left, top, right - left, bottom - top)
}

dotNetHelperMap = {}

createMutationObserver(filler, interactionObserver) {
Expand All @@ -126,6 +142,8 @@
sheetMousePositionListeners = {}
}

export function getVirtualizer() {
export function

getVirtualizer() {
return new Virtualizer()
}
Binary file modified _framework/BlazorDatasheet.Core.dll
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Core.dll.br
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Core.dll.gz
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Core.pdb.gz
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.SharedPages.dll
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.SharedPages.dll.br
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.SharedPages.dll.gz
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.SharedPages.pdb.gz
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Wasm.dll
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Wasm.dll.br
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Wasm.dll.gz
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Wasm.pdb.gz
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.dll
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.dll.br
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.dll.gz
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.pdb.gz
Binary file not shown.
8 changes: 4 additions & 4 deletions _framework/blazor.boot.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"linkerEnabled": true,
"resources": {
"assembly": {
"BlazorDatasheet.Core.dll": "sha256-\/5U8qXFuSI\/Cc+DGm\/isTBUDwZM3xy6WmVeqc8iBuyk=",
"BlazorDatasheet.Core.dll": "sha256-WTfuQfPZHMTweShk11erCv9stwDHMjoE9lmL2ieLsZs=",
"BlazorDatasheet.DataStructures.dll": "sha256-aKLSlv7DvEQDBkcV7TcmGFrwwEcAMPms2pA5PF\/r7Rk=",
"BlazorDatasheet.dll": "sha256-PhO5raMEkmON53wsf49gue8Rs9JqYixwvLMuamfX6AU=",
"BlazorDatasheet.dll": "sha256-W7nsuL47wI\/LwE+ylFJg+kep4gSFXZWP4ulzC\/pvOyQ=",
"BlazorDatasheet.Formula.Core.dll": "sha256-rYKka0vP5oZ2KTjoZWg2HQIfzeJdALWwXmu3DBhMH\/0=",
"BlazorDatasheet.Formula.Functions.dll": "sha256-aD+pC7Ezjl+YHVOjfAi9HWRwcre9T3KWzbcfyhzAzdM=",
"BlazorDatasheet.SharedPages.dll": "sha256-tty1oCFL59pXPdm7iOdIF1twbSItBhpi10tXOhH4tMo=",
"BlazorDatasheet.Wasm.dll": "sha256-nAKeInC+DPQdiR+fQtaFmXD0mWw3vwtN0GvdGCWrLKc=",
"BlazorDatasheet.SharedPages.dll": "sha256-N97c7RQZybmqQWs2sAFyC5vIzgKy83xhDkWso2ggx9s=",
"BlazorDatasheet.Wasm.dll": "sha256-\/x3PlF1V3HBgMowyPQcHBvYCinq1WWIWJEf7gou9N\/A=",
"Microsoft.AspNetCore.Components.dll": "sha256-+peX2RctMJpqQXEV1Te4dQTl\/QNSGGVnwIhM+G8pnb4=",
"Microsoft.AspNetCore.Components.Web.dll": "sha256-PoKRSE1ZX7+3VgiWs0rqLEmV1Gu4n4iySlTfug6agsE=",
"Microsoft.AspNetCore.Components.WebAssembly.dll": "sha256-VfuhQtMrvCmEflZYOOSPlstWKSnWBKH\/9leuaVp3ChE=",
Expand Down
Binary file modified _framework/blazor.boot.json.br
Binary file not shown.
Binary file modified _framework/blazor.boot.json.gz
Binary file not shown.

0 comments on commit 506ef3d

Please sign in to comment.