@ apache- 超集/ 核心
用于构建Apache Superset扩展和集成的官方核心包. 这个软件包为主机应用程序和扩展提供了包括共享的UI组件,公用功能,API,以及类型定义在内的基本构件.
* 安装
npm install @apache-superset/core
QQ 软件包结构
该源被组织成有重点的命名空间,各自在自己的目录中:
src/
├── authentication/
├── commands/
├── common/
├── components/
├── contributions/
├── editors/
├── extensions/
├── menus/
├── sqlLab/
├── theme/
├── translation/
├── utils/
├── views/
└── index.ts
QQ 快速启动
前端贡献从您的扩展切入点注册为模块级副作用.
视图
在应用程序中的特定位置添加自定义面板或 UI 组件 :
import { views } from '@apache-superset/core';
import MyPanel from './MyPanel';
views.registerView(
{ id: 'my-extension.main', name: 'My Panel Name' },
'sqllab.panels',
() => <MyPanel />,
);
图标
定义可从菜单、键盘快捷键或代码中被触发的命名动作 :
import { commands } from '@apache-superset/core';
commands.registerCommand(
{
id: 'my-extension.copy-query',
title: 'Copy Query',
icon: 'CopyOutlined',
description: 'Copy the current query to clipboard',
},
() => {
/* implementation */
},
);
菜单
将命令附加到指定位置的初级、二级或上下文菜单中:
import { menus } from '@apache-superset/core';
menus.registerMenuItem(
{ view: 'sqllab.editor', command: 'my-extension.copy-query' },
'sqllab.editor',
'primary',
);
编辑器
替换一个或多个语言的默认文本编辑器 :
import { editors } from '@apache-superset/core';
import MonacoSQLEditor from './MonacoSQLEditor';
editors.registerEditor(
{
id: 'my-extension.monaco-sql',
name: 'Monaco SQL Editor',
languages: ['sql'],
},
MonacoSQLEditor,
);
许可证
根据Apache许可证第2.0版获得许可. 见 自由主义 详细情况.