Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".invalid-filename-dialog__input[data-v-3a479259]{min-height:calc(var(--default-clickable-area) + 4 * var(--default-font-size))}")),document.head.appendChild(e)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
import{I as n,b as r}from"./index-V3sFXKbr.chunk.mjs";import{d as s}from"./vue.runtime.esm-Cvc35Ey2.chunk.mjs";import{n as o,t}from"./index-Dkr9ebK1-CC5oxkgM.chunk.mjs";import{S as l,B as m}from"./index-CYNaqKNs.chunk.mjs";import{N as c}from"./NcNoteCard-CajyNJZ1.chunk.mjs";import"./index-Y-UlKA14.chunk.mjs";import"./preload-helper-BmjW8Ca_.chunk.mjs";import"./index-RCrftHFV.chunk.mjs";const d=s({components:{NcDialog:m,NcNoteCard:c,NcTextField:l},props:{error:{type:n,required:!0},validateFilename:{type:Function,required:!0}},setup(){return{t}},data(){return{newName:"",validationError:""}},computed:{isValidName(){return this.validationError===""},isInvalidFileType(){return this.error.reason===r.Extension&&this.error.segment.match(/^\.\w/)!==null},canRename(){return!this.isInvalidFileType},dialogButtons(){const e=[{label:t("Cancel"),type:"error",callback:()=>{this.$emit("close",{cancel:!0})}},{label:t("Skip"),callback:()=>{this.$emit("close",{skip:!0})}}];return this.canRename&&e.push({label: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 r.Character:return t('"{segment}" is not allowed inside a file or folder name.',{segment:e.segment});case r.ReservedName:return t('"{segment}" is a forbidden file or folder name.',{segment:e.segment});case r.Extension:return e.segment.match(/\.\w/)?t('"{segment}" is a forbidden file type.',{segment:e.segment}):t('Filenames must not end with "{segment}".',{segment:e.segment})}}}});var h=function(){var e=this,i=e._self._c;return e._self._setupProxy,i("NcDialog",{attrs:{buttons:e.dialogButtons,name:e.t("Invalid filename")},on:{close:function(a){return e.$emit("close",{cancel:!0})}}},[i("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?i("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(a){e.newName=a}}}):e._e()],1)},u=[],p=o(d,h,u,!1,null,"3a479259");const b=p.exports;export{b as default};
//# sourceMappingURL=InvalidFilenameDialog-BBs-WwIb-CNFdQwRD.chunk.mjs.map
import{I as n,b as r}from"./index-V3sFXKbr.chunk.mjs";import{d as s}from"./vue.runtime.esm-Cvc35Ey2.chunk.mjs";import{n as o,t}from"./index-Dkr9ebK1-IxTpPtq4.chunk.mjs";import{S as l,B as m}from"./index-CYNaqKNs.chunk.mjs";import{N as c}from"./NcNoteCard-CajyNJZ1.chunk.mjs";import"./index-Y-UlKA14.chunk.mjs";import"./preload-helper-Dh9HmuEY.chunk.mjs";import"./index-ETwsRz7N.chunk.mjs";const d=s({components:{NcDialog:m,NcNoteCard:c,NcTextField:l},props:{error:{type:n,required:!0},validateFilename:{type:Function,required:!0}},setup(){return{t}},data(){return{newName:"",validationError:""}},computed:{isValidName(){return this.validationError===""},isInvalidFileType(){return this.error.reason===r.Extension&&this.error.segment.match(/^\.\w/)!==null},canRename(){return!this.isInvalidFileType},dialogButtons(){const e=[{label:t("Cancel"),type:"error",callback:()=>{this.$emit("close",{cancel:!0})}},{label:t("Skip"),callback:()=>{this.$emit("close",{skip:!0})}}];return this.canRename&&e.push({label: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 r.Character:return t('"{segment}" is not allowed inside a file or folder name.',{segment:e.segment});case r.ReservedName:return t('"{segment}" is a forbidden file or folder name.',{segment:e.segment});case r.Extension:return e.segment.match(/\.\w/)?t('"{segment}" is a forbidden file type.',{segment:e.segment}):t('Filenames must not end with "{segment}".',{segment:e.segment})}}}});var h=function(){var e=this,i=e._self._c;return e._self._setupProxy,i("NcDialog",{attrs:{buttons:e.dialogButtons,name:e.t("Invalid filename")},on:{close:function(a){return e.$emit("close",{cancel:!0})}}},[i("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?i("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(a){e.newName=a}}}):e._e()],1)},u=[],p=o(d,h,u,!1,null,"3a479259");const b=p.exports;export{b as default};
//# sourceMappingURL=InvalidFilenameDialog-BBs-WwIb-Bn4h1qxD.chunk.mjs.map
Loading
Loading