@fto-consult/expo-ui 2.14.2 → 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
|
@@ -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);
|