react-crud-mobile 1.3.46 → 1.3.48
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 +86 -39
- 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 +88 -41
- package/dist/react-crud-mobile.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/elements/core/UISelect.tsx +64 -20
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { useState,
|
|
1
|
+
import React, { useState, useRef, useEffect, useContext, useLayoutEffect, createContext } from 'react';
|
|
2
2
|
import { Utils, ScopeUtils, CrudUtils, ComponentUtils, ViewUtils, HtmlUtils, ThemeUtils, useTheme } from 'react-crud-utils';
|
|
3
|
-
import { View, StyleSheet, TouchableOpacity, Text, Linking, TouchableHighlight,
|
|
3
|
+
import { View, StyleSheet, TouchableOpacity, Text, Linking, TouchableHighlight, Modal, SafeAreaView, ScrollView, Switch, TextInput, Platform, Dimensions, Alert, Image, StatusBar, KeyboardAvoidingView, TouchableWithoutFeedback, Keyboard } 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, AntDesign, Entypo, EvilIcons, MaterialCommunityIcons } from '@expo/vector-icons';
|
|
@@ -481,8 +481,25 @@ function UIButton(props) {
|
|
|
481
481
|
});
|
|
482
482
|
}
|
|
483
483
|
|
|
484
|
+
//import { ThemeUtils, Utils } from 'react-crud-utils';
|
|
485
|
+
//import { StatusBar } from 'react-native';
|
|
486
|
+
var MobileUtils = /*#__PURE__*/function () {
|
|
487
|
+
function MobileUtils() {}
|
|
488
|
+
MobileUtils.syncTheme = function syncTheme() {
|
|
489
|
+
// let current = ThemeUtils.getCurrentTheme();
|
|
490
|
+
//let dec: any = { light: 'light-content', dark: 'dark-content' };
|
|
491
|
+
//let name = Utils.nvl(dec[current?.theme], dec.light);
|
|
492
|
+
//StatusBar.setBarStyle?.(name);
|
|
493
|
+
//StatusBar.setBackgroundColor?.(current?.colors?.theme);
|
|
494
|
+
};
|
|
495
|
+
return MobileUtils;
|
|
496
|
+
}();
|
|
497
|
+
|
|
484
498
|
function UISelect(props) {
|
|
485
499
|
var _theme$styles, _theme$colors, _scope$original, _scope$original2;
|
|
500
|
+
var _useState = useState(false),
|
|
501
|
+
modalVisible = _useState[0],
|
|
502
|
+
setModalVisible = _useState[1];
|
|
486
503
|
var scope = props.scope;
|
|
487
504
|
var element = scope.original;
|
|
488
505
|
var items = Utils.nvl(scope.getOptions(), []);
|
|
@@ -490,17 +507,15 @@ function UISelect(props) {
|
|
|
490
507
|
var value = scope.getDisplayValue();
|
|
491
508
|
var theme = scope.getTheme();
|
|
492
509
|
var headerStyle = Utils.nvl((_theme$styles = theme.styles) == null || (_theme$styles = _theme$styles.defaults) == null ? void 0 : _theme$styles.header, {});
|
|
493
|
-
var dlgName = scope.getName('dialog');
|
|
494
510
|
var handlePress = function handlePress() {
|
|
495
|
-
|
|
496
|
-
click: {
|
|
497
|
-
action: 'dialog',
|
|
498
|
-
dialog: dlgName
|
|
499
|
-
}
|
|
500
|
-
});
|
|
511
|
+
setModalVisible(!modalVisible);
|
|
501
512
|
};
|
|
513
|
+
var scrollRef = useRef(null);
|
|
502
514
|
var iconColor = Utils.nvl((_theme$colors = theme.colors) == null ? void 0 : _theme$colors.text, '#100e0e');
|
|
503
515
|
var modalColor = Utils.nvl(headerStyle.color, 'white');
|
|
516
|
+
var defaults = {
|
|
517
|
+
color: modalColor
|
|
518
|
+
};
|
|
504
519
|
var onClick = function onClick(_ref) {
|
|
505
520
|
var value = _ref.value;
|
|
506
521
|
var val = value;
|
|
@@ -511,11 +526,19 @@ function UISelect(props) {
|
|
|
511
526
|
} else {
|
|
512
527
|
scope.changeValue(value);
|
|
513
528
|
}
|
|
529
|
+
setModalVisible(false);
|
|
514
530
|
};
|
|
515
531
|
var style = function style(part, extra) {
|
|
516
532
|
var all = _extends({}, styles$3[part], extra);
|
|
517
533
|
return scope.getStyle(part, all);
|
|
518
534
|
};
|
|
535
|
+
var isModalVisible = function isModalVisible() {
|
|
536
|
+
return modalVisible;
|
|
537
|
+
};
|
|
538
|
+
//v4
|
|
539
|
+
useEffect(function () {
|
|
540
|
+
MobileUtils.syncTheme();
|
|
541
|
+
}, [modalVisible]);
|
|
519
542
|
return /*#__PURE__*/jsxs(View, {
|
|
520
543
|
style: style('selectRoot'),
|
|
521
544
|
children: [/*#__PURE__*/jsxs(TouchableOpacity, {
|
|
@@ -530,25 +553,63 @@ function UISelect(props) {
|
|
|
530
553
|
color: scope.getPart('iconColor', null, iconColor),
|
|
531
554
|
style: style('iconStyle', {})
|
|
532
555
|
})]
|
|
533
|
-
}), /*#__PURE__*/
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
556
|
+
}), /*#__PURE__*/jsxs(Modal, {
|
|
557
|
+
animationType: "slide",
|
|
558
|
+
transparent: true,
|
|
559
|
+
visible: isModalVisible(),
|
|
560
|
+
onRequestClose: function onRequestClose() {
|
|
561
|
+
return setModalVisible(false);
|
|
562
|
+
},
|
|
563
|
+
children: [/*#__PURE__*/jsx(SafeAreaView, {
|
|
564
|
+
style: style('modalTop')
|
|
565
|
+
}), /*#__PURE__*/jsxs(SafeAreaView, {
|
|
566
|
+
style: style('modalSafe'),
|
|
567
|
+
children: [/*#__PURE__*/jsxs(View, {
|
|
568
|
+
style: scope.getStyle('header', headerStyle),
|
|
569
|
+
children: [/*#__PURE__*/jsx(TouchableOpacity, {
|
|
570
|
+
onPress: handlePress,
|
|
571
|
+
style: style('modalCloseButton'),
|
|
572
|
+
children: /*#__PURE__*/jsx(Ionicons$1, {
|
|
573
|
+
name: "close",
|
|
574
|
+
size: 24,
|
|
575
|
+
color: modalColor,
|
|
576
|
+
style: style('modalCloseText', defaults)
|
|
577
|
+
})
|
|
578
|
+
}), /*#__PURE__*/jsx(Text, {
|
|
579
|
+
style: style('modalTitle', defaults),
|
|
580
|
+
children: placeholder
|
|
581
|
+
})]
|
|
582
|
+
}), /*#__PURE__*/jsx(ScrollView, {
|
|
583
|
+
contentContainerStyle: {
|
|
584
|
+
flexGrow: 1,
|
|
585
|
+
paddingBottom: 50
|
|
586
|
+
},
|
|
587
|
+
style: style('modalContent'),
|
|
588
|
+
nestedScrollEnabled: true,
|
|
589
|
+
ref: scrollRef,
|
|
590
|
+
children: /*#__PURE__*/jsx(View, {
|
|
591
|
+
style: {
|
|
592
|
+
flex: 1
|
|
593
|
+
},
|
|
594
|
+
children: /*#__PURE__*/jsx(UI.List, _extends({
|
|
595
|
+
data: items,
|
|
596
|
+
name: scope.getName('list'),
|
|
597
|
+
layout: "card",
|
|
598
|
+
click: onClick,
|
|
599
|
+
rowStyle: _extends({
|
|
600
|
+
paddingLeft: 15,
|
|
601
|
+
paddinRight: 15
|
|
602
|
+
}, (_scope$original = scope.original) == null ? void 0 : _scope$original.rowStyle)
|
|
603
|
+
}, (_scope$original2 = scope.original) == null ? void 0 : _scope$original2.listProps, {
|
|
604
|
+
children: /*#__PURE__*/jsx(UI.Value, {
|
|
605
|
+
value: "#{@this.label}"
|
|
606
|
+
})
|
|
607
|
+
}))
|
|
608
|
+
})
|
|
609
|
+
})]
|
|
610
|
+
})]
|
|
550
611
|
})]
|
|
551
|
-
}, scope.getName(
|
|
612
|
+
}, scope.getName(scope.getPart('modal') + "_" + modalVisible));
|
|
552
613
|
}
|
|
553
614
|
var styles$3 = /*#__PURE__*/StyleSheet.create({
|
|
554
615
|
selectRoot: {
|
|
@@ -1450,20 +1511,6 @@ var styles$8 = /*#__PURE__*/StyleSheet.create({
|
|
|
1450
1511
|
}
|
|
1451
1512
|
});
|
|
1452
1513
|
|
|
1453
|
-
//import { ThemeUtils, Utils } from 'react-crud-utils';
|
|
1454
|
-
//import { StatusBar } from 'react-native';
|
|
1455
|
-
var MobileUtils = /*#__PURE__*/function () {
|
|
1456
|
-
function MobileUtils() {}
|
|
1457
|
-
MobileUtils.syncTheme = function syncTheme() {
|
|
1458
|
-
// let current = ThemeUtils.getCurrentTheme();
|
|
1459
|
-
//let dec: any = { light: 'light-content', dark: 'dark-content' };
|
|
1460
|
-
//let name = Utils.nvl(dec[current?.theme], dec.light);
|
|
1461
|
-
//StatusBar.setBarStyle?.(name);
|
|
1462
|
-
//StatusBar.setBackgroundColor?.(current?.colors?.theme);
|
|
1463
|
-
};
|
|
1464
|
-
return MobileUtils;
|
|
1465
|
-
}();
|
|
1466
|
-
|
|
1467
1514
|
function UIView(_ref) {
|
|
1468
1515
|
var _theme$styles, _theme$styles2;
|
|
1469
1516
|
var scope = _ref.scope,
|