@ozdao/prometheus-framework 0.2.185 → 0.2.187
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/prometheus-framework/src/modules/globals/globals.client.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/globals.client.js +10 -6
- package/dist/prometheus-framework/src/modules/globals/mixins/mixins.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/mixins/mixins.js +20 -16
- package/dist/prometheus-framework/src/modules/globals/router/routerGuards.cjs +1 -0
- package/dist/prometheus-framework/src/modules/globals/router/routerGuards.js +18 -0
- package/package.json +1 -1
- package/src/modules/globals/globals.client.js +4 -0
- package/src/modules/globals/mixins/mixins.js +0 -1
- package/src/modules/globals/router/routerGuards.js +1 -1
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./localization/methods/get-browser-locale.cjs"),r=require("./localization/vue-i18n.cjs"),o=require("./store/globals.cjs");exports.getBrowserLocale=e.default;exports.VueI18n=r.default;exports.
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./localization/methods/get-browser-locale.cjs"),r=require("./localization/vue-i18n.cjs"),t=require("./router/routerGuards.cjs"),o=require("./mixins/mixins.cjs"),u=require("./store/globals.cjs");exports.getBrowserLocale=e.default;exports.VueI18n=r.default;exports.routerGuards=t.default;exports.mixins=o;exports.globalStore=u;
|
@@ -1,8 +1,12 @@
|
|
1
|
-
import { default as
|
2
|
-
import { default as
|
3
|
-
import
|
1
|
+
import { default as t } from "./localization/methods/get-browser-locale.js";
|
2
|
+
import { default as f } from "./localization/vue-i18n.js";
|
3
|
+
import { default as m } from "./router/routerGuards.js";
|
4
|
+
import * as o from "./mixins/mixins.js";
|
5
|
+
import * as r from "./store/globals.js";
|
4
6
|
export {
|
5
|
-
|
6
|
-
|
7
|
-
|
7
|
+
f as VueI18n,
|
8
|
+
t as getBrowserLocale,
|
9
|
+
r as globalStore,
|
10
|
+
o as mixins,
|
11
|
+
m as routerGuards
|
8
12
|
};
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function m(){const y=t=>t?(t.includes("ROLE_ADMIN")?t.includes("ROLE_ADMIN"):!1)===!0:!1,d=(t,l,s,i)=>{const r=i.find(a=>a.organization===t);if(!r)return!1;const n=r.rights[l];return n?n[s]===!0:!1},u=()=>"฿",f=t=>{const l=u();return`${t.toFixed(2).replace(".",",").replace(/\B(?=(\d{3})+(?!\d))/g," ")} ${l}`},g=(t,l={})=>{var s=new Date(t),i=s.getFullYear().toString(),e=(s.getMonth()+1).toString(),r=s.getDate().toString(),n=s.getHours().toString(),a=s.getMinutes().toString(),o={dateOnly:l.dateOnly||!1,timeOnly:l.timeOnly||!1,dayMonth:l.dayMonth||!1,dayTime:l.dayTime||!1,monthYear:l.monthYear||!1,yearOnly:l.yearOnly||!1,custom:l.custom||""};return o.dateOnly?i+"."+(e[1]?e:"0"+e[0])+"."+(r[1]?r:"0"+r[0]):o.timeOnly?(n[1]?n:"0"+n[0])+":"+(a[1]?a:"0"+a[0]):o.dayMonth?(r[1]?r:"0"+r[0])+"."+(e[1]?e:"0"+e[0]):o.dayTime?(r[1]?r:"0"+r[0])+" в "+(n[1]?n:"0"+n[0])+":"+(a[1]?a:"0"+a[0]):o.monthYear?(e[1]?e:"0"+e[0])+"."+i:o.yearOnly?i:o.custom?o.custom.replace("yyyy",i).replace("mm",e[1]?e:"0"+e[0]).replace("dd",r[1]?r:"0"+r[0]).replace("hh",n[1]?n:"0"+n[0]).replace("min",a[1]?a:"0"+a[0]):(n[1]?n:"0"+n[0])+":"+(a[1]?a:"0"+a[0])+", "+i+"."+(e[1]?e:"0"+e[0])+"."+(r[1]?r:"0"+r[0])},c=t=>(t||(t=""),t.toLowerCase().replace(/ /g,"-").replace(/[^a-z0-9-]/g,""));return{isAdmin:y,hasAccess:d,returnCurrency:u,formatPrice:f,formatDate:g,normalizeUrlParam:c,joinArrayToUrl:t=>t.join("/"),getMarketplaceLink:(t,l,s,i)=>{let e=l?c(l):"",r=s?c(s):"",n=i?c(i):"",a="/marketplace";return a+=e?`/${e}`:"",a+=e&&r?`/${r}`:"",a+=e&&r&&n?`/${n}`:"",t&&t.length&&(a+=`?categories=${t.join(",")}`),a},getSpotsLink:(t,l,s)=>{let i=t?c(t):"",e=l?c(l):"",r=s?c(s):"",n="/spots";return n+=i?`/${i}`:"",n+=i&&e?`/${e}`:"",n+=i&&e&&r?`/${r}`:"",n}}}const h={methods:m()};exports.globalMixins=h;exports.useGlobalMixins=m;
|
@@ -1,15 +1,15 @@
|
|
1
|
-
function
|
2
|
-
const m = (t) => t ? (t.includes("ROLE_ADMIN") ? t.includes("ROLE_ADMIN") : !1) === !0 : !1, y = (t, l,
|
3
|
-
const r =
|
1
|
+
function g() {
|
2
|
+
const m = (t) => t ? (t.includes("ROLE_ADMIN") ? t.includes("ROLE_ADMIN") : !1) === !0 : !1, y = (t, l, i, s) => {
|
3
|
+
const r = s.find((a) => a.organization === t);
|
4
4
|
if (!r)
|
5
5
|
return !1;
|
6
6
|
const n = r.rights[l];
|
7
|
-
return n ? n[
|
8
|
-
}, u = () => "฿",
|
7
|
+
return n ? n[i] === !0 : !1;
|
8
|
+
}, u = () => "฿", d = (t) => {
|
9
9
|
const l = u();
|
10
10
|
return `${t.toFixed(2).replace(".", ",").replace(/\B(?=(\d{3})+(?!\d))/g, " ")} ${l}`;
|
11
|
-
},
|
12
|
-
var
|
11
|
+
}, f = (t, l = {}) => {
|
12
|
+
var i = new Date(t), s = i.getFullYear().toString(), e = (i.getMonth() + 1).toString(), r = i.getDate().toString(), n = i.getHours().toString(), a = i.getMinutes().toString(), c = {
|
13
13
|
dateOnly: l.dateOnly || !1,
|
14
14
|
timeOnly: l.timeOnly || !1,
|
15
15
|
dayMonth: l.dayMonth || !1,
|
@@ -18,26 +18,30 @@ function O() {
|
|
18
18
|
yearOnly: l.yearOnly || !1,
|
19
19
|
custom: l.custom || ""
|
20
20
|
};
|
21
|
-
return c.dateOnly ?
|
21
|
+
return c.dateOnly ? s + "." + (e[1] ? e : "0" + e[0]) + "." + (r[1] ? r : "0" + r[0]) : c.timeOnly ? (n[1] ? n : "0" + n[0]) + ":" + (a[1] ? a : "0" + a[0]) : c.dayMonth ? (r[1] ? r : "0" + r[0]) + "." + (e[1] ? e : "0" + e[0]) : c.dayTime ? (r[1] ? r : "0" + r[0]) + " в " + (n[1] ? n : "0" + n[0]) + ":" + (a[1] ? a : "0" + a[0]) : c.monthYear ? (e[1] ? e : "0" + e[0]) + "." + s : c.yearOnly ? s : c.custom ? c.custom.replace("yyyy", s).replace("mm", e[1] ? e : "0" + e[0]).replace("dd", r[1] ? r : "0" + r[0]).replace("hh", n[1] ? n : "0" + n[0]).replace("min", a[1] ? a : "0" + a[0]) : (n[1] ? n : "0" + n[0]) + ":" + (a[1] ? a : "0" + a[0]) + ", " + s + "." + (e[1] ? e : "0" + e[0]) + "." + (r[1] ? r : "0" + r[0]);
|
22
22
|
}, o = (t) => (t || (t = ""), t.toLowerCase().replace(/ /g, "-").replace(/[^a-z0-9-]/g, ""));
|
23
23
|
return {
|
24
24
|
isAdmin: m,
|
25
25
|
hasAccess: y,
|
26
26
|
returnCurrency: u,
|
27
|
-
formatPrice:
|
28
|
-
formatDate:
|
27
|
+
formatPrice: d,
|
28
|
+
formatDate: f,
|
29
29
|
normalizeUrlParam: o,
|
30
30
|
joinArrayToUrl: (t) => t.join("/"),
|
31
|
-
getMarketplaceLink: (t, l,
|
32
|
-
let e = l ? o(l) : "", r =
|
31
|
+
getMarketplaceLink: (t, l, i, s) => {
|
32
|
+
let e = l ? o(l) : "", r = i ? o(i) : "", n = s ? o(s) : "", a = "/marketplace";
|
33
33
|
return a += e ? `/${e}` : "", a += e && r ? `/${r}` : "", a += e && r && n ? `/${n}` : "", t && t.length && (a += `?categories=${t.join(",")}`), a;
|
34
34
|
},
|
35
|
-
getSpotsLink: (t, l,
|
36
|
-
let
|
37
|
-
return n +=
|
35
|
+
getSpotsLink: (t, l, i) => {
|
36
|
+
let s = t ? o(t) : "", e = l ? o(l) : "", r = i ? o(i) : "", n = "/spots";
|
37
|
+
return n += s ? `/${s}` : "", n += s && e ? `/${e}` : "", n += s && e && r ? `/${r}` : "", n;
|
38
38
|
}
|
39
39
|
};
|
40
40
|
}
|
41
|
+
const O = {
|
42
|
+
methods: g()
|
43
|
+
};
|
41
44
|
export {
|
42
|
-
O as
|
45
|
+
O as globalMixins,
|
46
|
+
g as useGlobalMixins
|
43
47
|
};
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function c(u,s,r,i){u.beforeEach((t,n,e)=>{const{authorize:l}=t.meta;if(l){if(s.auth.state.access.status===!1)return e({path:"/auth/signin",query:{returnUrl:t.path}});if(l.length&&!l.some(o=>s.auth.state.access.roles.includes(o)))return e({path:"/auth/signin"})}const a=t.params.locale;if(r.config.globalProperties.$i18n.locale!==a&&a&&Object.keys(i.global.availableLocales).includes(a))return r.config.globalProperties.$i18n.locale=a,e();e()})}exports.default=c;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
function n(i, t, r, o) {
|
2
|
+
i.beforeEach((l, u, a) => {
|
3
|
+
const { authorize: s } = l.meta;
|
4
|
+
if (s) {
|
5
|
+
if (t.auth.state.access.status === !1)
|
6
|
+
return a({ path: "/auth/signin", query: { returnUrl: l.path } });
|
7
|
+
if (s.length && !s.some((c) => t.auth.state.access.roles.includes(c)))
|
8
|
+
return a({ path: "/auth/signin" });
|
9
|
+
}
|
10
|
+
const e = l.params.locale;
|
11
|
+
if (r.config.globalProperties.$i18n.locale !== e && e && Object.keys(o.global.availableLocales).includes(e))
|
12
|
+
return r.config.globalProperties.$i18n.locale = e, a();
|
13
|
+
a();
|
14
|
+
});
|
15
|
+
}
|
16
|
+
export {
|
17
|
+
n as default
|
18
|
+
};
|
package/package.json
CHANGED
@@ -3,11 +3,15 @@
|
|
3
3
|
|
4
4
|
import getBrowserLocale from './localization/methods/get-browser-locale.js';
|
5
5
|
import VueI18n from './localization/vue-i18n.js';
|
6
|
+
import routerGuards from './router/routerGuards.js';
|
6
7
|
|
8
|
+
import * as mixins from './mixins/mixins.js'
|
7
9
|
import * as globalStore from './store/globals.js';
|
8
10
|
|
9
11
|
export {
|
10
12
|
// Client,
|
13
|
+
mixins,
|
14
|
+
routerGuards,
|
11
15
|
getBrowserLocale,
|
12
16
|
VueI18n,
|
13
17
|
globalStore
|