@onehat/ui 0.3.118 → 0.3.120

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.118",
3
+ "version": "0.3.120",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -20,6 +20,7 @@ export default function Pagination(props) {
20
20
  minimize = false,
21
21
  disablePageSize = false,
22
22
  showMoreOnly = false,
23
+ showPagination = true, // everything except reloadBtn
23
24
 
24
25
  // withComponent
25
26
  self,
@@ -61,14 +62,16 @@ export default function Pagination(props) {
61
62
  isDisabled = false;
62
63
  if (showMoreOnly) {
63
64
  isDisabled = (pageEnd === total);
64
- items.push(<Button
65
- key="showMore"
66
- parent={self}
67
- reference="showMoreBtn"
68
- onPress={() => Repository.showMore()}
69
- isDisabled={isDisabled}
70
- tooltip="Show More"
71
- >Show More</Button>);
65
+ if (showPagination) {
66
+ items.push(<Button
67
+ key="showMore"
68
+ parent={self}
69
+ reference="showMoreBtn"
70
+ onPress={() => Repository.showMore()}
71
+ isDisabled={isDisabled}
72
+ tooltip="Show More"
73
+ >Show More</Button>);
74
+ }
72
75
  if (!Repository.isLocal) {
73
76
  items.push(<IconButton
74
77
  key="reload"
@@ -83,70 +86,73 @@ export default function Pagination(props) {
83
86
  }
84
87
  } else {
85
88
  isDisabled = page === 1;
86
- items.push(<IconButton
87
- key="first"
88
- parent={self}
89
- reference="firstPageBtn"
90
- {...iconButtonProps}
91
- isDisabled={isDisabled}
92
- icon={<Icon as={AnglesLeft} {...iconProps} color={isDisabled ? 'disabled' : 'trueGray.600'} />}
93
- onPress={() => Repository.setPage(1)}
94
- tooltip="First Page"
95
- />);
96
- items.push(<IconButton
97
- key="prev"
98
- parent={self}
99
- reference="prevPageBtn"
100
- {...iconButtonProps}
101
- isDisabled={isDisabled}
102
- icon={<Icon as={AngleLeft} {...iconProps} color={isDisabled ? 'disabled' : 'trueGray.600'} />}
103
- onPress={() => Repository.prevPage()}
104
- tooltip="Previous Page"
105
- />);
106
- if (!minimize) {
107
- items.push(<Row
108
- key="pageSelector"
109
- mx={3}
110
- justifyContent="center"
111
- alignItems="center"
112
- >
113
- <Text mr={2}>Page</Text>
114
- <Input
115
- parent={self}
116
- reference="pageInput"
117
- keyboardType="numeric"
118
- value={page?.toString()}
119
- onChangeValue={(value) => Repository.setPage(value)}
120
- maxValue={totalPages}
121
- isDisabled={totalPages === 1}
122
- w={10}
123
- tooltip="Set Page"
124
- />
125
- <Text ml={2}>of {totalPages}</Text>
126
- </Row>);
89
+ if (showPagination) {
90
+ items.push(<IconButton
91
+ key="first"
92
+ parent={self}
93
+ reference="firstPageBtn"
94
+ {...iconButtonProps}
95
+ isDisabled={isDisabled}
96
+ icon={<Icon as={AnglesLeft} {...iconProps} color={isDisabled ? 'disabled' : 'trueGray.600'} />}
97
+ onPress={() => Repository.setPage(1)}
98
+ tooltip="First Page"
99
+ />);
100
+ items.push(<IconButton
101
+ key="prev"
102
+ parent={self}
103
+ reference="prevPageBtn"
104
+ {...iconButtonProps}
105
+ isDisabled={isDisabled}
106
+ icon={<Icon as={AngleLeft} {...iconProps} color={isDisabled ? 'disabled' : 'trueGray.600'} />}
107
+ onPress={() => Repository.prevPage()}
108
+ tooltip="Previous Page"
109
+ />);
110
+ if (!minimize) {
111
+ items.push(<Row
112
+ key="pageSelector"
113
+ mx={3}
114
+ justifyContent="center"
115
+ alignItems="center"
116
+ >
117
+ <Text mr={2}>Page</Text>
118
+ <Input
119
+ parent={self}
120
+ reference="pageInput"
121
+ keyboardType="numeric"
122
+ value={page?.toString()}
123
+ onChangeValue={(value) => Repository.setPage(value)}
124
+ maxValue={totalPages}
125
+ isDisabled={totalPages === 1}
126
+ w={10}
127
+ tooltip="Set Page"
128
+ />
129
+ <Text ml={2}>of {totalPages}</Text>
130
+ </Row>);
131
+ }
132
+
133
+ isDisabled = page === totalPages || totalPages <= 1;
134
+ items.push(<IconButton
135
+ key="next"
136
+ parent={self}
137
+ reference="nextPageBtn"
138
+ {...iconButtonProps}
139
+ isDisabled={isDisabled}
140
+ icon={<Icon as={AngleRight} {...iconProps} color={isDisabled ? 'disabled' : 'trueGray.600'} />}
141
+ onPress={() => Repository.nextPage()}
142
+ tooltip="Next Page"
143
+ />);
144
+ items.push(<IconButton
145
+ key="last"
146
+ parent={self}
147
+ reference="lastPageBtn"
148
+ {...iconButtonProps}
149
+ isDisabled={isDisabled}
150
+ icon={<Icon as={AnglesRight} {...iconProps} color={isDisabled ? 'disabled' : 'trueGray.600'} />}
151
+ onPress={() => Repository.setPage(totalPages)}
152
+ tooltip="Last Page"
153
+ />);
127
154
  }
128
-
129
- isDisabled = page === totalPages || totalPages <= 1;
130
- items.push(<IconButton
131
- key="next"
132
- parent={self}
133
- reference="nextPageBtn"
134
- {...iconButtonProps}
135
- isDisabled={isDisabled}
136
- icon={<Icon as={AngleRight} {...iconProps} color={isDisabled ? 'disabled' : 'trueGray.600'} />}
137
- onPress={() => Repository.nextPage()}
138
- tooltip="Next Page"
139
- />);
140
- items.push(<IconButton
141
- key="last"
142
- parent={self}
143
- reference="lastPageBtn"
144
- {...iconButtonProps}
145
- isDisabled={isDisabled}
146
- icon={<Icon as={AnglesRight} {...iconProps} color={isDisabled ? 'disabled' : 'trueGray.600'} />}
147
- onPress={() => Repository.setPage(totalPages)}
148
- tooltip="Last Page"
149
- />);
155
+
150
156
  if (!Repository.isLocal) {
151
157
  items.push(<IconButton
152
158
  key="reload"
@@ -158,10 +164,10 @@ export default function Pagination(props) {
158
164
  tooltip="Reload"
159
165
  />);
160
166
  }
161
- if (!minimize && !disablePageSize) {
167
+ if (showPagination && !minimize && !disablePageSize) {
162
168
  items.push(<PageSizeCombo key="pageSize" pageSize={pageSize} Repository={Repository} />);
163
169
  }
164
- if (!minimize) {
170
+ if (showPagination && !minimize) {
165
171
  let pageSpan = `${pageStart} – ${pageEnd}`;
166
172
  if (pageStart === pageEnd) {
167
173
  pageSpan = pageStart;
@@ -181,6 +187,7 @@ export default function Pagination(props) {
181
187
  </Row>;
182
188
  }, [
183
189
  // Repository,
190
+ showPagination,
184
191
  page,
185
192
  pageSize,
186
193
  total,
@@ -49,7 +49,7 @@ export default function PaginationToolbar(props) {
49
49
  w="100%"
50
50
  onLayout={(e) => onLayout(e)}
51
51
  >
52
- {showPagination && <Pagination {...propsToPass} w={toolbarItems.length ? null : '100%'} minimize={minimize} disablePageSize={disablePageSize} />}
52
+ <Pagination {...propsToPass} showPagination={showPagination} w={toolbarItems.length ? null : '100%'} minimize={minimize} disablePageSize={disablePageSize} />
53
53
  {toolbarItems.length ? <Row flex={1} {...toolbarProps}>{toolbarItems}</Row> : null}
54
54
  </Toolbar>;
55
55
  };
@@ -87,6 +87,9 @@ function Viewer(props) {
87
87
  if (type?.match && type.match(/Combo$/) && Repository?.isRemote && !Repository?.isLoaded) {
88
88
  editorTypeProps.autoLoad = true;
89
89
  }
90
+ if (type.match(/(Tag|TagEditor)$/)) {
91
+ editorTypeProps.isViewOnly = true;
92
+ }
90
93
  const Element = getComponentFromType(type);
91
94
  let children;
92
95