@fto-consult/expo-ui 2.10.4 → 2.11.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.
@@ -0,0 +1,244 @@
1
+ INSERT INTO countries(code,name,dialCode)
2
+ VALUES
3
+ ('AF','Afghanistan (‫افغانستان‬‎)','93'),
4
+ ('AL','Albania (Shqipëri)','355'),
5
+ ('DZ','Algeria (‫الجزائر‬‎)','213'),
6
+ ('AS','American Samoa','1684'),
7
+ ('AD','Andorra','376'),
8
+ ('AO','Angola','244'),
9
+ ('AI','Anguilla','1264'),
10
+ ('AG','Antigua and Barbuda','1268'),
11
+ ('AR','Argentina','54'),
12
+ ('AM','Armenia (Հայաստան)','374'),
13
+ ('AW','Aruba','297'),
14
+ ('AU','Australia','61'),
15
+ ('AT','Austria (Österreich)','43'),
16
+ ('AZ','Azerbaijan (Azərbaycan)','994'),
17
+ ('BS','Bahamas','1242'),
18
+ ('BH','Bahrain (‫البحرين‬‎)','973'),
19
+ ('BD','Bangladesh (বাংলাদেশ)','880'),
20
+ ('BB','Barbados','1246'),
21
+ ('BY','Belarus (Беларусь)','375'),
22
+ ('BE','Belgium (België)','32'),
23
+ ('BZ','Belize','501'),
24
+ ('BJ','Benin (Bénin)','229'),
25
+ ('BM','Bermuda','1441'),
26
+ ('BT','Bhutan (འབྲུག)','975'),
27
+ ('BO','Bolivia','591'),
28
+ ('BA','Bosnia and Herzegovina (Босна и Херцеговина)','387'),
29
+ ('BW','Botswana','267'),
30
+ ('BR','Brazil (Brasil)','55'),
31
+ ('IO','British Indian Ocean Territory','246'),
32
+ ('VG','British Virgin Islands','1284'),
33
+ ('BN','Brunei','673'),
34
+ ('BG','Bulgaria (България)','359'),
35
+ ('BF','Burkina Faso','226'),
36
+ ('BI','Burundi (Uburundi)','257'),
37
+ ('KH','Cambodia (កម្ពុជា)','855'),
38
+ ('CM','Cameroon (Cameroun)','237'),
39
+ ('CA','Canada','1'),
40
+ ('CV','Cape Verde (Kabu Verdi)','238'),
41
+ ('BQ','Caribbean Netherlands','599'),
42
+ ('KY','Cayman Islands','1345'),
43
+ ('CF','Central African Republic (République centrafricaine)','236'),
44
+ ('TD','Chad (Tchad)','235'),
45
+ ('CL','Chile','56'),
46
+ ('CN','China (中国)','86'),
47
+ ('CX','Christmas Island','61'),
48
+ ('CC','Cocos (Keeling) Islands','61'),
49
+ ('CO','Colombia','57'),
50
+ ('KM','Comoros (‫جزر القمر‬‎)','269'),
51
+ ('CD','Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)','243'),
52
+ ('CG','Congo (Republic) (Congo-Brazzaville)','242'),
53
+ ('CK','Cook Islands','682'),
54
+ ('CR','Costa Rica','506'),
55
+ ('CI','Côte d’Ivoire','225'),
56
+ ('HR','Croatia (Hrvatska)','385'),
57
+ ('CU','Cuba','53'),
58
+ ('CW','Curaçao','599'),
59
+ ('CY','Cyprus (Κύπρος)','357'),
60
+ ('CZ','Czech Republic (Česká republika)','420'),
61
+ ('DK','Denmark (Danmark)','45'),
62
+ ('DJ','Djibouti','253'),
63
+ ('DM','Dominica','1767'),
64
+ ('DO','Dominican Republic (República Dominicana)','1'),
65
+ ('EC','Ecuador','593'),
66
+ ('EG','Egypt (‫مصر‬‎)','20'),
67
+ ('SV','El Salvador','503'),
68
+ ('GQ','Equatorial Guinea (Guinea Ecuatorial)','240'),
69
+ ('ER','Eritrea','291'),
70
+ ('EE','Estonia (Eesti)','372'),
71
+ ('ET','Ethiopia','251'),
72
+ ('FK','Falkland Islands (Islas Malvinas)','500'),
73
+ ('FO','Faroe Islands (Føroyar)','298'),
74
+ ('FJ','Fiji','679'),
75
+ ('FI','Finland (Suomi)','358'),
76
+ ('FR','France','33'),
77
+ ('GF','French Guiana (Guyane française)','594'),
78
+ ('PF','French Polynesia (Polynésie française)','689'),
79
+ ('GA','Gabon','241'),
80
+ ('GM','Gambia','220'),
81
+ ('GE','Georgia (საქართველო)','995'),
82
+ ('DE','Germany (Deutschland)','49'),
83
+ ('GH','Ghana (Gaana)','233'),
84
+ ('GI','Gibraltar','350'),
85
+ ('GR','Greece (Ελλάδα)','30'),
86
+ ('GL','Greenland (Kalaallit Nunaat)','299'),
87
+ ('GD','Grenada','1473'),
88
+ ('GP','Guadeloupe','590'),
89
+ ('GU','Guam','1671'),
90
+ ('GT','Guatemala','502'),
91
+ ('GG','Guernsey','44'),
92
+ ('GN','Guinea (Guinée)','224'),
93
+ ('GW','Guinea-Bissau (Guiné Bissau)','245'),
94
+ ('GY','Guyana','592'),
95
+ ('HT','Haiti','509'),
96
+ ('HN','Honduras','504'),
97
+ ('HK','Hong Kong (香港)','852'),
98
+ ('HU','Hungary (Magyarország)','36'),
99
+ ('IS','Iceland (Ísland)','354'),
100
+ ('IN','India (भारत)','91'),
101
+ ('ID','Indonesia','62'),
102
+ ('IR','Iran (‫ایران‬‎)','98'),
103
+ ('IQ','Iraq (‫العراق‬‎)','964'),
104
+ ('IE','Ireland','353'),
105
+ ('IM','Isle of Man','44'),
106
+ ('IL','Israel (‫ישראל‬‎)','972'),
107
+ ('IT','Italy (Italia)','39'),
108
+ ('JM','Jamaica','1876'),
109
+ ('JP','Japan (日本)','81'),
110
+ ('JE','Jersey','44'),
111
+ ('JO','Jordan (‫الأردن‬‎)','962'),
112
+ ('KZ','Kazakhstan (Казахстан)','77'),
113
+ ('KE','Kenya','254'),
114
+ ('KI','Kiribati','686'),
115
+ ('KW','Kuwait (‫الكويت‬‎)','965'),
116
+ ('KG','Kyrgyzstan (Кыргызстан)','996'),
117
+ ('LA','Laos (ລາວ)','856'),
118
+ ('LV','Latvia (Latvija)','371'),
119
+ ('LB','Lebanon (‫لبنان‬‎)','961'),
120
+ ('LS','Lesotho','266'),
121
+ ('LR','Liberia','231'),
122
+ ('LY','Libya (‫ليبيا‬‎)','218'),
123
+ ('LI','Liechtenstein','423'),
124
+ ('LT','Lithuania (Lietuva)','370'),
125
+ ('LU','Luxembourg','352'),
126
+ ('MO','Macau (澳門)','853'),
127
+ ('MK','Macedonia (FYROM) (Македонија)','389'),
128
+ ('MG','Madagascar (Madagasikara)','261'),
129
+ ('MW','Malawi','265'),
130
+ ('MY','Malaysia','60'),
131
+ ('MV','Maldives','960'),
132
+ ('ML','Mali','223'),
133
+ ('MT','Malta','356'),
134
+ ('MH','Marshall Islands','692'),
135
+ ('MQ','Martinique','596'),
136
+ ('MR','Mauritania (‫موريتانيا‬‎)','222'),
137
+ ('MU','Mauritius (Moris)','230'),
138
+ ('YT','Mayotte','262'),
139
+ ('MX','Mexico (México)','52'),
140
+ ('FM','Micronesia','691'),
141
+ ('MD','Moldova (Republica Moldova)','373'),
142
+ ('MC','Monaco','377'),
143
+ ('MN','Mongolia (Монгол)','976'),
144
+ ('ME','Montenegro (Crna Gora)','382'),
145
+ ('MS','Montserrat','1664'),
146
+ ('MA','Morocco (‫المغرب‬‎)','212'),
147
+ ('MZ','Mozambique (Moçambique)','258'),
148
+ ('MM','Myanmar (Burma)','95'),
149
+ ('NA','Namibia (Namibië)','264'),
150
+ ('NR','Nauru','674'),
151
+ ('NP','Nepal (नेपाल)','977'),
152
+ ('NL','Netherlands (Nederland)','31'),
153
+ ('NC','New Caledonia (Nouvelle-Calédonie)','687'),
154
+ ('NZ','New Zealand','64'),
155
+ ('NI','Nicaragua','505'),
156
+ ('NE','Niger (Nijar)','227'),
157
+ ('NG','Nigeria','234'),
158
+ ('NU','Niue','683'),
159
+ ('NF','Norfolk Island','672'),
160
+ ('KP','North Korea (조선 민주주의 인민 공화국)','850'),
161
+ ('MP','Northern Mariana Islands','1670'),
162
+ ('NO','Norway (Norge)','47'),
163
+ ('OM','Oman (‫عُمان‬‎)','968'),
164
+ ('PK','Pakistan (‫پاکستان‬‎)','92'),
165
+ ('PW','Palau','680'),
166
+ ('PS','Palestine (‫فلسطين‬‎)','970'),
167
+ ('PA','Panama (Panamá)','507'),
168
+ ('PG','Papua New Guinea','675'),
169
+ ('PY','Paraguay','595'),
170
+ ('PE','Peru (Perú)','51'),
171
+ ('PH','Philippines','63'),
172
+ ('PL','Poland (Polska)','48'),
173
+ ('PT','Portugal','351'),
174
+ ('PR','Puerto Rico','1'),
175
+ ('QA','Qatar (‫قطر‬‎)','974'),
176
+ ('RE','Réunion (La Réunion)','262'),
177
+ ('RO','Romania (România)','40'),
178
+ ('RU','Russia (Россия)','7'),
179
+ ('RW','Rwanda','250'),
180
+ ('BL','Saint Barthélemy (Saint-Barthélemy)','590'),
181
+ ('SH','Saint Helena','290'),
182
+ ('KN','Saint Kitts and Nevis','1869'),
183
+ ('LC','Saint Lucia','1758'),
184
+ ('MF','Saint Martin (Saint-Martin (partie française))','590'),
185
+ ('PM','Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)','508'),
186
+ ('VC','Saint Vincent and the Grenadines','1784'),
187
+ ('WS','Samoa','685'),
188
+ ('SM','San Marino','378'),
189
+ ('ST','São Tomé and Príncipe (São Tomé e Príncipe)','239'),
190
+ ('SA','Saudi Arabia (‫المملكة العربية السعودية‬‎)','966'),
191
+ ('SN','Senegal (Sénégal)','221'),
192
+ ('RS','Serbia (Србија)','381'),
193
+ ('SC','Seychelles','248'),
194
+ ('SL','Sierra Leone','232'),
195
+ ('SG','Singapore','65'),
196
+ ('SX','Sint Maarten','1721'),
197
+ ('SK','Slovakia (Slovensko)','421'),
198
+ ('SI','Slovenia (Slovenija)','386'),
199
+ ('SB','Solomon Islands','677'),
200
+ ('SO','Somalia (Soomaaliya)','252'),
201
+ ('ZA','South Africa','27'),
202
+ ('KR','South Korea (대한민국)','82'),
203
+ ('SS','South Sudan (‫جنوب السودان‬‎)','211'),
204
+ ('ES','Spain (España)','34'),
205
+ ('LK','Sri Lanka (ශ්‍රී ලංකාව)','94'),
206
+ ('SD','Sudan (‫السودان‬‎)','249'),
207
+ ('SR','Suriname','597'),
208
+ ('SJ','Svalbard and Jan Mayen','47'),
209
+ ('SZ','Swaziland','268'),
210
+ ('SE','Sweden (Sverige)','46'),
211
+ ('CH','Switzerland (Schweiz)','41'),
212
+ ('SY','Syria (‫سوريا‬‎)','963'),
213
+ ('TW','Taiwan (台灣)','886'),
214
+ ('TJ','Tajikistan','992'),
215
+ ('TZ','Tanzania','255'),
216
+ ('TH','Thailand (ไทย)','66'),
217
+ ('TL','Timor-Leste','670'),
218
+ ('TG','Togo','228'),
219
+ ('TK','Tokelau','690'),
220
+ ('TO','Tonga','676'),
221
+ ('TT','Trinidad and Tobago','1868'),
222
+ ('TN','Tunisia (‫تونس‬‎)','216'),
223
+ ('TR','Turkey (Türkiye)','90'),
224
+ ('TM','Turkmenistan','993'),
225
+ ('TC','Turks and Caicos Islands','1649'),
226
+ ('TV','Tuvalu','688'),
227
+ ('VI','U.S. Virgin Islands','1340'),
228
+ ('UG','Uganda','256'),
229
+ ('UA','Ukraine (Україна)','380'),
230
+ ('AE','United Arab Emirates (‫الإمارات العربية المتحدة‬‎)','971'),
231
+ ('GB','United Kingdom','44'),
232
+ ('US','United States','1'),
233
+ ('UY','Uruguay','598'),
234
+ ('UZ','Uzbekistan (Oʻzbekiston)','998'),
235
+ ('VU','Vanuatu','678'),
236
+ ('VA','Vatican City (Città del Vaticano)','39'),
237
+ ('VE','Venezuela','58'),
238
+ ('VN','Vietnam (Việt Nam)','84'),
239
+ ('WF','Wallis and Futuna','681'),
240
+ ('EH','Western Sahara (‫الصحراء الغربية‬‎)','212'),
241
+ ('YE','Yemen (‫اليمن‬‎)','967'),
242
+ ('ZM','Zambia','260'),
243
+ ('ZW','Zimbabwe','263'),
244
+ ('AX','Åland Islands','358')
@@ -1,28 +1,51 @@
1
1
  import allCountries from "./resources/countries.json";
2
2
  import {get as getFlag} from "./resources/flags";
3
3
  import {orderBy} from 'lodash';
4
+ import { StyleSheet } from "react-native";
5
+
6
+ export const COUNTRIES = {};
4
7
 
5
8
  export const getAll = (options)=>{
6
9
  return orderBy(
7
10
  allCountries, // eslint-disable-line global-require
8
11
  ['name'],
9
12
  ['asc'],
10
- ).map((country, index) => ({
11
- key: index,
12
- image: getFlag(country.iso2),
13
- label: country.name,
14
- dialCode: `+${country.dialCode}`,
15
- iso2: country.iso2,
16
- code : country.iso2,
17
- isoCode : country.iso2,
18
- }));
13
+ ).map((country, index) => {
14
+ const c = {
15
+ key: index,
16
+ image: getFlag(country.iso2),
17
+ label: country.name,
18
+ dialCode: `+${country.dialCode}`,
19
+ iso2: country.iso2,
20
+ code : country.iso2,
21
+ isoCode : country.iso2,
22
+ };
23
+ COUNTRIES[country.iso2.toUpperCase().trim()] = c;
24
+ return c;
25
+ });
19
26
  }
20
27
 
21
28
  export const countries = getAll();
22
29
 
30
+
23
31
  export {getFlag};
24
32
 
25
33
  export const getCountry = (code)=>{
26
34
  if(!code || typeof code !=='string') return null;
27
- return countries.find((c) => c.code === code)
28
- }
35
+ code = code.toUpperCase().trim();
36
+ return COUNTRIES[code] || null;
37
+ }
38
+
39
+ export const styles = StyleSheet.create({
40
+ renderedImage : {
41
+ flexDirection : "row",
42
+ alignItems : 'center',
43
+ justifyContent : 'flex-start',
44
+ flex : 1,
45
+ },
46
+ flagImage : {
47
+ borderWidth:0,
48
+ width : 30,
49
+ height : 20,
50
+ },
51
+ })
@@ -33,6 +33,8 @@ import TableLink from "$TableLink";
33
33
  import appConfig from "$capp/config";
34
34
  import stableHash from "stable-hash";
35
35
  import DatagridProgressBar from "./ProgressBar";
36
+ import {Flag} from "$ecomponents/Countries"
37
+ import View from "$ecomponents/View";
36
38
 
37
39
  export const arrayValueSeparator = ", ";
38
40
 
@@ -952,6 +954,10 @@ export default class CommonDatagridComponent extends AppComponent {
952
954
  width = Math.max(width,mWidth);
953
955
  } else if((type.contains("number") || type.contains("decimal") && this.props.format)){
954
956
  width = Math.max(width,DATE_COLUMN_WIDTH-30);
957
+ } else if(type == "tel"){
958
+ width = Math.max(width,DATE_COLUMN_WIDTH)
959
+ } else if(type =="select_country" || type =='selectcountry'){
960
+ width = Math.max(width,90);
955
961
  }
956
962
  totalWidths +=width;
957
963
  widths[header.field] = width;
@@ -1098,7 +1104,6 @@ export default class CommonDatagridComponent extends AppComponent {
1098
1104
  });
1099
1105
  data = newData;
1100
1106
  }
1101
- const beforeS = data;
1102
1107
  if(this.isDatagrid() && isNonNullString(this._sort.column)){
1103
1108
  if(isObj(this.state.columns) && this.state.columns[this._sort.column]){
1104
1109
  let field = this.state.columns[this._sort.column];
@@ -1504,8 +1509,13 @@ export default class CommonDatagridComponent extends AppComponent {
1504
1509
  return false;
1505
1510
  }
1506
1511
  UNSAFE_componentWillReceiveProps(nextProps){
1507
- if(!isObjOrArray(nextProps.data) || nextProps.data == this.props.data || stableHash(nextProps.data) == stableHash(this.props.data)) return;
1508
- this.prepareData({data:nextProps.data,force:true},(state)=>{
1512
+ if(!isObjOrArray(nextProps.data) || nextProps.data == this.props.data || stableHash(nextProps.data) == stableHash(this.props.data)) {
1513
+ if(nextProps.isLoading !== this.props.isLoading && typeof nextProps.isLoading =='boolean'){
1514
+ this.setIsLoading(nextProps.isLoading)
1515
+ }
1516
+ return;
1517
+ }
1518
+ this.prepareData({...nextProps,force:true},(state)=>{
1509
1519
  this.setState(state)
1510
1520
  });
1511
1521
  }
@@ -1649,6 +1659,9 @@ export default class CommonDatagridComponent extends AppComponent {
1649
1659
  _render = checkedLabel;
1650
1660
  } else _render = uncheckedLabel;
1651
1661
  }
1662
+ else if(_type =='select_country' || _type =='selectcountry'){
1663
+ _render = <Flag withCode {...columnDef} length={undefined} width={undefined} height={undefined} code={defaultValue}/>
1664
+ }
1652
1665
  ///le lien vers le table data se fait via une colonne de type selecttabledata ou select_tabledata ou potant l'une des propriétés foreignKeyTable ou linkToTable de type chaine de caractère non nulle
1653
1666
  else if(arrayValueExists(['piece','selecttabledata','id'],_type) || isNonNullString(columnDef.linkToTable) || isNonNullString(columnDef.foreignKeyTable)){
1654
1667
  let tableName = defaultStr(columnDef.linkToTable && columnDef.linkToTable,columnDef.foreignKeyTable && columnDef.foreignKeyTable,columnDef.tableName,columnDef.table).toUpperCase();
@@ -66,7 +66,8 @@ export default class Filter extends AppComponent {
66
66
  },
67
67
  previousRef : {
68
68
  value : {current : null}
69
- }
69
+ },
70
+ manualRunRef : {value : {current : 0}},
70
71
  })
71
72
  extendObj(this.state,{
72
73
  ...this.initFiltersOp(),
@@ -84,7 +85,11 @@ export default class Filter extends AppComponent {
84
85
  };
85
86
  })
86
87
  }
88
+ setSessionManualRunValue(value){
89
+ this.manualRunRef.current = value;
90
+ }
87
91
  getSessionManualRunValue(){
92
+ return this.manualRunRef.current;
88
93
  return getSessionData(manualRunKey) ? true : false
89
94
  }
90
95
  willRunManually (){
@@ -92,7 +97,7 @@ export default class Filter extends AppComponent {
92
97
  }
93
98
  toggleManualRun(){
94
99
  this.setState({manualRun:!this.state.manualRun},()=>{
95
- setSessionData(manualRunKey,this.state.manualRun?0:1);
100
+ this.setSessionManualRunValue(this.state.manualRun?0:1);
96
101
  if(!this.willRunManually()){
97
102
  this.fireValueChanged(true);
98
103
  }
@@ -177,6 +182,7 @@ export default class Filter extends AppComponent {
177
182
  }
178
183
  const prev = JSON.stringify(defaultObj(this.previousRef.current)), current = {value,operator,action,ignoreCase};
179
184
  let tV = isArray(value) && value.length <= 0 ? undefined : value;
185
+
180
186
  this.isInitializedRef.current = this.props.dynamicRendered || this.isInitializedRef.current;
181
187
  if(prev == "{}" && (isNullOrEmpty(tV) || value === 0) && (!this.isInitializedRef.current) && (force !== true)) {
182
188
  return this;
@@ -203,7 +209,10 @@ export default class Filter extends AppComponent {
203
209
  value = f(value);
204
210
  }
205
211
  if(isNonNullString(value) && this.state.ignoreCase){
206
- value = RegExp(value.ltrim("/").rtrim("/"),'i');
212
+ try {
213
+ const v = RegExp(value.ltrim("/").rtrim("/"),'i');
214
+ value = v;
215
+ } catch{}
207
216
  }
208
217
  action = "$regex";
209
218
  }
@@ -771,6 +771,7 @@ export default class Field extends AppComponent {
771
771
  usePlaceholderWhenEmpty,
772
772
  width,
773
773
  height,
774
+ jsType,
774
775
  ...rest
775
776
  } = this.props;
776
777
  if(this.state.caughtAnError){
@@ -863,7 +864,7 @@ export default class Field extends AppComponent {
863
864
  delete rest.archivable;
864
865
 
865
866
  this.___formattedField = undefined;
866
- let _type = this.type = defaultStr(this.props.jsType,this.props.type,this.type,"text").trim().toLowerCase();
867
+ let _type = this.type = defaultStr(jsType,this.props.type,this.type,"text").trim().toLowerCase();
867
868
  format = defaultStr(format).toLowerCase().trim();
868
869
  tooltip = defaultVal(tooltip,title);
869
870
 
@@ -2,6 +2,7 @@ import {defaultStr,defaultObj,defaultVal,isObj} from "$utils";
2
2
  import Fields from "../Fields";
3
3
  //import dataFileManager from "$dataFileManager";
4
4
  import i18n from "$i18n";
5
+ import React from "$react";
5
6
 
6
7
  const componentTypes = {
7
8
  ...Fields,
@@ -58,11 +59,12 @@ export const getFilterComponentProps = (_props)=>{
58
59
  check,
59
60
  width,
60
61
  type,
62
+ jsType,
61
63
  ...props
62
64
  } = _props;
63
65
  props = defaultObj(props);
64
66
  let component = Fields.TextField;
65
- type = defaultStr(type,'text').toLowerCase().replaceAll("_","").replaceAll("-","").trim();
67
+ type = defaultStr(jsType,type,'text').toLowerCase().replaceAll("_","").replaceAll("-","").trim();
66
68
  props = defaultObj(props);
67
69
  /*if(type =='datafile'){
68
70
  type = 'select';
@@ -74,6 +76,9 @@ export const getFilterComponentProps = (_props)=>{
74
76
  props.inputProps.placeholder = defaultStr(props.inputProps.placeholder,i18n.lang("search.."))
75
77
  props.label = label;
76
78
  component = Fields.SelectField;
79
+ if(type =='select_country' || type =='selectcountry'){
80
+ component = Fields.SelectCountry;
81
+ }
77
82
  /*if(type !== 'select'){
78
83
  if(type === 'selectstructdata') {
79
84
  dbName = 'structData';
@@ -88,8 +93,8 @@ export const getFilterComponentProps = (_props)=>{
88
93
  } else if(type == 'switch' || type =='radio' || type ==='checkbox') {
89
94
  type = 'select';
90
95
  let {checkedLabel,checkedTooltip,uncheckedTooltip,checkedValue,uncheckedLabel,uncheckedValue,label,text,...pR} = props;
91
- checkedLabel = defaultVal(checkedLabel,checkedTooltip,'Désactivé/Désélectionné')
92
- uncheckedLabel = defaultVal(uncheckedLabel,uncheckedTooltip,'Activé/Sélectionné')
96
+ checkedLabel = defaultVal(checkedLabel,checkedTooltip,'Inactif/Désélectionné')
97
+ uncheckedLabel = defaultVal(uncheckedLabel,uncheckedTooltip,'Actif/Sélectionné')
93
98
  checkedValue = defaultVal(checkedValue,1); uncheckedValue = defaultVal(uncheckedValue,0)
94
99
  props = pR;
95
100
  props.items = [{code:checkedValue,label:checkedLabel},{code:uncheckedValue,label:uncheckedLabel}];
@@ -98,7 +103,9 @@ export const getFilterComponentProps = (_props)=>{
98
103
  component = type == 'datetime' ? Fields.DateTime : type === 'date'? Fields.Date : Fields.Time;
99
104
  } else if(type == 'color' || type =='colorpicker') {
100
105
  component = Fields.ColorPicker;
101
- } else {
106
+ } else if(React.isComponent(componentTypes[type])) {
107
+ component = componentTypes[type];
108
+ }else {
102
109
  delete props.dbName;
103
110
  delete props.tableName;
104
111
  props.label = label;
@@ -1,8 +1,7 @@
1
1
  import {Image,View} from "react-native";
2
2
  import Menu from "$ecomponents/Menu";
3
3
  import Avatar from "$ecomponents/Avatar";
4
- import {TouchableOpacity,Pressable} from "react-native";
5
- import {isDecimal,setQueryParams,isValidURL,defaultStr as defaultString,isDataURL,isPromise,defaultBool,isObj,isNonNullString} from "$utils";
4
+ import {isDecimal,setQueryParams,isValidURL,defaultDecimal,defaultStr as defaultString,isDataURL,isPromise,defaultBool,isObj,isNonNullString} from "$utils";
6
5
  import {notify} from "$ecomponents/Dialog";
7
6
  let maxWidthDiff = 150, maxHeightDiff = 150;
8
7
  import {StyleSheet} from "react-native";
@@ -58,7 +57,7 @@ export default function ImageComponent(props){
58
57
  let {disabled,onMount,defaultSource,onUnmount,label,text,labelProps,readOnly,beforeRemove,
59
58
  onChange,draw,round,drawText,drawLabel,rounded,editable,defaultSrc,
60
59
  createSignatureOnly,pickImageProps,width,height,cropProps,size,resizeProps,containerProps,
61
- menuProps,pickUri,drawProps,imageProps,testID,...rest} = props;
60
+ menuProps,pickUri,drawProps,imageProps,length,testID,...rest} = props;
62
61
  rest = defaultObj(rest);
63
62
  pickImageProps = defaultObj(pickImageProps);
64
63
  cropProps = defaultObj(cropProps);
@@ -71,7 +70,7 @@ export default function ImageComponent(props){
71
70
  round = defaultBool(round,rounded,true);
72
71
  containerProps = defaultObj(containerProps);
73
72
  drawProps = defaultObj(drawProps);
74
- let content = null;
73
+ const flattenStyle = StyleSheet.flatten(props.style) || {};
75
74
  defaultSrc = defaultVal(defaultSrc);
76
75
  editable = defaultBool(editable,true);
77
76
  if(disabled){
@@ -82,16 +81,25 @@ export default function ImageComponent(props){
82
81
  setSrc(props.src);
83
82
  },[props.src])
84
83
 
84
+ if(!isDecimal(width) && isDecimal(flattenStyle.width)){
85
+ width = flattenStyle.width;
86
+ }
87
+ if(!isDecimal(height) && isDecimal(flattenStyle.height)){
88
+ height = flattenStyle.height;
89
+ }
85
90
  if(isDecimal(width) && width > 0){
86
91
  rest.width = width;
87
92
  }
93
+
88
94
  if(isDecimal(height) && height > 0){
89
95
  rest.height = height;
90
96
  }
97
+
91
98
  if(isDecimal(size) && size > 10){
92
99
  rest.size = Math.trunc(size);
93
100
  } else {
94
- rest.size = 50;
101
+ const sZize = Math.min(defaultDecimal(width),defaultDecimal(height));
102
+ rest.size = sZize >= 10 ? sZize : 50;
95
103
  }
96
104
 
97
105
  let imageWidth, imageHeight;
@@ -251,7 +259,7 @@ export default function ImageComponent(props){
251
259
  {...menuProps}
252
260
  disabled = {isDisabled}
253
261
  anchor = {(props)=>{
254
- return <View pointerEvents={pointerEvents} accessibilityLabel = {_label} testID={testID+"_Container"} {...containerProps} pointerEvents={disabled|| readOnly? "none":"auto"} style={[label?styles.align:null,containerProps.style,label?styles.container:null]}>
262
+ return <View accessibilityLabel = {_label} testID={testID+"_Container"} {...containerProps} pointerEvents={disabled|| readOnly? "none":"auto"} style={[label?styles.align:null,containerProps.style,label?styles.container:null]}>
255
263
  {<Label testID={testID+"_Label"} {...labelProps} disabled={disabled} style={[styles.label,labelProps.style]}>{label}</Label>}
256
264
  {<Avatar
257
265
  resizeMethod = {"auto"}
@@ -9,7 +9,6 @@ import Icon from "$ecomponents/Icon";
9
9
  import PhoneNumber from "./PhoneNumber";
10
10
  import SelectCountry from "$ecomponents/Countries/SelectCountry";
11
11
  import {getFlag} from "$ecomponents/Countries";
12
- import View from "$ecomponents/View";
13
12
 
14
13
  import libPhoneNumber from 'google-libphonenumber';
15
14
  const asYouTypeFormatter = libPhoneNumber.AsYouTypeFormatter;
@@ -19,20 +19,18 @@ import stableHash from "stable-hash";
19
19
  const SimpleSelect = React.forwardRef((props,ref)=>{
20
20
  let {style : customStyle,onMount,mode,showSearch,anchorContainerProps,renderText,contentContainerProps,withCheckedIcon,testID,selectionColor,dialogProps,onShow,anchor,onUnmont,controlled,onDismiss,visible:controlledVisible,selectedColor,inputProps,itemProps,itemContainerProps,label,listProps,editable,readOnly,text,filter,renderItem,itemValue,getItemValue,defaultValue,items:menuItems,onPress,onChange,disabled,...rest} = props;
21
21
  const flattenStyle = StyleSheet.flatten(customStyle) || {};
22
+ const [layout,setLayout] = React.useState({
23
+ height: 0,
24
+ width: 0,
25
+ });
22
26
  const [state,setState] = React.useState({
23
27
  value : defaultValue !== undefined? defaultValue:undefined,
24
28
  visible : controlled?undefined:false,
25
29
  items : [],
26
- layout : {
27
- height: 0,
28
- width: 0,
29
- },
30
30
  });
31
31
  contentContainerProps = defaultObj(contentContainerProps);
32
- const inputLayout = state.layout;
33
- const prevLayout = React.usePrevious(inputLayout);
32
+ const prevLayout = React.usePrevious(layout);
34
33
  filter = defaultFunc(filter,x=>true);
35
- const {items} = state;
36
34
  const value = state.value,
37
35
  visible = controlled? controlledVisible : state.visible;
38
36
  compare = defaultFunc(compare,(a,b)=> a === b);
@@ -68,7 +66,8 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
68
66
  return React.getTextContent(content);
69
67
  }
70
68
  const prevMenuItems = React.usePrevious(menuItems,stableHash);
71
- const areItemsEquals = prevMenuItems == menuItems;//JSON.stringify(prevMenuItems) == JSON.stringify(menuItems);
69
+ const hasInitializedRef = React.useRef(false);
70
+ const areItemsEquals = hasInitializedRef.current && prevMenuItems == menuItems;//JSON.stringify(prevMenuItems) == JSON.stringify(menuItems);
72
71
  const prepareItems = React.useCallback(()=>{
73
72
  const items = [];
74
73
  selectedRef.current = null;
@@ -96,7 +95,7 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
96
95
  if(isDecimal(content)) content+="";
97
96
  if(!React.isValidElement(content,true)) return null;
98
97
  mItem.content = content;
99
- mItem.textContent = rText;
98
+ mItem.textContent = React.getTextContent(rText) || React.getTextContent(content);
100
99
  if(isValueDifferent && itValue !== undefined && compare(defaultValue,itValue)){
101
100
  selectedRef.current = mItem;
102
101
  currentSelectedValue = defaultValue;
@@ -106,8 +105,10 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
106
105
  }
107
106
  items.push(mItem);
108
107
  });
108
+ hasInitializedRef.current = true;
109
109
  setState({...state,value:currentSelectedValue,items});
110
110
  },[stableHash(menuItems)])
111
+ const {items} = state;
111
112
  React.useEffect(()=>{
112
113
  if(compare(defaultValue == value) && areItemsEquals) return;
113
114
  if(!areItemsEquals){
@@ -199,22 +200,17 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
199
200
  itemContainerProps = defaultObj(itemContainerProps);
200
201
  const onLayout = (event) => {
201
202
  const layout = event.nativeEvent.layout;
202
- if(prevIsMob === isMob && layout.height == prevLayout.height && layout.width == prevLayout.width) return;
203
+ if(prevIsMob === isMob && Math.abs(layout.height - prevLayout.height) <=50 && Math.abs(layout.width == prevLayout.width)<=50) return;
203
204
  const isDiff = prevIsMob !== isMob;
204
- const nState = {
205
- ...state,
206
- layout,
207
- //visible : controlled ? undefined : isDiff ? false : visible
208
- };
209
- setState(nState);
205
+ setLayout(layout);
210
206
  if(controlled && onDismiss){
211
207
  if(isDiff){
212
- onDismiss(nState,true);
208
+ onDismiss(state,true);
213
209
  }
214
210
  }
215
211
  };
216
212
  const dimensions = Dimensions.get("window");// useWindowDimensions();
217
- let contentContainerHeight = dimensions.height - defaultDecimal(inputLayout?.top) - defaultDecimal(inputLayout?.height)-20;
213
+ let contentContainerHeight = dimensions.height - defaultDecimal(layout?.top) - defaultDecimal(layout?.height)-20;
218
214
  contentContainerHeight = Math.max(contentContainerHeight,200);
219
215
  let marginTop = 0;
220
216
  const Component = isMob ? Dialog : Menu;
@@ -341,7 +337,7 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
341
337
  paddingHorizontal : 10,
342
338
  paddingVertical:0,
343
339
  height : !isMob?contentContainerHeight:'90%',
344
- width : !isMob ? inputLayout.width : undefined,
340
+ width : !isMob ? layout.width : undefined,
345
341
  },
346
342
  isMob && {flex:1},
347
343
  !isMob && {paddingRight : 0},