@sisense/sdk-ui 2.21.0 → 2.22.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 (136) hide show
  1. package/dist/ai.cjs +58 -58
  2. package/dist/ai.js +863 -846
  3. package/dist/analytics-composer/node.cjs +1 -1
  4. package/dist/analytics-composer/node.js +718 -709
  5. package/dist/analytics-composer.cjs +1 -1
  6. package/dist/analytics-composer.js +6 -6
  7. package/dist/{dimensions-DuUqQgpi.js → dimensions-BiLyFpCg.js} +1 -1
  8. package/dist/{dimensions-DVGn8ORR.cjs → dimensions-X4_igtmO.cjs} +1 -1
  9. package/dist/{execute-query-B21bnb05.js → execute-query-BEeqqDl6.js} +1483 -1490
  10. package/dist/execute-query-DJDE0zRU.cjs +1 -0
  11. package/dist/{index-0brX9D6q.cjs → index-NyouhE_A.cjs} +1 -1
  12. package/dist/{index-Ck90GjPy.js → index-kxX21arA.js} +15 -1
  13. package/dist/index.cjs +404 -404
  14. package/dist/index.js +22869 -21774
  15. package/dist/index.umd.js +644 -644
  16. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/index.d.ts +1 -1
  17. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/translate-dashboard-utils.d.ts +8 -1
  18. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/types.d.ts +9 -2
  19. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/index.d.ts +4 -0
  20. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/persist-dashboard-model-middleware.d.ts +13 -0
  21. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/{use-dashboard-model-reducer.d.ts → dashboard-model-reducer/types.d.ts} +19 -36
  22. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/use-dashboard-model-reducer.d.ts +9 -0
  23. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/utils.d.ts +28 -0
  24. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/use-dashboard-persistence.d.ts +4 -4
  25. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/duplicate-widget/duplicate-widget-utils.d.ts +34 -0
  26. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/duplicate-widget/index.d.ts +2 -0
  27. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/duplicate-widget/use-duplicate-widget-menu-item.d.ts +57 -0
  28. package/dist/packages/sdk-ui/src/domains/dashboarding/types.d.ts +43 -2
  29. package/dist/packages/sdk-ui/src/domains/dashboarding/use-composed-dashboard.d.ts +15 -3
  30. package/dist/packages/sdk-ui/src/domains/filters/components/cascading-filter-tile/cascading-filter-tile.d.ts +7 -0
  31. package/dist/packages/sdk-ui/src/domains/filters/components/cascading-filter-tile/cascading-level-filter.d.ts +4 -1
  32. package/dist/packages/sdk-ui/src/domains/filters/components/cascading-filter-tile/use-cascadding-filter-tile-menu-items/use-cascadding-filter-tile-lock-menu-item.d.ts +13 -0
  33. package/dist/packages/sdk-ui/src/domains/filters/components/cascading-filter-tile/use-cascadding-filter-tile-menu-items/use-cascadding-filter-tile-menu-items.d.ts +14 -0
  34. package/dist/packages/sdk-ui/src/domains/filters/components/criteria-filter-tile/criteria-filter-tile.d.ts +7 -0
  35. package/dist/packages/sdk-ui/src/domains/filters/components/custom-filter-tile.d.ts +7 -0
  36. package/dist/packages/sdk-ui/src/domains/filters/components/date-filter/date-range-filter-tile/date-range-filter-tile.d.ts +7 -0
  37. package/dist/packages/sdk-ui/src/domains/filters/components/date-filter/relative-date-filter-tile/relative-date-filter-tile.d.ts +7 -0
  38. package/dist/packages/sdk-ui/src/domains/filters/components/{filter-tile.d.ts → filter-tile/filter-tile.d.ts} +7 -0
  39. package/dist/packages/sdk-ui/src/domains/filters/components/filter-tile/index.d.ts +1 -0
  40. package/dist/packages/sdk-ui/src/domains/filters/components/filter-tile/types.d.ts +36 -0
  41. package/dist/packages/sdk-ui/src/domains/filters/components/filter-tile-container.d.ts +6 -0
  42. package/dist/packages/sdk-ui/src/domains/filters/components/filters-panel/types.d.ts +13 -0
  43. package/dist/packages/sdk-ui/src/domains/filters/components/index.d.ts +1 -1
  44. package/dist/packages/sdk-ui/src/domains/filters/components/member-filter-tile/member-filter-tile.d.ts +7 -0
  45. package/dist/packages/sdk-ui/src/domains/filters/components/unsupported-filter-tile.d.ts +10 -1
  46. package/dist/packages/sdk-ui/src/domains/filters/shared/clone-filter-and-toggle-locked.d.ts +7 -0
  47. package/dist/packages/sdk-ui/src/domains/filters/shared/filter-tile-menu-button.d.ts +10 -0
  48. package/dist/packages/sdk-ui/src/domains/filters/shared/use-filter-tile-menu-items/use-filter-tile-lock-menu-item.d.ts +15 -0
  49. package/dist/packages/sdk-ui/src/domains/filters/shared/use-filter-tile-menu-items/use-filter-tile-menu-items.d.ts +14 -0
  50. package/dist/packages/sdk-ui/src/domains/formulas/index.d.ts +0 -1
  51. package/dist/packages/sdk-ui/src/domains/formulas/use-get-shared-formula.d.ts +20 -7
  52. package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-widget-style-options/index.d.ts +1 -0
  53. package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-widget-style-options/to-widget-dto-style.d.ts +63 -0
  54. package/dist/packages/sdk-ui/src/domains/widgets/helpers/header-menu-utils.d.ts +1 -1
  55. package/dist/packages/sdk-ui/src/domains/widgets/helpers/index.d.ts +1 -1
  56. package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-header/types.d.ts +1 -17
  57. package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-header/widget-menu-button.d.ts +1 -1
  58. package/dist/packages/sdk-ui/src/infra/api/types/dashboard-dto.d.ts +2 -1
  59. package/dist/packages/sdk-ui/src/infra/app/client-application.d.ts +17 -0
  60. package/dist/packages/sdk-ui/src/infra/app/settings/settings.d.ts +3 -0
  61. package/dist/packages/sdk-ui/src/infra/app/settings/types/deployment-props.d.ts +1 -1
  62. package/dist/packages/sdk-ui/src/infra/app/settings/types/features.d.ts +18 -1
  63. package/dist/packages/sdk-ui/src/infra/contexts/plugin-provider/index.d.ts +5 -0
  64. package/dist/packages/sdk-ui/src/infra/contexts/plugin-provider/plugin-context.d.ts +15 -0
  65. package/dist/packages/sdk-ui/src/infra/contexts/plugin-provider/plugin-provider.d.ts +21 -0
  66. package/dist/packages/sdk-ui/src/infra/contexts/plugin-provider/types.d.ts +50 -0
  67. package/dist/packages/sdk-ui/src/infra/contexts/plugin-provider/validate-plugins.d.ts +9 -0
  68. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/de-de.d.ts +14 -0
  69. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/en-us.d.ts +14 -0
  70. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/es-ar.d.ts +14 -0
  71. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/es-es.d.ts +14 -0
  72. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/fr-fr.d.ts +14 -0
  73. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/it-it.d.ts +14 -0
  74. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ja-jp.d.ts +14 -0
  75. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ko-kr.d.ts +14 -0
  76. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/nl-nl.d.ts +14 -0
  77. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/pt-br.d.ts +14 -0
  78. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ru-ru.d.ts +14 -0
  79. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/tr-tr.d.ts +14 -0
  80. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/zh-cn.d.ts +14 -0
  81. package/dist/packages/sdk-ui/src/infra/translation/resources/en.d.ts +14 -0
  82. package/dist/packages/sdk-ui/src/infra/translation/resources/index.d.ts +28 -0
  83. package/dist/packages/sdk-ui/src/modules/ai/api/chat-rest-api.d.ts +2 -1
  84. package/dist/packages/sdk-ui/src/modules/ai/api/narration-endpoints.d.ts +2 -1
  85. package/dist/packages/sdk-ui/src/modules/ai/get-nlg-insights-from-widget.d.ts +1 -0
  86. package/dist/packages/sdk-ui/src/props.d.ts +13 -20
  87. package/dist/packages/sdk-ui/src/public-api/internal.d.ts +1 -0
  88. package/dist/packages/sdk-ui/src/public-api/public.d.ts +2 -2
  89. package/dist/packages/sdk-ui/src/public-api/sisense-internal.d.ts +6 -0
  90. package/dist/packages/sdk-ui/src/shared/components/alert/alert.d.ts +91 -0
  91. package/dist/packages/sdk-ui/src/shared/components/alert/index.d.ts +2 -0
  92. package/dist/packages/sdk-ui/src/shared/components/menu/menu-button.d.ts +2 -1
  93. package/dist/packages/sdk-ui/src/shared/components/quota-notification/quota-notification.d.ts +32 -0
  94. package/dist/packages/sdk-ui/src/shared/hooks/use-app-settings.d.ts +11 -0
  95. package/dist/packages/sdk-ui/src/shared/hooks/use-quota-notification.d.ts +54 -0
  96. package/dist/packages/sdk-ui/src/shared/hooks/use-quota-warning-dismissed.d.ts +8 -0
  97. package/dist/packages/sdk-ui/src/shared/icons/warning-icon.d.ts +6 -0
  98. package/dist/packages/sdk-ui/src/shared/icons/x-circle-icon.d.ts +6 -0
  99. package/dist/packages/sdk-ui/src/shared/types/menu-item.d.ts +17 -0
  100. package/dist/{use-common-filters-DBqRT0et.js → quota-notification-D6oMJal8.js} +10460 -10234
  101. package/dist/{use-common-filters-CXJN3RSs.cjs → quota-notification-z3dv2KoH.cjs} +129 -129
  102. package/dist/translations/de-de.cjs +1 -1
  103. package/dist/translations/de-de.js +16 -2
  104. package/dist/translations/en-us.cjs +1 -1
  105. package/dist/translations/en-us.js +1 -1
  106. package/dist/translations/es-ar.cjs +1 -1
  107. package/dist/translations/es-ar.js +16 -2
  108. package/dist/translations/es-es.cjs +1 -1
  109. package/dist/translations/es-es.js +16 -2
  110. package/dist/translations/fr-fr.cjs +1 -1
  111. package/dist/translations/fr-fr.js +16 -2
  112. package/dist/translations/it-it.cjs +1 -1
  113. package/dist/translations/it-it.js +16 -2
  114. package/dist/translations/ja-jp.cjs +1 -1
  115. package/dist/translations/ja-jp.js +16 -2
  116. package/dist/translations/ko-kr.cjs +1 -1
  117. package/dist/translations/ko-kr.js +16 -2
  118. package/dist/translations/nl-nl.cjs +1 -1
  119. package/dist/translations/nl-nl.js +16 -2
  120. package/dist/translations/pt-br.cjs +1 -1
  121. package/dist/translations/pt-br.js +16 -2
  122. package/dist/translations/ru-ru.cjs +1 -1
  123. package/dist/translations/ru-ru.js +16 -2
  124. package/dist/translations/tr-tr.cjs +1 -1
  125. package/dist/translations/tr-tr.js +16 -2
  126. package/dist/translations/zh-cn.cjs +1 -1
  127. package/dist/translations/zh-cn.js +16 -2
  128. package/dist/{types-Ch9J6ycn.cjs → types-CoY6F8Ma.cjs} +1 -1
  129. package/dist/{types-Ockb-LJ0.js → types-ixSwJkxM.js} +1 -1
  130. package/dist/{utils-BXDqo_yg.js → utils-BP-BglHE.js} +4181 -4157
  131. package/dist/{utils-DH69_bUK.cjs → utils-C8YMrOdw.cjs} +36 -36
  132. package/dist/{widget-composer-DfVCQL2G.js → widget-composer-CUUFoCb9.js} +3 -3
  133. package/dist/{widget-composer-DgCWcMJ1.cjs → widget-composer-DI4sHaNe.cjs} +3 -3
  134. package/package.json +10 -9
  135. package/dist/execute-query-BIkhszY1.cjs +0 -1
  136. /package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/{use-dasboard-model-utils.d.ts → use-dashboard-model-utils.d.ts} +0 -0
@@ -6,5 +6,5 @@ export * from './use-get-dashboard-models';
6
6
  export * from './dashboard-model';
7
7
  export * as dashboardModelTranslator from './dashboard-model-translator';
8
8
  export * from './use-dashboard-model/use-dashboard-model';
9
- export * from './use-dashboard-model/use-dashboard-model-reducer';
9
+ export * from './use-dashboard-model/dashboard-model-reducer';
10
10
  export * from './use-dashboard-model/use-dashboard-persistence';
@@ -4,7 +4,7 @@ import { TabbersConfig } from '../../../domains/dashboarding/hooks/use-tabber';
4
4
  import { Panel, WidgetDto } from '../../../domains/widgets/components/widget-by-id/types';
5
5
  import { RestApi } from '../../../infra/api/rest-api';
6
6
  import { type CascadingFilterDto, DashboardDto, type FilterDto, type LayoutDto } from '../../../infra/api/types/dashboard-dto';
7
- import type { WidgetsOptions, WidgetsPanelColumnLayout } from './types';
7
+ import type { SpecificWidgetOptions, WidgetsOptions, WidgetsPanelColumnLayout } from './types';
8
8
  export declare const translateLayout: (layout: LayoutDto) => WidgetsPanelColumnLayout;
9
9
  export declare function extractDashboardFilters(dashboardFilters: Array<FilterDto | CascadingFilterDto>, filterRelationsModel?: FilterRelationsModel | FilterRelationsModelNode): Filter[] | FilterRelations;
10
10
  export declare const getJtdNavigateType: (widget: WidgetDto) => TriggerMethod;
@@ -20,6 +20,13 @@ export declare function extractPivotTargetsConfigFromWidgetDto(widget: WidgetDto
20
20
  location: 'row' | 'column' | 'value';
21
21
  } | Measure, JtdTarget[]> | undefined;
22
22
  export declare function translateWidgetsOptions(widgets?: WidgetDto[]): WidgetsOptions;
23
+ /**
24
+ * Applies {@link SpecificWidgetOptions} to a {@link WidgetDto}.
25
+ * Merges filtersOptions and jtdConfig into the DTO for persistence.
26
+ *
27
+ * @internal
28
+ */
29
+ export declare function withSpecificWidgetOptions(widgetOptions?: SpecificWidgetOptions): (widgetDto: WidgetDto) => WidgetDto;
23
30
  export declare function translateTabbersOptions(widgets?: WidgetDto[]): TabbersConfig;
24
31
  /**
25
32
  * Replace all shared formulas, which defined by id references, in the dashboard with their actual values.
@@ -74,13 +74,20 @@ export type DashboardId = string;
74
74
  *
75
75
  * For example, how common filters defined at the dashboard level should be applied to widgets.
76
76
  */
77
- export type WidgetsOptions = Record<WidgetId, {
77
+ export type WidgetsOptions = Record<WidgetId, SpecificWidgetOptions>;
78
+ /**
79
+ * Options for a specific widget
80
+ */
81
+ export type SpecificWidgetOptions = {
82
+ /**
83
+ * Options for common filters defined at the dashboard level to be applied to certain widgets.
84
+ */
78
85
  filtersOptions?: CommonFiltersOptions;
79
86
  /**
80
87
  * Jump To Dashboard config for widgets.
81
88
  */
82
89
  jtdConfig?: JumpToDashboardConfig | JumpToDashboardConfigForPivot;
83
- }>;
90
+ };
84
91
  /**
85
92
  * Style options for the dashboard.
86
93
  */
@@ -0,0 +1,4 @@
1
+ export * from './use-dashboard-model-reducer.js';
2
+ export * from './persist-dashboard-model-middleware.js';
3
+ export * from './types.js';
4
+ export * from './utils.js';
@@ -0,0 +1,13 @@
1
+ import { RestApi } from '../../../../../infra/api/rest-api';
2
+ import { UseDashboardModelInternalAction } from './types.js';
3
+ /**
4
+ * Middleware that persists the dashboard model changes to the Sisense server.
5
+ *
6
+ * @param dashboardOid - Dashboard OID, or undefined if not initialized
7
+ * @param action - Internal dashboard model action to persist
8
+ * @param restApi - Sisense REST API instance
9
+ * @param sharedMode - Whether the dashboard is in shared mode
10
+ * @returns Promise resolving to the action (possibly transformed, e.g. for ADD_WIDGET)
11
+ * @internal
12
+ */
13
+ export declare function persistDashboardModelMiddleware(dashboardOid: string | undefined, action: UseDashboardModelInternalAction, restApi: RestApi, sharedMode: boolean): Promise<UseDashboardModelInternalAction>;
@@ -1,7 +1,6 @@
1
1
  import { Filter, FilterRelations } from '@sisense/sdk-data';
2
- import { DashboardModel, WidgetsPanelLayout } from '../../../../domains/dashboarding/dashboard-model';
3
- import { WidgetModel } from '../../../../domains/widgets/widget-model';
4
- import { RestApi } from '../../../../infra/api/rest-api';
2
+ import { DashboardModel, SpecificWidgetOptions, WidgetsPanelLayout } from '../../../../../domains/dashboarding/dashboard-model';
3
+ import { WidgetModel } from '../../../../../domains/widgets/widget-model';
5
4
  export type UseDashboardModelState = DashboardModel | null;
6
5
  /**
7
6
  * Internal action types for the dashboard model state used in {@link useDashboardModel}.
@@ -55,12 +54,23 @@ export type UseDashboardModelFilterUpdateAction = {
55
54
  };
56
55
  /**
57
56
  * Add widget action for the dashboard model state used in {@link useDashboardModel}.
57
+ * If widgetsPanelLayout is not provided, the widget will be appended to the first cell of the first column.
58
58
  *
59
- * @internal
59
+ * WidgetModel plain payload will be deprecated in the future.
60
+ * Instead, use the following payload:
61
+ * {
62
+ * widget: WidgetModel;
63
+ * widgetsPanelLayout?: WidgetsPanelLayout;
64
+ * widgetOptions?: SpecificWidgetOptions;
65
+ * }
60
66
  */
61
67
  export type UseDashboardModelAddWidgetAction = {
62
68
  type: UseDashboardModelActionType.ADD_WIDGET;
63
- payload: WidgetModel;
69
+ payload: WidgetModel | {
70
+ widget: WidgetModel;
71
+ widgetsPanelLayout?: WidgetsPanelLayout;
72
+ widgetOptions?: SpecificWidgetOptions;
73
+ };
64
74
  };
65
75
  /**
66
76
  * Layout update action for the dashboard model state used in {@link useDashboardModel}.
@@ -72,7 +82,9 @@ export type UseDashboardModelLayoutUpdateAction = {
72
82
  payload: WidgetsPanelLayout;
73
83
  };
74
84
  /**
75
- * Layout update action for the dashboard model state used in {@link useDashboardModel}.
85
+ * Widgets delete action for the dashboard model state used in {@link useDashboardModel}.
86
+ * {@link UseDashboardWidgetsDeleteAction} is dispatched with
87
+ * {@link UseDashboardModelActionType.WIDGETS_DELETE}.
76
88
  *
77
89
  * @internal
78
90
  */
@@ -80,33 +92,4 @@ export type UseDashboardWidgetsDeleteAction = {
80
92
  type: UseDashboardModelActionType.WIDGETS_DELETE;
81
93
  payload: string[];
82
94
  };
83
- /**
84
- * Reducer for the dashboard model state used in {@link useDashboardModel}.
85
- *
86
- * @param state
87
- * @param action
88
- * @internal
89
- */
90
- export declare function dashboardReducer(state: UseDashboardModelState, action: UseDashboardModelInternalAction): UseDashboardModelState;
91
- /**
92
- * Translates filters and relations to DTOs.
93
- *
94
- * @param filtersOrFilterRelations - The filters or filter relations to translate
95
- * @returns The translated filters and relations DTOs for Fusion
96
- * @internal
97
- */
98
- export declare function translateFiltersAndRelationsToDto(filtersOrFilterRelations: Filter[] | FilterRelations): {
99
- filters: (import("../../../../infra/api/types/dashboard-dto").FilterDto | import("../../../../infra/api/types/dashboard-dto").CascadingFilterDto)[];
100
- filterRelations: {
101
- datasource: string;
102
- filterRelations: import("@sisense/sdk-data").FilterRelationsModelNode;
103
- }[] | undefined;
104
- };
105
- /**
106
- * Middleware that persists the dashboard model changes to the Sisense server.
107
- *
108
- * @param restApi - The Sisense REST API instance
109
- * @param reducer - The dashboard model reducer
110
- * @internal
111
- */
112
- export declare function persistDashboardModelMiddleware(dashboardOid: string | undefined, action: UseDashboardModelInternalAction, restApi: RestApi, sharedMode: boolean): Promise<UseDashboardModelInternalAction>;
95
+ export type AddWidgetPayload = UseDashboardModelAddWidgetAction['payload'];
@@ -0,0 +1,9 @@
1
+ import { UseDashboardModelInternalAction, UseDashboardModelState } from './types.js';
2
+ /**
3
+ * Reducer for the dashboard model state used in {@link useDashboardModel}.
4
+ *
5
+ * @param state
6
+ * @param action
7
+ * @internal
8
+ */
9
+ export declare function dashboardReducer(state: UseDashboardModelState, action: UseDashboardModelInternalAction): UseDashboardModelState;
@@ -0,0 +1,28 @@
1
+ import { Filter, FilterRelations } from '@sisense/sdk-data';
2
+ import { SpecificWidgetOptions, WidgetsPanelLayout } from '../../../../../domains/dashboarding/dashboard-model';
3
+ import { WidgetModel } from '../../../../../domains/widgets/widget-model';
4
+ import { AddWidgetPayload } from './types.js';
5
+ /**
6
+ * Translates filters and relations to DTOs.
7
+ *
8
+ * @param filtersOrFilterRelations - The filters or filter relations to translate
9
+ * @returns The translated filters and relations DTOs for Fusion
10
+ * @internal
11
+ */
12
+ export declare function translateFiltersAndRelationsToDto(filtersOrFilterRelations: Filter[] | FilterRelations): {
13
+ filters: (import("../../../../../infra/api/types/dashboard-dto.js").FilterDto | import("../../../../../infra/api/types/dashboard-dto.js").CascadingFilterDto)[];
14
+ filterRelations: {
15
+ datasource: string;
16
+ filterRelations: import("@sisense/sdk-data").FilterRelationsModelNode;
17
+ }[] | undefined;
18
+ };
19
+ export declare function parseAddWidgetPayload(payload: AddWidgetPayload): {
20
+ widget: WidgetModel;
21
+ widgetsPanelLayout?: WidgetsPanelLayout;
22
+ widgetOptions?: SpecificWidgetOptions;
23
+ };
24
+ /**
25
+ * Appends a widget cell to the first column's first row. Creates row/cells if missing.
26
+ * Returns a new layout (immutable) or the original when no columns exist.
27
+ */
28
+ export declare function appendWidgetToFirstCell(layout: WidgetsPanelLayout | undefined, widgetId: string): WidgetsPanelLayout | undefined;
@@ -1,5 +1,5 @@
1
1
  import { DashboardModel } from '../../../../domains/dashboarding/dashboard-model';
2
- import { UseDashboardModelAction } from './use-dashboard-model-reducer';
2
+ import { UseDashboardModelAction, UseDashboardModelInternalAction } from './dashboard-model-reducer';
3
3
  export interface UseDashboardPersistenceParams {
4
4
  /**
5
5
  * The dashboard model to manage persistence for
@@ -25,10 +25,10 @@ export interface UseDashboardPersistenceResult {
25
25
  */
26
26
  dashboard: DashboardModel | null;
27
27
  /**
28
- * Function to dispatch changes to the dashboard model with optional persistence
29
- * Returns a promise when persistence is enabled to allow error handling
28
+ * Function to dispatch changes to the dashboard model with optional persistence.
29
+ * Returns a promise that resolves to the processed (or transformed) action.
30
30
  */
31
- dispatchChanges: (action: UseDashboardModelAction) => Promise<void> | void;
31
+ dispatchChanges: (action: UseDashboardModelAction) => Promise<UseDashboardModelInternalAction>;
32
32
  }
33
33
  /**
34
34
  * Hook that provides persistence capabilities for an already loaded dashboard model.
@@ -0,0 +1,34 @@
1
+ import type { WidgetsPanelLayout } from '../../../../domains/dashboarding/dashboard-model/types.js';
2
+ /**
3
+ * Location of a widget cell within the layout structure.
4
+ */
5
+ export type WidgetCellLocation = {
6
+ columnIndex: number;
7
+ rowIndex: number;
8
+ cellIndex: number;
9
+ };
10
+ /**
11
+ * Finds the location of a widget cell in the layout.
12
+ *
13
+ * @param layout - The widgets panel layout.
14
+ * @param widgetId - The ID of the widget to find.
15
+ * @returns The cell location, or undefined if not found.
16
+ */
17
+ export declare const getWidgetCellLocation: (layout: Readonly<WidgetsPanelLayout>, widgetId: string) => WidgetCellLocation | undefined;
18
+ /**
19
+ * Transformer: Inserts a new cell into the same row as the original cell.
20
+ * Splits the original cell's widthPercentage in half: original and new cell each get 50%.
21
+ *
22
+ * @param originalCellLocation - The location of the original cell.
23
+ * @param newWidgetId - The ID of the new widget.
24
+ * @returns A pure transformer that produces the updated layout.
25
+ */
26
+ export declare const withNewCellInsertedToTheSameRow: (originalCellLocation: WidgetCellLocation, newWidgetId: string) => (layout: Readonly<WidgetsPanelLayout>) => WidgetsPanelLayout;
27
+ /**
28
+ * Transformer: Replaces a widget ID with another in all cells of the layout.
29
+ *
30
+ * @param oldWidgetId - The widget ID to replace.
31
+ * @param newWidgetId - The new widget ID.
32
+ * @returns A pure transformer that produces the updated layout (immutable).
33
+ */
34
+ export declare const withReplacedWidgetId: (oldWidgetId: string, newWidgetId: string) => (layout: Readonly<WidgetsPanelLayout>) => WidgetsPanelLayout;
@@ -0,0 +1,2 @@
1
+ export { getWidgetCellLocation, withNewCellInsertedToTheSameRow, withReplacedWidgetId, type WidgetCellLocation, } from './duplicate-widget-utils.js';
2
+ export { useDuplicateWidgetMenuItem, type UseDuplicateWidgetMenuItemParams, type DuplicateWidgetMiddlewareOutput, } from './use-duplicate-widget-menu-item.js';
@@ -0,0 +1,57 @@
1
+ /// <reference types="react" />
2
+ import type { WidgetsOptions, WidgetsPanelLayout } from '../../../../domains/dashboarding/dashboard-model/types.js';
3
+ import { type WidgetProps } from '../../../../domains/widgets/components/widget/types.js';
4
+ import type { DashboardPersistenceManager } from '../../types.js';
5
+ /** Setter for widgets array (e.g. React setState or updater function). */
6
+ export type SetWidgets = React.Dispatch<React.SetStateAction<WidgetProps[]>>;
7
+ /** Setter for widgets options array (e.g. React setState or updater function). */
8
+ export type SetWidgetsOptions = React.Dispatch<React.SetStateAction<WidgetsOptions>>;
9
+ /** Setter for widgets panel layout. */
10
+ export type SetWidgetsLayout = (newLayout: WidgetsPanelLayout) => void;
11
+ /** Options for the duplicate widget middleware hook. */
12
+ export type UseDuplicateWidgetMenuItemParams = {
13
+ /** Current widgets. */
14
+ widgets: WidgetProps[];
15
+ /** Setter to update widgets (e.g. from parent state). */
16
+ setWidgets: SetWidgets;
17
+ /** Current widgets panel layout. */
18
+ widgetsLayout: WidgetsPanelLayout;
19
+ /** Setter to update widgets layout (e.g. from parent state). */
20
+ setWidgetsLayout: SetWidgetsLayout;
21
+ /** When false, returns widgets unchanged (no menu item added). */
22
+ enabled?: boolean;
23
+ /** Dashboard-level widget options (applied to cloned widget when persisting). */
24
+ widgetsOptions?: WidgetsOptions;
25
+ /** Setter to update widgets options (e.g. from parent state). */
26
+ setWidgetsOptions: SetWidgetsOptions;
27
+ persistence?: Pick<DashboardPersistenceManager, 'addWidget'>;
28
+ };
29
+ /** Output of the duplicate widget middleware. */
30
+ export type DuplicateWidgetMiddlewareOutput = {
31
+ widgets: WidgetProps[];
32
+ };
33
+ /**
34
+ * Middleware hook that adds a "Duplicate widget" header menu item to each widget.
35
+ * On click, clones the widget and updates the layout (inserts new cell in the same row).
36
+ *
37
+ * @param options - Options containing widgets, layout, setters, and enabled flag.
38
+ * @returns Updated props with widgets augmented with the duplicate menu item (or unchanged when disabled).
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const [widgets, setWidgets] = useSyncedState(initialWidgets);
43
+ * const [widgetsLayout, setWidgetsLayout] = useSyncedState(initialLayout);
44
+ * const { widgets: widgetsWithDuplicate, widgetsLayout: widgetsLayoutWithDuplicate } = useDuplicateWidgetMenuItem({
45
+ * widgets,
46
+ * setWidgets,
47
+ * widgetsLayout,
48
+ * setWidgetsLayout,
49
+ * enabled: true,
50
+ * });
51
+ * const { layout: widgetsLayout, setLayout: setWidgetsLayout } = useWidgetsLayoutManagement({
52
+ * layout: widgetsLayoutWithDuplicate,
53
+ * layoutManagers: [tabberLayoutManager],
54
+ * });
55
+ * ```
56
+ */
57
+ export declare function useDuplicateWidgetMenuItem(params: UseDuplicateWidgetMenuItemParams): DuplicateWidgetMiddlewareOutput;
@@ -1,10 +1,10 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { DataSource, Filter, FilterRelations } from '@sisense/sdk-data';
3
- import { DashboardStyleOptions, WidgetsOptions, WidgetsPanelLayout } from '../../domains/dashboarding/dashboard-model';
3
+ import { DashboardStyleOptions, SpecificWidgetOptions, WidgetsOptions, WidgetsPanelLayout } from '../../domains/dashboarding/dashboard-model';
4
4
  import { TabbersConfig } from '../../domains/dashboarding/hooks/use-tabber';
5
5
  import { FiltersPanelConfig } from '../../domains/filters/components/filters-panel/types';
6
6
  import { WidgetProps } from '../../domains/widgets/components/widget/types';
7
- export type { DashboardStyleOptions, WidgetsPanelColumnLayout, WidgetsPanelLayout, WidgetsPanelCell, WidgetsPanelRow, WidgetsPanelColumn, } from '../../domains/dashboarding/dashboard-model';
7
+ export type { DashboardStyleOptions, SpecificWidgetOptions, WidgetsPanelColumnLayout, WidgetsPanelLayout, WidgetsPanelCell, WidgetsPanelRow, WidgetsPanelColumn, } from '../../domains/dashboarding/dashboard-model';
8
8
  export type { TabbersConfig, TabberConfig, TabberTabConfig, } from '../../domains/dashboarding/hooks/use-tabber';
9
9
  /**
10
10
  * Event triggered when dashboard filters are updated.
@@ -217,6 +217,23 @@ export interface EditModeConfig {
217
217
  * @default true
218
218
  */
219
219
  showDragHandleIcon?: boolean;
220
+ /**
221
+ * Configuration for the widget duplication feature.
222
+ *
223
+ * @internal
224
+ */
225
+ duplicateWidget?: {
226
+ /**
227
+ * When `true`, adds a "Duplicate widget" menu item to each widget header.
228
+ * On click, clones the widget and updates the layout.
229
+ * Only has effect when edit mode is also enabled (`editMode.enabled`) and batch mode is disabled (`editMode.applyChangesAsBatch.enabled`).
230
+ * If batch mode is enabled, "Duplicate widget" menu item won't be applied because it would not be possible to undo/redo the duplication.
231
+ *
232
+ * If not specified, the default value is `false`.
233
+ * @internal
234
+ */
235
+ enabled: boolean;
236
+ };
220
237
  }
221
238
  /**
222
239
  * Dashboard configuration
@@ -278,6 +295,26 @@ export interface DashboardLayoutOptions {
278
295
  */
279
296
  widgetsPanel?: WidgetsPanelLayout;
280
297
  }
298
+ /**
299
+ * Interface for persisting dashboard changes from the composition layer (e.g. add widget).
300
+ *
301
+ * @internal
302
+ */
303
+ export type DashboardPersistenceManager = {
304
+ /**
305
+ * Adds a widget to the dashboard.
306
+ *
307
+ * @param widget - The widget to add.
308
+ * @param widgetsPanelLayout - The layout to add the widget to.
309
+ * @param widgetOptions - The options for the widget.
310
+ * @returns The persisted widget (possibly modified by the server, e.g. new id), the new widgets panel layout and the widget options.
311
+ */
312
+ addWidget: (widget: WidgetProps, widgetsPanelLayout: WidgetsPanelLayout, widgetOptions?: SpecificWidgetOptions) => Promise<{
313
+ widget: WidgetProps;
314
+ widgetsPanelLayout: WidgetsPanelLayout;
315
+ widgetOptions?: SpecificWidgetOptions;
316
+ }>;
317
+ };
281
318
  /**
282
319
  * Props for the Dashboard component
283
320
  */
@@ -317,6 +354,10 @@ export interface DashboardProps {
317
354
  * @param event The event that occurred
318
355
  */
319
356
  onChange?: (event: DashboardChangeEvent) => void;
357
+ /**
358
+ * @internal
359
+ */
360
+ persistence?: DashboardPersistenceManager;
320
361
  }
321
362
  /**
322
363
  * Props for the Dashboard Header component
@@ -1,12 +1,24 @@
1
1
  import { Filter, FilterRelations } from '@sisense/sdk-data';
2
- import { WidgetsPanelLayout } from '../../domains/dashboarding/dashboard-model';
3
- import { DashboardProps } from './types.js';
2
+ import type { WidgetsPanelLayout } from '../../domains/dashboarding/dashboard-model';
3
+ import { DashboardPersistenceManager, DashboardProps } from './types.js';
4
4
  export type ComposableDashboardProps = Pick<DashboardProps, 'filters' | 'widgets' | 'widgetsOptions' | 'layoutOptions' | 'config'>;
5
5
  export type UseComposedDashboardOptions = {
6
6
  /**
7
7
  * @internal
8
8
  */
9
9
  onFiltersChange?: (filters: Filter[] | FilterRelations) => void;
10
+ /**
11
+ * @internal
12
+ */
13
+ persistence?: DashboardPersistenceManager;
14
+ /**
15
+ * Runtime edit mode state. When provided (e.g. by Dashboard), used for duplicate-widget visibility
16
+ * instead of only config.widgetsPanel.editMode.isEditing.
17
+ * @internal
18
+ *
19
+ * @deprecated Temporal workaround. Edit mode (with history management) should be managed by the `useComposedDashboard` hook instead of the Dashboard component.
20
+ */
21
+ isEditing?: boolean;
10
22
  };
11
23
  /**
12
24
  * Result of the {@link useComposedDashboard} hook.
@@ -24,7 +36,7 @@ export type ComposedDashboardResult<D extends ComposableDashboardProps | Dashboa
24
36
  *
25
37
  * @internal
26
38
  */
27
- export declare function useComposedDashboardInternal<D extends ComposableDashboardProps | DashboardProps>(initialDashboard: D, { onFiltersChange }?: UseComposedDashboardOptions): ComposedDashboardResult<D>;
39
+ export declare function useComposedDashboardInternal<D extends ComposableDashboardProps | DashboardProps>(initialDashboard: D, { onFiltersChange, persistence, isEditing: isEditingRuntime }?: UseComposedDashboardOptions): ComposedDashboardResult<D>;
28
40
  /**
29
41
  * React hook that takes in separate dashboard elements and
30
42
  * composes them into a coordinated dashboard with change detection, cross filtering, and drill down.
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { DataSource, Filter } from '@sisense/sdk-data';
3
3
  import { FilterVariant } from '../common/filter-utils.js';
4
+ import type { FilterTileConfig } from '../filter-tile/types.js';
4
5
  /**
5
6
  * Props for {@link CascadingFilterTile}
6
7
  *
@@ -23,6 +24,12 @@ export interface CascadingFilterTileProps {
23
24
  onDelete?: () => void;
24
25
  /** Filter edit callback */
25
26
  onEdit?: (levelIndex: number) => void;
27
+ /**
28
+ * Config for the filter tile
29
+ *
30
+ * @internal
31
+ */
32
+ config?: FilterTileConfig;
26
33
  /**
27
34
  * Render header title (first cascading level filter only)
28
35
  *
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { DataSource, Filter } from '@sisense/sdk-data';
3
+ import { MenuItem } from '../../../../shared/types/menu-item.js';
3
4
  /**
4
5
  * Props of the {@link CascadingLevelFilterTile} component
5
6
  *
@@ -21,6 +22,8 @@ export type CascadingLevelFilterTileProps = {
21
22
  onEdit?: () => void;
22
23
  /** Whether the filter is the last in the list */
23
24
  isLast?: boolean;
25
+ /** Menu items to be displayed in the cascading level filter header */
26
+ menuItems: MenuItem[];
24
27
  /**
25
28
  * Render header title
26
29
  *
@@ -33,4 +36,4 @@ export type CascadingLevelFilterTileProps = {
33
36
  *
34
37
  * @internal
35
38
  */
36
- export declare const CascadingLevelFilterTile: ({ filter, dataSource, parentFilters, onChange, isLast, onEdit, renderHeaderTitle, }: CascadingLevelFilterTileProps) => import("react/jsx-runtime").JSX.Element;
39
+ export declare const CascadingLevelFilterTile: ({ filter, dataSource, parentFilters, onChange, isLast, onEdit, menuItems, renderHeaderTitle, }: CascadingLevelFilterTileProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import type { MenuItem } from '../../../../../shared/types/menu-item';
2
+ /**
3
+ * Builds the lock menu item for the cascading filter tile.
4
+ *
5
+ * @param locked - Current lock state
6
+ * @param onLockToggle - Handler for lock toggle
7
+ * @returns Filter tile lock menu item
8
+ * @internal
9
+ */
10
+ export declare function useCascadingFilterTileLockMenuItem({ locked, onLockToggle, }: {
11
+ locked: boolean;
12
+ onLockToggle: () => void;
13
+ }): MenuItem;
@@ -0,0 +1,14 @@
1
+ import { type CascadingFilter } from '@sisense/sdk-data';
2
+ import type { MenuItem } from '../../../../../shared/types/menu-item';
3
+ import type { FilterTileConfig } from '../../../components/filter-tile/types';
4
+ /**
5
+ * Builds the menu items list for a cascading filter tile,
6
+ * conditionally prepending them based on config.
7
+ *
8
+ * @param filter - The current filter
9
+ * @param config - Filter tile configuration
10
+ * @param onChange - Callback invoked when the filter changes (e.g., lock toggle)
11
+ * @returns Filter tile menu items
12
+ * @internal
13
+ */
14
+ export declare function useCascadingFilterTileMenuItems(filter: CascadingFilter, config: FilterTileConfig | undefined, onChange: ((filter: CascadingFilter) => void) | undefined): MenuItem[];
@@ -2,6 +2,7 @@
2
2
  import { Filter, Measure } from '@sisense/sdk-data';
3
3
  import { FilterVariant } from '../common/filter-utils.js';
4
4
  import { FilterTileDesignOptions } from '../filter-tile-container.js';
5
+ import type { FilterTileConfig } from '../filter-tile/types.js';
5
6
  /**
6
7
  * Props of the {@link CriteriaFilterTile} component.
7
8
  */
@@ -26,6 +27,12 @@ export interface CriteriaFilterTileProps {
26
27
  * @internal
27
28
  */
28
29
  tileDesignOptions?: FilterTileDesignOptions;
30
+ /**
31
+ * Config for the filter tile
32
+ *
33
+ * @internal
34
+ */
35
+ config?: FilterTileConfig;
29
36
  /**
30
37
  * Render header title
31
38
  *
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { Filter } from '@sisense/sdk-data';
3
+ import type { FilterTileConfig } from '../../../domains/filters/components/filter-tile/types';
3
4
  import { FilterTileDesignOptions } from './filter-tile-container';
4
5
  /**
5
6
  * Props for {@link CustomFilterTile}
@@ -21,6 +22,12 @@ export interface CustomFilterTileProps {
21
22
  onEdit?: () => void;
22
23
  /** Design options for the tile @internal */
23
24
  tileDesignOptions?: FilterTileDesignOptions;
25
+ /**
26
+ * Config for the filter tile
27
+ *
28
+ * @internal
29
+ */
30
+ config?: FilterTileConfig;
24
31
  /**
25
32
  * Render header title
26
33
  *
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { DataSource, Filter, LevelAttribute } from '@sisense/sdk-data';
3
3
  import { FilterTileDesignOptions } from '../../filter-tile-container';
4
+ import type { FilterTileConfig } from '../../filter-tile/types';
4
5
  /**
5
6
  * Props of the {@link DateRangeFilterTile} component.
6
7
  */
@@ -62,6 +63,12 @@ export interface DateRangeFilterTileProps {
62
63
  * @internal
63
64
  */
64
65
  tileDesignOptions?: FilterTileDesignOptions;
66
+ /**
67
+ * Config for the filter tile
68
+ *
69
+ * @internal
70
+ */
71
+ config?: FilterTileConfig;
65
72
  /**
66
73
  * Render header title
67
74
  *
@@ -2,6 +2,7 @@
2
2
  import { Filter } from '@sisense/sdk-data';
3
3
  import { FilterVariant } from '../../common/index.js';
4
4
  import { FilterTileDesignOptions } from '../../filter-tile-container.js';
5
+ import type { FilterTileConfig } from '../../filter-tile/types.js';
5
6
  /**
6
7
  * Props of the {@link RelativeDateFilterTile} component.
7
8
  */
@@ -35,6 +36,12 @@ export interface RelativeDateFilterTileProps {
35
36
  * @internal
36
37
  */
37
38
  tileDesignOptions?: FilterTileDesignOptions;
39
+ /**
40
+ * Config for the filter tile
41
+ *
42
+ * @internal
43
+ */
44
+ config?: FilterTileConfig;
38
45
  /**
39
46
  * Render header title
40
47
  *
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { DataSource, Filter } from '@sisense/sdk-data';
3
+ import { FilterTileConfig } from './types.js';
3
4
  /**
4
5
  * Props of the {@link FilterTile} component
5
6
  *
@@ -17,6 +18,12 @@ export interface FilterTileProps {
17
18
  levelIndex?: number) => void;
18
19
  /** Default data source used for filter tiles */
19
20
  defaultDataSource?: DataSource;
21
+ /**
22
+ * Configurations for the filter tile
23
+ *
24
+ * @internal
25
+ */
26
+ config?: FilterTileConfig;
20
27
  /**
21
28
  * Render header title
22
29
  *
@@ -0,0 +1 @@
1
+ export { FilterTile, type FilterTileProps } from './filter-tile.js';
@@ -0,0 +1,36 @@
1
+ import { MenuItem } from '../../../../shared/types/menu-item';
2
+ /**
3
+ * Configuration for the filter tile.
4
+ */
5
+ export type FilterTileConfig = {
6
+ /**
7
+ * Configurations for the filter tile header.
8
+ */
9
+ header?: {
10
+ /**
11
+ * Configurations for the filter tile header menu.
12
+ */
13
+ menu?: {
14
+ /**
15
+ * List of menu items to be injected into the filter tile header.
16
+ */
17
+ items?: MenuItem[];
18
+ };
19
+ };
20
+ /**
21
+ * Configures the available actions within the filter tile.
22
+ */
23
+ actions?: {
24
+ /**
25
+ * Configuration for locking a filter.
26
+ */
27
+ lockFilter?: {
28
+ /**
29
+ * Determines whether the possibility to lock a filter is enabled.
30
+ *
31
+ * If not specified, the default value is `false`.
32
+ */
33
+ enabled?: boolean;
34
+ };
35
+ };
36
+ };