@sisense/sdk-ui 2.5.0 → 2.6.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 +1 -1
- package/dist/ai.js +4 -4
- package/dist/analytics-composer.cjs +82 -82
- package/dist/analytics-composer.js +1911 -1911
- package/dist/{derive-chart-family-ci86jmVk.js → derive-chart-family-BPYK8evJ.js} +11063 -11000
- package/dist/{derive-chart-family-Cjjn5U5S.cjs → derive-chart-family-yUBZXP4x.cjs} +146 -146
- package/dist/dimensions-BgPl9ZS9.cjs +1 -0
- package/dist/dimensions-DuHaCozA.js +203 -0
- package/dist/index.cjs +14 -14
- package/dist/index.js +5390 -5298
- package/dist/index.umd.js +248 -248
- package/dist/packages/sdk-ui/src/app/client-application.d.ts +2 -2
- package/dist/packages/sdk-ui/src/chart/restructured-charts/highchart-based-charts/highcharts-based-chart-renderer/highcharts-based-chart-renderer.d.ts +4 -0
- package/dist/packages/sdk-ui/src/dashboard/components/jtd-dashboard.d.ts +2 -1
- package/dist/packages/sdk-ui/src/dashboard/hooks/jtd/jtd-filters.d.ts +38 -4
- package/dist/packages/sdk-ui/src/dashboard/types.d.ts +26 -19
- package/dist/packages/sdk-ui/src/dynamic-size-container/dynamic-size-container.d.ts +2 -1
- package/dist/packages/sdk-ui/src/models/dashboard/translate-dashboard-utils.d.ts +1 -0
- package/dist/packages/sdk-ui/src/props.d.ts +10 -0
- package/dist/packages/sdk-ui/src/sisense-chart/sisense-chart.d.ts +1 -1
- package/dist/packages/sdk-ui/src/sisense-chart/types.d.ts +4 -0
- package/dist/packages/sdk-ui/src/widget-by-id/utils.d.ts +26 -0
- package/dist/{use-common-filters-BTk7vuUo.js → use-common-filters-B1RKY2KD.js} +745 -717
- package/dist/{use-common-filters-Bf8KKBN2.cjs → use-common-filters-CRgYdKcV.cjs} +33 -33
- package/dist/{widget-composer-CJDaEkCY.cjs → widget-composer-B2r2a9Oh.cjs} +7 -7
- package/dist/{widget-composer-BtqAxkpr.js → widget-composer-I9gUFBZt.js} +67 -66
- package/package.json +7 -7
- package/dist/dimensions-COtPNdpu.cjs +0 -1
- package/dist/dimensions-wzj4u0MX.js +0 -200
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var tt=Object.defineProperty,et=Object.defineProperties;var rt=Object.getOwnPropertyDescriptors;var $=Object.getOwnPropertySymbols;var it=Object.prototype.hasOwnProperty,at=Object.prototype.propertyIsEnumerable;var j=(t,e,r)=>e in t?tt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,l=(t,e)=>{for(var r in e||(e={}))it.call(e,r)&&j(t,r,e[r]);if($)for(var r of $(e))at.call(e,r)&&j(t,r,e[r]);return t},m=(t,e)=>et(t,rt(e));const n=require("./derive-chart-family-
|
|
1
|
+
"use strict";var tt=Object.defineProperty,et=Object.defineProperties;var rt=Object.getOwnPropertyDescriptors;var $=Object.getOwnPropertySymbols;var it=Object.prototype.hasOwnProperty,at=Object.prototype.propertyIsEnumerable;var j=(t,e,r)=>e in t?tt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,l=(t,e)=>{for(var r in e||(e={}))it.call(e,r)&&j(t,r,e[r]);if($)for(var r of $(e))at.call(e,r)&&j(t,r,e[r]);return t},m=(t,e)=>et(t,rt(e));const n=require("./derive-chart-family-yUBZXP4x.cjs");class P extends n.DimensionalElement{constructor(e,r){var i;super((i=e.jaql.title)!==null&&i!==void 0?i:"",r),this.__serializable="JaqlElement",this.expression=e.jaql.dim||e.jaql.formula,this.metadataItem=e,e.jaql.agg?this.aggregation=e.jaql.agg:delete this.aggregation,e.jaql.formula?this.formula=e.jaql.formula:delete this.formula,e.jaql.sort?this.sortType=n.getSortType(e.jaql.sort):delete this.sortType,this.skipValidation=!0}get id(){return this.expression}jaql(e){return e===!0?this.metadataItem.jaql:this.metadataItem}serialize(){const e=super.serialize();return e.metadataItem=this.metadataItem,e.type=this.type,e}}const st={text:n.MetadataTypes.TextAttribute,numeric:n.MetadataTypes.NumericAttribute,datetime:n.MetadataTypes.DateLevel},nt=t=>t&&t.__serializable==="JaqlElement";function ot(t){var e;return new P(t,(e=st[t.jaql.datatype])!==null&&e!==void 0?e:"numeric")}function _(t){const{jaql:e}=t;if(e.formula)return n.createCalculatedMeasureHelper(e);const r=n.DimensionalLevelAttribute.translateJaqlToGranularity(e);return"agg"in e&&e.dim&&e.datatype?n.createMeasureHelper({expression:e.dim,dataType:e.datatype,agg:e.agg||"",granularity:r,format:void 0,sort:e.sort,title:e.title,dataSource:e.datasource}):e.dim&&e.datatype?n.createAttributeHelper({expression:e.dim,dataType:e.datatype,granularity:r,sort:e.sort,title:e.title,panel:t.panel,dataSource:e.datasource}):ot(t)}const lt={jaql:{datasource:{title:"",type:"elasticube"},metadata:[]},queryTitle:"",chartRecommendations:{}},dt={model:"",metadata:[],chart:{},queryTitle:""},ct=t=>"widgetProps"in t,B=t=>"dashboardOid"in t&&"widgetOid"in t,ut=t=>"dashboardProps"in t,pt=t=>"dashboardOid"in t;function mt(t){return t.replace(/\s+/g,"-").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function gt(t){return t.charAt(0).toUpperCase()+t.slice(1)}function yt(t){const e=/\[(.+?)\s\(Calendar\)\]/;return t.replace(e,"[$1]").trim()}function ft(t){if(t)if(t.metadata){if(!t.model)throw new n.TranslatableError("errors.missingModelTitle")}else throw new n.TranslatableError("errors.missingMetadata");else throw new n.TranslatableError("errors.emptyModel");return t}function ht(t){return!t||!t.jaql.datasource.title||!t.jaql.metadata.length}function R(t){if(![...n.ALL_CHART_TYPES,"pivot","pivot2"].includes(t))throw new n.TranslatableError("errors.chartTypeNotSupported",{chartType:t})}function St(t){return"widgetType"in t&&t.widgetType==="pivot"}function S(t){var e;return"column"in t&&((e=t.column)==null?void 0:e.expression)&&/\(.*\)/.test(t.column.expression)}function w(t){const e="measures"in t&&u(t.measures)||"values"in t&&u(t.values);return St(t)?"values"in t.dataOptions&&u(t.dataOptions.values):"chartType"in t?t.chartType==="indicator"?"value"in t.dataOptions&&u(t.dataOptions.value)||"secondary"in t.dataOptions&&u(t.dataOptions.secondary):t.chartType==="table"?!("columns"in t.dataOptions)||!u(t.dataOptions.columns)?!1:t.dataOptions.columns.some(i=>S(i)):t.chartType==="boxplot"?!1:t.chartType==="scatter"?"x"in t.dataOptions&&t.dataOptions.x!==void 0&&S(t.dataOptions.x)||"y"in t.dataOptions&&t.dataOptions.y!==void 0&&S(t.dataOptions.y)||"size"in t.dataOptions&&t.dataOptions.size!==void 0:t.chartType==="scattermap"?"colorBy"in t.dataOptions&&t.dataOptions.colorBy!==void 0&&S(t.dataOptions.colorBy)||"details"in t.dataOptions&&t.dataOptions.details!==void 0&&S(t.dataOptions.details)||"size"in t.dataOptions&&t.dataOptions.size!==void 0&&S(t.dataOptions.size):t.chartType==="areamap"?"geo"in t.dataOptions&&u(t.dataOptions.geo)&&"color"in t.dataOptions&&u(t.dataOptions.color):"value"in t.dataOptions&&u(t.dataOptions.value):e}function u(t){return Array.isArray(t)&&t.length>0}function Ot(t){const e=t.split(`
|
|
2
2
|
`);for(let r=0;r<e.length-1;r++)if(e[r].trim()===""){const i=e[r+1].trim();if(i.startsWith("import *")||i.startsWith("import {")){e.splice(r,1);break}}return e.join(`
|
|
3
|
-
`)}function
|
|
3
|
+
`)}function Tt(t){const e=i=>/^[$A-Z_][0-9A-Z_$]*$/i.test(i);if("composeCode"in t)return t;const r={};for(const[i,a]of Object.entries(t)){const s=e(i)?i:`"${i}"`;r[s]=a}return r}const bt={react:{baseChartTmpl:`import { {{componentString}} } from '@sisense/sdk-ui';
|
|
4
4
|
{{extraImportsString}}
|
|
5
5
|
import * as DM from './{{dataSourceString}}'; // generated with @sisense/sdk-cli
|
|
6
6
|
|
|
@@ -416,13 +416,13 @@ import { DashboardById } from '@sisense/sdk-ui-vue';
|
|
|
416
416
|
<\/script>
|
|
417
417
|
<template>
|
|
418
418
|
<DashboardById :dashboardOid="'{{dashboardOid}}'" />
|
|
419
|
-
</template>`,dashboardTmpl:"/** COMING SOON */"}},k=(t,e)=>
|
|
420
|
-
`,M="UNKNOWN",
|
|
419
|
+
</template>`,dashboardTmpl:"/** COMING SOON */"}},k=(t,e)=>bt[e][t].replace(/{{(.*?)Tmpl}}/g,(i,a)=>k(`${a}Tmpl`,e)),F=(t,e)=>t.replace(/{{(.*?)}}/g,(r,i)=>i in e?e[i]:(console.warn(`Placeholder ${i} not found in data`),r)),C=(t,e,r="react")=>{const i=k(t,r);return Ot(F(i,e))},vt=()=>Object.values(n.AggregationTypes).map(e=>n.DimensionalBaseMeasure.aggregationToJAQL(e)).join("|"),N=t=>{const{formula:e,context:r,filter:i}=t;if(!r||!e)return t;const a=Object.keys(r);if(a.length!==1)return t;const s=a[0];if(typeof s!="string")return t;const o=r[`${s}`],g=vt(),d=new RegExp(`^\\s*(${g})\\(\\[\\w+\\]\\)$`),f=e.match(d);if(f&&e.includes(s)){const c=f[1];return l({dim:o.dim,table:o.table,column:o.column,datatype:o.datatype,agg:c,title:t.title},i?{filter:l({},i)}:{})}return t},D=t=>{let e=t;if("formula"in t&&(e=N(t)),"context"in e){const r=l({},e.context);Object.keys(r).forEach(i=>{r[`${i}`]=D(r[`${i}`])}),e.context=r}return e},Et=t=>{var i;const e=t;if(e.panel!=="scope")return e;const{jaql:r}=e;return(i=r.filter)!=null&&i.by&&(r.filter.by=N(r.filter.by)),m(l({},e),{jaql:r})},z=t=>{let e=t;e=Et(e);const{jaql:r,measure:i,by:a}=e;return l(l(m(l({},e),{jaql:D(r)}),a?{by:D(a)}:{}),i?{measure:D(i)}:{})},O=6,x=`
|
|
420
|
+
`,M="UNKNOWN",xt=(t,e)=>{let r="";return r+=`measureFactory.customFormula(
|
|
421
421
|
`,r+=" ".repeat(e),r+=` '${n.escapeSingleQuotes(t.title)}',
|
|
422
422
|
`,r+=" ".repeat(e),r+=` '${t.formula}',
|
|
423
423
|
`,r+=" ".repeat(e),r+=` {
|
|
424
424
|
`,Object.entries(t.context).forEach(([i,a])=>{const s=n.normalizeAttributeName(a.table||M,a.column||M,void 0,"DM");r+=" ".repeat(e),r+=` '${i.slice(1,-1)}': ${s},
|
|
425
425
|
`}),r+=" ".repeat(e),r+=` }
|
|
426
|
-
`,r+=" ".repeat(e),r+=")",r},
|
|
427
|
-
`,
|
|
428
|
-
`+" ".repeat(e+2):""}]`,r},W=t=>t?Array.isArray(t)?
|
|
426
|
+
`,r+=" ".repeat(e),r+=")",r},Dt=t=>{const{level:e,table:r,column:i,agg:a,title:s}=t;let o;return r&&i&&(o=n.normalizeAttributeName(r,i,e,"DM")),a&&r&&i&&s&&(o=`measureFactory.${n.DimensionalBaseMeasure.aggregationFromJAQL(a)}(${o}, '${n.escapeSingleQuotes(s)}')`),o||M},Ct=(t,e)=>{const r=t.jaql(!1).jaql;return"formula"in r?xt(r,e):Dt(r)},p=(t,e=0,r=!1)=>{if(!t)return"";if(typeof t=="string")return`'${n.escapeSingleQuotes(t)}'`;if(t instanceof P)return Ct(t,e);if(t instanceof n.DimensionalElement)return t.composeCode||"";let i="";return Array.isArray(t)?i+=`[${t.map(a=>p(a,e+2))}${t.length?x+" ".repeat(e+2):""}]`:(i+=`{${x}`,Object.entries(t).forEach(([a,s])=>{if(r&&typeof a=="string"&&(a=`'${n.escapeSingleQuotes(a)}'`),i+=" ".repeat(e+2),Array.isArray(s))i+=`${a}: [${s.map(o=>p(o,e+4,r))}${s.length?x+" ".repeat(e+2):""}]`;else if(typeof s=="object"&&s!==null){const o=Array.isArray(s)?s:Tt(s);i+=`${a}: ${p(o,e+2,r)}`}else["number","boolean","undefined"].includes(typeof s)||s===null?i+=`${a}: ${s}`:typeof s=="string"?i+=`${a}: '${n.escapeSingleQuotes(s)}'`:i+=`${a}: ${s}`;i+=`,${x}`}),i+=" ".repeat(e),i+="}"),i};function wt(t){return p(t,O)}function I(t,e="data-source-placeholder"){if(!t)return e;const r=typeof t=="object"&&"title"in t?t.title:t;return mt(r)}function q(t,e=!0){const r=[];return e&&r.push("measureFactory"),u(t)&&r.push("filterFactory"),r.length>0?`import { ${r.join(", ")} } from '@sisense/sdk-data';`:""}const L=`
|
|
427
|
+
`,Mt=(t,e)=>{if(t.composeCode)return`${L}${" ".repeat(e)}${t.composeCode}`;const r=t.jaql().jaql;return`${L}${" ".repeat(e)}filterFactory.customFilter(${p(r,e,!0)})`},It=(t,e=0)=>{if(!t)return"";let r="";return r+=`[${t.map(i=>Mt(i,e+2))}${t.length?`
|
|
428
|
+
`+" ".repeat(e+2):""}]`,r},W=t=>t?Array.isArray(t)?It(t,6):"/** Filter relations not supported yet */":"[]",qt=["executeQueryByWidgetIdTmpl","widgetByIdTmpl"],Wt="chartWidgetTmpl",Pt="pivotTableWidgetTmpl",$t=t=>t,jt=({dashboardOid:t,widgetOid:e,uiFramework:r="react",chartType:i="table",includeChart:a=!0})=>{R(i);const s={dashboardOid:t,widgetOid:e},o=qt[Number(a)];return C(o,s,r)},J=(t,e,r)=>{if(n.isChartWidgetProps(t)){R(t.chartType);const i=w(t),a={idString:t.id,widgetTypeString:"chart",titleString:t.title,dataSourceString:I(t.dataSource),chartTypeString:$t(t.chartType),dataOptionsString:wt(t.dataOptions),filtersString:W(t.filters),componentString:"ChartWidget",extraImportsString:q(t.filters||[],i),styleOptionsString:p(t.styleOptions||{},O),drilldownOptionsString:p(t.drilldownOptions||{},O)};return C(r.chart,a,e)}if(n.isPivotTableWidgetProps(t)){const i=w(t),a={idString:t.id,widgetTypeString:"pivot",titleString:t.title,dataSourceString:I(t.dataSource),dataOptionsString:p(t.dataOptions),filtersString:W(t.filters),componentString:"PivotTableWidget",extraImportsString:q(t.filters||[],i),styleOptionsString:p(t.styleOptions||{},O)};return C(r.pivot,a,e)}if(n.isCustomWidgetProps(t))return"/** Custom widget code not supported yet */";throw new n.TranslatableError("errors.otherWidgetTypesNotSupported")},Lt=({widgetProps:t,uiFramework:e="react"})=>J(t,e,{chart:Wt,pivot:Pt}),Qt=t=>"chartType"in t.chartRecommendations?t.chartRecommendations:{chartType:"table",chartFamily:"table",axesMapping:{}},At=t=>({dataOptions:{columns:t.map(_)}}),_t=Object.freeze({convolution:{enabled:!0,selectedConvolutionType:"bySlicesCount",independentSlicesCount:7},lineWidth:{width:"bold"},markers:{enabled:!1},legend:{enabled:!1},yAxis:{gridLines:!1},xAxis:{gridLines:!1}}),Q=Object.freeze({line:"line/spline",pie:"pie/donut",bar:"bar/stacked",column:"column/stackedcolumn"}),Y=(t,e,r)=>{const i=t.reduce((s,o)=>(s[o.jaql.title]=o,s),{}),a=Object.entries(r).reduce((s,o)=>{const[g,d]=o;return s[`${g}`]=Array.isArray(d)?d.map(f=>{var T,b;const c=n.normalizeAnyColumn(f);delete c.enabled;const y=i[c.column.name];if(!y)return{column:{type:"",name:c.column.name}};const h=_(y);if(y.panel==="measures")return m(l({},c),{column:h});if(n.isDatetime(h.type)){const v=(b=(T=y.format)==null?void 0:T.mask)==null?void 0:b[y.jaql.level];if(v)return m(l({},c),{column:h,dateFormat:v})}return m(l({},c),{column:h})}):d,s},{});switch(e){case"cartesian":return l({category:[],value:[],breakBy:[]},a);case"categorical":return l({category:[],value:[]},a);case"scatter":return Object.keys(a).forEach(s=>{a[`${s}`]=a[`${s}`][0]}),a;case"scattermap":return Object.keys(a).forEach(s=>{s!=="geo"&&(a[`${s}`]=a[`${s}`][0])}),a;case"table":return Object.keys(a).length===0?At(t).dataOptions:a;case"boxplot":case"areamap":case"indicator":default:return a}},A=(t,e)=>{var r,i,a,s;return e==="x"?(i=(r=t.category)!=null?r:t.x)==null?void 0:i.map(o=>n.normalizeAnyColumn(o).column.name).join(", "):(s=(a=t.value)!=null?a:t.y)==null?void 0:s.map(o=>n.normalizeAnyColumn(o).column.name).join(", ")},U=(t,e,r,i)=>{let a;return i&&t in Q?a=n.merge(n.merge(_t,{subtype:Q[`${t}`]}),{legend:{enabled:!0,position:"right"},yAxis:{title:{enabled:!0,text:A(e,"y")}},xAxis:{title:{enabled:!0,text:A(e,"x")}}},r):a=n.merge(n.getDefaultStyleOptions(),r),a},K=(t,e,r=!0)=>{const{chartFamily:i,chartType:a,axesMapping:s={},styleOptions:o={}}=e,g=Y(t,i,s),d=U(a,s,o,r);return{dataOptions:g,chartStyleOptions:d}},Bt=t=>"chartType"in t?t:{chartType:"table",chartFamily:"table",axesMapping:{}},Rt=t=>t.map(e=>n.createFilterFromJaql(e.jaql)),kt=t=>t.reduce((e,r)=>{if((r.panel==="scope"||r.jaql.filter)&&e.metadataFilters.push(n.cloneDeep(r)),r.panel!=="scope"){const i=n.cloneDeep(r);delete i.jaql.filter,e.metadataColumns.push(i)}return e},{metadataColumns:[],metadataFilters:[]}),Ft=(t,e)=>{if(!ht(t))try{const{useCustomizedStyleOptions:r=!1}=e||{},{jaql:i,chartRecommendations:a,queryTitle:s}=t,{metadata:o,datasource:g}=i,d=m(l({},g),{type:g.type||"elasticube"}),f=n.convertJaqlDataSourceForDto(d),c=o.map(E=>z(E)).map(E=>m(l({},E),{jaql:m(l({},E.jaql),{datasource:f})})),y=Bt(a),h=y.chartType.toLowerCase(),T={cornerRadius:"Small",header:{renderToolbar:()=>null}},{metadataColumns:b,metadataFilters:v}=kt(c),H=Rt(v),{dataOptions:G,chartStyleOptions:Z}=K(b,y,r),X=l(l({},Z),T);return{widgetType:"chart",id:s,title:s,chartType:h,dataSource:d,dataOptions:G,filters:H,styleOptions:X}}catch(r){console.error(r);return}},V=(t,e)=>Ft(t,e),Nt=t=>B(t)?jt(t):Lt(t),zt=Object.freeze(Object.defineProperty({__proto__:null,toWidgetCode:Nt,toWidgetProps:V},Symbol.toStringTag,{value:"Module"}));exports.CODE_TEMPLATES_INDENT=O;exports.EMPTY_EXPANDED_QUERY_MODEL=lt;exports.EMPTY_SIMPLE_QUERY_MODEL=dt;exports.JaqlElement=P;exports.capitalizeFirstLetter=gt;exports.checkIfMeasuresExist=w;exports.generateCode=C;exports.getChartDataOptions=Y;exports.getChartOptions=K;exports.getChartRecommendationsOrDefault=Qt;exports.getChartStyleOptions=U;exports.getWidgetCode=J;exports.isByIdDashboardCodeParams=pt;exports.isByIdWidgetCodeParams=B;exports.isClientSideDashboardCodeParams=ut;exports.isClientSideWidgetCodeParams=ct;exports.isJaqlElement=nt;exports.populatePlaceholders=F;exports.sanitizeDimensionId=yt;exports.simplifyMetadataItem=z;exports.stringifyDataSource=I;exports.stringifyExtraImports=q;exports.stringifyFilters=W;exports.stringifyProps=p;exports.toWidgetProps=V;exports.validateQueryModel=ft;exports.widgetComposer=zt;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
var tt = Object.defineProperty, et = Object.defineProperties;
|
|
2
2
|
var rt = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var
|
|
3
|
+
var $ = Object.getOwnPropertySymbols;
|
|
4
4
|
var it = Object.prototype.hasOwnProperty, at = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var j = (t, e, r) => e in t ? tt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, o = (t, e) => {
|
|
6
6
|
for (var r in e || (e = {}))
|
|
7
7
|
it.call(e, r) && j(t, r, e[r]);
|
|
8
|
-
if (
|
|
9
|
-
for (var r of
|
|
8
|
+
if ($)
|
|
9
|
+
for (var r of $(e))
|
|
10
10
|
at.call(e, r) && j(t, r, e[r]);
|
|
11
11
|
return t;
|
|
12
12
|
}, u = (t, e) => et(t, rt(e));
|
|
13
|
-
import {
|
|
14
|
-
class J extends
|
|
13
|
+
import { eb as st, au as nt, ec as ot, ed as lt, e5 as _, w as dt, m as C, T as S, ee as ct, aU as N, dM as ut, ef as O, e7 as z, aD as pt, b5 as mt, b4 as gt, aL as I, at as yt, n as M, eg as ft, a8 as ht, bN as L, eh as St } from "./derive-chart-family-BPYK8evJ.js";
|
|
14
|
+
class J extends _ {
|
|
15
15
|
constructor(e, r) {
|
|
16
16
|
var i;
|
|
17
|
-
super((i = e.jaql.title) !== null && i !== void 0 ? i : "", r), this.expression = e.jaql.dim || e.jaql.formula, this.metadataItem = e, e.jaql.agg ? this.aggregation = e.jaql.agg : delete this.aggregation, e.jaql.formula ? this.formula = e.jaql.formula : delete this.formula, e.jaql.sort ? this.sortType =
|
|
17
|
+
super((i = e.jaql.title) !== null && i !== void 0 ? i : "", r), this.__serializable = "JaqlElement", this.expression = e.jaql.dim || e.jaql.formula, this.metadataItem = e, e.jaql.agg ? this.aggregation = e.jaql.agg : delete this.aggregation, e.jaql.formula ? this.formula = e.jaql.formula : delete this.formula, e.jaql.sort ? this.sortType = dt(e.jaql.sort) : delete this.sortType, this.skipValidation = !0;
|
|
18
18
|
}
|
|
19
19
|
get id() {
|
|
20
20
|
return this.expression;
|
|
@@ -27,14 +27,14 @@ class J extends N {
|
|
|
27
27
|
*/
|
|
28
28
|
serialize() {
|
|
29
29
|
const e = super.serialize();
|
|
30
|
-
return e.
|
|
30
|
+
return e.metadataItem = this.metadataItem, e.type = this.type, e;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
const Ot = {
|
|
34
34
|
text: C.TextAttribute,
|
|
35
35
|
numeric: C.NumericAttribute,
|
|
36
36
|
datetime: C.DateLevel
|
|
37
|
-
};
|
|
37
|
+
}, ae = (t) => t && t.__serializable === "JaqlElement";
|
|
38
38
|
function Tt(t) {
|
|
39
39
|
var e;
|
|
40
40
|
return new J(t, (e = Ot[t.jaql.datatype]) !== null && e !== void 0 ? e : "numeric");
|
|
@@ -42,9 +42,9 @@ function Tt(t) {
|
|
|
42
42
|
function K(t) {
|
|
43
43
|
const { jaql: e } = t;
|
|
44
44
|
if (e.formula)
|
|
45
|
-
return
|
|
46
|
-
const r =
|
|
47
|
-
return "agg" in e && e.dim && e.datatype ?
|
|
45
|
+
return st(e);
|
|
46
|
+
const r = nt.translateJaqlToGranularity(e);
|
|
47
|
+
return "agg" in e && e.dim && e.datatype ? ot({
|
|
48
48
|
expression: e.dim,
|
|
49
49
|
dataType: e.datatype,
|
|
50
50
|
agg: e.agg || "",
|
|
@@ -53,7 +53,7 @@ function K(t) {
|
|
|
53
53
|
sort: e.sort,
|
|
54
54
|
title: e.title,
|
|
55
55
|
dataSource: e.datasource
|
|
56
|
-
}) : e.dim && e.datatype ?
|
|
56
|
+
}) : e.dim && e.datatype ? lt({
|
|
57
57
|
expression: e.dim,
|
|
58
58
|
dataType: e.datatype,
|
|
59
59
|
granularity: r,
|
|
@@ -63,7 +63,7 @@ function K(t) {
|
|
|
63
63
|
dataSource: e.datasource
|
|
64
64
|
}) : Tt(t);
|
|
65
65
|
}
|
|
66
|
-
const
|
|
66
|
+
const se = {
|
|
67
67
|
jaql: {
|
|
68
68
|
datasource: {
|
|
69
69
|
title: "",
|
|
@@ -73,23 +73,23 @@ const ae = {
|
|
|
73
73
|
},
|
|
74
74
|
queryTitle: "",
|
|
75
75
|
chartRecommendations: {}
|
|
76
|
-
},
|
|
76
|
+
}, ne = {
|
|
77
77
|
model: "",
|
|
78
78
|
metadata: [],
|
|
79
79
|
chart: {},
|
|
80
80
|
queryTitle: ""
|
|
81
|
-
},
|
|
81
|
+
}, oe = (t) => "widgetProps" in t, bt = (t) => "dashboardOid" in t && "widgetOid" in t, le = (t) => "dashboardProps" in t, de = (t) => "dashboardOid" in t;
|
|
82
82
|
function vt(t) {
|
|
83
83
|
return t.replace(/\s+/g, "-").replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function ce(t) {
|
|
86
86
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function ue(t) {
|
|
89
89
|
const e = /\[(.+?)\s\(Calendar\)\]/;
|
|
90
90
|
return t.replace(e, "[$1]").trim();
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function pe(t) {
|
|
93
93
|
if (t)
|
|
94
94
|
if (t.metadata) {
|
|
95
95
|
if (!t.model)
|
|
@@ -120,7 +120,7 @@ function h(t) {
|
|
|
120
120
|
var e;
|
|
121
121
|
return "column" in t && ((e = t.column) == null ? void 0 : e.expression) && /\(.*\)/.test(t.column.expression);
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function A(t) {
|
|
124
124
|
const e = "measures" in t && c(t.measures) || "values" in t && c(t.values);
|
|
125
125
|
return Et(t) ? "values" in t.dataOptions && c(t.dataOptions.values) : "chartType" in t ? t.chartType === "indicator" ? "value" in t.dataOptions && c(t.dataOptions.value) || "secondary" in t.dataOptions && c(t.dataOptions.secondary) : t.chartType === "table" ? !("columns" in t.dataOptions) || !c(t.dataOptions.columns) ? !1 : t.dataOptions.columns.some((i) => h(i)) : t.chartType === "boxplot" ? !1 : t.chartType === "scatter" ? "x" in t.dataOptions && t.dataOptions.x !== void 0 && h(t.dataOptions.x) || "y" in t.dataOptions && t.dataOptions.y !== void 0 && h(t.dataOptions.y) || "size" in t.dataOptions && t.dataOptions.size !== void 0 : t.chartType === "scattermap" ? "colorBy" in t.dataOptions && t.dataOptions.colorBy !== void 0 && h(t.dataOptions.colorBy) || "details" in t.dataOptions && t.dataOptions.details !== void 0 && h(t.dataOptions.details) || "size" in t.dataOptions && t.dataOptions.size !== void 0 && h(t.dataOptions.size) : t.chartType === "areamap" ? "geo" in t.dataOptions && c(t.dataOptions.geo) && "color" in t.dataOptions && c(t.dataOptions.color) : "value" in t.dataOptions && c(t.dataOptions.value) : e;
|
|
126
126
|
}
|
|
@@ -611,10 +611,10 @@ import { DashboardById } from '@sisense/sdk-ui-vue';
|
|
|
611
611
|
</template>`,
|
|
612
612
|
dashboardTmpl: "/** COMING SOON */"
|
|
613
613
|
}
|
|
614
|
-
}, Y = (t, e) => Ct[e][t].replace(/{{(.*?)Tmpl}}/g, (i, a) => Y(`${a}Tmpl`, e)),
|
|
614
|
+
}, Y = (t, e) => Ct[e][t].replace(/{{(.*?)Tmpl}}/g, (i, a) => Y(`${a}Tmpl`, e)), Mt = (t, e) => t.replace(/{{(.*?)}}/g, (r, i) => i in e ? e[i] : (console.warn(`Placeholder ${i} not found in data`), r)), q = (t, e, r = "react") => {
|
|
615
615
|
const i = Y(t, r);
|
|
616
|
-
return Dt(
|
|
617
|
-
},
|
|
616
|
+
return Dt(Mt(i, e));
|
|
617
|
+
}, It = () => Object.values(ut).map((e) => N.aggregationToJAQL(e)).join("|"), V = (t) => {
|
|
618
618
|
const { formula: e, context: r, filter: i } = t;
|
|
619
619
|
if (!r || !e)
|
|
620
620
|
return t;
|
|
@@ -624,7 +624,7 @@ import { DashboardById } from '@sisense/sdk-ui-vue';
|
|
|
624
624
|
const s = a[0];
|
|
625
625
|
if (typeof s != "string")
|
|
626
626
|
return t;
|
|
627
|
-
const n = r[`${s}`], m =
|
|
627
|
+
const n = r[`${s}`], m = It(), l = new RegExp(`^\\s*(${m})\\(\\[\\w+\\]\\)$`), y = e.match(l);
|
|
628
628
|
if (y && e.includes(s)) {
|
|
629
629
|
const d = y[1];
|
|
630
630
|
return o({
|
|
@@ -657,7 +657,7 @@ import { DashboardById } from '@sisense/sdk-ui-vue';
|
|
|
657
657
|
return (i = r.filter) != null && i.by && (r.filter.by = V(r.filter.by)), u(o({}, e), {
|
|
658
658
|
jaql: r
|
|
659
659
|
});
|
|
660
|
-
},
|
|
660
|
+
}, Wt = (t) => {
|
|
661
661
|
let e = t;
|
|
662
662
|
e = qt(e);
|
|
663
663
|
const { jaql: r, measure: i, by: a } = e;
|
|
@@ -669,14 +669,14 @@ import { DashboardById } from '@sisense/sdk-ui-vue';
|
|
|
669
669
|
measure: D(i)
|
|
670
670
|
} : {});
|
|
671
671
|
}, w = 6, E = `
|
|
672
|
-
`,
|
|
672
|
+
`, W = "UNKNOWN", $t = (t, e) => {
|
|
673
673
|
let r = "";
|
|
674
674
|
return r += `measureFactory.customFormula(
|
|
675
675
|
`, r += " ".repeat(e), r += ` '${O(t.title)}',
|
|
676
676
|
`, r += " ".repeat(e), r += ` '${t.formula}',
|
|
677
677
|
`, r += " ".repeat(e), r += ` {
|
|
678
678
|
`, Object.entries(t.context).forEach(([i, a]) => {
|
|
679
|
-
const s = z(a.table ||
|
|
679
|
+
const s = z(a.table || W, a.column || W, void 0, "DM");
|
|
680
680
|
r += " ".repeat(e), r += ` '${i.slice(1, -1)}': ${s},
|
|
681
681
|
`;
|
|
682
682
|
}), r += " ".repeat(e), r += ` }
|
|
@@ -684,10 +684,10 @@ import { DashboardById } from '@sisense/sdk-ui-vue';
|
|
|
684
684
|
}, jt = (t) => {
|
|
685
685
|
const { level: e, table: r, column: i, agg: a, title: s } = t;
|
|
686
686
|
let n;
|
|
687
|
-
return r && i && (n = z(r, i, e, "DM")), a && r && i && s && (n = `measureFactory.${
|
|
687
|
+
return r && i && (n = z(r, i, e, "DM")), a && r && i && s && (n = `measureFactory.${N.aggregationFromJAQL(a)}(${n}, '${O(s)}')`), n || W;
|
|
688
688
|
}, Lt = (t, e) => {
|
|
689
689
|
const r = t.jaql(!1).jaql;
|
|
690
|
-
return "formula" in r ?
|
|
690
|
+
return "formula" in r ? $t(r, e) : jt(r);
|
|
691
691
|
}, p = (t, e = 0, r = !1) => {
|
|
692
692
|
if (!t)
|
|
693
693
|
return "";
|
|
@@ -695,7 +695,7 @@ import { DashboardById } from '@sisense/sdk-ui-vue';
|
|
|
695
695
|
return `'${O(t)}'`;
|
|
696
696
|
if (t instanceof J)
|
|
697
697
|
return Lt(t, e);
|
|
698
|
-
if (t instanceof
|
|
698
|
+
if (t instanceof _)
|
|
699
699
|
return t.composeCode || "";
|
|
700
700
|
let i = "";
|
|
701
701
|
return Array.isArray(t) ? i += `[${t.map((a) => p(a, e + 2))}${t.length ? E + " ".repeat(e + 2) : ""}]` : (i += `{${E}`, Object.entries(t).forEach(([a, s]) => {
|
|
@@ -713,10 +713,10 @@ import { DashboardById } from '@sisense/sdk-ui-vue';
|
|
|
713
713
|
i += `,${E}`;
|
|
714
714
|
}), i += " ".repeat(e), i += "}"), i;
|
|
715
715
|
};
|
|
716
|
-
function
|
|
716
|
+
function At(t) {
|
|
717
717
|
return p(t, w);
|
|
718
718
|
}
|
|
719
|
-
function
|
|
719
|
+
function P(t, e = "data-source-placeholder") {
|
|
720
720
|
if (!t)
|
|
721
721
|
return e;
|
|
722
722
|
const r = typeof t == "object" && "title" in t ? t.title : t;
|
|
@@ -727,7 +727,7 @@ function Q(t, e = !0) {
|
|
|
727
727
|
return e && r.push("measureFactory"), c(t) && r.push("filterFactory"), r.length > 0 ? `import { ${r.join(", ")} } from '@sisense/sdk-data';` : "";
|
|
728
728
|
}
|
|
729
729
|
const k = `
|
|
730
|
-
`,
|
|
730
|
+
`, Pt = (t, e) => {
|
|
731
731
|
if (t.composeCode)
|
|
732
732
|
return `${k}${" ".repeat(e)}${t.composeCode}`;
|
|
733
733
|
const r = t.jaql().jaql;
|
|
@@ -736,28 +736,28 @@ const k = `
|
|
|
736
736
|
if (!t)
|
|
737
737
|
return "";
|
|
738
738
|
let r = "";
|
|
739
|
-
return r += `[${t.map((i) =>
|
|
739
|
+
return r += `[${t.map((i) => Pt(i, e + 2))}${t.length ? `
|
|
740
740
|
` + " ".repeat(e + 2) : ""}]`, r;
|
|
741
741
|
}, B = (t) => t ? Array.isArray(t) ? Qt(t, 6) : "/** Filter relations not supported yet */" : "[]", kt = [
|
|
742
742
|
"executeQueryByWidgetIdTmpl",
|
|
743
743
|
"widgetByIdTmpl"
|
|
744
|
-
], Bt = "chartWidgetTmpl", Rt = "pivotTableWidgetTmpl", Ft = (t) => t,
|
|
744
|
+
], Bt = "chartWidgetTmpl", Rt = "pivotTableWidgetTmpl", Ft = (t) => t, _t = ({ dashboardOid: t, widgetOid: e, uiFramework: r = "react", chartType: i = "table", includeChart: a = !0 }) => {
|
|
745
745
|
U(i);
|
|
746
746
|
const s = {
|
|
747
747
|
dashboardOid: t,
|
|
748
748
|
widgetOid: e
|
|
749
749
|
}, n = kt[Number(a)];
|
|
750
750
|
return q(n, s, r);
|
|
751
|
-
},
|
|
751
|
+
}, Nt = (t, e, r) => {
|
|
752
752
|
if (pt(t)) {
|
|
753
753
|
U(t.chartType);
|
|
754
|
-
const i =
|
|
754
|
+
const i = A(t), a = {
|
|
755
755
|
idString: t.id,
|
|
756
756
|
widgetTypeString: "chart",
|
|
757
757
|
titleString: t.title,
|
|
758
|
-
dataSourceString:
|
|
758
|
+
dataSourceString: P(t.dataSource),
|
|
759
759
|
chartTypeString: Ft(t.chartType),
|
|
760
|
-
dataOptionsString:
|
|
760
|
+
dataOptionsString: At(t.dataOptions),
|
|
761
761
|
filtersString: B(t.filters),
|
|
762
762
|
componentString: "ChartWidget",
|
|
763
763
|
extraImportsString: Q(t.filters || [], i),
|
|
@@ -767,11 +767,11 @@ const k = `
|
|
|
767
767
|
return q(r.chart, a, e);
|
|
768
768
|
}
|
|
769
769
|
if (mt(t)) {
|
|
770
|
-
const i =
|
|
770
|
+
const i = A(t), a = {
|
|
771
771
|
idString: t.id,
|
|
772
772
|
widgetTypeString: "pivot",
|
|
773
773
|
titleString: t.title,
|
|
774
|
-
dataSourceString:
|
|
774
|
+
dataSourceString: P(t.dataSource),
|
|
775
775
|
dataOptionsString: p(t.dataOptions),
|
|
776
776
|
filtersString: B(t.filters),
|
|
777
777
|
componentString: "PivotTableWidget",
|
|
@@ -783,10 +783,10 @@ const k = `
|
|
|
783
783
|
if (gt(t))
|
|
784
784
|
return "/** Custom widget code not supported yet */";
|
|
785
785
|
throw new S("errors.otherWidgetTypesNotSupported");
|
|
786
|
-
}, zt = ({ widgetProps: t, uiFramework: e = "react" }) =>
|
|
786
|
+
}, zt = ({ widgetProps: t, uiFramework: e = "react" }) => Nt(t, e, {
|
|
787
787
|
chart: Bt,
|
|
788
788
|
pivot: Rt
|
|
789
|
-
}),
|
|
789
|
+
}), me = (t) => "chartType" in t.chartRecommendations ? t.chartRecommendations : {
|
|
790
790
|
chartType: "table",
|
|
791
791
|
chartFamily: "table",
|
|
792
792
|
axesMapping: {}
|
|
@@ -825,7 +825,7 @@ const k = `
|
|
|
825
825
|
const [m, l] = n;
|
|
826
826
|
return s[`${m}`] = Array.isArray(l) ? l.map((y) => {
|
|
827
827
|
var T, b;
|
|
828
|
-
const d =
|
|
828
|
+
const d = I(y);
|
|
829
829
|
delete d.enabled;
|
|
830
830
|
const g = i[d.column.name];
|
|
831
831
|
if (!g)
|
|
@@ -883,10 +883,10 @@ const k = `
|
|
|
883
883
|
}
|
|
884
884
|
}, F = (t, e) => {
|
|
885
885
|
var r, i, a, s;
|
|
886
|
-
return e === "x" ? (i = (r = t.category) != null ? r : t.x) == null ? void 0 : i.map((n) =>
|
|
886
|
+
return e === "x" ? (i = (r = t.category) != null ? r : t.x) == null ? void 0 : i.map((n) => I(n).column.name).join(", ") : (s = (a = t.value) != null ? a : t.y) == null ? void 0 : s.map((n) => I(n).column.name).join(", ");
|
|
887
887
|
}, Yt = (t, e, r, i) => {
|
|
888
888
|
let a;
|
|
889
|
-
return i && t in R ? a =
|
|
889
|
+
return i && t in R ? a = M(M(Kt, {
|
|
890
890
|
subtype: R[`${t}`]
|
|
891
891
|
}), {
|
|
892
892
|
legend: {
|
|
@@ -905,7 +905,7 @@ const k = `
|
|
|
905
905
|
text: F(e, "x")
|
|
906
906
|
}
|
|
907
907
|
}
|
|
908
|
-
}, r) : a =
|
|
908
|
+
}, r) : a = M(ft(), r), a;
|
|
909
909
|
}, Vt = (t, e, r = !0) => {
|
|
910
910
|
const { chartFamily: i, chartType: a, axesMapping: s = {}, styleOptions: n = {} } = e, m = Ut(t, i, s), l = Yt(a, s, n, r);
|
|
911
911
|
return {
|
|
@@ -930,7 +930,7 @@ const k = `
|
|
|
930
930
|
try {
|
|
931
931
|
const { useCustomizedStyleOptions: r = !1 } = e || {}, { jaql: i, chartRecommendations: a, queryTitle: s } = t, { metadata: n, datasource: m } = i, l = u(o({}, m), {
|
|
932
932
|
type: m.type || "elasticube"
|
|
933
|
-
}), y = St(l), d = n.map((x) =>
|
|
933
|
+
}), y = St(l), d = n.map((x) => Wt(x)).map((x) => u(o({}, x), {
|
|
934
934
|
jaql: u(o({}, x.jaql), {
|
|
935
935
|
datasource: y
|
|
936
936
|
})
|
|
@@ -955,36 +955,37 @@ const k = `
|
|
|
955
955
|
console.error(r);
|
|
956
956
|
return;
|
|
957
957
|
}
|
|
958
|
-
}, te = (t, e) => Xt(t, e), ee = (t) => bt(t) ?
|
|
958
|
+
}, te = (t, e) => Xt(t, e), ee = (t) => bt(t) ? _t(t) : zt(t), ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
959
959
|
__proto__: null,
|
|
960
960
|
toWidgetCode: ee,
|
|
961
961
|
toWidgetProps: te
|
|
962
962
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
963
963
|
export {
|
|
964
964
|
w as C,
|
|
965
|
-
|
|
965
|
+
ne as E,
|
|
966
966
|
J,
|
|
967
967
|
q as a,
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
968
|
+
A as b,
|
|
969
|
+
ce as c,
|
|
970
|
+
P as d,
|
|
971
971
|
B as e,
|
|
972
972
|
Q as f,
|
|
973
|
-
|
|
973
|
+
Nt as g,
|
|
974
974
|
p as h,
|
|
975
|
-
|
|
975
|
+
de as i,
|
|
976
976
|
ae as j,
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
977
|
+
se as k,
|
|
978
|
+
oe as l,
|
|
979
|
+
bt as m,
|
|
980
|
+
le as n,
|
|
981
|
+
Wt as o,
|
|
982
|
+
Mt as p,
|
|
983
|
+
me as q,
|
|
984
|
+
Ut as r,
|
|
985
|
+
ue as s,
|
|
986
986
|
te as t,
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
987
|
+
Yt as u,
|
|
988
|
+
pe as v,
|
|
989
|
+
ge as w,
|
|
990
|
+
Vt as x
|
|
990
991
|
};
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"Sisense",
|
|
12
12
|
"Compose SDK"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.
|
|
14
|
+
"version": "2.6.0",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
"@emotion/styled": "^11.14.0",
|
|
58
58
|
"@mui/material": "^6.4.11",
|
|
59
59
|
"@mui/system": "^6.4.11",
|
|
60
|
-
"@sisense/sdk-common": "2.
|
|
61
|
-
"@sisense/sdk-data": "2.
|
|
62
|
-
"@sisense/sdk-pivot-client": "2.
|
|
63
|
-
"@sisense/sdk-query-client": "2.
|
|
64
|
-
"@sisense/sdk-rest-client": "2.
|
|
65
|
-
"@sisense/sdk-tracking": "2.
|
|
60
|
+
"@sisense/sdk-common": "2.6.0",
|
|
61
|
+
"@sisense/sdk-data": "2.6.0",
|
|
62
|
+
"@sisense/sdk-pivot-client": "2.6.0",
|
|
63
|
+
"@sisense/sdk-query-client": "2.6.0",
|
|
64
|
+
"@sisense/sdk-rest-client": "2.6.0",
|
|
65
|
+
"@sisense/sdk-tracking": "2.6.0",
|
|
66
66
|
"@sisense/sisense-charts": "5.1.1",
|
|
67
67
|
"@tanstack/react-query": "4.36.1",
|
|
68
68
|
"classnames": "^2.3.2",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./derive-chart-family-Cjjn5U5S.cjs");class m extends e.DimensionalElement{constructor(i,t,s,a,u,o,l,h,D,r){if(super(i,u||e.MetadataTypes.Dimension,o,h,D),this._dimensions=[],this._attributes=[],this._sort=e.Sort.None,!D&&t){const{table:d,column:g}=e.parseExpression(t);this.composeCode=e.normalizeAttributeName(d,g,"",e.DATA_MODEL_MODULE_NAME)}this._sort=l||e.Sort.None,this._expression=t,this.setDimensions(a||[]),this.setAttributes(s),r&&(this.defaultAttribute=r)}static parseType(i){switch(i){case"datetime":case e.MetadataTypes.DateDimension:return e.MetadataTypes.DateDimension;case"text":case e.MetadataTypes.TextDimension:return e.MetadataTypes.TextDimension;case"numeric":case e.MetadataTypes.NumericDimension:return e.MetadataTypes.NumericDimension}return e.MetadataTypes.TextDimension}getAttachedName(i,t){let s=i;const a=e.normalizeName(i);return(a==="id"||a==="name"||Object.getOwnPropertyDescriptor(this,a)!==void 0||this[a]!==void 0)&&(s=t),s}setDimensions(i){this._dimensions=i;for(let t=0;t<i.length;t++){const s=this.getAttachedName(i[t].name,i[t].attributes[0].expression);this[e.normalizeName(s)]=i[t],s!=i[t].name&&(i[t].name=s)}}setAttributes(i){this._attributes=i||[];for(let t=0;t<i.length;t++){const s=this.getAttachedName(i[t].name,i[t].expression);this[e.normalizeName(s)]=i[t],i[t].name!=s&&(i[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(i){return new m(this.name,this.expression,this.attributes,this.dimensions,this.type,this.description,i,this.dataSource,this.composeCode,this.defaultAttribute)}serialize(){const i=super.serialize();return i.__serializable="DimensionalDimension",i.expression=this.expression,this.getSort()!==void 0&&(i.sort=this.getSort()),i.attributes=this._attributes.map(t=>t.serialize()),i.dimensions=this._dimensions.map(t=>t.serialize()),this.defaultAttribute&&(i.defaultAttribute=this.defaultAttribute.serialize()),i}jaql(i){if(this.defaultAttribute)return this.defaultAttribute.jaql(i);if(this.dimensions.length>0)return this.dimensions[0].jaql(i);const t={jaql:{title:this.name,dim:this.expression,datatype:e.jaqlSimpleColumnType(this.type)}};return this._sort!=e.Sort.None&&(t.jaql.sort=this._sort==e.Sort.Ascending?"asc":"desc"),i===!0?t.jaql:t}}class y extends m{constructor(i,t,s,a,u,o){super(i,t,[],[],e.MetadataTypes.DateDimension,s,a,u,o),this.defaultLevel=e.DateLevels.Years,this.Years=new e.DimensionalLevelAttribute(e.DateLevels.Years,t,e.DateLevels.Years,"yyyy",s,a,u),this.Quarters=new e.DimensionalLevelAttribute(e.DateLevels.Quarters,t,e.DateLevels.Quarters,"Q yyyy",s,a,u),this.Months=new e.DimensionalLevelAttribute(e.DateLevels.Months,t,e.DateLevels.Months,"yyyy-MM",s,a,u),this.Weeks=new e.DimensionalLevelAttribute(e.DateLevels.Weeks,t,e.DateLevels.Weeks,"ww yyyy",s,a,u),this.Days=new e.DimensionalLevelAttribute(e.DateLevels.Days,t,e.DateLevels.Days,"yyyy-MM-dd",s,a,u),this.Hours=new e.DimensionalLevelAttribute(e.DateLevels.Hours,t,e.DateLevels.Hours,"yyyy-MM-dd HH:mm",s,a,u),this.MinutesRoundTo30=new e.DimensionalLevelAttribute(e.DateLevels.MinutesRoundTo30,t,e.DateLevels.MinutesRoundTo30,"yyyy-MM-dd HH:mm",s,a,u),this.MinutesRoundTo15=new e.DimensionalLevelAttribute(e.DateLevels.MinutesRoundTo15,t,e.DateLevels.MinutesRoundTo15,"yyyy-MM-dd HH:mm",s,a,u),this.Minutes=new e.DimensionalLevelAttribute(e.DateLevels.Minutes,t,e.DateLevels.Minutes,"yyyy-MM-dd HH:mm",s,a,u),this.Seconds=new e.DimensionalLevelAttribute(e.DateLevels.Seconds,t,e.DateLevels.Seconds,"yyyy-MM-dd HH:mm:ss",s,a,u),this.AggHours=new e.DimensionalLevelAttribute(e.DateLevels.AggHours,t,e.DateLevels.AggHours,"HH:mm",s,a,u),this.AggMinutesRoundTo30=new e.DimensionalLevelAttribute(e.DateLevels.AggMinutesRoundTo30,t,e.DateLevels.AggMinutesRoundTo30,"HH:mm",s,a,u),this.AggMinutesRoundTo15=new e.DimensionalLevelAttribute(e.DateLevels.AggMinutesRoundTo15,t,e.DateLevels.AggMinutesRoundTo15,"HH:mm",s,a,u),this.AggMinutesRoundTo1=new e.DimensionalLevelAttribute(e.DateLevels.AggMinutesRoundTo1,t,e.DateLevels.AggMinutesRoundTo1,"HH:mm",s,a,u),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(i){this._attributes=i}getSort(){return this._sort}sort(i){return new y(this.name,this.expression,this.description,i,this.dataSource,this.composeCode)}serialize(){const i=super.serialize();return i.__serializable="DimensionalDateDimension",i}jaql(i){const t=this[this.defaultLevel].jaql();return t.jaql.title=this.name,i?t.jaql:t}}function M(n){const i=n.name||n.title,t=n.desc||n.description,s=n.expression||n.dim,a=m.parseType(n.dimtype||n.type),u=n.sort,o=n.dataSource;if(a==e.MetadataTypes.DateDimension)return new y(i,s,t,u,o);const l=Object.getOwnPropertyNames(n).map(r=>n[r]).filter(r=>e.MetadataTypes.isAttribute(r==null?void 0:r.type));if(l.length==0)if(n.attributes){let r;for(let d=0;d<n.attributes.length;d++)r=n.attributes[d],l.push(new e.DimensionalAttribute(r.name,r.expression,r.type,r.description,r.sort,r.dataSource))}else s&&l.push(new e.DimensionalAttribute(i,s,a,t,u,o));const h=Object.getOwnPropertyNames(n).map(r=>n[r]).filter(r=>e.MetadataTypes.isDimension(r==null?void 0:r.type));if(h.length==0&&n.dimensions)for(let r=0;r<n.dimensions.length;r++)h.push(M(n.dimensions[r]));const D=new m(i,s,l,h,a,t,u,o);return n.defaultAttribute&&(D.defaultAttribute=l.find(r=>r.name===n.defaultAttribute)),D}function p(n){const i=n.name||n.title,t=n.expression||n.dim,s=n.desc||n.description,a=n.sort,u=n.dataSource;return new y(i,t,s,a,u)}exports.DimensionalDateDimension=y;exports.DimensionalDimension=m;exports.createDateDimension=p;exports.createDimension=M;
|