@fto-consult/expo-ui 2.14.1 → 2.14.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.
package/package.json
CHANGED
|
@@ -17,8 +17,8 @@ const DatagridRenderTypeComponent = (props)=>{
|
|
|
17
17
|
const isDesk = isDesktopMedia();
|
|
18
18
|
let type = defaultStr(get(typeKey),isDesk? "fixed":'accordion').toLowerCase().trim();
|
|
19
19
|
const rTypes = [
|
|
20
|
-
{...getActiveProps(type,'accordion'),
|
|
21
|
-
{...getActiveProps(type,'table'),
|
|
20
|
+
{...getActiveProps(type,'accordion'),tooltip:"Les éléments de liste s'affichent de manière optimisé pour téléphone mobile",code:'accordion',icon:accordionIcon,label:'Mobile',labelText:'environnement optimisé pour téléphone mobile'},
|
|
21
|
+
{...getActiveProps(type,'table'),tooltip:"Les éléments de listes s'affichent dans un tableau rééel",code:'table',icon:tableIcon,label:'Tableau réel avec pagination'}
|
|
22
22
|
]
|
|
23
23
|
Object.map(rendersTypes,(t,i)=>{
|
|
24
24
|
if(isObj(t)){
|
|
@@ -37,10 +37,10 @@ const DatagridRenderTypeComponent = (props)=>{
|
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
return <Menu
|
|
40
|
-
|
|
40
|
+
tooltip = {"Type d'affichage du tableau"}
|
|
41
41
|
sheet
|
|
42
42
|
items = {rTypes}
|
|
43
|
-
anchor = {(props)=><Icon {...props} name = {typeObj.icon}
|
|
43
|
+
anchor = {(props)=><Icon {...props} name = {typeObj.icon} tooltip={typeObj.tooltip}/>}
|
|
44
44
|
onPressItem = {({item})=>{
|
|
45
45
|
if(isObj(item) && item.code){
|
|
46
46
|
set(typeKey,item.code);
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @see :
|
|
7
7
|
*/
|
|
8
8
|
import Datagrid from "./IndexComponent";
|
|
9
|
-
import {defaultStr,defaultObj,defaultVal,isObjOrArray,isObj,extendObj} from "$utils";
|
|
9
|
+
import {defaultStr,defaultObj,defaultVal,isNonNullString,defaultNumber,isObjOrArray,isObj,extendObj} from "$utils";
|
|
10
10
|
import {Pressable} from "react-native";
|
|
11
11
|
import SimpleSelect from "$ecomponents/SimpleSelect";
|
|
12
12
|
import React from "$react";
|
|
@@ -27,6 +27,26 @@ import PropTypes from "prop-types";
|
|
|
27
27
|
import {isDesktopMedia} from "$dimensions";
|
|
28
28
|
import ActivityIndicator from "$ecomponents/ActivityIndicator";
|
|
29
29
|
import {Menu} from "$ecomponents/BottomSheet";
|
|
30
|
+
import session from "$session";
|
|
31
|
+
|
|
32
|
+
export const getSessionKey = ()=>{
|
|
33
|
+
return Auth.getSessionKey("swrDatagrid");
|
|
34
|
+
}
|
|
35
|
+
export const getSessionData = (key)=>{
|
|
36
|
+
const data = defaultObj(session.get(getSessionKey()));
|
|
37
|
+
return isNonNullString(key) ? data[key.trim()] : data;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const setSessionData = (key,value)=>{
|
|
41
|
+
const d = getSessionData();
|
|
42
|
+
if(isObj(key)){
|
|
43
|
+
return session.set(getSessionKey(),extendObj({},d,key));
|
|
44
|
+
}
|
|
45
|
+
d[key] = value;
|
|
46
|
+
return session.set(getSessionKey(),d);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
30
50
|
|
|
31
51
|
const timeout = 5000*60*60;
|
|
32
52
|
export const swrOptions = {
|
|
@@ -110,7 +130,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
|
110
130
|
const totalRef = React.useRef(0);
|
|
111
131
|
const isFetchingRef = React.useRef(false);
|
|
112
132
|
const pageRef = React.useRef(1);
|
|
113
|
-
const limitRef = React.useRef(500);
|
|
133
|
+
const limitRef = React.useRef(defaultNumber(getSessionData("limit"),500));
|
|
114
134
|
const isInitializedRef = React.useRef(false);
|
|
115
135
|
testID = defaultStr(testID,"RNSWRDatagridComponent")
|
|
116
136
|
const {error, isValidating,isLoading,refresh} = useSWR(fetchPath,{
|
|
@@ -268,6 +288,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
|
268
288
|
onPress : ()=>{
|
|
269
289
|
if(item == limitRef.current) return;
|
|
270
290
|
limitRef.current = item;
|
|
291
|
+
setSessionData("limit",limitRef.current);
|
|
271
292
|
pageRef.current = firstPage;
|
|
272
293
|
setTimeout(() => {
|
|
273
294
|
doRefresh(true);
|
|
@@ -339,7 +360,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
|
339
360
|
</View>
|
|
340
361
|
</View>
|
|
341
362
|
}}
|
|
342
|
-
ListFooterComponent = {(props)=>{
|
|
363
|
+
/*ListFooterComponent = {(props)=>{
|
|
343
364
|
const r = typeof ListFooterComponent =='function'? ListFooterComponent(props) : null;
|
|
344
365
|
if(!loading) return r;
|
|
345
366
|
const aContent = <View testID={testID+"_ListHeaderActivityIndicator"} style={[theme.styles.w100,theme.styles.justifyContentCenter]}>
|
|
@@ -352,7 +373,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
|
352
373
|
</View>
|
|
353
374
|
}
|
|
354
375
|
return aContent;
|
|
355
|
-
}}
|
|
376
|
+
}}*/
|
|
356
377
|
handleQueryLimit = {false}
|
|
357
378
|
handlePagination = {false}
|
|
358
379
|
autoSort = {canSortRemotely()? false : true}
|