@fto-consult/expo-ui 6.16.6 → 6.17.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/package.json
CHANGED
|
@@ -103,8 +103,19 @@ const DrawerComponent = React.forwardRef((props,ref)=>{
|
|
|
103
103
|
callbackRef.current = callback;
|
|
104
104
|
setState({minimized:false,permanent:true});
|
|
105
105
|
}
|
|
106
|
+
const checkToggleBtn = (cb)=>{
|
|
107
|
+
if(!Dimensions.isDesktopMedia() && drawerRef?.current?.isPermanent()){
|
|
108
|
+
setState({permanent:false});
|
|
109
|
+
if(typeof cb ==='function'){
|
|
110
|
+
cb(getDrawerState());
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
106
116
|
|
|
107
117
|
context.toggleMinimized = (minimized,s2)=>{
|
|
118
|
+
if(!checkToggleBtn()) return;
|
|
108
119
|
if(!Dimensions.isDesktopMedia() || typeof minimized !== 'boolean' || !drawerRef.current || !drawerRef.current.isOpen()) return;
|
|
109
120
|
if(!minimizable === false) return;
|
|
110
121
|
let nS = {minimized};
|
|
@@ -119,6 +130,17 @@ const DrawerComponent = React.forwardRef((props,ref)=>{
|
|
|
119
130
|
context.isLeftPosition = ()=> isLeftPosition;
|
|
120
131
|
context.canToggle = x=> canHandleExtra() ? true : permanent? false : true;
|
|
121
132
|
context.canMinimize = x => minimizable !== false && canBeMinimizedOrPermanent() ? true : false;
|
|
133
|
+
context.togglePermanent = (x,cb)=>{
|
|
134
|
+
if(typeof x !== "boolean") return;
|
|
135
|
+
if(!checkToggleBtn(cb)) return;
|
|
136
|
+
const isPerm = drawerRef?.current?.isPermanent();
|
|
137
|
+
if(x && ! isPerm || !x && isPerm){
|
|
138
|
+
setState({permanent:x});
|
|
139
|
+
}
|
|
140
|
+
if(typeof cb =="function"){
|
|
141
|
+
cb(getDrawerState());
|
|
142
|
+
}
|
|
143
|
+
}
|
|
122
144
|
|
|
123
145
|
let {permanent:isPermanent,minimized:isMinimized} = session.get();
|
|
124
146
|
if(_canBeMinimizedOrPermanent && isPermanent){
|
|
@@ -288,9 +310,10 @@ const DrawerComponent = React.forwardRef((props,ref)=>{
|
|
|
288
310
|
drawerRef.current.isOpen = context.isOpen = typeof drawerRef.current.isOpen =='function'? drawerRef.current.isOpen.bind(drawerRef.current) : x=> drawerRef && drawerRef.current ? drawerRef.current.drawerShown : false;
|
|
289
311
|
drawerRef.current.isClosed = context.isClosed = x => !drawerRef.current.isOpen();
|
|
290
312
|
context.toggle = drawerRef.current.toggleDrawer = drawerRef.current.toggle = cb =>{
|
|
313
|
+
if(!checkToggleBtn(cb)) return;
|
|
291
314
|
if(isPermanent || isMinimized) {
|
|
292
315
|
if(typeof cb ==='function'){
|
|
293
|
-
cb(getDrawerState(
|
|
316
|
+
cb(getDrawerState());
|
|
294
317
|
}
|
|
295
318
|
return;
|
|
296
319
|
}
|
|
@@ -21,6 +21,8 @@ import useApp from "$econtext/hooks";
|
|
|
21
21
|
*/
|
|
22
22
|
const TableDataSelectField = React.forwardRef(({foreignKeyColumn,isStructData,getForeignKeyTable:cGetForeignKeyTable,prepareFilters:cPrepareFilters,bindUpsert2RemoveEvents,onAdd,showAdd:customShowAdd,canShowAdd,foreignKeyTable,fetchItemsPath,foreignKeyLabel,foreignKeyLabelIndex,dropdownActions,fields,fetchItems:customFetchItem,convertFiltersToSQL,mutateFetchedItems,onFetchItems,isFilter,isUpdate,isDocEditing,items,onAddProps,fetchOptions,...props},ref)=>{
|
|
23
23
|
props.data = defaultObj(props.data);
|
|
24
|
+
const type = defaultStr(props.type)?.toLowerCase();
|
|
25
|
+
isStructData = isStructData || type?.replaceAll("-","").replaceAll("_","").trim().contains("structdata");
|
|
24
26
|
const {getTableData:appGetForeignKeyTable,getStructData} = useApp();
|
|
25
27
|
if(!foreignKeyColumn && isNonNullString(props.field)){
|
|
26
28
|
foreignKeyColumn = props.field;
|
|
@@ -252,7 +254,7 @@ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,isStructData,ge
|
|
|
252
254
|
if(typeof canShowAdd ==='function'){
|
|
253
255
|
return canShowAdd({...props,table:foreignKeyTable,foreignKeyColumn,foreignKeyLabel,sortDir,foreignKeyTableObj:fKeyTable,foreignKeyTable})
|
|
254
256
|
}
|
|
255
|
-
if(Auth
|
|
257
|
+
if(Auth[isStructData?"isStructDataAllowed":"isTableDataAllowed"]({table:foreignKeyTable,action:'create'})){
|
|
256
258
|
return !!defaultVal(customShowAdd,true);
|
|
257
259
|
}
|
|
258
260
|
return false;
|