foris 6.6.0 → 6.6.1-beta.bf0b2ce7
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/common/RichTable/RichTable.js +7 -12
- package/foris-6.6.1.tgz +0 -0
- package/form/components/SubmitButton.js +15 -12
- package/package.json +1 -1
- package/foris-6.6.0.tgz +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C) 2019-
|
|
2
|
+
* Copyright (C) 2019-2025 CZ.NIC z.s.p.o. (https://www.nic.cz/)
|
|
3
3
|
*
|
|
4
4
|
* This is free software, licensed under the GNU General Public License v3.
|
|
5
5
|
* See /LICENSE for more information.
|
|
@@ -20,22 +20,20 @@ import RichTableBody from "./RichTableBody";
|
|
|
20
20
|
import RichTableHeader from "./RichTableHeader";
|
|
21
21
|
import RichTablePagination from "./RichTablePagination";
|
|
22
22
|
|
|
23
|
-
const fallbackData = [];
|
|
24
|
-
|
|
25
23
|
RichTable.propTypes = {
|
|
26
24
|
/** Columns to be displayed in the table */
|
|
27
25
|
columns: PropTypes.array.isRequired,
|
|
28
|
-
/** Data to be displayed in the table */
|
|
26
|
+
/** Data to be displayed in the table, must be passed as a stable reference, for example, useState */
|
|
29
27
|
data: PropTypes.array.isRequired,
|
|
30
28
|
/** Whether to display pagination */
|
|
31
29
|
withPagination: PropTypes.bool,
|
|
32
|
-
/** Number of rows per page */
|
|
30
|
+
/** Number of rows per page, the default is 5 */
|
|
33
31
|
pageSize: PropTypes.number,
|
|
34
32
|
/** Index of the current page */
|
|
35
33
|
pageIndex: PropTypes.number,
|
|
36
34
|
};
|
|
37
35
|
|
|
38
|
-
function RichTable({
|
|
36
|
+
export default function RichTable({
|
|
39
37
|
columns,
|
|
40
38
|
data,
|
|
41
39
|
withPagination,
|
|
@@ -43,7 +41,6 @@ function RichTable({
|
|
|
43
41
|
pageIndex = 0,
|
|
44
42
|
}) {
|
|
45
43
|
const tableColumns = useMemo(() => columns, [columns]);
|
|
46
|
-
const [tableData] = useState(data ?? fallbackData);
|
|
47
44
|
const [sorting, setSorting] = useState([]);
|
|
48
45
|
const [pagination, setPagination] = useState({
|
|
49
46
|
pageIndex,
|
|
@@ -51,7 +48,7 @@ function RichTable({
|
|
|
51
48
|
});
|
|
52
49
|
|
|
53
50
|
const table = useReactTable({
|
|
54
|
-
data
|
|
51
|
+
data,
|
|
55
52
|
columns: tableColumns,
|
|
56
53
|
getCoreRowModel: getCoreRowModel(),
|
|
57
54
|
getSortedRowModel: getSortedRowModel(),
|
|
@@ -64,7 +61,7 @@ function RichTable({
|
|
|
64
61
|
},
|
|
65
62
|
});
|
|
66
63
|
|
|
67
|
-
const paginationIsNeeded =
|
|
64
|
+
const paginationIsNeeded = data.length > pageSize && withPagination;
|
|
68
65
|
|
|
69
66
|
return (
|
|
70
67
|
<div className="table-responsive">
|
|
@@ -76,11 +73,9 @@ function RichTable({
|
|
|
76
73
|
<RichTablePagination
|
|
77
74
|
table={table}
|
|
78
75
|
tablePageSize={pageSize}
|
|
79
|
-
allRows={
|
|
76
|
+
allRows={data.length}
|
|
80
77
|
/>
|
|
81
78
|
)}
|
|
82
79
|
</div>
|
|
83
80
|
);
|
|
84
81
|
}
|
|
85
|
-
|
|
86
|
-
export default RichTable;
|
package/foris-6.6.1.tgz
ADDED
|
Binary file
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C) 2019 CZ.NIC z.s.p.o. (
|
|
2
|
+
* Copyright (C) 2019-2025 CZ.NIC z.s.p.o. (https://www.nic.cz/)
|
|
3
3
|
*
|
|
4
4
|
* This is free software, licensed under the GNU General Public License v3.
|
|
5
5
|
* See /LICENSE for more information.
|
|
@@ -20,22 +20,25 @@ export const STATES = {
|
|
|
20
20
|
SubmitButton.propTypes = {
|
|
21
21
|
disabled: PropTypes.bool,
|
|
22
22
|
state: PropTypes.oneOf(Object.keys(STATES).map((key) => STATES[key])),
|
|
23
|
+
label: PropTypes.string,
|
|
23
24
|
};
|
|
24
25
|
|
|
25
|
-
export function SubmitButton({ disabled, state, ...props }) {
|
|
26
|
+
export function SubmitButton({ disabled, state, label, ...props }) {
|
|
26
27
|
const disableSubmitButton = disabled || state !== STATES.READY;
|
|
27
28
|
const loadingSubmitButton = state !== STATES.READY;
|
|
28
29
|
|
|
29
|
-
let labelSubmitButton;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
let labelSubmitButton = label;
|
|
31
|
+
if (!labelSubmitButton) {
|
|
32
|
+
switch (state) {
|
|
33
|
+
case STATES.SAVING:
|
|
34
|
+
labelSubmitButton = _("Updating");
|
|
35
|
+
break;
|
|
36
|
+
case STATES.LOAD:
|
|
37
|
+
labelSubmitButton = _("Load settings");
|
|
38
|
+
break;
|
|
39
|
+
default:
|
|
40
|
+
labelSubmitButton = _("Save");
|
|
41
|
+
}
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
return (
|
package/package.json
CHANGED
package/foris-6.6.0.tgz
DELETED
|
Binary file
|