%PDF- %PDF-
Direktori : /www/varak.net/nextcloud.varak.net/apps_old/apps/passwords/js/Static/ |
Current File : //www/varak.net/nextcloud.varak.net/apps_old/apps/passwords/js/Static/Form.ff60e377e3947dac5a65.js |
(self.webpackChunkncpasswords=self.webpackChunkncpasswords||[]).push([[1637],{61474:(t,e,a)=>{"use strict";a.r(e),a.d(e,{default:()=>l});const l={}},69928:(t,e,a)=>{"use strict";a.r(e),a.d(e,{default:()=>r});var l=function(){var t=this,e=t._self._c;return e("form",{staticClass:"passwords-form",attrs:{id:t.id,"data-form":t.name},on:{submit:function(e){return t.preventSubmit(e)}}},[t.message?e("translate",{staticClass:"message",attrs:{tag:"div",say:t.message}}):t._e(),t._v(" "),t._l(t.getFields,(function(a){return e("div",{staticClass:"field",class:{large:null!==a.button}},[e("translate",{attrs:{tag:"label",for:a.attributes.id,say:a.label}}),t._v(" "),"checkbox"===a.attributes.type?e("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.fields[a.name],expression:"fields[field.name]"}],attrs:{type:"checkbox"},domProps:{checked:Array.isArray(t.fields[a.name])?t._i(t.fields[a.name],null)>-1:t.fields[a.name]},on:{change:function(e){var l=t.fields[a.name],s=e.target,i=!!s.checked;if(Array.isArray(l)){var n=t._i(l,null);s.checked?n<0&&t.$set(t.fields,a.name,l.concat([null])):n>-1&&t.$set(t.fields,a.name,l.slice(0,n).concat(l.slice(n+1)))}else t.$set(t.fields,a.name,i)}}},"input",a.attributes,!1)):"radio"===a.attributes.type?e("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.fields[a.name],expression:"fields[field.name]"}],attrs:{type:"radio"},domProps:{checked:t._q(t.fields[a.name],null)},on:{change:function(e){return t.$set(t.fields,a.name,null)}}},"input",a.attributes,!1)):e("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.fields[a.name],expression:"fields[field.name]"}],attrs:{type:a.attributes.type},domProps:{value:t.fields[a.name]},on:{input:function(e){e.target.composing||t.$set(t.fields,a.name,e.target.value)}}},"input",a.attributes,!1)),t._v(" "),a.button?e("translate",{staticClass:"button",attrs:{tag:"a",icon:a.button.icon,title:a.button.title},on:{click:function(e){return t.executeButtonAction(a,e)}}}):t._e()],1)})),t._v(" "),e("input",{attrs:{type:"submit"}})],2)};l._withStripped=!0;var s=a(53024),i=a(80444);const n={components:{Translate:s.A},props:{id:{type:String},name:{type:String},message:{type:String|Array},form:{type:Object}},data:()=>({fields:{}}),computed:{getFields(){let t=[];for(let e in this.form){if(!this.form.hasOwnProperty(e))continue;let a=this.form[e],l=a.value?a.value:"",s=a.type?a.type:"text",n=this.resolveFieldButton(a),r=`password-field-${e}`,o=a.label?a.label:e.capitalize(),u=i.A.translateArray(a.title?a.title:a.label),d=!!a.required,c=!!a.checked,m=a.minlength?a.minlength:null,f=a.maxlength?a.maxlength:null,p=a.pattern?a.pattern:null,h=i.A.translateArray(a.placeholder?a.placeholder:a.label);this.fields[e]=l,"checkbox"!==s||a.hasOwnProperty("value")||(l=c),this.fields[e]=l,m&&!p&&(p=`.{${m},}`),t.push({name:e,label:o,button:n,attributes:{name:e,value:l,type:s,id:r,title:u,placeholder:h,required:d,checked:c,maxlength:f,pattern:p}})}return t}},methods:{preventSubmit(t){t.preventDefault()},getFormData(){let t=document.querySelectorAll(`#${this.id} input`),e=!1;for(let a=0;a<t.length;a++){let l=t[a],s=l.name,n=!1;if(s&&(l.setCustomValidity(""),l.checkValidity()||(e=!0,n=!0),!n&&this.form[s].validator&&!this.form[s].validator(this.fields[s],this.fields,l))){let t="Please correct your input";this.form[s].title&&(t=this.form[s].title),l.setCustomValidity(i.A.translate(t)),e=!0}}return e?(document.querySelector(`#${this.id} [type=submit]`).click(),!1):this.fields},executeButtonAction(t,e){let a=document.getElementById(t.attributes.id),l=t.button.action(t,a,e);void 0!==l&&(a.value=l,this.fields[t.name]=l)},resolveFieldButton(t){if(t.button){if("string"!=typeof t.button)return t.button;if("toggle"===t.button)return{icon:"eye",title:"Show value",action:this.toggleButtonAction}}return null},toggleButtonAction(t,e,a){let l="I"===a.target.tagName?a.target:a.target.getElementsByTagName("i")[0];l.classList.toggle("fa-eye-slash"),l.classList.toggle("fa-eye"),e.type="text"===e.type?"password":"text"}}};a(44773);const r=(0,a(14486).A)(n,l,[],!1,null,null,null).exports},44773:(t,e,a)=>{var l=a(61474);l.__esModule&&(l=l.default),"string"==typeof l&&(l=[[t.id,l,""]]),l.locals&&(t.exports=l.locals),(0,a(70534).A)("6030a5c6",l,!1,{})}}]);