import { nav, Page } from 'tonva-tools'; import { VTuidMainListBase, VTuidDivListBase } from './vTuidList'; import { VEntity } from '../CVEntity'; import { Tuid } from '../../entities'; import { CTuid, TuidUI } from './cTuid'; import { SearchBox, List } from 'tonva-react-form'; import React from 'react'; import { RowContent } from '../form/viewModel'; import { observer } from 'mobx-react'; export class VTuidSelect extends VEntity> { protected mainRowContent: (row:any) => JSX.Element; protected divRowContent: (row:any) => JSX.Element; async open(param?:any): Promise { if (param === undefined) await this.showMain(param); else await this.showDiv(param); } private async showMain(param) { this.mainRowContent = this.ui.rowContent || RowContent; await this.controller.searchMain(param); this.openPage(this.mainView); } private async showDiv(ownerValue: any) { let {divs} = this.ui; if (divs !== undefined) { this.divRowContent = divs[this.entity.name].rowContent; } if (this.divRowContent === undefined) { this.divRowContent = RowContent; } let divItems = await this.controller.getDivItems(ownerValue); this.openPage(this.divView, {items: divItems}); } protected mainView = observer(() => { let header = ; return ; }); onSearchMain = async (key:string) => { await this.controller.searchMain(key); //await this.PageItems.first(key); } renderMainRow = (item:any, index:number):JSX.Element => ; clickMainRow = async (item:any) => { this.ceasePage(); if (this.controller.entity.owner === undefined) { this.returnCall(item); return; } await this.showDiv(this.entity.getIdFromObj(item)); } protected divView = (param:any) => { return ; } renderDivRow = (item:any, index:number):JSX.Element => ; clickDivRow = (item:any) => { this.ceasePage(); this.returnCall(item); } }