bmp-layout 0.0.25-beta.3 → 0.0.25-beta.4
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/bmp-layout.es.js +101 -19
- package/bmp-layout.umd.js +3 -3
- package/package.json +1 -1
- package/style.css +1 -1
package/bmp-layout.es.js
CHANGED
|
@@ -1217,6 +1217,28 @@ function buildChildPaths(router) {
|
|
|
1217
1217
|
return { ...child, path: `${parentPath}${childPath}` };
|
|
1218
1218
|
});
|
|
1219
1219
|
}
|
|
1220
|
+
function mergeExampleRoutes(targetModule, exampleRoutes, position = "start") {
|
|
1221
|
+
if (!exampleRoutes || exampleRoutes.length === 0)
|
|
1222
|
+
return;
|
|
1223
|
+
const convertRouteToMenu = (route) => {
|
|
1224
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
1225
|
+
return {
|
|
1226
|
+
name: ((_a2 = route.meta) == null ? void 0 : _a2.title) || route.name || "",
|
|
1227
|
+
path: route.path,
|
|
1228
|
+
icon: ((_b = route.meta) == null ? void 0 : _b.icon) || "",
|
|
1229
|
+
visible: ((_c = route.meta) == null ? void 0 : _c.hidden) !== true,
|
|
1230
|
+
redirect: route.redirect || "",
|
|
1231
|
+
meta: {
|
|
1232
|
+
title: ((_d = route.meta) == null ? void 0 : _d.title) || route.name || "",
|
|
1233
|
+
icon: ((_e = route.meta) == null ? void 0 : _e.icon) || "",
|
|
1234
|
+
hidden: ((_f = route.meta) == null ? void 0 : _f.hidden) === true
|
|
1235
|
+
},
|
|
1236
|
+
children: (route.children || []).map(convertRouteToMenu)
|
|
1237
|
+
};
|
|
1238
|
+
};
|
|
1239
|
+
const converted = exampleRoutes.map(convertRouteToMenu);
|
|
1240
|
+
targetModule.children = position === "start" ? converted.concat(targetModule.children || []) : (targetModule.children || []).concat(converted);
|
|
1241
|
+
}
|
|
1220
1242
|
const usePermissionStore = defineStore("layout-permission", {
|
|
1221
1243
|
state: () => ({
|
|
1222
1244
|
routers: [],
|
|
@@ -1281,12 +1303,13 @@ const usePermissionStore = defineStore("layout-permission", {
|
|
|
1281
1303
|
this.leftMenuRouters = routers;
|
|
1282
1304
|
},
|
|
1283
1305
|
// 处理模块对应菜单
|
|
1284
|
-
setModuleRouters(menuId) {
|
|
1306
|
+
setModuleRouters(menuId, exampleRoutes = [], examplePosition = "start") {
|
|
1285
1307
|
const findRouter = findRouterBy(this.getRoleRouters, "id", menuId);
|
|
1286
1308
|
if (findRouter) {
|
|
1287
1309
|
this.moduleId = findRouter.id;
|
|
1288
1310
|
this.moduleName = findRouter.name;
|
|
1289
1311
|
this.moduleRouters = buildChildPaths(findRouter);
|
|
1312
|
+
mergeExampleRoutes(findRouter, exampleRoutes, examplePosition);
|
|
1290
1313
|
}
|
|
1291
1314
|
},
|
|
1292
1315
|
resetState() {
|
|
@@ -1300,12 +1323,13 @@ const usePermissionStore = defineStore("layout-permission", {
|
|
|
1300
1323
|
this.roleRouters = [];
|
|
1301
1324
|
},
|
|
1302
1325
|
// 处理模块对应菜单(通过模块code)
|
|
1303
|
-
setModuleRoutersByCode(moduleCode) {
|
|
1326
|
+
setModuleRoutersByCode(moduleCode, exampleRoutes = [], examplePosition = "start") {
|
|
1304
1327
|
const findRouter = findRouterBy(this.getRoleRouters, "moduleCode", moduleCode);
|
|
1305
1328
|
if (findRouter) {
|
|
1306
1329
|
this.moduleId = findRouter.id;
|
|
1307
1330
|
this.moduleName = findRouter.name;
|
|
1308
1331
|
this.moduleRouters = buildChildPaths(findRouter);
|
|
1332
|
+
mergeExampleRoutes(findRouter, exampleRoutes, examplePosition);
|
|
1309
1333
|
}
|
|
1310
1334
|
}
|
|
1311
1335
|
},
|
|
@@ -8651,9 +8675,10 @@ const _sfc_main$r = /* @__PURE__ */ Object.assign({ name: "ProductServicePanel"
|
|
|
8651
8675
|
return paths.filter(Boolean).reduce((result, path) => {
|
|
8652
8676
|
if (!result)
|
|
8653
8677
|
return path;
|
|
8678
|
+
if (path.startsWith("/"))
|
|
8679
|
+
return path;
|
|
8654
8680
|
const normalizedBase = result.endsWith("/") ? result.slice(0, -1) : result;
|
|
8655
|
-
|
|
8656
|
-
return `${normalizedBase}/${normalizedPath}`;
|
|
8681
|
+
return `${normalizedBase}/${path}`;
|
|
8657
8682
|
}, "");
|
|
8658
8683
|
};
|
|
8659
8684
|
const getAccessiblePath = (item, parentPath = "") => {
|
|
@@ -8678,10 +8703,11 @@ const _sfc_main$r = /* @__PURE__ */ Object.assign({ name: "ProductServicePanel"
|
|
|
8678
8703
|
var _a2, _b, _c, _d;
|
|
8679
8704
|
const fullPath = getAccessiblePath(item, parentPath);
|
|
8680
8705
|
if (fullPath) {
|
|
8706
|
+
const normalizedPath = fullPath.startsWith("/") ? fullPath : `/${fullPath}`;
|
|
8681
8707
|
const currentModuleId = permissionStore.getModuleId;
|
|
8682
8708
|
const selectedModuleId = (_b = (_a2 = productList.value[activeProductIndex.value]) == null ? void 0 : _a2.children[activeModuleIndex.value]) == null ? void 0 : _b.id;
|
|
8683
|
-
if (selectedModuleId === currentModuleId) {
|
|
8684
|
-
router.push(
|
|
8709
|
+
if (selectedModuleId === currentModuleId || fullPath.startsWith("/")) {
|
|
8710
|
+
router.push(normalizedPath);
|
|
8685
8711
|
} else {
|
|
8686
8712
|
const currentOrigin = window.location.origin;
|
|
8687
8713
|
const modulePath = ((_d = (_c = productList.value[activeProductIndex.value]) == null ? void 0 : _c.children[activeModuleIndex.value]) == null ? void 0 : _d.modulePath) || "";
|
|
@@ -8807,7 +8833,7 @@ const _sfc_main$r = /* @__PURE__ */ Object.assign({ name: "ProductServicePanel"
|
|
|
8807
8833
|
}, [
|
|
8808
8834
|
createVNode(unref(_sfc_main$x), {
|
|
8809
8835
|
icon: product.icon ? product.icon : "svg-icon:clipboard",
|
|
8810
|
-
size:
|
|
8836
|
+
size: 16
|
|
8811
8837
|
}, null, 8, ["icon"]),
|
|
8812
8838
|
createElementVNode("span", null, toDisplayString(product.title), 1),
|
|
8813
8839
|
product.children.length > 0 ? (openBlock(), createElementBlock("div", {
|
|
@@ -8942,7 +8968,7 @@ const _sfc_main$r = /* @__PURE__ */ Object.assign({ name: "ProductServicePanel"
|
|
|
8942
8968
|
};
|
|
8943
8969
|
}
|
|
8944
8970
|
});
|
|
8945
|
-
const ProductServicePanel = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-
|
|
8971
|
+
const ProductServicePanel = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-8066b9b5"]]);
|
|
8946
8972
|
const _sfc_main$q = /* @__PURE__ */ Object.assign({ name: "Logo" }, {
|
|
8947
8973
|
__name: "Logo",
|
|
8948
8974
|
emits: ["logo-click"],
|
|
@@ -8998,7 +9024,7 @@ const _sfc_main$q = /* @__PURE__ */ Object.assign({ name: "Logo" }, {
|
|
|
8998
9024
|
};
|
|
8999
9025
|
}
|
|
9000
9026
|
});
|
|
9001
|
-
const _hoisted_1$a = { class: "w-full min-w-1000px" };
|
|
9027
|
+
const _hoisted_1$a = { class: "w-full min-w-1000px h-full" };
|
|
9002
9028
|
const _sfc_main$p = /* @__PURE__ */ Object.assign({ name: "AppView" }, {
|
|
9003
9029
|
__name: "AppView",
|
|
9004
9030
|
setup(__props) {
|
|
@@ -10447,7 +10473,13 @@ const {
|
|
|
10447
10473
|
} = useDesign();
|
|
10448
10474
|
const prefixCls$1 = getPrefixCls$1("layout");
|
|
10449
10475
|
const scrollRef = ref();
|
|
10450
|
-
const useRenderLayout = (
|
|
10476
|
+
const useRenderLayout = (props, {
|
|
10477
|
+
onLogoClick,
|
|
10478
|
+
onMessageClick,
|
|
10479
|
+
onLogoutClick,
|
|
10480
|
+
onClearCacheLogoutClick,
|
|
10481
|
+
onSwitchCompanyClick
|
|
10482
|
+
}) => {
|
|
10451
10483
|
const appStore = useAppStore();
|
|
10452
10484
|
const permissionStore = usePermissionStore();
|
|
10453
10485
|
const pageLoading = computed(() => appStore.getPageLoading);
|
|
@@ -10561,12 +10593,12 @@ const useRenderLayout = (onLogoClick, onMessageClick, onLogoutClick, onClearCach
|
|
|
10561
10593
|
"onSwitchCompanyClick": onSwitchCompanyClick
|
|
10562
10594
|
}, null)]), createVNode("div", {
|
|
10563
10595
|
"class": [`${prefixCls$1}-content`, "w-full h-[calc(100%-var(--top-tool-height))]"]
|
|
10564
|
-
}, [withDirectives(createVNode(ElScrollbar, {
|
|
10596
|
+
}, [props.scroll ? withDirectives(createVNode(ElScrollbar, {
|
|
10565
10597
|
"class": [`${prefixCls$1}-content-scrollbar`],
|
|
10566
10598
|
"ref": scrollRef
|
|
10567
10599
|
}, {
|
|
10568
10600
|
default: () => [createVNode(_sfc_main$p, null, null)]
|
|
10569
|
-
}), [[resolveDirective("loading"), pageLoading.value]])])]);
|
|
10601
|
+
}), [[resolveDirective("loading"), pageLoading.value]]) : createVNode(_sfc_main$p, null, null)])]);
|
|
10570
10602
|
};
|
|
10571
10603
|
const renderTopLeft = () => {
|
|
10572
10604
|
return createVNode(Fragment, null, [createVNode("div", {
|
|
@@ -10631,13 +10663,25 @@ const {
|
|
|
10631
10663
|
} = useDesign();
|
|
10632
10664
|
const prefixCls = getPrefixCls("layout");
|
|
10633
10665
|
const layoutScrollRef = ref();
|
|
10634
|
-
const renderLayout = (layout,
|
|
10666
|
+
const renderLayout = (layout, props, {
|
|
10667
|
+
handleLogoClick,
|
|
10668
|
+
handleMessageClick,
|
|
10669
|
+
handleLogoutClick,
|
|
10670
|
+
handleClearCacheLogoutClick,
|
|
10671
|
+
handleSwitchCompanyClick
|
|
10672
|
+
}) => {
|
|
10635
10673
|
const {
|
|
10636
10674
|
renderLeft,
|
|
10637
10675
|
renderTop,
|
|
10638
10676
|
renderTopLeft,
|
|
10639
10677
|
scrollRef: scrollRef2
|
|
10640
|
-
} = useRenderLayout(
|
|
10678
|
+
} = useRenderLayout(props, {
|
|
10679
|
+
onLogoClick: handleLogoClick,
|
|
10680
|
+
onMessageClick: handleMessageClick,
|
|
10681
|
+
onLogoutClick: handleLogoutClick,
|
|
10682
|
+
onClearCacheLogoutClick: handleClearCacheLogoutClick,
|
|
10683
|
+
onSwitchCompanyClick: handleSwitchCompanyClick
|
|
10684
|
+
});
|
|
10641
10685
|
layoutScrollRef.value = scrollRef2.value;
|
|
10642
10686
|
switch (unref(layout)) {
|
|
10643
10687
|
case "left":
|
|
@@ -10650,6 +10694,12 @@ const renderLayout = (layout, onLogoClick, onMessageClick, onLogoutClick, onClea
|
|
|
10650
10694
|
};
|
|
10651
10695
|
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
10652
10696
|
name: "Layout",
|
|
10697
|
+
props: {
|
|
10698
|
+
scroll: {
|
|
10699
|
+
type: Boolean,
|
|
10700
|
+
default: true
|
|
10701
|
+
}
|
|
10702
|
+
},
|
|
10653
10703
|
emits: ["logo-click", "message-click", "logout-click", "clear-cache-logout-click", "switch-company-click"],
|
|
10654
10704
|
setup(props, {
|
|
10655
10705
|
emit
|
|
@@ -10675,10 +10725,16 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
10675
10725
|
};
|
|
10676
10726
|
return () => createVNode("section", {
|
|
10677
10727
|
"class": [prefixCls, `${prefixCls}__${layout.value}`, "w-[100%] h-[100%] relative", `${prefixCls}__${theme.value}`]
|
|
10678
|
-
}, [renderLayout(layout,
|
|
10728
|
+
}, [renderLayout(layout, props, {
|
|
10729
|
+
handleLogoClick,
|
|
10730
|
+
handleMessageClick,
|
|
10731
|
+
handleLogoutClick,
|
|
10732
|
+
handleClearCacheLogoutClick,
|
|
10733
|
+
handleSwitchCompanyClick
|
|
10734
|
+
}), props.scroll && createVNode(_sfc_main$y, null, null)]);
|
|
10679
10735
|
}
|
|
10680
10736
|
});
|
|
10681
|
-
const Layout = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-
|
|
10737
|
+
const Layout = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-0945fd78"]]);
|
|
10682
10738
|
const _sfc_main$d = {
|
|
10683
10739
|
__name: "ConfigGlobal",
|
|
10684
10740
|
props: {
|
|
@@ -10750,6 +10806,22 @@ const _sfc_main$c = /* @__PURE__ */ Object.assign({ name: "PageCard" }, {
|
|
|
10750
10806
|
padding: "16px"
|
|
10751
10807
|
};
|
|
10752
10808
|
}
|
|
10809
|
+
},
|
|
10810
|
+
customClass: {
|
|
10811
|
+
type: String,
|
|
10812
|
+
default: ""
|
|
10813
|
+
},
|
|
10814
|
+
scroll: {
|
|
10815
|
+
type: Boolean,
|
|
10816
|
+
default: false
|
|
10817
|
+
},
|
|
10818
|
+
scrollHeight: {
|
|
10819
|
+
type: String,
|
|
10820
|
+
default: void 0
|
|
10821
|
+
},
|
|
10822
|
+
scrollMaxHeight: {
|
|
10823
|
+
type: String,
|
|
10824
|
+
default: void 0
|
|
10753
10825
|
}
|
|
10754
10826
|
},
|
|
10755
10827
|
setup(__props) {
|
|
@@ -10759,17 +10831,27 @@ const _sfc_main$c = /* @__PURE__ */ Object.assign({ name: "PageCard" }, {
|
|
|
10759
10831
|
return openBlock(), createBlock(unref(ElCard), {
|
|
10760
10832
|
"body-style": __props.bodyStyle,
|
|
10761
10833
|
header: __props.title,
|
|
10762
|
-
class: normalizeClass([unref(prefixCls2), "mx-16px my-16px"])
|
|
10834
|
+
class: normalizeClass([unref(prefixCls2), __props.customClass, "mx-16px my-16px"])
|
|
10763
10835
|
}, {
|
|
10764
10836
|
default: withCtx(() => [
|
|
10765
|
-
|
|
10837
|
+
__props.scroll ? (openBlock(), createBlock(unref(ElScrollbar), {
|
|
10838
|
+
key: 0,
|
|
10839
|
+
height: __props.scrollHeight,
|
|
10840
|
+
"max-height": __props.scrollMaxHeight,
|
|
10841
|
+
always: ""
|
|
10842
|
+
}, {
|
|
10843
|
+
default: withCtx(() => [
|
|
10844
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
10845
|
+
]),
|
|
10846
|
+
_: 3
|
|
10847
|
+
}, 8, ["height", "max-height"])) : renderSlot(_ctx.$slots, "default", { key: 1 }, void 0, true)
|
|
10766
10848
|
]),
|
|
10767
10849
|
_: 3
|
|
10768
10850
|
}, 8, ["body-style", "header", "class"]);
|
|
10769
10851
|
};
|
|
10770
10852
|
}
|
|
10771
10853
|
});
|
|
10772
|
-
const PageCard = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-
|
|
10854
|
+
const PageCard = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-8351baee"]]);
|
|
10773
10855
|
const _hoisted_1$5 = { class: "ml-2px" };
|
|
10774
10856
|
const _hoisted_2$5 = { class: "flex items-center" };
|
|
10775
10857
|
const _sfc_main$b = /* @__PURE__ */ Object.assign({ name: "PageNavBar" }, {
|