@onehat/ui 0.3.69 → 0.3.70
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
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef, } from 'react';
|
|
2
2
|
import {
|
|
3
|
+
Button,
|
|
3
4
|
Modal,
|
|
4
5
|
Popover,
|
|
5
6
|
Pressable,
|
|
@@ -21,6 +22,7 @@ import emptyFn from '../../../../Functions/emptyFn.js';
|
|
|
21
22
|
import { Grid, WindowedGridEditor } from '../../../Grid/Grid.js';
|
|
22
23
|
import IconButton from '../../../Buttons/IconButton.js';
|
|
23
24
|
import CaretDown from '../../../Icons/CaretDown.js';
|
|
25
|
+
import Check from '../../../Icons/Check.js';
|
|
24
26
|
import Xmark from '../../../Icons/Xmark.js';
|
|
25
27
|
import _ from 'lodash';
|
|
26
28
|
|
|
@@ -327,7 +329,7 @@ export function ComboComponent(props) {
|
|
|
327
329
|
}
|
|
328
330
|
|
|
329
331
|
} else {
|
|
330
|
-
|
|
332
|
+
Repository.clear();
|
|
331
333
|
}
|
|
332
334
|
|
|
333
335
|
} else {
|
|
@@ -427,6 +429,7 @@ export function ComboComponent(props) {
|
|
|
427
429
|
|
|
428
430
|
let xButton = null,
|
|
429
431
|
inputAndTrigger = null,
|
|
432
|
+
checkBtn = null,
|
|
430
433
|
grid = null,
|
|
431
434
|
dropdownMenu = null,
|
|
432
435
|
assembledComponents = null;
|
|
@@ -734,6 +737,27 @@ export function ComboComponent(props) {
|
|
|
734
737
|
</Popover>;
|
|
735
738
|
}
|
|
736
739
|
if (UiGlobals.mode === UI_MODE_REACT_NATIVE) {
|
|
740
|
+
if (isEditor) {
|
|
741
|
+
// in RN, an editor has no way to accept the selection of the grid, so we need to add a check button to do this
|
|
742
|
+
const isCheckBtnDisabled = _.isEmpty(value);
|
|
743
|
+
checkBtn = <IconButton
|
|
744
|
+
_icon={{
|
|
745
|
+
as: Check,
|
|
746
|
+
color: isCheckBtnDisabled ? 'disabled' : 'trueGray.600',
|
|
747
|
+
size: 'sm',
|
|
748
|
+
}}
|
|
749
|
+
isDisabled={isCheckBtnDisabled}
|
|
750
|
+
onPress={acceptSelection}
|
|
751
|
+
h="100%"
|
|
752
|
+
borderWidth={1}
|
|
753
|
+
borderColor="#bbb"
|
|
754
|
+
borderRadius="md"
|
|
755
|
+
bg={styles.FORM_COMBO_TRIGGER_BG}
|
|
756
|
+
_hover={{
|
|
757
|
+
bg: styles.FORM_COMBO_TRIGGER_HOVER_BG,
|
|
758
|
+
}}
|
|
759
|
+
/>;
|
|
760
|
+
}
|
|
737
761
|
const inputAndTriggerClone = // for RN, this is the actual input and trigger, as we need them to appear up above in the modal
|
|
738
762
|
<Row h={10}>
|
|
739
763
|
{disableDirectEntry ?
|
|
@@ -797,6 +821,7 @@ export function ComboComponent(props) {
|
|
|
797
821
|
bg: styles.FORM_COMBO_TRIGGER_HOVER_BG,
|
|
798
822
|
}}
|
|
799
823
|
/>
|
|
824
|
+
{checkBtn}
|
|
800
825
|
</Row>;
|
|
801
826
|
dropdownMenu = <Modal
|
|
802
827
|
isOpen={true}
|
|
@@ -810,6 +835,7 @@ export function ComboComponent(props) {
|
|
|
810
835
|
>
|
|
811
836
|
{inputAndTriggerClone}
|
|
812
837
|
{grid}
|
|
838
|
+
<Button mt={2} onPress={() => setIsMenuShown(false)}>Close</Button>
|
|
813
839
|
</Modal>;
|
|
814
840
|
}
|
|
815
841
|
}
|
|
@@ -290,11 +290,11 @@ export function DateElement(props) {
|
|
|
290
290
|
color: styles.FORM_DATE_ICON_COLOR,
|
|
291
291
|
size: 'sm',
|
|
292
292
|
}}
|
|
293
|
-
isDisabled={isDisabled}
|
|
294
293
|
onPress={onTriggerPress}
|
|
295
294
|
onBlur={onTriggerBlur}
|
|
296
|
-
h=
|
|
295
|
+
h={10}
|
|
297
296
|
w={10}
|
|
297
|
+
isDisabled={isDisabled}
|
|
298
298
|
borderWidth={1}
|
|
299
299
|
borderColor="#bbb"
|
|
300
300
|
borderLeftRadius="md"
|
|
@@ -334,20 +334,21 @@ export function DateElement(props) {
|
|
|
334
334
|
<Input
|
|
335
335
|
ref={inputRef}
|
|
336
336
|
value={textInputValue}
|
|
337
|
-
|
|
338
|
-
isDisabled={isDisabled}
|
|
337
|
+
// setValue={onInputSetValue}
|
|
339
338
|
onChangeValue={onInputChangeText}
|
|
340
339
|
onKeyPress={onInputKeyPress}
|
|
341
|
-
onFocus={onInputFocus}
|
|
342
340
|
onBlur={onInputBlur}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
}
|
|
341
|
+
onFocus={onInputFocus}
|
|
342
|
+
autoSubmit={true}
|
|
343
|
+
isDisabled={isDisabled}
|
|
344
|
+
// onLayout={(e) => {
|
|
345
|
+
// const {
|
|
346
|
+
// height,
|
|
347
|
+
// width,
|
|
348
|
+
// } = e.nativeEvent.layout;
|
|
349
|
+
// setWidth(Math.round(width));
|
|
350
|
+
// setTop(Math.round(height));
|
|
351
|
+
// }}
|
|
351
352
|
flex={1}
|
|
352
353
|
h="100%"
|
|
353
354
|
m={0}
|
|
@@ -455,6 +456,7 @@ export function DateElement(props) {
|
|
|
455
456
|
minWidth={menuMinWidth}
|
|
456
457
|
overflow="auto"
|
|
457
458
|
bg="#fff"
|
|
459
|
+
{...translateProps}
|
|
458
460
|
>
|
|
459
461
|
<Popover.Body
|
|
460
462
|
ref={pickerRef}
|