@vuu-ui/vuu-table-extras 0.8.32 → 0.8.33

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/cjs/index.js CHANGED
@@ -1,2 +1,54 @@
1
- "use strict";var ln=Object.create;var it=Object.defineProperty;var un=Object.getOwnPropertyDescriptor;var pn=Object.getOwnPropertyNames;var cn=Object.getPrototypeOf,mn=Object.prototype.hasOwnProperty;var dn=(t,e)=>{for(var o in e)it(t,o,{get:e[o],enumerable:!0})},so=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of pn(e))!mn.call(t,s)&&s!==o&&it(t,s,{get:()=>e[s],enumerable:!(n=un(e,s))||n.enumerable});return t};var ue=(t,e,o)=>(o=t!=null?ln(cn(t)):{},so(e||!t||!t.__esModule?it(o,"default",{value:t,enumerable:!0}):o,t)),gn=t=>so(it({},"__esModule",{value:!0}),t);var io=(t,e,o)=>{if(!e.has(t))throw TypeError("Cannot "+o)};var f=(t,e,o)=>(io(t,e,"read from private field"),o?o.call(t):e.get(t)),U=(t,e,o)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,o)},pe=(t,e,o,n)=>(io(t,e,"write to private field"),n?n.call(t,o):e.set(t,o),o);var hr={};dn(hr,{BackgroundCell:()=>fo,BackgroundCellConfigurationEditor:()=>ho,BaseNumericFormattingSettings:()=>ot,CaseValidator:()=>lo,ColumnExpressionInput:()=>yt,ColumnExpressionPanel:()=>Kt,ColumnFormattingPanel:()=>oo,ColumnList:()=>Rt,ColumnNamedTerms:()=>xt,ColumnSettingsPanel:()=>gr,DataSourceStats:()=>fr,DateTimeFormattingSettings:()=>jt,DropdownCell:()=>bo,LookupCell:()=>Oo,PatternValidator:()=>po,PctProgressCell:()=>ko,TableSettingsPanel:()=>xr,columnExpressionLanguageSupport:()=>Nt,isCompleteExpression:()=>zt,isCompleteRelationalExpression:()=>Zt,lastNamedChild:()=>ht,useColumnExpressionEditor:()=>qt,useColumnExpressionSuggestionProvider:()=>Jt,useTableSettings:()=>ro,walkTree:()=>$t});module.exports=gn(hr);var ao=require("@vuu-ui/vuu-utils"),fn=t=>typeof t=="string",lo=(t,e)=>fn(e)?e===""?!0:t.value==="lower"&&e.toLowerCase()!==e?"value must be all lowercase":t.value==="upper"&&e.toUpperCase()!==e?"value must be all uppercase":!0:"value must be a string";(0,ao.registerComponent)("vuu-case",lo,"data-edit-validator",{});var uo=require("@vuu-ui/vuu-utils"),Cn=t=>typeof t=="string",vn="value does not match expected pattern",po=(t,e)=>{if(typeof t.value!="string")throw Error("Pattern validation rule must provide pattern");if(Cn(e)){if(e==="")return!0;{let{message:o=vn}=t;return new RegExp(t.value).test(e)||o}}else return"value must be a string"};(0,uo.registerComponent)("vuu-pattern",po,"data-edit-validator",{});var R=require("@vuu-ui/vuu-utils"),mo=ue(require("clsx"),1),go=require("react");var ve=require("@vuu-ui/vuu-utils"),at=require("react"),xn=[void 0,void 0,void 0,void 0];function co(t,e,o){var g;let n=(0,at.useRef)(),[s,r,a,l]=n.current||xn,{type:p}=o,m=(0,ve.isTypeDescriptor)(p)?(g=p.formatting)==null?void 0:g.decimals:void 0,d=t===s&&(0,ve.isValidNumber)(e)&&(0,ve.isValidNumber)(r)&&o===a?(0,ve.getMovingValueDirection)(e,l,r,m):"";return(0,at.useEffect)(()=>{n.current=[t,e,o,d]}),d}var lt=require("react/jsx-runtime"),hn="\u2B06",bn="\u2B07",{KEY:yn}=R.metadataKeys,Ue="vuuBackgroundCell",Te={ArrowOnly:"arrow",BackgroundOnly:"bg-only",ArrowBackground:"arrow-bg"},En=t=>(0,R.isTypeDescriptor)(t)&&t.renderer&&"flashStyle"in t.renderer?t.renderer.flashStyle:Te.BackgroundOnly,fo=(0,go.memo)(function({column:e,columnMap:o,row:n}){let{name:s,type:r,valueFormatter:a}=e,l=o[s],p=n[l],m=En(r),d=co(n[yn],p,e),g=m===Te.ArrowOnly||m===Te.ArrowBackground?d===R.UP1||d===R.UP2?hn:d===R.DOWN1||d===R.DOWN2?bn:null:null,u=d?" "+d:"",i=(0,mo.default)(Ue,u,{[`${Ue}-backgroundOnly`]:m===Te.BackgroundOnly,[`${Ue}-arrowOnly`]:m===Te.ArrowOnly,[`${Ue}-arrowBackground`]:m===Te.ArrowBackground});return(0,lt.jsxs)("div",{className:i,tabIndex:-1,children:[(0,lt.jsx)("div",{className:`${Ue}-arrow`,children:g}),a(n[l])]})},R.dataAndColumnUnchanged);(0,R.registerComponent)("vuu.price-move-background",fo,"cell-renderer",{description:"Change background color of cell when value changes",configEditor:"BackgroundCellConfigurationEditor",label:"Background Flash",serverDataType:["long","int","double"]});var Co=require("@vuu-ui/vuu-ui-controls"),vo=require("@vuu-ui/vuu-utils"),ut=require("@salt-ds/core"),pt=require("react");var We=require("react/jsx-runtime"),wn="vuuBackgroundCellConfiguration",Bt=[{label:"Background Only",value:"bg-only"},{label:"Background and Arrow",value:"arrow-bg"},{label:"Arrow Only",value:"arrow"}],[xo]=Bt,On=t=>{let{flashStyle:e}=t.type.renderer;return Bt.find(o=>o.value===e)||xo},ho=({column:t,onChangeRendering:e})=>{let[o,n]=(0,pt.useState)(On(t)),s=(0,pt.useCallback)((r,a)=>{var p;n(a);let l=t.type.renderer;e({...l,flashStyle:(p=a==null?void 0:a.value)!=null?p:xo.value})},[t.type,e]);return(0,We.jsxs)(ut.FormField,{children:[(0,We.jsx)(ut.FormFieldLabel,{children:"Flash Style"}),(0,We.jsx)(Co.Dropdown,{className:`${wn}-flashStyle`,onSelectionChange:s,selected:o,source:Bt,width:"100%"})]})};(0,vo.registerConfigurationEditor)("BackgroundCellConfigurationEditor",ho);var ct=require("@vuu-ui/vuu-data-react"),mt=require("@vuu-ui/vuu-ui-controls"),ke=require("@vuu-ui/vuu-utils"),ce=require("react");var yo=require("react/jsx-runtime"),Sn="vuuTableDropdownCell",Tn=["Enter"," "],bo=(0,ce.memo)(function({column:e,columnMap:o,onCommit:n=mt.WarnCommit,row:s}){let r=o[e.name],a=s[r],{values:l}=(0,ct.useLookupValues)(e,a),p=(0,ce.useRef)(null);(0,ce.useMemo)(()=>{p.current=(0,ct.getSelectedOption)(l,a)},[a,l]);let m=(0,ce.useCallback)((d,g)=>{g&&n(g.value).then(u=>{u===!0&&d&&(0,ke.dispatchCustomEvent)(d.target,"vuu-commit")})},[n]);return(0,yo.jsx)(mt.Dropdown,{className:Sn,onSelectionChange:m,openKeys:Tn,selected:p.current,source:l,width:e.width-17})},ke.dataColumnAndKeyUnchanged);(0,ke.registerComponent)("dropdown-cell",bo,"cell-renderer",{userCanAssign:!1});var Eo=require("@vuu-ui/vuu-data-react"),dt=require("@vuu-ui/vuu-utils"),wo=require("react"),So=require("react/jsx-runtime"),Oo=(0,wo.memo)(function({column:e,columnMap:o,row:n}){let s=o[e.name],r=n[s],{initialValue:a}=(0,Eo.useLookupValues)(e,r);return(0,So.jsx)("span",{children:a==null?void 0:a.label})},dt.dataAndColumnUnchanged);(0,dt.registerComponent)("lookup-cell",Oo,"cell-renderer",{userCanAssign:!1});var To=require("@vuu-ui/vuu-utils"),Lt=ue(require("clsx"),1);var Ge=require("react/jsx-runtime"),Ye="vuuPctProgressCell",kn=t=>t>=0&&t<=1?t*100:t>2?0:t>1?100:0,ko=({column:t,columnMap:e,row:o})=>{let n=o[e[t.name]],s=kn(n),r=(0,Lt.default)(Ye,{});return(0,Ge.jsxs)("div",{className:(0,Lt.default)(r,{[`${Ye}-zero`]:s===0,[`${Ye}-complete`]:s>=100}),tabIndex:-1,children:[(0,Ge.jsx)("span",{className:`${Ye}-progressBar`,style:{"--progress-bar-pct":`${s}%`}}),(0,Ge.jsx)("span",{className:`${Ye}-text`,children:`${s.toFixed(2)} %`})]})};(0,To.registerComponent)("vuu.pct-progress",ko,"cell-renderer",{description:"Percentage formatter",label:"Percentage formatter",serverDataType:"double"});var re=require("@vuu-ui/vuu-utils"),Po=ue(require("clsx"),1);var xe=require("react/jsx-runtime"),qe="vuuProgressCell",Pn=({column:t,columnMap:e,row:o})=>{let{name:n,type:s}=t,r=o[e[n]],a=!1,l=0;if((0,re.isTypeDescriptor)(s)&&(0,re.isColumnTypeRenderer)(s.renderer)){let{associatedField:m}=s.renderer;if(m){let d=o[e[m]];if((0,re.isValidNumber)(r)&&(0,re.isValidNumber)(d))l=Math.min(Math.round(r/d*100),100),l=Math.min(Math.round(r/d*100),100),a=isFinite(l);else{let g=parseFloat(r);if(Number.isFinite(g)){let u=parseFloat(d);Number.isFinite(u)&&(l=Math.min(Math.round(g/u*100),100),a=isFinite(l))}}}else throw Error("ProgressCell associatedField is required to render")}let p=(0,Po.default)(qe,{});return(0,xe.jsxs)("div",{className:p,tabIndex:-1,children:[a?(0,xe.jsxs)("span",{className:`${qe}-track`,children:[(0,xe.jsx)("span",{className:`${qe}-bg`}),(0,xe.jsx)("span",{className:`${qe}-bar`,style:{"--progress-bar-pct":`-${100-l}%`}})]}):null,(0,xe.jsx)("span",{className:`${qe}-text`,children:`${l} %`})]})};(0,re.registerComponent)("vuu.progress",Pn,"cell-renderer",{description:"Progress formatter",label:"Progress formatter",serverDataType:["long","int","double"],userCanAssign:!1});var he=require("@vuu-ui/vuu-ui-controls"),gt=require("@salt-ds/core"),Fo=ue(require("clsx"),1),Dt=require("react"),Pe=require("@vuu-ui/vuu-utils");var H=require("react/jsx-runtime"),me="vuuColumnList",Bo="vuuColumnListItem",Fn=({className:t,item:e,...o})=>(0,H.jsxs)(he.ListItem,{...o,className:(0,Fo.default)(t,Bo),"data-name":e==null?void 0:e.name,children:[(0,H.jsx)(he.Icon,{name:"draggable",size:16}),e!=null&&e.isCalculated?(0,H.jsx)(he.Icon,{name:"function"}):(0,H.jsx)(gt.Checkbox,{className:`${me}-checkBox`,checked:e==null?void 0:e.subscribed}),(0,H.jsx)("span",{className:`${me}-text`,children:(0,Pe.getColumnLabel)(e)}),(0,H.jsx)(gt.Switch,{className:`${me}-switch`,checked:(e==null?void 0:e.hidden)!==!0,disabled:(e==null?void 0:e.subscribed)!==!0})]}),Rt=({columnItems:t,onChange:e,onMoveListItem:o,onNavigateToColumn:n,...s})=>{let r=(0,Dt.useCallback)(({target:l})=>{let p=l,m=(0,Pe.queryClosest)(l,`.${Bo}`);if(m){let{dataset:{name:d}}=m;if(d){let g=(0,Pe.queryClosest)(l,`.${me}-checkBox`),u=(0,Pe.queryClosest)(l,`.${me}-switch`);g?e(d,"subscribed",p.checked):u&&e(d,"hidden",p.checked===!1)}}},[e]),a=(0,Dt.useCallback)(l=>{let p=l.target;if(p.classList.contains("vuuColumnList-text")){let m=p.closest(".vuuListItem");m!=null&&m.dataset.name&&(n==null||n(m.dataset.name))}},[]);return(0,H.jsxs)("div",{...s,className:me,children:[(0,H.jsx)("div",{className:`${me}-header`,children:(0,H.jsx)("span",{children:"Column Selection"})}),(0,H.jsxs)("div",{className:`${me}-colHeadings`,children:[(0,H.jsx)("span",{children:"Column subscription"}),(0,H.jsx)("span",{children:"Visibility"})]}),(0,H.jsx)(he.List,{ListItem:Fn,allowDragDrop:!0,height:"auto",onChange:r,onClick:a,onMoveListItem:o,selectionStrategy:"none",source:t,itemHeight:33})]})};var oe=require("@vuu-ui/vuu-ui-controls"),Ze=require("@vuu-ui/vuu-utils"),O=require("@salt-ds/core"),nn=ue(require("clsx"),1);var Wo=require("@vuu-ui/vuu-ui-controls"),Me=require("@vuu-ui/vuu-utils"),K=require("@salt-ds/core"),tt=require("react");var Ao=require("react");var P=require("@vuu-ui/vuu-codemirror"),Gt=require("@vuu-ui/vuu-utils"),G=require("react");var M=require("@vuu-ui/vuu-codemirror");var Lo=require("@lezer/lr"),ft=Lo.LRParser.deserialize({version:14,states:"&xOVQPOOO!fQPO'#C^OVQPO'#CcQ!pQPOOO#bQPO'#CkO#gQPO'#CrOOQO'#Cy'#CyO#lQPO,58}OVQPO,59QOVQPO,59QOOQO'#Cn'#CnOVQPO,59XOVQPO,59VOVQPO'#CtOOQO,59^,59^OOQO1G.i1G.iOOQO1G.l1G.lO$bQPO1G.lO%ZQPO1G.sO!pQPO'#CmO%qQQO1G.qO%|QQO'#C{OOQO'#C{'#C{O&wQPO,59`OVQPO,59ZOVQPO,59[OVQPO7+$]OVQPO'#CuO'RQPO1G.zOOQO1G.z1G.zO'ZQQO'#C^O'eQQO1G.sO'{QQO1G.uOOQO1G.v1G.vO(WQPO<<GwO(_QPO,59aOOQO-E6s-E6sOOQO7+$f7+$fOVQPOAN=cO(iQQO1G.lO(yQPOG22}OOQOLD(iLD(iO)QQPO,59QO)QQPO,59QO)QQPO,59X",stateData:")n~OlOS~ORUOSUOTUOUUOWQO`SOnPO~OWgXZQX[QX]QX^QXpQXqQXrQXsQXtQXuQXeQX~OjQXXQX~PnOZWO[WO]XO^XOpYOqYOrYOsYOtYOuYO~OW[O~OW]O~OX_O~P!pO]Yi^YipYiqYirYisYitYiuYieYi~OZWO[WOjYiXYi~P#sOpaiqairaisaitaiuaieai~OZWO[WO]XO^XOjaiXai~P$rOejOvhOwiO~OZmX[mX]mX^mXeoXpmXqmXrmXsmXtmXumXvoXwoX~OXmOekO~P!pOXuOekO~OvQXwQX~PnOZzO[zO]{O^{Ovaiwai~P$rOwiOecivci~OevO~P!pOXiaeia~P!pOZzO[zOvYiwYi~P#sOXyO~P!pORUOSUOTUOUUOWQO`SOnnO~O`UTn~",goto:"$epPPqPPPPqPPqPPPPqP!S!g!r!rPq!w#Y#]PPP#cP$[oUOQWXZ[]hijkvz{|hUOQWXZ]jkvz{|Ve[hi[ZRVgrsxR|cVf[hioTOQWXZ[]hijkvz{|R^TQlgRtlQROQVQS`WzQaXQbZUc[hiQg]Qo|QrjQskQw{RxvQd[QphRqi",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:393});var Bn=M.LRLanguage.define({name:"VuuColumnExpression",parser:ft.configure({props:[(0,M.styleTags)({Column:M.tags.attributeValue,Function:M.tags.variableName,String:M.tags.string,Or:M.tags.emphasis,Operator:M.tags.operator})]})}),Nt=()=>new M.LanguageSupport(Bn);var Ht=class{constructor(e){switch(this.value=e,typeof e){case"boolean":this.type="booleanLiteralExpression";break;case"number":this.type="numericLiteralExpression";break;default:this.type="stringLiteralExpression"}}toJSON(){return{type:this.type,value:this.value}}},Vt=class{constructor(e){this.type="colExpression";this.column=e}toJSON(){return{type:this.type,column:this.column}}},Je,ye,Qt=class{constructor(e="unknown"){U(this,Je,[{type:"unknown"},{type:"unknown"}]);U(this,ye,void 0);this.type="arithmeticExpression";pe(this,ye,e)}get op(){return f(this,ye)}set op(e){pe(this,ye,e)}get expressions(){return f(this,Je)}toJSON(){return{type:this.type,op:f(this,ye),expressions:f(this,Je)}}};Je=new WeakMap,ye=new WeakMap;var De,It=class{constructor(e){U(this,De,[]);this.type="callExpression";this.functionName=e}get expressions(){return f(this,De)}get arguments(){return f(this,De)}toJSON(){return{type:this.type,functionName:this.functionName,arguments:f(this,De).map(e=>{var o;return(o=e.toJSON)==null?void 0:o.call(e)})}}};De=new WeakMap;var Ke,Re,Be=class{constructor(){U(this,Ke,[{type:"unknown"},{type:"unknown"}]);U(this,Re,"unknown");this.type="relationalExpression"}get op(){return f(this,Re)}set op(e){pe(this,Re,e)}get expressions(){return f(this,Ke)}toJSON(){return{type:this.type,op:f(this,Re),expressions:f(this,Ke)}}};Ke=new WeakMap,Re=new WeakMap;var je,Ne,Le=class{constructor(e){U(this,je,[{type:"unknown"},{type:"unknown"}]);U(this,Ne,void 0);this.type="booleanCondition";pe(this,Ne,e)}get op(){return f(this,Ne)}get expressions(){return f(this,je)}toJSON(){return{type:this.type,op:f(this,Ne),expressions:f(this,je).map(e=>{var o;return(o=e.toJSON)==null?void 0:o.call(e)})}}};je=new WeakMap,Ne=new WeakMap;var Y,_e=class{constructor(e){U(this,Y,void 0);this.type="conditionalExpression";pe(this,Y,[e?new Le(e):new Be,{type:"unknown"},{type:"unknown"}])}get expressions(){return f(this,Y)}get condition(){return f(this,Y)[0]}get truthyExpression(){return f(this,Y)[1]}set truthyExpression(e){f(this,Y)[1]=e}get falsyExpression(){return f(this,Y)[2]}set falsyExpression(e){f(this,Y)[2]=e}toJSON(){var e,o,n,s,r;return{type:this.type,condition:(o=(e=this.condition).toJSON)==null?void 0:o.call(e),truthyExpression:this.truthyExpression,falsyExpression:(r=(s=(n=this.falsyExpression)==null?void 0:n.toJSON)==null?void 0:s.call(n))!=null?r:this.falsyExpression}}};Y=new WeakMap;var be=t=>t.type==="unknown",Ct=t=>t.type==="arithmeticExpression",Ln=t=>t.type==="callExpression",Fe=t=>t.type==="conditionalExpression",Dn=t=>t.type==="relationalExpression"||t.type==="booleanCondition";var Rn=t=>t.type==="booleanCondition",At=t=>(t==null?void 0:t.type)==="relationalExpression";var A=t=>{if(be(t))return t;if(At(t)){let[e,o]=t.expressions;if(N(e))return A(e);if(t.op==="unknown")return t;if(N(o))return A(o)}else if(Dn(t)){let{expressions:e=[]}=t;for(let o of e)if(N(o))return A(o)}else if(Fe(t)){let{condition:e,truthyExpression:o,falsyExpression:n}=t;if(N(e))return A(e);if(N(o))return A(o);if(N(n))return A(n)}else if(Ct(t)){let{expressions:e=[]}=t;for(let o of e)if(N(o))return A(o)}},vt=(t,e,o)=>{let{expressions:n=[]}=t;if(n.includes(e)){let s=n.indexOf(e);return n.splice(s,1,o),!0}else for(let s of n)if(vt(s,e,o))return!0;return!1},N=t=>be(t)?!0:Fe(t)?N(t.condition)||N(t.truthyExpression)||N(t.falsyExpression):At(t)||Rn(t)?t.op===void 0||t.expressions.some(e=>N(e)):!1,Do=(t,e)=>{let o=A(t);o?o.expressions?o.expressions.push(e):console.warn("don't know how to treat targetExpression"):console.error("no target expression found")},y,Ee,Mt=class{constructor(){U(this,y,void 0);U(this,Ee,[])}setCondition(e){if(f(this,y)===void 0)this.addExpression(new _e(e));else if(Fe(f(this,y))){if(N(f(this,y).condition)){let o=e?new Le(e):new Be;this.addExpression(o)}else if(be(f(this,y).truthyExpression))f(this,y).truthyExpression=new _e(e);else if(N(f(this,y).truthyExpression)){let o=e?new Le(e):new Be;this.addExpression(o)}else if(be(f(this,y).falsyExpression))f(this,y).falsyExpression=new _e(e);else if(N(f(this,y).falsyExpression)){let o=e?new Le(e):new Be;this.addExpression(o)}}else console.error("setCondition called unexpectedly")}addExpression(e){if(f(this,Ee).length>0){let o=f(this,Ee).at(-1);o==null||o.arguments.push(e)}else if(f(this,y)===void 0)pe(this,y,e);else if(Ct(f(this,y))){let o=A(f(this,y));o&&be(o)&&vt(f(this,y),o,e)}else if(Fe(f(this,y))&&N(f(this,y))){let o=A(f(this,y));o&&be(o)?vt(f(this,y),o,e):o&&Do(o,e)}}setFunction(e){let o=new It(e);this.addExpression(o),f(this,Ee).push(o)}setColumn(e){this.addExpression(new Vt(e))}setArithmeticOp(e){let o=e,n=f(this,y);Ct(n)&&(n.op=o)}setRelationalOperator(e){let o=e;if(f(this,y)&&Fe(f(this,y))){let n=A(f(this,y));At(n)?n.op=o:console.error(`no target expression found (op = ${e})`)}}setValue(e){let o=new Ht(e);if(f(this,y)===void 0)pe(this,y,o);else if(Ct(f(this,y)))this.addExpression(o);else if(Ln(f(this,y)))f(this,y).arguments.push(o);else if(Fe(f(this,y)))if(N(f(this,y))){let n=A(f(this,y));n&&be(n)?vt(f(this,y),n,o):n&&Do(n,o)}else console.log("what do we do with value, in a complete expression")}closeBrace(){f(this,Ee).pop()}get expression(){return f(this,y)}toJSON(){var e;return(e=f(this,y))==null?void 0:e.toJSON()}};y=new WeakMap,Ee=new WeakMap;var $t=(t,e)=>{let o=new Mt,n=t.cursor();do{let{name:s,from:r,to:a}=n;switch(s){case"AndCondition":o.setCondition("and");break;case"OrCondition":o.setCondition("or");break;case"RelationalExpression":o.setCondition();break;case"ArithmeticExpression":o.addExpression(new Qt);break;case"Column":{let l=e.substring(r,a);o.setColumn(l)}break;case"Function":{let l=e.substring(r,a);o.setFunction(l)}break;case"Times":case"Divide":case"Plus":case"Minus":{let l=e.substring(r,a);o.setArithmeticOp(l)}break;case"RelationalOperator":{let l=e.substring(r,a);o.setRelationalOperator(l)}break;case"False":case"True":{let l=e.substring(r,a);o.setValue(l==="true")}break;case"String":o.setValue(e.substring(r+1,a-1));break;case"Number":o.setValue(parseFloat(e.substring(r,a)));break;case"CloseBrace":o.closeBrace();break;default:}}while(n.next());return o.toJSON()};var Nn=ft.configure({strict:!0}),Ro=["Number","String"],xt=[...Ro,"AndCondition","ArithmeticExpression","BooleanOperator","RelationalOperatorOperator","CallExpression","CloseBrace","Column","Comma","ConditionalExpression","Divide","Equal","If","Minus","OpenBrace","OrCondition","ParenthesizedExpression","Plus","RelationalExpression","RelationalOperator","Times"],zt=t=>{try{return Nn.parse(t),!0}catch{return!1}},ht=t=>{let{lastChild:e}=t;for(;e&&!xt.includes(e.name);)e=e.prevSibling,console.log(e==null?void 0:e.name);return e},Zt=t=>{if((t==null?void 0:t.name)==="RelationalExpression"){let{firstChild:e}=t,o=ht(t);if((e==null?void 0:e.name)==="Column"&&typeof(o==null?void 0:o.name)=="string"&&Ro.includes(o.name))return!0}return!1};var de=require("@vuu-ui/vuu-codemirror"),Hn=de.HighlightStyle.define([{tag:de.tags.attributeValue,color:"var(--vuuFilterEditor-variableColor);font-weight: bold"},{tag:de.tags.variableName,color:"var(--vuuFilterEditor-variableColor)"},{tag:de.tags.comment,color:"green",fontStyle:"italic"}]),No=(0,de.syntaxHighlighting)(Hn);var Ho=require("@vuu-ui/vuu-codemirror"),Vo=Ho.EditorView.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-completionLabel":{color:"var(--vuu-color-gray-50)"},".cm-completionMatchedText":{color:"var(--vuu-color-gray-80)",fontWeight:700,textDecoration:"none"},".cm-tooltip":{background:"var(--vuuFilterEditor-tooltipBackground)",border:"var(--vuuFilterEditor-tooltipBorder)",borderRadius:"4px",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});var F=require("@vuu-ui/vuu-codemirror"),Wt=require("react");var Vn=(t,e)=>e?t.map(o=>{var n;return{...o,apply:typeof o.apply=="function"?o.apply:`${e}${(n=o.apply)!=null?n:o.label}`}}):t,Qn=t=>t===void 0?!1:["Times","Divide","Plus","Minus"].includes(t.name),et=t=>({apply:()=>{t==null||t()},label:"Done",boost:10}),He=(t,e)=>{var s;let{lastChild:o}=t,{pos:n}=e;for(;o;)if(o.from<n&&xt.includes(o.name)){if(o.name==="ParenthesizedExpression"){let a=(s=o.firstChild)==null?void 0:s.nextSibling;a&&(o=a)}return o}else o=o.prevSibling},Qo=(t,e)=>{var o;if(t.name==="ArgList"){let n=t.prevSibling;if(n)return(0,F.getValue)(n,e)}else if(t.name==="OpenBrace"){let n=(o=t.parent)==null?void 0:o.prevSibling;if((n==null?void 0:n.name)==="Function")return(0,F.getValue)(n,e)}},Io=(t,e)=>{if(t.name==="RelationalExpression"){let o=ht(t);if((o==null?void 0:o.name)==="RelationalOperator")return(0,F.getValue)(o,e)}else{let o=t.prevSibling;if((o==null?void 0:o.name)==="RelationalOperator")return(0,F.getValue)(o,e)}},Yt=(t,e)=>{var o;if(t.name==="RelationalExpression"){if(((o=t.firstChild)==null?void 0:o.name)==="Column")return(0,F.getValue)(t.firstChild,e)}else{let n=t.prevSibling;if((n==null?void 0:n.name)==="Column")return(0,F.getValue)(n,e);if((n==null?void 0:n.name)==="RelationalOperator")return Yt(n,e)}},Xt=async(t,e,o,n={})=>{let s=await e.getSuggestions(o,n),{startsWith:r=""}=n;return{from:t.pos-r.length,options:s}},Ut=(t,e,o,n,s)=>{let r=He(t,e);switch(r==null?void 0:r.name){case"If":return Xt(e,o,"expression",{prefix:"( "});case"OpenBrace":return Xt(e,o,"expression");case"Condition":return Xt(e,o,"expression",{prefix:", "});case"CloseBrace":if(n){let a=[et(s)];return{from:e.pos,options:a}}}},In=(t,e)=>{let o=[et(e)];return{from:t.pos,options:o}},Mo=(t,e)=>{let o=(0,Wt.useCallback)(async(n,s,r={})=>{let a=await t.getSuggestions(s,r),{startsWith:l=""}=r;return{from:n.pos-l.length,options:a}},[t]);return(0,Wt.useCallback)(async n=>{var g,u;let{state:s,pos:r}=n,a=(g=n.matchBefore(/\w*/))!=null?g:{from:0,to:0,text:void 0},p=(0,F.syntaxTree)(s).resolveInner(r,-1),m=s.doc.toString(),d=zt(m);switch(p.name){case"If":return o(n,"expression",{prefix:"( "});case"Condition":{let i=He(p,n);if((i==null?void 0:i.name)==="Column"){let c=(0,F.getPreviousNode)(i);if((c==null?void 0:c.name)!=="RelationalOperator")return o(n,"condition-operator",{columnName:(0,F.getValue)(i,s)})}else if((i==null?void 0:i.name)==="RelationalOperator")return o(n,"expression")}break;case"ConditionalExpression":return Ut(p,n,t);case"RelationalExpression":{if(Zt(p))return{from:n.pos,options:F.booleanJoinSuggestions.concat({label:", <truthy expression>, <falsy expression>",apply:", "})};{let i=Io(p,s),c=Yt(p,s);if(i)return o(n,"expression");{let C=await t.getSuggestions("condition-operator",{columnName:c});return{from:n.pos,options:C}}}}break;case"RelationalOperator":return o(n,"expression");case"String":{let i=Io(p,s),c=Yt(p,s),{from:C,to:v}=p;if(v-C===2&&n.pos===C+1){if(c&&i)return o(n,"columnValue",{columnName:c,operator:i,startsWith:a.text})}else if(v-C>2&&n.pos===v)return o(n,"expression",{prefix:", "})}break;case"ArithmeticExpression":{let i=He(p,n);if((i==null?void 0:i.name)==="Column")return o(n,"expression");if(Qn(i)){let c=i.name;return o(n,"column",{operator:c})}}break;case"OpenBrace":{let i=Qo(p,s);return o(n,"expression",{functionName:i})}break;case"ArgList":{let i=Qo(p,s),c=He(p,n),C=(c==null?void 0:c.name)==="OpenBrace"||(c==null?void 0:c.name)==="Comma"?void 0:",",v=await t.getSuggestions("expression",{functionName:i});return v=C?Vn(v,", "):v,(c==null?void 0:c.name)!=="OpenBrace"&&(c==null?void 0:c.name)!=="Comma"&&(v=[{apply:") ",boost:10,label:"Done - no more arguments"}].concat(v)),{from:n.pos,options:v}}case"Equal":if(m.trim()==="=")return o(n,"expression");break;case"ParenthesizedExpression":case"ColumnDefinitionExpression":if(n.pos===0)return o(n,"expression");{let i=He(p,n);if((i==null?void 0:i.name)==="Column"){if(d){let c=[et(e.current)],C=(0,F.getValue)(i,s),v=await t.getSuggestions("operator",{columnName:C});return{from:n.pos,options:c.concat(v)}}}else if((i==null?void 0:i.name)==="CallExpression"){if(d)return{from:n.pos,options:[et(e.current)]}}else if((i==null?void 0:i.name)==="ArithmeticExpression"){if(d){let c=[et(e.current)],C=He(i,n);if((C==null?void 0:C.name)==="Column"){let v=(0,F.getValue)(C,s),x=await t.getSuggestions("operator",{columnName:v});c=c.concat(x)}return{from:n.pos,options:c}}}else if((i==null?void 0:i.name)==="ConditionalExpression")return Ut(i,n,t,d,e.current);break}case"Column":if(await t.isPartialMatch("expression",void 0,a.text))return o(n,"expression",{startsWith:a.text});break;case"Comma":{let i=(0,F.getNamedParentNode)(p);if((i==null?void 0:i.name)==="ConditionalExpression")return o(n,"expression")}break;case"CloseBrace":{let i=(0,F.getNamedParentNode)(p);if((i==null?void 0:i.name)==="ConditionalExpression")return Ut(i,n,t,d,e.current);if((i==null?void 0:i.name)==="ArgList"&&d)return In(n,e.current)}break;default:((u=p==null?void 0:p.prevSibling)==null?void 0:u.name)==="FilterClause"&&console.log("looks like we ight be a or|and operator")}},[o,e,t])};var bt=t=>{if(t.current==null)throw Error("EditorView not defined");return t.current},Mn=()=>"vuuSuggestion",An=()=>console.log("noooop"),$n=t=>"expressionType"in t,zn=t=>{if($n(t)){let e=(0,Gt.createEl)("div","expression-type-container"),o=(0,Gt.createEl)("span","expression-type",t.expressionType);return e.appendChild(o),e}else return null},qt=({onChange:t,onSubmitExpression:e,source:o,suggestionProvider:n})=>{let s=(0,G.useRef)(null),r=(0,G.useRef)(An),a=(0,G.useRef)(),l=Mo(n,r),[p,m,d]=(0,G.useMemo)(()=>{let u=()=>{let x=bt(a),h=x.state.doc.toString(),w=(0,P.ensureSyntaxTree)(x.state,x.state.doc.length,5e3);if(w){let D=$t(w,h);return[h,D]}else return["",void 0]},i=()=>{bt(a).setState(v())},c=()=>{let[x,h]=u();e==null||e(x,h)},C=x=>P.keymap.of([{key:x,run(){return(0,P.startCompletion)(bt(a)),!0}}]),v=()=>P.EditorState.create({doc:o,extensions:[P.minimalSetup,(0,P.autocompletion)({addToOptions:[{render:zn,position:70}],override:[l],optionClass:Mn}),Nt(),P.keymap.of(P.defaultKeymap),C("ArrowDown"),P.EditorView.updateListener.of(x=>{let h=bt(a);if(x.docChanged){(0,P.startCompletion)(h);let w=h.state.doc.toString();t==null||t(w)}}),P.EditorState.transactionFilter.of(x=>x.newDoc.lines>1?[]:x),Vo,No]});return r.current=()=>{c()},[v,i,c]},[l,t,e,o]);(0,G.useEffect)(()=>{if(!s.current)throw Error("editor not in dom");return a.current=new P.EditorView({state:p(),parent:s.current}),()=>{var u;(u=a.current)==null||u.destroy()}},[l,p]);let g=(0,G.useCallback)(()=>{d()},[d]);return{editorRef:s,clearInput:m,onBlur:g}};var $o=require("react/jsx-runtime"),Zn="vuuColumnExpressionInput",yt=(0,Ao.memo)(({onChange:t,onSubmitExpression:e,source:o="",suggestionProvider:n})=>{let{editorRef:s,onBlur:r}=qt({onChange:t,onSubmitExpression:e,source:o,suggestionProvider:n});return(0,$o.jsx)("div",{className:`${Zn}`,onBlur:r,ref:s})},(t,e)=>t.source===e.source);yt.displayName="ColumnExpressionInput";var _=require("@vuu-ui/vuu-codemirror"),Et=require("@vuu-ui/vuu-data-react"),Ie=require("@vuu-ui/vuu-utils"),Qe=require("react");var Ve=[{accepts:["boolean"],description:"Applies boolean and operator across supplied parameters to returns a single boolean result",example:{expression:'and(ccy="EUR",quantity=0)',result:"true | false"},name:"and",params:{description:"( boolean, [ boolean* ] )"},type:"boolean"},{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:["boolean"],description:"Applies boolean or operator across supplied parameters to returns a single boolean result",example:{expression:'or(status="cancelled",quantity=0)',result:"true | false"},name:"or",params:{description:"( boolean, [ boolean* ] )"},type:"boolean"},{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"}];var q=require("@vuu-ui/vuu-utils"),zo=({name:t,description:e,example:o,params:n,type:s})=>{let r=(0,q.createEl)("div","vuuFunctionDoc"),a=(0,q.createEl)("div","function-heading"),l=(0,q.createEl)("span","function-name",t),p=(0,q.createEl)("span","param-list",n.description),m=(0,q.createEl)("span","function-type",s);a.appendChild(l),a.appendChild(p),a.appendChild(m);let d=(0,q.createEl)("p",void 0,e);if(r.appendChild(a),r.appendChild(d),o){let g=(0,q.createEl)("div","example-container"),u=(0,q.createEl)("div","example-expression",o.expression),i=(0,q.createEl)("div","example-result",o.result);g.appendChild(u),r.appendChild(g),r.appendChild(i)}return r};var Xn=[],we=t=>t.map(e=>{var o;return{...e,apply:((o=e.apply)!=null?o:e.label)+" "}}),Un=(t,{functionName:e,operator:o})=>{if(o)return t.filter(Ie.isNumericColumn);if(e){let n=Ve.find(s=>s.name===e);if(n)switch(n.accepts){case"string":return t.filter(Ie.isTextColumn);case"number":return t.filter(Ie.isNumericColumn);default:return t}}return t},Zo=(t,e)=>Un(t,e).map(n=>{var r;let s=(r=n.label)!=null?r:n.name;return{apply:e.prefix?`${e.prefix}${n.name}`:n.name,label:s,boost:5,type:"column",expressionType:n.serverDataType}}),Wn=[{apply:"* ",boost:2,label:"*",type:"operator"},{apply:"/ ",boost:2,label:"/",type:"operator"},{apply:"+ ",boost:2,label:"+",type:"operator"},{apply:"- ",boost:2,label:"-",type:"operator"}],Yn=t=>t===void 0||(0,Ie.isNumericColumn)(t)?Wn:Xn,Gn=t=>{switch(t.serverDataType){case"string":case"char":return we(_.stringOperators);case"int":case"long":case"double":return we(_.numericOperators)}},_t=t=>({apply:`${t.name}( `,boost:2,expressionType:t.type,info:()=>zo(t),label:t.name,type:"function"}),qn=t=>{if(t){if(typeof t.accepts=="string")return t.accepts;if(Array.isArray(t.accepts))return t.accepts.every(e=>e==="string")?"string":"any"}return"any"},_n=Ve.map(_t),Jn=({functionName:t})=>{if(t){let e=Ve.find(n=>n.name===t),o=qn(e);if(e)switch(o){case"string":return Ve.filter(n=>n.type==="string"||n.type==="variable").map(_t);case"number":return Ve.filter(n=>n.type==="number"||n.type==="variable").map(_t);default:}}return _n},Kn={},Jt=({columns:t,table:e})=>{let o=(0,Qe.useCallback)(l=>l?t.find(p=>p.name===l):void 0,[t]),n=(0,Qe.useRef)(),s=(0,Et.useTypeaheadSuggestions)(),r=(0,Qe.useCallback)(async(l,p=Kn)=>{let{columnName:m,functionName:d,operator:g,prefix:u}=p;switch(l){case"expression":{let i=await we(Zo(t,{functionName:d,prefix:u})).concat(Jn(p));return n.current=i}case"column":{let i=await Zo(t,p);return n.current=we(i)}case"operator":{let i=await Yn(o(m));return n.current=we(i)}case"relational-operator":{let i=await(0,_.getRelationalOperators)(o(m));return n.current=we(i)}case"condition-operator":{let i=o(m);if(i){let c=await Gn(i);if(c)return n.current=we(c)}}break;case"columnValue":if(m&&g){let i=(0,Et.getTypeaheadParams)(e,m),c=await s(i);return n.current=(0,_.toSuggestions)(c,{suffix:""}),n.current.forEach(C=>{C.apply=(v,x,h)=>{let w=new _.AnnotationType,D=h+x.label.length+1;v.dispatch({changes:{from:h,insert:x.label},selection:{anchor:D,head:D},annotations:w.of(x)})}}),n.current}break}return[]},[t,o,s,e]),a=(0,Qe.useCallback)(async(l,p,m)=>{let{current:d}=n,g=!1,u=d||await r(l,{columnName:p});if(m&&u)for(let i of u){if(i.label===m)return!1;i.label.startsWith(m)&&(g=!0)}return g},[r]);return{getSuggestions:r,isPartialMatch:a}};var J=require("@vuu-ui/vuu-utils"),se=require("react"),jn=t=>{let[e,o,n]=(0,J.getCalculatedColumnDetails)(t);return n===""?{...t,name:`${e}:string:${o}`}:t},Xo=({column:t,onChangeName:e,onChangeServerDataType:o})=>{let[n,s]=(0,se.useState)(jn(t)),r=(0,se.useRef)(t),a=(0,se.useCallback)(d=>{r.current=d,s(d)},[]),l=(0,se.useCallback)(d=>{let{value:g}=d.target,u=(0,J.setCalculatedColumnName)(n,g);a(u),e==null||e(u.name)},[n,e,a]),p=(0,se.useCallback)(d=>{let g=d.trim(),{current:u}=r,i=(0,J.setCalculatedColumnExpression)(u,g);a(i),e==null||e(i.name)},[e,a]),m=(0,se.useCallback)((d,g)=>{if((0,J.isVuuColumnDataType)(g)){let u=(0,J.setCalculatedColumnType)(n,g);a(u),e==null||e(u.name),o==null||o(g)}},[n,e,o,a]);return{column:n,onChangeExpression:p,onChangeName:l,onChangeServerDataType:m}};var V=require("react/jsx-runtime"),Uo="vuuColumnExpressionPanel",Kt=({column:t,onChangeName:e,onChangeServerDataType:o,tableConfig:n,vuuTable:s})=>{let r=(0,tt.useRef)(null),{column:a,onChangeExpression:l,onChangeName:p,onChangeServerDataType:m}=Xo({column:t,onChangeName:e,onChangeServerDataType:o}),d=(0,tt.useRef)((0,Me.getCalculatedColumnExpression)(a)),g=Jt({columns:n.columns,table:s}),u=(0,tt.useCallback)(()=>{var i,c;r.current&&((c=(i=r.current)==null?void 0:i.querySelector("button"))==null||c.focus())},[]);return(0,V.jsxs)("div",{className:Uo,children:[(0,V.jsx)("div",{className:"vuuColumnSettingsPanel-header",children:(0,V.jsx)("span",{children:"Calculation"})}),(0,V.jsxs)(K.FormField,{"data-field":"column-name",children:[(0,V.jsx)(K.FormFieldLabel,{children:"Column Name"}),(0,V.jsx)(K.Input,{className:"vuuInput",onChange:p,value:(0,Me.getCalculatedColumnName)(a)})]}),(0,V.jsxs)(K.FormField,{"data-field":"column-expression",children:[(0,V.jsx)(K.FormFieldLabel,{children:"Expression"}),(0,V.jsx)(yt,{onChange:l,onSubmitExpression:u,source:d.current,suggestionProvider:g})]}),(0,V.jsxs)(K.FormField,{"data-field":"type",children:[(0,V.jsx)(K.FormFieldLabel,{children:"Column type"}),(0,V.jsx)(Wo.Dropdown,{className:`${Uo}-type`,onSelectionChange:m,ref:r,selected:(0,Me.getCalculatedColumnType)(a)||null,source:["double","long","string","boolean"],width:"100%"})]})]})};var Jo=require("@vuu-ui/vuu-ui-controls"),ee=require("@vuu-ui/vuu-utils"),Ot=require("@salt-ds/core"),to=ue(require("clsx"),1),Ae=require("react");var Q=require("@salt-ds/core"),Yo=require("@vuu-ui/vuu-utils"),Oe=require("react"),$=require("react/jsx-runtime"),er="vuuFormattingSettings",ot=({column:t,onChangeFormatting:e})=>{var p,m,d;let[o,n]=(0,Oe.useState)((0,Yo.getTypeFormattingFromColumn)(t)),s=(0,Oe.useCallback)(g=>{(g.key==="Enter"||g.key==="Tab")&&e(o)},[o,e]),r=(0,Oe.useCallback)(g=>{let{value:u}=g.target,i=u===""||isNaN(parseInt(u))?void 0:parseInt(u),c={...o,decimals:i};n(c)},[o]),a=(0,Oe.useCallback)(g=>{let{checked:u}=g.target,i={...o,alignOnDecimals:u};n(i),e(i)},[o,e]),l=(0,Oe.useCallback)(g=>{let{checked:u}=g.target,i={...o,zeroPad:u};n(i),e(i)},[o,e]);return(0,$.jsxs)("div",{className:er,children:[(0,$.jsxs)(Q.FormField,{"data-field":"decimals",children:[(0,$.jsx)(Q.FormFieldLabel,{children:"Number of decimals"}),(0,$.jsx)(Q.Input,{className:"vuuInput",onChange:r,onKeyDown:s,value:(p=o.decimals)!=null?p:""})]}),(0,$.jsxs)(Q.FormField,{labelPlacement:"left",children:[(0,$.jsx)(Q.FormFieldLabel,{children:"Align on decimals"}),(0,$.jsx)(Q.Switch,{checked:(m=o.alignOnDecimals)!=null?m:!1,onChange:a,value:"align-decimals"})]}),(0,$.jsxs)(Q.FormField,{labelPlacement:"left",children:[(0,$.jsx)(Q.FormFieldLabel,{children:"Zero pad decimals"}),(0,$.jsx)(Q.Switch,{checked:(d=o.zeroPad)!=null?d:!1,onChange:l,value:"zero-pad"})]})]})};var qo=require("react"),fe=require("@salt-ds/core"),wt=require("@vuu-ui/vuu-utils");var ge=require("react"),Go=require("@vuu-ui/vuu-ui-controls"),ie=require("@vuu-ui/vuu-utils"),j=require("@salt-ds/core"),z=require("react/jsx-runtime"),jt=({column:t,onChangeFormatting:e})=>{var d,g;let o=(0,ie.getTypeFormattingFromColumn)(t),{pattern:n=ie.fallbackDateTimePattern}=o,s=(0,ge.useMemo)(()=>nr(n),[n]),[r,a]=(0,ge.useState)({time:(d=n.time)!=null?d:ie.defaultPatternsByType.time,date:(g=n.date)!=null?g:ie.defaultPatternsByType.date}),l=(0,ge.useCallback)(u=>e({...o,pattern:u}),[e,o]),p=(0,ge.useCallback)(u=>(i,c)=>{let C={...n!=null?n:{},[u]:c};a(v=>{var x,h;return{time:(x=C.time)!=null?x:v.time,date:(h=C.date)!=null?h:v.date}}),l(C)},[l,n]),m=(0,ge.useCallback)(u=>{var c,C,v,x;let i=u.currentTarget.value;switch(i){case"time":return l({[i]:(c=n[i])!=null?c:r[i]});case"date":return l({[i]:(C=n[i])!=null?C:r[i]});case"both":return l({time:(v=n.time)!=null?v:r.time,date:(x=n.date)!=null?x:r.date})}},[l,n,r]);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(j.FormField,{labelPlacement:"top",children:[(0,z.jsx)(j.FormFieldLabel,{children:"Display"}),(0,z.jsx)(j.ToggleButtonGroup,{className:"vuuToggleButtonGroup",onChange:m,value:s,"data-variant":"primary",children:or.map(u=>(0,z.jsx)(j.ToggleButton,{value:u,children:u.toUpperCase()},u))})]}),["date","time"].filter(u=>!!n[u]).map(u=>(0,z.jsxs)(j.FormField,{labelPlacement:"top",children:[(0,z.jsx)(j.FormFieldLabel,{children:`${tr[u]} pattern`}),(0,z.jsx)(Go.Dropdown,{onSelectionChange:p(u),selected:n[u],source:ie.supportedDateTimePatterns[u],width:"100%"})]},u))]})},tr={date:"Date",time:"Time"},or=["date","time","both"];function nr(t){return t.time?t.date?"both":"time":"date"}var ae=require("react/jsx-runtime"),rr="vuuLongColumnFormattingSettings",_o=t=>{let{column:e,onChangeColumnType:o}=t,n=(0,wt.isTypeDescriptor)(e.type)?e.type.name:e.type,s=(0,qo.useCallback)(r=>{let a=r.currentTarget.value;o(a)},[o]);return(0,ae.jsxs)("div",{className:rr,children:[(0,ae.jsxs)(fe.FormField,{children:[(0,ae.jsx)(fe.FormFieldLabel,{children:"Type inferred as"}),(0,ae.jsx)(fe.ToggleButtonGroup,{className:"vuuToggleButtonGroup",onChange:s,value:n!=null?n:"number",children:sr.map(r=>(0,ae.jsx)(fe.ToggleButton,{value:r,children:r.toUpperCase()},r))})]}),(0,wt.isDateTimeColumn)(e)?(0,ae.jsx)(jt,{...t,column:e}):(0,ae.jsx)(ot,{...t})]})},sr=["number","date/time"];var W=require("react/jsx-runtime"),eo="vuuColumnFormattingPanel",ir=t=>{var e;return(e=t.label)!=null?e:t.name},oo=({availableRenderers:t,className:e,column:o,onChangeFormatting:n,onChangeColumnType:s,onChangeRendering:r,...a})=>{let l=(0,Ae.useMemo)(()=>ar({column:o,onChangeFormatting:n,onChangeColumnType:s}),[o,s,n]);console.log({formattingSettingsComponent:l});let p=(0,Ae.useMemo)(()=>{let{type:u}=o;if((0,ee.isTypeDescriptor)(u)&&(0,ee.isColumnTypeRenderer)(u.renderer)){let i=(0,ee.getCellRendererOptions)(u.renderer.name);return(0,ee.getConfigurationEditor)(i==null?void 0:i.configEditor)}},[o]),m=(0,Ae.useMemo)(()=>{let{type:u}=o,[i]=t,c=(0,ee.isTypeDescriptor)(u)&&(0,ee.isColumnTypeRenderer)(u.renderer)?u.renderer.name:void 0,C=t.find(v=>v.name===c);return C!=null?C:i},[t,o]),d=(0,Ae.useCallback)((u,i)=>{let c={name:i.name};r==null||r(c)},[r]),{serverDataType:g="string"}=o;return(0,W.jsxs)("div",{...a,className:"vuuColumnSettingsPanel-header",children:[(0,W.jsx)("div",{children:"Formatting"}),(0,W.jsxs)(Ot.FormField,{children:[(0,W.jsx)(Ot.FormFieldLabel,{children:`Renderer (data type ${o.serverDataType})`}),(0,W.jsx)(Jo.Dropdown,{className:(0,to.default)(`${eo}-renderer`),itemToString:ir,onSelectionChange:d,selected:m,source:t,width:"100%"})]}),(0,W.jsxs)("div",{className:(0,to.default)(eo,e,`${eo}-${g}`),children:[l,p?(0,W.jsx)(p,{column:o,onChangeRendering:r}):null]})]})};function ar(t){let{column:e}=t;switch(e.serverDataType){case"double":case"int":return(0,W.jsx)(ot,{...t});case"long":return(0,W.jsx)(_o,{...t});default:return null}}var Ko=ue(require("clsx"),1),St=require("@vuu-ui/vuu-utils");var te=require("react/jsx-runtime"),$e="vuuColumnNameLabel",jo=({column:t,onClick:e})=>{if((0,St.isCalculatedColumn)(t.name)){let[o,n,s]=(0,St.getCalculatedColumnDetails)(t),r=o||"name",a="=expression",l=r==="name"?`${$e}-placeholder`:void 0,p=s===""?`${$e}-placeholder`:void 0;return(0,te.jsxs)("div",{className:(0,Ko.default)($e,`${$e}-calculated`),onClick:e,children:[(0,te.jsx)("span",{className:l,children:r}),(0,te.jsx)("span",{children:":"}),(0,te.jsx)("span",{children:n||"string"}),(0,te.jsx)("span",{children:":"}),(0,te.jsx)("span",{className:p,children:a}),(0,te.jsx)("span",{className:`${$e}-edit`,"data-icon":"edit"})]})}else return(0,te.jsx)("div",{className:$e,children:t.name})};var B=require("@vuu-ui/vuu-utils"),T=require("react"),lr=[{description:"Default formatter for columns with data type integer",label:"Default Renderer (int, long)",name:"default-int"}],ur=[{description:"Default formatter for columns with data type double",label:"Default Renderer (double)",name:"default-double"}],en=[{description:"Default formatter for columns with data type string",label:"Default Renderer (string)",name:"default-string"}],pr=[],cr=t=>{switch(t.serverDataType){case"char":case"string":return en.concat((0,B.getRegisteredCellRenderers)("string"));case"int":case"long":return lr.concat((0,B.getRegisteredCellRenderers)("int"));case"double":return ur.concat((0,B.getRegisteredCellRenderers)("double"));case"boolean":return pr.concat((0,B.getRegisteredCellRenderers)("boolean"));default:return en}},tn=t=>{let e=t.closest(".saltFormField");if(e&&e.dataset.field){let{dataset:{field:o}}=e;return o}else throw Error("named form field not found")},mr=(t,e)=>{if(e.name==="::")return e;{let o=t.find(n=>n.name===e.name);if(o)return o;throw Error(`columns does not contain column ${name}`)}},ze=(t,e)=>({...t,columns:t.columns.map(o=>o.name===e.name?e:o)}),on=({column:t,onCancelCreateColumn:e,onConfigChange:o,onCreateCalculatedColumn:n,tableConfig:s})=>{let[r,a]=(0,T.useState)(mr(s.columns,t)),l=(0,T.useRef)(r),[p,m]=(0,T.useState)(r.name==="::"),d=(0,T.useCallback)(()=>{l.current=r,m(!0)},[r]);(0,T.useEffect)(()=>{a(t),m(t.name==="::")},[t]);let g=(0,T.useMemo)(()=>cr(r),[r]),u=(0,T.useCallback)(()=>{o(ze(s,r))},[r,o,s]),i=(0,T.useCallback)(k=>{let S=(0,B.queryClosest)(k.target,"button");if(S){let Xe=tn(S),{value:Z}=S;switch(Xe){case"column-alignment":if((0,B.isValidColumnAlignment)(Z)){let X={...r,align:Z||void 0};a(X),o(ze(s,X))}break;case"column-pin":if((0,B.isValidPinLocation)(Z)){let X={...r,pin:Z||void 0};a(X),o(ze(s,X));break}}}},[r,o,s]),c=(0,T.useCallback)(k=>{let S=k.target,Xe=tn(S),{value:Z}=S;switch(Xe){case"column-label":a(X=>({...X,label:Z}));break;case"column-name":a(X=>(0,B.setCalculatedColumnName)(X,Z));break;case"column-width":a(X=>({...X,width:parseInt(Z)}));break}},[]),C=(0,T.useCallback)(k=>{a(S=>({...S,name:k}))},[]),v=(0,T.useCallback)(k=>{let S=(0,B.updateColumnFormatting)(r,k);a(S),o(ze(s,S))},[r,o,s]),x=(0,T.useCallback)(k=>{let S=(0,B.updateColumnType)(r,k);a(S),o(ze(s,S))},[r,o,s]),h=(0,T.useCallback)(k=>{a(S=>({...S,serverDataType:k}))},[]),w=(0,T.useCallback)(k=>{if(k){let S=(0,B.updateColumnRenderProps)(r,k);a(S),o(ze(s,S))}},[r,o,s]),D=(0,T.useCallback)(({moveBy:k})=>{let{columns:S}=s,Xe=S.indexOf(r)+k,Z=S[Xe];Z&&a(Z)},[r,s]),st=(0,T.useCallback)(()=>{D({moveBy:1})},[D]),kt=(0,T.useCallback)(()=>{D({moveBy:-1})},[D]),Pt=(0,T.useCallback)(()=>{n(r)},[r,n]),Ft=(0,T.useCallback)(()=>{t.name==="::"?e():(l.current!==void 0&&l.current!==r&&a(l.current),m(!1))},[r,t.name,e]);return{availableRenderers:g,editCalculatedColumn:p,column:r,navigateNextColumn:st,navigatePrevColumn:kt,onCancel:Ft,onChange:c,onChangeCalculatedColumnName:C,onChangeFormatting:v,onChangeRendering:w,onChangeServerDataType:h,onChangeToggleButton:i,onChangeType:x,onEditCalculatedColumn:d,onInputCommit:u,onSave:Pt}};var b=require("react/jsx-runtime"),Ce="vuuColumnSettingsPanel",dr=t=>{let{name:e,label:o}=t;return(0,Ze.isCalculatedColumn)(e)?o!=null?o:(0,Ze.getCalculatedColumnName)(t):o!=null?o:e},gr=({column:t,onCancelCreateColumn:e,onConfigChange:o,onCreateCalculatedColumn:n,tableConfig:s,vuuTable:r})=>{let a=t.name==="::",{availableRenderers:l,editCalculatedColumn:p,column:m,navigateNextColumn:d,navigatePrevColumn:g,onCancel:u,onChange:i,onChangeCalculatedColumnName:c,onChangeFormatting:C,onChangeRendering:v,onChangeServerDataType:x,onChangeToggleButton:h,onChangeType:w,onEditCalculatedColumn:D,onInputCommit:st,onSave:kt}=on({column:t,onCancelCreateColumn:e,onConfigChange:o,onCreateCalculatedColumn:n,tableConfig:s}),{serverDataType:Pt,align:Ft=(0,Ze.getDefaultAlignment)(Pt),pin:k,width:S}=m;return(0,b.jsxs)("div",{className:(0,nn.default)(Ce,{[`${Ce}-editing`]:p}),children:[(0,b.jsx)("div",{className:`${Ce}-header`,children:(0,b.jsx)(jo,{column:m,onClick:D})}),p?(0,b.jsx)(Kt,{column:m,onChangeName:c,onChangeServerDataType:x,tableConfig:s,vuuTable:r}):null,(0,b.jsxs)(O.FormField,{"data-field":"column-label",children:[(0,b.jsx)(O.FormFieldLabel,{children:"Column Label"}),(0,b.jsx)(oe.VuuInput,{className:"vuuInput","data-embedded":!0,onChange:i,onCommit:st,value:dr(m)})]}),(0,b.jsxs)(O.FormField,{"data-field":"column-width",children:[(0,b.jsx)(O.FormFieldLabel,{children:"Column Width"}),(0,b.jsx)(oe.VuuInput,{className:"vuuInput","data-embedded":!0,onChange:i,value:S,onCommit:st})]}),(0,b.jsxs)(O.FormField,{"data-field":"column-alignment",children:[(0,b.jsx)(O.FormFieldLabel,{children:"Alignment"}),(0,b.jsxs)(O.ToggleButtonGroup,{onChange:h,value:Ft,children:[(0,b.jsx)(O.ToggleButton,{value:"left",children:(0,b.jsx)(oe.Icon,{name:"align-left",size:16})}),(0,b.jsx)(O.ToggleButton,{value:"right",children:(0,b.jsx)(oe.Icon,{name:"align-right",size:16})})]})]}),(0,b.jsxs)(O.FormField,{"data-field":"column-pin",children:[(0,b.jsx)(O.FormFieldLabel,{children:"Pin Column"}),(0,b.jsxs)(O.ToggleButtonGroup,{onChange:h,value:k!=null?k:"",children:[(0,b.jsx)(O.ToggleButton,{value:"left",children:(0,b.jsx)(oe.Icon,{name:"pin-left",size:16})}),(0,b.jsx)(O.ToggleButton,{value:"floating",children:(0,b.jsx)(oe.Icon,{name:"pin-float",size:16})}),(0,b.jsx)(O.ToggleButton,{value:"right",children:(0,b.jsx)(oe.Icon,{name:"pin-right",size:16})}),(0,b.jsx)(O.ToggleButton,{value:"",children:(0,b.jsx)(oe.Icon,{name:"cross-circle",size:16})})]})]}),(0,b.jsx)(oo,{availableRenderers:l,column:m,onChangeFormatting:C,onChangeRendering:v,onChangeColumnType:w}),p?(0,b.jsxs)("div",{className:"vuuColumnSettingsPanel-buttonBar","data-align":"right",children:[(0,b.jsx)(O.Button,{className:`${Ce}-buttonCancel`,onClick:u,tabIndex:-1,children:"cancel"}),(0,b.jsx)(O.Button,{className:`${Ce}-buttonSave`,onClick:kt,variant:"cta",children:"save"})]}):(0,b.jsxs)("div",{className:`${Ce}-buttonBar`,"data-align":a?"right":void 0,children:[(0,b.jsx)(O.Button,{className:`${Ce}-buttonNavPrev`,variant:"secondary","data-icon":"arrow-left",onClick:g,children:"PREVIOUS"}),(0,b.jsx)(O.Button,{className:`${Ce}-buttonNavNext`,variant:"secondary","data-icon":"arrow-right",onClick:d,children:"NEXT"})]})]})};var rn=ue(require("clsx"),1),rt=require("react");var le=require("react/jsx-runtime"),nt="vuuDatasourceStats",no=new Intl.NumberFormat,fr=({className:t,dataSource:e})=>{let[o,n]=(0,rt.useState)(e.range),[s,r]=(0,rt.useState)(e.size);(0,rt.useEffect)(()=>(r(e.size),e.on("resize",r),e.on("range",n),()=>{e.removeListener("resize",r),e.removeListener("range",n)}),[e]);let a=(0,rn.default)(nt,t),l=no.format(o.from+1),p=no.format(Math.min(o.to,s)),m=no.format(s);return(0,le.jsxs)("div",{className:a,children:[(0,le.jsx)("span",{className:`${nt}-label`,children:"Row count"}),(0,le.jsx)("span",{className:`${nt}-range`,children:l}),(0,le.jsx)("span",{children:"-"}),(0,le.jsx)("span",{className:`${nt}-range`,children:p}),(0,le.jsx)("span",{children:"of"}),(0,le.jsx)("span",{className:`${nt}-size`,children:m})]})};var L=require("@salt-ds/core");var sn=require("@vuu-ui/vuu-table"),I=require("@vuu-ui/vuu-utils"),ne=require("react"),Cr=(t,e)=>{let o=[];for(let{name:n}of t){let s=e.find(r=>r.name===n);s&&o.push(s)}return o},vr=(t,e)=>t.map(({name:o,serverDataType:n})=>{let s=e.find(r=>r.name===o);return{hidden:s==null?void 0:s.hidden,isCalculated:(0,I.isCalculatedColumn)(o),label:s==null?void 0:s.label,name:o,serverDataType:n,subscribed:s!==void 0}}),ro=({availableColumns:t,onConfigChange:e,onDataSourceConfigChange:o,tableConfig:n})=>{let[{availableColumns:s,tableConfig:r},a]=(0,ne.useState)({availableColumns:t,tableConfig:n}),l=(0,ne.useMemo)(()=>vr(s,r.columns),[s,r.columns]),p=(0,ne.useCallback)((c,C)=>{a(v=>{let x=(0,I.moveItem)(v.availableColumns,c,C),h=Cr(x,r.columns);return{availableColumns:x,tableConfig:{...v.tableConfig,columns:h}}})},[r.columns]),m=(0,ne.useCallback)((c,C,v)=>{let x=l.find(h=>h.name===c);if(C==="subscribed")if(x!=null&&x.subscribed){let h=r.columns.filter(w=>w.name!==c).map(w=>w.name);a(w=>({...w,tableConfig:{...r,columns:r.columns.filter((0,I.subscribedOnly)(h))}})),o({columns:h})}else{let h={...r,columns:(0,I.addColumnToSubscribedColumns)(r.columns,s,c)};a(D=>({...D,tableConfig:h}));let w=h.columns.map(D=>D.name);o({columns:w})}else if(x!=null&&x.subscribed){let h=r.columns.find(w=>w.name===c);if(h){let w=(0,sn.updateTableConfig)(r,{type:"column-prop",property:C,column:h,value:v});a(D=>({...D,tableConfig:w}))}}},[s,l,o,r]),d=(0,ne.useCallback)(c=>{let C=(0,I.queryClosest)(c.target,"button");if(C){let v=parseInt(C.value),x=v===0?void 0:v===1?"capitalize":"uppercase";a(h=>({...h,tableConfig:{...h.tableConfig,columnFormatHeader:x}}))}},[]),g=(0,ne.useCallback)(c=>{let C=(0,I.queryClosest)(c.target,"button");if(C){let{ariaPressed:v,value:x}=C;console.log({ariaPressed:v,value:x,button:C}),a(h=>({...h,tableConfig:{...h.tableConfig,[x]:v!=="true"}}))}},[]),u=(0,ne.useCallback)((c,C)=>{let v=parseInt(C);isNaN(v)||a(x=>({...x,tableConfig:{...x.tableConfig,columnDefaultWidth:v}})),console.log({value:C})},[]);(0,I.useLayoutEffectSkipFirst)(()=>{e==null||e(r)},[e,r]);let i=r.columnFormatHeader===void 0?0:r.columnFormatHeader==="capitalize"?1:2;return{columnItems:l,columnLabelsValue:i,onChangeColumnLabels:d,onChangeTableAttribute:g,onColumnChange:m,onCommitColumnWidth:u,onMoveListItem:p,tableConfig:r}};var Se=require("@vuu-ui/vuu-ui-controls"),an=require("@vuu-ui/vuu-ui-controls");var E=require("react/jsx-runtime"),Tt="vuuTableSettingsPanel",xr=({allowColumnLabelCase:t=!0,allowColumnDefaultWidth:e=!0,allowGridRowStyling:o=!0,availableColumns:n,onAddCalculatedColumn:s,onConfigChange:r,onDataSourceConfigChange:a,onNavigateToColumn:l,tableConfig:p})=>{var x,h,w;let{columnItems:m,columnLabelsValue:d,onChangeColumnLabels:g,onChangeTableAttribute:u,onColumnChange:i,onCommitColumnWidth:c,onMoveListItem:C,tableConfig:v}=ro({availableColumns:n,onConfigChange:r,onDataSourceConfigChange:a,tableConfig:p});return(0,E.jsxs)("div",{className:Tt,children:[t||e||o?(0,E.jsx)("div",{className:`${Tt}-header`,children:(0,E.jsx)("span",{children:"Column Settings"})}):null,e?(0,E.jsxs)(L.FormField,{children:[(0,E.jsx)(L.FormFieldLabel,{children:"Column Width"}),(0,E.jsx)(an.VuuInput,{className:"vuuInput","data-embedded":!0,onCommit:c})]}):null,t?(0,E.jsxs)(L.FormField,{children:[(0,E.jsx)(L.FormFieldLabel,{children:"Column Labels"}),(0,E.jsxs)(L.ToggleButtonGroup,{className:"vuuToggleButtonGroup",onChange:g,value:d,children:[(0,E.jsx)(L.ToggleButton,{className:"vuuIconToggleButton",value:0,children:(0,E.jsx)(Se.Icon,{name:"text-strikethrough",size:48})}),(0,E.jsx)(L.ToggleButton,{className:"vuuIconToggleButton",value:1,children:(0,E.jsx)(Se.Icon,{name:"text-Tt",size:48})}),(0,E.jsx)(L.ToggleButton,{className:"vuuIconToggleButton",value:2,children:(0,E.jsx)(Se.Icon,{name:"text-T",size:48})})]})]}):null,o?(0,E.jsxs)(L.FormField,{children:[(0,E.jsx)(L.FormFieldLabel,{children:"Grid separators"}),(0,E.jsxs)("div",{className:"saltToggleButtonGroup vuuStateButtonGroup saltToggleButtonGroup-horizontal",children:[(0,E.jsx)(L.ToggleButton,{selected:(x=v.zebraStripes)!=null?x:!1,onChange:u,value:"zebraStripes",children:(0,E.jsx)(Se.Icon,{name:"row-striping",size:16})}),(0,E.jsx)(L.ToggleButton,{selected:(h=v.rowSeparators)!=null?h:!1,onChange:u,value:"rowSeparators",children:(0,E.jsx)(Se.Icon,{name:"row-lines",size:16})}),(0,E.jsx)(L.ToggleButton,{selected:(w=v.columnSeparators)!=null?w:!1,onChange:u,value:"columnSeparators",children:(0,E.jsx)(Se.Icon,{name:"col-lines",size:16})})]})]}):null,(0,E.jsx)(Rt,{columnItems:m,onChange:i,onMoveListItem:C,onNavigateToColumn:l}),(0,E.jsxs)("div",{className:`${Tt}-calculatedButtonbar`,children:[(0,E.jsx)(L.Button,{"data-icon":"plus",onClick:s}),(0,E.jsx)("span",{className:`${Tt}-calculatedLabel`,children:"Add calculated column"})]})]})};
1
+ 'use strict';
2
+
3
+ var CaseValidator = require('./cell-edit-validators/CaseValidator.js');
4
+ var PatternValidator = require('./cell-edit-validators/PatternValidator.js');
5
+ var BackgroundCell = require('./cell-renderers/background-cell/BackgroundCell.js');
6
+ var BackgroundCellConfigurationEditor = require('./cell-renderers/background-cell/BackgroundCellConfigurationEditor.js');
7
+ var DropdownCell = require('./cell-renderers/dropdown-cell/DropdownCell.js');
8
+ var LookupCell = require('./cell-renderers/lookup-cell/LookupCell.js');
9
+ var PctProgressCell = require('./cell-renderers/pct-progress-cell/PctProgressCell.js');
10
+ require('./cell-renderers/progress-cell/ProgressCell.js');
11
+ var ColumnList = require('./column-list/ColumnList.js');
12
+ var ColumnSettingsPanel = require('./column-settings/ColumnSettingsPanel.js');
13
+ var ColumnExpressionInput = require('./column-expression-input/ColumnExpressionInput.js');
14
+ var ColumnExpressionLanguage = require('./column-expression-input/column-language-parser/ColumnExpressionLanguage.js');
15
+ var ColumnExpressionTreeWalker = require('./column-expression-input/column-language-parser/ColumnExpressionTreeWalker.js');
16
+ var columnExpressionParseUtils = require('./column-expression-input/column-language-parser/column-expression-parse-utils.js');
17
+ var useColumnExpressionEditor = require('./column-expression-input/useColumnExpressionEditor.js');
18
+ var useColumnExpressionSuggestionProvider = require('./column-expression-input/useColumnExpressionSuggestionProvider.js');
19
+ var ColumnExpressionPanel = require('./column-expression-panel/ColumnExpressionPanel.js');
20
+ var ColumnFormattingPanel = require('./column-formatting-settings/ColumnFormattingPanel.js');
21
+ var BaseNumericFormattingSettings = require('./column-formatting-settings/BaseNumericFormattingSettings.js');
22
+ var DateTimeFormattingSettings = require('./column-formatting-settings/DateTimeFormattingSettings.js');
23
+ var DatasourceStats = require('./datasource-stats/DatasourceStats.js');
24
+ var TableSettingsPanel = require('./table-settings/TableSettingsPanel.js');
25
+ var useTableSettings = require('./table-settings/useTableSettings.js');
26
+
27
+
28
+
29
+ exports.CaseValidator = CaseValidator.CaseValidator;
30
+ exports.PatternValidator = PatternValidator.PatternValidator;
31
+ exports.BackgroundCell = BackgroundCell.BackgroundCell;
32
+ exports.BackgroundCellConfigurationEditor = BackgroundCellConfigurationEditor.BackgroundCellConfigurationEditor;
33
+ exports.DropdownCell = DropdownCell.DropdownCell;
34
+ exports.LookupCell = LookupCell.LookupCell;
35
+ exports.PctProgressCell = PctProgressCell.PctProgressCell;
36
+ exports.ColumnList = ColumnList.ColumnList;
37
+ exports.ColumnSettingsPanel = ColumnSettingsPanel.ColumnSettingsPanel;
38
+ exports.ColumnExpressionInput = ColumnExpressionInput.ColumnExpressionInput;
39
+ exports.columnExpressionLanguageSupport = ColumnExpressionLanguage.columnExpressionLanguageSupport;
40
+ exports.walkTree = ColumnExpressionTreeWalker.walkTree;
41
+ exports.ColumnNamedTerms = columnExpressionParseUtils.ColumnNamedTerms;
42
+ exports.isCompleteExpression = columnExpressionParseUtils.isCompleteExpression;
43
+ exports.isCompleteRelationalExpression = columnExpressionParseUtils.isCompleteRelationalExpression;
44
+ exports.lastNamedChild = columnExpressionParseUtils.lastNamedChild;
45
+ exports.useColumnExpressionEditor = useColumnExpressionEditor.useColumnExpressionEditor;
46
+ exports.useColumnExpressionSuggestionProvider = useColumnExpressionSuggestionProvider.useColumnExpressionSuggestionProvider;
47
+ exports.ColumnExpressionPanel = ColumnExpressionPanel.ColumnExpressionPanel;
48
+ exports.ColumnFormattingPanel = ColumnFormattingPanel.ColumnFormattingPanel;
49
+ exports.BaseNumericFormattingSettings = BaseNumericFormattingSettings.BaseNumericFormattingSettings;
50
+ exports.DateTimeFormattingSettings = DateTimeFormattingSettings.DateTimeFormattingSettings;
51
+ exports.DataSourceStats = DatasourceStats.DataSourceStats;
52
+ exports.TableSettingsPanel = TableSettingsPanel.TableSettingsPanel;
53
+ exports.useTableSettings = useTableSettings.useTableSettings;
2
54
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,22 +1,21 @@
1
1
  {
2
- "name": "@vuu-ui/vuu-table-extras",
3
- "version": "0.8.32",
2
+ "version": "0.8.33",
4
3
  "author": "heswell",
5
4
  "license": "Apache-2.0",
6
5
  "devDependencies": {
7
- "@vuu-ui/vuu-filter-types": "0.8.32",
8
- "@vuu-ui/vuu-protocol-types": "0.8.32"
6
+ "@vuu-ui/vuu-filter-types": "0.8.33",
7
+ "@vuu-ui/vuu-protocol-types": "0.8.33"
9
8
  },
10
9
  "dependencies": {
11
- "@vuu-ui/vuu-codemirror": "0.8.32",
12
- "@vuu-ui/vuu-data-react": "0.8.32",
13
- "@vuu-ui/vuu-data-types": "0.8.32",
14
- "@vuu-ui/vuu-table-types": "0.8.32",
15
- "@vuu-ui/vuu-layout": "0.8.32",
16
- "@vuu-ui/vuu-popups": "0.8.32",
17
- "@vuu-ui/vuu-table": "0.8.32",
18
- "@vuu-ui/vuu-utils": "0.8.32",
19
- "@vuu-ui/vuu-ui-controls": "0.8.32",
10
+ "@vuu-ui/vuu-codemirror": "0.8.33",
11
+ "@vuu-ui/vuu-data-react": "0.8.33",
12
+ "@vuu-ui/vuu-data-types": "0.8.33",
13
+ "@vuu-ui/vuu-table-types": "0.8.33",
14
+ "@vuu-ui/vuu-layout": "0.8.33",
15
+ "@vuu-ui/vuu-popups": "0.8.33",
16
+ "@vuu-ui/vuu-table": "0.8.33",
17
+ "@vuu-ui/vuu-utils": "0.8.33",
18
+ "@vuu-ui/vuu-ui-controls": "0.8.33",
20
19
  "@lezer/lr": "1.3.4",
21
20
  "@salt-ds/core": "1.17.0"
22
21
  },
@@ -27,14 +26,11 @@
27
26
  },
28
27
  "type": "module",
29
28
  "files": [
30
- "cjs",
31
- "esm",
32
- "index.css",
33
- "index.css.map",
29
+ "README.md",
34
30
  "/types"
35
31
  ],
36
- "style": "index.css",
37
- "module": "esm/index.js",
38
32
  "main": "cjs/index.js",
33
+ "module": "esm/index.js",
34
+ "name": "@vuu-ui/vuu-table-extras",
39
35
  "types": "types/index.d.ts"
40
36
  }
package/LICENSE DELETED
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright 2015 UBS
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.