@progress/kendo-vue-layout
Version:
9 lines (8 loc) • 3.94 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),r=require("@progress/kendo-vue-common"),q=require("@progress/kendo-vue-intl"),k=require("@progress/kendo-svg-icons"),S=require("./contants.js"),b=require("./messages/main.js"),D=t.defineComponent({name:"KendoStep",props:{current:Boolean,disabled:Boolean,icon:String,svgIcon:Object,index:Number,isValid:{type:Boolean,default:void 0},focused:Boolean,label:String,optional:Boolean,tabIndex:{type:Number,default:0},text:String,animationDuration:[Boolean,Number],isVertical:Boolean,item:[String,Object,Boolean,Function],linear:Boolean,mode:String,numOfSteps:Number,value:Number,successIcon:String,successSvgIcon:Object,errorIcon:String,errorSvgIcon:Object,onChange:Function,onFocus:Function},inject:{kendoLocalizationService:{default:null}},computed:{itemClassNames(){const{current:e,disabled:n,focused:i,index:o,isValid:s,optional:d}=this.$props;return{"k-step":!0,"k-step-first":o===0,"k-step-last":this.numOfSteps&&o===this.numOfSteps-1,"k-step-done":o<this.value,"k-step-current":e,"k-step-optional":d,"k-disabled":n,"k-focus":i,"k-step-error":s!==void 0&&!s,"k-step-success":s}},itemStyles(){const{index:e}=this.$props,n=!this.linear||e===this.value-1||e===this.value||e===this.value+1;return{maxWidth:this.isVertical?void 0:`calc(100% / ${this.numOfSteps})`,pointerEvents:n?void 0:"none"}}},watch:{focused(e){this.aElement=this.$refs.aElement,this.aElement&&e&&this.aElement.focus()}},setup(){return{kendoLocalizationService:t.inject("kendoLocalizationService",{})}},render(){const e=r.getDefaultSlots(this),{current:n,disabled:i,focused:o,icon:s,svgIcon:d,index:a,isValid:c,label:l,optional:I,tabIndex:m,text:g,animationDuration:u,item:v,linear:N,mode:V,value:p,successIcon:x,successSvgIcon:C,errorIcon:O,errorSvgIcon:F}=this.$props,y=!N||a===p-1||a===p||a===p+1,B=q.provideLocalizationService(this),$=(f=>B.toLanguageString(f,b.messages[f]))(b.optionalText),z=typeof u=="number"?u:u!==!1?S.DEFAULT_ANIMATION_DURATION:S.NO_ANIMATION,L=c?x||"check-circle":O||"exclamation-circle",j=c?C||k.checkOutlineIcon:F||k.exclamationCircleIcon,h=t.createVNode(r.Icon,{class:"k-step-indicator-icon",name:r.getIconName(L),icon:j,"aria-hidden":"true"},null),A=function(){return V!=="labels"?t.createVNode("span",{class:"k-step-indicator","aria-hidden":!0,style:{transitionDuration:z+"ms"}},[this.getStepIndicatorContent(l,s,d,g,a,c,h)]):null},E=function(){return t.createVNode("span",{class:"k-step-label"},[l&&t.createVNode("span",{class:"k-step-text"},[l]),l&&c!==void 0&&h,I&&t.createVNode("span",{class:"k-step-label-optional"},[$])])};return t.createVNode("li",{class:this.itemClassNames,style:this.itemStyles},[t.createVNode("a",{ref:"aElement",class:"k-step-link",title:l||void 0,onClick:this.handleClick,onFocusin:this.handleFocus,"tab-index":m||(n?0:-1),"aria-current":n?!0:void 0,"aria-disabled":i||!y||void 0,"aria-invalid":c!==void 0&&!c||void 0},[v?e:[A.call(this),E.call(this)]])])},methods:{getStepIndicatorContent(e,n,i,o,s,d,a){return e?n||i?t.createVNode(r.Icon,{class:"k-step-indicator-icon",name:n,icon:i},null):t.createVNode("span",{class:"k-step-indicator-text"},[o||s+1]):d!==void 0?a:n||i?t.createVNode(r.Icon,{class:"k-step-indicator-icon",name:n,icon:i},null):t.createVNode("span",{class:"k-step-indicator-text"},[o||s+1])},focus(){this.$el&&r.focusFirstFocusableChild(this.$el)},handleClick(e){this.disabled||this.$emit("change",{event:e,value:this.index,component:this})},handleFocus(e){this.disabled||this.$emit("focus",e)}}});exports.Step=D;