web-kxjl-components 1.0.3 → 1.0.5
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/README.md +16 -6
- package/dist/chunks/_plugin-vue_export-helper-Djzt4Yr7.js +7 -0
- package/dist/index.d.ts +2 -4
- package/dist/index.js +13 -151
- package/dist/kx-app-switcher.d.ts +2 -0
- package/dist/kx-app-switcher.js +126 -0
- package/package.json +7 -2
- package/dist/components/kx-app-switcher/app-icon.vue.d.ts +0 -7
package/README.md
CHANGED
|
@@ -12,18 +12,25 @@ npm install web-kxjl-components
|
|
|
12
12
|
|
|
13
13
|
样式已内联进 JS,导入组件时自动注入,无需再引入 css 文件。
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
全量注册(包含 KxEmpty 等套件组件,不含 KxAppSwitcher):
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
|
-
import
|
|
18
|
+
import KxComponents from "web-kxjl-components";
|
|
19
|
+
|
|
20
|
+
app.use(KxComponents);
|
|
19
21
|
```
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
只用套件中的个别组件时,也可以具名引入:
|
|
22
24
|
|
|
23
25
|
```ts
|
|
24
|
-
import
|
|
26
|
+
import { KxEmpty } from "web-kxjl-components";
|
|
27
|
+
```
|
|
25
28
|
|
|
26
|
-
|
|
29
|
+
KxAppSwitcher 按需引入(独立入口,宿主打包时只包含该组件):
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import KxAppSwitcher from "web-kxjl-components/kx-app-switcher";
|
|
33
|
+
import type { ApiResult, Product, ProductSystem } from "web-kxjl-components/kx-app-switcher";
|
|
27
34
|
```
|
|
28
35
|
|
|
29
36
|
## 开发
|
|
@@ -33,7 +40,10 @@ npm install
|
|
|
33
40
|
npm run build # vue-tsc 生成类型声明 + vite 库模式构建,产物在 dist/
|
|
34
41
|
```
|
|
35
42
|
|
|
36
|
-
|
|
43
|
+
新增组件分两类:
|
|
44
|
+
|
|
45
|
+
- 套件组件:在 `src/components/<kx-xxx>/index.vue` 编写,然后在 `src/index.ts` 中导入、加入 `components` 并具名导出。
|
|
46
|
+
- 独立按需组件:除组件本身外,新建 `src/<kx-xxx>.ts` 作为入口,并在 `vite.config.ts` 的 `lib.entry`、`package.json` 的 `exports` 与 `sideEffects` 中补上对应条目,不放进 `src/index.ts` 的 `components`。
|
|
37
47
|
|
|
38
48
|
## 提交约定
|
|
39
49
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { App } from "vue";
|
|
2
2
|
import KxEmpty from "./components/kx-empty/index.vue";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export type { ApiResult, Product, ProductSystem, } from "./components/kx-app-switcher/types";
|
|
6
|
-
/** 全量注册:app.use(KxComponents) */
|
|
3
|
+
export { KxEmpty };
|
|
4
|
+
/** 全量注册:app.use(KxComponents),仅含全量套件组件(如 KxEmpty) */
|
|
7
5
|
declare const _default: {
|
|
8
6
|
install(app: App): void;
|
|
9
7
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,164 +1,26 @@
|
|
|
1
|
-
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.kx-empty[data-v-392d5d37]{justify-content:center;align-items:center;width:100%;height:100%;display:flex}
|
|
2
|
-
import {
|
|
1
|
+
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.kx-empty[data-v-392d5d37]{justify-content:center;align-items:center;width:100%;height:100%;display:flex}`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
|
|
2
|
+
import { t as e } from "./chunks/_plugin-vue_export-helper-Djzt4Yr7.js";
|
|
3
|
+
import { ElEmpty as t } from "element-plus/es";
|
|
3
4
|
import "element-plus/es/components/base/style/css";
|
|
4
5
|
import "element-plus/es/components/empty/style/css";
|
|
5
|
-
import {
|
|
6
|
-
import "element-plus/es/components/loading/style/css";
|
|
7
|
-
import "element-plus/es/components/popover/style/css";
|
|
8
|
-
import "element-plus/es/components/tooltip/style/css";
|
|
6
|
+
import { createElementBlock as n, createVNode as r, defineComponent as i, openBlock as a, renderSlot as o, withCtx as s } from "vue";
|
|
9
7
|
// src/components/kx-empty/index.vue?vue&type=script&setup=true&lang.ts
|
|
10
|
-
var
|
|
8
|
+
var c = { class: "kx-empty" }, l = /*#__PURE__*/ e(/* @__PURE__ */ i({
|
|
11
9
|
name: "KxEmpty",
|
|
12
10
|
__name: "index",
|
|
13
11
|
props: { description: { default: "暂无数据" } },
|
|
14
|
-
setup(t) {
|
|
15
|
-
return (n, r) => {
|
|
16
|
-
let i = e;
|
|
17
|
-
return m(), c("div", S, [d(i, { description: t.description }, {
|
|
18
|
-
default: b(() => [_(n.$slots, "default", {}, void 0, !0)]),
|
|
19
|
-
_: 3
|
|
20
|
-
}, 8, ["description"])]);
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
}), w = (e, t) => {
|
|
24
|
-
let n = e.__vccOpts || e;
|
|
25
|
-
for (let [e, r] of t) n[e] = r;
|
|
26
|
-
return n;
|
|
27
|
-
}, T = /*#__PURE__*/ w(C, [["__scopeId", "data-v-392d5d37"]]), E = ["src"], D = {
|
|
28
|
-
key: 1,
|
|
29
|
-
class: "kx-app-icon",
|
|
30
|
-
viewBox: "0 0 24 24",
|
|
31
|
-
"aria-hidden": "true"
|
|
32
|
-
}, O = /*#__PURE__*/ w(/* @__PURE__ */ f({
|
|
33
|
-
name: "KxAppIcon",
|
|
34
|
-
__name: "app-icon",
|
|
35
|
-
props: { src: {} },
|
|
36
12
|
setup(e) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
n.
|
|
40
|
-
|
|
41
|
-
key: 0,
|
|
42
|
-
class: "kx-app-icon",
|
|
43
|
-
src: e.src,
|
|
44
|
-
alt: "",
|
|
45
|
-
onError: r[0] ||= (e) => n.value = !0
|
|
46
|
-
}, null, 40, E)) : (m(), c("svg", D, [...r[1] ||= [u("<rect width=\"24\" height=\"24\" rx=\"6\" fill=\"var(--kx-primary, #2879ff)\" data-v-e5f115f7></rect><rect x=\"5\" y=\"5\" width=\"6\" height=\"6\" rx=\"1.5\" fill=\"#fff\" data-v-e5f115f7></rect><rect x=\"13\" y=\"5\" width=\"6\" height=\"6\" rx=\"1.5\" fill=\"#fff\" data-v-e5f115f7></rect><rect x=\"5\" y=\"13\" width=\"6\" height=\"6\" rx=\"1.5\" fill=\"#fff\" data-v-e5f115f7></rect><rect x=\"13\" y=\"13\" width=\"6\" height=\"6\" rx=\"1.5\" fill=\"#fff\" data-v-e5f115f7></rect>", 5)]]));
|
|
47
|
-
}
|
|
48
|
-
}), [["__scopeId", "data-v-e5f115f7"]]), k = { class: "kx-app-switcher__trigger" }, A = { class: "kx-app-switcher__panel" }, j = {
|
|
49
|
-
key: 0,
|
|
50
|
-
class: "kx-app-switcher__card kx-app-switcher__systems"
|
|
51
|
-
}, M = [
|
|
52
|
-
"aria-disabled",
|
|
53
|
-
"title",
|
|
54
|
-
"onClick"
|
|
55
|
-
], N = { class: "kx-app-switcher__system-icon" }, P = { class: "kx-app-switcher__system-name" }, F = { class: "kx-app-switcher__card kx-app-switcher__products" }, I = [
|
|
56
|
-
"title",
|
|
57
|
-
"onMouseenter",
|
|
58
|
-
"onFocus",
|
|
59
|
-
"onClick"
|
|
60
|
-
], L = { class: "kx-app-switcher__product-name" }, R = { class: "kx-app-switcher__product-icon" }, z = /*#__PURE__*/ w(/* @__PURE__ */ f({
|
|
61
|
-
name: "KxAppSwitcher",
|
|
62
|
-
__name: "index",
|
|
63
|
-
props: {
|
|
64
|
-
fetcher: {},
|
|
65
|
-
staticFileFormat: {},
|
|
66
|
-
disabledTip: { default: "暂未开通" }
|
|
67
|
-
},
|
|
68
|
-
setup(u) {
|
|
69
|
-
let f = u, S = h(!1), C = h(!1), w = h(!1), T = h([]), E = h(null), D = /^(https?:|data:|blob:|\/\/)/i;
|
|
70
|
-
function z(e) {
|
|
71
|
-
return [...e].sort((e, t) => (e.sortNum ?? 0) - (t.sortNum ?? 0));
|
|
72
|
-
}
|
|
73
|
-
let B = a(() => T.value.find((e) => e.id === E.value)?.systems ?? []);
|
|
74
|
-
async function V() {
|
|
75
|
-
if (!(C.value || w.value)) {
|
|
76
|
-
C.value = !0;
|
|
77
|
-
try {
|
|
78
|
-
let e = await f.fetcher();
|
|
79
|
-
e.code === 0 && Array.isArray(e.data) && (T.value = z(e.data).map((e) => ({
|
|
80
|
-
...e,
|
|
81
|
-
systems: z(e.systems ?? [])
|
|
82
|
-
})), E.value = T.value[0]?.id ?? null, w.value = !0);
|
|
83
|
-
} catch {} finally {
|
|
84
|
-
C.value = !1;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
y(S, (e) => {
|
|
89
|
-
e && V();
|
|
90
|
-
});
|
|
91
|
-
function H(e) {
|
|
92
|
-
return e ? D.test(e) ? e : f.staticFileFormat ? f.staticFileFormat(e) : e : "";
|
|
93
|
-
}
|
|
94
|
-
function U(e) {
|
|
95
|
-
if (!e.sysUrl) return;
|
|
96
|
-
let t;
|
|
97
|
-
try {
|
|
98
|
-
t = new URL(e.sysUrl, window.location.origin);
|
|
99
|
-
} catch {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
(t.protocol === "http:" || t.protocol === "https:") && (window.open(t.href, "_blank", "noopener,noreferrer"), S.value = !1);
|
|
103
|
-
}
|
|
104
|
-
return (a, f) => {
|
|
105
|
-
let h = r, y = e, w = n, D = t;
|
|
106
|
-
return m(), o(w, {
|
|
107
|
-
visible: S.value,
|
|
108
|
-
"onUpdate:visible": f[0] ||= (e) => S.value = e,
|
|
109
|
-
trigger: "click",
|
|
110
|
-
placement: "bottom-end",
|
|
111
|
-
width: 430,
|
|
112
|
-
"show-arrow": !1,
|
|
113
|
-
"popper-style": {
|
|
114
|
-
padding: 0,
|
|
115
|
-
border: "none",
|
|
116
|
-
background: "transparent",
|
|
117
|
-
boxShadow: "none"
|
|
118
|
-
}
|
|
119
|
-
}, {
|
|
120
|
-
reference: b(() => [l("span", k, [_(a.$slots, "default", { visible: S.value }, void 0, !0)])]),
|
|
121
|
-
default: b(() => [x((m(), c("div", A, [B.value.length ? (m(), c("div", j, [(m(!0), c(i, null, g(B.value, (e) => (m(), o(h, {
|
|
122
|
-
key: e.id,
|
|
123
|
-
content: u.disabledTip,
|
|
124
|
-
disabled: !!e.sysUrl,
|
|
125
|
-
placement: "left"
|
|
126
|
-
}, {
|
|
127
|
-
default: b(() => [l("button", {
|
|
128
|
-
type: "button",
|
|
129
|
-
class: p(["kx-app-switcher__system", { "is-disabled": !e.sysUrl }]),
|
|
130
|
-
"aria-disabled": !e.sysUrl,
|
|
131
|
-
title: e.description,
|
|
132
|
-
onClick: (t) => U(e)
|
|
133
|
-
}, [l("span", N, [d(O, { src: H(e.icon) }, null, 8, ["src"])]), l("span", P, v(e.sysName), 1)], 10, M)]),
|
|
134
|
-
_: 2
|
|
135
|
-
}, 1032, ["content", "disabled"]))), 128))])) : s("", !0), l("div", F, [
|
|
136
|
-
f[1] ||= l("div", { class: "kx-app-switcher__title" }, "应用切换", -1),
|
|
137
|
-
!C.value && !T.value.length ? (m(), o(y, {
|
|
138
|
-
key: 0,
|
|
139
|
-
"image-size": 60,
|
|
140
|
-
description: "暂无应用"
|
|
141
|
-
})) : s("", !0),
|
|
142
|
-
(m(!0), c(i, null, g(T.value, (e) => (m(), c("button", {
|
|
143
|
-
key: e.id,
|
|
144
|
-
type: "button",
|
|
145
|
-
class: p(["kx-app-switcher__product", { "is-active": e.id === E.value }]),
|
|
146
|
-
title: e.description,
|
|
147
|
-
onMouseenter: (t) => E.value = e.id,
|
|
148
|
-
onFocus: (t) => E.value = e.id,
|
|
149
|
-
onClick: (t) => E.value = e.id
|
|
150
|
-
}, [l("span", L, v(e.productName), 1), l("span", R, [d(O, { src: H(e.icon) }, null, 8, ["src"])])], 42, I))), 128))
|
|
151
|
-
])])), [[D, C.value]])]),
|
|
13
|
+
return (i, l) => {
|
|
14
|
+
let u = t;
|
|
15
|
+
return a(), n("div", c, [r(u, { description: e.description }, {
|
|
16
|
+
default: s(() => [o(i.$slots, "default", {}, void 0, !0)]),
|
|
152
17
|
_: 3
|
|
153
|
-
}, 8, ["
|
|
18
|
+
}, 8, ["description"])]);
|
|
154
19
|
};
|
|
155
20
|
}
|
|
156
|
-
}), [["__scopeId", "data-v-
|
|
157
|
-
|
|
158
|
-
KxAppSwitcher: z
|
|
159
|
-
}, V = { install(e) {
|
|
160
|
-
Object.entries(B).forEach(([t, n]) => {
|
|
21
|
+
}), [["__scopeId", "data-v-392d5d37"]]), u = { KxEmpty: l }, d = { install(e) {
|
|
22
|
+
Object.entries(u).forEach(([t, n]) => {
|
|
161
23
|
e.component(t, n);
|
|
162
24
|
});
|
|
163
25
|
} };
|
|
164
|
-
export {
|
|
26
|
+
export { l as KxEmpty, d as default };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.kx-app-switcher__trigger[data-v-8f6c0173]{cursor:pointer;display:inline-flex}.kx-app-switcher__panel[data-v-8f6c0173]{--kx-text-primary:var(--kx-switcher-text-primary,#303133);--kx-text-regular:var(--kx-switcher-text-regular,#606266);--kx-text-disabled:var(--kx-switcher-text-disabled,#a8abb2);--kx-bg-overlay:var(--kx-switcher-bg-overlay,#fff);--kx-border-light:var(--kx-switcher-border-light,#e4e7ed);--kx-box-shadow-light:var(--kx-switcher-box-shadow-light,0 0 12px #0000001f);--kx-fill-light:var(--kx-switcher-fill-light,#f5f7fa);justify-content:flex-end;align-items:flex-start;gap:8px;min-height:80px;display:flex}.kx-app-switcher__card[data-v-8f6c0173]{background:var(--kx-bg-overlay);border:1px solid var(--kx-border-light);box-shadow:var(--kx-box-shadow-light);border-radius:8px;padding:12px}.kx-app-switcher__systems[data-v-8f6c0173]{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.kx-app-switcher__system[data-v-8f6c0173]{color:var(--kx-text-primary);text-align:left;cursor:pointer;background:0 0;border:none;border-radius:6px;align-items:center;gap:10px;padding:8px;font-size:14px;font-weight:400;display:flex}.kx-app-switcher__system[data-v-8f6c0173]:hover{background:var(--kx-fill-light)}.kx-app-switcher__system.is-disabled[data-v-8f6c0173]{color:var(--kx-text-disabled);cursor:not-allowed}.kx-app-switcher__system.is-disabled[data-v-8f6c0173]:hover{background:0 0}.kx-app-switcher__system.is-disabled .kx-app-switcher__system-icon[data-v-8f6c0173]{opacity:.4;filter:grayscale()}.kx-app-switcher__system-icon[data-v-8f6c0173]{background:var(--kx-system-icon-bg);box-sizing:border-box;border-radius:6px;flex:none;width:24px;height:24px;padding:5px;overflow:hidden}.kx-app-switcher__system[data-v-8f6c0173]:nth-child(6n+1){--kx-system-icon-bg:#4b3fe9}.kx-app-switcher__system[data-v-8f6c0173]:nth-child(6n+2){--kx-system-icon-bg:#ef883a}.kx-app-switcher__system[data-v-8f6c0173]:nth-child(6n+3){--kx-system-icon-bg:#3fade9}.kx-app-switcher__system[data-v-8f6c0173]:nth-child(6n+4){--kx-system-icon-bg:#3686ff}.kx-app-switcher__system[data-v-8f6c0173]:nth-child(6n+5){--kx-system-icon-bg:#61bb5a}.kx-app-switcher__system[data-v-8f6c0173]:nth-child(6n){--kx-system-icon-bg:#ec6589}.kx-app-switcher__icon[data-v-8f6c0173]{object-fit:contain;width:100%;height:100%;display:block}.kx-app-switcher__system-name[data-v-8f6c0173]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.kx-app-switcher__products[data-v-8f6c0173]{flex-direction:column;flex:none;gap:8px;width:190px;display:flex}.kx-app-switcher__title[data-v-8f6c0173]{color:var(--kx-text-regular);font-size:14px}.kx-app-switcher__product[data-v-8f6c0173]{height:52px;color:var(--kx-text-primary);cursor:pointer;background:var(--kx-product-icon,none) right center/104px 47px no-repeat, linear-gradient(90deg, #fff, var(--kx-product-bg-end));border:1px solid #e2e8f0;border-radius:4px;align-items:center;padding:0 16px;font-size:16px;font-weight:600;display:flex}.kx-app-switcher__product.is-active[data-v-8f6c0173]{border-color:var(--kx-product-border)}.kx-app-switcher__product[data-v-8f6c0173]:nth-of-type(5n+1){--kx-product-bg-end:#dde9ff;--kx-product-border:#3b6df0}.kx-app-switcher__product[data-v-8f6c0173]:nth-of-type(5n+2){--kx-product-bg-end:#f4ecff;--kx-product-border:#883eff}.kx-app-switcher__product[data-v-8f6c0173]:nth-of-type(5n+3){--kx-product-bg-end:#e2f8e8;--kx-product-border:#61bb5a}.kx-app-switcher__product[data-v-8f6c0173]:nth-of-type(5n+4){--kx-product-bg-end:#d9f2ff;--kx-product-border:#3fade9}.kx-app-switcher__product[data-v-8f6c0173]:nth-of-type(5n){--kx-product-bg-end:#ffebdd;--kx-product-border:#ef883a}.kx-app-switcher__product-name[data-v-8f6c0173]{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
|
|
2
|
+
import { t as e } from "./chunks/_plugin-vue_export-helper-Djzt4Yr7.js";
|
|
3
|
+
import { ElEmpty as t, ElLoadingDirective as n, ElPopover as r, ElTooltip as i } from "element-plus/es";
|
|
4
|
+
import "element-plus/es/components/base/style/css";
|
|
5
|
+
import "element-plus/es/components/empty/style/css";
|
|
6
|
+
import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, defineComponent as d, normalizeClass as f, normalizeStyle as p, openBlock as m, ref as h, renderList as g, renderSlot as _, toDisplayString as v, watch as y, withCtx as b, withDirectives as x } from "vue";
|
|
7
|
+
import "element-plus/es/components/loading/style/css";
|
|
8
|
+
import "element-plus/es/components/popover/style/css";
|
|
9
|
+
import "element-plus/es/components/tooltip/style/css";
|
|
10
|
+
// src/components/kx-app-switcher/index.vue?vue&type=script&setup=true&lang.ts
|
|
11
|
+
var S = { class: "kx-app-switcher__trigger" }, C = { class: "kx-app-switcher__panel" }, w = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "kx-app-switcher__card kx-app-switcher__systems"
|
|
14
|
+
}, T = [
|
|
15
|
+
"aria-disabled",
|
|
16
|
+
"title",
|
|
17
|
+
"onClick"
|
|
18
|
+
], E = { class: "kx-app-switcher__system-icon" }, D = ["src"], O = { class: "kx-app-switcher__system-name" }, k = { class: "kx-app-switcher__card kx-app-switcher__products" }, A = [
|
|
19
|
+
"title",
|
|
20
|
+
"onMouseenter",
|
|
21
|
+
"onFocus",
|
|
22
|
+
"onClick"
|
|
23
|
+
], j = { class: "kx-app-switcher__product-name" }, M = /*#__PURE__*/ e(/* @__PURE__ */ d({
|
|
24
|
+
name: "KxAppSwitcher",
|
|
25
|
+
__name: "index",
|
|
26
|
+
props: {
|
|
27
|
+
fetcher: {},
|
|
28
|
+
staticFileFormat: {},
|
|
29
|
+
disabledTip: { default: "暂未开通" }
|
|
30
|
+
},
|
|
31
|
+
setup(e) {
|
|
32
|
+
let d = e, M = h(!1), N = h(!1), P = h(!1), F = h([]), I = h(null), L = /^(https?:|data:|blob:|\/\/)/i;
|
|
33
|
+
function R(e) {
|
|
34
|
+
return [...e].sort((e, t) => (e.sortNum ?? 0) - (t.sortNum ?? 0));
|
|
35
|
+
}
|
|
36
|
+
let z = o(() => F.value.find((e) => e.id === I.value)?.systems ?? []);
|
|
37
|
+
async function B() {
|
|
38
|
+
if (!(N.value || P.value)) {
|
|
39
|
+
N.value = !0;
|
|
40
|
+
try {
|
|
41
|
+
let e = await d.fetcher();
|
|
42
|
+
e.code === 0 && Array.isArray(e.data) && (F.value = R(e.data).map((e) => ({
|
|
43
|
+
...e,
|
|
44
|
+
systems: R(e.systems ?? [])
|
|
45
|
+
})), I.value = F.value[0]?.id ?? null, P.value = !0);
|
|
46
|
+
} catch {} finally {
|
|
47
|
+
N.value = !1;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
y(M, (e) => {
|
|
52
|
+
e && B();
|
|
53
|
+
});
|
|
54
|
+
function V(e) {
|
|
55
|
+
return e ? L.test(e) ? e : d.staticFileFormat ? d.staticFileFormat(e) : e : "";
|
|
56
|
+
}
|
|
57
|
+
function H(e) {
|
|
58
|
+
if (!e.sysUrl) return;
|
|
59
|
+
let t;
|
|
60
|
+
try {
|
|
61
|
+
t = new URL(e.sysUrl, window.location.origin);
|
|
62
|
+
} catch {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
(t.protocol === "http:" || t.protocol === "https:") && (window.open(t.href, "_blank", "noopener,noreferrer"), M.value = !1);
|
|
66
|
+
}
|
|
67
|
+
return (o, d) => {
|
|
68
|
+
let h = i, y = t, P = r, L = n;
|
|
69
|
+
return m(), s(P, {
|
|
70
|
+
visible: M.value,
|
|
71
|
+
"onUpdate:visible": d[0] ||= (e) => M.value = e,
|
|
72
|
+
trigger: "click",
|
|
73
|
+
placement: "bottom-end",
|
|
74
|
+
width: 480,
|
|
75
|
+
"show-arrow": !1,
|
|
76
|
+
"popper-style": {
|
|
77
|
+
padding: 0,
|
|
78
|
+
border: "none",
|
|
79
|
+
background: "transparent",
|
|
80
|
+
boxShadow: "none"
|
|
81
|
+
}
|
|
82
|
+
}, {
|
|
83
|
+
reference: b(() => [u("span", S, [_(o.$slots, "default", { visible: M.value }, void 0, !0)])]),
|
|
84
|
+
default: b(() => [x((m(), l("div", C, [z.value.length ? (m(), l("div", w, [(m(!0), l(a, null, g(z.value, (t) => (m(), s(h, {
|
|
85
|
+
key: t.id,
|
|
86
|
+
content: e.disabledTip,
|
|
87
|
+
disabled: !!t.sysUrl,
|
|
88
|
+
placement: "left"
|
|
89
|
+
}, {
|
|
90
|
+
default: b(() => [u("button", {
|
|
91
|
+
type: "button",
|
|
92
|
+
class: f(["kx-app-switcher__system", { "is-disabled": !t.sysUrl }]),
|
|
93
|
+
"aria-disabled": !t.sysUrl,
|
|
94
|
+
title: t.description,
|
|
95
|
+
onClick: (e) => H(t)
|
|
96
|
+
}, [u("span", E, [t.icon ? (m(), l("img", {
|
|
97
|
+
key: 0,
|
|
98
|
+
class: "kx-app-switcher__icon",
|
|
99
|
+
src: V(t.icon),
|
|
100
|
+
alt: ""
|
|
101
|
+
}, null, 8, D)) : c("", !0)]), u("span", O, v(t.sysName), 1)], 10, T)]),
|
|
102
|
+
_: 2
|
|
103
|
+
}, 1032, ["content", "disabled"]))), 128))])) : c("", !0), u("div", k, [
|
|
104
|
+
d[1] ||= u("div", { class: "kx-app-switcher__title" }, "应用切换", -1),
|
|
105
|
+
!N.value && !F.value.length ? (m(), s(y, {
|
|
106
|
+
key: 0,
|
|
107
|
+
"image-size": 60,
|
|
108
|
+
description: "暂无应用"
|
|
109
|
+
})) : c("", !0),
|
|
110
|
+
(m(!0), l(a, null, g(F.value, (e) => (m(), l("button", {
|
|
111
|
+
key: e.id,
|
|
112
|
+
type: "button",
|
|
113
|
+
class: f(["kx-app-switcher__product", { "is-active": e.id === I.value }]),
|
|
114
|
+
title: e.description,
|
|
115
|
+
style: p(e.icon ? { "--kx-product-icon": `url('${V(e.icon)}')` } : {}),
|
|
116
|
+
onMouseenter: (t) => I.value = e.id,
|
|
117
|
+
onFocus: (t) => I.value = e.id,
|
|
118
|
+
onClick: (t) => I.value = e.id
|
|
119
|
+
}, [u("span", j, v(e.productName), 1)], 46, A))), 128))
|
|
120
|
+
])])), [[L, N.value]])]),
|
|
121
|
+
_: 3
|
|
122
|
+
}, 8, ["visible"]);
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}), [["__scopeId", "data-v-8f6c0173"]]);
|
|
126
|
+
export { M as default };
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "web-kxjl-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "公司公共组件库(Vue 3 + Element Plus)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"sideEffects": [
|
|
8
|
-
"./dist/index.js"
|
|
8
|
+
"./dist/index.js",
|
|
9
|
+
"./dist/kx-app-switcher.js"
|
|
9
10
|
],
|
|
10
11
|
"files": [
|
|
11
12
|
"dist"
|
|
@@ -17,6 +18,10 @@
|
|
|
17
18
|
".": {
|
|
18
19
|
"types": "./dist/index.d.ts",
|
|
19
20
|
"import": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./kx-app-switcher": {
|
|
23
|
+
"types": "./dist/kx-app-switcher.d.ts",
|
|
24
|
+
"import": "./dist/kx-app-switcher.js"
|
|
20
25
|
}
|
|
21
26
|
},
|
|
22
27
|
"publishConfig": {
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
type __VLS_Props = {
|
|
2
|
-
/** 图标地址,为空或加载失败时显示默认图标 */
|
|
3
|
-
src?: string;
|
|
4
|
-
};
|
|
5
|
-
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
-
declare const _default: typeof __VLS_export;
|
|
7
|
-
export default _default;
|