@das-fed/utils 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api-services/index.d.ts +1 -0
- package/api-services/index.js +2 -6964
- package/api-services/modules/app-manage.d.ts +2 -0
- package/api-services/modules/app-manage.js +3 -6964
- package/api-services/modules/authentication.d.ts +2 -0
- package/api-services/modules/authentication.js +3 -6964
- package/api-services/modules/bems.d.ts +6 -0
- package/api-services/modules/bems.js +6 -6967
- package/api-services/modules/contract.d.ts +2 -0
- package/api-services/modules/contract.js +3 -6964
- package/api-services/modules/duty-manage.d.ts +7 -0
- package/api-services/modules/duty-manage.js +7 -6968
- package/api-services/modules/enterpriseright.d.ts +2 -0
- package/api-services/modules/enterpriseright.js +3 -6964
- package/api-services/modules/file.d.ts +36 -0
- package/api-services/modules/file.js +380 -7040
- package/api-services/modules/gateway-edge.d.ts +2 -0
- package/api-services/modules/gateway-edge.js +3 -6964
- package/api-services/modules/index.d.ts +21 -0
- package/api-services/modules/index.js +445 -7105
- package/api-services/modules/iot.d.ts +15 -0
- package/api-services/modules/iot.js +16 -6977
- package/api-services/modules/justauth.d.ts +3 -0
- package/api-services/modules/justauth.js +4 -6965
- package/api-services/modules/knowledge.d.ts +2 -0
- package/api-services/modules/knowledge.js +3 -6964
- package/api-services/modules/link.d.ts +2 -0
- package/api-services/modules/link.js +3 -6964
- package/api-services/modules/permission.d.ts +2 -0
- package/api-services/modules/permission.js +3 -6964
- package/api-services/modules/platformManage.d.ts +14 -0
- package/api-services/modules/platformManage.js +10 -6971
- package/api-services/modules/portal.d.ts +2 -0
- package/api-services/modules/portal.js +3 -6964
- package/api-services/modules/space-manage.d.ts +2 -0
- package/api-services/modules/space-manage.js +3 -6964
- package/api-services/modules/super-admin.d.ts +8 -0
- package/api-services/modules/super-admin.js +6 -6967
- package/api-services/modules/supplier.d.ts +6 -0
- package/api-services/modules/supplier.js +5 -6966
- package/api-services/modules/supplychain-manage.d.ts +2 -0
- package/api-services/modules/supplychain-manage.js +3 -6964
- package/api-services/modules/systemConfiguration.d.ts +2 -0
- package/api-services/modules/systemConfiguration.js +3 -6964
- package/api-services/modules/tool.d.ts +2 -0
- package/api-services/modules/tool.js +3 -6964
- package/api-services/src/create-service.d.ts +2 -0
- package/api-services/src/create-service.js +2286 -6013
- package/api-services/src/sso.d.ts +29 -0
- package/api-services/src/sso.js +506 -669
- package/api-services/src/util.d.ts +1 -0
- package/api-services/src/util.js +243 -247
- package/atob/index.d.ts +2 -0
- package/common-info/getIframeUrl.d.ts +9 -0
- package/common-info/getIframeUrl.js +6 -11
- package/common-info/index.d.ts +42 -0
- package/common-info/index.js +104 -163
- package/common-info/setInfoFromUrl.d.ts +8 -0
- package/common-tools/arr-tools.d.ts +15 -0
- package/common-tools/date-format.d.ts +7 -0
- package/common-tools/get-url-params.d.ts +33 -0
- package/common-tools/get-url-params.js +1 -0
- package/common-tools/handle-data.d.ts +6 -0
- package/common-tools/index.d.ts +7 -0
- package/common-tools/index.js +7 -117
- package/common-tools/nest-tree-format.d.ts +30 -0
- package/common-tools/obj-tools.d.ts +7 -0
- package/common-tools/setHtmlMinWH.d.ts +5 -0
- package/common-tools/throttled.d.ts +7 -0
- package/config/index.d.ts +2 -0
- package/curring-http/index.d.ts +11 -0
- package/directive/auth.d.ts +8 -0
- package/directive/auth.js +32 -190
- package/directive/clickOutside.d.ts +5 -0
- package/directive/clickOutside.js +19 -21
- package/directive/hoverInside.d.ts +5 -0
- package/directive/hoverInside.js +13 -15
- package/directive/index.d.ts +3 -0
- package/directive/index.js +6 -260
- package/directive/utils.d.ts +7 -0
- package/dom-check-in/index.d.ts +6 -0
- package/dom-watcher/index.d.ts +25 -0
- package/hooks/popup-manager/use-zindex.d.ts +5 -0
- package/index.d.ts +2 -0
- package/index.js +2 -266
- package/load-js/index.d.ts +3 -0
- package/load-js/index.js +8 -12
- package/oss/index.d.ts +2 -0
- package/oss/index.js +8 -12
- package/package.json +5 -6
- package/pinyin-first-character/index.d.ts +2 -0
- package/process-engine-info/index.d.ts +10 -0
- package/pure-image-src/index.d.ts +2 -0
- package/set-personal-info/index.d.ts +5 -0
- package/set-personal-info/index.js +516 -622
- package/size-watcher/index.d.ts +6 -0
- package/style/index.d.ts +2 -0
- package/style/math.d.ts +9 -0
- package/style/style.d.ts +30 -0
- package/token-tools/index.d.ts +18 -0
- package/token-tools/index.js +60 -1579
- package/vue/hooks/use-model-value.d.ts +3 -0
- package/vue/index.d.ts +1 -0
- package/vue/index.js +2 -8
- package/webSocket-service/index.d.ts +40 -0
- package/webSocket-service/index.js +35 -138
- package/with-install/index.d.ts +10 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 过滤掉叶子节点,返回嵌套数组
|
|
3
|
+
* @param arr 要过滤的树
|
|
4
|
+
* @param children 子节点指定字段名,默认‘children’
|
|
5
|
+
* @returns 返回过滤掉叶子节点的嵌套数组
|
|
6
|
+
*/
|
|
7
|
+
export declare const findNonEmptyChildrenItems: (arr: any[], children?: string) => any[];
|
|
8
|
+
/**
|
|
9
|
+
* 树形数组转扁平数组
|
|
10
|
+
* @param list 要拍平的树
|
|
11
|
+
* @param child 子节点指定字段名,默认‘children’
|
|
12
|
+
* @param deleteChild 是否删除children字段,默认为true
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare const flatTree: (list: any[], child?: string, deleteChild?: boolean) => any[];
|
|
16
|
+
/**
|
|
17
|
+
* 根据条件过滤节点
|
|
18
|
+
* @param tree 要过滤的树
|
|
19
|
+
* @param predicate 过滤条件,符合条件的节点保留
|
|
20
|
+
* @param children 子节点指定字段名,默认‘children’
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
export declare const filterTreeArray: (tree: any[], predicate: (node: any) => boolean, children?: string) => any[];
|
|
24
|
+
/**
|
|
25
|
+
* 树结构查找节点,深度优先
|
|
26
|
+
* @param tree 要过滤的树
|
|
27
|
+
* @param func 过滤条件,符合条件的节点保留(参数为函数,返回值为布尔值)
|
|
28
|
+
* @returns 查找到的节点
|
|
29
|
+
*/
|
|
30
|
+
export declare const treeFind: (tree: any[], func: (node: any) => boolean) => any;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Ref, ComputedRef } from 'vue';
|
|
2
|
+
import type { CurringConfigFun, CurringConfig, CurringRes } from './type';
|
|
3
|
+
/** 第一层(接入层):接收封装后的axios实例,第二个参数是全局请求配置,配置项参考AxiosRequestConfig */
|
|
4
|
+
declare const curringHttp: (axiosInstance: any, globalConfig?: CurringConfigFun) => {
|
|
5
|
+
get: (url: string | Ref | ComputedRef, urlConfig?: CurringConfigFun) => (payload?: any, payloadConfig?: CurringConfig) => CurringRes;
|
|
6
|
+
post: (url: string | Ref | ComputedRef, urlConfig?: CurringConfigFun) => (payload?: any, payloadConfig?: CurringConfig) => CurringRes;
|
|
7
|
+
put: (url: string | Ref | ComputedRef, urlConfig?: CurringConfigFun) => (payload?: any, payloadConfig?: CurringConfig) => CurringRes;
|
|
8
|
+
patch: (url: string | Ref | ComputedRef, urlConfig?: CurringConfigFun) => (payload?: any, payloadConfig?: CurringConfig) => CurringRes;
|
|
9
|
+
delete: (url: string | Ref | ComputedRef, urlConfig?: CurringConfigFun) => (payload?: any, payloadConfig?: CurringConfig) => CurringRes;
|
|
10
|
+
};
|
|
11
|
+
export { curringHttp };
|
package/directive/auth.js
CHANGED
|
@@ -1,165 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const n = e.indexOf("?");
|
|
6
|
-
n !== -1 ? r = e.slice(n) : r = "";
|
|
7
|
-
}
|
|
8
|
-
const s = new URLSearchParams(r);
|
|
9
|
-
if (t)
|
|
10
|
-
return s.get(t);
|
|
11
|
-
{
|
|
12
|
-
let n = {};
|
|
13
|
-
for (let [c, o] of s.entries())
|
|
14
|
-
n[c] = o;
|
|
15
|
-
return n;
|
|
16
|
-
}
|
|
17
|
-
}, C = (e, t = "children", r = !0) => Array.isArray(e) && e.length ? e.reduce((s, n) => {
|
|
18
|
-
let c = n[t], o = { ...n };
|
|
19
|
-
return r && delete o[t], c && c.length ? s.concat(o, C(c, t, r)) : s.concat(o);
|
|
20
|
-
}, []) : [];
|
|
21
|
-
/*! js-cookie v3.0.5 | MIT */
|
|
22
|
-
function d(e) {
|
|
23
|
-
for (var t = 1; t < arguments.length; t++) {
|
|
24
|
-
var r = arguments[t];
|
|
25
|
-
for (var s in r)
|
|
26
|
-
e[s] = r[s];
|
|
27
|
-
}
|
|
28
|
-
return e;
|
|
29
|
-
}
|
|
30
|
-
var w = {
|
|
31
|
-
read: function(e) {
|
|
32
|
-
return e[0] === '"' && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
33
|
-
},
|
|
34
|
-
write: function(e) {
|
|
35
|
-
return encodeURIComponent(e).replace(
|
|
36
|
-
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
|
|
37
|
-
decodeURIComponent
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
function g(e, t) {
|
|
42
|
-
function r(n, c, o) {
|
|
43
|
-
if (!(typeof document > "u")) {
|
|
44
|
-
o = d({}, t, o), typeof o.expires == "number" && (o.expires = new Date(Date.now() + o.expires * 864e5)), o.expires && (o.expires = o.expires.toUTCString()), n = encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
45
|
-
var a = "";
|
|
46
|
-
for (var i in o)
|
|
47
|
-
o[i] && (a += "; " + i, o[i] !== !0 && (a += "=" + o[i].split(";")[0]));
|
|
48
|
-
return document.cookie = n + "=" + e.write(c, n) + a;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
function s(n) {
|
|
52
|
-
if (!(typeof document > "u" || arguments.length && !n)) {
|
|
53
|
-
for (var c = document.cookie ? document.cookie.split("; ") : [], o = {}, a = 0; a < c.length; a++) {
|
|
54
|
-
var i = c[a].split("="), u = i.slice(1).join("=");
|
|
55
|
-
try {
|
|
56
|
-
var f = decodeURIComponent(i[0]);
|
|
57
|
-
if (o[f] = e.read(u, f), n === f)
|
|
58
|
-
break;
|
|
59
|
-
} catch {
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return n ? o[n] : o;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return Object.create(
|
|
66
|
-
{
|
|
67
|
-
set: r,
|
|
68
|
-
get: s,
|
|
69
|
-
remove: function(n, c) {
|
|
70
|
-
r(
|
|
71
|
-
n,
|
|
72
|
-
"",
|
|
73
|
-
d({}, c, {
|
|
74
|
-
expires: -1
|
|
75
|
-
})
|
|
76
|
-
);
|
|
77
|
-
},
|
|
78
|
-
withAttributes: function(n) {
|
|
79
|
-
return g(this.converter, d({}, this.attributes, n));
|
|
80
|
-
},
|
|
81
|
-
withConverter: function(n) {
|
|
82
|
-
return g(d({}, this.converter, n), this.attributes);
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
attributes: { value: Object.freeze(t) },
|
|
87
|
-
converter: { value: Object.freeze(e) }
|
|
88
|
-
}
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
var h = g(w, { path: "/" });
|
|
92
|
-
const y = (e) => {
|
|
93
|
-
var t = encodeURIComponent(e);
|
|
94
|
-
return t = btoa(t), t;
|
|
95
|
-
}, I = () => {
|
|
96
|
-
let t = { ...(window == null ? void 0 : window.config) || {} };
|
|
97
|
-
t.rootContainer || (t.rootContainer = "#app"), t.baseURL || (t.baseURL = location.origin), t.ossBaseURL || (t.ossBaseURL = "/oss"), t.ossBaseURL.startsWith("/") && (t.ossBaseURL = `${t.baseURL}/oss`), t.ssoBaseURL || (t.ssoBaseURL = t.baseURL);
|
|
98
|
-
let { microAppName: r, publicPath: s, mainAppName: n } = t;
|
|
99
|
-
return r && !0 && !s && (s = `/${r}/`.replace(/\/\//g, "/")), s || (s = "/"), t.publicPath = s, t.autoOssBucket || (t.autoOssBucket = n || r), t;
|
|
100
|
-
};
|
|
101
|
-
S(!1);
|
|
102
|
-
I();
|
|
103
|
-
y("das123"), +/* @__PURE__ */ new Date();
|
|
104
|
-
const P = () => {
|
|
105
|
-
const e = new URL(location.href).searchParams, t = e.get("token") || e.get("accessToken") || e.get("accesstoken") || "";
|
|
106
|
-
if (t) {
|
|
107
|
-
const r = JSON.stringify({ access_token: t });
|
|
108
|
-
sessionStorage.setItem("accessToken", t), sessionStorage.setItem("tokenInfo", r), h.set("accessToken", t), h.set("accessTokenInfo", r);
|
|
109
|
-
}
|
|
110
|
-
}, R = () => {
|
|
111
|
-
const e = JSON.parse(sessionStorage.getItem("projectInfo") || "{}"), t = new URL(location.href).searchParams, r = t.get("project") || t.get("projectId") || "";
|
|
112
|
-
if (!r)
|
|
113
|
-
return;
|
|
114
|
-
const s = t.get("projectParent") || t.get("projectParentId") || (e == null ? void 0 : e.parentId) || "", n = t.get("projectName") || (e == null ? void 0 : e.name) || "";
|
|
115
|
-
sessionStorage.setItem("project", r), sessionStorage.setItem("projectInfo", JSON.stringify({ ...e, id: r, name: n, parentId: s }));
|
|
116
|
-
}, U = () => h.get("accessToken") ?? "", m = (e, t) => {
|
|
117
|
-
const r = "permission-btn", s = I(), n = v(), c = p(location.href, "app") || "", o = t || c || (window.__IN_MICRO_APP__ ? n.currentSubAppCode : s.title);
|
|
118
|
-
if (!o)
|
|
119
|
-
return;
|
|
120
|
-
const a = p(location.href, "menu") || "", i = e || a || (window.__IN_MICRO_APP__ ? n.currentSubApp.currentMenuCode : JSON.parse(sessionStorage.getItem(`${s.title}-tabs`) || "{}").currentTab.code), u = JSON.parse(sessionStorage.getItem(r) || "{}");
|
|
121
|
-
if (!u || JSON.stringify(u) === "{}")
|
|
122
|
-
return;
|
|
123
|
-
const f = u[o][i];
|
|
124
|
-
return f && f.length ? f : u[o]["origin-auth"] ? u[o]["origin-auth"][i] ?? [] : [];
|
|
125
|
-
}, v = () => {
|
|
126
|
-
var s;
|
|
127
|
-
if (!window.__IN_MICRO_APP__)
|
|
128
|
-
return {};
|
|
129
|
-
const e = JSON.parse(sessionStorage.getItem("subApps") || "{}"), t = ((s = e.appcategorys) == null ? void 0 : s.map((n) => n.apps).flat()) ?? [];
|
|
130
|
-
return {
|
|
131
|
-
appcategorys: e.appcategorys ?? [],
|
|
132
|
-
currentSubApp: e.currentSubApp ?? {},
|
|
133
|
-
currentSubAppCode: e.currentSubAppCode ?? "",
|
|
134
|
-
flatSubAppList: t,
|
|
135
|
-
subAppList: e.subAppList ?? []
|
|
136
|
-
};
|
|
137
|
-
}, L = () => {
|
|
138
|
-
const e = I();
|
|
139
|
-
let t = {};
|
|
140
|
-
if (window.__IN_MICRO_APP__) {
|
|
141
|
-
const r = JSON.parse(sessionStorage.getItem("tabs") || "{}");
|
|
142
|
-
t = {
|
|
143
|
-
activeKey: r.activeKey ?? "",
|
|
144
|
-
currentTab: r.currentTab ?? {},
|
|
145
|
-
tabMap: r.tabMap ?? {}
|
|
146
|
-
};
|
|
147
|
-
} else {
|
|
148
|
-
const r = JSON.parse(sessionStorage.getItem(`${e.title}-tabs`) || "{}");
|
|
149
|
-
t = {
|
|
150
|
-
activeKey: r.activeKey ?? "",
|
|
151
|
-
currentTab: r.currentTab ?? {},
|
|
152
|
-
tabList: r.tabList ?? []
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
return t;
|
|
156
|
-
};
|
|
157
|
-
U() || P();
|
|
158
|
-
R();
|
|
159
|
-
const b = async (e, t) => {
|
|
160
|
-
let r = e;
|
|
161
|
-
return t != null && t.target && (typeof t.target == "string" && (r = t.target), typeof t.target == "function" && (r = await t.target(e))), r;
|
|
162
|
-
}, k = (e, t) => {
|
|
1
|
+
import { getUrlParams as g, flatTree as P } from "@das-fed/utils/common-tools";
|
|
2
|
+
import { getSubApps as v, getPageAuth as i } from "@das-fed/utils/common-info";
|
|
3
|
+
import { getEl as o } from "@das-fed/utils/directive/utils";
|
|
4
|
+
const A = (e, t) => {
|
|
163
5
|
if (!e || !t)
|
|
164
6
|
return !1;
|
|
165
7
|
if (typeof t == "string")
|
|
@@ -167,56 +9,56 @@ const b = async (e, t) => {
|
|
|
167
9
|
{
|
|
168
10
|
let r = !1;
|
|
169
11
|
for (let s of t)
|
|
170
|
-
if (e.find((
|
|
12
|
+
if (e.find((a) => a.code === s)) {
|
|
171
13
|
r = !0;
|
|
172
14
|
break;
|
|
173
15
|
}
|
|
174
16
|
return r;
|
|
175
17
|
}
|
|
176
|
-
},
|
|
177
|
-
var
|
|
18
|
+
}, h = (e) => {
|
|
19
|
+
var d;
|
|
178
20
|
const t = (e == null ? void 0 : e.code) ?? "", r = (e == null ? void 0 : e.path) ?? location.pathname, s = (e == null ? void 0 : e.applicationCode) ?? "";
|
|
179
|
-
let
|
|
180
|
-
if (
|
|
181
|
-
const
|
|
182
|
-
if (
|
|
183
|
-
const
|
|
184
|
-
if (
|
|
185
|
-
const f =
|
|
186
|
-
f && (
|
|
21
|
+
let l = "";
|
|
22
|
+
if (l = e != null && e.menuCode ? e.menuCode : g(location.href, "menu"), !l) {
|
|
23
|
+
const c = ((d = v().currentSubApp) == null ? void 0 : d.menus) ?? [];
|
|
24
|
+
if (c && c.length) {
|
|
25
|
+
const n = P(c).filter((f) => f == null ? void 0 : f.routeUrl);
|
|
26
|
+
if (n && n.length) {
|
|
27
|
+
const f = n.find((u) => u != null && u.applicationPath ? r == null ? void 0 : r.includes("/" + u.applicationPath + u.routeUrl) : r == null ? void 0 : r.includes(u.routeUrl));
|
|
28
|
+
f && (l = (f == null ? void 0 : f.code) ?? "");
|
|
187
29
|
}
|
|
188
30
|
}
|
|
189
31
|
}
|
|
190
|
-
let
|
|
32
|
+
let a = !1;
|
|
191
33
|
if (t) {
|
|
192
|
-
const
|
|
193
|
-
|
|
34
|
+
const c = i(l, s) ?? [];
|
|
35
|
+
a = A(c, t);
|
|
194
36
|
} else
|
|
195
|
-
|
|
196
|
-
return
|
|
197
|
-
},
|
|
37
|
+
a = !!i(l, s);
|
|
38
|
+
return a;
|
|
39
|
+
}, m = (e, t) => {
|
|
198
40
|
t === "hide" ? e.classList.add("is-hide") : (e.setAttribute("disabled", ""), e.classList.add("is-disabled"));
|
|
199
|
-
},
|
|
41
|
+
}, b = (e, t) => {
|
|
200
42
|
t === "hide" ? e.classList.remove("is-hide") : (e.removeAttribute("disabled"), e.classList.remove("is-disabled"));
|
|
201
|
-
},
|
|
43
|
+
}, U = (e, t) => {
|
|
202
44
|
let r = (e ? t.value : t) || {};
|
|
203
45
|
typeof r == "string" && (r = { code: r });
|
|
204
|
-
const s = (r == null ? void 0 : r.type) ?? "hide",
|
|
46
|
+
const s = (r == null ? void 0 : r.type) ?? "hide", l = h(r);
|
|
205
47
|
if (e)
|
|
206
48
|
if (!t.oldValue)
|
|
207
|
-
|
|
208
|
-
|
|
49
|
+
l || o(e, r).then((a) => {
|
|
50
|
+
m(a, s);
|
|
209
51
|
});
|
|
210
52
|
else {
|
|
211
|
-
const
|
|
212
|
-
if (
|
|
53
|
+
const a = h(t.oldValue), d = l;
|
|
54
|
+
if (a === d)
|
|
213
55
|
return;
|
|
214
|
-
|
|
215
|
-
|
|
56
|
+
o(e, r).then((c) => {
|
|
57
|
+
d ? b(c, s) : m(c, s);
|
|
216
58
|
});
|
|
217
59
|
}
|
|
218
|
-
return
|
|
60
|
+
return l;
|
|
219
61
|
};
|
|
220
62
|
export {
|
|
221
|
-
|
|
63
|
+
U as vAuth
|
|
222
64
|
};
|
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
for (let f of c)
|
|
11
|
-
f.__click_outside__ = a, f.contains(_.target) && (i = !1);
|
|
1
|
+
import { getEl as r } from "@das-fed/utils/directive/utils";
|
|
2
|
+
const f = {
|
|
3
|
+
mounted: async (i, _) => {
|
|
4
|
+
const e = _.value, t = await r(i, e);
|
|
5
|
+
function c(n) {
|
|
6
|
+
let l = !0;
|
|
7
|
+
if (Array.isArray(t))
|
|
8
|
+
for (let o of t)
|
|
9
|
+
o.__click_outside__ = c, o.contains(n.target) && (l = !1);
|
|
12
10
|
else
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
t.contains(n.target) && (l = !1), t.__click_outside__ = c;
|
|
12
|
+
l && e != null && e.fn && typeof (e == null ? void 0 : e.fn) == "function" && (e == null || e.fn(n));
|
|
15
13
|
}
|
|
16
|
-
document.addEventListener("click",
|
|
14
|
+
document.addEventListener("click", c);
|
|
17
15
|
},
|
|
18
|
-
beforeUnmount: async (
|
|
19
|
-
const e =
|
|
20
|
-
if (Array.isArray(
|
|
21
|
-
for (let
|
|
22
|
-
document.removeEventListener("click",
|
|
16
|
+
beforeUnmount: async (i, _) => {
|
|
17
|
+
const e = _.value, t = await r(i, e);
|
|
18
|
+
if (Array.isArray(t))
|
|
19
|
+
for (let c of t)
|
|
20
|
+
document.removeEventListener("click", c.__click_outside__), delete c.__click_outside__;
|
|
23
21
|
else
|
|
24
|
-
document.removeEventListener("click",
|
|
22
|
+
document.removeEventListener("click", t.__click_outside__), delete t.__click_outside__;
|
|
25
23
|
}
|
|
26
24
|
};
|
|
27
25
|
export {
|
|
28
|
-
|
|
26
|
+
f as vClickOutside
|
|
29
27
|
};
|
package/directive/hoverInside.js
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function f(r, d) {
|
|
8
|
-
n._inside_event = f, typeof e == "function" ? e(r, d) : e != null && e.fn && typeof (e == null ? void 0 : e.fn) == "function" && (e == null || e.fn(r, d));
|
|
1
|
+
import { getEl as r } from "@das-fed/utils/directive/utils";
|
|
2
|
+
const o = {
|
|
3
|
+
mounted: async (s, a) => {
|
|
4
|
+
const e = a.value, n = await r(s, e);
|
|
5
|
+
function i(t, d) {
|
|
6
|
+
n._inside_event = i, typeof e == "function" ? e(t, d) : e != null && e.fn && typeof (e == null ? void 0 : e.fn) == "function" && (e == null || e.fn(t, d));
|
|
9
7
|
}
|
|
10
|
-
n.addEventListener("mouseenter", (
|
|
11
|
-
|
|
12
|
-
}), n.addEventListener("mouseleave", (
|
|
13
|
-
|
|
8
|
+
n.addEventListener("mouseenter", (t) => {
|
|
9
|
+
i(!0, t);
|
|
10
|
+
}), n.addEventListener("mouseleave", (t) => {
|
|
11
|
+
i(!1, t);
|
|
14
12
|
});
|
|
15
13
|
},
|
|
16
|
-
beforeUnmount: async (
|
|
17
|
-
const e =
|
|
14
|
+
beforeUnmount: async (s, a) => {
|
|
15
|
+
const e = a.value, n = await r(s, e);
|
|
18
16
|
n.addEventListener("mouseenter", n._inside_event), n.addEventListener("mouseleave", n._inside_event), delete n._inside_event;
|
|
19
17
|
}
|
|
20
18
|
};
|
|
21
19
|
export {
|
|
22
|
-
|
|
20
|
+
o as vHoverInside
|
|
23
21
|
};
|