@onehat/ui 0.2.39 → 0.2.40

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.2.39",
3
+ "version": "0.2.40",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -42,6 +42,7 @@ const
42
42
 
43
43
  if (_.isNil(value)) {
44
44
  return <IconButton
45
+ ref={props.outerRef}
45
46
  icon={<Icon as={Na} color="trueGray.400" />}
46
47
  onPress={onToggle}
47
48
  borderWidth={1}
@@ -1,8 +1,8 @@
1
1
  import { useState, } from 'react';
2
2
  import {
3
- EDITOR_VIEW_MODE__VIEW,
4
- EDITOR_VIEW_MODE__ADD,
5
- EDITOR_VIEW_MODE__EDIT,
3
+ EDITOR_MODE__VIEW,
4
+ EDITOR_MODE__ADD,
5
+ EDITOR_MODE__EDIT,
6
6
  } from '../../Constants/Editor.js';
7
7
  import _ from 'lodash';
8
8
 
@@ -38,7 +38,7 @@ export default function withEditor(WrappedComponent) {
38
38
  [currentRecord, setCurrentRecord] = useState(null),
39
39
  [isEditorShown, setIsEditorShown] = useState(false),
40
40
  [isEditorViewOnly, setIsEditorViewOnly] = useState(false),
41
- [editorViewMode, setEditorViewMode] = useState(EDITOR_VIEW_MODE__VIEW),
41
+ [editorMode, setEditorMode] = useState(EDITOR_MODE__VIEW),
42
42
  addRecord = async () => {
43
43
  if (!userCanEdit) {
44
44
  return;
@@ -48,7 +48,7 @@ export default function withEditor(WrappedComponent) {
48
48
  entity = await Repository.add(defaultValues, false, true, true);
49
49
  setSelection([entity]);
50
50
  setIsEditorViewOnly(false);
51
- setEditorViewMode(EDITOR_VIEW_MODE__ADD);
51
+ setEditorMode(EDITOR_MODE__ADD);
52
52
  setIsEditorShown(true);
53
53
  },
54
54
  editRecord = () => {
@@ -56,7 +56,7 @@ export default function withEditor(WrappedComponent) {
56
56
  return;
57
57
  }
58
58
  setIsEditorViewOnly(false);
59
- setEditorViewMode(EDITOR_VIEW_MODE__EDIT);
59
+ setEditorMode(EDITOR_MODE__EDIT);
60
60
  setIsEditorShown(true);
61
61
  },
62
62
  deleteRecord = (e) => {
@@ -88,7 +88,7 @@ export default function withEditor(WrappedComponent) {
88
88
  return;
89
89
  }
90
90
  setIsEditorViewOnly(true);
91
- setEditorViewMode(EDITOR_VIEW_MODE__VIEW);
91
+ setEditorMode(EDITOR_MODE__VIEW);
92
92
  setIsEditorShown(true);
93
93
  },
94
94
  duplicateRecord = async () => {
@@ -147,7 +147,8 @@ export default function withEditor(WrappedComponent) {
147
147
  setCurrentRecord={setCurrentRecord}
148
148
  isEditorShown={isEditorShown}
149
149
  isEditorViewOnly={isEditorViewOnly}
150
- editorViewMode={editorViewMode}
150
+ editorMode={editorMode}
151
+ setEditorMode={setEditorMode}
151
152
  setIsEditorShown={setIsEditorShown}
152
153
  onAdd={addRecord}
153
154
  onEdit={editRecord}
@@ -3,6 +3,6 @@ export const EDITOR_TYPE__WINDOWED = 'EDITOR_TYPE__WINDOWED';
3
3
  export const EDITOR_TYPE__SIDE = 'EDITOR_TYPE__SIDE';
4
4
  export const EDITOR_TYPE__SMART = 'EDITOR_TYPE__SMART';
5
5
  export const EDITOR_TYPE__PLAIN = 'EDITOR_TYPE__PLAIN';
6
- export const EDITOR_VIEW_MODE__VIEW = 'EDITOR_VIEW_MODE__VIEW';
7
- export const EDITOR_VIEW_MODE__ADD = 'EDITOR_VIEW_MODE__ADD';
8
- export const EDITOR_VIEW_MODE__EDIT = 'EDITOR_VIEW_MODE__EDIT';
6
+ export const EDITOR_MODE__VIEW = 'EDITOR_MODE__VIEW';
7
+ export const EDITOR_MODE__ADD = 'EDITOR_MODE__ADD';
8
+ export const EDITOR_MODE__EDIT = 'EDITOR_MODE__EDIT';