@abpjs/permission-management 0.8.0 → 1.0.0

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/dist/index.d.mts CHANGED
@@ -3,7 +3,7 @@ import React from 'react';
3
3
 
4
4
  /**
5
5
  * Permission Management module type definitions
6
- * Translated from @abp/ng.permission-management v0.7.6
6
+ * Translated from @abp/ng.permission-management v1.0.0
7
7
  */
8
8
  /**
9
9
  * PermissionManagement namespace containing all permission-related types
@@ -140,6 +140,8 @@ interface UsePermissionManagementReturn {
140
140
  getSelectedGroupPermissions: () => PermissionWithMargin[];
141
141
  /** Check if a permission is granted */
142
142
  isGranted: (permissionName: string) => boolean;
143
+ /** Check if a permission is granted by a role provider (v0.9.0) */
144
+ isGrantedByRole: (grantedProviders: PermissionManagement.GrantedProvider[]) => boolean;
143
145
  /** Reset state */
144
146
  reset: () => void;
145
147
  }
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import React from 'react';
3
3
 
4
4
  /**
5
5
  * Permission Management module type definitions
6
- * Translated from @abp/ng.permission-management v0.7.6
6
+ * Translated from @abp/ng.permission-management v1.0.0
7
7
  */
8
8
  /**
9
9
  * PermissionManagement namespace containing all permission-related types
@@ -140,6 +140,8 @@ interface UsePermissionManagementReturn {
140
140
  getSelectedGroupPermissions: () => PermissionWithMargin[];
141
141
  /** Check if a permission is granted */
142
142
  isGranted: (permissionName: string) => boolean;
143
+ /** Check if a permission is granted by a role provider (v0.9.0) */
144
+ isGrantedByRole: (grantedProviders: PermissionManagement.GrantedProvider[]) => boolean;
143
145
  /** Reset state */
144
146
  reset: () => void;
145
147
  }
package/dist/index.js CHANGED
@@ -98,6 +98,12 @@ function usePermissionManagement() {
98
98
  },
99
99
  [permissions]
100
100
  );
101
+ const isGrantedByRole = (0, import_react.useCallback)(
102
+ (grantedProviders) => {
103
+ return grantedProviders.some((provider) => provider.providerName === "R");
104
+ },
105
+ []
106
+ );
101
107
  const getSelectedGroupPermissions = (0, import_react.useCallback)(() => {
102
108
  if (!selectedGroup) return [];
103
109
  const groupPermissions = groups.find((g) => g.name === selectedGroup.name)?.permissions ?? [];
@@ -266,6 +272,7 @@ function usePermissionManagement() {
266
272
  toggleSelectAll,
267
273
  getSelectedGroupPermissions,
268
274
  isGranted,
275
+ isGrantedByRole,
269
276
  reset
270
277
  };
271
278
  }
package/dist/index.mjs CHANGED
@@ -70,6 +70,12 @@ function usePermissionManagement() {
70
70
  },
71
71
  [permissions]
72
72
  );
73
+ const isGrantedByRole = useCallback(
74
+ (grantedProviders) => {
75
+ return grantedProviders.some((provider) => provider.providerName === "R");
76
+ },
77
+ []
78
+ );
73
79
  const getSelectedGroupPermissions = useCallback(() => {
74
80
  if (!selectedGroup) return [];
75
81
  const groupPermissions = groups.find((g) => g.name === selectedGroup.name)?.permissions ?? [];
@@ -238,6 +244,7 @@ function usePermissionManagement() {
238
244
  toggleSelectAll,
239
245
  getSelectedGroupPermissions,
240
246
  isGranted,
247
+ isGrantedByRole,
241
248
  reset
242
249
  };
243
250
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abpjs/permission-management",
3
- "version": "0.8.0",
3
+ "version": "1.0.0",
4
4
  "description": "ABP Framework permission-management components for React - translated from @abp/ng.permission-management",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -32,11 +32,20 @@
32
32
  "dependencies": {
33
33
  "@chakra-ui/react": "^3.2.0",
34
34
  "@emotion/react": "^11.11.0",
35
- "@abpjs/core": "0.8.0",
36
- "@abpjs/theme-shared": "0.8.0"
35
+ "@abpjs/core": "1.0.0",
36
+ "@abpjs/theme-shared": "1.0.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@abp/ng.permission-management": "0.8.0"
39
+ "@abp/ng.permission-management": "1.0.0",
40
+ "@testing-library/jest-dom": "^6.4.0",
41
+ "@testing-library/react": "^14.2.0",
42
+ "@types/react": "^18.2.0",
43
+ "@types/react-dom": "^18.2.0",
44
+ "@vitest/coverage-v8": "^1.2.0",
45
+ "jsdom": "^24.0.0",
46
+ "react": "^18.2.0",
47
+ "react-dom": "^18.2.0",
48
+ "vitest": "^1.2.0"
40
49
  },
41
50
  "author": "tekthar.com",
42
51
  "license": "LGPL-3.0",
@@ -59,6 +68,7 @@
59
68
  "format": "prettier --write \"src/**/*.{ts,tsx,json,md}\"",
60
69
  "format:check": "prettier --check \"src/**/*.{ts,tsx,json,md}\"",
61
70
  "type-check": "tsc --noEmit",
62
- "test": "vitest"
71
+ "test": "vitest run",
72
+ "test:watch": "vitest"
63
73
  }
64
74
  }