This repository was archived by the owner on Jul 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +19
-13
lines changed
parsers/handlers/unmarshall Expand file tree Collapse file tree 6 files changed +19
-13
lines changed Original file line number Diff line number Diff line change 11import { ActionType } from "react-table" ;
22import NoteInfo from "services/NoteInfo" ;
3- import { TableDataType } from "cdm/FolderModel" ;
3+ import { TableColumn , TableDataType } from "cdm/FolderModel" ;
44
55export type RowSelectOption = {
66 backgroundColor : string ,
@@ -9,7 +9,7 @@ export type RowSelectOption = {
99export type PopperProps = {
1010 dispatch : ( action : ActionType ) => void ;
1111 row : any ;
12- column : any ;
12+ column : TableColumn ;
1313 columns : any ;
1414 note : NoteInfo ;
1515 state : TableDataType ;
Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ export default function DefaultCell(cellProperties: Cell) {
170170 < PopperSelectPortal
171171 dispatch = { dataDispatch }
172172 row = { cellProperties . row }
173- column = { cellProperties . column }
173+ column = { cellProperties . column as unknown as TableColumn }
174174 columns = { columns }
175175 note = { note }
176176 state = { ( cellProperties as any ) . initialState }
Original file line number Diff line number Diff line change @@ -75,7 +75,6 @@ function columnOptions(
7575) : TableColumn {
7676 LOGGER . debug ( `=> columnOptions. column: ${ JSON . stringify ( column ) } ` ) ;
7777 const options : RowSelectOption [ ] = column . options ?? [ ] ;
78-
7978 if ( Object . values ( DataTypes ) . includes ( column . input ) ) {
8079 LOGGER . debug ( `<= columnOptions` , `return ${ column . input } column` ) ;
8180 return {
Original file line number Diff line number Diff line change @@ -19,9 +19,17 @@ import { DatabaseHeaderProps } from "cdm/FolderModel";
1919import ReactDOM from "react-dom" ;
2020import { c } from "helpers/StylesHelper" ;
2121import { HeaderContext } from "components/contexts/HeaderContext" ;
22+ import { RowSelectOption } from "cdm/RowSelectModel" ;
2223
24+ /**
25+ * Generate column Options with Select type
26+ * @param options
27+ * @param rows
28+ * @param columnId
29+ * @returns
30+ */
2331function setOptionsOfSelectDataType (
24- options : any [ ] ,
32+ options : RowSelectOption [ ] ,
2533 rows : any ,
2634 columnId : string
2735) : any [ ] {
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ const PopperSelectPortal = (popperProps: PopperProps) => {
3939 dispatch ( {
4040 type : ActionTypes . UPDATE_OPTION_CELL ,
4141 file : note . getFile ( ) ,
42- key : ( column as any ) . key ,
42+ key : column . key ,
4343 value : option . label ,
4444 row : row ,
4545 columnId : column . id ,
@@ -53,7 +53,7 @@ const PopperSelectPortal = (popperProps: PopperProps) => {
5353 type : ActionTypes . ADD_OPTION_TO_COLUMN ,
5454 option : e . target . value ,
5555 backgroundColor : randomColor ( ) ,
56- columnId : ( column as any ) . id ,
56+ columnId : column . id ,
5757 } ) ;
5858 }
5959 setShowAdd ( false ) ;
@@ -70,7 +70,7 @@ const PopperSelectPortal = (popperProps: PopperProps) => {
7070 columns : columns ,
7171 option : e . target . value ,
7272 backgroundColor : randomColor ( ) ,
73- columnId : ( column as any ) . id ,
73+ columnId : column . id ,
7474 type : ActionTypes . ADD_OPTION_TO_COLUMN ,
7575 } ) ;
7676 }
@@ -79,8 +79,8 @@ const PopperSelectPortal = (popperProps: PopperProps) => {
7979 }
8080
8181 function getColor ( ) {
82- const match = ( column as any ) . options . find (
83- ( option : { label : any } ) => option . label === contextValue . value
82+ const match = column . options . find (
83+ ( option : { label : string } ) => option . label === contextValue . value
8484 ) ;
8585 return ( match && match . backgroundColor ) || grey ( 200 ) ;
8686 }
Original file line number Diff line number Diff line change 11import { DatabaseColumn } from "cdm/DatabaseModel" ;
22import { DiskHandlerResponse } from "cdm/MashallModel" ;
33import { DataTypes , YAML_INDENT } from "helpers/Constants" ;
4- import { Literal } from "obsidian-dataview/lib/data-model/value" ;
54import { AbstractDiskHandler } from "parsers/handlers/unmarshall/AbstractDiskPropertyHandler" ;
65
76export class UnmarshallColumnsHandler extends AbstractDiskHandler {
@@ -46,8 +45,8 @@ function unmarshallParticularInputInfo(column: DatabaseColumn): string[] {
4645 if ( column . options && Array . isArray ( column . options ) ) {
4746 particularInputString . push ( `${ YAML_INDENT . repeat ( 2 ) } options:` ) ;
4847 column . options . forEach ( option => {
49- particularInputString . push ( `${ YAML_INDENT . repeat ( 3 ) } - {label: ${ option . label } , backgroundColor: ${ option
50- . backgroundColor . toString ( ) } }`) ;
48+ particularInputString . push ( `${ YAML_INDENT . repeat ( 3 ) } - { label: " ${ option . label } " , backgroundColor: " ${ option
49+ . backgroundColor } " }`) ;
5150 } ) ;
5251 }
5352 }
You can’t perform that action at this time.
0 commit comments