UNPKG

jobsys-explore

Version:

Enhanced component based on vant

47 lines (46 loc) 1.41 kB
let o = []; const u = { beforeMount(e, n) { let { value: i } = n; const { arg: t } = n; if (!i) return; (typeof i == "string" || i instanceof String) && (i = [i]); let [s, f] = i; f || (f = o), (typeof s == "string" || s instanceof String) && (s = [s]), t === void 0 || t === "all" ? s.every((r) => f.includes(r)) || (e.style.display = "none") : t === "any" ? s.some((r) => f.includes(r)) || (e.style.display = "none") : t === "none" && s.some((r) => f.includes(r)) && (e.style.display = "none"); } }; function a(e) { o = e; } function l(e, n) { if (!e) return !0; (typeof e == "string" || e instanceof String) && (e = [e]); let [i, t] = e; if (t || (t = o), (typeof i == "string" || i instanceof String) && (i = [i]), n === void 0 || n === "all") { if (!i.every((s) => t.includes(s))) return !1; } else if (n === "any") { if (!i.some((s) => t.includes(s))) return !1; } else if (n === "none" && i.some((s) => t.includes(s))) return !1; return !0; } const c = { /** * * @param app * @param {Object} [options] * @param {Object} [options.defaultPermissions] */ install(e, n) { e.directive("auth", u), e.config.globalProperties.$auth = l, e.provide("auth", l), n && n.defaultPermissions && a(n.defaultPermissions); } }; export { c as auth, a as setDefaultPermissions }; //# sourceMappingURL=directives.js.map