@fto-consult/expo-ui 2.34.3 → 2.34.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -155,7 +155,7 @@ export const footerFieldName = "dgrid-fters-fields";
|
|
|
155
155
|
|
|
156
156
|
|
|
157
157
|
/*****
|
|
158
|
-
* Pour spécifier qu'un champ du datagrid n'existe pas en bd il s'
|
|
158
|
+
* Pour spécifier qu'un champ du datagrid n'existe pas en bd il s'ufit de suffixer le nom du champ par le suffix : "FoundInDB" et de renseigner false comme valeur
|
|
159
159
|
de l'objet rowData de cette propriété
|
|
160
160
|
*/
|
|
161
161
|
export default class CommonDatagridComponent extends AppComponent {
|
|
@@ -719,7 +719,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
719
719
|
if(header.type.contains("date")){
|
|
720
720
|
this.dateFields[header.field] = header;
|
|
721
721
|
}
|
|
722
|
-
/**** pour ignorer une colonne du datagrid, il
|
|
722
|
+
/**** pour ignorer une colonne du datagrid, il sufit de passer le paramètre datagrid à false */
|
|
723
723
|
if(!isNonNullString(header.field) || header.datagrid === false) {
|
|
724
724
|
return;
|
|
725
725
|
}
|
|
@@ -2094,6 +2094,10 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
2094
2094
|
let totalWidths = 0;
|
|
2095
2095
|
let columnIndex = 0,visibleColumnIndex=0;
|
|
2096
2096
|
this.sectionListColumnsSize.current = 0;
|
|
2097
|
+
/*** la props widht de la colonne peut être en pourcentage
|
|
2098
|
+
* l'on peut également définir la valeur minWidth en entier qui représentera la longuer minimale du champ
|
|
2099
|
+
* la props fitWidth permet de dire que le champ devra occuper l'espace restant sur la page
|
|
2100
|
+
*/
|
|
2097
2101
|
Object.map(columns,(header,headerIndex) => {
|
|
2098
2102
|
let {
|
|
2099
2103
|
field,
|
|
@@ -2115,6 +2119,9 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
2115
2119
|
|
|
2116
2120
|
const type = defaultStr(header.jsType,header.type,"text").toLowerCase();
|
|
2117
2121
|
sortType = defaultStr(sortType,type).toLowerCase();
|
|
2122
|
+
if(typeof width =='string' && width.contains("%")){
|
|
2123
|
+
width = ((parseFloat(width.replaceAll(" ","").split('%')[0].trim())|0)*windowWidth)/100;
|
|
2124
|
+
}
|
|
2118
2125
|
width = defaultDecimal(width);
|
|
2119
2126
|
if(width <COLUMN_WIDTH/2){
|
|
2120
2127
|
width = COLUMN_WIDTH;
|
|
@@ -2129,6 +2136,9 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
2129
2136
|
} else if(type =="select_country" || type =='selectcountry'){
|
|
2130
2137
|
width = Math.max(width,90);
|
|
2131
2138
|
}
|
|
2139
|
+
if(typeof restCol.minWidth =='number'){
|
|
2140
|
+
width = Math.max(width,minWidth);
|
|
2141
|
+
}
|
|
2132
2142
|
totalWidths +=width;
|
|
2133
2143
|
widths[header.field] = width;
|
|
2134
2144
|
const colProps = {id,key}
|
|
@@ -2139,6 +2149,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
2139
2149
|
}
|
|
2140
2150
|
const title = header.text = header.text || header.label || header.title||header.field
|
|
2141
2151
|
visibleColumnsNames[header.field] = visible ? true : false;
|
|
2152
|
+
|
|
2142
2153
|
visibleColumns.push({
|
|
2143
2154
|
onPress : ()=>{
|
|
2144
2155
|
setTimeout(() => {
|
|
@@ -34,6 +34,15 @@ const TableDataSelectField = React.forwardRef((_props,ref)=>{
|
|
|
34
34
|
}
|
|
35
35
|
fKeyTable = defaultObj(fKeyTable);
|
|
36
36
|
foreignKeyTable = defaultStr(fKeyTable.tableName,fKeyTable.table,foreignKeyTable).trim().toUpperCase();
|
|
37
|
+
const sortColumn = defaultStr(fKeyTable.defaultSortColumn);
|
|
38
|
+
const sortDir = defaultStr(fKeyTable.defaultSortOrder).toLowerCase().trim();
|
|
39
|
+
const sort = {};
|
|
40
|
+
if(sortColumn){
|
|
41
|
+
sort.column = sortColumn;
|
|
42
|
+
if(sortDir =='asc' || sortDir =='desc'){
|
|
43
|
+
sort.dir = sortDir;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
37
46
|
const isMounted = React.useIsMounted();
|
|
38
47
|
const showAdd = isFilter || !foreignKeyTable ? false : React.useRef(Auth.isTableDataAllowed({foreignKeyTable,action:'create'}) ? defaultVal(props.showAdd,props.showAddBtn,true) : false).current;
|
|
39
48
|
const [state,setState] = React.useState({
|
|
@@ -44,6 +53,9 @@ const TableDataSelectField = React.forwardRef((_props,ref)=>{
|
|
|
44
53
|
const cFetch = typeof customFetchItem =='function' && customFetchItem;
|
|
45
54
|
const fetchItems = (opts)=>{
|
|
46
55
|
opts.showError = false;
|
|
56
|
+
if(sortColumn){
|
|
57
|
+
opts.sort = sort;
|
|
58
|
+
}
|
|
47
59
|
if(cFetch) return cFetch(queryPath,opts);
|
|
48
60
|
if(queryPath){
|
|
49
61
|
return fetch(queryPath,opts);
|
|
@@ -109,6 +109,7 @@ export const getFilterComponentProps = (_props)=>{
|
|
|
109
109
|
} else if(isNonNullString(props.foreignKeyColumn) && isNonNullString(props.foreignKeyTable)) {
|
|
110
110
|
component = Fields.SelectTableData;
|
|
111
111
|
props.multiple = true;
|
|
112
|
+
type = "select";
|
|
112
113
|
}else {
|
|
113
114
|
const tt = type.replaceAll("_","").toLowerCase();
|
|
114
115
|
if(React.isComponent(componentTypes[tt])){
|