-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
1 lines (1 loc) · 2.69 KB
/
index.js
1
(function(){"use strict";var f=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("k-field",{staticClass:"k-recentlymodified-field",attrs:{help:e.help,label:e.label,when:e.when}},[i("k-box",{staticClass:"recentlymodified-text",attrs:{theme:e.dynTheme,name:"textfield",text:e.dynText}})],1)},v=[],F="";function l(e,t,i,T,r,h,c,M){var n=typeof e=="function"?e.options:e;t&&(n.render=t,n.staticRenderFns=i,n._compiled=!0),T&&(n.functional=!0),h&&(n._scopeId="data-v-"+h);var a;if(c?(a=function(s){s=s||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!s&&typeof __VUE_SSR_CONTEXT__!="undefined"&&(s=__VUE_SSR_CONTEXT__),r&&r.call(this,s),s&&s._registeredComponents&&s._registeredComponents.add(c)},n._ssrRegister=a):r&&(a=M?function(){r.call(this,(n.functional?this.parent:this).$root.$options.shadowRoot)}:r),a)if(n.functional){n._injectStyles=a;var w=n.render;n.render=function(U,u){return a.call(u),w(U,u)}}else{var _=n.beforeCreate;n.beforeCreate=_?[].concat(_,a):[a]}return{exports:e,options:n}}const y={props:{help:String,label:String,when:String,theme:{type:String,default:"info"},loading:{type:Boolean,default:!1},interval:{type:Number,default:0}},data(){return{auser:void 0,datetime:void 0,hasUserChange:!1}},created(){this.syncContent(),this.interval>0&&setInterval(this.syncContent,this.interval*1e3)},watch:{hasChanges(){this.hasChanges||this.syncContent()}},computed:{hasChanges(){return this.$store.getters["content/hasChanges"]()},dynText(){return this.auser+", "+this.datetime},dynTheme(){return this.hasUserChange?"negative":this.hasChanges||this.loading?"notice":this.theme}},methods:{syncContent(){let e=this.$store.getters["content/id"]();this.$api.get("recentlymodified/field",{id:e.split("?")[0]}).then(t=>{this.auser!==void 0&&this.auser!==t.auser&&(this.hasUserChange=!0),this.auser=t.auser,this.datetime=t.datetime,this.loading=!1}).catch(t=>{this.loading=!1})}}},o={};var m=l(y,f,v,!1,p,null,null,null);function p(e){for(let t in o)this[t]=o[t]}var C=function(){return m.exports}(),g=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("section",{staticClass:"k-section k-links-section"},[i("header",{staticClass:"k-section-header"},[i("h2",{staticClass:"k-headline"},[e._v(e._s(e.headline))])]),i("k-collection",{attrs:{items:e.links,layout:e.layout}})],1)},$=[],x="";const k={data(){return{headline:"Recently Modified",layout:"list",links:[]}},created(){this.load().then(e=>{this.headline=e.headline,this.links=e.query})}},d={};var R=l(k,g,$,!1,S,null,null,null);function S(e){for(let t in d)this[t]=d[t]}var b=function(){return R.exports}();panel.plugin("bnomei/recently-modified",{fields:{recentlymodified:C},sections:{recentlymodified:b}})})();