@onehat/ui 0.2.71 → 0.2.73

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.71",
3
+ "version": "0.2.73",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -52,7 +52,7 @@ import _ from 'lodash';
52
52
  // The default export is *with* the HOC. A separate *raw* component is
53
53
  // exported which can be combined with many HOCs for various functionality.
54
54
 
55
- export function Grid(props) {
55
+ export function GridComponent(props) {
56
56
  const {
57
57
 
58
58
  columnsConfig = [], // json configurations for each column
@@ -851,26 +851,26 @@ export function Grid(props) {
851
851
 
852
852
  }
853
853
 
854
- export const Grid = withAlert(
855
- withEvents(
856
- withData(
857
- withMultiSelection(
858
- withSelection(
859
- // withSideEditor(
860
- withFilters(
861
- withPresetButtons(
862
- withContextMenu(
863
- Grid
864
- ),
865
- true // isGrid
866
- )
867
- )
868
- // )
869
- )
870
- )
854
+ const Grid = withAlert(
855
+ withEvents(
856
+ withData(
857
+ withMultiSelection(
858
+ withSelection(
859
+ // withSideEditor(
860
+ withFilters(
861
+ withPresetButtons(
862
+ withContextMenu(
863
+ GridComponent
864
+ ),
865
+ true // isGrid
871
866
  )
872
867
  )
873
- );
868
+ // )
869
+ )
870
+ )
871
+ )
872
+ )
873
+ );
874
874
 
875
875
  export const SideGridEditor = withAlert(
876
876
  withEvents(
@@ -881,7 +881,7 @@ export const SideGridEditor = withAlert(
881
881
  withFilters(
882
882
  withPresetButtons(
883
883
  withContextMenu(
884
- Grid
884
+ GridComponent
885
885
  ),
886
886
  true // isGrid
887
887
  )
@@ -902,7 +902,7 @@ export const WindowedGridEditor = withAlert(
902
902
  withFilters(
903
903
  withPresetButtons(
904
904
  withContextMenu(
905
- Grid
905
+ GridComponent
906
906
  ),
907
907
  true // isGrid
908
908
  )
@@ -923,7 +923,7 @@ export const InlineGridEditor = withAlert(
923
923
  withPresetButtons(
924
924
  withContextMenu(
925
925
  withFilters(
926
- Grid
926
+ GridComponent
927
927
  ),
928
928
  true // isGrid
929
929
  )
@@ -0,0 +1,39 @@
1
+ import { useEffect, useState, } from 'react';
2
+ import Panel from './Panel.js';
3
+ import { Tree, } from '../Tree/Tree.js';
4
+ import _ from 'lodash';
5
+
6
+ export function TreePanel(props) {
7
+ const {
8
+ disableTitleChange = false,
9
+ selectorSelected,
10
+ } = props,
11
+ originalTitle = props.title,
12
+ [isReady, setIsReady] = useState(disableTitleChange),
13
+ [title, setTitle] = useState(originalTitle);
14
+
15
+ useEffect(() => {
16
+ if (!disableTitleChange && originalTitle) {
17
+ let newTitle = originalTitle;
18
+ if (selectorSelected?.[0]?.displayValue) {
19
+ newTitle = originalTitle + ' for ' + selectorSelected[0].displayValue;
20
+ }
21
+ if (newTitle !== title) {
22
+ setTitle(newTitle);
23
+ }
24
+ }
25
+ if (!isReady) {
26
+ setIsReady(true);
27
+ }
28
+ }, [selectorSelected, disableTitleChange, originalTitle]);
29
+
30
+ if (!isReady) {
31
+ return null;
32
+ }
33
+
34
+ return <Panel {...props} title={title}>
35
+ <Tree {...props} />
36
+ </Panel>;
37
+ }
38
+
39
+ export default TreePanel;
@@ -63,7 +63,7 @@ import _ from 'lodash';
63
63
  //////////////////////
64
64
 
65
65
 
66
- export function Tree(props) {
66
+ export function TreeComponent(props) {
67
67
  const {
68
68
  areRootsVisible = true,
69
69
  extraParams = {}, // Additional params to send with each request ( e.g. { order: 'Categories.name ASC' })
@@ -1114,25 +1114,25 @@ export function Tree(props) {
1114
1114
 
1115
1115
  }
1116
1116
 
1117
- export const Tree = withAlert(
1118
- withEvents(
1119
- withData(
1120
- // withMultiSelection(
1121
- withSelection(
1122
- // withSideEditor(
1123
- withFilters(
1124
- // withPresetButtons(
1125
- withContextMenu(
1126
- Tree
1127
- )
1128
- // )
1129
- )
1130
- // )
1131
- )
1132
- // )
1133
- )
1117
+ const Tree = withAlert(
1118
+ withEvents(
1119
+ withData(
1120
+ // withMultiSelection(
1121
+ withSelection(
1122
+ // withSideEditor(
1123
+ withFilters(
1124
+ // withPresetButtons(
1125
+ withContextMenu(
1126
+ TreeComponent
1127
+ )
1128
+ // )
1134
1129
  )
1135
- );
1130
+ // )
1131
+ )
1132
+ // )
1133
+ )
1134
+ )
1135
+ );
1136
1136
 
1137
1137
  export const SideTreeEditor = withAlert(
1138
1138
  withEvents(
@@ -1143,7 +1143,7 @@ export const SideTreeEditor = withAlert(
1143
1143
  withFilters(
1144
1144
  withPresetButtons(
1145
1145
  withContextMenu(
1146
- Tree
1146
+ TreeComponent
1147
1147
  )
1148
1148
  )
1149
1149
  )
@@ -1163,7 +1163,7 @@ export const WindowedTreeEditor = withAlert(
1163
1163
  withFilters(
1164
1164
  withPresetButtons(
1165
1165
  withContextMenu(
1166
- Tree
1166
+ TreeComponent
1167
1167
  )
1168
1168
  )
1169
1169
  )