react-crud-mobile 1.3.558 → 1.3.561

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/index.js CHANGED
@@ -502,7 +502,8 @@ function UIButton(props) {
502
502
  if (!label) {
503
503
  def = { ...def, borderRadius: 20 };
504
504
  }
505
- let css = style("button", def);
505
+ let pure = style("button", {});
506
+ let css = { ...style("button", def), ...pure };
506
507
  if (!css.width) {
507
508
  let h = css.height;
508
509
  if (typeof h === "number") css.minWidth = h;
@@ -1685,9 +1686,7 @@ function UIOrder(props) {
1685
1686
  const [items, setItems] = (0, import_react17.useState)(initial);
1686
1687
  const [draggingId, setDraggingId] = (0, import_react17.useState)(null);
1687
1688
  const positions = (0, import_react17.useRef)(
1688
- Object.fromEntries(
1689
- initial.map((it, i) => [it.value, new import_react_native20.Animated.Value(i * ITEM_HEIGHT)])
1690
- )
1689
+ Object.fromEntries(initial.map((it, i) => [it.value, new import_react_native20.Animated.Value(i * ITEM_HEIGHT)]))
1691
1690
  ).current;
1692
1691
  const panRespondersRef = (0, import_react17.useRef)({});
1693
1692
  const activeItem = (0, import_react17.useRef)(null);
@@ -1699,8 +1698,7 @@ function UIOrder(props) {
1699
1698
  }, [items]);
1700
1699
  (0, import_react17.useEffect)(() => {
1701
1700
  items.forEach((it, idx) => {
1702
- if (!positions[it.value])
1703
- positions[it.value] = new import_react_native20.Animated.Value(idx * ITEM_HEIGHT);
1701
+ if (!positions[it.value]) positions[it.value] = new import_react_native20.Animated.Value(idx * ITEM_HEIGHT);
1704
1702
  import_react_native20.Animated.spring(positions[it.value], {
1705
1703
  toValue: idx * ITEM_HEIGHT,
1706
1704
  useNativeDriver: false
@@ -1722,35 +1720,26 @@ function UIOrder(props) {
1722
1720
  onStartShouldSetPanResponder: () => true,
1723
1721
  onPanResponderGrant: () => {
1724
1722
  const currentItems = itemsRef.current;
1725
- if (!positions[item.value] || !currentItems.find((it) => it.value === item.value))
1726
- return;
1723
+ if (!positions[item.value] || !currentItems.find((it) => it.value === item.value)) return;
1727
1724
  activeItem.current = item;
1728
- activeIndex.current = currentItems.findIndex(
1729
- (it) => it.value === item.value
1730
- );
1725
+ activeIndex.current = currentItems.findIndex((it) => it.value === item.value);
1731
1726
  offsetY.current = positions[item.value]._value;
1732
1727
  setDraggingId(item.value);
1733
1728
  },
1734
1729
  onPanResponderMove: (_, gesture) => {
1735
1730
  const currentItems = itemsRef.current;
1736
- if (!positions[item.value] || !currentItems.find((it) => it.value === item.value))
1737
- return;
1731
+ if (!positions[item.value] || !currentItems.find((it) => it.value === item.value)) return;
1738
1732
  const y = offsetY.current + gesture.dy;
1739
1733
  positions[item.value].setValue(y);
1740
1734
  const targetIndex = Math.max(
1741
1735
  0,
1742
- Math.min(
1743
- currentItems.length - 1,
1744
- Math.floor((y + ITEM_HEIGHT / 2) / ITEM_HEIGHT)
1745
- )
1736
+ Math.min(currentItems.length - 1, Math.floor((y + ITEM_HEIGHT / 2) / ITEM_HEIGHT))
1746
1737
  );
1747
1738
  currentItems.forEach((other, idx) => {
1748
1739
  if (other.value === item.value || !positions[other.value]) return;
1749
1740
  let targetY = idx * ITEM_HEIGHT;
1750
- if (idx > activeIndex.current && idx <= targetIndex)
1751
- targetY = (idx - 1) * ITEM_HEIGHT;
1752
- else if (idx < activeIndex.current && idx >= targetIndex)
1753
- targetY = (idx + 1) * ITEM_HEIGHT;
1741
+ if (idx > activeIndex.current && idx <= targetIndex) targetY = (idx - 1) * ITEM_HEIGHT;
1742
+ else if (idx < activeIndex.current && idx >= targetIndex) targetY = (idx + 1) * ITEM_HEIGHT;
1754
1743
  import_react_native20.Animated.timing(positions[other.value], {
1755
1744
  toValue: targetY,
1756
1745
  duration: 120,
@@ -1761,15 +1750,11 @@ function UIOrder(props) {
1761
1750
  onPanResponderRelease: () => {
1762
1751
  const moved = activeItem.current;
1763
1752
  const currentItems = itemsRef.current;
1764
- if (!moved || !positions[moved.value] || !currentItems.find((it) => it.value === moved.value))
1765
- return;
1753
+ if (!moved || !positions[moved.value] || !currentItems.find((it) => it.value === moved.value)) return;
1766
1754
  const finalY = positions[moved.value]._value;
1767
1755
  const newIndex = Math.max(
1768
1756
  0,
1769
- Math.min(
1770
- currentItems.length - 1,
1771
- Math.floor((finalY + ITEM_HEIGHT / 2) / ITEM_HEIGHT)
1772
- )
1757
+ Math.min(currentItems.length - 1, Math.floor((finalY + ITEM_HEIGHT / 2) / ITEM_HEIGHT))
1773
1758
  );
1774
1759
  const oldIndex = activeIndex.current;
1775
1760
  const updated = [...currentItems];
@@ -1821,7 +1806,7 @@ function UIOrder(props) {
1821
1806
  };
1822
1807
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react_native20.View, { style: styles11.container, children: [
1823
1808
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Empty, {}),
1824
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native20.View, { style: { height: items.length * ITEM_HEIGHT, width: "100%" }, children: items.map((item) => {
1809
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native20.View, { style: { height: items.length * ITEM_HEIGHT, width: "100%", ...scope.getStyle("container") }, children: items.map((item) => {
1825
1810
  const y = positions[item.value];
1826
1811
  if (!y) return null;
1827
1812
  const isDragging = draggingId === item.value;
@@ -1845,14 +1830,7 @@ function UIOrder(props) {
1845
1830
  children: [
1846
1831
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native20.View, { style: styles11.handle, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native20.Text, { style: styles11.handleText, children: "\u2261" }) }),
1847
1832
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native20.Text, { style: styles11.itemText, children: item.label }),
1848
- element.remove && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1849
- import_react_native20.TouchableOpacity,
1850
- {
1851
- onPress: () => removeItem(item.value),
1852
- style: styles11.del,
1853
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native20.Text, { style: { color: "#fff" }, children: "X" })
1854
- }
1855
- )
1833
+ element.remove && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native20.TouchableOpacity, { onPress: () => removeItem(item.value), style: styles11.del, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native20.Text, { style: { color: "#fff" }, children: "X" }) })
1856
1834
  ]
1857
1835
  },
1858
1836
  item.value