@sisense/sdk-ui 2.23.0 → 2.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/dist/ai.cjs +59 -59
  2. package/dist/ai.js +919 -980
  3. package/dist/analytics-composer/node.cjs +1 -1
  4. package/dist/analytics-composer/node.js +1232 -1220
  5. package/dist/analytics-composer.cjs +1 -1
  6. package/dist/analytics-composer.js +6 -6
  7. package/dist/{execute-query-CHYTupEo.js → apply-styled-options-to-query-BsBTwL6W.js} +1522 -1447
  8. package/dist/apply-styled-options-to-query-mFJvsssw.cjs +1 -0
  9. package/dist/{index-Dx6wvLd3.cjs → index-BX9p-XrU.cjs} +1 -1
  10. package/dist/{index-DCAC0mJe.js → index-D7mHzfx0.js} +30 -1
  11. package/dist/index.cjs +731 -712
  12. package/dist/index.js +26018 -33110
  13. package/dist/index.umd.js +985 -958
  14. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/types.d.ts +1 -1
  15. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/persist-dashboard-model-middleware.d.ts +17 -5
  16. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/types.d.ts +4 -1
  17. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/duplicate-widget/use-duplicate-widget-menu-item.d.ts +1 -1
  18. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/rename-widget/use-widget-renaming.d.ts +1 -1
  19. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/use-widget-csv-download.d.ts +24 -0
  20. package/dist/packages/sdk-ui/src/domains/dashboarding/index.d.ts +2 -0
  21. package/dist/packages/sdk-ui/src/domains/dashboarding/persistence/persistence-manager.d.ts +11 -0
  22. package/dist/packages/sdk-ui/src/domains/dashboarding/persistence/types.d.ts +52 -0
  23. package/dist/packages/sdk-ui/src/domains/dashboarding/types.d.ts +25 -28
  24. package/dist/packages/sdk-ui/src/domains/dashboarding/use-composed-dashboard.d.ts +4 -2
  25. package/dist/packages/sdk-ui/src/domains/narrative/components/narrative-collapsible.d.ts +13 -0
  26. package/dist/packages/sdk-ui/src/domains/narrative/components/narrative-top-slot-shell.d.ts +21 -0
  27. package/dist/packages/sdk-ui/src/domains/narrative/components/widget-narrative-interactive.d.ts +11 -0
  28. package/dist/packages/sdk-ui/src/domains/narrative/components/widget-narrative.d.ts +40 -0
  29. package/dist/packages/sdk-ui/src/domains/narrative/core/build-narrative-request.d.ts +36 -0
  30. package/dist/packages/sdk-ui/src/domains/narrative/core/get-narrative-dimensions-and-measures.d.ts +22 -0
  31. package/dist/packages/sdk-ui/src/domains/narrative/core/widget-narrative-options.d.ts +28 -0
  32. package/dist/packages/sdk-ui/src/domains/narrative/core/widget-props-to-narrative-params.d.ts +36 -0
  33. package/dist/packages/sdk-ui/src/domains/narrative/hooks/use-get-widget-narrative.d.ts +62 -0
  34. package/dist/packages/sdk-ui/src/domains/narrative/hooks/use-widget-narrative-state.d.ts +39 -0
  35. package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/helpers/use-translated-data-options.d.ts +12 -1
  36. package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-data-options/apply-styled-options-to-query.d.ts +87 -0
  37. package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-data-options/translate-data-options.d.ts +13 -1
  38. package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/compose-code-to-readable.d.ts +12 -0
  39. package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/index.d.ts +6 -0
  40. package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-definition.d.ts +26 -0
  41. package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-params-to-view-model.d.ts +12 -0
  42. package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-pill-bubble-tooltip.d.ts +12 -0
  43. package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-pill.d.ts +13 -0
  44. package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/types.d.ts +51 -0
  45. package/dist/packages/sdk-ui/src/domains/widgets/components/chart-widget/use-chart-widget-csv-download.d.ts +18 -0
  46. package/dist/packages/sdk-ui/src/domains/widgets/components/custom-widget/use-custom-widget-csv-download.d.ts +15 -0
  47. package/dist/packages/sdk-ui/src/domains/widgets/components/pivot-table-widget/use-pivot-widget-csv-download.d.ts +18 -0
  48. package/dist/packages/sdk-ui/src/domains/widgets/components/tabber-buttons-widget/types.d.ts +8 -8
  49. package/dist/packages/sdk-ui/src/domains/widgets/components/widget/types.d.ts +21 -1
  50. package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-widget-style-options/to-widget-dto-style.d.ts +59 -2
  51. package/dist/packages/sdk-ui/src/domains/widgets/hooks/use-csv-query-file-loader.d.ts +16 -0
  52. package/dist/packages/sdk-ui/src/domains/widgets/hooks/use-with-csv-download-menu-item.d.ts +22 -0
  53. package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-header/widget-menu-button.d.ts +1 -1
  54. package/dist/packages/sdk-ui/src/domains/widgets/widget-model/widget-model-translator/utils.d.ts +9 -0
  55. package/dist/packages/sdk-ui/src/domains/widgets/widget-model/widget-model-translator/widget-model-translator.d.ts +5 -2
  56. package/dist/packages/sdk-ui/src/infra/api/narrative/narrative-api-types.d.ts +32 -0
  57. package/dist/packages/sdk-ui/src/infra/api/narrative/narrative-constants.d.ts +6 -0
  58. package/dist/packages/sdk-ui/src/{modules/ai/api/narration-endpoints.d.ts → infra/api/narrative/narrative-endpoints.d.ts} +8 -7
  59. package/dist/packages/sdk-ui/src/infra/api/narrative/send-ai-feedback.d.ts +8 -0
  60. package/dist/packages/sdk-ui/src/infra/app/client-application.d.ts +2 -2
  61. package/dist/packages/sdk-ui/src/infra/contexts/custom-widgets-provider/custom-widgets-provider-adapter.d.ts +2 -1
  62. package/dist/packages/sdk-ui/src/infra/contexts/custom-widgets-provider/use-custom-widgets.d.ts +11 -4
  63. package/dist/packages/sdk-ui/src/infra/contexts/emotion-cache-provider/emotion-cache-provider.d.ts +31 -3
  64. package/dist/packages/sdk-ui/src/infra/contexts/emotion-cache-provider/stylis-plugins/css-selector-prefix-plugin.d.ts +18 -0
  65. package/dist/packages/sdk-ui/src/infra/plugins/custom-plugin-context-provider.d.ts +18 -0
  66. package/dist/packages/sdk-ui/src/infra/plugins/plugin-context.d.ts +29 -0
  67. package/dist/packages/sdk-ui/src/infra/{contexts/plugin-provider → plugins}/plugin-provider.d.ts +4 -2
  68. package/dist/packages/sdk-ui/src/infra/{contexts/plugin-provider → plugins}/types.d.ts +12 -4
  69. package/dist/packages/sdk-ui/src/infra/plugins/use-widget-plugin-registry.d.ts +7 -0
  70. package/dist/packages/sdk-ui/src/infra/{contexts/plugin-provider → plugins}/validate-plugins.d.ts +1 -1
  71. package/dist/packages/sdk-ui/src/infra/plugins/widget-plugins/types.d.ts +302 -0
  72. package/dist/packages/sdk-ui/src/infra/plugins/widget-plugins/widget-plugin-registry.d.ts +33 -0
  73. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/de-de.d.ts +29 -0
  74. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/en-us.d.ts +29 -0
  75. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/es-ar.d.ts +29 -0
  76. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/es-es.d.ts +29 -0
  77. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/fr-fr.d.ts +29 -0
  78. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/it-it.d.ts +29 -0
  79. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ja-jp.d.ts +29 -0
  80. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ko-kr.d.ts +29 -0
  81. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/nl-nl.d.ts +29 -0
  82. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/pt-br.d.ts +29 -0
  83. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ru-ru.d.ts +29 -0
  84. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/tr-tr.d.ts +29 -0
  85. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/zh-cn.d.ts +29 -0
  86. package/dist/packages/sdk-ui/src/infra/translation/resources/en.d.ts +29 -0
  87. package/dist/packages/sdk-ui/src/infra/translation/resources/index.d.ts +58 -0
  88. package/dist/packages/sdk-ui/src/modules/ai/api/chat-rest-api.d.ts +1 -1
  89. package/dist/packages/sdk-ui/src/modules/ai/api/types.d.ts +5 -18
  90. package/dist/packages/sdk-ui/src/modules/ai/chart/nlq-chart-widget.d.ts +2 -0
  91. package/dist/packages/sdk-ui/src/modules/ai/common/collapsible.d.ts +3 -0
  92. package/dist/packages/sdk-ui/src/modules/ai/get-nlg-insights-from-widget.d.ts +5 -13
  93. package/dist/packages/sdk-ui/src/modules/ai/index.d.ts +1 -1
  94. package/dist/packages/sdk-ui/src/modules/ai/use-get-nlg-insights.d.ts +4 -26
  95. package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/expression/custom-formula/validate-custom-formula.d.ts +15 -3
  96. package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/expression/formula-function-schemas.d.ts +22 -6
  97. package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/utils/schema-index.d.ts +5 -2
  98. package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/types.d.ts +3 -7
  99. package/dist/packages/sdk-ui/src/props.d.ts +20 -2
  100. package/dist/packages/sdk-ui/src/public-api/internal.d.ts +2 -0
  101. package/dist/packages/sdk-ui/src/public-api/public.d.ts +1 -1
  102. package/dist/packages/sdk-ui/src/public-api/sisense-internal.d.ts +9 -1
  103. package/dist/packages/sdk-ui/src/shared/const.d.ts +5 -0
  104. package/dist/packages/sdk-ui/src/shared/types/menu-item.d.ts +5 -1
  105. package/dist/packages/sdk-ui/src/shared/utils/menu-item-converters.d.ts +12 -0
  106. package/dist/packages/sdk-ui/src/types.d.ts +1 -1
  107. package/dist/parse-compose-code-DfZskSng.js +352 -0
  108. package/dist/parse-compose-code-v4J9BrUg.cjs +1 -0
  109. package/dist/translations/de-de.cjs +1 -1
  110. package/dist/translations/de-de.js +31 -2
  111. package/dist/translations/en-us.cjs +1 -1
  112. package/dist/translations/en-us.js +1 -1
  113. package/dist/translations/es-ar.cjs +1 -1
  114. package/dist/translations/es-ar.js +31 -2
  115. package/dist/translations/es-es.cjs +1 -1
  116. package/dist/translations/es-es.js +31 -2
  117. package/dist/translations/fr-fr.cjs +1 -1
  118. package/dist/translations/fr-fr.js +31 -2
  119. package/dist/translations/it-it.cjs +1 -1
  120. package/dist/translations/it-it.js +31 -2
  121. package/dist/translations/ja-jp.cjs +1 -1
  122. package/dist/translations/ja-jp.js +31 -2
  123. package/dist/translations/ko-kr.cjs +1 -1
  124. package/dist/translations/ko-kr.js +31 -2
  125. package/dist/translations/nl-nl.cjs +1 -1
  126. package/dist/translations/nl-nl.js +31 -2
  127. package/dist/translations/pt-br.cjs +1 -1
  128. package/dist/translations/pt-br.js +31 -2
  129. package/dist/translations/ru-ru.cjs +1 -1
  130. package/dist/translations/ru-ru.js +31 -2
  131. package/dist/translations/tr-tr.cjs +1 -1
  132. package/dist/translations/tr-tr.js +31 -2
  133. package/dist/translations/zh-cn.cjs +1 -1
  134. package/dist/translations/zh-cn.js +31 -2
  135. package/dist/{types-B96nVbgX.js → types-BBp2sp_s.js} +1 -1
  136. package/dist/types-GFLaiax5.cjs +1 -0
  137. package/dist/use-hover-DsnmY-p_.cjs +721 -0
  138. package/dist/{quota-notification-CVl0isIV.js → use-hover-mptQLQ4S.js} +27865 -19277
  139. package/dist/{utils-CgV-jWWQ.cjs → utils-BlNqPAG8.cjs} +45 -45
  140. package/dist/{utils-ChqSLRbz.js → utils-DTUC-wtI.js} +7729 -7513
  141. package/dist/{widget-composer-Blul90Zb.cjs → widget-composer-CDb2iOoS.cjs} +1 -1
  142. package/dist/{widget-composer-Cf_CN3Ux.js → widget-composer-D0BZrLna.js} +3 -3
  143. package/package.json +11 -10
  144. package/dist/dimensions-2t18RSZC.cjs +0 -1
  145. package/dist/dimensions-C0BmtTH2.js +0 -204
  146. package/dist/execute-query-DmAyVFF5.cjs +0 -1
  147. package/dist/packages/sdk-ui/src/infra/contexts/plugin-provider/index.d.ts +0 -5
  148. package/dist/packages/sdk-ui/src/infra/contexts/plugin-provider/plugin-context.d.ts +0 -15
  149. package/dist/packages/sdk-ui/src/infra/styled/index.d.ts +0 -4
  150. package/dist/packages/sdk-ui/src/infra/styled/with-css-selector-prefix.d.ts +0 -2
  151. package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/query/constants.d.ts +0 -8
  152. package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/utils/parse-compose-code.d.ts +0 -15
  153. package/dist/quota-notification-RAaHp-eO.cjs +0 -713
  154. package/dist/types-DZ4vWh8j.cjs +0 -1
@@ -1,4 +1,4 @@
1
- import { CustomWidgetComponent } from './types';
1
+ import { CustomWidgetComponent, CustomWidgetComponentProps } from './types';
2
2
  /**
3
3
  * Hook that provides API for configuring custom widgets.
4
4
  *
@@ -18,8 +18,15 @@ import { CustomWidgetComponent } from './types';
18
18
  *
19
19
  * @group Dashboards
20
20
  */
21
- export declare const useCustomWidgets: () => {
22
- registerCustomWidget: <T = any>(customWidgetType: string, customWidget: CustomWidgetComponent<T>) => void;
21
+ export declare const useCustomWidgets: () => UseCustomWidgetsResult;
22
+ /**
23
+ * Result of the `useCustomWidgets` hook.
24
+ */
25
+ export type UseCustomWidgetsResult = {
26
+ /** Registers a custom widget. */
27
+ registerCustomWidget: <T = CustomWidgetComponentProps>(customWidgetType: string, customWidget: CustomWidgetComponent<T>) => void;
28
+ /** Checks if a custom widget is registered. */
23
29
  hasCustomWidget: (customWidgetType: string) => boolean;
24
- getCustomWidget: (customWidgetType: string) => CustomWidgetComponent<any> | undefined;
30
+ /** Gets a custom widget. */
31
+ getCustomWidget: (customWidgetType: string) => CustomWidgetComponent | undefined;
25
32
  };
@@ -1,10 +1,38 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  export interface EmotionCacheProviderProps {
3
3
  children: ReactNode;
4
+ /**
5
+ * An ancestor CSS selector (e.g. `'#sdk-scope'`) to prepend to every Emotion
6
+ * CSS rule to increase specificity.
7
+ *
8
+ * When omitted (`undefined`), no prefix logic is applied.
9
+ */
10
+ cssSelectorPrefix?: string;
4
11
  }
5
12
  /**
6
- * A provider component that uses the Emotion cache, but only creates one if a nonce is found in the DOM.
7
- * This ensures that styles are injected in a way that is compliant with CSP if necessary.
8
- * If no nonce is found, it simply renders the children without the CacheProvider.
13
+ * Provides an Emotion cache to the component tree. Handles two concerns:
14
+ *
15
+ * 1. **CSP nonce** when a `<meta property="csp-nonce">` tag is present, a
16
+ * cache carrying that nonce is created so Emotion's `<style>` tags comply
17
+ * with Content Security Policy.
18
+ *
19
+ * 2. **CSS selector prefix** — when `cssSelectorPrefix` is provided, a Stylis
20
+ * plugin is installed that prepends the selector to every compiled CSS rule,
21
+ * increasing specificity so CSDK styles win over host-app overrides.
22
+ *
23
+ * The component is designed to be used at two levels:
24
+ *
25
+ * - **Top-level** (in `SisenseContextProvider`, no `cssSelectorPrefix` prop) —
26
+ * creates a nonce-only cache if needed and establishes the internal context
27
+ * so nested instances can detect they are not the first provider.
28
+ *
29
+ * - **Nested** (in `ThemeProvider`, with `cssSelectorPrefix` prop) — compares
30
+ * the requested prefix against the ancestor's value via `EmotionCacheContext`.
31
+ * A new cache is created only when the prefix has actually changed; otherwise
32
+ * children are rendered as-is, reusing the ancestor's cache.
33
+ *
34
+ * When a nested provider creates a cache (nonce is always included when present),
35
+ * it also updates `EmotionCacheContext` so that further nested providers can
36
+ * detect the new prefix value and avoid creating duplicate caches.
9
37
  */
10
38
  export declare const EmotionCacheProvider: React.FC<EmotionCacheProviderProps>;
@@ -0,0 +1,18 @@
1
+ import type { Middleware } from 'stylis';
2
+ /**
3
+ * Creates a Stylis plugin that prepends a CSS selector prefix to every rule.
4
+ *
5
+ * Given configured prefix, for example "#sdk-root", a compiled rule like ".css-abc { color: red }"
6
+ * becomes "#sdk-root .css-abc { color: red }", increasing its specificity so
7
+ * that library styles win over same-specificity rules from the host application.
8
+ *
9
+ * Operating at the Stylis (CSS compilation) layer means all CSS is covered —
10
+ * template strings, interpolation functions, object styles, and keyframe
11
+ * declarations — without any changes to the styled-component call sites.
12
+ *
13
+ * @param prefix - An ancestor CSS selector, e.g. `'#sdk-scope'` or `'.my-app'`.
14
+ * Must match an element that wraps all library components in the DOM.
15
+ * @returns A Stylis v4 middleware function compatible with `@emotion/cache`'s
16
+ * `stylisPlugins` option.
17
+ */
18
+ export declare function createCssSelectorPrefixPlugin(prefix: string): Middleware;
@@ -0,0 +1,18 @@
1
+ import { type PropsWithChildren } from 'react';
2
+ import { CustomContextProviderProps } from '../../types';
3
+ import type { Plugin } from './types.js';
4
+ /** @internal */
5
+ export type CustomPluginContextProviderContext = {
6
+ plugins: Plugin[];
7
+ };
8
+ /** @internal */
9
+ export type CustomPluginContextProviderProps = CustomContextProviderProps<CustomPluginContextProviderContext>;
10
+ /**
11
+ * Custom Plugin Context Provider component that allows passing external plugin context.
12
+ *
13
+ * Specifically designed to serve as a bridge for passing plugin context between an
14
+ * external framework wrapper and child React components.
15
+ *
16
+ * @internal
17
+ */
18
+ export declare const CustomPluginContextProvider: React.FC<PropsWithChildren<CustomPluginContextProviderProps>>;
@@ -0,0 +1,29 @@
1
+ /// <reference types="react" />
2
+ import { WidgetPlugin } from './widget-plugins/types.js';
3
+ import type { WidgetPluginRegistry } from './widget-plugins/widget-plugin-registry.js';
4
+ /**
5
+ * Context for accessing registered plugins
6
+ *
7
+ * @internal
8
+ */
9
+ export interface PluginContextValue {
10
+ /**
11
+ * Validated widget plugin declarations (metadata)
12
+ */
13
+ widgetPlugins: readonly WidgetPlugin[];
14
+ /**
15
+ * Central widget component registry (used for lookup and legacy bridge)
16
+ */
17
+ widgetRegistry: WidgetPluginRegistry;
18
+ }
19
+ /**
20
+ * Error message when a plugin hook/component is used outside PluginProvider.
21
+ * @internal
22
+ */
23
+ export declare const PLUGIN_CONTEXT_MISSING_MESSAGE = "PluginContext is missing. Ensure PluginProvider (or a compatible provider) is an ancestor.";
24
+ /**
25
+ * React context for plugin management.
26
+ * Default is null to avoid a shared WidgetPluginRegistry at module load (cross-test/consumer pollution).
27
+ * PluginProvider supplies a real value; consumers must check for null and throw if missing.
28
+ */
29
+ export declare const PluginContext: import("react").Context<PluginContextValue | null>;
@@ -1,9 +1,9 @@
1
1
  import { type ReactNode } from 'react';
2
- import { Plugin } from './types';
2
+ import { Plugin } from './types.js';
3
3
  /**
4
4
  * Props for PluginProvider component
5
5
  *
6
- * @internal
6
+ * @sisenseInternal
7
7
  */
8
8
  export interface PluginProviderProps {
9
9
  /**
@@ -17,5 +17,7 @@ export interface PluginProviderProps {
17
17
  }
18
18
  /**
19
19
  * Plugin Provider component that validates and provides access to plugins
20
+ *
21
+ * @sisenseInternal
20
22
  */
21
23
  export declare const PluginProvider: React.FC<PluginProviderProps>;
@@ -1,9 +1,10 @@
1
+ import type { WidgetPlugin } from './widget-plugins/types.js';
1
2
  /**
2
- * Plugin with metadata information
3
+ * Base plugin information
3
4
  *
4
- * @internal
5
+ * @sisenseInternal
5
6
  */
6
- export interface Plugin {
7
+ export interface BasePluginInfo {
7
8
  /**
8
9
  * Unique name identifier for the plugin
9
10
  */
@@ -32,7 +33,7 @@ export interface Plugin {
32
33
  /**
33
34
  * Result of plugin validation
34
35
  *
35
- * @internal
36
+ * @sisenseInternal
36
37
  */
37
38
  export interface PluginValidationResult {
38
39
  /**
@@ -48,3 +49,10 @@ export interface PluginValidationResult {
48
49
  */
49
50
  reason?: string;
50
51
  }
52
+ /**
53
+ * Plugin declaration.
54
+ * Currently only widget plugins are supported.
55
+ *
56
+ * @sisenseInternal
57
+ */
58
+ export type Plugin = WidgetPlugin;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Hook for accessing the widget plugin registry.
3
+ * Used internally by the CustomWidget renderer to look up components.
4
+ *
5
+ * @internal
6
+ */
7
+ export declare const useWidgetPluginRegistry: () => import("./widget-plugins/widget-plugin-registry.js").WidgetPluginRegistry;
@@ -1,4 +1,4 @@
1
- import { Plugin } from './types';
1
+ import { Plugin } from './types.js';
2
2
  /**
3
3
  * Validates and returns only valid plugins.
4
4
  *
@@ -0,0 +1,302 @@
1
+ import { FunctionComponent, ReactNode } from 'react';
2
+ import type { DataSource, Filter, FilterRelations } from '@sisense/sdk-data';
3
+ import { AnyObject } from '../../../shared/utils/utility-types';
4
+ import type { AbstractDataPointWithEntries, GenericDataOptions } from '../../../types';
5
+ import type { BasePluginInfo } from '../types';
6
+ /**
7
+ * Widget plugin declaration.
8
+ *
9
+ * @sisenseInternal
10
+ */
11
+ export interface WidgetPlugin<Props = CustomVisualizationProps, StyleOptions = CustomVisualizationStyleOptions> extends BasePluginInfo {
12
+ /**
13
+ * The type of plugin
14
+ */
15
+ pluginType: 'widget';
16
+ /**
17
+ * The custom widget declaration to be registered
18
+ */
19
+ customWidget?: {
20
+ /**
21
+ * The unique name of the custom widget type (used for registration and identification)
22
+ * @example 'my-custom-widget'
23
+ */
24
+ name: string;
25
+ /**
26
+ * The display name of the custom widget type (used for display in the UI)
27
+ * @example 'My Custom Widget'
28
+ */
29
+ displayName: string;
30
+ /**
31
+ * Configuration options for the custom widget
32
+ */
33
+ config?: {
34
+ /**
35
+ * Configuration options for the widget header
36
+ */
37
+ header?: {
38
+ /**
39
+ * Whether the header is visible.
40
+ * If not specified, the header is visible by default.
41
+ * @example true
42
+ */
43
+ visible?: boolean;
44
+ };
45
+ };
46
+ /**
47
+ * Definition of the custom visualization to be rendered in the new custom widget
48
+ */
49
+ visualization: {
50
+ /**
51
+ * The custom visualization component to be rendered in the new custom widget
52
+ */
53
+ Component: CustomVisualization<Props>;
54
+ };
55
+ /**
56
+ * Definition of the design panel for the custom widget
57
+ */
58
+ designPanel?: {
59
+ Component?: DesignPanel<StyleOptions>;
60
+ };
61
+ /**
62
+ * Definition of the data panel for the custom widget
63
+ */
64
+ dataPanel?: {
65
+ /**
66
+ * Configuration options for the data panel
67
+ * @example
68
+ * ```tsx
69
+ * {
70
+ * inputs: [
71
+ * { name: 'category', displayName: 'Category', type: 'dimension' },
72
+ * { name: 'value', displayName: 'Value', type: 'measure' },
73
+ * ],
74
+ * }
75
+ * ```
76
+ */
77
+ config?: {
78
+ /**
79
+ * Inputs for the data panel
80
+ * @example
81
+ * ```tsx
82
+ * [
83
+ * { name: 'category', displayName: 'Category', type: 'dimension' },
84
+ * { name: 'value', displayName: 'Value', type: 'measure' },
85
+ * ]
86
+ * ```
87
+ */
88
+ inputs?: {
89
+ /**
90
+ * The name of the input
91
+ * @example 'category'
92
+ */
93
+ name: string;
94
+ /**
95
+ * The display name of the input
96
+ * @example 'Category'
97
+ */
98
+ displayName?: string;
99
+ /**
100
+ * The type of the input
101
+ */
102
+ type: 'dimension' | 'measure';
103
+ /**
104
+ * The minimum number of items that can be selected
105
+ * @example 1
106
+ */
107
+ minItems?: number;
108
+ /**
109
+ * The maximum number of items that can be selected
110
+ * @example 5
111
+ */
112
+ maxItems?: number;
113
+ /**
114
+ * Whether the items can be sorted
115
+ */
116
+ canSort?: boolean;
117
+ /**
118
+ * Whether the items can be formatted
119
+ */
120
+ canFormat?: boolean;
121
+ }[];
122
+ };
123
+ /**
124
+ * The icon of the custom widget to be displayed in the widget selector
125
+ * @example
126
+ * ```tsx
127
+ * const MyWidgetIcon = () => <PieChartIcon />;
128
+ * ```
129
+ */
130
+ icon?: () => ReactNode;
131
+ };
132
+ };
133
+ }
134
+ /**
135
+ * Props passed to a user-defined custom visualization component.
136
+ *
137
+ * @typeParam DataOptions - The shape of data options for this custom visualization
138
+ * @typeParam StyleOptions - The shape of style options for this custom visualization
139
+ * @typeParam DataPoint - The shape of data points for event handlers
140
+ *
141
+ * @example
142
+ * ```tsx
143
+ * import { CustomVisualization, CustomVisualizationProps, CustomWidgetDataPoint, StyledColumn, StyledMeasureColumn, DataPointEntry, GenericDataOptions} from '@sisense/sdk-ui';
144
+ *
145
+ * interface MyDataOptions extends GenericDataOptions {
146
+ * category: StyledColumn[];
147
+ * value: StyledMeasureColumn[];
148
+ * }
149
+ *
150
+ * interface MyDataPoint extends CustomWidgetDataPoint {
151
+ * entries: {
152
+ * category: DataPointEntry[];
153
+ * value: DataPointEntry[];
154
+ * };
155
+ * }
156
+ *
157
+ * type MyNewChartProps = CustomVisualizationProps<MyDataOptions, {}, MyDataPoint>;
158
+ *
159
+ * const MyNewChart: CustomVisualization<MyNewChartProps> = (props) => {
160
+ * const { dataOptions, onDataPointClick } = props;
161
+ * // ... implementation based on props
162
+ * return <div>My New Awesome Chart</div>;
163
+ * };
164
+ * ```
165
+ *
166
+ * @sisenseInternal
167
+ */
168
+ export interface CustomVisualizationProps<DataOptions = GenericDataOptions, StyleOptions = CustomVisualizationStyleOptions, DataPoint extends AbstractDataPointWithEntries = AbstractDataPointWithEntries> extends CustomVisualizationEventProps<DataPoint> {
169
+ /** Data source for the custom visualization */
170
+ dataSource?: DataSource;
171
+ /** Data options defining what data to display */
172
+ dataOptions: DataOptions;
173
+ /** Style options for customizing appearance */
174
+ styleOptions?: StyleOptions;
175
+ /** Filters to apply to the data */
176
+ filters?: Filter[] | FilterRelations;
177
+ /** Highlight filters for interactive highlighting */
178
+ highlights?: Filter[];
179
+ }
180
+ /**
181
+ * Style options for a custom visualization.
182
+ *
183
+ * @sisenseInternal
184
+ */
185
+ export interface CustomVisualizationStyleOptions extends AnyObject {
186
+ }
187
+ /**
188
+ * A user-defined custom visualization component.
189
+ * This can be any visual representation of the data - chart, table, map, etc.
190
+ *
191
+ * @typeParam Props - The props type for the custom visualization component
192
+ * @sisenseInternal
193
+ */
194
+ export type CustomVisualization<Props = CustomVisualizationProps> = (props: Props) => ReactNode;
195
+ /**
196
+ * Event props for custom visualizations with generic data point type.
197
+ *
198
+ * @typeParam DataPoint - The shape of data points for this custom visualization
199
+ * @sisenseInternal
200
+ */
201
+ export interface CustomVisualizationEventProps<DataPoint extends AbstractDataPointWithEntries = AbstractDataPointWithEntries> {
202
+ /**
203
+ * Click handler callback for a data point
204
+ *
205
+ * @category Callbacks
206
+ */
207
+ onDataPointClick?: CustomVisualizationDataPointEventHandler<DataPoint>;
208
+ /**
209
+ * Context menu handler callback for a data point
210
+ *
211
+ * @category Callbacks
212
+ */
213
+ onDataPointContextMenu?: CustomVisualizationDataPointContextMenuHandler<DataPoint>;
214
+ /**
215
+ * Handler callback for selection of multiple data points
216
+ *
217
+ * @category Callbacks
218
+ */
219
+ onDataPointsSelected?: CustomVisualizationDataPointsEventHandler<DataPoint>;
220
+ }
221
+ /**
222
+ * Generic event handler for custom visualization data point click.
223
+ *
224
+ * @typeParam T - The shape of the data point
225
+ * @example
226
+ * ```tsx
227
+ * const handleClick: CustomVisualizationDataPointEventHandler<MyChartDataPoint> = (point, event) => {
228
+ * console.log('Clicked:', point.label, point.value);
229
+ * };
230
+ * ```
231
+ *
232
+ * @sisenseInternal
233
+ */
234
+ export type CustomVisualizationDataPointEventHandler<T extends AbstractDataPointWithEntries = AbstractDataPointWithEntries> = (point: CustomVisualizationDataPoint<T>, nativeEvent: PointerEvent | MouseEvent) => void;
235
+ /**
236
+ * Represents a single data point in a custom visualization.
237
+ *
238
+ * This type is used to define the structure of a data point that is passed to event handlers
239
+ * like `onDataPointClick`. It typically extends `AbstractDataPointWithEntries` to include
240
+ * specific entries for categories, values, or other dimensions used in the widget.
241
+ *
242
+ * @example
243
+ * ```typescript
244
+ * interface MyChartDataPoint extends CustomVisualizationDataPoint {
245
+ * entries: {
246
+ * category: DataPointEntry[];
247
+ * value: DataPointEntry[];
248
+ * };
249
+ * }
250
+ *
251
+ * const onDataPointClick = (point: MyChartDataPoint) => {
252
+ * console.log('Clicked category:', point.entries.category[0].value);
253
+ * };
254
+ * ```
255
+ *
256
+ * @sisenseInternal
257
+ */
258
+ export type CustomVisualizationDataPoint<T extends AbstractDataPointWithEntries = AbstractDataPointWithEntries> = T;
259
+ /**
260
+ * Generic event handler for custom widget data point context menu.
261
+ *
262
+ * @typeParam T - The shape of the data point
263
+ * @sisenseInternal
264
+ */
265
+ export type CustomVisualizationDataPointContextMenuHandler<T extends AbstractDataPointWithEntries = AbstractDataPointWithEntries> = (
266
+ /** Data point that triggered the context menu */
267
+ point: CustomVisualizationDataPoint<T>,
268
+ /** Native browser event */
269
+ nativeEvent: MouseEvent) => void;
270
+ /**
271
+ * Generic event handler for custom visualization data points selection.
272
+ *
273
+ * @typeParam T - The shape of the data point
274
+ * @example
275
+ * ```tsx
276
+ * const handleSelect: CustomVisualizationDataPointsEventHandler<MyChartDataPoint> = (points, event) => {
277
+ * console.log('Selected:', points.length, 'points');
278
+ * };
279
+ * ```
280
+ *
281
+ * @sisenseInternal
282
+ */
283
+ export type CustomVisualizationDataPointsEventHandler<T extends AbstractDataPointWithEntries = AbstractDataPointWithEntries> = (
284
+ /** Data points that were selected */
285
+ points: CustomVisualizationDataPoint<T>[],
286
+ /** Native browser event */
287
+ nativeEvent: MouseEvent) => void;
288
+ /**
289
+ * Props for the design panel component for the custom widget.
290
+ *
291
+ * @sisenseInternal
292
+ */
293
+ export interface DesignPanelProps<StyleOptions = CustomVisualizationStyleOptions> {
294
+ styleOptions: StyleOptions;
295
+ onChange: (styleOptions: StyleOptions) => void;
296
+ }
297
+ /**
298
+ * The design panel component for the custom widget.
299
+ *
300
+ * @sisenseInternal
301
+ */
302
+ export type DesignPanel<StyleOptions = CustomVisualizationStyleOptions> = FunctionComponent<DesignPanelProps<StyleOptions>>;
@@ -0,0 +1,33 @@
1
+ import type { CustomVisualization } from './types.js';
2
+ /**
3
+ * Central widget registration and lookup.
4
+ * Plugin-sourced entries take priority over legacy-sourced entries.
5
+ *
6
+ * @internal
7
+ */
8
+ export declare class WidgetPluginRegistry {
9
+ private readonly entries;
10
+ /**
11
+ * Register a widget component by type name.
12
+ * Plugin-sourced entries take priority over legacy-sourced entries.
13
+ * Within the same source, first-write-wins (no silent overwrites).
14
+ */
15
+ register(widgetTypeName: string, component: CustomVisualization, source?: 'plugin' | 'legacy'): void;
16
+ /**
17
+ * Unregister a widget by type name and source.
18
+ * Only removes the entry if it matches the given source.
19
+ */
20
+ unregister(widgetTypeName: string, source: 'plugin' | 'legacy'): void;
21
+ /**
22
+ * Get a widget component by type name.
23
+ * When `source` is provided, returns the component only if the entry matches that source.
24
+ * When omitted, returns the component for any source (plugin takes priority over legacy).
25
+ */
26
+ getComponent(widgetTypeName: string, source?: 'plugin' | 'legacy'): CustomVisualization | undefined;
27
+ /**
28
+ * Check if a widget is registered.
29
+ * When `source` is provided, returns true only if an entry exists for that source.
30
+ * When omitted, returns true for any registered entry.
31
+ */
32
+ has(widgetTypeName: string, source?: 'plugin' | 'legacy'): boolean;
33
+ }
@@ -223,6 +223,8 @@ declare const _default: {
223
223
  deleteWidget: string;
224
224
  renameWidget: string;
225
225
  distributeEqualWidth: string;
226
+ download: string;
227
+ csvFile: string;
226
228
  };
227
229
  };
228
230
  customWidgets: {
@@ -407,6 +409,33 @@ declare const _default: {
407
409
  lockGroup: string;
408
410
  unlockGroup: string;
409
411
  };
412
+ toggleSwitch: string;
413
+ };
414
+ chart: {
415
+ indicator: {
416
+ label: string;
417
+ };
418
+ visualization: {
419
+ label: string;
420
+ };
421
+ pivotTable: {
422
+ label: string;
423
+ };
424
+ table: {
425
+ label: string;
426
+ };
427
+ };
428
+ loadingOverlay: {
429
+ label: string;
430
+ };
431
+ queryDefinition: {
432
+ showMorePills: string;
433
+ showLess: string;
434
+ connectorBy: string;
435
+ connectorWhere: string;
436
+ tooltipType: string;
437
+ tooltipColumn: string;
438
+ tooltipFormula: string;
410
439
  };
411
440
  measures: {
412
441
  countShort: string;
@@ -223,6 +223,8 @@ declare const _default: {
223
223
  deleteWidget: string;
224
224
  renameWidget: string;
225
225
  distributeEqualWidth: string;
226
+ download: string;
227
+ csvFile: string;
226
228
  };
227
229
  };
228
230
  customWidgets: {
@@ -407,6 +409,33 @@ declare const _default: {
407
409
  lockGroup: string;
408
410
  unlockGroup: string;
409
411
  };
412
+ toggleSwitch: string;
413
+ };
414
+ chart: {
415
+ indicator: {
416
+ label: string;
417
+ };
418
+ visualization: {
419
+ label: string;
420
+ };
421
+ pivotTable: {
422
+ label: string;
423
+ };
424
+ table: {
425
+ label: string;
426
+ };
427
+ };
428
+ loadingOverlay: {
429
+ label: string;
430
+ };
431
+ queryDefinition: {
432
+ showMorePills: string;
433
+ showLess: string;
434
+ connectorBy: string;
435
+ connectorWhere: string;
436
+ tooltipType: string;
437
+ tooltipColumn: string;
438
+ tooltipFormula: string;
410
439
  };
411
440
  measures: {
412
441
  countShort: string;
@@ -223,6 +223,8 @@ declare const _default: {
223
223
  deleteWidget: string;
224
224
  renameWidget: string;
225
225
  distributeEqualWidth: string;
226
+ download: string;
227
+ csvFile: string;
226
228
  };
227
229
  };
228
230
  customWidgets: {
@@ -407,6 +409,33 @@ declare const _default: {
407
409
  lockGroup: string;
408
410
  unlockGroup: string;
409
411
  };
412
+ toggleSwitch: string;
413
+ };
414
+ chart: {
415
+ indicator: {
416
+ label: string;
417
+ };
418
+ visualization: {
419
+ label: string;
420
+ };
421
+ pivotTable: {
422
+ label: string;
423
+ };
424
+ table: {
425
+ label: string;
426
+ };
427
+ };
428
+ loadingOverlay: {
429
+ label: string;
430
+ };
431
+ queryDefinition: {
432
+ showMorePills: string;
433
+ showLess: string;
434
+ connectorBy: string;
435
+ connectorWhere: string;
436
+ tooltipType: string;
437
+ tooltipColumn: string;
438
+ tooltipFormula: string;
410
439
  };
411
440
  measures: {
412
441
  countShort: string;