@onehat/ui 0.3.167 → 0.3.170

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@onehat/ui",
3
- "version": "0.3.167",
3
+ "version": "0.3.170",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -43,6 +43,7 @@ export function ComboComponent(props) {
43
43
  hideMenuOnSelection = true,
44
44
  showXButton = false,
45
45
  showEyeButton = false,
46
+ viewerProps = {}, // popup for eyeButton
46
47
  _input = {},
47
48
  isEditor = false,
48
49
  isDisabled = false,
@@ -593,7 +594,7 @@ export function ComboComponent(props) {
593
594
 
594
595
  if (UiGlobals.mode === UI_MODE_REACT_NATIVE) {
595
596
  // This input and trigger are for show
596
- // The just show the current getDisplayValue and open the menu
597
+ // They just show the current getDisplayValue and open the menu
597
598
  const displayValue = getDisplayValue();
598
599
  inputAndTrigger = <>
599
600
  <Pressable
@@ -607,6 +608,7 @@ export function ComboComponent(props) {
607
608
  bg={styles.FORM_COMBO_INPUT_BG}
608
609
  m={0}
609
610
  p={2}
611
+ h="100%"
610
612
  >
611
613
  {inputIconElement}
612
614
  <Text
@@ -738,7 +740,17 @@ export function ComboComponent(props) {
738
740
  }
739
741
 
740
742
  }}
741
- onAdd={onGridAdd}
743
+ onAdd={(entity) => {
744
+ if (entity?.id !== value && !isInTag) {
745
+ // Select it and set the value of the combo.
746
+ setGridSelection([entity]);
747
+ const id = entity.id;
748
+ setValue(id);
749
+ }
750
+ if (onGridAdd) {
751
+ onGridAdd([entity]);
752
+ }
753
+ }}
742
754
  onSave={(selection) => {
743
755
  const entity = selection[0];
744
756
  if (entity?.id !== value && !isInTag) { // Tag doesn't use value, so don't do this comparison in the Tag
@@ -915,7 +927,7 @@ export function ComboComponent(props) {
915
927
  // be responsive for small screen sizes and bump additionalButtons to the next line
916
928
  assembledComponents =
917
929
  <Column>
918
- <Row {...refProps} justifyContent="center" alignItems="center" h={styles.FORM_COMBO_HEIGHT} flex={1}>
930
+ <Row {...refProps} justifyContent="center" alignItems="center" flex={1}>
919
931
  {xButton}
920
932
  {eyeButton}
921
933
  {inputAndTrigger}
@@ -927,7 +939,7 @@ export function ComboComponent(props) {
927
939
  </Column>;
928
940
  } else {
929
941
  assembledComponents =
930
- <Row {...refProps} justifyContent="center" alignItems="center" h={styles.FORM_COMBO_HEIGHT} flex={1} onLayout={onLayout}>
942
+ <Row {...refProps} justifyContent="center" alignItems="center" flex={1} onLayout={onLayout}>
931
943
  {xButton}
932
944
  {eyeButton}
933
945
  {inputAndTrigger}
@@ -963,13 +975,13 @@ export function ComboComponent(props) {
963
975
  <Editor
964
976
  {...propsForViewer}
965
977
  editorType={EDITOR_TYPE__WINDOWED}
978
+ isEditorViewOnly={true}
979
+ {...viewerProps}
966
980
  px={0}
967
981
  py={0}
968
982
  w="100%"
969
983
  parent={self}
970
984
  reference="viewer"
971
-
972
- isEditorViewOnly={true}
973
985
  selection={viewerSelection}
974
986
  onEditorClose={onViewerClose}
975
987
  />