@fto-consult/expo-ui 5.7.5 → 5.7.7
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 +7 -7
- package/src/components/Countries/SelectCountry.js +13 -2
- package/src/components/Datagrid/Common/Common.js +26 -8
- package/src/components/Form/Fields/SelectCountry.js +1 -4
- package/src/components/Form/Fields/SelectTableData/Component.js +34 -16
- package/src/components/SimpleSelect/index.js +14 -16
- package/src/components/TextField/index.js +4 -3
- package/src/layouts/Screen/ScreenWithOrWithoutAuthContainer.js +1 -1
- package/src/layouts/Screen/utils.js +1 -1
- package/src/navigation/utils.js +23 -4
- package/src/screens/ScreenWrapper.js +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fto-consult/expo-ui",
|
|
3
|
-
"version": "5.7.
|
|
3
|
+
"version": "5.7.7",
|
|
4
4
|
"description": "Bibliothèque de composants UI Expo,react-native",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -58,17 +58,17 @@
|
|
|
58
58
|
},
|
|
59
59
|
"homepage": "https://github.com/borispipo/expo-ui#readme",
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@emotion/native": "^11.10.
|
|
61
|
+
"@emotion/native": "^11.10.6",
|
|
62
62
|
"@expo/html-elements": "^0.2.0",
|
|
63
63
|
"@expo/vector-icons": "^13.0.0",
|
|
64
|
-
"@fto-consult/common": "^3.10.
|
|
64
|
+
"@fto-consult/common": "^3.10.69",
|
|
65
65
|
"@gorhom/portal": "^1.0.14",
|
|
66
66
|
"@react-native-async-storage/async-storage": "^1.17.11",
|
|
67
67
|
"@react-native-community/datetimepicker": "^6.7.3",
|
|
68
68
|
"@react-native-community/netinfo": "^9.3.7",
|
|
69
69
|
"@react-native/assets-registry": "^0.72.0",
|
|
70
|
-
"@react-navigation/native": "^6.1.
|
|
71
|
-
"@react-navigation/native-stack": "^6.9.
|
|
70
|
+
"@react-navigation/native": "^6.1.6",
|
|
71
|
+
"@react-navigation/native-stack": "^6.9.12",
|
|
72
72
|
"@shopify/flash-list": "^1.4.0",
|
|
73
73
|
"apexcharts": "^3.37.2",
|
|
74
74
|
"expo": "^48.0.10",
|
|
@@ -83,12 +83,12 @@
|
|
|
83
83
|
"expo-web-browser": "~12.1.1",
|
|
84
84
|
"file-saver": "^2.0.5",
|
|
85
85
|
"fs-extra": "^11.1.1",
|
|
86
|
-
"google-libphonenumber": "^3.2.
|
|
86
|
+
"google-libphonenumber": "^3.2.32",
|
|
87
87
|
"htmlparser2-without-node-native": "^3.9.2",
|
|
88
88
|
"process": "^0.11.10",
|
|
89
89
|
"prop-types": "^15.8.1",
|
|
90
90
|
"react": "^18.2.0",
|
|
91
|
-
"react-content-loader": "^6.2.
|
|
91
|
+
"react-content-loader": "^6.2.1",
|
|
92
92
|
"react-dom": "^18.2.0",
|
|
93
93
|
"react-native": "^0.71.3",
|
|
94
94
|
"react-native-big-list": "^1.6.0",
|
|
@@ -12,8 +12,19 @@ import appConfig from "$capp/config";
|
|
|
12
12
|
/**** retourne les props du champ de type countrie */
|
|
13
13
|
export const getCountryFieldProps = (props)=>{
|
|
14
14
|
props = defaultObj(props);
|
|
15
|
-
let {imageProps,...rest} = props;
|
|
15
|
+
let {imageProps,defaultValue,...rest} = props;
|
|
16
|
+
const countryStr = defaultStr(appConfig.countryCode).toUpperCase();
|
|
16
17
|
imageProps = defaultObj(imageProps);
|
|
18
|
+
if(rest.multiple){
|
|
19
|
+
if(isNonNullString(defaultValue)){
|
|
20
|
+
defaultValue = defaultValue.split(",");
|
|
21
|
+
}
|
|
22
|
+
if(!defaultValue){
|
|
23
|
+
defaultValue = [countryStr];
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
defaultValue = defaultStr(defaultValue,countryStr);
|
|
27
|
+
}
|
|
17
28
|
return {
|
|
18
29
|
label : defaultStr(props.label,props.text,'Pays'),
|
|
19
30
|
type : 'select',
|
|
@@ -32,8 +43,8 @@ export const getCountryFieldProps = (props)=>{
|
|
|
32
43
|
<Label>{item.label}</Label>
|
|
33
44
|
</View>
|
|
34
45
|
},
|
|
35
|
-
defaultValue : appConfig.countryCode,
|
|
36
46
|
...defaultObj(rest),
|
|
47
|
+
defaultValue,
|
|
37
48
|
}
|
|
38
49
|
}
|
|
39
50
|
|
|
@@ -774,12 +774,15 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
774
774
|
}
|
|
775
775
|
const footers = this.getFootersFields(true);
|
|
776
776
|
let isAccordion = this.isAccordion();
|
|
777
|
+
const rowKeysColumns = {};
|
|
777
778
|
Object.mapToArray(columns,(headerCol1,headerIndex)=>{
|
|
778
779
|
if(!isObj(headerCol1)) return;
|
|
779
|
-
const
|
|
780
|
-
if(isAccordion && headerCol.accordion === false) return null;
|
|
781
|
-
let header = {...headerCol};
|
|
780
|
+
const header = Object.clone(headerCol1);
|
|
782
781
|
header.field = defaultStr(header.field, headerIndex)
|
|
782
|
+
if(header.primaryKey){
|
|
783
|
+
rowKeysColumns[header.field] = true;
|
|
784
|
+
}
|
|
785
|
+
if(isAccordion && header.accordion === false) return null;
|
|
783
786
|
header.type = defaultStr(header.jsType,header.type,"text").toLowerCase();
|
|
784
787
|
if(header.type.contains("date")){
|
|
785
788
|
this.dateFields[header.field] = header;
|
|
@@ -799,7 +802,8 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
799
802
|
if(!this.hasColumnsHalreadyInitialized){
|
|
800
803
|
this.initColumnsCallback({...header,colIndex,columnField:header.field});
|
|
801
804
|
}
|
|
802
|
-
})
|
|
805
|
+
});
|
|
806
|
+
this.rowKeysColumns = Object.keys(rowKeysColumns);
|
|
803
807
|
return footers;
|
|
804
808
|
}
|
|
805
809
|
getFootersFields(init){
|
|
@@ -3436,16 +3440,30 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
3436
3440
|
isVirtual(){
|
|
3437
3441
|
return false;
|
|
3438
3442
|
}
|
|
3439
|
-
|
|
3440
3443
|
getRowKey(row,rowIndex){
|
|
3441
3444
|
let k = rowIndex;
|
|
3445
|
+
if(isFunction(this.props.getRowKey)){
|
|
3446
|
+
k = this.props.getRowKey({row,rowData:row,data:row,rowIndex,item:row,index:rowIndex,context:this});
|
|
3447
|
+
if(typeof k =='string' && k || typeof k =='number'){
|
|
3448
|
+
return k;
|
|
3449
|
+
}
|
|
3450
|
+
}
|
|
3442
3451
|
const rowKey = this.props.rowKey;
|
|
3452
|
+
const rKey = Array.isArray(this.rowKeysColumns) && this.rowKeysColumns.length ? this.rowKeysColumns : null;
|
|
3453
|
+
if(rKey){
|
|
3454
|
+
const rr = React.getKeyFromObj(row,rKey);
|
|
3455
|
+
if(rr){
|
|
3456
|
+
return rr;
|
|
3457
|
+
}
|
|
3458
|
+
}
|
|
3459
|
+
const rkey = React.getKeyFromObj(row,rowIndex,rowKey);
|
|
3460
|
+
if(rkey){
|
|
3461
|
+
return rkey;
|
|
3462
|
+
}
|
|
3443
3463
|
if(isNonNullString(rowKey) && isObj(row) && (isNonNullString(row[rowKey]) || isDecimal(row[rowKey]))){
|
|
3444
3464
|
return row[rowKey];
|
|
3445
3465
|
}
|
|
3446
|
-
if(
|
|
3447
|
-
k = this.props.getRowKey({row,rowData:row,data:row,rowIndex,item:row,index:rowIndex,context:this});
|
|
3448
|
-
} else if(isObj(row)){
|
|
3466
|
+
if(isObj(row)){
|
|
3449
3467
|
return React.getKey(row,rowIndex);
|
|
3450
3468
|
} else k = rowIndex;
|
|
3451
3469
|
if(isObj(row) && isNonNullString(row.rowKey)){
|
|
@@ -2,11 +2,8 @@ import SelectField from "./SelectField";
|
|
|
2
2
|
import {getCountryFieldProps} from "$ecomponents/Countries";
|
|
3
3
|
|
|
4
4
|
export default class FormFieldSelectCountry extends SelectField{
|
|
5
|
-
getComponentProps(props){
|
|
6
|
-
return {...getCountryFieldProps(),...defaultObj(props)}
|
|
7
|
-
}
|
|
8
5
|
_render(props){
|
|
9
|
-
return super._render(
|
|
6
|
+
return super._render(getCountryFieldProps(props))
|
|
10
7
|
}
|
|
11
8
|
}
|
|
12
9
|
FormFieldSelectCountry.propTypes = {
|
|
@@ -19,7 +19,7 @@ import appConfig from "$appConfig";
|
|
|
19
19
|
* foreignKeyTable : la tableData dans laquelle effectuer les donées de la requêtes
|
|
20
20
|
* foreignKeyLabel : Le libélé dans la table étrangère
|
|
21
21
|
*/
|
|
22
|
-
const TableDataSelectField = React.forwardRef(({foreignKeyColumn,foreignKeyTable,fetchItemsPath,foreignKeyLabel,foreignKeyLabelIndex,dropdownActions,fields,fetchItems:customFetchItem,convertFiltersToSQL,mutateFetchedItems,getForeignKeyTable,onFetchItems,isFilter,isUpdate,isDocEditing,items,onAddProps,fetchOptions,...props},ref)=>{
|
|
22
|
+
const TableDataSelectField = React.forwardRef(({foreignKeyColumn,bindUpsert2RemoveEvents,onAdd,showAdd:customShowAdd,canShowAdd,foreignKeyTable,fetchItemsPath,foreignKeyLabel,foreignKeyLabelIndex,dropdownActions,fields,fetchItems:customFetchItem,convertFiltersToSQL,mutateFetchedItems,getForeignKeyTable,onFetchItems,isFilter,isUpdate,isDocEditing,items,onAddProps,fetchOptions,...props},ref)=>{
|
|
23
23
|
props.data = defaultObj(props.data);
|
|
24
24
|
if(isNonNullString(foreignKeyColumn)){
|
|
25
25
|
foreignKeyColumn = foreignKeyColumn.trim();
|
|
@@ -49,7 +49,7 @@ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,foreignKeyTable
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
const isMounted = React.useIsMounted();
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
const [state,setState] = React.useState({
|
|
54
54
|
items : [],
|
|
55
55
|
});
|
|
@@ -99,14 +99,19 @@ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,foreignKeyTable
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
React.useEffect(()=>{
|
|
102
|
-
const onUpsertData = ()=>{return isMounted()?context.refresh():undefined};
|
|
103
|
-
APP.on(actions.upsert(foreignKeyTable),onUpsertData);
|
|
104
|
-
APP.on(actions.onRemove(foreignKeyTable),onUpsertData);
|
|
105
102
|
context.refresh();
|
|
103
|
+
if(bindUpsert2RemoveEvents !== false){
|
|
104
|
+
const onUpsertData = ()=>{return isMounted()?context.refresh():undefined};
|
|
105
|
+
APP.on(actions.upsert(foreignKeyTable),onUpsertData);
|
|
106
|
+
APP.on(actions.onRemove(foreignKeyTable),onUpsertData);
|
|
107
|
+
return ()=>{
|
|
108
|
+
APP.off(actions.upsert(foreignKeyTable),onUpsertData);
|
|
109
|
+
APP.off(actions.onRemove(foreignKeyTable),onUpsertData);
|
|
110
|
+
};
|
|
111
|
+
}
|
|
106
112
|
return ()=>{
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
};
|
|
113
|
+
|
|
114
|
+
}
|
|
110
115
|
},[]);
|
|
111
116
|
|
|
112
117
|
let dat = isNonNullString(foreignKeyColumnValue)? {
|
|
@@ -227,13 +232,23 @@ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,foreignKeyTable
|
|
|
227
232
|
if(!ttitle){
|
|
228
233
|
const txt = defaultStr(props.label,props.text);
|
|
229
234
|
const tt = defaultStr(fKeyTable.text,fKeyTable.label);
|
|
230
|
-
ttitle = txt && tt ? "{0} [1]".sprintf(txt,tt) : tt || txt;
|
|
235
|
+
ttitle = txt && tt ? "{0} [{1}]".sprintf(txt,tt) : tt || txt;
|
|
231
236
|
}
|
|
232
237
|
dialogProps.title = ttitle;
|
|
238
|
+
const showAdd = React.useMemo(()=>{
|
|
239
|
+
if(isFilter || !foreignKeyTable) return false;
|
|
240
|
+
if(typeof canShowAdd ==='function'){
|
|
241
|
+
return canShowAdd({...props,table:foreignKeyTable,foreignKeyColumn,foreignKeyLabel,sortDir,foreignKeyTableObj:fKeyTable,foreignKeyTable})
|
|
242
|
+
}
|
|
243
|
+
if(Auth.isTableDataAllowed({table:foreignKeyTable,action:'create'})){
|
|
244
|
+
return !!defaultVal(customShowAdd,true);
|
|
245
|
+
}
|
|
246
|
+
return false;
|
|
247
|
+
},[isFilter,foreignKeyTable,customShowAdd]);
|
|
233
248
|
return <Dropdown
|
|
234
249
|
{...props}
|
|
235
250
|
isFilter = {isFilter}
|
|
236
|
-
showAdd = {
|
|
251
|
+
showAdd = {showAdd}
|
|
237
252
|
{...state}
|
|
238
253
|
isLoading = {isLoading}
|
|
239
254
|
dialogProps = {dialogProps}
|
|
@@ -266,25 +281,28 @@ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,foreignKeyTable
|
|
|
266
281
|
return rItem(p);
|
|
267
282
|
}}
|
|
268
283
|
hideOnAdd
|
|
269
|
-
onAdd = {(
|
|
284
|
+
onAdd = {(args)=>{
|
|
270
285
|
onAddProps = defaultObj(isFunction(onAddProps)? onAddProps.call(context,{context,foreignKeyTable,dbName,props}) : onAddProps);
|
|
271
|
-
|
|
286
|
+
if(typeof onAdd =='function'){
|
|
287
|
+
return onAdd({...args,...onAddProps});
|
|
288
|
+
}
|
|
289
|
+
return navigateToTableData({...onAddProps,foreignKeyTable,table:foreignKeyTable,foreignKeyColumn,tableName : foreignKeyTable,...args})
|
|
272
290
|
}}
|
|
273
291
|
/>
|
|
274
292
|
});
|
|
275
293
|
|
|
276
294
|
TableDataSelectField.propTypes = {
|
|
277
295
|
...Dropdown.propTypes,
|
|
296
|
+
bindUpsert2RemoveEvents : PropTypes.bool,//si le composant écoutera l'évènement de rafraichissement des données
|
|
297
|
+
onAdd : PropTypes.func, //({})=>, la fonction appelée lorsque l'on clique sur le bouton add
|
|
298
|
+
canShowAdd : PropTypes.func, //({foreignKeyTable,foreignKeyColumn})=><boolean> la fonction permettant de spécifier si l'on peut afficher le bouton showAdd
|
|
278
299
|
mutateFetchedItems : PropTypes.func, //la fonction permettant d'effectuer une mutation sur l'ensemble des donnéees récupérées à distance
|
|
279
300
|
fetchItems : PropTypes.func,//la fonction de rappel à utiliser pour faire une requête fetch permettant de selectionner les données à distance
|
|
280
301
|
getForeignKeyTable : PropTypes.func, //la fonction permettant de récupérer la fKeyTable data dont fait référence le champ
|
|
281
302
|
foreignKeyTable : PropTypes.string, //le nom de la fKeyTable data à laquelle se reporte le champ
|
|
282
303
|
fetchItemsPath : PropTypes.string, //le chemin d'api pour récupérer les items des données étrangères en utilisant la fonction fetch
|
|
283
304
|
beforeFetchItems : PropTypes.func, //appelée immédiatement avant l'exécution de la requête fetch
|
|
284
|
-
foreignKeyColumn : PropTypes.
|
|
285
|
-
PropTypes.string,
|
|
286
|
-
//PropTypes.arrayOf(PropTypes.string)
|
|
287
|
-
]).isRequired,//le nom de la clé étrangère à laquelle fait référence la colone dans la fKeyTable
|
|
305
|
+
foreignKeyColumn : PropTypes.string,//le nom de la clé étrangère à laquelle fait référence la colone dans la fKeyTable
|
|
288
306
|
foreignKeyLabel : PropTypes.oneOfType([
|
|
289
307
|
PropTypes.string,
|
|
290
308
|
PropTypes.arrayOf(PropTypes.string), ///si c'est un tableau, il s'agit des colonnes qui seront utilisées pour le rendu du foreignKey
|
|
@@ -22,15 +22,11 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
|
|
|
22
22
|
height: 0,
|
|
23
23
|
width: 0,
|
|
24
24
|
});
|
|
25
|
-
const [
|
|
26
|
-
|
|
27
|
-
visible : controlled?controlledVisible:false,
|
|
28
|
-
items : [],
|
|
29
|
-
});
|
|
25
|
+
const [visible,setVisible] = React.useState(controlled?controlledVisible:false)
|
|
26
|
+
const [value,setValue] = React.useState(defaultValue !== undefined? defaultValue:undefined);
|
|
30
27
|
contentContainerProps = defaultObj(contentContainerProps);
|
|
31
28
|
const prevLayout = React.usePrevious(layout);
|
|
32
29
|
filter = defaultFunc(filter,x=>true);
|
|
33
|
-
const {value,visible} = state;
|
|
34
30
|
compare = defaultFunc(compare,(a,b)=> a === b);
|
|
35
31
|
const prevValue = React.usePrevious(value,compare);
|
|
36
32
|
const selectedRef = React.useRef(undefined);
|
|
@@ -89,7 +85,6 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
|
|
|
89
85
|
items.push(mItem);
|
|
90
86
|
});
|
|
91
87
|
return items;
|
|
92
|
-
//return ({...state,value:currentSelectedValue,items});
|
|
93
88
|
},[menuItems])
|
|
94
89
|
React.useEffect(()=>{
|
|
95
90
|
if(compare(defaultValue == value)) return;
|
|
@@ -99,11 +94,14 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
|
|
|
99
94
|
if(update !== true && compare(value,node.value)) return;
|
|
100
95
|
selectedRef.current = node;
|
|
101
96
|
if(update === true){
|
|
102
|
-
const nState = {...state,value:node.value,visible:controlled?undefined:false};
|
|
103
97
|
if(controlled && onDismiss){
|
|
104
|
-
if(onDismiss(
|
|
98
|
+
if(onDismiss({visible,value,items,defaultValue},defaultObj(selectedRef.current)) === false) return;
|
|
99
|
+
}
|
|
100
|
+
setValue(node.value);
|
|
101
|
+
const vv = controlled?undefined:false;
|
|
102
|
+
if(typeof vv =='boolean' && vv !==visible){
|
|
103
|
+
setVisible(vv);
|
|
105
104
|
}
|
|
106
|
-
setState(nState);
|
|
107
105
|
}
|
|
108
106
|
}
|
|
109
107
|
const context = {};
|
|
@@ -117,7 +115,7 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
|
|
|
117
115
|
}
|
|
118
116
|
}
|
|
119
117
|
if(selectedRef.current !== undefined){
|
|
120
|
-
|
|
118
|
+
setValue(defaultValue);
|
|
121
119
|
}
|
|
122
120
|
}
|
|
123
121
|
context.getValue = ()=> value;
|
|
@@ -137,22 +135,22 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
|
|
|
137
135
|
if(!isEditable) return;
|
|
138
136
|
if(controlled){
|
|
139
137
|
if(onShow){
|
|
140
|
-
onShow(
|
|
138
|
+
onShow({visible,value,items,defaultValue});
|
|
141
139
|
}
|
|
142
140
|
return;
|
|
143
141
|
}
|
|
144
142
|
if(!visible){
|
|
145
|
-
|
|
143
|
+
setVisible(true);
|
|
146
144
|
}
|
|
147
145
|
}
|
|
148
146
|
const close = context.close = (args)=>{
|
|
149
147
|
if(controlled){
|
|
150
148
|
if(onDismiss){
|
|
151
|
-
onDismiss(
|
|
149
|
+
onDismiss({visible,value,items,defaultValue},defaultObj(selectedRef.current));
|
|
152
150
|
}
|
|
153
151
|
return false;
|
|
154
152
|
}
|
|
155
|
-
|
|
153
|
+
setVisible(false);
|
|
156
154
|
return false;
|
|
157
155
|
}
|
|
158
156
|
context.disable = ()=>{
|
|
@@ -191,7 +189,7 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
|
|
|
191
189
|
setLayout(layout);
|
|
192
190
|
if(controlled && onDismiss){
|
|
193
191
|
if(isDiff){
|
|
194
|
-
onDismiss(
|
|
192
|
+
onDismiss({visible,value,items,defaultValue},true);
|
|
195
193
|
}
|
|
196
194
|
}
|
|
197
195
|
};
|
|
@@ -324,7 +324,7 @@ const TextFieldComponent = React.forwardRef((componentProps,inputRef)=>{
|
|
|
324
324
|
const txt = defaultStr(text).trim();
|
|
325
325
|
if((txt.length <=1 && !error)){
|
|
326
326
|
if(validType.contains("unique") || validType.contains("required")){
|
|
327
|
-
callOnChange(txt);
|
|
327
|
+
callOnChange(toCase(txt));
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
if(props.onBlur){
|
|
@@ -388,9 +388,10 @@ const TextFieldComponent = React.forwardRef((componentProps,inputRef)=>{
|
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
|
-
|
|
391
|
+
const tVal = toCase(text2);
|
|
392
|
+
if(tVal !== text){
|
|
392
393
|
setText(text2,true);
|
|
393
|
-
callOnChange(
|
|
394
|
+
callOnChange(tVal);
|
|
394
395
|
}
|
|
395
396
|
},
|
|
396
397
|
selection,
|
|
@@ -5,7 +5,7 @@ import PropTypes from "prop-types";
|
|
|
5
5
|
import {defaultObj,defaultStr,defaultNumber,defaultBool} from "$cutils";
|
|
6
6
|
import View from "$ecomponents/View";
|
|
7
7
|
import { useNavigation} from '$cnavigation';
|
|
8
|
-
import Fab from "$
|
|
8
|
+
import Fab from "$layouts/Fab";
|
|
9
9
|
import APP from "$capp";
|
|
10
10
|
import AppBar,{createAppBarRef} from "$elayouts/AppBar";
|
|
11
11
|
import ErrorBoundary from "$ecomponents/ErrorBoundary";
|
|
@@ -205,7 +205,7 @@ export function renderActions({context,isUpdate,newElementLabel,makePhoneCallPr
|
|
|
205
205
|
flat : true,
|
|
206
206
|
onPress : createCallback({context:self,action:'makePhoneCall',force:true,callback:onPressToMakePhoneCall})
|
|
207
207
|
}:null,
|
|
208
|
-
copyToClipboard : (isUpdate)?{
|
|
208
|
+
copyToClipboard : (false && isUpdate)?{
|
|
209
209
|
text : 'Copier',
|
|
210
210
|
icon : COPY_ICON,
|
|
211
211
|
title : 'Copier',
|
package/src/navigation/utils.js
CHANGED
|
@@ -7,7 +7,9 @@ import {isNonNullString,defaultStr,defaultObj,isObj} from "$cutils";
|
|
|
7
7
|
|
|
8
8
|
export const tableDataRouteName = 'TableData';
|
|
9
9
|
|
|
10
|
-
export const
|
|
10
|
+
export const structDataRouteName = 'StructData';
|
|
11
|
+
|
|
12
|
+
const navigateToTableOrStructData = function(tableName,params,actionType){
|
|
11
13
|
if(isNonNullString(tableName)){
|
|
12
14
|
tableName = {tableName};
|
|
13
15
|
}
|
|
@@ -19,11 +21,11 @@ export const navigateToTableData = function(tableName,params,actionType){
|
|
|
19
21
|
if(!tableName) return;
|
|
20
22
|
const {perm} = params;
|
|
21
23
|
let isAllowed = true;
|
|
22
|
-
actionType = defaultStr(actionType,"tabledata").replaceAll(" ","").toLowerCase();
|
|
24
|
+
actionType = defaultStr(actionType,"tabledata").replaceAll("_","").replaceAll("-","").replaceAll(" ","").toLowerCase();
|
|
23
25
|
const isTableData = actionType =='tabledata';
|
|
24
26
|
if(isNonNullString(perm)){
|
|
25
27
|
isAllowed = Auth.isAllowedFromStr(perm)
|
|
26
|
-
} else if(actionType =='
|
|
28
|
+
} else if(actionType =='structdata') {
|
|
27
29
|
isAllowed = Auth.isStructDataAllowed({table:tableName})
|
|
28
30
|
} else if(isTableData){
|
|
29
31
|
isAllowed = Auth.isTableDataAllowed({table:tableName});
|
|
@@ -31,10 +33,18 @@ export const navigateToTableData = function(tableName,params,actionType){
|
|
|
31
33
|
if(!isAllowed){
|
|
32
34
|
return Auth.showError();
|
|
33
35
|
}
|
|
34
|
-
params.routeName = buildScreenRoute(tableName,tableDataRouteName);
|
|
36
|
+
params.routeName = buildScreenRoute(tableName,actionType =='structdata'? structDataRouteName : tableDataRouteName);
|
|
35
37
|
return navigate(params)
|
|
36
38
|
}
|
|
37
39
|
|
|
40
|
+
export const navigateToTableData = (tableName,params)=>{
|
|
41
|
+
return navigateToTableOrStructData(tableName,params,"tabledata");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const navigateToStructData = (tableName,params)=>{
|
|
45
|
+
return navigateToTableOrStructData(tableName,params,"structdata");
|
|
46
|
+
}
|
|
47
|
+
|
|
38
48
|
export const buildScreenRoute = function(tableName,parent){
|
|
39
49
|
if(isObj(tableName)){
|
|
40
50
|
tableName = defaultStr(tableName.tableName,tableName.table);
|
|
@@ -51,6 +61,11 @@ export const getTableDataRouteName = function(tableName){
|
|
|
51
61
|
return buildScreenRoute(tableName,tableDataRouteName);
|
|
52
62
|
}
|
|
53
63
|
|
|
64
|
+
export const getStructDataRouteName = function(tableName){
|
|
65
|
+
return buildScreenRoute(tableName,structDataRouteName);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export const getStructDataScreenName = getStructDataRouteName;
|
|
54
69
|
export const getTableDataScreenName = getTableDataRouteName;
|
|
55
70
|
|
|
56
71
|
/*** permet d'obtenir le lien vers l'écran table data permettant de lister les données de la table data */
|
|
@@ -58,6 +73,10 @@ export const getTableDataListRouteName = function(tableName){
|
|
|
58
73
|
return buildScreenRoute(tableName,tableDataRouteName+"/LIST/");
|
|
59
74
|
}
|
|
60
75
|
|
|
76
|
+
export const getStructDataListRouteName = function(tableName){
|
|
77
|
+
return buildScreenRoute(tableName,structDataRouteName+"/LIST/");
|
|
78
|
+
}
|
|
79
|
+
|
|
61
80
|
export const getTableDataListScreenName = getTableDataListRouteName;
|
|
62
81
|
|
|
63
82
|
export const navigateToTableDataList = function (tableName,params){
|
|
@@ -63,7 +63,9 @@ export default function ScreenWrapperNavComponent(_props){
|
|
|
63
63
|
},[]);
|
|
64
64
|
setScreenOptions(options);
|
|
65
65
|
const allowDrawer = typeof options.allowDrawer ==='boolean'? options.allowDrawer : typeof options.withDrawer =='boolean'? options.withDrawer : typeof Screen.allowDrawer =='boolean'? Screen.allowDrawer : typeof Screen.withDrawer =='boolean' ? Screen.withDrawer : Screen.isModalScreen == true ? false : true;
|
|
66
|
+
const withFab = typeof options.withFab ==='boolean' ? options.withFab : typeof Screen.withFab =='boolean'? Screen.withFab : allowDrawer;
|
|
66
67
|
return <Screen
|
|
68
|
+
withFab = {withFab}
|
|
67
69
|
{...rest}
|
|
68
70
|
key = {sanitizedName}
|
|
69
71
|
authRequired={authRequired||allowDrawer}
|