import { IControl, IDataSource, SourceCode, ITableDefinition, ComponentControl, ControlType } from '@datahu/core' import {I18n} from '../i18n' import {BaseDataSource, BaseDataSourceOption} from '../base' import {DominoHelper} from './DominoHelper' export class DominoDataSourceOption extends BaseDataSourceOption { static controls: Array = [] @ComponentControl({ type: ControlType.text, title: 'Domino Web 地址' }) url: string = 'http://localhost' @ComponentControl({ type: ControlType.text, title: '用户名' }) username: string = '' @ComponentControl({ type: ControlType.password, title: '密码' }) password: string = '' @ComponentControl({ type: ControlType.text, title: '数据库文件' }) database: string = '' @ComponentControl({ type: ControlType.text, title: '视图' }) view: string = '' @ComponentControl({ type: ControlType.boolean, title: '查询所有数据' }) queryAll: boolean = true @ComponentControl({ type: ControlType.objectSet, title: '自定义查询参数' }) params: Array = [ { key: '', value: '' } ] } export class DominoDataSource extends BaseDataSource { helper?: DominoHelper constructor(language: string, config?: DominoDataSourceOption) { super(language, config) this.title = 'Domino Lotus' this.description = 'Domino Lotus' if (config) { this.helper = new DominoHelper(config) } } // 数据源默认配置值 config: DominoDataSourceOption = new DominoDataSourceOption() icon: string = '' sourceCode: SourceCode = SourceCode.Javascript getTables(): Promise> { return this.helper!.getTables() } getData(tables: Array): Promise> { return this.helper!.getData(tables) } }