接口说明文档:https://smartbi.feishu.cn/docx/XWaddBPPYoJXmvxZQLkcJH08nif
Markdown |
---|
## BaseAdHocAnalysisExtender 基类
透视分析扩展点需继承此类,在自定义的 Extender 类中可通过 this 指针调用 BaseAdHocAnalysisExtender 中的方法
| | <strong>名称</strong> | <strong>参数</strong> | <strong>返回值</strong> | <strong>说明</strong> |
| --------------------- | --------------------- | --------------------- | ----------------------- | --------------------- |
| <strong>方法</strong> | on | 事件、事件回调 | - | 添加接口监听事件 |
### 二开接口
#### AD_HOC_ANALYSIS_ON_INIT
<strong>触发时机:</strong>透视分析界面初始化时
<strong>作用</strong>:暂无对外接口
| | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | adHocAnalysisImpl | IAdHocAnalysis | 即席查询对象 |
#### AD_HOC_DATA_PANEL_ON_INIT
<strong>触发时机:</strong>左侧数据来源选择面板初始化时
<strong>作用:</strong>对下拉菜单进行加减、禁用切换数据源
| | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | adHocDataPanelImpl | IAdHocDataPanel | 数据来源面板对象 |
<strong>示例代码</strong>
```typescript
this.on(AD_HOC_DATA_PANEL_ON_INIT, async (impl) => {
// 禁止切换数据集
if (!impl.getCurrentDatasetId()) {
impl.setSelectDatasetDisabled(true)
}
// 屏蔽数据面板下拉部分菜单
impl.setDropDownBtnsFilter(menu => {
// 屏蔽编辑和切换数据集菜单
return menu.id !== 'EDIT' && menu.id !== 'SWITCH_DATASET'
})
})
}
```
#### AD_HOC_SAVE_DIALOG_ON_INIT
<strong>触发时机:</strong>保存弹窗初始化时
<strong>作用:</strong>指定用户的可保存的目录
| | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | saveDialogImpl | ISaveDialog | 保存弹窗对象 |
<strong>示例代码</strong>
```typescript
this.on(AD_HOC_SAVE_DIALOG_ON_INIT, async (saveDialogImpl) => {
saveDialogImpl.setNodeFilter((node) => {
return node.id != 'PUBLIC_ANALYSIS'
})
})
```
#### AD_HOC_DATASET_SELECTOR_ON_INIT
<strong>触发时机:</strong>左侧数据来源选择面板初始化时
<strong>作用:</strong>对数据来源选择进行限制
| | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | ------------------------ | --------------------- | --------------------- |
| <strong>输入参数</strong> | adHocDatasetSelectorImpl | IAdHocDatasetSelector | 选择数据集弹窗对象 |
<strong>示例代码</strong>
```typescript
this.on(AD_HOC_DATASET_SELECTOR_ON_INIT, async (impl) => {
impl.setRootNodeId('DEFAULT_TREENODE')
}
```
#### AD_HOC_TOOLBAR_ON_INIT
<strong>触发时机:</strong>工具栏初始化时
<strong>作用:</strong>对工具栏增加自定义项,删除某项
| | <strong>名称</strong> | <strong>类型</strong> | <strong>说明</strong> |
| ------------------------- | --------------------- | --------------------- | --------------------- |
| <strong>输入参数</strong> | toolbarImpl | IDQueryToolbar | 工具栏对象 |
<strong>示例代码</strong>
```typescript
this.on(AD_HOC_TOOLBAR_ON_INIT, async (toolbarImpl) => {
// 添加自定义按钮
toolbarImpl.addItem({
id: 'test',
label: '自定义按钮',
icon: 'sx-icon-data-panel-toggle',
handler: () => {
alert('点击自定义按钮')
}
})
})
```
## 接口对象
### IAdHocAnalysisQuery(透视分析界面)
暂无
### IAdHocDataPanel(数据面板)
IAdHocDataPanel 继承 [IDatasetPanel](https://smartbi.feishu.cn/docx/NMCmdBVh0ogQBDx3maOc0lVin2g#WVJadvRxDoHiPlxAGYQcxn04nNd)
### ISaveDialog(保存弹窗)
见:[ISaveDialog](https://smartbi.feishu.cn/docx/NMCmdBVh0ogQBDx3maOc0lVin2g#BRJtd7zU3osgeGx1wwPczYubnly)
### IAdHocDatasetSelector(选择数据集弹窗)
IAdHocDatasetSelector 继承 [IDatasetSelector](https://smartbi.feishu.cn/docx/NMCmdBVh0ogQBDx3maOc0lVin2g#QjnEd8SwPoqwX4x0aOwcg4msnKf)
### IAdHocToolbar(工具栏)
IAdHocToolbar 继承 [IBaseToolbar](https://smartbi.feishu.cn/docx/NMCmdBVh0ogQBDx3maOc0lVin2g#MZpFdg1O2oKLVLxntd2c1ecintd)
## 二开示例
[【透视分析】二开示例](https://smartbi.feishu.cn/docx/BRtedkGueosLDVxdunccqOSsnGh)
|