@fto-consult/expo-ui 8.83.0 → 8.83.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/bin/create-app/dependencies.js +38 -38
- package/bin/create-app/eas.json +18 -18
- package/expo-ui.json +10 -10
- package/package.json +1 -1
- package/src/components/Chart/appexChart/appexChart.html +23 -23
- package/src/components/Form/Action.js +14 -4
- package/src/components/Form/Fields/Field.js +8 -2
- package/src/components/Form/Form.js +10 -0
- package/src/components/Form/FormData/FormData.js +1 -0
- package/src/components/Form/utils/FormsManager.js +1 -0
- package/src/components/SimpleSelect/index.js +14 -7
- package/src/components/Form/FormData/Table.js +0 -0
@@ -63,14 +63,25 @@ const FormActionComponent = React.forwardRef(({
|
|
63
63
|
context.toggleStatus();
|
64
64
|
}
|
65
65
|
};
|
66
|
+
const onV = FormsManager.on("validate",onMountForm);
|
67
|
+
const onNoV = FormsManager.on("novalidate",onMountForm);
|
68
|
+
const onUpdate = FormsManager.on("update",onMountForm);
|
66
69
|
APP.on("MOUNT_FORM",onMountForm);
|
67
70
|
context.toggleStatus();
|
68
71
|
return ()=>{
|
69
72
|
React.setRef(ref,null);
|
70
73
|
FormsManager.trigger("unmountAction",formName,id);
|
71
74
|
APP.off("MOUNT_FORM",onMountForm);
|
75
|
+
[onV,onNoV,onUpdate].map(v=>{
|
76
|
+
if(typeof v?.remove =="function"){
|
77
|
+
v.remove();
|
78
|
+
}
|
79
|
+
});
|
80
|
+
FormsManager.off("validate",onMountForm);
|
81
|
+
FormsManager.off("novalidate",onMountForm);
|
82
|
+
FormsManager.off("update",onMountForm);
|
72
83
|
}
|
73
|
-
},[]);
|
84
|
+
},[formName]);
|
74
85
|
const props = {
|
75
86
|
...rest,
|
76
87
|
...componentProps,
|
@@ -85,7 +96,6 @@ const FormActionComponent = React.forwardRef(({
|
|
85
96
|
return;
|
86
97
|
}
|
87
98
|
const args = React.getOnPressArgs(event);
|
88
|
-
//console.log(args," is argggggg ",onPress)
|
89
99
|
if(!onPress) return;
|
90
100
|
const formInstance = getFormInstance(formName);
|
91
101
|
if(!formInstance || typeof formInstance.isValid != 'function' && isObj(formInstance.props)) return;
|
@@ -97,12 +107,12 @@ const FormActionComponent = React.forwardRef(({
|
|
97
107
|
if(typeof children ==='function'){
|
98
108
|
return children(props);
|
99
109
|
}
|
100
|
-
Component =
|
110
|
+
Component = React.isComponent(props.Component) ? props.Component : React.isComponent(Component)? Component : Button;
|
101
111
|
delete props.Component;
|
102
112
|
delete props.formName;
|
103
113
|
delete props.isAction;
|
104
114
|
delete props.formName;
|
105
|
-
return <Component
|
115
|
+
return <Component ref = {innerRef} {...props}>{children}</Component>
|
106
116
|
});
|
107
117
|
|
108
118
|
|
@@ -277,8 +277,10 @@ export default class Field extends AppComponent {
|
|
277
277
|
this.callOnChange({value,event,isValid:true,...rest});
|
278
278
|
if(form && form.props){
|
279
279
|
if(canEnable){
|
280
|
+
const vOpts = {...defaultObj(rest),formName:this.formName,data:form.getData(),context:form,fieldInstance:this,field:this.name,name:this.name,value,event,form};
|
281
|
+
form.onValidate.call(form,vOpts);
|
280
282
|
if(isFunction(form.props.onValidate)){
|
281
|
-
form.props.onValidate.call(form,
|
283
|
+
form.props.onValidate.call(form,vOpts)
|
282
284
|
}
|
283
285
|
}
|
284
286
|
if(isFunction(form.props.onValidateField)){
|
@@ -352,8 +354,12 @@ export default class Field extends AppComponent {
|
|
352
354
|
let form = Forms.getForm(this.formName);
|
353
355
|
this.callOnChange({value,validRule,validParams,event,isValid:false,...rest});
|
354
356
|
if(form){
|
357
|
+
const vOpts = {...defaultObj(rest),formName:this.formName,fieldInstance:this,name:this.name,field:this.name,value,msg,validRule,validParams,event,context:form};
|
358
|
+
if(typeof form?.onNoValidate ==="function"){
|
359
|
+
form.onNoValidate.call(form,vOpts);
|
360
|
+
}
|
355
361
|
if(form.props && isFunction(form.props.onNoValidate)){
|
356
|
-
form.props.onNoValidate.call(form,
|
362
|
+
form.props.onNoValidate.call(form,vOpts);
|
357
363
|
}
|
358
364
|
}
|
359
365
|
})
|
@@ -79,6 +79,10 @@ export default class FormComponent extends React.AppComponent {
|
|
79
79
|
super.componentDidMount();
|
80
80
|
Forms.trigger("mount",this.props.name,this,false);
|
81
81
|
}
|
82
|
+
componentDidUpdate(...rest){
|
83
|
+
super.componentDidUpdate(...rest);
|
84
|
+
Forms.trigger("update",this.props.name,this,false);
|
85
|
+
}
|
82
86
|
resetFields(){
|
83
87
|
this._fields = {}
|
84
88
|
}
|
@@ -90,6 +94,12 @@ export default class FormComponent extends React.AppComponent {
|
|
90
94
|
let fields = defaultObj(this.getFields());
|
91
95
|
return fields[fieldName] || null;
|
92
96
|
}
|
97
|
+
onValidate(...rest){
|
98
|
+
Forms.trigger("validate",this.props.name,...rest);
|
99
|
+
}
|
100
|
+
onNoValidate(...rest){
|
101
|
+
Forms.trigger("novalidate",this.props.name,...rest);
|
102
|
+
}
|
93
103
|
render (){
|
94
104
|
if(isNonNullString(this.props.perm) && !Auth.isAllowedFromStr(this.props.perm)){
|
95
105
|
return null;
|
@@ -106,3 +106,4 @@ export const getActions = (formName) =>{
|
|
106
106
|
export const warning = (payload,msg) => {if(!isNonNullString(msg)) msg = "⚠ Forms, Missing field name";else msg = "⚠ Forms, "+msg;console.warn(`⚠ Forms, Missing field name: ${payload}`);}
|
107
107
|
|
108
108
|
|
109
|
+
export {MANAGER as Manager,MANAGER}
|
@@ -16,6 +16,8 @@ import {isDesktopMedia} from "$cplatform/dimensions";
|
|
16
16
|
import { matchOperators,getSearchTimeout,canAutoFocusSearchField} from "$ecomponents/Dropdown/utils";
|
17
17
|
import Dialog from "$ecomponents/Dialog";
|
18
18
|
|
19
|
+
const isValidValue =(value)=> typeof value === "string" || typeof value === "number" || isObj(value) || Array.isArray(value);
|
20
|
+
|
19
21
|
const SimpleSelect = React.forwardRef((props,ref)=>{
|
20
22
|
let {style : customStyle,onMount,mode,showSearch,anchorContainerProps,renderText,contentContainerProps,withCheckedIcon,testID,selectionColor,dialogProps,onShow,anchor,onUnmont,controlled:cr,onDismiss,visible:controlledVisible,selectedColor,inputProps,itemProps,itemContainerProps,label,listProps,readOnly,text,filter,renderItem,itemValue,getItemValue,defaultValue,items:menuItems,onPress,onChange,disabled,...rest} = props;
|
21
23
|
const flattenStyle = StyleSheet.flatten(customStyle) || {};
|
@@ -42,8 +44,8 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
|
|
42
44
|
return index;
|
43
45
|
}
|
44
46
|
if(isObj(item)) {
|
45
|
-
if(isNonNullString(item._id)) return item._id;
|
46
|
-
if(isNonNullString(item.code)) return item.code;
|
47
|
+
if(isNonNullString(item._id) || typeof item._id =="number") return item._id;
|
48
|
+
if(isNonNullString(item.code) || typeof item.code =="number") return item.code;
|
47
49
|
return index;
|
48
50
|
}
|
49
51
|
return index;
|
@@ -58,16 +60,16 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
|
|
58
60
|
const isValueDifferent = !compare(defaultValue,value);
|
59
61
|
Object.map(menuItems,(item,index,_index)=>{
|
60
62
|
if(React.isValidElement(item) || !filter({items:menuItems,item,_index,index})) return null;
|
61
|
-
const backupItem = item;
|
62
63
|
if(!isObj(item)) {
|
63
64
|
if(isDecimal(item) || isNonNullString(item)){
|
64
65
|
item = {label:item+""};
|
65
66
|
} else return null;
|
66
67
|
}
|
68
|
+
const backupItem = item;
|
67
69
|
const {code,label,text} = item;
|
68
70
|
let itValue = itemValue({item:backupItem,index,_index});
|
69
71
|
if(itValue === undefined){
|
70
|
-
itValue =
|
72
|
+
itValue = isValidValue(code)? code : index;
|
71
73
|
}
|
72
74
|
const mItem = {item:backupItem,value:itValue,index,_index};
|
73
75
|
let content = renderItem ? renderItem({item:backupItem,index,_index,value:itValue}) : defaultVal(label,text,code);
|
@@ -76,7 +78,10 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
|
|
76
78
|
content = rText;
|
77
79
|
}
|
78
80
|
if(isDecimal(content)) content+="";
|
79
|
-
if(!React.isValidElement(content,true))
|
81
|
+
if(!React.isValidElement(content,true)) {
|
82
|
+
console.warn("Simple select, invalid meuitem content: ",content,mItem,props);
|
83
|
+
return null;
|
84
|
+
}
|
80
85
|
mItem.content = content;
|
81
86
|
mItem.textContent = React.getTextContent(rText) || React.getTextContent(content);
|
82
87
|
if(isValueDifferent && itValue !== undefined && compare(defaultValue,itValue)){
|
@@ -88,9 +93,11 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
|
|
88
93
|
items.push(mItem);
|
89
94
|
});
|
90
95
|
return items;
|
91
|
-
},[menuItems])
|
96
|
+
},[menuItems,defaultValue,value]);
|
92
97
|
React.useEffect(()=>{
|
93
|
-
if(compare(defaultValue,value))
|
98
|
+
if(compare(defaultValue,value)) {
|
99
|
+
return;
|
100
|
+
}
|
94
101
|
selectValue(defaultValue);
|
95
102
|
},[defaultValue]);
|
96
103
|
const setSelected = (node,update)=>{
|
File without changes
|