@fto-consult/expo-ui 7.18.1 → 7.19.1

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "7.18.1",
3
+ "version": "7.19.1",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "scripts": {
6
6
  "clear-npx-cache": "npx clear-npx-cache",
@@ -72,7 +72,7 @@
72
72
  "@expo/vector-icons": "^13.0.0",
73
73
  "@faker-js/faker": "^8.0.2",
74
74
  "@fto-consult/common": "^4.4.0",
75
- "@fto-consult/electron-gen": "^2.2.1",
75
+ "@fto-consult/electron-gen": "^2.3.0",
76
76
  "@fto-consult/expo-ui": "^7.17.9",
77
77
  "@pchmn/expo-material3-theme": "^1.3.1",
78
78
  "@react-native-async-storage/async-storage": "1.18.2",
@@ -4175,6 +4175,7 @@ CommonDatagridComponent.propTypes = {
4175
4175
  aggregatorFunction : PropTypes.string,
4176
4176
  /*** permet de faire une mutation sur les options de la recherche, immédiatement avant le lancement de la recherche */
4177
4177
  fetchOptionsMutator : PropTypes.func,
4178
+ fetchOptions : PropTypes.object,
4178
4179
  resetSessionData : PropTypes.bool, //pour forcer la réinitialisation des données de sessions liés à la table data
4179
4180
  /*** si les données à récupérer à distance seront */
4180
4181
  fetchOnlyVisibleColumns : PropTypes.bool,
@@ -81,10 +81,12 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
81
81
  isLoading : customIsLoading,
82
82
  icon : cIcon,
83
83
  swrOptions,
84
+ pagination,
84
85
  ...rest
85
86
  } = props;
86
87
  const screenContext = useScreen();
87
88
  rest = defaultObj(rest);
89
+ pagination = defaultObj(pagination);
88
90
  rest.exportTableProps = defaultObj(rest.exportTableProps)
89
91
  const firstPage = 1;
90
92
  const tableName = defaultStr(table?.tableName,table?.table).trim().toUpperCase();
@@ -94,7 +96,8 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
94
96
  const sColumn = defaultStr(sort.column,defaultSortColumn);
95
97
  if(sColumn){
96
98
  sort.column = sColumn;
97
- if(defaultSortOrder =='asc' || defaultSortOrder =='desc'){
99
+ sort.dir = defaultStr(sort.dir).toLowerCase().trim();
100
+ if(!['asc','desc'].includes(sort.dir) && ['asc','desc'].includes(defaultSortOrder)){
98
101
  sort.dir = defaultSortOrder;
99
102
  }
100
103
  } else {
@@ -133,7 +136,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
133
136
  },rest.exportTableProps.pdf);
134
137
  const fetchOptionsRef = React.useRef({});
135
138
  const isFetchPathNull = fetchPath === null || fetchPath ===false;
136
- const fPathRef = React.useRef(defaultStr(fetchPathKey,uniqid("fetchPath")));
139
+ const fPathRef = React.useRef(defaultStr(fetchPathKey,"defaultFetchPathKey"));
137
140
  fetchPath = defaultStr(fetchPath,table?.queryPath,tableName.toLowerCase()).trim();
138
141
  if(fetchPath){
139
142
  fetchPath = setQueryParams(fetchPath,"SWRFetchPathKey",fPathRef.current)
@@ -142,10 +145,10 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
142
145
  const innerRef = React.useRef(null);
143
146
  const showProgressRef = React.useRef(true);
144
147
  const forceRefreshRef = React.useRef(true);
145
- const pageRef = React.useRef(1);
148
+ const pageRef = React.useRef(defaultNumber(pagination.start,1));
146
149
  const canHandlePagination = handlePagination !== false ? true : false;
147
150
  const canHandleLimit = handleQueryLimit !== false && canHandlePagination ? true : false;
148
- const limitRef = React.useRef(!canHandleLimit ?0 : defaultNumber(getSessionData("limit"),500));
151
+ const limitRef = React.useRef(!canHandleLimit ?0 : defaultNumber(getSessionData("limit"),pagination.limit,500));
149
152
  const isInitializedRef = React.useRef(false);
150
153
  const hasFetchedRef = React.useRef(false);
151
154
  swrOptions = defaultObj(swrOptions);
@@ -110,8 +110,12 @@ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,swrOptions,fore
110
110
  const fetchItemsRef = React.useRef(customFetchItem);
111
111
  fetchItemsRef.current = customFetchItem;
112
112
  swrOptions = Object.assign({},swrOptions);
113
- if(isFilter){
113
+ ///@see : https://swr.vercel.app/docs/revalidation#disable-automatic-revalidations
114
+ if(isFilter || isDisabled){
114
115
  swrOptions.refreshInterval = 0;
116
+ swrOptions.revalidateOnFocus = false;
117
+ swrOptions.revalidateIfStale = false;
118
+ swrOptions.revalidateOnReconnect = false;
115
119
  }
116
120
  const restOptionsRef = React.useRef({});
117
121
  const fetchedResultRef = React.useRef({});
@@ -1,12 +1,8 @@
1
1
  module.exports = {
2
2
  "@fto-consult/expo-ui": {
3
- "name": "@fto-consult/expo-ui",
4
3
  "version": "7.17.9",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/borispipo/expo-ui.git"
8
- },
9
- "homepage": "https://github.com/borispipo/expo-ui#readme"
4
+ "url": "https://github.com/borispipo/expo-ui#readme",
5
+ "license": "ISC"
10
6
  },
11
7
  "@babel/plugin-proposal-export-namespace-from": {
12
8
  "version": "7.18.9",
@@ -49,12 +45,12 @@ module.exports = {
49
45
  "license": "MIT"
50
46
  },
51
47
  "@fto-consult/common": {
52
- "version": "4.2.1",
48
+ "version": "4.4.0",
53
49
  "url": "https://github.com/borispipo/common#readme",
54
50
  "license": "ISC"
55
51
  },
56
52
  "@fto-consult/electron-gen": {
57
- "version": "2.2.1",
53
+ "version": "2.3.0",
58
54
  "license": "ISC"
59
55
  },
60
56
  "@pchmn/expo-material3-theme": {