react-crud-mobile 1.3.51 → 1.3.52
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/elements/UI.d.ts +1 -0
- package/dist/elements/core/UIOrder.d.ts +3 -0
- package/dist/react-crud-mobile.cjs.development.js +158 -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 +158 -2
- package/dist/react-crud-mobile.esm.js.map +1 -1
- package/package.json +76 -75
- package/src/elements/UI.tsx +74 -73
- package/src/elements/UIChildren.tsx +139 -139
- package/src/elements/UIComplete.tsx +14 -14
- package/src/elements/UIElement.tsx +707 -701
- package/src/elements/UITag.tsx +13 -13
- package/src/elements/charts/ElChart.tsx +10 -10
- package/src/elements/core/SafeView.tsx +69 -69
- package/src/elements/core/UIButton.tsx +139 -139
- package/src/elements/core/UIIcon.tsx +25 -25
- package/src/elements/core/UIInclude.tsx +40 -40
- package/src/elements/core/UIInput.tsx +96 -96
- package/src/elements/core/UIList.tsx +168 -168
- package/src/elements/core/UIListRow.tsx +123 -123
- package/src/elements/core/UIModal.tsx +206 -206
- package/src/elements/core/UIOrder.tsx +169 -0
- package/src/elements/core/UIQuantity.tsx +98 -98
- package/src/elements/core/UISelect.tsx +177 -177
- package/src/elements/core/UIToast.tsx +44 -44
- package/src/elements/core/UIToggle.tsx +102 -102
- package/src/elements/core/UIView.tsx +94 -94
- package/src/elements/index.ts +1 -1
- package/src/elements/tabs/ElTabs.tsx +178 -178
- package/src/index.ts +1 -1
|
@@ -6,6 +6,7 @@ import Ionicons from '@expo/vector-icons/Ionicons';
|
|
|
6
6
|
import { Ionicons as Ionicons$1, AntDesign, Entypo, EvilIcons, MaterialCommunityIcons } from '@expo/vector-icons';
|
|
7
7
|
import Slider from '@react-native-community/slider';
|
|
8
8
|
import Toast, { BaseToast, ErrorToast } from 'react-native-toast-message';
|
|
9
|
+
import DraggableFlatList from 'react-native-draggable-flatlist';
|
|
9
10
|
import { SafeAreaProvider, SafeAreaView as SafeAreaView$1 } from 'react-native-safe-area-context';
|
|
10
11
|
|
|
11
12
|
function _extends() {
|
|
@@ -1590,6 +1591,153 @@ var styles$9 = /*#__PURE__*/StyleSheet.create({
|
|
|
1590
1591
|
view: {}
|
|
1591
1592
|
});
|
|
1592
1593
|
|
|
1594
|
+
function UIOrder(props) {
|
|
1595
|
+
var scope = props.scope;
|
|
1596
|
+
var crud = scope.crud;
|
|
1597
|
+
var original = scope.original;
|
|
1598
|
+
var cols = Utils.nvl(scope.getPart('cols', undefined, 1));
|
|
1599
|
+
var add = ComponentUtils.getDefine(props, 'add');
|
|
1600
|
+
var hideAddWhenEmpty = original.hideAddWhenEmpty;
|
|
1601
|
+
var getStyle = function getStyle(key, extra) {
|
|
1602
|
+
return scope.getStyle(key, _extends({}, extra, styles$a[key]));
|
|
1603
|
+
};
|
|
1604
|
+
var getContainerStyle = function getContainerStyle(extra) {
|
|
1605
|
+
var row = getStyle('container', {});
|
|
1606
|
+
if (cols > 1) {
|
|
1607
|
+
row = _extends({}, row, {
|
|
1608
|
+
flexDirection: 'row',
|
|
1609
|
+
flexWrap: 'wrap'
|
|
1610
|
+
});
|
|
1611
|
+
}
|
|
1612
|
+
return row;
|
|
1613
|
+
};
|
|
1614
|
+
var LocalData = function LocalData() {
|
|
1615
|
+
var _useState = useState(scope.updateIndex),
|
|
1616
|
+
index = _useState[0],
|
|
1617
|
+
setIndex = _useState[1];
|
|
1618
|
+
scope.update = function () {
|
|
1619
|
+
scope.updateIndex = ++index;
|
|
1620
|
+
setIndex(index);
|
|
1621
|
+
};
|
|
1622
|
+
var keyData = scope.key('data');
|
|
1623
|
+
var items = Utils.call(function () {
|
|
1624
|
+
var _original$list;
|
|
1625
|
+
var list = Utils.nvl(scope.getItems(), []);
|
|
1626
|
+
if (original.search && !((_original$list = original.list) != null && _original$list.url)) {
|
|
1627
|
+
var query = crud.get('query', '').toLowerCase().trim();
|
|
1628
|
+
if (query.length > 1) {
|
|
1629
|
+
var filters = [];
|
|
1630
|
+
var filterBy = Utils.nvl(original.filterBy, 'label');
|
|
1631
|
+
Utils.each(list, function (o) {
|
|
1632
|
+
var label = o[filterBy];
|
|
1633
|
+
if (label) {
|
|
1634
|
+
if (label.includes(query)) {
|
|
1635
|
+
filters.push(o);
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
});
|
|
1639
|
+
return filters;
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
return list;
|
|
1643
|
+
});
|
|
1644
|
+
var isShowAdd = function isShowAdd() {
|
|
1645
|
+
if (!Utils.isEmpty(items)) {
|
|
1646
|
+
return true;
|
|
1647
|
+
}
|
|
1648
|
+
return hideAddWhenEmpty !== true;
|
|
1649
|
+
};
|
|
1650
|
+
var Empty = function Empty() {
|
|
1651
|
+
if (!Utils.isEmpty(items)) {
|
|
1652
|
+
return /*#__PURE__*/jsx(Fragment, {});
|
|
1653
|
+
}
|
|
1654
|
+
var empty = scope.attr('empty', 'Sem registro');
|
|
1655
|
+
if (!empty) {
|
|
1656
|
+
return /*#__PURE__*/jsx(Fragment, {});
|
|
1657
|
+
}
|
|
1658
|
+
if (typeof empty === 'string') {
|
|
1659
|
+
return /*#__PURE__*/jsx(Text, {
|
|
1660
|
+
style: scope.getStyle('empty', {
|
|
1661
|
+
flex: 1,
|
|
1662
|
+
fontWeight: 500,
|
|
1663
|
+
fontSize: 20,
|
|
1664
|
+
padding: 10,
|
|
1665
|
+
textAlign: 'center',
|
|
1666
|
+
justifyContent: 'center',
|
|
1667
|
+
alignItems: 'center'
|
|
1668
|
+
}),
|
|
1669
|
+
children: empty
|
|
1670
|
+
});
|
|
1671
|
+
}
|
|
1672
|
+
return /*#__PURE__*/jsx(Fragment, {
|
|
1673
|
+
children: empty
|
|
1674
|
+
});
|
|
1675
|
+
};
|
|
1676
|
+
var renderItem = function renderItem(_ref) {
|
|
1677
|
+
var item = _ref.item,
|
|
1678
|
+
drag = _ref.drag,
|
|
1679
|
+
isActive = _ref.isActive;
|
|
1680
|
+
return /*#__PURE__*/jsx(TouchableOpacity, {
|
|
1681
|
+
style: [styles$a.row, {
|
|
1682
|
+
backgroundColor: isActive ? 'lightblue' : 'white'
|
|
1683
|
+
}],
|
|
1684
|
+
onLongPress: drag // Initiate drag on long press
|
|
1685
|
+
,
|
|
1686
|
+
children: /*#__PURE__*/jsx(Text, {
|
|
1687
|
+
style: styles$a.text,
|
|
1688
|
+
children: scope.getItemLabel(item)
|
|
1689
|
+
})
|
|
1690
|
+
});
|
|
1691
|
+
};
|
|
1692
|
+
return /*#__PURE__*/jsxs(View, {
|
|
1693
|
+
style: getContainerStyle(),
|
|
1694
|
+
children: [/*#__PURE__*/jsx(Empty, {}), /*#__PURE__*/jsx(DraggableFlatList, {
|
|
1695
|
+
data: items,
|
|
1696
|
+
renderItem: renderItem,
|
|
1697
|
+
keyExtractor: function keyExtractor(item) {
|
|
1698
|
+
return scope.getItemValue(item);
|
|
1699
|
+
},
|
|
1700
|
+
onDragEnd: function onDragEnd(_ref2) {
|
|
1701
|
+
var data = _ref2.data;
|
|
1702
|
+
scope.changeValue(data);
|
|
1703
|
+
}
|
|
1704
|
+
}), isShowAdd() && /*#__PURE__*/jsx(Fragment, {
|
|
1705
|
+
children: add
|
|
1706
|
+
})]
|
|
1707
|
+
}, keyData);
|
|
1708
|
+
};
|
|
1709
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
1710
|
+
children: [original.search !== false && /*#__PURE__*/jsx(UI.Text, {
|
|
1711
|
+
placeholder: "Pesquisar...",
|
|
1712
|
+
field: "query",
|
|
1713
|
+
crud: crud,
|
|
1714
|
+
style: {
|
|
1715
|
+
marginBottom: 10
|
|
1716
|
+
},
|
|
1717
|
+
change: {
|
|
1718
|
+
action: function action() {
|
|
1719
|
+
scope.search();
|
|
1720
|
+
}
|
|
1721
|
+
},
|
|
1722
|
+
icon: /*#__PURE__*/jsx(Ionicons$1, {
|
|
1723
|
+
name: "search",
|
|
1724
|
+
size: 20,
|
|
1725
|
+
color: "#888"
|
|
1726
|
+
})
|
|
1727
|
+
}), /*#__PURE__*/jsx(LocalData, {})]
|
|
1728
|
+
});
|
|
1729
|
+
}
|
|
1730
|
+
var styles$a = /*#__PURE__*/StyleSheet.create({
|
|
1731
|
+
row: {
|
|
1732
|
+
padding: 20,
|
|
1733
|
+
borderBottomWidth: 1,
|
|
1734
|
+
borderBottomColor: '#ccc'
|
|
1735
|
+
},
|
|
1736
|
+
text: {
|
|
1737
|
+
fontSize: 18
|
|
1738
|
+
}
|
|
1739
|
+
});
|
|
1740
|
+
|
|
1593
1741
|
var CrudContext = /*#__PURE__*/createContext({});
|
|
1594
1742
|
function UIElement(props) {
|
|
1595
1743
|
var _original$list, _original$load;
|
|
@@ -1730,7 +1878,7 @@ function UIElement(props) {
|
|
|
1730
1878
|
var _elementStyle$type;
|
|
1731
1879
|
var type = Utils.nvl(original.type, 'none');
|
|
1732
1880
|
var key = Utils.nvl(part, 'root');
|
|
1733
|
-
var def = _extends({}, styles$
|
|
1881
|
+
var def = _extends({}, styles$b[key]);
|
|
1734
1882
|
var hasChild = hasChildren();
|
|
1735
1883
|
type = Utils.nvl(original.layout, type);
|
|
1736
1884
|
if (!part && !hasChild) {
|
|
@@ -1930,6 +2078,9 @@ function UIElement(props) {
|
|
|
1930
2078
|
}), scope.isType('list', 'repeat') && /*#__PURE__*/jsx(UIList, _extends({}, props, {
|
|
1931
2079
|
scope: scope,
|
|
1932
2080
|
crud: crud
|
|
2081
|
+
})), scope.isType('order') && /*#__PURE__*/jsx(UIOrder, _extends({}, props, {
|
|
2082
|
+
scope: scope,
|
|
2083
|
+
crud: crud
|
|
1933
2084
|
})), scope.isType('dialog') && /*#__PURE__*/jsx(UIModal, _extends({}, props, {
|
|
1934
2085
|
scope: scope,
|
|
1935
2086
|
crud: crud
|
|
@@ -2078,7 +2229,7 @@ elementStyle.toggle = /*#__PURE__*/StyleSheet.create({
|
|
|
2078
2229
|
flexWrap: 'nowrap'
|
|
2079
2230
|
})
|
|
2080
2231
|
});
|
|
2081
|
-
var styles$
|
|
2232
|
+
var styles$b = /*#__PURE__*/StyleSheet.create({
|
|
2082
2233
|
root: {
|
|
2083
2234
|
gap: 5,
|
|
2084
2235
|
flexDirection: 'column',
|
|
@@ -2188,6 +2339,11 @@ function SafeView(props) {
|
|
|
2188
2339
|
|
|
2189
2340
|
var _excluded = ["type"];
|
|
2190
2341
|
var UI = {
|
|
2342
|
+
Order: function Order(props) {
|
|
2343
|
+
return /*#__PURE__*/jsx(UIElement, _extends({}, props, {
|
|
2344
|
+
type: "order"
|
|
2345
|
+
}));
|
|
2346
|
+
},
|
|
2191
2347
|
List: function List(props) {
|
|
2192
2348
|
return /*#__PURE__*/jsx(UIElement, _extends({}, props, {
|
|
2193
2349
|
type: "list"
|