@sisense/sdk-ui 1.29.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 +1047 -1005
- package/dist/analytics-composer.cjs +20 -20
- package/dist/analytics-composer.js +180 -182
- package/dist/{derive-chart-family-Cy3hlluo.js → derive-chart-family-B2J2kMs6.js} +1767 -1743
- package/dist/{derive-chart-family-DWCXp57c.cjs → derive-chart-family-Bmg9hQGc.cjs} +21 -21
- package/dist/index.cjs +83 -85
- package/dist/index.js +6867 -6673
- 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 +2 -2
- 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 +3 -2
- 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-last-nlq-response.d.ts +4 -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 +5 -1
- package/dist/packages/sdk-ui/src/chart-options-processor/advanced-chart-options.d.ts +3 -4
- package/dist/packages/sdk-ui/src/common/components/radio.d.ts +1 -1
- package/dist/packages/sdk-ui/src/common/hooks/use-debounced-value.d.ts +5 -0
- package/dist/packages/sdk-ui/src/const.d.ts +2 -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/select/base.d.ts +3 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/multi-select-item.d.ts +2 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/searchable-multi-select.d.ts +2 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/searchable-single-select.d.ts +2 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/single-select-item.d.ts +2 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/select/single-select.d.ts +2 -0
- package/dist/packages/sdk-ui/src/filters/components/filter-editor-popover/common/selectable-section.d.ts +2 -3
- package/dist/packages/sdk-ui/src/filters/components/icons/pencil-icon.d.ts +3 -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/hooks/use-pivot-builder.d.ts +7 -0
- package/dist/packages/sdk-ui/src/translation/resources/en.d.ts +4 -0
- package/dist/packages/sdk-ui/src/translation/resources/index.d.ts +8 -0
- package/dist/packages/sdk-ui/src/types.d.ts +10 -0
- package/dist/packages/sdk-ui/src/widget-by-id/types.d.ts +1 -0
- package/dist/{useQuery-CdtycPOg.js → useQuery-1ixYW8qO.js} +15539 -15521
- package/dist/{useQuery-CRu7WcYd.cjs → useQuery-Ctzmd-JM.cjs} +154 -154
- package/dist/{widget-composer-DyY3yi_b.cjs → widget-composer-CdxKUwZf.cjs} +13 -5
- package/dist/{widget-composer-G4mPX-JO.js → widget-composer-Ch2kYMok.js} +66 -58
- package/package.json +7 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var B=Object.defineProperty;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>
|
|
@@ -295,6 +303,6 @@ const { data, isLoading, isError, error } = useExecuteQuery(queryProps);
|
|
|
295
303
|
`,r+=" ".repeat(t),r+=` {
|
|
296
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}, '${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
|
|
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=`
|
|
299
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?`
|
|
300
|
-
`+" ".repeat(t+2):""}]`,r},
|
|
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,15 +1,15 @@
|
|
|
1
|
-
var
|
|
1
|
+
var K = Object.defineProperty;
|
|
2
2
|
var w = Object.getOwnPropertySymbols;
|
|
3
|
-
var
|
|
4
|
-
var C = (e, t, r) => t in e ?
|
|
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 {
|
|
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
13
|
class Q extends q {
|
|
14
14
|
constructor(t, r) {
|
|
15
15
|
var a;
|
|
@@ -36,16 +36,16 @@ const je = {
|
|
|
36
36
|
widgetProps: void 0,
|
|
37
37
|
queryTitle: "",
|
|
38
38
|
chartRecommendations: {}
|
|
39
|
-
},
|
|
39
|
+
}, ke = {
|
|
40
40
|
model: "",
|
|
41
41
|
metadata: [],
|
|
42
42
|
chart: {},
|
|
43
43
|
queryTitle: ""
|
|
44
|
-
},
|
|
44
|
+
}, Ae = (e) => "widgetProps" in e, re = (e) => "dashboardOid" in e && "widgetOid" in e;
|
|
45
45
|
function ae(e) {
|
|
46
46
|
return e.replace(/\s+/g, "-").replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function Fe(e) {
|
|
49
49
|
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
50
50
|
}
|
|
51
51
|
function Ne(e) {
|
|
@@ -66,14 +66,14 @@ function Be(e) {
|
|
|
66
66
|
function ie(e) {
|
|
67
67
|
return !e || !e.jaql.datasource.title || !e.jaql.metadata.length;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function k(e) {
|
|
70
70
|
if (![...J, "pivot", "pivot2"].includes(e))
|
|
71
71
|
throw new u("errors.chartTypeNotSupported", { chartType: e });
|
|
72
72
|
}
|
|
73
73
|
function se(e) {
|
|
74
74
|
return "widgetType" in e && e.widgetType === "pivot";
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function A(e) {
|
|
77
77
|
const t = "measures" in e && m(e.measures) || "values" in e && m(e.values);
|
|
78
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
|
}
|
|
@@ -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
|
-
},
|
|
424
|
+
}, F = (e, t) => ne[t][e].replace(
|
|
417
425
|
/{{(.*?)Tmpl}}/g,
|
|
418
|
-
(a, s) =>
|
|
419
|
-
), le = (e, t) => e.replace(/{{(.*?)}}/g, (r, a) => a in t ? t[a] : (console.warn(`Placeholder ${a} not found in data`), r)),
|
|
420
|
-
const a =
|
|
426
|
+
(a, s) => F(`${s}Tmpl`, t)
|
|
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") => {
|
|
428
|
+
const a = F(e, r);
|
|
421
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
|
);
|
|
@@ -442,7 +450,7 @@ const { data, isLoading, isError, error } = useExecuteQuery(queryProps);
|
|
|
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: '${P(o)}'}`), n ? `${" ".repeat(t)}${n}` :
|
|
453
|
+
)}(${n}, '${S(l)}')`), o && (n = `{column: ${n}, sortType: '${P(o)}'}`), n ? `${" ".repeat(t)}${n}` : b;
|
|
446
454
|
}, ce = (e, t) => {
|
|
447
455
|
const r = e.jaql().jaql;
|
|
448
456
|
return "formula" in r ? de(r, t) : h + ue(r, t);
|
|
@@ -473,12 +481,12 @@ function B(e, t = !0) {
|
|
|
473
481
|
const r = [];
|
|
474
482
|
return t && r.push("measureFactory"), m(e) && r.push("filterFactory"), r.length > 0 ? `import { ${r.join(", ")} } from '@sisense/sdk-data';` : "";
|
|
475
483
|
}
|
|
476
|
-
const
|
|
484
|
+
const W = `
|
|
477
485
|
`, pe = (e, t) => {
|
|
478
486
|
if (e.composeCode)
|
|
479
|
-
return `${
|
|
487
|
+
return `${W}${" ".repeat(t)}${e.composeCode}`;
|
|
480
488
|
const r = e.jaql().jaql;
|
|
481
|
-
return `${
|
|
489
|
+
return `${W}${" ".repeat(t)}filterFactory.customFilter(${p(
|
|
482
490
|
r,
|
|
483
491
|
t,
|
|
484
492
|
!0
|
|
@@ -496,7 +504,7 @@ const I = `
|
|
|
496
504
|
return ge(e, 2);
|
|
497
505
|
throw new u("errors.filterRelationsNotSupported");
|
|
498
506
|
}, ye = ["executeQueryByWidgetIdTmpl", "widgetByIdTmpl"], he = "chartWidgetTmpl", Se = "pivotTableWidgetTmpl", Te = (e) => e, ve = (e, t, r) => {
|
|
499
|
-
const a =
|
|
507
|
+
const a = A(e), s = {
|
|
500
508
|
titleString: e.title,
|
|
501
509
|
dataSourceString: N(e.dataSource),
|
|
502
510
|
chartTypeString: Te(e.chartType),
|
|
@@ -505,16 +513,16 @@ const I = `
|
|
|
505
513
|
componentString: "ChartWidget",
|
|
506
514
|
extraImportsString: B(e.filters || [], a)
|
|
507
515
|
};
|
|
508
|
-
return
|
|
516
|
+
return E(r, s, t);
|
|
509
517
|
}, Oe = (e, t, r) => {
|
|
510
|
-
const a =
|
|
518
|
+
const a = A(e), s = {
|
|
511
519
|
titleString: e.title,
|
|
512
520
|
dataSourceString: N(e.dataSource),
|
|
513
521
|
dataOptionsString: p(e.dataOptions),
|
|
514
522
|
componentString: "PivotTableWidget",
|
|
515
523
|
extraImportsString: B(e.filters || [], a)
|
|
516
524
|
};
|
|
517
|
-
return
|
|
525
|
+
return E(r, s, t);
|
|
518
526
|
}, xe = ({
|
|
519
527
|
dashboardOid: e,
|
|
520
528
|
widgetOid: t,
|
|
@@ -522,19 +530,19 @@ const I = `
|
|
|
522
530
|
chartType: a = "table",
|
|
523
531
|
includeChart: s = !0
|
|
524
532
|
}) => {
|
|
525
|
-
|
|
533
|
+
k(a);
|
|
526
534
|
const i = { dashboardOid: e, widgetOid: t }, o = ye[Number(s)];
|
|
527
|
-
return
|
|
528
|
-
},
|
|
535
|
+
return E(o, i, r);
|
|
536
|
+
}, be = ({
|
|
529
537
|
widgetProps: e,
|
|
530
538
|
uiFramework: t = "react"
|
|
531
539
|
}) => {
|
|
540
|
+
if (Z(e))
|
|
541
|
+
return k(e.chartType), ve(e, t, he);
|
|
532
542
|
if (H(e))
|
|
533
|
-
return A(e.chartType), ve(e, t, he);
|
|
534
|
-
if (G(e))
|
|
535
543
|
return Oe(e, t, Se);
|
|
536
544
|
throw new u("errors.otherWidgetTypesNotSupported");
|
|
537
|
-
},
|
|
545
|
+
}, Ee = (e) => ({
|
|
538
546
|
dataOptions: { columns: e.map(j) }
|
|
539
547
|
}), we = Object.freeze({
|
|
540
548
|
convolution: {
|
|
@@ -555,7 +563,7 @@ const I = `
|
|
|
555
563
|
xAxis: {
|
|
556
564
|
gridLines: !1
|
|
557
565
|
}
|
|
558
|
-
}),
|
|
566
|
+
}), $ = Object.freeze({
|
|
559
567
|
line: "line/spline",
|
|
560
568
|
pie: "pie/donut",
|
|
561
569
|
bar: "bar/stacked",
|
|
@@ -574,7 +582,7 @@ const I = `
|
|
|
574
582
|
column: c,
|
|
575
583
|
sortType: "sortNone"
|
|
576
584
|
};
|
|
577
|
-
if (
|
|
585
|
+
if (G(c.type)) {
|
|
578
586
|
const O = (v = (T = d.format) == null ? void 0 : T.mask) == null ? void 0 : v[d.jaql.level];
|
|
579
587
|
if (O)
|
|
580
588
|
return {
|
|
@@ -606,22 +614,22 @@ const I = `
|
|
|
606
614
|
o !== "geo" && (i[`${o}`] = i[`${o}`][0]);
|
|
607
615
|
}), i;
|
|
608
616
|
case "table":
|
|
609
|
-
return Object.keys(i).length === 0 ?
|
|
617
|
+
return Object.keys(i).length === 0 ? Ee(e).dataOptions : i;
|
|
610
618
|
case "boxplot":
|
|
611
619
|
case "areamap":
|
|
612
620
|
case "indicator":
|
|
613
621
|
default:
|
|
614
622
|
return i;
|
|
615
623
|
}
|
|
616
|
-
},
|
|
624
|
+
}, I = (e, t) => {
|
|
617
625
|
var r, a, s, i;
|
|
618
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(", ");
|
|
619
|
-
},
|
|
627
|
+
}, Me = (e, t, r = !0) => {
|
|
620
628
|
const a = Ce(e, t);
|
|
621
629
|
let s;
|
|
622
|
-
return r && t.chartType in
|
|
623
|
-
|
|
624
|
-
subtype:
|
|
630
|
+
return r && t.chartType in $ ? s = M(
|
|
631
|
+
M(we, {
|
|
632
|
+
subtype: $[t.chartType]
|
|
625
633
|
}),
|
|
626
634
|
{
|
|
627
635
|
legend: {
|
|
@@ -631,13 +639,13 @@ const I = `
|
|
|
631
639
|
yAxis: {
|
|
632
640
|
title: {
|
|
633
641
|
enabled: !0,
|
|
634
|
-
text:
|
|
642
|
+
text: I(t, "y")
|
|
635
643
|
}
|
|
636
644
|
},
|
|
637
645
|
xAxis: {
|
|
638
646
|
title: {
|
|
639
647
|
enabled: !0,
|
|
640
|
-
text:
|
|
648
|
+
text: I(t, "x")
|
|
641
649
|
}
|
|
642
650
|
}
|
|
643
651
|
}
|
|
@@ -645,36 +653,36 @@ const I = `
|
|
|
645
653
|
dataOptions: a,
|
|
646
654
|
chartStyleOptions: s
|
|
647
655
|
};
|
|
648
|
-
},
|
|
656
|
+
}, De = (e) => "chartType" in e ? e : {
|
|
649
657
|
chartType: "table",
|
|
650
658
|
chartFamily: "table",
|
|
651
659
|
axesMapping: {}
|
|
652
|
-
},
|
|
660
|
+
}, We = (e) => e.map((t) => ee(t.jaql)), $e = (e) => e.reduce(
|
|
653
661
|
(t, r) => {
|
|
654
|
-
if ((r.panel === "scope" || r.jaql.filter) && t.metadataFilters.push(
|
|
655
|
-
const a =
|
|
662
|
+
if ((r.panel === "scope" || r.jaql.filter) && t.metadataFilters.push(D(r)), r.panel !== "scope") {
|
|
663
|
+
const a = D(r);
|
|
656
664
|
delete a.jaql.filter, t.metadataColumns.push(a);
|
|
657
665
|
}
|
|
658
666
|
return t;
|
|
659
667
|
},
|
|
660
668
|
{ metadataColumns: [], metadataFilters: [] }
|
|
661
|
-
),
|
|
669
|
+
), Ie = (e, t) => {
|
|
662
670
|
if (!ie(e))
|
|
663
671
|
try {
|
|
664
672
|
const { useCustomizedStyleOptions: r = !1 } = t || {}, { jaql: a, chartRecommendations: s, queryTitle: i } = e, {
|
|
665
673
|
metadata: o,
|
|
666
674
|
datasource: { title: l, id: n, type: g = "elasticube" }
|
|
667
|
-
} = a, f =
|
|
675
|
+
} = a, f = De(s), d = f.chartType.toLowerCase(), c = {
|
|
668
676
|
cornerRadius: "Small",
|
|
669
677
|
header: {
|
|
670
678
|
// remove info button and render empty toolbar instead
|
|
671
679
|
renderToolbar: () => null
|
|
672
680
|
}
|
|
673
|
-
}, { metadataColumns: T, metadataFilters: v } =
|
|
681
|
+
}, { metadataColumns: T, metadataFilters: v } = $e(o), O = We(v), { dataOptions: _, chartStyleOptions: R } = Me(
|
|
674
682
|
T,
|
|
675
683
|
f,
|
|
676
684
|
r
|
|
677
|
-
),
|
|
685
|
+
), U = y(y({}, R), c);
|
|
678
686
|
return {
|
|
679
687
|
widgetType: "chart",
|
|
680
688
|
id: i,
|
|
@@ -687,28 +695,28 @@ const I = `
|
|
|
687
695
|
},
|
|
688
696
|
dataOptions: _,
|
|
689
697
|
filters: O,
|
|
690
|
-
styleOptions:
|
|
698
|
+
styleOptions: U
|
|
691
699
|
};
|
|
692
700
|
} catch (r) {
|
|
693
701
|
console.error(r);
|
|
694
702
|
return;
|
|
695
703
|
}
|
|
696
|
-
}, qe = (e, t) =>
|
|
704
|
+
}, qe = (e, t) => Ie(e, t), Pe = (e) => re(e) ? xe(e) : be(e), _e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
697
705
|
__proto__: null,
|
|
698
706
|
toWidgetCode: Pe,
|
|
699
707
|
toWidgetProps: qe
|
|
700
708
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
701
709
|
export {
|
|
702
|
-
|
|
710
|
+
ke as E,
|
|
703
711
|
N as a,
|
|
704
712
|
p as b,
|
|
705
|
-
|
|
713
|
+
Fe as c,
|
|
706
714
|
fe as d,
|
|
707
715
|
B as e,
|
|
708
|
-
|
|
709
|
-
|
|
716
|
+
A as f,
|
|
717
|
+
E as g,
|
|
710
718
|
je as h,
|
|
711
|
-
|
|
719
|
+
Ae as i,
|
|
712
720
|
re as j,
|
|
713
721
|
le as p,
|
|
714
722
|
Ne as s,
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"Sisense",
|
|
12
12
|
"Compose SDK"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.30.0",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
"@emotion/styled": "^11.10.5",
|
|
54
54
|
"@mui/material": "^5.16.7",
|
|
55
55
|
"@mui/system": "^5.16.7",
|
|
56
|
-
"@sisense/sdk-common": "^1.
|
|
57
|
-
"@sisense/sdk-data": "^1.
|
|
58
|
-
"@sisense/sdk-pivot-client": "^1.
|
|
59
|
-
"@sisense/sdk-query-client": "^1.
|
|
60
|
-
"@sisense/sdk-rest-client": "^1.
|
|
61
|
-
"@sisense/sdk-tracking": "^1.
|
|
56
|
+
"@sisense/sdk-common": "^1.30.0",
|
|
57
|
+
"@sisense/sdk-data": "^1.30.0",
|
|
58
|
+
"@sisense/sdk-pivot-client": "^1.30.0",
|
|
59
|
+
"@sisense/sdk-query-client": "^1.30.0",
|
|
60
|
+
"@sisense/sdk-rest-client": "^1.30.0",
|
|
61
|
+
"@sisense/sdk-tracking": "^1.30.0",
|
|
62
62
|
"@sisense/sisense-charts": "5.1.1",
|
|
63
63
|
"@tanstack/react-query": "4.36.1",
|
|
64
64
|
"classnames": "^2.3.2",
|