@onehat/ui 0.3.187 → 0.3.189

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.187",
3
+ "version": "0.3.189",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -745,15 +745,15 @@ export function ComboComponent(props) {
745
745
  }
746
746
 
747
747
  }}
748
- onAdd={(entity) => {
749
- if (entity?.id !== value && !isInTag) {
748
+ onAdd={(selection) => {
749
+ const entity = selection[0];
750
+ if (entity.id !== value && !isInTag) {
750
751
  // Select it and set the value of the combo.
751
- setGridSelection([entity]);
752
- const id = entity.id;
753
- setValue(id);
752
+ setGridSelection(selection);
753
+ setValue(entity.id);
754
754
  }
755
755
  if (onGridAdd) {
756
- onGridAdd([entity]);
756
+ onGridAdd(selection);
757
757
  }
758
758
  }}
759
759
  onSave={(selection) => {
@@ -761,9 +761,8 @@ export function ComboComponent(props) {
761
761
  if (entity?.id !== value && !isInTag) { // Tag doesn't use value, so don't do this comparison in the Tag
762
762
  // Either a phantom record was just solidified into a real record, or a new (non-phantom) record was added.
763
763
  // Select it and set the value of the combo.
764
- setGridSelection([entity]);
765
- const id = entity.id;
766
- setValue(id);
764
+ setGridSelection(selection);
765
+ setValue(entity.id);
767
766
  }
768
767
  if (onGridSave) {
769
768
  onGridSave(selection);
@@ -287,17 +287,12 @@ function Form(props) {
287
287
  return <Row>{elements}</Row>;
288
288
  },
289
289
  buildFromItems = () => {
290
- const builtItems = [];
291
- _.each(items, (item, ix) => {
292
- if (!item) {
293
- return;
294
- }
295
- const builtItem = buildFromItem(item, ix, columnDefaults);
296
- builtItems.push(builtItem);
297
- });
298
- return builtItems;
290
+ return _.map(items, (item, ix) => buildFromItem(item, ix, columnDefaults));
299
291
  },
300
292
  buildFromItem = (item, ix, defaults) => {
293
+ if (!item) {
294
+ return null;
295
+ }
301
296
  if (React.isValidElement(item)) {
302
297
  return item;
303
298
  }
@@ -57,17 +57,12 @@ function Viewer(props) {
57
57
  styles = UiGlobals.styles,
58
58
  flex = props.flex || 1,
59
59
  buildFromItems = () => {
60
- const builtItems = [];
61
- _.each(items, (item, ix) => {
62
- if (!item) {
63
- return;
64
- }
65
- const builtItem = buildFromItem(item, ix, columnDefaults);
66
- builtItems.push(builtItem);
67
- });
68
- return builtItems;
60
+ return _.map(items, (item, ix) => buildFromItem(item, ix, columnDefaults));
69
61
  },
70
62
  buildFromItem = (item, ix, defaults) => {
63
+ if (!item) {
64
+ return null;
65
+ }
71
66
  let {
72
67
  type,
73
68
  title,