@fto-consult/expo-ui 6.73.7 → 6.73.8
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/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from "$react";
|
2
2
|
import { StyleSheet } from "react-native";
|
3
3
|
import {defaultObj,extendObj} from "$cutils";
|
4
|
-
import Auth from "$cauth";
|
4
|
+
import Auth,{getTableDataPermResourcePrefix} from "$cauth";
|
5
5
|
import Expandable from "$ecomponents/Expandable";
|
6
6
|
import PropTypes from "prop-types";
|
7
7
|
import theme from "$theme";
|
@@ -9,7 +9,7 @@ import {defaultActions as mDefaultAction,hasResource} from "./utils";
|
|
9
9
|
import PermLine from "./PermLine";
|
10
10
|
import Grid from "$ecomponents/Grid";
|
11
11
|
|
12
|
-
const PermLines = React.forwardRef(({user,gridProps,defaultActions:cDefaultActions,disabled,isUserMasterAdmin:cIsMasterAdmin,permLineProps,cellProps,containerProps,style,
|
12
|
+
const PermLines = React.forwardRef(({user,gridProps,defaultActions:cDefaultActions,disabled,isUserMasterAdmin:cIsMasterAdmin,permLineProps,cellProps,containerProps,style,tables,title,testID,perms,onChange:cOnChange,...props},ref)=>{
|
13
13
|
const isUserMasterAdmin = !!cIsMasterAdmin;
|
14
14
|
user = defaultObj(user,Auth.getLoggedUser());
|
15
15
|
gridProps = defaultObj(gridProps);
|
@@ -22,7 +22,6 @@ const PermLines = React.forwardRef(({user,gridProps,defaultActions:cDefaultActio
|
|
22
22
|
const defaultActions = React.useRef(extendObj(true,{},mDefaultAction,defaultActions)).current;
|
23
23
|
const data = dataRef.current;
|
24
24
|
disabled = !!disabled || isUserMasterAdmin;
|
25
|
-
tablePermPrefix = tablePermPrefix === false ? "" : typeof tablePermPrefix =="string" ? tablePermPrefix.trim() : defaultStr("table/").toLowerCase();
|
26
25
|
const onChange = disabled ? undefined : (arg)=>{
|
27
26
|
let {data,resource} = arg;
|
28
27
|
if(!isNonNullString(resource)) return;
|
@@ -58,7 +57,7 @@ const PermLines = React.forwardRef(({user,gridProps,defaultActions:cDefaultActio
|
|
58
57
|
if(!isObj(table) || !isObj(table.perms)) return null;
|
59
58
|
tableName = defaultStr(table.tableName,table.table,tableName).toLowerCase().trim();
|
60
59
|
const text = defaultStr(table.text,table.label)
|
61
|
-
const resource = (
|
60
|
+
const resource = getTableDataPermResourcePrefix(tableName);
|
62
61
|
const perms = {};
|
63
62
|
Object.map(table.perms,(perm,i)=>{
|
64
63
|
if(perm ===false) {
|
@@ -87,7 +86,6 @@ const PermLines = React.forwardRef(({user,gridProps,defaultActions:cDefaultActio
|
|
87
86
|
isUserMasterAdmin = {isUserMasterAdmin}
|
88
87
|
disabled = {disabled}
|
89
88
|
table = {tableName}
|
90
|
-
tablePermPrefix = {tablePermPrefix}
|
91
89
|
perms = {perms}
|
92
90
|
data = {data}
|
93
91
|
defaultActions = {defaultActions}
|
@@ -100,7 +98,7 @@ const PermLines = React.forwardRef(({user,gridProps,defaultActions:cDefaultActio
|
|
100
98
|
/>);
|
101
99
|
})
|
102
100
|
return content;
|
103
|
-
},[tables,allPerms,isUserMasterAdmin,disabled
|
101
|
+
},[tables,allPerms,isUserMasterAdmin,disabled])
|
104
102
|
return <Expandable withScrollView={false} {...props} testID={testID} style={[theme.styles.w100,style]} containerProps={containerProps} titleProps = {{style:[styles.expandable,theme.styles.w100]}} title={title}>
|
105
103
|
<Grid testID={testID+"_Grid"} {...gridProps}>
|
106
104
|
{content }
|
@@ -133,10 +131,6 @@ PermLines.propTypes = {
|
|
133
131
|
perms : PropTypes.object,//la liste des permissions qui peuvent associer au compte d'un utilisaters
|
134
132
|
/*** si les élements de permissions seront modifiable où non */
|
135
133
|
disabled : PropTypes.bool,
|
136
|
-
tablePermPrefix : PropTypes.oneOfType([
|
137
|
-
PropTypes.string,
|
138
|
-
PropTypes.bool,
|
139
|
-
]),/*** le prefixe de permission à jouter à chaque permissions de table de donénes, exemple : 'table/', pour le prefix des permissions de type table de données */
|
140
134
|
title : PropTypes.oneOfType([
|
141
135
|
PropTypes.node,
|
142
136
|
PropTypes.element,
|