| Current Path : /var/www/homesaver/www/bitrix/js/ui/image-stack-steps/dist/ |
| Current File : /var/www/homesaver/www/bitrix/js/ui/image-stack-steps/dist/image-stack-steps.bundle.min.js |
this.BX=this.BX||{};(function(t,e,s,a,i,r,n){"use strict";const o=Object.freeze({TEXT:"text",STUB:"stub"});const p=Object.freeze({IMAGE:"image",IMAGE_STUB:"image-stub",USER:"user",USER_STUB:"user-stub",ICON:"icon",COUNTER:"counter"});const l=Object.freeze({CUSTOM:"custom",OK:"ok",CANCEL:"cancel",WAIT:"wait"});const c=Object.freeze({TEXT:"text",STUB:"stub",DURATION:"duration"});function u(t){if(!r.Type.isStringFilled(t.id)){console.warn("UI.Image-Stack-Steps: StepData.id must be filled string");return false}if(!r.Type.isUndefined(t.progressBox)){if(!r.Type.isPlainObject(t.progressBox)){console.warn("UI.Image-Stack-Steps: StepData.progressBox must be plain object")}if(!r.Type.isString(t.progressBox.title)){console.warn("UI.Image-Stack-Steps: StepData.progressBox.title must be string");return false}}return d(t.header)&&f(t.stack)&&m(t.footer)}function d(t){if(r.Type.isNil(t)){return true}if(!r.Type.isPlainObject(t)){console.warn("UI.Image-Stack-Steps: StepData.header must be plain object");return false}if(!Object.values(o).includes(t.type)){console.warn("UI.Image-Stack-Steps: StepData.header.type must be one of headerTypeEnum values");return false}if(t.type===o.TEXT){var e;if(r.Type.isString((e=t.data)==null?void 0:e.text)){return true}console.warn("UI.Image-Stack-Steps: "+'StepData.header with type "text" must contain HeaderData.text; '+"HeaderData.text must be string");return false}return t.type===o.STUB}function m(t){if(r.Type.isNil(t)){return true}if(!r.Type.isPlainObject(t)){console.warn("UI.Image-Stack-Steps: StepData.footer must be plain object");return false}if(t.type===c.TEXT){var e;if(r.Type.isString((e=t.data)==null?void 0:e.text)){return true}console.warn("UI.Image-Stack-Steps: "+'StepData.footer with type "text" must contain FooterData.text; '+"FooterData.text must be string");return false}if(t.type===c.DURATION){return h(t.data)}return t.type===c.STUB}function f(t){if(!r.Type.isPlainObject(t)){console.warn("UI.Image-Stack-Steps: StepData.stack must be plain object");return false}if(!r.Type.isUndefined(t.status)){if(!r.Type.isPlainObject(t.status)){console.warn("UI.Image-Stack-Steps: StackData.status must be plain object");return false}if(!S(t.status)){return false}}if(!r.Type.isArrayFilled(t.images)){console.warn("UI.Image-Stack-Steps: StackData.images must be filled array");return false}for(const e of t.images){if(!g(e)){return false}}return true}function g(t){var e,s,a,i,n,o;if(!r.Type.isPlainObject(t)){return false}if(t.type===p.IMAGE&&r.Type.isString((e=t.data)==null?void 0:e.src)&&(r.Type.isUndefined((s=t.data)==null?void 0:s.title)||r.Type.isStringFilled((a=t.data)==null?void 0:a.title))){return true}if(t.type===p.USER&&r.Type.isString((i=t.data)==null?void 0:i.src)&&r.Type.isNumber((n=t.data)==null?void 0:n.userId)&&t.data.userId>0){return true}if(t.type===p.ICON&&y(t.data)){return true}if(t.type===p.USER_STUB||t.type===p.IMAGE_STUB){return true}if(t.type===p.COUNTER&&r.Type.isStringFilled((o=t.data)==null?void 0:o.text)){return true}console.warn("UI.Image-Stack-Steps: StackData.data must be correct",t);return false}function S(t){if(t.type===l.CUSTOM&&!y(t.data)){console.warn('UI.Image-Stack-Steps: StackData.status with type "custom" must be correct',t);return false}if(Object.values(l).includes(t.type)){return true}console.warn("UI.Image-Stack-Steps: StackData.status must be correct",t);return false}function h(t){if(!r.Type.isNumber(t.duration)||t.duration<0){console.warn("UI.Image-Stack-Steps: FooterDurationData.duration must be not negative number");return false}if(!r.Type.isBoolean(t.realtime)){console.warn("UI.Image-Stack-Steps: FooterDurationData.realtime must be boolean");return false}if(t.realtime===true&&!r.Type.isUndefined(t.realtimeBoundary)&&(!r.Type.isNumber(t.realtimeBoundary)||t.realtimeBoundary<=0)){console.warn("UI.Image-Stack-Steps: FooterDurationData.realtimeBoundary must be positive integer");return false}if(!r.Type.isUndefined(t.format)&&!(r.Type.isString(t.format)||r.Type.isArray(t.format))){console.warn("UI.Image-Stack-Steps: FooterDurationData.format must be array or string");return false}return true}function y(t){return r.Type.isPlainObject(t)&&r.Type.isStringFilled(t.icon)&&r.Type.isStringFilled(t.color)}const b={name:"ui-image-stack-steps-step-progress-box",components:{BIcon:i.BIcon},props:{title:{type:String,required:true}},template:`\n\t\t<div\n\t\t\t:title="title"\n\t\t\tclass="ui-image-stack-steps-step-progress-box"\n\t\t>\n\t\t\t<BIcon\n\t\t\t\tname="more"\n\t\t\t\t:size="12"\n\t\t\t\tcolor="var(--ui-color-base-70)"\n\t\t\t\tclass="ui-image-stack-steps-step-progress-box__icon"\n\t\t\t/>\n\t\t\t<div class="ui-image-stack-steps-step-progress-box__icon-overlay"></div>\n\t\t</div>\n\t`};const v={name:"ui-image-stack-steps-text",props:{text:{type:String,required:true}},template:`\n\t\t<div class="ui-image-stack-steps-text" :title="text">{{ text }}</div>\n\t`};const T={name:"ui-image-stack-steps-text-skeleton",template:`\n\t\t<div class="ui-image-stack-steps-text-skeleton-area">\n\t\t\t<div class="ui-image-stack-steps-text-skeleton-area-stub"></div>\n\t\t</div>\n\t`};const k={name:"ui-image-stack-steps-step-header",props:{header:{type:Object,required:true,validator:t=>d(t)}},methods:{getComponent(){if(this.header.type===o.TEXT){return v}return T},getCustomStyles(){var t;const e={};if(r.Type.isNumber((t=this.header.styles)==null?void 0:t.maxWidth)){e.maxWidth=`${this.header.styles.maxWidth}px`}return e}},template:`\n\t\t<div class="ui-image-stack-steps-header" :style="getCustomStyles()">\n\t\t\t<component :is="getComponent()" v-bind="header.data"/>\n\t\t</div>\n\t`};const I={name:"ui-image-stack-steps-step-stack-status",components:{BIcon:i.BIcon},props:{status:{type:Object,required:true,validator:t=>S(t)}},computed:{icon(){switch(this.status.type){case l.OK:return"circle-check";case l.WAIT:return"black-clock";case l.CANCEL:return"cross-circle-60";default:return this.status.data.icon}},color(){switch(this.status.type){case l.OK:return"var(--ui-color-primary-alt)";case l.WAIT:return"var(--ui-color-palette-blue-60)";case l.CANCEL:return"var(--ui-color-base-35)";default:return this.status.data.color}}},template:`\n\t\t<div class="ui-image-stack-steps-step-stack-status">\n\t\t\t<BIcon\n\t\t\t\tv-if="icon"\n\t\t\t\t:name="icon" :color="color" :size="24"\n\t\t\t\tclass="ui-image-stack-steps-step-stack-status-icon"\n\t\t\t/>\n\t\t\t<div class="ui-image-stack-steps-step-stack-status-icon__overlay"></div>\n\t\t</div>\n\t`};const B={name:"ui-image-stack-steps-image",props:{src:{type:String,required:true,validator:t=>r.Type.isStringFilled(t)},title:{type:String,required:false,validator:t=>r.Type.isStringFilled(t)}},methods:{getSafeSrc(){return`url('${encodeURI(r.Text.encode(this.src))}')`}},template:`\n\t\t<div\n\t\t\t:style="{ backgroundImage: getSafeSrc()}"\n\t\t\tclass="ui-image-stack-steps-image"\n\t\t\t:title="title"\n\t\t></div>\n\t`};const U={name:"ui-image-stack-steps-image-stub",template:`\n\t\t<div class="ui-image-stack-steps-image --image-stub"></div>\n\t`};const x={name:"ui-image-stack-steps-user",props:{src:{type:String,required:true},userId:{type:Number,required:true,validator:t=>t>0}},data(){return{style:{backgroundImage:r.Type.isStringFilled(this.src)?this.getSafeSrc():""}}},methods:{getSafeSrc(){return`url('${encodeURI(r.Text.encode(this.src))}')`}},template:`\n\t\t<div \n\t\t\tclass="ui-image-stack-steps-image --user"\n\t\t\t:style="style"\n\t\t\t:bx-tooltip-user-id="userId"\n\t\t></div>\n\t`};const F={name:"ui-image-stack-steps-icon",components:{BIcon:i.BIcon},props:{icon:{type:String,required:true,validator:t=>r.Type.isStringFilled(t)},color:{type:String,required:true,validator:t=>r.Type.isStringFilled(t)}},template:`\n\t\t<div class="ui-image-stack-steps-image --icon">\n\t\t\t<BIcon :name="icon" :color="color" :size="24"/>\n\t\t</div>\n\t`};const w={name:"ui-image-stack-steps-user-stub",components:{Icon:F},template:`\n\t\t<Icon icon="person" color="var(--ui-color-base-15)"/>\n\t`};const E={name:"ui-image-stack-steps-counter",props:{text:{type:String,required:true,validator:t=>r.Type.isStringFilled(t)}},template:`\n\t\t<div class="ui-image-stack-steps-counter">{{ text }}</div>\n\t`};const O={name:"ui-image-stack-steps-step-stack",components:{StackStatus:I},props:{stack:{type:Object,required:true,validator:t=>f(t)}},computed:{hasStatus(){return r.Type.isPlainObject(this.stack.status)}},methods:{getComponent(t){switch(t.type){case p.IMAGE:return B;case p.USER:return x;case p.ICON:return F;case p.USER_STUB:return w;case p.COUNTER:return E;default:return U}},computeKey(t,e){let s="image-stub";switch(t.type){case p.IMAGE:s=t.data.src;break;case p.USER:s=String(t.data.userId);break;case p.ICON:s=`${t.data.icon}-${t.data.color}`;break;case p.USER_STUB:s="user-stub";break;case p.COUNTER:s="counter";break}return`${s}-${e}`}},template:`\n\t\t<div class="ui-image-stack-steps-step-stack">\n\t\t\t<StackStatus v-if="hasStatus" :status="stack.status"/>\n\t\t\t<template v-for="(image, index) in stack.images" :key="computeKey(image, index)">\n\t\t\t\t<component :is="getComponent(image)" v-bind="image.data"/>\n\t\t\t</template>\n\t\t</div>\n\t`};const D={name:"ui-image-stack-steps-duration",components:{Text:v},props:{duration:{type:Number,required:true,validator:t=>t>=0},realtime:{type:Boolean,required:true},realtimeBoundary:{type:Number,required:false},format:{type:[String,Array],required:false}},data(){return{defaultFormat:[["s","sdiff"],["i","idiff"],["H","Hdiff"],["d","ddiff"],["m","mdiff"],["Y","Ydiff"]],defaultRealtimeBoundary:60*60,computedDuration:0,startTime:Math.floor(Date.now()/1e3),timer:null}},watch:{duration(){this.computedDuration=0;this.startTime=Math.floor(Date.now()/1e3)},isRealtime(t){if(t){this.startTime=Math.floor(Date.now()/1e3);this.computedDuration=0;this.startTimer()}else{this.stopTimer()}}},computed:{text(){const t=this.isRealtime?this.duration+this.computedDuration:this.duration;return n.DateTimeFormat.format(this.getFormat(),0,t)},isRealtime(){return this.realtime}},mounted(){this.startTimer()},unmounted(){this.stopTimer()},methods:{startTimer(){if(!this.isRealtime){return}this.timer=setInterval((()=>{if(!this.isRealtime){this.stopTimer();return}if(this.duration+this.computedDuration<(this.realtimeBoundary||this.defaultRealtimeBoundary)){this.computedDuration=Math.floor(Date.now()/1e3)-this.startTime;return}this.stopTimer()}),1e3)},stopTimer(){if(this.timer){clearInterval(this.timer);this.timer=null}},getFormat(){if(r.Type.isArray(this.format)||r.Type.isString(this.format)){return this.format}return this.defaultFormat}},template:`\n\t\t<Text :text="text"/>\n\t`};const P={name:"ui-image-stack-steps-step-footer",props:{footer:{type:Object,required:true,validator:t=>r.Type.isPlainObject(t)}},methods:{getComponent(){switch(this.footer.type){case c.TEXT:return v;case c.DURATION:return D;default:return T}},getCustomStyles(){var t;const e={};if(r.Type.isNumber((t=this.footer.styles)==null?void 0:t.maxWidth)){e.maxWidth=`${this.footer.styles.maxWidth}px`}return e}},template:`\n\t\t<div class="ui-image-stack-steps-footer" :style="getCustomStyles()">\n\t\t\t<component :is="getComponent()" v-bind="footer.data"/>\n\t\t</div>\n\t`};const j={name:"ui-image-stack-steps-step",components:{ProgressBox:b,Header:k,Stack:O,Footer:P},props:{step:{type:Object,required:true,validator:t=>u(t)}},computed:{hasProgressBox(){return r.Type.isPlainObject(this.step.progressBox)},hasHeader(){return!r.Type.isNil(this.step.header)},hasFooter(){return!r.Type.isNil(this.step.footer)},getCustomStyles(){var t;const e={};if((t=this.step.styles)!=null&&t.minWidth){e.minWidth=`${r.Text.toInteger(this.step.styles.minWidth)}px`}return e}},template:`\n\t\t<div \n\t\t\tclass="ui-image-stack-steps-step"\n\t\t\t:class="{'--with-header': hasHeader, '--with-footer': hasFooter}"\n\t\t\t:style="getCustomStyles"\n\t\t>\n\t\t\t<ProgressBox v-if="hasProgressBox" :title="step.progressBox.title"/>\n\t\t\t<Header v-if="hasHeader" :header="step.header"/>\n\t\t\t<Stack :stack="step.stack"/>\n\t\t\t<Footer v-if="hasFooter" :footer="step.footer"/>\n\t\t</div>\n\t`};const H={name:"ui-image-stack-steps-application",components:{Step:j},props:{initialSteps:{type:Array,required:true,validator:t=>r.Type.isArrayFilled(t)}},data(){return{steps:this.initialSteps}},created(){this.subscribeOnEvents()},methods:{subscribeOnEvents(){if(this.$root.$app){s.EventEmitter.subscribe(this.$root.$app,"UI.ImageStackSteps.onUpdateSteps",(()=>{this.steps=this.$root.$app.getSteps()}))}}},template:`\n\t\t<div class="ui-image-stack-steps">\n\t\t\t<template v-for="step in steps" :key="step.id">\n\t\t\t\t<Step :step="step"/>\n\t\t\t</template>\n\t\t</div>\n\t`};var A=babelHelpers.classPrivateFieldLooseKey("steps");var C=babelHelpers.classPrivateFieldLooseKey("application");var N=babelHelpers.classPrivateFieldLooseKey("setSteps");var L=babelHelpers.classPrivateFieldLooseKey("initApplication");class R{constructor(t){Object.defineProperty(this,L,{value:$});Object.defineProperty(this,N,{value:q});Object.defineProperty(this,A,{writable:true,value:[]});Object.defineProperty(this,C,{writable:true,value:void 0});if(!r.Type.isArrayFilled(t.steps)){throw new TypeError("options.steps must be filled array")}babelHelpers.classPrivateFieldLooseBase(this,N)[N](t.steps);if(!r.Type.isArrayFilled(babelHelpers.classPrivateFieldLooseBase(this,A)[A])){throw new TypeError("options.steps must be contain correct steps data, see warnings")}babelHelpers.classPrivateFieldLooseBase(this,L)[L]()}renderTo(t){babelHelpers.classPrivateFieldLooseBase(this,C)[C].mount(t)}getSteps(){return babelHelpers.classPrivateFieldLooseBase(this,A)[A].map((t=>({...t})))}addStep(t){if(u(t)){babelHelpers.classPrivateFieldLooseBase(this,A)[A].push(t);s.EventEmitter.emit(this,"UI.ImageStackSteps.onUpdateSteps");return true}console.warn("UI.Image-Stack-Steps: Step was skipped due to incorrect stepData",t);return false}updateStep(t,e){const a=babelHelpers.classPrivateFieldLooseBase(this,A)[A].findIndex((t=>t.id===e));if(a===-1){console.warn(`UI.Image-Stack-Steps: Step with id ${e} not find`);return false}const i=babelHelpers.classPrivateFieldLooseBase(this,A)[A][a];const r=Object.assign(i,t);r.id=i.id;if(u(r)){babelHelpers.classPrivateFieldLooseBase(this,A)[A][a]=r;s.EventEmitter.emit(this,"UI.ImageStackSteps.onUpdateSteps");return true}console.warn("UI.Image-Stack-Steps: Step was not updated due to incorrect stepData",r);return false}deleteStep(t){const e=babelHelpers.classPrivateFieldLooseBase(this,A)[A].findIndex((e=>e.id===t));if(e===-1){return true}babelHelpers.classPrivateFieldLooseBase(this,A)[A].splice(e,1);s.EventEmitter.emit(this,"UI.ImageStackSteps.onUpdateSteps");return true}destroy(){babelHelpers.classPrivateFieldLooseBase(this,C)[C].unmount();babelHelpers.classPrivateFieldLooseBase(this,C)[C]=null;babelHelpers.classPrivateFieldLooseBase(this,A)[A]=null}}function q(t){babelHelpers.classPrivateFieldLooseBase(this,A)[A]=[];t.forEach((t=>{if(u(t)){babelHelpers.classPrivateFieldLooseBase(this,A)[A].push(t)}else{console.warn("UI.Image-Stack-Steps: Step was skipped due to incorrect stepData",t)}}))}function $(){const t=this;babelHelpers.classPrivateFieldLooseBase(this,C)[C]=e.BitrixVue.createApp({name:"ui-image-stack-steps",components:{Application:H},props:{steps:Array},created(){this.$app=t},template:`\n\t\t\t\t\t<Application\n\t\t\t\t\t\t:initialSteps="steps"\n\t\t\t\t\t></Application>\n\t\t\t\t`},{steps:babelHelpers.classPrivateFieldLooseBase(this,A)[A]})}t.headerTypeEnum=o;t.imageTypeEnum=p;t.footerTypeEnum=c;t.stackStatusEnum=l;t.ImageStackSteps=R})(this.BX.UI=this.BX.UI||{},BX.Vue3,BX.Event,BX.UI,BX.UI.IconSet,BX,BX.Main);
//# sourceMappingURL=image-stack-steps.bundle.map.js