createInput(parent, data, field, index = -1, initial = "") {
        const id = field.id;
        const inputType = field.inputType;
        /*
         * Some fields don't need UI...
         */
        if (inputType === "currentdate") {
            const fmt = field.args[0] || 'yyyy-MM-dd';
            data[id] = DateTime_1.now().toFormat(fmt);
            console.log(`Date ${data[id]} with ${fmt}`);
            return;
        }
        // Create div and label
        const controlEl = parent.createEl('div', { cls: "from-template-section" });
        const labelText = index < 9 ? `${ucFirst(id)} (${index + 1}): ` : `${ucFirst(id)}: `;
        const label = controlEl.createEl("label", { text: labelText, cls: "from-template-label" });
        label.htmlFor = id;
        //Put the data into the record to start
        if (initial)
            data[field.id] = initial;
        let element;
        if (inputType === "area") {
            const t = new obsidian.TextAreaComponent(controlEl)
                .setValue(data[id])
                .onChange((value) => data[id] = value);
            t.inputEl.rows = 5;
            element = t.inputEl;
        }
        else if (inputType === "choice") {
            const opts = {};
            field.args.forEach(f => opts[f] = ucFirst(f));
            const t = new obsidian.DropdownComponent(controlEl)
                .addOptions(opts)
                .setValue(data[id])
                .onChange((value) => data[id] = value);
            element = t.selectEl;
        }
        /*
        else if( inputType === "search") {
            const t = new SearchComponent(controlEl)
            //.setValue(data[id])
            .onChange((value) => data[id] = value)
            t.inputEl.addClass("from-template-control")
        }
        else if( inputType === "moment") {
            const t = new MomentFormatComponent(controlEl)
            //.setValue(data[id])
            .onChange((value) => data[id] = value)
            t.inputEl.addClass("from-template-control")
        }
        */
        else if (inputType === "text") {
            const t = new obsidian.TextComponent(controlEl)
                .setValue(data[id])
                .onChange((value) => data[id] = value);
            t.inputEl.size = 50;
            element = t.inputEl;
        }
        if (element) {
            if (index === 0)
                element.focus();
            element.addClass("from-template-control");
            if (index <= 8)
                this.scope.register(["Mod"], `${index + 1}`, () => element.focus());
        }
    }
/*
     * Creates the UI element for putting in the text. Takes a parent HTMLElement, and:
     * - creates a div with a title for the control
     * - creates a control, base on a field type. The 'field' parameter is taken from the template, and can be given as field:type
    */
Creates the UI element for putting in the text. Takes a parent HTMLElement, and:
- creates a div with a title for the control
- creates a control, base on a field type. The 'field' parameter is taken from the template, and can be given as field:type
Creates the UI element for putting in the text . Takes a parent HTMLElement and : - creates a div with a title for the control - creates a control base on a field type . The ' field ' parameter is taken from the template and can be given as field : type
createInput(parent, data, field, index = -1, initial = "") {
        const id = field.id;
        const inputType = field.inputType;
        if (inputType === "currentdate") {
            const fmt = field.args[0] || 'yyyy-MM-dd';
            data[id] = DateTime_1.now().toFormat(fmt);
            console.log(`Date ${data[id]} with ${fmt}`);
            return;
        }
        const controlEl = parent.createEl('div', { cls: "from-template-section" });
        const labelText = index < 9 ? `${ucFirst(id)} (${index + 1}): ` : `${ucFirst(id)}: `;
        const label = controlEl.createEl("label", { text: labelText, cls: "from-template-label" });
        label.htmlFor = id;
        if (initial)
            data[field.id] = initial;
        let element;
        if (inputType === "area") {
            const t = new obsidian.TextAreaComponent(controlEl)
                .setValue(data[id])
                .onChange((value) => data[id] = value);
            t.inputEl.rows = 5;
            element = t.inputEl;
        }
        else if (inputType === "choice") {
            const opts = {};
            field.args.forEach(f => opts[f] = ucFirst(f));
            const t = new obsidian.DropdownComponent(controlEl)
                .addOptions(opts)
                .setValue(data[id])
                .onChange((value) => data[id] = value);
            element = t.selectEl;
        }
        else if (inputType === "text") {
            const t = new obsidian.TextComponent(controlEl)
                .setValue(data[id])
                .onChange((value) => data[id] = value);
            t.inputEl.size = 50;
            element = t.inputEl;
        }
        if (element) {
            if (index === 0)
                element.focus();
            element.addClass("from-template-control");
            if (index <= 8)
                this.scope.register(["Mod"], `${index + 1}`, () => element.focus());
        }
    }
createInput ( parent , data , field , index = - 1 , initial = "" ) { const id = field . id ; const inputType = field . inputType ; if ( inputType === "currentdate" ) { const fmt = field . args [ 0 ] || 'yyyy-MM-dd' ; data [ id ] = DateTime_1 . now ( ) . toFormat ( fmt ) ; console . log ( ` ${ data [ id ] } ${ fmt } ` ) ; return ; } const controlEl = parent . createEl ( 'div' , { cls : "from-template-section" } ) ; const labelText = index < 9 ? ` ${ ucFirst ( id ) } ${ index + 1 } ` : ` ${ ucFirst ( id ) } ` ; const label = controlEl . createEl ( "label" , { text : labelText , cls : "from-template-label" } ) ; label . htmlFor = id ; if ( initial ) data [ field . id ] = initial ; let element ; if ( inputType === "area" ) { const t = new obsidian . TextAreaComponent ( controlEl ) . setValue ( data [ id ] ) . onChange ( ( value ) => data [ id ] = value ) ; t . inputEl . rows = 5 ; element = t . inputEl ; } else if ( inputType === "choice" ) { const opts = { } ; field . args . forEach ( f => opts [ f ] = ucFirst ( f ) ) ; const t = new obsidian . DropdownComponent ( controlEl ) . addOptions ( opts ) . setValue ( data [ id ] ) . onChange ( ( value ) => data [ id ] = value ) ; element = t . selectEl ; } else if ( inputType === "text" ) { const t = new obsidian . TextComponent ( controlEl ) . setValue ( data [ id ] ) . onChange ( ( value ) => data [ id ] = value ) ; t . inputEl . size = 50 ; element = t . inputEl ; } if ( element ) { if ( index === 0 ) element . focus ( ) ; element . addClass ( "from-template-control" ) ; if ( index <= 8 ) this . scope . register ( [ "Mod" ] , ` ${ index + 1 } ` , ( ) => element . focus ( ) ) ; } }
Creates the UI element for putting in the text.
Creates the UI element for putting in the text .
/*
         * Some fields don't need UI...
         */ // Create div and label //Put the data into the record to start /*
        else if( inputType === "search") {
            const t = new SearchComponent(controlEl)
            //.setValue(data[id])
            .onChange((value) => data[id] = value)
            t.inputEl.addClass("from-template-control")
        }
        else if( inputType === "moment") {
            const t = new MomentFormatComponent(controlEl)
            //.setValue(data[id])
            .onChange((value) => data[id] = value)
            t.inputEl.addClass("from-template-control")
        }
        */