@vuu-ui/vuu-table-extras 0.8.2 → 0.8.3-debug

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/esm/index.js CHANGED
@@ -1,2 +1,3261 @@
1
- var an=(e,n,t)=>{if(!n.has(e))throw TypeError("Cannot "+t)};var u=(e,n,t)=>(an(e,n,"read from private field"),t?t.call(e):n.get(e)),T=(e,n,t)=>{if(n.has(e))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(e):n.set(e,t)},F=(e,n,t,o)=>(an(e,n,"write to private field"),o?o.call(e,t):n.set(e,t),t);import{DOWN1 as bt,DOWN2 as yt,isTypeDescriptor as Et,metadataKeys as vt,registerComponent as Ot,UP1 as Pt,UP2 as St}from"@vuu-ui/vuu-utils";import Tt from"classnames";import{getMovingValueDirection as gt,isTypeDescriptor as ft,isValidNumber as ln}from"@vuu-ui/vuu-utils";import{useEffect as Ct,useRef as xt}from"react";var ht=[void 0,void 0,void 0,void 0];function pn(e,n,t){var x;let o=xt(),[i,r,s,p]=o.current||ht,{type:l}=t,c=ft(l)?(x=l.formatting)==null?void 0:x.decimals:void 0,g=e===i&&ln(n)&&ln(r)&&t===s?gt(n,p,r,c):"";return Ct(()=>{o.current=[e,n,t,g]}),g}import{jsx as kt,jsxs as Ft}from"react/jsx-runtime";var Dt=String.fromCharCode(11014),wt=String.fromCharCode(11015),{KEY:Rt}=vt,ye="vuuBackgroundCell",ae={ArrowOnly:"arrow",BackgroundOnly:"bg-only",ArrowBackground:"arrow-bg"},At=e=>Et(e)&&e.renderer&&"flashStyle"in e.renderer?e.renderer.flashStyle:ae.BackgroundOnly,Nt=({column:e,row:n})=>{let{key:t,type:o,valueFormatter:i}=e,r=n[t],s=At(o),p=pn(n[Rt],r,e),l=s===ae.ArrowOnly||s===ae.ArrowBackground?p===Pt||p===St?Dt:p===bt||p===yt?wt:null:null,c=p?" "+p:"",g=Tt(ye,c,{[`${ye}-arrowOnly`]:s===ae.ArrowOnly,[`${ye}-arrowBackground`]:s===ae.ArrowBackground});return Ft("div",{className:g,tabIndex:-1,children:[kt("div",{className:`${ye}-flasher`,children:l}),i(n[e.key])]})};Ot("background",Nt,"cell-renderer",{serverDataType:["long","int","double"]});import{isColumnTypeRenderer as Qt,isTypeDescriptor as Lt,registerComponent as It}from"@vuu-ui/vuu-utils";import Bt from"classnames";import{jsx as Fe,jsxs as cn}from"react/jsx-runtime";var le="vuuProgressCell",$t=({column:e,columnMap:n,row:t})=>{let{type:o}=e,i=t[e.key],r=!1,s=0;if(Lt(o)&&Qt(o.renderer)){let{associatedField:l}=o.renderer,c=t[n[l]];if(typeof i=="number"&&typeof c=="number")s=Math.min(Math.round(i/c*100),100),r=isFinite(s);else{let g=parseFloat(i);if(Number.isFinite(g)){let x=parseFloat(c);Number.isFinite(x)&&(s=Math.min(Math.round(g/x*100),100),r=isFinite(s))}}}let p=Bt(le,{});return cn("div",{className:p,tabIndex:-1,children:[r?cn("span",{className:`${le}-track`,children:[Fe("span",{className:`${le}-bg`}),Fe("span",{className:`${le}-bar`,style:{"--progress-bar-pct":`-${100-s}%`}})]}):null,Fe("span",{className:`${le}-text`,children:`${s} %`})]})};It("vuu.progress",$t,"cell-renderer",{serverDataType:["long","int","double"]});import{autocompletion as ro,defaultKeymap as so,EditorState as io,EditorView as Sn,ensureSyntaxTree as ao,keymap as Ve,minimalSetup as lo,startCompletion as Tn}from"@vuu-ui/vuu-codemirror";import{createEl as Dn}from"@vuu-ui/vuu-utils";import{useEffect as po,useMemo as co,useRef as Ye}from"react";import{LanguageSupport as Ut,LRLanguage as Gt,styleTags as Wt,tags as ve}from"@vuu-ui/vuu-codemirror";import{LRParser as Mt}from"@lezer/lr";var Ee=Mt.deserialize({version:14,states:"&fOVQPOOO!SQPO'#C^OVQPO'#CcQ!pQPOOO#OQPO'#CkO#TQPO'#CrOOQO'#Cy'#CyO#YQPO,58}OVQPO,59QOVQPO,59QOVQPO,59VOVQPO'#CtOOQO,59^,59^OOQO1G.i1G.iOOQO1G.l1G.lO#kQPO1G.lO$fQPO'#CmO%WQQO1G.qOOQO'#C{'#C{O%cQPO,59`OOQO'#Cn'#CnO%wQPO,59XOVQPO,59ZOVQPO,59[OVQPO7+$]OVQPO'#CuO&`QPO1G.zOOQO1G.z1G.zO&hQQO'#C^O&rQQO1G.sO'ZQQO1G.uOOQO1G.v1G.vO'fQPO<<GwO'wQPO,59aOOQO-E6s-E6sOOQO7+$f7+$fOVQPOAN=cO(]QQO1G.lO(tQPOG22}OOQOLD(iLD(iO%wQPO,59QO%wQPO,59Q",stateData:")[~OlOS~ORUOSUOTUOUUOWQO`SOnPO~OWgXZQX[QX]QX^QXeQX~OjQXXQXpQXqQXrQXsQXtQXuQX~PnOZWO[WO]XO^XO~OWYO~OWZO~OX]OZWO[WO]XO^XO~OZWO[WO]Yi^YijYiXYipYiqYirYisYitYiuYieYi~OZWO[WO]XO^XOpdOqdOrdOsdOtdOudO~OehOvfOwgO~OXkOZWO[WO]XO^XOeiO~ORUOSUOTUOUUOWQO`SOnlO~OXsOeiO~OvQXwQX~PnOZxO[xO]yO^yOeaivaiwai~OwgOecivci~OZWO[WO]XO^XOetO~OZWO[WO]XO^XOXiaeia~OZxO[xO]Yi^YieYivYiwYi~OXwOZWO[WO]XO^XO~O`UTn~",goto:"#spPPqPPPPqPPqPPPPqP!R!W!R!RPq!Z!k!nPPP!tP#jmUOQWXYZefghitxyVbYfgRe`mTOQWXYZefghitxyR[TQjcRrjQROQVQS^WxQ_XU`YfgQcZQmeQphQqiQuyRvtQaYQnfRog",nodeNames:"\u26A0 ColumnDefinitionExpression Column Number String True False ParenthesizedExpression OpenBrace CloseBrace ArithmeticExpression Divide Times Plus Minus ConditionalExpression If RelationalExpression RelationalOperator AndCondition OrCondition Comma CallExpression Function ArgList",maxTerm:39,skippedNodes:[0],repeatNodeCount:1,tokenData:".^~RnXY#PYZ#P]^#Ppq#Pqr#brs#mxy$eyz$jz{$o{|$t|}$y}!O%O!O!P%T!P!Q%c!Q![%h!^!_%s!_!`&Q!`!a&V!c!}&d#R#S&d#T#U&u#U#Y&d#Y#Z(Y#Z#]&d#]#^*j#^#c&d#c#d+f#d#h&d#h#i,b#i#o&d~#USl~XY#PYZ#P]^#Ppq#P~#eP!_!`#h~#mOu~~#pWOX#mZ]#m^r#mrs$Ys#O#m#P;'S#m;'S;=`$_<%lO#m~$_OS~~$bP;=`<%l#m~$jOW~~$oOX~~$tO[~~$yO]~~%OOe~~%TO^~~%WP!Q![%Z~%`PR~!Q![%Z~%hOZ~~%mQR~!O!P%Z!Q![%h~%xPr~!_!`%{~&QOt~~&VOp~~&[Pq~!_!`&_~&dOs~P&iSnP!Q![&d!c!}&d#R#S&d#T#o&dR&zUnP!Q![&d!c!}&d#R#S&d#T#b&d#b#c'^#c#o&dR'cUnP!Q![&d!c!}&d#R#S&d#T#W&d#W#X'u#X#o&dR'|SvQnP!Q![&d!c!}&d#R#S&d#T#o&d~(_TnP!Q![&d!c!}&d#R#S&d#T#U(n#U#o&d~(sUnP!Q![&d!c!}&d#R#S&d#T#`&d#`#a)V#a#o&d~)[UnP!Q![&d!c!}&d#R#S&d#T#g&d#g#h)n#h#o&d~)sUnP!Q![&d!c!}&d#R#S&d#T#X&d#X#Y*V#Y#o&d~*^SU~nP!Q![&d!c!}&d#R#S&d#T#o&d~*oUnP!Q![&d!c!}&d#R#S&d#T#Y&d#Y#Z+R#Z#o&d~+YS`~nP!Q![&d!c!}&d#R#S&d#T#o&dR+kUnP!Q![&d!c!}&d#R#S&d#T#f&d#f#g+}#g#o&dR,USwQnP!Q![&d!c!}&d#R#S&d#T#o&d~,gUnP!Q![&d!c!}&d#R#S&d#T#f&d#f#g,y#g#o&d~-OUnP!Q![&d!c!}&d#R#S&d#T#i&d#i#j-b#j#o&d~-gUnP!Q![&d!c!}&d#R#S&d#T#X&d#X#Y-y#Y#o&d~.QST~nP!Q![&d!c!}&d#R#S&d#T#o&d",tokenizers:[0,1],topRules:{ColumnDefinitionExpression:[0,1]},tokenPrec:375});var Ht=Gt.define({name:"VuuColumnExpression",parser:Ee.configure({props:[Wt({Function:ve.variableName,String:ve.string,Or:ve.emphasis,Operator:ve.operator})]})}),un=()=>new Ut(Ht);var Qe=class{constructor(n){switch(this.value=n,typeof n){case"boolean":this.type="booleanLiteralExpression";break;case"number":this.type="numericLiteralExpression";break;default:this.type="stringLiteralExpression"}}toJSON(){return{type:this.type,value:this.value}}},Le=class{constructor(n){this.type="colExpression";this.column=n}toJSON(){return{type:this.type,column:this.column}}},ce,L,Ie=class{constructor(n="unknown"){T(this,ce,[{type:"unknown"},{type:"unknown"}]);T(this,L,void 0);this.type="arithmeticExpression";F(this,L,n)}get op(){return u(this,L)}set op(n){F(this,L,n)}get expressions(){return u(this,ce)}toJSON(){return{type:this.type,op:u(this,L),expressions:u(this,ce)}}};ce=new WeakMap,L=new WeakMap;var V,Be=class{constructor(n){T(this,V,[]);this.type="callExpression";this.functionName=n}get expressions(){return u(this,V)}get arguments(){return u(this,V)}toJSON(){return{type:this.type,functionName:this.functionName,arguments:u(this,V).map(n=>{var t;return(t=n.toJSON)==null?void 0:t.call(n)})}}};V=new WeakMap;var ue,Y,H=class{constructor(){T(this,ue,[{type:"unknown"},{type:"unknown"}]);T(this,Y,"unknown");this.type="relationalExpression"}get op(){return u(this,Y)}set op(n){F(this,Y,n)}get expressions(){return u(this,ue)}toJSON(){return{type:this.type,op:u(this,Y),expressions:u(this,ue)}}};ue=new WeakMap,Y=new WeakMap;var me,z,X=class{constructor(n){T(this,me,[{type:"unknown"},{type:"unknown"}]);T(this,z,void 0);this.type="booleanCondition";F(this,z,n)}get op(){return u(this,z)}get expressions(){return u(this,me)}toJSON(){return{type:this.type,op:u(this,z),expressions:u(this,me).map(n=>{var t;return(t=n.toJSON)==null?void 0:t.call(n)})}}};me=new WeakMap,z=new WeakMap;var D,pe=class{constructor(n){T(this,D,void 0);this.type="conditionalExpression";F(this,D,[n?new X(n):new H,{type:"unknown"},{type:"unknown"}])}get expressions(){return u(this,D)}get condition(){return u(this,D)[0]}get truthyExpression(){return u(this,D)[1]}set truthyExpression(n){u(this,D)[1]=n}get falsyExpression(){return u(this,D)[2]}set falsyExpression(n){u(this,D)[2]=n}toJSON(){var n,t,o,i,r;return{type:this.type,condition:(t=(n=this.condition).toJSON)==null?void 0:t.call(n),truthyExpression:this.truthyExpression,falsyExpression:(r=(i=(o=this.falsyExpression)==null?void 0:o.toJSON)==null?void 0:i.call(o))!=null?r:this.falsyExpression}}};D=new WeakMap;var Q=e=>e.type==="unknown",Oe=e=>e.type==="arithmeticExpression",Xt=e=>e.type==="callExpression",W=e=>e.type==="conditionalExpression",Vt=e=>e.type==="relationalExpression"||e.type==="booleanCondition";var Yt=e=>e.type==="booleanCondition",Me=e=>(e==null?void 0:e.type)==="relationalExpression";var S=e=>{if(Q(e))return e;if(Me(e)){let[n,t]=e.expressions;if(O(n))return S(n);if(e.op==="unknown")return e;if(O(t))return S(t)}else if(Vt(e)){let{expressions:n=[]}=e;for(let t of n)if(O(t))return S(t)}else if(W(e)){let{condition:n,truthyExpression:t,falsyExpression:o}=e;if(O(n))return S(n);if(O(t))return S(t);if(O(o))return S(o)}else if(Oe(e)){let{expressions:n=[]}=e;for(let t of n)if(O(t))return S(t)}},Pe=(e,n,t)=>{let{expressions:o=[]}=e;if(o.includes(n)){let i=o.indexOf(n);return o.splice(i,1,t),!0}else for(let i of o)if(Pe(i,n,t))return!0;return!1},O=e=>Q(e)?!0:W(e)?O(e.condition)||O(e.truthyExpression)||O(e.falsyExpression):Me(e)||Yt(e)?e.op===void 0||e.expressions.some(n=>O(n)):!1,mn=(e,n)=>{let t=S(e);t?t.expressions?t.expressions.push(n):console.warn("don't know how to treat targetExpression"):console.error("no target expression found")},C,I,$e=class{constructor(){T(this,C,void 0);T(this,I,[])}setCondition(n){if(u(this,C)===void 0)this.addExpression(new pe(n));else if(W(u(this,C))){if(O(u(this,C).condition)){let t=n?new X(n):new H;this.addExpression(t)}else if(Q(u(this,C).truthyExpression))u(this,C).truthyExpression=new pe(n);else if(O(u(this,C).truthyExpression)){let t=n?new X(n):new H;this.addExpression(t)}else if(Q(u(this,C).falsyExpression))u(this,C).falsyExpression=new pe(n);else if(O(u(this,C).falsyExpression)){let t=n?new X(n):new H;this.addExpression(t)}}else console.error("setCondition called unexpectedly")}addExpression(n){if(u(this,I).length>0){let t=u(this,I).at(-1);t==null||t.arguments.push(n)}else if(u(this,C)===void 0)F(this,C,n);else if(Oe(u(this,C))){let t=S(u(this,C));t&&Q(t)&&Pe(u(this,C),t,n)}else if(W(u(this,C))&&O(u(this,C))){let t=S(u(this,C));t&&Q(t)?Pe(u(this,C),t,n):t&&mn(t,n)}}setFunction(n){let t=new Be(n);this.addExpression(t),u(this,I).push(t)}setColumn(n){this.addExpression(new Le(n))}setArithmeticOp(n){let t=n,o=u(this,C);Oe(o)&&(o.op=t)}setRelationalOperator(n){let t=n;if(u(this,C)&&W(u(this,C))){let o=S(u(this,C));Me(o)?o.op=t:console.error(`no target expression found (op = ${n})`)}}setValue(n){let t=new Qe(n);if(u(this,C)===void 0)F(this,C,t);else if(Oe(u(this,C)))this.addExpression(t);else if(Xt(u(this,C)))u(this,C).arguments.push(t);else if(W(u(this,C)))if(O(u(this,C))){let o=S(u(this,C));o&&Q(o)?Pe(u(this,C),o,t):o&&mn(o,t)}else console.log("what do we do with value, in a complete expression")}closeBrace(){u(this,I).pop()}get expression(){return u(this,C)}toJSON(){var n;return(n=u(this,C))==null?void 0:n.toJSON()}};C=new WeakMap,I=new WeakMap;var dn=(e,n)=>{let t=new $e,o=e.cursor();do{let{name:i,from:r,to:s}=o;switch(i){case"AndCondition":t.setCondition("and");break;case"OrCondition":t.setCondition("or");break;case"RelationalExpression":t.setCondition();break;case"ArithmeticExpression":t.addExpression(new Ie);break;case"Column":{let p=n.substring(r,s);t.setColumn(p)}break;case"Function":{let p=n.substring(r,s);t.setFunction(p)}break;case"Times":case"Divide":case"Plus":case"Minus":{let p=n.substring(r,s);t.setArithmeticOp(p)}break;case"RelationalOperator":{let p=n.substring(r,s);t.setRelationalOperator(p)}break;case"False":case"True":{let p=n.substring(r,s);t.setValue(p==="true")}break;case"String":t.setValue(n.substring(r+1,s-1));break;case"Number":t.setValue(parseFloat(n.substring(r,s)));break;case"CloseBrace":t.closeBrace();break;default:}}while(o.next());return t.toJSON()};var zt=Ee.configure({strict:!0}),gn=["Number","String"],Ue=[...gn,"AndCondition","ArithmeticExpression","BooleanOperator","RelationalOperatorOperator","CallExpression","CloseBrace","Column","Comma","ConditionalExpression","Divide","Equal","If","Minus","OpenBrace","OrCondition","ParenthesizedExpression","Plus","RelationalExpression","RelationalOperator","Times"],fn=e=>{try{return zt.parse(e),!0}catch{return!1}},Ge=e=>{let{lastChild:n}=e;for(;n&&!Ue.includes(n.name);)n=n.prevSibling,console.log(n==null?void 0:n.name);return n},Cn=e=>{if((e==null?void 0:e.name)==="RelationalExpression"){let{firstChild:n}=e,t=Ge(e);if((n==null?void 0:n.name)==="Column"&&typeof(t==null?void 0:t.name)=="string"&&gn.includes(t.name))return!0}return!1};import{HighlightStyle as Zt,syntaxHighlighting as Jt,tags as xn}from"@vuu-ui/vuu-codemirror";var qt=Zt.define([{tag:xn.variableName,color:"var(--vuuFilterEditor-variableColor)"},{tag:xn.comment,color:"green",fontStyle:"italic"}]),hn=Jt(qt);import{EditorView as _t}from"@vuu-ui/vuu-codemirror";var bn=_t.theme({"&":{border:"solid 1px var(--salt-container-primary-borderColor)",color:"var(--vuuFilterEditor-color)",backgroundColor:"var(--vuuFilterEditor-background)"},".cm-content":{caretColor:"var(--vuuFilterEditor-cursorColor)"},"&.cm-focused .cm-cursor":{borderLeftColor:"var(--vuuFilterEditor-cursorColor)"},"&.cm-focused .cm-selectionBackground, ::selection":{backgroundColor:"var(--vuuFilterEditor-selectionBackground)"},".cm-selectionBackground, ::selection":{backgroundColor:"var(--vuuFilterEditor-selectionBackground)"},".cm-scroller":{fontFamily:"var(--vuuFilterEditor-fontFamily)"},".cm-tooltip":{background:"var(--vuuFilterEditor-tooltipBackground)",border:"var(--vuuFilterEditor-tooltipBorder)",boxShadow:"var(--vuuFilterEditor-tooltipElevation)","&.cm-tooltip-autocomplete > ul":{fontFamily:"var(--vuuFilterEditor-fontFamily)",fontSize:"var(--vuuFilterEditor-fontSize)",maxHeight:"240px"},"&.cm-tooltip-autocomplete > ul > li":{height:"var(--vuuFilterEditor-suggestion-height)",padding:"0 3px",lineHeight:"var(--vuuFilterEditor-suggestion-height)"},"&.cm-tooltip-autocomplete li[aria-selected]":{background:"var(--vuuFilterEditor-suggestion-selectedBackground)",color:"var(--vuuFilterEditor-suggestion-selectedColor)"},"&.cm-tooltip-autocomplete li .cm-completionDetail":{color:"var(--vuuFilterEditor-suggestion-detailColor)"}}},{dark:!1});import{booleanJoinSuggestions as Kt,getNamedParentNode as yn,getPreviousNode as jt,getValue as A,syntaxTree as eo}from"@vuu-ui/vuu-codemirror";import{useCallback as En}from"react";var no=(e,n)=>n?e.map(t=>{var o;return{...t,apply:typeof t.apply=="function"?t.apply:`${n}${(o=t.apply)!=null?o:t.label}`}}):e,to=e=>e===void 0?!1:["Times","Divide","Plus","Minus"].includes(e.name),Z=(e,n)=>{var i;let{lastChild:t}=e,{pos:o}=n;for(;t;)if(t.from<o&&Ue.includes(t.name)){if(t.name==="ParenthesizedExpression"){let s=(i=t.firstChild)==null?void 0:i.nextSibling;s&&(t=s)}return t}else t=t.prevSibling},vn=(e,n)=>{var t;if(e.name==="ArgList"){let o=e.prevSibling;if(o)return A(o,n)}else if(e.name==="OpenBrace"){let o=(t=e.parent)==null?void 0:t.prevSibling;if((o==null?void 0:o.name)==="Function")return A(o,n)}},On=(e,n)=>{if(e.name==="RelationalExpression"){let t=Ge(e);if((t==null?void 0:t.name)==="RelationalOperator")return A(t,n)}else{let t=e.prevSibling;if((t==null?void 0:t.name)==="RelationalOperator")return A(t,n)}},Xe=(e,n)=>{var t;if(e.name==="RelationalExpression"){if(((t=e.firstChild)==null?void 0:t.name)==="Column")return A(e.firstChild,n)}else{let o=e.prevSibling;if((o==null?void 0:o.name)==="Column")return A(o,n);if((o==null?void 0:o.name)==="RelationalOperator")return Xe(o,n)}},We=async(e,n,t,o={})=>{let i=await n.getSuggestions(t,o),{startsWith:r=""}=o;return{from:e.pos-r.length,options:i}},He=(e,n,t,o,i)=>{let r=Z(e,n);switch(console.log(`conditional expression last child ${r==null?void 0:r.name}`),r==null?void 0:r.name){case"If":return We(n,t,"expression",{prefix:"( "});case"OpenBrace":return We(n,t,"expression");case"Condition":return We(n,t,"expression",{prefix:", "});case"CloseBrace":if(o){let s=[{apply:()=>{i==null||i()},label:"Save Expression",boost:10}];return{from:n.pos,options:s}}}},oo=(e,n)=>{let t=[{apply:()=>{n==null||n()},label:"Save Expression",boost:10}];return{from:e.pos,options:t}},Pn=(e,n)=>{let t=En(async(o,i,r={})=>{let s=await e.getSuggestions(i,r),{startsWith:p=""}=r;return{from:o.pos-p.length,options:s}},[e]);return En(async o=>{var x,h;let{state:i,pos:r}=o,s=(x=o.matchBefore(/\w*/))!=null?x:{from:0,to:0,text:void 0},l=eo(i).resolveInner(r,-1),c=i.doc.toString(),g=fn(c);switch(console.log({nodeBeforeName:l.name}),l.name){case"If":return console.log("conditional expression If"),t(o,"expression",{prefix:"( "});case"Condition":{let a=Z(l,o);if((a==null?void 0:a.name)==="Column"){let d=jt(a);if((d==null?void 0:d.name)!=="RelationalOperator")return t(o,"condition-operator",{columnName:A(a,i)});console.log(`Condition last child Column, prev child ${d==null?void 0:d.name}`)}else if((a==null?void 0:a.name)==="RelationalOperator")return t(o,"expression");console.log(`condition last child ${a==null?void 0:a.name}`)}break;case"ConditionalExpression":return He(l,o,e);case"RelationalExpression":{if(Cn(l))return{from:o.pos,options:Kt.concat({label:", <truthy expression>, <falsy expression>",apply:", "})};{let a=On(l,i),d=Xe(l,i);if(a)return t(o,"expression");{let f=await e.getSuggestions("condition-operator",{columnName:d});return{from:o.pos,options:f}}}}break;case"RelationalOperator":return t(o,"expression");case"String":{let a=On(l,i),d=Xe(l,i),{from:f,to:m}=l;if(m-f===2&&o.pos===f+1){if(d&&a)return t(o,"columnValue",{columnName:d,operator:a,startsWith:s.text})}else if(m-f>2&&o.pos===m)return t(o,"expression",{prefix:", "});console.log(`we have a string, column is ${d} ${f} ${m}`)}break;case"ArithmeticExpression":{let a=Z(l,o);if((a==null?void 0:a.name)==="Column")return t(o,"expression");if(to(a)){let d=a.name;return t(o,"column",{operator:d})}}break;case"OpenBrace":{let a=vn(l,i);return t(o,"expression",{functionName:a})}break;case"ArgList":{let a=vn(l,i),d=Z(l,o),f=(d==null?void 0:d.name)==="OpenBrace"?void 0:",",m=await e.getSuggestions("expression",{functionName:a});return m=f?no(m,", "):m,(d==null?void 0:d.name)!=="OpenBrace"&&(d==null?void 0:d.name)!=="Comma"&&(m=[{apply:") ",boost:10,label:"Done - no more arguments"}].concat(m)),{from:o.pos,options:m}}case"Equal":if(c.trim()==="=")return t(o,"expression");break;case"ParenthesizedExpression":case"ColumnDefinitionExpression":if(o.pos===0)return t(o,"expression");{let a=Z(l,o);if((a==null?void 0:a.name)==="Column"){if(g){let d=[{apply:()=>{n.current()},label:"Save Expression",boost:10}],f=A(a,i),m=await e.getSuggestions("operator",{columnName:f});return{from:o.pos,options:d.concat(m)}}}else if((a==null?void 0:a.name)==="CallExpression"){if(g){let d=[{apply:()=>{n.current()},label:"Save Expression",boost:10}];return{from:o.pos,options:d}}}else if((a==null?void 0:a.name)==="ArithmeticExpression"){if(g){let d=[{apply:()=>{n.current()},label:"Save Expression",boost:10}],f=Z(a,o);if((f==null?void 0:f.name)==="Column"){let m=A(f,i),b=await e.getSuggestions("operator",{columnName:m});d=d.concat(b)}return{from:o.pos,options:d}}}else if((a==null?void 0:a.name)==="ConditionalExpression")return He(a,o,e,g,n.current);break}case"Column":if(await e.isPartialMatch("expression",void 0,s.text))return t(o,"expression",{startsWith:s.text});break;case"Comma":{let a=yn(l);if((a==null?void 0:a.name)==="ConditionalExpression")return t(o,"expression")}break;case"CloseBrace":{let a=yn(l);if((a==null?void 0:a.name)==="ConditionalExpression")return He(a,o,e,g,n.current);if((a==null?void 0:a.name)==="ArgList"&&g)return oo(o,n.current);console.log(`does closebrace denote an ARgList or a parenthetised expression ? ${a}`)}break;default:((h=l==null?void 0:l.prevSibling)==null?void 0:h.name)==="FilterClause"&&console.log("looks like we ight be a or|and operator")}},[t,n,e])};var de=e=>{if(e.current==null)throw Error("EditorView not defined");return e.current},uo=()=>"vuuSuggestion",mo=()=>console.log("noooop"),go=e=>"expressionType"in e,fo=e=>{if(go(e)){let n=Dn("div","expression-type-container"),t=Dn("span","expression-type",e.expressionType);return n.appendChild(t),n}else return null},wn=({onChange:e,onSubmitExpression:n,suggestionProvider:t})=>{let o=Ye(null),i=Ye(mo),r=Ye(),s=Pn(t,i),[p,l]=co(()=>{let c=()=>{let f=de(r),m=f.state.doc.toString(),b=ao(f.state,f.state.doc.length,5e3);if(b){let P=dn(b,m);return[m,P]}else return["",void 0]},g=()=>{de(r).setState(d())},x=()=>{let[f,m]=c();n==null||n(f,m),g()},h=f=>Ve.of([{key:f,run(){return x(),!0}}]),a=f=>Ve.of([{key:f,run(){return Tn(de(r)),!0}}]),d=()=>io.create({doc:"",extensions:[lo,ro({addToOptions:[{render:fo,position:70}],override:[s],optionClass:uo}),un(),Ve.of(so),h("Ctrl-Enter"),a("ArrowDown"),Sn.updateListener.of(f=>{let m=de(r);if(f.docChanged){Tn(m);let b=m.state.doc.toString();e==null||e(b,void 0)}}),bn,hn]});return i.current=()=>{x(),setTimeout(()=>{de(r).focus()},100)},[d,g]},[s,e,n]);return po(()=>{if(!o.current)throw Error("editor not in dom");return r.current=new Sn({state:p(),parent:o.current}),()=>{var c;(c=r.current)==null||c.destroy()}},[s,p]),{editorRef:o,clearInput:l}};import{jsx as xo}from"react/jsx-runtime";var Co="vuuColumnExpressionInput",Rn=({onChange:e,onSubmitExpression:n,suggestionProvider:t})=>{let{editorRef:o}=wn({onChange:e,onSubmitExpression:n,suggestionProvider:t});return xo("div",{className:`${Co}`,ref:o})};import{AnnotationType as ho,getRelationalOperators as bo,numericOperators as yo,stringOperators as Eo,toSuggestions as vo}from"@vuu-ui/vuu-codemirror";import{getTypeaheadParams as Oo,useTypeaheadSuggestions as Po}from"@vuu-ui/vuu-data-react";import{isNumericColumn as Ze,isTextColumn as So}from"@vuu-ui/vuu-utils";import{useCallback as ze,useRef as To}from"react";var J=[{accepts:"string",description:"Returns multiple string values as a single joined string. Arguments may be string literal values, string columns or other string expressions. Non string arguments may also be included, these will be converted to strings.",example:{expression:'concatenate("example", "-test")',result:'"example-test"'},name:"concatenate",params:{description:"( string, string, [ string* ] )"},type:"string"},{accepts:["string","string"],description:"Tests a string value to determine whether it contains a given substring. Accepts two arguments: source text and target substring. Returns true if <source text> contains one or more occurrences of <target subscring>",example:{expression:'contains("Royal Bank of Scotland", "bank")',result:"true"},name:"contains",params:{description:"( string )"},type:"boolean"},{accepts:["string","number"],description:"Returns the leftmost <number> characters from <string>. First argument may be a string literal, string column or other string expression.",example:{expression:'left("USD Benchmark Report", 3)',result:'"USD"'},name:"left",params:{count:2,description:"( string, number )"},type:"string"},{accepts:"string",description:"Returns the number of characters in <string>. Argument may be a string literal, string column or other string expression.",example:{expression:'len("example")',result:"7"},name:"len",params:{description:"(string)"},type:"number"},{accepts:"string",description:"Convert a string value to lowercase. Argument may be a string column or other string expression.",example:{expression:'lower("examPLE")',result:'"example"'},name:"lower",params:{description:"( string )"},type:"string"},{accepts:"string",description:"Convert a string value to uppercase. Argument may be a string column or other string expression.",example:{expression:'upper("example")',result:'"EXAMPLE"'},name:"upper",params:{description:"( string )"},type:"string"},{accepts:["string","number"],description:"Returns the rightmost <number> characters from <string>. First argument may be a string literal, string column or other string expression.",example:{expression:"blah",result:"blah"},name:"right",params:{description:"( string )"},type:"string"},{accepts:["string","string","string"],description:"Replace characters within a string. Accepts three arguments: source text, text to replace and replacement text. Returns a copy of <source text> with any occurrences of <text to replace> replaced by <replacement text>",example:{expression:"blah",result:"blah"},name:"replace",params:{description:"( string )"},type:"string"},{accepts:"number",description:"Converts a number to a string.",example:{expression:"blah",result:"blah"},name:"text",params:{description:"( string )"},type:"string"},{accepts:"string",description:"Tests a string value to determine whether it starts with a given substring. Accepts two arguments: source text and target substring. Returns true if <source text> starts with <target subscring>.",example:{expression:"blah",result:"blah"},name:"starts",params:{description:"( string )"},type:"boolean"},{accepts:"string",description:"Tests a string value to determine whether it ends with a given substring. Accepts two arguments: source text and target substring. Returns true if <source text> ends with <target subscring>.",example:{expression:"blah",result:"blah"},name:"ends",params:{description:"( string )"},type:"boolean"},{accepts:"number",description:"blah",example:{expression:"blah",result:"blah"},name:"min",params:{description:"( string )"},type:"number"},{accepts:"number",description:"blah",example:{expression:"blah",result:"blah"},name:"max",params:{description:"( string )"},type:"number"},{accepts:"number",description:"blah",example:{expression:"blah",result:"blah"},name:"sum",params:{description:"( string )"},type:"number"},{accepts:"number",description:"blah",example:{expression:"blah",result:"blah"},name:"round",params:{description:"( string )"},type:"number"},{accepts:"any",description:"blah",example:{expression:"blah",result:"blah"},name:"or",params:{description:"( string )"},type:"boolean"},{accepts:"any",description:"blah",example:{expression:"blah",result:"blah"},name:"and",params:{description:"( string )"},type:"boolean"},{accepts:"any",description:"Return one of two possible result values, depending on the evaluation of a filter expression. If <filterExpression> resolves to true, result is <expression1>, otherwise <expression2>. ",example:{expression:"blah",result:"blah"},name:"if",params:{description:"( filterExpression, expression1, expression 2)"},type:"variable"}];import{createEl as N}from"@vuu-ui/vuu-utils";var An=({name:e,description:n,example:t,params:o,type:i})=>{let r=N("div","vuuFunctionDoc"),s=N("div","function-heading"),p=N("span","function-name",e),l=N("span","param-list",o.description),c=N("span","function-type",i);s.appendChild(p),s.appendChild(l),s.appendChild(c);let g=N("p",void 0,n);if(r.appendChild(s),r.appendChild(g),t){let x=N("div","example-container","Example:"),h=N("div","example-expression",t.expression),a=N("div","example-result",t.result);x.appendChild(h),x.appendChild(a),r.appendChild(x)}return r};var Do=[],B=e=>e.map(n=>{var t;return{...n,apply:((t=n.apply)!=null?t:n.label)+" "}}),wo=(e,{functionName:n,operator:t})=>{if(t)return e.filter(Ze);if(n){let o=J.find(i=>i.name===n);if(o)switch(o.accepts){case"string":return e.filter(So);case"number":return e.filter(Ze);default:return e}}return e},Nn=(e,n)=>wo(e,n).map(o=>{var r;let i=(r=o.label)!=null?r:o.name;return{apply:n.prefix?`${n.prefix}${i}`:i,label:i,boost:5,type:"column",expressionType:o.serverDataType}}),Ro=[{apply:"* ",boost:2,label:"*",type:"operator"},{apply:"/ ",boost:2,label:"/",type:"operator"},{apply:"+ ",boost:2,label:"+",type:"operator"},{apply:"- ",boost:2,label:"-",type:"operator"}],Ao=e=>e===void 0||Ze(e)?Ro:Do,No=e=>{switch(e.serverDataType){case"string":case"char":return B(Eo);case"int":case"long":case"double":return B(yo)}},Je=e=>({apply:`${e.name}( `,boost:2,expressionType:e.type,info:()=>An(e),label:e.name,type:"function"}),ko=e=>{if(e){if(typeof e.accepts=="string")return e.accepts;if(Array.isArray(e.accepts))return e.accepts.every(n=>n==="string")?"string":"any"}return"any"},Fo=J.map(Je),Qo=({functionName:e})=>{if(e){let n=J.find(o=>o.name===e),t=ko(n);if(n)switch(t){case"string":return J.filter(o=>o.type==="string"||o.type==="variable").map(Je);case"number":return J.filter(o=>o.type==="number"||o.type==="variable").map(Je);default:}}return Fo},Lo={},kn=({columns:e,table:n})=>{let t=ze(p=>p?e.find(l=>l.name===p):void 0,[e]),o=To(),i=Po(),r=ze(async(p,l=Lo)=>{let{columnName:c,functionName:g,operator:x,prefix:h}=l;switch(p){case"expression":{let a=await B(Nn(e,{functionName:g,prefix:h})).concat(Qo(l));return o.current=a}case"column":{let a=await Nn(e,l);return o.current=B(a)}case"operator":{let a=await Ao(t(c));return o.current=B(a)}case"relational-operator":{let a=await bo(t(c));return o.current=B(a)}case"condition-operator":{let a=t(c);if(a){let d=await No(a);if(d)return o.current=B(d)}}break;case"columnValue":if(c&&x){let a=Oo(n,c),d=await i(a);return o.current=vo(d,{suffix:""}),o.current.forEach(f=>{f.apply=(m,b,P)=>{let w=new ho,ie=P+b.label.length+1;m.dispatch({changes:{from:P,insert:b.label},selection:{anchor:ie,head:ie},annotations:w.of(b)})}}),o.current}break}return[]},[e,t,i,n]),s=ze(async(p,l,c)=>{let{current:g}=o,x=!1,h=g||await r(p,{columnName:l});if(c&&h)for(let a of h){if(a.label===c)return!1;a.label.startsWith(c)&&(x=!0)}return x},[r]);return{getSuggestions:r,isPartialMatch:s}};import{Button as tn,Panel as Ir}from"@salt-ds/core";import Br from"classnames";import{useCallback as xe,useState as et}from"react";import{List as Qn}from"@heswell/salt-lab";import{Button as ge,Text as Ln,useIdMemo as Mo}from"@salt-ds/core";import{useCallback as $,useState as Uo}from"react";import{ListItem as Io}from"@heswell/salt-lab";import Bo from"classnames";import{jsx as qe,jsxs as $o}from"react/jsx-runtime";var q="vuuColumnListItem",Fn=({className:e,item:n,label:t,style:o,...i})=>{let r=Bo(q,e,{[`${q}-calculated`]:n==null?void 0:n.expression,[`${q}-hidden`]:n==null?void 0:n.hidden});return $o(Io,{className:r,...i,children:[qe("span",{className:`${q}-iconType`}),qe("label",{className:`${q}-label`,children:t}),qe("span",{className:`${q}-iconHidden`})]})};import{jsx as v,jsxs as K}from"react/jsx-runtime";var _="vuuColumnPicker",Go=(e,n)=>e.filter(t=>n.find(o=>o.name===t.name)==null),In=({availableColumns:e,id:n,dispatchColumnAction:t,onAddCalculatedColumnClick:o,onSelectionChange:i,chosenColumns:r,selectedColumn:s})=>{let[p,l]=Uo([]),c=Mo(n),g=Go(e,r),x=$(()=>{p.length>0&&(l([]),t({type:"addColumn",columns:p}))},[t,p]),h=$(()=>s&&t({type:"removeColumn",column:s}),[s,t]),a=$(()=>s&&t({type:"moveColumn",column:s,moveBy:-1}),[t,s]),d=$(()=>s&&t({type:"moveColumn",column:s,moveBy:1}),[t,s]),f=$((P,w)=>l(w),[]),m=$((P,w)=>i==null?void 0:i(w),[i]),b=$((P,w)=>{t({type:"moveColumn",moveFrom:P,moveTo:w})},[t]);return K("div",{className:_,id:c,children:[K("div",{className:`${_}-listColumn`,children:[v("label",{htmlFor:`available-${c}`,children:v(Ln,{as:"h4",children:"Available Columns"})}),v("div",{className:`${_}-listContainer`,style:{flex:1,overflow:"hidden"},children:v(Qn,{borderless:!0,checkable:!1,height:"100%",id:`available-${c}`,itemHeight:24,itemToString:P=>P.name,onSelectionChange:f,selected:p,selectionStrategy:"extended",source:g})}),v("div",{style:{display:"flex",alignItems:"center",flex:"0 0 32px",marginTop:"var(--salt-size-basis-unit)"},children:K(ge,{onClick:x,disabled:p.length===0,children:["Show",v("span",{"data-icon":"arrow-thin-right",style:{marginLeft:8}})]})})]}),K("div",{className:`${_}-listColumn`,children:[v("label",{htmlFor:`selected-${c}`,children:v(Ln,{as:"h4",children:"Included Columns"})}),v("div",{className:`${_}-listContainer`,style:{flex:1,overflow:"hidden"},children:v(Qn,{ListItem:Fn,allowDragDrop:!0,borderless:!0,height:"100%",id:`selected-${c}`,itemHeight:24,itemToString:P=>P.name,onMoveListItem:b,onSelectionChange:m,selected:s,style:{flex:1},source:r})}),K("div",{style:{alignItems:"center",flex:"0 0 32px",display:"flex",gap:6,marginTop:"var(--salt-size-basis-unit)"},children:[K(ge,{onClick:h,disabled:s===null,children:[v("span",{"data-icon":"arrow-thin-left",style:{marginRight:8}}),"Hide"]}),v(ge,{"aria-label":"Move column up",onClick:a,disabled:s===null||(r==null?void 0:r.indexOf(s))===0,style:{width:28},children:v("span",{"data-icon":"arrow-thin-up"})}),v(ge,{"aria-label":"Move column down",onClick:d,disabled:s===null||r.indexOf(s)===r.length-1,style:{width:28},children:v("span",{"data-icon":"arrow-thin-down"})}),v(ge,{"aria-label":"Add calculated column",className:`${_}-addCalculatedColumn`,onClick:o,variant:"primary",children:v("span",{"data-icon":"add"})})]})]})]})};import{Stack as sr}from"@vuu-ui/vuu-layout";import{Checkbox as ir,FormField as M,Input as Ke,RadioButton as fe,RadioButtonGroup as Xn,StepperInput as ar}from"@heswell/salt-lab";import{Panel as Vn,Text as lr}from"@salt-ds/core";import pr from"classnames";import{useCallback as ee,useState as cr}from"react";import{getRegisteredCellRenderers as qo}from"@vuu-ui/vuu-utils";import{Dropdown as _o}from"@heswell/salt-lab";import{Panel as Ko}from"@salt-ds/core";import Gn from"classnames";import{useMemo as jo}from"react";import{FormField as Wo,StepperInput as Ho,Switch as Bn}from"@heswell/salt-lab";import{Text as Xo}from"@salt-ds/core";import{useCallback as Se}from"react";import{Fragment as $n,jsx as j,jsxs as zo}from"react/jsx-runtime";var Vo={alignOnDecimals:!1,decimals:4,zeroPad:!1},Yo=(e,n)=>{let t=typeof e=="object"&&e.formatting?e.formatting:{};return["alignOnDecimals","decimals","zeroPad"].reduce((i,r)=>t[r]!==void 0?{...i,[r]:t[r]}:(n==null?void 0:n[r])!==void 0?{...i,[r]:n[r]}:i,Vo)},Mn=({column:e,dispatchColumnAction:n})=>{let{decimals:t,alignOnDecimals:o,zeroPad:i}=Yo(e==null?void 0:e.type),r=Se(c=>n({type:"updateColumnTypeFormatting",column:e,...c}),[e,n]),s=Se(c=>r({decimals:parseInt(c.toString(),10)}),[r]),p=Se((c,g)=>r({alignOnDecimals:g}),[r]),l=Se((c,g)=>r({zeroPad:g}),[r]);switch(e.serverDataType){case"double":return zo($n,{children:[j(Wo,{label:"No of Decimals",labelPlacement:"top",children:j(Ho,{value:t,onChange:s})}),j(Bn,{checked:o,label:"Align on decimals",LabelProps:{className:"vuuColumnPanelSwitch"},onChange:p}),j(Bn,{checked:i,label:"Zero pad",LabelProps:{className:"vuuColumnPanelSwitch"},onChange:l})]});case"long":case"int":return j($n,{children:j(Xo,{children:"Work in progress"})});default:return null}};import{Fragment as Zo,jsx as Jo}from"react/jsx-runtime";var Un=({column:e,dispatchColumnAction:n})=>(console.log({column:e,dispatchColumnAction:n}),Jo(Zo,{children:"what"}));import{Fragment as or,jsx as Te,jsxs as rr}from"react/jsx-runtime";var _e="vuuColumnTypePanel",er=["Default Renderer (int, long)"],nr=["Default Renderer (double)"],Wn=["Default Renderer (string)"],tr=e=>{let t=qo(e.serverDataType).map(o=>o.name);switch(console.log({customRendererNames:t}),e.serverDataType){case"char":case"string":return Wn;case"int":case"long":return er;case"double":return nr.concat(t);default:return Wn}},Hn=({className:e,column:n,dispatchColumnAction:t,...o})=>{let i=jo(()=>{switch(n.serverDataType){case"double":case"int":case"long":return Te(Mn,{column:n,dispatchColumnAction:t});default:return Te(Un,{column:n,dispatchColumnAction:t})}},[n,t]),{serverDataType:r="string"}=n,s=tr(n);return rr(or,{children:[Te(_o,{className:Gn(`${_e}-renderer`),fullWidth:!0,selected:s[0],source:s}),Te(Ko,{...o,className:Gn(_e,e,`${_e}-${r}`),children:i})]})};import{jsx as y,jsxs as ne}from"react/jsx-runtime";var Yn="vuuColumnSettingsPanel",ur={className:"salt-density-high"},zn=()=>null,Zn=({column:e,dispatchColumnAction:n,style:t,...o})=>{var h,a,d,f;let[i,r]=cr(0),s=ee(m=>n({type:"updateColumnProp",column:e,...m}),[e,n]),p=ee(m=>s({align:m.target.value}),[s]),l=ee(m=>s({pin:m.target.value}),[s]),c=ee((m,b)=>s({hidden:b}),[s]),g=ee((m,b)=>s({label:b}),[s]),x=ee(m=>s({width:parseInt(m.toString(),10)}),[s]);return ne("div",{className:Yn,...o,style:{...t},children:[y(lr,{as:"h4",children:"Column Settings"}),ne(sr,{active:i,showTabs:!0,className:pr(`${Yn}-columnTabs`),onTabSelectionChanged:r,TabstripProps:ur,children:[ne(Vn,{title:"Column",children:[y(M,{label:"Hidden",labelPlacement:"left",children:y(ir,{checked:e.hidden===!0,onChange:c})}),y(M,{label:"Label",labelPlacement:"left",children:y(Ke,{value:(h=e.label)!=null?h:e.name,onChange:g})}),y(M,{label:"Width",labelPlacement:"left",children:y(ar,{value:(a=e.width)!=null?a:100,onChange:x})}),y(M,{label:"Align",labelPlacement:"left",ActivationIndicatorComponent:zn,children:ne(Xn,{"aria-label":"Column Align",value:(d=e.align)!=null?d:"left",legend:"Align",onChange:p,children:[y(fe,{label:"Left",value:"left"}),y(fe,{label:"Right",value:"right"})]})}),y(M,{label:"Pin Column",labelPlacement:"left",ActivationIndicatorComponent:zn,children:ne(Xn,{"aria-label":"Pin Column",value:(f=e.pin)!=null?f:"",legend:"Pin Column",onChange:l,children:[y(fe,{label:"Do not pin",value:""}),y(fe,{label:"Left",value:"left"}),y(fe,{label:"Right",value:"right"})]})})]}),y(Hn,{column:e,dispatchColumnAction:n,title:"Data Cell"}),ne(Vn,{title:"Vuu",variant:"secondary",children:[y(M,{label:"Name",labelPlacement:"top",readOnly:!0,variant:"secondary",children:y(Ke,{value:e.name})}),y(M,{label:"Vuu type",labelPlacement:"top",readOnly:!0,variant:"secondary",children:y(Ke,{value:e.serverDataType})})]})]})]})};import{FormField as Jn,RadioButton as je,RadioButtonGroup as mr,StepperInput as dr}from"@heswell/salt-lab";import{Panel as gr,Text as fr}from"@salt-ds/core";import{useCallback as en}from"react";import{jsx as U,jsxs as nn}from"react/jsx-runtime";var Cr="vuuGridSettingsPanel",xr=()=>null,qn=({config:e,dispatchColumnAction:n,style:t,...o})=>{var p;let i=en(l=>n({type:"updateGridSettings",...l}),[n]),r=en(l=>i({columnFormatHeader:l.target.value}),[i]),s=en(l=>i({columnDefaultWidth:parseInt(l.toString(),10)}),[i]);return nn("div",{className:Cr,...o,style:{...t},children:[U(fr,{as:"h4",children:"Grid Settings"}),nn(gr,{children:[U(Jn,{label:"Format column labels",labelPlacement:"left",ActivationIndicatorComponent:xr,children:nn(mr,{"aria-label":"Format column labels",value:e.columnFormatHeader,legend:"Format column labels",onChange:r,children:[U(je,{label:"No Formatting",value:void 0}),U(je,{label:"Capitalize",value:"capitalize"}),U(je,{label:"Uppercase",value:"uppercase"})]})}),U(Jn,{label:"Default Column Width",labelPlacement:"left",children:U(dr,{value:(p=e.columnDefaultWidth)!=null?p:100,onChange:s})})]})]})};import{useReducer as hr}from"react";import{moveItem as br}from"@heswell/salt-lab";import{fromServerDataType as yr}from"@vuu-ui/vuu-utils";var Er=(e,n)=>{switch(console.log(`gridSettingsReducer ${n.type}`),n.type){case"addColumn":return vr(e,n);case"addCalculatedColumn":return Or(e,n);case"moveColumn":return Sr(e,n);case"removeColumn":return Pr(e,n);case"updateColumn":return e;case"updateColumnProp":return Tr(e,n);case"updateGridSettings":return Dr(e,n);case"updateColumnTypeFormatting":return wr(e,n);default:return e}},_n=e=>{let[n,t]=hr(Er,e);return{gridSettings:n,dispatchColumnAction:t}};function vr(e,{column:n,columns:t,index:o=-1}){let{columns:i}=e;if(o===-1){if(Array.isArray(t))return{...e,columns:i.concat(t)};if(n)return{...e,columns:i.concat(n)}}return e}function Or(e,{columnName:n,columnType:t,expression:o}){let{columns:i}=e,r={name:n,expression:o,serverDataType:t};return{...e,columns:i.concat(r)}}function Pr(e,{column:n}){let{columns:t}=e;return{...e,columns:t.filter(o=>o.name!==n.name)}}function Sr(e,{column:n,moveBy:t,moveFrom:o,moveTo:i}){let{columns:r}=e;if(n&&typeof t=="number"){let s=r.indexOf(n),p=r.slice(),[l]=p.splice(s,1);return p.splice(s+t,0,l),{...e,columns:p}}else return typeof o=="number"&&typeof i=="number"?{...e,columns:br(r,o,i)}:e}function Tr(e,{align:n,column:t,hidden:o,label:i,width:r}){let{columns:s}=e;return(n==="left"||n==="right")&&(s=Ce(s,{...t,align:n})),typeof o=="boolean"&&(s=Ce(s,{...t,hidden:o})),typeof i=="string"&&(s=Ce(s,{...t,label:i})),typeof r=="number"&&(s=Ce(s,{...t,width:r})),{...e,columns:s}}function Dr(e,{columnFormatHeader:n}){return{...e,columnFormatHeader:n!=null?n:e.columnFormatHeader}}function wr(e,{alignOnDecimals:n,column:t,decimals:o,zeroPad:i}){let{columns:r}=e;if(r.find(p=>p.name===t.name)){let{serverDataType:p="string",type:l=yr(p)}=t,c=typeof l=="string"?{name:l}:{...l};return typeof n=="boolean"&&(c.formatting={...c.formatting,alignOnDecimals:n}),typeof o=="number"&&(c.formatting={...c.formatting,decimals:o}),typeof i=="boolean"&&(c.formatting={...c.formatting,zeroPad:i}),{...e,columns:Ce(r,{...t,type:c})}}else return e}function Ce(e,n){return e.map(t=>t.name===n.name?n:t)}import{Stack as $r}from"@vuu-ui/vuu-layout";import{FormField as Rr,Input as Ar}from"@heswell/salt-lab";import{Button as Nr,Panel as kr,Text as Fr}from"@salt-ds/core";import{useCallback as De,useRef as Qr,useState as Kn}from"react";import{jsx as te,jsxs as Lr}from"react/jsx-runtime";var jn=({columns:e,dispatchColumnAction:n,table:t})=>{let[o,i]=Kn(""),[,r]=Kn(),s=Qr(""),p=kn({columns:e,table:t}),l=De(h=>{let{value:a}=h.target;i(a)},[]),c=De(h=>{s.current=h},[]),g=De((h,a)=>{console.log({source:h}),r(a)},[]),x=De(()=>{s.current&&(console.log(`save expression ${JSON.stringify(s.current,null,2)}`),n({type:"addCalculatedColumn",columnName:o,expression:s.current,columnType:"string"}))},[o,n]);return Lr(kr,{className:"vuuCalculatedColumnPanel",title:"Define Computed Column",children:[te(Fr,{styleAs:"h4",children:"Define Computed Column"}),te(Rr,{label:"Column Name",labelPlacement:"left",children:te(Ar,{value:o,onChange:l})}),te(Rn,{onChange:c,onSubmitExpression:g,suggestionProvider:p}),te("div",{style:{marginTop:12},children:te(Nr,{onClick:x,children:"Add Column"})})]})};import{jsx as k,jsxs as Re}from"react/jsx-runtime";var we="vuuDatagridSettingsPanel",Mr=()=>{},Ur=["table-settings","column-chooser","column-settings","define-column"],Gr=(e,n)=>Ur[n],jl=({availableColumns:e,className:n,gridConfig:t,onCancel:o,onConfigChange:i,...r})=>{var ie;console.log("DatagridSettingsPanel render");let[s,p]=et(0),{gridSettings:l,dispatchColumnAction:c}=_n(t),[g,x]=et(null),h=xe(R=>{x(R?R.name:null)},[]),a=xe((R,dt=!1)=>{console.log("1) DataGridSettingsPanel fire onConfigChange"),i==null||i(l,dt)},[l,i]),d=xe(R=>{p(R)},[]),f=xe(R=>a(R,!0),[a]),m=g===null?null:(ie=l.columns.find(R=>R.name===g))!=null?ie:null,b={activeTabIndex:s,enableRenameTab:!1,orientation:"vertical"},P=xe(()=>p(3),[]),w=s===2?"right":void 0;return Re("div",{...r,className:Br(we,n),children:[Re($r,{TabstripProps:b,className:`${we}-stack`,getTabIcon:Gr,getTabLabel:Mr,active:s===2?1:s,onTabSelectionChanged:d,showTabs:!0,children:[k(qn,{config:l,dispatchColumnAction:c}),Re("div",{className:`${we}-columnPanels`,"data-align":w,children:[k(In,{availableColumns:e,chosenColumns:l.columns,dispatchColumnAction:c,onSelectionChange:h,onAddCalculatedColumnClick:P,selectedColumn:m}),m===null?k(Ir,{className:"vuuColumnSettingsPanel",children:"Select a column"}):k(Zn,{column:m,dispatchColumnAction:c,style:{background:"white",flex:"1 0 150px"}})]}),k("div",{title:"Column Settings",children:"Column Settings"}),k(jn,{columns:l.columns,dispatchColumnAction:c,table:{module:"SIMUL",table:"instruments"}})]}),Re("div",{className:`${we}-buttonBar`,children:[k(tn,{onClick:o,children:"Cancel"}),k(tn,{onClick:a,children:"Apply"}),k(tn,{onClick:f,children:"Save"})]})]})};import{useEffect as Wr,useState as nt}from"react";import Hr from"classnames";import{jsx as he,jsxs as Xr}from"react/jsx-runtime";var Ae="vuuDatasourceStats",on=new Intl.NumberFormat,mp=({className:e,dataSource:n})=>{let[t,o]=nt(n.range),[i,r]=nt(n.size);Wr(()=>{r(n.size),n.on("resize",r),n.on("range",o)},[n]);let s=Hr(Ae,e),p=on.format(t.from),l=on.format(t.to-1),c=on.format(i);return Xr("div",{className:s,children:[he("span",{children:"Showing rows"}),he("span",{className:`${Ae}-range`,children:p}),he("span",{className:`${Ae}-range`,children:l}),he("span",{children:"of"}),he("span",{className:`${Ae}-size`,children:c})]})};import{Stack as ls}from"@vuu-ui/vuu-layout";import{Checkbox as ps,FormField as G,Input as sn,RadioButton as be,RadioButtonGroup as pt,StepperInput as cs}from"@heswell/salt-lab";import{Panel as ct,Text as us}from"@salt-ds/core";import ms from"classnames";import{useCallback as re,useState as ds}from"react";import{getRegisteredCellRenderers as jr}from"@vuu-ui/vuu-utils";import{Dropdown as es}from"@heswell/salt-lab";import{Panel as ns}from"@salt-ds/core";import it from"classnames";import{useMemo as ts}from"react";import{FormField as Vr,StepperInput as Yr,Switch as tt}from"@heswell/salt-lab";import{Text as zr}from"@salt-ds/core";import{useCallback as Ne}from"react";import{Fragment as ot,jsx as oe,jsxs as qr}from"react/jsx-runtime";var Zr={alignOnDecimals:!1,decimals:4,zeroPad:!1},Jr=(e,n)=>{let t=typeof e=="object"&&e.formatting?e.formatting:{};return["alignOnDecimals","decimals","zeroPad"].reduce((i,r)=>t[r]!==void 0?{...i,[r]:t[r]}:(n==null?void 0:n[r])!==void 0?{...i,[r]:n[r]}:i,Zr)},rt=({column:e,dispatchColumnAction:n})=>{let{decimals:t,alignOnDecimals:o,zeroPad:i}=Jr(e==null?void 0:e.type),r=Ne(c=>n({type:"updateColumnTypeFormatting",column:e,...c}),[e,n]),s=Ne(c=>r({decimals:parseInt(c.toString(),10)}),[r]),p=Ne((c,g)=>r({alignOnDecimals:g}),[r]),l=Ne((c,g)=>r({zeroPad:g}),[r]);switch(e.serverDataType){case"double":return qr(ot,{children:[oe(Vr,{label:"No of Decimals",labelPlacement:"top",children:oe(Yr,{value:t,onChange:s})}),oe(tt,{checked:o,label:"Align on decimals",LabelProps:{className:"vuuColumnPanelSwitch"},onChange:p}),oe(tt,{checked:i,label:"Zero pad",LabelProps:{className:"vuuColumnPanelSwitch"},onChange:l})]});case"long":case"int":return oe(ot,{children:oe(zr,{children:"Work in progress"})});default:return null}};import{Fragment as _r,jsx as Kr}from"react/jsx-runtime";var st=({column:e,dispatchColumnAction:n})=>(console.log(e,n),Kr(_r,{children:"what"}));import{Fragment as is,jsx as ke,jsxs as as}from"react/jsx-runtime";var rn="vuuColumnTypePanel",os=["Default Renderer (int, long)"],rs=["Default Renderer (double)"],at=["Default Renderer (string)"],ss=e=>{let t=jr(e.serverDataType).map(o=>o.name);switch(console.log({customRendererNames:t}),e.serverDataType){case"char":case"string":return at;case"int":case"long":return os;case"double":return rs.concat(t);default:return at}},lt=({className:e,column:n,dispatchColumnAction:t,...o})=>{let i=ts(()=>{switch(n.serverDataType){case"double":case"int":case"long":return ke(rt,{column:n,dispatchColumnAction:t});default:return ke(st,{column:n,dispatchColumnAction:t})}},[n,t]),{serverDataType:r="string"}=n,s=ss(n);return as(is,{children:[ke(es,{className:it(`${rn}-renderer`),fullWidth:!0,selected:s[0],source:s}),ke(ns,{...o,className:it(rn,e,`${rn}-${r}`),children:i})]})};import{jsx as E,jsxs as se}from"react/jsx-runtime";var ut="vuuColumnSettingsPanel",gs={className:"salt-density-high"},mt=()=>null,ec=({column:e,dispatchColumnAction:n,style:t,...o})=>{var h,a,d,f;let[i,r]=ds(0),s=re(m=>n({type:"updateColumnProp",column:e,...m}),[e,n]),p=re(m=>s({align:m.target.value}),[s]),l=re(m=>s({pin:m.target.value}),[s]),c=re((m,b)=>s({hidden:b}),[s]),g=re((m,b)=>s({label:b}),[s]),x=re(m=>s({width:parseInt(m.toString(),10)}),[s]);return se("div",{className:ut,...o,style:{...t},children:[E(us,{as:"h4",children:"Column Settings"}),se(ls,{active:i,showTabs:!0,className:ms(`${ut}-columnTabs`),onTabSelectionChanged:r,TabstripProps:gs,children:[se(ct,{title:"Column",children:[E(G,{label:"Hidden",labelPlacement:"left",children:E(ps,{checked:e.hidden===!0,onChange:c})}),E(G,{label:"Label",labelPlacement:"left",children:E(sn,{value:(h=e.label)!=null?h:e.name,onChange:g})}),E(G,{label:"Width",labelPlacement:"left",children:E(cs,{value:(a=e.width)!=null?a:100,onChange:x})}),E(G,{label:"Align",labelPlacement:"left",ActivationIndicatorComponent:mt,children:se(pt,{"aria-label":"Column Align",value:(d=e.align)!=null?d:"left",legend:"Align",onChange:p,children:[E(be,{label:"Left",value:"left"}),E(be,{label:"Right",value:"right"})]})}),E(G,{label:"Pin Column",labelPlacement:"left",ActivationIndicatorComponent:mt,children:se(pt,{"aria-label":"Pin Column",value:(f=e.pin)!=null?f:"",legend:"Pin Column",onChange:l,children:[E(be,{label:"Do not pin",value:""}),E(be,{label:"Left",value:"left"}),E(be,{label:"Right",value:"right"})]})})]}),E(lt,{column:e,dispatchColumnAction:n,title:"Data Cell"}),se(ct,{title:"Vuu",variant:"secondary",children:[E(G,{label:"Name",labelPlacement:"top",readOnly:!0,variant:"secondary",children:E(sn,{value:e.name})}),E(G,{label:"Vuu type",labelPlacement:"top",readOnly:!0,variant:"secondary",children:E(sn,{value:e.serverDataType})})]})]})]})};export{Rn as ColumnExpressionInput,Ue as ColumnNamedTerms,ec as ColumnSettingsPanel,mp as DataSourceStats,jl as DatagridSettingsPanel,un as columnExpressionLanguageSupport,fn as isCompleteExpression,Cn as isCompleteRelationalExpression,Ge as lastNamedChild,wn as useColumnExpressionEditor,kn as useColumnExpressionSuggestionProvider,dn as walkTree};
1
+ var __accessCheck = (obj, member, msg) => {
2
+ if (!member.has(obj))
3
+ throw TypeError("Cannot " + msg);
4
+ };
5
+ var __privateGet = (obj, member, getter) => {
6
+ __accessCheck(obj, member, "read from private field");
7
+ return getter ? getter.call(obj) : member.get(obj);
8
+ };
9
+ var __privateAdd = (obj, member, value) => {
10
+ if (member.has(obj))
11
+ throw TypeError("Cannot add the same private member more than once");
12
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
13
+ };
14
+ var __privateSet = (obj, member, value, setter) => {
15
+ __accessCheck(obj, member, "write to private field");
16
+ setter ? setter.call(obj, value) : member.set(obj, value);
17
+ return value;
18
+ };
19
+
20
+ // src/cell-renderers/background-cell/BackgroundCell.tsx
21
+ import {
22
+ DOWN1,
23
+ DOWN2,
24
+ isTypeDescriptor as isTypeDescriptor2,
25
+ metadataKeys,
26
+ registerComponent,
27
+ UP1,
28
+ UP2
29
+ } from "@vuu-ui/vuu-utils";
30
+ import cx from "classnames";
31
+
32
+ // src/cell-renderers/background-cell/useDirection.ts
33
+ import {
34
+ getMovingValueDirection,
35
+ isTypeDescriptor,
36
+ isValidNumber
37
+ } from "@vuu-ui/vuu-utils";
38
+ import { useEffect, useRef } from "react";
39
+ var INITIAL_VALUE = [void 0, void 0, void 0, void 0];
40
+ function useDirection(key, value, column) {
41
+ var _a;
42
+ const ref = useRef();
43
+ const [prevKey, prevValue, prevColumn, prevDirection] = ref.current || INITIAL_VALUE;
44
+ const { type: dataType } = column;
45
+ const decimals = isTypeDescriptor(dataType) ? (_a = dataType.formatting) == null ? void 0 : _a.decimals : void 0;
46
+ const direction = key === prevKey && isValidNumber(value) && isValidNumber(prevValue) && column === prevColumn ? getMovingValueDirection(value, prevDirection, prevValue, decimals) : "";
47
+ useEffect(() => {
48
+ ref.current = [key, value, column, direction];
49
+ });
50
+ return direction;
51
+ }
52
+
53
+ // src/cell-renderers/background-cell/BackgroundCell.tsx
54
+ import { jsx, jsxs } from "react/jsx-runtime";
55
+ var CHAR_ARROW_UP = String.fromCharCode(11014);
56
+ var CHAR_ARROW_DOWN = String.fromCharCode(11015);
57
+ var { KEY } = metadataKeys;
58
+ var classBase = "vuuBackgroundCell";
59
+ var FlashStyle = {
60
+ ArrowOnly: "arrow",
61
+ BackgroundOnly: "bg-only",
62
+ ArrowBackground: "arrow-bg"
63
+ };
64
+ var getFlashStyle = (colType) => {
65
+ if (isTypeDescriptor2(colType) && colType.renderer) {
66
+ if ("flashStyle" in colType.renderer) {
67
+ return colType.renderer["flashStyle"];
68
+ }
69
+ }
70
+ return FlashStyle.BackgroundOnly;
71
+ };
72
+ var BackgroundCell = ({ column, row }) => {
73
+ const { key, type, valueFormatter } = column;
74
+ const value = row[key];
75
+ const flashStyle = getFlashStyle(type);
76
+ const direction = useDirection(row[KEY], value, column);
77
+ const arrow = flashStyle === FlashStyle.ArrowOnly || flashStyle === FlashStyle.ArrowBackground ? direction === UP1 || direction === UP2 ? CHAR_ARROW_UP : direction === DOWN1 || direction === DOWN2 ? CHAR_ARROW_DOWN : null : null;
78
+ const dirClass = direction ? ` ` + direction : "";
79
+ const className = cx(classBase, dirClass, {
80
+ [`${classBase}-arrowOnly`]: flashStyle === FlashStyle.ArrowOnly,
81
+ [`${classBase}-arrowBackground`]: flashStyle === FlashStyle.ArrowBackground
82
+ });
83
+ return /* @__PURE__ */ jsxs("div", { className, tabIndex: -1, children: [
84
+ /* @__PURE__ */ jsx("div", { className: `${classBase}-flasher`, children: arrow }),
85
+ valueFormatter(row[column.key])
86
+ ] });
87
+ };
88
+ registerComponent("background", BackgroundCell, "cell-renderer", {
89
+ serverDataType: ["long", "int", "double"]
90
+ });
91
+
92
+ // src/cell-renderers/progress-cell/ProgressCell.tsx
93
+ import {
94
+ isColumnTypeRenderer,
95
+ isTypeDescriptor as isTypeDescriptor3,
96
+ registerComponent as registerComponent2
97
+ } from "@vuu-ui/vuu-utils";
98
+ import cx2 from "classnames";
99
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
100
+ var classBase2 = "vuuProgressCell";
101
+ var ProgressCell = ({ column, columnMap, row }) => {
102
+ const { type } = column;
103
+ const value = row[column.key];
104
+ let showProgress = false;
105
+ let percentage = 0;
106
+ if (isTypeDescriptor3(type) && isColumnTypeRenderer(type.renderer)) {
107
+ const { associatedField } = type.renderer;
108
+ const associatedValue = row[columnMap[associatedField]];
109
+ if (typeof value === "number" && typeof associatedValue === "number") {
110
+ percentage = Math.min(Math.round(value / associatedValue * 100), 100);
111
+ showProgress = isFinite(percentage);
112
+ } else {
113
+ const floatValue = parseFloat(value);
114
+ if (Number.isFinite(floatValue)) {
115
+ const floatOtherValue = parseFloat(associatedValue);
116
+ if (Number.isFinite(floatOtherValue)) {
117
+ percentage = Math.min(
118
+ Math.round(floatValue / floatOtherValue * 100),
119
+ 100
120
+ );
121
+ showProgress = isFinite(percentage);
122
+ }
123
+ }
124
+ }
125
+ }
126
+ const className = cx2(classBase2, {});
127
+ return /* @__PURE__ */ jsxs2("div", { className, tabIndex: -1, children: [
128
+ showProgress ? /* @__PURE__ */ jsxs2("span", { className: `${classBase2}-track`, children: [
129
+ /* @__PURE__ */ jsx2("span", { className: `${classBase2}-bg` }),
130
+ /* @__PURE__ */ jsx2(
131
+ "span",
132
+ {
133
+ className: `${classBase2}-bar`,
134
+ style: { "--progress-bar-pct": `-${100 - percentage}%` }
135
+ }
136
+ )
137
+ ] }) : null,
138
+ /* @__PURE__ */ jsx2("span", { className: `${classBase2}-text`, children: `${percentage} %` })
139
+ ] });
140
+ };
141
+ registerComponent2("vuu.progress", ProgressCell, "cell-renderer", {
142
+ serverDataType: ["long", "int", "double"]
143
+ });
144
+
145
+ // src/column-expression-input/useColumnExpressionEditor.ts
146
+ import {
147
+ autocompletion,
148
+ defaultKeymap,
149
+ EditorState as EditorState2,
150
+ EditorView as EditorView2,
151
+ ensureSyntaxTree,
152
+ keymap,
153
+ minimalSetup,
154
+ startCompletion
155
+ } from "@vuu-ui/vuu-codemirror";
156
+ import { createEl } from "@vuu-ui/vuu-utils";
157
+ import { useEffect as useEffect2, useMemo, useRef as useRef2 } from "react";
158
+
159
+ // src/column-expression-input/column-language-parser/ColumnExpressionLanguage.ts
160
+ import {
161
+ LanguageSupport,
162
+ LRLanguage,
163
+ styleTags,
164
+ tags as tag
165
+ } from "@vuu-ui/vuu-codemirror";
166
+
167
+ // src/column-expression-input/column-language-parser/generated/column-parser.js
168
+ import { LRParser } from "@lezer/lr";
169
+ var parser = LRParser.deserialize({
170
+ version: 14,
171
+ states: "&fOVQPOOO!SQPO'#C^OVQPO'#CcQ!pQPOOO#OQPO'#CkO#TQPO'#CrOOQO'#Cy'#CyO#YQPO,58}OVQPO,59QOVQPO,59QOVQPO,59VOVQPO'#CtOOQO,59^,59^OOQO1G.i1G.iOOQO1G.l1G.lO#kQPO1G.lO$fQPO'#CmO%WQQO1G.qOOQO'#C{'#C{O%cQPO,59`OOQO'#Cn'#CnO%wQPO,59XOVQPO,59ZOVQPO,59[OVQPO7+$]OVQPO'#CuO&`QPO1G.zOOQO1G.z1G.zO&hQQO'#C^O&rQQO1G.sO'ZQQO1G.uOOQO1G.v1G.vO'fQPO<<GwO'wQPO,59aOOQO-E6s-E6sOOQO7+$f7+$fOVQPOAN=cO(]QQO1G.lO(tQPOG22}OOQOLD(iLD(iO%wQPO,59QO%wQPO,59Q",
172
+ stateData: ")[~OlOS~ORUOSUOTUOUUOWQO`SOnPO~OWgXZQX[QX]QX^QXeQX~OjQXXQXpQXqQXrQXsQXtQXuQX~PnOZWO[WO]XO^XO~OWYO~OWZO~OX]OZWO[WO]XO^XO~OZWO[WO]Yi^YijYiXYipYiqYirYisYitYiuYieYi~OZWO[WO]XO^XOpdOqdOrdOsdOtdOudO~OehOvfOwgO~OXkOZWO[WO]XO^XOeiO~ORUOSUOTUOUUOWQO`SOnlO~OXsOeiO~OvQXwQX~PnOZxO[xO]yO^yOeaivaiwai~OwgOecivci~OZWO[WO]XO^XOetO~OZWO[WO]XO^XOXiaeia~OZxO[xO]Yi^YieYivYiwYi~OXwOZWO[WO]XO^XO~O`UTn~",
173
+ goto: "#spPPqPPPPqPPqPPPPqP!R!W!R!RPq!Z!k!nPPP!tP#jmUOQWXYZefghitxyVbYfgRe`mTOQWXYZefghitxyR[TQjcRrjQROQVQS^WxQ_XU`YfgQcZQmeQphQqiQuyRvtQaYQnfRog",
174
+ nodeNames: "\u26A0 ColumnDefinitionExpression Column Number String True False ParenthesizedExpression OpenBrace CloseBrace ArithmeticExpression Divide Times Plus Minus ConditionalExpression If RelationalExpression RelationalOperator AndCondition OrCondition Comma CallExpression Function ArgList",
175
+ maxTerm: 39,
176
+ skippedNodes: [0],
177
+ repeatNodeCount: 1,
178
+ tokenData: ".^~RnXY#PYZ#P]^#Ppq#Pqr#brs#mxy$eyz$jz{$o{|$t|}$y}!O%O!O!P%T!P!Q%c!Q![%h!^!_%s!_!`&Q!`!a&V!c!}&d#R#S&d#T#U&u#U#Y&d#Y#Z(Y#Z#]&d#]#^*j#^#c&d#c#d+f#d#h&d#h#i,b#i#o&d~#USl~XY#PYZ#P]^#Ppq#P~#eP!_!`#h~#mOu~~#pWOX#mZ]#m^r#mrs$Ys#O#m#P;'S#m;'S;=`$_<%lO#m~$_OS~~$bP;=`<%l#m~$jOW~~$oOX~~$tO[~~$yO]~~%OOe~~%TO^~~%WP!Q![%Z~%`PR~!Q![%Z~%hOZ~~%mQR~!O!P%Z!Q![%h~%xPr~!_!`%{~&QOt~~&VOp~~&[Pq~!_!`&_~&dOs~P&iSnP!Q![&d!c!}&d#R#S&d#T#o&dR&zUnP!Q![&d!c!}&d#R#S&d#T#b&d#b#c'^#c#o&dR'cUnP!Q![&d!c!}&d#R#S&d#T#W&d#W#X'u#X#o&dR'|SvQnP!Q![&d!c!}&d#R#S&d#T#o&d~(_TnP!Q![&d!c!}&d#R#S&d#T#U(n#U#o&d~(sUnP!Q![&d!c!}&d#R#S&d#T#`&d#`#a)V#a#o&d~)[UnP!Q![&d!c!}&d#R#S&d#T#g&d#g#h)n#h#o&d~)sUnP!Q![&d!c!}&d#R#S&d#T#X&d#X#Y*V#Y#o&d~*^SU~nP!Q![&d!c!}&d#R#S&d#T#o&d~*oUnP!Q![&d!c!}&d#R#S&d#T#Y&d#Y#Z+R#Z#o&d~+YS`~nP!Q![&d!c!}&d#R#S&d#T#o&dR+kUnP!Q![&d!c!}&d#R#S&d#T#f&d#f#g+}#g#o&dR,USwQnP!Q![&d!c!}&d#R#S&d#T#o&d~,gUnP!Q![&d!c!}&d#R#S&d#T#f&d#f#g,y#g#o&d~-OUnP!Q![&d!c!}&d#R#S&d#T#i&d#i#j-b#j#o&d~-gUnP!Q![&d!c!}&d#R#S&d#T#X&d#X#Y-y#Y#o&d~.QST~nP!Q![&d!c!}&d#R#S&d#T#o&d",
179
+ tokenizers: [0, 1],
180
+ topRules: { "ColumnDefinitionExpression": [0, 1] },
181
+ tokenPrec: 375
182
+ });
183
+
184
+ // src/column-expression-input/column-language-parser/ColumnExpressionLanguage.ts
185
+ var columnExpressionLanguage = LRLanguage.define({
186
+ name: "VuuColumnExpression",
187
+ parser: parser.configure({
188
+ props: [
189
+ styleTags({
190
+ Function: tag.variableName,
191
+ String: tag.string,
192
+ Or: tag.emphasis,
193
+ Operator: tag.operator
194
+ })
195
+ ]
196
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
197
+ })
198
+ });
199
+ var columnExpressionLanguageSupport = () => {
200
+ return new LanguageSupport(
201
+ columnExpressionLanguage
202
+ /*, [exampleCompletion]*/
203
+ );
204
+ };
205
+
206
+ // src/column-expression-input/column-language-parser/ColumnExpressionTreeWalker.ts
207
+ var LiteralExpressionImpl = class {
208
+ constructor(value) {
209
+ this.value = value;
210
+ switch (typeof value) {
211
+ case "boolean":
212
+ this.type = "booleanLiteralExpression";
213
+ break;
214
+ case "number":
215
+ this.type = "numericLiteralExpression";
216
+ break;
217
+ default:
218
+ this.type = "stringLiteralExpression";
219
+ }
220
+ }
221
+ toJSON() {
222
+ return {
223
+ type: this.type,
224
+ value: this.value
225
+ };
226
+ }
227
+ };
228
+ var ColumnExpressionImpl = class {
229
+ constructor(columnName) {
230
+ this.type = "colExpression";
231
+ this.column = columnName;
232
+ }
233
+ toJSON() {
234
+ return {
235
+ type: this.type,
236
+ column: this.column
237
+ };
238
+ }
239
+ };
240
+ var _expressions, _op;
241
+ var ArithmeticExpressionImpl = class {
242
+ constructor(op = "unknown") {
243
+ __privateAdd(this, _expressions, [
244
+ { type: "unknown" },
245
+ { type: "unknown" }
246
+ ]);
247
+ __privateAdd(this, _op, void 0);
248
+ this.type = "arithmeticExpression";
249
+ __privateSet(this, _op, op);
250
+ }
251
+ get op() {
252
+ return __privateGet(this, _op);
253
+ }
254
+ set op(op) {
255
+ __privateSet(this, _op, op);
256
+ }
257
+ get expressions() {
258
+ return __privateGet(this, _expressions);
259
+ }
260
+ toJSON() {
261
+ return {
262
+ type: this.type,
263
+ op: __privateGet(this, _op),
264
+ expressions: __privateGet(this, _expressions)
265
+ };
266
+ }
267
+ };
268
+ _expressions = new WeakMap();
269
+ _op = new WeakMap();
270
+ var _expressions2;
271
+ var CallExpressionImpl = class {
272
+ constructor(functionName) {
273
+ __privateAdd(this, _expressions2, []);
274
+ this.type = "callExpression";
275
+ this.functionName = functionName;
276
+ }
277
+ get expressions() {
278
+ return __privateGet(this, _expressions2);
279
+ }
280
+ get arguments() {
281
+ return __privateGet(this, _expressions2);
282
+ }
283
+ toJSON() {
284
+ return {
285
+ type: this.type,
286
+ functionName: this.functionName,
287
+ arguments: __privateGet(this, _expressions2).map((e) => {
288
+ var _a;
289
+ return (_a = e.toJSON) == null ? void 0 : _a.call(e);
290
+ })
291
+ };
292
+ }
293
+ };
294
+ _expressions2 = new WeakMap();
295
+ var _expressions3, _op2;
296
+ var RelationalExpressionImpl = class {
297
+ constructor() {
298
+ __privateAdd(this, _expressions3, [
299
+ { type: "unknown" },
300
+ { type: "unknown" }
301
+ ]);
302
+ __privateAdd(this, _op2, "unknown");
303
+ this.type = "relationalExpression";
304
+ }
305
+ get op() {
306
+ return __privateGet(this, _op2);
307
+ }
308
+ set op(op) {
309
+ __privateSet(this, _op2, op);
310
+ }
311
+ get expressions() {
312
+ return __privateGet(this, _expressions3);
313
+ }
314
+ toJSON() {
315
+ return {
316
+ type: this.type,
317
+ op: __privateGet(this, _op2),
318
+ expressions: __privateGet(this, _expressions3)
319
+ };
320
+ }
321
+ };
322
+ _expressions3 = new WeakMap();
323
+ _op2 = new WeakMap();
324
+ var _expressions4, _op3;
325
+ var BooleanConditionImp = class {
326
+ constructor(booleanOperator) {
327
+ __privateAdd(this, _expressions4, [
328
+ { type: "unknown" },
329
+ { type: "unknown" }
330
+ ]);
331
+ __privateAdd(this, _op3, void 0);
332
+ this.type = "booleanCondition";
333
+ __privateSet(this, _op3, booleanOperator);
334
+ }
335
+ get op() {
336
+ return __privateGet(this, _op3);
337
+ }
338
+ get expressions() {
339
+ return __privateGet(this, _expressions4);
340
+ }
341
+ toJSON() {
342
+ return {
343
+ type: this.type,
344
+ op: __privateGet(this, _op3),
345
+ expressions: __privateGet(this, _expressions4).map((e) => {
346
+ var _a;
347
+ return (_a = e.toJSON) == null ? void 0 : _a.call(e);
348
+ })
349
+ };
350
+ }
351
+ };
352
+ _expressions4 = new WeakMap();
353
+ _op3 = new WeakMap();
354
+ var _expressions5;
355
+ var ConditionalExpressionImpl = class {
356
+ constructor(booleanOperator) {
357
+ __privateAdd(this, _expressions5, void 0);
358
+ this.type = "conditionalExpression";
359
+ __privateSet(this, _expressions5, [
360
+ booleanOperator ? new BooleanConditionImp(booleanOperator) : new RelationalExpressionImpl(),
361
+ { type: "unknown" },
362
+ { type: "unknown" }
363
+ ]);
364
+ }
365
+ get expressions() {
366
+ return __privateGet(this, _expressions5);
367
+ }
368
+ get condition() {
369
+ return __privateGet(this, _expressions5)[0];
370
+ }
371
+ get truthyExpression() {
372
+ return __privateGet(this, _expressions5)[1];
373
+ }
374
+ set truthyExpression(expression) {
375
+ __privateGet(this, _expressions5)[1] = expression;
376
+ }
377
+ get falsyExpression() {
378
+ return __privateGet(this, _expressions5)[2];
379
+ }
380
+ set falsyExpression(expression) {
381
+ __privateGet(this, _expressions5)[2] = expression;
382
+ }
383
+ toJSON() {
384
+ var _a, _b, _c, _d, _e;
385
+ return {
386
+ type: this.type,
387
+ condition: (_b = (_a = this.condition).toJSON) == null ? void 0 : _b.call(_a),
388
+ truthyExpression: this.truthyExpression,
389
+ falsyExpression: (_e = (_d = (_c = this.falsyExpression) == null ? void 0 : _c.toJSON) == null ? void 0 : _d.call(_c)) != null ? _e : this.falsyExpression
390
+ };
391
+ }
392
+ };
393
+ _expressions5 = new WeakMap();
394
+ var isUnknown = (e) => e.type === "unknown";
395
+ var isArithmeticExpression = (expression) => expression.type === "arithmeticExpression";
396
+ var isCallExpression = (expression) => expression.type === "callExpression";
397
+ var isConditionalExpression = (expression) => expression.type === "conditionalExpression";
398
+ var isCondition = (expression) => expression.type === "relationalExpression" || expression.type === "booleanCondition";
399
+ var isBooleanCondition = (expression) => expression.type === "booleanCondition";
400
+ var isRelationalExpression = (expression) => (expression == null ? void 0 : expression.type) === "relationalExpression";
401
+ var firstIncompleteExpression = (expression) => {
402
+ if (isUnknown(expression)) {
403
+ return expression;
404
+ } else if (isRelationalExpression(expression)) {
405
+ const [operand1, operand2] = expression.expressions;
406
+ if (expressionIsIncomplete(operand1)) {
407
+ return firstIncompleteExpression(operand1);
408
+ } else if (expression.op === "unknown") {
409
+ return expression;
410
+ } else if (expressionIsIncomplete(operand2)) {
411
+ return firstIncompleteExpression(operand2);
412
+ }
413
+ } else if (isCondition(expression)) {
414
+ const { expressions = [] } = expression;
415
+ for (const e of expressions) {
416
+ if (expressionIsIncomplete(e)) {
417
+ return firstIncompleteExpression(e);
418
+ }
419
+ }
420
+ } else if (isConditionalExpression(expression)) {
421
+ const { condition, truthyExpression, falsyExpression } = expression;
422
+ if (expressionIsIncomplete(condition)) {
423
+ return firstIncompleteExpression(condition);
424
+ } else if (expressionIsIncomplete(truthyExpression)) {
425
+ return firstIncompleteExpression(truthyExpression);
426
+ } else if (expressionIsIncomplete(falsyExpression)) {
427
+ return firstIncompleteExpression(falsyExpression);
428
+ }
429
+ } else if (isArithmeticExpression(expression)) {
430
+ const { expressions = [] } = expression;
431
+ for (const e of expressions) {
432
+ if (expressionIsIncomplete(e)) {
433
+ return firstIncompleteExpression(e);
434
+ }
435
+ }
436
+ }
437
+ };
438
+ var replaceUnknownExpression = (incompleteExpression, unknownExpression, expression) => {
439
+ const { expressions = [] } = incompleteExpression;
440
+ if (expressions.includes(unknownExpression)) {
441
+ const pos = expressions.indexOf(unknownExpression);
442
+ expressions.splice(pos, 1, expression);
443
+ return true;
444
+ } else {
445
+ for (const e of expressions) {
446
+ if (replaceUnknownExpression(e, unknownExpression, expression)) {
447
+ return true;
448
+ }
449
+ }
450
+ }
451
+ return false;
452
+ };
453
+ var expressionIsIncomplete = (expression) => {
454
+ if (isUnknown(expression)) {
455
+ return true;
456
+ } else if (isConditionalExpression(expression)) {
457
+ return expressionIsIncomplete(expression.condition) || expressionIsIncomplete(expression.truthyExpression) || expressionIsIncomplete(expression.falsyExpression);
458
+ } else if (isRelationalExpression(expression) || isBooleanCondition(expression)) {
459
+ return expression.op === void 0 || expression.expressions.some((e) => expressionIsIncomplete(e));
460
+ }
461
+ return false;
462
+ };
463
+ var addExpression = (expression, subExpression) => {
464
+ const targetExpression = firstIncompleteExpression(expression);
465
+ if (targetExpression) {
466
+ if (targetExpression.expressions) {
467
+ targetExpression.expressions.push(subExpression);
468
+ } else {
469
+ console.warn("don't know how to treat targetExpression");
470
+ }
471
+ } else {
472
+ console.error("no target expression found");
473
+ }
474
+ };
475
+ var _expression, _callStack;
476
+ var ColumnExpression = class {
477
+ constructor() {
478
+ __privateAdd(this, _expression, void 0);
479
+ __privateAdd(this, _callStack, []);
480
+ }
481
+ setCondition(booleanOperator) {
482
+ if (__privateGet(this, _expression) === void 0) {
483
+ this.addExpression(new ConditionalExpressionImpl(booleanOperator));
484
+ } else if (isConditionalExpression(__privateGet(this, _expression))) {
485
+ if (expressionIsIncomplete(__privateGet(this, _expression).condition)) {
486
+ const condition = booleanOperator ? new BooleanConditionImp(booleanOperator) : new RelationalExpressionImpl();
487
+ this.addExpression(condition);
488
+ } else if (isUnknown(__privateGet(this, _expression).truthyExpression)) {
489
+ __privateGet(this, _expression).truthyExpression = new ConditionalExpressionImpl(
490
+ booleanOperator
491
+ );
492
+ } else if (expressionIsIncomplete(__privateGet(this, _expression).truthyExpression)) {
493
+ const condition = booleanOperator ? new BooleanConditionImp(booleanOperator) : new RelationalExpressionImpl();
494
+ this.addExpression(condition);
495
+ } else if (isUnknown(__privateGet(this, _expression).falsyExpression)) {
496
+ __privateGet(this, _expression).falsyExpression = new ConditionalExpressionImpl(
497
+ booleanOperator
498
+ );
499
+ } else if (expressionIsIncomplete(__privateGet(this, _expression).falsyExpression)) {
500
+ const condition = booleanOperator ? new BooleanConditionImp(booleanOperator) : new RelationalExpressionImpl();
501
+ this.addExpression(condition);
502
+ }
503
+ } else {
504
+ console.error("setCondition called unexpectedly");
505
+ }
506
+ }
507
+ addExpression(expression) {
508
+ if (__privateGet(this, _callStack).length > 0) {
509
+ const currentCallExpression = __privateGet(this, _callStack).at(-1);
510
+ currentCallExpression == null ? void 0 : currentCallExpression.arguments.push(expression);
511
+ } else if (__privateGet(this, _expression) === void 0) {
512
+ __privateSet(this, _expression, expression);
513
+ } else if (isArithmeticExpression(__privateGet(this, _expression))) {
514
+ const targetExpression = firstIncompleteExpression(__privateGet(this, _expression));
515
+ if (targetExpression && isUnknown(targetExpression)) {
516
+ replaceUnknownExpression(
517
+ __privateGet(this, _expression),
518
+ targetExpression,
519
+ expression
520
+ );
521
+ }
522
+ } else if (isConditionalExpression(__privateGet(this, _expression))) {
523
+ if (expressionIsIncomplete(__privateGet(this, _expression))) {
524
+ const targetExpression = firstIncompleteExpression(__privateGet(this, _expression));
525
+ if (targetExpression && isUnknown(targetExpression)) {
526
+ replaceUnknownExpression(
527
+ __privateGet(this, _expression),
528
+ targetExpression,
529
+ expression
530
+ );
531
+ } else if (targetExpression) {
532
+ addExpression(targetExpression, expression);
533
+ }
534
+ }
535
+ }
536
+ }
537
+ setFunction(functionName) {
538
+ const callExpression = new CallExpressionImpl(functionName);
539
+ this.addExpression(callExpression);
540
+ __privateGet(this, _callStack).push(callExpression);
541
+ }
542
+ setColumn(columnName) {
543
+ this.addExpression(new ColumnExpressionImpl(columnName));
544
+ }
545
+ setArithmeticOp(value) {
546
+ const op = value;
547
+ const expression = __privateGet(this, _expression);
548
+ if (isArithmeticExpression(expression)) {
549
+ expression.op = op;
550
+ }
551
+ }
552
+ setRelationalOperator(value) {
553
+ const op = value;
554
+ if (__privateGet(this, _expression) && isConditionalExpression(__privateGet(this, _expression))) {
555
+ const targetExpression = firstIncompleteExpression(__privateGet(this, _expression));
556
+ if (isRelationalExpression(targetExpression)) {
557
+ targetExpression.op = op;
558
+ } else {
559
+ console.error(`no target expression found (op = ${value})`);
560
+ }
561
+ }
562
+ }
563
+ setValue(value) {
564
+ const literalExpression = new LiteralExpressionImpl(value);
565
+ if (__privateGet(this, _expression) === void 0) {
566
+ __privateSet(this, _expression, literalExpression);
567
+ } else if (isArithmeticExpression(__privateGet(this, _expression))) {
568
+ this.addExpression(literalExpression);
569
+ } else if (isCallExpression(__privateGet(this, _expression))) {
570
+ __privateGet(this, _expression).arguments.push(literalExpression);
571
+ } else if (isConditionalExpression(__privateGet(this, _expression))) {
572
+ if (expressionIsIncomplete(__privateGet(this, _expression))) {
573
+ const targetExpression = firstIncompleteExpression(__privateGet(this, _expression));
574
+ if (targetExpression && isUnknown(targetExpression)) {
575
+ replaceUnknownExpression(
576
+ __privateGet(this, _expression),
577
+ targetExpression,
578
+ literalExpression
579
+ );
580
+ } else if (targetExpression) {
581
+ addExpression(targetExpression, literalExpression);
582
+ }
583
+ } else {
584
+ console.log("what do we do with value, in a complete expression");
585
+ }
586
+ }
587
+ }
588
+ closeBrace() {
589
+ __privateGet(this, _callStack).pop();
590
+ }
591
+ get expression() {
592
+ return __privateGet(this, _expression);
593
+ }
594
+ toJSON() {
595
+ var _a;
596
+ return (_a = __privateGet(this, _expression)) == null ? void 0 : _a.toJSON();
597
+ }
598
+ };
599
+ _expression = new WeakMap();
600
+ _callStack = new WeakMap();
601
+ var walkTree = (tree, source) => {
602
+ const columnExpression = new ColumnExpression();
603
+ const cursor = tree.cursor();
604
+ do {
605
+ const { name, from, to } = cursor;
606
+ switch (name) {
607
+ case "AndCondition":
608
+ columnExpression.setCondition("and");
609
+ break;
610
+ case "OrCondition":
611
+ columnExpression.setCondition("or");
612
+ break;
613
+ case "RelationalExpression":
614
+ columnExpression.setCondition();
615
+ break;
616
+ case "ArithmeticExpression":
617
+ columnExpression.addExpression(new ArithmeticExpressionImpl());
618
+ break;
619
+ case "Column":
620
+ {
621
+ const columnName = source.substring(from, to);
622
+ columnExpression.setColumn(columnName);
623
+ }
624
+ break;
625
+ case "Function":
626
+ {
627
+ const functionName = source.substring(from, to);
628
+ columnExpression.setFunction(functionName);
629
+ }
630
+ break;
631
+ case "Times":
632
+ case "Divide":
633
+ case "Plus":
634
+ case "Minus":
635
+ {
636
+ const op = source.substring(from, to);
637
+ columnExpression.setArithmeticOp(op);
638
+ }
639
+ break;
640
+ case "RelationalOperator":
641
+ {
642
+ const op = source.substring(from, to);
643
+ columnExpression.setRelationalOperator(op);
644
+ }
645
+ break;
646
+ case "False":
647
+ case "True":
648
+ {
649
+ const value = source.substring(from, to);
650
+ columnExpression.setValue(value === "true" ? true : false);
651
+ }
652
+ break;
653
+ case "String":
654
+ columnExpression.setValue(source.substring(from + 1, to - 1));
655
+ break;
656
+ case "Number":
657
+ columnExpression.setValue(parseFloat(source.substring(from, to)));
658
+ break;
659
+ case "CloseBrace":
660
+ columnExpression.closeBrace();
661
+ break;
662
+ default:
663
+ }
664
+ } while (cursor.next());
665
+ return columnExpression.toJSON();
666
+ };
667
+
668
+ // src/column-expression-input/column-language-parser/column-expression-parse-utils.ts
669
+ var strictParser = parser.configure({ strict: true });
670
+ var RelationalOperands = ["Number", "String"];
671
+ var ColumnNamedTerms = [
672
+ ...RelationalOperands,
673
+ "AndCondition",
674
+ "ArithmeticExpression",
675
+ "BooleanOperator",
676
+ "RelationalOperatorOperator",
677
+ "CallExpression",
678
+ "CloseBrace",
679
+ "Column",
680
+ "Comma",
681
+ "ConditionalExpression",
682
+ "Divide",
683
+ "Equal",
684
+ "If",
685
+ "Minus",
686
+ "OpenBrace",
687
+ "OrCondition",
688
+ "ParenthesizedExpression",
689
+ "Plus",
690
+ "RelationalExpression",
691
+ "RelationalOperator",
692
+ "Times"
693
+ ];
694
+ var isCompleteExpression = (src) => {
695
+ try {
696
+ strictParser.parse(src);
697
+ return true;
698
+ } catch (err) {
699
+ return false;
700
+ }
701
+ };
702
+ var lastNamedChild = (node) => {
703
+ let { lastChild } = node;
704
+ while (lastChild && !ColumnNamedTerms.includes(lastChild.name)) {
705
+ lastChild = lastChild.prevSibling;
706
+ console.log(lastChild == null ? void 0 : lastChild.name);
707
+ }
708
+ return lastChild;
709
+ };
710
+ var isCompleteRelationalExpression = (node) => {
711
+ if ((node == null ? void 0 : node.name) === "RelationalExpression") {
712
+ const { firstChild } = node;
713
+ const lastChild = lastNamedChild(node);
714
+ if ((firstChild == null ? void 0 : firstChild.name) === "Column" && typeof (lastChild == null ? void 0 : lastChild.name) === "string" && RelationalOperands.includes(lastChild.name)) {
715
+ return true;
716
+ }
717
+ }
718
+ return false;
719
+ };
720
+
721
+ // src/column-expression-input/highlighting.ts
722
+ import {
723
+ HighlightStyle,
724
+ syntaxHighlighting,
725
+ tags
726
+ } from "@vuu-ui/vuu-codemirror";
727
+ var myHighlightStyle = HighlightStyle.define([
728
+ { tag: tags.variableName, color: "var(--vuuFilterEditor-variableColor)" },
729
+ { tag: tags.comment, color: "green", fontStyle: "italic" }
730
+ ]);
731
+ var vuuHighlighting = syntaxHighlighting(myHighlightStyle);
732
+
733
+ // src/column-expression-input/theme.ts
734
+ import { EditorView } from "@vuu-ui/vuu-codemirror";
735
+ var vuuTheme = EditorView.theme(
736
+ {
737
+ "&": {
738
+ border: "solid 1px var(--salt-container-primary-borderColor)",
739
+ color: "var(--vuuFilterEditor-color)",
740
+ backgroundColor: "var(--vuuFilterEditor-background)"
741
+ },
742
+ ".cm-content": {
743
+ caretColor: "var(--vuuFilterEditor-cursorColor)"
744
+ },
745
+ "&.cm-focused .cm-cursor": {
746
+ borderLeftColor: "var(--vuuFilterEditor-cursorColor)"
747
+ },
748
+ "&.cm-focused .cm-selectionBackground, ::selection": {
749
+ backgroundColor: "var(--vuuFilterEditor-selectionBackground)"
750
+ },
751
+ ".cm-selectionBackground, ::selection": {
752
+ backgroundColor: "var(--vuuFilterEditor-selectionBackground)"
753
+ },
754
+ ".cm-scroller": {
755
+ fontFamily: "var(--vuuFilterEditor-fontFamily)"
756
+ },
757
+ ".cm-tooltip": {
758
+ background: "var(--vuuFilterEditor-tooltipBackground)",
759
+ border: "var(--vuuFilterEditor-tooltipBorder)",
760
+ boxShadow: "var(--vuuFilterEditor-tooltipElevation)",
761
+ "&.cm-tooltip-autocomplete > ul": {
762
+ fontFamily: "var(--vuuFilterEditor-fontFamily)",
763
+ fontSize: "var(--vuuFilterEditor-fontSize)",
764
+ maxHeight: "240px"
765
+ },
766
+ "&.cm-tooltip-autocomplete > ul > li": {
767
+ height: "var(--vuuFilterEditor-suggestion-height)",
768
+ padding: "0 3px",
769
+ lineHeight: "var(--vuuFilterEditor-suggestion-height)"
770
+ },
771
+ "&.cm-tooltip-autocomplete li[aria-selected]": {
772
+ background: "var(--vuuFilterEditor-suggestion-selectedBackground)",
773
+ color: "var(--vuuFilterEditor-suggestion-selectedColor)"
774
+ },
775
+ "&.cm-tooltip-autocomplete li .cm-completionDetail": {
776
+ color: "var(--vuuFilterEditor-suggestion-detailColor)"
777
+ }
778
+ }
779
+ },
780
+ { dark: false }
781
+ );
782
+
783
+ // src/column-expression-input/useColumnAutoComplete.ts
784
+ import {
785
+ booleanJoinSuggestions,
786
+ getNamedParentNode,
787
+ getPreviousNode,
788
+ getValue,
789
+ syntaxTree
790
+ } from "@vuu-ui/vuu-codemirror";
791
+ import { useCallback } from "react";
792
+ var applyPrefix = (completions, prefix) => prefix ? completions.map((completion) => {
793
+ var _a;
794
+ return {
795
+ ...completion,
796
+ apply: typeof completion.apply === "function" ? completion.apply : `${prefix}${(_a = completion.apply) != null ? _a : completion.label}`
797
+ };
798
+ }) : completions;
799
+ var isOperator = (node) => node === void 0 ? false : ["Times", "Divide", "Plus", "Minus"].includes(node.name);
800
+ var getLastChild = (node, context) => {
801
+ var _a;
802
+ let { lastChild: childNode } = node;
803
+ const { pos } = context;
804
+ while (childNode) {
805
+ const isBeforeCursor = childNode.from < pos;
806
+ if (isBeforeCursor && ColumnNamedTerms.includes(childNode.name)) {
807
+ if (childNode.name === "ParenthesizedExpression") {
808
+ const expression = (_a = childNode.firstChild) == null ? void 0 : _a.nextSibling;
809
+ if (expression) {
810
+ childNode = expression;
811
+ }
812
+ }
813
+ return childNode;
814
+ } else {
815
+ childNode = childNode.prevSibling;
816
+ }
817
+ }
818
+ };
819
+ var getFunctionName = (node, state) => {
820
+ var _a;
821
+ if (node.name === "ArgList") {
822
+ const functionNode = node.prevSibling;
823
+ if (functionNode) {
824
+ return getValue(functionNode, state);
825
+ }
826
+ } else if (node.name === "OpenBrace") {
827
+ const maybeFunction = (_a = node.parent) == null ? void 0 : _a.prevSibling;
828
+ if ((maybeFunction == null ? void 0 : maybeFunction.name) === "Function") {
829
+ return getValue(maybeFunction, state);
830
+ }
831
+ }
832
+ };
833
+ var getRelationalOperator = (node, state) => {
834
+ if (node.name === "RelationalExpression") {
835
+ const lastNode = lastNamedChild(node);
836
+ if ((lastNode == null ? void 0 : lastNode.name) === "RelationalOperator") {
837
+ return getValue(lastNode, state);
838
+ }
839
+ } else {
840
+ const prevNode = node.prevSibling;
841
+ if ((prevNode == null ? void 0 : prevNode.name) === "RelationalOperator") {
842
+ return getValue(prevNode, state);
843
+ }
844
+ }
845
+ };
846
+ var getColumnName = (node, state) => {
847
+ var _a;
848
+ if (node.name === "RelationalExpression") {
849
+ if (((_a = node.firstChild) == null ? void 0 : _a.name) === "Column") {
850
+ return getValue(node.firstChild, state);
851
+ }
852
+ } else {
853
+ const prevNode = node.prevSibling;
854
+ if ((prevNode == null ? void 0 : prevNode.name) === "Column") {
855
+ return getValue(prevNode, state);
856
+ } else if ((prevNode == null ? void 0 : prevNode.name) === "RelationalOperator") {
857
+ return getColumnName(prevNode, state);
858
+ }
859
+ }
860
+ };
861
+ var makeSuggestions = async (context, suggestionProvider, suggestionType, optionalArgs = {}) => {
862
+ const options = await suggestionProvider.getSuggestions(
863
+ suggestionType,
864
+ optionalArgs
865
+ );
866
+ const { startsWith = "" } = optionalArgs;
867
+ return { from: context.pos - startsWith.length, options };
868
+ };
869
+ var handleConditionalExpression = (node, context, suggestionProvider, maybeComplete, onSubmit) => {
870
+ const lastChild = getLastChild(node, context);
871
+ console.log(`conditional expression last child ${lastChild == null ? void 0 : lastChild.name}`);
872
+ switch (lastChild == null ? void 0 : lastChild.name) {
873
+ case "If":
874
+ return makeSuggestions(context, suggestionProvider, "expression", {
875
+ prefix: "( "
876
+ });
877
+ case "OpenBrace":
878
+ return makeSuggestions(context, suggestionProvider, "expression");
879
+ case "Condition":
880
+ return makeSuggestions(context, suggestionProvider, "expression", {
881
+ prefix: ", "
882
+ });
883
+ case "CloseBrace":
884
+ if (maybeComplete) {
885
+ const options = [
886
+ {
887
+ apply: () => {
888
+ onSubmit == null ? void 0 : onSubmit();
889
+ },
890
+ label: "Save Expression",
891
+ boost: 10
892
+ }
893
+ ];
894
+ return { from: context.pos, options };
895
+ }
896
+ }
897
+ };
898
+ var promptToSave = (context, onSubmit) => {
899
+ const options = [
900
+ {
901
+ apply: () => {
902
+ onSubmit == null ? void 0 : onSubmit();
903
+ },
904
+ label: "Save Expression",
905
+ boost: 10
906
+ }
907
+ ];
908
+ return { from: context.pos, options };
909
+ };
910
+ var useColumnAutoComplete = (suggestionProvider, onSubmit) => {
911
+ const makeSuggestions2 = useCallback(
912
+ async (context, suggestionType, optionalArgs = {}) => {
913
+ const options = await suggestionProvider.getSuggestions(
914
+ suggestionType,
915
+ optionalArgs
916
+ );
917
+ const { startsWith = "" } = optionalArgs;
918
+ return { from: context.pos - startsWith.length, options };
919
+ },
920
+ [suggestionProvider]
921
+ );
922
+ return useCallback(
923
+ async (context) => {
924
+ var _a, _b;
925
+ const { state, pos } = context;
926
+ const word = (_a = context.matchBefore(/\w*/)) != null ? _a : {
927
+ from: 0,
928
+ to: 0,
929
+ text: void 0
930
+ };
931
+ const tree = syntaxTree(state);
932
+ const nodeBefore = tree.resolveInner(pos, -1);
933
+ const text = state.doc.toString();
934
+ const maybeComplete = isCompleteExpression(text);
935
+ console.log({ nodeBeforeName: nodeBefore.name });
936
+ switch (nodeBefore.name) {
937
+ case "If": {
938
+ console.log(`conditional expression If`);
939
+ return makeSuggestions2(context, "expression", { prefix: "( " });
940
+ }
941
+ case "Condition":
942
+ {
943
+ const lastChild = getLastChild(nodeBefore, context);
944
+ if ((lastChild == null ? void 0 : lastChild.name) === "Column") {
945
+ const prevChild = getPreviousNode(lastChild);
946
+ if ((prevChild == null ? void 0 : prevChild.name) !== "RelationalOperator") {
947
+ return makeSuggestions2(context, "condition-operator", {
948
+ columnName: getValue(lastChild, state)
949
+ });
950
+ }
951
+ console.log(
952
+ `Condition last child Column, prev child ${prevChild == null ? void 0 : prevChild.name}`
953
+ );
954
+ } else if ((lastChild == null ? void 0 : lastChild.name) === "RelationalOperator") {
955
+ return makeSuggestions2(context, "expression");
956
+ }
957
+ console.log(`condition last child ${lastChild == null ? void 0 : lastChild.name}`);
958
+ }
959
+ break;
960
+ case "ConditionalExpression":
961
+ return handleConditionalExpression(
962
+ nodeBefore,
963
+ context,
964
+ suggestionProvider
965
+ );
966
+ case "RelationalExpression":
967
+ {
968
+ if (isCompleteRelationalExpression(nodeBefore)) {
969
+ return {
970
+ from: context.pos,
971
+ options: booleanJoinSuggestions.concat({
972
+ label: ", <truthy expression>, <falsy expression>",
973
+ apply: ", "
974
+ })
975
+ };
976
+ } else {
977
+ const operator = getRelationalOperator(nodeBefore, state);
978
+ const columnName = getColumnName(nodeBefore, state);
979
+ if (!operator) {
980
+ const options = await suggestionProvider.getSuggestions(
981
+ "condition-operator",
982
+ {
983
+ columnName
984
+ }
985
+ );
986
+ return { from: context.pos, options };
987
+ } else {
988
+ return makeSuggestions2(context, "expression");
989
+ }
990
+ }
991
+ }
992
+ break;
993
+ case "RelationalOperator":
994
+ return makeSuggestions2(context, "expression");
995
+ case "String":
996
+ {
997
+ const operator = getRelationalOperator(
998
+ nodeBefore,
999
+ state
1000
+ );
1001
+ const columnName = getColumnName(nodeBefore, state);
1002
+ const { from, to } = nodeBefore;
1003
+ if (to - from === 2 && context.pos === from + 1) {
1004
+ if (columnName && operator) {
1005
+ return makeSuggestions2(context, "columnValue", {
1006
+ columnName,
1007
+ operator,
1008
+ startsWith: word.text
1009
+ });
1010
+ }
1011
+ } else if (to - from > 2 && context.pos === to) {
1012
+ return makeSuggestions2(context, "expression", {
1013
+ prefix: ", "
1014
+ });
1015
+ }
1016
+ console.log(
1017
+ `we have a string, column is ${columnName} ${from} ${to}`
1018
+ );
1019
+ }
1020
+ break;
1021
+ case "ArithmeticExpression":
1022
+ {
1023
+ const lastChild = getLastChild(nodeBefore, context);
1024
+ if ((lastChild == null ? void 0 : lastChild.name) === "Column") {
1025
+ return makeSuggestions2(context, "expression");
1026
+ } else if (isOperator(lastChild)) {
1027
+ const operator = lastChild.name;
1028
+ return makeSuggestions2(context, "column", { operator });
1029
+ }
1030
+ }
1031
+ break;
1032
+ case "OpenBrace":
1033
+ {
1034
+ const functionName = getFunctionName(nodeBefore, state);
1035
+ return makeSuggestions2(context, "expression", { functionName });
1036
+ }
1037
+ break;
1038
+ case "ArgList": {
1039
+ const functionName = getFunctionName(nodeBefore, state);
1040
+ const lastArgument = getLastChild(nodeBefore, context);
1041
+ const prefix = (lastArgument == null ? void 0 : lastArgument.name) === "OpenBrace" ? void 0 : ",";
1042
+ let options = await suggestionProvider.getSuggestions("expression", {
1043
+ functionName
1044
+ });
1045
+ options = prefix ? applyPrefix(options, ", ") : options;
1046
+ if ((lastArgument == null ? void 0 : lastArgument.name) !== "OpenBrace" && (lastArgument == null ? void 0 : lastArgument.name) !== "Comma") {
1047
+ options = [
1048
+ {
1049
+ apply: ") ",
1050
+ boost: 10,
1051
+ label: "Done - no more arguments"
1052
+ }
1053
+ ].concat(options);
1054
+ }
1055
+ return { from: context.pos, options };
1056
+ }
1057
+ case "Equal":
1058
+ if (text.trim() === "=") {
1059
+ return makeSuggestions2(context, "expression");
1060
+ }
1061
+ break;
1062
+ case "ParenthesizedExpression":
1063
+ case "ColumnDefinitionExpression":
1064
+ if (context.pos === 0) {
1065
+ return makeSuggestions2(context, "expression");
1066
+ } else {
1067
+ const lastChild = getLastChild(nodeBefore, context);
1068
+ if ((lastChild == null ? void 0 : lastChild.name) === "Column") {
1069
+ if (maybeComplete) {
1070
+ const options = [
1071
+ {
1072
+ apply: () => {
1073
+ onSubmit.current();
1074
+ },
1075
+ label: "Save Expression",
1076
+ boost: 10
1077
+ }
1078
+ ];
1079
+ const columnName = getValue(lastChild, state);
1080
+ const columnOptions = await suggestionProvider.getSuggestions("operator", {
1081
+ columnName
1082
+ });
1083
+ return {
1084
+ from: context.pos,
1085
+ options: options.concat(columnOptions)
1086
+ };
1087
+ }
1088
+ } else if ((lastChild == null ? void 0 : lastChild.name) === "CallExpression") {
1089
+ if (maybeComplete) {
1090
+ const options = [
1091
+ {
1092
+ apply: () => {
1093
+ onSubmit.current();
1094
+ },
1095
+ label: "Save Expression",
1096
+ boost: 10
1097
+ }
1098
+ ];
1099
+ return {
1100
+ from: context.pos,
1101
+ options
1102
+ };
1103
+ }
1104
+ } else if ((lastChild == null ? void 0 : lastChild.name) === "ArithmeticExpression") {
1105
+ if (maybeComplete) {
1106
+ let options = [
1107
+ {
1108
+ apply: () => {
1109
+ onSubmit.current();
1110
+ },
1111
+ label: "Save Expression",
1112
+ boost: 10
1113
+ }
1114
+ ];
1115
+ const lastExpressionChild = getLastChild(lastChild, context);
1116
+ if ((lastExpressionChild == null ? void 0 : lastExpressionChild.name) === "Column") {
1117
+ const columnName = getValue(lastExpressionChild, state);
1118
+ const suggestions = await suggestionProvider.getSuggestions(
1119
+ "operator",
1120
+ { columnName }
1121
+ );
1122
+ options = options.concat(suggestions);
1123
+ }
1124
+ return {
1125
+ from: context.pos,
1126
+ options
1127
+ };
1128
+ }
1129
+ } else if ((lastChild == null ? void 0 : lastChild.name) === "ConditionalExpression") {
1130
+ return handleConditionalExpression(
1131
+ lastChild,
1132
+ context,
1133
+ suggestionProvider,
1134
+ maybeComplete,
1135
+ onSubmit.current
1136
+ );
1137
+ }
1138
+ break;
1139
+ }
1140
+ case "Column":
1141
+ {
1142
+ const isPartialMatch = await suggestionProvider.isPartialMatch(
1143
+ "expression",
1144
+ void 0,
1145
+ word.text
1146
+ );
1147
+ if (isPartialMatch) {
1148
+ return makeSuggestions2(context, "expression", {
1149
+ startsWith: word.text
1150
+ });
1151
+ }
1152
+ }
1153
+ break;
1154
+ case "Comma":
1155
+ {
1156
+ const parentNode = getNamedParentNode(nodeBefore);
1157
+ if ((parentNode == null ? void 0 : parentNode.name) === "ConditionalExpression") {
1158
+ return makeSuggestions2(context, "expression");
1159
+ }
1160
+ }
1161
+ break;
1162
+ case "CloseBrace":
1163
+ {
1164
+ const parentNode = getNamedParentNode(nodeBefore);
1165
+ if ((parentNode == null ? void 0 : parentNode.name) === "ConditionalExpression") {
1166
+ return handleConditionalExpression(
1167
+ parentNode,
1168
+ context,
1169
+ suggestionProvider,
1170
+ maybeComplete,
1171
+ onSubmit.current
1172
+ );
1173
+ } else if ((parentNode == null ? void 0 : parentNode.name) === "ArgList") {
1174
+ if (maybeComplete) {
1175
+ return promptToSave(context, onSubmit.current);
1176
+ }
1177
+ }
1178
+ console.log(
1179
+ `does closebrace denote an ARgList or a parenthetised expression ? ${parentNode}`
1180
+ );
1181
+ }
1182
+ break;
1183
+ default: {
1184
+ if (((_b = nodeBefore == null ? void 0 : nodeBefore.prevSibling) == null ? void 0 : _b.name) === "FilterClause") {
1185
+ console.log("looks like we ight be a or|and operator");
1186
+ }
1187
+ }
1188
+ }
1189
+ },
1190
+ [makeSuggestions2, onSubmit, suggestionProvider]
1191
+ );
1192
+ };
1193
+
1194
+ // src/column-expression-input/useColumnExpressionEditor.ts
1195
+ var getView = (ref) => {
1196
+ if (ref.current == void 0) {
1197
+ throw Error("EditorView not defined");
1198
+ }
1199
+ return ref.current;
1200
+ };
1201
+ var getOptionClass = () => {
1202
+ return "vuuSuggestion";
1203
+ };
1204
+ var noop = () => console.log("noooop");
1205
+ var hasExpressionType = (completion) => "expressionType" in completion;
1206
+ var injectOptionContent = (completion) => {
1207
+ if (hasExpressionType(completion)) {
1208
+ const div = createEl("div", "expression-type-container");
1209
+ const span = createEl("span", "expression-type", completion.expressionType);
1210
+ div.appendChild(span);
1211
+ return div;
1212
+ } else {
1213
+ return null;
1214
+ }
1215
+ };
1216
+ var useColumnExpressionEditor = ({
1217
+ onChange,
1218
+ onSubmitExpression,
1219
+ suggestionProvider
1220
+ }) => {
1221
+ const editorRef = useRef2(null);
1222
+ const onSubmit = useRef2(noop);
1223
+ const viewRef = useRef2();
1224
+ const completionFn = useColumnAutoComplete(suggestionProvider, onSubmit);
1225
+ const [createState, clearInput] = useMemo(() => {
1226
+ const parseExpression = () => {
1227
+ const view = getView(viewRef);
1228
+ const source = view.state.doc.toString();
1229
+ const tree = ensureSyntaxTree(view.state, view.state.doc.length, 5e3);
1230
+ if (tree) {
1231
+ const expression = walkTree(tree, source);
1232
+ return [source, expression];
1233
+ } else {
1234
+ return ["", void 0];
1235
+ }
1236
+ };
1237
+ const clearInput2 = () => {
1238
+ getView(viewRef).setState(createState2());
1239
+ };
1240
+ const submitExpressionAndClearInput = () => {
1241
+ const [source, expression] = parseExpression();
1242
+ onSubmitExpression == null ? void 0 : onSubmitExpression(source, expression);
1243
+ clearInput2();
1244
+ };
1245
+ const submitFilter = (key) => {
1246
+ return keymap.of([
1247
+ {
1248
+ key,
1249
+ run() {
1250
+ submitExpressionAndClearInput();
1251
+ return true;
1252
+ }
1253
+ }
1254
+ ]);
1255
+ };
1256
+ const showSuggestions = (key) => {
1257
+ return keymap.of([
1258
+ {
1259
+ key,
1260
+ run() {
1261
+ startCompletion(getView(viewRef));
1262
+ return true;
1263
+ }
1264
+ }
1265
+ ]);
1266
+ };
1267
+ const createState2 = () => EditorState2.create({
1268
+ doc: "",
1269
+ extensions: [
1270
+ minimalSetup,
1271
+ autocompletion({
1272
+ addToOptions: [
1273
+ {
1274
+ render: injectOptionContent,
1275
+ position: 70
1276
+ }
1277
+ ],
1278
+ override: [completionFn],
1279
+ optionClass: getOptionClass
1280
+ }),
1281
+ columnExpressionLanguageSupport(),
1282
+ keymap.of(defaultKeymap),
1283
+ submitFilter("Ctrl-Enter"),
1284
+ showSuggestions("ArrowDown"),
1285
+ EditorView2.updateListener.of((v) => {
1286
+ const view = getView(viewRef);
1287
+ if (v.docChanged) {
1288
+ startCompletion(view);
1289
+ const source = view.state.doc.toString();
1290
+ onChange == null ? void 0 : onChange(source, void 0);
1291
+ }
1292
+ }),
1293
+ // Enforces single line view
1294
+ // EditorState.transactionFilter.of((tr) =>
1295
+ // tr.newDoc.lines > 1 ? [] : tr
1296
+ // ),
1297
+ vuuTheme,
1298
+ vuuHighlighting
1299
+ ]
1300
+ });
1301
+ onSubmit.current = () => {
1302
+ submitExpressionAndClearInput();
1303
+ setTimeout(() => {
1304
+ getView(viewRef).focus();
1305
+ }, 100);
1306
+ };
1307
+ return [createState2, clearInput2];
1308
+ }, [completionFn, onChange, onSubmitExpression]);
1309
+ useEffect2(() => {
1310
+ if (!editorRef.current) {
1311
+ throw Error("editor not in dom");
1312
+ }
1313
+ viewRef.current = new EditorView2({
1314
+ state: createState(),
1315
+ parent: editorRef.current
1316
+ });
1317
+ return () => {
1318
+ var _a;
1319
+ (_a = viewRef.current) == null ? void 0 : _a.destroy();
1320
+ };
1321
+ }, [completionFn, createState]);
1322
+ return { editorRef, clearInput };
1323
+ };
1324
+
1325
+ // src/column-expression-input/ColumnExpressionInput.tsx
1326
+ import { jsx as jsx3 } from "react/jsx-runtime";
1327
+ var classBase3 = "vuuColumnExpressionInput";
1328
+ var ColumnExpressionInput = ({
1329
+ onChange,
1330
+ onSubmitExpression,
1331
+ suggestionProvider
1332
+ }) => {
1333
+ const { editorRef } = useColumnExpressionEditor({
1334
+ onChange,
1335
+ onSubmitExpression,
1336
+ suggestionProvider
1337
+ });
1338
+ return /* @__PURE__ */ jsx3("div", { className: `${classBase3}`, ref: editorRef });
1339
+ };
1340
+
1341
+ // src/column-expression-input/useColumnExpressionSuggestionProvider.ts
1342
+ import {
1343
+ AnnotationType,
1344
+ getRelationalOperators,
1345
+ numericOperators,
1346
+ stringOperators,
1347
+ toSuggestions
1348
+ } from "@vuu-ui/vuu-codemirror";
1349
+ import {
1350
+ getTypeaheadParams,
1351
+ useTypeaheadSuggestions
1352
+ } from "@vuu-ui/vuu-data-react";
1353
+ import { isNumericColumn, isTextColumn } from "@vuu-ui/vuu-utils";
1354
+ import { useCallback as useCallback2, useRef as useRef3 } from "react";
1355
+
1356
+ // src/column-expression-input/column-function-descriptors.ts
1357
+ var columnFunctionDescriptors = [
1358
+ /**
1359
+ * concatenate()
1360
+ */
1361
+ {
1362
+ accepts: "string",
1363
+ description: "Returns multiple string values as a single joined string. Arguments may be string literal values, string columns or other string expressions. Non string arguments may also be included, these will be converted to strings.",
1364
+ example: {
1365
+ expression: 'concatenate("example", "-test")',
1366
+ result: '"example-test"'
1367
+ },
1368
+ name: "concatenate",
1369
+ params: {
1370
+ description: "( string, string, [ string* ] )"
1371
+ },
1372
+ type: "string"
1373
+ },
1374
+ /**
1375
+ * contains()
1376
+ */
1377
+ {
1378
+ accepts: ["string", "string"],
1379
+ description: "Tests a string value to determine whether it contains a given substring. Accepts two arguments: source text and target substring. Returns true if <source text> contains one or more occurrences of <target subscring>",
1380
+ example: {
1381
+ expression: 'contains("Royal Bank of Scotland", "bank")',
1382
+ result: "true"
1383
+ },
1384
+ name: "contains",
1385
+ params: {
1386
+ description: "( string )"
1387
+ },
1388
+ type: "boolean"
1389
+ },
1390
+ /**
1391
+ * left()
1392
+ */
1393
+ {
1394
+ accepts: ["string", "number"],
1395
+ description: "Returns the leftmost <number> characters from <string>. First argument may be a string literal, string column or other string expression.",
1396
+ example: {
1397
+ expression: 'left("USD Benchmark Report", 3)',
1398
+ result: '"USD"'
1399
+ },
1400
+ name: "left",
1401
+ params: {
1402
+ count: 2,
1403
+ description: "( string, number )"
1404
+ },
1405
+ type: "string"
1406
+ },
1407
+ /**
1408
+ * len()
1409
+ */
1410
+ {
1411
+ accepts: "string",
1412
+ description: "Returns the number of characters in <string>. Argument may be a string literal, string column or other string expression.",
1413
+ example: {
1414
+ expression: 'len("example")',
1415
+ result: "7"
1416
+ },
1417
+ name: "len",
1418
+ params: {
1419
+ description: "(string)"
1420
+ },
1421
+ type: "number"
1422
+ },
1423
+ /**
1424
+ * lower()
1425
+ */
1426
+ {
1427
+ accepts: "string",
1428
+ description: "Convert a string value to lowercase. Argument may be a string column or other string expression.",
1429
+ example: {
1430
+ expression: 'lower("examPLE")',
1431
+ result: '"example"'
1432
+ },
1433
+ name: "lower",
1434
+ params: {
1435
+ description: "( string )"
1436
+ },
1437
+ type: "string"
1438
+ },
1439
+ /**
1440
+ * upper()
1441
+ */
1442
+ {
1443
+ accepts: "string",
1444
+ description: "Convert a string value to uppercase. Argument may be a string column or other string expression.",
1445
+ example: {
1446
+ expression: 'upper("example")',
1447
+ result: '"EXAMPLE"'
1448
+ },
1449
+ name: "upper",
1450
+ params: {
1451
+ description: "( string )"
1452
+ },
1453
+ type: "string"
1454
+ },
1455
+ /**
1456
+ * right()
1457
+ */
1458
+ {
1459
+ accepts: ["string", "number"],
1460
+ description: "Returns the rightmost <number> characters from <string>. First argument may be a string literal, string column or other string expression.",
1461
+ example: {
1462
+ expression: "blah",
1463
+ result: "blah"
1464
+ },
1465
+ name: "right",
1466
+ params: {
1467
+ description: "( string )"
1468
+ },
1469
+ type: "string"
1470
+ },
1471
+ /**
1472
+ * replace()
1473
+ */
1474
+ {
1475
+ accepts: ["string", "string", "string"],
1476
+ description: "Replace characters within a string. Accepts three arguments: source text, text to replace and replacement text. Returns a copy of <source text> with any occurrences of <text to replace> replaced by <replacement text>",
1477
+ example: {
1478
+ expression: "blah",
1479
+ result: "blah"
1480
+ },
1481
+ name: "replace",
1482
+ params: {
1483
+ description: "( string )"
1484
+ },
1485
+ type: "string"
1486
+ },
1487
+ /**
1488
+ * text()
1489
+ */
1490
+ {
1491
+ accepts: "number",
1492
+ description: "Converts a number to a string.",
1493
+ example: {
1494
+ expression: "blah",
1495
+ result: "blah"
1496
+ },
1497
+ name: "text",
1498
+ params: {
1499
+ description: "( string )"
1500
+ },
1501
+ type: "string"
1502
+ },
1503
+ /**
1504
+ * starts()
1505
+ */
1506
+ {
1507
+ accepts: "string",
1508
+ description: "Tests a string value to determine whether it starts with a given substring. Accepts two arguments: source text and target substring. Returns true if <source text> starts with <target subscring>.",
1509
+ example: {
1510
+ expression: "blah",
1511
+ result: "blah"
1512
+ },
1513
+ name: "starts",
1514
+ params: {
1515
+ description: "( string )"
1516
+ },
1517
+ type: "boolean"
1518
+ },
1519
+ /**
1520
+ * starts()
1521
+ */
1522
+ {
1523
+ accepts: "string",
1524
+ description: "Tests a string value to determine whether it ends with a given substring. Accepts two arguments: source text and target substring. Returns true if <source text> ends with <target subscring>.",
1525
+ example: {
1526
+ expression: "blah",
1527
+ result: "blah"
1528
+ },
1529
+ name: "ends",
1530
+ params: {
1531
+ description: "( string )"
1532
+ },
1533
+ type: "boolean"
1534
+ },
1535
+ {
1536
+ accepts: "number",
1537
+ description: "blah",
1538
+ example: {
1539
+ expression: "blah",
1540
+ result: "blah"
1541
+ },
1542
+ name: "min",
1543
+ params: {
1544
+ description: "( string )"
1545
+ },
1546
+ type: "number"
1547
+ },
1548
+ {
1549
+ accepts: "number",
1550
+ description: "blah",
1551
+ example: {
1552
+ expression: "blah",
1553
+ result: "blah"
1554
+ },
1555
+ name: "max",
1556
+ params: {
1557
+ description: "( string )"
1558
+ },
1559
+ type: "number"
1560
+ },
1561
+ {
1562
+ accepts: "number",
1563
+ description: "blah",
1564
+ example: {
1565
+ expression: "blah",
1566
+ result: "blah"
1567
+ },
1568
+ name: "sum",
1569
+ params: {
1570
+ description: "( string )"
1571
+ },
1572
+ type: "number"
1573
+ },
1574
+ {
1575
+ accepts: "number",
1576
+ description: "blah",
1577
+ example: {
1578
+ expression: "blah",
1579
+ result: "blah"
1580
+ },
1581
+ name: "round",
1582
+ params: {
1583
+ description: "( string )"
1584
+ },
1585
+ type: "number"
1586
+ },
1587
+ {
1588
+ accepts: "any",
1589
+ description: "blah",
1590
+ example: {
1591
+ expression: "blah",
1592
+ result: "blah"
1593
+ },
1594
+ name: "or",
1595
+ params: {
1596
+ description: "( string )"
1597
+ },
1598
+ type: "boolean"
1599
+ },
1600
+ {
1601
+ accepts: "any",
1602
+ description: "blah",
1603
+ example: {
1604
+ expression: "blah",
1605
+ result: "blah"
1606
+ },
1607
+ name: "and",
1608
+ params: {
1609
+ description: "( string )"
1610
+ },
1611
+ type: "boolean"
1612
+ },
1613
+ {
1614
+ accepts: "any",
1615
+ description: "Return one of two possible result values, depending on the evaluation of a filter expression. If <filterExpression> resolves to true, result is <expression1>, otherwise <expression2>. ",
1616
+ example: {
1617
+ expression: "blah",
1618
+ result: "blah"
1619
+ },
1620
+ name: "if",
1621
+ params: {
1622
+ description: "( filterExpression, expression1, expression 2)"
1623
+ },
1624
+ type: "variable"
1625
+ }
1626
+ ];
1627
+
1628
+ // src/column-expression-input/functionDocInfo.ts
1629
+ import { createEl as createEl2 } from "@vuu-ui/vuu-utils";
1630
+ var functionDocInfo = ({
1631
+ name,
1632
+ description,
1633
+ example,
1634
+ params,
1635
+ type
1636
+ }) => {
1637
+ const rootElement = createEl2("div", "vuuFunctionDoc");
1638
+ const headingElement = createEl2("div", "function-heading");
1639
+ const nameElement = createEl2("span", "function-name", name);
1640
+ const paramElement = createEl2("span", "param-list", params.description);
1641
+ const typeElement = createEl2("span", "function-type", type);
1642
+ headingElement.appendChild(nameElement);
1643
+ headingElement.appendChild(paramElement);
1644
+ headingElement.appendChild(typeElement);
1645
+ const child2 = createEl2("p", void 0, description);
1646
+ rootElement.appendChild(headingElement);
1647
+ rootElement.appendChild(child2);
1648
+ if (example) {
1649
+ const exampleElement = createEl2("div", "example-container", "Example:");
1650
+ const expressionElement = createEl2(
1651
+ "div",
1652
+ "example-expression",
1653
+ example.expression
1654
+ );
1655
+ const resultElement = createEl2("div", "example-result", example.result);
1656
+ exampleElement.appendChild(expressionElement);
1657
+ exampleElement.appendChild(resultElement);
1658
+ rootElement.appendChild(exampleElement);
1659
+ }
1660
+ return rootElement;
1661
+ };
1662
+
1663
+ // src/column-expression-input/useColumnExpressionSuggestionProvider.ts
1664
+ var NO_OPERATORS = [];
1665
+ var withApplySpace = (suggestions) => suggestions.map((suggestion) => {
1666
+ var _a;
1667
+ return {
1668
+ ...suggestion,
1669
+ apply: ((_a = suggestion.apply) != null ? _a : suggestion.label) + " "
1670
+ };
1671
+ });
1672
+ var getValidColumns = (columns, { functionName, operator }) => {
1673
+ if (operator) {
1674
+ return columns.filter(isNumericColumn);
1675
+ } else if (functionName) {
1676
+ const fn = columnFunctionDescriptors.find((f) => f.name === functionName);
1677
+ if (fn) {
1678
+ switch (fn.accepts) {
1679
+ case "string":
1680
+ return columns.filter(isTextColumn);
1681
+ case "number":
1682
+ return columns.filter(isNumericColumn);
1683
+ default:
1684
+ return columns;
1685
+ }
1686
+ }
1687
+ }
1688
+ return columns;
1689
+ };
1690
+ var getColumns = (columns, options) => {
1691
+ const validColumns = getValidColumns(columns, options);
1692
+ return validColumns.map((column) => {
1693
+ var _a;
1694
+ const label = (_a = column.label) != null ? _a : column.name;
1695
+ return {
1696
+ apply: options.prefix ? `${options.prefix}${label}` : label,
1697
+ label,
1698
+ boost: 5,
1699
+ type: "column",
1700
+ expressionType: column.serverDataType
1701
+ };
1702
+ });
1703
+ };
1704
+ var arithmeticOperators = [
1705
+ { apply: "* ", boost: 2, label: "*", type: "operator" },
1706
+ { apply: "/ ", boost: 2, label: "/", type: "operator" },
1707
+ { apply: "+ ", boost: 2, label: "+", type: "operator" },
1708
+ { apply: "- ", boost: 2, label: "-", type: "operator" }
1709
+ ];
1710
+ var getOperators = (column) => {
1711
+ if (column === void 0 || isNumericColumn(column)) {
1712
+ return arithmeticOperators;
1713
+ } else {
1714
+ return NO_OPERATORS;
1715
+ }
1716
+ };
1717
+ var getConditionOperators = (column) => {
1718
+ switch (column.serverDataType) {
1719
+ case "string":
1720
+ case "char":
1721
+ return withApplySpace(
1722
+ stringOperators
1723
+ /*, startsWith*/
1724
+ );
1725
+ case "int":
1726
+ case "long":
1727
+ case "double":
1728
+ return withApplySpace(numericOperators);
1729
+ }
1730
+ };
1731
+ var toFunctionCompletion = (functionDescriptor) => ({
1732
+ apply: `${functionDescriptor.name}( `,
1733
+ boost: 2,
1734
+ expressionType: functionDescriptor.type,
1735
+ info: () => functionDocInfo(functionDescriptor),
1736
+ label: functionDescriptor.name,
1737
+ type: "function"
1738
+ });
1739
+ var getAcceptedTypes = (fn) => {
1740
+ if (fn) {
1741
+ if (typeof fn.accepts === "string") {
1742
+ return fn.accepts;
1743
+ } else if (Array.isArray(fn.accepts)) {
1744
+ if (fn.accepts.every((s) => s === "string")) {
1745
+ return "string";
1746
+ } else {
1747
+ return "any";
1748
+ }
1749
+ }
1750
+ }
1751
+ return "any";
1752
+ };
1753
+ var functions = columnFunctionDescriptors.map(toFunctionCompletion);
1754
+ var getFunctions = ({ functionName }) => {
1755
+ if (functionName) {
1756
+ const fn = columnFunctionDescriptors.find((f) => f.name === functionName);
1757
+ const acceptedTypes = getAcceptedTypes(fn);
1758
+ if (fn) {
1759
+ switch (acceptedTypes) {
1760
+ case "string":
1761
+ return columnFunctionDescriptors.filter((f) => f.type === "string" || f.type === "variable").map(toFunctionCompletion);
1762
+ case "number":
1763
+ return columnFunctionDescriptors.filter((f) => f.type === "number" || f.type === "variable").map(toFunctionCompletion);
1764
+ default:
1765
+ }
1766
+ }
1767
+ }
1768
+ return functions;
1769
+ };
1770
+ var NONE = {};
1771
+ var useColumnExpressionSuggestionProvider = ({
1772
+ columns,
1773
+ table
1774
+ }) => {
1775
+ const findColumn = useCallback2(
1776
+ (name) => name ? columns.find((col) => col.name === name) : void 0,
1777
+ [columns]
1778
+ );
1779
+ const latestSuggestionsRef = useRef3();
1780
+ const getTypeaheadSuggestions = useTypeaheadSuggestions();
1781
+ const getSuggestions = useCallback2(
1782
+ async (suggestionType, options = NONE) => {
1783
+ const { columnName, functionName, operator, prefix } = options;
1784
+ switch (suggestionType) {
1785
+ case "expression": {
1786
+ const suggestions = await withApplySpace(
1787
+ getColumns(columns, { functionName, prefix })
1788
+ ).concat(getFunctions(options));
1789
+ return latestSuggestionsRef.current = suggestions;
1790
+ }
1791
+ case "column": {
1792
+ const suggestions = await getColumns(columns, options);
1793
+ return latestSuggestionsRef.current = withApplySpace(suggestions);
1794
+ }
1795
+ case "operator": {
1796
+ const suggestions = await getOperators(findColumn(columnName));
1797
+ return latestSuggestionsRef.current = withApplySpace(suggestions);
1798
+ }
1799
+ case "relational-operator": {
1800
+ const suggestions = await getRelationalOperators(
1801
+ findColumn(columnName)
1802
+ );
1803
+ return latestSuggestionsRef.current = withApplySpace(suggestions);
1804
+ }
1805
+ case "condition-operator":
1806
+ {
1807
+ const column = findColumn(columnName);
1808
+ if (column) {
1809
+ const suggestions = await getConditionOperators(column);
1810
+ if (suggestions) {
1811
+ return latestSuggestionsRef.current = withApplySpace(suggestions);
1812
+ }
1813
+ }
1814
+ }
1815
+ break;
1816
+ case "columnValue":
1817
+ if (columnName && operator) {
1818
+ const params = getTypeaheadParams(
1819
+ table,
1820
+ columnName
1821
+ /*, startsWith*/
1822
+ );
1823
+ const suggestions = await getTypeaheadSuggestions(params);
1824
+ latestSuggestionsRef.current = toSuggestions(suggestions, {
1825
+ suffix: ""
1826
+ });
1827
+ latestSuggestionsRef.current.forEach((suggestion) => {
1828
+ suggestion.apply = (view, completion, from) => {
1829
+ const annotation = new AnnotationType();
1830
+ const cursorPos = from + completion.label.length + 1;
1831
+ view.dispatch({
1832
+ changes: { from, insert: completion.label },
1833
+ selection: { anchor: cursorPos, head: cursorPos },
1834
+ annotations: annotation.of(completion)
1835
+ });
1836
+ };
1837
+ });
1838
+ return latestSuggestionsRef.current;
1839
+ }
1840
+ break;
1841
+ }
1842
+ return [];
1843
+ },
1844
+ [columns, findColumn, getTypeaheadSuggestions, table]
1845
+ );
1846
+ const isPartialMatch = useCallback2(
1847
+ async (valueType, columnName, pattern) => {
1848
+ const { current: latestSuggestions } = latestSuggestionsRef;
1849
+ let maybe = false;
1850
+ const suggestions = latestSuggestions || await getSuggestions(valueType, { columnName });
1851
+ if (pattern && suggestions) {
1852
+ for (const option of suggestions) {
1853
+ if (option.label === pattern) {
1854
+ return false;
1855
+ } else if (option.label.startsWith(pattern)) {
1856
+ maybe = true;
1857
+ }
1858
+ }
1859
+ }
1860
+ return maybe;
1861
+ },
1862
+ [getSuggestions]
1863
+ );
1864
+ return {
1865
+ getSuggestions,
1866
+ isPartialMatch
1867
+ };
1868
+ };
1869
+
1870
+ // src/datagrid-configuration-ui/settings-panel/DatagridSettingsPanel.tsx
1871
+ import { Button as Button3, Panel as Panel5 } from "@salt-ds/core";
1872
+ import cx6 from "classnames";
1873
+ import {
1874
+ useCallback as useCallback8,
1875
+ useState as useState4
1876
+ } from "react";
1877
+
1878
+ // src/datagrid-configuration-ui/column-picker/ColumnPicker.tsx
1879
+ import { List } from "@heswell/salt-lab";
1880
+ import { Button, Text, useIdMemo as useId } from "@salt-ds/core";
1881
+ import { useCallback as useCallback3, useState } from "react";
1882
+
1883
+ // src/datagrid-configuration-ui/column-picker/ColumnListItem.tsx
1884
+ import { ListItem } from "@heswell/salt-lab";
1885
+ import cx3 from "classnames";
1886
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
1887
+ var classBase4 = "vuuColumnListItem";
1888
+ var ColumnListItem = ({
1889
+ className: classNameProp,
1890
+ item,
1891
+ label,
1892
+ style: styleProp,
1893
+ ...restProps
1894
+ }) => {
1895
+ const className = cx3(classBase4, classNameProp, {
1896
+ [`${classBase4}-calculated`]: item == null ? void 0 : item.expression,
1897
+ [`${classBase4}-hidden`]: item == null ? void 0 : item.hidden
1898
+ });
1899
+ return /* @__PURE__ */ jsxs3(ListItem, { className, ...restProps, children: [
1900
+ /* @__PURE__ */ jsx4("span", { className: `${classBase4}-iconType` }),
1901
+ /* @__PURE__ */ jsx4("label", { className: `${classBase4}-label`, children: label }),
1902
+ /* @__PURE__ */ jsx4("span", { className: `${classBase4}-iconHidden` })
1903
+ ] });
1904
+ };
1905
+
1906
+ // src/datagrid-configuration-ui/column-picker/ColumnPicker.tsx
1907
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
1908
+ var classBase5 = "vuuColumnPicker";
1909
+ var removeSelectedColumns = (availableColumns, selectedColumns) => {
1910
+ return availableColumns.filter(
1911
+ (column) => selectedColumns.find((col) => col.name === column.name) == null
1912
+ );
1913
+ };
1914
+ var ColumnPicker = ({
1915
+ availableColumns,
1916
+ id: idProp,
1917
+ dispatchColumnAction: dispatch,
1918
+ onAddCalculatedColumnClick,
1919
+ onSelectionChange,
1920
+ chosenColumns,
1921
+ selectedColumn
1922
+ }) => {
1923
+ const [selected1, setSelected1] = useState([]);
1924
+ const id = useId(idProp);
1925
+ const unusedColumns = removeSelectedColumns(availableColumns, chosenColumns);
1926
+ const addColumn2 = useCallback3(() => {
1927
+ if (selected1.length > 0) {
1928
+ setSelected1([]);
1929
+ dispatch({ type: "addColumn", columns: selected1 });
1930
+ }
1931
+ }, [dispatch, selected1]);
1932
+ const removeColumn2 = useCallback3(
1933
+ () => selectedColumn && dispatch({ type: "removeColumn", column: selectedColumn }),
1934
+ [selectedColumn, dispatch]
1935
+ );
1936
+ const moveColumnUp = useCallback3(
1937
+ () => selectedColumn && dispatch({ type: "moveColumn", column: selectedColumn, moveBy: -1 }),
1938
+ [dispatch, selectedColumn]
1939
+ );
1940
+ const moveColumnDown = useCallback3(
1941
+ () => selectedColumn && dispatch({ type: "moveColumn", column: selectedColumn, moveBy: 1 }),
1942
+ [dispatch, selectedColumn]
1943
+ );
1944
+ const handleSelectionChange1 = useCallback3(
1945
+ (evt, selected) => setSelected1(selected),
1946
+ []
1947
+ );
1948
+ const handleSelectionChange2 = useCallback3(
1949
+ (evt, selected) => onSelectionChange == null ? void 0 : onSelectionChange(selected),
1950
+ [onSelectionChange]
1951
+ );
1952
+ const handleDrop = useCallback3(
1953
+ (moveFrom, moveTo) => {
1954
+ dispatch({ type: "moveColumn", moveFrom, moveTo });
1955
+ },
1956
+ [dispatch]
1957
+ );
1958
+ return /* @__PURE__ */ jsxs4("div", { className: classBase5, id, children: [
1959
+ /* @__PURE__ */ jsxs4("div", { className: `${classBase5}-listColumn`, children: [
1960
+ /* @__PURE__ */ jsx5("label", { htmlFor: `available-${id}`, children: /* @__PURE__ */ jsx5(Text, { as: "h4", children: "Available Columns" }) }),
1961
+ /* @__PURE__ */ jsx5(
1962
+ "div",
1963
+ {
1964
+ className: `${classBase5}-listContainer`,
1965
+ style: { flex: 1, overflow: "hidden" },
1966
+ children: /* @__PURE__ */ jsx5(
1967
+ List,
1968
+ {
1969
+ borderless: true,
1970
+ checkable: false,
1971
+ height: "100%",
1972
+ id: `available-${id}`,
1973
+ itemHeight: 24,
1974
+ itemToString: (item) => item.name,
1975
+ onSelectionChange: handleSelectionChange1,
1976
+ selected: selected1,
1977
+ selectionStrategy: "extended",
1978
+ source: unusedColumns
1979
+ }
1980
+ )
1981
+ }
1982
+ ),
1983
+ /* @__PURE__ */ jsx5(
1984
+ "div",
1985
+ {
1986
+ style: {
1987
+ display: "flex",
1988
+ alignItems: "center",
1989
+ flex: "0 0 32px",
1990
+ marginTop: "var(--salt-size-basis-unit)"
1991
+ },
1992
+ children: /* @__PURE__ */ jsxs4(Button, { onClick: addColumn2, disabled: selected1.length === 0, children: [
1993
+ "Show",
1994
+ /* @__PURE__ */ jsx5("span", { "data-icon": "arrow-thin-right", style: { marginLeft: 8 } })
1995
+ ] })
1996
+ }
1997
+ )
1998
+ ] }),
1999
+ /* @__PURE__ */ jsxs4("div", { className: `${classBase5}-listColumn`, children: [
2000
+ /* @__PURE__ */ jsx5("label", { htmlFor: `selected-${id}`, children: /* @__PURE__ */ jsx5(Text, { as: "h4", children: "Included Columns" }) }),
2001
+ /* @__PURE__ */ jsx5(
2002
+ "div",
2003
+ {
2004
+ className: `${classBase5}-listContainer`,
2005
+ style: { flex: 1, overflow: "hidden" },
2006
+ children: /* @__PURE__ */ jsx5(
2007
+ List,
2008
+ {
2009
+ ListItem: ColumnListItem,
2010
+ allowDragDrop: true,
2011
+ borderless: true,
2012
+ height: "100%",
2013
+ id: `selected-${id}`,
2014
+ itemHeight: 24,
2015
+ itemToString: (item) => item.name,
2016
+ onMoveListItem: handleDrop,
2017
+ onSelectionChange: handleSelectionChange2,
2018
+ selected: selectedColumn,
2019
+ style: { flex: 1 },
2020
+ source: chosenColumns
2021
+ }
2022
+ )
2023
+ }
2024
+ ),
2025
+ /* @__PURE__ */ jsxs4(
2026
+ "div",
2027
+ {
2028
+ style: {
2029
+ alignItems: "center",
2030
+ flex: "0 0 32px",
2031
+ display: "flex",
2032
+ gap: 6,
2033
+ marginTop: "var(--salt-size-basis-unit)"
2034
+ },
2035
+ children: [
2036
+ /* @__PURE__ */ jsxs4(Button, { onClick: removeColumn2, disabled: selectedColumn === null, children: [
2037
+ /* @__PURE__ */ jsx5("span", { "data-icon": "arrow-thin-left", style: { marginRight: 8 } }),
2038
+ "Hide"
2039
+ ] }),
2040
+ /* @__PURE__ */ jsx5(
2041
+ Button,
2042
+ {
2043
+ "aria-label": "Move column up",
2044
+ onClick: moveColumnUp,
2045
+ disabled: selectedColumn === null || (chosenColumns == null ? void 0 : chosenColumns.indexOf(selectedColumn)) === 0,
2046
+ style: { width: 28 },
2047
+ children: /* @__PURE__ */ jsx5("span", { "data-icon": "arrow-thin-up" })
2048
+ }
2049
+ ),
2050
+ /* @__PURE__ */ jsx5(
2051
+ Button,
2052
+ {
2053
+ "aria-label": "Move column down",
2054
+ onClick: moveColumnDown,
2055
+ disabled: selectedColumn === null || chosenColumns.indexOf(selectedColumn) === chosenColumns.length - 1,
2056
+ style: { width: 28 },
2057
+ children: /* @__PURE__ */ jsx5("span", { "data-icon": "arrow-thin-down" })
2058
+ }
2059
+ ),
2060
+ /* @__PURE__ */ jsx5(
2061
+ Button,
2062
+ {
2063
+ "aria-label": "Add calculated column",
2064
+ className: `${classBase5}-addCalculatedColumn`,
2065
+ onClick: onAddCalculatedColumnClick,
2066
+ variant: "primary",
2067
+ children: /* @__PURE__ */ jsx5("span", { "data-icon": "add" })
2068
+ }
2069
+ )
2070
+ ]
2071
+ }
2072
+ )
2073
+ ] })
2074
+ ] });
2075
+ };
2076
+
2077
+ // src/datagrid-configuration-ui/column-settings-panel/ColumnSettingsPanel.tsx
2078
+ import { Stack } from "@vuu-ui/vuu-layout";
2079
+ import {
2080
+ Checkbox,
2081
+ FormField as FormField2,
2082
+ Input,
2083
+ RadioButton,
2084
+ RadioButtonGroup,
2085
+ StepperInput as StepperInput2
2086
+ } from "@heswell/salt-lab";
2087
+ import { Panel as Panel2, Text as Text3 } from "@salt-ds/core";
2088
+ import cx5 from "classnames";
2089
+ import {
2090
+ useCallback as useCallback5,
2091
+ useState as useState2
2092
+ } from "react";
2093
+
2094
+ // src/datagrid-configuration-ui/column-type-panel/ColumnTypePanel.tsx
2095
+ import { getRegisteredCellRenderers } from "@vuu-ui/vuu-utils";
2096
+ import { Dropdown } from "@heswell/salt-lab";
2097
+ import { Panel } from "@salt-ds/core";
2098
+ import cx4 from "classnames";
2099
+ import { useMemo as useMemo2 } from "react";
2100
+
2101
+ // src/datagrid-configuration-ui/column-type-panel/NumericColumnPanel.tsx
2102
+ import { FormField, StepperInput, Switch } from "@heswell/salt-lab";
2103
+ import { Text as Text2 } from "@salt-ds/core";
2104
+ import { useCallback as useCallback4 } from "react";
2105
+ import { Fragment, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
2106
+ var defaultValues = {
2107
+ alignOnDecimals: false,
2108
+ decimals: 4,
2109
+ zeroPad: false
2110
+ };
2111
+ var getColumnValues = (columnType, gridDefaultValues) => {
2112
+ const columnValue = typeof columnType === "object" && columnType.formatting ? columnType.formatting : {};
2113
+ const properties = ["alignOnDecimals", "decimals", "zeroPad"];
2114
+ return properties.reduce((configValues, property) => {
2115
+ if (columnValue[property] !== void 0) {
2116
+ return {
2117
+ ...configValues,
2118
+ [property]: columnValue[property]
2119
+ };
2120
+ } else if ((gridDefaultValues == null ? void 0 : gridDefaultValues[property]) !== void 0) {
2121
+ return {
2122
+ ...configValues,
2123
+ [property]: gridDefaultValues[property]
2124
+ };
2125
+ }
2126
+ return configValues;
2127
+ }, defaultValues);
2128
+ };
2129
+ var NumericColumnPanel = ({
2130
+ column,
2131
+ dispatchColumnAction
2132
+ }) => {
2133
+ const { decimals, alignOnDecimals, zeroPad } = getColumnValues(column == null ? void 0 : column.type);
2134
+ const dispatchUpdate = useCallback4(
2135
+ (values) => dispatchColumnAction({
2136
+ type: "updateColumnTypeFormatting",
2137
+ column,
2138
+ ...values
2139
+ }),
2140
+ [column, dispatchColumnAction]
2141
+ );
2142
+ const handleChangeDecimals = useCallback4(
2143
+ (value) => dispatchUpdate({ decimals: parseInt(value.toString(), 10) }),
2144
+ [dispatchUpdate]
2145
+ );
2146
+ const handleChangeAlignOnDecimals = useCallback4(
2147
+ (evt, value) => dispatchUpdate({ alignOnDecimals: value }),
2148
+ [dispatchUpdate]
2149
+ );
2150
+ const handleChangeZeroPad = useCallback4(
2151
+ (evt, value) => dispatchUpdate({ zeroPad: value }),
2152
+ [dispatchUpdate]
2153
+ );
2154
+ switch (column.serverDataType) {
2155
+ case "double":
2156
+ return /* @__PURE__ */ jsxs5(Fragment, { children: [
2157
+ /* @__PURE__ */ jsx6(FormField, { label: "No of Decimals", labelPlacement: "top", children: /* @__PURE__ */ jsx6(StepperInput, { value: decimals, onChange: handleChangeDecimals }) }),
2158
+ /* @__PURE__ */ jsx6(
2159
+ Switch,
2160
+ {
2161
+ checked: alignOnDecimals,
2162
+ label: "Align on decimals",
2163
+ LabelProps: { className: "vuuColumnPanelSwitch" },
2164
+ onChange: handleChangeAlignOnDecimals
2165
+ }
2166
+ ),
2167
+ /* @__PURE__ */ jsx6(
2168
+ Switch,
2169
+ {
2170
+ checked: zeroPad,
2171
+ label: "Zero pad",
2172
+ LabelProps: { className: "vuuColumnPanelSwitch" },
2173
+ onChange: handleChangeZeroPad
2174
+ }
2175
+ )
2176
+ ] });
2177
+ case "long":
2178
+ case "int":
2179
+ return /* @__PURE__ */ jsx6(Fragment, { children: /* @__PURE__ */ jsx6(Text2, { children: "Work in progress" }) });
2180
+ default:
2181
+ return null;
2182
+ }
2183
+ };
2184
+
2185
+ // src/datagrid-configuration-ui/column-type-panel/StringColumnPanel.tsx
2186
+ import { Fragment as Fragment2, jsx as jsx7 } from "react/jsx-runtime";
2187
+ var StringColumnPanel = ({
2188
+ column,
2189
+ dispatchColumnAction
2190
+ }) => {
2191
+ console.log({ column, dispatchColumnAction });
2192
+ return /* @__PURE__ */ jsx7(Fragment2, { children: "what" });
2193
+ };
2194
+
2195
+ // src/datagrid-configuration-ui/column-type-panel/ColumnTypePanel.tsx
2196
+ import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
2197
+ var classBase6 = "vuuColumnTypePanel";
2198
+ var integerCellRenderers = ["Default Renderer (int, long)"];
2199
+ var doubleCellRenderers = ["Default Renderer (double)"];
2200
+ var stringCellRenderers = ["Default Renderer (string)"];
2201
+ var getAvailableCellRenderers = (column) => {
2202
+ const customCellRenderers = getRegisteredCellRenderers(column.serverDataType);
2203
+ const customRendererNames = customCellRenderers.map((r) => r.name);
2204
+ console.log({ customRendererNames });
2205
+ switch (column.serverDataType) {
2206
+ case "char":
2207
+ case "string":
2208
+ return stringCellRenderers;
2209
+ case "int":
2210
+ case "long":
2211
+ return integerCellRenderers;
2212
+ case "double":
2213
+ return doubleCellRenderers.concat(customRendererNames);
2214
+ default:
2215
+ return stringCellRenderers;
2216
+ }
2217
+ };
2218
+ var ColumnTypePanel = ({
2219
+ className,
2220
+ column,
2221
+ dispatchColumnAction,
2222
+ ...props
2223
+ }) => {
2224
+ const content = useMemo2(() => {
2225
+ switch (column.serverDataType) {
2226
+ case "double":
2227
+ case "int":
2228
+ case "long":
2229
+ return /* @__PURE__ */ jsx8(
2230
+ NumericColumnPanel,
2231
+ {
2232
+ column,
2233
+ dispatchColumnAction
2234
+ }
2235
+ );
2236
+ default:
2237
+ return /* @__PURE__ */ jsx8(
2238
+ StringColumnPanel,
2239
+ {
2240
+ column,
2241
+ dispatchColumnAction
2242
+ }
2243
+ );
2244
+ }
2245
+ }, [column, dispatchColumnAction]);
2246
+ const { serverDataType = "string" } = column;
2247
+ const availableRenderers = getAvailableCellRenderers(column);
2248
+ return /* @__PURE__ */ jsxs6(Fragment3, { children: [
2249
+ /* @__PURE__ */ jsx8(
2250
+ Dropdown,
2251
+ {
2252
+ className: cx4(`${classBase6}-renderer`),
2253
+ fullWidth: true,
2254
+ selected: availableRenderers[0],
2255
+ source: availableRenderers
2256
+ }
2257
+ ),
2258
+ /* @__PURE__ */ jsx8(
2259
+ Panel,
2260
+ {
2261
+ ...props,
2262
+ className: cx4(classBase6, className, `${classBase6}-${serverDataType}`),
2263
+ children: content
2264
+ }
2265
+ )
2266
+ ] });
2267
+ };
2268
+
2269
+ // src/datagrid-configuration-ui/column-settings-panel/ColumnSettingsPanel.tsx
2270
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
2271
+ var classBase7 = "vuuColumnSettingsPanel";
2272
+ var tabstripProps = {
2273
+ className: "salt-density-high"
2274
+ };
2275
+ var NullActivationIndicator = () => null;
2276
+ var ColumnSettingsPanel = ({
2277
+ column,
2278
+ dispatchColumnAction,
2279
+ style: styleProp,
2280
+ ...props
2281
+ }) => {
2282
+ var _a, _b, _c, _d;
2283
+ const [activeTab, setActiveTab] = useState2(0);
2284
+ const dispatchUpdate = useCallback5(
2285
+ (values) => dispatchColumnAction({
2286
+ type: "updateColumnProp",
2287
+ column,
2288
+ ...values
2289
+ }),
2290
+ [column, dispatchColumnAction]
2291
+ );
2292
+ const handleChangeAlign = useCallback5(
2293
+ (evt) => dispatchUpdate({ align: evt.target.value }),
2294
+ [dispatchUpdate]
2295
+ );
2296
+ const handleChangePin = useCallback5(
2297
+ (evt) => dispatchUpdate({ pin: evt.target.value }),
2298
+ [dispatchUpdate]
2299
+ );
2300
+ const handleChangeHidden = useCallback5(
2301
+ (evt, value) => dispatchUpdate({ hidden: value }),
2302
+ [dispatchUpdate]
2303
+ );
2304
+ const handleChangeLabel = useCallback5(
2305
+ (evt, value) => dispatchUpdate({ label: value }),
2306
+ [dispatchUpdate]
2307
+ );
2308
+ const handleChangeWidth = useCallback5(
2309
+ (value) => dispatchUpdate({ width: parseInt(value.toString(), 10) }),
2310
+ [dispatchUpdate]
2311
+ );
2312
+ return /* @__PURE__ */ jsxs7(
2313
+ "div",
2314
+ {
2315
+ className: classBase7,
2316
+ ...props,
2317
+ style: {
2318
+ ...styleProp
2319
+ },
2320
+ children: [
2321
+ /* @__PURE__ */ jsx9(Text3, { as: "h4", children: "Column Settings" }),
2322
+ /* @__PURE__ */ jsxs7(
2323
+ Stack,
2324
+ {
2325
+ active: activeTab,
2326
+ showTabs: true,
2327
+ className: cx5(`${classBase7}-columnTabs`),
2328
+ onTabSelectionChanged: setActiveTab,
2329
+ TabstripProps: tabstripProps,
2330
+ children: [
2331
+ /* @__PURE__ */ jsxs7(Panel2, { title: "Column", children: [
2332
+ /* @__PURE__ */ jsx9(FormField2, { label: "Hidden", labelPlacement: "left", children: /* @__PURE__ */ jsx9(
2333
+ Checkbox,
2334
+ {
2335
+ checked: column.hidden === true,
2336
+ onChange: handleChangeHidden
2337
+ }
2338
+ ) }),
2339
+ /* @__PURE__ */ jsx9(FormField2, { label: "Label", labelPlacement: "left", children: /* @__PURE__ */ jsx9(
2340
+ Input,
2341
+ {
2342
+ value: (_a = column.label) != null ? _a : column.name,
2343
+ onChange: handleChangeLabel
2344
+ }
2345
+ ) }),
2346
+ /* @__PURE__ */ jsx9(FormField2, { label: "Width", labelPlacement: "left", children: /* @__PURE__ */ jsx9(
2347
+ StepperInput2,
2348
+ {
2349
+ value: (_b = column.width) != null ? _b : 100,
2350
+ onChange: handleChangeWidth
2351
+ }
2352
+ ) }),
2353
+ /* @__PURE__ */ jsx9(
2354
+ FormField2,
2355
+ {
2356
+ label: "Align",
2357
+ labelPlacement: "left",
2358
+ ActivationIndicatorComponent: NullActivationIndicator,
2359
+ children: /* @__PURE__ */ jsxs7(
2360
+ RadioButtonGroup,
2361
+ {
2362
+ "aria-label": "Column Align",
2363
+ value: (_c = column.align) != null ? _c : "left",
2364
+ legend: "Align",
2365
+ onChange: handleChangeAlign,
2366
+ children: [
2367
+ /* @__PURE__ */ jsx9(RadioButton, { label: "Left", value: "left" }),
2368
+ /* @__PURE__ */ jsx9(RadioButton, { label: "Right", value: "right" })
2369
+ ]
2370
+ }
2371
+ )
2372
+ }
2373
+ ),
2374
+ /* @__PURE__ */ jsx9(
2375
+ FormField2,
2376
+ {
2377
+ label: "Pin Column",
2378
+ labelPlacement: "left",
2379
+ ActivationIndicatorComponent: NullActivationIndicator,
2380
+ children: /* @__PURE__ */ jsxs7(
2381
+ RadioButtonGroup,
2382
+ {
2383
+ "aria-label": "Pin Column",
2384
+ value: (_d = column.pin) != null ? _d : "",
2385
+ legend: "Pin Column",
2386
+ onChange: handleChangePin,
2387
+ children: [
2388
+ /* @__PURE__ */ jsx9(RadioButton, { label: "Do not pin", value: "" }),
2389
+ /* @__PURE__ */ jsx9(RadioButton, { label: "Left", value: "left" }),
2390
+ /* @__PURE__ */ jsx9(RadioButton, { label: "Right", value: "right" })
2391
+ ]
2392
+ }
2393
+ )
2394
+ }
2395
+ )
2396
+ ] }),
2397
+ /* @__PURE__ */ jsx9(
2398
+ ColumnTypePanel,
2399
+ {
2400
+ column,
2401
+ dispatchColumnAction,
2402
+ title: "Data Cell"
2403
+ }
2404
+ ),
2405
+ /* @__PURE__ */ jsxs7(Panel2, { title: "Vuu", variant: "secondary", children: [
2406
+ /* @__PURE__ */ jsx9(
2407
+ FormField2,
2408
+ {
2409
+ label: "Name",
2410
+ labelPlacement: "top",
2411
+ readOnly: true,
2412
+ variant: "secondary",
2413
+ children: /* @__PURE__ */ jsx9(Input, { value: column.name })
2414
+ }
2415
+ ),
2416
+ /* @__PURE__ */ jsx9(
2417
+ FormField2,
2418
+ {
2419
+ label: "Vuu type",
2420
+ labelPlacement: "top",
2421
+ readOnly: true,
2422
+ variant: "secondary",
2423
+ children: /* @__PURE__ */ jsx9(Input, { value: column.serverDataType })
2424
+ }
2425
+ )
2426
+ ] })
2427
+ ]
2428
+ }
2429
+ )
2430
+ ]
2431
+ }
2432
+ );
2433
+ };
2434
+
2435
+ // src/datagrid-configuration-ui/settings-panel/GridSettingsPanel.tsx
2436
+ import {
2437
+ FormField as FormField3,
2438
+ RadioButton as RadioButton2,
2439
+ RadioButtonGroup as RadioButtonGroup2,
2440
+ StepperInput as StepperInput3
2441
+ } from "@heswell/salt-lab";
2442
+ import { Panel as Panel3, Text as Text4 } from "@salt-ds/core";
2443
+ import { useCallback as useCallback6 } from "react";
2444
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
2445
+ var classBase8 = "vuuGridSettingsPanel";
2446
+ var NullActivationIndicator2 = () => null;
2447
+ var GridSettingsPanel = ({
2448
+ config,
2449
+ dispatchColumnAction,
2450
+ style: styleProp,
2451
+ ...props
2452
+ }) => {
2453
+ var _a;
2454
+ const dispatchUpdate = useCallback6(
2455
+ (values) => dispatchColumnAction({
2456
+ type: "updateGridSettings",
2457
+ ...values
2458
+ }),
2459
+ [dispatchColumnAction]
2460
+ );
2461
+ const handleChangeLabelFormatting = useCallback6(
2462
+ (evt) => dispatchUpdate({
2463
+ columnFormatHeader: evt.target.value
2464
+ }),
2465
+ [dispatchUpdate]
2466
+ );
2467
+ const handleChangeWidth = useCallback6(
2468
+ (value) => dispatchUpdate({ columnDefaultWidth: parseInt(value.toString(), 10) }),
2469
+ [dispatchUpdate]
2470
+ );
2471
+ return /* @__PURE__ */ jsxs8(
2472
+ "div",
2473
+ {
2474
+ className: classBase8,
2475
+ ...props,
2476
+ style: {
2477
+ ...styleProp
2478
+ },
2479
+ children: [
2480
+ /* @__PURE__ */ jsx10(Text4, { as: "h4", children: "Grid Settings" }),
2481
+ /* @__PURE__ */ jsxs8(Panel3, { children: [
2482
+ /* @__PURE__ */ jsx10(
2483
+ FormField3,
2484
+ {
2485
+ label: "Format column labels",
2486
+ labelPlacement: "left",
2487
+ ActivationIndicatorComponent: NullActivationIndicator2,
2488
+ children: /* @__PURE__ */ jsxs8(
2489
+ RadioButtonGroup2,
2490
+ {
2491
+ "aria-label": "Format column labels",
2492
+ value: config.columnFormatHeader,
2493
+ legend: "Format column labels",
2494
+ onChange: handleChangeLabelFormatting,
2495
+ children: [
2496
+ /* @__PURE__ */ jsx10(RadioButton2, { label: "No Formatting", value: void 0 }),
2497
+ /* @__PURE__ */ jsx10(RadioButton2, { label: "Capitalize", value: "capitalize" }),
2498
+ /* @__PURE__ */ jsx10(RadioButton2, { label: "Uppercase", value: "uppercase" })
2499
+ ]
2500
+ }
2501
+ )
2502
+ }
2503
+ ),
2504
+ /* @__PURE__ */ jsx10(FormField3, { label: "Default Column Width", labelPlacement: "left", children: /* @__PURE__ */ jsx10(
2505
+ StepperInput3,
2506
+ {
2507
+ value: (_a = config.columnDefaultWidth) != null ? _a : 100,
2508
+ onChange: handleChangeWidth
2509
+ }
2510
+ ) })
2511
+ ] })
2512
+ ]
2513
+ }
2514
+ );
2515
+ };
2516
+
2517
+ // src/datagrid-configuration-ui/settings-panel/useGridSettings.ts
2518
+ import { useReducer } from "react";
2519
+ import { moveItem } from "@heswell/salt-lab";
2520
+ import { fromServerDataType } from "@vuu-ui/vuu-utils";
2521
+ var gridSettingsReducer = (state, action) => {
2522
+ console.log(`gridSettingsReducer ${action.type}`);
2523
+ switch (action.type) {
2524
+ case "addColumn":
2525
+ return addColumn(state, action);
2526
+ case "addCalculatedColumn":
2527
+ return addCalculatedColumn(state, action);
2528
+ case "moveColumn":
2529
+ return moveColumn(state, action);
2530
+ case "removeColumn":
2531
+ return removeColumn(state, action);
2532
+ case "updateColumn":
2533
+ return state;
2534
+ case "updateColumnProp":
2535
+ return updateColumnProp(state, action);
2536
+ case "updateGridSettings":
2537
+ return updateGridSettings(state, action);
2538
+ case "updateColumnTypeFormatting":
2539
+ return updateColumnTypeFormatting(state, action);
2540
+ default:
2541
+ return state;
2542
+ }
2543
+ };
2544
+ var useGridSettings = (config) => {
2545
+ const [state, dispatchColumnAction] = useReducer(
2546
+ gridSettingsReducer,
2547
+ config
2548
+ );
2549
+ return {
2550
+ gridSettings: state,
2551
+ dispatchColumnAction
2552
+ };
2553
+ };
2554
+ function addColumn(state, { column, columns, index = -1 }) {
2555
+ const { columns: stateColumns } = state;
2556
+ if (index === -1) {
2557
+ if (Array.isArray(columns)) {
2558
+ return { ...state, columns: stateColumns.concat(columns) };
2559
+ } else if (column) {
2560
+ return { ...state, columns: stateColumns.concat(column) };
2561
+ }
2562
+ }
2563
+ return state;
2564
+ }
2565
+ function addCalculatedColumn(state, { columnName, columnType, expression }) {
2566
+ const { columns: stateColumns } = state;
2567
+ const calculatedColumn = {
2568
+ name: columnName,
2569
+ expression,
2570
+ serverDataType: columnType
2571
+ };
2572
+ return { ...state, columns: stateColumns.concat(calculatedColumn) };
2573
+ }
2574
+ function removeColumn(state, { column }) {
2575
+ const { columns: stateColumns } = state;
2576
+ return {
2577
+ ...state,
2578
+ columns: stateColumns.filter((col) => col.name !== column.name)
2579
+ };
2580
+ }
2581
+ function moveColumn(state, { column, moveBy, moveFrom, moveTo }) {
2582
+ const { columns: stateColumns } = state;
2583
+ if (column && typeof moveBy === "number") {
2584
+ const idx = stateColumns.indexOf(column);
2585
+ const newColumns = stateColumns.slice();
2586
+ const [movedColumns] = newColumns.splice(idx, 1);
2587
+ newColumns.splice(idx + moveBy, 0, movedColumns);
2588
+ return {
2589
+ ...state,
2590
+ columns: newColumns
2591
+ };
2592
+ } else if (typeof moveFrom === "number" && typeof moveTo === "number") {
2593
+ return {
2594
+ ...state,
2595
+ columns: moveItem(stateColumns, moveFrom, moveTo)
2596
+ };
2597
+ } else {
2598
+ return state;
2599
+ }
2600
+ }
2601
+ function updateColumnProp(state, { align, column, hidden, label, width }) {
2602
+ let { columns: stateColumns } = state;
2603
+ if (align === "left" || align === "right") {
2604
+ stateColumns = replaceColumn(stateColumns, { ...column, align });
2605
+ }
2606
+ if (typeof hidden === "boolean") {
2607
+ stateColumns = replaceColumn(stateColumns, { ...column, hidden });
2608
+ }
2609
+ if (typeof label === "string") {
2610
+ stateColumns = replaceColumn(stateColumns, { ...column, label });
2611
+ }
2612
+ if (typeof width === "number") {
2613
+ stateColumns = replaceColumn(stateColumns, { ...column, width });
2614
+ }
2615
+ return {
2616
+ ...state,
2617
+ columns: stateColumns
2618
+ };
2619
+ }
2620
+ function updateGridSettings(state, { columnFormatHeader }) {
2621
+ return {
2622
+ ...state,
2623
+ columnFormatHeader: columnFormatHeader != null ? columnFormatHeader : state.columnFormatHeader
2624
+ };
2625
+ }
2626
+ function updateColumnTypeFormatting(state, {
2627
+ alignOnDecimals,
2628
+ column,
2629
+ decimals,
2630
+ zeroPad
2631
+ }) {
2632
+ const { columns: stateColumns } = state;
2633
+ const targetColumn = stateColumns.find((col) => col.name === column.name);
2634
+ if (targetColumn) {
2635
+ const {
2636
+ serverDataType = "string",
2637
+ type: columnType = fromServerDataType(serverDataType)
2638
+ } = column;
2639
+ const type = typeof columnType === "string" ? {
2640
+ name: columnType
2641
+ } : {
2642
+ ...columnType
2643
+ };
2644
+ if (typeof alignOnDecimals === "boolean") {
2645
+ type.formatting = {
2646
+ ...type.formatting,
2647
+ alignOnDecimals
2648
+ };
2649
+ }
2650
+ if (typeof decimals === "number") {
2651
+ type.formatting = {
2652
+ ...type.formatting,
2653
+ decimals
2654
+ };
2655
+ }
2656
+ if (typeof zeroPad === "boolean") {
2657
+ type.formatting = {
2658
+ ...type.formatting,
2659
+ zeroPad
2660
+ };
2661
+ }
2662
+ return {
2663
+ ...state,
2664
+ columns: replaceColumn(stateColumns, { ...column, type })
2665
+ };
2666
+ } else {
2667
+ return state;
2668
+ }
2669
+ }
2670
+ function replaceColumn(columns, column) {
2671
+ return columns.map((col) => col.name === column.name ? column : col);
2672
+ }
2673
+
2674
+ // src/datagrid-configuration-ui/settings-panel/DatagridSettingsPanel.tsx
2675
+ import { Stack as Stack2 } from "@vuu-ui/vuu-layout";
2676
+
2677
+ // src/datagrid-configuration-ui/calculated-column-panel/CalculatedColumnPanel.tsx
2678
+ import { FormField as FormField4, Input as Input2 } from "@heswell/salt-lab";
2679
+ import { Button as Button2, Panel as Panel4, Text as Text5 } from "@salt-ds/core";
2680
+ import {
2681
+ useCallback as useCallback7,
2682
+ useRef as useRef4,
2683
+ useState as useState3
2684
+ } from "react";
2685
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
2686
+ var CalculatedColumnPanel = ({
2687
+ columns,
2688
+ dispatchColumnAction,
2689
+ table
2690
+ }) => {
2691
+ const [columnName, setColumnName] = useState3("");
2692
+ const [, setExpression] = useState3();
2693
+ const sourceRef = useRef4("");
2694
+ const suggestionProvider = useColumnExpressionSuggestionProvider({
2695
+ columns,
2696
+ table
2697
+ });
2698
+ const handleChangeName = useCallback7(
2699
+ (evt) => {
2700
+ const { value } = evt.target;
2701
+ setColumnName(value);
2702
+ },
2703
+ []
2704
+ );
2705
+ const handleChangeExpression = useCallback7((source) => {
2706
+ sourceRef.current = source;
2707
+ }, []);
2708
+ const handleSubmitExpression = useCallback7(
2709
+ (source, expression) => {
2710
+ console.log({ source });
2711
+ setExpression(expression);
2712
+ },
2713
+ []
2714
+ );
2715
+ const handleSave = useCallback7(() => {
2716
+ if (sourceRef.current) {
2717
+ console.log(
2718
+ `save expression ${JSON.stringify(sourceRef.current, null, 2)}`
2719
+ );
2720
+ dispatchColumnAction({
2721
+ type: "addCalculatedColumn",
2722
+ columnName,
2723
+ expression: sourceRef.current,
2724
+ columnType: "string"
2725
+ });
2726
+ }
2727
+ }, [columnName, dispatchColumnAction]);
2728
+ return /* @__PURE__ */ jsxs9(Panel4, { className: "vuuCalculatedColumnPanel", title: "Define Computed Column", children: [
2729
+ /* @__PURE__ */ jsx11(Text5, { styleAs: "h4", children: "Define Computed Column" }),
2730
+ /* @__PURE__ */ jsx11(FormField4, { label: "Column Name", labelPlacement: "left", children: /* @__PURE__ */ jsx11(Input2, { value: columnName, onChange: handleChangeName }) }),
2731
+ /* @__PURE__ */ jsx11(
2732
+ ColumnExpressionInput,
2733
+ {
2734
+ onChange: handleChangeExpression,
2735
+ onSubmitExpression: handleSubmitExpression,
2736
+ suggestionProvider
2737
+ }
2738
+ ),
2739
+ /* @__PURE__ */ jsx11("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsx11(Button2, { onClick: handleSave, children: "Add Column" }) })
2740
+ ] });
2741
+ };
2742
+
2743
+ // src/datagrid-configuration-ui/settings-panel/DatagridSettingsPanel.tsx
2744
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
2745
+ var classBase9 = "vuuDatagridSettingsPanel";
2746
+ var getTabLabel = () => void 0;
2747
+ var icons = [
2748
+ "table-settings",
2749
+ "column-chooser",
2750
+ "column-settings",
2751
+ "define-column"
2752
+ ];
2753
+ var getTabIcon = (component, tabIndex) => icons[tabIndex];
2754
+ var DatagridSettingsPanel = ({
2755
+ availableColumns,
2756
+ className,
2757
+ gridConfig,
2758
+ onCancel,
2759
+ onConfigChange,
2760
+ ...props
2761
+ }) => {
2762
+ var _a;
2763
+ console.log(`DatagridSettingsPanel render`);
2764
+ const [selectedTabIndex, setSelectedTabIndex] = useState4(0);
2765
+ const { gridSettings, dispatchColumnAction } = useGridSettings(gridConfig);
2766
+ const [selectedColumnName, setSelectedColumnName] = useState4(
2767
+ null
2768
+ );
2769
+ const handleColumnSelected = useCallback8(
2770
+ (selected) => {
2771
+ setSelectedColumnName(selected ? selected.name : null);
2772
+ },
2773
+ []
2774
+ );
2775
+ const handleApply = useCallback8(
2776
+ (evt, closePanel = false) => {
2777
+ console.log(`1) DataGridSettingsPanel fire onConfigChange`);
2778
+ onConfigChange == null ? void 0 : onConfigChange(gridSettings, closePanel);
2779
+ },
2780
+ [gridSettings, onConfigChange]
2781
+ );
2782
+ const handleTabSelectionChanged = useCallback8((selectedTabIndex2) => {
2783
+ setSelectedTabIndex(selectedTabIndex2);
2784
+ }, []);
2785
+ const handleSave = useCallback8(
2786
+ (evt) => handleApply(evt, true),
2787
+ [handleApply]
2788
+ );
2789
+ const selectedColumn = selectedColumnName === null ? null : (_a = gridSettings.columns.find((col) => col.name === selectedColumnName)) != null ? _a : null;
2790
+ const tabstripProps3 = {
2791
+ activeTabIndex: selectedTabIndex,
2792
+ enableRenameTab: false,
2793
+ orientation: "vertical"
2794
+ };
2795
+ const handleAddCalculatedColumn = useCallback8(
2796
+ () => setSelectedTabIndex(3),
2797
+ []
2798
+ );
2799
+ const panelShift = selectedTabIndex === 2 ? "right" : void 0;
2800
+ return /* @__PURE__ */ jsxs10("div", { ...props, className: cx6(classBase9, className), children: [
2801
+ /* @__PURE__ */ jsxs10(
2802
+ Stack2,
2803
+ {
2804
+ TabstripProps: tabstripProps3,
2805
+ className: `${classBase9}-stack`,
2806
+ getTabIcon,
2807
+ getTabLabel,
2808
+ active: selectedTabIndex === 2 ? 1 : selectedTabIndex,
2809
+ onTabSelectionChanged: handleTabSelectionChanged,
2810
+ showTabs: true,
2811
+ children: [
2812
+ /* @__PURE__ */ jsx12(
2813
+ GridSettingsPanel,
2814
+ {
2815
+ config: gridSettings,
2816
+ dispatchColumnAction
2817
+ }
2818
+ ),
2819
+ /* @__PURE__ */ jsxs10("div", { className: `${classBase9}-columnPanels`, "data-align": panelShift, children: [
2820
+ /* @__PURE__ */ jsx12(
2821
+ ColumnPicker,
2822
+ {
2823
+ availableColumns,
2824
+ chosenColumns: gridSettings.columns,
2825
+ dispatchColumnAction,
2826
+ onSelectionChange: handleColumnSelected,
2827
+ onAddCalculatedColumnClick: handleAddCalculatedColumn,
2828
+ selectedColumn
2829
+ }
2830
+ ),
2831
+ selectedColumn === null ? /* @__PURE__ */ jsx12(Panel5, { className: "vuuColumnSettingsPanel", children: "Select a column" }) : /* @__PURE__ */ jsx12(
2832
+ ColumnSettingsPanel,
2833
+ {
2834
+ column: selectedColumn,
2835
+ dispatchColumnAction,
2836
+ style: { background: "white", flex: "1 0 150px" }
2837
+ }
2838
+ )
2839
+ ] }),
2840
+ /* @__PURE__ */ jsx12("div", { title: "Column Settings", children: "Column Settings" }),
2841
+ /* @__PURE__ */ jsx12(
2842
+ CalculatedColumnPanel,
2843
+ {
2844
+ columns: gridSettings.columns,
2845
+ dispatchColumnAction,
2846
+ table: { module: "SIMUL", table: "instruments" }
2847
+ }
2848
+ )
2849
+ ]
2850
+ }
2851
+ ),
2852
+ /* @__PURE__ */ jsxs10("div", { className: `${classBase9}-buttonBar`, children: [
2853
+ /* @__PURE__ */ jsx12(Button3, { onClick: onCancel, children: "Cancel" }),
2854
+ /* @__PURE__ */ jsx12(Button3, { onClick: handleApply, children: "Apply" }),
2855
+ /* @__PURE__ */ jsx12(Button3, { onClick: handleSave, children: "Save" })
2856
+ ] })
2857
+ ] });
2858
+ };
2859
+
2860
+ // src/datasource-stats/DatasourceStats.tsx
2861
+ import { useEffect as useEffect3, useState as useState5 } from "react";
2862
+ import cx7 from "classnames";
2863
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
2864
+ var classBase10 = "vuuDatasourceStats";
2865
+ var numberFormatter = new Intl.NumberFormat();
2866
+ var DataSourceStats = ({
2867
+ className: classNameProp,
2868
+ dataSource
2869
+ }) => {
2870
+ const [range, setRange] = useState5(dataSource.range);
2871
+ const [size, setSize] = useState5(dataSource.size);
2872
+ useEffect3(() => {
2873
+ setSize(dataSource.size);
2874
+ dataSource.on("resize", setSize);
2875
+ dataSource.on("range", setRange);
2876
+ }, [dataSource]);
2877
+ const className = cx7(classBase10, classNameProp);
2878
+ const from = numberFormatter.format(range.from);
2879
+ const to = numberFormatter.format(range.to - 1);
2880
+ const value = numberFormatter.format(size);
2881
+ return /* @__PURE__ */ jsxs11("div", { className, children: [
2882
+ /* @__PURE__ */ jsx13("span", { children: "Showing rows" }),
2883
+ /* @__PURE__ */ jsx13("span", { className: `${classBase10}-range`, children: from }),
2884
+ /* @__PURE__ */ jsx13("span", { className: `${classBase10}-range`, children: to }),
2885
+ /* @__PURE__ */ jsx13("span", { children: "of" }),
2886
+ /* @__PURE__ */ jsx13("span", { className: `${classBase10}-size`, children: value })
2887
+ ] });
2888
+ };
2889
+
2890
+ // src/table-settings/column-settings-panel/ColumnSettingsPanel.tsx
2891
+ import { Stack as Stack3 } from "@vuu-ui/vuu-layout";
2892
+ import {
2893
+ Checkbox as Checkbox2,
2894
+ FormField as FormField6,
2895
+ Input as Input3,
2896
+ RadioButton as RadioButton3,
2897
+ RadioButtonGroup as RadioButtonGroup3,
2898
+ StepperInput as StepperInput5
2899
+ } from "@heswell/salt-lab";
2900
+ import { Panel as Panel7, Text as Text7 } from "@salt-ds/core";
2901
+ import cx9 from "classnames";
2902
+ import {
2903
+ useCallback as useCallback10,
2904
+ useState as useState6
2905
+ } from "react";
2906
+
2907
+ // src/table-settings/column-type-panel/ColumnTypePanel.tsx
2908
+ import { getRegisteredCellRenderers as getRegisteredCellRenderers2 } from "@vuu-ui/vuu-utils";
2909
+ import { Dropdown as Dropdown2 } from "@heswell/salt-lab";
2910
+ import { Panel as Panel6 } from "@salt-ds/core";
2911
+ import cx8 from "classnames";
2912
+ import { useMemo as useMemo3 } from "react";
2913
+
2914
+ // src/table-settings/column-type-panel/NumericColumnPanel.tsx
2915
+ import { FormField as FormField5, StepperInput as StepperInput4, Switch as Switch2 } from "@heswell/salt-lab";
2916
+ import { Text as Text6 } from "@salt-ds/core";
2917
+ import { useCallback as useCallback9 } from "react";
2918
+ import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
2919
+ var defaultValues2 = {
2920
+ alignOnDecimals: false,
2921
+ decimals: 4,
2922
+ zeroPad: false
2923
+ };
2924
+ var getColumnValues2 = (columnType, gridDefaultValues) => {
2925
+ const columnValue = typeof columnType === "object" && columnType.formatting ? columnType.formatting : {};
2926
+ const properties = ["alignOnDecimals", "decimals", "zeroPad"];
2927
+ return properties.reduce((configValues, property) => {
2928
+ if (columnValue[property] !== void 0) {
2929
+ return {
2930
+ ...configValues,
2931
+ [property]: columnValue[property]
2932
+ };
2933
+ } else if ((gridDefaultValues == null ? void 0 : gridDefaultValues[property]) !== void 0) {
2934
+ return {
2935
+ ...configValues,
2936
+ [property]: gridDefaultValues[property]
2937
+ };
2938
+ }
2939
+ return configValues;
2940
+ }, defaultValues2);
2941
+ };
2942
+ var NumericColumnPanel2 = ({
2943
+ column,
2944
+ dispatchColumnAction
2945
+ }) => {
2946
+ const { decimals, alignOnDecimals, zeroPad } = getColumnValues2(column == null ? void 0 : column.type);
2947
+ const dispatchUpdate = useCallback9(
2948
+ (values) => dispatchColumnAction({
2949
+ type: "updateColumnTypeFormatting",
2950
+ column,
2951
+ ...values
2952
+ }),
2953
+ [column, dispatchColumnAction]
2954
+ );
2955
+ const handleChangeDecimals = useCallback9(
2956
+ (value) => dispatchUpdate({ decimals: parseInt(value.toString(), 10) }),
2957
+ [dispatchUpdate]
2958
+ );
2959
+ const handleChangeAlignOnDecimals = useCallback9(
2960
+ (evt, value) => dispatchUpdate({ alignOnDecimals: value }),
2961
+ [dispatchUpdate]
2962
+ );
2963
+ const handleChangeZeroPad = useCallback9(
2964
+ (evt, value) => dispatchUpdate({ zeroPad: value }),
2965
+ [dispatchUpdate]
2966
+ );
2967
+ switch (column.serverDataType) {
2968
+ case "double":
2969
+ return /* @__PURE__ */ jsxs12(Fragment4, { children: [
2970
+ /* @__PURE__ */ jsx14(FormField5, { label: "No of Decimals", labelPlacement: "top", children: /* @__PURE__ */ jsx14(StepperInput4, { value: decimals, onChange: handleChangeDecimals }) }),
2971
+ /* @__PURE__ */ jsx14(
2972
+ Switch2,
2973
+ {
2974
+ checked: alignOnDecimals,
2975
+ label: "Align on decimals",
2976
+ LabelProps: { className: "vuuColumnPanelSwitch" },
2977
+ onChange: handleChangeAlignOnDecimals
2978
+ }
2979
+ ),
2980
+ /* @__PURE__ */ jsx14(
2981
+ Switch2,
2982
+ {
2983
+ checked: zeroPad,
2984
+ label: "Zero pad",
2985
+ LabelProps: { className: "vuuColumnPanelSwitch" },
2986
+ onChange: handleChangeZeroPad
2987
+ }
2988
+ )
2989
+ ] });
2990
+ case "long":
2991
+ case "int":
2992
+ return /* @__PURE__ */ jsx14(Fragment4, { children: /* @__PURE__ */ jsx14(Text6, { children: "Work in progress" }) });
2993
+ default:
2994
+ return null;
2995
+ }
2996
+ };
2997
+
2998
+ // src/table-settings/column-type-panel/StringColumnPanel.tsx
2999
+ import { Fragment as Fragment5, jsx as jsx15 } from "react/jsx-runtime";
3000
+ var StringColumnPanel2 = ({
3001
+ column,
3002
+ dispatchColumnAction
3003
+ }) => {
3004
+ console.log(column, dispatchColumnAction);
3005
+ return /* @__PURE__ */ jsx15(Fragment5, { children: "what" });
3006
+ };
3007
+
3008
+ // src/table-settings/column-type-panel/ColumnTypePanel.tsx
3009
+ import { Fragment as Fragment6, jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
3010
+ var classBase11 = "vuuColumnTypePanel";
3011
+ var integerCellRenderers2 = ["Default Renderer (int, long)"];
3012
+ var doubleCellRenderers2 = ["Default Renderer (double)"];
3013
+ var stringCellRenderers2 = ["Default Renderer (string)"];
3014
+ var getAvailableCellRenderers2 = (column) => {
3015
+ const customCellRenderers = getRegisteredCellRenderers2(column.serverDataType);
3016
+ const customRendererNames = customCellRenderers.map((r) => r.name);
3017
+ console.log({ customRendererNames });
3018
+ switch (column.serverDataType) {
3019
+ case "char":
3020
+ case "string":
3021
+ return stringCellRenderers2;
3022
+ case "int":
3023
+ case "long":
3024
+ return integerCellRenderers2;
3025
+ case "double":
3026
+ return doubleCellRenderers2.concat(customRendererNames);
3027
+ default:
3028
+ return stringCellRenderers2;
3029
+ }
3030
+ };
3031
+ var ColumnTypePanel2 = ({
3032
+ className,
3033
+ column,
3034
+ dispatchColumnAction,
3035
+ ...props
3036
+ }) => {
3037
+ const content = useMemo3(() => {
3038
+ switch (column.serverDataType) {
3039
+ case "double":
3040
+ case "int":
3041
+ case "long":
3042
+ return /* @__PURE__ */ jsx16(
3043
+ NumericColumnPanel2,
3044
+ {
3045
+ column,
3046
+ dispatchColumnAction
3047
+ }
3048
+ );
3049
+ default:
3050
+ return /* @__PURE__ */ jsx16(
3051
+ StringColumnPanel2,
3052
+ {
3053
+ column,
3054
+ dispatchColumnAction
3055
+ }
3056
+ );
3057
+ }
3058
+ }, [column, dispatchColumnAction]);
3059
+ const { serverDataType = "string" } = column;
3060
+ const availableRenderers = getAvailableCellRenderers2(column);
3061
+ return /* @__PURE__ */ jsxs13(Fragment6, { children: [
3062
+ /* @__PURE__ */ jsx16(
3063
+ Dropdown2,
3064
+ {
3065
+ className: cx8(`${classBase11}-renderer`),
3066
+ fullWidth: true,
3067
+ selected: availableRenderers[0],
3068
+ source: availableRenderers
3069
+ }
3070
+ ),
3071
+ /* @__PURE__ */ jsx16(
3072
+ Panel6,
3073
+ {
3074
+ ...props,
3075
+ className: cx8(classBase11, className, `${classBase11}-${serverDataType}`),
3076
+ children: content
3077
+ }
3078
+ )
3079
+ ] });
3080
+ };
3081
+
3082
+ // src/table-settings/column-settings-panel/ColumnSettingsPanel.tsx
3083
+ import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
3084
+ var classBase12 = "vuuColumnSettingsPanel";
3085
+ var tabstripProps2 = {
3086
+ className: "salt-density-high"
3087
+ };
3088
+ var NullActivationIndicator3 = () => null;
3089
+ var ColumnSettingsPanel2 = ({
3090
+ column,
3091
+ dispatchColumnAction,
3092
+ style: styleProp,
3093
+ ...props
3094
+ }) => {
3095
+ var _a, _b, _c, _d;
3096
+ const [activeTab, setActiveTab] = useState6(0);
3097
+ const dispatchUpdate = useCallback10(
3098
+ (values) => dispatchColumnAction({
3099
+ type: "updateColumnProp",
3100
+ column,
3101
+ ...values
3102
+ }),
3103
+ [column, dispatchColumnAction]
3104
+ );
3105
+ const handleChangeAlign = useCallback10(
3106
+ (evt) => dispatchUpdate({ align: evt.target.value }),
3107
+ [dispatchUpdate]
3108
+ );
3109
+ const handleChangePin = useCallback10(
3110
+ (evt) => dispatchUpdate({ pin: evt.target.value }),
3111
+ [dispatchUpdate]
3112
+ );
3113
+ const handleChangeHidden = useCallback10(
3114
+ (evt, value) => dispatchUpdate({ hidden: value }),
3115
+ [dispatchUpdate]
3116
+ );
3117
+ const handleChangeLabel = useCallback10(
3118
+ (evt, value) => dispatchUpdate({ label: value }),
3119
+ [dispatchUpdate]
3120
+ );
3121
+ const handleChangeWidth = useCallback10(
3122
+ (value) => dispatchUpdate({ width: parseInt(value.toString(), 10) }),
3123
+ [dispatchUpdate]
3124
+ );
3125
+ return /* @__PURE__ */ jsxs14(
3126
+ "div",
3127
+ {
3128
+ className: classBase12,
3129
+ ...props,
3130
+ style: {
3131
+ ...styleProp
3132
+ },
3133
+ children: [
3134
+ /* @__PURE__ */ jsx17(Text7, { as: "h4", children: "Column Settings" }),
3135
+ /* @__PURE__ */ jsxs14(
3136
+ Stack3,
3137
+ {
3138
+ active: activeTab,
3139
+ showTabs: true,
3140
+ className: cx9(`${classBase12}-columnTabs`),
3141
+ onTabSelectionChanged: setActiveTab,
3142
+ TabstripProps: tabstripProps2,
3143
+ children: [
3144
+ /* @__PURE__ */ jsxs14(Panel7, { title: "Column", children: [
3145
+ /* @__PURE__ */ jsx17(FormField6, { label: "Hidden", labelPlacement: "left", children: /* @__PURE__ */ jsx17(
3146
+ Checkbox2,
3147
+ {
3148
+ checked: column.hidden === true,
3149
+ onChange: handleChangeHidden
3150
+ }
3151
+ ) }),
3152
+ /* @__PURE__ */ jsx17(FormField6, { label: "Label", labelPlacement: "left", children: /* @__PURE__ */ jsx17(
3153
+ Input3,
3154
+ {
3155
+ value: (_a = column.label) != null ? _a : column.name,
3156
+ onChange: handleChangeLabel
3157
+ }
3158
+ ) }),
3159
+ /* @__PURE__ */ jsx17(FormField6, { label: "Width", labelPlacement: "left", children: /* @__PURE__ */ jsx17(
3160
+ StepperInput5,
3161
+ {
3162
+ value: (_b = column.width) != null ? _b : 100,
3163
+ onChange: handleChangeWidth
3164
+ }
3165
+ ) }),
3166
+ /* @__PURE__ */ jsx17(
3167
+ FormField6,
3168
+ {
3169
+ label: "Align",
3170
+ labelPlacement: "left",
3171
+ ActivationIndicatorComponent: NullActivationIndicator3,
3172
+ children: /* @__PURE__ */ jsxs14(
3173
+ RadioButtonGroup3,
3174
+ {
3175
+ "aria-label": "Column Align",
3176
+ value: (_c = column.align) != null ? _c : "left",
3177
+ legend: "Align",
3178
+ onChange: handleChangeAlign,
3179
+ children: [
3180
+ /* @__PURE__ */ jsx17(RadioButton3, { label: "Left", value: "left" }),
3181
+ /* @__PURE__ */ jsx17(RadioButton3, { label: "Right", value: "right" })
3182
+ ]
3183
+ }
3184
+ )
3185
+ }
3186
+ ),
3187
+ /* @__PURE__ */ jsx17(
3188
+ FormField6,
3189
+ {
3190
+ label: "Pin Column",
3191
+ labelPlacement: "left",
3192
+ ActivationIndicatorComponent: NullActivationIndicator3,
3193
+ children: /* @__PURE__ */ jsxs14(
3194
+ RadioButtonGroup3,
3195
+ {
3196
+ "aria-label": "Pin Column",
3197
+ value: (_d = column.pin) != null ? _d : "",
3198
+ legend: "Pin Column",
3199
+ onChange: handleChangePin,
3200
+ children: [
3201
+ /* @__PURE__ */ jsx17(RadioButton3, { label: "Do not pin", value: "" }),
3202
+ /* @__PURE__ */ jsx17(RadioButton3, { label: "Left", value: "left" }),
3203
+ /* @__PURE__ */ jsx17(RadioButton3, { label: "Right", value: "right" })
3204
+ ]
3205
+ }
3206
+ )
3207
+ }
3208
+ )
3209
+ ] }),
3210
+ /* @__PURE__ */ jsx17(
3211
+ ColumnTypePanel2,
3212
+ {
3213
+ column,
3214
+ dispatchColumnAction,
3215
+ title: "Data Cell"
3216
+ }
3217
+ ),
3218
+ /* @__PURE__ */ jsxs14(Panel7, { title: "Vuu", variant: "secondary", children: [
3219
+ /* @__PURE__ */ jsx17(
3220
+ FormField6,
3221
+ {
3222
+ label: "Name",
3223
+ labelPlacement: "top",
3224
+ readOnly: true,
3225
+ variant: "secondary",
3226
+ children: /* @__PURE__ */ jsx17(Input3, { value: column.name })
3227
+ }
3228
+ ),
3229
+ /* @__PURE__ */ jsx17(
3230
+ FormField6,
3231
+ {
3232
+ label: "Vuu type",
3233
+ labelPlacement: "top",
3234
+ readOnly: true,
3235
+ variant: "secondary",
3236
+ children: /* @__PURE__ */ jsx17(Input3, { value: column.serverDataType })
3237
+ }
3238
+ )
3239
+ ] })
3240
+ ]
3241
+ }
3242
+ )
3243
+ ]
3244
+ }
3245
+ );
3246
+ };
3247
+ export {
3248
+ ColumnExpressionInput,
3249
+ ColumnNamedTerms,
3250
+ ColumnSettingsPanel2 as ColumnSettingsPanel,
3251
+ DataSourceStats,
3252
+ DatagridSettingsPanel,
3253
+ columnExpressionLanguageSupport,
3254
+ isCompleteExpression,
3255
+ isCompleteRelationalExpression,
3256
+ lastNamedChild,
3257
+ useColumnExpressionEditor,
3258
+ useColumnExpressionSuggestionProvider,
3259
+ walkTree
3260
+ };
2
3261
  //# sourceMappingURL=index.js.map