@fto-consult/expo-ui 6.7.2 → 6.8.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 +1 -1
- package/src/components/AppBar/Content.js +1 -1
- package/src/components/AppBar/index.js +4 -2
- package/src/components/Datagrid/Test/accordion.js +80 -0
- package/src/components/Datagrid/Test/data.json +1 -0
- package/src/components/Datagrid/Test/fields.js +150 -0
- package/src/components/Datagrid/Test/index.js +10 -0
- package/src/components/Datagrid/Test/multiplicater.js +7 -0
- package/src/components/Drawer/index.js +8 -4
- package/src/components/Table/List/index.js +0 -1
- package/src/layouts/AppBar/index.js +47 -32
- package/src/navigation/Drawer/index.js +14 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
// Copyright 2023 @fto-consult/Boris Fouomene. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style
|
|
3
|
+
// license that can be found in the LICENSE file.
|
|
4
|
+
import i18n from "$i18n";
|
|
5
|
+
export default {
|
|
6
|
+
type : {
|
|
7
|
+
text : 'Type',
|
|
8
|
+
type : 'select',
|
|
9
|
+
required : true,
|
|
10
|
+
width : 150,
|
|
11
|
+
items : {
|
|
12
|
+
PSA : {code:'PSA',index:0,piece:'RVE',label:i18n.lang("payments_sales","Vente")},
|
|
13
|
+
PPU : {code:'PPU',index:0,piece:'RAC',label:i18n.lang("payments_purchases","Achat")},
|
|
14
|
+
PIN : {code:'PIN',index : 0,piece:'REN', label:i18n.lang("payments_increases","Encaissement")},
|
|
15
|
+
PDE : {code:'PDE',index:0,piece:'RDE',label:i18n.lang("payments_decreases","Décaissement")},
|
|
16
|
+
PTR : {code:'PTR',index:0,piece:'RTR',label:i18n.lang("payments_transfers","Transfert")},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
date : {
|
|
20
|
+
text : 'Date',
|
|
21
|
+
tooltip : 'La date',
|
|
22
|
+
type : 'date',
|
|
23
|
+
defaultValue : new Date(),
|
|
24
|
+
},
|
|
25
|
+
from : {
|
|
26
|
+
tooltip : 'Le compte source',
|
|
27
|
+
idfield : 'code',
|
|
28
|
+
//le point d'origine
|
|
29
|
+
text : 'Du/De',
|
|
30
|
+
},
|
|
31
|
+
to : {
|
|
32
|
+
idfield : 'code',
|
|
33
|
+
tooltip : 'Le compte destination',
|
|
34
|
+
text : 'Au/A',
|
|
35
|
+
},
|
|
36
|
+
amount : {
|
|
37
|
+
text : 'Montant',
|
|
38
|
+
type : 'number',
|
|
39
|
+
format : 'money',
|
|
40
|
+
defaultValue : 0,
|
|
41
|
+
},
|
|
42
|
+
mode : {
|
|
43
|
+
type : 'selectstructdata',
|
|
44
|
+
text : 'Mode',
|
|
45
|
+
tableName : 'payments_methods',
|
|
46
|
+
required : true,
|
|
47
|
+
defaultValue : 'ESPECE',
|
|
48
|
+
},
|
|
49
|
+
cost : {
|
|
50
|
+
text : 'Coût',
|
|
51
|
+
type : 'number',
|
|
52
|
+
format : 'money',
|
|
53
|
+
defaultValue : 0,
|
|
54
|
+
validType : 'numberGreaterThanOrEquals[0]',
|
|
55
|
+
},
|
|
56
|
+
totalAmount : {
|
|
57
|
+
text : 'Montant Total',
|
|
58
|
+
type : 'number',
|
|
59
|
+
format : 'money',
|
|
60
|
+
defaultValue : 0,
|
|
61
|
+
form : false,
|
|
62
|
+
},
|
|
63
|
+
imputedAmount : {
|
|
64
|
+
text : 'Montant Imputé',
|
|
65
|
+
form : false,
|
|
66
|
+
type : 'number',
|
|
67
|
+
format : 'money',
|
|
68
|
+
import : false,
|
|
69
|
+
},
|
|
70
|
+
restToImpute :{
|
|
71
|
+
text : 'Reste à Imputer',
|
|
72
|
+
form : false,
|
|
73
|
+
type : 'number',
|
|
74
|
+
format : 'money',
|
|
75
|
+
import : false,
|
|
76
|
+
},
|
|
77
|
+
code : {
|
|
78
|
+
text : 'Numéro/pièce',
|
|
79
|
+
type : 'piece',
|
|
80
|
+
tableName : 'PAYMENTS',
|
|
81
|
+
dbName : 'default',
|
|
82
|
+
piece : '',
|
|
83
|
+
width : 200,
|
|
84
|
+
},
|
|
85
|
+
reference : {
|
|
86
|
+
tooltip : 'La référence ',
|
|
87
|
+
text : 'Référence',
|
|
88
|
+
width : 300,
|
|
89
|
+
sortable : false,
|
|
90
|
+
filter : false,
|
|
91
|
+
import : false,
|
|
92
|
+
},
|
|
93
|
+
category : {
|
|
94
|
+
text : 'Catégorie',
|
|
95
|
+
type : 'selectStructData',
|
|
96
|
+
table : 'payments_categories',
|
|
97
|
+
width : 200
|
|
98
|
+
},
|
|
99
|
+
label : {
|
|
100
|
+
text : 'Objet/Motif',
|
|
101
|
+
tooltip : "L'objet ou le motif du règlement",
|
|
102
|
+
format : 'hashtag',
|
|
103
|
+
maxLength : 500,
|
|
104
|
+
rows : 1,
|
|
105
|
+
width : 300
|
|
106
|
+
},
|
|
107
|
+
approved : {
|
|
108
|
+
type : 'switch',
|
|
109
|
+
form : false,
|
|
110
|
+
width : 100,
|
|
111
|
+
text : 'Approuvé',
|
|
112
|
+
defaultValue : 0,
|
|
113
|
+
checkedTooltip : 'Oui',
|
|
114
|
+
uncheckedTooltip : 'Non'
|
|
115
|
+
},
|
|
116
|
+
transferredAmount : {
|
|
117
|
+
text : 'Montant transféré',
|
|
118
|
+
title : "Le montant transféré dans le fichier de donné, si le document a été transféré",
|
|
119
|
+
type : "number",
|
|
120
|
+
format : 'money',
|
|
121
|
+
visible : false,
|
|
122
|
+
form : false,
|
|
123
|
+
},
|
|
124
|
+
netAmount : {
|
|
125
|
+
text : 'Montant net',
|
|
126
|
+
title : "Le montant net représente la différence entre le montant réglé et le montant transféré",
|
|
127
|
+
type : "number",
|
|
128
|
+
format : 'money',
|
|
129
|
+
visible : false,
|
|
130
|
+
filter : false,
|
|
131
|
+
sortable : false,
|
|
132
|
+
form : false,
|
|
133
|
+
},
|
|
134
|
+
tags : {
|
|
135
|
+
text : 'Etiquettes',
|
|
136
|
+
type : 'selectstructdata',
|
|
137
|
+
table : 'tags',
|
|
138
|
+
multiple : true,
|
|
139
|
+
display : 'tags',
|
|
140
|
+
width : 200
|
|
141
|
+
},
|
|
142
|
+
comment : {
|
|
143
|
+
text : 'Note complémentaire',
|
|
144
|
+
tootile : 'Note complémentaire au règlement',
|
|
145
|
+
maxLength : 120,
|
|
146
|
+
format : 'hashtag',
|
|
147
|
+
rows : 1,
|
|
148
|
+
width : 200
|
|
149
|
+
},
|
|
150
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Copyright 2022 @fto-consult/Boris Fouomene. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style
|
|
3
|
+
// license that can be found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import fields from "./fields";
|
|
6
|
+
import Table from "../Table";
|
|
7
|
+
const data = require("./data.json");
|
|
8
|
+
export default function TestDatagridComponent({...props}){
|
|
9
|
+
return <Table columns={fields} data={data.docs} {...props}/>
|
|
10
|
+
}
|
|
@@ -140,6 +140,10 @@ const DrawerComponent = React.forwardRef((props,ref)=>{
|
|
|
140
140
|
}
|
|
141
141
|
setState(nS);
|
|
142
142
|
}
|
|
143
|
+
context.getPosition = ()=>position;
|
|
144
|
+
context.hasLeftPositon = ()=> position === DRAWER_POSITIONS.left;
|
|
145
|
+
context.hasRightPosition = ()=> position === DRAWER_POSITIONS.right;
|
|
146
|
+
context.isLeftPosition = ()=> isLeftPosition;
|
|
143
147
|
context.canToggle = x=> canHandleExtra() ? true : permanent? false : true;
|
|
144
148
|
context.canMinimize = x => minimizable !== false && canBeMinimizedOrPermanent() ? true : false;
|
|
145
149
|
|
|
@@ -221,10 +225,10 @@ const DrawerComponent = React.forwardRef((props,ref)=>{
|
|
|
221
225
|
///lorsque le drawer est en mode permanent, l'icone par défaut est l'icon devant le dépingler du mode permanent
|
|
222
226
|
const backIcon = "window-close";//isLeftPosition ? "arrow-left" : "arrow-right";
|
|
223
227
|
const chevronIcon = isLeftPosition ? "chevron-left":"chevron-right";
|
|
224
|
-
temporaryToggleIcon = React.isValidElement(temporaryToggleIcon)? temporaryToggleIcon : backIcon;
|
|
225
|
-
permanentToggleIcon = React.isValidElement(permanentToggleIcon)? permanentToggleIcon : chevronIcon;
|
|
226
|
-
minimizedToggleIcon = React.isValidElement(minimizedToggleIcon)? minimizedToggleIcon : MENU_ICON;
|
|
227
|
-
|
|
228
|
+
context.temporaryToggleIcon = temporaryToggleIcon = React.isValidElement(temporaryToggleIcon)? temporaryToggleIcon : backIcon;
|
|
229
|
+
context.permanentToggleIcon = permanentToggleIcon = React.isValidElement(permanentToggleIcon)? permanentToggleIcon : chevronIcon;
|
|
230
|
+
context.minimizedToggleIcon = minimizedToggleIcon = React.isValidElement(minimizedToggleIcon)? minimizedToggleIcon : chevronIcon//MENU_ICON;
|
|
231
|
+
|
|
228
232
|
let toggleIconTooltip = null;
|
|
229
233
|
let toggleIcon = null, mobileToggleIconTooltip = "Cliquez pour "+(open?'Masquer':'Afficher')+ " le drawer";
|
|
230
234
|
if(!isPermanent){
|
|
@@ -12,44 +12,59 @@ const AppBarLayout = React.forwardRef(({backActionProps,withDrawer,backAction,ba
|
|
|
12
12
|
const innerRef = React.useRef(null);
|
|
13
13
|
options = defaultObj(options);
|
|
14
14
|
const mergedRef = React.useMergeRefs(innerRef,ref);
|
|
15
|
-
backActionProps = Object.assign({},backActionProps);
|
|
16
|
-
const {drawerRef} = useDrawer();
|
|
17
15
|
return <AppBar
|
|
18
|
-
backAction = {
|
|
19
|
-
props = defaultObj(props);
|
|
20
|
-
const size = 30;
|
|
21
|
-
const bProps = {
|
|
22
|
-
size,
|
|
23
|
-
//color : theme.colors.primaryText,
|
|
24
|
-
...backActionProps,
|
|
25
|
-
...props,
|
|
26
|
-
}
|
|
27
|
-
return backAction === true ? <Appbar.BackAction {...bProps}/> : withDrawer !== false? <Icon {...bProps} icon = {MENU_ICON}/> : null;
|
|
28
|
-
}}
|
|
16
|
+
backAction = {getBackActionComponent({backAction,backActionProps,withDrawer})}
|
|
29
17
|
{...props}
|
|
30
|
-
onBackActionPress = {(args)=>{
|
|
31
|
-
const {canGoBack,goBack} = args;
|
|
32
|
-
if(backAction === true && canGoBack()){
|
|
33
|
-
goBack();
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
if(drawerRef && drawerRef.current){
|
|
37
|
-
if(drawerRef.current.isMinimized() && drawerRef.current.isOpen()){
|
|
38
|
-
drawerRef.current.restore();
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
if(!drawerRef.current.isPermanent()){
|
|
42
|
-
drawerRef.current.toggle();
|
|
43
|
-
} else if(!drawerRef.current.isOpen()){
|
|
44
|
-
drawerRef.current.open();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return false;
|
|
48
|
-
}}
|
|
49
18
|
ref = {mergedRef}
|
|
50
19
|
/>
|
|
51
20
|
});
|
|
52
21
|
|
|
22
|
+
export const getBackActionComponent = ({backAction,backActionProps,withDrawer})=>{
|
|
23
|
+
backActionProps = Object.assign({},backActionProps);
|
|
24
|
+
return function MainDrawerBackAction({...props}){
|
|
25
|
+
const {drawerRef} = useDrawer();
|
|
26
|
+
const size = 30;
|
|
27
|
+
const bProps = {
|
|
28
|
+
size,
|
|
29
|
+
...backActionProps,
|
|
30
|
+
...props,
|
|
31
|
+
onPress : (args)=>{
|
|
32
|
+
const {canGoBack,goBack} = args;
|
|
33
|
+
if(typeof props.onPress ==='function' && props.onPress(args) === false) return false;
|
|
34
|
+
if(backAction === true && canGoBack()){
|
|
35
|
+
goBack();
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
if(drawerRef && drawerRef.current){
|
|
39
|
+
if(drawerRef.current.isMinimized() && drawerRef.current.isOpen()){
|
|
40
|
+
drawerRef.current.restore();
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
if(!drawerRef.current.isPermanent()){
|
|
44
|
+
drawerRef.current.toggle();
|
|
45
|
+
} else if(!drawerRef.current.isOpen()){
|
|
46
|
+
drawerRef.current.open();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
if(backAction === true) return <Appbar.BackAction {...bProps}/>;
|
|
53
|
+
const isPermanent = typeof drawerRef.current?.isPermanent =='function' && drawerRef?.current?.isPermanent();
|
|
54
|
+
const isMinimized = typeof drawerRef.current?.isMinimized =="function" && drawerRef.current.isMinimized();
|
|
55
|
+
if(backAction === false || withDrawer === false) return null;
|
|
56
|
+
const hasRightPosition = typeof drawerRef.current?.hasRightPosition =="function" && drawerRef.current?.hasRightPosition();
|
|
57
|
+
if(isMinimized){
|
|
58
|
+
bProps.style =[bProps.style];
|
|
59
|
+
if(hasRightPosition){
|
|
60
|
+
bProps.style.push({marginRight:-10});
|
|
61
|
+
} else bProps.style.push({marginLeft:-10});
|
|
62
|
+
bProps.title = "Cliquez pour restaurer le drawer à sa position initiale"
|
|
63
|
+
}
|
|
64
|
+
return !isPermanent || isMinimized ? <Icon {...bProps} icon = {isMinimized ? `chevron-${hasRightPosition?"left":"right"}` : MENU_ICON}/> : null
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
53
68
|
AppBarLayout.displayName = "AppBarLayout";
|
|
54
69
|
|
|
55
70
|
AppBarLayout.propTypes = {
|
|
@@ -8,17 +8,20 @@ import Login from "$eauth/Login";
|
|
|
8
8
|
import {navigate} from "$cnavigation";
|
|
9
9
|
import theme from "$theme";
|
|
10
10
|
import Logo from "$ecomponents/Logo";
|
|
11
|
+
import Dimensions from "$dimensions";
|
|
11
12
|
|
|
12
|
-
const DrawerNavigator = React.forwardRef(({content,children,state,...props},ref)=>{
|
|
13
|
+
const DrawerNavigator = React.forwardRef(({content,children:customChildren,state,...props},ref)=>{
|
|
13
14
|
const drawerRef = React.useRef(null);
|
|
14
15
|
const mergedRefs = React.useMergeRefs(drawerRef,ref);
|
|
15
16
|
const forceRender = React.useForceRender();
|
|
16
17
|
const refreshItemsRef = React.useRef(false);
|
|
18
|
+
const [currentMedia,setCurrentMedia] = React.useState(Dimensions.getCurrentMedia());
|
|
17
19
|
const items = useGetItems({refresh:()=>{
|
|
18
20
|
if(drawerRef.current && drawerRef.current && drawerRef.current.forceRenderNavigationView){
|
|
19
21
|
return drawerRef.current.forceRenderNavigationView();
|
|
20
22
|
}
|
|
21
23
|
},force:refreshItemsRef.current});
|
|
24
|
+
const children= React.useMemo(()=>customChildren,[customChildren,isLoggedIn])
|
|
22
25
|
React.useEffect(()=>{
|
|
23
26
|
const onLogoutUser = ()=>{
|
|
24
27
|
setIsLoggedIn(false);
|
|
@@ -28,11 +31,21 @@ const DrawerNavigator = React.forwardRef(({content,children,state,...props},ref)
|
|
|
28
31
|
forceRender();
|
|
29
32
|
refreshItemsRef.current = false;
|
|
30
33
|
};
|
|
34
|
+
const onResizePage = ()=>{
|
|
35
|
+
forceRender();
|
|
36
|
+
}
|
|
31
37
|
APP.on(APP.EVENTS.AUTH_LOGOUT_USER,onLogoutUser);
|
|
38
|
+
const bindResize = Dimensions.addEventListener("change",()=>{
|
|
39
|
+
const cMedia = Dimensions.getCurrentMedia();
|
|
40
|
+
if(cMedia !== currentMedia){
|
|
41
|
+
setCurrentMedia(cMedia);
|
|
42
|
+
}
|
|
43
|
+
})
|
|
32
44
|
APP.on(APP.EVENTS.UPDATE_THEME,refreshItems);
|
|
33
45
|
return ()=>{
|
|
34
46
|
APP.off(APP.EVENTS.AUTH_LOGOUT_USER,onLogoutUser);
|
|
35
47
|
APP.off(APP.EVENTS.UPDATE_THEME,refreshItems);
|
|
48
|
+
if(typeof bindResize ==='function') bindResize();
|
|
36
49
|
}
|
|
37
50
|
},[])
|
|
38
51
|
const headerCB = ({isMinimized})=>{
|