Skip to content

Commit

Permalink
Deploying to gh-pages from @ 3ef8d86 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
anmcgrath committed May 27, 2024
1 parent 95c0416 commit b0a8d01
Show file tree
Hide file tree
Showing 44 changed files with 209 additions and 32 deletions.
7 changes: 4 additions & 3 deletions _content/BlazorDatasheet/BlazorDatasheet.bundle.scp.css
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,19 @@
.text-input:focus[b-ogyzqrxhj5] {
outline: none;
}
/* _content/BlazorDatasheet/Render/DefaultComponents/SelectRenderer.razor.rz.scp.css */
.dropper[b-fldepj96gs] {
/* _content/BlazorDatasheet/Render/CaretButton.razor.rz.scp.css */
.dropper[b-n1g2dcs84v] {
background: none;
color:#999999;
margin: 0;
padding: 0 2px 0 2px;
border: none;
}

.dropper:hover[b-fldepj96gs]{
.dropper:hover[b-n1g2dcs84v]{
background: var(--selection-bg-color);
}
/* _content/BlazorDatasheet/Render/DefaultComponents/SelectRenderer.razor.rz.scp.css */
/* _content/BlazorDatasheet/Render/DefaultComponents/TextRenderer.razor.rz.scp.css */
.cell-renderer[b-7xkejoswml]{
overflow:hidden;
Expand Down
173 changes: 173 additions & 0 deletions _content/BlazorDatasheet/js/menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
class MenuService {

constructor() {
this.menus = [];
this.activeMenuEls = []

window.addEventListener('mousedown', this.handleWindowMouseDown.bind(this))
}

handleWindowMouseDown(event) {
let insideMenu = event.target.closest('.sheetMenu') != null
if (insideMenu)
return

this.activeMenuEls.forEach(menuEl => this.closeMenu(menuEl.id))
}

registerMenu(id, parentId) {
this.menus.push({id, parentId});
}

showMenu(menuId, options) {
this.menus.forEach(menu => {
if (menu.id === menuId) {
let el = document.getElementById(menuId);
if (el) {
this.activeMenuEl = el
this.showMenuEl(el, options);
}
}
});
}

closeMenu(menuId, closeParent) {
let el = document.getElementById(menuId)
if (el)
el.hidePopover()

let children = this.getChildren(menuId)
children.forEach(child => this.closeMenu(child.id))

if (closeParent) {
let parent = this.menus.find(menu => menu.id === menuId)
if (parent) {
this.closeMenu(parent.parentId, true)
}
}
}

closeSubMenus(menuId) {
let children = this.getChildren(menuId)
children.forEach(child => this.closeMenu(child.id))
}

getChildren(menuId) {
return this.menus.filter(menu => menu.parentId === menuId)
}

isActive(menuEl) {
return this.activeMenuEls.some(el => el.id === menuEl.id)
}

showMenuEl(menuEl, options) {
if (this.isActive(menuEl))
return

// run with set timeout to allow the updated menu to be structured based on context
setTimeout(() => {
menuEl.showPopover()
let self = this

let onToggle = function (event) {
if (!self.menus.some(menu => menu.id === event.target.id)) // if menu doesn't exist
return
if (event.newState === 'open') {
self.activeMenuEls.push(event.target)
} else {
self.activeMenuEls.splice(self.activeMenuEls.indexOf(event.target), 1)
event.target.removeEventListener('toggle', onToggle)
}
}

menuEl.addEventListener('toggle', onToggle)
if (options.trigger === 'oncontextmenu') {
let rect = new DOMRect(options.args.clientX, options.args.clientY, 1, 1)
this.positionMenu(menuEl, rect, options.margin, options.placement)
} else if (options.targetId) {
let targetEl = document.getElementById(options.targetId)
if (!targetEl)
return
let targetRect = targetEl.getBoundingClientRect()
this.positionMenu(menuEl, targetRect, options.margin, options.placement)
}
}, 1)
}

positionMenu(menuEl, targetRect, margin, placement, flipCount = 0) {
let menuRect = menuEl.getBoundingClientRect()
let x = targetRect.left + targetRect.width / 2 - menuRect.width / 2
let y = targetRect.top + targetRect.height / 2 - menuRect.height / 2

if (placement.includes("bottom"))
y = targetRect.bottom + margin
else if (placement.includes("top"))
y = targetRect.top - menuRect.height - margin

if (placement.includes("right"))
x = targetRect.right + margin
else if (placement.includes("left"))
x = targetRect.left - menuRect.width - margin

if (x < 0)
x = margin
if (y < 0)
y = margin
if (x > window.innerWidth - menuRect.width)
x = window.innerWidth - menuRect.width - margin
if (y > window.innerHeight - menuRect.height)
y = window.innerHeight - menuRect.height - margin

// if the new menu position intersects the target rect, flip the menu
let newTargetRect = {left: x, top: y, width: menuRect.width, height: menuRect.height}
if (this.intersects(targetRect, newTargetRect)) {
// flip x first, then y
if (flipCount === 0) {
this.positionMenu(menuEl, targetRect, margin, this.flipPlacementX(placement), flipCount + 1)
return
} else if (flipCount === 1) {
this.positionMenu(menuEl, targetRect, margin, this.flipPlacement(placement), flipCount + 1)
return
}
}

menuEl.style.top = y + "px"
menuEl.style.left = x + "px"
}

flipPlacementX(placement) {
if (placement.includes("right"))
return placement.replace("right", "left")
if (placement.includes("left"))
return placement.replace("left", "right")
return placement
}

flipPlacement(placement) {
if (placement.includes("top"))
return placement.replace("top", "bottom")
if (placement.includes("bottom"))
return placement.replace("bottom", "top")
if (placement.includes("left"))
return placement.replace("left", "right")
if (placement.includes("right"))
return placement.replace("right", "left")
return placement
}

intersects(rect1, rect2) {
return rect1.left < rect2.left + rect2.width &&
rect1.left + rect1.width > rect2.left &&
rect1.top < rect2.top + rect2.height &&
rect1.top + rect1.height > rect2.top
}

}

let menuService = null

export function getMenuService() {
if (menuService == null)
menuService = new MenuService()
return menuService
}
5 changes: 3 additions & 2 deletions _content/BlazorDatasheet/js/sheet-pointer-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class PointerInputService {
let args = this.getSheetPointerEventArgs(e)
if (!args)
return

this.dotnetHelper.invokeMethodAsync(this.pointerUpCallbackName, args);
}

Expand All @@ -58,7 +58,7 @@ class PointerInputService {
let args = this.getSheetPointerEventArgs(e)
if (!args)
return

if (args.row !== this.currentRow || args.col !== this.currentCol) {
this.onCellEnter(args)
}
Expand Down Expand Up @@ -123,6 +123,7 @@ class PointerInputService {
ctrlKey: e.ctrlKey,
metaKey: e.metaKey,
shiftKey: e.shiftKey,
mouseButton: e.button
};
}

Expand Down
34 changes: 18 additions & 16 deletions _content/BlazorDatasheet/sheet-styles.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
.vars[theme='default'] {
--sheet-foreground-color: #5c5c5c;
.vars {
--sheet-font-weight: normal;
--sheet-font-size: 0.75rem;
--sheet-font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Helvetica Neue, Arial, sans-serif;
}

.vars[theme='default'] {
--sheet-foreground-color: #454545;
--sheet-bg-color: #ffffff;
--sheet-border-style: 1px solid lightgray;
--sheet-border-style: 1px solid #c5c5c5;
--row-header-bg-color: #fafafa;
--col-header-bg-color: #fafafa;
--headers-foreground-color: #000000;
--active-header-bg-color: #ececec;
--sheet-font-weight: normal;
--headers-foreground-color: #5c5a5a;
--active-header-bg-color: #ededed;
--icon-color: #000000;
--shadow-overlay-color: grey;
--invalid-cell-foreground-color: #ff0000;
Expand All @@ -15,6 +20,7 @@
--cell-highlight-bg-color: #a9e5b6;
--num-highlight-color: #43a3b4;
--string-highlight-color: #1a6206;
--sheet-menu-bg-color: #f1f1f1;
}

.vars[theme='dark'] {
Expand All @@ -25,7 +31,6 @@
--col-header-bg-color: #2d2d2d;
--headers-foreground-color: #a4a4a4;
--active-header-bg-color: #343434;
--sheet-font-weight: normal;
--icon-color: #000000;
--shadow-overlay-color: #000000;
--invalid-cell-foreground-color: #d71b1b;
Expand All @@ -34,6 +39,7 @@
--cell-highlight-bg-color: #456b4d;
--num-highlight-color: #d4d6ec;
--string-highlight-color: #79a16a;
--sheet-menu-bg-color: #333;
}

.active-sheet {
Expand All @@ -46,11 +52,14 @@

.sheet {
background: var(--sheet-bg-color);
font-size: .8rem;
font-size: var(--sheet-font-size);
box-sizing: border-box;
position: relative;
display: block;
white-space: nowrap;
font-family: var(--sheet-font-family), serif;
-moz-osx-font-smoothing: grayscale;
font-weight: var(--sheet-font-weight);
}

.sheet-fixed-height {
Expand Down Expand Up @@ -104,7 +113,7 @@
display: inline-block;
width: 100%;
height: 100%;
padding: 2px;
padding: 3px;
overflow: hidden;
box-sizing: border-box;
-moz-box-sizing: border-box;
Expand All @@ -121,9 +130,6 @@

.column-active {
background: var(--active-header-bg-color) !important;
border-bottom-width: 2px;
border-bottom-color: var(--selection-border-color);
border-bottom-style: solid;
}

.row-head {
Expand All @@ -139,10 +145,6 @@

.row-active {
background: var(--active-header-bg-color) !important;
border-right-width: 2px;
padding-right: 4px;
border-right-color: var(--selection-border-color);
border-right-style: solid;
}

.unselectable {
Expand Down
Binary file modified _framework/BlazorDatasheet.Core.pdb.gz
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Core.wasm
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Core.wasm.br
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Core.wasm.gz
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.DataStructures.pdb.gz
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.DataStructures.wasm
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.DataStructures.wasm.br
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.DataStructures.wasm.gz
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Formula.Core.pdb.gz
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Formula.Core.wasm
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Formula.Core.wasm.br
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Formula.Core.wasm.gz
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Formula.Functions.pdb.gz
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Formula.Functions.wasm
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Formula.Functions.wasm.br
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Formula.Functions.wasm.gz
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.SharedPages.pdb.gz
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.SharedPages.wasm
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.SharedPages.wasm.br
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.SharedPages.wasm.gz
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Wasm.pdb.gz
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Wasm.wasm
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Wasm.wasm.br
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.Wasm.wasm.gz
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.pdb.gz
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.wasm
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.wasm.br
Binary file not shown.
Binary file modified _framework/BlazorDatasheet.wasm.gz
Binary file not shown.
Binary file modified _framework/Microsoft.AspNetCore.Components.Web.wasm
Binary file not shown.
Binary file modified _framework/Microsoft.AspNetCore.Components.Web.wasm.br
Binary file not shown.
Binary file modified _framework/Microsoft.AspNetCore.Components.Web.wasm.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified _framework/System.Runtime.wasm
Binary file not shown.
Binary file modified _framework/System.Runtime.wasm.br
Binary file not shown.
Binary file modified _framework/System.Runtime.wasm.gz
Binary file not shown.
22 changes: 11 additions & 11 deletions _framework/blazor.boot.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"mainAssemblyName": "BlazorDatasheet.Wasm",
"resources": {
"hash": "sha256-rzxavEtq8Tr1BjStAJCMmA3B6J2YQjCsE9k0A7S/Ig0=",
"hash": "sha256-sgiJeeDTxqkmipu381LHVr9e8GgRN3mMI83yu7ocbzc=",
"jsModuleNative": {
"dotnet.native.8.0.5.k8qrcc28q0.js": "sha256-boyHe+0RMZDkzBKGhsrnXPhPg3oZ6UqJnTUzngJPjNY="
},
Expand All @@ -17,20 +17,20 @@
"icudt_no_CJK.dat": "sha256-L7sV7NEYP37/Qr2FPCePo5cJqRgTXRwGHuwF5Q+0Nfs="
},
"assembly": {
"BlazorDatasheet.Core.wasm": "sha256-9db/g9s1dzwk066U5eW+b19QCsaD54yKKveQ7AIBcVM=",
"BlazorDatasheet.DataStructures.wasm": "sha256-Cc4hnpPHcMN2ez5YJt636XDYWRHFSvGm/BfONn8MLAY=",
"BlazorDatasheet.Formula.Core.wasm": "sha256-2FkKYdHey05ocKZPsY0CYSguy9vDE2IPX2hb/DCqwdI=",
"BlazorDatasheet.Formula.Functions.wasm": "sha256-7ZpF+DYAaB/Xfy8A0gBAU+N/w3wKQi1caz5+WKdys/o=",
"BlazorDatasheet.SharedPages.wasm": "sha256-g15AtK0ju7UXonu3QDdwKUFaNasrsSSE56q1/ikuvrY=",
"BlazorDatasheet.wasm": "sha256-qSDFZZHY/hrvX0sHTo/IL1FLPs0lmUMnTRxm5PmxJaM=",
"BlazorDatasheet.Wasm.wasm": "sha256-YHt0/1H6YSxedjIa23wLcrvROOFYhGCybNaUw+DjXnE=",
"BlazorDatasheet.Core.wasm": "sha256-f/Ig4OAGL4xwX6kAaDAXdTkCO/LHLYls84Lzwr7Sa6o=",
"BlazorDatasheet.DataStructures.wasm": "sha256-6wxG/v3yEF53NlbgqA5iLYVdy3TnXJ3Uc0AP4xN9s6I=",
"BlazorDatasheet.Formula.Core.wasm": "sha256-eWQwxEju4CJfVkOGRbk9ulddrXJAhfI4cRLQNqfalOc=",
"BlazorDatasheet.Formula.Functions.wasm": "sha256-CYClYV0hObVnscnrgvTNU+9Dwx/qL8aHFPWDE6U7cnY=",
"BlazorDatasheet.SharedPages.wasm": "sha256-ejFAaKNEWTL9+VIuAjTA/PvA+jnbhiPsdeypsj/7Ip0=",
"BlazorDatasheet.wasm": "sha256-tRBbgZFAP5wcefni4aRA46pEAY1SavpECEXQUJJRuu4=",
"BlazorDatasheet.Wasm.wasm": "sha256-MjkyB5Zs3AwbauuNTcG7D0u9uOO0WMGSxiv2f6eyGIE=",
"Microsoft.AspNetCore.Components.wasm": "sha256-Bi3Pw6kLOxE9dWidQgVeWqeRHb+t3tBfL09rsqSgVMw=",
"Microsoft.AspNetCore.Components.Web.wasm": "sha256-onv3iSmRQynb8JqGS01UMpK5Z8PhxY/oPM1OKwlEyQQ=",
"Microsoft.AspNetCore.Components.Web.wasm": "sha256-iH252MO3nQAr9K7QhAMcQoTS1neY2iDxHciAQvv/DXo=",
"Microsoft.AspNetCore.Components.WebAssembly.wasm": "sha256-vOYUxJenhpqw4oK5b61FP/mlyRZu3zgVemvtISW29fs=",
"Microsoft.Extensions.Configuration.Abstractions.wasm": "sha256-87sn2TYqgdZ95sXmavjKEzoEfMgHnYQ9LOvnMX+aZcI=",
"Microsoft.Extensions.Configuration.Json.wasm": "sha256-Sxmy2ZS134URxbHEvdbS6NcQ3zXS7UWx/5ZPpwiW7FA=",
"Microsoft.Extensions.Configuration.wasm": "sha256-jYqHUZ07UYWc8POk7xhas6xQYH7t1qoTcylqoDqncJk=",
"Microsoft.Extensions.DependencyInjection.Abstractions.wasm": "sha256-5Y+6osFnqQiML0GdBR9sTo/Mnl6XLJApJ5Fmq/9q+2I=",
"Microsoft.Extensions.DependencyInjection.Abstractions.wasm": "sha256-bhvezKUkqgL/nna5MW3EiQsK3vzIPHUSGhcLx5RxTbA=",
"Microsoft.Extensions.DependencyInjection.wasm": "sha256-gg8xZqJsBBrrNEyUGzYqhL3sqkuZ4AHAvdTdL9nZ0S0=",
"Microsoft.Extensions.Logging.Abstractions.wasm": "sha256-x/ani8NQOjvLtAq+Vig4UTcaBRMf6VOL+v+VfwaG3mA=",
"Microsoft.Extensions.Logging.wasm": "sha256-8BH+kQfjYuZWxprOICXJ4+tU0OdJOYDKN7G0S3zYYHI=",
Expand All @@ -56,7 +56,7 @@
"System.Private.CoreLib.wasm": "sha256-xm8j+QzOvnpt2+P+WgMKdGB+cJiNOEtDqVu1KK/8M2M=",
"System.Private.Uri.wasm": "sha256-BzXC/OIDlX/a8+RXKcwWs6g84xZCXzBccGC9lYdCnn4=",
"System.Runtime.InteropServices.JavaScript.wasm": "sha256-RvSQhLKJujLuqBo74rRl9EPQoT0pjZd0C+p6/QODOF8=",
"System.Runtime.wasm": "sha256-W0ulg+Smd78o+s9xPnodd1lctiQsGlhodXhoSWN3Ne0=",
"System.Runtime.wasm": "sha256-ZwGF2PAhr2nzjBWqacZMXrKypsZSeeVwfSEmo/XR55k=",
"System.Text.Encodings.Web.wasm": "sha256-FcdXnswiO5ciSFlTqeZtH/LHOzBYGhHUHpA6GJMdeXs=",
"System.Text.Json.wasm": "sha256-T8G9sW6W3fAgmb9qw2EzlQkSWOtrDw65/oMSSXYbMsE=",
"System.Text.RegularExpressions.wasm": "sha256-o6Ef/uOI9sFxJXKnXQbJnRMbcIIJ/ZFdc4fFqA9wu7Y=",
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 b0a8d01

Please sign in to comment.