web-kxjl-components 1.0.4 → 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 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 { KxEmpty } from "web-kxjl-components";
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 KxComponents from "web-kxjl-components";
26
+ import { KxEmpty } from "web-kxjl-components";
27
+ ```
25
28
 
26
- app.use(KxComponents);
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
- 新增组件:在 `src/components/<kx-xxx>/index.vue` 编写,然后在 `src/index.ts` 中导入、加入 `components` 并具名导出。
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
 
@@ -0,0 +1,7 @@
1
+ // \0plugin-vue:export-helper
2
+ var e = (e, t) => {
3
+ let n = e.__vccOpts || e;
4
+ for (let [e, r] of t) n[e] = r;
5
+ return n;
6
+ };
7
+ export { e as t };
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
- import KxAppSwitcher from "./components/kx-app-switcher/index.vue";
4
- export { KxEmpty, KxAppSwitcher };
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,155 +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}.kx-app-switcher__trigger[data-v-af73d3b0]{cursor:pointer;display:inline-flex}.kx-app-switcher__panel[data-v-af73d3b0]{--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-af73d3b0]{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-af73d3b0]{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.kx-app-switcher__system[data-v-af73d3b0]{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-af73d3b0]:hover{background:var(--kx-fill-light)}.kx-app-switcher__system.is-disabled[data-v-af73d3b0]{color:var(--kx-text-disabled);cursor:not-allowed}.kx-app-switcher__system.is-disabled[data-v-af73d3b0]:hover{background:0 0}.kx-app-switcher__system.is-disabled .kx-app-switcher__system-icon[data-v-af73d3b0]{opacity:.4;filter:grayscale()}.kx-app-switcher__system-icon[data-v-af73d3b0]{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-af73d3b0]:nth-child(6n+1){--kx-system-icon-bg:#4b3fe9}.kx-app-switcher__system[data-v-af73d3b0]:nth-child(6n+2){--kx-system-icon-bg:#ef883a}.kx-app-switcher__system[data-v-af73d3b0]:nth-child(6n+3){--kx-system-icon-bg:#3fade9}.kx-app-switcher__system[data-v-af73d3b0]:nth-child(6n+4){--kx-system-icon-bg:#3686ff}.kx-app-switcher__system[data-v-af73d3b0]:nth-child(6n+5){--kx-system-icon-bg:#61bb5a}.kx-app-switcher__system[data-v-af73d3b0]:nth-child(6n){--kx-system-icon-bg:#ec6589}.kx-app-switcher__icon[data-v-af73d3b0]{object-fit:contain;width:100%;height:100%;display:block}.kx-app-switcher__system-name[data-v-af73d3b0]{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.kx-app-switcher__products[data-v-af73d3b0]{flex-direction:column;flex:none;gap:8px;width:190px;display:flex}.kx-app-switcher__title[data-v-af73d3b0]{color:var(--kx-text-regular);font-size:14px}.kx-app-switcher__product[data-v-af73d3b0]{height:52px;color:var(--kx-text-primary);cursor:pointer;background:linear-gradient(90deg, #fff, var(--kx-product-bg-end));border:1px solid #e2e8f0;border-radius:4px;justify-content:space-between;align-items:center;padding:0 0 0 16px;font-size:16px;font-weight:600;display:flex}.kx-app-switcher__product.is-active[data-v-af73d3b0]{border-color:var(--kx-product-border)}.kx-app-switcher__product[data-v-af73d3b0]:nth-of-type(5n+1){--kx-product-bg-end:#dde9ff;--kx-product-border:#3b6df0}.kx-app-switcher__product[data-v-af73d3b0]:nth-of-type(5n+2){--kx-product-bg-end:#f4ecff;--kx-product-border:#883eff}.kx-app-switcher__product[data-v-af73d3b0]:nth-of-type(5n+3){--kx-product-bg-end:#e2f8e8;--kx-product-border:#61bb5a}.kx-app-switcher__product[data-v-af73d3b0]:nth-of-type(5n+4){--kx-product-bg-end:#d9f2ff;--kx-product-border:#3fade9}.kx-app-switcher__product[data-v-af73d3b0]:nth-of-type(5n){--kx-product-bg-end:#ffebdd;--kx-product-border:#ef883a}.kx-app-switcher__product-icon[data-v-af73d3b0]{flex:none;width:104px;height:47px}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
2
- import { ElEmpty as e, ElLoadingDirective as t, ElPopover as n, ElTooltip as r } from "element-plus/es";
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 { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, normalizeClass as f, openBlock as p, ref as m, renderList as h, renderSlot as g, toDisplayString as _, watch as v, withCtx as y, withDirectives as b } from "vue";
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 x = { class: "kx-empty" }, S = /*@__PURE__*/ d({
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 p(), c("div", x, [u(i, { description: t.description }, {
18
- default: y(() => [g(n.$slots, "default", {}, void 0, !0)]),
12
+ setup(e) {
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)]),
19
17
  _: 3
20
18
  }, 8, ["description"])]);
21
19
  };
22
20
  }
23
- }), C = (e, t) => {
24
- let n = e.__vccOpts || e;
25
- for (let [e, r] of t) n[e] = r;
26
- return n;
27
- }, w = /*#__PURE__*/ C(S, [["__scopeId", "data-v-392d5d37"]]), T = { class: "kx-app-switcher__trigger" }, E = { class: "kx-app-switcher__panel" }, D = {
28
- key: 0,
29
- class: "kx-app-switcher__card kx-app-switcher__systems"
30
- }, O = [
31
- "aria-disabled",
32
- "title",
33
- "onClick"
34
- ], k = { class: "kx-app-switcher__system-icon" }, A = ["src"], j = { class: "kx-app-switcher__system-name" }, M = { class: "kx-app-switcher__card kx-app-switcher__products" }, N = [
35
- "title",
36
- "onMouseenter",
37
- "onFocus",
38
- "onClick"
39
- ], P = { class: "kx-app-switcher__product-name" }, F = {
40
- key: 0,
41
- class: "kx-app-switcher__product-icon"
42
- }, I = ["src"], L = /*#__PURE__*/ C(/* @__PURE__ */ d({
43
- name: "KxAppSwitcher",
44
- __name: "index",
45
- props: {
46
- fetcher: {},
47
- staticFileFormat: {},
48
- disabledTip: { default: "暂未开通" }
49
- },
50
- setup(u) {
51
- let d = u, x = m(!1), S = m(!1), C = m(!1), w = m([]), L = m(null), R = /^(https?:|data:|blob:|\/\/)/i;
52
- function z(e) {
53
- return [...e].sort((e, t) => (e.sortNum ?? 0) - (t.sortNum ?? 0));
54
- }
55
- let B = a(() => w.value.find((e) => e.id === L.value)?.systems ?? []);
56
- async function V() {
57
- if (!(S.value || C.value)) {
58
- S.value = !0;
59
- try {
60
- let e = await d.fetcher();
61
- e.code === 0 && Array.isArray(e.data) && (w.value = z(e.data).map((e) => ({
62
- ...e,
63
- systems: z(e.systems ?? [])
64
- })), L.value = w.value[0]?.id ?? null, C.value = !0);
65
- } catch {} finally {
66
- S.value = !1;
67
- }
68
- }
69
- }
70
- v(x, (e) => {
71
- e && V();
72
- });
73
- function H(e) {
74
- return e ? R.test(e) ? e : d.staticFileFormat ? d.staticFileFormat(e) : e : "";
75
- }
76
- function U(e) {
77
- if (!e.sysUrl) return;
78
- let t;
79
- try {
80
- t = new URL(e.sysUrl, window.location.origin);
81
- } catch {
82
- return;
83
- }
84
- (t.protocol === "http:" || t.protocol === "https:") && (window.open(t.href, "_blank", "noopener,noreferrer"), x.value = !1);
85
- }
86
- return (a, d) => {
87
- let m = r, v = e, C = n, R = t;
88
- return p(), o(C, {
89
- visible: x.value,
90
- "onUpdate:visible": d[0] ||= (e) => x.value = e,
91
- trigger: "click",
92
- placement: "bottom-end",
93
- width: 480,
94
- "show-arrow": !1,
95
- "popper-style": {
96
- padding: 0,
97
- border: "none",
98
- background: "transparent",
99
- boxShadow: "none"
100
- }
101
- }, {
102
- reference: y(() => [l("span", T, [g(a.$slots, "default", { visible: x.value }, void 0, !0)])]),
103
- default: y(() => [b((p(), c("div", E, [B.value.length ? (p(), c("div", D, [(p(!0), c(i, null, h(B.value, (e) => (p(), o(m, {
104
- key: e.id,
105
- content: u.disabledTip,
106
- disabled: !!e.sysUrl,
107
- placement: "left"
108
- }, {
109
- default: y(() => [l("button", {
110
- type: "button",
111
- class: f(["kx-app-switcher__system", { "is-disabled": !e.sysUrl }]),
112
- "aria-disabled": !e.sysUrl,
113
- title: e.description,
114
- onClick: (t) => U(e)
115
- }, [l("span", k, [e.icon ? (p(), c("img", {
116
- key: 0,
117
- class: "kx-app-switcher__icon",
118
- src: H(e.icon),
119
- alt: ""
120
- }, null, 8, A)) : s("", !0)]), l("span", j, _(e.sysName), 1)], 10, O)]),
121
- _: 2
122
- }, 1032, ["content", "disabled"]))), 128))])) : s("", !0), l("div", M, [
123
- d[1] ||= l("div", { class: "kx-app-switcher__title" }, "应用切换", -1),
124
- !S.value && !w.value.length ? (p(), o(v, {
125
- key: 0,
126
- "image-size": 60,
127
- description: "暂无应用"
128
- })) : s("", !0),
129
- (p(!0), c(i, null, h(w.value, (e) => (p(), c("button", {
130
- key: e.id,
131
- type: "button",
132
- class: f(["kx-app-switcher__product", { "is-active": e.id === L.value }]),
133
- title: e.description,
134
- onMouseenter: (t) => L.value = e.id,
135
- onFocus: (t) => L.value = e.id,
136
- onClick: (t) => L.value = e.id
137
- }, [l("span", P, _(e.productName), 1), e.icon ? (p(), c("span", F, [l("img", {
138
- class: "kx-app-switcher__icon",
139
- src: H(e.icon),
140
- alt: ""
141
- }, null, 8, I)])) : s("", !0)], 42, N))), 128))
142
- ])])), [[R, S.value]])]),
143
- _: 3
144
- }, 8, ["visible"]);
145
- };
146
- }
147
- }), [["__scopeId", "data-v-af73d3b0"]]), R = {
148
- KxEmpty: w,
149
- KxAppSwitcher: L
150
- }, z = { install(e) {
151
- Object.entries(R).forEach(([t, n]) => {
21
+ }), [["__scopeId", "data-v-392d5d37"]]), u = { KxEmpty: l }, d = { install(e) {
22
+ Object.entries(u).forEach(([t, n]) => {
152
23
  e.component(t, n);
153
24
  });
154
25
  } };
155
- export { L as KxAppSwitcher, w as KxEmpty, z as default };
26
+ export { l as KxEmpty, d as default };
@@ -0,0 +1,2 @@
1
+ export { default } from "./components/kx-app-switcher/index.vue";
2
+ export type { ApiResult, Product, ProductSystem, } from "./components/kx-app-switcher/types";
@@ -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.4",
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": {