@fto-consult/expo-ui 6.74.0 → 6.74.2
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
@@ -45,11 +45,13 @@ export const renderRowCell = (arg)=>{
|
|
45
45
|
} else if(typeof columnDef.render === "function"){
|
46
46
|
_render = columnDef.render.call(context,renderArgs);
|
47
47
|
} else if(arrayValueExists( _type,["date","datetime","time"])){
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
48
|
+
if(rowData[columnField]){
|
49
|
+
const sqlFormat =_type === 'time'? undefined : _type ==="datetime" ? DateLib.SQLDateTimeFormat : DateLib.SQLDateFormat;
|
50
|
+
let _dd =DateLib.parse(rowData[columnField],sqlFormat);
|
51
|
+
if(DateLib.isDateObj(_dd)){
|
52
|
+
const eFormat = defaultStr(columnDef.format,(_type === 'time'?DateLib.defaultTimeFormat:DateLib.masks.defaultDate));
|
53
|
+
_render = DateLib.format(_dd,eFormat);
|
54
|
+
}
|
53
55
|
}
|
54
56
|
if(!_render) _render = rowData[columnField]
|
55
57
|
} else if(arrayValueExists(_type,['switch','checkbox'])){
|
@@ -101,15 +101,16 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
101
101
|
defaultSortColumn,
|
102
102
|
defaultSortOrder,
|
103
103
|
isLoading : customIsLoading,
|
104
|
+
icon : cIcon,
|
104
105
|
...rest
|
105
106
|
} = props;
|
106
107
|
const {swrConfig} = useContext();
|
107
108
|
rest = defaultObj(rest);
|
108
109
|
rest.exportTableProps = defaultObj(rest.exportTableProps)
|
109
110
|
const firstPage = 1;
|
110
|
-
const tableName = defaultStr(table
|
111
|
-
defaultSortColumn = defaultStr(defaultSortColumn,table
|
112
|
-
defaultSortOrder = defaultStr(defaultSortOrder,table
|
111
|
+
const tableName = defaultStr(table?.tableName,table?.table).trim().toUpperCase();
|
112
|
+
defaultSortColumn = defaultStr(defaultSortColumn,table?.defaultSortColumn);
|
113
|
+
defaultSortOrder = defaultStr(defaultSortOrder,table?.defaultSortOrder).toLowerCase().trim();
|
113
114
|
sort = isNonNullString(sort)? {column:sort} : isObj(sort)?sort : {};
|
114
115
|
const sColumn = defaultStr(sort.column,defaultSortColumn);
|
115
116
|
if(sColumn){
|
@@ -120,26 +121,28 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
120
121
|
} else {
|
121
122
|
delete sort.column;
|
122
123
|
}
|
123
|
-
canMakePhoneCall = defaultBool(canMakePhoneCall,table
|
124
|
-
makePhoneCallProps = isValidMakePhoneCallProps(makePhoneCallProps) && makePhoneCallProps || isValidMakePhoneCallProps(rest.makePhoneCallProps) && rest.makePhoneCallProps || isValidMakePhoneCallProps(table
|
125
|
-
rowKey = defaultStr(rowKey,table
|
126
|
-
const title = React.isValidElement(customTitle,true) && customTitle || defaultStr(table
|
127
|
-
columns = table
|
124
|
+
canMakePhoneCall = defaultBool(canMakePhoneCall,table?.canMakePhoneCall);
|
125
|
+
makePhoneCallProps = isValidMakePhoneCallProps(makePhoneCallProps) && makePhoneCallProps || isValidMakePhoneCallProps(rest.makePhoneCallProps) && rest.makePhoneCallProps || isValidMakePhoneCallProps(table?.makePhoneCallProps) && table?.makePhoneCallProps || {};
|
126
|
+
rowKey = defaultStr(rowKey,table?.rowKey,table?.primaryKeyColumnName);
|
127
|
+
const title = React.isValidElement(customTitle,true) && customTitle || defaultStr(table?.label,table?.text)
|
128
|
+
columns = (isObj(columns) || Array.isArray(columns)) && Object.size(columns,true) && columns || table?.fields;
|
128
129
|
const fetchFields = [];
|
129
130
|
Object.map(columns,(column,i)=>{
|
130
131
|
if(isObj(column)){
|
131
132
|
fetchFields.push(defaultStr(column.field,i));
|
132
133
|
}
|
133
|
-
})
|
134
|
-
actions = defaultVal(table
|
135
|
-
|
136
|
-
|
137
|
-
|
134
|
+
});
|
135
|
+
actions = defaultVal(table?.actions,actions);
|
136
|
+
if(isObj(table) && isObj(table?.datagrid)){
|
137
|
+
for(let i in Datagrid.propTypes){
|
138
|
+
if(i in table){
|
139
|
+
rest[i] = isObj(rest[i])? extendObj({},rest[i],table[i]) : table[i];
|
140
|
+
}
|
138
141
|
}
|
139
142
|
}
|
140
143
|
rest.actions = actions;
|
141
144
|
rest.columns = columns || [];
|
142
|
-
const icon = defaultStr(table
|
145
|
+
const icon = defaultStr(cIcon,table?.icon);
|
143
146
|
rest.tableName = tableName;
|
144
147
|
rest.canMakePhoneCall = canMakePhoneCall;
|
145
148
|
rest.makePhoneCallProps = makePhoneCallProps;
|
@@ -151,7 +154,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
151
154
|
},rest.exportTableProps.pdf);
|
152
155
|
const fetchOptionsRef = React.useRef(defaultObj(customFetchOptions));
|
153
156
|
const fPathRef = React.useRef(defaultStr(fetchPathKey,uniqid("fetchPath")));
|
154
|
-
fetchPath = defaultStr(fetchPath,table
|
157
|
+
fetchPath = defaultStr(fetchPath,table?.queryPath,tableName.toLowerCase()).trim();
|
155
158
|
if(fetchPath){
|
156
159
|
fetchPath = setQueryParams(fetchPath,"SWRFetchPathKey",fPathRef.current)
|
157
160
|
}
|
@@ -292,7 +295,7 @@ const SWRDatagridComponent = React.forwardRef((props,ref)=>{
|
|
292
295
|
return (
|
293
296
|
<Datagrid
|
294
297
|
testID = {testID}
|
295
|
-
{...defaultObj(table
|
298
|
+
{...defaultObj(table?.datagrid)}
|
296
299
|
{...rest}
|
297
300
|
title = {customTitle || title || undefined}
|
298
301
|
sort = {sort}
|
@@ -448,7 +451,7 @@ SWRDatagridComponent.propTypes = {
|
|
448
451
|
PropTypes.objectOf(PropTypes.object),
|
449
452
|
PropTypes.arrayOf(PropTypes.object),
|
450
453
|
])
|
451
|
-
})
|
454
|
+
}),
|
452
455
|
}
|
453
456
|
|
454
457
|
const styles = StyleSheet.create({
|
@@ -137,7 +137,7 @@ export default class Filter extends AppComponent {
|
|
137
137
|
type = defaultStr(type,this.type,this.props.type).toLowerCase();
|
138
138
|
if(type.contains('select')){
|
139
139
|
return "$in";
|
140
|
-
} if(type !== 'date2time' && type !== 'time' && type !== 'number' && type !== 'decimal'){
|
140
|
+
} if(type !== 'date2time' && type !=="date" && type !== 'time' && type !== 'number' && type !== 'decimal'){
|
141
141
|
return '$regexcontains';
|
142
142
|
}
|
143
143
|
return '$eq';
|