@onehat/ui 0.3.207 → 0.3.208

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.207",
3
+ "version": "0.3.208",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -37,6 +37,7 @@ export default function withEditor(WrappedComponent, isTree = false) {
37
37
  onChange, // any kind of crud change
38
38
  onDelete,
39
39
  onSave, // this could also be called 'onEdit'
40
+ onEditorClose,
40
41
  newEntityDisplayValue,
41
42
  newEntityDisplayProperty, // in case the field to set for newEntityDisplayValue is different from model
42
43
  defaultValues,
@@ -66,10 +67,16 @@ export default function withEditor(WrappedComponent, isTree = false) {
66
67
  [currentRecord, setCurrentRecord] = useState(null),
67
68
  [isAdding, setIsAdding] = useState(false),
68
69
  [isSaving, setIsSaving] = useState(false),
69
- [isEditorShown, setIsEditorShown] = useState(false),
70
+ [isEditorShown, setIsEditorShownRaw] = useState(false),
70
71
  [isEditorViewOnly, setIsEditorViewOnly] = useState(canEditorViewOnly), // current state of whether editor is in view-only mode
71
72
  [isIgnoreNextSelectionChange, setIsIgnoreNextSelectionChange] = useState(false),
72
73
  [lastSelection, setLastSelection] = useState(),
74
+ setIsEditorShown = (bool) => {
75
+ setIsEditorShownRaw(bool);
76
+ if (!bool && onEditorClose) {
77
+ onEditorClose();
78
+ }
79
+ },
73
80
  setSelectionDecorated = (newSelection) => {
74
81
  function doIt() {
75
82
  setSelection(newSelection);