@onehat/ui 0.3.280 → 0.3.281
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
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Icon,
|
|
3
|
+
} from 'native-base';
|
|
4
|
+
import testProps from '../../Functions/testProps.js';
|
|
5
|
+
import IconButton from './IconButton.js';
|
|
6
|
+
import Rotate from '../Icons/Rotate.js';
|
|
7
|
+
|
|
8
|
+
export default function ReloadPageButton(props) {
|
|
9
|
+
const {
|
|
10
|
+
iconProps ={},
|
|
11
|
+
self,
|
|
12
|
+
Repository,
|
|
13
|
+
} = props;
|
|
14
|
+
|
|
15
|
+
if (!Repository || Repository.isLocal) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return <IconButton
|
|
20
|
+
{...testProps('reloadPageBtn')}
|
|
21
|
+
{...props}
|
|
22
|
+
reference="reloadPageBtn"
|
|
23
|
+
parent={self}
|
|
24
|
+
icon={<Icon as={Rotate} {...iconProps} color="trueGray.600" />}
|
|
25
|
+
onPress={() => Repository.reload()}
|
|
26
|
+
tooltip="Reload"
|
|
27
|
+
ml={2}
|
|
28
|
+
/>;
|
|
29
|
+
}
|
|
30
|
+
|
|
@@ -48,6 +48,7 @@ import getIconButtonFromConfig from '../../Functions/getIconButtonFromConfig.js'
|
|
|
48
48
|
import nbToRgb from '../../Functions/nbToRgb.js';
|
|
49
49
|
import testProps from '../../Functions/testProps.js';
|
|
50
50
|
import Loading from '../Messages/Loading.js';
|
|
51
|
+
import ReloadPageButton from '../Buttons/ReloadPageButton.js';
|
|
51
52
|
import GridHeaderRow from './GridHeaderRow.js';
|
|
52
53
|
import GridRow, { DragSourceDropTargetGridRow, DragSourceGridRow, DropTargetGridRow } from './GridRow.js';
|
|
53
54
|
import IconButton from '../Buttons/IconButton.js';
|
|
@@ -969,7 +970,10 @@ function GridComponent(props) {
|
|
|
969
970
|
showMoreOnly={showMoreOnly}
|
|
970
971
|
/>;
|
|
971
972
|
} else if (footerToolbarItemComponents.length) {
|
|
972
|
-
listFooterComponent = <Toolbar>
|
|
973
|
+
listFooterComponent = <Toolbar>
|
|
974
|
+
<ReloadPageButton Repository={Repository} self={self} />
|
|
975
|
+
{footerToolbarItemComponents}
|
|
976
|
+
</Toolbar>;
|
|
973
977
|
}
|
|
974
978
|
}
|
|
975
979
|
|
|
@@ -8,6 +8,7 @@ import useForceUpdate from '../../Hooks/useForceUpdate.js';
|
|
|
8
8
|
import testProps from '../../Functions/testProps.js';
|
|
9
9
|
import Button from '../Buttons/Button.js';
|
|
10
10
|
import IconButton from '../Buttons/IconButton.js';
|
|
11
|
+
import ReloadPageButton from '../Buttons/ReloadPageButton.js';
|
|
11
12
|
import AngleLeft from '../Icons/AngleLeft.js';
|
|
12
13
|
import AnglesLeft from '../Icons/AnglesLeft.js';
|
|
13
14
|
import AngleRight from '../Icons/AngleRight.js';
|
|
@@ -66,35 +67,25 @@ export default function Pagination(props) {
|
|
|
66
67
|
if (showPagination) {
|
|
67
68
|
items.push(<Button
|
|
68
69
|
{...testProps('showMoreBtn')}
|
|
69
|
-
key="
|
|
70
|
-
parent={self}
|
|
70
|
+
key="showMoreBtn"
|
|
71
71
|
reference="showMoreBtn"
|
|
72
|
+
parent={self}
|
|
72
73
|
onPress={() => Repository.showMore()}
|
|
73
74
|
isDisabled={isDisabled}
|
|
74
75
|
tooltip="Show More"
|
|
75
76
|
>Show More</Button>);
|
|
76
77
|
}
|
|
77
78
|
if (!Repository.isLocal) {
|
|
78
|
-
items.push(<
|
|
79
|
-
{...testProps('reloadPageBtn')}
|
|
80
|
-
key="reload"
|
|
81
|
-
parent={self}
|
|
82
|
-
reference="reloadPageBtn"
|
|
83
|
-
{...iconButtonProps}
|
|
84
|
-
icon={<Icon as={Rotate} {...iconProps} color="trueGray.600" />}
|
|
85
|
-
onPress={() => Repository.reload()}
|
|
86
|
-
tooltip="Reload"
|
|
87
|
-
ml={2}
|
|
88
|
-
/>);
|
|
79
|
+
items.push(<ReloadPageButton key="reloadPageBtn" {...iconButtonProps} iconProps={iconProps} Repository={Repository} self={self} />);
|
|
89
80
|
}
|
|
90
81
|
} else {
|
|
91
82
|
isDisabled = page === 1;
|
|
92
83
|
if (showPagination) {
|
|
93
84
|
items.push(<IconButton
|
|
94
85
|
{...testProps('firstPageBtn')}
|
|
95
|
-
key="
|
|
96
|
-
parent={self}
|
|
86
|
+
key="firstPageBtn"
|
|
97
87
|
reference="firstPageBtn"
|
|
88
|
+
parent={self}
|
|
98
89
|
{...iconButtonProps}
|
|
99
90
|
isDisabled={isDisabled}
|
|
100
91
|
icon={<Icon as={AnglesLeft} {...iconProps} color={isDisabled ? 'disabled' : 'trueGray.600'} />}
|
|
@@ -103,9 +94,9 @@ export default function Pagination(props) {
|
|
|
103
94
|
/>);
|
|
104
95
|
items.push(<IconButton
|
|
105
96
|
{...testProps('prevPageBtn')}
|
|
106
|
-
key="
|
|
107
|
-
parent={self}
|
|
97
|
+
key="prevPageBtn"
|
|
108
98
|
reference="prevPageBtn"
|
|
99
|
+
parent={self}
|
|
109
100
|
{...iconButtonProps}
|
|
110
101
|
isDisabled={isDisabled}
|
|
111
102
|
icon={<Icon as={AngleLeft} {...iconProps} color={isDisabled ? 'disabled' : 'trueGray.600'} />}
|
|
@@ -122,8 +113,8 @@ export default function Pagination(props) {
|
|
|
122
113
|
<Text mr={2}>Page</Text>
|
|
123
114
|
<Input
|
|
124
115
|
{...testProps('pageInput')}
|
|
125
|
-
parent={self}
|
|
126
116
|
reference="pageInput"
|
|
117
|
+
parent={self}
|
|
127
118
|
keyboardType="numeric"
|
|
128
119
|
value={page?.toString()}
|
|
129
120
|
onChangeValue={(value) => Repository.setPage(value)}
|
|
@@ -139,9 +130,9 @@ export default function Pagination(props) {
|
|
|
139
130
|
isDisabled = page === totalPages || totalPages <= 1;
|
|
140
131
|
items.push(<IconButton
|
|
141
132
|
{...testProps('nextPageBtn')}
|
|
142
|
-
key="
|
|
143
|
-
parent={self}
|
|
133
|
+
key="nextPageBtn"
|
|
144
134
|
reference="nextPageBtn"
|
|
135
|
+
parent={self}
|
|
145
136
|
{...iconButtonProps}
|
|
146
137
|
isDisabled={isDisabled}
|
|
147
138
|
icon={<Icon as={AngleRight} {...iconProps} color={isDisabled ? 'disabled' : 'trueGray.600'} />}
|
|
@@ -150,9 +141,9 @@ export default function Pagination(props) {
|
|
|
150
141
|
/>);
|
|
151
142
|
items.push(<IconButton
|
|
152
143
|
{...testProps('lastPageBtn')}
|
|
153
|
-
key="
|
|
154
|
-
parent={self}
|
|
144
|
+
key="lastPageBtn"
|
|
155
145
|
reference="lastPageBtn"
|
|
146
|
+
parent={self}
|
|
156
147
|
{...iconButtonProps}
|
|
157
148
|
isDisabled={isDisabled}
|
|
158
149
|
icon={<Icon as={AnglesRight} {...iconProps} color={isDisabled ? 'disabled' : 'trueGray.600'} />}
|
|
@@ -162,21 +153,14 @@ export default function Pagination(props) {
|
|
|
162
153
|
}
|
|
163
154
|
|
|
164
155
|
if (!Repository.isLocal) {
|
|
165
|
-
items.push(<
|
|
166
|
-
{...testProps('reloadPageBtn')}
|
|
167
|
-
key="reload"
|
|
168
|
-
parent={self}
|
|
169
|
-
reference="reloadPageBtn"
|
|
170
|
-
{...iconButtonProps}
|
|
171
|
-
icon={<Icon as={Rotate} {...iconProps} color="trueGray.600" />}
|
|
172
|
-
onPress={() => Repository.reload()}
|
|
173
|
-
tooltip="Reload"
|
|
174
|
-
/>);
|
|
156
|
+
items.push(<ReloadPageButton key="reloadPageBtn" {...iconButtonProps} iconProps={iconProps} Repository={Repository} self={self} />);
|
|
175
157
|
}
|
|
176
158
|
if (showPagination && !minimize && !disablePageSize) {
|
|
177
159
|
items.push(<PageSizeCombo
|
|
178
160
|
{...testProps('pageSize')}
|
|
179
161
|
key="pageSize"
|
|
162
|
+
reference="pageSize"
|
|
163
|
+
parent={self}
|
|
180
164
|
pageSize={pageSize}
|
|
181
165
|
Repository={Repository}
|
|
182
166
|
/>);
|