export class DsProjectRoomData { text = ''; // text we want to label url = ''; // url we want to label showInIframe = false; // boolean to determine if this url can be opened in an iframe - need to check in advance isList?: boolean; // adding and option to label a list of records listHeader?: string; // header for the list listHeaderFixed?: boolean; // mark list header as fixed listItemDefaultHeader?: string; // when isList is true this will be the default name presented for item in list listBlockIndex?: number; // this will be the block index from (dsProjectRoomObj) to present as header when filled listBlockFieldFirstIndex?: number; // this will be the first field index in listBlockIndex(the selected block index) to present as header when filled listBlockFieldSecondIndex?: number; // this will be the second field index in listBlockIndex(the selected block index) to present as header when filled constructor(obj?) { if (obj) { for (const key in obj) { if (obj[key] !== undefined && obj[key] !== null) { this[key] = obj[key]; } } } } } export class DsProjectRoomBlock { blockName = ''; // the name of the block - will be presented as header in html blockDesc = ''; // the description of the block - will be presented under header in html blockWidth = ''; // width of the block in case we want two blocks to be in one row (must have next blocks complete width to 100%) blockWidthToPixel = ''; // responsive width of the block will stop when window is lower then pixels numColumns: number; // number of columns we want the fields to spread on fields: DsProjectRoomBlockField[] = []; // fields list inside the block isValid = true; // represent if the block is html valid constructor(obj?) { if (obj) { if (obj.blockName) { this.blockName = obj.blockName; } if (obj.blockDesc) { this.blockDesc = obj.blockDesc; } if (obj.blockWidth) { this.blockWidth = obj.blockWidth; } if (obj.blockWidthToPixel) { this.blockWidthToPixel = obj.blockWidthToPixel; } if (obj.numColumns) { this.numColumns = obj.numColumns; } if (obj.fields) { for (const i in obj.fields) { this.fields.push( new DsProjectRoomBlockField(obj.fields[i])); } } } } } export class DsProjectRooomListBlocks { label = ''; // will be used for html input name and label text description = ''; // description that will show as text under the field value: any = ''; // value of the field inputType = ''; // html input type (text,number,email,checkbox,textarea,select,select_multiple,radio,text_list(must come with listBlocks) required?: boolean; // html required pattern?: string; // html pattern constructor(obj?) { if (obj) { for (const key in obj) { if (obj[key] !== undefined && obj[key] !== null) { this[key] = obj[key]; } } } } } class OutputObj { blocks: DsProjectRooomListBlocks | DsProjectRooomListBlocks[]; // full output blocks to cache if needed cleanBlocks: any | any[]; // clean output blocks with only full fields valid: boolean; // represent if the list of items or one item is valid in order to alert the user } export class DsProjectRoomBlockField { label = ''; // will be used for html input name and label text description = ''; // description that will show as text under the field value: any = ''; // value of the field inputType = ''; // html input type (text,number,email,checkbox,textarea,select,select_multiple,radio,text_list(must come with listBlocks) required?: boolean; // html required pattern?: string; // html pattern listBlocks?: DsProjectRooomListBlocks[]; // for text-list type an array of DsProjectRooomListBlocks spread equal on 100% depend: string; // determine when field depend on another field based on label name dependOnValue: any; // determine the true value (number, boolean, string, any compare using ===) when a field depend on another field breakLine: boolean; // boolean to force break line between fields fullLine: boolean; // boolean to force field to spread on full line center: boolean; // boolean to force field to be center of column options: any[]; // represent string select, select_multiple, radio options rows: number; // will be use only to set rows for textarea css: any; // represent specific style to a string constructor(obj?) { if (obj) { for (const key in obj) { if (key === 'listBlocks') { for (const i in obj.listBlocks) { obj.listBlocks[i] = new DsProjectRooomListBlocks(obj.listBlocks[i]); } } if (obj[key] !== undefined && obj[key] !== null) { const origKey = this.convertShortKey(key); this[origKey] = obj[key]; } } } } convertShortKey(key) { key === 'l' ? key = 'label' : ''; // will be used for html input name and label text key === 'd' ? key = 'description' : ''; // description that will show as text under the field key === 'v' ? key = 'value' : ''; // value of the field key === 'iT' ? key = 'inputType' : ''; // html input type (text,number,email,checkbox,textarea,select,select_multiple,radio,text_list(must come with listBlocks) key === 'r' ? key = 'required' : ''; // html required key === 'p' ? key = 'pattern' : ''; // html pattern key === 'lB' ? key = 'listBlocks' : ''; // for text-list type an array of DsProjectRooomListBlocks spread equal on 100% key === 'de' ? key = 'depend' : ''; // determine when field depend on another field based on label name key === 'dOV' ? key = 'dependOnValue' : ''; // determine the true value (number, boolean, string, any compare using ===) when a field depend on another field key === 'bL' ? key = 'breakLine' : ''; // boolean to force break line between fields key === 'fL' ? key = 'fullLine' : ''; // boolean to force field to spread on full line key === 'c' ? key = 'center' : ''; // boolean to force field to be center of column key === 'o' ? key = 'options' : ''; // represent string select, select_multiple, radio options key === 'ro' ? key = 'rows' : ''; // will be use only to set rows for textarea key === 'cs' ? key = 'css' : ''; // represent specific style to a string return key; } } export class DsProjectRooomListBlocksShortField { l = ''; // will be used for html input name and label text d = ''; // description that will show as text under the field v: any = ''; // value of the field iT = ''; // html input type (text,number,email,checkbox,textarea,select,select_multiple,radio,text_list(must come with listBlocks) r?: boolean; // html required p?: string; // html pattern lB?: DsProjectRooomListBlocks[]; // for text-list type an array of DsProjectRooomListBlocks spread equal on 100% de: string; // determine when field depend on another field based on label name dOV: any; // determine the true value (number, boolean, string, any compare using ===) when a field depend on another field bL: boolean; // boolean to force break line between fields fL: boolean; // boolean to force field to spread on full line c: boolean; // boolean to force field to be center of column o: any[]; // represent string select, select_multiple, radio options ro: number; // will be use only to set rows for textarea cs: any; // represent specific style to a string constructor(obj?) { if (obj) { for (const key in obj) { if (key === 'lO') { for (const i in obj.lO) { obj.lO[i] = new DsProjectRooomListBlocks(obj.lO[i]); } } if (obj[key] !== undefined && obj[key] !== null) { this[key] = obj[key]; } } } } }