@helpdice/ui 1.6.9 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Placeholder/index.js +37 -16
- package/dist/auto-complete/index.js +37 -15
- package/dist/avatar/avatar.d.ts +2 -1
- package/dist/avatar/index.js +33 -13
- package/dist/badge/index.js +30 -11
- package/dist/breadcrumbs/index.js +30 -11
- package/dist/button/index.js +32 -12
- package/dist/button-dropdown/index.js +30 -11
- package/dist/button-group/index.js +30 -11
- package/dist/capacity/index.js +30 -11
- package/dist/card/index.js +30 -11
- package/dist/checkbox/index.js +30 -11
- package/dist/code/index.js +30 -11
- package/dist/col/index.js +21 -2
- package/dist/collapse/index.js +30 -11
- package/dist/css-baseline/index.js +24 -5
- package/dist/description/index.js +30 -11
- package/dist/display/index.js +30 -11
- package/dist/divider/index.js +30 -11
- package/dist/dot/index.js +30 -11
- package/dist/drawer/index.js +30 -11
- package/dist/fieldset/index.js +30 -11
- package/dist/grid/grid-container.d.ts +3 -3
- package/dist/grid/grid.d.ts +3 -3
- package/dist/grid/index.js +30 -11
- package/dist/image/index.js +30 -11
- package/dist/index.d.ts +3 -3
- package/dist/index.js +10950 -1486
- package/dist/input/index.js +34 -13
- package/dist/keyboard/index.js +30 -11
- package/dist/link/index.js +30 -11
- package/dist/list/index.d.ts +9 -0
- package/dist/list/index.js +1287 -0
- package/dist/list/list-item.d.ts +53 -0
- package/dist/list/list.d.ts +44 -0
- package/dist/loading/index.js +30 -11
- package/dist/menu/index.d.ts +2 -0
- package/dist/menu/index.js +10354 -0
- package/dist/menu/menu.d.ts +9 -0
- package/dist/modal/index.js +34 -13
- package/dist/note/index.js +30 -11
- package/dist/page/index.js +30 -11
- package/dist/pagination/index.js +30 -11
- package/dist/popover/index.js +30 -11
- package/dist/progress/index.js +30 -11
- package/dist/radio/index.js +30 -11
- package/dist/rating/index.js +30 -11
- package/dist/row/index.js +21 -2
- package/dist/search-bar/index.js +31 -12
- package/dist/select/index.js +30 -11
- package/dist/slider/index.js +30 -11
- package/dist/snippet/index.js +30 -11
- package/dist/spacer/index.js +30 -11
- package/dist/spinner/index.js +30 -11
- package/dist/table/index.d.ts +0 -1
- package/dist/table/index.js +1663 -2242
- package/dist/tabs/index.js +30 -11
- package/dist/tag/index.js +30 -11
- package/dist/text/index.js +37 -16
- package/dist/text/text.d.ts +1 -0
- package/dist/textarea/index.js +30 -11
- package/dist/toggle/index.js +30 -11
- package/dist/tooltip/index.js +30 -11
- package/dist/tree/index.js +21 -2
- package/dist/ui-provider/index.js +32 -12
- package/dist/use-scale/index.js +9 -9
- package/dist/user/index.js +33 -13
- package/esm/auto-complete/auto-complete.js +3 -2
- package/esm/avatar/avatar.d.ts +2 -1
- package/esm/avatar/avatar.js +3 -2
- package/esm/button/button.js +2 -1
- package/esm/code-block/index.js +17 -12
- package/esm/css-baseline/css-baseline.js +3 -3
- package/esm/form/FormWrapper.js +4 -4
- package/esm/grid/grid-container.d.ts +3 -3
- package/esm/grid/grid.d.ts +3 -3
- package/esm/index.d.ts +3 -3
- package/esm/index.js +3 -3
- package/esm/input/input.js +2 -1
- package/esm/input/password.js +2 -1
- package/esm/link/link.js +2 -2
- package/esm/list/index.d.ts +9 -0
- package/esm/list/index.js +8 -0
- package/esm/list/list-item.d.ts +53 -0
- package/esm/list/list-item.js +84 -0
- package/esm/list/list.d.ts +44 -0
- package/esm/list/list.js +29 -0
- package/esm/login-with/LoginSocialApple/index.js +17 -17
- package/esm/login-with/LoginSocialGithub/index.js +2 -2
- package/esm/login-with/LoginSocialInstagram/index.js +2 -2
- package/esm/login-with/LoginSocialLinkedin/index.js +2 -2
- package/esm/login-with/LoginSocialMicrosoft/index.js +2 -2
- package/esm/login-with/LoginSocialPinterest/index.js +9 -9
- package/esm/login-with/LoginSocialTiktok/index.js +2 -2
- package/esm/login-with/LoginSocialTwitter/index.js +11 -11
- package/esm/menu/index.d.ts +2 -0
- package/esm/menu/index.js +2 -0
- package/esm/menu/menu.d.ts +9 -0
- package/esm/menu/menu.js +92 -0
- package/esm/modal/modal-action.js +2 -1
- package/esm/table/index.d.ts +0 -1
- package/esm/table/index.js +0 -1
- package/esm/table/table-body.js +4 -23
- package/esm/text/child.js +3 -3
- package/esm/text/text.d.ts +1 -0
- package/esm/text/text.js +4 -2
- package/esm/tooltip/__test__/index.test.js +28 -28
- package/package.json +15 -11
- package/dist/cart/index.d.ts +0 -72
- package/dist/cart/useLocalStorage.d.ts +0 -1
- package/dist/table/data-table.d.ts +0 -44
- package/esm/cart/index.d.ts +0 -72
- package/esm/cart/index.js +0 -265
- package/esm/cart/useLocalStorage.d.ts +0 -1
- package/esm/cart/useLocalStorage.js +0 -29
- package/esm/table/data-table.d.ts +0 -44
- package/esm/table/data-table.js +0 -451
package/esm/table/data-table.js
DELETED
|
@@ -1,451 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
import React, { memo, useEffect, useMemo, useState } from 'react';
|
|
4
|
-
// import { useDebounce } from 'use-debounce';
|
|
5
|
-
import { ArrowLeft, Columns, Delete, Edit, Filters, Refresh } from '@helpdice/icons';
|
|
6
|
-
// import InfiniteScroll from 'react-infinite-scroll-component';
|
|
7
|
-
import _ from 'lodash';
|
|
8
|
-
// import Text from '../text';
|
|
9
|
-
import Container from '../grid/grid-container';
|
|
10
|
-
import Grid from '../grid';
|
|
11
|
-
import Button from '../button';
|
|
12
|
-
import Tooltip from '../tooltip';
|
|
13
|
-
import Table from './table';
|
|
14
|
-
import Popover from '../popover';
|
|
15
|
-
// import Input from '../input';
|
|
16
|
-
// import Select from '../select';
|
|
17
|
-
|
|
18
|
-
function DataTable(_ref) {
|
|
19
|
-
var _ref$cols = _ref.cols,
|
|
20
|
-
cols = _ref$cols === void 0 ? [] : _ref$cols,
|
|
21
|
-
_ref$rows = _ref.rows,
|
|
22
|
-
rows = _ref$rows === void 0 ? [] : _ref$rows,
|
|
23
|
-
_ref$readOnly = _ref.readOnly,
|
|
24
|
-
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
25
|
-
_ref$heading = _ref.heading,
|
|
26
|
-
heading = _ref$heading === void 0 ? [] : _ref$heading,
|
|
27
|
-
_ref$filter = _ref.filter,
|
|
28
|
-
filter = _ref$filter === void 0 ? true : _ref$filter,
|
|
29
|
-
menu = _ref.menu,
|
|
30
|
-
_ref$sideMenu = _ref.sideMenu,
|
|
31
|
-
sideMenu = _ref$sideMenu === void 0 ? false : _ref$sideMenu,
|
|
32
|
-
_ref$style = _ref.style,
|
|
33
|
-
style = _ref$style === void 0 ? {} : _ref$style,
|
|
34
|
-
children = _ref.children,
|
|
35
|
-
_ref$onBack = _ref.onBack,
|
|
36
|
-
onBack = _ref$onBack === void 0 ? function () {
|
|
37
|
-
window.history.back();
|
|
38
|
-
} : _ref$onBack,
|
|
39
|
-
onRefresh = _ref.onRefresh,
|
|
40
|
-
_onFilters = _ref.onFilters,
|
|
41
|
-
onSelectedDelete = _ref.onSelectedDelete,
|
|
42
|
-
onSelectedEdit = _ref.onSelectedEdit,
|
|
43
|
-
onSelected = _ref.onSelected,
|
|
44
|
-
_ref$disableViewColum = _ref.disableViewColumn,
|
|
45
|
-
disableViewColumn = _ref$disableViewColum === void 0 ? false : _ref$disableViewColum,
|
|
46
|
-
_ref$rowDraggable = _ref.rowDraggable,
|
|
47
|
-
rowDraggable = _ref$rowDraggable === void 0 ? false : _ref$rowDraggable,
|
|
48
|
-
onDragOver = _ref.onDragOver,
|
|
49
|
-
onDragEnter = _ref.onDragEnter,
|
|
50
|
-
onDragLeave = _ref.onDragLeave,
|
|
51
|
-
onDrop = _ref.onDrop,
|
|
52
|
-
onRowClick = _ref.onRowClick,
|
|
53
|
-
dataLength = _ref.dataLength,
|
|
54
|
-
viewLength = _ref.viewLength,
|
|
55
|
-
_onPageChange = _ref.onPageChange,
|
|
56
|
-
_ref$disableMenu = _ref.disableMenu,
|
|
57
|
-
disableMenu = _ref$disableMenu === void 0 ? false : _ref$disableMenu,
|
|
58
|
-
_ref$cursorPagination = _ref.cursorPagination,
|
|
59
|
-
cursorPagination = _ref$cursorPagination === void 0 ? false : _ref$cursorPagination,
|
|
60
|
-
previousCursor = _ref.previousCursor,
|
|
61
|
-
nextCursor = _ref.nextCursor,
|
|
62
|
-
_ref$hasMore = _ref.hasMore,
|
|
63
|
-
hasMore = _ref$hasMore === void 0 ? false : _ref$hasMore,
|
|
64
|
-
_ref$stickyHeader = _ref.stickyHeader,
|
|
65
|
-
stickyHeader = _ref$stickyHeader === void 0 ? false : _ref$stickyHeader,
|
|
66
|
-
onNextPage = _ref.onNextPage,
|
|
67
|
-
onPreviousPage = _ref.onPreviousPage;
|
|
68
|
-
var TABLE_ID = _.uniqueId('tbl');
|
|
69
|
-
var _useState = useState([]),
|
|
70
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
71
|
-
hideColumn = _useState2[0],
|
|
72
|
-
setHideColumn = _useState2[1];
|
|
73
|
-
var _useState3 = useState(false),
|
|
74
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
75
|
-
openFilter = _useState4[0],
|
|
76
|
-
setOpenFilter = _useState4[1];
|
|
77
|
-
// const [anchorEl, setAnchorEl] = useState(null);
|
|
78
|
-
var _useState5 = useState([]),
|
|
79
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
80
|
-
selected = _useState6[0],
|
|
81
|
-
setSelected = _useState6[1];
|
|
82
|
-
|
|
83
|
-
// const [table_filters] = useDebounce(filters, 500);
|
|
84
|
-
var COLUMNS = cols.filter(function (col) {
|
|
85
|
-
var _String;
|
|
86
|
-
var dataName = (_String = String(col === null || col === void 0 ? void 0 : col.name)) === null || _String === void 0 ? void 0 : _String.replace(' ', '_').toLowerCase();
|
|
87
|
-
return !hideColumn.includes(dataName);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
// State for filter values
|
|
91
|
-
// const [filterValues, setFilterValues] = useState(
|
|
92
|
-
// COLUMNS.reduce((acc, col) => {
|
|
93
|
-
// acc[col.filter] = '';
|
|
94
|
-
// return acc;
|
|
95
|
-
// }, {})
|
|
96
|
-
// );
|
|
97
|
-
|
|
98
|
-
function handleShowFilter() {
|
|
99
|
-
return setOpenFilter(!openFilter);
|
|
100
|
-
}
|
|
101
|
-
useEffect(function () {
|
|
102
|
-
cols.forEach(function (col) {
|
|
103
|
-
if (hideColumn.includes(col.name)) {
|
|
104
|
-
document.querySelectorAll("[data-column=\"".concat(col.id, "\"]")).forEach(function (el) {
|
|
105
|
-
el.style.display = 'none !important';
|
|
106
|
-
});
|
|
107
|
-
} else {
|
|
108
|
-
document.querySelectorAll("[data-column=\"".concat(col.id, "\"]")).forEach(function (el) {
|
|
109
|
-
el.style.display = '';
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
}, [hideColumn, cols]);
|
|
114
|
-
function handleHideColumnClick(_event, _id) {
|
|
115
|
-
var _String2;
|
|
116
|
-
var id = (_String2 = String(_id)) === null || _String2 === void 0 ? void 0 : _String2.replace(' ', '_').toLowerCase();
|
|
117
|
-
var selectedIndex = hideColumn.indexOf(id);
|
|
118
|
-
var newSelected = [];
|
|
119
|
-
if (selectedIndex === -1) {
|
|
120
|
-
newSelected = newSelected.concat(hideColumn, id);
|
|
121
|
-
} else if (selectedIndex === 0) {
|
|
122
|
-
newSelected = newSelected.concat(hideColumn.slice(1));
|
|
123
|
-
} else if (selectedIndex === hideColumn.length - 1) {
|
|
124
|
-
newSelected = newSelected.concat(hideColumn.slice(0, -1));
|
|
125
|
-
} else if (selectedIndex > 0) {
|
|
126
|
-
newSelected = newSelected.concat(hideColumn.slice(0, selectedIndex), hideColumn.slice(selectedIndex + 1));
|
|
127
|
-
}
|
|
128
|
-
setHideColumn(newSelected);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Children change reset selected
|
|
132
|
-
useEffect(function () {
|
|
133
|
-
setSelected([]);
|
|
134
|
-
}, [children]);
|
|
135
|
-
|
|
136
|
-
// const tableHeadStyle = {
|
|
137
|
-
// position: 'sticky',
|
|
138
|
-
// // backgroundColor: '#fafafb',
|
|
139
|
-
// // boxShadow: '0 2px 2px -1px rgba(0, 0, 0, 0.4)',
|
|
140
|
-
// top: 0,
|
|
141
|
-
// zIndex: 9,
|
|
142
|
-
// '& .MuiTableCell-root': {
|
|
143
|
-
// fontSize: '14px !important',
|
|
144
|
-
// py: 0.2
|
|
145
|
-
// }
|
|
146
|
-
// // ...borderStyle
|
|
147
|
-
// };
|
|
148
|
-
|
|
149
|
-
// const borderStyle = {
|
|
150
|
-
// '& .MuiTableCell-root': {
|
|
151
|
-
// py: 0.2,
|
|
152
|
-
// px: 1
|
|
153
|
-
// // borderLeft: '1px solid #ccc !important',
|
|
154
|
-
// // borderRight: '1px solid #ccc !important'
|
|
155
|
-
// },
|
|
156
|
-
// '& td:first-of-type': {
|
|
157
|
-
// borderLeft: 'none !important'
|
|
158
|
-
// },
|
|
159
|
-
// '& td:last-child': {
|
|
160
|
-
// borderRight: 'none !important'
|
|
161
|
-
// }
|
|
162
|
-
// // '& tr': { borderBottom: '1px solid #ccc !important' }
|
|
163
|
-
// };
|
|
164
|
-
|
|
165
|
-
// const handleFilterChange = (name: string, value?: any) => {
|
|
166
|
-
// setFilterValues({ ...filterValues, [name]: value });
|
|
167
|
-
// };
|
|
168
|
-
|
|
169
|
-
// const generateFilterInputs = () => {
|
|
170
|
-
// return COLUMNS.map((col) => {
|
|
171
|
-
// const { name: Header, filter: accessor, options } = col;
|
|
172
|
-
// const filterName = String(col?.name)?.replace(' ', '_').toLowerCase();
|
|
173
|
-
// // const unq_accessor = _.uniqueId(filterName);
|
|
174
|
-
// // if (Header === 'actions') {
|
|
175
|
-
// // return (
|
|
176
|
-
// // <th style={{ margin: '3px' }} data-column={Header} key={unq_accessor}>
|
|
177
|
-
// // <Button onClick={applyFilters} auto px={0.6} scale={2 / 3}>Apply</Button>
|
|
178
|
-
// // </th>
|
|
179
|
-
// // )
|
|
180
|
-
// // }
|
|
181
|
-
// return (
|
|
182
|
-
// <Popover.Item style={{ padding: '3px' }} data-column={Header}>
|
|
183
|
-
// {accessor === 'fixed' && (
|
|
184
|
-
// <Select
|
|
185
|
-
// // key={filterName}
|
|
186
|
-
// name={filterName}
|
|
187
|
-
// value={filterValues[filterName] ?? 'All'}
|
|
188
|
-
// onChange={(newValue) => handleFilterChange(filterName, newValue)}
|
|
189
|
-
// >
|
|
190
|
-
// <Select.Option value="All">All {Header}</Select.Option>
|
|
191
|
-
// {options ? options.map((option: any) => (
|
|
192
|
-
// <Select.Option value={option.value}>{option.name}</Select.Option>
|
|
193
|
-
// )) : null}
|
|
194
|
-
// </Select>
|
|
195
|
-
// )}
|
|
196
|
-
// {accessor === 'date' && (
|
|
197
|
-
// <Input
|
|
198
|
-
// // id={`filter-date-${filterName}`}
|
|
199
|
-
// // key={filterName}
|
|
200
|
-
// type="date"
|
|
201
|
-
// name={filterName}
|
|
202
|
-
// value={filterValues[filterName]}
|
|
203
|
-
// onChange={(e) => handleFilterChange(filterName, e.target.value)}
|
|
204
|
-
// />
|
|
205
|
-
// )}
|
|
206
|
-
// {accessor === 'search' && (
|
|
207
|
-
// <Input
|
|
208
|
-
// // id={`filter-search-${filterName}`}
|
|
209
|
-
// // key={filterName}
|
|
210
|
-
// type="text"
|
|
211
|
-
// autoComplete="off"
|
|
212
|
-
// // ref={filterRefs.current[filterName]} // Dynamically set ref}
|
|
213
|
-
// name={filterName}
|
|
214
|
-
// style={{ height: 30, minWidth: 160 }}
|
|
215
|
-
// value={filterValues[filterName]}
|
|
216
|
-
// onChange={(e) => handleFilterChange(filterName, e.target.value)}
|
|
217
|
-
// placeholder="Search..."
|
|
218
|
-
// fullWidth
|
|
219
|
-
// />
|
|
220
|
-
// )}
|
|
221
|
-
// </Popover.Item>
|
|
222
|
-
// );
|
|
223
|
-
// });
|
|
224
|
-
// };
|
|
225
|
-
|
|
226
|
-
var content = function content() {
|
|
227
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, cols.map(function (option, _index) {
|
|
228
|
-
// const colunqid = _.uniqueId(`${option.name}-${index}`);
|
|
229
|
-
var isSelected = !hideColumn.includes(option.id);
|
|
230
|
-
return /*#__PURE__*/React.createElement(Popover.Item, {
|
|
231
|
-
selected: isSelected
|
|
232
|
-
// key={colunqid}
|
|
233
|
-
,
|
|
234
|
-
onClick: function onClick(e) {
|
|
235
|
-
return handleHideColumnClick(e, option.id);
|
|
236
|
-
}
|
|
237
|
-
}, /*#__PURE__*/React.createElement("span", null, option.name));
|
|
238
|
-
}));
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
// const filterContent = () => (
|
|
242
|
-
// <>
|
|
243
|
-
// {generateFilterInputs()}
|
|
244
|
-
// <Popover.Item>
|
|
245
|
-
// <Button onClick={() => {
|
|
246
|
-
// if (onFilters) {
|
|
247
|
-
// onFilters(filterValues)
|
|
248
|
-
// }
|
|
249
|
-
// }}>Apply</Button></Popover.Item></>
|
|
250
|
-
// )
|
|
251
|
-
|
|
252
|
-
var SELECTED = useMemo(function () {
|
|
253
|
-
if (onSelected) {
|
|
254
|
-
return onSelected(selected);
|
|
255
|
-
}
|
|
256
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
257
|
-
}, [selected]);
|
|
258
|
-
return /*#__PURE__*/React.createElement(Container, {
|
|
259
|
-
className: "helpdice-ui-data-table-container",
|
|
260
|
-
direction: "column"
|
|
261
|
-
}, /*#__PURE__*/React.createElement(Grid.Container, {
|
|
262
|
-
style: {
|
|
263
|
-
marginBottom: '0.5rem',
|
|
264
|
-
marginTop: '0.5rem'
|
|
265
|
-
}
|
|
266
|
-
}, heading && /*#__PURE__*/React.createElement(Grid, {
|
|
267
|
-
sm: disableMenu ? 24 : 12,
|
|
268
|
-
xs: 24
|
|
269
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
270
|
-
style: {
|
|
271
|
-
display: 'flex',
|
|
272
|
-
alignItems: 'center',
|
|
273
|
-
gap: '1rem',
|
|
274
|
-
fontSize: 'larger'
|
|
275
|
-
}
|
|
276
|
-
}, children && /*#__PURE__*/React.createElement(Button, {
|
|
277
|
-
type: "button",
|
|
278
|
-
auto: true,
|
|
279
|
-
scale: 2 / 3,
|
|
280
|
-
px: 0.6,
|
|
281
|
-
iconRight: /*#__PURE__*/React.createElement(ArrowLeft, null),
|
|
282
|
-
onClick: onBack
|
|
283
|
-
}), heading)), !disableMenu && /*#__PURE__*/React.createElement(Grid, {
|
|
284
|
-
sm: 12,
|
|
285
|
-
xs: 24
|
|
286
|
-
}, /*#__PURE__*/React.createElement(Container, {
|
|
287
|
-
width: "100%",
|
|
288
|
-
style: {
|
|
289
|
-
margin: 0,
|
|
290
|
-
gap: '0.6rem'
|
|
291
|
-
},
|
|
292
|
-
justify: "flex-end",
|
|
293
|
-
alignContent: "center"
|
|
294
|
-
}, menu, !children && !readOnly ? /*#__PURE__*/React.createElement(React.Fragment, null, (selected === null || selected === void 0 ? void 0 : selected.length) > 0 && SELECTED, onSelectedEdit && selected.length === 1 ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
295
|
-
text: "Edit Selected",
|
|
296
|
-
placement: "bottom",
|
|
297
|
-
font: 0.8,
|
|
298
|
-
px: 0.6,
|
|
299
|
-
py: 0.4,
|
|
300
|
-
type: "dark"
|
|
301
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
302
|
-
onClick: function onClick() {
|
|
303
|
-
return onSelectedEdit(selected[0]);
|
|
304
|
-
},
|
|
305
|
-
iconRight: /*#__PURE__*/React.createElement(Edit, null),
|
|
306
|
-
auto: true,
|
|
307
|
-
type: "button",
|
|
308
|
-
scale: 2 / 3,
|
|
309
|
-
px: 0.6
|
|
310
|
-
})) : null, onSelectedDelete && selected.length > 1 ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
311
|
-
text: "Delete Selected",
|
|
312
|
-
placement: "bottom",
|
|
313
|
-
font: 0.8,
|
|
314
|
-
px: 0.6,
|
|
315
|
-
py: 0.4,
|
|
316
|
-
type: "dark"
|
|
317
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
318
|
-
onClick: function onClick() {
|
|
319
|
-
return onSelectedDelete(selected);
|
|
320
|
-
},
|
|
321
|
-
auto: true,
|
|
322
|
-
scale: 2 / 3,
|
|
323
|
-
px: 0.6,
|
|
324
|
-
type: "button",
|
|
325
|
-
iconRight: /*#__PURE__*/React.createElement(Delete, null)
|
|
326
|
-
})) : null, onRefresh ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
327
|
-
text: "Refresh",
|
|
328
|
-
placement: "bottom",
|
|
329
|
-
font: 0.8,
|
|
330
|
-
px: 0.6,
|
|
331
|
-
py: 0.4,
|
|
332
|
-
type: "dark"
|
|
333
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
334
|
-
type: "button",
|
|
335
|
-
onClick: function onClick() {
|
|
336
|
-
return onRefresh();
|
|
337
|
-
},
|
|
338
|
-
auto: true,
|
|
339
|
-
scale: 2 / 3,
|
|
340
|
-
px: 0.6,
|
|
341
|
-
iconRight: /*#__PURE__*/React.createElement(Refresh, null)
|
|
342
|
-
})) : null, _onFilters && filter ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
343
|
-
text: "Columns",
|
|
344
|
-
placement: "bottomEnd",
|
|
345
|
-
font: 0.8,
|
|
346
|
-
px: 0.6,
|
|
347
|
-
py: 0.4,
|
|
348
|
-
type: "dark"
|
|
349
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
350
|
-
type: "button",
|
|
351
|
-
onClick: handleShowFilter,
|
|
352
|
-
auto: true,
|
|
353
|
-
scale: 2 / 3,
|
|
354
|
-
px: 0.6,
|
|
355
|
-
iconRight: /*#__PURE__*/React.createElement(Filters, null)
|
|
356
|
-
})) : null, !disableViewColumn && /*#__PURE__*/React.createElement(Tooltip, {
|
|
357
|
-
text: "Columns",
|
|
358
|
-
placement: "bottomEnd",
|
|
359
|
-
font: 0.8,
|
|
360
|
-
px: 0.6,
|
|
361
|
-
py: 0.4,
|
|
362
|
-
type: "dark"
|
|
363
|
-
}, /*#__PURE__*/React.createElement(Popover, {
|
|
364
|
-
disableItemsAutoClose: true,
|
|
365
|
-
placement: "bottomEnd",
|
|
366
|
-
child: content
|
|
367
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
368
|
-
type: "button",
|
|
369
|
-
onClick: function onClick() {},
|
|
370
|
-
auto: true,
|
|
371
|
-
scale: 2 / 3,
|
|
372
|
-
px: 0.6,
|
|
373
|
-
iconRight: /*#__PURE__*/React.createElement(Columns, null)
|
|
374
|
-
})))) : null))), children ? /*#__PURE__*/React.createElement("div", {
|
|
375
|
-
style: {
|
|
376
|
-
padding: '1rem'
|
|
377
|
-
}
|
|
378
|
-
}, children) : /*#__PURE__*/React.createElement("div", {
|
|
379
|
-
style: {
|
|
380
|
-
gap: 5,
|
|
381
|
-
display: 'flex',
|
|
382
|
-
flexDirection: sideMenu ? 'row' : 'column'
|
|
383
|
-
}
|
|
384
|
-
}, sideMenu ? /*#__PURE__*/React.createElement(Container, {
|
|
385
|
-
direction: "column",
|
|
386
|
-
style: {
|
|
387
|
-
width: '15rem',
|
|
388
|
-
gap: 5,
|
|
389
|
-
padding: '0.5rem 0.7rem',
|
|
390
|
-
border: '1px solid #cfcfcf',
|
|
391
|
-
borderRadius: '5px'
|
|
392
|
-
}
|
|
393
|
-
}, sideMenu) : null, /*#__PURE__*/React.createElement("div", {
|
|
394
|
-
onDragOver: onDragOver,
|
|
395
|
-
onDragEnter: onDragEnter,
|
|
396
|
-
onDragLeave: onDragLeave,
|
|
397
|
-
onDrop: onDrop,
|
|
398
|
-
id: TABLE_ID,
|
|
399
|
-
className: "helpdice-ui-table-container",
|
|
400
|
-
style: _extends({
|
|
401
|
-
position: 'relative',
|
|
402
|
-
overflowY: 'auto',
|
|
403
|
-
maxWidth: 'calc(100vw - 1.5rem)',
|
|
404
|
-
width: sideMenu ? 'calc(100vw - 17.2rem)' : 'inherit !important'
|
|
405
|
-
}, style)
|
|
406
|
-
}, /*#__PURE__*/React.createElement(Table, {
|
|
407
|
-
stickyHeader: stickyHeader,
|
|
408
|
-
readOnly: readOnly,
|
|
409
|
-
cursorPagination: cursorPagination,
|
|
410
|
-
previousCursor: previousCursor,
|
|
411
|
-
nextCursor: nextCursor,
|
|
412
|
-
hasMore: hasMore,
|
|
413
|
-
onNextPage: onNextPage,
|
|
414
|
-
onPreviousPage: onPreviousPage,
|
|
415
|
-
dataLength: dataLength,
|
|
416
|
-
viewLength: viewLength,
|
|
417
|
-
onPageChange: function onPageChange(page, start, end) {
|
|
418
|
-
if (_onPageChange) {
|
|
419
|
-
_onPageChange(page, start, end);
|
|
420
|
-
}
|
|
421
|
-
},
|
|
422
|
-
onFilters: function onFilters(filters) {
|
|
423
|
-
if (_onFilters) {
|
|
424
|
-
_onFilters(filters);
|
|
425
|
-
}
|
|
426
|
-
},
|
|
427
|
-
onRow: onRowClick,
|
|
428
|
-
rowDraggable: rowDraggable,
|
|
429
|
-
showFilters: openFilter,
|
|
430
|
-
onSelected: function onSelected(selected) {
|
|
431
|
-
return setSelected(selected);
|
|
432
|
-
},
|
|
433
|
-
data: rows,
|
|
434
|
-
style: {
|
|
435
|
-
borderCollapse: 'collapse',
|
|
436
|
-
overflow: 'auto'
|
|
437
|
-
}
|
|
438
|
-
}, COLUMNS.map(function (column) {
|
|
439
|
-
return /*#__PURE__*/React.createElement(Table.Column, {
|
|
440
|
-
style: column === null || column === void 0 ? void 0 : column.style,
|
|
441
|
-
options: column === null || column === void 0 ? void 0 : column.options,
|
|
442
|
-
fontSize: column === null || column === void 0 ? void 0 : column.fontSize,
|
|
443
|
-
prop: column.id,
|
|
444
|
-
label: column.name,
|
|
445
|
-
filter: column === null || column === void 0 ? void 0 : column.filter,
|
|
446
|
-
noWrap: column === null || column === void 0 ? void 0 : column.noWrap,
|
|
447
|
-
align: column === null || column === void 0 ? void 0 : column.align
|
|
448
|
-
});
|
|
449
|
-
})))));
|
|
450
|
-
}
|
|
451
|
-
export default /*#__PURE__*/memo(DataTable);
|