@onehat/ui 0.4.31 → 0.4.33
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 +7 -0
- package/src/Components/Form/Field/Tag/Tag.js +16 -27
- package/src/Components/Form/FieldSet.js +2 -0
- package/src/Components/Form/Form.js +2 -3
- package/src/Components/Hoc/withValue.js +1 -2
- package/src/Constants/Dates.js +1 -0
- package/src/Functions/Cypress/form_functions.js +3 -1
- package/src/Functions/buildAdditionalButtons.js +11 -18
package/package.json
CHANGED
|
@@ -65,6 +65,7 @@ export function ComboComponent(props) {
|
|
|
65
65
|
onGridAdd, // to hook into when menu adds (ComboEditor only)
|
|
66
66
|
onGridSave, // to hook into when menu saves (ComboEditor only)
|
|
67
67
|
onGridDelete, // to hook into when menu deletes (ComboEditor only)
|
|
68
|
+
onSubmit, // when Combo is used in a Tag, call this when the user submits the Combo value (i.e. presses Enter or clicks a row)
|
|
68
69
|
newEntityDisplayProperty,
|
|
69
70
|
testID,
|
|
70
71
|
|
|
@@ -252,6 +253,9 @@ export function ComboComponent(props) {
|
|
|
252
253
|
if (id !== value) {
|
|
253
254
|
setValue(id);
|
|
254
255
|
}
|
|
256
|
+
if (onSubmit) {
|
|
257
|
+
onSubmit(id);
|
|
258
|
+
}
|
|
255
259
|
hideMenu();
|
|
256
260
|
break;
|
|
257
261
|
case 'ArrowDown':
|
|
@@ -815,6 +819,9 @@ export function ComboComponent(props) {
|
|
|
815
819
|
hideMenu();
|
|
816
820
|
onInputFocus();
|
|
817
821
|
}
|
|
822
|
+
if (onSubmit) {
|
|
823
|
+
onSubmit(id);
|
|
824
|
+
}
|
|
818
825
|
}}
|
|
819
826
|
reference="grid"
|
|
820
827
|
parent={self}
|
|
@@ -50,13 +50,6 @@ function TagComponent(props) {
|
|
|
50
50
|
} = props,
|
|
51
51
|
styles = UiGlobals.styles,
|
|
52
52
|
valueRef = useRef(value),
|
|
53
|
-
ignoreNextComboValueChangeRef = useRef(false),
|
|
54
|
-
getIgnoreNextComboValueChange = () => {
|
|
55
|
-
return ignoreNextComboValueChangeRef.current;
|
|
56
|
-
},
|
|
57
|
-
setIgnoreNextComboValueChange = (bool) => {
|
|
58
|
-
ignoreNextComboValueChangeRef.current = bool;
|
|
59
|
-
},
|
|
60
53
|
onView = async (item, e) => {
|
|
61
54
|
const
|
|
62
55
|
id = item.id,
|
|
@@ -91,14 +84,9 @@ function TagComponent(props) {
|
|
|
91
84
|
});
|
|
92
85
|
},
|
|
93
86
|
clearComboValue = () => {
|
|
94
|
-
setIgnoreNextComboValueChange(true); // we're clearing out the value of the underlying Combo, so ignore it when this combo submits the new value change
|
|
95
87
|
self.children.combo.setValue(null);
|
|
96
88
|
},
|
|
97
89
|
onChangeComboValue = (comboValue) => {
|
|
98
|
-
if (getIgnoreNextComboValueChange()) {
|
|
99
|
-
setIgnoreNextComboValueChange(false);
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
90
|
|
|
103
91
|
if (_.isNil(comboValue)) {
|
|
104
92
|
// NOTE: We *shouldn't* get here, but for some unknown reason, we *were* getting here on rare occasions.
|
|
@@ -309,21 +297,22 @@ function TagComponent(props) {
|
|
|
309
297
|
>
|
|
310
298
|
<HStack className={valueBoxesClassName}>{valueBoxes}</HStack>
|
|
311
299
|
|
|
312
|
-
{!isViewOnly &&
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
300
|
+
{!isViewOnly &&
|
|
301
|
+
<WhichCombo
|
|
302
|
+
Repository={props.Repository}
|
|
303
|
+
Editor={props.Editor}
|
|
304
|
+
onSubmit={onChangeComboValue}
|
|
305
|
+
parent={self}
|
|
306
|
+
reference="combo"
|
|
307
|
+
isInTag={true}
|
|
308
|
+
onGridAdd={onGridAdd}
|
|
309
|
+
onGridSave={onGridSave}
|
|
310
|
+
onGridDelete={onGridDelete}
|
|
311
|
+
tooltip={tooltip}
|
|
312
|
+
usePermissions={props.usePermissions}
|
|
313
|
+
{..._combo}
|
|
314
|
+
className={comboClassName}
|
|
315
|
+
/>}
|
|
327
316
|
</VStackNative>;
|
|
328
317
|
|
|
329
318
|
}
|
|
@@ -782,7 +782,7 @@ function Form(props) {
|
|
|
782
782
|
if (message) {
|
|
783
783
|
message = <Text className="text-[#f00]">{message}</Text>;
|
|
784
784
|
}
|
|
785
|
-
element = <VStack className="Form-VStack4 flex-1
|
|
785
|
+
element = <VStack className="Form-VStack4 flex-1">
|
|
786
786
|
{element}
|
|
787
787
|
{message}
|
|
788
788
|
</VStack>;
|
|
@@ -790,7 +790,7 @@ function Form(props) {
|
|
|
790
790
|
if (item.additionalEditButtons) {
|
|
791
791
|
const buttons = buildAdditionalButtons(item.additionalEditButtons, self, { fieldState, formSetValue, formGetValues, formState });
|
|
792
792
|
if (containerWidth > styles.FORM_STACK_ROW_THRESHOLD) {
|
|
793
|
-
element = <HStack className="Form-HStack5 flex-1 flex-wrap">
|
|
793
|
+
element = <HStack className="Form-HStack5 flex-1 flex-wrap items-center">
|
|
794
794
|
{element}
|
|
795
795
|
{buttons}
|
|
796
796
|
</HStack>;
|
|
@@ -883,7 +883,6 @@ function Form(props) {
|
|
|
883
883
|
min-h-[50px]
|
|
884
884
|
w-full
|
|
885
885
|
flex-none
|
|
886
|
-
pb-2
|
|
887
886
|
${error ? 'bg-[#fdd]' : ''}
|
|
888
887
|
`}
|
|
889
888
|
>
|
package/src/Constants/Dates.js
CHANGED
|
@@ -14,3 +14,4 @@ export const ONE_YEAR_AGO = moment().add(-1, 'years');
|
|
|
14
14
|
export const MOMENT_DATE_FORMAT_1 = 'YYYY-MM-DD HH:mm:ss';
|
|
15
15
|
export const MOMENT_DATE_FORMAT_2 = 'MMMM Do YYYY, h:mm:ss a';
|
|
16
16
|
export const MOMENT_DATE_FORMAT_3 = 'h:mm A';
|
|
17
|
+
export const MOMENT_DATE_FORMAT_4 = 'YYYY-MM-DD';
|
|
@@ -188,7 +188,9 @@ export function setTagValue(selectors, value) {
|
|
|
188
188
|
cy.get(field)
|
|
189
189
|
.wait(1000) // render
|
|
190
190
|
.type('{downarrow}')
|
|
191
|
-
.wait(500)
|
|
191
|
+
.wait(500) // allow time for selection
|
|
192
|
+
.type('{enter}')
|
|
193
|
+
.wait(250); // allow time to register enter key
|
|
192
194
|
});
|
|
193
195
|
|
|
194
196
|
// press trigger to hide dropdown
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Icon,
|
|
3
|
-
} from '@project-components/Gluestack';
|
|
4
1
|
import Button from '../Components/Buttons/Button.js';
|
|
5
2
|
import testProps from './testProps.js';
|
|
6
3
|
import _ from 'lodash';
|
|
@@ -14,32 +11,28 @@ export default function buildAdditionalButtons(configs, self, handlerArgs = {})
|
|
|
14
11
|
handler,
|
|
15
12
|
icon,
|
|
16
13
|
isDisabled,
|
|
14
|
+
tooltip,
|
|
17
15
|
color = '#fff',
|
|
18
16
|
} = config,
|
|
19
17
|
buttonProps = {
|
|
20
18
|
key,
|
|
19
|
+
parent: self,
|
|
21
20
|
reference: key,
|
|
21
|
+
text,
|
|
22
|
+
icon,
|
|
23
|
+
isDisabled,
|
|
22
24
|
className: 'ml-2',
|
|
25
|
+
tooltip,
|
|
26
|
+
color,
|
|
23
27
|
};
|
|
24
28
|
if (handler) {
|
|
25
29
|
buttonProps.onPress = () => handler(handlerArgs);
|
|
26
30
|
}
|
|
27
|
-
if (icon) {
|
|
28
|
-
buttonProps.leftIcon = <Icon as={icon} size="sm" className="text-[#fff]" />;
|
|
29
|
-
}
|
|
30
|
-
if (isDisabled) {
|
|
31
|
-
buttonProps.isDisabled = isDisabled;
|
|
32
|
-
}
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
reference={key}
|
|
39
|
-
text={text}
|
|
40
|
-
{...buttonProps}
|
|
41
|
-
/>;
|
|
42
|
-
additionalButtons.push(button);
|
|
32
|
+
additionalButtons.push(<Button
|
|
33
|
+
{...testProps(key)}
|
|
34
|
+
{...buttonProps}
|
|
35
|
+
/>);
|
|
43
36
|
});
|
|
44
37
|
return additionalButtons;
|
|
45
38
|
}
|