diff options
Diffstat (limited to 'dist/settings-declarative-settings-forms.js')
-rw-r--r-- | dist/settings-declarative-settings-forms.js | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/dist/settings-declarative-settings-forms.js b/dist/settings-declarative-settings-forms.js new file mode 100644 index 00000000000..11418dc983d --- /dev/null +++ b/dist/settings-declarative-settings-forms.js @@ -0,0 +1,2 @@ +(()=>{"use strict";var e,a,r,i={27565:(e,a,r)=>{var i=r(85471),l=r(38613),o=r(53334),n=r(26287),d=r(99498),s=r(85168),c=r(17334),p=r.n(c),u=r(88837),f=r(44492),v=r(67607),m=r(32073),h=r(96763);const A={name:"DeclarativeSection",components:{NcSettingsSection:u.A,NcInputField:f.A,NcSelect:v.A,NcCheckboxRadioSwitch:m.A},props:{form:{type:Object,required:!0}},data:()=>({formFieldsData:{}}),beforeMount(){this.initFormFieldsData()},computed:{formApp(){return this.form.app||""},formFields(){return this.form.fields||[]}},methods:{initFormFieldsData(){this.form.fields.forEach((e=>{"checkbox"===e.type&&this.$set(e,"value",+e.value),"multi-checkbox"===e.type&&(""===e.value?(this.$set(e,"value",{}),e.options.forEach((t=>{this.$set(e.value,t.value,!1)}))):(this.$set(e,"value",JSON.parse(e.value)),e.options.forEach((t=>{e.value.hasOwnProperty(t.value)||this.$set(e.value,t.value,!1)})),Object.keys(e.value).forEach((t=>{e.options.find((e=>e.value===t))||delete e.value[t]})))),"multi-select"===e.type&&(""===e.value?this.$set(e,"value",[]):this.$set(e,"value",JSON.parse(e.value))),this.$set(this.formFieldsData,e.id,{value:e.value})}))},updateFormFieldDataValue(e,t){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.formFieldsData[t.id].value=e,a&&this.updateDeclarativeSettingsValue(t)},updateDeclarativeSettingsValue(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;try{return n.A.post((0,d.KT)("settings/api/declarative/value"),{app:this.formApp,formId:this.form.id.replace(this.formApp+"_",""),fieldId:e.id,value:null===a?this.formFieldsData[e.id].value:a})}catch(e){h.debug(e),(0,s.Qg)(t("settings","Failed to save setting"))}},onChangeDebounced:p()((function(e){this.updateDeclarativeSettingsValue(e)}),1e3),isTextFormField:e=>["text","password","email","tel","url","number"].includes(e.type)}};var b=r(85072),_=r.n(b),g=r(97825),C=r.n(g),y=r(77659),x=r.n(y),k=r(55056),D=r.n(k),F=r(10540),w=r.n(F),S=r(41113),O=r.n(S),N=r(46613),E={};E.styleTagTransform=O(),E.setAttributes=D(),E.insert=x().bind(null,"head"),E.domAPI=C(),E.insertStyleElement=w(),_()(N.A,E),N.A&&N.A.locals&&N.A.locals;const T=(0,r(14486).A)(A,(function(){var e=this,t=e._self._c;return t("NcSettingsSection",{staticClass:"declarative-settings-section",attrs:{name:e.t(e.formApp,e.form.title),description:e.t(e.formApp,e.form.description),"doc-url":e.form.doc_url||""}},e._l(e.formFields,(function(a){return t("div",{key:a.id,staticClass:"declarative-form-field",class:{"declarative-form-field-text":e.isTextFormField(a),"declarative-form-field-select":"select"===a.type,"declarative-form-field-multi-select":"multi-select"===a.type,"declarative-form-field-checkbox":"checkbox"===a.type,"declarative-form-field-multi_checkbox":"multi-checkbox"===a.type,"declarative-form-field-radio":"radio"===a.type},attrs:{"aria-label":e.t("settings","{app}'s declarative setting field: {name}",{app:e.formApp,name:e.t(e.formApp,a.title)})}},[e.isTextFormField(a)?[t("div",{staticClass:"input-wrapper"},[t("NcInputField",{attrs:{type:a.type,label:e.t(e.formApp,a.title),value:e.formFieldsData[a.id].value,placeholder:e.t(e.formApp,a.placeholder)},on:{"update:value":[function(t){return e.$set(e.formFieldsData[a.id],"value",t)},function(t){return e.onChangeDebounced(a)}],submit:function(t){return e.updateDeclarativeSettingsValue(a)}}})],1),e._v(" "),t("span",{staticClass:"hint"},[e._v(e._s(e.t(e.formApp,a.description)))])]:e._e(),e._v(" "),"select"===a.type?[t("label",{attrs:{for:a.id+"_field"}},[e._v(e._s(e.t(e.formApp,a.title)))]),e._v(" "),t("div",{staticClass:"input-wrapper"},[t("NcSelect",{attrs:{id:a.id+"_field",options:a.options,placeholder:e.t(e.formApp,a.placeholder),"label-outside":!0,value:e.formFieldsData[a.id].value},on:{input:t=>e.updateFormFieldDataValue(t,a,!0)}})],1),e._v(" "),t("span",{staticClass:"hint"},[e._v(e._s(e.t(e.formApp,a.description)))])]:e._e(),e._v(" "),"multi-select"===a.type?[t("label",{attrs:{for:a.id+"_field"}},[e._v(e._s(e.t(e.formApp,a.title)))]),e._v(" "),t("div",{staticClass:"input-wrapper"},[t("NcSelect",{attrs:{id:a.id+"_field",options:a.options,placeholder:e.t(e.formApp,a.placeholder),multiple:!0,"label-outside":!0,value:e.formFieldsData[a.id].value},on:{input:t=>{e.formFieldsData[a.id].value=t,e.updateDeclarativeSettingsValue(a,JSON.stringify(e.formFieldsData[a.id].value))}}})],1),e._v(" "),t("span",{staticClass:"hint"},[e._v(e._s(e.t(e.formApp,a.description)))])]:e._e(),e._v(" "),"checkbox"===a.type?[t("label",{attrs:{for:a.id+"_field"}},[e._v(e._s(e.t(e.formApp,a.title)))]),e._v(" "),t("NcCheckboxRadioSwitch",{attrs:{id:a.id+"_field",checked:Boolean(e.formFieldsData[a.id].value)},on:{"update:checked":t=>{a.value=t,e.updateFormFieldDataValue(+t,a,!0)}}},[e._v("\n\t\t\t\t"+e._s(e.t(e.formApp,a.label))+"\n\t\t\t")]),e._v(" "),t("span",{staticClass:"hint"},[e._v(e._s(e.t(e.formApp,a.description)))])]:e._e(),e._v(" "),"multi-checkbox"===a.type?[t("label",{attrs:{for:a.id+"_field"}},[e._v(e._s(e.t(e.formApp,a.title)))]),e._v(" "),e._l(a.options,(function(r){return t("NcCheckboxRadioSwitch",{key:r.value,attrs:{id:a.id+"_field_"+r.value,checked:e.formFieldsData[a.id].value[r.value]},on:{"update:checked":t=>{e.formFieldsData[a.id].value[r.value]=t,e.updateDeclarativeSettingsValue(a,JSON.stringify(e.formFieldsData[a.id].value))}}},[e._v("\n\t\t\t\t"+e._s(e.t(e.formApp,r.name))+"\n\t\t\t")])})),e._v(" "),t("span",{staticClass:"hint"},[e._v(e._s(e.t(e.formApp,a.description)))])]:e._e(),e._v(" "),"radio"===a.type?[t("label",{attrs:{for:a.id+"_field"}},[e._v(e._s(e.t(e.formApp,a.title)))]),e._v(" "),e._l(a.options,(function(r){return t("NcCheckboxRadioSwitch",{key:r.value,attrs:{value:r.value,type:"radio",checked:e.formFieldsData[a.id].value},on:{"update:checked":t=>e.updateFormFieldDataValue(t,a,!0)}},[e._v("\n\t\t\t\t"+e._s(e.t(e.formApp,r.name))+"\n\t\t\t")])})),e._v(" "),t("span",{staticClass:"hint"},[e._v(e._s(e.t(e.formApp,a.description)))])]:e._e()],2)})),0)}),[],!1,null,"49d8d244",null).exports;var j=r(96763);const $=(0,l.C)("settings","declarative-settings-forms",[]);j.debug("Loaded declarative forms:",$),document.addEventListener("DOMContentLoaded",(()=>{!function(e){i.Ay.mixin({methods:{t:o.Tl,n:o.zw}});const t=i.Ay.extend(T);for(const a of e)new t({el:"#".concat(a.app,"_").concat(a.id),propsData:{form:a}})}($)}))},46613:(e,t,a)=>{a.d(t,{A:()=>n});var r=a(71354),i=a.n(r),l=a(76314),o=a.n(l)()(i());o.push([e.id,".declarative-form-field[data-v-49d8d244]{margin:20px 0;padding:10px 0}.declarative-form-field .input-wrapper[data-v-49d8d244]{width:100%;max-width:400px}.declarative-form-field[data-v-49d8d244]:last-child{border-bottom:none}.declarative-form-field .hint[data-v-49d8d244]{display:inline-block;color:var(--color-text-maxcontrast);margin-left:8px;padding-top:5px}.declarative-form-field-radio[data-v-49d8d244],.declarative-form-field-multi_checkbox[data-v-49d8d244]{max-height:250px;overflow-y:auto}.declarative-form-field-multi-select[data-v-49d8d244],.declarative-form-field-select[data-v-49d8d244]{display:flex;flex-direction:column}.declarative-form-field-multi-select label[data-v-49d8d244],.declarative-form-field-select label[data-v-49d8d244]{margin-bottom:5px}","",{version:3,sources:["webpack://./apps/settings/src/components/DeclarativeSettings/DeclarativeSection.vue"],names:[],mappings:"AACA,yCACC,aAAA,CACA,cAAA,CAEA,wDACC,UAAA,CACA,eAAA,CAGD,oDACC,kBAAA,CAGD,+CACC,oBAAA,CACA,mCAAA,CACA,eAAA,CACA,eAAA,CAGD,uGACC,gBAAA,CACA,eAAA,CAGD,sGACC,YAAA,CACA,qBAAA,CAEA,kHACC,iBAAA",sourcesContent:["\r\n.declarative-form-field {\r\n\tmargin: 20px 0;\r\n\tpadding: 10px 0;\r\n\r\n\t.input-wrapper {\r\n\t\twidth: 100%;\r\n\t\tmax-width: 400px;\r\n\t}\r\n\r\n\t&:last-child {\r\n\t\tborder-bottom: none;\r\n\t}\r\n\r\n\t.hint {\r\n\t\tdisplay: inline-block;\r\n\t\tcolor: var(--color-text-maxcontrast);\r\n\t\tmargin-left: 8px;\r\n\t\tpadding-top: 5px;\r\n\t}\r\n\r\n\t&-radio, &-multi_checkbox {\r\n\t\tmax-height: 250px;\r\n\t\toverflow-y: auto;\r\n\t}\r\n\r\n\t&-multi-select, &-select {\r\n\t\tdisplay: flex;\r\n\t\tflex-direction: column;\r\n\r\n\t\tlabel {\r\n\t\t\tmargin-bottom: 5px;\r\n\t\t}\r\n\t}\r\n}\r\n"],sourceRoot:""}]);const n=o}},l={};function o(e){var t=l[e];if(void 0!==t)return t.exports;var a=l[e]={id:e,loaded:!1,exports:{}};return i[e].call(a.exports,a,a.exports,o),a.loaded=!0,a.exports}o.m=i,e=[],o.O=(t,a,r,i)=>{if(!a){var l=1/0;for(c=0;c<e.length;c++){a=e[c][0],r=e[c][1],i=e[c][2];for(var n=!0,d=0;d<a.length;d++)(!1&i||l>=i)&&Object.keys(o.O).every((e=>o.O[e](a[d])))?a.splice(d--,1):(n=!1,i<l&&(l=i));if(n){e.splice(c--,1);var s=r();void 0!==s&&(t=s)}}return t}i=i||0;for(var c=e.length;c>0&&e[c-1][2]>i;c--)e[c]=e[c-1];e[c]=[a,r,i]},o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var a in t)o.o(t,a)&&!o.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,a)=>(o.f[a](e,t),t)),[])),o.u=e=>e+"-"+e+".js?v="+{1359:"79a120e5671b1b5ba537",8618:"1e8f15db3b14455fef8f"}[e],o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a={},r="nextcloud:",o.l=(e,t,i,l)=>{if(a[e])a[e].push(t);else{var n,d;if(void 0!==i)for(var s=document.getElementsByTagName("script"),c=0;c<s.length;c++){var p=s[c];if(p.getAttribute("src")==e||p.getAttribute("data-webpack")==r+i){n=p;break}}n||(d=!0,(n=document.createElement("script")).charset="utf-8",n.timeout=120,o.nc&&n.setAttribute("nonce",o.nc),n.setAttribute("data-webpack",r+i),n.src=e),a[e]=[t];var u=(t,r)=>{n.onerror=n.onload=null,clearTimeout(f);var i=a[e];if(delete a[e],n.parentNode&&n.parentNode.removeChild(n),i&&i.forEach((e=>e(r))),t)return t(r)},f=setTimeout(u.bind(null,void 0,{type:"timeout",target:n}),12e4);n.onerror=u.bind(null,n.onerror),n.onload=u.bind(null,n.onload),d&&document.head.appendChild(n)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),o.j=6085,(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var a=t.getElementsByTagName("script");if(a.length)for(var r=a.length-1;r>-1&&(!e||!/^http(s?):/.test(e));)e=a[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{o.b=document.baseURI||self.location.href;var e={6085:0};o.f.j=(t,a)=>{var r=o.o(e,t)?e[t]:void 0;if(0!==r)if(r)a.push(r[2]);else{var i=new Promise(((a,i)=>r=e[t]=[a,i]));a.push(r[2]=i);var l=o.p+o.u(t),n=new Error;o.l(l,(a=>{if(o.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var i=a&&("load"===a.type?"missing":a.type),l=a&&a.target&&a.target.src;n.message="Loading chunk "+t+" failed.\n("+i+": "+l+")",n.name="ChunkLoadError",n.type=i,n.request=l,r[1](n)}}),"chunk-"+t,t)}},o.O.j=t=>0===e[t];var t=(t,a)=>{var r,i,l=a[0],n=a[1],d=a[2],s=0;if(l.some((t=>0!==e[t]))){for(r in n)o.o(n,r)&&(o.m[r]=n[r]);if(d)var c=d(o)}for(t&&t(a);s<l.length;s++)i=l[s],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return o.O(c)},a=self.webpackChunknextcloud=self.webpackChunknextcloud||[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))})(),o.nc=void 0;var n=o.O(void 0,[4208],(()=>o(27565)));n=o.O(n)})(); +//# sourceMappingURL=settings-declarative-settings-forms.js.map?v=d27f2b431a59171ca710
\ No newline at end of file |