// Copyright (C) 2024 Robert J.A. Wagner; Am Kiefernwald 49b; D-64297 Darmstadt - All Rights Reserved export default class toFormElem_base { constructor() { // this.pFE = []; XRW.FE ??= {}; this.setThisFE(); } setFE(_pFE) { for (let FE_Type in _pFE) { let FE = _pFE[FE_Type]; if (!FE.elem) return XRW.panic(`toFormElem_base: no elem definiton`); FE.elem.FE_Type ??= FE_Type; // this.pFE.push(FE_Type); if (FE_Type in XRW.FE) XRW.warn(`toFormElem: overloading existing FE("${FE_Type}")`); FE.Builder = this; XRW.FE[FE_Type] = FE; } } setThisFE() { XRW.warn("Empty FE"); } jsonOuter_OLD(cell) { let ojson = { tag: 'DIV', _style: `float:left;left:${cell.style.x};top:${cell.style.y};width:${cell.style.wx};`, next: [] }; if (cell.style.wy) ojson._style += `height:${cell.style.wy};`; ojson._style += "border: 1px solid #aaaaaa;" return ojson; } jsonLabel(cell, marginTop = -2) { // if (!cell.item.FE_Title) cell.item.FE_Title = cell.item.FGM_key; let fs = (cell.fs) ? cell.fs - 1 : 10; let _style = `font-size:${Math.round(fs * 1.3333)}px;color:white;background-color:#009688;padding-left:2px;padding-top:${marginTop}px;padding-bottom:3px;height:100%;`; let ojson = { tag: 'LABEL', _for: cell.item.id, next: [] }; if (cell.item.hint) { _style = `float:left;` + _style + `width:90%;`; ojson.next.push({ tag: "P", _style: `float:left;width:10%;font-size:8px;background-color:#009688;text-align:center;;margin-top:${marginTop}px;padding-bottom:3px;height:100%;`, inner: "O" }); } else { _style += `width: 100%;` } ojson.next.push({ tag: 'DIV', inner: cell.item.FE_Title, _style }); return ojson; } renderFinalize() { } getCellText(form, control, item, cell, arg, FGM_Key) { return arg[FGM_Key].toString(); } renderCellText() { } }