trithuc-mvc-react 1.7.1 → 1.7.3
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.
|
@@ -77,7 +77,7 @@ export function FilterElement({ name, type, label, keyValue, keyLabel, childrenF
|
|
|
77
77
|
case "select":
|
|
78
78
|
return (
|
|
79
79
|
<FormControl sx={{ minWidth: 160 }} size="small" fullWidth>
|
|
80
|
-
<InputLabel
|
|
80
|
+
<InputLabel shrink={true}>{label}</InputLabel>
|
|
81
81
|
<Select
|
|
82
82
|
{...rest}
|
|
83
83
|
labelId="demo-simple-select-label"
|
|
@@ -87,6 +87,7 @@ export function FilterElement({ name, type, label, keyValue, keyLabel, childrenF
|
|
|
87
87
|
size={size}
|
|
88
88
|
label={label}
|
|
89
89
|
value={value ?? ""}
|
|
90
|
+
displayEmpty
|
|
90
91
|
onChange={(e) => {
|
|
91
92
|
onFieldChange(e);
|
|
92
93
|
setDataSearch({ ...dataSearch, [name]: e.target.value });
|
package/contexts/index.jsx
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { createContext
|
|
1
|
+
import { createContext } from "react";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const PermissionContext = createContext({
|
|
4
4
|
permissionMap: {},
|
|
5
5
|
setPermission: () => {}
|
|
6
6
|
});
|
|
7
|
+
|
|
8
|
+
export { PermissionContext };
|
package/hooks/index.js
ADDED
package/hooks/usePermission.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useContext, useMemo } from "react";
|
|
2
2
|
import { PermissionContext } from "../contexts";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const usePermission = (tableName) => {
|
|
5
5
|
if (!tableName) {
|
|
6
6
|
throw new Error("tableName is required");
|
|
7
7
|
}
|
|
@@ -32,3 +32,4 @@ export const usePermission = (tableName) => {
|
|
|
32
32
|
|
|
33
33
|
return { permission, set, canEdit, canDelete, canDeleteMulti, canSave, canCreate, canAction, canView, canImport };
|
|
34
34
|
};
|
|
35
|
+
export default usePermission;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMemo, useState } from "react";
|
|
2
2
|
import { PermissionContext } from "../contexts";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const PermissionProvider = ({ children }) => {
|
|
5
5
|
const [permissionMap, setPermission] = useState({});
|
|
6
6
|
const value = useMemo(() => {
|
|
7
7
|
return { permissionMap, setPermission };
|
|
@@ -9,3 +9,4 @@ export const PermissionProvider = ({ children }) => {
|
|
|
9
9
|
console.log("PermissionProvider: permissionMap", permissionMap);
|
|
10
10
|
return <PermissionContext.Provider value={value}>{children}</PermissionContext.Provider>;
|
|
11
11
|
};
|
|
12
|
+
export default PermissionProvider;
|
package/providers/index.jsx
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import PermissionProvider from "./PermissionProvider";
|
|
2
|
+
export { PermissionProvider };
|
package/hooks/index.jsx
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./usePermission";
|