@fto-consult/expo-ui 2.26.9 → 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,7 +128,11 @@ 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
138
|
const dataRef = React.useRef([]);
|
|
@@ -241,6 +247,26 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
|
241
247
|
}
|
|
242
248
|
const loading = (isLoading|| isValidating);
|
|
243
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
|
+
});
|
|
244
270
|
return (
|
|
245
271
|
<Datagrid
|
|
246
272
|
testID = {testID}
|
|
@@ -274,22 +300,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
|
274
300
|
</Pressable>
|
|
275
301
|
}}
|
|
276
302
|
title = {'Limite du nombre d\'éléments par page'}
|
|
277
|
-
items = {
|
|
278
|
-
return {
|
|
279
|
-
text : item.formatNumber(),
|
|
280
|
-
icon : limitRef.current == item ? 'check' : null,
|
|
281
|
-
primary : limitRef.current === item ? true : false,
|
|
282
|
-
onPress : ()=>{
|
|
283
|
-
if(item == limitRef.current) return;
|
|
284
|
-
limitRef.current = item;
|
|
285
|
-
setSessionData("limit",limitRef.current);
|
|
286
|
-
pageRef.current = firstPage;
|
|
287
|
-
setTimeout(() => {
|
|
288
|
-
doRefresh(true);
|
|
289
|
-
}, (500));
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
})}
|
|
303
|
+
items = {itLimits}
|
|
293
304
|
/>
|
|
294
305
|
<Icon
|
|
295
306
|
///firstPage
|
|
@@ -320,7 +331,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
|
320
331
|
/>
|
|
321
332
|
<View testID={testID+"_PaginationLabel"}>
|
|
322
333
|
<Label style={{fontSize:15}}>
|
|
323
|
-
{page.formatNumber()}-{totalPages.formatNumber()}{" / "}{totalRef.current.formatNumber()}
|
|
334
|
+
{(totalRef.current?page:0).formatNumber()}-{totalPages.formatNumber()}{" / "}{totalRef.current.formatNumber()}
|
|
324
335
|
</Label>
|
|
325
336
|
</View>
|
|
326
337
|
<Icon
|
|
@@ -413,6 +424,7 @@ SWRDatagridComponent.displayName = "SWRDatagridComponent";
|
|
|
413
424
|
SWRDatagridComponent.propTypes = {
|
|
414
425
|
...Datagrid.propTypes,
|
|
415
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
|
|
416
428
|
fetchData : PropTypes.func,
|
|
417
429
|
table : PropTypes.shape({
|
|
418
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
|
}
|