vome-core 0.0.84 → 0.0.86
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/admin/config/plugin-dev.js +1 -1
- package/dist/admin/crud/components/vm-switch.vue +30 -2
- package/dist/admin/crud/config.js +1 -1
- package/dist/admin/crud/confirm.js +1 -1
- package/dist/admin/crud/dict.js +1 -1
- package/dist/admin/crud/index.js +1 -1
- package/dist/admin/crud/key.js +1 -1
- package/dist/admin/crud/mitt.js +1 -1
- package/dist/admin/crud/plugins.js +1 -1
- package/dist/admin/crud/span.js +1 -1
- package/dist/admin/crud/style.js +1 -1
- package/dist/admin/crud/validate.js +1 -1
- package/dist/admin/crud/vm-search.vue +16 -32
- package/dist/admin/crud/vm-table.vue +22 -6
- package/dist/admin/crud/vm-upsert.vue +14 -2
- package/dist/admin/directives/perm.js +1 -1
- package/dist/admin/hooks/useUpload.js +1 -1
- package/dist/admin/index.d.ts +1 -0
- package/dist/admin/index.js +8 -0
- package/dist/admin/lib/browser.js +1 -1
- package/dist/admin/lib/cn.js +1 -1
- package/dist/admin/lib/dialog-float.js +1 -1
- package/dist/admin/lib/export-excel.js +1 -1
- package/dist/admin/lib/import-excel.js +1 -1
- package/dist/admin/lib/json.js +1 -1
- package/dist/admin/lib/menu.js +1 -1
- package/dist/admin/lib/tree.js +1 -1
- package/dist/admin/lib/upload.js +1 -1
- package/dist/admin/lib/video-frame.js +1 -1
- package/dist/client/dict.d.ts +31 -0
- package/dist/client/dict.js +53 -0
- package/dist/client/eps.d.ts +4 -2
- package/dist/client/eps.js +29 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.js +10 -1
- package/dist/client/service.js +2 -8
- package/dist/client/vite-plugin-eps.js +6 -2
- package/dist/index.js +1 -1
- package/dist/server/index.js +1 -1
- package/dist/shared/excel.js +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/shared/locale-json.js +1 -1
- package/dist/shared/tree.js +1 -1
- package/dist/src/agent/protocol.d.ts +9 -5
- package/dist/src/routing/eps.d.ts +2 -2
- package/dist/src/routing/index.d.ts +1 -1
- package/dist/typings/routing/eps.d.ts +14 -0
- package/package.json +1 -1
- package/typings/admin/comm/eps.d.ts +13 -0
- package/typings/admin/comm/eps.ts +15 -0
package/dist/client/eps.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { EpsEntity, EpsModuleMap } from '../../typings/admin/comm/eps';
|
|
1
|
+
import type { EpsEntity, EpsModuleMap, EpsPayload } from '../../typings/admin/comm/eps';
|
|
2
2
|
export type EpsSide = 'admin' | 'app';
|
|
3
|
-
/**
|
|
3
|
+
/** 兼容旧版纯 modules map 与新版 { modules, dict } */
|
|
4
|
+
export declare function parseEpsPayload(input: unknown): EpsPayload;
|
|
5
|
+
/** 拉取 EPS;公开接口建议 request 侧 toast:false;顺带灌入字典本地缓存 */
|
|
4
6
|
export declare function loadEps(force?: boolean, side?: EpsSide): Promise<EpsModuleMap>;
|
|
5
7
|
export declare function loadAllEps(force?: boolean): Promise<{
|
|
6
8
|
admin: EpsModuleMap;
|
package/dist/client/eps.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getClientRequest } from "./configure";
|
|
2
|
+
import { clearDictCache, hydrateDictFromEps } from "./dict";
|
|
2
3
|
const EPS_URL = {
|
|
3
4
|
admin: "/admin/base/open/eps",
|
|
4
5
|
app: "/app/base/open/eps"
|
|
@@ -7,11 +8,37 @@ const cache = {
|
|
|
7
8
|
admin: null,
|
|
8
9
|
app: null
|
|
9
10
|
};
|
|
11
|
+
function isEpsPayload(input) {
|
|
12
|
+
return Boolean(input && typeof input === "object" && "modules" in input && input.modules && typeof input.modules === "object");
|
|
13
|
+
}
|
|
14
|
+
export function parseEpsPayload(input) {
|
|
15
|
+
if (!input || typeof input !== "object") {
|
|
16
|
+
return { modules: {}, dict: {} };
|
|
17
|
+
}
|
|
18
|
+
const m = input;
|
|
19
|
+
if ("code" in m && "data" in m && m.data && typeof m.data === "object" && !Array.isArray(m.data)) {
|
|
20
|
+
return parseEpsPayload(m.data);
|
|
21
|
+
}
|
|
22
|
+
if (isEpsPayload(input)) {
|
|
23
|
+
return {
|
|
24
|
+
modules: input.modules || {},
|
|
25
|
+
dict: input.dict && typeof input.dict === "object" ? input.dict : {}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return { modules: input, dict: {} };
|
|
29
|
+
}
|
|
10
30
|
export async function loadEps(force = false, side = "admin") {
|
|
11
31
|
if (cache[side] && !force)
|
|
12
32
|
return cache[side];
|
|
13
33
|
const request = getClientRequest();
|
|
14
|
-
|
|
34
|
+
const raw = await request(EPS_URL[side], {
|
|
35
|
+
toast: false
|
|
36
|
+
});
|
|
37
|
+
const payload = parseEpsPayload(raw);
|
|
38
|
+
cache[side] = payload.modules || {};
|
|
39
|
+
if (payload.dict && Object.keys(payload.dict).length) {
|
|
40
|
+
hydrateDictFromEps(payload.dict);
|
|
41
|
+
}
|
|
15
42
|
return cache[side];
|
|
16
43
|
}
|
|
17
44
|
export async function loadAllEps(force = false) {
|
|
@@ -39,4 +66,5 @@ export function clearEpsCache(side) {
|
|
|
39
66
|
}
|
|
40
67
|
cache.admin = null;
|
|
41
68
|
cache.app = null;
|
|
69
|
+
clearDictCache();
|
|
42
70
|
}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { configureClient, getClientRequest, type ClientHooks, type ClientRequestFn, } from './configure';
|
|
2
|
-
export { loadEps, loadAllEps, getEps, findEpsEntity, clearEpsCache, type EpsSide, } from './eps';
|
|
2
|
+
export { loadEps, loadAllEps, getEps, findEpsEntity, clearEpsCache, parseEpsPayload, type EpsSide, } from './eps';
|
|
3
|
+
export { getDict, getDictMap, getDictOptions, hydrateDictFromEps, replaceDictTrees, clearDictCache, type EpsDictNode, type EpsDictMap, type EpsDictRow, } from './dict';
|
|
3
4
|
export { BaseService } from './base';
|
|
4
5
|
export { service, getService, createEps, bindEpsHotReload, setServicePerms, resolveService, serviceOf, type CreateEpsOptions, type ServiceLeaf, type ServiceTree, } from './service';
|
|
5
6
|
export { createLocaleStore, type I18nLangItem, type LocalePersist, type LocalePackApi, type CreateLocaleStoreOptions, } from './locale-store';
|
package/dist/client/index.js
CHANGED
|
@@ -7,8 +7,17 @@ export {
|
|
|
7
7
|
loadAllEps,
|
|
8
8
|
getEps,
|
|
9
9
|
findEpsEntity,
|
|
10
|
-
clearEpsCache
|
|
10
|
+
clearEpsCache,
|
|
11
|
+
parseEpsPayload
|
|
11
12
|
} from "./eps";
|
|
13
|
+
export {
|
|
14
|
+
getDict,
|
|
15
|
+
getDictMap,
|
|
16
|
+
getDictOptions,
|
|
17
|
+
hydrateDictFromEps,
|
|
18
|
+
replaceDictTrees,
|
|
19
|
+
clearDictCache
|
|
20
|
+
} from "./dict";
|
|
12
21
|
export { BaseService } from "./base";
|
|
13
22
|
export {
|
|
14
23
|
service,
|
package/dist/client/service.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseService } from "./base";
|
|
2
|
-
import { loadEps } from "./eps";
|
|
2
|
+
import { loadEps, parseEpsPayload } from "./eps";
|
|
3
3
|
function toCamel(str) {
|
|
4
4
|
return str.replace(/([^-])(?:-+([^-]))/g, (_m, a, b) => a + String(b).toUpperCase());
|
|
5
5
|
}
|
|
@@ -120,13 +120,7 @@ function buildFromEps(map, side, root) {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
function normalizeEpsMap(input) {
|
|
123
|
-
|
|
124
|
-
return {};
|
|
125
|
-
const m = input;
|
|
126
|
-
if ("code" in m && "data" in m && m.data && typeof m.data === "object" && !Array.isArray(m.data)) {
|
|
127
|
-
return m.data;
|
|
128
|
-
}
|
|
129
|
-
return input;
|
|
123
|
+
return parseEpsPayload(input).modules;
|
|
130
124
|
}
|
|
131
125
|
function countPrefixedEntities(map) {
|
|
132
126
|
return Object.values(map).flat().filter((e) => e && typeof e === "object" && Boolean(e.prefix)).length;
|
|
@@ -140,9 +140,13 @@ async function fetchEps(apiUrl) {
|
|
|
140
140
|
try {
|
|
141
141
|
const res = await fetch(apiUrl, { signal: AbortSignal.timeout(5000) });
|
|
142
142
|
const json = await res.json();
|
|
143
|
-
if (json?.code
|
|
144
|
-
return
|
|
143
|
+
if (json?.code !== 1000 || !json.data || typeof json.data !== "object") {
|
|
144
|
+
return null;
|
|
145
145
|
}
|
|
146
|
+
const data = json.data;
|
|
147
|
+
const modules = "modules" in data && data.modules && typeof data.modules === "object" ? data.modules : data;
|
|
148
|
+
if (modules && Object.keys(modules).length)
|
|
149
|
+
return modules;
|
|
146
150
|
} catch {}
|
|
147
151
|
return null;
|
|
148
152
|
}
|