vsoft-ui 1.0.1 → 1.0.2

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.
@@ -0,0 +1,3 @@
1
+ import { default as Button } from './src/Button.vue';
2
+ export { Button };
3
+ export default Button;
@@ -0,0 +1,24 @@
1
+ interface Props {
2
+ permission?: string | string[];
3
+ permissionMode?: 'any' | 'all';
4
+ }
5
+ declare function __VLS_template(): {
6
+ attrs: Partial<{}>;
7
+ slots: {
8
+ default?(_: {}): any;
9
+ };
10
+ refs: {};
11
+ rootEl: any;
12
+ };
13
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
14
+ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
15
+ permission: string | string[];
16
+ permissionMode: "any" | "all";
17
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
18
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
19
+ export default _default;
20
+ type __VLS_WithTemplateSlots<T, S> = T & {
21
+ new (): {
22
+ $slots: S;
23
+ };
24
+ };
@@ -0,0 +1,3 @@
1
+ import { default as Input } from './src/Input.vue';
2
+ export { Input };
3
+ export default Input;
@@ -0,0 +1,27 @@
1
+ interface Props {
2
+ permission?: string | string[];
3
+ permissionMode?: 'any' | 'all';
4
+ }
5
+ declare function __VLS_template(): {
6
+ attrs: Partial<{}>;
7
+ slots: {
8
+ prepend?(_: {}): any;
9
+ append?(_: {}): any;
10
+ prefix?(_: {}): any;
11
+ suffix?(_: {}): any;
12
+ };
13
+ refs: {};
14
+ rootEl: any;
15
+ };
16
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
17
+ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
18
+ permission: string | string[];
19
+ permissionMode: "any" | "all";
20
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
21
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
22
+ export default _default;
23
+ type __VLS_WithTemplateSlots<T, S> = T & {
24
+ new (): {
25
+ $slots: S;
26
+ };
27
+ };
@@ -0,0 +1,11 @@
1
+ import { App } from 'vue';
2
+ declare global {
3
+ interface HTMLElement {
4
+ _permissionOriginalParent?: Node | null;
5
+ _permissionNextSibling?: Node | null;
6
+ }
7
+ }
8
+ /**
9
+ * 安装权限指令
10
+ */
11
+ export declare function setupPermissionDirective(app: App): void;
@@ -0,0 +1,12 @@
1
+ import { Ref } from 'vue';
2
+ export interface UsePermissionOptions {
3
+ mode?: 'any' | 'all';
4
+ }
5
+ export declare function usePermission(): {
6
+ permissions: Ref<string[], string[]>;
7
+ hasPermission: (requiredPermissions: string | string[]) => boolean;
8
+ hasAnyPermission: (requiredPermissions: string | string[]) => boolean;
9
+ hasAllPermissions: (requiredPermissions: string | string[]) => boolean;
10
+ createPermissionComputed: (requiredPermissions: Ref<string | string[]> | string | string[], options?: UsePermissionOptions) => import('vue').ComputedRef<boolean>;
11
+ setPermissions: (permissions: string[]) => void;
12
+ };
package/dist/index.d.ts CHANGED
@@ -1,16 +1,10 @@
1
- import { install } from './install';
2
-
3
- export * from './components';
4
- export { install };
5
- export type { InstallOptions } from './install';
6
- export { usePermission, PermissionService, createPermissionService } from './permission';
7
- declare const _default: {
8
- install: typeof install;
9
- version: string;
1
+ import { App } from 'vue';
2
+ import { default as Button } from './components/button';
3
+ import { default as Input } from './components/input';
4
+ import { permission } from './utils/permission';
5
+ import { usePermission } from './hooks/usePermission';
6
+ declare const VSoftUI: {
7
+ install(app: App): void;
10
8
  };
11
- export default _default;
12
- declare module 'vue' {
13
- interface GlobalComponents {
14
- [key: string]: any;
15
- }
16
- }
9
+ export { Button, Input, permission, usePermission, VSoftUI };
10
+ export default VSoftUI;
@@ -0,0 +1,33 @@
1
+ declare class Permission {
2
+ private permissions;
3
+ /**
4
+ * 设置用户权限
5
+ * @param permissions 权限数组
6
+ */
7
+ setPermissions(permissions: string[]): void;
8
+ /**
9
+ * 获取当前用户权限
10
+ * @returns 权限数组
11
+ */
12
+ getPermissions(): string[];
13
+ /**
14
+ * 检查是否拥有任一权限
15
+ * @param requiredPermissions 需要的权限
16
+ * @returns 是否拥有权限
17
+ */
18
+ hasAny(requiredPermissions: string | string[]): boolean;
19
+ /**
20
+ * 检查是否拥有所有权限
21
+ * @param requiredPermissions 需要的权限
22
+ * @returns 是否拥有权限
23
+ */
24
+ hasAll(requiredPermissions: string | string[]): boolean;
25
+ /**
26
+ * 检查是否拥有指定权限
27
+ * @param requiredPermissions 需要的权限
28
+ * @returns 是否拥有权限
29
+ */
30
+ hasPermission(requiredPermissions: string | string[]): boolean;
31
+ }
32
+ export declare const permission: Permission;
33
+ export {};