@sisense/sdk-ui 1.15.1 → 1.17.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 (113) hide show
  1. package/dist/ai.cjs +50 -50
  2. package/dist/ai.js +133 -132
  3. package/dist/analytics-composer/index.d.ts +1 -0
  4. package/dist/analytics-composer/translators/code-templates.d.ts +11 -0
  5. package/dist/analytics-composer/translators/generate-code.d.ts +18 -0
  6. package/dist/analytics-composer/translators/index.d.ts +3 -0
  7. package/dist/analytics-composer/translators/model-translator.d.ts +48 -0
  8. package/dist/analytics-composer/translators/query-templates.d.ts +1 -0
  9. package/dist/analytics-composer/translators/query-translator.d.ts +134 -0
  10. package/dist/analytics-composer/translators/translate-filters-to-code.d.ts +2 -0
  11. package/dist/analytics-composer/translators/translate-props-to-code.d.ts +8 -0
  12. package/dist/analytics-composer/translators/types.d.ts +95 -0
  13. package/dist/analytics-composer/translators/utils.d.ts +13 -0
  14. package/dist/analytics-composer.cjs +239 -0
  15. package/dist/analytics-composer.d.ts +1 -0
  16. package/dist/analytics-composer.js +5435 -0
  17. package/dist/api/rest-api.d.ts +5 -0
  18. package/dist/api/types/dashboard-dto.d.ts +8 -0
  19. package/dist/api/types/palette-dto.d.ts +9 -0
  20. package/dist/app/client-application.d.ts +22 -2
  21. package/dist/app/settings/settings.d.ts +5 -0
  22. package/dist/app/settings/types/features.d.ts +6 -0
  23. package/dist/chart/advanced-chart.d.ts +7 -0
  24. package/dist/chart-data/advanced-analytics-data.d.ts +50 -0
  25. package/dist/chart-data/types.d.ts +2 -1
  26. package/dist/chart-data-options/types.d.ts +35 -4
  27. package/dist/chart-data-processor/table-processor.d.ts +1 -1
  28. package/dist/chart-options-processor/advanced-chart-options.d.ts +24 -0
  29. package/dist/chart-options-processor/cartesian-chart-options.d.ts +2 -1
  30. package/dist/chart-options-processor/chart-options-service.d.ts +5 -0
  31. package/dist/chart-options-processor/common-highcharts-option-service.d.ts +2 -1
  32. package/dist/chart-options-processor/translations/axis-section.d.ts +2 -2
  33. package/dist/chart-options-processor/translations/legend-section.d.ts +2 -0
  34. package/dist/chart-options-processor/translations/tooltip-utils.d.ts +1 -0
  35. package/dist/chart-options-processor/translations/tooltip.d.ts +4 -2
  36. package/dist/charts/map-charts/scattermap/utils/map.d.ts +6 -2
  37. package/dist/charts/map-charts/scattermap/utils/markers.d.ts +1 -1
  38. package/dist/charts/table/data-table-wrapper.d.ts +1 -1
  39. package/dist/charts/table/helpers/calc-column-widths.d.ts +1 -1
  40. package/dist/charts/table/types.d.ts +0 -1
  41. package/dist/common/components/loading-indicator.d.ts +27 -0
  42. package/dist/common/hooks/use-has-changed.d.ts +1 -1
  43. package/dist/common/hooks/use-tracking.d.ts +7 -0
  44. package/dist/common-filters/cascading-utils.d.ts +30 -0
  45. package/dist/common-filters/common-filters-connector.d.ts +7 -1
  46. package/dist/common-filters/selection-utils.d.ts +1 -1
  47. package/dist/common-filters/types.d.ts +17 -6
  48. package/dist/common-filters/utils.d.ts +2 -5
  49. package/dist/dashboard/dashboard-by-id.d.ts +8 -3
  50. package/dist/dashboard/dashboard.d.ts +8 -4
  51. package/dist/dashboard/index.d.ts +1 -1
  52. package/dist/dashboard/types.d.ts +13 -7
  53. package/dist/dashboard-widget/dashboard-widget.d.ts +2 -0
  54. package/dist/dashboard-widget/translate-widget-data-options.d.ts +1 -1
  55. package/dist/dashboard-widget/translate-widget-drilldown-options.d.ts +2 -2
  56. package/dist/dashboard-widget/translate-widget-style-options.d.ts +11 -2
  57. package/dist/dashboard-widget/types.d.ts +29 -8
  58. package/dist/dashboard-widget/utils.d.ts +8 -0
  59. package/dist/decorators/component-decorators/with-tracking/error-tracker.d.ts +3 -0
  60. package/dist/filters/components/date-filter/date-filter/date-filter.d.ts +1 -0
  61. package/dist/filters/components/filters-panel/filters-panel.d.ts +2 -1
  62. package/dist/get-widget-options-D4UHj7o5.cjs +198 -0
  63. package/dist/get-widget-options-D88MkBTJ.js +37924 -0
  64. package/dist/index.cjs +183 -208
  65. package/dist/index.d.ts +3 -3
  66. package/dist/index.js +20621 -24251
  67. package/dist/models/dashboard/dashboard-model.d.ts +10 -2
  68. package/dist/models/dashboard/get-dashboard-model.d.ts +13 -2
  69. package/dist/models/dashboard/types.d.ts +21 -2
  70. package/dist/models/dashboard/use-get-dashboard-model.d.ts +2 -0
  71. package/dist/models/dashboard/use-get-dashboard-models.d.ts +2 -0
  72. package/dist/models/widget/get-widget-model.d.ts +13 -2
  73. package/dist/models/widget/translate-widget.d.ts +10 -1
  74. package/dist/models/widget/use-get-widget-model.d.ts +2 -0
  75. package/dist/models/widget/widget-model.d.ts +5 -3
  76. package/dist/pivot-table/helpers/prepare-pivot-styling-props.d.ts +16 -15
  77. package/dist/pivot-table/{use-apply-pivot-table-formatting.d.ts → hooks/use-apply-pivot-table-formatting.d.ts} +1 -1
  78. package/dist/pivot-table/{use-get-pivot-table-query.d.ts → hooks/use-get-pivot-table-query.d.ts} +4 -8
  79. package/dist/pivot-table/hooks/use-pivot-data-loading.d.ts +15 -0
  80. package/dist/pivot-table/hooks/use-pivot-data-service.d.ts +10 -0
  81. package/dist/pivot-table/{use-pivot-table-data-options-internal.d.ts → hooks/use-pivot-table-data-options-internal.d.ts} +2 -2
  82. package/dist/pivot-table/hooks/use-render-pivot.d.ts +24 -0
  83. package/dist/pivot-table/pivot-table.d.ts +2 -2
  84. package/dist/props.d.ts +45 -10
  85. package/dist/query-execution/execute-query-by-widget-id.d.ts +2 -0
  86. package/dist/query-execution/index.d.ts +1 -1
  87. package/dist/query-execution/types.d.ts +11 -2
  88. package/dist/query-execution/use-execute-query-by-widget-id.d.ts +5 -5
  89. package/dist/sisense-context/sisense-context.d.ts +2 -0
  90. package/dist/theme-provider/default-theme-settings.d.ts +2 -0
  91. package/dist/themes/legacy-design-settings.d.ts +14 -0
  92. package/dist/translation/resources/en.d.ts +9 -0
  93. package/dist/translation/resources/index.d.ts +18 -0
  94. package/dist/types.d.ts +89 -9
  95. package/dist/useQuery-C6PPvTP0.js +43462 -0
  96. package/dist/useQuery-ChZNmTT3.cjs +433 -0
  97. package/dist/utils/color/color-interpolation.d.ts +9 -0
  98. package/dist/utils/combine-handlers.d.ts +3 -0
  99. package/dist/utils/filters.d.ts +14 -0
  100. package/dist/widgets/common/drilldown-connector.d.ts +19 -0
  101. package/dist/widgets/common/{custom-drilldown.d.ts → use-drilldown.d.ts} +7 -3
  102. package/dist/widgets/common/widget-container.d.ts +2 -2
  103. package/dist/widgets/common/widget-header-info-button.d.ts +2 -2
  104. package/dist/widgets/common/widget-header.d.ts +2 -2
  105. package/dist/widgets/common/widget-style-utils.d.ts +5 -4
  106. package/dist/widgets/use-highlight-selection.d.ts +10 -0
  107. package/package.json +18 -9
  108. package/dist/filters/utils.d.ts +0 -7
  109. package/dist/useQuery-B-49RH93.js +0 -76791
  110. package/dist/useQuery-C2MQvc4S.cjs +0 -603
  111. package/dist/widgets/chart-widget-deprecated.d.ts +0 -30
  112. package/dist/widgets/common/drilldown.d.ts +0 -25
  113. package/dist/widgets/common/use-widget-drilldown.d.ts +0 -2
@@ -0,0 +1 @@
1
+ export * from './translators';
@@ -0,0 +1,11 @@
1
+ import { CodeTemplates } from './types';
2
+ /**
3
+ * Code templates for different UI frameworks.
4
+ *
5
+ * A code template is made up of other code templates and placeholders.
6
+ * This allows a code template to be reused in other code templates.
7
+ * For example, a chart widget template can be reused in a dashboard template.
8
+ *
9
+ * @internal
10
+ */
11
+ export declare const CODE_TEMPLATES: CodeTemplates;
@@ -0,0 +1,18 @@
1
+ import { CodeTemplateKey, UiFramework } from './types';
2
+ /**
3
+ * Populates placeholders in the given template with the given data.
4
+ * If a placeholder is not found in the data, a warning is logged.
5
+ *
6
+ * @param template - the template to populate
7
+ * @param data - the data to populate the template with
8
+ * @returns the populated template
9
+ */
10
+ export declare const populatePlaceholders: (template: string, data: Record<string, string>) => string;
11
+ /**
12
+ * Generates code from a template with the given data and UI framework.
13
+ *
14
+ * @param templateKey - the key of the template to use
15
+ * @param data - the data to populate the template with
16
+ * @param uiFramework - the UI framework for the generated code
17
+ */
18
+ export declare const generateCode: (templateKey: CodeTemplateKey, data: Record<string, string>, uiFramework?: UiFramework) => string;
@@ -0,0 +1,3 @@
1
+ export * from './types';
2
+ export { ModelTranslator } from './model-translator';
3
+ export { QueryTranslator } from './query-translator';
@@ -0,0 +1,48 @@
1
+ import { ExpandedQueryModel, ChartWidgetModel, UiFramework } from './types.js';
2
+ /**
3
+ * A class that translates expanded query model to CSDK chart model and code.
4
+ *
5
+ * @internal
6
+ */
7
+ export declare class ModelTranslator {
8
+ queryModel: ExpandedQueryModel;
9
+ constructor(queryModel: ExpandedQueryModel);
10
+ /**
11
+ * Gets chart recommendations or default to table.
12
+ *
13
+ * @param chart - chart recommendations
14
+ * @returns chart recommendations or default to table
15
+ */
16
+ private getChartRecommendationsOrDefault;
17
+ /**
18
+ * Gets filters from metadata.
19
+ *
20
+ * @param metadata - metadata items
21
+ * @return array of Filter objects
22
+ */
23
+ private getFilters;
24
+ /**
25
+ * Splits metadata into columns and filters.
26
+ *
27
+ * @param metadata - metadata items
28
+ */
29
+ private splitMetadata;
30
+ /**
31
+ * Converts query model to chart
32
+ */
33
+ toChart(): ChartWidgetModel | undefined;
34
+ private stringifyDataSource;
35
+ private stringifyChartType;
36
+ private stringifyFilters;
37
+ private stringifyDataOptions;
38
+ private stringifyExtraImports;
39
+ private getChartWidgetCode;
40
+ /**
41
+ * Converts chart widget model to CSDK code.
42
+ *
43
+ * @param chartWidgetModel - chart widget model
44
+ * @param uiFramework - UI framework
45
+ * @returns CSDK code string of the UI framework
46
+ */
47
+ toCode(chartWidgetModel: ChartWidgetModel, uiFramework?: UiFramework): string;
48
+ }
@@ -0,0 +1 @@
1
+ export declare const QUERY_TEMPLATE = "# This is your query - you can modify it directly and click Run to see new results.\n# Try uncommenting the elements below\n# To learn more about the query syntax, visit [Doc URL]\n---\nmodel: {{dataSourceTitle}}\n# metadata:\n# - jaql:\n# dim: \"[DimTable1.SomeTextColumn]\"\n# title: Dimension1\n# - jaql:\n# dim: \"[Table2.SomeDateColumn]\"\n# level: years\n# title: Dimension2\n# format:\n# mask:\n# years: yyyy\n# - jaql:\n# dim: \"[FactTable1.Column1]\"\n# agg: sum\n# title: Measure1\n# - jaql:\n# type: measure\n# formula: (SUM([Column1]) - SUM([Column2])) / SUM([Column1])\n# context:\n# \"[Column1]\":\n# dim: \"[FactTable1.Column1]\"\n# \"[Column2]\":\n# dim: \"[FactTable1.Column2]\"\n# title: Measure2\n# - jaql:\n# dim: \"[FactTable1.Column1]\"\n# filter:\n# fromNotEqual: 1000\n# panel: scope\n# chart:\n# chartType: table\n# dataOptions:\n# columns:\n# - name: Dimension1\n# - name: Dimension2\n# - name: Measure1\n# - name: Measure2";
@@ -0,0 +1,134 @@
1
+ import { ExpandedQueryModel, SimpleQueryModel, SimpleChartRecommendations } from './types.js';
2
+ import { DataSourceField, MetadataItem, MetadataItemJaql } from '@sisense/sdk-query-client';
3
+ import { ChartRecommendations } from '../../ai';
4
+ /**
5
+ * A class that translates ExpandedQueryModel (Raw JAQL+Chart Recommendations)
6
+ * to SimpleQueryModel (Simple JAQL+Simple Chart Options) and vice versa.
7
+ *
8
+ * It also provides methods to stringify query models to YAML strings
9
+ * and parse YAML strings to query models.
10
+ *
11
+ * @internal
12
+ */
13
+ export declare class QueryTranslator {
14
+ private readonly contextTitle;
15
+ private readonly indexedFields;
16
+ /**
17
+ * Constructor for QueryTranslator.
18
+ *
19
+ * @param contextTitle - The context title
20
+ * @param fields - The data source fields
21
+ */
22
+ constructor(contextTitle: string, fields: DataSourceField[]);
23
+ private indexFields;
24
+ /**
25
+ * Concatenates Aggregation Types.
26
+ */
27
+ private concatAggTypes;
28
+ /**
29
+ * Simplifies Aggregation Formula defined in MetadataItemJaql returned from chat response.
30
+ *
31
+ * @param aggFormula - The Aggregation Formula to simplify
32
+ * @returns The equivalent measure
33
+ * @privateRemarks
34
+ * See unit tests for examples of aggregation formulas and their equivalent measures.
35
+ */
36
+ simplifyAggFormula(aggFormula: MetadataItemJaql): MetadataItemJaql;
37
+ /**
38
+ * Simplifies MetadataItemJaql.
39
+ *
40
+ * @param item - The MetadataItemJaql to simplify
41
+ * @returns The simplified MetadataItemJaql
42
+ */
43
+ simplifyMetadataItemJaql(item: MetadataItemJaql): MetadataItemJaql;
44
+ /**
45
+ * Simplify filter
46
+ *
47
+ * @param item - the MetadataItem
48
+ * @return the MetadataItem with simplified filter
49
+ */
50
+ simplifyMetadataItemFilter(item: MetadataItem): MetadataItem;
51
+ /**
52
+ * Simplify date and number format
53
+ *
54
+ * @param item - the MetadataItem
55
+ * @return the MetadataItem with simplified format
56
+ */
57
+ simplifyMetadataItemFormat(item: MetadataItem): MetadataItem;
58
+ /**
59
+ * Simplifies MetadataItem.
60
+ *
61
+ * @param item - The MetadataItem to simplify
62
+ * @returns The simplified MetadataItem
63
+ */
64
+ simplifyMetadataItem(item: MetadataItem): MetadataItem;
65
+ /**
66
+ * Simplifies Chart Recommendations.
67
+ *
68
+ * @param chartRecommendations - The Chart Recommendations to simplify
69
+ * @returns The simplified chart data options
70
+ */
71
+ simplifyChartRecommendations(chartRecommendations: ChartRecommendations | {}): SimpleChartRecommendations | {};
72
+ /**
73
+ * Returns the query title with the chart type.
74
+ *
75
+ * @param queryTitle - The query title
76
+ * @param chartRecommendations - The chart recommendations
77
+ * @returns The query title with the chart type
78
+ */
79
+ getQueryTitleWithChartType(queryTitle: string, chartRecommendations: {} | ChartRecommendations): string;
80
+ /**
81
+ * Takes a ExpandedQueryModel (e.g., from chat response) and translates it to SimpleQueryModel.
82
+ *
83
+ * @param expandedQueryModel - The Expanded Query model to simplify
84
+ * @returns The simplified query model
85
+ */
86
+ translateToSimple(expandedQueryModel: ExpandedQueryModel): SimpleQueryModel;
87
+ /**
88
+ * Stringifies a simple query model to YAML string.
89
+ *
90
+ * @param simpleQueryModel - The Simple Query model to convert
91
+ * @returns The YAML string representing the simple query model
92
+ */
93
+ stringifySimple(simpleQueryModel: SimpleQueryModel): string;
94
+ /**
95
+ * Returns the query template.
96
+ */
97
+ getQueryTemplate(): string;
98
+ /**
99
+ * Parses a YAML string to Simple Query Model.
100
+ *
101
+ * @param simpleQueryYaml - The YAML string to parse
102
+ * @returns The Simple Query Model
103
+ */
104
+ parseSimple(simpleQueryYaml: string): SimpleQueryModel;
105
+ /**
106
+ * Expands Chart Recommendations.
107
+ *
108
+ * @param chartRecommendations - The Chart Recommendations to expand
109
+ * @returns The expanded chart recommendations
110
+ */
111
+ expandChartRecommendations(chartRecommendations: SimpleChartRecommendations | {}): ChartRecommendations | {};
112
+ /**
113
+ * Expands MetadataItemJaql by adding table, column, datatype, and title
114
+ * if they are missing from the item.
115
+ *
116
+ * @param item - The MetadataItemJaql to expand
117
+ * @returns The expanded MetadataItemJaql
118
+ */
119
+ expandMetadataItemJaql(item: MetadataItemJaql): MetadataItemJaql;
120
+ /**
121
+ * Expands MetadataItem
122
+ *
123
+ * @param item - The MetadataItem to expand
124
+ * @returns The expanded MetadataItem
125
+ */
126
+ expandMetadataItem(item: MetadataItem): MetadataItem;
127
+ /**
128
+ * Translates a Simple Query Model to Expanded Query Model.
129
+ *
130
+ * @param simpleQueryModel - The Simple Query model to convert
131
+ * @returns The Expanded Query Model
132
+ */
133
+ translateToExpanded(simpleQueryModel: SimpleQueryModel): ExpandedQueryModel;
134
+ }
@@ -0,0 +1,2 @@
1
+ import { Filter } from '@sisense/sdk-data';
2
+ export declare const stringifyFilterList: (filters: Filter[], indent?: number) => string;
@@ -0,0 +1,8 @@
1
+ export type MembersFilterJaql = {
2
+ members: string[];
3
+ };
4
+ export type FromNotEqualFilterJaql = {
5
+ fromNotEqual: number;
6
+ };
7
+ export type FilterJaql = MembersFilterJaql | FromNotEqualFilterJaql;
8
+ export declare const stringifyProps: (props: object | string, indent?: number, wrapInQuotes?: boolean) => string;
@@ -0,0 +1,95 @@
1
+ import { MetadataItem } from '@sisense/sdk-query-client';
2
+ import { AxesMapping, NlqResponseData } from '../../ai';
3
+ import { ChartType, WidgetModel } from '../../';
4
+ /**
5
+ * Expanded Query Model that is based on NlqResponseData.
6
+ * It contains expanded JAQL and chart recommendations returned from the chat response.
7
+ *
8
+ * @internal
9
+ */
10
+ export type ExpandedQueryModel = Pick<NlqResponseData, 'jaql' | 'chartRecommendations' | 'queryTitle'>;
11
+ /**
12
+ * Expanded Query Model
13
+ *
14
+ * Used as a default value for ExpandedQueryModel
15
+ *
16
+ * @internal
17
+ */
18
+ export declare const EMPTY_EXPANDED_QUERY_MODEL: ExpandedQueryModel;
19
+ /**
20
+ * Simple Chart Recommendations
21
+ *
22
+ * @internal
23
+ */
24
+ export interface SimpleChartRecommendations {
25
+ chartType: string;
26
+ dataOptions: AxesMapping;
27
+ }
28
+ /**
29
+ * Simple Query Model that is a simplified version of ExpandedQueryModel.
30
+ *
31
+ * It removes any JAQL syntax or information that already exists in the schema.
32
+ * Also, any parameters that have a default do not need to be specified.
33
+ *
34
+ * Users manipulates this model via the query in YAML format.
35
+ *
36
+ * ModelTranslator is responsible for translating this query model to SimpleWidgetModel.
37
+ *
38
+ * @internal
39
+ */
40
+ export interface SimpleQueryModel {
41
+ /**
42
+ * The data model or perspective title.
43
+ */
44
+ model: string;
45
+ metadata: MetadataItem[];
46
+ chart: SimpleChartRecommendations | {};
47
+ /**
48
+ * Title of the query
49
+ */
50
+ queryTitle: string;
51
+ }
52
+ /**
53
+ * Empty Simple Query Model
54
+ *
55
+ * Used as a default value for SimpleQueryModel
56
+ *
57
+ * @internal
58
+ */
59
+ export declare const EMPTY_SIMPLE_QUERY_MODEL: SimpleQueryModel;
60
+ /**
61
+ * Chart Widget Model
62
+ *
63
+ * This model serves two purposes:
64
+ *
65
+ * (1) For rendering a chart widget (including table) in the Query Composer.
66
+ * (2) For reverse engineered (translated) to CSDK code
67
+ *
68
+ * @internal
69
+ */
70
+ export type ChartWidgetModel = Pick<WidgetModel, 'getChartWidgetProps'> & {
71
+ chartType: ChartType;
72
+ queryTitle: string;
73
+ };
74
+ /**
75
+ * UI Framework
76
+ *
77
+ * @internal
78
+ */
79
+ export type UiFramework = 'react' | 'vue' | 'angular';
80
+ /**
81
+ * Code Template Key
82
+ *
83
+ * @internal
84
+ */
85
+ export type CodeTemplateKey = 'baseChartTmpl' | 'chartTmpl' | 'chartWidgetTmpl';
86
+ /**
87
+ * Code Templates
88
+ *
89
+ * @internal
90
+ */
91
+ export type CodeTemplates = {
92
+ [key in UiFramework]: {
93
+ [key in CodeTemplateKey]: string;
94
+ };
95
+ };
@@ -0,0 +1,13 @@
1
+ import { ExpandedQueryModel, SimpleQueryModel } from './types';
2
+ export declare function toKebabCase(str: string): string;
3
+ export declare function capitalizeFirstLetter(str: string): string;
4
+ /**
5
+ * Sanitize ID of a dimension
6
+ *
7
+ * @param str - input string
8
+ * @return sanitized ID
9
+ */
10
+ export declare function sanitizeDimensionId(str: string): string;
11
+ export declare function validateQueryModel(model: any): SimpleQueryModel;
12
+ export declare function isEmptyQueryModel(queryModel: ExpandedQueryModel | undefined | null): boolean;
13
+ export declare function escapeSingleQuotes(str?: string): string | undefined;