@@ -2,36 +2,79 @@ import { TableColumn } from "cdm/FolderModel";
22import { DatabaseView } from "DatabaseView" ;
33import { Modal } from "obsidian" ;
44import { add_setting_header } from "settings/SettingsComponents" ;
5- import { ColumnHandler , ColumnHandlerResponse } from "components/modals/handlers/AbstractColumnHandler" ;
5+ import { ColumnHandler } from "components/modals/handlers/AbstractColumnHandler" ;
66import { MediaDimensionsHandler } from "components/modals/handlers/MediaDimensionsHandler" ;
77import { MediaToggleHandler } from "components/modals/handlers/MediaToggleHandler" ;
8+ import { StyleClasses } from "helpers/Constants" ;
9+ import { ColumnHandlerResponse } from "cdm/ModalSettingsModel" ;
810
911export class ColumnModal extends Modal {
1012 view : DatabaseView ;
1113 column : TableColumn ;
14+ columnSettingsManager : ColumnSettingsManager ;
1215 constructor (
1316 view : DatabaseView ,
1417 column : TableColumn
1518 ) {
1619 super ( view . app ) ;
1720 this . view = view ;
1821 this . column = column ;
22+ this . columnSettingsManager = new ColumnSettingsManager ( this . view , this . column ) ;
1923 }
2024
2125 onOpen ( ) {
22- const { contentEl, modalEl } = this ;
26+ const { contentEl } = this ;
2327 contentEl . empty ( ) ;
28+ this . columnSettingsManager . constructUI ( contentEl ) ;
29+ }
30+
31+ reset ( columnHandlerResponse : ColumnHandlerResponse ) {
32+
33+ }
34+
35+ onClose ( ) {
36+ const { contentEl } = this ;
37+ contentEl . empty ( ) ;
38+ }
39+ }
40+ export class ColumnSettingsManager {
41+ view : DatabaseView ;
42+ column : TableColumn ;
43+ constructor (
44+ view : DatabaseView ,
45+ column : TableColumn
46+ ) {
47+ this . view = view ;
48+ this . column = column ;
49+ }
50+ constructUI ( containerEl : HTMLElement ) {
51+ /** Common modal headings */
52+ containerEl . addClass ( StyleClasses . COLUMN_MODAL ) ;
53+ add_setting_header ( containerEl , `Settings of ${ this . column . label } column` , 'h2' ) ;
54+
55+ const settingBody = containerEl . createDiv ( ) ;
56+ settingBody . addClass ( StyleClasses . COLUMN_MODAL_BODY ) ;
57+ settingBody . setAttribute ( "id" , StyleClasses . COLUMN_MODAL_BODY ) ;
2458 const initialResponse : ColumnHandlerResponse = {
25- containerEl : contentEl ,
59+ containerEl : containerEl ,
2660 view : this . view ,
2761 column : this . column ,
62+ columnSettingsManager : this
2863 } ;
29- folder_settings_section ( initialResponse ) ;
64+ this . constructBody ( initialResponse ) ;
3065 }
3166
32- onClose ( ) {
33- const { contentEl } = this ;
34- contentEl . empty ( ) ;
67+ constructBody ( settingHandlerResponse : ColumnHandlerResponse ) {
68+ /** Columns section */
69+ folder_settings_section ( settingHandlerResponse ) ;
70+ }
71+
72+ reset ( response : ColumnHandlerResponse ) {
73+ const columnElement = document . getElementById ( StyleClasses . COLUMN_MODAL_BODY ) ;
74+ // remove all sections
75+ columnElement . empty ( ) ;
76+ response . containerEl = columnElement ;
77+ this . constructBody ( response ) ;
3578 }
3679}
3780
0 commit comments