@refinedev/core 4.20.0 → 4.21.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/CHANGELOG.md +40 -0
- package/README.md +1 -1
- package/dist/contexts/accessControl/IAccessControlContext.d.ts +16 -1
- package/dist/contexts/accessControl/IAccessControlContext.d.ts.map +1 -1
- package/dist/contexts/accessControl/index.d.ts +3 -2
- package/dist/contexts/accessControl/index.d.ts.map +1 -1
- package/dist/esm/index.js +6 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/hooks/export/index.d.ts.map +1 -1
- package/dist/iife/index.js +5 -5
- package/dist/iife/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/contexts/accessControl/IAccessControlContext.ts +18 -1
- package/src/contexts/accessControl/index.tsx +33 -6
- package/src/hooks/export/index.ts +3 -1
- package/src/index.tsx +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# @pankod/refine-core
|
|
2
2
|
|
|
3
|
+
## 4.21.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#4449](https://github.com/refinedev/refine/pull/4449) [`cc84d61bc5c`](https://github.com/refinedev/refine/commit/cc84d61bc5c8cfc8ac7da391f965471ecad6c445) Thanks [@BatuhanW](https://github.com/BatuhanW)! - feat: allow access control provider to be configured globally.
|
|
8
|
+
|
|
9
|
+
Now `accessControlProvider` accepts `options.buttons` parameter to globally configure UI buttons' behaviour.
|
|
10
|
+
|
|
11
|
+
These configuration will be used as a fallback, if no configuration on button prop level is found.
|
|
12
|
+
|
|
13
|
+
Default values:
|
|
14
|
+
|
|
15
|
+
`options.buttons.enableAccessControl` => `true`
|
|
16
|
+
`options.buttons.hideIfUnauthorized` => `false`
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
const accessControlProvider: IAccessControlContext = {
|
|
20
|
+
can: async (params: CanParams): Promise<CanReturnType> => {
|
|
21
|
+
return { can: true };
|
|
22
|
+
},
|
|
23
|
+
options: {
|
|
24
|
+
buttons: {
|
|
25
|
+
enableAccessControl: true,
|
|
26
|
+
hideIfUnauthorized: false,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- [#4521](https://github.com/refinedev/refine/pull/4521) [`a3c8d4f84c7`](https://github.com/refinedev/refine/commit/a3c8d4f84c7b20b6d30f43310f5260b2f57b801a) Thanks [@alicanerdurmaz](https://github.com/alicanerdurmaz)! - fixed: `useExport`'s `resource` props is not working.
|
|
35
|
+
With this fix, `useExport` will now work with `resource` props.
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
useExport({
|
|
39
|
+
resource: "users",
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
3
43
|
## 4.20.0
|
|
4
44
|
|
|
5
45
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ It eliminates repetitive tasks demanded by **CRUD** operations and provides indu
|
|
|
61
61
|
|
|
62
62
|
Instead of being a limited set of pre-styled components, **refine** is a collection of helper `hooks`, `components`, and `providers`. They are all decoupled from _UI components_ and _business logic_, so that they never keep you from customizing your _UI_ or coding your own flow.
|
|
63
63
|
|
|
64
|
-
**refine** seamlessly works with any **custom design** or **UI framework** that you favor. For convenience, it ships with ready-made integrations for [Ant Design System](https://ant.design/), [Material UI](https://mui.com/), [Mantine](https://mantine.dev/), and [Chakra UI](https://chakra-ui.com/).
|
|
64
|
+
**refine** seamlessly works with any **custom design** or **UI framework** that you favor. For convenience, it ships with ready-made integrations for [Ant Design System](https://ant.design/), [Material UI](https://mui.com/material-ui/getting-started/overview/), [Mantine](https://mantine.dev/), and [Chakra UI](https://chakra-ui.com/).
|
|
65
65
|
|
|
66
66
|
## Use cases
|
|
67
67
|
|
|
@@ -26,6 +26,21 @@ export declare type CanReturnType = {
|
|
|
26
26
|
};
|
|
27
27
|
export interface IAccessControlContext {
|
|
28
28
|
can?: ({ resource, action, params }: CanParams) => Promise<CanReturnType>;
|
|
29
|
+
options?: {
|
|
30
|
+
buttons?: {
|
|
31
|
+
enableAccessControl?: boolean;
|
|
32
|
+
hideIfUnauthorized?: boolean;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export interface IAccessControlContextReturnType {
|
|
37
|
+
can?: ({ resource, action, params }: CanParams) => Promise<CanReturnType>;
|
|
38
|
+
options: {
|
|
39
|
+
buttons: {
|
|
40
|
+
enableAccessControl?: boolean;
|
|
41
|
+
hideIfUnauthorized?: boolean;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
29
44
|
}
|
|
30
|
-
export declare type AccessControlProvider = Required<IAccessControlContext
|
|
45
|
+
export declare type AccessControlProvider = Partial<IAccessControlContext> & Required<Pick<IAccessControlContext, "can">>;
|
|
31
46
|
//# sourceMappingURL=IAccessControlContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IAccessControlContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/accessControl/IAccessControlContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAErE,oBAAY,SAAS,GAAG;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE;QACL,QAAQ,CAAC,EAAE,aAAa,GAAG;YAAE,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAA;SAAE,CAAC;QACtD,EAAE,CAAC,EAAE,OAAO,CAAC;QACb,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACtB,CAAC;CACL,CAAC;AAEF,oBAAY,aAAa,GAAG;IACxB,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,qBAAqB;IAClC,GAAG,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,SAAS,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"IAccessControlContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/accessControl/IAccessControlContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAErE,oBAAY,SAAS,GAAG;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE;QACL,QAAQ,CAAC,EAAE,aAAa,GAAG;YAAE,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAA;SAAE,CAAC;QACtD,EAAE,CAAC,EAAE,OAAO,CAAC;QACb,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACtB,CAAC;CACL,CAAC;AAEF,oBAAY,aAAa,GAAG;IACxB,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,qBAAqB;IAClC,GAAG,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,SAAS,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAC1E,OAAO,CAAC,EAAE;QACN,OAAO,CAAC,EAAE;YACN,mBAAmB,CAAC,EAAE,OAAO,CAAC;YAC9B,kBAAkB,CAAC,EAAE,OAAO,CAAC;SAChC,CAAC;KACL,CAAC;CACL;AAED,MAAM,WAAW,+BAA+B;IAC5C,GAAG,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,SAAS,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAC1E,OAAO,EAAE;QACL,OAAO,EAAE;YACL,mBAAmB,CAAC,EAAE,OAAO,CAAC;YAC9B,kBAAkB,CAAC,EAAE,OAAO,CAAC;SAChC,CAAC;KACL,CAAC;CACL;AAED,oBAAY,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC,GAC9D,QAAQ,CAAC,IAAI,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { IAccessControlContext } from "./IAccessControlContext";
|
|
2
|
+
import { IAccessControlContext, IAccessControlContextReturnType } from "./IAccessControlContext";
|
|
3
3
|
/** @deprecated default value for access control context has no use and is an empty object. */
|
|
4
4
|
export declare const defaultAccessControlContext: IAccessControlContext;
|
|
5
|
-
export declare const AccessControlContext: React.Context<
|
|
5
|
+
export declare const AccessControlContext: React.Context<IAccessControlContextReturnType>;
|
|
6
|
+
export { IAccessControlContext };
|
|
6
7
|
export declare const AccessControlContextProvider: React.FC<IAccessControlContext & {
|
|
7
8
|
children?: React.ReactNode;
|
|
8
9
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/contexts/accessControl/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/contexts/accessControl/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACH,qBAAqB,EACrB,+BAA+B,EAClC,MAAM,yBAAyB,CAAC;AAEjC,8FAA8F;AAC9F,eAAO,MAAM,2BAA2B,EAAE,qBAA0B,CAAC;AAErE,eAAO,MAAM,oBAAoB,gDAK3B,CAAC;AAEP,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAEjC,eAAO,MAAM,4BAA4B,EAAE,KAAK,CAAC,EAAE,CAC/C,qBAAqB,GAAG;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B,CA0BJ,CAAC"}
|