@vuu-ui/vuu-table-extras 0.8.6 → 0.8.7-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,3239 @@
1
- var pn=(e,n,t)=>{if(!n.has(e))throw TypeError("Cannot "+t)};var c=(e,n,t)=>(pn(e,n,"read from private field"),t?t.call(e):n.get(e)),D=(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)},L=(e,n,t,o)=>(pn(e,n,"write to private field"),o?o.call(e,t):n.set(e,t),t);import{DOWN1 as Ot,DOWN2 as Pt,isTypeDescriptor as St,metadataKeys as Tt,registerComponent as Dt,UP1 as wt,UP2 as Ft}from"@vuu-ui/vuu-utils";import Rt from"classnames";import{getMovingValueDirection as ht,isTypeDescriptor as bt,isValidNumber as un}from"@vuu-ui/vuu-utils";import{useEffect as yt,useRef as Et}from"react";var vt=[void 0,void 0,void 0,void 0];function cn(e,n,t){var x;let o=Et(),[i,r,s,p]=o.current||vt,{type:l}=t,u=bt(l)?(x=l.formatting)==null?void 0:x.decimals:void 0,g=e===i&&un(n)&&un(r)&&t===s?ht(n,p,r,u):"";return yt(()=>{o.current=[e,n,t,g]}),g}import{jsx as It,jsxs as Bt}from"react/jsx-runtime";var Nt=String.fromCharCode(11014),kt=String.fromCharCode(11015),{KEY:At}=Tt,ve="vuuBackgroundCell",le={ArrowOnly:"arrow",BackgroundOnly:"bg-only",ArrowBackground:"arrow-bg"},Lt=e=>St(e)&&e.renderer&&"flashStyle"in e.renderer?e.renderer.flashStyle:le.BackgroundOnly,Qt=({column:e,row:n})=>{let{key:t,type:o,valueFormatter:i}=e,r=n[t],s=Lt(o),p=cn(n[At],r,e),l=s===le.ArrowOnly||s===le.ArrowBackground?p===wt||p===Ft?Nt:p===Ot||p===Pt?kt:null:null,u=p?" "+p:"",g=Rt(ve,u,{[`${ve}-arrowOnly`]:s===le.ArrowOnly,[`${ve}-arrowBackground`]:s===le.ArrowBackground});return Bt("div",{className:g,tabIndex:-1,children:[It("div",{className:`${ve}-flasher`,children:l}),i(n[e.key])]})};Dt("background",Qt,"cell-renderer",{serverDataType:["long","int","double"]});import{isColumnTypeRenderer as Mt,isTypeDescriptor as $t,registerComponent as Ut}from"@vuu-ui/vuu-utils";import Ht from"classnames";import{jsx as Ie,jsxs as mn}from"react/jsx-runtime";var pe="vuuProgressCell",Gt=({column:e,columnMap:n,row:t})=>{let{type:o}=e,i=t[e.key],r=!1,s=0;if($t(o)&&Mt(o.renderer)){let{associatedField:l}=o.renderer,u=t[n[l]];if(typeof i=="number"&&typeof u=="number")s=Math.min(Math.round(i/u*100),100),r=isFinite(s);else{let g=parseFloat(i);if(Number.isFinite(g)){let x=parseFloat(u);Number.isFinite(x)&&(s=Math.min(Math.round(g/x*100),100),r=isFinite(s))}}}let p=Ht(pe,{});return mn("div",{className:p,tabIndex:-1,children:[r?mn("span",{className:`${pe}-track`,children:[Ie("span",{className:`${pe}-bg`}),Ie("span",{className:`${pe}-bar`,style:{"--progress-bar-pct":`-${100-s}%`}})]}):null,Ie("span",{className:`${pe}-text`,children:`${s} %`})]})};Ut("vuu.progress",Gt,"cell-renderer",{serverDataType:["long","int","double"]});import{autocompletion as lo,defaultKeymap as po,EditorState as uo,EditorView as Dn,ensureSyntaxTree as co,keymap as Ze,minimalSetup as mo,startCompletion as wn}from"@vuu-ui/vuu-codemirror";import{createEl as Fn}from"@vuu-ui/vuu-utils";import{useEffect as go,useMemo as fo,useRef as Je}from"react";import{LanguageSupport as Xt,LRLanguage as Vt,styleTags as Yt,tags as Pe}from"@vuu-ui/vuu-codemirror";import{LRParser as Wt}from"@lezer/lr";var Oe=Wt.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 zt=Vt.define({name:"VuuColumnExpression",parser:Oe.configure({props:[Yt({Function:Pe.variableName,String:Pe.string,Or:Pe.emphasis,Operator:Pe.operator})]})}),dn=()=>new Xt(zt);var Be=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}}},Me=class{constructor(n){this.type="colExpression";this.column=n}toJSON(){return{type:this.type,column:this.column}}},ce,I,$e=class{constructor(n="unknown"){D(this,ce,[{type:"unknown"},{type:"unknown"}]);D(this,I,void 0);this.type="arithmeticExpression";L(this,I,n)}get op(){return c(this,I)}set op(n){L(this,I,n)}get expressions(){return c(this,ce)}toJSON(){return{type:this.type,op:c(this,I),expressions:c(this,ce)}}};ce=new WeakMap,I=new WeakMap;var z,Ue=class{constructor(n){D(this,z,[]);this.type="callExpression";this.functionName=n}get expressions(){return c(this,z)}get arguments(){return c(this,z)}toJSON(){return{type:this.type,functionName:this.functionName,arguments:c(this,z).map(n=>{var t;return(t=n.toJSON)==null?void 0:t.call(n)})}}};z=new WeakMap;var me,Z,V=class{constructor(){D(this,me,[{type:"unknown"},{type:"unknown"}]);D(this,Z,"unknown");this.type="relationalExpression"}get op(){return c(this,Z)}set op(n){L(this,Z,n)}get expressions(){return c(this,me)}toJSON(){return{type:this.type,op:c(this,Z),expressions:c(this,me)}}};me=new WeakMap,Z=new WeakMap;var de,J,Y=class{constructor(n){D(this,de,[{type:"unknown"},{type:"unknown"}]);D(this,J,void 0);this.type="booleanCondition";L(this,J,n)}get op(){return c(this,J)}get expressions(){return c(this,de)}toJSON(){return{type:this.type,op:c(this,J),expressions:c(this,de).map(n=>{var t;return(t=n.toJSON)==null?void 0:t.call(n)})}}};de=new WeakMap,J=new WeakMap;var F,ue=class{constructor(n){D(this,F,void 0);this.type="conditionalExpression";L(this,F,[n?new Y(n):new V,{type:"unknown"},{type:"unknown"}])}get expressions(){return c(this,F)}get condition(){return c(this,F)[0]}get truthyExpression(){return c(this,F)[1]}set truthyExpression(n){c(this,F)[1]=n}get falsyExpression(){return c(this,F)[2]}set falsyExpression(n){c(this,F)[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}}};F=new WeakMap;var Q=e=>e.type==="unknown",Se=e=>e.type==="arithmeticExpression",Zt=e=>e.type==="callExpression",X=e=>e.type==="conditionalExpression",Jt=e=>e.type==="relationalExpression"||e.type==="booleanCondition";var qt=e=>e.type==="booleanCondition",Ge=e=>(e==null?void 0:e.type)==="relationalExpression";var T=e=>{if(Q(e))return e;if(Ge(e)){let[n,t]=e.expressions;if(O(n))return T(n);if(e.op==="unknown")return e;if(O(t))return T(t)}else if(Jt(e)){let{expressions:n=[]}=e;for(let t of n)if(O(t))return T(t)}else if(X(e)){let{condition:n,truthyExpression:t,falsyExpression:o}=e;if(O(n))return T(n);if(O(t))return T(t);if(O(o))return T(o)}else if(Se(e)){let{expressions:n=[]}=e;for(let t of n)if(O(t))return T(t)}},Te=(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(Te(i,n,t))return!0;return!1},O=e=>Q(e)?!0:X(e)?O(e.condition)||O(e.truthyExpression)||O(e.falsyExpression):Ge(e)||qt(e)?e.op===void 0||e.expressions.some(n=>O(n)):!1,gn=(e,n)=>{let t=T(e);t?t.expressions?t.expressions.push(n):console.warn("don't know how to treat targetExpression"):console.error("no target expression found")},C,B,He=class{constructor(){D(this,C,void 0);D(this,B,[])}setCondition(n){if(c(this,C)===void 0)this.addExpression(new ue(n));else if(X(c(this,C))){if(O(c(this,C).condition)){let t=n?new Y(n):new V;this.addExpression(t)}else if(Q(c(this,C).truthyExpression))c(this,C).truthyExpression=new ue(n);else if(O(c(this,C).truthyExpression)){let t=n?new Y(n):new V;this.addExpression(t)}else if(Q(c(this,C).falsyExpression))c(this,C).falsyExpression=new ue(n);else if(O(c(this,C).falsyExpression)){let t=n?new Y(n):new V;this.addExpression(t)}}else console.error("setCondition called unexpectedly")}addExpression(n){if(c(this,B).length>0){let t=c(this,B).at(-1);t==null||t.arguments.push(n)}else if(c(this,C)===void 0)L(this,C,n);else if(Se(c(this,C))){let t=T(c(this,C));t&&Q(t)&&Te(c(this,C),t,n)}else if(X(c(this,C))&&O(c(this,C))){let t=T(c(this,C));t&&Q(t)?Te(c(this,C),t,n):t&&gn(t,n)}}setFunction(n){let t=new Ue(n);this.addExpression(t),c(this,B).push(t)}setColumn(n){this.addExpression(new Me(n))}setArithmeticOp(n){let t=n,o=c(this,C);Se(o)&&(o.op=t)}setRelationalOperator(n){let t=n;if(c(this,C)&&X(c(this,C))){let o=T(c(this,C));Ge(o)?o.op=t:console.error(`no target expression found (op = ${n})`)}}setValue(n){let t=new Be(n);if(c(this,C)===void 0)L(this,C,t);else if(Se(c(this,C)))this.addExpression(t);else if(Zt(c(this,C)))c(this,C).arguments.push(t);else if(X(c(this,C)))if(O(c(this,C))){let o=T(c(this,C));o&&Q(o)?Te(c(this,C),o,t):o&&gn(o,t)}else console.log("what do we do with value, in a complete expression")}closeBrace(){c(this,B).pop()}get expression(){return c(this,C)}toJSON(){var n;return(n=c(this,C))==null?void 0:n.toJSON()}};C=new WeakMap,B=new WeakMap;var fn=(e,n)=>{let t=new He,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 $e);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 _t=Oe.configure({strict:!0}),Cn=["Number","String"],We=[...Cn,"AndCondition","ArithmeticExpression","BooleanOperator","RelationalOperatorOperator","CallExpression","CloseBrace","Column","Comma","ConditionalExpression","Divide","Equal","If","Minus","OpenBrace","OrCondition","ParenthesizedExpression","Plus","RelationalExpression","RelationalOperator","Times"],xn=e=>{try{return _t.parse(e),!0}catch{return!1}},Xe=e=>{let{lastChild:n}=e;for(;n&&!We.includes(n.name);)n=n.prevSibling,console.log(n==null?void 0:n.name);return n},hn=e=>{if((e==null?void 0:e.name)==="RelationalExpression"){let{firstChild:n}=e,t=Xe(e);if((n==null?void 0:n.name)==="Column"&&typeof(t==null?void 0:t.name)=="string"&&Cn.includes(t.name))return!0}return!1};import{HighlightStyle as Kt,syntaxHighlighting as jt,tags as bn}from"@vuu-ui/vuu-codemirror";var eo=Kt.define([{tag:bn.variableName,color:"var(--vuuFilterEditor-variableColor)"},{tag:bn.comment,color:"green",fontStyle:"italic"}]),yn=jt(eo);import{EditorView as no}from"@vuu-ui/vuu-codemirror";var En=no.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 to,getNamedParentNode as vn,getPreviousNode as oo,getValue as N,syntaxTree as ro}from"@vuu-ui/vuu-codemirror";import{useCallback as On}from"react";var so=(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,io=e=>e===void 0?!1:["Times","Divide","Plus","Minus"].includes(e.name),q=(e,n)=>{var i;let{lastChild:t}=e,{pos:o}=n;for(;t;)if(t.from<o&&We.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},Pn=(e,n)=>{var t;if(e.name==="ArgList"){let o=e.prevSibling;if(o)return N(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 N(o,n)}},Sn=(e,n)=>{if(e.name==="RelationalExpression"){let t=Xe(e);if((t==null?void 0:t.name)==="RelationalOperator")return N(t,n)}else{let t=e.prevSibling;if((t==null?void 0:t.name)==="RelationalOperator")return N(t,n)}},ze=(e,n)=>{var t;if(e.name==="RelationalExpression"){if(((t=e.firstChild)==null?void 0:t.name)==="Column")return N(e.firstChild,n)}else{let o=e.prevSibling;if((o==null?void 0:o.name)==="Column")return N(o,n);if((o==null?void 0:o.name)==="RelationalOperator")return ze(o,n)}},Ve=async(e,n,t,o={})=>{let i=await n.getSuggestions(t,o),{startsWith:r=""}=o;return{from:e.pos-r.length,options:i}},Ye=(e,n,t,o,i)=>{let r=q(e,n);switch(console.log(`conditional expression last child ${r==null?void 0:r.name}`),r==null?void 0:r.name){case"If":return Ve(n,t,"expression",{prefix:"( "});case"OpenBrace":return Ve(n,t,"expression");case"Condition":return Ve(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}}}},ao=(e,n)=>{let t=[{apply:()=>{n==null||n()},label:"Save Expression",boost:10}];return{from:e.pos,options:t}},Tn=(e,n)=>{let t=On(async(o,i,r={})=>{let s=await e.getSuggestions(i,r),{startsWith:p=""}=r;return{from:o.pos-p.length,options:s}},[e]);return On(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=ro(i).resolveInner(r,-1),u=i.doc.toString(),g=xn(u);switch(console.log({nodeBeforeName:l.name}),l.name){case"If":return console.log("conditional expression If"),t(o,"expression",{prefix:"( "});case"Condition":{let a=q(l,o);if((a==null?void 0:a.name)==="Column"){let d=oo(a);if((d==null?void 0:d.name)!=="RelationalOperator")return t(o,"condition-operator",{columnName:N(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 Ye(l,o,e);case"RelationalExpression":{if(hn(l))return{from:o.pos,options:to.concat({label:", <truthy expression>, <falsy expression>",apply:", "})};{let a=Sn(l,i),d=ze(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=Sn(l,i),d=ze(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=q(l,o);if((a==null?void 0:a.name)==="Column")return t(o,"expression");if(io(a)){let d=a.name;return t(o,"column",{operator:d})}}break;case"OpenBrace":{let a=Pn(l,i);return t(o,"expression",{functionName:a})}break;case"ArgList":{let a=Pn(l,i),d=q(l,o),f=(d==null?void 0:d.name)==="OpenBrace"?void 0:",",m=await e.getSuggestions("expression",{functionName:a});return m=f?so(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(u.trim()==="=")return t(o,"expression");break;case"ParenthesizedExpression":case"ColumnDefinitionExpression":if(o.pos===0)return t(o,"expression");{let a=q(l,o);if((a==null?void 0:a.name)==="Column"){if(g){let d=[{apply:()=>{n.current()},label:"Save Expression",boost:10}],f=N(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=q(a,o);if((f==null?void 0:f.name)==="Column"){let m=N(f,i),E=await e.getSuggestions("operator",{columnName:m});d=d.concat(E)}return{from:o.pos,options:d}}}else if((a==null?void 0:a.name)==="ConditionalExpression")return Ye(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=vn(l);if((a==null?void 0:a.name)==="ConditionalExpression")return t(o,"expression")}break;case"CloseBrace":{let a=vn(l);if((a==null?void 0:a.name)==="ConditionalExpression")return Ye(a,o,e,g,n.current);if((a==null?void 0:a.name)==="ArgList"&&g)return ao(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 ge=e=>{if(e.current==null)throw Error("EditorView not defined");return e.current},Co=()=>"vuuSuggestion",xo=()=>console.log("noooop"),ho=e=>"expressionType"in e,bo=e=>{if(ho(e)){let n=Fn("div","expression-type-container"),t=Fn("span","expression-type",e.expressionType);return n.appendChild(t),n}else return null},Rn=({onChange:e,onSubmitExpression:n,suggestionProvider:t})=>{let o=Je(null),i=Je(xo),r=Je(),s=Tn(t,i),[p,l]=fo(()=>{let u=()=>{let f=ge(r),m=f.state.doc.toString(),E=co(f.state,f.state.doc.length,5e3);if(E){let w=fn(E,m);return[m,w]}else return["",void 0]},g=()=>{ge(r).setState(d())},x=()=>{let[f,m]=u();n==null||n(f,m),g()},h=f=>Ze.of([{key:f,run(){return x(),!0}}]),a=f=>Ze.of([{key:f,run(){return wn(ge(r)),!0}}]),d=()=>uo.create({doc:"",extensions:[mo,lo({addToOptions:[{render:bo,position:70}],override:[s],optionClass:Co}),dn(),Ze.of(po),h("Ctrl-Enter"),a("ArrowDown"),Dn.updateListener.of(f=>{let m=ge(r);if(f.docChanged){wn(m);let E=m.state.doc.toString();e==null||e(E,void 0)}}),En,yn]});return i.current=()=>{x(),setTimeout(()=>{ge(r).focus()},100)},[d,g]},[s,e,n]);return go(()=>{if(!o.current)throw Error("editor not in dom");return r.current=new Dn({state:p(),parent:o.current}),()=>{var u;(u=r.current)==null||u.destroy()}},[s,p]),{editorRef:o,clearInput:l}};import{jsx as Eo}from"react/jsx-runtime";var yo="vuuColumnExpressionInput",Nn=({onChange:e,onSubmitExpression:n,suggestionProvider:t})=>{let{editorRef:o}=Rn({onChange:e,onSubmitExpression:n,suggestionProvider:t});return Eo("div",{className:`${yo}`,ref:o})};import{AnnotationType as vo,getRelationalOperators as Oo,numericOperators as Po,stringOperators as So,toSuggestions as To}from"@vuu-ui/vuu-codemirror";import{getTypeaheadParams as Do,useTypeaheadSuggestions as wo}from"@vuu-ui/vuu-data-react";import{isNumericColumn as _e,isTextColumn as Fo}from"@vuu-ui/vuu-utils";import{useCallback as qe,useRef as Ro}from"react";var _=[{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 k}from"@vuu-ui/vuu-utils";var kn=({name:e,description:n,example:t,params:o,type:i})=>{let r=k("div","vuuFunctionDoc"),s=k("div","function-heading"),p=k("span","function-name",e),l=k("span","param-list",o.description),u=k("span","function-type",i);s.appendChild(p),s.appendChild(l),s.appendChild(u);let g=k("p",void 0,n);if(r.appendChild(s),r.appendChild(g),t){let x=k("div","example-container","Example:"),h=k("div","example-expression",t.expression),a=k("div","example-result",t.result);x.appendChild(h),x.appendChild(a),r.appendChild(x)}return r};var No=[],M=e=>e.map(n=>{var t;return{...n,apply:((t=n.apply)!=null?t:n.label)+" "}}),ko=(e,{functionName:n,operator:t})=>{if(t)return e.filter(_e);if(n){let o=_.find(i=>i.name===n);if(o)switch(o.accepts){case"string":return e.filter(Fo);case"number":return e.filter(_e);default:return e}}return e},An=(e,n)=>ko(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}}),Ao=[{apply:"* ",boost:2,label:"*",type:"operator"},{apply:"/ ",boost:2,label:"/",type:"operator"},{apply:"+ ",boost:2,label:"+",type:"operator"},{apply:"- ",boost:2,label:"-",type:"operator"}],Lo=e=>e===void 0||_e(e)?Ao:No,Qo=e=>{switch(e.serverDataType){case"string":case"char":return M(So);case"int":case"long":case"double":return M(Po)}},Ke=e=>({apply:`${e.name}( `,boost:2,expressionType:e.type,info:()=>kn(e),label:e.name,type:"function"}),Io=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"},Bo=_.map(Ke),Mo=({functionName:e})=>{if(e){let n=_.find(o=>o.name===e),t=Io(n);if(n)switch(t){case"string":return _.filter(o=>o.type==="string"||o.type==="variable").map(Ke);case"number":return _.filter(o=>o.type==="number"||o.type==="variable").map(Ke);default:}}return Bo},$o={},Ln=({columns:e,table:n})=>{let t=qe(p=>p?e.find(l=>l.name===p):void 0,[e]),o=Ro(),i=wo(),r=qe(async(p,l=$o)=>{let{columnName:u,functionName:g,operator:x,prefix:h}=l;switch(p){case"expression":{let a=await M(An(e,{functionName:g,prefix:h})).concat(Mo(l));return o.current=a}case"column":{let a=await An(e,l);return o.current=M(a)}case"operator":{let a=await Lo(t(u));return o.current=M(a)}case"relational-operator":{let a=await Oo(t(u));return o.current=M(a)}case"condition-operator":{let a=t(u);if(a){let d=await Qo(a);if(d)return o.current=M(d)}}break;case"columnValue":if(u&&x){let a=Do(n,u),d=await i(a);return o.current=To(d,{suffix:""}),o.current.forEach(f=>{f.apply=(m,E,w)=>{let Qe=new vo,ae=w+E.label.length+1;m.dispatch({changes:{from:w,insert:E.label},selection:{anchor:ae,head:ae},annotations:Qe.of(E)})}}),o.current}break}return[]},[e,t,i,n]),s=qe(async(p,l,u)=>{let{current:g}=o,x=!1,h=g||await r(p,{columnName:l});if(u&&h)for(let a of h){if(a.label===u)return!1;a.label.startsWith(u)&&(x=!0)}return x},[r]);return{getSuggestions:r,isPartialMatch:s}};import{Button as rn,Panel as $r}from"@salt-ds/core";import Ur from"classnames";import{useCallback as be,useState as rt}from"react";import{List as In}from"@salt-ds/lab";import{Button as fe,Text as Bn,useIdMemo as Wo}from"@salt-ds/core";import{useCallback as j,useState as Xo}from"react";import{ListItem as Uo}from"@salt-ds/lab";import Ho from"classnames";import{jsx as je,jsxs as Go}from"react/jsx-runtime";var K="vuuColumnListItem",Qn=({className:e,item:n,label:t,style:o,...i})=>{let r=Ho(K,e,{[`${K}-calculated`]:n==null?void 0:n.expression,[`${K}-hidden`]:n==null?void 0:n.hidden});return Go(Uo,{className:r,...i,children:[je("span",{className:`${K}-iconType`}),je("label",{className:`${K}-label`,children:t}),je("span",{className:`${K}-iconHidden`})]})};import{jsx as v,jsxs as ne}from"react/jsx-runtime";var ee="vuuColumnPicker",Vo=(e,n)=>e.filter(t=>n.find(o=>o.name===t.name)==null),Mn=({availableColumns:e,id:n,dispatchColumnAction:t,onAddCalculatedColumnClick:o,onSelectionChange:i,chosenColumns:r,selectedColumn:s})=>{let[p,l]=Xo([]),u=Wo(n),g=Vo(e,r),x=j(()=>{p.length>0&&(l([]),t({type:"addColumn",columns:p}))},[t,p]),h=j(()=>s&&t({type:"removeColumn",column:s}),[s,t]),a=j(()=>s&&t({type:"moveColumn",column:s,moveBy:-1}),[t,s]),d=j(()=>s&&t({type:"moveColumn",column:s,moveBy:1}),[t,s]),f=j((E,w)=>l(w),[]),m=j((E,w)=>i==null?void 0:i(w),[i]);return ne("div",{className:ee,id:u,children:[ne("div",{className:`${ee}-listColumn`,children:[v("label",{htmlFor:`available-${u}`,children:v(Bn,{as:"h4",children:"Available Columns"})}),v("div",{className:`${ee}-listContainer`,style:{flex:1,overflow:"hidden"},children:v(In,{borderless:!0,checkable:!1,height:"100%",id:`available-${u}`,itemHeight:24,itemToString:E=>E.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:ne(fe,{onClick:x,disabled:p.length===0,children:["Show",v("span",{"data-icon":"arrow-thin-right",style:{marginLeft:8}})]})})]}),ne("div",{className:`${ee}-listColumn`,children:[v("label",{htmlFor:`selected-${u}`,children:v(Bn,{as:"h4",children:"Included Columns"})}),v("div",{className:`${ee}-listContainer`,style:{flex:1,overflow:"hidden"},children:v(In,{ListItem:Qn,borderless:!0,height:"100%",id:`selected-${u}`,itemHeight:24,itemToString:E=>E.name,onSelectionChange:m,selected:s,style:{flex:1},source:r})}),ne("div",{style:{alignItems:"center",flex:"0 0 32px",display:"flex",gap:6,marginTop:"var(--salt-size-basis-unit)"},children:[ne(fe,{onClick:h,disabled:s===null,children:[v("span",{"data-icon":"arrow-thin-left",style:{marginRight:8}}),"Hide"]}),v(fe,{"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(fe,{"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(fe,{"aria-label":"Add calculated column",className:`${ee}-addCalculatedColumn`,onClick:o,variant:"primary",children:v("span",{"data-icon":"add"})})]})]})]})};import{Stack as pr}from"@vuu-ui/vuu-layout";import{StepperInput as ur}from"@salt-ds/lab";import{Checkbox as cr,FormField as $,FormFieldLabel as U,Input as nn,Panel as zn,RadioButton as Ce,RadioButtonGroup as Zn,Text as mr}from"@salt-ds/core";import dr from"classnames";import{useCallback as oe,useState as gr}from"react";import{getRegisteredCellRenderers as er}from"@vuu-ui/vuu-utils";import{Dropdown as nr}from"@salt-ds/lab";import{Panel as tr}from"@salt-ds/core";import Xn from"classnames";import{useMemo as or}from"react";import{StepperInput as Yo,Switch as $n}from"@salt-ds/lab";import{FormField as zo,FormFieldLabel as Zo,Text as Jo}from"@salt-ds/core";import{useCallback as De}from"react";import{Fragment as Hn,jsx as te,jsxs as Un}from"react/jsx-runtime";var qo={alignOnDecimals:!1,decimals:4,zeroPad:!1},_o=(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,qo)},Gn=({column:e,dispatchColumnAction:n})=>{let{decimals:t,alignOnDecimals:o,zeroPad:i}=_o(e==null?void 0:e.type),r=De(u=>n({type:"updateColumnTypeFormatting",column:e,...u}),[e,n]),s=De(u=>r({decimals:parseInt(u.toString(),10)}),[r]),p=De((u,g)=>r({alignOnDecimals:g}),[r]),l=De((u,g)=>r({zeroPad:g}),[r]);switch(e.serverDataType){case"double":return Un(Hn,{children:[Un(zo,{labelPlacement:"top",children:[te(Zo,{children:"No of Decimals"}),te(Yo,{value:t,onChange:s})]}),te($n,{checked:o,label:"Align on decimals",LabelProps:{className:"vuuColumnPanelSwitch"},onChange:p}),te($n,{checked:i,label:"Zero pad",LabelProps:{className:"vuuColumnPanelSwitch"},onChange:l})]});case"long":case"int":return te(Hn,{children:te(Jo,{children:"Work in progress"})});default:return null}};import{Fragment as Ko,jsx as jo}from"react/jsx-runtime";var Wn=({column:e,dispatchColumnAction:n})=>(console.log({column:e,dispatchColumnAction:n}),jo(Ko,{children:"what"}));import{Fragment as ar,jsx as we,jsxs as lr}from"react/jsx-runtime";var en="vuuColumnTypePanel",rr=["Default Renderer (int, long)"],sr=["Default Renderer (double)"],Vn=["Default Renderer (string)"],ir=e=>{let t=er(e.serverDataType).map(o=>o.name);switch(console.log({customRendererNames:t}),e.serverDataType){case"char":case"string":return Vn;case"int":case"long":return rr;case"double":return sr.concat(t);default:return Vn}},Yn=({className:e,column:n,dispatchColumnAction:t,...o})=>{let i=or(()=>{switch(n.serverDataType){case"double":case"int":case"long":return we(Gn,{column:n,dispatchColumnAction:t});default:return we(Wn,{column:n,dispatchColumnAction:t})}},[n,t]),{serverDataType:r="string"}=n,s=ir(n);return lr(ar,{children:[we(nr,{className:Xn(`${en}-renderer`),fullWidth:!0,selected:s[0],source:s}),we(tr,{...o,className:Xn(en,e,`${en}-${r}`),children:i})]})};import{jsx as b,jsxs as P}from"react/jsx-runtime";var Jn="vuuColumnSettingsPanel",fr={className:"salt-density-high"},qn=({column:e,dispatchColumnAction:n,style:t,...o})=>{var h,a,d,f;let[i,r]=gr(0),s=oe(m=>n({type:"updateColumnProp",column:e,...m}),[e,n]),p=oe(m=>s({align:m.target.value}),[s]),l=oe(m=>s({pin:m.target.value}),[s]),u=oe(m=>s({hidden:m.target.checked}),[s]),g=oe(m=>s({label:m.target.value}),[s]),x=oe(m=>s({width:parseInt(m.toString(),10)}),[s]);return P("div",{className:Jn,...o,style:{...t},children:[b(mr,{as:"h4",children:"Column Settings"}),P(pr,{active:i,className:dr(`${Jn}-columnTabs`),onTabSelectionChanged:r,TabstripProps:fr,children:[P(zn,{title:"Column",children:[P($,{labelPlacement:"left",children:[b(U,{children:"Hidden"}),b(cr,{checked:e.hidden===!0,onChange:u})]}),P($,{labelPlacement:"left",children:[b(U,{children:"Label"}),b(nn,{value:(h=e.label)!=null?h:e.name,onChange:g})]}),P($,{labelPlacement:"left",children:[b(U,{children:"Width"}),b(ur,{value:(a=e.width)!=null?a:100,onChange:x})]}),P($,{labelPlacement:"left",children:[b(U,{children:"ALign"}),P(Zn,{"aria-label":"Column Align",value:(d=e.align)!=null?d:"left",onChange:p,children:[b(Ce,{label:"Left",value:"left"}),b(Ce,{label:"Right",value:"right"})]})]}),P($,{labelPlacement:"left",children:[b(U,{children:"Pin Column"}),P(Zn,{"aria-label":"Pin Column",value:(f=e.pin)!=null?f:"",onChange:l,children:[b(Ce,{label:"Do not pin",value:""}),b(Ce,{label:"Left",value:"left"}),b(Ce,{label:"Right",value:"right"})]})]})]}),b(Yn,{column:e,dispatchColumnAction:n,title:"Data Cell"}),P(zn,{title:"Vuu",variant:"secondary",children:[P($,{labelPlacement:"top",readOnly:!0,children:[b(U,{children:"Name"}),b(nn,{value:e.name})]}),P($,{labelPlacement:"top",readOnly:!0,children:[b(U,{children:"Vuu Type"}),b(nn,{value:e.serverDataType})]})]})]})]})};import{FormField as _n,FormFieldLabel as Kn,Panel as Cr,RadioButton as tn,RadioButtonGroup as xr,Text as hr}from"@salt-ds/core";import{StepperInput as br}from"@salt-ds/lab";import{useCallback as on}from"react";import{jsx as H,jsxs as xe}from"react/jsx-runtime";var yr="vuuGridSettingsPanel",jn=({config:e,dispatchColumnAction:n,style:t,...o})=>{var p;let i=on(l=>n({type:"updateGridSettings",...l}),[n]),r=on(l=>i({columnFormatHeader:l.target.value}),[i]),s=on(l=>i({columnDefaultWidth:parseInt(l.toString(),10)}),[i]);return xe("div",{className:yr,...o,style:{...t},children:[H(hr,{as:"h4",children:"Grid Settings"}),xe(Cr,{children:[xe(_n,{labelPlacement:"left",children:[H(Kn,{children:"Format column labels"}),xe(xr,{"aria-label":"Format column labels",value:e.columnFormatHeader,onChange:r,children:[H(tn,{label:"No Formatting",value:void 0}),H(tn,{label:"Capitalize",value:"capitalize"}),H(tn,{label:"Uppercase",value:"uppercase"})]})]}),xe(_n,{labelPlacement:"left",children:[H(Kn,{children:"Default Column Width"}),H(br,{value:(p=e.columnDefaultWidth)!=null?p:100,onChange:s})]})]})]})};import{useReducer as Er}from"react";import{moveItem as vr}from"@vuu-ui/vuu-ui-controls";import{fromServerDataType as Or}from"@vuu-ui/vuu-utils";var Pr=(e,n)=>{switch(console.log(`gridSettingsReducer ${n.type}`),n.type){case"addColumn":return Sr(e,n);case"addCalculatedColumn":return Tr(e,n);case"moveColumn":return wr(e,n);case"removeColumn":return Dr(e,n);case"updateColumn":return e;case"updateColumnProp":return Fr(e,n);case"updateGridSettings":return Rr(e,n);case"updateColumnTypeFormatting":return Nr(e,n);default:return e}},et=e=>{let[n,t]=Er(Pr,e);return{gridSettings:n,dispatchColumnAction:t}};function Sr(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 Tr(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 Dr(e,{column:n}){let{columns:t}=e;return{...e,columns:t.filter(o=>o.name!==n.name)}}function wr(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:vr(r,o,i)}:e}function Fr(e,{align:n,column:t,hidden:o,label:i,width:r}){let{columns:s}=e;return(n==="left"||n==="right")&&(s=he(s,{...t,align:n})),typeof o=="boolean"&&(s=he(s,{...t,hidden:o})),typeof i=="string"&&(s=he(s,{...t,label:i})),typeof r=="number"&&(s=he(s,{...t,width:r})),{...e,columns:s}}function Rr(e,{columnFormatHeader:n}){return{...e,columnFormatHeader:n!=null?n:e.columnFormatHeader}}function Nr(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=Or(p)}=t,u=typeof l=="string"?{name:l}:{...l};return typeof n=="boolean"&&(u.formatting={...u.formatting,alignOnDecimals:n}),typeof o=="number"&&(u.formatting={...u.formatting,decimals:o}),typeof i=="boolean"&&(u.formatting={...u.formatting,zeroPad:i}),{...e,columns:he(r,{...t,type:u})}}else return e}function he(e,n){return e.map(t=>t.name===n.name?n:t)}import{Stack as Hr}from"@vuu-ui/vuu-layout";import{Button as kr,FormField as Ar,FormFieldLabel as Lr,Input as Qr,Panel as Ir,Text as Br}from"@salt-ds/core";import{useCallback as Fe,useRef as Mr,useState as nt}from"react";import{jsx as re,jsxs as tt}from"react/jsx-runtime";var ot=({columns:e,dispatchColumnAction:n,table:t})=>{let[o,i]=nt(""),[,r]=nt(),s=Mr(""),p=Ln({columns:e,table:t}),l=Fe(h=>{let{value:a}=h.target;i(a)},[]),u=Fe(h=>{s.current=h},[]),g=Fe((h,a)=>{console.log({source:h}),r(a)},[]),x=Fe(()=>{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 tt(Ir,{className:"vuuCalculatedColumnPanel",title:"Define Computed Column",children:[re(Br,{styleAs:"h4",children:"Define Computed Column"}),tt(Ar,{labelPlacement:"left",children:[re(Lr,{children:"Column Name"}),re(Qr,{value:o,onChange:l})]}),re(Nn,{onChange:u,onSubmitExpression:g,suggestionProvider:p}),re("div",{style:{marginTop:12},children:re(kr,{onClick:x,children:"Add Column"})})]})};import{jsx as A,jsxs as Ne}from"react/jsx-runtime";var Re="vuuDatagridSettingsPanel",Gr=()=>{},Wr=["table-settings","column-chooser","column-settings","define-column"],Xr=(e,n)=>Wr[n],np=({availableColumns:e,className:n,gridConfig:t,onCancel:o,onConfigChange:i,...r})=>{var ae;console.log("DatagridSettingsPanel render");let[s,p]=rt(0),{gridSettings:l,dispatchColumnAction:u}=et(t),[g,x]=rt(null),h=be(R=>{x(R?R.name:null)},[]),a=be((R,xt=!1)=>{console.log("1) DataGridSettingsPanel fire onConfigChange"),i==null||i(l,xt)},[l,i]),d=be(R=>{p(R)},[]),f=be(R=>a(R,!0),[a]),m=g===null?null:(ae=l.columns.find(R=>R.name===g))!=null?ae:null,E={activeTabIndex:s,allowRenameTab:!1,orientation:"vertical"},w=be(()=>p(3),[]),Qe=s===2?"right":void 0;return Ne("div",{...r,className:Ur(Re,n),children:[Ne(Hr,{TabstripProps:E,className:`${Re}-stack`,getTabIcon:Xr,getTabLabel:Gr,active:s===2?1:s,onTabSelectionChanged:d,children:[A(jn,{config:l,dispatchColumnAction:u}),Ne("div",{className:`${Re}-columnPanels`,"data-align":Qe,children:[A(Mn,{availableColumns:e,chosenColumns:l.columns,dispatchColumnAction:u,onSelectionChange:h,onAddCalculatedColumnClick:w,selectedColumn:m}),m===null?A($r,{className:"vuuColumnSettingsPanel",children:"Select a column"}):A(qn,{column:m,dispatchColumnAction:u,style:{background:"white",flex:"1 0 150px"}})]}),A("div",{title:"Column Settings",children:"Column Settings"}),A(ot,{columns:l.columns,dispatchColumnAction:u,table:{module:"SIMUL",table:"instruments"}})]}),Ne("div",{className:`${Re}-buttonBar`,children:[A(rn,{onClick:o,children:"Cancel"}),A(rn,{onClick:a,children:"Apply"}),A(rn,{onClick:f,children:"Save"})]})]})};import{useEffect as Vr,useState as st}from"react";import Yr from"classnames";import{jsx as ye,jsxs as zr}from"react/jsx-runtime";var ke="vuuDatasourceStats",sn=new Intl.NumberFormat,gp=({className:e,dataSource:n})=>{let[t,o]=st(n.range),[i,r]=st(n.size);Vr(()=>{r(n.size),n.on("resize",r),n.on("range",o)},[n]);let s=Yr(ke,e),p=sn.format(t.from),l=sn.format(t.to-1),u=sn.format(i);return zr("div",{className:s,children:[ye("span",{children:"Showing rows"}),ye("span",{className:`${ke}-range`,children:p}),ye("span",{className:`${ke}-range`,children:l}),ye("span",{children:"of"}),ye("span",{className:`${ke}-size`,children:u})]})};import{Stack as cs}from"@vuu-ui/vuu-layout";import{StepperInput as ms}from"@salt-ds/lab";import{Checkbox as ds,FormField as G,FormFieldLabel as W,Input as ln,Panel as gt,RadioButton as Ee,RadioButtonGroup as ft,Text as gs}from"@salt-ds/core";import fs from"classnames";import{useCallback as ie,useState as Cs}from"react";import{getRegisteredCellRenderers as ts}from"@vuu-ui/vuu-utils";import{Dropdown as os}from"@salt-ds/lab";import{Panel as rs}from"@salt-ds/core";import ct from"classnames";import{useMemo as ss}from"react";import{StepperInput as Zr,Switch as it}from"@salt-ds/lab";import{FormField as Jr,FormFieldLabel as qr,Text as _r}from"@salt-ds/core";import{useCallback as Ae}from"react";import{Fragment as lt,jsx as se,jsxs as at}from"react/jsx-runtime";var Kr={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,Kr)},pt=({column:e,dispatchColumnAction:n})=>{let{decimals:t,alignOnDecimals:o,zeroPad:i}=jr(e==null?void 0:e.type),r=Ae(u=>n({type:"updateColumnTypeFormatting",column:e,...u}),[e,n]),s=Ae(u=>r({decimals:parseInt(u.toString(),10)}),[r]),p=Ae((u,g)=>r({alignOnDecimals:g}),[r]),l=Ae((u,g)=>r({zeroPad:g}),[r]);switch(e.serverDataType){case"double":return at(lt,{children:[at(Jr,{labelPlacement:"top",children:[se(qr,{children:"No of Decimals"}),se(Zr,{value:t,onChange:s})]}),se(it,{checked:o,label:"Align on decimals",LabelProps:{className:"vuuColumnPanelSwitch"},onChange:p}),se(it,{checked:i,label:"Zero pad",LabelProps:{className:"vuuColumnPanelSwitch"},onChange:l})]});case"long":case"int":return se(lt,{children:se(_r,{children:"Work in progress"})});default:return null}};import{Fragment as es,jsx as ns}from"react/jsx-runtime";var ut=({column:e,dispatchColumnAction:n})=>(console.log(e,n),ns(es,{children:"what"}));import{Fragment as ps,jsx as Le,jsxs as us}from"react/jsx-runtime";var an="vuuColumnTypePanel",is=["Default Renderer (int, long)"],as=["Default Renderer (double)"],mt=["Default Renderer (string)"],ls=e=>{let t=ts(e.serverDataType).map(o=>o.name);switch(console.log({customRendererNames:t}),e.serverDataType){case"char":case"string":return mt;case"int":case"long":return is;case"double":return as.concat(t);default:return mt}},dt=({className:e,column:n,dispatchColumnAction:t,...o})=>{let i=ss(()=>{switch(n.serverDataType){case"double":case"int":case"long":return Le(pt,{column:n,dispatchColumnAction:t});default:return Le(ut,{column:n,dispatchColumnAction:t})}},[n,t]),{serverDataType:r="string"}=n,s=ls(n);return us(ps,{children:[Le(os,{className:ct(`${an}-renderer`),fullWidth:!0,selected:s[0],source:s}),Le(rs,{...o,className:ct(an,e,`${an}-${r}`),children:i})]})};import{jsx as y,jsxs as S}from"react/jsx-runtime";var Ct="vuuColumnSettingsPanel",xs={className:"salt-density-high"},ou=({column:e,dispatchColumnAction:n,style:t,...o})=>{var h,a,d,f;let[i,r]=Cs(0),s=ie(m=>n({type:"updateColumnProp",column:e,...m}),[e,n]),p=ie(m=>s({align:m.target.value}),[s]),l=ie(m=>s({pin:m.target.value}),[s]),u=ie(m=>s({hidden:m.target.checked}),[s]),g=ie(m=>s({label:m.target.value}),[s]),x=ie(m=>s({width:parseInt(m.toString(),10)}),[s]);return S("div",{className:Ct,...o,style:{...t},children:[y(gs,{as:"h4",children:"Column Settings"}),S(cs,{active:i,className:fs(`${Ct}-columnTabs`),onTabSelectionChanged:r,TabstripProps:xs,children:[S(gt,{title:"Column",children:[S(G,{labelPlacement:"left",children:[y(W,{children:"Hidden"}),y(ds,{checked:e.hidden===!0,onChange:u})]}),S(G,{labelPlacement:"left",children:[y(W,{children:"Label"}),y(ln,{value:(h=e.label)!=null?h:e.name,onChange:g})]}),S(G,{labelPlacement:"left",children:[y(W,{children:"Width"}),y(ms,{value:(a=e.width)!=null?a:100,onChange:x})]}),S(G,{labelPlacement:"left",children:[y(W,{children:"Align"}),S(ft,{"aria-label":"Column Align",value:(d=e.align)!=null?d:"left",onChange:p,children:[y(Ee,{label:"Left",value:"left"}),y(Ee,{label:"Right",value:"right"})]})]}),S(G,{labelPlacement:"left",children:[y(W,{children:"Pin Column"}),S(ft,{"aria-label":"Pin Column",value:(f=e.pin)!=null?f:"",onChange:l,children:[y(Ee,{label:"Do not pin",value:""}),y(Ee,{label:"Left",value:"left"}),y(Ee,{label:"Right",value:"right"})]})]})]}),y(dt,{column:e,dispatchColumnAction:n,title:"Data Cell"}),S(gt,{title:"Vuu",variant:"secondary",children:[S(G,{labelPlacement:"top",readOnly:!0,children:[y(W,{children:"Name"}),y(ln,{value:e.name})]}),S(G,{labelPlacement:"top",readOnly:!0,children:[y(W,{children:"Vuu Type"}),y(ln,{value:e.serverDataType})]})]})]})]})};export{Nn as ColumnExpressionInput,We as ColumnNamedTerms,ou as ColumnSettingsPanel,gp as DataSourceStats,np as DatagridSettingsPanel,dn as columnExpressionLanguageSupport,xn as isCompleteExpression,hn as isCompleteRelationalExpression,Xe as lastNamedChild,Rn as useColumnExpressionEditor,Ln as useColumnExpressionSuggestionProvider,fn 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 "@salt-ds/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 "@salt-ds/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
+ return /* @__PURE__ */ jsxs4("div", { className: classBase5, id, children: [
1953
+ /* @__PURE__ */ jsxs4("div", { className: `${classBase5}-listColumn`, children: [
1954
+ /* @__PURE__ */ jsx5("label", { htmlFor: `available-${id}`, children: /* @__PURE__ */ jsx5(Text, { as: "h4", children: "Available Columns" }) }),
1955
+ /* @__PURE__ */ jsx5(
1956
+ "div",
1957
+ {
1958
+ className: `${classBase5}-listContainer`,
1959
+ style: { flex: 1, overflow: "hidden" },
1960
+ children: /* @__PURE__ */ jsx5(
1961
+ List,
1962
+ {
1963
+ borderless: true,
1964
+ checkable: false,
1965
+ height: "100%",
1966
+ id: `available-${id}`,
1967
+ itemHeight: 24,
1968
+ itemToString: (item) => item.name,
1969
+ onSelectionChange: handleSelectionChange1,
1970
+ selected: selected1,
1971
+ selectionStrategy: "extended",
1972
+ source: unusedColumns
1973
+ }
1974
+ )
1975
+ }
1976
+ ),
1977
+ /* @__PURE__ */ jsx5(
1978
+ "div",
1979
+ {
1980
+ style: {
1981
+ display: "flex",
1982
+ alignItems: "center",
1983
+ flex: "0 0 32px",
1984
+ marginTop: "var(--salt-size-basis-unit)"
1985
+ },
1986
+ children: /* @__PURE__ */ jsxs4(Button, { onClick: addColumn2, disabled: selected1.length === 0, children: [
1987
+ "Show",
1988
+ /* @__PURE__ */ jsx5("span", { "data-icon": "arrow-thin-right", style: { marginLeft: 8 } })
1989
+ ] })
1990
+ }
1991
+ )
1992
+ ] }),
1993
+ /* @__PURE__ */ jsxs4("div", { className: `${classBase5}-listColumn`, children: [
1994
+ /* @__PURE__ */ jsx5("label", { htmlFor: `selected-${id}`, children: /* @__PURE__ */ jsx5(Text, { as: "h4", children: "Included Columns" }) }),
1995
+ /* @__PURE__ */ jsx5(
1996
+ "div",
1997
+ {
1998
+ className: `${classBase5}-listContainer`,
1999
+ style: { flex: 1, overflow: "hidden" },
2000
+ children: /* @__PURE__ */ jsx5(
2001
+ List,
2002
+ {
2003
+ ListItem: ColumnListItem,
2004
+ borderless: true,
2005
+ height: "100%",
2006
+ id: `selected-${id}`,
2007
+ itemHeight: 24,
2008
+ itemToString: (item) => item.name,
2009
+ onSelectionChange: handleSelectionChange2,
2010
+ selected: selectedColumn,
2011
+ style: { flex: 1 },
2012
+ source: chosenColumns
2013
+ }
2014
+ )
2015
+ }
2016
+ ),
2017
+ /* @__PURE__ */ jsxs4(
2018
+ "div",
2019
+ {
2020
+ style: {
2021
+ alignItems: "center",
2022
+ flex: "0 0 32px",
2023
+ display: "flex",
2024
+ gap: 6,
2025
+ marginTop: "var(--salt-size-basis-unit)"
2026
+ },
2027
+ children: [
2028
+ /* @__PURE__ */ jsxs4(Button, { onClick: removeColumn2, disabled: selectedColumn === null, children: [
2029
+ /* @__PURE__ */ jsx5("span", { "data-icon": "arrow-thin-left", style: { marginRight: 8 } }),
2030
+ "Hide"
2031
+ ] }),
2032
+ /* @__PURE__ */ jsx5(
2033
+ Button,
2034
+ {
2035
+ "aria-label": "Move column up",
2036
+ onClick: moveColumnUp,
2037
+ disabled: selectedColumn === null || (chosenColumns == null ? void 0 : chosenColumns.indexOf(selectedColumn)) === 0,
2038
+ style: { width: 28 },
2039
+ children: /* @__PURE__ */ jsx5("span", { "data-icon": "arrow-thin-up" })
2040
+ }
2041
+ ),
2042
+ /* @__PURE__ */ jsx5(
2043
+ Button,
2044
+ {
2045
+ "aria-label": "Move column down",
2046
+ onClick: moveColumnDown,
2047
+ disabled: selectedColumn === null || chosenColumns.indexOf(selectedColumn) === chosenColumns.length - 1,
2048
+ style: { width: 28 },
2049
+ children: /* @__PURE__ */ jsx5("span", { "data-icon": "arrow-thin-down" })
2050
+ }
2051
+ ),
2052
+ /* @__PURE__ */ jsx5(
2053
+ Button,
2054
+ {
2055
+ "aria-label": "Add calculated column",
2056
+ className: `${classBase5}-addCalculatedColumn`,
2057
+ onClick: onAddCalculatedColumnClick,
2058
+ variant: "primary",
2059
+ children: /* @__PURE__ */ jsx5("span", { "data-icon": "add" })
2060
+ }
2061
+ )
2062
+ ]
2063
+ }
2064
+ )
2065
+ ] })
2066
+ ] });
2067
+ };
2068
+
2069
+ // src/datagrid-configuration-ui/column-settings-panel/ColumnSettingsPanel.tsx
2070
+ import { Stack } from "@vuu-ui/vuu-layout";
2071
+ import { StepperInput as StepperInput2 } from "@salt-ds/lab";
2072
+ import {
2073
+ Checkbox,
2074
+ FormField as FormField2,
2075
+ FormFieldLabel as FormFieldLabel2,
2076
+ Input,
2077
+ Panel as Panel2,
2078
+ RadioButton,
2079
+ RadioButtonGroup,
2080
+ Text as Text3
2081
+ } from "@salt-ds/core";
2082
+ import cx5 from "classnames";
2083
+ import {
2084
+ useCallback as useCallback5,
2085
+ useState as useState2
2086
+ } from "react";
2087
+
2088
+ // src/datagrid-configuration-ui/column-type-panel/ColumnTypePanel.tsx
2089
+ import { getRegisteredCellRenderers } from "@vuu-ui/vuu-utils";
2090
+ import { Dropdown } from "@salt-ds/lab";
2091
+ import { Panel } from "@salt-ds/core";
2092
+ import cx4 from "classnames";
2093
+ import { useMemo as useMemo2 } from "react";
2094
+
2095
+ // src/datagrid-configuration-ui/column-type-panel/NumericColumnPanel.tsx
2096
+ import { StepperInput, Switch } from "@salt-ds/lab";
2097
+ import { FormField, FormFieldLabel, Text as Text2 } from "@salt-ds/core";
2098
+ import { useCallback as useCallback4 } from "react";
2099
+ import { Fragment, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
2100
+ var defaultValues = {
2101
+ alignOnDecimals: false,
2102
+ decimals: 4,
2103
+ zeroPad: false
2104
+ };
2105
+ var getColumnValues = (columnType, gridDefaultValues) => {
2106
+ const columnValue = typeof columnType === "object" && columnType.formatting ? columnType.formatting : {};
2107
+ const properties = ["alignOnDecimals", "decimals", "zeroPad"];
2108
+ return properties.reduce((configValues, property) => {
2109
+ if (columnValue[property] !== void 0) {
2110
+ return {
2111
+ ...configValues,
2112
+ [property]: columnValue[property]
2113
+ };
2114
+ } else if ((gridDefaultValues == null ? void 0 : gridDefaultValues[property]) !== void 0) {
2115
+ return {
2116
+ ...configValues,
2117
+ [property]: gridDefaultValues[property]
2118
+ };
2119
+ }
2120
+ return configValues;
2121
+ }, defaultValues);
2122
+ };
2123
+ var NumericColumnPanel = ({
2124
+ column,
2125
+ dispatchColumnAction
2126
+ }) => {
2127
+ const { decimals, alignOnDecimals, zeroPad } = getColumnValues(column == null ? void 0 : column.type);
2128
+ const dispatchUpdate = useCallback4(
2129
+ (values) => dispatchColumnAction({
2130
+ type: "updateColumnTypeFormatting",
2131
+ column,
2132
+ ...values
2133
+ }),
2134
+ [column, dispatchColumnAction]
2135
+ );
2136
+ const handleChangeDecimals = useCallback4(
2137
+ (value) => dispatchUpdate({ decimals: parseInt(value.toString(), 10) }),
2138
+ [dispatchUpdate]
2139
+ );
2140
+ const handleChangeAlignOnDecimals = useCallback4(
2141
+ (evt, value) => dispatchUpdate({ alignOnDecimals: value }),
2142
+ [dispatchUpdate]
2143
+ );
2144
+ const handleChangeZeroPad = useCallback4(
2145
+ (evt, value) => dispatchUpdate({ zeroPad: value }),
2146
+ [dispatchUpdate]
2147
+ );
2148
+ switch (column.serverDataType) {
2149
+ case "double":
2150
+ return /* @__PURE__ */ jsxs5(Fragment, { children: [
2151
+ /* @__PURE__ */ jsxs5(FormField, { labelPlacement: "top", children: [
2152
+ /* @__PURE__ */ jsx6(FormFieldLabel, { children: "No of Decimals" }),
2153
+ /* @__PURE__ */ jsx6(StepperInput, { value: decimals, onChange: handleChangeDecimals })
2154
+ ] }),
2155
+ /* @__PURE__ */ jsx6(
2156
+ Switch,
2157
+ {
2158
+ checked: alignOnDecimals,
2159
+ label: "Align on decimals",
2160
+ LabelProps: { className: "vuuColumnPanelSwitch" },
2161
+ onChange: handleChangeAlignOnDecimals
2162
+ }
2163
+ ),
2164
+ /* @__PURE__ */ jsx6(
2165
+ Switch,
2166
+ {
2167
+ checked: zeroPad,
2168
+ label: "Zero pad",
2169
+ LabelProps: { className: "vuuColumnPanelSwitch" },
2170
+ onChange: handleChangeZeroPad
2171
+ }
2172
+ )
2173
+ ] });
2174
+ case "long":
2175
+ case "int":
2176
+ return /* @__PURE__ */ jsx6(Fragment, { children: /* @__PURE__ */ jsx6(Text2, { children: "Work in progress" }) });
2177
+ default:
2178
+ return null;
2179
+ }
2180
+ };
2181
+
2182
+ // src/datagrid-configuration-ui/column-type-panel/StringColumnPanel.tsx
2183
+ import { Fragment as Fragment2, jsx as jsx7 } from "react/jsx-runtime";
2184
+ var StringColumnPanel = ({
2185
+ column,
2186
+ dispatchColumnAction
2187
+ }) => {
2188
+ console.log({ column, dispatchColumnAction });
2189
+ return /* @__PURE__ */ jsx7(Fragment2, { children: "what" });
2190
+ };
2191
+
2192
+ // src/datagrid-configuration-ui/column-type-panel/ColumnTypePanel.tsx
2193
+ import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
2194
+ var classBase6 = "vuuColumnTypePanel";
2195
+ var integerCellRenderers = ["Default Renderer (int, long)"];
2196
+ var doubleCellRenderers = ["Default Renderer (double)"];
2197
+ var stringCellRenderers = ["Default Renderer (string)"];
2198
+ var getAvailableCellRenderers = (column) => {
2199
+ const customCellRenderers = getRegisteredCellRenderers(column.serverDataType);
2200
+ const customRendererNames = customCellRenderers.map((r) => r.name);
2201
+ console.log({ customRendererNames });
2202
+ switch (column.serverDataType) {
2203
+ case "char":
2204
+ case "string":
2205
+ return stringCellRenderers;
2206
+ case "int":
2207
+ case "long":
2208
+ return integerCellRenderers;
2209
+ case "double":
2210
+ return doubleCellRenderers.concat(customRendererNames);
2211
+ default:
2212
+ return stringCellRenderers;
2213
+ }
2214
+ };
2215
+ var ColumnTypePanel = ({
2216
+ className,
2217
+ column,
2218
+ dispatchColumnAction,
2219
+ ...props
2220
+ }) => {
2221
+ const content = useMemo2(() => {
2222
+ switch (column.serverDataType) {
2223
+ case "double":
2224
+ case "int":
2225
+ case "long":
2226
+ return /* @__PURE__ */ jsx8(
2227
+ NumericColumnPanel,
2228
+ {
2229
+ column,
2230
+ dispatchColumnAction
2231
+ }
2232
+ );
2233
+ default:
2234
+ return /* @__PURE__ */ jsx8(
2235
+ StringColumnPanel,
2236
+ {
2237
+ column,
2238
+ dispatchColumnAction
2239
+ }
2240
+ );
2241
+ }
2242
+ }, [column, dispatchColumnAction]);
2243
+ const { serverDataType = "string" } = column;
2244
+ const availableRenderers = getAvailableCellRenderers(column);
2245
+ return /* @__PURE__ */ jsxs6(Fragment3, { children: [
2246
+ /* @__PURE__ */ jsx8(
2247
+ Dropdown,
2248
+ {
2249
+ className: cx4(`${classBase6}-renderer`),
2250
+ fullWidth: true,
2251
+ selected: availableRenderers[0],
2252
+ source: availableRenderers
2253
+ }
2254
+ ),
2255
+ /* @__PURE__ */ jsx8(
2256
+ Panel,
2257
+ {
2258
+ ...props,
2259
+ className: cx4(classBase6, className, `${classBase6}-${serverDataType}`),
2260
+ children: content
2261
+ }
2262
+ )
2263
+ ] });
2264
+ };
2265
+
2266
+ // src/datagrid-configuration-ui/column-settings-panel/ColumnSettingsPanel.tsx
2267
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
2268
+ var classBase7 = "vuuColumnSettingsPanel";
2269
+ var tabstripProps = {
2270
+ className: "salt-density-high"
2271
+ };
2272
+ var ColumnSettingsPanel = ({
2273
+ column,
2274
+ dispatchColumnAction,
2275
+ style: styleProp,
2276
+ ...props
2277
+ }) => {
2278
+ var _a, _b, _c, _d;
2279
+ const [activeTab, setActiveTab] = useState2(0);
2280
+ const dispatchUpdate = useCallback5(
2281
+ (values) => dispatchColumnAction({
2282
+ type: "updateColumnProp",
2283
+ column,
2284
+ ...values
2285
+ }),
2286
+ [column, dispatchColumnAction]
2287
+ );
2288
+ const handleChangeAlign = useCallback5(
2289
+ (evt) => dispatchUpdate({ align: evt.target.value }),
2290
+ [dispatchUpdate]
2291
+ );
2292
+ const handleChangePin = useCallback5(
2293
+ (evt) => dispatchUpdate({ pin: evt.target.value }),
2294
+ [dispatchUpdate]
2295
+ );
2296
+ const handleChangeHidden = useCallback5(
2297
+ (evt) => dispatchUpdate({ hidden: evt.target.checked }),
2298
+ [dispatchUpdate]
2299
+ );
2300
+ const handleChangeLabel = useCallback5(
2301
+ (evt) => dispatchUpdate({ label: evt.target.value }),
2302
+ [dispatchUpdate]
2303
+ );
2304
+ const handleChangeWidth = useCallback5(
2305
+ (value) => dispatchUpdate({ width: parseInt(value.toString(), 10) }),
2306
+ [dispatchUpdate]
2307
+ );
2308
+ return /* @__PURE__ */ jsxs7(
2309
+ "div",
2310
+ {
2311
+ className: classBase7,
2312
+ ...props,
2313
+ style: {
2314
+ ...styleProp
2315
+ },
2316
+ children: [
2317
+ /* @__PURE__ */ jsx9(Text3, { as: "h4", children: "Column Settings" }),
2318
+ /* @__PURE__ */ jsxs7(
2319
+ Stack,
2320
+ {
2321
+ active: activeTab,
2322
+ className: cx5(`${classBase7}-columnTabs`),
2323
+ onTabSelectionChanged: setActiveTab,
2324
+ TabstripProps: tabstripProps,
2325
+ children: [
2326
+ /* @__PURE__ */ jsxs7(Panel2, { title: "Column", children: [
2327
+ /* @__PURE__ */ jsxs7(FormField2, { labelPlacement: "left", children: [
2328
+ /* @__PURE__ */ jsx9(FormFieldLabel2, { children: "Hidden" }),
2329
+ /* @__PURE__ */ jsx9(
2330
+ Checkbox,
2331
+ {
2332
+ checked: column.hidden === true,
2333
+ onChange: handleChangeHidden
2334
+ }
2335
+ )
2336
+ ] }),
2337
+ /* @__PURE__ */ jsxs7(FormField2, { labelPlacement: "left", children: [
2338
+ /* @__PURE__ */ jsx9(FormFieldLabel2, { children: "Label" }),
2339
+ /* @__PURE__ */ jsx9(
2340
+ Input,
2341
+ {
2342
+ value: (_a = column.label) != null ? _a : column.name,
2343
+ onChange: handleChangeLabel
2344
+ }
2345
+ )
2346
+ ] }),
2347
+ /* @__PURE__ */ jsxs7(FormField2, { labelPlacement: "left", children: [
2348
+ /* @__PURE__ */ jsx9(FormFieldLabel2, { children: "Width" }),
2349
+ /* @__PURE__ */ jsx9(
2350
+ StepperInput2,
2351
+ {
2352
+ value: (_b = column.width) != null ? _b : 100,
2353
+ onChange: handleChangeWidth
2354
+ }
2355
+ )
2356
+ ] }),
2357
+ /* @__PURE__ */ jsxs7(FormField2, { labelPlacement: "left", children: [
2358
+ /* @__PURE__ */ jsx9(FormFieldLabel2, { children: "ALign" }),
2359
+ /* @__PURE__ */ jsxs7(
2360
+ RadioButtonGroup,
2361
+ {
2362
+ "aria-label": "Column Align",
2363
+ value: (_c = column.align) != null ? _c : "left",
2364
+ onChange: handleChangeAlign,
2365
+ children: [
2366
+ /* @__PURE__ */ jsx9(RadioButton, { label: "Left", value: "left" }),
2367
+ /* @__PURE__ */ jsx9(RadioButton, { label: "Right", value: "right" })
2368
+ ]
2369
+ }
2370
+ )
2371
+ ] }),
2372
+ /* @__PURE__ */ jsxs7(FormField2, { labelPlacement: "left", children: [
2373
+ /* @__PURE__ */ jsx9(FormFieldLabel2, { children: "Pin Column" }),
2374
+ /* @__PURE__ */ jsxs7(
2375
+ RadioButtonGroup,
2376
+ {
2377
+ "aria-label": "Pin Column",
2378
+ value: (_d = column.pin) != null ? _d : "",
2379
+ onChange: handleChangePin,
2380
+ children: [
2381
+ /* @__PURE__ */ jsx9(RadioButton, { label: "Do not pin", value: "" }),
2382
+ /* @__PURE__ */ jsx9(RadioButton, { label: "Left", value: "left" }),
2383
+ /* @__PURE__ */ jsx9(RadioButton, { label: "Right", value: "right" })
2384
+ ]
2385
+ }
2386
+ )
2387
+ ] })
2388
+ ] }),
2389
+ /* @__PURE__ */ jsx9(
2390
+ ColumnTypePanel,
2391
+ {
2392
+ column,
2393
+ dispatchColumnAction,
2394
+ title: "Data Cell"
2395
+ }
2396
+ ),
2397
+ /* @__PURE__ */ jsxs7(Panel2, { title: "Vuu", variant: "secondary", children: [
2398
+ /* @__PURE__ */ jsxs7(FormField2, { labelPlacement: "top", readOnly: true, children: [
2399
+ /* @__PURE__ */ jsx9(FormFieldLabel2, { children: "Name" }),
2400
+ /* @__PURE__ */ jsx9(Input, { value: column.name })
2401
+ ] }),
2402
+ /* @__PURE__ */ jsxs7(FormField2, { labelPlacement: "top", readOnly: true, children: [
2403
+ /* @__PURE__ */ jsx9(FormFieldLabel2, { children: "Vuu Type" }),
2404
+ /* @__PURE__ */ jsx9(Input, { value: column.serverDataType })
2405
+ ] })
2406
+ ] })
2407
+ ]
2408
+ }
2409
+ )
2410
+ ]
2411
+ }
2412
+ );
2413
+ };
2414
+
2415
+ // src/datagrid-configuration-ui/settings-panel/GridSettingsPanel.tsx
2416
+ import {
2417
+ FormField as FormField3,
2418
+ FormFieldLabel as FormFieldLabel3,
2419
+ Panel as Panel3,
2420
+ RadioButton as RadioButton2,
2421
+ RadioButtonGroup as RadioButtonGroup2,
2422
+ Text as Text4
2423
+ } from "@salt-ds/core";
2424
+ import { StepperInput as StepperInput3 } from "@salt-ds/lab";
2425
+ import { useCallback as useCallback6 } from "react";
2426
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
2427
+ var classBase8 = "vuuGridSettingsPanel";
2428
+ var GridSettingsPanel = ({
2429
+ config,
2430
+ dispatchColumnAction,
2431
+ style: styleProp,
2432
+ ...props
2433
+ }) => {
2434
+ var _a;
2435
+ const dispatchUpdate = useCallback6(
2436
+ (values) => dispatchColumnAction({
2437
+ type: "updateGridSettings",
2438
+ ...values
2439
+ }),
2440
+ [dispatchColumnAction]
2441
+ );
2442
+ const handleChangeLabelFormatting = useCallback6(
2443
+ (evt) => dispatchUpdate({
2444
+ columnFormatHeader: evt.target.value
2445
+ }),
2446
+ [dispatchUpdate]
2447
+ );
2448
+ const handleChangeWidth = useCallback6(
2449
+ (value) => dispatchUpdate({ columnDefaultWidth: parseInt(value.toString(), 10) }),
2450
+ [dispatchUpdate]
2451
+ );
2452
+ return /* @__PURE__ */ jsxs8(
2453
+ "div",
2454
+ {
2455
+ className: classBase8,
2456
+ ...props,
2457
+ style: {
2458
+ ...styleProp
2459
+ },
2460
+ children: [
2461
+ /* @__PURE__ */ jsx10(Text4, { as: "h4", children: "Grid Settings" }),
2462
+ /* @__PURE__ */ jsxs8(Panel3, { children: [
2463
+ /* @__PURE__ */ jsxs8(FormField3, { labelPlacement: "left", children: [
2464
+ /* @__PURE__ */ jsx10(FormFieldLabel3, { children: "Format column labels" }),
2465
+ /* @__PURE__ */ jsxs8(
2466
+ RadioButtonGroup2,
2467
+ {
2468
+ "aria-label": "Format column labels",
2469
+ value: config.columnFormatHeader,
2470
+ onChange: handleChangeLabelFormatting,
2471
+ children: [
2472
+ /* @__PURE__ */ jsx10(RadioButton2, { label: "No Formatting", value: void 0 }),
2473
+ /* @__PURE__ */ jsx10(RadioButton2, { label: "Capitalize", value: "capitalize" }),
2474
+ /* @__PURE__ */ jsx10(RadioButton2, { label: "Uppercase", value: "uppercase" })
2475
+ ]
2476
+ }
2477
+ )
2478
+ ] }),
2479
+ /* @__PURE__ */ jsxs8(FormField3, { labelPlacement: "left", children: [
2480
+ /* @__PURE__ */ jsx10(FormFieldLabel3, { children: "Default Column Width" }),
2481
+ /* @__PURE__ */ jsx10(
2482
+ StepperInput3,
2483
+ {
2484
+ value: (_a = config.columnDefaultWidth) != null ? _a : 100,
2485
+ onChange: handleChangeWidth
2486
+ }
2487
+ )
2488
+ ] })
2489
+ ] })
2490
+ ]
2491
+ }
2492
+ );
2493
+ };
2494
+
2495
+ // src/datagrid-configuration-ui/settings-panel/useGridSettings.ts
2496
+ import { useReducer } from "react";
2497
+ import { moveItem } from "@vuu-ui/vuu-ui-controls";
2498
+ import { fromServerDataType } from "@vuu-ui/vuu-utils";
2499
+ var gridSettingsReducer = (state, action) => {
2500
+ console.log(`gridSettingsReducer ${action.type}`);
2501
+ switch (action.type) {
2502
+ case "addColumn":
2503
+ return addColumn(state, action);
2504
+ case "addCalculatedColumn":
2505
+ return addCalculatedColumn(state, action);
2506
+ case "moveColumn":
2507
+ return moveColumn(state, action);
2508
+ case "removeColumn":
2509
+ return removeColumn(state, action);
2510
+ case "updateColumn":
2511
+ return state;
2512
+ case "updateColumnProp":
2513
+ return updateColumnProp(state, action);
2514
+ case "updateGridSettings":
2515
+ return updateGridSettings(state, action);
2516
+ case "updateColumnTypeFormatting":
2517
+ return updateColumnTypeFormatting(state, action);
2518
+ default:
2519
+ return state;
2520
+ }
2521
+ };
2522
+ var useGridSettings = (config) => {
2523
+ const [state, dispatchColumnAction] = useReducer(
2524
+ gridSettingsReducer,
2525
+ config
2526
+ );
2527
+ return {
2528
+ gridSettings: state,
2529
+ dispatchColumnAction
2530
+ };
2531
+ };
2532
+ function addColumn(state, { column, columns, index = -1 }) {
2533
+ const { columns: stateColumns } = state;
2534
+ if (index === -1) {
2535
+ if (Array.isArray(columns)) {
2536
+ return { ...state, columns: stateColumns.concat(columns) };
2537
+ } else if (column) {
2538
+ return { ...state, columns: stateColumns.concat(column) };
2539
+ }
2540
+ }
2541
+ return state;
2542
+ }
2543
+ function addCalculatedColumn(state, { columnName, columnType, expression }) {
2544
+ const { columns: stateColumns } = state;
2545
+ const calculatedColumn = {
2546
+ name: columnName,
2547
+ expression,
2548
+ serverDataType: columnType
2549
+ };
2550
+ return { ...state, columns: stateColumns.concat(calculatedColumn) };
2551
+ }
2552
+ function removeColumn(state, { column }) {
2553
+ const { columns: stateColumns } = state;
2554
+ return {
2555
+ ...state,
2556
+ columns: stateColumns.filter((col) => col.name !== column.name)
2557
+ };
2558
+ }
2559
+ function moveColumn(state, { column, moveBy, moveFrom, moveTo }) {
2560
+ const { columns: stateColumns } = state;
2561
+ if (column && typeof moveBy === "number") {
2562
+ const idx = stateColumns.indexOf(column);
2563
+ const newColumns = stateColumns.slice();
2564
+ const [movedColumns] = newColumns.splice(idx, 1);
2565
+ newColumns.splice(idx + moveBy, 0, movedColumns);
2566
+ return {
2567
+ ...state,
2568
+ columns: newColumns
2569
+ };
2570
+ } else if (typeof moveFrom === "number" && typeof moveTo === "number") {
2571
+ return {
2572
+ ...state,
2573
+ columns: moveItem(stateColumns, moveFrom, moveTo)
2574
+ };
2575
+ } else {
2576
+ return state;
2577
+ }
2578
+ }
2579
+ function updateColumnProp(state, { align, column, hidden, label, width }) {
2580
+ let { columns: stateColumns } = state;
2581
+ if (align === "left" || align === "right") {
2582
+ stateColumns = replaceColumn(stateColumns, { ...column, align });
2583
+ }
2584
+ if (typeof hidden === "boolean") {
2585
+ stateColumns = replaceColumn(stateColumns, { ...column, hidden });
2586
+ }
2587
+ if (typeof label === "string") {
2588
+ stateColumns = replaceColumn(stateColumns, { ...column, label });
2589
+ }
2590
+ if (typeof width === "number") {
2591
+ stateColumns = replaceColumn(stateColumns, { ...column, width });
2592
+ }
2593
+ return {
2594
+ ...state,
2595
+ columns: stateColumns
2596
+ };
2597
+ }
2598
+ function updateGridSettings(state, { columnFormatHeader }) {
2599
+ return {
2600
+ ...state,
2601
+ columnFormatHeader: columnFormatHeader != null ? columnFormatHeader : state.columnFormatHeader
2602
+ };
2603
+ }
2604
+ function updateColumnTypeFormatting(state, {
2605
+ alignOnDecimals,
2606
+ column,
2607
+ decimals,
2608
+ zeroPad
2609
+ }) {
2610
+ const { columns: stateColumns } = state;
2611
+ const targetColumn = stateColumns.find((col) => col.name === column.name);
2612
+ if (targetColumn) {
2613
+ const {
2614
+ serverDataType = "string",
2615
+ type: columnType = fromServerDataType(serverDataType)
2616
+ } = column;
2617
+ const type = typeof columnType === "string" ? {
2618
+ name: columnType
2619
+ } : {
2620
+ ...columnType
2621
+ };
2622
+ if (typeof alignOnDecimals === "boolean") {
2623
+ type.formatting = {
2624
+ ...type.formatting,
2625
+ alignOnDecimals
2626
+ };
2627
+ }
2628
+ if (typeof decimals === "number") {
2629
+ type.formatting = {
2630
+ ...type.formatting,
2631
+ decimals
2632
+ };
2633
+ }
2634
+ if (typeof zeroPad === "boolean") {
2635
+ type.formatting = {
2636
+ ...type.formatting,
2637
+ zeroPad
2638
+ };
2639
+ }
2640
+ return {
2641
+ ...state,
2642
+ columns: replaceColumn(stateColumns, { ...column, type })
2643
+ };
2644
+ } else {
2645
+ return state;
2646
+ }
2647
+ }
2648
+ function replaceColumn(columns, column) {
2649
+ return columns.map((col) => col.name === column.name ? column : col);
2650
+ }
2651
+
2652
+ // src/datagrid-configuration-ui/settings-panel/DatagridSettingsPanel.tsx
2653
+ import { Stack as Stack2 } from "@vuu-ui/vuu-layout";
2654
+
2655
+ // src/datagrid-configuration-ui/calculated-column-panel/CalculatedColumnPanel.tsx
2656
+ import {
2657
+ Button as Button2,
2658
+ FormField as FormField4,
2659
+ FormFieldLabel as FormFieldLabel4,
2660
+ Input as Input2,
2661
+ Panel as Panel4,
2662
+ Text as Text5
2663
+ } from "@salt-ds/core";
2664
+ import {
2665
+ useCallback as useCallback7,
2666
+ useRef as useRef4,
2667
+ useState as useState3
2668
+ } from "react";
2669
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
2670
+ var CalculatedColumnPanel = ({
2671
+ columns,
2672
+ dispatchColumnAction,
2673
+ table
2674
+ }) => {
2675
+ const [columnName, setColumnName] = useState3("");
2676
+ const [, setExpression] = useState3();
2677
+ const sourceRef = useRef4("");
2678
+ const suggestionProvider = useColumnExpressionSuggestionProvider({
2679
+ columns,
2680
+ table
2681
+ });
2682
+ const handleChangeName = useCallback7(
2683
+ (evt) => {
2684
+ const { value } = evt.target;
2685
+ setColumnName(value);
2686
+ },
2687
+ []
2688
+ );
2689
+ const handleChangeExpression = useCallback7((source) => {
2690
+ sourceRef.current = source;
2691
+ }, []);
2692
+ const handleSubmitExpression = useCallback7(
2693
+ (source, expression) => {
2694
+ console.log({ source });
2695
+ setExpression(expression);
2696
+ },
2697
+ []
2698
+ );
2699
+ const handleSave = useCallback7(() => {
2700
+ if (sourceRef.current) {
2701
+ console.log(
2702
+ `save expression ${JSON.stringify(sourceRef.current, null, 2)}`
2703
+ );
2704
+ dispatchColumnAction({
2705
+ type: "addCalculatedColumn",
2706
+ columnName,
2707
+ expression: sourceRef.current,
2708
+ columnType: "string"
2709
+ });
2710
+ }
2711
+ }, [columnName, dispatchColumnAction]);
2712
+ return /* @__PURE__ */ jsxs9(Panel4, { className: "vuuCalculatedColumnPanel", title: "Define Computed Column", children: [
2713
+ /* @__PURE__ */ jsx11(Text5, { styleAs: "h4", children: "Define Computed Column" }),
2714
+ /* @__PURE__ */ jsxs9(FormField4, { labelPlacement: "left", children: [
2715
+ /* @__PURE__ */ jsx11(FormFieldLabel4, { children: "Column Name" }),
2716
+ /* @__PURE__ */ jsx11(Input2, { value: columnName, onChange: handleChangeName })
2717
+ ] }),
2718
+ /* @__PURE__ */ jsx11(
2719
+ ColumnExpressionInput,
2720
+ {
2721
+ onChange: handleChangeExpression,
2722
+ onSubmitExpression: handleSubmitExpression,
2723
+ suggestionProvider
2724
+ }
2725
+ ),
2726
+ /* @__PURE__ */ jsx11("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsx11(Button2, { onClick: handleSave, children: "Add Column" }) })
2727
+ ] });
2728
+ };
2729
+
2730
+ // src/datagrid-configuration-ui/settings-panel/DatagridSettingsPanel.tsx
2731
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
2732
+ var classBase9 = "vuuDatagridSettingsPanel";
2733
+ var getTabLabel = () => void 0;
2734
+ var icons = [
2735
+ "table-settings",
2736
+ "column-chooser",
2737
+ "column-settings",
2738
+ "define-column"
2739
+ ];
2740
+ var getTabIcon = (component, tabIndex) => icons[tabIndex];
2741
+ var DatagridSettingsPanel = ({
2742
+ availableColumns,
2743
+ className,
2744
+ gridConfig,
2745
+ onCancel,
2746
+ onConfigChange,
2747
+ ...props
2748
+ }) => {
2749
+ var _a;
2750
+ console.log(`DatagridSettingsPanel render`);
2751
+ const [selectedTabIndex, setSelectedTabIndex] = useState4(0);
2752
+ const { gridSettings, dispatchColumnAction } = useGridSettings(gridConfig);
2753
+ const [selectedColumnName, setSelectedColumnName] = useState4(
2754
+ null
2755
+ );
2756
+ const handleColumnSelected = useCallback8(
2757
+ (selected) => {
2758
+ setSelectedColumnName(selected ? selected.name : null);
2759
+ },
2760
+ []
2761
+ );
2762
+ const handleApply = useCallback8(
2763
+ (evt, closePanel = false) => {
2764
+ console.log(`1) DataGridSettingsPanel fire onConfigChange`);
2765
+ onConfigChange == null ? void 0 : onConfigChange(gridSettings, closePanel);
2766
+ },
2767
+ [gridSettings, onConfigChange]
2768
+ );
2769
+ const handleTabSelectionChanged = useCallback8((selectedTabIndex2) => {
2770
+ setSelectedTabIndex(selectedTabIndex2);
2771
+ }, []);
2772
+ const handleSave = useCallback8(
2773
+ (evt) => handleApply(evt, true),
2774
+ [handleApply]
2775
+ );
2776
+ const selectedColumn = selectedColumnName === null ? null : (_a = gridSettings.columns.find((col) => col.name === selectedColumnName)) != null ? _a : null;
2777
+ const tabstripProps3 = {
2778
+ activeTabIndex: selectedTabIndex,
2779
+ allowRenameTab: false,
2780
+ orientation: "vertical"
2781
+ };
2782
+ const handleAddCalculatedColumn = useCallback8(
2783
+ () => setSelectedTabIndex(3),
2784
+ []
2785
+ );
2786
+ const panelShift = selectedTabIndex === 2 ? "right" : void 0;
2787
+ return /* @__PURE__ */ jsxs10("div", { ...props, className: cx6(classBase9, className), children: [
2788
+ /* @__PURE__ */ jsxs10(
2789
+ Stack2,
2790
+ {
2791
+ TabstripProps: tabstripProps3,
2792
+ className: `${classBase9}-stack`,
2793
+ getTabIcon,
2794
+ getTabLabel,
2795
+ active: selectedTabIndex === 2 ? 1 : selectedTabIndex,
2796
+ onTabSelectionChanged: handleTabSelectionChanged,
2797
+ children: [
2798
+ /* @__PURE__ */ jsx12(
2799
+ GridSettingsPanel,
2800
+ {
2801
+ config: gridSettings,
2802
+ dispatchColumnAction
2803
+ }
2804
+ ),
2805
+ /* @__PURE__ */ jsxs10("div", { className: `${classBase9}-columnPanels`, "data-align": panelShift, children: [
2806
+ /* @__PURE__ */ jsx12(
2807
+ ColumnPicker,
2808
+ {
2809
+ availableColumns,
2810
+ chosenColumns: gridSettings.columns,
2811
+ dispatchColumnAction,
2812
+ onSelectionChange: handleColumnSelected,
2813
+ onAddCalculatedColumnClick: handleAddCalculatedColumn,
2814
+ selectedColumn
2815
+ }
2816
+ ),
2817
+ selectedColumn === null ? /* @__PURE__ */ jsx12(Panel5, { className: "vuuColumnSettingsPanel", children: "Select a column" }) : /* @__PURE__ */ jsx12(
2818
+ ColumnSettingsPanel,
2819
+ {
2820
+ column: selectedColumn,
2821
+ dispatchColumnAction,
2822
+ style: { background: "white", flex: "1 0 150px" }
2823
+ }
2824
+ )
2825
+ ] }),
2826
+ /* @__PURE__ */ jsx12("div", { title: "Column Settings", children: "Column Settings" }),
2827
+ /* @__PURE__ */ jsx12(
2828
+ CalculatedColumnPanel,
2829
+ {
2830
+ columns: gridSettings.columns,
2831
+ dispatchColumnAction,
2832
+ table: { module: "SIMUL", table: "instruments" }
2833
+ }
2834
+ )
2835
+ ]
2836
+ }
2837
+ ),
2838
+ /* @__PURE__ */ jsxs10("div", { className: `${classBase9}-buttonBar`, children: [
2839
+ /* @__PURE__ */ jsx12(Button3, { onClick: onCancel, children: "Cancel" }),
2840
+ /* @__PURE__ */ jsx12(Button3, { onClick: handleApply, children: "Apply" }),
2841
+ /* @__PURE__ */ jsx12(Button3, { onClick: handleSave, children: "Save" })
2842
+ ] })
2843
+ ] });
2844
+ };
2845
+
2846
+ // src/datasource-stats/DatasourceStats.tsx
2847
+ import { useEffect as useEffect3, useState as useState5 } from "react";
2848
+ import cx7 from "classnames";
2849
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
2850
+ var classBase10 = "vuuDatasourceStats";
2851
+ var numberFormatter = new Intl.NumberFormat();
2852
+ var DataSourceStats = ({
2853
+ className: classNameProp,
2854
+ dataSource
2855
+ }) => {
2856
+ const [range, setRange] = useState5(dataSource.range);
2857
+ const [size, setSize] = useState5(dataSource.size);
2858
+ useEffect3(() => {
2859
+ setSize(dataSource.size);
2860
+ dataSource.on("resize", setSize);
2861
+ dataSource.on("range", setRange);
2862
+ }, [dataSource]);
2863
+ const className = cx7(classBase10, classNameProp);
2864
+ const from = numberFormatter.format(range.from);
2865
+ const to = numberFormatter.format(range.to - 1);
2866
+ const value = numberFormatter.format(size);
2867
+ return /* @__PURE__ */ jsxs11("div", { className, children: [
2868
+ /* @__PURE__ */ jsx13("span", { children: "Showing rows" }),
2869
+ /* @__PURE__ */ jsx13("span", { className: `${classBase10}-range`, children: from }),
2870
+ /* @__PURE__ */ jsx13("span", { className: `${classBase10}-range`, children: to }),
2871
+ /* @__PURE__ */ jsx13("span", { children: "of" }),
2872
+ /* @__PURE__ */ jsx13("span", { className: `${classBase10}-size`, children: value })
2873
+ ] });
2874
+ };
2875
+
2876
+ // src/table-settings/column-settings-panel/ColumnSettingsPanel.tsx
2877
+ import { Stack as Stack3 } from "@vuu-ui/vuu-layout";
2878
+ import { StepperInput as StepperInput5 } from "@salt-ds/lab";
2879
+ import {
2880
+ Checkbox as Checkbox2,
2881
+ FormField as FormField6,
2882
+ FormFieldLabel as FormFieldLabel6,
2883
+ Input as Input3,
2884
+ Panel as Panel7,
2885
+ RadioButton as RadioButton3,
2886
+ RadioButtonGroup as RadioButtonGroup3,
2887
+ Text as Text7
2888
+ } from "@salt-ds/core";
2889
+ import cx9 from "classnames";
2890
+ import {
2891
+ useCallback as useCallback10,
2892
+ useState as useState6
2893
+ } from "react";
2894
+
2895
+ // src/table-settings/column-type-panel/ColumnTypePanel.tsx
2896
+ import { getRegisteredCellRenderers as getRegisteredCellRenderers2 } from "@vuu-ui/vuu-utils";
2897
+ import { Dropdown as Dropdown2 } from "@salt-ds/lab";
2898
+ import { Panel as Panel6 } from "@salt-ds/core";
2899
+ import cx8 from "classnames";
2900
+ import { useMemo as useMemo3 } from "react";
2901
+
2902
+ // src/table-settings/column-type-panel/NumericColumnPanel.tsx
2903
+ import { StepperInput as StepperInput4, Switch as Switch2 } from "@salt-ds/lab";
2904
+ import {
2905
+ FormField as FormField5,
2906
+ FormFieldLabel as FormFieldLabel5,
2907
+ Text as Text6
2908
+ } from "@salt-ds/core";
2909
+ import { useCallback as useCallback9 } from "react";
2910
+ import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
2911
+ var defaultValues2 = {
2912
+ alignOnDecimals: false,
2913
+ decimals: 4,
2914
+ zeroPad: false
2915
+ };
2916
+ var getColumnValues2 = (columnType, gridDefaultValues) => {
2917
+ const columnValue = typeof columnType === "object" && columnType.formatting ? columnType.formatting : {};
2918
+ const properties = ["alignOnDecimals", "decimals", "zeroPad"];
2919
+ return properties.reduce((configValues, property) => {
2920
+ if (columnValue[property] !== void 0) {
2921
+ return {
2922
+ ...configValues,
2923
+ [property]: columnValue[property]
2924
+ };
2925
+ } else if ((gridDefaultValues == null ? void 0 : gridDefaultValues[property]) !== void 0) {
2926
+ return {
2927
+ ...configValues,
2928
+ [property]: gridDefaultValues[property]
2929
+ };
2930
+ }
2931
+ return configValues;
2932
+ }, defaultValues2);
2933
+ };
2934
+ var NumericColumnPanel2 = ({
2935
+ column,
2936
+ dispatchColumnAction
2937
+ }) => {
2938
+ const { decimals, alignOnDecimals, zeroPad } = getColumnValues2(column == null ? void 0 : column.type);
2939
+ const dispatchUpdate = useCallback9(
2940
+ (values) => dispatchColumnAction({
2941
+ type: "updateColumnTypeFormatting",
2942
+ column,
2943
+ ...values
2944
+ }),
2945
+ [column, dispatchColumnAction]
2946
+ );
2947
+ const handleChangeDecimals = useCallback9(
2948
+ (value) => dispatchUpdate({ decimals: parseInt(value.toString(), 10) }),
2949
+ [dispatchUpdate]
2950
+ );
2951
+ const handleChangeAlignOnDecimals = useCallback9(
2952
+ (evt, value) => dispatchUpdate({ alignOnDecimals: value }),
2953
+ [dispatchUpdate]
2954
+ );
2955
+ const handleChangeZeroPad = useCallback9(
2956
+ (evt, value) => dispatchUpdate({ zeroPad: value }),
2957
+ [dispatchUpdate]
2958
+ );
2959
+ switch (column.serverDataType) {
2960
+ case "double":
2961
+ return /* @__PURE__ */ jsxs12(Fragment4, { children: [
2962
+ /* @__PURE__ */ jsxs12(FormField5, { labelPlacement: "top", children: [
2963
+ /* @__PURE__ */ jsx14(FormFieldLabel5, { children: "No of Decimals" }),
2964
+ /* @__PURE__ */ jsx14(StepperInput4, { value: decimals, onChange: handleChangeDecimals })
2965
+ ] }),
2966
+ /* @__PURE__ */ jsx14(
2967
+ Switch2,
2968
+ {
2969
+ checked: alignOnDecimals,
2970
+ label: "Align on decimals",
2971
+ LabelProps: { className: "vuuColumnPanelSwitch" },
2972
+ onChange: handleChangeAlignOnDecimals
2973
+ }
2974
+ ),
2975
+ /* @__PURE__ */ jsx14(
2976
+ Switch2,
2977
+ {
2978
+ checked: zeroPad,
2979
+ label: "Zero pad",
2980
+ LabelProps: { className: "vuuColumnPanelSwitch" },
2981
+ onChange: handleChangeZeroPad
2982
+ }
2983
+ )
2984
+ ] });
2985
+ case "long":
2986
+ case "int":
2987
+ return /* @__PURE__ */ jsx14(Fragment4, { children: /* @__PURE__ */ jsx14(Text6, { children: "Work in progress" }) });
2988
+ default:
2989
+ return null;
2990
+ }
2991
+ };
2992
+
2993
+ // src/table-settings/column-type-panel/StringColumnPanel.tsx
2994
+ import { Fragment as Fragment5, jsx as jsx15 } from "react/jsx-runtime";
2995
+ var StringColumnPanel2 = ({
2996
+ column,
2997
+ dispatchColumnAction
2998
+ }) => {
2999
+ console.log(column, dispatchColumnAction);
3000
+ return /* @__PURE__ */ jsx15(Fragment5, { children: "what" });
3001
+ };
3002
+
3003
+ // src/table-settings/column-type-panel/ColumnTypePanel.tsx
3004
+ import { Fragment as Fragment6, jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
3005
+ var classBase11 = "vuuColumnTypePanel";
3006
+ var integerCellRenderers2 = ["Default Renderer (int, long)"];
3007
+ var doubleCellRenderers2 = ["Default Renderer (double)"];
3008
+ var stringCellRenderers2 = ["Default Renderer (string)"];
3009
+ var getAvailableCellRenderers2 = (column) => {
3010
+ const customCellRenderers = getRegisteredCellRenderers2(column.serverDataType);
3011
+ const customRendererNames = customCellRenderers.map((r) => r.name);
3012
+ console.log({ customRendererNames });
3013
+ switch (column.serverDataType) {
3014
+ case "char":
3015
+ case "string":
3016
+ return stringCellRenderers2;
3017
+ case "int":
3018
+ case "long":
3019
+ return integerCellRenderers2;
3020
+ case "double":
3021
+ return doubleCellRenderers2.concat(customRendererNames);
3022
+ default:
3023
+ return stringCellRenderers2;
3024
+ }
3025
+ };
3026
+ var ColumnTypePanel2 = ({
3027
+ className,
3028
+ column,
3029
+ dispatchColumnAction,
3030
+ ...props
3031
+ }) => {
3032
+ const content = useMemo3(() => {
3033
+ switch (column.serverDataType) {
3034
+ case "double":
3035
+ case "int":
3036
+ case "long":
3037
+ return /* @__PURE__ */ jsx16(
3038
+ NumericColumnPanel2,
3039
+ {
3040
+ column,
3041
+ dispatchColumnAction
3042
+ }
3043
+ );
3044
+ default:
3045
+ return /* @__PURE__ */ jsx16(
3046
+ StringColumnPanel2,
3047
+ {
3048
+ column,
3049
+ dispatchColumnAction
3050
+ }
3051
+ );
3052
+ }
3053
+ }, [column, dispatchColumnAction]);
3054
+ const { serverDataType = "string" } = column;
3055
+ const availableRenderers = getAvailableCellRenderers2(column);
3056
+ return /* @__PURE__ */ jsxs13(Fragment6, { children: [
3057
+ /* @__PURE__ */ jsx16(
3058
+ Dropdown2,
3059
+ {
3060
+ className: cx8(`${classBase11}-renderer`),
3061
+ fullWidth: true,
3062
+ selected: availableRenderers[0],
3063
+ source: availableRenderers
3064
+ }
3065
+ ),
3066
+ /* @__PURE__ */ jsx16(
3067
+ Panel6,
3068
+ {
3069
+ ...props,
3070
+ className: cx8(classBase11, className, `${classBase11}-${serverDataType}`),
3071
+ children: content
3072
+ }
3073
+ )
3074
+ ] });
3075
+ };
3076
+
3077
+ // src/table-settings/column-settings-panel/ColumnSettingsPanel.tsx
3078
+ import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
3079
+ var classBase12 = "vuuColumnSettingsPanel";
3080
+ var tabstripProps2 = {
3081
+ className: "salt-density-high"
3082
+ };
3083
+ var ColumnSettingsPanel2 = ({
3084
+ column,
3085
+ dispatchColumnAction,
3086
+ style: styleProp,
3087
+ ...props
3088
+ }) => {
3089
+ var _a, _b, _c, _d;
3090
+ const [activeTab, setActiveTab] = useState6(0);
3091
+ const dispatchUpdate = useCallback10(
3092
+ (values) => dispatchColumnAction({
3093
+ type: "updateColumnProp",
3094
+ column,
3095
+ ...values
3096
+ }),
3097
+ [column, dispatchColumnAction]
3098
+ );
3099
+ const handleChangeAlign = useCallback10(
3100
+ (evt) => dispatchUpdate({ align: evt.target.value }),
3101
+ [dispatchUpdate]
3102
+ );
3103
+ const handleChangePin = useCallback10(
3104
+ (evt) => dispatchUpdate({ pin: evt.target.value }),
3105
+ [dispatchUpdate]
3106
+ );
3107
+ const handleChangeHidden = useCallback10(
3108
+ (evt) => dispatchUpdate({ hidden: evt.target.checked }),
3109
+ [dispatchUpdate]
3110
+ );
3111
+ const handleChangeLabel = useCallback10(
3112
+ (evt) => dispatchUpdate({ label: evt.target.value }),
3113
+ [dispatchUpdate]
3114
+ );
3115
+ const handleChangeWidth = useCallback10(
3116
+ (value) => dispatchUpdate({ width: parseInt(value.toString(), 10) }),
3117
+ [dispatchUpdate]
3118
+ );
3119
+ return /* @__PURE__ */ jsxs14(
3120
+ "div",
3121
+ {
3122
+ className: classBase12,
3123
+ ...props,
3124
+ style: {
3125
+ ...styleProp
3126
+ },
3127
+ children: [
3128
+ /* @__PURE__ */ jsx17(Text7, { as: "h4", children: "Column Settings" }),
3129
+ /* @__PURE__ */ jsxs14(
3130
+ Stack3,
3131
+ {
3132
+ active: activeTab,
3133
+ className: cx9(`${classBase12}-columnTabs`),
3134
+ onTabSelectionChanged: setActiveTab,
3135
+ TabstripProps: tabstripProps2,
3136
+ children: [
3137
+ /* @__PURE__ */ jsxs14(Panel7, { title: "Column", children: [
3138
+ /* @__PURE__ */ jsxs14(FormField6, { labelPlacement: "left", children: [
3139
+ /* @__PURE__ */ jsx17(FormFieldLabel6, { children: "Hidden" }),
3140
+ /* @__PURE__ */ jsx17(
3141
+ Checkbox2,
3142
+ {
3143
+ checked: column.hidden === true,
3144
+ onChange: handleChangeHidden
3145
+ }
3146
+ )
3147
+ ] }),
3148
+ /* @__PURE__ */ jsxs14(FormField6, { labelPlacement: "left", children: [
3149
+ /* @__PURE__ */ jsx17(FormFieldLabel6, { children: "Label" }),
3150
+ /* @__PURE__ */ jsx17(
3151
+ Input3,
3152
+ {
3153
+ value: (_a = column.label) != null ? _a : column.name,
3154
+ onChange: handleChangeLabel
3155
+ }
3156
+ )
3157
+ ] }),
3158
+ /* @__PURE__ */ jsxs14(FormField6, { labelPlacement: "left", children: [
3159
+ /* @__PURE__ */ jsx17(FormFieldLabel6, { children: "Width" }),
3160
+ /* @__PURE__ */ jsx17(
3161
+ StepperInput5,
3162
+ {
3163
+ value: (_b = column.width) != null ? _b : 100,
3164
+ onChange: handleChangeWidth
3165
+ }
3166
+ )
3167
+ ] }),
3168
+ /* @__PURE__ */ jsxs14(FormField6, { labelPlacement: "left", children: [
3169
+ /* @__PURE__ */ jsx17(FormFieldLabel6, { children: "Align" }),
3170
+ /* @__PURE__ */ jsxs14(
3171
+ RadioButtonGroup3,
3172
+ {
3173
+ "aria-label": "Column Align",
3174
+ value: (_c = column.align) != null ? _c : "left",
3175
+ onChange: handleChangeAlign,
3176
+ children: [
3177
+ /* @__PURE__ */ jsx17(RadioButton3, { label: "Left", value: "left" }),
3178
+ /* @__PURE__ */ jsx17(RadioButton3, { label: "Right", value: "right" })
3179
+ ]
3180
+ }
3181
+ )
3182
+ ] }),
3183
+ /* @__PURE__ */ jsxs14(FormField6, { labelPlacement: "left", children: [
3184
+ /* @__PURE__ */ jsx17(FormFieldLabel6, { children: "Pin Column" }),
3185
+ /* @__PURE__ */ jsxs14(
3186
+ RadioButtonGroup3,
3187
+ {
3188
+ "aria-label": "Pin Column",
3189
+ value: (_d = column.pin) != null ? _d : "",
3190
+ onChange: handleChangePin,
3191
+ children: [
3192
+ /* @__PURE__ */ jsx17(RadioButton3, { label: "Do not pin", value: "" }),
3193
+ /* @__PURE__ */ jsx17(RadioButton3, { label: "Left", value: "left" }),
3194
+ /* @__PURE__ */ jsx17(RadioButton3, { label: "Right", value: "right" })
3195
+ ]
3196
+ }
3197
+ )
3198
+ ] })
3199
+ ] }),
3200
+ /* @__PURE__ */ jsx17(
3201
+ ColumnTypePanel2,
3202
+ {
3203
+ column,
3204
+ dispatchColumnAction,
3205
+ title: "Data Cell"
3206
+ }
3207
+ ),
3208
+ /* @__PURE__ */ jsxs14(Panel7, { title: "Vuu", variant: "secondary", children: [
3209
+ /* @__PURE__ */ jsxs14(FormField6, { labelPlacement: "top", readOnly: true, children: [
3210
+ /* @__PURE__ */ jsx17(FormFieldLabel6, { children: "Name" }),
3211
+ /* @__PURE__ */ jsx17(Input3, { value: column.name })
3212
+ ] }),
3213
+ /* @__PURE__ */ jsxs14(FormField6, { labelPlacement: "top", readOnly: true, children: [
3214
+ /* @__PURE__ */ jsx17(FormFieldLabel6, { children: "Vuu Type" }),
3215
+ /* @__PURE__ */ jsx17(Input3, { value: column.serverDataType })
3216
+ ] })
3217
+ ] })
3218
+ ]
3219
+ }
3220
+ )
3221
+ ]
3222
+ }
3223
+ );
3224
+ };
3225
+ export {
3226
+ ColumnExpressionInput,
3227
+ ColumnNamedTerms,
3228
+ ColumnSettingsPanel2 as ColumnSettingsPanel,
3229
+ DataSourceStats,
3230
+ DatagridSettingsPanel,
3231
+ columnExpressionLanguageSupport,
3232
+ isCompleteExpression,
3233
+ isCompleteRelationalExpression,
3234
+ lastNamedChild,
3235
+ useColumnExpressionEditor,
3236
+ useColumnExpressionSuggestionProvider,
3237
+ walkTree
3238
+ };
2
3239
  //# sourceMappingURL=index.js.map