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

Commit afd5abd

Browse files
committed
Merge branch 'master' into 688-bug-pagination-buttons-are-inaccessible-in-mobile
2 parents a14a9ef + 56dbe87 commit afd5abd

File tree

3 files changed

+26
-19
lines changed

3 files changed

+26
-19
lines changed

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"luxon": "3.2.1",
6262
"monkey-around": "2.3.0",
6363
"obsidian-dataview": "0.5.52",
64-
"obsidian-projects-types": "0.6.0",
64+
"obsidian-projects-types": "0.7.1",
6565
"react": "18.2.0",
6666
"react-csv": "2.2.2",
6767
"react-datepicker": "4.8.0",

src/api/obsidian-projects-api.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ class ProjectAPI extends ProjectView {
5252
if (currentColumnsLength < actualFields.length) {
5353
const newColumns: Record<string, DatabaseColumn> = {};
5454
actualFields.forEach((field, index) => {
55-
const { name, type } = field;
55+
const { name, type, repeated } = field;
5656
/**
5757
* I can not use the view object here without make it a class variable
5858
* and I don't want to do that because I can not support multiple views
5959
*
6060
* Could we add the config to the data object? I can manage a map of views with that
6161
*/
62-
const inputType = this.projectsTypeToPluginTypeMapper(type);
62+
const inputType = this.projectsTypeToPluginTypeMapper(type, repeated);
6363
const key = dbTrim(name);
6464
const newColumn: DatabaseColumn = {
6565
input: inputType,
@@ -90,7 +90,9 @@ class ProjectAPI extends ProjectView {
9090
// `saveConfig` Callback to save configuration changes.
9191
async onOpen(projectView: ProjectViewProps) {
9292
const { contentEl, config, saveConfig, project, viewId } = projectView;
93-
const { path } = project;
93+
94+
const path = project.dataSource.kind === "folder" ? project.dataSource.config.path : ""
95+
9496
const filePath = config.filepath;
9597
if (!filePath) {
9698
const folder = resolve_tfolder(path);
@@ -129,19 +131,21 @@ class ProjectAPI extends ProjectView {
129131
const localSettings: LocalSettings = {
130132
...this.plugin.settings.local_settings,
131133
}
132-
if (project.dataview) {
133-
localSettings.source_destination_path = project.path;
134+
135+
if (project.dataSource.kind === "dataview") {
136+
localSettings.source_destination_path = "";
134137
localSettings.source_data = SourceDataTypes.QUERY;
135138
/*
136139
* Check if the query contains FROM or from
137140
* then Split query to only get subtring from "from" to the end
138141
*/
142+
const dataviewQuery = project.dataSource.config.query
139143
let query = "";
140144
const SOURCE_FLAG = "FROM";
141-
if (project.query?.contains(SOURCE_FLAG)) {
142-
query = project.query?.split(SOURCE_FLAG)[1];
143-
} else if (project.query?.contains(SOURCE_FLAG.toLowerCase())) {
144-
query = project.query?.split(SOURCE_FLAG.toLowerCase())[1];
145+
if (dataviewQuery.contains(SOURCE_FLAG)) {
146+
query = dataviewQuery.split(SOURCE_FLAG)[1];
147+
} else if (dataviewQuery.contains(SOURCE_FLAG.toLowerCase())) {
148+
query = dataviewQuery.split(SOURCE_FLAG.toLowerCase())[1];
145149
} else {
146150
// Handle error with default configuation
147151
localSettings.source_data = SourceDataTypes.CURRENT_FOLDER;
@@ -158,14 +162,17 @@ class ProjectAPI extends ProjectView {
158162
* @param type
159163
* @returns
160164
*/
161-
private projectsTypeToPluginTypeMapper(type: string): string {
165+
private projectsTypeToPluginTypeMapper(type: string, repeated: boolean): string {
166+
if (repeated) {
167+
return InputType.TAGS
168+
}
169+
162170
let inputType = "";
163171
const mapper = new Map<string, string>(
164172
[
165173
[DataFieldType.Number, InputType.NUMBER],
166174
[DataFieldType.Boolean, InputType.CHECKBOX],
167175
[DataFieldType.Date, InputType.CALENDAR],
168-
[DataFieldType.List, InputType.TAGS],
169176
]
170177
);
171178
if (mapper.has(type)) {

0 commit comments

Comments
 (0)