swico 2.9.0-beta.2 → 2.9.0-beta.3

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swico",
3
- "version": "2.9.0-beta.2",
3
+ "version": "2.9.0-beta.3",
4
4
  "description": "Simple, efficient, and practical front-end framework",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -1,9 +1,3 @@
1
1
  import { SwicoHistoryType } from '../../../typings/global-type';
2
2
  export declare let history: SwicoHistoryType;
3
- export declare const formatAncPath: (ancPath: string) => string;
4
- export declare const pathNameList: {
5
- path: string;
6
- name: string;
7
- custom?: any;
8
- }[];
9
3
  export declare const getRouter: () => import("vue-router").Router;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getRouter = exports.pathNameList = exports.formatAncPath = exports.history = void 0;
6
+ exports.getRouter = exports.history = void 0;
7
7
  const vue_router_1 = require("vue-router");
8
8
  const router_1 = require("./router");
9
9
  const qs_1 = __importDefault(require("qs"));
@@ -14,26 +14,6 @@ const transformRouteItemCustomToMeta = (routeItem) => {
14
14
  return Object.assign(Object.assign({}, newRouteItem), { children: children === null || children === void 0 ? void 0 : children.map((item) => transformRouteItemCustomToMeta(item)) });
15
15
  };
16
16
  const formatRoutes = router_1.routes.map((routeItem) => transformRouteItemCustomToMeta(routeItem));
17
- const formatAncPath = (ancPath) => {
18
- let newAncPath = ancPath.startsWith('/') ? ancPath : '/' + ancPath;
19
- newAncPath = newAncPath.endsWith('/') ? newAncPath.slice(0, -1) : newAncPath;
20
- return newAncPath;
21
- };
22
- exports.formatAncPath = formatAncPath;
23
- const getPathNameList = (routes) => {
24
- const list = [];
25
- const checkRouteItem = (item, ancPath) => {
26
- const { path, name, children, custom } = item;
27
- const newAncPath = `${(0, exports.formatAncPath)(ancPath)}${path.startsWith('/') ? path : '/' + path}`;
28
- list.push({ path: newAncPath, name, custom });
29
- if (children) {
30
- children.some((item) => checkRouteItem(item, newAncPath));
31
- }
32
- };
33
- routes.forEach((item) => checkRouteItem(item, ''));
34
- return list;
35
- };
36
- exports.pathNameList = getPathNameList(router_1.routes);
37
17
  const getRouter = () => {
38
18
  const router = (0, vue_router_1.createRouter)({
39
19
  history: (router_1.routerType === 'hash' ? vue_router_1.createWebHashHistory : vue_router_1.createWebHistory)(router_1.routerBase),
@@ -14,11 +14,10 @@ const Container = (0, vue_1.defineComponent)({
14
14
  const error = (0, vue_1.ref)(null);
15
15
  (0, vue_1.onErrorCaptured)((err) => {
16
16
  error.value = err.toString();
17
- return false;
18
17
  });
19
18
  return { error };
20
19
  },
21
- template: '<SwicoLayout v-if="!error"></SwicoLayout>'
20
+ template: '<SwicoLayout ></SwicoLayout>'
22
21
  });
23
22
  const router = (0, history_1.getRouter)();
24
23
  const app = (0, vue_1.createApp)(Container);
@@ -8,7 +8,6 @@ const vue_router_1 = require("vue-router");
8
8
  const qs_1 = __importDefault(require("qs"));
9
9
  const vue_1 = require("vue");
10
10
  const router_1 = require("./$env/router");
11
- const history_1 = require("./$env/history");
12
11
  const getFormatRouterBase = (routerBase) => {
13
12
  const lastIndexBase = routerBase[routerBase.length - 1];
14
13
  return lastIndexBase === '/' ? routerBase.slice(0, routerBase.length - 1) : routerBase;
@@ -46,7 +45,6 @@ exports.useLocation = useLocation;
46
45
  const useNav = () => {
47
46
  const router = (0, vue_router_1.useRouter)();
48
47
  const newNavigate = (to, options) => {
49
- var _a;
50
48
  switch (typeof to) {
51
49
  case 'string':
52
50
  if (options === null || options === void 0 ? void 0 : options.replace) {
@@ -60,10 +58,6 @@ const useNav = () => {
60
58
  router.go(to);
61
59
  break;
62
60
  case 'object': {
63
- const name = to.name;
64
- if (name && !((_a = history_1.pathNameList.find((item) => item.name === name)) === null || _a === void 0 ? void 0 : _a.path)) {
65
- throw `An error occurred while executing 'useNav()' operation: The path for the name "${to.name}" could not be found`;
66
- }
67
61
  if (options === null || options === void 0 ? void 0 : options.replace) {
68
62
  router.replace(to);
69
63
  }