@hpcc-js/form 3.4.0 → 3.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- var t=Object.defineProperty,e=(e,n)=>t(e,"name",{value:n,configurable:!0});import{IInput as n}from"@hpcc-js/api";import{HTMLWidget as i,rgb as s,WidgetArray as o,d3Event as l,select as a,SVGWidget as r,scaleLinear as p,timeParse as h,drag as u,timeFormat as c,format as d}from"@hpcc-js/common";const m="@hpcc-js/form",f="3.4.0",y="3.21.0",g=class _Button extends i{_inputElement=[];constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this;this._inputElement[0]=e.append("button").attr("name",this.name()).on("click",function(t){t.click(t)}).on("blur",function(t){t.blur(t)}).on("change",function(t){n.value([n._inputElement[0].property("value")]),t.change(t,!0)})}update(t,e){super.update(t,e),this._inputElement[0].text(this.value())}};e(g,"Button");let b=g;b.prototype._class+=" form_Button",b.prototype.implements(n.prototype);const _=class _CheckBox extends i{_inputElement=[];constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this,i=e.append("ul");this.selectOptions().length||this.selectOptions().push(""),this.selectOptions().forEach(function(t,e){n._inputElement[e]=i.append("li").append("input").attr("type","checkbox"),n._inputElement[e].node().insertAdjacentHTML("afterend","<text>"+t+"</text>")}),this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(t){const e=[];n._inputElement.forEach(function(t){t.property("checked")&&e.push(t.property("value"))}),n.value(e),t.change(t,!0)})})}update(t,e){super.update(t,e);const n=this;this._inputElement.forEach(function(t,e){t.property("value",n.selectOptions()[e]),-1!==n.value().indexOf(n.selectOptions()[e])&&"false"!==n.value()?t.property("checked",!0):t.property("checked",!1)})}insertSelectOptions(t){let e="";t.length>0?t.forEach(function(t){const n=t instanceof Array?t[0]:t,i=t instanceof Array?t[1]?t[1]:t[0]:t;e+="<option value='"+n+"'>"+i+"</option>"}):e+="<option>selectOptions not set</option>",this._inputElement[0].html(e)}};e(_,"CheckBox");let v=_;v.prototype._class+=" form_CheckBox",v.prototype.implements(n.prototype),v.prototype.publish("selectOptions",[],"array","Array of options used to fill a dropdown list");const x=class _ColorInput extends i{_inputElement=[];constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this;this._inputElement[0]=e.append("input").attr("type","text"),this._inputElement[0].classed("color-text",!0),this._inputElement[1]=e.append("input").attr("type","color"),this._inputElement.forEach(function(t,e){t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(t){0===e?(n._inputElement[1].property("value",s(n._inputElement[0].property("value")).toString()),n.value(n._inputElement[0].property("value"))):(n._inputElement[0].property("value",n._inputElement[1].property("value")),n.value(s(n._inputElement[1].property("value")).toString())),t.change(t,!0)})})}update(t,e){super.update(t,e);const n=this;this._inputElement.forEach(function(t){t.attr("name",n.name())}),this._inputElement[0].attr("type","text"),this._inputElement[1].attr("type","color"),this._inputElement[0].property("value",this.value()),this._inputElement[1].property("value",s(this.value()).toString());const i=this._inputElement[0].node().getBoundingClientRect();this._inputElement[1].style("height",i.height-2+"px")}};e(x,"ColorInput");let E=x;E.prototype._class+=" form_ColorInput",E.prototype.implements(n.prototype);const k=class _Form extends i{tbody;tfoot;btntd;_controls;_maxCols;constructor(){super(),this._tag="form"}data(t){if(!arguments.length){const t=[];return this.inputsForEach(function(e){t.push(e.value())}),t}return this.inputsForEach(function(e,n){t&&t.length>n&&e.value(t[n]).render()}),this}inputsForEach(t,e){let n=0;this.inputs().forEach(function(i){(i instanceof o?i.content():[i]).forEach(function(i){e?t.call(e,i,n++):t(i,n++)})})}inputsMap(){const t={};return this.inputs().forEach(function(e){t[e.name()]=e}),t}calcMaxColumns(){let t=0;return this.inputs().forEach(function(e){const n=e instanceof o?e.content():[e];n.length>t&&(t=n.length)}),t}values(t){if(!arguments.length){const t={};return this.inputsForEach(function(e){const n=e.type?e.type():"text";if(e.value()||!this.omitBlank())switch(n){case"checkbox":t[e.name()]=e.value_exists()?!!e.value():void 0;break;case"number":const n=e.value();t[e.name()]=""===n?void 0:+n;break;default:t[e.name()]=e.value_exists()?e.value():void 0}},this),t}return this.inputsForEach(function(e){t[e.name()]?e.value(t[e.name()]):this.omitBlank()&&e.value("")},this),this}submit(){let t=!0;this.validate()&&(t=this.checkValidation()),(this.allowEmptyRequest()||this.inputs().some(function(t){return-1!==t._class.indexOf("WidgetArray")?t.content().some(function(t){return t.hasValue()}):t.hasValue()}))&&this.click(t?this.values():null,null,t)}clear(){this.inputsForEach(function(t){switch(t.classID()){case"form_Slider":t.allowRange()?t.value([t.low(),t.low()]).render():t.value(t.low()).render();break;case"form_CheckBox":t.value(!1).render();break;case"form_Button":break;default:t.value(void 0).render()}})}checkValidation(){let t=!0;const e=[];return this.inputsForEach(function(t){t.isValid()||e.push("'"+t.label()+"' value is invalid.")}),e.length>0&&(alert(e.join("\n")),t=!1),t}enter(t,e){super.enter(t,e),e.on("submit",function(){l().preventDefault()}),this._placeholderElement.style("overflow","auto");const n=e.append("table");this.tbody=n.append("tbody"),this.tfoot=n.append("tfoot"),this.btntd=this.tfoot.append("tr").append("td").attr("colspan",2);const i=this;this._controls=[(new b).classed({default:!0}).value("Submit").on("click",function(){i.submit()},!0),(new b).value("Clear").on("click",function(){i.clear()},!0)];const s=i.btntd.append("div").style("float","right");this._controls.forEach(function(t){const e=s.append("span").style("float","left");t.target(e.node()).render()})}update(t,e){super.update(t,e),this._maxCols=this.calcMaxColumns();const n=this,i=this.tbody.selectAll("tr").data(this.inputs());i.enter().append("tr").each(function(t,e){const i=a(this),s=t instanceof o?t.content():[t];s.forEach(function(t,e){i.append("td").attr("class","prompt");const o=i.append("td").attr("class","input");if(e===s.length-1&&s.length<n._maxCols&&o.attr("colspan",2*(n._maxCols-s.length+1)),t.target(o.node()).render(),t instanceof r){const e=t.element().node().getBBox();o.style("height",e.height+"px"),t.resize().render()}t._inputElement instanceof Array&&t._inputElement.forEach(function(t){t.on("keyup.form",function(t){setTimeout(function(){n._controls[0].disable(!n.allowEmptyRequest()&&!n.inputs().some(function(t){return-1!==t._class.indexOf("WidgetArray")?t.content().some(function(t){return t.hasValue()}):t.hasValue()}))},100)})})})}).merge(i).each(function(t,e){const n=a(this);(t instanceof o?t.content():[t]).forEach(function(t,e){n.select("td.prompt").text(t.label()+":")})}),i.each(function(t,e){0===e&&t.setFocus&&t.setFocus()}),i.exit().each(function(t,e){(t instanceof o?t.content():[t]).forEach(function(t,e){t.target(null)})}).remove(),this.tfoot.style("display",this.showSubmit()?"table-footer-group":"none"),this.btntd.attr("colspan",2*this._maxCols),this.allowEmptyRequest()||setTimeout(function(){n._controls[0].disable(!n.allowEmptyRequest()&&!n.inputs().some(function(t){return-1!==t._class.indexOf("WidgetArray")?t.content().some(function(t){return t.hasValue()}):t.hasValue()}))},100)}exit(t,e){this.inputsForEach(t=>t.target(null)),super.exit(t,e)}click(t,e,n){}};e(k,"Form");let w=k;w.prototype._class+=" form_Form",w.prototype.publish("validate",!0,"boolean","Enable/Disable input validation"),w.prototype.publish("inputs",[],"widgetArray","Array of input widgets",null,{render:!1}),w.prototype.publish("showSubmit",!0,"boolean","Show Submit/Cancel Controls"),w.prototype.publish("omitBlank",!1,"boolean","Drop Blank Fields From Submit"),w.prototype.publish("allowEmptyRequest",!1,"boolean","Allow Blank Form to be Submitted");const R=class _Input extends i{_inputElement=[];_labelElement=[];constructor(){super(),n.call(this),this._tag="div"}checked(t){return arguments.length?(this._inputElement[0]&&this._inputElement[0].property("checked",t),this):!!this._inputElement[0]&&this._inputElement[0].property("checked")}enter(t,e){super.enter(t,e),this._labelElement[0]=e.append("label").attr("for",this.id()+"_input").style("visibility",this.inlineLabel_exists()?"visible":"hidden");const n=this;switch(this.type()){case"button":this._inputElement[0]=e.append("button").attr("id",this.id()+"_input");break;case"textarea":this._inputElement[0]=e.append("textarea").attr("id",this.id()+"_input");break;default:this._inputElement[0]=e.append("input").attr("id",this.id()+"_input").attr("type",this.type())}this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(e){n.value([t.property("value")]),e.change(e,!0)}),t.on("keyup",function(e){n.value([t.property("value")]),e.change(e,!1)})})}update(t,e){switch(super.update(t,e),this._labelElement[0].style("visibility",this.inlineLabel_exists()?"visible":"hidden").text(this.inlineLabel()),this.type()){case"button":this._inputElement[0].text(this.value());break;case"textarea":this._inputElement[0].property("value",this.value());break;default:this._inputElement[0].attr("type",this.type()),this._inputElement[0].property("value",this.value())}}blur(t){}keyup(t){}focus(t){}click(t){}dblclick(t){}change(t,e){}};e(R,"Input");let S=R;S.prototype._class+=" form_Input",S.prototype.implements(n.prototype),S.prototype.publish("type","text","set","Input type",["string","number","boolean","date","time","hidden","nested","button","checkbox","text","textarea","search","email","datetime"]),S.prototype.publish("inlineLabel",null,"string","Input Label",null,{optional:!0});const P=class _FieldForm extends w{constructor(){super(),this._tag="form"}fields(t){const e=super.fields.apply(this,arguments);if(arguments.length){const e=this.inputsMap();this.inputs(t.map(t=>e[t.id()]||(new S).name(t.id()).label(t.label()).type(t.type())))}return e}data(t){if(!arguments.length)return super.data();if(super.data(t[0]),t[0]){const e=this.inputs(),n=t[0][this.columns().length];let i=0;for(const t in n)e[i].name(t),++i}return this}};e(P,"FieldForm");let O=P;O.prototype._class+=" form_FieldForm";const C=class _InputRange extends i{_inputElement=[];_labelElement=[];_rangeData=[];constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e),this._labelElement[0]=e.append("label").attr("for",this.id()+"_input").style("visibility",this.inlineLabel_exists()?"visible":"hidden"),this._inputElement.push(e.append("input").attr("id",this.id()+"_input_min").attr("type",this.type())),this._inputElement.push(e.append("input").attr("id",this.id()+"_input_max").attr("type",this.type()));const n=this;this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(i){n._rangeData[e]=t.property("value"),n.value(n._rangeData),i.change(i,!0)})})}update(t,e){super.update(t,e),this._labelElement[0].style("visibility",this.inlineLabel_exists()?"visible":"hidden").text(this.inlineLabel()),this._rangeData=this.value(),this._inputElement.forEach(function(t,e){t.attr("type",this.type()).property("value",this._rangeData.length>e?this._rangeData[e]:"")},this)}};e(C,"InputRange");let F=C;F.prototype._class+=" form_InputRange",F.prototype.implements(n.prototype),F.prototype.publish("type","text","set","InputRange type",["number","date","text","time","datetime","hidden"]),F.prototype.publish("inlineLabel",null,"string","InputRange Label",null,{optional:!0}),F.prototype.publish("value",["",""],"array","Input Current Value",null,{override:!0});const L=class _OnOff extends i{_inputElement=[];_input;constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e),e.classed("onoffswitch",!0);const n=this;this._input=e.append("input").attr("class","onoffswitch-checkbox").attr("type","checkbox").attr("id",this.id()+"_onOff").on("click",function(t){t.click(t)}).on("blur",function(t){t.blur(t)}).on("change",function(t){const e=[];n._inputElement.forEach(function(t,n){t.property("checked")&&e.push(t.property("value"))}),n.value(e),t.change(t,!0)});const i=e.append("label").attr("class","onoffswitch-label").attr("for",this.id()+"_onOff"),s=i.append("div").attr("class","onoffswitch-inner");s.append("div").attr("class","onoffswitch-offText").style("padding-right",this.containerRadius()/2+"px").text(this.offText()),s.append("div").attr("class","onoffswitch-onText").style("padding-left",this.containerRadius()/2+"px").style("width",`calc(100% - ${this.containerRadius()/2}px)`).text(this.onText()),i.append("div").attr("class","onoffswitch-switch")}update(t,e){super.update(t,e),this._input.attr("name",this.name()),e.style("margin-left",this.marginLeft()+"px").style("margin-bottom",this.marginBottom()+"px").style("width",this.minWidth()+"px");const n=this.minHeight()-4*this.gutter();e.select(".onoffswitch-switch").style("height",n+"px").style("width",n+"px").style("top",2*this.gutter()+1+"px").style("border-radius",this.switchRadius()+"px"),e.select(".onoffswitch-inner").style("min-height",this.minHeight()+"px"),e.select(".onoffswitch-label").style("border-radius",this.containerRadius()+"px"),e.select(".onoffswitch-offText").style("color",this.offFontColor()).style("background-color",this.offColor()),e.select(".onoffswitch-onText").style("color",this.onFontColor()).style("background-color",this.onColor())}};e(L,"OnOff");let A=L;A.prototype._class+=" form_OnOff",A.prototype.implements(n.prototype),A.prototype.publish("marginLeft",0,"number","Margin left of OnOff"),A.prototype.publish("marginBottom",0,"number","Margin bottom of OnOff"),A.prototype.publish("minWidth",100,"number","Minimum width of OnOff (pixels)"),A.prototype.publish("minHeight",20,"number","Minimum height of OnOff (pixels)"),A.prototype.publish("gutter",1,"number","Space between switch and border of OnOff (pixels)"),A.prototype.publish("onText","Save","string","Text to display when 'ON'"),A.prototype.publish("offText","Properties","string","Text to display when 'OFF'"),A.prototype.publish("switchRadius",10,"number","Border radius of switch (pixels)"),A.prototype.publish("containerRadius",10,"number","Border radius of OnOff (pixels)"),A.prototype.publish("onColor","#2ecc71","html-color","Background color when 'ON'"),A.prototype.publish("offColor","#ecf0f1","html-color","Background color when 'OFF'"),A.prototype.publish("onFontColor","#2c3e50","html-color","Font color when 'ON'"),A.prototype.publish("offFontColor","#7f8c8d","html-color","Font color when 'OFF'");const B=class _Radio extends i{_inputElement=[];constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this,i=e.append("ul");this.selectOptions().length||this.selectOptions().push(""),this.selectOptions().forEach(function(t,e){n._inputElement[e]=i.append("li").append("input").attr("type","radio"),n._inputElement[e].node().insertAdjacentHTML("afterend","<text>"+t+"</text>")}),this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(e){n.value([t.property("value")]),e.change(e,!0)})})}update(t,e){super.update(t,e);const n=this;this._inputElement.forEach(function(t,e){t.property("value",n.selectOptions()[e]),-1!==n.value().indexOf(n.selectOptions()[e])&&"false"!==n.value()?t.property("checked",!0):t.property("checked",!1)})}};e(B,"Radio");let M=B;M.prototype._class+=" form_Radio",M.prototype.implements(n.prototype),M.prototype.publish("selectOptions",[],"array","Array of options used to fill a dropdown list");const H=class _Range extends i{_inputElement=[];constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this;this._inputElement[0]=e.append("input").attr("type","range"),this._inputElement[1]=e.append("input").attr("type","number"),this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(t){0===e?(n._inputElement[1].property("value",s(n._inputElement[0].property("value")).toString()),n.value(n._inputElement[0].property("value"))):(n._inputElement[0].property("value",n._inputElement[1].property("value")),n.value(s(n._inputElement[1].property("value")).toString())),t.change(t,!0)})})}update(t,e){super.update(t,e),this._inputElement[0].attr("type","range"),this._inputElement[0].property("value",this.value()),this._inputElement[0].attr("min",this.low()),this._inputElement[0].attr("max",this.high()),this._inputElement[0].attr("step",this.step()),this._inputElement[1].attr("type","number"),this._inputElement[1].property("value",this.value()),this._inputElement[1].attr("min",this.low()),this._inputElement[1].attr("max",this.high()),this._inputElement[1].attr("step",this.step())}insertSelectOptions(t){let e="";t.length>0?t.forEach(function(t){const n=t instanceof Array?t[0]:t,i=t instanceof Array?t[1]?t[1]:t[0]:t;e+="<option value='"+n+"'>"+i+"</option>"}):e+="<option>selectOptions not set</option>",this._inputElement[0].html(e)}};e(H,"Range");let I=H;I.prototype._class+=" form_Range",I.prototype.implements(n.prototype),I.prototype.publish("type","text","set","Input type",["html-color","number","checkbox","button","select","textarea","date","text","range","search","email","time","datetime"]),I.prototype.publish("selectOptions",[],"array","Array of options used to fill a dropdown list"),I.prototype.publish("low",null,"number","Minimum value for Range input"),I.prototype.publish("high",null,"number","Maximum value for Range input"),I.prototype.publish("step",null,"number","Step value for Range input");const T=class _Select extends i{_inputElement=[];constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this;this._inputElement[0]=e.append("select").attr("name",this.name()).on("click",function(t){t.click(t)}).on("blur",function(t){t.blur(t)}).on("change",function(t){n.value([n._inputElement[0].property("value")]),t.change(t,!0)})}update(t,e){super.update(t,e),this.insertSelectOptions(this.selectOptions()),this._inputElement[0].property("value",this.value()).style("max-width",this.maxWidth_exists()?this.maxWidth()+"px":null)}insertSelectOptions(t){let e="";t.length>0?t.forEach(function(t){const n=t instanceof Array?t[0]:t,i=t instanceof Array?t[1]?t[1]:t[0]:t;e+="<option value='"+n+"'>"+i+"</option>"}):e+="<option>selectOptions not set</option>",this._inputElement[0].html(e)}};e(T,"Select");let V=T;V.prototype._class+=" form_Select",V.prototype.implements(n.prototype),V.prototype.publish("selectOptions",[],"array","Array of options used to fill a dropdown list"),V.prototype.publish("maxWidth",120,"number","Width",null,{optional:!0});const D=class _Slider extends r{xScale;moveMode;moveStartPos;prevValue;slider;handleLeft;handleLeftPos=0;handleLeftStartPos;handleRight;handleRightPos=0;handleRightStartPos;constructor(){super(),n.call(this)}enter(t,e){if(super.enter(t,e),this.resize({width:this.width(),height:50}),this.xScale=p().clamp(!0),this.slider=e.append("g").attr("class","slider"),null===this.low()&&null===this.high()&&null!==this.lowDatetime()&&null!==this.highDatetime()){const t=h(this.timePattern()?this.timePattern():"%Q");this.low(t(this.lowDatetime()).getTime()),this.high(t(this.highDatetime()).getTime())}this.slider.append("line").attr("class","track").select(function(){return this.parentNode.appendChild(this.cloneNode(!0))}).attr("class","track-inset").select(function(){return this.parentNode.appendChild(this.cloneNode(!0))}).attr("class","track-overlay").call(u().on("start",()=>{const t=l();this.moveStartPos=t.x,this.handleLeftStartPos=this.handleLeftPos,this.handleRightStartPos=this.handleRightPos,this.allowRange()&&this.handleLeftPos<=t.x&&t.x<=this.handleRightPos?this.moveMode="both":Math.abs(t.x-this.handleLeftPos)<Math.abs(t.x-this.handleRightPos)?this.moveMode="left":this.moveMode="right",this.moveHandleTo(t.x)}).on("drag",()=>{this.moveHandleTo(l().x)}).on("end",()=>{this.moveHandleTo(l().x),this.data([[this.xScale.invert(this.handleLeftPos),this.xScale.invert(this.handleRightPos)]]),this.checkChangedValue()})),this.slider.insert("g",".track-overlay").attr("class","ticks").attr("transform",`translate(0, ${this.fontSize()+this.tickHeight()/2})`),this.handleRight=this.slider.insert("path",".track-overlay").attr("class","handle"),this.handleLeft=this.slider.insert("path",".track-overlay").attr("class","handle")}update(t,e){super.update(t,e);const n=this;this.xScale.domain([this.low(),this.high()]).range([0,this.width()-2*this.padding()]),this.slider.attr("transform","translate("+(-this.width()/2+this.padding())+",0)"),this.slider.selectAll("line.track,line.track-inset,line.track-overlay").attr("x1",this.xScale.range()[0]).attr("x2",this.xScale.range()[1]);const i=(this.width()-2*this.padding())/(this.tickCount()-1),s=[];if(null!==this.tickDateFormat()&&null!==this.timePattern()){const t=h("%Q"),e=c(this.tickDateFormat()),n=(this.high()-this.low())/(this.tickCount()-1);for(let i=0;i<this.tickCount();i++){const o=t(""+(this.low()+n*i));s.push(e(o))}}else{const t=d(this.tickValueFormat()),e=(this.high()-this.low())/(this.tickCount()-1);for(let n=0;n<this.tickCount();n++){const i=this.low()+e*n;s.push(t(i))}}const o=this.slider.selectAll("g.tick").data(s),l=o.enter().append("g").attr("class","tick");l.append("text").attr("class","tick-text"),l.append("line").attr("class","tick-line"),l.merge(o).each(function(t,e){const s=i*e;a(this).select("text.tick-text").style("font-size",n.fontSize()).attr("x",function(){return 0===e?s-2:e===n.tickCount()-1?s+2:s}).attr("y",n.tickHeight()+n.tickOffset()/2+n.fontSize()).attr("text-basline","text-before-edge").attr("text-anchor",function(){return 0===e?"start":e===n.tickCount()-1?"end":"middle"}).text(()=>t),a(this).select("line.tick-line").attr("x1",s).attr("x2",s).attr("y1",n.tickOffset()-1).attr("y2",n.tickOffset()+n.tickHeight()).style("stroke","#000").style("stroke-width",1)}),this.slider.node().appendChild(this.handleRight.node()),this.slider.node().appendChild(this.handleLeft.node()),this.handleLeftPos=this.lowPos(),this.handleRightPos=this.highPos(),this.updateHandles(),this.checkChangedValue()}checkChangedValue(){this.prevValue!==this.value()&&void 0!==this.prevValue&&this.change(this),this.prevValue=this.value()}updateHandles(){this.handleLeft.attr("transform",`translate(${this.handleLeftPos}, -28)`).attr("d",t=>this.handlePath("l")),this.handleRight.attr("transform",`translate(${this.handleRightPos}, -28)`).attr("d",t=>this.handlePath("r"))}lowPos(){let t=[[this.low(),this.high()]];return this.data().length>0&&"number"==typeof this.data()[0][0]&&"number"==typeof this.data()[0][1]&&(t=this.data()),this.xScale(t[0][0])}highPos(){let t=[[this.low(),this.high()]];return this.data().length>0&&"number"==typeof this.data()[0][0]&&"number"==typeof this.data()[0][1]&&(t=this.data()),this.xScale(t[0][this.allowRange()?1:0])}moveHandleTo(t){if(this.allowRange())switch(this.moveMode){case"both":this.handleLeftPos=this.handleLeftStartPos+t-this.moveStartPos,this.handleRightPos=this.handleRightStartPos+t-this.moveStartPos;break;case"left":this.handleLeftPos=t,this.handleLeftPos>this.handleRightPos&&(this.handleRightPos=this.handleLeftPos);break;case"right":this.handleRightPos=t,this.handleRightPos<this.handleLeftPos&&(this.handleLeftPos=this.handleRightPos)}else this.handleLeftPos=this.handleRightPos=t;this.handleLeftPos=this.constrain(this.handleLeftPos),this.handleRightPos=this.constrain(this.handleRightPos),this.value(this.allowRange()?[this.xScale.invert(this.handleLeftPos),this.xScale.invert(this.handleRightPos)]:this.xScale.invert(this.handleLeftPos)),this.updateHandles()}constrain(t){const e=this.xScale.range();return t<e[0]&&(t=e[0]),t>e[1]&&(t=e[1]),this.nearestStep(t)}nearestStep(t){const e=this.xScale.invert(t);return this.xScale(this.low()+Math.round((e-this.low())/this.step())*this.step())}handlePath=/* @__PURE__ */e(function(t){const e=+("r"===t),n=e?1:-1,i=this.allowRange()?.5:0;let s="M"+i*n+","+"18A6,6 0 0 "+e+" "+6.5*n+",24V30A6,6 0 0 "+e+" "+i*n+",36";return this.allowRange()?s+="ZM"+2.5*n+",26V28M"+4.5*n+",26V28":s+="M"+1*n+",26V28",s},"handlePath")};e(D,"Slider");let W=D;W.prototype._class+=" form_Slider",W.prototype.implements(n.prototype),W.prototype.publish("padding",16,"number","Outer Padding",null,{tags:["Basic"]}),W.prototype.publish("fontSize",12,"number","Font Size",null,{tags:["Basic"]}),W.prototype.publish("fontFamily",null,"string","Font Name",null,{tags:["Basic"]}),W.prototype.publish("fontColor",null,"html-color","Font Color",null,{tags:["Basic"]}),W.prototype.publish("allowRange",!1,"boolean","Allow Range Selection",null,{tags:["Intermediate"]}),W.prototype.publish("low",null,"number","Low",null,{tags:["Intermediate"]}),W.prototype.publish("high",null,"number","High",null,{tags:["Intermediate"]}),W.prototype.publish("step",10,"number","Step",null,{tags:["Intermediate"]}),W.prototype.publish("lowDatetime",null,"string","Low",null,{tags:["Intermediate"]}),W.prototype.publish("highDatetime",null,"string","High",null,{tags:["Intermediate"]}),W.prototype.publish("selectionLabel","","string","Selection Label",null,{tags:["Intermediate"]}),W.prototype.publish("timePattern","%Y-%m-%d","string"),W.prototype.publish("tickCount",10,"number"),W.prototype.publish("tickOffset",5,"number"),W.prototype.publish("tickHeight",8,"number"),W.prototype.publish("tickDateFormat",null,"string"),W.prototype.publish("tickValueFormat",",.0f","string");const z=W.prototype.name;W.prototype.name=function(t){const e=z.apply(this,arguments);if(arguments.length){const e=t instanceof Array?t:[t];r.prototype.columns.call(this,e)}return e};const N=W.prototype.value;W.prototype.value=function(t){const e=N.apply(this,arguments);return arguments.length?(r.prototype.data.call(this,[this.allowRange()?t:[t,t]]),e):this.allowRange()?r.prototype.data.call(this)[0]:r.prototype.data.call(this)[0][0]};const j=class _TextArea extends S{constructor(){super(),this._tag="div",this.type("textarea")}enter(t,e){super.enter(t,e)}calcHeight(){return Math.max(this.minHeight_exists()?this.minHeight():0,this.height())}update(t,e){super.update(t,e),this._inputElement[0].attr("rows",this.rows()).attr("cols",this.cols()).attr("wrap",this.wrap()).attr("spellcheck",this.spellcheck()).style("height",this.calcHeight()+"px")}};e(j,"TextArea");let q=j;q.prototype._class+=" form_TextArea",q.prototype.publish("rows",null,"number","Rows",null,{optional:!0}),q.prototype.publish("cols",null,"number","Columns",null,{optional:!0}),q.prototype.publish("wrap","off","set","Wrap",["off","on"]),q.prototype.publish("minHeight",null,"number","Minimum Height",null,{optional:!0}),q.prototype.publish("spellcheck",null,"boolean","Input spell checking",{optional:!0});export{y as BUILD_VERSION,b as Button,v as CheckBox,E as ColorInput,O as FieldForm,w as Form,S as Input,F as InputRange,A as OnOff,m as PKG_NAME,f as PKG_VERSION,M as Radio,I as Range,V as Select,W as Slider,q as TextArea};
1
+ var t=Object.defineProperty,e=(e,n)=>t(e,"name",{value:n,configurable:!0});import{IInput as n}from"@hpcc-js/api";import{HTMLWidget as i,rgb as s,WidgetArray as o,d3Event as l,select as a,SVGWidget as r,scaleLinear as p,timeParse as h,drag as u,timeFormat as c,format as d}from"@hpcc-js/common";const m="@hpcc-js/form",f="3.4.2",y="3.21.3",g=class _Button extends i{_inputElement=[];constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this;this._inputElement[0]=e.append("button").attr("name",this.name()).on("click",function(t){t.click(t)}).on("blur",function(t){t.blur(t)}).on("change",function(t){n.value([n._inputElement[0].property("value")]),t.change(t,!0)})}update(t,e){super.update(t,e),this._inputElement[0].text(this.value())}};e(g,"Button");let b=g;b.prototype._class+=" form_Button",b.prototype.implements(n.prototype);const _=class _CheckBox extends i{_inputElement=[];constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this,i=e.append("ul");this.selectOptions().length||this.selectOptions().push(""),this.selectOptions().forEach(function(t,e){n._inputElement[e]=i.append("li").append("input").attr("type","checkbox"),n._inputElement[e].node().insertAdjacentHTML("afterend","<text>"+t+"</text>")}),this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(t){const e=[];n._inputElement.forEach(function(t){t.property("checked")&&e.push(t.property("value"))}),n.value(e),t.change(t,!0)})})}update(t,e){super.update(t,e);const n=this;this._inputElement.forEach(function(t,e){t.property("value",n.selectOptions()[e]),-1!==n.value().indexOf(n.selectOptions()[e])&&"false"!==n.value()?t.property("checked",!0):t.property("checked",!1)})}insertSelectOptions(t){let e="";t.length>0?t.forEach(function(t){const n=t instanceof Array?t[0]:t,i=t instanceof Array?t[1]?t[1]:t[0]:t;e+="<option value='"+n+"'>"+i+"</option>"}):e+="<option>selectOptions not set</option>",this._inputElement[0].html(e)}};e(_,"CheckBox");let v=_;v.prototype._class+=" form_CheckBox",v.prototype.implements(n.prototype),v.prototype.publish("selectOptions",[],"array","Array of options used to fill a dropdown list");const x=class _ColorInput extends i{_inputElement=[];constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this;this._inputElement[0]=e.append("input").attr("type","text"),this._inputElement[0].classed("color-text",!0),this._inputElement[1]=e.append("input").attr("type","color"),this._inputElement.forEach(function(t,e){t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(t){0===e?(n._inputElement[1].property("value",s(n._inputElement[0].property("value")).toString()),n.value(n._inputElement[0].property("value"))):(n._inputElement[0].property("value",n._inputElement[1].property("value")),n.value(s(n._inputElement[1].property("value")).toString())),t.change(t,!0)})})}update(t,e){super.update(t,e);const n=this;this._inputElement.forEach(function(t){t.attr("name",n.name())}),this._inputElement[0].attr("type","text"),this._inputElement[1].attr("type","color"),this._inputElement[0].property("value",this.value()),this._inputElement[1].property("value",s(this.value()).toString());const i=this._inputElement[0].node().getBoundingClientRect();this._inputElement[1].style("height",i.height-2+"px")}};e(x,"ColorInput");let E=x;E.prototype._class+=" form_ColorInput",E.prototype.implements(n.prototype);const k=class _Form extends i{tbody;tfoot;btntd;_controls;_maxCols;constructor(){super(),this._tag="form"}data(t){if(!arguments.length){const t=[];return this.inputsForEach(function(e){t.push(e.value())}),t}return this.inputsForEach(function(e,n){t&&t.length>n&&e.value(t[n]).render()}),this}inputsForEach(t,e){let n=0;this.inputs().forEach(function(i){(i instanceof o?i.content():[i]).forEach(function(i){e?t.call(e,i,n++):t(i,n++)})})}inputsMap(){const t={};return this.inputs().forEach(function(e){t[e.name()]=e}),t}calcMaxColumns(){let t=0;return this.inputs().forEach(function(e){const n=e instanceof o?e.content():[e];n.length>t&&(t=n.length)}),t}values(t){if(!arguments.length){const t={};return this.inputsForEach(function(e){const n=e.type?e.type():"text";if(e.value()||!this.omitBlank())switch(n){case"checkbox":t[e.name()]=e.value_exists()?!!e.value():void 0;break;case"number":const n=e.value();t[e.name()]=""===n?void 0:+n;break;default:t[e.name()]=e.value_exists()?e.value():void 0}},this),t}return this.inputsForEach(function(e){t[e.name()]?e.value(t[e.name()]):this.omitBlank()&&e.value("")},this),this}submit(){let t=!0;this.validate()&&(t=this.checkValidation()),(this.allowEmptyRequest()||this.inputs().some(function(t){return-1!==t._class.indexOf("WidgetArray")?t.content().some(function(t){return t.hasValue()}):t.hasValue()}))&&this.click(t?this.values():null,null,t)}clear(){this.inputsForEach(function(t){switch(t.classID()){case"form_Slider":t.allowRange()?t.value([t.low(),t.low()]).render():t.value(t.low()).render();break;case"form_CheckBox":t.value(!1).render();break;case"form_Button":break;default:t.value(void 0).render()}})}checkValidation(){let t=!0;const e=[];return this.inputsForEach(function(t){t.isValid()||e.push("'"+t.label()+"' value is invalid.")}),e.length>0&&(alert(e.join("\n")),t=!1),t}enter(t,e){super.enter(t,e),e.on("submit",function(){l().preventDefault()}),this._placeholderElement.style("overflow","auto");const n=e.append("table");this.tbody=n.append("tbody"),this.tfoot=n.append("tfoot"),this.btntd=this.tfoot.append("tr").append("td").attr("colspan",2);const i=this;this._controls=[(new b).classed({default:!0}).value("Submit").on("click",function(){i.submit()},!0),(new b).value("Clear").on("click",function(){i.clear()},!0)];const s=i.btntd.append("div").style("float","right");this._controls.forEach(function(t){const e=s.append("span").style("float","left");t.target(e.node()).render()})}update(t,e){super.update(t,e),this._maxCols=this.calcMaxColumns();const n=this,i=this.tbody.selectAll("tr").data(this.inputs());i.enter().append("tr").each(function(t,e){const i=a(this),s=t instanceof o?t.content():[t];s.forEach(function(t,e){i.append("td").attr("class","prompt");const o=i.append("td").attr("class","input");if(e===s.length-1&&s.length<n._maxCols&&o.attr("colspan",2*(n._maxCols-s.length+1)),t.target(o.node()).render(),t instanceof r){const e=t.element().node().getBBox();o.style("height",e.height+"px"),t.resize().render()}t._inputElement instanceof Array&&t._inputElement.forEach(function(t){t.on("keyup.form",function(t){setTimeout(function(){n._controls[0].disable(!n.allowEmptyRequest()&&!n.inputs().some(function(t){return-1!==t._class.indexOf("WidgetArray")?t.content().some(function(t){return t.hasValue()}):t.hasValue()}))},100)})})})}).merge(i).each(function(t,e){const n=a(this);(t instanceof o?t.content():[t]).forEach(function(t,e){n.select("td.prompt").text(t.label()+":")})}),i.each(function(t,e){0===e&&t.setFocus&&t.setFocus()}),i.exit().each(function(t,e){(t instanceof o?t.content():[t]).forEach(function(t,e){t.target(null)})}).remove(),this.tfoot.style("display",this.showSubmit()?"table-footer-group":"none"),this.btntd.attr("colspan",2*this._maxCols),this.allowEmptyRequest()||setTimeout(function(){n._controls[0].disable(!n.allowEmptyRequest()&&!n.inputs().some(function(t){return-1!==t._class.indexOf("WidgetArray")?t.content().some(function(t){return t.hasValue()}):t.hasValue()}))},100)}exit(t,e){this.inputsForEach(t=>t.target(null)),super.exit(t,e)}click(t,e,n){}};e(k,"Form");let w=k;w.prototype._class+=" form_Form",w.prototype.publish("validate",!0,"boolean","Enable/Disable input validation"),w.prototype.publish("inputs",[],"widgetArray","Array of input widgets",null,{render:!1}),w.prototype.publish("showSubmit",!0,"boolean","Show Submit/Cancel Controls"),w.prototype.publish("omitBlank",!1,"boolean","Drop Blank Fields From Submit"),w.prototype.publish("allowEmptyRequest",!1,"boolean","Allow Blank Form to be Submitted");const R=class _Input extends i{_inputElement=[];_labelElement=[];constructor(){super(),n.call(this),this._tag="div"}checked(t){return arguments.length?(this._inputElement[0]&&this._inputElement[0].property("checked",t),this):!!this._inputElement[0]&&this._inputElement[0].property("checked")}enter(t,e){super.enter(t,e),this._labelElement[0]=e.append("label").attr("for",this.id()+"_input").style("visibility",this.inlineLabel_exists()?"visible":"hidden");const n=this;switch(this.type()){case"button":this._inputElement[0]=e.append("button").attr("id",this.id()+"_input");break;case"textarea":this._inputElement[0]=e.append("textarea").attr("id",this.id()+"_input");break;default:this._inputElement[0]=e.append("input").attr("id",this.id()+"_input").attr("type",this.type())}this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(e){n.value([t.property("value")]),e.change(e,!0)}),t.on("keyup",function(e){n.value([t.property("value")]),e.change(e,!1)})})}update(t,e){switch(super.update(t,e),this._labelElement[0].style("visibility",this.inlineLabel_exists()?"visible":"hidden").text(this.inlineLabel()),this.type()){case"button":this._inputElement[0].text(this.value());break;case"textarea":this._inputElement[0].property("value",this.value());break;default:this._inputElement[0].attr("type",this.type()),this._inputElement[0].property("value",this.value())}}blur(t){}keyup(t){}focus(t){}click(t){}dblclick(t){}change(t,e){}};e(R,"Input");let S=R;S.prototype._class+=" form_Input",S.prototype.implements(n.prototype),S.prototype.publish("type","text","set","Input type",["string","number","boolean","date","time","hidden","nested","button","checkbox","text","textarea","search","email","datetime"]),S.prototype.publish("inlineLabel",null,"string","Input Label",null,{optional:!0});const P=class _FieldForm extends w{constructor(){super(),this._tag="form"}fields(t){const e=super.fields.apply(this,arguments);if(arguments.length){const e=this.inputsMap();this.inputs(t.map(t=>e[t.id()]||(new S).name(t.id()).label(t.label()).type(t.type())))}return e}data(t){if(!arguments.length)return super.data();if(super.data(t[0]),t[0]){const e=this.inputs(),n=t[0][this.columns().length];let i=0;for(const t in n)e[i].name(t),++i}return this}};e(P,"FieldForm");let O=P;O.prototype._class+=" form_FieldForm";const C=class _InputRange extends i{_inputElement=[];_labelElement=[];_rangeData=[];constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e),this._labelElement[0]=e.append("label").attr("for",this.id()+"_input").style("visibility",this.inlineLabel_exists()?"visible":"hidden"),this._inputElement.push(e.append("input").attr("id",this.id()+"_input_min").attr("type",this.type())),this._inputElement.push(e.append("input").attr("id",this.id()+"_input_max").attr("type",this.type()));const n=this;this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(i){n._rangeData[e]=t.property("value"),n.value(n._rangeData),i.change(i,!0)})})}update(t,e){super.update(t,e),this._labelElement[0].style("visibility",this.inlineLabel_exists()?"visible":"hidden").text(this.inlineLabel()),this._rangeData=this.value(),this._inputElement.forEach(function(t,e){t.attr("type",this.type()).property("value",this._rangeData.length>e?this._rangeData[e]:"")},this)}};e(C,"InputRange");let F=C;F.prototype._class+=" form_InputRange",F.prototype.implements(n.prototype),F.prototype.publish("type","text","set","InputRange type",["number","date","text","time","datetime","hidden"]),F.prototype.publish("inlineLabel",null,"string","InputRange Label",null,{optional:!0}),F.prototype.publish("value",["",""],"array","Input Current Value",null,{override:!0});const L=class _OnOff extends i{_inputElement=[];_input;constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e),e.classed("onoffswitch",!0);const n=this;this._input=e.append("input").attr("class","onoffswitch-checkbox").attr("type","checkbox").attr("id",this.id()+"_onOff").on("click",function(t){t.click(t)}).on("blur",function(t){t.blur(t)}).on("change",function(t){const e=[];n._inputElement.forEach(function(t,n){t.property("checked")&&e.push(t.property("value"))}),n.value(e),t.change(t,!0)});const i=e.append("label").attr("class","onoffswitch-label").attr("for",this.id()+"_onOff"),s=i.append("div").attr("class","onoffswitch-inner");s.append("div").attr("class","onoffswitch-offText").style("padding-right",this.containerRadius()/2+"px").text(this.offText()),s.append("div").attr("class","onoffswitch-onText").style("padding-left",this.containerRadius()/2+"px").style("width",`calc(100% - ${this.containerRadius()/2}px)`).text(this.onText()),i.append("div").attr("class","onoffswitch-switch")}update(t,e){super.update(t,e),this._input.attr("name",this.name()),e.style("margin-left",this.marginLeft()+"px").style("margin-bottom",this.marginBottom()+"px").style("width",this.minWidth()+"px");const n=this.minHeight()-4*this.gutter();e.select(".onoffswitch-switch").style("height",n+"px").style("width",n+"px").style("top",2*this.gutter()+1+"px").style("border-radius",this.switchRadius()+"px"),e.select(".onoffswitch-inner").style("min-height",this.minHeight()+"px"),e.select(".onoffswitch-label").style("border-radius",this.containerRadius()+"px"),e.select(".onoffswitch-offText").style("color",this.offFontColor()).style("background-color",this.offColor()),e.select(".onoffswitch-onText").style("color",this.onFontColor()).style("background-color",this.onColor())}};e(L,"OnOff");let A=L;A.prototype._class+=" form_OnOff",A.prototype.implements(n.prototype),A.prototype.publish("marginLeft",0,"number","Margin left of OnOff"),A.prototype.publish("marginBottom",0,"number","Margin bottom of OnOff"),A.prototype.publish("minWidth",100,"number","Minimum width of OnOff (pixels)"),A.prototype.publish("minHeight",20,"number","Minimum height of OnOff (pixels)"),A.prototype.publish("gutter",1,"number","Space between switch and border of OnOff (pixels)"),A.prototype.publish("onText","Save","string","Text to display when 'ON'"),A.prototype.publish("offText","Properties","string","Text to display when 'OFF'"),A.prototype.publish("switchRadius",10,"number","Border radius of switch (pixels)"),A.prototype.publish("containerRadius",10,"number","Border radius of OnOff (pixels)"),A.prototype.publish("onColor","#2ecc71","html-color","Background color when 'ON'"),A.prototype.publish("offColor","#ecf0f1","html-color","Background color when 'OFF'"),A.prototype.publish("onFontColor","#2c3e50","html-color","Font color when 'ON'"),A.prototype.publish("offFontColor","#7f8c8d","html-color","Font color when 'OFF'");const B=class _Radio extends i{_inputElement=[];constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this,i=e.append("ul");this.selectOptions().length||this.selectOptions().push(""),this.selectOptions().forEach(function(t,e){n._inputElement[e]=i.append("li").append("input").attr("type","radio"),n._inputElement[e].node().insertAdjacentHTML("afterend","<text>"+t+"</text>")}),this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(e){n.value([t.property("value")]),e.change(e,!0)})})}update(t,e){super.update(t,e);const n=this;this._inputElement.forEach(function(t,e){t.property("value",n.selectOptions()[e]),-1!==n.value().indexOf(n.selectOptions()[e])&&"false"!==n.value()?t.property("checked",!0):t.property("checked",!1)})}};e(B,"Radio");let M=B;M.prototype._class+=" form_Radio",M.prototype.implements(n.prototype),M.prototype.publish("selectOptions",[],"array","Array of options used to fill a dropdown list");const H=class _Range extends i{_inputElement=[];constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this;this._inputElement[0]=e.append("input").attr("type","range"),this._inputElement[1]=e.append("input").attr("type","number"),this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(t){0===e?(n._inputElement[1].property("value",s(n._inputElement[0].property("value")).toString()),n.value(n._inputElement[0].property("value"))):(n._inputElement[0].property("value",n._inputElement[1].property("value")),n.value(s(n._inputElement[1].property("value")).toString())),t.change(t,!0)})})}update(t,e){super.update(t,e),this._inputElement[0].attr("type","range"),this._inputElement[0].property("value",this.value()),this._inputElement[0].attr("min",this.low()),this._inputElement[0].attr("max",this.high()),this._inputElement[0].attr("step",this.step()),this._inputElement[1].attr("type","number"),this._inputElement[1].property("value",this.value()),this._inputElement[1].attr("min",this.low()),this._inputElement[1].attr("max",this.high()),this._inputElement[1].attr("step",this.step())}insertSelectOptions(t){let e="";t.length>0?t.forEach(function(t){const n=t instanceof Array?t[0]:t,i=t instanceof Array?t[1]?t[1]:t[0]:t;e+="<option value='"+n+"'>"+i+"</option>"}):e+="<option>selectOptions not set</option>",this._inputElement[0].html(e)}};e(H,"Range");let I=H;I.prototype._class+=" form_Range",I.prototype.implements(n.prototype),I.prototype.publish("type","text","set","Input type",["html-color","number","checkbox","button","select","textarea","date","text","range","search","email","time","datetime"]),I.prototype.publish("selectOptions",[],"array","Array of options used to fill a dropdown list"),I.prototype.publish("low",null,"number","Minimum value for Range input"),I.prototype.publish("high",null,"number","Maximum value for Range input"),I.prototype.publish("step",null,"number","Step value for Range input");const T=class _Select extends i{_inputElement=[];constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this;this._inputElement[0]=e.append("select").attr("name",this.name()).on("click",function(t){t.click(t)}).on("blur",function(t){t.blur(t)}).on("change",function(t){n.value([n._inputElement[0].property("value")]),t.change(t,!0)})}update(t,e){super.update(t,e),this.insertSelectOptions(this.selectOptions()),this._inputElement[0].property("value",this.value()).style("max-width",this.maxWidth_exists()?this.maxWidth()+"px":null)}insertSelectOptions(t){let e="";t.length>0?t.forEach(function(t){const n=t instanceof Array?t[0]:t,i=t instanceof Array?t[1]?t[1]:t[0]:t;e+="<option value='"+n+"'>"+i+"</option>"}):e+="<option>selectOptions not set</option>",this._inputElement[0].html(e)}};e(T,"Select");let V=T;V.prototype._class+=" form_Select",V.prototype.implements(n.prototype),V.prototype.publish("selectOptions",[],"array","Array of options used to fill a dropdown list"),V.prototype.publish("maxWidth",120,"number","Width",null,{optional:!0});const D=class _Slider extends r{xScale;moveMode;moveStartPos;prevValue;slider;handleLeft;handleLeftPos=0;handleLeftStartPos;handleRight;handleRightPos=0;handleRightStartPos;constructor(){super(),n.call(this)}enter(t,e){if(super.enter(t,e),this.resize({width:this.width(),height:50}),this.xScale=p().clamp(!0),this.slider=e.append("g").attr("class","slider"),null===this.low()&&null===this.high()&&null!==this.lowDatetime()&&null!==this.highDatetime()){const t=h(this.timePattern()?this.timePattern():"%Q");this.low(t(this.lowDatetime()).getTime()),this.high(t(this.highDatetime()).getTime())}this.slider.append("line").attr("class","track").select(function(){return this.parentNode.appendChild(this.cloneNode(!0))}).attr("class","track-inset").select(function(){return this.parentNode.appendChild(this.cloneNode(!0))}).attr("class","track-overlay").call(u().on("start",()=>{const t=l();this.moveStartPos=t.x,this.handleLeftStartPos=this.handleLeftPos,this.handleRightStartPos=this.handleRightPos,this.allowRange()&&this.handleLeftPos<=t.x&&t.x<=this.handleRightPos?this.moveMode="both":Math.abs(t.x-this.handleLeftPos)<Math.abs(t.x-this.handleRightPos)?this.moveMode="left":this.moveMode="right",this.moveHandleTo(t.x)}).on("drag",()=>{this.moveHandleTo(l().x)}).on("end",()=>{this.moveHandleTo(l().x),this.data([[this.xScale.invert(this.handleLeftPos),this.xScale.invert(this.handleRightPos)]]),this.checkChangedValue()})),this.slider.insert("g",".track-overlay").attr("class","ticks").attr("transform",`translate(0, ${this.fontSize()+this.tickHeight()/2})`),this.handleRight=this.slider.insert("path",".track-overlay").attr("class","handle"),this.handleLeft=this.slider.insert("path",".track-overlay").attr("class","handle")}update(t,e){super.update(t,e);const n=this;this.xScale.domain([this.low(),this.high()]).range([0,this.width()-2*this.padding()]),this.slider.attr("transform","translate("+(-this.width()/2+this.padding())+",0)"),this.slider.selectAll("line.track,line.track-inset,line.track-overlay").attr("x1",this.xScale.range()[0]).attr("x2",this.xScale.range()[1]);const i=(this.width()-2*this.padding())/(this.tickCount()-1),s=[];if(null!==this.tickDateFormat()&&null!==this.timePattern()){const t=h("%Q"),e=c(this.tickDateFormat()),n=(this.high()-this.low())/(this.tickCount()-1);for(let i=0;i<this.tickCount();i++){const o=t(""+(this.low()+n*i));s.push(e(o))}}else{const t=d(this.tickValueFormat()),e=(this.high()-this.low())/(this.tickCount()-1);for(let n=0;n<this.tickCount();n++){const i=this.low()+e*n;s.push(t(i))}}const o=this.slider.selectAll("g.tick").data(s),l=o.enter().append("g").attr("class","tick");l.append("text").attr("class","tick-text"),l.append("line").attr("class","tick-line"),l.merge(o).each(function(t,e){const s=i*e;a(this).select("text.tick-text").style("font-size",n.fontSize()).attr("x",function(){return 0===e?s-2:e===n.tickCount()-1?s+2:s}).attr("y",n.tickHeight()+n.tickOffset()/2+n.fontSize()).attr("text-basline","text-before-edge").attr("text-anchor",function(){return 0===e?"start":e===n.tickCount()-1?"end":"middle"}).text(()=>t),a(this).select("line.tick-line").attr("x1",s).attr("x2",s).attr("y1",n.tickOffset()-1).attr("y2",n.tickOffset()+n.tickHeight()).style("stroke","#000").style("stroke-width",1)}),this.slider.node().appendChild(this.handleRight.node()),this.slider.node().appendChild(this.handleLeft.node()),this.handleLeftPos=this.lowPos(),this.handleRightPos=this.highPos(),this.updateHandles(),this.checkChangedValue()}checkChangedValue(){this.prevValue!==this.value()&&void 0!==this.prevValue&&this.change(this),this.prevValue=this.value()}updateHandles(){this.handleLeft.attr("transform",`translate(${this.handleLeftPos}, -28)`).attr("d",t=>this.handlePath("l")),this.handleRight.attr("transform",`translate(${this.handleRightPos}, -28)`).attr("d",t=>this.handlePath("r"))}lowPos(){let t=[[this.low(),this.high()]];return this.data().length>0&&"number"==typeof this.data()[0][0]&&"number"==typeof this.data()[0][1]&&(t=this.data()),this.xScale(t[0][0])}highPos(){let t=[[this.low(),this.high()]];return this.data().length>0&&"number"==typeof this.data()[0][0]&&"number"==typeof this.data()[0][1]&&(t=this.data()),this.xScale(t[0][this.allowRange()?1:0])}moveHandleTo(t){if(this.allowRange())switch(this.moveMode){case"both":this.handleLeftPos=this.handleLeftStartPos+t-this.moveStartPos,this.handleRightPos=this.handleRightStartPos+t-this.moveStartPos;break;case"left":this.handleLeftPos=t,this.handleLeftPos>this.handleRightPos&&(this.handleRightPos=this.handleLeftPos);break;case"right":this.handleRightPos=t,this.handleRightPos<this.handleLeftPos&&(this.handleLeftPos=this.handleRightPos)}else this.handleLeftPos=this.handleRightPos=t;this.handleLeftPos=this.constrain(this.handleLeftPos),this.handleRightPos=this.constrain(this.handleRightPos),this.value(this.allowRange()?[this.xScale.invert(this.handleLeftPos),this.xScale.invert(this.handleRightPos)]:this.xScale.invert(this.handleLeftPos)),this.updateHandles()}constrain(t){const e=this.xScale.range();return t<e[0]&&(t=e[0]),t>e[1]&&(t=e[1]),this.nearestStep(t)}nearestStep(t){const e=this.xScale.invert(t);return this.xScale(this.low()+Math.round((e-this.low())/this.step())*this.step())}handlePath=/* @__PURE__ */e(function(t){const e=+("r"===t),n=e?1:-1,i=this.allowRange()?.5:0;let s="M"+i*n+","+"18A6,6 0 0 "+e+" "+6.5*n+",24V30A6,6 0 0 "+e+" "+i*n+",36";return this.allowRange()?s+="ZM"+2.5*n+",26V28M"+4.5*n+",26V28":s+="M"+1*n+",26V28",s},"handlePath")};e(D,"Slider");let W=D;W.prototype._class+=" form_Slider",W.prototype.implements(n.prototype),W.prototype.publish("padding",16,"number","Outer Padding",null,{tags:["Basic"]}),W.prototype.publish("fontSize",12,"number","Font Size",null,{tags:["Basic"]}),W.prototype.publish("fontFamily",null,"string","Font Name",null,{tags:["Basic"]}),W.prototype.publish("fontColor",null,"html-color","Font Color",null,{tags:["Basic"]}),W.prototype.publish("allowRange",!1,"boolean","Allow Range Selection",null,{tags:["Intermediate"]}),W.prototype.publish("low",null,"number","Low",null,{tags:["Intermediate"]}),W.prototype.publish("high",null,"number","High",null,{tags:["Intermediate"]}),W.prototype.publish("step",10,"number","Step",null,{tags:["Intermediate"]}),W.prototype.publish("lowDatetime",null,"string","Low",null,{tags:["Intermediate"]}),W.prototype.publish("highDatetime",null,"string","High",null,{tags:["Intermediate"]}),W.prototype.publish("selectionLabel","","string","Selection Label",null,{tags:["Intermediate"]}),W.prototype.publish("timePattern","%Y-%m-%d","string"),W.prototype.publish("tickCount",10,"number"),W.prototype.publish("tickOffset",5,"number"),W.prototype.publish("tickHeight",8,"number"),W.prototype.publish("tickDateFormat",null,"string"),W.prototype.publish("tickValueFormat",",.0f","string");const z=W.prototype.name;W.prototype.name=function(t){const e=z.apply(this,arguments);if(arguments.length){const e=t instanceof Array?t:[t];r.prototype.columns.call(this,e)}return e};const N=W.prototype.value;W.prototype.value=function(t){const e=N.apply(this,arguments);return arguments.length?(r.prototype.data.call(this,[this.allowRange()?t:[t,t]]),e):this.allowRange()?r.prototype.data.call(this)[0]:r.prototype.data.call(this)[0][0]};const j=class _TextArea extends S{constructor(){super(),this._tag="div",this.type("textarea")}enter(t,e){super.enter(t,e)}calcHeight(){return Math.max(this.minHeight_exists()?this.minHeight():0,this.height())}update(t,e){super.update(t,e),this._inputElement[0].attr("rows",this.rows()).attr("cols",this.cols()).attr("wrap",this.wrap()).attr("spellcheck",this.spellcheck()).style("height",this.calcHeight()+"px")}};e(j,"TextArea");let q=j;q.prototype._class+=" form_TextArea",q.prototype.publish("rows",null,"number","Rows",null,{optional:!0}),q.prototype.publish("cols",null,"number","Columns",null,{optional:!0}),q.prototype.publish("wrap","off","set","Wrap",["off","on"]),q.prototype.publish("minHeight",null,"number","Minimum Height",null,{optional:!0}),q.prototype.publish("spellcheck",null,"boolean","Input spell checking",{optional:!0});export{y as BUILD_VERSION,b as Button,v as CheckBox,E as ColorInput,O as FieldForm,w as Form,S as Input,F as InputRange,A as OnOff,m as PKG_NAME,f as PKG_VERSION,M as Radio,I as Range,V as Select,W as Slider,q as TextArea};
2
2
  //# sourceMappingURL=index.js.map
3
3
  !function(){"use strict";try{if("undefined"!=typeof document){var o=document.createElement("style");o.appendChild(document.createTextNode(".form_Input input,.form_Input select,.form_Input button,.form_Input textarea{padding:2px}.form_Input button{cursor:pointer}.form_Input input.color-text{width:120px}.form_Input input.color-text+input{width:57px;position:absolute}.form_Input textarea,.form_Input input[type=textbox]{width:100%;box-sizing:border-box;display:block}.form_Input ul{list-style-type:none;float:left;padding:0;margin:0}.form_Input li{float:left;list-style-position:inside}.form_Form{color:#404040}.form_Form tbody td{white-space:nowrap;border:1px solid #E5E5E5}.form_Form td.prompt{padding:2px;vertical-align:middle;background-color:#e5e5e5}.form_Form td.input{padding:2px;width:100%;vertical-align:middle}.form_Form td.input .common_HTMLWidget ul{margin:0}.form_Form tfoot button{margin:5px}.form_Form tbody tr:hover{background-color:#fafafa}.form_Form .form_Button button{background-position:-1px -1px;box-sizing:border-box;color:#24292e;cursor:pointer;height:28px;inset:0;overflow-wrap:break-word;position:relative;text-decoration:none solid rgb(36,41,46);vertical-align:middle;white-space:nowrap;word-wrap:break-word;column-rule-color:#24292e;perspective-origin:57.2938px 14px;transform-origin:57.2938px 14px;-webkit-user-select:none;user-select:none;background:#eff3f6 linear-gradient(-180deg,#fafbfc,#eff3f6 90%) repeat-x scroll -1px -1px / 110% 110% padding-box border-box;border:1px solid rgba(27,31,35,.2);border-radius:3px;outline:rgb(36,41,46) none 0px;padding:3px 10px}.form_Form .form_Button button[disabled=disabled]{background:#dbdfe2}.form_Form .form_Button button:focus{box-shadow:0 0 0 .2em #0366d64d}.form_Form .form_Button button:hover{background:#dbdfe2}.form_Form .form_Button.default button{color:#fff;text-decoration:none solid rgb(255,255,255);word-wrap:break-word;column-rule-color:#fff;perspective-origin:44.975px 17px;transform-origin:44.975px 17px;background:#28a745 linear-gradient(-180deg,#34d058,#28a745 90%) repeat-x scroll -1px -1px / 110% 110% padding-box border-box;outline:rgb(255,255,255) none 0px}.form_Form .form_Button.default button[disabled=disabled],.form_Form .form_Button.default button[disabled=disabled]:hover{background:#dbdfe2}.form_Form .form_Button.default button:hover{background:#149331}.onoffswitch-checkbox{display:none}.onoffswitch{position:relative;height:20px;width:100px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}.onoffswitch-label{display:block;overflow:hidden;cursor:pointer;border:1px solid #999999;height:20px}.onoffswitch-inner{position:relative;display:block;transition:margin .3s ease-in 0s}.onoffswitch-inner>.onoffswitch-offText,.onoffswitch-inner>.onoffswitch-onText{height:100%}.onoffswitch-inner>.onoffswitch-offText{font-weight:700;position:absolute;right:0;transition:all .3s ease-in 0s;width:100%;text-align:right}.onoffswitch-inner>.onoffswitch-onText{font-weight:700;position:absolute;left:-100%;transition:all .3s ease-in 0s;width:100%;text-align:left}.onoffswitch-switch{display:block;width:20px;margin:-1px;background:#fff;position:absolute;border:1px solid #999999;transition:all .3s ease-in 0s;inset:0 78px 0 4px}.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-inner>.onoffswitch-offText{right:-100%}.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-inner>.onoffswitch-onText{left:0}.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-switch{left:calc(100% - 20px)}.form_Slider .ticks{font:10px sans-serif}.form_Slider .track,.form_Slider .track-inset,.form_Slider .track-overlay{stroke-linecap:round}.form_Slider .track{stroke:#000;stroke-opacity:.3;stroke-width:10px}.form_Slider .track-inset{stroke:#ddd;stroke-width:8px}.form_Slider .track-overlay{pointer-events:stroke;stroke-width:50px;stroke:transparent;cursor:crosshair}.form_Slider .handle{fill:#fff;stroke:#000;stroke-opacity:.5;stroke-width:1.25px}.form_Slider .tick-line{stroke:#000;stroke-opacity:.5;stroke-width:1px;shape-rendering:crispEdges}")),document.head.appendChild(o)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();
@@ -1,3 +1,3 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@hpcc-js/api"),require("@hpcc-js/common")):"function"==typeof define&&define.amd?define(["exports","@hpcc-js/api","@hpcc-js/common"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@hpcc-js/form"]={},t["@hpcc-js/api"],t["@hpcc-js/common"])}(this,function(t,e,n){"use strict";var i=Object.defineProperty,s=(t,e)=>i(t,"name",{value:e,configurable:!0});const o=class _Button extends n.HTMLWidget{_inputElement=[];constructor(){super(),e.IInput.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this;this._inputElement[0]=e.append("button").attr("name",this.name()).on("click",function(t){t.click(t)}).on("blur",function(t){t.blur(t)}).on("change",function(t){n.value([n._inputElement[0].property("value")]),t.change(t,!0)})}update(t,e){super.update(t,e),this._inputElement[0].text(this.value())}};s(o,"Button");let l=o;l.prototype._class+=" form_Button",l.prototype.implements(e.IInput.prototype);const a=class _CheckBox extends n.HTMLWidget{_inputElement=[];constructor(){super(),e.IInput.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this,i=e.append("ul");this.selectOptions().length||this.selectOptions().push(""),this.selectOptions().forEach(function(t,e){n._inputElement[e]=i.append("li").append("input").attr("type","checkbox"),n._inputElement[e].node().insertAdjacentHTML("afterend","<text>"+t+"</text>")}),this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(t){const e=[];n._inputElement.forEach(function(t){t.property("checked")&&e.push(t.property("value"))}),n.value(e),t.change(t,!0)})})}update(t,e){super.update(t,e);const n=this;this._inputElement.forEach(function(t,e){t.property("value",n.selectOptions()[e]),-1!==n.value().indexOf(n.selectOptions()[e])&&"false"!==n.value()?t.property("checked",!0):t.property("checked",!1)})}insertSelectOptions(t){let e="";t.length>0?t.forEach(function(t){const n=t instanceof Array?t[0]:t,i=t instanceof Array?t[1]?t[1]:t[0]:t;e+="<option value='"+n+"'>"+i+"</option>"}):e+="<option>selectOptions not set</option>",this._inputElement[0].html(e)}};s(a,"CheckBox");let r=a;r.prototype._class+=" form_CheckBox",r.prototype.implements(e.IInput.prototype),r.prototype.publish("selectOptions",[],"array","Array of options used to fill a dropdown list");const p=class _ColorInput extends n.HTMLWidget{_inputElement=[];constructor(){super(),e.IInput.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const i=this;this._inputElement[0]=e.append("input").attr("type","text"),this._inputElement[0].classed("color-text",!0),this._inputElement[1]=e.append("input").attr("type","color"),this._inputElement.forEach(function(t,e){t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(t){0===e?(i._inputElement[1].property("value",n.rgb(i._inputElement[0].property("value")).toString()),i.value(i._inputElement[0].property("value"))):(i._inputElement[0].property("value",i._inputElement[1].property("value")),i.value(n.rgb(i._inputElement[1].property("value")).toString())),t.change(t,!0)})})}update(t,e){super.update(t,e);const i=this;this._inputElement.forEach(function(t){t.attr("name",i.name())}),this._inputElement[0].attr("type","text"),this._inputElement[1].attr("type","color"),this._inputElement[0].property("value",this.value()),this._inputElement[1].property("value",n.rgb(this.value()).toString());const s=this._inputElement[0].node().getBoundingClientRect();this._inputElement[1].style("height",s.height-2+"px")}};s(p,"ColorInput");let h=p;h.prototype._class+=" form_ColorInput",h.prototype.implements(e.IInput.prototype);const u=class _Form extends n.HTMLWidget{tbody;tfoot;btntd;_controls;_maxCols;constructor(){super(),this._tag="form"}data(t){if(!arguments.length){const t=[];return this.inputsForEach(function(e){t.push(e.value())}),t}return this.inputsForEach(function(e,n){t&&t.length>n&&e.value(t[n]).render()}),this}inputsForEach(t,e){let i=0;this.inputs().forEach(function(s){(s instanceof n.WidgetArray?s.content():[s]).forEach(function(n){e?t.call(e,n,i++):t(n,i++)})})}inputsMap(){const t={};return this.inputs().forEach(function(e){t[e.name()]=e}),t}calcMaxColumns(){let t=0;return this.inputs().forEach(function(e){const i=e instanceof n.WidgetArray?e.content():[e];i.length>t&&(t=i.length)}),t}values(t){if(!arguments.length){const t={};return this.inputsForEach(function(e){const n=e.type?e.type():"text";if(e.value()||!this.omitBlank())switch(n){case"checkbox":t[e.name()]=e.value_exists()?!!e.value():void 0;break;case"number":const n=e.value();t[e.name()]=""===n?void 0:+n;break;default:t[e.name()]=e.value_exists()?e.value():void 0}},this),t}return this.inputsForEach(function(e){t[e.name()]?e.value(t[e.name()]):this.omitBlank()&&e.value("")},this),this}submit(){let t=!0;this.validate()&&(t=this.checkValidation()),(this.allowEmptyRequest()||this.inputs().some(function(t){return-1!==t._class.indexOf("WidgetArray")?t.content().some(function(t){return t.hasValue()}):t.hasValue()}))&&this.click(t?this.values():null,null,t)}clear(){this.inputsForEach(function(t){switch(t.classID()){case"form_Slider":t.allowRange()?t.value([t.low(),t.low()]).render():t.value(t.low()).render();break;case"form_CheckBox":t.value(!1).render();break;case"form_Button":break;default:t.value(void 0).render()}})}checkValidation(){let t=!0;const e=[];return this.inputsForEach(function(t){t.isValid()||e.push("'"+t.label()+"' value is invalid.")}),e.length>0&&(alert(e.join("\n")),t=!1),t}enter(t,e){super.enter(t,e),e.on("submit",function(){n.d3Event().preventDefault()}),this._placeholderElement.style("overflow","auto");const i=e.append("table");this.tbody=i.append("tbody"),this.tfoot=i.append("tfoot"),this.btntd=this.tfoot.append("tr").append("td").attr("colspan",2);const s=this;this._controls=[(new l).classed({default:!0}).value("Submit").on("click",function(){s.submit()},!0),(new l).value("Clear").on("click",function(){s.clear()},!0)];const o=s.btntd.append("div").style("float","right");this._controls.forEach(function(t){const e=o.append("span").style("float","left");t.target(e.node()).render()})}update(t,e){super.update(t,e),this._maxCols=this.calcMaxColumns();const i=this,s=this.tbody.selectAll("tr").data(this.inputs());s.enter().append("tr").each(function(t,e){const s=n.select(this),o=t instanceof n.WidgetArray?t.content():[t];o.forEach(function(t,e){s.append("td").attr("class","prompt");const l=s.append("td").attr("class","input");if(e===o.length-1&&o.length<i._maxCols&&l.attr("colspan",2*(i._maxCols-o.length+1)),t.target(l.node()).render(),t instanceof n.SVGWidget){const e=t.element().node().getBBox();l.style("height",e.height+"px"),t.resize().render()}t._inputElement instanceof Array&&t._inputElement.forEach(function(t){t.on("keyup.form",function(t){setTimeout(function(){i._controls[0].disable(!i.allowEmptyRequest()&&!i.inputs().some(function(t){return-1!==t._class.indexOf("WidgetArray")?t.content().some(function(t){return t.hasValue()}):t.hasValue()}))},100)})})})}).merge(s).each(function(t,e){const i=n.select(this);(t instanceof n.WidgetArray?t.content():[t]).forEach(function(t,e){i.select("td.prompt").text(t.label()+":")})}),s.each(function(t,e){0===e&&t.setFocus&&t.setFocus()}),s.exit().each(function(t,e){(t instanceof n.WidgetArray?t.content():[t]).forEach(function(t,e){t.target(null)})}).remove(),this.tfoot.style("display",this.showSubmit()?"table-footer-group":"none"),this.btntd.attr("colspan",2*this._maxCols),this.allowEmptyRequest()||setTimeout(function(){i._controls[0].disable(!i.allowEmptyRequest()&&!i.inputs().some(function(t){return-1!==t._class.indexOf("WidgetArray")?t.content().some(function(t){return t.hasValue()}):t.hasValue()}))},100)}exit(t,e){this.inputsForEach(t=>t.target(null)),super.exit(t,e)}click(t,e,n){}};s(u,"Form");let c=u;c.prototype._class+=" form_Form",c.prototype.publish("validate",!0,"boolean","Enable/Disable input validation"),c.prototype.publish("inputs",[],"widgetArray","Array of input widgets",null,{render:!1}),c.prototype.publish("showSubmit",!0,"boolean","Show Submit/Cancel Controls"),c.prototype.publish("omitBlank",!1,"boolean","Drop Blank Fields From Submit"),c.prototype.publish("allowEmptyRequest",!1,"boolean","Allow Blank Form to be Submitted");const d=class _Input extends n.HTMLWidget{_inputElement=[];_labelElement=[];constructor(){super(),e.IInput.call(this),this._tag="div"}checked(t){return arguments.length?(this._inputElement[0]&&this._inputElement[0].property("checked",t),this):!!this._inputElement[0]&&this._inputElement[0].property("checked")}enter(t,e){super.enter(t,e),this._labelElement[0]=e.append("label").attr("for",this.id()+"_input").style("visibility",this.inlineLabel_exists()?"visible":"hidden");const n=this;switch(this.type()){case"button":this._inputElement[0]=e.append("button").attr("id",this.id()+"_input");break;case"textarea":this._inputElement[0]=e.append("textarea").attr("id",this.id()+"_input");break;default:this._inputElement[0]=e.append("input").attr("id",this.id()+"_input").attr("type",this.type())}this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(e){n.value([t.property("value")]),e.change(e,!0)}),t.on("keyup",function(e){n.value([t.property("value")]),e.change(e,!1)})})}update(t,e){switch(super.update(t,e),this._labelElement[0].style("visibility",this.inlineLabel_exists()?"visible":"hidden").text(this.inlineLabel()),this.type()){case"button":this._inputElement[0].text(this.value());break;case"textarea":this._inputElement[0].property("value",this.value());break;default:this._inputElement[0].attr("type",this.type()),this._inputElement[0].property("value",this.value())}}blur(t){}keyup(t){}focus(t){}click(t){}dblclick(t){}change(t,e){}};s(d,"Input");let m=d;m.prototype._class+=" form_Input",m.prototype.implements(e.IInput.prototype),m.prototype.publish("type","text","set","Input type",["string","number","boolean","date","time","hidden","nested","button","checkbox","text","textarea","search","email","datetime"]),m.prototype.publish("inlineLabel",null,"string","Input Label",null,{optional:!0});const f=class _FieldForm extends c{constructor(){super(),this._tag="form"}fields(t){const e=super.fields.apply(this,arguments);if(arguments.length){const e=this.inputsMap();this.inputs(t.map(t=>e[t.id()]||(new m).name(t.id()).label(t.label()).type(t.type())))}return e}data(t){if(!arguments.length)return super.data();if(super.data(t[0]),t[0]){const e=this.inputs(),n=t[0][this.columns().length];let i=0;for(const t in n)e[i].name(t),++i}return this}};s(f,"FieldForm");let g=f;g.prototype._class+=" form_FieldForm";const y=class _InputRange extends n.HTMLWidget{_inputElement=[];_labelElement=[];_rangeData=[];constructor(){super(),e.IInput.call(this),this._tag="div"}enter(t,e){super.enter(t,e),this._labelElement[0]=e.append("label").attr("for",this.id()+"_input").style("visibility",this.inlineLabel_exists()?"visible":"hidden"),this._inputElement.push(e.append("input").attr("id",this.id()+"_input_min").attr("type",this.type())),this._inputElement.push(e.append("input").attr("id",this.id()+"_input_max").attr("type",this.type()));const n=this;this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(i){n._rangeData[e]=t.property("value"),n.value(n._rangeData),i.change(i,!0)})})}update(t,e){super.update(t,e),this._labelElement[0].style("visibility",this.inlineLabel_exists()?"visible":"hidden").text(this.inlineLabel()),this._rangeData=this.value(),this._inputElement.forEach(function(t,e){t.attr("type",this.type()).property("value",this._rangeData.length>e?this._rangeData[e]:"")},this)}};s(y,"InputRange");let b=y;b.prototype._class+=" form_InputRange",b.prototype.implements(e.IInput.prototype),b.prototype.publish("type","text","set","InputRange type",["number","date","text","time","datetime","hidden"]),b.prototype.publish("inlineLabel",null,"string","InputRange Label",null,{optional:!0}),b.prototype.publish("value",["",""],"array","Input Current Value",null,{override:!0});const _=class _OnOff extends n.HTMLWidget{_inputElement=[];_input;constructor(){super(),e.IInput.call(this),this._tag="div"}enter(t,e){super.enter(t,e),e.classed("onoffswitch",!0);const n=this;this._input=e.append("input").attr("class","onoffswitch-checkbox").attr("type","checkbox").attr("id",this.id()+"_onOff").on("click",function(t){t.click(t)}).on("blur",function(t){t.blur(t)}).on("change",function(t){const e=[];n._inputElement.forEach(function(t,n){t.property("checked")&&e.push(t.property("value"))}),n.value(e),t.change(t,!0)});const i=e.append("label").attr("class","onoffswitch-label").attr("for",this.id()+"_onOff"),s=i.append("div").attr("class","onoffswitch-inner");s.append("div").attr("class","onoffswitch-offText").style("padding-right",this.containerRadius()/2+"px").text(this.offText()),s.append("div").attr("class","onoffswitch-onText").style("padding-left",this.containerRadius()/2+"px").style("width",`calc(100% - ${this.containerRadius()/2}px)`).text(this.onText()),i.append("div").attr("class","onoffswitch-switch")}update(t,e){super.update(t,e),this._input.attr("name",this.name()),e.style("margin-left",this.marginLeft()+"px").style("margin-bottom",this.marginBottom()+"px").style("width",this.minWidth()+"px");const n=this.minHeight()-4*this.gutter();e.select(".onoffswitch-switch").style("height",n+"px").style("width",n+"px").style("top",2*this.gutter()+1+"px").style("border-radius",this.switchRadius()+"px"),e.select(".onoffswitch-inner").style("min-height",this.minHeight()+"px"),e.select(".onoffswitch-label").style("border-radius",this.containerRadius()+"px"),e.select(".onoffswitch-offText").style("color",this.offFontColor()).style("background-color",this.offColor()),e.select(".onoffswitch-onText").style("color",this.onFontColor()).style("background-color",this.onColor())}};s(_,"OnOff");let v=_;v.prototype._class+=" form_OnOff",v.prototype.implements(e.IInput.prototype),v.prototype.publish("marginLeft",0,"number","Margin left of OnOff"),v.prototype.publish("marginBottom",0,"number","Margin bottom of OnOff"),v.prototype.publish("minWidth",100,"number","Minimum width of OnOff (pixels)"),v.prototype.publish("minHeight",20,"number","Minimum height of OnOff (pixels)"),v.prototype.publish("gutter",1,"number","Space between switch and border of OnOff (pixels)"),v.prototype.publish("onText","Save","string","Text to display when 'ON'"),v.prototype.publish("offText","Properties","string","Text to display when 'OFF'"),v.prototype.publish("switchRadius",10,"number","Border radius of switch (pixels)"),v.prototype.publish("containerRadius",10,"number","Border radius of OnOff (pixels)"),v.prototype.publish("onColor","#2ecc71","html-color","Background color when 'ON'"),v.prototype.publish("offColor","#ecf0f1","html-color","Background color when 'OFF'"),v.prototype.publish("onFontColor","#2c3e50","html-color","Font color when 'ON'"),v.prototype.publish("offFontColor","#7f8c8d","html-color","Font color when 'OFF'");const x=class _Radio extends n.HTMLWidget{_inputElement=[];constructor(){super(),e.IInput.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this,i=e.append("ul");this.selectOptions().length||this.selectOptions().push(""),this.selectOptions().forEach(function(t,e){n._inputElement[e]=i.append("li").append("input").attr("type","radio"),n._inputElement[e].node().insertAdjacentHTML("afterend","<text>"+t+"</text>")}),this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(e){n.value([t.property("value")]),e.change(e,!0)})})}update(t,e){super.update(t,e);const n=this;this._inputElement.forEach(function(t,e){t.property("value",n.selectOptions()[e]),-1!==n.value().indexOf(n.selectOptions()[e])&&"false"!==n.value()?t.property("checked",!0):t.property("checked",!1)})}};s(x,"Radio");let E=x;E.prototype._class+=" form_Radio",E.prototype.implements(e.IInput.prototype),E.prototype.publish("selectOptions",[],"array","Array of options used to fill a dropdown list");const k=class _Range extends n.HTMLWidget{_inputElement=[];constructor(){super(),e.IInput.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const i=this;this._inputElement[0]=e.append("input").attr("type","range"),this._inputElement[1]=e.append("input").attr("type","number"),this._inputElement.forEach(function(t,e){t.attr("name",i.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(t){0===e?(i._inputElement[1].property("value",n.rgb(i._inputElement[0].property("value")).toString()),i.value(i._inputElement[0].property("value"))):(i._inputElement[0].property("value",i._inputElement[1].property("value")),i.value(n.rgb(i._inputElement[1].property("value")).toString())),t.change(t,!0)})})}update(t,e){super.update(t,e),this._inputElement[0].attr("type","range"),this._inputElement[0].property("value",this.value()),this._inputElement[0].attr("min",this.low()),this._inputElement[0].attr("max",this.high()),this._inputElement[0].attr("step",this.step()),this._inputElement[1].attr("type","number"),this._inputElement[1].property("value",this.value()),this._inputElement[1].attr("min",this.low()),this._inputElement[1].attr("max",this.high()),this._inputElement[1].attr("step",this.step())}insertSelectOptions(t){let e="";t.length>0?t.forEach(function(t){const n=t instanceof Array?t[0]:t,i=t instanceof Array?t[1]?t[1]:t[0]:t;e+="<option value='"+n+"'>"+i+"</option>"}):e+="<option>selectOptions not set</option>",this._inputElement[0].html(e)}};s(k,"Range");let w=k;w.prototype._class+=" form_Range",w.prototype.implements(e.IInput.prototype),w.prototype.publish("type","text","set","Input type",["html-color","number","checkbox","button","select","textarea","date","text","range","search","email","time","datetime"]),w.prototype.publish("selectOptions",[],"array","Array of options used to fill a dropdown list"),w.prototype.publish("low",null,"number","Minimum value for Range input"),w.prototype.publish("high",null,"number","Maximum value for Range input"),w.prototype.publish("step",null,"number","Step value for Range input");const S=class _Select extends n.HTMLWidget{_inputElement=[];constructor(){super(),e.IInput.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this;this._inputElement[0]=e.append("select").attr("name",this.name()).on("click",function(t){t.click(t)}).on("blur",function(t){t.blur(t)}).on("change",function(t){n.value([n._inputElement[0].property("value")]),t.change(t,!0)})}update(t,e){super.update(t,e),this.insertSelectOptions(this.selectOptions()),this._inputElement[0].property("value",this.value()).style("max-width",this.maxWidth_exists()?this.maxWidth()+"px":null)}insertSelectOptions(t){let e="";t.length>0?t.forEach(function(t){const n=t instanceof Array?t[0]:t,i=t instanceof Array?t[1]?t[1]:t[0]:t;e+="<option value='"+n+"'>"+i+"</option>"}):e+="<option>selectOptions not set</option>",this._inputElement[0].html(e)}};s(S,"Select");let I=S;I.prototype._class+=" form_Select",I.prototype.implements(e.IInput.prototype),I.prototype.publish("selectOptions",[],"array","Array of options used to fill a dropdown list"),I.prototype.publish("maxWidth",120,"number","Width",null,{optional:!0});const R=class _Slider extends n.SVGWidget{xScale;moveMode;moveStartPos;prevValue;slider;handleLeft;handleLeftPos=0;handleLeftStartPos;handleRight;handleRightPos=0;handleRightStartPos;constructor(){super(),e.IInput.call(this)}enter(t,e){if(super.enter(t,e),this.resize({width:this.width(),height:50}),this.xScale=n.scaleLinear().clamp(!0),this.slider=e.append("g").attr("class","slider"),null===this.low()&&null===this.high()&&null!==this.lowDatetime()&&null!==this.highDatetime()){const t=n.timeParse(this.timePattern()?this.timePattern():"%Q");this.low(t(this.lowDatetime()).getTime()),this.high(t(this.highDatetime()).getTime())}this.slider.append("line").attr("class","track").select(function(){return this.parentNode.appendChild(this.cloneNode(!0))}).attr("class","track-inset").select(function(){return this.parentNode.appendChild(this.cloneNode(!0))}).attr("class","track-overlay").call(n.drag().on("start",()=>{const t=n.d3Event();this.moveStartPos=t.x,this.handleLeftStartPos=this.handleLeftPos,this.handleRightStartPos=this.handleRightPos,this.allowRange()&&this.handleLeftPos<=t.x&&t.x<=this.handleRightPos?this.moveMode="both":Math.abs(t.x-this.handleLeftPos)<Math.abs(t.x-this.handleRightPos)?this.moveMode="left":this.moveMode="right",this.moveHandleTo(t.x)}).on("drag",()=>{this.moveHandleTo(n.d3Event().x)}).on("end",()=>{this.moveHandleTo(n.d3Event().x),this.data([[this.xScale.invert(this.handleLeftPos),this.xScale.invert(this.handleRightPos)]]),this.checkChangedValue()})),this.slider.insert("g",".track-overlay").attr("class","ticks").attr("transform",`translate(0, ${this.fontSize()+this.tickHeight()/2})`),this.handleRight=this.slider.insert("path",".track-overlay").attr("class","handle"),this.handleLeft=this.slider.insert("path",".track-overlay").attr("class","handle")}update(t,e){super.update(t,e);const i=this;this.xScale.domain([this.low(),this.high()]).range([0,this.width()-2*this.padding()]),this.slider.attr("transform","translate("+(-this.width()/2+this.padding())+",0)"),this.slider.selectAll("line.track,line.track-inset,line.track-overlay").attr("x1",this.xScale.range()[0]).attr("x2",this.xScale.range()[1]);const s=(this.width()-2*this.padding())/(this.tickCount()-1),o=[];if(null!==this.tickDateFormat()&&null!==this.timePattern()){const t=n.timeParse("%Q"),e=n.timeFormat(this.tickDateFormat()),i=(this.high()-this.low())/(this.tickCount()-1);for(let n=0;n<this.tickCount();n++){const s=t(""+(this.low()+i*n));o.push(e(s))}}else{const t=n.format(this.tickValueFormat()),e=(this.high()-this.low())/(this.tickCount()-1);for(let n=0;n<this.tickCount();n++){const i=this.low()+e*n;o.push(t(i))}}const l=this.slider.selectAll("g.tick").data(o),a=l.enter().append("g").attr("class","tick");a.append("text").attr("class","tick-text"),a.append("line").attr("class","tick-line"),a.merge(l).each(function(t,e){const o=s*e;n.select(this).select("text.tick-text").style("font-size",i.fontSize()).attr("x",function(){return 0===e?o-2:e===i.tickCount()-1?o+2:o}).attr("y",i.tickHeight()+i.tickOffset()/2+i.fontSize()).attr("text-basline","text-before-edge").attr("text-anchor",function(){return 0===e?"start":e===i.tickCount()-1?"end":"middle"}).text(()=>t),n.select(this).select("line.tick-line").attr("x1",o).attr("x2",o).attr("y1",i.tickOffset()-1).attr("y2",i.tickOffset()+i.tickHeight()).style("stroke","#000").style("stroke-width",1)}),this.slider.node().appendChild(this.handleRight.node()),this.slider.node().appendChild(this.handleLeft.node()),this.handleLeftPos=this.lowPos(),this.handleRightPos=this.highPos(),this.updateHandles(),this.checkChangedValue()}checkChangedValue(){this.prevValue!==this.value()&&void 0!==this.prevValue&&this.change(this),this.prevValue=this.value()}updateHandles(){this.handleLeft.attr("transform",`translate(${this.handleLeftPos}, -28)`).attr("d",t=>this.handlePath("l")),this.handleRight.attr("transform",`translate(${this.handleRightPos}, -28)`).attr("d",t=>this.handlePath("r"))}lowPos(){let t=[[this.low(),this.high()]];return this.data().length>0&&"number"==typeof this.data()[0][0]&&"number"==typeof this.data()[0][1]&&(t=this.data()),this.xScale(t[0][0])}highPos(){let t=[[this.low(),this.high()]];return this.data().length>0&&"number"==typeof this.data()[0][0]&&"number"==typeof this.data()[0][1]&&(t=this.data()),this.xScale(t[0][this.allowRange()?1:0])}moveHandleTo(t){if(this.allowRange())switch(this.moveMode){case"both":this.handleLeftPos=this.handleLeftStartPos+t-this.moveStartPos,this.handleRightPos=this.handleRightStartPos+t-this.moveStartPos;break;case"left":this.handleLeftPos=t,this.handleLeftPos>this.handleRightPos&&(this.handleRightPos=this.handleLeftPos);break;case"right":this.handleRightPos=t,this.handleRightPos<this.handleLeftPos&&(this.handleLeftPos=this.handleRightPos)}else this.handleLeftPos=this.handleRightPos=t;this.handleLeftPos=this.constrain(this.handleLeftPos),this.handleRightPos=this.constrain(this.handleRightPos),this.value(this.allowRange()?[this.xScale.invert(this.handleLeftPos),this.xScale.invert(this.handleRightPos)]:this.xScale.invert(this.handleLeftPos)),this.updateHandles()}constrain(t){const e=this.xScale.range();return t<e[0]&&(t=e[0]),t>e[1]&&(t=e[1]),this.nearestStep(t)}nearestStep(t){const e=this.xScale.invert(t);return this.xScale(this.low()+Math.round((e-this.low())/this.step())*this.step())}handlePath=s(function(t){const e=+("r"===t),n=e?1:-1,i=this.allowRange()?.5:0;let s="M"+i*n+","+"18A6,6 0 0 "+e+" "+6.5*n+",24V30A6,6 0 0 "+e+" "+i*n+",36";return this.allowRange()?s+="ZM"+2.5*n+",26V28M"+4.5*n+",26V28":s+="M"+1*n+",26V28",s},"handlePath")};s(R,"Slider");let P=R;P.prototype._class+=" form_Slider",P.prototype.implements(e.IInput.prototype),P.prototype.publish("padding",16,"number","Outer Padding",null,{tags:["Basic"]}),P.prototype.publish("fontSize",12,"number","Font Size",null,{tags:["Basic"]}),P.prototype.publish("fontFamily",null,"string","Font Name",null,{tags:["Basic"]}),P.prototype.publish("fontColor",null,"html-color","Font Color",null,{tags:["Basic"]}),P.prototype.publish("allowRange",!1,"boolean","Allow Range Selection",null,{tags:["Intermediate"]}),P.prototype.publish("low",null,"number","Low",null,{tags:["Intermediate"]}),P.prototype.publish("high",null,"number","High",null,{tags:["Intermediate"]}),P.prototype.publish("step",10,"number","Step",null,{tags:["Intermediate"]}),P.prototype.publish("lowDatetime",null,"string","Low",null,{tags:["Intermediate"]}),P.prototype.publish("highDatetime",null,"string","High",null,{tags:["Intermediate"]}),P.prototype.publish("selectionLabel","","string","Selection Label",null,{tags:["Intermediate"]}),P.prototype.publish("timePattern","%Y-%m-%d","string"),P.prototype.publish("tickCount",10,"number"),P.prototype.publish("tickOffset",5,"number"),P.prototype.publish("tickHeight",8,"number"),P.prototype.publish("tickDateFormat",null,"string"),P.prototype.publish("tickValueFormat",",.0f","string");const O=P.prototype.name;P.prototype.name=function(t){const e=O.apply(this,arguments);if(arguments.length){const e=t instanceof Array?t:[t];n.SVGWidget.prototype.columns.call(this,e)}return e};const L=P.prototype.value;P.prototype.value=function(t){const e=L.apply(this,arguments);return arguments.length?(n.SVGWidget.prototype.data.call(this,[this.allowRange()?t:[t,t]]),e):this.allowRange()?n.SVGWidget.prototype.data.call(this)[0]:n.SVGWidget.prototype.data.call(this)[0][0]};const C=class _TextArea extends m{constructor(){super(),this._tag="div",this.type("textarea")}enter(t,e){super.enter(t,e)}calcHeight(){return Math.max(this.minHeight_exists()?this.minHeight():0,this.height())}update(t,e){super.update(t,e),this._inputElement[0].attr("rows",this.rows()).attr("cols",this.cols()).attr("wrap",this.wrap()).attr("spellcheck",this.spellcheck()).style("height",this.calcHeight()+"px")}};s(C,"TextArea");let F=C;F.prototype._class+=" form_TextArea",F.prototype.publish("rows",null,"number","Rows",null,{optional:!0}),F.prototype.publish("cols",null,"number","Columns",null,{optional:!0}),F.prototype.publish("wrap","off","set","Wrap",["off","on"]),F.prototype.publish("minHeight",null,"number","Minimum Height",null,{optional:!0}),F.prototype.publish("spellcheck",null,"boolean","Input spell checking",{optional:!0}),t.BUILD_VERSION="3.21.0",t.Button=l,t.CheckBox=r,t.ColorInput=h,t.FieldForm=g,t.Form=c,t.Input=m,t.InputRange=b,t.OnOff=v,t.PKG_NAME="@hpcc-js/form",t.PKG_VERSION="3.4.0",t.Radio=E,t.Range=w,t.Select=I,t.Slider=P,t.TextArea=F,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@hpcc-js/api"),require("@hpcc-js/common")):"function"==typeof define&&define.amd?define(["exports","@hpcc-js/api","@hpcc-js/common"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@hpcc-js/form"]={},t["@hpcc-js/api"],t["@hpcc-js/common"])}(this,function(t,e,n){"use strict";var i=Object.defineProperty,s=(t,e)=>i(t,"name",{value:e,configurable:!0});const o=class _Button extends n.HTMLWidget{_inputElement=[];constructor(){super(),e.IInput.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this;this._inputElement[0]=e.append("button").attr("name",this.name()).on("click",function(t){t.click(t)}).on("blur",function(t){t.blur(t)}).on("change",function(t){n.value([n._inputElement[0].property("value")]),t.change(t,!0)})}update(t,e){super.update(t,e),this._inputElement[0].text(this.value())}};s(o,"Button");let l=o;l.prototype._class+=" form_Button",l.prototype.implements(e.IInput.prototype);const a=class _CheckBox extends n.HTMLWidget{_inputElement=[];constructor(){super(),e.IInput.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this,i=e.append("ul");this.selectOptions().length||this.selectOptions().push(""),this.selectOptions().forEach(function(t,e){n._inputElement[e]=i.append("li").append("input").attr("type","checkbox"),n._inputElement[e].node().insertAdjacentHTML("afterend","<text>"+t+"</text>")}),this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(t){const e=[];n._inputElement.forEach(function(t){t.property("checked")&&e.push(t.property("value"))}),n.value(e),t.change(t,!0)})})}update(t,e){super.update(t,e);const n=this;this._inputElement.forEach(function(t,e){t.property("value",n.selectOptions()[e]),-1!==n.value().indexOf(n.selectOptions()[e])&&"false"!==n.value()?t.property("checked",!0):t.property("checked",!1)})}insertSelectOptions(t){let e="";t.length>0?t.forEach(function(t){const n=t instanceof Array?t[0]:t,i=t instanceof Array?t[1]?t[1]:t[0]:t;e+="<option value='"+n+"'>"+i+"</option>"}):e+="<option>selectOptions not set</option>",this._inputElement[0].html(e)}};s(a,"CheckBox");let r=a;r.prototype._class+=" form_CheckBox",r.prototype.implements(e.IInput.prototype),r.prototype.publish("selectOptions",[],"array","Array of options used to fill a dropdown list");const p=class _ColorInput extends n.HTMLWidget{_inputElement=[];constructor(){super(),e.IInput.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const i=this;this._inputElement[0]=e.append("input").attr("type","text"),this._inputElement[0].classed("color-text",!0),this._inputElement[1]=e.append("input").attr("type","color"),this._inputElement.forEach(function(t,e){t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(t){0===e?(i._inputElement[1].property("value",n.rgb(i._inputElement[0].property("value")).toString()),i.value(i._inputElement[0].property("value"))):(i._inputElement[0].property("value",i._inputElement[1].property("value")),i.value(n.rgb(i._inputElement[1].property("value")).toString())),t.change(t,!0)})})}update(t,e){super.update(t,e);const i=this;this._inputElement.forEach(function(t){t.attr("name",i.name())}),this._inputElement[0].attr("type","text"),this._inputElement[1].attr("type","color"),this._inputElement[0].property("value",this.value()),this._inputElement[1].property("value",n.rgb(this.value()).toString());const s=this._inputElement[0].node().getBoundingClientRect();this._inputElement[1].style("height",s.height-2+"px")}};s(p,"ColorInput");let h=p;h.prototype._class+=" form_ColorInput",h.prototype.implements(e.IInput.prototype);const u=class _Form extends n.HTMLWidget{tbody;tfoot;btntd;_controls;_maxCols;constructor(){super(),this._tag="form"}data(t){if(!arguments.length){const t=[];return this.inputsForEach(function(e){t.push(e.value())}),t}return this.inputsForEach(function(e,n){t&&t.length>n&&e.value(t[n]).render()}),this}inputsForEach(t,e){let i=0;this.inputs().forEach(function(s){(s instanceof n.WidgetArray?s.content():[s]).forEach(function(n){e?t.call(e,n,i++):t(n,i++)})})}inputsMap(){const t={};return this.inputs().forEach(function(e){t[e.name()]=e}),t}calcMaxColumns(){let t=0;return this.inputs().forEach(function(e){const i=e instanceof n.WidgetArray?e.content():[e];i.length>t&&(t=i.length)}),t}values(t){if(!arguments.length){const t={};return this.inputsForEach(function(e){const n=e.type?e.type():"text";if(e.value()||!this.omitBlank())switch(n){case"checkbox":t[e.name()]=e.value_exists()?!!e.value():void 0;break;case"number":const n=e.value();t[e.name()]=""===n?void 0:+n;break;default:t[e.name()]=e.value_exists()?e.value():void 0}},this),t}return this.inputsForEach(function(e){t[e.name()]?e.value(t[e.name()]):this.omitBlank()&&e.value("")},this),this}submit(){let t=!0;this.validate()&&(t=this.checkValidation()),(this.allowEmptyRequest()||this.inputs().some(function(t){return-1!==t._class.indexOf("WidgetArray")?t.content().some(function(t){return t.hasValue()}):t.hasValue()}))&&this.click(t?this.values():null,null,t)}clear(){this.inputsForEach(function(t){switch(t.classID()){case"form_Slider":t.allowRange()?t.value([t.low(),t.low()]).render():t.value(t.low()).render();break;case"form_CheckBox":t.value(!1).render();break;case"form_Button":break;default:t.value(void 0).render()}})}checkValidation(){let t=!0;const e=[];return this.inputsForEach(function(t){t.isValid()||e.push("'"+t.label()+"' value is invalid.")}),e.length>0&&(alert(e.join("\n")),t=!1),t}enter(t,e){super.enter(t,e),e.on("submit",function(){n.d3Event().preventDefault()}),this._placeholderElement.style("overflow","auto");const i=e.append("table");this.tbody=i.append("tbody"),this.tfoot=i.append("tfoot"),this.btntd=this.tfoot.append("tr").append("td").attr("colspan",2);const s=this;this._controls=[(new l).classed({default:!0}).value("Submit").on("click",function(){s.submit()},!0),(new l).value("Clear").on("click",function(){s.clear()},!0)];const o=s.btntd.append("div").style("float","right");this._controls.forEach(function(t){const e=o.append("span").style("float","left");t.target(e.node()).render()})}update(t,e){super.update(t,e),this._maxCols=this.calcMaxColumns();const i=this,s=this.tbody.selectAll("tr").data(this.inputs());s.enter().append("tr").each(function(t,e){const s=n.select(this),o=t instanceof n.WidgetArray?t.content():[t];o.forEach(function(t,e){s.append("td").attr("class","prompt");const l=s.append("td").attr("class","input");if(e===o.length-1&&o.length<i._maxCols&&l.attr("colspan",2*(i._maxCols-o.length+1)),t.target(l.node()).render(),t instanceof n.SVGWidget){const e=t.element().node().getBBox();l.style("height",e.height+"px"),t.resize().render()}t._inputElement instanceof Array&&t._inputElement.forEach(function(t){t.on("keyup.form",function(t){setTimeout(function(){i._controls[0].disable(!i.allowEmptyRequest()&&!i.inputs().some(function(t){return-1!==t._class.indexOf("WidgetArray")?t.content().some(function(t){return t.hasValue()}):t.hasValue()}))},100)})})})}).merge(s).each(function(t,e){const i=n.select(this);(t instanceof n.WidgetArray?t.content():[t]).forEach(function(t,e){i.select("td.prompt").text(t.label()+":")})}),s.each(function(t,e){0===e&&t.setFocus&&t.setFocus()}),s.exit().each(function(t,e){(t instanceof n.WidgetArray?t.content():[t]).forEach(function(t,e){t.target(null)})}).remove(),this.tfoot.style("display",this.showSubmit()?"table-footer-group":"none"),this.btntd.attr("colspan",2*this._maxCols),this.allowEmptyRequest()||setTimeout(function(){i._controls[0].disable(!i.allowEmptyRequest()&&!i.inputs().some(function(t){return-1!==t._class.indexOf("WidgetArray")?t.content().some(function(t){return t.hasValue()}):t.hasValue()}))},100)}exit(t,e){this.inputsForEach(t=>t.target(null)),super.exit(t,e)}click(t,e,n){}};s(u,"Form");let c=u;c.prototype._class+=" form_Form",c.prototype.publish("validate",!0,"boolean","Enable/Disable input validation"),c.prototype.publish("inputs",[],"widgetArray","Array of input widgets",null,{render:!1}),c.prototype.publish("showSubmit",!0,"boolean","Show Submit/Cancel Controls"),c.prototype.publish("omitBlank",!1,"boolean","Drop Blank Fields From Submit"),c.prototype.publish("allowEmptyRequest",!1,"boolean","Allow Blank Form to be Submitted");const d=class _Input extends n.HTMLWidget{_inputElement=[];_labelElement=[];constructor(){super(),e.IInput.call(this),this._tag="div"}checked(t){return arguments.length?(this._inputElement[0]&&this._inputElement[0].property("checked",t),this):!!this._inputElement[0]&&this._inputElement[0].property("checked")}enter(t,e){super.enter(t,e),this._labelElement[0]=e.append("label").attr("for",this.id()+"_input").style("visibility",this.inlineLabel_exists()?"visible":"hidden");const n=this;switch(this.type()){case"button":this._inputElement[0]=e.append("button").attr("id",this.id()+"_input");break;case"textarea":this._inputElement[0]=e.append("textarea").attr("id",this.id()+"_input");break;default:this._inputElement[0]=e.append("input").attr("id",this.id()+"_input").attr("type",this.type())}this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(e){n.value([t.property("value")]),e.change(e,!0)}),t.on("keyup",function(e){n.value([t.property("value")]),e.change(e,!1)})})}update(t,e){switch(super.update(t,e),this._labelElement[0].style("visibility",this.inlineLabel_exists()?"visible":"hidden").text(this.inlineLabel()),this.type()){case"button":this._inputElement[0].text(this.value());break;case"textarea":this._inputElement[0].property("value",this.value());break;default:this._inputElement[0].attr("type",this.type()),this._inputElement[0].property("value",this.value())}}blur(t){}keyup(t){}focus(t){}click(t){}dblclick(t){}change(t,e){}};s(d,"Input");let m=d;m.prototype._class+=" form_Input",m.prototype.implements(e.IInput.prototype),m.prototype.publish("type","text","set","Input type",["string","number","boolean","date","time","hidden","nested","button","checkbox","text","textarea","search","email","datetime"]),m.prototype.publish("inlineLabel",null,"string","Input Label",null,{optional:!0});const f=class _FieldForm extends c{constructor(){super(),this._tag="form"}fields(t){const e=super.fields.apply(this,arguments);if(arguments.length){const e=this.inputsMap();this.inputs(t.map(t=>e[t.id()]||(new m).name(t.id()).label(t.label()).type(t.type())))}return e}data(t){if(!arguments.length)return super.data();if(super.data(t[0]),t[0]){const e=this.inputs(),n=t[0][this.columns().length];let i=0;for(const t in n)e[i].name(t),++i}return this}};s(f,"FieldForm");let g=f;g.prototype._class+=" form_FieldForm";const y=class _InputRange extends n.HTMLWidget{_inputElement=[];_labelElement=[];_rangeData=[];constructor(){super(),e.IInput.call(this),this._tag="div"}enter(t,e){super.enter(t,e),this._labelElement[0]=e.append("label").attr("for",this.id()+"_input").style("visibility",this.inlineLabel_exists()?"visible":"hidden"),this._inputElement.push(e.append("input").attr("id",this.id()+"_input_min").attr("type",this.type())),this._inputElement.push(e.append("input").attr("id",this.id()+"_input_max").attr("type",this.type()));const n=this;this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(i){n._rangeData[e]=t.property("value"),n.value(n._rangeData),i.change(i,!0)})})}update(t,e){super.update(t,e),this._labelElement[0].style("visibility",this.inlineLabel_exists()?"visible":"hidden").text(this.inlineLabel()),this._rangeData=this.value(),this._inputElement.forEach(function(t,e){t.attr("type",this.type()).property("value",this._rangeData.length>e?this._rangeData[e]:"")},this)}};s(y,"InputRange");let b=y;b.prototype._class+=" form_InputRange",b.prototype.implements(e.IInput.prototype),b.prototype.publish("type","text","set","InputRange type",["number","date","text","time","datetime","hidden"]),b.prototype.publish("inlineLabel",null,"string","InputRange Label",null,{optional:!0}),b.prototype.publish("value",["",""],"array","Input Current Value",null,{override:!0});const _=class _OnOff extends n.HTMLWidget{_inputElement=[];_input;constructor(){super(),e.IInput.call(this),this._tag="div"}enter(t,e){super.enter(t,e),e.classed("onoffswitch",!0);const n=this;this._input=e.append("input").attr("class","onoffswitch-checkbox").attr("type","checkbox").attr("id",this.id()+"_onOff").on("click",function(t){t.click(t)}).on("blur",function(t){t.blur(t)}).on("change",function(t){const e=[];n._inputElement.forEach(function(t,n){t.property("checked")&&e.push(t.property("value"))}),n.value(e),t.change(t,!0)});const i=e.append("label").attr("class","onoffswitch-label").attr("for",this.id()+"_onOff"),s=i.append("div").attr("class","onoffswitch-inner");s.append("div").attr("class","onoffswitch-offText").style("padding-right",this.containerRadius()/2+"px").text(this.offText()),s.append("div").attr("class","onoffswitch-onText").style("padding-left",this.containerRadius()/2+"px").style("width",`calc(100% - ${this.containerRadius()/2}px)`).text(this.onText()),i.append("div").attr("class","onoffswitch-switch")}update(t,e){super.update(t,e),this._input.attr("name",this.name()),e.style("margin-left",this.marginLeft()+"px").style("margin-bottom",this.marginBottom()+"px").style("width",this.minWidth()+"px");const n=this.minHeight()-4*this.gutter();e.select(".onoffswitch-switch").style("height",n+"px").style("width",n+"px").style("top",2*this.gutter()+1+"px").style("border-radius",this.switchRadius()+"px"),e.select(".onoffswitch-inner").style("min-height",this.minHeight()+"px"),e.select(".onoffswitch-label").style("border-radius",this.containerRadius()+"px"),e.select(".onoffswitch-offText").style("color",this.offFontColor()).style("background-color",this.offColor()),e.select(".onoffswitch-onText").style("color",this.onFontColor()).style("background-color",this.onColor())}};s(_,"OnOff");let v=_;v.prototype._class+=" form_OnOff",v.prototype.implements(e.IInput.prototype),v.prototype.publish("marginLeft",0,"number","Margin left of OnOff"),v.prototype.publish("marginBottom",0,"number","Margin bottom of OnOff"),v.prototype.publish("minWidth",100,"number","Minimum width of OnOff (pixels)"),v.prototype.publish("minHeight",20,"number","Minimum height of OnOff (pixels)"),v.prototype.publish("gutter",1,"number","Space between switch and border of OnOff (pixels)"),v.prototype.publish("onText","Save","string","Text to display when 'ON'"),v.prototype.publish("offText","Properties","string","Text to display when 'OFF'"),v.prototype.publish("switchRadius",10,"number","Border radius of switch (pixels)"),v.prototype.publish("containerRadius",10,"number","Border radius of OnOff (pixels)"),v.prototype.publish("onColor","#2ecc71","html-color","Background color when 'ON'"),v.prototype.publish("offColor","#ecf0f1","html-color","Background color when 'OFF'"),v.prototype.publish("onFontColor","#2c3e50","html-color","Font color when 'ON'"),v.prototype.publish("offFontColor","#7f8c8d","html-color","Font color when 'OFF'");const x=class _Radio extends n.HTMLWidget{_inputElement=[];constructor(){super(),e.IInput.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this,i=e.append("ul");this.selectOptions().length||this.selectOptions().push(""),this.selectOptions().forEach(function(t,e){n._inputElement[e]=i.append("li").append("input").attr("type","radio"),n._inputElement[e].node().insertAdjacentHTML("afterend","<text>"+t+"</text>")}),this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(e){n.value([t.property("value")]),e.change(e,!0)})})}update(t,e){super.update(t,e);const n=this;this._inputElement.forEach(function(t,e){t.property("value",n.selectOptions()[e]),-1!==n.value().indexOf(n.selectOptions()[e])&&"false"!==n.value()?t.property("checked",!0):t.property("checked",!1)})}};s(x,"Radio");let E=x;E.prototype._class+=" form_Radio",E.prototype.implements(e.IInput.prototype),E.prototype.publish("selectOptions",[],"array","Array of options used to fill a dropdown list");const k=class _Range extends n.HTMLWidget{_inputElement=[];constructor(){super(),e.IInput.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const i=this;this._inputElement[0]=e.append("input").attr("type","range"),this._inputElement[1]=e.append("input").attr("type","number"),this._inputElement.forEach(function(t,e){t.attr("name",i.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(t){0===e?(i._inputElement[1].property("value",n.rgb(i._inputElement[0].property("value")).toString()),i.value(i._inputElement[0].property("value"))):(i._inputElement[0].property("value",i._inputElement[1].property("value")),i.value(n.rgb(i._inputElement[1].property("value")).toString())),t.change(t,!0)})})}update(t,e){super.update(t,e),this._inputElement[0].attr("type","range"),this._inputElement[0].property("value",this.value()),this._inputElement[0].attr("min",this.low()),this._inputElement[0].attr("max",this.high()),this._inputElement[0].attr("step",this.step()),this._inputElement[1].attr("type","number"),this._inputElement[1].property("value",this.value()),this._inputElement[1].attr("min",this.low()),this._inputElement[1].attr("max",this.high()),this._inputElement[1].attr("step",this.step())}insertSelectOptions(t){let e="";t.length>0?t.forEach(function(t){const n=t instanceof Array?t[0]:t,i=t instanceof Array?t[1]?t[1]:t[0]:t;e+="<option value='"+n+"'>"+i+"</option>"}):e+="<option>selectOptions not set</option>",this._inputElement[0].html(e)}};s(k,"Range");let w=k;w.prototype._class+=" form_Range",w.prototype.implements(e.IInput.prototype),w.prototype.publish("type","text","set","Input type",["html-color","number","checkbox","button","select","textarea","date","text","range","search","email","time","datetime"]),w.prototype.publish("selectOptions",[],"array","Array of options used to fill a dropdown list"),w.prototype.publish("low",null,"number","Minimum value for Range input"),w.prototype.publish("high",null,"number","Maximum value for Range input"),w.prototype.publish("step",null,"number","Step value for Range input");const S=class _Select extends n.HTMLWidget{_inputElement=[];constructor(){super(),e.IInput.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this;this._inputElement[0]=e.append("select").attr("name",this.name()).on("click",function(t){t.click(t)}).on("blur",function(t){t.blur(t)}).on("change",function(t){n.value([n._inputElement[0].property("value")]),t.change(t,!0)})}update(t,e){super.update(t,e),this.insertSelectOptions(this.selectOptions()),this._inputElement[0].property("value",this.value()).style("max-width",this.maxWidth_exists()?this.maxWidth()+"px":null)}insertSelectOptions(t){let e="";t.length>0?t.forEach(function(t){const n=t instanceof Array?t[0]:t,i=t instanceof Array?t[1]?t[1]:t[0]:t;e+="<option value='"+n+"'>"+i+"</option>"}):e+="<option>selectOptions not set</option>",this._inputElement[0].html(e)}};s(S,"Select");let I=S;I.prototype._class+=" form_Select",I.prototype.implements(e.IInput.prototype),I.prototype.publish("selectOptions",[],"array","Array of options used to fill a dropdown list"),I.prototype.publish("maxWidth",120,"number","Width",null,{optional:!0});const R=class _Slider extends n.SVGWidget{xScale;moveMode;moveStartPos;prevValue;slider;handleLeft;handleLeftPos=0;handleLeftStartPos;handleRight;handleRightPos=0;handleRightStartPos;constructor(){super(),e.IInput.call(this)}enter(t,e){if(super.enter(t,e),this.resize({width:this.width(),height:50}),this.xScale=n.scaleLinear().clamp(!0),this.slider=e.append("g").attr("class","slider"),null===this.low()&&null===this.high()&&null!==this.lowDatetime()&&null!==this.highDatetime()){const t=n.timeParse(this.timePattern()?this.timePattern():"%Q");this.low(t(this.lowDatetime()).getTime()),this.high(t(this.highDatetime()).getTime())}this.slider.append("line").attr("class","track").select(function(){return this.parentNode.appendChild(this.cloneNode(!0))}).attr("class","track-inset").select(function(){return this.parentNode.appendChild(this.cloneNode(!0))}).attr("class","track-overlay").call(n.drag().on("start",()=>{const t=n.d3Event();this.moveStartPos=t.x,this.handleLeftStartPos=this.handleLeftPos,this.handleRightStartPos=this.handleRightPos,this.allowRange()&&this.handleLeftPos<=t.x&&t.x<=this.handleRightPos?this.moveMode="both":Math.abs(t.x-this.handleLeftPos)<Math.abs(t.x-this.handleRightPos)?this.moveMode="left":this.moveMode="right",this.moveHandleTo(t.x)}).on("drag",()=>{this.moveHandleTo(n.d3Event().x)}).on("end",()=>{this.moveHandleTo(n.d3Event().x),this.data([[this.xScale.invert(this.handleLeftPos),this.xScale.invert(this.handleRightPos)]]),this.checkChangedValue()})),this.slider.insert("g",".track-overlay").attr("class","ticks").attr("transform",`translate(0, ${this.fontSize()+this.tickHeight()/2})`),this.handleRight=this.slider.insert("path",".track-overlay").attr("class","handle"),this.handleLeft=this.slider.insert("path",".track-overlay").attr("class","handle")}update(t,e){super.update(t,e);const i=this;this.xScale.domain([this.low(),this.high()]).range([0,this.width()-2*this.padding()]),this.slider.attr("transform","translate("+(-this.width()/2+this.padding())+",0)"),this.slider.selectAll("line.track,line.track-inset,line.track-overlay").attr("x1",this.xScale.range()[0]).attr("x2",this.xScale.range()[1]);const s=(this.width()-2*this.padding())/(this.tickCount()-1),o=[];if(null!==this.tickDateFormat()&&null!==this.timePattern()){const t=n.timeParse("%Q"),e=n.timeFormat(this.tickDateFormat()),i=(this.high()-this.low())/(this.tickCount()-1);for(let n=0;n<this.tickCount();n++){const s=t(""+(this.low()+i*n));o.push(e(s))}}else{const t=n.format(this.tickValueFormat()),e=(this.high()-this.low())/(this.tickCount()-1);for(let n=0;n<this.tickCount();n++){const i=this.low()+e*n;o.push(t(i))}}const l=this.slider.selectAll("g.tick").data(o),a=l.enter().append("g").attr("class","tick");a.append("text").attr("class","tick-text"),a.append("line").attr("class","tick-line"),a.merge(l).each(function(t,e){const o=s*e;n.select(this).select("text.tick-text").style("font-size",i.fontSize()).attr("x",function(){return 0===e?o-2:e===i.tickCount()-1?o+2:o}).attr("y",i.tickHeight()+i.tickOffset()/2+i.fontSize()).attr("text-basline","text-before-edge").attr("text-anchor",function(){return 0===e?"start":e===i.tickCount()-1?"end":"middle"}).text(()=>t),n.select(this).select("line.tick-line").attr("x1",o).attr("x2",o).attr("y1",i.tickOffset()-1).attr("y2",i.tickOffset()+i.tickHeight()).style("stroke","#000").style("stroke-width",1)}),this.slider.node().appendChild(this.handleRight.node()),this.slider.node().appendChild(this.handleLeft.node()),this.handleLeftPos=this.lowPos(),this.handleRightPos=this.highPos(),this.updateHandles(),this.checkChangedValue()}checkChangedValue(){this.prevValue!==this.value()&&void 0!==this.prevValue&&this.change(this),this.prevValue=this.value()}updateHandles(){this.handleLeft.attr("transform",`translate(${this.handleLeftPos}, -28)`).attr("d",t=>this.handlePath("l")),this.handleRight.attr("transform",`translate(${this.handleRightPos}, -28)`).attr("d",t=>this.handlePath("r"))}lowPos(){let t=[[this.low(),this.high()]];return this.data().length>0&&"number"==typeof this.data()[0][0]&&"number"==typeof this.data()[0][1]&&(t=this.data()),this.xScale(t[0][0])}highPos(){let t=[[this.low(),this.high()]];return this.data().length>0&&"number"==typeof this.data()[0][0]&&"number"==typeof this.data()[0][1]&&(t=this.data()),this.xScale(t[0][this.allowRange()?1:0])}moveHandleTo(t){if(this.allowRange())switch(this.moveMode){case"both":this.handleLeftPos=this.handleLeftStartPos+t-this.moveStartPos,this.handleRightPos=this.handleRightStartPos+t-this.moveStartPos;break;case"left":this.handleLeftPos=t,this.handleLeftPos>this.handleRightPos&&(this.handleRightPos=this.handleLeftPos);break;case"right":this.handleRightPos=t,this.handleRightPos<this.handleLeftPos&&(this.handleLeftPos=this.handleRightPos)}else this.handleLeftPos=this.handleRightPos=t;this.handleLeftPos=this.constrain(this.handleLeftPos),this.handleRightPos=this.constrain(this.handleRightPos),this.value(this.allowRange()?[this.xScale.invert(this.handleLeftPos),this.xScale.invert(this.handleRightPos)]:this.xScale.invert(this.handleLeftPos)),this.updateHandles()}constrain(t){const e=this.xScale.range();return t<e[0]&&(t=e[0]),t>e[1]&&(t=e[1]),this.nearestStep(t)}nearestStep(t){const e=this.xScale.invert(t);return this.xScale(this.low()+Math.round((e-this.low())/this.step())*this.step())}handlePath=s(function(t){const e=+("r"===t),n=e?1:-1,i=this.allowRange()?.5:0;let s="M"+i*n+","+"18A6,6 0 0 "+e+" "+6.5*n+",24V30A6,6 0 0 "+e+" "+i*n+",36";return this.allowRange()?s+="ZM"+2.5*n+",26V28M"+4.5*n+",26V28":s+="M"+1*n+",26V28",s},"handlePath")};s(R,"Slider");let P=R;P.prototype._class+=" form_Slider",P.prototype.implements(e.IInput.prototype),P.prototype.publish("padding",16,"number","Outer Padding",null,{tags:["Basic"]}),P.prototype.publish("fontSize",12,"number","Font Size",null,{tags:["Basic"]}),P.prototype.publish("fontFamily",null,"string","Font Name",null,{tags:["Basic"]}),P.prototype.publish("fontColor",null,"html-color","Font Color",null,{tags:["Basic"]}),P.prototype.publish("allowRange",!1,"boolean","Allow Range Selection",null,{tags:["Intermediate"]}),P.prototype.publish("low",null,"number","Low",null,{tags:["Intermediate"]}),P.prototype.publish("high",null,"number","High",null,{tags:["Intermediate"]}),P.prototype.publish("step",10,"number","Step",null,{tags:["Intermediate"]}),P.prototype.publish("lowDatetime",null,"string","Low",null,{tags:["Intermediate"]}),P.prototype.publish("highDatetime",null,"string","High",null,{tags:["Intermediate"]}),P.prototype.publish("selectionLabel","","string","Selection Label",null,{tags:["Intermediate"]}),P.prototype.publish("timePattern","%Y-%m-%d","string"),P.prototype.publish("tickCount",10,"number"),P.prototype.publish("tickOffset",5,"number"),P.prototype.publish("tickHeight",8,"number"),P.prototype.publish("tickDateFormat",null,"string"),P.prototype.publish("tickValueFormat",",.0f","string");const O=P.prototype.name;P.prototype.name=function(t){const e=O.apply(this,arguments);if(arguments.length){const e=t instanceof Array?t:[t];n.SVGWidget.prototype.columns.call(this,e)}return e};const L=P.prototype.value;P.prototype.value=function(t){const e=L.apply(this,arguments);return arguments.length?(n.SVGWidget.prototype.data.call(this,[this.allowRange()?t:[t,t]]),e):this.allowRange()?n.SVGWidget.prototype.data.call(this)[0]:n.SVGWidget.prototype.data.call(this)[0][0]};const C=class _TextArea extends m{constructor(){super(),this._tag="div",this.type("textarea")}enter(t,e){super.enter(t,e)}calcHeight(){return Math.max(this.minHeight_exists()?this.minHeight():0,this.height())}update(t,e){super.update(t,e),this._inputElement[0].attr("rows",this.rows()).attr("cols",this.cols()).attr("wrap",this.wrap()).attr("spellcheck",this.spellcheck()).style("height",this.calcHeight()+"px")}};s(C,"TextArea");let F=C;F.prototype._class+=" form_TextArea",F.prototype.publish("rows",null,"number","Rows",null,{optional:!0}),F.prototype.publish("cols",null,"number","Columns",null,{optional:!0}),F.prototype.publish("wrap","off","set","Wrap",["off","on"]),F.prototype.publish("minHeight",null,"number","Minimum Height",null,{optional:!0}),F.prototype.publish("spellcheck",null,"boolean","Input spell checking",{optional:!0}),t.BUILD_VERSION="3.21.3",t.Button=l,t.CheckBox=r,t.ColorInput=h,t.FieldForm=g,t.Form=c,t.Input=m,t.InputRange=b,t.OnOff=v,t.PKG_NAME="@hpcc-js/form",t.PKG_VERSION="3.4.2",t.Radio=E,t.Range=w,t.Select=I,t.Slider=P,t.TextArea=F,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
2
2
  //# sourceMappingURL=index.umd.cjs.map
3
3
  !function(){"use strict";try{if("undefined"!=typeof document){var o=document.createElement("style");o.appendChild(document.createTextNode(".form_Input input,.form_Input select,.form_Input button,.form_Input textarea{padding:2px}.form_Input button{cursor:pointer}.form_Input input.color-text{width:120px}.form_Input input.color-text+input{width:57px;position:absolute}.form_Input textarea,.form_Input input[type=textbox]{width:100%;box-sizing:border-box;display:block}.form_Input ul{list-style-type:none;float:left;padding:0;margin:0}.form_Input li{float:left;list-style-position:inside}.form_Form{color:#404040}.form_Form tbody td{white-space:nowrap;border:1px solid #E5E5E5}.form_Form td.prompt{padding:2px;vertical-align:middle;background-color:#e5e5e5}.form_Form td.input{padding:2px;width:100%;vertical-align:middle}.form_Form td.input .common_HTMLWidget ul{margin:0}.form_Form tfoot button{margin:5px}.form_Form tbody tr:hover{background-color:#fafafa}.form_Form .form_Button button{background-position:-1px -1px;box-sizing:border-box;color:#24292e;cursor:pointer;height:28px;inset:0;overflow-wrap:break-word;position:relative;text-decoration:none solid rgb(36,41,46);vertical-align:middle;white-space:nowrap;word-wrap:break-word;column-rule-color:#24292e;perspective-origin:57.2938px 14px;transform-origin:57.2938px 14px;-webkit-user-select:none;user-select:none;background:#eff3f6 linear-gradient(-180deg,#fafbfc,#eff3f6 90%) repeat-x scroll -1px -1px / 110% 110% padding-box border-box;border:1px solid rgba(27,31,35,.2);border-radius:3px;outline:rgb(36,41,46) none 0px;padding:3px 10px}.form_Form .form_Button button[disabled=disabled]{background:#dbdfe2}.form_Form .form_Button button:focus{box-shadow:0 0 0 .2em #0366d64d}.form_Form .form_Button button:hover{background:#dbdfe2}.form_Form .form_Button.default button{color:#fff;text-decoration:none solid rgb(255,255,255);word-wrap:break-word;column-rule-color:#fff;perspective-origin:44.975px 17px;transform-origin:44.975px 17px;background:#28a745 linear-gradient(-180deg,#34d058,#28a745 90%) repeat-x scroll -1px -1px / 110% 110% padding-box border-box;outline:rgb(255,255,255) none 0px}.form_Form .form_Button.default button[disabled=disabled],.form_Form .form_Button.default button[disabled=disabled]:hover{background:#dbdfe2}.form_Form .form_Button.default button:hover{background:#149331}.onoffswitch-checkbox{display:none}.onoffswitch{position:relative;height:20px;width:100px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}.onoffswitch-label{display:block;overflow:hidden;cursor:pointer;border:1px solid #999999;height:20px}.onoffswitch-inner{position:relative;display:block;transition:margin .3s ease-in 0s}.onoffswitch-inner>.onoffswitch-offText,.onoffswitch-inner>.onoffswitch-onText{height:100%}.onoffswitch-inner>.onoffswitch-offText{font-weight:700;position:absolute;right:0;transition:all .3s ease-in 0s;width:100%;text-align:right}.onoffswitch-inner>.onoffswitch-onText{font-weight:700;position:absolute;left:-100%;transition:all .3s ease-in 0s;width:100%;text-align:left}.onoffswitch-switch{display:block;width:20px;margin:-1px;background:#fff;position:absolute;border:1px solid #999999;transition:all .3s ease-in 0s;inset:0 78px 0 4px}.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-inner>.onoffswitch-offText{right:-100%}.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-inner>.onoffswitch-onText{left:0}.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-switch{left:calc(100% - 20px)}.form_Slider .ticks{font:10px sans-serif}.form_Slider .track,.form_Slider .track-inset,.form_Slider .track-overlay{stroke-linecap:round}.form_Slider .track{stroke:#000;stroke-opacity:.3;stroke-width:10px}.form_Slider .track-inset{stroke:#ddd;stroke-width:8px}.form_Slider .track-overlay{pointer-events:stroke;stroke-width:50px;stroke:transparent;cursor:crosshair}.form_Slider .handle{fill:#fff;stroke:#000;stroke-opacity:.5;stroke-width:1.25px}.form_Slider .tick-line{stroke:#000;stroke-opacity:.5;stroke-width:1px;shape-rendering:crispEdges}")),document.head.appendChild(o)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hpcc-js/form",
3
- "version": "3.4.0",
3
+ "version": "3.4.2",
4
4
  "description": "hpcc-js - Viz Form",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.cjs",
@@ -37,12 +37,12 @@
37
37
  "update-major": "npx --yes npm-check-updates -u"
38
38
  },
39
39
  "dependencies": {
40
- "@hpcc-js/api": "^3.4.11",
41
- "@hpcc-js/chart": "^3.7.0",
42
- "@hpcc-js/common": "^3.7.1"
40
+ "@hpcc-js/api": "^3.4.13",
41
+ "@hpcc-js/chart": "^3.7.2",
42
+ "@hpcc-js/common": "^3.7.3"
43
43
  },
44
44
  "devDependencies": {
45
- "@hpcc-js/esbuild-plugins": "^1.8.3",
45
+ "@hpcc-js/esbuild-plugins": "^1.8.5",
46
46
  "d3-brush": "^1",
47
47
  "d3-color": "3.1.0",
48
48
  "d3-drag": "^1",
@@ -60,5 +60,5 @@
60
60
  "url": "https://github.com/hpcc-systems/Visualization/issues"
61
61
  },
62
62
  "homepage": "https://github.com/hpcc-systems/Visualization",
63
- "gitHead": "ada394f582442d2b23a7ff55b9f87a50a723f45b"
63
+ "gitHead": "eab3a48367063ed368bdd82c05de6a822ee308aa"
64
64
  }