react-crud-mobile 1.3.77 → 1.3.78

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),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=require("react-native-draggable-flatlist"),f=e(d),p=require("react-native-gesture-handler"),g=require("react-native-safe-area-context");function x(){return(x=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 h(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,p,g,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=x({},n.props);return delete c.children,"string"==typeof i?r.Utils.isEmpty(n.props.children)?l.jsx(i,x({},c)):l.jsx(i,x({},c,{children:l.jsx(h,x({transient:!0,validateScope:s},n.props,{scope:o,crud:a}))})):"function"==typeof i?l.jsx(i,x({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(h,x({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(ne,x({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"),p=y[f],g={},r.Utils.isEmpty(e.style)||(null!=(d=e.style)&&d.push?r.Utils.each(e.style,(function(e){e&&(g=x({},g,e))})):g=x({},e.style)),x({},p,g,o.getStyle(u))),children:l.jsx(v,{})})})}var y=i.StyleSheet.create({child:{width:"100%"},inner:{width:"100%"}});function m(e){var i=e.scope,a=t.useState(0),s=a[0],c=a[1],u=i.original,d=i.getItems(),f=0,p=[],g=t.useState(null),y=g[0],m=g[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=x({},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&&p.push(x({},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(p[s],!1);var S=function(e){v(p[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:p.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(h,x({},e,{scope:i,children:y.child}))}),"stepper"===u.layout&&l.jsxs("div",{className:"ui-tabs-actions",children:[l.jsx(ue.Output,{space:6,layout:"left",children:l.jsx(ue.Include,x({},e,{transient:!0,name:"left",default:l.jsx(ue.Button,{rendered:s>0,icon:l.jsx(o,{}),click:function(){S(-1)}})}))}),l.jsx(ue.Output,{space:6,layout:"right",children:l.jsx(ue.Include,x({},e,{transient:!0,name:"right",default:l.jsx(ue.Button,{rendered:s<p.length-1,icon:l.jsx(o,{}),click:function(){S(1)}})}))})]})]})]})})}function v(e){var t=e.scope;return t.getItems(),r.Utils.asList(t.original.columns),l.jsx("div",{className:"ui-chart-data"})}function j(e){return l.jsx(i.TouchableOpacity,{onPress:function(){i.Linking.openURL("https://reactnative.dev/")},children:l.jsx(i.Text,{style:b.link,children:"Clique aqui para acessar o React Native"})})}var b={link:{}};function S(e){return l.jsx(l.Fragment,{children:l.jsx(j,x({},e.defaultsInput,e.defaultsUI))})}function w(e){return l.jsx(i.TouchableOpacity,{onPress:function(){i.Linking.openURL("https://reactnative.dev/")},children:l.jsx(i.Text,{style:C.link,children:"Clique aqui para acessar o React Native"})})}var C={link:{}};function U(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 T={small:{minWidth:30,height:30}};function k(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 p={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"}},g=function(e,n){var i=x({},p[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=x({},null==h?void 0:h.button);"outlined"===c&&(e.borderWidth=1,e.borderColor=r.Utils.nvl(u,"text")),o&&(e=x({},e,T[o]));var t=g("button",e);if(!t.width){var n=t.height;"number"==typeof n&&(t.minWidth=n)}return t})),m=g("buttonLabel"),v=r.Utils.call((function(){var e=g("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})]})})}function I(e){var n,o,s,c,u=t.useState(!1),d=u[0],f=u[1],p=e.scope,g=p.original,h=r.Utils.nvl(p.getOptions(),[]),y=p.attr("placeholder","Selecione..."),m=p.getDisplayValue(),v=p.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},T=function(e,t){var n=x({},V[e],t);return p.getStyle(e,n)};return l.jsxs(i.View,{style:T("selectRoot"),children:[l.jsxs(i.TouchableOpacity,{onPress:b,style:T("selectInput"),children:[l.jsx(i.Text,{style:T("selectLabel"),children:r.Utils.nvl(m,y)}),l.jsx(a.Ionicons,{name:"chevron-down-outline",size:p.getPart("iconSize",null,24),color:p.getPart("iconColor",null,w),style:T("iconStyle",{})})]}),l.jsxs(i.Modal,{animationType:"slide",transparent:!0,visible:d,onRequestClose:function(){return f(!1)},children:[l.jsx(i.SafeAreaView,{style:T("modalTop")}),l.jsxs(i.SafeAreaView,{style:T("modalSafe"),children:[l.jsxs(i.View,{style:p.getStyle("header",j),children:[l.jsx(i.TouchableOpacity,{onPress:b,style:T("modalCloseButton"),children:l.jsx(a.Ionicons,{name:"close",size:24,color:C,style:T("modalCloseText",U)})}),l.jsx(i.Text,{style:T("modalTitle",U),children:y})]}),l.jsx(i.ScrollView,{contentContainerStyle:{flexGrow:1,paddingBottom:50},style:T("modalContent"),nestedScrollEnabled:!0,ref:S,children:l.jsx(i.View,{style:{flex:1,paddingLeft:15,paddingRight:15,paddingTop:10,paddingBottom:10},children:l.jsx(ue.List,x({data:h,name:p.getName("list"),layout:"card",click:function(e){var t=e.value;p.changeValue(g.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:x({paddingLeft:15,paddinRight:15},null==(s=p.original)?void 0:s.rowStyle)},null==(c=p.original)?void 0:c.listProps,{children:l.jsx(ue.Value,{value:"#{@this.label}"})}))})})]})]})]},p.getName(p.getPart("modal")+"_"+d))}var V=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 F(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 P(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),p=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 p(!1)},onSlidingComplete:function(){return p(!0)},style:x({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 z(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){return l.jsx(i.TouchableOpacity,{onPress:function(){i.Linking.openURL("https://reactnative.dev/")},children:l.jsx(i.Text,{style:D.link,children:"Clique aqui para acessar o React Native"})})}var D={link:{}};function E(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],p=d[1],g=function(e,t){return x({},n.getStyle(e,W[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:g("base"),children:[n.getPart("left"),l.jsx(i.TextInput,{style:g("input"),onChangeText:function(e){e=n.changeValue(e),p(e)},value:f,placeholder:c}),l.jsx(h,{})]}),n.getPart("right")]})}var W=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 q(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:O,list:B})?void 0:n[s.type],p=""+o.key("row",a,""),g=t.useState(r.ScopeUtils.create(x({},s,{parent:o,name:p,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,g),v=function(){return l.jsx(l.Fragment,!m&&s.useIsInView&&!g.visible&&a>20?{}:{children:l.jsx(h,{scope:g,crud:g.crud,children:e.children})})};return l.jsx((function(){var e=t.useState(0),n=e[0],r=e[1],p=o.key("item"),h=function(){var e=g.getStyle("row",x({},f.row,{minHeight:40}));return u>0&&(e.width=d),e};return g.update=function(){o.updateIndex=o.updateIndex+1,r(++n)},!1===g.getPart("renderedItem",void 0,!0)?l.jsx(l.Fragment,{}):s.click?l.jsx(i.TouchableHighlight,{style:h(),underlayColor:"transparent",ref:y,onPress:function(e){e.stopPropagation(),function(e){g.call("click",{value:e,item:e,edit:!0,index:a})}(c)},children:l.jsx(v,{})},p):l.jsx(i.View,{style:h(),ref:y,children:l.jsx(v,{})},p)}),{})}var B=i.StyleSheet.create({row:{padding:5,margin:0,width:"100%",backgroundColor:"background",gap:10,borderRadius:8,justifyContent:"center"}}),O=i.StyleSheet.create({row:{padding:0,width:"100%",justifyContent:"center"}});function N(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:H})?void 0:n[c.type],f=r.ComponentUtils.getDefine(e,"add"),p=c.hideAddWhenEmpty,g=function(){var n=t.useState(o.updateIndex),a=n[0],g=n[1];o.update=function(){o.updateIndex=++a,g(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",x({},{},d.container)),u>1&&(h=x({},h,{flexDirection:"row",flexWrap:"wrap"})),h),children:[l.jsx(v,{}),m.map((function(t,n){return l.jsx(q,{index:n,item:t,scope:o,children:e.children})})),(!r.Utils.isEmpty(m)||!0!==p)&&l.jsx(l.Fragment,{children:f})]},y)};return l.jsxs(l.Fragment,{children:[!1!==c.search&&l.jsx(ue.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(g,{})]})}var H=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 M(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=x({},G.text);return s&&(c.color="#ffffff"),r.Utils.isEmpty(e.children)?l.jsx(i.Text,{style:c,children:o.label}):l.jsx(q,{scope:n,item:o.object,index:a,children:e.children})},p=function(e){var t=x({},G.item,n.getStyle("item")),r=Math.floor(100/o.length)+"%";if(d(e)){var i=n.getPart("selectedColor",void 0,"primary");(t=x({},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:p(e),onPress:function(t){!function(e){n.changeValue(e.object),u(++c)}(e)},children:l.jsx(f,{item:e,index:t})},"k-"+t)}))})}var G=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 _(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 p={padding:0,alignItems:"center",height:30,width:30,textAlign:"center",verticalAling:"middle",borderRadius:24,backgroundColor:f,color:"#ffffff",justifyContent:"center"},g={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:p,addButton:x({},p),delButton:x({},p)},h=function(e){n.changeValue(d+e),u(++c)},y=function(e,t){var r=x({},g[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 K(){var e={success:function(e){return l.jsx(c.BaseToast,x({},e,{style:t.darkToast,contentContainerStyle:{paddingHorizontal:15},text1Style:t.text,text2Style:t.text}))},error:function(e){return l.jsx(c.ErrorToast,x({},e,{style:t.darkToast,text1Style:t.text,text2Style:t.text}))},info:function(e){return l.jsx(c.BaseToast,x({},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 Q(e){var n,a,s=t.useState(!1),c=s[0],u=s[1],d=t.useState(0),f=d[0],p=d[1],g=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=x({},J[e],t);return x({},y.getStyle(e,n))},w=function(){y.close({scope:y,crud:y.currentDialog,event:{}})},C=function(e){u(c=e)};y.update=function(){p(++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",x({parent:t,root:t,name:n,dialog:g.dialog,data:a,edit:i,scope:y},l));g.dialog=s,y.currentDialog=s,C(!0),y.update()},y.dialogHide=function(e){var t;g.dialog=r.Utils.nvl(y.currentDialog.dialog,null),y.currentDialog=null,C(!1),null!=(t=g.dialog)&&t.scope&&g.dialog.scope.update(),y.update()};var U=y.currentDialog;if(!U)return l.jsx(l.Fragment,{});if(U.uuid!==(null==(a=g.dialog)?void 0:a.uuid))return l.jsx(l.Fragment,{});var T=r.ComponentUtils.getDefine(e,"header","right"),k=r.ComponentUtils.getDefine(e,"bottom");y.put("scrollRef",b),r.ComponentUtils.setViewScope(y);var I=r.Utils.nvl(j.color,"white"),V={color:I},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:I,style:S("modalCloseText",V)})}),l.jsx(i.Text,{style:S("modalTitle",V),children:m}),!r.Utils.isEmpty(T)&&l.jsx(h,{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(h,{scope:y,crud:y.currentDialog,children:e.children})})}),k]}),l.jsx(K,{})]},F)}var J=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 X(e){var t,n,o=e.scope,a=o.getTheme(),s=o.getPart("header",null,[]),c=r.Utils.nvl(null==(t=a.styles)||null==(t=t.defaults)?void 0:t.header,{}),u=r.Utils.nvl(null==(n=a.styles)||null==(n=n.defaults)?void 0:n.headerText,{}),d=r.Utils.call((function(){var e=o.getStyle("header",c),t=e.backgroundColor;return t&&(e.color=r.HtmlUtils.getTextColor(t)),e})),f=!r.Utils.isEmpty(s);return l.jsx(l.Fragment,{children:f&&l.jsx(i.View,{style:d,children:l.jsx((function(){return"string"==typeof s?l.jsx(i.Text,{style:u,children:s}):l.jsx(l.Fragment,{children:s})}),{})})})}function Y(e){var n=e.scope,o=e.children,a=t.useRef(null),s=n.original,c=function(){var e=r.ViewUtils.getCrud();r.Utils.each(e.scroll,(function(e){e.onScroll&&e.onScroll.call(e)}))};n.put("scrollRef",a),r.ComponentUtils.setViewScope(n);var u=function(){return!1===s.scroll?l.jsx(h,{scope:n,children:o}):l.jsx(i.View,{style:n.getStyle("container",Z.container),children:l.jsx(i.ScrollView,{onScroll:c,scrollEventThrottle:16,ref:a,nestedScrollEnabled:!0,keyboardShouldPersistTaps:"handled",contentContainerStyle:n.getStyle("contentContainer",{paddingBottom:50}),style:n.getStyle("scroll",Z.scroll),children:l.jsx(h,{scope:n,children:o})})})};return l.jsxs(l.Fragment,{children:[l.jsx(X,{scope:n}),l.jsx(u,{}),l.jsx(K,{})]})}var Z=i.StyleSheet.create({scroll:{paddingTop:10,paddingBottom:10,paddingLeft:15,paddingRight:15},container:{},view:{}});function $(e){var n=e.scope,o=n.crud,s=n.original,c=(r.Utils.nvl(n.getPart("cols",void 0,1)),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}))),u=t.useState(c),g=u[0],h=u[1];return l.jsxs(p.GestureHandlerRootView,{style:x({flex:1,width:"100%"},n.getStyle("order",{justifyContent:"flex-start"})),children:[l.jsx(X,{scope:n}),l.jsx(f,{data:g,renderItem:function(e){var t=e.item,r=e.drag,o=e.isActive,s=x({},n.getStyle("row"));return o&&(s=x({},s,n.getStyle("active"))),l.jsx(d.ScaleDecorator,{children:l.jsxs(i.TouchableOpacity,{style:[ee.row,{backgroundColor:o?"lightblue":"white"},x({},s)],onLongPress:r,children:[l.jsx(a.MaterialCommunityIcons,{name:"drag",size:24,color:"black"}),l.jsx(i.Text,{style:ee.text,children:n.getItemLabel(t)})]})})},keyExtractor:function(e){return n.getItemValue(e)},onDragEnd:function(e){var t=e.data;h(t),n.changeValue(t)}})]})}var ee=i.StyleSheet.create({row:{flexDirection:"row",gap:10,padding:15,borderBottomWidth:1,borderBottomColor:"#ccc"},text:{fontSize:18}}),te=t.createContext({});function ne(e){var n,o,s=t.useContext(te),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(x({crud:d},e,{theme:c})))[0],p=t.useState(0),g=p[0],y=p[1],j=t.useState(null),b=j[0],C=j[1];f.compile(e),d=f.crud;var T=f.getOptions(),V=f.original,L=t.useRef(null);f.update=function(){y(++g)},f.updateElement=function(){y(++g)},f.toast=function(e,t,n){void 0===t&&(t="info"),u.show(x({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=V.custom;return e?l.jsx(ne,"string"==typeof e?{element:{value:e,type:"dummy"},crud:d}:x({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 W=function(){var e=f.getValue();q({target:{value:!(!0===e)}})},q=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()},B=function(e){f.call("click")},O={scope:f,crud:d,onChange:q};f.isType("password")&&(O.type="password");var H=function(){return!(f.isInput()||r.Utils.isEmpty(e.children)&&r.Utils.isEmpty(e.elements))},A=f.is("type","text","number","integer","int","phone","postalCode","money","password","email"),G=function(e,t){var n,i=r.Utils.nvl(V.type,"none"),l=r.Utils.nvl(e,"root"),o=x({},oe[l]),a=H();return i=r.Utils.nvl(V.layout,i),e||a||(o=x({},o)),f.isInput()&&(o=x({},o,le.input[l])),o=x({},o,null==le||null==(n=le[i])?void 0:n[l]),a&&e&&(o=x({},o,ae[e])),x({},o,f.getStyle(e,x({},o,t)))},K=G("element"),J={required:f.isRequired(),size:"small",scope:f,crud:d,style:K,placeholder:f.attr("placeholder","Digite aqui")};f.error=function(e){b=e,C(e)},null!=(n=V.list)&&n.url||null!=(o=V.load)&&o.url||f.start(),t.useEffect((function(){f.start()}));var X=function(){return"string"==typeof V.icon?l.jsx(a.Ionicons,{name:V.icon,style:f.getStyle("icon")}):l.jsx(l.Fragment,{children:V.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 Z=!f.isType("input","grid","list","order","repeat")&&V.click,ee={};Z&&(ee.underlayColor="transparent",ee.onPress=B);var ie=function(){return l.jsxs(l.Fragment,{children:[f.getPart("render",null,l.jsx(l.Fragment,{})),f.is("type","button")&&l.jsxs(k,x({},J,{onClick:B,variant:f.attr("variant","outlined"),children:[V.icon&&l.jsx(X,{}),V.label&&l.jsx(i.Text,{style:f.getPart("label","button"),children:f.getLabel()})]})),f.is("type","icon")&&l.jsx(U,x({},J,{onClick:B,variant:f.attr("variant","outlined"),children:f.getDisplayValue()})),f.is("type","link")&&l.jsxs(w,x({},J,{onClick:B,variant:f.attr("variant","outlined"),children:[V.icon&&l.jsx(X,{}),V.label&&l.jsx(i.Text,{style:f.getPart("label","link"),children:f.getLabel()})]})),A&&l.jsx(E,x({},O,J,{InputProps:x({},V.inputProps)})),f.is("type","complete","autocomplete")&&l.jsx(S,{scope:f,defaultsInput:O,defaultsUI:J}),f.is("type","quantity")&&l.jsx(_,{scope:f,defaultsInput:O,defaultsUI:J}),f.is("type","checkbox","boolean","switch")&&l.jsx(F,x({checked:!0===f.getValue()},O,{onChange:W})),f.isType("slider")&&l.jsx(P,x({},O,{onChange:W})),f.is("type","select")&&l.jsx(I,x({},O,J,{value:f.getSelectedValue()})),f.is("type","toggle")&&l.jsx(M,x({},O,J,{value:f.getSelectedValue()})),f.is("type","radio")&&l.jsx(R,x({},O,J,{row:!0,children:T.map((function(e,t){return l.jsx(z,{control:l.jsx(R,x({},J)),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(U,{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:G("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(h,x({},e,{scope:f,crud:d,style:G(n,i),children:o}))}return l.jsx(l.Fragment,{})},ce=function(){return l.jsxs(l.Fragment,{children:[void 0!==V.label&&!1!==V.label&&!f.isType("button","dialog","modal")&&l.jsxs(i.View,{style:G("outerLabel",{alignSelf:"flex-start",flexDirection:"row",display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),children:[l.jsx(i.Text,{style:G("label"),children:f.getLabel()}),l.jsx(se,{name:"actions",style:{width:"auto"}})]}),!H()&&l.jsxs(l.Fragment,{children:[l.jsx(i.View,{style:G("inner"),children:l.jsx(ie,{})}),b&&l.jsx(i.View,{style:G("error"),children:b})]}),f.isType("list","repeat")&&l.jsx(N,x({},e,{scope:f,crud:d})),f.isType("order")&&l.jsx($,x({},e,{scope:f,crud:d})),f.isType("dialog")&&l.jsx(Q,x({},e,{scope:f,crud:d})),f.isType("chart")&&l.jsx(v,x({},e,{scope:f,crud:d})),f.isType("tabs")&&l.jsx(m,x({},e,{scope:f,crud:d})),f.isType("view")&&l.jsx(Y,x({},e,{scope:f,crud:d})),!f.isType("tabs","view","grid","list","define","repeat","modal","dialog","chart")&&l.jsx(h,x({},e,{scope:f,crud:d,style:G("inner")}))]})},ue=function(e){if(f.is("type|layout","card")){var t=x({},G("box",x({},re.box,{alignSelf:"stretch"})));return l.jsx(i.View,{style:G("card",x({},t)),children:l.jsx(i.View,{style:G("boxInner",{paddingHorizontal:15,paddingVertical:10}),children:e.children})})}return f.isInput()||V.container?l.jsx(i.View,{style:G("container",{padding:5,width:"100%"}),children:e.children}):l.jsx(l.Fragment,{children:e.children})};return l.jsx(te.Provider,{value:{crud:d,theme:c},children:l.jsx((function(e){var t=i.View;return Z&&(t=i.TouchableHighlight),f.isType("dialog","order")||V.transient?l.jsx(l.Fragment,{children:e.children}):l.jsx(t,x({},e))}),x({ref:L,style:G()},ee,{children:l.jsx(ue,{children:l.jsx(ce,{})})}))})}var re=i.StyleSheet.create({box:{borderWidth:0,borderColor:"#dedede",borderStyle:"solid",backgroundColor:"white",borderRadius:12,width:"100%",shadowColor:"#000",shadowOpacity:.1,shadowRadius:4}}),ie=x({},re.box),le={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}}};le.input=i.StyleSheet.create({label:{paddingLeft:0},inner:{flex:1,width:"100%",padding:0,gap:10,alignSelf:"flex-start",flexDirection:"row",flexWrap:"wrap"}}),le.switch={inner:{padding:5}},le.quantity={inner:x({},ie,{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"})},le.toggle=i.StyleSheet.create({inner:x({},ie,{flex:1,width:"100%",gap:10,justifyContent:"center",flexDirection:"row",paddingHorizontal:10,paddingVertical:0,alignSelf:"flex-start",flexWrap:"nowrap"})});var oe=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%"}}),ae=i.StyleSheet.create({root:{gap:10},label:{width:"100%",fontWeight:500,fontSize:24}});function se(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,x({},t,{children:t.children}))}),x({},e.tagProps,{children:l.jsx(h,x({transient:!0},e,{scope:e.scope,crud:e.crud,part:e.name,children:t}))}))}var ce=["type"],ue={Order:function(e){return l.jsx(ne,x({},e,{type:"order"}))},List:function(e){return l.jsx(ne,x({},e,{type:"list"}))},Row:function(e){return l.jsx(ne,x({},e,{type:"row"}))},Value:function(e){return l.jsx(ne,x({},e,{type:"value"}))},Label:function(e){return l.jsx(ne,x({},e,{type:"label"}))},Repeat:function(e){return l.jsx(ne,x({},e,{type:"repeat",props:{search:!1}}))},Define:function(e){return l.jsx(ne,x({},e,{type:"define"}))},Include:function(e){return l.jsx(se,x({},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,ce);return l.jsx(ne,x({},t,{type:"column"}))},Input:function(e){return l.jsx(ne,x({},e))},Text:function(e){return l.jsx(ne,x({},e,{type:"text"}))},Email:function(e){return l.jsx(ne,x({},e,{type:"email"}))},Button:function(e){return l.jsx(ne,x({},e,{type:"button"}))},Link:function(e){return l.jsx(ne,x({},e,{type:"link"}))},Icon:function(e){return l.jsx(ne,x({},e,{type:"icon"}))},Output:function(e){return l.jsx(ne,x({},e,{type:"output"}))},Form:function(e){return l.jsx(ne,x({},e,{type:"form"}))},Crud:function(e){return l.jsx(ne,x({},e,{type:"crud"}))},View:function(e){return l.jsx(ne,x({},e,{type:"view",transient:!0}))},Bottom:function(e){return l.jsx(ne,x({},e,{type:"bottom"}))},Dialog:function(e){return l.jsx(ne,x({},e,{type:"dialog"}))},Content:function(e){return l.jsx(ne,x({},e,{type:"content"}))},Top:function(e){return l.jsx(ne,x({},e,{type:"top"}))},Card:function(e){return l.jsx(ne,x({},e,{type:"card"}))},Tab:function(e){return l.jsx(ne,x({},e,{type:"tab"}))},Tabs:function(e){return l.jsx(ne,x({},e,{type:"tabs"}))},Step:function(e){return l.jsx(ne,x({},e,{type:"tab",layout:"step"}))},Stepper:function(e){return l.jsx(ne,x({},e,{type:"tabs",layout:"stepper"}))},Money:function(e){return l.jsx(ne,x({},e,{type:"money"}))},Chart:function(e){return l.jsx(ne,x({},e,{type:"chart"}))},Password:function(e){return l.jsx(ne,x({},e,{type:"password"}))},Complete:function(e){return l.jsx(ne,x({},e,{type:"complete"}))},Checkbox:function(e){return l.jsx(ne,x({},e,{type:"switch"}))},Switch:function(e){return l.jsx(ne,x({},e,{type:"switch"}))},Radio:function(e){return l.jsx(ne,x({},e,{type:"radio"}))},Select:function(e){return l.jsx(ne,x({},e,{type:"select"}))},Toggle:function(e){return l.jsx(ne,x({},e,{type:"toggle"}))},Entity:function(e){return l.jsx(ne,x({},e,{type:"entity"}))},Element:function(e){return l.jsx(ne,x({},e,{type:"element"}))},Quantity:function(e){return l.jsx(ne,x({},e,{type:"quantity"}))},Slider:function(e){return l.jsx(ne,x({},e,{type:"slider"}))},SafeView:function(e){var t,n=r.ThemeUtils.getCurrentTheme();return r.Utils.isEmpty(n)&&(n=r.useTheme()),l.jsxs(g.SafeAreaProvider,{children:[l.jsx(i.StatusBar,{barStyle:"dark-content"}),l.jsx(g.SafeAreaView,{style:x({backgroundColor:null==(t=n.colors)?void 0:t.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=ue;
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=require("react-native-draggable-flatlist"),f=e(d),p=require("react-native-gesture-handler"),g=require("react-native-safe-area-context");function x(){return(x=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 h(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,p,g,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=x({},n.props);return delete c.children,"string"==typeof i?r.Utils.isEmpty(n.props.children)?l.jsx(i,x({},c)):l.jsx(i,x({},c,{children:l.jsx(h,x({transient:!0,validateScope:s},n.props,{scope:o,crud:a}))})):"function"==typeof i?l.jsx(i,x({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(h,x({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(ne,x({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"),p=y[f],g={},r.Utils.isEmpty(e.style)||(null!=(d=e.style)&&d.push?r.Utils.each(e.style,(function(e){e&&(g=x({},g,e))})):g=x({},e.style)),x({},p,g,o.getStyle(u))),children:l.jsx(v,{})})})}var y=i.StyleSheet.create({child:{width:"100%"},inner:{width:"100%"}});function m(e){var i=e.scope,a=t.useState(0),s=a[0],c=a[1],u=i.original,d=i.getItems(),f=0,p=[],g=t.useState(null),y=g[0],m=g[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=x({},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&&p.push(x({},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(p[s],!1);var S=function(e){v(p[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:p.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(h,x({},e,{scope:i,children:y.child}))}),"stepper"===u.layout&&l.jsxs("div",{className:"ui-tabs-actions",children:[l.jsx(ue.Output,{space:6,layout:"left",children:l.jsx(ue.Include,x({},e,{transient:!0,name:"left",default:l.jsx(ue.Button,{rendered:s>0,icon:l.jsx(o,{}),click:function(){S(-1)}})}))}),l.jsx(ue.Output,{space:6,layout:"right",children:l.jsx(ue.Include,x({},e,{transient:!0,name:"right",default:l.jsx(ue.Button,{rendered:s<p.length-1,icon:l.jsx(o,{}),click:function(){S(1)}})}))})]})]})]})})}function v(e){var t=e.scope;return t.getItems(),r.Utils.asList(t.original.columns),l.jsx("div",{className:"ui-chart-data"})}function j(e){return l.jsx(i.TouchableOpacity,{onPress:function(){i.Linking.openURL("https://reactnative.dev/")},children:l.jsx(i.Text,{style:b.link,children:"Clique aqui para acessar o React Native"})})}var b={link:{}};function S(e){return l.jsx(l.Fragment,{children:l.jsx(j,x({},e.defaultsInput,e.defaultsUI))})}function w(e){return l.jsx(i.TouchableOpacity,{onPress:function(){i.Linking.openURL("https://reactnative.dev/")},children:l.jsx(i.Text,{style:C.link,children:"Clique aqui para acessar o React Native"})})}var C={link:{}};function U(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 T={small:{minWidth:30,height:30}};function k(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 p={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"}},g=function(e,n){var i=x({},p[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=x({},null==h?void 0:h.button);"outlined"===c&&(e.borderWidth=1,e.borderColor=r.Utils.nvl(u,"text")),o&&(e=x({},e,T[o]));var t=g("button",e);if(!t.width){var n=t.height;"number"==typeof n&&(t.minWidth=n)}return t})),m=g("buttonLabel"),v=r.Utils.call((function(){var e=g("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})]})})}function I(e){var n,o,s,c,u=t.useState(!1),d=u[0],f=u[1],p=e.scope,g=p.original,h=r.Utils.nvl(p.getOptions(),[]),y=p.attr("placeholder","Selecione..."),m=p.getDisplayValue(),v=p.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},T=function(e,t){var n=x({},V[e],t);return p.getStyle(e,n)};return l.jsxs(i.View,{style:T("selectRoot"),children:[l.jsxs(i.TouchableOpacity,{onPress:b,style:T("selectInput"),children:[l.jsx(i.Text,{style:T("selectLabel"),children:r.Utils.nvl(m,y)}),l.jsx(a.Ionicons,{name:"chevron-down-outline",size:p.getPart("iconSize",null,24),color:p.getPart("iconColor",null,w),style:T("iconStyle",{})})]}),l.jsxs(i.Modal,{animationType:"slide",transparent:!0,visible:d,onRequestClose:function(){return f(!1)},children:[l.jsx(i.SafeAreaView,{style:T("modalTop")}),l.jsxs(i.SafeAreaView,{style:T("modalSafe"),children:[l.jsxs(i.View,{style:p.getStyle("header",j),children:[l.jsx(i.TouchableOpacity,{onPress:b,style:T("modalCloseButton"),children:l.jsx(a.Ionicons,{name:"close",size:24,color:C,style:T("modalCloseText",U)})}),l.jsx(i.Text,{style:T("modalTitle",U),children:y})]}),l.jsx(i.ScrollView,{contentContainerStyle:{flexGrow:1,paddingBottom:50},style:T("modalContent"),nestedScrollEnabled:!0,ref:S,children:l.jsx(i.View,{style:{flex:1,paddingLeft:15,paddingRight:15,paddingTop:10,paddingBottom:10},children:l.jsx(ue.List,x({data:h,name:p.getName("list"),layout:"card",click:function(e){var t=e.value;p.changeValue(g.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:x({paddingLeft:15,paddinRight:15},null==(s=p.original)?void 0:s.rowStyle)},null==(c=p.original)?void 0:c.listProps,{children:l.jsx(ue.Value,{value:"#{@this.label}"})}))})})]})]})]},p.getName(p.getPart("modal")+"_"+d))}var V=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 P(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),p=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 p(!1)},onSlidingComplete:function(){return p(!0)},style:x({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 L(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 R(e){return l.jsx(i.TouchableOpacity,{onPress:function(){i.Linking.openURL("https://reactnative.dev/")},children:l.jsx(i.Text,{style:D.link,children:"Clique aqui para acessar o React Native"})})}var D={link:{}};function E(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],p=d[1],g=function(e,t){return x({},n.getStyle(e,W[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:g("base"),children:[n.getPart("left"),l.jsx(i.TextInput,{style:g("input"),onChangeText:function(e){e=n.changeValue(e),p(e)},value:f,placeholder:c}),l.jsx(h,{})]}),n.getPart("right")]})}var W=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 q(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:O,list:B})?void 0:n[s.type],p=""+o.key("row",a,""),g=t.useState(r.ScopeUtils.create(x({},s,{parent:o,name:p,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,g),v=function(){return l.jsx(l.Fragment,!m&&s.useIsInView&&!g.visible&&a>20?{}:{children:l.jsx(h,{scope:g,crud:g.crud,children:e.children})})};return l.jsx((function(){var e=t.useState(0),n=e[0],r=e[1],p=o.key("item"),h=function(){var e=g.getStyle("row",x({},f.row,{minHeight:40}));return u>0&&(e.width=d),e};return g.update=function(){o.updateIndex=o.updateIndex+1,r(++n)},!1===g.getPart("renderedItem",void 0,!0)?l.jsx(l.Fragment,{}):s.click?l.jsx(i.TouchableHighlight,{style:h(),underlayColor:"transparent",ref:y,onPress:function(e){e.stopPropagation(),function(e){g.call("click",{value:e,item:e,edit:!0,index:a})}(c)},children:l.jsx(v,{})},p):l.jsx(i.View,{style:h(),ref:y,children:l.jsx(v,{})},p)}),{})}var B=i.StyleSheet.create({row:{padding:5,margin:0,width:"100%",backgroundColor:"background",gap:10,borderRadius:8,justifyContent:"center"}}),O=i.StyleSheet.create({row:{padding:0,width:"100%",justifyContent:"center"}});function N(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:H})?void 0:n[c.type],f=r.ComponentUtils.getDefine(e,"add"),p=c.hideAddWhenEmpty,g=function(){var n=t.useState(o.updateIndex),a=n[0],g=n[1];o.update=function(){o.updateIndex=++a,g(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",x({},{},d.container)),u>1&&(h=x({},h,{flexDirection:"row",flexWrap:"wrap"})),h),children:[l.jsx(v,{}),m.map((function(t,n){return l.jsx(q,{index:n,item:t,scope:o,children:e.children})})),(!r.Utils.isEmpty(m)||!0!==p)&&l.jsx(l.Fragment,{children:f})]},y)};return l.jsxs(l.Fragment,{children:[!1!==c.search&&l.jsx(ue.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(g,{})]})}var H=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 M(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=x({},G.text);return s&&(c.color="#ffffff"),r.Utils.isEmpty(e.children)?l.jsx(i.Text,{style:c,children:o.label}):l.jsx(q,{scope:n,item:o.object,index:a,children:e.children})},p=function(e){var t=x({},G.item,n.getStyle("item")),r=Math.floor(100/o.length)+"%";if(d(e)){var i=n.getPart("selectedColor",void 0,"primary");(t=x({},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:p(e),onPress:function(t){!function(e){n.changeValue(e.object),u(++c)}(e)},children:l.jsx(f,{item:e,index:t})},"k-"+t)}))})}var G=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 _(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 p={padding:0,alignItems:"center",height:30,width:30,textAlign:"center",verticalAling:"middle",borderRadius:24,backgroundColor:f,color:"#ffffff",justifyContent:"center"},g={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:p,addButton:x({},p),delButton:x({},p)},h=function(e){n.changeValue(d+e),u(++c)},y=function(e,t){var r=x({},g[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 K(){var e={success:function(e){return l.jsx(c.BaseToast,x({},e,{style:t.darkToast,contentContainerStyle:{paddingHorizontal:15},text1Style:t.text,text2Style:t.text}))},error:function(e){return l.jsx(c.ErrorToast,x({},e,{style:t.darkToast,text1Style:t.text,text2Style:t.text}))},info:function(e){return l.jsx(c.BaseToast,x({},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 Q(e){var n,a,s=t.useState(!1),c=s[0],u=s[1],d=t.useState(0),f=d[0],p=d[1],g=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=x({},J[e],t);return x({},y.getStyle(e,n))},w=function(){y.close({scope:y,crud:y.currentDialog,event:{}})},C=function(e){u(c=e)};y.update=function(){p(++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",x({parent:t,root:t,name:n,dialog:g.dialog,data:a,edit:i,scope:y},l));g.dialog=s,y.currentDialog=s,C(!0),y.update()},y.dialogHide=function(e){var t;g.dialog=r.Utils.nvl(y.currentDialog.dialog,null),y.currentDialog=null,C(!1),null!=(t=g.dialog)&&t.scope&&g.dialog.scope.update(),y.update()};var U=y.currentDialog;if(!U)return l.jsx(l.Fragment,{});if(U.uuid!==(null==(a=g.dialog)?void 0:a.uuid))return l.jsx(l.Fragment,{});var T=r.ComponentUtils.getDefine(e,"header","right"),k=r.ComponentUtils.getDefine(e,"bottom");y.put("scrollRef",b),r.ComponentUtils.setViewScope(y);var I=r.Utils.nvl(j.color,"white"),V={color:I},P=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:I,style:S("modalCloseText",V)})}),l.jsx(i.Text,{style:S("modalTitle",V),children:m}),!r.Utils.isEmpty(T)&&l.jsx(h,{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(h,{scope:y,crud:y.currentDialog,children:e.children})})}),k]}),l.jsx(K,{})]},P)}var J=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 X(e){var t,n,o=e.scope,a=o.getTheme(),s=o.getPart("header",null,[]),c=r.Utils.nvl(null==(t=a.styles)||null==(t=t.defaults)?void 0:t.header,{}),u=r.Utils.nvl(null==(n=a.styles)||null==(n=n.defaults)?void 0:n.headerText,{}),d=r.Utils.call((function(){var e=o.getStyle("header",c),t=e.backgroundColor;return t&&(e.color=r.HtmlUtils.getTextColor(t)),e})),f=!r.Utils.isEmpty(s);return l.jsx(l.Fragment,{children:f&&l.jsx(i.View,{style:d,children:l.jsx((function(){return"string"==typeof s?l.jsx(i.Text,{style:u,children:s}):l.jsx(l.Fragment,{children:s})}),{})})})}function Y(e){var n=e.scope,o=e.children,a=t.useRef(null),s=n.original,c=function(){var e=r.ViewUtils.getCrud();r.Utils.each(e.scroll,(function(e){e.onScroll&&e.onScroll.call(e)}))};n.put("scrollRef",a),r.ComponentUtils.setViewScope(n);var u=function(){return!1===s.scroll?l.jsx(h,{scope:n,children:o}):l.jsx(i.View,{style:n.getStyle("container",Z.container),children:l.jsx(i.ScrollView,{onScroll:c,scrollEventThrottle:16,ref:a,nestedScrollEnabled:!0,keyboardShouldPersistTaps:"handled",contentContainerStyle:n.getStyle("contentContainer",{paddingBottom:50}),style:n.getStyle("scroll",Z.scroll),children:l.jsx(h,{scope:n,children:o})})})};return l.jsxs(l.Fragment,{children:[l.jsx(X,{scope:n}),l.jsx(u,{}),l.jsx(K,{})]})}var Z=i.StyleSheet.create({scroll:{paddingTop:10,paddingBottom:10,paddingLeft:15,paddingRight:15},container:{},view:{}});function $(e){var n=e.scope,o=n.crud,s=n.original,c=(r.Utils.nvl(n.getPart("cols",void 0,1)),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}))),u=t.useState(c),g=u[0],h=u[1];return l.jsxs(p.GestureHandlerRootView,{style:x({flex:1,width:"100%"},n.getStyle("order",{justifyContent:"flex-start"})),children:[l.jsx(X,{scope:n}),l.jsx(f,{data:g,renderItem:function(e){var t=e.item,r=e.drag,o=e.isActive,s=x({},n.getStyle("row"));return o&&(s=x({},s,n.getStyle("active"))),l.jsx(d.ScaleDecorator,{children:l.jsxs(i.TouchableOpacity,{style:[ee.row,{backgroundColor:o?"lightblue":"white"},x({},s)],delayLongPress:100,onLongPress:r,children:[l.jsx(a.MaterialCommunityIcons,{name:"drag",size:24,color:"black"}),l.jsx(i.Text,{style:ee.text,children:n.getItemLabel(t)})]})})},keyExtractor:function(e){return n.getItemValue(e)},onDragEnd:function(e){var t=e.data;h(t),n.changeValue(t)}})]})}var ee=i.StyleSheet.create({row:{flexDirection:"row",gap:10,padding:15,borderBottomWidth:1,borderBottomColor:"#ccc"},text:{fontSize:18}}),te=t.createContext({});function ne(e){var n,o,s=t.useContext(te),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(x({crud:d},e,{theme:c})))[0],p=t.useState(0),g=p[0],y=p[1],j=t.useState(null),b=j[0],C=j[1];f.compile(e),d=f.crud;var T=f.getOptions(),V=f.original,z=t.useRef(null);f.update=function(){y(++g)},f.updateElement=function(){y(++g)},f.toast=function(e,t,n){void 0===t&&(t="info"),u.show(x({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=V.custom;return e?l.jsx(ne,"string"==typeof e?{element:{value:e,type:"dummy"},crud:d}:x({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 W=function(){var e=f.getValue();q({target:{value:!(!0===e)}})},q=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()},B=function(e){f.call("click")},O={scope:f,crud:d,onChange:q};f.isType("password")&&(O.type="password");var H=function(){return!(f.isInput()||r.Utils.isEmpty(e.children)&&r.Utils.isEmpty(e.elements))},A=f.is("type","text","number","integer","int","phone","postalCode","money","password","email"),G=function(e,t){var n,i=r.Utils.nvl(V.type,"none"),l=r.Utils.nvl(e,"root"),o=x({},oe[l]),a=H();return i=r.Utils.nvl(V.layout,i),e||a||(o=x({},o)),f.isInput()&&(o=x({},o,le.input[l])),o=x({},o,null==le||null==(n=le[i])?void 0:n[l]),a&&e&&(o=x({},o,ae[e])),x({},o,f.getStyle(e,x({},o,t)))},K=G("element"),J={required:f.isRequired(),size:"small",scope:f,crud:d,style:K,placeholder:f.attr("placeholder","Digite aqui")};f.error=function(e){b=e,C(e)},null!=(n=V.list)&&n.url||null!=(o=V.load)&&o.url||f.start(),t.useEffect((function(){f.start()}));var X=function(){return"string"==typeof V.icon?l.jsx(a.Ionicons,{name:V.icon,style:f.getStyle("icon")}):l.jsx(l.Fragment,{children:V.icon})};if(f.open=function(e){i.Linking.openURL(e.url)},t.useLayoutEffect((function(){if(null!=z&&z.current&&f.is("type","card","list","tabs","stepper")){var e=null==z?void 0:z.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 Z=!f.isType("input","grid","list","order","repeat")&&V.click,ee={};Z&&(ee.underlayColor="transparent",ee.onPress=B);var ie=function(){return l.jsxs(l.Fragment,{children:[f.getPart("render",null,l.jsx(l.Fragment,{})),f.is("type","button")&&l.jsxs(k,x({},J,{onClick:B,variant:f.attr("variant","outlined"),children:[V.icon&&l.jsx(X,{}),V.label&&l.jsx(i.Text,{style:f.getPart("label","button"),children:f.getLabel()})]})),f.is("type","icon")&&l.jsx(U,x({},J,{onClick:B,variant:f.attr("variant","outlined"),children:f.getDisplayValue()})),f.is("type","link")&&l.jsxs(w,x({},J,{onClick:B,variant:f.attr("variant","outlined"),children:[V.icon&&l.jsx(X,{}),V.label&&l.jsx(i.Text,{style:f.getPart("label","link"),children:f.getLabel()})]})),A&&l.jsx(E,x({},O,J,{InputProps:x({},V.inputProps)})),f.is("type","complete","autocomplete")&&l.jsx(S,{scope:f,defaultsInput:O,defaultsUI:J}),f.is("type","quantity")&&l.jsx(_,{scope:f,defaultsInput:O,defaultsUI:J}),f.is("type","checkbox","boolean","switch")&&l.jsx(P,x({checked:!0===f.getValue()},O,{onChange:W})),f.isType("slider")&&l.jsx(F,x({},O,{onChange:W})),f.is("type","select")&&l.jsx(I,x({},O,J,{value:f.getSelectedValue()})),f.is("type","toggle")&&l.jsx(M,x({},O,J,{value:f.getSelectedValue()})),f.is("type","radio")&&l.jsx(R,x({},O,J,{row:!0,children:T.map((function(e,t){return l.jsx(L,{control:l.jsx(R,x({},J)),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(U,{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:G("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(h,x({},e,{scope:f,crud:d,style:G(n,i),children:o}))}return l.jsx(l.Fragment,{})},ce=function(){return l.jsxs(l.Fragment,{children:[void 0!==V.label&&!1!==V.label&&!f.isType("button","dialog","modal")&&l.jsxs(i.View,{style:G("outerLabel",{alignSelf:"flex-start",flexDirection:"row",display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),children:[l.jsx(i.Text,{style:G("label"),children:f.getLabel()}),l.jsx(se,{name:"actions",style:{width:"auto"}})]}),!H()&&l.jsxs(l.Fragment,{children:[l.jsx(i.View,{style:G("inner"),children:l.jsx(ie,{})}),b&&l.jsx(i.View,{style:G("error"),children:b})]}),f.isType("list","repeat")&&l.jsx(N,x({},e,{scope:f,crud:d})),f.isType("order")&&l.jsx($,x({},e,{scope:f,crud:d})),f.isType("dialog")&&l.jsx(Q,x({},e,{scope:f,crud:d})),f.isType("chart")&&l.jsx(v,x({},e,{scope:f,crud:d})),f.isType("tabs")&&l.jsx(m,x({},e,{scope:f,crud:d})),f.isType("view")&&l.jsx(Y,x({},e,{scope:f,crud:d})),!f.isType("tabs","view","grid","list","define","repeat","modal","dialog","chart")&&l.jsx(h,x({},e,{scope:f,crud:d,style:G("inner")}))]})},ue=function(e){if(f.is("type|layout","card")){var t=x({},G("box",x({},re.box,{alignSelf:"stretch"})));return l.jsx(i.View,{style:G("card",x({},t)),children:l.jsx(i.View,{style:G("boxInner",{paddingHorizontal:15,paddingVertical:10}),children:e.children})})}return f.isInput()||V.container?l.jsx(i.View,{style:G("container",{padding:5,width:"100%"}),children:e.children}):l.jsx(l.Fragment,{children:e.children})};return l.jsx(te.Provider,{value:{crud:d,theme:c},children:l.jsx((function(e){var t=i.View;return Z&&(t=i.TouchableHighlight),f.isType("dialog","order")||V.transient?l.jsx(l.Fragment,{children:e.children}):l.jsx(t,x({},e))}),x({ref:z,style:G()},ee,{children:l.jsx(ue,{children:l.jsx(ce,{})})}))})}var re=i.StyleSheet.create({box:{borderWidth:0,borderColor:"#dedede",borderStyle:"solid",backgroundColor:"white",borderRadius:12,width:"100%",shadowColor:"#000",shadowOpacity:.1,shadowRadius:4}}),ie=x({},re.box),le={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}}};le.input=i.StyleSheet.create({label:{paddingLeft:0},inner:{flex:1,width:"100%",padding:0,gap:10,alignSelf:"flex-start",flexDirection:"row",flexWrap:"wrap"}}),le.switch={inner:{padding:5}},le.quantity={inner:x({},ie,{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"})},le.toggle=i.StyleSheet.create({inner:x({},ie,{flex:1,width:"100%",gap:10,justifyContent:"center",flexDirection:"row",paddingHorizontal:10,paddingVertical:0,alignSelf:"flex-start",flexWrap:"nowrap"})});var oe=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%"}}),ae=i.StyleSheet.create({root:{gap:10},label:{width:"100%",fontWeight:500,fontSize:24}});function se(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,x({},t,{children:t.children}))}),x({},e.tagProps,{children:l.jsx(h,x({transient:!0},e,{scope:e.scope,crud:e.crud,part:e.name,children:t}))}))}var ce=["type"],ue={Order:function(e){return l.jsx(ne,x({},e,{type:"order"}))},List:function(e){return l.jsx(ne,x({},e,{type:"list"}))},Row:function(e){return l.jsx(ne,x({},e,{type:"row"}))},Value:function(e){return l.jsx(ne,x({},e,{type:"value"}))},Label:function(e){return l.jsx(ne,x({},e,{type:"label"}))},Repeat:function(e){return l.jsx(ne,x({},e,{type:"repeat",props:{search:!1}}))},Define:function(e){return l.jsx(ne,x({},e,{type:"define"}))},Include:function(e){return l.jsx(se,x({},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,ce);return l.jsx(ne,x({},t,{type:"column"}))},Input:function(e){return l.jsx(ne,x({},e))},Text:function(e){return l.jsx(ne,x({},e,{type:"text"}))},Email:function(e){return l.jsx(ne,x({},e,{type:"email"}))},Button:function(e){return l.jsx(ne,x({},e,{type:"button"}))},Link:function(e){return l.jsx(ne,x({},e,{type:"link"}))},Icon:function(e){return l.jsx(ne,x({},e,{type:"icon"}))},Output:function(e){return l.jsx(ne,x({},e,{type:"output"}))},Form:function(e){return l.jsx(ne,x({},e,{type:"form"}))},Crud:function(e){return l.jsx(ne,x({},e,{type:"crud"}))},View:function(e){return l.jsx(ne,x({},e,{type:"view",transient:!0}))},Bottom:function(e){return l.jsx(ne,x({},e,{type:"bottom"}))},Dialog:function(e){return l.jsx(ne,x({},e,{type:"dialog"}))},Content:function(e){return l.jsx(ne,x({},e,{type:"content"}))},Top:function(e){return l.jsx(ne,x({},e,{type:"top"}))},Card:function(e){return l.jsx(ne,x({},e,{type:"card"}))},Tab:function(e){return l.jsx(ne,x({},e,{type:"tab"}))},Tabs:function(e){return l.jsx(ne,x({},e,{type:"tabs"}))},Step:function(e){return l.jsx(ne,x({},e,{type:"tab",layout:"step"}))},Stepper:function(e){return l.jsx(ne,x({},e,{type:"tabs",layout:"stepper"}))},Money:function(e){return l.jsx(ne,x({},e,{type:"money"}))},Chart:function(e){return l.jsx(ne,x({},e,{type:"chart"}))},Password:function(e){return l.jsx(ne,x({},e,{type:"password"}))},Complete:function(e){return l.jsx(ne,x({},e,{type:"complete"}))},Checkbox:function(e){return l.jsx(ne,x({},e,{type:"switch"}))},Switch:function(e){return l.jsx(ne,x({},e,{type:"switch"}))},Radio:function(e){return l.jsx(ne,x({},e,{type:"radio"}))},Select:function(e){return l.jsx(ne,x({},e,{type:"select"}))},Toggle:function(e){return l.jsx(ne,x({},e,{type:"toggle"}))},Entity:function(e){return l.jsx(ne,x({},e,{type:"entity"}))},Element:function(e){return l.jsx(ne,x({},e,{type:"element"}))},Quantity:function(e){return l.jsx(ne,x({},e,{type:"quantity"}))},Slider:function(e){return l.jsx(ne,x({},e,{type:"slider"}))},SafeView:function(e){var t,n=r.ThemeUtils.getCurrentTheme();return r.Utils.isEmpty(n)&&(n=r.useTheme()),l.jsxs(g.SafeAreaProvider,{children:[l.jsx(i.StatusBar,{barStyle:"dark-content"}),l.jsx(g.SafeAreaView,{style:x({backgroundColor:null==(t=n.colors)?void 0:t.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=ue;
2
2
  //# sourceMappingURL=react-crud-mobile.cjs.production.min.js.map