@g1cloud/open-bluesea-core 1.0.0-alpha.1 → 1.0.0-alpha.4
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/css/bluesea.css +0 -90
- package/dist/blueseaPlugin.d.ts +7 -0
- package/dist/component/input/DateInputLib.d.ts +26 -0
- package/dist/index.d.ts +7 -0
- package/dist/model/FieldContext.d.ts +1 -1
- package/dist/open-bluesea-core.css +2989 -1
- package/dist/open-bluesea-core.es.js +4073 -1866
- package/dist/open-bluesea-core.umd.js +4580 -1
- package/dist/util/formatUtil.d.ts +2 -0
- package/package.json +12 -1
|
@@ -1 +1,4580 @@
|
|
|
1
|
-
(function(M,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("dayjs")):typeof define=="function"&&define.amd?define(["exports","vue","dayjs"],e):(M=typeof globalThis<"u"?globalThis:M||self,e(M.OpenBlueseaCore={},M.Vue,M.dayJs))})(this,(function(M,e,ae){"use strict";const U=Symbol("BlueseaContextMenuPlugin");class Z{contextMenuItems=e.ref();position=e.ref();options=e.ref();showContextMenu(o,n,a){this.position.value={x:o.clientX,y:o.clientY},this.markComponentRaw(n),this.contextMenuItems.value=n,this.options.value=a}hideContextMenu(){this.options.value?.onHideContextMenu&&this.options.value.onHideContextMenu(),this.contextMenuItems.value=void 0,this.position.value=void 0,this.options.value=void 0}markComponentRaw(o){o.forEach(n=>{n.component&&(n.component=e.markRaw(n.component)),n.children&&this.markComponentRaw(n.children)})}}const W=()=>{const t=e.inject(U);if(!t)throw new Error("BSContextMenuPlugin is not initialized.");return t},Pe=()=>e.inject(U),$e=()=>new Z;class De{dateFormat="YYYY-MM-DD HH:mm Z";dateFormatDay="YYYY-MM-DD Z";dateFormatMinute="YYYY-MM-DD HH:mm Z";dateFormatSecond="YYYY-MM-DD HH:mm:ss Z";minDateValue="1920-01-01T00:00:00.000Z";maxDateValue="9000-12-31T23:59:59.999Z";componentConfig;constructor(o){this.dateFormat=o?.dateFormat||this.dateFormat,this.dateFormatDay=o?.dateFormatDay||this.dateFormatDay,this.dateFormatMinute=o?.dateFormatMinute||this.dateFormatMinute,this.dateFormatSecond=o?.dateFormatSecond||this.dateFormatSecond,this.minDateValue=o?.minDateValue||this.minDateValue,this.maxDateValue=o?.maxDateValue||this.maxDateValue,this.componentConfig={popup:{hideOnScroll:!1,...o?.componentConfig?.popup}}}resolveDisplayDateFormat(o){const n=o||this.dateFormat;return n==="DAY"?this.dateFormatDay:n==="MINUTE"?this.dateFormatMinute:n==="SECOND"?this.dateFormatSecond:n}}const le=Symbol("BlueseaConfig"),Ne=()=>e.inject(le),Ie={install(t,o){const n=new De(o);t.provide(le,n);const a=new Z;t.provide(U,a)}},Le=e.reactive([]),Fe=e.reactive([]),T=e.ref(),ie=(t,o)=>{T.value={content:t,target:e.markRaw(o),cursorInTooltip:!1}},K=()=>{T.value&&!T.value.cursorInTooltip&&(T.value=void 0)},re=()=>!!T.value,Te=e.ref(!1),ze=800,Oe=0,se=(t,o)=>{o&&o.content?(t.setAttribute("data-bs-tooltip-data",JSON.stringify(o)),re()&&ie(o.content,t)):(t.removeAttribute("data-bs-tooltip-data"),re()&&K())},G={mounted:(t,o)=>{se(t,o.value),t.addEventListener("mouseover",()=>{const n=t.getAttribute("data-bs-tooltip-data"),a=n?JSON.parse(n):void 0;a&&a.content&&(t.setAttribute("data-bs-tooltip","true"),setTimeout(()=>{const c=t.getAttribute("data-bs-tooltip-data"),s=c?JSON.parse(c):void 0;s&&s.content&&t.getAttribute("data-bs-tooltip")==="true"&&window.document.contains(t)&&ie(s.content,t)},a.delay||ze))}),t.addEventListener("mouseout",n=>{t.contains(n.relatedTarget)||(t.removeAttribute("data-bs-tooltip"),setTimeout(()=>K(),Oe))})},updated:(t,o)=>{se(t,o.value)},unmounted:()=>{K()}},He=["textContent"],qe=e.defineComponent({__name:"BSButton",props:{caption:{},buttonColor:{default:"default"},leftIcon:{},rightIcon:{},disabled:{type:Boolean,default:!1},linkUrl:{},linkTarget:{},routePath:{},tooltip:{}},setup(t){return(o,n)=>e.withDirectives((e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.linkUrl?"a":t.routePath?"router-link":"button"),{class:e.normalizeClass([[t.buttonColor],"bs-button position-relative"]),disabled:t.disabled,href:t.linkUrl,target:t.linkTarget,to:t.routePath},{default:e.withCtx(()=>[t.leftIcon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass([{"bs-mr-4":!!t.caption},"font-icon left"])},e.toDisplayString(t.leftIcon),3)):e.createCommentVNode("",!0),e.createElementVNode("span",{textContent:e.toDisplayString(t.caption)},null,8,He),t.rightIcon?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass([{"bs-ml-4":!!t.caption},"font-icon right"])},e.toDisplayString(t.rightIcon),3)):e.createCommentVNode("",!0)]),_:1},8,["class","disabled","href","target","to"])),[[e.unref(G),{content:t.tooltip}]])}}),de=(t,o)=>{const n=t.__vccOpts||t;for(const[a,c]of o)n[a]=c;return n},Re=de(qe,[["__scopeId","data-v-26726ef5"]]),Ae={class:"page-navigation"},Ue=["data-page","onClick"],Ke=e.defineComponent({__name:"BSPageNavigation",props:{totalCount:{default:0},offset:{default:0},limit:{default:10},visiblePageCount:{default:10},maxPage:{}},emits:["offsetChanged"],setup(t,{emit:o}){const n=t,a=o,c=e.computed(()=>{const y=Math.floor((n.totalCount-1)/n.limit)+1;return n.totalCount<1?1:n.maxPage&&y>n.maxPage?n.maxPage:y||0}),s=e.computed(()=>Math.min(Math.floor(n.offset/n.limit)+1,c.value)),h=e.computed(()=>Math.floor((s.value-1)/n.visiblePageCount)*n.visiblePageCount+1),f=e.computed(()=>Math.min(h.value+n.visiblePageCount-1,c.value)),p=e.computed(()=>{if(n.totalCount<=0)return[];const y=h.value,r=f.value,g=Array(r-y+1);for(let E=0;E<g.length;E++)g[E]=E+y;return g}),S=e.computed(()=>h.value-1),B=e.computed(()=>f.value+1),V=e.computed(()=>h.value<=1),b=e.computed(()=>f.value>=c.value),x=y=>{const r=Math.max(1,Math.min(y,c.value));if(s.value!==r){const g=(r-1)*n.limit;a("offsetChanged",g,{offset:n.offset,limit:n.limit,totalCount:n.totalCount})}};return(y,r)=>(e.openBlock(),e.createElementBlock("div",Ae,[e.createElementVNode("span",{class:e.normalizeClass([{disabled:V.value},"font-icon first"]),onClick:r[0]||(r[0]=e.withModifiers(g=>!V.value&&x(1),["prevent"]))},"keyboard_double_arrow_left",2),e.createElementVNode("span",{class:e.normalizeClass([{disabled:V.value},"font-icon prev"]),onClick:r[1]||(r[1]=e.withModifiers(g=>!V.value&&x(S.value),["prevent"]))},"keyboard_arrow_left",2),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,g=>(e.openBlock(),e.createElementBlock("span",{key:g,class:e.normalizeClass([{on:g===s.value},"page"]),"data-page":g,onClick:e.withModifiers(E=>x(g),["prevent"])},e.toDisplayString(g),11,Ue))),128)),e.createElementVNode("span",{class:e.normalizeClass([{disabled:b.value},"font-icon next"]),onClick:r[2]||(r[2]=e.withModifiers(g=>!b.value&&x(B.value),["prevent"]))},"keyboard_arrow_right",2),e.createElementVNode("span",{class:e.normalizeClass([{disabled:b.value},"font-icon last"]),onClick:r[3]||(r[3]=e.withModifiers(g=>!b.value&&x(c.value),["prevent"]))},"keyboard_double_arrow_right",2)]))}}),Ye={},je={class:"bs-loading-icon"};function Ze(t,o){return e.openBlock(),e.createElementBlock("div",je,[...o[0]||(o[0]=[e.createElementVNode("span",{class:"font-icon"},"progress_activity",-1)])])}const ce=de(Ye,[["render",Ze]]),We=async(t,o=200,n=15)=>await new Promise(a=>{let c=0;const s=setInterval(()=>{(c>n||t())&&(clearInterval(s),a(void 0)),c++},o)}),ue=async(t=2e3)=>new Promise(o=>setTimeout(o,t)),Ge=(t,o,n=200,a=15)=>{let c=0;const s=setInterval(()=>{c>a||t()?clearInterval(s):o?.(),c++},n)},Je=["data-popup-id"],Xe=8,J=e.defineComponent({__name:"BSPopup",props:{popupId:{},maxHeight:{default:"360px"},baseElement:{},offsetFromBaseElement:{},extraClass:{},popupDirection:{default:"auto-down"},popupAlign:{default:"auto"},zIndex:{}},emits:["requestClose","click","keydown"],setup(t,{emit:o}){const n=t,a=o,c=Ne(),s=c?.componentConfig?.popup?.container||".bs-popup-container",h=e.ref();let f;const p=e.ref("-100000px"),S=e.ref("-100000px"),B=()=>n.baseElement instanceof HTMLElement?x(n.baseElement):n.baseElement?y(n.baseElement):{left:0,top:0,right:0,bottom:0,width:0,height:0};e.onMounted(async()=>{if(await ue(10),n.baseElement&&h.value){f=B();const i=h.value.getBoundingClientRect(),m=r(f,i,n.popupDirection,n.popupAlign);S.value=`${m.top}px`,p.value=`${m.left}px`}});const V=e.ref({x:0,y:0}),b=e.computed(()=>`translate(${V.value.x}px, ${V.value.y}px)`),x=i=>{const m=i.getBoundingClientRect(),l={left:m.left,top:m.top,right:m.right,bottom:m.bottom,width:m.width,height:m.height};let d=i.offsetParent;for(;d;)l.top-=d.scrollTop||0,l.bottom-=d.scrollTop||0,l.left-=d.scrollLeft||0,l.right-=d.scrollLeft||0,d=d.offsetParent;return l},y=i=>({left:i.left,top:i.top,right:i.left,bottom:i.top,width:0,height:0}),r=(i,m,l,d)=>{if(l==="auto-down")if(i.bottom+m.height+(n.offsetFromBaseElement||0)>window.innerHeight)if(i.top-m.height-(n.offsetFromBaseElement||0)<0){const k=i.bottom+m.height+(n.offsetFromBaseElement||0)-window.innerHeight;return{top:i.bottom+(n.offsetFromBaseElement||0)-k-Xe,left:g(i,m,d)}}else return{top:i.top-m.height-(n.offsetFromBaseElement||0),left:g(i,m,d)};else return{top:i.bottom+(n.offsetFromBaseElement||0),left:g(i,m,d)};else return l==="down"?{top:i.bottom+(n.offsetFromBaseElement||0),left:g(i,m,d)}:l==="up"?{top:i.top-m.height-(n.offsetFromBaseElement||0),left:g(i,m,d)}:l==="auto-right"?i.right+m.width>window.innerWidth?{top:i.top,left:i.left-m.width}:{top:i.top,left:i.right}:l==="right"?{top:i.top,left:i.right}:{left:0,top:0}},g=(i,m,l)=>l==="auto"?i.left+m.width>window.innerWidth?i.right-m.width<0?i.left:i.left-(m.width-i.width):i.left:l==="center"?i.left-(m.width-i.width)/2:l==="left"?i.left:l==="right"?i.left-(m.width-i.width):0,E=()=>{a("requestClose")},w=[],u=()=>{if(c?.componentConfig?.popup?.hideOnScroll)E();else if(f){const i=B();V.value.x=i.left-f.left,V.value.y=i.top-f.top}};return e.onMounted(()=>{if(n.baseElement instanceof HTMLElement&&(window.addEventListener("scroll",u,{passive:!0}),n.baseElement instanceof HTMLElement)){let i=n.baseElement;for(;i;)(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth)&&w.push(i),i=i.parentElement;w.forEach(m=>m.addEventListener("scroll",u,{passive:!0}))}}),e.onBeforeUnmount(()=>{window.removeEventListener("scroll",u),w.forEach(i=>i.removeEventListener("scroll",u))}),(i,m)=>(e.openBlock(),e.createBlock(e.Teleport,{to:e.unref(s)},[e.createVNode(e.Transition,null,{default:e.withCtx(()=>[e.createElementVNode("div",{ref_key:"root",ref:h,class:e.normalizeClass([t.extraClass,"bs-popup overflow-auto"]),"data-popup-id":t.popupId,style:e.normalizeStyle({maxHeight:t.maxHeight,top:S.value,left:p.value,zIndex:t.zIndex,transform:b.value}),onClick:m[0]||(m[0]=l=>a("click",l)),onKeydown:m[1]||(m[1]=l=>a("keydown",l))},[e.renderSlot(i.$slots,"default")],46,Je)]),_:3})],8,["to"]))}}),Qe=["textContent"],me=e.defineComponent({__name:"BSTooltip",props:{align:{default:"center"},content:{},target:{}},setup(t){const o=t,n=e.computed(()=>{const a={};if(o.target){const c=o.target.getBoundingClientRect();a.top=`${c.bottom+8}px`,o.align==="left"?a.left=`${c.left}px`:o.align==="right"?a.right=`${c.right}px`:a.left=`${(c.left+c.right)/2}px`}return a});return(a,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([t.align,"bs-tooltip"]),style:e.normalizeStyle(n.value)},[e.createElementVNode("div",{textContent:e.toDisplayString(t.content)},null,8,Qe)],6))}}),_e=(t,o)=>{t._bsFieldValidator=o,t.setAttribute("data-bs-field-validator","")},H=t=>{const o=e.ref(),n=e.ref(t.initialValue),a=e.ref(!1),c=e.ref([]),s=e.ref(!1),h=u=>t.convertToValue?t.convertToValue(u):u??"",f=u=>t.convertFromValue?t.convertFromValue(u):u?.toString()??"",p=async(u,i)=>{const m=h(u);await S(m,i)},S=async(u,i)=>{if(n.value=u,t.disabled?.value){a.value=!0;return}a.value=!1;const m=await t.isValid?.(n.value,i);m&&m.length>0?(a.value=!1,c.value=m):(a.value=!0,c.value=[])},B=u=>u.target&&"value"in u.target?u.target.value:void 0,V=async(u="form")=>{await S(n.value,u)},b=()=>{s.value=!1,c.value=[],a.value=!1},x=async u=>{const i=B(u);i!==void 0&&await p(i,"input")},w={stringValue:o,value:n,valid:a,errors:c,touched:s,handleInput:async u=>{await x(u)},handleChange:async u=>{const i=B(u);i!==void 0&&await p(i,"change")},handleFocus:u=>{s.value=!0},handleBlur:async u=>{const i=B(u);i!==void 0&&await p(i,"blur")},validateValue:S,validate:V,clearErrors:b,getName:()=>{const u=t.field?.value;return u?u.getAttribute("name")??u.getAttribute("data-field-name")??"":""}};return o.value=f(n.value),t.field&&e.watch(t.field,u=>{u&&_e(u,w)}),w},q=async(t,o,n,a,c)=>{const s=[];if(o){for(const h of o){const f=await h(t,a,c);f&&f.forEach(p=>s.push(p))}s.forEach(h=>n.push(h))}return s.length>0},X=(t,o,n,a)=>o&&(typeof t=="string"&&!t||t===void 0)?(a.push({code:"required",message:n||"Required"}),!0):!1,et=(t,o,n,a)=>t&&o&&!new RegExp(o).test(t)?(a.push({code:"allowedPattern",message:n||"Invalid format"}),!0):!1,fe=(t,o,n,a,c,s,h)=>{const f=!!t&&!!o&&t.length<o,p=!!t&&!!a&&t.length>a;return f&&p?h.push({code:"betweenLength",message:s||"Should be {0} ~ {1} characters"}):f?h.push({code:"minLength",message:n||"Should be {0} characters or more"}):p&&h.push({code:"maxLength",message:c||"Should be {0} characters or less"}),f||p},tt=(t,o,n,a,c,s,h)=>{const f=o!==void 0&&t<o,p=a!==void 0&&t>a;return f&&p?h.push({code:"betweenValue",message:s||"Should be {0} ~ {1}"}):f?h.push({code:"minValue",message:n||"Should be {0} or more"}):p&&h.push({code:"maxValue",message:c||"Should be {0} or less"}),f||p};let nt=0,ot=0;const L={handleExternalErrorMessage(t,o,n){if(n){const a=document.getElementById(n);a&&(!t||!o||o.length===0?a.style.display="none":(a.style.display="",a.textContent=o||""))}},generateNextId(t){return`${t}-${++nt}`},generateNextName(t){return`${t}${++ot}`},isRelativeSize(t){return t?.endsWith("%")||!1},delayed(t,o=200){o<=0?t():window.setTimeout(t,o)},trimStringValue(t,o){return o?t?.trim():t},getPrefixSuffixList(t){if(!t)return[];const o=Array.isArray(t)?t:[t],n=[];for(let a of o)a&&(typeof a=="object"&&a.hasOwnProperty("type")&&a.hasOwnProperty("value")?n.push(a):n.push({type:"text",value:a}));return n}},Q=Symbol("SavePoint");class _{fields=e.markRaw(new Map);children;registerField(o){const n=new it({getCurrentValue:o.getCurrentValue,setCurrentValue:o.setCurrentValue,compare:o.compare});return e.watch(o.field,a=>{a&&this.fields.set(a,n)}),n}unregisterField(o){o.value&&this.fields.delete(o.value)}addChild(o){this.children||(this.children=[]),this.children.push(o)}removeChild(o){if(this.children){const n=this.children.findIndex(a=>a===o);n>=0&&this.children.splice(n,1)}}set(){this.fields.forEach(o=>o.saveValue()),this.children?.forEach(o=>o.set())}async setNextTick(){await e.nextTick(),this.set()}rollback(){this.fields.forEach(o=>o.rollbackValue()),this.children?.forEach(o=>o.rollback())}isModified(){return Array.from(this.fields.values()).find(o=>o.isFieldModified())?!0:this.children?!!this.children.find(o=>o.isModified()):!1}}const at=()=>{const t=new _;return e.provide(Q,t),t},ee=new _,z=()=>{const t=e.inject(Q,ee);return t===ee?void 0:t},lt=()=>{e.provide(Q,ee)};class it{saved=!1;savedValue=e.shallowRef();valueProvider;constructor(o){this.valueProvider=o}saveValue(){this.savedValue.value=this.valueProvider.getCurrentValue(),this.saved=!0}getSavedValue(){return this.savedValue.value}rollbackValue(){this.saved&&this.valueProvider.setCurrentValue(this.savedValue.value)}isModified(o){return this.saved&&(this.valueProvider.compare?!this.valueProvider.compare(this.savedValue.value,o):this.savedValue?.value!==o)}isFieldModified(){return this.isModified(this.valueProvider.getCurrentValue())}}const rt={key:0},st=["textContent"],R=e.defineComponent({__name:"ValidationErrors",props:{errors:{},hideErrorMessage:{type:Boolean}},setup(t){return(o,n)=>!t.hideErrorMessage&&t.errors&&t.errors.length>0?(e.openBlock(),e.createElementBlock("div",rt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.errors,a=>(e.openBlock(),e.createElementBlock("div",{key:a.code,textContent:e.toDisplayString(a.message),class:"bs-field-error"},null,8,st))),128))])):e.createCommentVNode("",!0)}}),he=Symbol("FieldContext"),dt=t=>{e.provide(he,t)},pe={},O=()=>{const t=e.inject(he,pe);return t===pe?void 0:t},ct=["textContent"],ut={class:"font-icon"},mt=["src","alt"],F=e.defineComponent({__name:"BSPrefixSuffix",props:{value:{},type:{}},setup(t){const o=t,n=e.computed(()=>L.getPrefixSuffixList(o.value));return(a,c)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,s=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[s.type==="text"?(e.openBlock(),e.createElementBlock("span",{textContent:e.toDisplayString(s.value),key:JSON.stringify(s.value),class:e.normalizeClass(t.type)},null,10,ct)):s.type==="font-icon"?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(t.type)},[e.createElementVNode("span",ut,e.toDisplayString(s.value),1)],2)):s.type==="image-url"?(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass(t.type)},[e.createElementVNode("img",{src:s.value,alt:t.type},null,8,mt)],2)):e.createCommentVNode("",!0)],64))),256))}}),ft={key:0,class:"view-mode"},ht=["textContent"],pt={key:1,class:"input-area"},gt=["id","placeholder","autocomplete","disabled","maxlength","name","tabindex","type"],bt=e.defineComponent({__name:"BSTextInput",props:{id:{},placeholder:{},name:{default:()=>L.generateNextName("textInput")},modelValue:{},maxlength:{},disabled:{type:Boolean},forceValidateWhenDisabled:{type:Boolean},viewMode:{type:Boolean},width:{default:"200px"},autocomplete:{},tabindex:{default:0},inputType:{default:"text"},trimValue:{type:Boolean,default:!0},prefix:{},suffix:{},required:{type:Boolean},minLength:{},maxLength:{},regExp:{},validationMessageRequired:{},validationMessageMinLength:{},validationMessageMaxLength:{},validationMessageBetweenLength:{},validationMessageRegExp:{},extraValidationRules:{},ignoreSavePoint:{type:Boolean},hideErrorMessage:{type:Boolean},showErrorMessageOnDisabled:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:o}){const n=t,a=o;e.watch(()=>n.modelValue,()=>{B.value=p(n.modelValue),r(n.modelValue||"","change")});const c=e.ref(),s=O(),h=async(i,m)=>{const l=[],d=i??"";return X(d,n.required,n.validationMessageRequired,l)||et(d,n.regExp,n.validationMessageRegExp,l)||fe(d,n.minLength,n.validationMessageMinLength,n.maxLength,n.validationMessageMaxLength,n.validationMessageBetweenLength,l)||await q(d,n.extraValidationRules,l,m,s),l},f=i=>String(L.trimStringValue(i,n.trimValue)||""),p=i=>L.trimStringValue(i,n.trimValue)??"",S=e.computed(()=>n.viewMode||n.disabled&&!n.forceValidateWhenDisabled),{stringValue:B,errors:V,handleInput:b,handleFocus:x,handleBlur:y,validateValue:r}=H({field:c,disabled:S,initialValue:n.modelValue,isValid:h,convertToValue:f,convertFromValue:p}),g={input:b,focus:x,blur:y,change:()=>{a("update:modelValue",f(B.value))}},E=n.ignoreSavePoint?void 0:z(),w=E?.registerField({field:c,getCurrentValue:()=>n.modelValue||"",setCurrentValue:i=>a("update:modelValue",i||"")}),u=e.computed(()=>!!w?.isModified(n.modelValue||""));return e.onBeforeUnmount(()=>E?.unregisterField(c)),(i,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([{required:t.required,disabled:t.disabled,modified:u.value,error:e.unref(V).length>0},"bs-text-input"]),style:e.normalizeStyle({width:t.width})},[t.viewMode?(e.openBlock(),e.createElementBlock("div",ft,[e.createVNode(F,{value:t.prefix,type:"prefix"},null,8,["value"]),e.createElementVNode("span",{textContent:e.toDisplayString(e.unref(B))},null,8,ht),e.createVNode(F,{value:t.suffix,type:"suffix"},null,8,["value"])])):(e.openBlock(),e.createElementBlock("div",pt,[e.createVNode(F,{value:t.prefix,type:"prefix"},null,8,["value"]),e.withDirectives(e.createElementVNode("input",e.mergeProps({id:t.id,ref_key:"field",ref:c,"onUpdate:modelValue":m[0]||(m[0]=l=>e.isRef(B)?B.value=l:null),placeholder:t.placeholder,autocomplete:t.autocomplete,disabled:t.disabled,maxlength:t.maxlength,name:t.name,tabindex:t.tabindex,type:t.inputType},e.toHandlers(g,!0)),null,16,gt),[[e.vModelDynamic,e.unref(B)]]),e.createVNode(F,{value:t.suffix,type:"suffix"},null,8,["value"])])),t.viewMode?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(R,{key:2,errors:e.unref(V),"hide-error-message":t.hideErrorMessage||t.disabled&&!t.showErrorMessageOnDisabled},null,8,["errors","hide-error-message"]))],6))}});function ge(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Y={exports:{}},yt=Y.exports,be;function xt(){return be||(be=1,(function(t,o){(function(n,a){t.exports=a()})(yt,(function(){var n="minute",a=/[+-]\d\d(?::?\d\d)?/g,c=/([+-]|\d\d)/g;return function(s,h,f){var p=h.prototype;f.utc=function(r){var g={date:r,utc:!0,args:arguments};return new h(g)},p.utc=function(r){var g=f(this.toDate(),{locale:this.$L,utc:!0});return r?g.add(this.utcOffset(),n):g},p.local=function(){return f(this.toDate(),{locale:this.$L,utc:!1})};var S=p.parse;p.parse=function(r){r.utc&&(this.$u=!0),this.$utils().u(r.$offset)||(this.$offset=r.$offset),S.call(this,r)};var B=p.init;p.init=function(){if(this.$u){var r=this.$d;this.$y=r.getUTCFullYear(),this.$M=r.getUTCMonth(),this.$D=r.getUTCDate(),this.$W=r.getUTCDay(),this.$H=r.getUTCHours(),this.$m=r.getUTCMinutes(),this.$s=r.getUTCSeconds(),this.$ms=r.getUTCMilliseconds()}else B.call(this)};var V=p.utcOffset;p.utcOffset=function(r,g){var E=this.$utils().u;if(E(r))return this.$u?0:E(this.$offset)?V.call(this):this.$offset;if(typeof r=="string"&&(r=(function(m){m===void 0&&(m="");var l=m.match(a);if(!l)return null;var d=(""+l[0]).match(c)||["-",0,0],k=d[0],v=60*+d[1]+ +d[2];return v===0?0:k==="+"?v:-v})(r),r===null))return this;var w=Math.abs(r)<=16?60*r:r;if(w===0)return this.utc(g);var u=this.clone();if(g)return u.$offset=w,u.$u=!1,u;var i=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(u=this.local().add(w+i,n)).$offset=w,u.$x.$localOffset=i,u};var b=p.format;p.format=function(r){var g=r||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return b.call(this,g)},p.valueOf=function(){var r=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*r},p.isUTC=function(){return!!this.$u},p.toISOString=function(){return this.toDate().toISOString()},p.toString=function(){return this.toDate().toUTCString()};var x=p.toDate;p.toDate=function(r){return r==="s"&&this.$offset?f(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():x.call(this)};var y=p.diff;p.diff=function(r,g,E){if(r&&this.$u===r.$u)return y.call(this,r,g,E);var w=this.local(),u=f(r).local();return y.call(w,u,g,E)}}}))})(Y)),Y.exports}var kt=xt();const Bt=ge(kt);var j={exports:{}},Vt=j.exports,ye;function Ct(){return ye||(ye=1,(function(t,o){(function(n,a){t.exports=a()})(Vt,(function(){var n={year:0,month:1,day:2,hour:3,minute:4,second:5},a={};return function(c,s,h){var f,p=function(b,x,y){y===void 0&&(y={});var r=new Date(b),g=(function(E,w){w===void 0&&(w={});var u=w.timeZoneName||"short",i=E+"|"+u,m=a[i];return m||(m=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:E,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:u}),a[i]=m),m})(x,y);return g.formatToParts(r)},S=function(b,x){for(var y=p(b,x),r=[],g=0;g<y.length;g+=1){var E=y[g],w=E.type,u=E.value,i=n[w];i>=0&&(r[i]=parseInt(u,10))}var m=r[3],l=m===24?0:m,d=r[0]+"-"+r[1]+"-"+r[2]+" "+l+":"+r[4]+":"+r[5]+":000",k=+b;return(h.utc(d).valueOf()-(k-=k%1e3))/6e4},B=s.prototype;B.tz=function(b,x){b===void 0&&(b=f);var y,r=this.utcOffset(),g=this.toDate(),E=g.toLocaleString("en-US",{timeZone:b}),w=Math.round((g-new Date(E))/1e3/60),u=15*-Math.round(g.getTimezoneOffset()/15)-w;if(!Number(u))y=this.utcOffset(0,x);else if(y=h(E,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(u,!0),x){var i=y.utcOffset();y=y.add(r-i,"minute")}return y.$x.$timezone=b,y},B.offsetName=function(b){var x=this.$x.$timezone||h.tz.guess(),y=p(this.valueOf(),x,{timeZoneName:b}).find((function(r){return r.type.toLowerCase()==="timezonename"}));return y&&y.value};var V=B.startOf;B.startOf=function(b,x){if(!this.$x||!this.$x.$timezone)return V.call(this,b,x);var y=h(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return V.call(y,b,x).tz(this.$x.$timezone,!0)},h.tz=function(b,x,y){var r=y&&x,g=y||x||f,E=S(+h(),g);if(typeof b!="string")return h(b).tz(g);var w=(function(l,d,k){var v=l-60*d*1e3,I=S(v,k);if(d===I)return[v,d];var C=S(v-=60*(I-d)*1e3,k);return I===C?[v,I]:[l-60*Math.min(I,C)*1e3,Math.max(I,C)]})(h.utc(b,r).valueOf(),E,g),u=w[0],i=w[1],m=h(u).utcOffset(i);return m.$x.$timezone=g,m},h.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},h.tz.setDefault=function(b){f=b}}}))})(j)),j.exports}var wt=Ct();const Mt=ge(wt);ae.extend(Bt),ae.extend(Mt);const Et=(t,o=2)=>{const n=Math.pow(10,o);return Math.round(t*n)/n},St={escapeNewLine(t){return t?t.replace(/\r\n|\r|\n/g,"<br />"):""},escapeHtml(t){return t?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):""},splitNewLine(t){return t?t.split(/\r\n|\r|\n/g):[]},formatNumber(t){if(t||typeof t=="number"){const o=/\B(?=(\d{3})+(?!\d))/g,n=t.toString().split("."),a=n[0].replace(o,","),c=n[1]?`.${n[1]}`:"";return a+c}return null},formatNumberByCode(t,o){return typeof t>"u"?null:t||typeof t=="number"?t.toLocaleString(o):null},formatPrice(t,o,n=!1){if(t||typeof t=="number"){const a=this.formatNumber(t);return n?`${o} ${a}`:`${a} ${o}`}return null},formatPercent(t,o=!0,n=2){return t!=null&&!isNaN(Number(t))?`${Et(Number(t)*100,n)}${o?"%":""}`:null},formatCreditCardNo(t,o="-"){return t.match(/.{1,4}/g)?.join(o)},toPlainText(t){const o=document.createElement("DIV");return o.innerHTML=t||"",o.textContent||o.innerText}},vt={key:0,class:"view-mode"},Pt=["textContent"],$t={key:1,class:"input-area"},Dt=["id","autocomplete","disabled","maxlength","name","tabindex","value"],Nt=e.defineComponent({__name:"BSNumberInput",props:{id:{},placeholder:{},name:{},modelValue:{},maxlength:{},disabled:{type:Boolean},viewMode:{type:Boolean},width:{default:"200px"},autocomplete:{},tabindex:{default:0},prefix:{},suffix:{},format:{type:Boolean,default:!0},formatInViewMode:{type:Boolean,default:!0},formatOnBlur:{type:Boolean,default:!0},required:{type:Boolean},minValue:{},maxValue:{},validationMessageRequired:{},validationMessageMinValue:{},validationMessageMaxValue:{},validationMessageBetweenValue:{},extraValidationRules:{},ignoreSavePoint:{type:Boolean},hideErrorMessage:{type:Boolean},showErrorMessageOnDisabled:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:o}){const n=t,a=o,c=d=>d.replace(/[^\d-\\.,]/g,"");e.watch(()=>n.modelValue,()=>{x.value=V(n.modelValue),w(n.modelValue,"change")});const s=e.ref(),h=e.ref(!1),f=e.computed(()=>n.format?St.formatNumber(x.value)||"":x.value||""),p=O(),S=async(d,k)=>{const v=[];return X(d,n.required,n.validationMessageRequired,v)||d!==void 0&&tt(d,n.minValue,n.validationMessageMinValue,n.maxValue,n.validationMessageMaxValue,n.validationMessageBetweenValue,v)||await q(d,n.extraValidationRules,v,k,p),v},B=d=>{if(!d)return;const k=Number(d);return isNaN(k)?void 0:k},V=d=>d!==void 0?String(d):"",b=e.computed(()=>n.viewMode||n.disabled),{stringValue:x,errors:y,handleInput:r,handleFocus:g,handleBlur:E,validateValue:w}=H({field:s,disabled:b,initialValue:n.modelValue,isValid:S,convertToValue:B,convertFromValue:V}),u={input:async d=>{x.value=c(d.target.value),await r(d)},focus:d=>{h.value=!0,g(d)},blur:d=>{h.value=!1,E(d)},change:()=>{a("update:modelValue",B(x.value))}},i=n.ignoreSavePoint?void 0:z(),m=i?.registerField({field:s,getCurrentValue:()=>n.modelValue,setCurrentValue:d=>a("update:modelValue",d)}),l=e.computed(()=>!!m?.isModified(n.modelValue));return e.onBeforeUnmount(()=>i?.unregisterField(s)),(d,k)=>{const v=e.resolveDirective("t");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([{required:t.required,disabled:t.disabled,modified:l.value,error:e.unref(y).length>0},"bs-number-input"]),style:e.normalizeStyle({width:t.width})},[t.viewMode?(e.openBlock(),e.createElementBlock("div",vt,[e.createVNode(F,{value:t.prefix,type:"prefix"},null,8,["value"]),e.createElementVNode("span",{textContent:e.toDisplayString(t.formatInViewMode?f.value:e.unref(x))},null,8,Pt),e.createVNode(F,{value:t.suffix,type:"suffix"},null,8,["value"])])):(e.openBlock(),e.createElementBlock("div",$t,[e.createVNode(F,{value:t.prefix,type:"prefix"},null,8,["value"]),e.withDirectives(e.createElementVNode("input",e.mergeProps({id:t.id,ref_key:"field",ref:s,autocomplete:t.autocomplete,disabled:t.disabled,maxlength:t.maxlength,name:t.name,tabindex:t.tabindex,value:h.value||!t.formatOnBlur?e.unref(x):f.value,type:"text"},e.toHandlers(u,!0)),null,16,Dt),[[v,t.placeholder,void 0,{placeholder:!0}]]),e.createVNode(F,{value:t.suffix,type:"suffix"},null,8,["value"])])),t.viewMode?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(R,{key:2,errors:e.unref(y),"hide-error-message":t.hideErrorMessage||t.disabled&&!t.showErrorMessageOnDisabled},null,8,["errors","hide-error-message"]))],6)}}}),It={key:0,class:"view-mode bs-layout-horizontal gap-8 align-items-start"},Lt=["textContent"],Ft={key:1,class:"input-area bs-layout-horizontal align-items-start"},Tt=["placeholder","disabled","maxlength","name","tabindex"],zt=e.defineComponent({__name:"BSTextArea",props:{id:{},placeholder:{},name:{},modelValue:{},maxlength:{},disabled:{type:Boolean},viewMode:{type:Boolean},width:{default:"400px"},height:{},autocomplete:{},tabindex:{default:0},trimValue:{type:Boolean,default:!0},prefix:{},suffix:{},required:{type:Boolean},minLength:{},maxLength:{},validationMessageRequired:{},validationMessageMinLength:{},validationMessageMaxLength:{},validationMessageBetweenLength:{},extraValidationRules:{},ignoreSavePoint:{type:Boolean},hideErrorMessage:{type:Boolean},showErrorMessageOnDisabled:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:o}){const n=t,a=o,c=C=>String(L.trimStringValue(C,n.trimValue)||""),s=C=>L.trimStringValue(C,n.trimValue)??"";e.watch(()=>n.modelValue,()=>{B.value=s(n.modelValue),r(n.modelValue||"","change")});const h=e.ref(),f=O(),p=async(C,P)=>{const D=[],$=C?.trim()??"";return X($,n.required,n.validationMessageRequired,D)||fe($,n.minLength,n.validationMessageMinLength,n.maxLength,n.validationMessageMaxLength,n.validationMessageBetweenLength,D)||await q($,n.extraValidationRules,D,P,f),D},S=e.computed(()=>n.viewMode||n.disabled),{stringValue:B,errors:V,handleInput:b,handleFocus:x,handleBlur:y,validateValue:r}=H({field:h,disabled:S,initialValue:n.modelValue,isValid:p,convertToValue:c,convertFromValue:s}),g={input:b,focus:x,blur:y,change:()=>{a("update:modelValue",c(B.value))}},E=e.computed(()=>L.isRelativeSize(n.width)?n.width:void 0),w=e.computed(()=>L.isRelativeSize(n.height)?n.height:void 0),u=e.computed(()=>L.isRelativeSize(n.width)?"100%":n.width),i=e.computed(()=>k.value||(L.isRelativeSize(n.height)?"100%":n.height)),m=n.ignoreSavePoint?void 0:z(),l=m?.registerField({field:h,getCurrentValue:()=>n.modelValue||"",setCurrentValue:C=>a("update:modelValue",C||"")}),d=e.computed(()=>!!l?.isModified(n.modelValue||""));e.onBeforeUnmount(()=>m?.unregisterField(h));const k=e.ref(),v=C=>{h.value&&h.value.setPointerCapture(C.pointerId)},I=C=>{h.value&&(k.value=`${h.value.offsetHeight}px`,h.value.releasePointerCapture(C.pointerId))};return(C,P)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([{disabled:t.disabled,modified:d.value,error:e.unref(V).length>0},"bs-text-area"]),style:e.normalizeStyle({width:E.value,height:w.value})},[t.viewMode?(e.openBlock(),e.createElementBlock("div",It,[e.createVNode(F,{value:t.prefix,type:"prefix"},null,8,["value"]),e.createElementVNode("div",{textContent:e.toDisplayString(e.unref(B))},null,8,Lt),e.createVNode(F,{value:t.suffix,type:"suffix"},null,8,["value"])])):(e.openBlock(),e.createElementBlock("div",Ft,[e.createVNode(F,{value:t.prefix,type:"prefix"},null,8,["value"]),e.withDirectives(e.createElementVNode("textarea",e.mergeProps({ref_key:"field",ref:h,"onUpdate:modelValue":P[0]||(P[0]=D=>e.isRef(B)?B.value=D:null),placeholder:t.placeholder,disabled:t.disabled,maxlength:t.maxlength,name:t.name,style:{width:u.value,height:i.value},tabindex:t.tabindex,class:"grow",onPointerdown:v,onPointerup:I},e.toHandlers(g,!0)),null,16,Tt),[[e.vModelText,e.unref(B)]]),e.createVNode(F,{value:t.suffix,type:"suffix"},null,8,["value"])])),t.viewMode?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(R,{key:2,errors:e.unref(V),"hide-error-message":t.hideErrorMessage||t.disabled&&!t.showErrorMessageOnDisabled},null,8,["errors","hide-error-message"]))],6))}}),Ot=["id","checked","disabled","name","tabindex"],Ht=["textContent","for"],qt=["for"],xe=e.defineComponent({__name:"BSCheckbox",props:{id:{default:()=>L.generateNextId("checkbox")},name:{},label:{},modelValue:{type:Boolean},disabled:{type:Boolean},viewMode:{type:Boolean},tabindex:{default:0},disableSavePoint:{type:Boolean},ignoreSavePoint:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:o}){const n=t,a=o,c=e.ref(n.modelValue),s=e.useSlots(),h=e.computed(()=>!!s?.default),f={change:b=>{c.value=b.target.checked,n.modelValue!==c.value&&a("update:modelValue",c.value)}};e.watch(()=>n.modelValue,()=>c.value=n.modelValue);const p=e.ref(),S=n.ignoreSavePoint?void 0:z(),B=S?.registerField({field:p,getCurrentValue:()=>n.modelValue||!1,setCurrentValue:b=>{n.disableSavePoint||a("update:modelValue",b||!1)}}),V=e.computed(()=>!!B?.isModified(n.modelValue));return e.onBeforeUnmount(()=>S?.unregisterField(p)),(b,x)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass([{checked:c.value,disabled:t.disabled,modified:V.value},"bs-checkbox"])},[e.createElementVNode("input",e.mergeProps({id:t.id,ref_key:"field",ref:p,checked:c.value,disabled:t.disabled||t.viewMode,name:t.name,tabindex:t.tabindex,class:"",type:"checkbox"},e.toHandlers(f,!0)),null,16,Ot),t.label?(e.openBlock(),e.createElementBlock("label",{key:0,textContent:e.toDisplayString(t.label),for:t.id,class:"text-label"},null,8,Ht)):e.createCommentVNode("",!0),h.value?(e.openBlock(),e.createElementBlock("label",{key:1,for:t.id,class:"slot-label cursor-pointer"},[e.renderSlot(b.$slots,"default",{disabled:t.disabled})],8,qt)):e.createCommentVNode("",!0)],2))}}),ke=t=>t?typeof t=="string"?t:String(t):"",Be=(t,o,n)=>{if(o){const a=o(t);if(a!==void 0)return a}return n(t)},te=(t,o,n)=>{if(o){const a=o(t);if(a)return a}return n(t)},Rt=["data-field-name"],At={class:"items"},Ut=["textContent"],Kt=e.defineComponent({__name:"BSCheckboxGroup",props:{name:{},modelValue:{default:()=>[]},items:{default:()=>[]},valueProvider:{},labelProvider:{},keyProvider:{},enabledItemProvider:{},tabindex:{default:0},disabled:{type:Boolean},viewMode:{type:Boolean},required:{type:Boolean},validationMessageRequired:{},extraValidationRules:{},ignoreSavePoint:{type:Boolean},hideErrorMessage:{type:Boolean},showErrorMessageOnDisabled:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:o}){const n=t,a=o,c=l=>n.labelProvider?n.labelProvider(l):String(l),s=l=>n.valueProvider?n.valueProvider(l):l,h=l=>te(l,n.keyProvider,()=>String(s(l))),f=l=>n.enabledItemProvider?!n.enabledItemProvider(l):!1,p=e.ref({}),S=(l,d,k)=>{n.items.forEach(v=>l[h(v)]=d.includes(s(v))),k&&E(n.modelValue,"change")},B=(l,d)=>{const k=s(d),v=n.modelValue.includes(k);if(l&&!v){const I=[...n.modelValue,k],C=n.items.map(P=>s(P)).filter(P=>I.includes(P));a("update:modelValue",C)}else if(!l&&v){const I=n.modelValue.indexOf(k),C=n.modelValue.toSpliced(I,1);a("update:modelValue",C)}},V=e.computed(()=>n.items.filter(l=>n.modelValue.includes(s(l))).map(c).join(", ")),b=e.ref(),x=O(),y=async(l,d)=>{const k=[];return n.required&&(l===void 0||l.length===0)?k.push({code:"required",message:n.validationMessageRequired||"Required"}):l!==void 0&&await q(l,n.extraValidationRules,k,d,x),k},r=e.computed(()=>n.viewMode||n.disabled),{errors:g,validateValue:E}=H({field:b,disabled:r,initialValue:n.modelValue,isValid:y}),w=l=>{const d={};n.items.forEach(k=>d[h(k)]=!1),S(d,n.modelValue,l),p.value=d};e.watch(()=>n.items,()=>w(!1)),e.watch(()=>n.modelValue,l=>S(p.value,l,!0)),e.onMounted(()=>{w(!1)});const u=n.ignoreSavePoint?void 0:z(),i=u?.registerField({field:b,getCurrentValue:()=>[...n.modelValue],setCurrentValue:l=>a("update:modelValue",[...l||[]]),compare:(l,d)=>l?.toSorted().join(",")===d?.toSorted().join(",")}),m=e.computed(()=>!!i?.isModified(n.modelValue||[]));return e.onBeforeUnmount(()=>u?.unregisterField(b)),(l,d)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"field",ref:b,class:e.normalizeClass([{required:t.required,disabled:t.disabled,modified:m.value,error:e.unref(g).length>0},"bs-checkbox-group bs-layout-vertical"]),"data-field-name":t.name,role:"group"},[e.createElementVNode("div",At,[t.viewMode?(e.openBlock(),e.createElementBlock("div",{key:0,class:"view-mode",textContent:e.toDisplayString(V.value)},null,8,Ut)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(t.items,k=>(e.openBlock(),e.createBlock(xe,{key:h(k),disabled:t.disabled||f(k),label:c(k),"model-value":p.value[h(k)],name:`${t.name||""}_${h(k)}`,tabindex:t.tabindex,"disable-save-point":"","onUpdate:modelValue":v=>B(v,k)},null,8,["disabled","label","model-value","name","tabindex","onUpdate:modelValue"]))),128))]),t.viewMode?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(R,{key:0,errors:e.unref(g),"hide-error-message":t.hideErrorMessage||t.disabled&&!t.showErrorMessageOnDisabled},null,8,["errors","hide-error-message"]))],10,Rt))}}),Yt=["id","checked","disabled","name","tabindex"],jt=["for"],Zt={key:0,class:"font-icon"},Wt=["textContent"],Gt=["for"],Ve=e.defineComponent({__name:"BSRadioButton",props:{id:{default:()=>L.generateNextId("radio")},name:{default:()=>L.generateNextName("radio")},label:{},icon:{},modelValue:{},itemValue:{},disabled:{type:Boolean},viewMode:{type:Boolean},tabindex:{default:0}},emits:["update:modelValue"],setup(t,{emit:o}){const n=t,a=o,c=e.computed(()=>n.itemValue!==void 0&&n.itemValue===n.modelValue||!1),s=e.useSlots(),h=e.computed(()=>!!s?.default),p={change:S=>{S.target.checked&&a("update:modelValue",n.itemValue)}};return(S,B)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass([{checked:c.value,disabled:t.disabled},"bs-radio-button"])},[e.createElementVNode("input",e.mergeProps({id:t.id,checked:c.value,disabled:t.disabled||t.viewMode,name:t.name,tabindex:t.tabindex,class:"",role:"radio",type:"radio"},e.toHandlers(p,!0)),null,16,Yt),e.createElementVNode("label",{for:t.id},[t.icon?(e.openBlock(),e.createElementBlock("span",Zt,e.toDisplayString(t.icon),1)):e.createCommentVNode("",!0),t.label?(e.openBlock(),e.createElementBlock("span",{key:1,textContent:e.toDisplayString(t.label),class:"text-label"},null,8,Wt)):e.createCommentVNode("",!0)],8,jt),h.value?(e.openBlock(),e.createElementBlock("label",{key:0,for:t.id,class:"slot-label cursor-pointer"},[e.renderSlot(S.$slots,"default",{disabled:t.disabled})],8,Gt)):e.createCommentVNode("",!0)],2))}}),Jt=["data-field-name"],Xt=["textContent"],Qt={key:1,class:"radio-button-group",role:"radiogroup"},_t=e.defineComponent({__name:"BSRadioButtonGroup",props:{name:{default:()=>L.generateNextName("radioGroup")},modelValue:{},items:{default:()=>[]},valueProvider:{},labelProvider:{},iconProvider:{},keyProvider:{},enabledItemProvider:{},tooltipProvider:{},tabindex:{default:0},disabled:{type:Boolean},viewMode:{type:Boolean},required:{type:Boolean},validationMessageRequired:{},extraValidationRules:{},ignoreSavePoint:{type:Boolean},hideErrorMessage:{type:Boolean},showErrorMessageOnDisabled:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:o}){const n=t,a=o,c=u=>Be(u,n.labelProvider,()=>String(u)),s=u=>n.valueProvider?n.valueProvider(u):u,h=u=>te(u,n.keyProvider,()=>String(s(u))),f=u=>n.enabledItemProvider?!n.enabledItemProvider(u):!1,p=e.computed(()=>{const u=n.items.find(i=>s(i)===n.modelValue);return u?c(u):""}),S=u=>{a("update:modelValue",u)};e.watch(()=>n.modelValue,()=>r(n.modelValue,"change"));const B=e.ref(),V=O(),b=async(u,i)=>{const m=[];return n.required&&u===void 0?m.push({code:"required",message:n.validationMessageRequired||"Required"}):u!==void 0&&await q(u,n.extraValidationRules,m,i,V),m},x=e.computed(()=>n.viewMode||n.disabled),{errors:y,validateValue:r}=H({field:B,disabled:x,initialValue:n.modelValue,isValid:b}),g=n.ignoreSavePoint?void 0:z(),E=g?.registerField({field:B,getCurrentValue:()=>n.modelValue,setCurrentValue:u=>a("update:modelValue",u)}),w=e.computed(()=>!!E?.isModified(n.modelValue));return e.onBeforeUnmount(()=>g?.unregisterField(B)),(u,i)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"field",ref:B,class:e.normalizeClass([{required:t.required,disabled:t.disabled,modified:w.value,error:e.unref(y).length>0},"bs-radio-button-group"]),"data-field-name":t.name},[t.viewMode?(e.openBlock(),e.createElementBlock("div",{key:0,textContent:e.toDisplayString(p.value)},null,8,Xt)):(e.openBlock(),e.createElementBlock("div",Qt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,m=>e.withDirectives((e.openBlock(),e.createBlock(Ve,{key:h(m),disabled:t.disabled||f(m),icon:t.iconProvider?.(m),"item-value":s(m),label:c(m),"model-value":t.modelValue,name:t.name,tabindex:t.tabindex,"onUpdate:modelValue":i[0]||(i[0]=l=>S(l))},null,8,["disabled","icon","item-value","label","model-value","name","tabindex"])),[[e.unref(G),{content:t.tooltipProvider?.(m)}]])),128))])),t.viewMode?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(R,{key:2,errors:e.unref(y),"hide-error-message":t.hideErrorMessage||t.disabled&&!t.showErrorMessageOnDisabled},null,8,["errors","hide-error-message"]))],10,Jt))}});function ne(t){return t!=null}function Ce(t){t.focus()}const we={mounted:(t,o)=>{(o.value===void 0||String(o.value)==="true"||typeof o.value=="number")&&(typeof o.value=="number"?setTimeout(()=>Ce(t),o.value):Ce(t))}},Me=(t,o)=>{let n;return(...a)=>new Promise((c,s)=>{n&&clearTimeout(n),n=setTimeout(()=>{try{const h=t(...a);c(h)}catch(h){s(h)}finally{n=void 0}},o)})},en={key:0,class:"popup-search pa-4"},tn=["data-value","onMouseover","onClick"],nn=["textContent"],on=["textContent"],Ee=e.defineComponent({__name:"BSSelectPopup",props:{items:{},initialItem:{},selectedItems:{},valueProvider:{},labelProvider:{},allowNull:{type:Boolean},nullLabel:{},maxHeight:{},showSearch:{type:[Boolean,String],default:"auto"},baseElement:{},popupAlign:{},popupDirection:{}},emits:["itemSelected","requestClose"],setup(t,{expose:o,emit:n}){const a=t,c=n,s=e.ref();e.watch(()=>a.items,async()=>{const l=await a.items,d=a.allowNull?[void 0,...l]:l;s.value=d.map(k=>{if(k!==void 0){const v=a.labelProvider(k),I=v?v.toLowerCase():"";return{original:k,value:a.valueProvider(k),label:v,keyword:I}}else return})},{immediate:!0});const h=e.computed(()=>a.showSearch==="auto"?s.value&&s.value.length>10:a.showSearch),f=e.ref(""),p=e.computed(()=>{if(s.value!==void 0)return f.value?s.value.filter(l=>l?.keyword?.includes(f.value)):s.value}),S=Me(l=>{f.value=l},300),B=l=>{const d=l.target.value.trim().toLowerCase();S(d)},V=l=>p.value?.findIndex(d=>d===void 0&&l===void 0?!0:d&&l?d.value===a.valueProvider(l):!1)??-1,b=()=>{if(p.value&&p.value.length>0){const l=Math.min(V(g.value)+1,p.value.length-1);E(p.value[l]?.original,l)}},x=()=>{if(p.value&&p.value.length>0){const l=Math.max(0,V(g.value)-1);E(p.value[l]?.original,l)}},y=()=>{m(g.value)},r=l=>{switch(l.key){case"Enter":y();break;case"ArrowDown":b();break;case"ArrowUp":x();break}},g=e.ref();g.value=a.initialItem;const E=(l,d)=>{g.value=l,d!==void 0&&u(d)},w=e.ref(),u=l=>{const d=w.value?.querySelectorAll(".popup-item")[l];if(w.value&&d){const k=w.value.getBoundingClientRect(),v=d.getBoundingClientRect();(v.top<k.top||v.bottom>k.bottom)&&(w.value.scrollTop=d.offsetTop-(w.value.offsetHeight-d.offsetHeight)/2)}};e.onMounted(async()=>{await e.nextTick(),await e.nextTick();const l=g.value||a.selectedItems?.[0];l&&u(V(l))});const i=l=>{const d=g.value;return d===void 0&&l===void 0?!0:d!==void 0&&l!==void 0?a.valueProvider(d)===a.valueProvider(l):!1},m=l=>{l&&s.value&&(l=s.value.filter(ne).find(d=>d&&d.value===a.valueProvider(l))?.original),c("itemSelected",l)};return o({handleKeyboard:r}),(l,d)=>(e.openBlock(),e.createBlock(J,{"base-element":t.baseElement,"max-height":t.maxHeight,"offset-from-base-element":4,"popup-align":t.popupAlign,"popup-direction":t.popupDirection,"extra-class":"bs-select-popup bs-layout-vertical",onRequestClose:d[2]||(d[2]=k=>c("requestClose")),onKeydown:e.withKeys(e.withModifiers(r,["stop","prevent"]),["enter","down","up"])},{default:e.withCtx(()=>[h.value?(e.openBlock(),e.createElementBlock("div",en,[e.withDirectives(e.createElementVNode("input",{type:"text",onInput:B,onKeydown:d[0]||(d[0]=e.withKeys(e.withModifiers(()=>{},["stop"]),["space"])),onClick:d[1]||(d[1]=e.withModifiers(()=>{},["stop"]))},null,544),[[e.unref(we)]])])):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"popupItems",ref:w,class:"popup-items grow h-full overflow-auto"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,k=>(e.openBlock(),e.createElementBlock("div",{key:k!==void 0?String(k):"",class:e.normalizeClass([{hovered:i(k?.original),"selected-item":k!==void 0&&t.selectedItems?.includes(k?.original)},"popup-item"]),"data-value":k?.value||"",onMouseover:v=>E(k?.original),onClick:e.withModifiers(v=>m(k?.original),["stop"])},[d[3]||(d[3]=e.createElementVNode("span",{class:"checkbox"},null,-1)),k!==void 0?(e.openBlock(),e.createElementBlock("label",{key:0,textContent:e.toDisplayString(k?.label),class:"label"},null,8,nn)):(e.openBlock(),e.createElementBlock("label",{key:1,textContent:e.toDisplayString(t.nullLabel),class:"label null-label"},null,8,on))],42,tn))),128))],512)]),_:1},8,["base-element","max-height","popup-align","popup-direction","onKeydown"]))}}),Se=(t,o)=>{t.vClickOutsideContext={enabled:o?.enabled??!0,handler:typeof o=="function"?o:o?.handler,insideElements:o?.insideElements}},an=(t,o)=>o?o.some(n=>{if(n instanceof HTMLElement)return n.contains(t);if(typeof n=="string")return document.querySelector(n)?.contains(t)}):!1,oe={mounted:(t,o)=>{const n=a=>{let c=a.target;if(!t.contains(c)){const s=t.vClickOutsideContext;s&&s.enabled&&(an(c,s.insideElements)||s.handler?.())}};t.vClickOutsideListener=n,Se(t,o.value),window.addEventListener("click",n)},updated:(t,o)=>{Se(t,o.value)},unmounted:t=>{const o=t.vClickOutsideListener;o&&window.removeEventListener("click",o),delete t.vClickOutsideContext}},ln=["tabindex","onKeydown"],rn=["textContent"],sn=["data-field-name"],dn=["textContent"],cn=["textContent"],un={key:2,class:"small-progress"},mn=e.defineComponent({__name:"BSSelect",props:{modelValue:{},items:{default:()=>[]},name:{},valueProvider:{type:Function,default:t=>t},labelProvider:{type:Function,default:ke},selectedLabelProvider:{},placeholder:{default:()=>""},allowNull:{type:Boolean},nullLabel:{},disabled:{type:Boolean},viewMode:{type:Boolean},tabindex:{default:0},required:{type:Boolean},validationMessageRequired:{},extraValidationRules:{},ignoreSavePoint:{type:Boolean},popupAlign:{},popupDirection:{},popupMaxHeight:{},showPopupSearch:{type:[Boolean,String],default:"auto"},hideErrorMessage:{type:Boolean},showErrorMessageOnDisabled:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:o}){const n=t,a=o,c=e.ref(),s=e.ref(!1);e.watch(()=>n.items,async()=>{s.value=!0,c.value=await n.items,s.value=!1},{immediate:!0});const h=$=>n.labelProvider?n.labelProvider($):String($),f=$=>n.valueProvider?n.valueProvider($):$,p=$=>$!==void 0?c.value?.find(N=>f(N)===$):void 0,S=e.computed(()=>!n.modelValue),B=e.computed(()=>p(n.modelValue)),V=e.computed(()=>B.value!==void 0?[B.value]:[]),b=e.computed(()=>B.value!==void 0?n.selectedLabelProvider?n.selectedLabelProvider(B.value):h(B.value):""),x=e.ref(!1),y=$=>{!n.disabled&&!n.viewMode&&(x.value=$===void 0?!x.value:$)},r=$=>{x.value?$.stopPropagation():y(!1)},g=e.ref(),E=$=>{x.value?g.value&&g.value.handleKeyboard($):y(!0)},w=$=>{const N=$?f($):void 0;a("update:modelValue",N),x.value=!1,i()},u=e.useTemplateRef("root"),i=()=>u.value?.focus();e.watch(()=>n.modelValue,()=>I(n.modelValue,"change"));const m=e.ref(),l=O(),d=async($,N)=>{const A=[];return n.required&&$===void 0?A.push({code:"required",message:n.validationMessageRequired||"Required"}):$!==void 0&&await q($,n.extraValidationRules,A,N,l),A},k=e.computed(()=>n.viewMode||n.disabled),{errors:v,validateValue:I}=H({field:m,disabled:k,initialValue:n.modelValue,isValid:d}),C=n.ignoreSavePoint?void 0:z(),P=C?.registerField({field:m,getCurrentValue:()=>n.modelValue,setCurrentValue:$=>a("update:modelValue",$)}),D=e.computed(()=>!!P?.isModified(n.modelValue));return e.onBeforeUnmount(()=>C?.unregisterField(m)),($,N)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",{ref:"root",class:e.normalizeClass([{"popup-open":x.value,disabled:t.disabled,modified:D.value,error:e.unref(v).length>0,empty:S.value,"view-mode":t.viewMode},"bs-select"]),tabindex:t.disabled?-1:t.tabindex,onClick:N[1]||(N[1]=A=>y()),onKeydown:[N[2]||(N[2]=e.withKeys(e.withModifiers(A=>y(),["stop","prevent"]),["space"])),e.withKeys(e.withModifiers(E,["stop","prevent"]),["enter","down","up"]),N[3]||(N[3]=e.withKeys(e.withModifiers(A=>{y(!1),i()},["stop","prevent"]),["esc"])),e.withKeys(r,["tab"])]},[t.viewMode?(e.openBlock(),e.createElementBlock("div",{key:0,textContent:e.toDisplayString(b.value)},null,8,rn)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",{ref_key:"field",ref:m,"data-field-name":t.name,class:"selected w-full",role:"listbox"},[B.value===void 0?(e.openBlock(),e.createElementBlock("span",{key:0,textContent:e.toDisplayString(t.placeholder),class:"placeholder grow"},null,8,dn)):(e.openBlock(),e.createElementBlock("span",{key:1,textContent:e.toDisplayString(b.value),class:"label"},null,8,cn)),N[4]||(N[4]=e.createElementVNode("span",{class:"dropdown-btn"},"expand_more",-1)),s.value?(e.openBlock(),e.createElementBlock("span",un,"progress_activity")):e.createCommentVNode("",!0)],8,sn),!t.disabled&&x.value?(e.openBlock(),e.createBlock(Ee,{key:0,ref_key:"selectPopup",ref:g,"allow-null":t.allowNull,"base-element":u.value,"initial-item":B.value,items:t.items,"label-provider":t.labelProvider,"max-height":t.popupMaxHeight,"null-label":t.nullLabel,"popup-align":t.popupAlign,"popup-direction":t.popupDirection,"selected-items":V.value,"show-search":t.showPopupSearch,"value-provider":t.valueProvider,onItemSelected:w,onRequestClose:N[0]||(N[0]=A=>{y(!1),i()})},null,8,["allow-null","base-element","initial-item","items","label-provider","max-height","null-label","popup-align","popup-direction","selected-items","show-search","value-provider"])):e.createCommentVNode("",!0),t.viewMode?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(R,{key:1,errors:e.unref(v),"hide-error-message":t.hideErrorMessage||t.disabled&&!t.showErrorMessageOnDisabled},null,8,["errors","hide-error-message"]))],64))],42,ln)),[[e.unref(oe),()=>y(!1)]])}}),fn=["tabindex","onKeydown"],hn={key:0},pn=["textContent"],gn=["textContent"],bn=["data-field-name"],yn=["textContent"],xn={key:1,class:"text-truncate"},kn=["textContent"],Bn=["textContent"],Vn={key:2,class:"small-progress"},Cn=e.defineComponent({__name:"BSMultiSelect",props:{modelValue:{default:()=>[]},items:{default:()=>[]},name:{},valueProvider:{type:Function,default:t=>t},labelProvider:{type:Function,default:ke},selectedLabelProvider:{},keyProvider:{},placeholder:{},tabindex:{default:0},disabled:{type:Boolean},viewMode:{type:Boolean},required:{type:Boolean},validationMessageRequired:{},extraValidationRules:{},ignoreSavePoint:{type:Boolean},popupAlign:{},popupDirection:{},popupMaxHeight:{},showPopupSearch:{type:[Boolean,String],default:"auto"},hideErrorMessage:{type:Boolean},showErrorMessageOnDisabled:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:o}){const n=t,a=o,c=e.ref(),s=e.ref(!1);e.watch(()=>n.items,async()=>{s.value=!0,c.value=await n.items,s.value=!1},{immediate:!0});const h=C=>Be(C,n.labelProvider,()=>String(C)),f=C=>n.valueProvider?n.valueProvider(C):C,p=C=>te(C,n.keyProvider,()=>String(C)),S=C=>C?c.value?.find(P=>f(P)===C):void 0,B=e.computed(()=>!n.modelValue||n.modelValue.length===0),V=e.computed(()=>n.modelValue.map(S).filter(ne)),b=e.ref(!1),x=C=>{!n.disabled&&!n.viewMode&&(b.value=C===void 0?!b.value:C)},y=e.ref(),r=C=>{b.value?y.value&&y.value.handleKeyboard(C):x(!0)},g=C=>{if(C&&c.value){let P=[...V.value];const D=P.indexOf(C);D>=0?P.splice(D,1):P=c.value.filter(N=>P.includes(N)||N===C);const $=P.map(f);a("update:modelValue",$)}},E=e.useTemplateRef("root");e.watch(()=>n.modelValue,()=>d(n.modelValue,"change"));const w=e.ref(),u=O(),i=async(C,P)=>{const D=[];return n.required&&(C===void 0||C.length===0)?D.push({code:"required",message:n.validationMessageRequired||"Required"}):C!==void 0&&await q(C,n.extraValidationRules,D,P,u),D},m=e.computed(()=>n.viewMode||n.disabled),{errors:l,validateValue:d}=H({field:w,disabled:m,initialValue:n.modelValue,isValid:i}),k=n.ignoreSavePoint?void 0:z(),v=k?.registerField({field:w,getCurrentValue:()=>[...n.modelValue],setCurrentValue:C=>a("update:modelValue",[...C||[]]),compare:(C,P)=>C?.toSorted().join(",")===P?.toSorted().join(",")}),I=e.computed(()=>!!v?.isModified(n.modelValue||[]));return e.onBeforeUnmount(()=>k?.unregisterField(w)),(C,P)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",{ref:"root",class:e.normalizeClass([{"popup-open":b.value,disabled:t.disabled,modified:I.value,error:e.unref(l).length>0,empty:B.value,"view-mode":t.viewMode},"bs-multi-select"]),tabindex:t.disabled?-1:t.tabindex,onClick:P[1]||(P[1]=D=>x()),onKeydown:[P[2]||(P[2]=e.withKeys(e.withModifiers(D=>x(),["stop","prevent"]),["space"])),e.withKeys(e.withModifiers(r,["stop","prevent"]),["enter","down","up"]),P[3]||(P[3]=e.withKeys(e.withModifiers(D=>x(!1),["stop","prevent"]),["esc"])),P[4]||(P[4]=e.withKeys(D=>x(!1),["tab"]))]},[t.viewMode?(e.openBlock(),e.createElementBlock("div",hn,[t.selectedLabelProvider?(e.openBlock(),e.createElementBlock("span",{key:0,textContent:e.toDisplayString(t.selectedLabelProvider(V.value)),class:"label"},null,8,pn)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(V.value,D=>(e.openBlock(),e.createElementBlock("span",{key:p(D),textContent:e.toDisplayString(h(D)),class:"label"},null,8,gn))),128))])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",{ref_key:"field",ref:w,"data-field-name":t.name,class:"selected w-full",role:"listbox"},[V.value.length===0?(e.openBlock(),e.createElementBlock("span",{key:0,textContent:e.toDisplayString(t.placeholder),class:"placeholder grow"},null,8,yn)):(e.openBlock(),e.createElementBlock("span",xn,[t.selectedLabelProvider?(e.openBlock(),e.createElementBlock("span",{key:0,textContent:e.toDisplayString(t.selectedLabelProvider(V.value)),class:"label"},null,8,kn)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(V.value,D=>(e.openBlock(),e.createElementBlock("span",{key:p(D),textContent:e.toDisplayString(h(D)),class:"label"},null,8,Bn))),128))])),P[5]||(P[5]=e.createElementVNode("span",{class:"dropdown-btn"},"expand_more",-1)),s.value?(e.openBlock(),e.createElementBlock("span",Vn,"progress_activity")):e.createCommentVNode("",!0)],8,bn),!t.disabled&&b.value?(e.openBlock(),e.createBlock(Ee,{key:0,ref_key:"selectPopup",ref:y,"base-element":E.value,"initial-item":V.value[0],items:t.items,"label-provider":t.labelProvider,"max-height":t.popupMaxHeight,"popup-align":t.popupAlign,"popup-direction":t.popupDirection,"selected-items":V.value,"show-search":t.showPopupSearch,"value-provider":t.valueProvider,onItemSelected:g,onRequestClose:P[0]||(P[0]=D=>x(!1))},null,8,["base-element","initial-item","items","label-provider","max-height","popup-align","popup-direction","selected-items","show-search","value-provider"])):e.createCommentVNode("",!0)],64)),t.viewMode?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(R,{key:2,errors:e.unref(l),"hide-error-message":t.hideErrorMessage||t.disabled&&!t.showErrorMessageOnDisabled},null,8,["errors","hide-error-message"]))],42,fn)),[[e.unref(oe),()=>x(!1)]])}}),wn=e.defineComponent({__name:"SlideDownTransition",setup(t){const o=f=>{f instanceof HTMLElement&&requestAnimationFrame(()=>{f.style.maxHeight="0px"})},n=f=>{f instanceof HTMLElement&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{f.style.maxHeight=`${f.scrollHeight}px`})})},a=f=>{f instanceof HTMLElement&&(f.style.maxHeight="none")},c=f=>{f instanceof HTMLElement&&requestAnimationFrame(()=>{f.style.maxHeight=`${f.scrollHeight}px`})},s=f=>{f instanceof HTMLElement&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{f.style.maxHeight="0px"})})},h=f=>{f instanceof HTMLElement&&(f.style.maxHeight="none")};return(f,p)=>(e.openBlock(),e.createBlock(e.Transition,{name:"slide-down",onEnter:n,onLeave:s,onBeforeEnter:o,onAfterEnter:a,onBeforeLeave:c,onAfterLeave:h},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"default")]),_:3}))}}),Mn={key:0,class:"card-layout-header bs-layout-horizontal flex-align-center"},En=["textContent"],Sn=e.defineComponent({__name:"BSCardLayout",props:{title:{},hideTitle:{type:Boolean},cardBodyClass:{}},setup(t){const o=e.ref(!0),n=()=>o.value=!o.value;return(a,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([{expanded:o.value},"bs-card-layout"])},[t.hideTitle?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Mn,[e.createElementVNode("span",{class:"expand-btn font-icon bs-clickable",onClick:n},"label"),e.createElementVNode("div",{textContent:e.toDisplayString(t.title),class:"card-layout-title"},null,8,En),c[0]||(c[0]=e.createElementVNode("div",{class:"grow"},null,-1)),e.createElementVNode("div",null,[e.renderSlot(a.$slots,"title-right")])])),e.createVNode(wn,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(t.cardBodyClass)},[e.renderSlot(a.$slots,"default")],2),[[e.vShow,o.value]])]),_:3})],2))}}),vn={class:"bs-notification-container"},Pn={class:"top-notification bs-layout-vertical-inline flex-align-center gap-4"},$n=["textContent"],Dn={class:"bottom-notification bs-layout-vertical-inline flex-align-end gap-4"},Nn={class:"tooltip-container"},In=e.defineComponent({__name:"BSNotificationContainer",setup(t){const o=e.ref(),n=(a,c)=>{T.value&&o.value&&!o.value.$el?.contains(c.relatedTarget)&&(T.value.cursorInTooltip=a,a||K())};return(a,c)=>(e.openBlock(),e.createElementBlock("div",vn,[e.createElementVNode("div",Pn,[e.createVNode(e.TransitionGroup,{name:"notification"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Le),s=>(e.openBlock(),e.createElementBlock("div",{key:s.entryId,textContent:e.toDisplayString(s.message),class:e.normalizeClass(s.style)},null,10,$n))),128))]),_:1})]),e.createElementVNode("div",Dn,[e.createVNode(e.TransitionGroup,{name:"alarm"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Fe),s=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.component),{key:s.entryId,"alarm-entry-id":s.entryId,class:"bs-alarm-frame"},null,8,["alarm-entry-id"]))),128))]),_:1})]),e.createElementVNode("div",Nn,[e.unref(T)?(e.openBlock(),e.createBlock(me,{key:0,ref_key:"tooltip",ref:o,content:e.unref(T).content,target:e.unref(T).target,onMouseout:c[0]||(c[0]=s=>n(!1,s)),onMouseover:c[1]||(c[1]=s=>n(!0,s))},null,8,["content","target"])):e.createCommentVNode("",!0)]),e.unref(Te)?(e.openBlock(),e.createBlock(ce,{key:0})):e.createCommentVNode("",!0)]))}}),Ln=["data-menu-id"],Fn=["textContent","href","target"],Tn=["data-menu-id"],zn=["textContent","data-menu-id","onMouseenter","onClick"],ve=e.defineComponent({__name:"BSContextMenu",props:{menuItems:{},popupId:{},baseElement:{},left:{},top:{},zIndex:{},direction:{}},emits:["menuClicked","requestClose"],setup(t,{emit:o}){const n=o,a=W(),c=V=>{V.disabled||V.children||(V.handler?.(),a.hideContextMenu(),n("menuClicked",V))},s=()=>{a.hideContextMenu()},h=()=>{B(),n("requestClose")},f=e.ref(),p=e.ref(),S=(V,b)=>{b.children?(p.value=V.target,f.value=b.children):(f.value=void 0,p.value=void 0)},B=()=>{a.hideContextMenu()};return(V,b)=>{const x=e.resolveComponent("router-link"),y=e.resolveComponent("BSContextMenu",!0);return e.openBlock(),e.createBlock(J,{ref:"root","base-element":t.baseElement||{left:t.left||0,top:t.top||0},"popup-direction":t.direction,"popup-id":t.popupId,"z-index":t.zIndex,"extra-class":"bs-context-menu",onRequestClose:h,onKeydown:e.withKeys(B,["esc"])},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.menuItems,r=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:r},[r.type==="separator"?(e.openBlock(),e.createElementBlock("div",{key:0,class:"menu separator",onClick:b[0]||(b[0]=e.withModifiers(()=>{},["stop"]))})):r.type==="custom"&&r.component?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.component),{key:1,class:"menu custom"})):r.type==="link"?(e.openBlock(),e.createElementBlock("div",{key:2,"data-menu-id":r.menuId,class:"menu no-padding","data-id":"context-menu-item"},[e.createElementVNode("a",{textContent:e.toDisplayString(r.caption),href:r.href,target:r.target,onClick:e.withModifiers(s,["stop"])},null,8,Fn)],8,Ln)):r.type==="route"?(e.openBlock(),e.createElementBlock("div",{key:3,"data-menu-id":r.menuId,class:"menu no-padding","data-id":"context-menu-item"},[e.createVNode(x,{textContent:e.toDisplayString(r.caption),to:r.href||"",onClick:e.withModifiers(s,["stop"])},null,8,["textContent","to"])],8,Tn)):(e.openBlock(),e.createElementBlock("div",{key:4,textContent:e.toDisplayString(r.caption),class:e.normalizeClass([{"has-submenu":r.children,disabled:r.disabled},"menu"]),"data-menu-id":r.menuId,"data-id":"context-menu-item",onMouseenter:g=>S(g,r),onClick:e.withModifiers(g=>c(r),["stop"])},null,42,zn))],64))),128)),f.value&&p.value?(e.openBlock(),e.createBlock(y,{key:0,"base-element":p.value,"menu-items":f.value,direction:"auto-right"},null,8,["base-element","menu-items"])):e.createCommentVNode("",!0)]),_:1},8,["base-element","popup-direction","popup-id","z-index"])}}}),On={class:"bs-context-menu-container"},Hn=e.defineComponent({__name:"BSContextMenuContainer",setup(t){const o=W(),n=e.computed(()=>o.contextMenuItems.value),a=e.computed(()=>o.position.value||{x:0,y:0}),c=e.computed(()=>o.options.value),s=()=>{o.hideContextMenu()};return(h,f)=>(e.openBlock(),e.createElementBlock("div",On,[n.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"context-menu-curtain",tabindex:"0",onClick:e.withModifiers(s,["prevent"]),onContextmenu:e.withModifiers(s,["prevent"])},null,32)):e.createCommentVNode("",!0),n.value?(e.openBlock(),e.createBlock(ve,{key:1,left:a.value.x,"menu-items":n.value,top:a.value.y,"z-index":c.value?.zIndex},null,8,["left","menu-items","top","z-index"])):e.createCommentVNode("",!0),f[0]||(f[0]=e.createElementVNode("div",{class:"bs-popup-container"},null,-1))]))}});M.BSButton=Re,M.BSCardLayout=Sn,M.BSCheckbox=xe,M.BSCheckboxGroup=Kt,M.BSContextMenu=ve,M.BSContextMenuContainer=Hn,M.BSContextMenuPlugin=Z,M.BSLoadingIcon=ce,M.BSMultiSelect=Cn,M.BSNotificationContainer=In,M.BSNumberInput=Nt,M.BSPageNavigation=Ke,M.BSPopup=J,M.BSRadioButton=Ve,M.BSRadioButtonGroup=_t,M.BSSelect=mn,M.BSTextArea=zt,M.BSTextInput=bt,M.BSTooltip=me,M.BlueseaPlugin=Ie,M.ContextMenuPluginKey=U,M.SavePointImpl=_,M.cancelProvidedSavePoint=lt,M.createContextMenuPlugin=$e,M.debounce=Me,M.notNull=ne,M.provideFieldContext=dt,M.provideSavePoint=at,M.tryUntil=Ge,M.useContextMenu=W,M.useContextMenuOptional=Pe,M.useFieldContext=O,M.useSavePoint=z,M.vClickOutside=oe,M.vFocusOnLoad=we,M.vTooltip=G,M.waitDuring=ue,M.waitUntil=We,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(global, factory) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue"), require("dayjs")) : typeof define === "function" && define.amd ? define(["exports", "vue", "dayjs"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.OpenBlueseaCore = {}, global.Vue, global.dayJs));
|
|
3
|
+
})(this, (function(exports2, vue, dayjs) {
|
|
4
|
+
"use strict";
|
|
5
|
+
const ContextMenuPluginKey = Symbol("BlueseaContextMenuPlugin");
|
|
6
|
+
class BSContextMenuPlugin {
|
|
7
|
+
contextMenuItems = vue.ref();
|
|
8
|
+
position = vue.ref();
|
|
9
|
+
options = vue.ref();
|
|
10
|
+
showContextMenu(event, menus, options) {
|
|
11
|
+
this.position.value = { x: event.clientX, y: event.clientY };
|
|
12
|
+
this.markComponentRaw(menus);
|
|
13
|
+
this.contextMenuItems.value = menus;
|
|
14
|
+
this.options.value = options;
|
|
15
|
+
}
|
|
16
|
+
hideContextMenu() {
|
|
17
|
+
if (this.options.value?.onHideContextMenu) {
|
|
18
|
+
this.options.value.onHideContextMenu();
|
|
19
|
+
}
|
|
20
|
+
this.contextMenuItems.value = void 0;
|
|
21
|
+
this.position.value = void 0;
|
|
22
|
+
this.options.value = void 0;
|
|
23
|
+
}
|
|
24
|
+
// install(app: AbstractApp) {
|
|
25
|
+
// app.provide(contextMenuPluginKey, this)
|
|
26
|
+
// }
|
|
27
|
+
markComponentRaw(menus) {
|
|
28
|
+
menus.forEach((menu) => {
|
|
29
|
+
if (menu.component)
|
|
30
|
+
menu.component = vue.markRaw(menu.component);
|
|
31
|
+
if (menu.children)
|
|
32
|
+
this.markComponentRaw(menu.children);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const useContextMenu = () => {
|
|
37
|
+
const contextMenu = vue.inject(ContextMenuPluginKey);
|
|
38
|
+
if (!contextMenu)
|
|
39
|
+
throw new Error("BSContextMenuPlugin is not initialized.");
|
|
40
|
+
return contextMenu;
|
|
41
|
+
};
|
|
42
|
+
const useContextMenuOptional = () => {
|
|
43
|
+
return vue.inject(ContextMenuPluginKey);
|
|
44
|
+
};
|
|
45
|
+
const createContextMenuPlugin = () => {
|
|
46
|
+
return new BSContextMenuPlugin();
|
|
47
|
+
};
|
|
48
|
+
class BlueseaConfig {
|
|
49
|
+
dateFormat = "YYYY-MM-DD HH:mm";
|
|
50
|
+
dateFormatDay = "YYYY-MM-DD";
|
|
51
|
+
dateFormatMinute = "YYYY-MM-DD HH:mm";
|
|
52
|
+
dateFormatSecond = "YYYY-MM-DD HH:mm:ss";
|
|
53
|
+
minDateValue = "1920-01-01T00:00:00.000Z";
|
|
54
|
+
maxDateValue = "9000-12-31T23:59:59.999Z";
|
|
55
|
+
timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
56
|
+
componentConfig;
|
|
57
|
+
constructor(config) {
|
|
58
|
+
this.dateFormat = config?.dateFormat || this.dateFormat;
|
|
59
|
+
this.dateFormatDay = config?.dateFormatDay || this.dateFormatDay;
|
|
60
|
+
this.dateFormatMinute = config?.dateFormatMinute || this.dateFormatMinute;
|
|
61
|
+
this.dateFormatSecond = config?.dateFormatSecond || this.dateFormatSecond;
|
|
62
|
+
this.minDateValue = config?.minDateValue || this.minDateValue;
|
|
63
|
+
this.maxDateValue = config?.maxDateValue || this.maxDateValue;
|
|
64
|
+
if (config?.timeZone)
|
|
65
|
+
this.timeZone = config.timeZone;
|
|
66
|
+
this.componentConfig = {
|
|
67
|
+
popup: { hideOnScroll: false, ...config?.componentConfig?.popup },
|
|
68
|
+
calendar: { startYear: "-20", endYear: "+20", ...config?.componentConfig?.calendar }
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
resolveDisplayDateFormat(format) {
|
|
72
|
+
const actualFormat = format || this.dateFormat;
|
|
73
|
+
if (actualFormat === "DAY")
|
|
74
|
+
return this.dateFormatDay;
|
|
75
|
+
else if (actualFormat === "MINUTE")
|
|
76
|
+
return this.dateFormatMinute;
|
|
77
|
+
else if (actualFormat === "SECOND")
|
|
78
|
+
return this.dateFormatSecond;
|
|
79
|
+
else
|
|
80
|
+
return actualFormat;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const BlueseaConfigKey = Symbol("BlueseaConfig");
|
|
84
|
+
const useBlueseaConfig = () => {
|
|
85
|
+
return vue.inject(BlueseaConfigKey);
|
|
86
|
+
};
|
|
87
|
+
const BlueseaPlugin = {
|
|
88
|
+
install(app, options) {
|
|
89
|
+
const config = new BlueseaConfig(options);
|
|
90
|
+
app.provide(BlueseaConfigKey, config);
|
|
91
|
+
const contextMenu = new BSContextMenuPlugin();
|
|
92
|
+
app.provide(ContextMenuPluginKey, contextMenu);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const notificationEntries = vue.reactive([]);
|
|
96
|
+
const alarmEntries = vue.reactive([]);
|
|
97
|
+
const tooltipEntry = vue.ref();
|
|
98
|
+
const showTooltip = (content, target) => {
|
|
99
|
+
tooltipEntry.value = {
|
|
100
|
+
content,
|
|
101
|
+
target: vue.markRaw(target),
|
|
102
|
+
cursorInTooltip: false
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
const hideTooltip = () => {
|
|
106
|
+
if (tooltipEntry.value && !tooltipEntry.value.cursorInTooltip) {
|
|
107
|
+
tooltipEntry.value = void 0;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const isTooltipDisplayed = () => {
|
|
111
|
+
return !!tooltipEntry.value;
|
|
112
|
+
};
|
|
113
|
+
const showLoadingIcon = vue.ref(false);
|
|
114
|
+
const DEFAULT_TOOLTIP_SHOW_DELAY = 800;
|
|
115
|
+
const DEFAULT_TOOLTIP_HIDE_DELAY = 0;
|
|
116
|
+
const setTooltipParam = (el, param) => {
|
|
117
|
+
if (param && param.content) {
|
|
118
|
+
el.setAttribute("data-bs-tooltip-data", JSON.stringify(param));
|
|
119
|
+
if (isTooltipDisplayed())
|
|
120
|
+
showTooltip(param.content, el);
|
|
121
|
+
} else {
|
|
122
|
+
el.removeAttribute("data-bs-tooltip-data");
|
|
123
|
+
if (isTooltipDisplayed())
|
|
124
|
+
hideTooltip();
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const vTooltip = {
|
|
128
|
+
mounted: (el, binding) => {
|
|
129
|
+
setTooltipParam(el, binding.value);
|
|
130
|
+
el.addEventListener("mouseover", () => {
|
|
131
|
+
const json = el.getAttribute("data-bs-tooltip-data");
|
|
132
|
+
const param = json ? JSON.parse(json) : void 0;
|
|
133
|
+
if (param && param.content) {
|
|
134
|
+
el.setAttribute("data-bs-tooltip", "true");
|
|
135
|
+
setTimeout(() => {
|
|
136
|
+
const json2 = el.getAttribute("data-bs-tooltip-data");
|
|
137
|
+
const param2 = json2 ? JSON.parse(json2) : void 0;
|
|
138
|
+
if (param2 && param2.content && el.getAttribute("data-bs-tooltip") === "true" && window.document.contains(el)) {
|
|
139
|
+
showTooltip(param2.content, el);
|
|
140
|
+
}
|
|
141
|
+
}, param.delay || DEFAULT_TOOLTIP_SHOW_DELAY);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
el.addEventListener("mouseout", (event) => {
|
|
145
|
+
if (!el.contains(event.relatedTarget)) {
|
|
146
|
+
el.removeAttribute("data-bs-tooltip");
|
|
147
|
+
setTimeout(() => hideTooltip(), DEFAULT_TOOLTIP_HIDE_DELAY);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
},
|
|
151
|
+
updated: (el, binding) => {
|
|
152
|
+
setTooltipParam(el, binding.value);
|
|
153
|
+
},
|
|
154
|
+
unmounted: () => {
|
|
155
|
+
hideTooltip();
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
const _hoisted_1$q = ["textContent"];
|
|
159
|
+
const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
160
|
+
__name: "BSButton",
|
|
161
|
+
props: {
|
|
162
|
+
caption: {},
|
|
163
|
+
buttonColor: { default: "default" },
|
|
164
|
+
leftIcon: {},
|
|
165
|
+
rightIcon: {},
|
|
166
|
+
disabled: { type: Boolean, default: false },
|
|
167
|
+
linkUrl: {},
|
|
168
|
+
linkTarget: {},
|
|
169
|
+
routePath: {},
|
|
170
|
+
tooltip: {}
|
|
171
|
+
},
|
|
172
|
+
setup(__props) {
|
|
173
|
+
return (_ctx, _cache) => {
|
|
174
|
+
return vue.withDirectives((vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(__props.linkUrl ? "a" : __props.routePath ? "router-link" : "button"), {
|
|
175
|
+
class: vue.normalizeClass([[__props.buttonColor], "bs-button position-relative"]),
|
|
176
|
+
disabled: __props.disabled,
|
|
177
|
+
href: __props.linkUrl,
|
|
178
|
+
target: __props.linkTarget,
|
|
179
|
+
to: __props.routePath
|
|
180
|
+
}, {
|
|
181
|
+
default: vue.withCtx(() => [
|
|
182
|
+
__props.leftIcon ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
183
|
+
key: 0,
|
|
184
|
+
class: vue.normalizeClass([{ "mr-1": !!__props.caption }, "font-icon left"])
|
|
185
|
+
}, vue.toDisplayString(__props.leftIcon), 3)) : vue.createCommentVNode("", true),
|
|
186
|
+
vue.createElementVNode("span", {
|
|
187
|
+
textContent: vue.toDisplayString(__props.caption)
|
|
188
|
+
}, null, 8, _hoisted_1$q),
|
|
189
|
+
__props.rightIcon ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
190
|
+
key: 1,
|
|
191
|
+
class: vue.normalizeClass([{ "ml-1": !!__props.caption }, "font-icon right"])
|
|
192
|
+
}, vue.toDisplayString(__props.rightIcon), 3)) : vue.createCommentVNode("", true)
|
|
193
|
+
]),
|
|
194
|
+
_: 1
|
|
195
|
+
}, 8, ["class", "disabled", "href", "target", "to"])), [
|
|
196
|
+
[vue.unref(vTooltip), { content: __props.tooltip }]
|
|
197
|
+
]);
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
const _hoisted_1$p = { class: "page-navigation" };
|
|
202
|
+
const _hoisted_2$l = ["data-page", "onClick"];
|
|
203
|
+
const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
|
|
204
|
+
__name: "BSPageNavigation",
|
|
205
|
+
props: {
|
|
206
|
+
totalCount: { default: 0 },
|
|
207
|
+
offset: { default: 0 },
|
|
208
|
+
limit: { default: 10 },
|
|
209
|
+
visiblePageCount: { default: 10 },
|
|
210
|
+
maxPage: {}
|
|
211
|
+
},
|
|
212
|
+
emits: ["offsetChanged"],
|
|
213
|
+
setup(__props, { emit: __emit }) {
|
|
214
|
+
const props = __props;
|
|
215
|
+
const emit = __emit;
|
|
216
|
+
const totalPage = vue.computed(() => {
|
|
217
|
+
const totalPage2 = Math.floor((props.totalCount - 1) / props.limit) + 1;
|
|
218
|
+
if (props.totalCount < 1) return 1;
|
|
219
|
+
if (props.maxPage && totalPage2 > props.maxPage) return props.maxPage;
|
|
220
|
+
return totalPage2 || 0;
|
|
221
|
+
});
|
|
222
|
+
const currentPage = vue.computed(() => {
|
|
223
|
+
return Math.min(Math.floor(props.offset / props.limit) + 1, totalPage.value);
|
|
224
|
+
});
|
|
225
|
+
const currentSetFirstPage = vue.computed(() => {
|
|
226
|
+
return Math.floor((currentPage.value - 1) / props.visiblePageCount) * props.visiblePageCount + 1;
|
|
227
|
+
});
|
|
228
|
+
const currentSetLastPage = vue.computed(() => {
|
|
229
|
+
return Math.min(currentSetFirstPage.value + props.visiblePageCount - 1, totalPage.value);
|
|
230
|
+
});
|
|
231
|
+
const visiblePages = vue.computed(() => {
|
|
232
|
+
if (props.totalCount <= 0) return [];
|
|
233
|
+
const first = currentSetFirstPage.value;
|
|
234
|
+
const last = currentSetLastPage.value;
|
|
235
|
+
const pages = Array(last - first + 1);
|
|
236
|
+
for (let i = 0; i < pages.length; i++) pages[i] = i + first;
|
|
237
|
+
return pages;
|
|
238
|
+
});
|
|
239
|
+
const prevArrowPage = vue.computed(() => {
|
|
240
|
+
return currentSetFirstPage.value - 1;
|
|
241
|
+
});
|
|
242
|
+
const nextArrowPage = vue.computed(() => {
|
|
243
|
+
return currentSetLastPage.value + 1;
|
|
244
|
+
});
|
|
245
|
+
const isFirstSet = vue.computed(() => {
|
|
246
|
+
return currentSetFirstPage.value <= 1;
|
|
247
|
+
});
|
|
248
|
+
const isLastSet = vue.computed(() => {
|
|
249
|
+
return currentSetLastPage.value >= totalPage.value;
|
|
250
|
+
});
|
|
251
|
+
const goToPage = (page) => {
|
|
252
|
+
const normalized = Math.max(1, Math.min(page, totalPage.value));
|
|
253
|
+
if (currentPage.value !== normalized) {
|
|
254
|
+
const offset = (normalized - 1) * props.limit;
|
|
255
|
+
emit(
|
|
256
|
+
"offsetChanged",
|
|
257
|
+
offset,
|
|
258
|
+
{ offset: props.offset, limit: props.limit, totalCount: props.totalCount }
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
return (_ctx, _cache) => {
|
|
263
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$p, [
|
|
264
|
+
vue.createElementVNode("span", {
|
|
265
|
+
class: vue.normalizeClass([{ "disabled": isFirstSet.value }, "font-icon first"]),
|
|
266
|
+
onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => !isFirstSet.value && goToPage(1), ["prevent"]))
|
|
267
|
+
}, "keyboard_double_arrow_left", 2),
|
|
268
|
+
vue.createElementVNode("span", {
|
|
269
|
+
class: vue.normalizeClass([{ "disabled": isFirstSet.value }, "font-icon prev"]),
|
|
270
|
+
onClick: _cache[1] || (_cache[1] = vue.withModifiers(($event) => !isFirstSet.value && goToPage(prevArrowPage.value), ["prevent"]))
|
|
271
|
+
}, "keyboard_arrow_left", 2),
|
|
272
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(visiblePages.value, (page) => {
|
|
273
|
+
return vue.openBlock(), vue.createElementBlock("span", {
|
|
274
|
+
key: page,
|
|
275
|
+
class: vue.normalizeClass([{ on: page === currentPage.value }, "page"]),
|
|
276
|
+
"data-page": page,
|
|
277
|
+
onClick: vue.withModifiers(($event) => goToPage(page), ["prevent"])
|
|
278
|
+
}, vue.toDisplayString(page), 11, _hoisted_2$l);
|
|
279
|
+
}), 128)),
|
|
280
|
+
vue.createElementVNode("span", {
|
|
281
|
+
class: vue.normalizeClass([{ "disabled": isLastSet.value }, "font-icon next"]),
|
|
282
|
+
onClick: _cache[2] || (_cache[2] = vue.withModifiers(($event) => !isLastSet.value && goToPage(nextArrowPage.value), ["prevent"]))
|
|
283
|
+
}, "keyboard_arrow_right", 2),
|
|
284
|
+
vue.createElementVNode("span", {
|
|
285
|
+
class: vue.normalizeClass([{ "disabled": isLastSet.value }, "font-icon last"]),
|
|
286
|
+
onClick: _cache[3] || (_cache[3] = vue.withModifiers(($event) => !isLastSet.value && goToPage(totalPage.value), ["prevent"]))
|
|
287
|
+
}, "keyboard_double_arrow_right", 2)
|
|
288
|
+
]);
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
const _export_sfc = (sfc, props) => {
|
|
293
|
+
const target = sfc.__vccOpts || sfc;
|
|
294
|
+
for (const [key, val] of props) {
|
|
295
|
+
target[key] = val;
|
|
296
|
+
}
|
|
297
|
+
return target;
|
|
298
|
+
};
|
|
299
|
+
const _sfc_main$p = {};
|
|
300
|
+
const _hoisted_1$o = { class: "bs-loading-icon" };
|
|
301
|
+
function _sfc_render(_ctx, _cache) {
|
|
302
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$o, [..._cache[0] || (_cache[0] = [
|
|
303
|
+
vue.createElementVNode("span", { class: "font-icon" }, "progress_activity", -1)
|
|
304
|
+
])]);
|
|
305
|
+
}
|
|
306
|
+
const BSLoadingIcon = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_render]]);
|
|
307
|
+
const waitUntil = async (condition, intervalMilliseconds = 200, maxTrial = 15) => {
|
|
308
|
+
return await new Promise((resolve) => {
|
|
309
|
+
let tried = 0;
|
|
310
|
+
const interval = setInterval(() => {
|
|
311
|
+
if (tried > maxTrial || condition()) {
|
|
312
|
+
clearInterval(interval);
|
|
313
|
+
resolve(void 0);
|
|
314
|
+
}
|
|
315
|
+
tried++;
|
|
316
|
+
}, intervalMilliseconds);
|
|
317
|
+
});
|
|
318
|
+
};
|
|
319
|
+
const waitDuring = async (milliSec = 2e3) => {
|
|
320
|
+
return new Promise((resolve) => setTimeout(resolve, milliSec));
|
|
321
|
+
};
|
|
322
|
+
const tryUntil = (until, tryCall, intervalMilliseconds = 200, maxTrial = 15) => {
|
|
323
|
+
let tried = 0;
|
|
324
|
+
const interval = setInterval(() => {
|
|
325
|
+
tried > maxTrial || until() ? clearInterval(interval) : tryCall?.();
|
|
326
|
+
tried++;
|
|
327
|
+
}, intervalMilliseconds);
|
|
328
|
+
};
|
|
329
|
+
const _hoisted_1$n = ["data-popup-id"];
|
|
330
|
+
const ADJUST_OFFSET = 8;
|
|
331
|
+
const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
|
|
332
|
+
__name: "BSPopup",
|
|
333
|
+
props: {
|
|
334
|
+
popupId: {},
|
|
335
|
+
maxHeight: { default: "360px" },
|
|
336
|
+
baseElement: {},
|
|
337
|
+
offsetFromBaseElement: {},
|
|
338
|
+
extraClass: {},
|
|
339
|
+
popupDirection: { default: "auto-down" },
|
|
340
|
+
popupAlign: { default: "auto" },
|
|
341
|
+
zIndex: {}
|
|
342
|
+
},
|
|
343
|
+
emits: ["requestClose", "click", "keydown"],
|
|
344
|
+
setup(__props, { emit: __emit }) {
|
|
345
|
+
const props = __props;
|
|
346
|
+
const emit = __emit;
|
|
347
|
+
const blueseaConfig = useBlueseaConfig();
|
|
348
|
+
const popupContainer = blueseaConfig?.componentConfig?.popup?.container || ".bs-popup-container";
|
|
349
|
+
const root = vue.ref();
|
|
350
|
+
let baseElementRect = void 0;
|
|
351
|
+
const left = vue.ref("-100000px");
|
|
352
|
+
const top = vue.ref("-100000px");
|
|
353
|
+
const calculateBaseElementRect = () => {
|
|
354
|
+
return props.baseElement instanceof HTMLElement ? getElementPosition(props.baseElement) : props.baseElement ? getPositionRect(props.baseElement) : { left: 0, top: 0, right: 0, bottom: 0, width: 0, height: 0 };
|
|
355
|
+
};
|
|
356
|
+
vue.onMounted(async () => {
|
|
357
|
+
await waitDuring(10);
|
|
358
|
+
if (props.baseElement && root.value) {
|
|
359
|
+
baseElementRect = calculateBaseElementRect();
|
|
360
|
+
const rootRect = root.value.getBoundingClientRect();
|
|
361
|
+
const pos = calculatePosition(
|
|
362
|
+
baseElementRect,
|
|
363
|
+
rootRect,
|
|
364
|
+
props.popupDirection,
|
|
365
|
+
props.popupAlign
|
|
366
|
+
);
|
|
367
|
+
top.value = `${pos.top}px`;
|
|
368
|
+
left.value = `${pos.left}px`;
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
const positionDelta = vue.ref({ x: 0, y: 0 });
|
|
372
|
+
const transform = vue.computed(() => {
|
|
373
|
+
return `translate(${positionDelta.value.x}px, ${positionDelta.value.y}px)`;
|
|
374
|
+
});
|
|
375
|
+
const getElementPosition = (el) => {
|
|
376
|
+
const dom = el.getBoundingClientRect();
|
|
377
|
+
const rect = {
|
|
378
|
+
left: dom.left,
|
|
379
|
+
top: dom.top,
|
|
380
|
+
right: dom.right,
|
|
381
|
+
bottom: dom.bottom,
|
|
382
|
+
width: dom.width,
|
|
383
|
+
height: dom.height
|
|
384
|
+
};
|
|
385
|
+
let cur = el.offsetParent;
|
|
386
|
+
while (cur) {
|
|
387
|
+
rect.top -= cur.scrollTop || 0;
|
|
388
|
+
rect.bottom -= cur.scrollTop || 0;
|
|
389
|
+
rect.left -= cur.scrollLeft || 0;
|
|
390
|
+
rect.right -= cur.scrollLeft || 0;
|
|
391
|
+
cur = cur.offsetParent;
|
|
392
|
+
}
|
|
393
|
+
return rect;
|
|
394
|
+
};
|
|
395
|
+
const getPositionRect = (base) => {
|
|
396
|
+
return {
|
|
397
|
+
left: base.left,
|
|
398
|
+
top: base.top,
|
|
399
|
+
right: base.left,
|
|
400
|
+
bottom: base.top,
|
|
401
|
+
width: 0,
|
|
402
|
+
height: 0
|
|
403
|
+
};
|
|
404
|
+
};
|
|
405
|
+
const calculatePosition = (rect, rootRect, direction, align) => {
|
|
406
|
+
if (direction === "auto-down") {
|
|
407
|
+
if (rect.bottom + rootRect.height + (props.offsetFromBaseElement || 0) > window.innerHeight) {
|
|
408
|
+
if (rect.top - rootRect.height - (props.offsetFromBaseElement || 0) < 0) {
|
|
409
|
+
const offset = rect.bottom + rootRect.height + (props.offsetFromBaseElement || 0) - window.innerHeight;
|
|
410
|
+
return {
|
|
411
|
+
// down 인데 top 위치를 약간 조절함
|
|
412
|
+
top: rect.bottom + (props.offsetFromBaseElement || 0) - offset - ADJUST_OFFSET,
|
|
413
|
+
left: calculateAlign(rect, rootRect, align)
|
|
414
|
+
};
|
|
415
|
+
} else {
|
|
416
|
+
return {
|
|
417
|
+
// up
|
|
418
|
+
top: rect.top - rootRect.height - (props.offsetFromBaseElement || 0),
|
|
419
|
+
left: calculateAlign(rect, rootRect, align)
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
} else {
|
|
423
|
+
return {
|
|
424
|
+
// down
|
|
425
|
+
top: rect.bottom + (props.offsetFromBaseElement || 0),
|
|
426
|
+
left: calculateAlign(rect, rootRect, align)
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
} else if (direction === "down") {
|
|
430
|
+
return {
|
|
431
|
+
top: rect.bottom + (props.offsetFromBaseElement || 0),
|
|
432
|
+
left: calculateAlign(rect, rootRect, align)
|
|
433
|
+
};
|
|
434
|
+
} else if (direction === "up") {
|
|
435
|
+
return {
|
|
436
|
+
top: rect.top - rootRect.height - (props.offsetFromBaseElement || 0),
|
|
437
|
+
left: calculateAlign(rect, rootRect, align)
|
|
438
|
+
};
|
|
439
|
+
} else if (direction === "auto-right") {
|
|
440
|
+
if (rect.right + rootRect.width > window.innerWidth) {
|
|
441
|
+
return { top: rect.top, left: rect.left - rootRect.width };
|
|
442
|
+
} else {
|
|
443
|
+
return { top: rect.top, left: rect.right };
|
|
444
|
+
}
|
|
445
|
+
} else if (direction === "right") {
|
|
446
|
+
return { top: rect.top, left: rect.right };
|
|
447
|
+
} else {
|
|
448
|
+
return { left: 0, top: 0 };
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
const calculateAlign = (rect, rootRect, align) => {
|
|
452
|
+
if (align === "auto") {
|
|
453
|
+
if (rect.left + rootRect.width > window.innerWidth) {
|
|
454
|
+
if (rect.right - rootRect.width < 0) {
|
|
455
|
+
return rect.left;
|
|
456
|
+
} else {
|
|
457
|
+
return rect.left - (rootRect.width - rect.width);
|
|
458
|
+
}
|
|
459
|
+
} else {
|
|
460
|
+
return rect.left;
|
|
461
|
+
}
|
|
462
|
+
} else if (align === "center") {
|
|
463
|
+
return rect.left - (rootRect.width - rect.width) / 2;
|
|
464
|
+
} else if (align === "left") {
|
|
465
|
+
return rect.left;
|
|
466
|
+
} else if (align === "right") {
|
|
467
|
+
return rect.left - (rootRect.width - rect.width);
|
|
468
|
+
} else {
|
|
469
|
+
return 0;
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
const emitClose = () => {
|
|
473
|
+
emit("requestClose");
|
|
474
|
+
};
|
|
475
|
+
const scrollableParents = [];
|
|
476
|
+
const handleParentScroll = () => {
|
|
477
|
+
if (blueseaConfig?.componentConfig?.popup?.hideOnScroll) {
|
|
478
|
+
emitClose();
|
|
479
|
+
} else if (baseElementRect) {
|
|
480
|
+
const newRect = calculateBaseElementRect();
|
|
481
|
+
positionDelta.value.x = newRect.left - baseElementRect.left;
|
|
482
|
+
positionDelta.value.y = newRect.top - baseElementRect.top;
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
vue.onMounted(() => {
|
|
486
|
+
if (props.baseElement instanceof HTMLElement) {
|
|
487
|
+
window.addEventListener("scroll", handleParentScroll, { passive: true });
|
|
488
|
+
if (props.baseElement instanceof HTMLElement) {
|
|
489
|
+
let cur = props.baseElement;
|
|
490
|
+
while (cur) {
|
|
491
|
+
if (cur.scrollHeight > cur.clientHeight || cur.scrollWidth > cur.clientWidth) {
|
|
492
|
+
scrollableParents.push(cur);
|
|
493
|
+
}
|
|
494
|
+
cur = cur.parentElement;
|
|
495
|
+
}
|
|
496
|
+
scrollableParents.forEach(
|
|
497
|
+
(el) => el.addEventListener("scroll", handleParentScroll, { passive: true })
|
|
498
|
+
);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
vue.onBeforeUnmount(() => {
|
|
503
|
+
window.removeEventListener("scroll", handleParentScroll);
|
|
504
|
+
scrollableParents.forEach(
|
|
505
|
+
(el) => el.removeEventListener("scroll", handleParentScroll)
|
|
506
|
+
);
|
|
507
|
+
});
|
|
508
|
+
return (_ctx, _cache) => {
|
|
509
|
+
return vue.openBlock(), vue.createBlock(vue.Teleport, { to: vue.unref(popupContainer) }, [
|
|
510
|
+
vue.createVNode(vue.Transition, null, {
|
|
511
|
+
default: vue.withCtx(() => [
|
|
512
|
+
vue.createElementVNode("div", {
|
|
513
|
+
ref_key: "root",
|
|
514
|
+
ref: root,
|
|
515
|
+
class: vue.normalizeClass([__props.extraClass, "bs-popup overflow-auto"]),
|
|
516
|
+
"data-popup-id": __props.popupId,
|
|
517
|
+
style: vue.normalizeStyle({ maxHeight: __props.maxHeight, top: top.value, left: left.value, zIndex: __props.zIndex, transform: transform.value }),
|
|
518
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emit("click", $event)),
|
|
519
|
+
onKeydown: _cache[1] || (_cache[1] = ($event) => emit("keydown", $event))
|
|
520
|
+
}, [
|
|
521
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
522
|
+
], 46, _hoisted_1$n)
|
|
523
|
+
]),
|
|
524
|
+
_: 3
|
|
525
|
+
})
|
|
526
|
+
], 8, ["to"]);
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
const _hoisted_1$m = ["textContent"];
|
|
531
|
+
const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
|
|
532
|
+
__name: "BSTooltip",
|
|
533
|
+
props: {
|
|
534
|
+
align: { default: "center" },
|
|
535
|
+
content: {},
|
|
536
|
+
target: {}
|
|
537
|
+
},
|
|
538
|
+
setup(__props) {
|
|
539
|
+
const props = __props;
|
|
540
|
+
const positionStyle = vue.computed(() => {
|
|
541
|
+
const result = {};
|
|
542
|
+
if (props.target) {
|
|
543
|
+
const rect = props.target.getBoundingClientRect();
|
|
544
|
+
result.top = `${rect.bottom + 8}px`;
|
|
545
|
+
if (props.align === "left") result.left = `${rect.left}px`;
|
|
546
|
+
else if (props.align === "right") result.right = `${rect.right}px`;
|
|
547
|
+
else result.left = `${(rect.left + rect.right) / 2}px`;
|
|
548
|
+
}
|
|
549
|
+
return result;
|
|
550
|
+
});
|
|
551
|
+
return (_ctx, _cache) => {
|
|
552
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
553
|
+
class: vue.normalizeClass([__props.align, "bs-tooltip"]),
|
|
554
|
+
style: vue.normalizeStyle(positionStyle.value)
|
|
555
|
+
}, [
|
|
556
|
+
vue.createElementVNode("div", {
|
|
557
|
+
textContent: vue.toDisplayString(__props.content)
|
|
558
|
+
}, null, 8, _hoisted_1$m)
|
|
559
|
+
], 6);
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
});
|
|
563
|
+
function notNull(value) {
|
|
564
|
+
return value !== null && value !== void 0;
|
|
565
|
+
}
|
|
566
|
+
function doFocus(el) {
|
|
567
|
+
el.focus();
|
|
568
|
+
}
|
|
569
|
+
const vFocusOnLoad = {
|
|
570
|
+
mounted: (el, binding) => {
|
|
571
|
+
if (binding.value === void 0 || String(binding.value) === "true" || typeof binding.value === "number") {
|
|
572
|
+
if (typeof binding.value === "number") {
|
|
573
|
+
setTimeout(() => doFocus(el), binding.value);
|
|
574
|
+
} else {
|
|
575
|
+
doFocus(el);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
};
|
|
580
|
+
const debounce = (func, wait) => {
|
|
581
|
+
let timeout;
|
|
582
|
+
return (...args) => {
|
|
583
|
+
return new Promise((resolve, reject) => {
|
|
584
|
+
if (timeout) {
|
|
585
|
+
clearTimeout(timeout);
|
|
586
|
+
}
|
|
587
|
+
timeout = setTimeout(() => {
|
|
588
|
+
try {
|
|
589
|
+
const result = func(...args);
|
|
590
|
+
resolve(result);
|
|
591
|
+
} catch (error) {
|
|
592
|
+
reject(error);
|
|
593
|
+
} finally {
|
|
594
|
+
timeout = void 0;
|
|
595
|
+
}
|
|
596
|
+
}, wait);
|
|
597
|
+
});
|
|
598
|
+
};
|
|
599
|
+
};
|
|
600
|
+
const _hoisted_1$l = {
|
|
601
|
+
key: 0,
|
|
602
|
+
class: "popup-search"
|
|
603
|
+
};
|
|
604
|
+
const _hoisted_2$k = ["data-value", "onMouseover", "onClick"];
|
|
605
|
+
const _hoisted_3$g = ["textContent"];
|
|
606
|
+
const _hoisted_4$a = ["textContent"];
|
|
607
|
+
const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
608
|
+
__name: "BSSelectPopup",
|
|
609
|
+
props: {
|
|
610
|
+
items: {},
|
|
611
|
+
initialItem: {},
|
|
612
|
+
selectedItems: {},
|
|
613
|
+
valueProvider: {},
|
|
614
|
+
labelProvider: {},
|
|
615
|
+
allowNull: { type: Boolean },
|
|
616
|
+
nullLabel: {},
|
|
617
|
+
maxHeight: {},
|
|
618
|
+
showSearch: { type: [Boolean, String], default: "auto" },
|
|
619
|
+
baseElement: {},
|
|
620
|
+
popupAlign: {},
|
|
621
|
+
popupDirection: {}
|
|
622
|
+
},
|
|
623
|
+
emits: ["itemSelected", "requestClose"],
|
|
624
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
625
|
+
const props = __props;
|
|
626
|
+
const emit = __emit;
|
|
627
|
+
const allItems = vue.ref();
|
|
628
|
+
vue.watch(
|
|
629
|
+
() => props.items,
|
|
630
|
+
async () => {
|
|
631
|
+
const items = await props.items;
|
|
632
|
+
const nullAddedItems = props.allowNull ? [void 0, ...items] : items;
|
|
633
|
+
allItems.value = nullAddedItems.map((item) => {
|
|
634
|
+
if (item !== void 0) {
|
|
635
|
+
const label = props.labelProvider(item);
|
|
636
|
+
const keyword = label ? label.toLowerCase() : "";
|
|
637
|
+
return {
|
|
638
|
+
original: item,
|
|
639
|
+
value: props.valueProvider(item),
|
|
640
|
+
label,
|
|
641
|
+
keyword
|
|
642
|
+
};
|
|
643
|
+
} else return void 0;
|
|
644
|
+
});
|
|
645
|
+
},
|
|
646
|
+
{ immediate: true }
|
|
647
|
+
);
|
|
648
|
+
const actualShowSearch = vue.computed(() => {
|
|
649
|
+
if (props.showSearch === "auto") {
|
|
650
|
+
return allItems.value && allItems.value.length > 10;
|
|
651
|
+
} else return props.showSearch;
|
|
652
|
+
});
|
|
653
|
+
const searchKeyword = vue.ref("");
|
|
654
|
+
const filteredItems = vue.computed(() => {
|
|
655
|
+
if (allItems.value === void 0) return void 0;
|
|
656
|
+
if (searchKeyword.value) {
|
|
657
|
+
return allItems.value.filter(
|
|
658
|
+
(item) => item?.keyword?.includes(searchKeyword.value)
|
|
659
|
+
);
|
|
660
|
+
} else return allItems.value;
|
|
661
|
+
});
|
|
662
|
+
const doSetSearchKeyword = debounce((keyword) => {
|
|
663
|
+
searchKeyword.value = keyword;
|
|
664
|
+
}, 300);
|
|
665
|
+
const setSearchKeyword = (event) => {
|
|
666
|
+
const keyword = event.target.value.trim().toLowerCase();
|
|
667
|
+
doSetSearchKeyword(keyword);
|
|
668
|
+
};
|
|
669
|
+
const findItemIndex = (target) => {
|
|
670
|
+
return filteredItems.value?.findIndex((item) => {
|
|
671
|
+
if (item === void 0 && target === void 0) return true;
|
|
672
|
+
else if (item && target) return item.value === props.valueProvider(target);
|
|
673
|
+
else return false;
|
|
674
|
+
}) ?? -1;
|
|
675
|
+
};
|
|
676
|
+
const nextPopupItem = () => {
|
|
677
|
+
if (filteredItems.value && filteredItems.value.length > 0) {
|
|
678
|
+
const index = Math.min(
|
|
679
|
+
findItemIndex(hoveredPopupItem.value) + 1,
|
|
680
|
+
filteredItems.value.length - 1
|
|
681
|
+
);
|
|
682
|
+
setHoveredPopupItem(filteredItems.value[index]?.original, index);
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
const prevPopupItem = () => {
|
|
686
|
+
if (filteredItems.value && filteredItems.value.length > 0) {
|
|
687
|
+
const index = Math.max(0, findItemIndex(hoveredPopupItem.value) - 1);
|
|
688
|
+
setHoveredPopupItem(filteredItems.value[index]?.original, index);
|
|
689
|
+
}
|
|
690
|
+
};
|
|
691
|
+
const selectItem = () => {
|
|
692
|
+
selectPopupItem(hoveredPopupItem.value);
|
|
693
|
+
};
|
|
694
|
+
const handleKeyboard = (event) => {
|
|
695
|
+
switch (event.key) {
|
|
696
|
+
case "Enter":
|
|
697
|
+
selectItem();
|
|
698
|
+
break;
|
|
699
|
+
case "ArrowDown":
|
|
700
|
+
nextPopupItem();
|
|
701
|
+
break;
|
|
702
|
+
case "ArrowUp":
|
|
703
|
+
prevPopupItem();
|
|
704
|
+
break;
|
|
705
|
+
}
|
|
706
|
+
};
|
|
707
|
+
const hoveredPopupItem = vue.ref();
|
|
708
|
+
hoveredPopupItem.value = props.initialItem;
|
|
709
|
+
const setHoveredPopupItem = (item, index) => {
|
|
710
|
+
hoveredPopupItem.value = item;
|
|
711
|
+
if (index !== void 0) scrollToShowItem(index);
|
|
712
|
+
};
|
|
713
|
+
const popupItems = vue.ref();
|
|
714
|
+
const scrollToShowItem = (index) => {
|
|
715
|
+
const item = popupItems.value?.querySelectorAll(".popup-item")[index];
|
|
716
|
+
if (popupItems.value && item) {
|
|
717
|
+
const popupRect = popupItems.value.getBoundingClientRect();
|
|
718
|
+
const itemRect = item.getBoundingClientRect();
|
|
719
|
+
if (itemRect.top < popupRect.top || itemRect.bottom > popupRect.bottom) {
|
|
720
|
+
popupItems.value.scrollTop = item.offsetTop - (popupItems.value.offsetHeight - item.offsetHeight) / 2;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
vue.onMounted(async () => {
|
|
725
|
+
await vue.nextTick();
|
|
726
|
+
await vue.nextTick();
|
|
727
|
+
const focusedItem = hoveredPopupItem.value || props.selectedItems?.[0];
|
|
728
|
+
if (focusedItem) {
|
|
729
|
+
scrollToShowItem(findItemIndex(focusedItem));
|
|
730
|
+
}
|
|
731
|
+
});
|
|
732
|
+
const isHoveredPopupItem = (item) => {
|
|
733
|
+
const hovered = hoveredPopupItem.value;
|
|
734
|
+
if (hovered === void 0 && item === void 0) return true;
|
|
735
|
+
else if (hovered !== void 0 && item !== void 0)
|
|
736
|
+
return props.valueProvider(hovered) === props.valueProvider(item);
|
|
737
|
+
else return false;
|
|
738
|
+
};
|
|
739
|
+
const selectPopupItem = (item) => {
|
|
740
|
+
if (item && allItems.value) {
|
|
741
|
+
item = allItems.value.filter(notNull).find((it) => it && it.value === props.valueProvider(item))?.original;
|
|
742
|
+
}
|
|
743
|
+
emit("itemSelected", item);
|
|
744
|
+
};
|
|
745
|
+
__expose({
|
|
746
|
+
handleKeyboard
|
|
747
|
+
});
|
|
748
|
+
return (_ctx, _cache) => {
|
|
749
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$o, {
|
|
750
|
+
"base-element": __props.baseElement,
|
|
751
|
+
"max-height": __props.maxHeight,
|
|
752
|
+
"offset-from-base-element": 4,
|
|
753
|
+
"popup-align": __props.popupAlign,
|
|
754
|
+
"popup-direction": __props.popupDirection,
|
|
755
|
+
"extra-class": "bs-select-popup flex flex-col",
|
|
756
|
+
onRequestClose: _cache[2] || (_cache[2] = ($event) => emit("requestClose")),
|
|
757
|
+
onKeydown: vue.withKeys(vue.withModifiers(handleKeyboard, ["stop", "prevent"]), ["enter", "down", "up"])
|
|
758
|
+
}, {
|
|
759
|
+
default: vue.withCtx(() => [
|
|
760
|
+
actualShowSearch.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
|
|
761
|
+
vue.withDirectives(vue.createElementVNode("input", {
|
|
762
|
+
type: "text",
|
|
763
|
+
onInput: setSearchKeyword,
|
|
764
|
+
onKeydown: _cache[0] || (_cache[0] = vue.withKeys(vue.withModifiers(() => {
|
|
765
|
+
}, ["stop"]), ["space"])),
|
|
766
|
+
onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
|
|
767
|
+
}, ["stop"]))
|
|
768
|
+
}, null, 544), [
|
|
769
|
+
[vue.unref(vFocusOnLoad)]
|
|
770
|
+
])
|
|
771
|
+
])) : vue.createCommentVNode("", true),
|
|
772
|
+
vue.createElementVNode("div", {
|
|
773
|
+
ref_key: "popupItems",
|
|
774
|
+
ref: popupItems,
|
|
775
|
+
class: "popup-items"
|
|
776
|
+
}, [
|
|
777
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(filteredItems.value, (item) => {
|
|
778
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
779
|
+
key: item !== void 0 ? String(item) : "",
|
|
780
|
+
class: vue.normalizeClass([{
|
|
781
|
+
hovered: isHoveredPopupItem(item?.original),
|
|
782
|
+
"selected-item": item !== void 0 && __props.selectedItems?.includes(item?.original)
|
|
783
|
+
}, "popup-item"]),
|
|
784
|
+
"data-value": item?.value || "",
|
|
785
|
+
onMouseover: ($event) => setHoveredPopupItem(item?.original),
|
|
786
|
+
onClick: vue.withModifiers(($event) => selectPopupItem(item?.original), ["stop"])
|
|
787
|
+
}, [
|
|
788
|
+
_cache[3] || (_cache[3] = vue.createElementVNode("span", { class: "checkbox" }, null, -1)),
|
|
789
|
+
item !== void 0 ? (vue.openBlock(), vue.createElementBlock("label", {
|
|
790
|
+
key: 0,
|
|
791
|
+
textContent: vue.toDisplayString(item?.label),
|
|
792
|
+
class: "label"
|
|
793
|
+
}, null, 8, _hoisted_3$g)) : (vue.openBlock(), vue.createElementBlock("label", {
|
|
794
|
+
key: 1,
|
|
795
|
+
textContent: vue.toDisplayString(__props.nullLabel),
|
|
796
|
+
class: "label null-label"
|
|
797
|
+
}, null, 8, _hoisted_4$a))
|
|
798
|
+
], 42, _hoisted_2$k);
|
|
799
|
+
}), 128))
|
|
800
|
+
], 512)
|
|
801
|
+
]),
|
|
802
|
+
_: 1
|
|
803
|
+
}, 8, ["base-element", "max-height", "popup-align", "popup-direction", "onKeydown"]);
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
});
|
|
807
|
+
const updateContext = (el, value) => {
|
|
808
|
+
el.vClickOutsideContext = {
|
|
809
|
+
enabled: value?.enabled ?? true,
|
|
810
|
+
handler: typeof value === "function" ? value : value?.handler,
|
|
811
|
+
insideElements: value?.insideElements
|
|
812
|
+
};
|
|
813
|
+
};
|
|
814
|
+
const clickInsideElements = (target, elements) => {
|
|
815
|
+
if (!elements)
|
|
816
|
+
return false;
|
|
817
|
+
return elements.some((el) => {
|
|
818
|
+
if (el instanceof HTMLElement)
|
|
819
|
+
return el.contains(target);
|
|
820
|
+
else if (typeof el === "string")
|
|
821
|
+
return document.querySelector(el)?.contains(target);
|
|
822
|
+
});
|
|
823
|
+
};
|
|
824
|
+
const vClickOutside = {
|
|
825
|
+
mounted: (el, binding) => {
|
|
826
|
+
const clickListener = (event) => {
|
|
827
|
+
let target = event.target;
|
|
828
|
+
if (!el.contains(target)) {
|
|
829
|
+
const context = el.vClickOutsideContext;
|
|
830
|
+
if (context && context.enabled) {
|
|
831
|
+
if (!clickInsideElements(target, context.insideElements)) {
|
|
832
|
+
context.handler?.();
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
};
|
|
837
|
+
el.vClickOutsideListener = clickListener;
|
|
838
|
+
updateContext(el, binding.value);
|
|
839
|
+
window.addEventListener("click", clickListener);
|
|
840
|
+
},
|
|
841
|
+
updated: (el, binding) => {
|
|
842
|
+
updateContext(el, binding.value);
|
|
843
|
+
},
|
|
844
|
+
unmounted: (el) => {
|
|
845
|
+
const clickListener = el.vClickOutsideListener;
|
|
846
|
+
if (clickListener)
|
|
847
|
+
window.removeEventListener("click", clickListener);
|
|
848
|
+
delete el.vClickOutsideContext;
|
|
849
|
+
}
|
|
850
|
+
};
|
|
851
|
+
const storeFieldValidator = (field, validator) => {
|
|
852
|
+
field._bsFieldValidator = validator;
|
|
853
|
+
field.setAttribute("data-bs-field-validator", "");
|
|
854
|
+
};
|
|
855
|
+
const fieldValidator = (option) => {
|
|
856
|
+
const stringValue = vue.ref();
|
|
857
|
+
const value = vue.ref(option.initialValue);
|
|
858
|
+
const valid = vue.ref(false);
|
|
859
|
+
const errors = vue.ref([]);
|
|
860
|
+
const touched = vue.ref(false);
|
|
861
|
+
const convertToValue = (value2) => {
|
|
862
|
+
return option.convertToValue ? option.convertToValue(value2) : value2 ?? "";
|
|
863
|
+
};
|
|
864
|
+
const convertFromValue = (value2) => {
|
|
865
|
+
return option.convertFromValue ? option.convertFromValue(value2) : value2?.toString() ?? "";
|
|
866
|
+
};
|
|
867
|
+
const validateStringValue = async (val, phase) => {
|
|
868
|
+
const value2 = convertToValue(val);
|
|
869
|
+
await validateValue(value2, phase);
|
|
870
|
+
};
|
|
871
|
+
const validateValue = async (val, phase) => {
|
|
872
|
+
value.value = val;
|
|
873
|
+
if (option.disabled?.value) {
|
|
874
|
+
valid.value = true;
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
valid.value = false;
|
|
878
|
+
const errs = await option.isValid?.(value.value, phase);
|
|
879
|
+
if (errs && errs.length > 0) {
|
|
880
|
+
valid.value = false;
|
|
881
|
+
errors.value = errs;
|
|
882
|
+
} else {
|
|
883
|
+
valid.value = true;
|
|
884
|
+
errors.value = [];
|
|
885
|
+
}
|
|
886
|
+
};
|
|
887
|
+
const getElementValue = (event) => {
|
|
888
|
+
return event.target && "value" in event.target ? event.target.value : void 0;
|
|
889
|
+
};
|
|
890
|
+
const validate = async (phase = "form") => {
|
|
891
|
+
await validateValue(value.value, phase);
|
|
892
|
+
};
|
|
893
|
+
const clearErrors = () => {
|
|
894
|
+
touched.value = false;
|
|
895
|
+
errors.value = [];
|
|
896
|
+
valid.value = false;
|
|
897
|
+
};
|
|
898
|
+
const validateInput = async (event) => {
|
|
899
|
+
const inputValue = getElementValue(event);
|
|
900
|
+
if (inputValue !== void 0) {
|
|
901
|
+
await validateStringValue(inputValue, "input");
|
|
902
|
+
}
|
|
903
|
+
};
|
|
904
|
+
const handleInput = async (event) => {
|
|
905
|
+
await validateInput(event);
|
|
906
|
+
};
|
|
907
|
+
const handleChange = async (event) => {
|
|
908
|
+
const inputValue = getElementValue(event);
|
|
909
|
+
if (inputValue !== void 0) {
|
|
910
|
+
await validateStringValue(inputValue, "change");
|
|
911
|
+
}
|
|
912
|
+
};
|
|
913
|
+
const handleFocus = (_) => {
|
|
914
|
+
touched.value = true;
|
|
915
|
+
};
|
|
916
|
+
const handleBlur = async (event) => {
|
|
917
|
+
const inputValue = getElementValue(event);
|
|
918
|
+
if (inputValue !== void 0) {
|
|
919
|
+
await validateStringValue(inputValue, "blur");
|
|
920
|
+
}
|
|
921
|
+
};
|
|
922
|
+
const validator = {
|
|
923
|
+
stringValue,
|
|
924
|
+
value,
|
|
925
|
+
valid,
|
|
926
|
+
errors,
|
|
927
|
+
touched,
|
|
928
|
+
handleInput,
|
|
929
|
+
handleChange,
|
|
930
|
+
handleFocus,
|
|
931
|
+
handleBlur,
|
|
932
|
+
validateValue,
|
|
933
|
+
validate,
|
|
934
|
+
clearErrors,
|
|
935
|
+
getName: () => {
|
|
936
|
+
const field = option.field?.value;
|
|
937
|
+
return field ? field.getAttribute("name") ?? field.getAttribute("data-field-name") ?? "" : "";
|
|
938
|
+
}
|
|
939
|
+
};
|
|
940
|
+
stringValue.value = convertFromValue(value.value);
|
|
941
|
+
if (option.field) {
|
|
942
|
+
vue.watch(option.field, (field) => {
|
|
943
|
+
if (field)
|
|
944
|
+
storeFieldValidator(field, validator);
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
return validator;
|
|
948
|
+
};
|
|
949
|
+
const executeFieldValidationRule = async (value, rules, errors, phase, fieldContext) => {
|
|
950
|
+
const errs = [];
|
|
951
|
+
if (rules) {
|
|
952
|
+
for (const rule of rules) {
|
|
953
|
+
const result = await rule(value, phase, fieldContext);
|
|
954
|
+
if (result)
|
|
955
|
+
result.forEach((error) => errs.push(error));
|
|
956
|
+
}
|
|
957
|
+
errs.forEach((error) => errors.push(error));
|
|
958
|
+
}
|
|
959
|
+
return errs.length > 0;
|
|
960
|
+
};
|
|
961
|
+
const executeRequiredValidation = (value, checkRequired, requiredMessage, errors) => {
|
|
962
|
+
if (checkRequired) {
|
|
963
|
+
if (typeof value === "string" && !value || value === void 0) {
|
|
964
|
+
errors.push({ code: "required", message: requiredMessage || "Required" });
|
|
965
|
+
return true;
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
return false;
|
|
969
|
+
};
|
|
970
|
+
const executeRegExpValidation = (value, regexp, message, errors) => {
|
|
971
|
+
if (value && regexp && !new RegExp(regexp).test(value)) {
|
|
972
|
+
errors.push({ code: "allowedPattern", message: message || "Invalid format" });
|
|
973
|
+
return true;
|
|
974
|
+
}
|
|
975
|
+
return false;
|
|
976
|
+
};
|
|
977
|
+
const executeBetweenLengthValidation = (text, minLength, minLengthMessage, maxLength, maxLengthMessage, betweenLengthMessage, errors) => {
|
|
978
|
+
const invalidMinLength = !!text && !!minLength && text.length < minLength;
|
|
979
|
+
const invalidMaxLength = !!text && !!maxLength && text.length > maxLength;
|
|
980
|
+
if (invalidMinLength && invalidMaxLength) {
|
|
981
|
+
errors.push({
|
|
982
|
+
code: "betweenLength",
|
|
983
|
+
message: betweenLengthMessage || "Should be {0} ~ {1} characters"
|
|
984
|
+
// {
|
|
985
|
+
// key: 'bs.error.validation.lengthRange',
|
|
986
|
+
// args: [minLength, maxLength]
|
|
987
|
+
// }
|
|
988
|
+
});
|
|
989
|
+
} else if (invalidMinLength) {
|
|
990
|
+
errors.push({
|
|
991
|
+
code: "minLength",
|
|
992
|
+
message: minLengthMessage || "Should be {0} characters or more"
|
|
993
|
+
// {
|
|
994
|
+
// key: 'bs.error.validation.lengthMin',
|
|
995
|
+
// args: [minLength]
|
|
996
|
+
// }
|
|
997
|
+
});
|
|
998
|
+
} else if (invalidMaxLength) {
|
|
999
|
+
errors.push({
|
|
1000
|
+
code: "maxLength",
|
|
1001
|
+
message: maxLengthMessage || "Should be {0} characters or less"
|
|
1002
|
+
// {
|
|
1003
|
+
// key: 'bs.error.validation.lengthMax',
|
|
1004
|
+
// args: [maxLength]
|
|
1005
|
+
// }
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
return invalidMinLength || invalidMaxLength;
|
|
1009
|
+
};
|
|
1010
|
+
const executeBetweenValueValidation = (value, minValue, minValueMessage, maxValue, maxValueMessage, betweenValueMessage, errors) => {
|
|
1011
|
+
const invalidMinValue = minValue !== void 0 && value < minValue;
|
|
1012
|
+
const invalidMaxValue = maxValue !== void 0 && value > maxValue;
|
|
1013
|
+
if (invalidMinValue && invalidMaxValue) {
|
|
1014
|
+
errors.push({
|
|
1015
|
+
code: "betweenValue",
|
|
1016
|
+
message: betweenValueMessage || "Should be {0} ~ {1}"
|
|
1017
|
+
// {
|
|
1018
|
+
// key: 'bs.error.validation.valueRange',
|
|
1019
|
+
// args: [minValue, maxValue]
|
|
1020
|
+
// }
|
|
1021
|
+
});
|
|
1022
|
+
} else if (invalidMinValue) {
|
|
1023
|
+
errors.push({
|
|
1024
|
+
code: "minValue",
|
|
1025
|
+
message: minValueMessage || "Should be {0} or more"
|
|
1026
|
+
// {
|
|
1027
|
+
// key: 'bs.error.validation.valueMin',
|
|
1028
|
+
// args: [minValue]
|
|
1029
|
+
// }
|
|
1030
|
+
});
|
|
1031
|
+
} else if (invalidMaxValue) {
|
|
1032
|
+
errors.push({
|
|
1033
|
+
code: "maxValue",
|
|
1034
|
+
message: maxValueMessage || "Should be {0} or less"
|
|
1035
|
+
// {
|
|
1036
|
+
// key: 'bs.error.validation.valueMax',
|
|
1037
|
+
// args: [maxValue]
|
|
1038
|
+
// }
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
return invalidMinValue || invalidMaxValue;
|
|
1042
|
+
};
|
|
1043
|
+
const executeDateRangeValidation = (fromValue, toValue, validationMessage, erros) => {
|
|
1044
|
+
const skip = fromValue === void 0 || toValue === void 0;
|
|
1045
|
+
const invalidDateOrder = dayjs(toValue).isBefore(dayjs(fromValue));
|
|
1046
|
+
if (!skip && invalidDateOrder) {
|
|
1047
|
+
erros.push({
|
|
1048
|
+
code: "dateOrder",
|
|
1049
|
+
message: validationMessage || "Invalid date order"
|
|
1050
|
+
// { key: 'bs.daterangegroup.invalidDateOrder' }
|
|
1051
|
+
});
|
|
1052
|
+
}
|
|
1053
|
+
return !skip || invalidDateOrder;
|
|
1054
|
+
};
|
|
1055
|
+
const SAVE_POINT_KEY = Symbol("SavePoint");
|
|
1056
|
+
class SavePointImpl {
|
|
1057
|
+
fields = vue.markRaw(/* @__PURE__ */ new Map());
|
|
1058
|
+
children;
|
|
1059
|
+
registerField(option) {
|
|
1060
|
+
const handler = new SavePointHandlerImpl({
|
|
1061
|
+
getCurrentValue: option.getCurrentValue,
|
|
1062
|
+
setCurrentValue: option.setCurrentValue,
|
|
1063
|
+
compare: option.compare
|
|
1064
|
+
});
|
|
1065
|
+
vue.watch(option.field, (field) => {
|
|
1066
|
+
if (field)
|
|
1067
|
+
this.fields.set(field, handler);
|
|
1068
|
+
});
|
|
1069
|
+
return handler;
|
|
1070
|
+
}
|
|
1071
|
+
unregisterField(field) {
|
|
1072
|
+
if (field.value)
|
|
1073
|
+
this.fields.delete(field.value);
|
|
1074
|
+
}
|
|
1075
|
+
addChild(child) {
|
|
1076
|
+
if (!this.children)
|
|
1077
|
+
this.children = [];
|
|
1078
|
+
this.children.push(child);
|
|
1079
|
+
}
|
|
1080
|
+
removeChild(child) {
|
|
1081
|
+
if (this.children) {
|
|
1082
|
+
const index = this.children.findIndex((ch) => ch === child);
|
|
1083
|
+
if (index >= 0)
|
|
1084
|
+
this.children.splice(index, 1);
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
set() {
|
|
1088
|
+
this.fields.forEach((handler) => handler.saveValue());
|
|
1089
|
+
this.children?.forEach((child) => child.set());
|
|
1090
|
+
}
|
|
1091
|
+
async setNextTick() {
|
|
1092
|
+
await vue.nextTick();
|
|
1093
|
+
this.set();
|
|
1094
|
+
}
|
|
1095
|
+
rollback() {
|
|
1096
|
+
this.fields.forEach((handler) => handler.rollbackValue());
|
|
1097
|
+
this.children?.forEach((child) => child.rollback());
|
|
1098
|
+
}
|
|
1099
|
+
isModified() {
|
|
1100
|
+
if (Array.from(this.fields.values()).find((handler) => handler.isFieldModified())) {
|
|
1101
|
+
return true;
|
|
1102
|
+
}
|
|
1103
|
+
if (this.children) {
|
|
1104
|
+
return !!this.children.find((child) => child.isModified());
|
|
1105
|
+
}
|
|
1106
|
+
return false;
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
const provideSavePoint = () => {
|
|
1110
|
+
const savePoint = new SavePointImpl();
|
|
1111
|
+
vue.provide(SAVE_POINT_KEY, savePoint);
|
|
1112
|
+
return savePoint;
|
|
1113
|
+
};
|
|
1114
|
+
const dummySavePoint = new SavePointImpl();
|
|
1115
|
+
const useSavePoint = () => {
|
|
1116
|
+
const result = vue.inject(SAVE_POINT_KEY, dummySavePoint);
|
|
1117
|
+
return result === dummySavePoint ? void 0 : result;
|
|
1118
|
+
};
|
|
1119
|
+
const cancelProvidedSavePoint = () => {
|
|
1120
|
+
vue.provide(SAVE_POINT_KEY, dummySavePoint);
|
|
1121
|
+
};
|
|
1122
|
+
class SavePointHandlerImpl {
|
|
1123
|
+
saved = false;
|
|
1124
|
+
savedValue = vue.shallowRef();
|
|
1125
|
+
valueProvider;
|
|
1126
|
+
constructor(valueProvider) {
|
|
1127
|
+
this.valueProvider = valueProvider;
|
|
1128
|
+
}
|
|
1129
|
+
saveValue() {
|
|
1130
|
+
this.savedValue.value = this.valueProvider.getCurrentValue();
|
|
1131
|
+
this.saved = true;
|
|
1132
|
+
}
|
|
1133
|
+
getSavedValue() {
|
|
1134
|
+
return this.savedValue.value;
|
|
1135
|
+
}
|
|
1136
|
+
rollbackValue() {
|
|
1137
|
+
if (this.saved)
|
|
1138
|
+
this.valueProvider.setCurrentValue(this.savedValue.value);
|
|
1139
|
+
}
|
|
1140
|
+
isModified(currentValue) {
|
|
1141
|
+
return this.saved && (this.valueProvider.compare ? !this.valueProvider.compare(this.savedValue.value, currentValue) : this.savedValue?.value !== currentValue);
|
|
1142
|
+
}
|
|
1143
|
+
isFieldModified() {
|
|
1144
|
+
return this.isModified(this.valueProvider.getCurrentValue());
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
const _hoisted_1$k = { key: 0 };
|
|
1148
|
+
const _hoisted_2$j = ["textContent"];
|
|
1149
|
+
const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
|
|
1150
|
+
__name: "ValidationErrors",
|
|
1151
|
+
props: {
|
|
1152
|
+
errors: {},
|
|
1153
|
+
hideErrorMessage: { type: Boolean }
|
|
1154
|
+
},
|
|
1155
|
+
setup(__props) {
|
|
1156
|
+
return (_ctx, _cache) => {
|
|
1157
|
+
return !__props.hideErrorMessage && __props.errors && __props.errors.length > 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$k, [
|
|
1158
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.errors, (error) => {
|
|
1159
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
1160
|
+
key: error.code,
|
|
1161
|
+
textContent: vue.toDisplayString(error.message),
|
|
1162
|
+
class: "bs-field-error"
|
|
1163
|
+
}, null, 8, _hoisted_2$j);
|
|
1164
|
+
}), 128))
|
|
1165
|
+
])) : vue.createCommentVNode("", true);
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1168
|
+
});
|
|
1169
|
+
const FIELD_CONTEXT_KEY = Symbol("FieldContext");
|
|
1170
|
+
const provideFieldContext = (fieldContext) => {
|
|
1171
|
+
vue.provide(FIELD_CONTEXT_KEY, fieldContext);
|
|
1172
|
+
};
|
|
1173
|
+
const dummyFieldContext = {};
|
|
1174
|
+
const useFieldContext = () => {
|
|
1175
|
+
const result = vue.inject(FIELD_CONTEXT_KEY, dummyFieldContext);
|
|
1176
|
+
return result === dummyFieldContext ? void 0 : result;
|
|
1177
|
+
};
|
|
1178
|
+
const defaultLabelProvider = (item) => {
|
|
1179
|
+
if (!item)
|
|
1180
|
+
return "";
|
|
1181
|
+
else if (typeof item === "string")
|
|
1182
|
+
return item;
|
|
1183
|
+
else
|
|
1184
|
+
return String(item);
|
|
1185
|
+
};
|
|
1186
|
+
const executeLabelProviderOrDefault = (item, labelProvider, defaultLabel) => {
|
|
1187
|
+
if (labelProvider) {
|
|
1188
|
+
const label = labelProvider(item);
|
|
1189
|
+
if (label !== void 0)
|
|
1190
|
+
return label;
|
|
1191
|
+
}
|
|
1192
|
+
return defaultLabel(item);
|
|
1193
|
+
};
|
|
1194
|
+
const executeKeyProviderOrDefault = (item, keyProvider, defaultKey) => {
|
|
1195
|
+
if (keyProvider) {
|
|
1196
|
+
const key = keyProvider(item);
|
|
1197
|
+
if (key)
|
|
1198
|
+
return key;
|
|
1199
|
+
}
|
|
1200
|
+
return defaultKey(item);
|
|
1201
|
+
};
|
|
1202
|
+
const _hoisted_1$j = ["tabindex", "onKeydown"];
|
|
1203
|
+
const _hoisted_2$i = ["textContent"];
|
|
1204
|
+
const _hoisted_3$f = ["data-field-name"];
|
|
1205
|
+
const _hoisted_4$9 = ["textContent"];
|
|
1206
|
+
const _hoisted_5$4 = ["textContent"];
|
|
1207
|
+
const _hoisted_6$2 = {
|
|
1208
|
+
key: 2,
|
|
1209
|
+
class: "small-progress"
|
|
1210
|
+
};
|
|
1211
|
+
const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
|
|
1212
|
+
__name: "BSSelect",
|
|
1213
|
+
props: {
|
|
1214
|
+
modelValue: {},
|
|
1215
|
+
items: { default: () => [] },
|
|
1216
|
+
name: {},
|
|
1217
|
+
valueProvider: { type: Function, default: (item) => item },
|
|
1218
|
+
labelProvider: { type: Function, default: defaultLabelProvider },
|
|
1219
|
+
selectedLabelProvider: {},
|
|
1220
|
+
placeholder: { default: () => "" },
|
|
1221
|
+
allowNull: { type: Boolean },
|
|
1222
|
+
nullLabel: {},
|
|
1223
|
+
disabled: { type: Boolean },
|
|
1224
|
+
viewMode: { type: Boolean },
|
|
1225
|
+
tabindex: { default: 0 },
|
|
1226
|
+
required: { type: Boolean },
|
|
1227
|
+
validationMessageRequired: {},
|
|
1228
|
+
extraValidationRules: {},
|
|
1229
|
+
ignoreSavePoint: { type: Boolean },
|
|
1230
|
+
popupAlign: {},
|
|
1231
|
+
popupDirection: {},
|
|
1232
|
+
popupMaxHeight: {},
|
|
1233
|
+
showPopupSearch: { type: [Boolean, String], default: "auto" },
|
|
1234
|
+
hideErrorMessage: { type: Boolean },
|
|
1235
|
+
showErrorMessageOnDisabled: { type: Boolean }
|
|
1236
|
+
},
|
|
1237
|
+
emits: ["update:modelValue"],
|
|
1238
|
+
setup(__props, { emit: __emit }) {
|
|
1239
|
+
const props = __props;
|
|
1240
|
+
const emit = __emit;
|
|
1241
|
+
const allItems = vue.ref();
|
|
1242
|
+
const loadingItems = vue.ref(false);
|
|
1243
|
+
vue.watch(
|
|
1244
|
+
() => props.items,
|
|
1245
|
+
async () => {
|
|
1246
|
+
loadingItems.value = true;
|
|
1247
|
+
allItems.value = await props.items;
|
|
1248
|
+
loadingItems.value = false;
|
|
1249
|
+
},
|
|
1250
|
+
{ immediate: true }
|
|
1251
|
+
);
|
|
1252
|
+
const itemLabel = (item) => {
|
|
1253
|
+
return props.labelProvider ? props.labelProvider(item) : String(item);
|
|
1254
|
+
};
|
|
1255
|
+
const itemValue = (item) => {
|
|
1256
|
+
return props.valueProvider ? props.valueProvider(item) : item;
|
|
1257
|
+
};
|
|
1258
|
+
const findItemFromValue = (value) => {
|
|
1259
|
+
return value !== void 0 ? allItems.value?.find((item) => itemValue(item) === value) : void 0;
|
|
1260
|
+
};
|
|
1261
|
+
const isEmpty = vue.computed(() => !props.modelValue);
|
|
1262
|
+
const selectedItem = vue.computed(() => findItemFromValue(props.modelValue));
|
|
1263
|
+
const selectedItems = vue.computed(() => selectedItem.value !== void 0 ? [selectedItem.value] : []);
|
|
1264
|
+
const selectedItemLabel = vue.computed(() => {
|
|
1265
|
+
if (selectedItem.value !== void 0) {
|
|
1266
|
+
return props.selectedLabelProvider ? props.selectedLabelProvider(selectedItem.value) : itemLabel(selectedItem.value);
|
|
1267
|
+
} else {
|
|
1268
|
+
return "";
|
|
1269
|
+
}
|
|
1270
|
+
});
|
|
1271
|
+
const showPopup = vue.ref(false);
|
|
1272
|
+
const togglePopup = (show) => {
|
|
1273
|
+
if (!props.disabled && !props.viewMode) {
|
|
1274
|
+
showPopup.value = show === void 0 ? !showPopup.value : show;
|
|
1275
|
+
}
|
|
1276
|
+
};
|
|
1277
|
+
const handleTabKey = (event) => {
|
|
1278
|
+
if (showPopup.value) {
|
|
1279
|
+
event.stopPropagation();
|
|
1280
|
+
} else {
|
|
1281
|
+
togglePopup(false);
|
|
1282
|
+
}
|
|
1283
|
+
};
|
|
1284
|
+
const selectPopup = vue.ref();
|
|
1285
|
+
const handleKeyboardEvent = (event) => {
|
|
1286
|
+
if (!showPopup.value) togglePopup(true);
|
|
1287
|
+
else if (selectPopup.value) selectPopup.value.handleKeyboard(event);
|
|
1288
|
+
};
|
|
1289
|
+
const itemSelected = (item) => {
|
|
1290
|
+
const value = item ? itemValue(item) : void 0;
|
|
1291
|
+
emit("update:modelValue", value);
|
|
1292
|
+
showPopup.value = false;
|
|
1293
|
+
focusToRoot();
|
|
1294
|
+
};
|
|
1295
|
+
const rootRef = vue.useTemplateRef("root");
|
|
1296
|
+
const focusToRoot = () => rootRef.value?.focus();
|
|
1297
|
+
vue.watch(
|
|
1298
|
+
() => props.modelValue,
|
|
1299
|
+
() => validateValue(props.modelValue, "change")
|
|
1300
|
+
);
|
|
1301
|
+
const field = vue.ref();
|
|
1302
|
+
const fieldContext = useFieldContext();
|
|
1303
|
+
const isValid = async (value, phase) => {
|
|
1304
|
+
const errors2 = [];
|
|
1305
|
+
if (props.required && value === void 0) {
|
|
1306
|
+
errors2.push({ code: "required", message: props.validationMessageRequired || "Required" });
|
|
1307
|
+
} else if (value !== void 0) {
|
|
1308
|
+
await executeFieldValidationRule(value, props.extraValidationRules, errors2, phase, fieldContext);
|
|
1309
|
+
}
|
|
1310
|
+
return errors2;
|
|
1311
|
+
};
|
|
1312
|
+
const validationDisabled = vue.computed(() => props.viewMode || props.disabled);
|
|
1313
|
+
const { errors, validateValue } = fieldValidator({
|
|
1314
|
+
field,
|
|
1315
|
+
disabled: validationDisabled,
|
|
1316
|
+
initialValue: props.modelValue,
|
|
1317
|
+
isValid
|
|
1318
|
+
});
|
|
1319
|
+
const savePoint = props.ignoreSavePoint ? void 0 : useSavePoint();
|
|
1320
|
+
const savePointHandler = savePoint?.registerField({
|
|
1321
|
+
field,
|
|
1322
|
+
getCurrentValue: () => props.modelValue,
|
|
1323
|
+
setCurrentValue: (value) => emit("update:modelValue", value)
|
|
1324
|
+
});
|
|
1325
|
+
const modified = vue.computed(() => !!savePointHandler?.isModified(props.modelValue));
|
|
1326
|
+
vue.onBeforeUnmount(() => savePoint?.unregisterField(field));
|
|
1327
|
+
return (_ctx, _cache) => {
|
|
1328
|
+
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
1329
|
+
ref: "root",
|
|
1330
|
+
class: vue.normalizeClass([{ "popup-open": showPopup.value, disabled: __props.disabled, modified: modified.value, error: vue.unref(errors).length > 0, empty: isEmpty.value, "view-mode": __props.viewMode }, "bs-select"]),
|
|
1331
|
+
tabindex: __props.disabled ? -1 : __props.tabindex,
|
|
1332
|
+
onClick: _cache[1] || (_cache[1] = ($event) => togglePopup()),
|
|
1333
|
+
onKeydown: [
|
|
1334
|
+
_cache[2] || (_cache[2] = vue.withKeys(vue.withModifiers(($event) => togglePopup(), ["stop", "prevent"]), ["space"])),
|
|
1335
|
+
vue.withKeys(vue.withModifiers(handleKeyboardEvent, ["stop", "prevent"]), ["enter", "down", "up"]),
|
|
1336
|
+
_cache[3] || (_cache[3] = vue.withKeys(vue.withModifiers(($event) => {
|
|
1337
|
+
togglePopup(false);
|
|
1338
|
+
focusToRoot();
|
|
1339
|
+
}, ["stop", "prevent"]), ["esc"])),
|
|
1340
|
+
vue.withKeys(handleTabKey, ["tab"])
|
|
1341
|
+
]
|
|
1342
|
+
}, [
|
|
1343
|
+
__props.viewMode ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
1344
|
+
key: 0,
|
|
1345
|
+
textContent: vue.toDisplayString(selectedItemLabel.value)
|
|
1346
|
+
}, null, 8, _hoisted_2$i)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
1347
|
+
vue.createElementVNode("div", {
|
|
1348
|
+
ref_key: "field",
|
|
1349
|
+
ref: field,
|
|
1350
|
+
"data-field-name": __props.name,
|
|
1351
|
+
class: "selected w-full",
|
|
1352
|
+
role: "listbox"
|
|
1353
|
+
}, [
|
|
1354
|
+
selectedItem.value === void 0 ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
1355
|
+
key: 0,
|
|
1356
|
+
textContent: vue.toDisplayString(__props.placeholder),
|
|
1357
|
+
class: "placeholder grow"
|
|
1358
|
+
}, null, 8, _hoisted_4$9)) : (vue.openBlock(), vue.createElementBlock("span", {
|
|
1359
|
+
key: 1,
|
|
1360
|
+
textContent: vue.toDisplayString(selectedItemLabel.value),
|
|
1361
|
+
class: "label"
|
|
1362
|
+
}, null, 8, _hoisted_5$4)),
|
|
1363
|
+
_cache[4] || (_cache[4] = vue.createElementVNode("span", { class: "dropdown-btn" }, "expand_more", -1)),
|
|
1364
|
+
loadingItems.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_6$2, "progress_activity")) : vue.createCommentVNode("", true)
|
|
1365
|
+
], 8, _hoisted_3$f),
|
|
1366
|
+
!__props.disabled && showPopup.value ? (vue.openBlock(), vue.createBlock(_sfc_main$m, {
|
|
1367
|
+
key: 0,
|
|
1368
|
+
ref_key: "selectPopup",
|
|
1369
|
+
ref: selectPopup,
|
|
1370
|
+
"allow-null": __props.allowNull,
|
|
1371
|
+
"base-element": rootRef.value,
|
|
1372
|
+
"initial-item": selectedItem.value,
|
|
1373
|
+
items: __props.items,
|
|
1374
|
+
"label-provider": __props.labelProvider,
|
|
1375
|
+
"max-height": __props.popupMaxHeight,
|
|
1376
|
+
"null-label": __props.nullLabel,
|
|
1377
|
+
"popup-align": __props.popupAlign,
|
|
1378
|
+
"popup-direction": __props.popupDirection,
|
|
1379
|
+
"selected-items": selectedItems.value,
|
|
1380
|
+
"show-search": __props.showPopupSearch,
|
|
1381
|
+
"value-provider": __props.valueProvider,
|
|
1382
|
+
onItemSelected: itemSelected,
|
|
1383
|
+
onRequestClose: _cache[0] || (_cache[0] = ($event) => {
|
|
1384
|
+
togglePopup(false);
|
|
1385
|
+
focusToRoot();
|
|
1386
|
+
})
|
|
1387
|
+
}, null, 8, ["allow-null", "base-element", "initial-item", "items", "label-provider", "max-height", "null-label", "popup-align", "popup-direction", "selected-items", "show-search", "value-provider"])) : vue.createCommentVNode("", true),
|
|
1388
|
+
!__props.viewMode ? (vue.openBlock(), vue.createBlock(_sfc_main$l, {
|
|
1389
|
+
key: 1,
|
|
1390
|
+
errors: vue.unref(errors),
|
|
1391
|
+
"hide-error-message": __props.hideErrorMessage || __props.disabled && !__props.showErrorMessageOnDisabled
|
|
1392
|
+
}, null, 8, ["errors", "hide-error-message"])) : vue.createCommentVNode("", true)
|
|
1393
|
+
], 64))
|
|
1394
|
+
], 42, _hoisted_1$j)), [
|
|
1395
|
+
[vue.unref(vClickOutside), () => togglePopup(false)]
|
|
1396
|
+
]);
|
|
1397
|
+
};
|
|
1398
|
+
}
|
|
1399
|
+
});
|
|
1400
|
+
const _hoisted_1$i = { class: "bs-calendar" };
|
|
1401
|
+
const _hoisted_2$h = { class: "bs-calendar-head" };
|
|
1402
|
+
const _hoisted_3$e = { class: "year-month" };
|
|
1403
|
+
const _hoisted_4$8 = {
|
|
1404
|
+
key: 0,
|
|
1405
|
+
class: "timezone"
|
|
1406
|
+
};
|
|
1407
|
+
const _hoisted_5$3 = { class: "weekdays" };
|
|
1408
|
+
const _hoisted_6$1 = ["textContent"];
|
|
1409
|
+
const _hoisted_7$1 = ["onClick"];
|
|
1410
|
+
const _hoisted_8$1 = {
|
|
1411
|
+
key: 0,
|
|
1412
|
+
class: "bs-calendar-time"
|
|
1413
|
+
};
|
|
1414
|
+
const _hoisted_9$1 = { class: "select-wrap" };
|
|
1415
|
+
const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
|
|
1416
|
+
__name: "BSCalendar",
|
|
1417
|
+
props: {
|
|
1418
|
+
modelValue: {},
|
|
1419
|
+
initialYear: {},
|
|
1420
|
+
initialMonth: {},
|
|
1421
|
+
timeZone: {},
|
|
1422
|
+
showTimeZone: { type: Boolean },
|
|
1423
|
+
resolution: { default: "MINUTE_10" },
|
|
1424
|
+
firstDay: { default: 1 },
|
|
1425
|
+
displayFormat: {},
|
|
1426
|
+
rangeType: {},
|
|
1427
|
+
rangeValue: {},
|
|
1428
|
+
disabled: { type: Boolean },
|
|
1429
|
+
startYear: {},
|
|
1430
|
+
endYear: {}
|
|
1431
|
+
},
|
|
1432
|
+
emits: ["update:modelValue"],
|
|
1433
|
+
setup(__props, { emit: __emit }) {
|
|
1434
|
+
const props = __props;
|
|
1435
|
+
const blueseaConfig = useBlueseaConfig();
|
|
1436
|
+
const emit = __emit;
|
|
1437
|
+
const actualTimeZone = vue.computed(() => props.timeZone || blueseaConfig.timeZone);
|
|
1438
|
+
const actualStartYear = vue.computed(
|
|
1439
|
+
() => props.startYear || blueseaConfig.componentConfig.calendar?.startYear || "-20"
|
|
1440
|
+
);
|
|
1441
|
+
const actualEndYear = vue.computed(
|
|
1442
|
+
() => props.endYear || blueseaConfig.componentConfig.calendar?.endYear || "+20"
|
|
1443
|
+
);
|
|
1444
|
+
const today = vue.computed(() => dayjs().tz(actualTimeZone.value));
|
|
1445
|
+
const isToday = (day) => today.value.year() === day.year() && today.value.month() === day.month() && today.value.date() === day.date();
|
|
1446
|
+
const year = vue.ref();
|
|
1447
|
+
const month = vue.ref();
|
|
1448
|
+
const selected = vue.ref();
|
|
1449
|
+
const dayjsResolution = vue.computed(
|
|
1450
|
+
() => props.resolution === "MINUTE_10" || props.resolution === "MINUTE_30" ? "minute" : props.resolution.toLowerCase()
|
|
1451
|
+
);
|
|
1452
|
+
vue.watch(
|
|
1453
|
+
() => props.modelValue,
|
|
1454
|
+
() => {
|
|
1455
|
+
if (props.modelValue) {
|
|
1456
|
+
let date = dayjs(props.modelValue).tz(actualTimeZone.value);
|
|
1457
|
+
if (props.rangeType === "to") date = date.endOf(dayjsResolution.value);
|
|
1458
|
+
year.value = date.year();
|
|
1459
|
+
month.value = date.month() + 1;
|
|
1460
|
+
selected.value = date;
|
|
1461
|
+
} else {
|
|
1462
|
+
year.value = props.initialYear || today.value.year();
|
|
1463
|
+
month.value = props.initialMonth || today.value.month() + 1;
|
|
1464
|
+
}
|
|
1465
|
+
},
|
|
1466
|
+
{ immediate: true }
|
|
1467
|
+
);
|
|
1468
|
+
const firstDay = vue.computed(
|
|
1469
|
+
() => dayjs.tz(`${year.value}-${month.value}-1`, "YYYY-M-D", actualTimeZone.value)
|
|
1470
|
+
);
|
|
1471
|
+
const weekdays = vue.computed(() => {
|
|
1472
|
+
if (props.firstDay === 0) return ["S", "M", "T", "W", "T", "F", "S"];
|
|
1473
|
+
else return ["M", "T", "W", "T", "F", "S", "S"];
|
|
1474
|
+
});
|
|
1475
|
+
const monthDays = vue.computed(() => {
|
|
1476
|
+
const days = [];
|
|
1477
|
+
const diff = (firstDay.value.day() + (7 - props.firstDay)) % 7;
|
|
1478
|
+
let current = firstDay.value.add(-diff, "day");
|
|
1479
|
+
[...Array(6).keys()].forEach(() => {
|
|
1480
|
+
const week = [];
|
|
1481
|
+
days.push(week);
|
|
1482
|
+
[...Array(7).keys()].forEach(() => {
|
|
1483
|
+
week.push(current);
|
|
1484
|
+
current = current.add(1, "day");
|
|
1485
|
+
});
|
|
1486
|
+
});
|
|
1487
|
+
return days;
|
|
1488
|
+
});
|
|
1489
|
+
const calculateYear = (now, value) => {
|
|
1490
|
+
if (value.startsWith("+") || value.startsWith("-"))
|
|
1491
|
+
return now + parseInt(value);
|
|
1492
|
+
else return parseInt(value);
|
|
1493
|
+
};
|
|
1494
|
+
const years = vue.computed(() => {
|
|
1495
|
+
const now = dayjs().year();
|
|
1496
|
+
const start = calculateYear(now, actualStartYear.value.trim());
|
|
1497
|
+
const end = calculateYear(now, actualEndYear.value.trim());
|
|
1498
|
+
if (end >= start) {
|
|
1499
|
+
const length = end - start + 1;
|
|
1500
|
+
return Array.from({ length }, (_, i) => start + i);
|
|
1501
|
+
}
|
|
1502
|
+
return [];
|
|
1503
|
+
});
|
|
1504
|
+
const months = [...Array(12).keys()].map((value) => value + 1);
|
|
1505
|
+
const hours = [...Array(24).keys()];
|
|
1506
|
+
const minutes = vue.computed(() => {
|
|
1507
|
+
if (props.resolution === "MINUTE_10") {
|
|
1508
|
+
if (props.rangeType === "to") return [9, 19, 29, 39, 49, 59];
|
|
1509
|
+
else return [0, 10, 20, 30, 40, 50];
|
|
1510
|
+
} else if (props.resolution === "MINUTE_30") {
|
|
1511
|
+
if (props.rangeType === "to") return [29, 59];
|
|
1512
|
+
else return [0, 30];
|
|
1513
|
+
} else {
|
|
1514
|
+
return [...Array(60).keys()];
|
|
1515
|
+
}
|
|
1516
|
+
});
|
|
1517
|
+
const defaultHour = vue.computed(() => props.rangeType === "to" ? 23 : 0);
|
|
1518
|
+
const defaultMinute = vue.computed(() => props.rangeType === "to" ? 59 : 0);
|
|
1519
|
+
const selectDate = (day) => {
|
|
1520
|
+
if (props.disabled) return;
|
|
1521
|
+
if (selected.value) {
|
|
1522
|
+
day = day.hour(selected.value.hour()).minute(selected.value.minute());
|
|
1523
|
+
} else {
|
|
1524
|
+
day = day.hour(defaultHour.value).minute(defaultMinute.value);
|
|
1525
|
+
}
|
|
1526
|
+
if (props.rangeType === "to") {
|
|
1527
|
+
day = day.endOf(dayjsResolution.value);
|
|
1528
|
+
} else {
|
|
1529
|
+
day = day.startOf(dayjsResolution.value);
|
|
1530
|
+
}
|
|
1531
|
+
selected.value = day;
|
|
1532
|
+
emitValue();
|
|
1533
|
+
};
|
|
1534
|
+
const initSelectDate = () => {
|
|
1535
|
+
if (!selected.value) {
|
|
1536
|
+
selected.value = dayjs(today.value).startOf("day");
|
|
1537
|
+
}
|
|
1538
|
+
};
|
|
1539
|
+
const updateHour = (hour) => {
|
|
1540
|
+
if (!selected.value) initSelectDate();
|
|
1541
|
+
selected.value = selected.value?.hour(hour || 0);
|
|
1542
|
+
emitValue();
|
|
1543
|
+
};
|
|
1544
|
+
const updateMinute = (minute) => {
|
|
1545
|
+
if (!selected.value) initSelectDate();
|
|
1546
|
+
selected.value = selected.value?.minute(minute || 0);
|
|
1547
|
+
emitValue();
|
|
1548
|
+
};
|
|
1549
|
+
const emitValue = () => {
|
|
1550
|
+
if (selected.value && !props.disabled) {
|
|
1551
|
+
emit("update:modelValue", selected.value.toISOString());
|
|
1552
|
+
}
|
|
1553
|
+
};
|
|
1554
|
+
const rangeDayYmd = vue.computed(
|
|
1555
|
+
() => props.rangeValue ? dayjs(props.rangeValue).tz(actualTimeZone.value).format("YYYY-MM-DD") : void 0
|
|
1556
|
+
);
|
|
1557
|
+
const selectedDay = vue.computed(
|
|
1558
|
+
() => selected.value ? selected.value.tz(actualTimeZone.value).startOf("day") : void 0
|
|
1559
|
+
);
|
|
1560
|
+
const selectedDayYmd = vue.computed(
|
|
1561
|
+
() => selectedDay.value ? selectedDay.value.format("YYYY-MM-DD") : void 0
|
|
1562
|
+
);
|
|
1563
|
+
const isSelectedDay = (day) => selectedDay.value && selectedDay.value.year() === day.year() && selectedDay.value.month() === day.month() && selectedDay.value.date() === day.date();
|
|
1564
|
+
const dayTdClass = (day) => {
|
|
1565
|
+
const result = [`dow-${day.day()}`];
|
|
1566
|
+
if (isToday(day)) result.push("today");
|
|
1567
|
+
if (isSelectedDay(day)) result.push("selected");
|
|
1568
|
+
if (day.month() + 1 !== month.value) result.push("other-month");
|
|
1569
|
+
if (rangeDayYmd.value && selectedDayYmd.value) {
|
|
1570
|
+
const dayYmd = day.format("YYYY-MM-DD");
|
|
1571
|
+
if (props.rangeType === "from" && rangeDayYmd.value >= selectedDayYmd.value) {
|
|
1572
|
+
if (dayYmd === selectedDayYmd.value) result.push("range-selected-start");
|
|
1573
|
+
if (dayYmd === rangeDayYmd.value) result.push("range-selected-end");
|
|
1574
|
+
if (dayYmd >= selectedDayYmd.value && dayYmd <= rangeDayYmd.value)
|
|
1575
|
+
result.push("range-selected");
|
|
1576
|
+
} else if (props.rangeType === "to" && rangeDayYmd.value <= selectedDayYmd.value) {
|
|
1577
|
+
if (dayYmd === rangeDayYmd.value) result.push("range-selected-start");
|
|
1578
|
+
if (dayYmd === selectedDayYmd.value) result.push("range-selected-end");
|
|
1579
|
+
if (dayYmd >= rangeDayYmd.value && dayYmd <= selectedDayYmd.value)
|
|
1580
|
+
result.push("range-selected");
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
return result;
|
|
1584
|
+
};
|
|
1585
|
+
const prevMonth = () => {
|
|
1586
|
+
if (month.value && year.value) {
|
|
1587
|
+
month.value = month.value - 1;
|
|
1588
|
+
if (month.value < 1) {
|
|
1589
|
+
month.value = 12;
|
|
1590
|
+
year.value = year.value - 1;
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
};
|
|
1594
|
+
const nextMonth = () => {
|
|
1595
|
+
if (month.value && year.value) {
|
|
1596
|
+
month.value = month.value + 1;
|
|
1597
|
+
if (month.value > 12) {
|
|
1598
|
+
month.value = 1;
|
|
1599
|
+
year.value = year.value + 1;
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
};
|
|
1603
|
+
return (_ctx, _cache) => {
|
|
1604
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, [
|
|
1605
|
+
vue.createElementVNode("div", _hoisted_2$h, [
|
|
1606
|
+
vue.createElementVNode("div", _hoisted_3$e, [
|
|
1607
|
+
vue.createVNode(_sfc_main$r, {
|
|
1608
|
+
class: "",
|
|
1609
|
+
"left-icon": "chevron_left",
|
|
1610
|
+
onClick: prevMonth
|
|
1611
|
+
}),
|
|
1612
|
+
vue.createVNode(_sfc_main$k, {
|
|
1613
|
+
modelValue: year.value,
|
|
1614
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => year.value = $event),
|
|
1615
|
+
disabled: __props.disabled,
|
|
1616
|
+
items: years.value
|
|
1617
|
+
}, null, 8, ["modelValue", "disabled", "items"]),
|
|
1618
|
+
vue.createVNode(_sfc_main$k, {
|
|
1619
|
+
modelValue: month.value,
|
|
1620
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => month.value = $event),
|
|
1621
|
+
disabled: __props.disabled,
|
|
1622
|
+
items: vue.unref(months)
|
|
1623
|
+
}, null, 8, ["modelValue", "disabled", "items"]),
|
|
1624
|
+
vue.createVNode(_sfc_main$r, {
|
|
1625
|
+
class: "",
|
|
1626
|
+
"left-icon": "chevron_right",
|
|
1627
|
+
onClick: nextMonth
|
|
1628
|
+
})
|
|
1629
|
+
]),
|
|
1630
|
+
__props.showTimeZone ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$8, "(" + vue.toDisplayString(actualTimeZone.value) + ")", 1)) : vue.createCommentVNode("", true)
|
|
1631
|
+
]),
|
|
1632
|
+
vue.createElementVNode("table", {
|
|
1633
|
+
class: vue.normalizeClass([{ disabled: __props.disabled }, "align-self-center"])
|
|
1634
|
+
}, [
|
|
1635
|
+
vue.createElementVNode("tbody", null, [
|
|
1636
|
+
vue.createElementVNode("tr", _hoisted_5$3, [
|
|
1637
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(weekdays.value, (day) => {
|
|
1638
|
+
return vue.openBlock(), vue.createElementBlock("th", {
|
|
1639
|
+
key: day,
|
|
1640
|
+
textContent: vue.toDisplayString(day)
|
|
1641
|
+
}, null, 8, _hoisted_6$1);
|
|
1642
|
+
}), 128))
|
|
1643
|
+
]),
|
|
1644
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(monthDays.value, (week) => {
|
|
1645
|
+
return vue.openBlock(), vue.createElementBlock("tr", {
|
|
1646
|
+
key: week[0].toISOString(),
|
|
1647
|
+
class: "date"
|
|
1648
|
+
}, [
|
|
1649
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(week, (day) => {
|
|
1650
|
+
return vue.openBlock(), vue.createElementBlock("td", {
|
|
1651
|
+
key: day.toISOString(),
|
|
1652
|
+
class: vue.normalizeClass(dayTdClass(day)),
|
|
1653
|
+
onClick: () => selectDate(day)
|
|
1654
|
+
}, [
|
|
1655
|
+
vue.createElementVNode("div", null, vue.toDisplayString(day.date()), 1)
|
|
1656
|
+
], 10, _hoisted_7$1);
|
|
1657
|
+
}), 128))
|
|
1658
|
+
]);
|
|
1659
|
+
}), 128))
|
|
1660
|
+
])
|
|
1661
|
+
], 2),
|
|
1662
|
+
["HOUR", "MINUTE_10", "MINUTE_30", "MINUTE", "SECOND"].includes(
|
|
1663
|
+
__props.resolution
|
|
1664
|
+
) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$1, [
|
|
1665
|
+
vue.createElementVNode("div", _hoisted_9$1, [
|
|
1666
|
+
vue.createVNode(_sfc_main$k, {
|
|
1667
|
+
disabled: __props.disabled,
|
|
1668
|
+
items: hours,
|
|
1669
|
+
"label-provider": (item) => item < 10 ? "0" + item : item.toString(),
|
|
1670
|
+
"model-value": selected.value ? selected.value.hour() : defaultHour.value,
|
|
1671
|
+
"popup-direction": "up",
|
|
1672
|
+
"onUpdate:modelValue": updateHour
|
|
1673
|
+
}, null, 8, ["disabled", "label-provider", "model-value"]),
|
|
1674
|
+
_cache[2] || (_cache[2] = vue.createElementVNode("span", { class: "" }, ":", -1)),
|
|
1675
|
+
vue.createVNode(_sfc_main$k, {
|
|
1676
|
+
disabled: __props.disabled || __props.resolution === "HOUR",
|
|
1677
|
+
items: minutes.value,
|
|
1678
|
+
"label-provider": (item) => item < 10 ? "0" + item : item.toString(),
|
|
1679
|
+
"model-value": selected.value ? selected.value.minute() : defaultMinute.value,
|
|
1680
|
+
"popup-direction": "up",
|
|
1681
|
+
"onUpdate:modelValue": updateMinute
|
|
1682
|
+
}, null, 8, ["disabled", "items", "label-provider", "model-value"])
|
|
1683
|
+
])
|
|
1684
|
+
])) : vue.createCommentVNode("", true)
|
|
1685
|
+
]);
|
|
1686
|
+
};
|
|
1687
|
+
}
|
|
1688
|
+
});
|
|
1689
|
+
const _hoisted_1$h = { class: "bs-calendar-range flex flex-row" };
|
|
1690
|
+
const _hoisted_2$g = { class: "flex flex-col" };
|
|
1691
|
+
const _hoisted_3$d = { class: "flex flex-row items-center" };
|
|
1692
|
+
const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
|
|
1693
|
+
__name: "BSCalendarRange",
|
|
1694
|
+
props: {
|
|
1695
|
+
from: {},
|
|
1696
|
+
to: {},
|
|
1697
|
+
disabledFrom: { type: Boolean },
|
|
1698
|
+
disabledTo: { type: Boolean },
|
|
1699
|
+
timeZone: {},
|
|
1700
|
+
firstDay: { default: 1 },
|
|
1701
|
+
displayFormat: {},
|
|
1702
|
+
resolution: {},
|
|
1703
|
+
startYear: {},
|
|
1704
|
+
endYear: {}
|
|
1705
|
+
},
|
|
1706
|
+
emits: ["update:from", "update:to"],
|
|
1707
|
+
setup(__props, { emit: __emit }) {
|
|
1708
|
+
const props = __props;
|
|
1709
|
+
const emit = __emit;
|
|
1710
|
+
const blueseaConfig = useBlueseaConfig();
|
|
1711
|
+
const actualTimeZone = vue.computed(() => props.timeZone || blueseaConfig.timeZone);
|
|
1712
|
+
const nextMonth = vue.computed(() => dayjs().add(1, "month").tz(actualTimeZone.value));
|
|
1713
|
+
const fromValue = vue.ref();
|
|
1714
|
+
const toValue = vue.ref();
|
|
1715
|
+
vue.watch(
|
|
1716
|
+
() => [props.from, props.to],
|
|
1717
|
+
() => {
|
|
1718
|
+
fromValue.value = props.from;
|
|
1719
|
+
toValue.value = props.to;
|
|
1720
|
+
},
|
|
1721
|
+
{ immediate: true }
|
|
1722
|
+
);
|
|
1723
|
+
const updateFrom = (value) => {
|
|
1724
|
+
emit("update:from", value);
|
|
1725
|
+
};
|
|
1726
|
+
const updateTo = (value) => {
|
|
1727
|
+
emit("update:to", value);
|
|
1728
|
+
};
|
|
1729
|
+
return (_ctx, _cache) => {
|
|
1730
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
|
|
1731
|
+
vue.createElementVNode("div", _hoisted_2$g, [
|
|
1732
|
+
vue.createElementVNode("div", _hoisted_3$d, [
|
|
1733
|
+
vue.createVNode(_sfc_main$j, {
|
|
1734
|
+
modelValue: fromValue.value,
|
|
1735
|
+
"onUpdate:modelValue": [
|
|
1736
|
+
_cache[0] || (_cache[0] = ($event) => fromValue.value = $event),
|
|
1737
|
+
updateFrom
|
|
1738
|
+
],
|
|
1739
|
+
disabled: __props.disabledFrom,
|
|
1740
|
+
"display-format": __props.displayFormat,
|
|
1741
|
+
"end-year": __props.endYear,
|
|
1742
|
+
"first-day": __props.firstDay,
|
|
1743
|
+
"range-value": toValue.value,
|
|
1744
|
+
resolution: __props.resolution,
|
|
1745
|
+
"start-year": __props.startYear,
|
|
1746
|
+
"time-zone": actualTimeZone.value,
|
|
1747
|
+
"hide-extra-date": "",
|
|
1748
|
+
"range-type": "from"
|
|
1749
|
+
}, null, 8, ["modelValue", "disabled", "display-format", "end-year", "first-day", "range-value", "resolution", "start-year", "time-zone"]),
|
|
1750
|
+
_cache[2] || (_cache[2] = vue.createElementVNode("span", { class: "tilde" }, "~", -1)),
|
|
1751
|
+
vue.createVNode(_sfc_main$j, {
|
|
1752
|
+
modelValue: toValue.value,
|
|
1753
|
+
"onUpdate:modelValue": [
|
|
1754
|
+
_cache[1] || (_cache[1] = ($event) => toValue.value = $event),
|
|
1755
|
+
updateTo
|
|
1756
|
+
],
|
|
1757
|
+
disabled: __props.disabledTo,
|
|
1758
|
+
"display-format": __props.displayFormat,
|
|
1759
|
+
"end-year": __props.endYear,
|
|
1760
|
+
"first-day": __props.firstDay,
|
|
1761
|
+
"initial-month": __props.to ? void 0 : nextMonth.value.month() + 1,
|
|
1762
|
+
"initial-year": __props.to ? void 0 : nextMonth.value.year(),
|
|
1763
|
+
"range-value": fromValue.value,
|
|
1764
|
+
resolution: __props.resolution,
|
|
1765
|
+
"start-year": __props.startYear,
|
|
1766
|
+
"time-zone": actualTimeZone.value,
|
|
1767
|
+
"hide-extra-date": "",
|
|
1768
|
+
"range-type": "to"
|
|
1769
|
+
}, null, 8, ["modelValue", "disabled", "display-format", "end-year", "first-day", "initial-month", "initial-year", "range-value", "resolution", "start-year", "time-zone"])
|
|
1770
|
+
])
|
|
1771
|
+
])
|
|
1772
|
+
]);
|
|
1773
|
+
};
|
|
1774
|
+
}
|
|
1775
|
+
});
|
|
1776
|
+
let nextId = 0;
|
|
1777
|
+
let nextName = 0;
|
|
1778
|
+
const componentUtil = {
|
|
1779
|
+
handleExternalErrorMessage(showErrorMessage, errorMessage, elementId) {
|
|
1780
|
+
if (elementId) {
|
|
1781
|
+
const el = document.getElementById(elementId);
|
|
1782
|
+
if (el) {
|
|
1783
|
+
if (!showErrorMessage || !errorMessage || errorMessage.length === 0) {
|
|
1784
|
+
el.style.display = "none";
|
|
1785
|
+
} else {
|
|
1786
|
+
el.style.display = "";
|
|
1787
|
+
el.textContent = errorMessage || "";
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
},
|
|
1792
|
+
generateNextId(prefix) {
|
|
1793
|
+
return `${prefix}-${++nextId}`;
|
|
1794
|
+
},
|
|
1795
|
+
generateNextName(prefix) {
|
|
1796
|
+
return `${prefix}${++nextName}`;
|
|
1797
|
+
},
|
|
1798
|
+
isRelativeSize(size) {
|
|
1799
|
+
return size?.endsWith("%") || false;
|
|
1800
|
+
},
|
|
1801
|
+
delayed(func, millis = 200) {
|
|
1802
|
+
if (millis <= 0) {
|
|
1803
|
+
func();
|
|
1804
|
+
} else {
|
|
1805
|
+
window.setTimeout(func, millis);
|
|
1806
|
+
}
|
|
1807
|
+
},
|
|
1808
|
+
trimStringValue(value, trim) {
|
|
1809
|
+
return trim ? value?.trim() : value;
|
|
1810
|
+
},
|
|
1811
|
+
getPrefixSuffixList(param) {
|
|
1812
|
+
if (!param)
|
|
1813
|
+
return [];
|
|
1814
|
+
const params = Array.isArray(param) ? param : [param];
|
|
1815
|
+
const list = [];
|
|
1816
|
+
for (let item of params) {
|
|
1817
|
+
if (!item)
|
|
1818
|
+
continue;
|
|
1819
|
+
if (typeof item === "object" && item.hasOwnProperty("type") && item.hasOwnProperty("value")) {
|
|
1820
|
+
list.push(item);
|
|
1821
|
+
} else {
|
|
1822
|
+
list.push({ type: "text", value: item });
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
return list;
|
|
1826
|
+
}
|
|
1827
|
+
};
|
|
1828
|
+
const _hoisted_1$g = ["textContent"];
|
|
1829
|
+
const _hoisted_2$f = { class: "font-icon" };
|
|
1830
|
+
const _hoisted_3$c = ["src", "alt"];
|
|
1831
|
+
const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
1832
|
+
__name: "BSPrefixSuffix",
|
|
1833
|
+
props: {
|
|
1834
|
+
value: {},
|
|
1835
|
+
type: {}
|
|
1836
|
+
},
|
|
1837
|
+
setup(__props) {
|
|
1838
|
+
const props = __props;
|
|
1839
|
+
const items = vue.computed(() => componentUtil.getPrefixSuffixList(props.value));
|
|
1840
|
+
return (_ctx, _cache) => {
|
|
1841
|
+
return vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(items.value, (item) => {
|
|
1842
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
1843
|
+
item.type === "text" ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
1844
|
+
textContent: vue.toDisplayString(item.value),
|
|
1845
|
+
key: JSON.stringify(item.value),
|
|
1846
|
+
class: vue.normalizeClass(__props.type)
|
|
1847
|
+
}, null, 10, _hoisted_1$g)) : item.type === "font-icon" ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
1848
|
+
key: 1,
|
|
1849
|
+
class: vue.normalizeClass(__props.type)
|
|
1850
|
+
}, [
|
|
1851
|
+
vue.createElementVNode("span", _hoisted_2$f, vue.toDisplayString(item.value), 1)
|
|
1852
|
+
], 2)) : item.type === "image-url" ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
1853
|
+
key: 2,
|
|
1854
|
+
class: vue.normalizeClass(__props.type)
|
|
1855
|
+
}, [
|
|
1856
|
+
vue.createElementVNode("img", {
|
|
1857
|
+
src: item.value,
|
|
1858
|
+
alt: __props.type
|
|
1859
|
+
}, null, 8, _hoisted_3$c)
|
|
1860
|
+
], 2)) : vue.createCommentVNode("", true)
|
|
1861
|
+
], 64);
|
|
1862
|
+
}), 256);
|
|
1863
|
+
};
|
|
1864
|
+
}
|
|
1865
|
+
});
|
|
1866
|
+
const _hoisted_1$f = {
|
|
1867
|
+
key: 0,
|
|
1868
|
+
class: "view-mode"
|
|
1869
|
+
};
|
|
1870
|
+
const _hoisted_2$e = ["textContent"];
|
|
1871
|
+
const _hoisted_3$b = {
|
|
1872
|
+
key: 1,
|
|
1873
|
+
class: "input-area"
|
|
1874
|
+
};
|
|
1875
|
+
const _hoisted_4$7 = ["id", "placeholder", "autocomplete", "disabled", "maxlength", "name", "tabindex", "type"];
|
|
1876
|
+
const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
|
|
1877
|
+
__name: "BSTextInput",
|
|
1878
|
+
props: {
|
|
1879
|
+
id: {},
|
|
1880
|
+
placeholder: {},
|
|
1881
|
+
name: { default: () => componentUtil.generateNextName("textInput") },
|
|
1882
|
+
modelValue: {},
|
|
1883
|
+
maxlength: {},
|
|
1884
|
+
disabled: { type: Boolean },
|
|
1885
|
+
forceValidateWhenDisabled: { type: Boolean },
|
|
1886
|
+
viewMode: { type: Boolean },
|
|
1887
|
+
width: { default: "200px" },
|
|
1888
|
+
autocomplete: {},
|
|
1889
|
+
tabindex: { default: 0 },
|
|
1890
|
+
inputType: { default: "text" },
|
|
1891
|
+
trimValue: { type: Boolean, default: true },
|
|
1892
|
+
prefix: {},
|
|
1893
|
+
suffix: {},
|
|
1894
|
+
required: { type: Boolean },
|
|
1895
|
+
minLength: {},
|
|
1896
|
+
maxLength: {},
|
|
1897
|
+
regExp: {},
|
|
1898
|
+
validationMessageRequired: {},
|
|
1899
|
+
validationMessageMinLength: {},
|
|
1900
|
+
validationMessageMaxLength: {},
|
|
1901
|
+
validationMessageBetweenLength: {},
|
|
1902
|
+
validationMessageRegExp: {},
|
|
1903
|
+
extraValidationRules: {},
|
|
1904
|
+
ignoreSavePoint: { type: Boolean },
|
|
1905
|
+
hideErrorMessage: { type: Boolean },
|
|
1906
|
+
showErrorMessageOnDisabled: { type: Boolean }
|
|
1907
|
+
},
|
|
1908
|
+
emits: ["update:modelValue"],
|
|
1909
|
+
setup(__props, { emit: __emit }) {
|
|
1910
|
+
const props = __props;
|
|
1911
|
+
const emit = __emit;
|
|
1912
|
+
vue.watch(
|
|
1913
|
+
() => props.modelValue,
|
|
1914
|
+
() => {
|
|
1915
|
+
stringValue.value = convertFromValue(props.modelValue);
|
|
1916
|
+
validateValue(props.modelValue || "", "change");
|
|
1917
|
+
}
|
|
1918
|
+
);
|
|
1919
|
+
const field = vue.ref();
|
|
1920
|
+
const fieldContext = useFieldContext();
|
|
1921
|
+
const isValid = async (value, phase) => {
|
|
1922
|
+
const errors2 = [];
|
|
1923
|
+
const text = value ?? "";
|
|
1924
|
+
executeRequiredValidation(
|
|
1925
|
+
text,
|
|
1926
|
+
props.required,
|
|
1927
|
+
props.validationMessageRequired,
|
|
1928
|
+
errors2
|
|
1929
|
+
) || executeRegExpValidation(
|
|
1930
|
+
text,
|
|
1931
|
+
props.regExp,
|
|
1932
|
+
props.validationMessageRegExp,
|
|
1933
|
+
errors2
|
|
1934
|
+
) || executeBetweenLengthValidation(
|
|
1935
|
+
text,
|
|
1936
|
+
props.minLength,
|
|
1937
|
+
props.validationMessageMinLength,
|
|
1938
|
+
props.maxLength,
|
|
1939
|
+
props.validationMessageMaxLength,
|
|
1940
|
+
props.validationMessageBetweenLength,
|
|
1941
|
+
errors2
|
|
1942
|
+
) || await executeFieldValidationRule(
|
|
1943
|
+
text,
|
|
1944
|
+
props.extraValidationRules,
|
|
1945
|
+
errors2,
|
|
1946
|
+
phase,
|
|
1947
|
+
fieldContext
|
|
1948
|
+
);
|
|
1949
|
+
return errors2;
|
|
1950
|
+
};
|
|
1951
|
+
const convertToValue = (stringValue2) => {
|
|
1952
|
+
return String(
|
|
1953
|
+
componentUtil.trimStringValue(stringValue2, props.trimValue) || ""
|
|
1954
|
+
);
|
|
1955
|
+
};
|
|
1956
|
+
const convertFromValue = (value) => {
|
|
1957
|
+
return componentUtil.trimStringValue(value, props.trimValue) ?? "";
|
|
1958
|
+
};
|
|
1959
|
+
const validationDisabled = vue.computed(
|
|
1960
|
+
() => props.viewMode || props.disabled && !props.forceValidateWhenDisabled
|
|
1961
|
+
);
|
|
1962
|
+
const {
|
|
1963
|
+
stringValue,
|
|
1964
|
+
errors,
|
|
1965
|
+
handleInput,
|
|
1966
|
+
handleFocus,
|
|
1967
|
+
handleBlur,
|
|
1968
|
+
validateValue
|
|
1969
|
+
} = fieldValidator({
|
|
1970
|
+
field,
|
|
1971
|
+
disabled: validationDisabled,
|
|
1972
|
+
initialValue: props.modelValue,
|
|
1973
|
+
isValid,
|
|
1974
|
+
convertToValue,
|
|
1975
|
+
convertFromValue
|
|
1976
|
+
});
|
|
1977
|
+
const handlers = {
|
|
1978
|
+
input: handleInput,
|
|
1979
|
+
focus: handleFocus,
|
|
1980
|
+
blur: handleBlur,
|
|
1981
|
+
change: () => {
|
|
1982
|
+
emit("update:modelValue", convertToValue(stringValue.value));
|
|
1983
|
+
}
|
|
1984
|
+
};
|
|
1985
|
+
const savePoint = props.ignoreSavePoint ? void 0 : useSavePoint();
|
|
1986
|
+
const savePointHandler = savePoint?.registerField({
|
|
1987
|
+
field,
|
|
1988
|
+
getCurrentValue: () => props.modelValue || "",
|
|
1989
|
+
setCurrentValue: (value) => emit("update:modelValue", value || "")
|
|
1990
|
+
});
|
|
1991
|
+
const modified = vue.computed(
|
|
1992
|
+
() => !!savePointHandler?.isModified(props.modelValue || "")
|
|
1993
|
+
);
|
|
1994
|
+
vue.onBeforeUnmount(() => savePoint?.unregisterField(field));
|
|
1995
|
+
return (_ctx, _cache) => {
|
|
1996
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
1997
|
+
class: vue.normalizeClass([{ required: __props.required, disabled: __props.disabled, modified: modified.value, error: vue.unref(errors).length > 0 }, "bs-text-input bs-input-wrap"]),
|
|
1998
|
+
style: vue.normalizeStyle({ width: __props.width })
|
|
1999
|
+
}, [
|
|
2000
|
+
__props.viewMode ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, [
|
|
2001
|
+
vue.createVNode(_sfc_main$h, {
|
|
2002
|
+
value: __props.prefix,
|
|
2003
|
+
type: "prefix"
|
|
2004
|
+
}, null, 8, ["value"]),
|
|
2005
|
+
vue.createElementVNode("span", {
|
|
2006
|
+
textContent: vue.toDisplayString(vue.unref(stringValue))
|
|
2007
|
+
}, null, 8, _hoisted_2$e),
|
|
2008
|
+
vue.createVNode(_sfc_main$h, {
|
|
2009
|
+
value: __props.suffix,
|
|
2010
|
+
type: "suffix"
|
|
2011
|
+
}, null, 8, ["value"])
|
|
2012
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$b, [
|
|
2013
|
+
vue.createVNode(_sfc_main$h, {
|
|
2014
|
+
value: __props.prefix,
|
|
2015
|
+
type: "prefix"
|
|
2016
|
+
}, null, 8, ["value"]),
|
|
2017
|
+
vue.withDirectives(vue.createElementVNode("input", vue.mergeProps({
|
|
2018
|
+
id: __props.id,
|
|
2019
|
+
ref_key: "field",
|
|
2020
|
+
ref: field,
|
|
2021
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(stringValue) ? stringValue.value = $event : null),
|
|
2022
|
+
placeholder: __props.placeholder,
|
|
2023
|
+
autocomplete: __props.autocomplete,
|
|
2024
|
+
disabled: __props.disabled,
|
|
2025
|
+
maxlength: __props.maxlength,
|
|
2026
|
+
name: __props.name,
|
|
2027
|
+
tabindex: __props.tabindex,
|
|
2028
|
+
type: __props.inputType
|
|
2029
|
+
}, vue.toHandlers(handlers, true)), null, 16, _hoisted_4$7), [
|
|
2030
|
+
[vue.vModelDynamic, vue.unref(stringValue)]
|
|
2031
|
+
]),
|
|
2032
|
+
vue.createVNode(_sfc_main$h, {
|
|
2033
|
+
value: __props.suffix,
|
|
2034
|
+
type: "suffix"
|
|
2035
|
+
}, null, 8, ["value"])
|
|
2036
|
+
])),
|
|
2037
|
+
!__props.viewMode ? (vue.openBlock(), vue.createBlock(_sfc_main$l, {
|
|
2038
|
+
key: 2,
|
|
2039
|
+
errors: vue.unref(errors),
|
|
2040
|
+
"hide-error-message": __props.hideErrorMessage || __props.disabled && !__props.showErrorMessageOnDisabled
|
|
2041
|
+
}, null, 8, ["errors", "hide-error-message"])) : vue.createCommentVNode("", true)
|
|
2042
|
+
], 6);
|
|
2043
|
+
};
|
|
2044
|
+
}
|
|
2045
|
+
});
|
|
2046
|
+
function getDefaultExportFromCjs(x) {
|
|
2047
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
2048
|
+
}
|
|
2049
|
+
var utc$2 = { exports: {} };
|
|
2050
|
+
var utc$1 = utc$2.exports;
|
|
2051
|
+
var hasRequiredUtc;
|
|
2052
|
+
function requireUtc() {
|
|
2053
|
+
if (hasRequiredUtc) return utc$2.exports;
|
|
2054
|
+
hasRequiredUtc = 1;
|
|
2055
|
+
(function(module2, exports3) {
|
|
2056
|
+
!(function(t, i) {
|
|
2057
|
+
module2.exports = i();
|
|
2058
|
+
})(utc$1, (function() {
|
|
2059
|
+
var t = "minute", i = /[+-]\d\d(?::?\d\d)?/g, e = /([+-]|\d\d)/g;
|
|
2060
|
+
return function(s, f, n) {
|
|
2061
|
+
var u = f.prototype;
|
|
2062
|
+
n.utc = function(t2) {
|
|
2063
|
+
var i2 = { date: t2, utc: true, args: arguments };
|
|
2064
|
+
return new f(i2);
|
|
2065
|
+
}, u.utc = function(i2) {
|
|
2066
|
+
var e2 = n(this.toDate(), { locale: this.$L, utc: true });
|
|
2067
|
+
return i2 ? e2.add(this.utcOffset(), t) : e2;
|
|
2068
|
+
}, u.local = function() {
|
|
2069
|
+
return n(this.toDate(), { locale: this.$L, utc: false });
|
|
2070
|
+
};
|
|
2071
|
+
var r = u.parse;
|
|
2072
|
+
u.parse = function(t2) {
|
|
2073
|
+
t2.utc && (this.$u = true), this.$utils().u(t2.$offset) || (this.$offset = t2.$offset), r.call(this, t2);
|
|
2074
|
+
};
|
|
2075
|
+
var o = u.init;
|
|
2076
|
+
u.init = function() {
|
|
2077
|
+
if (this.$u) {
|
|
2078
|
+
var t2 = this.$d;
|
|
2079
|
+
this.$y = t2.getUTCFullYear(), this.$M = t2.getUTCMonth(), this.$D = t2.getUTCDate(), this.$W = t2.getUTCDay(), this.$H = t2.getUTCHours(), this.$m = t2.getUTCMinutes(), this.$s = t2.getUTCSeconds(), this.$ms = t2.getUTCMilliseconds();
|
|
2080
|
+
} else o.call(this);
|
|
2081
|
+
};
|
|
2082
|
+
var a = u.utcOffset;
|
|
2083
|
+
u.utcOffset = function(s2, f2) {
|
|
2084
|
+
var n2 = this.$utils().u;
|
|
2085
|
+
if (n2(s2)) return this.$u ? 0 : n2(this.$offset) ? a.call(this) : this.$offset;
|
|
2086
|
+
if ("string" == typeof s2 && (s2 = (function(t2) {
|
|
2087
|
+
void 0 === t2 && (t2 = "");
|
|
2088
|
+
var s3 = t2.match(i);
|
|
2089
|
+
if (!s3) return null;
|
|
2090
|
+
var f3 = ("" + s3[0]).match(e) || ["-", 0, 0], n3 = f3[0], u3 = 60 * +f3[1] + +f3[2];
|
|
2091
|
+
return 0 === u3 ? 0 : "+" === n3 ? u3 : -u3;
|
|
2092
|
+
})(s2), null === s2)) return this;
|
|
2093
|
+
var u2 = Math.abs(s2) <= 16 ? 60 * s2 : s2;
|
|
2094
|
+
if (0 === u2) return this.utc(f2);
|
|
2095
|
+
var r2 = this.clone();
|
|
2096
|
+
if (f2) return r2.$offset = u2, r2.$u = false, r2;
|
|
2097
|
+
var o2 = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
|
|
2098
|
+
return (r2 = this.local().add(u2 + o2, t)).$offset = u2, r2.$x.$localOffset = o2, r2;
|
|
2099
|
+
};
|
|
2100
|
+
var h = u.format;
|
|
2101
|
+
u.format = function(t2) {
|
|
2102
|
+
var i2 = t2 || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
|
|
2103
|
+
return h.call(this, i2);
|
|
2104
|
+
}, u.valueOf = function() {
|
|
2105
|
+
var t2 = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
|
|
2106
|
+
return this.$d.valueOf() - 6e4 * t2;
|
|
2107
|
+
}, u.isUTC = function() {
|
|
2108
|
+
return !!this.$u;
|
|
2109
|
+
}, u.toISOString = function() {
|
|
2110
|
+
return this.toDate().toISOString();
|
|
2111
|
+
}, u.toString = function() {
|
|
2112
|
+
return this.toDate().toUTCString();
|
|
2113
|
+
};
|
|
2114
|
+
var l = u.toDate;
|
|
2115
|
+
u.toDate = function(t2) {
|
|
2116
|
+
return "s" === t2 && this.$offset ? n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : l.call(this);
|
|
2117
|
+
};
|
|
2118
|
+
var c = u.diff;
|
|
2119
|
+
u.diff = function(t2, i2, e2) {
|
|
2120
|
+
if (t2 && this.$u === t2.$u) return c.call(this, t2, i2, e2);
|
|
2121
|
+
var s2 = this.local(), f2 = n(t2).local();
|
|
2122
|
+
return c.call(s2, f2, i2, e2);
|
|
2123
|
+
};
|
|
2124
|
+
};
|
|
2125
|
+
}));
|
|
2126
|
+
})(utc$2);
|
|
2127
|
+
return utc$2.exports;
|
|
2128
|
+
}
|
|
2129
|
+
var utcExports = requireUtc();
|
|
2130
|
+
const utc = /* @__PURE__ */ getDefaultExportFromCjs(utcExports);
|
|
2131
|
+
var timezone$2 = { exports: {} };
|
|
2132
|
+
var timezone$1 = timezone$2.exports;
|
|
2133
|
+
var hasRequiredTimezone;
|
|
2134
|
+
function requireTimezone() {
|
|
2135
|
+
if (hasRequiredTimezone) return timezone$2.exports;
|
|
2136
|
+
hasRequiredTimezone = 1;
|
|
2137
|
+
(function(module2, exports3) {
|
|
2138
|
+
!(function(t, e) {
|
|
2139
|
+
module2.exports = e();
|
|
2140
|
+
})(timezone$1, (function() {
|
|
2141
|
+
var t = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, e = {};
|
|
2142
|
+
return function(n, i, o) {
|
|
2143
|
+
var r, a = function(t2, n2, i2) {
|
|
2144
|
+
void 0 === i2 && (i2 = {});
|
|
2145
|
+
var o2 = new Date(t2), r2 = (function(t3, n3) {
|
|
2146
|
+
void 0 === n3 && (n3 = {});
|
|
2147
|
+
var i3 = n3.timeZoneName || "short", o3 = t3 + "|" + i3, r3 = e[o3];
|
|
2148
|
+
return r3 || (r3 = new Intl.DateTimeFormat("en-US", { hour12: false, timeZone: t3, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: i3 }), e[o3] = r3), r3;
|
|
2149
|
+
})(n2, i2);
|
|
2150
|
+
return r2.formatToParts(o2);
|
|
2151
|
+
}, u = function(e2, n2) {
|
|
2152
|
+
for (var i2 = a(e2, n2), r2 = [], u2 = 0; u2 < i2.length; u2 += 1) {
|
|
2153
|
+
var f2 = i2[u2], s2 = f2.type, m = f2.value, c = t[s2];
|
|
2154
|
+
c >= 0 && (r2[c] = parseInt(m, 10));
|
|
2155
|
+
}
|
|
2156
|
+
var d = r2[3], l = 24 === d ? 0 : d, h = r2[0] + "-" + r2[1] + "-" + r2[2] + " " + l + ":" + r2[4] + ":" + r2[5] + ":000", v = +e2;
|
|
2157
|
+
return (o.utc(h).valueOf() - (v -= v % 1e3)) / 6e4;
|
|
2158
|
+
}, f = i.prototype;
|
|
2159
|
+
f.tz = function(t2, e2) {
|
|
2160
|
+
void 0 === t2 && (t2 = r);
|
|
2161
|
+
var n2, i2 = this.utcOffset(), a2 = this.toDate(), u2 = a2.toLocaleString("en-US", { timeZone: t2 }), f2 = Math.round((a2 - new Date(u2)) / 1e3 / 60), s2 = 15 * -Math.round(a2.getTimezoneOffset() / 15) - f2;
|
|
2162
|
+
if (!Number(s2)) n2 = this.utcOffset(0, e2);
|
|
2163
|
+
else if (n2 = o(u2, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(s2, true), e2) {
|
|
2164
|
+
var m = n2.utcOffset();
|
|
2165
|
+
n2 = n2.add(i2 - m, "minute");
|
|
2166
|
+
}
|
|
2167
|
+
return n2.$x.$timezone = t2, n2;
|
|
2168
|
+
}, f.offsetName = function(t2) {
|
|
2169
|
+
var e2 = this.$x.$timezone || o.tz.guess(), n2 = a(this.valueOf(), e2, { timeZoneName: t2 }).find((function(t3) {
|
|
2170
|
+
return "timezonename" === t3.type.toLowerCase();
|
|
2171
|
+
}));
|
|
2172
|
+
return n2 && n2.value;
|
|
2173
|
+
};
|
|
2174
|
+
var s = f.startOf;
|
|
2175
|
+
f.startOf = function(t2, e2) {
|
|
2176
|
+
if (!this.$x || !this.$x.$timezone) return s.call(this, t2, e2);
|
|
2177
|
+
var n2 = o(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
|
|
2178
|
+
return s.call(n2, t2, e2).tz(this.$x.$timezone, true);
|
|
2179
|
+
}, o.tz = function(t2, e2, n2) {
|
|
2180
|
+
var i2 = n2 && e2, a2 = n2 || e2 || r, f2 = u(+o(), a2);
|
|
2181
|
+
if ("string" != typeof t2) return o(t2).tz(a2);
|
|
2182
|
+
var s2 = (function(t3, e3, n3) {
|
|
2183
|
+
var i3 = t3 - 60 * e3 * 1e3, o2 = u(i3, n3);
|
|
2184
|
+
if (e3 === o2) return [i3, e3];
|
|
2185
|
+
var r2 = u(i3 -= 60 * (o2 - e3) * 1e3, n3);
|
|
2186
|
+
return o2 === r2 ? [i3, o2] : [t3 - 60 * Math.min(o2, r2) * 1e3, Math.max(o2, r2)];
|
|
2187
|
+
})(o.utc(t2, i2).valueOf(), f2, a2), m = s2[0], c = s2[1], d = o(m).utcOffset(c);
|
|
2188
|
+
return d.$x.$timezone = a2, d;
|
|
2189
|
+
}, o.tz.guess = function() {
|
|
2190
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
2191
|
+
}, o.tz.setDefault = function(t2) {
|
|
2192
|
+
r = t2;
|
|
2193
|
+
};
|
|
2194
|
+
};
|
|
2195
|
+
}));
|
|
2196
|
+
})(timezone$2);
|
|
2197
|
+
return timezone$2.exports;
|
|
2198
|
+
}
|
|
2199
|
+
var timezoneExports = requireTimezone();
|
|
2200
|
+
const timezone = /* @__PURE__ */ getDefaultExportFromCjs(timezoneExports);
|
|
2201
|
+
dayjs.extend(utc);
|
|
2202
|
+
dayjs.extend(timezone);
|
|
2203
|
+
const round = (num, decimalPlace = 2) => {
|
|
2204
|
+
const pow = Math.pow(10, decimalPlace);
|
|
2205
|
+
return Math.round(num * pow) / pow;
|
|
2206
|
+
};
|
|
2207
|
+
const formatUtil = {
|
|
2208
|
+
/**
|
|
2209
|
+
* 개행 문자('\r', '\n')를 '<br/>' 태그로 변경한다.
|
|
2210
|
+
* @param str 변경할 String
|
|
2211
|
+
* @return 개행문자가 '<br/>'로 변경된 String
|
|
2212
|
+
*/
|
|
2213
|
+
escapeNewLine(str) {
|
|
2214
|
+
return str ? str.replace(/\r\n|\r|\n/g, "<br />") : "";
|
|
2215
|
+
},
|
|
2216
|
+
/**
|
|
2217
|
+
* `str` 안의 `&<>"'` 문자를 escape 처리한다.
|
|
2218
|
+
* @param str 변경할 String
|
|
2219
|
+
*/
|
|
2220
|
+
escapeHtml(str) {
|
|
2221
|
+
return str ? str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'") : "";
|
|
2222
|
+
},
|
|
2223
|
+
/**
|
|
2224
|
+
* String 을 개행 문자('\r', '\n') 기준으로 나눈다.
|
|
2225
|
+
* @param str
|
|
2226
|
+
* @return 개행문자로 나누어진 string 의 array
|
|
2227
|
+
*/
|
|
2228
|
+
splitNewLine(str) {
|
|
2229
|
+
return str ? str.split(/\r\n|\r|\n/g) : [];
|
|
2230
|
+
},
|
|
2231
|
+
/**
|
|
2232
|
+
* ISO8601 형식의 string 을 주어진 format 으로 변환한다.
|
|
2233
|
+
* @param utcDate
|
|
2234
|
+
* @param format
|
|
2235
|
+
* @param displayTimeZone
|
|
2236
|
+
*/
|
|
2237
|
+
formatDateString(utcDate, format, displayTimeZone) {
|
|
2238
|
+
if (utcDate) {
|
|
2239
|
+
let date = dayjs(utcDate);
|
|
2240
|
+
if (displayTimeZone)
|
|
2241
|
+
date = date.tz(displayTimeZone);
|
|
2242
|
+
return date.format(format || "YYYY-MM-DD HH:mm Z");
|
|
2243
|
+
}
|
|
2244
|
+
return "";
|
|
2245
|
+
},
|
|
2246
|
+
/**
|
|
2247
|
+
* 숫자에 구분점을 넣는다. 소수점 이하가 있는 경우도 처리한다.
|
|
2248
|
+
* * 12345 -> '12,345'
|
|
2249
|
+
* * 12345.12345 -> '12,345.12345'
|
|
2250
|
+
* * 0 -> '0'
|
|
2251
|
+
* * undefined -> null
|
|
2252
|
+
* * null -> null
|
|
2253
|
+
*
|
|
2254
|
+
* @param value
|
|
2255
|
+
* @return
|
|
2256
|
+
*/
|
|
2257
|
+
formatNumber(value) {
|
|
2258
|
+
if (value || typeof value === "number") {
|
|
2259
|
+
const regexp = /\B(?=(\d{3})+(?!\d))/g;
|
|
2260
|
+
const splitValue = value.toString().split(".");
|
|
2261
|
+
const integerPart = splitValue[0].replace(regexp, ",");
|
|
2262
|
+
const decimalPart = splitValue[1] ? `.${splitValue[1]}` : "";
|
|
2263
|
+
return integerPart + decimalPart;
|
|
2264
|
+
}
|
|
2265
|
+
return null;
|
|
2266
|
+
},
|
|
2267
|
+
formatNumberByCode(value, locale) {
|
|
2268
|
+
if (typeof value === "undefined") {
|
|
2269
|
+
return null;
|
|
2270
|
+
}
|
|
2271
|
+
if (value || typeof value === "number") {
|
|
2272
|
+
return value.toLocaleString(locale);
|
|
2273
|
+
}
|
|
2274
|
+
return null;
|
|
2275
|
+
},
|
|
2276
|
+
/**
|
|
2277
|
+
* 통화단위와 표시위치를 받아 출력한다
|
|
2278
|
+
* @param value 값
|
|
2279
|
+
* @param currencyUnit 통화단위
|
|
2280
|
+
* @param prefix true 이면 withUnit을 앞에 붙이고, false 이면 뒤에 붙인다.
|
|
2281
|
+
*/
|
|
2282
|
+
formatPrice(value, currencyUnit, prefix = false) {
|
|
2283
|
+
if (value || typeof value === "number") {
|
|
2284
|
+
const formattedValue = this.formatNumber(value);
|
|
2285
|
+
return prefix ? `${currencyUnit} ${formattedValue}` : `${formattedValue} ${currencyUnit}`;
|
|
2286
|
+
}
|
|
2287
|
+
return null;
|
|
2288
|
+
},
|
|
2289
|
+
/**
|
|
2290
|
+
* rate 를 받아 percent 를 출력한다.
|
|
2291
|
+
* * 0.1 -> 10%
|
|
2292
|
+
* * 0.55 -> 55%
|
|
2293
|
+
* * 0.551 -> 55.1%
|
|
2294
|
+
* @param value 비율 값
|
|
2295
|
+
* @param withUnit true 이면 % 를 붙이고, false 이면 붙이지 않는다.
|
|
2296
|
+
* @param decimalPlace 소숫점 n번째에서 반올림한다.
|
|
2297
|
+
*/
|
|
2298
|
+
formatPercent(value, withUnit = true, decimalPlace = 2) {
|
|
2299
|
+
return value !== void 0 && value !== null && !isNaN(Number(value)) ? `${round(Number(value) * 100, decimalPlace)}${withUnit ? "%" : ""}` : null;
|
|
2300
|
+
},
|
|
2301
|
+
/**
|
|
2302
|
+
* 신용카드번호를 4자리 단위로 나누어 구분자를 넣는다.
|
|
2303
|
+
* @param value
|
|
2304
|
+
* @param separator 구분자
|
|
2305
|
+
*/
|
|
2306
|
+
formatCreditCardNo(value, separator = "-") {
|
|
2307
|
+
return value.match(/.{1,4}/g)?.join(separator);
|
|
2308
|
+
},
|
|
2309
|
+
/**
|
|
2310
|
+
* `HTML`태그가 포함된 문자열에서 text 만 남긴다.
|
|
2311
|
+
* @param textIncludedHTMLElement HTML 태그를 포함하는 문자열
|
|
2312
|
+
* @return HTML 태그가 제거된 문자열
|
|
2313
|
+
*/
|
|
2314
|
+
toPlainText(textIncludedHTMLElement) {
|
|
2315
|
+
const tmp = document.createElement("DIV");
|
|
2316
|
+
tmp.innerHTML = textIncludedHTMLElement || "";
|
|
2317
|
+
return tmp.textContent || tmp.innerText;
|
|
2318
|
+
}
|
|
2319
|
+
};
|
|
2320
|
+
const _hoisted_1$e = {
|
|
2321
|
+
key: 0,
|
|
2322
|
+
class: "view-mode"
|
|
2323
|
+
};
|
|
2324
|
+
const _hoisted_2$d = ["textContent"];
|
|
2325
|
+
const _hoisted_3$a = {
|
|
2326
|
+
key: 1,
|
|
2327
|
+
class: "input-area"
|
|
2328
|
+
};
|
|
2329
|
+
const _hoisted_4$6 = ["id", "placeholder", "autocomplete", "disabled", "maxlength", "name", "tabindex", "value"];
|
|
2330
|
+
const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
|
|
2331
|
+
__name: "BSNumberInput",
|
|
2332
|
+
props: {
|
|
2333
|
+
id: {},
|
|
2334
|
+
placeholder: {},
|
|
2335
|
+
name: {},
|
|
2336
|
+
modelValue: {},
|
|
2337
|
+
maxlength: {},
|
|
2338
|
+
disabled: { type: Boolean },
|
|
2339
|
+
viewMode: { type: Boolean },
|
|
2340
|
+
width: { default: "200px" },
|
|
2341
|
+
autocomplete: {},
|
|
2342
|
+
tabindex: { default: 0 },
|
|
2343
|
+
prefix: {},
|
|
2344
|
+
suffix: {},
|
|
2345
|
+
format: { type: Boolean, default: true },
|
|
2346
|
+
formatInViewMode: { type: Boolean, default: true },
|
|
2347
|
+
formatOnBlur: { type: Boolean, default: true },
|
|
2348
|
+
required: { type: Boolean },
|
|
2349
|
+
minValue: {},
|
|
2350
|
+
maxValue: {},
|
|
2351
|
+
validationMessageRequired: {},
|
|
2352
|
+
validationMessageMinValue: {},
|
|
2353
|
+
validationMessageMaxValue: {},
|
|
2354
|
+
validationMessageBetweenValue: {},
|
|
2355
|
+
extraValidationRules: {},
|
|
2356
|
+
ignoreSavePoint: { type: Boolean },
|
|
2357
|
+
hideErrorMessage: { type: Boolean },
|
|
2358
|
+
showErrorMessageOnDisabled: { type: Boolean }
|
|
2359
|
+
},
|
|
2360
|
+
emits: ["update:modelValue"],
|
|
2361
|
+
setup(__props, { emit: __emit }) {
|
|
2362
|
+
const props = __props;
|
|
2363
|
+
const emit = __emit;
|
|
2364
|
+
const normalizeNumber = (value) => {
|
|
2365
|
+
return value.replace(/[^\d-\\.,]/g, "");
|
|
2366
|
+
};
|
|
2367
|
+
vue.watch(
|
|
2368
|
+
() => props.modelValue,
|
|
2369
|
+
() => {
|
|
2370
|
+
stringValue.value = convertFromValue(props.modelValue);
|
|
2371
|
+
validateValue(props.modelValue, "change");
|
|
2372
|
+
}
|
|
2373
|
+
);
|
|
2374
|
+
const field = vue.ref();
|
|
2375
|
+
const focused = vue.ref(false);
|
|
2376
|
+
const formattedStringValue = vue.computed(
|
|
2377
|
+
() => props.format ? formatUtil.formatNumber(stringValue.value) || "" : stringValue.value || ""
|
|
2378
|
+
);
|
|
2379
|
+
const fieldContext = useFieldContext();
|
|
2380
|
+
const isValid = async (value, phase) => {
|
|
2381
|
+
const errors2 = [];
|
|
2382
|
+
executeRequiredValidation(
|
|
2383
|
+
value,
|
|
2384
|
+
props.required,
|
|
2385
|
+
props.validationMessageRequired,
|
|
2386
|
+
errors2
|
|
2387
|
+
) || value !== void 0 && executeBetweenValueValidation(
|
|
2388
|
+
value,
|
|
2389
|
+
props.minValue,
|
|
2390
|
+
props.validationMessageMinValue,
|
|
2391
|
+
props.maxValue,
|
|
2392
|
+
props.validationMessageMaxValue,
|
|
2393
|
+
props.validationMessageBetweenValue,
|
|
2394
|
+
errors2
|
|
2395
|
+
) || await executeFieldValidationRule(
|
|
2396
|
+
value,
|
|
2397
|
+
props.extraValidationRules,
|
|
2398
|
+
errors2,
|
|
2399
|
+
phase,
|
|
2400
|
+
fieldContext
|
|
2401
|
+
);
|
|
2402
|
+
return errors2;
|
|
2403
|
+
};
|
|
2404
|
+
const convertToValue = (stringValue2) => {
|
|
2405
|
+
if (!stringValue2) return void 0;
|
|
2406
|
+
const value = Number(stringValue2);
|
|
2407
|
+
return isNaN(value) ? void 0 : value;
|
|
2408
|
+
};
|
|
2409
|
+
const convertFromValue = (value) => {
|
|
2410
|
+
return value !== void 0 ? String(value) : "";
|
|
2411
|
+
};
|
|
2412
|
+
const validationDisabled = vue.computed(() => props.viewMode || props.disabled);
|
|
2413
|
+
const {
|
|
2414
|
+
stringValue,
|
|
2415
|
+
errors,
|
|
2416
|
+
handleInput,
|
|
2417
|
+
handleFocus,
|
|
2418
|
+
handleBlur,
|
|
2419
|
+
validateValue
|
|
2420
|
+
} = fieldValidator({
|
|
2421
|
+
field,
|
|
2422
|
+
disabled: validationDisabled,
|
|
2423
|
+
initialValue: props.modelValue,
|
|
2424
|
+
isValid,
|
|
2425
|
+
convertToValue,
|
|
2426
|
+
convertFromValue
|
|
2427
|
+
});
|
|
2428
|
+
const handlers = {
|
|
2429
|
+
input: async (event) => {
|
|
2430
|
+
stringValue.value = normalizeNumber(
|
|
2431
|
+
event.target.value
|
|
2432
|
+
);
|
|
2433
|
+
await handleInput(event);
|
|
2434
|
+
},
|
|
2435
|
+
focus: (event) => {
|
|
2436
|
+
focused.value = true;
|
|
2437
|
+
handleFocus(event);
|
|
2438
|
+
},
|
|
2439
|
+
blur: (event) => {
|
|
2440
|
+
focused.value = false;
|
|
2441
|
+
handleBlur(event);
|
|
2442
|
+
},
|
|
2443
|
+
change: () => {
|
|
2444
|
+
emit("update:modelValue", convertToValue(stringValue.value));
|
|
2445
|
+
}
|
|
2446
|
+
};
|
|
2447
|
+
const savePoint = props.ignoreSavePoint ? void 0 : useSavePoint();
|
|
2448
|
+
const savePointHandler = savePoint?.registerField({
|
|
2449
|
+
field,
|
|
2450
|
+
getCurrentValue: () => props.modelValue,
|
|
2451
|
+
setCurrentValue: (value) => emit("update:modelValue", value)
|
|
2452
|
+
});
|
|
2453
|
+
const modified = vue.computed(
|
|
2454
|
+
() => !!savePointHandler?.isModified(props.modelValue)
|
|
2455
|
+
);
|
|
2456
|
+
vue.onBeforeUnmount(() => savePoint?.unregisterField(field));
|
|
2457
|
+
return (_ctx, _cache) => {
|
|
2458
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
2459
|
+
class: vue.normalizeClass([{ required: __props.required, disabled: __props.disabled, modified: modified.value, error: vue.unref(errors).length > 0 }, "bs-number-input bs-input-wrap"]),
|
|
2460
|
+
style: vue.normalizeStyle({ width: __props.width })
|
|
2461
|
+
}, [
|
|
2462
|
+
__props.viewMode ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [
|
|
2463
|
+
vue.createVNode(_sfc_main$h, {
|
|
2464
|
+
value: __props.prefix,
|
|
2465
|
+
type: "prefix"
|
|
2466
|
+
}, null, 8, ["value"]),
|
|
2467
|
+
vue.createElementVNode("span", {
|
|
2468
|
+
textContent: vue.toDisplayString(__props.formatInViewMode ? formattedStringValue.value : vue.unref(stringValue))
|
|
2469
|
+
}, null, 8, _hoisted_2$d),
|
|
2470
|
+
vue.createVNode(_sfc_main$h, {
|
|
2471
|
+
value: __props.suffix,
|
|
2472
|
+
type: "suffix"
|
|
2473
|
+
}, null, 8, ["value"])
|
|
2474
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$a, [
|
|
2475
|
+
vue.createVNode(_sfc_main$h, {
|
|
2476
|
+
value: __props.prefix,
|
|
2477
|
+
type: "prefix"
|
|
2478
|
+
}, null, 8, ["value"]),
|
|
2479
|
+
vue.createElementVNode("input", vue.mergeProps({
|
|
2480
|
+
id: __props.id,
|
|
2481
|
+
ref_key: "field",
|
|
2482
|
+
ref: field,
|
|
2483
|
+
placeholder: __props.placeholder,
|
|
2484
|
+
autocomplete: __props.autocomplete,
|
|
2485
|
+
disabled: __props.disabled,
|
|
2486
|
+
maxlength: __props.maxlength,
|
|
2487
|
+
name: __props.name,
|
|
2488
|
+
tabindex: __props.tabindex,
|
|
2489
|
+
value: focused.value || !__props.formatOnBlur ? vue.unref(stringValue) : formattedStringValue.value,
|
|
2490
|
+
type: "text"
|
|
2491
|
+
}, vue.toHandlers(handlers, true)), null, 16, _hoisted_4$6),
|
|
2492
|
+
vue.createVNode(_sfc_main$h, {
|
|
2493
|
+
value: __props.suffix,
|
|
2494
|
+
type: "suffix"
|
|
2495
|
+
}, null, 8, ["value"])
|
|
2496
|
+
])),
|
|
2497
|
+
!__props.viewMode ? (vue.openBlock(), vue.createBlock(_sfc_main$l, {
|
|
2498
|
+
key: 2,
|
|
2499
|
+
errors: vue.unref(errors),
|
|
2500
|
+
"hide-error-message": __props.hideErrorMessage || __props.disabled && !__props.showErrorMessageOnDisabled
|
|
2501
|
+
}, null, 8, ["errors", "hide-error-message"])) : vue.createCommentVNode("", true)
|
|
2502
|
+
], 6);
|
|
2503
|
+
};
|
|
2504
|
+
}
|
|
2505
|
+
});
|
|
2506
|
+
const _hoisted_1$d = {
|
|
2507
|
+
key: 0,
|
|
2508
|
+
class: "view-mode flex flex-row gap-2 items-start"
|
|
2509
|
+
};
|
|
2510
|
+
const _hoisted_2$c = ["textContent"];
|
|
2511
|
+
const _hoisted_3$9 = {
|
|
2512
|
+
key: 1,
|
|
2513
|
+
class: "input-area flex flex-row items-start"
|
|
2514
|
+
};
|
|
2515
|
+
const _hoisted_4$5 = ["placeholder", "disabled", "maxlength", "name", "tabindex"];
|
|
2516
|
+
const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
|
|
2517
|
+
__name: "BSTextArea",
|
|
2518
|
+
props: {
|
|
2519
|
+
id: {},
|
|
2520
|
+
placeholder: {},
|
|
2521
|
+
name: {},
|
|
2522
|
+
modelValue: {},
|
|
2523
|
+
maxlength: {},
|
|
2524
|
+
disabled: { type: Boolean },
|
|
2525
|
+
viewMode: { type: Boolean },
|
|
2526
|
+
width: { default: "400px" },
|
|
2527
|
+
height: {},
|
|
2528
|
+
autocomplete: {},
|
|
2529
|
+
tabindex: { default: 0 },
|
|
2530
|
+
trimValue: { type: Boolean, default: true },
|
|
2531
|
+
prefix: {},
|
|
2532
|
+
suffix: {},
|
|
2533
|
+
required: { type: Boolean },
|
|
2534
|
+
minLength: {},
|
|
2535
|
+
maxLength: {},
|
|
2536
|
+
validationMessageRequired: {},
|
|
2537
|
+
validationMessageMinLength: {},
|
|
2538
|
+
validationMessageMaxLength: {},
|
|
2539
|
+
validationMessageBetweenLength: {},
|
|
2540
|
+
extraValidationRules: {},
|
|
2541
|
+
ignoreSavePoint: { type: Boolean },
|
|
2542
|
+
hideErrorMessage: { type: Boolean },
|
|
2543
|
+
showErrorMessageOnDisabled: { type: Boolean }
|
|
2544
|
+
},
|
|
2545
|
+
emits: ["update:modelValue"],
|
|
2546
|
+
setup(__props, { emit: __emit }) {
|
|
2547
|
+
const props = __props;
|
|
2548
|
+
const emit = __emit;
|
|
2549
|
+
const convertToValue = (stringValue2) => {
|
|
2550
|
+
return String(componentUtil.trimStringValue(stringValue2, props.trimValue) || "");
|
|
2551
|
+
};
|
|
2552
|
+
const convertFromValue = (value) => {
|
|
2553
|
+
return componentUtil.trimStringValue(value, props.trimValue) ?? "";
|
|
2554
|
+
};
|
|
2555
|
+
vue.watch(
|
|
2556
|
+
() => props.modelValue,
|
|
2557
|
+
() => {
|
|
2558
|
+
stringValue.value = convertFromValue(props.modelValue);
|
|
2559
|
+
validateValue(props.modelValue || "", "change");
|
|
2560
|
+
}
|
|
2561
|
+
);
|
|
2562
|
+
const field = vue.ref();
|
|
2563
|
+
const fieldContext = useFieldContext();
|
|
2564
|
+
const isValid = async (value, phase) => {
|
|
2565
|
+
const errors2 = [];
|
|
2566
|
+
const text = value?.trim() ?? "";
|
|
2567
|
+
executeRequiredValidation(text, props.required, props.validationMessageRequired, errors2) || executeBetweenLengthValidation(
|
|
2568
|
+
text,
|
|
2569
|
+
props.minLength,
|
|
2570
|
+
props.validationMessageMinLength,
|
|
2571
|
+
props.maxLength,
|
|
2572
|
+
props.validationMessageMaxLength,
|
|
2573
|
+
props.validationMessageBetweenLength,
|
|
2574
|
+
errors2
|
|
2575
|
+
) || await executeFieldValidationRule(text, props.extraValidationRules, errors2, phase, fieldContext);
|
|
2576
|
+
return errors2;
|
|
2577
|
+
};
|
|
2578
|
+
const validationDisabled = vue.computed(() => props.viewMode || props.disabled);
|
|
2579
|
+
const {
|
|
2580
|
+
stringValue,
|
|
2581
|
+
errors,
|
|
2582
|
+
handleInput,
|
|
2583
|
+
handleFocus,
|
|
2584
|
+
handleBlur,
|
|
2585
|
+
validateValue
|
|
2586
|
+
} = fieldValidator({
|
|
2587
|
+
field,
|
|
2588
|
+
disabled: validationDisabled,
|
|
2589
|
+
initialValue: props.modelValue,
|
|
2590
|
+
isValid,
|
|
2591
|
+
convertToValue,
|
|
2592
|
+
convertFromValue
|
|
2593
|
+
});
|
|
2594
|
+
const handlers = {
|
|
2595
|
+
input: handleInput,
|
|
2596
|
+
focus: handleFocus,
|
|
2597
|
+
blur: handleBlur,
|
|
2598
|
+
change: () => {
|
|
2599
|
+
emit("update:modelValue", convertToValue(stringValue.value));
|
|
2600
|
+
}
|
|
2601
|
+
};
|
|
2602
|
+
const outerWidth = vue.computed(() => componentUtil.isRelativeSize(props.width) ? props.width : void 0);
|
|
2603
|
+
const outerHeight = vue.computed(() => componentUtil.isRelativeSize(props.height) ? props.height : void 0);
|
|
2604
|
+
const innerWidth = vue.computed(() => componentUtil.isRelativeSize(props.width) ? "100%" : props.width);
|
|
2605
|
+
const innerHeight = vue.computed(() => resizedHeight.value || (componentUtil.isRelativeSize(props.height) ? "100%" : props.height));
|
|
2606
|
+
const savePoint = props.ignoreSavePoint ? void 0 : useSavePoint();
|
|
2607
|
+
const savePointHandler = savePoint?.registerField({
|
|
2608
|
+
field,
|
|
2609
|
+
getCurrentValue: () => props.modelValue || "",
|
|
2610
|
+
setCurrentValue: (value) => emit("update:modelValue", value || "")
|
|
2611
|
+
});
|
|
2612
|
+
const modified = vue.computed(() => !!savePointHandler?.isModified(props.modelValue || ""));
|
|
2613
|
+
vue.onBeforeUnmount(() => savePoint?.unregisterField(field));
|
|
2614
|
+
const resizedHeight = vue.ref();
|
|
2615
|
+
const capturePointer = (event) => {
|
|
2616
|
+
if (field.value) {
|
|
2617
|
+
field.value.setPointerCapture(event.pointerId);
|
|
2618
|
+
}
|
|
2619
|
+
};
|
|
2620
|
+
const preserveResizedHeight = (event) => {
|
|
2621
|
+
if (field.value) {
|
|
2622
|
+
resizedHeight.value = `${field.value.offsetHeight}px`;
|
|
2623
|
+
field.value.releasePointerCapture(event.pointerId);
|
|
2624
|
+
}
|
|
2625
|
+
};
|
|
2626
|
+
return (_ctx, _cache) => {
|
|
2627
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
2628
|
+
class: vue.normalizeClass([{ disabled: __props.disabled, modified: modified.value, error: vue.unref(errors).length > 0 }, "bs-text-area bs-input-wrap"]),
|
|
2629
|
+
style: vue.normalizeStyle({ width: outerWidth.value, height: outerHeight.value })
|
|
2630
|
+
}, [
|
|
2631
|
+
__props.viewMode ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$d, [
|
|
2632
|
+
vue.createVNode(_sfc_main$h, {
|
|
2633
|
+
value: __props.prefix,
|
|
2634
|
+
type: "prefix"
|
|
2635
|
+
}, null, 8, ["value"]),
|
|
2636
|
+
vue.createElementVNode("div", {
|
|
2637
|
+
textContent: vue.toDisplayString(vue.unref(stringValue))
|
|
2638
|
+
}, null, 8, _hoisted_2$c),
|
|
2639
|
+
vue.createVNode(_sfc_main$h, {
|
|
2640
|
+
value: __props.suffix,
|
|
2641
|
+
type: "suffix"
|
|
2642
|
+
}, null, 8, ["value"])
|
|
2643
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$9, [
|
|
2644
|
+
vue.createVNode(_sfc_main$h, {
|
|
2645
|
+
value: __props.prefix,
|
|
2646
|
+
type: "prefix"
|
|
2647
|
+
}, null, 8, ["value"]),
|
|
2648
|
+
vue.withDirectives(vue.createElementVNode("textarea", vue.mergeProps({
|
|
2649
|
+
ref_key: "field",
|
|
2650
|
+
ref: field,
|
|
2651
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(stringValue) ? stringValue.value = $event : null),
|
|
2652
|
+
placeholder: __props.placeholder,
|
|
2653
|
+
disabled: __props.disabled,
|
|
2654
|
+
maxlength: __props.maxlength,
|
|
2655
|
+
name: __props.name,
|
|
2656
|
+
style: { width: innerWidth.value, height: innerHeight.value },
|
|
2657
|
+
tabindex: __props.tabindex,
|
|
2658
|
+
class: "grow",
|
|
2659
|
+
onPointerdown: capturePointer,
|
|
2660
|
+
onPointerup: preserveResizedHeight
|
|
2661
|
+
}, vue.toHandlers(handlers, true)), null, 16, _hoisted_4$5), [
|
|
2662
|
+
[vue.vModelText, vue.unref(stringValue)]
|
|
2663
|
+
]),
|
|
2664
|
+
vue.createVNode(_sfc_main$h, {
|
|
2665
|
+
value: __props.suffix,
|
|
2666
|
+
type: "suffix"
|
|
2667
|
+
}, null, 8, ["value"])
|
|
2668
|
+
])),
|
|
2669
|
+
!__props.viewMode ? (vue.openBlock(), vue.createBlock(_sfc_main$l, {
|
|
2670
|
+
key: 2,
|
|
2671
|
+
errors: vue.unref(errors),
|
|
2672
|
+
"hide-error-message": __props.hideErrorMessage || __props.disabled && !__props.showErrorMessageOnDisabled
|
|
2673
|
+
}, null, 8, ["errors", "hide-error-message"])) : vue.createCommentVNode("", true)
|
|
2674
|
+
], 6);
|
|
2675
|
+
};
|
|
2676
|
+
}
|
|
2677
|
+
});
|
|
2678
|
+
const _hoisted_1$c = ["id", "checked", "disabled", "name", "tabindex"];
|
|
2679
|
+
const _hoisted_2$b = ["textContent", "for"];
|
|
2680
|
+
const _hoisted_3$8 = ["for"];
|
|
2681
|
+
const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
2682
|
+
__name: "BSCheckbox",
|
|
2683
|
+
props: {
|
|
2684
|
+
id: { default: () => componentUtil.generateNextId("checkbox") },
|
|
2685
|
+
name: {},
|
|
2686
|
+
label: {},
|
|
2687
|
+
modelValue: { type: Boolean },
|
|
2688
|
+
disabled: { type: Boolean },
|
|
2689
|
+
viewMode: { type: Boolean },
|
|
2690
|
+
tabindex: { default: 0 },
|
|
2691
|
+
disableSavePoint: { type: Boolean },
|
|
2692
|
+
ignoreSavePoint: { type: Boolean }
|
|
2693
|
+
},
|
|
2694
|
+
emits: ["update:modelValue"],
|
|
2695
|
+
setup(__props, { emit: __emit }) {
|
|
2696
|
+
const props = __props;
|
|
2697
|
+
const emit = __emit;
|
|
2698
|
+
const checked = vue.ref(props.modelValue);
|
|
2699
|
+
const slots = vue.useSlots();
|
|
2700
|
+
const hasLabelSlot = vue.computed(() => !!slots?.default);
|
|
2701
|
+
const handlers = {
|
|
2702
|
+
change: (event) => {
|
|
2703
|
+
checked.value = event.target.checked;
|
|
2704
|
+
if (props.modelValue !== checked.value)
|
|
2705
|
+
emit("update:modelValue", checked.value);
|
|
2706
|
+
}
|
|
2707
|
+
};
|
|
2708
|
+
vue.watch(
|
|
2709
|
+
() => props.modelValue,
|
|
2710
|
+
() => checked.value = props.modelValue
|
|
2711
|
+
);
|
|
2712
|
+
const field = vue.ref();
|
|
2713
|
+
const savePoint = props.ignoreSavePoint ? void 0 : useSavePoint();
|
|
2714
|
+
const savePointHandler = savePoint?.registerField({
|
|
2715
|
+
field,
|
|
2716
|
+
getCurrentValue: () => props.modelValue || false,
|
|
2717
|
+
setCurrentValue: (value) => {
|
|
2718
|
+
if (!props.disableSavePoint) emit("update:modelValue", value || false);
|
|
2719
|
+
}
|
|
2720
|
+
});
|
|
2721
|
+
const modified = vue.computed(() => !!savePointHandler?.isModified(props.modelValue));
|
|
2722
|
+
vue.onBeforeUnmount(() => savePoint?.unregisterField(field));
|
|
2723
|
+
return (_ctx, _cache) => {
|
|
2724
|
+
return vue.openBlock(), vue.createElementBlock("span", {
|
|
2725
|
+
class: vue.normalizeClass([{ checked: checked.value, disabled: __props.disabled, modified: modified.value }, "bs-checkbox"])
|
|
2726
|
+
}, [
|
|
2727
|
+
vue.createElementVNode("input", vue.mergeProps({
|
|
2728
|
+
id: __props.id,
|
|
2729
|
+
ref_key: "field",
|
|
2730
|
+
ref: field,
|
|
2731
|
+
checked: checked.value,
|
|
2732
|
+
disabled: __props.disabled || __props.viewMode,
|
|
2733
|
+
name: __props.name,
|
|
2734
|
+
tabindex: __props.tabindex,
|
|
2735
|
+
class: "",
|
|
2736
|
+
type: "checkbox"
|
|
2737
|
+
}, vue.toHandlers(handlers, true)), null, 16, _hoisted_1$c),
|
|
2738
|
+
__props.label ? (vue.openBlock(), vue.createElementBlock("label", {
|
|
2739
|
+
key: 0,
|
|
2740
|
+
textContent: vue.toDisplayString(__props.label),
|
|
2741
|
+
for: __props.id,
|
|
2742
|
+
class: "text-label"
|
|
2743
|
+
}, null, 8, _hoisted_2$b)) : vue.createCommentVNode("", true),
|
|
2744
|
+
hasLabelSlot.value ? (vue.openBlock(), vue.createElementBlock("label", {
|
|
2745
|
+
key: 1,
|
|
2746
|
+
for: __props.id,
|
|
2747
|
+
class: "slot-label cursor-pointer"
|
|
2748
|
+
}, [
|
|
2749
|
+
vue.renderSlot(_ctx.$slots, "default", { disabled: __props.disabled })
|
|
2750
|
+
], 8, _hoisted_3$8)) : vue.createCommentVNode("", true)
|
|
2751
|
+
], 2);
|
|
2752
|
+
};
|
|
2753
|
+
}
|
|
2754
|
+
});
|
|
2755
|
+
const _hoisted_1$b = ["data-field-name"];
|
|
2756
|
+
const _hoisted_2$a = { class: "items" };
|
|
2757
|
+
const _hoisted_3$7 = ["textContent"];
|
|
2758
|
+
const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
|
|
2759
|
+
__name: "BSCheckboxGroup",
|
|
2760
|
+
props: {
|
|
2761
|
+
name: {},
|
|
2762
|
+
modelValue: { default: () => [] },
|
|
2763
|
+
items: { default: () => [] },
|
|
2764
|
+
valueProvider: {},
|
|
2765
|
+
labelProvider: {},
|
|
2766
|
+
keyProvider: {},
|
|
2767
|
+
enabledItemProvider: {},
|
|
2768
|
+
tabindex: { default: 0 },
|
|
2769
|
+
disabled: { type: Boolean },
|
|
2770
|
+
viewMode: { type: Boolean },
|
|
2771
|
+
required: { type: Boolean },
|
|
2772
|
+
validationMessageRequired: {},
|
|
2773
|
+
extraValidationRules: {},
|
|
2774
|
+
ignoreSavePoint: { type: Boolean },
|
|
2775
|
+
hideErrorMessage: { type: Boolean },
|
|
2776
|
+
showErrorMessageOnDisabled: { type: Boolean }
|
|
2777
|
+
},
|
|
2778
|
+
emits: ["update:modelValue"],
|
|
2779
|
+
setup(__props, { emit: __emit }) {
|
|
2780
|
+
const props = __props;
|
|
2781
|
+
const emit = __emit;
|
|
2782
|
+
const itemLabel = (item) => {
|
|
2783
|
+
return props.labelProvider ? props.labelProvider(item) : String(item);
|
|
2784
|
+
};
|
|
2785
|
+
const itemValue = (item) => {
|
|
2786
|
+
return props.valueProvider ? props.valueProvider(item) : item;
|
|
2787
|
+
};
|
|
2788
|
+
const itemKey = (item) => {
|
|
2789
|
+
return executeKeyProviderOrDefault(item, props.keyProvider, () => String(itemValue(item)));
|
|
2790
|
+
};
|
|
2791
|
+
const isDisabledItem = (item) => props.enabledItemProvider ? !props.enabledItemProvider(item) : false;
|
|
2792
|
+
const itemCheckMap = vue.ref({});
|
|
2793
|
+
const refreshItemCheckMap = (map, values, shouldValidate) => {
|
|
2794
|
+
props.items.forEach((item) => map[itemKey(item)] = values.includes(itemValue(item)));
|
|
2795
|
+
if (shouldValidate) {
|
|
2796
|
+
validateValue(props.modelValue, "change");
|
|
2797
|
+
}
|
|
2798
|
+
};
|
|
2799
|
+
const toggleItemValue = (checked, item) => {
|
|
2800
|
+
const value = itemValue(item);
|
|
2801
|
+
const contains = props.modelValue.includes(value);
|
|
2802
|
+
if (checked && !contains) {
|
|
2803
|
+
const newValue = [...props.modelValue, value];
|
|
2804
|
+
const sorted = props.items.map((item2) => itemValue(item2)).filter((item2) => newValue.includes(item2));
|
|
2805
|
+
emit("update:modelValue", sorted);
|
|
2806
|
+
} else if (!checked && contains) {
|
|
2807
|
+
const index = props.modelValue.indexOf(value);
|
|
2808
|
+
const newValue = props.modelValue.toSpliced(index, 1);
|
|
2809
|
+
emit("update:modelValue", newValue);
|
|
2810
|
+
}
|
|
2811
|
+
};
|
|
2812
|
+
const modelValueLabels = vue.computed(() => {
|
|
2813
|
+
return props.items.filter((item) => props.modelValue.includes(itemValue(item))).map(itemLabel).join(", ");
|
|
2814
|
+
});
|
|
2815
|
+
const field = vue.ref();
|
|
2816
|
+
const fieldContext = useFieldContext();
|
|
2817
|
+
const isValid = async (value, phase) => {
|
|
2818
|
+
const errors2 = [];
|
|
2819
|
+
if (props.required && (value === void 0 || value.length === 0)) {
|
|
2820
|
+
errors2.push({ code: "required", message: props.validationMessageRequired || "Required" });
|
|
2821
|
+
} else if (value !== void 0) {
|
|
2822
|
+
await executeFieldValidationRule(value, props.extraValidationRules, errors2, phase, fieldContext);
|
|
2823
|
+
}
|
|
2824
|
+
return errors2;
|
|
2825
|
+
};
|
|
2826
|
+
const validationDisabled = vue.computed(() => props.viewMode || props.disabled);
|
|
2827
|
+
const { errors, validateValue } = fieldValidator({
|
|
2828
|
+
field,
|
|
2829
|
+
disabled: validationDisabled,
|
|
2830
|
+
initialValue: props.modelValue,
|
|
2831
|
+
isValid
|
|
2832
|
+
});
|
|
2833
|
+
const resetItemCheckMap = (shouldValidate) => {
|
|
2834
|
+
const map = {};
|
|
2835
|
+
props.items.forEach((item) => map[itemKey(item)] = false);
|
|
2836
|
+
refreshItemCheckMap(map, props.modelValue, shouldValidate);
|
|
2837
|
+
itemCheckMap.value = map;
|
|
2838
|
+
};
|
|
2839
|
+
vue.watch(() => props.items, () => resetItemCheckMap(false));
|
|
2840
|
+
vue.watch(
|
|
2841
|
+
() => props.modelValue,
|
|
2842
|
+
(values) => refreshItemCheckMap(itemCheckMap.value, values, true)
|
|
2843
|
+
);
|
|
2844
|
+
vue.onMounted(() => {
|
|
2845
|
+
resetItemCheckMap(false);
|
|
2846
|
+
});
|
|
2847
|
+
const savePoint = props.ignoreSavePoint ? void 0 : useSavePoint();
|
|
2848
|
+
const savePointHandler = savePoint?.registerField({
|
|
2849
|
+
field,
|
|
2850
|
+
getCurrentValue: () => [...props.modelValue],
|
|
2851
|
+
setCurrentValue: (value) => emit("update:modelValue", [...value || []]),
|
|
2852
|
+
compare: (savedValue, currentValue) => savedValue?.toSorted().join(",") === currentValue?.toSorted().join(",")
|
|
2853
|
+
});
|
|
2854
|
+
const modified = vue.computed(() => !!savePointHandler?.isModified(props.modelValue || []));
|
|
2855
|
+
vue.onBeforeUnmount(() => savePoint?.unregisterField(field));
|
|
2856
|
+
return (_ctx, _cache) => {
|
|
2857
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
2858
|
+
ref_key: "field",
|
|
2859
|
+
ref: field,
|
|
2860
|
+
class: vue.normalizeClass([{ required: __props.required, disabled: __props.disabled, modified: modified.value, error: vue.unref(errors).length > 0 }, "bs-checkbox-group flex flex-col"]),
|
|
2861
|
+
"data-field-name": __props.name,
|
|
2862
|
+
role: "group"
|
|
2863
|
+
}, [
|
|
2864
|
+
vue.createElementVNode("div", _hoisted_2$a, [
|
|
2865
|
+
__props.viewMode ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
2866
|
+
key: 0,
|
|
2867
|
+
class: "view-mode",
|
|
2868
|
+
textContent: vue.toDisplayString(modelValueLabels.value)
|
|
2869
|
+
}, null, 8, _hoisted_3$7)) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(__props.items, (item) => {
|
|
2870
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$d, {
|
|
2871
|
+
key: itemKey(item),
|
|
2872
|
+
disabled: __props.disabled || isDisabledItem(item),
|
|
2873
|
+
label: itemLabel(item),
|
|
2874
|
+
"model-value": itemCheckMap.value[itemKey(item)],
|
|
2875
|
+
name: `${__props.name || ""}_${itemKey(item)}`,
|
|
2876
|
+
tabindex: __props.tabindex,
|
|
2877
|
+
"disable-save-point": "",
|
|
2878
|
+
"onUpdate:modelValue": ($event) => toggleItemValue($event, item)
|
|
2879
|
+
}, null, 8, ["disabled", "label", "model-value", "name", "tabindex", "onUpdate:modelValue"]);
|
|
2880
|
+
}), 128))
|
|
2881
|
+
]),
|
|
2882
|
+
!__props.viewMode ? (vue.openBlock(), vue.createBlock(_sfc_main$l, {
|
|
2883
|
+
key: 0,
|
|
2884
|
+
errors: vue.unref(errors),
|
|
2885
|
+
"hide-error-message": __props.hideErrorMessage || __props.disabled && !__props.showErrorMessageOnDisabled
|
|
2886
|
+
}, null, 8, ["errors", "hide-error-message"])) : vue.createCommentVNode("", true)
|
|
2887
|
+
], 10, _hoisted_1$b);
|
|
2888
|
+
};
|
|
2889
|
+
}
|
|
2890
|
+
});
|
|
2891
|
+
const _hoisted_1$a = ["id", "checked", "disabled", "name", "tabindex"];
|
|
2892
|
+
const _hoisted_2$9 = ["for"];
|
|
2893
|
+
const _hoisted_3$6 = {
|
|
2894
|
+
key: 0,
|
|
2895
|
+
class: "font-icon"
|
|
2896
|
+
};
|
|
2897
|
+
const _hoisted_4$4 = ["textContent"];
|
|
2898
|
+
const _hoisted_5$2 = ["for"];
|
|
2899
|
+
const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
|
|
2900
|
+
__name: "BSRadioButton",
|
|
2901
|
+
props: {
|
|
2902
|
+
id: { default: () => componentUtil.generateNextId("radio") },
|
|
2903
|
+
name: { default: () => componentUtil.generateNextName("radio") },
|
|
2904
|
+
label: {},
|
|
2905
|
+
icon: {},
|
|
2906
|
+
modelValue: {},
|
|
2907
|
+
itemValue: {},
|
|
2908
|
+
disabled: { type: Boolean },
|
|
2909
|
+
viewMode: { type: Boolean },
|
|
2910
|
+
tabindex: { default: 0 }
|
|
2911
|
+
},
|
|
2912
|
+
emits: ["update:modelValue"],
|
|
2913
|
+
setup(__props, { emit: __emit }) {
|
|
2914
|
+
const props = __props;
|
|
2915
|
+
const emit = __emit;
|
|
2916
|
+
const checked = vue.computed(() => props.itemValue !== void 0 && props.itemValue === props.modelValue || false);
|
|
2917
|
+
const slots = vue.useSlots();
|
|
2918
|
+
const hasLabelSlot = vue.computed(() => !!slots?.default);
|
|
2919
|
+
const handleClick = (event) => {
|
|
2920
|
+
const curChecked = event.target.checked;
|
|
2921
|
+
if (curChecked) {
|
|
2922
|
+
emit("update:modelValue", props.itemValue);
|
|
2923
|
+
}
|
|
2924
|
+
};
|
|
2925
|
+
const handlers = {
|
|
2926
|
+
change: handleClick
|
|
2927
|
+
// click: handleClick
|
|
2928
|
+
};
|
|
2929
|
+
return (_ctx, _cache) => {
|
|
2930
|
+
return vue.openBlock(), vue.createElementBlock("span", {
|
|
2931
|
+
class: vue.normalizeClass([{ checked: checked.value, disabled: __props.disabled }, "bs-radio-button"])
|
|
2932
|
+
}, [
|
|
2933
|
+
vue.createElementVNode("input", vue.mergeProps({
|
|
2934
|
+
id: __props.id,
|
|
2935
|
+
checked: checked.value,
|
|
2936
|
+
disabled: __props.disabled || __props.viewMode,
|
|
2937
|
+
name: __props.name,
|
|
2938
|
+
tabindex: __props.tabindex,
|
|
2939
|
+
class: "",
|
|
2940
|
+
role: "radio",
|
|
2941
|
+
type: "radio"
|
|
2942
|
+
}, vue.toHandlers(handlers, true)), null, 16, _hoisted_1$a),
|
|
2943
|
+
vue.createElementVNode("label", { for: __props.id }, [
|
|
2944
|
+
__props.icon ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$6, vue.toDisplayString(__props.icon), 1)) : vue.createCommentVNode("", true),
|
|
2945
|
+
__props.label ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
2946
|
+
key: 1,
|
|
2947
|
+
textContent: vue.toDisplayString(__props.label),
|
|
2948
|
+
class: "text-label"
|
|
2949
|
+
}, null, 8, _hoisted_4$4)) : vue.createCommentVNode("", true)
|
|
2950
|
+
], 8, _hoisted_2$9),
|
|
2951
|
+
hasLabelSlot.value ? (vue.openBlock(), vue.createElementBlock("label", {
|
|
2952
|
+
key: 0,
|
|
2953
|
+
for: __props.id,
|
|
2954
|
+
class: "slot-label cursor-pointer"
|
|
2955
|
+
}, [
|
|
2956
|
+
vue.renderSlot(_ctx.$slots, "default", { disabled: __props.disabled })
|
|
2957
|
+
], 8, _hoisted_5$2)) : vue.createCommentVNode("", true)
|
|
2958
|
+
], 2);
|
|
2959
|
+
};
|
|
2960
|
+
}
|
|
2961
|
+
});
|
|
2962
|
+
const _hoisted_1$9 = ["data-field-name"];
|
|
2963
|
+
const _hoisted_2$8 = ["textContent"];
|
|
2964
|
+
const _hoisted_3$5 = {
|
|
2965
|
+
key: 1,
|
|
2966
|
+
class: "radio-button-group",
|
|
2967
|
+
role: "radiogroup"
|
|
2968
|
+
};
|
|
2969
|
+
const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
|
|
2970
|
+
__name: "BSRadioButtonGroup",
|
|
2971
|
+
props: {
|
|
2972
|
+
name: { default: () => componentUtil.generateNextName("radioGroup") },
|
|
2973
|
+
modelValue: {},
|
|
2974
|
+
items: { default: () => [] },
|
|
2975
|
+
valueProvider: {},
|
|
2976
|
+
labelProvider: {},
|
|
2977
|
+
iconProvider: {},
|
|
2978
|
+
keyProvider: {},
|
|
2979
|
+
enabledItemProvider: {},
|
|
2980
|
+
tooltipProvider: {},
|
|
2981
|
+
tabindex: { default: 0 },
|
|
2982
|
+
disabled: { type: Boolean },
|
|
2983
|
+
viewMode: { type: Boolean },
|
|
2984
|
+
required: { type: Boolean },
|
|
2985
|
+
validationMessageRequired: {},
|
|
2986
|
+
extraValidationRules: {},
|
|
2987
|
+
ignoreSavePoint: { type: Boolean },
|
|
2988
|
+
hideErrorMessage: { type: Boolean },
|
|
2989
|
+
showErrorMessageOnDisabled: { type: Boolean }
|
|
2990
|
+
},
|
|
2991
|
+
emits: ["update:modelValue"],
|
|
2992
|
+
setup(__props, { emit: __emit }) {
|
|
2993
|
+
const props = __props;
|
|
2994
|
+
const emit = __emit;
|
|
2995
|
+
const itemLabel = (item) => {
|
|
2996
|
+
return executeLabelProviderOrDefault(item, props.labelProvider, () => String(item));
|
|
2997
|
+
};
|
|
2998
|
+
const itemValue = (item) => {
|
|
2999
|
+
return props.valueProvider ? props.valueProvider(item) : item;
|
|
3000
|
+
};
|
|
3001
|
+
const itemKey = (item) => {
|
|
3002
|
+
return executeKeyProviderOrDefault(item, props.keyProvider, () => String(itemValue(item)));
|
|
3003
|
+
};
|
|
3004
|
+
const isDisabledItem = (item) => props.enabledItemProvider ? !props.enabledItemProvider(item) : false;
|
|
3005
|
+
const modelValueLabel = vue.computed(() => {
|
|
3006
|
+
const selected = props.items.find((item) => itemValue(item) === props.modelValue);
|
|
3007
|
+
return selected ? itemLabel(selected) : "";
|
|
3008
|
+
});
|
|
3009
|
+
const emitValue = (value) => {
|
|
3010
|
+
emit("update:modelValue", value);
|
|
3011
|
+
};
|
|
3012
|
+
vue.watch(
|
|
3013
|
+
() => props.modelValue,
|
|
3014
|
+
() => validateValue(props.modelValue, "change")
|
|
3015
|
+
);
|
|
3016
|
+
const field = vue.ref();
|
|
3017
|
+
const fieldContext = useFieldContext();
|
|
3018
|
+
const isValid = async (value, phase) => {
|
|
3019
|
+
const errors2 = [];
|
|
3020
|
+
if (props.required && value === void 0) {
|
|
3021
|
+
errors2.push({ code: "required", message: props.validationMessageRequired || "Required" });
|
|
3022
|
+
} else if (value !== void 0) {
|
|
3023
|
+
await executeFieldValidationRule(value, props.extraValidationRules, errors2, phase, fieldContext);
|
|
3024
|
+
}
|
|
3025
|
+
return errors2;
|
|
3026
|
+
};
|
|
3027
|
+
const validationDisabled = vue.computed(() => props.viewMode || props.disabled);
|
|
3028
|
+
const { errors, validateValue } = fieldValidator({
|
|
3029
|
+
field,
|
|
3030
|
+
disabled: validationDisabled,
|
|
3031
|
+
initialValue: props.modelValue,
|
|
3032
|
+
isValid
|
|
3033
|
+
});
|
|
3034
|
+
const savePoint = props.ignoreSavePoint ? void 0 : useSavePoint();
|
|
3035
|
+
const savePointHandler = savePoint?.registerField({
|
|
3036
|
+
field,
|
|
3037
|
+
getCurrentValue: () => props.modelValue,
|
|
3038
|
+
setCurrentValue: (value) => emit("update:modelValue", value)
|
|
3039
|
+
});
|
|
3040
|
+
const modified = vue.computed(() => !!savePointHandler?.isModified(props.modelValue));
|
|
3041
|
+
vue.onBeforeUnmount(() => savePoint?.unregisterField(field));
|
|
3042
|
+
return (_ctx, _cache) => {
|
|
3043
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
3044
|
+
ref_key: "field",
|
|
3045
|
+
ref: field,
|
|
3046
|
+
class: vue.normalizeClass([{ required: __props.required, disabled: __props.disabled, modified: modified.value, error: vue.unref(errors).length > 0 }, "bs-radio-button-group"]),
|
|
3047
|
+
"data-field-name": __props.name
|
|
3048
|
+
}, [
|
|
3049
|
+
__props.viewMode ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
3050
|
+
key: 0,
|
|
3051
|
+
textContent: vue.toDisplayString(modelValueLabel.value)
|
|
3052
|
+
}, null, 8, _hoisted_2$8)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$5, [
|
|
3053
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.items, (item) => {
|
|
3054
|
+
return vue.withDirectives((vue.openBlock(), vue.createBlock(_sfc_main$b, {
|
|
3055
|
+
key: itemKey(item),
|
|
3056
|
+
disabled: __props.disabled || isDisabledItem(item),
|
|
3057
|
+
icon: __props.iconProvider?.(item),
|
|
3058
|
+
"item-value": itemValue(item),
|
|
3059
|
+
label: itemLabel(item),
|
|
3060
|
+
"model-value": __props.modelValue,
|
|
3061
|
+
name: __props.name,
|
|
3062
|
+
tabindex: __props.tabindex,
|
|
3063
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => emitValue($event))
|
|
3064
|
+
}, null, 8, ["disabled", "icon", "item-value", "label", "model-value", "name", "tabindex"])), [
|
|
3065
|
+
[vue.unref(vTooltip), { content: __props.tooltipProvider?.(item) }]
|
|
3066
|
+
]);
|
|
3067
|
+
}), 128))
|
|
3068
|
+
])),
|
|
3069
|
+
!__props.viewMode ? (vue.openBlock(), vue.createBlock(_sfc_main$l, {
|
|
3070
|
+
key: 2,
|
|
3071
|
+
errors: vue.unref(errors),
|
|
3072
|
+
"hide-error-message": __props.hideErrorMessage || __props.disabled && !__props.showErrorMessageOnDisabled
|
|
3073
|
+
}, null, 8, ["errors", "hide-error-message"])) : vue.createCommentVNode("", true)
|
|
3074
|
+
], 10, _hoisted_1$9);
|
|
3075
|
+
};
|
|
3076
|
+
}
|
|
3077
|
+
});
|
|
3078
|
+
const _hoisted_1$8 = ["tabindex", "onKeydown"];
|
|
3079
|
+
const _hoisted_2$7 = { key: 0 };
|
|
3080
|
+
const _hoisted_3$4 = ["textContent"];
|
|
3081
|
+
const _hoisted_4$3 = ["textContent"];
|
|
3082
|
+
const _hoisted_5$1 = ["data-field-name"];
|
|
3083
|
+
const _hoisted_6 = ["textContent"];
|
|
3084
|
+
const _hoisted_7 = {
|
|
3085
|
+
key: 1,
|
|
3086
|
+
class: "text-truncate"
|
|
3087
|
+
};
|
|
3088
|
+
const _hoisted_8 = ["textContent"];
|
|
3089
|
+
const _hoisted_9 = ["textContent"];
|
|
3090
|
+
const _hoisted_10 = {
|
|
3091
|
+
key: 2,
|
|
3092
|
+
class: "small-progress"
|
|
3093
|
+
};
|
|
3094
|
+
const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
3095
|
+
__name: "BSMultiSelect",
|
|
3096
|
+
props: {
|
|
3097
|
+
modelValue: { default: () => [] },
|
|
3098
|
+
items: { default: () => [] },
|
|
3099
|
+
name: {},
|
|
3100
|
+
valueProvider: { type: Function, default: (item) => item },
|
|
3101
|
+
labelProvider: { type: Function, default: defaultLabelProvider },
|
|
3102
|
+
selectedLabelProvider: {},
|
|
3103
|
+
keyProvider: {},
|
|
3104
|
+
placeholder: {},
|
|
3105
|
+
tabindex: { default: 0 },
|
|
3106
|
+
disabled: { type: Boolean },
|
|
3107
|
+
viewMode: { type: Boolean },
|
|
3108
|
+
required: { type: Boolean },
|
|
3109
|
+
validationMessageRequired: {},
|
|
3110
|
+
extraValidationRules: {},
|
|
3111
|
+
ignoreSavePoint: { type: Boolean },
|
|
3112
|
+
popupAlign: {},
|
|
3113
|
+
popupDirection: {},
|
|
3114
|
+
popupMaxHeight: {},
|
|
3115
|
+
showPopupSearch: { type: [Boolean, String], default: "auto" },
|
|
3116
|
+
hideErrorMessage: { type: Boolean },
|
|
3117
|
+
showErrorMessageOnDisabled: { type: Boolean }
|
|
3118
|
+
},
|
|
3119
|
+
emits: ["update:modelValue"],
|
|
3120
|
+
setup(__props, { emit: __emit }) {
|
|
3121
|
+
const props = __props;
|
|
3122
|
+
const emit = __emit;
|
|
3123
|
+
const allItems = vue.ref();
|
|
3124
|
+
const loadingItems = vue.ref(false);
|
|
3125
|
+
vue.watch(
|
|
3126
|
+
() => props.items,
|
|
3127
|
+
async () => {
|
|
3128
|
+
loadingItems.value = true;
|
|
3129
|
+
allItems.value = await props.items;
|
|
3130
|
+
loadingItems.value = false;
|
|
3131
|
+
},
|
|
3132
|
+
{ immediate: true }
|
|
3133
|
+
);
|
|
3134
|
+
const itemLabel = (item) => {
|
|
3135
|
+
return executeLabelProviderOrDefault(item, props.labelProvider, () => String(item));
|
|
3136
|
+
};
|
|
3137
|
+
const itemValue = (item) => {
|
|
3138
|
+
return props.valueProvider ? props.valueProvider(item) : item;
|
|
3139
|
+
};
|
|
3140
|
+
const itemKey = (item) => {
|
|
3141
|
+
return executeKeyProviderOrDefault(item, props.keyProvider, () => String(item));
|
|
3142
|
+
};
|
|
3143
|
+
const findItemFromValue = (value) => {
|
|
3144
|
+
return value ? allItems.value?.find((item) => itemValue(item) === value) : void 0;
|
|
3145
|
+
};
|
|
3146
|
+
const isEmpty = vue.computed(() => !props.modelValue || props.modelValue.length === 0);
|
|
3147
|
+
const selectedItems = vue.computed(() => props.modelValue.map(findItemFromValue).filter(notNull));
|
|
3148
|
+
const showPopup = vue.ref(false);
|
|
3149
|
+
const togglePopup = (show) => {
|
|
3150
|
+
if (!props.disabled && !props.viewMode) {
|
|
3151
|
+
showPopup.value = show === void 0 ? !showPopup.value : show;
|
|
3152
|
+
}
|
|
3153
|
+
};
|
|
3154
|
+
const selectPopup = vue.ref();
|
|
3155
|
+
const handleKeyboardEvent = (event) => {
|
|
3156
|
+
if (!showPopup.value) togglePopup(true);
|
|
3157
|
+
else if (selectPopup.value) selectPopup.value.handleKeyboard(event);
|
|
3158
|
+
};
|
|
3159
|
+
const itemSelected = (item) => {
|
|
3160
|
+
if (item && allItems.value) {
|
|
3161
|
+
let newItems = [...selectedItems.value];
|
|
3162
|
+
const index = newItems.indexOf(item);
|
|
3163
|
+
if (index >= 0) {
|
|
3164
|
+
newItems.splice(index, 1);
|
|
3165
|
+
} else {
|
|
3166
|
+
newItems = allItems.value.filter((it) => newItems.includes(it) || it === item);
|
|
3167
|
+
}
|
|
3168
|
+
const values = newItems.map(itemValue);
|
|
3169
|
+
emit("update:modelValue", values);
|
|
3170
|
+
}
|
|
3171
|
+
};
|
|
3172
|
+
const rootRef = vue.useTemplateRef("root");
|
|
3173
|
+
vue.watch(
|
|
3174
|
+
() => props.modelValue,
|
|
3175
|
+
() => validateValue(props.modelValue, "change")
|
|
3176
|
+
);
|
|
3177
|
+
const field = vue.ref();
|
|
3178
|
+
const fieldContext = useFieldContext();
|
|
3179
|
+
const isValid = async (value, phase) => {
|
|
3180
|
+
const errors2 = [];
|
|
3181
|
+
if (props.required && (value === void 0 || value.length === 0)) {
|
|
3182
|
+
errors2.push({ code: "required", message: props.validationMessageRequired || "Required" });
|
|
3183
|
+
} else if (value !== void 0) {
|
|
3184
|
+
await executeFieldValidationRule(value, props.extraValidationRules, errors2, phase, fieldContext);
|
|
3185
|
+
}
|
|
3186
|
+
return errors2;
|
|
3187
|
+
};
|
|
3188
|
+
const validationDisabled = vue.computed(() => props.viewMode || props.disabled);
|
|
3189
|
+
const { errors, validateValue } = fieldValidator({
|
|
3190
|
+
field,
|
|
3191
|
+
disabled: validationDisabled,
|
|
3192
|
+
initialValue: props.modelValue,
|
|
3193
|
+
isValid
|
|
3194
|
+
});
|
|
3195
|
+
const savePoint = props.ignoreSavePoint ? void 0 : useSavePoint();
|
|
3196
|
+
const savePointHandler = savePoint?.registerField({
|
|
3197
|
+
field,
|
|
3198
|
+
getCurrentValue: () => [...props.modelValue],
|
|
3199
|
+
setCurrentValue: (value) => emit("update:modelValue", [...value || []]),
|
|
3200
|
+
compare: (savedValue, currentValue) => savedValue?.toSorted().join(",") === currentValue?.toSorted().join(",")
|
|
3201
|
+
});
|
|
3202
|
+
const modified = vue.computed(() => !!savePointHandler?.isModified(props.modelValue || []));
|
|
3203
|
+
vue.onBeforeUnmount(() => savePoint?.unregisterField(field));
|
|
3204
|
+
return (_ctx, _cache) => {
|
|
3205
|
+
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
3206
|
+
ref: "root",
|
|
3207
|
+
class: vue.normalizeClass([{ "popup-open": showPopup.value, disabled: __props.disabled, modified: modified.value, error: vue.unref(errors).length > 0, empty: isEmpty.value, "view-mode": __props.viewMode }, "bs-multi-select"]),
|
|
3208
|
+
tabindex: __props.disabled ? -1 : __props.tabindex,
|
|
3209
|
+
onClick: _cache[1] || (_cache[1] = ($event) => togglePopup()),
|
|
3210
|
+
onKeydown: [
|
|
3211
|
+
_cache[2] || (_cache[2] = vue.withKeys(vue.withModifiers(($event) => togglePopup(), ["stop", "prevent"]), ["space"])),
|
|
3212
|
+
vue.withKeys(vue.withModifiers(handleKeyboardEvent, ["stop", "prevent"]), ["enter", "down", "up"]),
|
|
3213
|
+
_cache[3] || (_cache[3] = vue.withKeys(vue.withModifiers(($event) => togglePopup(false), ["stop", "prevent"]), ["esc"])),
|
|
3214
|
+
_cache[4] || (_cache[4] = vue.withKeys(($event) => togglePopup(false), ["tab"]))
|
|
3215
|
+
]
|
|
3216
|
+
}, [
|
|
3217
|
+
__props.viewMode ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$7, [
|
|
3218
|
+
__props.selectedLabelProvider ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
3219
|
+
key: 0,
|
|
3220
|
+
textContent: vue.toDisplayString(__props.selectedLabelProvider(selectedItems.value)),
|
|
3221
|
+
class: "label"
|
|
3222
|
+
}, null, 8, _hoisted_3$4)) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(selectedItems.value, (item) => {
|
|
3223
|
+
return vue.openBlock(), vue.createElementBlock("span", {
|
|
3224
|
+
key: itemKey(item),
|
|
3225
|
+
textContent: vue.toDisplayString(itemLabel(item)),
|
|
3226
|
+
class: "label"
|
|
3227
|
+
}, null, 8, _hoisted_4$3);
|
|
3228
|
+
}), 128))
|
|
3229
|
+
])) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
3230
|
+
vue.createElementVNode("div", {
|
|
3231
|
+
ref_key: "field",
|
|
3232
|
+
ref: field,
|
|
3233
|
+
"data-field-name": __props.name,
|
|
3234
|
+
class: "selected w-full",
|
|
3235
|
+
role: "listbox"
|
|
3236
|
+
}, [
|
|
3237
|
+
selectedItems.value.length === 0 ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
3238
|
+
key: 0,
|
|
3239
|
+
textContent: vue.toDisplayString(__props.placeholder),
|
|
3240
|
+
class: "placeholder grow"
|
|
3241
|
+
}, null, 8, _hoisted_6)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_7, [
|
|
3242
|
+
__props.selectedLabelProvider ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
3243
|
+
key: 0,
|
|
3244
|
+
textContent: vue.toDisplayString(__props.selectedLabelProvider(selectedItems.value)),
|
|
3245
|
+
class: "label"
|
|
3246
|
+
}, null, 8, _hoisted_8)) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(selectedItems.value, (item) => {
|
|
3247
|
+
return vue.openBlock(), vue.createElementBlock("span", {
|
|
3248
|
+
key: itemKey(item),
|
|
3249
|
+
textContent: vue.toDisplayString(itemLabel(item)),
|
|
3250
|
+
class: "label"
|
|
3251
|
+
}, null, 8, _hoisted_9);
|
|
3252
|
+
}), 128))
|
|
3253
|
+
])),
|
|
3254
|
+
_cache[5] || (_cache[5] = vue.createElementVNode("span", { class: "dropdown-btn" }, "expand_more", -1)),
|
|
3255
|
+
loadingItems.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_10, "progress_activity")) : vue.createCommentVNode("", true)
|
|
3256
|
+
], 8, _hoisted_5$1),
|
|
3257
|
+
!__props.disabled && showPopup.value ? (vue.openBlock(), vue.createBlock(_sfc_main$m, {
|
|
3258
|
+
key: 0,
|
|
3259
|
+
ref_key: "selectPopup",
|
|
3260
|
+
ref: selectPopup,
|
|
3261
|
+
"base-element": rootRef.value,
|
|
3262
|
+
"initial-item": selectedItems.value[0],
|
|
3263
|
+
items: __props.items,
|
|
3264
|
+
"label-provider": __props.labelProvider,
|
|
3265
|
+
"max-height": __props.popupMaxHeight,
|
|
3266
|
+
"popup-align": __props.popupAlign,
|
|
3267
|
+
"popup-direction": __props.popupDirection,
|
|
3268
|
+
"selected-items": selectedItems.value,
|
|
3269
|
+
"show-search": __props.showPopupSearch,
|
|
3270
|
+
"value-provider": __props.valueProvider,
|
|
3271
|
+
onItemSelected: itemSelected,
|
|
3272
|
+
onRequestClose: _cache[0] || (_cache[0] = ($event) => togglePopup(false))
|
|
3273
|
+
}, null, 8, ["base-element", "initial-item", "items", "label-provider", "max-height", "popup-align", "popup-direction", "selected-items", "show-search", "value-provider"])) : vue.createCommentVNode("", true)
|
|
3274
|
+
], 64)),
|
|
3275
|
+
!__props.viewMode ? (vue.openBlock(), vue.createBlock(_sfc_main$l, {
|
|
3276
|
+
key: 2,
|
|
3277
|
+
errors: vue.unref(errors),
|
|
3278
|
+
"hide-error-message": __props.hideErrorMessage || __props.disabled && !__props.showErrorMessageOnDisabled
|
|
3279
|
+
}, null, 8, ["errors", "hide-error-message"])) : vue.createCommentVNode("", true)
|
|
3280
|
+
], 42, _hoisted_1$8)), [
|
|
3281
|
+
[vue.unref(vClickOutside), () => togglePopup(false)]
|
|
3282
|
+
]);
|
|
3283
|
+
};
|
|
3284
|
+
}
|
|
3285
|
+
});
|
|
3286
|
+
dayjs.extend(utc);
|
|
3287
|
+
dayjs.extend(timezone);
|
|
3288
|
+
const dateInputFormatByResolution = (resolution) => {
|
|
3289
|
+
if (resolution === "DAY")
|
|
3290
|
+
return "YYYYMMDD";
|
|
3291
|
+
else if (resolution === "HOUR")
|
|
3292
|
+
return "YYYYMMDDHH";
|
|
3293
|
+
else if (resolution === "SECOND")
|
|
3294
|
+
return "YYYYMMDDHHmmss";
|
|
3295
|
+
else
|
|
3296
|
+
return "YYYYMMDDHHmm";
|
|
3297
|
+
};
|
|
3298
|
+
const convertInputToDateString = (str, inputFormat, endTime, resolution, inputTimeZone, minDateValue, maxDateValue) => {
|
|
3299
|
+
if (str) {
|
|
3300
|
+
try {
|
|
3301
|
+
if (str.length < inputFormat.length) {
|
|
3302
|
+
if (endTime) {
|
|
3303
|
+
str += (dayjs().year() + "12312359").substring(str.length, inputFormat.length);
|
|
3304
|
+
} else {
|
|
3305
|
+
str += (dayjs().year() + "01010000").substring(str.length, inputFormat.length);
|
|
3306
|
+
}
|
|
3307
|
+
}
|
|
3308
|
+
let value = dayjs.tz(str, inputFormat, inputTimeZone);
|
|
3309
|
+
if (endTime)
|
|
3310
|
+
value = value.endOf(resolution.toLowerCase());
|
|
3311
|
+
const minValue = minDateValue;
|
|
3312
|
+
if (minValue) {
|
|
3313
|
+
let minDate = dayjs(minValue).tz(inputTimeZone);
|
|
3314
|
+
if (value.isBefore(minDate))
|
|
3315
|
+
value = minDate;
|
|
3316
|
+
}
|
|
3317
|
+
const maxValue = maxDateValue;
|
|
3318
|
+
if (maxValue) {
|
|
3319
|
+
let maxDate = dayjs(maxValue).tz(inputTimeZone);
|
|
3320
|
+
if (maxDate.isBefore(value))
|
|
3321
|
+
value = maxDate;
|
|
3322
|
+
}
|
|
3323
|
+
if (resolution === "MINUTE_10" || resolution === "MINUTE_30") {
|
|
3324
|
+
const truncateUnit = resolution === "MINUTE_10" ? 10 : 30;
|
|
3325
|
+
if (endTime) {
|
|
3326
|
+
const truncated = Math.ceil(value.minute() / truncateUnit) * truncateUnit;
|
|
3327
|
+
value = value.minute(truncated).second(0).millisecond(0).add(-1, "millisecond");
|
|
3328
|
+
} else {
|
|
3329
|
+
const truncated = Math.floor(value.minute() / truncateUnit) * truncateUnit;
|
|
3330
|
+
value = value.minute(truncated).second(0).millisecond(0);
|
|
3331
|
+
}
|
|
3332
|
+
}
|
|
3333
|
+
return value.toISOString();
|
|
3334
|
+
} catch (err) {
|
|
3335
|
+
}
|
|
3336
|
+
}
|
|
3337
|
+
return "";
|
|
3338
|
+
};
|
|
3339
|
+
const convertDateToInputString = (date, inputFormat, inputTimeZone) => {
|
|
3340
|
+
return dayjs(date).tz(inputTimeZone).format(inputFormat);
|
|
3341
|
+
};
|
|
3342
|
+
const checkDateMinMaxValue = (value, inputFormat, endTime, resolution, inputTimeZone, minDateValue, maxDateValue) => {
|
|
3343
|
+
if (value) {
|
|
3344
|
+
const input = convertDateToInputString(value, inputFormat, inputTimeZone);
|
|
3345
|
+
return convertInputToDateString(input, inputFormat, endTime, resolution, inputTimeZone, minDateValue, maxDateValue);
|
|
3346
|
+
}
|
|
3347
|
+
};
|
|
3348
|
+
const normalizeDateInput = (value) => {
|
|
3349
|
+
return value.replace(/[^\d-]/g, "");
|
|
3350
|
+
};
|
|
3351
|
+
const _hoisted_1$7 = { class: "bs-date-input-popup" };
|
|
3352
|
+
const _hoisted_2$6 = { class: "buttons" };
|
|
3353
|
+
const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
|
|
3354
|
+
__name: "BSDateInputPopup",
|
|
3355
|
+
props: {
|
|
3356
|
+
modelValue: {},
|
|
3357
|
+
resolution: {},
|
|
3358
|
+
displayFormat: {},
|
|
3359
|
+
timeZone: {},
|
|
3360
|
+
baseElement: {},
|
|
3361
|
+
popupAlign: {},
|
|
3362
|
+
popupDirection: {},
|
|
3363
|
+
selectStartYear: {},
|
|
3364
|
+
selectEndYear: {},
|
|
3365
|
+
okButtonCaption: { default: "OK" },
|
|
3366
|
+
cancelButtonCaption: { default: "Cancel" }
|
|
3367
|
+
},
|
|
3368
|
+
emits: ["update:modelValue", "close"],
|
|
3369
|
+
setup(__props, { emit: __emit }) {
|
|
3370
|
+
const props = __props;
|
|
3371
|
+
const emit = __emit;
|
|
3372
|
+
const date = vue.ref(props.modelValue);
|
|
3373
|
+
const emitValue = () => {
|
|
3374
|
+
emit("update:modelValue", date.value);
|
|
3375
|
+
close();
|
|
3376
|
+
};
|
|
3377
|
+
const close = () => {
|
|
3378
|
+
emit("close");
|
|
3379
|
+
};
|
|
3380
|
+
return (_ctx, _cache) => {
|
|
3381
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$o, {
|
|
3382
|
+
"base-element": __props.baseElement,
|
|
3383
|
+
"popup-align": __props.popupAlign,
|
|
3384
|
+
"offset-from-base-element": 4,
|
|
3385
|
+
"popup-direction": __props.popupDirection,
|
|
3386
|
+
"max-height": "auto",
|
|
3387
|
+
onRequestClose: close,
|
|
3388
|
+
onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
|
|
3389
|
+
}, ["stop"]))
|
|
3390
|
+
}, {
|
|
3391
|
+
default: vue.withCtx(() => [
|
|
3392
|
+
vue.createElementVNode("div", _hoisted_1$7, [
|
|
3393
|
+
vue.createVNode(_sfc_main$j, {
|
|
3394
|
+
modelValue: date.value,
|
|
3395
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => date.value = $event),
|
|
3396
|
+
"display-format": __props.displayFormat,
|
|
3397
|
+
"end-year": __props.selectEndYear,
|
|
3398
|
+
resolution: __props.resolution,
|
|
3399
|
+
"start-year": __props.selectStartYear,
|
|
3400
|
+
"time-zone": __props.timeZone
|
|
3401
|
+
}, null, 8, ["modelValue", "display-format", "end-year", "resolution", "start-year", "time-zone"]),
|
|
3402
|
+
vue.createElementVNode("div", _hoisted_2$6, [
|
|
3403
|
+
vue.createVNode(_sfc_main$r, {
|
|
3404
|
+
caption: __props.okButtonCaption,
|
|
3405
|
+
"button-color": "blue",
|
|
3406
|
+
class: "min-w-80",
|
|
3407
|
+
onClick: emitValue
|
|
3408
|
+
}, null, 8, ["caption"]),
|
|
3409
|
+
vue.createVNode(_sfc_main$r, {
|
|
3410
|
+
caption: __props.cancelButtonCaption,
|
|
3411
|
+
class: "min-w-80",
|
|
3412
|
+
onClick: close
|
|
3413
|
+
}, null, 8, ["caption"])
|
|
3414
|
+
])
|
|
3415
|
+
])
|
|
3416
|
+
]),
|
|
3417
|
+
_: 1
|
|
3418
|
+
}, 8, ["base-element", "popup-align", "popup-direction"]);
|
|
3419
|
+
};
|
|
3420
|
+
}
|
|
3421
|
+
});
|
|
3422
|
+
const _hoisted_1$6 = {
|
|
3423
|
+
key: 0,
|
|
3424
|
+
class: "view-mode"
|
|
3425
|
+
};
|
|
3426
|
+
const _hoisted_2$5 = {
|
|
3427
|
+
key: 1,
|
|
3428
|
+
class: "input-area"
|
|
3429
|
+
};
|
|
3430
|
+
const _hoisted_3$3 = ["id", "placeholder", "disabled", "maxlength", "name", "tabindex", "value"];
|
|
3431
|
+
const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
3432
|
+
__name: "BSDateInput",
|
|
3433
|
+
props: {
|
|
3434
|
+
id: {},
|
|
3435
|
+
placeholder: {},
|
|
3436
|
+
name: {},
|
|
3437
|
+
modelValue: {},
|
|
3438
|
+
disabled: { type: Boolean },
|
|
3439
|
+
viewMode: { type: Boolean },
|
|
3440
|
+
required: { type: Boolean },
|
|
3441
|
+
width: { default: "200px" },
|
|
3442
|
+
resolution: { default: "MINUTE_10" },
|
|
3443
|
+
endTime: { type: Boolean },
|
|
3444
|
+
displayFormat: {},
|
|
3445
|
+
timeZone: {},
|
|
3446
|
+
hidePopupExtraDate: { type: Boolean },
|
|
3447
|
+
tabindex: { default: 0 },
|
|
3448
|
+
validationMessageRequired: {},
|
|
3449
|
+
extraValidationRules: {},
|
|
3450
|
+
ignoreSavePoint: { type: Boolean },
|
|
3451
|
+
popupAlign: {},
|
|
3452
|
+
popupDirection: {},
|
|
3453
|
+
popupStartYear: {},
|
|
3454
|
+
popupEndYear: {},
|
|
3455
|
+
hideErrorMessage: { type: Boolean },
|
|
3456
|
+
showErrorMessageOnDisabled: { type: Boolean },
|
|
3457
|
+
minDateValue: {},
|
|
3458
|
+
maxDateValue: {}
|
|
3459
|
+
},
|
|
3460
|
+
emits: ["update:modelValue"],
|
|
3461
|
+
setup(__props, { emit: __emit }) {
|
|
3462
|
+
const props = __props;
|
|
3463
|
+
const emit = __emit;
|
|
3464
|
+
const blueseaConfig = useBlueseaConfig();
|
|
3465
|
+
const actualTimeZone = vue.computed(() => props.timeZone || blueseaConfig.timeZone);
|
|
3466
|
+
const actualDisplayFormat = vue.computed(() => props.displayFormat || blueseaConfig.dateFormat);
|
|
3467
|
+
const actualMinDateValue = vue.computed(
|
|
3468
|
+
() => props.minDateValue || blueseaConfig.minDateValue
|
|
3469
|
+
);
|
|
3470
|
+
const actualMaxDateValue = vue.computed(
|
|
3471
|
+
() => props.maxDateValue || blueseaConfig.maxDateValue
|
|
3472
|
+
);
|
|
3473
|
+
const inputFormat = vue.computed(
|
|
3474
|
+
() => dateInputFormatByResolution(props.resolution)
|
|
3475
|
+
);
|
|
3476
|
+
vue.watch(
|
|
3477
|
+
() => [props.modelValue, actualTimeZone.value],
|
|
3478
|
+
() => {
|
|
3479
|
+
stringValue.value = formatUtil.formatDateString(
|
|
3480
|
+
props.modelValue,
|
|
3481
|
+
inputFormat.value,
|
|
3482
|
+
actualTimeZone.value
|
|
3483
|
+
);
|
|
3484
|
+
validateValue(props.modelValue || "", "change");
|
|
3485
|
+
}
|
|
3486
|
+
);
|
|
3487
|
+
const focused = vue.ref(false);
|
|
3488
|
+
const formattedValue = vue.computed(
|
|
3489
|
+
() => formattedTimeZoneValue(actualTimeZone.value)
|
|
3490
|
+
);
|
|
3491
|
+
const formattedTimeZoneValue = (displayTimeZone) => {
|
|
3492
|
+
const date = convertInputToDateString(
|
|
3493
|
+
stringValue.value,
|
|
3494
|
+
inputFormat.value,
|
|
3495
|
+
props.endTime,
|
|
3496
|
+
props.resolution,
|
|
3497
|
+
actualTimeZone.value,
|
|
3498
|
+
actualMinDateValue.value,
|
|
3499
|
+
actualMaxDateValue.value
|
|
3500
|
+
);
|
|
3501
|
+
return formatUtil.formatDateString(date, actualDisplayFormat.value, displayTimeZone);
|
|
3502
|
+
};
|
|
3503
|
+
const viewModeValue = vue.computed(
|
|
3504
|
+
() => viewModeTimeZoneValue(actualTimeZone.value)
|
|
3505
|
+
);
|
|
3506
|
+
const viewModeTimeZoneValue = (displayTimeZone) => {
|
|
3507
|
+
const stringDate = formatUtil.formatDateString(
|
|
3508
|
+
props.modelValue,
|
|
3509
|
+
dateInputFormatByResolution("SECOND"),
|
|
3510
|
+
actualTimeZone.value
|
|
3511
|
+
);
|
|
3512
|
+
const date = convertInputToDateString(
|
|
3513
|
+
stringDate,
|
|
3514
|
+
"SECOND",
|
|
3515
|
+
props.endTime,
|
|
3516
|
+
"SECOND",
|
|
3517
|
+
actualTimeZone.value,
|
|
3518
|
+
actualMinDateValue.value,
|
|
3519
|
+
actualMaxDateValue.value
|
|
3520
|
+
);
|
|
3521
|
+
return formatUtil.formatDateString(date, actualDisplayFormat.value, displayTimeZone);
|
|
3522
|
+
};
|
|
3523
|
+
const maxlength = vue.computed(() => inputFormat.value.length);
|
|
3524
|
+
const rootRef = vue.useTemplateRef("root");
|
|
3525
|
+
const field = vue.ref();
|
|
3526
|
+
const fieldContext = useFieldContext();
|
|
3527
|
+
const isValid = async (value, phase) => {
|
|
3528
|
+
const errors2 = [];
|
|
3529
|
+
const text = value?.trim() ?? "";
|
|
3530
|
+
executeRequiredValidation(
|
|
3531
|
+
text,
|
|
3532
|
+
props.required,
|
|
3533
|
+
props.validationMessageRequired,
|
|
3534
|
+
errors2
|
|
3535
|
+
) || await executeFieldValidationRule(
|
|
3536
|
+
text,
|
|
3537
|
+
props.extraValidationRules,
|
|
3538
|
+
errors2,
|
|
3539
|
+
phase,
|
|
3540
|
+
fieldContext
|
|
3541
|
+
);
|
|
3542
|
+
return errors2;
|
|
3543
|
+
};
|
|
3544
|
+
const validationDisabled = vue.computed(() => props.viewMode || props.disabled);
|
|
3545
|
+
const {
|
|
3546
|
+
stringValue,
|
|
3547
|
+
errors,
|
|
3548
|
+
handleInput,
|
|
3549
|
+
handleFocus,
|
|
3550
|
+
handleBlur,
|
|
3551
|
+
validateValue
|
|
3552
|
+
} = fieldValidator({
|
|
3553
|
+
field,
|
|
3554
|
+
disabled: validationDisabled,
|
|
3555
|
+
initialValue: props.modelValue,
|
|
3556
|
+
isValid,
|
|
3557
|
+
convertToValue: (input) => convertInputToDateString(
|
|
3558
|
+
input,
|
|
3559
|
+
inputFormat.value,
|
|
3560
|
+
props.endTime,
|
|
3561
|
+
props.resolution,
|
|
3562
|
+
actualTimeZone.value,
|
|
3563
|
+
actualMinDateValue.value,
|
|
3564
|
+
actualMaxDateValue.value
|
|
3565
|
+
),
|
|
3566
|
+
convertFromValue: (date) => formatUtil.formatDateString(date, inputFormat.value, actualTimeZone.value)
|
|
3567
|
+
});
|
|
3568
|
+
const handlers = {
|
|
3569
|
+
input: async (event) => {
|
|
3570
|
+
stringValue.value = normalizeDateInput(
|
|
3571
|
+
event.target.value
|
|
3572
|
+
);
|
|
3573
|
+
await handleInput(event);
|
|
3574
|
+
},
|
|
3575
|
+
focus: (event) => {
|
|
3576
|
+
focused.value = true;
|
|
3577
|
+
handleFocus(event);
|
|
3578
|
+
},
|
|
3579
|
+
blur: (event) => {
|
|
3580
|
+
focused.value = false;
|
|
3581
|
+
handleBlur(event);
|
|
3582
|
+
},
|
|
3583
|
+
change: () => {
|
|
3584
|
+
const date = convertInputToDateString(
|
|
3585
|
+
stringValue.value,
|
|
3586
|
+
inputFormat.value,
|
|
3587
|
+
props.endTime,
|
|
3588
|
+
props.resolution,
|
|
3589
|
+
actualTimeZone.value,
|
|
3590
|
+
actualMinDateValue.value,
|
|
3591
|
+
actualMaxDateValue.value
|
|
3592
|
+
);
|
|
3593
|
+
emit("update:modelValue", date);
|
|
3594
|
+
stringValue.value = convertDateToInputString(
|
|
3595
|
+
date,
|
|
3596
|
+
inputFormat.value,
|
|
3597
|
+
actualTimeZone.value
|
|
3598
|
+
);
|
|
3599
|
+
}
|
|
3600
|
+
};
|
|
3601
|
+
const savePoint = props.ignoreSavePoint ? void 0 : useSavePoint();
|
|
3602
|
+
const savePointHandler = savePoint?.registerField({
|
|
3603
|
+
field,
|
|
3604
|
+
getCurrentValue: () => props.modelValue || "",
|
|
3605
|
+
setCurrentValue: (value) => emit("update:modelValue", value || "")
|
|
3606
|
+
});
|
|
3607
|
+
const modified = vue.computed(
|
|
3608
|
+
() => !!savePointHandler?.isModified(props.modelValue || "")
|
|
3609
|
+
);
|
|
3610
|
+
vue.onBeforeUnmount(() => savePoint?.unregisterField(field));
|
|
3611
|
+
const showPopup = vue.ref(false);
|
|
3612
|
+
const togglePopup = (show) => {
|
|
3613
|
+
if (!props.disabled && !props.viewMode) {
|
|
3614
|
+
showPopup.value = show === void 0 ? !showPopup.value : show;
|
|
3615
|
+
}
|
|
3616
|
+
};
|
|
3617
|
+
const setValueFromPopup = async (value) => {
|
|
3618
|
+
const checkedValue = checkDateMinMaxValue(
|
|
3619
|
+
value,
|
|
3620
|
+
inputFormat.value,
|
|
3621
|
+
props.endTime,
|
|
3622
|
+
props.resolution,
|
|
3623
|
+
actualTimeZone.value,
|
|
3624
|
+
actualMinDateValue.value,
|
|
3625
|
+
actualMaxDateValue.value
|
|
3626
|
+
);
|
|
3627
|
+
emit("update:modelValue", checkedValue);
|
|
3628
|
+
await vue.nextTick();
|
|
3629
|
+
await validateValue(value || "", "change");
|
|
3630
|
+
};
|
|
3631
|
+
return (_ctx, _cache) => {
|
|
3632
|
+
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
3633
|
+
ref: "root",
|
|
3634
|
+
class: vue.normalizeClass([{ required: __props.required, disabled: __props.disabled, modified: modified.value, error: vue.unref(errors).length > 0 }, "bs-date-input bs-input-wrap position-relative"]),
|
|
3635
|
+
style: vue.normalizeStyle({ width: __props.width }),
|
|
3636
|
+
onKeydown: _cache[2] || (_cache[2] = vue.withKeys(vue.withModifiers(() => togglePopup(false), ["stop", "prevent"]), ["esc"]))
|
|
3637
|
+
}, [
|
|
3638
|
+
__props.viewMode ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$6, [
|
|
3639
|
+
vue.createElementVNode("span", null, vue.toDisplayString(viewModeValue.value), 1)
|
|
3640
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$5, [
|
|
3641
|
+
vue.createElementVNode("span", {
|
|
3642
|
+
class: vue.normalizeClass([{ "bs-clickable": !__props.disabled }, "font-icon"]),
|
|
3643
|
+
onClick: _cache[0] || (_cache[0] = ($event) => togglePopup())
|
|
3644
|
+
}, " calendar_month ", 2),
|
|
3645
|
+
vue.createElementVNode("input", vue.mergeProps({
|
|
3646
|
+
id: __props.id,
|
|
3647
|
+
ref_key: "field",
|
|
3648
|
+
ref: field,
|
|
3649
|
+
placeholder: __props.placeholder,
|
|
3650
|
+
disabled: __props.disabled,
|
|
3651
|
+
maxlength: maxlength.value,
|
|
3652
|
+
name: __props.name,
|
|
3653
|
+
tabindex: __props.tabindex,
|
|
3654
|
+
value: focused.value ? vue.unref(stringValue) : formattedValue.value,
|
|
3655
|
+
type: "text"
|
|
3656
|
+
}, vue.toHandlers(handlers, true)), null, 16, _hoisted_3$3)
|
|
3657
|
+
])),
|
|
3658
|
+
!__props.viewMode ? (vue.openBlock(), vue.createBlock(_sfc_main$l, {
|
|
3659
|
+
key: 2,
|
|
3660
|
+
errors: vue.unref(errors),
|
|
3661
|
+
"hide-error-message": __props.hideErrorMessage || __props.disabled && !__props.showErrorMessageOnDisabled
|
|
3662
|
+
}, null, 8, ["errors", "hide-error-message"])) : vue.createCommentVNode("", true),
|
|
3663
|
+
showPopup.value ? (vue.openBlock(), vue.createBlock(_sfc_main$8, {
|
|
3664
|
+
key: 3,
|
|
3665
|
+
"base-element": rootRef.value,
|
|
3666
|
+
"display-format": actualDisplayFormat.value,
|
|
3667
|
+
"hide-extra-date": __props.hidePopupExtraDate,
|
|
3668
|
+
"model-value": __props.modelValue,
|
|
3669
|
+
"popup-align": __props.popupAlign,
|
|
3670
|
+
"popup-direction": __props.popupDirection,
|
|
3671
|
+
resolution: __props.resolution,
|
|
3672
|
+
"select-end-year": __props.popupEndYear,
|
|
3673
|
+
"select-start-year": __props.popupStartYear,
|
|
3674
|
+
"time-zone": __props.timeZone,
|
|
3675
|
+
onClose: _cache[1] || (_cache[1] = () => togglePopup(false)),
|
|
3676
|
+
"onUpdate:modelValue": setValueFromPopup
|
|
3677
|
+
}, null, 8, ["base-element", "display-format", "hide-extra-date", "model-value", "popup-align", "popup-direction", "resolution", "select-end-year", "select-start-year", "time-zone"])) : vue.createCommentVNode("", true)
|
|
3678
|
+
], 38)), [
|
|
3679
|
+
[vue.unref(vClickOutside), () => togglePopup(false)]
|
|
3680
|
+
]);
|
|
3681
|
+
};
|
|
3682
|
+
}
|
|
3683
|
+
});
|
|
3684
|
+
const _hoisted_1$5 = { class: "bs-date-range-popup flex flex-col px-16 py-8" };
|
|
3685
|
+
const _hoisted_2$4 = { class: "buttons" };
|
|
3686
|
+
const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
3687
|
+
__name: "BSDateRangeInputPopup",
|
|
3688
|
+
props: {
|
|
3689
|
+
from: {},
|
|
3690
|
+
to: {},
|
|
3691
|
+
disabledFrom: { type: Boolean },
|
|
3692
|
+
disabledTo: { type: Boolean },
|
|
3693
|
+
resolution: {},
|
|
3694
|
+
displayFormat: {},
|
|
3695
|
+
timeZone: {},
|
|
3696
|
+
baseElement: {},
|
|
3697
|
+
selectStartYear: {},
|
|
3698
|
+
selectEndYear: {},
|
|
3699
|
+
okButtonCaption: { default: "OK" },
|
|
3700
|
+
cancelButtonCaption: { default: "Cancel" }
|
|
3701
|
+
},
|
|
3702
|
+
emits: ["update:from", "update:to", "close"],
|
|
3703
|
+
setup(__props, { emit: __emit }) {
|
|
3704
|
+
const props = __props;
|
|
3705
|
+
const emit = __emit;
|
|
3706
|
+
const fromValue = vue.ref(props.from);
|
|
3707
|
+
const toValue = vue.ref(props.to);
|
|
3708
|
+
const emitValue = () => {
|
|
3709
|
+
emit("update:from", fromValue.value);
|
|
3710
|
+
emit("update:to", toValue.value);
|
|
3711
|
+
close();
|
|
3712
|
+
};
|
|
3713
|
+
const close = () => {
|
|
3714
|
+
emit("close");
|
|
3715
|
+
};
|
|
3716
|
+
return (_ctx, _cache) => {
|
|
3717
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$o, {
|
|
3718
|
+
"base-element": __props.baseElement,
|
|
3719
|
+
"offset-from-base-element": 4,
|
|
3720
|
+
"max-height": "auto",
|
|
3721
|
+
onRequestClose: close,
|
|
3722
|
+
onClick: _cache[2] || (_cache[2] = vue.withModifiers(() => {
|
|
3723
|
+
}, ["stop"]))
|
|
3724
|
+
}, {
|
|
3725
|
+
default: vue.withCtx(() => [
|
|
3726
|
+
vue.createElementVNode("div", _hoisted_1$5, [
|
|
3727
|
+
vue.createVNode(_sfc_main$i, {
|
|
3728
|
+
from: fromValue.value,
|
|
3729
|
+
"onUpdate:from": _cache[0] || (_cache[0] = ($event) => fromValue.value = $event),
|
|
3730
|
+
to: toValue.value,
|
|
3731
|
+
"onUpdate:to": _cache[1] || (_cache[1] = ($event) => toValue.value = $event),
|
|
3732
|
+
"disabled-from": __props.disabledFrom,
|
|
3733
|
+
"disabled-to": __props.disabledTo,
|
|
3734
|
+
"display-format": __props.displayFormat,
|
|
3735
|
+
"end-year": __props.selectEndYear,
|
|
3736
|
+
resolution: __props.resolution,
|
|
3737
|
+
"start-year": __props.selectStartYear,
|
|
3738
|
+
"time-zone": __props.timeZone
|
|
3739
|
+
}, null, 8, ["from", "to", "disabled-from", "disabled-to", "display-format", "end-year", "resolution", "start-year", "time-zone"]),
|
|
3740
|
+
vue.createElementVNode("div", _hoisted_2$4, [
|
|
3741
|
+
vue.createVNode(_sfc_main$r, {
|
|
3742
|
+
caption: __props.okButtonCaption,
|
|
3743
|
+
"button-color": "blue",
|
|
3744
|
+
class: "min-w-80",
|
|
3745
|
+
onClick: emitValue
|
|
3746
|
+
}, null, 8, ["caption"]),
|
|
3747
|
+
vue.createVNode(_sfc_main$r, {
|
|
3748
|
+
caption: __props.cancelButtonCaption,
|
|
3749
|
+
class: "min-w-80",
|
|
3750
|
+
onClick: close
|
|
3751
|
+
}, null, 8, ["caption"])
|
|
3752
|
+
])
|
|
3753
|
+
])
|
|
3754
|
+
]),
|
|
3755
|
+
_: 1
|
|
3756
|
+
}, 8, ["base-element"]);
|
|
3757
|
+
};
|
|
3758
|
+
}
|
|
3759
|
+
});
|
|
3760
|
+
const _hoisted_1$4 = {
|
|
3761
|
+
key: 0,
|
|
3762
|
+
class: "view-mode"
|
|
3763
|
+
};
|
|
3764
|
+
const _hoisted_2$3 = {
|
|
3765
|
+
key: 1,
|
|
3766
|
+
class: "input-area"
|
|
3767
|
+
};
|
|
3768
|
+
const _hoisted_3$2 = ["id", "placeholder", "disabled", "maxlength", "name", "tabindex", "value"];
|
|
3769
|
+
const _hoisted_4$2 = ["id", "placeholder", "disabled", "maxlength", "name", "tabindex", "value"];
|
|
3770
|
+
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
3771
|
+
__name: "BSDateRange",
|
|
3772
|
+
props: {
|
|
3773
|
+
idFrom: {},
|
|
3774
|
+
idTo: {},
|
|
3775
|
+
placeholderFrom: {},
|
|
3776
|
+
placeholderTo: {},
|
|
3777
|
+
nameFrom: {},
|
|
3778
|
+
nameTo: {},
|
|
3779
|
+
fromValue: {},
|
|
3780
|
+
toValue: {},
|
|
3781
|
+
disabledFrom: { type: Boolean },
|
|
3782
|
+
disabledTo: { type: Boolean },
|
|
3783
|
+
viewMode: { type: Boolean },
|
|
3784
|
+
required: { type: Boolean },
|
|
3785
|
+
requiredFrom: { type: Boolean },
|
|
3786
|
+
requiredTo: { type: Boolean },
|
|
3787
|
+
width: { default: "364px" },
|
|
3788
|
+
resolution: { default: "MINUTE_10" },
|
|
3789
|
+
displayFormat: {},
|
|
3790
|
+
timeZone: {},
|
|
3791
|
+
hidePopupExtraDate: { type: Boolean },
|
|
3792
|
+
tabindex: { default: 0 },
|
|
3793
|
+
validateDateOrder: { type: Boolean, default: true },
|
|
3794
|
+
validationMessageRequired: {},
|
|
3795
|
+
validationMessageDateOrder: {},
|
|
3796
|
+
extraValidationRules: {},
|
|
3797
|
+
ignoreSavePoint: { type: Boolean },
|
|
3798
|
+
popupDisplayFormat: {},
|
|
3799
|
+
popupAlign: {},
|
|
3800
|
+
popupDirection: {},
|
|
3801
|
+
popupStartYear: {},
|
|
3802
|
+
popupEndYear: {},
|
|
3803
|
+
hideErrorMessage: { type: Boolean },
|
|
3804
|
+
showErrorMessageOnDisabled: { type: Boolean },
|
|
3805
|
+
minDateValue: {},
|
|
3806
|
+
maxDateValue: {}
|
|
3807
|
+
},
|
|
3808
|
+
emits: ["update:fromValue", "update:toValue"],
|
|
3809
|
+
setup(__props, { emit: __emit }) {
|
|
3810
|
+
const props = __props;
|
|
3811
|
+
const emit = __emit;
|
|
3812
|
+
const blueseaConfig = useBlueseaConfig();
|
|
3813
|
+
const rootRef = vue.useTemplateRef("root");
|
|
3814
|
+
const formattedDateRange = vue.computed(() => {
|
|
3815
|
+
return `${viewModeFrom.value} ~ ${viewModeTo.value}`;
|
|
3816
|
+
});
|
|
3817
|
+
const actualTimeZone = vue.computed(() => props.timeZone || blueseaConfig.timeZone);
|
|
3818
|
+
const actualDisplayFormat = vue.computed(() => props.displayFormat || blueseaConfig.dateFormat);
|
|
3819
|
+
const actualMinDateValue = vue.computed(
|
|
3820
|
+
() => props.minDateValue || blueseaConfig.minDateValue
|
|
3821
|
+
);
|
|
3822
|
+
const actualMaxDateValue = vue.computed(
|
|
3823
|
+
() => props.maxDateValue || blueseaConfig.maxDateValue
|
|
3824
|
+
);
|
|
3825
|
+
const inputFormat = vue.computed(
|
|
3826
|
+
() => dateInputFormatByResolution(props.resolution)
|
|
3827
|
+
);
|
|
3828
|
+
vue.watch(
|
|
3829
|
+
() => [props.fromValue, actualTimeZone.value],
|
|
3830
|
+
() => {
|
|
3831
|
+
stringValueFrom.value = formatUtil.formatDateString(
|
|
3832
|
+
props.fromValue,
|
|
3833
|
+
inputFormat.value,
|
|
3834
|
+
actualTimeZone.value
|
|
3835
|
+
);
|
|
3836
|
+
validateValueFrom(props.fromValue || "", "change");
|
|
3837
|
+
}
|
|
3838
|
+
);
|
|
3839
|
+
vue.watch(
|
|
3840
|
+
() => [props.toValue, actualTimeZone.value],
|
|
3841
|
+
() => {
|
|
3842
|
+
stringValueTo.value = formatUtil.formatDateString(
|
|
3843
|
+
props.toValue,
|
|
3844
|
+
inputFormat.value,
|
|
3845
|
+
actualTimeZone.value
|
|
3846
|
+
);
|
|
3847
|
+
validateValueTo(props.toValue || "", "change");
|
|
3848
|
+
}
|
|
3849
|
+
);
|
|
3850
|
+
const validateValueAll = async (phase) => {
|
|
3851
|
+
await validateValueFrom(props.fromValue || "", phase);
|
|
3852
|
+
await validateValueTo(props.toValue || "", phase);
|
|
3853
|
+
};
|
|
3854
|
+
const focusedFrom = vue.ref(false);
|
|
3855
|
+
const focusedTo = vue.ref(false);
|
|
3856
|
+
const formattedFrom = vue.computed(
|
|
3857
|
+
() => formattedTimeZoneFrom(actualTimeZone.value)
|
|
3858
|
+
);
|
|
3859
|
+
const formattedTimeZoneFrom = (timeZone) => {
|
|
3860
|
+
const resolution = props.resolution === "MINUTE_10" || props.resolution === "MINUTE_30" ? "MINUTE" : props.resolution;
|
|
3861
|
+
const date = convertInputToDateString(
|
|
3862
|
+
stringValueFrom.value,
|
|
3863
|
+
inputFormat.value,
|
|
3864
|
+
false,
|
|
3865
|
+
resolution,
|
|
3866
|
+
actualTimeZone.value,
|
|
3867
|
+
actualMinDateValue.value,
|
|
3868
|
+
actualMaxDateValue.value
|
|
3869
|
+
);
|
|
3870
|
+
return formatUtil.formatDateString(date, actualDisplayFormat.value, timeZone);
|
|
3871
|
+
};
|
|
3872
|
+
const formattedTo = vue.computed(() => formattedTimeZoneTo(actualTimeZone.value));
|
|
3873
|
+
const formattedTimeZoneTo = (timeZone) => {
|
|
3874
|
+
const date = convertInputToDateString(
|
|
3875
|
+
stringValueTo.value,
|
|
3876
|
+
inputFormat.value,
|
|
3877
|
+
true,
|
|
3878
|
+
props.resolution,
|
|
3879
|
+
actualTimeZone.value,
|
|
3880
|
+
actualMinDateValue.value,
|
|
3881
|
+
actualMaxDateValue.value
|
|
3882
|
+
);
|
|
3883
|
+
return formatUtil.formatDateString(date, actualDisplayFormat.value, timeZone);
|
|
3884
|
+
};
|
|
3885
|
+
const viewModeFrom = vue.computed(
|
|
3886
|
+
() => viewModeTimeZoneValue(props.fromValue, false, actualTimeZone.value)
|
|
3887
|
+
);
|
|
3888
|
+
const viewModeTo = vue.computed(
|
|
3889
|
+
() => viewModeTimeZoneValue(props.toValue, true, actualTimeZone.value)
|
|
3890
|
+
);
|
|
3891
|
+
const viewModeTimeZoneValue = (value, endTime, displayTimeZone) => {
|
|
3892
|
+
const stringDate = formatUtil.formatDateString(
|
|
3893
|
+
value,
|
|
3894
|
+
dateInputFormatByResolution("SECOND"),
|
|
3895
|
+
actualTimeZone.value
|
|
3896
|
+
);
|
|
3897
|
+
const date = convertInputToDateString(
|
|
3898
|
+
stringDate,
|
|
3899
|
+
"SECOND",
|
|
3900
|
+
endTime,
|
|
3901
|
+
"SECOND",
|
|
3902
|
+
actualTimeZone.value,
|
|
3903
|
+
actualMinDateValue.value,
|
|
3904
|
+
actualMaxDateValue.value
|
|
3905
|
+
);
|
|
3906
|
+
return formatUtil.formatDateString(date, actualDisplayFormat.value, displayTimeZone);
|
|
3907
|
+
};
|
|
3908
|
+
const maxlength = vue.computed(() => inputFormat.value.length);
|
|
3909
|
+
const disabled = vue.computed(() => props.disabledFrom && props.disabledTo);
|
|
3910
|
+
const fieldFrom = vue.ref();
|
|
3911
|
+
const fieldTo = vue.ref();
|
|
3912
|
+
const fieldContext = useFieldContext();
|
|
3913
|
+
const errors = vue.computed(() => {
|
|
3914
|
+
const merged = [...errorsFrom.value];
|
|
3915
|
+
errorsTo.value.forEach((err) => {
|
|
3916
|
+
if (!merged.find((mergedErr) => mergedErr.code === err.code))
|
|
3917
|
+
merged.push(err);
|
|
3918
|
+
});
|
|
3919
|
+
return merged;
|
|
3920
|
+
});
|
|
3921
|
+
const isValidFrom = async (value, phase) => {
|
|
3922
|
+
const errors2 = [];
|
|
3923
|
+
const text = value?.trim() ?? "";
|
|
3924
|
+
executeRequiredValidation(
|
|
3925
|
+
text,
|
|
3926
|
+
props.required || props.requiredFrom,
|
|
3927
|
+
props.validationMessageRequired,
|
|
3928
|
+
errors2
|
|
3929
|
+
) || props.validateDateOrder && executeDateRangeValidation(
|
|
3930
|
+
text,
|
|
3931
|
+
props.toValue,
|
|
3932
|
+
props.validationMessageDateOrder,
|
|
3933
|
+
errors2
|
|
3934
|
+
);
|
|
3935
|
+
await executeFieldValidationRule(
|
|
3936
|
+
text,
|
|
3937
|
+
props.extraValidationRules,
|
|
3938
|
+
errors2,
|
|
3939
|
+
phase,
|
|
3940
|
+
fieldContext
|
|
3941
|
+
);
|
|
3942
|
+
return errors2;
|
|
3943
|
+
};
|
|
3944
|
+
const validationDisabledFrom = vue.computed(
|
|
3945
|
+
() => props.viewMode || props.disabledFrom
|
|
3946
|
+
);
|
|
3947
|
+
const {
|
|
3948
|
+
stringValue: stringValueFrom,
|
|
3949
|
+
errors: errorsFrom,
|
|
3950
|
+
handleInput: handleInputFrom,
|
|
3951
|
+
handleChange: handleChangeFrom,
|
|
3952
|
+
handleFocus: handleFocusFrom,
|
|
3953
|
+
handleBlur: handleBlurFrom,
|
|
3954
|
+
validateValue: validateValueFrom
|
|
3955
|
+
} = fieldValidator({
|
|
3956
|
+
field: fieldFrom,
|
|
3957
|
+
disabled: validationDisabledFrom,
|
|
3958
|
+
initialValue: props.fromValue,
|
|
3959
|
+
isValid: isValidFrom,
|
|
3960
|
+
convertToValue: (input) => convertInputToDateString(
|
|
3961
|
+
input,
|
|
3962
|
+
inputFormat.value,
|
|
3963
|
+
false,
|
|
3964
|
+
props.resolution,
|
|
3965
|
+
actualTimeZone.value,
|
|
3966
|
+
actualMinDateValue.value,
|
|
3967
|
+
actualMaxDateValue.value
|
|
3968
|
+
),
|
|
3969
|
+
convertFromValue: (date) => formatUtil.formatDateString(date, inputFormat.value, actualTimeZone.value)
|
|
3970
|
+
});
|
|
3971
|
+
const handlersFrom = {
|
|
3972
|
+
input: async (event) => {
|
|
3973
|
+
stringValueFrom.value = normalizeDateInput(
|
|
3974
|
+
event.target.value
|
|
3975
|
+
);
|
|
3976
|
+
await handleInputFrom(event);
|
|
3977
|
+
},
|
|
3978
|
+
focus: (event) => {
|
|
3979
|
+
focusedFrom.value = true;
|
|
3980
|
+
handleFocusFrom(event);
|
|
3981
|
+
},
|
|
3982
|
+
blur: (event) => {
|
|
3983
|
+
focusedFrom.value = false;
|
|
3984
|
+
handleBlurFrom(event);
|
|
3985
|
+
},
|
|
3986
|
+
change: (event) => {
|
|
3987
|
+
handleChangeFrom(event);
|
|
3988
|
+
const date = convertInputToDateString(
|
|
3989
|
+
stringValueFrom.value,
|
|
3990
|
+
inputFormat.value,
|
|
3991
|
+
false,
|
|
3992
|
+
props.resolution,
|
|
3993
|
+
actualTimeZone.value,
|
|
3994
|
+
actualMinDateValue.value,
|
|
3995
|
+
actualMaxDateValue.value
|
|
3996
|
+
);
|
|
3997
|
+
emit("update:fromValue", date);
|
|
3998
|
+
stringValueFrom.value = convertDateToInputString(
|
|
3999
|
+
date,
|
|
4000
|
+
inputFormat.value,
|
|
4001
|
+
actualTimeZone.value
|
|
4002
|
+
);
|
|
4003
|
+
}
|
|
4004
|
+
};
|
|
4005
|
+
const isValidTo = async (value, phase) => {
|
|
4006
|
+
const errors2 = [];
|
|
4007
|
+
const text = value?.trim() ?? "";
|
|
4008
|
+
executeRequiredValidation(
|
|
4009
|
+
text,
|
|
4010
|
+
props.required || props.requiredTo,
|
|
4011
|
+
props.validationMessageRequired,
|
|
4012
|
+
errors2
|
|
4013
|
+
) || props.validateDateOrder && executeDateRangeValidation(
|
|
4014
|
+
props.fromValue,
|
|
4015
|
+
text,
|
|
4016
|
+
props.validationMessageDateOrder,
|
|
4017
|
+
errors2
|
|
4018
|
+
);
|
|
4019
|
+
await executeFieldValidationRule(
|
|
4020
|
+
text,
|
|
4021
|
+
props.extraValidationRules,
|
|
4022
|
+
errors2,
|
|
4023
|
+
phase,
|
|
4024
|
+
fieldContext
|
|
4025
|
+
);
|
|
4026
|
+
return errors2;
|
|
4027
|
+
};
|
|
4028
|
+
const validationDisabledTo = vue.computed(() => props.viewMode || props.disabledTo);
|
|
4029
|
+
const {
|
|
4030
|
+
stringValue: stringValueTo,
|
|
4031
|
+
errors: errorsTo,
|
|
4032
|
+
handleInput: handleInputTo,
|
|
4033
|
+
handleChange: handleChangeTo,
|
|
4034
|
+
handleFocus: handleFocusTo,
|
|
4035
|
+
handleBlur: handleBlurTo,
|
|
4036
|
+
validateValue: validateValueTo
|
|
4037
|
+
} = fieldValidator({
|
|
4038
|
+
field: fieldTo,
|
|
4039
|
+
disabled: validationDisabledTo,
|
|
4040
|
+
initialValue: props.toValue,
|
|
4041
|
+
isValid: isValidTo,
|
|
4042
|
+
convertToValue: (input) => convertInputToDateString(
|
|
4043
|
+
input,
|
|
4044
|
+
inputFormat.value,
|
|
4045
|
+
true,
|
|
4046
|
+
props.resolution,
|
|
4047
|
+
actualTimeZone.value,
|
|
4048
|
+
actualMinDateValue.value,
|
|
4049
|
+
actualMaxDateValue.value
|
|
4050
|
+
),
|
|
4051
|
+
convertFromValue: (date) => formatUtil.formatDateString(date, inputFormat.value, actualTimeZone.value)
|
|
4052
|
+
});
|
|
4053
|
+
const handlersTo = {
|
|
4054
|
+
input: async (event) => {
|
|
4055
|
+
stringValueTo.value = normalizeDateInput(
|
|
4056
|
+
event.target.value
|
|
4057
|
+
);
|
|
4058
|
+
await handleInputTo(event);
|
|
4059
|
+
},
|
|
4060
|
+
focus: (event) => {
|
|
4061
|
+
focusedTo.value = true;
|
|
4062
|
+
handleFocusTo(event);
|
|
4063
|
+
},
|
|
4064
|
+
blur: (event) => {
|
|
4065
|
+
focusedTo.value = false;
|
|
4066
|
+
handleBlurTo(event);
|
|
4067
|
+
},
|
|
4068
|
+
change: (event) => {
|
|
4069
|
+
handleChangeTo(event);
|
|
4070
|
+
const date = convertInputToDateString(
|
|
4071
|
+
stringValueTo.value,
|
|
4072
|
+
inputFormat.value,
|
|
4073
|
+
true,
|
|
4074
|
+
props.resolution,
|
|
4075
|
+
actualTimeZone.value,
|
|
4076
|
+
actualMinDateValue.value,
|
|
4077
|
+
actualMaxDateValue.value
|
|
4078
|
+
);
|
|
4079
|
+
emit("update:toValue", date);
|
|
4080
|
+
stringValueTo.value = convertDateToInputString(
|
|
4081
|
+
date,
|
|
4082
|
+
inputFormat.value,
|
|
4083
|
+
actualTimeZone.value
|
|
4084
|
+
);
|
|
4085
|
+
}
|
|
4086
|
+
};
|
|
4087
|
+
const savePoint = props.ignoreSavePoint ? void 0 : useSavePoint();
|
|
4088
|
+
const savePointHandlerFrom = savePoint?.registerField({
|
|
4089
|
+
field: fieldFrom,
|
|
4090
|
+
getCurrentValue: () => props.fromValue || "",
|
|
4091
|
+
setCurrentValue: (value) => emit("update:fromValue", value || "")
|
|
4092
|
+
});
|
|
4093
|
+
const modifiedFrom = vue.computed(
|
|
4094
|
+
() => !!savePointHandlerFrom?.isModified(props.fromValue || "")
|
|
4095
|
+
);
|
|
4096
|
+
vue.onBeforeUnmount(() => savePoint?.unregisterField(fieldFrom));
|
|
4097
|
+
const savePointHandlerTo = savePoint?.registerField({
|
|
4098
|
+
field: fieldTo,
|
|
4099
|
+
getCurrentValue: () => props.toValue || "",
|
|
4100
|
+
setCurrentValue: (value) => emit("update:toValue", value || "")
|
|
4101
|
+
});
|
|
4102
|
+
const modifiedTo = vue.computed(
|
|
4103
|
+
() => !!savePointHandlerTo?.isModified(props.toValue || "")
|
|
4104
|
+
);
|
|
4105
|
+
vue.onBeforeUnmount(() => savePoint?.unregisterField(fieldTo));
|
|
4106
|
+
const modified = vue.computed(() => modifiedFrom.value || modifiedTo.value);
|
|
4107
|
+
const showPopup = vue.ref(false);
|
|
4108
|
+
const togglePopup = (show) => {
|
|
4109
|
+
if ((!props.disabledFrom || !props.disabledTo) && !props.viewMode) {
|
|
4110
|
+
showPopup.value = show === void 0 ? !showPopup.value : show;
|
|
4111
|
+
}
|
|
4112
|
+
};
|
|
4113
|
+
const setFromValueFromPopup = async (value) => {
|
|
4114
|
+
const checkedValue = checkDateMinMaxValue(
|
|
4115
|
+
value,
|
|
4116
|
+
inputFormat.value,
|
|
4117
|
+
false,
|
|
4118
|
+
props.resolution,
|
|
4119
|
+
actualTimeZone.value,
|
|
4120
|
+
actualMinDateValue.value,
|
|
4121
|
+
actualMaxDateValue.value
|
|
4122
|
+
);
|
|
4123
|
+
emit("update:fromValue", checkedValue);
|
|
4124
|
+
await vue.nextTick();
|
|
4125
|
+
await validateValueAll("change");
|
|
4126
|
+
};
|
|
4127
|
+
const setToValueFromPopup = async (value) => {
|
|
4128
|
+
const checkedValue = checkDateMinMaxValue(
|
|
4129
|
+
value,
|
|
4130
|
+
inputFormat.value,
|
|
4131
|
+
true,
|
|
4132
|
+
props.resolution,
|
|
4133
|
+
actualTimeZone.value,
|
|
4134
|
+
actualMinDateValue.value,
|
|
4135
|
+
actualMaxDateValue.value
|
|
4136
|
+
);
|
|
4137
|
+
emit("update:toValue", checkedValue);
|
|
4138
|
+
await vue.nextTick();
|
|
4139
|
+
await validateValueAll("change");
|
|
4140
|
+
};
|
|
4141
|
+
return (_ctx, _cache) => {
|
|
4142
|
+
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
4143
|
+
ref: "root",
|
|
4144
|
+
class: vue.normalizeClass([{ required: __props.required, disabled: disabled.value, modified: modified.value, error: errors.value.length > 0 }, "bs-date-range bs-input-wrap position-relative"]),
|
|
4145
|
+
style: vue.normalizeStyle({ width: __props.width }),
|
|
4146
|
+
onKeydown: _cache[2] || (_cache[2] = vue.withKeys(vue.withModifiers(() => togglePopup(false), ["stop", "prevent"]), ["esc"]))
|
|
4147
|
+
}, [
|
|
4148
|
+
__props.viewMode ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [
|
|
4149
|
+
vue.createElementVNode("span", null, vue.toDisplayString(formattedDateRange.value), 1)
|
|
4150
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$3, [
|
|
4151
|
+
vue.createElementVNode("span", {
|
|
4152
|
+
class: vue.normalizeClass([{ "bs-clickable": !disabled.value }, "font-icon"]),
|
|
4153
|
+
onClick: _cache[0] || (_cache[0] = () => togglePopup())
|
|
4154
|
+
}, " calendar_month ", 2),
|
|
4155
|
+
vue.createElementVNode("input", vue.mergeProps({
|
|
4156
|
+
id: __props.idFrom,
|
|
4157
|
+
ref_key: "fieldFrom",
|
|
4158
|
+
ref: fieldFrom,
|
|
4159
|
+
placeholder: __props.placeholderFrom,
|
|
4160
|
+
disabled: __props.disabledFrom,
|
|
4161
|
+
maxlength: maxlength.value,
|
|
4162
|
+
name: __props.nameFrom,
|
|
4163
|
+
tabindex: __props.tabindex,
|
|
4164
|
+
value: focusedFrom.value ? vue.unref(stringValueFrom) : formattedFrom.value,
|
|
4165
|
+
type: "text"
|
|
4166
|
+
}, vue.toHandlers(handlersFrom, true)), null, 16, _hoisted_3$2),
|
|
4167
|
+
_cache[3] || (_cache[3] = vue.createElementVNode("span", { class: "px-4" }, "~", -1)),
|
|
4168
|
+
vue.createElementVNode("input", vue.mergeProps({
|
|
4169
|
+
id: __props.idTo,
|
|
4170
|
+
ref_key: "fieldTo",
|
|
4171
|
+
ref: fieldTo,
|
|
4172
|
+
placeholder: __props.placeholderTo,
|
|
4173
|
+
disabled: __props.disabledTo,
|
|
4174
|
+
maxlength: maxlength.value,
|
|
4175
|
+
name: __props.nameTo,
|
|
4176
|
+
tabindex: __props.tabindex,
|
|
4177
|
+
value: focusedTo.value ? vue.unref(stringValueTo) : formattedTo.value,
|
|
4178
|
+
type: "text"
|
|
4179
|
+
}, vue.toHandlers(handlersTo, true)), null, 16, _hoisted_4$2)
|
|
4180
|
+
])),
|
|
4181
|
+
!__props.viewMode ? (vue.openBlock(), vue.createBlock(_sfc_main$l, {
|
|
4182
|
+
key: 2,
|
|
4183
|
+
errors: errors.value,
|
|
4184
|
+
"hide-error-message": __props.hideErrorMessage || disabled.value && !__props.showErrorMessageOnDisabled
|
|
4185
|
+
}, null, 8, ["errors", "hide-error-message"])) : vue.createCommentVNode("", true),
|
|
4186
|
+
showPopup.value ? (vue.openBlock(), vue.createBlock(_sfc_main$6, {
|
|
4187
|
+
key: 3,
|
|
4188
|
+
"base-element": rootRef.value,
|
|
4189
|
+
"disabled-from": __props.disabledFrom,
|
|
4190
|
+
"disabled-to": __props.disabledTo,
|
|
4191
|
+
"display-format": __props.popupDisplayFormat || actualDisplayFormat.value,
|
|
4192
|
+
from: __props.fromValue,
|
|
4193
|
+
"hide-extra-date": __props.hidePopupExtraDate,
|
|
4194
|
+
"popup-align": __props.popupAlign,
|
|
4195
|
+
"popup-direction": __props.popupDirection,
|
|
4196
|
+
resolution: __props.resolution,
|
|
4197
|
+
"select-end-year": __props.popupEndYear,
|
|
4198
|
+
"select-start-year": __props.popupStartYear,
|
|
4199
|
+
"time-zone": __props.timeZone,
|
|
4200
|
+
to: __props.toValue,
|
|
4201
|
+
onClose: _cache[1] || (_cache[1] = () => togglePopup(false)),
|
|
4202
|
+
"onUpdate:from": setFromValueFromPopup,
|
|
4203
|
+
"onUpdate:to": setToValueFromPopup
|
|
4204
|
+
}, null, 8, ["base-element", "disabled-from", "disabled-to", "display-format", "from", "hide-extra-date", "popup-align", "popup-direction", "resolution", "select-end-year", "select-start-year", "time-zone", "to"])) : vue.createCommentVNode("", true)
|
|
4205
|
+
], 38)), [
|
|
4206
|
+
[vue.unref(vClickOutside), () => togglePopup(false)]
|
|
4207
|
+
]);
|
|
4208
|
+
};
|
|
4209
|
+
}
|
|
4210
|
+
});
|
|
4211
|
+
const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
4212
|
+
__name: "SlideDownTransition",
|
|
4213
|
+
setup(__props) {
|
|
4214
|
+
const beforeEnter = (el) => {
|
|
4215
|
+
if (el instanceof HTMLElement) {
|
|
4216
|
+
requestAnimationFrame(() => {
|
|
4217
|
+
el.style.maxHeight = "0px";
|
|
4218
|
+
});
|
|
4219
|
+
}
|
|
4220
|
+
};
|
|
4221
|
+
const enter = (el) => {
|
|
4222
|
+
if (el instanceof HTMLElement) {
|
|
4223
|
+
requestAnimationFrame(() => {
|
|
4224
|
+
requestAnimationFrame(() => {
|
|
4225
|
+
el.style.maxHeight = `${el.scrollHeight}px`;
|
|
4226
|
+
});
|
|
4227
|
+
});
|
|
4228
|
+
}
|
|
4229
|
+
};
|
|
4230
|
+
const afterEnter = (el) => {
|
|
4231
|
+
if (el instanceof HTMLElement) {
|
|
4232
|
+
el.style.maxHeight = "none";
|
|
4233
|
+
}
|
|
4234
|
+
};
|
|
4235
|
+
const beforeLeave = (el) => {
|
|
4236
|
+
if (el instanceof HTMLElement) {
|
|
4237
|
+
requestAnimationFrame(() => {
|
|
4238
|
+
el.style.maxHeight = `${el.scrollHeight}px`;
|
|
4239
|
+
});
|
|
4240
|
+
}
|
|
4241
|
+
};
|
|
4242
|
+
const leave = (el) => {
|
|
4243
|
+
if (el instanceof HTMLElement) {
|
|
4244
|
+
requestAnimationFrame(() => {
|
|
4245
|
+
requestAnimationFrame(() => {
|
|
4246
|
+
el.style.maxHeight = `0px`;
|
|
4247
|
+
});
|
|
4248
|
+
});
|
|
4249
|
+
}
|
|
4250
|
+
};
|
|
4251
|
+
const afterLeave = (el) => {
|
|
4252
|
+
if (el instanceof HTMLElement) {
|
|
4253
|
+
el.style.maxHeight = "none";
|
|
4254
|
+
}
|
|
4255
|
+
};
|
|
4256
|
+
return (_ctx, _cache) => {
|
|
4257
|
+
return vue.openBlock(), vue.createBlock(vue.Transition, {
|
|
4258
|
+
name: "slide-down",
|
|
4259
|
+
onEnter: enter,
|
|
4260
|
+
onLeave: leave,
|
|
4261
|
+
onBeforeEnter: beforeEnter,
|
|
4262
|
+
onAfterEnter: afterEnter,
|
|
4263
|
+
onBeforeLeave: beforeLeave,
|
|
4264
|
+
onAfterLeave: afterLeave
|
|
4265
|
+
}, {
|
|
4266
|
+
default: vue.withCtx(() => [
|
|
4267
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
4268
|
+
]),
|
|
4269
|
+
_: 3
|
|
4270
|
+
});
|
|
4271
|
+
};
|
|
4272
|
+
}
|
|
4273
|
+
});
|
|
4274
|
+
const _hoisted_1$3 = {
|
|
4275
|
+
key: 0,
|
|
4276
|
+
class: "card-layout-header flex flex-row items-center"
|
|
4277
|
+
};
|
|
4278
|
+
const _hoisted_2$2 = ["textContent"];
|
|
4279
|
+
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
4280
|
+
__name: "BSCardLayout",
|
|
4281
|
+
props: {
|
|
4282
|
+
title: {},
|
|
4283
|
+
hideTitle: { type: Boolean },
|
|
4284
|
+
cardBodyClass: {}
|
|
4285
|
+
},
|
|
4286
|
+
setup(__props) {
|
|
4287
|
+
const expanded = vue.ref(true);
|
|
4288
|
+
const toggleExpand = () => expanded.value = !expanded.value;
|
|
4289
|
+
return (_ctx, _cache) => {
|
|
4290
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
4291
|
+
class: vue.normalizeClass([{ expanded: expanded.value }, "bs-card-layout"])
|
|
4292
|
+
}, [
|
|
4293
|
+
!__props.hideTitle ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
|
|
4294
|
+
vue.createElementVNode("span", {
|
|
4295
|
+
class: "expand-btn font-icon bs-clickable",
|
|
4296
|
+
onClick: toggleExpand
|
|
4297
|
+
}, "label"),
|
|
4298
|
+
vue.createElementVNode("div", {
|
|
4299
|
+
textContent: vue.toDisplayString(__props.title),
|
|
4300
|
+
class: "card-layout-title"
|
|
4301
|
+
}, null, 8, _hoisted_2$2),
|
|
4302
|
+
_cache[0] || (_cache[0] = vue.createElementVNode("div", { class: "grow" }, null, -1)),
|
|
4303
|
+
vue.createElementVNode("div", null, [
|
|
4304
|
+
vue.renderSlot(_ctx.$slots, "title-right")
|
|
4305
|
+
])
|
|
4306
|
+
])) : vue.createCommentVNode("", true),
|
|
4307
|
+
vue.createVNode(_sfc_main$4, null, {
|
|
4308
|
+
default: vue.withCtx(() => [
|
|
4309
|
+
vue.withDirectives(vue.createElementVNode("div", {
|
|
4310
|
+
class: vue.normalizeClass(__props.cardBodyClass)
|
|
4311
|
+
}, [
|
|
4312
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
4313
|
+
], 2), [
|
|
4314
|
+
[vue.vShow, expanded.value]
|
|
4315
|
+
])
|
|
4316
|
+
]),
|
|
4317
|
+
_: 3
|
|
4318
|
+
})
|
|
4319
|
+
], 2);
|
|
4320
|
+
};
|
|
4321
|
+
}
|
|
4322
|
+
});
|
|
4323
|
+
const _hoisted_1$2 = { class: "bs-notification-container" };
|
|
4324
|
+
const _hoisted_2$1 = { class: "top-notification inline-flex flex-col items-center gap-1" };
|
|
4325
|
+
const _hoisted_3$1 = ["textContent"];
|
|
4326
|
+
const _hoisted_4$1 = { class: "bottom-notification inline-flex flex-col items-end gap-1" };
|
|
4327
|
+
const _hoisted_5 = { class: "tooltip-container" };
|
|
4328
|
+
const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
4329
|
+
__name: "BSNotificationContainer",
|
|
4330
|
+
setup(__props) {
|
|
4331
|
+
const tooltip = vue.ref();
|
|
4332
|
+
const setCursorInTooltip = (isIn, event) => {
|
|
4333
|
+
if (tooltipEntry.value && tooltip.value && !tooltip.value.$el?.contains(event.relatedTarget)) {
|
|
4334
|
+
tooltipEntry.value.cursorInTooltip = isIn;
|
|
4335
|
+
if (!isIn) hideTooltip();
|
|
4336
|
+
}
|
|
4337
|
+
};
|
|
4338
|
+
return (_ctx, _cache) => {
|
|
4339
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
|
|
4340
|
+
vue.createElementVNode("div", _hoisted_2$1, [
|
|
4341
|
+
vue.createVNode(vue.TransitionGroup, { name: "notification" }, {
|
|
4342
|
+
default: vue.withCtx(() => [
|
|
4343
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(notificationEntries), (entry) => {
|
|
4344
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
4345
|
+
key: entry.entryId,
|
|
4346
|
+
textContent: vue.toDisplayString(entry.message),
|
|
4347
|
+
class: vue.normalizeClass(entry.style)
|
|
4348
|
+
}, null, 10, _hoisted_3$1);
|
|
4349
|
+
}), 128))
|
|
4350
|
+
]),
|
|
4351
|
+
_: 1
|
|
4352
|
+
})
|
|
4353
|
+
]),
|
|
4354
|
+
vue.createElementVNode("div", _hoisted_4$1, [
|
|
4355
|
+
vue.createVNode(vue.TransitionGroup, { name: "alarm" }, {
|
|
4356
|
+
default: vue.withCtx(() => [
|
|
4357
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(alarmEntries), (entry) => {
|
|
4358
|
+
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(entry.component), {
|
|
4359
|
+
key: entry.entryId,
|
|
4360
|
+
"alarm-entry-id": entry.entryId,
|
|
4361
|
+
class: "bs-alarm-frame"
|
|
4362
|
+
}, null, 8, ["alarm-entry-id"]);
|
|
4363
|
+
}), 128))
|
|
4364
|
+
]),
|
|
4365
|
+
_: 1
|
|
4366
|
+
})
|
|
4367
|
+
]),
|
|
4368
|
+
vue.createElementVNode("div", _hoisted_5, [
|
|
4369
|
+
vue.unref(tooltipEntry) ? (vue.openBlock(), vue.createBlock(_sfc_main$n, {
|
|
4370
|
+
key: 0,
|
|
4371
|
+
ref_key: "tooltip",
|
|
4372
|
+
ref: tooltip,
|
|
4373
|
+
content: vue.unref(tooltipEntry).content,
|
|
4374
|
+
target: vue.unref(tooltipEntry).target,
|
|
4375
|
+
onMouseout: _cache[0] || (_cache[0] = ($event) => setCursorInTooltip(false, $event)),
|
|
4376
|
+
onMouseover: _cache[1] || (_cache[1] = ($event) => setCursorInTooltip(true, $event))
|
|
4377
|
+
}, null, 8, ["content", "target"])) : vue.createCommentVNode("", true)
|
|
4378
|
+
]),
|
|
4379
|
+
vue.unref(showLoadingIcon) ? (vue.openBlock(), vue.createBlock(BSLoadingIcon, { key: 0 })) : vue.createCommentVNode("", true)
|
|
4380
|
+
]);
|
|
4381
|
+
};
|
|
4382
|
+
}
|
|
4383
|
+
});
|
|
4384
|
+
const _hoisted_1$1 = ["data-menu-id"];
|
|
4385
|
+
const _hoisted_2 = ["textContent", "href", "target"];
|
|
4386
|
+
const _hoisted_3 = ["data-menu-id"];
|
|
4387
|
+
const _hoisted_4 = ["textContent", "data-menu-id", "onMouseenter", "onClick"];
|
|
4388
|
+
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
4389
|
+
__name: "BSContextMenu",
|
|
4390
|
+
props: {
|
|
4391
|
+
menuItems: {},
|
|
4392
|
+
popupId: {},
|
|
4393
|
+
baseElement: {},
|
|
4394
|
+
left: {},
|
|
4395
|
+
top: {},
|
|
4396
|
+
zIndex: {},
|
|
4397
|
+
direction: {}
|
|
4398
|
+
},
|
|
4399
|
+
emits: ["menuClicked", "requestClose"],
|
|
4400
|
+
setup(__props, { emit: __emit }) {
|
|
4401
|
+
const emit = __emit;
|
|
4402
|
+
const contextMenu = useContextMenu();
|
|
4403
|
+
const handleMenuClick = (menu) => {
|
|
4404
|
+
if (menu.disabled) return;
|
|
4405
|
+
if (menu.children) ;
|
|
4406
|
+
else {
|
|
4407
|
+
menu.handler?.();
|
|
4408
|
+
contextMenu.hideContextMenu();
|
|
4409
|
+
emit("menuClicked", menu);
|
|
4410
|
+
}
|
|
4411
|
+
};
|
|
4412
|
+
const handleLinkClick = () => {
|
|
4413
|
+
contextMenu.hideContextMenu();
|
|
4414
|
+
};
|
|
4415
|
+
const requestClose = () => {
|
|
4416
|
+
hideContextMenu();
|
|
4417
|
+
emit("requestClose");
|
|
4418
|
+
};
|
|
4419
|
+
const submenu = vue.ref();
|
|
4420
|
+
const submenuParent = vue.ref();
|
|
4421
|
+
const showSubmenu = (event, menu) => {
|
|
4422
|
+
if (menu.children) {
|
|
4423
|
+
submenuParent.value = event.target;
|
|
4424
|
+
submenu.value = menu.children;
|
|
4425
|
+
} else {
|
|
4426
|
+
submenu.value = void 0;
|
|
4427
|
+
submenuParent.value = void 0;
|
|
4428
|
+
}
|
|
4429
|
+
};
|
|
4430
|
+
const hideContextMenu = () => {
|
|
4431
|
+
contextMenu.hideContextMenu();
|
|
4432
|
+
};
|
|
4433
|
+
return (_ctx, _cache) => {
|
|
4434
|
+
const _component_router_link = vue.resolveComponent("router-link");
|
|
4435
|
+
const _component_BSContextMenu = vue.resolveComponent("BSContextMenu", true);
|
|
4436
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$o, {
|
|
4437
|
+
ref: "root",
|
|
4438
|
+
"base-element": __props.baseElement || { left: __props.left || 0, top: __props.top || 0 },
|
|
4439
|
+
"popup-direction": __props.direction,
|
|
4440
|
+
"popup-id": __props.popupId,
|
|
4441
|
+
"z-index": __props.zIndex,
|
|
4442
|
+
"extra-class": "bs-context-menu",
|
|
4443
|
+
onRequestClose: requestClose,
|
|
4444
|
+
onKeydown: vue.withKeys(hideContextMenu, ["esc"])
|
|
4445
|
+
}, {
|
|
4446
|
+
default: vue.withCtx(() => [
|
|
4447
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.menuItems, (menu) => {
|
|
4448
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: menu }, [
|
|
4449
|
+
menu.type === "separator" ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4450
|
+
key: 0,
|
|
4451
|
+
class: "menu separator",
|
|
4452
|
+
onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
|
|
4453
|
+
}, ["stop"]))
|
|
4454
|
+
})) : menu.type === "custom" && menu.component ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(menu.component), {
|
|
4455
|
+
key: 1,
|
|
4456
|
+
class: "menu custom"
|
|
4457
|
+
})) : menu.type === "link" ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4458
|
+
key: 2,
|
|
4459
|
+
"data-menu-id": menu.menuId,
|
|
4460
|
+
class: "menu no-padding",
|
|
4461
|
+
"data-id": "context-menu-item"
|
|
4462
|
+
}, [
|
|
4463
|
+
vue.createElementVNode("a", {
|
|
4464
|
+
textContent: vue.toDisplayString(menu.caption),
|
|
4465
|
+
href: menu.href,
|
|
4466
|
+
target: menu.target,
|
|
4467
|
+
onClick: vue.withModifiers(handleLinkClick, ["stop"])
|
|
4468
|
+
}, null, 8, _hoisted_2)
|
|
4469
|
+
], 8, _hoisted_1$1)) : menu.type === "route" ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4470
|
+
key: 3,
|
|
4471
|
+
"data-menu-id": menu.menuId,
|
|
4472
|
+
class: "menu no-padding",
|
|
4473
|
+
"data-id": "context-menu-item"
|
|
4474
|
+
}, [
|
|
4475
|
+
vue.createVNode(_component_router_link, {
|
|
4476
|
+
textContent: vue.toDisplayString(menu.caption),
|
|
4477
|
+
to: menu.href || "",
|
|
4478
|
+
onClick: vue.withModifiers(handleLinkClick, ["stop"])
|
|
4479
|
+
}, null, 8, ["textContent", "to"])
|
|
4480
|
+
], 8, _hoisted_3)) : (vue.openBlock(), vue.createElementBlock("div", {
|
|
4481
|
+
key: 4,
|
|
4482
|
+
textContent: vue.toDisplayString(menu.caption),
|
|
4483
|
+
class: vue.normalizeClass([{ "has-submenu": menu.children, disabled: menu.disabled }, "menu"]),
|
|
4484
|
+
"data-menu-id": menu.menuId,
|
|
4485
|
+
"data-id": "context-menu-item",
|
|
4486
|
+
onMouseenter: ($event) => showSubmenu($event, menu),
|
|
4487
|
+
onClick: vue.withModifiers(($event) => handleMenuClick(menu), ["stop"])
|
|
4488
|
+
}, null, 42, _hoisted_4))
|
|
4489
|
+
], 64);
|
|
4490
|
+
}), 128)),
|
|
4491
|
+
submenu.value && submenuParent.value ? (vue.openBlock(), vue.createBlock(_component_BSContextMenu, {
|
|
4492
|
+
key: 0,
|
|
4493
|
+
"base-element": submenuParent.value,
|
|
4494
|
+
"menu-items": submenu.value,
|
|
4495
|
+
direction: "auto-right"
|
|
4496
|
+
}, null, 8, ["base-element", "menu-items"])) : vue.createCommentVNode("", true)
|
|
4497
|
+
]),
|
|
4498
|
+
_: 1
|
|
4499
|
+
}, 8, ["base-element", "popup-direction", "popup-id", "z-index"]);
|
|
4500
|
+
};
|
|
4501
|
+
}
|
|
4502
|
+
});
|
|
4503
|
+
const _hoisted_1 = { class: "bs-context-menu-container" };
|
|
4504
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
4505
|
+
__name: "BSContextMenuContainer",
|
|
4506
|
+
setup(__props) {
|
|
4507
|
+
const contextMenu = useContextMenu();
|
|
4508
|
+
const menuItems = vue.computed(() => contextMenu.contextMenuItems.value);
|
|
4509
|
+
const position = vue.computed(() => contextMenu.position.value || { x: 0, y: 0 });
|
|
4510
|
+
const options = vue.computed(() => contextMenu.options.value);
|
|
4511
|
+
const hideContextMenu = () => {
|
|
4512
|
+
contextMenu.hideContextMenu();
|
|
4513
|
+
};
|
|
4514
|
+
return (_ctx, _cache) => {
|
|
4515
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
4516
|
+
menuItems.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4517
|
+
key: 0,
|
|
4518
|
+
class: "context-menu-curtain",
|
|
4519
|
+
tabindex: "0",
|
|
4520
|
+
onClick: vue.withModifiers(hideContextMenu, ["prevent"]),
|
|
4521
|
+
onContextmenu: vue.withModifiers(hideContextMenu, ["prevent"])
|
|
4522
|
+
}, null, 32)) : vue.createCommentVNode("", true),
|
|
4523
|
+
menuItems.value ? (vue.openBlock(), vue.createBlock(_sfc_main$1, {
|
|
4524
|
+
key: 1,
|
|
4525
|
+
left: position.value.x,
|
|
4526
|
+
"menu-items": menuItems.value,
|
|
4527
|
+
top: position.value.y,
|
|
4528
|
+
"z-index": options.value?.zIndex
|
|
4529
|
+
}, null, 8, ["left", "menu-items", "top", "z-index"])) : vue.createCommentVNode("", true),
|
|
4530
|
+
_cache[0] || (_cache[0] = vue.createElementVNode("div", { class: "bs-popup-container" }, null, -1))
|
|
4531
|
+
]);
|
|
4532
|
+
};
|
|
4533
|
+
}
|
|
4534
|
+
});
|
|
4535
|
+
exports2.BSButton = _sfc_main$r;
|
|
4536
|
+
exports2.BSCalendar = _sfc_main$j;
|
|
4537
|
+
exports2.BSCalendarRange = _sfc_main$i;
|
|
4538
|
+
exports2.BSCardLayout = _sfc_main$3;
|
|
4539
|
+
exports2.BSCheckbox = _sfc_main$d;
|
|
4540
|
+
exports2.BSCheckboxGroup = _sfc_main$c;
|
|
4541
|
+
exports2.BSContextMenu = _sfc_main$1;
|
|
4542
|
+
exports2.BSContextMenuContainer = _sfc_main;
|
|
4543
|
+
exports2.BSContextMenuPlugin = BSContextMenuPlugin;
|
|
4544
|
+
exports2.BSDateInput = _sfc_main$7;
|
|
4545
|
+
exports2.BSDateInputPopup = _sfc_main$8;
|
|
4546
|
+
exports2.BSDateRange = _sfc_main$5;
|
|
4547
|
+
exports2.BSDateRangeInputPopup = _sfc_main$6;
|
|
4548
|
+
exports2.BSLoadingIcon = BSLoadingIcon;
|
|
4549
|
+
exports2.BSMultiSelect = _sfc_main$9;
|
|
4550
|
+
exports2.BSNotificationContainer = _sfc_main$2;
|
|
4551
|
+
exports2.BSNumberInput = _sfc_main$f;
|
|
4552
|
+
exports2.BSPageNavigation = _sfc_main$q;
|
|
4553
|
+
exports2.BSPopup = _sfc_main$o;
|
|
4554
|
+
exports2.BSRadioButton = _sfc_main$b;
|
|
4555
|
+
exports2.BSRadioButtonGroup = _sfc_main$a;
|
|
4556
|
+
exports2.BSSelect = _sfc_main$k;
|
|
4557
|
+
exports2.BSTextArea = _sfc_main$e;
|
|
4558
|
+
exports2.BSTextInput = _sfc_main$g;
|
|
4559
|
+
exports2.BSTooltip = _sfc_main$n;
|
|
4560
|
+
exports2.BlueseaPlugin = BlueseaPlugin;
|
|
4561
|
+
exports2.ContextMenuPluginKey = ContextMenuPluginKey;
|
|
4562
|
+
exports2.SavePointImpl = SavePointImpl;
|
|
4563
|
+
exports2.cancelProvidedSavePoint = cancelProvidedSavePoint;
|
|
4564
|
+
exports2.createContextMenuPlugin = createContextMenuPlugin;
|
|
4565
|
+
exports2.debounce = debounce;
|
|
4566
|
+
exports2.notNull = notNull;
|
|
4567
|
+
exports2.provideFieldContext = provideFieldContext;
|
|
4568
|
+
exports2.provideSavePoint = provideSavePoint;
|
|
4569
|
+
exports2.tryUntil = tryUntil;
|
|
4570
|
+
exports2.useContextMenu = useContextMenu;
|
|
4571
|
+
exports2.useContextMenuOptional = useContextMenuOptional;
|
|
4572
|
+
exports2.useFieldContext = useFieldContext;
|
|
4573
|
+
exports2.useSavePoint = useSavePoint;
|
|
4574
|
+
exports2.vClickOutside = vClickOutside;
|
|
4575
|
+
exports2.vFocusOnLoad = vFocusOnLoad;
|
|
4576
|
+
exports2.vTooltip = vTooltip;
|
|
4577
|
+
exports2.waitDuring = waitDuring;
|
|
4578
|
+
exports2.waitUntil = waitUntil;
|
|
4579
|
+
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
4580
|
+
}));
|