@onehat/ui 0.3.317 → 0.3.318

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.317",
3
+ "version": "0.3.318",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -52,11 +52,10 @@
52
52
  "react-dnd-html5-backend": "^16.0.1",
53
53
  "react-dnd-touch-backend":"16.0.1",
54
54
  "react-draggable": "^4.4.5",
55
- "react-json-view": "^1.21.3",
56
- "react-json-view-lite": "^1.4.0",
57
55
  "react-native": "*",
58
56
  "react-native-draggable": "^3.3.0",
59
57
  "react-native-svg": "*",
58
+ "react18-json-view": "^0.2.8",
60
59
  "use-file-picker": "^2.1.1"
61
60
  },
62
61
  "devDependencies": {
@@ -21,7 +21,7 @@ export function JsonElement(props) {
21
21
  tooltipRef = null,
22
22
  tooltip = null,
23
23
  isDisabled = false,
24
- isEditable = true,
24
+ isViewOnly = false,
25
25
  tooltipPlacement = 'bottom',
26
26
  testID,
27
27
 
@@ -34,34 +34,29 @@ export function JsonElement(props) {
34
34
  ...propsToPass
35
35
  } = props,
36
36
  styles = UiGlobals.styles,
37
- JsonEditor = getComponentFromType('JsonEditor'),
38
- JsonViewer = getComponentFromType('JsonViewer');
39
-
37
+ JsonEditor = getComponentFromType('JsonEditor');
38
+
40
39
  let assembledComponents = null;
41
40
 
42
41
  if (UiGlobals.mode === UI_MODE_WEB) {
43
42
  const src = JSON.parse(value);
44
-
45
- if (isEditable) {
46
- assembledComponents =
43
+ assembledComponents =
44
+ <Row
45
+ flex={1}
46
+ {...propsToPass}
47
+ justifyContent="flex-start"
48
+ >
47
49
  <JsonEditor
48
- // {...propsToPass}
50
+ width="100%"
51
+ editable={!isViewOnly}
49
52
  src={src}
50
53
  enableClipboard={false}
51
54
  collapsed={true}
52
- editable={isEditable}
53
55
  onEdit={(obj) => {
54
56
  setValue(JSON.stringify(obj.updated_src));
55
57
  }}
56
- isDisabled={isDisabled}
57
- />;
58
- } else {
59
- assembledComponents =
60
- <JsonViewer
61
- // {...propsToPass}
62
- data={src}
63
- />;
64
- }
58
+ />
59
+ </Row>;
65
60
 
66
61
  }
67
62
  if (UiGlobals.mode === UI_MODE_REACT_NATIVE) {
@@ -122,7 +122,7 @@ function GridRow(props) {
122
122
  if (UiGlobals.mode === UI_MODE_WEB) {
123
123
  elementProps.textOverflow = 'ellipsis';
124
124
  }
125
- if (type.match(/(Tag|TagEditor)$/)) {
125
+ if (type.match(/(Tag|TagEditor|Json)$/)) {
126
126
  elementProps.isViewOnly = true; // TODO: this won't work for InlineGridEditor, bc that Grid can't use isViewOnly when actually editing
127
127
  }
128
128
  if (config.getCellProps) {
@@ -5,7 +5,6 @@ import Datetime from '../PlatformImports/Web/Datetime.js';
5
5
  import Draggable from '../PlatformImports/Web/Draggable.js';
6
6
  import File from '../PlatformImports/Web/File.js';
7
7
  import JsonEditor from '../PlatformImports/Web/JsonEditor.js';
8
- import JsonViewer from '../PlatformImports/Web/JsonViewer.js';
9
8
  import useWindowSize from '../PlatformImports/Web/useWindowSize.js';
10
9
  import _ from 'lodash';
11
10
 
@@ -17,7 +16,6 @@ export default function registerWebComponents() {
17
16
  Draggable,
18
17
  File,
19
18
  JsonEditor,
20
- JsonViewer,
21
19
  useWindowSize,
22
20
  });
23
21
  }
@@ -1,3 +1,4 @@
1
- import ReactJson from 'react-json-view'; // https://www.npmjs.com/package/react-json-view
1
+ import ReactJson from 'react18-json-view'; // https://www.npmjs.com/package/react18-json-view
2
+ import 'react18-json-view/src/style.css'
2
3
 
3
4
  export default ReactJson.default || ReactJson;
@@ -1,4 +0,0 @@
1
- import { JsonView, allExpanded, darkStyles, defaultStyles } from 'react-json-view-lite'; // https://www.npmjs.com/package/react-json-view-lite
2
- import 'react-json-view-lite/dist/index.css';
3
-
4
- export default JsonView;