com-angel-authorization 1.0.6 → 1.0.7

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.
@@ -38,6 +38,9 @@ __export(vue_exports, {
38
38
  RESOURCE_TYPE_API: () => RESOURCE_TYPE_API,
39
39
  ROOT_PARENT_ID: () => ROOT_PARENT_ID,
40
40
  ResourceManager: () => ResourceManager,
41
+ SYSTEM_ADMIN_DEFAULT_KEY: () => SYSTEM_ADMIN_DEFAULT_KEY,
42
+ SYSTEM_ADMIN_MENU: () => SYSTEM_ADMIN_MENU,
43
+ SystemAdmin: () => SystemAdmin,
41
44
  appendQueryParam: () => appendQueryParam,
42
45
  buildCreateBody: () => buildCreateBody,
43
46
  buildCreateMenuBody: () => buildCreateMenuBody,
@@ -547,7 +550,7 @@ function toStringArray(value) {
547
550
  }).filter(Boolean);
548
551
  }
549
552
  if (typeof value === "string" && value.trim()) {
550
- return value.split(",").map((s3) => s3.trim()).filter(Boolean);
553
+ return value.split(",").map((s4) => s4.trim()).filter(Boolean);
551
554
  }
552
555
  return [];
553
556
  }
@@ -2218,6 +2221,186 @@ var MenuManager = (0, import_vue4.defineComponent)({
2218
2221
  ]);
2219
2222
  }
2220
2223
  });
2224
+
2225
+ // src/vue/SystemAdmin.ts
2226
+ var import_vue5 = require("vue");
2227
+
2228
+ // src/admin/menu.ts
2229
+ var SYSTEM_ADMIN_MENU = {
2230
+ key: "system",
2231
+ label: "\u7CFB\u7EDF\u7BA1\u7406",
2232
+ children: [
2233
+ { key: "menu", label: "\u83DC\u5355\u7BA1\u7406" },
2234
+ { key: "resource", label: "\u6743\u9650\u70B9\u7BA1\u7406" }
2235
+ ]
2236
+ };
2237
+ var SYSTEM_ADMIN_DEFAULT_KEY = "menu";
2238
+
2239
+ // src/vue/SystemAdmin.ts
2240
+ var s3 = {
2241
+ root: {
2242
+ display: "flex",
2243
+ minHeight: "560px",
2244
+ border: "1px solid #eaecf0",
2245
+ borderRadius: "12px",
2246
+ overflow: "hidden",
2247
+ background: "#fff",
2248
+ fontFamily: '"PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif',
2249
+ color: "#101828"
2250
+ },
2251
+ sidebar: {
2252
+ width: "200px",
2253
+ flexShrink: "0",
2254
+ borderRight: "1px solid #eaecf0",
2255
+ background: "#f9fafb",
2256
+ padding: "16px 12px"
2257
+ },
2258
+ sidebarTitle: {
2259
+ fontSize: "14px",
2260
+ fontWeight: "600",
2261
+ color: "#344054",
2262
+ padding: "4px 10px 12px"
2263
+ },
2264
+ nav: {
2265
+ display: "flex",
2266
+ flexDirection: "column",
2267
+ gap: "4px"
2268
+ },
2269
+ navItem: {
2270
+ border: "none",
2271
+ background: "transparent",
2272
+ textAlign: "left",
2273
+ padding: "10px 12px",
2274
+ borderRadius: "8px",
2275
+ fontSize: "14px",
2276
+ color: "#475467",
2277
+ cursor: "pointer"
2278
+ },
2279
+ navItemActive: {
2280
+ background: "#e6f7f9",
2281
+ color: "#049BAD",
2282
+ fontWeight: "600"
2283
+ },
2284
+ content: {
2285
+ flex: "1",
2286
+ minWidth: "0",
2287
+ display: "flex",
2288
+ flexDirection: "column",
2289
+ background: "#fff"
2290
+ },
2291
+ contentHeader: {
2292
+ display: "flex",
2293
+ alignItems: "center",
2294
+ justifyContent: "space-between",
2295
+ gap: "12px",
2296
+ padding: "12px 16px",
2297
+ borderBottom: "1px solid #f2f4f7"
2298
+ },
2299
+ breadcrumb: {
2300
+ display: "flex",
2301
+ alignItems: "center",
2302
+ gap: "8px",
2303
+ fontSize: "13px"
2304
+ },
2305
+ breadcrumbParent: { color: "#98a2b3" },
2306
+ breadcrumbSep: { color: "#d0d5dd" },
2307
+ breadcrumbCurrent: { color: "#344054", fontWeight: "600" },
2308
+ panel: {
2309
+ flex: "1",
2310
+ minHeight: "0",
2311
+ overflow: "auto"
2312
+ }
2313
+ };
2314
+ var SystemAdmin = (0, import_vue5.defineComponent)({
2315
+ name: "SystemAdmin",
2316
+ props: {
2317
+ menuApi: {
2318
+ type: Object,
2319
+ required: true
2320
+ },
2321
+ resourceApi: {
2322
+ type: Object,
2323
+ required: true
2324
+ },
2325
+ defaultActiveKey: {
2326
+ type: String,
2327
+ default: SYSTEM_ADMIN_DEFAULT_KEY
2328
+ },
2329
+ activeKey: {
2330
+ type: String,
2331
+ default: void 0
2332
+ },
2333
+ title: {
2334
+ type: String,
2335
+ default: SYSTEM_ADMIN_MENU.label
2336
+ }
2337
+ },
2338
+ emits: {
2339
+ "update:activeKey": (_key) => true,
2340
+ activeKeyChange: (_key) => true
2341
+ },
2342
+ setup(props, { emit, slots }) {
2343
+ const innerKey = (0, import_vue5.ref)(props.defaultActiveKey);
2344
+ (0, import_vue5.watch)(
2345
+ () => props.defaultActiveKey,
2346
+ (value) => {
2347
+ if (props.activeKey === void 0) innerKey.value = value;
2348
+ }
2349
+ );
2350
+ const activeKey = (0, import_vue5.computed)(
2351
+ () => props.activeKey ?? innerKey.value
2352
+ );
2353
+ const activeLabel = (0, import_vue5.computed)(
2354
+ () => SYSTEM_ADMIN_MENU.children.find((item) => item.key === activeKey.value)?.label ?? ""
2355
+ );
2356
+ function setActiveKey(key) {
2357
+ if (props.activeKey === void 0) innerKey.value = key;
2358
+ emit("update:activeKey", key);
2359
+ emit("activeKeyChange", key);
2360
+ }
2361
+ return () => (0, import_vue5.h)("div", { style: s3.root }, [
2362
+ (0, import_vue5.h)("aside", { style: s3.sidebar }, [
2363
+ (0, import_vue5.h)("div", { style: s3.sidebarTitle }, props.title),
2364
+ (0, import_vue5.h)(
2365
+ "nav",
2366
+ { style: s3.nav },
2367
+ SYSTEM_ADMIN_MENU.children.map((item) => {
2368
+ const active = item.key === activeKey.value;
2369
+ return (0, import_vue5.h)(
2370
+ "button",
2371
+ {
2372
+ key: item.key,
2373
+ type: "button",
2374
+ style: {
2375
+ ...s3.navItem,
2376
+ ...active ? s3.navItemActive : {}
2377
+ },
2378
+ onClick: () => setActiveKey(item.key)
2379
+ },
2380
+ item.label
2381
+ );
2382
+ })
2383
+ )
2384
+ ]),
2385
+ (0, import_vue5.h)("main", { style: s3.content }, [
2386
+ (0, import_vue5.h)("div", { style: s3.contentHeader }, [
2387
+ (0, import_vue5.h)("div", { style: s3.breadcrumb }, [
2388
+ (0, import_vue5.h)("span", { style: s3.breadcrumbParent }, props.title),
2389
+ (0, import_vue5.h)("span", { style: s3.breadcrumbSep }, "/"),
2390
+ (0, import_vue5.h)("span", { style: s3.breadcrumbCurrent }, activeLabel.value)
2391
+ ]),
2392
+ slots.toolbarExtra?.()
2393
+ ]),
2394
+ (0, import_vue5.h)("div", { style: s3.panel }, [
2395
+ activeKey.value === "menu" ? (0, import_vue5.h)(MenuManager, { api: props.menuApi, title: "\u83DC\u5355\u7BA1\u7406" }) : (0, import_vue5.h)(ResourceManager, {
2396
+ api: props.resourceApi,
2397
+ title: "\u6743\u9650\u70B9\u7BA1\u7406"
2398
+ })
2399
+ ])
2400
+ ])
2401
+ ]);
2402
+ }
2403
+ });
2221
2404
  // Annotate the CommonJS export names for ESM import in node:
2222
2405
  0 && (module.exports = {
2223
2406
  Can,
@@ -2238,6 +2421,9 @@ var MenuManager = (0, import_vue4.defineComponent)({
2238
2421
  RESOURCE_TYPE_API,
2239
2422
  ROOT_PARENT_ID,
2240
2423
  ResourceManager,
2424
+ SYSTEM_ADMIN_DEFAULT_KEY,
2425
+ SYSTEM_ADMIN_MENU,
2426
+ SystemAdmin,
2241
2427
  appendQueryParam,
2242
2428
  buildCreateBody,
2243
2429
  buildCreateMenuBody,