react-crud-mobile 1.0.90 → 1.0.92

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.
Files changed (41) hide show
  1. package/dist/elements/UI.d.ts +11 -10
  2. package/dist/elements/core/UIAutoComplete.d.ts +2 -0
  3. package/dist/elements/core/UIButton.d.ts +3 -0
  4. package/dist/elements/core/UIIcon.d.ts +2 -0
  5. package/dist/elements/core/UIInput.d.ts +3 -0
  6. package/dist/elements/core/UILink.d.ts +2 -0
  7. package/dist/elements/core/UIOption.d.ts +2 -0
  8. package/dist/elements/core/UIRadio.d.ts +2 -0
  9. package/dist/elements/core/UISelect.d.ts +2 -0
  10. package/dist/elements/core/UISwitch.d.ts +3 -0
  11. package/dist/react-crud-mobile.cjs.development.js +49 -44
  12. package/dist/react-crud-mobile.cjs.development.js.map +1 -1
  13. package/dist/react-crud-mobile.cjs.production.min.js +1 -1
  14. package/dist/react-crud-mobile.cjs.production.min.js.map +1 -1
  15. package/dist/react-crud-mobile.esm.js +50 -45
  16. package/dist/react-crud-mobile.esm.js.map +1 -1
  17. package/package.json +1 -1
  18. package/src/elements/UI.tsx +16 -14
  19. package/src/elements/UIComplete.tsx +1 -1
  20. package/src/elements/UIElement.tsx +27 -27
  21. package/src/elements/core/{AutoComplete.tsx → UIAutoComplete.tsx} +1 -1
  22. package/src/elements/core/{Button.tsx → UIButton.tsx} +1 -1
  23. package/src/elements/core/{Radio.tsx → UIIcon.tsx} +1 -1
  24. package/src/elements/core/{Input.tsx → UIInput.tsx} +1 -1
  25. package/src/elements/core/{Icon.tsx → UILink.tsx} +1 -1
  26. package/src/elements/core/{Option.tsx → UIOption.tsx} +1 -1
  27. package/src/elements/core/{Link.tsx → UIRadio.tsx} +1 -1
  28. package/src/elements/core/UISelect.tsx +17 -0
  29. package/src/elements/core/UISwitch.tsx +26 -0
  30. package/src/elements/grid/ElLabel.tsx +1 -1
  31. package/dist/elements/core/AutoComplete.d.ts +0 -2
  32. package/dist/elements/core/Button.d.ts +0 -3
  33. package/dist/elements/core/Icon.d.ts +0 -2
  34. package/dist/elements/core/Input.d.ts +0 -3
  35. package/dist/elements/core/Link.d.ts +0 -2
  36. package/dist/elements/core/Option.d.ts +0 -2
  37. package/dist/elements/core/Radio.d.ts +0 -2
  38. package/dist/elements/core/Select.d.ts +0 -2
  39. package/dist/elements/core/Switch.d.ts +0 -2
  40. package/src/elements/core/Select.tsx +0 -17
  41. package/src/elements/core/Switch.tsx +0 -17
@@ -1,6 +1,6 @@
1
1
  import React, { useState, createElement, useRef, useEffect, useLayoutEffect } from 'react';
2
2
  import { Utils, ScopeUtils, Scope, CrudUtils, ComponentUtils, HtmlUtils } from 'react-crud-utils';
3
- import { View, StyleSheet, TouchableOpacity, Text, Linking, TouchableHighlight, TextInput, Image } from 'react-native';
3
+ import { View, StyleSheet, TouchableOpacity, Text, Linking, TouchableHighlight, Switch, TextInput, Image } from 'react-native';
4
4
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
5
5
  import Ionicons from '@expo/vector-icons/Ionicons';
6
6
  import { Ionicons as Ionicons$1 } from '@expo/vector-icons';
@@ -418,7 +418,7 @@ function ElGridBotom(props) {
418
418
  });
419
419
  }
420
420
 
421
- function Icon(props) {
421
+ function UIIcon(props) {
422
422
  var handlePress = function handlePress() {
423
423
  Linking.openURL('https://reactnative.dev/');
424
424
  };
@@ -450,7 +450,7 @@ function ElLabel(props) {
450
450
  if (typeof original.icon === 'string') {
451
451
  return /*#__PURE__*/jsx("div", {
452
452
  className: "ui-label-icon",
453
- children: /*#__PURE__*/jsx(Icon, {
453
+ children: /*#__PURE__*/jsx(UIIcon, {
454
454
  className: scope.getIcon()
455
455
  })
456
456
  });
@@ -694,7 +694,7 @@ function ElChart(props) {
694
694
  });
695
695
  }
696
696
 
697
- function AutoComplete(props) {
697
+ function UIAutoComplete(props) {
698
698
  var handlePress = function handlePress() {
699
699
  Linking.openURL('https://reactnative.dev/');
700
700
  };
@@ -714,7 +714,7 @@ function UIComplete(_ref) {
714
714
  var defaultsInput = _ref.defaultsInput,
715
715
  defaultsUI = _ref.defaultsUI;
716
716
  return /*#__PURE__*/jsx(Fragment, {
717
- children: /*#__PURE__*/jsx(AutoComplete, _extends({}, defaultsInput, defaultsUI))
717
+ children: /*#__PURE__*/jsx(UIAutoComplete, _extends({}, defaultsInput, defaultsUI))
718
718
  });
719
719
  }
720
720
 
@@ -770,7 +770,7 @@ function ElRepeat(props) {
770
770
  });
771
771
  }
772
772
 
773
- function Link(props) {
773
+ function UILink(props) {
774
774
  var handlePress = function handlePress() {
775
775
  Linking.openURL('https://reactnative.dev/');
776
776
  };
@@ -786,7 +786,7 @@ var styles$3 = {
786
786
  link: {}
787
787
  };
788
788
 
789
- function Button(props) {
789
+ function UIButton(props) {
790
790
  var scope = props.scope;
791
791
  var element = scope.original;
792
792
  var color = element.color;
@@ -853,7 +853,7 @@ function Button(props) {
853
853
  });
854
854
  }
855
855
 
856
- function Select(props) {
856
+ function UISelect(props) {
857
857
  var handlePress = function handlePress() {
858
858
  Linking.openURL('https://reactnative.dev/');
859
859
  };
@@ -869,55 +869,55 @@ var styles$4 = {
869
869
  link: {}
870
870
  };
871
871
 
872
- function Switch(props) {
873
- var handlePress = function handlePress() {
874
- Linking.openURL('https://reactnative.dev/');
872
+ function UISwitch(props) {
873
+ var scope = props.scope;
874
+ var initial = Utils.nvl(scope.getValue(), false);
875
+ var _useState = useState(initial),
876
+ value = _useState[0],
877
+ setValue = _useState[1];
878
+ var onChange = function onChange(v) {
879
+ scope.changeValue(v);
880
+ setValue(v);
875
881
  };
876
- return /*#__PURE__*/jsx(TouchableOpacity, {
877
- onPress: handlePress,
878
- children: /*#__PURE__*/jsx(Text, {
879
- style: styles$5.link,
880
- children: "Clique aqui para acessar o React Native"
881
- })
882
+ return /*#__PURE__*/jsx(Switch, {
883
+ value: value,
884
+ onValueChange: onChange // Alterna o estado
882
885
  });
883
886
  }
884
- var styles$5 = {
885
- link: {}
886
- };
887
887
 
888
- function Option(props) {
888
+ function UIOption(props) {
889
889
  var handlePress = function handlePress() {
890
890
  Linking.openURL('https://reactnative.dev/');
891
891
  };
892
892
  return /*#__PURE__*/jsx(TouchableOpacity, {
893
893
  onPress: handlePress,
894
894
  children: /*#__PURE__*/jsx(Text, {
895
- style: styles$6.link,
895
+ style: styles$5.link,
896
896
  children: "Clique aqui para acessar o React Native"
897
897
  })
898
898
  });
899
899
  }
900
- var styles$6 = {
900
+ var styles$5 = {
901
901
  link: {}
902
902
  };
903
903
 
904
- function Radio(props) {
904
+ function UIRadio(props) {
905
905
  var handlePress = function handlePress() {
906
906
  Linking.openURL('https://reactnative.dev/');
907
907
  };
908
908
  return /*#__PURE__*/jsx(TouchableOpacity, {
909
909
  onPress: handlePress,
910
910
  children: /*#__PURE__*/jsx(Text, {
911
- style: styles$7.link,
911
+ style: styles$6.link,
912
912
  children: "Clique aqui para acessar o React Native"
913
913
  })
914
914
  });
915
915
  }
916
- var styles$7 = {
916
+ var styles$6 = {
917
917
  link: {}
918
918
  };
919
919
 
920
- function Input(props) {
920
+ function UIInput(props) {
921
921
  var scope = props.scope;
922
922
  var initial = Utils.nvl(scope.getValue(), '');
923
923
  var label = scope.getLabel();
@@ -930,13 +930,13 @@ function Input(props) {
930
930
  setValue(v);
931
931
  };
932
932
  return /*#__PURE__*/jsx(TextInput, {
933
- style: styles$8.input,
933
+ style: styles$7.input,
934
934
  onChangeText: onChange,
935
935
  value: value,
936
936
  placeholder: placeholder
937
937
  });
938
938
  }
939
- var styles$8 = /*#__PURE__*/StyleSheet.create({
939
+ var styles$7 = /*#__PURE__*/StyleSheet.create({
940
940
  input: {
941
941
  borderRadius: 20,
942
942
  padding: 10,
@@ -1058,7 +1058,7 @@ function UIElement(props) {
1058
1058
  var _elementStyle$type, _elementStyle$type2;
1059
1059
  var type = Utils.nvl(original.type, 'none');
1060
1060
  var key = Utils.nvl(part, 'root');
1061
- var def = _extends({}, styles$9[key], elementStyle == null || (_elementStyle$type = elementStyle[type]) == null ? void 0 : _elementStyle$type[key]);
1061
+ var def = _extends({}, styles$8[key], elementStyle == null || (_elementStyle$type = elementStyle[type]) == null ? void 0 : _elementStyle$type[key]);
1062
1062
  var hasChild = hasChildren();
1063
1063
  if (!part && !hasChild) {
1064
1064
  def = _extends({}, def, {
@@ -1101,7 +1101,7 @@ function UIElement(props) {
1101
1101
  });
1102
1102
  var CustomIcon = function CustomIcon() {
1103
1103
  if (typeof original.icon === 'string') {
1104
- return /*#__PURE__*/jsx(Icon, {
1104
+ return /*#__PURE__*/jsx(UIIcon, {
1105
1105
  children: scope.getIcon()
1106
1106
  });
1107
1107
  }
@@ -1168,50 +1168,50 @@ function UIElement(props) {
1168
1168
  }), isShowInner() && /*#__PURE__*/jsxs(Fragment, {
1169
1169
  children: [/*#__PURE__*/jsxs(View, {
1170
1170
  style: getStyle('inner'),
1171
- children: [scope.is('type', 'button') && /*#__PURE__*/jsxs(Button, _extends({}, defaultsUI, {
1171
+ children: [scope.is('type', 'button') && /*#__PURE__*/jsxs(UIButton, _extends({}, defaultsUI, {
1172
1172
  onClick: onClick,
1173
1173
  variant: scope.attr('variant', 'outlined'),
1174
1174
  children: [original.icon && /*#__PURE__*/jsx(CustomIcon, {}), original.label && /*#__PURE__*/jsx(Text, {
1175
1175
  style: scope.getPart('label', 'button'),
1176
1176
  children: scope.getLabel()
1177
1177
  })]
1178
- })), scope.is('type', 'icon') && /*#__PURE__*/jsx(Icon, _extends({}, defaultsUI, {
1178
+ })), scope.is('type', 'icon') && /*#__PURE__*/jsx(UIIcon, _extends({}, defaultsUI, {
1179
1179
  onClick: onClick,
1180
1180
  variant: scope.attr('variant', 'outlined'),
1181
1181
  children: scope.getDisplayValue()
1182
- })), scope.is('type', 'link') && /*#__PURE__*/jsxs(Link, _extends({}, defaultsUI, {
1182
+ })), scope.is('type', 'link') && /*#__PURE__*/jsxs(UILink, _extends({}, defaultsUI, {
1183
1183
  onClick: onClick,
1184
1184
  variant: scope.attr('variant', 'outlined'),
1185
1185
  children: [original.icon && /*#__PURE__*/jsx(CustomIcon, {}), original.label && /*#__PURE__*/jsx(Text, {
1186
1186
  style: scope.getPart('label', 'link'),
1187
1187
  children: scope.getLabel()
1188
1188
  })]
1189
- })), scope.is('type', 'text', 'number', 'phone', 'postalCode', 'money', 'password', 'email') && /*#__PURE__*/jsx(Input, _extends({}, defaultsInput, defaultsUI, {
1189
+ })), scope.is('type', 'text', 'number', 'phone', 'postalCode', 'money', 'password', 'email') && /*#__PURE__*/jsx(UIInput, _extends({}, defaultsInput, defaultsUI, {
1190
1190
  InputProps: _extends({}, original.inputProps)
1191
1191
  })), scope.is('type', 'complete', 'autocomplete') && /*#__PURE__*/jsx(UIComplete, {
1192
1192
  scope: scope,
1193
1193
  defaultsInput: defaultsInput,
1194
1194
  defaultsUI: defaultsUI
1195
- }), scope.is('type', 'checkbox', 'boolean', 'switch') && /*#__PURE__*/jsx(Switch, _extends({
1195
+ }), scope.is('type', 'checkbox', 'boolean', 'switch') && /*#__PURE__*/jsx(UISwitch, _extends({
1196
1196
  checked: isChecked()
1197
1197
  }, defaultsInput, {
1198
1198
  onChange: onCheck
1199
- })), scope.is('type', 'select') && /*#__PURE__*/jsxs(Select, _extends({}, defaultsInput, defaultsUI, {
1199
+ })), scope.is('type', 'select') && /*#__PURE__*/jsxs(UISelect, _extends({}, defaultsInput, defaultsUI, {
1200
1200
  value: scope.getSelectedValue(),
1201
- children: [/*#__PURE__*/jsx(Option, {
1201
+ children: [/*#__PURE__*/jsx(UIOption, {
1202
1202
  value: '',
1203
1203
  children: "Selecione"
1204
1204
  }), options.map(function (row, i) {
1205
- return /*#__PURE__*/jsx(Option, {
1205
+ return /*#__PURE__*/jsx(UIOption, {
1206
1206
  value: row.value,
1207
1207
  children: row.label
1208
1208
  }, 'i' + i);
1209
1209
  })]
1210
- })), scope.is('type', 'radio') && /*#__PURE__*/jsx(Radio, _extends({}, defaultsInput, defaultsUI, {
1210
+ })), scope.is('type', 'radio') && /*#__PURE__*/jsx(UIRadio, _extends({}, defaultsInput, defaultsUI, {
1211
1211
  row: true,
1212
1212
  children: options.map(function (row, i) {
1213
- return /*#__PURE__*/jsx(Option, {
1214
- control: /*#__PURE__*/jsx(Radio, _extends({}, defaultsUI)),
1213
+ return /*#__PURE__*/jsx(UIOption, {
1214
+ control: /*#__PURE__*/jsx(UIRadio, _extends({}, defaultsUI)),
1215
1215
  label: row.label,
1216
1216
  value: row.value
1217
1217
  }, 'i' + i);
@@ -1219,7 +1219,7 @@ function UIElement(props) {
1219
1219
  })), scope.is('type', 'custom') && /*#__PURE__*/jsx(Custom, {}), scope.is('type', 'column') && /*#__PURE__*/jsxs(Fragment, {
1220
1220
  children: [scope.is('format', 'img') && /*#__PURE__*/jsx(Image, {
1221
1221
  source: scope.getDisplayValue()
1222
- }), scope.is('format', 'icon') && /*#__PURE__*/jsx(Icon, {
1222
+ }), scope.is('format', 'icon') && /*#__PURE__*/jsx(UIIcon, {
1223
1223
  className: scope.getDisplayValue()
1224
1224
  }), !scope.is('format', 'icon', 'img') && /*#__PURE__*/jsx(Text, {
1225
1225
  children: scope.getDisplayValue()
@@ -1260,7 +1260,7 @@ elementStyle.card = /*#__PURE__*/StyleSheet.create({
1260
1260
  paddingTop: 5
1261
1261
  }
1262
1262
  });
1263
- var styles$9 = /*#__PURE__*/StyleSheet.create({
1263
+ var styles$8 = /*#__PURE__*/StyleSheet.create({
1264
1264
  root: {
1265
1265
  gap: 5,
1266
1266
  flexDirection: 'column',
@@ -1467,7 +1467,12 @@ var UI = {
1467
1467
  },
1468
1468
  Checkbox: function Checkbox(props) {
1469
1469
  return /*#__PURE__*/jsx(UIElement, _extends({}, props, {
1470
- type: "checkbox"
1470
+ type: "switch"
1471
+ }));
1472
+ },
1473
+ Switch: function Switch(props) {
1474
+ return /*#__PURE__*/jsx(UIElement, _extends({}, props, {
1475
+ type: "switch"
1471
1476
  }));
1472
1477
  },
1473
1478
  Radio: function Radio(props) {