@onehat/ui 0.3.189 → 0.3.191

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.189",
3
+ "version": "0.3.191",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -763,6 +763,9 @@ export function ComboComponent(props) {
763
763
  // Select it and set the value of the combo.
764
764
  setGridSelection(selection);
765
765
  setValue(entity.id);
766
+ } else {
767
+ // we're not changing the Combo's value, but we might still need to change its displayValue
768
+ setDisplayValue(entity.id);
766
769
  }
767
770
  if (onGridSave) {
768
771
  onGridSave(selection);
@@ -33,7 +33,6 @@ export default function withEditor(WrappedComponent, isTree = false) {
33
33
  }
34
34
  return 'record' + (selection[0].displayValue ? ' "' + selection[0].displayValue + '"' : '') + '?';
35
35
  },
36
- record,
37
36
  onAdd,
38
37
  onChange, // any kind of crud change
39
38
  onDelete,
@@ -313,12 +312,10 @@ export default function withEditor(WrappedComponent, isTree = false) {
313
312
  },
314
313
  doEditorSave = async (data, e) => {
315
314
  // NOTE: The Form submits onSave for both adds (when not isAutoSsave) and edits.
316
- const
317
- what = record || selection,
318
- isSingle = what.length === 1;
315
+ const isSingle = selection.length === 1;
319
316
  if (isSingle) {
320
317
  // just update this one entity
321
- what[0].setValues(data);
318
+ selection[0].setValues(data);
322
319
 
323
320
  } else if (selection.length > 1) {
324
321
  // Edit multiple entities
@@ -327,7 +324,7 @@ export default function withEditor(WrappedComponent, isTree = false) {
327
324
  const propertyNames = Object.getOwnPropertyNames(data);
328
325
  _.each(propertyNames, (propertyName) => {
329
326
  if (!_.isNil(data[propertyName])) {
330
- _.each(what, (rec) => {
327
+ _.each(selection, (rec) => {
331
328
  rec[propertyName] = data[propertyName]
332
329
  });
333
330
  }
@@ -335,7 +332,7 @@ export default function withEditor(WrappedComponent, isTree = false) {
335
332
  }
336
333
 
337
334
  if (getListeners().onBeforeSave) {
338
- const listenerResult = await getListeners().onBeforeSave(what);
335
+ const listenerResult = await getListeners().onBeforeSave(selection);
339
336
  if (listenerResult === false) {
340
337
  return;
341
338
  }
@@ -354,23 +351,23 @@ export default function withEditor(WrappedComponent, isTree = false) {
354
351
 
355
352
  if (success) {
356
353
  if (onChange) {
357
- onChange(what);
354
+ onChange(selection);
358
355
  }
359
356
  if (editorMode === EDITOR_MODE__ADD) {
360
357
  if (onAdd) {
361
- await onAdd(what);
358
+ await onAdd(selection);
362
359
  }
363
360
  if (getListeners().onAfterAdd) {
364
- await getListeners().onAfterAdd(what);
361
+ await getListeners().onAfterAdd(selection);
365
362
  }
366
363
  setIsAdding(false);
367
364
  setEditorMode(EDITOR_MODE__EDIT);
368
365
  } else if (editorMode === EDITOR_MODE__EDIT) {
369
366
  if (getListeners().onAfterEdit) {
370
- await getListeners().onAfterEdit(what);
367
+ await getListeners().onAfterEdit(selection);
371
368
  }
372
369
  if (onSave) {
373
- onSave(what);
370
+ onSave(selection);
374
371
  }
375
372
  }
376
373
  // setIsEditorShown(false);