@onehat/ui 0.3.61 → 0.3.66
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/package.json +1 -1
- package/src/Components/Form/Field/Combo/Combo.js +11 -4
- package/src/Components/Form/Field/Input.js +6 -1
- package/src/Components/Form/Field/TextArea.js +3 -0
- package/src/Components/Form/Form.js +7 -3
- package/src/Components/Hoc/withAlert.js +1 -1
- package/src/Components/index.js +2 -0
- package/src/PlatformImports/Web/Attachments.js +1 -0
package/package.json
CHANGED
|
@@ -38,6 +38,7 @@ export function ComboComponent(props) {
|
|
|
38
38
|
isEditor = false,
|
|
39
39
|
isDisabled = false,
|
|
40
40
|
tooltipPlacement = 'bottom',
|
|
41
|
+
placeholder,
|
|
41
42
|
onRowPress,
|
|
42
43
|
|
|
43
44
|
// withComponent
|
|
@@ -470,11 +471,12 @@ export function ComboComponent(props) {
|
|
|
470
471
|
borderTopRightRadius={0}
|
|
471
472
|
borderBottomRightRadius={0}
|
|
472
473
|
fontSize={styles.FORM_COMBO_INPUT_FONTSIZE}
|
|
474
|
+
color={_.isEmpty(textInputValue) ? 'trueGray.400' : '#000'}
|
|
473
475
|
bg={styles.FORM_COMBO_INPUT_BG}
|
|
474
476
|
_focus={{
|
|
475
477
|
bg: styles.FORM_COMBO_INPUT_FOCUS_BG,
|
|
476
478
|
}}
|
|
477
|
-
>{textInputValue}</Text>
|
|
479
|
+
>{_.isEmpty(textInputValue) ? placeholder : textInputValue}</Text>
|
|
478
480
|
</Pressable> :
|
|
479
481
|
<Input
|
|
480
482
|
ref={inputRef}
|
|
@@ -504,6 +506,7 @@ export function ComboComponent(props) {
|
|
|
504
506
|
_focus={{
|
|
505
507
|
bg: styles.FORM_COMBO_INPUT_FOCUS_BG,
|
|
506
508
|
}}
|
|
509
|
+
placeholder={placeholder}
|
|
507
510
|
{..._input}
|
|
508
511
|
/>}
|
|
509
512
|
<IconButton
|
|
@@ -549,12 +552,13 @@ export function ComboComponent(props) {
|
|
|
549
552
|
borderColor="trueGray.400"
|
|
550
553
|
borderTopRightRadius={0}
|
|
551
554
|
borderBottomRightRadius={0}
|
|
555
|
+
color={_.isEmpty(textInputValue) ? 'trueGray.400' : '#000'}
|
|
552
556
|
fontSize={styles.FORM_COMBO_INPUT_FONTSIZE}
|
|
553
557
|
bg={styles.FORM_COMBO_INPUT_BG}
|
|
554
558
|
_focus={{
|
|
555
559
|
bg: styles.FORM_COMBO_INPUT_FOCUS_BG,
|
|
556
560
|
}}
|
|
557
|
-
>{textInputValue}</Text>
|
|
561
|
+
>{_.isEmpty(textInputValue) ? placeholder : textInputValue}</Text>
|
|
558
562
|
</Pressable>
|
|
559
563
|
<IconButton
|
|
560
564
|
ref={triggerRef}
|
|
@@ -772,6 +776,7 @@ export function ComboComponent(props) {
|
|
|
772
776
|
_focus={{
|
|
773
777
|
bg: styles.FORM_COMBO_INPUT_FOCUS_BG,
|
|
774
778
|
}}
|
|
779
|
+
placeholder={placeholder}
|
|
775
780
|
{..._input}
|
|
776
781
|
/>}
|
|
777
782
|
<IconButton
|
|
@@ -796,11 +801,13 @@ export function ComboComponent(props) {
|
|
|
796
801
|
</Row>;
|
|
797
802
|
dropdownMenu = <Modal
|
|
798
803
|
isOpen={true}
|
|
804
|
+
safeAreaTop={true}
|
|
799
805
|
onClose={() => setIsMenuShown(false)}
|
|
800
|
-
|
|
806
|
+
mt="auto"
|
|
807
|
+
mb="auto"
|
|
801
808
|
w="100%"
|
|
802
809
|
h={400}
|
|
803
|
-
|
|
810
|
+
p={5}
|
|
804
811
|
>
|
|
805
812
|
{inputAndTriggerClone}
|
|
806
813
|
{grid}
|
|
@@ -65,6 +65,11 @@ function InputElement(props) {
|
|
|
65
65
|
if (localValue === null || typeof localValue === 'undefined') {
|
|
66
66
|
localValue = ''; // If the value is null or undefined, don't let this be an uncontrolled input
|
|
67
67
|
}
|
|
68
|
+
|
|
69
|
+
const sizeProps = {};
|
|
70
|
+
if (!props.flex && !props.w) {
|
|
71
|
+
sizeProps.flex = 1;
|
|
72
|
+
}
|
|
68
73
|
|
|
69
74
|
let component = <Input
|
|
70
75
|
ref={props.outerRef}
|
|
@@ -72,12 +77,12 @@ function InputElement(props) {
|
|
|
72
77
|
_input={{
|
|
73
78
|
onKeyPress: onKeyPressLocal,
|
|
74
79
|
}}
|
|
75
|
-
flex={1}
|
|
76
80
|
fontSize={styles.FORM_INPUT_FONTSIZE}
|
|
77
81
|
bg={styles.FORM_INPUT_BG}
|
|
78
82
|
_focus={{
|
|
79
83
|
bg: styles.FORM_INPUT_FOCUS_BG,
|
|
80
84
|
}}
|
|
85
|
+
{...sizeProps}
|
|
81
86
|
{...props}
|
|
82
87
|
value={localValue}
|
|
83
88
|
/>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useState, useRef, isValidElement, } from 'react';
|
|
1
|
+
import React, { useEffect, useState, useRef, isValidElement, } from 'react';
|
|
2
2
|
import { View, } from 'react-native';
|
|
3
3
|
import {
|
|
4
4
|
Box,
|
|
@@ -72,6 +72,7 @@ function Form(props) {
|
|
|
72
72
|
buttonGroupProps = {}, // buttons in footer
|
|
73
73
|
checkIsEditingDisabled = true,
|
|
74
74
|
disableLabels = false,
|
|
75
|
+
disableDirtyIcon = false,
|
|
75
76
|
onBack,
|
|
76
77
|
onReset,
|
|
77
78
|
onViewMode,
|
|
@@ -267,7 +268,7 @@ function Form(props) {
|
|
|
267
268
|
// </Column>;
|
|
268
269
|
// }
|
|
269
270
|
|
|
270
|
-
const dirtyIcon = isDirty ? <Icon as={Pencil} size="2xs" color="trueGray.300" position="absolute" top="2px" left="2px" /> : null;
|
|
271
|
+
const dirtyIcon = isDirty && !disableDirtyIcon ? <Icon as={Pencil} size="2xs" color="trueGray.300" position="absolute" top="2px" left="2px" /> : null;
|
|
271
272
|
return <Row key={ix} bg={error ? '#fdd' : '#fff'} w={w} flex={flex} {...columnProps}>{dirtyIcon}{element}</Row>;
|
|
272
273
|
}}
|
|
273
274
|
/>);
|
|
@@ -279,6 +280,9 @@ function Form(props) {
|
|
|
279
280
|
return _.map(items, (item, ix) => buildFromItem(item, ix, columnDefaults));
|
|
280
281
|
},
|
|
281
282
|
buildFromItem = (item, ix, defaults) => {
|
|
283
|
+
if (React.isValidElement(item)) {
|
|
284
|
+
return item;
|
|
285
|
+
}
|
|
282
286
|
let {
|
|
283
287
|
type,
|
|
284
288
|
title,
|
|
@@ -510,7 +514,7 @@ function Form(props) {
|
|
|
510
514
|
</Row>;
|
|
511
515
|
}
|
|
512
516
|
|
|
513
|
-
const dirtyIcon = isDirty ? <Icon as={Pencil} size="2xs" color="trueGray.300" position="absolute" top="2px" left="2px" /> : null;
|
|
517
|
+
const dirtyIcon = isDirty && !disableDirtyIcon ? <Icon as={Pencil} size="2xs" color="trueGray.300" position="absolute" top="2px" left="2px" /> : null;
|
|
514
518
|
return <Row key={ix} px={2} pb={1} bg={error ? '#fdd' : null}>{dirtyIcon}{element}</Row>;
|
|
515
519
|
}}
|
|
516
520
|
/>;
|
|
@@ -66,7 +66,7 @@ export default function withAlert(WrappedComponent) {
|
|
|
66
66
|
},
|
|
67
67
|
onConfirm = (message, callback, includeCancel = false) => {
|
|
68
68
|
clearAll();
|
|
69
|
-
setMode(ALERT_MODE_YES_NO);
|
|
69
|
+
setMode(includeCancel ? ALERT_MODE_YES : ALERT_MODE_YES_NO);
|
|
70
70
|
setTitle('Confirm');
|
|
71
71
|
setMessage(message);
|
|
72
72
|
setIncludeCancel(includeCancel);
|
package/src/Components/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Column,
|
|
3
|
+
Row,
|
|
3
4
|
} from 'native-base';
|
|
4
5
|
// import AccordionGridPanel from '../Components/Panel/AccordionGridPanel.js';
|
|
5
6
|
import ArrayCheckboxGroup from './Form/Field/Checkbox/ArrayCheckboxGroup.js';
|
|
@@ -90,6 +91,7 @@ const components = {
|
|
|
90
91
|
// Picker,
|
|
91
92
|
PlusMinusButton,
|
|
92
93
|
RadioGroup,
|
|
94
|
+
Row,
|
|
93
95
|
SquareButton,
|
|
94
96
|
TabPanel,
|
|
95
97
|
Tag,
|