@witlink/components 0.0.3 → 0.0.4

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/dist/utils.js ADDED
@@ -0,0 +1,199 @@
1
+ const y = Object.prototype.toString;
2
+ function i(n, t) {
3
+ return y.call(n) === `[object ${t}]`;
4
+ }
5
+ function h(n) {
6
+ return i(n, "Function");
7
+ }
8
+ const U = (n) => typeof n < "u", w = (n) => !U(n), O = (n) => n !== null && i(n, "Object");
9
+ function M(n) {
10
+ return i(n, "Date");
11
+ }
12
+ function L(n) {
13
+ return i(n, "Number");
14
+ }
15
+ function K(n) {
16
+ return i(n, "AsyncFunction");
17
+ }
18
+ function R(n) {
19
+ return i(n, "Promise") && h(n.then) && h(n.catch);
20
+ }
21
+ function v(n) {
22
+ return i(n, "String");
23
+ }
24
+ function F(n) {
25
+ return i(n, "Boolean");
26
+ }
27
+ function J(n) {
28
+ return n && Array.isArray(n);
29
+ }
30
+ const T = () => typeof window < "u", k = (n) => typeof window < "u" && i(n, "Window"), _ = (n) => O(n) && !!n.tagName, B = typeof window > "u";
31
+ function W(n) {
32
+ return n && ["IMAGE", "IMG"].includes(n.tagName);
33
+ }
34
+ function N(n) {
35
+ return n === null;
36
+ }
37
+ function D(n) {
38
+ return w(n) || N(n);
39
+ }
40
+ function Y(n) {
41
+ const { fileData: t = null, name: o = "" } = n || {};
42
+ if (t && typeof t == "object") {
43
+ const e = window.URL.createObjectURL(new Blob([t])), r = document.createElement("a");
44
+ r.style.display = "none", r.href = e, r.setAttribute("download", o), document.body.appendChild(r), r.click(), document.body.removeChild(r), window.URL.revokeObjectURL(e);
45
+ }
46
+ }
47
+ const p = "Witlink-Usercenter-QureyParams";
48
+ function m() {
49
+ const n = localStorage.getItem(p) || "{}", { token: t, lang: o, usercenterUrl: e } = JSON.parse(n);
50
+ return { token: t, lang: o, usercenterUrl: e };
51
+ }
52
+ function x(n) {
53
+ const t = m();
54
+ localStorage.setItem(
55
+ p,
56
+ JSON.stringify({ ...t, ...n })
57
+ );
58
+ }
59
+ function $() {
60
+ const n = window.location.href, t = {}, o = n.split("?")[1];
61
+ return o && o.split("&").forEach((e) => {
62
+ const [r, c] = e.split("=");
63
+ r && c && (t[r] = decodeURIComponent(c));
64
+ }), t;
65
+ }
66
+ const E = "Witlink-Usercenter";
67
+ function G() {
68
+ const { usercenterUrl: n } = m();
69
+ window.location.href = n;
70
+ }
71
+ function q() {
72
+ window.open(m().usercenterUrl, E), window.close();
73
+ }
74
+ const b = "", a = "ACCESS_TOKEN", l = "locale", g = "userInfo", d = "menuInfo";
75
+ function P(n) {
76
+ const t = new URL(n);
77
+ return t.hash && t.hash.startsWith("#/") ? `/${t.hash.substring(2).split("?")[0]}`.replace(/\/+/g, "/") : t.pathname;
78
+ }
79
+ function I(n, t = {}) {
80
+ const o = Array.isArray(n) ? n : [n];
81
+ for (const e of o) {
82
+ if (e.path && e.name !== void 0) {
83
+ const r = e.path.startsWith("/") ? e.path : `/${e.path}`;
84
+ t[r] = e.name.toString();
85
+ }
86
+ e.children && e.children.length > 0 && I(e.children, t);
87
+ }
88
+ return t;
89
+ }
90
+ function s(n) {
91
+ return b + n;
92
+ }
93
+ function z(n) {
94
+ localStorage.setItem(s(a), n);
95
+ }
96
+ function Q() {
97
+ return localStorage.getItem(s(a));
98
+ }
99
+ function X() {
100
+ localStorage.removeItem(s(a));
101
+ }
102
+ function H(n) {
103
+ localStorage.setItem(s(l), n);
104
+ }
105
+ function V() {
106
+ return localStorage.getItem(s(l));
107
+ }
108
+ function Z() {
109
+ localStorage.removeItem(s(l));
110
+ }
111
+ function nn(n = {}) {
112
+ n = { ...S() || {}, ...n }, localStorage.setItem(s(g), JSON.stringify(n));
113
+ }
114
+ function S(n) {
115
+ const t = localStorage.getItem(s(g));
116
+ if (n) {
117
+ if (typeof n == "string")
118
+ return (t ? JSON.parse(t) : {})[n] || null;
119
+ if (Array.isArray(n)) {
120
+ const o = t ? JSON.parse(t) : {}, e = {};
121
+ return n.forEach((r) => {
122
+ e[r] = o[r] || null;
123
+ }), e;
124
+ }
125
+ }
126
+ return t ? JSON.parse(t) : null;
127
+ }
128
+ function tn(n) {
129
+ localStorage.setItem(s(d), JSON.stringify(n));
130
+ }
131
+ function C() {
132
+ const n = localStorage.getItem(s(d));
133
+ return n ? JSON.parse(n) : null;
134
+ }
135
+ const f = {}, u = {};
136
+ function A() {
137
+ if (Object.keys(f).length === 0) {
138
+ const n = C() || [];
139
+ I(n, f);
140
+ }
141
+ return f;
142
+ }
143
+ function j() {
144
+ return Object.keys(u).length === 0 && ((S() || {}).role.permissions || []).forEach((o) => {
145
+ var e;
146
+ if (o.actionEntitySet != null && ((e = o.actionEntitySet) == null ? void 0 : e.length) > 0) {
147
+ const r = o.actionEntitySet.map((c) => c.action);
148
+ u[o.permissionId] = r;
149
+ }
150
+ }), u;
151
+ }
152
+ function en(n) {
153
+ const t = j(), o = P(window.location.href), r = A()[o] || "";
154
+ return (t[r] || []).includes(n);
155
+ }
156
+ function on() {
157
+ localStorage.removeItem(s(g)), localStorage.removeItem(s(d)), localStorage.removeItem(s(a)), localStorage.removeItem(s(l));
158
+ }
159
+ export {
160
+ E as UserCenterKey,
161
+ Y as exportFile,
162
+ j as getButtonPermissions,
163
+ V as getLocale,
164
+ C as getMenuInfo,
165
+ Q as getToken,
166
+ m as getUserCenterParams,
167
+ $ as getUserCenterParamsByUrl,
168
+ S as getUserInfo,
169
+ en as hasPermission,
170
+ i as is,
171
+ J as isArray,
172
+ K as isAsyncFunction,
173
+ F as isBoolean,
174
+ T as isClient,
175
+ M as isDate,
176
+ U as isDef,
177
+ _ as isElement,
178
+ h as isFunction,
179
+ W as isImageDom,
180
+ N as isNull,
181
+ D as isNullOrUndef,
182
+ L as isNumber,
183
+ O as isObject,
184
+ R as isPromise,
185
+ B as isServer,
186
+ v as isString,
187
+ w as isUndef,
188
+ k as isWindow,
189
+ q as logoutToUserCenter,
190
+ on as removeAll,
191
+ Z as removeLocale,
192
+ X as removeToken,
193
+ H as setLocale,
194
+ tn as setMenuInfo,
195
+ z as setToken,
196
+ x as setUserCenterParams,
197
+ nn as setUserInfo,
198
+ G as toUserCenterConsole
199
+ };
package/package.json CHANGED
@@ -1,48 +1,51 @@
1
1
  {
2
2
  "name": "@witlink/components",
3
3
  "private": false,
4
- "version": "0.0.3",
4
+ "version": "0.0.4",
5
5
  "description": "witlink公共组件库",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "files": [
9
9
  "dist"
10
10
  ],
11
- "main": "./dist/components.umd.cjs",
12
- "module": "./dist/components.js",
11
+ "main": "./dist/index.umd.cjs",
12
+ "module": "./dist/index.js",
13
13
  "types": "./dist/index.d.ts",
14
14
  "exports": {
15
15
  ".": {
16
- "import": "./dist/components.js",
17
- "require": "./dist/components.umd.cjs"
16
+ "import": "./dist/index.js"
18
17
  },
19
- "./style.css": "./dist/style.css"
18
+ "./utils": {
19
+ "import": "./dist/utils.js"
20
+ },
21
+ "./style.css": "./dist/index.css"
20
22
  },
21
23
  "scripts": {
22
24
  "dev": "vite",
23
- "build": "vue-tsc -noEmit && vite build",
25
+ "build": "vue-tsc -b && vite build",
24
26
  "preview": "vite preview"
25
27
  },
26
- "dependencies": {
27
- "bpmn-js": "^17.11.1"
28
+ "peerDependencies": {
29
+ "ant-design-vue": "^4.2.5",
30
+ "element-plus": "^2.8.7",
31
+ "vue": "^3.5.13"
28
32
  },
29
33
  "devDependencies": {
30
- "@iconify-json/ant-design": "^1.2.2",
31
- "@types/node": "^22.8.7",
32
- "@vitejs/plugin-vue": "^5.1.4",
33
- "@vueuse/core": "^11.2.0",
34
- "ant-design-vue": "^4.2.5",
35
- "axios": "^1.7.7",
36
- "less": "^4.2.0",
34
+ "@iconify-json/ant-design": "^1.2.5",
35
+ "@types/node": "^22.13.11",
36
+ "@vitejs/plugin-vue": "^5.2.1",
37
+ "@vue/tsconfig": "^0.7.0",
38
+ "@vueuse/core": "^13.0.0",
39
+ "less": "^4.2.2",
37
40
  "less-loader": "^12.2.0",
38
- "rollup-plugin-visualizer": "^5.12.0",
39
- "typescript": "~5.6.2",
40
- "unplugin-auto-import": "^0.18.3",
41
- "unplugin-icons": "^0.20.0",
42
- "unplugin-vue-components": "^0.27.4",
43
- "vite": "^5.4.10",
44
- "vite-plugin-dts": "^4.3.0",
45
- "vue": "^3.5.12",
46
- "vue-tsc": "^2.1.8"
41
+ "rollup-plugin-visualizer": "^5.14.0",
42
+ "typescript": "~5.7.2",
43
+ "unplugin-auto-import": "^19.1.1",
44
+ "unplugin-icons": "^22.1.0",
45
+ "unplugin-vue-components": "^28.4.1",
46
+ "vite": "^6.2.0",
47
+ "vite-plugin-dts": "^4.5.3",
48
+ "vue-tsc": "^2.2.4",
49
+ "vue-router": "^4.5.0"
47
50
  }
48
51
  }