import{m as w}from"./slider-B0ER1pJ5.js";import{u as J}from"./useFieldsExtraOptions-BAS3Fj_1.js";import{a as $,C as B,b as p,k as z,O as x,m as f,g as V,p as o,n as A,D as g,u as t,q as C,F as D,H as E,P as q,I as y}from"./convert-case-to-camel-case.utils-DDUpNI96.js";import"./widget-BUAABBRb.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";import"./translationsStore-DBJu9sBR.js";const H={class:"slider-min-max"},I={class:"label"},L={class:"label"},R={class:"custom-marks"},U=["onClick"],Z=$({__name:"Small",props:{field:{},modelValue:{}},emits:["update:modelValue"],setup(S,{emit:M}){const m=S,{field:s}=B(m),_=p(()=>s.value.jump?1:Number(s.value.step||1)),u=p(()=>Number(s.value.min)),n=p(()=>Number(s.value.max)),v=z(m.modelValue),b=p(()=>s.value.jump),r=M,F=e=>{r("update:modelValue",Array.isArray(e)?e:[e])},{formatMinMax:N}=J(s),O=e=>{const l=e.toFixed(2);return parseFloat(l).toString()},i=p(()=>{var l;return(((l=s.value.scalePoints)==null?void 0:l.trim())||"").split(",").map(a=>Number(a.trim())).filter(a=>!isNaN(a)&&a>=u.value&&a<=n.value)}),P=e=>({left:`${(e-u.value)/(n.value-u.value)*100}%`}),h=e=>{b.value&&r("update:modelValue",[v.value[0],e])},j=e=>{b.value&&i.value.includes(e)&&r("update:modelValue",[e,v.value[1]])};return x(()=>m.modelValue,e=>{v.value=e}),x(v,e=>{if(b.value){const l=i.value.reduce((d,c)=>Math.abs(c-e[0])<Math.abs(d-e[0])?c:d,i.value[0]),a=i.value.reduce((d,c)=>Math.abs(c-e[1])<Math.abs(d-e[1])?c:d,i.value[0]),k=[l,a];JSON.stringify(k)!==JSON.stringify(m.modelValue)&&r("update:modelValue",k)}else JSON.stringify(e)!==JSON.stringify(m.modelValue)&&r("update:modelValue",e)}),(e,l)=>(V(),f("div",{class:y(["slider-wrapper ccb-small-multi-range-field",{jump:t(s).jump}])},[o("div",H,[o("div",{class:"slider-min-max-item first",onClick:l[0]||(l[0]=a=>j(u.value))},[o("span",I,g(t(N)(u.value)),1)]),o("div",{class:"slider-min-max-item",onClick:l[1]||(l[1]=a=>h(n.value))},[o("span",L,g(t(N)(n.value)),1)])]),A(t(w),{style:{margin:"10px 0"},format:O,min:t(s).min,max:t(s).max,step:_.value,disabled:t(s).disabled,modelValue:e.modelValue,"onUpdate:modelValue":F,"show-tooltip":"focus"},null,8,["min","max","step","disabled","modelValue"]),o("div",R,[t(s).scalePoints?(V(!0),f(D,{key:0},E(i.value,a=>(V(),f("div",{key:a,class:"mark",style:q(P(a))},[o("div",{class:y(["tick",{"tick-passed":a>=e.modelValue[0]&&a<=e.modelValue[1]}])},null,2),a!==u.value&&a!==n.value?(V(),f("div",{key:0,class:y(["label",{"label-passed":a<=e.modelValue[0]}]),onClick:k=>h(a)},g(a),11,U)):C("",!0)],4))),128)):C("",!0)])],2))}});export{Z as default};
//# sourceMappingURL=Small-DhPXJ2Qw.js.map
