@sisense/sdk-ui 1.28.0 → 1.30.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 +51 -51
- package/dist/ai.js +1177 -1122
- package/dist/analytics-composer.cjs +20 -20
- package/dist/analytics-composer.js +180 -182
- package/dist/{derive-chart-family-BYdyoe8O.js → derive-chart-family-B2J2kMs6.js} +15299 -15416
- package/dist/{derive-chart-family-BNu7PP-p.cjs → derive-chart-family-Bmg9hQGc.cjs} +102 -102
- package/dist/index.cjs +252 -121
- package/dist/index.js +12548 -10364
- package/dist/packages/sdk-ui/src/ai/ai-context-provider.d.ts +2 -1
- package/dist/packages/sdk-ui/src/ai/api/chat-api-provider.d.ts +2 -1
- package/dist/packages/sdk-ui/src/ai/api/chat-rest-api.d.ts +5 -3
- package/dist/packages/sdk-ui/src/ai/api/hooks.d.ts +4 -3
- package/dist/packages/sdk-ui/src/ai/api/types.d.ts +6 -1
- package/dist/packages/sdk-ui/src/ai/chart/nlq-chart-widget.d.ts +10 -1
- package/dist/packages/sdk-ui/src/ai/chat-box.d.ts +3 -1
- package/dist/packages/sdk-ui/src/ai/chat-config.d.ts +7 -1
- package/dist/packages/sdk-ui/src/ai/chat-id-storage-provider.d.ts +12 -0
- package/dist/packages/sdk-ui/src/ai/use-chat-session.d.ts +4 -3
- package/dist/packages/sdk-ui/src/ai/use-get-chat.d.ts +6 -0
- package/dist/packages/sdk-ui/src/ai/use-get-nlg-insights.d.ts +2 -0
- package/dist/packages/sdk-ui/src/ai/use-get-query-recommendations.d.ts +3 -2
- package/dist/packages/sdk-ui/src/ai/use-last-nlq-response.d.ts +4 -2
- package/dist/packages/sdk-ui/src/analytics-composer/common/utils.d.ts +0 -1
- package/dist/packages/sdk-ui/src/area-chart.d.ts +1 -1
- package/dist/packages/sdk-ui/src/areamap-chart.d.ts +1 -1
- package/dist/packages/sdk-ui/src/boxplot-utils.d.ts +3 -2
- package/dist/packages/sdk-ui/src/chart-data-options/coloring/range-coloring.d.ts +12 -0
- package/dist/packages/sdk-ui/src/chart-data-options/types.d.ts +6 -2
- package/dist/packages/sdk-ui/src/chart-options-processor/advanced-chart-options.d.ts +3 -4
- package/dist/packages/sdk-ui/src/chart-options-processor/subtype-to-design-options.d.ts +1 -1
- package/dist/packages/sdk-ui/src/chart-options-processor/translations/axis-section.d.ts +5 -2
- package/dist/packages/sdk-ui/src/chart-options-processor/translations/design-options.d.ts +1 -0
- package/dist/packages/sdk-ui/src/chart-options-processor/translations/value-label-section.d.ts +3 -1
- package/dist/packages/sdk-ui/src/common/components/button.d.ts +10 -0
- package/dist/packages/sdk-ui/src/common/components/popover.d.ts +23 -0
- package/dist/packages/sdk-ui/src/common/components/radio.d.ts +8 -0
- package/dist/packages/sdk-ui/src/common/hooks/use-combined-menu.d.ts +3 -4
- package/dist/packages/sdk-ui/src/common/hooks/use-debounced-value.d.ts +5 -0
- package/dist/packages/sdk-ui/src/const.d.ts +3 -0
- package/dist/packages/sdk-ui/src/dashboard/components/dashboard-container.d.ts +1 -1
- package/dist/packages/sdk-ui/src/dashboard/types.d.ts +6 -0
- package/dist/packages/sdk-ui/src/filters/components/criteria-filter-tile/criteria-filter-operations.d.ts +4 -4
- package/dist/packages/sdk-ui/src/filters/components/criteria-filter-tile/criteria-filter-tile.d.ts +4 -5
- package/dist/packages/sdk-ui/src/filters/components/criteria-filter-tile/index.d.ts +2 -1
- package/dist/packages/sdk-ui/src/filters/components/criteria-filter-tile/types.d.ts +7 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/index.d.ts +4 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/input.d.ts +5 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/search-input.d.ts +8 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/base.d.ts +17 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/index.d.ts +3 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/multi-select-item.d.ts +9 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/searchable-multi-select.d.ts +14 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/searchable-single-select.d.ts +14 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/single-select-item.d.ts +9 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/single-select.d.ts +14 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/types.d.ts +7 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/utils.d.ts +4 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/selectable-section.d.ts +10 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/filter-editor-popover.d.ts +12 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/filter-editor.d.ts +8 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/multi-select-control.d.ts +7 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/sections/include-all-section.d.ts +9 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/sections/members-section.d.ts +11 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/sections/text-condition-section.d.ts +11 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/utils.d.ts +5 -0
- package/dist/packages/sdk-ui/src/filters/components/filters-panel/filters-panel.d.ts +2 -0
- package/dist/packages/sdk-ui/src/filters/components/icons/arrow-down-icon.d.ts +1 -1
- package/dist/packages/sdk-ui/src/filters/components/icons/check-icon.d.ts +2 -0
- package/dist/packages/sdk-ui/src/filters/components/icons/index.d.ts +1 -0
- package/dist/packages/sdk-ui/src/filters/components/icons/pencil-icon.d.ts +3 -1
- package/dist/packages/sdk-ui/src/filters/components/icons/search-icon.d.ts +1 -1
- package/dist/packages/sdk-ui/src/filters/components/member-filter-tile/member-filter-tile.d.ts +1 -1
- package/dist/packages/sdk-ui/src/filters/helpers.d.ts +1 -122
- package/dist/packages/sdk-ui/src/filters/index.d.ts +0 -1
- package/dist/packages/sdk-ui/src/pivot-table/formatters/data-cell-formatters/data-cell-color-formatter.d.ts +4 -0
- package/dist/packages/sdk-ui/src/pivot-table/formatters/header-cell-formatters/header-cell-totals-formatter.d.ts +4 -0
- package/dist/packages/sdk-ui/src/pivot-table/hooks/use-pivot-builder.d.ts +7 -0
- package/dist/packages/sdk-ui/src/props.d.ts +15 -15
- package/dist/packages/sdk-ui/src/translation/resources/en.d.ts +33 -0
- package/dist/packages/sdk-ui/src/translation/resources/index.d.ts +66 -0
- package/dist/packages/sdk-ui/src/types.d.ts +37 -2
- package/dist/packages/sdk-ui/src/utils/filter-relations.d.ts +30 -72
- package/dist/packages/sdk-ui/src/widget-by-id/dashboard-widget.d.ts +1 -1
- package/dist/packages/sdk-ui/src/widget-by-id/translate-widget-data-options.d.ts +1 -2
- package/dist/packages/sdk-ui/src/widget-by-id/types.d.ts +15 -0
- package/dist/packages/sdk-ui/src/widget-by-id/utils.d.ts +2 -57
- package/dist/{useQuery-CwqhrvKr.js → useQuery-1ixYW8qO.js} +27765 -27713
- package/dist/useQuery-Ctzmd-JM.cjs +916 -0
- package/dist/{widget-composer-BvJFwTM1.cjs → widget-composer-CdxKUwZf.cjs} +18 -10
- package/dist/{widget-composer-CAmaQCTo.js → widget-composer-Ch2kYMok.js} +115 -105
- package/package.json +7 -7
- package/dist/useQuery-7UcSPq8U.cjs +0 -915
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var B=Object.defineProperty;var w=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var D=(e,t,r)=>t in e?B(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,y=(e,t)=>{for(var r in t||(t={}))R.call(t,r)&&D(e,r,t[r]);if(w)for(var r of w(t))U.call(t,r)&&D(e,r,t[r]);return e};const o=require("./derive-chart-family-Bmg9hQGc.cjs");class W extends o.DimensionalElement{constructor(t,r){var a;super((a=t.jaql.title)!==null&&a!==void 0?a:"",r),this.expression=t.jaql.dim||t.jaql.formula,this.metadataItem=t,t.jaql.agg?this.aggregation=t.jaql.agg:delete this.aggregation,t.jaql.formula?this.formula=t.jaql.formula:delete this.formula,t.jaql.sort?this.sortType=o.getSortType(t.jaql.sort):delete this.sortType,this.skipValidation=!0}get id(){return this.expression}jaql(){return this.metadataItem}}const Y={text:o.MetadataTypes.TextAttribute,numeric:o.MetadataTypes.NumericAttribute,datetime:o.MetadataTypes.DateLevel};function Q(e){var t;return new W(e,(t=Y[e.jaql.datatype])!==null&&t!==void 0?t:"numeric")}const z={jaql:{datasource:{title:""},metadata:[]},widgetProps:void 0,queryTitle:"",chartRecommendations:{}},K={model:"",metadata:[],chart:{},queryTitle:""},J=e=>"widgetProps"in e,L=e=>"dashboardOid"in e&&"widgetOid"in e;function V(e){return e.replace(/\s+/g,"-").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function X(e){return e.charAt(0).toUpperCase()+e.slice(1)}function H(e){const t=/\[(.+?)\s\(Calendar\)\]/;return e.replace(t,"[$1]").trim()}function Z(e){if(e)if(e.metadata){if(!e.model)throw new o.TranslatableError("errors.missingModelTitle")}else throw new o.TranslatableError("errors.missingMetadata");else throw new o.TranslatableError("errors.emptyModel");return e}function G(e){return!e||!e.jaql.datasource.title||!e.jaql.metadata.length}function $(e){if(![...o.ALL_CHART_TYPES,"pivot","pivot2"].includes(e))throw new o.TranslatableError("errors.chartTypeNotSupported",{chartType:e})}function ee(e){return"widgetType"in e&&e.widgetType==="pivot"}function x(e){const t="measures"in e&&p(e.measures)||"values"in e&&p(e.values);return ee(e)?"values"in e.dataOptions&&p(e.dataOptions.values):"chartType"in e?e.chartType==="scatter"?"x"in e.dataOptions&&"y"in e.dataOptions&&(e.dataOptions.x!==void 0||e.dataOptions.y!==void 0):e.chartType==="scattermap"?"geo"in e.dataOptions&&p(e.dataOptions.geo):"value"in e.dataOptions&&p(e.dataOptions.value):t}function p(e){return Array.isArray(e)&&e.length>0}function te(e){const t=e.split(`
|
|
2
2
|
`);for(let r=0;r<t.length-1;r++)if(t[r].trim()===""){const a=t[r+1].trim();if(a.startsWith("import *")||a.startsWith("import {")){t.splice(r,1);break}}return t.join(`
|
|
3
3
|
`)}const re={react:{baseChartTmpl:`import { {{componentString}} } from '@sisense/sdk-ui';
|
|
4
4
|
{{extraImportsString}}
|
|
@@ -99,7 +99,7 @@ const CodeExample = () => {
|
|
|
99
99
|
return <div>Error: {error.message}</div>;
|
|
100
100
|
}
|
|
101
101
|
if (data) {
|
|
102
|
-
return <div>Total Rows: {data.rows.length}</div>;
|
|
102
|
+
return <div>Total Rows: {data.table.rows.length}</div>;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
return null;
|
|
@@ -119,11 +119,13 @@ export default function CodeExample() {
|
|
|
119
119
|
/>
|
|
120
120
|
);
|
|
121
121
|
}`},angular:{baseChartTmpl:`import { Component } from '@angular/core';
|
|
122
|
+
import { SdkUiModule, type ChartDataOptions } from '@sisense/sdk-ui-angular';
|
|
122
123
|
{{extraImportsString}}
|
|
123
124
|
import * as DM from './{{dataSourceString}}'; // generated with @sisense/sdk-cli
|
|
124
125
|
|
|
125
126
|
@Component({
|
|
126
127
|
selector: 'code-example',
|
|
128
|
+
imports: [SdkUiModule],
|
|
127
129
|
template: \`
|
|
128
130
|
<csdk-chart-widget
|
|
129
131
|
chartType='{{chartTypeString}}'
|
|
@@ -135,12 +137,14 @@ import * as DM from './{{dataSourceString}}'; // generated with @sisense/sdk-cli
|
|
|
135
137
|
})
|
|
136
138
|
export class CodeExample {
|
|
137
139
|
DM = DM;
|
|
138
|
-
dataOptions = {{dataOptionsString}};
|
|
140
|
+
dataOptions: ChartDataOptions = {{dataOptionsString}};
|
|
139
141
|
filters = {{filtersString}};
|
|
140
142
|
}`,chartTmpl:"{{baseChartTmpl}}",chartWidgetTmpl:"{{baseChartTmpl}}",widgetByIdTmpl:`import { Component } from '@angular/core';
|
|
143
|
+
import { SdkUiModule } from '@sisense/sdk-ui-angular';
|
|
141
144
|
|
|
142
145
|
@Component({
|
|
143
146
|
selector: 'code-example',
|
|
147
|
+
imports: [SdkUiModule],
|
|
144
148
|
template: \`
|
|
145
149
|
<csdk-widget-by-id
|
|
146
150
|
[widgetOid]="widgetOid"
|
|
@@ -155,11 +159,13 @@ export class CodeExample {
|
|
|
155
159
|
dashboardOid = "{{dashboardOid}}";
|
|
156
160
|
includeDashboardFilters = true;
|
|
157
161
|
}`,executeQueryByWidgetIdTmpl:`import { Component } from '@angular/core';
|
|
162
|
+
import { CommonModule } from '@angular/common';
|
|
158
163
|
import { QueryService } from '@sisense/sdk-ui-angular';
|
|
159
164
|
import { type QueryResultData } from '@sisense/sdk-data';
|
|
160
165
|
|
|
161
166
|
@Component({
|
|
162
167
|
selector: 'code-example',
|
|
168
|
+
imports: [CommonModule],
|
|
163
169
|
template: \`<div>
|
|
164
170
|
<div *ngIf="errorMessage">Error: {{ errorMessage }}</div>
|
|
165
171
|
<div *ngIf="!errorMessage">Total Rows: {{ queryResult.rows.length }}</div>
|
|
@@ -188,6 +194,7 @@ export class CodeExample {
|
|
|
188
194
|
}
|
|
189
195
|
}
|
|
190
196
|
`,executeQueryTmpl:`import { Component } from '@angular/core';
|
|
197
|
+
import { CommonModule } from '@angular/common';
|
|
191
198
|
{{extraImportsString}}
|
|
192
199
|
import { type QueryResultData } from '@sisense/sdk-data';
|
|
193
200
|
import * as DM from './{{dataSourceString}}'; // generated with @sisense/sdk-cli
|
|
@@ -195,6 +202,7 @@ import { QueryService } from '@sisense/sdk-ui-angular';
|
|
|
195
202
|
|
|
196
203
|
@Component({
|
|
197
204
|
selector: 'code-example',
|
|
205
|
+
imports: [CommonModule],
|
|
198
206
|
template: \`<div>
|
|
199
207
|
<div *ngIf="errorMessage">Error: {{ errorMessage }}</div>
|
|
200
208
|
<div *ngIf="!errorMessage">Total Rows: {{ queryResult.rows.length }}</div>
|
|
@@ -288,13 +296,13 @@ const { data, isLoading, isError, error } = useExecuteQuery(queryProps);
|
|
|
288
296
|
<div v-else-if="isError">Error: {{error.message}}</div>
|
|
289
297
|
<div v-else-if="data">Total Rows: {{data.rows.length}}</div>
|
|
290
298
|
</div>
|
|
291
|
-
</template>`,executePivotQueryTmpl:"Not implemented yet",pivotTableWidgetTmpl:"Not implemented yet"}},
|
|
292
|
-
`,
|
|
293
|
-
`,r+=" ".repeat(t),r+=` '${
|
|
299
|
+
</template>`,executePivotQueryTmpl:"Not implemented yet",pivotTableWidgetTmpl:"Not implemented yet"}},q=(e,t)=>re[t][e].replace(/{{(.*?)Tmpl}}/g,(a,s)=>q(`${s}Tmpl`,t)),j=(e,t)=>e.replace(/{{(.*?)}}/g,(r,a)=>a in t?t[a]:(console.warn(`Placeholder ${a} not found in data`),r)),E=(e,t,r="react")=>{const a=q(e,r);return te(j(a,t))},h=`
|
|
300
|
+
`,O="UNKNOWN",ae=(e,t)=>{let r="";return r+=`measureFactory.customFormula(
|
|
301
|
+
`,r+=" ".repeat(t),r+=` '${o.escapeSingleQuotes(e.title)}',
|
|
294
302
|
`,r+=" ".repeat(t),r+=` '${e.formula}',
|
|
295
303
|
`,r+=" ".repeat(t),r+=` {
|
|
296
|
-
`,Object.entries(e.context).forEach(([a,s])=>{const i=o.normalizeAttributeName(s.table||
|
|
304
|
+
`,Object.entries(e.context).forEach(([a,s])=>{const i=o.normalizeAttributeName(s.table||O,s.column||O,void 0,"DM");r+=" ".repeat(t),r+=` '${a.slice(1,-1)}': ${i},
|
|
297
305
|
`}),r+=" ".repeat(t),r+=` }
|
|
298
|
-
`,r+=" ".repeat(t),r+=")",r},ie=(e,t)=>{const{level:r,table:a,column:s,agg:i,sort:n,title:d}=e;let l;return a&&s&&(l=o.normalizeAttributeName(a,s,r,"DM")),i&&a&&s&&d&&(l=`measureFactory.${o.DimensionalBaseMeasure.aggregationFromJAQL(i)}(${l}, '${
|
|
299
|
-
`,ne=(e,t)=>{if(e.composeCode)return`${
|
|
300
|
-
`+" ".repeat(t+2):""}]`,r},
|
|
306
|
+
`,r+=" ".repeat(t),r+=")",r},ie=(e,t)=>{const{level:r,table:a,column:s,agg:i,sort:n,title:d}=e;let l;return a&&s&&(l=o.normalizeAttributeName(a,s,r,"DM")),i&&a&&s&&d&&(l=`measureFactory.${o.DimensionalBaseMeasure.aggregationFromJAQL(i)}(${l}, '${o.escapeSingleQuotes(d)}')`),n&&(l=`{column: ${l}, sortType: '${o.getSortType(n)}'}`),l?`${" ".repeat(t)}${l}`:O},se=(e,t)=>{const r=e.jaql().jaql;return"formula"in r?ae(r,t):h+ie(r,t)},c=(e,t=0,r=!1)=>{if(!e)return"";if(typeof e=="string")return`'${o.escapeSingleQuotes(e)}'`;if(e instanceof W)return se(e,t);if(e instanceof o.DimensionalElement)return e.composeCode||"";let a="";return Array.isArray(e)?a+=`[${e.map(s=>c(s,t+2))}${e.length?h+" ".repeat(t+2):""}]`:(a+=`{${h}`,Object.entries(e).forEach(([s,i])=>{r&&(s=`'${o.escapeSingleQuotes(s)}'`),a+=" ".repeat(t+2),Array.isArray(i)?a+=`${s}: [${i.map(n=>c(n,t+4,r))}${i.length?h+" ".repeat(t+2):""}]`:typeof i=="object"?a+=`${s}: ${c(i,t+2,r)}`:["number","boolean","undefined",null].includes(typeof i)?a+=`${s}: ${i}`:a+=`${s}: '${o.escapeSingleQuotes(i)}'`,a+=`,${h}`}),a+=" ".repeat(t),a+="}"),a};function oe(e){return c(e,2)}function b(e){if(!e)throw new o.TranslatableError("errors.undefinedDataSource");let t;return typeof e=="object"&&"title"in e?t=e.title:t=e,V(t)}function C(e,t=!0){const r=[];return t&&r.push("measureFactory"),p(e)&&r.push("filterFactory"),r.length>0?`import { ${r.join(", ")} } from '@sisense/sdk-data';`:""}const M=`
|
|
307
|
+
`,ne=(e,t)=>{if(e.composeCode)return`${M}${" ".repeat(t)}${e.composeCode}`;const r=e.jaql().jaql;return`${M}${" ".repeat(t)}filterFactory.customFilter(${c(r,t,!0)})`},le=(e,t=0)=>{if(!e)return"";let r="";return r+=`[${e.map(a=>ne(a,t+2))}${e.length?`
|
|
308
|
+
`+" ".repeat(t+2):""}]`,r},k=e=>{if(!e)return"";if(Array.isArray(e))return le(e,2);throw new o.TranslatableError("errors.filterRelationsNotSupported")},de=["executeQueryByWidgetIdTmpl","widgetByIdTmpl"],ue="chartWidgetTmpl",ce="pivotTableWidgetTmpl",me=e=>e,pe=(e,t,r)=>{const a=x(e),s={titleString:e.title,dataSourceString:b(e.dataSource),chartTypeString:me(e.chartType),dataOptionsString:oe(e.dataOptions),filtersString:k(e.filters),componentString:"ChartWidget",extraImportsString:C(e.filters||[],a)};return E(r,s,t)},ge=(e,t,r)=>{const a=x(e),s={titleString:e.title,dataSourceString:b(e.dataSource),dataOptionsString:c(e.dataOptions),componentString:"PivotTableWidget",extraImportsString:C(e.filters||[],a)};return E(r,s,t)},fe=({dashboardOid:e,widgetOid:t,uiFramework:r="react",chartType:a="table",includeChart:s=!0})=>{$(a);const i={dashboardOid:e,widgetOid:t},n=de[Number(s)];return E(n,i,r)},ye=({widgetProps:e,uiFramework:t="react"})=>{if(o.isChartWidgetProps(e))return $(e.chartType),pe(e,t,ue);if(o.isPivotTableWidgetProps(e))return ge(e,t,ce);throw new o.TranslatableError("errors.otherWidgetTypesNotSupported")},he=e=>({dataOptions:{columns:e.map(Q)}}),Se=Object.freeze({convolution:{enabled:!0,selectedConvolutionType:"bySlicesCount",independentSlicesCount:7},lineWidth:{width:"bold"},markers:{enabled:!1},legend:{enabled:!1},yAxis:{gridLines:!1},xAxis:{gridLines:!1}}),P=Object.freeze({line:"line/spline",pie:"pie/donut",bar:"bar/stacked",column:"column/stackedcolumn"}),Te=(e,t)=>{const{axesMapping:r={},chartFamily:a}=t,s=e.reduce((n,d)=>(n[d.jaql.title]=d,n),{}),i=Object.entries(r).reduce((n,d)=>{const[l,g]=d;return n[`${l}`]=Array.isArray(g)?g.map(f=>{var S,T;const u=s[f.name];if(!u)return{column:{type:"",name:f.name}};const m=Q(u);if(u.panel==="measures")return{column:m,sortType:"sortNone"};if(o.isDatetime(m.type)){const v=(T=(S=u.format)==null?void 0:S.mask)==null?void 0:T[u.jaql.level];if(v)return{column:m,dateFormat:v}}return m}):g,n},{});switch(a){case"cartesian":return y({category:[],value:[],breakBy:[]},i);case"categorical":return y({category:[],value:[]},i);case"scatter":return Object.keys(i).forEach(n=>{i[`${n}`]=i[`${n}`][0]}),i;case"scattermap":return Object.keys(i).forEach(n=>{n!=="geo"&&(i[`${n}`]=i[`${n}`][0])}),i;case"table":return Object.keys(i).length===0?he(e).dataOptions:i;case"boxplot":case"areamap":case"indicator":default:return i}},I=(e,t)=>{var r,a,s,i;return t==="x"?(a=(r=e.axesMapping.category)!=null?r:e.axesMapping.x)==null?void 0:a.map(n=>n.name).join(", "):(i=(s=e.axesMapping.value)!=null?s:e.axesMapping.y)==null?void 0:i.map(n=>n.name).join(", ")},ve=(e,t,r=!0)=>{const a=Te(e,t);let s;return r&&t.chartType in P?s=o.merge(o.merge(Se,{subtype:P[t.chartType]}),{legend:{enabled:!0,position:"right"},yAxis:{title:{enabled:!0,text:I(t,"y")}},xAxis:{title:{enabled:!0,text:I(t,"x")}}}):s=o.getDefaultStyleOptions(),{dataOptions:a,chartStyleOptions:s}},Ee=e=>"chartType"in e?e:{chartType:"table",chartFamily:"table",axesMapping:{}},Oe=e=>e.map(t=>o.createFilterFromJaql(t.jaql)),xe=e=>e.reduce((t,r)=>{if((r.panel==="scope"||r.jaql.filter)&&t.metadataFilters.push(o.cloneDeep(r)),r.panel!=="scope"){const a=o.cloneDeep(r);delete a.jaql.filter,t.metadataColumns.push(a)}return t},{metadataColumns:[],metadataFilters:[]}),be=(e,t)=>{if(!G(e))try{const{useCustomizedStyleOptions:r=!1}=t||{},{jaql:a,chartRecommendations:s,queryTitle:i}=e,{metadata:n,datasource:{title:d,id:l,type:g="elasticube"}}=a,f=Ee(s),u=f.chartType.toLowerCase(),m={cornerRadius:"Small",header:{renderToolbar:()=>null}},{metadataColumns:S,metadataFilters:T}=xe(n),v=Oe(T),{dataOptions:F,chartStyleOptions:_}=ve(S,f,r),N=y(y({},_),m);return{widgetType:"chart",id:i,title:i,chartType:u,dataSource:{title:d,id:l,type:g},dataOptions:F,filters:v,styleOptions:N}}catch(r){console.error(r);return}},A=(e,t)=>be(e,t),Ce=e=>L(e)?fe(e):ye(e),we=Object.freeze(Object.defineProperty({__proto__:null,toWidgetCode:Ce,toWidgetProps:A},Symbol.toStringTag,{value:"Module"}));exports.EMPTY_EXPANDED_QUERY_MODEL=z;exports.EMPTY_SIMPLE_QUERY_MODEL=K;exports.capitalizeFirstLetter=X;exports.checkIfMeasuresExist=x;exports.generateCode=E;exports.isByIdWidgetCodeParams=L;exports.isClientSideWidgetCodeParams=J;exports.populatePlaceholders=j;exports.sanitizeDimensionId=H;exports.stringifyDataSource=b;exports.stringifyExtraImports=C;exports.stringifyFilters=k;exports.stringifyProps=c;exports.toWidgetProps=A;exports.validateQueryModel=Z;exports.widgetComposer=we;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
var K = Object.defineProperty;
|
|
2
2
|
var w = Object.getOwnPropertySymbols;
|
|
3
|
-
var
|
|
4
|
-
var C = (e, t, r) => t in e ? K(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r,
|
|
3
|
+
var Y = Object.prototype.hasOwnProperty, z = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var C = (e, t, r) => t in e ? K(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, y = (e, t) => {
|
|
5
5
|
for (var r in t || (t = {}))
|
|
6
|
-
|
|
6
|
+
Y.call(t, r) && C(e, r, t[r]);
|
|
7
7
|
if (w)
|
|
8
8
|
for (var r of w(t))
|
|
9
|
-
|
|
9
|
+
z.call(t, r) && C(e, r, t[r]);
|
|
10
10
|
return e;
|
|
11
11
|
};
|
|
12
|
-
import {
|
|
13
|
-
class
|
|
12
|
+
import { cK as q, h as P, M as x, T as u, cL as J, cM as S, cN as L, ae as V, Z, ag as H, m as M, cO as X, P as G, B as ee, aW as D } from "./derive-chart-family-B2J2kMs6.js";
|
|
13
|
+
class Q extends q {
|
|
14
14
|
constructor(t, r) {
|
|
15
15
|
var a;
|
|
16
|
-
super((a = t.jaql.title) !== null && a !== void 0 ? a : "", r), this.expression = t.jaql.dim || t.jaql.formula, this.metadataItem = t, t.jaql.agg ? this.aggregation = t.jaql.agg : delete this.aggregation, t.jaql.formula ? this.formula = t.jaql.formula : delete this.formula, t.jaql.sort ? this.sortType =
|
|
16
|
+
super((a = t.jaql.title) !== null && a !== void 0 ? a : "", r), this.expression = t.jaql.dim || t.jaql.formula, this.metadataItem = t, t.jaql.agg ? this.aggregation = t.jaql.agg : delete this.aggregation, t.jaql.formula ? this.formula = t.jaql.formula : delete this.formula, t.jaql.sort ? this.sortType = P(t.jaql.sort) : delete this.sortType, this.skipValidation = !0;
|
|
17
17
|
}
|
|
18
18
|
get id() {
|
|
19
19
|
return this.expression;
|
|
@@ -27,16 +27,16 @@ const te = {
|
|
|
27
27
|
numeric: x.NumericAttribute,
|
|
28
28
|
datetime: x.DateLevel
|
|
29
29
|
};
|
|
30
|
-
function
|
|
30
|
+
function j(e) {
|
|
31
31
|
var t;
|
|
32
|
-
return new
|
|
32
|
+
return new Q(e, (t = te[e.jaql.datatype]) !== null && t !== void 0 ? t : "numeric");
|
|
33
33
|
}
|
|
34
|
-
const
|
|
34
|
+
const je = {
|
|
35
35
|
jaql: { datasource: { title: "" }, metadata: [] },
|
|
36
36
|
widgetProps: void 0,
|
|
37
37
|
queryTitle: "",
|
|
38
38
|
chartRecommendations: {}
|
|
39
|
-
},
|
|
39
|
+
}, ke = {
|
|
40
40
|
model: "",
|
|
41
41
|
metadata: [],
|
|
42
42
|
chart: {},
|
|
@@ -48,7 +48,7 @@ function ae(e) {
|
|
|
48
48
|
function Fe(e) {
|
|
49
49
|
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function Ne(e) {
|
|
52
52
|
const t = /\[(.+?)\s\(Calendar\)\]/;
|
|
53
53
|
return e.replace(t, "[$1]").trim();
|
|
54
54
|
}
|
|
@@ -66,21 +66,21 @@ function Be(e) {
|
|
|
66
66
|
function ie(e) {
|
|
67
67
|
return !e || !e.jaql.datasource.title || !e.jaql.metadata.length;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
return e && e.replace(new RegExp("(?<!\\\\)'", "g"), "\\'");
|
|
71
|
-
}
|
|
72
|
-
function j(e) {
|
|
69
|
+
function k(e) {
|
|
73
70
|
if (![...J, "pivot", "pivot2"].includes(e))
|
|
74
71
|
throw new u("errors.chartTypeNotSupported", { chartType: e });
|
|
75
72
|
}
|
|
73
|
+
function se(e) {
|
|
74
|
+
return "widgetType" in e && e.widgetType === "pivot";
|
|
75
|
+
}
|
|
76
76
|
function A(e) {
|
|
77
|
-
const t = "measures" in e &&
|
|
78
|
-
return "chartType" in e ? e.chartType === "scatter" ? "x" in e.dataOptions && "y" in e.dataOptions && (e.dataOptions.x !== void 0 || e.dataOptions.y !== void 0) : e.chartType === "scattermap" ? "geo" in e.dataOptions &&
|
|
77
|
+
const t = "measures" in e && m(e.measures) || "values" in e && m(e.values);
|
|
78
|
+
return se(e) ? "values" in e.dataOptions && m(e.dataOptions.values) : "chartType" in e ? e.chartType === "scatter" ? "x" in e.dataOptions && "y" in e.dataOptions && (e.dataOptions.x !== void 0 || e.dataOptions.y !== void 0) : e.chartType === "scattermap" ? "geo" in e.dataOptions && m(e.dataOptions.geo) : "value" in e.dataOptions && m(e.dataOptions.value) : t;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function m(e) {
|
|
81
81
|
return Array.isArray(e) && e.length > 0;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function oe(e) {
|
|
84
84
|
const t = e.split(`
|
|
85
85
|
`);
|
|
86
86
|
for (let r = 0; r < t.length - 1; r++)
|
|
@@ -94,7 +94,7 @@ function se(e) {
|
|
|
94
94
|
return t.join(`
|
|
95
95
|
`);
|
|
96
96
|
}
|
|
97
|
-
const
|
|
97
|
+
const ne = {
|
|
98
98
|
react: {
|
|
99
99
|
baseChartTmpl: `import { {{componentString}} } from '@sisense/sdk-ui';
|
|
100
100
|
{{extraImportsString}}
|
|
@@ -201,7 +201,7 @@ const CodeExample = () => {
|
|
|
201
201
|
return <div>Error: {error.message}</div>;
|
|
202
202
|
}
|
|
203
203
|
if (data) {
|
|
204
|
-
return <div>Total Rows: {data.rows.length}</div>;
|
|
204
|
+
return <div>Total Rows: {data.table.rows.length}</div>;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
return null;
|
|
@@ -225,11 +225,13 @@ export default function CodeExample() {
|
|
|
225
225
|
},
|
|
226
226
|
angular: {
|
|
227
227
|
baseChartTmpl: `import { Component } from '@angular/core';
|
|
228
|
+
import { SdkUiModule, type ChartDataOptions } from '@sisense/sdk-ui-angular';
|
|
228
229
|
{{extraImportsString}}
|
|
229
230
|
import * as DM from './{{dataSourceString}}'; // generated with @sisense/sdk-cli
|
|
230
231
|
|
|
231
232
|
@Component({
|
|
232
233
|
selector: 'code-example',
|
|
234
|
+
imports: [SdkUiModule],
|
|
233
235
|
template: \`
|
|
234
236
|
<csdk-chart-widget
|
|
235
237
|
chartType='{{chartTypeString}}'
|
|
@@ -241,15 +243,17 @@ import * as DM from './{{dataSourceString}}'; // generated with @sisense/sdk-cli
|
|
|
241
243
|
})
|
|
242
244
|
export class CodeExample {
|
|
243
245
|
DM = DM;
|
|
244
|
-
dataOptions = {{dataOptionsString}};
|
|
246
|
+
dataOptions: ChartDataOptions = {{dataOptionsString}};
|
|
245
247
|
filters = {{filtersString}};
|
|
246
248
|
}`,
|
|
247
249
|
chartTmpl: "{{baseChartTmpl}}",
|
|
248
250
|
chartWidgetTmpl: "{{baseChartTmpl}}",
|
|
249
251
|
widgetByIdTmpl: `import { Component } from '@angular/core';
|
|
252
|
+
import { SdkUiModule } from '@sisense/sdk-ui-angular';
|
|
250
253
|
|
|
251
254
|
@Component({
|
|
252
255
|
selector: 'code-example',
|
|
256
|
+
imports: [SdkUiModule],
|
|
253
257
|
template: \`
|
|
254
258
|
<csdk-widget-by-id
|
|
255
259
|
[widgetOid]="widgetOid"
|
|
@@ -265,11 +269,13 @@ export class CodeExample {
|
|
|
265
269
|
includeDashboardFilters = true;
|
|
266
270
|
}`,
|
|
267
271
|
executeQueryByWidgetIdTmpl: `import { Component } from '@angular/core';
|
|
272
|
+
import { CommonModule } from '@angular/common';
|
|
268
273
|
import { QueryService } from '@sisense/sdk-ui-angular';
|
|
269
274
|
import { type QueryResultData } from '@sisense/sdk-data';
|
|
270
275
|
|
|
271
276
|
@Component({
|
|
272
277
|
selector: 'code-example',
|
|
278
|
+
imports: [CommonModule],
|
|
273
279
|
template: \`<div>
|
|
274
280
|
<div *ngIf="errorMessage">Error: {{ errorMessage }}</div>
|
|
275
281
|
<div *ngIf="!errorMessage">Total Rows: {{ queryResult.rows.length }}</div>
|
|
@@ -299,6 +305,7 @@ export class CodeExample {
|
|
|
299
305
|
}
|
|
300
306
|
`,
|
|
301
307
|
executeQueryTmpl: `import { Component } from '@angular/core';
|
|
308
|
+
import { CommonModule } from '@angular/common';
|
|
302
309
|
{{extraImportsString}}
|
|
303
310
|
import { type QueryResultData } from '@sisense/sdk-data';
|
|
304
311
|
import * as DM from './{{dataSourceString}}'; // generated with @sisense/sdk-cli
|
|
@@ -306,6 +313,7 @@ import { QueryService } from '@sisense/sdk-ui-angular';
|
|
|
306
313
|
|
|
307
314
|
@Component({
|
|
308
315
|
selector: 'code-example',
|
|
316
|
+
imports: [CommonModule],
|
|
309
317
|
template: \`<div>
|
|
310
318
|
<div *ngIf="errorMessage">Error: {{ errorMessage }}</div>
|
|
311
319
|
<div *ngIf="!errorMessage">Total Rows: {{ queryResult.rows.length }}</div>
|
|
@@ -413,14 +421,14 @@ const { data, isLoading, isError, error } = useExecuteQuery(queryProps);
|
|
|
413
421
|
executePivotQueryTmpl: "Not implemented yet",
|
|
414
422
|
pivotTableWidgetTmpl: "Not implemented yet"
|
|
415
423
|
}
|
|
416
|
-
}, F = (e, t) =>
|
|
424
|
+
}, F = (e, t) => ne[t][e].replace(
|
|
417
425
|
/{{(.*?)Tmpl}}/g,
|
|
418
426
|
(a, s) => F(`${s}Tmpl`, t)
|
|
419
|
-
),
|
|
427
|
+
), le = (e, t) => e.replace(/{{(.*?)}}/g, (r, a) => a in t ? t[a] : (console.warn(`Placeholder ${a} not found in data`), r)), E = (e, t, r = "react") => {
|
|
420
428
|
const a = F(e, r);
|
|
421
|
-
return
|
|
429
|
+
return oe(le(a, t));
|
|
422
430
|
}, h = `
|
|
423
|
-
`,
|
|
431
|
+
`, b = "UNKNOWN", de = (e, t) => {
|
|
424
432
|
let r = "";
|
|
425
433
|
return r += `measureFactory.customFormula(
|
|
426
434
|
`, r += " ".repeat(t), r += ` '${S(e.title)}',
|
|
@@ -428,8 +436,8 @@ const { data, isLoading, isError, error } = useExecuteQuery(queryProps);
|
|
|
428
436
|
`, r += " ".repeat(t), r += ` {
|
|
429
437
|
`, Object.entries(e.context).forEach(([a, s]) => {
|
|
430
438
|
const i = L(
|
|
431
|
-
s.table ||
|
|
432
|
-
s.column ||
|
|
439
|
+
s.table || b,
|
|
440
|
+
s.column || b,
|
|
433
441
|
void 0,
|
|
434
442
|
"DM"
|
|
435
443
|
);
|
|
@@ -437,31 +445,33 @@ const { data, isLoading, isError, error } = useExecuteQuery(queryProps);
|
|
|
437
445
|
`;
|
|
438
446
|
}), r += " ".repeat(t), r += ` }
|
|
439
447
|
`, r += " ".repeat(t), r += ")", r;
|
|
440
|
-
},
|
|
448
|
+
}, ue = (e, t) => {
|
|
441
449
|
const { level: r, table: a, column: s, agg: i, sort: o, title: l } = e;
|
|
442
450
|
let n;
|
|
443
451
|
return a && s && (n = L(a, s, r, "DM")), i && a && s && l && (n = `measureFactory.${V.aggregationFromJAQL(
|
|
444
452
|
i
|
|
445
|
-
)}(${n}, '${S(l)}')`), o && (n = `{column: ${n}, sortType: '${
|
|
446
|
-
},
|
|
453
|
+
)}(${n}, '${S(l)}')`), o && (n = `{column: ${n}, sortType: '${P(o)}'}`), n ? `${" ".repeat(t)}${n}` : b;
|
|
454
|
+
}, ce = (e, t) => {
|
|
447
455
|
const r = e.jaql().jaql;
|
|
448
|
-
return "formula" in r ?
|
|
456
|
+
return "formula" in r ? de(r, t) : h + ue(r, t);
|
|
449
457
|
}, p = (e, t = 0, r = !1) => {
|
|
450
458
|
if (!e)
|
|
451
459
|
return "";
|
|
452
460
|
if (typeof e == "string")
|
|
453
461
|
return `'${S(e)}'`;
|
|
454
|
-
if (e instanceof
|
|
455
|
-
return
|
|
462
|
+
if (e instanceof Q)
|
|
463
|
+
return ce(e, t);
|
|
464
|
+
if (e instanceof q)
|
|
465
|
+
return e.composeCode || "";
|
|
456
466
|
let a = "";
|
|
457
467
|
return Array.isArray(e) ? a += `[${e.map((s) => p(s, t + 2))}${e.length ? h + " ".repeat(t + 2) : ""}]` : (a += `{${h}`, Object.entries(e).forEach(([s, i]) => {
|
|
458
468
|
r && (s = `'${S(s)}'`), a += " ".repeat(t + 2), Array.isArray(i) ? a += `${s}: [${i.map((o) => p(o, t + 4, r))}${i.length ? h + " ".repeat(t + 2) : ""}]` : typeof i == "object" ? a += `${s}: ${p(i, t + 2, r)}` : ["number", "boolean", "undefined", null].includes(typeof i) ? a += `${s}: ${i}` : a += `${s}: '${S(i)}'`, a += `,${h}`;
|
|
459
469
|
}), a += " ".repeat(t), a += "}"), a;
|
|
460
470
|
};
|
|
461
|
-
function
|
|
471
|
+
function me(e) {
|
|
462
472
|
return p(e, 2);
|
|
463
473
|
}
|
|
464
|
-
function
|
|
474
|
+
function N(e) {
|
|
465
475
|
if (!e)
|
|
466
476
|
throw new u("errors.undefinedDataSource");
|
|
467
477
|
let t;
|
|
@@ -469,72 +479,72 @@ function k(e) {
|
|
|
469
479
|
}
|
|
470
480
|
function B(e, t = !0) {
|
|
471
481
|
const r = [];
|
|
472
|
-
return t && r.push("measureFactory"),
|
|
482
|
+
return t && r.push("measureFactory"), m(e) && r.push("filterFactory"), r.length > 0 ? `import { ${r.join(", ")} } from '@sisense/sdk-data';` : "";
|
|
473
483
|
}
|
|
474
|
-
const
|
|
484
|
+
const W = `
|
|
475
485
|
`, pe = (e, t) => {
|
|
476
486
|
if (e.composeCode)
|
|
477
|
-
return `${
|
|
487
|
+
return `${W}${" ".repeat(t)}${e.composeCode}`;
|
|
478
488
|
const r = e.jaql().jaql;
|
|
479
|
-
return `${
|
|
489
|
+
return `${W}${" ".repeat(t)}filterFactory.customFilter(${p(
|
|
480
490
|
r,
|
|
481
491
|
t,
|
|
482
492
|
!0
|
|
483
493
|
)})`;
|
|
484
|
-
},
|
|
494
|
+
}, ge = (e, t = 0) => {
|
|
485
495
|
if (!e)
|
|
486
496
|
return "";
|
|
487
497
|
let r = "";
|
|
488
498
|
return r += `[${e.map((a) => pe(a, t + 2))}${e.length ? `
|
|
489
499
|
` + " ".repeat(t + 2) : ""}]`, r;
|
|
490
|
-
},
|
|
500
|
+
}, fe = (e) => {
|
|
491
501
|
if (!e)
|
|
492
502
|
return "";
|
|
493
503
|
if (Array.isArray(e))
|
|
494
|
-
return
|
|
504
|
+
return ge(e, 2);
|
|
495
505
|
throw new u("errors.filterRelationsNotSupported");
|
|
496
|
-
},
|
|
506
|
+
}, ye = ["executeQueryByWidgetIdTmpl", "widgetByIdTmpl"], he = "chartWidgetTmpl", Se = "pivotTableWidgetTmpl", Te = (e) => e, ve = (e, t, r) => {
|
|
497
507
|
const a = A(e), s = {
|
|
498
508
|
titleString: e.title,
|
|
499
|
-
dataSourceString:
|
|
500
|
-
chartTypeString:
|
|
501
|
-
dataOptionsString:
|
|
502
|
-
filtersString:
|
|
509
|
+
dataSourceString: N(e.dataSource),
|
|
510
|
+
chartTypeString: Te(e.chartType),
|
|
511
|
+
dataOptionsString: me(e.dataOptions),
|
|
512
|
+
filtersString: fe(e.filters),
|
|
503
513
|
componentString: "ChartWidget",
|
|
504
514
|
extraImportsString: B(e.filters || [], a)
|
|
505
515
|
};
|
|
506
|
-
return
|
|
507
|
-
},
|
|
516
|
+
return E(r, s, t);
|
|
517
|
+
}, Oe = (e, t, r) => {
|
|
508
518
|
const a = A(e), s = {
|
|
509
519
|
titleString: e.title,
|
|
510
|
-
dataSourceString:
|
|
520
|
+
dataSourceString: N(e.dataSource),
|
|
511
521
|
dataOptionsString: p(e.dataOptions),
|
|
512
522
|
componentString: "PivotTableWidget",
|
|
513
523
|
extraImportsString: B(e.filters || [], a)
|
|
514
524
|
};
|
|
515
|
-
return
|
|
516
|
-
},
|
|
525
|
+
return E(r, s, t);
|
|
526
|
+
}, xe = ({
|
|
517
527
|
dashboardOid: e,
|
|
518
528
|
widgetOid: t,
|
|
519
529
|
uiFramework: r = "react",
|
|
520
530
|
chartType: a = "table",
|
|
521
531
|
includeChart: s = !0
|
|
522
532
|
}) => {
|
|
523
|
-
|
|
524
|
-
const i = { dashboardOid: e, widgetOid: t }, o =
|
|
525
|
-
return
|
|
526
|
-
},
|
|
533
|
+
k(a);
|
|
534
|
+
const i = { dashboardOid: e, widgetOid: t }, o = ye[Number(s)];
|
|
535
|
+
return E(o, i, r);
|
|
536
|
+
}, be = ({
|
|
527
537
|
widgetProps: e,
|
|
528
538
|
uiFramework: t = "react"
|
|
529
539
|
}) => {
|
|
540
|
+
if (Z(e))
|
|
541
|
+
return k(e.chartType), ve(e, t, he);
|
|
530
542
|
if (H(e))
|
|
531
|
-
return
|
|
532
|
-
if (X(e))
|
|
533
|
-
return ve(e, t, he);
|
|
543
|
+
return Oe(e, t, Se);
|
|
534
544
|
throw new u("errors.otherWidgetTypesNotSupported");
|
|
535
545
|
}, Ee = (e) => ({
|
|
536
|
-
dataOptions: { columns: e.map(
|
|
537
|
-
}),
|
|
546
|
+
dataOptions: { columns: e.map(j) }
|
|
547
|
+
}), we = Object.freeze({
|
|
538
548
|
convolution: {
|
|
539
549
|
enabled: !0,
|
|
540
550
|
selectedConvolutionType: "bySlicesCount",
|
|
@@ -553,20 +563,20 @@ const $ = `
|
|
|
553
563
|
xAxis: {
|
|
554
564
|
gridLines: !1
|
|
555
565
|
}
|
|
556
|
-
}),
|
|
566
|
+
}), $ = Object.freeze({
|
|
557
567
|
line: "line/spline",
|
|
558
568
|
pie: "pie/donut",
|
|
559
569
|
bar: "bar/stacked",
|
|
560
570
|
column: "column/stackedcolumn"
|
|
561
|
-
}),
|
|
571
|
+
}), Ce = (e, t) => {
|
|
562
572
|
const { axesMapping: r = {}, chartFamily: a } = t, s = e.reduce((o, l) => (o[l.jaql.title] = l, o), {}), i = Object.entries(r).reduce((o, l) => {
|
|
563
|
-
const [n,
|
|
564
|
-
return o[`${n}`] = Array.isArray(
|
|
573
|
+
const [n, g] = l;
|
|
574
|
+
return o[`${n}`] = Array.isArray(g) ? g.map((f) => {
|
|
565
575
|
var T, v;
|
|
566
|
-
const d = s[
|
|
576
|
+
const d = s[f.name];
|
|
567
577
|
if (!d)
|
|
568
|
-
return { column: { type: "", name:
|
|
569
|
-
const c =
|
|
578
|
+
return { column: { type: "", name: f.name } };
|
|
579
|
+
const c = j(d);
|
|
570
580
|
if (d.panel === "measures")
|
|
571
581
|
return {
|
|
572
582
|
column: c,
|
|
@@ -581,17 +591,17 @@ const $ = `
|
|
|
581
591
|
};
|
|
582
592
|
}
|
|
583
593
|
return c;
|
|
584
|
-
}) :
|
|
594
|
+
}) : g, o;
|
|
585
595
|
}, {});
|
|
586
596
|
switch (a) {
|
|
587
597
|
case "cartesian":
|
|
588
|
-
return
|
|
598
|
+
return y({
|
|
589
599
|
category: [],
|
|
590
600
|
value: [],
|
|
591
601
|
breakBy: []
|
|
592
602
|
}, i);
|
|
593
603
|
case "categorical":
|
|
594
|
-
return
|
|
604
|
+
return y({
|
|
595
605
|
category: [],
|
|
596
606
|
value: []
|
|
597
607
|
}, i);
|
|
@@ -611,15 +621,15 @@ const $ = `
|
|
|
611
621
|
default:
|
|
612
622
|
return i;
|
|
613
623
|
}
|
|
614
|
-
},
|
|
624
|
+
}, I = (e, t) => {
|
|
615
625
|
var r, a, s, i;
|
|
616
626
|
return t === "x" ? (a = (r = e.axesMapping.category) != null ? r : e.axesMapping.x) == null ? void 0 : a.map((o) => o.name).join(", ") : (i = (s = e.axesMapping.value) != null ? s : e.axesMapping.y) == null ? void 0 : i.map((o) => o.name).join(", ");
|
|
617
|
-
},
|
|
618
|
-
const a =
|
|
627
|
+
}, Me = (e, t, r = !0) => {
|
|
628
|
+
const a = Ce(e, t);
|
|
619
629
|
let s;
|
|
620
|
-
return r && t.chartType in
|
|
621
|
-
|
|
622
|
-
subtype:
|
|
630
|
+
return r && t.chartType in $ ? s = M(
|
|
631
|
+
M(we, {
|
|
632
|
+
subtype: $[t.chartType]
|
|
623
633
|
}),
|
|
624
634
|
{
|
|
625
635
|
legend: {
|
|
@@ -629,17 +639,17 @@ const $ = `
|
|
|
629
639
|
yAxis: {
|
|
630
640
|
title: {
|
|
631
641
|
enabled: !0,
|
|
632
|
-
text:
|
|
642
|
+
text: I(t, "y")
|
|
633
643
|
}
|
|
634
644
|
},
|
|
635
645
|
xAxis: {
|
|
636
646
|
title: {
|
|
637
647
|
enabled: !0,
|
|
638
|
-
text:
|
|
648
|
+
text: I(t, "x")
|
|
639
649
|
}
|
|
640
650
|
}
|
|
641
651
|
}
|
|
642
|
-
) : s =
|
|
652
|
+
) : s = X(), {
|
|
643
653
|
dataOptions: a,
|
|
644
654
|
chartStyleOptions: s
|
|
645
655
|
};
|
|
@@ -647,10 +657,10 @@ const $ = `
|
|
|
647
657
|
chartType: "table",
|
|
648
658
|
chartFamily: "table",
|
|
649
659
|
axesMapping: {}
|
|
650
|
-
},
|
|
660
|
+
}, We = (e) => e.map((t) => ee(t.jaql)), $e = (e) => e.reduce(
|
|
651
661
|
(t, r) => {
|
|
652
|
-
if ((r.panel === "scope" || r.jaql.filter) && t.metadataFilters.push(
|
|
653
|
-
const a =
|
|
662
|
+
if ((r.panel === "scope" || r.jaql.filter) && t.metadataFilters.push(D(r)), r.panel !== "scope") {
|
|
663
|
+
const a = D(r);
|
|
654
664
|
delete a.jaql.filter, t.metadataColumns.push(a);
|
|
655
665
|
}
|
|
656
666
|
return t;
|
|
@@ -661,18 +671,18 @@ const $ = `
|
|
|
661
671
|
try {
|
|
662
672
|
const { useCustomizedStyleOptions: r = !1 } = t || {}, { jaql: a, chartRecommendations: s, queryTitle: i } = e, {
|
|
663
673
|
metadata: o,
|
|
664
|
-
datasource: { title: l, id: n, type:
|
|
665
|
-
} = a,
|
|
674
|
+
datasource: { title: l, id: n, type: g = "elasticube" }
|
|
675
|
+
} = a, f = De(s), d = f.chartType.toLowerCase(), c = {
|
|
666
676
|
cornerRadius: "Small",
|
|
667
677
|
header: {
|
|
668
678
|
// remove info button and render empty toolbar instead
|
|
669
679
|
renderToolbar: () => null
|
|
670
680
|
}
|
|
671
|
-
}, { metadataColumns: T, metadataFilters: v } = $e(o), O =
|
|
681
|
+
}, { metadataColumns: T, metadataFilters: v } = $e(o), O = We(v), { dataOptions: _, chartStyleOptions: R } = Me(
|
|
672
682
|
T,
|
|
673
|
-
|
|
683
|
+
f,
|
|
674
684
|
r
|
|
675
|
-
),
|
|
685
|
+
), U = y(y({}, R), c);
|
|
676
686
|
return {
|
|
677
687
|
widgetType: "chart",
|
|
678
688
|
id: i,
|
|
@@ -681,36 +691,36 @@ const $ = `
|
|
|
681
691
|
dataSource: {
|
|
682
692
|
title: l,
|
|
683
693
|
id: n,
|
|
684
|
-
type:
|
|
694
|
+
type: g
|
|
685
695
|
},
|
|
686
|
-
dataOptions:
|
|
696
|
+
dataOptions: _,
|
|
687
697
|
filters: O,
|
|
688
|
-
styleOptions:
|
|
698
|
+
styleOptions: U
|
|
689
699
|
};
|
|
690
700
|
} catch (r) {
|
|
691
701
|
console.error(r);
|
|
692
702
|
return;
|
|
693
703
|
}
|
|
694
|
-
},
|
|
704
|
+
}, qe = (e, t) => Ie(e, t), Pe = (e) => re(e) ? xe(e) : be(e), _e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
695
705
|
__proto__: null,
|
|
696
|
-
toWidgetCode:
|
|
697
|
-
toWidgetProps:
|
|
706
|
+
toWidgetCode: Pe,
|
|
707
|
+
toWidgetProps: qe
|
|
698
708
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
699
709
|
export {
|
|
700
|
-
|
|
701
|
-
|
|
710
|
+
ke as E,
|
|
711
|
+
N as a,
|
|
702
712
|
p as b,
|
|
703
713
|
Fe as c,
|
|
704
|
-
|
|
714
|
+
fe as d,
|
|
705
715
|
B as e,
|
|
706
716
|
A as f,
|
|
707
|
-
|
|
708
|
-
|
|
717
|
+
E as g,
|
|
718
|
+
je as h,
|
|
709
719
|
Ae as i,
|
|
710
720
|
re as j,
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
721
|
+
le as p,
|
|
722
|
+
Ne as s,
|
|
723
|
+
qe as t,
|
|
714
724
|
Be as v,
|
|
715
|
-
|
|
725
|
+
_e as w
|
|
716
726
|
};
|