@fto-consult/expo-ui 2.10.5 → 2.11.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.
@@ -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
 
@@ -954,6 +956,8 @@ export default class CommonDatagridComponent extends AppComponent {
954
956
  width = Math.max(width,DATE_COLUMN_WIDTH-30);
955
957
  } else if(type == "tel"){
956
958
  width = Math.max(width,DATE_COLUMN_WIDTH)
959
+ } else if(type =="select_country" || type =='selectcountry'){
960
+ width = Math.max(width,90);
957
961
  }
958
962
  totalWidths +=width;
959
963
  widths[header.field] = width;
@@ -1505,7 +1509,12 @@ export default class CommonDatagridComponent extends AppComponent {
1505
1509
  return false;
1506
1510
  }
1507
1511
  UNSAFE_componentWillReceiveProps(nextProps){
1508
- if(!isObjOrArray(nextProps.data) || nextProps.data == this.props.data || stableHash(nextProps.data) == stableHash(this.props.data)) return;
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
+ }
1509
1518
  this.prepareData({...nextProps,force:true},(state)=>{
1510
1519
  this.setState(state)
1511
1520
  });
@@ -1650,6 +1659,9 @@ export default class CommonDatagridComponent extends AppComponent {
1650
1659
  _render = checkedLabel;
1651
1660
  } else _render = uncheckedLabel;
1652
1661
  }
1662
+ else if(_type =='select_country' || _type =='selectcountry'){
1663
+ _render = <Flag withCode {...columnDef} length={undefined} width={undefined} height={undefined} code={defaultValue}/>
1664
+ }
1653
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
1654
1666
  else if(arrayValueExists(['piece','selecttabledata','id'],_type) || isNonNullString(columnDef.linkToTable) || isNonNullString(columnDef.foreignKeyTable)){
1655
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
  }
@@ -76,6 +76,9 @@ export const getFilterComponentProps = (_props)=>{
76
76
  props.inputProps.placeholder = defaultStr(props.inputProps.placeholder,i18n.lang("search.."))
77
77
  props.label = label;
78
78
  component = Fields.SelectField;
79
+ if(type =='select_country' || type =='selectcountry'){
80
+ component = Fields.SelectCountry;
81
+ }
79
82
  /*if(type !== 'select'){
80
83
  if(type === 'selectstructdata') {
81
84
  dbName = 'structData';
@@ -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"}
@@ -20,7 +20,7 @@ import {defaultDecimal,extendObj} from "$utils";
20
20
  import theme,{StylePropTypes} from "$theme";
21
21
  import APP from "$app/instance";
22
22
  import MenuItem from "./Item";
23
- import {isWeb} from "$platform";
23
+ import { MIN_WIDTH } from './utils';
24
24
 
25
25
  const RESIZE_PAGE = APP.EVENTS.RESIZE_PAGE;
26
26
 
@@ -516,7 +516,8 @@ class _Menu extends AppComponent {
516
516
  shadowMenuContainerStyle,
517
517
  contentStyle,
518
518
  {backgroundColor : theme.colors.surface},
519
- sameWidth && anchorLayout.width ? {width:Math.max(anchorLayout.width,minWidth)} : undefined,
519
+ minWidth && {minWidth : Math.max(minWidth,MIN_WIDTH)},
520
+ sameWidth && anchorLayout.width ? {width:Math.max(anchorLayout.width,minWidth,MIN_WIDTH)} : undefined,
520
521
  ]
521
522
  }
522
523
  >
@@ -7,6 +7,7 @@ import Expandable from "$ecomponents/Expandable";
7
7
  import {cursorPointer} from "$theme";
8
8
  import Item from "./Item";
9
9
 
10
+ export const MIN_WIDTH = 150;
10
11
 
11
12
  export const renderItems = (props)=>{
12
13
  let _items = [];
@@ -20,6 +20,7 @@ const AbsoluteScrollView = React.forwardRef(({testID,contentProps,listRef,contai
20
20
  styles : {},
21
21
  visible : true,
22
22
  })
23
+ const [layoutVisible,_setLayoutVisible] = React.useState(true);
23
24
  const {styles,visible} = state,setStyles = (s)=>{
24
25
  if(isObj(s)){
25
26
  setState({...state,styles:{...styles,...s}});
@@ -31,9 +32,19 @@ const AbsoluteScrollView = React.forwardRef(({testID,contentProps,listRef,contai
31
32
  setState({...state,visible});
32
33
  }
33
34
  }
34
- }
35
+ },setVisible = (visible)=>{
36
+ if(typeof visible =='boolean' && visible !== state.visible){
37
+ setState({...state,visible});
38
+ }
39
+ },setLayoutVisible = (layoutVisible)=>{
40
+ if(typeof layoutVisible =='boolean' && layoutVisible !== state.layoutVisible){
41
+ _setLayoutVisible(layoutVisible);
42
+ }
43
+ }
35
44
  React.setRef(ref,{
36
45
  setStyles,
46
+ setVisible,
47
+ setLayoutVisible,
37
48
  checkVisibility : (args)=>{
38
49
  args = defaultObj(args);
39
50
  if(isObj(args.contentOffset) && isObj(args.contentSize)){
@@ -56,7 +67,7 @@ const AbsoluteScrollView = React.forwardRef(({testID,contentProps,listRef,contai
56
67
  toggleVisible();
57
68
  },[styles])
58
69
  return <Portal>
59
- {<View testID={testID+"_Containter"} {...containerProps} style={[mainStyles.container,containerProps.style,styles.container,{left:win.width-10},!visible &&{display:'none',width:0,opacity:0}]}>
70
+ {<View testID={testID+"_Containter"} {...containerProps} style={[mainStyles.container,containerProps.style,styles.container,{left:win.width-10},(!visible || !layoutVisible) &&{display:'none',width:0,opacity:0}]}>
60
71
  <ScrollView
61
72
  {...props}
62
73
  ref = {scrollViewRef}
@@ -5,7 +5,7 @@ import PropTypes from "prop-types";
5
5
  export const DEFAULT_COLUMN_WIDTH = 60;
6
6
  import React from "$react";
7
7
  import Label from "$ecomponents/Label";
8
- import { StyleSheet,View as RNView,ScrollView,Dimensions} from "react-native";
8
+ import { StyleSheet,View as RNView,ScrollView,NativeModules,Dimensions} from "react-native";
9
9
  import { getRowStyle } from "$ecomponents/Datagrid/utils";
10
10
  import {isMobileNative} from "$cplatform";
11
11
  import theme from "$theme";
@@ -213,6 +213,16 @@ const TableComponent = React.forwardRef(({containerProps,renderEmpty,isRowSelect
213
213
  React.setRef(tableRef,context);
214
214
  const cStyle = {width:listWidth}
215
215
  const absoluteScrollViewRef = React.useRef(null);
216
+ const scrollViewLayoutRef = React.useRef({});
217
+ const toggleAbsoluteScrollVisible = ()=>{
218
+ const ref = scrollViewLayoutRef.current;
219
+ if(isObj(ref.layout) && isObj(ref.content)){
220
+ const layoutVisible = Math.abs(ref.content.width - ref.layout.width)<=50 ? false : true;
221
+ if(absoluteScrollViewRef.current && absoluteScrollViewRef.current.setLayoutVisible){
222
+ absoluteScrollViewRef.current.setLayoutVisible(layoutVisible);
223
+ }
224
+ }
225
+ }
216
226
  return <View testID= {testID+"_Container"} {...containerProps} style={[styles.container,{alignItems:'stretch'},containerProps.style]}>
217
227
  <RNView style={[cStyle]} testID={testID+"_Headers_ScrollViewContainer"}>
218
228
  <ScrollView
@@ -234,12 +244,23 @@ const TableComponent = React.forwardRef(({containerProps,renderEmpty,isRowSelect
234
244
  {hasEmptyData ? <View testID={testID+"_Empty"} style={styles.hasNotData}>
235
245
  {emptyData}
236
246
  </View> : <ScrollView {...scrollViewProps} scrollEventThrottle = {scrollEventThrottle} horizontal contentContainerStyle={[scrollContentContainerStyle,scrollViewProps.contentContainerStyle]} showsVerticalScrollIndicator={false}
237
- onScroll = {getOnScrollCb([headerScrollViewRef,footerScrollViewRef],null,(args)=>{
238
- const nativeEvent = args.nativeEvent;
239
- if(absoluteScrollViewRef.current && absoluteScrollViewRef.current.checkVisibility){
240
- absoluteScrollViewRef.current.checkVisibility(nativeEvent);
241
- }
242
- })} ref={scrollViewRef} testID={testID+"_ScrollView"}>
247
+ onScroll = {getOnScrollCb([headerScrollViewRef,footerScrollViewRef],null,(args)=>{
248
+ const nativeEvent = args.nativeEvent;
249
+ if(absoluteScrollViewRef.current && absoluteScrollViewRef.current.checkVisibility){
250
+ absoluteScrollViewRef.current.checkVisibility(nativeEvent);
251
+ }
252
+ })}
253
+ onLayout={({nativeEvent:{layout}}) => {
254
+ scrollViewLayoutRef.current.layout = layout;
255
+ toggleAbsoluteScrollVisible();
256
+ }}
257
+ ref={scrollViewRef}
258
+ testID={testID+"_ScrollView"}
259
+ onContentSizeChange = {(width,height)=>{
260
+ scrollViewLayoutRef.current.content = {width,height};
261
+ toggleAbsoluteScrollVisible();
262
+ }}
263
+ >
243
264
  <FlashList
244
265
  containerProps = {{style:[cStyle]}}
245
266
  //prepareItems = {Array.isArray(items)? false : undefined}
@@ -353,7 +374,7 @@ const styles = StyleSheet.create({
353
374
  minHeight : 300,
354
375
  paddingBottom : 50,
355
376
  paddingLeft : 10,
356
- paddingRight : 10,
377
+ paddingRight : 0,
357
378
  flex : 1,
358
379
  position : 'relative',
359
380
  },