@fto-consult/expo-ui 2.26.8 → 2.26.10
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/babel.config.alias.js
CHANGED
|
@@ -24,7 +24,7 @@ module.exports = (opts)=>{
|
|
|
24
24
|
r["$mainScreens"] = r["$mainScreens"] || r["$emainScreens"];
|
|
25
25
|
r["$escreen"] = r["$eScreen"] = path.resolve(expo,"layouts/Screen");
|
|
26
26
|
r["$eTableDataScreen"] = path.resolve(expo,"layouts","Screen","TableData");
|
|
27
|
-
r["$TableDataScreen"] = r["$TableDataScreen"] || r["$eTableDataScreen"]
|
|
27
|
+
r["$TableDataScreen"] = r["$tableDataScreen"] = r["$TableDataScreen"] || r["$tableDataScreen"] || r["$eTableDataScreen"]
|
|
28
28
|
r["$eassets"] = path.resolve(dir,"assets");
|
|
29
29
|
r["$ethemeSelectorComponent"] = path.resolve(expo,"auth","ThemeSelector");
|
|
30
30
|
/*** le composant permettant de sélectionner un theme utilisateur */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fto-consult/expo-ui",
|
|
3
|
-
"version": "2.26.
|
|
3
|
+
"version": "2.26.10",
|
|
4
4
|
"description": "Bibliothèque de composants UI Expo,react-native",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@emotion/native": "^11.10.0",
|
|
62
62
|
"@expo/html-elements": "^0.2.0",
|
|
63
63
|
"@expo/vector-icons": "^13.0.0",
|
|
64
|
-
"@fto-consult/common": "^1.24.
|
|
64
|
+
"@fto-consult/common": "^1.24.16",
|
|
65
65
|
"@gorhom/portal": "^1.0.14",
|
|
66
66
|
"@react-native-async-storage/async-storage": "~1.17.3",
|
|
67
67
|
"@react-native-community/datetimepicker": "6.5.2",
|
|
@@ -14,6 +14,7 @@ import Auth from "$cauth";
|
|
|
14
14
|
import DateLib from "$lib/date";
|
|
15
15
|
import {getFetchOptions} from "$cutils/filters";
|
|
16
16
|
import {setQueryParams} from "$cutils/uri";
|
|
17
|
+
import {uniqid} from "$utils";
|
|
17
18
|
import { getFetcherOptions } from "$capi/fetch";
|
|
18
19
|
import Icon from "$ecomponents/Icon";
|
|
19
20
|
import Label from "$ecomponents/Label";
|
|
@@ -79,6 +80,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
|
79
80
|
makePhoneCallProps,
|
|
80
81
|
fetchData,
|
|
81
82
|
fetchPath,
|
|
83
|
+
fetchPathKey,
|
|
82
84
|
fetcher,
|
|
83
85
|
ListFooterComponent,
|
|
84
86
|
testID,
|
|
@@ -126,10 +128,14 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
|
126
128
|
},rest.exportTableProps.pdf);
|
|
127
129
|
const fetchOptionsRef = React.useRef(defaultObj(customFetchOptions));
|
|
128
130
|
const refreshCBRef = React.useRef(null);
|
|
131
|
+
const fPathRef = React.useRef(defaultStr(fetchPathKey,uniqid("fetchPath")));
|
|
129
132
|
fetchPath = defaultStr(fetchPath,table.queryPath,tableName.toLowerCase()).trim();
|
|
133
|
+
if(fetchPath){
|
|
134
|
+
fetchPath = setQueryParams(fetchPath,fPathRef.current,fPathRef.current)
|
|
135
|
+
}
|
|
130
136
|
const innerRef = React.useRef(null);
|
|
131
137
|
const showProgressRef = React.useRef(true);
|
|
132
|
-
const dataRef = React.useRef(
|
|
138
|
+
const dataRef = React.useRef([]);
|
|
133
139
|
const hasResultRef = React.useRef(false);
|
|
134
140
|
const totalRef = React.useRef(0);
|
|
135
141
|
const isFetchingRef = React.useRef(false);
|
|
@@ -160,13 +166,6 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
|
160
166
|
}
|
|
161
167
|
const fetchCB = ({data,total})=>{
|
|
162
168
|
totalRef.current = total;
|
|
163
|
-
/***
|
|
164
|
-
* if(pageRef.current ===firstPage){
|
|
165
|
-
dataRef.current = data;
|
|
166
|
-
} else {
|
|
167
|
-
dataRef.current = prevPage != pageRef.current ? (isObj(data)?{...dataRef.current,...data}:[...dataRef.current,...data]) : data;
|
|
168
|
-
}
|
|
169
|
-
*/
|
|
170
169
|
dataRef.current = data;
|
|
171
170
|
hasResultRef.current = true;
|
|
172
171
|
if(onFetchData && typeof onFetchData =='function'){
|
|
@@ -205,7 +204,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
|
205
204
|
},[isValidating,isLoading])
|
|
206
205
|
const doRefresh = (showProgress)=>{
|
|
207
206
|
showProgressRef.current = showProgress ? typeof showProgress ==='boolean' : false;
|
|
208
|
-
|
|
207
|
+
if(isFetchingRef.current) return;
|
|
209
208
|
refreshCBRef.current = ()=>{
|
|
210
209
|
//showProgressRef.current = false;
|
|
211
210
|
};
|
|
@@ -248,6 +247,26 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
|
248
247
|
}
|
|
249
248
|
const loading = (isLoading|| isValidating);
|
|
250
249
|
const pointerEvents = loading ?"node" : "auto";
|
|
250
|
+
const itLimits = [{
|
|
251
|
+
text : "Limite nbre elts par page",
|
|
252
|
+
divider : true,
|
|
253
|
+
}]
|
|
254
|
+
getDefaultPaginationRowsPerPageItems().map((item)=>{
|
|
255
|
+
itLimits.push({
|
|
256
|
+
text : item.formatNumber(),
|
|
257
|
+
icon : limitRef.current == item ? 'check' : null,
|
|
258
|
+
primary : limitRef.current === item ? true : false,
|
|
259
|
+
onPress : ()=>{
|
|
260
|
+
if(item == limitRef.current) return;
|
|
261
|
+
limitRef.current = item;
|
|
262
|
+
setSessionData("limit",limitRef.current);
|
|
263
|
+
pageRef.current = firstPage;
|
|
264
|
+
setTimeout(() => {
|
|
265
|
+
doRefresh(true);
|
|
266
|
+
}, (500));
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
});
|
|
251
270
|
return (
|
|
252
271
|
<Datagrid
|
|
253
272
|
testID = {testID}
|
|
@@ -281,22 +300,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
|
281
300
|
</Pressable>
|
|
282
301
|
}}
|
|
283
302
|
title = {'Limite du nombre d\'éléments par page'}
|
|
284
|
-
items = {
|
|
285
|
-
return {
|
|
286
|
-
text : item.formatNumber(),
|
|
287
|
-
icon : limitRef.current == item ? 'check' : null,
|
|
288
|
-
primary : limitRef.current === item ? true : false,
|
|
289
|
-
onPress : ()=>{
|
|
290
|
-
if(item == limitRef.current) return;
|
|
291
|
-
limitRef.current = item;
|
|
292
|
-
setSessionData("limit",limitRef.current);
|
|
293
|
-
pageRef.current = firstPage;
|
|
294
|
-
setTimeout(() => {
|
|
295
|
-
doRefresh(true);
|
|
296
|
-
}, (500));
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
})}
|
|
303
|
+
items = {itLimits}
|
|
300
304
|
/>
|
|
301
305
|
<Icon
|
|
302
306
|
///firstPage
|
|
@@ -327,7 +331,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
|
327
331
|
/>
|
|
328
332
|
<View testID={testID+"_PaginationLabel"}>
|
|
329
333
|
<Label style={{fontSize:15}}>
|
|
330
|
-
{page.formatNumber()}-{totalPages.formatNumber()}{" / "}{totalRef.current.formatNumber()}
|
|
334
|
+
{(totalRef.current?page:0).formatNumber()}-{totalPages.formatNumber()}{" / "}{totalRef.current.formatNumber()}
|
|
331
335
|
</Label>
|
|
332
336
|
</View>
|
|
333
337
|
<Icon
|
|
@@ -420,6 +424,7 @@ SWRDatagridComponent.displayName = "SWRDatagridComponent";
|
|
|
420
424
|
SWRDatagridComponent.propTypes = {
|
|
421
425
|
...Datagrid.propTypes,
|
|
422
426
|
fetchPath : PropTypes.string,
|
|
427
|
+
fetchPathKey : PropTypes.string,//la clé permettant de suffixer l'url fecherPath afin que ce ne soit pas unique pour certaines tables
|
|
423
428
|
fetchData : PropTypes.func,
|
|
424
429
|
table : PropTypes.shape({
|
|
425
430
|
tableName : PropTypes.string,
|
|
@@ -19,6 +19,7 @@ import defaultKeyboardEvents from "../utils/keyboardEvents";
|
|
|
19
19
|
import sprintf from "./sprintf";
|
|
20
20
|
import ErrorMessage from "$ecomponents/ErrorBoundary/ErrorMessage";
|
|
21
21
|
import { UPPER_CASE, LOWER_CASE} from "$common/lib/validator";
|
|
22
|
+
import Label from "$components/Label";
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
export default class Field extends AppComponent {
|
|
@@ -904,6 +905,9 @@ export default class Field extends AppComponent {
|
|
|
904
905
|
const renderRigth = (props)=>{
|
|
905
906
|
let right = null;
|
|
906
907
|
let cRight = typeof customRight ==='function'? customRight(props) : customRight;
|
|
908
|
+
if(typeof cRight ==='number' || typeof cRight =="string"){
|
|
909
|
+
cRight = <Label {...props}>{cRight}</Label>
|
|
910
|
+
}
|
|
907
911
|
if(!React.isValidElement(cRight)){
|
|
908
912
|
cRight = null;
|
|
909
913
|
}
|
|
@@ -207,7 +207,7 @@ export default class FormDataComponent extends AppComponent{
|
|
|
207
207
|
delete rest.filter;
|
|
208
208
|
}
|
|
209
209
|
if(name){
|
|
210
|
-
rest.defaultValue = useDefaultValueFromData === false ? defaultValue : (name in data && data[name] !== undefined? data[name]: defaultValue);
|
|
210
|
+
rest.defaultValue = useDefaultValueFromData === false ? defaultValue : (name in data && data[name] !== undefined && data[name] !== null? data[name]: defaultValue);
|
|
211
211
|
if((type == 'selecttabledata' || type == 'datafile')){
|
|
212
212
|
rest._defaultValue = data[rest.name];
|
|
213
213
|
}
|
|
@@ -10,6 +10,7 @@ import {currencies} from "$ccurrency";
|
|
|
10
10
|
import { Pressable } from "react-native";
|
|
11
11
|
import {styles} from "$theme";
|
|
12
12
|
import appConfig from "$app/config";
|
|
13
|
+
import PropTypes from "prop-types";
|
|
13
14
|
|
|
14
15
|
const CurrencySelector = React.forwardRef((props,ref)=>{
|
|
15
16
|
return <SimpleSelect ref={ref} {...selectCurrencyFieldProps(props)}/>
|
|
@@ -22,10 +23,10 @@ export default CurrencySelector;
|
|
|
22
23
|
export const currencyFormatRef = React.createRef(null);
|
|
23
24
|
|
|
24
25
|
/*** onAdd est appelé lorsqu'on ajoute un format personalisé */
|
|
25
|
-
export const selectCurrencyFieldProps = ({right,disabled,readOnly,isFilter,onChange,onBlur,editable,...props})=>{
|
|
26
|
+
export const selectCurrencyFieldProps = ({right,disabled,readOnly,onFormatChange,isFilter,onChange,onBlur,editable,...props})=>{
|
|
26
27
|
const isEditable = disabled !== true && readOnly !== true && editable !== false;
|
|
27
28
|
const currency = appConfig.currency;
|
|
28
|
-
currencyFormatRef.current = defaultStr(currencyFormatRef.current,appConfig.currencyFormat,"%v%s");
|
|
29
|
+
currencyFormatRef.current = defaultStr(currencyFormatRef.current,appConfig.currencyFormat,"%v %s");
|
|
29
30
|
const iconSize = 25;
|
|
30
31
|
return {
|
|
31
32
|
items : currencies,
|
|
@@ -83,8 +84,11 @@ export const selectCurrencyFieldProps = ({right,disabled,readOnly,isFilter,onCha
|
|
|
83
84
|
containerProps = {{
|
|
84
85
|
width:70,
|
|
85
86
|
}}
|
|
86
|
-
onChange = {(
|
|
87
|
-
currencyFormatRef.current = value;
|
|
87
|
+
onChange = {(args)=>{
|
|
88
|
+
currencyFormatRef.current = args.value;
|
|
89
|
+
if(typeof onFormatChange =="function"){
|
|
90
|
+
onFormatChange(args)
|
|
91
|
+
}
|
|
88
92
|
}}
|
|
89
93
|
/>
|
|
90
94
|
</Pressable>
|
|
@@ -97,4 +101,5 @@ export const selectCurrencyFieldProps = ({right,disabled,readOnly,isFilter,onCha
|
|
|
97
101
|
|
|
98
102
|
CurrencySelector.propTypes = {
|
|
99
103
|
...SimpleSelect.propTypes,
|
|
104
|
+
onFormatChange : PropTypes.func,//lorsque le format de la currency change
|
|
100
105
|
}
|