UNPKG

ucbuilder

Version:

:Shree Ganeshay Namah: new way app design

149 lines 3.79 kB
export class Control { _name; get name() { return this._name; } set name(value) { this._name = value; if (value.match(/^(?!\d)\w+$/) != null) { this._nameQT = value; this._nameThis = `.${value}`; } else { this._nameQT = `"${value}"`; this._nameThis = `["${value}"]`; } } _nameQT = ''; get nameQT() { return this._nameQT; } ; _nameThis = ''; get nameThis() { return this._nameThis; } ; codeFilePath = ""; type = 'none'; generic = ''; scope = "public"; proto = ""; importedClassName = undefined; src = undefined; nodeName = ""; constructor() { } } ; export const templete = { name: "", scope: 'public', controls: [], }; export class DesignerOptionsBase { importer = new importManage(); htmlFilePath = ''; dynamicName = undefined; className = ""; baseClassName = ""; codeFilePath = ""; dynamicFilePath = ""; } class ucDesigner extends DesignerOptionsBase { getterFunk = ""; controls = []; } class tptDesigner extends DesignerOptionsBase { templetes = []; } export class dynamicDesignerElementTree { type = 'element'; value; nodeName; props = {}; children = []; } export class codeOptionsBase { className = ""; designerClassName = ""; designerFilePath = ""; } class TsUcRow { //htmlFileContent?: string; //codeFilePath = ""; code = new codeOptionsBase(); designer = new ucDesigner(); } class TsTptRow { code = new codeOptionsBase(); designer = new tptDesigner(); } export class CommonRow { src; dynamicFileContent; dynamicFileContentx; htmlFileContent; sources = { 'ts_uc': new TsUcRow(), 'ts_tpt': new TsTptRow(), }; } class importManage { classes = []; _imprtMap = {}; getNameNumber(name) { let impNames = this._imprtMap; let impName = impNames[name]; if (impName == undefined) { impNames[name] = 0; return name; } else { impName++; impNames[name] = impName; return `${name}${impName}`; } } addImport = (names, url /*, _importclasses: ImportClassNode[]*/) => { let _urlLowerCase = url.toLowerCase(); // let _importclasses = this.designer.importClasses; let _this = this; let _import = this.classes.find(s => s.url.toLowerCase() == _urlLowerCase); let rtrn = []; if (_import != undefined) { names.forEach(name => { let fnd = _import.names.find(s => s.name == name); if (fnd == undefined) { fnd = { alias: _this.getNameNumber(name), name: name }; fnd.asText = fnd.alias === fnd.name ? fnd.alias : `${fnd.name} as ${fnd.alias}`; _import.names.push(fnd); } rtrn.push(fnd.alias); }); } else { _import = { names: [], url: url, }; this.classes.push(_import); names.forEach(name => { let fnd = { alias: _this.getNameNumber(name), name: name }; fnd.asText = fnd.alias === fnd.name ? fnd.alias : `${fnd.name} as ${fnd.alias}`; _import.names.push(fnd); rtrn.push(fnd.alias); }); } return rtrn; }; } export const templeteControl = { name: "", nodeName: "", scope: "public", proto: "", }; //# sourceMappingURL=buildRow.js.map