@deskhero/dh_ui 1.44.0 → 1.44.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dh_ui.es.js CHANGED
@@ -43228,6 +43228,9 @@ const _sfc_main$1 = {
43228
43228
  class: Marker,
43229
43229
  shortcut: "CMD+SHIFT+H"
43230
43230
  },
43231
+ upload: {
43232
+ class: Upload
43233
+ },
43231
43234
  inlineCode: {
43232
43235
  class: InlineCode
43233
43236
  },
package/dist/dh_ui.umd.js CHANGED
@@ -370,4 +370,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
370
370
  `);var w=d(b.insertInto+" "+b.insertAt.before);x.insertBefore(g,w)}}function N(b){if(b.parentNode===null)return!1;b.parentNode.removeChild(b);var g=p.indexOf(b);g>=0&&p.splice(g,1)}function D(b){var g=document.createElement("style");return b.attrs.type===void 0&&(b.attrs.type="text/css"),I(g,b.attrs),h(b,g),g}function I(b,g){Object.keys(g).forEach(function(x){b.setAttribute(x,g[x])})}function m(b,g){var x,k,w,C;if(g.transform&&b.css){if(!(C=g.transform(b.css)))return function(){};b.css=C}if(g.singleton){var E=M++;x=f||(f=D(g)),k=A.bind(null,x,E,!1),w=A.bind(null,x,E,!0)}else b.sourceMap&&typeof URL=="function"&&typeof URL.createObjectURL=="function"&&typeof URL.revokeObjectURL=="function"&&typeof Blob=="function"&&typeof btoa=="function"?(x=function(O){var _=document.createElement("link");return O.attrs.type===void 0&&(O.attrs.type="text/css"),O.attrs.rel="stylesheet",I(_,O.attrs),h(O,_),_}(g),k=S.bind(null,x,g),w=function(){N(x),x.href&&URL.revokeObjectURL(x.href)}):(x=D(g),k=z.bind(null,x),w=function(){N(x)});return k(b),function(O){if(O){if(O.css===b.css&&O.media===b.media&&O.sourceMap===b.sourceMap)return;k(b=O)}else w()}}t.exports=function(b,g){if(typeof DEBUG!="undefined"&&DEBUG&&typeof document!="object")throw new Error("The style-loader cannot be used in a non-browser environment");(g=g||{}).attrs=typeof g.attrs=="object"?g.attrs:{},g.singleton||typeof g.singleton=="boolean"||(g.singleton=l()),g.insertInto||(g.insertInto="head"),g.insertAt||(g.insertAt="bottom");var x=v(b,g);return j(x,g),function(k){for(var w=[],C=0;C<x.length;C++){var E=x[C];(O=s[E.id]).refs--,w.push(O)}for(k&&j(v(k,g),g),C=0;C<w.length;C++){var O;if((O=w[C]).refs===0){for(var _=0;_<O.parts.length;_++)O.parts[_]();delete s[O.id]}}}};var T,L=(T=[],function(b,g){return T[b]=g,T.filter(Boolean).join(`
371
371
  `)});function A(b,g,x,k){var w=x?"":k.css;if(b.styleSheet)b.styleSheet.cssText=L(g,w);else{var C=document.createTextNode(w),E=b.childNodes;E[g]&&b.removeChild(E[g]),E.length?b.insertBefore(C,E[g]):b.appendChild(C)}}function z(b,g){var x=g.css,k=g.media;if(k&&b.setAttribute("media",k),b.styleSheet)b.styleSheet.cssText=x;else{for(;b.firstChild;)b.removeChild(b.firstChild);b.appendChild(document.createTextNode(x))}}function S(b,g,x){var k=x.css,w=x.sourceMap,C=g.convertToAbsoluteUrls===void 0&&w;(g.convertToAbsoluteUrls||C)&&(k=y(k)),w&&(k+=`
372
372
  /*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(w))))+" */");var E=new Blob([k],{type:"text/css"}),O=b.href;b.href=URL.createObjectURL(E),O&&URL.revokeObjectURL(O)}},function(t,o){t.exports=function(e){var i=typeof window!="undefined"&&window.location;if(!i)throw new Error("fixUrls requires window.location");if(!e||typeof e!="string")return e;var a=i.protocol+"//"+i.host,s=a+i.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(l,u){var d,f=u.trim().replace(/^"(.*)"$/,function(M,p){return p}).replace(/^'(.*)'$/,function(M,p){return p});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(f)?l:(d=f.indexOf("//")===0?f:f.indexOf("/")===0?a+f:s+f.replace(/^\.\//,""),"url("+JSON.stringify(d)+")")})}},function(t,o,e){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(i){var a=this;if(!document.documentElement.contains(a))return null;do{if(a.matches(i))return a;a=a.parentElement||a.parentNode}while(a!==null&&a.nodeType===1);return null})},function(t,o,e){e.r(o),e.d(o,"default",function(){return p}),e(0);function i(y){return function(j){if(Array.isArray(j))return a(j)}(y)||function(j){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(j))return Array.from(j)}(y)||function(j,v){if(!!j){if(typeof j=="string")return a(j,v);var h=Object.prototype.toString.call(j).slice(8,-1);if(h==="Object"&&j.constructor&&(h=j.constructor.name),h==="Map"||h==="Set")return Array.from(j);if(h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h))return a(j,v)}}(y)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
373
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function a(y,j){(j==null||j>y.length)&&(j=y.length);for(var v=0,h=new Array(j);v<j;v++)h[v]=y[v];return h}function s(){var y=document.activeElement,j=window.getSelection().getRangeAt(0),v=j.cloneRange();return v.selectNodeContents(y),v.setStart(j.endContainer,j.endOffset),v.extractContents()}function l(y){var j,v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},N=document.createElement(y);Array.isArray(v)?(j=N.classList).add.apply(j,i(v)):v&&N.classList.add(v);for(var D in h)N[D]=h[D];return N}function u(y){return y.innerHTML.replace("<br>"," ").trim()}function d(y){var j=arguments.length>1&&arguments[1]!==void 0&&arguments[1],v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,h=document.createRange(),N=window.getSelection();h.selectNodeContents(y),v!==void 0&&(h.setStart(y,v),h.setEnd(y,v)),h.collapse(j),N.removeAllRanges(),N.addRange(h)}e(5);function f(y,j){for(var v=0;v<j.length;v++){var h=j[v];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(y,h.key,h)}}function M(y,j,v){return j&&f(y.prototype,j),v&&f(y,v),y}var p=function(){function y(j){var v=j.data,h=(j.config,j.api),N=j.readOnly;(function(D,I){if(!(D instanceof I))throw new TypeError("Cannot call a class as a function")})(this,y),this._elements={wrapper:null,items:[]},this.readOnly=N,this.api=h,this.data=v||{}}return M(y,null,[{key:"isReadOnlySupported",get:function(){return!0}},{key:"enableLineBreaks",get:function(){return!0}},{key:"toolbox",get:function(){return{icon:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9.2 12L11.0586 13.8586C11.1367 13.9367 11.2633 13.9367 11.3414 13.8586L14.7 10.5"/><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/></svg>',title:"Checklist"}}},{key:"conversionConfig",get:function(){return{export:function(j){return j.items.map(function(v){return v.text}).join(". ")},import:function(j){return{items:[{text:j,checked:!1}]}}}}}]),M(y,[{key:"render",value:function(){var j=this;return this._elements.wrapper=l("div",[this.CSS.baseBlock,this.CSS.wrapper]),this.data.items||(this.data.items=[{text:"",checked:!1}]),this.data.items.forEach(function(v){var h=j.createChecklistItem(v);j._elements.wrapper.appendChild(h)}),this.readOnly||(this._elements.wrapper.addEventListener("keydown",function(v){switch(v.keyCode){case 13:j.enterPressed(v);break;case 8:j.backspace(v)}},!1),this._elements.wrapper.addEventListener("click",function(v){j.toggleCheckbox(v)})),this._elements.wrapper}},{key:"save",value:function(){var j=this,v=this.items.map(function(h){return{text:u(j.getItemInput(h)),checked:h.classList.contains(j.CSS.itemChecked)}});return{items:v=v.filter(function(h){return h.text.trim().length!==0})}}},{key:"validate",value:function(j){return!!j.items.length}},{key:"toggleCheckbox",value:function(j){var v=j.target.closest(".".concat(this.CSS.item));v.querySelector(".".concat(this.CSS.checkbox)).contains(j.target)&&v.classList.toggle(this.CSS.itemChecked)}},{key:"createChecklistItem",value:function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},v=l("div",this.CSS.item),h=l("span",this.CSS.checkbox),N=l("div",this.CSS.textField,{innerHTML:j.text?j.text:"",contentEditable:!this.readOnly});return j.checked&&v.classList.add(this.CSS.itemChecked),v.appendChild(h),v.appendChild(N),v}},{key:"enterPressed",value:function(j){j.preventDefault();var v=this.items,h=document.activeElement.closest(".".concat(this.CSS.item));if(v.indexOf(h)===v.length-1&&u(this.getItemInput(h)).length===0){var N=this.api.blocks.getCurrentBlockIndex();return h.remove(),this.api.blocks.insert(),void this.api.caret.setToBlock(N+1)}var D,I,m=s(),T=(D=m,(I=document.createElement("div")).appendChild(D),I.innerHTML),L=this.createChecklistItem({text:T,checked:!1});this._elements.wrapper.insertBefore(L,h.nextSibling),d(this.getItemInput(L),!0)}},{key:"backspace",value:function(j){var v=j.target.closest(".".concat(this.CSS.item)),h=this.items.indexOf(v),N=this.items[h-1];if(N&&window.getSelection().focusOffset===0){j.preventDefault();var D=s(),I=this.getItemInput(N),m=I.childNodes.length;I.appendChild(D),d(I,void 0,m),v.remove()}}},{key:"getItemInput",value:function(j){return j.querySelector(".".concat(this.CSS.textField))}},{key:"CSS",get:function(){return{baseBlock:this.api.styles.block,wrapper:"cdx-checklist",item:"cdx-checklist__item",itemChecked:"cdx-checklist__item--checked",checkbox:"cdx-checklist__item-checkbox",textField:"cdx-checklist__item-text"}}},{key:"items",get:function(){return Array.from(this._elements.wrapper.querySelectorAll(".".concat(this.CSS.item)))}}]),y}()}]).default})})(UM);var HA=Qt(UM.exports),Hw="";const FA={class:"file__upload"},GA=c.createElementVNode("label",{for:"upload_pdf"},[c.createTextVNode(" Drag and drop image file or "),c.createElementVNode("span",{id:"upload"},"browse")],-1),$A={key:1,class:"file__upload_items"},JA=["alt","src"],XA={__name:"ImageUpload",props:{uploadProgress:{type:Array,required:!0,default:()=>[100]},errorOccurred:{type:Array,required:!0,default:()=>[!1]},modelValue:{type:FileList,required:!1,default:void 0},errorMessage:{type:String,required:!1,default:"an error occurred while uploading"}},emits:["update:modelValue","save:modelValue","reload"],setup(r,{emit:n}){const t=r,o=c.ref(null),e=c.ref(!1),i=c.ref([]);function a(d){d.stopPropagation(),i.value=o.value.files,i.value&&(e.value=!0),n("update:modelValue",i.value)}function s(d){d.stopPropagation(),d.dataTransfer.dropEffect="copy"}function l(d){d.stopPropagation(),e.value=!0,i.value=d.dataTransfer.files,n("update:modelValue",i.value)}function u(d){return URL.createObjectURL(d)}return(d,f)=>(c.openBlock(),c.createElementBlock("div",FA,[e.value?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",{key:0,class:"file__upload_btn",onDragover:f[1]||(f[1]=c.withModifiers(M=>s(M),["prevent"])),onDrop:f[2]||(f[2]=c.withModifiers(M=>l(M),["prevent"]))},[c.createVNode(ke,{class:"file__upload_btn_icon","icon-name":"upload",size:24}),GA,c.createElementVNode("input",{id:"upload_pdf",ref_key:"upload",ref:o,multiple:"",name:"file",type:"file",onInput:f[0]||(f[0]=M=>a(M))},null,544)],32)),e.value?(c.openBlock(),c.createElementBlock("div",$A,[t.uploadProgress[0]==100&&!r.errorOccurred[0]?(c.openBlock(),c.createElementBlock("img",{key:0,alt:i.value[0].name,class:"file__upload_img",src:u(i.value[0])},null,8,JA)):c.createCommentVNode("",!0)])):c.createCommentVNode("",!0)]))}};var Fw="";const KA={class:"editor__wrapper"},qA={key:0,class:"editor__count"},ew=c.createTextVNode(" /300 "),tw={class:"editor__body"},nw={key:0,class:"editor__first"},rw={class:"editor__first_text"},ow={class:"editor__first_link",href:"https://deskhero.com",target:"_blank"},iw=c.createElementVNode("div",{id:"codex-editor"},null,-1),aw={__name:"TextEditor",props:{data:{type:Object,default:()=>({blocks:[]}),required:!1},readOnly:{type:Boolean,default:!0,required:!1},featureSet:{type:String,default:"Default",required:!1},firstBlock:{type:Boolean,default:!0,required:!1},firstBlockText:{type:String,default:"add your first block",required:!1},learnMoreText:{type:String,default:"Learn more about the text editor",required:!1},placeholder:{type:String,default:"Start typing...",required:!1},wordCount:{type:Boolean,default:!1,required:!1},minHeight:{type:Number,default:50,required:!1}},emits:["change"],setup(r,{emit:n}){const t=r,o=c.ref(!1),e=c.ref(0),i=c.ref(!1),a=c.ref({holder:"codex-editor",autofocus:!0,minHeight:0,defaultBlock:"paragraph",readOnly:t.readOnly,logLevel:"ERROR",onReady:()=>{o.value=!0},onChange:async(f,M)=>{if(M.type!=="block-changed"||!t.wordCount){const A=await f.saver.save();n("change",A.blocks);return}function p(A){return"text"in A.data}function y(A){return A.filter(p).reduce((z,S)=>(z+=S.data.text.length,z),0)}const j=300,v=await f.saver.save(),h=y(v.blocks);if(e.value=h,h<=j)return;const N=M.detail.target,D=M.detail.index,I=v.blocks.filter(A=>A.id===N.id).pop(),m=v.blocks.filter(A=>A.id!==N.id),T=y(m),L=j-T;f.blocks.update(N.id,{text:I.data.text.substr(0,L)}),f.caret.setToBlock(D,"end")}}),s=c.computed(()=>e.value>300);function l(){t.featureSet=="Full"?window.editor=new Zl({...a.value,data:t.data,minHeight:t.minHeight,tools:{paragraph:{class:Hl,config:{placeholder:t.placeholder}},header:{class:Wl},list:{class:CM},underline:{class:wM,shortcut:"CMD+SHIFT+U"},marker:{class:kM,shortcut:"CMD+SHIFT+H"},inlineCode:{class:RA},checklist:{class:HA},table:{class:VA},delimiter:{class:WA},code:{class:ZA}}}):t.featureSet=="Mail"?window.editor=new Zl({...a.value,data:t.data,minHeight:t.minHeight,tools:{paragraph:{class:Hl,config:{placeholder:t.placeholder}},header:{class:Wl}}}):window.editor=new Zl({...a.value,data:t.data,minHeight:t.minHeight,tools:{paragraph:{class:Hl,config:{placeholder:t.placeholder}},header:{class:Wl},list:{class:CM},underline:{class:wM,shortcut:"CMD+SHIFT+U"},marker:{class:kM,shortcut:"CMD+SHIFT+H"},upload:{class:d}}})}function u(){l(),i.value=!1}c.onMounted(()=>{t.firstBlock?l():i.value=!0});class d{static get isReadOnlySupported(){return!0}static get toolbox(){return{title:"Image upload",icon:'<svg width="15" height="16" viewBox="0 0 15 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 7.86105L8.00238 11.8587C7.44745 12.3993 6.70189 12.6997 5.92714 12.6946C5.15239 12.6896 4.4108 12.3796 3.86295 11.8317C3.31511 11.2839 3.0051 10.5423 3.00006 9.76755C2.99502 8.9928 3.29535 8.24724 3.83602 7.69231L7.95308 3.57525C8.3214 3.20693 8.82097 3 9.34186 3C9.86276 3 10.3623 3.20693 10.7306 3.57525C11.099 3.94358 11.3059 4.44314 11.3059 4.96404C11.3059 5.48494 11.099 5.9845 10.7306 6.35283L6.73233 10.3511C6.54817 10.5353 6.29839 10.6388 6.03794 10.6388C5.77749 10.6388 5.52771 10.5353 5.34355 10.3511C5.15938 10.167 5.05592 9.9172 5.05592 9.65675C5.05592 9.3963 5.15938 9.14652 5.34355 8.96236L9.22243 5.08348" stroke="black" stroke-width="0.5"/></svg>'}}constructor({data:M}){this.data=M,this.wrapper=void 0}render(){return this.wrapper=document.createElement("div"),this.data&&this.data.url?(this._createImage(this.data.url),this.wrapper):(c.createApp(XA,{data:function(){return this.data}}).mount(this.wrapper),this.wrapper)}_createImage(M){const p=document.createElement("img");p.classList.add("file__upload_img"),p.src=M,this.wrapper.innerHTML="",this.wrapper.appendChild(p)}save(M){return{url:M.querySelector("img").src}}}return(f,M)=>(c.openBlock(),c.createElementBlock("div",KA,[r.wordCount?(c.openBlock(),c.createElementBlock("div",qA,[c.createElementVNode("span",{class:c.normalizeClass(c.unref(s)?"editor__count--danger":"")},c.toDisplayString(e.value),3),ew])):c.createCommentVNode("",!0),c.createElementVNode("div",tw,[i.value?(c.openBlock(),c.createElementBlock("div",nw,[c.createElementVNode("button",{class:"editor__first_btn",onClick:u},"+"),c.createElementVNode("p",rw,c.toDisplayString(r.firstBlockText),1),c.createElementVNode("a",ow,c.toDisplayString(r.learnMoreText),1)])):c.createCommentVNode("",!0),iw])]))}};var Gw="";const sw={class:"code"},lw=["autocomplete"],uw=["autocomplete"],cw=["autocomplete"],dw=["autocomplete"],fw=["autocomplete"],Mw=["autocomplete"];var gw=st(c.defineComponent({__name:"VerificationCode",props:{code:{type:String,required:!1,default:""},focusOnFirstInput:{type:Boolean,default:!0},focusOnFirstInputDelay:{type:Number,default:100},autoComplete:{type:String,default:"off"}},emits:["submit"],setup(r,{emit:n}){const t=r,o=c.ref(null),e=c.ref(null),i=c.ref(null),a=c.ref(null),s=c.ref(null),l=c.ref(null);async function u(v){var h,N,D,I,m;switch(v){case 1:break;case 2:(h=o.value)==null||h.focus();break;case 3:(N=e.value)==null||N.focus();break;case 4:(D=i.value)==null||D.focus();break;case 5:(I=a.value)==null||I.focus();break;case 6:(m=s.value)==null||m.focus();break}}async function d(v){var h,N,D,I,m;switch(v){case 1:(h=e.value)==null||h.focus();break;case 2:(N=i.value)==null||N.focus();break;case 3:(D=a.value)==null||D.focus();break;case 4:(I=s.value)==null||I.focus();break;case 5:(m=l.value)==null||m.focus();break}}async function f(v,h){const N=v.key;let D=!0;[{_index:1,nextInput:e},{_index:2,nextInput:i},{_index:3,nextInput:a},{_index:4,nextInput:s},{_index:5,nextInput:l}].forEach(({_index:I,nextInput:m})=>{h===I&&(m.value&&N.match(/^[0-9]+$/)&&m.value.focus({}),D=!1),v.preventDefault()}),N.match(/^[0-9]+$/)&&(v.target.value=N),D&&y()}async function M(v){var N;const h=((N=v.clipboardData)==null?void 0:N.getData("text/plain"))||"";p(h),y()}function p(v){const h=v.replace(/\D/g,"");if(h.length!==6)return;const[N,D,I,m,T,L]=h.split("");o.value&&(o.value.value=N),e.value&&(e.value.value=D),i.value&&(i.value.value=I),a.value&&(a.value.value=m),s.value&&(s.value.value=T),l.value&&(l.value.value=L)}async function y(){var h,N,D,I,m,T;const v=`${(h=o.value)==null?void 0:h.value}${(N=e.value)==null?void 0:N.value}${(D=i.value)==null?void 0:D.value}${(I=a.value)==null?void 0:I.value}${(m=s.value)==null?void 0:m.value}${(T=l.value)==null?void 0:T.value}`;n("submit",v)}function j(){setTimeout(()=>{var v;t.focusOnFirstInput&&((v=o.value)==null||v.focus())},t.focusOnFirstInputDelay)}return c.onMounted(()=>{t.code&&(p(t.code),y()),j()}),(v,h)=>(c.openBlock(),c.createElementBlock("div",sw,[c.createElementVNode("input",{ref_key:"txtInput1",ref:o,autocomplete:r.autoComplete,autofocus:"",class:"form-input input-1","data-e2e":"input-1",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:h[0]||(h[0]=N=>f(N,1)),onKeyup:[h[1]||(h[1]=c.withKeys(N=>u(1),["delete"])),h[2]||(h[2]=c.withKeys(N=>u(1),["left"])),h[3]||(h[3]=c.withKeys(N=>d(1),["right"]))],onPaste:M},null,40,lw),c.createElementVNode("input",{ref_key:"txtInput2",ref:e,autocomplete:r.autoComplete,class:"form-input","data-e2e":"input-2",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:h[4]||(h[4]=N=>f(N,2)),onKeyup:[h[5]||(h[5]=c.withKeys(N=>u(2),["delete"])),h[6]||(h[6]=c.withKeys(N=>u(2),["left"])),h[7]||(h[7]=c.withKeys(N=>d(2),["right"]))],onPaste:M},null,40,uw),c.createElementVNode("input",{ref_key:"txtInput3",ref:i,autocomplete:r.autoComplete,class:"form-input","data-e2e":"input-3",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:h[8]||(h[8]=N=>f(N,3)),onKeyup:[h[9]||(h[9]=c.withKeys(N=>u(3),["delete"])),h[10]||(h[10]=c.withKeys(N=>u(3),["left"])),h[11]||(h[11]=c.withKeys(N=>d(3),["right"]))],onPaste:M},null,40,cw),c.createElementVNode("input",{ref_key:"txtInput4",ref:a,autocomplete:r.autoComplete,class:"form-input","data-e2e":"input-4",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:h[12]||(h[12]=N=>f(N,4)),onKeyup:[h[13]||(h[13]=c.withKeys(N=>u(4),["delete"])),h[14]||(h[14]=c.withKeys(N=>u(4),["left"])),h[15]||(h[15]=c.withKeys(N=>d(4),["right"]))],onPaste:M},null,40,dw),c.createElementVNode("input",{ref_key:"txtInput5",ref:s,autocomplete:r.autoComplete,class:"form-input","data-e2e":"input-5",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:h[16]||(h[16]=N=>f(N,5)),onKeyup:[h[17]||(h[17]=c.withKeys(N=>u(5),["delete"])),h[18]||(h[18]=c.withKeys(N=>u(5),["left"])),h[19]||(h[19]=c.withKeys(N=>d(5),["right"]))],onPaste:M},null,40,fw),c.createElementVNode("input",{ref_key:"txtInput6",ref:l,autocomplete:r.autoComplete,class:"form-input","data-e2e":"input-6",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:h[20]||(h[20]=N=>f(N,6)),onKeyup:[h[21]||(h[21]=c.withKeys(N=>u(6),["delete"])),h[22]||(h[22]=c.withKeys(N=>u(6),["left"])),h[23]||(h[23]=c.withKeys(N=>d(6),["right"]))],onPaste:M},null,40,Mw)]))}}),[["__scopeId","data-v-2ace876a"]]);Se.DhAdvancedDatePicker=kT,Se.DhAdvancedFilter=jM,Se.DhCopyText=ET,Se.DhDatePicker=UT,Se.DhDropdownMenu=VT,Se.DhError=WT,Se.DhExpansionPanel=JT,Se.DhFileUpload=gk,Se.DhIcon=ke,Se.DhInputDropdown=Ik,Se.DhInputGroup=vk,Se.DhInputList=dA,Se.DhModal=NA,Se.DhNotification=vA,Se.DhNumberRange=IM,Se.DhPasswordField=wA,Se.DhRadioBox=vM,Se.DhRadioBoxGroup=CA,Se.DhSearchInput=QA,Se.DhStepper=PA,Se.DhSwitch=pd,Se.DhTextEditor=aw,Se.DhTooltip=DM,Se.DhVerificationCode=gw,Object.defineProperties(Se,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
373
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function a(y,j){(j==null||j>y.length)&&(j=y.length);for(var v=0,h=new Array(j);v<j;v++)h[v]=y[v];return h}function s(){var y=document.activeElement,j=window.getSelection().getRangeAt(0),v=j.cloneRange();return v.selectNodeContents(y),v.setStart(j.endContainer,j.endOffset),v.extractContents()}function l(y){var j,v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},N=document.createElement(y);Array.isArray(v)?(j=N.classList).add.apply(j,i(v)):v&&N.classList.add(v);for(var D in h)N[D]=h[D];return N}function u(y){return y.innerHTML.replace("<br>"," ").trim()}function d(y){var j=arguments.length>1&&arguments[1]!==void 0&&arguments[1],v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,h=document.createRange(),N=window.getSelection();h.selectNodeContents(y),v!==void 0&&(h.setStart(y,v),h.setEnd(y,v)),h.collapse(j),N.removeAllRanges(),N.addRange(h)}e(5);function f(y,j){for(var v=0;v<j.length;v++){var h=j[v];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(y,h.key,h)}}function M(y,j,v){return j&&f(y.prototype,j),v&&f(y,v),y}var p=function(){function y(j){var v=j.data,h=(j.config,j.api),N=j.readOnly;(function(D,I){if(!(D instanceof I))throw new TypeError("Cannot call a class as a function")})(this,y),this._elements={wrapper:null,items:[]},this.readOnly=N,this.api=h,this.data=v||{}}return M(y,null,[{key:"isReadOnlySupported",get:function(){return!0}},{key:"enableLineBreaks",get:function(){return!0}},{key:"toolbox",get:function(){return{icon:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9.2 12L11.0586 13.8586C11.1367 13.9367 11.2633 13.9367 11.3414 13.8586L14.7 10.5"/><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/></svg>',title:"Checklist"}}},{key:"conversionConfig",get:function(){return{export:function(j){return j.items.map(function(v){return v.text}).join(". ")},import:function(j){return{items:[{text:j,checked:!1}]}}}}}]),M(y,[{key:"render",value:function(){var j=this;return this._elements.wrapper=l("div",[this.CSS.baseBlock,this.CSS.wrapper]),this.data.items||(this.data.items=[{text:"",checked:!1}]),this.data.items.forEach(function(v){var h=j.createChecklistItem(v);j._elements.wrapper.appendChild(h)}),this.readOnly||(this._elements.wrapper.addEventListener("keydown",function(v){switch(v.keyCode){case 13:j.enterPressed(v);break;case 8:j.backspace(v)}},!1),this._elements.wrapper.addEventListener("click",function(v){j.toggleCheckbox(v)})),this._elements.wrapper}},{key:"save",value:function(){var j=this,v=this.items.map(function(h){return{text:u(j.getItemInput(h)),checked:h.classList.contains(j.CSS.itemChecked)}});return{items:v=v.filter(function(h){return h.text.trim().length!==0})}}},{key:"validate",value:function(j){return!!j.items.length}},{key:"toggleCheckbox",value:function(j){var v=j.target.closest(".".concat(this.CSS.item));v.querySelector(".".concat(this.CSS.checkbox)).contains(j.target)&&v.classList.toggle(this.CSS.itemChecked)}},{key:"createChecklistItem",value:function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},v=l("div",this.CSS.item),h=l("span",this.CSS.checkbox),N=l("div",this.CSS.textField,{innerHTML:j.text?j.text:"",contentEditable:!this.readOnly});return j.checked&&v.classList.add(this.CSS.itemChecked),v.appendChild(h),v.appendChild(N),v}},{key:"enterPressed",value:function(j){j.preventDefault();var v=this.items,h=document.activeElement.closest(".".concat(this.CSS.item));if(v.indexOf(h)===v.length-1&&u(this.getItemInput(h)).length===0){var N=this.api.blocks.getCurrentBlockIndex();return h.remove(),this.api.blocks.insert(),void this.api.caret.setToBlock(N+1)}var D,I,m=s(),T=(D=m,(I=document.createElement("div")).appendChild(D),I.innerHTML),L=this.createChecklistItem({text:T,checked:!1});this._elements.wrapper.insertBefore(L,h.nextSibling),d(this.getItemInput(L),!0)}},{key:"backspace",value:function(j){var v=j.target.closest(".".concat(this.CSS.item)),h=this.items.indexOf(v),N=this.items[h-1];if(N&&window.getSelection().focusOffset===0){j.preventDefault();var D=s(),I=this.getItemInput(N),m=I.childNodes.length;I.appendChild(D),d(I,void 0,m),v.remove()}}},{key:"getItemInput",value:function(j){return j.querySelector(".".concat(this.CSS.textField))}},{key:"CSS",get:function(){return{baseBlock:this.api.styles.block,wrapper:"cdx-checklist",item:"cdx-checklist__item",itemChecked:"cdx-checklist__item--checked",checkbox:"cdx-checklist__item-checkbox",textField:"cdx-checklist__item-text"}}},{key:"items",get:function(){return Array.from(this._elements.wrapper.querySelectorAll(".".concat(this.CSS.item)))}}]),y}()}]).default})})(UM);var HA=Qt(UM.exports),Hw="";const FA={class:"file__upload"},GA=c.createElementVNode("label",{for:"upload_pdf"},[c.createTextVNode(" Drag and drop image file or "),c.createElementVNode("span",{id:"upload"},"browse")],-1),$A={key:1,class:"file__upload_items"},JA=["alt","src"],XA={__name:"ImageUpload",props:{uploadProgress:{type:Array,required:!0,default:()=>[100]},errorOccurred:{type:Array,required:!0,default:()=>[!1]},modelValue:{type:FileList,required:!1,default:void 0},errorMessage:{type:String,required:!1,default:"an error occurred while uploading"}},emits:["update:modelValue","save:modelValue","reload"],setup(r,{emit:n}){const t=r,o=c.ref(null),e=c.ref(!1),i=c.ref([]);function a(d){d.stopPropagation(),i.value=o.value.files,i.value&&(e.value=!0),n("update:modelValue",i.value)}function s(d){d.stopPropagation(),d.dataTransfer.dropEffect="copy"}function l(d){d.stopPropagation(),e.value=!0,i.value=d.dataTransfer.files,n("update:modelValue",i.value)}function u(d){return URL.createObjectURL(d)}return(d,f)=>(c.openBlock(),c.createElementBlock("div",FA,[e.value?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",{key:0,class:"file__upload_btn",onDragover:f[1]||(f[1]=c.withModifiers(M=>s(M),["prevent"])),onDrop:f[2]||(f[2]=c.withModifiers(M=>l(M),["prevent"]))},[c.createVNode(ke,{class:"file__upload_btn_icon","icon-name":"upload",size:24}),GA,c.createElementVNode("input",{id:"upload_pdf",ref_key:"upload",ref:o,multiple:"",name:"file",type:"file",onInput:f[0]||(f[0]=M=>a(M))},null,544)],32)),e.value?(c.openBlock(),c.createElementBlock("div",$A,[t.uploadProgress[0]==100&&!r.errorOccurred[0]?(c.openBlock(),c.createElementBlock("img",{key:0,alt:i.value[0].name,class:"file__upload_img",src:u(i.value[0])},null,8,JA)):c.createCommentVNode("",!0)])):c.createCommentVNode("",!0)]))}};var Fw="";const KA={class:"editor__wrapper"},qA={key:0,class:"editor__count"},ew=c.createTextVNode(" /300 "),tw={class:"editor__body"},nw={key:0,class:"editor__first"},rw={class:"editor__first_text"},ow={class:"editor__first_link",href:"https://deskhero.com",target:"_blank"},iw=c.createElementVNode("div",{id:"codex-editor"},null,-1),aw={__name:"TextEditor",props:{data:{type:Object,default:()=>({blocks:[]}),required:!1},readOnly:{type:Boolean,default:!0,required:!1},featureSet:{type:String,default:"Default",required:!1},firstBlock:{type:Boolean,default:!0,required:!1},firstBlockText:{type:String,default:"add your first block",required:!1},learnMoreText:{type:String,default:"Learn more about the text editor",required:!1},placeholder:{type:String,default:"Start typing...",required:!1},wordCount:{type:Boolean,default:!1,required:!1},minHeight:{type:Number,default:50,required:!1}},emits:["change"],setup(r,{emit:n}){const t=r,o=c.ref(!1),e=c.ref(0),i=c.ref(!1),a=c.ref({holder:"codex-editor",autofocus:!0,minHeight:0,defaultBlock:"paragraph",readOnly:t.readOnly,logLevel:"ERROR",onReady:()=>{o.value=!0},onChange:async(f,M)=>{if(M.type!=="block-changed"||!t.wordCount){const A=await f.saver.save();n("change",A.blocks);return}function p(A){return"text"in A.data}function y(A){return A.filter(p).reduce((z,S)=>(z+=S.data.text.length,z),0)}const j=300,v=await f.saver.save(),h=y(v.blocks);if(e.value=h,h<=j)return;const N=M.detail.target,D=M.detail.index,I=v.blocks.filter(A=>A.id===N.id).pop(),m=v.blocks.filter(A=>A.id!==N.id),T=y(m),L=j-T;f.blocks.update(N.id,{text:I.data.text.substr(0,L)}),f.caret.setToBlock(D,"end")}}),s=c.computed(()=>e.value>300);function l(){t.featureSet=="Full"?window.editor=new Zl({...a.value,data:t.data,minHeight:t.minHeight,tools:{paragraph:{class:Hl,config:{placeholder:t.placeholder}},header:{class:Wl},list:{class:CM},underline:{class:wM,shortcut:"CMD+SHIFT+U"},marker:{class:kM,shortcut:"CMD+SHIFT+H"},upload:{class:d},inlineCode:{class:RA},checklist:{class:HA},table:{class:VA},delimiter:{class:WA},code:{class:ZA}}}):t.featureSet=="Mail"?window.editor=new Zl({...a.value,data:t.data,minHeight:t.minHeight,tools:{paragraph:{class:Hl,config:{placeholder:t.placeholder}},header:{class:Wl}}}):window.editor=new Zl({...a.value,data:t.data,minHeight:t.minHeight,tools:{paragraph:{class:Hl,config:{placeholder:t.placeholder}},header:{class:Wl},list:{class:CM},underline:{class:wM,shortcut:"CMD+SHIFT+U"},marker:{class:kM,shortcut:"CMD+SHIFT+H"},upload:{class:d}}})}function u(){l(),i.value=!1}c.onMounted(()=>{t.firstBlock?l():i.value=!0});class d{static get isReadOnlySupported(){return!0}static get toolbox(){return{title:"Image upload",icon:'<svg width="15" height="16" viewBox="0 0 15 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 7.86105L8.00238 11.8587C7.44745 12.3993 6.70189 12.6997 5.92714 12.6946C5.15239 12.6896 4.4108 12.3796 3.86295 11.8317C3.31511 11.2839 3.0051 10.5423 3.00006 9.76755C2.99502 8.9928 3.29535 8.24724 3.83602 7.69231L7.95308 3.57525C8.3214 3.20693 8.82097 3 9.34186 3C9.86276 3 10.3623 3.20693 10.7306 3.57525C11.099 3.94358 11.3059 4.44314 11.3059 4.96404C11.3059 5.48494 11.099 5.9845 10.7306 6.35283L6.73233 10.3511C6.54817 10.5353 6.29839 10.6388 6.03794 10.6388C5.77749 10.6388 5.52771 10.5353 5.34355 10.3511C5.15938 10.167 5.05592 9.9172 5.05592 9.65675C5.05592 9.3963 5.15938 9.14652 5.34355 8.96236L9.22243 5.08348" stroke="black" stroke-width="0.5"/></svg>'}}constructor({data:M}){this.data=M,this.wrapper=void 0}render(){return this.wrapper=document.createElement("div"),this.data&&this.data.url?(this._createImage(this.data.url),this.wrapper):(c.createApp(XA,{data:function(){return this.data}}).mount(this.wrapper),this.wrapper)}_createImage(M){const p=document.createElement("img");p.classList.add("file__upload_img"),p.src=M,this.wrapper.innerHTML="",this.wrapper.appendChild(p)}save(M){return{url:M.querySelector("img").src}}}return(f,M)=>(c.openBlock(),c.createElementBlock("div",KA,[r.wordCount?(c.openBlock(),c.createElementBlock("div",qA,[c.createElementVNode("span",{class:c.normalizeClass(c.unref(s)?"editor__count--danger":"")},c.toDisplayString(e.value),3),ew])):c.createCommentVNode("",!0),c.createElementVNode("div",tw,[i.value?(c.openBlock(),c.createElementBlock("div",nw,[c.createElementVNode("button",{class:"editor__first_btn",onClick:u},"+"),c.createElementVNode("p",rw,c.toDisplayString(r.firstBlockText),1),c.createElementVNode("a",ow,c.toDisplayString(r.learnMoreText),1)])):c.createCommentVNode("",!0),iw])]))}};var Gw="";const sw={class:"code"},lw=["autocomplete"],uw=["autocomplete"],cw=["autocomplete"],dw=["autocomplete"],fw=["autocomplete"],Mw=["autocomplete"];var gw=st(c.defineComponent({__name:"VerificationCode",props:{code:{type:String,required:!1,default:""},focusOnFirstInput:{type:Boolean,default:!0},focusOnFirstInputDelay:{type:Number,default:100},autoComplete:{type:String,default:"off"}},emits:["submit"],setup(r,{emit:n}){const t=r,o=c.ref(null),e=c.ref(null),i=c.ref(null),a=c.ref(null),s=c.ref(null),l=c.ref(null);async function u(v){var h,N,D,I,m;switch(v){case 1:break;case 2:(h=o.value)==null||h.focus();break;case 3:(N=e.value)==null||N.focus();break;case 4:(D=i.value)==null||D.focus();break;case 5:(I=a.value)==null||I.focus();break;case 6:(m=s.value)==null||m.focus();break}}async function d(v){var h,N,D,I,m;switch(v){case 1:(h=e.value)==null||h.focus();break;case 2:(N=i.value)==null||N.focus();break;case 3:(D=a.value)==null||D.focus();break;case 4:(I=s.value)==null||I.focus();break;case 5:(m=l.value)==null||m.focus();break}}async function f(v,h){const N=v.key;let D=!0;[{_index:1,nextInput:e},{_index:2,nextInput:i},{_index:3,nextInput:a},{_index:4,nextInput:s},{_index:5,nextInput:l}].forEach(({_index:I,nextInput:m})=>{h===I&&(m.value&&N.match(/^[0-9]+$/)&&m.value.focus({}),D=!1),v.preventDefault()}),N.match(/^[0-9]+$/)&&(v.target.value=N),D&&y()}async function M(v){var N;const h=((N=v.clipboardData)==null?void 0:N.getData("text/plain"))||"";p(h),y()}function p(v){const h=v.replace(/\D/g,"");if(h.length!==6)return;const[N,D,I,m,T,L]=h.split("");o.value&&(o.value.value=N),e.value&&(e.value.value=D),i.value&&(i.value.value=I),a.value&&(a.value.value=m),s.value&&(s.value.value=T),l.value&&(l.value.value=L)}async function y(){var h,N,D,I,m,T;const v=`${(h=o.value)==null?void 0:h.value}${(N=e.value)==null?void 0:N.value}${(D=i.value)==null?void 0:D.value}${(I=a.value)==null?void 0:I.value}${(m=s.value)==null?void 0:m.value}${(T=l.value)==null?void 0:T.value}`;n("submit",v)}function j(){setTimeout(()=>{var v;t.focusOnFirstInput&&((v=o.value)==null||v.focus())},t.focusOnFirstInputDelay)}return c.onMounted(()=>{t.code&&(p(t.code),y()),j()}),(v,h)=>(c.openBlock(),c.createElementBlock("div",sw,[c.createElementVNode("input",{ref_key:"txtInput1",ref:o,autocomplete:r.autoComplete,autofocus:"",class:"form-input input-1","data-e2e":"input-1",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:h[0]||(h[0]=N=>f(N,1)),onKeyup:[h[1]||(h[1]=c.withKeys(N=>u(1),["delete"])),h[2]||(h[2]=c.withKeys(N=>u(1),["left"])),h[3]||(h[3]=c.withKeys(N=>d(1),["right"]))],onPaste:M},null,40,lw),c.createElementVNode("input",{ref_key:"txtInput2",ref:e,autocomplete:r.autoComplete,class:"form-input","data-e2e":"input-2",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:h[4]||(h[4]=N=>f(N,2)),onKeyup:[h[5]||(h[5]=c.withKeys(N=>u(2),["delete"])),h[6]||(h[6]=c.withKeys(N=>u(2),["left"])),h[7]||(h[7]=c.withKeys(N=>d(2),["right"]))],onPaste:M},null,40,uw),c.createElementVNode("input",{ref_key:"txtInput3",ref:i,autocomplete:r.autoComplete,class:"form-input","data-e2e":"input-3",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:h[8]||(h[8]=N=>f(N,3)),onKeyup:[h[9]||(h[9]=c.withKeys(N=>u(3),["delete"])),h[10]||(h[10]=c.withKeys(N=>u(3),["left"])),h[11]||(h[11]=c.withKeys(N=>d(3),["right"]))],onPaste:M},null,40,cw),c.createElementVNode("input",{ref_key:"txtInput4",ref:a,autocomplete:r.autoComplete,class:"form-input","data-e2e":"input-4",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:h[12]||(h[12]=N=>f(N,4)),onKeyup:[h[13]||(h[13]=c.withKeys(N=>u(4),["delete"])),h[14]||(h[14]=c.withKeys(N=>u(4),["left"])),h[15]||(h[15]=c.withKeys(N=>d(4),["right"]))],onPaste:M},null,40,dw),c.createElementVNode("input",{ref_key:"txtInput5",ref:s,autocomplete:r.autoComplete,class:"form-input","data-e2e":"input-5",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:h[16]||(h[16]=N=>f(N,5)),onKeyup:[h[17]||(h[17]=c.withKeys(N=>u(5),["delete"])),h[18]||(h[18]=c.withKeys(N=>u(5),["left"])),h[19]||(h[19]=c.withKeys(N=>d(5),["right"]))],onPaste:M},null,40,fw),c.createElementVNode("input",{ref_key:"txtInput6",ref:l,autocomplete:r.autoComplete,class:"form-input","data-e2e":"input-6",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:h[20]||(h[20]=N=>f(N,6)),onKeyup:[h[21]||(h[21]=c.withKeys(N=>u(6),["delete"])),h[22]||(h[22]=c.withKeys(N=>u(6),["left"])),h[23]||(h[23]=c.withKeys(N=>d(6),["right"]))],onPaste:M},null,40,Mw)]))}}),[["__scopeId","data-v-2ace876a"]]);Se.DhAdvancedDatePicker=kT,Se.DhAdvancedFilter=jM,Se.DhCopyText=ET,Se.DhDatePicker=UT,Se.DhDropdownMenu=VT,Se.DhError=WT,Se.DhExpansionPanel=JT,Se.DhFileUpload=gk,Se.DhIcon=ke,Se.DhInputDropdown=Ik,Se.DhInputGroup=vk,Se.DhInputList=dA,Se.DhModal=NA,Se.DhNotification=vA,Se.DhNumberRange=IM,Se.DhPasswordField=wA,Se.DhRadioBox=vM,Se.DhRadioBoxGroup=CA,Se.DhSearchInput=QA,Se.DhStepper=PA,Se.DhSwitch=pd,Se.DhTextEditor=aw,Se.DhTooltip=DM,Se.DhVerificationCode=gw,Object.defineProperties(Se,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deskhero/dh_ui",
3
- "version": "1.44.0",
3
+ "version": "1.44.1",
4
4
  "files": [
5
5
  "dist"
6
6
  ],