@fto-consult/expo-ui 2.33.1 → 2.34.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/index.js CHANGED
@@ -16,11 +16,12 @@ const isWeb = Platform.OS === "web";
16
16
  */
17
17
  export default function ExpoUIApp (options){
18
18
  options = options && typeof options =='object' && !Array.isArray(options)? options : {};
19
+ const {initConfig,...opts} = options;
19
20
  appConfig.current = options.config;
20
- if(typeof options.initConfig ==='function'){
21
- options.initConfig({appConfig});
21
+ if(typeof initConfig ==='function'){
22
+ initConfig({appConfig});
22
23
  }
23
- const App = require('./src/App').default(options);
24
+ const App = require('./src/App').default(opts);
24
25
  if (false) {
25
26
  const root = createRoot(document.getElementById("root") || document.getElementById("main"));
26
27
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "2.33.1",
3
+ "version": "2.34.1",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -12,7 +12,6 @@ import BottomSheet from "$ecomponents/BottomSheet/Provider";
12
12
  import {isMobileMedia} from "$cplatform/dimensions";
13
13
  import {isNativeMobile} from "$cplatform";
14
14
  import Icon,{MENU_ICON} from "$ecomponents/Icon";
15
- import SimpleSelect from "$ecomponents/SimpleSelect";
16
15
  import Dropdown from "$ecomponents/Dropdown";
17
16
  import React from "$react";
18
17
  import Footer from "../Footer/Footer";
@@ -21,13 +20,14 @@ import CommonTableDatagrid from "../Common/TableData";
21
20
  import BackToTop from "$ecomponents/BackToTop";
22
21
  import FiltersAccordionComponent from "./Filters";
23
22
  import RenderType from "../RenderType";
24
- import { flatMode,HEIGHT} from "$ecomponents/TextField";
25
- import List,{FlatList,FlashList} from "$ecomponents/List";
23
+ import { flatMode} from "$ecomponents/TextField";
24
+ import {FlashList} from "$ecomponents/List";
26
25
  import theme,{Colors} from "$theme";
27
26
  import {getRowStyle,styles as rStyles} from "../utils";
28
27
  import Avatar from "$ecomponents/Avatar";
29
28
  import {defaultObj,isOb,isNonNullString} from "$utils";
30
29
  import PropTypes from "prop-types";
30
+ import {isTouchDevice} from "$platform";
31
31
 
32
32
  const DatagridFactory = (Factory)=>{
33
33
  Factory = Factory || CommonDatagrid;
@@ -125,6 +125,7 @@ const DatagridFactory = (Factory)=>{
125
125
  } else if(isObj(renderedContent.contentProps)){
126
126
  descriptionProps = {...descriptionProps,...renderedContent.contentProps,style:[descriptionProps.style,renderedContent.contentProps.style]}
127
127
  }
128
+ //
128
129
  rowProps = defaultObj(renderedContent.rowProps);
129
130
  avatarProps.color = color;
130
131
  if(typeof avatarContent =='function'){
@@ -430,7 +431,7 @@ const DatagridFactory = (Factory)=>{
430
431
  } = this.preparedColumns;
431
432
  const hasFootersFields = this.hasFootersFields();
432
433
  const datagridHeader = <View testID={testID+"_HeaderContainer"} pointerEvents={pointerEvents} style={[styles.datagridHeader]}>
433
- <ScrollView testID={testID+"_HeaderScrollView"} horizontal contentContainerStyle={StyleSheet.flatten([styles.contentContainerStyle,styles.minW100])}>
434
+ <ScrollView testID={testID+"_HeaderScrollView"} horizontal showsHorizontalScrollIndicator = {!isTouchDevice()} contentContainerStyle={StyleSheet.flatten([styles.contentContainerStyle,styles.minW100])}>
434
435
  <View testID={testID+"_HeaderContentCntainer"} style={[styles.table,styles.pullRight]}>
435
436
  {dbSelector}
436
437
  <View testID={testID+"_HeaderQueryLimit"} style={[styles.paginationItem]}>
@@ -567,8 +568,8 @@ const DatagridFactory = (Factory)=>{
567
568
  {!canRenderChart && showFooters ? (
568
569
  <View testID={testID+"_FooterContainer"} pointerEvents={pointerEvents} style={[theme.styles.justifyContentCenter,theme.styles.pv1]}>
569
570
  <View testID={testID+"_FooterContentContainer"} style={[styles.footersContainer]}>
570
- <ScrollView testID={testID+"_FooterScrollView"} horizontal contentContainerStyle={[styles.contentContainerStyle]}>
571
- <View testID={testID+"_FooterContent"} style={[styles.table]}>
571
+ <ScrollView testID={testID+"_FooterScrollView"} horizontal showsHorizontalScrollIndicator = {!isTouchDevice()} contentContainerStyle={[styles.contentContainerStyle]}>
572
+ <View testID={testID+"_FooterContent"} style={[styles.table,theme.styles.p1]}>
572
573
  {Object.mapToArray(this.getFooterValues(),(footer,field)=>{
573
574
  return <Footer
574
575
  key = {field}
@@ -675,7 +676,6 @@ const styles = StyleSheet.create({
675
676
  alignItems : 'center',
676
677
  flex:1,
677
678
  paddingHorizontal : 10,
678
- paddingVertical : 0,
679
679
  },
680
680
  pullRight : {
681
681
  flexDirection : 'row',
@@ -127,7 +127,7 @@ export default function DGGridFooterValue (props){
127
127
  return <Pressable {...anchorProps} {...p} testID={testID} style={[styles.anchor,anchorProps.style,label?styles.row:null]} title={title}>
128
128
  {label ?
129
129
  <>
130
- <View testID={testID+"_Label"}><Label style={[styles.label]}>{label}</Label></View>
130
+ <View testID={testID+"_Label"}><Label fontSize={15} textBold style={[styles.label]}>{label}</Label></View>
131
131
  <View testID={testID+"_LabelPoint"}><Label style = {styles.label}> : </Label></View>
132
132
  </>
133
133
  : null}
@@ -91,6 +91,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
91
91
  beforeFetchData,
92
92
  sort,
93
93
  defaultSortColumn,
94
+ defaultSortOrder,
94
95
  ...rest
95
96
  } = props;
96
97
  rest = defaultObj(rest);
@@ -98,10 +99,14 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
98
99
  const firstPage = 1;
99
100
  const tableName = defaultStr(table.tableName,table.table).trim().toUpperCase();
100
101
  defaultSortColumn = defaultStr(defaultSortColumn,table.defaultSortColumn);
102
+ defaultSortOrder = defaultStr(defaultSortOrder,table.defaultSortOrder).toLowerCase().trim();
101
103
  sort = isNonNullString(sort)? {column:sort} : isObj(sort)?sort : {};
102
104
  const sColumn = defaultStr(sort.column,defaultSortColumn);
103
105
  if(sColumn){
104
106
  sort.column = sColumn;
107
+ if(defaultSortOrder =='asc' || defaultSortOrder =='desc'){
108
+ sort.dir = defaultSortOrder;
109
+ }
105
110
  } else {
106
111
  delete sort.column;
107
112
  }
@@ -20,12 +20,12 @@ import appConfig from "$appConfig";
20
20
  * foreignKeyLabel : Le libélé dans la table étrangère
21
21
  */
22
22
  const TableDataSelectField = React.forwardRef((_props,ref)=>{
23
- let {foreignKeyColumn,foreignKeyTable,foreignKeyLabel,dropdownActions,fields,fetchItems,convertFiltersToSQL,mutateFetchedItems,getForeignKeyTable,onFetchItems,isFilter,isUpdate,isDocEditing,items,onAddProps,fetchDataOpts,...props} = _props;
23
+ let {foreignKeyColumn,foreignKeyTable,foreignKeyLabel,dropdownActions,fields,fetchItems:customFetchItem,convertFiltersToSQL,mutateFetchedItems,getForeignKeyTable,onFetchItems,isFilter,isUpdate,isDocEditing,items,onAddProps,fetchDataOpts,...props} = _props;
24
24
  props = defaultObj(props);
25
25
  props.data = defaultObj(props.data);
26
26
  foreignKeyColumn = foreignKeyColumn.trim();
27
27
  convertFiltersToSQL = defaultVal(convertFiltersToSQL,willConvertFiltersToSQL());
28
- getForeignKeyTable = getForeignKeyTable || appConfig.get("getTableData");
28
+ getForeignKeyTable = getForeignKeyTable || appConfig.getDatabaseTableData;
29
29
  const fKeyTable = typeof getForeignKeyTable =='function' ? getForeignKeyTable(foreignKeyTable,props) : undefined
30
30
  if(!isObj(fKeyTable) || !(defaultStr(fKeyTable.tableName,fKeyTable.table))){
31
31
  console.error("type de données invalide pour la fKeyTable ",fKeyTable," composant SelectTableData",_props);
@@ -38,7 +38,7 @@ const TableDataSelectField = React.forwardRef((_props,ref)=>{
38
38
  items : [],isLoading : true,
39
39
  });
40
40
  fetchDataOpts = Object.clone(defaultObj(fetchDataOpts));
41
- fetchItems = typeof fetchItems =='function' ? fetchItems : typeof fKeyTable.queryPath =='string' ? (opts)=>{
41
+ const fetchItems = typeof customFetchItem =='function' ? customFetchItem : typeof fKeyTable.queryPath =='string' ? (opts)=>{
42
42
  return fetch(fKeyTable.queryPath,opts);
43
43
  } : undefined;
44
44
  isUpdate = defaultBool(isUpdate,typeof isDocEditing ==='function' && isDocEditing({data:props.data,fKeyTable,foreignKeyTable}));
@@ -1,4 +1,4 @@
1
- import {defaultStr,defaultObj,defaultVal,isObj} from "$utils";
1
+ import {defaultStr,isNonNullString,defaultObj,defaultVal,isObj} from "$utils";
2
2
  import Fields from "../Fields";
3
3
  //import dataFileManager from "$dataFileManager";
4
4
  import i18n from "$i18n";
@@ -106,7 +106,9 @@ export const getFilterComponentProps = (_props)=>{
106
106
  component = componentTypes[type];
107
107
  } else if(React.isComponent(componentTypes[type.replaceAll("_","")])){
108
108
  component = componentTypes[type.replaceAll("_","")];
109
- } else {
109
+ } else if(isNonNullString(props.foreignKeyColumn) && isNonNullString(props.foreignKeyTable)) {
110
+ component = Fields.SelectTableData;
111
+ }else {
110
112
  const tt = type.replaceAll("_","").toLowerCase();
111
113
  if(React.isComponent(componentTypes[tt])){
112
114
  component = componentTypes[tt];
@@ -27,6 +27,7 @@ const ScrollViewComponent = React.forwardRef((props,ref) => {
27
27
  },[])
28
28
  return virtualized ? <FlatList
29
29
  {...rest}
30
+ showsHorizontalScrollIndicator = {!isTouchDevice()} showsVerticalScrollIndicator={!isTouchDevice()}
30
31
  ref = {ref}
31
32
  testID = {testID}
32
33
  data={[]}
@@ -36,7 +37,7 @@ const ScrollViewComponent = React.forwardRef((props,ref) => {
36
37
  contentContainerStyle = {[!isNative && {flex:1,flexGrow: 1,maxHeight:Math.max(height-100,250)},rest.contentContainerStyle]}
37
38
  ListHeaderComponent={() => <View testID={testID+'_FlatListContent'} {...cProps} mediaQueryUpdateNativeProps = {mediaQueryUpdateNativeProps}
38
39
  >{children}</View>}
39
- /> : <ScrollView ref={ref} {...rest} testID={testID} children={children}/>
40
+ /> : <ScrollView showsHorizontalScrollIndicator = {!isTouchDevice()} showsVerticalScrollIndicator={!isTouchDevice()} ref={ref} {...rest} testID={testID} children={children}/>
40
41
  });
41
42
 
42
43
  ScrollViewComponent.displayName = "ScrollViewComponent";
@@ -7,7 +7,7 @@ import theme from "$theme";
7
7
  import PropTypes from "prop-types";
8
8
 
9
9
  export const title = 'Statistiques en BD';
10
- export default function DatabaseStatisticScreen ({withScreen,fetchDataProps,tableFilter,getTable,fetchCount,fetchData,title:customTitle,contentProps,containerProps,tables,Component,...props}){
10
+ export default function DatabaseStatisticScreen ({withScreen,fetchDataProps,tableFilter,fetchCount,fetchData,title:customTitle,contentProps,containerProps,tables,Component,...props}){
11
11
  Component = React.isComponent(Component)? Component : Grid;
12
12
  containerProps = defaultObj(containerProps);
13
13
  const title = containerProps.title = defaultStr(containerProps.title,DatabaseStatisticScreen.title);