2 lines
3.6 KiB
JavaScript
2 lines
3.6 KiB
JavaScript
"use strict";(globalThis.webpackChunknextcloud_ui_legacy=globalThis.webpackChunknextcloud_ui_legacy||[]).push([[6590],{11352:(e,t,a)=>{a.r(t),a.d(t,{default:()=>C});var n=a(85072),i=a.n(n),r=a(97825),s=a.n(r),l=a(77659),o=a.n(l),d=a(55056),c=a.n(d),m=a(10540),u=a.n(m),h=a(41113),p=a.n(h),g=a(69905),f={};f.styleTagTransform=p(),f.setAttributes=c(),f.insert=o().bind(null,"head"),f.domAPI=s(),f.insertStyleElement=u(),i()(g.A,f),g.A&&g.A.locals&&g.A.locals;var v=a(35810),w=a(85471),b=a(90231),E=a(94219),y=a(82182),A=a(31133);const N=(0,w.pM)({components:{NcDialog:E.A,NcNoteCard:A.A,NcTextField:y.A},props:{error:{type:v.di,required:!0},validateFilename:{type:Function,required:!0}},setup:()=>({t:b.t}),data:()=>({newName:"",validationError:""}),computed:{isValidName(){return""===this.validationError},isInvalidFileType(){return this.error.reason===v.nF.Extension&&null!==this.error.segment.match(/^\.\w/)},canRename(){return!this.isInvalidFileType},dialogButtons(){const e=[{label:(0,b.t)("Cancel"),type:"error",callback:()=>{this.$emit("close",{cancel:!0})}},{label:(0,b.t)("Skip"),callback:()=>{this.$emit("close",{skip:!0})}}];return this.canRename&&e.push({label:(0,b.t)("Rename"),type:"primary",disabled:!this.isValidName,callback:()=>{this.$emit("close",{rename:this.newName.trimEnd()})}}),e}},watch:{error:{handler(){this.validationError=this.getErrorText(this.error),this.newName=this.error.filename},immediate:!0},newName(){try{this.validateFilename(this.newName.trimEnd()),this.validationError=""}catch(e){this.validationError=this.getErrorText(e)}finally{const e=this.$refs.textfield?.$el.querySelector("input");e&&(e.setCustomValidity(this.validationError),e.reportValidity())}}},methods:{getErrorText(e){switch(e.reason){case v.nF.Character:return(0,b.t)('"{segment}" is not allowed inside a file or folder name.',{segment:e.segment});case v.nF.ReservedName:return(0,b.t)('"{segment}" is a forbidden file or folder name.',{segment:e.segment});case v.nF.Extension:return e.segment.match(/\.\w/)?(0,b.t)('"{segment}" is a forbidden file type.',{segment:e.segment}):(0,b.t)('Filenames must not end with "{segment}".',{segment:e.segment})}}}});var _=function(){var e=this,t=e._self._c;return e._self._setupProxy,t("NcDialog",{attrs:{buttons:e.dialogButtons,name:e.t("Invalid filename")},on:{close:function(t){return e.$emit("close",{cancel:!0})}}},[t("NcNoteCard",{attrs:{severity:"error"}},[e._v(" "+e._s(e.getErrorText(e.error))+" "+e._s(e.t("You can either rename the file, skip this file or cancel the whole operation."))+" ")]),e.canRename?t("NcTextField",{ref:"textfield",staticClass:"invalid-filename-dialog__input",attrs:{error:!e.isValidName,"helper-text":e.validationError,label:e.t("New filename"),value:e.newName},on:{"update:value":function(t){e.newName=t}}}):e._e()],1)},x=[];const C=(0,b.n)(N,_,x,!1,null,"9d7d9a49").exports},69905:(e,t,a)=>{a.d(t,{A:()=>l});var n=a(71354),i=a.n(n),r=a(76314),s=a.n(r)()(i());s.push([e.id,"\n.invalid-filename-dialog__input[data-v-9d7d9a49] {\n\t/* Ensure the helper text can always be shown without jumping */\n\tmin-height: calc(var(--default-clickable-area) + 4 * var(--default-font-size));\n}\n","",{version:3,sources:["webpack://./node_modules/@nextcloud/upload/dist/assets/InvalidFilenameDialog-DKMLP0ER.css"],names:[],mappings:";AACA;CACC,+DAA+D;CAC/D,8EAA8E;AAC/E",sourcesContent:["\n.invalid-filename-dialog__input[data-v-9d7d9a49] {\n\t/* Ensure the helper text can always be shown without jumping */\n\tmin-height: calc(var(--default-clickable-area) + 4 * var(--default-font-size));\n}\n"],sourceRoot:""}]);const l=s}}]);
|
|
//# sourceMappingURL=6590-6590.js.map?v=460453c0c09b90e6b174
|