@fto-consult/expo-ui 2.3.0 → 2.3.2

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": "2.3.0",
3
+ "version": "2.3.2",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -62,7 +62,7 @@
62
62
  "@expo/html-elements": "^0.2.0",
63
63
  "@expo/metro-config": "^0.4.0",
64
64
  "@expo/webpack-config": "^0.17.2",
65
- "@fto-consult/common": "^1.11.13",
65
+ "@fto-consult/common": "^1.11.15",
66
66
  "@gorhom/portal": "^1.0.14",
67
67
  "@react-native-async-storage/async-storage": "~1.17.3",
68
68
  "@react-native-community/datetimepicker": "6.5.2",
@@ -10,6 +10,7 @@ import Label from "$ecomponents/Label";
10
10
  import theme from "$theme"
11
11
  import Expandable from "$ecomponents/Expandable";
12
12
  import { Dimensions } from "react-native";
13
+ import Grid from "$components/Grid";
13
14
 
14
15
  const MIN_WIDTH = 250;
15
16
  let windowWidth = Dimensions.get("window").width;
@@ -28,6 +29,12 @@ const FiltersAccordionComponent = React.forwardRef((props,ref)=>{
28
29
  const filterTitle = defaultStr(customFilterTitle,'Filtres');
29
30
  const canHandlerFilterRef = React.useRef(0);
30
31
  const filteredRef = React.useRef({});
32
+ const cellProps = {
33
+ desktopSize : 4,
34
+ tabletSize :6,
35
+ phoneSize : 12,
36
+ style : [theme.styles.ph1],
37
+ }
31
38
  const prepareContent = (filters)=>{
32
39
  const content = []
33
40
  const colMenus = [];
@@ -37,7 +44,7 @@ const FiltersAccordionComponent = React.forwardRef((props,ref)=>{
37
44
  };
38
45
  Object.map(filters,(filter,index)=>{
39
46
  if(React.isValidElement(filter)){
40
- content.push(<React.Fragment key={index}>{filter}</React.Fragment>)
47
+ content.push(<Grid.Cell {...cellProps} key={index}>{filter}</Grid.Cell>)
41
48
  } else if(isObj(filter)){
42
49
  const {onChange} = filter;
43
50
  const key = defaultStr(filter.key,filter.field,filter.index,index+"");
@@ -65,7 +72,9 @@ const FiltersAccordionComponent = React.forwardRef((props,ref)=>{
65
72
  }
66
73
  }
67
74
  mainFilterTitle +=(content.length?",":"")+"\n"+defaultStr(filter.label,filter.text,filter.field)+" : "+defVal+""
68
- content.push(<Filter
75
+ content.push(
76
+ <Grid.Cell {...cellProps} key={key}>
77
+ <Filter
69
78
  {...filter}
70
79
  dynamicRendered
71
80
  isLoading = {isLoading && filteredRef.current[key] ? true : false}
@@ -88,7 +97,7 @@ const FiltersAccordionComponent = React.forwardRef((props,ref)=>{
88
97
  withBottomSheet
89
98
  containerProps = {{...containerProps}}
90
99
  inputProps = {{containerProps}}
91
- />)
100
+ /></Grid.Cell>)
92
101
  }
93
102
  })
94
103
  return {content,mainFilterTitle,colMenus}
@@ -130,10 +139,10 @@ const FiltersAccordionComponent = React.forwardRef((props,ref)=>{
130
139
  </View>
131
140
  </Expandable>
132
141
  </View>
133
- {content.length ? <View style={styles.contentContainer}>
134
- <View style = {[styles.content]}>
142
+ {content.length ? <View style={[theme.styles.w100]}>
143
+ <Grid style={theme.styles.w100}>
135
144
  {content}
136
- </View>
145
+ </Grid>
137
146
  </View> : null}
138
147
  </View>
139
148
  </Content>
@@ -481,7 +481,7 @@ export default class CommonDatagridComponent extends AppComponent {
481
481
  header.colIndex = colIndex;
482
482
  this.state.columns[header.field] = header;
483
483
  /*** les pieds de pages sont les données de type decimal, où qu'on peut compter */
484
- if(header.footer !== false && (arrayValueExists(['decimal','number','money'],header.type) || header.format == 'money')){
484
+ if(header.footer !== false && ((arrayValueExists(['decimal','number','money'],header.type) && header.format) || header.format == 'money' || header.format =='number')){
485
485
  footers[header.field] = header;
486
486
  }
487
487
  if(!this.hasColumnsHalreadyInitialized){
@@ -11,7 +11,6 @@ import TextField from "$ecomponents/TextField";
11
11
  import Icon from "$ecomponents/Icon";
12
12
  import {StyleSheet,View} from "react-native";
13
13
  import DatePickerModal from '../DatePickerModal'
14
- import "../i18n";
15
14
  import PeriodActionComponent from "../PeriodAction";
16
15
 
17
16
  const validMinDate = (date,minDate)=>{
@@ -9,6 +9,12 @@ const Dictionary = {
9
9
  mustBeLowerThan: 'doit être plus récente de',
10
10
  mustBeBetween: 'doit être entre',
11
11
  dateIsDisabled: 'la date n\'est pas autorisée',
12
+ previous: 'Précédent',
13
+ next: 'Suivant',
14
+ typeInDate: 'Entrer la date',
15
+ pickDateFromCalendar: 'Sélectionner une date dans le calendrier',
16
+ close: 'Fermer',
17
+ "DD/MM/YYYY" : "JJ/MM/AAAA",
12
18
  },
13
19
  en : {
14
20
  save: 'Save',
@@ -20,6 +26,12 @@ const Dictionary = {
20
26
  mustBeLowerThan: 'Must be earlier then',
21
27
  mustBeBetween: 'Must be between',
22
28
  dateIsDisabled: 'Day is not allowed',
29
+ previous: 'Previous',
30
+ next: 'Next',
31
+ typeInDate: 'Type in date',
32
+ pickDateFromCalendar: 'Pick date from calendar',
33
+ close: 'Close',
34
+ "DD/MM/YYYY" : "DD/MM/AAAA"
23
35
  }
24
36
  }
25
37
 
@@ -1,3 +1,4 @@
1
1
  import {registerTranslation} from 'react-native-paper-dates'
2
2
  import Dictionary from "./dictionary";
3
- registerTranslation("fr",Dictionary.fr);
3
+ registerTranslation("fr",Dictionary.fr);
4
+ registerTranslation("en",Dictionary.en);
@@ -42,6 +42,7 @@ const _operators = {
42
42
  }
43
43
 
44
44
  const periodActions = {
45
+ $yesterday : "Hier",
45
46
  $today:"Aujourd'hui",
46
47
  $prevWeek:"Semaine passée",
47
48
  $week:'Cette semaine',
@@ -185,7 +186,7 @@ export default class Filter extends AppComponent {
185
186
  let originValue = value;
186
187
  const type = defaultStr(this.props.type).toLowerCase().trim();
187
188
  value = parseDecimal(value,type);
188
- if(action =="$today"){
189
+ if(action =="$today" || action =='$yesterday'){
189
190
  force = true;
190
191
  }
191
192
  let prev = JSON.stringify(defaultObj(this.previousObj)),//{value:this.previousValue,operator:this.previousOperator,action:this.previousAction}
@@ -206,7 +207,7 @@ export default class Filter extends AppComponent {
206
207
  let originAction = action;
207
208
  if(isNonNullString(action)){
208
209
  action = action.toLowerCase().trim();
209
- if(action =="$today"){
210
+ if(action =="$today" || action =='$yesterday'){
210
211
  action = "$eq";
211
212
  } else if(action.startsWith("$") && (action.contains("week") || action.contains("month"))){
212
213
  action = "$period";
@@ -294,7 +295,7 @@ export default class Filter extends AppComponent {
294
295
  }
295
296
  setAction(action,text){
296
297
  if(!(this.searchFilter.current)) return;
297
- if(action === this.state.action && action !="$period" && action !== "$today") return;
298
+ if(action === this.state.action && action !="$period" && action !== "$today" && action !='$yesterday') return;
298
299
  let value = this.state.defaultValue;
299
300
  let act = defaultStr(action).toLowerCase();
300
301
  const isDateTime = this.type?.contains("time");
@@ -305,7 +306,9 @@ export default class Filter extends AppComponent {
305
306
  })
306
307
  } else if(action =="$today"){
307
308
  return this.runAction({value:new Date().resetHours().resetMinutes().resetSeconds().toFormat(dateFormat),action})
308
- } else if(act.startsWith("$") && (act.contains("week") || act.contains("month"))){
309
+ } else if(action =="$yesterday"){
310
+ return this.runAction({value: DateLib.removeDays(1,new Date(),null,true).resetHours().resetMinutes().resetSeconds().toFormat(dateFormat),action})
311
+ } else if(act.startsWith("$") && (act.contains("week") || act.contains("month"))){
309
312
  let diff = undefined;
310
313
  const currentDate = new Date();
311
314
  currentDate.setHours(0);
@@ -507,7 +510,7 @@ export default class Filter extends AppComponent {
507
510
  if(checked && (isNumber(defaultValue) || isNonNullString(defaultValue))) {
508
511
  let hasS = false;
509
512
  let act = defaultStr(action).toLowerCase();
510
- if(act =="$today"){
513
+ if(act =="$today" || act =='$yesterday'){
511
514
 
512
515
  } else if((action =="$period" || (act.startsWith("$") && (act.contains("week") || act.contains("month"))))){
513
516
  let sp = defaultValue.split("=>");
@@ -1,11 +0,0 @@
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 i18n from "$i18n";
6
-
7
- i18n.dictionary({
8
- fr : {
9
- "DD/MM/YYYY" : "JJ/MM/AAAA"
10
- }
11
- })