react-crud-mobile 1.3.50 → 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 +159 -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 +159 -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 -205
- 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
package/dist/elements/UI.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { ListType, UserType, InputType, ChartType, ContainerType, ListInputType, TabsType, DefineType, ButtonType, IconType, LinkType, SliderType } from 'react-crud-utils';
|
|
3
3
|
import SafeView from './core/SafeView';
|
|
4
4
|
declare const UI: {
|
|
5
|
+
Order: (props: ListType) => import("react").JSX.Element;
|
|
5
6
|
List: (props: ListType) => import("react").JSX.Element;
|
|
6
7
|
Row: (props: UserType) => import("react").JSX.Element;
|
|
7
8
|
Value: (props: UserType) => import("react").JSX.Element;
|
|
@@ -14,6 +14,7 @@ var vectorIcons = require('@expo/vector-icons');
|
|
|
14
14
|
var Slider = _interopDefault(require('@react-native-community/slider'));
|
|
15
15
|
var Toast = require('react-native-toast-message');
|
|
16
16
|
var Toast__default = _interopDefault(Toast);
|
|
17
|
+
var DraggableFlatList = _interopDefault(require('react-native-draggable-flatlist'));
|
|
17
18
|
var reactNativeSafeAreaContext = require('react-native-safe-area-context');
|
|
18
19
|
|
|
19
20
|
function _extends() {
|
|
@@ -1358,6 +1359,7 @@ function UIModal(props) {
|
|
|
1358
1359
|
index = _useState2[0],
|
|
1359
1360
|
setIndex = _useState2[1];
|
|
1360
1361
|
var main = reactCrudUtils.ViewUtils.getCrud('view');
|
|
1362
|
+
//v3
|
|
1361
1363
|
var scope = props.scope;
|
|
1362
1364
|
var label = scope.getLabel();
|
|
1363
1365
|
var theme = scope.getTheme();
|
|
@@ -1597,6 +1599,153 @@ var styles$9 = /*#__PURE__*/reactNative.StyleSheet.create({
|
|
|
1597
1599
|
view: {}
|
|
1598
1600
|
});
|
|
1599
1601
|
|
|
1602
|
+
function UIOrder(props) {
|
|
1603
|
+
var scope = props.scope;
|
|
1604
|
+
var crud = scope.crud;
|
|
1605
|
+
var original = scope.original;
|
|
1606
|
+
var cols = reactCrudUtils.Utils.nvl(scope.getPart('cols', undefined, 1));
|
|
1607
|
+
var add = reactCrudUtils.ComponentUtils.getDefine(props, 'add');
|
|
1608
|
+
var hideAddWhenEmpty = original.hideAddWhenEmpty;
|
|
1609
|
+
var getStyle = function getStyle(key, extra) {
|
|
1610
|
+
return scope.getStyle(key, _extends({}, extra, styles$a[key]));
|
|
1611
|
+
};
|
|
1612
|
+
var getContainerStyle = function getContainerStyle(extra) {
|
|
1613
|
+
var row = getStyle('container', {});
|
|
1614
|
+
if (cols > 1) {
|
|
1615
|
+
row = _extends({}, row, {
|
|
1616
|
+
flexDirection: 'row',
|
|
1617
|
+
flexWrap: 'wrap'
|
|
1618
|
+
});
|
|
1619
|
+
}
|
|
1620
|
+
return row;
|
|
1621
|
+
};
|
|
1622
|
+
var LocalData = function LocalData() {
|
|
1623
|
+
var _useState = React.useState(scope.updateIndex),
|
|
1624
|
+
index = _useState[0],
|
|
1625
|
+
setIndex = _useState[1];
|
|
1626
|
+
scope.update = function () {
|
|
1627
|
+
scope.updateIndex = ++index;
|
|
1628
|
+
setIndex(index);
|
|
1629
|
+
};
|
|
1630
|
+
var keyData = scope.key('data');
|
|
1631
|
+
var items = reactCrudUtils.Utils.call(function () {
|
|
1632
|
+
var _original$list;
|
|
1633
|
+
var list = reactCrudUtils.Utils.nvl(scope.getItems(), []);
|
|
1634
|
+
if (original.search && !((_original$list = original.list) != null && _original$list.url)) {
|
|
1635
|
+
var query = crud.get('query', '').toLowerCase().trim();
|
|
1636
|
+
if (query.length > 1) {
|
|
1637
|
+
var filters = [];
|
|
1638
|
+
var filterBy = reactCrudUtils.Utils.nvl(original.filterBy, 'label');
|
|
1639
|
+
reactCrudUtils.Utils.each(list, function (o) {
|
|
1640
|
+
var label = o[filterBy];
|
|
1641
|
+
if (label) {
|
|
1642
|
+
if (label.includes(query)) {
|
|
1643
|
+
filters.push(o);
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
});
|
|
1647
|
+
return filters;
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
return list;
|
|
1651
|
+
});
|
|
1652
|
+
var isShowAdd = function isShowAdd() {
|
|
1653
|
+
if (!reactCrudUtils.Utils.isEmpty(items)) {
|
|
1654
|
+
return true;
|
|
1655
|
+
}
|
|
1656
|
+
return hideAddWhenEmpty !== true;
|
|
1657
|
+
};
|
|
1658
|
+
var Empty = function Empty() {
|
|
1659
|
+
if (!reactCrudUtils.Utils.isEmpty(items)) {
|
|
1660
|
+
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
1661
|
+
}
|
|
1662
|
+
var empty = scope.attr('empty', 'Sem registro');
|
|
1663
|
+
if (!empty) {
|
|
1664
|
+
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
1665
|
+
}
|
|
1666
|
+
if (typeof empty === 'string') {
|
|
1667
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactNative.Text, {
|
|
1668
|
+
style: scope.getStyle('empty', {
|
|
1669
|
+
flex: 1,
|
|
1670
|
+
fontWeight: 500,
|
|
1671
|
+
fontSize: 20,
|
|
1672
|
+
padding: 10,
|
|
1673
|
+
textAlign: 'center',
|
|
1674
|
+
justifyContent: 'center',
|
|
1675
|
+
alignItems: 'center'
|
|
1676
|
+
}),
|
|
1677
|
+
children: empty
|
|
1678
|
+
});
|
|
1679
|
+
}
|
|
1680
|
+
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1681
|
+
children: empty
|
|
1682
|
+
});
|
|
1683
|
+
};
|
|
1684
|
+
var renderItem = function renderItem(_ref) {
|
|
1685
|
+
var item = _ref.item,
|
|
1686
|
+
drag = _ref.drag,
|
|
1687
|
+
isActive = _ref.isActive;
|
|
1688
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactNative.TouchableOpacity, {
|
|
1689
|
+
style: [styles$a.row, {
|
|
1690
|
+
backgroundColor: isActive ? 'lightblue' : 'white'
|
|
1691
|
+
}],
|
|
1692
|
+
onLongPress: drag // Initiate drag on long press
|
|
1693
|
+
,
|
|
1694
|
+
children: /*#__PURE__*/jsxRuntime.jsx(reactNative.Text, {
|
|
1695
|
+
style: styles$a.text,
|
|
1696
|
+
children: scope.getItemLabel(item)
|
|
1697
|
+
})
|
|
1698
|
+
});
|
|
1699
|
+
};
|
|
1700
|
+
return /*#__PURE__*/jsxRuntime.jsxs(reactNative.View, {
|
|
1701
|
+
style: getContainerStyle(),
|
|
1702
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Empty, {}), /*#__PURE__*/jsxRuntime.jsx(DraggableFlatList, {
|
|
1703
|
+
data: items,
|
|
1704
|
+
renderItem: renderItem,
|
|
1705
|
+
keyExtractor: function keyExtractor(item) {
|
|
1706
|
+
return scope.getItemValue(item);
|
|
1707
|
+
},
|
|
1708
|
+
onDragEnd: function onDragEnd(_ref2) {
|
|
1709
|
+
var data = _ref2.data;
|
|
1710
|
+
scope.changeValue(data);
|
|
1711
|
+
}
|
|
1712
|
+
}), isShowAdd() && /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1713
|
+
children: add
|
|
1714
|
+
})]
|
|
1715
|
+
}, keyData);
|
|
1716
|
+
};
|
|
1717
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1718
|
+
children: [original.search !== false && /*#__PURE__*/jsxRuntime.jsx(UI.Text, {
|
|
1719
|
+
placeholder: "Pesquisar...",
|
|
1720
|
+
field: "query",
|
|
1721
|
+
crud: crud,
|
|
1722
|
+
style: {
|
|
1723
|
+
marginBottom: 10
|
|
1724
|
+
},
|
|
1725
|
+
change: {
|
|
1726
|
+
action: function action() {
|
|
1727
|
+
scope.search();
|
|
1728
|
+
}
|
|
1729
|
+
},
|
|
1730
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(vectorIcons.Ionicons, {
|
|
1731
|
+
name: "search",
|
|
1732
|
+
size: 20,
|
|
1733
|
+
color: "#888"
|
|
1734
|
+
})
|
|
1735
|
+
}), /*#__PURE__*/jsxRuntime.jsx(LocalData, {})]
|
|
1736
|
+
});
|
|
1737
|
+
}
|
|
1738
|
+
var styles$a = /*#__PURE__*/reactNative.StyleSheet.create({
|
|
1739
|
+
row: {
|
|
1740
|
+
padding: 20,
|
|
1741
|
+
borderBottomWidth: 1,
|
|
1742
|
+
borderBottomColor: '#ccc'
|
|
1743
|
+
},
|
|
1744
|
+
text: {
|
|
1745
|
+
fontSize: 18
|
|
1746
|
+
}
|
|
1747
|
+
});
|
|
1748
|
+
|
|
1600
1749
|
var CrudContext = /*#__PURE__*/React.createContext({});
|
|
1601
1750
|
function UIElement(props) {
|
|
1602
1751
|
var _original$list, _original$load;
|
|
@@ -1737,7 +1886,7 @@ function UIElement(props) {
|
|
|
1737
1886
|
var _elementStyle$type;
|
|
1738
1887
|
var type = reactCrudUtils.Utils.nvl(original.type, 'none');
|
|
1739
1888
|
var key = reactCrudUtils.Utils.nvl(part, 'root');
|
|
1740
|
-
var def = _extends({}, styles$
|
|
1889
|
+
var def = _extends({}, styles$b[key]);
|
|
1741
1890
|
var hasChild = hasChildren();
|
|
1742
1891
|
type = reactCrudUtils.Utils.nvl(original.layout, type);
|
|
1743
1892
|
if (!part && !hasChild) {
|
|
@@ -1937,6 +2086,9 @@ function UIElement(props) {
|
|
|
1937
2086
|
}), scope.isType('list', 'repeat') && /*#__PURE__*/jsxRuntime.jsx(UIList, _extends({}, props, {
|
|
1938
2087
|
scope: scope,
|
|
1939
2088
|
crud: crud
|
|
2089
|
+
})), scope.isType('order') && /*#__PURE__*/jsxRuntime.jsx(UIOrder, _extends({}, props, {
|
|
2090
|
+
scope: scope,
|
|
2091
|
+
crud: crud
|
|
1940
2092
|
})), scope.isType('dialog') && /*#__PURE__*/jsxRuntime.jsx(UIModal, _extends({}, props, {
|
|
1941
2093
|
scope: scope,
|
|
1942
2094
|
crud: crud
|
|
@@ -2085,7 +2237,7 @@ elementStyle.toggle = /*#__PURE__*/reactNative.StyleSheet.create({
|
|
|
2085
2237
|
flexWrap: 'nowrap'
|
|
2086
2238
|
})
|
|
2087
2239
|
});
|
|
2088
|
-
var styles$
|
|
2240
|
+
var styles$b = /*#__PURE__*/reactNative.StyleSheet.create({
|
|
2089
2241
|
root: {
|
|
2090
2242
|
gap: 5,
|
|
2091
2243
|
flexDirection: 'column',
|
|
@@ -2195,6 +2347,11 @@ function SafeView(props) {
|
|
|
2195
2347
|
|
|
2196
2348
|
var _excluded = ["type"];
|
|
2197
2349
|
var UI = {
|
|
2350
|
+
Order: function Order(props) {
|
|
2351
|
+
return /*#__PURE__*/jsxRuntime.jsx(UIElement, _extends({}, props, {
|
|
2352
|
+
type: "order"
|
|
2353
|
+
}));
|
|
2354
|
+
},
|
|
2198
2355
|
List: function List(props) {
|
|
2199
2356
|
return /*#__PURE__*/jsxRuntime.jsx(UIElement, _extends({}, props, {
|
|
2200
2357
|
type: "list"
|