@onehat/ui 0.3.24 → 0.3.25

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.24",
3
+ "version": "0.3.25",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -29,7 +29,7 @@ export default function FieldSet(props) {
29
29
  borderWidth={1}
30
30
  borderColor="trueGray.400"
31
31
  bg={styles.FORM_FIELDSET_BG}
32
- m={2}
32
+ mb={4}
33
33
  pb={1}
34
34
  {...propsToPass}
35
35
  >
@@ -552,15 +552,15 @@ function Form(props) {
552
552
  formComponents = buildFromItems();
553
553
  const formAncillaryComponents = buildAncillary();
554
554
  editor = <>
555
- <Row>{formComponents}</Row>
555
+ <Column p={4}>{formComponents}</Column>
556
556
  <Column pt={4}>{formAncillaryComponents}</Column>
557
557
  </>;
558
558
  } else {
559
559
  formComponents = buildFromItems();
560
560
  const formAncillaryComponents = buildAncillary();
561
561
  editor = <ScrollView _web={{ height: 1 }} width="100%" pb={1}>
562
- <Row>{formComponents}</Row>
563
- <Column pt={4}>{formAncillaryComponents}</Column>
562
+ <Column p={4}>{formComponents}</Column>
563
+ <Column m={2} pt={4}>{formAncillaryComponents}</Column>
564
564
  </ScrollView>;
565
565
  }
566
566
 
@@ -616,7 +616,7 @@ function Form(props) {
616
616
  </Row>}
617
617
 
618
618
  {editor}
619
-
619
+
620
620
  <Footer justifyContent="flex-end" {...footerProps} {...savingProps}>
621
621
  {onDelete && editorMode === EDITOR_MODE__EDIT && isSingle &&
622
622
  <Row flex={1} justifyContent="flex-start">
@@ -195,7 +195,8 @@ function GridComponent(props) {
195
195
  let newSelection = selection;
196
196
  if (isInSelection(item)) {
197
197
  // Already selected
198
- if (allowToggle) {
198
+ const isSingle = selection.length === 1;
199
+ if (allowToggle || isSingle) {
199
200
  // Create empty selection
200
201
  newSelection = [];
201
202
  } else {
@@ -94,7 +94,17 @@ export default function Viewer(props) {
94
94
  label = propertyDef.title;
95
95
  }
96
96
 
97
- const value = (record?.properties[name]?.displayValue) || null;
97
+ let value = record?.properties[name]?.displayValue || null;
98
+ const
99
+ schema = record?.repository.getSchema(),
100
+ propertyDefinition = schema?.getPropertyDefinition(name);
101
+ if (propertyDefinition?.isFk) {
102
+ // value above is the id, get the actual display value
103
+ const fkDisplayField = propertyDefinition.fkDisplayField;
104
+ if (record.properties[fkDisplayField]) {
105
+ value = record.properties[fkDisplayField].displayValue;
106
+ }
107
+ }
98
108
 
99
109
  let element = <Element
100
110
  value={value}
@@ -107,7 +117,7 @@ export default function Viewer(props) {
107
117
  }
108
118
  element = <><Label {...labelProps}>{label}</Label>{element}</>;
109
119
  }
110
- return <Row key={ix} px={2} pb={1}>{element}</Row>;
120
+ return <Row key={ix}>{element}</Row>;
111
121
  },
112
122
  buildAncillary = () => {
113
123
  const components = [];
@@ -154,7 +164,7 @@ export default function Viewer(props) {
154
164
 
155
165
  return <Column flex={flex} {...props}>
156
166
  <ScrollView width="100%" _web={{ height: 1 }}>
157
- <Column m={2}>
167
+ <Column p={4}>
158
168
  {onEditMode && <Row mb={4} justifyContent="flex-end">
159
169
  <Button
160
170
  key="editBtn"