123 |
- /*! For license information please see files_reminders-main.js.LICENSE.txt */
- (()=>{var e,t,r,s={7552:(e,t,r)=>{"use strict";var s=r(20144),n=r(69183),a=r(64024),o=r(31352),i=r(45400),l=r.n(i),c=r(79570),d=r.n(c),u=r(12945),m=r.n(u),f=r(875),j=r.n(f),p=r(69254),h=r(36246),y=r(11734),b=r(46308),v=r(4820),k=r(79753);const g=async(e,t)=>{const r=(0,k.generateOcsUrl)("/apps/files_reminders/api/v1/{fileId}",{fileId:e});return(await v.Z.put(r,{dueDate:t.toISOString()})).data.ocs.data};var w,_=r(80351),A=r.n(_);!function(e){e[e.LaterToday=0]="LaterToday",e[e.Tomorrow=1]="Tomorrow",e[e.ThisWeekend=2]="ThisWeekend",e[e.NextWeek=3]="NextWeek"}(w||(w={}));const x=()=>{const e=A()().get("hour");return A()().startOf("day").add(e+2,"hour").toDate()},D=e=>{let t={hour:"numeric",minute:"2-digit"};const r=A()(e),s=A()();return r.isSame(s,"date")||(t={...t,weekday:"short"}),r.isSame(s,"week")||(t={...t,month:"short",day:"numeric"}),e.toLocaleString((0,o.aj)(),t)},I=e=>e.toLocaleString((0,o.aj)(),{weekday:"long",hour:"numeric",minute:"2-digit",month:"long",day:"numeric"}),S=(0,r(17499).IY)().setApp("files_reminders").detectUser().build(),C={dateTimePreset:w.LaterToday,label:(0,o.Iu)("files_reminders","Later today"),ariaLabel:(0,o.Iu)("files_reminders","Set reminder for later today")},O={dateTimePreset:w.Tomorrow,label:(0,o.Iu)("files_reminders","Tomorrow"),ariaLabel:(0,o.Iu)("files_reminders","Set reminder for tomorrow")},N={dateTimePreset:w.ThisWeekend,label:(0,o.Iu)("files_reminders","This weekend"),ariaLabel:(0,o.Iu)("files_reminders","Set reminder for this weekend")},T={dateTimePreset:w.NextWeek,label:(0,o.Iu)("files_reminders","Next week"),ariaLabel:(0,o.Iu)("files_reminders","Set reminder for next week")},z=s.default.extend({name:"SetReminderActions",components:{ArrowLeft:p.default,CalendarClock:h.Z,Check:y.default,CloseCircleOutline:b.Z,NcActionButton:l(),NcActionInput:d(),NcActions:m(),NcActionSeparator:j()},props:{file:{type:Object,required:!0},dueDate:{type:Date,default:null}},data:()=>({open:!0,now:new Date,customDueDate:x()}),watch:{open(e){e||this.$emit("close")}},computed:{fileId(){return this.file.id},fileName(){return this.file.name},clearAriaLabel(){return"".concat((0,o.Iu)("files_reminders","Clear reminder")," – ").concat(I(this.dueDate))},customAriaLabel(){return""===this.customDueDate?null:"".concat((0,o.Iu)("files_reminders","Set reminder at custom date & time")," – ").concat(I(this.customDueDate))},options(){return[C,O,N,T].map((e=>{const t=(e=>({[w.LaterToday]:()=>{const e=A()(),t=A()().startOf("day").add(18,"hour"),r=t.clone().subtract(1,"hour");return e.isSameOrAfter(r)?null:t.toDate()},[w.Tomorrow]:()=>A()().add(1,"day").startOf("day").add(8,"hour").toDate(),[w.ThisWeekend]:()=>{const e=A()();return[5,6,7].includes(e.isoWeekday())?null:A()().startOf("isoWeek").add(5,"day").add(8,"hour").toDate()},[w.NextWeek]:()=>7===A()().isoWeekday()?null:A()().startOf("isoWeek").add(1,"week").add(8,"hour").toDate()}[e]()))(e.dateTimePreset);return t?{...e,ariaLabel:"".concat(e.ariaLabel," – ").concat(I(t)),dateString:D(t),action:()=>this.set(t)}:null})).filter(Boolean)}},methods:{t:o.Iu,getDateString:D,async set(e){try{await g(this.fileId,e),(0,a.s$)((0,o.Iu)("files_reminders",'Reminder set for "{fileName}"',{fileName:this.fileName})),this.open=!1}catch(e){S.error("Failed to set reminder",{error:e}),(0,a.x2)((0,o.Iu)("files_reminders","Failed to set reminder"))}},async setCustom(){if(""!==this.customDueDate)try{await g(this.fileId,this.customDueDate),(0,a.s$)((0,o.Iu)("files_reminders",'Reminder set for "{fileName}"',{fileName:this.fileName})),this.open=!1}catch(e){S.error("Failed to set reminder",{error:e}),(0,a.x2)((0,o.Iu)("files_reminders","Failed to set reminder"))}else(0,a.x2)((0,o.Iu)("files_reminders","Please choose a valid date & time"))},async clear(){try{await(async e=>{const t=(0,k.generateOcsUrl)("/apps/files_reminders/api/v1/{fileId}",{fileId:e});return(await v.Z.delete(t)).data.ocs.data})(this.fileId),(0,a.s$)((0,o.Iu)("files_reminders","Reminder cleared")),this.open=!1}catch(e){S.error("Failed to clear reminder",{error:e}),(0,a.x2)((0,o.Iu)("files_reminders","Failed to clear reminder"))}}}});var L=r(93379),E=r.n(L),P=r(7795),B=r.n(P),$=r(90569),W=r.n($),Z=r(3565),F=r.n(Z),R=r(19216),U=r.n(R),q=r(44589),M=r.n(q),Y=r(86113),G={};G.styleTagTransform=M(),G.setAttributes=F(),G.insert=W().bind(null,"head"),G.domAPI=B(),G.insertStyleElement=U(),E()(Y.Z,G),Y.Z&&Y.Z.locals&&Y.Z.locals;const H=(0,r(51900).Z)(z,(function(){var e=this,t=e._self._c;return e._self._setupProxy,t("NcActions",{staticClass:"actions-secondary-vue",attrs:{open:e.open},on:{"update:open":function(t){e.open=t}}},[t("NcActionButton",{on:{click:function(t){return e.$emit("back")}},scopedSlots:e._u([{key:"icon",fn:function(){return[t("ArrowLeft",{attrs:{size:20}})]},proxy:!0}])},[e._v("\n\t\t"+e._s(e.t("files_reminders","Back"))+"\n\t")]),e._v(" "),Boolean(e.dueDate)?t("NcActionButton",{attrs:{"aria-label":e.clearAriaLabel},on:{click:e.clear},scopedSlots:e._u([{key:"icon",fn:function(){return[t("CloseCircleOutline",{attrs:{size:20}})]},proxy:!0}],null,!1,3165582732)},[e._v("\n\t\t"+e._s(e.t("files_reminders","Clear reminder"))+" – "+e._s(e.getDateString(e.dueDate))+"\n\t")]):e._e(),e._v(" "),t("NcActionSeparator"),e._v(" "),e._l(e.options,(function(r){let{label:s,ariaLabel:n,dateString:a,action:o}=r;return t("NcActionButton",{key:s,attrs:{"aria-label":n},on:{click:o}},[e._v("\n\t\t"+e._s(s)+" – "+e._s(a)+"\n\t")])})),e._v(" "),t("NcActionSeparator"),e._v(" "),t("NcActionInput",{attrs:{type:"datetime-local","is-native-picker":"",min:e.now},scopedSlots:e._u([{key:"icon",fn:function(){return[t("CalendarClock",{attrs:{size:20}})]},proxy:!0}]),model:{value:e.customDueDate,callback:function(t){e.customDueDate=t},expression:"customDueDate"}}),e._v(" "),t("NcActionButton",{attrs:{"aria-label":e.customAriaLabel},on:{click:e.setCustom},scopedSlots:e._u([{key:"icon",fn:function(){return[t("Check",{attrs:{size:20}})]},proxy:!0}])},[e._v("\n\t\t"+e._s(e.t("files_reminders","Set custom reminder"))+"\n\t")])],2)}),[],!1,null,"5d769186",null).exports;(0,n.Ld)("files:action-menu:opened",(async e=>{const t=e.context.fileInfoModel.attributes.id,r=e.context.$file[0].querySelector(".fileactions .action-menu"),n=e.el.querySelector(".action-setreminder-container .action-setreminder");let i=null,l=null;try{i=(await(async e=>{const t=(0,k.generateOcsUrl)("/apps/files_reminders/api/v1/{fileId}",{fileId:e}),r=await v.Z.get(t);return{dueDate:r.data.ocs.data.dueDate?new Date(r.data.ocs.data.dueDate):null}})(t)).dueDate}catch(e){l=e,S.error("Failed to load reminder for file with id: ".concat(t),{error:l})}n.addEventListener("click",(t=>{if(l)throw(0,a.x2)((0,o.Iu)("files_reminders","Failed to load reminder")),Error();const n=document.createElement("div"),c=s.default.extend(H),d=r.style.display;r.style.display="none",r.insertAdjacentElement("afterend",n);const u=new c({propsData:{file:e.context.fileInfoModel.attributes,dueDate:i}}).$mount(n),m=()=>{u.$destroy(),u.$el.remove(),r.style.display=d};u.$once("back",(()=>{m(),r.click()})),u.$once("close",(()=>{m()}))}),{once:!0})}))},86113:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});var s=r(87537),n=r.n(s),a=r(23645),o=r.n(a)()(n());o.push([e.id,".actions-secondary-vue[data-v-5d769186]{display:block !important;float:right !important;padding:5px 0 0 4px !important;pointer-events:none !important}","",{version:3,sources:["webpack://./apps/files_reminders/src/components/SetReminderActions.vue"],names:[],mappings:"AACA,wCACC,wBAAA,CACA,sBAAA,CACA,8BAAA,CACA,8BAAA",sourcesContent:["\n.actions-secondary-vue {\n\tdisplay: block !important;\n\tfloat: right !important;\n\tpadding: 5px 0 0 4px !important;\n\tpointer-events: none !important; // prevent activation of file row\n}\n"],sourceRoot:""}]);const i=o},46700:(e,t,r)=>{var s={"./af":42786,"./af.js":42786,"./ar":30867,"./ar-dz":14130,"./ar-dz.js":14130,"./ar-kw":96135,"./ar-kw.js":96135,"./ar-ly":56440,"./ar-ly.js":56440,"./ar-ma":47702,"./ar-ma.js":47702,"./ar-sa":16040,"./ar-sa.js":16040,"./ar-tn":37100,"./ar-tn.js":37100,"./ar.js":30867,"./az":31083,"./az.js":31083,"./be":9808,"./be.js":9808,"./bg":68338,"./bg.js":68338,"./bm":67438,"./bm.js":67438,"./bn":8905,"./bn-bd":76225,"./bn-bd.js":76225,"./bn.js":8905,"./bo":11560,"./bo.js":11560,"./br":1278,"./br.js":1278,"./bs":80622,"./bs.js":80622,"./ca":2468,"./ca.js":2468,"./cs":5822,"./cs.js":5822,"./cv":50877,"./cv.js":50877,"./cy":47373,"./cy.js":47373,"./da":24780,"./da.js":24780,"./de":59740,"./de-at":60217,"./de-at.js":60217,"./de-ch":60894,"./de-ch.js":60894,"./de.js":59740,"./dv":5300,"./dv.js":5300,"./el":50837,"./el.js":50837,"./en-au":78348,"./en-au.js":78348,"./en-ca":77925,"./en-ca.js":77925,"./en-gb":22243,"./en-gb.js":22243,"./en-ie":46436,"./en-ie.js":46436,"./en-il":47207,"./en-il.js":47207,"./en-in":44175,"./en-in.js":44175,"./en-nz":76319,"./en-nz.js":76319,"./en-sg":31662,"./en-sg.js":31662,"./eo":92915,"./eo.js":92915,"./es":55655,"./es-do":55251,"./es-do.js":55251,"./es-mx":96112,"./es-mx.js":96112,"./es-us":71146,"./es-us.js":71146,"./es.js":55655,"./et":5603,"./et.js":5603,"./eu":77763,"./eu.js":77763,"./fa":76959,"./fa.js":76959,"./fi":11897,"./fi.js":11897,"./fil":42549,"./fil.js":42549,"./fo":94694,"./fo.js":94694,"./fr":94470,"./fr-ca":63049,"./fr-ca.js":63049,"./fr-ch":52330,"./fr-ch.js":52330,"./fr.js":94470,"./fy":5044,"./fy.js":5044,"./ga":29295,"./ga.js":29295,"./gd":2101,"./gd.js":2101,"./gl":38794,"./gl.js":38794,"./gom-deva":27884,"./gom-deva.js":27884,"./gom-latn":23168,"./gom-latn.js":23168,"./gu":95349,"./gu.js":95349,"./he":24206,"./he.js":24206,"./hi":30094,"./hi.js":30094,"./hr":30316,"./hr.js":30316,"./hu":22138,"./hu.js":22138,"./hy-am":11423,"./hy-am.js":11423,"./id":29218,"./id.js":29218,"./is":90135,"./is.js":90135,"./it":90626,"./it-ch":10150,"./it-ch.js":10150,"./it.js":90626,"./ja":39183,"./ja.js":39183,"./jv":24286,"./jv.js":24286,"./ka":12105,"./ka.js":12105,"./kk":47772,"./kk.js":47772,"./km":18758,"./km.js":18758,"./kn":79282,"./kn.js":79282,"./ko":33730,"./ko.js":33730,"./ku":1408,"./ku.js":1408,"./ky":33291,"./ky.js":33291,"./lb":36841,"./lb.js":36841,"./lo":55466,"./lo.js":55466,"./lt":57010,"./lt.js":57010,"./lv":37595,"./lv.js":37595,"./me":39861,"./me.js":39861,"./mi":35493,"./mi.js":35493,"./mk":95966,"./mk.js":95966,"./ml":87341,"./ml.js":87341,"./mn":5115,"./mn.js":5115,"./mr":10370,"./mr.js":10370,"./ms":9847,"./ms-my":41237,"./ms-my.js":41237,"./ms.js":9847,"./mt":72126,"./mt.js":72126,"./my":56165,"./my.js":56165,"./nb":64924,"./nb.js":64924,"./ne":16744,"./ne.js":16744,"./nl":93901,"./nl-be":59814,"./nl-be.js":59814,"./nl.js":93901,"./nn":83877,"./nn.js":83877,"./oc-lnc":92135,"./oc-lnc.js":92135,"./pa-in":15858,"./pa-in.js":15858,"./pl":64495,"./pl.js":64495,"./pt":89520,"./pt-br":57971,"./pt-br.js":57971,"./pt.js":89520,"./ro":96459,"./ro.js":96459,"./ru":21793,"./ru.js":21793,"./sd":40950,"./sd.js":40950,"./se":10490,"./se.js":10490,"./si":90124,"./si.js":90124,"./sk":64249,"./sk.js":64249,"./sl":14985,"./sl.js":14985,"./sq":51104,"./sq.js":51104,"./sr":49131,"./sr-cyrl":79915,"./sr-cyrl.js":79915,"./sr.js":49131,"./ss":85893,"./ss.js":85893,"./sv":98760,"./sv.js":98760,"./sw":91172,"./sw.js":91172,"./ta":27333,"./ta.js":27333,"./te":23110,"./te.js":23110,"./tet":52095,"./tet.js":52095,"./tg":27321,"./tg.js":27321,"./th":9041,"./th.js":9041,"./tk":19005,"./tk.js":19005,"./tl-ph":75768,"./tl-ph.js":75768,"./tlh":89444,"./tlh.js":89444,"./tr":72397,"./tr.js":72397,"./tzl":28254,"./tzl.js":28254,"./tzm":51106,"./tzm-latn":30699,"./tzm-latn.js":30699,"./tzm.js":51106,"./ug-cn":9288,"./ug-cn.js":9288,"./uk":67691,"./uk.js":67691,"./ur":13795,"./ur.js":13795,"./uz":6791,"./uz-latn":60588,"./uz-latn.js":60588,"./uz.js":6791,"./vi":65666,"./vi.js":65666,"./x-pseudo":14378,"./x-pseudo.js":14378,"./yo":75805,"./yo.js":75805,"./zh-cn":83839,"./zh-cn.js":83839,"./zh-hk":55726,"./zh-hk.js":55726,"./zh-mo":99807,"./zh-mo.js":99807,"./zh-tw":74152,"./zh-tw.js":74152};function n(e){var t=a(e);return r(t)}function a(e){if(!r.o(s,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return s[e]}n.keys=function(){return Object.keys(s)},n.resolve=a,e.exports=n,n.id=46700}},n={};function a(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={id:e,loaded:!1,exports:{}};return s[e].call(r.exports,r,r.exports,a),r.loaded=!0,r.exports}a.m=s,e=[],a.O=(t,r,s,n)=>{if(!r){var o=1/0;for(d=0;d<e.length;d++){r=e[d][0],s=e[d][1],n=e[d][2];for(var i=!0,l=0;l<r.length;l++)(!1&n||o>=n)&&Object.keys(a.O).every((e=>a.O[e](r[l])))?r.splice(l--,1):(i=!1,n<o&&(o=n));if(i){e.splice(d--,1);var c=s();void 0!==c&&(t=c)}}return t}n=n||0;for(var d=e.length;d>0&&e[d-1][2]>n;d--)e[d]=e[d-1];e[d]=[r,s,n]},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=00434e4baa0d8e7b79f1",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,s,n,o)=>{if(t[e])t[e].push(s);else{var i,l;if(void 0!==n)for(var c=document.getElementsByTagName("script"),d=0;d<c.length;d++){var u=c[d];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==r+n){i=u;break}}i||(l=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.setAttribute("data-webpack",r+n),i.src=e),t[e]=[s];var m=(r,s)=>{i.onerror=i.onload=null,clearTimeout(f);var n=t[e];if(delete t[e],i.parentNode&&i.parentNode.removeChild(i),n&&n.forEach((e=>e(s))),r)return r(s)},f=setTimeout(m.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=m.bind(null,i.onerror),i.onload=m.bind(null,i.onload),l&&document.head.appendChild(i)}},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=5265,(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");r.length&&(e=r[r.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{a.b=document.baseURI||self.location.href;var e={5265:0};a.f.j=(t,r)=>{var s=a.o(e,t)?e[t]:void 0;if(0!==s)if(s)r.push(s[2]);else{var n=new Promise(((r,n)=>s=e[t]=[r,n]));r.push(s[2]=n);var o=a.p+a.u(t),i=new Error;a.l(o,(r=>{if(a.o(e,t)&&(0!==(s=e[t])&&(e[t]=void 0),s)){var n=r&&("load"===r.type?"missing":r.type),o=r&&r.target&&r.target.src;i.message="Loading chunk "+t+" failed.\n("+n+": "+o+")",i.name="ChunkLoadError",i.type=n,i.request=o,s[1](i)}}),"chunk-"+t,t)}},a.O.j=t=>0===e[t];var t=(t,r)=>{var s,n,o=r[0],i=r[1],l=r[2],c=0;if(o.some((t=>0!==e[t]))){for(s in i)a.o(i,s)&&(a.m[s]=i[s]);if(l)var d=l(a)}for(t&&t(r);c<o.length;c++)n=o[c],a.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return a.O(d)},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 o=a.O(void 0,[7874],(()=>a(7552)));o=a.O(o)})();
- //# sourceMappingURL=files_reminders-main.js.map?v=7c9303bed8a7c09792f8
|