@tsed/react-formio 1.9.9 → 1.10.3
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/dist/components/index.d.ts +1 -1
- package/dist/components/table/components/defaultCellHeader.component.d.ts +1 -1
- package/dist/components/table/index.d.ts +11 -0
- package/dist/components/table/table.component.d.ts +5 -2
- package/dist/index.js +50 -5
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +38 -6
- package/dist/index.modern.js.map +1 -1
- package/package.json +4 -4
- package/src/components/index.ts +1 -1
- package/src/components/table/components/defaultCellHeader.component.tsx +2 -3
- package/src/components/table/index.ts +11 -0
- package/src/components/table/table.component.tsx +22 -14
- package/dist/components/table/filters/numberRangeColumnFilter.component.d.ts +0 -0
- package/src/components/table/filters/numberRangeColumnFilter.component.tsx +0 -52
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/react-formio",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.modern.js",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"prettier": "prettier '{src,test}/**/*.{ts,tsx}' --write"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@tsed/redux-utils": "1.
|
|
16
|
+
"@tsed/redux-utils": "1.10.3",
|
|
17
17
|
"eventemitter2": "^6.4.3",
|
|
18
18
|
"prop-types": "^15.7.2"
|
|
19
19
|
},
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"tooltip.js": "^1.3.3"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@tsed/tailwind": "1.
|
|
32
|
-
"@tsed/tailwind-formio": "1.
|
|
31
|
+
"@tsed/tailwind": "1.10.3",
|
|
32
|
+
"@tsed/tailwind-formio": "1.10.3"
|
|
33
33
|
},
|
|
34
34
|
"repository": "https://github.com/TypedProject/tsed-formio",
|
|
35
35
|
"bugs": {
|
package/src/components/index.ts
CHANGED
|
@@ -19,6 +19,6 @@ export * from "./pagination/pagination.component";
|
|
|
19
19
|
export * from "./react-component/reactComponent.component";
|
|
20
20
|
export * from "./select/select.component";
|
|
21
21
|
export * from "./submissions-table/submissionsTable.component";
|
|
22
|
-
export * from "./table
|
|
22
|
+
export * from "./table";
|
|
23
23
|
export * from "./tabs/tabs.component";
|
|
24
24
|
export * from "./loader/loader.component";
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { HeaderGroup } from "react-table";
|
|
3
3
|
|
|
4
|
-
export interface DefaultCellHeaderProps<
|
|
5
|
-
|
|
6
|
-
> extends Record<string, unknown> {
|
|
4
|
+
export interface DefaultCellHeaderProps<Data extends object = any>
|
|
5
|
+
extends Record<string, unknown> {
|
|
7
6
|
column: HeaderGroup<Data>;
|
|
8
7
|
}
|
|
9
8
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./utils/useOperations.hook";
|
|
2
|
+
export * from "./components/cell.component";
|
|
3
|
+
export * from "./components/defaultArrowSort.component";
|
|
4
|
+
export * from "./components/defaultCellHeader.component";
|
|
5
|
+
export * from "./components/defaultCellHeader.component";
|
|
6
|
+
export * from "./components/defaultCellOperations.component";
|
|
7
|
+
export * from "./components/defaultOperationButton.component";
|
|
8
|
+
export * from "./filters/defaultColumnFilter.component";
|
|
9
|
+
export * from "./filters/selectColumnFilter.component";
|
|
10
|
+
export * from "./filters/sliderColumnFilter.component";
|
|
11
|
+
export * from "./table.component";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
import { DefaultColumnFilter } from "./filters/defaultColumnFilter.component";
|
|
23
23
|
import { useOperations } from "./utils/useOperations.hook";
|
|
24
24
|
|
|
25
|
-
export interface TableProps<Data extends
|
|
25
|
+
export interface TableProps<Data extends object = any>
|
|
26
26
|
extends TableOptions<Data>,
|
|
27
27
|
Partial<QueryOptions> {
|
|
28
28
|
className?: string;
|
|
@@ -82,6 +82,9 @@ export interface TableProps<Data extends Record<string, unknown> = {}>
|
|
|
82
82
|
* Disable pagination
|
|
83
83
|
*/
|
|
84
84
|
disablePagination?: boolean;
|
|
85
|
+
manualPagination?: boolean;
|
|
86
|
+
manualSortBy?: boolean;
|
|
87
|
+
manualFilters?: boolean;
|
|
85
88
|
/**
|
|
86
89
|
* Configuration operation for each line.
|
|
87
90
|
*/
|
|
@@ -116,7 +119,7 @@ function DefaultEmptyData() {
|
|
|
116
119
|
|
|
117
120
|
const hooks = [useFilters, useGroupBy, useSortBy, usePagination];
|
|
118
121
|
|
|
119
|
-
export function Table<Data extends
|
|
122
|
+
export function Table<Data extends object = any>(
|
|
120
123
|
props: PropsWithChildren<TableProps<Data>>
|
|
121
124
|
) {
|
|
122
125
|
const {
|
|
@@ -174,9 +177,12 @@ export function Table<Data extends Record<string, unknown>>(
|
|
|
174
177
|
pageSize: controlledPageSize || 10,
|
|
175
178
|
sortBy: controlledSortBy || []
|
|
176
179
|
} as any,
|
|
177
|
-
manualPagination:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
+
manualPagination:
|
|
181
|
+
props.manualPagination === undefined ? true : props.manualPagination,
|
|
182
|
+
manualSortBy:
|
|
183
|
+
props.manualSortBy === undefined ? true : props.manualPagination,
|
|
184
|
+
manualFilters:
|
|
185
|
+
props.manualFilters === undefined ? true : props.manualFilters,
|
|
180
186
|
disableFilters,
|
|
181
187
|
filterId,
|
|
182
188
|
setFilterId
|
|
@@ -251,15 +257,17 @@ export function Table<Data extends Record<string, unknown>>(
|
|
|
251
257
|
{isLoading ? <Loader /> : null}
|
|
252
258
|
{!data.length ? <EmptyData /> : null}
|
|
253
259
|
{!isLoading && data.length && !disablePagination ? (
|
|
254
|
-
<
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
260
|
+
<div className={"overflow-hidden"}>
|
|
261
|
+
<Pagination
|
|
262
|
+
{...tableInstance}
|
|
263
|
+
className={"text-sm"}
|
|
264
|
+
pageIndex={pageIndex}
|
|
265
|
+
pageSize={pageSize}
|
|
266
|
+
pageSizes={pageSizes}
|
|
267
|
+
setPageSize={setPageSize}
|
|
268
|
+
i18n={i18n}
|
|
269
|
+
/>
|
|
270
|
+
</div>
|
|
263
271
|
) : null}
|
|
264
272
|
{children}
|
|
265
273
|
</div>
|
|
File without changes
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// // This is a custom UI for our 'between' or number range
|
|
2
|
-
// // filter. It uses two number boxes and filters rows to
|
|
3
|
-
// // ones that have values between the two
|
|
4
|
-
// import React from 'react'
|
|
5
|
-
//
|
|
6
|
-
// export function NumberRangeColumnFilter ({ column: { filterValue = [], preFilteredRows, setFilter, id } }) {
|
|
7
|
-
// const [min, max] = React.useMemo(() => {
|
|
8
|
-
// let min = preFilteredRows.length ? preFilteredRows[0].values[id] : 0
|
|
9
|
-
// let max = preFilteredRows.length ? preFilteredRows[0].values[id] : 0
|
|
10
|
-
// preFilteredRows.forEach(row => {
|
|
11
|
-
// min = Math.min(row.values[id], min)
|
|
12
|
-
// max = Math.max(row.values[id], max)
|
|
13
|
-
// })
|
|
14
|
-
// return [min, max]
|
|
15
|
-
// }, [id, preFilteredRows])
|
|
16
|
-
//
|
|
17
|
-
// return (
|
|
18
|
-
// <div
|
|
19
|
-
// style={{
|
|
20
|
-
// display: 'flex'
|
|
21
|
-
// }}
|
|
22
|
-
// >
|
|
23
|
-
// <input
|
|
24
|
-
// value={filterValue[0] || ''}
|
|
25
|
-
// type="number"
|
|
26
|
-
// onChange={e => {
|
|
27
|
-
// const val = e.target.value
|
|
28
|
-
// setFilter((old = []) => [val ? parseInt(val, 10) : undefined, old[1]])
|
|
29
|
-
// }}
|
|
30
|
-
// placeholder={`Min (${min})`}
|
|
31
|
-
// style={{
|
|
32
|
-
// width: '70px',
|
|
33
|
-
// marginRight: '0.5rem'
|
|
34
|
-
// }}
|
|
35
|
-
// />
|
|
36
|
-
// to
|
|
37
|
-
// <input
|
|
38
|
-
// value={filterValue[1] || ''}
|
|
39
|
-
// type="number"
|
|
40
|
-
// onChange={e => {
|
|
41
|
-
// const val = e.target.value
|
|
42
|
-
// setFilter((old = []) => [old[0], val ? parseInt(val, 10) : undefined])
|
|
43
|
-
// }}
|
|
44
|
-
// placeholder={`Max (${max})`}
|
|
45
|
-
// style={{
|
|
46
|
-
// width: '70px',
|
|
47
|
-
// marginLeft: '0.5rem'
|
|
48
|
-
// }}
|
|
49
|
-
// />
|
|
50
|
-
// </div>
|
|
51
|
-
// )
|
|
52
|
-
// }
|