@chumsinc/sortable-tables 2.1.2 → 3.0.0

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.
Files changed (66) hide show
  1. package/CHANGELOG.md +87 -48
  2. package/README.md +94 -4
  3. package/dist/DataTable.d.ts +6 -6
  4. package/dist/DataTableCell.d.ts +299 -295
  5. package/dist/DataTableCols.d.ts +5 -0
  6. package/dist/DataTableContext.d.ts +10 -0
  7. package/dist/DataTableHead.d.ts +2 -2
  8. package/dist/DataTableProvider.d.ts +12 -0
  9. package/dist/DataTableRow.d.ts +1 -1
  10. package/dist/DataTableTBody.d.ts +1 -1
  11. package/dist/DataTableTH.d.ts +6 -6
  12. package/dist/RowsPerPage.d.ts +0 -1
  13. package/dist/SortableTable.d.ts +6 -6
  14. package/dist/SortableTableHead.d.ts +6 -6
  15. package/dist/SortableTableHeadWrapper.d.ts +9 -0
  16. package/dist/SortableTableTH.d.ts +6 -6
  17. package/dist/StandaloneDataTable.d.ts +6 -0
  18. package/dist/StandaloneSortHelper.d.ts +5 -0
  19. package/dist/StandaloneSortableTable.d.ts +6 -0
  20. package/dist/Table.d.ts +6 -5
  21. package/dist/index.cjs.js +30 -28
  22. package/dist/index.cjs.js.map +1 -1
  23. package/dist/index.d.ts +20 -10
  24. package/dist/index.es.js +521 -388
  25. package/dist/index.es.js.map +1 -1
  26. package/dist/types.d.ts +104 -105
  27. package/dist/useField.d.ts +6 -0
  28. package/dist/useTableContext.d.ts +2 -0
  29. package/dist/useTableFields.d.ts +9 -0
  30. package/dist/useTableSort.d.ts +9 -0
  31. package/eslint.config.mjs +3 -3
  32. package/package.json +7 -5
  33. package/src/DataTable.tsx +23 -28
  34. package/src/DataTableCell.tsx +33 -28
  35. package/src/DataTableCols.tsx +18 -0
  36. package/src/DataTableContext.ts +13 -0
  37. package/src/DataTableHead.tsx +9 -9
  38. package/src/DataTableProvider.tsx +62 -0
  39. package/src/DataTableRow.tsx +10 -8
  40. package/src/DataTableTBody.tsx +1 -5
  41. package/src/DataTableTH.tsx +11 -9
  42. package/src/RowsPerPage.tsx +6 -9
  43. package/src/SortableTable.tsx +26 -28
  44. package/src/SortableTableHead.tsx +17 -16
  45. package/src/SortableTableHeadWrapper.tsx +20 -0
  46. package/src/SortableTableTH.tsx +11 -8
  47. package/src/StandaloneDataTable.tsx +16 -0
  48. package/src/StandaloneSortHelper.tsx +15 -0
  49. package/src/StandaloneSortableTable.tsx +21 -0
  50. package/src/Table.tsx +49 -44
  51. package/src/TablePagination.tsx +4 -6
  52. package/src/index.tsx +26 -12
  53. package/src/types.ts +127 -128
  54. package/src/useField.ts +19 -0
  55. package/src/useTableContext.ts +10 -0
  56. package/src/useTableFields.ts +20 -0
  57. package/src/useTableSort.ts +20 -0
  58. package/test/Main.tsx +37 -0
  59. package/test/TableColumnsHandler.tsx +28 -0
  60. package/test/TestTable.tsx +51 -68
  61. package/test/data.ts +232 -232
  62. package/test/index.tsx +11 -11
  63. package/test/tableFields.tsx +52 -0
  64. package/test/utils.ts +19 -0
  65. package/tsconfig.json +1 -0
  66. package/vite.config.ts +1 -2
@@ -1,68 +1,51 @@
1
- import React, {useEffect, useState} from 'react';
2
- import {ProductLine, productLines, productLineSorter} from './data'
3
- import {SortableTable, SortableTableField, SortProps} from "../src";
4
- import TablePagination from "../src/TablePagination";
5
-
6
- const fields: SortableTableField<ProductLine>[] = [
7
- {field: 'ProductLine', title: 'Prod Line', sortable: true, as: 'th'},
8
- {field: 'ProductLineDesc', title: 'Description', sortable: true},
9
- {
10
- field: 'ProductType',
11
- title: 'Description',
12
- sortable: true,
13
- render: (row) => <span className="badge bg-info">{row.ProductType}</span>,
14
- align: 'center'
15
- },
16
- {
17
- field: 'Valuation',
18
- title: 'Valuation',
19
- sortable: true,
20
- render: (row) => <span className="badge bg-secondary">{row.Valuation}</span>,
21
- align: 'center'
22
- },
23
- {
24
- field: 'ExplodeKitItems',
25
- title: 'Explode Kit Items?',
26
- sortable: true,
27
- render: (row) => <span className="badge bg-primary">{row.ExplodeKitItems}</span>,
28
- align: 'end'
29
- },
30
- ]
31
- const rowClassName = (row: ProductLine) => row.active ? '' : 'table-warning';
32
-
33
- export default function TestTable() {
34
- const [sort, setSort] = useState<SortProps<ProductLine>>({field: 'ProductLine', ascending: true});
35
- const [list, setList] = useState<ProductLine[]>(productLines);
36
- const [page, setPage] = useState(0);
37
- const [rowsPerPage, setRowsPerPage] = useState(5);
38
-
39
-
40
- useEffect(() => {
41
- setList([...productLines.sort(productLineSorter(sort))]);
42
- setPage(0)
43
- }, [sort]);
44
-
45
- const rowsPerPageChangeHandler = (rpp: number) => {
46
- setPage(0);
47
- setRowsPerPage(rpp);
48
- }
49
-
50
- return (
51
- <div>
52
- <SortableTable currentSort={sort} onChangeSort={setSort} fields={fields} size="lg" responsive
53
- data={list.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)}
54
- keyField="ProductLine" rowClassName={rowClassName}/>
55
- <TablePagination page={page} onChangePage={setPage} size="sm"
56
- rowsPerPage={rowsPerPage}
57
- rowsPerPageProps={{
58
- onChange: rowsPerPageChangeHandler,
59
- label: <span className="bi-images" />,
60
- pageValues: [5, 10, 15, 25, 50, 100]
61
- }}
62
- showFirst={list.length > rowsPerPage}
63
- showLast={list.length > rowsPerPage}
64
- count={list.length}/>
65
- </div>
66
-
67
- )
68
- }
1
+ import React, {useState} from 'react';
2
+ import type {ProductLine} from './data'
3
+ import {SortableTable, type SortProps, useTableSort} from "../src";
4
+ import TablePagination from "../src/TablePagination";
5
+ import TableColumnsHandler from "./TableColumnsHandler";
6
+
7
+
8
+ const rowClassName = (row: ProductLine) => row.active ? '' : 'table-warning';
9
+
10
+ export interface TestTableProps {
11
+ data: ProductLine[];
12
+ onChangeSort?: (sort: SortProps<ProductLine>) => void;
13
+ }
14
+
15
+ export default function TestTable({data, onChangeSort}: TestTableProps) {
16
+ const [page, setPage] = useState(0);
17
+ const [rowsPerPage, setRowsPerPage] = useState(5);
18
+ const [, setSort] = useTableSort<ProductLine>();
19
+
20
+
21
+ const rowsPerPageChangeHandler = (rpp: number) => {
22
+ setPage(0);
23
+ setRowsPerPage(rpp);
24
+ }
25
+
26
+ const sortChangeHandler = (sort: SortProps<ProductLine>) => {
27
+ onChangeSort?.(sort);
28
+ setSort(sort);
29
+ }
30
+
31
+
32
+ return (
33
+ <div>
34
+ <TableColumnsHandler/>
35
+ <SortableTable onChangeSort={sortChangeHandler} size="lg" responsive
36
+ data={data.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)}
37
+ keyField="ProductLine" rowClassName={rowClassName}/>
38
+ <TablePagination page={page} onChangePage={setPage} size="sm"
39
+ rowsPerPage={rowsPerPage}
40
+ rowsPerPageProps={{
41
+ onChange: rowsPerPageChangeHandler,
42
+ label: <span className="bi-images"/>,
43
+ pageValues: [5, 10, 15, 25, 50, 100]
44
+ }}
45
+ showFirst={data.length > rowsPerPage}
46
+ showLast={data.length > rowsPerPage}
47
+ count={data.length}/>
48
+ </div>
49
+
50
+ )
51
+ }
package/test/data.ts CHANGED
@@ -1,232 +1,232 @@
1
- import {SortProps} from "../src";
2
-
3
- export interface ProductLine {
4
- ProductLine: string,
5
- ProductLineDesc: string,
6
- ProductType: string;
7
- Valuation: string;
8
- ExplodeKitItems: string;
9
- active: boolean;
10
- }
11
-
12
- export const productLines: ProductLine[] = [
13
- {
14
- "ProductLine": "A",
15
- "ProductLineDesc": "Watchbands",
16
- "ProductType": "F",
17
- "Valuation": "2",
18
- "ExplodeKitItems": "P",
19
- "active": true
20
- },
21
- {
22
- "ProductLine": "BC",
23
- "ProductLineDesc": "Beyond Coastal",
24
- "ProductType": "F",
25
- "Valuation": "5",
26
- "ExplodeKitItems": "P",
27
- "active": true
28
- },
29
- {
30
- "ProductLine": "CASE",
31
- "ProductLineDesc": "Accessory Cases & Bags",
32
- "ProductType": "F",
33
- "Valuation": "2",
34
- "ExplodeKitItems": "A",
35
- "active": true
36
- },
37
- {
38
- "ProductLine": "D",
39
- "ProductLineDesc": "Display Racks",
40
- "ProductType": "F",
41
- "Valuation": "2",
42
- "ExplodeKitItems": "P",
43
- "active": true
44
- },
45
- {
46
- "ProductLine": "E",
47
- "ProductLineDesc": "Retainers",
48
- "ProductType": "F",
49
- "Valuation": "2",
50
- "ExplodeKitItems": "P",
51
- "active": true
52
- },
53
- {
54
- "ProductLine": "E2",
55
- "ProductLineDesc": "Optical Accessories",
56
- "ProductType": "F",
57
- "Valuation": "2",
58
- "ExplodeKitItems": "P",
59
- "active": true
60
- },
61
- {
62
- "ProductLine": "F2",
63
- "ProductLineDesc": "Active Gear/Fitness",
64
- "ProductType": "F",
65
- "Valuation": "2",
66
- "ExplodeKitItems": "P",
67
- "active": true
68
- },
69
- {
70
- "ProductLine": "FGRM",
71
- "ProductLineDesc": "Finished Goods w/USA Step",
72
- "ProductType": "F",
73
- "Valuation": "2",
74
- "ExplodeKitItems": "P",
75
- "active": true
76
- },
77
- {
78
- "ProductLine": "FUSA",
79
- "ProductLineDesc": "#Freestyle USA Sales",
80
- "ProductType": "F",
81
- "Valuation": "2",
82
- "ExplodeKitItems": "A",
83
- "active": false
84
- },
85
- {
86
- "ProductLine": "G",
87
- "ProductLineDesc": "Chums Custom OEM",
88
- "ProductType": "F",
89
- "Valuation": "2",
90
- "ExplodeKitItems": "P",
91
- "active": true
92
- },
93
- {
94
- "ProductLine": "J",
95
- "ProductLineDesc": "Winter Products",
96
- "ProductType": "F",
97
- "Valuation": "2",
98
- "ExplodeKitItems": "P",
99
- "active": true
100
- },
101
- {
102
- "ProductLine": "JP",
103
- "ProductLineDesc": "Japan Products",
104
- "ProductType": "F",
105
- "Valuation": "2",
106
- "ExplodeKitItems": "A",
107
- "active": true
108
- },
109
- {
110
- "ProductLine": "K",
111
- "ProductLineDesc": "Keychains",
112
- "ProductType": "F",
113
- "Valuation": "2",
114
- "ExplodeKitItems": "P",
115
- "active": true
116
- },
117
- {
118
- "ProductLine": "L",
119
- "ProductLineDesc": "Wallets",
120
- "ProductType": "F",
121
- "Valuation": "2",
122
- "ExplodeKitItems": "P",
123
- "active": true
124
- },
125
- {
126
- "ProductLine": "M",
127
- "ProductLineDesc": "Misc Products",
128
- "ProductType": "F",
129
- "Valuation": "2",
130
- "ExplodeKitItems": "P",
131
- "active": true
132
- },
133
- {
134
- "ProductLine": "O",
135
- "ProductLineDesc": "Lip Balm/Lotion",
136
- "ProductType": "F",
137
- "Valuation": "2",
138
- "ExplodeKitItems": "P",
139
- "active": true
140
- },
141
- {
142
- "ProductLine": "P",
143
- "ProductLineDesc": "Paracord",
144
- "ProductType": "F",
145
- "Valuation": "2",
146
- "ExplodeKitItems": "A",
147
- "active": true
148
- },
149
- {
150
- "ProductLine": "POFG",
151
- "ProductLineDesc": "Purchased Items with WT",
152
- "ProductType": "F",
153
- "Valuation": "2",
154
- "ExplodeKitItems": "P",
155
- "active": true
156
- },
157
- {
158
- "ProductLine": "R",
159
- "ProductLineDesc": "Rep Sample Product",
160
- "ProductType": "F",
161
- "Valuation": "2",
162
- "ExplodeKitItems": "P",
163
- "active": true
164
- },
165
- {
166
- "ProductLine": "RBC",
167
- "ProductLineDesc": "#Rep Sample BeyondCoastal",
168
- "ProductType": "F",
169
- "Valuation": "2",
170
- "ExplodeKitItems": "A",
171
- "active": false
172
- },
173
- {
174
- "ProductLine": "RM",
175
- "ProductLineDesc": "Raw Materials",
176
- "ProductType": "R",
177
- "Valuation": "2",
178
- "ExplodeKitItems": "P",
179
- "active": true
180
- },
181
- {
182
- "ProductLine": "RMLY",
183
- "ProductLineDesc": "Lanyard RHOOKS Sold",
184
- "ProductType": "R",
185
- "Valuation": "2",
186
- "ExplodeKitItems": "P",
187
- "active": true
188
- },
189
- {
190
- "ProductLine": "S",
191
- "ProductLineDesc": "Promotional Products",
192
- "ProductType": "F",
193
- "Valuation": "2",
194
- "ExplodeKitItems": "P",
195
- "active": true
196
- },
197
- {
198
- "ProductLine": "T",
199
- "ProductLineDesc": "Kits",
200
- "ProductType": "F",
201
- "Valuation": "2",
202
- "ExplodeKitItems": "A",
203
- "active": true
204
- },
205
- {
206
- "ProductLine": "V",
207
- "ProductLineDesc": "Lanyards",
208
- "ProductType": "F",
209
- "Valuation": "2",
210
- "ExplodeKitItems": "P",
211
- "active": true
212
- }
213
- ];
214
-
215
- export const productLineSorter = (sort: SortProps<ProductLine>) => (a: ProductLine, b: ProductLine) => {
216
- const {field, ascending} = sort;
217
- const sortMod = ascending === false ? -1 : 1;
218
- switch (field) {
219
- case 'ProductLine':
220
- case 'ProductLineDesc':
221
- case 'ProductType':
222
- case 'Valuation':
223
- case 'ExplodeKitItems':
224
- return (
225
- a[field].localeCompare(b[field]) === 0
226
- ? a.ProductLine.localeCompare(b.ProductLine)
227
- : a[field].localeCompare(b[field])
228
- ) * sortMod;
229
- default:
230
- return a.ProductLine.localeCompare(b.ProductLine)
231
- }
232
- }
1
+ import type {SortProps} from "../src";
2
+
3
+ export interface ProductLine {
4
+ ProductLine: string,
5
+ ProductLineDesc: string,
6
+ ProductType: string;
7
+ Valuation: string;
8
+ ExplodeKitItems: string;
9
+ active: boolean;
10
+ }
11
+
12
+ export const productLines: ProductLine[] = [
13
+ {
14
+ "ProductLine": "A",
15
+ "ProductLineDesc": "Watchbands",
16
+ "ProductType": "F",
17
+ "Valuation": "2",
18
+ "ExplodeKitItems": "P",
19
+ "active": true
20
+ },
21
+ {
22
+ "ProductLine": "BC",
23
+ "ProductLineDesc": "Beyond Coastal",
24
+ "ProductType": "F",
25
+ "Valuation": "5",
26
+ "ExplodeKitItems": "P",
27
+ "active": true
28
+ },
29
+ {
30
+ "ProductLine": "CASE",
31
+ "ProductLineDesc": "Accessory Cases & Bags",
32
+ "ProductType": "F",
33
+ "Valuation": "2",
34
+ "ExplodeKitItems": "A",
35
+ "active": true
36
+ },
37
+ {
38
+ "ProductLine": "D",
39
+ "ProductLineDesc": "Display Racks",
40
+ "ProductType": "F",
41
+ "Valuation": "2",
42
+ "ExplodeKitItems": "P",
43
+ "active": true
44
+ },
45
+ {
46
+ "ProductLine": "E",
47
+ "ProductLineDesc": "Retainers",
48
+ "ProductType": "F",
49
+ "Valuation": "2",
50
+ "ExplodeKitItems": "P",
51
+ "active": true
52
+ },
53
+ {
54
+ "ProductLine": "E2",
55
+ "ProductLineDesc": "Optical Accessories",
56
+ "ProductType": "F",
57
+ "Valuation": "2",
58
+ "ExplodeKitItems": "P",
59
+ "active": true
60
+ },
61
+ {
62
+ "ProductLine": "F2",
63
+ "ProductLineDesc": "Active Gear/Fitness",
64
+ "ProductType": "F",
65
+ "Valuation": "2",
66
+ "ExplodeKitItems": "P",
67
+ "active": true
68
+ },
69
+ {
70
+ "ProductLine": "FGRM",
71
+ "ProductLineDesc": "Finished Goods w/USA Step",
72
+ "ProductType": "F",
73
+ "Valuation": "2",
74
+ "ExplodeKitItems": "P",
75
+ "active": true
76
+ },
77
+ {
78
+ "ProductLine": "FUSA",
79
+ "ProductLineDesc": "#Freestyle USA Sales",
80
+ "ProductType": "F",
81
+ "Valuation": "2",
82
+ "ExplodeKitItems": "A",
83
+ "active": false
84
+ },
85
+ {
86
+ "ProductLine": "G",
87
+ "ProductLineDesc": "Chums Custom OEM",
88
+ "ProductType": "F",
89
+ "Valuation": "2",
90
+ "ExplodeKitItems": "P",
91
+ "active": true
92
+ },
93
+ {
94
+ "ProductLine": "J",
95
+ "ProductLineDesc": "Winter Products",
96
+ "ProductType": "F",
97
+ "Valuation": "2",
98
+ "ExplodeKitItems": "P",
99
+ "active": true
100
+ },
101
+ {
102
+ "ProductLine": "JP",
103
+ "ProductLineDesc": "Japan Products",
104
+ "ProductType": "F",
105
+ "Valuation": "2",
106
+ "ExplodeKitItems": "A",
107
+ "active": true
108
+ },
109
+ {
110
+ "ProductLine": "K",
111
+ "ProductLineDesc": "Keychains",
112
+ "ProductType": "F",
113
+ "Valuation": "2",
114
+ "ExplodeKitItems": "P",
115
+ "active": true
116
+ },
117
+ {
118
+ "ProductLine": "L",
119
+ "ProductLineDesc": "Wallets",
120
+ "ProductType": "F",
121
+ "Valuation": "2",
122
+ "ExplodeKitItems": "P",
123
+ "active": true
124
+ },
125
+ {
126
+ "ProductLine": "M",
127
+ "ProductLineDesc": "Misc Products",
128
+ "ProductType": "F",
129
+ "Valuation": "2",
130
+ "ExplodeKitItems": "P",
131
+ "active": true
132
+ },
133
+ {
134
+ "ProductLine": "O",
135
+ "ProductLineDesc": "Lip Balm/Lotion",
136
+ "ProductType": "F",
137
+ "Valuation": "2",
138
+ "ExplodeKitItems": "P",
139
+ "active": true
140
+ },
141
+ {
142
+ "ProductLine": "P",
143
+ "ProductLineDesc": "Paracord",
144
+ "ProductType": "F",
145
+ "Valuation": "2",
146
+ "ExplodeKitItems": "A",
147
+ "active": true
148
+ },
149
+ {
150
+ "ProductLine": "POFG",
151
+ "ProductLineDesc": "Purchased Items with WT",
152
+ "ProductType": "F",
153
+ "Valuation": "2",
154
+ "ExplodeKitItems": "P",
155
+ "active": true
156
+ },
157
+ {
158
+ "ProductLine": "R",
159
+ "ProductLineDesc": "Rep Sample Product",
160
+ "ProductType": "F",
161
+ "Valuation": "2",
162
+ "ExplodeKitItems": "P",
163
+ "active": true
164
+ },
165
+ {
166
+ "ProductLine": "RBC",
167
+ "ProductLineDesc": "#Rep Sample BeyondCoastal",
168
+ "ProductType": "F",
169
+ "Valuation": "2",
170
+ "ExplodeKitItems": "A",
171
+ "active": false
172
+ },
173
+ {
174
+ "ProductLine": "RM",
175
+ "ProductLineDesc": "Raw Materials",
176
+ "ProductType": "R",
177
+ "Valuation": "2",
178
+ "ExplodeKitItems": "P",
179
+ "active": true
180
+ },
181
+ {
182
+ "ProductLine": "RMLY",
183
+ "ProductLineDesc": "Lanyard RHOOKS Sold",
184
+ "ProductType": "R",
185
+ "Valuation": "2",
186
+ "ExplodeKitItems": "P",
187
+ "active": true
188
+ },
189
+ {
190
+ "ProductLine": "S",
191
+ "ProductLineDesc": "Promotional Products",
192
+ "ProductType": "F",
193
+ "Valuation": "2",
194
+ "ExplodeKitItems": "P",
195
+ "active": true
196
+ },
197
+ {
198
+ "ProductLine": "T",
199
+ "ProductLineDesc": "Kits",
200
+ "ProductType": "F",
201
+ "Valuation": "2",
202
+ "ExplodeKitItems": "A",
203
+ "active": true
204
+ },
205
+ {
206
+ "ProductLine": "V",
207
+ "ProductLineDesc": "Lanyards",
208
+ "ProductType": "F",
209
+ "Valuation": "2",
210
+ "ExplodeKitItems": "P",
211
+ "active": true
212
+ }
213
+ ];
214
+
215
+ export const productLineSorter = (sort: SortProps<ProductLine>) => (a: ProductLine, b: ProductLine) => {
216
+ const {field, ascending} = sort;
217
+ const sortMod = ascending === false ? -1 : 1;
218
+ switch (field) {
219
+ case 'ProductLine':
220
+ case 'ProductLineDesc':
221
+ case 'ProductType':
222
+ case 'Valuation':
223
+ case 'ExplodeKitItems':
224
+ return (
225
+ a[field].localeCompare(b[field]) === 0
226
+ ? a.ProductLine.localeCompare(b.ProductLine)
227
+ : a[field].localeCompare(b[field])
228
+ ) * sortMod;
229
+ default:
230
+ return a.ProductLine.localeCompare(b.ProductLine)
231
+ }
232
+ }
package/test/index.tsx CHANGED
@@ -1,11 +1,11 @@
1
- import React from 'react';
2
- import {createRoot} from "react-dom/client";
3
- import TestTable from "./TestTable";
4
-
5
- const container = document.getElementById('app');
6
- const root = createRoot(container!);
7
- root.render(
8
- <React.StrictMode>
9
- <TestTable />
10
- </React.StrictMode>
11
- );
1
+ import React from 'react';
2
+ import {createRoot} from "react-dom/client";
3
+ import Main from "./Main";
4
+
5
+ const container = document.getElementById('app');
6
+ const root = createRoot(container!);
7
+ root.render(
8
+ <React.StrictMode>
9
+ <Main/>
10
+ </React.StrictMode>
11
+ );
@@ -0,0 +1,52 @@
1
+ import type {SortableTableField} from "../src";
2
+ import type {ProductLine} from "./data";
3
+ import React from "react";
4
+
5
+ export const tableFields: SortableTableField<ProductLine>[] = [
6
+ {
7
+ id: 'prodLine',
8
+ field: 'ProductLine',
9
+ title: 'Prod Line',
10
+ sortable: true,
11
+ as: 'th'
12
+ },
13
+ {
14
+ id: 'ProductLineDesc',
15
+ field: 'ProductLineDesc',
16
+ title: 'Description',
17
+ sortable: true,
18
+ visible: false,
19
+ },
20
+ {
21
+ id: 'prodType',
22
+ field: 'ProductType',
23
+ title: 'Description',
24
+ sortable: true,
25
+ render: (row) => <span className="badge bg-info">{row.ProductType}</span>,
26
+ align: 'center'
27
+ },
28
+ {
29
+ id: 'valuation',
30
+ field: 'Valuation',
31
+ title: 'Valuation',
32
+ sortable: true,
33
+ render: (row) => <span className="badge bg-secondary">{row.Valuation}</span>,
34
+ align: 'center'
35
+ },
36
+ {
37
+ id: 'explodeKit',
38
+ field: 'ExplodeKitItems',
39
+ title: 'Explode Kit Items?',
40
+ sortable: true,
41
+ render: (row) => <span className="badge bg-primary">{row.ExplodeKitItems}</span>,
42
+ align: 'end'
43
+ },
44
+ {
45
+ id: 'active',
46
+ field: 'active',
47
+ title: 'Active?',
48
+ sortable: true,
49
+ align: 'center',
50
+ render: (row) => <span className={`badge ${row.active ? 'bg-success' : 'bg-danger'}`}>{row.active ? 'Yes' : 'No'}</span>,
51
+ }
52
+ ]