import { NgxExcelModelColumnRule, NgxExcelContextChanged, NgxExcelRow, NgxExcelColumn, NgxExcelSelectOption } from '../models/models'; import { NgxExcelUploadService } from './ngx-excel-helper'; import { INgxExcelDataSource } from './ngx-excel-data-source'; import { NgxExcelService } from './ngx-excel.service'; import { NgxExcelComponentService } from './ngx-excel-component.service'; import { Observable } from 'rxjs'; export interface BehaviorEvent { action: 'metas' | 'appendRow' | 'updateRow' | 'removeRow' | 'error'; payload?: any; } export declare class NgxExcelController { private _dataService; private _componentService; private _subscription; private _loadedRowCount; private _pageNumMax; private _total; private _cachedForeignModelsMap; private _selectedExcelCellComponent; private _selectedExcelRow; private _selectedExcelCol; private readonly _subject; private readonly _metasSubject; private _pageSize; private _globalFilters; private _extraFilters; private _extraMetas; constructor(_dataService: INgxExcelDataSource, _componentService: NgxExcelComponentService); /** * 判断是否有针对该模型的指定操作权限 * @param model 待处理的模型 * @param action 处理动作 */ privilege(model: any, action: string): boolean; /** * 判断是否有针对该模型的指定操作能力 * @param model 待处理的模型 * @param action 处理动作 */ can(model: any, action: string): boolean; /** * 判断是否有针对该字段的编辑能力 * @param excelRow 待判断的数据行 * @param excelCol 待处理的数据列 */ canEdit(excelRow: NgxExcelRow, excelCol: NgxExcelColumn): boolean; /** * 验证提交数据的有效性 * @param excelRow 待判断的数据行 * @param excelCol 待判断的数据列 * @param newValue 新值 */ validate(excelRow: NgxExcelRow, excelCol: NgxExcelColumn, newValue: any): boolean | string | Observable; /** * 判断单元格是否被选中 * @param excelRow 表格行 * @param excelCol 表格列 */ isSelectedCell(excelRow: NgxExcelRow, excelCol: NgxExcelColumn): boolean; /** * 选中单元格 * @param component 单元格组件 * @param excelRow 表格行 * @param excelCol 表格列 */ selectCell(component: any, excelRow: NgxExcelRow, excelCol: NgxExcelColumn): boolean; /** * 获得所有字段的模型规则(服务穿透) */ /** * 获得指定字段的模型规则(服务穿透) * @param name 字段名 */ getRule(name: string, excel?: NgxExcelService): NgxExcelModelColumnRule; /** * 获得指定模型的主键 * @param model 模型 */ getPrimaryKey(context: any): string; /** * 获得下拉可选项列表 * @param excelRow 表格行 * @param excelCol 表格列 */ getSelectOptions(excelRow: NgxExcelRow, excelCol: NgxExcelColumn): Observable; /** * 获得外键可选项 * @param excelRow 表格行 * @param excelCol 表格列 * @param keyword 关键字 */ getForeignModels(excelRow: NgxExcelRow, excelCol: NgxExcelColumn, keyword: string): Observable; /** * 获得文件上传服务 * @param item H5上传对象 */ getUploadService(payload: { [name: string]: string | Blob; }): NgxExcelUploadService; /** * 绑定额外的过滤参数 * @param filters 过滤参数列表 */ bindFilters(filters: { [name: string]: string | string[]; }): NgxExcelController; /** * 绑定额外的元数据列表 * @param metas 需要请求的额外元数据列表 */ bindMetas(metas: string | string[]): Observable<{ [name: string]: any; }>; /** * 绑定数据集 * @param dataSet 待绑定的数据集 */ bindDataSet(dataSet: any[]): void; /** * 获得完整的数据集 */ getDataSet(): any; /** * 增加列 * @param column 动态增加列定义 * @param index 增加的位序(默认在最后增加) */ resolveColumn(column: NgxExcelColumn): NgxExcelColumn; /** * 根据行号加载表格行 * @param lineNumBegin 开始行号 * @param lineNumEnd 结束行号 */ loadRows(lineNumBegin: number, lineNumEnd: number): Observable<{ excelRows: NgxExcelRow[]; total: number; }>; /** * 处理上下文菜单点击事件 * @param action 动作 * @param model 模型 */ handleContextMenuClick(action: string, model?: any): Observable; /** * 处理模型变更 * @param originalModel 原始的模型 * @param model 修改后的模型 * @param name 更新字段名 */ handleModelChanged(originalModel: any, model: any, name: string): Observable; /** * 增加一个数据行 * @param context 行内容 * @param i 行号 */ createExcelRow(context: any, i: number): NgxExcelRow; /** * 计算页码 * @param lineNum 行号 */ private _getPageForIndex; /** * 加载页 * @param pageNum 页码从 0 开始 */ private _loadPage; }