@sisense/sdk-ui 2.24.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.
- package/dist/ai.cjs +59 -59
- package/dist/ai.js +919 -980
- package/dist/analytics-composer/node.cjs +1 -1
- package/dist/analytics-composer/node.js +856 -1030
- package/dist/analytics-composer.cjs +1 -1
- package/dist/analytics-composer.js +6 -6
- package/dist/{execute-query-b9oy2Egy.js → apply-styled-options-to-query-BsBTwL6W.js} +1518 -1446
- package/dist/apply-styled-options-to-query-mFJvsssw.cjs +1 -0
- package/dist/{index-Ck-0gJC9.cjs → index-BX9p-XrU.cjs} +1 -1
- package/dist/{index-r66Tjiqj.js → index-D7mHzfx0.js} +9 -0
- package/dist/index.cjs +467 -452
- package/dist/index.js +25112 -32394
- package/dist/index.umd.js +708 -685
- package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/types.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/persist-dashboard-model-middleware.d.ts +17 -5
- package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/types.d.ts +4 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/duplicate-widget/use-duplicate-widget-menu-item.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/rename-widget/use-widget-renaming.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/index.d.ts +2 -0
- package/dist/packages/sdk-ui/src/domains/dashboarding/persistence/persistence-manager.d.ts +11 -0
- package/dist/packages/sdk-ui/src/domains/dashboarding/persistence/types.d.ts +52 -0
- package/dist/packages/sdk-ui/src/domains/dashboarding/types.d.ts +5 -28
- package/dist/packages/sdk-ui/src/domains/dashboarding/use-composed-dashboard.d.ts +4 -2
- package/dist/packages/sdk-ui/src/domains/narrative/components/narrative-collapsible.d.ts +13 -0
- package/dist/packages/sdk-ui/src/domains/narrative/components/narrative-top-slot-shell.d.ts +21 -0
- package/dist/packages/sdk-ui/src/domains/narrative/components/widget-narrative-interactive.d.ts +11 -0
- package/dist/packages/sdk-ui/src/domains/narrative/components/widget-narrative.d.ts +40 -0
- package/dist/packages/sdk-ui/src/domains/narrative/core/build-narrative-request.d.ts +36 -0
- package/dist/packages/sdk-ui/src/domains/narrative/core/get-narrative-dimensions-and-measures.d.ts +22 -0
- package/dist/packages/sdk-ui/src/domains/narrative/core/widget-narrative-options.d.ts +28 -0
- package/dist/packages/sdk-ui/src/domains/narrative/core/widget-props-to-narrative-params.d.ts +36 -0
- package/dist/packages/sdk-ui/src/domains/narrative/hooks/use-get-widget-narrative.d.ts +62 -0
- package/dist/packages/sdk-ui/src/domains/narrative/hooks/use-widget-narrative-state.d.ts +39 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-data-options/apply-styled-options-to-query.d.ts +87 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-data-options/translate-data-options.d.ts +13 -1
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/compose-code-to-readable.d.ts +12 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/index.d.ts +6 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-definition.d.ts +26 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-params-to-view-model.d.ts +12 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-pill-bubble-tooltip.d.ts +12 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-pill.d.ts +13 -0
- package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/types.d.ts +51 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-widget-style-options/to-widget-dto-style.d.ts +50 -2
- package/dist/packages/sdk-ui/src/domains/widgets/widget-model/widget-model-translator/utils.d.ts +9 -0
- package/dist/packages/sdk-ui/src/domains/widgets/widget-model/widget-model-translator/widget-model-translator.d.ts +5 -2
- package/dist/packages/sdk-ui/src/infra/api/narrative/narrative-api-types.d.ts +32 -0
- package/dist/packages/sdk-ui/src/infra/api/narrative/narrative-constants.d.ts +6 -0
- package/dist/packages/sdk-ui/src/{modules/ai/api/narration-endpoints.d.ts → infra/api/narrative/narrative-endpoints.d.ts} +8 -7
- package/dist/packages/sdk-ui/src/infra/api/narrative/send-ai-feedback.d.ts +8 -0
- package/dist/packages/sdk-ui/src/infra/contexts/emotion-cache-provider/emotion-cache-provider.d.ts +31 -3
- package/dist/packages/sdk-ui/src/infra/contexts/emotion-cache-provider/stylis-plugins/css-selector-prefix-plugin.d.ts +18 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/de-de.d.ts +9 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/en-us.d.ts +9 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/es-ar.d.ts +9 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/es-es.d.ts +9 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/fr-fr.d.ts +9 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/it-it.d.ts +9 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ja-jp.d.ts +9 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ko-kr.d.ts +9 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/nl-nl.d.ts +9 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/pt-br.d.ts +9 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ru-ru.d.ts +9 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/tr-tr.d.ts +9 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/zh-cn.d.ts +9 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/en.d.ts +9 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/index.d.ts +18 -0
- package/dist/packages/sdk-ui/src/modules/ai/api/chat-rest-api.d.ts +1 -1
- package/dist/packages/sdk-ui/src/modules/ai/api/types.d.ts +5 -18
- package/dist/packages/sdk-ui/src/modules/ai/chart/nlq-chart-widget.d.ts +2 -0
- package/dist/packages/sdk-ui/src/modules/ai/common/collapsible.d.ts +3 -0
- package/dist/packages/sdk-ui/src/modules/ai/get-nlg-insights-from-widget.d.ts +5 -13
- package/dist/packages/sdk-ui/src/modules/ai/index.d.ts +1 -1
- package/dist/packages/sdk-ui/src/modules/ai/use-get-nlg-insights.d.ts +4 -26
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/types.d.ts +3 -7
- package/dist/packages/sdk-ui/src/props.d.ts +1 -1
- package/dist/packages/sdk-ui/src/public-api/sisense-internal.d.ts +7 -1
- package/dist/packages/sdk-ui/src/types.d.ts +1 -1
- package/dist/parse-compose-code-DfZskSng.js +352 -0
- package/dist/parse-compose-code-v4J9BrUg.cjs +1 -0
- package/dist/translations/de-de.cjs +1 -1
- package/dist/translations/de-de.js +10 -1
- package/dist/translations/en-us.cjs +1 -1
- package/dist/translations/en-us.js +1 -1
- package/dist/translations/es-ar.cjs +1 -1
- package/dist/translations/es-ar.js +10 -1
- package/dist/translations/es-es.cjs +1 -1
- package/dist/translations/es-es.js +10 -1
- package/dist/translations/fr-fr.cjs +1 -1
- package/dist/translations/fr-fr.js +10 -1
- package/dist/translations/it-it.cjs +1 -1
- package/dist/translations/it-it.js +12 -3
- package/dist/translations/ja-jp.cjs +1 -1
- package/dist/translations/ja-jp.js +12 -3
- package/dist/translations/ko-kr.cjs +1 -1
- package/dist/translations/ko-kr.js +12 -3
- package/dist/translations/nl-nl.cjs +1 -1
- package/dist/translations/nl-nl.js +12 -3
- package/dist/translations/pt-br.cjs +1 -1
- package/dist/translations/pt-br.js +10 -1
- package/dist/translations/ru-ru.cjs +1 -1
- package/dist/translations/ru-ru.js +12 -3
- package/dist/translations/tr-tr.cjs +1 -1
- package/dist/translations/tr-tr.js +10 -1
- package/dist/translations/zh-cn.cjs +1 -1
- package/dist/translations/zh-cn.js +12 -3
- package/dist/{types-DJtC8_5_.js → types-BBp2sp_s.js} +1 -1
- package/dist/types-GFLaiax5.cjs +1 -0
- package/dist/use-hover-DsnmY-p_.cjs +721 -0
- package/dist/{quota-notification-CeKnEyQG.js → use-hover-mptQLQ4S.js} +27603 -19263
- package/dist/{utils-D8O1_kl3.cjs → utils-BlNqPAG8.cjs} +45 -45
- package/dist/{utils-BCp2ISWh.js → utils-DTUC-wtI.js} +7724 -7512
- package/dist/{widget-composer-BkHZISs7.cjs → widget-composer-CDb2iOoS.cjs} +1 -1
- package/dist/{widget-composer-CDNL9_XF.js → widget-composer-D0BZrLna.js} +3 -3
- package/package.json +11 -10
- package/dist/dimensions-C1R5YRt-.js +0 -204
- package/dist/dimensions-C7yXAoZs.cjs +0 -1
- package/dist/execute-query-0Y9Fn9Pf.cjs +0 -1
- package/dist/packages/sdk-ui/src/infra/styled/index.d.ts +0 -4
- package/dist/packages/sdk-ui/src/infra/styled/with-css-selector-prefix.d.ts +0 -2
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/query/constants.d.ts +0 -8
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/utils/parse-compose-code.d.ts +0 -34
- package/dist/quota-notification-BqRYSJ7r.cjs +0 -713
- package/dist/types-C0QU2tsE.cjs +0 -1
|
@@ -435,6 +435,15 @@ export declare const resources: {
|
|
|
435
435
|
loadingOverlay: {
|
|
436
436
|
label: string;
|
|
437
437
|
};
|
|
438
|
+
queryDefinition: {
|
|
439
|
+
showMorePills: string;
|
|
440
|
+
showLess: string;
|
|
441
|
+
connectorBy: string;
|
|
442
|
+
connectorWhere: string;
|
|
443
|
+
tooltipType: string;
|
|
444
|
+
tooltipColumn: string;
|
|
445
|
+
tooltipFormula: string;
|
|
446
|
+
};
|
|
438
447
|
measures: {
|
|
439
448
|
countShort: string;
|
|
440
449
|
countDistinct: string;
|
|
@@ -875,6 +884,15 @@ export declare const resources: {
|
|
|
875
884
|
loadingOverlay: {
|
|
876
885
|
label: string;
|
|
877
886
|
};
|
|
887
|
+
queryDefinition: {
|
|
888
|
+
showMorePills: string;
|
|
889
|
+
showLess: string;
|
|
890
|
+
connectorBy: string;
|
|
891
|
+
connectorWhere: string;
|
|
892
|
+
tooltipType: string;
|
|
893
|
+
tooltipColumn: string;
|
|
894
|
+
tooltipFormula: string;
|
|
895
|
+
};
|
|
878
896
|
measures: {
|
|
879
897
|
countShort: string;
|
|
880
898
|
countDistinct: string;
|
|
@@ -20,7 +20,7 @@ export declare class ChatRestApi {
|
|
|
20
20
|
private deleteChatHistory;
|
|
21
21
|
private sendFeedback;
|
|
22
22
|
ai: {
|
|
23
|
-
getNlgInsights: (request: GetNlgInsightsRequest) => Promise<import(
|
|
23
|
+
getNlgInsights: (request: GetNlgInsightsRequest) => Promise<import("../../../infra/api/narrative/narrative-api-types").NarrativeResponse>;
|
|
24
24
|
getNlqResult: (contextTitle: string, request: GetNlqResultRequest) => Promise<NlqResult | undefined>;
|
|
25
25
|
getQueryRecommendations: (contextTitle: string, config: QueryRecommendationConfig) => Promise<QueryRecommendationResponse | undefined>;
|
|
26
26
|
setLlmConfig: (config: LlmConfig) => Promise<unknown>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { JaqlQueryPayload } from '@sisense/sdk-query-client';
|
|
2
1
|
import { WidgetProps } from '../../../domains/widgets/components/widget/types';
|
|
2
|
+
import type { GetNlgInsightsResponse as GetNlgInsightsResponseInfra, SendAiFeedbackRequest } from '../../../infra/api/narrative/narrative-api-types.js';
|
|
3
3
|
import { ExpandedQueryModel } from '../../../modules/analytics-composer';
|
|
4
4
|
export interface ChatContext {
|
|
5
5
|
title: string;
|
|
@@ -102,17 +102,9 @@ export type NlqResult = Omit<NlqResponseData, 'followupQuestions'>;
|
|
|
102
102
|
export interface QueryRecommendation extends Omit<NlqResponseData, 'followupQuestions'> {
|
|
103
103
|
}
|
|
104
104
|
export type QueryRecommendationResponse = QueryRecommendation[];
|
|
105
|
-
export
|
|
106
|
-
jaql: Pick<JaqlQueryPayload, 'datasource' | 'metadata' | 'filterRelations'>;
|
|
107
|
-
verbosity?: 'Low' | 'High';
|
|
108
|
-
}
|
|
105
|
+
export type { GetNlgInsightsRequest } from '../../../infra/api/narrative/narrative-api-types.js';
|
|
109
106
|
/** @internal */
|
|
110
|
-
export
|
|
111
|
-
data?: {
|
|
112
|
-
answer: string;
|
|
113
|
-
};
|
|
114
|
-
responseType: 'Text';
|
|
115
|
-
}
|
|
107
|
+
export type GetNlgInsightsResponse = GetNlgInsightsResponseInfra;
|
|
116
108
|
/** @internal */
|
|
117
109
|
export declare const NLQ_RESULT_CHART_TYPES: readonly ["indicator", "column", "line", "table", "pie", "bar"];
|
|
118
110
|
/** NLQ result chart types @expandType */
|
|
@@ -122,12 +114,8 @@ export interface GetNlqResultRequest {
|
|
|
122
114
|
timezone?: string;
|
|
123
115
|
chartTypes: NlqResultChartType[];
|
|
124
116
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
data: object;
|
|
128
|
-
sourceId: string;
|
|
129
|
-
rating: -1 | 1;
|
|
130
|
-
}
|
|
117
|
+
/** @internal */
|
|
118
|
+
export type SendFeedbackRequest = SendAiFeedbackRequest;
|
|
131
119
|
/**
|
|
132
120
|
* The chat mode to use for a chat session
|
|
133
121
|
*
|
|
@@ -135,4 +123,3 @@ export interface SendFeedbackRequest {
|
|
|
135
123
|
* develop: Enable developers to build queries and charts for embedded analytics
|
|
136
124
|
*/
|
|
137
125
|
export type ChatMode = 'analyze' | 'develop';
|
|
138
|
-
export {};
|
|
@@ -40,6 +40,8 @@ export interface NlqChartWidgetProps {
|
|
|
40
40
|
/**
|
|
41
41
|
* React component that renders a chart widget based on NLQ response data.
|
|
42
42
|
*
|
|
43
|
+
* @deprecated Prefer composing `ChartWidget` with `WidgetNarrative` when using `WidgetProps` for new embeds.
|
|
44
|
+
*
|
|
43
45
|
* @example
|
|
44
46
|
* ```tsx
|
|
45
47
|
* import { NlqChartWidget, NlqResponseData } from '@sisense/sdk-ui/ai';
|
|
@@ -4,6 +4,9 @@ type CollapsibleProps = {
|
|
|
4
4
|
/**
|
|
5
5
|
* Text container with an expand/collapse button for text over the character limit.
|
|
6
6
|
*
|
|
7
|
+
* Uses `max-height` + `overflow: hidden` when collapsed (not `line-clamp`), because
|
|
8
|
+
* `white-space: pre-wrap` is incompatible with `-webkit-line-clamp` in browsers.
|
|
9
|
+
*
|
|
7
10
|
* @internal
|
|
8
11
|
*/
|
|
9
12
|
export default function Collapsible({ text }: CollapsibleProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,31 +1,23 @@
|
|
|
1
|
-
import { DataSource } from '@sisense/sdk-data';
|
|
2
1
|
import { HttpClient } from '@sisense/sdk-rest-client';
|
|
2
|
+
import type { WidgetNarrativeNlgOptions } from '../../domains/narrative/core/widget-narrative-options.js';
|
|
3
3
|
import { WidgetProps } from '../../domains/widgets/components/widget/types';
|
|
4
4
|
/**
|
|
5
5
|
* Options for {@link getNlgInsightsFromWidget} function.
|
|
6
|
+
*
|
|
6
7
|
* @internal
|
|
7
8
|
*/
|
|
8
|
-
export
|
|
9
|
-
/** Optional default data source to use if WidgetProps.dataSource is undefined */
|
|
10
|
-
defaultDataSource?: DataSource;
|
|
11
|
-
/** The verbosity of the NLG summarization */
|
|
12
|
-
verbosity?: 'Low' | 'High';
|
|
13
|
-
/** When false, legacy narration endpoint only; when true or undefined, try unified then fallback. From props.isUnifiedNarrationEnabled. */
|
|
14
|
-
isUnifiedNarrationEnabled?: boolean;
|
|
15
|
-
isSisenseAiEnabled?: boolean;
|
|
16
|
-
}
|
|
9
|
+
export type GetNlgInsightsFromWidgetOptions = WidgetNarrativeNlgOptions;
|
|
17
10
|
/**
|
|
18
11
|
* Pure function that fetches NLG insights from WidgetProps.
|
|
19
12
|
*
|
|
20
13
|
* This function converts WidgetProps to the required API format and makes an HTTP request
|
|
21
|
-
* to get natural language insights about the chart data.
|
|
14
|
+
* to get natural language insights about the chart or pivot data.
|
|
22
15
|
*
|
|
23
|
-
* @param props - WidgetProps containing chart configuration
|
|
16
|
+
* @param props - WidgetProps containing chart or pivot configuration
|
|
24
17
|
* @param httpClient - HttpClient instance for making API requests
|
|
25
18
|
* @param options - Optional configuration including defaultDataSource and verbosity
|
|
26
19
|
* @returns Promise that resolves to the NLG insights answer string
|
|
27
20
|
* @throws Error if dataSource cannot be resolved or if API response is invalid
|
|
28
|
-
*
|
|
29
21
|
* @example
|
|
30
22
|
* ```typescript
|
|
31
23
|
* import { getNlgInsightsFromWidget } from '@sisense/sdk-ui/ai';
|
|
@@ -13,6 +13,6 @@ export { default as GetNlgInsights, type GetNlgInsightsProps } from './get-nlg-i
|
|
|
13
13
|
export { NlqChartWidget, type NlqChartWidgetProps } from './chart/nlq-chart-widget.js';
|
|
14
14
|
export { ChatRestApi } from './api/chat-rest-api.js';
|
|
15
15
|
export { CustomAiContextProvider, type CustomAiContext, type CustomAiContextProviderProps, } from './custom-ai-context-provider.js';
|
|
16
|
-
export { prepareGetNlgInsightsPayload } from '
|
|
16
|
+
export { prepareGetNlgInsightsPayload } from '../../domains/narrative/core/build-narrative-request.js';
|
|
17
17
|
export { getNlgInsightsFromWidget, type GetNlgInsightsFromWidgetOptions, } from './get-nlg-insights-from-widget.js';
|
|
18
18
|
export { widgetComposer } from '../../modules/analytics-composer';
|
|
@@ -1,27 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { GetNlgInsightsRequest } from '
|
|
3
|
-
import { GetNlgInsightsProps } from './get-nlg-insights.js';
|
|
4
|
-
|
|
5
|
-
* Parameters for {@link useGetNlgInsights} hook.
|
|
6
|
-
*/
|
|
7
|
-
export interface UseGetNlgInsightsParams {
|
|
8
|
-
/** The data source that the query targets - e.g. `Sample ECommerce` */
|
|
9
|
-
dataSource: DataSource;
|
|
10
|
-
/** Dimensions of the query */
|
|
11
|
-
dimensions?: Attribute[];
|
|
12
|
-
/** Measures of the query */
|
|
13
|
-
measures?: Measure[];
|
|
14
|
-
/** Filters of the query */
|
|
15
|
-
filters?: Filter[] | FilterRelations;
|
|
16
|
-
/**
|
|
17
|
-
* Boolean flag to enable/disable API call by default
|
|
18
|
-
*
|
|
19
|
-
* If not specified, the default value is `true`
|
|
20
|
-
*/
|
|
21
|
-
enabled?: boolean;
|
|
22
|
-
/** The verbosity of the NLG summarization */
|
|
23
|
-
verbosity?: 'Low' | 'High';
|
|
24
|
-
}
|
|
1
|
+
import { prepareGetNlgInsightsPayload, type UseGetNlgInsightsParams } from '../../domains/narrative/core/build-narrative-request.js';
|
|
2
|
+
import type { GetNlgInsightsRequest } from '../../infra/api/narrative/narrative-api-types.js';
|
|
3
|
+
import type { GetNlgInsightsProps } from './get-nlg-insights.js';
|
|
4
|
+
export { prepareGetNlgInsightsPayload, type UseGetNlgInsightsParams };
|
|
25
5
|
/**
|
|
26
6
|
* State for {@link useGetNlgInsights} hook.
|
|
27
7
|
*/
|
|
@@ -39,8 +19,6 @@ export interface UseGetNlgInsightsState {
|
|
|
39
19
|
/** Callback to trigger a refetch of the data */
|
|
40
20
|
refetch: () => void;
|
|
41
21
|
}
|
|
42
|
-
/** @internal */
|
|
43
|
-
export declare function prepareGetNlgInsightsPayload(params: UseGetNlgInsightsParams | GetNlgInsightsRequest): GetNlgInsightsRequest;
|
|
44
22
|
/**
|
|
45
23
|
*
|
|
46
24
|
* @param params - {@link UseGetNlgInsightsParams}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Attribute, Filter, FilterRelations, JaqlDataSourceForDto, JSONArray, Measure, PivotGrandTotals } from '@sisense/sdk-data';
|
|
1
|
+
import { type Arg, type ArgValue, Attribute, Filter, FilterRelations, type FunctionCall, JaqlDataSourceForDto, JSONArray, Measure, PivotGrandTotals } from '@sisense/sdk-data';
|
|
2
2
|
import { CategoryStyle, SeriesStyle, ValueStyle } from '../../../public-api/index.js';
|
|
3
3
|
import type { PivotTableStyleOptions } from '../../../types.js';
|
|
4
4
|
import { DataSchemaContext, NlqTranslationInput } from '../types.js';
|
|
@@ -16,20 +16,16 @@ export interface InternalDataSchemaContext {
|
|
|
16
16
|
chartType?: string;
|
|
17
17
|
}
|
|
18
18
|
export declare const DIMENSIONAL_NAME_PREFIX = "DM.";
|
|
19
|
+
/** Re-exported from `@sisense/sdk-data` (compose-code parse tree). */
|
|
20
|
+
export type { Arg, ArgValue, FunctionCall };
|
|
19
21
|
export type ArgType = 'string' | 'string[]' | 'number' | 'number[]' | 'boolean' | 'Attribute' | 'Attribute[]' | 'Measure' | 'BaseMeasure' | 'Measure[]' | 'Filter' | 'Filter[]' | 'FilterRelationsNode' | 'DateDimension' | 'LevelAttribute' | 'Measure | number' | 'Date | string' | 'string | number' | 'BaseFilterConfig' | 'MembersFilterConfig' | 'CustomFormulaContext' | 'any';
|
|
20
22
|
export interface ArgSchema {
|
|
21
23
|
type: ArgType;
|
|
22
24
|
required: boolean;
|
|
23
25
|
}
|
|
24
|
-
export type ArgValue = string | number | boolean | FunctionCall | string[];
|
|
25
|
-
export type Arg = ArgValue | Record<string, ArgValue>;
|
|
26
26
|
export type ProcessedArg = unknown;
|
|
27
27
|
export type QueryElement = Filter | FilterRelations | Measure;
|
|
28
28
|
export type FactoryFunction = (...args: unknown[]) => QueryElement;
|
|
29
|
-
export type FunctionCall = {
|
|
30
|
-
function: string;
|
|
31
|
-
args: Arg[];
|
|
32
|
-
};
|
|
33
29
|
/**
|
|
34
30
|
* Context object passed to all custom processors containing runtime information
|
|
35
31
|
* needed for processing.
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* Such APIs are for in-company usage only.
|
|
5
5
|
* These APIs may change for in-company needs and are not part of the public contract.
|
|
6
6
|
*/
|
|
7
|
-
export { useDashboardPersistence } from '../domains/dashboarding/dashboard-model';
|
|
8
7
|
export { translateFiltersAndRelationsToDto } from '../domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/utils.js';
|
|
9
8
|
export { UseDashboardModelActionType } from '../domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/types.js';
|
|
10
9
|
export { type DashboardDto } from '../infra/api/types/dashboard-dto';
|
|
@@ -24,7 +23,14 @@ export type { Plugin } from '../infra/plugins/types.js';
|
|
|
24
23
|
export type { WidgetPlugin, CustomVisualization, CustomVisualizationProps, CustomVisualizationStyleOptions, CustomVisualizationEventProps, CustomVisualizationDataPoint, CustomVisualizationDataPointEventHandler, CustomVisualizationDataPointContextMenuHandler, CustomVisualizationDataPointsEventHandler, DesignPanelProps, DesignPanel, } from '../infra/plugins/widget-plugins/types.js';
|
|
25
24
|
export { LoadingIndicator } from '../shared/components/loading-indicator.js';
|
|
26
25
|
export { DataSchemaBrowser } from '../domains/data-browser/data-schema-browser/data-schema-browser.js';
|
|
26
|
+
export { type NarrativeQueryParams } from '../domains/narrative/core/build-narrative-request.js';
|
|
27
|
+
export { useGetWidgetNarrative, type UseGetWidgetNarrativeOptions, type UseGetWidgetNarrativeParams, type UseGetWidgetNarrativeResult, } from '../domains/narrative/hooks/use-get-widget-narrative.js';
|
|
28
|
+
export { WidgetNarrative, type WidgetNarrativeProps, } from '../domains/narrative/components/widget-narrative.js';
|
|
27
29
|
export type { NlqChartWidgetStyleOptions } from '../types';
|
|
28
30
|
export type { RenderTitleHandler } from '../types';
|
|
29
31
|
export { isChartWidgetProps } from '../domains/widgets/components/widget-by-id/utils.js';
|
|
30
32
|
export { isPivotTableWidgetProps } from '../domains/widgets/components/widget-by-id/utils.js';
|
|
33
|
+
export { useDashboardPersistence } from '../domains/dashboarding/dashboard-model';
|
|
34
|
+
export { createDashboardPersistenceManager } from '../domains/dashboarding/persistence/persistence-manager.js';
|
|
35
|
+
export type { DashboardPersistenceManager } from '../domains/dashboarding/persistence/types.js';
|
|
36
|
+
export { QueryDefinition, type QueryDefinitionProps, type QueryPillCategory, type QueryPillItem, type QueryDefinitionViewModel, } from '../domains/visualizations/core/query-definition';
|
|
@@ -1964,7 +1964,7 @@ export type CompleteThemeSettings = DeepRequired<Omit<ThemeSettings, 'typography
|
|
|
1964
1964
|
fontsLoader?: FontsLoaderSettings;
|
|
1965
1965
|
};
|
|
1966
1966
|
};
|
|
1967
|
-
/** @
|
|
1967
|
+
/** @alpha */
|
|
1968
1968
|
export type ThemeConfig = {
|
|
1969
1969
|
cssSelectorPrefix?: {
|
|
1970
1970
|
enabled?: boolean;
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { D as x, M as m, S as y, p as R, a as S, w, n as A, j as W, b as u, c as l, d as b } from "./apply-styled-options-to-query-BsBTwL6W.js";
|
|
2
|
+
class g extends x {
|
|
3
|
+
constructor(i, e, n, s, r, a, h, c, d, f) {
|
|
4
|
+
if (super(i, r || m.Dimension, a, c, d), this.__serializable = "DimensionalDimension", this._dimensions = [], this._attributes = [], this._sort = y.None, !d && e) {
|
|
5
|
+
const { table: p, column: o } = R(e);
|
|
6
|
+
this.composeCode = `${S}.${w(p)}.${w(o)}`;
|
|
7
|
+
}
|
|
8
|
+
this._sort = h || y.None, this._expression = e, this.setDimensions(s || []), this.setAttributes(n), f && (this.defaultAttribute = f);
|
|
9
|
+
}
|
|
10
|
+
static parseType(i) {
|
|
11
|
+
switch (i) {
|
|
12
|
+
case "datetime":
|
|
13
|
+
case m.DateDimension:
|
|
14
|
+
return m.DateDimension;
|
|
15
|
+
case "text":
|
|
16
|
+
case m.TextDimension:
|
|
17
|
+
return m.TextDimension;
|
|
18
|
+
case "numeric":
|
|
19
|
+
case m.NumericDimension:
|
|
20
|
+
return m.NumericDimension;
|
|
21
|
+
}
|
|
22
|
+
return m.TextDimension;
|
|
23
|
+
}
|
|
24
|
+
getAttachedName(i, e) {
|
|
25
|
+
let n = i;
|
|
26
|
+
const s = A(i);
|
|
27
|
+
return (s === "id" || s === "name" || Object.getOwnPropertyDescriptor(this, s) !== void 0 || this[s] !== void 0) && (n = e), n;
|
|
28
|
+
}
|
|
29
|
+
setDimensions(i) {
|
|
30
|
+
this._dimensions = i;
|
|
31
|
+
for (let e = 0; e < i.length; e++) {
|
|
32
|
+
const n = this.getAttachedName(i[e].name, i[e].attributes[0].expression);
|
|
33
|
+
this[A(n)] = i[e], n != i[e].name && (i[e].name = n);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
setAttributes(i) {
|
|
37
|
+
this._attributes = i || [];
|
|
38
|
+
for (let e = 0; e < i.length; e++) {
|
|
39
|
+
const n = this.getAttachedName(i[e].name, i[e].expression);
|
|
40
|
+
this[A(n)] = i[e], i[e].name != n && (i[e].name = n);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* gets the element's ID
|
|
45
|
+
*/
|
|
46
|
+
get id() {
|
|
47
|
+
return this._expression;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Gets the child attributes
|
|
51
|
+
*/
|
|
52
|
+
get attributes() {
|
|
53
|
+
return this._attributes;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Gets the child dimensions
|
|
57
|
+
*/
|
|
58
|
+
get dimensions() {
|
|
59
|
+
return this._dimensions;
|
|
60
|
+
}
|
|
61
|
+
get expression() {
|
|
62
|
+
return this._expression;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Gets the sort definition of this instance
|
|
66
|
+
*
|
|
67
|
+
* @returns The Sort definition of this instance
|
|
68
|
+
*/
|
|
69
|
+
getSort() {
|
|
70
|
+
return this._sort;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Gets a sorted {@link Dimension} with the given definition
|
|
74
|
+
*
|
|
75
|
+
* @param sort - Sort definition
|
|
76
|
+
* @returns An instance representing the sorted {@link Dimension} of this instance
|
|
77
|
+
*/
|
|
78
|
+
sort(i) {
|
|
79
|
+
return new g(this.name, this.expression, this.attributes, this.dimensions, this.type, this.description, i, this.dataSource, this.composeCode, this.defaultAttribute);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Gets a serializable representation of the element
|
|
83
|
+
*/
|
|
84
|
+
serialize() {
|
|
85
|
+
const i = super.serialize();
|
|
86
|
+
return i.expression = this.expression, this.getSort() !== void 0 && (i.sort = this.getSort()), i.attributes = this._attributes.map((e) => e.serialize()), i.dimensions = this._dimensions.map((e) => e.serialize()), this.defaultAttribute && (i.defaultAttribute = this.defaultAttribute.serialize()), i;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Gets the JAQL representation of this instance
|
|
90
|
+
*
|
|
91
|
+
* @param nested - defines whether the JAQL is nested within parent JAQL statement or a root JAQL element
|
|
92
|
+
*/
|
|
93
|
+
jaql(i) {
|
|
94
|
+
if (this.defaultAttribute)
|
|
95
|
+
return this.defaultAttribute.jaql(i);
|
|
96
|
+
if (this.dimensions.length > 0)
|
|
97
|
+
return this.dimensions[0].jaql(i);
|
|
98
|
+
const e = {
|
|
99
|
+
jaql: {
|
|
100
|
+
title: this.name,
|
|
101
|
+
dim: this.expression,
|
|
102
|
+
datatype: W(this.type)
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
return this._sort != y.None && (e.jaql.sort = this._sort == y.Ascending ? "asc" : "desc"), i === !0 ? e.jaql : e;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const L = (t) => t && t.__serializable === "DimensionalDimension";
|
|
109
|
+
class D extends g {
|
|
110
|
+
constructor(i, e, n, s, r, a, h, c) {
|
|
111
|
+
super(i, e, [], [], m.DateDimension, n, s, r, a), this.__serializable = "DimensionalDateDimension";
|
|
112
|
+
const d = [n, s, r, void 0, void 0, h, c];
|
|
113
|
+
this.defaultLevel = u.Years, this.Years = new l(u.Years, e, u.Years, "yyyy", ...d), this.Quarters = new l(u.Quarters, e, u.Quarters, "Q yyyy", ...d), this.Months = new l(u.Months, e, u.Months, "yyyy-MM", ...d), this.Weeks = new l(u.Weeks, e, u.Weeks, "ww yyyy", ...d), this.Days = new l(u.Days, e, u.Days, "yyyy-MM-dd", ...d), this.Hours = new l(u.Hours, e, u.Hours, "yyyy-MM-dd HH:mm", ...d), this.MinutesRoundTo30 = new l(u.MinutesRoundTo30, e, u.MinutesRoundTo30, "yyyy-MM-dd HH:mm", n, s, r), this.MinutesRoundTo15 = new l(u.MinutesRoundTo15, e, u.MinutesRoundTo15, "yyyy-MM-dd HH:mm", ...d), this.Minutes = new l(u.Minutes, e, u.Minutes, "yyyy-MM-dd HH:mm", ...d), this.Seconds = new l(u.Seconds, e, u.Seconds, "yyyy-MM-dd HH:mm:ss", n, s, r), this.AggHours = new l(u.AggHours, e, u.AggHours, "HH:mm", ...d), this.AggMinutesRoundTo30 = new l(u.AggMinutesRoundTo30, e, u.AggMinutesRoundTo30, "HH:mm", n, s, r), this.AggMinutesRoundTo15 = new l(u.AggMinutesRoundTo15, e, u.AggMinutesRoundTo15, "HH:mm", ...d), this.AggMinutesRoundTo1 = new l(u.AggMinutesRoundTo1, e, u.AggMinutesRoundTo1, "HH:mm", ...d), this.setAttributes([
|
|
114
|
+
this.Years,
|
|
115
|
+
this.Quarters,
|
|
116
|
+
this.Months,
|
|
117
|
+
this.Weeks,
|
|
118
|
+
this.Days,
|
|
119
|
+
this.Hours,
|
|
120
|
+
this.MinutesRoundTo30,
|
|
121
|
+
this.MinutesRoundTo15,
|
|
122
|
+
this.Minutes,
|
|
123
|
+
this.Seconds,
|
|
124
|
+
this.AggHours,
|
|
125
|
+
this.AggMinutesRoundTo30,
|
|
126
|
+
this.AggMinutesRoundTo15,
|
|
127
|
+
this.AggMinutesRoundTo1
|
|
128
|
+
]);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* gets the element's ID
|
|
132
|
+
*/
|
|
133
|
+
get id() {
|
|
134
|
+
return this.expression;
|
|
135
|
+
}
|
|
136
|
+
setDimensions() {
|
|
137
|
+
}
|
|
138
|
+
setAttributes(i) {
|
|
139
|
+
this._attributes = i;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Gets the sort definition of this instance
|
|
143
|
+
*
|
|
144
|
+
* @returns The Sort definition of this instance
|
|
145
|
+
*/
|
|
146
|
+
getSort() {
|
|
147
|
+
return this._sort;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Gets a sorted {@link Dimension} with the given definition
|
|
151
|
+
*
|
|
152
|
+
* @param sort - Sort definition
|
|
153
|
+
* @returns An instance representing the sorted {@link Dimension} of this instance
|
|
154
|
+
*/
|
|
155
|
+
sort(i) {
|
|
156
|
+
return new D(this.name, this.expression, this.description, i, this.dataSource, this.composeCode, this.indexed, this.merged);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Gets a serializable representation of the element
|
|
160
|
+
*/
|
|
161
|
+
serialize() {
|
|
162
|
+
return super.serialize();
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Gets the JAQL representation of this instance
|
|
166
|
+
*
|
|
167
|
+
* @param nested - defines whether the JAQL is nested within parent JAQL statement or a root JAQL element
|
|
168
|
+
*/
|
|
169
|
+
jaql(i) {
|
|
170
|
+
const e = this[this.defaultLevel].jaql();
|
|
171
|
+
return e.jaql.title = this.name, i ? e.jaql : e;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
const I = (t) => t && t.__serializable === "DimensionalDateDimension";
|
|
175
|
+
function z(t) {
|
|
176
|
+
const i = t.name || t.title, e = t.desc || t.description, n = t.expression || t.dim, s = g.parseType(t.dimtype || t.type), r = t.sort, a = t.dataSource, h = t.indexed, c = t.merged;
|
|
177
|
+
if (s == m.DateDimension)
|
|
178
|
+
return new D(i, n, e, r, a, void 0, h, c);
|
|
179
|
+
const d = Object.getOwnPropertyNames(t).map((o) => t[o]).filter((o) => m.isAttribute(o == null ? void 0 : o.type));
|
|
180
|
+
if (d.length == 0)
|
|
181
|
+
if (t.attributes) {
|
|
182
|
+
let o;
|
|
183
|
+
for (let M = 0; M < t.attributes.length; M++)
|
|
184
|
+
o = t.attributes[M], d.push(new b(o.name, o.expression, o.type, o.description, o.sort, o.dataSource, void 0, void 0, o.indexed, o.merged));
|
|
185
|
+
} else n && d.push(new b(i, n, s, e, r, a, void 0, void 0, h, c));
|
|
186
|
+
const f = Object.getOwnPropertyNames(t).map((o) => t[o]).filter((o) => m.isDimension(o == null ? void 0 : o.type));
|
|
187
|
+
if (f.length == 0 && t.dimensions)
|
|
188
|
+
for (let o = 0; o < t.dimensions.length; o++)
|
|
189
|
+
f.push(z(t.dimensions[o]));
|
|
190
|
+
const p = new g(i, n, d, f, s, e, r, a);
|
|
191
|
+
return t.defaultAttribute && (p.defaultAttribute = d.find((o) => o.name === t.defaultAttribute)), p;
|
|
192
|
+
}
|
|
193
|
+
function Q(t) {
|
|
194
|
+
const i = t.name || t.title, e = t.expression || t.dim, n = t.desc || t.description, s = t.sort, r = t.dataSource;
|
|
195
|
+
return new D(i, e, n, s, r, void 0, t.indexed, t.merged);
|
|
196
|
+
}
|
|
197
|
+
function T(t, i) {
|
|
198
|
+
const e = [];
|
|
199
|
+
let n = "", s = 0, r = !1, a = null;
|
|
200
|
+
for (let h = 0; h < t.length; h++) {
|
|
201
|
+
const c = t[h], d = t[h + 1];
|
|
202
|
+
if (r) {
|
|
203
|
+
if (c !== a) {
|
|
204
|
+
n += c;
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
if (d === a) {
|
|
208
|
+
n += c + d, h++;
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
r = !1, a = null, n += c;
|
|
212
|
+
continue;
|
|
213
|
+
} else {
|
|
214
|
+
if (c === "'" || c === '"') {
|
|
215
|
+
r = !0, a = c, n += c;
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
if ("([{".includes(c) && s++, ")]}".includes(c) && s--, c === i && s === 0) {
|
|
219
|
+
e.push(n.trim()), n = "";
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
n += c;
|
|
224
|
+
}
|
|
225
|
+
return n.trim() && e.push(n.trim()), e;
|
|
226
|
+
}
|
|
227
|
+
function N(t, i) {
|
|
228
|
+
let e = 0, n = !1, s = null;
|
|
229
|
+
for (let r = 0; r < t.length; r++) {
|
|
230
|
+
const a = t[r], h = t[r + 1];
|
|
231
|
+
if (n) {
|
|
232
|
+
if (a !== s)
|
|
233
|
+
continue;
|
|
234
|
+
if (h === s) {
|
|
235
|
+
r++;
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
n = !1, s = null;
|
|
239
|
+
} else {
|
|
240
|
+
if (a === "'" || a === '"') {
|
|
241
|
+
n = !0, s = a;
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
if ("([{".includes(a) && e++, ")]}".includes(a) && e--, a === i && e === 0)
|
|
245
|
+
return r;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return -1;
|
|
249
|
+
}
|
|
250
|
+
function Y(t, i) {
|
|
251
|
+
if (t[i] !== "(")
|
|
252
|
+
return -1;
|
|
253
|
+
let e = 1, n = i + 1, s = !1, r = null;
|
|
254
|
+
for (; n < t.length; ) {
|
|
255
|
+
const a = t[n], h = t[n + 1];
|
|
256
|
+
if (s) {
|
|
257
|
+
if (a !== r) {
|
|
258
|
+
n++;
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
if (h === r) {
|
|
262
|
+
n += 2;
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
s = !1, r = null, n++;
|
|
266
|
+
} else {
|
|
267
|
+
if (a === "'" || a === '"') {
|
|
268
|
+
s = !0, r = a, n++;
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
if ("([{".includes(a) && e++, ")]}".includes(a) && --e === 0)
|
|
272
|
+
return n;
|
|
273
|
+
n++;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return -1;
|
|
277
|
+
}
|
|
278
|
+
function C(t) {
|
|
279
|
+
return t.startsWith("'") && t.endsWith("'") || t.startsWith('"') && t.endsWith('"') ? t.slice(1, -1) : t;
|
|
280
|
+
}
|
|
281
|
+
function q(t) {
|
|
282
|
+
if (!t || typeof t != "string")
|
|
283
|
+
throw new Error(`Invalid composeCode: expected non-empty string, got ${typeof t}`);
|
|
284
|
+
const i = t.trim();
|
|
285
|
+
if (!i)
|
|
286
|
+
throw new Error("Invalid composeCode: empty string");
|
|
287
|
+
const e = i.match(/^([a-zA-Z_$][a-zA-Z0-9_.$]*)\s*\((.*)\)$/);
|
|
288
|
+
if (!e)
|
|
289
|
+
throw new Error(`Invalid composeCode format: expected function call, got '${i}'`);
|
|
290
|
+
const n = e[1], s = e[2], r = _(s);
|
|
291
|
+
return {
|
|
292
|
+
function: n,
|
|
293
|
+
args: r
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
function _(t) {
|
|
297
|
+
return t.trim() ? T(t, ",").map(H) : [];
|
|
298
|
+
}
|
|
299
|
+
function H(t) {
|
|
300
|
+
if (!t)
|
|
301
|
+
throw new Error("Cannot parse empty argument value");
|
|
302
|
+
if (t === "null")
|
|
303
|
+
return null;
|
|
304
|
+
if (t === "undefined")
|
|
305
|
+
return;
|
|
306
|
+
if (t === "true")
|
|
307
|
+
return !0;
|
|
308
|
+
if (t === "false")
|
|
309
|
+
return !1;
|
|
310
|
+
if (t.match(/^-?\d+(\.\d+)?$/))
|
|
311
|
+
return parseFloat(t);
|
|
312
|
+
if (t.startsWith("'") && t.endsWith("'") || t.startsWith('"') && t.endsWith('"')) {
|
|
313
|
+
const e = t[0];
|
|
314
|
+
return t.slice(1, -1).replace(new RegExp(`${e}${e}`, "g"), e);
|
|
315
|
+
}
|
|
316
|
+
if (t.startsWith("[") && t.endsWith("]")) {
|
|
317
|
+
const e = t.slice(1, -1).trim();
|
|
318
|
+
if (!e)
|
|
319
|
+
return [];
|
|
320
|
+
const n = _(e);
|
|
321
|
+
return n.every((s) => typeof s == "string"), n;
|
|
322
|
+
}
|
|
323
|
+
if (t.startsWith("{") && t.endsWith("}")) {
|
|
324
|
+
const e = t.slice(1, -1).trim();
|
|
325
|
+
return e ? $(e) : {};
|
|
326
|
+
}
|
|
327
|
+
return t.includes("(") && t.includes(")") ? q(t) : (t.startsWith("DM."), t);
|
|
328
|
+
}
|
|
329
|
+
function E(t) {
|
|
330
|
+
const i = N(t, ":");
|
|
331
|
+
if (i === -1)
|
|
332
|
+
throw new Error(`Invalid object property: expected 'key: value', got '${t}'`);
|
|
333
|
+
const e = C(t.slice(0, i).trim()), n = H(t.slice(i + 1).trim());
|
|
334
|
+
return [e, n];
|
|
335
|
+
}
|
|
336
|
+
function $(t) {
|
|
337
|
+
if (!t.trim())
|
|
338
|
+
return {};
|
|
339
|
+
const i = T(t, ",").map(E).filter(([, e]) => e !== null);
|
|
340
|
+
return Object.fromEntries(i);
|
|
341
|
+
}
|
|
342
|
+
export {
|
|
343
|
+
g as D,
|
|
344
|
+
Q as a,
|
|
345
|
+
I as b,
|
|
346
|
+
z as c,
|
|
347
|
+
D as d,
|
|
348
|
+
Y as f,
|
|
349
|
+
L as i,
|
|
350
|
+
q as p,
|
|
351
|
+
T as s
|
|
352
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const i=require("./apply-styled-options-to-query-mFJvsssw.cjs");class h extends i.DimensionalElement{constructor(n,t,s,r,o,u,m,d,l,c){if(super(n,o||i.MetadataTypes.Dimension,u,d,l),this.__serializable="DimensionalDimension",this._dimensions=[],this._attributes=[],this._sort=i.Sort.None,!l&&t){const{table:D,column:a}=i.parseExpression(t);this.composeCode=`${i.DATA_MODEL_MODULE_NAME}.${i.wrapIfNeedsNormalization(D)}.${i.wrapIfNeedsNormalization(a)}`}this._sort=m||i.Sort.None,this._expression=t,this.setDimensions(r||[]),this.setAttributes(s),c&&(this.defaultAttribute=c)}static parseType(n){switch(n){case"datetime":case i.MetadataTypes.DateDimension:return i.MetadataTypes.DateDimension;case"text":case i.MetadataTypes.TextDimension:return i.MetadataTypes.TextDimension;case"numeric":case i.MetadataTypes.NumericDimension:return i.MetadataTypes.NumericDimension}return i.MetadataTypes.TextDimension}getAttachedName(n,t){let s=n;const r=i.normalizeName(n);return(r==="id"||r==="name"||Object.getOwnPropertyDescriptor(this,r)!==void 0||this[r]!==void 0)&&(s=t),s}setDimensions(n){this._dimensions=n;for(let t=0;t<n.length;t++){const s=this.getAttachedName(n[t].name,n[t].attributes[0].expression);this[i.normalizeName(s)]=n[t],s!=n[t].name&&(n[t].name=s)}}setAttributes(n){this._attributes=n||[];for(let t=0;t<n.length;t++){const s=this.getAttachedName(n[t].name,n[t].expression);this[i.normalizeName(s)]=n[t],n[t].name!=s&&(n[t].name=s)}}get id(){return this._expression}get attributes(){return this._attributes}get dimensions(){return this._dimensions}get expression(){return this._expression}getSort(){return this._sort}sort(n){return new h(this.name,this.expression,this.attributes,this.dimensions,this.type,this.description,n,this.dataSource,this.composeCode,this.defaultAttribute)}serialize(){const n=super.serialize();return n.expression=this.expression,this.getSort()!==void 0&&(n.sort=this.getSort()),n.attributes=this._attributes.map(t=>t.serialize()),n.dimensions=this._dimensions.map(t=>t.serialize()),this.defaultAttribute&&(n.defaultAttribute=this.defaultAttribute.serialize()),n}jaql(n){if(this.defaultAttribute)return this.defaultAttribute.jaql(n);if(this.dimensions.length>0)return this.dimensions[0].jaql(n);const t={jaql:{title:this.name,dim:this.expression,datatype:i.jaqlSimpleColumnType(this.type)}};return this._sort!=i.Sort.None&&(t.jaql.sort=this._sort==i.Sort.Ascending?"asc":"desc"),n===!0?t.jaql:t}}const L=e=>e&&e.__serializable==="DimensionalDimension";class f extends h{constructor(n,t,s,r,o,u,m,d){super(n,t,[],[],i.MetadataTypes.DateDimension,s,r,o,u),this.__serializable="DimensionalDateDimension";const l=[s,r,o,void 0,void 0,m,d];this.defaultLevel=i.DateLevels.Years,this.Years=new i.DimensionalLevelAttribute(i.DateLevels.Years,t,i.DateLevels.Years,"yyyy",...l),this.Quarters=new i.DimensionalLevelAttribute(i.DateLevels.Quarters,t,i.DateLevels.Quarters,"Q yyyy",...l),this.Months=new i.DimensionalLevelAttribute(i.DateLevels.Months,t,i.DateLevels.Months,"yyyy-MM",...l),this.Weeks=new i.DimensionalLevelAttribute(i.DateLevels.Weeks,t,i.DateLevels.Weeks,"ww yyyy",...l),this.Days=new i.DimensionalLevelAttribute(i.DateLevels.Days,t,i.DateLevels.Days,"yyyy-MM-dd",...l),this.Hours=new i.DimensionalLevelAttribute(i.DateLevels.Hours,t,i.DateLevels.Hours,"yyyy-MM-dd HH:mm",...l),this.MinutesRoundTo30=new i.DimensionalLevelAttribute(i.DateLevels.MinutesRoundTo30,t,i.DateLevels.MinutesRoundTo30,"yyyy-MM-dd HH:mm",s,r,o),this.MinutesRoundTo15=new i.DimensionalLevelAttribute(i.DateLevels.MinutesRoundTo15,t,i.DateLevels.MinutesRoundTo15,"yyyy-MM-dd HH:mm",...l),this.Minutes=new i.DimensionalLevelAttribute(i.DateLevels.Minutes,t,i.DateLevels.Minutes,"yyyy-MM-dd HH:mm",...l),this.Seconds=new i.DimensionalLevelAttribute(i.DateLevels.Seconds,t,i.DateLevels.Seconds,"yyyy-MM-dd HH:mm:ss",s,r,o),this.AggHours=new i.DimensionalLevelAttribute(i.DateLevels.AggHours,t,i.DateLevels.AggHours,"HH:mm",...l),this.AggMinutesRoundTo30=new i.DimensionalLevelAttribute(i.DateLevels.AggMinutesRoundTo30,t,i.DateLevels.AggMinutesRoundTo30,"HH:mm",s,r,o),this.AggMinutesRoundTo15=new i.DimensionalLevelAttribute(i.DateLevels.AggMinutesRoundTo15,t,i.DateLevels.AggMinutesRoundTo15,"HH:mm",...l),this.AggMinutesRoundTo1=new i.DimensionalLevelAttribute(i.DateLevels.AggMinutesRoundTo1,t,i.DateLevels.AggMinutesRoundTo1,"HH:mm",...l),this.setAttributes([this.Years,this.Quarters,this.Months,this.Weeks,this.Days,this.Hours,this.MinutesRoundTo30,this.MinutesRoundTo15,this.Minutes,this.Seconds,this.AggHours,this.AggMinutesRoundTo30,this.AggMinutesRoundTo15,this.AggMinutesRoundTo1])}get id(){return this.expression}setDimensions(){}setAttributes(n){this._attributes=n}getSort(){return this._sort}sort(n){return new f(this.name,this.expression,this.description,n,this.dataSource,this.composeCode,this.indexed,this.merged)}serialize(){return super.serialize()}jaql(n){const t=this[this.defaultLevel].jaql();return t.jaql.title=this.name,n?t.jaql:t}}const T=e=>e&&e.__serializable==="DimensionalDateDimension";function y(e){const n=e.name||e.title,t=e.desc||e.description,s=e.expression||e.dim,r=h.parseType(e.dimtype||e.type),o=e.sort,u=e.dataSource,m=e.indexed,d=e.merged;if(r==i.MetadataTypes.DateDimension)return new f(n,s,t,o,u,void 0,m,d);const l=Object.getOwnPropertyNames(e).map(a=>e[a]).filter(a=>i.MetadataTypes.isAttribute(a==null?void 0:a.type));if(l.length==0)if(e.attributes){let a;for(let p=0;p<e.attributes.length;p++)a=e.attributes[p],l.push(new i.DimensionalAttribute(a.name,a.expression,a.type,a.description,a.sort,a.dataSource,void 0,void 0,a.indexed,a.merged))}else s&&l.push(new i.DimensionalAttribute(n,s,r,t,o,u,void 0,void 0,m,d));const c=Object.getOwnPropertyNames(e).map(a=>e[a]).filter(a=>i.MetadataTypes.isDimension(a==null?void 0:a.type));if(c.length==0&&e.dimensions)for(let a=0;a<e.dimensions.length;a++)c.push(y(e.dimensions[a]));const D=new h(n,s,l,c,r,t,o,u);return e.defaultAttribute&&(D.defaultAttribute=l.find(a=>a.name===e.defaultAttribute)),D}function w(e){const n=e.name||e.title,t=e.expression||e.dim,s=e.desc||e.description,r=e.sort,o=e.dataSource;return new f(n,t,s,r,o,void 0,e.indexed,e.merged)}function g(e,n){const t=[];let s="",r=0,o=!1,u=null;for(let m=0;m<e.length;m++){const d=e[m],l=e[m+1];if(o){if(d!==u){s+=d;continue}if(l===u){s+=d+l,m++;continue}o=!1,u=null,s+=d;continue}else{if(d==="'"||d==='"'){o=!0,u=d,s+=d;continue}if("([{".includes(d)&&r++,")]}".includes(d)&&r--,d===n&&r===0){t.push(s.trim()),s="";continue}}s+=d}return s.trim()&&t.push(s.trim()),t}function _(e,n){let t=0,s=!1,r=null;for(let o=0;o<e.length;o++){const u=e[o],m=e[o+1];if(s){if(u!==r)continue;if(m===r){o++;continue}s=!1,r=null}else{if(u==="'"||u==='"'){s=!0,r=u;continue}if("([{".includes(u)&&t++,")]}".includes(u)&&t--,u===n&&t===0)return o}}return-1}function v(e,n){if(e[n]!=="(")return-1;let t=1,s=n+1,r=!1,o=null;for(;s<e.length;){const u=e[s],m=e[s+1];if(r){if(u!==o){s++;continue}if(m===o){s+=2;continue}r=!1,o=null,s++}else{if(u==="'"||u==='"'){r=!0,o=u,s++;continue}if("([{".includes(u)&&t++,")]}".includes(u)&&--t===0)return s;s++}}return-1}function H(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function M(e){if(!e||typeof e!="string")throw new Error(`Invalid composeCode: expected non-empty string, got ${typeof e}`);const n=e.trim();if(!n)throw new Error("Invalid composeCode: empty string");const t=n.match(/^([a-zA-Z_$][a-zA-Z0-9_.$]*)\s*\((.*)\)$/);if(!t)throw new Error(`Invalid composeCode format: expected function call, got '${n}'`);const s=t[1],r=t[2],o=A(r);return{function:s,args:o}}function A(e){return e.trim()?g(e,",").map(b):[]}function b(e){if(!e)throw new Error("Cannot parse empty argument value");if(e==="null")return null;if(e==="undefined")return;if(e==="true")return!0;if(e==="false")return!1;if(e.match(/^-?\d+(\.\d+)?$/))return parseFloat(e);if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')){const t=e[0];return e.slice(1,-1).replace(new RegExp(`${t}${t}`,"g"),t)}if(e.startsWith("[")&&e.endsWith("]")){const t=e.slice(1,-1).trim();if(!t)return[];const s=A(t);return s.every(r=>typeof r=="string"),s}if(e.startsWith("{")&&e.endsWith("}")){const t=e.slice(1,-1).trim();return t?x(t):{}}return e.includes("(")&&e.includes(")")?M(e):(e.startsWith("DM."),e)}function R(e){const n=_(e,":");if(n===-1)throw new Error(`Invalid object property: expected 'key: value', got '${e}'`);const t=H(e.slice(0,n).trim()),s=b(e.slice(n+1).trim());return[t,s]}function x(e){if(!e.trim())return{};const n=g(e,",").map(R).filter(([,t])=>t!==null);return Object.fromEntries(n)}exports.DimensionalDateDimension=f;exports.DimensionalDimension=h;exports.createDateDimension=w;exports.createDimension=y;exports.findMatchingCloseParen=v;exports.isDimensionalDateDimension=T;exports.isDimensionalDimension=L;exports.parseComposeCodeToFunctionCall=M;exports.splitAtDepthZero=g;
|