react-crud-mobile 1.3.21 → 1.3.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react-crud-mobile.cjs.development.js +3 -2
- package/dist/react-crud-mobile.cjs.development.js.map +1 -1
- package/dist/react-crud-mobile.cjs.production.min.js +1 -1
- package/dist/react-crud-mobile.cjs.production.min.js.map +1 -1
- package/dist/react-crud-mobile.esm.js +3 -2
- package/dist/react-crud-mobile.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/elements/core/UISelect.tsx +2 -1
|
@@ -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-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 r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}function p(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,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 i=n.type,c=f({},n.props);return delete c.children,"string"==typeof i?r.Utils.isEmpty(n.props.children)?l.jsx(i,f({},c)):l.jsx(i,f({},c,{children:l.jsx(p,f({transient:!0,validateScope:s},n.props,{scope:o,crud:a}))})):"function"==typeof i?l.jsx(i,f({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(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,{}):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,x=r.Utils.nvl(u,"root"),h=g[x],y={},r.Utils.isEmpty(e.style)||(null!=(d=e.style)&&d.push?r.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=i.StyleSheet.create({child:{width:"100%"},inner:{width:"100%"}});function x(e){var i=e.scope,a=t.useState(0),s=a[0],c=a[1],u=i.original,d=i.getItems(),g=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=f({},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(f({},o,{child:e,element:o,original:n,index:g++,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(p,f({},e,{scope:i,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(),r.Utils.asList(t.original.columns),l.jsx("div",{className:"ui-chart-data"})}function y(e){return l.jsx(i.TouchableOpacity,{onPress:function(){i.Linking.openURL("https://reactnative.dev/")},children:l.jsx(i.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(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){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 w={small:{minWidth:30,height:30}};function C(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(),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 i=f({},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=p?{height:40,padding:0}:{height:50};var y=r.Utils.call((function(){var e=f({},null==h?void 0:h.button);"outlined"===c&&(e.borderWidth=1,e.borderColor=r.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=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:[p&&l.jsx(l.Fragment,{children:l.jsx(a.Ionicons,{size:r.Utils.nvl(n.iconSize,30),style:v,name:p})}),d&&l.jsx(i.Text,{style:m,children:d})]})})}var T=function(){function e(){}return e.syncTheme=function(){},e}();function U(e){var n,o=t.useState(!1),s=o[0],c=o[1],u=e.scope,d=u.original,p=r.Utils.nvl(u.getOptions(),[]),g=u.attr("placeholder","Selecione..."),x=u.getDisplayValue(),h=r.ViewUtils.getCrud("view"),y=u.getTheme(),m=function(){var e=!s;h.data.selectIsOpen=e,c(e)},v=r.Utils.nvl(null==(n=y.colors)?void 0:n.text,"#100e0e"),j=function(e,t){var n=f({},k[e],t);return u.getStyle(e,n)};return t.useEffect((function(){T.syncTheme()}),[s]),l.jsxs(i.View,{style:j("selectRoot"),children:[l.jsxs(i.TouchableOpacity,{onPress:m,style:j("selectInput"),children:[l.jsx(i.Text,{style:j("selectLabel"),children:r.Utils.nvl(x,g)}),l.jsx(a.Ionicons,{name:"chevron-down-outline",size:u.getPart("iconSize",null,24),color:u.getPart("iconColor",null,v),style:j("iconStyle",{})})]}),l.jsxs(i.Modal,{animationType:"slide",transparent:!0,visible:s,onRequestClose:function(){return c(!1)},children:[l.jsx(i.SafeAreaView,{style:j("modalTop")}),l.jsxs(i.SafeAreaView,{style:j("modalSafe"),children:[l.jsxs(i.View,{style:j("modalHeader"),children:[l.jsx(i.TouchableOpacity,{onPress:function(){return c(!1)},style:j("modalCloseButton"),children:l.jsx(i.Text,{style:j("modalCloseText"),children:"X"})}),l.jsx(i.Text,{style:j("modalTitle"),children:g})]}),l.jsx(i.View,{style:j("modalContent"),children:l.jsx(le.List,{data:p,name:u.getName("list"),click:function(e){var t=e.value;u.changeValue(d.isObject&&null!=t&&t.object?null==t?void 0:t.object:null!=t&&t.value?null==t?void 0:t.value:t),m()},children:l.jsx(le.Value,{value:"#{@this.label}"})})})]})]})]})}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",paddingTop:10,paddingBottom:10,paddingLeft:15,paddingRight:15}});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 I(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),p=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: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=r.Utils.nvl(e,0),console.log(e),n.changeValue(e),c(e)}})})}function F(e){return l.jsx(i.TouchableOpacity,{onPress:function(){i.Linking.openURL("https://reactnative.dev/")},children:l.jsx(i.Text,{style:P.link,children:"Clique aqui para acessar o React Native"})})}var P={link:{}};function z(e){return l.jsx(i.TouchableOpacity,{onPress:function(){i.Linking.openURL("https://reactnative.dev/")},children:l.jsx(i.Text,{style:R.link,children:"Clique aqui para acessar o React Native"})})}var R={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),p=d[0],g=d[1],x=function(e,t){return f({},n.getStyle(e,L[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:p,placeholder:c}),l.jsx(h,{})]}),n.getPart("right")]})}var L=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 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(r.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 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(p,{scope:h,crud:h.crud,children:e.children})})};return l.jsx((function(){var e=t.useState(0),n=e[0],r=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,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,{})},p):l.jsx(i.View,{style:x(),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"}}),W=i.StyleSheet.create({row:{padding:0,width:"100%",justifyContent:"center"}});function q(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:N,list:O})?void 0:n[c.type],p=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",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})})),(!r.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=i.StyleSheet.create({container:{display:"flex",flexWrap:"wrap",gap:10,width:"100%"},text:{fontSize:18,fontWeight:"bold"}}),N=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},p=function(t){var o=t.item,a=t.index,s=d(o),c=f({},A.text);return s&&(c.color="#ffffff"),r.Utils.isEmpty(e.children)?l.jsx(i.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")),r=Math.floor(100/o.length)+"%";if(d(e)){var i=n.getPart("selectedColor",void 0,"primary");(t=f({},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(p,{item:e,index:t})},"k-"+t)}))})}var A=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 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 r=f({},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 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=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),g=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=f({},_[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"),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",f({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()},t.useEffect((function(){T.syncTheme()}),[c]);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 k=r.ComponentUtils.getDefine(e,"header","right");y.put("scrollRef",b),r.ComponentUtils.setViewScope(y);var V=r.Utils.nvl(j.color,"white"),I={color:V},F=y.currentDialog.name+"-"+g;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:V,style:S("modalCloseText",I)})}),l.jsx(i.Text,{style:S("modalTitle",I),children:m}),!r.Utils.isEmpty(k)&&l.jsx(p,{scope:y,crud:y.currentDialog,transient:!0,children:k})]}),l.jsx(i.ScrollView,{contentContainerStyle:{flexGrow:1,paddingBottom:50},style:S("modalContent"),nestedScrollEnabled:!0,ref:b,children:l.jsx(i.View,{style:{flex:1},children:l.jsx(p,{scope:y,crud:y.currentDialog,children:e.children})})})]}),l.jsx(G,{})]},F)}var _=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",paddingTop:10,paddingBottom:10,paddingLeft:15,paddingRight:15}});function Q(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,{}),g=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",g),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:g,nestedScrollEnabled:!0,keyboardShouldPersistTaps:"handled",contentContainerStyle:a.getStyle("contentContainer",{paddingBottom:50}),style:a.getStyle("scroll",X.scroll),children:l.jsx(p,{scope:a,children:s})})}),l.jsx(G,{})]})}var X=i.StyleSheet.create({scroll:{paddingTop:10,paddingBottom:10,paddingLeft:15,paddingRight:15},container:{},view:{}}),J=t.createContext({});function Y(e){var n,o,s=t.useContext(J),c=r.Utils.nvl(e.theme,null==s?void 0:s.theme),d=r.Utils.nvl(e.crud,null==s?void 0:s.crud),g=t.useState(r.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];d=g.crud;var P=g.getOptions(),R=g.original,L=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=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 g.execute(e)}}],{cancelable:!1})}};var D=function(){var e=R.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()||r.Utils.isEmpty(e.children)&&r.Utils.isEmpty(e.elements))},G=g.is("type","text","number","integer","int","phone","postalCode","money","password","email"),_=function(e,t){var n,i=r.Utils.nvl(R.type,"none"),l=r.Utils.nvl(e,"root"),o=f({},te[l]),a=A();return i=r.Utils.nvl(R.layout,i),e||a||(o=f({},o)),g.isInput()&&(o=f({},o,ee.input[l])),o=f({},o,null==ee||null==(n=ee[i])?void 0:n[l]),a&&e&&(o=f({},o,ne[e])),f({},o,g.getStyle(e,f({},o,t)))},X=_("element"),$={required:g.isRequired(),size:"small",scope:g,crud:d,style:X,placeholder:g.attr("placeholder","Digite aqui")};g.error=function(e){T=e,k(e)},null!=(n=R.list)&&n.url||null!=(o=R.load)&&o.url||g.start(),t.useEffect((function(){g.start()}));var re=function(){return"string"==typeof R.icon?l.jsx(a.Ionicons,{name:R.icon,style:g.getStyle("icon")}):l.jsx(l.Fragment,{children:R.icon})};if(g.open=function(e){i.Linking.openURL(e.url)},t.useLayoutEffect((function(){if(null!=L&&L.current&&g.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")}}})),!g.isRendered()||g.is("type","define"))return l.jsx(l.Fragment,{});var ie=i.View,le={};!g.isType("input","grid","list","repeat")&&R.click&&(ie=i.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:[R.icon&&l.jsx(re,{}),R.label&&l.jsx(i.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:[R.icon&&l.jsx(re,{}),R.label&&l.jsx(i.Text,{style:g.getPart("label","link"),children:g.getLabel()})]})),G&&l.jsx(E,f({},N,$,{InputProps:f({},R.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(z,f({},N,$,{row:!0,children:P.map((function(e,t){return l.jsx(F,{control:l.jsx(z,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(i.Image,{source:g.getDisplayValue()}),g.is("format","icon")&&l.jsx(S,{scope:g,crud:d}),!g.is("format","icon","img")&&l.jsx(i.Text,{children:g.getDisplayValue()})]}),g.is("type","output","value")&&l.jsx(i.Text,{style:_("value"),children:g.getDisplayValue()})]})},ae=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(p,f({},e,{scope:g,crud:d,style:_(n,i),children:o}))}return l.jsx(l.Fragment,{})},se=function(){return l.jsxs(l.Fragment,{children:[void 0!==R.label&&!1!==R.label&&!g.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:g.getLabel()}),l.jsx(ae,{name:"actions",style:{width:"auto"}})]}),!A()&&l.jsxs(l.Fragment,{children:[l.jsx(i.View,{style:_("inner"),children:l.jsx(oe,{})}),T&&l.jsx(i.View,{style:_("error"),children:T})]}),g.isType("list","repeat")&&l.jsx(q,f({},e,{scope:g,crud:d})),g.isType("dialog")&&l.jsx(K,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:_("inner")}))]})},ce=function(e){if(g.is("type|layout","card")){var t=f({},_("box",f({},Z.box,{alignSelf:"stretch"})));return l.jsx(i.View,{style:_("card",f({},t)),children:l.jsx(i.View,{style:_("boxInner",{paddingHorizontal:15,paddingVertical:10}),children:e.children})})}return g.isInput()||R.container?l.jsx(i.View,{style:_("container",{padding:5,width:"100%"}),children:e.children}):l.jsx(l.Fragment,{children:e.children})};return l.jsx(J.Provider,{value:{crud:d,theme:c},children:l.jsx(ie,f({ref:L,style:_()},le,{children:l.jsx(ce,{children:l.jsx(se,{})})}))})}var Z=i.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=i.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=i.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=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%"}}),ne=i.StyleSheet.create({root:{gap:10},label:{width:"100%",fontWeight:500,fontSize:24}});function re(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,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 ie=["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(re,f({},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,ie);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=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(d.SafeAreaProvider,{children:[l.jsx(i.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(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=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=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 r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}function p(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,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 i=n.type,c=f({},n.props);return delete c.children,"string"==typeof i?r.Utils.isEmpty(n.props.children)?l.jsx(i,f({},c)):l.jsx(i,f({},c,{children:l.jsx(p,f({transient:!0,validateScope:s},n.props,{scope:o,crud:a}))})):"function"==typeof i?l.jsx(i,f({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(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,{}):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,x=r.Utils.nvl(u,"root"),h=g[x],y={},r.Utils.isEmpty(e.style)||(null!=(d=e.style)&&d.push?r.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=i.StyleSheet.create({child:{width:"100%"},inner:{width:"100%"}});function x(e){var i=e.scope,a=t.useState(0),s=a[0],c=a[1],u=i.original,d=i.getItems(),g=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=f({},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(f({},o,{child:e,element:o,original:n,index:g++,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(p,f({},e,{scope:i,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(),r.Utils.asList(t.original.columns),l.jsx("div",{className:"ui-chart-data"})}function y(e){return l.jsx(i.TouchableOpacity,{onPress:function(){i.Linking.openURL("https://reactnative.dev/")},children:l.jsx(i.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(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){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 w={small:{minWidth:30,height:30}};function C(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(),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 i=f({},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=p?{height:40,padding:0}:{height:50};var y=r.Utils.call((function(){var e=f({},null==h?void 0:h.button);"outlined"===c&&(e.borderWidth=1,e.borderColor=r.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=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:[p&&l.jsx(l.Fragment,{children:l.jsx(a.Ionicons,{size:r.Utils.nvl(n.iconSize,30),style:v,name:p})}),d&&l.jsx(i.Text,{style:m,children:d})]})})}var T=function(){function e(){}return e.syncTheme=function(){},e}();function U(e){var n,o,s=t.useState(!1),c=s[0],u=s[1],d=e.scope,p=d.original,g=r.Utils.nvl(d.getOptions(),[]),x=d.attr("placeholder","Selecione..."),h=d.getDisplayValue(),y=r.ViewUtils.getCrud("view"),m=d.getTheme(),v=r.Utils.nvl(null==(n=m.styles)||null==(n=n.defaults)?void 0:n.header,{}),j=function(){var e=!c;y.data.selectIsOpen=e,u(e)},b=r.Utils.nvl(null==(o=m.colors)?void 0:o.text,"#100e0e"),S=function(e,t){var n=f({},k[e],t);return d.getStyle(e,n)};return t.useEffect((function(){T.syncTheme()}),[c]),l.jsxs(i.View,{style:S("selectRoot"),children:[l.jsxs(i.TouchableOpacity,{onPress:j,style:S("selectInput"),children:[l.jsx(i.Text,{style:S("selectLabel"),children:r.Utils.nvl(h,x)}),l.jsx(a.Ionicons,{name:"chevron-down-outline",size:d.getPart("iconSize",null,24),color:d.getPart("iconColor",null,b),style:S("iconStyle",{})})]}),l.jsxs(i.Modal,{animationType:"slide",transparent:!0,visible:c,onRequestClose:function(){return u(!1)},children:[l.jsx(i.SafeAreaView,{style:S("modalTop")}),l.jsxs(i.SafeAreaView,{style:S("modalSafe"),children:[l.jsxs(i.View,{style:d.getStyle("header",v),children:[l.jsx(i.TouchableOpacity,{onPress:function(){return u(!1)},style:S("modalCloseButton"),children:l.jsx(i.Text,{style:S("modalCloseText"),children:"X"})}),l.jsx(i.Text,{style:S("modalTitle"),children:x})]}),l.jsx(i.View,{style:S("modalContent"),children:l.jsx(le.List,{data:g,name:d.getName("list"),click:function(e){var t=e.value;d.changeValue(p.isObject&&null!=t&&t.object?null==t?void 0:t.object:null!=t&&t.value?null==t?void 0:t.value:t),j()},children:l.jsx(le.Value,{value:"#{@this.label}"})})})]})]})]})}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",paddingTop:10,paddingBottom:10,paddingLeft:15,paddingRight:15}});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 I(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),p=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: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=r.Utils.nvl(e,0),console.log(e),n.changeValue(e),c(e)}})})}function F(e){return l.jsx(i.TouchableOpacity,{onPress:function(){i.Linking.openURL("https://reactnative.dev/")},children:l.jsx(i.Text,{style:P.link,children:"Clique aqui para acessar o React Native"})})}var P={link:{}};function z(e){return l.jsx(i.TouchableOpacity,{onPress:function(){i.Linking.openURL("https://reactnative.dev/")},children:l.jsx(i.Text,{style:R.link,children:"Clique aqui para acessar o React Native"})})}var R={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),p=d[0],g=d[1],x=function(e,t){return f({},n.getStyle(e,L[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:p,placeholder:c}),l.jsx(h,{})]}),n.getPart("right")]})}var L=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 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(r.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 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(p,{scope:h,crud:h.crud,children:e.children})})};return l.jsx((function(){var e=t.useState(0),n=e[0],r=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,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,{})},p):l.jsx(i.View,{style:x(),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"}}),W=i.StyleSheet.create({row:{padding:0,width:"100%",justifyContent:"center"}});function q(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:N,list:O})?void 0:n[c.type],p=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",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})})),(!r.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=i.StyleSheet.create({container:{display:"flex",flexWrap:"wrap",gap:10,width:"100%"},text:{fontSize:18,fontWeight:"bold"}}),N=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},p=function(t){var o=t.item,a=t.index,s=d(o),c=f({},A.text);return s&&(c.color="#ffffff"),r.Utils.isEmpty(e.children)?l.jsx(i.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")),r=Math.floor(100/o.length)+"%";if(d(e)){var i=n.getPart("selectedColor",void 0,"primary");(t=f({},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(p,{item:e,index:t})},"k-"+t)}))})}var A=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 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 r=f({},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 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=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),g=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=f({},_[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"),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",f({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()},t.useEffect((function(){T.syncTheme()}),[c]);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 k=r.ComponentUtils.getDefine(e,"header","right");y.put("scrollRef",b),r.ComponentUtils.setViewScope(y);var V=r.Utils.nvl(j.color,"white"),I={color:V},F=y.currentDialog.name+"-"+g;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:V,style:S("modalCloseText",I)})}),l.jsx(i.Text,{style:S("modalTitle",I),children:m}),!r.Utils.isEmpty(k)&&l.jsx(p,{scope:y,crud:y.currentDialog,transient:!0,children:k})]}),l.jsx(i.ScrollView,{contentContainerStyle:{flexGrow:1,paddingBottom:50},style:S("modalContent"),nestedScrollEnabled:!0,ref:b,children:l.jsx(i.View,{style:{flex:1},children:l.jsx(p,{scope:y,crud:y.currentDialog,children:e.children})})})]}),l.jsx(G,{})]},F)}var _=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",paddingTop:10,paddingBottom:10,paddingLeft:15,paddingRight:15}});function Q(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,{}),g=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",g),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:g,nestedScrollEnabled:!0,keyboardShouldPersistTaps:"handled",contentContainerStyle:a.getStyle("contentContainer",{paddingBottom:50}),style:a.getStyle("scroll",X.scroll),children:l.jsx(p,{scope:a,children:s})})}),l.jsx(G,{})]})}var X=i.StyleSheet.create({scroll:{paddingTop:10,paddingBottom:10,paddingLeft:15,paddingRight:15},container:{},view:{}}),J=t.createContext({});function Y(e){var n,o,s=t.useContext(J),c=r.Utils.nvl(e.theme,null==s?void 0:s.theme),d=r.Utils.nvl(e.crud,null==s?void 0:s.crud),g=t.useState(r.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];d=g.crud;var P=g.getOptions(),R=g.original,L=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=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 g.execute(e)}}],{cancelable:!1})}};var D=function(){var e=R.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()||r.Utils.isEmpty(e.children)&&r.Utils.isEmpty(e.elements))},G=g.is("type","text","number","integer","int","phone","postalCode","money","password","email"),_=function(e,t){var n,i=r.Utils.nvl(R.type,"none"),l=r.Utils.nvl(e,"root"),o=f({},te[l]),a=A();return i=r.Utils.nvl(R.layout,i),e||a||(o=f({},o)),g.isInput()&&(o=f({},o,ee.input[l])),o=f({},o,null==ee||null==(n=ee[i])?void 0:n[l]),a&&e&&(o=f({},o,ne[e])),f({},o,g.getStyle(e,f({},o,t)))},X=_("element"),$={required:g.isRequired(),size:"small",scope:g,crud:d,style:X,placeholder:g.attr("placeholder","Digite aqui")};g.error=function(e){T=e,k(e)},null!=(n=R.list)&&n.url||null!=(o=R.load)&&o.url||g.start(),t.useEffect((function(){g.start()}));var re=function(){return"string"==typeof R.icon?l.jsx(a.Ionicons,{name:R.icon,style:g.getStyle("icon")}):l.jsx(l.Fragment,{children:R.icon})};if(g.open=function(e){i.Linking.openURL(e.url)},t.useLayoutEffect((function(){if(null!=L&&L.current&&g.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")}}})),!g.isRendered()||g.is("type","define"))return l.jsx(l.Fragment,{});var ie=i.View,le={};!g.isType("input","grid","list","repeat")&&R.click&&(ie=i.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:[R.icon&&l.jsx(re,{}),R.label&&l.jsx(i.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:[R.icon&&l.jsx(re,{}),R.label&&l.jsx(i.Text,{style:g.getPart("label","link"),children:g.getLabel()})]})),G&&l.jsx(E,f({},N,$,{InputProps:f({},R.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(z,f({},N,$,{row:!0,children:P.map((function(e,t){return l.jsx(F,{control:l.jsx(z,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(i.Image,{source:g.getDisplayValue()}),g.is("format","icon")&&l.jsx(S,{scope:g,crud:d}),!g.is("format","icon","img")&&l.jsx(i.Text,{children:g.getDisplayValue()})]}),g.is("type","output","value")&&l.jsx(i.Text,{style:_("value"),children:g.getDisplayValue()})]})},ae=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(p,f({},e,{scope:g,crud:d,style:_(n,i),children:o}))}return l.jsx(l.Fragment,{})},se=function(){return l.jsxs(l.Fragment,{children:[void 0!==R.label&&!1!==R.label&&!g.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:g.getLabel()}),l.jsx(ae,{name:"actions",style:{width:"auto"}})]}),!A()&&l.jsxs(l.Fragment,{children:[l.jsx(i.View,{style:_("inner"),children:l.jsx(oe,{})}),T&&l.jsx(i.View,{style:_("error"),children:T})]}),g.isType("list","repeat")&&l.jsx(q,f({},e,{scope:g,crud:d})),g.isType("dialog")&&l.jsx(K,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:_("inner")}))]})},ce=function(e){if(g.is("type|layout","card")){var t=f({},_("box",f({},Z.box,{alignSelf:"stretch"})));return l.jsx(i.View,{style:_("card",f({},t)),children:l.jsx(i.View,{style:_("boxInner",{paddingHorizontal:15,paddingVertical:10}),children:e.children})})}return g.isInput()||R.container?l.jsx(i.View,{style:_("container",{padding:5,width:"100%"}),children:e.children}):l.jsx(l.Fragment,{children:e.children})};return l.jsx(J.Provider,{value:{crud:d,theme:c},children:l.jsx(ie,f({ref:L,style:_()},le,{children:l.jsx(ce,{children:l.jsx(se,{})})}))})}var Z=i.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=i.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=i.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=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%"}}),ne=i.StyleSheet.create({root:{gap:10},label:{width:"100%",fontWeight:500,fontSize:24}});function re(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,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 ie=["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(re,f({},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,ie);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=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(d.SafeAreaProvider,{children:[l.jsx(i.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(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=le;
|
|
2
2
|
//# sourceMappingURL=react-crud-mobile.cjs.production.min.js.map
|