@@ -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