nextcloud-server/dist/files_reminders-init.js

2 lines
17 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

(()=>{var e,t,r,n={4084:(e,t,r)=>{"use strict";var n,i=r(35810),a=r(61338),s=r(53334),o=r(85471),d=r(19051),l=r(63814);async function c(e,t){const r=(0,l.KT)("/apps/files_reminders/api/v1/{fileId}",{fileId:e});return(await d.Ay.put(r,{dueDate:t.toISOString()})).data.ocs.data}async function u(e){const t=(0,l.KT)("/apps/files_reminders/api/v1/{fileId}",{fileId:e});return(await d.Ay.delete(t)).data.ocs.data}function m(){const e=new Date;return e.setHours(0,0,0,0),e.setDate(e.getDate()-e.getDay()+1),new Date(e)}function f(e){new Date(e).setHours(0,0,0,0);const t=new Date(e.getFullYear(),0,1,0,0,0,0),r=(e.getTime()-t.getTime())/864e5;return Math.ceil((r+t.getDay()+1)/7)}function p(e){return{[n.LaterToday]:()=>{const e=new Date,t=new Date;t.setHours(18,0,0,0);const r=new Date;return r.setHours(17,0,0,0),e>=r?null:t},[n.Tomorrow]:()=>{const e=new Date,t=new Date;return t.setDate(e.getDate()+1),t.setHours(8,0,0,0),t},[n.ThisWeekend]:()=>{const e=new Date;if([5,6,0].includes(e.getDay()))return null;const t=new Date,r=m();return t.setDate(r.getDate()+5),t.setHours(8,0,0,0),t},[n.NextWeek]:()=>{if(0===(new Date).getDay())return null;const e=new Date,t=m();return e.setDate(t.getDate()+7),e.setHours(8,0,0,0),e}}[e]()}function g(e){let t={hour:"numeric",minute:"2-digit"};const r=new Date;var n,i;return i=r,((n=e).getDate()!==i.getDate()||n.getMonth()!==i.getMonth()||n.getFullYear()!==i.getFullYear())&&(t={...t,weekday:"short"}),function(e,t){return f(e)===f(t)&&e.getFullYear()===t.getFullYear()}(e,r)||(t={...t,month:"short",day:"numeric"}),e.getFullYear()!==r.getFullYear()&&(t={...t,year:"numeric"}),e.toLocaleString((0,s.lO)(),t)}function h(e){let t={month:"long",day:"numeric",weekday:"long",hour:"numeric",minute:"2-digit"};const r=new Date;return e.getFullYear()!==r.getFullYear()&&(t={...t,year:"numeric"}),e.toLocaleString((0,s.lO)(),t)}!function(e){e.LaterToday="later-today",e.Tomorrow="tomorrow",e.ThisWeekend="this-weekend",e.NextWeek="next-week"}(n||(n={}));const A=new i.hY({id:"clear-reminder",displayName:()=>(0,s.Tl)("files_reminders","Clear reminder"),title:e=>{const t=e.at(0),r=new Date(t.attributes["reminder-due-date"]);return`${(0,s.Tl)("files_reminders","Clear reminder")} ${h(r)}`},iconSvgInline:()=>'<svg xmlns="http://www.w3.org/2000/svg" id="mdi-alarm-off" viewBox="0 0 24 24"><path d="M8,3.28L6.6,1.86L5.74,2.57L7.16,4M16.47,18.39C15.26,19.39 13.7,20 12,20A7,7 0 0,1 5,13C5,11.3 5.61,9.74 6.61,8.53M2.92,2.29L1.65,3.57L3,4.9L1.87,5.83L3.29,7.25L4.4,6.31L5.2,7.11C3.83,8.69 3,10.75 3,13A9,9 0 0,0 12,22C14.25,22 16.31,21.17 17.89,19.8L20.09,22L21.36,20.73L3.89,3.27L2.92,2.29M22,5.72L17.4,1.86L16.11,3.39L20.71,7.25L22,5.72M12,6A7,7 0 0,1 19,13C19,13.84 18.84,14.65 18.57,15.4L20.09,16.92C20.67,15.73 21,14.41 21,13A9,9 0 0,0 12,4C10.59,4 9.27,4.33 8.08,4.91L9.6,6.43C10.35,6.16 11.16,6 12,6Z" /></svg>',enabled:e=>{if(1!==e.length)return!1;const t=e.at(0).attributes["reminder-due-date"];return Boolean(t)},async exec(e){if(e.fileid)try{return await u(e.fileid),o.Ay.set(e.attributes,"reminder-due-date",""),(0,a.Ic)("files:node:updated",e),!0}catch{return!1}return null},order:19}),b='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-alarm" viewBox="0 0 24 24"><path d="M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22A9,9 0 0,0 21,13A9,9 0 0,0 12,4M12.5,8H11V14L15.75,16.85L16.5,15.62L12.5,13.25V8M7.88,3.39L6.6,1.86L2,5.71L3.29,7.24L7.88,3.39M22,5.72L17.4,1.86L16.11,3.39L20.71,7.25L22,5.72Z" /></svg>';var v=r(85168),w=r(74095),D=r(4604),y=r(48198),C=r(94219),_=r(31133);const T=(0,r(35947).YK)().setApp("files_reminders").detectUser().build(),S=o.Ay.extend({name:"SetCustomReminderModal",components:{NcButton:w.A,NcDateTime:D.A,NcDateTimePickerNative:y.A,NcDialog:C.A,NcNoteCard:_.A},data:()=>({node:void 0,hasDueDate:!1,opened:!1,isValid:!0,customDueDate:null,nowDate:new Date}),computed:{fileId(){return this.node?.fileid},fileName(){return this.node?.basename},name(){return this.fileName?(0,s.Tl)("files_reminders",'Set reminder for "{fileName}"',{fileName:this.fileName}):""},label:()=>(0,s.Tl)("files_reminders","Reminder at custom date & time"),clearAriaLabel:()=>(0,s.Tl)("files_reminders","Clear reminder")},methods:{t:s.Tl,getDateString:g,open(e){const t=e.attributes["reminder-due-date"]?new Date(e.attributes["reminder-due-date"]):null;this.node=e,this.hasDueDate=Boolean(t),this.isValid=!0,this.opened=!0,this.customDueDate=t??function(){const e=new Date,t=new Date;return t.setHours(e.getHours()+2,0,0,0),t}(),this.nowDate=new Date,setTimeout(()=>{const e=document.getElementById("set-custom-reminder");e.focus(),this.hasDueDate||e.showPicker()},300)},async setCustom(){if(this.customDueDate instanceof Date&&!isNaN(this.customDueDate))try{await c(this.fileId,this.customDueDate),o.Ay.set(this.node.attributes,"reminder-due-date",this.customDueDate.toISOString()),(0,a.Ic)("files:node:updated",this.node),(0,v.Te)((0,s.Tl)("files_reminders",'Reminder set for "{fileName}"',{fileName:this.fileName})),this.onClose()}catch(e){T.error("Failed to set reminder",{error:e}),(0,v.Qg)((0,s.Tl)("files_reminders","Failed to set reminder"))}else(0,v.Qg)((0,s.Tl)("files_reminders","Please choose a valid date & time"))},async clear(){try{await u(this.fileId),o.Ay.set(this.node.attributes,"reminder-due-date",""),(0,a.Ic)("files:node:updated",this.node),(0,v.Te)((0,s.Tl)("files_reminders",'Reminder cleared for "{fileName}"',{fileName:this.fileName})),this.onClose()}catch(e){T.error("Failed to clear reminder",{error:e}),(0,v.Qg)((0,s.Tl)("files_reminders","Failed to clear reminder"))}},onClose(){this.opened=!1,this.$emit("close")},onInput(){const e=document.getElementById("set-custom-reminder");this.isValid=e.checkValidity()}}});var x=r(85072),L=r.n(x),N=r(97825),k=r.n(N),I=r(77659),P=r.n(I),M=r(55056),O=r.n(M),H=r(10540),B=r.n(H),F=r(41113),V=r.n(F),Y=r(36902),E={};E.styleTagTransform=V(),E.setAttributes=O(),E.insert=P().bind(null,"head"),E.domAPI=k(),E.insertStyleElement=B(),L()(Y.A,E),Y.A&&Y.A.locals&&Y.A.locals;const R=(0,r(14486).A)(S,function(){var e=this,t=e._self._c;return e._self._setupProxy,e.opened?t("NcDialog",{attrs:{name:e.name,"out-transition":!0,size:"small","close-on-click-outside":""},on:{closing:e.onClose},scopedSlots:e._u([{key:"actions",fn:function(){return[t("NcButton",{attrs:{variant:"tertiary"},on:{click:e.onClose}},[e._v("\n\t\t\t"+e._s(e.t("files_reminders","Cancel"))+"\n\t\t")]),e._v(" "),e.hasDueDate?t("NcButton",{on:{click:e.clear}},[e._v("\n\t\t\t"+e._s(e.t("files_reminders","Clear reminder"))+"\n\t\t")]):e._e(),e._v(" "),t("NcButton",{attrs:{disabled:!e.isValid,variant:"primary",form:"set-custom-reminder-form",type:"submit"}},[e._v("\n\t\t\t"+e._s(e.t("files_reminders","Set reminder"))+"\n\t\t")])]},proxy:!0}],null,!1,2109217514)},[t("form",{staticClass:"custom-reminder-modal",attrs:{id:"set-custom-reminder-form"},on:{submit:function(t){return t.preventDefault(),e.setCustom.apply(null,arguments)}}},[t("NcDateTimePickerNative",{attrs:{id:"set-custom-reminder",label:e.label,min:e.nowDate,required:!0,type:"datetime-local"},on:{input:e.onInput},model:{value:e.customDueDate,callback:function(t){e.customDueDate=t},expression:"customDueDate"}}),e._v(" "),e.isValid?t("NcNoteCard",{attrs:{type:"info"}},[e._v("\n\t\t\t"+e._s(e.t("files_reminders","We will remind you of this file"))+"\n\t\t\t"),t("NcDateTime",{attrs:{timestamp:e.customDueDate}})],1):t("NcNoteCard",{attrs:{type:"error"}},[e._v("\n\t\t\t"+e._s(e.t("files_reminders","Please choose a valid date & time"))+"\n\t\t")])],1)]):e._e()},[],!1,null,"568d1fb1",null).exports,$=o.Ay.extend(R),j=document.createElement("div");j.id="set-custom-reminder-modal",document.body.appendChild(j);const G=new $({name:"SetCustomReminderModal",el:j});function W(e){return G.open(e),new Promise(e=>{G.$once("close",e)})}const Q=new i.hY({id:"reminder-status",inline:()=>!0,displayName:()=>"",title:e=>{const t=e.at(0),r=new Date(t.attributes["reminder-due-date"]);return`${(0,s.Tl)("files_reminders","Reminder set")} ${h(r)}`},iconSvgInline:()=>b,enabled:e=>{if(1!==e.length)return!1;const t=e.at(0).attributes["reminder-due-date"];return Boolean(t)},exec:async e=>(W(e),null),order:-15}),U="set-reminder-menu",K=new i.hY({id:U,displayName:()=>(0,s.Tl)("files_reminders","Set reminder"),iconSvgInline:()=>b,enabled:(e,t)=>"trashbin"!==t.id&&(1===e.length&&void 0!==e.at(0).attributes["reminder-due-date"]),exec:async()=>null,order:20}),Z=new i.hY({id:"set-reminder-custom",displayName:()=>(0,s.Tl)("files_reminders","Custom reminder"),title:()=>(0,s.Tl)("files_reminders","Reminder at custom date & time"),iconSvgInline:()=>'<svg xmlns="http://www.w3.org/2000/svg" id="mdi-calendar-clock" viewBox="0 0 24 24"><path d="M15,13H16.5V15.82L18.94,17.23L18.19,18.53L15,16.69V13M19,8H5V19H9.67C9.24,18.09 9,17.07 9,16A7,7 0 0,1 16,9C17.07,9 18.09,9.24 19,9.67V8M5,21C3.89,21 3,20.1 3,19V5C3,3.89 3.89,3 5,3H6V1H8V3H16V1H18V3H19A2,2 0 0,1 21,5V11.1C22.24,12.36 23,14.09 23,16A7,7 0 0,1 16,23C14.09,23 12.36,22.24 11.1,21H5M16,11.15A4.85,4.85 0 0,0 11.15,16C11.15,18.68 13.32,20.85 16,20.85A4.85,4.85 0 0,0 20.85,16C20.85,13.32 18.68,11.15 16,11.15Z" /></svg>',enabled:(e,t)=>"trashbin"!==t.id&&(1===e.length&&void 0!==e.at(0).attributes["reminder-due-date"]),parent:U,exec:async e=>(W(e),null),order:22});var q=r(19672),X={};X.styleTagTransform=V(),X.setAttributes=O(),X.insert=P().bind(null,"head"),X.domAPI=k(),X.insertStyleElement=B(),L()(q.A,X),q.A&&q.A.locals&&q.A.locals;const z={dateTimePreset:n.LaterToday,label:(0,s.t)("files_reminders","Later today"),ariaLabel:(0,s.t)("files_reminders","Set reminder for later today"),dateString:"",verboseDateString:""},J={dateTimePreset:n.Tomorrow,label:(0,s.t)("files_reminders","Tomorrow"),ariaLabel:(0,s.t)("files_reminders","Set reminder for tomorrow"),dateString:"",verboseDateString:""},ee={dateTimePreset:n.ThisWeekend,label:(0,s.t)("files_reminders","This weekend"),ariaLabel:(0,s.t)("files_reminders","Set reminder for this weekend"),dateString:"",verboseDateString:""},te={dateTimePreset:n.NextWeek,label:(0,s.t)("files_reminders","Next week"),ariaLabel:(0,s.t)("files_reminders","Set reminder for next week"),dateString:"",verboseDateString:""};[z,J,ee,te].forEach(e=>{const t=p(e.dateTimePreset);t&&(e.dateString=g(t),e.verboseDateString=h(t),setInterval(()=>{const t=p(e.dateTimePreset);t&&(e.dateString=g(t),e.verboseDateString=h(t))},18e5))});const re=[z,J,ee,te].map(function(e){return new i.hY({id:`set-reminder-${e.dateTimePreset}`,displayName:()=>`${e.label} ${e.dateString}`,title:()=>`${e.ariaLabel} ${e.verboseDateString}`,iconSvgInline:()=>"<svg></svg>",enabled:(t,r)=>"trashbin"!==r.id&&(1===t.length&&(void 0!==t.at(0).attributes["reminder-due-date"]&&Boolean(p(e.dateTimePreset)))),parent:U,async exec(t){if(!t.fileid)return T.error("Failed to set reminder, missing file id"),(0,v.Qg)((0,s.t)("files_reminders","Failed to set reminder")),null;try{const r=p(e.dateTimePreset);await c(t.fileid,r),o.Ay.set(t.attributes,"reminder-due-date",r.toISOString()),(0,a.Ic)("files:node:updated",t),(0,v.Te)((0,s.t)("files_reminders",'Reminder set for "{fileName}"',{fileName:t.basename}))}catch(e){T.error("Failed to set reminder",{error:e}),(0,v.Qg)((0,s.t)("files_reminders","Failed to set reminder"))}return null},order:21})});(0,i.Yc)("nc:reminder-due-date",{nc:"http://nextcloud.org/ns"}),(0,i.Gg)(Q),(0,i.Gg)(A),(0,i.Gg)(K),(0,i.Gg)(Z),re.forEach(e=>(0,i.Gg)(e))},15340:()=>{},19672:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(71354),i=r.n(n),a=r(76314),s=r.n(a)()(i());s.push([e.id,'.files-list__row-action-set-reminder-custom{margin-top:13px;position:relative}.files-list__row-action-set-reminder-custom::before{content:"";margin-block:3px;margin-inline:15px 10px;border-bottom:1px solid var(--color-border-dark);cursor:default;display:flex;height:0;position:absolute;inset-inline:0;top:-10px}',"",{version:3,sources:["webpack://./apps/files_reminders/src/actions/setReminderSuggestionActions.scss"],names:[],mappings:"AAMA,4CACC,eAAA,CACA,iBAAA,CAEA,oDACC,UAAA,CACA,gBAAA,CACA,uBAAA,CACA,gDAAA,CACA,cAAA,CACA,YAAA,CACA,QAAA,CACA,iBAAA,CACA,cAAA,CACA,SAAA",sourcesContent:['/**\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n // TODO: remove when/if the actions API supports a separator\n // This the last preset action, so we need to add a separator\n.files-list__row-action-set-reminder-custom {\n\tmargin-top: 13px;\n\tposition: relative;\n\n\t&::before {\n\t\tcontent: "";\n\t\tmargin-block: 3px;\n\t\tmargin-inline: 15px 10px;\n\t\tborder-bottom: 1px solid var(--color-border-dark);\n\t\tcursor: default;\n\t\tdisplay: flex;\n\t\theight: 0;\n\t\tposition: absolute;\n\t\tinset-inline: 0;\n\t\ttop: -10px;\n\t}\n}\n'],sourceRoot:""}]);const o=s},36902:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(71354),i=r.n(n),a=r(76314),s=r.n(a)()(i());s.push([e.id,".custom-reminder-modal[data-v-568d1fb1]{margin:0 12px}","",{version:3,sources:["webpack://./apps/files_reminders/src/components/SetCustomReminderModal.vue"],names:[],mappings:"AACA,wCACC,aAAA",sourcesContent:["\n.custom-reminder-modal {\n\tmargin: 0 12px;\n}\n"],sourceRoot:""}]);const o=s},47790:()=>{},51069:()=>{},63779:()=>{},64688:()=>{},66089:()=>{},73776:()=>{},77199:()=>{},77965:()=>{},78982:()=>{},79368:()=>{},79838:()=>{}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={id:e,loaded:!1,exports:{}};return n[e].call(r.exports,r,r.exports,a),r.loaded=!0,r.exports}a.m=n,e=[],a.O=(t,r,n,i)=>{if(!r){var s=1/0;for(c=0;c<e.length;c++){for(var[r,n,i]=e[c],o=!0,d=0;d<r.length;d++)(!1&i||s>=i)&&Object.keys(a.O).every(e=>a.O[e](r[d]))?r.splice(d--,1):(o=!1,i<s&&(s=i));if(o){e.splice(c--,1);var l=n();void 0!==l&&(t=l)}}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]=[r,n,i]},a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,r)=>(a.f[r](e,t),t),[])),a.u=e=>e+"-"+e+".js?v="+{594:"706f8e77fcd637f25ccf",620:"8e3c118f58088ce04c74",2391:"a1c7f293d21dd6ef8096",2880:"62fd555d64b20d9a6c97",4325:"cc118df199f1941c08e4",5862:"4ca96c4f928b038599cf",7145:"375037f0ab8e6cfa581e",8339:"3f9cf3b616cfbc0082d4"}[e],a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="nextcloud:",a.l=(e,n,i,s)=>{if(t[e])t[e].push(n);else{var o,d;if(void 0!==i)for(var l=document.getElementsByTagName("script"),c=0;c<l.length;c++){var u=l[c];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==r+i){o=u;break}}o||(d=!0,(o=document.createElement("script")).charset="utf-8",a.nc&&o.setAttribute("nonce",a.nc),o.setAttribute("data-webpack",r+i),o.src=e),t[e]=[n];var m=(r,n)=>{o.onerror=o.onload=null,clearTimeout(f);var i=t[e];if(delete t[e],o.parentNode&&o.parentNode.removeChild(o),i&&i.forEach(e=>e(n)),r)return r(n)},f=setTimeout(m.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=m.bind(null,o.onerror),o.onload=m.bind(null,o.onload),d&&document.head.appendChild(o)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),a.j=9735,(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{a.b="undefined"!=typeof document&&document.baseURI||self.location.href;var e={9735:0};a.f.j=(t,r)=>{var n=a.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var i=new Promise((r,i)=>n=e[t]=[r,i]);r.push(n[2]=i);var s=a.p+a.u(t),o=new Error;a.l(s,r=>{if(a.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var i=r&&("load"===r.type?"missing":r.type),s=r&&r.target&&r.target.src;o.message="Loading chunk "+t+" failed.\n("+i+": "+s+")",o.name="ChunkLoadError",o.type=i,o.request=s,n[1](o)}},"chunk-"+t,t)}},a.O.j=t=>0===e[t];var t=(t,r)=>{var n,i,[s,o,d]=r,l=0;if(s.some(t=>0!==e[t])){for(n in o)a.o(o,n)&&(a.m[n]=o[n]);if(d)var c=d(a)}for(t&&t(r);l<s.length;l++)i=s[l],a.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return a.O(c)},r=self.webpackChunknextcloud=self.webpackChunknextcloud||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})(),a.nc=void 0;var s=a.O(void 0,[4208],()=>a(4084));s=a.O(s)})();
//# sourceMappingURL=files_reminders-init.js.map?v=9ae50125b653ba085d84