@fkui/vue 5.37.0 → 5.37.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs.js +59 -34
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/esm/index.esm.js +60 -35
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/types/index.d.ts +82 -60
- package/package.json +10 -10
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -164,7 +164,7 @@ isIndex(key,length)))){result.push(key);}}return result;}var _arrayLikeKeys=arra
|
|
|
164
164
|
*/beforeSubmit:{type:Function,required:false,default(){}},/**
|
|
165
165
|
* If given, this function is called before the form data is validated and the [[submit]] event is emitted.
|
|
166
166
|
* See <f-validation-form> `beforeValidation` props for more info.
|
|
167
|
-
*/beforeValidation:{type:Function,required:false,default(){}},buttons:{type:Array,required:false,default:()=>[{label:logic.TranslationService.provider.translate("fkui.form-modal.button.submit.text","Spara"),event:"submit",type:"primary",submitButton:true},{label:logic.TranslationService.provider.translate("fkui.form-modal.button.cancel.text","Avbryt"),event:"dismiss",type:"secondary"}]}},emits:["cancel","close","submit"],data(){return{};},computed:{preparedButtons(){return prepareButtonList(this.buttons,FKUIConfigButtonOrder.LEFT_TO_RIGHT);},hasDeprecatedSlots(){return hasSlot(this,"cancel-button-text")||hasSlot(this,"submit-button-text");}},methods:{onClose(){logic.ValidationService.resetState(this.$el);this.$emit("cancel");this.$emit("close",{reason:"close"});},async onSubmit(){logic.ValidationService.resetState(this.$el);this.$emit("submit",{data:this.value});this.$emit("close",{reason:"submit",data:this.value});},onCancel(){logic.ValidationService.resetState(this.$el);this.$emit("cancel");this.$emit("close",{reason:"close"});}}});const _hoisted_1$P={class:"button-group"};const _hoisted_2$B=["type","form","onClick"];const _hoisted_3$w={key:0,class:"sr-only"};const _hoisted_4$r=["form"];function _sfc_render$W(_ctx,_cache,$props,$setup,$data,$options){const _component_f_validation_form=vue.resolveComponent("f-validation-form");const _component_f_modal=vue.resolveComponent("f-modal");return vue.openBlock(),vue.createBlock(_component_f_modal,{"data-test":_ctx.dataTest,fullscreen:_ctx.fullscreen,"is-open":_ctx.isOpen,size:_ctx.size,"aria-close-text":_ctx.ariaCloseText,onClose:_ctx.onClose},{header:vue.withCtx(()=>[vue.renderSlot(_ctx.$slots,"header")]),content:vue.withCtx(()=>[vue.createElementVNode("div",null,[vue.renderSlot(_ctx.$slots,"default")]),vue.createTextVNode(),vue.createVNode(_component_f_validation_form,{id:_ctx.formId,"before-submit":_ctx.beforeSubmit,"before-validation":_ctx.beforeValidation,"use-error-list":_ctx.useErrorList,onSubmit:_ctx.onSubmit,onCancel:_ctx.onCancel},{"error-message":vue.withCtx(()=>[vue.renderSlot(_ctx.$slots,"error-message")]),default:vue.withCtx(()=>[vue.createTextVNode(),vue.renderSlot(_ctx.$slots,"input-text-fields")]),_:3/* FORWARDED */},8,["id","before-submit","before-validation","use-error-list","onSubmit","onCancel"])]),footer:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$P,[!_ctx.hasDeprecatedSlots?(vue.openBlock(true),vue.createElementBlock(vue.Fragment,{key:0},vue.renderList(_ctx.preparedButtons,button=>{return vue.openBlock(),vue.createElementBlock("button",{key:button.label,type:button.buttonType,class:vue.normalizeClass([button.classlist,"button-group__item"]),form:button.buttonType==="submit"?_ctx.formId:void 0,onClick:$event=>button.buttonType==="button"?_ctx.onCancel():false},[vue.createElementVNode("span",null,vue.toDisplayString(button.label),1/* TEXT */),vue.createTextVNode(),button.screenreader?(vue.openBlock(),vue.createElementBlock("span",_hoisted_3$w," "+vue.toDisplayString(button.screenreader),1/* TEXT */)):vue.createCommentVNode("v-if",true)],10,_hoisted_2$B);}),128/* KEYED_FRAGMENT */)):(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:1},[vue.createElementVNode("button",{form:_ctx.formId,"data-test":"submit-button",type:"submit",class:"button button--primary button-group__item button--large"},[vue.renderSlot(_ctx.$slots,"submit-button-text",{},()=>[vue.createTextVNode(vue.toDisplayString(_ctx.$t("fkui.form-modal.button.submit.text","Spara")),1/* TEXT */)])],8,_hoisted_4$r),vue.createTextVNode(),vue.createElementVNode("button",{"data-test":"cancel-button",type:"button",class:"button button--secondary button-group__item button--large",onClick:_cache[0]||(_cache[0]=(...args)=>_ctx.onCancel&&_ctx.onCancel(...args))},[vue.renderSlot(_ctx.$slots,"cancel-button-text",{},()=>[vue.createTextVNode(vue.toDisplayString(_ctx.$t("fkui.form-modal.button.cancel.text","Avbryt")),1/* TEXT */)])])],64/* STABLE_FRAGMENT */))])]),_:3/* FORWARDED */},8,["data-test","fullscreen","is-open","size","aria-close-text","onClose"]);}const FFormModal=/* @__PURE__ */_export_sfc(_sfc_main$14,[["render",_sfc_render$W]]);async function confirmModal(callingInstance,modalData){const buttons=[{label:modalData.confirm,event:"confirm",type:"primary"},{label:modalData.dismiss,event:"dismiss",type:"secondary"}];const{reason}=await openModal(callingInstance,FConfirmModal,{props:{heading:modalData.heading,content:modalData.content,buttons}});return reason==="confirm";}function isVueComponent(element){return Boolean(element&&typeof element==="object"&&"$el"in element);}function focus(element,options={}){if(Array.isArray(element)){return focus(element[0],options);}if(isVueComponent(element)){var _element$focusTarget;const targetElement=(_element$focusTarget=element.focusTarget)!==null&&_element$focusTarget!==void 0?_element$focusTarget:element.$el;return focus(targetElement,options);}if(element instanceof HTMLElement){logic.focus(element,options);return true;}return false;}function getInputElement(vm){const inputElement=vm.$el.querySelector("input");if(!inputElement){const id=vm.$el.id;const tag=vm.$el.tagName.toLowerCase();throw new Error(`Could not find input element from element "${tag}#${id}"`);}return inputElement;}function hasSlot(vm,name,props={}){const slot=vm.$slots[name];return Boolean(renderSlotText(slot,props));}function findParentByName(vm,name){let current=vm;while(current){if(current.$options.name===name){return current;}current=current.$parent;}return void 0;}function getParentByName(vm,name){const parentVm=findParentByName(vm,name);if(parentVm===void 0){throw new Error(`Unable to find parent component by given name '${name}'.`);}return parentVm;}function hasParentByName(vm,name){return findParentByName(vm,name)!==void 0;}class ErrorData{constructor(error,vm,info){__publicField(this,"error");__publicField(this,"vm");__publicField(this,"info");this.error=error;this.vm=vm;this.info=info;}}class ErrorViewData{constructor(hasError=false,payload){__publicField(this,"hasError");__publicField(this,"payload");this.hasError=hasError;this.payload=payload;}}class FormErrorList{constructor(fields){__publicField(this,"focusElementId","");__publicField(this,"id","");__publicField(this,"isValid",false);__publicField(this,"numberOfTimesSubmitted",0);__publicField(this,"title","");Object.assign(this,fields);}}class FormStep{constructor(fields){__publicField(this,"isOpen",false);__publicField(this,"isAnyFieldTouched",false);__publicField(this,"focusElementId","");__publicField(this,"id","");__publicField(this,"isValid",false);__publicField(this,"numberOfTimesSubmitted",0);__publicField(this,"title","");Object.assign(this,fields);}}var MenuAction=/* @__PURE__ */(MenuAction2=>{MenuAction2[MenuAction2["MOVE_NEXT"]=0]="MOVE_NEXT";MenuAction2[MenuAction2["MOVE_PREV"]=1]="MOVE_PREV";MenuAction2[MenuAction2["MOVE_FIRST"]=2]="MOVE_FIRST";MenuAction2[MenuAction2["MOVE_LAST"]=3]="MOVE_LAST";MenuAction2[MenuAction2["ACTIVATE"]=4]="ACTIVATE";return MenuAction2;})(MenuAction||{});function actionFromKeyboardEvent(event){switch(event.key){case"End":return MenuAction.MOVE_LAST;case"Home":return MenuAction.MOVE_FIRST;case"Up":case"ArrowUp":return MenuAction.MOVE_PREV;case"Down":case"ArrowDown":return MenuAction.MOVE_NEXT;case"Left":case"ArrowLeft":return MenuAction.MOVE_PREV;case"Right":case"ArrowRight":return MenuAction.MOVE_NEXT;case"Tab":if(event.shiftKey){return MenuAction.MOVE_PREV;}return MenuAction.MOVE_NEXT;case" ":case"Spacebar":case"Enter":return MenuAction.ACTIVATE;default:return null;}}function getValidatableElement(element){if(logic.isValidatableHTMLElement(element)){return element;}const validatableInsideElement=element.querySelector("input, textarea, select");if(validatableInsideElement){return validatableInsideElement;}else{throw new Error(`Couldn't find any validatable element`);}}function triggerInitialValidationToSupportFFormStepValidation(el){const target=getValidatableElement(el);logic.ValidationService.validateElement(target);}function registerValidators(el,binding){const{modifiers:bindingModifiers={},value:bindingValue={}}=binding;const target=getValidatableElement(el);Object.keys(bindingValue).forEach(validatorName=>{if(!bindingModifiers[validatorName]){throw new Error(`Have you forget to add '${validatorName}' to v-validation.${validatorName}?`);}});const validatorConfigs={};Object.keys(bindingModifiers).forEach(validatorName=>{validatorConfigs[validatorName]=bindingValue[validatorName]||{};});logic.ValidationService.addValidatorsToElement(target,validatorConfigs);}const ValidationDirective={beforeMount(el,binding){registerValidators(el,binding);},beforeUnmount(el,_binding){const validatableElement=getValidatableElement(el);dispatchComponentUnmountEvent(validatableElement);logic.ValidationService.removeValidatorsFromElement(validatableElement);},updated(el,binding){if(!isEqual$1(binding.value,binding.oldValue)){registerValidators(el,binding);}},mounted(el){triggerInitialValidationToSupportFFormStepValidation(el);}};const ValidationPrefixDirective={beforeMount(el,binding){el.addEventListener("component-validity",event=>{const e=event;e.detail.errorMessage=`${binding.value}${e.detail.errorMessage}`;});}};const ValidationPlugin={install(app){app.directive("validation",ValidationDirective);app.directive("validationPrefix",ValidationPrefixDirective);}};const UNHANDLED_ERROR_EVENT="unhandled-error";const defaults={captureWarnings:true,logToConsole:true};function errorHandler(options,error,vm,info){if(options.logToConsole){const consoleOutput=info?[`Error in ${info}:`,error,vm]:[error,vm];console.error(...consoleOutput);}if(error instanceof Error){EventBus.$emit(UNHANDLED_ERROR_EVENT,new ErrorData(error,vm,info));}else{EventBus.$emit(UNHANDLED_ERROR_EVENT,new ErrorData(new Error(String(error)),vm,info));}}function warnHandler(options,msg,vm,trace){if(options.logToConsole){console.warn(`Warning:`,msg,trace);}const error={name:"warning",message:msg,stack:trace};EventBus.$emit(UNHANDLED_ERROR_EVENT,new ErrorData(error,vm,"warning"));}const ErrorPlugin={install(app,options){const config2={...defaults,...options};app.config.errorHandler=errorHandler.bind(void 0,config2);if(config2.captureWarnings){app.config.warnHandler=warnHandler.bind(void 0,config2);}}};const _sfc_main$13=vue.defineComponent({name:"FErrorPage",props:{payload:{type:Object,required:false,default:null}}});const _hoisted_1$O={"data-test":"f-error-page"};const _hoisted_2$A=/* @__PURE__ */vue.createElementVNode("h1",null,"Fel",-1/* HOISTED */);const _hoisted_3$v=/* @__PURE__ */vue.createElementVNode("p",null,"Ett fel har uppstått.",-1/* HOISTED */);const _hoisted_4$q=/* @__PURE__ */vue.createElementVNode("a",{href:"/"},"Gå till startsidan",-1/* HOISTED */);function _sfc_render$V(_ctx,_cache,$props,$setup,$data,$options){return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$O,[_hoisted_2$A,vue.createTextVNode(),_hoisted_3$v,vue.createTextVNode(),_hoisted_4$q]);}const FErrorPage=/* @__PURE__ */_export_sfc(_sfc_main$13,[["render",_sfc_render$V]]);const _sfc_main$12=vue.defineComponent({name:"FErrorHandlingApp",props:{defaultComponent:{type:[Function,Object],required:false,default:void 0},errorComponent:{type:[Function,Object],required:false,default:FErrorPage}},data(){return new ErrorViewData();},watch:{$route(){this.hasError=false;}},created(){EventBus.$on(UNHANDLED_ERROR_EVENT,payload=>{this.hasError=true;this.payload=payload;});}});function _sfc_render$U(_ctx,_cache,$props,$setup,$data,$options){return vue.openBlock(),vue.createElementBlock("div",null,[_ctx.hasError?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(_ctx.errorComponent),{key:0,payload:_ctx.payload},null,8,["payload"])):_ctx.defaultComponent?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(_ctx.defaultComponent),{key:1})):vue.renderSlot(_ctx.$slots,"default",{key:2})]);}const FErrorHandlingApp=/* @__PURE__ */_export_sfc(_sfc_main$12,[["render",_sfc_render$U]]);function isMonthBefore(date2,minDate){return Boolean(minDate&&date2.isBefore(minDate.startOfMonth()));}function isMonthAfter(date2,maxDate){return Boolean(maxDate&&date2.isAfter(maxDate.endOfMonth()));}function isInvalidMonth(date2,minDate,maxDate){const startOfMonth=date2.startOfMonth();return isMonthBefore(startOfMonth,minDate)||isMonthAfter(startOfMonth,maxDate);}function getMessage($t,date2,minDate,maxDate){const invalidMonth=isInvalidMonth(date2,minDate,maxDate);if(!invalidMonth){return void 0;}if(date2.isBefore(minDate)){const{day,monthName,year}=minDate;return $t("fkui.calendar.error.below-min-date","Du kan inte välja en dag före {{day}} {{month}} {{year}}",{day,month:monthName,year});}if(date2.isAfter(maxDate)){const{day,monthName,year}=maxDate;return $t("fkui.calendar.error.above-max-date","Du kan inte välja en dag efter {{day}} {{month}} {{year}}",{day,month:monthName,year});}}const _sfc_main$11=vue.defineComponent({name:"ICalendarNavbar",components:{FIcon},mixins:[TranslationMixin],props:{/**
|
|
167
|
+
*/beforeValidation:{type:Function,required:false,default(){}},buttons:{type:Array,required:false,default:()=>[{label:logic.TranslationService.provider.translate("fkui.form-modal.button.submit.text","Spara"),event:"submit",type:"primary",submitButton:true},{label:logic.TranslationService.provider.translate("fkui.form-modal.button.cancel.text","Avbryt"),event:"dismiss",type:"secondary"}]}},emits:["cancel","close","submit"],data(){return{};},computed:{preparedButtons(){return prepareButtonList(this.buttons,FKUIConfigButtonOrder.LEFT_TO_RIGHT);},hasDeprecatedSlots(){return hasSlot(this,"cancel-button-text")||hasSlot(this,"submit-button-text");}},methods:{onClose(){logic.ValidationService.resetState(this.$el);this.$emit("cancel");this.$emit("close",{reason:"close"});},async onSubmit(){logic.ValidationService.resetState(this.$el);this.$emit("submit",{data:this.value});this.$emit("close",{reason:"submit",data:this.value});},onCancel(){logic.ValidationService.resetState(this.$el);this.$emit("cancel");this.$emit("close",{reason:"close"});}}});const _hoisted_1$P={class:"button-group"};const _hoisted_2$B=["type","form","onClick"];const _hoisted_3$w={key:0,class:"sr-only"};const _hoisted_4$r=["form"];function _sfc_render$W(_ctx,_cache,$props,$setup,$data,$options){const _component_f_validation_form=vue.resolveComponent("f-validation-form");const _component_f_modal=vue.resolveComponent("f-modal");return vue.openBlock(),vue.createBlock(_component_f_modal,{"data-test":_ctx.dataTest,fullscreen:_ctx.fullscreen,"is-open":_ctx.isOpen,size:_ctx.size,"aria-close-text":_ctx.ariaCloseText,onClose:_ctx.onClose},{header:vue.withCtx(()=>[vue.renderSlot(_ctx.$slots,"header")]),content:vue.withCtx(()=>[vue.createElementVNode("div",null,[vue.renderSlot(_ctx.$slots,"default")]),vue.createTextVNode(),vue.createVNode(_component_f_validation_form,{id:_ctx.formId,"before-submit":_ctx.beforeSubmit,"before-validation":_ctx.beforeValidation,"use-error-list":_ctx.useErrorList,onSubmit:_ctx.onSubmit,onCancel:_ctx.onCancel},{"error-message":vue.withCtx(()=>[vue.renderSlot(_ctx.$slots,"error-message")]),default:vue.withCtx(()=>[vue.createTextVNode(),vue.renderSlot(_ctx.$slots,"input-text-fields")]),_:3/* FORWARDED */},8,["id","before-submit","before-validation","use-error-list","onSubmit","onCancel"])]),footer:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$P,[!_ctx.hasDeprecatedSlots?(vue.openBlock(true),vue.createElementBlock(vue.Fragment,{key:0},vue.renderList(_ctx.preparedButtons,button=>{return vue.openBlock(),vue.createElementBlock("button",{key:button.label,type:button.buttonType,class:vue.normalizeClass([button.classlist,"button-group__item"]),form:button.buttonType==="submit"?_ctx.formId:void 0,onClick:$event=>button.buttonType==="button"?_ctx.onCancel():false},[vue.createElementVNode("span",null,vue.toDisplayString(button.label),1/* TEXT */),vue.createTextVNode(),button.screenreader?(vue.openBlock(),vue.createElementBlock("span",_hoisted_3$w," "+vue.toDisplayString(button.screenreader),1/* TEXT */)):vue.createCommentVNode("v-if",true)],10,_hoisted_2$B);}),128/* KEYED_FRAGMENT */)):(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:1},[vue.createElementVNode("button",{form:_ctx.formId,"data-test":"submit-button",type:"submit",class:"button button--primary button-group__item button--large"},[vue.renderSlot(_ctx.$slots,"submit-button-text",{},()=>[vue.createTextVNode(vue.toDisplayString(_ctx.$t("fkui.form-modal.button.submit.text","Spara")),1/* TEXT */)])],8,_hoisted_4$r),vue.createTextVNode(),vue.createElementVNode("button",{"data-test":"cancel-button",type:"button",class:"button button--secondary button-group__item button--large",onClick:_cache[0]||(_cache[0]=(...args)=>_ctx.onCancel&&_ctx.onCancel(...args))},[vue.renderSlot(_ctx.$slots,"cancel-button-text",{},()=>[vue.createTextVNode(vue.toDisplayString(_ctx.$t("fkui.form-modal.button.cancel.text","Avbryt")),1/* TEXT */)])])],64/* STABLE_FRAGMENT */))])]),_:3/* FORWARDED */},8,["data-test","fullscreen","is-open","size","aria-close-text","onClose"]);}const FFormModal=/* @__PURE__ */_export_sfc(_sfc_main$14,[["render",_sfc_render$W]]);async function confirmModal(callingInstance,modalData){const buttons=[{label:modalData.confirm,event:"confirm",type:"primary"},{label:modalData.dismiss,event:"dismiss",type:"secondary"}];const{reason}=await openModal(callingInstance,FConfirmModal,{props:{heading:modalData.heading,content:modalData.content,buttons}});return reason==="confirm";}function isVueComponent(element){return Boolean(element&&typeof element==="object"&&"$el"in element);}function focus(element,options={}){if(Array.isArray(element)){return focus(element[0],options);}if(isVueComponent(element)){var _element$focusTarget;const targetElement=(_element$focusTarget=element.focusTarget)!==null&&_element$focusTarget!==void 0?_element$focusTarget:element.$el;return focus(targetElement,options);}if(element instanceof HTMLElement){logic.focus(element,options);return true;}return false;}function getInputElement(vm){const inputElement=vm.$el.querySelector("input");if(!inputElement){const id=vm.$el.id;const tag=vm.$el.tagName.toLowerCase();throw new Error(`Could not find input element from element "${tag}#${id}"`);}return inputElement;}function hasSlot(vm,name,props={},options={}){const slot=vm.$slots[name];return Boolean(renderSlotText(slot,props,options));}function findParentByName(vm,name){let current=vm;while(current){if(current.$options.name===name){return current;}current=current.$parent;}return void 0;}function getParentByName(vm,name){const parentVm=findParentByName(vm,name);if(parentVm===void 0){throw new Error(`Unable to find parent component by given name '${name}'.`);}return parentVm;}function hasParentByName(vm,name){return findParentByName(vm,name)!==void 0;}class ErrorData{constructor(error,vm,info){__publicField(this,"error");__publicField(this,"vm");__publicField(this,"info");this.error=error;this.vm=vm;this.info=info;}}class ErrorViewData{constructor(hasError=false,payload){__publicField(this,"hasError");__publicField(this,"payload");this.hasError=hasError;this.payload=payload;}}class FormErrorList{constructor(fields){__publicField(this,"focusElementId","");__publicField(this,"id","");__publicField(this,"isValid",false);__publicField(this,"numberOfTimesSubmitted",0);__publicField(this,"title","");Object.assign(this,fields);}}class FormStep{constructor(fields){__publicField(this,"isOpen",false);__publicField(this,"isAnyFieldTouched",false);__publicField(this,"focusElementId","");__publicField(this,"id","");__publicField(this,"isValid",false);__publicField(this,"numberOfTimesSubmitted",0);__publicField(this,"title","");Object.assign(this,fields);}}var MenuAction=/* @__PURE__ */(MenuAction2=>{MenuAction2[MenuAction2["MOVE_NEXT"]=0]="MOVE_NEXT";MenuAction2[MenuAction2["MOVE_PREV"]=1]="MOVE_PREV";MenuAction2[MenuAction2["MOVE_FIRST"]=2]="MOVE_FIRST";MenuAction2[MenuAction2["MOVE_LAST"]=3]="MOVE_LAST";MenuAction2[MenuAction2["ACTIVATE"]=4]="ACTIVATE";return MenuAction2;})(MenuAction||{});function actionFromKeyboardEvent(event){switch(event.key){case"End":return MenuAction.MOVE_LAST;case"Home":return MenuAction.MOVE_FIRST;case"Up":case"ArrowUp":return MenuAction.MOVE_PREV;case"Down":case"ArrowDown":return MenuAction.MOVE_NEXT;case"Left":case"ArrowLeft":return MenuAction.MOVE_PREV;case"Right":case"ArrowRight":return MenuAction.MOVE_NEXT;case"Tab":if(event.shiftKey){return MenuAction.MOVE_PREV;}return MenuAction.MOVE_NEXT;case" ":case"Spacebar":case"Enter":return MenuAction.ACTIVATE;default:return null;}}function getValidatableElement(element){if(logic.isValidatableHTMLElement(element)){return element;}const validatableInsideElement=element.querySelector("input, textarea, select");if(validatableInsideElement){return validatableInsideElement;}else{throw new Error(`Couldn't find any validatable element`);}}function triggerInitialValidationToSupportFFormStepValidation(el){const target=getValidatableElement(el);logic.ValidationService.validateElement(target);}function registerValidators(el,binding){const{modifiers:bindingModifiers={},value:bindingValue={}}=binding;const target=getValidatableElement(el);Object.keys(bindingValue).forEach(validatorName=>{if(!bindingModifiers[validatorName]){throw new Error(`Have you forget to add '${validatorName}' to v-validation.${validatorName}?`);}});const validatorConfigs={};Object.keys(bindingModifiers).forEach(validatorName=>{validatorConfigs[validatorName]=bindingValue[validatorName]||{};});logic.ValidationService.addValidatorsToElement(target,validatorConfigs);}const ValidationDirective={beforeMount(el,binding){registerValidators(el,binding);},beforeUnmount(el,_binding){const validatableElement=getValidatableElement(el);dispatchComponentUnmountEvent(validatableElement);logic.ValidationService.removeValidatorsFromElement(validatableElement);},updated(el,binding){if(!isEqual$1(binding.value,binding.oldValue)){registerValidators(el,binding);}},mounted(el){triggerInitialValidationToSupportFFormStepValidation(el);}};const ValidationPrefixDirective={beforeMount(el,binding){el.addEventListener("component-validity",event=>{const e=event;e.detail.errorMessage=`${binding.value}${e.detail.errorMessage}`;});}};const ValidationPlugin={install(app){app.directive("validation",ValidationDirective);app.directive("validationPrefix",ValidationPrefixDirective);}};const UNHANDLED_ERROR_EVENT="unhandled-error";const defaults={captureWarnings:true,logToConsole:true};function errorHandler(options,error,vm,info){if(options.logToConsole){const consoleOutput=info?[`Error in ${info}:`,error,vm]:[error,vm];console.error(...consoleOutput);}if(error instanceof Error){EventBus.$emit(UNHANDLED_ERROR_EVENT,new ErrorData(error,vm,info));}else{EventBus.$emit(UNHANDLED_ERROR_EVENT,new ErrorData(new Error(String(error)),vm,info));}}function warnHandler(options,msg,vm,trace){if(options.logToConsole){console.warn(`Warning:`,msg,trace);}const error={name:"warning",message:msg,stack:trace};EventBus.$emit(UNHANDLED_ERROR_EVENT,new ErrorData(error,vm,"warning"));}const ErrorPlugin={install(app,options){const config2={...defaults,...options};app.config.errorHandler=errorHandler.bind(void 0,config2);if(config2.captureWarnings){app.config.warnHandler=warnHandler.bind(void 0,config2);}}};const _sfc_main$13=vue.defineComponent({name:"FErrorPage",props:{payload:{type:Object,required:false,default:null}}});const _hoisted_1$O={"data-test":"f-error-page"};const _hoisted_2$A=/* @__PURE__ */vue.createElementVNode("h1",null,"Fel",-1/* HOISTED */);const _hoisted_3$v=/* @__PURE__ */vue.createElementVNode("p",null,"Ett fel har uppstått.",-1/* HOISTED */);const _hoisted_4$q=/* @__PURE__ */vue.createElementVNode("a",{href:"/"},"Gå till startsidan",-1/* HOISTED */);function _sfc_render$V(_ctx,_cache,$props,$setup,$data,$options){return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$O,[_hoisted_2$A,vue.createTextVNode(),_hoisted_3$v,vue.createTextVNode(),_hoisted_4$q]);}const FErrorPage=/* @__PURE__ */_export_sfc(_sfc_main$13,[["render",_sfc_render$V]]);const _sfc_main$12=vue.defineComponent({name:"FErrorHandlingApp",props:{defaultComponent:{type:[Function,Object],required:false,default:void 0},errorComponent:{type:[Function,Object],required:false,default:FErrorPage}},data(){return new ErrorViewData();},watch:{$route(){this.hasError=false;}},created(){EventBus.$on(UNHANDLED_ERROR_EVENT,payload=>{this.hasError=true;this.payload=payload;});}});function _sfc_render$U(_ctx,_cache,$props,$setup,$data,$options){return vue.openBlock(),vue.createElementBlock("div",null,[_ctx.hasError?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(_ctx.errorComponent),{key:0,payload:_ctx.payload},null,8,["payload"])):_ctx.defaultComponent?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(_ctx.defaultComponent),{key:1})):vue.renderSlot(_ctx.$slots,"default",{key:2})]);}const FErrorHandlingApp=/* @__PURE__ */_export_sfc(_sfc_main$12,[["render",_sfc_render$U]]);function isMonthBefore(date2,minDate){return Boolean(minDate&&date2.isBefore(minDate.startOfMonth()));}function isMonthAfter(date2,maxDate){return Boolean(maxDate&&date2.isAfter(maxDate.endOfMonth()));}function isInvalidMonth(date2,minDate,maxDate){const startOfMonth=date2.startOfMonth();return isMonthBefore(startOfMonth,minDate)||isMonthAfter(startOfMonth,maxDate);}function getMessage($t,date2,minDate,maxDate){const invalidMonth=isInvalidMonth(date2,minDate,maxDate);if(!invalidMonth){return void 0;}if(date2.isBefore(minDate)){const{day,monthName,year}=minDate;return $t("fkui.calendar.error.below-min-date","Du kan inte välja en dag före {{day}} {{month}} {{year}}",{day,month:monthName,year});}if(date2.isAfter(maxDate)){const{day,monthName,year}=maxDate;return $t("fkui.calendar.error.above-max-date","Du kan inte välja en dag efter {{day}} {{month}} {{year}}",{day,month:monthName,year});}}const _sfc_main$11=vue.defineComponent({name:"ICalendarNavbar",components:{FIcon},mixins:[TranslationMixin],props:{/**
|
|
168
168
|
* Focused month.
|
|
169
169
|
*/modelValue:{type:Object,required:true},/**
|
|
170
170
|
* Min date.
|
|
@@ -239,22 +239,7 @@ isIndex(key,length)))){result.push(key);}}return result;}var _arrayLikeKeys=arra
|
|
|
239
239
|
* The items to be diplayed in the menu
|
|
240
240
|
*/items:{type:Array,required:true},/**
|
|
241
241
|
* Unique accessible name for navigation landmark.
|
|
242
|
-
*/ariaLabel:{type:String,required:false,default:"Kontextuell meny"}},emits:["close","select"],setup(){return{contextmenu:vue.ref(null)};},data(){return{selectedItem:"",currentFocusedItemIndex:-1};},computed:{popupItems(){return this.items.filter(isContextMenuTextItem);},separatorPositions(){const res=[];if(this.items.length>1){this.items.forEach((it,i)=>{if(isContextMenuSeparatorItem(it)){const pos=i-1-res.length;if(pos>=0&&pos<this.items.length-1){res.push(pos);}}});}return res;},hasIcons(){return this.items.some(it=>isContextMenuTextItem(it)&&it.icon);}},watch:{isOpen:{immediate:true,async handler(){if(this.isOpen){this.currentFocusedItemIndex=-1;this.selectedItem="";}}}},methods:{hasSeparatorAfterItemAt(index){return this.separatorPositions.includes(index);},closePopup(){this.$emit("close");},onClickItem(item){if(isContextMenuTextItem(item)&&item.key){this.selectedItem=item.key;this.$emit("select",this.selectedItem);this.closePopup();}},tabIndex(index){return index===this.currentFocusedItemIndex?0:-1;},onKeyUp(event){if(preventKeys$3.includes(event.key)){event.preventDefault();}},doHandlePopupMenuTabKey(action){if(action===MenuAction.MOVE_NEXT&&this.currentFocusedItemIndex+1===this.popupItems.length){this.closePopup();return true;}else if(action===MenuAction.MOVE_PREV&&(this.currentFocusedItemIndex===0||this.currentFocusedItemIndex===-1)){this.closePopup();return false;}return false;},async onKeyDown(event){if(!preventKeys$3.includes(event.key)){return;}if(event.key==="Escape"){this.$emit("close");return;}const action=actionFromKeyboardEvent(event);if(action===null){return;}if(event.key==="Tab"&&this.doHandlePopupMenuTabKey(action)){return;}if(keyUp$1.includes(event.key)&&this.currentFocusedItemIndex===-1){this.currentFocusedItemIndex=this.popupItems.length>0?this.popupItems.length:1;}event.preventDefault();await doMenuAction$3(action,this);},async setFocusOnItem(index){if(index<0||index>=this.popupItems.length){return;}this.currentFocusedItemIndex=index;await this.$nextTick();if(!this.isOpen){return;}const items=getHTMLElementsFromVueRef(this.$refs.items);if(items.length>0){const popupMenuItem=items[index];logic.focus(popupMenuItem,{preventScroll:true});}},async activateItem(index){if(index<0||index>=this.popupItems.length){return;}if(index!==this.currentFocusedItemIndex){await this.setFocusOnItem(index);}this.onClickItem(this.popupItems[this.currentFocusedItemIndex]);}}});const _hoisted_1$I=["aria-label"];const _hoisted_2$w={ref:"contextmenu",role:"menu",tabindex:"-1",class:"contextmenu__list"};const _hoisted_3$s=["onClick"];const _hoisted_4$n=["tabindex"];const _hoisted_5$l={key:0,class:"contextmenu__separator"};function _sfc_render$N(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=vue.resolveComponent("f-icon");const _component_i_popup=vue.resolveComponent("i-popup");return vue.openBlock(),vue.createBlock(_component_i_popup,{"is-open":_ctx.isOpen,"keyboard-trap":false,anchor:_ctx.anchor,"set-focus":true,"focus-element":()=>_ctx.contextmenu,inline:"never",onClose:_cache[2]||(_cache[2]=$event=>_ctx.$emit("close"))},{default:vue.withCtx(()=>[vue.createElementVNode("nav",{class:"contextmenu","aria-label":_ctx.ariaLabel,onKeyup:_cache[0]||(_cache[0]=(...args)=>_ctx.onKeyUp&&_ctx.onKeyUp(...args)),onKeydown:_cache[1]||(_cache[1]=(...args)=>_ctx.onKeyDown&&_ctx.onKeyDown(...args))},[vue.createElementVNode("ul",_hoisted_2$w,[(vue.openBlock(true),vue.createElementBlock(vue.Fragment,null,vue.renderList(_ctx.popupItems,(item,index)=>{return vue.openBlock(),vue.createElementBlock("li",{key:item.key,role:"menuitem",onClick:$event=>_ctx.onClickItem(item)},[vue.createElementVNode("div",{ref_for:true,ref:"items",tabindex:_ctx.tabIndex(index),class:"contextmenu__list__item"},[_ctx.hasIcons?(vue.openBlock(),vue.createBlock(_component_f_icon,{key:0,class:"contextmenu__lefticon",name:item.icon?item.icon:"",library:item.iconLibrary?item.iconLibrary:"f"},null,8,["name","library"])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),vue.createElementVNode("a",{ref_for:true,ref:"anchors"},vue.toDisplayString(item.label),513/* TEXT, NEED_PATCH */)],8,_hoisted_4$n),vue.createTextVNode(),_ctx.hasSeparatorAfterItemAt(index)?(vue.openBlock(),vue.createElementBlock("hr",_hoisted_5$l)):vue.createCommentVNode("v-if",true)],8,_hoisted_3$s);}),128/* KEYED_FRAGMENT */))],512/* NEED_PATCH */)],40,_hoisted_1$I)]),_:1/* STABLE */},8,["is-open","anchor","focus-element"]);}const FContextMenu=/* @__PURE__ */_export_sfc(_sfc_main$X,[["render",_sfc_render$N]]);const
|
|
243
|
-
* Set to `true`, empty string `""` or string `"disabled"` to disable this input field.
|
|
244
|
-
*/disabled:{type:Boolean,required:false,default:false},/**
|
|
245
|
-
* The id for the input id attribute.
|
|
246
|
-
* The id for the label for attribute.
|
|
247
|
-
* If the prop is not set a random value will be generated.
|
|
248
|
-
*/id:{type:String,required:false,default:()=>logic.ElementIdService.generateElementId()},/**
|
|
249
|
-
* The value for the input checked attribute.
|
|
250
|
-
* @model
|
|
251
|
-
*/// ? The rule is disabled so that the `checked` prop can be undefined or null.
|
|
252
|
-
/* eslint-disable-next-line vue/require-default-prop -- technical debt,
|
|
253
|
-
/* it should contain a default value of undefined and proptype should
|
|
254
|
-
/* include undefined (see comment on line above) */modelValue:{type:anyType$1,required:false},/**
|
|
255
|
-
* The value for the input.
|
|
256
|
-
*/value:{type:anyType$1,required:true}},emits:["change","update:modelValue"],setup(){return{showDetails:vue.inject("showDetails","never"),getFieldsetLabelText:vue.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=>lodash.isEqual(vue.toValue(it),vue.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
|
|
257
|
-
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=>!lodash.isEqual(vue.toValue(it),vue.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__ */vue.createElementVNode("br",null,null,-1/* HOISTED */);const _hoisted_5$k={key:0,class:"checkbox__details"};const _hoisted_6$g=/* @__PURE__ */vue.createElementVNode("br",null,null,-1/* HOISTED */);function _sfc_render$M(_ctx,_cache,$props,$setup,$data,$options){return vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass(["checkbox",_ctx.disabledClass]),onValidity:_cache[2]||(_cache[2]=(...args)=>_ctx.onValidity&&_ctx.onValidity(...args))},[vue.createElementVNode("input",vue.mergeProps({id:_ctx.id},_ctx.attrs,{ref:"checkboxInput",type:"checkbox",class:"checkbox__input",disabled:_ctx.disabled,onKeydown:_cache[0]||(_cache[0]=vue.withKeys((...args)=>_ctx.onKeydown&&_ctx.onKeydown(...args),["space"])),onChange:_cache[1]||(_cache[1]=$event=>_ctx.updateExpandedFlag())}),null,16,_hoisted_1$H),vue.createTextVNode(),vue.createElementVNode("label",{class:vue.normalizeClass(_ctx.$slots.details?"checkbox__label checkbox__width":"checkbox__label"),for:_ctx.id},[vue.renderSlot(_ctx.$slots,"default"),vue.createTextVNode(),_ctx.$slots.details?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:0},[_ctx.showDetails==="always"?(vue.openBlock(),vue.createElementBlock("span",_hoisted_3$r,[_hoisted_4$m,vue.createTextVNode(),vue.renderSlot(_ctx.$slots,"details")])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),_ctx.showDetails==="when-selected"?(vue.openBlock(),vue.createBlock(vue.Transition,{key:1,onEnter:_ctx.enter,onAfterEnter:_ctx.afterEnter,onLeave:_ctx.leave},{default:vue.withCtx(()=>[_ctx.expanded?(vue.openBlock(),vue.createElementBlock("span",_hoisted_5$k,[_hoisted_6$g,vue.createTextVNode(),vue.renderSlot(_ctx.$slots,"details",{height:_ctx.height})])):vue.createCommentVNode("v-if",true)]),_:3/* FORWARDED */},8,["onEnter","onAfterEnter","onLeave"])):vue.createCommentVNode("v-if",true)],64/* STABLE_FRAGMENT */)):vue.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=vue.defineComponent({name:"FFieldset",components:{FIcon},mixins:[TranslationMixin],provide(){return{[getFieldsetLabelText]:()=>{return renderSlotText(this.$slots.label);},sharedName:this.name,showDetails:this.showDetails};},props:{/**
|
|
242
|
+
*/ariaLabel:{type:String,required:false,default:"Kontextuell meny"}},emits:["close","select"],setup(){return{contextmenu:vue.ref(null)};},data(){return{selectedItem:"",currentFocusedItemIndex:-1};},computed:{popupItems(){return this.items.filter(isContextMenuTextItem);},separatorPositions(){const res=[];if(this.items.length>1){this.items.forEach((it,i)=>{if(isContextMenuSeparatorItem(it)){const pos=i-1-res.length;if(pos>=0&&pos<this.items.length-1){res.push(pos);}}});}return res;},hasIcons(){return this.items.some(it=>isContextMenuTextItem(it)&&it.icon);}},watch:{isOpen:{immediate:true,async handler(){if(this.isOpen){this.currentFocusedItemIndex=-1;this.selectedItem="";}}}},methods:{hasSeparatorAfterItemAt(index){return this.separatorPositions.includes(index);},closePopup(){this.$emit("close");},onClickItem(item){if(isContextMenuTextItem(item)&&item.key){this.selectedItem=item.key;this.$emit("select",this.selectedItem);this.closePopup();}},tabIndex(index){return index===this.currentFocusedItemIndex?0:-1;},onKeyUp(event){if(preventKeys$3.includes(event.key)){event.preventDefault();}},doHandlePopupMenuTabKey(action){if(action===MenuAction.MOVE_NEXT&&this.currentFocusedItemIndex+1===this.popupItems.length){this.closePopup();return true;}else if(action===MenuAction.MOVE_PREV&&(this.currentFocusedItemIndex===0||this.currentFocusedItemIndex===-1)){this.closePopup();return false;}return false;},async onKeyDown(event){if(!preventKeys$3.includes(event.key)){return;}if(event.key==="Escape"){this.$emit("close");return;}const action=actionFromKeyboardEvent(event);if(action===null){return;}if(event.key==="Tab"&&this.doHandlePopupMenuTabKey(action)){return;}if(keyUp$1.includes(event.key)&&this.currentFocusedItemIndex===-1){this.currentFocusedItemIndex=this.popupItems.length>0?this.popupItems.length:1;}event.preventDefault();await doMenuAction$3(action,this);},async setFocusOnItem(index){if(index<0||index>=this.popupItems.length){return;}this.currentFocusedItemIndex=index;await this.$nextTick();if(!this.isOpen){return;}const items=getHTMLElementsFromVueRef(this.$refs.items);if(items.length>0){const popupMenuItem=items[index];logic.focus(popupMenuItem,{preventScroll:true});}},async activateItem(index){if(index<0||index>=this.popupItems.length){return;}if(index!==this.currentFocusedItemIndex){await this.setFocusOnItem(index);}this.onClickItem(this.popupItems[this.currentFocusedItemIndex]);}}});const _hoisted_1$I=["aria-label"];const _hoisted_2$w={ref:"contextmenu",role:"menu",tabindex:"-1",class:"contextmenu__list"};const _hoisted_3$s=["onClick"];const _hoisted_4$n=["tabindex"];const _hoisted_5$l={key:0,class:"contextmenu__separator"};function _sfc_render$N(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=vue.resolveComponent("f-icon");const _component_i_popup=vue.resolveComponent("i-popup");return vue.openBlock(),vue.createBlock(_component_i_popup,{"is-open":_ctx.isOpen,"keyboard-trap":false,anchor:_ctx.anchor,"set-focus":true,"focus-element":()=>_ctx.contextmenu,inline:"never",onClose:_cache[2]||(_cache[2]=$event=>_ctx.$emit("close"))},{default:vue.withCtx(()=>[vue.createElementVNode("nav",{class:"contextmenu","aria-label":_ctx.ariaLabel,onKeyup:_cache[0]||(_cache[0]=(...args)=>_ctx.onKeyUp&&_ctx.onKeyUp(...args)),onKeydown:_cache[1]||(_cache[1]=(...args)=>_ctx.onKeyDown&&_ctx.onKeyDown(...args))},[vue.createElementVNode("ul",_hoisted_2$w,[(vue.openBlock(true),vue.createElementBlock(vue.Fragment,null,vue.renderList(_ctx.popupItems,(item,index)=>{return vue.openBlock(),vue.createElementBlock("li",{key:item.key,role:"menuitem",onClick:$event=>_ctx.onClickItem(item)},[vue.createElementVNode("div",{ref_for:true,ref:"items",tabindex:_ctx.tabIndex(index),class:"contextmenu__list__item"},[_ctx.hasIcons?(vue.openBlock(),vue.createBlock(_component_f_icon,{key:0,class:"contextmenu__lefticon",name:item.icon?item.icon:"",library:item.iconLibrary?item.iconLibrary:"f"},null,8,["name","library"])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),vue.createElementVNode("a",{ref_for:true,ref:"anchors"},vue.toDisplayString(item.label),513/* TEXT, NEED_PATCH */)],8,_hoisted_4$n),vue.createTextVNode(),_ctx.hasSeparatorAfterItemAt(index)?(vue.openBlock(),vue.createElementBlock("hr",_hoisted_5$l)):vue.createCommentVNode("v-if",true)],8,_hoisted_3$s);}),128/* KEYED_FRAGMENT */))],512/* NEED_PATCH */)],40,_hoisted_1$I)]),_:1/* STABLE */},8,["is-open","anchor","focus-element"]);}const FContextMenu=/* @__PURE__ */_export_sfc(_sfc_main$X,[["render",_sfc_render$N]]);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 injectionKeys={sharedName:Symbol("sharedName"),showDetails:Symbol("showDetails"),getFieldsetLabelText:Symbol("getFieldsetLabelText")};function useFieldset(){return{sharedName:vue.inject(injectionKeys.sharedName,void 0),showDetails:vue.inject(injectionKeys.showDetails,"never"),getFieldsetLabelText:vue.inject(injectionKeys.getFieldsetLabelText,()=>void 0)};}const _sfc_main$W=vue.defineComponent({name:"FFieldset",components:{FIcon},mixins:[TranslationMixin],props:{/**
|
|
258
243
|
* The id for the fieldset id attribute.
|
|
259
244
|
* If the prop is not set a random value will be generated.
|
|
260
245
|
*/id:{type:String,required:false,default:()=>logic.ElementIdService.generateElementId()},/**
|
|
@@ -278,10 +263,25 @@ injected(){return this;}},methods:{updateExpandedFlag(){const checkboxInput=getH
|
|
|
278
263
|
* * `never` (default) - Never show item details.
|
|
279
264
|
* - `when-selected` - Show item details when selected.
|
|
280
265
|
* - `always` - Always show item details.
|
|
281
|
-
*/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 logic.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;}},/**
|
|
266
|
+
*/showDetails:{type:String,default:"never",validator(value){return["never","when-selected","always"].includes(value);}}},setup(props){const slots=vue.useSlots();vue.provide(injectionKeys.sharedName,props.name);vue.provide(injectionKeys.showDetails,props.showDetails);vue.provide(injectionKeys.getFieldsetLabelText,()=>{return renderSlotText(slots.label);});},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 logic.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;}},/**
|
|
282
267
|
* Workaround for NVDA-bug. Force re rendering of legend element due to NVDA not recognizing innerHTML changes.
|
|
283
268
|
* NVDA has closed the bug as it is related to the browser (works in FF): https://github.com/nvaccess/nvda/issues/13162
|
|
284
|
-
*/forceLegendUpdate(){this.legendKey++;},async updateCheckboxChildren(){await this.$nextTick();this.children=Array.from(this.$el.querySelectorAll('input[type="checkbox"]'));}}});const _hoisted_1$
|
|
269
|
+
*/forceLegendUpdate(){this.legendKey++;},async updateCheckboxChildren(){await this.$nextTick();this.children=Array.from(this.$el.querySelectorAll('input[type="checkbox"]'));}}});const _hoisted_1$H=["id"];const _hoisted_2$v={key:0,class:"sr-only"};const _hoisted_3$r={key:0,class:"label__message label__message--error"};const _hoisted_4$m={key:0,"data-test":"checked-boxes",class:"sr-only","aria-live":"polite"};const _hoisted_5$k={key:0};const _hoisted_6$g={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$M(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=vue.resolveComponent("f-icon");return vue.openBlock(),vue.createElementBlock("fieldset",{id:_ctx.id,class:vue.normalizeClass(["fieldset",_ctx.classes]),onValidity:_cache[0]||(_cache[0]=(...args)=>_ctx.onValidity&&_ctx.onValidity(...args))},[(vue.openBlock(),vue.createElementBlock("legend",{key:_ctx.legendKey,class:vue.normalizeClass(["label",_ctx.legendClass])},[vue.renderSlot(_ctx.$slots,"label"),vue.createTextVNode(),_ctx.hasCheckbox&&_ctx.children.length>1?(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$v,[vue.createElementVNode("span",null,vue.toDisplayString(_ctx.numberOfCheckboxesScreenReaderText),1/* TEXT */)])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),vue.renderSlot(_ctx.$slots,"description",vue.normalizeProps(vue.guardReactiveProps({descriptionClass:_ctx.descriptionClass,discreteDescriptionClass:_ctx.discreteDescriptionClass}))),vue.createTextVNode(),vue.renderSlot(_ctx.$slots,"error-message",vue.normalizeProps(vue.guardReactiveProps({hasError:_ctx.hasError,validationMessage:_ctx.validity.validationMessage})),()=>[_ctx.hasError?(vue.openBlock(),vue.createElementBlock("span",_hoisted_3$r,[vue.createVNode(_component_f_icon,{class:"label__icon--left",name:"error"}),vue.createTextVNode(" "+vue.toDisplayString(_ctx.validity.validationMessage),1/* TEXT */)])):vue.createCommentVNode("v-if",true)])],2/* CLASS */)),vue.createTextVNode(),_ctx.hasCheckbox?(vue.openBlock(),vue.createElementBlock("span",_hoisted_4$m,[_ctx.children.length===1?(vue.openBlock(),vue.createElementBlock("span",_hoisted_5$k,vue.toDisplayString(_ctx.checkboxCheckedScreenReaderText),1/* TEXT */)):(vue.openBlock(),vue.createElementBlock("span",_hoisted_6$g,vue.toDisplayString(_ctx.numberOfCheckedCheckboxesScreenText),1/* TEXT */))])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),_ctx.hasTooltipSlot?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:1},[vue.createElementVNode("div",_hoisted_7$d,[vue.createElementVNode("div",_hoisted_8$9,[vue.createElementVNode("div",_hoisted_9$5,[vue.renderSlot(_ctx.$slots,"label")])]),vue.createTextVNode(),vue.renderSlot(_ctx.$slots,"tooltip")]),vue.createTextVNode(),_ctx.hasDescriptionSlot||_ctx.hasErrorMessageSlot||_ctx.hasError?(vue.openBlock(),vue.createElementBlock("div",{key:0,class:vue.normalizeClass(["label",_ctx.groupLabelClass]),"aria-hidden":"true"},[vue.renderSlot(_ctx.$slots,"description",vue.normalizeProps(vue.guardReactiveProps({descriptionClass:_ctx.descriptionClass,discreteDescriptionClass:_ctx.discreteDescriptionClass}))),vue.createTextVNode(),vue.renderSlot(_ctx.$slots,"error-message",vue.normalizeProps(vue.guardReactiveProps({hasError:_ctx.hasError,validationMessage:_ctx.validity.validationMessage})),()=>[_ctx.hasError?(vue.openBlock(),vue.createElementBlock("span",_hoisted_10$5,[vue.createVNode(_component_f_icon,{class:"label__icon--left",name:"error"}),vue.createTextVNode(" "+vue.toDisplayString(_ctx.validity.validationMessage),1/* TEXT */)])):vue.createCommentVNode("v-if",true)])],2/* CLASS */)):vue.createCommentVNode("v-if",true)],64/* STABLE_FRAGMENT */)):vue.createCommentVNode("v-if",true),vue.createTextVNode(),vue.createElementVNode("div",{class:vue.normalizeClass(_ctx.groupContentClass)},[vue.renderSlot(_ctx.$slots,"default")],2/* CLASS */)],42,_hoisted_1$H);}const FFieldset=/* @__PURE__ */_export_sfc(_sfc_main$W,[["render",_sfc_render$M]]);const anyType$1=[String,Object,Array,Number,Date,Boolean];const _sfc_main$V=vue.defineComponent({name:"FCheckboxField",inheritAttrs:false,props:{/**
|
|
270
|
+
* Set to `true`, empty string `""` or string `"disabled"` to disable this input field.
|
|
271
|
+
*/disabled:{type:Boolean,required:false,default:false},/**
|
|
272
|
+
* The id for the input id attribute.
|
|
273
|
+
* The id for the label for attribute.
|
|
274
|
+
* If the prop is not set a random value will be generated.
|
|
275
|
+
*/id:{type:String,required:false,default:()=>logic.ElementIdService.generateElementId()},/**
|
|
276
|
+
* The value for the input checked attribute.
|
|
277
|
+
* @model
|
|
278
|
+
*/// ? The rule is disabled so that the `checked` prop can be undefined or null.
|
|
279
|
+
/* eslint-disable-next-line vue/require-default-prop -- technical debt,
|
|
280
|
+
/* it should contain a default value of undefined and proptype should
|
|
281
|
+
/* include undefined (see comment on line above) */modelValue:{type:anyType$1,required:false},/**
|
|
282
|
+
* The value for the input.
|
|
283
|
+
*/value:{type:anyType$1,required:true}},emits:["change","update:modelValue"],setup(){const{showDetails,getFieldsetLabelText}=useFieldset();return{showDetails,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=>lodash.isEqual(vue.toValue(it),vue.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
|
|
284
|
+
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=>!lodash.isEqual(vue.toValue(it),vue.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$G=["id","disabled"];const _hoisted_2$u=["for"];const _hoisted_3$q={key:0,class:"checkbox__details"};const _hoisted_4$l=/* @__PURE__ */vue.createElementVNode("br",null,null,-1/* HOISTED */);const _hoisted_5$j={key:0,class:"checkbox__details"};const _hoisted_6$f=/* @__PURE__ */vue.createElementVNode("br",null,null,-1/* HOISTED */);function _sfc_render$L(_ctx,_cache,$props,$setup,$data,$options){return vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass(["checkbox",_ctx.disabledClass]),onValidity:_cache[2]||(_cache[2]=(...args)=>_ctx.onValidity&&_ctx.onValidity(...args))},[vue.createElementVNode("input",vue.mergeProps({id:_ctx.id},_ctx.attrs,{ref:"checkboxInput",type:"checkbox",class:"checkbox__input",disabled:_ctx.disabled,onKeydown:_cache[0]||(_cache[0]=vue.withKeys((...args)=>_ctx.onKeydown&&_ctx.onKeydown(...args),["space"])),onChange:_cache[1]||(_cache[1]=$event=>_ctx.updateExpandedFlag())}),null,16,_hoisted_1$G),vue.createTextVNode(),vue.createElementVNode("label",{class:vue.normalizeClass(_ctx.$slots.details?"checkbox__label checkbox__width":"checkbox__label"),for:_ctx.id},[vue.renderSlot(_ctx.$slots,"default"),vue.createTextVNode(),_ctx.$slots.details?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:0},[_ctx.showDetails==="always"?(vue.openBlock(),vue.createElementBlock("span",_hoisted_3$q,[_hoisted_4$l,vue.createTextVNode(),vue.renderSlot(_ctx.$slots,"details")])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),_ctx.showDetails==="when-selected"?(vue.openBlock(),vue.createBlock(vue.Transition,{key:1,onEnter:_ctx.enter,onAfterEnter:_ctx.afterEnter,onLeave:_ctx.leave},{default:vue.withCtx(()=>[_ctx.expanded?(vue.openBlock(),vue.createElementBlock("span",_hoisted_5$j,[_hoisted_6$f,vue.createTextVNode(),vue.renderSlot(_ctx.$slots,"details",{height:_ctx.height})])):vue.createCommentVNode("v-if",true)]),_:3/* FORWARDED */},8,["onEnter","onAfterEnter","onLeave"])):vue.createCommentVNode("v-if",true)],64/* STABLE_FRAGMENT */)):vue.createCommentVNode("v-if",true)],10,_hoisted_2$u)],34/* CLASS, NEED_HYDRATION */);}const FCheckboxField=/* @__PURE__ */_export_sfc(_sfc_main$V,[["render",_sfc_render$L]]);const _sfc_main$U=vue.defineComponent({name:"FCheckboxGroup",components:{FFieldset},mixins:[TranslationMixin],inheritAttrs:false,props:{/**
|
|
285
285
|
* The id for the fieldset id attribute.
|
|
286
286
|
* If the prop is not set the id will be generated.
|
|
287
287
|
*/id:{type:String,required:false,default:()=>logic.ElementIdService.generateElementId()},/**
|
|
@@ -309,7 +309,7 @@ injected(){return this;}},methods:{updateExpandedFlag(){const checkboxInput=getH
|
|
|
309
309
|
* Property for changing the "modify" modal heading
|
|
310
310
|
*/modifyModalHeader:{type:String,required:false,default:logic.TranslationService.provider.translate("fkui.crud-dataset.modal.header.modify","Ändra rad")},/**
|
|
311
311
|
* Property for changing the "delete" modal heading
|
|
312
|
-
*/deleteModalHeader:{type:String,required:false,default:logic.TranslationService.provider.translate("fkui.crud-dataset.modal.header.delete","Är du säker på att du vill ta bort raden?")}},emits:["change","created","deleted","updated","update:modelValue"],data(){return{result:[],Operation,operation:Operation.NONE,item:null,originalItemToUpdate:null,isFormModalOpen:false,isConfirmModalOpen:false,callbackAfterItemAdd(){},callbackBeforeItemDelete(){}};},computed:{confirmButtonText(){return this.operation===Operation.ADD?this.$t("fkui.crud-dataset.modal.confirm.add","Lägg till"):this.$t("fkui.crud-dataset.modal.confirm.modify","Spara");},cancelButtonText(){return this.operation===Operation.ADD?this.$t("fkui.crud-dataset.modal.cancel.add","Avbryt"):this.$t("fkui.crud-dataset.modal.cancel.modify","Avbryt");},confirmDeleteButtons(){return[{label:this.$t("fkui.crud-dataset.modal.confirm.delete","Ja, ta bort"),type:"primary",event:"confirm"},{label:this.$t("fkui.crud-dataset.modal.cancel.delete","Nej, avbryt"),type:"secondary"}];},hasAddSlot(){return Boolean(this.$slots.add);},hasDeleteSlot(){return Boolean(this.$slots.delete);},hasModifySlot(){return Boolean(this.$slots.modify);},formModalHeader(){return this.operation===Operation.ADD?this.addNewModalHeader:this.modifyModalHeader;}},watch:{modelValue:{immediate:true,deep:true,handler(data){this.result=[...data];}}},mounted(){if(!this.hasAddSlot&&!this.hasDeleteSlot&&!this.hasModifySlot){throw Error("Atleast one template of the following must be defined. #add, #delete or #modify");}},methods:{createItem(){if(!this.hasAddSlot){throw Error("No template is defined for #add");}this.operation=Operation.ADD;this.item=this.beforeCreate?this.beforeCreate():{};this.isFormModalOpen=true;},deleteItem(item){if(!this.hasDeleteSlot){throw Error("No template is defined for #delete");}this.operation=Operation.DELETE;this.item=item;this.isConfirmModalOpen=true;},onDeleteConfirm(){if(!this.item){return;}this.callbackBeforeItemDelete(this.item);this.result=this.result.filter(item=>item!==this.item);this.$emit("deleted",this.item);this.$emit("update:modelValue",this.result);this.$emit("change",this.result);logic.alertScreenReader(this.$t("fkui.crud-dataset.aria-live.delete","Raden har tagits bort"),{assertive:true});},onDeleteClose(e){this.onModalClose();if(e.reason==="close"&&this.onCancel){this.onCancel();}},onModalClose(){this.isFormModalOpen=false;this.isConfirmModalOpen=false;},onFormModalSubmit(){if(!this.item){return;}if(this.operation===Operation.ADD){this.result.push(this.item);this.$emit("created",this.item);this.$emit("update:modelValue",this.result);this.$emit("change",this.result);this.callbackAfterItemAdd(this.item);logic.alertScreenReader(this.$t("fkui.crud-dataset.aria-live.add","En rad har lagts till"),{assertive:true});}else if(this.operation===Operation.MODIFY){if(this.originalItemToUpdate){Object.assign(this.originalItemToUpdate,this.item);}else{this.originalItemToUpdate=this.item;}this.$emit("updated",this.originalItemToUpdate);this.$emit("update:modelValue",this.result);this.$emit("change",this.result);logic.alertScreenReader(this.$t("fkui.crud-dataset.aria-live.modify","Raden har ändrats"),{assertive:true});}this.isFormModalOpen=false;},updateItem(item){if(!this.hasModifySlot){throw Error("No template is defined for #modify");}this.operation=Operation.MODIFY;this.originalItemToUpdate=item;this.item=logic.deepClone(item);this.isFormModalOpen=true;}}});const _hoisted_1$F={class:"crud-dataset"};const _hoisted_2$t={key:0};function _sfc_render$J(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=vue.resolveComponent("f-icon");const _component_f_form_modal=vue.resolveComponent("f-form-modal");const _component_f_confirm_modal=vue.resolveComponent("f-confirm-modal");return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$F,[vue.renderSlot(_ctx.$slots,"default"),vue.createTextVNode(),_ctx.hasAddSlot?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$t,[vue.createElementVNode("button",{"data-test":"f-crud-dataset-add-button",type:"button",class:"button button--discrete crud-dataset__add-button",onClick:_cache[0]||(_cache[0]=$event=>_ctx.createItem())},[vue.createVNode(_component_f_icon,{class:"button__icon",name:"plus"}),vue.createTextVNode(),vue.renderSlot(_ctx.$slots,"add-button",{},()=>[vue.createTextVNode(vue.toDisplayString(_ctx.$t("fkui.crud-dataset.button.add","Lägg till ny")),1/* TEXT */)])])])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),vue.createVNode(_component_f_form_modal,{"is-open":_ctx.isFormModalOpen,"aria-close-text":_ctx.$t("fkui.crud-dataset.modal.close","Stäng"),"use-error-list":false,"before-submit":_ctx.beforeSubmit,"before-validation":_ctx.beforeValidation,"on-cancel":_ctx.onCancel,onClose:_ctx.onModalClose,onCancel:_ctx.onCancel,onSubmit:_ctx.onFormModalSubmit},{header:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(_ctx.formModalHeader),1/* TEXT */)]),"input-text-fields":vue.withCtx(()=>[_ctx.operation===_ctx.Operation.ADD?vue.renderSlot(_ctx.$slots,"add",vue.normalizeProps(vue.mergeProps({key:0},{item:_ctx.item}))):vue.createCommentVNode("v-if",true),vue.createTextVNode(),_ctx.operation===_ctx.Operation.MODIFY?vue.renderSlot(_ctx.$slots,"modify",vue.normalizeProps(vue.mergeProps({key:1},{item:_ctx.item}))):vue.createCommentVNode("v-if",true)]),"submit-button-text":vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(_ctx.confirmButtonText),1/* TEXT */)]),"cancel-button-text":vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(_ctx.cancelButtonText),1/* TEXT */)]),_:3/* FORWARDED */},8,["is-open","aria-close-text","before-submit","before-validation","on-cancel","onClose","onCancel","onSubmit"]),vue.createTextVNode(),vue.createVNode(_component_f_confirm_modal,{"is-open":_ctx.isConfirmModalOpen,buttons:_ctx.confirmDeleteButtons,onConfirm:_ctx.onDeleteConfirm,onClose:_ctx.onDeleteClose},{heading:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(_ctx.deleteModalHeader),1/* TEXT */)]),content:vue.withCtx(()=>[vue.renderSlot(_ctx.$slots,"delete",vue.normalizeProps(vue.guardReactiveProps({item:_ctx.item})))]),_:3/* FORWARDED */},8,["is-open","buttons","onConfirm","onClose"])]);}const FCrudDataset=/* @__PURE__ */_export_sfc(_sfc_main$T,[["render",_sfc_render$J]]);function FCrudDatasetInjected(){return{delete:vue.inject("delete"),modify:vue.inject("modify")};}const _sfc_main$S=vue.defineComponent({name:"FCrudButton",components:{FIcon},mixins:[TranslationMixin],props:{action:{type:String,required:true,validator(value){return["delete","modify"].includes(value);}},icon:{type:Boolean,default:false},item:{type:Object,required:true},label:{type:Boolean,default:false}},setup(){return FCrudDatasetInjected();},computed:{iconName(){if(this.action==="delete"){return"trashcan";}else{return"pen";}},buttonText(){if(this.action==="delete"){return this.$t("fkui.crud-button.delete","Ta bort");}else{return this.$t("fkui.crud-button.modify","Ändra");}}},methods:{executeAction(){if(this.action==="delete"){this.delete(this.item);}else{this.modify(this.item);}}}});const _hoisted_1$E={key:1,class:"sr-only"};function _sfc_render$I(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=vue.resolveComponent("f-icon");return vue.openBlock(),vue.createElementBlock("button",{type:"button",class:"button button--discrete",onClick:_cache[0]||(_cache[0]=(...args)=>_ctx.executeAction&&_ctx.executeAction(...args))},[_ctx.icon?(vue.openBlock(),vue.createBlock(_component_f_icon,{key:0,class:"button__icon",name:_ctx.iconName},null,8,["name"])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),!_ctx.label?(vue.openBlock(),vue.createElementBlock("span",_hoisted_1$E,[vue.renderSlot(_ctx.$slots,"default",{},()=>[vue.createTextVNode(vue.toDisplayString(_ctx.buttonText),1/* TEXT */)])])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),_ctx.label?vue.renderSlot(_ctx.$slots,"default",{key:2},()=>[vue.createTextVNode(vue.toDisplayString(_ctx.buttonText),1/* TEXT */)]):vue.createCommentVNode("v-if",true)]);}const FCrudButton=/* @__PURE__ */_export_sfc(_sfc_main$S,[["render",_sfc_render$I]]);function ActivateItemInjected(){return{registerCallbackAfterItemAdd:vue.inject("registerCallbackAfterItemAdd",()=>void 0),registerCallbackBeforeItemDelete:vue.inject("registerCallbackBeforeItemDelete",()=>void 0)};}var FTableColumnType=/* @__PURE__ */(FTableColumnType2=>{FTableColumnType2["TEXT"]="text";FTableColumnType2["DATE"]="date";FTableColumnType2["NUMERIC"]="numeric";FTableColumnType2["ACTION"]="action";return FTableColumnType2;})(FTableColumnType||{});var FTableColumnSize=/* @__PURE__ */(FTableColumnSize2=>{FTableColumnSize2["EXPAND"]="table__column--expand";FTableColumnSize2["SHRINK"]="table__column--shrink";return FTableColumnSize2;})(FTableColumnSize||{});var FTableColumnSort=/* @__PURE__ */(FTableColumnSort2=>{FTableColumnSort2["UNSORTED"]="unsorted";FTableColumnSort2["ASCENDING"]="ascending";FTableColumnSort2["DESCENDING"]="descending";return FTableColumnSort2;})(FTableColumnSort||{});function addColumn(src,column){if(!src.some(col=>col.name===column.name)){return[...src,column];}return src;}function setVisibilityColumn(src,id,visible){const column=src.find(col=>col.name===id);if(column){column.visible=visible;}}function updateSortOrder(src,columnName,ascending){src.forEach(column=>{if(column.name===columnName){column.sort=ascending?"ascending":"descending";}else{column.sort="unsorted";}});}function setSortableColumns(src,columnNames){for(const columnName of columnNames){const foundColumn=src.find(col=>col.name===columnName);if(foundColumn){foundColumn.sortable=true;}}}function getSortableIconName(column){switch(column.sort){case"unsorted":return"sort";case"ascending":return"caret-up";case"descending":return"caret-down";default:return"";}}function getSortableIconClasses(column){const classes=["table__column__header__icon"];if(column.sort==="unsorted"){classes.push("table__column__header__icon--discrete");}return classes;}function isTableColumnType(value){return["text","date","numeric","action"].includes(value);}function FTableInjected(){return{addColumn:vue.inject("addColumn"),setVisibilityColumn:vue.inject("setVisibilityColumn"),textFieldTableMode:true};}const _sfc_main$R=vue.defineComponent({name:"FTableColumn",inheritAttrs:false,props:{/**
|
|
312
|
+
*/deleteModalHeader:{type:String,required:false,default:logic.TranslationService.provider.translate("fkui.crud-dataset.modal.header.delete","Är du säker på att du vill ta bort raden?")}},emits:["change","created","deleted","updated","update:modelValue"],data(){return{result:[],Operation,operation:Operation.NONE,item:null,originalItemToUpdate:null,isFormModalOpen:false,isConfirmModalOpen:false,callbackAfterItemAdd(){},callbackBeforeItemDelete(){}};},computed:{confirmButtonText(){return this.operation===Operation.ADD?this.$t("fkui.crud-dataset.modal.confirm.add","Lägg till"):this.$t("fkui.crud-dataset.modal.confirm.modify","Spara");},cancelButtonText(){return this.operation===Operation.ADD?this.$t("fkui.crud-dataset.modal.cancel.add","Avbryt"):this.$t("fkui.crud-dataset.modal.cancel.modify","Avbryt");},confirmDeleteButtons(){return[{label:this.$t("fkui.crud-dataset.modal.confirm.delete","Ja, ta bort"),type:"primary",event:"confirm"},{label:this.$t("fkui.crud-dataset.modal.cancel.delete","Nej, avbryt"),type:"secondary"}];},hasAddSlot(){return Boolean(this.$slots.add);},hasDeleteSlot(){return Boolean(this.$slots.delete);},hasModifySlot(){return Boolean(this.$slots.modify);},formModalHeader(){return this.operation===Operation.ADD?this.addNewModalHeader:this.modifyModalHeader;}},watch:{modelValue:{immediate:true,deep:true,handler(data){this.result=[...data];}}},mounted(){if(!this.hasAddSlot&&!this.hasDeleteSlot&&!this.hasModifySlot){throw Error("Atleast one template of the following must be defined. #add, #delete or #modify");}},methods:{createItem(){if(!this.hasAddSlot){throw Error("No template is defined for #add");}this.operation=Operation.ADD;this.item=this.beforeCreate?this.beforeCreate():{};this.isFormModalOpen=true;},deleteItem(item){if(!this.hasDeleteSlot){throw Error("No template is defined for #delete");}this.operation=Operation.DELETE;this.item=item;this.isConfirmModalOpen=true;},onDeleteConfirm(){if(!this.item){return;}this.callbackBeforeItemDelete(this.item);this.result=this.result.filter(item=>item!==this.item);this.$emit("deleted",this.item);this.$emit("update:modelValue",this.result);this.$emit("change",this.result);logic.alertScreenReader(this.$t("fkui.crud-dataset.aria-live.delete","Raden har tagits bort"),{assertive:true});},onDeleteClose(e){this.onModalClose();if(e.reason==="close"&&this.onCancel){this.onCancel();}},onModalClose(){this.isFormModalOpen=false;this.isConfirmModalOpen=false;},onFormModalSubmit(){if(!this.item){return;}if(this.operation===Operation.ADD){this.result.push(this.item);this.$emit("created",this.item);this.$emit("update:modelValue",this.result);this.$emit("change",this.result);this.callbackAfterItemAdd(this.item);logic.alertScreenReader(this.$t("fkui.crud-dataset.aria-live.add","En rad har lagts till"),{assertive:true});}else if(this.operation===Operation.MODIFY){if(this.originalItemToUpdate){Object.assign(this.originalItemToUpdate,this.item);}else{this.originalItemToUpdate=this.item;}this.$emit("updated",this.originalItemToUpdate);this.$emit("update:modelValue",this.result);this.$emit("change",this.result);logic.alertScreenReader(this.$t("fkui.crud-dataset.aria-live.modify","Raden har ändrats"),{assertive:true});}this.isFormModalOpen=false;},updateItem(item){if(!this.hasModifySlot){throw Error("No template is defined for #modify");}this.operation=Operation.MODIFY;this.originalItemToUpdate=item;this.item=logic.deepClone(item);this.isFormModalOpen=true;}}});const _hoisted_1$F={class:"crud-dataset"};const _hoisted_2$t={key:0};function _sfc_render$J(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=vue.resolveComponent("f-icon");const _component_f_form_modal=vue.resolveComponent("f-form-modal");const _component_f_confirm_modal=vue.resolveComponent("f-confirm-modal");return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$F,[vue.renderSlot(_ctx.$slots,"default"),vue.createTextVNode(),_ctx.hasAddSlot?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$t,[vue.createElementVNode("button",{"data-test":"f-crud-dataset-add-button",type:"button",class:"button button--tertiary crud-dataset__add-button",onClick:_cache[0]||(_cache[0]=$event=>_ctx.createItem())},[vue.createVNode(_component_f_icon,{class:"button__icon",name:"plus"}),vue.createTextVNode(),vue.renderSlot(_ctx.$slots,"add-button",{},()=>[vue.createTextVNode(vue.toDisplayString(_ctx.$t("fkui.crud-dataset.button.add","Lägg till ny")),1/* TEXT */)])])])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),vue.createVNode(_component_f_form_modal,{"is-open":_ctx.isFormModalOpen,"aria-close-text":_ctx.$t("fkui.crud-dataset.modal.close","Stäng"),"use-error-list":false,"before-submit":_ctx.beforeSubmit,"before-validation":_ctx.beforeValidation,"on-cancel":_ctx.onCancel,onClose:_ctx.onModalClose,onCancel:_ctx.onCancel,onSubmit:_ctx.onFormModalSubmit},{header:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(_ctx.formModalHeader),1/* TEXT */)]),"input-text-fields":vue.withCtx(()=>[_ctx.operation===_ctx.Operation.ADD?vue.renderSlot(_ctx.$slots,"add",vue.normalizeProps(vue.mergeProps({key:0},{item:_ctx.item}))):vue.createCommentVNode("v-if",true),vue.createTextVNode(),_ctx.operation===_ctx.Operation.MODIFY?vue.renderSlot(_ctx.$slots,"modify",vue.normalizeProps(vue.mergeProps({key:1},{item:_ctx.item}))):vue.createCommentVNode("v-if",true)]),"submit-button-text":vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(_ctx.confirmButtonText),1/* TEXT */)]),"cancel-button-text":vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(_ctx.cancelButtonText),1/* TEXT */)]),_:3/* FORWARDED */},8,["is-open","aria-close-text","before-submit","before-validation","on-cancel","onClose","onCancel","onSubmit"]),vue.createTextVNode(),vue.createVNode(_component_f_confirm_modal,{"is-open":_ctx.isConfirmModalOpen,buttons:_ctx.confirmDeleteButtons,onConfirm:_ctx.onDeleteConfirm,onClose:_ctx.onDeleteClose},{heading:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(_ctx.deleteModalHeader),1/* TEXT */)]),content:vue.withCtx(()=>[vue.renderSlot(_ctx.$slots,"delete",vue.normalizeProps(vue.guardReactiveProps({item:_ctx.item})))]),_:3/* FORWARDED */},8,["is-open","buttons","onConfirm","onClose"])]);}const FCrudDataset=/* @__PURE__ */_export_sfc(_sfc_main$T,[["render",_sfc_render$J]]);function FCrudDatasetInjected(){return{delete:vue.inject("delete"),modify:vue.inject("modify")};}const _sfc_main$S=vue.defineComponent({name:"FCrudButton",components:{FIcon},mixins:[TranslationMixin],props:{action:{type:String,required:true,validator(value){return["delete","modify"].includes(value);}},icon:{type:Boolean,default:false},item:{type:Object,required:true},label:{type:Boolean,default:false}},setup(){return FCrudDatasetInjected();},computed:{iconName(){if(this.action==="delete"){return"trashcan";}else{return"pen";}},buttonText(){if(this.action==="delete"){return this.$t("fkui.crud-button.delete","Ta bort");}else{return this.$t("fkui.crud-button.modify","Ändra");}}},methods:{executeAction(){if(this.action==="delete"){this.delete(this.item);}else{this.modify(this.item);}}}});const _hoisted_1$E={key:1,class:"sr-only"};function _sfc_render$I(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=vue.resolveComponent("f-icon");return vue.openBlock(),vue.createElementBlock("button",{type:"button",class:"button button--small button--tertiary",onClick:_cache[0]||(_cache[0]=(...args)=>_ctx.executeAction&&_ctx.executeAction(...args))},[_ctx.icon?(vue.openBlock(),vue.createBlock(_component_f_icon,{key:0,class:"button__icon",name:_ctx.iconName},null,8,["name"])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),!_ctx.label?(vue.openBlock(),vue.createElementBlock("span",_hoisted_1$E,[vue.renderSlot(_ctx.$slots,"default",{},()=>[vue.createTextVNode(vue.toDisplayString(_ctx.buttonText),1/* TEXT */)])])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),_ctx.label?vue.renderSlot(_ctx.$slots,"default",{key:2},()=>[vue.createTextVNode(vue.toDisplayString(_ctx.buttonText),1/* TEXT */)]):vue.createCommentVNode("v-if",true)]);}const FCrudButton=/* @__PURE__ */_export_sfc(_sfc_main$S,[["render",_sfc_render$I]]);function ActivateItemInjected(){return{registerCallbackAfterItemAdd:vue.inject("registerCallbackAfterItemAdd",()=>void 0),registerCallbackBeforeItemDelete:vue.inject("registerCallbackBeforeItemDelete",()=>void 0)};}var FTableColumnType=/* @__PURE__ */(FTableColumnType2=>{FTableColumnType2["TEXT"]="text";FTableColumnType2["DATE"]="date";FTableColumnType2["NUMERIC"]="numeric";FTableColumnType2["ACTION"]="action";return FTableColumnType2;})(FTableColumnType||{});var FTableColumnSize=/* @__PURE__ */(FTableColumnSize2=>{FTableColumnSize2["EXPAND"]="table__column--expand";FTableColumnSize2["SHRINK"]="table__column--shrink";return FTableColumnSize2;})(FTableColumnSize||{});var FTableColumnSort=/* @__PURE__ */(FTableColumnSort2=>{FTableColumnSort2["UNSORTED"]="unsorted";FTableColumnSort2["ASCENDING"]="ascending";FTableColumnSort2["DESCENDING"]="descending";return FTableColumnSort2;})(FTableColumnSort||{});function addColumn(src,column){if(!src.some(col=>col.name===column.name)){return[...src,column];}return src;}function setVisibilityColumn(src,id,visible){const column=src.find(col=>col.name===id);if(column){column.visible=visible;}}function updateSortOrder(src,columnName,ascending){src.forEach(column=>{if(column.name===columnName){column.sort=ascending?"ascending":"descending";}else{column.sort="unsorted";}});}function setSortableColumns(src,columnNames){for(const columnName of columnNames){const foundColumn=src.find(col=>col.name===columnName);if(foundColumn){foundColumn.sortable=true;}}}function getSortableIconName(column){switch(column.sort){case"unsorted":return"sort";case"ascending":return"caret-up";case"descending":return"caret-down";default:return"";}}function getSortableIconClasses(column){const classes=["table__column__header__icon"];if(column.sort==="unsorted"){classes.push("table__column__header__icon--discrete");}return classes;}function isTableColumnType(value){return["text","date","numeric","action"].includes(value);}function FTableInjected(){return{addColumn:vue.inject("addColumn"),setVisibilityColumn:vue.inject("setVisibilityColumn"),textFieldTableMode:true};}const _sfc_main$R=vue.defineComponent({name:"FTableColumn",inheritAttrs:false,props:{/**
|
|
313
313
|
* Unique (per-table) identifier.
|
|
314
314
|
*
|
|
315
315
|
* Typically set to the row property displayed but any unique string can
|
|
@@ -445,7 +445,8 @@ defaultText:"",descriptionText:"",descriptionScreenReaderText:"",discreteDescrip
|
|
|
445
445
|
* @model
|
|
446
446
|
*/decimals:{type:Number,required:false,default:void 0},formatter:{type:Function,required:false,default:defaultFormatter$1},parser:{type:Function,required:false,default:logic.parseNumber}},setup(){return{textFieldTableMode:vue.inject("textFieldTableMode",false)};},mounted(){const inputElement=getInputElement(this);inputElement.setAttribute("inputmode","numeric");inputElement.setAttribute("maxlength","20");logic.ValidationService.addValidatorsToElement(inputElement,{number:{}},true);logic.ValidationService.validateElement(inputElement);}});const _sfc_main$E=vue.defineComponent({name:"FPersonnummerTextField",extends:FTextField,mixins:[TranslationMixin],props:{formatter:{type:Function,required:false,default:logic.formatPersonnummer},parser:{type:Function,required:false,default:logic.parsePersonnummer}},setup(){return{textFieldTableMode:vue.inject("textFieldTableMode",false)};},data(){return{defaultText:this.$t("fkui.personnummer-text-field.label-10-digits","Personnummer"),discreteDescriptionText:this.$t("fkui.personnummer-text-field.example-10-digits","(ååmmdd-nnnn)"),discreteDescriptionScreenReaderText:this.$t("fkui.personnummer-text-field.format-description-10-digits","Skriv personnumret med 10 siffror,")};},mounted(){const inputElement=getInputElement(this);logic.ValidationService.addValidatorsToElement(inputElement,{maxLength:{length:20},personnummerFormat:{},personnummerLuhn:{}},true);inputElement.setAttribute("inputmode","numeric");inputElement.setAttribute("maxlength","23");logic.ValidationService.validateElement(inputElement);}});const _sfc_main$D=vue.defineComponent({name:"FPlusgiroTextField",extends:FTextField,mixins:[TranslationMixin],props:{formatter:{type:Function,required:false,default:logic.parsePlusgiro}},setup(){return{textFieldTableMode:vue.inject("textFieldTableMode",false)};},data(){return{defaultText:this.$t("fkui.plusgiro-text-field.label","Plusgironummer")};},mounted(){const inputElement=getInputElement(this);logic.ValidationService.addValidatorsToElement(inputElement,{maxLength:{length:11},plusgiro:{}},true);inputElement.setAttribute("inputmode","numeric");inputElement.setAttribute("maxlength","16");logic.ValidationService.validateElement(inputElement);}});const _sfc_main$C=vue.defineComponent({name:"FPostalCodeTextField",extends:FTextField,mixins:[TranslationMixin],props:{formatter:{type:Function,required:false,default:logic.formatPostalCode}},setup(){return{textFieldTableMode:vue.inject("textFieldTableMode",false)};},data(){return{defaultText:this.$t("fkui.postal-code-text-field.label","Postnummer"),discreteDescriptionText:this.$t("fkui.postal-code-text-field.example","(123 45)"),discreteDescriptionScreenReaderText:this.$t("fkui.postal-code-text-field.format-description","Formatbeskrivning")};},mounted(){const inputElement=getInputElement(this);logic.ValidationService.addValidatorsToElement(inputElement,{maxLength:{length:13},postalCode:{}},true);inputElement.setAttribute("inputmode","numeric");inputElement.setAttribute("maxlength","15");logic.ValidationService.validateElement(inputElement);}});function defaultFormatter(modelValue){return logic.formatPercent(modelValue,this.decimals);}const _sfc_main$B=vue.defineComponent({name:"FPercentTextField",extends:FTextField,mixins:[TranslationMixin],props:{/**
|
|
447
447
|
* The number of decimals to format number as.
|
|
448
|
-
*/decimals:{type:Number,required:false,default:void 0},formatter:{type:Function,required:false,default:defaultFormatter},parser:{type:Function,required:false,default:logic.parsePercent}},setup(){return{textFieldTableMode:vue.inject("textFieldTableMode",false)};},data(){return{defaultText:this.$t("fkui.percent-text-field.label","Procent")};},mounted(){const inputElement=getInputElement(this);inputElement.setAttribute("inputmode",this.decimals?"decimal":"numeric");inputElement.setAttribute("maxlength","10");logic.ValidationService.addValidatorsToElement(inputElement,{percent:{},minValue:{minValue:0},maxValue:{maxValue:999}},true);logic.ValidationService.validateElement(inputElement);}});const _sfc_main$A=vue.defineComponent({name:"FOrganisationsnummerTextField",extends:FTextField,mixins:[TranslationMixin],props:{formatter:{type:Function,required:false,default:logic.parseOrganisationsnummer}},setup(){return{textFieldTableMode:vue.inject("textFieldTableMode",false)};},data(){return{defaultText:this.$t("fkui.organisationsnummer-text-field.label","Organisationsnummer"),discreteDescriptionText:this.$t("fkui.organisationsnummer-text-field.example","(999999-9999)"),discreteDescriptionScreenReaderText:this.$t("fkui.organisationsnummer-text-field.format-description","Formatbeskrivning")};},mounted(){const inputElement=getInputElement(this);logic.ValidationService.addValidatorsToElement(inputElement,{maxLength:{length:11},organisationsnummer:{}},true);inputElement.setAttribute("inputmode","numeric");inputElement.setAttribute("maxlength","20");logic.ValidationService.validateElement(inputElement);}});function sort(list,sortAttribute,ascending){return list.sort((item1,item2)=>compare(item1,item2,sortAttribute,ascending));}function compare(item1,item2,attribute,ascending){const value1=item1[attribute];const value2=item2[attribute];if(!logic.isSet(value1)||!logic.isSet(value2)){return nullCompare(value1,value2);}if(
|
|
448
|
+
*/decimals:{type:Number,required:false,default:void 0},formatter:{type:Function,required:false,default:defaultFormatter},parser:{type:Function,required:false,default:logic.parsePercent}},setup(){return{textFieldTableMode:vue.inject("textFieldTableMode",false)};},data(){return{defaultText:this.$t("fkui.percent-text-field.label","Procent")};},mounted(){const inputElement=getInputElement(this);inputElement.setAttribute("inputmode",this.decimals?"decimal":"numeric");inputElement.setAttribute("maxlength","10");logic.ValidationService.addValidatorsToElement(inputElement,{percent:{},minValue:{minValue:0},maxValue:{maxValue:999}},true);logic.ValidationService.validateElement(inputElement);}});const _sfc_main$A=vue.defineComponent({name:"FOrganisationsnummerTextField",extends:FTextField,mixins:[TranslationMixin],props:{formatter:{type:Function,required:false,default:logic.parseOrganisationsnummer}},setup(){return{textFieldTableMode:vue.inject("textFieldTableMode",false)};},data(){return{defaultText:this.$t("fkui.organisationsnummer-text-field.label","Organisationsnummer"),discreteDescriptionText:this.$t("fkui.organisationsnummer-text-field.example","(999999-9999)"),discreteDescriptionScreenReaderText:this.$t("fkui.organisationsnummer-text-field.format-description","Formatbeskrivning")};},mounted(){const inputElement=getInputElement(this);logic.ValidationService.addValidatorsToElement(inputElement,{maxLength:{length:11},organisationsnummer:{}},true);inputElement.setAttribute("inputmode","numeric");inputElement.setAttribute("maxlength","20");logic.ValidationService.validateElement(inputElement);}});function sort(list,sortAttribute,ascending){return list.sort((item1,item2)=>compare(item1,item2,sortAttribute,ascending));}function compare(item1,item2,attribute,ascending){const value1=item1[attribute];const value2=item2[attribute];if(!logic.isSet(value1)||!logic.isSet(value2)){return nullCompare(value1,value2);}if(!isSupportedType(value1)||!isSupportedType(value2)){throw Error(`Sorting is only supported for types number, string and boolean.
|
|
449
|
+
Attribute '${attribute.toString()}' comparsion of types '${typeof value1}' and '${typeof value2}' is not supported.`);}if(typeof value1==="string"&&typeof value2==="string"){return fixOrder(value1.localeCompare(value2),ascending);}if(typeof value1==="number"&&typeof value2==="number"){return fixOrder(numberCompare(value1,value2),ascending);}if(typeof value1==="boolean"&&typeof value2==="boolean"){return fixOrder(booleanCompare(value1,value2),ascending);}if(typeof value1==="string"){return-1;}else{return 1;}}function isSupportedType(value){return["string","number","boolean"].includes(typeof value);}function fixOrder(order,ascending){return ascending?order:order-order*2;}function booleanCompare(value1,value2){if(value1===value2){return 0;}else if(value1>value2){return 1;}return-1;}function numberCompare(value1,value2){return value1-value2;}function nullCompare(value1,value2){if(!logic.isSet(value1)&&!logic.isSet(value2)){return 0;}else if(!logic.isSet(value1)){return 1;}return-1;}function includesAllSearchTerms(item,filterAttributes,searchTerms){const values=filterAttributes.map(it=>{const value=item[it];return logic.isSet(value)?value.toString().toLocaleLowerCase():void 0;}).filter(Boolean);for(const searchTerm of searchTerms){const match=values.find(it=>it==null?void 0:it.includes(searchTerm));if(!match){return false;}}return true;}function filter(list,filterAttributes,searchString){searchString=searchString.trim();if(searchString.trim()===""){return list;}const searchTerms=searchString.split(/\s+/).map(word=>word.toLocaleLowerCase());return list.filter(item=>includesAllSearchTerms(item,filterAttributes,searchTerms));}const _sfc_main$z=vue.defineComponent({name:"FSortFilterDataset",components:{FSelectField,FTextField,FIcon,IFlex,IFlexItem},mixins:[TranslationMixin],provide(){return{sort:(attribute,ascending)=>{const foundAttribute=this.sortOrders.find(item=>item.attribute===attribute&&item.ascending===ascending);if(foundAttribute){this.sortAttribute=foundAttribute;}else{this.sortAttribute={attribute:"",ascending:false};}this.sortFilterData();this.$emit("usedSortAttributes",this.sortAttribute);},registerCallbackOnSort:callback=>{this.tableCallbackOnSort=callback;},registerCallbackOnMount:callback=>{this.tableCallbackSortableColumns=callback;}};},props:{/**
|
|
449
450
|
* The data that you wish to sort or filter.
|
|
450
451
|
*/data:{type:Array,required:true,default:()=>[]},/**
|
|
451
452
|
* All the attributes you want to enable sorting for and the corresponding name to display in the dropdown.
|
|
@@ -477,7 +478,7 @@ defaultText:"",descriptionText:"",descriptionScreenReaderText:"",discreteDescrip
|
|
|
477
478
|
* - `"vertical"`: Enables vertical scrolling
|
|
478
479
|
* - `"both"`: Enables scrolling in both directions
|
|
479
480
|
* - `"none"`: Disables scrolling (default)
|
|
480
|
-
*/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=vue.resolveComponent("f-icon");return vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass(_ctx.wrapperClasses)},[vue.createElementVNode("table",vue.mergeProps({class:["table",_ctx.tableClasses],tabindex:_ctx.tabindex},_ctx.$attrs),[_ctx.hasCaption?(vue.openBlock(),vue.createElementBlock("caption",_hoisted_2$p,[vue.renderSlot(_ctx.$slots,"caption")])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),vue.createElementVNode("colgroup",null,[(vue.openBlock(true),vue.createElementBlock(vue.Fragment,null,vue.renderList(_ctx.columns,column=>{return vue.openBlock(),vue.createElementBlock("col",{key:column.id,class:vue.normalizeClass(column.size)},null,2/* CLASS */);}),128/* KEYED_FRAGMENT */))]),vue.createTextVNode(),vue.createElementVNode("thead",null,[vue.createElementVNode("tr",_hoisted_3$m,[(vue.openBlock(true),vue.createElementBlock(vue.Fragment,null,vue.renderList(_ctx.visibleColumns,column=>{return vue.openBlock(),vue.createElementBlock("th",vue.mergeProps({key:column.id,scope:"col",class:_ctx.columnClasses(column)},vue.toHandlers(column.sortable?{click:()=>_ctx.onClickColumnHeader(column)}:{},true)),[vue.createElementVNode("span",{innerHTML:_ctx.escapeNewlines(column.title)},null,8,_hoisted_4$h),vue.createTextVNode(),column.sortable?(vue.openBlock(),vue.createBlock(_component_f_icon,{key:0,class:vue.normalizeClass(_ctx.iconClasses(column)),name:_ctx.iconName(column)},null,8,["class","name"])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),column.description?(vue.openBlock(),vue.createElementBlock("span",_hoisted_5$f,vue.toDisplayString(column.description),1/* TEXT */)):vue.createCommentVNode("v-if",true)],16/* FULL_PROPS */);}),128/* KEYED_FRAGMENT */))])]),vue.createTextVNode(),vue.createElementVNode("tbody",null,[!_ctx.hasInitiateColumns?(vue.openBlock(),vue.createElementBlock("tr",_hoisted_6$b,[vue.renderSlot(_ctx.$slots,"default",vue.normalizeProps(vue.guardReactiveProps({row:_ctx.emptyRow})))])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),_ctx.isEmpty?(vue.openBlock(),vue.createElementBlock("tr",_hoisted_7$a,[vue.createElementVNode("td",{class:"table__column table__column--action",colspan:_ctx.columns.length},[vue.renderSlot(_ctx.$slots,"empty",{},()=>[vue.createTextVNode(vue.toDisplayString(_ctx.$t("fkui.data-table.empty","Tabellen är tom")),1/* TEXT */)])],8,_hoisted_8$8)])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),(vue.openBlock(true),vue.createElementBlock(vue.Fragment,null,vue.renderList(_ctx.rows,row=>{return vue.openBlock(),vue.createElementBlock("tr",{key:_ctx.rowKey(row),class:"table__row"},[vue.renderSlot(_ctx.$slots,"default",vue.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(!logic.isInvalidDatesConfig(config2)){throw new Error("Invalid invalidDates config");}return!config2.dates.includes(day.toString());}function passesInvalidWeekdays(day,config2){if(!config2){return true;}if(!logic.isInvalidWeekdaysConfig(config2)){throw new Error("Invalid invalidWeekdays config");}return!config2.days.includes(day.weekDay);}function updateCalendarValue(newValue){const newCalendarValue=date.FDate.fromIso(newValue);if(!newCalendarValue.isValid()){
|
|
481
|
+
*/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",{},{stripClasses:[]});},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=vue.resolveComponent("f-icon");return vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass(_ctx.wrapperClasses)},[vue.createElementVNode("table",vue.mergeProps({class:["table",_ctx.tableClasses],tabindex:_ctx.tabindex},_ctx.$attrs),[_ctx.hasCaption?(vue.openBlock(),vue.createElementBlock("caption",_hoisted_2$p,[vue.renderSlot(_ctx.$slots,"caption")])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),vue.createElementVNode("colgroup",null,[(vue.openBlock(true),vue.createElementBlock(vue.Fragment,null,vue.renderList(_ctx.columns,column=>{return vue.openBlock(),vue.createElementBlock("col",{key:column.id,class:vue.normalizeClass(column.size)},null,2/* CLASS */);}),128/* KEYED_FRAGMENT */))]),vue.createTextVNode(),vue.createElementVNode("thead",null,[vue.createElementVNode("tr",_hoisted_3$m,[(vue.openBlock(true),vue.createElementBlock(vue.Fragment,null,vue.renderList(_ctx.visibleColumns,column=>{return vue.openBlock(),vue.createElementBlock("th",vue.mergeProps({key:column.id,scope:"col",class:_ctx.columnClasses(column)},vue.toHandlers(column.sortable?{click:()=>_ctx.onClickColumnHeader(column)}:{},true)),[vue.createElementVNode("span",{innerHTML:_ctx.escapeNewlines(column.title)},null,8,_hoisted_4$h),vue.createTextVNode(),column.sortable?(vue.openBlock(),vue.createBlock(_component_f_icon,{key:0,class:vue.normalizeClass(_ctx.iconClasses(column)),name:_ctx.iconName(column)},null,8,["class","name"])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),column.description?(vue.openBlock(),vue.createElementBlock("span",_hoisted_5$f,vue.toDisplayString(column.description),1/* TEXT */)):vue.createCommentVNode("v-if",true)],16/* FULL_PROPS */);}),128/* KEYED_FRAGMENT */))])]),vue.createTextVNode(),vue.createElementVNode("tbody",null,[!_ctx.hasInitiateColumns?(vue.openBlock(),vue.createElementBlock("tr",_hoisted_6$b,[vue.renderSlot(_ctx.$slots,"default",vue.normalizeProps(vue.guardReactiveProps({row:_ctx.emptyRow})))])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),_ctx.isEmpty?(vue.openBlock(),vue.createElementBlock("tr",_hoisted_7$a,[vue.createElementVNode("td",{class:"table__column table__column--action",colspan:_ctx.columns.length},[vue.renderSlot(_ctx.$slots,"empty",{},()=>[vue.createTextVNode(vue.toDisplayString(_ctx.$t("fkui.data-table.empty","Tabellen är tom")),1/* TEXT */)])],8,_hoisted_8$8)])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),(vue.openBlock(true),vue.createElementBlock(vue.Fragment,null,vue.renderList(_ctx.rows,row=>{return vue.openBlock(),vue.createElementBlock("tr",{key:_ctx.rowKey(row),class:"table__row"},[vue.renderSlot(_ctx.$slots,"default",vue.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(!logic.isInvalidDatesConfig(config2)){throw new Error("Invalid invalidDates config");}return!config2.dates.includes(day.toString());}function passesInvalidWeekdays(day,config2){if(!config2){return true;}if(!logic.isInvalidWeekdaysConfig(config2)){throw new Error("Invalid invalidWeekdays config");}return!config2.days.includes(day.weekDay);}function updateCalendarValue(datepicker,newValue){const{isDateEnabled,minDate,maxDate}=datepicker;const newCalendarValue=date.FDate.fromIso(newValue);if(!newCalendarValue.isValid()){datepicker.calendarValue=void 0;}else if(isInvalidMonth(newCalendarValue,minDate,maxDate)){datepicker.calendarValue=void 0;}else if(!isDateEnabled(newCalendarValue)){datepicker.calendarValue=void 0;}else if(!datepicker.calendarValue||!datepicker.calendarValue.equals(newCalendarValue)){datepicker.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=date.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||date.FDate.now().startOfMonth();}const _sfc_main$x=vue.defineComponent({name:"FDatepickerField",components:{FCalendar,IPopup,FTextField,FIcon,FCalendarDay},mixins:[TranslationMixin],inheritAttrs:false,props:{/** Selected day.
|
|
481
482
|
* @model
|
|
482
483
|
*/modelValue:{type:String,required:false,default:""},/**
|
|
483
484
|
* Initial month. Applies when no day is selected.
|
|
@@ -500,7 +501,7 @@ defaultText:"",descriptionText:"",descriptionScreenReaderText:"",discreteDescrip
|
|
|
500
501
|
* ```
|
|
501
502
|
*/inputWidth:{type:String,required:false,default:"sm-12"},/**
|
|
502
503
|
* Set to `true`, empty string `""` or string `"disabled"` to disable this field.
|
|
503
|
-
*/disabled:{type:Boolean,required:false,default:false}},emits:["change","update:modelValue"],setup(){const defaultMinDate=date.FDate.now().addYears(-10);const defaultMaxDate=date.FDate.now().addYears(10);return{textFieldValue:vue.ref(""),textFieldTouched:vue.ref(false),textFieldValidityRevealed:vue.ref(false),textFieldTableMode:vue.inject("textFieldTableMode",false),componentTouched:vue.ref(false),calendarMonth:vue.shallowRef(getDisplayMonth(defaultMinDate,defaultMaxDate)),calendarValue:vue.shallowRef(void 0),isCalendarOpen:vue.ref(false),validationConfig:vue.ref({}),minDate:vue.shallowRef(defaultMinDate),maxDate:vue.shallowRef(defaultMaxDate),calendarInputs:vue.ref(null)};},computed:{calendarButtonText(){const{calendarValue}=this;if(calendarValue&&calendarValue.isValid()){const prettyDate=calendarValue.toString(date.DateFormat.FULL);const text=this.$t("fkui.datepicker-field.change","Ändra datum");return`${text} ${prettyDate}`;}else{return this.$t("fkui.datepicker-field.choose","Välj datum");}},popupClass(){return this.textFieldTableMode?"datepicker-field__popup datepicker-field__table":"datepicker-field__popup";}},watch:{modelValue:{async handler(value){if(value!==this.textFieldValue){await this.updateTextFieldValue(value);this.updateCalendarValue(value);}},immediate:true}},mounted(){logic.ValidationService.addValidatorsToElement(getInputElement(this),{date:{},dateFormat:{},minDate:{limit:this.minDate.toString()},maxDate:{limit:this.maxDate.toString()}},true);},methods:{dateFormatter:logic.parseDate,async onValidityTextField({detail}){if(this.textFieldValidityRevealed&&detail.validityMode==="INITIAL"){this.textFieldTouched=false;this.componentTouched=false;}if(!this.textFieldTouched&&["blur","change"].includes(detail.nativeEvent)){this.textFieldTouched=true;}if(this.isCalendarOpen){logic.alertScreenReader(detail.validationMessage,{assertive:true});}this.textFieldValidityRevealed=detail.validityMode!=="INITIAL";if(detail.validityMode==="INITIAL"||!this.textFieldTouched||this.componentTouched){return;}const inputElement=getInputElement(this);const pendingValidityEvent=new CustomEvent("pending-validity",{bubbles:false});inputElement.dispatchEvent(pendingValidityEvent);},onChangeTextField(){this.updateCalendarValue(this.textFieldValue);this.$emit("update:modelValue",this.textFieldValue);this.$emit("change",this.textFieldValue);},onClickCalendarButton(){if(!this.isCalendarOpen){this.calendarMonth=getDisplayMonth(this.minDate,this.maxDate,this.calendarValue,this.initialMonth);}this.isCalendarOpen=!this.isCalendarOpen;},onFocusoutTextFieldButton(e){if(this.componentTouched||this.$refs.component===null){return;}const component=getHTMLElementFromVueRef(this.$refs.component);const relatedTarget=e.relatedTarget;if(!component.contains(relatedTarget)){this.componentTouched=true;const inputElement=getInputElement(this);logic.ValidationService.setTouched(inputElement);logic.ValidationService.validateElement(inputElement);}},async onSelectCalendarDay(date2){this.componentTouched=true;this.isCalendarOpen=!this.isDateEnabled(date2);if(!this.isCalendarOpen){getHTMLElementFromVueRef(this.$refs.calendarButton).focus();}this.$emit("update:modelValue",date2.toString());this.$emit("change",date2.toString());await this.updateTextFieldValue(date2.toString());this.updateCalendarValue(date2.toString());},async onKeyupEsc(){this.isCalendarOpen=false;logic.waitForScreenReader(()=>{getHTMLElementFromVueRef(this.$refs.calendarButton).focus();});},async onClickCloseCalendarButton(){this.isCalendarOpen=false;logic.waitForScreenReader(()=>{getHTMLElementFromVueRef(this.$refs.calendarButton).focus();});},onOpenPopup(){if(!this.isCalendarOpen){return;}const popup=getHTMLElementFromVueRef(this.$refs.popup);const navMonth=popup.querySelector(".calendar-navbar__month");if(navMonth){navMonth.focus({preventScroll:true});}},onClosePopup(){this.isCalendarOpen=false;},async onValidationConfigUpdate(event){this.validationConfig=event.detail.config;if(this.validationConfig.minDate){const minDateConfig=this.validationConfig.minDate;if(!minDateConfig.limit){throw new Error("MinDate validator must be set");}this.minDate=date.FDate.fromIso(minDateConfig.limit.toString());}if(this.validationConfig.maxDate){const maxDateConfig=this.validationConfig.maxDate;if(!maxDateConfig.limit){throw new Error("MaxDate validator must be set");}this.maxDate=date.FDate.fromIso(maxDateConfig.limit.toString());}const element=findHTMLElementFromVueRef(this.$refs.calendarInputs);if(element){await this.$nextTick();logic.ValidationService.validateAllElements(element);}},isDateEnabled(day){return isDayEnabled(day,this.validationConfig);},isDaySelected(date2){return this.calendarValue?date2.equals(this.calendarValue):false;},highlightDay(date$1){return this.highlightToday&&date$1.equals(date.FDate.now());},async updateTextFieldValue(newValue){this.textFieldValue=newValue;await this.$nextTick();logic.ValidationService.validateElement(getInputElement(this));},updateCalendarValue}});const _hoisted_1$u={ref:"component",class:"datepicker-field"};const _hoisted_2$o=["disabled","aria-expanded"];const _hoisted_3$l={class:"sr-only"};const _hoisted_4$g={class:"datepicker-field__close"};function _sfc_render$x(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=vue.resolveComponent("f-icon");const _component_f_text_field=vue.resolveComponent("f-text-field");const _component_f_calendar_day=vue.resolveComponent("f-calendar-day");const _component_f_calendar=vue.resolveComponent("f-calendar");const _component_i_popup=vue.resolveComponent("i-popup");return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$u,[vue.createElementVNode("div",{ref:"calendarInputs",onFocusout:_cache[2]||(_cache[2]=(...args)=>_ctx.onFocusoutTextFieldButton&&_ctx.onFocusoutTextFieldButton(...args))},[vue.createVNode(_component_f_text_field,vue.mergeProps(_ctx.$attrs,{modelValue:_ctx.textFieldValue,"onUpdate:modelValue":_cache[1]||(_cache[1]=$event=>_ctx.textFieldValue=$event),maxlength:"20",disabled:_ctx.disabled,formatter:_ctx.dateFormatter,"label-width":_ctx.labelWidth,"input-width":_ctx.inputWidth,onComponentValidity:_ctx.onValidityTextField,onChange:_ctx.onChangeTextField,onValidationConfigUpdate:_ctx.onValidationConfigUpdate}),vue.createSlots({description:vue.withCtx(({descriptionClass,discreteDescriptionClass})=>[vue.renderSlot(_ctx.$slots,"description",vue.normalizeProps(vue.guardReactiveProps({descriptionClass,discreteDescriptionClass})))]),"error-message":vue.withCtx(({hasError,validationMessage})=>[vue.renderSlot(_ctx.$slots,"error-message",vue.normalizeProps(vue.guardReactiveProps({hasError,validationMessage})))]),"input-right":vue.withCtx(()=>[vue.createElementVNode("button",{ref:"calendarButton",disabled:_ctx.disabled,class:"datepicker-field__button",type:"button","aria-expanded":_ctx.isCalendarOpen?"true":"false","data-test":"calendar-button",onClick:_cache[0]||(_cache[0]=$event=>_ctx.onClickCalendarButton())},[vue.createVNode(_component_f_icon,{name:"calendar"}),vue.createTextVNode(),vue.createElementVNode("span",_hoisted_3$l,vue.toDisplayString(_ctx.calendarButtonText),1/* TEXT */)],8,_hoisted_2$o)]),default:vue.withCtx(()=>[vue.renderSlot(_ctx.$slots,"default",{},()=>[vue.createTextVNode(vue.toDisplayString(_ctx.$t("fkui.datepicker-field.label","Datum")),1/* TEXT */)]),vue.createTextVNode(),vue.createTextVNode(),vue.createTextVNode(),vue.createTextVNode()]),_:2/* DYNAMIC */},[_ctx.$slots.tooltip?{name:"tooltip",fn:vue.withCtx(()=>[vue.renderSlot(_ctx.$slots,"tooltip")]),key:"0"}:void 0]),1040,["modelValue","disabled","formatter","label-width","input-width","onComponentValidity","onChange","onValidationConfigUpdate"])],544/* NEED_HYDRATION, NEED_PATCH */),vue.createTextVNode(),vue.createVNode(_component_i_popup,{"is-open":_ctx.isCalendarOpen,anchor:_ctx.calendarInputs,inline:_ctx.alwaysInline?"always":void 0,"set-focus":false,onOpen:_ctx.onOpenPopup,onClose:_ctx.onClosePopup},{default:vue.withCtx(()=>[vue.createElementVNode("div",{ref:"popup",class:vue.normalizeClass(_ctx.popupClass)},[vue.createVNode(_component_f_calendar,{modelValue:_ctx.calendarMonth,"onUpdate:modelValue":_cache[3]||(_cache[3]=$event=>_ctx.calendarMonth=$event),"tab-date":_ctx.calendarValue,"min-date":_ctx.minDate,"max-date":_ctx.maxDate,onClick:_ctx.onSelectCalendarDay,onKeyup:vue.withKeys(vue.withModifiers(_ctx.onKeyupEsc,["stop"]),["esc","native"])},{default:vue.withCtx(({date:date2,isFocused})=>[vue.createVNode(_component_f_calendar_day,{day:date2,enabled:_ctx.isDateEnabled(date2),focused:isFocused,highlight:_ctx.highlightDay(date2),selected:_ctx.isDaySelected(date2)},null,8,["day","enabled","focused","highlight","selected"])]),_:1/* STABLE */},8,["modelValue","tab-date","min-date","max-date","onClick","onKeyup"]),vue.createTextVNode(),vue.createElementVNode("div",_hoisted_4$g,[vue.createElementVNode("button",{class:"button button--discrete button--discrete--black datepicker-field__close__button",type:"button",onClick:_cache[4]||(_cache[4]=(...args)=>_ctx.onClickCloseCalendarButton&&_ctx.onClickCloseCalendarButton(...args)),onKeyup:_cache[5]||(_cache[5]=vue.withKeys(vue.withModifiers((...args)=>_ctx.onKeyupEsc&&_ctx.onKeyupEsc(...args),["stop"]),["esc"]))},[vue.createElementVNode("span",null,vue.toDisplayString(_ctx.$t("fkui.datepicker-field.close","Stäng")),1/* TEXT */),vue.createTextVNode(),vue.createVNode(_component_f_icon,{"aria-hidden":"true",class:"button__icon",name:"close"})],32/* NEED_HYDRATION */)])],2/* CLASS */)]),_:1/* STABLE */},8,["is-open","anchor","inline","onOpen","onClose"])],512/* NEED_PATCH */);}const FDatepickerField=/* @__PURE__ */_export_sfc(_sfc_main$x,[["render",_sfc_render$x]]);const _sfc_main$w=vue.defineComponent({name:"FExpand",data(){return{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"}};},methods:{enter(element){const htmlElement=getHTMLElementFromVueRef(element);Object.assign(htmlElement.style,this.initialStyle);Object.assign(htmlElement.style,this.hiddenStyle);htmlElement.style.width=getComputedStyle(element).width;const height=getComputedStyle(element).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);});}}});function _sfc_render$w(_ctx,_cache,$props,$setup,$data,$options){return vue.openBlock(),vue.createBlock(vue.Transition,{onEnter:_ctx.enter,onAfterEnter:_ctx.afterEnter,onLeave:_ctx.leave},{default:vue.withCtx(()=>[vue.renderSlot(_ctx.$slots,"default",{height:_ctx.height})]),_:3/* FORWARDED */},8,["onEnter","onAfterEnter","onLeave"]);}const FExpand=/* @__PURE__ */_export_sfc(_sfc_main$w,[["render",_sfc_render$w]]);const _sfc_main$v=vue.defineComponent({name:"FExpandablePanel",components:{FIcon,FExpand},mixins:[TranslationMixin],inheritAttrs:false,props:{/**
|
|
504
|
+
*/disabled:{type:Boolean,required:false,default:false}},emits:["change","update:modelValue"],setup(){const defaultMinDate=date.FDate.now().addYears(-10);const defaultMaxDate=date.FDate.now().addYears(10);return{textFieldValue:vue.ref(""),textFieldTouched:vue.ref(false),textFieldValidityRevealed:vue.ref(false),textFieldTableMode:vue.inject("textFieldTableMode",false),componentTouched:vue.ref(false),calendarMonth:vue.shallowRef(getDisplayMonth(defaultMinDate,defaultMaxDate)),calendarValue:vue.shallowRef(void 0),isCalendarOpen:vue.ref(false),validationConfig:vue.ref({}),minDate:vue.shallowRef(defaultMinDate),maxDate:vue.shallowRef(defaultMaxDate),calendarInputs:vue.ref(null)};},computed:{calendarButtonText(){const{calendarValue}=this;if(calendarValue&&calendarValue.isValid()){const prettyDate=calendarValue.toString(date.DateFormat.FULL);const text=this.$t("fkui.datepicker-field.change","Ändra datum");return`${text} ${prettyDate}`;}else{return this.$t("fkui.datepicker-field.choose","Välj datum");}},popupClass(){return this.textFieldTableMode?"datepicker-field__popup datepicker-field__table":"datepicker-field__popup";}},watch:{modelValue:{async handler(value){if(value!==this.textFieldValue){await this.updateTextFieldValue(value);updateCalendarValue(this,value);}},immediate:true}},mounted(){logic.ValidationService.addValidatorsToElement(getInputElement(this),{date:{},dateFormat:{},minDate:{limit:this.minDate.toString()},maxDate:{limit:this.maxDate.toString()}},true);},methods:{dateFormatter:logic.parseDate,async onValidityTextField({detail}){if(this.textFieldValidityRevealed&&detail.validityMode==="INITIAL"){this.textFieldTouched=false;this.componentTouched=false;}if(!this.textFieldTouched&&["blur","change"].includes(detail.nativeEvent)){this.textFieldTouched=true;}if(this.isCalendarOpen){logic.alertScreenReader(detail.validationMessage,{assertive:true});}this.textFieldValidityRevealed=detail.validityMode!=="INITIAL";if(detail.validityMode==="INITIAL"||!this.textFieldTouched||this.componentTouched){return;}const inputElement=getInputElement(this);const pendingValidityEvent=new CustomEvent("pending-validity",{bubbles:false});inputElement.dispatchEvent(pendingValidityEvent);},onChangeTextField(){updateCalendarValue(this,this.textFieldValue);this.$emit("update:modelValue",this.textFieldValue);this.$emit("change",this.textFieldValue);},onClickCalendarButton(){if(!this.isCalendarOpen){this.calendarMonth=getDisplayMonth(this.minDate,this.maxDate,this.calendarValue,this.initialMonth);}this.isCalendarOpen=!this.isCalendarOpen;},onFocusoutTextFieldButton(e){if(this.componentTouched||this.$refs.component===null){return;}const component=getHTMLElementFromVueRef(this.$refs.component);const relatedTarget=e.relatedTarget;if(!component.contains(relatedTarget)){this.componentTouched=true;const inputElement=getInputElement(this);logic.ValidationService.setTouched(inputElement);logic.ValidationService.validateElement(inputElement);}},async onSelectCalendarDay(date2){this.componentTouched=true;this.isCalendarOpen=!this.isDateEnabled(date2);if(!this.isCalendarOpen){getHTMLElementFromVueRef(this.$refs.calendarButton).focus();}this.$emit("update:modelValue",date2.toString());this.$emit("change",date2.toString());await this.updateTextFieldValue(date2.toString());updateCalendarValue(this,date2.toString());},async onKeyupEsc(){this.isCalendarOpen=false;logic.waitForScreenReader(()=>{getHTMLElementFromVueRef(this.$refs.calendarButton).focus();});},async onClickCloseCalendarButton(){this.isCalendarOpen=false;logic.waitForScreenReader(()=>{getHTMLElementFromVueRef(this.$refs.calendarButton).focus();});},onOpenPopup(){if(!this.isCalendarOpen){return;}const popup=getHTMLElementFromVueRef(this.$refs.popup);const navMonth=popup.querySelector(".calendar-navbar__month");if(navMonth){navMonth.focus({preventScroll:true});}},onClosePopup(){this.isCalendarOpen=false;},async onValidationConfigUpdate(event){this.validationConfig=event.detail.config;if(this.validationConfig.minDate){const minDateConfig=this.validationConfig.minDate;if(!minDateConfig.limit){throw new Error("MinDate validator must be set");}this.minDate=date.FDate.fromIso(minDateConfig.limit.toString());}if(this.validationConfig.maxDate){const maxDateConfig=this.validationConfig.maxDate;if(!maxDateConfig.limit){throw new Error("MaxDate validator must be set");}this.maxDate=date.FDate.fromIso(maxDateConfig.limit.toString());}const element=findHTMLElementFromVueRef(this.$refs.calendarInputs);if(element){await this.$nextTick();logic.ValidationService.validateAllElements(element);}},isDateEnabled(day){return isDayEnabled(day,this.validationConfig);},isDaySelected(date2){return this.calendarValue?date2.equals(this.calendarValue):false;},highlightDay(date$1){return this.highlightToday&&date$1.equals(date.FDate.now());},async updateTextFieldValue(newValue){this.textFieldValue=newValue;await this.$nextTick();logic.ValidationService.validateElement(getInputElement(this));}}});const _hoisted_1$u={ref:"component",class:"datepicker-field"};const _hoisted_2$o=["disabled","aria-expanded"];const _hoisted_3$l={class:"sr-only"};const _hoisted_4$g={class:"datepicker-field__close"};function _sfc_render$x(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=vue.resolveComponent("f-icon");const _component_f_text_field=vue.resolveComponent("f-text-field");const _component_f_calendar_day=vue.resolveComponent("f-calendar-day");const _component_f_calendar=vue.resolveComponent("f-calendar");const _component_i_popup=vue.resolveComponent("i-popup");return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$u,[vue.createElementVNode("div",{ref:"calendarInputs",onFocusout:_cache[2]||(_cache[2]=(...args)=>_ctx.onFocusoutTextFieldButton&&_ctx.onFocusoutTextFieldButton(...args))},[vue.createVNode(_component_f_text_field,vue.mergeProps(_ctx.$attrs,{modelValue:_ctx.textFieldValue,"onUpdate:modelValue":_cache[1]||(_cache[1]=$event=>_ctx.textFieldValue=$event),maxlength:"20",disabled:_ctx.disabled,formatter:_ctx.dateFormatter,"label-width":_ctx.labelWidth,"input-width":_ctx.inputWidth,onComponentValidity:_ctx.onValidityTextField,onChange:_ctx.onChangeTextField,onValidationConfigUpdate:_ctx.onValidationConfigUpdate}),vue.createSlots({description:vue.withCtx(({descriptionClass,discreteDescriptionClass})=>[vue.renderSlot(_ctx.$slots,"description",vue.normalizeProps(vue.guardReactiveProps({descriptionClass,discreteDescriptionClass})))]),"error-message":vue.withCtx(({hasError,validationMessage})=>[vue.renderSlot(_ctx.$slots,"error-message",vue.normalizeProps(vue.guardReactiveProps({hasError,validationMessage})))]),"input-right":vue.withCtx(()=>[vue.createElementVNode("button",{ref:"calendarButton",disabled:_ctx.disabled,class:"datepicker-field__button",type:"button","aria-expanded":_ctx.isCalendarOpen?"true":"false","data-test":"calendar-button",onClick:_cache[0]||(_cache[0]=$event=>_ctx.onClickCalendarButton())},[vue.createVNode(_component_f_icon,{name:"calendar"}),vue.createTextVNode(),vue.createElementVNode("span",_hoisted_3$l,vue.toDisplayString(_ctx.calendarButtonText),1/* TEXT */)],8,_hoisted_2$o)]),default:vue.withCtx(()=>[vue.renderSlot(_ctx.$slots,"default",{},()=>[vue.createTextVNode(vue.toDisplayString(_ctx.$t("fkui.datepicker-field.label","Datum")),1/* TEXT */)]),vue.createTextVNode(),vue.createTextVNode(),vue.createTextVNode(),vue.createTextVNode()]),_:2/* DYNAMIC */},[_ctx.$slots.tooltip?{name:"tooltip",fn:vue.withCtx(()=>[vue.renderSlot(_ctx.$slots,"tooltip")]),key:"0"}:void 0]),1040,["modelValue","disabled","formatter","label-width","input-width","onComponentValidity","onChange","onValidationConfigUpdate"])],544/* NEED_HYDRATION, NEED_PATCH */),vue.createTextVNode(),vue.createVNode(_component_i_popup,{"is-open":_ctx.isCalendarOpen,anchor:_ctx.calendarInputs,inline:_ctx.alwaysInline?"always":void 0,"set-focus":false,onOpen:_ctx.onOpenPopup,onClose:_ctx.onClosePopup},{default:vue.withCtx(()=>[vue.createElementVNode("div",{ref:"popup",class:vue.normalizeClass(_ctx.popupClass)},[vue.createVNode(_component_f_calendar,{modelValue:_ctx.calendarMonth,"onUpdate:modelValue":_cache[3]||(_cache[3]=$event=>_ctx.calendarMonth=$event),"tab-date":_ctx.calendarValue,"min-date":_ctx.minDate,"max-date":_ctx.maxDate,onClick:_ctx.onSelectCalendarDay,onKeyup:vue.withKeys(vue.withModifiers(_ctx.onKeyupEsc,["stop"]),["esc","native"])},{default:vue.withCtx(({date:date2,isFocused})=>[vue.createVNode(_component_f_calendar_day,{day:date2,enabled:_ctx.isDateEnabled(date2),focused:isFocused,highlight:_ctx.highlightDay(date2),selected:_ctx.isDaySelected(date2)},null,8,["day","enabled","focused","highlight","selected"])]),_:1/* STABLE */},8,["modelValue","tab-date","min-date","max-date","onClick","onKeyup"]),vue.createTextVNode(),vue.createElementVNode("div",_hoisted_4$g,[vue.createElementVNode("button",{class:"button button--discrete button--discrete--black datepicker-field__close__button",type:"button",onClick:_cache[4]||(_cache[4]=(...args)=>_ctx.onClickCloseCalendarButton&&_ctx.onClickCloseCalendarButton(...args)),onKeyup:_cache[5]||(_cache[5]=vue.withKeys(vue.withModifiers((...args)=>_ctx.onKeyupEsc&&_ctx.onKeyupEsc(...args),["stop"]),["esc"]))},[vue.createElementVNode("span",null,vue.toDisplayString(_ctx.$t("fkui.datepicker-field.close","Stäng")),1/* TEXT */),vue.createTextVNode(),vue.createVNode(_component_f_icon,{"aria-hidden":"true",class:"button__icon",name:"close"})],32/* NEED_HYDRATION */)])],2/* CLASS */)]),_:1/* STABLE */},8,["is-open","anchor","inline","onOpen","onClose"])],512/* NEED_PATCH */);}const FDatepickerField=/* @__PURE__ */_export_sfc(_sfc_main$x,[["render",_sfc_render$x]]);const _sfc_main$w=vue.defineComponent({name:"FExpand",data(){return{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"}};},methods:{enter(element){const htmlElement=getHTMLElementFromVueRef(element);Object.assign(htmlElement.style,this.initialStyle);Object.assign(htmlElement.style,this.hiddenStyle);htmlElement.style.width=getComputedStyle(element).width;const height=getComputedStyle(element).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);});}}});function _sfc_render$w(_ctx,_cache,$props,$setup,$data,$options){return vue.openBlock(),vue.createBlock(vue.Transition,{onEnter:_ctx.enter,onAfterEnter:_ctx.afterEnter,onLeave:_ctx.leave},{default:vue.withCtx(()=>[vue.renderSlot(_ctx.$slots,"default",{height:_ctx.height})]),_:3/* FORWARDED */},8,["onEnter","onAfterEnter","onLeave"]);}const FExpand=/* @__PURE__ */_export_sfc(_sfc_main$w,[["render",_sfc_render$w]]);const _sfc_main$v=vue.defineComponent({name:"FExpandablePanel",components:{FIcon,FExpand},mixins:[TranslationMixin],inheritAttrs:false,props:{/**
|
|
504
505
|
* Toggle expanded/collapsed state
|
|
505
506
|
*/expanded:{type:Boolean,required:false,default:false},/**
|
|
506
507
|
* Element to render for the header element inside the expandable panel.
|
|
@@ -632,24 +633,48 @@ onItemFocus(event){if(event&&event.target){event.target.style.position="relative
|
|
|
632
633
|
*/delay:{type:Boolean,required:false,default:false},/**
|
|
633
634
|
* Language used for determining fallback value for the loading text. Useful if loader is displayed before
|
|
634
635
|
* text keys have been downloaded
|
|
635
|
-
*/language:{type:String,required:false,default:"sv"}},data(){return{oldFocus:void 0};},computed:{defaultLoadingText(){return this.language==="en"?"Please wait":"Vänligen vänta";},classes(){return{"loader--overlay":this.overlay,"loader--delay":this.delay};},teleportTarget(){return config.teleportTarget;},teleportDisabled(){return!this.overlay;}},watch:{show(show){if(show){this.openLoader();}else{this.closeLoader();}}},mounted(){if(this.show){this.openLoader();}},methods:{async listener(){await this.$nextTick();focus(this.$refs["loader-text"]);},async openLoader(){if(this.overlay){logic.saveFocus(document);this.listener();logic.addFocusListener(logic.findTabbableElements(document),this.listener);}},closeLoader(){if(this.overlay){logic.removeFocusListener(logic.findTabbableElements(document),this.listener);logic.restoreFocus();}}}});const _hoisted_1$g={class:"loader__backdrop"};const _hoisted_2$c=/* @__PURE__ */vue.createElementVNode("div",{class:"loader__wrapper"},[/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-1 loader__spinner"},[/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-1-circle1 loader__circle loader__circle--1"}),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-1-circle2 loader__circle loader__circle--2"}),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-1-circle3 loader__circle loader__circle--3"}),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-1-circle4 loader__circle loader__circle--4"})]),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-2 loader__spinner"},[/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-2-circle1 loader__circle loader__circle--1"}),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-2-circle2 loader__circle loader__circle--2"}),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-2-circle3 loader__circle loader__circle--3"}),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-2-circle4 loader__circle loader__circle--4"})]),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-3 loader__spinner"},[/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-3-circle1 loader__circle loader__circle--1"}),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-3-circle2 loader__circle loader__circle--2"}),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-3-circle3 loader__circle loader__circle--3"}),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-3-circle4 loader__circle loader__circle--4"})])],-1/* HOISTED */);const _hoisted_3$a={role:"alert"};function _sfc_render$i(_ctx,_cache,$props,$setup,$data,$options){return vue.openBlock(),vue.createBlock(vue.Teleport,{to:_ctx.teleportTarget,disabled:_ctx.teleportDisabled},[vue.withDirectives(vue.createElementVNode("div",vue.mergeProps(_ctx.$attrs,{class:["loader",_ctx.classes]}),[vue.createElementVNode("div",_hoisted_1$g,[_hoisted_2$c,vue.createTextVNode(),vue.createElementVNode("div",{ref:"loader-text",class:vue.normalizeClass(["loader__wait-text",{"loader--delay":_ctx.delay}]),tabindex:"-1"},[vue.createElementVNode("span",_hoisted_3$a,[vue.renderSlot(_ctx.$slots,"default",{},()=>[vue.createTextVNode(vue.toDisplayString(_ctx.$t("fkui.loader.wait.text",_ctx.defaultLoadingText)),1/* TEXT */)])])],2/* CLASS */)])],16/* FULL_PROPS */),[[vue.vShow,_ctx.show]])],8,["to","disabled"]);}const FLoader=/* @__PURE__ */_export_sfc(_sfc_main$i,[["render",_sfc_render$i]]);function getNewItemIndexFromMenuAction$2(action,index,n){let newIndex;if(n<=0){return 0;}switch(action){case MenuAction.MOVE_NEXT:newIndex=(index+1)%n;break;case MenuAction.MOVE_PREV:newIndex=(index-1+n)%n;break;case MenuAction.MOVE_FIRST:newIndex=0;break;case MenuAction.MOVE_LAST:newIndex=Math.max(n-1,0);break;default:newIndex=index;}return newIndex;}async function doMenuAction$2(action,target){const itemsLength=target.items.length;const currentIndex=target.currentFocusedItemIndex;const newFocusedItemIndex=getNewItemIndexFromMenuAction$2(action,currentIndex,itemsLength);switch(action){case MenuAction.MOVE_NEXT:case MenuAction.MOVE_PREV:case MenuAction.MOVE_FIRST:case MenuAction.MOVE_LAST:await target.setFocusOnItem(newFocusedItemIndex);break;case MenuAction.ACTIVATE:await target.activateItem(newFocusedItemIndex);break;}}const preventKeys$2=["Up","Down","ArrowUp","ArrowDown","Home","End"," ","Spacebar","Enter"];const _sfc_main$h=vue.defineComponent({name:"IPopupMenu",components:{FIcon,IPopup},props:{/**
|
|
636
|
+
*/language:{type:String,required:false,default:"sv"}},data(){return{oldFocus:void 0};},computed:{defaultLoadingText(){return this.language==="en"?"Please wait":"Vänligen vänta";},classes(){return{"loader--overlay":this.overlay,"loader--delay":this.delay};},teleportTarget(){return config.teleportTarget;},teleportDisabled(){return!this.overlay;}},watch:{show(show){if(show){this.openLoader();}else{this.closeLoader();}}},mounted(){if(this.show){this.openLoader();}},methods:{async listener(){await this.$nextTick();focus(this.$refs["loader-text"]);},async openLoader(){if(this.overlay){logic.saveFocus(document);this.listener();logic.addFocusListener(logic.findTabbableElements(document),this.listener);}},closeLoader(){if(this.overlay){logic.removeFocusListener(logic.findTabbableElements(document),this.listener);logic.restoreFocus();}}}});const _hoisted_1$g={class:"loader__backdrop"};const _hoisted_2$c=/* @__PURE__ */vue.createElementVNode("div",{class:"loader__wrapper"},[/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-1 loader__spinner"},[/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-1-circle1 loader__circle loader__circle--1"}),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-1-circle2 loader__circle loader__circle--2"}),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-1-circle3 loader__circle loader__circle--3"}),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-1-circle4 loader__circle loader__circle--4"})]),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-2 loader__spinner"},[/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-2-circle1 loader__circle loader__circle--1"}),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-2-circle2 loader__circle loader__circle--2"}),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-2-circle3 loader__circle loader__circle--3"}),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-2-circle4 loader__circle loader__circle--4"})]),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-3 loader__spinner"},[/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-3-circle1 loader__circle loader__circle--1"}),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-3-circle2 loader__circle loader__circle--2"}),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-3-circle3 loader__circle loader__circle--3"}),/* @__PURE__ */vue.createTextVNode(),/* @__PURE__ */vue.createElementVNode("div",{class:"loader__spinner-3-circle4 loader__circle loader__circle--4"})])],-1/* HOISTED */);const _hoisted_3$a={role:"alert"};function _sfc_render$i(_ctx,_cache,$props,$setup,$data,$options){return vue.openBlock(),vue.createBlock(vue.Teleport,{to:_ctx.teleportTarget,disabled:_ctx.teleportDisabled},[vue.withDirectives(vue.createElementVNode("div",vue.mergeProps(_ctx.$attrs,{class:["loader",_ctx.classes]}),[vue.createElementVNode("div",_hoisted_1$g,[_hoisted_2$c,vue.createTextVNode(),vue.createElementVNode("div",{ref:"loader-text",class:vue.normalizeClass(["loader__wait-text",{"loader--delay":_ctx.delay}]),tabindex:"-1"},[vue.createElementVNode("span",_hoisted_3$a,[vue.renderSlot(_ctx.$slots,"default",{},()=>[vue.createTextVNode(vue.toDisplayString(_ctx.$t("fkui.loader.wait.text",_ctx.defaultLoadingText)),1/* TEXT */)])])],2/* CLASS */)])],16/* FULL_PROPS */),[[vue.vShow,_ctx.show]])],8,["to","disabled"]);}const FLoader=/* @__PURE__ */_export_sfc(_sfc_main$i,[["render",_sfc_render$i]]);function getNewItemIndexFromMenuAction$2(action,index,n){let newIndex;if(n<=0){return 0;}switch(action){case MenuAction.MOVE_NEXT:newIndex=(index+1)%n;break;case MenuAction.MOVE_PREV:newIndex=(index-1+n)%n;break;case MenuAction.MOVE_FIRST:newIndex=0;break;case MenuAction.MOVE_LAST:newIndex=Math.max(n-1,0);break;default:newIndex=index;}return newIndex;}async function doMenuAction$2(action,target){const itemsLength=target.items.length;const currentIndex=target.currentFocusedItemIndex;const newFocusedItemIndex=getNewItemIndexFromMenuAction$2(action,currentIndex,itemsLength);switch(action){case MenuAction.MOVE_NEXT:case MenuAction.MOVE_PREV:case MenuAction.MOVE_FIRST:case MenuAction.MOVE_LAST:await target.setFocusOnItem(newFocusedItemIndex);break;case MenuAction.ACTIVATE:await target.activateItem(newFocusedItemIndex);break;}}const preventKeys$2=["Tab","Up","Down","ArrowUp","ArrowDown","Home","End"," ","Spacebar","Enter"];const _sfc_main$h=vue.defineComponent({name:"IPopupMenu",components:{FIcon,IPopup},props:{/**
|
|
637
|
+
* Key of the currently selected and highlighted item.
|
|
638
|
+
*
|
|
639
|
+
* @model
|
|
640
|
+
*/modelValue:{type:String,required:false,default:""},/**
|
|
641
|
+
* Key of the currently focused item.
|
|
642
|
+
* Sets focus on matching item element when value changes.
|
|
643
|
+
*
|
|
644
|
+
* @model
|
|
645
|
+
*/focusedItem:{type:String,required:false,default:""},/**
|
|
636
646
|
* Toggle open/closed popup.
|
|
637
647
|
*/isOpen:{type:Boolean,required:true},/**
|
|
638
648
|
* DOM element to position popup at.
|
|
639
649
|
*/anchor:{type:HTMLElement,default:void 0},/**
|
|
640
|
-
* The currently highlighted menu item key
|
|
641
|
-
* @model
|
|
642
|
-
*/modelValue:{type:String,required:false,default:""},/**
|
|
643
650
|
* The items to be diplayed in the menu
|
|
644
651
|
*/items:{type:Array,required:true},/**
|
|
645
|
-
* The key of the currently selected focused item
|
|
646
|
-
*/focusedItemKey:{type:String,required:false,default:""},/**
|
|
647
652
|
* If true, enable built-in keyboard navigation
|
|
648
653
|
*/enableKeyboardNavigation:{type:Boolean,required:false,default:false},/**
|
|
649
654
|
* Unique accessible name for navigation landmark.
|
|
650
655
|
*/ariaLabel:{type:String,required:false,default:"Popupmeny"},/**
|
|
651
656
|
* Text for selected item for screen reader
|
|
652
|
-
*/selectedMenuItemScreenReaderText:{type:String,required:false,default:"vald nu"}},emits:[
|
|
657
|
+
*/selectedMenuItemScreenReaderText:{type:String,required:false,default:"vald nu"}},emits:[/**
|
|
658
|
+
* Emitted when an item is selected and when tabbing out of the popup.
|
|
659
|
+
*
|
|
660
|
+
* @event close
|
|
661
|
+
*/"close",/**
|
|
662
|
+
* Vue 2 V-model event. Emitted when an item is selected.
|
|
663
|
+
*
|
|
664
|
+
* @event select
|
|
665
|
+
* @deprecated
|
|
666
|
+
* @type {string} item key
|
|
667
|
+
*/"select",/**
|
|
668
|
+
* V-model event. Emitted when an item is selected.
|
|
669
|
+
*
|
|
670
|
+
* @event select
|
|
671
|
+
* @type {string} item key
|
|
672
|
+
*/"update:modelValue",/**
|
|
673
|
+
* V-model event. Emitted when item focus changes.
|
|
674
|
+
*
|
|
675
|
+
* @event select
|
|
676
|
+
* @type {string} Key of focused item, or empty if no item focused.
|
|
677
|
+
*/"update:focusedItem"],data(){return{currentFocusedItemIndex:0,lastSelectedItem:""};},watch:{isOpen:{immediate:true,async handler(newVal){if(newVal){return;}this.currentFocusedItemIndex=0;this.lastSelectedItem="";this.$emit("update:focusedItem","");}},modelValue:{async handler(newVal){if(this.enableKeyboardNavigation){return;}const index=this.indexOfItemByKey(newVal);if(index>=0){await this.activateItem(index);}else{this.setFocusedItemIndex(0);}}},focusedItem:{async handler(newVal){if(newVal.length===0){return;}const index=this.indexOfItemByKey(newVal);if(index>=0){await this.setFocusOnItem(index);}else{this.setFocusedItemIndex(0);}}}},methods:{isSelected(index){return this.items[index].key===this.modelValue;},focusElement(){return null;},findItemByKey(key){return this.items.find(it=>it.key===key);},indexOfItemByKey(key){const item=this.findItemByKey(key);if(!item){return-1;}return this.items.indexOf(item);},async onClickItem(item,doClick=false){var _a;if(item.key!==this.lastSelectedItem){this.$emit("update:modelValue",item.key);this.$emit("select",item.key);this.lastSelectedItem=item.key;}this.$emit("close");if(item.href&&doClick){const anchors=getSortedHTMLElementsFromVueRef(this.$refs.anchors);(_a=anchors[this.currentFocusedItemIndex])==null?void 0:_a.click();}},itemClasses(item){const highlight=item.key===this.modelValue?["ipopupmenu__list__item--highlight"]:[];return["ipopupmenu__list__item",...highlight];},async setFocusOnItem(index){this.setFocusedItemIndex(index);await this.$nextTick();if(!this.isOpen){return;}const anchors=getSortedHTMLElementsFromVueRef(this.$refs.anchors);if(anchors.length===0){return;}const itemAnchor=anchors[index];logic.focus(itemAnchor,{preventScroll:true});const key=this.items[index].key;this.$emit("update:focusedItem",key);},async activateItem(index){if(index!==this.currentFocusedItemIndex){await this.setFocusOnItem(index);}await this.onClickItem(this.items[index],true);},setFocusedItemIndex(index){this.currentFocusedItemIndex=index;},onKeyUp(event){if(!this.enableKeyboardNavigation){return;}if(preventKeys$2.includes(event.key)){event.preventDefault();}},async onKeyDown(event){if(!this.enableKeyboardNavigation){return;}if(!preventKeys$2.includes(event.key)){return;}const firstItemFocused=this.currentFocusedItemIndex===0;const lastItemFocused=this.currentFocusedItemIndex===this.items.length-1;const tabOutPrev=event.key==="Tab"&&event.shiftKey&&firstItemFocused;const tabOutNext=event.key==="Tab"&&!event.shiftKey&&lastItemFocused;if(tabOutPrev||tabOutNext){if(tabOutPrev){event.preventDefault();}this.$emit("close");return;}const action=actionFromKeyboardEvent(event);if(action===null){return;}event.preventDefault();await doMenuAction$2(action,this);}}});const _hoisted_1$f=["aria-label"];const _hoisted_2$b={role:"menu",class:"ipopupmenu__list"};const _hoisted_3$9=["onClick"];const _hoisted_4$7=["data-ref-index","href","target"];const _hoisted_5$7={key:0,class:"sr-only"};function _sfc_render$h(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=vue.resolveComponent("f-icon");const _component_i_popup=vue.resolveComponent("i-popup");return vue.openBlock(),vue.createBlock(_component_i_popup,{class:"ipopupmenu","is-open":_ctx.isOpen,"keyboard-trap":false,anchor:_ctx.anchor,"focus-element":_ctx.focusElement,onClose:_cache[0]||(_cache[0]=$event=>_ctx.$emit("close")),onKeyup:_ctx.onKeyUp,onKeydown:_ctx.onKeyDown},{default:vue.withCtx(()=>[vue.createElementVNode("nav",{class:"ipopupmenu ipopupmenu--vertical","aria-label":_ctx.ariaLabel},[vue.createElementVNode("ul",_hoisted_2$b,[(vue.openBlock(true),vue.createElementBlock(vue.Fragment,null,vue.renderList(_ctx.items,(item,index)=>{return vue.openBlock(),vue.createElementBlock("li",{ref_for:true,ref:"items",key:item.key,role:"presentation",class:vue.normalizeClass(_ctx.itemClasses(item)),onClick:$event=>_ctx.onClickItem(item)},[vue.createElementVNode("a",{ref_for:true,ref:"anchors","data-ref-index":index,href:item.href,role:"menuitem",target:item.target,tabindex:"0"},[_ctx.isSelected(index)?(vue.openBlock(),vue.createElementBlock("span",_hoisted_5$7,[vue.createElementVNode("span",null,vue.toDisplayString(_ctx.selectedMenuItemScreenReaderText)+" ",1/* TEXT */)])):vue.createCommentVNode("v-if",true),vue.createTextVNode(vue.toDisplayString(item.label)+" ",1/* TEXT */),item.iconRight?(vue.openBlock(),vue.createBlock(_component_f_icon,{key:1,name:item.iconRight},null,8,["name"])):vue.createCommentVNode("v-if",true)],8,_hoisted_4$7)],10,_hoisted_3$9);}),128/* KEYED_FRAGMENT */))])],8,_hoisted_1$f)]),_:1/* STABLE */},8,["is-open","anchor","focus-element","onKeyup","onKeydown"]);}const IPopupMenu=/* @__PURE__ */_export_sfc(_sfc_main$h,[["render",_sfc_render$h]]);const menuMoreKey="MENU_MORE";function findOverflowIndex(totalWidth,elements){let sum=0;return elements.findIndex(element=>{sum+=element.offsetWidth;return sum>totalWidth;});}function getNewItemIndexFromMenuAction$1(action,index,n){let newIndex;if(n<=0){return 0;}switch(action){case MenuAction.MOVE_NEXT:newIndex=(index+1)%n;break;case MenuAction.MOVE_PREV:newIndex=(index-1+n)%n;break;case MenuAction.MOVE_FIRST:newIndex=0;break;case MenuAction.MOVE_LAST:newIndex=Math.max(n-1,0);break;default:newIndex=index;}return newIndex;}async function doMenuAction$1(action,target){const itemsLength=target.items.length;const currentIndex=target.currentFocusedItemIndex;const newFocusedItemIndex=getNewItemIndexFromMenuAction$1(action,currentIndex,itemsLength);switch(action){case MenuAction.MOVE_NEXT:case MenuAction.MOVE_PREV:case MenuAction.MOVE_FIRST:case MenuAction.MOVE_LAST:await target.setFocusOnItem(newFocusedItemIndex);break;case MenuAction.ACTIVATE:await target.activateItem(newFocusedItemIndex);break;}}const preventKeys$1=["Tab","Up","Down","Left","Right","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"," ","Spacebar","Enter"];const _sfc_main$g=vue.defineComponent({name:"IMenu",components:{FIcon},props:{/**
|
|
653
678
|
* The currently highlighted menu item key
|
|
654
679
|
* @model
|
|
655
680
|
*/modelValue:{type:String,required:false,default:""},/**
|
|
@@ -693,7 +718,7 @@ onItemFocus(event){if(event&&event.target){event.target.style.position="relative
|
|
|
693
718
|
* @event update:route
|
|
694
719
|
* @param route
|
|
695
720
|
* @type {string}
|
|
696
|
-
*/"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=logic.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=vue.resolveComponent("i-menu");const _component_i_popup_menu=vue.resolveComponent("i-popup-menu");return vue.openBlock(),vue.createElementBlock("div",null,[vue.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"]),vue.createTextVNode(),vue.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=vue.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=vue.resolveComponent("f-icon");const _component_i_flex_item=vue.resolveComponent("i-flex-item");const _component_i_flex=vue.resolveComponent("i-flex");return vue.openBlock(),vue.createElementBlock("div",{ref:"offline",class:"offline__wrapper",role:_ctx.role},[!_ctx.isOnline?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$9,[vue.createVNode(_component_i_flex,{gap:"2x"},{default:vue.withCtx(()=>[vue.createVNode(_component_i_flex_item,{class:"offline__icon",shrink:"",align:"center"},{default:vue.withCtx(()=>[vue.createElementVNode("span",_hoisted_3$7,[vue.createVNode(_component_f_icon,{name:"triangle"}),vue.createTextVNode(),vue.createVNode(_component_f_icon,{name:"alert"})])]),_:1/* STABLE */}),vue.createTextVNode(),vue.createVNode(_component_i_flex_item,{class:"offline_content",grow:"",align:"center"},{default:vue.withCtx(()=>[vue.createElementVNode("p",_hoisted_4$5,[vue.renderSlot(_ctx.$slots,"default",{},()=>[vue.createTextVNode(" Det verkar som att du inte har någon internetuppkoppling just nu ")])])]),_:3/* FORWARDED */})]),_:3/* FORWARDED */})])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),vue.withDirectives(vue.createElementVNode("span",{class:"sr-only","aria-hidden":_ctx.shouldNotRead?"true":void 0},"\n Din internetuppkoppling fungerar igen\n ",8,_hoisted_5$5),[[vue.vShow,_ctx.isOnline]])],8,_hoisted_1$d);}const FOffline=/* @__PURE__ */_export_sfc(_sfc_main$e,[["render",_sfc_render$e]]);const _sfc_main$d=vue.defineComponent({name:"FOutputField",components:{FLabel},inheritAttrs:false,props:{/**
|
|
721
|
+
*/"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=logic.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=vue.resolveComponent("i-menu");const _component_i_popup_menu=vue.resolveComponent("i-popup-menu");return vue.openBlock(),vue.createElementBlock("div",null,[vue.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"]),vue.createTextVNode(),vue.createVNode(_component_i_popup_menu,{ref:"popupMenu",modelValue:_ctx.selectedPopupItemKey,"onUpdate:modelValue":_cache[1]||(_cache[1]=$event=>_ctx.selectedPopupItemKey=$event),"focused-item":_ctx.focusedPopupMenuItemKey,"onUpdate:focusedItem":_cache[2]||(_cache[2]=$event=>_ctx.focusedPopupMenuItemKey=$event),items:_ctx.popupItems,"is-open":_ctx.popupOpen,anchor:_ctx.popupAnchor,"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","focused-item","items","is-open","anchor","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=vue.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=vue.resolveComponent("f-icon");const _component_i_flex_item=vue.resolveComponent("i-flex-item");const _component_i_flex=vue.resolveComponent("i-flex");return vue.openBlock(),vue.createElementBlock("div",{ref:"offline",class:"offline__wrapper",role:_ctx.role},[!_ctx.isOnline?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$9,[vue.createVNode(_component_i_flex,{gap:"2x"},{default:vue.withCtx(()=>[vue.createVNode(_component_i_flex_item,{class:"offline__icon",shrink:"",align:"center"},{default:vue.withCtx(()=>[vue.createElementVNode("span",_hoisted_3$7,[vue.createVNode(_component_f_icon,{name:"triangle"}),vue.createTextVNode(),vue.createVNode(_component_f_icon,{name:"alert"})])]),_:1/* STABLE */}),vue.createTextVNode(),vue.createVNode(_component_i_flex_item,{class:"offline_content",grow:"",align:"center"},{default:vue.withCtx(()=>[vue.createElementVNode("p",_hoisted_4$5,[vue.renderSlot(_ctx.$slots,"default",{},()=>[vue.createTextVNode(" Det verkar som att du inte har någon internetuppkoppling just nu ")])])]),_:3/* FORWARDED */})]),_:3/* FORWARDED */})])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),vue.withDirectives(vue.createElementVNode("span",{class:"sr-only","aria-hidden":_ctx.shouldNotRead?"true":void 0},"\n Din internetuppkoppling fungerar igen\n ",8,_hoisted_5$5),[[vue.vShow,_ctx.isOnline]])],8,_hoisted_1$d);}const FOffline=/* @__PURE__ */_export_sfc(_sfc_main$e,[["render",_sfc_render$e]]);const _sfc_main$d=vue.defineComponent({name:"FOutputField",components:{FLabel},inheritAttrs:false,props:{/**
|
|
697
722
|
* Associate the output field with one or more id's of the elements
|
|
698
723
|
* contributing or affecting the result of this field. Multiple id's can
|
|
699
724
|
* be set with a space-separated string or an array of strings.
|
|
@@ -747,7 +772,7 @@ onItemFocus(event){if(event&&event.target){event.target.style.position="relative
|
|
|
747
772
|
/* it should contain a default value of undefined and proptype should
|
|
748
773
|
/* include undefined (see comment on line above) */modelValue:{type:anyType,required:false},/**
|
|
749
774
|
* The value for the input.
|
|
750
|
-
*/value:{type:anyType,required:true}},emits:["change","update:modelValue"],setup(){
|
|
775
|
+
*/value:{type:anyType,required:true}},emits:["change","update:modelValue"],setup(){const{sharedName,showDetails,getFieldsetLabelText}=useFieldset();return{sharedName,showDetails,getFieldsetLabelText};},data(){return{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(){var _this$sharedName;return{...this.$attrs,value:this.value,checked:this.value===this.modelValue,name:(_this$sharedName=this.sharedName)!==null&&_this$sharedName!==void 0?_this$sharedName:this.$attrs.name,onChange:event=>{if(event.target instanceof HTMLInputElement){this.$emit("update:modelValue",this.value);this.$emit("change",this.value);}},onInput:event=>{event.target.focus();}};},disabledClass(){return this.disabled?"disabled":"";}},methods:{async onValidity({detail}){if(detail.target!==this.$el.querySelector("input")){return;}await this.$nextTick();let errorMessage="";if(hasSlot(this,"default")){const labelText=this.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$8=["id","disabled"];const _hoisted_2$5=["for"];const _hoisted_3$4={key:0,class:"radio-button__details"};const _hoisted_4$3=/* @__PURE__ */vue.createElementVNode("br",null,null,-1/* HOISTED */);const _hoisted_5$3={key:0,class:"radio-button__details"};const _hoisted_6$3=/* @__PURE__ */vue.createElementVNode("br",null,null,-1/* HOISTED */);function _sfc_render$9(_ctx,_cache,$props,$setup,$data,$options){return vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass(["radio-button",_ctx.disabledClass]),onValidity:_cache[0]||(_cache[0]=(...args)=>_ctx.onValidity&&_ctx.onValidity(...args))},[vue.createElementVNode("input",vue.mergeProps({id:_ctx.id,type:"radio",class:"radio-button__input",disabled:_ctx.disabled},_ctx.attrs),null,16,_hoisted_1$8),vue.createTextVNode(),vue.createElementVNode("label",{class:vue.normalizeClass(_ctx.$slots.details?"radio-button__label radio-button__width":"radio-button__label"),for:_ctx.id},[vue.renderSlot(_ctx.$slots,"default"),vue.createTextVNode(),_ctx.$slots.details?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:0},[_ctx.showDetails==="always"?(vue.openBlock(),vue.createElementBlock("span",_hoisted_3$4,[_hoisted_4$3,vue.createTextVNode(),vue.renderSlot(_ctx.$slots,"details")])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),_ctx.showDetails==="when-selected"?(vue.openBlock(),vue.createBlock(vue.Transition,{key:1,onEnter:_ctx.enter,onAfterEnter:_ctx.afterEnter,onLeave:_ctx.leave},{default:vue.withCtx(()=>[_ctx.value===_ctx.modelValue?(vue.openBlock(),vue.createElementBlock("span",_hoisted_5$3,[_hoisted_6$3,vue.createTextVNode(),vue.renderSlot(_ctx.$slots,"details",{height:_ctx.height})])):vue.createCommentVNode("v-if",true)]),_:3/* FORWARDED */},8,["onEnter","onAfterEnter","onLeave"])):vue.createCommentVNode("v-if",true)],64/* STABLE_FRAGMENT */)):vue.createCommentVNode("v-if",true)],10,_hoisted_2$5)],34/* CLASS, NEED_HYDRATION */);}const FRadioField=/* @__PURE__ */_export_sfc(_sfc_main$9,[["render",_sfc_render$9]]);const _sfc_main$8=vue.defineComponent({name:"FRadioGroup",components:{FFieldset},inheritAttrs:false,props:{/**
|
|
751
776
|
* The id for the fieldset id attribute.
|
|
752
777
|
* If the prop is not set the id will be generated.
|
|
753
778
|
*/id:{type:String,required:false,default:()=>logic.ElementIdService.generateElementId()},/**
|
|
@@ -797,7 +822,7 @@ onItemFocus(event){if(event&&event.target){event.target.style.position="relative
|
|
|
797
822
|
* @event collapse
|
|
798
823
|
* @param row
|
|
799
824
|
* @type {ListItem}
|
|
800
|
-
*/"collapse"],setup(props,context){const sortFilterDatasetInjected=FSortFilterDatasetInjected();const activateItemInjected=ActivateItemInjected();const expandableTable=useExpandableTable(props.expandableAttribute,props.keyAttribute,props.expandableDescribedby,context.emit,context.slots);return{...sortFilterDatasetInjected,...activateItemInjected,...expandableTable};},data(){return{activeRow:void 0,columns:[],emptyRow:emptyTableRow(),selectedRows:[],tr:[]};},computed:{hasCaption(){return hasSlot(this,"caption");},hasCheckboxDescription(){return hasSlot(this,"checkbox-description",{row:this.emptyRow});},hasInitiateColumns(){return this.columns.length>0;},isEmpty(){return this.rows.length===0;},visibleColumns(){return this.columns.filter(col=>col.visible);},tableClasses(){const classes=[];if(this.selectable){classes.push("table--selectable");}if(this.hover){classes.push("table--hover");}return classes;},tableRole(){return this.isExpandableTable?"treegrid":"grid";},wrapperClasses(){return tableScrollClasses(this.scroll);},nbOfColumns(){let columnCount=this.columns.length;if(this.selectable){columnCount++;}if(this.isExpandableTable){columnCount++;}return columnCount;}},watch:{rows:{immediate:true,deep:true,handler:function(){if(this.modelValue){this.selectedRows=this.modelValue.filter(row=>{return includeItem(row,this.rows,this.keyAttribute);});}}}},updated(){const tbodyElement=this.$refs["tbodyElement"];const trElements=[].slice.call(tbodyElement.children);const trInteractableElements=trElements.filter(tr=>{return tr.tabIndex===0;});this.tr=trInteractableElements;},mounted(){this.registerCallbackOnSort(this.callbackOnSort);this.registerCallbackOnMount(this.callbackSortableColumns);this.registerCallbackAfterItemAdd(this.callbackAfterItemAdd);this.registerCallbackBeforeItemDelete(this.callbackBeforeItemDelete);},methods:{isActive(row){return itemEquals(row,this.activeRow,this.keyAttribute);},isSelected(row){return includeItem(row,this.selectedRows,this.keyAttribute);},onKeydownExpandable(event,index){if(event.key===" "||event.key==="Spacebar"){event.preventDefault();return;}onKeydown.call(this,event,index);},onKeydown(event,index){onKeydown.call(this,event,index);},onClick(event,row){const{target}=event;const isRelevant=["TD","TH"].includes(target.nodeName);if(isRelevant){const parent=target.parentElement;this.activate(row,parent);}},activate(row,tr){this.$emit("click",row);if(this.isExpandableTable&&this.hasExpandableContent(row)){this.toggleExpanded(row);}if(!itemEquals(row,this.activeRow,this.keyAttribute)){this.$emit("change",row);this.activeRow=row;if(tr){tr.focus();const td=tr.children[0];forceRepaintIE11(td);}}},rowDescription(row){const slot=this.$slots["row-description"];return renderSlotText(slot,{row});},onSelect(row){if(includeItem(row,this.selectedRows,this.keyAttribute)){this.selectedRows=this.selectedRows.filter(i=>!itemEquals(i,row,this.keyAttribute));this.$emit("unselect",row);}else{this.selectedRows.push(row);this.$emit("select",row);}this.updateVModelWithSelectedRows();this.$forceUpdate();},updateVModelWithSelectedRows(){if(this.modelValue){this.$emit("update:modelValue",this.selectedRows);this.$emit("update",this.selectedRows);}},rowClasses(row,index){const active=this.isActive(row)?["table__row--active"]:[];const selected=this.isSelected(row)?["table__row--selected"]:[];const isExpandableRow=this.isExpandableTable&&this.hasExpandableContent(row);const expandable=isExpandableRow?["table__row--expandable"]:[];const expanded=this.isExpanded(row)?["table__row--expanded-border"]:[];const striped=this.striped&&index%2!==0?["table__row--striped"]:[];return["table__row",...active,...selected,...striped,...expandable,...expanded];},rowKey(row){const key=row[this.keyAttribute];if(typeof key==="undefined"){throw new Error(`Key attribute [${this.keyAttribute}]' is missing in row`);}return String(key);},columnClasses(column){const sortable=column.sortable?["table__column--sortable"]:[];return["table__column",`table__column--${column.type}`,...sortable,column.size];},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);},callbackAfterItemAdd(item){this.activate(item,null);},callbackBeforeItemDelete(item){if(this.rows.length===0){return;}let targetIndex=this.rows.indexOf(item)-1;if(targetIndex<0&&this.rows.length>1){targetIndex=1;}else if(targetIndex<0){targetIndex=0;}this.activate(this.rows[targetIndex],this.tr[targetIndex]);},escapeNewlines(value){return value.replace(/\n/g,"<br/>");}}});const _hoisted_1$6=["role"];const _hoisted_2$3={key:0};const _hoisted_3$3={key:0,class:"table__column--shrink"};const _hoisted_4$2={key:1,class:"table__column--shrink"};const _hoisted_5$2={class:"table__row"};const _hoisted_6$2={key:0,scope:"col"};const _hoisted_7$2={class:"sr-only"};const _hoisted_8$2={key:1,scope:"col"};const _hoisted_9$2={class:"sr-only"};const _hoisted_10$2=["innerHTML"];const _hoisted_11$1={key:1,class:"table__column__description"};const _hoisted_12$1={ref:"tbodyElement"};const _hoisted_13$1=["aria-label","aria-expanded","aria-level","aria-describedby","onKeydown","onClick"];const _hoisted_14$1={key:0};const _hoisted_15$1={key:0,class:"table__expand-icon"};const _hoisted_16={key:1,class:"table__column--selectable"};const _hoisted_17={class:"table__input"};const _hoisted_18={key:0,class:"sr-only"};const _hoisted_19=/* @__PURE__ */vue.createElementVNode("td",null,null,-1/* HOISTED */);const _hoisted_20={key:0,class:"table__column--selectable"};const _hoisted_21=["colspan"];const _hoisted_22={key:0};const _hoisted_23={hidden:""};const _hoisted_24=["colspan"];function _sfc_render$6(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=vue.resolveComponent("f-icon");const _component_f_checkbox_field=vue.resolveComponent("f-checkbox-field");return vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass(_ctx.wrapperClasses)},[vue.createElementVNode("table",vue.mergeProps({class:["table",_ctx.tableClasses],role:_ctx.tableRole},_ctx.$attrs),[_ctx.hasCaption?(vue.openBlock(),vue.createElementBlock("caption",_hoisted_2$3,[vue.renderSlot(_ctx.$slots,"caption")])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),vue.createElementVNode("colgroup",null,[_ctx.isExpandableTable?(vue.openBlock(),vue.createElementBlock("col",_hoisted_3$3)):vue.createCommentVNode("v-if",true),vue.createTextVNode(),_ctx.selectable?(vue.openBlock(),vue.createElementBlock("col",_hoisted_4$2)):vue.createCommentVNode("v-if",true),vue.createTextVNode(),(vue.openBlock(true),vue.createElementBlock(vue.Fragment,null,vue.renderList(_ctx.columns,column=>{return vue.openBlock(),vue.createElementBlock("col",{key:column.id,class:vue.normalizeClass(column.size)},null,2/* CLASS */);}),128/* KEYED_FRAGMENT */))]),vue.createTextVNode(),vue.createElementVNode("thead",null,[vue.createElementVNode("tr",_hoisted_5$2,[_ctx.isExpandableTable?(vue.openBlock(),vue.createElementBlock("th",_hoisted_6$2,[vue.createElementVNode("span",_hoisted_7$2,vue.toDisplayString(_ctx.$t("fkui.interactive-table.select","Expandera")),1/* TEXT */)])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),_ctx.selectable?(vue.openBlock(),vue.createElementBlock("th",_hoisted_8$2,[vue.createElementVNode("span",_hoisted_9$2,vue.toDisplayString(_ctx.$t("fkui.interactive-table.select","Markera")),1/* TEXT */)])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),(vue.openBlock(true),vue.createElementBlock(vue.Fragment,null,vue.renderList(_ctx.visibleColumns,column=>{return vue.openBlock(),vue.createElementBlock("th",vue.mergeProps({key:column.id,scope:"col",class:_ctx.columnClasses(column)},vue.toHandlers(column.sortable?{click:()=>_ctx.onClickColumnHeader(column)}:{},true)),[vue.createElementVNode("span",{innerHTML:_ctx.escapeNewlines(column.title)},null,8,_hoisted_10$2),vue.createTextVNode(),column.sortable?(vue.openBlock(),vue.createBlock(_component_f_icon,{key:0,class:vue.normalizeClass(_ctx.iconClasses(column)),name:_ctx.iconName(column)},null,8,["class","name"])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),column.description?(vue.openBlock(),vue.createElementBlock("span",_hoisted_11$1,vue.toDisplayString(column.description),1/* TEXT */)):vue.createCommentVNode("v-if",true)],16/* FULL_PROPS */);}),128/* KEYED_FRAGMENT */))])]),vue.createTextVNode(),vue.createElementVNode("tbody",_hoisted_12$1,[(vue.openBlock(true),vue.createElementBlock(vue.Fragment,null,vue.renderList(_ctx.rows,(row,index)=>{return vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:_ctx.rowKey(row)},[vue.createElementVNode("tr",{class:vue.normalizeClass(_ctx.rowClasses(row,index)),"aria-label":_ctx.rowDescription(row),"aria-expanded":_ctx.rowAriaExpanded(row),"aria-level":_ctx.isExpandableTable?1:void 0,"aria-describedby":_ctx.getExpandableDescribedby(row),tabindex:"0",onKeydown:vue.withModifiers($event=>_ctx.onKeydown($event,index),["self"]),onClick:$event=>_ctx.onClick($event,row,index)},[_ctx.isExpandableTable?(vue.openBlock(),vue.createElementBlock("td",_hoisted_14$1,[_ctx.hasExpandableContent(row)?(vue.openBlock(),vue.createElementBlock("div",_hoisted_15$1,[vue.createVNode(_component_f_icon,{name:"arrow-right",rotate:_ctx.isExpanded(row)?"270":"90"},null,8,["rotate"])])):vue.createCommentVNode("v-if",true)])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),_ctx.selectable?(vue.openBlock(),vue.createElementBlock("td",_hoisted_16,[vue.createElementVNode("div",_hoisted_17,[vue.createVNode(_component_f_checkbox_field,{value:true,"model-value":_ctx.isSelected(row),onClick:vue.withModifiers($event=>_ctx.onSelect(row),["self"])},{default:vue.withCtx(()=>[_ctx.hasCheckboxDescription?(vue.openBlock(),vue.createElementBlock("span",_hoisted_18,[vue.renderSlot(_ctx.$slots,"checkbox-description",vue.mergeProps({ref_for:true},{row}))])):vue.createCommentVNode("v-if",true)]),_:2/* DYNAMIC */},1032,["model-value","onClick"])])])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),vue.renderSlot(_ctx.$slots,"default",vue.mergeProps({ref_for:true},{row}))],42,_hoisted_13$1),vue.createTextVNode(),_ctx.isExpandableTable&&_ctx.hasExpandableContent(row)?(vue.openBlock(true),vue.createElementBlock(vue.Fragment,{key:0},vue.renderList(_ctx.expandableRows(row),(expandableRow,expandableIndex)=>{return vue.openBlock(),vue.createElementBlock("tr",{key:_ctx.rowKey(expandableRow),"aria-level":"2",class:vue.normalizeClass(_ctx.expandableRowClasses(row,expandableIndex))},[_hoisted_19,vue.createTextVNode(),_ctx.selectable?(vue.openBlock(),vue.createElementBlock("td",_hoisted_20)):vue.createCommentVNode("v-if",true),vue.createTextVNode(),!_ctx.hasExpandableSlot?(vue.openBlock(true),vue.createElementBlock(vue.Fragment,{key:1},vue.renderList(_ctx.columns,(column,columnIndex)=>{return vue.openBlock(),vue.createElementBlock("td",{key:`${_ctx.rowKey(expandableRow)}${column.name}`,class:vue.normalizeClass(_ctx.expandableColumnClasses(column,columnIndex))},vue.toDisplayString(expandableRow[column.name]),3/* TEXT, CLASS */);}),128/* KEYED_FRAGMENT */)):(vue.openBlock(),vue.createElementBlock("td",{key:2,class:"table__column table__column--indented",colspan:_ctx.columns.length},[vue.renderSlot(_ctx.$slots,"expandable",vue.mergeProps({ref_for:true},{expandableRow,parentRow:row}))],8,_hoisted_21))],2/* CLASS */);}),128/* KEYED_FRAGMENT */)):vue.createCommentVNode("v-if",true)],64/* STABLE_FRAGMENT */);}),128/* KEYED_FRAGMENT */)),vue.createTextVNode(),!_ctx.hasInitiateColumns?(vue.openBlock(),vue.createElementBlock("tr",_hoisted_22,[vue.renderSlot(_ctx.$slots,"default",vue.normalizeProps(vue.guardReactiveProps({row:_ctx.emptyRow})))])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),_ctx.isEmpty?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:1},[vue.withDirectives(vue.createElementVNode("tr",_hoisted_23,[vue.renderSlot(_ctx.$slots,"default",vue.normalizeProps(vue.guardReactiveProps({row:_ctx.emptyRow})))],512/* NEED_PATCH */),[[vue.vShow,false]]),vue.createTextVNode(),vue.createElementVNode("tr",null,[vue.createElementVNode("td",{class:"table__column table__column--action",colspan:_ctx.nbOfColumns},[vue.renderSlot(_ctx.$slots,"empty",{},()=>[vue.createTextVNode(vue.toDisplayString(_ctx.$t("fkui.interactive-table.empty","Tabellen är tom")),1/* TEXT */)])],8,_hoisted_24)])],64/* STABLE_FRAGMENT */)):vue.createCommentVNode("v-if",true)],512/* NEED_PATCH */)],16,_hoisted_1$6)],2/* CLASS */);}const FInteractiveTable=/* @__PURE__ */_export_sfc(_sfc_main$6,[["render",_sfc_render$6]]);const _sfc_main$5=vue.defineComponent({name:"FTextareaField",components:{FLabel},inheritAttrs:false,props:{/**
|
|
825
|
+
*/"collapse"],setup(props,context){const sortFilterDatasetInjected=FSortFilterDatasetInjected();const activateItemInjected=ActivateItemInjected();const expandableTable=useExpandableTable(props.expandableAttribute,props.keyAttribute,props.expandableDescribedby,context.emit,context.slots);return{...sortFilterDatasetInjected,...activateItemInjected,...expandableTable};},data(){return{activeRow:void 0,columns:[],emptyRow:emptyTableRow(),selectedRows:[],tr:[]};},computed:{hasCaption(){return hasSlot(this,"caption",{},{stripClasses:[]});},hasCheckboxDescription(){return hasSlot(this,"checkbox-description",{row:this.emptyRow});},hasInitiateColumns(){return this.columns.length>0;},isEmpty(){return this.rows.length===0;},visibleColumns(){return this.columns.filter(col=>col.visible);},tableClasses(){const classes=[];if(this.selectable){classes.push("table--selectable");}if(this.hover){classes.push("table--hover");}return classes;},tableRole(){return this.isExpandableTable?"treegrid":"grid";},wrapperClasses(){return tableScrollClasses(this.scroll);},nbOfColumns(){let columnCount=this.columns.length;if(this.selectable){columnCount++;}if(this.isExpandableTable){columnCount++;}return columnCount;}},watch:{rows:{immediate:true,deep:true,handler:function(){if(this.modelValue){this.selectedRows=this.modelValue.filter(row=>{return includeItem(row,this.rows,this.keyAttribute);});}}}},updated(){const tbodyElement=this.$refs["tbodyElement"];const trElements=[].slice.call(tbodyElement.children);const trInteractableElements=trElements.filter(tr=>{return tr.tabIndex===0;});this.tr=trInteractableElements;},mounted(){this.registerCallbackOnSort(this.callbackOnSort);this.registerCallbackOnMount(this.callbackSortableColumns);this.registerCallbackAfterItemAdd(this.callbackAfterItemAdd);this.registerCallbackBeforeItemDelete(this.callbackBeforeItemDelete);},methods:{isActive(row){return itemEquals(row,this.activeRow,this.keyAttribute);},isSelected(row){return includeItem(row,this.selectedRows,this.keyAttribute);},onKeydownExpandable(event,index){if(event.key===" "||event.key==="Spacebar"){event.preventDefault();return;}onKeydown.call(this,event,index);},onKeydown(event,index){onKeydown.call(this,event,index);},onClick(event,row){const{target}=event;const isRelevant=["TD","TH"].includes(target.nodeName);if(isRelevant){const parent=target.parentElement;this.activate(row,parent);}},activate(row,tr){this.$emit("click",row);if(this.isExpandableTable&&this.hasExpandableContent(row)){this.toggleExpanded(row);}if(!itemEquals(row,this.activeRow,this.keyAttribute)){this.$emit("change",row);this.activeRow=row;if(tr){tr.focus();const td=tr.children[0];forceRepaintIE11(td);}}},rowDescription(row){const slot=this.$slots["row-description"];return renderSlotText(slot,{row});},onSelect(row){if(includeItem(row,this.selectedRows,this.keyAttribute)){this.selectedRows=this.selectedRows.filter(i=>!itemEquals(i,row,this.keyAttribute));this.$emit("unselect",row);}else{this.selectedRows.push(row);this.$emit("select",row);}this.updateVModelWithSelectedRows();this.$forceUpdate();},updateVModelWithSelectedRows(){if(this.modelValue){this.$emit("update:modelValue",this.selectedRows);this.$emit("update",this.selectedRows);}},rowClasses(row,index){const active=this.isActive(row)?["table__row--active"]:[];const selected=this.isSelected(row)?["table__row--selected"]:[];const isExpandableRow=this.isExpandableTable&&this.hasExpandableContent(row);const expandable=isExpandableRow?["table__row--expandable"]:[];const expanded=this.isExpanded(row)?["table__row--expanded-border"]:[];const striped=this.striped&&index%2!==0?["table__row--striped"]:[];return["table__row",...active,...selected,...striped,...expandable,...expanded];},rowKey(row){const key=row[this.keyAttribute];if(typeof key==="undefined"){throw new Error(`Key attribute [${this.keyAttribute}]' is missing in row`);}return String(key);},columnClasses(column){const sortable=column.sortable?["table__column--sortable"]:[];return["table__column",`table__column--${column.type}`,...sortable,column.size];},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);},callbackAfterItemAdd(item){this.activate(item,null);},callbackBeforeItemDelete(item){if(this.rows.length===0){return;}let targetIndex=this.rows.indexOf(item)-1;if(targetIndex<0&&this.rows.length>1){targetIndex=1;}else if(targetIndex<0){targetIndex=0;}this.activate(this.rows[targetIndex],this.tr[targetIndex]);},escapeNewlines(value){return value.replace(/\n/g,"<br/>");}}});const _hoisted_1$6=["role"];const _hoisted_2$3={key:0};const _hoisted_3$3={key:0,class:"table__column--shrink"};const _hoisted_4$2={key:1,class:"table__column--shrink"};const _hoisted_5$2={class:"table__row"};const _hoisted_6$2={key:0,scope:"col"};const _hoisted_7$2={class:"sr-only"};const _hoisted_8$2={key:1,scope:"col"};const _hoisted_9$2={class:"sr-only"};const _hoisted_10$2=["innerHTML"];const _hoisted_11$1={key:1,class:"table__column__description"};const _hoisted_12$1={ref:"tbodyElement"};const _hoisted_13$1=["aria-label","aria-expanded","aria-level","aria-describedby","onKeydown","onClick"];const _hoisted_14$1={key:0};const _hoisted_15$1={key:0,class:"table__expand-icon"};const _hoisted_16={key:1,class:"table__column--selectable"};const _hoisted_17={class:"table__input"};const _hoisted_18={key:0,class:"sr-only"};const _hoisted_19=/* @__PURE__ */vue.createElementVNode("td",null,null,-1/* HOISTED */);const _hoisted_20={key:0,class:"table__column--selectable"};const _hoisted_21=["colspan"];const _hoisted_22={key:0};const _hoisted_23={hidden:""};const _hoisted_24=["colspan"];function _sfc_render$6(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=vue.resolveComponent("f-icon");const _component_f_checkbox_field=vue.resolveComponent("f-checkbox-field");return vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass(_ctx.wrapperClasses)},[vue.createElementVNode("table",vue.mergeProps({class:["table",_ctx.tableClasses],role:_ctx.tableRole},_ctx.$attrs),[_ctx.hasCaption?(vue.openBlock(),vue.createElementBlock("caption",_hoisted_2$3,[vue.renderSlot(_ctx.$slots,"caption")])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),vue.createElementVNode("colgroup",null,[_ctx.isExpandableTable?(vue.openBlock(),vue.createElementBlock("col",_hoisted_3$3)):vue.createCommentVNode("v-if",true),vue.createTextVNode(),_ctx.selectable?(vue.openBlock(),vue.createElementBlock("col",_hoisted_4$2)):vue.createCommentVNode("v-if",true),vue.createTextVNode(),(vue.openBlock(true),vue.createElementBlock(vue.Fragment,null,vue.renderList(_ctx.columns,column=>{return vue.openBlock(),vue.createElementBlock("col",{key:column.id,class:vue.normalizeClass(column.size)},null,2/* CLASS */);}),128/* KEYED_FRAGMENT */))]),vue.createTextVNode(),vue.createElementVNode("thead",null,[vue.createElementVNode("tr",_hoisted_5$2,[_ctx.isExpandableTable?(vue.openBlock(),vue.createElementBlock("th",_hoisted_6$2,[vue.createElementVNode("span",_hoisted_7$2,vue.toDisplayString(_ctx.$t("fkui.interactive-table.select","Expandera")),1/* TEXT */)])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),_ctx.selectable?(vue.openBlock(),vue.createElementBlock("th",_hoisted_8$2,[vue.createElementVNode("span",_hoisted_9$2,vue.toDisplayString(_ctx.$t("fkui.interactive-table.select","Markera")),1/* TEXT */)])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),(vue.openBlock(true),vue.createElementBlock(vue.Fragment,null,vue.renderList(_ctx.visibleColumns,column=>{return vue.openBlock(),vue.createElementBlock("th",vue.mergeProps({key:column.id,scope:"col",class:_ctx.columnClasses(column)},vue.toHandlers(column.sortable?{click:()=>_ctx.onClickColumnHeader(column)}:{},true)),[vue.createElementVNode("span",{innerHTML:_ctx.escapeNewlines(column.title)},null,8,_hoisted_10$2),vue.createTextVNode(),column.sortable?(vue.openBlock(),vue.createBlock(_component_f_icon,{key:0,class:vue.normalizeClass(_ctx.iconClasses(column)),name:_ctx.iconName(column)},null,8,["class","name"])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),column.description?(vue.openBlock(),vue.createElementBlock("span",_hoisted_11$1,vue.toDisplayString(column.description),1/* TEXT */)):vue.createCommentVNode("v-if",true)],16/* FULL_PROPS */);}),128/* KEYED_FRAGMENT */))])]),vue.createTextVNode(),vue.createElementVNode("tbody",_hoisted_12$1,[(vue.openBlock(true),vue.createElementBlock(vue.Fragment,null,vue.renderList(_ctx.rows,(row,index)=>{return vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:_ctx.rowKey(row)},[vue.createElementVNode("tr",{class:vue.normalizeClass(_ctx.rowClasses(row,index)),"aria-label":_ctx.rowDescription(row),"aria-expanded":_ctx.rowAriaExpanded(row),"aria-level":_ctx.isExpandableTable?1:void 0,"aria-describedby":_ctx.getExpandableDescribedby(row),tabindex:"0",onKeydown:vue.withModifiers($event=>_ctx.onKeydown($event,index),["self"]),onClick:$event=>_ctx.onClick($event,row,index)},[_ctx.isExpandableTable?(vue.openBlock(),vue.createElementBlock("td",_hoisted_14$1,[_ctx.hasExpandableContent(row)?(vue.openBlock(),vue.createElementBlock("div",_hoisted_15$1,[vue.createVNode(_component_f_icon,{name:"arrow-right",rotate:_ctx.isExpanded(row)?"270":"90"},null,8,["rotate"])])):vue.createCommentVNode("v-if",true)])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),_ctx.selectable?(vue.openBlock(),vue.createElementBlock("td",_hoisted_16,[vue.createElementVNode("div",_hoisted_17,[vue.createVNode(_component_f_checkbox_field,{value:true,"model-value":_ctx.isSelected(row),onClick:vue.withModifiers($event=>_ctx.onSelect(row),["self"])},{default:vue.withCtx(()=>[_ctx.hasCheckboxDescription?(vue.openBlock(),vue.createElementBlock("span",_hoisted_18,[vue.renderSlot(_ctx.$slots,"checkbox-description",vue.mergeProps({ref_for:true},{row}))])):vue.createCommentVNode("v-if",true)]),_:2/* DYNAMIC */},1032,["model-value","onClick"])])])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),vue.renderSlot(_ctx.$slots,"default",vue.mergeProps({ref_for:true},{row}))],42,_hoisted_13$1),vue.createTextVNode(),_ctx.isExpandableTable&&_ctx.hasExpandableContent(row)?(vue.openBlock(true),vue.createElementBlock(vue.Fragment,{key:0},vue.renderList(_ctx.expandableRows(row),(expandableRow,expandableIndex)=>{return vue.openBlock(),vue.createElementBlock("tr",{key:_ctx.rowKey(expandableRow),"aria-level":"2",class:vue.normalizeClass(_ctx.expandableRowClasses(row,expandableIndex))},[_hoisted_19,vue.createTextVNode(),_ctx.selectable?(vue.openBlock(),vue.createElementBlock("td",_hoisted_20)):vue.createCommentVNode("v-if",true),vue.createTextVNode(),!_ctx.hasExpandableSlot?(vue.openBlock(true),vue.createElementBlock(vue.Fragment,{key:1},vue.renderList(_ctx.columns,(column,columnIndex)=>{return vue.openBlock(),vue.createElementBlock("td",{key:`${_ctx.rowKey(expandableRow)}${column.name}`,class:vue.normalizeClass(_ctx.expandableColumnClasses(column,columnIndex))},vue.toDisplayString(expandableRow[column.name]),3/* TEXT, CLASS */);}),128/* KEYED_FRAGMENT */)):(vue.openBlock(),vue.createElementBlock("td",{key:2,class:"table__column table__column--indented",colspan:_ctx.columns.length},[vue.renderSlot(_ctx.$slots,"expandable",vue.mergeProps({ref_for:true},{expandableRow,parentRow:row}))],8,_hoisted_21))],2/* CLASS */);}),128/* KEYED_FRAGMENT */)):vue.createCommentVNode("v-if",true)],64/* STABLE_FRAGMENT */);}),128/* KEYED_FRAGMENT */)),vue.createTextVNode(),!_ctx.hasInitiateColumns?(vue.openBlock(),vue.createElementBlock("tr",_hoisted_22,[vue.renderSlot(_ctx.$slots,"default",vue.normalizeProps(vue.guardReactiveProps({row:_ctx.emptyRow})))])):vue.createCommentVNode("v-if",true),vue.createTextVNode(),_ctx.isEmpty?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:1},[vue.withDirectives(vue.createElementVNode("tr",_hoisted_23,[vue.renderSlot(_ctx.$slots,"default",vue.normalizeProps(vue.guardReactiveProps({row:_ctx.emptyRow})))],512/* NEED_PATCH */),[[vue.vShow,false]]),vue.createTextVNode(),vue.createElementVNode("tr",null,[vue.createElementVNode("td",{class:"table__column table__column--action",colspan:_ctx.nbOfColumns},[vue.renderSlot(_ctx.$slots,"empty",{},()=>[vue.createTextVNode(vue.toDisplayString(_ctx.$t("fkui.interactive-table.empty","Tabellen är tom")),1/* TEXT */)])],8,_hoisted_24)])],64/* STABLE_FRAGMENT */)):vue.createCommentVNode("v-if",true)],512/* NEED_PATCH */)],16,_hoisted_1$6)],2/* CLASS */);}const FInteractiveTable=/* @__PURE__ */_export_sfc(_sfc_main$6,[["render",_sfc_render$6]]);const _sfc_main$5=vue.defineComponent({name:"FTextareaField",components:{FLabel},inheritAttrs:false,props:{/**
|
|
801
826
|
* The id for the input id attribute.
|
|
802
827
|
* The id for the label for attribute.
|
|
803
828
|
* If the prop is not set a random value will be generated.
|
|
@@ -909,4 +934,4 @@ this.modelValue.length>=this.maxlength-this.softLimit;},charactersLeftWarningInt
|
|
|
909
934
|
* @model
|
|
910
935
|
*/modelValue:{type:Object,required:true},/**
|
|
911
936
|
* Dialogue tree
|
|
912
|
-
*/dialogueTree:{type:Object,required:true}},emits:["change","update:modelValue"],data(){return{currentStep:this.dialogueTree,steps:[]};},computed:{userData(){if(isDialogueTreeEndQuestion(this.currentStep)){return this.currentStep.userData;}return void 0;},options(){if(!isDialogueTreeEndQuestion(this.currentStep)){return this.currentStep.options;}return[];}},created(){this.currentStep=this.dialogueTree;if(isDialogueTreeEndQuestion(this.currentStep)){this.emitChange(true);}else{this.emitChange(false);}},methods:{async onClickedOption(option,index){this.steps.push(index);this.currentStep=option.question;if(isDialogueTreeEndQuestion(option.question)){this.emitChange(true);await this.$nextTick();logic.focusFirst(this.$el);}else{this.emitChange(false);await this.$nextTick();const firstElement=getHTMLElementsFromVueRef(this.$refs["dialogueButton-0"])[0];if(firstElement){logic.focus(firstElement);}}},emitChange(lastStep){const emit={label:this.currentStep.label,lastStep,steps:this.steps};this.$emit("update:modelValue",emit);this.$emit("change",emit);}}});const _hoisted_1={class:"dialogue-tree"};const _hoisted_2={key:0,class:"dialogue-tree__list"};const _hoisted_3=["onClick"];function _sfc_render(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=vue.resolveComponent("f-icon");return vue.openBlock(),vue.createElementBlock("div",_hoisted_1,[_ctx.options.length>0?(vue.openBlock(),vue.createElementBlock("ul",_hoisted_2,[(vue.openBlock(true),vue.createElementBlock(vue.Fragment,null,vue.renderList(_ctx.options,(option,index)=>{return vue.openBlock(),vue.createElementBlock("li",{key:option.label,class:"dialogue-tree__list-item"},[vue.createElementVNode("button",{ref_for:true,ref:`dialogueButton-${index}`,type:"button",onClick:$event=>_ctx.onClickedOption(option,index)},[vue.createElementVNode("span",null,vue.toDisplayString(option.label),1/* TEXT */),vue.createTextVNode(),vue.createVNode(_component_f_icon,{name:"arrow-right"})],8,_hoisted_3)]);}),128/* KEYED_FRAGMENT */))])):vue.renderSlot(_ctx.$slots,"default",vue.normalizeProps(vue.mergeProps({key:1},{userData:_ctx.userData})))]);}const FDialogueTree=/* @__PURE__ */_export_sfc(_sfc_main,[["render",_sfc_render]]);exports.ActivateItemInjected=ActivateItemInjected;exports.ErrorData=ErrorData;exports.ErrorPlugin=ErrorPlugin;exports.ErrorViewData=ErrorViewData;exports.EventBus=EventBus;exports.FBadge=FBadge;exports.FBankAccountNumberTextField=_sfc_main$I;exports.FBankgiroTextField=_sfc_main$H;exports.FCalendar=FCalendar;exports.FCalendarDay=FCalendarDay;exports.FCard=FCard;exports.FCheckboxField=FCheckboxField;exports.FCheckboxGroup=FCheckboxGroup;exports.FCheckboxGroupField=FCheckboxField;exports.FClearingnumberTextField=_sfc_main$G;exports.FConfirmModal=FConfirmModal;exports.FContextMenu=FContextMenu;exports.FCrudButton=FCrudButton;exports.FCrudDataset=FCrudDataset;exports.FCurrencyTextField=_sfc_main$K;exports.FDataTable=FDataTable;exports.FDatepickerField=FDatepickerField;exports.FDialogueTree=FDialogueTree;exports.FEmailTextField=FEmailTextField;exports.FErrorHandlingApp=FErrorHandlingApp;exports.FErrorList=FErrorList;exports.FExpand=FExpand;exports.FExpandablePanel=FExpandablePanel;exports.FExpandableParagraph=FExpandableParagraph;exports.FFieldset=FFieldset;exports.FFileItem=FFileItem;exports.FFileSelector=FFileSelector;exports.FForm=FForm;exports.FFormModal=FFormModal;exports.FFormModalAction=FValidationFormAction;exports.FFormStep=FFormStep;exports.FFormStepButton=FFormStepButton;exports.FIcon=FIcon;exports.FInteractiveTable=FInteractiveTable;exports.FKUIConfigButtonOrder=FKUIConfigButtonOrder;exports.FLabel=FLabel;exports.FLayoutApplicationTemplate=FLayoutApplicationTemplate;exports.FLayoutLeftPanel=FLayoutLeftPanel;exports.FLayoutRightPanel=FLayoutRightPanel;exports.FLayoutRightPanelService=FLayoutRightPanelService;exports.FList=FList;exports.FLoader=FLoader;exports.FMessageBox=FMessageBox;exports.FModal=FModal;exports.FNavigationMenu=FNavigationMenu;exports.FNumericTextField=_sfc_main$F;exports.FOffline=FOffline;exports.FOrganisationsnummerTextField=_sfc_main$A;exports.FOutputField=FOutputField;exports.FPageHeader=FPageHeader;exports.FPercentTextField=_sfc_main$B;exports.FPersonnummerTextField=_sfc_main$E;exports.FPhoneTextField=FPhoneTextField;exports.FPlusgiroTextField=_sfc_main$D;exports.FPostalCodeTextField=_sfc_main$C;exports.FProgressbar=FProgressbar;exports.FRadioField=FRadioField;exports.FRadioGroup=FRadioGroup;exports.FRadioGroupField=FRadioField;exports.FSearchTextField=FSearchTextField;exports.FSelectField=FSelectField;exports.FSortFilterDataset=FSortFilterDataset;exports.FSortFilterDatasetInjected=FSortFilterDatasetInjected;exports.FStaticField=FStaticField;exports.FTableColumn=FTableColumn;exports.FTableColumnSize=FTableColumnSize;exports.FTableColumnSort=FTableColumnSort;exports.FTableColumnType=FTableColumnType;exports.FTextField=FTextField;exports.FTextareaField=FTextareaField;exports.FTooltip=FTooltip;exports.FValidationForm=FValidationForm;exports.FValidationFormAction=FValidationFormAction;exports.FValidationGroup=FValidationGroup;exports.FWizard=FWizard;exports.FWizardStep=FWizardStep;exports.FWizardStepAction=FValidationFormAction;exports.FormErrorList=FormErrorList;exports.FormStep=FormStep;exports.IAnimateExpand=IAnimateExpand;exports.ICalendarMonth=ICalendarMonth;exports.ICalendarMonthGrid=ICalendarMonthGrid;exports.ICalendarNavbar=ICalendarNavbar;exports.IFlex=IFlex;exports.IFlexItem=IFlexItem;exports.IMenu=IMenu;exports.IPopup=IPopup;exports.IPopupError=IPopupError;exports.IPopupMenu=IPopupMenu;exports.ISkipLink=ISkipLink;exports.IValidationForm=FValidationForm;exports.MenuAction=MenuAction;exports.ModalReason=ModalReason;exports.Operation=Operation;exports.TableScroll=TableScroll;exports.TestPlugin=TestPlugin;exports.TranslationMixin=TranslationMixin;exports.TranslationPlugin=TranslationPlugin;exports.UNHANDLED_ERROR_EVENT=UNHANDLED_ERROR_EVENT;exports.ValidationPlugin=ValidationPlugin;exports.actionFromKeyboardEvent=actionFromKeyboardEvent;exports.cleanUpElements=cleanUpElements;exports.config=config;exports.confirmModal=confirmModal;exports.createFFormProvideOptions=createFFormProvideOptions;exports.dispatchComponentUnmountEvent=dispatchComponentUnmountEvent;exports.dispatchComponentValidityEvent=dispatchComponentValidityEvent;exports.emptyTableRow=emptyTableRow;exports.findElementFromVueRef=findElementFromVueRef;exports.findHTMLElementFromVueRef=findHTMLElementFromVueRef;exports.findParentByName=findParentByName;exports.focus=focus;exports.formModal=formModal;exports.getDayEndOffset=getDayEndOffset;exports.getDayStartOffset=getDayStartOffset;exports.getElementFromVueRef=getElementFromVueRef;exports.getElementsFromVueRef=getElementsFromVueRef;exports.getHTMLElementFromVueRef=getHTMLElementFromVueRef;exports.getHTMLElementsFromVueRef=getHTMLElementsFromVueRef;exports.getInputElement=getInputElement;exports.getParentByName=getParentByName;exports.getRef=getRef;exports.getSortedHTMLElementsFromVueRef=getSortedHTMLElementsFromVueRef;exports.getTextFromScopedSlot=getTextFromScopedSlot;exports.handleKeyboardFocusNavigation=handleKeyboardFocusNavigation;exports.hasParentByName=hasParentByName;exports.hasSlot=hasSlot;exports.includeItem=includeItem;exports.isContextMenuSeparatorItem=isContextMenuSeparatorItem;exports.isContextMenuTextItem=isContextMenuTextItem;exports.isDialogueTreeEndQuestion=isDialogueTreeEndQuestion;exports.isFormStepReference=isFormStepReference;exports.itemEquals=itemEquals;exports.mountComponent=mountComponent;exports.openModal=openModal;exports.refIsElement=refIsElement;exports.refIsElementArray=refIsElementArray;exports.refIsHTMLElementArray=refIsHTMLElementArray;exports.refIsVue=refIsVue;exports.refIsVueArray=refIsVueArray;exports.renderSlotText=renderSlotText;exports.setIsOpen=setIsOpen;exports.setRef=setRef;exports.setRunningContext=setRunningContext;exports.sortComponentsWithErrorsOnDOMOrder=sortComponentsWithErrorsOnDOMOrder;exports.tableScrollClasses=tableScrollClasses;exports.
|
|
937
|
+
*/dialogueTree:{type:Object,required:true}},emits:["change","update:modelValue"],data(){return{currentStep:this.dialogueTree,steps:[]};},computed:{userData(){if(isDialogueTreeEndQuestion(this.currentStep)){return this.currentStep.userData;}return void 0;},options(){if(!isDialogueTreeEndQuestion(this.currentStep)){return this.currentStep.options;}return[];}},created(){this.currentStep=this.dialogueTree;if(isDialogueTreeEndQuestion(this.currentStep)){this.emitChange(true);}else{this.emitChange(false);}},methods:{async onClickedOption(option,index){this.steps.push(index);this.currentStep=option.question;if(isDialogueTreeEndQuestion(option.question)){this.emitChange(true);await this.$nextTick();logic.focusFirst(this.$el);}else{this.emitChange(false);await this.$nextTick();const firstElement=getHTMLElementsFromVueRef(this.$refs["dialogueButton-0"])[0];if(firstElement){logic.focus(firstElement);}}},emitChange(lastStep){const emit={label:this.currentStep.label,lastStep,steps:this.steps};this.$emit("update:modelValue",emit);this.$emit("change",emit);}}});const _hoisted_1={class:"dialogue-tree"};const _hoisted_2={key:0,class:"dialogue-tree__list"};const _hoisted_3=["onClick"];function _sfc_render(_ctx,_cache,$props,$setup,$data,$options){const _component_f_icon=vue.resolveComponent("f-icon");return vue.openBlock(),vue.createElementBlock("div",_hoisted_1,[_ctx.options.length>0?(vue.openBlock(),vue.createElementBlock("ul",_hoisted_2,[(vue.openBlock(true),vue.createElementBlock(vue.Fragment,null,vue.renderList(_ctx.options,(option,index)=>{return vue.openBlock(),vue.createElementBlock("li",{key:option.label,class:"dialogue-tree__list-item"},[vue.createElementVNode("button",{ref_for:true,ref:`dialogueButton-${index}`,type:"button",onClick:$event=>_ctx.onClickedOption(option,index)},[vue.createElementVNode("span",null,vue.toDisplayString(option.label),1/* TEXT */),vue.createTextVNode(),vue.createVNode(_component_f_icon,{name:"arrow-right"})],8,_hoisted_3)]);}),128/* KEYED_FRAGMENT */))])):vue.renderSlot(_ctx.$slots,"default",vue.normalizeProps(vue.mergeProps({key:1},{userData:_ctx.userData})))]);}const FDialogueTree=/* @__PURE__ */_export_sfc(_sfc_main,[["render",_sfc_render]]);exports.ActivateItemInjected=ActivateItemInjected;exports.ErrorData=ErrorData;exports.ErrorPlugin=ErrorPlugin;exports.ErrorViewData=ErrorViewData;exports.EventBus=EventBus;exports.FBadge=FBadge;exports.FBankAccountNumberTextField=_sfc_main$I;exports.FBankgiroTextField=_sfc_main$H;exports.FCalendar=FCalendar;exports.FCalendarDay=FCalendarDay;exports.FCard=FCard;exports.FCheckboxField=FCheckboxField;exports.FCheckboxGroup=FCheckboxGroup;exports.FCheckboxGroupField=FCheckboxField;exports.FClearingnumberTextField=_sfc_main$G;exports.FConfirmModal=FConfirmModal;exports.FContextMenu=FContextMenu;exports.FCrudButton=FCrudButton;exports.FCrudDataset=FCrudDataset;exports.FCurrencyTextField=_sfc_main$K;exports.FDataTable=FDataTable;exports.FDatepickerField=FDatepickerField;exports.FDialogueTree=FDialogueTree;exports.FEmailTextField=FEmailTextField;exports.FErrorHandlingApp=FErrorHandlingApp;exports.FErrorList=FErrorList;exports.FExpand=FExpand;exports.FExpandablePanel=FExpandablePanel;exports.FExpandableParagraph=FExpandableParagraph;exports.FFieldset=FFieldset;exports.FFileItem=FFileItem;exports.FFileSelector=FFileSelector;exports.FForm=FForm;exports.FFormModal=FFormModal;exports.FFormModalAction=FValidationFormAction;exports.FFormStep=FFormStep;exports.FFormStepButton=FFormStepButton;exports.FIcon=FIcon;exports.FInteractiveTable=FInteractiveTable;exports.FKUIConfigButtonOrder=FKUIConfigButtonOrder;exports.FLabel=FLabel;exports.FLayoutApplicationTemplate=FLayoutApplicationTemplate;exports.FLayoutLeftPanel=FLayoutLeftPanel;exports.FLayoutRightPanel=FLayoutRightPanel;exports.FLayoutRightPanelService=FLayoutRightPanelService;exports.FList=FList;exports.FLoader=FLoader;exports.FMessageBox=FMessageBox;exports.FModal=FModal;exports.FNavigationMenu=FNavigationMenu;exports.FNumericTextField=_sfc_main$F;exports.FOffline=FOffline;exports.FOrganisationsnummerTextField=_sfc_main$A;exports.FOutputField=FOutputField;exports.FPageHeader=FPageHeader;exports.FPercentTextField=_sfc_main$B;exports.FPersonnummerTextField=_sfc_main$E;exports.FPhoneTextField=FPhoneTextField;exports.FPlusgiroTextField=_sfc_main$D;exports.FPostalCodeTextField=_sfc_main$C;exports.FProgressbar=FProgressbar;exports.FRadioField=FRadioField;exports.FRadioGroup=FRadioGroup;exports.FRadioGroupField=FRadioField;exports.FSearchTextField=FSearchTextField;exports.FSelectField=FSelectField;exports.FSortFilterDataset=FSortFilterDataset;exports.FSortFilterDatasetInjected=FSortFilterDatasetInjected;exports.FStaticField=FStaticField;exports.FTableColumn=FTableColumn;exports.FTableColumnSize=FTableColumnSize;exports.FTableColumnSort=FTableColumnSort;exports.FTableColumnType=FTableColumnType;exports.FTextField=FTextField;exports.FTextareaField=FTextareaField;exports.FTooltip=FTooltip;exports.FValidationForm=FValidationForm;exports.FValidationFormAction=FValidationFormAction;exports.FValidationGroup=FValidationGroup;exports.FWizard=FWizard;exports.FWizardStep=FWizardStep;exports.FWizardStepAction=FValidationFormAction;exports.FormErrorList=FormErrorList;exports.FormStep=FormStep;exports.IAnimateExpand=IAnimateExpand;exports.ICalendarMonth=ICalendarMonth;exports.ICalendarMonthGrid=ICalendarMonthGrid;exports.ICalendarNavbar=ICalendarNavbar;exports.IFlex=IFlex;exports.IFlexItem=IFlexItem;exports.IMenu=IMenu;exports.IPopup=IPopup;exports.IPopupError=IPopupError;exports.IPopupMenu=IPopupMenu;exports.ISkipLink=ISkipLink;exports.IValidationForm=FValidationForm;exports.MenuAction=MenuAction;exports.ModalReason=ModalReason;exports.Operation=Operation;exports.Placement=Placement;exports.TableScroll=TableScroll;exports.TestPlugin=TestPlugin;exports.TranslationMixin=TranslationMixin;exports.TranslationPlugin=TranslationPlugin;exports.UNHANDLED_ERROR_EVENT=UNHANDLED_ERROR_EVENT;exports.ValidationPlugin=ValidationPlugin;exports.actionFromKeyboardEvent=actionFromKeyboardEvent;exports.cleanUpElements=cleanUpElements;exports.config=config;exports.confirmModal=confirmModal;exports.createFFormProvideOptions=createFFormProvideOptions;exports.dispatchComponentUnmountEvent=dispatchComponentUnmountEvent;exports.dispatchComponentValidityEvent=dispatchComponentValidityEvent;exports.emptyTableRow=emptyTableRow;exports.findElementFromVueRef=findElementFromVueRef;exports.findHTMLElementFromVueRef=findHTMLElementFromVueRef;exports.findParentByName=findParentByName;exports.focus=focus;exports.formModal=formModal;exports.getDayEndOffset=getDayEndOffset;exports.getDayStartOffset=getDayStartOffset;exports.getElementFromVueRef=getElementFromVueRef;exports.getElementsFromVueRef=getElementsFromVueRef;exports.getHTMLElementFromVueRef=getHTMLElementFromVueRef;exports.getHTMLElementsFromVueRef=getHTMLElementsFromVueRef;exports.getInputElement=getInputElement;exports.getParentByName=getParentByName;exports.getRef=getRef;exports.getSortedHTMLElementsFromVueRef=getSortedHTMLElementsFromVueRef;exports.getTextFromScopedSlot=getTextFromScopedSlot;exports.handleKeyboardFocusNavigation=handleKeyboardFocusNavigation;exports.hasParentByName=hasParentByName;exports.hasSlot=hasSlot;exports.includeItem=includeItem;exports.isContextMenuSeparatorItem=isContextMenuSeparatorItem;exports.isContextMenuTextItem=isContextMenuTextItem;exports.isDialogueTreeEndQuestion=isDialogueTreeEndQuestion;exports.isFormStepReference=isFormStepReference;exports.itemEquals=itemEquals;exports.mountComponent=mountComponent;exports.openModal=openModal;exports.refIsElement=refIsElement;exports.refIsElementArray=refIsElementArray;exports.refIsHTMLElementArray=refIsHTMLElementArray;exports.refIsVue=refIsVue;exports.refIsVueArray=refIsVueArray;exports.renderSlotText=renderSlotText;exports.setIsOpen=setIsOpen;exports.setRef=setRef;exports.setRunningContext=setRunningContext;exports.sortComponentsWithErrorsOnDOMOrder=sortComponentsWithErrorsOnDOMOrder;exports.tableScrollClasses=tableScrollClasses;exports.useTranslate=useTranslate;
|