@onehat/ui 0.3.118 → 0.3.121
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
|
@@ -44,6 +44,7 @@ export default function withFilters(WrappedComponent) {
|
|
|
44
44
|
customFilters = [], // of shape: { title, type, field, value, getRepoFilters(value) }
|
|
45
45
|
minFilters = 3,
|
|
46
46
|
maxFilters = 6,
|
|
47
|
+
onFilterChange,
|
|
47
48
|
|
|
48
49
|
// withData
|
|
49
50
|
Repository,
|
|
@@ -192,6 +193,9 @@ export default function withFilters(WrappedComponent) {
|
|
|
192
193
|
if (save && id) {
|
|
193
194
|
setSaved(id + '-filters', filters);
|
|
194
195
|
}
|
|
196
|
+
if (onFilterChange) {
|
|
197
|
+
onFilterChange(filters);
|
|
198
|
+
}
|
|
195
199
|
},
|
|
196
200
|
onFilterChangeValue = (field, value) => {
|
|
197
201
|
// handler for when a filter value changes
|
|
@@ -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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
-
|
|
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
|
|