@fkui/vue 5.36.0 → 5.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs.js +17 -17
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/esm/index.esm.js +17 -17
- package/dist/esm/index.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/esm/index.esm.js
CHANGED
|
@@ -47,7 +47,7 @@ isIndex(key,length)))){result.push(key);}}return result;}var _arrayLikeKeys=arra
|
|
|
47
47
|
* 1. Header
|
|
48
48
|
* 2. First interactive element within content
|
|
49
49
|
* 3. Content
|
|
50
|
-
*/resolveFocusElement(){const titleElement=findElementFromVueRef(this.$refs.modalTitle);if(titleElement){return titleElement;}const contentElement=getHTMLElementFromVueRef(this.$refs.modalContent);const tabbableChildren=findTabbableElements(contentElement);const firstTabbableChildElement=tabbableChildren.length?tabbableChildren[0]:void 0;return firstTabbableChildElement!==null&&firstTabbableChildElement!==void 0?firstTabbableChildElement:contentElement;},restoreState(){if(this.savedFocus){var _this$savedScroll;const root2=document.documentElement;root2.classList.remove("modal__open");root2.style.removeProperty("top");root2.scrollTop=(_this$savedScroll=this.savedScroll)!==null&&_this$savedScroll!==void 0?_this$savedScroll:0;popFocus(this.savedFocus);this.savedFocus=null;this.savedScroll=null;}},onFocusFirst(){const tabbableElements=findTabbableElements(this.$refs.modalDialogContainer);const lastTabbableElement=tabbableElements[tabbableElements.length-2];focusElement(lastTabbableElement,this.$el);},onFocusLast(){const tabbableElements=findTabbableElements(this.$refs.modalDialogContainer);const firstTabbableElement=tabbableElements[1];focusElement(firstTabbableElement,this.$el);}}});const _hoisted_1$T=["id"];const _hoisted_2$F={class:"modal__backdrop"};const _hoisted_3$z={class:"modal__inner-container"};const _hoisted_4$t={class:"modal__dialog"};const _hoisted_5$p={class:"modal__dialog-inner"};const _hoisted_6$
|
|
50
|
+
*/resolveFocusElement(){const titleElement=findElementFromVueRef(this.$refs.modalTitle);if(titleElement){return titleElement;}const contentElement=getHTMLElementFromVueRef(this.$refs.modalContent);const tabbableChildren=findTabbableElements(contentElement);const firstTabbableChildElement=tabbableChildren.length?tabbableChildren[0]:void 0;return firstTabbableChildElement!==null&&firstTabbableChildElement!==void 0?firstTabbableChildElement:contentElement;},restoreState(){if(this.savedFocus){var _this$savedScroll;const root2=document.documentElement;root2.classList.remove("modal__open");root2.style.removeProperty("top");root2.scrollTop=(_this$savedScroll=this.savedScroll)!==null&&_this$savedScroll!==void 0?_this$savedScroll:0;popFocus(this.savedFocus);this.savedFocus=null;this.savedScroll=null;}},onFocusFirst(){const tabbableElements=findTabbableElements(this.$refs.modalDialogContainer);const lastTabbableElement=tabbableElements[tabbableElements.length-2];focusElement(lastTabbableElement,this.$el);},onFocusLast(){const tabbableElements=findTabbableElements(this.$refs.modalDialogContainer);const firstTabbableElement=tabbableElements[1];focusElement(firstTabbableElement,this.$el);}}});const _hoisted_1$T=["id"];const _hoisted_2$F={class:"modal__backdrop"};const _hoisted_3$z={class:"modal__inner-container"};const _hoisted_4$t={class:"modal__dialog"};const _hoisted_5$p={class:"modal__dialog-inner"};const _hoisted_6$k={class:"modal__header"};const _hoisted_7$g={key:0,ref:"modalTitle",class:"modal__title",tabindex:"-1"};const _hoisted_8$b={ref:"modalContent",class:"modal__content",tabindex:"-1"};const _hoisted_9$7={class:"modal__footer"};const _hoisted_10$7={class:"modal__shelf"};const _hoisted_11$3=["aria-label"];function _sfc_render$11(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");return _ctx.isOpen?(openBlock(),createElementBlock("div",{key:0,id:_ctx.id,class:normalizeClass(["modal",_ctx.modalClass])},[createElementVNode("div",_hoisted_2$F,[createElementVNode("div",{class:"modal__outer-container scroll-target",tabindex:"-1",role:"dialog","aria-modal":"true",onKeyup:_cache[3]||(_cache[3]=withKeys((...args)=>_ctx.onClose&&_ctx.onClose(...args),["esc"]))},[createElementVNode("div",_hoisted_3$z,[createElementVNode("div",{ref:"modalDialogContainer",class:normalizeClass(["modal__dialog-container",_ctx.containerClasses])},[createElementVNode("div",_hoisted_4$t,[createElementVNode("div",_hoisted_5$p,[createElementVNode("div",_hoisted_6$k,[createElementVNode("div",{tabindex:"0",onFocus:_cache[0]||(_cache[0]=(...args)=>_ctx.onFocusFirst&&_ctx.onFocusFirst(...args))},null,32/* NEED_HYDRATION */),createTextVNode(),_ctx.hasHeaderSlot?(openBlock(),createElementBlock("h1",_hoisted_7$g,[renderSlot(_ctx.$slots,"header")],512/* NEED_PATCH */)):createCommentVNode("v-if",true)]),createTextVNode(),createElementVNode("div",_hoisted_8$b,[renderSlot(_ctx.$slots,"content")],512/* NEED_PATCH */),createTextVNode(),createElementVNode("div",_hoisted_9$7,[renderSlot(_ctx.$slots,"footer")])]),createTextVNode(),createElementVNode("div",_hoisted_10$7,[createElementVNode("button",{type:"button",class:"close-button","aria-label":_ctx.ariaCloseText,onClick:_cache[1]||(_cache[1]=(...args)=>_ctx.onClose&&_ctx.onClose(...args))},[createElementVNode("span",null,toDisplayString(_ctx.$t("fkui.modal.close","Stäng")),1/* TEXT */),createTextVNode(),createVNode(_component_f_icon,{name:"close"})],8,_hoisted_11$3),createTextVNode(),createElementVNode("div",{tabindex:"0",onFocus:_cache[2]||(_cache[2]=(...args)=>_ctx.onFocusLast&&_ctx.onFocusLast(...args))},null,32/* NEED_HYDRATION */)])])],2/* CLASS */)])],32/* NEED_HYDRATION */)])],10,_hoisted_1$T)):createCommentVNode("v-if",true);}const FModal=/* @__PURE__ */_export_sfc(_sfc_main$1b,[["render",_sfc_render$11]]);function prepareButtonList(src,buttonOrder=config.buttonOrder){const list=src.map(it=>{var _it$event,_ref2,_it$reason,_it$type;return{label:it.label,screenreader:it.screenreader,event:(_it$event=it.event)!==null&&_it$event!==void 0?_it$event:"dismiss",reason:(_ref2=(_it$reason=it.reason)!==null&&_it$reason!==void 0?_it$reason:it.event)!==null&&_ref2!==void 0?_ref2:"dismiss",classlist:["button",`button--${(_it$type=it.type)!==null&&_it$type!==void 0?_it$type:"secondary"}`],buttonType:it.submitButton?"submit":"button"};});switch(buttonOrder){case FKUIConfigButtonOrder.LEFT_TO_RIGHT:return list;case FKUIConfigButtonOrder.RIGHT_TO_LEFT:return list.reverse();}}const defaultButtons=[{label:"Primärknapp",event:"confirm",type:"primary"},{label:"Sekundärknapp",event:"dismiss",type:"secondary"}];const _sfc_main$1a=defineComponent({name:"FConfirmModal",components:{FModal},inheritAttrs:true,props:{/**
|
|
51
51
|
* Enable fullscreen mode in mobile.
|
|
52
52
|
*/fullscreen:{type:Boolean,required:false,default:false},/**
|
|
53
53
|
* Prop for opening modal
|
|
@@ -106,7 +106,7 @@ isIndex(key,length)))){result.push(key);}}return result;}var _arrayLikeKeys=arra
|
|
|
106
106
|
* Display bullets in list.
|
|
107
107
|
*/bullets:{type:Boolean,required:false,default:false},/**
|
|
108
108
|
* Optional callback for performing actions before navigation.
|
|
109
|
-
*/beforeNavigate:{type:Function,required:false,default(){return()=>{};}}},computed:{hasTitleSlot(){return hasSlot(this,"title");}},methods:{liClasses(errorItem){const classes=[];if(!this.bullets&&errorItem.id){classes.push("error-list__link");}return classes;},async onClickItem(item){await this.beforeNavigate(item);focusError(item);}}});const _hoisted_1$R={class:"error-list"};const _hoisted_2$D={key:0};const _hoisted_3$x={class:"error-list__list error-list--list-style-none"};const _hoisted_4$s=["onClick"];const _hoisted_5$o=/* @__PURE__ */createElementVNode("span",{class:"error-list__bullet","aria-hidden":"true"},null,-1/* HOISTED */);const _hoisted_6$
|
|
109
|
+
*/beforeNavigate:{type:Function,required:false,default(){return()=>{};}}},computed:{hasTitleSlot(){return hasSlot(this,"title");}},methods:{liClasses(errorItem){const classes=[];if(!this.bullets&&errorItem.id){classes.push("error-list__link");}return classes;},async onClickItem(item){await this.beforeNavigate(item);focusError(item);}}});const _hoisted_1$R={class:"error-list"};const _hoisted_2$D={key:0};const _hoisted_3$x={class:"error-list__list error-list--list-style-none"};const _hoisted_4$s=["onClick"];const _hoisted_5$o=/* @__PURE__ */createElementVNode("span",{class:"error-list__bullet","aria-hidden":"true"},null,-1/* HOISTED */);const _hoisted_6$j={class:"error-list__link"};const _hoisted_7$f=/* @__PURE__ */createElementVNode("span",{class:"error-list__bullet","aria-hidden":"true"},null,-1/* HOISTED */);function _sfc_render$Z(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");const _component_i_flex_item=resolveComponent("i-flex-item");const _component_i_flex=resolveComponent("i-flex");return openBlock(),createElementBlock("div",_hoisted_1$R,[createVNode(_component_i_flex,null,{default:withCtx(()=>[_ctx.hasTitleSlot?(openBlock(),createBlock(_component_i_flex_item,{key:0,shrink:""},{default:withCtx(()=>[createVNode(_component_f_icon,{class:"error-list__icon",name:"error"})]),_:1/* STABLE */})):createCommentVNode("v-if",true),createTextVNode(),_ctx.hasTitleSlot?(openBlock(),createBlock(_component_i_flex_item,{key:1,shrink:""},{default:withCtx(()=>[createTextVNode(" ")]),_:1/* STABLE */})):createCommentVNode("v-if",true),createTextVNode(),createVNode(_component_i_flex_item,{grow:""},{default:withCtx(()=>[_ctx.hasTitleSlot?(openBlock(),createElementBlock("div",_hoisted_2$D,[renderSlot(_ctx.$slots,"title")])):createCommentVNode("v-if",true),createTextVNode(),createElementVNode("ul",_hoisted_3$x,[(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.items,item=>{return openBlock(),createElementBlock("li",{key:item.id,class:normalizeClass(_ctx.liClasses(item))},[item.id?(openBlock(),createElementBlock("a",{key:0,href:"javascript:",onClick:withModifiers($event=>_ctx.onClickItem(item),["prevent"])},[_ctx.bullets?(openBlock(),createElementBlock(Fragment,{key:0},[_hoisted_5$o,createTextVNode(),createElementVNode("span",_hoisted_6$j,toDisplayString(item.title),1/* TEXT */)],64/* STABLE_FRAGMENT */)):(openBlock(),createElementBlock(Fragment,{key:1},[createTextVNode(toDisplayString(item.title),1/* TEXT */)],64/* STABLE_FRAGMENT */))],8,_hoisted_4$s)):(openBlock(),createElementBlock(Fragment,{key:1},[_ctx.bullets?(openBlock(),createElementBlock(Fragment,{key:0},[_hoisted_7$f,createTextVNode(),createElementVNode("span",null,toDisplayString(item.title),1/* TEXT */)],64/* STABLE_FRAGMENT */)):(openBlock(),createElementBlock(Fragment,{key:1},[createTextVNode(toDisplayString(item.title),1/* TEXT */)],64/* STABLE_FRAGMENT */))],64/* STABLE_FRAGMENT */))],2/* CLASS */);}),128/* KEYED_FRAGMENT */))])]),_:3/* FORWARDED */})]),_:3/* FORWARDED */})]);}const FErrorList=/* @__PURE__ */_export_sfc(_sfc_main$17,[["render",_sfc_render$Z]]);function cleanUpElements(vm){return new Promise(resolve=>{window.setTimeout(()=>{Object.keys(vm.components).forEach(id=>{const domElement=vm.$el.querySelector(`#${id}`);if(!domElement){delete vm.components[id];}});resolve();},0);});}function sortComponentsWithErrorsOnDOMOrder(componentList){const errorList=Object.values(componentList).filter(component=>{const validity=component instanceof Reference?component.ref.isValid:component.validityMode;return typeof validity==="boolean"?validity===false:validity==="ERROR";});errorList.sort((a,b)=>{const elementToCompareA=a instanceof Reference?document.querySelector(`#${a.ref.id}`):a.target;const elementToCompareB=b instanceof Reference?document.querySelector(`#${b.ref.id}`):b.target;return documentOrderComparator(elementToCompareA,elementToCompareB);});return errorList;}function isFormStepReference(reference){return"isOpen"in reference.ref;}const _sfc_main$16=defineComponent({name:"FValidationGroup",props:{/**
|
|
110
110
|
* A `GroupValidityEvent` object containing:
|
|
111
111
|
*
|
|
112
112
|
* `isValid`: the aggregated validity of underlying components
|
|
@@ -166,12 +166,12 @@ isIndex(key,length)))){result.push(key);}}return result;}var _arrayLikeKeys=arra
|
|
|
166
166
|
* Min date.
|
|
167
167
|
*/minDate:{type:Object,required:true},/**
|
|
168
168
|
* Max date.
|
|
169
|
-
*/maxDate:{type:Object,required:true}},emits:["change","update:modelValue"],computed:{previousDisabled(){return isInvalidMonth(this.modelValue.addMonths(-1),this.minDate,this.maxDate);},nextDisabled(){return isInvalidMonth(this.modelValue.addMonths(1),this.minDate,this.maxDate);},previousValue(){return this.modelValue.addMonths(-1);},nextValue(){return this.modelValue.addMonths(1);},currentText(){return this.getDateText(this.modelValue);},previousSrText(){return this.$t("fkui.calendar-navbar.previous","Föregående månad");},nextSrText(){return this.$t("fkui.calendar-navbar.next","Nästa månad");},previousIconClasses(){return{"calendar-navbar__icon":true,"calendar-navbar__icon--disabled":this.previousDisabled};},nextIconClasses(){return{"calendar-navbar__icon":true,"calendar-navbar__icon--disabled":this.nextDisabled};}},methods:{onClickPreviousButton(){if(!this.previousDisabled){this.$emit("update:modelValue",this.previousValue);this.$emit("change",this.previousValue);const previousMonth=this.getDateText(this.previousValue);const previousMonthText=this.$t("fkui.calendar-navbar.previous-month","{{ previousMonth }} visas",{previousMonth});alertScreenReader(previousMonthText,{assertive:true});return;}const message=getMessage(this.$t,this.previousValue,this.minDate,this.maxDate);if(message){alertScreenReader(message,{assertive:true});}},onClickNextButton(){if(!this.nextDisabled){this.$emit("update:modelValue",this.nextValue);this.$emit("change",this.nextValue);const nextMonth=this.getDateText(this.nextValue);const nextMonthText=this.$t("fkui.calendar-navbar.next-month","{{ nextMonth }} visas",{nextMonth});alertScreenReader(nextMonthText,{assertive:true});return;}const message=getMessage(this.$t,this.nextValue,this.minDate,this.maxDate);if(message){alertScreenReader(message,{assertive:true});}},getDateText(value){return`${value.monthName} ${value.year}`;},isFocused(ref2){return document.activeElement===this.$refs[ref2];}}});const _hoisted_1$N={class:"calendar-navbar"};const _hoisted_2$z={class:"calendar-navbar__month",tabindex:"-1"};const _hoisted_3$u=["aria-disabled","aria-live"];const _hoisted_4$p={class:"sr-only"};const _hoisted_5$n=["aria-disabled","aria-live"];const _hoisted_6$
|
|
169
|
+
*/maxDate:{type:Object,required:true}},emits:["change","update:modelValue"],computed:{previousDisabled(){return isInvalidMonth(this.modelValue.addMonths(-1),this.minDate,this.maxDate);},nextDisabled(){return isInvalidMonth(this.modelValue.addMonths(1),this.minDate,this.maxDate);},previousValue(){return this.modelValue.addMonths(-1);},nextValue(){return this.modelValue.addMonths(1);},currentText(){return this.getDateText(this.modelValue);},previousSrText(){return this.$t("fkui.calendar-navbar.previous","Föregående månad");},nextSrText(){return this.$t("fkui.calendar-navbar.next","Nästa månad");},previousIconClasses(){return{"calendar-navbar__icon":true,"calendar-navbar__icon--disabled":this.previousDisabled};},nextIconClasses(){return{"calendar-navbar__icon":true,"calendar-navbar__icon--disabled":this.nextDisabled};}},methods:{onClickPreviousButton(){if(!this.previousDisabled){this.$emit("update:modelValue",this.previousValue);this.$emit("change",this.previousValue);const previousMonth=this.getDateText(this.previousValue);const previousMonthText=this.$t("fkui.calendar-navbar.previous-month","{{ previousMonth }} visas",{previousMonth});alertScreenReader(previousMonthText,{assertive:true});return;}const message=getMessage(this.$t,this.previousValue,this.minDate,this.maxDate);if(message){alertScreenReader(message,{assertive:true});}},onClickNextButton(){if(!this.nextDisabled){this.$emit("update:modelValue",this.nextValue);this.$emit("change",this.nextValue);const nextMonth=this.getDateText(this.nextValue);const nextMonthText=this.$t("fkui.calendar-navbar.next-month","{{ nextMonth }} visas",{nextMonth});alertScreenReader(nextMonthText,{assertive:true});return;}const message=getMessage(this.$t,this.nextValue,this.minDate,this.maxDate);if(message){alertScreenReader(message,{assertive:true});}},getDateText(value){return`${value.monthName} ${value.year}`;},isFocused(ref2){return document.activeElement===this.$refs[ref2];}}});const _hoisted_1$N={class:"calendar-navbar"};const _hoisted_2$z={class:"calendar-navbar__month",tabindex:"-1"};const _hoisted_3$u=["aria-disabled","aria-live"];const _hoisted_4$p={class:"sr-only"};const _hoisted_5$n=["aria-disabled","aria-live"];const _hoisted_6$i={class:"sr-only"};function _sfc_render$T(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");return openBlock(),createElementBlock("div",_hoisted_1$N,[createElementVNode("div",_hoisted_2$z,toDisplayString(_ctx.currentText),1/* TEXT */),createTextVNode(),createElementVNode("button",{ref:"previousButton",class:"calendar-navbar__arrow calendar-navbar__arrow--previous",type:"button","aria-disabled":_ctx.previousDisabled,"aria-live":_ctx.isFocused("previousButton")?"polite":"off",onClick:_cache[0]||(_cache[0]=withModifiers((...args)=>_ctx.onClickPreviousButton&&_ctx.onClickPreviousButton(...args),["stop"]))},[createElementVNode("span",_hoisted_4$p,toDisplayString(_ctx.previousSrText),1/* TEXT */),createTextVNode(),createVNode(_component_f_icon,{class:normalizeClass(_ctx.previousIconClasses),name:"arrow-right"},null,8,["class"])],8,_hoisted_3$u),createTextVNode(),createElementVNode("button",{ref:"nextButton",class:"calendar-navbar__arrow calendar-navbar__arrow--next",type:"button","aria-disabled":_ctx.nextDisabled,"aria-live":_ctx.isFocused("nextButton")?"polite":"off",onClick:_cache[1]||(_cache[1]=withModifiers((...args)=>_ctx.onClickNextButton&&_ctx.onClickNextButton(...args),["stop"]))},[createElementVNode("span",_hoisted_6$i,toDisplayString(_ctx.nextSrText),1/* TEXT */),createTextVNode(),createVNode(_component_f_icon,{class:normalizeClass(_ctx.nextIconClasses),name:"arrow-right"},null,8,["class"])],8,_hoisted_5$n)]);}const ICalendarNavbar=/* @__PURE__ */_export_sfc(_sfc_main$11,[["render",_sfc_render$T]]);function getDayStartOffset(days){return days[0].weekDay-1;}function getDayEndOffset(days){return 7-days[days.length-1].weekDay;}const _sfc_main$10=defineComponent({name:"ICalendarMonthGrid",props:{/**
|
|
170
170
|
* Focused month.
|
|
171
171
|
* @model
|
|
172
172
|
*/value:{type:Object,required:true},/**
|
|
173
173
|
* Hide week numbers.
|
|
174
|
-
*/hideWeekNumbers:{type:Boolean,required:false,default:false}},data(){return{weekdays:getWeekdayNamings(),focused:false,resizeObserver:void 0,internalHideWeekNumbers:false,showShortWeekdays:false};},computed:{totalCols(){return this.hideWeekNumbers?7:8;},weeks(){return groupByWeek(this.value.startOfMonth(),this.value.endOfMonth());}},mounted(){this.resizeObserver=new ResizeObserver(debounce(this.onResize,100));this.resizeObserver.observe(this.$el);this.onResize();},unmounted(){if(this.resizeObserver){this.resizeObserver.disconnect();}},methods:{onResize(){const component=this.$el;this.internalHideWeekNumbers=this.hideWeekNumbers||component.offsetWidth<320;this.showShortWeekdays=component.offsetWidth<640;},onFocusin(){this.focused=true;},onFocusout(e){const component=this.$el;const relatedTarget=e.relatedTarget;if(!component.contains(relatedTarget)){this.focused=false;}},getDayStartOffset,getDayEndOffset}});const _hoisted_1$M={key:0,class:"calendar-month__col--week"};const _hoisted_2$y=/* @__PURE__ */createElementVNode("col",{class:"calendar-month__col--day"},null,-1/* HOISTED */);const _hoisted_3$t=/* @__PURE__ */createElementVNode("col",{class:"calendar-month__col--day"},null,-1/* HOISTED */);const _hoisted_4$o=/* @__PURE__ */createElementVNode("col",{class:"calendar-month__col--day"},null,-1/* HOISTED */);const _hoisted_5$m=/* @__PURE__ */createElementVNode("col",{class:"calendar-month__col--day"},null,-1/* HOISTED */);const _hoisted_6$
|
|
174
|
+
*/hideWeekNumbers:{type:Boolean,required:false,default:false}},data(){return{weekdays:getWeekdayNamings(),focused:false,resizeObserver:void 0,internalHideWeekNumbers:false,showShortWeekdays:false};},computed:{totalCols(){return this.hideWeekNumbers?7:8;},weeks(){return groupByWeek(this.value.startOfMonth(),this.value.endOfMonth());}},mounted(){this.resizeObserver=new ResizeObserver(debounce(this.onResize,100));this.resizeObserver.observe(this.$el);this.onResize();},unmounted(){if(this.resizeObserver){this.resizeObserver.disconnect();}},methods:{onResize(){const component=this.$el;this.internalHideWeekNumbers=this.hideWeekNumbers||component.offsetWidth<320;this.showShortWeekdays=component.offsetWidth<640;},onFocusin(){this.focused=true;},onFocusout(e){const component=this.$el;const relatedTarget=e.relatedTarget;if(!component.contains(relatedTarget)){this.focused=false;}},getDayStartOffset,getDayEndOffset}});const _hoisted_1$M={key:0,class:"calendar-month__col--week"};const _hoisted_2$y=/* @__PURE__ */createElementVNode("col",{class:"calendar-month__col--day"},null,-1/* HOISTED */);const _hoisted_3$t=/* @__PURE__ */createElementVNode("col",{class:"calendar-month__col--day"},null,-1/* HOISTED */);const _hoisted_4$o=/* @__PURE__ */createElementVNode("col",{class:"calendar-month__col--day"},null,-1/* HOISTED */);const _hoisted_5$m=/* @__PURE__ */createElementVNode("col",{class:"calendar-month__col--day"},null,-1/* HOISTED */);const _hoisted_6$h=/* @__PURE__ */createElementVNode("col",{class:"calendar-month__col--day"},null,-1/* HOISTED */);const _hoisted_7$e=/* @__PURE__ */createElementVNode("col",{class:"calendar-month__col--day"},null,-1/* HOISTED */);const _hoisted_8$a=/* @__PURE__ */createElementVNode("col",{class:"calendar-month__col--day"},null,-1/* HOISTED */);const _hoisted_9$6={role:"presentation"};const _hoisted_10$6={role:"presentation"};const _hoisted_11$2={key:0,scope:"col","aria-hidden":"true",class:"calendar-month__header-cell"};const _hoisted_12$2=["title"];const _hoisted_13$2={role:"presentation"};const _hoisted_14$2={key:0,class:"calendar-month__cell calendar-month__cell--week-number","aria-hidden":"true"};const _hoisted_15$2=["colspan"];const _hoisted_16$1=["colspan"];const _hoisted_17$1={key:0,"aria-hidden":"true"};const _hoisted_18$1=["colspan"];const _hoisted_19$1={key:1,"aria-hidden":"true"};const _hoisted_20$1=["colspan"];function _sfc_render$S(_ctx,_cache,$props,$setup,$data,$options){return openBlock(),createElementBlock("table",{class:"calendar-month__table",role:"application",onFocusin:_cache[0]||(_cache[0]=(...args)=>_ctx.onFocusin&&_ctx.onFocusin(...args)),onFocusout:_cache[1]||(_cache[1]=(...args)=>_ctx.onFocusout&&_ctx.onFocusout(...args))},[createElementVNode("colgroup",null,[!_ctx.internalHideWeekNumbers?(openBlock(),createElementBlock("col",_hoisted_1$M)):createCommentVNode("v-if",true),createTextVNode(),_hoisted_2$y,createTextVNode(),_hoisted_3$t,createTextVNode(),_hoisted_4$o,createTextVNode(),_hoisted_5$m,createTextVNode(),_hoisted_6$h,createTextVNode(),_hoisted_7$e,createTextVNode(),_hoisted_8$a]),createTextVNode(),createElementVNode("thead",_hoisted_9$6,[createElementVNode("tr",_hoisted_10$6,[!_ctx.internalHideWeekNumbers?(openBlock(),createElementBlock("th",_hoisted_11$2)):createCommentVNode("v-if",true),createTextVNode(),(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.weekdays,weekday=>{return openBlock(),createElementBlock("th",{key:weekday.name,scope:"col",role:"presentation",class:"calendar-month__header-cell"},[createElementVNode("abbr",{"aria-hidden":"true",title:weekday.name},toDisplayString(_ctx.showShortWeekdays?weekday.shortName:weekday.name),9,_hoisted_12$2)]);}),128/* KEYED_FRAGMENT */))])]),createTextVNode(),createElementVNode("tbody",_hoisted_13$2,[(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.weeks,week=>{return openBlock(),createElementBlock("tr",{key:week.week,role:"presentation"},[!_ctx.internalHideWeekNumbers?(openBlock(),createElementBlock("td",_hoisted_14$2,toDisplayString(week.week),1/* TEXT */)):createCommentVNode("v-if",true),createTextVNode(),_ctx.getDayStartOffset(week.days)?(openBlock(),createElementBlock("td",{key:1,class:"calendar-month__cell",colspan:_ctx.getDayStartOffset(week.days),"aria-hidden":"true"},null,8,_hoisted_15$2)):createCommentVNode("v-if",true),createTextVNode(),(openBlock(true),createElementBlock(Fragment,null,renderList(week.days,day=>{return openBlock(),createElementBlock("td",{key:day.toString(),class:"calendar-month__cell",role:"presentation"},[renderSlot(_ctx.$slots,"default",{date:day,focused:_ctx.focused})]);}),128/* KEYED_FRAGMENT */)),createTextVNode(),_ctx.getDayEndOffset(week.days)?(openBlock(),createElementBlock("td",{key:2,class:"calendar-month__cell",colspan:_ctx.getDayEndOffset(week.days),"aria-hidden":"true"},null,8,_hoisted_16$1)):createCommentVNode("v-if",true)]);}),128/* KEYED_FRAGMENT */)),createTextVNode(),_ctx.weeks.length<5?(openBlock(),createElementBlock("tr",_hoisted_17$1,[createElementVNode("td",{class:"calendar-month__cell",colspan:_ctx.totalCols,"aria-hidden":"true"},null,8,_hoisted_18$1)])):createCommentVNode("v-if",true),createTextVNode(),_ctx.weeks.length<6?(openBlock(),createElementBlock("tr",_hoisted_19$1,[createElementVNode("td",{class:"calendar-month__cell",colspan:_ctx.totalCols,"aria-hidden":"true"},null,8,_hoisted_20$1)])):createCommentVNode("v-if",true)])],32/* NEED_HYDRATION */);}const ICalendarMonthGrid=/* @__PURE__ */_export_sfc(_sfc_main$10,[["render",_sfc_render$S]]);const DayStep={ArrowRight:1,ArrowLeft:-1,ArrowUp:-7,ArrowDown:7};function isDayStepKey(e){return Object.keys(DayStep).includes(e.code);}function getDayStep(keyBoardEvent){return DayStep[keyBoardEvent.code];}function isSameMonth(a,b){return a.startOfMonth().equals(b.startOfMonth());}function getDayTabindex(date,active,entry){const ref2=active!==null&&active!==void 0?active:entry;if(ref2&&isSameMonth(ref2,date)){return date.equals(ref2)?0:-1;}else{return date.day===1?0:-1;}}const _sfc_main$$=defineComponent({name:"ICalendarMonth",components:{ICalendarMonthGrid},mixins:[TranslationMixin],props:{/**
|
|
175
175
|
* Active month.
|
|
176
176
|
* @model
|
|
177
177
|
*/modelValue:{type:Object,required:true},/**
|
|
@@ -250,7 +250,7 @@ isIndex(key,length)))){result.push(key);}}return result;}var _arrayLikeKeys=arra
|
|
|
250
250
|
/* include undefined (see comment on line above) */modelValue:{type:anyType$1,required:false},/**
|
|
251
251
|
* The value for the input.
|
|
252
252
|
*/value:{type:anyType$1,required:true}},emits:["change","update:modelValue"],setup(){return{showDetails:inject("showDetails","never"),getFieldsetLabelText:inject("getFieldsetLabelText",()=>"")};},data(){return{expanded:false,height:0,initialStyle:{overflow:"hidden",transition:"height 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96)"},hiddenStyle:{height:"auto",position:"absolute",visibility:"hidden"},visibleStyle:{width:"",position:"",visibility:"",height:"0px"},openedStyle:{height:"auto"}};},computed:{attrs(){let checked;if(Array.isArray(this.modelValue)){checked=this.modelValue.findIndex(it=>isEqual$2(toValue(it),toValue(this.value)))>=0;}else{checked=this.value===this.modelValue;}return{...this.$attrs,value:this.value,checked,onChange:event=>{if(event.target instanceof HTMLInputElement){this.emitVModelEvent(event);}},onInput:event=>{event.target.focus();}};},disabledClass(){return this.disabled?"disabled":"";},// eslint-disable-next-line @typescript-eslint/no-explicit-any -- technical debt, nore sure whats going on here
|
|
253
|
-
injected(){return this;}},methods:{updateExpandedFlag(){const checkboxInput=getHTMLElementFromVueRef(this.$refs["checkboxInput"]);this.expanded=checkboxInput.checked;},emitVModelEvent(event){let newModel;if(Array.isArray(this.modelValue)){newModel=[...this.modelValue].filter(it=>!isEqual$2(toValue(it),toValue(this.value)));if(this.modelValue.length<=newModel.length){newModel.push(this.value);}}else{if(this.value===this.modelValue){newModel=typeof this.value==="boolean"?false:void 0;}else{const target=event.target;newModel=target.value==="true"?true:this.value;}}this.$emit("update:modelValue",newModel);this.$emit("change",newModel);},onKeydown(event){event.stopPropagation();},onValidity({detail}){if(detail.target!==this.$el.querySelector("input")){return;}let errorMessage="";if(hasSlot(this,"default")){const labelText=this.injected.getFieldsetLabelText();if(labelText){errorMessage=`${labelText} ${renderSlotText(this.$slots.default)}`;}else{errorMessage=`${renderSlotText(this.$slots.default)}`;}}const element=this.$el.querySelector(`#${detail.elementId}`);if(element){dispatchComponentValidityEvent(element,{...detail,errorMessage,focusElementId:detail.elementId});}},enter(element){const htmlElement=getHTMLElementFromVueRef(element);const computedStyle=getComputedStyle(element);Object.assign(htmlElement.style,this.initialStyle);Object.assign(htmlElement.style,this.hiddenStyle);htmlElement.style.width=computedStyle.width;const height=computedStyle.height;Object.assign(htmlElement.style,this.visibleStyle);getComputedStyle(element).height;setTimeout(()=>{this.height=parseInt(height,10);htmlElement.style.height=height;});},afterEnter(element){const htmlElement=getHTMLElementFromVueRef(element);Object.assign(htmlElement.style,this.openedStyle);},leave(element){const htmlElement=getHTMLElementFromVueRef(element);const height=getComputedStyle(element).height;htmlElement.style.height=height;getComputedStyle(element).height;setTimeout(()=>{Object.assign(htmlElement.style,this.visibleStyle);});}}});const _hoisted_1$H=["id","disabled"];const _hoisted_2$v=["for"];const _hoisted_3$r={key:0,class:"checkbox__details"};const _hoisted_4$m=/* @__PURE__ */createElementVNode("br",null,null,-1/* HOISTED */);const _hoisted_5$k={key:0,class:"checkbox__details"};const _hoisted_6$
|
|
253
|
+
injected(){return this;}},methods:{updateExpandedFlag(){const checkboxInput=getHTMLElementFromVueRef(this.$refs["checkboxInput"]);this.expanded=checkboxInput.checked;},emitVModelEvent(event){let newModel;if(Array.isArray(this.modelValue)){newModel=[...this.modelValue].filter(it=>!isEqual$2(toValue(it),toValue(this.value)));if(this.modelValue.length<=newModel.length){newModel.push(this.value);}}else{if(this.value===this.modelValue){newModel=typeof this.value==="boolean"?false:void 0;}else{const target=event.target;newModel=target.value==="true"?true:this.value;}}this.$emit("update:modelValue",newModel);this.$emit("change",newModel);},onKeydown(event){event.stopPropagation();},onValidity({detail}){if(detail.target!==this.$el.querySelector("input")){return;}let errorMessage="";if(hasSlot(this,"default")){const labelText=this.injected.getFieldsetLabelText();if(labelText){errorMessage=`${labelText} ${renderSlotText(this.$slots.default)}`;}else{errorMessage=`${renderSlotText(this.$slots.default)}`;}}const element=this.$el.querySelector(`#${detail.elementId}`);if(element){dispatchComponentValidityEvent(element,{...detail,errorMessage,focusElementId:detail.elementId});}},enter(element){const htmlElement=getHTMLElementFromVueRef(element);const computedStyle=getComputedStyle(element);Object.assign(htmlElement.style,this.initialStyle);Object.assign(htmlElement.style,this.hiddenStyle);htmlElement.style.width=computedStyle.width;const height=computedStyle.height;Object.assign(htmlElement.style,this.visibleStyle);getComputedStyle(element).height;setTimeout(()=>{this.height=parseInt(height,10);htmlElement.style.height=height;});},afterEnter(element){const htmlElement=getHTMLElementFromVueRef(element);Object.assign(htmlElement.style,this.openedStyle);},leave(element){const htmlElement=getHTMLElementFromVueRef(element);const height=getComputedStyle(element).height;htmlElement.style.height=height;getComputedStyle(element).height;setTimeout(()=>{Object.assign(htmlElement.style,this.visibleStyle);});}}});const _hoisted_1$H=["id","disabled"];const _hoisted_2$v=["for"];const _hoisted_3$r={key:0,class:"checkbox__details"};const _hoisted_4$m=/* @__PURE__ */createElementVNode("br",null,null,-1/* HOISTED */);const _hoisted_5$k={key:0,class:"checkbox__details"};const _hoisted_6$g=/* @__PURE__ */createElementVNode("br",null,null,-1/* HOISTED */);function _sfc_render$M(_ctx,_cache,$props,$setup,$data,$options){return openBlock(),createElementBlock("div",{class:normalizeClass(["checkbox",_ctx.disabledClass]),onValidity:_cache[2]||(_cache[2]=(...args)=>_ctx.onValidity&&_ctx.onValidity(...args))},[createElementVNode("input",mergeProps({id:_ctx.id},_ctx.attrs,{ref:"checkboxInput",type:"checkbox",class:"checkbox__input",disabled:_ctx.disabled,onKeydown:_cache[0]||(_cache[0]=withKeys((...args)=>_ctx.onKeydown&&_ctx.onKeydown(...args),["space"])),onChange:_cache[1]||(_cache[1]=$event=>_ctx.updateExpandedFlag())}),null,16,_hoisted_1$H),createTextVNode(),createElementVNode("label",{class:normalizeClass(_ctx.$slots.details?"checkbox__label checkbox__width":"checkbox__label"),for:_ctx.id},[renderSlot(_ctx.$slots,"default"),createTextVNode(),_ctx.$slots.details?(openBlock(),createElementBlock(Fragment,{key:0},[_ctx.showDetails==="always"?(openBlock(),createElementBlock("span",_hoisted_3$r,[_hoisted_4$m,createTextVNode(),renderSlot(_ctx.$slots,"details")])):createCommentVNode("v-if",true),createTextVNode(),_ctx.showDetails==="when-selected"?(openBlock(),createBlock(Transition,{key:1,onEnter:_ctx.enter,onAfterEnter:_ctx.afterEnter,onLeave:_ctx.leave},{default:withCtx(()=>[_ctx.expanded?(openBlock(),createElementBlock("span",_hoisted_5$k,[_hoisted_6$g,createTextVNode(),renderSlot(_ctx.$slots,"details",{height:_ctx.height})])):createCommentVNode("v-if",true)]),_:3/* FORWARDED */},8,["onEnter","onAfterEnter","onLeave"])):createCommentVNode("v-if",true)],64/* STABLE_FRAGMENT */)):createCommentVNode("v-if",true)],10,_hoisted_2$v)],34/* CLASS, NEED_HYDRATION */);}const FCheckboxField=/* @__PURE__ */_export_sfc(_sfc_main$W,[["render",_sfc_render$M]]);const getFieldsetLabelText=Symbol("getFieldsetLabelText");function*labelClasses(options){const{labelClass}=options;yield"fieldset__label";yield labelClass;}function*contentClasses(options){const{hasRadiobutton,hasCheckbox,contentClass}=options;yield"fieldset__content";if(hasRadiobutton){yield"radio-button-group__content";}if(hasCheckbox){yield"checkbox-group__content";}yield contentClass;}const _sfc_main$V=defineComponent({name:"FFieldset",components:{FIcon},mixins:[TranslationMixin],provide(){return{[getFieldsetLabelText]:()=>{return renderSlotText(this.$slots.label);},sharedName:this.name,showDetails:this.showDetails};},props:{/**
|
|
254
254
|
* The id for the fieldset id attribute.
|
|
255
255
|
* If the prop is not set a random value will be generated.
|
|
256
256
|
*/id:{type:String,required:false,default:()=>ElementIdService.generateElementId()},/**
|
|
@@ -277,7 +277,7 @@ injected(){return this;}},methods:{updateExpandedFlag(){const checkboxInput=getH
|
|
|
277
277
|
*/showDetails:{type:String,default:"never",validator(value){return["never","when-selected","always"].includes(value);}}},data(){return{validity:{validityMode:"INITIAL"},descriptionClass:["label__description"],discreteDescriptionClass:["label__description","label__description--discrete"],validityElement:null,dispatchObject:{},detail:{},hasDocumentListener:false,legendKey:1,oldMessage:"",children:new Array(),hasCheckbox:false,hasRadiobutton:false};},computed:{hasError(){return this.validity.validityMode==="ERROR";},hasErrorMessageSlot(){return hasSlot(this,"error-message");},hasTooltipSlot(){return Boolean(this.$slots.tooltip);},hasDescriptionSlot(){return hasSlot(this,"description");},legendClass(){return this.hasTooltipSlot?["sr-only"]:this.groupLabelClass;},groupLabelClass(){return Array.from(labelClasses(this));},groupContentClass(){return Array.from(contentClasses(this));},classes(){const{hasRadiobutton,hasCheckbox,horizontal,chip,border}=this;return{"radio-button-group":hasRadiobutton,"radio-button-group--chip":chip&&hasRadiobutton,"radio-button-group--horizontal":horizontal&&hasRadiobutton,"radio-button-group--border":border&&hasRadiobutton,"checkbox-group":hasCheckbox,"checkbox-group--chip":chip&&hasCheckbox,"checkbox-group--horizontal":horizontal&&hasCheckbox,"checkbox-group--border":border&&hasCheckbox};},checkedChildren(){return this.children.filter(child=>child.checked);},debouncedUpdateChildren(){return debounce(this.updateCheckboxChildren.bind(this),150);},checkboxCheckedScreenReaderText(){return this.checkedChildren.length===1?this.$t("fkui.checkbox-group.checkbox.checked","Kryssruta kryssad"):this.$t("fkui.checkbox-group.checkbox.not.checked","Kryssruta ej kryssad");},numberOfCheckboxesScreenReaderText(){return this.$t("fkui.checkbox-group.count","Grupp med {{ count }} kryssrutor",{count:String(this.children.length)});},numberOfCheckedCheckboxesScreenText(){return this.$t("fkui.checkbox-group.checked","{{ checked }} kryssad av {{ count }}",{checked:String(this.checkedChildren.length),count:String(this.children.length)});}},async mounted(){await this.$nextTick();const types=Array.from(this.$el.querySelectorAll(`input[type="checkbox"], input[type="radio"]`),it=>it.getAttribute("type"));this.hasCheckbox=types.includes("checkbox");this.hasRadiobutton=types.includes("radio");if(this.hasCheckbox){this.updateCheckboxChildren();}},updated(){if(this.hasCheckbox){this.debouncedUpdateChildren();}},methods:{async onValidity({detail}){var _renderSlotText2;if(detail.target!==this.$el){return;}this.detail=detail;await this.$nextTick();const errorMessage=(_renderSlotText2=renderSlotText(this.$slots.label))!==null&&_renderSlotText2!==void 0?_renderSlotText2:"";const firstFocusableElement=this.$el.querySelector("input:not(disabled), select:not(disabled), textarea:not(disabled)");const focusElementId=firstFocusableElement?firstFocusableElement.id:this.id;this.validityElement=this.$el;this.dispatchObject={...detail,errorMessage,focusElementId};this.validity=this.detail;if(this.validityElement){dispatchComponentValidityEvent(this.validityElement,this.dispatchObject);}const message=detail.validityMode==="INITIAL"?"":detail.validationMessage;if(message!==this.oldMessage){this.forceLegendUpdate();this.oldMessage=message;}},/**
|
|
278
278
|
* Workaround for NVDA-bug. Force re rendering of legend element due to NVDA not recognizing innerHTML changes.
|
|
279
279
|
* NVDA has closed the bug as it is related to the browser (works in FF): https://github.com/nvaccess/nvda/issues/13162
|
|
280
|
-
*/forceLegendUpdate(){this.legendKey++;},async updateCheckboxChildren(){await this.$nextTick();this.children=Array.from(this.$el.querySelectorAll('input[type="checkbox"]'));}}});const _hoisted_1$G=["id"];const _hoisted_2$u={key:0,class:"sr-only"};const _hoisted_3$q={key:0,class:"label__message label__message--error"};const _hoisted_4$l={key:0,"data-test":"checked-boxes",class:"sr-only","aria-live":"polite"};const _hoisted_5$j={key:0};const _hoisted_6$
|
|
280
|
+
*/forceLegendUpdate(){this.legendKey++;},async updateCheckboxChildren(){await this.$nextTick();this.children=Array.from(this.$el.querySelectorAll('input[type="checkbox"]'));}}});const _hoisted_1$G=["id"];const _hoisted_2$u={key:0,class:"sr-only"};const _hoisted_3$q={key:0,class:"label__message label__message--error"};const _hoisted_4$l={key:0,"data-test":"checked-boxes",class:"sr-only","aria-live":"polite"};const _hoisted_5$j={key:0};const _hoisted_6$f={key:1};const _hoisted_7$d={class:"sr-separator"};const _hoisted_8$9={class:"tooltip-before","aria-hidden":"true"};const _hoisted_9$5={class:"label tooltip-before__label"};const _hoisted_10$5={key:0,class:"label__message label__message--error"};function _sfc_render$L(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");return openBlock(),createElementBlock("fieldset",{id:_ctx.id,class:normalizeClass(["fieldset",_ctx.classes]),onValidity:_cache[0]||(_cache[0]=(...args)=>_ctx.onValidity&&_ctx.onValidity(...args))},[(openBlock(),createElementBlock("legend",{key:_ctx.legendKey,class:normalizeClass(["label",_ctx.legendClass])},[renderSlot(_ctx.$slots,"label"),createTextVNode(),_ctx.hasCheckbox&&_ctx.children.length>1?(openBlock(),createElementBlock("span",_hoisted_2$u,[createElementVNode("span",null,toDisplayString(_ctx.numberOfCheckboxesScreenReaderText),1/* TEXT */)])):createCommentVNode("v-if",true),createTextVNode(),renderSlot(_ctx.$slots,"description",normalizeProps(guardReactiveProps({descriptionClass:_ctx.descriptionClass,discreteDescriptionClass:_ctx.discreteDescriptionClass}))),createTextVNode(),renderSlot(_ctx.$slots,"error-message",normalizeProps(guardReactiveProps({hasError:_ctx.hasError,validationMessage:_ctx.validity.validationMessage})),()=>[_ctx.hasError?(openBlock(),createElementBlock("span",_hoisted_3$q,[createVNode(_component_f_icon,{class:"label__icon--left",name:"error"}),createTextVNode(" "+toDisplayString(_ctx.validity.validationMessage),1/* TEXT */)])):createCommentVNode("v-if",true)])],2/* CLASS */)),createTextVNode(),_ctx.hasCheckbox?(openBlock(),createElementBlock("span",_hoisted_4$l,[_ctx.children.length===1?(openBlock(),createElementBlock("span",_hoisted_5$j,toDisplayString(_ctx.checkboxCheckedScreenReaderText),1/* TEXT */)):(openBlock(),createElementBlock("span",_hoisted_6$f,toDisplayString(_ctx.numberOfCheckedCheckboxesScreenText),1/* TEXT */))])):createCommentVNode("v-if",true),createTextVNode(),_ctx.hasTooltipSlot?(openBlock(),createElementBlock(Fragment,{key:1},[createElementVNode("div",_hoisted_7$d,[createElementVNode("div",_hoisted_8$9,[createElementVNode("div",_hoisted_9$5,[renderSlot(_ctx.$slots,"label")])]),createTextVNode(),renderSlot(_ctx.$slots,"tooltip")]),createTextVNode(),_ctx.hasDescriptionSlot||_ctx.hasErrorMessageSlot||_ctx.hasError?(openBlock(),createElementBlock("div",{key:0,class:normalizeClass(["label",_ctx.groupLabelClass]),"aria-hidden":"true"},[renderSlot(_ctx.$slots,"description",normalizeProps(guardReactiveProps({descriptionClass:_ctx.descriptionClass,discreteDescriptionClass:_ctx.discreteDescriptionClass}))),createTextVNode(),renderSlot(_ctx.$slots,"error-message",normalizeProps(guardReactiveProps({hasError:_ctx.hasError,validationMessage:_ctx.validity.validationMessage})),()=>[_ctx.hasError?(openBlock(),createElementBlock("span",_hoisted_10$5,[createVNode(_component_f_icon,{class:"label__icon--left",name:"error"}),createTextVNode(" "+toDisplayString(_ctx.validity.validationMessage),1/* TEXT */)])):createCommentVNode("v-if",true)])],2/* CLASS */)):createCommentVNode("v-if",true)],64/* STABLE_FRAGMENT */)):createCommentVNode("v-if",true),createTextVNode(),createElementVNode("div",{class:normalizeClass(_ctx.groupContentClass)},[renderSlot(_ctx.$slots,"default")],2/* CLASS */)],42,_hoisted_1$G);}const FFieldset=/* @__PURE__ */_export_sfc(_sfc_main$V,[["render",_sfc_render$L]]);const _sfc_main$U=defineComponent({name:"FCheckboxGroup",components:{FFieldset},mixins:[TranslationMixin],inheritAttrs:false,props:{/**
|
|
281
281
|
* The id for the fieldset id attribute.
|
|
282
282
|
* If the prop is not set the id will be generated.
|
|
283
283
|
*/id:{type:String,required:false,default:()=>ElementIdService.generateElementId()},/**
|
|
@@ -343,7 +343,7 @@ injected(){return this;}},methods:{updateExpandedFlag(){const checkboxInput=getH
|
|
|
343
343
|
* - `"action"`: buttons to perform actions on row
|
|
344
344
|
*/type:{type:String,required:false,default:FTableColumnType.TEXT,validator(value){return isTableColumnType(value);}}},setup(){return FTableInjected();},computed:{classes(){return["table__column",`table__column--${this.type}`];},scope(){return this.rowHeader?"row":null;},tagName(){if(this.rowHeader){return"th";}else{return"td";}}},watch:{visible:{handler:function(){this.setVisibilityColumn(this.name,this.visible);}}},created(){if(this.shrink&&this.expand){throw new Error("Table cannot have both shrink and expand enabled at the same time");}const size=this.shrink?FTableColumnSize.SHRINK:FTableColumnSize.EXPAND;this.addColumn({name:this.name,title:this.title,description:this.description||void 0,id:ElementIdService.generateElementId("column"),size,type:this.type,visible:this.visible,sortable:false,sort:FTableColumnSort.UNSORTED});}});const _hoisted_1$D=/* @__PURE__ */createElementVNode("span",{class:"sr-only"}," ",-1/* HOISTED */);function _sfc_render$H(_ctx,_cache,$props,$setup,$data,$options){return _ctx.visible?(openBlock(),createBlock(resolveDynamicComponent(_ctx.tagName),mergeProps({key:0,class:_ctx.classes,scope:_ctx.scope},_ctx.$attrs),{default:withCtx(()=>[renderSlot(_ctx.$slots,"default"),createTextVNode(),_hoisted_1$D]),_:3/* FORWARDED */},16,["class","scope"])):createCommentVNode("v-if",true);}const FTableColumn=/* @__PURE__ */_export_sfc(_sfc_main$R,[["render",_sfc_render$H]]);function FSortFilterDatasetInjected(){return{sort:inject("sort",()=>void 0),registerCallbackOnSort:inject("registerCallbackOnSort",()=>void 0),registerCallbackOnMount:inject("registerCallbackOnMount",()=>void 0)};}const _sfc_main$Q=defineComponent({name:"FLabel",components:{FIcon},props:{/**
|
|
345
345
|
* The id for the form element the label is bound to.
|
|
346
|
-
*/for:{type:String,required:false,default:void 0}},data(){return{descriptionClass:["label__description"],discreteDescriptionClass:["label__description","label__description--discrete"]};},computed:{forProperty(){return this.for;},hasDefaultSlot(){return hasSlot(this,"default");},hasErrorMessageSlot(){return hasSlot(this,"error-message");},hasDescriptionSlot(){return hasSlot(this,"description");}}});const _hoisted_1$C={key:0};const _hoisted_2$s={key:0,class:"tooltip-before"};const _hoisted_3$p=["for"];const _hoisted_4$k=["for"];const _hoisted_5$i={key:0,class:"label__message label__message--error"};const _hoisted_6$
|
|
346
|
+
*/for:{type:String,required:false,default:void 0}},data(){return{descriptionClass:["label__description"],discreteDescriptionClass:["label__description","label__description--discrete"]};},computed:{forProperty(){return this.for;},hasDefaultSlot(){return hasSlot(this,"default");},hasErrorMessageSlot(){return hasSlot(this,"error-message");},hasDescriptionSlot(){return hasSlot(this,"description");}}});const _hoisted_1$C={key:0};const _hoisted_2$s={key:0,class:"tooltip-before"};const _hoisted_3$p=["for"];const _hoisted_4$k=["for"];const _hoisted_5$i={key:0,class:"label__message label__message--error"};const _hoisted_6$e=["for"];const _hoisted_7$c={key:0,class:"label__message label__message--error"};function _sfc_render$G(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");return _ctx.$slots.tooltip?(openBlock(),createElementBlock("div",_hoisted_1$C,[_ctx.hasDefaultSlot?(openBlock(),createElementBlock("div",_hoisted_2$s,[createElementVNode("label",{class:"label tooltip-before__label",for:_ctx.forProperty},[renderSlot(_ctx.$slots,"default")],8,_hoisted_3$p)])):createCommentVNode("v-if",true),createTextVNode(),renderSlot(_ctx.$slots,"tooltip"),createTextVNode(),_ctx.hasDescriptionSlot||_ctx.hasErrorMessageSlot?(openBlock(),createElementBlock("label",{key:1,class:"label sr-separator",for:_ctx.forProperty},[renderSlot(_ctx.$slots,"description",normalizeProps(guardReactiveProps({descriptionClass:_ctx.descriptionClass,discreteDescriptionClass:_ctx.discreteDescriptionClass}))),createTextVNode(),_ctx.hasErrorMessageSlot?(openBlock(),createElementBlock("span",_hoisted_5$i,[createVNode(_component_f_icon,{class:"label__icon--left",name:"error"}),createTextVNode(),renderSlot(_ctx.$slots,"error-message")])):createCommentVNode("v-if",true)],8,_hoisted_4$k)):createCommentVNode("v-if",true)])):(openBlock(),createElementBlock("label",{key:1,class:"label",for:_ctx.forProperty},[renderSlot(_ctx.$slots,"default"),createTextVNode(),renderSlot(_ctx.$slots,"description",normalizeProps(guardReactiveProps({descriptionClass:_ctx.descriptionClass,discreteDescriptionClass:_ctx.discreteDescriptionClass}))),createTextVNode(),_ctx.hasErrorMessageSlot?(openBlock(),createElementBlock("span",_hoisted_7$c,[createVNode(_component_f_icon,{class:"label__icon--left",name:"error"}),createTextVNode(),renderSlot(_ctx.$slots,"error-message")])):createCommentVNode("v-if",true)],8,_hoisted_6$e));}const FLabel=/* @__PURE__ */_export_sfc(_sfc_main$Q,[["render",_sfc_render$G]]);function resolveWidthClass$1(words,inline){return inline?void 0:words.split(" ").map(word=>`i-width-${word}`).join(" ");}const _sfc_main$P=defineComponent({name:"FSelectField",components:{FIcon,FLabel},inheritAttrs:false,props:{/**
|
|
347
347
|
* The id for the select id attribute.
|
|
348
348
|
* The id for the label for attribute.
|
|
349
349
|
* If the prop is not set a random value will be generated.
|
|
@@ -417,7 +417,7 @@ type:Function,required:false,default:void 0},/**
|
|
|
417
417
|
* input-width="md-6 lg-3"
|
|
418
418
|
* ```
|
|
419
419
|
*/inputWidth:{type:String,required:false,default:"sm-12"}},emits:["blur","change","update","update:modelValue"],setup(){return{textFieldTableMode:inject("textFieldTableMode",false)};},data(){return{showErrorPopup:false,viewValue:"",lastModelValue:"",validationMessage:"",validityMode:"INITIAL",// internal default texts possible to override when extending component
|
|
420
|
-
defaultText:"",descriptionText:"",descriptionScreenReaderText:"",discreteDescriptionText:"",discreteDescriptionScreenReaderText:""};},computed:{showPopupError(){return this.textFieldTableMode&&this.hasError&&this.showErrorPopup;},labelClass(){return this.textFieldTableMode?"sr-only":"";},isValid(){return this.validityMode==="VALID";},hasError(){return this.validityMode==="ERROR";},rootClass(){return{"text-field--error":this.hasError,"text-field--inline":this.inline,"text-field--table":this.textFieldTableMode};},labelWrapperClass(){return resolveWidthClass(this.labelWidth,this.inline);},inputWrapperClass(){return resolveWidthClass(this.inputWidth,this.inline);},isModelUpdatedProgrammatically(){return this.lastModelValue!==this.modelValue;}},watch:{modelValue:{immediate:true,handler:function(){if(this.modelValue===void 0||this.modelValue===null){this.viewValue="";return;}if(!this.isModelUpdatedProgrammatically){return;}this.setViewValueToFormattedValueOrFallbackToValue();this.lastModelValue=this.modelValue;}}},methods:{getErrorPopupAnchor(){return this.$refs.input;},closePopupError(){this.showErrorPopup=false;},async onChange(){if(!this.$refs.input.hasAttribute("data-validation")){this.$emit("update:modelValue",this.viewValue);this.$emit("update",this.viewValue);await this.$nextTick();this.$emit("change",this.viewValue);}},onFocus(){this.showErrorPopup=true;},async onBlur(){this.showErrorPopup=false;if(!this.$refs.input){return;}if(!this.$refs.input.hasAttribute("data-validation")){this.$emit("update:modelValue",this.viewValue);this.$emit("update",this.viewValue);await this.$nextTick();this.$emit("blur",this.viewValue);}},async onValidity({detail}){this.validationMessage=detail.validationMessage;this.validityMode=detail.validityMode;if(detail.nativeEvent==="change"||detail.nativeEvent==="blur"){let newModelValue;if(detail.isValid){newModelValue=this.resolveNewModelValue(this.viewValue);}else{newModelValue=this.viewValue;}this.lastModelValue=newModelValue;this.$emit("update:modelValue",newModelValue);this.$emit("update",newModelValue);await this.$nextTick();this.$emit(detail.nativeEvent,newModelValue);if(detail.isValid){this.syncViewValueAfterModelUpdate(newModelValue);}}this.triggerComponentValidityEvent(detail);},onPendingValidity(){this.validityMode="INITIAL";},resolveNewModelValue(viewValue){const trimmedViewValue=viewValue.trim();if(trimmedViewValue===""){return"";}else if(isSet(this.parser)){var _this$parser;return(_this$parser=this.parser(trimmedViewValue))!==null&&_this$parser!==void 0?_this$parser:trimmedViewValue;}else if(isSet(this.formatter)){var _this$formatter;return(_this$formatter=this.formatter(trimmedViewValue))!==null&&_this$formatter!==void 0?_this$formatter:trimmedViewValue;}else{return trimmedViewValue;}},syncViewValueAfterModelUpdate(newModelValue){if(newModelValue===""){this.viewValue="";}else if(isSet(this.parser)){if(isSet(this.formatter)){this.viewValue=String(this.formatter(newModelValue)||this.viewValue);}}else{this.viewValue=String(newModelValue);}},triggerComponentValidityEvent(validityEvent){var _renderSlotText4;const errorMessage=(_renderSlotText4=renderSlotText(this.$slots.default,{},{stripClasses:[]}))!==null&&_renderSlotText4!==void 0?_renderSlotText4:this.defaultText;const element=this.$el.querySelector(`#${validityEvent.elementId}`);if(element){dispatchComponentValidityEvent(element,{...validityEvent,errorMessage,focusElementId:validityEvent.elementId});}},setViewValueToFormattedValueOrFallbackToValue(){if(!isSet(this.formatter)){this.viewValue=String(this.modelValue);return;}const parsedValue=isSet(this.parser)&&typeof this.modelValue==="string"?this.parser(this.modelValue):this.modelValue;const formattedValue=isSet(parsedValue)?this.formatter(parsedValue):void 0;this.viewValue=isSet(formattedValue)?formattedValue:String(this.modelValue);}}});const _hoisted_1$z={key:0};const _hoisted_2$r={key:0,class:"sr-only"};const _hoisted_3$o={key:0,class:"sr-only"};const _hoisted_4$j={class:"text-field__icon-wrapper"};const _hoisted_5$h=["id","type"];const _hoisted_6$
|
|
420
|
+
defaultText:"",descriptionText:"",descriptionScreenReaderText:"",discreteDescriptionText:"",discreteDescriptionScreenReaderText:""};},computed:{showPopupError(){return this.textFieldTableMode&&this.hasError&&this.showErrorPopup;},labelClass(){return this.textFieldTableMode?"sr-only":"";},isValid(){return this.validityMode==="VALID";},hasError(){return this.validityMode==="ERROR";},rootClass(){return{"text-field--error":this.hasError,"text-field--inline":this.inline,"text-field--table":this.textFieldTableMode};},labelWrapperClass(){return resolveWidthClass(this.labelWidth,this.inline);},inputWrapperClass(){return resolveWidthClass(this.inputWidth,this.inline);},isModelUpdatedProgrammatically(){return this.lastModelValue!==this.modelValue;}},watch:{modelValue:{immediate:true,handler:function(){if(this.modelValue===void 0||this.modelValue===null){this.viewValue="";return;}if(!this.isModelUpdatedProgrammatically){return;}this.setViewValueToFormattedValueOrFallbackToValue();this.lastModelValue=this.modelValue;}}},methods:{getErrorPopupAnchor(){return this.$refs.input;},closePopupError(){this.showErrorPopup=false;},async onChange(){if(!this.$refs.input.hasAttribute("data-validation")){this.$emit("update:modelValue",this.viewValue);this.$emit("update",this.viewValue);await this.$nextTick();this.$emit("change",this.viewValue);}},onFocus(){this.showErrorPopup=true;},async onBlur(){this.showErrorPopup=false;if(!this.$refs.input){return;}if(!this.$refs.input.hasAttribute("data-validation")){this.$emit("update:modelValue",this.viewValue);this.$emit("update",this.viewValue);await this.$nextTick();this.$emit("blur",this.viewValue);}},async onValidity({detail}){this.validationMessage=detail.validationMessage;this.validityMode=detail.validityMode;if(detail.nativeEvent==="change"||detail.nativeEvent==="blur"){let newModelValue;if(detail.isValid){newModelValue=this.resolveNewModelValue(this.viewValue);}else{newModelValue=this.viewValue;}this.lastModelValue=newModelValue;this.$emit("update:modelValue",newModelValue);this.$emit("update",newModelValue);await this.$nextTick();this.$emit(detail.nativeEvent,newModelValue);if(detail.isValid){this.syncViewValueAfterModelUpdate(newModelValue);}}this.triggerComponentValidityEvent(detail);},onPendingValidity(){this.validityMode="INITIAL";},resolveNewModelValue(viewValue){const trimmedViewValue=viewValue.trim();if(trimmedViewValue===""){return"";}else if(isSet(this.parser)){var _this$parser;return(_this$parser=this.parser(trimmedViewValue))!==null&&_this$parser!==void 0?_this$parser:trimmedViewValue;}else if(isSet(this.formatter)){var _this$formatter;return(_this$formatter=this.formatter(trimmedViewValue))!==null&&_this$formatter!==void 0?_this$formatter:trimmedViewValue;}else{return trimmedViewValue;}},syncViewValueAfterModelUpdate(newModelValue){if(newModelValue===""){this.viewValue="";}else if(isSet(this.parser)){if(isSet(this.formatter)){this.viewValue=String(this.formatter(newModelValue)||this.viewValue);}}else{this.viewValue=String(newModelValue);}},triggerComponentValidityEvent(validityEvent){var _renderSlotText4;const errorMessage=(_renderSlotText4=renderSlotText(this.$slots.default,{},{stripClasses:[]}))!==null&&_renderSlotText4!==void 0?_renderSlotText4:this.defaultText;const element=this.$el.querySelector(`#${validityEvent.elementId}`);if(element){dispatchComponentValidityEvent(element,{...validityEvent,errorMessage,focusElementId:validityEvent.elementId});}},setViewValueToFormattedValueOrFallbackToValue(){if(!isSet(this.formatter)){this.viewValue=String(this.modelValue);return;}const parsedValue=isSet(this.parser)&&typeof this.modelValue==="string"?this.parser(this.modelValue):this.modelValue;const formattedValue=isSet(parsedValue)?this.formatter(parsedValue):void 0;this.viewValue=isSet(formattedValue)?formattedValue:String(this.modelValue);}}});const _hoisted_1$z={key:0};const _hoisted_2$r={key:0,class:"sr-only"};const _hoisted_3$o={key:0,class:"sr-only"};const _hoisted_4$j={class:"text-field__icon-wrapper"};const _hoisted_5$h=["id","type"];const _hoisted_6$d={key:2,class:"text-field__append-inner"};function _sfc_render$D(_ctx,_cache,$props,$setup,$data,$options){const _component_f_label=resolveComponent("f-label");const _component_f_icon=resolveComponent("f-icon");const _component_i_popup_error=resolveComponent("i-popup-error");return openBlock(),createElementBlock("div",{class:normalizeClass(["text-field",_ctx.rootClass])},[createElementVNode("div",{class:normalizeClass(_ctx.labelWrapperClass)},[createVNode(_component_f_label,{for:_ctx.id,class:normalizeClass(_ctx.labelClass)},createSlots({default:withCtx(()=>[renderSlot(_ctx.$slots,"default",{},()=>[_ctx.defaultText!==""?(openBlock(),createElementBlock("span",_hoisted_1$z,toDisplayString(_ctx.defaultText),1/* TEXT */)):createCommentVNode("v-if",true)])]),description:withCtx(({descriptionClass,discreteDescriptionClass})=>[renderSlot(_ctx.$slots,"description",normalizeProps(guardReactiveProps({descriptionClass,discreteDescriptionClass})),()=>[_ctx.descriptionText?(openBlock(),createElementBlock("span",{key:0,class:normalizeClass(descriptionClass)},[_ctx.descriptionScreenReaderText?(openBlock(),createElementBlock("span",_hoisted_2$r,toDisplayString(_ctx.descriptionScreenReaderText),1/* TEXT */)):createCommentVNode("v-if",true),createTextVNode(),createElementVNode("span",null,toDisplayString(_ctx.descriptionText),1/* TEXT */)],2/* CLASS */)):createCommentVNode("v-if",true),createTextVNode(),_ctx.discreteDescriptionText?(openBlock(),createElementBlock("span",{key:1,class:normalizeClass(discreteDescriptionClass)},[_ctx.discreteDescriptionScreenReaderText?(openBlock(),createElementBlock("span",_hoisted_3$o,toDisplayString(_ctx.discreteDescriptionScreenReaderText),1/* TEXT */)):createCommentVNode("v-if",true),createTextVNode(),createElementVNode("span",null,toDisplayString(_ctx.discreteDescriptionText),1/* TEXT */)],2/* CLASS */)):createCommentVNode("v-if",true)])]),"error-message":withCtx(()=>[renderSlot(_ctx.$slots,"error-message",normalizeProps(guardReactiveProps({hasError:_ctx.hasError,validationMessage:_ctx.validationMessage})),()=>[_ctx.hasError?(openBlock(),createElementBlock(Fragment,{key:0},[createTextVNode(toDisplayString(_ctx.validationMessage),1/* TEXT */)],64/* STABLE_FRAGMENT */)):createCommentVNode("v-if",true)])]),_:2/* DYNAMIC */},[_ctx.$slots.tooltip?{name:"tooltip",fn:withCtx(()=>[renderSlot(_ctx.$slots,"tooltip")]),key:"0"}:void 0]),1032,["for","class"])],2/* CLASS */),createTextVNode(),createElementVNode("div",{class:normalizeClass(["text-field__input-wrapper",_ctx.inputWrapperClass])},[renderSlot(_ctx.$slots,"input-left"),createTextVNode(),createElementVNode("div",_hoisted_4$j,[withDirectives(createElementVNode("input",mergeProps({id:_ctx.id,ref:"input","onUpdate:modelValue":_cache[0]||(_cache[0]=$event=>_ctx.viewValue=$event),type:_ctx.type,class:"text-field__input"},_ctx.$attrs,{onBlur:_cache[1]||(_cache[1]=(...args)=>_ctx.onBlur&&_ctx.onBlur(...args)),onFocus:_cache[2]||(_cache[2]=(...args)=>_ctx.onFocus&&_ctx.onFocus(...args)),onChange:_cache[3]||(_cache[3]=(...args)=>_ctx.onChange&&_ctx.onChange(...args)),onValidity:_cache[4]||(_cache[4]=(...args)=>_ctx.onValidity&&_ctx.onValidity(...args)),onPendingValidity:_cache[5]||(_cache[5]=(...args)=>_ctx.onPendingValidity&&_ctx.onPendingValidity(...args))}),null,16,_hoisted_5$h),[[vModelDynamic,_ctx.viewValue]]),createTextVNode(),_ctx.hasError&&_ctx.textFieldTableMode?(openBlock(),createBlock(_component_f_icon,{key:0,ref:"icon",class:"text-field__icon input-icon text-field__append-inner text-field__error-popup-icon",name:"error"},null,512/* NEED_PATCH */)):createCommentVNode("v-if",true),createTextVNode(),_ctx.textFieldTableMode?(openBlock(),createBlock(_component_i_popup_error,{key:1,anchor:_ctx.getErrorPopupAnchor(),"is-open":_ctx.showPopupError,"error-message":_ctx.validationMessage,onClose:_ctx.closePopupError},null,8,["anchor","is-open","error-message","onClose"])):createCommentVNode("v-if",true),createTextVNode(),_ctx.$slots["append-inner"]?(openBlock(),createElementBlock("div",_hoisted_6$d,[renderSlot(_ctx.$slots,"append-inner")])):createCommentVNode("v-if",true)]),createTextVNode(),renderSlot(_ctx.$slots,"input-right")],2/* CLASS */)],2/* CLASS */);}const FTextField=/* @__PURE__ */_export_sfc(_sfc_main$N,[["render",_sfc_render$D]]);const _sfc_main$M=defineComponent({name:"FEmailTextField",components:{FTextField},mixins:[TranslationMixin],inheritAttrs:false,props:{/**
|
|
421
421
|
* The id for the input id attribute.
|
|
422
422
|
* The id for the label for attribute.
|
|
423
423
|
* If the prop is not set a random value will be generated.
|
|
@@ -457,7 +457,7 @@ defaultText:"",descriptionText:"",descriptionScreenReaderText:"",discreteDescrip
|
|
|
457
457
|
* Default is textkey "fkui.sort-filter-dataset.placeholder.filter"
|
|
458
458
|
*/placeholderFilter:{type:String,required:false,default:TranslationMixin.methods.$t("fkui.sort-filter-dataset.placeholder.filter","Sök")},/**
|
|
459
459
|
* The order the data will be sorted by if defaultSortAttribute has been set.
|
|
460
|
-
*/defaultSortAscending:{type:Boolean,required:false,default:()=>true}},emits:["datasetSorted","usedSortAttributes"],data(){return{searchString:"",sortAttribute:{attribute:"",ascending:false},sortFilterResult:[],tableCallbackOnSort:()=>{return;},tableCallbackSortableColumns:()=>{return;}};},computed:{showClearButton(){return this.searchString.length>0;},sortOrders(){const arr=[];let id=0;Object.keys(this.sortableAttributes).forEach(key=>{arr.push({attribute:key,name:this.sortableAttributes[key],ascendingName:this.$t("fkui.sort-filter-dataset.label.ascending","stigande"),ascending:true,id:id++});arr.push({attribute:key,name:this.sortableAttributes[key],ascendingName:this.$t("fkui.sort-filter-dataset.label.descending","fallande"),ascending:false,id:id++});});return arr;},filterAttributes(){return Object.keys(this.sortableAttributes);}},watch:{data:{immediate:true,deep:true,handler:function(){if(this.defaultSortAttribute!==""){const foundAttribute=this.sortOrders.find(item=>item.attribute===this.defaultSortAttribute&&item.ascending===this.defaultSortAscending);if(foundAttribute){this.sortAttribute=foundAttribute;}}this.sortFilterData();}}},created(){this.debouncedFilterResultset=debounce(this.filterResultset,250).bind(this);},mounted(){this.tableCallbackSortableColumns(Object.keys(this.sortableAttributes));},methods:{sortFilterData(){const filteredData=filter(this.data,this.filterAttributes,this.searchString);if(this.sortAttribute.attribute===""){this.sortFilterResult=filteredData;}else{this.sortFilterResult=sort([...filteredData],this.sortAttribute.attribute,this.sortAttribute.ascending);}this.$nextTick(()=>{this.tableCallbackOnSort(this.sortAttribute.attribute,this.sortAttribute.ascending);});this.$emit("datasetSorted",this.sortFilterResult);},onChangeSortAttribute(){this.sortFilterData();this.$emit("usedSortAttributes",this.sortAttribute);},onSearchInput(event){this.searchString=event.target.value;this.debouncedFilterResultset();},onClickClearSearch(){this.searchString="";this.sortFilterData();const input=this.$el.querySelector(".text-field--inline input");focus$1(input);},debouncedFilterResultset(){},filterResultset(){this.sortFilterData();if(this.searchString===""){alertScreenReader(this.$t("fkui.sort-filter-dataset.aria-live.empty","Sök redigera Sök tom"));}else{const searchAriaLive=this.$t("fkui.sort-filter-dataset.aria-live.search",`Din sökning på "{{ search }}" gav {{ result }} träffar.`,{result:this.sortFilterResult.length,search:this.searchString});alertScreenReader(searchAriaLive);}}}});const _hoisted_1$w={class:"sort-filter-dataset"};const _hoisted_2$q={class:"sort-filter-dataset__search"};const _hoisted_3$n={class:"sr-only"};const _hoisted_4$i=["title"];const _hoisted_5$g={class:"sr-only"};const _hoisted_6$
|
|
460
|
+
*/defaultSortAscending:{type:Boolean,required:false,default:()=>true}},emits:["datasetSorted","usedSortAttributes"],data(){return{searchString:"",sortAttribute:{attribute:"",ascending:false},sortFilterResult:[],tableCallbackOnSort:()=>{return;},tableCallbackSortableColumns:()=>{return;}};},computed:{showClearButton(){return this.searchString.length>0;},sortOrders(){const arr=[];let id=0;Object.keys(this.sortableAttributes).forEach(key=>{arr.push({attribute:key,name:this.sortableAttributes[key],ascendingName:this.$t("fkui.sort-filter-dataset.label.ascending","stigande"),ascending:true,id:id++});arr.push({attribute:key,name:this.sortableAttributes[key],ascendingName:this.$t("fkui.sort-filter-dataset.label.descending","fallande"),ascending:false,id:id++});});return arr;},filterAttributes(){return Object.keys(this.sortableAttributes);}},watch:{data:{immediate:true,deep:true,handler:function(){if(this.defaultSortAttribute!==""){const foundAttribute=this.sortOrders.find(item=>item.attribute===this.defaultSortAttribute&&item.ascending===this.defaultSortAscending);if(foundAttribute){this.sortAttribute=foundAttribute;}}this.sortFilterData();}}},created(){this.debouncedFilterResultset=debounce(this.filterResultset,250).bind(this);},mounted(){this.tableCallbackSortableColumns(Object.keys(this.sortableAttributes));},methods:{sortFilterData(){const filteredData=filter(this.data,this.filterAttributes,this.searchString);if(this.sortAttribute.attribute===""){this.sortFilterResult=filteredData;}else{this.sortFilterResult=sort([...filteredData],this.sortAttribute.attribute,this.sortAttribute.ascending);}this.$nextTick(()=>{this.tableCallbackOnSort(this.sortAttribute.attribute,this.sortAttribute.ascending);});this.$emit("datasetSorted",this.sortFilterResult);},onChangeSortAttribute(){this.sortFilterData();this.$emit("usedSortAttributes",this.sortAttribute);},onSearchInput(event){this.searchString=event.target.value;this.debouncedFilterResultset();},onClickClearSearch(){this.searchString="";this.sortFilterData();const input=this.$el.querySelector(".text-field--inline input");focus$1(input);},debouncedFilterResultset(){},filterResultset(){this.sortFilterData();if(this.searchString===""){alertScreenReader(this.$t("fkui.sort-filter-dataset.aria-live.empty","Sök redigera Sök tom"));}else{const searchAriaLive=this.$t("fkui.sort-filter-dataset.aria-live.search",`Din sökning på "{{ search }}" gav {{ result }} träffar.`,{result:this.sortFilterResult.length,search:this.searchString});alertScreenReader(searchAriaLive);}}}});const _hoisted_1$w={class:"sort-filter-dataset"};const _hoisted_2$q={class:"sort-filter-dataset__search"};const _hoisted_3$n={class:"sr-only"};const _hoisted_4$i=["title"];const _hoisted_5$g={class:"sr-only"};const _hoisted_6$c={value:{attribute:"",ascending:false}};const _hoisted_7$b=["value"];function _sfc_render$z(_ctx,_cache,$props,$setup,$data,$options){const _component_i_flex_item=resolveComponent("i-flex-item");const _component_f_icon=resolveComponent("f-icon");const _component_f_text_field=resolveComponent("f-text-field");const _component_f_select_field=resolveComponent("f-select-field");const _component_i_flex=resolveComponent("i-flex");return openBlock(),createElementBlock("div",_hoisted_1$w,[createVNode(_component_i_flex,{collapse:"",gap:"3x",wrap:""},{default:withCtx(()=>[createVNode(_component_i_flex_item,{shrink:"",align:"center"},{default:withCtx(()=>[renderSlot(_ctx.$slots,"header",normalizeProps(guardReactiveProps({slotClass:"sort-filter-dataset__toolbar__header"})))]),_:3/* FORWARDED */}),createTextVNode(),createVNode(_component_i_flex_item,{grow:""},{default:withCtx(()=>[createVNode(_component_i_flex,{collapse:"",float:"right"},{default:withCtx(()=>[_ctx.showFilter?(openBlock(),createBlock(_component_i_flex_item,{key:0,shrink:"",align:"center"},{default:withCtx(()=>[createElementVNode("div",_hoisted_2$q,[createVNode(_component_f_icon,{name:"search",class:"sort-filter-dataset__search__magnify-icon"}),createTextVNode(),createVNode(_component_f_text_field,{modelValue:_ctx.searchString,"onUpdate:modelValue":_cache[0]||(_cache[0]=$event=>_ctx.searchString=$event),inline:"",placeholder:_ctx.placeholderFilter,maxlength:"64",onInput:_ctx.onSearchInput},{default:withCtx(()=>[createElementVNode("span",_hoisted_3$n,toDisplayString(_ctx.placeholderFilter),1/* TEXT */)]),_:1/* STABLE */},8,["modelValue","placeholder","onInput"]),createTextVNode(),_ctx.showClearButton?(openBlock(),createElementBlock("button",{key:0,type:"button",class:"button button--discrete sort-filter-dataset__search__close-icon",title:_ctx.$t("fkui.sort-filter-dataset.clear.filter","Rensa sökfält"),onClick:_cache[1]||(_cache[1]=(...args)=>_ctx.onClickClearSearch&&_ctx.onClickClearSearch(...args))},[createVNode(_component_f_icon,{name:"close"}),createTextVNode(),createElementVNode("span",_hoisted_5$g,toDisplayString(_ctx.$t("fkui.sort-filter-dataset.clear.filter","Rensa sökfält")),1/* TEXT */)],8,_hoisted_4$i)):createCommentVNode("v-if",true)])]),_:1/* STABLE */})):createCommentVNode("v-if",true),createTextVNode(),_ctx.showSort?(openBlock(),createBlock(_component_i_flex_item,{key:1,shrink:"",align:"center"},{default:withCtx(()=>[createVNode(_component_f_select_field,{modelValue:_ctx.sortAttribute,"onUpdate:modelValue":_cache[2]||(_cache[2]=$event=>_ctx.sortAttribute=$event),class:"sort-filter-dataset__sort",inline:"",onChange:_ctx.onChangeSortAttribute},{label:withCtx(()=>[createTextVNode(toDisplayString(_ctx.$t("fkui.sort-filter-dataset.label.sort","Sortera på")),1/* TEXT */)]),default:withCtx(()=>[createTextVNode(),createElementVNode("option",_hoisted_6$c,toDisplayString(_ctx.$t("fkui.sort-filter-dataset.label.unsorted","Välj")),1/* TEXT */),createTextVNode(),(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.sortOrders,sortOrder=>{return openBlock(),createElementBlock("option",{key:sortOrder.id,value:sortOrder},toDisplayString(sortOrder.name)+" ("+toDisplayString(sortOrder.ascendingName)+")\n ",9,_hoisted_7$b);}),128/* KEYED_FRAGMENT */))]),_:1/* STABLE */},8,["modelValue","onChange"])]),_:1/* STABLE */})):createCommentVNode("v-if",true)]),_:1/* STABLE */})]),_:1/* STABLE */})]),_:3/* FORWARDED */}),createTextVNode(),renderSlot(_ctx.$slots,"default",normalizeProps(guardReactiveProps({sortFilterResult:_ctx.sortFilterResult})))]);}const FSortFilterDataset=/* @__PURE__ */_export_sfc(_sfc_main$z,[["render",_sfc_render$z]]);const _sfc_main$y=defineComponent({name:"FDataTable",components:{FIcon},mixins:[TranslationMixin],provide(){return{addColumn:column=>{if(column.type===FTableColumnType.ACTION){throw new Error("Cannot use action column in FDataTable component");}this.columns=addColumn(this.columns,column);},setVisibilityColumn:(id,visible)=>{setVisibilityColumn(this.columns,id,visible);},textFieldTableMode:true};},inheritAttrs:false,props:{/**
|
|
461
461
|
* The rows to be listed.
|
|
462
462
|
* The rows will be listed in the given array order.
|
|
463
463
|
*/rows:{type:Array,required:true},/**
|
|
@@ -473,7 +473,7 @@ defaultText:"",descriptionText:"",descriptionScreenReaderText:"",discreteDescrip
|
|
|
473
473
|
* - `"vertical"`: Enables vertical scrolling
|
|
474
474
|
* - `"both"`: Enables scrolling in both directions
|
|
475
475
|
* - `"none"`: Disables scrolling (default)
|
|
476
|
-
*/scroll:{type:String,default:TableScroll.NONE,validator:function(value){const types=Object.values(TableScroll);return types.includes(value);}}},setup(){return FSortFilterDatasetInjected();},data(){return{columns:[],emptyRow:emptyTableRow()};},computed:{hasCaption(){return hasSlot(this,"caption");},tableClasses(){const classes=[];if(this.striped){classes.push("table--striped");}return classes;},isEmpty(){return this.rows.length===0;},visibleColumns(){return this.columns.filter(col=>col.visible);},hasInitiateColumns(){return this.columns.length>0;},wrapperClasses(){return tableScrollClasses(this.scroll);},tabindex(){return this.scroll!==TableScroll.NONE?0:void 0;}},mounted(){this.registerCallbackOnSort(this.callbackOnSort);this.registerCallbackOnMount(this.callbackSortableColumns);},methods:{rowKey(item){const key=item[this.keyAttribute];if(typeof key==="undefined"){throw new Error(`Key attribute [${this.keyAttribute}]' is missing in row`);}return String(key);},columnClasses(column){const classes=["table__column",`table__column--${column.type}`,column.size];if(column.sortable){classes.push("table__column--sortable");}return classes;},iconClasses(column){return getSortableIconClasses(column);},iconName(column){return getSortableIconName(column);},onClickColumnHeader(column){if(!column.sortable){return;}let columnName=column.name;if(column.sort===FTableColumnSort.DESCENDING){columnName="";column.sort=FTableColumnSort.UNSORTED;}this.sort(columnName,column.sort!==FTableColumnSort.ASCENDING);},callbackOnSort(columnName,ascending){updateSortOrder(this.columns,columnName,ascending);},callbackSortableColumns(columnNames){setSortableColumns(this.columns,columnNames);},escapeNewlines(value){return value.replace(/\n/g,"<br/>");}}});const _hoisted_1$v=["tabindex"];const _hoisted_2$p={key:0};const _hoisted_3$m={class:"table__row"};const _hoisted_4$h=["innerHTML"];const _hoisted_5$f={key:1,class:"table__column__description"};const _hoisted_6$
|
|
476
|
+
*/scroll:{type:String,default:TableScroll.NONE,validator:function(value){const types=Object.values(TableScroll);return types.includes(value);}}},setup(){return FSortFilterDatasetInjected();},data(){return{columns:[],emptyRow:emptyTableRow()};},computed:{hasCaption(){return hasSlot(this,"caption");},tableClasses(){const classes=[];if(this.striped){classes.push("table--striped");}return classes;},isEmpty(){return this.rows.length===0;},visibleColumns(){return this.columns.filter(col=>col.visible);},hasInitiateColumns(){return this.columns.length>0;},wrapperClasses(){return tableScrollClasses(this.scroll);},tabindex(){return this.scroll!==TableScroll.NONE?0:void 0;}},mounted(){this.registerCallbackOnSort(this.callbackOnSort);this.registerCallbackOnMount(this.callbackSortableColumns);},methods:{rowKey(item){const key=item[this.keyAttribute];if(typeof key==="undefined"){throw new Error(`Key attribute [${this.keyAttribute}]' is missing in row`);}return String(key);},columnClasses(column){const classes=["table__column",`table__column--${column.type}`,column.size];if(column.sortable){classes.push("table__column--sortable");}return classes;},iconClasses(column){return getSortableIconClasses(column);},iconName(column){return getSortableIconName(column);},onClickColumnHeader(column){if(!column.sortable){return;}let columnName=column.name;if(column.sort===FTableColumnSort.DESCENDING){columnName="";column.sort=FTableColumnSort.UNSORTED;}this.sort(columnName,column.sort!==FTableColumnSort.ASCENDING);},callbackOnSort(columnName,ascending){updateSortOrder(this.columns,columnName,ascending);},callbackSortableColumns(columnNames){setSortableColumns(this.columns,columnNames);},escapeNewlines(value){return value.replace(/\n/g,"<br/>");}}});const _hoisted_1$v=["tabindex"];const _hoisted_2$p={key:0};const _hoisted_3$m={class:"table__row"};const _hoisted_4$h=["innerHTML"];const _hoisted_5$f={key:1,class:"table__column__description"};const _hoisted_6$b={key:0};const _hoisted_7$a={key:1};const _hoisted_8$8=["colspan"];function _sfc_render$y(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");return openBlock(),createElementBlock("div",{class:normalizeClass(_ctx.wrapperClasses)},[createElementVNode("table",mergeProps({class:["table",_ctx.tableClasses],tabindex:_ctx.tabindex},_ctx.$attrs),[_ctx.hasCaption?(openBlock(),createElementBlock("caption",_hoisted_2$p,[renderSlot(_ctx.$slots,"caption")])):createCommentVNode("v-if",true),createTextVNode(),createElementVNode("colgroup",null,[(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.columns,column=>{return openBlock(),createElementBlock("col",{key:column.id,class:normalizeClass(column.size)},null,2/* CLASS */);}),128/* KEYED_FRAGMENT */))]),createTextVNode(),createElementVNode("thead",null,[createElementVNode("tr",_hoisted_3$m,[(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.visibleColumns,column=>{return openBlock(),createElementBlock("th",mergeProps({key:column.id,scope:"col",class:_ctx.columnClasses(column)},toHandlers(column.sortable?{click:()=>_ctx.onClickColumnHeader(column)}:{},true)),[createElementVNode("span",{innerHTML:_ctx.escapeNewlines(column.title)},null,8,_hoisted_4$h),createTextVNode(),column.sortable?(openBlock(),createBlock(_component_f_icon,{key:0,class:normalizeClass(_ctx.iconClasses(column)),name:_ctx.iconName(column)},null,8,["class","name"])):createCommentVNode("v-if",true),createTextVNode(),column.description?(openBlock(),createElementBlock("span",_hoisted_5$f,toDisplayString(column.description),1/* TEXT */)):createCommentVNode("v-if",true)],16/* FULL_PROPS */);}),128/* KEYED_FRAGMENT */))])]),createTextVNode(),createElementVNode("tbody",null,[!_ctx.hasInitiateColumns?(openBlock(),createElementBlock("tr",_hoisted_6$b,[renderSlot(_ctx.$slots,"default",normalizeProps(guardReactiveProps({row:_ctx.emptyRow})))])):createCommentVNode("v-if",true),createTextVNode(),_ctx.isEmpty?(openBlock(),createElementBlock("tr",_hoisted_7$a,[createElementVNode("td",{class:"table__column table__column--action",colspan:_ctx.columns.length},[renderSlot(_ctx.$slots,"empty",{},()=>[createTextVNode(toDisplayString(_ctx.$t("fkui.data-table.empty","Tabellen är tom")),1/* TEXT */)])],8,_hoisted_8$8)])):createCommentVNode("v-if",true),createTextVNode(),(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.rows,row=>{return openBlock(),createElementBlock("tr",{key:_ctx.rowKey(row),class:"table__row"},[renderSlot(_ctx.$slots,"default",mergeProps({ref_for:true},{row}))]);}),128/* KEYED_FRAGMENT */))])],16,_hoisted_1$v)],2/* CLASS */);}const FDataTable=/* @__PURE__ */_export_sfc(_sfc_main$y,[["render",_sfc_render$y]]);function isDayEnabled(day,config2){return passesMinDate(day,config2.minDate)&&passesMaxDate(day,config2.maxDate)&&passesInvalidDates(day,config2.invalidDates)&&passesInvalidWeekdays(day,config2.invalidWeekdays);}function passesMinDate(day,config2){if(!config2){throw new Error("MinDate validator must be set");}if(!config2.limit){throw new Error("Invalid minDate config");}return config2.limit<=day.toString();}function passesMaxDate(day,config2){if(!config2){throw new Error("MaxDate validator must be set");}if(!config2.limit){throw new Error("Invalid maxDate config");}return day.toString()<=config2.limit;}function passesInvalidDates(day,config2){if(!config2){return true;}if(!isInvalidDatesConfig(config2)){throw new Error("Invalid invalidDates config");}return!config2.dates.includes(day.toString());}function passesInvalidWeekdays(day,config2){if(!config2){return true;}if(!isInvalidWeekdaysConfig(config2)){throw new Error("Invalid invalidWeekdays config");}return!config2.days.includes(day.weekDay);}function updateCalendarValue(newValue){const newCalendarValue=FDate.fromIso(newValue);if(!newCalendarValue.isValid()){this.calendarValue=void 0;}else if(isInvalidMonth(newCalendarValue,this.minDate,this.maxDate)){this.calendarValue=void 0;}else if(!this.isDateEnabled(newCalendarValue)){this.calendarValue=void 0;}else if(!this.calendarValue||!this.calendarValue.equals(newCalendarValue)){this.calendarValue=newCalendarValue;}}function getDisplayMonth(minDate,maxDate,selectedDate,initialMonth){let effectiveDate;if(selectedDate&&selectedDate.isValid()){effectiveDate=selectedDate;}else if(initialMonth&&initialMonth.isValid()){effectiveDate=initialMonth;}else{effectiveDate=FDate.now();}let month;if(!isInvalidMonth(effectiveDate,minDate,maxDate)){month=effectiveDate.startOfMonth();}else if(isMonthBefore(effectiveDate,minDate)){month=minDate==null?void 0:minDate.startOfMonth();}else if(isMonthAfter(effectiveDate,maxDate)){month=maxDate==null?void 0:maxDate.startOfMonth();}return month||FDate.now().startOfMonth();}const _sfc_main$x=defineComponent({name:"FDatepickerField",components:{FCalendar,IPopup,FTextField,FIcon,FCalendarDay},mixins:[TranslationMixin],inheritAttrs:false,props:{/** Selected day.
|
|
477
477
|
* @model
|
|
478
478
|
*/modelValue:{type:String,required:false,default:""},/**
|
|
479
479
|
* Initial month. Applies when no day is selected.
|
|
@@ -508,7 +508,7 @@ defaultText:"",descriptionText:"",descriptionScreenReaderText:"",discreteDescrip
|
|
|
508
508
|
* Number of notifications present in panel.
|
|
509
509
|
*
|
|
510
510
|
* If set to zero (default) no notification badge will be displayed.
|
|
511
|
-
*/notifications:{type:Number,required:false,default:0},screenReaderNotificationTemplate:{type:String,required:false,default:"Du har %VALUE% notifieringar."}},emits:["toggle"],computed:{expandedClass(){return this.expanded?"expandable-panel--expanded":"expandable-panel--collapsed";},hasOutsideSlot(){return hasSlot(this,"outside");},haveNotifications(){return this.notifications>0;},screenReaderNotificationText(){return`${this.screenReaderNotificationTemplate.replace("%VALUE%",this.notifications.toString())}`;}},methods:{onClickHeadingButton(event){this.$emit("toggle",event);}}});const _hoisted_1$t=["aria-expanded","aria-controls"];const _hoisted_2$n={class:"expandable-panel__icon"};const _hoisted_3$k={class:"icon-stack"};const _hoisted_4$f=["title"];const _hoisted_5$e={class:"sr-only"};const _hoisted_6$
|
|
511
|
+
*/notifications:{type:Number,required:false,default:0},screenReaderNotificationTemplate:{type:String,required:false,default:"Du har %VALUE% notifieringar."}},emits:["toggle"],computed:{expandedClass(){return this.expanded?"expandable-panel--expanded":"expandable-panel--collapsed";},hasOutsideSlot(){return hasSlot(this,"outside");},haveNotifications(){return this.notifications>0;},screenReaderNotificationText(){return`${this.screenReaderNotificationTemplate.replace("%VALUE%",this.notifications.toString())}`;}},methods:{onClickHeadingButton(event){this.$emit("toggle",event);}}});const _hoisted_1$t=["aria-expanded","aria-controls"];const _hoisted_2$n={class:"expandable-panel__icon"};const _hoisted_3$k={class:"icon-stack"};const _hoisted_4$f=["title"];const _hoisted_5$e={class:"sr-only"};const _hoisted_6$a=["id"];const _hoisted_7$9={class:"expandable-panel__body"};const _hoisted_8$7={key:0,class:"expandable-panel__outside"};function _sfc_render$v(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");const _component_f_expand=resolveComponent("f-expand");return openBlock(),createElementBlock("div",{class:normalizeClass(["expandable-panel",_ctx.expandedClass])},[(openBlock(),createBlock(resolveDynamicComponent(_ctx.headerTag),{class:"expandable-panel__heading"},{default:withCtx(()=>[createElementVNode("button",mergeProps({type:"button","aria-expanded":_ctx.expanded?"true":"false","aria-controls":_ctx.id},_ctx.$attrs,{onClick:_cache[0]||(_cache[0]=(...args)=>_ctx.onClickHeadingButton&&_ctx.onClickHeadingButton(...args))}),[createElementVNode("span",_hoisted_2$n,[createElementVNode("span",_hoisted_3$k,[createVNode(_component_f_icon,{name:"dash"}),createTextVNode(),createVNode(_component_f_icon,{name:"dash"})])]),createTextVNode(),renderSlot(_ctx.$slots,"title"),createTextVNode(),_ctx.haveNotifications?(openBlock(),createElementBlock("span",{key:0,class:"expandable-panel__notification",title:_ctx.$t("fkui.expandable-panel.notification.title","{{ count }} notifiering{{ suffix }}",{count:_ctx.notifications,suffix:_ctx.notifications>1?"ar":""})},[createElementVNode("span",_hoisted_5$e,toDisplayString(_ctx.screenReaderNotificationText),1/* TEXT */),createTextVNode(),createVNode(_component_f_icon,{name:"bell"})],8,_hoisted_4$f)):createCommentVNode("v-if",true)],16,_hoisted_1$t)]),_:3/* FORWARDED */})),createTextVNode(),createVNode(_component_f_expand,null,{default:withCtx(()=>[withDirectives(createElementVNode("div",{id:_ctx.id,class:"expandable-panel__content"},[createElementVNode("div",_hoisted_7$9,[renderSlot(_ctx.$slots,"default")]),createTextVNode(),_ctx.hasOutsideSlot?(openBlock(),createElementBlock("div",_hoisted_8$7,[renderSlot(_ctx.$slots,"outside")])):createCommentVNode("v-if",true)],8,_hoisted_6$a),[[vShow,_ctx.expanded]])]),_:3/* FORWARDED */})],2/* CLASS */);}const FExpandablePanel=/* @__PURE__ */_export_sfc(_sfc_main$v,[["render",_sfc_render$v]]);const _sfc_main$u=defineComponent({name:"FExpandableParagraph",components:{FIcon,FExpand},inheritAttrs:false,props:{/**
|
|
512
512
|
* Toggle expanded/collapsed state
|
|
513
513
|
*/expanded:{type:Boolean,required:false,default:false},/**
|
|
514
514
|
* Element to render for the button elmement
|
|
@@ -522,7 +522,7 @@ defaultText:"",descriptionText:"",descriptionScreenReaderText:"",discreteDescrip
|
|
|
522
522
|
*/list:{type:Boolean,default:false,required:false},/**
|
|
523
523
|
* The id for the content id attribute.
|
|
524
524
|
* If the prop is not set the id will be generated.
|
|
525
|
-
*/id:{type:String,required:false,default:()=>ElementIdService.generateElementId()}},emits:["toggle"],computed:{expandedClass(){return this.expanded?"expandable-paragraph--open":"expandable-paragraph--closed";},listClass(){return this.list?"expandable-paragraph--list":"";},relatedClass(){return this.hasRelatedSlot?"expandable-paragraph--related-information":"";},hasRelatedSlot(){return hasSlot(this,"related");},headerVisualClass(){return`heading--${this.headerVisualTag||"h4"}`;}},methods:{onClickMinimize(event){this.$emit("toggle",event);}}});const _hoisted_1$s=["aria-expanded","aria-controls"];const _hoisted_2$m={class:"expandable-paragraph__icon"};const _hoisted_3$j={class:"icon-stack"};const _hoisted_4$e={key:0,class:"expandable-paragraph__related-information"};const _hoisted_5$d=["id"];const _hoisted_6$
|
|
525
|
+
*/id:{type:String,required:false,default:()=>ElementIdService.generateElementId()}},emits:["toggle"],computed:{expandedClass(){return this.expanded?"expandable-paragraph--open":"expandable-paragraph--closed";},listClass(){return this.list?"expandable-paragraph--list":"";},relatedClass(){return this.hasRelatedSlot?"expandable-paragraph--related-information":"";},hasRelatedSlot(){return hasSlot(this,"related");},headerVisualClass(){return`heading--${this.headerVisualTag||"h4"}`;}},methods:{onClickMinimize(event){this.$emit("toggle",event);}}});const _hoisted_1$s=["aria-expanded","aria-controls"];const _hoisted_2$m={class:"expandable-paragraph__icon"};const _hoisted_3$j={class:"icon-stack"};const _hoisted_4$e={key:0,class:"expandable-paragraph__related-information"};const _hoisted_5$d=["id"];const _hoisted_6$9={class:"expandable-paragraph__content"};const _hoisted_7$8={key:0,class:"expandable-paragraph__separator"};function _sfc_render$u(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");const _component_f_expand=resolveComponent("f-expand");return openBlock(),createElementBlock("div",{class:normalizeClass(["expandable-paragraph",[_ctx.expandedClass,_ctx.listClass]])},[createElementVNode("div",{class:normalizeClass(_ctx.relatedClass)},[(openBlock(),createBlock(resolveDynamicComponent(_ctx.headerTag),{class:normalizeClass(["expandable-paragraph__heading",_ctx.headerVisualClass])},{default:withCtx(()=>[createElementVNode("button",mergeProps({type:"button",class:"expandable-paragraph__button","aria-expanded":_ctx.expanded?"true":"false","aria-controls":_ctx.id},_ctx.$attrs,{onClick:_cache[0]||(_cache[0]=(...args)=>_ctx.onClickMinimize&&_ctx.onClickMinimize(...args))}),[createElementVNode("span",_hoisted_2$m,[createElementVNode("span",_hoisted_3$j,[createVNode(_component_f_icon,{name:"dash"}),createTextVNode(),createVNode(_component_f_icon,{name:"dash"})])]),createTextVNode(),renderSlot(_ctx.$slots,"title")],16,_hoisted_1$s)]),_:3/* FORWARDED */},8,["class"])),createTextVNode(),_ctx.hasRelatedSlot?(openBlock(),createElementBlock("div",_hoisted_4$e,[renderSlot(_ctx.$slots,"related")])):createCommentVNode("v-if",true)],2/* CLASS */),createTextVNode(),createVNode(_component_f_expand,null,{default:withCtx(()=>[withDirectives(createElementVNode("div",{id:_ctx.id,class:"expandable-paragraph__container"},[createElementVNode("div",_hoisted_6$9,[renderSlot(_ctx.$slots,"default")]),createTextVNode(),!_ctx.list?(openBlock(),createElementBlock("div",_hoisted_7$8)):createCommentVNode("v-if",true)],8,_hoisted_5$d),[[vShow,_ctx.expanded]])]),_:3/* FORWARDED */})],2/* CLASS */);}const FExpandableParagraph=/* @__PURE__ */_export_sfc(_sfc_main$u,[["render",_sfc_render$u]]);const DEFAULT_ICON="file";const iconMap={"image/*":"pic","application/msword":"doc","application/pdf":"pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"doc","application/vnd.openxmlformats-officedocument.wordprocessingml.template":"doc"};const _sfc_main$t=defineComponent({name:"FFileItem",components:{FIcon},inheritAttrs:false,props:{/**
|
|
526
526
|
* The id for the input id attribute.
|
|
527
527
|
* The id for the label for attribute.
|
|
528
528
|
* If the prop is not set a random value will be generated.
|
|
@@ -534,7 +534,7 @@ defaultText:"",descriptionText:"",descriptionScreenReaderText:"",discreteDescrip
|
|
|
534
534
|
* The name of the file uploaded
|
|
535
535
|
*/originalMimeType:{type:String,required:false,default:void 0},/**
|
|
536
536
|
* If file name changed, this info will be displayed, placeholder %before% and %after% will be replaced with originalMimeType and mimeType
|
|
537
|
-
*/changedMimeTypeText:{type:String,required:false,default:void 0}},computed:{isMimeTypeChanged(){return isSet(this.originalMimeType)&&this.originalMimeType!==this.mimeType;},mimeTypeChangedText(){var _this$changedMimeType;const originalMimeType=(this.originalMimeType||"").split("/").pop()||"";const currentMimeType=(this.mimeType||"").split("/").pop()||"";const localChangedMimeTypeText=(_this$changedMimeType=this.changedMimeTypeText)!==null&&_this$changedMimeType!==void 0?_this$changedMimeType:this.$t("fkui.file-item.changed-mime-type.text","(%before% ändrad till %after%)");return localChangedMimeTypeText.replace("%before%",originalMimeType).replace("%after%",currentMimeType);},iconName(){const{mimeType}=this;if(!mimeType){return DEFAULT_ICON;}if(iconMap[mimeType]){return iconMap[mimeType];}const p=mimeType.split("/",1);const wildcard=[p[0],"*"].join("/");if(iconMap[wildcard]){return iconMap[wildcard];}return DEFAULT_ICON;}}});const _hoisted_1$r={class:"file-item"};const _hoisted_2$l={class:"file-item__row"};const _hoisted_3$i=["id"];const _hoisted_4$d={class:"icon-stack button__icon icon-stack--new-window"};const _hoisted_5$c={class:"file-item__file-name"};const _hoisted_6$
|
|
537
|
+
*/changedMimeTypeText:{type:String,required:false,default:void 0}},computed:{isMimeTypeChanged(){return isSet(this.originalMimeType)&&this.originalMimeType!==this.mimeType;},mimeTypeChangedText(){var _this$changedMimeType;const originalMimeType=(this.originalMimeType||"").split("/").pop()||"";const currentMimeType=(this.mimeType||"").split("/").pop()||"";const localChangedMimeTypeText=(_this$changedMimeType=this.changedMimeTypeText)!==null&&_this$changedMimeType!==void 0?_this$changedMimeType:this.$t("fkui.file-item.changed-mime-type.text","(%before% ändrad till %after%)");return localChangedMimeTypeText.replace("%before%",originalMimeType).replace("%after%",currentMimeType);},iconName(){const{mimeType}=this;if(!mimeType){return DEFAULT_ICON;}if(iconMap[mimeType]){return iconMap[mimeType];}const p=mimeType.split("/",1);const wildcard=[p[0],"*"].join("/");if(iconMap[wildcard]){return iconMap[wildcard];}return DEFAULT_ICON;}}});const _hoisted_1$r={class:"file-item"};const _hoisted_2$l={class:"file-item__row"};const _hoisted_3$i=["id"];const _hoisted_4$d={class:"icon-stack button__icon icon-stack--new-window"};const _hoisted_5$c={class:"file-item__file-name"};const _hoisted_6$8={class:"sr-only"};const _hoisted_7$7={key:0,class:"file-item__change-info"};const _hoisted_8$6=/* @__PURE__ */createElementVNode("hr",{class:"file-item__separator"},null,-1/* HOISTED */);function _sfc_render$t(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");return openBlock(),createElementBlock("div",_hoisted_1$r,[createElementVNode("div",_hoisted_2$l,[createElementVNode("a",mergeProps({id:_ctx.id,class:"file-item__file-open"},_ctx.$attrs),[createElementVNode("div",_hoisted_4$d,[createVNode(_component_f_icon,{name:"new-window"}),createTextVNode(),createVNode(_component_f_icon,{name:_ctx.iconName},null,8,["name"])]),createTextVNode(),createElementVNode("span",_hoisted_5$c,toDisplayString(_ctx.fileName),1/* TEXT */),createTextVNode(),createElementVNode("span",_hoisted_6$8," "+toDisplayString(_ctx.$t("fkui.file-item.file-open","öppnas i nytt fönster")),1/* TEXT */)],16,_hoisted_3$i),createTextVNode(),renderSlot(_ctx.$slots,"row")]),createTextVNode(),renderSlot(_ctx.$slots,"default"),createTextVNode(),_ctx.isMimeTypeChanged?(openBlock(),createElementBlock("div",_hoisted_7$7,toDisplayString(_ctx.mimeTypeChangedText),1/* TEXT */)):createCommentVNode("v-if",true),createTextVNode(),_hoisted_8$6]);}const FFileItem=/* @__PURE__ */_export_sfc(_sfc_main$t,[["render",_sfc_render$t]]);const _sfc_main$s=defineComponent({name:"FFileSelector",components:{FIcon},inheritAttrs:false,model:{prop:"files",event:"change"},props:{/**
|
|
538
538
|
* The id for the input id attribute.
|
|
539
539
|
* The id for the label for attribute.
|
|
540
540
|
* If the prop is not set a random value will be generated.
|
|
@@ -586,14 +586,14 @@ injected(){return this;},isSubmitted(){return this.self.ref.numberOfTimesSubmitt
|
|
|
586
586
|
*/id:{type:String,required:false,default:()=>ElementIdService.generateElementId()},isOpen:Boolean,isAnyFieldTouched:Boolean,additionalScreenreaderText:{type:String,required:false,default:""}}});const _hoisted_1$m=["id","aria-expanded"];const _hoisted_2$i={class:"sr-only"};function _sfc_render$o(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");return openBlock(),createElementBlock("button",mergeProps({id:_ctx.id,class:"button button--margin-bottom-0 button--large",type:"button"},_ctx.$attrs,{"aria-expanded":_ctx.isOpen?"true":"false","data-form-step-button":""}),[_ctx.isOpen?(openBlock(),createElementBlock(Fragment,{key:0},[createVNode(_component_f_icon,{name:"success",class:"button__icon"}),createTextVNode(" "+toDisplayString(_ctx.$t("fkui.form-step-button.close","OK")),1/* TEXT */)],64/* STABLE_FRAGMENT */)):(openBlock(),createElementBlock(Fragment,{key:1},[createVNode(_component_f_icon,{name:"pen",class:"button__icon"}),createTextVNode(" "+toDisplayString(_ctx.isAnyFieldTouched?_ctx.$t("fkui.form-step-button.edit","Ändra"):_ctx.$t("fkui.form-step-button.open","Fyll i")),1/* TEXT */)],64/* STABLE_FRAGMENT */)),createTextVNode(),createElementVNode("span",_hoisted_2$i,toDisplayString(_ctx.additionalScreenreaderText),1/* TEXT */)],16,_hoisted_1$m);}const FFormStepButton=/* @__PURE__ */_export_sfc(_sfc_main$o,[["render",_sfc_render$o]]);const _sfc_main$n=defineComponent({name:"FCard",data(){return{headingClass:["card__header-label"]};},computed:{hasHeaderSlot(){return hasSlot(this,"header");},hasFooterSlot(){return hasSlot(this,"footer");}}});const _hoisted_1$l={class:"card card--default"};const _hoisted_2$h={key:0,class:"card__header"};const _hoisted_3$f={class:"card__content"};const _hoisted_4$c={key:1,class:"card__footer"};function _sfc_render$n(_ctx,_cache,$props,$setup,$data,$options){return openBlock(),createElementBlock("div",_hoisted_1$l,[_ctx.hasHeaderSlot?(openBlock(),createElementBlock("div",_hoisted_2$h,[renderSlot(_ctx.$slots,"header",normalizeProps(guardReactiveProps({headingSlotClass:_ctx.headingClass})))])):createCommentVNode("v-if",true),createTextVNode(),createElementVNode("div",_hoisted_3$f,[renderSlot(_ctx.$slots,"default")]),createTextVNode(),_ctx.hasFooterSlot?(openBlock(),createElementBlock("div",_hoisted_4$c,[renderSlot(_ctx.$slots,"footer")])):createCommentVNode("v-if",true)]);}const FCard=/* @__PURE__ */_export_sfc(_sfc_main$n,[["render",_sfc_render$n]]);const _sfc_main$m=defineComponent({name:"FLayoutApplicationTemplate",computed:{showHeader(){return this.hasSlot("header");},showTopNavigation(){return this.hasSlot("top-navigation");},showFooter(){return this.hasSlot("footer");}},mounted(){document.body.classList.add("layout-application-template__body");},beforeUnmount(){document.body.classList.remove("layout-application-template__body");},methods:{hasSlot(name){return isSet(this.$slots[name]);}}});const _hoisted_1$k={class:"layout-application-template"};const _hoisted_2$g={key:0,ref:"header",class:"layout-application-template__header"};const _hoisted_3$e={key:1};const _hoisted_4$b={ref:"primary-content",class:"layout-application-template__main"};const _hoisted_5$b={key:0,class:"layout-application-template__footer"};function _sfc_render$m(_ctx,_cache,$props,$setup,$data,$options){return openBlock(),createElementBlock("div",_hoisted_1$k,[_ctx.showHeader||_ctx.showTopNavigation?(openBlock(),createElementBlock("header",_hoisted_2$g,[_ctx.showHeader?renderSlot(_ctx.$slots,"header",{key:0}):createCommentVNode("v-if",true),createTextVNode(),_ctx.showTopNavigation?(openBlock(),createElementBlock("nav",_hoisted_3$e,[renderSlot(_ctx.$slots,"top-navigation")])):createCommentVNode("v-if",true)],512/* NEED_PATCH */)):createCommentVNode("v-if",true),createTextVNode(),createElementVNode("main",_hoisted_4$b,[renderSlot(_ctx.$slots,"default"),createTextVNode(),_ctx.showFooter?(openBlock(),createElementBlock("footer",_hoisted_5$b,[renderSlot(_ctx.$slots,"footer")])):createCommentVNode("v-if",true)],512/* NEED_PATCH */)]);}const FLayoutApplicationTemplate=/* @__PURE__ */_export_sfc(_sfc_main$m,[["render",_sfc_render$m]]);function getGridClasses(target){if(target===null){return{};}const width=typeof target==="number"?target:target.offsetWidth;return{"grid--force":true,"grid--force-sm":true,"grid--force-md":width>=640,"grid--force-lg":width>=1024,"grid--force-xl":width>=1280};}function useLayoutPanel(options){const growToRight=options.grow==="right";let borderDrag=false;let dragStart=0;let dragStartWidth=0;let preferredWidth=-1;let minWidth=150;let maxWidth=0.5;const panelWidth=ref(0);const leftPrimaryClasses=ref({});const rightPrimaryClasses=ref({});function updateOptions(){var _options$initialWidth,_options$minWidth,_options$maxWidth;panelWidth.value=parseInt(toValue((_options$initialWidth=options.initialWidth)!==null&&_options$initialWidth!==void 0?_options$initialWidth:"0"),10);minWidth=parseInt(toValue((_options$minWidth=options.minWidth)!==null&&_options$minWidth!==void 0?_options$minWidth:"150"),10);maxWidth=toValue((_options$maxWidth=options.maxWidth)!==null&&_options$maxWidth!==void 0?_options$maxWidth:0.5);}function disableEvent(event){event.preventDefault();}function onMouseUp(){document.body.style.cursor="";borderDrag=false;window.removeEventListener("selectstart",disableEvent);}function onMouseMove(event){if(borderDrag){const growDirection=growToRight?1:-1;preferredWidth=dragStartWidth+(event.screenX-dragStart)*growDirection;limitWidth();}}function onBorderMouseDown(event){document.body.style.cursor="w-resize";borderDrag=true;dragStart=event.screenX;dragStartWidth=panelWidth.value;window.addEventListener("selectstart",disableEvent);const selection=window.getSelection();if(selection){selection.removeAllRanges();}}function limitWidth(){if(preferredWidth===-1){preferredWidth=panelWidth.value;}let newWidth=preferredWidth;newWidth=Math.max(newWidth,minWidth);newWidth=Math.min(newWidth,window.innerWidth*maxWidth);panelWidth.value=newWidth;updatePrimaryGrid();}function updatePrimaryGrid(){const leftPrimaryElement=document.getElementById("layout-side-navigation__primary-content");const rightPrimaryElement=document.getElementById("layout-secondary__primary");leftPrimaryClasses.value=getGridClasses(leftPrimaryElement);rightPrimaryClasses.value=getGridClasses(rightPrimaryElement);}function gridClasses(){updatePrimaryGrid();return getGridClasses(preferredWidth);}onMounted(()=>{window.addEventListener("mouseup",onMouseUp);window.addEventListener("mousemove",onMouseMove);window.addEventListener("resize",limitWidth);});onUnmounted(()=>{window.removeEventListener("mouseup",onMouseUp);window.removeEventListener("mousemove",onMouseMove);window.removeEventListener("resize",limitWidth);});watchEffect(()=>{updateOptions();});return{panelWidth,/* methods */onBorderMouseDown,updatePrimaryGrid,/* class getters */gridClasses,leftPrimaryClasses,rightPrimaryClasses};}const _sfc_main$l=defineComponent({name:"FLayoutLeftPanel",components:{FIcon},props:{/**
|
|
587
587
|
* The default width for the panel in pixels
|
|
588
588
|
*/initialWidth:{type:String,default:"320",validator(value){const parsed=parseInt(value,10);return!isNaN(parsed);}}},setup(props){const{initialWidth}=toRefs(props);return useLayoutPanel({initialWidth,minWidth:"150",maxWidth:0.5,grow:"right"});},data(){return{isOpen:true,offsetTop:0};},computed:{navigationStyle(){if(this.isOpen){return{width:`${this.panelWidth}px`,top:`${this.offsetTop}px`};}else{return{top:`${this.offsetTop}px`};}},primaryStyle(){if(this.isOpen){return{"margin-left":`${this.panelWidth}px`};}else{return{"margin-left":`3.5rem`};}},// This is to make word-wrap work in IE11
|
|
589
|
-
contentStyle(){return{"max-width":`${this.panelWidth-35}px`};}},mounted(){const headers=document.getElementsByClassName("layout-application-template__header");const header=headers.item(0);if(header){this.offsetTop=header.offsetHeight;}},methods:{toggleSideNavigation(){this.isOpen=!this.isOpen;window.setTimeout(()=>{this.updatePrimaryGrid();const ref2=this.isOpen?"close-button":"open-button";const element=getElementFromVueRef(this.$refs[ref2]);focus$1(element);},0);}}});const _hoisted_1$j={class:"layout-navigation"};const _hoisted_2$f=["aria-expanded"];const _hoisted_3$d={class:"layout-navigation__navigation__inner"};const _hoisted_4$a=/* @__PURE__ */createElementVNode("span",{class:"sr-only"},"Stäng navigationspanelen",-1/* HOISTED */);const _hoisted_5$a=/* @__PURE__ */createElementVNode("div",null,[/* @__PURE__ */createElementVNode("hr")],-1/* HOISTED */);const _hoisted_6$
|
|
589
|
+
contentStyle(){return{"max-width":`${this.panelWidth-35}px`};}},mounted(){const headers=document.getElementsByClassName("layout-application-template__header");const header=headers.item(0);if(header){this.offsetTop=header.offsetHeight;}},methods:{toggleSideNavigation(){this.isOpen=!this.isOpen;window.setTimeout(()=>{this.updatePrimaryGrid();const ref2=this.isOpen?"close-button":"open-button";const element=getElementFromVueRef(this.$refs[ref2]);focus$1(element);},0);}}});const _hoisted_1$j={class:"layout-navigation"};const _hoisted_2$f=["aria-expanded"];const _hoisted_3$d={class:"layout-navigation__navigation__inner"};const _hoisted_4$a=/* @__PURE__ */createElementVNode("span",{class:"sr-only"},"Stäng navigationspanelen",-1/* HOISTED */);const _hoisted_5$a=/* @__PURE__ */createElementVNode("div",null,[/* @__PURE__ */createElementVNode("hr")],-1/* HOISTED */);const _hoisted_6$7={key:1,class:"layout-navigation__navigation__inner--minimized"};const _hoisted_7$6=/* @__PURE__ */createElementVNode("span",{class:"sr-only"},"Öppna navigationspanelen",-1/* HOISTED */);const _hoisted_8$5=/* @__PURE__ */createElementVNode("div",{class:"layout-navigation__navigation__border__dot"},null,-1/* HOISTED */);const _hoisted_9$4=/* @__PURE__ */createElementVNode("div",{class:"layout-navigation__navigation__border__dot"},null,-1/* HOISTED */);const _hoisted_10$4=/* @__PURE__ */createElementVNode("div",{class:"layout-navigation__navigation__border__dot"},null,-1/* HOISTED */);function _sfc_render$l(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");return openBlock(),createElementBlock("div",_hoisted_1$j,[createElementVNode("nav",{id:"layout-navigation__navigation",class:"layout-navigation__navigation",style:normalizeStyle(_ctx.navigationStyle),"aria-expanded":_ctx.isOpen},[createElementVNode("div",_hoisted_3$d,[_ctx.isOpen?(openBlock(),createElementBlock(Fragment,{key:0},[createElementVNode("div",{class:"layout-navigation__navigation__inner__title",style:normalizeStyle(_ctx.contentStyle)},[renderSlot(_ctx.$slots,"heading"),createTextVNode(),createElementVNode("button",{ref:"close-button",class:"button button--tertiary button--small button--tertiary--black",type:"button",onClick:_cache[0]||(_cache[0]=(...args)=>_ctx.toggleSideNavigation&&_ctx.toggleSideNavigation(...args))},[_hoisted_4$a,createTextVNode(),createVNode(_component_f_icon,{class:"button__icon",name:"chevrons-left"})],512/* NEED_PATCH */)],4/* STYLE */),createTextVNode(),_hoisted_5$a,createTextVNode(),createElementVNode("div",{class:normalizeClass(["layout-navigation__navigation__inner__content scroll-target",_ctx.gridClasses]),style:normalizeStyle(_ctx.contentStyle)},[renderSlot(_ctx.$slots,"content")],6/* CLASS, STYLE */)],64/* STABLE_FRAGMENT */)):createCommentVNode("v-if",true),createTextVNode(),!_ctx.isOpen?(openBlock(),createElementBlock("div",_hoisted_6$7,[createElementVNode("button",{ref:"open-button",class:"button button--tertiary button--tertiary--black",type:"button",onClick:_cache[1]||(_cache[1]=(...args)=>_ctx.toggleSideNavigation&&_ctx.toggleSideNavigation(...args))},[_hoisted_7$6,createTextVNode(),createVNode(_component_f_icon,{class:"button__icon",name:"bars"})],512/* NEED_PATCH */)])):createCommentVNode("v-if",true)]),createTextVNode(),_ctx.isOpen?(openBlock(),createElementBlock("div",{key:0,class:"layout-navigation__navigation__border",onMousedown:_cache[2]||(_cache[2]=(...args)=>_ctx.onBorderMouseDown&&_ctx.onBorderMouseDown(...args))},[_hoisted_8$5,createTextVNode(),_hoisted_9$4,createTextVNode(),_hoisted_10$4],32/* NEED_HYDRATION */)):createCommentVNode("v-if",true)],12,_hoisted_2$f),createTextVNode(),createElementVNode("div",{id:"layout-navigation__primary",class:normalizeClass(["layout-navigation__primary",_ctx.leftPrimaryClasses]),style:normalizeStyle(_ctx.primaryStyle)},[renderSlot(_ctx.$slots,"default")],6/* CLASS, STYLE */)]);}const FLayoutLeftPanel=/* @__PURE__ */_export_sfc(_sfc_main$l,[["render",_sfc_render$l]]);class FRightPanelServiceImpl{constructor(){__publicField(this,"focusedElementBeforeOpenining",null);}open(){this.focusedElementBeforeOpenining=window.document.activeElement;this.emit("open");}openDialog(title){this.focusedElementBeforeOpenining=window.document.activeElement;this.emit("open-dialog",title);}close(){this.emit("close");if(this.focusedElementBeforeOpenining){this.focusedElementBeforeOpenining.focus();}}on(event,callback){EventBus.$on(`application-layout:${event}`,callback);}off(event,callback){EventBus.$off(`application-layout:${event}`,callback);}emit(event,arg){EventBus.$emit(`application-layout:${event}`,arg);}}const FLayoutRightPanelService=new FRightPanelServiceImpl();const _sfc_main$k=defineComponent({name:"FLayoutRightPanel",components:{FIcon},props:{/**
|
|
590
590
|
* The default width for the panel in pixels
|
|
591
591
|
*/initialWidth:{type:String,default:"320"},/**
|
|
592
592
|
* The default maximun width for the panel in percentage where 1 is 100% and 0 is 0%
|
|
593
593
|
*/maxWidth:{type:Number,default:0.5,validator(value){return typeof value==="number"&&value>0&&value<=1;}},/**
|
|
594
594
|
* The default minium width for the panel in pixels
|
|
595
595
|
*/minWidth:{type:String,default:"150"}},setup(props){const{initialWidth,minWidth,maxWidth}=toRefs(props);return useLayoutPanel({initialWidth,minWidth,maxWidth,grow:"left"});},data(){return{isAbsolutePositioned:false,isOpen:false,offsetTop:0};},computed:{secondaryStyle(){if(this.isOpen){return{width:`${this.panelWidth}px`,top:`${this.offsetTop}px`};}return{top:`${this.offsetTop}px`};},primaryStyle(){if(this.isOpen&&!this.isAbsolutePositioned){return{"margin-right":`${this.panelWidth}px`};}return{};},// This is to make word-wrap work in IE11
|
|
596
|
-
contentStyle(){return{"max-width":`${this.panelWidth-35}px`};}},mounted(){const headers=document.getElementsByClassName("layout-application-template__header");const header=headers.item(0);if(header){this.offsetTop=header.offsetHeight;}FLayoutRightPanelService.on("open",this.onOpenSecondary);FLayoutRightPanelService.on("close",this.onCloseSecondary);window.addEventListener("resize",this.onResize);this.onResize();},unmounted(){FLayoutRightPanelService.off("open",this.onOpenSecondary);FLayoutRightPanelService.off("close",this.onCloseSecondary);},methods:{async onOpenSecondary(){this.isOpen=true;await this.$nextTick();const element=getElementFromVueRef(this.$refs["title"]);const heading=element.querySelector("h1, h2, h3, h4, h5, h6");focus$1(heading,{force:true});},onCloseSecondary(){this.isOpen=false;},openSecondary(){FLayoutRightPanelService.open();},onClickCloseSecondary(){FLayoutRightPanelService.close();},onResize(){this.isAbsolutePositioned=window.innerWidth<1280;}}});const _hoisted_1$i={class:"layout-secondary"};const _hoisted_2$e=/* @__PURE__ */createElementVNode("div",{class:"layout-secondary__secondary__border__dot"},null,-1/* HOISTED */);const _hoisted_3$c=/* @__PURE__ */createElementVNode("div",{class:"layout-secondary__secondary__border__dot"},null,-1/* HOISTED */);const _hoisted_4$9=/* @__PURE__ */createElementVNode("div",{class:"layout-secondary__secondary__border__dot"},null,-1/* HOISTED */);const _hoisted_5$9={class:"layout-secondary__secondary__inner"};const _hoisted_6$
|
|
596
|
+
contentStyle(){return{"max-width":`${this.panelWidth-35}px`};}},mounted(){const headers=document.getElementsByClassName("layout-application-template__header");const header=headers.item(0);if(header){this.offsetTop=header.offsetHeight;}FLayoutRightPanelService.on("open",this.onOpenSecondary);FLayoutRightPanelService.on("close",this.onCloseSecondary);window.addEventListener("resize",this.onResize);this.onResize();},unmounted(){FLayoutRightPanelService.off("open",this.onOpenSecondary);FLayoutRightPanelService.off("close",this.onCloseSecondary);},methods:{async onOpenSecondary(){this.isOpen=true;await this.$nextTick();const element=getElementFromVueRef(this.$refs["title"]);const heading=element.querySelector("h1, h2, h3, h4, h5, h6");focus$1(heading,{force:true});},onCloseSecondary(){this.isOpen=false;},openSecondary(){FLayoutRightPanelService.open();},onClickCloseSecondary(){FLayoutRightPanelService.close();},onResize(){this.isAbsolutePositioned=window.innerWidth<1280;}}});const _hoisted_1$i={class:"layout-secondary"};const _hoisted_2$e=/* @__PURE__ */createElementVNode("div",{class:"layout-secondary__secondary__border__dot"},null,-1/* HOISTED */);const _hoisted_3$c=/* @__PURE__ */createElementVNode("div",{class:"layout-secondary__secondary__border__dot"},null,-1/* HOISTED */);const _hoisted_4$9=/* @__PURE__ */createElementVNode("div",{class:"layout-secondary__secondary__border__dot"},null,-1/* HOISTED */);const _hoisted_5$9={class:"layout-secondary__secondary__inner"};const _hoisted_6$6=/* @__PURE__ */createElementVNode("div",null,[/* @__PURE__ */createElementVNode("hr",{"aria-hidden":"true"})],-1/* HOISTED */);const _hoisted_7$5=/* @__PURE__ */createElementVNode("span",{class:"sr-only"},"Stäng sekundärpanelen",-1/* HOISTED */);function _sfc_render$k(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");return openBlock(),createElementBlock("div",_hoisted_1$i,[createElementVNode("div",{id:"layout-secondary__primary",class:normalizeClass(["layout-secondary__primary",_ctx.rightPrimaryClasses]),style:normalizeStyle(_ctx.primaryStyle)},[renderSlot(_ctx.$slots,"default")],6/* CLASS, STYLE */),createTextVNode(),_ctx.isOpen?(openBlock(),createElementBlock("aside",{key:0,style:normalizeStyle(_ctx.secondaryStyle),class:"layout-secondary__secondary"},[createElementVNode("div",{class:"layout-secondary__secondary__border",onMousedown:_cache[0]||(_cache[0]=(...args)=>_ctx.onBorderMouseDown&&_ctx.onBorderMouseDown(...args))},[_hoisted_2$e,createTextVNode(),_hoisted_3$c,createTextVNode(),_hoisted_4$9],32/* NEED_HYDRATION */),createTextVNode(),createElementVNode("div",_hoisted_5$9,[createElementVNode("div",{ref:"title",class:"layout-secondary__secondary__inner__title",style:normalizeStyle(_ctx.contentStyle)},[renderSlot(_ctx.$slots,"heading")],4/* STYLE */),createTextVNode(),_hoisted_6$6,createTextVNode(),createElementVNode("div",{class:normalizeClass(["layout-secondary__secondary__inner__content scroll-target",_ctx.gridClasses]),style:normalizeStyle(_ctx.contentStyle)},[renderSlot(_ctx.$slots,"content"),createTextVNode(),createElementVNode("button",{class:"button button--tertiary button--small button--tertiary--black layout-secondary__secondary__inner__close",type:"button",onClick:_cache[1]||(_cache[1]=(...args)=>_ctx.onClickCloseSecondary&&_ctx.onClickCloseSecondary(...args))},[_hoisted_7$5,createTextVNode(),createVNode(_component_f_icon,{class:"button__icon",name:"close"})])],6/* CLASS, STYLE */)])],4/* STYLE */)):createCommentVNode("v-if",true)]);}const FLayoutRightPanel=/* @__PURE__ */_export_sfc(_sfc_main$k,[["render",_sfc_render$k]]);const _sfc_main$j=defineComponent({name:"FList",components:{FCheckboxField},mixins:[TranslationMixin],props:{/**
|
|
597
597
|
* The items to be listed.
|
|
598
598
|
* The items will be listed in the given array order.
|
|
599
599
|
*/items:{type:Array,required:true},/**
|
|
@@ -619,7 +619,7 @@ getItemId(item){return`${this.elementId}_item_${this.itemKey(item)}`;},// Focus
|
|
|
619
619
|
// By setting position to relative the
|
|
620
620
|
// item and box-shadow is drawn with a higher z-index,
|
|
621
621
|
// thus no focus border under other list items.
|
|
622
|
-
onItemFocus(event){if(event&&event.target){event.target.style.position="relative";}},onItemBlur(event){if(event&&event.target){event.target.style.position="static";}},callbackAfterItemAdd(item){this.setActiveItem(item);},callbackBeforeItemDelete(item){if(this.items.length===0){return;}let targetIndex=this.items.indexOf(item)-1;if(targetIndex<0&&this.items.length>1){targetIndex=1;}else if(targetIndex<0){targetIndex=0;}this.setActiveItem(this.items[targetIndex]);if(this.getLiElements()[targetIndex]){this.getLiElements()[targetIndex].focus();}},isActive(item){return this.checkbox&&itemEquals(this.activeItem,item,this.keyAttribute);}}});const _hoisted_1$h={key:0,class:"list"};const _hoisted_2$d={key:0,class:"list__item"};const _hoisted_3$b={class:"list__item__itempane"};const _hoisted_4$8=["tabindex"];const _hoisted_5$8=["id","aria-labelledby","tabindex","onKeydown"];const _hoisted_6$
|
|
622
|
+
onItemFocus(event){if(event&&event.target){event.target.style.position="relative";}},onItemBlur(event){if(event&&event.target){event.target.style.position="static";}},callbackAfterItemAdd(item){this.setActiveItem(item);},callbackBeforeItemDelete(item){if(this.items.length===0){return;}let targetIndex=this.items.indexOf(item)-1;if(targetIndex<0&&this.items.length>1){targetIndex=1;}else if(targetIndex<0){targetIndex=0;}this.setActiveItem(this.items[targetIndex]);if(this.getLiElements()[targetIndex]){this.getLiElements()[targetIndex].focus();}},isActive(item){return this.checkbox&&itemEquals(this.activeItem,item,this.keyAttribute);}}});const _hoisted_1$h={key:0,class:"list"};const _hoisted_2$d={key:0,class:"list__item"};const _hoisted_3$b={class:"list__item__itempane"};const _hoisted_4$8=["tabindex"];const _hoisted_5$8=["id","aria-labelledby","tabindex","onKeydown"];const _hoisted_6$5=["onClick"];const _hoisted_7$4={class:"list__item__selectpane__input"};const _hoisted_8$4=["id"];const _hoisted_9$3={key:0,class:"list__item"};const _hoisted_10$3={class:"list__item__itempane"};function _sfc_render$j(_ctx,_cache,$props,$setup,$data,$options){const _component_f_checkbox_field=resolveComponent("f-checkbox-field");return!_ctx.selectable?(openBlock(),createElementBlock("ul",_hoisted_1$h,[(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.items,item=>{return openBlock(),createElementBlock("li",{key:_ctx.itemKey(item),class:"list__item"},[createElementVNode("div",{ref_for:true,ref:"listItemPanes",class:"list__item__itempane"},[renderSlot(_ctx.$slots,"default",mergeProps({ref_for:true},{item}))],512/* NEED_PATCH */)]);}),128/* KEYED_FRAGMENT */)),createTextVNode(),_ctx.isEmpty?(openBlock(),createElementBlock("li",_hoisted_2$d,[createElementVNode("div",_hoisted_3$b,[renderSlot(_ctx.$slots,"empty",{},()=>[createElementVNode("em",null,toDisplayString(_ctx.$t("fkui.list.empty","Listan är tom")),1/* TEXT */)])])])):createCommentVNode("v-if",true)])):(openBlock(),createElementBlock("ul",{key:1,ref:"ulElement",class:"list list--hover",tabindex:_ctx.checkbox?0:void 0},[(openBlock(true),createElementBlock(Fragment,null,renderList(_ctx.items,(item,index)=>{return openBlock(),createElementBlock("li",{id:_ctx.getItemId(item),key:_ctx.itemKey(item),"aria-labelledby":_ctx.getItemId(item),class:normalizeClass([_ctx.itemClasses(item),"list__item"]),tabindex:_ctx.checkbox?0:void 0,onKeydown:withModifiers($event=>_ctx.onItemKeyDown($event,item),["self"]),onFocus:_cache[0]||(_cache[0]=withModifiers((...args)=>_ctx.onItemFocus&&_ctx.onItemFocus(...args),["self"])),onBlur:_cache[1]||(_cache[1]=withModifiers((...args)=>_ctx.onItemBlur&&_ctx.onItemBlur(...args),["self"]))},[_ctx.checkbox?(openBlock(),createElementBlock("div",{key:0,class:"list__item__selectpane",onClick:withModifiers($event=>_ctx.onSelect(item),["self"])},[createElementVNode("div",_hoisted_7$4,[createVNode(_component_f_checkbox_field,{value:true,"model-value":_ctx.isSelected(item),onClick:withModifiers($event=>_ctx.onSelect(item),["self"])},{default:withCtx(()=>[createElementVNode("span",{id:_ctx.getAriaLabelledbyId(item),class:"sr-only"},[renderSlot(_ctx.$slots,"screenreader",mergeProps({ref_for:true},{item}))],8,_hoisted_8$4)]),_:2/* DYNAMIC */},1032,["model-value","onClick"])])],8,_hoisted_6$5)):createCommentVNode("v-if",true),createTextVNode(),(openBlock(),createBlock(resolveDynamicComponent(_ctx.checkbox?"div":"a"),{ref_for:true,ref:"listItemPanes",href:!_ctx.checkbox?"javascript:":void 0,class:"list__item__itempane",onClick:$event=>_ctx.onItemClick($event,index,item)},{default:withCtx(()=>[renderSlot(_ctx.$slots,"default",mergeProps({ref_for:true},{item}))]),_:2/* DYNAMIC */},1032,["href","onClick"]))],42,_hoisted_5$8);}),128/* KEYED_FRAGMENT */)),createTextVNode(),_ctx.isEmpty?(openBlock(),createElementBlock("li",_hoisted_9$3,[createElementVNode("div",_hoisted_10$3,[renderSlot(_ctx.$slots,"empty",{},()=>[createElementVNode("em",null,toDisplayString(_ctx.$t("fkui.list.empty","Listan är tom")),1/* TEXT */)])])])):createCommentVNode("v-if",true)],8,_hoisted_4$8));}const FList=/* @__PURE__ */_export_sfc(_sfc_main$j,[["render",_sfc_render$j]]);const _sfc_main$i=defineComponent({name:"FLoader",mixins:[TranslationMixin],inheritAttrs:false,props:{/* Aria-live must always be visible, hence v-if on component level is not possible, therefore we use show-prop *//**
|
|
623
623
|
* Determine if the loader is visible or not
|
|
624
624
|
*/show:{type:Boolean,required:true,default:false},/**
|
|
625
625
|
* If loader should be displayed as a fullscreen overlay.
|
|
@@ -689,7 +689,7 @@ onItemFocus(event){if(event&&event.target){event.target.style.position="relative
|
|
|
689
689
|
* @event update:route
|
|
690
690
|
* @param route
|
|
691
691
|
* @type {string}
|
|
692
|
-
*/"update:route"],data(){return{overflowIndex:-1,ignoreNoOverflow:false,selectedMenuItemKey:"",selectedPopupItemKey:"",popupAnchor:this.$el,popupOpen:false,currentFocusedItemIndex:0,focusedMenuItemKey:"",focusedPopupMenuItemKey:"",initPopupNavigationIndex:true};},computed:{items(){return this.routes.map(i=>({label:i.label,key:i.route,href:i.href,target:i.target}));},visibleItems(){if(this.overflowIndex>-1){const visibleItems=this.items.slice(0,this.overflowIndex);visibleItems.push({label:this.$t("fkui.navigation-menu.more-text","Mer"),key:menuMoreKey,iconRight:"arrow-down",ariaHasPopup:true,srMenuMoreTextContents:this.menuMoreScreenReaderText,srMenuMoreTextSelectedContents:this.menuMoreWithSelectedItemsSrText()});return visibleItems;}else{return this.items;}},popupItems(){return this.overflowIndex>-1?this.items.slice(this.overflowIndex):[];},hasPopupMenuSelectedItems(){return this.selectedPopupItemKey!=="";}},watch:{route:{async handler(value){const itemIndex=isSet(value)?this.indexOfItemByKey(this.items,value):-1;if(itemIndex<0){await this.activateItem(-1);return;}const isWithinMoreMenu=!this.findItemByKey(this.visibleItems,value);if(isWithinMoreMenu){const item=this.items[itemIndex];await this.activateInvisibleItem(item);}else{await this.activateItem(itemIndex);}},immediate:true}},mounted(){this.currentFocusedItemIndex=0;},methods:{selectedMenuItemSrText(){if(this.selectedMenuItemScreenReaderText===""){return this.$t("fkui.navigation-menu.current-page","Aktuell sida");}else{return this.selectedMenuItemScreenReaderText;}},menuMoreWithSelectedItemsSrText(){if(this.menuMoreWithSelectedItemsScreenReaderText===""){return this.$t("fkui.navigation-menu.more-selection","underliggande vald nu");}else{return this.menuMoreWithSelectedItemsScreenReaderText;}},findItemByKey(items,key){return items.find(it=>it.key===key);},indexOfItemByKey(items,key){return items.findIndex(it=>it.key===key);},async onOverflow(index){const ignore=this.ignoreNoOverflow;const shouldReset=index===-1&&ignore;const shouldIgnore=index>=0;if(shouldReset){this.ignoreNoOverflow=false;return;}if(shouldIgnore){this.ignoreNoOverflow=true;}this.updateOverflowIndex(index);await this.refreshSelectedItem();const shouldClosePopup=this.overflowIndex>-1&&!this.ignoreNoOverflow;if(shouldClosePopup){await this.setPopupOpen(false);}},async refreshSelectedItem(){const popupStatus=this.popupOpen;if(this.overflowIndex===-1){if(this.visibleItems.some(i=>i.key===this.selectedPopupItemKey)){this.selectedMenuItemKey=this.selectedPopupItemKey;this.selectedPopupItemKey="";}}else{if(this.popupItems.some(i=>i.key===this.selectedMenuItemKey)){var _ref3;this.selectedPopupItemKey=this.selectedMenuItemKey;const lastItem=this.visibleItems.at(-1);this.selectedMenuItemKey=(_ref3=lastItem==null?void 0:lastItem.key)!==null&&_ref3!==void 0?_ref3:"";}}await this.setPopupOpen(popupStatus);},async doSelectItem(key){if(key!==menuMoreKey){this.$emit("update:route",key);this.$emit("selectedRoute",key);}let index=-1;if(this.hasOverflow()){index=this.indexOfItemByKey(this.visibleItems,key);if(index===-1){index=this.indexOfItemByKey(this.items,key);}}else{index=this.indexOfItemByKey(this.items,key);}},async onSelectMenu(key){await this.doSelectItem(key);if(key!==menuMoreKey){if(this.findItemByKey(this.visibleItems,key)&&this.selectedPopupItemKey!==""){this.focusedPopupMenuItemKey="";this.selectedPopupItemKey="";}}else{const anchor=getHTMLElementFromVueRef(this.$refs.menu).querySelector("li:last-child");if(anchor){this.popupAnchor=anchor;}await this.setPopupOpen(true);}},async onSelectPopup(key){await this.setPopupOpen(false);await this.doSelectItem(key);},async onClosePopup(){await this.setPopupOpen(false);},async setPopupOpen(value){if(value){this.focusedPopupMenuItemKey="";}else{this.initPopupNavigationIndex=true;}this.popupOpen=value;await this.$nextTick();},updateOverflowIndex(index){this.overflowIndex=calcOverflowIndexFromIndex(index);},onKeyUp(event){if(preventKeys.includes(event.key)){event.preventDefault();}},doHandleMenuTabKey(action){if(this.hasOverflow()){if(action===MenuAction.MOVE_NEXT&&this.currentFocusedItemIndex+1===this.visibleItems.length){return true;}if(action===MenuAction.MOVE_PREV&&this.currentFocusedItemIndex-1===-1){return true;}}else{if(action===MenuAction.MOVE_NEXT&&this.currentFocusedItemIndex+1===this.items.length){return true;}if(action===MenuAction.MOVE_PREV&&this.currentFocusedItemIndex-1===-1){return true;}}return false;},async doHandlePopupMenuTabKey(action){if(action===MenuAction.MOVE_NEXT&&this.currentFocusedItemIndex+1===this.items.length){await this.setPopupOpen(false);return true;}else if(action===MenuAction.MOVE_NEXT&&this.currentFocusedItemIndex===this.overflowIndex){if(this.initPopupNavigationIndex){this.initPopupNavigationIndex=!this.initPopupNavigationIndex;this.setCurrentFocusedItemIndex(this.overflowIndex-1);return false;}}else if(action===MenuAction.MOVE_PREV&&this.currentFocusedItemIndex===this.overflowIndex){await this.setPopupOpen(false);this.setCurrentFocusedItemIndex(this.overflowIndex-1);return false;}return false;},setCurrentFocusedItemIndex(value){this.currentFocusedItemIndex=value;},doInitPopupNavigationIndex(event){if(keyDown.includes(event.key)||event.key==="Tab"){this.setCurrentFocusedItemIndex(this.overflowIndex-1);}else if(keyUp.includes(event.key)){this.setCurrentFocusedItemIndex(this.items.length+1);}},async onKeyDown(event){if(event.key==="Escape"){await this.setPopupOpen(false);return;}let action=actionFromKeyboardEvent(event);if(action===null){return;}if(!this.popupOpen){if(event.key==="Tab"&&this.doHandleMenuTabKey(action)){return;}event.preventDefault();await doMenuAction(action,this,0,this.visibleItems.length);}else{if(event.key==="Tab"&&(await this.doHandlePopupMenuTabKey(action))){return;}event.preventDefault();if(action===MenuAction.ACTIVATE&&this.focusedPopupMenuItemKey===""){action=null;await this.setPopupOpen(false);return;}if(this.initPopupNavigationIndex&&arrowKeys.includes(event.key)){this.initPopupNavigationIndex=!this.initPopupNavigationIndex;this.doInitPopupNavigationIndex(event);}await doMenuAction(action,this,this.overflowIndex,this.items.length);}},async setFocusOnItem(index){var _a,_b;this.setFocusedItemIndex(index);if(!this.hasOverflow()||!this.popupOpen&&index<=this.overflowIndex){this.setFocusedMenuItemKey(((_a=this.visibleItems[index])==null?void 0:_a.key)||"");}else{await this.setFocusedPopupMenuItemKey(((_b=this.items[index])==null?void 0:_b.key)||"");}},hasOverflow(){return this.overflowIndex!==-1;},async activateItem(index){var _a,_b;if(!this.hasOverflow()||!this.popupOpen&&index<=this.overflowIndex){const key=((_a=this.visibleItems[index])==null?void 0:_a.key)||"";await this.setSelectedMenuItemKey(key);await this.onSelectMenu(key);}else{const key=((_b=this.items[index])==null?void 0:_b.key)||"";this.selectedPopupItemKey=key;await this.onSelectPopup(key);}},async activateInvisibleItem(item){await this.setSelectedMenuItemKey(menuMoreKey);await this.onSelectMenu(menuMoreKey);this.selectedPopupItemKey=item.key;await this.onSelectPopup(item.key);if(item.href){const anchor=document.createElement("a");anchor.href=item.href;if(item.target){anchor.target=item.target;}anchor.click();}},setFocusedItemIndex(index){if(index<0){return;}if(!this.popupOpen&&this.hasOverflow()&&index>this.overflowIndex){this.setCurrentFocusedItemIndex(this.overflowIndex);}else{this.setCurrentFocusedItemIndex(index);}},async setFocusedPopupMenuItemKey(key){this.focusedPopupMenuItemKey="";if(key!==""){await this.$nextTick();this.focusedPopupMenuItemKey=key;}},setFocusedMenuItemKey(key){this.focusedMenuItemKey=key;},async setSelectedMenuItemKey(key){this.selectedMenuItemKey="";if(key!==""){await this.$nextTick();this.selectedMenuItemKey=key;}}}});function _sfc_render$f(_ctx,_cache,$props,$setup,$data,$options){const _component_i_menu=resolveComponent("i-menu");const _component_i_popup_menu=resolveComponent("i-popup-menu");return openBlock(),createElementBlock("div",null,[createVNode(_component_i_menu,{ref:"menu",modelValue:_ctx.selectedMenuItemKey,"onUpdate:modelValue":_cache[0]||(_cache[0]=$event=>_ctx.selectedMenuItemKey=$event),items:_ctx.visibleItems,vertical:_ctx.vertical,"focused-item-key":_ctx.focusedMenuItemKey,"selected-menu-item-screen-reader-text":_ctx.selectedMenuItemSrText(),"has-menu-more-selected-items":_ctx.hasPopupMenuSelectedItems,"aria-label":_ctx.menuAriaLabel,onSelect:_ctx.onSelectMenu,onOverflow:_ctx.onOverflow,onKeyup:_ctx.onKeyUp,onKeydown:_ctx.onKeyDown},null,8,["modelValue","items","vertical","focused-item-key","selected-menu-item-screen-reader-text","has-menu-more-selected-items","aria-label","onSelect","onOverflow","onKeyup","onKeydown"]),createTextVNode(),createVNode(_component_i_popup_menu,{ref:"popupMenu",modelValue:_ctx.selectedPopupItemKey,"onUpdate:modelValue":_cache[1]||(_cache[1]=$event=>_ctx.selectedPopupItemKey=$event),items:_ctx.popupItems,"is-open":_ctx.popupOpen,anchor:_ctx.popupAnchor,"focused-item-key":_ctx.focusedPopupMenuItemKey,"selected-menu-item-screen-reader-text":_ctx.selectedMenuItemSrText(),"aria-label":_ctx.popupAriaLabel,onSelect:_ctx.onSelectPopup,onClose:_ctx.onClosePopup,onKeyup:_ctx.onKeyUp,onKeydown:_ctx.onKeyDown},null,8,["modelValue","items","is-open","anchor","focused-item-key","selected-menu-item-screen-reader-text","aria-label","onSelect","onClose","onKeyup","onKeydown"])]);}const FNavigationMenu=/* @__PURE__ */_export_sfc(_sfc_main$f,[["render",_sfc_render$f]]);const EVENTS=["online","offline"];const _sfc_main$e=defineComponent({name:"FOffline",components:{FIcon},data(){return{isOnline:navigator.onLine||false,role:"none",shouldNotRead:true};},created(){EVENTS.forEach(event=>{window.addEventListener(event,this.updateOnlineStatus);});},beforeUnmount(){EVENTS.forEach(event=>{window.removeEventListener(event,this.updateOnlineStatus);});},mounted(){document.body.prepend(getElementFromVueRef(this.$refs.offline));},methods:{updateOnlineStatus(event){switch(event.type){case"online":this.shouldNotRead=false;this.isOnline=true;break;case"offline":this.shouldNotRead=true;this.isOnline=false;break;default:this.shouldNotRead=true;this.isOnline=false;break;}this.role="alert";}}});const _hoisted_1$d=["role"];const _hoisted_2$9={key:0,class:"offline"};const _hoisted_3$7={class:"offline__icon"};const _hoisted_4$5={class:"icon-stack icon-stack--error"};const _hoisted_5$5={class:"offline__content"};const _hoisted_6$5=["aria-hidden"];function _sfc_render$e(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");return openBlock(),createElementBlock("div",{ref:"offline",class:"offline__wrapper",role:_ctx.role},[!_ctx.isOnline?(openBlock(),createElementBlock("div",_hoisted_2$9,[createElementVNode("span",_hoisted_3$7,[createElementVNode("span",_hoisted_4$5,[createVNode(_component_f_icon,{name:"triangle"}),createTextVNode(),createVNode(_component_f_icon,{name:"alert"})])]),createTextVNode(),createElementVNode("p",_hoisted_5$5,[renderSlot(_ctx.$slots,"default",{},()=>[createTextVNode(" Det verkar som att du inte har någon internetuppkoppling just nu ")])])])):createCommentVNode("v-if",true),createTextVNode(),withDirectives(createElementVNode("span",{class:"sr-only","aria-hidden":_ctx.shouldNotRead?"true":void 0},"\n Din internetuppkoppling fungerar igen\n ",8,_hoisted_6$5),[[vShow,_ctx.isOnline]])],8,_hoisted_1$d);}const FOffline=/* @__PURE__ */_export_sfc(_sfc_main$e,[["render",_sfc_render$e]]);const _sfc_main$d=defineComponent({name:"FOutputField",components:{FLabel},inheritAttrs:false,props:{/**
|
|
692
|
+
*/"update:route"],data(){return{overflowIndex:-1,ignoreNoOverflow:false,selectedMenuItemKey:"",selectedPopupItemKey:"",popupAnchor:this.$el,popupOpen:false,currentFocusedItemIndex:0,focusedMenuItemKey:"",focusedPopupMenuItemKey:"",initPopupNavigationIndex:true};},computed:{items(){return this.routes.map(i=>({label:i.label,key:i.route,href:i.href,target:i.target}));},visibleItems(){if(this.overflowIndex>-1){const visibleItems=this.items.slice(0,this.overflowIndex);visibleItems.push({label:this.$t("fkui.navigation-menu.more-text","Mer"),key:menuMoreKey,iconRight:"arrow-down",ariaHasPopup:true,srMenuMoreTextContents:this.menuMoreScreenReaderText,srMenuMoreTextSelectedContents:this.menuMoreWithSelectedItemsSrText()});return visibleItems;}else{return this.items;}},popupItems(){return this.overflowIndex>-1?this.items.slice(this.overflowIndex):[];},hasPopupMenuSelectedItems(){return this.selectedPopupItemKey!=="";}},watch:{route:{async handler(value){const itemIndex=isSet(value)?this.indexOfItemByKey(this.items,value):-1;if(itemIndex<0){await this.activateItem(-1);return;}const isWithinMoreMenu=!this.findItemByKey(this.visibleItems,value);if(isWithinMoreMenu){const item=this.items[itemIndex];await this.activateInvisibleItem(item);}else{await this.activateItem(itemIndex);}},immediate:true}},mounted(){this.currentFocusedItemIndex=0;},methods:{selectedMenuItemSrText(){if(this.selectedMenuItemScreenReaderText===""){return this.$t("fkui.navigation-menu.current-page","Aktuell sida");}else{return this.selectedMenuItemScreenReaderText;}},menuMoreWithSelectedItemsSrText(){if(this.menuMoreWithSelectedItemsScreenReaderText===""){return this.$t("fkui.navigation-menu.more-selection","underliggande vald nu");}else{return this.menuMoreWithSelectedItemsScreenReaderText;}},findItemByKey(items,key){return items.find(it=>it.key===key);},indexOfItemByKey(items,key){return items.findIndex(it=>it.key===key);},async onOverflow(index){const ignore=this.ignoreNoOverflow;const shouldReset=index===-1&&ignore;const shouldIgnore=index>=0;if(shouldReset){this.ignoreNoOverflow=false;return;}if(shouldIgnore){this.ignoreNoOverflow=true;}this.updateOverflowIndex(index);await this.refreshSelectedItem();const shouldClosePopup=this.overflowIndex>-1&&!this.ignoreNoOverflow;if(shouldClosePopup){await this.setPopupOpen(false);}},async refreshSelectedItem(){const popupStatus=this.popupOpen;if(this.overflowIndex===-1){if(this.visibleItems.some(i=>i.key===this.selectedPopupItemKey)){this.selectedMenuItemKey=this.selectedPopupItemKey;this.selectedPopupItemKey="";}}else{if(this.popupItems.some(i=>i.key===this.selectedMenuItemKey)){var _ref3;this.selectedPopupItemKey=this.selectedMenuItemKey;const lastItem=this.visibleItems.at(-1);this.selectedMenuItemKey=(_ref3=lastItem==null?void 0:lastItem.key)!==null&&_ref3!==void 0?_ref3:"";}}await this.setPopupOpen(popupStatus);},async doSelectItem(key){if(key!==menuMoreKey){this.$emit("update:route",key);this.$emit("selectedRoute",key);}let index=-1;if(this.hasOverflow()){index=this.indexOfItemByKey(this.visibleItems,key);if(index===-1){index=this.indexOfItemByKey(this.items,key);}}else{index=this.indexOfItemByKey(this.items,key);}},async onSelectMenu(key){await this.doSelectItem(key);if(key!==menuMoreKey){if(this.findItemByKey(this.visibleItems,key)&&this.selectedPopupItemKey!==""){this.focusedPopupMenuItemKey="";this.selectedPopupItemKey="";}}else{const anchor=getHTMLElementFromVueRef(this.$refs.menu).querySelector("li:last-child");if(anchor){this.popupAnchor=anchor;}await this.setPopupOpen(true);}},async onSelectPopup(key){await this.setPopupOpen(false);await this.doSelectItem(key);},async onClosePopup(){await this.setPopupOpen(false);},async setPopupOpen(value){if(value){this.focusedPopupMenuItemKey="";}else{this.initPopupNavigationIndex=true;}this.popupOpen=value;await this.$nextTick();},updateOverflowIndex(index){this.overflowIndex=calcOverflowIndexFromIndex(index);},onKeyUp(event){if(preventKeys.includes(event.key)){event.preventDefault();}},doHandleMenuTabKey(action){if(this.hasOverflow()){if(action===MenuAction.MOVE_NEXT&&this.currentFocusedItemIndex+1===this.visibleItems.length){return true;}if(action===MenuAction.MOVE_PREV&&this.currentFocusedItemIndex-1===-1){return true;}}else{if(action===MenuAction.MOVE_NEXT&&this.currentFocusedItemIndex+1===this.items.length){return true;}if(action===MenuAction.MOVE_PREV&&this.currentFocusedItemIndex-1===-1){return true;}}return false;},async doHandlePopupMenuTabKey(action){if(action===MenuAction.MOVE_NEXT&&this.currentFocusedItemIndex+1===this.items.length){await this.setPopupOpen(false);return true;}else if(action===MenuAction.MOVE_NEXT&&this.currentFocusedItemIndex===this.overflowIndex){if(this.initPopupNavigationIndex){this.initPopupNavigationIndex=!this.initPopupNavigationIndex;this.setCurrentFocusedItemIndex(this.overflowIndex-1);return false;}}else if(action===MenuAction.MOVE_PREV&&this.currentFocusedItemIndex===this.overflowIndex){await this.setPopupOpen(false);this.setCurrentFocusedItemIndex(this.overflowIndex-1);return false;}return false;},setCurrentFocusedItemIndex(value){this.currentFocusedItemIndex=value;},doInitPopupNavigationIndex(event){if(keyDown.includes(event.key)||event.key==="Tab"){this.setCurrentFocusedItemIndex(this.overflowIndex-1);}else if(keyUp.includes(event.key)){this.setCurrentFocusedItemIndex(this.items.length+1);}},async onKeyDown(event){if(event.key==="Escape"){await this.setPopupOpen(false);return;}let action=actionFromKeyboardEvent(event);if(action===null){return;}if(!this.popupOpen){if(event.key==="Tab"&&this.doHandleMenuTabKey(action)){return;}event.preventDefault();await doMenuAction(action,this,0,this.visibleItems.length);}else{if(event.key==="Tab"&&(await this.doHandlePopupMenuTabKey(action))){return;}event.preventDefault();if(action===MenuAction.ACTIVATE&&this.focusedPopupMenuItemKey===""){action=null;await this.setPopupOpen(false);return;}if(this.initPopupNavigationIndex&&arrowKeys.includes(event.key)){this.initPopupNavigationIndex=!this.initPopupNavigationIndex;this.doInitPopupNavigationIndex(event);}await doMenuAction(action,this,this.overflowIndex,this.items.length);}},async setFocusOnItem(index){var _a,_b;this.setFocusedItemIndex(index);if(!this.hasOverflow()||!this.popupOpen&&index<=this.overflowIndex){this.setFocusedMenuItemKey(((_a=this.visibleItems[index])==null?void 0:_a.key)||"");}else{await this.setFocusedPopupMenuItemKey(((_b=this.items[index])==null?void 0:_b.key)||"");}},hasOverflow(){return this.overflowIndex!==-1;},async activateItem(index){var _a,_b;if(!this.hasOverflow()||!this.popupOpen&&index<=this.overflowIndex){const key=((_a=this.visibleItems[index])==null?void 0:_a.key)||"";await this.setSelectedMenuItemKey(key);await this.onSelectMenu(key);}else{const key=((_b=this.items[index])==null?void 0:_b.key)||"";this.selectedPopupItemKey=key;await this.onSelectPopup(key);}},async activateInvisibleItem(item){await this.setSelectedMenuItemKey(menuMoreKey);await this.onSelectMenu(menuMoreKey);this.selectedPopupItemKey=item.key;await this.onSelectPopup(item.key);if(item.href){const anchor=document.createElement("a");anchor.href=item.href;if(item.target){anchor.target=item.target;}anchor.click();}},setFocusedItemIndex(index){if(index<0){return;}if(!this.popupOpen&&this.hasOverflow()&&index>this.overflowIndex){this.setCurrentFocusedItemIndex(this.overflowIndex);}else{this.setCurrentFocusedItemIndex(index);}},async setFocusedPopupMenuItemKey(key){this.focusedPopupMenuItemKey="";if(key!==""){await this.$nextTick();this.focusedPopupMenuItemKey=key;}},setFocusedMenuItemKey(key){this.focusedMenuItemKey=key;},async setSelectedMenuItemKey(key){this.selectedMenuItemKey="";if(key!==""){await this.$nextTick();this.selectedMenuItemKey=key;}}}});function _sfc_render$f(_ctx,_cache,$props,$setup,$data,$options){const _component_i_menu=resolveComponent("i-menu");const _component_i_popup_menu=resolveComponent("i-popup-menu");return openBlock(),createElementBlock("div",null,[createVNode(_component_i_menu,{ref:"menu",modelValue:_ctx.selectedMenuItemKey,"onUpdate:modelValue":_cache[0]||(_cache[0]=$event=>_ctx.selectedMenuItemKey=$event),items:_ctx.visibleItems,vertical:_ctx.vertical,"focused-item-key":_ctx.focusedMenuItemKey,"selected-menu-item-screen-reader-text":_ctx.selectedMenuItemSrText(),"has-menu-more-selected-items":_ctx.hasPopupMenuSelectedItems,"aria-label":_ctx.menuAriaLabel,onSelect:_ctx.onSelectMenu,onOverflow:_ctx.onOverflow,onKeyup:_ctx.onKeyUp,onKeydown:_ctx.onKeyDown},null,8,["modelValue","items","vertical","focused-item-key","selected-menu-item-screen-reader-text","has-menu-more-selected-items","aria-label","onSelect","onOverflow","onKeyup","onKeydown"]),createTextVNode(),createVNode(_component_i_popup_menu,{ref:"popupMenu",modelValue:_ctx.selectedPopupItemKey,"onUpdate:modelValue":_cache[1]||(_cache[1]=$event=>_ctx.selectedPopupItemKey=$event),items:_ctx.popupItems,"is-open":_ctx.popupOpen,anchor:_ctx.popupAnchor,"focused-item-key":_ctx.focusedPopupMenuItemKey,"selected-menu-item-screen-reader-text":_ctx.selectedMenuItemSrText(),"aria-label":_ctx.popupAriaLabel,onSelect:_ctx.onSelectPopup,onClose:_ctx.onClosePopup,onKeyup:_ctx.onKeyUp,onKeydown:_ctx.onKeyDown},null,8,["modelValue","items","is-open","anchor","focused-item-key","selected-menu-item-screen-reader-text","aria-label","onSelect","onClose","onKeyup","onKeydown"])]);}const FNavigationMenu=/* @__PURE__ */_export_sfc(_sfc_main$f,[["render",_sfc_render$f]]);const EVENTS=["online","offline"];const _sfc_main$e=defineComponent({name:"FOffline",components:{FIcon,IFlex,IFlexItem},data(){return{isOnline:navigator.onLine||false,role:"none",shouldNotRead:true};},created(){EVENTS.forEach(event=>{window.addEventListener(event,this.updateOnlineStatus);});},beforeUnmount(){EVENTS.forEach(event=>{window.removeEventListener(event,this.updateOnlineStatus);});},mounted(){document.body.prepend(getElementFromVueRef(this.$refs.offline));},methods:{updateOnlineStatus(event){switch(event.type){case"online":this.shouldNotRead=false;this.isOnline=true;break;case"offline":this.shouldNotRead=true;this.isOnline=false;break;default:this.shouldNotRead=true;this.isOnline=false;break;}this.role="alert";}}});const _hoisted_1$d=["role"];const _hoisted_2$9={key:0,class:"offline"};const _hoisted_3$7={class:"icon-stack icon-stack--error"};const _hoisted_4$5={class:"offline__content"};const _hoisted_5$5=["aria-hidden"];function _sfc_render$e(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=resolveComponent("f-icon");const _component_i_flex_item=resolveComponent("i-flex-item");const _component_i_flex=resolveComponent("i-flex");return openBlock(),createElementBlock("div",{ref:"offline",class:"offline__wrapper",role:_ctx.role},[!_ctx.isOnline?(openBlock(),createElementBlock("div",_hoisted_2$9,[createVNode(_component_i_flex,{gap:"2x"},{default:withCtx(()=>[createVNode(_component_i_flex_item,{class:"offline__icon",shrink:"",align:"center"},{default:withCtx(()=>[createElementVNode("span",_hoisted_3$7,[createVNode(_component_f_icon,{name:"triangle"}),createTextVNode(),createVNode(_component_f_icon,{name:"alert"})])]),_:1/* STABLE */}),createTextVNode(),createVNode(_component_i_flex_item,{class:"offline_content",grow:"",align:"center"},{default:withCtx(()=>[createElementVNode("p",_hoisted_4$5,[renderSlot(_ctx.$slots,"default",{},()=>[createTextVNode(" Det verkar som att du inte har någon internetuppkoppling just nu ")])])]),_:3/* FORWARDED */})]),_:3/* FORWARDED */})])):createCommentVNode("v-if",true),createTextVNode(),withDirectives(createElementVNode("span",{class:"sr-only","aria-hidden":_ctx.shouldNotRead?"true":void 0},"\n Din internetuppkoppling fungerar igen\n ",8,_hoisted_5$5),[[vShow,_ctx.isOnline]])],8,_hoisted_1$d);}const FOffline=/* @__PURE__ */_export_sfc(_sfc_main$e,[["render",_sfc_render$e]]);const _sfc_main$d=defineComponent({name:"FOutputField",components:{FLabel},inheritAttrs:false,props:{/**
|
|
693
693
|
* Associate the output field with one or more id's of the elements
|
|
694
694
|
* contributing or affecting the result of this field. Multiple id's can
|
|
695
695
|
* be set with a space-separated string or an array of strings.
|