com-angel-authorization 1.0.0 → 1.0.1

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/vue/index.ts","../../src/vue/plugin.ts","../../src/vue/directive.ts","../../src/vue/Can.ts"],"sourcesContent":["export {\n createPermissionPlugin,\n usePermission,\n useHasPermission,\n useHasRole,\n PERMISSION_STORE_KEY,\n} from './plugin';\nexport type { PermissionPluginOptions, UsePermissionResult } from './plugin';\n\nexport { createVPermission } from './directive';\nexport type { PermissionDirectiveValue } from './directive';\n\nexport { Can } from './Can';\n\nexport type {\n CheckOptions,\n MatchMode,\n PermissionChecker,\n PermissionCode,\n PermissionListener,\n PermissionState,\n RoleCode,\n} from '../core';\n\nexport { PermissionStore, createPermissionStore } from '../core';\n","import {\n computed,\n inject,\n onScopeDispose,\n shallowRef,\n type App,\n type ComputedRef,\n type InjectionKey,\n type Plugin,\n} from 'vue';\nimport {\n createPermissionStore,\n type CheckOptions,\n type PermissionCode,\n type PermissionState,\n type PermissionStore,\n type RoleCode,\n} from '../core';\nimport { createVPermission } from './directive';\n\nexport const PERMISSION_STORE_KEY: InjectionKey<PermissionStore> = Symbol(\n 'angel-authorization-store',\n);\n\nexport interface PermissionPluginOptions {\n /** Pass an existing store to share across apps. */\n store?: PermissionStore;\n /** Initial state when the plugin creates its own store. */\n initialState?: Partial<PermissionState>;\n /** Custom directive name. Default: `permission` → `v-permission`. */\n directiveName?: string;\n}\n\nexport function createPermissionPlugin(\n options: PermissionPluginOptions = {},\n): Plugin & { store: PermissionStore } {\n const store = options.store ?? createPermissionStore(options.initialState);\n const directiveName = options.directiveName ?? 'permission';\n\n const plugin: Plugin & { store: PermissionStore } = {\n store,\n install(app: App) {\n app.provide(PERMISSION_STORE_KEY, store);\n app.directive(directiveName, createVPermission(store));\n app.config.globalProperties.$permission = store;\n app.config.globalProperties.$can = (\n codes: PermissionCode | PermissionCode[],\n opts?: CheckOptions,\n ) => store.can(codes, opts);\n app.config.globalProperties.$hasRole = (\n codes: RoleCode | RoleCode[],\n opts?: CheckOptions,\n ) => store.hasRole(codes, opts);\n },\n };\n\n return plugin;\n}\n\nfunction resolveStore(store?: PermissionStore): PermissionStore {\n const injected = store ?? inject(PERMISSION_STORE_KEY, null);\n if (!injected) {\n throw new Error(\n '[com-angel-authorization/vue] Permission store not found. Did you call app.use(createPermissionPlugin())?',\n );\n }\n return injected;\n}\n\nexport interface UsePermissionResult {\n permissions: ComputedRef<PermissionCode[]>;\n roles: ComputedRef<RoleCode[]>;\n isSuperAdmin: ComputedRef<boolean>;\n hasPermission: (codes: PermissionCode | PermissionCode[], options?: CheckOptions) => boolean;\n hasRole: (codes: RoleCode | RoleCode[], options?: CheckOptions) => boolean;\n can: (codes: PermissionCode | PermissionCode[], options?: CheckOptions) => boolean;\n setPermissions: (permissions: PermissionCode[]) => void;\n setRoles: (roles: RoleCode[]) => void;\n setSuperAdmin: (isSuperAdmin: boolean) => void;\n hydrate: (payload: Partial<PermissionState>) => void;\n clear: () => void;\n store: PermissionStore;\n}\n\n/**\n * Reactive permission API for Vue 3 Composition API.\n */\nexport function usePermission(store?: PermissionStore): UsePermissionResult {\n const permissionStore = resolveStore(store);\n const state = shallowRef<PermissionState>(permissionStore.getState());\n\n const unsubscribe = permissionStore.subscribe((next) => {\n state.value = next;\n });\n onScopeDispose(unsubscribe);\n\n return {\n permissions: computed(() => state.value.permissions),\n roles: computed(() => state.value.roles),\n isSuperAdmin: computed(() => Boolean(state.value.isSuperAdmin)),\n hasPermission: (codes, options) => permissionStore.hasPermission(codes, options),\n hasRole: (codes, options) => permissionStore.hasRole(codes, options),\n can: (codes, options) => permissionStore.can(codes, options),\n setPermissions: permissionStore.setPermissions.bind(permissionStore),\n setRoles: permissionStore.setRoles.bind(permissionStore),\n setSuperAdmin: permissionStore.setSuperAdmin.bind(permissionStore),\n hydrate: permissionStore.hydrate.bind(permissionStore),\n clear: permissionStore.clear.bind(permissionStore),\n store: permissionStore,\n };\n}\n\nexport function useHasPermission(\n codes: PermissionCode | PermissionCode[],\n options?: CheckOptions,\n store?: PermissionStore,\n) {\n const { permissions, isSuperAdmin, hasPermission } = usePermission(store);\n return computed(() => {\n void permissions.value;\n void isSuperAdmin.value;\n return hasPermission(codes, options);\n });\n}\n\nexport function useHasRole(\n codes: RoleCode | RoleCode[],\n options?: CheckOptions,\n store?: PermissionStore,\n) {\n const { roles, isSuperAdmin, hasRole } = usePermission(store);\n return computed(() => {\n void roles.value;\n void isSuperAdmin.value;\n return hasRole(codes, options);\n });\n}\n\ndeclare module 'vue' {\n interface ComponentCustomProperties {\n $permission: PermissionStore;\n $can: (codes: PermissionCode | PermissionCode[], options?: CheckOptions) => boolean;\n $hasRole: (codes: RoleCode | RoleCode[], options?: CheckOptions) => boolean;\n }\n}\n","import type { Directive, DirectiveBinding } from 'vue';\nimport type { CheckOptions, MatchMode, PermissionCode, PermissionStore, RoleCode } from '../core';\n\nexport type PermissionDirectiveValue =\n | PermissionCode\n | PermissionCode[]\n | {\n permission?: PermissionCode | PermissionCode[];\n role?: RoleCode | RoleCode[];\n mode?: MatchMode;\n /** When both permission and role are set. Default: `and`. */\n combine?: 'and' | 'or';\n /** CSS display value when allowed. Default: restores original display. */\n display?: string;\n };\n\nfunction parseBinding(binding: DirectiveBinding<PermissionDirectiveValue>): {\n permission?: PermissionCode | PermissionCode[];\n role?: RoleCode | RoleCode[];\n mode?: MatchMode;\n combine: 'and' | 'or';\n display?: string;\n} {\n const value = binding.value;\n const arg = binding.arg;\n\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n return {\n permission: value.permission,\n role: value.role,\n mode: value.mode ?? (arg === 'all' ? 'all' : 'any'),\n combine: value.combine ?? 'and',\n display: value.display,\n };\n }\n\n if (arg === 'role') {\n return {\n role: value as RoleCode | RoleCode[],\n mode: binding.modifiers.all ? 'all' : 'any',\n combine: 'and',\n };\n }\n\n return {\n permission: value as PermissionCode | PermissionCode[],\n mode: arg === 'all' || binding.modifiers.all ? 'all' : 'any',\n combine: 'and',\n };\n}\n\nfunction isAllowed(\n store: PermissionStore,\n binding: DirectiveBinding<PermissionDirectiveValue>,\n): boolean {\n const { permission, role, mode, combine } = parseBinding(binding);\n const options: CheckOptions = { mode };\n\n const hasPermCheck = permission !== undefined;\n const hasRoleCheck = role !== undefined;\n\n if (!hasPermCheck && !hasRoleCheck) return true;\n\n const permOk = hasPermCheck ? store.hasPermission(permission!, options) : true;\n const roleOk = hasRoleCheck ? store.hasRole(role!, options) : true;\n\n if (hasPermCheck && hasRoleCheck) {\n return combine === 'or' ? permOk || roleOk : permOk && roleOk;\n }\n\n return hasPermCheck ? permOk : roleOk;\n}\n\ntype ElWithPermission = HTMLElement & {\n __angelPermissionDisplay?: string;\n __angelPermissionUnsubscribe?: () => void;\n};\n\nfunction applyVisibility(\n el: ElWithPermission,\n allowed: boolean,\n display?: string,\n): void {\n if (el.__angelPermissionDisplay === undefined) {\n el.__angelPermissionDisplay = el.style.display;\n }\n\n if (allowed) {\n el.style.display = display ?? el.__angelPermissionDisplay ?? '';\n el.removeAttribute('aria-hidden');\n } else {\n el.style.display = 'none';\n el.setAttribute('aria-hidden', 'true');\n }\n}\n\n/**\n * Create a `v-permission` directive bound to a specific store.\n * Prefer installing via `createPermissionPlugin()` which registers this automatically.\n */\nexport function createVPermission(\n store: PermissionStore,\n): Directive<ElWithPermission, PermissionDirectiveValue> {\n return {\n mounted(el, binding) {\n const update = () => {\n const { display } = parseBinding(binding);\n applyVisibility(el, isAllowed(store, binding), display);\n };\n\n update();\n el.__angelPermissionUnsubscribe = store.subscribe(update);\n },\n\n updated(el, binding) {\n const { display } = parseBinding(binding);\n applyVisibility(el, isAllowed(store, binding), display);\n },\n\n unmounted(el) {\n el.__angelPermissionUnsubscribe?.();\n delete el.__angelPermissionUnsubscribe;\n delete el.__angelPermissionDisplay;\n },\n };\n}\n","import { computed, defineComponent, type PropType } from 'vue';\nimport type { MatchMode, PermissionCode, RoleCode } from '../core';\nimport { usePermission } from './plugin';\n\n/**\n * Conditionally render slot content based on permission / role.\n *\n * @example\n * <Can permission=\"user:edit\">\n * <button>Edit</button>\n * </Can>\n *\n * <Can :permission=\"['user:edit', 'user:delete']\" mode=\"all\">\n * <AdminPanel />\n * <template #fallback>No access</template>\n * </Can>\n */\nexport const Can = defineComponent({\n name: 'Can',\n props: {\n permission: {\n type: [String, Array] as PropType<PermissionCode | PermissionCode[]>,\n default: undefined,\n },\n role: {\n type: [String, Array] as PropType<RoleCode | RoleCode[]>,\n default: undefined,\n },\n mode: {\n type: String as PropType<MatchMode>,\n default: 'any',\n },\n combine: {\n type: String as PropType<'and' | 'or'>,\n default: 'and',\n },\n },\n setup(props, { slots }) {\n const { hasPermission, hasRole, permissions, roles, isSuperAdmin } = usePermission();\n\n const allowed = computed(() => {\n void permissions.value;\n void roles.value;\n void isSuperAdmin.value;\n\n const hasPermCheck = props.permission !== undefined;\n const hasRoleCheck = props.role !== undefined;\n\n if (!hasPermCheck && !hasRoleCheck) return true;\n\n const options = { mode: props.mode };\n const permOk = hasPermCheck ? hasPermission(props.permission!, options) : true;\n const roleOk = hasRoleCheck ? hasRole(props.role!, options) : true;\n\n if (hasPermCheck && hasRoleCheck) {\n return props.combine === 'or' ? permOk || roleOk : permOk && roleOk;\n }\n\n return hasPermCheck ? permOk : roleOk;\n });\n\n return () => {\n if (allowed.value) {\n return slots.default?.();\n }\n return slots.fallback?.() ?? null;\n };\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBASO;AACP,kBAOO;;;ACDP,SAAS,aAAa,SAMpB;AACA,QAAM,QAAQ,QAAQ;AACtB,QAAM,MAAM,QAAQ;AAEpB,MAAI,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,GAAG;AAC/D,WAAO;AAAA,MACL,YAAY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,QAAQ,KAAK;AAAA,MACpB,SAAS;AAAA,IACX;AAAA,IACA,MAAM;AAAA,MACJ,MAAM,CAAC,QAAQ,KAAK;AAAA,MACpB,SAAS;AAAA,IACX;AAAA,IACA,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IACA,SAAS;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,MAAM,OAAO,EAAE,MAAM,GAAG;AACtB,UAAM,EAAE,eAAe,SAAS,aAAa,OAAO,aAAa,IAAI,cAAc;AAEnF,UAAM,cAAU,sBAAS,MAAM;AAC7B,WAAK,YAAY;AACjB,WAAK,MAAM;AACX,WAAK,aAAa;AAElB,YAAM,eAAe,MAAM,eAAe;AAC1C,YAAM,eAAe,MAAM,SAAS;AAEpC,UAAI,CAAC,gBAAgB,CAAC,aAAc,QAAO;AAE3C,YAAM,UAAU,EAAE,MAAM,MAAM,KAAK;AACnC,YAAM,SAAS,eAAe,cAAc,MAAM,YAAa,OAAO,IAAI;AAC1E,YAAM,SAAS,eAAe,QAAQ,MAAM,MAAO,OAAO,IAAI;AAE9D,UAAI,gBAAgB,cAAc;AAChC,eAAO,MAAM,YAAY,OAAO,UAAU,SAAS,UAAU;AAAA,MAC/D;AAEA,aAAO,eAAe,SAAS;AAAA,IACjC,CAAC;AAED,WAAO,MAAM;AACX,UAAI,QAAQ,OAAO;AACjB,eAAO,MAAM,UAAU;AAAA,MACzB;AACA,aAAO,MAAM,WAAW,KAAK;AAAA,IAC/B;AAAA,EACF;AACF,CAAC;;;AH5CD,IAAAC,eAAuD;","names":["import_vue","import_core"]}
1
+ {"version":3,"sources":["../../src/vue/index.ts","../../src/vue/plugin.ts","../../src/vue/directive.ts","../../src/vue/Can.ts","../../src/vue/ResourceManager.ts"],"sourcesContent":["export {\n createPermissionPlugin,\n usePermission,\n useHasPermission,\n useHasRole,\n PERMISSION_STORE_KEY,\n} from './plugin';\nexport type { PermissionPluginOptions, UsePermissionResult } from './plugin';\n\nexport { createVPermission } from './directive';\nexport type { PermissionDirectiveValue } from './directive';\n\nexport { Can } from './Can';\n\nexport { ResourceManager } from './ResourceManager';\n\nexport type {\n CheckOptions,\n MatchMode,\n PermissionChecker,\n PermissionCode,\n PermissionListener,\n PermissionState,\n RoleCode,\n} from '../core';\n\nexport { PermissionStore, createPermissionStore } from '../core';\n\nexport { getAppClientId, getDeviceWorkerId, snowyflake } from '../utils/snowflake';\n\nexport type {\n AuthorizationResource,\n AuthorizationResourceApi,\n AuthorizationResourceFormValues,\n AuthorizationResourceListResult,\n CreateAuthorizationResourceBody,\n CreateDefaultResourceRequestOptions,\n FetchAuthorizationResourcesParams,\n HttpMethod,\n ListPaginationParams,\n ListPaginationResult,\n PageDirection,\n ResourceHttpRequest,\n ResourceRequestOptions,\n ResourceStatus,\n UpdateAuthorizationResourceBody,\n} from '../resources';\n\nexport {\n RESOURCE_PRIVATE_OPTIONS,\n RESOURCE_STATUS_DISABLED,\n RESOURCE_STATUS_ENABLED,\n RESOURCE_STATUS_OPTIONS,\n RESOURCE_TYPE_API,\n appendQueryParam,\n buildCreateBody,\n buildUpdateBody,\n createAuthorizationResourceApi,\n createDefaultResourceRequest,\n extractPagination,\n extractRecords,\n mapAuthorizationResource,\n} from '../resources';\n","import {\n computed,\n inject,\n onScopeDispose,\n shallowRef,\n type App,\n type ComputedRef,\n type InjectionKey,\n type Plugin,\n} from 'vue';\nimport {\n createPermissionStore,\n type CheckOptions,\n type PermissionCode,\n type PermissionState,\n type PermissionStore,\n type RoleCode,\n} from '../core';\nimport { createVPermission } from './directive';\n\nexport const PERMISSION_STORE_KEY: InjectionKey<PermissionStore> = Symbol(\n 'angel-authorization-store',\n);\n\nexport interface PermissionPluginOptions {\n /** Pass an existing store to share across apps. */\n store?: PermissionStore;\n /** Initial state when the plugin creates its own store. */\n initialState?: Partial<PermissionState>;\n /** Custom directive name. Default: `permission` → `v-permission`. */\n directiveName?: string;\n}\n\nexport function createPermissionPlugin(\n options: PermissionPluginOptions = {},\n): Plugin & { store: PermissionStore } {\n const store = options.store ?? createPermissionStore(options.initialState);\n const directiveName = options.directiveName ?? 'permission';\n\n const plugin: Plugin & { store: PermissionStore } = {\n store,\n install(app: App) {\n app.provide(PERMISSION_STORE_KEY, store);\n app.directive(directiveName, createVPermission(store));\n app.config.globalProperties.$permission = store;\n app.config.globalProperties.$can = (\n codes: PermissionCode | PermissionCode[],\n opts?: CheckOptions,\n ) => store.can(codes, opts);\n app.config.globalProperties.$hasRole = (\n codes: RoleCode | RoleCode[],\n opts?: CheckOptions,\n ) => store.hasRole(codes, opts);\n },\n };\n\n return plugin;\n}\n\nfunction resolveStore(store?: PermissionStore): PermissionStore {\n const injected = store ?? inject(PERMISSION_STORE_KEY, null);\n if (!injected) {\n throw new Error(\n '[com-angel-authorization/vue] Permission store not found. Did you call app.use(createPermissionPlugin())?',\n );\n }\n return injected;\n}\n\nexport interface UsePermissionResult {\n permissions: ComputedRef<PermissionCode[]>;\n roles: ComputedRef<RoleCode[]>;\n isSuperAdmin: ComputedRef<boolean>;\n hasPermission: (codes: PermissionCode | PermissionCode[], options?: CheckOptions) => boolean;\n hasRole: (codes: RoleCode | RoleCode[], options?: CheckOptions) => boolean;\n can: (codes: PermissionCode | PermissionCode[], options?: CheckOptions) => boolean;\n setPermissions: (permissions: PermissionCode[]) => void;\n setRoles: (roles: RoleCode[]) => void;\n setSuperAdmin: (isSuperAdmin: boolean) => void;\n hydrate: (payload: Partial<PermissionState>) => void;\n clear: () => void;\n store: PermissionStore;\n}\n\n/**\n * Reactive permission API for Vue 3 Composition API.\n */\nexport function usePermission(store?: PermissionStore): UsePermissionResult {\n const permissionStore = resolveStore(store);\n const state = shallowRef<PermissionState>(permissionStore.getState());\n\n const unsubscribe = permissionStore.subscribe((next) => {\n state.value = next;\n });\n onScopeDispose(unsubscribe);\n\n return {\n permissions: computed(() => state.value.permissions),\n roles: computed(() => state.value.roles),\n isSuperAdmin: computed(() => Boolean(state.value.isSuperAdmin)),\n hasPermission: (codes, options) => permissionStore.hasPermission(codes, options),\n hasRole: (codes, options) => permissionStore.hasRole(codes, options),\n can: (codes, options) => permissionStore.can(codes, options),\n setPermissions: permissionStore.setPermissions.bind(permissionStore),\n setRoles: permissionStore.setRoles.bind(permissionStore),\n setSuperAdmin: permissionStore.setSuperAdmin.bind(permissionStore),\n hydrate: permissionStore.hydrate.bind(permissionStore),\n clear: permissionStore.clear.bind(permissionStore),\n store: permissionStore,\n };\n}\n\nexport function useHasPermission(\n codes: PermissionCode | PermissionCode[],\n options?: CheckOptions,\n store?: PermissionStore,\n) {\n const { permissions, isSuperAdmin, hasPermission } = usePermission(store);\n return computed(() => {\n void permissions.value;\n void isSuperAdmin.value;\n return hasPermission(codes, options);\n });\n}\n\nexport function useHasRole(\n codes: RoleCode | RoleCode[],\n options?: CheckOptions,\n store?: PermissionStore,\n) {\n const { roles, isSuperAdmin, hasRole } = usePermission(store);\n return computed(() => {\n void roles.value;\n void isSuperAdmin.value;\n return hasRole(codes, options);\n });\n}\n\ndeclare module 'vue' {\n interface ComponentCustomProperties {\n $permission: PermissionStore;\n $can: (codes: PermissionCode | PermissionCode[], options?: CheckOptions) => boolean;\n $hasRole: (codes: RoleCode | RoleCode[], options?: CheckOptions) => boolean;\n }\n}\n","import type { Directive, DirectiveBinding } from 'vue';\nimport type { CheckOptions, MatchMode, PermissionCode, PermissionStore, RoleCode } from '../core';\n\nexport type PermissionDirectiveValue =\n | PermissionCode\n | PermissionCode[]\n | {\n permission?: PermissionCode | PermissionCode[];\n role?: RoleCode | RoleCode[];\n mode?: MatchMode;\n /** When both permission and role are set. Default: `and`. */\n combine?: 'and' | 'or';\n /** CSS display value when allowed. Default: restores original display. */\n display?: string;\n };\n\nfunction parseBinding(binding: DirectiveBinding<PermissionDirectiveValue>): {\n permission?: PermissionCode | PermissionCode[];\n role?: RoleCode | RoleCode[];\n mode?: MatchMode;\n combine: 'and' | 'or';\n display?: string;\n} {\n const value = binding.value;\n const arg = binding.arg;\n\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n return {\n permission: value.permission,\n role: value.role,\n mode: value.mode ?? (arg === 'all' ? 'all' : 'any'),\n combine: value.combine ?? 'and',\n display: value.display,\n };\n }\n\n if (arg === 'role') {\n return {\n role: value as RoleCode | RoleCode[],\n mode: binding.modifiers.all ? 'all' : 'any',\n combine: 'and',\n };\n }\n\n return {\n permission: value as PermissionCode | PermissionCode[],\n mode: arg === 'all' || binding.modifiers.all ? 'all' : 'any',\n combine: 'and',\n };\n}\n\nfunction isAllowed(\n store: PermissionStore,\n binding: DirectiveBinding<PermissionDirectiveValue>,\n): boolean {\n const { permission, role, mode, combine } = parseBinding(binding);\n const options: CheckOptions = { mode };\n\n const hasPermCheck = permission !== undefined;\n const hasRoleCheck = role !== undefined;\n\n if (!hasPermCheck && !hasRoleCheck) return true;\n\n const permOk = hasPermCheck ? store.hasPermission(permission!, options) : true;\n const roleOk = hasRoleCheck ? store.hasRole(role!, options) : true;\n\n if (hasPermCheck && hasRoleCheck) {\n return combine === 'or' ? permOk || roleOk : permOk && roleOk;\n }\n\n return hasPermCheck ? permOk : roleOk;\n}\n\ntype ElWithPermission = HTMLElement & {\n __angelPermissionDisplay?: string;\n __angelPermissionUnsubscribe?: () => void;\n};\n\nfunction applyVisibility(\n el: ElWithPermission,\n allowed: boolean,\n display?: string,\n): void {\n if (el.__angelPermissionDisplay === undefined) {\n el.__angelPermissionDisplay = el.style.display;\n }\n\n if (allowed) {\n el.style.display = display ?? el.__angelPermissionDisplay ?? '';\n el.removeAttribute('aria-hidden');\n } else {\n el.style.display = 'none';\n el.setAttribute('aria-hidden', 'true');\n }\n}\n\n/**\n * Create a `v-permission` directive bound to a specific store.\n * Prefer installing via `createPermissionPlugin()` which registers this automatically.\n */\nexport function createVPermission(\n store: PermissionStore,\n): Directive<ElWithPermission, PermissionDirectiveValue> {\n return {\n mounted(el, binding) {\n const update = () => {\n const { display } = parseBinding(binding);\n applyVisibility(el, isAllowed(store, binding), display);\n };\n\n update();\n el.__angelPermissionUnsubscribe = store.subscribe(update);\n },\n\n updated(el, binding) {\n const { display } = parseBinding(binding);\n applyVisibility(el, isAllowed(store, binding), display);\n },\n\n unmounted(el) {\n el.__angelPermissionUnsubscribe?.();\n delete el.__angelPermissionUnsubscribe;\n delete el.__angelPermissionDisplay;\n },\n };\n}\n","import { computed, defineComponent, type PropType } from 'vue';\nimport type { MatchMode, PermissionCode, RoleCode } from '../core';\nimport { usePermission } from './plugin';\n\n/**\n * Conditionally render slot content based on permission / role.\n *\n * @example\n * <Can permission=\"user:edit\">\n * <button>Edit</button>\n * </Can>\n *\n * <Can :permission=\"['user:edit', 'user:delete']\" mode=\"all\">\n * <AdminPanel />\n * <template #fallback>No access</template>\n * </Can>\n */\nexport const Can = defineComponent({\n name: 'Can',\n props: {\n permission: {\n type: [String, Array] as PropType<PermissionCode | PermissionCode[]>,\n default: undefined,\n },\n role: {\n type: [String, Array] as PropType<RoleCode | RoleCode[]>,\n default: undefined,\n },\n mode: {\n type: String as PropType<MatchMode>,\n default: 'any',\n },\n combine: {\n type: String as PropType<'and' | 'or'>,\n default: 'and',\n },\n },\n setup(props, { slots }) {\n const { hasPermission, hasRole, permissions, roles, isSuperAdmin } = usePermission();\n\n const allowed = computed(() => {\n void permissions.value;\n void roles.value;\n void isSuperAdmin.value;\n\n const hasPermCheck = props.permission !== undefined;\n const hasRoleCheck = props.role !== undefined;\n\n if (!hasPermCheck && !hasRoleCheck) return true;\n\n const options = { mode: props.mode };\n const permOk = hasPermCheck ? hasPermission(props.permission!, options) : true;\n const roleOk = hasRoleCheck ? hasRole(props.role!, options) : true;\n\n if (hasPermCheck && hasRoleCheck) {\n return props.combine === 'or' ? permOk || roleOk : permOk && roleOk;\n }\n\n return hasPermCheck ? permOk : roleOk;\n });\n\n return () => {\n if (allowed.value) {\n return slots.default?.();\n }\n return slots.fallback?.() ?? null;\n };\n },\n});\n","import {\n defineComponent,\n h,\n onMounted,\n reactive,\n ref,\n watch,\n type PropType,\n} from 'vue';\nimport {\n RESOURCE_PRIVATE_OPTIONS,\n RESOURCE_STATUS_ENABLED,\n RESOURCE_STATUS_OPTIONS,\n type AuthorizationResource,\n type AuthorizationResourceApi,\n type AuthorizationResourceFormValues,\n type PageDirection,\n} from '../resources';\n\nconst PAGE_SIZE_OPTIONS = ['10', '20', '50', '100'];\n\nfunction emptyForm(): AuthorizationResourceFormValues {\n return {\n name: '',\n identification: '',\n status: RESOURCE_STATUS_ENABLED,\n private: false,\n description: '',\n };\n}\n\nconst s = {\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: '16px',\n padding: '16px',\n color: '#101828',\n fontFamily:\n '\"PingFang SC\", \"Microsoft YaHei\", -apple-system, BlinkMacSystemFont, sans-serif',\n },\n toolbar: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: '12px',\n },\n title: { margin: '0', fontSize: '18px', fontWeight: '600' },\n toolbarRight: { display: 'flex', alignItems: 'center', gap: '8px' },\n error: {\n padding: '10px 12px',\n borderRadius: '8px',\n background: '#fef3f2',\n color: '#b42318',\n fontSize: '13px',\n },\n tableWrap: {\n overflow: 'auto',\n border: '1px solid #eaecf0',\n borderRadius: '10px',\n background: '#fff',\n },\n table: { width: '100%', borderCollapse: 'collapse', minWidth: '720px' },\n th: {\n textAlign: 'left',\n padding: '12px 14px',\n fontSize: '13px',\n fontWeight: '600',\n color: '#475467',\n background: '#f9fafb',\n borderBottom: '1px solid #eaecf0',\n },\n td: {\n padding: '12px 14px',\n fontSize: '14px',\n borderBottom: '1px solid #f2f4f7',\n verticalAlign: 'middle',\n },\n empty: {\n padding: '28px',\n textAlign: 'center',\n color: '#98a2b3',\n fontSize: '14px',\n },\n code: {\n fontFamily: 'ui-monospace, SFMono-Regular, Menlo, monospace',\n fontSize: '13px',\n background: '#f2f4f7',\n padding: '2px 6px',\n borderRadius: '4px',\n },\n badge: {\n display: 'inline-block',\n padding: '2px 8px',\n borderRadius: '999px',\n fontSize: '12px',\n fontWeight: '500',\n },\n linkBtn: {\n border: 'none',\n background: 'transparent',\n color: '#049BAD',\n cursor: 'pointer',\n padding: '0 8px 0 0',\n fontSize: '13px',\n },\n pagination: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: '12px',\n },\n pageSize: {\n display: 'flex',\n alignItems: 'center',\n gap: '8px',\n fontSize: '13px',\n color: '#475467',\n },\n pageBtns: { display: 'flex', gap: '8px' },\n primaryBtn: {\n border: 'none',\n background: '#049BAD',\n color: '#fff',\n borderRadius: '8px',\n padding: '8px 14px',\n cursor: 'pointer',\n fontSize: '14px',\n },\n secondaryBtn: {\n border: '1px solid #d0d5dd',\n background: '#fff',\n color: '#344054',\n borderRadius: '8px',\n padding: '8px 14px',\n cursor: 'pointer',\n fontSize: '14px',\n },\n select: {\n border: '1px solid #d0d5dd',\n borderRadius: '6px',\n padding: '4px 8px',\n fontSize: '13px',\n },\n mask: {\n position: 'fixed',\n inset: '0',\n background: 'rgba(16, 24, 40, 0.45)',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n zIndex: '1000',\n padding: '16px',\n },\n dialog: {\n width: '100%',\n maxWidth: '480px',\n background: '#fff',\n borderRadius: '12px',\n boxShadow: '0 20px 40px rgba(16,24,40,0.18)',\n },\n dialogHeader: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n padding: '14px 16px',\n borderBottom: '1px solid #eaecf0',\n },\n dialogTitle: { margin: '0', fontSize: '16px', fontWeight: '600' },\n iconBtn: {\n border: 'none',\n background: 'transparent',\n fontSize: '22px',\n lineHeight: '1',\n cursor: 'pointer',\n color: '#667085',\n },\n form: { display: 'flex', flexDirection: 'column', gap: '12px', padding: '16px' },\n field: { display: 'flex', flexDirection: 'column', gap: '6px' },\n label: { fontSize: '13px', color: '#344054', fontWeight: '500' },\n input: {\n border: '1px solid #d0d5dd',\n borderRadius: '8px',\n padding: '8px 10px',\n fontSize: '14px',\n outline: 'none',\n },\n dialogFooter: {\n display: 'flex',\n justifyContent: 'flex-end',\n gap: '8px',\n paddingTop: '4px',\n },\n} as const;\n\n/**\n * 权限点管理页面(Vue 3)\n */\nexport const ResourceManager = defineComponent({\n name: 'ResourceManager',\n props: {\n api: {\n type: Object as PropType<AuthorizationResourceApi>,\n required: true,\n },\n title: {\n type: String,\n default: '权限点管理',\n },\n pageSize: {\n type: String,\n default: '20',\n },\n },\n setup(props, { slots }) {\n const records = ref<AuthorizationResource[]>([]);\n const loading = ref(false);\n const error = ref('');\n const pageSize = ref(props.pageSize);\n const pageToken = ref('');\n const hasPreviousPage = ref(false);\n const hasNextPage = ref(false);\n const dialogOpen = ref(false);\n const editing = ref<AuthorizationResource | null>(null);\n const form = reactive<AuthorizationResourceFormValues>(emptyForm());\n const saving = ref(false);\n\n const statusLabel = Object.fromEntries(\n RESOURCE_STATUS_OPTIONS.map((o) => [o.value, o.label]),\n ) as Record<number, string>;\n\n async function loadList(direction: PageDirection = 'current', token = pageToken.value) {\n loading.value = true;\n error.value = '';\n try {\n const result = await props.api.list({\n pagination: {\n pageToken: token,\n pageSize: pageSize.value,\n pageDirection: direction,\n },\n });\n records.value = result.records;\n pageToken.value = result.pageToken;\n hasPreviousPage.value = result.hasPreviousPage;\n hasNextPage.value = result.hasNextPage;\n } catch (err) {\n error.value = err instanceof Error ? err.message : '加载失败';\n } finally {\n loading.value = false;\n }\n }\n\n function openCreate() {\n editing.value = null;\n Object.assign(form, emptyForm());\n dialogOpen.value = true;\n }\n\n function openEdit(row: AuthorizationResource) {\n editing.value = row;\n Object.assign(form, {\n name: row.name,\n identification: row.identification,\n status: row.status,\n private: row.private,\n description: row.description,\n });\n dialogOpen.value = true;\n }\n\n function closeDialog() {\n if (!saving.value) dialogOpen.value = false;\n }\n\n async function handleSubmit(event: Event) {\n event.preventDefault();\n if (!form.name.trim()) {\n error.value = '请填写权限名称';\n return;\n }\n if (!form.identification.trim()) {\n error.value = '请填写接口标识';\n return;\n }\n\n saving.value = true;\n error.value = '';\n try {\n if (editing.value) {\n await props.api.update(editing.value.resourceId, { ...form });\n } else {\n await props.api.create({ ...form });\n }\n dialogOpen.value = false;\n await loadList('current', '');\n } catch (err) {\n error.value = err instanceof Error ? err.message : '保存失败';\n } finally {\n saving.value = false;\n }\n }\n\n async function handleDelete(row: AuthorizationResource) {\n if (!window.confirm(`确认删除权限点「${row.name}」?`)) return;\n error.value = '';\n try {\n await props.api.remove(row.resourceId);\n await loadList('current', '');\n } catch (err) {\n error.value = err instanceof Error ? err.message : '删除失败';\n }\n }\n\n onMounted(() => {\n void loadList('current', '');\n });\n\n watch(\n () => [props.api, pageSize.value] as const,\n () => {\n pageToken.value = '';\n void loadList('current', '');\n },\n );\n\n return () =>\n h('div', { style: s.root }, [\n h('div', { style: s.toolbar }, [\n h('h2', { style: s.title }, props.title),\n h('div', { style: s.toolbarRight }, [\n slots.toolbarExtra?.(),\n h(\n 'button',\n { type: 'button', style: s.primaryBtn, onClick: openCreate },\n '新增',\n ),\n ]),\n ]),\n error.value ? h('div', { style: s.error }, error.value) : null,\n h('div', { style: s.tableWrap }, [\n h('table', { style: s.table }, [\n h('thead', [\n h('tr', [\n h('th', { style: s.th }, '权限名称'),\n h('th', { style: s.th }, '接口标识'),\n h('th', { style: s.th }, '描述'),\n h('th', { style: { ...s.th, width: '90px' } }, '状态'),\n h('th', { style: { ...s.th, width: '140px' } }, '操作'),\n ]),\n ]),\n h(\n 'tbody',\n loading.value\n ? [\n h('tr', [\n h('td', { colspan: 5, style: s.empty }, '加载中…'),\n ]),\n ]\n : records.value.length === 0\n ? [\n h('tr', [\n h('td', { colspan: 5, style: s.empty }, '暂无数据'),\n ]),\n ]\n : records.value.map((row) =>\n h('tr', { key: row.resourceId }, [\n h('td', { style: s.td }, row.name),\n h('td', { style: s.td }, [\n h('code', { style: s.code }, row.identification),\n ]),\n h('td', { style: s.td }, row.description || '—'),\n h('td', { style: s.td }, [\n h(\n 'span',\n {\n style: {\n ...s.badge,\n background:\n row.status === RESOURCE_STATUS_ENABLED\n ? '#e8f7ef'\n : '#f4f4f5',\n color:\n row.status === RESOURCE_STATUS_ENABLED\n ? '#067647'\n : '#667085',\n },\n },\n statusLabel[row.status] ?? String(row.status),\n ),\n ]),\n h('td', { style: s.td }, [\n h(\n 'button',\n {\n type: 'button',\n style: s.linkBtn,\n onClick: () => openEdit(row),\n },\n '编辑',\n ),\n h(\n 'button',\n {\n type: 'button',\n style: { ...s.linkBtn, color: '#d92d20' },\n onClick: () => void handleDelete(row),\n },\n '删除',\n ),\n ]),\n ]),\n ),\n ),\n ]),\n ]),\n h('div', { style: s.pagination }, [\n h('label', { style: s.pageSize }, [\n '每页',\n h(\n 'select',\n {\n style: s.select,\n value: pageSize.value,\n onChange: (e: Event) => {\n pageSize.value = (e.target as HTMLSelectElement).value;\n },\n },\n PAGE_SIZE_OPTIONS.map((size) =>\n h('option', { key: size, value: size }, size),\n ),\n ),\n ]),\n h('div', { style: s.pageBtns }, [\n h(\n 'button',\n {\n type: 'button',\n style: s.secondaryBtn,\n disabled: !hasPreviousPage.value || loading.value,\n onClick: () => void loadList('previous'),\n },\n '上一页',\n ),\n h(\n 'button',\n {\n type: 'button',\n style: s.secondaryBtn,\n disabled: !hasNextPage.value || loading.value,\n onClick: () => void loadList('next'),\n },\n '下一页',\n ),\n ]),\n ]),\n dialogOpen.value\n ? h(\n 'div',\n { style: s.mask, onClick: closeDialog },\n [\n h(\n 'div',\n {\n style: s.dialog,\n role: 'dialog',\n 'aria-modal': 'true',\n onClick: (e: Event) => e.stopPropagation(),\n },\n [\n h('div', { style: s.dialogHeader }, [\n h(\n 'h3',\n { style: s.dialogTitle },\n editing.value ? '编辑权限点' : '新增权限点',\n ),\n h(\n 'button',\n {\n type: 'button',\n style: s.iconBtn,\n 'aria-label': '关闭',\n onClick: closeDialog,\n },\n '×',\n ),\n ]),\n h(\n 'form',\n {\n style: s.form,\n onSubmit: (e: Event) => void handleSubmit(e),\n },\n [\n h('label', { style: s.field }, [\n h('span', { style: s.label }, '权限名称'),\n h('input', {\n style: s.input,\n value: form.name,\n placeholder: '请输入权限名称',\n required: true,\n onInput: (e: Event) => {\n form.name = (e.target as HTMLInputElement).value;\n },\n }),\n ]),\n h('label', { style: s.field }, [\n h('span', { style: s.label }, '接口标识'),\n h('input', {\n style: s.input,\n value: form.identification,\n placeholder: '如 user:list',\n required: true,\n onInput: (e: Event) => {\n form.identification = (\n e.target as HTMLInputElement\n ).value;\n },\n }),\n ]),\n h('label', { style: s.field }, [\n h('span', { style: s.label }, '状态'),\n h(\n 'select',\n {\n style: s.input,\n value: form.status,\n onChange: (e: Event) => {\n form.status = Number(\n (e.target as HTMLSelectElement).value,\n ) as 0 | 1;\n },\n },\n RESOURCE_STATUS_OPTIONS.map((opt) =>\n h('option', { key: opt.value, value: opt.value }, opt.label),\n ),\n ),\n ]),\n h('label', { style: s.field }, [\n h('span', { style: s.label }, '私有资源'),\n h(\n 'select',\n {\n style: s.input,\n value: form.private ? '1' : '0',\n onChange: (e: Event) => {\n form.private =\n (e.target as HTMLSelectElement).value === '1';\n },\n },\n RESOURCE_PRIVATE_OPTIONS.map((opt) =>\n h(\n 'option',\n {\n key: String(opt.value),\n value: opt.value ? '1' : '0',\n },\n opt.label,\n ),\n ),\n ),\n ]),\n h('label', { style: s.field }, [\n h('span', { style: s.label }, '描述'),\n h('textarea', {\n style: {\n ...s.input,\n minHeight: '88px',\n resize: 'vertical',\n },\n value: form.description,\n placeholder: '请输入描述',\n onInput: (e: Event) => {\n form.description = (\n e.target as HTMLTextAreaElement\n ).value;\n },\n }),\n ]),\n h('div', { style: s.dialogFooter }, [\n h(\n 'button',\n {\n type: 'button',\n style: s.secondaryBtn,\n onClick: closeDialog,\n },\n '取消',\n ),\n h(\n 'button',\n {\n type: 'submit',\n style: s.primaryBtn,\n disabled: saving.value,\n },\n saving.value ? '保存中…' : '保存',\n ),\n ]),\n ],\n ),\n ],\n ),\n ],\n )\n : null,\n ]);\n },\n});\n"],"mappings":";;;;;;;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V;AAAA,sBACA,OAAO,KAAK;AAAA,sBACZ,aAAa;AAAA,sBACb,SAAS,CAAC,MAAa;AACrB,6BAAK,cACH,EAAE,OACF;AAAA,sBACJ;AAAA,oBACF,CAAC;AAAA,kBACH,CAAC;AAAA,sBACD,eAAE,OAAO,EAAE,OAAO,EAAE,aAAa,GAAG;AAAA,wBAClC;AAAA,sBACE;AAAA,sBACA;AAAA,wBACE,MAAM;AAAA,wBACN,OAAO,EAAE;AAAA,wBACT,SAAS;AAAA,sBACX;AAAA,sBACA;AAAA,oBACF;AAAA,wBACA;AAAA,sBACE;AAAA,sBACA;AAAA,wBACE,MAAM;AAAA,wBACN,OAAO,EAAE;AAAA,wBACT,UAAU,OAAO;AAAA,sBACnB;AAAA,sBACA,OAAO,QAAQ,6BAAS;AAAA,oBAC1B;AAAA,kBACF,CAAC;AAAA,gBACH;AAAA,cACF;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF,IACA;AAAA,IACN,CAAC;AAAA,EACL;AACF,CAAC;;;AJtkBD,IAAAC,eAAuD;AAEvD,uBAA8D;AAoB9D,IAAAC,oBAcO;","names":["import_vue","import_vue","import_core","import_resources"]}
@@ -170,4 +170,165 @@ declare const Can: vue.DefineComponent<vue.ExtractPropTypes<{
170
170
  combine: "and" | "or";
171
171
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
172
172
 
173
- export { Can, type CheckOptions, type MatchMode, PERMISSION_STORE_KEY, type PermissionChecker, type PermissionCode, type PermissionDirectiveValue, type PermissionListener, type PermissionPluginOptions, type PermissionState, PermissionStore, type RoleCode, type UsePermissionResult, createPermissionPlugin, createPermissionStore, createVPermission, useHasPermission, useHasRole, usePermission };
173
+ type PageDirection = 'previous' | 'current' | 'next';
174
+ type ListPaginationParams = {
175
+ pageToken?: string;
176
+ pageSize?: string;
177
+ pageDirection?: PageDirection;
178
+ };
179
+ type ListPaginationResult = {
180
+ pageToken: string;
181
+ hasPreviousPage: boolean;
182
+ hasNextPage: boolean;
183
+ };
184
+ /** 权限点状态:1 启用,0 禁用 */
185
+ type ResourceStatus = 0 | 1;
186
+ type AuthorizationResource = {
187
+ resourceId: string;
188
+ type: 'api';
189
+ name: string;
190
+ identification: string;
191
+ status: ResourceStatus;
192
+ private: boolean;
193
+ description: string;
194
+ };
195
+ type AuthorizationResourceFormValues = {
196
+ name: string;
197
+ identification: string;
198
+ status: ResourceStatus;
199
+ private: boolean;
200
+ description: string;
201
+ };
202
+ type CreateAuthorizationResourceBody = AuthorizationResourceFormValues & {
203
+ resourceId: string;
204
+ type: 'api';
205
+ };
206
+ type UpdateAuthorizationResourceBody = Partial<AuthorizationResourceFormValues> & {
207
+ type?: 'api';
208
+ };
209
+ type FetchAuthorizationResourcesParams = {
210
+ pagination?: ListPaginationParams;
211
+ };
212
+ type AuthorizationResourceListResult = {
213
+ records: AuthorizationResource[];
214
+ pageToken: string;
215
+ hasPreviousPage: boolean;
216
+ hasNextPage: boolean;
217
+ };
218
+ declare const RESOURCE_TYPE_API: "api";
219
+ declare const RESOURCE_STATUS_ENABLED: ResourceStatus;
220
+ declare const RESOURCE_STATUS_DISABLED: ResourceStatus;
221
+ declare const RESOURCE_STATUS_OPTIONS: {
222
+ label: string;
223
+ value: ResourceStatus;
224
+ }[];
225
+ declare const RESOURCE_PRIVATE_OPTIONS: {
226
+ label: string;
227
+ value: boolean;
228
+ }[];
229
+
230
+ type HttpMethod = 'GET' | 'POST' | 'PATCH' | 'DELETE';
231
+ type ResourceRequestOptions = {
232
+ method: HttpMethod;
233
+ url: string;
234
+ body?: unknown;
235
+ signal?: AbortSignal;
236
+ };
237
+ /**
238
+ * 由宿主应用注入的请求函数(可对接 Angel_HGAMS 的 apiGetJson / apiPostJson 等)。
239
+ */
240
+ type ResourceHttpRequest = <T = unknown>(options: ResourceRequestOptions) => Promise<T>;
241
+ type AuthorizationResourceApi = {
242
+ list: (params?: FetchAuthorizationResourcesParams, signal?: AbortSignal) => Promise<AuthorizationResourceListResult>;
243
+ create: (values: AuthorizationResourceFormValues, signal?: AbortSignal) => Promise<unknown>;
244
+ update: (resourceId: string, values: AuthorizationResourceFormValues, signal?: AbortSignal) => Promise<unknown>;
245
+ remove: (resourceId: string, signal?: AbortSignal) => Promise<unknown>;
246
+ };
247
+ declare function mapAuthorizationResource(item: unknown): AuthorizationResource | null;
248
+ declare function buildCreateBody(values: AuthorizationResourceFormValues, resourceId?: string): CreateAuthorizationResourceBody;
249
+ declare function buildUpdateBody(values: AuthorizationResourceFormValues): UpdateAuthorizationResourceBody;
250
+ declare function createAuthorizationResourceApi(request: ResourceHttpRequest): AuthorizationResourceApi;
251
+ type CreateDefaultResourceRequestOptions = {
252
+ /** API 前缀,如 `/api` 或完整域名 */
253
+ baseUrl?: string;
254
+ /** 追加请求头(如 Authorization) */
255
+ getHeaders?: () => Record<string, string> | Promise<Record<string, string>>;
256
+ credentials?: RequestCredentials;
257
+ };
258
+ /**
259
+ * 基于 fetch 的默认请求实现,便于快速接入。
260
+ * 生产环境建议注入宿主应用已有的 request 封装。
261
+ */
262
+ declare function createDefaultResourceRequest(options?: CreateDefaultResourceRequestOptions): ResourceHttpRequest;
263
+
264
+ declare function appendQueryParam(parts: string[], key: string, value: string): void;
265
+ declare function extractPagination(payload: unknown): ListPaginationResult;
266
+ declare function extractRecords(payload: unknown): unknown[];
267
+
268
+ /**
269
+ * 权限点管理页面(Vue 3)
270
+ */
271
+ declare const ResourceManager: vue.DefineComponent<vue.ExtractPropTypes<{
272
+ api: {
273
+ type: PropType<AuthorizationResourceApi>;
274
+ required: true;
275
+ };
276
+ title: {
277
+ type: StringConstructor;
278
+ default: string;
279
+ };
280
+ pageSize: {
281
+ type: StringConstructor;
282
+ default: string;
283
+ };
284
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
285
+ [key: string]: any;
286
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
287
+ api: {
288
+ type: PropType<AuthorizationResourceApi>;
289
+ required: true;
290
+ };
291
+ title: {
292
+ type: StringConstructor;
293
+ default: string;
294
+ };
295
+ pageSize: {
296
+ type: StringConstructor;
297
+ default: string;
298
+ };
299
+ }>> & Readonly<{}>, {
300
+ title: string;
301
+ pageSize: string;
302
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
303
+
304
+ interface SnowyflakeOptions {
305
+ epoch?: bigint;
306
+ workerId?: bigint;
307
+ processId?: bigint;
308
+ workerIdBits?: number;
309
+ processIdBits?: number;
310
+ sequenceBits?: number;
311
+ }
312
+ /**
313
+ * snowyflake 2.0.1 仅支持固定 5+5+12 位布局,此处按相同 nextId 算法实现可配置位数版本。
314
+ */
315
+ declare class ConfigurableSnowflake {
316
+ readonly epoch: bigint;
317
+ readonly workerId: bigint;
318
+ readonly processId: bigint;
319
+ private readonly sequenceMask;
320
+ private readonly timestampLeftShift;
321
+ private readonly workerIdShift;
322
+ private readonly processIdShift;
323
+ private sequence;
324
+ private latestTimestamp;
325
+ constructor({ epoch, workerId, processId, workerIdBits, processIdBits, sequenceBits, }?: SnowyflakeOptions);
326
+ nextId(): bigint;
327
+ }
328
+ /** 应用级单例,模块加载时只初始化一次(不受 React StrictMode 重复 mount 影响) */
329
+ declare const snowyflake: ConfigurableSnowflake;
330
+ /** 生成雪花 ID 字符串(reportId、detailId、resourceId 等) */
331
+ declare function getAppClientId(): string;
332
+ declare function getDeviceWorkerId(): string;
333
+
334
+ export { type AuthorizationResource, type AuthorizationResourceApi, type AuthorizationResourceFormValues, type AuthorizationResourceListResult, Can, type CheckOptions, type CreateAuthorizationResourceBody, type CreateDefaultResourceRequestOptions, type FetchAuthorizationResourcesParams, type HttpMethod, type ListPaginationParams, type ListPaginationResult, type MatchMode, 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, type ResourceHttpRequest, ResourceManager, type ResourceRequestOptions, type ResourceStatus, type RoleCode, type UpdateAuthorizationResourceBody, type UsePermissionResult, appendQueryParam, buildCreateBody, buildUpdateBody, createAuthorizationResourceApi, createDefaultResourceRequest, createPermissionPlugin, createPermissionStore, createVPermission, extractPagination, extractRecords, getAppClientId, getDeviceWorkerId, mapAuthorizationResource, snowyflake, useHasPermission, useHasRole, usePermission };
@@ -170,4 +170,165 @@ declare const Can: vue.DefineComponent<vue.ExtractPropTypes<{
170
170
  combine: "and" | "or";
171
171
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
172
172
 
173
- export { Can, type CheckOptions, type MatchMode, PERMISSION_STORE_KEY, type PermissionChecker, type PermissionCode, type PermissionDirectiveValue, type PermissionListener, type PermissionPluginOptions, type PermissionState, PermissionStore, type RoleCode, type UsePermissionResult, createPermissionPlugin, createPermissionStore, createVPermission, useHasPermission, useHasRole, usePermission };
173
+ type PageDirection = 'previous' | 'current' | 'next';
174
+ type ListPaginationParams = {
175
+ pageToken?: string;
176
+ pageSize?: string;
177
+ pageDirection?: PageDirection;
178
+ };
179
+ type ListPaginationResult = {
180
+ pageToken: string;
181
+ hasPreviousPage: boolean;
182
+ hasNextPage: boolean;
183
+ };
184
+ /** 权限点状态:1 启用,0 禁用 */
185
+ type ResourceStatus = 0 | 1;
186
+ type AuthorizationResource = {
187
+ resourceId: string;
188
+ type: 'api';
189
+ name: string;
190
+ identification: string;
191
+ status: ResourceStatus;
192
+ private: boolean;
193
+ description: string;
194
+ };
195
+ type AuthorizationResourceFormValues = {
196
+ name: string;
197
+ identification: string;
198
+ status: ResourceStatus;
199
+ private: boolean;
200
+ description: string;
201
+ };
202
+ type CreateAuthorizationResourceBody = AuthorizationResourceFormValues & {
203
+ resourceId: string;
204
+ type: 'api';
205
+ };
206
+ type UpdateAuthorizationResourceBody = Partial<AuthorizationResourceFormValues> & {
207
+ type?: 'api';
208
+ };
209
+ type FetchAuthorizationResourcesParams = {
210
+ pagination?: ListPaginationParams;
211
+ };
212
+ type AuthorizationResourceListResult = {
213
+ records: AuthorizationResource[];
214
+ pageToken: string;
215
+ hasPreviousPage: boolean;
216
+ hasNextPage: boolean;
217
+ };
218
+ declare const RESOURCE_TYPE_API: "api";
219
+ declare const RESOURCE_STATUS_ENABLED: ResourceStatus;
220
+ declare const RESOURCE_STATUS_DISABLED: ResourceStatus;
221
+ declare const RESOURCE_STATUS_OPTIONS: {
222
+ label: string;
223
+ value: ResourceStatus;
224
+ }[];
225
+ declare const RESOURCE_PRIVATE_OPTIONS: {
226
+ label: string;
227
+ value: boolean;
228
+ }[];
229
+
230
+ type HttpMethod = 'GET' | 'POST' | 'PATCH' | 'DELETE';
231
+ type ResourceRequestOptions = {
232
+ method: HttpMethod;
233
+ url: string;
234
+ body?: unknown;
235
+ signal?: AbortSignal;
236
+ };
237
+ /**
238
+ * 由宿主应用注入的请求函数(可对接 Angel_HGAMS 的 apiGetJson / apiPostJson 等)。
239
+ */
240
+ type ResourceHttpRequest = <T = unknown>(options: ResourceRequestOptions) => Promise<T>;
241
+ type AuthorizationResourceApi = {
242
+ list: (params?: FetchAuthorizationResourcesParams, signal?: AbortSignal) => Promise<AuthorizationResourceListResult>;
243
+ create: (values: AuthorizationResourceFormValues, signal?: AbortSignal) => Promise<unknown>;
244
+ update: (resourceId: string, values: AuthorizationResourceFormValues, signal?: AbortSignal) => Promise<unknown>;
245
+ remove: (resourceId: string, signal?: AbortSignal) => Promise<unknown>;
246
+ };
247
+ declare function mapAuthorizationResource(item: unknown): AuthorizationResource | null;
248
+ declare function buildCreateBody(values: AuthorizationResourceFormValues, resourceId?: string): CreateAuthorizationResourceBody;
249
+ declare function buildUpdateBody(values: AuthorizationResourceFormValues): UpdateAuthorizationResourceBody;
250
+ declare function createAuthorizationResourceApi(request: ResourceHttpRequest): AuthorizationResourceApi;
251
+ type CreateDefaultResourceRequestOptions = {
252
+ /** API 前缀,如 `/api` 或完整域名 */
253
+ baseUrl?: string;
254
+ /** 追加请求头(如 Authorization) */
255
+ getHeaders?: () => Record<string, string> | Promise<Record<string, string>>;
256
+ credentials?: RequestCredentials;
257
+ };
258
+ /**
259
+ * 基于 fetch 的默认请求实现,便于快速接入。
260
+ * 生产环境建议注入宿主应用已有的 request 封装。
261
+ */
262
+ declare function createDefaultResourceRequest(options?: CreateDefaultResourceRequestOptions): ResourceHttpRequest;
263
+
264
+ declare function appendQueryParam(parts: string[], key: string, value: string): void;
265
+ declare function extractPagination(payload: unknown): ListPaginationResult;
266
+ declare function extractRecords(payload: unknown): unknown[];
267
+
268
+ /**
269
+ * 权限点管理页面(Vue 3)
270
+ */
271
+ declare const ResourceManager: vue.DefineComponent<vue.ExtractPropTypes<{
272
+ api: {
273
+ type: PropType<AuthorizationResourceApi>;
274
+ required: true;
275
+ };
276
+ title: {
277
+ type: StringConstructor;
278
+ default: string;
279
+ };
280
+ pageSize: {
281
+ type: StringConstructor;
282
+ default: string;
283
+ };
284
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
285
+ [key: string]: any;
286
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
287
+ api: {
288
+ type: PropType<AuthorizationResourceApi>;
289
+ required: true;
290
+ };
291
+ title: {
292
+ type: StringConstructor;
293
+ default: string;
294
+ };
295
+ pageSize: {
296
+ type: StringConstructor;
297
+ default: string;
298
+ };
299
+ }>> & Readonly<{}>, {
300
+ title: string;
301
+ pageSize: string;
302
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
303
+
304
+ interface SnowyflakeOptions {
305
+ epoch?: bigint;
306
+ workerId?: bigint;
307
+ processId?: bigint;
308
+ workerIdBits?: number;
309
+ processIdBits?: number;
310
+ sequenceBits?: number;
311
+ }
312
+ /**
313
+ * snowyflake 2.0.1 仅支持固定 5+5+12 位布局,此处按相同 nextId 算法实现可配置位数版本。
314
+ */
315
+ declare class ConfigurableSnowflake {
316
+ readonly epoch: bigint;
317
+ readonly workerId: bigint;
318
+ readonly processId: bigint;
319
+ private readonly sequenceMask;
320
+ private readonly timestampLeftShift;
321
+ private readonly workerIdShift;
322
+ private readonly processIdShift;
323
+ private sequence;
324
+ private latestTimestamp;
325
+ constructor({ epoch, workerId, processId, workerIdBits, processIdBits, sequenceBits, }?: SnowyflakeOptions);
326
+ nextId(): bigint;
327
+ }
328
+ /** 应用级单例,模块加载时只初始化一次(不受 React StrictMode 重复 mount 影响) */
329
+ declare const snowyflake: ConfigurableSnowflake;
330
+ /** 生成雪花 ID 字符串(reportId、detailId、resourceId 等) */
331
+ declare function getAppClientId(): string;
332
+ declare function getDeviceWorkerId(): string;
333
+
334
+ export { type AuthorizationResource, type AuthorizationResourceApi, type AuthorizationResourceFormValues, type AuthorizationResourceListResult, Can, type CheckOptions, type CreateAuthorizationResourceBody, type CreateDefaultResourceRequestOptions, type FetchAuthorizationResourcesParams, type HttpMethod, type ListPaginationParams, type ListPaginationResult, type MatchMode, 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, type ResourceHttpRequest, ResourceManager, type ResourceRequestOptions, type ResourceStatus, type RoleCode, type UpdateAuthorizationResourceBody, type UsePermissionResult, appendQueryParam, buildCreateBody, buildUpdateBody, createAuthorizationResourceApi, createDefaultResourceRequest, createPermissionPlugin, createPermissionStore, createVPermission, extractPagination, extractRecords, getAppClientId, getDeviceWorkerId, mapAuthorizationResource, snowyflake, useHasPermission, useHasRole, usePermission };