com-angel-authorization 1.0.6 → 1.0.8
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/README.md +32 -2
- package/dist/index.cjs +19 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -4
- package/dist/index.d.ts +24 -4
- package/dist/index.js +18 -6
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +163 -10
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +40 -4
- package/dist/react/index.d.ts +40 -4
- package/dist/react/index.js +160 -10
- package/dist/react/index.js.map +1 -1
- package/dist/vue/index.cjs +199 -11
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.d.cts +83 -4
- package/dist/vue/index.d.ts +83 -4
- package/dist/vue/index.js +196 -11
- package/dist/vue/index.js.map +1 -1
- package/package.json +1 -1
package/dist/vue/index.d.cts
CHANGED
|
@@ -222,7 +222,8 @@ type AuthorizationResourceListResult = {
|
|
|
222
222
|
};
|
|
223
223
|
type MenuResource = {
|
|
224
224
|
resourceId: string;
|
|
225
|
-
|
|
225
|
+
/** 上级菜单 ID;无上级时为 null */
|
|
226
|
+
parentId: string | null;
|
|
226
227
|
type: MenuResourceType;
|
|
227
228
|
name: string;
|
|
228
229
|
identification: string;
|
|
@@ -232,7 +233,8 @@ type MenuResource = {
|
|
|
232
233
|
status: ResourceStatus;
|
|
233
234
|
};
|
|
234
235
|
type MenuResourceFormValues = {
|
|
235
|
-
|
|
236
|
+
/** 上级菜单 ID;选择「无」时为 null */
|
|
237
|
+
parentId: string | null;
|
|
236
238
|
type: MenuResourceType;
|
|
237
239
|
name: string;
|
|
238
240
|
identification: string;
|
|
@@ -258,7 +260,11 @@ declare const MENU_TYPE_MENU: MenuResourceType;
|
|
|
258
260
|
declare const MENU_TYPE_BUTTON: MenuResourceType;
|
|
259
261
|
/** 菜单列表查询 type 参数 */
|
|
260
262
|
declare const MENU_LIST_TYPE_PARAM = "page,menu,button";
|
|
261
|
-
|
|
263
|
+
/**
|
|
264
|
+
* 上级菜单选择「无」时,表单 select 使用的空值。
|
|
265
|
+
* 提交接口时会转换为 parentId: null。
|
|
266
|
+
*/
|
|
267
|
+
declare const ROOT_PARENT_ID = "";
|
|
262
268
|
declare const RESOURCE_STATUS_ENABLED: ResourceStatus;
|
|
263
269
|
declare const RESOURCE_STATUS_DISABLED: ResourceStatus;
|
|
264
270
|
declare const RESOURCE_STATUS_OPTIONS: {
|
|
@@ -402,6 +408,79 @@ declare const MenuManager: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
402
408
|
pageSize: string;
|
|
403
409
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
404
410
|
|
|
411
|
+
type SystemAdminMenuKey = 'menu' | 'resource';
|
|
412
|
+
type SystemAdminSubMenu = {
|
|
413
|
+
key: SystemAdminMenuKey;
|
|
414
|
+
label: string;
|
|
415
|
+
};
|
|
416
|
+
type SystemAdminMenuGroup = {
|
|
417
|
+
key: 'system';
|
|
418
|
+
label: string;
|
|
419
|
+
children: SystemAdminSubMenu[];
|
|
420
|
+
};
|
|
421
|
+
/** 系统管理菜单结构:菜单管理、权限点管理为其子菜单 */
|
|
422
|
+
declare const SYSTEM_ADMIN_MENU: SystemAdminMenuGroup;
|
|
423
|
+
declare const SYSTEM_ADMIN_DEFAULT_KEY: SystemAdminMenuKey;
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* 系统管理:侧栏父菜单「系统管理」,子菜单为「菜单管理」「权限点管理」。
|
|
427
|
+
*/
|
|
428
|
+
declare const SystemAdmin: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
429
|
+
menuApi: {
|
|
430
|
+
type: PropType<MenuResourceApi>;
|
|
431
|
+
required: true;
|
|
432
|
+
};
|
|
433
|
+
resourceApi: {
|
|
434
|
+
type: PropType<AuthorizationResourceApi>;
|
|
435
|
+
required: true;
|
|
436
|
+
};
|
|
437
|
+
defaultActiveKey: {
|
|
438
|
+
type: PropType<SystemAdminMenuKey>;
|
|
439
|
+
default: SystemAdminMenuKey;
|
|
440
|
+
};
|
|
441
|
+
activeKey: {
|
|
442
|
+
type: PropType<SystemAdminMenuKey>;
|
|
443
|
+
default: undefined;
|
|
444
|
+
};
|
|
445
|
+
title: {
|
|
446
|
+
type: StringConstructor;
|
|
447
|
+
default: string;
|
|
448
|
+
};
|
|
449
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
450
|
+
[key: string]: any;
|
|
451
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
|
|
452
|
+
'update:activeKey': (_key: SystemAdminMenuKey) => true;
|
|
453
|
+
activeKeyChange: (_key: SystemAdminMenuKey) => true;
|
|
454
|
+
}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
455
|
+
menuApi: {
|
|
456
|
+
type: PropType<MenuResourceApi>;
|
|
457
|
+
required: true;
|
|
458
|
+
};
|
|
459
|
+
resourceApi: {
|
|
460
|
+
type: PropType<AuthorizationResourceApi>;
|
|
461
|
+
required: true;
|
|
462
|
+
};
|
|
463
|
+
defaultActiveKey: {
|
|
464
|
+
type: PropType<SystemAdminMenuKey>;
|
|
465
|
+
default: SystemAdminMenuKey;
|
|
466
|
+
};
|
|
467
|
+
activeKey: {
|
|
468
|
+
type: PropType<SystemAdminMenuKey>;
|
|
469
|
+
default: undefined;
|
|
470
|
+
};
|
|
471
|
+
title: {
|
|
472
|
+
type: StringConstructor;
|
|
473
|
+
default: string;
|
|
474
|
+
};
|
|
475
|
+
}>> & Readonly<{
|
|
476
|
+
"onUpdate:activeKey"?: ((_key: SystemAdminMenuKey) => any) | undefined;
|
|
477
|
+
onActiveKeyChange?: ((_key: SystemAdminMenuKey) => any) | undefined;
|
|
478
|
+
}>, {
|
|
479
|
+
title: string;
|
|
480
|
+
defaultActiveKey: SystemAdminMenuKey;
|
|
481
|
+
activeKey: SystemAdminMenuKey;
|
|
482
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
483
|
+
|
|
405
484
|
interface SnowyflakeOptions {
|
|
406
485
|
epoch?: bigint;
|
|
407
486
|
workerId?: bigint;
|
|
@@ -432,4 +511,4 @@ declare const snowyflake: ConfigurableSnowflake;
|
|
|
432
511
|
declare function getAppClientId(): string;
|
|
433
512
|
declare function getDeviceWorkerId(): string;
|
|
434
513
|
|
|
435
|
-
export { type ApiResourceType, type AuthorizationResource, type AuthorizationResourceApi, type AuthorizationResourceFormValues, type AuthorizationResourceListResult, Can, type CheckOptions, type CreateAuthorizationResourceBody, type CreateDefaultResourceRequestOptions, type CreateMenuResourceBody, type FetchAuthorizationResourcesParams, type FetchMenuResourcesParams, type HttpMethod, type ListPaginationParams, type ListPaginationResult, MENU_LIST_TYPE_PARAM, MENU_TYPE_BUTTON, MENU_TYPE_LABEL, MENU_TYPE_MENU, MENU_TYPE_OPTIONS, MENU_TYPE_PAGE, MENU_VISIBILITY_OPTIONS, type MatchMode, MenuManager, type MenuResource, type MenuResourceApi, type MenuResourceFormValues, type MenuResourceListResult, type MenuResourceType, PERMISSION_STORE_KEY, type PageDirection, type PermissionChecker, type PermissionCode, type PermissionDirectiveValue, type PermissionListener, type PermissionPluginOptions, type PermissionState, PermissionStore, RESOURCE_PRIVATE_OPTIONS, RESOURCE_STATUS_DISABLED, RESOURCE_STATUS_ENABLED, RESOURCE_STATUS_OPTIONS, RESOURCE_TYPE_API, ROOT_PARENT_ID, type ResourceHttpRequest, ResourceManager, type ResourceRequestOptions, type ResourceStatus, type ResourceType, type RoleCode, type UpdateAuthorizationResourceBody, type UpdateMenuResourceBody, type UsePermissionResult, appendQueryParam, buildCreateBody, buildCreateMenuBody, buildUpdateBody, buildUpdateMenuBody, createAuthorizationResourceApi, createDefaultResourceRequest, createMenuResourceApi, createPermissionPlugin, createPermissionStore, createVPermission, extractPagination, extractRecords, getAppClientId, getDeviceWorkerId, mapAuthorizationResource, mapMenuResource, snowyflake, useHasPermission, useHasRole, usePermission };
|
|
514
|
+
export { type ApiResourceType, type AuthorizationResource, type AuthorizationResourceApi, type AuthorizationResourceFormValues, type AuthorizationResourceListResult, Can, type CheckOptions, type CreateAuthorizationResourceBody, type CreateDefaultResourceRequestOptions, type CreateMenuResourceBody, type FetchAuthorizationResourcesParams, type FetchMenuResourcesParams, type HttpMethod, type ListPaginationParams, type ListPaginationResult, MENU_LIST_TYPE_PARAM, MENU_TYPE_BUTTON, MENU_TYPE_LABEL, MENU_TYPE_MENU, MENU_TYPE_OPTIONS, MENU_TYPE_PAGE, MENU_VISIBILITY_OPTIONS, type MatchMode, MenuManager, type MenuResource, type MenuResourceApi, type MenuResourceFormValues, type MenuResourceListResult, type MenuResourceType, PERMISSION_STORE_KEY, type PageDirection, type PermissionChecker, type PermissionCode, type PermissionDirectiveValue, type PermissionListener, type PermissionPluginOptions, type PermissionState, PermissionStore, RESOURCE_PRIVATE_OPTIONS, RESOURCE_STATUS_DISABLED, RESOURCE_STATUS_ENABLED, RESOURCE_STATUS_OPTIONS, RESOURCE_TYPE_API, ROOT_PARENT_ID, type ResourceHttpRequest, ResourceManager, type ResourceRequestOptions, type ResourceStatus, type ResourceType, type RoleCode, SYSTEM_ADMIN_DEFAULT_KEY, SYSTEM_ADMIN_MENU, SystemAdmin, type SystemAdminMenuGroup, type SystemAdminMenuKey, type SystemAdminSubMenu, type UpdateAuthorizationResourceBody, type UpdateMenuResourceBody, type UsePermissionResult, appendQueryParam, buildCreateBody, buildCreateMenuBody, buildUpdateBody, buildUpdateMenuBody, createAuthorizationResourceApi, createDefaultResourceRequest, createMenuResourceApi, createPermissionPlugin, createPermissionStore, createVPermission, extractPagination, extractRecords, getAppClientId, getDeviceWorkerId, mapAuthorizationResource, mapMenuResource, snowyflake, useHasPermission, useHasRole, usePermission };
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -222,7 +222,8 @@ type AuthorizationResourceListResult = {
|
|
|
222
222
|
};
|
|
223
223
|
type MenuResource = {
|
|
224
224
|
resourceId: string;
|
|
225
|
-
|
|
225
|
+
/** 上级菜单 ID;无上级时为 null */
|
|
226
|
+
parentId: string | null;
|
|
226
227
|
type: MenuResourceType;
|
|
227
228
|
name: string;
|
|
228
229
|
identification: string;
|
|
@@ -232,7 +233,8 @@ type MenuResource = {
|
|
|
232
233
|
status: ResourceStatus;
|
|
233
234
|
};
|
|
234
235
|
type MenuResourceFormValues = {
|
|
235
|
-
|
|
236
|
+
/** 上级菜单 ID;选择「无」时为 null */
|
|
237
|
+
parentId: string | null;
|
|
236
238
|
type: MenuResourceType;
|
|
237
239
|
name: string;
|
|
238
240
|
identification: string;
|
|
@@ -258,7 +260,11 @@ declare const MENU_TYPE_MENU: MenuResourceType;
|
|
|
258
260
|
declare const MENU_TYPE_BUTTON: MenuResourceType;
|
|
259
261
|
/** 菜单列表查询 type 参数 */
|
|
260
262
|
declare const MENU_LIST_TYPE_PARAM = "page,menu,button";
|
|
261
|
-
|
|
263
|
+
/**
|
|
264
|
+
* 上级菜单选择「无」时,表单 select 使用的空值。
|
|
265
|
+
* 提交接口时会转换为 parentId: null。
|
|
266
|
+
*/
|
|
267
|
+
declare const ROOT_PARENT_ID = "";
|
|
262
268
|
declare const RESOURCE_STATUS_ENABLED: ResourceStatus;
|
|
263
269
|
declare const RESOURCE_STATUS_DISABLED: ResourceStatus;
|
|
264
270
|
declare const RESOURCE_STATUS_OPTIONS: {
|
|
@@ -402,6 +408,79 @@ declare const MenuManager: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
402
408
|
pageSize: string;
|
|
403
409
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
404
410
|
|
|
411
|
+
type SystemAdminMenuKey = 'menu' | 'resource';
|
|
412
|
+
type SystemAdminSubMenu = {
|
|
413
|
+
key: SystemAdminMenuKey;
|
|
414
|
+
label: string;
|
|
415
|
+
};
|
|
416
|
+
type SystemAdminMenuGroup = {
|
|
417
|
+
key: 'system';
|
|
418
|
+
label: string;
|
|
419
|
+
children: SystemAdminSubMenu[];
|
|
420
|
+
};
|
|
421
|
+
/** 系统管理菜单结构:菜单管理、权限点管理为其子菜单 */
|
|
422
|
+
declare const SYSTEM_ADMIN_MENU: SystemAdminMenuGroup;
|
|
423
|
+
declare const SYSTEM_ADMIN_DEFAULT_KEY: SystemAdminMenuKey;
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* 系统管理:侧栏父菜单「系统管理」,子菜单为「菜单管理」「权限点管理」。
|
|
427
|
+
*/
|
|
428
|
+
declare const SystemAdmin: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
429
|
+
menuApi: {
|
|
430
|
+
type: PropType<MenuResourceApi>;
|
|
431
|
+
required: true;
|
|
432
|
+
};
|
|
433
|
+
resourceApi: {
|
|
434
|
+
type: PropType<AuthorizationResourceApi>;
|
|
435
|
+
required: true;
|
|
436
|
+
};
|
|
437
|
+
defaultActiveKey: {
|
|
438
|
+
type: PropType<SystemAdminMenuKey>;
|
|
439
|
+
default: SystemAdminMenuKey;
|
|
440
|
+
};
|
|
441
|
+
activeKey: {
|
|
442
|
+
type: PropType<SystemAdminMenuKey>;
|
|
443
|
+
default: undefined;
|
|
444
|
+
};
|
|
445
|
+
title: {
|
|
446
|
+
type: StringConstructor;
|
|
447
|
+
default: string;
|
|
448
|
+
};
|
|
449
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
450
|
+
[key: string]: any;
|
|
451
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
|
|
452
|
+
'update:activeKey': (_key: SystemAdminMenuKey) => true;
|
|
453
|
+
activeKeyChange: (_key: SystemAdminMenuKey) => true;
|
|
454
|
+
}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
455
|
+
menuApi: {
|
|
456
|
+
type: PropType<MenuResourceApi>;
|
|
457
|
+
required: true;
|
|
458
|
+
};
|
|
459
|
+
resourceApi: {
|
|
460
|
+
type: PropType<AuthorizationResourceApi>;
|
|
461
|
+
required: true;
|
|
462
|
+
};
|
|
463
|
+
defaultActiveKey: {
|
|
464
|
+
type: PropType<SystemAdminMenuKey>;
|
|
465
|
+
default: SystemAdminMenuKey;
|
|
466
|
+
};
|
|
467
|
+
activeKey: {
|
|
468
|
+
type: PropType<SystemAdminMenuKey>;
|
|
469
|
+
default: undefined;
|
|
470
|
+
};
|
|
471
|
+
title: {
|
|
472
|
+
type: StringConstructor;
|
|
473
|
+
default: string;
|
|
474
|
+
};
|
|
475
|
+
}>> & Readonly<{
|
|
476
|
+
"onUpdate:activeKey"?: ((_key: SystemAdminMenuKey) => any) | undefined;
|
|
477
|
+
onActiveKeyChange?: ((_key: SystemAdminMenuKey) => any) | undefined;
|
|
478
|
+
}>, {
|
|
479
|
+
title: string;
|
|
480
|
+
defaultActiveKey: SystemAdminMenuKey;
|
|
481
|
+
activeKey: SystemAdminMenuKey;
|
|
482
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
483
|
+
|
|
405
484
|
interface SnowyflakeOptions {
|
|
406
485
|
epoch?: bigint;
|
|
407
486
|
workerId?: bigint;
|
|
@@ -432,4 +511,4 @@ declare const snowyflake: ConfigurableSnowflake;
|
|
|
432
511
|
declare function getAppClientId(): string;
|
|
433
512
|
declare function getDeviceWorkerId(): string;
|
|
434
513
|
|
|
435
|
-
export { type ApiResourceType, type AuthorizationResource, type AuthorizationResourceApi, type AuthorizationResourceFormValues, type AuthorizationResourceListResult, Can, type CheckOptions, type CreateAuthorizationResourceBody, type CreateDefaultResourceRequestOptions, type CreateMenuResourceBody, type FetchAuthorizationResourcesParams, type FetchMenuResourcesParams, type HttpMethod, type ListPaginationParams, type ListPaginationResult, MENU_LIST_TYPE_PARAM, MENU_TYPE_BUTTON, MENU_TYPE_LABEL, MENU_TYPE_MENU, MENU_TYPE_OPTIONS, MENU_TYPE_PAGE, MENU_VISIBILITY_OPTIONS, type MatchMode, MenuManager, type MenuResource, type MenuResourceApi, type MenuResourceFormValues, type MenuResourceListResult, type MenuResourceType, PERMISSION_STORE_KEY, type PageDirection, type PermissionChecker, type PermissionCode, type PermissionDirectiveValue, type PermissionListener, type PermissionPluginOptions, type PermissionState, PermissionStore, RESOURCE_PRIVATE_OPTIONS, RESOURCE_STATUS_DISABLED, RESOURCE_STATUS_ENABLED, RESOURCE_STATUS_OPTIONS, RESOURCE_TYPE_API, ROOT_PARENT_ID, type ResourceHttpRequest, ResourceManager, type ResourceRequestOptions, type ResourceStatus, type ResourceType, type RoleCode, type UpdateAuthorizationResourceBody, type UpdateMenuResourceBody, type UsePermissionResult, appendQueryParam, buildCreateBody, buildCreateMenuBody, buildUpdateBody, buildUpdateMenuBody, createAuthorizationResourceApi, createDefaultResourceRequest, createMenuResourceApi, createPermissionPlugin, createPermissionStore, createVPermission, extractPagination, extractRecords, getAppClientId, getDeviceWorkerId, mapAuthorizationResource, mapMenuResource, snowyflake, useHasPermission, useHasRole, usePermission };
|
|
514
|
+
export { type ApiResourceType, type AuthorizationResource, type AuthorizationResourceApi, type AuthorizationResourceFormValues, type AuthorizationResourceListResult, Can, type CheckOptions, type CreateAuthorizationResourceBody, type CreateDefaultResourceRequestOptions, type CreateMenuResourceBody, type FetchAuthorizationResourcesParams, type FetchMenuResourcesParams, type HttpMethod, type ListPaginationParams, type ListPaginationResult, MENU_LIST_TYPE_PARAM, MENU_TYPE_BUTTON, MENU_TYPE_LABEL, MENU_TYPE_MENU, MENU_TYPE_OPTIONS, MENU_TYPE_PAGE, MENU_VISIBILITY_OPTIONS, type MatchMode, MenuManager, type MenuResource, type MenuResourceApi, type MenuResourceFormValues, type MenuResourceListResult, type MenuResourceType, PERMISSION_STORE_KEY, type PageDirection, type PermissionChecker, type PermissionCode, type PermissionDirectiveValue, type PermissionListener, type PermissionPluginOptions, type PermissionState, PermissionStore, RESOURCE_PRIVATE_OPTIONS, RESOURCE_STATUS_DISABLED, RESOURCE_STATUS_ENABLED, RESOURCE_STATUS_OPTIONS, RESOURCE_TYPE_API, ROOT_PARENT_ID, type ResourceHttpRequest, ResourceManager, type ResourceRequestOptions, type ResourceStatus, type ResourceType, type RoleCode, SYSTEM_ADMIN_DEFAULT_KEY, SYSTEM_ADMIN_MENU, SystemAdmin, type SystemAdminMenuGroup, type SystemAdminMenuKey, type SystemAdminSubMenu, type UpdateAuthorizationResourceBody, type UpdateMenuResourceBody, type UsePermissionResult, appendQueryParam, buildCreateBody, buildCreateMenuBody, buildUpdateBody, buildUpdateMenuBody, createAuthorizationResourceApi, createDefaultResourceRequest, createMenuResourceApi, createPermissionPlugin, createPermissionStore, createVPermission, extractPagination, extractRecords, getAppClientId, getDeviceWorkerId, mapAuthorizationResource, mapMenuResource, snowyflake, useHasPermission, useHasRole, usePermission };
|
package/dist/vue/index.js
CHANGED
|
@@ -314,7 +314,7 @@ var MENU_TYPE_PAGE = "page";
|
|
|
314
314
|
var MENU_TYPE_MENU = "menu";
|
|
315
315
|
var MENU_TYPE_BUTTON = "button";
|
|
316
316
|
var MENU_LIST_TYPE_PARAM = "page,menu,button";
|
|
317
|
-
var ROOT_PARENT_ID = "
|
|
317
|
+
var ROOT_PARENT_ID = "";
|
|
318
318
|
var RESOURCE_STATUS_ENABLED = 1;
|
|
319
319
|
var RESOURCE_STATUS_DISABLED = 0;
|
|
320
320
|
var RESOURCE_STATUS_OPTIONS = [
|
|
@@ -495,7 +495,7 @@ function toStringArray(value) {
|
|
|
495
495
|
}).filter(Boolean);
|
|
496
496
|
}
|
|
497
497
|
if (typeof value === "string" && value.trim()) {
|
|
498
|
-
return value.split(",").map((
|
|
498
|
+
return value.split(",").map((s4) => s4.trim()).filter(Boolean);
|
|
499
499
|
}
|
|
500
500
|
return [];
|
|
501
501
|
}
|
|
@@ -531,10 +531,11 @@ function mapMenuResource(item) {
|
|
|
531
531
|
);
|
|
532
532
|
const permissionNamesRaw = row.permissionPointNames ?? row.permission_point_names ?? row.permissionNames;
|
|
533
533
|
const permissionPointNames = Array.isArray(permissionNamesRaw) ? permissionNamesRaw.map((n) => String(n ?? "")).filter(Boolean) : void 0;
|
|
534
|
-
const
|
|
534
|
+
const rawParentId = row.parentId ?? row.parent_id;
|
|
535
|
+
const parentId = rawParentId === void 0 || rawParentId === null || rawParentId === "" || String(rawParentId) === "0" ? null : String(rawParentId);
|
|
535
536
|
return {
|
|
536
537
|
resourceId: String(resourceId),
|
|
537
|
-
parentId
|
|
538
|
+
parentId,
|
|
538
539
|
type: toMenuType(row.type),
|
|
539
540
|
name: String(row.name ?? ""),
|
|
540
541
|
identification: String(row.identification ?? row.identity ?? row.path ?? ""),
|
|
@@ -575,7 +576,7 @@ function buildUpdateBody(values) {
|
|
|
575
576
|
function buildCreateMenuBody(values, resourceId = getAppClientId()) {
|
|
576
577
|
return {
|
|
577
578
|
resourceId,
|
|
578
|
-
parentId: values.parentId
|
|
579
|
+
parentId: values.parentId ? values.parentId : null,
|
|
579
580
|
type: values.type,
|
|
580
581
|
name: values.name.trim(),
|
|
581
582
|
identification: values.identification.trim(),
|
|
@@ -585,7 +586,7 @@ function buildCreateMenuBody(values, resourceId = getAppClientId()) {
|
|
|
585
586
|
}
|
|
586
587
|
function buildUpdateMenuBody(values) {
|
|
587
588
|
return {
|
|
588
|
-
parentId: values.parentId
|
|
589
|
+
parentId: values.parentId ? values.parentId : null,
|
|
589
590
|
type: values.type,
|
|
590
591
|
name: values.name.trim(),
|
|
591
592
|
identification: values.identification.trim(),
|
|
@@ -1391,7 +1392,7 @@ import {
|
|
|
1391
1392
|
var PAGE_SIZE_OPTIONS2 = ["10", "20", "50", "100"];
|
|
1392
1393
|
function emptyForm2() {
|
|
1393
1394
|
return {
|
|
1394
|
-
parentId:
|
|
1395
|
+
parentId: null,
|
|
1395
1396
|
type: MENU_TYPE_MENU,
|
|
1396
1397
|
name: "",
|
|
1397
1398
|
identification: "",
|
|
@@ -1712,7 +1713,7 @@ var MenuManager = defineComponent3({
|
|
|
1712
1713
|
function openEdit(row) {
|
|
1713
1714
|
editing.value = row;
|
|
1714
1715
|
Object.assign(form, {
|
|
1715
|
-
parentId: row.parentId
|
|
1716
|
+
parentId: row.parentId ?? null,
|
|
1716
1717
|
type: row.type,
|
|
1717
1718
|
name: row.name,
|
|
1718
1719
|
identification: row.identification,
|
|
@@ -1957,13 +1958,14 @@ var MenuManager = defineComponent3({
|
|
|
1957
1958
|
"select",
|
|
1958
1959
|
{
|
|
1959
1960
|
style: s2.input,
|
|
1960
|
-
value: form.parentId,
|
|
1961
|
+
value: form.parentId ?? ROOT_PARENT_ID,
|
|
1961
1962
|
onChange: (e) => {
|
|
1962
|
-
|
|
1963
|
+
const value = e.target.value;
|
|
1964
|
+
form.parentId = value ? value : null;
|
|
1963
1965
|
}
|
|
1964
1966
|
},
|
|
1965
1967
|
[
|
|
1966
|
-
h2("option", { value: ROOT_PARENT_ID }, "\
|
|
1968
|
+
h2("option", { value: ROOT_PARENT_ID }, "\u65E0"),
|
|
1967
1969
|
...parentOptions.value.map(
|
|
1968
1970
|
(opt) => h2(
|
|
1969
1971
|
"option",
|
|
@@ -2174,6 +2176,186 @@ var MenuManager = defineComponent3({
|
|
|
2174
2176
|
]);
|
|
2175
2177
|
}
|
|
2176
2178
|
});
|
|
2179
|
+
|
|
2180
|
+
// src/vue/SystemAdmin.ts
|
|
2181
|
+
import { computed as computed4, defineComponent as defineComponent4, h as h3, ref as ref3, watch as watch3 } from "vue";
|
|
2182
|
+
|
|
2183
|
+
// src/admin/menu.ts
|
|
2184
|
+
var SYSTEM_ADMIN_MENU = {
|
|
2185
|
+
key: "system",
|
|
2186
|
+
label: "\u7CFB\u7EDF\u7BA1\u7406",
|
|
2187
|
+
children: [
|
|
2188
|
+
{ key: "menu", label: "\u83DC\u5355\u7BA1\u7406" },
|
|
2189
|
+
{ key: "resource", label: "\u6743\u9650\u70B9\u7BA1\u7406" }
|
|
2190
|
+
]
|
|
2191
|
+
};
|
|
2192
|
+
var SYSTEM_ADMIN_DEFAULT_KEY = "menu";
|
|
2193
|
+
|
|
2194
|
+
// src/vue/SystemAdmin.ts
|
|
2195
|
+
var s3 = {
|
|
2196
|
+
root: {
|
|
2197
|
+
display: "flex",
|
|
2198
|
+
minHeight: "560px",
|
|
2199
|
+
border: "1px solid #eaecf0",
|
|
2200
|
+
borderRadius: "12px",
|
|
2201
|
+
overflow: "hidden",
|
|
2202
|
+
background: "#fff",
|
|
2203
|
+
fontFamily: '"PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif',
|
|
2204
|
+
color: "#101828"
|
|
2205
|
+
},
|
|
2206
|
+
sidebar: {
|
|
2207
|
+
width: "200px",
|
|
2208
|
+
flexShrink: "0",
|
|
2209
|
+
borderRight: "1px solid #eaecf0",
|
|
2210
|
+
background: "#f9fafb",
|
|
2211
|
+
padding: "16px 12px"
|
|
2212
|
+
},
|
|
2213
|
+
sidebarTitle: {
|
|
2214
|
+
fontSize: "14px",
|
|
2215
|
+
fontWeight: "600",
|
|
2216
|
+
color: "#344054",
|
|
2217
|
+
padding: "4px 10px 12px"
|
|
2218
|
+
},
|
|
2219
|
+
nav: {
|
|
2220
|
+
display: "flex",
|
|
2221
|
+
flexDirection: "column",
|
|
2222
|
+
gap: "4px"
|
|
2223
|
+
},
|
|
2224
|
+
navItem: {
|
|
2225
|
+
border: "none",
|
|
2226
|
+
background: "transparent",
|
|
2227
|
+
textAlign: "left",
|
|
2228
|
+
padding: "10px 12px",
|
|
2229
|
+
borderRadius: "8px",
|
|
2230
|
+
fontSize: "14px",
|
|
2231
|
+
color: "#475467",
|
|
2232
|
+
cursor: "pointer"
|
|
2233
|
+
},
|
|
2234
|
+
navItemActive: {
|
|
2235
|
+
background: "#e6f7f9",
|
|
2236
|
+
color: "#049BAD",
|
|
2237
|
+
fontWeight: "600"
|
|
2238
|
+
},
|
|
2239
|
+
content: {
|
|
2240
|
+
flex: "1",
|
|
2241
|
+
minWidth: "0",
|
|
2242
|
+
display: "flex",
|
|
2243
|
+
flexDirection: "column",
|
|
2244
|
+
background: "#fff"
|
|
2245
|
+
},
|
|
2246
|
+
contentHeader: {
|
|
2247
|
+
display: "flex",
|
|
2248
|
+
alignItems: "center",
|
|
2249
|
+
justifyContent: "space-between",
|
|
2250
|
+
gap: "12px",
|
|
2251
|
+
padding: "12px 16px",
|
|
2252
|
+
borderBottom: "1px solid #f2f4f7"
|
|
2253
|
+
},
|
|
2254
|
+
breadcrumb: {
|
|
2255
|
+
display: "flex",
|
|
2256
|
+
alignItems: "center",
|
|
2257
|
+
gap: "8px",
|
|
2258
|
+
fontSize: "13px"
|
|
2259
|
+
},
|
|
2260
|
+
breadcrumbParent: { color: "#98a2b3" },
|
|
2261
|
+
breadcrumbSep: { color: "#d0d5dd" },
|
|
2262
|
+
breadcrumbCurrent: { color: "#344054", fontWeight: "600" },
|
|
2263
|
+
panel: {
|
|
2264
|
+
flex: "1",
|
|
2265
|
+
minHeight: "0",
|
|
2266
|
+
overflow: "auto"
|
|
2267
|
+
}
|
|
2268
|
+
};
|
|
2269
|
+
var SystemAdmin = defineComponent4({
|
|
2270
|
+
name: "SystemAdmin",
|
|
2271
|
+
props: {
|
|
2272
|
+
menuApi: {
|
|
2273
|
+
type: Object,
|
|
2274
|
+
required: true
|
|
2275
|
+
},
|
|
2276
|
+
resourceApi: {
|
|
2277
|
+
type: Object,
|
|
2278
|
+
required: true
|
|
2279
|
+
},
|
|
2280
|
+
defaultActiveKey: {
|
|
2281
|
+
type: String,
|
|
2282
|
+
default: SYSTEM_ADMIN_DEFAULT_KEY
|
|
2283
|
+
},
|
|
2284
|
+
activeKey: {
|
|
2285
|
+
type: String,
|
|
2286
|
+
default: void 0
|
|
2287
|
+
},
|
|
2288
|
+
title: {
|
|
2289
|
+
type: String,
|
|
2290
|
+
default: SYSTEM_ADMIN_MENU.label
|
|
2291
|
+
}
|
|
2292
|
+
},
|
|
2293
|
+
emits: {
|
|
2294
|
+
"update:activeKey": (_key) => true,
|
|
2295
|
+
activeKeyChange: (_key) => true
|
|
2296
|
+
},
|
|
2297
|
+
setup(props, { emit, slots }) {
|
|
2298
|
+
const innerKey = ref3(props.defaultActiveKey);
|
|
2299
|
+
watch3(
|
|
2300
|
+
() => props.defaultActiveKey,
|
|
2301
|
+
(value) => {
|
|
2302
|
+
if (props.activeKey === void 0) innerKey.value = value;
|
|
2303
|
+
}
|
|
2304
|
+
);
|
|
2305
|
+
const activeKey = computed4(
|
|
2306
|
+
() => props.activeKey ?? innerKey.value
|
|
2307
|
+
);
|
|
2308
|
+
const activeLabel = computed4(
|
|
2309
|
+
() => SYSTEM_ADMIN_MENU.children.find((item) => item.key === activeKey.value)?.label ?? ""
|
|
2310
|
+
);
|
|
2311
|
+
function setActiveKey(key) {
|
|
2312
|
+
if (props.activeKey === void 0) innerKey.value = key;
|
|
2313
|
+
emit("update:activeKey", key);
|
|
2314
|
+
emit("activeKeyChange", key);
|
|
2315
|
+
}
|
|
2316
|
+
return () => h3("div", { style: s3.root }, [
|
|
2317
|
+
h3("aside", { style: s3.sidebar }, [
|
|
2318
|
+
h3("div", { style: s3.sidebarTitle }, props.title),
|
|
2319
|
+
h3(
|
|
2320
|
+
"nav",
|
|
2321
|
+
{ style: s3.nav },
|
|
2322
|
+
SYSTEM_ADMIN_MENU.children.map((item) => {
|
|
2323
|
+
const active = item.key === activeKey.value;
|
|
2324
|
+
return h3(
|
|
2325
|
+
"button",
|
|
2326
|
+
{
|
|
2327
|
+
key: item.key,
|
|
2328
|
+
type: "button",
|
|
2329
|
+
style: {
|
|
2330
|
+
...s3.navItem,
|
|
2331
|
+
...active ? s3.navItemActive : {}
|
|
2332
|
+
},
|
|
2333
|
+
onClick: () => setActiveKey(item.key)
|
|
2334
|
+
},
|
|
2335
|
+
item.label
|
|
2336
|
+
);
|
|
2337
|
+
})
|
|
2338
|
+
)
|
|
2339
|
+
]),
|
|
2340
|
+
h3("main", { style: s3.content }, [
|
|
2341
|
+
h3("div", { style: s3.contentHeader }, [
|
|
2342
|
+
h3("div", { style: s3.breadcrumb }, [
|
|
2343
|
+
h3("span", { style: s3.breadcrumbParent }, props.title),
|
|
2344
|
+
h3("span", { style: s3.breadcrumbSep }, "/"),
|
|
2345
|
+
h3("span", { style: s3.breadcrumbCurrent }, activeLabel.value)
|
|
2346
|
+
]),
|
|
2347
|
+
slots.toolbarExtra?.()
|
|
2348
|
+
]),
|
|
2349
|
+
h3("div", { style: s3.panel }, [
|
|
2350
|
+
activeKey.value === "menu" ? h3(MenuManager, { api: props.menuApi, title: "\u83DC\u5355\u7BA1\u7406" }) : h3(ResourceManager, {
|
|
2351
|
+
api: props.resourceApi,
|
|
2352
|
+
title: "\u6743\u9650\u70B9\u7BA1\u7406"
|
|
2353
|
+
})
|
|
2354
|
+
])
|
|
2355
|
+
])
|
|
2356
|
+
]);
|
|
2357
|
+
}
|
|
2358
|
+
});
|
|
2177
2359
|
export {
|
|
2178
2360
|
Can,
|
|
2179
2361
|
MENU_LIST_TYPE_PARAM,
|
|
@@ -2193,6 +2375,9 @@ export {
|
|
|
2193
2375
|
RESOURCE_TYPE_API,
|
|
2194
2376
|
ROOT_PARENT_ID,
|
|
2195
2377
|
ResourceManager,
|
|
2378
|
+
SYSTEM_ADMIN_DEFAULT_KEY,
|
|
2379
|
+
SYSTEM_ADMIN_MENU,
|
|
2380
|
+
SystemAdmin,
|
|
2196
2381
|
appendQueryParam,
|
|
2197
2382
|
buildCreateBody,
|
|
2198
2383
|
buildCreateMenuBody,
|