Skip to content

Commit

Permalink
Merge pull request #859 from trey-wallis/dev
Browse files Browse the repository at this point in the history
8.12.2
  • Loading branch information
decaf-dev authored Nov 15, 2023
2 parents 7cdc42a + 2190698 commit 8f4ccd7
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 25 deletions.
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"id": "notion-like-tables",
"name": "DataLoom",
"minAppVersion": "1.2.0",
"minAppVersion": "1.4.0",
"description": "Weave together data from diverse sources into a cohesive table view. Inspired by Excel Spreadsheets and Notion.so.",
"author": "Trey Wallis",
"authorUrl": "https://github.com/trey-wallis",
"isDesktopOnly": false,
"fundingUrl": {
"Buymeacoffee": "https://www.buymeacoffee.com/treywallis"
},
"version": "8.12.1"
"version": "8.12.2"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-dataloom",
"version": "8.12.1",
"version": "8.12.2",
"description": "Weave together data from diverse sources into a cohesive table view. Inspired by Excel Spreadsheets and Notion.so.",
"main": "main.js",
"scripts": {
Expand Down
42 changes: 23 additions & 19 deletions src/react/loom-app/body-cell-container/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ export default function BodyCellContainer({
columnType === CellType.TAG ||
columnType === CellType.MULTI_TAG ||
columnType === CellType.DATE;
const isDisabled = source !== null && frontmatterKey === null;
const isUneditable =
columnType === CellType.CHECKBOX ||
columnType === CellType.CREATION_TIME ||
columnType === CellType.LAST_EDITED_TIME ||
columnType === CellType.SOURCE ||
columnType === CellType.SOURCE_FILE;

const COMPONENT_ID = `body-cell-${cellId}`;
const menu = useMenu(COMPONENT_ID);
Expand Down Expand Up @@ -180,13 +187,13 @@ export default function BodyCellContainer({
}

function handleMenuTriggerEnterDown() {
if (isDisabled) return;
if (columnType === CellType.CHECKBOX) toggleCheckbox();
}

function handleMenuTriggerClick() {
if (columnType === CellType.CHECKBOX) {
toggleCheckbox();
}
if (isDisabled) return;
if (columnType === CellType.CHECKBOX) toggleCheckbox();
}

function handleExternalLinkToggle(value: boolean) {
Expand Down Expand Up @@ -300,35 +307,32 @@ export default function BodyCellContainer({
const overflowClass = useOverflow(shouldWrapOverflow, {
ellipsis: columnType === CellType.DATE,
});

className += " " + overflowClass;

if (
columnType === CellType.LAST_EDITED_TIME ||
columnType === CellType.CREATION_TIME ||
columnType === CellType.SOURCE ||
columnType === CellType.SOURCE_FILE ||
(source && frontmatterKey === null)
) {
className += " dataloom-cell--body__container--default-cursor";
if (isUneditable) {
className += " dataloom-cell--uneditable";
} else if (isDisabled) {
className += " dataloom-cell--disabled";
}

const cellTags = columnTags.filter((tag) => cellTagIds.includes(tag.id));

let shouldRunTrigger = true;
if (
columnType === CellType.CHECKBOX ||
columnType === CellType.CREATION_TIME ||
columnType === CellType.LAST_EDITED_TIME ||
columnType === CellType.SOURCE ||
columnType === CellType.SOURCE_FILE ||
(source && frontmatterKey === null)
) {
if (isUneditable || isDisabled) {
shouldRunTrigger = false;
}

let ariaLabel = "";
if (isDisabled) {
ariaLabel =
"This cell is disabled until you choose a frontmatter key for this column";
}

return (
<>
<MenuTrigger
ariaLabel={ariaLabel}
ref={menu.triggerRef}
variant="cell"
menuId={menu.id}
Expand Down
9 changes: 7 additions & 2 deletions src/react/loom-app/body-cell-container/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
color: var(--text-normal); /* Stop dimming of text when mouse leaves embedded loom */
}

.dataloom-cell--body__container--default-cursor {
cursor: default;
.dataloom-cell--uneditable {
cursor: default;
}

.dataloom-cell--disabled {
cursor: default;
background-color: var(--background-secondary);
}
3 changes: 3 additions & 0 deletions src/react/shared/menu-trigger/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { useMenuOperations } from "../menu-provider/hooks";
import { LoomMenuLevel } from "../menu-provider/types";

interface Props {
ariaLabel?: string;
menuId: string;
level: LoomMenuLevel;
shouldRunTrigger?: boolean;
Expand All @@ -27,6 +28,7 @@ interface Props {
const MenuTrigger = React.forwardRef<HTMLDivElement, Props>(
(
{
ariaLabel,
menuId,
level,
variant,
Expand Down Expand Up @@ -109,6 +111,7 @@ const MenuTrigger = React.forwardRef<HTMLDivElement, Props>(
}
return (
<div
aria-label={ariaLabel}
data-menu-id={menuId}
tabIndex={0}
className={className}
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,6 @@
"8.11.2": "1.2.0",
"8.11.3": "1.2.0",
"8.12.0": "1.2.0",
"8.12.1": "1.2.0"
"8.12.1": "1.2.0",
"8.12.2": "1.4.0"
}

0 comments on commit 8f4ccd7

Please sign in to comment.