@bloom-housing/ui-components 6.0.1-alpha.0 → 6.0.1-alpha.1
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/CHANGELOG.md +24 -0
- package/index.ts +1 -0
- package/package.json +2 -2
- package/src/global/vendor/ag_grid.scss +43 -9
- package/src/headers/PageHeader.scss +2 -1
- package/src/navigation/Breadcrumbs.scss +1 -0
- package/src/navigation/SideNav.scss +56 -0
- package/src/navigation/SideNav.tsx +2 -2
- package/src/navigation/Tabs.scss +25 -6
- package/src/page_components/NavigationHeader.tsx +10 -10
- package/src/tables/AgTable.tsx +46 -22
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [6.0.1-alpha.1](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@6.0.1-alpha.0...@bloom-housing/ui-components@6.0.1-alpha.1) (2022-09-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add duplicates v2 feature ([11cd2b3](https://github.com/bloom-housing/bloom/commit/11cd2b3b4d39c69e10ca1c9a8c2c7199b4a08b6b)), closes [#3006](https://github.com/bloom-housing/bloom/issues/3006) [#2961](https://github.com/bloom-housing/bloom/issues/2961) [#3020](https://github.com/bloom-housing/bloom/issues/3020) [#3093](https://github.com/bloom-housing/bloom/issues/3093) [#2974](https://github.com/bloom-housing/bloom/issues/2974) [#2909](https://github.com/bloom-housing/bloom/issues/2909) [#2958](https://github.com/bloom-housing/bloom/issues/2958) [#2904](https://github.com/bloom-housing/bloom/issues/2904) [#2987](https://github.com/bloom-housing/bloom/issues/2987) [#2990](https://github.com/bloom-housing/bloom/issues/2990) [#2989](https://github.com/bloom-housing/bloom/issues/2989) [#2991](https://github.com/bloom-housing/bloom/issues/2991) [#2985](https://github.com/bloom-housing/bloom/issues/2985) [#2994](https://github.com/bloom-housing/bloom/issues/2994) [#2995](https://github.com/bloom-housing/bloom/issues/2995) [#2999](https://github.com/bloom-housing/bloom/issues/2999) [#2950](https://github.com/bloom-housing/bloom/issues/2950) [#2968](https://github.com/bloom-housing/bloom/issues/2968) [#2784](https://github.com/bloom-housing/bloom/issues/2784) [#2988](https://github.com/bloom-housing/bloom/issues/2988) [#3016](https://github.com/bloom-housing/bloom/issues/3016) [#3018](https://github.com/bloom-housing/bloom/issues/3018) [#3017](https://github.com/bloom-housing/bloom/issues/3017) [#3005](https://github.com/bloom-housing/bloom/issues/3005) [#3012](https://github.com/bloom-housing/bloom/issues/3012) [#3014](https://github.com/bloom-housing/bloom/issues/3014) [#3000](https://github.com/bloom-housing/bloom/issues/3000) [#3021](https://github.com/bloom-housing/bloom/issues/3021) [#3027](https://github.com/bloom-housing/bloom/issues/3027) [#3036](https://github.com/bloom-housing/bloom/issues/3036) [#3023](https://github.com/bloom-housing/bloom/issues/3023) [#3040](https://github.com/bloom-housing/bloom/issues/3040) [#3054](https://github.com/bloom-housing/bloom/issues/3054) [#3050](https://github.com/bloom-housing/bloom/issues/3050) [#483](https://github.com/bloom-housing/bloom/issues/483) [#3073](https://github.com/bloom-housing/bloom/issues/3073) [#3070](https://github.com/bloom-housing/bloom/issues/3070) [#3041](https://github.com/bloom-housing/bloom/issues/3041) [#3061](https://github.com/bloom-housing/bloom/issues/3061) [#3077](https://github.com/bloom-housing/bloom/issues/3077) [#3063](https://github.com/bloom-housing/bloom/issues/3063) [#3084](https://github.com/bloom-housing/bloom/issues/3084) [#3088](https://github.com/bloom-housing/bloom/issues/3088) [#2892](https://github.com/bloom-housing/bloom/issues/2892) [#3006](https://github.com/bloom-housing/bloom/issues/3006) [#2961](https://github.com/bloom-housing/bloom/issues/2961) [#3020](https://github.com/bloom-housing/bloom/issues/3020) [#3086](https://github.com/bloom-housing/bloom/issues/3086) [#3102](https://github.com/bloom-housing/bloom/issues/3102) [#3101](https://github.com/bloom-housing/bloom/issues/3101) [#3104](https://github.com/bloom-housing/bloom/issues/3104) [#3105](https://github.com/bloom-housing/bloom/issues/3105)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* The preference and program entities have been merged into a single entity called MultiselectQuestion
|
|
17
|
+
|
|
18
|
+
* chore(release): version
|
|
19
|
+
|
|
20
|
+
- @bloom-housing/backend-core@5.1.1-alpha.8
|
|
21
|
+
- @bloom-housing/shared-helpers@5.1.1-alpha.18
|
|
22
|
+
- @bloom-housing/partners@5.1.1-alpha.20
|
|
23
|
+
- @bloom-housing/public@5.1.1-alpha.18
|
|
24
|
+
- @bloom-housing/ui-components@5.1.1-alpha.11
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## [6.0.1-alpha.0](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@5.1.1-alpha.35...@bloom-housing/ui-components@6.0.1-alpha.0) (2022-09-28)
|
|
7
31
|
|
|
8
32
|
**Note:** Version bump only for package @bloom-housing/ui-components
|
package/index.ts
CHANGED
|
@@ -89,6 +89,7 @@ export * from "./src/navigation/ProgressNav"
|
|
|
89
89
|
export * from "./src/navigation/TabNav"
|
|
90
90
|
export * from "./src/navigation/Tabs"
|
|
91
91
|
export * from "./src/navigation/Breadcrumbs"
|
|
92
|
+
export * from "./src/navigation/SideNav"
|
|
92
93
|
|
|
93
94
|
/* Notifications */
|
|
94
95
|
export * from "./src/notifications/AlertBox"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloom-housing/ui-components",
|
|
3
|
-
"version": "6.0.1-alpha.
|
|
3
|
+
"version": "6.0.1-alpha.1",
|
|
4
4
|
"author": "Sean Albert <sean.albert@exygy.com>",
|
|
5
5
|
"description": "Shared user interface components for Bloom affordable housing system",
|
|
6
6
|
"homepage": "https://github.com/bloom-housing/bloom/tree/master/shared/ui-components",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"ts-jest": "^26.4.1",
|
|
111
111
|
"typesafe-actions": "^5.1.0"
|
|
112
112
|
},
|
|
113
|
-
"gitHead": "
|
|
113
|
+
"gitHead": "413ca224f8c49c4ae69e431cfabe26545fe54159"
|
|
114
114
|
}
|
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
)
|
|
12
12
|
);
|
|
13
13
|
|
|
14
|
+
--ag-selected-row-background-color: var(--bloom-color-primary-light);
|
|
15
|
+
|
|
16
|
+
a {
|
|
17
|
+
color: var(--bloom-color-primary-dark);
|
|
18
|
+
}
|
|
19
|
+
|
|
14
20
|
.ag-row {
|
|
15
21
|
height: ag-param(row-height);
|
|
16
22
|
}
|
|
@@ -72,6 +78,15 @@
|
|
|
72
78
|
@apply border-b-0;
|
|
73
79
|
}
|
|
74
80
|
|
|
81
|
+
.ag-pinned-right-header,
|
|
82
|
+
.ag-cell.ag-cell-first-right-pinned:not(.ag-cell-range-left):not(.ag-cell-range-single-cell) {
|
|
83
|
+
@apply border-gray-450;
|
|
84
|
+
@apply border-r-0;
|
|
85
|
+
@apply border-t-0;
|
|
86
|
+
@apply border-l-4;
|
|
87
|
+
@apply border-b-0;
|
|
88
|
+
}
|
|
89
|
+
|
|
75
90
|
.ag-row {
|
|
76
91
|
@apply border-t-0;
|
|
77
92
|
@apply border-l-0;
|
|
@@ -85,29 +100,48 @@
|
|
|
85
100
|
|
|
86
101
|
.ag-body-viewport {
|
|
87
102
|
::-webkit-scrollbar {
|
|
88
|
-
// -webkit-appearance: none;
|
|
89
103
|
height: 8px;
|
|
90
|
-
@apply bg-gray-600;
|
|
91
104
|
}
|
|
92
105
|
|
|
93
106
|
::-webkit-scrollbar-thumb {
|
|
94
107
|
border-radius: 8px;
|
|
95
|
-
@apply bg-gray-
|
|
108
|
+
@apply bg-gray-550;
|
|
96
109
|
}
|
|
110
|
+
}
|
|
97
111
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
box-shadow: inset 0 0 1px rgba(0, 0, 0, 0.7);
|
|
102
|
-
}
|
|
112
|
+
.ag-body-horizontal-scroll {
|
|
113
|
+
border-bottom: 1px solid var(--bloom-color-gray-500);
|
|
114
|
+
border-radius: var(--bloom-rounded-md);
|
|
103
115
|
}
|
|
104
116
|
|
|
105
117
|
.ag-root-wrapper {
|
|
106
118
|
@apply border-b-0;
|
|
107
119
|
@apply rounded-t-md;
|
|
108
|
-
@apply rounded-b-
|
|
120
|
+
@apply rounded-b-md;
|
|
109
121
|
overflow: visible;
|
|
110
122
|
}
|
|
123
|
+
|
|
124
|
+
.ag-layout-auto-height {
|
|
125
|
+
.ag-center-cols-container,
|
|
126
|
+
.ag-center-cols-clipper {
|
|
127
|
+
--table-min-height: 124px;
|
|
128
|
+
min-height: var(--table-min-height);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.ag-ltr {
|
|
133
|
+
.ag-selection-checkbox {
|
|
134
|
+
margin-right: var(--bloom-s6);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.ag-horizontal-right-spacer:not(.ag-scroller-corner) {
|
|
139
|
+
border: none;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.ag-horizontal-left-spacer:not(.ag-scroller-corner) {
|
|
143
|
+
border: none;
|
|
144
|
+
}
|
|
111
145
|
}
|
|
112
146
|
|
|
113
147
|
.data-pager {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
border-top: var(--bloom-border-1) solid var(--border-color);
|
|
16
16
|
color: var(--text-color);
|
|
17
17
|
|
|
18
|
-
@media (min-width: $screen-
|
|
18
|
+
@media (min-width: $screen-md) {
|
|
19
19
|
padding: var(--bloom-s10) 0;
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
.page-header__title {
|
|
48
48
|
text-align: center;
|
|
49
49
|
font-family: var(--text-font-family);
|
|
50
|
+
word-break: break-all;
|
|
50
51
|
|
|
51
52
|
@media (min-width: $screen-md) {
|
|
52
53
|
font-size: var(--title-font-size);
|
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
--selection-parent-accent: var(--bloom-color-gray-450);
|
|
9
9
|
--hover-link-color: var(--bloom-color-primary);
|
|
10
10
|
--hover-background-color: var(--bloom-color-primary-lighter);
|
|
11
|
+
--background-color: var(--bloom-color-white);
|
|
11
12
|
|
|
12
13
|
border: var(--border);
|
|
13
14
|
border-radius: var(--border-radius);
|
|
15
|
+
background-color: var(--background-color);
|
|
14
16
|
|
|
15
17
|
& > ul {
|
|
16
18
|
& > li:first-child > a {
|
|
@@ -70,3 +72,57 @@
|
|
|
70
72
|
padding-inline-start: calc(var(--current-padding-inline) + var(--current-padding-block));
|
|
71
73
|
}
|
|
72
74
|
}
|
|
75
|
+
|
|
76
|
+
.side-nav__horizontal {
|
|
77
|
+
display: flex;
|
|
78
|
+
|
|
79
|
+
ul {
|
|
80
|
+
width: 100%;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@media (min-width: $screen-sm) {
|
|
84
|
+
a {
|
|
85
|
+
&[aria-current]:not(:focus) {
|
|
86
|
+
box-shadow: inset 0px -3px 0px 0px var(--hover-link-color);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&.has-current-child:not(:focus) {
|
|
90
|
+
box-shadow: inset 0px 0px -3px 0px var(--selection-parent-accent);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
ul {
|
|
95
|
+
width: auto;
|
|
96
|
+
display: flex;
|
|
97
|
+
flex-direction: row;
|
|
98
|
+
@media (min-width: $screen-md) {
|
|
99
|
+
flex-direction: row;
|
|
100
|
+
}
|
|
101
|
+
@media (max-width: $screen-sm) {
|
|
102
|
+
flex-direction: column;
|
|
103
|
+
width: 100%;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
li:not(:last-child) {
|
|
108
|
+
border-right: var(--border);
|
|
109
|
+
border-bottom: 0px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
& > ul {
|
|
113
|
+
& > li:first-child > a {
|
|
114
|
+
border-bottom-left-radius: var(--border-radius);
|
|
115
|
+
border-bottom-right-radius: 0px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
& > li:last-child > a {
|
|
119
|
+
border-bottom-right-radius: var(--border-radius);
|
|
120
|
+
border-bottom-left-radius: 0px;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.side-nav__count {
|
|
127
|
+
margin-left: var(--bloom-s4);
|
|
128
|
+
}
|
|
@@ -11,8 +11,8 @@ export interface SideNavItemProps {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export interface SideNavProps {
|
|
14
|
-
navItems?: SideNavItemProps[]
|
|
15
14
|
className?: string
|
|
15
|
+
navItems?: SideNavItemProps[]
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
const ItemLabel = ({ item }: { item: SideNavItemProps }) => {
|
|
@@ -20,7 +20,7 @@ const ItemLabel = ({ item }: { item: SideNavItemProps }) => {
|
|
|
20
20
|
return (
|
|
21
21
|
<>
|
|
22
22
|
<span>{item.label}</span>
|
|
23
|
-
<span>{item.count}</span>
|
|
23
|
+
<span className={"side-nav__count"}>{item.count}</span>
|
|
24
24
|
</>
|
|
25
25
|
)
|
|
26
26
|
} else {
|
package/src/navigation/Tabs.scss
CHANGED
|
@@ -10,6 +10,29 @@
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
.tabs__horizontal {
|
|
14
|
+
ul {
|
|
15
|
+
@apply flex;
|
|
16
|
+
@apply flex-row;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.tabs__tab {
|
|
20
|
+
&:first-of-type {
|
|
21
|
+
@apply border-l;
|
|
22
|
+
@apply rounded-tl-lg;
|
|
23
|
+
@apply rounded-tr-lg;
|
|
24
|
+
@apply rounded-tr-none;
|
|
25
|
+
@apply rounded-bl-lg;
|
|
26
|
+
}
|
|
27
|
+
&:last-of-type {
|
|
28
|
+
@apply rounded-tr-lg;
|
|
29
|
+
@apply rounded-br-lg;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
border-bottom-color: var(--bloom-color-gray-450);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
13
36
|
.tabs__tab {
|
|
14
37
|
@apply bg-white;
|
|
15
38
|
@apply text-gray-800;
|
|
@@ -30,14 +53,10 @@
|
|
|
30
53
|
@apply border-l;
|
|
31
54
|
@apply rounded-tl-lg;
|
|
32
55
|
@apply rounded-tr-lg;
|
|
33
|
-
@
|
|
34
|
-
@apply rounded-tr-none;
|
|
35
|
-
}
|
|
56
|
+
@apply rounded-tr-none;
|
|
36
57
|
}
|
|
37
58
|
&:last-of-type {
|
|
38
|
-
@
|
|
39
|
-
@apply rounded-tr-lg;
|
|
40
|
-
}
|
|
59
|
+
@apply rounded-tr-lg;
|
|
41
60
|
}
|
|
42
61
|
&:hover {
|
|
43
62
|
border-bottom-color: map-get($tailwind-gray, 400);
|
|
@@ -17,12 +17,12 @@ type NavigationHeaderTabs = {
|
|
|
17
17
|
flagsQty?: number
|
|
18
18
|
listingLabel: string
|
|
19
19
|
applicationsLabel: string
|
|
20
|
-
flagsLabel: string
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
type NavigationHeaderTabsElement = {
|
|
24
23
|
label: string
|
|
25
24
|
path: string
|
|
25
|
+
activePaths: string[]
|
|
26
26
|
content: React.ReactNode | undefined
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -42,23 +42,23 @@ const NavigationHeader = ({
|
|
|
42
42
|
{
|
|
43
43
|
label: tabs?.listingLabel || "",
|
|
44
44
|
path: `/listings/${listingId}`,
|
|
45
|
+
activePaths: [`/listings/${listingId}`],
|
|
45
46
|
content: undefined,
|
|
46
47
|
},
|
|
47
48
|
{
|
|
48
49
|
label: tabs?.applicationsLabel || "",
|
|
49
50
|
path: `/listings/${listingId}/applications`,
|
|
51
|
+
activePaths: [
|
|
52
|
+
`/listings/${listingId}/applications`,
|
|
53
|
+
`/listings/${listingId}/applications/pending`,
|
|
54
|
+
`/listings/${listingId}/applications/pending?type=name_dob`,
|
|
55
|
+
`/listings/${listingId}/applications/pending?type=email`,
|
|
56
|
+
`/listings/${listingId}/applications/resolved`,
|
|
57
|
+
],
|
|
50
58
|
content: undefined,
|
|
51
59
|
},
|
|
52
60
|
]
|
|
53
61
|
|
|
54
|
-
if (process.env.showDuplicates && typeof tabs?.flagsQty === "number") {
|
|
55
|
-
elements.push({
|
|
56
|
-
label: tabs.flagsLabel,
|
|
57
|
-
path: `/listings/${listingId}/flags`,
|
|
58
|
-
content: <>{tabs.flagsQty}</>,
|
|
59
|
-
})
|
|
60
|
-
}
|
|
61
|
-
|
|
62
62
|
return elements
|
|
63
63
|
}, [tabs, listingId])
|
|
64
64
|
|
|
@@ -69,7 +69,7 @@ const NavigationHeader = ({
|
|
|
69
69
|
<TabNavItem
|
|
70
70
|
key={tab.path}
|
|
71
71
|
tagContent={tab?.content}
|
|
72
|
-
current={tab.
|
|
72
|
+
current={tab.activePaths.includes(currentPath)}
|
|
73
73
|
href={tab.path}
|
|
74
74
|
tagSize={AppearanceSizeType.small}
|
|
75
75
|
>
|
package/src/tables/AgTable.tsx
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import React, { useState, useCallback, useEffect, useRef } from "react"
|
|
2
2
|
import { useForm } from "react-hook-form"
|
|
3
3
|
import { AgGridReact } from "ag-grid-react"
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
GridOptions,
|
|
6
|
+
ColumnState,
|
|
7
|
+
ColumnApi,
|
|
8
|
+
ColDef,
|
|
9
|
+
ColGroupDef,
|
|
10
|
+
GridApi,
|
|
11
|
+
} from "ag-grid-community"
|
|
5
12
|
import { AgPagination, AG_PER_PAGE_OPTIONS } from "./AgPagination"
|
|
6
13
|
import { LoadingOverlay } from "../overlays/LoadingOverlay"
|
|
7
14
|
import { Field } from "../forms/Field"
|
|
@@ -15,11 +22,12 @@ export interface ColumnOrder {
|
|
|
15
22
|
}
|
|
16
23
|
|
|
17
24
|
export interface AgTableProps {
|
|
18
|
-
id: string
|
|
19
25
|
config: AgTableConfig
|
|
20
26
|
data: AgTableData
|
|
21
|
-
|
|
27
|
+
id: string
|
|
28
|
+
pagination?: AgTablePagination
|
|
22
29
|
search: AgTableSearch
|
|
30
|
+
selectConfig?: AgTableSelectConfig
|
|
23
31
|
sort?: AgTableSort
|
|
24
32
|
headerContent?: React.ReactNode
|
|
25
33
|
className?: string
|
|
@@ -36,11 +44,17 @@ export interface AgTablePagination {
|
|
|
36
44
|
setCurrentPage: React.Dispatch<React.SetStateAction<number>>
|
|
37
45
|
}
|
|
38
46
|
|
|
47
|
+
export interface AgTableSelectConfig {
|
|
48
|
+
setGridApi: React.Dispatch<React.SetStateAction<GridApi | null>>
|
|
49
|
+
updateSelectedValues: () => void
|
|
50
|
+
}
|
|
51
|
+
|
|
39
52
|
export interface AgTableConfig {
|
|
40
53
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
54
|
gridComponents?: { [p: string]: any }
|
|
42
55
|
columns: (ColDef | ColGroupDef)[]
|
|
43
56
|
totalItemsLabel: string
|
|
57
|
+
rowSelection?: boolean
|
|
44
58
|
}
|
|
45
59
|
|
|
46
60
|
export interface AgTableData {
|
|
@@ -53,6 +67,7 @@ export interface AgTableData {
|
|
|
53
67
|
|
|
54
68
|
export interface AgTableSearch {
|
|
55
69
|
setSearch: React.Dispatch<React.SetStateAction<string>>
|
|
70
|
+
showSearch?: boolean
|
|
56
71
|
}
|
|
57
72
|
|
|
58
73
|
export interface AgTableSort {
|
|
@@ -85,14 +100,15 @@ export const useAgTable = () => {
|
|
|
85
100
|
}
|
|
86
101
|
|
|
87
102
|
const AgTable = ({
|
|
88
|
-
id,
|
|
89
103
|
className,
|
|
104
|
+
config: { gridComponents, columns, totalItemsLabel, rowSelection },
|
|
105
|
+
data,
|
|
106
|
+
headerContent,
|
|
107
|
+
id,
|
|
108
|
+
selectConfig,
|
|
90
109
|
pagination,
|
|
91
|
-
search: { setSearch },
|
|
110
|
+
search: { setSearch, showSearch = true },
|
|
92
111
|
sort: { setSort } = {},
|
|
93
|
-
headerContent,
|
|
94
|
-
data,
|
|
95
|
-
config: { gridComponents, columns, totalItemsLabel },
|
|
96
112
|
strings,
|
|
97
113
|
}: AgTableProps) => {
|
|
98
114
|
// local storage key with column state
|
|
@@ -148,7 +164,7 @@ const AgTable = ({
|
|
|
148
164
|
const debounceFilter = useRef(
|
|
149
165
|
debounce((value: string) => {
|
|
150
166
|
setSearch(value)
|
|
151
|
-
pagination
|
|
167
|
+
pagination?.setCurrentPage(1)
|
|
152
168
|
}, 500)
|
|
153
169
|
)
|
|
154
170
|
useEffect(() => {
|
|
@@ -184,12 +200,15 @@ const AgTable = ({
|
|
|
184
200
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
185
201
|
const onGridReady = (params: any) => {
|
|
186
202
|
setGridColumnApi(params.columnApi)
|
|
203
|
+
if (selectConfig?.setGridApi) {
|
|
204
|
+
selectConfig.setGridApi(params.api)
|
|
205
|
+
}
|
|
187
206
|
}
|
|
188
207
|
|
|
189
208
|
return (
|
|
190
209
|
<div className={`ag-theme-alpine ag-theme-bloom ${className || ""}`}>
|
|
191
210
|
<div className="flex justify-between flex-col md:flex-row">
|
|
192
|
-
<div className=
|
|
211
|
+
<div className={`flex flex-wrap ${showSearch ? "mb-5" : "hidden"}`}>
|
|
193
212
|
<div className="md:mr-5 w-full md:w-56">
|
|
194
213
|
<Field
|
|
195
214
|
dataTestId="ag-search-input"
|
|
@@ -200,7 +219,7 @@ const AgTable = ({
|
|
|
200
219
|
placeholder={strings?.filter ?? t("t.filter")}
|
|
201
220
|
/>
|
|
202
221
|
</div>
|
|
203
|
-
<div className="w-full md:w-auto mt-2 mb-2 md:mb-0">
|
|
222
|
+
<div className="w-full md:w-auto mt-2 md:mt-0 mb-2 md:mb-0">
|
|
204
223
|
{!validSearch && (
|
|
205
224
|
<AlertBox type="notice">
|
|
206
225
|
{strings?.searchError ?? t("applications.table.searchError")}
|
|
@@ -211,8 +230,7 @@ const AgTable = ({
|
|
|
211
230
|
|
|
212
231
|
{headerContent}
|
|
213
232
|
</div>
|
|
214
|
-
|
|
215
|
-
<div className="applications-table mt-5">
|
|
233
|
+
<div className="applications-table">
|
|
216
234
|
<LoadingOverlay isLoading={data.loading}>
|
|
217
235
|
<div>
|
|
218
236
|
<AgGridReact
|
|
@@ -227,19 +245,25 @@ const AgTable = ({
|
|
|
227
245
|
suppressPaginationPanel={true}
|
|
228
246
|
paginationPageSize={AG_PER_PAGE_OPTIONS[0]}
|
|
229
247
|
suppressScrollOnNewData={true}
|
|
248
|
+
rowSelection={rowSelection ? "multiple" : undefined}
|
|
249
|
+
rowMultiSelectWithClick={rowSelection}
|
|
250
|
+
onRowDataChanged={selectConfig?.updateSelectedValues ?? undefined}
|
|
251
|
+
onFirstDataRendered={selectConfig?.updateSelectedValues ?? undefined}
|
|
230
252
|
></AgGridReact>
|
|
231
253
|
</div>
|
|
232
254
|
</LoadingOverlay>
|
|
233
255
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
256
|
+
{pagination && (
|
|
257
|
+
<AgPagination
|
|
258
|
+
totalItems={data.totalItems}
|
|
259
|
+
totalPages={data.totalPages}
|
|
260
|
+
currentPage={pagination.currentPage}
|
|
261
|
+
itemsPerPage={pagination.perPage}
|
|
262
|
+
quantityLabel={totalItemsLabel}
|
|
263
|
+
setCurrentPage={pagination.setCurrentPage}
|
|
264
|
+
setItemsPerPage={pagination.setPerPage}
|
|
265
|
+
/>
|
|
266
|
+
)}
|
|
243
267
|
</div>
|
|
244
268
|
</div>
|
|
245
269
|
)
|