You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
3.7 KiB
JavaScript

// Copyright (C) 2024 Robert J.A. Wagner; Am Kiefernwald 49b; D-64297 Darmstadt - All Rights Reserved
import toParent from "./oFormElem_10_base.js";
export default class toFormElem_input extends toParent {
constructor() {
super();
}
setThisFE() {
this.setFE({
// GenericArray: { FE_Title: "Array"}, FE_Data: { ynExport: 'Y', ynGenerateView: 'Y' } },
// GenericButton: { FE_Title: "Button"}, FE_Data: { ynExport: 'Y', ynGenerateView: 'Y' }, ynSkipSave: 'Y', ynReadOnly: 'Y', ynSkipOnSummary: 'Y' },
GenericCheck: { elem: { FE_Title: "Check", type: 'checkbox' }, FE_Data: { ynExport: 'Y', ynGenerateView: 'Y' }, defaultValue: 'N' },
GenericDate: { elem: { FE_Title: "Datum", type: 'date' }, FE_Data: { ynExport: 'Y', ynGenerateView: 'Y' } },
GenericEMail: { elem: { FE_Title: "EMail", type: 'email' }, FE_Data: { ynExport: 'Y', ynGenerateView: 'Y' } },
GenericTime: { elem: { FE_Title: 'Uhrzeit', type: 'time' }, FE_Data: { ynExport: 'Y', ynGenerateView: 'Y' } },
GenericFloat: { elem: { FE_Title: "Fliesskommazahl", type: 'number' }, FE_Data: { ynExport: 'Y', ynGenerateView: 'Y' } },
GenericInteger: { elem: { FE_Title: "Ganzzahl", type: 'number' }, FE_Data: { ynExport: 'Y', ynGenerateView: 'Y' } },
GenericWord: { elem: { FE_Title: "Prefix" }, FE_Data: { ynExport: 'Y', ynGenerateView: 'Y' } },
// GenericJSON: { FE_Title: "JSON"}, FE_Data: { ynExport: 'Y', ynGenerateView: 'Y' } },
GenericString: { elem: { FE_Title: "String" }, FE_Data: { ynExport: 'Y', ynGenerateView: 'Y' } },
GenericText: { elem: { FE_Title: "Text" }, FE_Data: { ynExport: 'Y', ynGenerateView: 'Y' } },
// GenericDataList: { FE_Title: 'Art', select: ['A', 'B', 'C'], FE_Data: { ynExport: 'Y', ynGenerateView: 'Y' } },
// GenericFixSelect: { elem: { FE_Title: 'Auswahl', select: ['A', 'B', 'C'] }, FE_Data: { ynExport: 'Y', ynGenerateView: 'Y' } },
});
}
//------------------------------
// render-functions
//------------------------------
render_ojsonElemForm(next, form, control, item, cell, arg, FGM_Key) {
let _type = item.type || 'text;'
let ojson = { tag: 'INPUT', _class: "w3-xrw-input", _value: arg[FGM_Key], _type };
if (cell.format.align) {
ojson._style += `text-align:${cell.align};`;
}
if (item.type == "checkbox") {
// ojson._class = 'w3-rw-check';
delete ojson._class;
let sz = cell.fs * 2;
ojson._style = `width:${sz}px;height:${sz}px;`;
if (arg[FGM_Key] == 'Y') ojson._checked = true;
}
next.push(ojson);
if (cell.item.ynTableStyle != 'Y') {
ojson._id = item.id;
let label = this.jsonLabel(cell);
next.push(label);
}
if (cell.item.ynReadOnly == 'Y') {
// pInput._class = pInput._class.replace("w3-xrw-input", "w3-xrw-input");
ojson['_readonly'] = true;
}
}
getCellText(form, control, item, cell, arg, FGM_Key) {
if (item.type == "checkbox") {
return XRW.translate(arg[FGM_Key]);
}
if (!arg || !FGM_Key) return;
return arg[FGM_Key].toString();
}
/*
render_setDOMObjectHeight(cell, dy) {
let dpy = dy * XRW.windowWidth / this.pageX;
let rectA = cell.obj.getBoundingClientRect();
let rectB = cell.obj.firstChild.getBoundingClientRect();
let apy = rectA.height - rectB.height;
cell.obj.firstChild.style.height = `${dpy - apy}px`;
}
*/
}
new toFormElem_input();