@fto-consult/expo-ui 6.7.2 → 6.8.0

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": "6.7.2",
3
+ "version": "6.8.0",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -30,7 +30,7 @@ const AppbarContent = ({
30
30
  const titleTextColor = Colors.isValid(titleColor) ? titleColor : theme.colors.primaryText;
31
31
  titleProps = defaultObj(titleProps);
32
32
  subtitleProps = defaultObj(subtitleProps);
33
- testID = defaultStr(testID,"RN_AppBarContentComponent")
33
+ testID = defaultStr(testID)+"_RN_AppBarContent";
34
34
  subtitle = subtitle === false ? null : subtitle;
35
35
  const subtitleColor = Colors.setAlpha(titleTextColor,0.7);
36
36
  const webStyle = isWeb() && theme.styles.webFontFamilly;
@@ -37,6 +37,7 @@ const AppBarComponent = React.forwardRef((props,ref)=> {
37
37
  right,
38
38
  onBackActionPress : customOnBackActionPress,actions,backActionRef,route,
39
39
  ...appBarProps} = props;
40
+ testID = defaultStr(testID)+"_RN_AppBarComponent";
40
41
  const customOptions = options;
41
42
  route = defaultObj(route,useRoute());
42
43
  options = defaultObj(options,useScreenOptions());
@@ -65,7 +66,7 @@ const AppBarComponent = React.forwardRef((props,ref)=> {
65
66
  }
66
67
  title = defaultVal(title,params.title,APP.getName());
67
68
  backActionProps = Object.assign({},backActionProps);
68
- backActionProps.testID = defaultStr(backActionProps.testID,testID+"_BackAction");
69
+ backActionProps.testID = defaultStr(backActionProps.testID)+"_AppBarBackAction";
69
70
 
70
71
  let BackActionComponent = backAction === false ? null : React.isComponent(backAction)? backAction : back ? Appbar.BackAction : Icon ;
71
72
  backActionProps.color = backActionProps.color && Colors.isValid(backActionProps.color)? backActionProps.color : anchorStyle.color;
@@ -113,7 +114,7 @@ const AppBarComponent = React.forwardRef((props,ref)=> {
113
114
  const elevStyle = elevation && Elevations[elevation];
114
115
  titleProps = defaultObj(titleProps);
115
116
  React.setRef(ref,context);
116
- testID = defaultStr(testID,"RN_AppBarComponent")
117
+ ;
117
118
  return (
118
119
  <Appbar.Header elevation={elevation} {...appBarProps} testID={testID} style={[styles.header,{backgroundColor},elevStyle,appBarProps.style]} onLayout={onPageResize}>
119
120
  {backAction}
@@ -122,6 +123,7 @@ const AppBarComponent = React.forwardRef((props,ref)=> {
122
123
  titleProps = {{...titleProps,style:[styles.title,{color:primaryText},titleProps.style]}}
123
124
  subtitle = {defaultVal(subtitle,params.subtitle,options.subtitle)}
124
125
  subtitleProps = {subtitleProps}
126
+ testID={testID+"_Content"}
125
127
  />
126
128
  {renderSplitedActions(splitedActions,{
127
129
  ...defaultObj(menuProps,appBarProps.menuProps),
@@ -0,0 +1,80 @@
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 Label from "$ecomponents/Label";
5
+ let multiplicater = require("./multiplicater");
6
+ import DateLib from "$date";
7
+ export default (args,from,to) =>{
8
+ let {rowData}= args;
9
+ rowData = defaultObj(rowData);
10
+ let cost = multiplicater({rowData,columnField:'cost'},from,to);
11
+ let tbFrom = "",tbTo = "",typeText = "";
12
+ let label = defaultStr(rowData.label)
13
+ let labelT = label;
14
+ if(label.length >250){
15
+ labelT = label.substring(0,245)+"...";
16
+ }
17
+ switch(rowData.type){
18
+ case "PSA":
19
+ tbFrom = "THIRD_PARTIES";
20
+ tbTo = "CHECKOUTS";
21
+ typeText = "Vente";
22
+ break;
23
+ case "PPU":
24
+ tbTo = "THIRD_PARTIES";
25
+ tbFrom = "CHECKOUTS";
26
+ typeText = "Achat";
27
+ break;
28
+ case "PDE":
29
+ tbTo = "THIRD_PARTIES";
30
+ tbFrom = "CHECKOUTS";
31
+ typeText = "Décaissement";
32
+ break;
33
+ case "PTR":
34
+ tbFrom = "CHECKOUTS";
35
+ tbTo = "CHECKOUTS";
36
+ typeText = "Transfert";
37
+ break;
38
+ case "PIN":
39
+ tbFrom = "THIRD_PARTIES";
40
+ tbTo = "CHECKOUTS";
41
+ typeText = "Encaissement";
42
+ }
43
+ if(typeText){
44
+ typeText = "["+typeText+"]"
45
+ }
46
+ if(cost > 0){
47
+ cost = cost.formatMoney();
48
+ } else cost = undefined;
49
+
50
+ return {
51
+ title : <div className="accordion-payment">
52
+ <Label
53
+ dbName={rowData.dbId}
54
+ table = {"PAYMENTS"}
55
+ _id = {rowData.code}
56
+ >
57
+ {typeText.toUpperCase()+" "+rowData.code}
58
+ </Label>
59
+ </div>,
60
+ content : <div>
61
+ {tbFrom && <Label
62
+ dbName={"common"}
63
+ table = {tbFrom}
64
+ _id = {tbFrom+"/"+rowData.from}
65
+ >
66
+ {rowData.from}
67
+ </Label>}
68
+ {tbFrom && tbTo && " => "}
69
+ {tbTo && <Label
70
+ dbName={"common"}
71
+ table = {tbTo}
72
+ _id = {tbTo+"/"+rowData.to}
73
+ >
74
+ {rowData.to+", "}
75
+ </Label>}
76
+ <span>{DateLib.format(rowData.date,DateLib.defaultDateFormat)+(rowData.mode?(" ["+rowData.mode+"]"):"")+
77
+ (cost? ((", Coût : ").toUpperCase()+cost):"")}</span>
78
+ </div>,
79
+ }
80
+ }