react-crud-mobile 1.3.51 → 1.3.53

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.
@@ -1,2 +1,2 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),n=e(t),i=require("react-crud-utils"),r=require("react-native"),l=require("react/jsx-runtime"),o=e(require("@expo/vector-icons/Ionicons")),a=require("@expo/vector-icons"),s=e(require("@react-native-community/slider")),c=require("react-native-toast-message"),u=e(c),d=require("react-native-safe-area-context");function f(){return(f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(null,arguments)}function p(e){var o=t.useState(i.Utils.nvl(e.scope,i.ScopeUtils.create(e)))[0],a=i.Utils.nvl(e.crud,o.crud),s=i.Utils.nvl(e.validateScope,"global"),c=i.Utils.nvl(e.part,"child");if(o.isInput())return l.jsx(l.Fragment,{});var u,d,x,h,y,m=function(e){var t,n=e.child;if(!n)return l.jsx(l.Fragment,{});if("string"==typeof n)return l.jsx(l.Fragment,{children:n});var r=n.type,c=f({},n.props);return delete c.children,"string"==typeof r?i.Utils.isEmpty(n.props.children)?l.jsx(r,f({},c)):l.jsx(r,f({},c,{children:l.jsx(p,f({transient:!0,validateScope:s},n.props,{scope:o,crud:a}))})):"function"==typeof r?l.jsx(r,f({validateScope:s},n.props,{parent:o,crud:a})):i.Utils.isEmpty(null==(t=n.props)?void 0:t.children)?l.jsx(l.Fragment,{}):l.jsx(p,f({validateScope:s},n.props,{scope:o,crud:a,transient:!0}))},v=function(){return l.jsx(l.Fragment,e.elements?{children:Object.entries(e.elements).map((function(e,t){return l.jsx(Y,f({crud:a},e[1]))}))}:{children:n.Children.map(e.children,(function(e){return l.jsx(m,{child:e})}))})};return e.transient?l.jsx(v,{}):i.Utils.isEmpty(e.children)&&i.Utils.isEmpty(e.elements)?l.jsx(l.Fragment,{}):l.jsx(l.Fragment,{children:l.jsx(r.View,{style:(u=c,x=i.Utils.nvl(u,"root"),h=g[x],y={},i.Utils.isEmpty(e.style)||(null!=(d=e.style)&&d.push?i.Utils.each(e.style,(function(e){e&&(y=f({},y,e))})):y=f({},e.style)),f({},h,y,o.getStyle(u))),children:l.jsx(v,{})})})}var g=r.StyleSheet.create({child:{width:"100%"},inner:{width:"100%"}});function x(e){var r=e.scope,a=t.useState(0),s=a[0],c=a[1],u=r.original,d=r.getItems(),g=0,x=[],h=t.useState(null),y=h[0],m=h[1],v=function(e,t){void 0===t&&(t=!0),e&&r.execute({event:{validate:t,validateScope:u.validateScope,action:function(){r.changeValue(e.data),y=e,c(s=e.index),m(e)}}})},j=function(e){var t,n="ui-tabs-item ui-click";return(null==(t=y)?void 0:t.index)===e.index&&(n+=" ui-tab-selected"),n},b=function(e,t){var n=f({},e.props);t||(t=r.crud.data);var l=i.CrudUtils.create("tabs",{data:t,changed:t,parent:r.crud}),o=i.Utils.resolve(n,l);!1!==o.rendered&&x.push(f({},o,{child:e,element:o,original:n,index:g++,data:t}))};n.Children.map(e.children,(function(e,t){if(i.Utils.isEmpty(d))b(e,{});else for(var n in d)b(e,d[n])})),y||v(x[s],!1);var S=function(e){v(x[s+e])},w="stepper"===u.layout;return l.jsx("div",{className:r.getStyleClass("inner"),style:r.getStyle("inner"),children:l.jsxs("div",{className:"ui-tabs-content",children:[l.jsx("div",{className:"ui-tabs-items",children:x.map((function(e,t){return l.jsxs("div",{className:j(e),onClick:function(){v(e)},children:[w&&l.jsx("div",{className:"ui-tab-item-divisor"}),l.jsxs("div",{className:"ui-tab-item-inner",children:[w&&l.jsx("div",{className:"ui-step-line"}),l.jsx("div",{className:"ui-tab-item-label",children:w?e.index+1:e.label})]})]},i.Utils.key(u.id,"tab",t))}))}),y&&l.jsxs(l.Fragment,{children:[w&&l.jsx("div",{className:"ui-tabs-label",children:y.label}),l.jsx("div",{className:"ui-tabs-area",children:l.jsx(p,f({},e,{scope:r,children:y.child}))}),"stepper"===u.layout&&l.jsxs("div",{className:"ui-tabs-actions",children:[l.jsx(le.Output,{space:6,layout:"left",children:l.jsx(le.Include,f({},e,{transient:!0,name:"left",default:l.jsx(le.Button,{rendered:s>0,icon:l.jsx(o,{}),click:function(){S(-1)}})}))}),l.jsx(le.Output,{space:6,layout:"right",children:l.jsx(le.Include,f({},e,{transient:!0,name:"right",default:l.jsx(le.Button,{rendered:s<x.length-1,icon:l.jsx(o,{}),click:function(){S(1)}})}))})]})]})]})})}function h(e){var t=e.scope;return t.getItems(),i.Utils.asList(t.original.columns),l.jsx("div",{className:"ui-chart-data"})}function y(e){return l.jsx(r.TouchableOpacity,{onPress:function(){r.Linking.openURL("https://reactnative.dev/")},children:l.jsx(r.Text,{style:m.link,children:"Clique aqui para acessar o React Native"})})}var m={link:{}};function v(e){return l.jsx(l.Fragment,{children:l.jsx(y,f({},e.defaultsInput,e.defaultsUI))})}function j(e){return l.jsx(r.TouchableOpacity,{onPress:function(){r.Linking.openURL("https://reactnative.dev/")},children:l.jsx(r.Text,{style:b.link,children:"Clique aqui para acessar o React Native"})})}var b={link:{}};function S(e){var t=e.scope,n=t.getValue(),r={ion:a.Ionicons,ant:a.AntDesign,entypo:a.Entypo,evil:a.EvilIcons,material:a.MaterialCommunityIcons},o=i.Utils.nvl(t.original.library,"ion");return l.jsx(r[o],{name:n,style:t.getStyle("icon")})}var w={small:{minWidth:30,height:30}};function C(e){var t=e.scope,n=t.original,o=i.Utils.nvl(n.size,"default"),s=i.Utils.nvl(n.align,"center"),c=i.Utils.nvl(n.variant,"default"),u=n.color,d=t.getLabel(),p=n.icon;u||(u="primaryLight");var g={buttonLabel:{color:"#ffffff",fontWeight:"500",fontSize:16},buttonInner:{flexDirection:"row",alignItems:"center",justifyContent:"center",height:44,minWidth:44},buttonIcon:{color:"#fff",fontSize:18},button:{backgroundColor:u,borderRadius:24,gap:10,justifyContent:"center",alignItems:"center",flexDirection:"row"}},x=function(e,n){var r=f({},g[e],n);return"text"!==c&&"outlined"!==c||(r.backgroundColor="transparent",r.color=i.Utils.nvl(u,"text")),"small"===o&&(r.fontSize=12,r.fontWeight=500),"medium"===o&&(r.fontSize=14,r.fontWeight=500),"left"===s&&(r.justifyContent="flex-start"),t.getStyle(e,r)},h={};h.button=p?{height:40,padding:0}:{height:50};var y=i.Utils.call((function(){var e=f({},null==h?void 0:h.button);"outlined"===c&&(e.borderWidth=1,e.borderColor=i.Utils.nvl(u,"text")),o&&(e=f({},e,w[o]));var t=x("button",e);if(!t.width){var n=t.height;"number"==typeof n&&(t.minWidth=n)}return t})),m=x("buttonLabel"),v=i.Utils.call((function(){var e=x("buttonIcon",h.icon);return e.fontSize=i.Utils.nvl(m.fontSize,e.fontSize),e}));return l.jsx(r.TouchableHighlight,{underlayColor:"transparent",onPress:function(e){t.call("click",{})},style:y,children:l.jsxs(l.Fragment,{children:[p&&l.jsx(l.Fragment,{children:l.jsx(a.Ionicons,{size:i.Utils.nvl(n.iconSize,30),style:v,name:p})}),d&&l.jsx(r.Text,{style:m,children:d})]})})}var T=function(){function e(){}return e.syncTheme=function(){},e}();function U(e){var n,o,s,c,u=t.useState(!1),d=u[0],p=u[1],g=e.scope,x=g.original,h=i.Utils.nvl(g.getOptions(),[]),y=g.attr("placeholder","Selecione..."),m=g.getDisplayValue(),v=g.getTheme(),j=i.Utils.nvl(null==(n=v.styles)||null==(n=n.defaults)?void 0:n.header,{}),b=function(){p(!d)},S=t.useRef(null),w=i.Utils.nvl(null==(o=v.colors)?void 0:o.text,"#100e0e"),C=i.Utils.nvl(j.color,"white"),U={color:C},V=function(e,t){var n=f({},k[e],t);return g.getStyle(e,n)};return t.useEffect((function(){T.syncTheme()}),[d]),l.jsxs(r.View,{style:V("selectRoot"),children:[l.jsxs(r.TouchableOpacity,{onPress:b,style:V("selectInput"),children:[l.jsx(r.Text,{style:V("selectLabel"),children:i.Utils.nvl(m,y)}),l.jsx(a.Ionicons,{name:"chevron-down-outline",size:g.getPart("iconSize",null,24),color:g.getPart("iconColor",null,w),style:V("iconStyle",{})})]}),l.jsxs(r.Modal,{animationType:"slide",transparent:!0,visible:d,onRequestClose:function(){return p(!1)},children:[l.jsx(r.SafeAreaView,{style:V("modalTop")}),l.jsxs(r.SafeAreaView,{style:V("modalSafe"),children:[l.jsxs(r.View,{style:g.getStyle("header",j),children:[l.jsx(r.TouchableOpacity,{onPress:b,style:V("modalCloseButton"),children:l.jsx(a.Ionicons,{name:"close",size:24,color:C,style:V("modalCloseText",U)})}),l.jsx(r.Text,{style:V("modalTitle",U),children:y})]}),l.jsx(r.ScrollView,{contentContainerStyle:{flexGrow:1,paddingBottom:50},style:V("modalContent"),nestedScrollEnabled:!0,ref:S,children:l.jsx(r.View,{style:{flex:1,paddingLeft:15,paddingRight:15,paddingTop:10,paddingBottom:10},children:l.jsx(le.List,f({data:h,name:g.getName("list"),layout:"card",click:function(e){var t=e.value;g.changeValue(x.isObject&&null!=t&&t.object?null==t?void 0:t.object:null!=t&&t.value?null==t?void 0:t.value:t),p(!1)},rowStyle:f({paddingLeft:15,paddinRight:15},null==(s=g.original)?void 0:s.rowStyle)},null==(c=g.original)?void 0:c.listProps,{children:l.jsx(le.Value,{value:"#{@this.label}"})}))})})]})]})]},g.getName(g.getPart("modal")+"_"+d))}var k=r.StyleSheet.create({selectRoot:{justifyContent:"flex-start",alignItems:"flex-start",flex:1},selectInput:{width:"100%",flexDirection:"row",borderRadius:5,paddingHorizontal:15,paddingVertical:10},selectLabel:{flex:1},modalTop:{backgroundColor:"primary",width:"100%"},modalSafe:{flex:1,width:"100%",backgroundColor:"background"},modalCloseButton:{padding:10},modalCloseText:{fontSize:18,color:"white"},modalTitle:{fontSize:18,fontWeight:"bold",marginLeft:10},modalContent:{flex:1,backgroundColor:"background"}});function V(e){var n=e.scope,o=i.Utils.nvl(n.getValue(),!1),a=t.useState(o),s=a[1];return l.jsx(r.Switch,{value:a[0],style:n.getStyle("element"),onValueChange:function(e){n.changeValue(e),s(e)}})}function I(e){var n=e.scope,r=i.Utils.nvl(n.getValue(),0),o=t.useState(r),a=o[0],c=o[1],u=n.attr("step",1),d=n.attr("min",0),p=n.attr("min",100),g=function(e){var t=i.ComponentUtils.getViewScope();if(n.original.debug&&console.log(t),t){var r,l=t.get("scrollRef");l&&(null==(r=l.current)||null==r.setNativeProps||r.setNativeProps({scrollEnabled:e}))}};return l.jsx(l.Fragment,{children:l.jsx(s,{minimumValue:d,maximumValue:p,step:u,minimumTrackTintColor:"#1EB1FC",maximumTrackTintColor:"#d3d3d3",thumbTintColor:"#1EB1FC",value:a,onSlidingStart:function(){return g(!1)},onSlidingComplete:function(){return g(!0)},style:f({width:"100%",height:40},n.getStyle("element")),onValueChange:function(e){e=i.Utils.nvl(e,0),console.log(e),n.changeValue(e),c(e)}})})}function F(e){return l.jsx(r.TouchableOpacity,{onPress:function(){r.Linking.openURL("https://reactnative.dev/")},children:l.jsx(r.Text,{style:P.link,children:"Clique aqui para acessar o React Native"})})}var P={link:{}};function R(e){return l.jsx(r.TouchableOpacity,{onPress:function(){r.Linking.openURL("https://reactnative.dev/")},children:l.jsx(r.Text,{style:z.link,children:"Clique aqui para acessar o React Native"})})}var z={link:{}};function L(e){var n=e.scope,o=i.Utils.call((function(){var e=i.Utils.nvl(n.getValue(),"");return e&&null!=e&&e.push?e.join(", ").trim():e})),s=n.getLabel(),c=n.getPart("placeholder",null,s),u=n.original,d=t.useState(o),p=d[0],g=d[1],x=function(e,t){return f({},n.getStyle(e,E[e]),t)},h=function(){var e=u.icon;return l.jsx(l.Fragment,e?"string"==typeof e?{children:u.icon&&l.jsx(a.Ionicons,{name:u.icon,size:n.attr("iconSize",20),color:n.attr("iconColor","#888")})}:{children:e}:{})};return l.jsxs(l.Fragment,{children:[l.jsxs(r.View,{style:x("base"),children:[n.getPart("left"),l.jsx(r.TextInput,{style:x("input"),onChangeText:function(e){e=n.changeValue(e),g(e)},value:p,placeholder:c}),l.jsx(h,{})]}),n.getPart("right")]})}var E=r.StyleSheet.create({base:{flex:1,width:"100%",paddingBottom:0,paddingTop:0,alignItems:"center",borderWidth:1,borderColor:"borderColor",borderRadius:5,paddingHorizontal:15,alignSelf:"flex-start",flexDirection:"row",flexWrap:"wrap",gap:10},icon:{marginRight:10},input:{marginHorizontal:0,marginVertical:0,height:40,flex:1}});function D(e){var n,o=e.scope,a=e.index,s=o.original,c=e.item,u=o.getPart("cols",void 0,-1),d=Math.floor(100/u)+"%",g=null==(n={repeat:W,list:B})?void 0:n[s.type],x=""+o.key("row",a,""),h=t.useState(i.ScopeUtils.create(f({},s,{parent:o,name:x,crud:o.crud,index:a,type:"row",data:c})))[0],y=t.useRef(null),m=function(e,n){var i=t.useState(!0===n.visible),l=i[0],o=i[1];return t.useEffect((function(){var t=setInterval((function(){var t;if(e.current&&!l&&null!=(t=n.original)&&t.useIsInView)if("web"===r.Platform.OS){var i=null==e.current.getBoundingClientRect?void 0:e.current.getBoundingClientRect();if(i&&"undefined"!=typeof window){var a=window.innerHeight,s=i.top<a&&i.bottom>0;s&&(n.visible=s),o(s)}}else null==e.current.measureInWindow||e.current.measureInWindow((function(e,t,i,l){var a=t<r.Dimensions.get("window").height&&t+l>0;a&&(n.visible=a),o(a)}))}),300);return function(){return clearInterval(t)}}),[e]),l}(y,h),v=function(){return l.jsx(l.Fragment,!m&&s.useIsInView&&!h.visible&&a>20?{}:{children:l.jsx(p,{scope:h,crud:h.crud,children:e.children})})};return l.jsx((function(){var e=t.useState(0),n=e[0],i=e[1],p=o.key("item"),x=function(){var e=h.getStyle("row",f({},g.row,{minHeight:40}));return u>0&&(e.width=d),e};return h.update=function(){o.updateIndex=o.updateIndex+1,i(++n)},!1===h.getPart("renderedItem",void 0,!0)?l.jsx(l.Fragment,{}):s.click?l.jsx(r.TouchableHighlight,{style:x(),underlayColor:"transparent",ref:y,onPress:function(e){e.stopPropagation(),function(e){h.call("click",{value:e,item:e,edit:!0,index:a})}(c)},children:l.jsx(v,{})},p):l.jsx(r.View,{style:x(),ref:y,children:l.jsx(v,{})},p)}),{})}var B=r.StyleSheet.create({row:{padding:5,margin:0,width:"100%",backgroundColor:"background",gap:10,borderRadius:8,justifyContent:"center"}}),W=r.StyleSheet.create({row:{padding:0,width:"100%",justifyContent:"center"}});function q(e){var n,o=e.scope,s=o.crud,c=o.original,u=i.Utils.nvl(o.getPart("cols",void 0,1)),d=null==(n={repeat:N,list:O})?void 0:n[c.type],p=i.ComponentUtils.getDefine(e,"add"),g=c.hideAddWhenEmpty,x=function(){var n=t.useState(o.updateIndex),a=n[0],x=n[1];o.update=function(){o.updateIndex=++a,x(a)};var h,y=o.key("data"),m=i.Utils.call((function(){var e,t=i.Utils.nvl(o.getItems(),[]);if(c.search&&(null==(e=c.list)||!e.url)){var n=s.get("query","").toLowerCase().trim();if(n.length>1){var r=[],l=i.Utils.nvl(c.filterBy,"label");return i.Utils.each(t,(function(e){var t=e[l];t&&t.includes(n)&&r.push(e)})),r}}return t})),v=function(){if(!i.Utils.isEmpty(m))return l.jsx(l.Fragment,{});var e=o.attr("empty","Sem registro");return e?"string"==typeof e?l.jsx(r.Text,{style:o.getStyle("empty",{flex:1,fontWeight:500,fontSize:20,padding:10,textAlign:"center",justifyContent:"center",alignItems:"center"}),children:e}):l.jsx(l.Fragment,{children:e}):l.jsx(l.Fragment,{})};return l.jsxs(r.View,{style:(h=o.getStyle("container",f({},{},d.container)),u>1&&(h=f({},h,{flexDirection:"row",flexWrap:"wrap"})),h),children:[l.jsx(v,{}),m.map((function(t,n){return l.jsx(D,{index:n,item:t,scope:o,children:e.children})})),(!i.Utils.isEmpty(m)||!0!==g)&&l.jsx(l.Fragment,{children:p})]},y)};return l.jsxs(l.Fragment,{children:[!1!==c.search&&l.jsx(le.Text,{placeholder:"Pesquisar...",field:"query",crud:s,style:{marginBottom:10},change:{action:function(){o.search()}},icon:l.jsx(a.Ionicons,{name:"search",size:20,color:"#888"})}),l.jsx(x,{})]})}var O=r.StyleSheet.create({container:{display:"flex",flexWrap:"wrap",gap:10,width:"100%"},text:{fontSize:18,fontWeight:"bold"}}),N=r.StyleSheet.create({container:{display:"flex",flexWrap:"wrap",gap:10,width:"100%"},text:{fontSize:18,fontWeight:"bold"}});function H(e){var n=e.scope,o=i.Utils.nvl(n.getOptions(),[]),a=n.getInputValue(),s=t.useState(0),c=s[0],u=s[1],d=function(e){return(null==e?void 0:e.value)===a},p=function(t){var o=t.item,a=t.index,s=d(o),c=f({},A.text);return s&&(c.color="#ffffff"),i.Utils.isEmpty(e.children)?l.jsx(r.Text,{style:c,children:o.label}):l.jsx(D,{scope:n,item:o.object,index:a,children:e.children})},g=function(e){var t=f({},A.item,n.getStyle("item")),i=Math.floor(100/o.length)+"%";if(d(e)){var r=n.getPart("selectedColor",void 0,"primary");(t=f({},t,n.getStyle("selected",{backgroundColor:r,color:"#ffffff"}))).color||(t.color="#ffffff")}return t.width=i,t};return l.jsx(l.Fragment,{children:o.map((function(e,t){return l.jsx(r.TouchableHighlight,{style:g(e),onPress:function(t){!function(e){n.changeValue(e.object),u(++c)}(e)},children:l.jsx(p,{item:e,index:t})},"k-"+t)}))})}var A=r.StyleSheet.create({container:{flex:1,width:"100%",gap:10,justifyContent:"center",flexDirection:"row"},item:{padding:10,marginVertical:8,backgroundColor:"background",borderRadius:8,justifyContent:"center",width:"auto",flexDirection:"row"},text:{fontSize:15,fontWeight:"500"}});function M(e){var n=e.scope,o=n.original,s=t.useState(0),c=s[0],u=s[1],d=n.getValue(0),p=o.color;p||(p="primary");var g={padding:0,alignItems:"center",height:30,width:30,textAlign:"center",verticalAling:"middle",borderRadius:24,backgroundColor:p,color:"#ffffff",justifyContent:"center"},x={buttonLabel:{color:"#ffffff",fontWeight:"500",fontSize:16},value:{flex:1,flexDirection:"row",textAlign:"center",fontWeight:"500"},buttonInner:{flexDirection:"row",alignItems:"center",justifyContent:"center"},buttonIcon:{color:"#fff",fontSize:18},button:g,addButton:f({},g),delButton:f({},g)},h=function(e){n.changeValue(d+e),u(++c)},y=function(e,t){var i=f({},x[e],t);return n.getStyle(e,i)};return l.jsxs(l.Fragment,{children:[l.jsx(r.TouchableHighlight,{underlayColor:"transparent",onPress:function(){h(-1)},style:y("delButton"),children:l.jsx(a.Ionicons,{size:30,style:y("buttonIcon"),name:"remove"})}),l.jsx(r.Text,{style:y("value"),children:i.Utils.nvl(d,0)}),l.jsx(r.TouchableHighlight,{underlayColor:"transparent",onPress:function(){h(1)},style:y("addButton"),children:l.jsx(a.Ionicons,{size:30,style:y("buttonIcon"),name:"add"})})]})}function G(){var e={success:function(e){return l.jsx(c.BaseToast,f({},e,{style:t.darkToast,contentContainerStyle:{paddingHorizontal:15},text1Style:t.text,text2Style:t.text}))},error:function(e){return l.jsx(c.ErrorToast,f({},e,{style:t.darkToast,text1Style:t.text,text2Style:t.text}))},info:function(e){return l.jsx(c.BaseToast,f({},e,{style:t.darkToast,text1Style:t.text,text2Style:t.text}))}},t=r.StyleSheet.create({darkToast:{backgroundColor:"rgba(34, 34, 34, 0.85)",borderLeftColor:"#222"},text:{color:"#fff",textAlign:"center"}});return l.jsx(u,{config:e})}function _(e){var n,a,s=t.useState(!1),c=s[0],u=s[1],d=t.useState(0),g=d[0],x=d[1],h=i.ViewUtils.getCrud("view"),y=e.scope,m=y.getLabel(),v=y.getTheme(),j=i.Utils.nvl(null==(n=v.styles)||null==(n=n.defaults)?void 0:n.header,{}),b=t.useRef(null),S=function(e,t){var n=f({},K[e],t);return f({},y.getStyle(e,n))},w=function(){y.close({scope:y,crud:y.currentDialog,event:{}})},C=function(e){u(c=e)};y.update=function(){x(++g)},y.dialogShow=function(e){var t=e.crud,n=y.getName("modal"),r=!0===e.edit,l={},o=null;t.is("row")?(l.parent=t.parent.parent,l.search=t.parent,o=t.data):t.is("search")&&(l.parent=t.parent,l.search=t);var a=i.Utils.nvl(e.item,o,{}),s=i.CrudUtils.create("dialog",f({parent:t,root:t,name:n,dialog:h.dialog,data:a,edit:r,scope:y},l));h.dialog=s,y.currentDialog=s,C(!0),y.update()},y.dialogHide=function(e){var t;h.dialog=i.Utils.nvl(y.currentDialog.dialog,null),y.currentDialog=null,C(!1),null!=(t=h.dialog)&&t.scope&&h.dialog.scope.update(),y.update()};var T=y.currentDialog;if(!T)return l.jsx(l.Fragment,{});if(T.uuid!==(null==(a=h.dialog)?void 0:a.uuid))return l.jsx(l.Fragment,{});var U=i.ComponentUtils.getDefine(e,"header","right"),k=i.ComponentUtils.getDefine(e,"bottom");y.put("scrollRef",b),i.ComponentUtils.setViewScope(y);var V=i.Utils.nvl(j.color,"white"),I={color:V},F=y.currentDialog.name+"-"+g;return l.jsxs(r.Modal,{animationType:"slide",transparent:!0,visible:c,onRequestClose:w,children:[l.jsx(r.SafeAreaView,{style:S("modalTop")}),l.jsxs(r.SafeAreaView,{style:S("modalSafe"),children:[l.jsxs(r.View,{style:y.getStyle("header",j),children:[l.jsx(r.TouchableOpacity,{onPress:w,style:S("modalCloseButton"),children:l.jsx(o,{name:"chevron-back-outline",size:24,color:V,style:S("modalCloseText",I)})}),l.jsx(r.Text,{style:S("modalTitle",I),children:m}),!i.Utils.isEmpty(U)&&l.jsx(p,{scope:y,crud:y.currentDialog,transient:!0,children:U})]}),l.jsx(r.ScrollView,{contentContainerStyle:{flexGrow:1,paddingBottom:50},style:S("modalContent"),nestedScrollEnabled:!0,ref:b,children:l.jsx(r.View,{style:{flex:1,paddingLeft:15,paddingRight:15,paddingTop:10,paddingBottom:10},children:l.jsx(p,{scope:y,crud:y.currentDialog,children:e.children})})}),k]}),l.jsx(G,{})]},F)}var K=r.StyleSheet.create({modalTop:{backgroundColor:"primary",width:"100%"},modalSafe:{flex:1,width:"100%",backgroundColor:"background"},modalCloseButton:{padding:10},modalCloseText:{fontSize:18,color:"white"},modalTitle:{fontSize:18,fontWeight:"bold",marginLeft:10},modalContent:{flex:1,backgroundColor:"background"}});function Q(e){var n,o,a=e.scope,s=e.children,c=a.getTheme(),u=a.getPart("header",null,[]),d=i.Utils.nvl(null==(n=c.styles)||null==(n=n.defaults)?void 0:n.header,{}),f=i.Utils.nvl(null==(o=c.styles)||null==(o=o.defaults)?void 0:o.headerText,{}),g=t.useRef(null);t.useEffect((function(){T.syncTheme()}),[]);var x=i.Utils.call((function(){var e=a.getStyle("header",d),t=e.backgroundColor;return t&&(e.color=i.HtmlUtils.getTextColor(t)),e})),h=!i.Utils.isEmpty(u),y=function(){return"string"==typeof u?l.jsx(r.Text,{style:f,children:u}):l.jsx(l.Fragment,{children:u})};return a.put("scrollRef",g),i.ComponentUtils.setViewScope(a),l.jsxs(l.Fragment,{children:[h&&l.jsx(r.View,{style:x,children:l.jsx(y,{})}),l.jsx(r.View,{style:a.getStyle("container",J.container),children:l.jsx(r.ScrollView,{onScroll:function(){var e=i.ViewUtils.getCrud();i.Utils.each(e.scroll,(function(e){e.onScroll&&e.onScroll.call(e)}))},scrollEventThrottle:16,ref:g,nestedScrollEnabled:!0,keyboardShouldPersistTaps:"handled",contentContainerStyle:a.getStyle("contentContainer",{paddingBottom:50}),style:a.getStyle("scroll",J.scroll),children:l.jsx(p,{scope:a,children:s})})}),l.jsx(G,{})]})}var J=r.StyleSheet.create({scroll:{paddingTop:10,paddingBottom:10,paddingLeft:15,paddingRight:15},container:{},view:{}}),X=t.createContext({});function Y(e){var n,o,s=t.useContext(X),c=i.Utils.nvl(e.theme,null==s?void 0:s.theme),d=i.Utils.nvl(e.crud,null==s?void 0:s.crud),g=t.useState(i.ScopeUtils.create(f({crud:d},e,{theme:c})))[0],y=t.useState(0),m=y[0],b=y[1],w=t.useState(null),T=w[0],k=w[1];g.compile(e),d=g.crud;var P=g.getOptions(),z=g.original,E=t.useRef(null);g.update=function(){b(++m)},g.updateElement=function(){b(++m)},g.toast=function(e,t,n){void 0===t&&(t="info"),u.show(f({type:t,text1:e,position:"bottom",visibilityTime:3e3},n))},g.prompt=function(e){var t=e.event;if(t){var n="Você tem certeza que deseja continuar?",l="Atenção",o=t.prompt;"string"==typeof o&&(n=o),"object"==typeof o&&(n=i.Utils.nvl(o.message,n),l=i.Utils.nvl(o.title,l)),r.Alert.alert(l,n,[{text:"Cancelar",style:"cancel"},{text:"Confirmar",onPress:function(){return g.execute(e)}}],{cancelable:!1})}};var D=function(){var e=z.custom;return e?l.jsx(Y,"string"==typeof e?{element:{value:e,type:"dummy"},crud:d}:f({type:e.type,tag:e.type},e.props,{crud:d})):l.jsx(l.Fragment,{})};if(g.is("type","dummy"))return l.jsx(l.Fragment,{children:g.getDisplayValue()});var B=function(){var e=g.getValue();W({target:{value:!(!0===e)}})},W=function(e){var t=e.target.value;g.isType("integer","int","number")?t=parseInt(t):g.isType("decimal")&&(t=parseFloat(t)),g.isType("select","complete")&&(t=g.getSelectedItem(t)),g.changeValue(t),g.update()},O=function(e){g.call("click")},N={scope:g,crud:d,onChange:W};g.isType("password")&&(N.type="password");var A=function(){return!(g.isInput()||i.Utils.isEmpty(e.children)&&i.Utils.isEmpty(e.elements))},G=g.is("type","text","number","integer","int","phone","postalCode","money","password","email"),K=function(e,t){var n,r=i.Utils.nvl(z.type,"none"),l=i.Utils.nvl(e,"root"),o=f({},te[l]),a=A();return r=i.Utils.nvl(z.layout,r),e||a||(o=f({},o)),g.isInput()&&(o=f({},o,ee.input[l])),o=f({},o,null==ee||null==(n=ee[r])?void 0:n[l]),a&&e&&(o=f({},o,ne[e])),f({},o,g.getStyle(e,f({},o,t)))},J=K("element"),$={required:g.isRequired(),size:"small",scope:g,crud:d,style:J,placeholder:g.attr("placeholder","Digite aqui")};g.error=function(e){T=e,k(e)},null!=(n=z.list)&&n.url||null!=(o=z.load)&&o.url||g.start(),t.useEffect((function(){g.start()}));var ie=function(){return"string"==typeof z.icon?l.jsx(a.Ionicons,{name:z.icon,style:g.getStyle("icon")}):l.jsx(l.Fragment,{children:z.icon})};if(g.open=function(e){r.Linking.openURL(e.url)},t.useLayoutEffect((function(){if(null!=E&&E.current&&g.is("type","card","list","tabs","stepper")){var e=null==E?void 0:E.current;if(null!=e&&e.classList){var t=i.HtmlUtils.getBGColor(e);e.classList.add("rgb(255, 255, 255)"===t?"ui-dark":"ui-light")}}})),!g.isRendered()||g.is("type","define"))return l.jsx(l.Fragment,{});var re=r.View,le={};!g.isType("input","grid","list","repeat")&&z.click&&(re=r.TouchableHighlight,le.underlayColor="transparent",le.onPress=O);var oe=function(){return l.jsxs(l.Fragment,{children:[g.getPart("render",null,l.jsx(l.Fragment,{})),g.is("type","button")&&l.jsxs(C,f({},$,{onClick:O,variant:g.attr("variant","outlined"),children:[z.icon&&l.jsx(ie,{}),z.label&&l.jsx(r.Text,{style:g.getPart("label","button"),children:g.getLabel()})]})),g.is("type","icon")&&l.jsx(S,f({},$,{onClick:O,variant:g.attr("variant","outlined"),children:g.getDisplayValue()})),g.is("type","link")&&l.jsxs(j,f({},$,{onClick:O,variant:g.attr("variant","outlined"),children:[z.icon&&l.jsx(ie,{}),z.label&&l.jsx(r.Text,{style:g.getPart("label","link"),children:g.getLabel()})]})),G&&l.jsx(L,f({},N,$,{InputProps:f({},z.inputProps)})),g.is("type","complete","autocomplete")&&l.jsx(v,{scope:g,defaultsInput:N,defaultsUI:$}),g.is("type","quantity")&&l.jsx(M,{scope:g,defaultsInput:N,defaultsUI:$}),g.is("type","checkbox","boolean","switch")&&l.jsx(V,f({checked:!0===g.getValue()},N,{onChange:B})),g.isType("slider")&&l.jsx(I,f({},N,{onChange:B})),g.is("type","select")&&l.jsx(U,f({},N,$,{value:g.getSelectedValue()})),g.is("type","toggle")&&l.jsx(H,f({},N,$,{value:g.getSelectedValue()})),g.is("type","radio")&&l.jsx(R,f({},N,$,{row:!0,children:P.map((function(e,t){return l.jsx(F,{control:l.jsx(R,f({},$)),label:e.label,value:e.value},"i"+t)}))})),g.is("type","custom")&&l.jsx(D,{}),g.is("type","column")&&l.jsxs(l.Fragment,{children:[g.is("format","img")&&l.jsx(r.Image,{source:g.getDisplayValue()}),g.is("format","icon")&&l.jsx(S,{scope:g,crud:d}),!g.is("format","icon","img")&&l.jsx(r.Text,{children:g.getDisplayValue()})]}),g.is("type","output","value")&&l.jsx(r.Text,{style:K("value"),children:g.getDisplayValue()})]})},ae=function(t){var n=t.name,r=t.style;if(e[n]){var o=i.ComponentUtils.getDefine(e,n);if(!i.Utils.isEmpty(o))return l.jsx(p,f({},e,{scope:g,crud:d,style:K(n,r),children:o}))}return l.jsx(l.Fragment,{})},se=function(){return l.jsxs(l.Fragment,{children:[void 0!==z.label&&!1!==z.label&&!g.isType("button","dialog","modal")&&l.jsxs(r.View,{style:K("outerLabel",{alignSelf:"flex-start",flexDirection:"row",display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),children:[l.jsx(r.Text,{style:K("label"),children:g.getLabel()}),l.jsx(ae,{name:"actions",style:{width:"auto"}})]}),!A()&&l.jsxs(l.Fragment,{children:[l.jsx(r.View,{style:K("inner"),children:l.jsx(oe,{})}),T&&l.jsx(r.View,{style:K("error"),children:T})]}),g.isType("list","repeat")&&l.jsx(q,f({},e,{scope:g,crud:d})),g.isType("dialog")&&l.jsx(_,f({},e,{scope:g,crud:d})),g.isType("chart")&&l.jsx(h,f({},e,{scope:g,crud:d})),g.isType("tabs")&&l.jsx(x,f({},e,{scope:g,crud:d})),g.isType("view")&&l.jsx(Q,f({},e,{scope:g,crud:d})),!g.isType("tabs","view","grid","list","define","repeat","modal","dialog","chart")&&l.jsx(p,f({},e,{scope:g,crud:d,style:K("inner")}))]})},ce=function(e){if(g.is("type|layout","card")){var t=f({},K("box",f({},Z.box,{alignSelf:"stretch"})));return l.jsx(r.View,{style:K("card",f({},t)),children:l.jsx(r.View,{style:K("boxInner",{paddingHorizontal:15,paddingVertical:10}),children:e.children})})}return g.isInput()||z.container?l.jsx(r.View,{style:K("container",{padding:5,width:"100%"}),children:e.children}):l.jsx(l.Fragment,{children:e.children})};return l.jsx(X.Provider,{value:{crud:d,theme:c},children:l.jsx(re,f({ref:E,style:K()},le,{children:l.jsx(ce,{children:l.jsx(se,{})})}))})}var Z=r.StyleSheet.create({box:{borderWidth:0,borderColor:"#dedede",borderStyle:"solid",backgroundColor:"white",borderRadius:12,width:"100%",shadowColor:"#000",shadowOpacity:.1,shadowRadius:4}}),$=f({},Z.box),ee={view:{inner:{width:"100%",alignItems:"normal",flex:1},container:{width:"100%",backgroundColor:"background",flex:1,gap:10},root:{width:"100%",flex:1,alignItems:"normal",padding:0}}};ee.input=r.StyleSheet.create({label:{paddingLeft:0},inner:{flex:1,width:"100%",padding:0,gap:10,alignSelf:"flex-start",flexDirection:"row",flexWrap:"wrap"}}),ee.switch={inner:{padding:5}},ee.quantity={inner:f({},$,{backgroundColor:"primarySoft",fontWeight:600,fontSize:16,borderRadius:25,borderWidth:0,padding:5,paddingHorizontal:5,paddingVertical:5,flexWrap:"nowrap",flex:1,flexDirection:"row",justifyContent:"center",alignItems:"center"})},ee.toggle=r.StyleSheet.create({inner:f({},$,{flex:1,width:"100%",gap:10,justifyContent:"center",flexDirection:"row",paddingHorizontal:10,paddingVertical:0,alignSelf:"flex-start",flexWrap:"nowrap"})});var te=r.StyleSheet.create({root:{gap:5,flexDirection:"column",flexWrap:"wrap",width:"100%",alignItems:"flex-start"},label:{fontWeight:400,marginTop:5,fontSize:12,color:"labelColor"},inner:{width:"100%"}}),ne=r.StyleSheet.create({root:{gap:10},label:{width:"100%",fontWeight:500,fontSize:24}});function ie(e){if(!1===e.rendered)return l.jsx(l.Fragment,{});var t=i.ComponentUtils.getDefine(e,e.name,e.position);return i.Utils.isEmpty(t)&&(t=e.default),i.Utils.isEmpty(t)?l.jsx(l.Fragment,{children:t}):l.jsx((function(t){var n=e.tag;return i.Utils.isEmpty(n)?l.jsx(l.Fragment,{children:t.children}):l.jsx(n,f({},t,{children:t.children}))}),f({},e.tagProps,{children:l.jsx(p,f({transient:!0},e,{scope:e.scope,crud:e.crud,part:e.name,children:t}))}))}var re=["type"],le={List:function(e){return l.jsx(Y,f({},e,{type:"list"}))},Row:function(e){return l.jsx(Y,f({},e,{type:"row"}))},Value:function(e){return l.jsx(Y,f({},e,{type:"value"}))},Label:function(e){return l.jsx(Y,f({},e,{type:"label"}))},Repeat:function(e){return l.jsx(Y,f({},e,{type:"repeat",props:{search:!1}}))},Define:function(e){return l.jsx(Y,f({},e,{type:"define"}))},Include:function(e){return l.jsx(ie,f({},e))},Column:function(e){var t=function(e,t){if(null==e)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;n[i]=e[i]}return n}(e,re);return l.jsx(Y,f({},t,{type:"column"}))},Input:function(e){return l.jsx(Y,f({},e))},Text:function(e){return l.jsx(Y,f({},e,{type:"text"}))},Email:function(e){return l.jsx(Y,f({},e,{type:"email"}))},Button:function(e){return l.jsx(Y,f({},e,{type:"button"}))},Link:function(e){return l.jsx(Y,f({},e,{type:"link"}))},Icon:function(e){return l.jsx(Y,f({},e,{type:"icon"}))},Output:function(e){return l.jsx(Y,f({},e,{type:"output"}))},Form:function(e){return l.jsx(Y,f({},e,{type:"form"}))},Crud:function(e){return l.jsx(Y,f({},e,{type:"crud"}))},View:function(e){return l.jsx(Y,f({},e,{type:"view",transient:!0}))},Bottom:function(e){return l.jsx(Y,f({},e,{type:"bottom"}))},Dialog:function(e){return l.jsx(Y,f({},e,{type:"dialog"}))},Content:function(e){return l.jsx(Y,f({},e,{type:"content"}))},Top:function(e){return l.jsx(Y,f({},e,{type:"top"}))},Card:function(e){return l.jsx(Y,f({},e,{type:"card"}))},Tab:function(e){return l.jsx(Y,f({},e,{type:"tab"}))},Tabs:function(e){return l.jsx(Y,f({},e,{type:"tabs"}))},Step:function(e){return l.jsx(Y,f({},e,{type:"tab",layout:"step"}))},Stepper:function(e){return l.jsx(Y,f({},e,{type:"tabs",layout:"stepper"}))},Money:function(e){return l.jsx(Y,f({},e,{type:"money"}))},Chart:function(e){return l.jsx(Y,f({},e,{type:"chart"}))},Password:function(e){return l.jsx(Y,f({},e,{type:"password"}))},Complete:function(e){return l.jsx(Y,f({},e,{type:"complete"}))},Checkbox:function(e){return l.jsx(Y,f({},e,{type:"switch"}))},Switch:function(e){return l.jsx(Y,f({},e,{type:"switch"}))},Radio:function(e){return l.jsx(Y,f({},e,{type:"radio"}))},Select:function(e){return l.jsx(Y,f({},e,{type:"select"}))},Toggle:function(e){return l.jsx(Y,f({},e,{type:"toggle"}))},Entity:function(e){return l.jsx(Y,f({},e,{type:"entity"}))},Element:function(e){return l.jsx(Y,f({},e,{type:"element"}))},Quantity:function(e){return l.jsx(Y,f({},e,{type:"quantity"}))},Slider:function(e){return l.jsx(Y,f({},e,{type:"slider"}))},SafeView:function(e){var n,o=i.ThemeUtils.getCurrentTheme();return i.Utils.isEmpty(o)&&(o=i.useTheme()),t.useEffect((function(){r.StatusBar.setBarStyle(i.Utils.nvl(o.theme,"light-content")),null==r.StatusBar.setBackgroundColor||r.StatusBar.setBackgroundColor(o.colors.theme)}),[]),l.jsxs(d.SafeAreaProvider,{children:[l.jsx(r.StatusBar,{barStyle:"light-content"}),l.jsx(d.SafeAreaView,{style:f({backgroundColor:null==(n=o.colors)?void 0:n.theme},e.viewStyle,{flex:1}),children:l.jsx(r.KeyboardAvoidingView,{behavior:"ios"===r.Platform.OS?"padding":"height",style:{flex:1,justifyContent:"center"},children:l.jsx(r.TouchableWithoutFeedback,{onPress:function(){"web"!==r.Platform.OS&&r.Keyboard.dismiss()},accessible:!1,children:l.jsx(l.Fragment,{children:e.children})})})})]})}};exports.UI=le;
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),n=e(t),r=require("react-crud-utils"),i=require("react-native"),l=require("react/jsx-runtime"),o=e(require("@expo/vector-icons/Ionicons")),a=require("@expo/vector-icons"),s=e(require("@react-native-community/slider")),c=require("react-native-toast-message"),u=e(c),d=e(require("react-native-draggable-flatlist")),f=require("react-native-safe-area-context");function p(){return(p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}function g(e){var o=t.useState(r.Utils.nvl(e.scope,r.ScopeUtils.create(e)))[0],a=r.Utils.nvl(e.crud,o.crud),s=r.Utils.nvl(e.validateScope,"global"),c=r.Utils.nvl(e.part,"child");if(o.isInput())return l.jsx(l.Fragment,{});var u,d,f,h,y,m=function(e){var t,n=e.child;if(!n)return l.jsx(l.Fragment,{});if("string"==typeof n)return l.jsx(l.Fragment,{children:n});var i=n.type,c=p({},n.props);return delete c.children,"string"==typeof i?r.Utils.isEmpty(n.props.children)?l.jsx(i,p({},c)):l.jsx(i,p({},c,{children:l.jsx(g,p({transient:!0,validateScope:s},n.props,{scope:o,crud:a}))})):"function"==typeof i?l.jsx(i,p({validateScope:s},n.props,{parent:o,crud:a})):r.Utils.isEmpty(null==(t=n.props)?void 0:t.children)?l.jsx(l.Fragment,{}):l.jsx(g,p({validateScope:s},n.props,{scope:o,crud:a,transient:!0}))},v=function(){return l.jsx(l.Fragment,e.elements?{children:Object.entries(e.elements).map((function(e,t){return l.jsx(ee,p({crud:a},e[1]))}))}:{children:n.Children.map(e.children,(function(e){return l.jsx(m,{child:e})}))})};return e.transient?l.jsx(v,{}):r.Utils.isEmpty(e.children)&&r.Utils.isEmpty(e.elements)?l.jsx(l.Fragment,{}):l.jsx(l.Fragment,{children:l.jsx(i.View,{style:(u=c,f=r.Utils.nvl(u,"root"),h=x[f],y={},r.Utils.isEmpty(e.style)||(null!=(d=e.style)&&d.push?r.Utils.each(e.style,(function(e){e&&(y=p({},y,e))})):y=p({},e.style)),p({},h,y,o.getStyle(u))),children:l.jsx(v,{})})})}var x=i.StyleSheet.create({child:{width:"100%"},inner:{width:"100%"}});function h(e){var i=e.scope,a=t.useState(0),s=a[0],c=a[1],u=i.original,d=i.getItems(),f=0,x=[],h=t.useState(null),y=h[0],m=h[1],v=function(e,t){void 0===t&&(t=!0),e&&i.execute({event:{validate:t,validateScope:u.validateScope,action:function(){i.changeValue(e.data),y=e,c(s=e.index),m(e)}}})},j=function(e){var t,n="ui-tabs-item ui-click";return(null==(t=y)?void 0:t.index)===e.index&&(n+=" ui-tab-selected"),n},b=function(e,t){var n=p({},e.props);t||(t=i.crud.data);var l=r.CrudUtils.create("tabs",{data:t,changed:t,parent:i.crud}),o=r.Utils.resolve(n,l);!1!==o.rendered&&x.push(p({},o,{child:e,element:o,original:n,index:f++,data:t}))};n.Children.map(e.children,(function(e,t){if(r.Utils.isEmpty(d))b(e,{});else for(var n in d)b(e,d[n])})),y||v(x[s],!1);var S=function(e){v(x[s+e])},w="stepper"===u.layout;return l.jsx("div",{className:i.getStyleClass("inner"),style:i.getStyle("inner"),children:l.jsxs("div",{className:"ui-tabs-content",children:[l.jsx("div",{className:"ui-tabs-items",children:x.map((function(e,t){return l.jsxs("div",{className:j(e),onClick:function(){v(e)},children:[w&&l.jsx("div",{className:"ui-tab-item-divisor"}),l.jsxs("div",{className:"ui-tab-item-inner",children:[w&&l.jsx("div",{className:"ui-step-line"}),l.jsx("div",{className:"ui-tab-item-label",children:w?e.index+1:e.label})]})]},r.Utils.key(u.id,"tab",t))}))}),y&&l.jsxs(l.Fragment,{children:[w&&l.jsx("div",{className:"ui-tabs-label",children:y.label}),l.jsx("div",{className:"ui-tabs-area",children:l.jsx(g,p({},e,{scope:i,children:y.child}))}),"stepper"===u.layout&&l.jsxs("div",{className:"ui-tabs-actions",children:[l.jsx(se.Output,{space:6,layout:"left",children:l.jsx(se.Include,p({},e,{transient:!0,name:"left",default:l.jsx(se.Button,{rendered:s>0,icon:l.jsx(o,{}),click:function(){S(-1)}})}))}),l.jsx(se.Output,{space:6,layout:"right",children:l.jsx(se.Include,p({},e,{transient:!0,name:"right",default:l.jsx(se.Button,{rendered:s<x.length-1,icon:l.jsx(o,{}),click:function(){S(1)}})}))})]})]})]})})}function y(e){var t=e.scope;return t.getItems(),r.Utils.asList(t.original.columns),l.jsx("div",{className:"ui-chart-data"})}function m(e){return l.jsx(i.TouchableOpacity,{onPress:function(){i.Linking.openURL("https://reactnative.dev/")},children:l.jsx(i.Text,{style:v.link,children:"Clique aqui para acessar o React Native"})})}var v={link:{}};function j(e){return l.jsx(l.Fragment,{children:l.jsx(m,p({},e.defaultsInput,e.defaultsUI))})}function b(e){return l.jsx(i.TouchableOpacity,{onPress:function(){i.Linking.openURL("https://reactnative.dev/")},children:l.jsx(i.Text,{style:S.link,children:"Clique aqui para acessar o React Native"})})}var S={link:{}};function w(e){var t=e.scope,n=t.getValue(),i={ion:a.Ionicons,ant:a.AntDesign,entypo:a.Entypo,evil:a.EvilIcons,material:a.MaterialCommunityIcons},o=r.Utils.nvl(t.original.library,"ion");return l.jsx(i[o],{name:n,style:t.getStyle("icon")})}var C={small:{minWidth:30,height:30}};function U(e){var t=e.scope,n=t.original,o=r.Utils.nvl(n.size,"default"),s=r.Utils.nvl(n.align,"center"),c=r.Utils.nvl(n.variant,"default"),u=n.color,d=t.getLabel(),f=n.icon;u||(u="primaryLight");var g={buttonLabel:{color:"#ffffff",fontWeight:"500",fontSize:16},buttonInner:{flexDirection:"row",alignItems:"center",justifyContent:"center",height:44,minWidth:44},buttonIcon:{color:"#fff",fontSize:18},button:{backgroundColor:u,borderRadius:24,gap:10,justifyContent:"center",alignItems:"center",flexDirection:"row"}},x=function(e,n){var i=p({},g[e],n);return"text"!==c&&"outlined"!==c||(i.backgroundColor="transparent",i.color=r.Utils.nvl(u,"text")),"small"===o&&(i.fontSize=12,i.fontWeight=500),"medium"===o&&(i.fontSize=14,i.fontWeight=500),"left"===s&&(i.justifyContent="flex-start"),t.getStyle(e,i)},h={};h.button=f?{height:40,padding:0}:{height:50};var y=r.Utils.call((function(){var e=p({},null==h?void 0:h.button);"outlined"===c&&(e.borderWidth=1,e.borderColor=r.Utils.nvl(u,"text")),o&&(e=p({},e,C[o]));var t=x("button",e);if(!t.width){var n=t.height;"number"==typeof n&&(t.minWidth=n)}return t})),m=x("buttonLabel"),v=r.Utils.call((function(){var e=x("buttonIcon",h.icon);return e.fontSize=r.Utils.nvl(m.fontSize,e.fontSize),e}));return l.jsx(i.TouchableHighlight,{underlayColor:"transparent",onPress:function(e){t.call("click",{})},style:y,children:l.jsxs(l.Fragment,{children:[f&&l.jsx(l.Fragment,{children:l.jsx(a.Ionicons,{size:r.Utils.nvl(n.iconSize,30),style:v,name:f})}),d&&l.jsx(i.Text,{style:m,children:d})]})})}var T=function(){function e(){}return e.syncTheme=function(){},e}();function I(e){var n,o,s,c,u=t.useState(!1),d=u[0],f=u[1],g=e.scope,x=g.original,h=r.Utils.nvl(g.getOptions(),[]),y=g.attr("placeholder","Selecione..."),m=g.getDisplayValue(),v=g.getTheme(),j=r.Utils.nvl(null==(n=v.styles)||null==(n=n.defaults)?void 0:n.header,{}),b=function(){f(!d)},S=t.useRef(null),w=r.Utils.nvl(null==(o=v.colors)?void 0:o.text,"#100e0e"),C=r.Utils.nvl(j.color,"white"),U={color:C},I=function(e,t){var n=p({},k[e],t);return g.getStyle(e,n)};return t.useEffect((function(){T.syncTheme()}),[d]),l.jsxs(i.View,{style:I("selectRoot"),children:[l.jsxs(i.TouchableOpacity,{onPress:b,style:I("selectInput"),children:[l.jsx(i.Text,{style:I("selectLabel"),children:r.Utils.nvl(m,y)}),l.jsx(a.Ionicons,{name:"chevron-down-outline",size:g.getPart("iconSize",null,24),color:g.getPart("iconColor",null,w),style:I("iconStyle",{})})]}),l.jsxs(i.Modal,{animationType:"slide",transparent:!0,visible:d,onRequestClose:function(){return f(!1)},children:[l.jsx(i.SafeAreaView,{style:I("modalTop")}),l.jsxs(i.SafeAreaView,{style:I("modalSafe"),children:[l.jsxs(i.View,{style:g.getStyle("header",j),children:[l.jsx(i.TouchableOpacity,{onPress:b,style:I("modalCloseButton"),children:l.jsx(a.Ionicons,{name:"close",size:24,color:C,style:I("modalCloseText",U)})}),l.jsx(i.Text,{style:I("modalTitle",U),children:y})]}),l.jsx(i.ScrollView,{contentContainerStyle:{flexGrow:1,paddingBottom:50},style:I("modalContent"),nestedScrollEnabled:!0,ref:S,children:l.jsx(i.View,{style:{flex:1,paddingLeft:15,paddingRight:15,paddingTop:10,paddingBottom:10},children:l.jsx(se.List,p({data:h,name:g.getName("list"),layout:"card",click:function(e){var t=e.value;g.changeValue(x.isObject&&null!=t&&t.object?null==t?void 0:t.object:null!=t&&t.value?null==t?void 0:t.value:t),f(!1)},rowStyle:p({paddingLeft:15,paddinRight:15},null==(s=g.original)?void 0:s.rowStyle)},null==(c=g.original)?void 0:c.listProps,{children:l.jsx(se.Value,{value:"#{@this.label}"})}))})})]})]})]},g.getName(g.getPart("modal")+"_"+d))}var k=i.StyleSheet.create({selectRoot:{justifyContent:"flex-start",alignItems:"flex-start",flex:1},selectInput:{width:"100%",flexDirection:"row",borderRadius:5,paddingHorizontal:15,paddingVertical:10},selectLabel:{flex:1},modalTop:{backgroundColor:"primary",width:"100%"},modalSafe:{flex:1,width:"100%",backgroundColor:"background"},modalCloseButton:{padding:10},modalCloseText:{fontSize:18,color:"white"},modalTitle:{fontSize:18,fontWeight:"bold",marginLeft:10},modalContent:{flex:1,backgroundColor:"background"}});function V(e){var n=e.scope,o=r.Utils.nvl(n.getValue(),!1),a=t.useState(o),s=a[1];return l.jsx(i.Switch,{value:a[0],style:n.getStyle("element"),onValueChange:function(e){n.changeValue(e),s(e)}})}function F(e){var n=e.scope,i=r.Utils.nvl(n.getValue(),0),o=t.useState(i),a=o[0],c=o[1],u=n.attr("step",1),d=n.attr("min",0),f=n.attr("min",100),g=function(e){var t=r.ComponentUtils.getViewScope();if(n.original.debug&&console.log(t),t){var i,l=t.get("scrollRef");l&&(null==(i=l.current)||null==i.setNativeProps||i.setNativeProps({scrollEnabled:e}))}};return l.jsx(l.Fragment,{children:l.jsx(s,{minimumValue:d,maximumValue:f,step:u,minimumTrackTintColor:"#1EB1FC",maximumTrackTintColor:"#d3d3d3",thumbTintColor:"#1EB1FC",value:a,onSlidingStart:function(){return g(!1)},onSlidingComplete:function(){return g(!0)},style:p({width:"100%",height:40},n.getStyle("element")),onValueChange:function(e){e=r.Utils.nvl(e,0),console.log(e),n.changeValue(e),c(e)}})})}function P(e){return l.jsx(i.TouchableOpacity,{onPress:function(){i.Linking.openURL("https://reactnative.dev/")},children:l.jsx(i.Text,{style:z.link,children:"Clique aqui para acessar o React Native"})})}var z={link:{}};function E(e){return l.jsx(i.TouchableOpacity,{onPress:function(){i.Linking.openURL("https://reactnative.dev/")},children:l.jsx(i.Text,{style:L.link,children:"Clique aqui para acessar o React Native"})})}var L={link:{}};function R(e){var n=e.scope,o=r.Utils.call((function(){var e=r.Utils.nvl(n.getValue(),"");return e&&null!=e&&e.push?e.join(", ").trim():e})),s=n.getLabel(),c=n.getPart("placeholder",null,s),u=n.original,d=t.useState(o),f=d[0],g=d[1],x=function(e,t){return p({},n.getStyle(e,D[e]),t)},h=function(){var e=u.icon;return l.jsx(l.Fragment,e?"string"==typeof e?{children:u.icon&&l.jsx(a.Ionicons,{name:u.icon,size:n.attr("iconSize",20),color:n.attr("iconColor","#888")})}:{children:e}:{})};return l.jsxs(l.Fragment,{children:[l.jsxs(i.View,{style:x("base"),children:[n.getPart("left"),l.jsx(i.TextInput,{style:x("input"),onChangeText:function(e){e=n.changeValue(e),g(e)},value:f,placeholder:c}),l.jsx(h,{})]}),n.getPart("right")]})}var D=i.StyleSheet.create({base:{flex:1,width:"100%",paddingBottom:0,paddingTop:0,alignItems:"center",borderWidth:1,borderColor:"borderColor",borderRadius:5,paddingHorizontal:15,alignSelf:"flex-start",flexDirection:"row",flexWrap:"wrap",gap:10},icon:{marginRight:10},input:{marginHorizontal:0,marginVertical:0,height:40,flex:1}});function B(e){var n,o=e.scope,a=e.index,s=o.original,c=e.item,u=o.getPart("cols",void 0,-1),d=Math.floor(100/u)+"%",f=null==(n={repeat:q,list:W})?void 0:n[s.type],x=""+o.key("row",a,""),h=t.useState(r.ScopeUtils.create(p({},s,{parent:o,name:x,crud:o.crud,index:a,type:"row",data:c})))[0],y=t.useRef(null),m=function(e,n){var r=t.useState(!0===n.visible),l=r[0],o=r[1];return t.useEffect((function(){var t=setInterval((function(){var t;if(e.current&&!l&&null!=(t=n.original)&&t.useIsInView)if("web"===i.Platform.OS){var r=null==e.current.getBoundingClientRect?void 0:e.current.getBoundingClientRect();if(r&&"undefined"!=typeof window){var a=window.innerHeight,s=r.top<a&&r.bottom>0;s&&(n.visible=s),o(s)}}else null==e.current.measureInWindow||e.current.measureInWindow((function(e,t,r,l){var a=t<i.Dimensions.get("window").height&&t+l>0;a&&(n.visible=a),o(a)}))}),300);return function(){return clearInterval(t)}}),[e]),l}(y,h),v=function(){return l.jsx(l.Fragment,!m&&s.useIsInView&&!h.visible&&a>20?{}:{children:l.jsx(g,{scope:h,crud:h.crud,children:e.children})})};return l.jsx((function(){var e=t.useState(0),n=e[0],r=e[1],g=o.key("item"),x=function(){var e=h.getStyle("row",p({},f.row,{minHeight:40}));return u>0&&(e.width=d),e};return h.update=function(){o.updateIndex=o.updateIndex+1,r(++n)},!1===h.getPart("renderedItem",void 0,!0)?l.jsx(l.Fragment,{}):s.click?l.jsx(i.TouchableHighlight,{style:x(),underlayColor:"transparent",ref:y,onPress:function(e){e.stopPropagation(),function(e){h.call("click",{value:e,item:e,edit:!0,index:a})}(c)},children:l.jsx(v,{})},g):l.jsx(i.View,{style:x(),ref:y,children:l.jsx(v,{})},g)}),{})}var W=i.StyleSheet.create({row:{padding:5,margin:0,width:"100%",backgroundColor:"background",gap:10,borderRadius:8,justifyContent:"center"}}),q=i.StyleSheet.create({row:{padding:0,width:"100%",justifyContent:"center"}});function O(e){var n,o=e.scope,s=o.crud,c=o.original,u=r.Utils.nvl(o.getPart("cols",void 0,1)),d=null==(n={repeat:A,list:N})?void 0:n[c.type],f=r.ComponentUtils.getDefine(e,"add"),g=c.hideAddWhenEmpty,x=function(){var n=t.useState(o.updateIndex),a=n[0],x=n[1];o.update=function(){o.updateIndex=++a,x(a)};var h,y=o.key("data"),m=r.Utils.call((function(){var e,t=r.Utils.nvl(o.getItems(),[]);if(c.search&&(null==(e=c.list)||!e.url)){var n=s.get("query","").toLowerCase().trim();if(n.length>1){var i=[],l=r.Utils.nvl(c.filterBy,"label");return r.Utils.each(t,(function(e){var t=e[l];t&&t.includes(n)&&i.push(e)})),i}}return t})),v=function(){if(!r.Utils.isEmpty(m))return l.jsx(l.Fragment,{});var e=o.attr("empty","Sem registro");return e?"string"==typeof e?l.jsx(i.Text,{style:o.getStyle("empty",{flex:1,fontWeight:500,fontSize:20,padding:10,textAlign:"center",justifyContent:"center",alignItems:"center"}),children:e}):l.jsx(l.Fragment,{children:e}):l.jsx(l.Fragment,{})};return l.jsxs(i.View,{style:(h=o.getStyle("container",p({},{},d.container)),u>1&&(h=p({},h,{flexDirection:"row",flexWrap:"wrap"})),h),children:[l.jsx(v,{}),m.map((function(t,n){return l.jsx(B,{index:n,item:t,scope:o,children:e.children})})),(!r.Utils.isEmpty(m)||!0!==g)&&l.jsx(l.Fragment,{children:f})]},y)};return l.jsxs(l.Fragment,{children:[!1!==c.search&&l.jsx(se.Text,{placeholder:"Pesquisar...",field:"query",crud:s,style:{marginBottom:10},change:{action:function(){o.search()}},icon:l.jsx(a.Ionicons,{name:"search",size:20,color:"#888"})}),l.jsx(x,{})]})}var N=i.StyleSheet.create({container:{display:"flex",flexWrap:"wrap",gap:10,width:"100%"},text:{fontSize:18,fontWeight:"bold"}}),A=i.StyleSheet.create({container:{display:"flex",flexWrap:"wrap",gap:10,width:"100%"},text:{fontSize:18,fontWeight:"bold"}});function H(e){var n=e.scope,o=r.Utils.nvl(n.getOptions(),[]),a=n.getInputValue(),s=t.useState(0),c=s[0],u=s[1],d=function(e){return(null==e?void 0:e.value)===a},f=function(t){var o=t.item,a=t.index,s=d(o),c=p({},M.text);return s&&(c.color="#ffffff"),r.Utils.isEmpty(e.children)?l.jsx(i.Text,{style:c,children:o.label}):l.jsx(B,{scope:n,item:o.object,index:a,children:e.children})},g=function(e){var t=p({},M.item,n.getStyle("item")),r=Math.floor(100/o.length)+"%";if(d(e)){var i=n.getPart("selectedColor",void 0,"primary");(t=p({},t,n.getStyle("selected",{backgroundColor:i,color:"#ffffff"}))).color||(t.color="#ffffff")}return t.width=r,t};return l.jsx(l.Fragment,{children:o.map((function(e,t){return l.jsx(i.TouchableHighlight,{style:g(e),onPress:function(t){!function(e){n.changeValue(e.object),u(++c)}(e)},children:l.jsx(f,{item:e,index:t})},"k-"+t)}))})}var M=i.StyleSheet.create({container:{flex:1,width:"100%",gap:10,justifyContent:"center",flexDirection:"row"},item:{padding:10,marginVertical:8,backgroundColor:"background",borderRadius:8,justifyContent:"center",width:"auto",flexDirection:"row"},text:{fontSize:15,fontWeight:"500"}});function G(e){var n=e.scope,o=n.original,s=t.useState(0),c=s[0],u=s[1],d=n.getValue(0),f=o.color;f||(f="primary");var g={padding:0,alignItems:"center",height:30,width:30,textAlign:"center",verticalAling:"middle",borderRadius:24,backgroundColor:f,color:"#ffffff",justifyContent:"center"},x={buttonLabel:{color:"#ffffff",fontWeight:"500",fontSize:16},value:{flex:1,flexDirection:"row",textAlign:"center",fontWeight:"500"},buttonInner:{flexDirection:"row",alignItems:"center",justifyContent:"center"},buttonIcon:{color:"#fff",fontSize:18},button:g,addButton:p({},g),delButton:p({},g)},h=function(e){n.changeValue(d+e),u(++c)},y=function(e,t){var r=p({},x[e],t);return n.getStyle(e,r)};return l.jsxs(l.Fragment,{children:[l.jsx(i.TouchableHighlight,{underlayColor:"transparent",onPress:function(){h(-1)},style:y("delButton"),children:l.jsx(a.Ionicons,{size:30,style:y("buttonIcon"),name:"remove"})}),l.jsx(i.Text,{style:y("value"),children:r.Utils.nvl(d,0)}),l.jsx(i.TouchableHighlight,{underlayColor:"transparent",onPress:function(){h(1)},style:y("addButton"),children:l.jsx(a.Ionicons,{size:30,style:y("buttonIcon"),name:"add"})})]})}function _(){var e={success:function(e){return l.jsx(c.BaseToast,p({},e,{style:t.darkToast,contentContainerStyle:{paddingHorizontal:15},text1Style:t.text,text2Style:t.text}))},error:function(e){return l.jsx(c.ErrorToast,p({},e,{style:t.darkToast,text1Style:t.text,text2Style:t.text}))},info:function(e){return l.jsx(c.BaseToast,p({},e,{style:t.darkToast,text1Style:t.text,text2Style:t.text}))}},t=i.StyleSheet.create({darkToast:{backgroundColor:"rgba(34, 34, 34, 0.85)",borderLeftColor:"#222"},text:{color:"#fff",textAlign:"center"}});return l.jsx(u,{config:e})}function K(e){var n,a,s=t.useState(!1),c=s[0],u=s[1],d=t.useState(0),f=d[0],x=d[1],h=r.ViewUtils.getCrud("view"),y=e.scope,m=y.getLabel(),v=y.getTheme(),j=r.Utils.nvl(null==(n=v.styles)||null==(n=n.defaults)?void 0:n.header,{}),b=t.useRef(null),S=function(e,t){var n=p({},Q[e],t);return p({},y.getStyle(e,n))},w=function(){y.close({scope:y,crud:y.currentDialog,event:{}})},C=function(e){u(c=e)};y.update=function(){x(++f)},y.dialogShow=function(e){var t=e.crud,n=y.getName("modal"),i=!0===e.edit,l={},o=null;t.is("row")?(l.parent=t.parent.parent,l.search=t.parent,o=t.data):t.is("search")&&(l.parent=t.parent,l.search=t);var a=r.Utils.nvl(e.item,o,{}),s=r.CrudUtils.create("dialog",p({parent:t,root:t,name:n,dialog:h.dialog,data:a,edit:i,scope:y},l));h.dialog=s,y.currentDialog=s,C(!0),y.update()},y.dialogHide=function(e){var t;h.dialog=r.Utils.nvl(y.currentDialog.dialog,null),y.currentDialog=null,C(!1),null!=(t=h.dialog)&&t.scope&&h.dialog.scope.update(),y.update()};var U=y.currentDialog;if(!U)return l.jsx(l.Fragment,{});if(U.uuid!==(null==(a=h.dialog)?void 0:a.uuid))return l.jsx(l.Fragment,{});var T=r.ComponentUtils.getDefine(e,"header","right"),I=r.ComponentUtils.getDefine(e,"bottom");y.put("scrollRef",b),r.ComponentUtils.setViewScope(y);var k=r.Utils.nvl(j.color,"white"),V={color:k},F=y.currentDialog.name+"-"+f;return l.jsxs(i.Modal,{animationType:"slide",transparent:!0,visible:c,onRequestClose:w,children:[l.jsx(i.SafeAreaView,{style:S("modalTop")}),l.jsxs(i.SafeAreaView,{style:S("modalSafe"),children:[l.jsxs(i.View,{style:y.getStyle("header",j),children:[l.jsx(i.TouchableOpacity,{onPress:w,style:S("modalCloseButton"),children:l.jsx(o,{name:"chevron-back-outline",size:24,color:k,style:S("modalCloseText",V)})}),l.jsx(i.Text,{style:S("modalTitle",V),children:m}),!r.Utils.isEmpty(T)&&l.jsx(g,{scope:y,crud:y.currentDialog,transient:!0,children:T})]}),l.jsx(i.ScrollView,{contentContainerStyle:{flexGrow:1,paddingBottom:50},style:S("modalContent"),nestedScrollEnabled:!0,ref:b,children:l.jsx(i.View,{style:{flex:1,paddingLeft:15,paddingRight:15,paddingTop:10,paddingBottom:10},children:l.jsx(g,{scope:y,crud:y.currentDialog,children:e.children})})}),I]}),l.jsx(_,{})]},F)}var Q=i.StyleSheet.create({modalTop:{backgroundColor:"primary",width:"100%"},modalSafe:{flex:1,width:"100%",backgroundColor:"background"},modalCloseButton:{padding:10},modalCloseText:{fontSize:18,color:"white"},modalTitle:{fontSize:18,fontWeight:"bold",marginLeft:10},modalContent:{flex:1,backgroundColor:"background"}});function J(e){var n,o,a=e.scope,s=e.children,c=a.getTheme(),u=a.getPart("header",null,[]),d=r.Utils.nvl(null==(n=c.styles)||null==(n=n.defaults)?void 0:n.header,{}),f=r.Utils.nvl(null==(o=c.styles)||null==(o=o.defaults)?void 0:o.headerText,{}),p=t.useRef(null);t.useEffect((function(){T.syncTheme()}),[]);var x=r.Utils.call((function(){var e=a.getStyle("header",d),t=e.backgroundColor;return t&&(e.color=r.HtmlUtils.getTextColor(t)),e})),h=!r.Utils.isEmpty(u),y=function(){return"string"==typeof u?l.jsx(i.Text,{style:f,children:u}):l.jsx(l.Fragment,{children:u})};return a.put("scrollRef",p),r.ComponentUtils.setViewScope(a),l.jsxs(l.Fragment,{children:[h&&l.jsx(i.View,{style:x,children:l.jsx(y,{})}),l.jsx(i.View,{style:a.getStyle("container",X.container),children:l.jsx(i.ScrollView,{onScroll:function(){var e=r.ViewUtils.getCrud();r.Utils.each(e.scroll,(function(e){e.onScroll&&e.onScroll.call(e)}))},scrollEventThrottle:16,ref:p,nestedScrollEnabled:!0,keyboardShouldPersistTaps:"handled",contentContainerStyle:a.getStyle("contentContainer",{paddingBottom:50}),style:a.getStyle("scroll",X.scroll),children:l.jsx(g,{scope:a,children:s})})}),l.jsx(_,{})]})}var X=i.StyleSheet.create({scroll:{paddingTop:10,paddingBottom:10,paddingLeft:15,paddingRight:15},container:{},view:{}});function Y(e){var n=e.scope,o=n.crud,s=n.original,c=r.Utils.nvl(n.getPart("cols",void 0,1)),u=r.ComponentUtils.getDefine(e,"add"),f=s.hideAddWhenEmpty,g=function(){var e=t.useState(n.updateIndex),a=e[0],g=e[1];n.update=function(){n.updateIndex=++a,g(a)};var x,h=n.key("data"),y=r.Utils.call((function(){var e,t=r.Utils.nvl(n.getItems(),[]);if(s.search&&(null==(e=s.list)||!e.url)){var i=o.get("query","").toLowerCase().trim();if(i.length>1){var l=[],a=r.Utils.nvl(s.filterBy,"label");return r.Utils.each(t,(function(e){var t=e[a];t&&t.includes(i)&&l.push(e)})),l}}return t})),m=function(){if(!r.Utils.isEmpty(y))return l.jsx(l.Fragment,{});var e=n.attr("empty","Sem registro");return e?"string"==typeof e?l.jsx(i.Text,{style:n.getStyle("empty",{flex:1,fontWeight:500,fontSize:20,padding:10,textAlign:"center",justifyContent:"center",alignItems:"center"}),children:e}):l.jsx(l.Fragment,{children:e}):l.jsx(l.Fragment,{})};return l.jsxs(i.View,{style:(x=n.getStyle("container",p({},{},Z.container)),c>1&&(x=p({},x,{flexDirection:"row",flexWrap:"wrap"})),x),children:[l.jsx(m,{}),l.jsx(d,{data:y,renderItem:function(e){return l.jsx(i.TouchableOpacity,{style:[Z.row,{backgroundColor:e.isActive?"lightblue":"white"}],onLongPress:e.drag,children:l.jsx(i.Text,{style:Z.text,children:n.getItemLabel(e.item)})})},keyExtractor:function(e){return n.getItemValue(e)},onDragEnd:function(e){n.changeValue(e.data)}}),(!r.Utils.isEmpty(y)||!0!==f)&&l.jsx(l.Fragment,{children:u})]},h)};return l.jsxs(l.Fragment,{children:[!1!==s.search&&l.jsx(se.Text,{placeholder:"Pesquisar...",field:"query",crud:o,style:{marginBottom:10},change:{action:function(){n.search()}},icon:l.jsx(a.Ionicons,{name:"search",size:20,color:"#888"})}),l.jsx(g,{})]})}var Z=i.StyleSheet.create({row:{padding:20,borderBottomWidth:1,borderBottomColor:"#ccc"},text:{fontSize:18}}),$=t.createContext({});function ee(e){var n,o,s=t.useContext($),c=r.Utils.nvl(e.theme,null==s?void 0:s.theme),d=r.Utils.nvl(e.crud,null==s?void 0:s.crud),f=t.useState(r.ScopeUtils.create(p({crud:d},e,{theme:c})))[0],x=t.useState(0),m=x[0],v=x[1],S=t.useState(null),C=S[0],T=S[1];f.compile(e),d=f.crud;var k=f.getOptions(),z=f.original,L=t.useRef(null);f.update=function(){v(++m)},f.updateElement=function(){v(++m)},f.toast=function(e,t,n){void 0===t&&(t="info"),u.show(p({type:t,text1:e,position:"bottom",visibilityTime:3e3},n))},f.prompt=function(e){var t=e.event;if(t){var n="Você tem certeza que deseja continuar?",l="Atenção",o=t.prompt;"string"==typeof o&&(n=o),"object"==typeof o&&(n=r.Utils.nvl(o.message,n),l=r.Utils.nvl(o.title,l)),i.Alert.alert(l,n,[{text:"Cancelar",style:"cancel"},{text:"Confirmar",onPress:function(){return f.execute(e)}}],{cancelable:!1})}};var D=function(){var e=z.custom;return e?l.jsx(ee,"string"==typeof e?{element:{value:e,type:"dummy"},crud:d}:p({type:e.type,tag:e.type},e.props,{crud:d})):l.jsx(l.Fragment,{})};if(f.is("type","dummy"))return l.jsx(l.Fragment,{children:f.getDisplayValue()});var B=function(){var e=f.getValue();W({target:{value:!(!0===e)}})},W=function(e){var t=e.target.value;f.isType("integer","int","number")?t=parseInt(t):f.isType("decimal")&&(t=parseFloat(t)),f.isType("select","complete")&&(t=f.getSelectedItem(t)),f.changeValue(t),f.update()},q=function(e){f.call("click")},N={scope:f,crud:d,onChange:W};f.isType("password")&&(N.type="password");var A=function(){return!(f.isInput()||r.Utils.isEmpty(e.children)&&r.Utils.isEmpty(e.elements))},M=f.is("type","text","number","integer","int","phone","postalCode","money","password","email"),_=function(e,t){var n,i=r.Utils.nvl(z.type,"none"),l=r.Utils.nvl(e,"root"),o=p({},ie[l]),a=A();return i=r.Utils.nvl(z.layout,i),e||a||(o=p({},o)),f.isInput()&&(o=p({},o,re.input[l])),o=p({},o,null==re||null==(n=re[i])?void 0:n[l]),a&&e&&(o=p({},o,le[e])),p({},o,f.getStyle(e,p({},o,t)))},Q=_("element"),X={required:f.isRequired(),size:"small",scope:f,crud:d,style:Q,placeholder:f.attr("placeholder","Digite aqui")};f.error=function(e){C=e,T(e)},null!=(n=z.list)&&n.url||null!=(o=z.load)&&o.url||f.start(),t.useEffect((function(){f.start()}));var Z=function(){return"string"==typeof z.icon?l.jsx(a.Ionicons,{name:z.icon,style:f.getStyle("icon")}):l.jsx(l.Fragment,{children:z.icon})};if(f.open=function(e){i.Linking.openURL(e.url)},t.useLayoutEffect((function(){if(null!=L&&L.current&&f.is("type","card","list","tabs","stepper")){var e=null==L?void 0:L.current;if(null!=e&&e.classList){var t=r.HtmlUtils.getBGColor(e);e.classList.add("rgb(255, 255, 255)"===t?"ui-dark":"ui-light")}}})),!f.isRendered()||f.is("type","define"))return l.jsx(l.Fragment,{});var ne=i.View,oe={};!f.isType("input","grid","list","repeat")&&z.click&&(ne=i.TouchableHighlight,oe.underlayColor="transparent",oe.onPress=q);var ae=function(){return l.jsxs(l.Fragment,{children:[f.getPart("render",null,l.jsx(l.Fragment,{})),f.is("type","button")&&l.jsxs(U,p({},X,{onClick:q,variant:f.attr("variant","outlined"),children:[z.icon&&l.jsx(Z,{}),z.label&&l.jsx(i.Text,{style:f.getPart("label","button"),children:f.getLabel()})]})),f.is("type","icon")&&l.jsx(w,p({},X,{onClick:q,variant:f.attr("variant","outlined"),children:f.getDisplayValue()})),f.is("type","link")&&l.jsxs(b,p({},X,{onClick:q,variant:f.attr("variant","outlined"),children:[z.icon&&l.jsx(Z,{}),z.label&&l.jsx(i.Text,{style:f.getPart("label","link"),children:f.getLabel()})]})),M&&l.jsx(R,p({},N,X,{InputProps:p({},z.inputProps)})),f.is("type","complete","autocomplete")&&l.jsx(j,{scope:f,defaultsInput:N,defaultsUI:X}),f.is("type","quantity")&&l.jsx(G,{scope:f,defaultsInput:N,defaultsUI:X}),f.is("type","checkbox","boolean","switch")&&l.jsx(V,p({checked:!0===f.getValue()},N,{onChange:B})),f.isType("slider")&&l.jsx(F,p({},N,{onChange:B})),f.is("type","select")&&l.jsx(I,p({},N,X,{value:f.getSelectedValue()})),f.is("type","toggle")&&l.jsx(H,p({},N,X,{value:f.getSelectedValue()})),f.is("type","radio")&&l.jsx(E,p({},N,X,{row:!0,children:k.map((function(e,t){return l.jsx(P,{control:l.jsx(E,p({},X)),label:e.label,value:e.value},"i"+t)}))})),f.is("type","custom")&&l.jsx(D,{}),f.is("type","column")&&l.jsxs(l.Fragment,{children:[f.is("format","img")&&l.jsx(i.Image,{source:f.getDisplayValue()}),f.is("format","icon")&&l.jsx(w,{scope:f,crud:d}),!f.is("format","icon","img")&&l.jsx(i.Text,{children:f.getDisplayValue()})]}),f.is("type","output","value")&&l.jsx(i.Text,{style:_("value"),children:f.getDisplayValue()})]})},se=function(t){var n=t.name,i=t.style;if(e[n]){var o=r.ComponentUtils.getDefine(e,n);if(!r.Utils.isEmpty(o))return l.jsx(g,p({},e,{scope:f,crud:d,style:_(n,i),children:o}))}return l.jsx(l.Fragment,{})},ce=function(){return l.jsxs(l.Fragment,{children:[void 0!==z.label&&!1!==z.label&&!f.isType("button","dialog","modal")&&l.jsxs(i.View,{style:_("outerLabel",{alignSelf:"flex-start",flexDirection:"row",display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),children:[l.jsx(i.Text,{style:_("label"),children:f.getLabel()}),l.jsx(se,{name:"actions",style:{width:"auto"}})]}),!A()&&l.jsxs(l.Fragment,{children:[l.jsx(i.View,{style:_("inner"),children:l.jsx(ae,{})}),C&&l.jsx(i.View,{style:_("error"),children:C})]}),f.isType("list","repeat")&&l.jsx(O,p({},e,{scope:f,crud:d})),f.isType("order")&&l.jsx(Y,p({},e,{scope:f,crud:d})),f.isType("dialog")&&l.jsx(K,p({},e,{scope:f,crud:d})),f.isType("chart")&&l.jsx(y,p({},e,{scope:f,crud:d})),f.isType("tabs")&&l.jsx(h,p({},e,{scope:f,crud:d})),f.isType("view")&&l.jsx(J,p({},e,{scope:f,crud:d})),!f.isType("tabs","view","grid","list","define","repeat","modal","dialog","chart")&&l.jsx(g,p({},e,{scope:f,crud:d,style:_("inner")}))]})},ue=function(e){if(f.is("type|layout","card")){var t=p({},_("box",p({},te.box,{alignSelf:"stretch"})));return l.jsx(i.View,{style:_("card",p({},t)),children:l.jsx(i.View,{style:_("boxInner",{paddingHorizontal:15,paddingVertical:10}),children:e.children})})}return f.isInput()||z.container?l.jsx(i.View,{style:_("container",{padding:5,width:"100%"}),children:e.children}):l.jsx(l.Fragment,{children:e.children})};return l.jsx($.Provider,{value:{crud:d,theme:c},children:l.jsx(ne,p({ref:L,style:_()},oe,{children:l.jsx(ue,{children:l.jsx(ce,{})})}))})}var te=i.StyleSheet.create({box:{borderWidth:0,borderColor:"#dedede",borderStyle:"solid",backgroundColor:"white",borderRadius:12,width:"100%",shadowColor:"#000",shadowOpacity:.1,shadowRadius:4}}),ne=p({},te.box),re={view:{inner:{width:"100%",alignItems:"normal",flex:1},container:{width:"100%",backgroundColor:"background",flex:1,gap:10},root:{width:"100%",flex:1,alignItems:"normal",padding:0}}};re.input=i.StyleSheet.create({label:{paddingLeft:0},inner:{flex:1,width:"100%",padding:0,gap:10,alignSelf:"flex-start",flexDirection:"row",flexWrap:"wrap"}}),re.switch={inner:{padding:5}},re.quantity={inner:p({},ne,{backgroundColor:"primarySoft",fontWeight:600,fontSize:16,borderRadius:25,borderWidth:0,padding:5,paddingHorizontal:5,paddingVertical:5,flexWrap:"nowrap",flex:1,flexDirection:"row",justifyContent:"center",alignItems:"center"})},re.toggle=i.StyleSheet.create({inner:p({},ne,{flex:1,width:"100%",gap:10,justifyContent:"center",flexDirection:"row",paddingHorizontal:10,paddingVertical:0,alignSelf:"flex-start",flexWrap:"nowrap"})});var ie=i.StyleSheet.create({root:{gap:5,flexDirection:"column",flexWrap:"wrap",width:"100%",alignItems:"flex-start"},label:{fontWeight:400,marginTop:5,fontSize:12,color:"labelColor"},inner:{width:"100%"}}),le=i.StyleSheet.create({root:{gap:10},label:{width:"100%",fontWeight:500,fontSize:24}});function oe(e){if(!1===e.rendered)return l.jsx(l.Fragment,{});var t=r.ComponentUtils.getDefine(e,e.name,e.position);return r.Utils.isEmpty(t)&&(t=e.default),r.Utils.isEmpty(t)?l.jsx(l.Fragment,{children:t}):l.jsx((function(t){var n=e.tag;return r.Utils.isEmpty(n)?l.jsx(l.Fragment,{children:t.children}):l.jsx(n,p({},t,{children:t.children}))}),p({},e.tagProps,{children:l.jsx(g,p({transient:!0},e,{scope:e.scope,crud:e.crud,part:e.name,children:t}))}))}var ae=["type"],se={Order:function(e){return l.jsx(ee,p({},e,{type:"order"}))},List:function(e){return l.jsx(ee,p({},e,{type:"list"}))},Row:function(e){return l.jsx(ee,p({},e,{type:"row"}))},Value:function(e){return l.jsx(ee,p({},e,{type:"value"}))},Label:function(e){return l.jsx(ee,p({},e,{type:"label"}))},Repeat:function(e){return l.jsx(ee,p({},e,{type:"repeat",props:{search:!1}}))},Define:function(e){return l.jsx(ee,p({},e,{type:"define"}))},Include:function(e){return l.jsx(oe,p({},e))},Column:function(e){var t=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,ae);return l.jsx(ee,p({},t,{type:"column"}))},Input:function(e){return l.jsx(ee,p({},e))},Text:function(e){return l.jsx(ee,p({},e,{type:"text"}))},Email:function(e){return l.jsx(ee,p({},e,{type:"email"}))},Button:function(e){return l.jsx(ee,p({},e,{type:"button"}))},Link:function(e){return l.jsx(ee,p({},e,{type:"link"}))},Icon:function(e){return l.jsx(ee,p({},e,{type:"icon"}))},Output:function(e){return l.jsx(ee,p({},e,{type:"output"}))},Form:function(e){return l.jsx(ee,p({},e,{type:"form"}))},Crud:function(e){return l.jsx(ee,p({},e,{type:"crud"}))},View:function(e){return l.jsx(ee,p({},e,{type:"view",transient:!0}))},Bottom:function(e){return l.jsx(ee,p({},e,{type:"bottom"}))},Dialog:function(e){return l.jsx(ee,p({},e,{type:"dialog"}))},Content:function(e){return l.jsx(ee,p({},e,{type:"content"}))},Top:function(e){return l.jsx(ee,p({},e,{type:"top"}))},Card:function(e){return l.jsx(ee,p({},e,{type:"card"}))},Tab:function(e){return l.jsx(ee,p({},e,{type:"tab"}))},Tabs:function(e){return l.jsx(ee,p({},e,{type:"tabs"}))},Step:function(e){return l.jsx(ee,p({},e,{type:"tab",layout:"step"}))},Stepper:function(e){return l.jsx(ee,p({},e,{type:"tabs",layout:"stepper"}))},Money:function(e){return l.jsx(ee,p({},e,{type:"money"}))},Chart:function(e){return l.jsx(ee,p({},e,{type:"chart"}))},Password:function(e){return l.jsx(ee,p({},e,{type:"password"}))},Complete:function(e){return l.jsx(ee,p({},e,{type:"complete"}))},Checkbox:function(e){return l.jsx(ee,p({},e,{type:"switch"}))},Switch:function(e){return l.jsx(ee,p({},e,{type:"switch"}))},Radio:function(e){return l.jsx(ee,p({},e,{type:"radio"}))},Select:function(e){return l.jsx(ee,p({},e,{type:"select"}))},Toggle:function(e){return l.jsx(ee,p({},e,{type:"toggle"}))},Entity:function(e){return l.jsx(ee,p({},e,{type:"entity"}))},Element:function(e){return l.jsx(ee,p({},e,{type:"element"}))},Quantity:function(e){return l.jsx(ee,p({},e,{type:"quantity"}))},Slider:function(e){return l.jsx(ee,p({},e,{type:"slider"}))},SafeView:function(e){var n,o=r.ThemeUtils.getCurrentTheme();return r.Utils.isEmpty(o)&&(o=r.useTheme()),t.useEffect((function(){i.StatusBar.setBarStyle(r.Utils.nvl(o.theme,"light-content")),null==i.StatusBar.setBackgroundColor||i.StatusBar.setBackgroundColor(o.colors.theme)}),[]),l.jsxs(f.SafeAreaProvider,{children:[l.jsx(i.StatusBar,{barStyle:"light-content"}),l.jsx(f.SafeAreaView,{style:p({backgroundColor:null==(n=o.colors)?void 0:n.theme},e.viewStyle,{flex:1}),children:l.jsx(i.KeyboardAvoidingView,{behavior:"ios"===i.Platform.OS?"padding":"height",style:{flex:1,justifyContent:"center"},children:l.jsx(i.TouchableWithoutFeedback,{onPress:function(){"web"!==i.Platform.OS&&i.Keyboard.dismiss()},accessible:!1,children:l.jsx(l.Fragment,{children:e.children})})})})]})}};exports.UI=se;
2
2
  //# sourceMappingURL=react-crud-mobile.cjs.production.min.js.map