mvframe 1.0.15 → 1.0.17

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.
Files changed (48) hide show
  1. package/dist/@ctrl.js +710 -0
  2. package/dist/@element-plus.js +659 -0
  3. package/dist/@floating-ui.js +997 -0
  4. package/dist/@sxzz.js +552 -0
  5. package/dist/@turf.js +1 -0
  6. package/dist/@visactor.js +55144 -0
  7. package/dist/@vue.js +30 -0
  8. package/dist/@vueuse.js +583 -0
  9. package/dist/Config.js +131 -109
  10. package/dist/async-validator.js +648 -0
  11. package/dist/composition.js +104 -96
  12. package/dist/css/cpt.css +1 -1
  13. package/dist/css/style.css +1 -1
  14. package/dist/cssfontparser.js +103 -0
  15. package/dist/d3-array.js +1 -0
  16. package/dist/d3-dsv.js +1 -0
  17. package/dist/d3-geo.js +1 -0
  18. package/dist/d3-hexbin.js +1 -0
  19. package/dist/d3-hierarchy.js +1 -0
  20. package/dist/dayjs.js +642 -0
  21. package/dist/element-plus.js +33909 -0
  22. package/dist/eventemitter3.js +113 -0
  23. package/dist/geobuf.js +1 -0
  24. package/dist/geojson-dissolve.js +1 -0
  25. package/dist/geojson-flatten.js +1 -0
  26. package/dist/geojson-linestring-dissolve.js +1 -0
  27. package/dist/gifuct-js.js +110 -0
  28. package/dist/ieee754.js +1 -0
  29. package/dist/index.js +15 -3007
  30. package/dist/js-binary-schema-parser.js +307 -0
  31. package/dist/lodash-es.js +1352 -0
  32. package/dist/lodash-unified.js +1 -0
  33. package/dist/lodash.js +597 -0
  34. package/dist/lottie-web.js +1 -0
  35. package/dist/maps.js +10 -0
  36. package/dist/memoize-one.js +36 -0
  37. package/dist/normalize-wheel-es.js +88 -0
  38. package/dist/pbf.js +1 -0
  39. package/dist/roughjs.js +1 -0
  40. package/dist/simple-statistics.js +1 -0
  41. package/dist/simplify-geojson.js +1 -0
  42. package/dist/simplify-geometry.js +1 -0
  43. package/dist/topojson-client.js +1 -0
  44. package/dist/topojson-server.js +1 -0
  45. package/dist/util.js +28 -26
  46. package/dist/vendor.js +5204 -0
  47. package/package.json +12 -4
  48. package/scripts/scaffold-app.js +202 -61
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mvframe",
3
3
  "packageManager": "yarn@4.4.1",
4
- "version": "1.0.15",
4
+ "version": "1.0.17",
5
5
  "author": "matt avis",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
@@ -14,6 +14,10 @@
14
14
  "import": "./dist/composition.js",
15
15
  "require": "./dist/composition.js"
16
16
  },
17
+ "./maps": {
18
+ "import": "./dist/maps.js",
19
+ "require": "./dist/maps.js"
20
+ },
17
21
  "./store": {
18
22
  "import": "./dist/store.js",
19
23
  "require": "./dist/store.js"
@@ -34,11 +38,12 @@
34
38
  "dev": "vite",
35
39
  "build": "node scripts/prebuild.js",
36
40
  "install-cursor-skill": "node scripts/install-cursor-skill.js",
37
- "scaffold-app": "node scripts/scaffold-app.js"
41
+ "scaffold-app": "node scripts/scaffold-app.js",
42
+ "gen-icon": "node scripts/gen-iconfont-ant-names.js"
38
43
  },
39
44
  "bin": {
40
- "mvframe-install-cursor-skill": "scripts/install-cursor-skill.js",
41
- "mvframe-init-app": "scripts/scaffold-app.js"
45
+ "mvframe-init-app": "scripts/scaffold-app.js",
46
+ "mvframe-install-cursor-skill": "scripts/install-cursor-skill.js"
42
47
  },
43
48
  "files": [
44
49
  "dist/*",
@@ -50,6 +55,9 @@
50
55
  "element-plus": "^2.2.0"
51
56
  },
52
57
  "dependencies": {
58
+ "@visactor/vtable": "^1.26.0",
59
+ "@visactor/vtable-editors": "^1.26.0",
60
+ "dayjs": "^1.11.20",
53
61
  "pinia": "^3.0.0",
54
62
  "vue": "^3.3.4",
55
63
  "vue-router": "^4.6.3",
@@ -106,8 +106,10 @@ function main() {
106
106
  }
107
107
 
108
108
  const dirs = [
109
- "src/views/Home",
110
- "src/views/Admin",
109
+ "src/views/Launch",
110
+ "src/views/Overview",
111
+ "src/views/A",
112
+ "src/views/B",
111
113
  "src/component",
112
114
  "src/assets/img",
113
115
  "src/assets/style",
@@ -115,6 +117,7 @@ function main() {
115
117
  "src/router",
116
118
  "src/pinia/chip",
117
119
  "src/config",
120
+ "src/maps",
118
121
  "src/composition",
119
122
  ];
120
123
  for (const d of dirs) {
@@ -129,8 +132,9 @@ import "element-plus/dist/index.css";
129
132
  import App from "./App.vue";
130
133
  import mvframe from "mvframe";
131
134
  import { pinia, store } from "mvframe/store";
132
- import routes from "./router/index.js";
135
+ import routes from "./router/routes.js";
133
136
  import appConfig from "./config/index.js";
137
+ import appMaps from "./maps/index.js";
134
138
  import "./assets/style/index.scss";
135
139
  import "mvframe/style";
136
140
  import "mvframe/style/cpt";
@@ -145,14 +149,20 @@ const launchRouteGuard = (to, from, next) => {
145
149
  return;
146
150
  }
147
151
  const launch = store.launch(pinia);
152
+ const loginPage = globalThis.$config?.loginPageName || "Entry";
153
+ const firstPage = globalThis.$config?.firstPageName || "Overview_Home";
154
+ if (launch.loggingOut && to.name === loginPage) {
155
+ next();
156
+ return;
157
+ }
148
158
  const authed = Boolean(launch.login);
149
159
  const isPublic = to.matched.some((r) => r.meta?.public);
150
160
  if (!authed && !isPublic) {
151
- next({ name: "Entry", replace: true });
161
+ next({ name: loginPage, replace: true });
152
162
  return;
153
163
  }
154
- if (authed && to.name === "Entry") {
155
- next({ name: "Home_Home", replace: true });
164
+ if (authed && to.name === loginPage) {
165
+ next({ name: firstPage, replace: true });
156
166
  return;
157
167
  }
158
168
  next();
@@ -179,6 +189,7 @@ app.use(mvframe, {
179
189
  storeChips: import.meta.glob("./pinia/chip/*.js", { eager: true }),
180
190
  },
181
191
  config: appConfig,
192
+ maps: appMaps,
182
193
  });
183
194
  app.mount("#app");
184
195
  `,
@@ -209,9 +220,10 @@ const isLoggedIn = computed(() => Boolean(launch.login));
209
220
  );
210
221
 
211
222
  write(
212
- "src/router/baseRouter.js",
223
+ "src/router/routes.js",
213
224
  `/**
214
- * 基础路由:登录等 \`meta.public\` 公开页(不写 public 则需登录,由 main.js 内 launch 守卫处理)。
225
+ * mvframe \`demo/routes.js\` 一致:单文件导出全部路由;\`meta.public\` 为公开页(见 main.js 守卫)。
226
+ * B 嵌套使用 Layout + 子路由;日后若按权限裁剪菜单,可对本数组 \`filter\` 后再交给 Frame。
215
227
  */
216
228
  export default [
217
229
  {
@@ -223,49 +235,71 @@ export default [
223
235
  public: true,
224
236
  },
225
237
  },
226
- ];
227
- `,
228
- );
229
-
230
- write(
231
- "src/router/adminRouter.js",
232
- `/**
233
- * 后台 / 业务路由(需登录后访问):可按接口权限过滤后追加,或整段替换。
234
- * meta.admin 等字段可与 mvframe vueRouter.useAdmin / adminPermission 配合。
235
- */
236
- export default [
237
238
  {
238
- path: "/home",
239
- name: "Home_Home",
240
- component: () => import("@/views/Home/Home.vue"),
239
+ path: "/overview",
240
+ name: "Overview_Home",
241
+ component: () => import("@/views/Overview/Home.vue"),
242
+ meta: {
243
+ title: "Overview",
244
+ admin: true,
245
+ },
246
+ },
247
+ {
248
+ path: "/a",
249
+ name: "A_Home",
250
+ component: () => import("@/views/A/Home.vue"),
241
251
  meta: {
242
- title: "Home",
252
+ title: "A",
253
+ icon: "im-swap-right",
254
+ admin: true,
243
255
  },
244
256
  },
245
257
  {
246
- path: "/admin",
247
- name: "Admin_Dashboard",
248
- component: () => import("@/views/Admin/Dashboard.vue"),
258
+ path: "/b",
259
+ name: "B_Home",
260
+ component: () => import("@/views/B/Layout.vue"),
249
261
  meta: {
250
- title: "Dashboard",
251
- icon: "im-setting",
252
- // admin: true,
262
+ title: "B",
263
+ icon: "im-swap-right",
264
+ admin: true,
253
265
  },
266
+ children: [
267
+ {
268
+ path: "first",
269
+ name: "B_First",
270
+ component: () => import("@/views/B/First.vue"),
271
+ meta: { title: "B_First" },
272
+ },
273
+ {
274
+ path: "second",
275
+ name: "B_Second",
276
+ component: () => import("@/views/B/Second.vue"),
277
+ meta: { title: "B_Second" },
278
+ },
279
+ {
280
+ path: "third",
281
+ name: "B_Third",
282
+ component: () => import("@/views/B/Third.vue"),
283
+ meta: { title: "B_Third" },
284
+ },
285
+ {
286
+ path: "fourth",
287
+ name: "B_Fourth",
288
+ component: () => import("@/views/B/Fourth.vue"),
289
+ meta: { title: "B_Fourth" },
290
+ },
291
+ {
292
+ path: "fifth",
293
+ name: "B_Fifth",
294
+ component: () => import("@/views/B/Fifth.vue"),
295
+ meta: { title: "B_Fifth" },
296
+ },
297
+ ],
254
298
  },
255
299
  ];
256
300
  `,
257
301
  );
258
302
 
259
- write(
260
- "src/router/index.js",
261
- `import baseRouter from "./baseRouter.js";
262
- import adminRouter from "./adminRouter.js";
263
-
264
- /** 交给 mvframe 的 vueRouter.routes(菜单与注册同源,无需拆两份维护) */
265
- export default [...baseRouter, ...adminRouter];
266
- `,
267
- );
268
-
269
303
  write(
270
304
  "src/config/index.js",
271
305
  `/**
@@ -284,6 +318,19 @@ export default {
284
318
  `,
285
319
  );
286
320
 
321
+ write(
322
+ "src/maps/index.js",
323
+ `/**
324
+ * 与 mvframe 内置 maps/chip/*.js 深度合并(不挂全局),供 useMap / getMaps / patchMaps 使用。
325
+ * 顶层键与芯片文件名一致(如 common、asa);子键用 useMap("common.vTableTool.refresh") 读取。
326
+ * @type {Record<string, unknown>}
327
+ */
328
+ export default {
329
+ // asa: { countryAll: { obj: {} } },
330
+ };
331
+ `,
332
+ );
333
+
287
334
  write(
288
335
  "src/pinia/chip/app.js",
289
336
  `/** 业务 Pinia chip:路径须为 pinia/chip/*.js,export default { state, actions } */
@@ -307,10 +354,21 @@ export default {
307
354
  write(
308
355
  "src/pinia/chip/launch.js",
309
356
  `/** 登录态:与 demo/pinia/launch.js、main.js launchRouteGuard、LoginPage 一致 */
357
+ const readLoginFromStorage = () => {
358
+ try {
359
+ const raw = localStorage.getItem("login");
360
+ if (raw == null) return false;
361
+ return raw === "true" || JSON.parse(raw) === true;
362
+ } catch {
363
+ return false;
364
+ }
365
+ };
366
+
310
367
  export default {
311
368
  state: () => ({
312
369
  userinfo: {},
313
- login: false,
370
+ login: readLoginFromStorage(),
371
+ loggingOut: false,
314
372
  }),
315
373
  actions: {
316
374
  /** 登录成功:合并写入 userinfo,并置 login: true */
@@ -320,10 +378,13 @@ export default {
320
378
  ...payload,
321
379
  };
322
380
  this.login = true;
381
+ localStorage.setItem("login", true);
323
382
  },
324
383
  clearLogin() {
325
384
  this.userinfo = {};
326
385
  this.login = false;
386
+ this.loggingOut = false;
387
+ localStorage.removeItem("login");
327
388
  },
328
389
  },
329
390
  };
@@ -357,7 +418,7 @@ defineOptions({
357
418
  </Frame>
358
419
  </template>
359
420
  <script setup>
360
- import routes from "@/router/index.js";
421
+ import routes from "@/router/routes.js";
361
422
 
362
423
  defineOptions({
363
424
  name: "AdminEntry",
@@ -401,6 +462,7 @@ const frameMenu = {
401
462
  <Login
402
463
  :form-fileds="formFileds"
403
464
  :login-methods="[0]"
465
+ :loading="loading"
404
466
  @submit="onSubmit"
405
467
  />
406
468
  </div>
@@ -414,10 +476,18 @@ defineOptions({
414
476
  const router = useRouter();
415
477
  const store = inject("store");
416
478
  const launch = store.launch();
417
-
418
- const onSubmit = (payload) => {
419
- launch.setLogin(payload ?? {});
420
- router.replace({ name: "Home_Home" }).catch(() => {});
479
+ const loading = ref(false);
480
+
481
+ const onSubmit = async (payload) => {
482
+ loading.value = true;
483
+ try {
484
+ launch.setLogin(payload ?? {});
485
+ await router.replace({ name: "Overview_Home" });
486
+ } catch {
487
+ /* 路由失败时仍结束 loading */
488
+ } finally {
489
+ loading.value = false;
490
+ }
421
491
  };
422
492
 
423
493
  /** 与 mvframe demo 一致:自定义提交字段名 account / pwd */
@@ -457,15 +527,18 @@ body {
457
527
  );
458
528
 
459
529
  write(
460
- "src/views/Admin/Dashboard.vue",
530
+ "src/views/Overview/Home.vue",
461
531
  `<template>
462
- <Page title="Dashboard" subtitle="后台路由示例(adminRouter)">
463
- <p>在 <code>src/router/adminRouter.js</code> 扩展;与 <code>baseRouter.js</code> 在 <code>index.js</code> 合并。</p>
532
+ <Page title="Overview" subtitle="登录后默认首页,可替换为业务概览">
533
+ <p>
534
+ 路由与 mvframe <code>demo/routes.js</code> 对齐:<code>/overview</code>、<code>/a</code>、<code>/b/...</code>;公开入口为
535
+ <code>routes.js</code> 中的 <code>Entry</code>。
536
+ </p>
464
537
  </Page>
465
538
  </template>
466
539
  <script setup>
467
540
  defineOptions({
468
- name: "AdminDashboard",
541
+ name: "OverviewHome",
469
542
  inheritAttrs: false,
470
543
  });
471
544
  </script>
@@ -478,18 +551,15 @@ code {
478
551
  );
479
552
 
480
553
  write(
481
- "src/views/Home/Home.vue",
554
+ "src/views/A/Home.vue",
482
555
  `<template>
483
- <Page title="Home" subtitle="MVFrame 雏形页,可从此扩展 views 模块">
484
- <p>
485
- 登录入口为 <code>baseRouter</code> 的 <code>Entry</code>(<code>meta.public</code>);业务路由见
486
- <code>adminRouter.js</code>,合并于 <code>router/index.js</code>,与侧栏菜单同源。
487
- </p>
556
+ <Page title="A" subtitle="一级业务模块示例">
557
+ <p>对应路由 <code>A_Home</code>,路径 <code>/a</code>。</p>
488
558
  </Page>
489
559
  </template>
490
560
  <script setup>
491
561
  defineOptions({
492
- name: "HomeHome",
562
+ name: "AHome",
493
563
  inheritAttrs: false,
494
564
  });
495
565
  </script>
@@ -501,6 +571,52 @@ code {
501
571
  `,
502
572
  );
503
573
 
574
+ write(
575
+ "src/views/B/Layout.vue",
576
+ `<template>
577
+ <Page title="B" subtitle="嵌套路由父级,子页在下方出口渲染">
578
+ <router-view />
579
+ </Page>
580
+ </template>
581
+ <script setup>
582
+ defineOptions({
583
+ name: "BLayout",
584
+ inheritAttrs: false,
585
+ });
586
+ </script>
587
+ `,
588
+ );
589
+
590
+ const bSubPages = [
591
+ ["First", "B_First"],
592
+ ["Second", "B_Second"],
593
+ ["Third", "B_Third"],
594
+ ["Fourth", "B_Fourth"],
595
+ ["Fifth", "B_Fifth"],
596
+ ];
597
+ for (const [file, routeTitle] of bSubPages) {
598
+ write(
599
+ `src/views/B/${file}.vue`,
600
+ `<template>
601
+ <Page title="${routeTitle}" subtitle="B 模块子路由">
602
+ <p>组件 <code>${file}</code>,路由名 <code>${routeTitle}</code>。</p>
603
+ </Page>
604
+ </template>
605
+ <script setup>
606
+ defineOptions({
607
+ name: "B${file}",
608
+ inheritAttrs: false,
609
+ });
610
+ </script>
611
+ <style lang="scss" scoped>
612
+ code {
613
+ font-size: 0.875rem;
614
+ }
615
+ </style>
616
+ `,
617
+ );
618
+ }
619
+
504
620
  write("src/component/.gitkeep", "");
505
621
  write("src/assets/img/.gitkeep", "");
506
622
  write("src/composition/.gitkeep", "");
@@ -542,7 +658,19 @@ export default defineConfig({
542
658
  vue(),
543
659
  AutoImport({
544
660
  include: [/\\.vue$/, /\\.vue\\?vue/, /\\.js$/],
545
- imports: ["vue", "vue-router"],
661
+ imports: [
662
+ "vue",
663
+ "vue-router",
664
+ {
665
+ "mvframe/maps": [
666
+ "useMap",
667
+ "getMaps",
668
+ "patchMaps",
669
+ "mapLang",
670
+ "mapLangPath",
671
+ ],
672
+ },
673
+ ],
546
674
  vueTemplate: true,
547
675
  dts: true,
548
676
  }),
@@ -579,7 +707,19 @@ yarn install
579
707
 
580
708
  ## Launch(登录壳)
581
709
 
582
- 雏形与 **mvframe demo** 对齐:\`pinia/chip/launch.js\`(顶层 \`login\` + \`userinfo\`)、\`App.vue\`(\`<AdminEntry v-if />\` / \`<Entry v-else />\`)、\`main.js\` 内 \`import { store, pinia } from "mvframe/store"\` + \`launchRouteGuard\` + \`useAdmin\` / \`adminPermission\` / \`noaccess\`。未登录仅 \`meta.public\`;已登录进 \`Entry\` 会重定向到 \`Home_Home\`。若不需门禁,将 \`useAdmin\` 改为 \`false\` 并删除 \`adminPermission\` 与 \`noaccess\`。
710
+ 雏形与 **mvframe demo** 对齐:\`pinia/chip/launch.js\`(顶层 \`login\` + \`userinfo\`)、\`App.vue\`(\`<AdminEntry v-if />\` / \`<Entry v-else />\`)、\`main.js\` 内 \`import { store, pinia } from "mvframe/store"\` + \`launchRouteGuard\` + \`useAdmin\` / \`adminPermission\` / \`noaccess\`。未登录仅 \`meta.public\`;已登录进 \`Entry\` 会重定向到 \`Overview_Home\`(\`/overview\`)。若不需门禁,将 \`useAdmin\` 改为 \`false\` 并删除 \`adminPermission\` 与 \`noaccess\`。
711
+
712
+ ## 路由(与 mvframe \`demo/routes.js\` 对齐)
713
+
714
+ | 路由名 | 路径 | 说明 |
715
+ |--------|------|------|
716
+ | \`Entry\` | \`/\` | 登录,\`meta.public\` |
717
+ | \`Overview_Home\` | \`/overview\` | 登录后默认页 |
718
+ | \`A_Home\` | \`/a\` | 一级模块示例 |
719
+ | \`B_Home\` | \`/b\` | 嵌套父级(\`Layout.vue\` + \`router-view\`) |
720
+ | \`B_First\` … \`B_Fifth\` | \`/b/first\` … | 子路由 |
721
+
722
+ 路由集中在 \`src/router/routes.js\`(与 demo 单文件一致);\`Frame\` 的 \`menu.routes\` 由该表筛选掉 \`meta.public\` 后与注册同源。
583
723
 
584
724
  ### 报错 \`Could not resolve '@vue/shared'\`
585
725
 
@@ -606,11 +746,12 @@ yarn install
606
746
  | \`src/api\` | 接口 |
607
747
  | \`src/assets/style\` | 样式入口,main.js 已 import |
608
748
  | \`src/assets/img\` | 静态图 |
609
- | \`src/router/baseRouter.js\` | 基础路由(公开页等) |
610
- | \`src/router/adminRouter.js\` | 后台 / 业务路由(可按权限过滤后合并) |
611
- | \`src/router/index.js\` | 合并导出 → \`vueRouter.routes\`(与 Frame \`menu.routes\` 同源) |
749
+ | \`src/router/routes.js\` | 全部路由(与 \`demo/routes.js\` 结构一致)→ \`vueRouter.routes\` |
750
+ | \`src/views/Launch/*\` | 登录壳与登录页 |
751
+ | \`src/views/Overview\`、\`A\`、\`B\` | 与路由表一一对应的页面 |
612
752
  | \`src/pinia/chip/*.js\` | 业务 store → \`storeChips: import.meta.glob(...)\` |
613
753
  | \`src/config/index.js\` | 合并进 \`globalThis.$config\` |
754
+ | \`src/maps/index.js\` | 与库内置 \`maps/chip\` 深度合并(模块内);\`useMap().$l()\` / \`mapLangPath\` / \`mapLang\` 可由 auto-import 从 \`mvframe/maps\` 引入 |
614
755
  | \`src/composition\` | 可选,与 Vite 别名 \`@cps\` 对应 |
615
756
 
616
757
  ## Cursor Skill(可选)