@fto-consult/expo-ui 6.49.2 → 6.51.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/create-transpile-module-transformer.js +22 -0
- package/metro-exotic-transformer.js +5 -0
- package/metro.config.js +3 -1
- package/package.json +2 -2
- package/src/auth/ThemeSelector/index.js +80 -4
- package/src/components/Chip/index.js +1 -1
- package/src/components/Color/index.js +1 -1
- package/src/components/Datagrid/Accordion/index.js +2 -7
- package/src/components/Datagrid/Common/Common.js +16 -5
- package/src/components/Datagrid/Table/Filter.js +7 -0
- package/src/components/Datagrid/Table/FilterMenu.js +27 -0
- package/src/components/Datagrid/Table/Filters.js +71 -0
- package/src/components/Datagrid/Table/FiltersMenu.js +45 -0
- package/src/components/Datagrid/Table/hooks.js +8 -0
- package/src/components/Datagrid/Table/index.js +10 -5
- package/src/components/Datagrid/Table/styles.js +16 -0
- package/src/components/Expandable/index.js +1 -1
- package/src/components/Fab/GroupComponent.js +3 -3
- package/src/components/Form/Fields/SelectTableData/Component.js +3 -5
- package/src/components/Menu/Menu.js +1 -1
- package/src/components/Modal/index.js +1 -1
- package/src/components/PhoneInput/index.js +1 -1
- package/src/components/SimpleSelect/index.js +1 -1
@@ -0,0 +1,22 @@
|
|
1
|
+
const {writeFile} = require("./electron/utils");
|
2
|
+
const fs = require("fs"), path = require("path");
|
3
|
+
module.exports = function({config,transpileModules}){
|
4
|
+
transpileModules = Array.isArray(transpileModules)? transpileModules : [];
|
5
|
+
if(!transpileModules.includes('@fto-consult')){
|
6
|
+
transpileModules.unshift('@fto-consult');
|
7
|
+
}
|
8
|
+
const transpilePath = path.resolve("./metro-exotic-transformer.js");
|
9
|
+
try {
|
10
|
+
writeFile(transpilePath,`
|
11
|
+
module.exports = require('@expo/metro-config/transformer').createExoticTransformer({
|
12
|
+
transpileModules : ${JSON.stringify(transpileModules)},
|
13
|
+
})
|
14
|
+
`);
|
15
|
+
} catch(e) {
|
16
|
+
console.log(e," generating metro-exotic-transformer on path ",transpilePath)
|
17
|
+
}
|
18
|
+
if(fs.existsSync(transpilePath)){
|
19
|
+
config.transformer.babelTransformerPath = transpilePath;
|
20
|
+
}
|
21
|
+
return config;
|
22
|
+
}
|
package/metro.config.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
const path = require("path");
|
2
2
|
const fs = require("fs");
|
3
|
-
const { getDefaultConfig } = require('expo/metro-config');
|
3
|
+
const { getDefaultConfig } = require('@expo/metro-config');
|
4
4
|
module.exports = function(opts){
|
5
5
|
//require("./create-expo-ui-package");
|
6
6
|
const isDev = 'development' === process.env.NODE_ENV;
|
@@ -39,6 +39,8 @@ module.exports = function(opts){
|
|
39
39
|
...sourceExts,"txt",
|
40
40
|
'jsx', 'js','tsx',
|
41
41
|
]
|
42
|
+
const transpileModules = [...(Array.isArray(opts.transpileModules)? opts.transpileModules : [])];
|
43
|
+
require("./create-transpile-module-transformer")({config,transpileModules});
|
42
44
|
// Remove all console logs in production...
|
43
45
|
config.transformer.minifierConfig.compress.drop_console = false;
|
44
46
|
/*config.platforms = Array.isArray(config.platforms) && config.platforms || [];
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fto-consult/expo-ui",
|
3
|
-
"version": "6.
|
3
|
+
"version": "6.51.0",
|
4
4
|
"description": "Bibliothèque de composants UI Expo,react-native",
|
5
5
|
"main": "main",
|
6
6
|
"scripts": {
|
@@ -70,7 +70,7 @@
|
|
70
70
|
"@expo/html-elements": "^0.5.1",
|
71
71
|
"@expo/vector-icons": "^13.0.0",
|
72
72
|
"@faker-js/faker": "^8.0.2",
|
73
|
-
"@fto-consult/common": "^3.
|
73
|
+
"@fto-consult/common": "^3.45.2",
|
74
74
|
"@pchmn/expo-material3-theme": "^1.3.1",
|
75
75
|
"@react-native-async-storage/async-storage": "1.18.2",
|
76
76
|
"@react-native-community/datetimepicker": "7.2.0",
|
@@ -8,7 +8,7 @@ import Auth,{login,getLoginId} from "$cauth";
|
|
8
8
|
import View from "$ecomponents/View";
|
9
9
|
import { StyleSheet } from "react-native";
|
10
10
|
import defaultTheme,{getColors} from "$theme/defaultTheme";
|
11
|
-
import theme,{defaultDarkTheme,Colors,defaultLightTheme} from "$theme";
|
11
|
+
import theme,{defaultDarkTheme,Colors,defaultLightTheme,lightColors,darkColors} from "$theme";
|
12
12
|
import Provider from "$ecomponents/Form/FormData/DialogProvider";
|
13
13
|
import Dropdown from "$ecomponents/Dropdown";
|
14
14
|
import {defaultObj} from "$cutils";
|
@@ -16,6 +16,27 @@ import Icon from "$ecomponents/Icon";
|
|
16
16
|
import {open,close} from "$preloader";
|
17
17
|
import {fields,getThemeData} from "$theme/utils";
|
18
18
|
import {modes} from "$ecomponents/TextField/utils";
|
19
|
+
import {createMaterial3Theme,getMaterial3Theme} from "@pchmn/expo-material3-theme";
|
20
|
+
import notify from "$cnotify";
|
21
|
+
|
22
|
+
const mColors = [
|
23
|
+
{
|
24
|
+
light: '#FFE082',
|
25
|
+
dark: '#FFE082',
|
26
|
+
},
|
27
|
+
{
|
28
|
+
light: '#3E8260',
|
29
|
+
dark: '#ADF2C7',
|
30
|
+
},
|
31
|
+
{
|
32
|
+
light: '#756FAB',
|
33
|
+
dark: '#E5DFFF',
|
34
|
+
},
|
35
|
+
{
|
36
|
+
light: '#9F6C2C',
|
37
|
+
dark: '#FDDDB9',
|
38
|
+
},
|
39
|
+
]
|
19
40
|
|
20
41
|
const getStyle = (color)=>{
|
21
42
|
if(!Colors.isValid(color)) return {};
|
@@ -47,7 +68,26 @@ export const getThemeFieldProps = (props,ref)=>{
|
|
47
68
|
const userThemeName = defaultStr(userTheme.name,defaultTheme.name);
|
48
69
|
const isDark = theme.isDark() || theme.isDarkUI();
|
49
70
|
const defTheme = isDark ? {...defaultDarkTheme.colors,dark:true} : {...defaultLightTheme.colors,dark:false};
|
50
|
-
const
|
71
|
+
const customColors = React.useMemo(()=>{
|
72
|
+
const colors = getColors();
|
73
|
+
if(false && userThemeName){
|
74
|
+
const t = `${userThemeName}`;
|
75
|
+
const c = Colors.isValid(defaultTheme?.colors?.primary)? createMaterial3Theme(defaultTheme.colors.primary) : null,
|
76
|
+
c2 = Colors.isValid(defaultTheme?.colors.secondary)? createMaterial3Theme(defaultTheme?.colors.secondary) :null;
|
77
|
+
['light','dark'].map((l)=>{
|
78
|
+
if(c && c[l]){
|
79
|
+
const name = `${t}-primary-${l}`;
|
80
|
+
colors[name] = {name,primaryName:userThemeName,secondaryName:`primary-${l}`,...c[l]};
|
81
|
+
}
|
82
|
+
if(c2 && c2[l]){
|
83
|
+
const name2 = `${t}-secondary-${l}`;
|
84
|
+
colors[name2] = {name:name2,primaryName:userThemeName,secondaryName:`secondary-${l}`,...c2[l]};
|
85
|
+
}
|
86
|
+
})
|
87
|
+
}
|
88
|
+
return colors;
|
89
|
+
},[]);
|
90
|
+
const itemsRef = React.useRef({...defaultObj(user.customThemes),...customColors});
|
51
91
|
fields.textFieldMode = {
|
52
92
|
type : 'select',
|
53
93
|
items : {...modes,none:{code:'',label:'Dynamique'}},
|
@@ -90,7 +130,7 @@ export const getThemeFieldProps = (props,ref)=>{
|
|
90
130
|
}
|
91
131
|
data.custom = true;
|
92
132
|
customThemes[data.name] = data;
|
93
|
-
itemsRef.current = {...customThemes,...
|
133
|
+
itemsRef.current = {...customThemes,...customColors};
|
94
134
|
user.customThemes = customThemes;
|
95
135
|
open((isEditing?"Modification ":"Enregistrement ")+"du thème...");
|
96
136
|
Auth.upsertUser(user,false).then(()=>{
|
@@ -118,7 +158,43 @@ export const getThemeFieldProps = (props,ref)=>{
|
|
118
158
|
showAdd : typeof showAdd =='boolean'? showAdd : isUserActive || Auth.isTableDataAllowed({table:'users',action:'"changeTheme"'}),
|
119
159
|
addIconTooltip : "Cliquez pour ajouter un nouveau thème",
|
120
160
|
onAdd : ()=>{
|
121
|
-
|
161
|
+
return Provider.open({
|
162
|
+
title : "Ajouter un theme personnalisé",
|
163
|
+
fields : {
|
164
|
+
color : {
|
165
|
+
type :"color",
|
166
|
+
text : 'A partir de la couleur',
|
167
|
+
required : true,
|
168
|
+
},
|
169
|
+
name : fields.name,
|
170
|
+
dark : fields.dark,
|
171
|
+
},
|
172
|
+
onSuccess : ({data})=>{
|
173
|
+
try {
|
174
|
+
const theme = createMaterial3Theme(data.color)
|
175
|
+
const dat = {...data,...Object.assign({},(data.dark? theme.dark : theme?.light))};
|
176
|
+
dat.text = Colors.isValid(dat.text)? dat.text : dat.onBackground || dat.onSurface;
|
177
|
+
const cols = dat.dark ? darkColors : lightColors;
|
178
|
+
["warning","error","info","success","divider"].map((c)=>{
|
179
|
+
if(!Colors.isValid(dat[c])){
|
180
|
+
dat[c] = cols[c];
|
181
|
+
const onKey = `on${c.ucFirst()}`;
|
182
|
+
dat[onKey] = dat[onKey] || cols[onKey];
|
183
|
+
}
|
184
|
+
})
|
185
|
+
if(isObj(dat)){
|
186
|
+
delete dat.color;
|
187
|
+
//Provider.close();
|
188
|
+
setTimeout(()=>{
|
189
|
+
showThemeExplorer(dat);
|
190
|
+
},500);
|
191
|
+
}
|
192
|
+
} catch(e){
|
193
|
+
notify.error(e);
|
194
|
+
Provider.close();
|
195
|
+
}
|
196
|
+
}
|
197
|
+
})
|
122
198
|
},
|
123
199
|
onChange : (args)=>{
|
124
200
|
args = defaultObj(args);
|
@@ -200,7 +200,7 @@ const ChipComponent = React.forwardRef(({
|
|
200
200
|
// @ts-expect-error We keep old a11y props for backwards compat with old RN versions
|
201
201
|
accessibilityTraits="button"
|
202
202
|
accessibilityComponentType="button"
|
203
|
-
role="button"
|
203
|
+
//role="button"
|
204
204
|
accessibilityLabel={closeIconAccessibilityLabel}
|
205
205
|
testID={testID+"_CloseButtonRipple"}
|
206
206
|
>
|
@@ -261,12 +261,7 @@ const DatagridFactory = (Factory)=>{
|
|
261
261
|
getMaxSelectedRows(){
|
262
262
|
return isMobileMedia()? 30 : 50;
|
263
263
|
}
|
264
|
-
|
265
|
-
if(!isNonNullString(field)) return;
|
266
|
-
let filteredColumns = {...this.state.filteredColumns};
|
267
|
-
filteredColumns[field] = visible;
|
268
|
-
this.setSessionData("filteredColumns"+this.getSessionNameKey(),filteredColumns);
|
269
|
-
}
|
264
|
+
|
270
265
|
/*** affiche les infos de l'item */
|
271
266
|
onToggleExpandItem({item,index,rowIndex,rowKey,...rest}){
|
272
267
|
if(!isObj(this.bottomSheetContext) || typeof this.bottomSheetContext.open !=='function') return;
|
@@ -410,7 +405,7 @@ const DatagridFactory = (Factory)=>{
|
|
410
405
|
visibleColumnsNames,
|
411
406
|
filteredColumns,
|
412
407
|
filters :headerFilters,
|
413
|
-
} = this.
|
408
|
+
} = this.getPreparedColumns();
|
414
409
|
const hasFootersFields = this.hasFootersFields();
|
415
410
|
const datagridHeader = <View testID={testID+"_HeaderContainer"} pointerEvents={pointerEvents} style={[styles.datagridHeader]}>
|
416
411
|
<ScrollView testID={testID+"_HeaderScrollView"} horizontal contentContainerStyle={StyleSheet.flatten([styles.contentContainerStyle,styles.minW100])}>
|
@@ -1188,11 +1188,11 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
1188
1188
|
return defaultStr(this.props.table,this.props.tableName,this.props.sessionName);
|
1189
1189
|
}
|
1190
1190
|
/*** affiche ou masque une colonne filtrée */
|
1191
|
-
|
1191
|
+
toggleFilterColumnVisibility1(field){
|
1192
1192
|
if(!isNonNullString(field)) return;
|
1193
1193
|
setTimeout(()=>{
|
1194
1194
|
this.setIsLoading(true,()=>{
|
1195
|
-
|
1195
|
+
const filteredColumns = {...this.state.filteredColumns};
|
1196
1196
|
filteredColumns[field] = defaultBool(filteredColumns[field],false) == false ? true : false;
|
1197
1197
|
this.prepareColumns({filteredColumns});
|
1198
1198
|
this.setState({filteredColumns},()=>{
|
@@ -1204,8 +1204,16 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
1204
1204
|
}
|
1205
1205
|
});
|
1206
1206
|
},true)
|
1207
|
-
},TIMEOUT)
|
1207
|
+
},TIMEOUT);
|
1208
|
+
}
|
1209
|
+
toggleFilterColumnVisibility(field,visible){
|
1210
|
+
if(!isNonNullString(field)) return;
|
1211
|
+
const filteredColumns = {...this.state.filteredColumns};
|
1212
|
+
filteredColumns[field] = visible;
|
1213
|
+
this.setSessionData("filteredColumns"+this.getSessionNameKey(),filteredColumns);
|
1214
|
+
return visible;
|
1208
1215
|
}
|
1216
|
+
|
1209
1217
|
/*** affiche ou masque une colonne
|
1210
1218
|
@param {string} field
|
1211
1219
|
*/
|
@@ -2370,7 +2378,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
2370
2378
|
return this.state.showFooters || this.hasSectionListData() && this.state.displayOnlySectionListHeaders;
|
2371
2379
|
}
|
2372
2380
|
canShowFilters(){
|
2373
|
-
return this.state.showFilters
|
2381
|
+
return this.isFilterable() && this.state.showFilters
|
2374
2382
|
}
|
2375
2383
|
toggleDisplayOnlySectionListHeaders(){
|
2376
2384
|
if(!this.canDisplayOnlySectionListHeaders()) return
|
@@ -2718,6 +2726,9 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
2718
2726
|
isValidRowKey(rowKey){
|
2719
2727
|
return !!(isNonNullString(rowKey) || typeof rowKey =='number');
|
2720
2728
|
}
|
2729
|
+
getPreparedColumns(){
|
2730
|
+
return this.preparedColumns;
|
2731
|
+
}
|
2721
2732
|
prepareData(args,cb){
|
2722
2733
|
let {pagination,config,aggregatorFunction:customAggregatorFunction,displayOnlySectionListHeaders:cdisplayOnlySectionListHeaders,data,force,sectionListColumns,sectionListCollapsedStates,updateFooters} = defaultObj(args);
|
2723
2734
|
cb = typeof cb ==='function'? cb : typeof args.cb == 'function'? args.cb : undefined;
|
@@ -2962,7 +2973,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
2962
2973
|
const footer = footers[column];
|
2963
2974
|
const canD = renderSectionListHeaderOnFirstCell && !hasAlreadRenderMainHeaderOnFirstCell;
|
2964
2975
|
const cProps = canD ? sectionListHeaderContainerProps : {};
|
2965
|
-
cells.push(<Cell {...cellProps} {...cProps} key={key2} width={width} testID={testID+"_FooterCellContainer_"+key2} style={[tableStyles.headerItemOrCell,!isA?{alignItems:'flex-start',justifyContent:'flex-start'}:{marginLeft:0,paddingLeft:0,marginRight:5},cellProps.style,cProps.style]}>
|
2976
|
+
cells.push(<Cell {...cellProps} {...cProps} key={key2} width={width} testID={testID+"_FooterCellContainer_"+key2} style={[tableStyles.headerItemOrCell,!isA?{alignItems:'flex-start',justifyContent:'flex-start'}:{marginLeft:0,paddingLeft:0,marginRight:5,paddingTop:5,paddingBottom:5},cellProps.style,cProps.style]}>
|
2966
2977
|
{canD ? headerContent:null}
|
2967
2978
|
<Footer
|
2968
2979
|
key = {key2}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
import Icon from "$ecomponents/Icon";
|
3
|
+
import Menu from "$ecomponents/Menu";
|
4
|
+
import { useDatagrid } from "./hooks";
|
5
|
+
import React from "$react";
|
6
|
+
import { getMenuStyle } from "./styles";
|
7
|
+
|
8
|
+
export default function DatagridTableFilterMenuComponent({filterKey,filteredColumns,context,...props}){
|
9
|
+
const cVisible = !!filteredColumns[filterKey];
|
10
|
+
const [visible,setVisible] = React.useState(cVisible);
|
11
|
+
React.useEffect(()=>{
|
12
|
+
if(false && visible !== cVisible){
|
13
|
+
setVisible(cVisible);
|
14
|
+
}
|
15
|
+
},[cVisible])
|
16
|
+
return <Menu.Item
|
17
|
+
{...props}
|
18
|
+
icon = {visible ? "check" : null}
|
19
|
+
onPress={(e)=>{
|
20
|
+
const nVisible = context?.toggleFilterColumnVisibility? context.toggleFilterColumnVisibility(filterKey,!!!filteredColumns[filterKey]) : visible;
|
21
|
+
if(nVisible !== visible){
|
22
|
+
setVisible(nVisible);
|
23
|
+
}
|
24
|
+
}}
|
25
|
+
/>
|
26
|
+
return null;
|
27
|
+
}
|
@@ -0,0 +1,71 @@
|
|
1
|
+
import React from "$react";
|
2
|
+
import View from "$ecomponents/View";
|
3
|
+
import {defaultStr,defaultBool,defaultArray,isObj} from "$cutils";
|
4
|
+
import theme from "$theme";
|
5
|
+
import { StyleSheet,ScrollView } from "react-native";
|
6
|
+
import Label from "$ecomponents/Label";
|
7
|
+
import Filter from "./Filter";
|
8
|
+
import FiltersMenu from "./FiltersMenu";
|
9
|
+
import FilterMenu from "./FilterMenu";
|
10
|
+
import {useDatagrid} from "./hooks";
|
11
|
+
|
12
|
+
export default function DatagridTableFiltersComponent({orOperator,andOperator,testID}){
|
13
|
+
testID = defaultStr(testID,"RN_DatagridTableFiltersComponent")
|
14
|
+
const {visible,isLoading,visibleColumnsNames,filters,filteredColumns,context} = useDatagrid();
|
15
|
+
const valuesRefs = React.useRef({});
|
16
|
+
const filteredRef = React.useRef({});
|
17
|
+
const {content,colMenus} = React.useStableMemo(()=>{
|
18
|
+
const content = [];
|
19
|
+
Object.map(filters,(filter,index)=>{
|
20
|
+
if(isObj(filter)){
|
21
|
+
const {onChange,filter:isFiltered,...rest} = filter;
|
22
|
+
if(isFiltered === false) return null;
|
23
|
+
const key = defaultStr(filter.key,filter.field,filter.columnField,filter.index,index+"");
|
24
|
+
content.push(<Filter
|
25
|
+
{...rest}
|
26
|
+
{...(isObj(valuesRefs.current[key]) ? valuesRefs.current[key] : {})}
|
27
|
+
dynamicRendered
|
28
|
+
orOperator = {defaultBool(orOperator,filter.orOperator,true)}
|
29
|
+
andOperator = {defaultBool(andOperator,filter.andOperator,true)}
|
30
|
+
onChange = {(arg)=>{
|
31
|
+
if(!arg.action && !arg.operator || !arg.field) return;
|
32
|
+
const canHandle = canHandleFilter(arg);
|
33
|
+
valuesRefs.current[key] = arg;
|
34
|
+
if(filteredRef.current[key] !== canHandle){
|
35
|
+
if(canHandle){
|
36
|
+
canHandlerFilterRef.current++;
|
37
|
+
} else {
|
38
|
+
canHandlerFilterRef.current = Math.max(0,canHandlerFilterRef.current-1);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
filteredRef.current[key] = canHandle;
|
42
|
+
if(onChange){
|
43
|
+
onChange(arg);
|
44
|
+
}
|
45
|
+
}}
|
46
|
+
/>)
|
47
|
+
}
|
48
|
+
})
|
49
|
+
return {content};
|
50
|
+
},[filters])
|
51
|
+
return <ScrollView horizontal testID={testID+"_FiltersScrollView"}>
|
52
|
+
<View testID={testID} style = {[theme.styles.row,styles.container,theme.styles.rowWrap,theme.styles.justifyStart,theme.styles.alignItemsCenter]}>
|
53
|
+
{<FiltersMenu/>}
|
54
|
+
{content}
|
55
|
+
</View>
|
56
|
+
</ScrollView>
|
57
|
+
}
|
58
|
+
|
59
|
+
const styles = StyleSheet.create({
|
60
|
+
hidden : {
|
61
|
+
opacity : 0,
|
62
|
+
display : "none",
|
63
|
+
},
|
64
|
+
container : {
|
65
|
+
paddingLeft : 10,
|
66
|
+
paddingRight : 10,
|
67
|
+
},
|
68
|
+
isLoading : {
|
69
|
+
pointerEvents : "none",
|
70
|
+
},
|
71
|
+
});
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import Menu from "$ecomponents/Menu";
|
2
|
+
import Icon from "$ecomponents/Icon";
|
3
|
+
import { useDatagrid } from "./hooks";
|
4
|
+
import {Pressable} from "react-native";
|
5
|
+
import {defaultStr} from "$cutils";
|
6
|
+
import theme from "$theme";
|
7
|
+
import Label from "$ecomponents/Label";
|
8
|
+
import React from "$react";
|
9
|
+
import { getMenuStyle } from "./styles";
|
10
|
+
|
11
|
+
export default function DatagridFiltersMenuComponent({testID,...props}){
|
12
|
+
const {filteredColumns,filterableColumnsNames,...rest} = useDatagrid();
|
13
|
+
const isFiltered = !!Object.size(filteredColumns,true);
|
14
|
+
testID = defaultStr(testID,"RN_DatagridFiltersMenuComponent")
|
15
|
+
console.log(props," is props heeein");
|
16
|
+
const items = React.useStableMemo(()=>{
|
17
|
+
const items = [];
|
18
|
+
console.log(rest," is ressss",filterableColumnsNames);
|
19
|
+
Object.map(filterableColumnsNames,(field)=>{
|
20
|
+
|
21
|
+
});
|
22
|
+
return;
|
23
|
+
colMenus.push(<FilterMenu
|
24
|
+
key = {key}
|
25
|
+
filterKey={key}
|
26
|
+
{...filter}
|
27
|
+
context={context}
|
28
|
+
filteredColumns={filteredColumns}
|
29
|
+
/>)
|
30
|
+
},[filterableColumnsNames]);
|
31
|
+
return <Menu
|
32
|
+
testID={testID}
|
33
|
+
{...props}
|
34
|
+
anchor={(p)=>{
|
35
|
+
return <Pressable {...p} testID={testID+"_FilterPressableContainer"} style={[theme.styles.row,theme.styles.justifyContentStart,theme.styles.alignItemsCenter,getMenuStyle()]}>
|
36
|
+
<Icon
|
37
|
+
name={isFiltered?"filter-menu":"filter-plus"}
|
38
|
+
primary = {isFiltered}
|
39
|
+
size={20}
|
40
|
+
/>
|
41
|
+
<Label primary={isFiltered} textBold={isFiltered}>Filtres</Label>
|
42
|
+
</Pressable>
|
43
|
+
}}
|
44
|
+
/>
|
45
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { useDatagrid as ud } from "../hooks";
|
2
|
+
export const useDatagrid = ()=>{
|
3
|
+
const {context} = ud();
|
4
|
+
const visible = context && typeof context?.canShowFilters =='function' && context.canShowFilters()|| false;
|
5
|
+
const isLoading = context && context.isLoading() || false;
|
6
|
+
const r = typeof context?.getPreparedColumns =='function'? context?.getPreparedColumns() : {};
|
7
|
+
return {...r,visible,isLoading,context};
|
8
|
+
}
|
@@ -15,6 +15,7 @@ import Footer from "../Footer/Footer";
|
|
15
15
|
import theme from "$theme";
|
16
16
|
import Table,{styles as tableStyles} from "$ecomponents/Table";
|
17
17
|
import DatagridProvider from "../hooks/Provider";
|
18
|
+
import Filters from "./Filters";
|
18
19
|
|
19
20
|
|
20
21
|
const DatagridFactory = (Factory)=>{
|
@@ -114,6 +115,7 @@ const DatagridFactory = (Factory)=>{
|
|
114
115
|
this.listRef.current.scrollToIndex({index});
|
115
116
|
}
|
116
117
|
}
|
118
|
+
|
117
119
|
getTestID(){
|
118
120
|
return defaultStr(this.props.testID,"RN_DatagridTable");
|
119
121
|
}
|
@@ -288,9 +290,7 @@ const DatagridFactory = (Factory)=>{
|
|
288
290
|
</View> : null;
|
289
291
|
return <DatagridProvider context={this}>
|
290
292
|
<View style={[styles.container,{flex:1}]} testID={testID+"_TableContainer"} pointerEvents={pointerEvents}>
|
291
|
-
<View ref={(el)=>{
|
292
|
-
this.layoutRef.current = el;
|
293
|
-
}} testID={testID+"_LayoutContainer"}>
|
293
|
+
<View ref={(el)=>{this.layoutRef.current = el;}} testID={testID+"_LayoutContainer"}>
|
294
294
|
{this.props.showActions !== false ? <DatagridActions
|
295
295
|
pointerEvents = {pointerEvents}
|
296
296
|
title = {this.renderDataSourceSelector()}
|
@@ -298,6 +298,11 @@ const DatagridFactory = (Factory)=>{
|
|
298
298
|
/> : null}
|
299
299
|
{rPagination}
|
300
300
|
{progressBar}
|
301
|
+
<Filters
|
302
|
+
testID={testID+"_DatagridTableHeaderFilters"}
|
303
|
+
orOperator = {this.props.filterOrOperator}
|
304
|
+
andOperator = {this.props.filterAndOperator}
|
305
|
+
/>
|
301
306
|
</View>
|
302
307
|
{canRenderChart ?
|
303
308
|
<View testID={testID+"_ChartContainer"} {...chartContainerProps} style={[theme.styles.w100,chartContainerProps.style]}>
|
@@ -315,7 +320,7 @@ const DatagridFactory = (Factory)=>{
|
|
315
320
|
renderItem = {this.renderFlashListItem.bind(this)}
|
316
321
|
renderSectionHeader = {this.renderFlashListItem.bind(this)}
|
317
322
|
hasFooters = {hasFootersFields && !canRenderChart ? true : false}
|
318
|
-
showFilters = {
|
323
|
+
showFilters = {false}
|
319
324
|
showFooters = {showFooters && !canRenderChart ? true : false}
|
320
325
|
showHeaders = { canRenderChart ? !!showFilters : true}
|
321
326
|
headerCellContainerProps = {{
|
@@ -335,7 +340,7 @@ const DatagridFactory = (Factory)=>{
|
|
335
340
|
data = {this.state.data}
|
336
341
|
footers = {this.getFooterValues()}
|
337
342
|
renderHeaderCell={this.renderHeaderCell.bind(this)}
|
338
|
-
renderFilterCell={this.renderFilterCell.bind(this)}
|
343
|
+
//renderFilterCell={this.renderFilterCell.bind(this)}
|
339
344
|
renderFooterCell={this.renderFooterCell.bind(this)}
|
340
345
|
renderEmpty = {this.renderEmpty.bind(this)}
|
341
346
|
/>}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { StyleSheet } from "react-native";
|
2
|
+
import theme from '$theme';
|
3
|
+
|
4
|
+
const styles = StyleSheet.create({
|
5
|
+
menuItem : {
|
6
|
+
borderRadius : 10,
|
7
|
+
}
|
8
|
+
});
|
9
|
+
|
10
|
+
export const getMenuStyle = (style)=>([
|
11
|
+
styles.menuItem,
|
12
|
+
{backgroundColor:theme.surfaceBackground},
|
13
|
+
style,
|
14
|
+
]);
|
15
|
+
|
16
|
+
export default styles;
|
@@ -110,7 +110,7 @@ const ExpandableComponent = React.forwardRef(({
|
|
110
110
|
borderless = {false}
|
111
111
|
accessibilityTraits="button"
|
112
112
|
accessibilityComponentType="button"
|
113
|
-
role="button"
|
113
|
+
//role="button"
|
114
114
|
style={[styles.container,props.style]}
|
115
115
|
onPress={handlePressAction}
|
116
116
|
onLongPress={onLongPress}
|
@@ -174,7 +174,7 @@ const FABGroup = ({
|
|
174
174
|
// @ts-expect-error We keep old a11y props for backwards compat with old RN versions
|
175
175
|
accessibilityTraits="button"
|
176
176
|
accessibilityComponentType="button"
|
177
|
-
role="button"
|
177
|
+
//role="button"
|
178
178
|
accessibilityState={{ expanded: open }}
|
179
179
|
style={StyleSheet.flatten([styles.fab, fabStyle])}
|
180
180
|
visible={visible}
|
@@ -310,7 +310,7 @@ const _FabItem = function({children,label,disabled:customDisabled,pointerEvents,
|
|
310
310
|
}
|
311
311
|
accessibilityTraits="button"
|
312
312
|
accessibilityComponentType="button"
|
313
|
-
role="button"
|
313
|
+
//role="button"
|
314
314
|
>
|
315
315
|
<Text testID={testID+"_Label"} style={StyleSheet.flatten([{ color},cursorStyle])}>
|
316
316
|
{label}
|
@@ -345,7 +345,7 @@ const _FabItem = function({children,label,disabled:customDisabled,pointerEvents,
|
|
345
345
|
// @ts-expect-error We keep old a11y props for backwards compat with old RN versions
|
346
346
|
accessibilityTraits="button"
|
347
347
|
accessibilityComponentType="button"
|
348
|
-
role="button"
|
348
|
+
//role="button"
|
349
349
|
testID={testID}
|
350
350
|
visible={open}
|
351
351
|
/>
|
@@ -60,9 +60,7 @@ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,isStructData,ge
|
|
60
60
|
}
|
61
61
|
const isMounted = React.useIsMounted();
|
62
62
|
|
63
|
-
const [
|
64
|
-
items : [],
|
65
|
-
});
|
63
|
+
const [stateItems,setItems] = React.useState([]);
|
66
64
|
const [isLoading,setIsLoading] = React.useState(true);
|
67
65
|
fetchOptions = Object.clone(defaultObj(fetchOptions));
|
68
66
|
const queryPath = fetchItemsPath || typeof fKeyTable.queryPath =='string' && fKeyTable.queryPath || typeof fKeyTable.fetchPath =='string' && fKeyTable.fetchPath || '';
|
@@ -185,7 +183,7 @@ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,isStructData,ge
|
|
185
183
|
}
|
186
184
|
}
|
187
185
|
}
|
188
|
-
|
186
|
+
setItems(items);
|
189
187
|
if(onFetchItems){
|
190
188
|
onFetchItems({data:items,items,context,props});
|
191
189
|
}
|
@@ -256,9 +254,9 @@ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,isStructData,ge
|
|
256
254
|
},[isFilter,foreignKeyTable,customShowAdd]);
|
257
255
|
return <Dropdown
|
258
256
|
{...props}
|
257
|
+
items = {stateItems}
|
259
258
|
isFilter = {isFilter}
|
260
259
|
showAdd = {showAdd}
|
261
|
-
{...state}
|
262
260
|
isLoading = {isLoading}
|
263
261
|
dialogProps = {dialogProps}
|
264
262
|
ref = {ref}
|
@@ -474,7 +474,7 @@ class _Menu extends AppComponent {
|
|
474
474
|
{rendered ? <TouchableWithoutFeedback
|
475
475
|
testID={testID+"_Menu_TouchableWithoutFeedBack"}
|
476
476
|
accessibilityLabel={overlayAccessibilityLabel}
|
477
|
-
role="button"
|
477
|
+
//role="button"
|
478
478
|
onPress={onDismiss}
|
479
479
|
style = {[hiddenStyle]}
|
480
480
|
>
|
@@ -122,7 +122,7 @@ const ModalComponent = React.forwardRef((props,ref)=>{
|
|
122
122
|
>
|
123
123
|
<TouchableWithoutFeedback
|
124
124
|
accessibilityLabel={overlayAccessibilityLabel}
|
125
|
-
role="button"
|
125
|
+
//role="button"
|
126
126
|
disabled={!dismissable}
|
127
127
|
onPress={dismissable ? hideModal : undefined}
|
128
128
|
importantForAccessibility="no"
|
@@ -163,7 +163,7 @@ export default function PhoneInputComponent(props){
|
|
163
163
|
pointerEvents = {pointerEvents}
|
164
164
|
left = {
|
165
165
|
<Pressable testID={testID+"_Left"} style={[styles.flag,disabledStyle,!isFlatMode && styles.notFlatModeFlag]}
|
166
|
-
role="button"
|
166
|
+
//role="button"
|
167
167
|
disabled = {props.disabled}
|
168
168
|
pointerEvents = {pointerEvents}
|
169
169
|
onPress={onPressFlag}
|
@@ -278,7 +278,7 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
|
|
278
278
|
const autoFocus = canAutoFocusSearchField({visible,items:renderingItems});
|
279
279
|
testID = defaultStr(testID, "RN_SimpleSelectComponent");
|
280
280
|
anchor = <Pressable
|
281
|
-
role="button"
|
281
|
+
//role="button"
|
282
282
|
activeOpacity={0.3}
|
283
283
|
testID = {testID}
|
284
284
|
{...defaultObj(anchorContainerProps)}
|