kelt-ui-kit-react 2.0.3 → 2.0.4
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/README.md +26 -0
- package/dist/addressSearch/AddressSearch.d.ts +20 -0
- package/dist/addressSearch/AddressSearch.view.d.ts +1 -0
- package/dist/badge/Badge.d.ts +1 -3
- package/dist/button/Button.d.ts +1 -1
- package/dist/button/button.interface.d.ts +2 -1
- package/dist/card/Card.d.ts +4 -1
- package/dist/dataTable/DataTable.d.ts +14 -17
- package/dist/dataTable/dataTable.interface.d.ts +19 -24
- package/dist/dataTable/dataTableActions/DataTableAction.d.ts +5 -3
- package/dist/dataTable/dataTableColumn/DataTableColumn.d.ts +7 -13
- package/dist/dataTable/dataTableLoading/DataTableLoading.d.ts +3 -1
- package/dist/dataTable/dataTableRow/DataTableRow.d.ts +6 -5
- package/dist/expands/Expands.d.ts +1 -0
- package/dist/expands/expand/expand.d.ts +3 -2
- package/dist/form/Form.d.ts +10 -2
- package/dist/form/form.enum.d.ts +3 -2
- package/dist/form/form.interface.d.ts +22 -3
- package/dist/form/input/Input.d.ts +0 -3
- package/dist/form/inputNumber/InputNumber.d.ts +2 -0
- package/dist/geocoding/GeocodingService.d.ts +13 -0
- package/dist/geocoding/geocoding.interface.d.ts +20 -0
- package/dist/grid/Grid.d.ts +5 -2
- package/dist/grid/col/Col.d.ts +3 -6
- package/dist/grid/col/colStyled/ColStyled.d.ts +8 -5
- package/dist/grid/grid.interface.d.ts +20 -5
- package/dist/grid/row/Row.d.ts +7 -0
- package/dist/header/Header.d.ts +1 -1
- package/dist/header/header.interface.d.ts +2 -1
- package/dist/icon/Icon.d.ts +1 -1
- package/dist/icon/icon.interface.d.ts +0 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +3724 -3628
- package/dist/menus/menu/Menu.d.ts +1 -0
- package/dist/select/Select.d.ts +2 -1
- package/dist/style.css +1 -1
- package/dist/tabs/Tabs.d.ts +1 -2
- package/dist/toaster/store/useToasterStore.d.ts +1 -0
- package/index.html +1 -2
- package/package.json +1 -1
- package/src/App.menu.tsx +8 -0
- package/src/addressSearch/AddressSearch.tsx +246 -0
- package/src/addressSearch/AddressSearch.view.tsx +52 -0
- package/src/addressSearch/addressSearch.css +133 -0
- package/src/badge/Badge.tsx +1 -9
- package/src/badge/badge.css +0 -4
- package/src/button/Button.tsx +3 -1
- package/src/button/button.css +2 -2
- package/src/button/button.interface.tsx +2 -1
- package/src/card/Card.tsx +37 -11
- package/src/card/card.css +7 -28
- package/src/card/cardAction/CardAction.tsx +4 -4
- package/src/damier/Damier.tsx +16 -7
- package/src/damier/damier.css +11 -4
- package/src/dataTable/DataTable.tsx +542 -685
- package/src/dataTable/DataTable.view.tsx +24 -48
- package/src/dataTable/dataTable.css +159 -134
- package/src/dataTable/dataTable.interface.ts +19 -25
- package/src/dataTable/dataTableActions/DataTableAction.tsx +25 -14
- package/src/dataTable/dataTableColumn/DataTableColumn.tsx +14 -64
- package/src/dataTable/dataTableLoading/DataTableLoading.tsx +15 -4
- package/src/dataTable/dataTableRow/DataTableRow.tsx +180 -64
- package/src/expands/Expands.tsx +18 -2
- package/src/expands/expand/expand.tsx +128 -5
- package/src/expands/expands.css +8 -3
- package/src/form/Form.tsx +294 -99
- package/src/form/Form.view.tsx +9 -1
- package/src/form/form.css +64 -1
- package/src/form/form.enum.ts +2 -1
- package/src/form/form.interface.tsx +31 -3
- package/src/form/input/Input.tsx +7 -61
- package/src/form/input/input.css +1 -19
- package/src/form/inputNumber/InputNumber.tsx +11 -6
- package/src/form/inputPrice/InputPrice.tsx +4 -2
- package/src/geocoding/GeocodingService.ts +89 -0
- package/src/geocoding/geocoding.interface.ts +25 -0
- package/src/grid/Grid.tsx +34 -21
- package/src/grid/col/Col.tsx +24 -15
- package/src/grid/col/col.css +3 -0
- package/src/grid/col/colStyled/ColStyled.tsx +59 -41
- package/src/grid/container/container.css +2 -2
- package/src/grid/grid.interface.tsx +25 -5
- package/src/grid/row/Row.tsx +49 -12
- package/src/grid/row/row.css +11 -3
- package/src/header/Header.tsx +4 -2
- package/src/header/header.css +17 -0
- package/src/header/header.interface.tsx +2 -1
- package/src/icon/Icon.tsx +2 -6
- package/src/icon/icon.interface.tsx +0 -1
- package/src/index.css +58 -12
- package/src/index.ts +12 -2
- package/src/menus/Menus.tsx +1 -0
- package/src/menus/menu/Menu.tsx +2 -1
- package/src/select/Select.tsx +5 -3
- package/src/sidebar/Sidebar.tsx +107 -5
- package/src/sidebar/sidebar.css +18 -1
- package/src/tabs/Tabs.tsx +1 -20
- package/src/tabs/tabs.css +9 -3
- package/src/toaster/Toaster.tsx +7 -2
- package/src/toaster/Toaster.view.tsx +1 -0
- package/src/toaster/store/useToasterStore.tsx +2 -0
- package/src/toaster/toaster.css +7 -2
- package/dist/_core/type/generiqueType.d.ts +0 -4
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/DataTableColumnFilter.d.ts +0 -10
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterDate/DataTableColumnFilterDate.d.ts +0 -9
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterDateRange/dataTableColumnFilterDateRange.d.ts +0 -9
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterEnum/DataTableColumnFilterEnum.d.ts +0 -13
- package/dist/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterString/DataTableColumnFilterString.d.ts +0 -9
- package/dist/dataTable/dataTableColumn/dataTableColumnSort/DataTableColumnSort.d.ts +0 -11
- package/dist/dataTable/dataTableFilters/DataTableFilters.d.ts +0 -7
- package/dist/dataTable/dataTableRow/dataTableRowOverlay/DataTableRowOverlay.d.ts +0 -12
- package/dist/dataTable/dataTableRow/dataTableRowValue/DataTableRowValue.d.ts +0 -11
- package/package/package.json +0 -56
- package/package/src/sidebar/Sidebar.tsx +0 -208
- package/package/src/sidebar/sidebar.css +0 -104
- package/src/_core/type/generiqueType.tsx +0 -4
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/DataTableColumnFilter.tsx +0 -36
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilter.css +0 -0
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterDate/DataTableColumnFilterDate.tsx +0 -39
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterDateRange/dataTableColumnFilterDateRange.tsx +0 -80
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterEnum/DataTableColumnFilterEnum.tsx +0 -89
- package/src/dataTable/dataTableColumn/dataTableColumnFilter/dataTableColumnFilterString/DataTableColumnFilterString.tsx +0 -37
- package/src/dataTable/dataTableColumn/dataTableColumnSort/DataTableColumnSort.tsx +0 -42
- package/src/dataTable/dataTableFilters/DataTableFilters.tsx +0 -91
- package/src/dataTable/dataTableFilters/dataTableFilters.css +0 -16
- package/src/dataTable/dataTableRow/dataTableRowOverlay/DataTableRowOverlay.tsx +0 -80
- package/src/dataTable/dataTableRow/dataTableRowValue/DataTableRowValue.tsx +0 -123
|
@@ -1,53 +1,37 @@
|
|
|
1
|
-
import { useMemo
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
DataTableActionsInterface,
|
|
6
|
-
DataTableColumnsInterface,
|
|
7
|
-
} from "./dataTable.interface";
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { DataTable } from "./DataTable";
|
|
3
|
+
import { dataTableActionsInterface } from "./dataTable.interface";
|
|
8
4
|
|
|
9
5
|
export const DataTableView = () => {
|
|
10
|
-
const dataTableColumns
|
|
6
|
+
const dataTableColumns = useMemo(() => {
|
|
11
7
|
return [
|
|
12
|
-
{
|
|
13
|
-
id: "id",
|
|
14
|
-
label: "ID",
|
|
15
|
-
minWidth: 50,
|
|
16
|
-
type: "number",
|
|
17
|
-
filterable: true,
|
|
18
|
-
filterType: TypeInputEnum.CHECKBOX,
|
|
19
|
-
filterDataEnum: [
|
|
20
|
-
{ label: "1", value: "1" },
|
|
21
|
-
{ label: "2", value: "2" },
|
|
22
|
-
{ label: "3", value: "3" },
|
|
23
|
-
],
|
|
24
|
-
},
|
|
8
|
+
{ id: "id", label: "ID", minWidth: 50, type: "number" },
|
|
25
9
|
{
|
|
26
10
|
id: "name",
|
|
27
11
|
label: "Name",
|
|
28
|
-
field: "name",
|
|
29
12
|
minWidth: 100,
|
|
30
|
-
|
|
13
|
+
editable: true,
|
|
14
|
+
enterToNextColumn: true,
|
|
31
15
|
type: "text",
|
|
32
|
-
displayOverlay: true,
|
|
33
|
-
openClickCell: true,
|
|
34
|
-
filterType: TypeInputEnum.TEXT,
|
|
35
|
-
filterDataEnum: [
|
|
36
|
-
{ label: "John Doe", value: "John Doe" },
|
|
37
|
-
{ label: "Jane Smith", value: "Jane Smith" },
|
|
38
|
-
{ label: "Alice Johnson", value: "Alice Johnson" },
|
|
39
|
-
],
|
|
40
16
|
},
|
|
41
|
-
{
|
|
17
|
+
{
|
|
18
|
+
id: "age",
|
|
19
|
+
label: "Age",
|
|
20
|
+
minWidth: 50,
|
|
21
|
+
editable: true,
|
|
22
|
+
enterToNextColumn: true,
|
|
23
|
+
type: "number",
|
|
24
|
+
},
|
|
42
25
|
];
|
|
43
26
|
}, []);
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
27
|
+
const data = useMemo(() => {
|
|
28
|
+
return [
|
|
29
|
+
{ id: 1, name: "John Doe", age: 28 },
|
|
30
|
+
{ id: 2, name: "Jane Smith", age: 34 },
|
|
31
|
+
{ id: 3, name: "Alice Johnson", age: 45 },
|
|
32
|
+
];
|
|
33
|
+
}, []);
|
|
34
|
+
const actions: dataTableActionsInterface<{
|
|
51
35
|
id: number;
|
|
52
36
|
name: string;
|
|
53
37
|
age: number;
|
|
@@ -71,22 +55,14 @@ export const DataTableView = () => {
|
|
|
71
55
|
},
|
|
72
56
|
];
|
|
73
57
|
}, []);
|
|
74
|
-
const onFiltersChange = (filters: DataTableFilterState) => {
|
|
75
|
-
console.log("Filters changed: ", filters);
|
|
76
|
-
};
|
|
77
58
|
return (
|
|
78
59
|
<DataTable
|
|
79
60
|
data={data}
|
|
80
61
|
actions={actions}
|
|
81
62
|
columns={dataTableColumns}
|
|
82
|
-
onFiltersChange={onFiltersChange}
|
|
83
|
-
onEditColumnByOverlay={(newRow) => {
|
|
84
|
-
setData((prevData) =>
|
|
85
|
-
prevData.map((row) => (row.id === newRow.id ? newRow : row)),
|
|
86
|
-
);
|
|
87
|
-
}}
|
|
88
63
|
id="datatable-example"
|
|
89
64
|
name={"DataTable"}
|
|
65
|
+
mobileCardView
|
|
90
66
|
onSelectionChange={(selectedRows) => {
|
|
91
67
|
console.log("Selected Rows: ", selectedRows);
|
|
92
68
|
}}
|
|
@@ -1,25 +1,110 @@
|
|
|
1
|
+
.data-table-footer-action {
|
|
2
|
+
position: fixed;
|
|
3
|
+
left: 5px;
|
|
4
|
+
right: 5px;
|
|
5
|
+
bottom: 5px;
|
|
6
|
+
border-radius: 4px;
|
|
7
|
+
z-index: 1000;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
background: #fff;
|
|
10
|
+
border-top: 1px solid #e5e5e5;
|
|
11
|
+
box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.18);
|
|
12
|
+
animation: data-table-footer-action-enter 180ms ease-out;
|
|
13
|
+
|
|
14
|
+
& .data-table-footer-action__content {
|
|
15
|
+
position: relative;
|
|
16
|
+
padding: 0.75rem 1rem;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
& .data-table-footer-action__close {
|
|
20
|
+
position: absolute;
|
|
21
|
+
top: 5px;
|
|
22
|
+
right: 5px;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
|
|
25
|
+
.bi {
|
|
26
|
+
color: #333;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@keyframes data-table-footer-action-enter {
|
|
35
|
+
from {
|
|
36
|
+
opacity: 0;
|
|
37
|
+
transform: translateY(100%);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
to {
|
|
41
|
+
opacity: 1;
|
|
42
|
+
transform: translateY(0);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
1
46
|
.data-table-container {
|
|
2
47
|
overflow: auto;
|
|
48
|
+
position: relative;
|
|
49
|
+
|
|
50
|
+
.data-table-mobile-cards {
|
|
51
|
+
display: grid;
|
|
52
|
+
gap: 0.75rem;
|
|
53
|
+
|
|
54
|
+
.data-table-mobile-card {
|
|
55
|
+
width: 100%;
|
|
56
|
+
max-width: none;
|
|
57
|
+
height: auto;
|
|
58
|
+
padding: 0;
|
|
59
|
+
border-radius: 8px;
|
|
60
|
+
}
|
|
3
61
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
62
|
+
.data-table-mobile-card__content {
|
|
63
|
+
width: 100%;
|
|
64
|
+
min-width: 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.data-table-mobile-card__field {
|
|
68
|
+
display: grid;
|
|
69
|
+
grid-template-columns: minmax(90px, 35%) minmax(0, 1fr);
|
|
70
|
+
gap: 0.75rem;
|
|
71
|
+
align-items: center;
|
|
72
|
+
padding: 0.625rem 0.75rem;
|
|
73
|
+
border-bottom: 1px solid #e5e5e5;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.data-table-mobile-card__label {
|
|
77
|
+
color: var(--tertiary-color);
|
|
78
|
+
font-size: 0.875rem;
|
|
79
|
+
font-weight: 600;
|
|
80
|
+
overflow-wrap: anywhere;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.data-table-mobile-card__actions {
|
|
84
|
+
display: flex;
|
|
85
|
+
gap: 0.5rem;
|
|
86
|
+
align-items: center;
|
|
87
|
+
justify-content: flex-end;
|
|
88
|
+
padding: 0.75rem;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.data-table-mobile-cards__empty {
|
|
92
|
+
padding: 1rem;
|
|
93
|
+
text-align: center;
|
|
94
|
+
color: #666;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&.data-table-container--with-footer-action {
|
|
99
|
+
scroll-padding-bottom: 80px;
|
|
11
100
|
}
|
|
12
101
|
|
|
13
102
|
.data-table {
|
|
14
103
|
width: 100%;
|
|
15
|
-
border-spacing:
|
|
16
|
-
font-size:
|
|
104
|
+
border-spacing: 0;
|
|
105
|
+
font-size: 16px;
|
|
17
106
|
color: #333;
|
|
18
107
|
|
|
19
|
-
/* .data-table-sticky-cell {
|
|
20
|
-
box-shadow: 2px 0 0 #f1f3f8;
|
|
21
|
-
} */
|
|
22
|
-
|
|
23
108
|
.select-cell {
|
|
24
109
|
min-width: 40px !important;
|
|
25
110
|
|
|
@@ -34,150 +119,90 @@
|
|
|
34
119
|
}
|
|
35
120
|
}
|
|
36
121
|
|
|
122
|
+
|
|
37
123
|
thead {
|
|
38
124
|
margin-bottom: 1rem;
|
|
39
|
-
|
|
125
|
+
position: sticky;
|
|
126
|
+
top: 0;
|
|
127
|
+
z-index: 1;
|
|
128
|
+
background-color: #fff;
|
|
40
129
|
|
|
41
130
|
th {
|
|
42
|
-
|
|
131
|
+
position: sticky;
|
|
132
|
+
top: 0;
|
|
133
|
+
z-index: 2;
|
|
134
|
+
background-color: #fff;
|
|
135
|
+
color: var(--tertiary-color);
|
|
43
136
|
min-width: 100px;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
background-clip: padding-box;
|
|
48
|
-
|
|
49
|
-
.data-table-column-sort {
|
|
50
|
-
.bi-arrow-down-up {
|
|
51
|
-
font-size: 1rem;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.data-table-column-filter {
|
|
56
|
-
visibility: hidden;
|
|
57
|
-
margin-left: 4px;
|
|
58
|
-
|
|
59
|
-
&.active {
|
|
60
|
-
visibility: visible;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.data-table-column-filter-active {
|
|
64
|
-
color: var(--tertiary-color);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.data-table-column-sort {
|
|
69
|
-
visibility: hidden;
|
|
70
|
-
margin-left: 4px;
|
|
71
|
-
|
|
72
|
-
&.active {
|
|
73
|
-
visibility: visible;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.data-table-column-sort-active {
|
|
77
|
-
color: var(--tertiary-color);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
137
|
+
padding: .5rem;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
80
140
|
|
|
81
|
-
|
|
82
|
-
|
|
141
|
+
tbody {
|
|
142
|
+
td {
|
|
143
|
+
padding: 0.5rem;
|
|
83
144
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
visibility: visible;
|
|
87
|
-
}
|
|
145
|
+
&:not(:first-child) {
|
|
146
|
+
padding-left: 0 !important;
|
|
88
147
|
}
|
|
89
148
|
}
|
|
90
149
|
|
|
91
|
-
.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
padding-bottom: 6px;
|
|
95
|
-
overflow: visible;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.data-table-filter-select {
|
|
99
|
-
width: 100%;
|
|
100
|
-
max-width: 100%;
|
|
101
|
-
|
|
102
|
-
button {
|
|
103
|
-
width: 100%;
|
|
104
|
-
max-width: 100%;
|
|
105
|
-
overflow: hidden;
|
|
106
|
-
padding: 4px 6px;
|
|
107
|
-
border: 1px solid #dedede;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.select-container-value {
|
|
111
|
-
display: block;
|
|
112
|
-
min-width: 0;
|
|
113
|
-
overflow: hidden;
|
|
114
|
-
text-overflow: ellipsis;
|
|
115
|
-
white-space: nowrap;
|
|
116
|
-
font-size: 0.7rem;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
150
|
+
tr.even {
|
|
151
|
+
background-color: #ffffff;
|
|
152
|
+
}
|
|
119
153
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
overflow: visible;
|
|
124
|
-
box-sizing: border-box;
|
|
154
|
+
tr.odd {
|
|
155
|
+
background-color: #f5f5f5;
|
|
156
|
+
}
|
|
125
157
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
158
|
+
.data-table-input-number-wrapper {
|
|
159
|
+
display: inline-flex;
|
|
160
|
+
align-items: center;
|
|
161
|
+
gap: 4px;
|
|
162
|
+
|
|
163
|
+
button.data-table-step-btn {
|
|
164
|
+
min-width: 28px !important;
|
|
165
|
+
width: 28px !important;
|
|
166
|
+
height: 28px !important;
|
|
167
|
+
max-height: 28px !important;
|
|
168
|
+
padding: 0 !important;
|
|
169
|
+
display: inline-flex !important;
|
|
170
|
+
align-items: center !important;
|
|
171
|
+
justify-content: center !important;
|
|
172
|
+
border-radius: 4px;
|
|
173
|
+
border: 1px solid #dcdcdc;
|
|
174
|
+
background-color: #f8f9fa;
|
|
175
|
+
color: #333;
|
|
176
|
+
font-size: 16px;
|
|
177
|
+
line-height: 1;
|
|
178
|
+
cursor: pointer;
|
|
179
|
+
transition: background-color 0.15s, border-color 0.15s;
|
|
129
180
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
181
|
+
&:hover:not(:disabled) {
|
|
182
|
+
background-color: #e9ecef;
|
|
183
|
+
border-color: #adb5bd;
|
|
133
184
|
}
|
|
134
185
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
width: 100%;
|
|
186
|
+
&:active:not(:disabled) {
|
|
187
|
+
background-color: #dee2e6;
|
|
138
188
|
}
|
|
139
189
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
190
|
+
&:disabled {
|
|
191
|
+
opacity: 0.4;
|
|
192
|
+
cursor: not-allowed;
|
|
193
|
+
background-color: #f8f9fa;
|
|
143
194
|
}
|
|
144
195
|
|
|
145
|
-
.
|
|
146
|
-
|
|
147
|
-
|
|
196
|
+
.bi {
|
|
197
|
+
font-size: 13px;
|
|
198
|
+
line-height: 1;
|
|
148
199
|
}
|
|
149
200
|
}
|
|
150
201
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
max-width: 100%;
|
|
154
|
-
min-width: 0;
|
|
155
|
-
box-sizing: border-box;
|
|
156
|
-
overflow: hidden;
|
|
157
|
-
text-overflow: ellipsis;
|
|
158
|
-
white-space: nowrap;
|
|
159
|
-
border: 1px solid #c9cfdb;
|
|
160
|
-
border-radius: 6px;
|
|
161
|
-
padding: 4px 6px;
|
|
162
|
-
font-size: 12px;
|
|
163
|
-
background-color: #fff;
|
|
164
|
-
color: #333;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
.data-table-header-row {
|
|
169
|
-
th {
|
|
170
|
-
position: sticky;
|
|
171
|
-
top: 0;
|
|
172
|
-
z-index: 12;
|
|
173
|
-
background-color: #f9fbfc;
|
|
202
|
+
input {
|
|
203
|
+
margin: 0;
|
|
174
204
|
}
|
|
175
205
|
}
|
|
176
206
|
}
|
|
177
207
|
}
|
|
178
|
-
}
|
|
179
|
-
.data-table-action-icon {
|
|
180
|
-
cursor: pointer;
|
|
181
|
-
display: flex;
|
|
182
|
-
align-items: center;
|
|
183
|
-
}
|
|
208
|
+
}
|
|
@@ -1,51 +1,45 @@
|
|
|
1
1
|
import { HTMLInputTypeAttribute } from "react";
|
|
2
|
-
import { EnumerableType } from "../_core/type/generiqueType";
|
|
3
|
-
import { TypeInputEnum } from "../form/form.enum";
|
|
4
2
|
|
|
5
|
-
export interface
|
|
3
|
+
export interface dataTableColumnsInterface<T> {
|
|
6
4
|
id: string;
|
|
7
5
|
label: string;
|
|
8
|
-
key?: string;
|
|
9
|
-
name?: string;
|
|
10
|
-
sticky?: boolean;
|
|
11
6
|
minWidth?: number;
|
|
12
7
|
maxWidth?: number;
|
|
13
8
|
width?: number;
|
|
14
9
|
align?: "right" | "left" | "center";
|
|
15
|
-
alignText?: "right" | "left" | "center";
|
|
16
10
|
format?: (value: any) => string;
|
|
17
11
|
sortable?: boolean;
|
|
18
12
|
filterable?: boolean;
|
|
19
|
-
|
|
20
|
-
filterType?: TypeInputEnum;
|
|
13
|
+
filterValue?: string;
|
|
21
14
|
editable?: boolean;
|
|
22
|
-
|
|
15
|
+
enterToNextColumn?: boolean;
|
|
23
16
|
options?: { label: string; value: string }[];
|
|
24
|
-
displayOverlay?: boolean;
|
|
25
|
-
onEditable?: (value: any, row: T) => boolean;
|
|
26
|
-
onChange?: (value: any, row: T) => void;
|
|
27
|
-
onEditByOverlay?: (value: any, row: T) => void;
|
|
28
17
|
onEdit?: (value: any, row: T) => void;
|
|
18
|
+
onEnter?: (value: any, row: T) => void;
|
|
29
19
|
onDisable?: (row: T) => boolean;
|
|
30
|
-
onEditTrigger?: "change" | "enter";
|
|
31
20
|
onRowStyle?: (row: T) => React.CSSProperties;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
21
|
+
type: HTMLInputTypeAttribute | "select" | "image";
|
|
22
|
+
imageAlt?: (row: T) => string;
|
|
23
|
+
imageStyle?: React.CSSProperties;
|
|
24
|
+
imageSrc?: (row: T) => string;
|
|
25
|
+
showStepButtons?: boolean | ((row: T) => boolean);
|
|
26
|
+
stepControls?: boolean | ((row: T) => boolean);
|
|
27
|
+
withStepControls?: boolean | ((row: T) => boolean);
|
|
28
|
+
step?: number;
|
|
29
|
+
min?: number;
|
|
30
|
+
max?: number;
|
|
38
31
|
}
|
|
39
|
-
export interface
|
|
32
|
+
export interface dataTableActionsInterface<T> {
|
|
40
33
|
id: string;
|
|
41
34
|
label: string;
|
|
42
35
|
type: "button" | "link" | "icon";
|
|
43
36
|
classIcon?: string;
|
|
44
|
-
onClick: (row: T) => void;
|
|
37
|
+
onClick: (row: T, rowIndex?: number) => void;
|
|
45
38
|
shouldDisplay?: (row: T) => boolean;
|
|
46
39
|
disabled?: boolean;
|
|
47
40
|
labelButton?: (row: T) => string;
|
|
48
41
|
visible?: boolean;
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
width?: string | number;
|
|
43
|
+
minWidth?: string | number;
|
|
44
|
+
focusNextRow?: boolean;
|
|
51
45
|
}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { Button } from "../../button/Button";
|
|
2
2
|
import { Icon } from "../../icon/Icon";
|
|
3
|
-
import {
|
|
3
|
+
import { dataTableActionsInterface } from "../dataTable.interface";
|
|
4
4
|
type DataTableActionProps = {
|
|
5
|
-
action:
|
|
5
|
+
action: dataTableActionsInterface<any>;
|
|
6
6
|
row: any;
|
|
7
|
+
rowIndex?: number;
|
|
7
8
|
index?: number;
|
|
9
|
+
onFocusNextRow?: (rowIndex: number) => void;
|
|
8
10
|
};
|
|
9
11
|
export const DataTableAction = ({
|
|
10
12
|
action,
|
|
11
13
|
row,
|
|
14
|
+
rowIndex,
|
|
12
15
|
index,
|
|
16
|
+
onFocusNextRow,
|
|
13
17
|
}: DataTableActionProps) => {
|
|
14
18
|
let title = action.label;
|
|
15
19
|
const display = action.shouldDisplay ? action.shouldDisplay(row) : true;
|
|
@@ -17,18 +21,27 @@ export const DataTableAction = ({
|
|
|
17
21
|
if (action.labelButton) {
|
|
18
22
|
title = action.labelButton ? action.labelButton(row) : action.label;
|
|
19
23
|
}
|
|
24
|
+
|
|
25
|
+
const handleClick = (e?: React.MouseEvent) => {
|
|
26
|
+
e?.stopPropagation();
|
|
27
|
+
action.onClick(row, rowIndex);
|
|
28
|
+
if (action.focusNextRow && rowIndex !== undefined) {
|
|
29
|
+
onFocusNextRow?.(rowIndex);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
20
33
|
return (
|
|
21
34
|
<>
|
|
22
35
|
{action.type === "button" && (
|
|
23
36
|
<Button
|
|
24
37
|
title={title}
|
|
25
38
|
key={`button-action-${action.id}-${index}`}
|
|
26
|
-
onClick={
|
|
27
|
-
// évite de déclencher le onRowClick de la ligne
|
|
28
|
-
e?.stopPropagation?.();
|
|
29
|
-
action.onClick(row);
|
|
30
|
-
}}
|
|
39
|
+
onClick={handleClick}
|
|
31
40
|
disabled={action.disabled}
|
|
41
|
+
style={{
|
|
42
|
+
minWidth: action.minWidth,
|
|
43
|
+
width: action.width,
|
|
44
|
+
}}
|
|
32
45
|
className={`data-table-action button--tertiary mr-2 w-100 ${
|
|
33
46
|
action.classIcon ? action.classIcon : ""
|
|
34
47
|
}`}
|
|
@@ -37,13 +50,11 @@ export const DataTableAction = ({
|
|
|
37
50
|
{action.type === "icon" && (
|
|
38
51
|
<div
|
|
39
52
|
key={`icon-action-${action.id}-${index}`}
|
|
40
|
-
className={`mr-2
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
e.stopPropagation();
|
|
46
|
-
action.onClick(row);
|
|
53
|
+
className={`mr-2 `}
|
|
54
|
+
onClick={handleClick}
|
|
55
|
+
style={{
|
|
56
|
+
minWidth: action.minWidth,
|
|
57
|
+
width: action.width,
|
|
47
58
|
}}
|
|
48
59
|
>
|
|
49
60
|
<Icon classIcon={action.classIcon ?? ""} key={action.id} />
|
|
@@ -1,77 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DataTableColumnsInterface } from "../dataTable.interface";
|
|
3
|
-
import { DataTableColumnFilter } from "./dataTableColumnFilter/DataTableColumnFilter";
|
|
4
|
-
import { DataTableColumnSort } from "./dataTableColumnSort/DataTableColumnSort";
|
|
1
|
+
import { dataTableColumnsInterface } from "../dataTable.interface";
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
type DataTableColumnProps = {
|
|
4
|
+
column: dataTableColumnsInterface<any>;
|
|
5
|
+
idx: number;
|
|
6
|
+
onColumnClick?: (column: dataTableColumnsInterface<any>) => void;
|
|
7
|
+
};
|
|
8
|
+
export const DataTableColumn = ({
|
|
7
9
|
column,
|
|
8
10
|
idx,
|
|
9
11
|
onColumnClick,
|
|
10
|
-
|
|
11
|
-
isFilterVisible,
|
|
12
|
-
onToggleFilterVisibility,
|
|
13
|
-
currentSortDirection,
|
|
14
|
-
onToggleSort,
|
|
15
|
-
stickyLeft,
|
|
16
|
-
stickyTop,
|
|
17
|
-
}: {
|
|
18
|
-
hasNestedColumns: boolean;
|
|
19
|
-
column: DataTableColumnsInterface<T>;
|
|
20
|
-
idx: number;
|
|
21
|
-
onColumnClick?: (column: DataTableColumnsInterface<T>) => void;
|
|
22
|
-
isFilterVisible?: boolean;
|
|
23
|
-
onToggleFilterVisibility?: (column: DataTableColumnsInterface<T>) => void;
|
|
24
|
-
currentSortDirection?: DataTableSortDirection | null;
|
|
25
|
-
onToggleSort?: (column: DataTableColumnsInterface<T>) => void;
|
|
26
|
-
stickyLeft?: number;
|
|
27
|
-
stickyTop?: number;
|
|
28
|
-
}) {
|
|
29
|
-
const hasChildren = !!column.children?.length;
|
|
30
|
-
const isSticky = stickyLeft !== undefined;
|
|
31
|
-
|
|
12
|
+
}: DataTableColumnProps) => {
|
|
32
13
|
return (
|
|
33
14
|
<th
|
|
34
15
|
key={`colonne-${column.id}-${idx}`}
|
|
35
16
|
style={{
|
|
36
|
-
minWidth:
|
|
37
|
-
maxWidth:
|
|
38
|
-
width:
|
|
39
|
-
textAlign: column.align
|
|
40
|
-
alignContent: column.children ? "center" : "flex-end",
|
|
41
|
-
top: stickyTop,
|
|
42
|
-
...(isSticky
|
|
43
|
-
? {
|
|
44
|
-
position: "sticky",
|
|
45
|
-
left: stickyLeft,
|
|
46
|
-
zIndex: 13,
|
|
47
|
-
backgroundColor: "#f9fbfc",
|
|
48
|
-
}
|
|
49
|
-
: {}),
|
|
17
|
+
minWidth: column.minWidth,
|
|
18
|
+
maxWidth: column.maxWidth,
|
|
19
|
+
width: column.width,
|
|
20
|
+
textAlign: column.align || "left",
|
|
50
21
|
}}
|
|
51
|
-
className={`${column.children ? "has-children" : ""} ${
|
|
52
|
-
isSticky ? "data-table-sticky-cell" : ""
|
|
53
|
-
}`.trim()}
|
|
54
|
-
colSpan={column.children?.length ?? 1}
|
|
55
|
-
rowSpan={!column.children?.length && hasNestedColumns ? 2 : 1}
|
|
56
22
|
onClick={() => onColumnClick?.(column)}
|
|
57
23
|
>
|
|
58
|
-
|
|
59
|
-
<div className="flex-1">{column.label}</div>
|
|
60
|
-
{column.filterable && (
|
|
61
|
-
<DataTableColumnFilter
|
|
62
|
-
column={column}
|
|
63
|
-
isFilterVisible={isFilterVisible}
|
|
64
|
-
onToggleVisibility={onToggleFilterVisibility}
|
|
65
|
-
/>
|
|
66
|
-
)}
|
|
67
|
-
{column.sortable && (
|
|
68
|
-
<DataTableColumnSort
|
|
69
|
-
column={column}
|
|
70
|
-
sortDirection={currentSortDirection}
|
|
71
|
-
onToggleSort={onToggleSort}
|
|
72
|
-
/>
|
|
73
|
-
)}
|
|
74
|
-
</div>
|
|
24
|
+
{column.label}
|
|
75
25
|
</th>
|
|
76
26
|
);
|
|
77
|
-
}
|
|
27
|
+
};
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
type DataTableLoadingProps = {
|
|
2
|
+
columns: any[];
|
|
3
|
+
actions: any[];
|
|
2
4
|
emptyMessage?: string;
|
|
3
5
|
};
|
|
4
|
-
export const DataTableLoading = ({
|
|
6
|
+
export const DataTableLoading = ({
|
|
7
|
+
columns,
|
|
8
|
+
actions,
|
|
9
|
+
emptyMessage,
|
|
10
|
+
}: DataTableLoadingProps) => {
|
|
5
11
|
return (
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
<tr>
|
|
13
|
+
<td
|
|
14
|
+
align="center"
|
|
15
|
+
colSpan={columns.length + (actions.length > 0 ? 1 : 0)}
|
|
16
|
+
>
|
|
17
|
+
<div className="mt-3">{emptyMessage || "Aucune donnée disponible"}</div>
|
|
18
|
+
</td>
|
|
19
|
+
</tr>
|
|
9
20
|
);
|
|
10
21
|
};
|