zf-dbs 0.1.0 → 0.1.2

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/package.json CHANGED
@@ -2,16 +2,13 @@
2
2
  "name": "zf-dbs",
3
3
  "type": "module",
4
4
  "description": "",
5
- "version": "0.1.0",
5
+ "version": "0.1.2",
6
6
  "main": "./dist/index.mjs",
7
7
  "module": "./dist/index.mjs",
8
8
  "types": "./dist/index.d.ts",
9
9
  "license": "ISC",
10
10
  "author": "zfowed <zfowed@qq.com>",
11
- "keywords": [
12
- "zf-dbs",
13
- "vite"
14
- ],
11
+ "keywords": [],
15
12
  "files": [
16
13
  "dist"
17
14
  ],
@@ -39,25 +36,26 @@
39
36
  "element-plus": "^2.6.2",
40
37
  "qs": "^6.12.0",
41
38
  "vue": "^3.4.21",
42
- "vue-router": "^4.3.0"
39
+ "vue-router": "^4.3.0",
40
+ "zf-utilz": "^0.1.10"
43
41
  },
44
42
  "devDependencies": {
45
43
  "@types/node": "^20.11.30",
46
44
  "@types/qs": "^6.9.14",
47
- "@typescript-eslint/eslint-plugin": "^6.21.0",
48
- "@typescript-eslint/parser": "^6.21.0",
45
+ "@typescript-eslint/eslint-plugin": "^7.4.0",
46
+ "@typescript-eslint/parser": "^7.4.0",
49
47
  "@vitejs/plugin-vue": "^4.6.2",
50
48
  "eslint": "^8.57.0",
51
49
  "eslint-config-standard": "^17.1.0",
52
- "eslint-plugin-vue": "^9.23.0",
50
+ "eslint-plugin-vue": "^9.24.0",
53
51
  "glob": "^10.3.10",
54
52
  "sass": "^1.72.0",
55
53
  "typescript": "^5.4.3",
56
54
  "unplugin-auto-import": "^0.16.7",
57
- "vite": "^5.2.4",
55
+ "vite": "^5.2.6",
58
56
  "vite-plugin-dts": "^3.7.3",
59
57
  "vite-plugin-lib-inject-css": "^1.3.0",
60
- "vue-tsc": "^1.8.27"
58
+ "vue-tsc": "^2.0.7"
61
59
  },
62
60
  "peerDependencies": {
63
61
  "vue": "^3.3.8",
@@ -72,7 +70,8 @@
72
70
  },
73
71
  "sideEffects": false,
74
72
  "scripts": {
75
- "dev": "vite",
73
+ "release": "pnpm build && pnpm publish",
74
+ "dev": "vite build --watch",
76
75
  "build": "vue-tsc && vite build"
77
76
  }
78
77
  }
@@ -1,152 +0,0 @@
1
- import { ref as y, defineComponent as v, reactive as S, computed as T, provide as z, unref as a, openBlock as p, createElementBlock as g, createVNode as b, withCtx as q, createElementVNode as w, renderSlot as f, normalizeStyle as H } from "vue";
2
- import { Z as x } from "./zkyql-F5.mjs";
3
- import { _ as C } from "./CHgC5LLL.mjs";
4
- class n {
5
- key;
6
- // Token key
7
- autoGetTokenHandle;
8
- // Token 处理函数
9
- /**
10
- * @param key Token key
11
- * @param autoGetTokenHandle Token 处理函数
12
- */
13
- constructor(e, t) {
14
- this.key = e, this.autoGetTokenHandle = t;
15
- }
16
- /**
17
- * 获取 Token
18
- * @returns Token
19
- */
20
- async getToken() {
21
- let e = n.getToken({ key: this.key });
22
- if (!e && this.autoGetTokenHandle) {
23
- const t = await Promise.resolve(this.autoGetTokenHandle());
24
- e = t.token, await this.setToken(e, { expires: t.expires });
25
- }
26
- return e;
27
- }
28
- /**
29
- * 设置 Token
30
- * @param token Token
31
- * @param options 选项
32
- * @returns Token
33
- */
34
- async setToken(e, t) {
35
- return n.setToken(e, { key: this.key, ...t });
36
- }
37
- static baseKey = "token";
38
- // Token 基础 key
39
- /**
40
- * 获取 Token
41
- * @param options 选项 { key: Token key }
42
- * @returns Token
43
- */
44
- static getToken(e) {
45
- const t = n.baseKey + ":" + (e?.key || "default"), s = Number(window.localStorage.getItem(`${t}_expires`) || 0), o = window.localStorage.getItem(t) || null;
46
- return o && s && s < Date.now() ? (window.localStorage.removeItem(t), window.localStorage.removeItem(`${t}_expires`), null) : o;
47
- }
48
- /**
49
- * 设置 Token
50
- * @param token Token
51
- * @param options 选项 { key: Token key, expires: Token 过期时间 }
52
- */
53
- static setToken(e, t) {
54
- const s = n.baseKey + ":" + (t?.key || "default"), o = Date.now() + Number(t?.expires || 0);
55
- window.localStorage.setItem(s, e || ""), window.localStorage.setItem(`${s}_expires`, String(o || 0));
56
- }
57
- }
58
- const l = y(null);
59
- function N(r) {
60
- const e = new n("default", r.requestAutoGetTokenHandle);
61
- return l.value = Object.assign({
62
- appTitle: "zf-dbs template",
63
- appHeight: 1080,
64
- appWidth: r.appWidths?.[0] || 1920,
65
- appWidths: [r.appWidth || 1920],
66
- useScale: !0,
67
- useStretch: !1,
68
- useUE: !1,
69
- pollingInterval: 1e3 * 60 * 5,
70
- requestBaseURL: "",
71
- requestUseMock: !1,
72
- requestFormatCodeKey: "code",
73
- requestFormatMessageKey: "message",
74
- requestFormatDataKey: "data",
75
- requestSuccessCode: [200, "200"],
76
- requestErrorAuthCode: [],
77
- requestErrorAuthHandle: void 0,
78
- requestErrorIgnoreMessageCode: [],
79
- requestTokenCacheKey: "token",
80
- requestTokenHeaderKey: "Authorization",
81
- requestAutoGetTokenHandle: e.autoGetTokenHandle,
82
- sign: void 0
83
- }, r), l;
84
- }
85
- function I() {
86
- if (!l.value)
87
- throw new Error("请先调用 defineConfig 进行配置");
88
- return l;
89
- }
90
- const W = {
91
- key: 0,
92
- class: "app"
93
- }, E = { class: "app__view" }, K = { class: "app__view" }, A = /* @__PURE__ */ v({
94
- __name: "zf-app",
95
- setup(r) {
96
- const e = I(), t = S({
97
- width: window.innerWidth,
98
- height: window.innerHeight
99
- });
100
- window.addEventListener("resize", () => {
101
- t.width = window.innerWidth, t.height = window.innerHeight;
102
- });
103
- function s(i, d) {
104
- const h = i.width / i.height;
105
- return d.reduce((c, u) => {
106
- const m = c.width / c.height, _ = u.width / u.height;
107
- return Math.abs(_ - h) < Math.abs(m - h) ? u : c;
108
- });
109
- }
110
- const o = T(() => {
111
- const i = [
112
- ...e.value.appWidths?.map((d) => ({ width: d, height: e.value.appHeight })) ?? [],
113
- { width: e.value.appWidth, height: e.value.appHeight }
114
- ];
115
- return s(t, i);
116
- });
117
- return z("pageSize", o), (i, d) => a(e).useScale ? (p(), g("div", W, [
118
- b(a(x), {
119
- width: a(o).width,
120
- height: a(o).height,
121
- mode: a(e).useStretch ? "scaleToFill" : "aspectFit"
122
- }, {
123
- default: q(() => [
124
- w("div", E, [
125
- f(i.$slots, "default", {}, void 0, !0)
126
- ])
127
- ]),
128
- _: 3
129
- }, 8, ["width", "height", "mode"])
130
- ])) : (p(), g("div", {
131
- key: 1,
132
- class: "app",
133
- style: H({ width: `${a(e).appWidth}px`, height: `${a(e).appHeight}px` })
134
- }, [
135
- w("div", K, [
136
- f(i.$slots, "default", {}, void 0, !0)
137
- ])
138
- ], 4));
139
- }
140
- }), k = /* @__PURE__ */ C(A, [["__scopeId", "data-v-29b93127"]]), R = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
141
- __proto__: null,
142
- ZfApp: k,
143
- default: k
144
- }, Symbol.toStringTag, { value: "Module" }));
145
- export {
146
- n as T,
147
- R as _,
148
- l as c,
149
- N as d,
150
- I as u,
151
- k as z
152
- };