Skip to content
This repository was archived by the owner on Mar 9, 2025. It is now read-only.

Commit c816aa7

Browse files
authored
Merge pull request #904 from trey-wallis/dev
8.15.8
2 parents 623bcb4 + caac2a0 commit c816aa7

File tree

5 files changed

+89
-49
lines changed

5 files changed

+89
-49
lines changed

manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
"fundingUrl": {
1010
"Buymeacoffee": "https://www.buymeacoffee.com/treywallis"
1111
},
12-
"version": "8.15.7"
12+
"version": "8.15.8"
1313
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "obsidian-dataloom",
3-
"version": "8.15.7",
3+
"version": "8.15.8",
44
"description": "Weave together data from diverse sources into different views. Inspired by Excel Spreadsheets and Notion.so.",
55
"main": "main.js",
66
"scripts": {

src/react/import-app/match-columns/match-column-menu.tsx

+25-17
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ColumnMatch } from "../types";
55
import { getIconIdForCellType } from "src/react/shared/icon/utils";
66
import Divider from "src/react/shared/divider";
77
import { NEW_COLUMN_ID } from "../constants";
8-
import { Column } from "src/shared/loom-state/types/loom-state";
8+
import { CellType, Column } from "src/shared/loom-state/types/loom-state";
99

1010
interface Props {
1111
id: string;
@@ -33,23 +33,31 @@ export default function MatchColumnMenu({
3333
position={position}
3434
openDirection="bottom-left"
3535
>
36-
{columns.map((column) => {
37-
const { id, content, type } = column;
38-
const isDisabled = columnMatches.some(
39-
(match) => match.columnId === id
40-
);
36+
{columns
37+
.filter(
38+
(column) =>
39+
column.type !== CellType.SOURCE &&
40+
column.type !== CellType.SOURCE_FILE &&
41+
column.type !== CellType.LAST_EDITED_TIME &&
42+
column.type !== CellType.CREATION_TIME
43+
)
44+
.map((column) => {
45+
const { id, content, type } = column;
46+
const isDisabled = columnMatches.some(
47+
(match) => match.columnId === id
48+
);
4149

42-
return (
43-
<MenuItem
44-
key={id}
45-
name={content}
46-
isDisabled={isDisabled}
47-
lucideId={getIconIdForCellType(type)}
48-
onClick={() => onColumnClick(id)}
49-
isSelected={id === selectedColumnId}
50-
/>
51-
);
52-
})}
50+
return (
51+
<MenuItem
52+
key={id}
53+
name={content}
54+
isDisabled={isDisabled}
55+
lucideId={getIconIdForCellType(type)}
56+
onClick={() => onColumnClick(id)}
57+
isSelected={id === selectedColumnId}
58+
/>
59+
);
60+
})}
5361
<Divider />
5462
<MenuItem
5563
name="Match as new"

src/react/import-app/state-utils.ts

+60-29
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ import {
66
createDateCell,
77
createMultiTagCell,
88
createTagCell,
9+
createCheckboxCell,
10+
createLastEditedTimeCell,
11+
createCreationTimeCell,
12+
createSourceCell,
13+
createSourceFileCell,
14+
createFileCell,
15+
createEmbedCell,
16+
createNumberCell,
917
} from "src/shared/loom-state/loom-state-factory";
1018
import {
1119
Cell,
@@ -83,39 +91,62 @@ export const addImportData = (
8391
if (match) {
8492
const { importColumnIndex } = match;
8593
content = importRow[importColumnIndex].trim();
86-
87-
//TODO THIS BUILD: handle all cell types
88-
89-
if (type === CellType.TAG) {
90-
const { cell, newTags } = findTagCell(
91-
columnTags,
92-
columnId,
93-
content
94-
);
95-
newCell = cell;
96-
columnTags.push(...newTags);
97-
} else if (type === CellType.MULTI_TAG) {
98-
const { cell, newTags } = findMultiTagCell(
99-
columnTags,
100-
columnId,
101-
content
102-
);
103-
newCell = cell;
104-
columnTags.push(...newTags);
105-
} else if (type === CellType.DATE) {
106-
const cell = findDateCell(
107-
columnId,
108-
content,
109-
dateFormat,
110-
dateFormatSeparator
111-
);
112-
newCell = cell;
113-
}
11494
}
115-
if (!newCell) {
95+
96+
if (type === CellType.TAG) {
97+
const { cell, newTags } = findTagCell(
98+
columnTags,
99+
columnId,
100+
content
101+
);
102+
newCell = cell;
103+
columnTags.push(...newTags);
104+
} else if (type === CellType.MULTI_TAG) {
105+
const { cell, newTags } = findMultiTagCell(
106+
columnTags,
107+
columnId,
108+
content
109+
);
110+
newCell = cell;
111+
columnTags.push(...newTags);
112+
} else if (type === CellType.DATE) {
113+
const cell = findDateCell(
114+
columnId,
115+
content,
116+
dateFormat,
117+
dateFormatSeparator
118+
);
119+
newCell = cell;
120+
} else if (type === CellType.CHECKBOX) {
121+
newCell = createCheckboxCell(columnId, {
122+
value: content.toLowerCase() === "true" ? true : false,
123+
});
124+
} else if (type === CellType.NUMBER) {
125+
newCell = createNumberCell(columnId, {
126+
value: parseFloat(content),
127+
});
128+
} else if (type === CellType.EMBED) {
129+
newCell = createEmbedCell(columnId, {
130+
pathOrUrl: content,
131+
});
132+
} else if (type === CellType.FILE) {
133+
newCell = createFileCell(columnId, {
134+
path: content,
135+
});
136+
} else if (type === CellType.CREATION_TIME) {
137+
newCell = createCreationTimeCell(columnId);
138+
} else if (type === CellType.LAST_EDITED_TIME) {
139+
newCell = createLastEditedTimeCell(columnId);
140+
} else if (type === CellType.SOURCE) {
141+
newCell = createSourceCell(columnId);
142+
} else if (type === CellType.SOURCE_FILE) {
143+
newCell = createSourceFileCell(columnId);
144+
} else if (type === CellType.TEXT) {
116145
newCell = createTextCell(columnId, {
117146
content,
118147
});
148+
} else {
149+
throw new Error("Unhandled cell type");
119150
}
120151
nextCells.push(newCell);
121152
});

versions.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -156,5 +156,6 @@
156156
"8.15.4": "1.4.0",
157157
"8.15.5": "1.4.0",
158158
"8.15.6": "1.4.0",
159-
"8.15.7": "1.4.0"
159+
"8.15.7": "1.4.0",
160+
"8.15.8": "1.4.0"
160161
}

0 commit comments

Comments
 (0)