@cumul.io/react-cumulio-dashboard

中文文档
4.0.2发布于 2024/01/23TypeScriptES Module近 30 天下载 3158

反应-积分-dashboard

此软件包已被标记为弃用

Deprecated in favor of @luzmo/react-embed

中文使用文档
文档目录11 节
  1. 目录
  2. 安装指令
  3. 使用量
  4. 活动
  5. 公共方法
  6. 更改日志
  7. 移徙
  8. 从 3.x.x 迁移到 4.x.x
  9. 从 2.x.x 迁移到 3.x.x
  10. 从 1.x.x 迁移到 2.x.x
  11. 快速链接

折旧

这个套件已经贬值,有利于 @luzmo/反应-嵌入

反应-积分-dashboard

这是用于嵌入的 React 库 卡穆尔.io 反应应用程序中的仪表板.

目录

  1. 安装指令
  2. 使用量
  3. 活动
  4. 公共方法
  5. 更改日志
  6. 移徙
  7. 快速链接

安装指令

npm i @cumul.io/react-cumulio-dashboard

使用量

import { CumulioDashboardComponent, CumulioDashboard } from '@cumul.io/react-cumulio-dashboard';
import { useRef } from 'react';
...
  function CumulioWrapper() {
    const ref = useRef<CumulioDashboard>(null);
    return (
      <div className="App">
        <button
          onClick={async (e) => console.log(await ref.current.exportDashboard())}
        >
          Export Dashboard
        </button>
        <CumulioDashboardComponent
          ref={ref}
          authKey="<!-- your generated authKey -->"
          authToken="<!-- your generated authToken -->"
          dashboardSlug="test"
          switchScreenModeOnResize={false}
          loaderSpinnerColor="rgb(0, 81, 126)"
          loaderSpinnerBackground="rgb(236 248 255)"
          itemsRendered={(e) => console.log('itemsRendered', e)}>
        </CumulioDashboardComponent>
      </div>
    );
  }
...

属性

以下列出仪表板上可用的属性

财产类型说明
dashboardId字符串您想要嵌入的 Cumul.io 仪表板的标识
dashboardSlug字符串您想要嵌入的 Cumul.io 仪表板的弹片( 如果提供仪表板Id, 将使用)
itemId字符串您想要嵌入的 Cumul.io 项的 ID
itemDimensions{宽:数/弦;高:数/弦;}只有在提供了项目ID时才适用项目的宽度和高度。 接受 JSON 字符串.
authKey字符串通过 Cumul.io API 生成的授权密钥
authToken字符串通过 Cumul.io API 生成的授权令牌
language字符串仪表板语言: 如"en"(默认:"auto")
screenMode字符串您的仪表板的屏幕模式 : “ 移动 ” 、 “ 平板 ” 、 “ 桌面 ” 、 “ 大屏幕 ” 、 “ 固定 ” 或 “ 自动 ” (默认 : “ 自动 ” )
switchScreenModeOnResize布尔真:嵌入式仪表板可以在改变容器大小时切换屏幕Modes,假:Dashboard会保留同一种屏幕Mode(默认:真实)
loaderBackground字符串加载器元素的背景颜色( 默认 : '# f9f9f9' )
loaderFontColor字符串装入器文字的字体颜色( 默认 : '# 5a5a5a5a' )
loaderSpinnerColor字符串装入器的自旋颜色( 默认 : “ rgba( 255, 165, 0, 0. 7) ”)
loaderSpinnerBackground字符串旋转器的背景颜色( 默认 : “ rgba( 169, 169, 169, 0. 14) ”)
appServer字符串Cumul.io 连接的租借(默认:"https://app.cumul.io/" 美国设置的应用程序Server 到"https://app.us.cumul.io/")
timezoneId字符串你想在仪表板上使用的时区 这个时区 id 需要是一个有效的 id , 可以在 IANA 时区数据库例如:欧洲/布鲁塞尔或美洲/纽约.
apiHost字符串要连接的 API 服务器 (default: 'https://api. cumul.io/' for USs set apiHost to 'https://api.us.cumul.io/')
editMode字符串指定嵌入式仪表板是否可编辑。 接受值:"视图","编辑Limited","编辑Full". 不希望嵌入式仪表板可编辑时使用"视图". (过失:"观"
mainColor字符串对嵌入式仪表板编辑器白标签中使用的主色调可选更改. 如果不提供,则使用组织上所设置的白色标签颜色的主要颜色。 应当指定为 rgb 值的字符串(即 “ rgb( 50, 50, 50) ”) .
accentColor字符串嵌入式仪表板编辑器的白标签中使用的口音颜色的可选覆盖. 如果不提供,则使用组织上所设置的白标签颜色的口音颜色。 应当指定为 rgb 值的字符串(即 “ rgb( 50, 50, 50) ”) .



活动

名称说明事件参数
已更改 过滤器过滤器被更改时退出ChangedFiltersEvent
自定义事件解除自定义事件时退出CustomEvent
导出导出完成或失败时发出ExportedEvent
已招标的项目当所有物品都提供时, 才被放出ItemsRenderedEvent
装入装入仪表板时放出LoadEvent

公共方法

getDashboards(): Promise<CumulioDashboard[]>
// Returns an instantly resolved promise with an array of all the visible dashboards on a page with their information.

getData(itemId: string): Promise<ItemData>
// Promise that returns an array with the data of a item.
  
getFilters(): Promise<FilterGroup[]>
// Promise that returns an array of filters.

setAuthorization(key: string, token: string): Promise<void>
// Sets a new pair of authKey & authToken for the dashboard

refreshData(itemId?: string): Promise<void>
// Refreshes the data of a specific item/chart when the id of that item is supplied. Without a itemId this refreshes the data in all items.

reloadDashboard(): Promise<void>
// Reloads the dashboard. (useful when the authorization is changed, and dashboard needs to be reloaded)

exportDashboard(type?: ExportType): Promise<ExportDashboard>
// Exports the current dashboard as either pdf or png.

getAccessibleDashboards(): Promise<AccessibleDashboard[]>
// Retrieves a list of all dashboards an integration has access to. authKey and authToken needs to be set for this function to work.

setEditMode(editMode: string): Promise<SetEditMode>
// Sets the editMode of the current dashboard. Accepted parameters: view , editLimited , editFull .

更改日志

移徙

从 3.x.x 迁移到 4.x.x

  • 过滤器显示为 FilterGroup 数组代替一个 Filter 阵列. FilterGroup 是一个包含过滤器列表和(或)描述其关系的条件的对象. FilterGroup 也可以有儿童组支持复杂的过滤逻辑
// FilterGroup 
{
  id: string;
  condition: 'and' | 'or';
  filters: Filter[]; 
  subGroups: FilterGroup[];
  origin: string;
  datasetId?: string; // dataset id in case of dahsboard level filters
  itemId?: string; // chart id in case of chart level filters
}

// Filter
{
  expression: string;
  parameters: [];
  properties: {
    id: string;
    origin: string;
    type: string;
    itemId: string;
    ignore?: string[];
  }
}
  • getFilters() 方法响应和 changedFilters 事件数据现在包含过滤器,作为 FilterGroup 对象代替 Filter 对象
getFilters(): Promise<FilterGroup[]>
// changedFilters event data
{
  changed: FilterGroup[]; // changed filters
  filters: FilterGroup[]; // all filters
  // ... other event properties
}

从 2.x.x 迁移到 3.x.x

  • 无更改

从 1.x.x 迁移到 2.x.x

  • 所有被调用用于储存的方法现在应调用组件参考(可用 useRef to obtain a ref) (中文(简体) ).
  • chartId 现在叫做 itemId, (中文(简体) ), charts-rendered 现在叫做 items-rendered
  • 所有事件现在都属于格式 { data: { ...eventData } }, (中文(简体) ), eventData 属于格式
{
  dashboardId?: string;
  dashboardSlug?: string;
  itemId?: string;
  language: string;
  name: string;
  screenMode: string;
  type: string;
  dimensions?: object; // populated depending on the event
  changed?: [];  // populated depending on the event
  filters?: [];  // populated depending on the event
  item?: string;    // populated depending on the event
  origin?: string;  // populated depending on the event
  object?: string;  // populated depending on the event
  data?: object;       // populated depending on the event
}
  • getFilters 现在返回一系列过滤器. [...objectOfFilters], (中文(简体) ), objectOfFilters 属于格式
[{
  expression: string;
  parameters: [];
  properties: {
    id: string;
    ignore?: string[];
    origin: string;
    type: string;
    viz: string;
  }
}]

为了更多 迁移请点击此处。 。 。 .

卡穆尔.io | 代码框示例 | 移徙 | 更改日志

版本与发布记录

@cumul.io/react-cumulio-dashboard 共发布 38 个版本,首次发布于 2021/10/19;过去 12 个月发布了 0 个版本。

版本发布日期距今
4.0.2latest2024/01/232 年前
4.0.12023/06/163 年前
4.0.02023/03/223 年前
3.2.02023/02/133 年前
3.1.132023/01/273 年前
3.1.122023/01/203 年前

关于 @cumul.io/react-cumulio-dashboard 的常见问题

@cumul.io/react-cumulio-dashboard 是什么?

反应-积分-dashboard注意:该包已被作者标记为弃用——Deprecated in favor of @luzmo/react-embed

如何安装 @cumul.io/react-cumulio-dashboard?

在项目目录运行 npm install @cumul.io/react-cumulio-dashboard,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^16 || ^17 || ^18)、react-dom(^16 || ^17 || ^18)、@cumul.io/cumulio-dashboard(4.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@cumul.io/react-cumulio-dashboard 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@cumul.io/react-cumulio-dashboard 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@cumul.io/react-cumulio-dashboard 可以商用吗?

@cumul.io/react-cumulio-dashboard 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@cumul.io/react-cumulio-dashboard 的下载量有多少?

根据 npm 官方下载统计,@cumul.io/react-cumulio-dashboard 在 2026/10/11 – 2026/11/09 这 30 天内被下载 3,158 次,日均约 105 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cumul.io/react-cumulio-dashboard 还在维护吗?

最新版本 4.0.2 发布于 2024/01/23(2 年前);至今共发布 38 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/10/19。作者已将其标记为弃用,新项目建议寻找替代方案。