@unbxd-ui/unbxd-react-components 0.2.145 → 0.2.146
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 +17 -1
- package/components/Accordian/Accordian.js +1 -2
- package/components/Accordian/Accordian.stories.js +140 -117
- package/components/Button/Button.stories.js +167 -61
- package/components/Button/DropdownButton.js +1 -2
- package/components/Button/index.js +1 -2
- package/components/DataLoader/DataLoader.js +1 -2
- package/components/DataLoader/DataLoader.stories.js +239 -53
- package/components/Form/Checkbox.js +5 -4
- package/components/Form/DragDropFileUploader.js +1 -2
- package/components/Form/Dropdown.js +1 -2
- package/components/Form/FileUploader.js +1 -2
- package/components/Form/Form.js +1 -2
- package/components/Form/Input.js +1 -2
- package/components/Form/RadioList.js +1 -2
- package/components/Form/RangeSlider.js +1 -2
- package/components/Form/SearchableDropdown.js +563 -0
- package/components/Form/ServerPaginatedDDList.js +17 -11
- package/components/Form/Textarea.js +1 -2
- package/components/Form/Toggle.js +1 -2
- package/components/Form/formCore.css +1 -1
- package/components/Form/formTheme.css +1 -1
- package/components/Form/index.js +7 -0
- package/components/Form/stories/Checkbox.stories.js +138 -39
- package/components/Form/stories/Dropdown.stories.js +322 -91
- package/components/Form/stories/FileUploader.stories.js +177 -18
- package/components/Form/stories/Input.stories.js +115 -0
- package/components/Form/stories/RangeSlider.stories.js +161 -63
- package/components/Form/stories/SearchableDropdown.stories.js +189 -0
- package/components/Form/stories/ServerPaginatedDropdown.stories.js +365 -0
- package/components/Form/stories/Textarea.stories.js +112 -33
- package/components/Form/stories/Toggle.stories.js +192 -13
- package/components/Form/variables.css +0 -0
- package/components/InlineModal/InlineModal.js +1 -2
- package/components/InlineModal/InlineModal.stories.js +239 -45
- package/components/InlineModal/index.js +1 -2
- package/components/InlineModal/inlineModalCore.css +1 -1
- package/components/List/List.stories.js +238 -0
- package/components/Modal/Modal.js +1 -2
- package/components/Modal/Modal.stories.js +256 -37
- package/components/Modal/modalCore.css +1 -1
- package/components/NotificationComponent/NotificationComponent.js +1 -2
- package/components/NotificationComponent/NotificationComponent.stories.js +170 -18
- package/components/PageLoader/PageLoader.js +84 -0
- package/components/PageLoader/PageLoader.stories.js +276 -0
- package/components/PageLoader/index.js +9 -0
- package/components/PageLoader/pageLoaderCore.css +1 -0
- package/components/ProgressBar/ProgressBar.css +0 -0
- package/components/ProgressBar/ProgressBar.stories.js +202 -9
- package/components/ProgressBar/progressBarCore.css +1 -1
- package/components/Table/BaseTable.js +84 -354
- package/components/Table/Table.js +6 -359
- package/components/Table/Table.stories.js +2109 -150
- package/components/Table/TableChild.js +383 -0
- package/components/Table/TableConstants.js +15 -0
- package/components/Table/hooks/usePrevious.js +14 -0
- package/components/Table/index.js +13 -0
- package/components/Table/tableCore.css +1 -1
- package/components/TableOld/BaseTable.js +373 -0
- package/components/TableOld/PaginationComponent.js +86 -0
- package/components/TableOld/TableOld.js +367 -0
- package/components/TableOld/index.js +15 -0
- package/components/TabsComponent/TabsComponent.js +1 -2
- package/components/TabsComponent/TabsComponent.stories.js +290 -52
- package/components/ToastNotification/ToastNotificationWrapper.js +212 -0
- package/components/ToastNotification/ToastNotificationWrapper.stories.js +554 -0
- package/components/ToastNotification/index.js +40 -0
- package/components/ToastNotification/toastNotificationCore.css +1 -0
- package/components/Tooltip/Tooltip.js +221 -83
- package/components/Tooltip/Tooltip.stories.js +379 -14
- package/components/Tooltip/tooltipCore.css +1 -1
- package/components/Tooltip/tooltipTheme.css +1 -1
- package/components/core.css +2 -3
- package/components/core.scss +17 -0
- package/components/index.js +58 -2
- package/components/theme.css +2 -3
- package/core/dataLoader.js +5 -2
- package/index.js +54 -0
- package/package.json +31 -20
- package/components/Button/DropdownButton.stories.js +0 -49
- package/components/Form/stories/DragDropFileUploader.stories.js +0 -25
- package/components/Form/stories/FormDefault.stories.js +0 -115
- package/components/Form/stories/RadioList.stories.js +0 -53
- package/components/Form/stories/TextInput.stories.js +0 -76
- package/components/Form/stories/form.stories.js +0 -233
- package/components/List/list.stories.js +0 -35
- package/core/dataLoader.stories.js +0 -119
|
@@ -4,16 +4,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports["default"] = exports.
|
|
7
|
+
exports["default"] = exports.StickyLastColumn = exports.StickyFirstColumn = exports.StickyBothColumns = exports.SimpleExpandableRows = exports.ServerSidePaginationWithCustomStyling = exports.ServerSidePagination = exports.SelectableRows = exports.RefreshTable = exports.PaginationOptionsShowcase = exports.NoStickyColumn = exports.NoPagination = exports.NoDataDefault = exports.ExpandableRows = exports.Default = exports.CustomStyling = exports.CustomPaginationStyling = exports.CustomNoDataComponent = exports.CustomColumnFormatting = exports.ConditionalExpandableRows = exports.BottomPagination = exports.AdvancedPaginationStyling = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _Table = _interopRequireDefault(require("./Table"));
|
|
10
|
-
var _DataLoader = _interopRequireDefault(require("../DataLoader"));
|
|
11
10
|
var _dataLoader = _interopRequireDefault(require("../../core/dataLoader"));
|
|
12
|
-
var _Form = require("../Form");
|
|
13
|
-
var _Constants = require("../../../public/Constants");
|
|
14
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
15
|
-
function
|
|
16
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
14
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
15
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -25,174 +21,2137 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
25
21
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
26
22
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
27
23
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
24
|
+
// Custom CheckBoxRow component for stories
|
|
25
|
+
var CustomCheckBoxRow = function CustomCheckBoxRow(_ref) {
|
|
26
|
+
var selected = _ref.selected,
|
|
27
|
+
onSelectionChange = _ref.onSelectionChange,
|
|
28
|
+
_ref$isCell = _ref.isCell,
|
|
29
|
+
isCell = _ref$isCell === void 0 ? false : _ref$isCell,
|
|
30
|
+
row = _ref.row;
|
|
31
|
+
var handleChange = function handleChange(e) {
|
|
32
|
+
if (isCell && row) {
|
|
33
|
+
onSelectionChange(row, e.target.checked);
|
|
34
|
+
} else {
|
|
35
|
+
onSelectionChange(null, e.target.checked);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return /*#__PURE__*/_react["default"].createElement("input", {
|
|
39
|
+
type: "checkbox",
|
|
40
|
+
checked: selected,
|
|
41
|
+
onChange: handleChange,
|
|
42
|
+
style: {
|
|
43
|
+
width: '16px',
|
|
44
|
+
height: '16px',
|
|
45
|
+
cursor: 'pointer',
|
|
46
|
+
accentColor: '#007bff'
|
|
47
|
+
}
|
|
48
|
+
});
|
|
39
49
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
|
|
51
|
+
// Set up request configurations for server-side examples
|
|
52
|
+
_dataLoader["default"].addRequestConfig('getUsers', {
|
|
53
|
+
url: 'https://jsonplaceholder.typicode.com/users',
|
|
54
|
+
method: 'GET'
|
|
55
|
+
});
|
|
56
|
+
_dataLoader["default"].addRequestConfig('getPosts', {
|
|
57
|
+
url: 'https://jsonplaceholder.typicode.com/posts',
|
|
58
|
+
method: 'GET'
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// Sample data for stories
|
|
62
|
+
var sampleRecords = [{
|
|
63
|
+
id: 1,
|
|
64
|
+
name: 'John Doe',
|
|
65
|
+
email: 'john.doe@example.com',
|
|
66
|
+
age: 30,
|
|
67
|
+
department: 'Engineering',
|
|
68
|
+
salary: 75000
|
|
69
|
+
}, {
|
|
70
|
+
id: 2,
|
|
71
|
+
name: 'Jane Smith',
|
|
72
|
+
email: 'jane.smith@example.com',
|
|
73
|
+
age: 28,
|
|
74
|
+
department: 'Marketing',
|
|
75
|
+
salary: 65000
|
|
76
|
+
}, {
|
|
77
|
+
id: 3,
|
|
78
|
+
name: 'Bob Johnson',
|
|
79
|
+
email: 'bob.johnson@example.com',
|
|
80
|
+
age: 35,
|
|
81
|
+
department: 'Sales',
|
|
82
|
+
salary: 80000
|
|
83
|
+
}, {
|
|
84
|
+
id: 4,
|
|
85
|
+
name: 'Alice Brown',
|
|
86
|
+
email: 'alice.brown@example.com',
|
|
87
|
+
age: 32,
|
|
88
|
+
department: 'Engineering',
|
|
89
|
+
salary: 78000
|
|
90
|
+
}, {
|
|
91
|
+
id: 5,
|
|
92
|
+
name: 'Charlie Wilson',
|
|
93
|
+
email: 'charlie.wilson@example.com',
|
|
94
|
+
age: 29,
|
|
95
|
+
department: 'HR',
|
|
96
|
+
salary: 60000
|
|
97
|
+
}, {
|
|
98
|
+
id: 6,
|
|
99
|
+
name: 'Diana Davis',
|
|
100
|
+
email: 'diana.davis@example.com',
|
|
101
|
+
age: 31,
|
|
102
|
+
department: 'Marketing',
|
|
103
|
+
salary: 67000
|
|
104
|
+
}, {
|
|
105
|
+
id: 7,
|
|
106
|
+
name: 'Edward Miller',
|
|
107
|
+
email: 'edward.miller@example.com',
|
|
108
|
+
age: 33,
|
|
109
|
+
department: 'Sales',
|
|
110
|
+
salary: 82000
|
|
111
|
+
}, {
|
|
112
|
+
id: 8,
|
|
113
|
+
name: 'Fiona Garcia',
|
|
114
|
+
email: 'fiona.garcia@example.com',
|
|
115
|
+
age: 27,
|
|
116
|
+
department: 'Engineering',
|
|
117
|
+
salary: 72000
|
|
118
|
+
}, {
|
|
119
|
+
id: 9,
|
|
120
|
+
name: 'George Martinez',
|
|
121
|
+
email: 'george.martinez@example.com',
|
|
122
|
+
age: 34,
|
|
123
|
+
department: 'HR',
|
|
124
|
+
salary: 62000
|
|
125
|
+
}, {
|
|
126
|
+
id: 10,
|
|
127
|
+
name: 'Helen Taylor',
|
|
128
|
+
email: 'helen.taylor@example.com',
|
|
129
|
+
age: 30,
|
|
130
|
+
department: 'Marketing',
|
|
131
|
+
salary: 68000
|
|
132
|
+
}, {
|
|
133
|
+
id: 11,
|
|
134
|
+
name: 'Isaac Thompson',
|
|
135
|
+
email: 'isaac.thompson@example.com',
|
|
136
|
+
age: 36,
|
|
137
|
+
department: 'Engineering',
|
|
138
|
+
salary: 79000
|
|
139
|
+
}, {
|
|
140
|
+
id: 12,
|
|
141
|
+
name: 'Julia White',
|
|
142
|
+
email: 'julia.white@example.com',
|
|
143
|
+
age: 26,
|
|
144
|
+
department: 'HR',
|
|
145
|
+
salary: 61000
|
|
146
|
+
}, {
|
|
147
|
+
id: 13,
|
|
148
|
+
name: 'Kevin Harris',
|
|
149
|
+
email: 'kevin.harris@example.com',
|
|
150
|
+
age: 38,
|
|
151
|
+
department: 'Sales',
|
|
152
|
+
salary: 85000
|
|
153
|
+
}, {
|
|
154
|
+
id: 14,
|
|
155
|
+
name: 'Laura Lewis',
|
|
156
|
+
email: 'laura.lewis@example.com',
|
|
157
|
+
age: 29,
|
|
158
|
+
department: 'Marketing',
|
|
159
|
+
salary: 66000
|
|
160
|
+
}, {
|
|
161
|
+
id: 15,
|
|
162
|
+
name: 'Michael Young',
|
|
163
|
+
email: 'michael.young@example.com',
|
|
164
|
+
age: 40,
|
|
165
|
+
department: 'Engineering',
|
|
166
|
+
salary: 88000
|
|
167
|
+
}, {
|
|
168
|
+
id: 16,
|
|
169
|
+
name: 'Natalie Hall',
|
|
170
|
+
email: 'natalie.hall@example.com',
|
|
171
|
+
age: 31,
|
|
172
|
+
department: 'HR',
|
|
173
|
+
salary: 63000
|
|
174
|
+
}, {
|
|
175
|
+
id: 17,
|
|
176
|
+
name: 'Oliver Allen',
|
|
177
|
+
email: 'oliver.allen@example.com',
|
|
178
|
+
age: 28,
|
|
179
|
+
department: 'Sales',
|
|
180
|
+
salary: 81000
|
|
181
|
+
}, {
|
|
182
|
+
id: 18,
|
|
183
|
+
name: 'Patricia King',
|
|
184
|
+
email: 'patricia.king@example.com',
|
|
185
|
+
age: 33,
|
|
186
|
+
department: 'Marketing',
|
|
187
|
+
salary: 69000
|
|
188
|
+
}, {
|
|
189
|
+
id: 19,
|
|
190
|
+
name: 'Quentin Scott',
|
|
191
|
+
email: 'quentin.scott@example.com',
|
|
192
|
+
age: 35,
|
|
193
|
+
department: 'Engineering',
|
|
194
|
+
salary: 76000
|
|
195
|
+
}, {
|
|
196
|
+
id: 20,
|
|
197
|
+
name: 'Rachel Adams',
|
|
198
|
+
email: 'rachel.adams@example.com',
|
|
199
|
+
age: 30,
|
|
200
|
+
department: 'HR',
|
|
201
|
+
salary: 64000
|
|
202
|
+
}];
|
|
203
|
+
|
|
204
|
+
// Sample column configurations
|
|
205
|
+
var basicColumnConfigs = [{
|
|
206
|
+
name: 'Name',
|
|
207
|
+
selector: function selector(row) {
|
|
208
|
+
return row.name;
|
|
209
|
+
},
|
|
210
|
+
sortable: true,
|
|
211
|
+
cell: function cell(row) {
|
|
212
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
213
|
+
className: "tbl-content"
|
|
214
|
+
}, row.name);
|
|
215
|
+
},
|
|
216
|
+
width: '200px'
|
|
217
|
+
}, {
|
|
218
|
+
name: 'Email',
|
|
219
|
+
selector: function selector(row) {
|
|
220
|
+
return row.email;
|
|
221
|
+
},
|
|
222
|
+
sortable: true,
|
|
223
|
+
cell: function cell(row) {
|
|
224
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
225
|
+
className: "tbl-content"
|
|
226
|
+
}, row.email);
|
|
227
|
+
},
|
|
228
|
+
width: '250px'
|
|
229
|
+
}, {
|
|
230
|
+
name: 'Age',
|
|
231
|
+
selector: function selector(row) {
|
|
232
|
+
return row.age;
|
|
233
|
+
},
|
|
234
|
+
sortable: true,
|
|
235
|
+
cell: function cell(row) {
|
|
236
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
237
|
+
className: "tbl-content"
|
|
238
|
+
}, row.age);
|
|
239
|
+
},
|
|
240
|
+
width: '100px'
|
|
241
|
+
}, {
|
|
242
|
+
name: 'Department',
|
|
243
|
+
selector: function selector(row) {
|
|
244
|
+
return row.department;
|
|
245
|
+
},
|
|
246
|
+
sortable: true,
|
|
247
|
+
cell: function cell(row) {
|
|
248
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
249
|
+
className: "tbl-content"
|
|
250
|
+
}, row.department);
|
|
251
|
+
},
|
|
252
|
+
width: '150px'
|
|
253
|
+
}, {
|
|
254
|
+
name: 'Salary',
|
|
255
|
+
selector: function selector(row) {
|
|
256
|
+
return "$".concat(row.salary.toLocaleString());
|
|
257
|
+
},
|
|
258
|
+
sortable: true,
|
|
259
|
+
cell: function cell(row) {
|
|
260
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
261
|
+
className: "tbl-content"
|
|
262
|
+
}, row.salary);
|
|
263
|
+
},
|
|
264
|
+
width: '120px'
|
|
265
|
+
}];
|
|
266
|
+
var postsColumnConfigs = [{
|
|
267
|
+
name: 'Post ID',
|
|
268
|
+
selector: function selector(row) {
|
|
269
|
+
return row.id;
|
|
270
|
+
},
|
|
271
|
+
sortable: true,
|
|
272
|
+
width: '100px'
|
|
273
|
+
}, {
|
|
274
|
+
name: 'Title',
|
|
275
|
+
selector: function selector(row) {
|
|
276
|
+
return row.title;
|
|
277
|
+
},
|
|
278
|
+
sortable: true,
|
|
279
|
+
width: '300px',
|
|
280
|
+
cell: function cell(row) {
|
|
281
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
282
|
+
style: {
|
|
283
|
+
fontWeight: '500',
|
|
284
|
+
color: '#2c3e50',
|
|
285
|
+
lineHeight: '1.4'
|
|
286
|
+
}
|
|
287
|
+
}, row.title);
|
|
288
|
+
}
|
|
289
|
+
}, {
|
|
290
|
+
name: 'Body',
|
|
291
|
+
selector: function selector(row) {
|
|
292
|
+
return row.body;
|
|
293
|
+
},
|
|
294
|
+
sortable: true,
|
|
295
|
+
width: '400px',
|
|
296
|
+
cell: function cell(row) {
|
|
297
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
298
|
+
style: {
|
|
299
|
+
color: '#666',
|
|
300
|
+
fontSize: '13px',
|
|
301
|
+
lineHeight: '1.3',
|
|
302
|
+
maxHeight: '60px',
|
|
303
|
+
overflow: 'hidden',
|
|
304
|
+
textOverflow: 'ellipsis'
|
|
305
|
+
}
|
|
306
|
+
}, row.body);
|
|
307
|
+
}
|
|
308
|
+
}, {
|
|
309
|
+
name: 'User ID',
|
|
310
|
+
selector: function selector(row) {
|
|
311
|
+
return row.userId;
|
|
312
|
+
},
|
|
313
|
+
sortable: true,
|
|
314
|
+
width: '100px',
|
|
315
|
+
cell: function cell(row) {
|
|
316
|
+
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
317
|
+
style: {
|
|
318
|
+
padding: '4px 8px',
|
|
319
|
+
borderRadius: '12px',
|
|
320
|
+
fontSize: '12px',
|
|
321
|
+
fontWeight: '500',
|
|
322
|
+
backgroundColor: '#e3f2fd',
|
|
323
|
+
color: '#1976d2'
|
|
324
|
+
}
|
|
325
|
+
}, "User ", row.userId);
|
|
326
|
+
}
|
|
327
|
+
}];
|
|
328
|
+
|
|
329
|
+
// Expandable content component for detailed row information
|
|
330
|
+
var ExpandableRowContent = function ExpandableRowContent(_ref2) {
|
|
331
|
+
var data = _ref2.data;
|
|
332
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
333
|
+
style: {
|
|
334
|
+
padding: '20px',
|
|
335
|
+
backgroundColor: '#f4f8ff',
|
|
336
|
+
borderLeft: '4px solid #007bff',
|
|
337
|
+
margin: '0'
|
|
53
338
|
}
|
|
54
|
-
}]
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
label: "Avatar",
|
|
60
|
-
key: "avatar",
|
|
61
|
-
/* eslint-disable react/prop-types */
|
|
62
|
-
valueFormatter: function renderUserImage(_ref2) {
|
|
63
|
-
var value = _ref2.value;
|
|
64
|
-
return /*#__PURE__*/_react["default"].createElement("img", {
|
|
65
|
-
src: value
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
/* eslint-enable react/prop-types */
|
|
69
|
-
}, {
|
|
70
|
-
label: "first_name",
|
|
71
|
-
key: "name",
|
|
72
|
-
sortable: true,
|
|
73
|
-
valueFormatter: function valueFormatter(_ref3) {
|
|
74
|
-
var record = _ref3.record;
|
|
75
|
-
var first_name = record.first_name,
|
|
76
|
-
last_name = record.last_name;
|
|
77
|
-
return "".concat(first_name, " ").concat(last_name);
|
|
339
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
340
|
+
style: {
|
|
341
|
+
display: 'grid',
|
|
342
|
+
gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))',
|
|
343
|
+
gap: '16px'
|
|
78
344
|
}
|
|
79
|
-
}]
|
|
80
|
-
|
|
345
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("h4", {
|
|
346
|
+
style: {
|
|
347
|
+
margin: '0 0 8px 0',
|
|
348
|
+
color: '#495057',
|
|
349
|
+
fontSize: '14px'
|
|
350
|
+
}
|
|
351
|
+
}, "Contact Information"), /*#__PURE__*/_react["default"].createElement("p", {
|
|
352
|
+
style: {
|
|
353
|
+
margin: '4px 0',
|
|
354
|
+
fontSize: '13px',
|
|
355
|
+
color: '#666'
|
|
356
|
+
}
|
|
357
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Email:"), " ", data.email), /*#__PURE__*/_react["default"].createElement("p", {
|
|
358
|
+
style: {
|
|
359
|
+
margin: '4px 0',
|
|
360
|
+
fontSize: '13px',
|
|
361
|
+
color: '#666'
|
|
362
|
+
}
|
|
363
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Phone:"), " ", data.phone || '+1 (555) 123-4567'), /*#__PURE__*/_react["default"].createElement("p", {
|
|
364
|
+
style: {
|
|
365
|
+
margin: '4px 0',
|
|
366
|
+
fontSize: '13px',
|
|
367
|
+
color: '#666'
|
|
368
|
+
}
|
|
369
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Address:"), " ", data.address || '123 Main St, City, State 12345')), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("h4", {
|
|
370
|
+
style: {
|
|
371
|
+
margin: '0 0 8px 0',
|
|
372
|
+
color: '#495057',
|
|
373
|
+
fontSize: '14px'
|
|
374
|
+
}
|
|
375
|
+
}, "Employment Details"), /*#__PURE__*/_react["default"].createElement("p", {
|
|
376
|
+
style: {
|
|
377
|
+
margin: '4px 0',
|
|
378
|
+
fontSize: '13px',
|
|
379
|
+
color: '#666'
|
|
380
|
+
}
|
|
381
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Start Date:"), " ", data.startDate || 'Jan 15, 2020'), /*#__PURE__*/_react["default"].createElement("p", {
|
|
382
|
+
style: {
|
|
383
|
+
margin: '4px 0',
|
|
384
|
+
fontSize: '13px',
|
|
385
|
+
color: '#666'
|
|
386
|
+
}
|
|
387
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Manager:"), " ", data.manager || 'Sarah Johnson'), /*#__PURE__*/_react["default"].createElement("p", {
|
|
388
|
+
style: {
|
|
389
|
+
margin: '4px 0',
|
|
390
|
+
fontSize: '13px',
|
|
391
|
+
color: '#666'
|
|
392
|
+
}
|
|
393
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Employee ID:"), " EMP-", data.id.toString().padStart(4, '0'))), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("h4", {
|
|
394
|
+
style: {
|
|
395
|
+
margin: '0 0 8px 0',
|
|
396
|
+
color: '#495057',
|
|
397
|
+
fontSize: '14px'
|
|
398
|
+
}
|
|
399
|
+
}, "Performance"), /*#__PURE__*/_react["default"].createElement("p", {
|
|
400
|
+
style: {
|
|
401
|
+
margin: '4px 0',
|
|
402
|
+
fontSize: '13px',
|
|
403
|
+
color: '#666'
|
|
404
|
+
}
|
|
405
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Rating:"), " ", data.rating || '4.2/5.0'), /*#__PURE__*/_react["default"].createElement("p", {
|
|
406
|
+
style: {
|
|
407
|
+
margin: '4px 0',
|
|
408
|
+
fontSize: '13px',
|
|
409
|
+
color: '#666'
|
|
410
|
+
}
|
|
411
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Projects:"), " ", data.projects || '12 completed'), /*#__PURE__*/_react["default"].createElement("p", {
|
|
412
|
+
style: {
|
|
413
|
+
margin: '4px 0',
|
|
414
|
+
fontSize: '13px',
|
|
415
|
+
color: '#666'
|
|
416
|
+
}
|
|
417
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Last Review:"), " ", data.lastReview || 'March 2024'))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
418
|
+
style: {
|
|
419
|
+
marginTop: '16px',
|
|
420
|
+
paddingTop: '16px',
|
|
421
|
+
borderTop: '1px solid #dee2e6'
|
|
422
|
+
}
|
|
423
|
+
}, /*#__PURE__*/_react["default"].createElement("h4", {
|
|
424
|
+
style: {
|
|
425
|
+
margin: '0 0 8px 0',
|
|
426
|
+
color: '#495057',
|
|
427
|
+
fontSize: '14px'
|
|
428
|
+
}
|
|
429
|
+
}, "Recent Activities"), /*#__PURE__*/_react["default"].createElement("div", {
|
|
430
|
+
style: {
|
|
431
|
+
fontSize: '13px',
|
|
432
|
+
color: '#666'
|
|
433
|
+
}
|
|
434
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
435
|
+
style: {
|
|
436
|
+
margin: '4px 0'
|
|
437
|
+
}
|
|
438
|
+
}, "\u2022 Completed Q1 Performance Review"), /*#__PURE__*/_react["default"].createElement("p", {
|
|
439
|
+
style: {
|
|
440
|
+
margin: '4px 0'
|
|
441
|
+
}
|
|
442
|
+
}, "\u2022 Attended React Training Workshop"), /*#__PURE__*/_react["default"].createElement("p", {
|
|
443
|
+
style: {
|
|
444
|
+
margin: '4px 0'
|
|
445
|
+
}
|
|
446
|
+
}, "\u2022 Led Project Alpha implementation"), /*#__PURE__*/_react["default"].createElement("p", {
|
|
447
|
+
style: {
|
|
448
|
+
margin: '4px 0'
|
|
449
|
+
}
|
|
450
|
+
}, "\u2022 Mentored 2 junior developers"))));
|
|
451
|
+
};
|
|
452
|
+
var _default = exports["default"] = {
|
|
453
|
+
title: 'Components/Table',
|
|
454
|
+
component: _Table["default"],
|
|
455
|
+
parameters: {
|
|
456
|
+
layout: 'padded',
|
|
457
|
+
docs: {
|
|
458
|
+
description: {
|
|
459
|
+
component: 'A comprehensive table component that supports client-side and server-side pagination, sorting, searching, expandable rows, and more.'
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
tags: ['autodocs'],
|
|
464
|
+
argTypes: {
|
|
465
|
+
records: {
|
|
466
|
+
control: 'object',
|
|
467
|
+
description: 'Array of data records to display in the table'
|
|
468
|
+
},
|
|
469
|
+
columnConfigs: {
|
|
470
|
+
control: 'object',
|
|
471
|
+
description: 'Array of column configurations defining table structure'
|
|
472
|
+
},
|
|
473
|
+
stickyColumn: {
|
|
474
|
+
control: 'boolean',
|
|
475
|
+
description: 'Whether to make the first and last column sticky'
|
|
476
|
+
},
|
|
477
|
+
paginationType: {
|
|
478
|
+
control: 'select',
|
|
479
|
+
options: ['', 'CLIENT', 'SERVER'],
|
|
480
|
+
description: 'Type of pagination to use (empty for no pagination)'
|
|
481
|
+
},
|
|
482
|
+
pagination: {
|
|
483
|
+
control: 'boolean',
|
|
484
|
+
description: 'Whether to show pagination controls'
|
|
485
|
+
},
|
|
486
|
+
paginationComponentOptions: {
|
|
487
|
+
control: 'object',
|
|
488
|
+
description: 'Options to customize pagination component styling and behavior'
|
|
489
|
+
},
|
|
490
|
+
expandableRows: {
|
|
491
|
+
control: 'boolean',
|
|
492
|
+
description: 'Whether rows can be expanded to show additional content'
|
|
493
|
+
},
|
|
494
|
+
selectableRows: {
|
|
495
|
+
control: 'boolean',
|
|
496
|
+
description: 'Whether rows can be selected with checkboxes'
|
|
497
|
+
},
|
|
498
|
+
showSelectableRows: {
|
|
499
|
+
control: 'boolean',
|
|
500
|
+
description: 'Whether to show selectable rows with checkboxes'
|
|
501
|
+
},
|
|
502
|
+
customClassName: {
|
|
503
|
+
control: 'text',
|
|
504
|
+
description: 'Additional CSS classes for styling'
|
|
505
|
+
},
|
|
506
|
+
noDataDescription: {
|
|
507
|
+
control: 'text',
|
|
508
|
+
description: 'Description text shown when no data is available'
|
|
509
|
+
},
|
|
510
|
+
noDataHeading: {
|
|
511
|
+
control: 'text',
|
|
512
|
+
description: 'Heading text shown when no data is available'
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}; // Template for stories
|
|
516
|
+
var Template = function Template(args) {
|
|
517
|
+
return /*#__PURE__*/_react["default"].createElement(_Table["default"], args);
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
// Basic table with client-side pagination
|
|
521
|
+
var Default = exports.Default = Template.bind({});
|
|
522
|
+
Default.args = {
|
|
523
|
+
records: sampleRecords,
|
|
524
|
+
columnConfigs: basicColumnConfigs,
|
|
525
|
+
paginationType: 'CLIENT',
|
|
526
|
+
pagination: true,
|
|
527
|
+
customClassName: 'custom-table',
|
|
528
|
+
paginationComponentOptions: {
|
|
529
|
+
className: 'default-pagination-styling'
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
// Table without pagination
|
|
534
|
+
var NoPagination = exports.NoPagination = Template.bind({});
|
|
535
|
+
NoPagination.args = {
|
|
536
|
+
records: sampleRecords,
|
|
537
|
+
columnConfigs: basicColumnConfigs,
|
|
538
|
+
pagination: false,
|
|
539
|
+
customClassName: 'custom-table'
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
// Table with custom styling
|
|
543
|
+
var CustomStyling = exports.CustomStyling = Template.bind({});
|
|
544
|
+
CustomStyling.args = {
|
|
545
|
+
records: sampleRecords,
|
|
546
|
+
columnConfigs: basicColumnConfigs,
|
|
547
|
+
paginationType: 'CLIENT',
|
|
548
|
+
pagination: true,
|
|
549
|
+
customClassName: 'custom-table-styled'
|
|
550
|
+
};
|
|
551
|
+
|
|
552
|
+
// Table with no data
|
|
553
|
+
var NoDataDefault = exports.NoDataDefault = Template.bind({});
|
|
554
|
+
NoDataDefault.args = {
|
|
555
|
+
records: [],
|
|
556
|
+
columnConfigs: basicColumnConfigs,
|
|
557
|
+
paginationType: 'CLIENT',
|
|
558
|
+
pagination: true,
|
|
559
|
+
customClassName: 'custom-table'
|
|
81
560
|
};
|
|
82
561
|
|
|
83
|
-
|
|
84
|
-
var
|
|
85
|
-
var
|
|
86
|
-
parentRecord = _props$parentRecord === void 0 ? {} : _props$parentRecord;
|
|
87
|
-
var id = parentRecord.id;
|
|
88
|
-
var _useState = (0, _react.useState)({}),
|
|
562
|
+
// Table with custom no data component
|
|
563
|
+
var CustomNoDataComponent = exports.CustomNoDataComponent = function CustomNoDataComponent() {
|
|
564
|
+
var _useState = (0, _react.useState)(false),
|
|
89
565
|
_useState2 = _slicedToArray(_useState, 2),
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
var
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
566
|
+
hasData = _useState2[0],
|
|
567
|
+
setHasData = _useState2[1];
|
|
568
|
+
var CustomNoData = function CustomNoData(_ref3) {
|
|
569
|
+
var description = _ref3.description,
|
|
570
|
+
heading = _ref3.heading;
|
|
571
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
572
|
+
style: {
|
|
573
|
+
padding: '40px 20px',
|
|
574
|
+
textAlign: 'center',
|
|
575
|
+
backgroundColor: '#f8f9fa',
|
|
576
|
+
borderRadius: '8px',
|
|
577
|
+
border: '2px dashed #dee2e6',
|
|
578
|
+
margin: '20px'
|
|
579
|
+
}
|
|
580
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
581
|
+
style: {
|
|
582
|
+
fontSize: '48px',
|
|
583
|
+
color: '#6c757d',
|
|
584
|
+
marginBottom: '16px'
|
|
585
|
+
}
|
|
586
|
+
}, "\uD83D\uDCCA"), /*#__PURE__*/_react["default"].createElement("div", {
|
|
587
|
+
style: {
|
|
588
|
+
fontSize: '20px',
|
|
589
|
+
fontWeight: 'bold',
|
|
590
|
+
color: '#495057',
|
|
591
|
+
marginBottom: '8px'
|
|
592
|
+
}
|
|
593
|
+
}, heading || 'No Data Available'), /*#__PURE__*/_react["default"].createElement("div", {
|
|
594
|
+
style: {
|
|
595
|
+
fontSize: '14px',
|
|
596
|
+
color: '#6c757d',
|
|
597
|
+
marginBottom: '20px',
|
|
598
|
+
lineHeight: '1.5'
|
|
599
|
+
}
|
|
600
|
+
}, description || 'There are no records to display at the moment.'), /*#__PURE__*/_react["default"].createElement("div", {
|
|
601
|
+
style: {
|
|
602
|
+
display: 'flex',
|
|
603
|
+
gap: '12px',
|
|
604
|
+
justifyContent: 'center',
|
|
605
|
+
flexWrap: 'wrap'
|
|
606
|
+
}
|
|
607
|
+
}));
|
|
608
|
+
};
|
|
609
|
+
var CustomNoDataWithIcon = function CustomNoDataWithIcon(_ref4) {
|
|
610
|
+
var description = _ref4.description,
|
|
611
|
+
heading = _ref4.heading;
|
|
612
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
613
|
+
style: {
|
|
614
|
+
padding: '60px 20px',
|
|
615
|
+
textAlign: 'center',
|
|
616
|
+
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
617
|
+
borderRadius: '12px',
|
|
618
|
+
color: 'white',
|
|
619
|
+
margin: '20px'
|
|
620
|
+
}
|
|
621
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
622
|
+
style: {
|
|
623
|
+
fontSize: '64px',
|
|
624
|
+
marginBottom: '16px'
|
|
625
|
+
}
|
|
626
|
+
}, "\uD83D\uDD0D"), /*#__PURE__*/_react["default"].createElement("div", {
|
|
627
|
+
style: {
|
|
628
|
+
fontSize: '24px',
|
|
629
|
+
fontWeight: 'bold',
|
|
630
|
+
marginBottom: '12px'
|
|
631
|
+
}
|
|
632
|
+
}, heading || 'No Results Found'), /*#__PURE__*/_react["default"].createElement("div", {
|
|
633
|
+
style: {
|
|
634
|
+
fontSize: '16px',
|
|
635
|
+
opacity: '0.9',
|
|
636
|
+
marginBottom: '24px',
|
|
637
|
+
lineHeight: '1.6'
|
|
638
|
+
}
|
|
639
|
+
}, description || 'We couldn\'t find any data matching your criteria.'), /*#__PURE__*/_react["default"].createElement("div", {
|
|
640
|
+
style: {
|
|
641
|
+
display: 'flex',
|
|
642
|
+
gap: '16px',
|
|
643
|
+
justifyContent: 'center',
|
|
644
|
+
flexWrap: 'wrap'
|
|
645
|
+
}
|
|
646
|
+
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
647
|
+
onClick: function onClick() {
|
|
648
|
+
return setHasData(true);
|
|
649
|
+
},
|
|
650
|
+
style: {
|
|
651
|
+
padding: '12px 24px',
|
|
652
|
+
backgroundColor: 'rgba(255, 255, 255, 0.2)',
|
|
653
|
+
color: 'white',
|
|
654
|
+
border: '2px solid rgba(255, 255, 255, 0.3)',
|
|
655
|
+
borderRadius: '8px',
|
|
656
|
+
cursor: 'pointer',
|
|
657
|
+
fontSize: '14px',
|
|
658
|
+
fontWeight: '500',
|
|
659
|
+
transition: 'all 0.3s ease'
|
|
660
|
+
},
|
|
661
|
+
onMouseOver: function onMouseOver(e) {
|
|
662
|
+
e.target.style.backgroundColor = 'rgba(255, 255, 255, 0.3)';
|
|
663
|
+
e.target.style.borderColor = 'rgba(255, 255, 255, 0.5)';
|
|
664
|
+
},
|
|
665
|
+
onMouseOut: function onMouseOut(e) {
|
|
666
|
+
e.target.style.backgroundColor = 'rgba(255, 255, 255, 0.2)';
|
|
667
|
+
e.target.style.borderColor = 'rgba(255, 255, 255, 0.3)';
|
|
668
|
+
}
|
|
669
|
+
}, "Try Again"), /*#__PURE__*/_react["default"].createElement("button", {
|
|
670
|
+
onClick: function onClick() {
|
|
671
|
+
return setHasData(false);
|
|
672
|
+
},
|
|
673
|
+
style: {
|
|
674
|
+
padding: '12px 24px',
|
|
675
|
+
backgroundColor: 'transparent',
|
|
676
|
+
color: 'white',
|
|
677
|
+
border: '2px solid rgba(255, 255, 255, 0.3)',
|
|
678
|
+
borderRadius: '8px',
|
|
679
|
+
cursor: 'pointer',
|
|
680
|
+
fontSize: '14px',
|
|
681
|
+
fontWeight: '500',
|
|
682
|
+
transition: 'all 0.3s ease'
|
|
683
|
+
},
|
|
684
|
+
onMouseOver: function onMouseOver(e) {
|
|
685
|
+
e.target.style.backgroundColor = 'rgba(255, 255, 255, 0.1)';
|
|
686
|
+
},
|
|
687
|
+
onMouseOut: function onMouseOut(e) {
|
|
688
|
+
e.target.style.backgroundColor = 'transparent';
|
|
689
|
+
}
|
|
690
|
+
}, "Clear")));
|
|
691
|
+
};
|
|
692
|
+
var CustomNoDataMinimal = function CustomNoDataMinimal(_ref5) {
|
|
693
|
+
var description = _ref5.description,
|
|
694
|
+
heading = _ref5.heading;
|
|
695
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
696
|
+
style: {
|
|
697
|
+
padding: '80px 20px',
|
|
698
|
+
textAlign: 'center',
|
|
699
|
+
backgroundColor: '#ffffff',
|
|
700
|
+
borderRadius: '8px',
|
|
701
|
+
border: '1px solid #e9ecef',
|
|
702
|
+
margin: '20px'
|
|
703
|
+
}
|
|
704
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
705
|
+
style: {
|
|
706
|
+
width: '80px',
|
|
707
|
+
height: '80px',
|
|
708
|
+
margin: '0 auto 24px',
|
|
709
|
+
borderRadius: '50%',
|
|
710
|
+
backgroundColor: '#f8f9fa',
|
|
711
|
+
display: 'flex',
|
|
712
|
+
alignItems: 'center',
|
|
713
|
+
justifyContent: 'center',
|
|
714
|
+
fontSize: '32px',
|
|
715
|
+
color: '#adb5bd'
|
|
716
|
+
}
|
|
717
|
+
}, "\uD83D\uDCCB"), /*#__PURE__*/_react["default"].createElement("div", {
|
|
718
|
+
style: {
|
|
719
|
+
fontSize: '18px',
|
|
720
|
+
fontWeight: '600',
|
|
721
|
+
color: '#343a40',
|
|
722
|
+
marginBottom: '8px'
|
|
723
|
+
}
|
|
724
|
+
}, heading || 'Empty State'), /*#__PURE__*/_react["default"].createElement("div", {
|
|
725
|
+
style: {
|
|
726
|
+
fontSize: '14px',
|
|
727
|
+
color: '#6c757d',
|
|
728
|
+
marginBottom: '32px',
|
|
729
|
+
maxWidth: '300px',
|
|
730
|
+
marginLeft: 'auto',
|
|
731
|
+
marginRight: 'auto',
|
|
732
|
+
lineHeight: '1.5'
|
|
733
|
+
}
|
|
734
|
+
}, description || 'This table is currently empty. Add some data to get started.'), /*#__PURE__*/_react["default"].createElement("button", {
|
|
735
|
+
onClick: function onClick() {
|
|
736
|
+
return setHasData(true);
|
|
737
|
+
},
|
|
738
|
+
style: {
|
|
739
|
+
padding: '10px 20px',
|
|
740
|
+
backgroundColor: '#007bff',
|
|
741
|
+
color: 'white',
|
|
742
|
+
border: 'none',
|
|
743
|
+
borderRadius: '6px',
|
|
744
|
+
cursor: 'pointer',
|
|
745
|
+
fontSize: '14px',
|
|
746
|
+
fontWeight: '500',
|
|
747
|
+
transition: 'background-color 0.2s ease'
|
|
748
|
+
},
|
|
749
|
+
onMouseOver: function onMouseOver(e) {
|
|
750
|
+
e.target.style.backgroundColor = '#0056b3';
|
|
751
|
+
},
|
|
752
|
+
onMouseOut: function onMouseOut(e) {
|
|
753
|
+
e.target.style.backgroundColor = '#007bff';
|
|
754
|
+
}
|
|
755
|
+
}, "Add Sample Data"));
|
|
756
|
+
};
|
|
757
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
758
|
+
style: {
|
|
759
|
+
marginBottom: '2rem'
|
|
98
760
|
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
761
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
762
|
+
style: {
|
|
763
|
+
marginTop: '1rem',
|
|
764
|
+
display: 'flex',
|
|
765
|
+
gap: '1rem',
|
|
766
|
+
flexWrap: 'wrap'
|
|
767
|
+
}
|
|
768
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
769
|
+
style: {
|
|
770
|
+
marginBottom: '3rem'
|
|
771
|
+
}
|
|
772
|
+
}, /*#__PURE__*/_react["default"].createElement("h4", {
|
|
773
|
+
style: {
|
|
774
|
+
marginBottom: '1rem',
|
|
775
|
+
color: '#495057'
|
|
776
|
+
}
|
|
777
|
+
}, "Custom No Data Component"), /*#__PURE__*/_react["default"].createElement(_Table["default"], {
|
|
778
|
+
records: hasData ? sampleRecords : [],
|
|
779
|
+
columnConfigs: basicColumnConfigs,
|
|
780
|
+
paginationType: "CLIENT",
|
|
781
|
+
pagination: true,
|
|
782
|
+
customClassName: "custom-table",
|
|
783
|
+
CustomNoDataComponent: CustomNoData
|
|
784
|
+
})));
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
// Interactive example with state management
|
|
788
|
+
var SelectableRows = exports.SelectableRows = function SelectableRows() {
|
|
789
|
+
var _useState3 = (0, _react.useState)([]),
|
|
790
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
791
|
+
selectedRows = _useState4[0],
|
|
792
|
+
setSelectedRows = _useState4[1];
|
|
793
|
+
var handleSelectionChange = function handleSelectionChange(rows) {
|
|
794
|
+
setSelectedRows(rows);
|
|
795
|
+
console.log('Selected rows:', rows);
|
|
104
796
|
};
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
797
|
+
|
|
798
|
+
// Create a mock API response formatter for the sample data
|
|
799
|
+
var responseFormatter = function responseFormatter(response) {
|
|
800
|
+
return {
|
|
801
|
+
entries: response || [],
|
|
802
|
+
total: response ? 20 : 0
|
|
803
|
+
};
|
|
804
|
+
};
|
|
805
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
806
|
+
style: {
|
|
807
|
+
marginBottom: '1rem'
|
|
109
808
|
}
|
|
110
|
-
}]
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
809
|
+
}, /*#__PURE__*/_react["default"].createElement("h3", null, "Table with Selectable Rows"), /*#__PURE__*/_react["default"].createElement("p", null, "This table allows you to select rows using checkboxes with server-side implementation."), selectedRows.length > 0 && /*#__PURE__*/_react["default"].createElement("div", {
|
|
810
|
+
style: {
|
|
811
|
+
marginTop: '8px',
|
|
812
|
+
padding: '8px 12px',
|
|
813
|
+
backgroundColor: '#e3f2fd',
|
|
814
|
+
borderRadius: '4px',
|
|
815
|
+
fontSize: '14px'
|
|
816
|
+
}
|
|
817
|
+
}, "Selected: ", selectedRows.length, " row(s) with ids - ", selectedRows.map(function (row) {
|
|
818
|
+
return row.id;
|
|
819
|
+
}).join(', '))), /*#__PURE__*/_react["default"].createElement(_Table["default"], {
|
|
820
|
+
columnConfigs: postsColumnConfigs,
|
|
821
|
+
paginationType: "SERVER",
|
|
822
|
+
pagination: true,
|
|
823
|
+
showSelectableRows: true,
|
|
824
|
+
setSelectedRow: handleSelectionChange,
|
|
825
|
+
CheckBoxRow: CustomCheckBoxRow,
|
|
826
|
+
customClassName: "custom-table",
|
|
827
|
+
apiInfo: {
|
|
828
|
+
pageNoKey: '_page',
|
|
829
|
+
perPageKey: '_limit',
|
|
830
|
+
searchBy: 'q',
|
|
831
|
+
requestId: 'getPosts',
|
|
832
|
+
responseFormatter: responseFormatter,
|
|
833
|
+
requestParam: {
|
|
834
|
+
_page: 1,
|
|
835
|
+
_limit: 10,
|
|
836
|
+
q: ''
|
|
837
|
+
}
|
|
838
|
+
},
|
|
839
|
+
onApiError: function onApiError(error) {
|
|
840
|
+
return console.error('API Error:', error);
|
|
841
|
+
}
|
|
842
|
+
}));
|
|
115
843
|
};
|
|
116
|
-
/* eslint-enable react/prop-types */
|
|
117
844
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
845
|
+
// Table with custom column formatting
|
|
846
|
+
var CustomColumnFormatting = exports.CustomColumnFormatting = Template.bind({});
|
|
847
|
+
CustomColumnFormatting.args = {
|
|
848
|
+
records: sampleRecords,
|
|
849
|
+
columnConfigs: [{
|
|
850
|
+
name: 'Employee Name',
|
|
851
|
+
sortable: true,
|
|
852
|
+
cell: function cell(row) {
|
|
853
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
854
|
+
style: {
|
|
855
|
+
display: 'flex',
|
|
856
|
+
alignItems: 'center',
|
|
857
|
+
gap: '8px'
|
|
858
|
+
},
|
|
859
|
+
className: "tbl-content"
|
|
860
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
861
|
+
style: {
|
|
862
|
+
width: '32px',
|
|
863
|
+
height: '32px',
|
|
864
|
+
borderRadius: '50%',
|
|
865
|
+
backgroundColor: '#007bff',
|
|
866
|
+
display: 'flex',
|
|
867
|
+
alignItems: 'center',
|
|
868
|
+
justifyContent: 'center',
|
|
869
|
+
color: 'white',
|
|
870
|
+
fontSize: '14px',
|
|
871
|
+
fontWeight: 'bold'
|
|
872
|
+
}
|
|
873
|
+
}, row.name.charAt(0)), /*#__PURE__*/_react["default"].createElement("span", null, row.name));
|
|
874
|
+
},
|
|
875
|
+
width: '200px'
|
|
876
|
+
}, {
|
|
877
|
+
name: 'Email',
|
|
878
|
+
selector: function selector(row) {
|
|
879
|
+
return row.email;
|
|
880
|
+
},
|
|
881
|
+
cell: function cell(row) {
|
|
882
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
883
|
+
className: "tbl-content"
|
|
884
|
+
}, row.email);
|
|
885
|
+
},
|
|
886
|
+
sortable: true,
|
|
887
|
+
width: '250px'
|
|
888
|
+
}, {
|
|
889
|
+
name: 'Department',
|
|
890
|
+
selector: function selector(row) {
|
|
891
|
+
return row.department;
|
|
892
|
+
},
|
|
893
|
+
sortable: true,
|
|
894
|
+
cell: function cell(row) {
|
|
895
|
+
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
896
|
+
style: {
|
|
897
|
+
padding: '4px 8px',
|
|
898
|
+
borderRadius: '12px',
|
|
899
|
+
fontSize: '12px',
|
|
900
|
+
fontWeight: '500',
|
|
901
|
+
backgroundColor: row.department === 'Engineering' ? '#e3f2fd' : row.department === 'Marketing' ? '#f3e5f5' : row.department === 'Sales' ? '#e8f5e8' : '#fff3e0',
|
|
902
|
+
color: row.department === 'Engineering' ? '#1976d2' : row.department === 'Marketing' ? '#7b1fa2' : row.department === 'Sales' ? '#388e3c' : '#f57c00'
|
|
903
|
+
},
|
|
904
|
+
className: "tbl-content"
|
|
905
|
+
}, row.department);
|
|
906
|
+
},
|
|
907
|
+
width: '150px'
|
|
908
|
+
}, {
|
|
909
|
+
name: 'Salary',
|
|
910
|
+
selector: function selector(row) {
|
|
911
|
+
return row.salary;
|
|
912
|
+
},
|
|
913
|
+
sortable: true,
|
|
914
|
+
cell: function cell(row) {
|
|
915
|
+
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
916
|
+
style: {
|
|
917
|
+
fontWeight: 'bold',
|
|
918
|
+
color: row.salary > 75000 ? '#4caf50' : '#ff9800'
|
|
919
|
+
},
|
|
920
|
+
className: "tbl-content"
|
|
921
|
+
}, "$", row.salary.toLocaleString());
|
|
922
|
+
},
|
|
923
|
+
width: '120px'
|
|
924
|
+
}],
|
|
925
|
+
paginationType: 'CLIENT',
|
|
926
|
+
pagination: true,
|
|
927
|
+
customClassName: 'custom-table'
|
|
123
928
|
};
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
929
|
+
|
|
930
|
+
// Table with different pagination positions
|
|
931
|
+
var BottomPagination = exports.BottomPagination = Template.bind({});
|
|
932
|
+
BottomPagination.args = {
|
|
933
|
+
records: sampleRecords,
|
|
934
|
+
columnConfigs: basicColumnConfigs,
|
|
935
|
+
paginationType: 'CLIENT',
|
|
936
|
+
pagination: true,
|
|
937
|
+
customClassName: 'custom-table bottom-pagination'
|
|
131
938
|
};
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
939
|
+
|
|
940
|
+
// Server-side table with posts data
|
|
941
|
+
var ServerSidePagination = exports.ServerSidePagination = function ServerSidePagination() {
|
|
942
|
+
var _useState5 = (0, _react.useState)([]),
|
|
943
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
944
|
+
selectedRows = _useState6[0],
|
|
945
|
+
setSelectedRows = _useState6[1];
|
|
946
|
+
var _useState7 = (0, _react.useState)(false),
|
|
947
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
948
|
+
refreshTrigger = _useState8[0],
|
|
949
|
+
setRefreshTrigger = _useState8[1];
|
|
950
|
+
var responseFormatter = function responseFormatter(response) {
|
|
141
951
|
return {
|
|
142
|
-
|
|
952
|
+
entries: response || [],
|
|
953
|
+
total: response ? 30 : 0
|
|
143
954
|
};
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
955
|
+
};
|
|
956
|
+
var handleRefresh = function handleRefresh() {
|
|
957
|
+
setRefreshTrigger(!refreshTrigger);
|
|
958
|
+
};
|
|
959
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
960
|
+
style: {
|
|
961
|
+
marginBottom: '1rem'
|
|
962
|
+
}
|
|
963
|
+
}, /*#__PURE__*/_react["default"].createElement("h3", null, "Server-Side Posts Table"), /*#__PURE__*/_react["default"].createElement("p", null, "This table fetches posts data from JSONPlaceholder API with custom formatting."), /*#__PURE__*/_react["default"].createElement("div", {
|
|
964
|
+
style: {
|
|
965
|
+
display: 'flex',
|
|
966
|
+
gap: '1rem',
|
|
967
|
+
alignItems: 'center',
|
|
968
|
+
marginTop: '8px'
|
|
969
|
+
}
|
|
970
|
+
}, selectedRows.length > 0 && /*#__PURE__*/_react["default"].createElement("span", {
|
|
971
|
+
style: {
|
|
972
|
+
fontSize: '14px',
|
|
973
|
+
color: '#666'
|
|
974
|
+
}
|
|
975
|
+
}, "Selected: ", selectedRows.length, " post(s)"))), /*#__PURE__*/_react["default"].createElement(_Table["default"], {
|
|
976
|
+
columnConfigs: postsColumnConfigs,
|
|
977
|
+
paginationType: "SERVER",
|
|
978
|
+
pagination: true,
|
|
979
|
+
showSelectableRows: true,
|
|
980
|
+
setSelectedRow: setSelectedRows,
|
|
981
|
+
CheckBoxRow: CustomCheckBoxRow,
|
|
982
|
+
refreshData: refreshTrigger,
|
|
983
|
+
customClassName: "custom-table",
|
|
984
|
+
apiInfo: {
|
|
985
|
+
pageNoKey: '_page',
|
|
986
|
+
perPageKey: '_limit',
|
|
987
|
+
searchBy: 'q',
|
|
988
|
+
requestId: 'getPosts',
|
|
989
|
+
responseFormatter: responseFormatter
|
|
990
|
+
},
|
|
991
|
+
onApiError: function onApiError(error) {
|
|
992
|
+
return console.error('API Error:', error);
|
|
993
|
+
}
|
|
994
|
+
}));
|
|
995
|
+
};
|
|
996
|
+
|
|
997
|
+
// Table with refresh functionality
|
|
998
|
+
var RefreshTable = exports.RefreshTable = function RefreshTable() {
|
|
999
|
+
var _useState9 = (0, _react.useState)(sampleRecords),
|
|
1000
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
1001
|
+
data = _useState0[0],
|
|
1002
|
+
setData = _useState0[1];
|
|
1003
|
+
var _useState1 = (0, _react.useState)(0),
|
|
1004
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
1005
|
+
refreshCount = _useState10[0],
|
|
1006
|
+
setRefreshCount = _useState10[1];
|
|
1007
|
+
var handleRefresh = function handleRefresh() {
|
|
1008
|
+
setRefreshCount(function (prev) {
|
|
1009
|
+
return prev + 1;
|
|
1010
|
+
});
|
|
1011
|
+
// Simulate data refresh
|
|
1012
|
+
setData([].concat(sampleRecords).sort(function () {
|
|
1013
|
+
return Math.random() - 0.5;
|
|
1014
|
+
}));
|
|
1015
|
+
};
|
|
1016
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1017
|
+
style: {
|
|
1018
|
+
marginBottom: '1rem'
|
|
1019
|
+
}
|
|
1020
|
+
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
1021
|
+
onClick: handleRefresh,
|
|
1022
|
+
style: {
|
|
1023
|
+
padding: '8px 16px',
|
|
1024
|
+
backgroundColor: '#28a745',
|
|
1025
|
+
color: 'white',
|
|
1026
|
+
border: 'none',
|
|
1027
|
+
borderRadius: '4px',
|
|
1028
|
+
cursor: 'pointer'
|
|
1029
|
+
}
|
|
1030
|
+
}, "Refresh Data (Refresh Count: ", refreshCount, ")")), /*#__PURE__*/_react["default"].createElement(_Table["default"], {
|
|
1031
|
+
records: data,
|
|
1032
|
+
columnConfigs: basicColumnConfigs,
|
|
1033
|
+
paginationType: "CLIENT",
|
|
1034
|
+
pagination: true,
|
|
1035
|
+
refreshData: refreshCount,
|
|
1036
|
+
customClassName: "custom-table"
|
|
1037
|
+
}));
|
|
1038
|
+
};
|
|
1039
|
+
|
|
1040
|
+
// Expandable rows story
|
|
1041
|
+
var ExpandableRows = exports.ExpandableRows = function ExpandableRows() {
|
|
1042
|
+
var expandableColumnConfigs = [{
|
|
1043
|
+
name: 'Name',
|
|
1044
|
+
selector: function selector(row) {
|
|
1045
|
+
return row.name;
|
|
1046
|
+
},
|
|
1047
|
+
sortable: true,
|
|
1048
|
+
cell: function cell(row) {
|
|
1049
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1050
|
+
className: "tbl-content",
|
|
1051
|
+
style: {
|
|
1052
|
+
display: 'flex',
|
|
1053
|
+
alignItems: 'center',
|
|
1054
|
+
gap: '8px'
|
|
1055
|
+
}
|
|
1056
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1057
|
+
style: {
|
|
1058
|
+
width: '32px',
|
|
1059
|
+
height: '32px',
|
|
1060
|
+
borderRadius: '50%',
|
|
1061
|
+
backgroundColor: '#007bff',
|
|
1062
|
+
display: 'flex',
|
|
1063
|
+
alignItems: 'center',
|
|
1064
|
+
justifyContent: 'center',
|
|
1065
|
+
color: 'white',
|
|
1066
|
+
fontSize: '14px',
|
|
1067
|
+
fontWeight: 'bold'
|
|
1068
|
+
}
|
|
1069
|
+
}, row.name.charAt(0)), /*#__PURE__*/_react["default"].createElement("span", null, row.name));
|
|
1070
|
+
},
|
|
1071
|
+
width: '200px'
|
|
1072
|
+
}, {
|
|
1073
|
+
name: 'Department',
|
|
1074
|
+
selector: function selector(row) {
|
|
1075
|
+
return row.department;
|
|
1076
|
+
},
|
|
1077
|
+
sortable: true,
|
|
1078
|
+
cell: function cell(row) {
|
|
1079
|
+
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
1080
|
+
style: {
|
|
1081
|
+
padding: '4px 8px',
|
|
1082
|
+
borderRadius: '12px',
|
|
1083
|
+
fontSize: '12px',
|
|
1084
|
+
fontWeight: '500',
|
|
1085
|
+
backgroundColor: row.department === 'Engineering' ? '#e3f2fd' : row.department === 'Marketing' ? '#f3e5f5' : row.department === 'Sales' ? '#e8f5e8' : '#fff3e0',
|
|
1086
|
+
color: row.department === 'Engineering' ? '#1976d2' : row.department === 'Marketing' ? '#7b1fa2' : row.department === 'Sales' ? '#388e3c' : '#f57c00'
|
|
1087
|
+
},
|
|
1088
|
+
className: "tbl-content"
|
|
1089
|
+
}, row.department);
|
|
1090
|
+
},
|
|
1091
|
+
width: '150px'
|
|
1092
|
+
}, {
|
|
1093
|
+
name: 'Position',
|
|
1094
|
+
selector: function selector(row) {
|
|
1095
|
+
return row.position;
|
|
1096
|
+
},
|
|
1097
|
+
sortable: true,
|
|
1098
|
+
cell: function cell(row) {
|
|
1099
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1100
|
+
className: "tbl-content"
|
|
1101
|
+
}, row.position);
|
|
1102
|
+
},
|
|
1103
|
+
width: '180px'
|
|
1104
|
+
}, {
|
|
1105
|
+
name: 'Salary',
|
|
1106
|
+
selector: function selector(row) {
|
|
1107
|
+
return row.salary;
|
|
1108
|
+
},
|
|
1109
|
+
sortable: true,
|
|
1110
|
+
cell: function cell(row) {
|
|
1111
|
+
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
1112
|
+
style: {
|
|
1113
|
+
fontWeight: 'bold',
|
|
1114
|
+
color: row.salary > 75000 ? '#4caf50' : '#ff9800'
|
|
1115
|
+
},
|
|
1116
|
+
className: "tbl-content"
|
|
1117
|
+
}, "$", row.salary.toLocaleString());
|
|
1118
|
+
},
|
|
1119
|
+
width: '120px'
|
|
1120
|
+
}, {
|
|
1121
|
+
name: 'Status',
|
|
1122
|
+
selector: function selector(row) {
|
|
1123
|
+
return row.status || 'Active';
|
|
1124
|
+
},
|
|
1125
|
+
sortable: true,
|
|
1126
|
+
cell: function cell(row) {
|
|
1127
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1128
|
+
className: "tbl-content"
|
|
1129
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
1130
|
+
style: {
|
|
1131
|
+
padding: '4px 8px',
|
|
1132
|
+
borderRadius: '12px',
|
|
1133
|
+
fontSize: '12px',
|
|
1134
|
+
fontWeight: 'bold',
|
|
1135
|
+
backgroundColor: '#e8f5e8',
|
|
1136
|
+
color: '#28a745'
|
|
1137
|
+
}
|
|
1138
|
+
}, "Active"));
|
|
1139
|
+
},
|
|
1140
|
+
width: '100px'
|
|
1141
|
+
}];
|
|
1142
|
+
|
|
1143
|
+
// Enhanced sample data with positions
|
|
1144
|
+
var expandableRowsData = [{
|
|
1145
|
+
id: 1,
|
|
1146
|
+
name: 'John Doe',
|
|
1147
|
+
department: 'Engineering',
|
|
1148
|
+
position: 'Senior Software Engineer',
|
|
1149
|
+
salary: 85000
|
|
1150
|
+
}, {
|
|
1151
|
+
id: 2,
|
|
1152
|
+
name: 'Jane Smith',
|
|
1153
|
+
department: 'Marketing',
|
|
1154
|
+
position: 'Marketing Manager',
|
|
1155
|
+
salary: 70000
|
|
1156
|
+
}, {
|
|
1157
|
+
id: 3,
|
|
1158
|
+
name: 'Bob Johnson',
|
|
1159
|
+
department: 'Sales',
|
|
1160
|
+
position: 'Sales Director',
|
|
1161
|
+
salary: 95000
|
|
1162
|
+
}, {
|
|
1163
|
+
id: 4,
|
|
1164
|
+
name: 'Alice Brown',
|
|
1165
|
+
department: 'Engineering',
|
|
1166
|
+
position: 'Tech Lead',
|
|
1167
|
+
salary: 92000
|
|
1168
|
+
}, {
|
|
1169
|
+
id: 5,
|
|
1170
|
+
name: 'Charlie Wilson',
|
|
1171
|
+
department: 'HR',
|
|
1172
|
+
position: 'HR Business Partner',
|
|
1173
|
+
salary: 65000
|
|
1174
|
+
}, {
|
|
1175
|
+
id: 6,
|
|
1176
|
+
name: 'Diana Davis',
|
|
1177
|
+
department: 'Marketing',
|
|
1178
|
+
position: 'Content Strategist',
|
|
1179
|
+
salary: 60000
|
|
1180
|
+
}, {
|
|
1181
|
+
id: 7,
|
|
1182
|
+
name: 'Edward Miller',
|
|
1183
|
+
department: 'Sales',
|
|
1184
|
+
position: 'Account Executive',
|
|
1185
|
+
salary: 75000
|
|
1186
|
+
}, {
|
|
1187
|
+
id: 8,
|
|
1188
|
+
name: 'Fiona Garcia',
|
|
1189
|
+
department: 'Engineering',
|
|
1190
|
+
position: 'Frontend Developer',
|
|
1191
|
+
salary: 78000
|
|
1192
|
+
}, {
|
|
1193
|
+
id: 9,
|
|
1194
|
+
name: 'George Martinez',
|
|
1195
|
+
department: 'HR',
|
|
1196
|
+
position: 'Talent Acquisition',
|
|
1197
|
+
salary: 62000
|
|
1198
|
+
}, {
|
|
1199
|
+
id: 10,
|
|
1200
|
+
name: 'Helen Taylor',
|
|
1201
|
+
department: 'Marketing',
|
|
1202
|
+
position: 'Digital Marketing Specialist',
|
|
1203
|
+
salary: 58000
|
|
1204
|
+
}];
|
|
1205
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1206
|
+
style: {
|
|
1207
|
+
marginBottom: '1rem'
|
|
1208
|
+
}
|
|
1209
|
+
}, /*#__PURE__*/_react["default"].createElement("h3", null, "Table with Expandable Rows"), /*#__PURE__*/_react["default"].createElement("p", null, "Click on any row to expand it and see additional details about the employee."), /*#__PURE__*/_react["default"].createElement("div", {
|
|
1210
|
+
style: {
|
|
1211
|
+
backgroundColor: '#e3f2fd',
|
|
1212
|
+
padding: '12px',
|
|
1213
|
+
borderRadius: '6px',
|
|
1214
|
+
marginTop: '12px',
|
|
1215
|
+
fontSize: '14px',
|
|
1216
|
+
color: '#1565c0'
|
|
1217
|
+
}
|
|
1218
|
+
}, "\uD83D\uDCA1 ", /*#__PURE__*/_react["default"].createElement("strong", null, "Feature:"), " Each row can be expanded to show detailed information including contact details, employment history, and performance metrics.")), /*#__PURE__*/_react["default"].createElement(_Table["default"], {
|
|
1219
|
+
records: expandableRowsData,
|
|
1220
|
+
columnConfigs: expandableColumnConfigs,
|
|
1221
|
+
paginationType: "CLIENT",
|
|
1222
|
+
pagination: true,
|
|
1223
|
+
expandableRows: true,
|
|
1224
|
+
expandableRowsComponent: ExpandableRowContent,
|
|
1225
|
+
customClassName: "custom-table expandable-table"
|
|
153
1226
|
}));
|
|
154
1227
|
};
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
1228
|
+
|
|
1229
|
+
// Simple expandable rows example
|
|
1230
|
+
var SimpleExpandableRows = exports.SimpleExpandableRows = function SimpleExpandableRows() {
|
|
1231
|
+
var SimpleExpandableContent = function SimpleExpandableContent(_ref6) {
|
|
1232
|
+
var data = _ref6.data;
|
|
1233
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1234
|
+
style: {
|
|
1235
|
+
padding: '16px',
|
|
1236
|
+
backgroundColor: '#f4f8ff',
|
|
1237
|
+
borderRadius: '4px',
|
|
1238
|
+
margin: '0'
|
|
1239
|
+
}
|
|
1240
|
+
}, /*#__PURE__*/_react["default"].createElement("h4", {
|
|
1241
|
+
style: {
|
|
1242
|
+
margin: '0 0 8px 0',
|
|
1243
|
+
fontSize: '16px',
|
|
1244
|
+
color: '#333'
|
|
1245
|
+
}
|
|
1246
|
+
}, "Additional Information for ", data.name), /*#__PURE__*/_react["default"].createElement("p", {
|
|
1247
|
+
style: {
|
|
1248
|
+
margin: '4px 0',
|
|
1249
|
+
color: '#666'
|
|
1250
|
+
}
|
|
1251
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Employee ID:"), " EMP-", data.id.toString().padStart(4, '0')), /*#__PURE__*/_react["default"].createElement("p", {
|
|
1252
|
+
style: {
|
|
1253
|
+
margin: '4px 0',
|
|
1254
|
+
color: '#666'
|
|
1255
|
+
}
|
|
1256
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Email:"), " ", data.email), /*#__PURE__*/_react["default"].createElement("p", {
|
|
1257
|
+
style: {
|
|
1258
|
+
margin: '4px 0',
|
|
1259
|
+
color: '#666'
|
|
1260
|
+
}
|
|
1261
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Full Department:"), " ", data.department, " Department"), /*#__PURE__*/_react["default"].createElement("p", {
|
|
1262
|
+
style: {
|
|
1263
|
+
margin: '4px 0',
|
|
1264
|
+
color: '#666'
|
|
1265
|
+
}
|
|
1266
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Annual Salary:"), " $", data.salary.toLocaleString()), /*#__PURE__*/_react["default"].createElement("p", {
|
|
1267
|
+
style: {
|
|
1268
|
+
margin: '4px 0',
|
|
1269
|
+
color: '#666'
|
|
1270
|
+
}
|
|
1271
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Age:"), " ", data.age, " years old"));
|
|
1272
|
+
};
|
|
1273
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1274
|
+
style: {
|
|
1275
|
+
marginBottom: '1rem'
|
|
1276
|
+
}
|
|
1277
|
+
}, /*#__PURE__*/_react["default"].createElement("h3", null, "Simple Expandable Rows"), /*#__PURE__*/_react["default"].createElement("p", null, "A simpler example of expandable rows with basic additional information.")), /*#__PURE__*/_react["default"].createElement(_Table["default"], {
|
|
1278
|
+
records: sampleRecords.slice(0, 8),
|
|
1279
|
+
columnConfigs: basicColumnConfigs,
|
|
1280
|
+
paginationType: "CLIENT",
|
|
1281
|
+
pagination: true,
|
|
1282
|
+
expandableRows: true,
|
|
1283
|
+
expandableRowsComponent: SimpleExpandableContent,
|
|
1284
|
+
customClassName: "custom-table"
|
|
160
1285
|
}));
|
|
161
1286
|
};
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
1287
|
+
|
|
1288
|
+
// Expandable rows with conditional expansion
|
|
1289
|
+
var ConditionalExpandableRows = exports.ConditionalExpandableRows = function ConditionalExpandableRows() {
|
|
1290
|
+
var ConditionalExpandableContent = function ConditionalExpandableContent(_ref7) {
|
|
1291
|
+
var data = _ref7.data;
|
|
1292
|
+
// Only show expansion for certain departments
|
|
1293
|
+
if (!['Engineering', 'Sales'].includes(data.department)) {
|
|
1294
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1295
|
+
style: {
|
|
1296
|
+
padding: '16px',
|
|
1297
|
+
backgroundColor: '#f4f8ff',
|
|
1298
|
+
border: '1px solid #ffeaa7',
|
|
1299
|
+
borderRadius: '4px',
|
|
1300
|
+
margin: '0',
|
|
1301
|
+
textAlign: 'center'
|
|
1302
|
+
}
|
|
1303
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
1304
|
+
style: {
|
|
1305
|
+
margin: 0,
|
|
1306
|
+
color: '#856404'
|
|
1307
|
+
}
|
|
1308
|
+
}, "\uD83D\uDCCB No additional details available for ", data.department, " department."));
|
|
1309
|
+
}
|
|
1310
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1311
|
+
style: {
|
|
1312
|
+
padding: '20px',
|
|
1313
|
+
backgroundColor: '#f8f9fa',
|
|
1314
|
+
border: '1px solid #dee2e6',
|
|
1315
|
+
borderRadius: '6px',
|
|
1316
|
+
margin: '8px 0'
|
|
1317
|
+
}
|
|
1318
|
+
}, /*#__PURE__*/_react["default"].createElement("h4", {
|
|
1319
|
+
style: {
|
|
1320
|
+
margin: '0 0 12px 0',
|
|
1321
|
+
color: '#495057'
|
|
1322
|
+
}
|
|
1323
|
+
}, data.department, " Department Details"), data.department === 'Engineering' && /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("p", {
|
|
1324
|
+
style: {
|
|
1325
|
+
margin: '4px 0',
|
|
1326
|
+
color: '#666'
|
|
1327
|
+
}
|
|
1328
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Programming Languages:"), " JavaScript, Python, Java"), /*#__PURE__*/_react["default"].createElement("p", {
|
|
1329
|
+
style: {
|
|
1330
|
+
margin: '4px 0',
|
|
1331
|
+
color: '#666'
|
|
1332
|
+
}
|
|
1333
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Current Project:"), " React Dashboard Redesign"), /*#__PURE__*/_react["default"].createElement("p", {
|
|
1334
|
+
style: {
|
|
1335
|
+
margin: '4px 0',
|
|
1336
|
+
color: '#666'
|
|
1337
|
+
}
|
|
1338
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Certifications:"), " AWS Solutions Architect, React Professional"), /*#__PURE__*/_react["default"].createElement("p", {
|
|
1339
|
+
style: {
|
|
1340
|
+
margin: '4px 0',
|
|
1341
|
+
color: '#666'
|
|
1342
|
+
}
|
|
1343
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Code Reviews:"), " 45 completed this quarter")), data.department === 'Sales' && /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("p", {
|
|
1344
|
+
style: {
|
|
1345
|
+
margin: '4px 0',
|
|
1346
|
+
color: '#666'
|
|
1347
|
+
}
|
|
1348
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Territory:"), " West Coast Region"), /*#__PURE__*/_react["default"].createElement("p", {
|
|
1349
|
+
style: {
|
|
1350
|
+
margin: '4px 0',
|
|
1351
|
+
color: '#666'
|
|
1352
|
+
}
|
|
1353
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Q1 Sales:"), " $125,000 (120% of target)"), /*#__PURE__*/_react["default"].createElement("p", {
|
|
1354
|
+
style: {
|
|
1355
|
+
margin: '4px 0',
|
|
1356
|
+
color: '#666'
|
|
1357
|
+
}
|
|
1358
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Active Deals:"), " 12 opportunities in pipeline"), /*#__PURE__*/_react["default"].createElement("p", {
|
|
1359
|
+
style: {
|
|
1360
|
+
margin: '4px 0',
|
|
1361
|
+
color: '#666'
|
|
1362
|
+
}
|
|
1363
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Client Satisfaction:"), " 4.8/5.0 average rating")));
|
|
173
1364
|
};
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
1365
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1366
|
+
style: {
|
|
1367
|
+
marginBottom: '1rem'
|
|
1368
|
+
}
|
|
1369
|
+
}, /*#__PURE__*/_react["default"].createElement("h3", null, "Conditional Expandable Rows"), /*#__PURE__*/_react["default"].createElement("p", null, "This example shows different content based on the row data. Engineering and Sales show detailed info, others show a simple message."), /*#__PURE__*/_react["default"].createElement("div", {
|
|
1370
|
+
style: {
|
|
1371
|
+
backgroundColor: '#fff3cd',
|
|
1372
|
+
padding: '8px 12px',
|
|
1373
|
+
borderRadius: '4px',
|
|
1374
|
+
fontSize: '13px',
|
|
1375
|
+
color: '#856404',
|
|
1376
|
+
marginTop: '8px'
|
|
1377
|
+
}
|
|
1378
|
+
}, "\uD83D\uDCA1 Try expanding rows from different departments to see the conditional content.")), /*#__PURE__*/_react["default"].createElement(_Table["default"], {
|
|
1379
|
+
records: sampleRecords.slice(0, 10),
|
|
1380
|
+
columnConfigs: basicColumnConfigs,
|
|
1381
|
+
paginationType: "CLIENT",
|
|
1382
|
+
pagination: true,
|
|
1383
|
+
expandableRows: true,
|
|
1384
|
+
expandableRowsComponent: ConditionalExpandableContent,
|
|
1385
|
+
customClassName: "custom-table"
|
|
1386
|
+
}));
|
|
1387
|
+
};
|
|
1388
|
+
|
|
1389
|
+
// Sample data with more columns for sticky testing
|
|
1390
|
+
var stickyTestRecords = [{
|
|
1391
|
+
id: 1,
|
|
1392
|
+
name: 'John Doe',
|
|
1393
|
+
email: 'john.doe@example.com',
|
|
1394
|
+
age: 30,
|
|
1395
|
+
department: 'Engineering',
|
|
1396
|
+
salary: 75000,
|
|
1397
|
+
location: 'New York',
|
|
1398
|
+
status: 'Active'
|
|
1399
|
+
}, {
|
|
1400
|
+
id: 2,
|
|
1401
|
+
name: 'Jane Smith',
|
|
1402
|
+
email: 'jane.smith@example.com',
|
|
1403
|
+
age: 28,
|
|
1404
|
+
department: 'Marketing',
|
|
1405
|
+
salary: 65000,
|
|
1406
|
+
location: 'Los Angeles',
|
|
1407
|
+
status: 'Active'
|
|
1408
|
+
}, {
|
|
1409
|
+
id: 3,
|
|
1410
|
+
name: 'Bob Johnson',
|
|
1411
|
+
email: 'bob.johnson@example.com',
|
|
1412
|
+
age: 35,
|
|
1413
|
+
department: 'Sales',
|
|
1414
|
+
salary: 80000,
|
|
1415
|
+
location: 'Chicago',
|
|
1416
|
+
status: 'Inactive'
|
|
1417
|
+
}, {
|
|
1418
|
+
id: 4,
|
|
1419
|
+
name: 'Alice Brown',
|
|
1420
|
+
email: 'alice.brown@example.com',
|
|
1421
|
+
age: 32,
|
|
1422
|
+
department: 'Engineering',
|
|
1423
|
+
salary: 78000,
|
|
1424
|
+
location: 'Seattle',
|
|
1425
|
+
status: 'Active'
|
|
1426
|
+
}, {
|
|
1427
|
+
id: 5,
|
|
1428
|
+
name: 'Charlie Wilson',
|
|
1429
|
+
email: 'charlie.wilson@example.com',
|
|
1430
|
+
age: 29,
|
|
1431
|
+
department: 'HR',
|
|
1432
|
+
salary: 60000,
|
|
1433
|
+
location: 'Austin',
|
|
1434
|
+
status: 'Active'
|
|
1435
|
+
}, {
|
|
1436
|
+
id: 6,
|
|
1437
|
+
name: 'Diana Davis',
|
|
1438
|
+
email: 'diana.davis@example.com',
|
|
1439
|
+
age: 31,
|
|
1440
|
+
department: 'Marketing',
|
|
1441
|
+
salary: 67000,
|
|
1442
|
+
location: 'Miami',
|
|
1443
|
+
status: 'Active'
|
|
1444
|
+
}, {
|
|
1445
|
+
id: 7,
|
|
1446
|
+
name: 'Edward Miller',
|
|
1447
|
+
email: 'edward.miller@example.com',
|
|
1448
|
+
age: 33,
|
|
1449
|
+
department: 'Sales',
|
|
1450
|
+
salary: 82000,
|
|
1451
|
+
location: 'Denver',
|
|
1452
|
+
status: 'Inactive'
|
|
1453
|
+
}, {
|
|
1454
|
+
id: 8,
|
|
1455
|
+
name: 'Fiona Garcia',
|
|
1456
|
+
email: 'fiona.garcia@example.com',
|
|
1457
|
+
age: 27,
|
|
1458
|
+
department: 'Engineering',
|
|
1459
|
+
salary: 72000,
|
|
1460
|
+
location: 'Portland',
|
|
1461
|
+
status: 'Active'
|
|
1462
|
+
}];
|
|
1463
|
+
|
|
1464
|
+
// Column configs with sticky first column
|
|
1465
|
+
var stickyFirstColumnConfigs = [{
|
|
1466
|
+
name: 'ID',
|
|
1467
|
+
selector: function selector(row) {
|
|
1468
|
+
return row.id;
|
|
1469
|
+
},
|
|
1470
|
+
sortable: true,
|
|
1471
|
+
cell: function cell(row) {
|
|
1472
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1473
|
+
className: "tbl-content",
|
|
1474
|
+
style: {
|
|
1475
|
+
fontWeight: 'bold',
|
|
1476
|
+
color: '#007bff'
|
|
1477
|
+
}
|
|
1478
|
+
}, row.id);
|
|
1479
|
+
},
|
|
1480
|
+
width: '80px',
|
|
1481
|
+
stickyColumn: true // First column sticky
|
|
1482
|
+
}, {
|
|
1483
|
+
name: 'Name',
|
|
1484
|
+
selector: function selector(row) {
|
|
1485
|
+
return row.name;
|
|
1486
|
+
},
|
|
1487
|
+
sortable: true,
|
|
1488
|
+
cell: function cell(row) {
|
|
1489
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1490
|
+
className: "tbl-content"
|
|
1491
|
+
}, row.name);
|
|
1492
|
+
},
|
|
1493
|
+
width: '150px'
|
|
1494
|
+
}, {
|
|
1495
|
+
name: 'Email',
|
|
1496
|
+
selector: function selector(row) {
|
|
1497
|
+
return row.email;
|
|
1498
|
+
},
|
|
1499
|
+
sortable: true,
|
|
1500
|
+
cell: function cell(row) {
|
|
1501
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1502
|
+
className: "tbl-content"
|
|
1503
|
+
}, row.email);
|
|
1504
|
+
},
|
|
1505
|
+
width: '200px'
|
|
1506
|
+
}, {
|
|
1507
|
+
name: 'Age',
|
|
1508
|
+
selector: function selector(row) {
|
|
1509
|
+
return row.age;
|
|
1510
|
+
},
|
|
1511
|
+
sortable: true,
|
|
1512
|
+
cell: function cell(row) {
|
|
1513
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1514
|
+
className: "tbl-content"
|
|
1515
|
+
}, row.age);
|
|
1516
|
+
},
|
|
1517
|
+
width: '80px'
|
|
1518
|
+
}, {
|
|
1519
|
+
name: 'Department',
|
|
1520
|
+
selector: function selector(row) {
|
|
1521
|
+
return row.department;
|
|
1522
|
+
},
|
|
1523
|
+
sortable: true,
|
|
1524
|
+
cell: function cell(row) {
|
|
1525
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1526
|
+
className: "tbl-content"
|
|
1527
|
+
}, row.department);
|
|
1528
|
+
},
|
|
1529
|
+
width: '130px'
|
|
1530
|
+
}, {
|
|
1531
|
+
name: 'Salary',
|
|
1532
|
+
selector: function selector(row) {
|
|
1533
|
+
return "$".concat(row.salary.toLocaleString());
|
|
1534
|
+
},
|
|
1535
|
+
sortable: true,
|
|
1536
|
+
cell: function cell(row) {
|
|
1537
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1538
|
+
className: "tbl-content"
|
|
1539
|
+
}, "$", row.salary.toLocaleString());
|
|
1540
|
+
},
|
|
1541
|
+
width: '100px'
|
|
1542
|
+
}, {
|
|
1543
|
+
name: 'Location',
|
|
1544
|
+
selector: function selector(row) {
|
|
1545
|
+
return row.location;
|
|
1546
|
+
},
|
|
1547
|
+
sortable: true,
|
|
1548
|
+
cell: function cell(row) {
|
|
1549
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1550
|
+
className: "tbl-content"
|
|
1551
|
+
}, row.location);
|
|
1552
|
+
},
|
|
1553
|
+
width: '120px'
|
|
1554
|
+
}, {
|
|
1555
|
+
name: 'Status',
|
|
1556
|
+
selector: function selector(row) {
|
|
1557
|
+
return row.status;
|
|
1558
|
+
},
|
|
1559
|
+
sortable: true,
|
|
1560
|
+
cell: function cell(row) {
|
|
1561
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1562
|
+
className: "tbl-content"
|
|
1563
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
1564
|
+
style: {
|
|
1565
|
+
padding: '4px 8px',
|
|
1566
|
+
borderRadius: '12px',
|
|
1567
|
+
fontSize: '12px',
|
|
1568
|
+
fontWeight: 'bold',
|
|
1569
|
+
backgroundColor: row.status === 'Active' ? '#e8f5e8' : '#ffe6e6',
|
|
1570
|
+
color: row.status === 'Active' ? '#28a745' : '#dc3545'
|
|
1571
|
+
}
|
|
1572
|
+
}, row.status));
|
|
1573
|
+
},
|
|
1574
|
+
width: '100px'
|
|
1575
|
+
}];
|
|
1576
|
+
|
|
1577
|
+
// Column configs with sticky last column
|
|
1578
|
+
var stickyLastColumnConfigs = [{
|
|
1579
|
+
name: 'ID',
|
|
1580
|
+
selector: function selector(row) {
|
|
1581
|
+
return row.id;
|
|
1582
|
+
},
|
|
1583
|
+
sortable: true,
|
|
1584
|
+
cell: function cell(row) {
|
|
1585
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1586
|
+
className: "tbl-content"
|
|
1587
|
+
}, row.id);
|
|
1588
|
+
},
|
|
1589
|
+
width: '80px'
|
|
1590
|
+
}, {
|
|
1591
|
+
name: 'Name',
|
|
1592
|
+
selector: function selector(row) {
|
|
1593
|
+
return row.name;
|
|
1594
|
+
},
|
|
1595
|
+
sortable: true,
|
|
1596
|
+
cell: function cell(row) {
|
|
1597
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1598
|
+
className: "tbl-content"
|
|
1599
|
+
}, row.name);
|
|
1600
|
+
},
|
|
1601
|
+
width: '150px'
|
|
1602
|
+
}, {
|
|
1603
|
+
name: 'Email',
|
|
1604
|
+
selector: function selector(row) {
|
|
1605
|
+
return row.email;
|
|
1606
|
+
},
|
|
1607
|
+
sortable: true,
|
|
1608
|
+
cell: function cell(row) {
|
|
1609
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1610
|
+
className: "tbl-content"
|
|
1611
|
+
}, row.email);
|
|
1612
|
+
},
|
|
1613
|
+
width: '200px'
|
|
1614
|
+
}, {
|
|
1615
|
+
name: 'Age',
|
|
1616
|
+
selector: function selector(row) {
|
|
1617
|
+
return row.age;
|
|
1618
|
+
},
|
|
1619
|
+
sortable: true,
|
|
1620
|
+
cell: function cell(row) {
|
|
1621
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1622
|
+
className: "tbl-content"
|
|
1623
|
+
}, row.age);
|
|
1624
|
+
},
|
|
1625
|
+
width: '80px'
|
|
1626
|
+
}, {
|
|
1627
|
+
name: 'Department',
|
|
1628
|
+
selector: function selector(row) {
|
|
1629
|
+
return row.department;
|
|
1630
|
+
},
|
|
1631
|
+
sortable: true,
|
|
1632
|
+
cell: function cell(row) {
|
|
1633
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1634
|
+
className: "tbl-content"
|
|
1635
|
+
}, row.department);
|
|
1636
|
+
},
|
|
1637
|
+
width: '130px'
|
|
1638
|
+
}, {
|
|
1639
|
+
name: 'Salary',
|
|
1640
|
+
selector: function selector(row) {
|
|
1641
|
+
return "$".concat(row.salary.toLocaleString());
|
|
1642
|
+
},
|
|
1643
|
+
sortable: true,
|
|
1644
|
+
cell: function cell(row) {
|
|
1645
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1646
|
+
className: "tbl-content"
|
|
1647
|
+
}, "$", row.salary.toLocaleString());
|
|
1648
|
+
},
|
|
1649
|
+
width: '100px'
|
|
1650
|
+
}, {
|
|
1651
|
+
name: 'Location',
|
|
1652
|
+
selector: function selector(row) {
|
|
1653
|
+
return row.location;
|
|
1654
|
+
},
|
|
1655
|
+
sortable: true,
|
|
1656
|
+
cell: function cell(row) {
|
|
1657
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1658
|
+
className: "tbl-content"
|
|
1659
|
+
}, row.location);
|
|
1660
|
+
},
|
|
1661
|
+
width: '120px'
|
|
1662
|
+
}, {
|
|
1663
|
+
name: 'Actions',
|
|
1664
|
+
selector: function selector(row) {
|
|
1665
|
+
return 'actions';
|
|
1666
|
+
},
|
|
1667
|
+
sortable: false,
|
|
1668
|
+
cell: function cell(row) {
|
|
1669
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1670
|
+
className: "tbl-content"
|
|
1671
|
+
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
1672
|
+
style: {
|
|
1673
|
+
padding: '4px 8px',
|
|
1674
|
+
marginRight: '4px',
|
|
1675
|
+
backgroundColor: '#007bff',
|
|
1676
|
+
color: 'white',
|
|
1677
|
+
border: 'none',
|
|
1678
|
+
borderRadius: '4px',
|
|
1679
|
+
cursor: 'pointer',
|
|
1680
|
+
fontSize: '12px'
|
|
1681
|
+
},
|
|
1682
|
+
onClick: function onClick() {
|
|
1683
|
+
return alert("Edit ".concat(row.name));
|
|
1684
|
+
}
|
|
1685
|
+
}, "Edit"), /*#__PURE__*/_react["default"].createElement("button", {
|
|
1686
|
+
style: {
|
|
1687
|
+
padding: '4px 8px',
|
|
1688
|
+
backgroundColor: '#dc3545',
|
|
1689
|
+
color: 'white',
|
|
1690
|
+
border: 'none',
|
|
1691
|
+
borderRadius: '4px',
|
|
1692
|
+
cursor: 'pointer',
|
|
1693
|
+
fontSize: '12px'
|
|
1694
|
+
},
|
|
1695
|
+
onClick: function onClick() {
|
|
1696
|
+
return alert("Delete ".concat(row.name));
|
|
1697
|
+
}
|
|
1698
|
+
}, "Delete"));
|
|
1699
|
+
},
|
|
1700
|
+
width: '120px',
|
|
1701
|
+
stickyColumn: true // Last column sticky
|
|
1702
|
+
}];
|
|
1703
|
+
|
|
1704
|
+
// Table with sticky first column
|
|
1705
|
+
var StickyFirstColumn = exports.StickyFirstColumn = function StickyFirstColumn() {
|
|
1706
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1707
|
+
style: {
|
|
1708
|
+
marginBottom: '1rem'
|
|
1709
|
+
}
|
|
1710
|
+
}, /*#__PURE__*/_react["default"].createElement("h3", null, "Sticky First Column Table"), /*#__PURE__*/_react["default"].createElement("p", null, "The first column (ID) is sticky and will remain visible when scrolling horizontally."), /*#__PURE__*/_react["default"].createElement("p", {
|
|
1711
|
+
style: {
|
|
1712
|
+
color: '#666',
|
|
1713
|
+
fontSize: '14px'
|
|
1714
|
+
}
|
|
1715
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Class applied:"), " ", /*#__PURE__*/_react["default"].createElement("code", null, "first-clm-sticky"))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
1716
|
+
style: {
|
|
1717
|
+
width: '800px',
|
|
1718
|
+
overflowX: 'auto',
|
|
1719
|
+
borderRight: '1px solid #ddd'
|
|
1720
|
+
}
|
|
1721
|
+
}, /*#__PURE__*/_react["default"].createElement(_Table["default"], {
|
|
1722
|
+
records: stickyTestRecords,
|
|
1723
|
+
columnConfigs: stickyFirstColumnConfigs,
|
|
1724
|
+
paginationType: "CLIENT",
|
|
1725
|
+
pagination: true,
|
|
1726
|
+
customClassName: "custom-table"
|
|
1727
|
+
})));
|
|
1728
|
+
};
|
|
1729
|
+
|
|
1730
|
+
// Table with sticky last column
|
|
1731
|
+
var StickyLastColumn = exports.StickyLastColumn = function StickyLastColumn() {
|
|
1732
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1733
|
+
style: {
|
|
1734
|
+
marginBottom: '1rem'
|
|
1735
|
+
}
|
|
1736
|
+
}, /*#__PURE__*/_react["default"].createElement("h3", null, "Sticky Last Column Table"), /*#__PURE__*/_react["default"].createElement("p", null, "The last column (Actions) is sticky and will remain visible when scrolling horizontally."), /*#__PURE__*/_react["default"].createElement("p", {
|
|
1737
|
+
style: {
|
|
1738
|
+
color: '#666',
|
|
1739
|
+
fontSize: '14px'
|
|
1740
|
+
}
|
|
1741
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Class applied:"), " ", /*#__PURE__*/_react["default"].createElement("code", null, "last-clm-sticky"))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
1742
|
+
style: {
|
|
1743
|
+
width: '800px',
|
|
1744
|
+
overflowX: 'auto',
|
|
1745
|
+
border: '1px solid #ddd'
|
|
1746
|
+
}
|
|
1747
|
+
}, /*#__PURE__*/_react["default"].createElement(_Table["default"], {
|
|
1748
|
+
records: stickyTestRecords,
|
|
1749
|
+
columnConfigs: stickyLastColumnConfigs,
|
|
1750
|
+
paginationType: "CLIENT",
|
|
1751
|
+
pagination: true,
|
|
1752
|
+
customClassName: "custom-table"
|
|
1753
|
+
})));
|
|
1754
|
+
};
|
|
1755
|
+
|
|
1756
|
+
// Table without sticky columns (for comparison)
|
|
1757
|
+
var NoStickyColumn = exports.NoStickyColumn = function NoStickyColumn() {
|
|
1758
|
+
var regularColumnConfigs = stickyFirstColumnConfigs.map(function (col) {
|
|
1759
|
+
return _objectSpread(_objectSpread({}, col), {}, {
|
|
1760
|
+
stickyColumn: false // Ensure no sticky columns
|
|
177
1761
|
});
|
|
1762
|
+
});
|
|
1763
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1764
|
+
style: {
|
|
1765
|
+
marginBottom: '1rem'
|
|
1766
|
+
}
|
|
1767
|
+
}, /*#__PURE__*/_react["default"].createElement("h3", null, "Regular Table (No Sticky Columns)"), /*#__PURE__*/_react["default"].createElement("p", null, "This table has no sticky columns for comparison purposes."), /*#__PURE__*/_react["default"].createElement("p", {
|
|
1768
|
+
style: {
|
|
1769
|
+
color: '#666',
|
|
1770
|
+
fontSize: '14px'
|
|
1771
|
+
}
|
|
1772
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Classes applied:"), " Only ", /*#__PURE__*/_react["default"].createElement("code", null, "nutana-table"))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
1773
|
+
style: {
|
|
1774
|
+
width: '800px',
|
|
1775
|
+
overflowX: 'auto',
|
|
1776
|
+
border: '1px solid #ddd'
|
|
1777
|
+
}
|
|
1778
|
+
}, /*#__PURE__*/_react["default"].createElement(_Table["default"], {
|
|
1779
|
+
records: stickyTestRecords,
|
|
1780
|
+
columnConfigs: regularColumnConfigs,
|
|
1781
|
+
paginationType: "CLIENT",
|
|
1782
|
+
pagination: true,
|
|
1783
|
+
customClassName: "custom-table"
|
|
1784
|
+
})));
|
|
1785
|
+
};
|
|
1786
|
+
|
|
1787
|
+
// Column configs with both first and last columns sticky
|
|
1788
|
+
var stickyBothColumnConfigs = [{
|
|
1789
|
+
name: 'ID',
|
|
1790
|
+
selector: function selector(row) {
|
|
1791
|
+
return row.id;
|
|
1792
|
+
},
|
|
1793
|
+
sortable: true,
|
|
1794
|
+
cell: function cell(row) {
|
|
1795
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1796
|
+
className: "tbl-content",
|
|
1797
|
+
style: {
|
|
1798
|
+
fontWeight: 'bold',
|
|
1799
|
+
color: '#007bff'
|
|
1800
|
+
}
|
|
1801
|
+
}, row.id);
|
|
1802
|
+
},
|
|
1803
|
+
width: '80px',
|
|
1804
|
+
stickyColumn: true // First column sticky
|
|
1805
|
+
}, {
|
|
1806
|
+
name: 'Name',
|
|
1807
|
+
selector: function selector(row) {
|
|
1808
|
+
return row.name;
|
|
1809
|
+
},
|
|
1810
|
+
sortable: true,
|
|
1811
|
+
cell: function cell(row) {
|
|
1812
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1813
|
+
className: "tbl-content"
|
|
1814
|
+
}, row.name);
|
|
1815
|
+
},
|
|
1816
|
+
width: '150px'
|
|
1817
|
+
}, {
|
|
1818
|
+
name: 'Email',
|
|
1819
|
+
selector: function selector(row) {
|
|
1820
|
+
return row.email;
|
|
1821
|
+
},
|
|
1822
|
+
sortable: true,
|
|
1823
|
+
cell: function cell(row) {
|
|
1824
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1825
|
+
className: "tbl-content"
|
|
1826
|
+
}, row.email);
|
|
1827
|
+
},
|
|
1828
|
+
width: '200px'
|
|
1829
|
+
}, {
|
|
1830
|
+
name: 'Age',
|
|
1831
|
+
selector: function selector(row) {
|
|
1832
|
+
return row.age;
|
|
1833
|
+
},
|
|
1834
|
+
sortable: true,
|
|
1835
|
+
cell: function cell(row) {
|
|
1836
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1837
|
+
className: "tbl-content"
|
|
1838
|
+
}, row.age);
|
|
1839
|
+
},
|
|
1840
|
+
width: '80px'
|
|
1841
|
+
}, {
|
|
1842
|
+
name: 'Department',
|
|
1843
|
+
selector: function selector(row) {
|
|
1844
|
+
return row.department;
|
|
1845
|
+
},
|
|
1846
|
+
sortable: true,
|
|
1847
|
+
cell: function cell(row) {
|
|
1848
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1849
|
+
className: "tbl-content"
|
|
1850
|
+
}, row.department);
|
|
1851
|
+
},
|
|
1852
|
+
width: '130px'
|
|
1853
|
+
}, {
|
|
1854
|
+
name: 'Salary',
|
|
1855
|
+
selector: function selector(row) {
|
|
1856
|
+
return "$".concat(row.salary.toLocaleString());
|
|
1857
|
+
},
|
|
1858
|
+
sortable: true,
|
|
1859
|
+
cell: function cell(row) {
|
|
1860
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1861
|
+
className: "tbl-content"
|
|
1862
|
+
}, "$", row.salary.toLocaleString());
|
|
1863
|
+
},
|
|
1864
|
+
width: '100px'
|
|
1865
|
+
}, {
|
|
1866
|
+
name: 'Location',
|
|
1867
|
+
selector: function selector(row) {
|
|
1868
|
+
return row.location;
|
|
1869
|
+
},
|
|
1870
|
+
sortable: true,
|
|
1871
|
+
cell: function cell(row) {
|
|
1872
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1873
|
+
className: "tbl-content"
|
|
1874
|
+
}, row.location);
|
|
1875
|
+
},
|
|
1876
|
+
width: '120px'
|
|
1877
|
+
}, {
|
|
1878
|
+
name: 'Actions',
|
|
1879
|
+
selector: function selector(row) {
|
|
1880
|
+
return 'actions';
|
|
1881
|
+
},
|
|
1882
|
+
sortable: false,
|
|
1883
|
+
cell: function cell(row) {
|
|
1884
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1885
|
+
className: "tbl-content"
|
|
1886
|
+
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
1887
|
+
style: {
|
|
1888
|
+
padding: '4px 8px',
|
|
1889
|
+
marginRight: '4px',
|
|
1890
|
+
backgroundColor: '#28a745',
|
|
1891
|
+
color: 'white',
|
|
1892
|
+
border: 'none',
|
|
1893
|
+
borderRadius: '4px',
|
|
1894
|
+
cursor: 'pointer',
|
|
1895
|
+
fontSize: '12px'
|
|
1896
|
+
},
|
|
1897
|
+
onClick: function onClick() {
|
|
1898
|
+
return alert("View ".concat(row.name));
|
|
1899
|
+
}
|
|
1900
|
+
}, "View"), /*#__PURE__*/_react["default"].createElement("button", {
|
|
1901
|
+
style: {
|
|
1902
|
+
padding: '4px 8px',
|
|
1903
|
+
marginRight: '4px',
|
|
1904
|
+
backgroundColor: '#007bff',
|
|
1905
|
+
color: 'white',
|
|
1906
|
+
border: 'none',
|
|
1907
|
+
borderRadius: '4px',
|
|
1908
|
+
cursor: 'pointer',
|
|
1909
|
+
fontSize: '12px'
|
|
1910
|
+
},
|
|
1911
|
+
onClick: function onClick() {
|
|
1912
|
+
return alert("Edit ".concat(row.name));
|
|
1913
|
+
}
|
|
1914
|
+
}, "Edit"), /*#__PURE__*/_react["default"].createElement("button", {
|
|
1915
|
+
style: {
|
|
1916
|
+
padding: '4px 8px',
|
|
1917
|
+
backgroundColor: '#dc3545',
|
|
1918
|
+
color: 'white',
|
|
1919
|
+
border: 'none',
|
|
1920
|
+
borderRadius: '4px',
|
|
1921
|
+
cursor: 'pointer',
|
|
1922
|
+
fontSize: '12px'
|
|
1923
|
+
},
|
|
1924
|
+
onClick: function onClick() {
|
|
1925
|
+
return alert("Delete ".concat(row.name));
|
|
1926
|
+
}
|
|
1927
|
+
}, "Delete"));
|
|
1928
|
+
},
|
|
1929
|
+
width: '180px',
|
|
1930
|
+
stickyColumn: true // Last column sticky
|
|
1931
|
+
}];
|
|
1932
|
+
|
|
1933
|
+
// Table with both first and last columns sticky
|
|
1934
|
+
var StickyBothColumns = exports.StickyBothColumns = function StickyBothColumns() {
|
|
1935
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1936
|
+
style: {
|
|
1937
|
+
marginBottom: '1rem'
|
|
1938
|
+
}
|
|
1939
|
+
}, /*#__PURE__*/_react["default"].createElement("h3", null, "Sticky First & Last Columns Table"), /*#__PURE__*/_react["default"].createElement("p", null, "Both the first column (ID) and last column (Actions) are sticky and will remain visible when scrolling horizontally."), /*#__PURE__*/_react["default"].createElement("p", {
|
|
1940
|
+
style: {
|
|
1941
|
+
color: '#666',
|
|
1942
|
+
fontSize: '14px'
|
|
1943
|
+
}
|
|
1944
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Classes applied:"), " ", /*#__PURE__*/_react["default"].createElement("code", null, "first-clm-sticky"), " and ", /*#__PURE__*/_react["default"].createElement("code", null, "last-clm-sticky")), /*#__PURE__*/_react["default"].createElement("div", {
|
|
1945
|
+
style: {
|
|
1946
|
+
backgroundColor: '#f8f9fa',
|
|
1947
|
+
padding: '8px 12px',
|
|
1948
|
+
borderRadius: '4px',
|
|
1949
|
+
marginTop: '8px',
|
|
1950
|
+
fontSize: '13px',
|
|
1951
|
+
color: '#495057'
|
|
1952
|
+
}
|
|
1953
|
+
}, "\uD83D\uDCA1 ", /*#__PURE__*/_react["default"].createElement("strong", null, "Testing tip:"), " Scroll horizontally to see both ID and Actions columns remain fixed while middle columns scroll.")), /*#__PURE__*/_react["default"].createElement("div", {
|
|
1954
|
+
style: {
|
|
1955
|
+
width: '800px',
|
|
1956
|
+
overflowX: 'auto',
|
|
1957
|
+
border: '1px solid #ddd'
|
|
1958
|
+
}
|
|
1959
|
+
}, /*#__PURE__*/_react["default"].createElement(_Table["default"], {
|
|
1960
|
+
records: stickyTestRecords,
|
|
1961
|
+
columnConfigs: stickyBothColumnConfigs,
|
|
1962
|
+
paginationType: "CLIENT",
|
|
1963
|
+
pagination: true,
|
|
1964
|
+
customClassName: "custom-table"
|
|
1965
|
+
})));
|
|
1966
|
+
};
|
|
1967
|
+
|
|
1968
|
+
// Custom pagination styling example
|
|
1969
|
+
var CustomPaginationStyling = exports.CustomPaginationStyling = Template.bind({});
|
|
1970
|
+
CustomPaginationStyling.args = {
|
|
1971
|
+
records: sampleRecords,
|
|
1972
|
+
columnConfigs: basicColumnConfigs,
|
|
1973
|
+
paginationType: 'CLIENT',
|
|
1974
|
+
pagination: true,
|
|
1975
|
+
customClassName: 'custom-table',
|
|
1976
|
+
paginationComponentOptions: {
|
|
1977
|
+
className: 'my-custom-pagination-class',
|
|
1978
|
+
// This will be applied to the 'rdt_Pagination' div
|
|
1979
|
+
rowsPerPageText: 'Records per page:',
|
|
1980
|
+
rangeSeparatorText: 'of',
|
|
1981
|
+
selectAllRowsItem: true,
|
|
1982
|
+
selectAllRowsItemText: 'All'
|
|
1983
|
+
}
|
|
1984
|
+
};
|
|
1985
|
+
|
|
1986
|
+
// Server-side pagination with custom styling
|
|
1987
|
+
var ServerSidePaginationWithCustomStyling = exports.ServerSidePaginationWithCustomStyling = function ServerSidePaginationWithCustomStyling() {
|
|
1988
|
+
var _useState11 = (0, _react.useState)([]),
|
|
1989
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
1990
|
+
selectedRows = _useState12[0],
|
|
1991
|
+
setSelectedRows = _useState12[1];
|
|
1992
|
+
var responseFormatter = function responseFormatter(response) {
|
|
1993
|
+
return {
|
|
1994
|
+
entries: response || [],
|
|
1995
|
+
total: response ? 30 : 0
|
|
1996
|
+
};
|
|
178
1997
|
};
|
|
179
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
1998
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1999
|
+
style: {
|
|
2000
|
+
marginBottom: '1rem'
|
|
2001
|
+
}
|
|
2002
|
+
}, /*#__PURE__*/_react["default"].createElement("h3", null, "Server-Side Pagination with Custom Styling"), /*#__PURE__*/_react["default"].createElement("p", null, "This example shows custom pagination styling with server-side data fetching."), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2003
|
+
style: {
|
|
2004
|
+
backgroundColor: '#e3f2fd',
|
|
2005
|
+
padding: '12px',
|
|
2006
|
+
borderRadius: '6px',
|
|
2007
|
+
marginTop: '12px',
|
|
2008
|
+
fontSize: '14px',
|
|
2009
|
+
color: '#1565c0'
|
|
2010
|
+
}
|
|
2011
|
+
}, "\uD83D\uDCA1 ", /*#__PURE__*/_react["default"].createElement("strong", null, "Custom Classes:"), " The pagination component has custom styling applied via ", /*#__PURE__*/_react["default"].createElement("code", null, "paginationComponentOptions"))), /*#__PURE__*/_react["default"].createElement(_Table["default"], {
|
|
2012
|
+
columnConfigs: postsColumnConfigs,
|
|
184
2013
|
paginationType: "SERVER",
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
2014
|
+
pagination: true,
|
|
2015
|
+
showSelectableRows: true,
|
|
2016
|
+
setSelectedRow: setSelectedRows,
|
|
2017
|
+
CheckBoxRow: CustomCheckBoxRow,
|
|
2018
|
+
customClassName: "custom-table",
|
|
2019
|
+
paginationComponentOptions: {
|
|
2020
|
+
className: 'server-pagination-custom',
|
|
2021
|
+
rowsPerPageText: 'Posts per page:',
|
|
2022
|
+
rangeSeparatorText: 'out of',
|
|
2023
|
+
selectAllRowsItem: true,
|
|
2024
|
+
selectAllRowsItemText: 'Show All'
|
|
2025
|
+
},
|
|
2026
|
+
apiInfo: {
|
|
2027
|
+
pageNoKey: '_page',
|
|
2028
|
+
perPageKey: '_limit',
|
|
2029
|
+
searchBy: 'q',
|
|
2030
|
+
requestId: 'getPosts',
|
|
2031
|
+
responseFormatter: responseFormatter
|
|
2032
|
+
},
|
|
2033
|
+
onApiError: function onApiError(error) {
|
|
2034
|
+
return console.error('API Error:', error);
|
|
2035
|
+
}
|
|
189
2036
|
}));
|
|
190
2037
|
};
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
2038
|
+
|
|
2039
|
+
// Pagination options showcase
|
|
2040
|
+
var PaginationOptionsShowcase = exports.PaginationOptionsShowcase = function PaginationOptionsShowcase() {
|
|
2041
|
+
var _useState13 = (0, _react.useState)({
|
|
2042
|
+
className: 'showcase-pagination',
|
|
2043
|
+
rowsPerPageText: 'Items per page:',
|
|
2044
|
+
rangeSeparatorText: 'of',
|
|
2045
|
+
selectAllRowsItem: true,
|
|
2046
|
+
selectAllRowsItemText: 'All Records'
|
|
2047
|
+
}),
|
|
2048
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
2049
|
+
currentOptions = _useState14[0],
|
|
2050
|
+
setCurrentOptions = _useState14[1];
|
|
2051
|
+
var optionSets = [{
|
|
2052
|
+
name: 'Default Style',
|
|
2053
|
+
options: {
|
|
2054
|
+
className: 'default-pagination',
|
|
2055
|
+
rowsPerPageText: 'Rows per page:',
|
|
2056
|
+
rangeSeparatorText: 'of',
|
|
2057
|
+
selectAllRowsItem: false
|
|
196
2058
|
}
|
|
197
|
-
}
|
|
2059
|
+
}, {
|
|
2060
|
+
name: 'Compact Style',
|
|
2061
|
+
options: {
|
|
2062
|
+
className: 'compact-pagination',
|
|
2063
|
+
rowsPerPageText: 'Per page:',
|
|
2064
|
+
rangeSeparatorText: '/',
|
|
2065
|
+
selectAllRowsItem: true,
|
|
2066
|
+
selectAllRowsItemText: 'All'
|
|
2067
|
+
}
|
|
2068
|
+
}, {
|
|
2069
|
+
name: 'Verbose Style',
|
|
2070
|
+
options: {
|
|
2071
|
+
className: 'verbose-pagination',
|
|
2072
|
+
rowsPerPageText: 'Number of records per page:',
|
|
2073
|
+
rangeSeparatorText: 'out of total',
|
|
2074
|
+
selectAllRowsItem: true,
|
|
2075
|
+
selectAllRowsItemText: 'Show All Records'
|
|
2076
|
+
}
|
|
2077
|
+
}, {
|
|
2078
|
+
name: 'Custom Brand Style',
|
|
2079
|
+
options: {
|
|
2080
|
+
className: 'brand-pagination',
|
|
2081
|
+
rowsPerPageText: 'Display:',
|
|
2082
|
+
rangeSeparatorText: 'from',
|
|
2083
|
+
selectAllRowsItem: true,
|
|
2084
|
+
selectAllRowsItemText: 'Everything'
|
|
2085
|
+
}
|
|
2086
|
+
}];
|
|
2087
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
2088
|
+
style: {
|
|
2089
|
+
marginBottom: '1rem'
|
|
2090
|
+
}
|
|
2091
|
+
}, /*#__PURE__*/_react["default"].createElement("h3", null, "Pagination Options Showcase"), /*#__PURE__*/_react["default"].createElement("p", null, "Try different pagination styling options to see how they affect the appearance and text."), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2092
|
+
style: {
|
|
2093
|
+
marginBottom: '16px'
|
|
2094
|
+
}
|
|
2095
|
+
}, /*#__PURE__*/_react["default"].createElement("label", {
|
|
2096
|
+
style: {
|
|
2097
|
+
marginRight: '8px',
|
|
2098
|
+
fontWeight: 'bold'
|
|
2099
|
+
}
|
|
2100
|
+
}, "Choose Style:"), /*#__PURE__*/_react["default"].createElement("select", {
|
|
2101
|
+
onChange: function onChange(e) {
|
|
2102
|
+
return setCurrentOptions(optionSets[e.target.value].options);
|
|
2103
|
+
},
|
|
2104
|
+
style: {
|
|
2105
|
+
padding: '4px 8px',
|
|
2106
|
+
borderRadius: '4px',
|
|
2107
|
+
border: '1px solid #ccc'
|
|
2108
|
+
}
|
|
2109
|
+
}, optionSets.map(function (set, index) {
|
|
2110
|
+
return /*#__PURE__*/_react["default"].createElement("option", {
|
|
2111
|
+
key: index,
|
|
2112
|
+
value: index
|
|
2113
|
+
}, set.name);
|
|
2114
|
+
}))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2115
|
+
style: {
|
|
2116
|
+
backgroundColor: '#f8f9fa',
|
|
2117
|
+
padding: '12px',
|
|
2118
|
+
borderRadius: '6px',
|
|
2119
|
+
fontSize: '13px',
|
|
2120
|
+
marginBottom: '16px'
|
|
2121
|
+
}
|
|
2122
|
+
}, /*#__PURE__*/_react["default"].createElement("strong", null, "Current Options:"), /*#__PURE__*/_react["default"].createElement("pre", {
|
|
2123
|
+
style: {
|
|
2124
|
+
margin: '8px 0 0 0',
|
|
2125
|
+
fontSize: '12px'
|
|
2126
|
+
}
|
|
2127
|
+
}, JSON.stringify(currentOptions, null, 2)))), /*#__PURE__*/_react["default"].createElement(_Table["default"], {
|
|
2128
|
+
records: sampleRecords,
|
|
2129
|
+
columnConfigs: basicColumnConfigs,
|
|
2130
|
+
paginationType: "CLIENT",
|
|
2131
|
+
pagination: true,
|
|
2132
|
+
customClassName: "custom-table",
|
|
2133
|
+
paginationComponentOptions: currentOptions
|
|
2134
|
+
}));
|
|
2135
|
+
};
|
|
2136
|
+
|
|
2137
|
+
// Advanced pagination styling with CSS
|
|
2138
|
+
var AdvancedPaginationStyling = exports.AdvancedPaginationStyling = function AdvancedPaginationStyling() {
|
|
2139
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("style", null, "\n .advanced-pagination {\n background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\n padding: 16px;\n border-radius: 12px;\n box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);\n }\n\n .advanced-pagination .rdt_TableFooter {\n color: white;\n font-weight: 500;\n }\n\n .advanced-pagination select {\n background: rgba(255, 255, 255, 0.2);\n color: white;\n border: 1px solid rgba(255, 255, 255, 0.3);\n border-radius: 6px;\n padding: 4px 8px;\n }\n\n .advanced-pagination button {\n background: rgba(255, 255, 255, 0.2);\n color: white;\n border: 1px solid rgba(255, 255, 255, 0.3);\n border-radius: 6px;\n padding: 8px 12px;\n margin: 0 2px;\n cursor: pointer;\n transition: all 0.3s ease;\n }\n\n .advanced-pagination button:hover:not(:disabled) {\n background: rgba(255, 255, 255, 0.3);\n transform: translateY(-1px);\n }\n\n .advanced-pagination button:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n "), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2140
|
+
style: {
|
|
2141
|
+
marginBottom: '1rem'
|
|
2142
|
+
}
|
|
2143
|
+
}, /*#__PURE__*/_react["default"].createElement("h3", null, "Advanced Pagination Styling"), /*#__PURE__*/_react["default"].createElement("p", null, "This example shows how custom CSS can be applied through the className option.")), /*#__PURE__*/_react["default"].createElement(_Table["default"], {
|
|
2144
|
+
records: sampleRecords,
|
|
2145
|
+
columnConfigs: basicColumnConfigs,
|
|
2146
|
+
paginationType: "CLIENT",
|
|
2147
|
+
pagination: true,
|
|
2148
|
+
customClassName: "custom-table",
|
|
2149
|
+
paginationComponentOptions: {
|
|
2150
|
+
className: 'advanced-pagination',
|
|
2151
|
+
rowsPerPageText: '🔢 Show:',
|
|
2152
|
+
rangeSeparatorText: '📊 of',
|
|
2153
|
+
selectAllRowsItem: true,
|
|
2154
|
+
selectAllRowsItemText: '🌟 All'
|
|
2155
|
+
}
|
|
2156
|
+
}));
|
|
198
2157
|
};
|