@crystaldesign/grid 24.15.0-beta.9 → 24.16.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/esm/index.js +643 -487
- package/build/types/grid/src/GirdOptions.d.ts +12 -3
- package/build/types/grid/src/GirdOptions.d.ts.map +1 -1
- package/build/types/grid/src/Grid.d.ts +7 -2
- package/build/types/grid/src/Grid.d.ts.map +1 -1
- package/build/types/grid/src/hooks/useApiInterface/apiFetchData.d.ts.map +1 -1
- package/build/types/grid/src/hooks/useApiInterface/index.d.ts +2 -1
- package/build/types/grid/src/hooks/useApiInterface/index.d.ts.map +1 -1
- package/build/types/grid/src/hooks/useEditActions.d.ts +2 -1
- package/build/types/grid/src/hooks/useEditActions.d.ts.map +1 -1
- package/build/types/grid/src/hooks/useSelection.d.ts +9 -0
- package/build/types/grid/src/hooks/useSelection.d.ts.map +1 -0
- package/build/types/grid/src/index.d.ts +2 -0
- package/build/types/grid/src/index.d.ts.map +1 -1
- package/build/types/grid/src/ui/cells/action/ActionCell.d.ts +1 -1
- package/build/types/grid/src/ui/cells/action/ActionCell.d.ts.map +1 -1
- package/build/types/grid/src/ui/cells/beginActions/BeginActionsCell.d.ts +7 -0
- package/build/types/grid/src/ui/cells/beginActions/BeginActionsCell.d.ts.map +1 -0
- package/build/types/grid/src/ui/cells/beginActions/BeginActionsHeader.d.ts +7 -0
- package/build/types/grid/src/ui/cells/beginActions/BeginActionsHeader.d.ts.map +1 -0
- package/build/types/grid/src/ui/cells/boolean/BooleanCell.d.ts.map +1 -1
- package/build/types/grid/src/ui/cells/media/MediaViewerCell.d.ts.map +1 -1
- package/build/types/grid/src/ui/components/NoData.d.ts +3 -1
- package/build/types/grid/src/ui/components/NoData.d.ts.map +1 -1
- package/build/types/grid/src/ui/components/Table.d.ts +30 -0
- package/build/types/grid/src/ui/components/Table.d.ts.map +1 -1
- package/package.json +6 -6
package/build/esm/index.js
CHANGED
|
@@ -5,16 +5,13 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
5
5
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
6
6
|
import React, { useState, useEffect, useMemo, createElement, forwardRef, useRef, useReducer, useCallback } from 'react';
|
|
7
7
|
import { useTranslation, useDivaCore, DivaUtils, getLogger, DivaError } from '@crystaldesign/diva-core';
|
|
8
|
-
import { useAsyncDebounce, useTable, useFilters, useGlobalFilter, useGroupBy, useSortBy, useExpanded, usePagination
|
|
8
|
+
import { useAsyncDebounce, useRowSelect, useTable, useFilters, useGlobalFilter, useGroupBy, useSortBy, useExpanded, usePagination } from 'react-table';
|
|
9
9
|
import makeStyles from '@mui/styles/makeStyles';
|
|
10
10
|
import createStyles from '@mui/styles/createStyles';
|
|
11
11
|
import Alert from '@mui/material/Alert';
|
|
12
|
-
import Checkbox from '@mui/material/Checkbox';
|
|
13
12
|
import TablePagination from '@mui/material/TablePagination';
|
|
14
13
|
import ViewHeadlineIcon from '@mui/icons-material/ViewHeadline';
|
|
15
14
|
import ViewModuleIcon from '@mui/icons-material/ViewModule';
|
|
16
|
-
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
|
17
|
-
import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
|
|
18
15
|
import SearchField from '@crystaldesign/searchfield';
|
|
19
16
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
20
17
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
@@ -27,8 +24,11 @@ import TableRow from '@mui/material/TableRow';
|
|
|
27
24
|
import Skeleton from '@mui/material/Skeleton';
|
|
28
25
|
import TableSortLabel from '@mui/material/TableSortLabel';
|
|
29
26
|
import IconButton from '@mui/material/IconButton';
|
|
27
|
+
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
|
28
|
+
import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
|
|
30
29
|
import DragIndicatorIcon from '@mui/icons-material/DragIndicator';
|
|
31
|
-
import { DragDropContext, Droppable, Draggable } from '
|
|
30
|
+
import { DragDropContext, Droppable, Draggable } from '@hello-pangea/dnd';
|
|
31
|
+
import classnames from 'classnames';
|
|
32
32
|
import MaToolbar from '@mui/material/Toolbar';
|
|
33
33
|
import ButtonGroup from '@mui/material/ButtonGroup';
|
|
34
34
|
import Button from '@mui/material/Button';
|
|
@@ -42,7 +42,6 @@ import MoreVertIcon from '@mui/icons-material/MoreVert';
|
|
|
42
42
|
import Menu from '@mui/material/Menu';
|
|
43
43
|
import MenuItem from '@mui/material/MenuItem';
|
|
44
44
|
import Tooltip from '@mui/material/Tooltip';
|
|
45
|
-
import classNames from 'classnames';
|
|
46
45
|
import ImageList from '@mui/material/ImageList';
|
|
47
46
|
import ImageListItem from '@mui/material/ImageListItem';
|
|
48
47
|
import Grid$1 from '@mui/material/Grid2';
|
|
@@ -62,6 +61,7 @@ import { NativeSelect, Tabs, Tab, TextareaAutosize as TextareaAutosize$1 } from
|
|
|
62
61
|
import TextField from '@mui/material/TextField';
|
|
63
62
|
import withStyles from '@mui/styles/withStyles';
|
|
64
63
|
import { unflatten } from 'flat';
|
|
64
|
+
import Checkbox from '@mui/material/Checkbox';
|
|
65
65
|
import { useHover, useLayer } from 'react-laag';
|
|
66
66
|
import { ContentBoxComponent } from '@crystaldesign/content-box';
|
|
67
67
|
import { NavigateBefore, NavigateNext } from '@mui/icons-material';
|
|
@@ -121,29 +121,6 @@ function DefaultColumnFilter(_ref) {
|
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
var nodataicon = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20version%3D%221.1%22%20width%3D%2272%22%20height%3D%2272%22%20viewBox%3D%220%200%20256%20256%22%20xml%3Aspace%3D%22preserve%22%3E%3Cdesc%3ECreated%20with%20Fabric.js%201.7.22%3C%2Fdesc%3E%3Cdefs%3E%3C%2Fdefs%3E%3Cg%20transform%3D%22translate%28128%20128%29%20scale%280.72%200.72%29%22%20style%3D%22%22%3E%20%3Cg%20style%3D%22stroke%3A%20none%3B%20stroke-width%3A%200%3B%20stroke-dasharray%3A%20none%3B%20stroke-linecap%3A%20butt%3B%20stroke-linejoin%3A%20miter%3B%20stroke-miterlimit%3A%2010%3B%20fill%3A%20none%3B%20fill-rule%3A%20nonzero%3B%20opacity%3A%201%3B%22%20transform%3D%22translate%28-175.05%20-175.05000000000004%29%20scale%283.89%203.89%29%22%20%3E%20%3Cpath%20d%3D%22M%2045%2081.889%20c%20-11.691%200%20-21.202%20-9.511%20-21.202%20-21.201%20S%2033.309%2039.485%2045%2039.485%20c%2011.69%200%2021.202%209.512%2021.202%2021.202%20S%2056.69%2081.889%2045%2081.889%20z%20M%2045%2041.485%20c%20-10.588%200%20-19.202%208.614%20-19.202%2019.202%20S%2034.412%2079.889%2045%2079.889%20s%2019.202%20-8.613%2019.202%20-19.201%20S%2055.588%2041.485%2045%2041.485%20z%22%20style%3D%22stroke%3A%20none%3B%20stroke-width%3A%201%3B%20stroke-dasharray%3A%20none%3B%20stroke-linecap%3A%20butt%3B%20stroke-linejoin%3A%20miter%3B%20stroke-miterlimit%3A%2010%3B%20fill%3A%20rgb%28179%2C179%2C179%29%3B%20fill-rule%3A%20nonzero%3B%20opacity%3A%201%3B%22%20transform%3D%22%20matrix%281%200%200%201%200%200%29%20%22%20stroke-linecap%3D%22round%22%20%2F%3E%20%3Cpath%20d%3D%22M%2071.227%2068.699%20H%2063.95%20c%20-0.553%200%20-1%20-0.447%20-1%20-1%20s%200.447%20-1%201%20-1%20h%207.276%20C%2080.476%2066.699%2088%2059.175%2088%2049.926%20s%20-7.524%20-16.774%20-16.773%20-16.774%20h%20-0.339%20c%20-0.508%200%20-0.935%20-0.38%20-0.993%20-0.885%20C%2068.433%2019.636%2057.73%2010.111%2045%2010.111%20s%20-23.433%209.525%20-24.895%2022.156%20c%20-0.058%200.505%20-0.485%200.885%20-0.993%200.885%20h%20-0.338%20C%209.525%2033.152%202%2040.677%202%2049.926%20s%207.525%2016.773%2016.774%2016.773%20h%207.276%20c%200.552%200%201%200.447%201%201%20s%20-0.448%201%20-1%201%20h%20-7.276%20C%208.422%2068.699%200%2060.277%200%2049.926%20c%200%20-10.172%208.131%20-18.48%2018.235%20-18.766%20C%2020.196%2017.958%2031.55%208.111%2045%208.111%20s%2024.804%209.847%2026.766%2023.049%20C%2081.869%2031.445%2090%2039.754%2090%2049.926%20C%2090%2060.277%2081.578%2068.699%2071.227%2068.699%20z%22%20style%3D%22stroke%3A%20none%3B%20stroke-width%3A%201%3B%20stroke-dasharray%3A%20none%3B%20stroke-linecap%3A%20butt%3B%20stroke-linejoin%3A%20miter%3B%20stroke-miterlimit%3A%2010%3B%20fill%3A%20rgb%28179%2C179%2C179%29%3B%20fill-rule%3A%20nonzero%3B%20opacity%3A%201%3B%22%20transform%3D%22%20matrix%281%200%200%201%200%200%29%20%22%20stroke-linecap%3D%22round%22%20%2F%3E%20%3Cpath%20d%3D%22M%2030.737%2075.993%20c%20-0.256%200%20-0.512%20-0.098%20-0.707%20-0.293%20c%20-0.391%20-0.391%20-0.391%20-1.023%200%20-1.414%20l%2028.569%20-28.569%20c%200.391%20-0.391%201.023%20-0.391%201.414%200%20s%200.391%201.023%200%201.414%20L%2031.444%2075.7%20C%2031.249%2075.896%2030.993%2075.993%2030.737%2075.993%20z%22%20style%3D%22stroke%3A%20none%3B%20stroke-width%3A%201%3B%20stroke-dasharray%3A%20none%3B%20stroke-linecap%3A%20butt%3B%20stroke-linejoin%3A%20miter%3B%20stroke-miterlimit%3A%2010%3B%20fill%3A%20rgb%28179%2C179%2C179%29%3B%20fill-rule%3A%20nonzero%3B%20opacity%3A%201%3B%22%20transform%3D%22%20matrix%281%200%200%201%200%200%29%20%22%20stroke-linecap%3D%22round%22%20%2F%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E";
|
|
125
|
-
|
|
126
|
-
function NoData() {
|
|
127
|
-
return /*#__PURE__*/jsxs("div", {
|
|
128
|
-
style: {
|
|
129
|
-
display: 'flex',
|
|
130
|
-
justifyContent: 'center',
|
|
131
|
-
alignItems: 'center',
|
|
132
|
-
flexDirection: 'column',
|
|
133
|
-
height: '100%'
|
|
134
|
-
},
|
|
135
|
-
children: [/*#__PURE__*/jsx("img", {
|
|
136
|
-
src: nodataicon
|
|
137
|
-
}), /*#__PURE__*/jsx("p", {
|
|
138
|
-
id: "noDataFound",
|
|
139
|
-
style: {
|
|
140
|
-
color: '#b3b3b3'
|
|
141
|
-
},
|
|
142
|
-
children: "No Data"
|
|
143
|
-
})]
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
|
|
147
124
|
function styleInject(css, ref) {
|
|
148
125
|
if ( ref === void 0 ) ref = {};
|
|
149
126
|
var insertAt = ref.insertAt;
|
|
@@ -172,14 +149,16 @@ function styleInject(css, ref) {
|
|
|
172
149
|
}
|
|
173
150
|
|
|
174
151
|
var draggedCell = "dragged-cell-9YMHK";
|
|
175
|
-
var
|
|
176
|
-
|
|
152
|
+
var noData = "no-data-q8Gzm";
|
|
153
|
+
var withToolbar = "with-toolbar-X2Mxk";
|
|
154
|
+
var css_248z$5 = ".dragged-cell-9YMHK {\n display: flex;\n justify-content: space-between;\n}\n\n.dragged-cell-9YMHK td {\n display: block;\n flex-grow: 100;\n}\n\n.dragged-cell-9YMHK td:nth-child(1) {\n padding: 16px 0 !important;\n}\n\n.dragged-cell-9YMHK td:nth-child(1) {\n max-width: 42px;\n width: 29px;\n}\n\n.no-data-q8Gzm {\n display: flex;\n justify-content: center;\n align-items: center;\n height: calc(100% - 59px - 63px);\n flex-direction: column;\n gap: 15px;\n margin: auto;\n box-shadow: inset 0 0 3px 0px rgba(0, 0, 0, 0.1);\n border-radius: 5px;\n position: absolute;\n margin-top: 59px;\n width: 100%;\n}\n\n.with-toolbar-X2Mxk {\n height: calc(100% - 98px - 61px - 63px);\n margin-top: calc(59px + 98px);\n}\n";
|
|
155
|
+
styleInject(css_248z$5);
|
|
177
156
|
|
|
178
157
|
var _excluded$3 = ["headerGroups", "rows", "isLoading", "selectedFlatRows"],
|
|
179
158
|
_excluded2 = ["row", "provided"],
|
|
180
159
|
_excluded3 = ["prepareRow", "row", "provided", "renderSubComponent", "toggleSelected", "dragDropRows"];
|
|
181
|
-
function ownKeys$
|
|
182
|
-
function _objectSpread$
|
|
160
|
+
function ownKeys$h(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; }
|
|
161
|
+
function _objectSpread$h(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$h(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$h(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
183
162
|
function MemoizedTable(_ref) {
|
|
184
163
|
var headerGroups = _ref.headerGroups,
|
|
185
164
|
rows = _ref.rows,
|
|
@@ -187,7 +166,7 @@ function MemoizedTable(_ref) {
|
|
|
187
166
|
selectedFlatRows = _ref.selectedFlatRows,
|
|
188
167
|
others = _objectWithoutProperties(_ref, _excluded$3);
|
|
189
168
|
return useMemo(function () {
|
|
190
|
-
return /*#__PURE__*/jsx(Table, _objectSpread$
|
|
169
|
+
return /*#__PURE__*/jsx(Table, _objectSpread$h({
|
|
191
170
|
headerGroups: headerGroups,
|
|
192
171
|
rows: rows,
|
|
193
172
|
isLoading: isLoading
|
|
@@ -213,8 +192,8 @@ function Table(_ref2) {
|
|
|
213
192
|
renderSubComponent = _ref2.renderSubComponent,
|
|
214
193
|
dragDropRows = _ref2.dragDropRows,
|
|
215
194
|
onDragEndAction = _ref2.onDragEndAction,
|
|
216
|
-
rowHight = _ref2.rowHight
|
|
217
|
-
|
|
195
|
+
rowHight = _ref2.rowHight;
|
|
196
|
+
_ref2.noData;
|
|
218
197
|
var classes = useStyles$6();
|
|
219
198
|
var onDragEnd = function onDragEnd(result) {
|
|
220
199
|
if (!result.destination) {
|
|
@@ -231,9 +210,9 @@ function Table(_ref2) {
|
|
|
231
210
|
myRows.splice(to, 0, elm);
|
|
232
211
|
rows = myRows;
|
|
233
212
|
}
|
|
234
|
-
return /*#__PURE__*/
|
|
213
|
+
return /*#__PURE__*/jsx(TableContainer, {
|
|
235
214
|
className: classes.table,
|
|
236
|
-
children:
|
|
215
|
+
children: /*#__PURE__*/jsxs(MaUTable, _objectSpread$h(_objectSpread$h({}, getTableProps()), {}, {
|
|
237
216
|
stickyHeader: true,
|
|
238
217
|
"aria-label": "sticky table",
|
|
239
218
|
children: [/*#__PURE__*/jsx(TableHead, {
|
|
@@ -242,74 +221,72 @@ function Table(_ref2) {
|
|
|
242
221
|
whiteSpace: 'nowrap'
|
|
243
222
|
},
|
|
244
223
|
children: headerGroups.map(function (headerGroup) {
|
|
245
|
-
return /*#__PURE__*/createElement(TableRow, _objectSpread$
|
|
224
|
+
return /*#__PURE__*/createElement(TableRow, _objectSpread$h(_objectSpread$h({}, headerGroup.getHeaderGroupProps()), {}, {
|
|
246
225
|
key: headerGroup.getHeaderGroupProps().key
|
|
247
226
|
}), dragDropRows && /*#__PURE__*/jsx(TableCell, {
|
|
248
227
|
style: {
|
|
249
228
|
width: '8px',
|
|
250
229
|
padding: '16px 0px 16px 5px'
|
|
251
230
|
}
|
|
252
|
-
}),
|
|
253
|
-
var
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
231
|
+
}), function () {
|
|
232
|
+
var headers = headerGroup.headers.flat();
|
|
233
|
+
return headers.map(function (column, i) {
|
|
234
|
+
var _headers;
|
|
235
|
+
var lastFlexible = ((_headers = headers[i + 1]) === null || _headers === void 0 ? void 0 : _headers.fixed) === true;
|
|
236
|
+
var cells = [];
|
|
237
|
+
if (column.fixed) {
|
|
238
|
+
cells.push(/*#__PURE__*/createElement(TableCell, _objectSpread$h(_objectSpread$h({}, column.getHeaderProps({
|
|
239
|
+
style: {
|
|
240
|
+
zIndex: 5,
|
|
241
|
+
backgroundColor: 'white',
|
|
242
|
+
position: 'sticky'
|
|
243
|
+
}
|
|
244
|
+
})), {}, {
|
|
245
|
+
className: "fixed-spacer1",
|
|
246
|
+
key: column.getHeaderProps().key + '_a'
|
|
247
|
+
}), /*#__PURE__*/jsx("div", {
|
|
248
|
+
style: {
|
|
249
|
+
width: 5
|
|
250
|
+
}
|
|
251
|
+
})));
|
|
252
|
+
cells.push(/*#__PURE__*/createElement(TableCell, _objectSpread$h(_objectSpread$h({}, column.getHeaderProps({
|
|
253
|
+
style: {
|
|
254
|
+
zIndex: 4
|
|
255
|
+
}
|
|
256
|
+
})), {}, {
|
|
257
|
+
className: "fixed-spacer2",
|
|
258
|
+
key: column.getHeaderProps().key + '_b'
|
|
259
|
+
}), /*#__PURE__*/jsx("div", {
|
|
260
|
+
style: {
|
|
261
|
+
backgroundColor: 'white'
|
|
262
|
+
}
|
|
263
|
+
})));
|
|
264
|
+
}
|
|
265
|
+
cells.push(/*#__PURE__*/createElement(TableCell, _objectSpread$h(_objectSpread$h({}, column.getHeaderProps({
|
|
270
266
|
style: {
|
|
271
|
-
width:
|
|
272
|
-
padding:
|
|
273
|
-
|
|
274
|
-
zIndex: 4,
|
|
275
|
-
|
|
267
|
+
width: lastFlexible ? undefined : column.width,
|
|
268
|
+
padding: column.padding,
|
|
269
|
+
right: column.fixed ? 0 : undefined,
|
|
270
|
+
zIndex: column.fixed ? 5 : 4,
|
|
271
|
+
minWidth: column.fixed ? column.width : column.minWidth,
|
|
272
|
+
maxWidth: column.maxWidth
|
|
276
273
|
}
|
|
277
274
|
})), {}, {
|
|
278
|
-
key: column.getHeaderProps().key
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
style: {
|
|
292
|
-
width: column.width,
|
|
293
|
-
padding: column.padding,
|
|
294
|
-
right: column.fixed ? 0 : undefined,
|
|
295
|
-
zIndex: column.fixed ? 5 : 4,
|
|
296
|
-
minWidth: column.fixed ? column.width : undefined
|
|
297
|
-
}
|
|
298
|
-
})), {}, {
|
|
299
|
-
key: column.getHeaderProps().key,
|
|
300
|
-
sortDirection: column.isSorted ? column.isSortedDesc ? 'desc' : 'asc' : false
|
|
301
|
-
}),
|
|
302
|
-
// only wrap in tableSortLabel if it is actually sortable, otherwise other functionalities (e.g. select) don't work
|
|
303
|
-
column.canSort && /*#__PURE__*/jsx(TableSortLabel, _objectSpread$e(_objectSpread$e({}, column.getSortByToggleProps()), {}, {
|
|
304
|
-
disabled: !column.canSort,
|
|
305
|
-
active: column.isSorted,
|
|
306
|
-
direction: column.isSortedDesc ? 'desc' : 'asc',
|
|
307
|
-
children: column.render('Header')
|
|
308
|
-
})), !column.canSort && column.render('Header')));
|
|
309
|
-
return cells;
|
|
310
|
-
}));
|
|
275
|
+
key: column.getHeaderProps().key,
|
|
276
|
+
sortDirection: column.isSorted ? column.isSortedDesc ? 'desc' : 'asc' : false
|
|
277
|
+
}),
|
|
278
|
+
// only wrap in tableSortLabel if it is actually sortable, otherwise other functionalities (e.g. select) don't work
|
|
279
|
+
column.canSort && /*#__PURE__*/jsx(TableSortLabel, _objectSpread$h(_objectSpread$h({}, column.getSortByToggleProps()), {}, {
|
|
280
|
+
disabled: !column.canSort,
|
|
281
|
+
active: column.isSorted,
|
|
282
|
+
direction: column.isSortedDesc ? 'desc' : 'asc',
|
|
283
|
+
children: column.render('Header')
|
|
284
|
+
})), !column.canSort && column.render('Header')));
|
|
285
|
+
return cells;
|
|
286
|
+
});
|
|
287
|
+
}());
|
|
311
288
|
})
|
|
312
|
-
}), !dragDropRows && /*#__PURE__*/jsxs(TableBody, _objectSpread$
|
|
289
|
+
}), !dragDropRows && /*#__PURE__*/jsxs(TableBody, _objectSpread$h(_objectSpread$h({}, getTableBodyProps()), {}, {
|
|
313
290
|
children: [!isLoading && rows.map(function (row, index) {
|
|
314
291
|
return /*#__PURE__*/jsx(MemoizedRow, {
|
|
315
292
|
row: row,
|
|
@@ -326,8 +303,9 @@ function Table(_ref2) {
|
|
|
326
303
|
children: /*#__PURE__*/jsx(Droppable, {
|
|
327
304
|
droppableId: "droppable",
|
|
328
305
|
direction: "vertical",
|
|
306
|
+
type: "group",
|
|
329
307
|
children: function children(provided, snapshot) {
|
|
330
|
-
return /*#__PURE__*/jsxs(TableBody, _objectSpread$
|
|
308
|
+
return /*#__PURE__*/jsxs(TableBody, _objectSpread$h(_objectSpread$h(_objectSpread$h({}, provided.droppableProps), {}, {
|
|
331
309
|
ref: provided.innerRef
|
|
332
310
|
}, getTableBodyProps()), {}, {
|
|
333
311
|
children: [!isLoading && rows.map(function (row, index) {
|
|
@@ -342,10 +320,10 @@ function Table(_ref2) {
|
|
|
342
320
|
transform = transform.replace(/\(.+\,/, '(0,');
|
|
343
321
|
others.className = draggedCell;
|
|
344
322
|
}
|
|
345
|
-
others.style = _objectSpread$
|
|
323
|
+
others.style = _objectSpread$h(_objectSpread$h({}, provided.draggableProps.style), {}, {
|
|
346
324
|
transform: transform
|
|
347
325
|
});
|
|
348
|
-
return /*#__PURE__*/createElement(MemoizedRow, _objectSpread$
|
|
326
|
+
return /*#__PURE__*/createElement(MemoizedRow, _objectSpread$h(_objectSpread$h({
|
|
349
327
|
provided: provided,
|
|
350
328
|
ref: provided.innerRef
|
|
351
329
|
}, provided.draggableProps), {}, {
|
|
@@ -365,12 +343,7 @@ function Table(_ref2) {
|
|
|
365
343
|
}
|
|
366
344
|
})
|
|
367
345
|
})]
|
|
368
|
-
}))
|
|
369
|
-
style: {
|
|
370
|
-
height: 'calc(100% - 59px)'
|
|
371
|
-
},
|
|
372
|
-
children: /*#__PURE__*/jsx(NoData, {})
|
|
373
|
-
}))]
|
|
346
|
+
}))
|
|
374
347
|
});
|
|
375
348
|
}
|
|
376
349
|
var MemoizedRow = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
@@ -378,7 +351,7 @@ var MemoizedRow = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
378
351
|
provided = _ref3.provided,
|
|
379
352
|
others = _objectWithoutProperties(_ref3, _excluded2);
|
|
380
353
|
return useMemo(function () {
|
|
381
|
-
return /*#__PURE__*/jsx(MyRow, _objectSpread$
|
|
354
|
+
return /*#__PURE__*/jsx(MyRow, _objectSpread$h({
|
|
382
355
|
row: row,
|
|
383
356
|
ref: ref,
|
|
384
357
|
provided: provided
|
|
@@ -395,94 +368,78 @@ var MyRow = /*#__PURE__*/forwardRef(function (_ref4, ref) {
|
|
|
395
368
|
others = _objectWithoutProperties(_ref4, _excluded3);
|
|
396
369
|
prepareRow(row);
|
|
397
370
|
return /*#__PURE__*/jsxs(React.Fragment, {
|
|
398
|
-
children: [/*#__PURE__*/createElement(TableRow, _objectSpread$
|
|
371
|
+
children: [/*#__PURE__*/createElement(TableRow, _objectSpread$h(_objectSpread$h({}, row.getRowProps()), {}, {
|
|
399
372
|
key: row.getRowProps().key,
|
|
373
|
+
className: classnames({
|
|
374
|
+
childRow: row.depth,
|
|
375
|
+
expandedRow: row.isExpanded
|
|
376
|
+
}),
|
|
400
377
|
selected: row.isSelected,
|
|
401
378
|
onClick: function onClick() {
|
|
402
379
|
return toggleSelected(row.id);
|
|
403
380
|
},
|
|
404
381
|
ref: ref,
|
|
405
382
|
"data-test-id": "table-row"
|
|
406
|
-
}, others), dragDropRows && /*#__PURE__*/createElement(TableCell, _objectSpread$
|
|
407
|
-
|
|
408
|
-
style: {
|
|
409
|
-
padding: 0,
|
|
410
|
-
userSelect: 'unset'
|
|
411
|
-
}
|
|
412
|
-
})), {}, {
|
|
383
|
+
}, others), dragDropRows && /*#__PURE__*/createElement(TableCell, _objectSpread$h(_objectSpread$h(_objectSpread$h({}, provided === null || provided === void 0 ? void 0 : provided.dragHandleProps), row.cells[0].getCellProps()), {}, {
|
|
384
|
+
className: "drag-handle",
|
|
413
385
|
key: row.cells[0].getCellProps().key,
|
|
414
386
|
"data-test-id": "table-cell"
|
|
415
|
-
}), /*#__PURE__*/jsx(DragIndicatorIcon, {})),
|
|
416
|
-
var
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}
|
|
387
|
+
}), /*#__PURE__*/jsx(DragIndicatorIcon, {})), function () {
|
|
388
|
+
var cellSettings = row.cells.flat();
|
|
389
|
+
return cellSettings.map(function (cell, i) {
|
|
390
|
+
var _cellSettings;
|
|
391
|
+
var lastFlexible = ((_cellSettings = cellSettings[i + 1]) === null || _cellSettings === void 0 ? void 0 : _cellSettings.column.fixed) === true;
|
|
392
|
+
var cells = [];
|
|
393
|
+
if (cell.column.fixed) {
|
|
394
|
+
cells.push(/*#__PURE__*/createElement(TableCell, _objectSpread$h(_objectSpread$h({}, cell.getCellProps()), {}, {
|
|
395
|
+
className: "fixed-spacer1",
|
|
396
|
+
key: cell.getCellProps().key + '_a',
|
|
397
|
+
"data-test-id": "table-cell"
|
|
398
|
+
})));
|
|
399
|
+
cells.push(/*#__PURE__*/createElement(TableCell, _objectSpread$h(_objectSpread$h({}, cell.getCellProps()), {}, {
|
|
400
|
+
className: "fixed-spacer2",
|
|
401
|
+
key: cell.getCellProps().key + '_b',
|
|
402
|
+
"data-test-id": "table-cell"
|
|
403
|
+
}), /*#__PURE__*/jsx("div", {})));
|
|
404
|
+
}
|
|
405
|
+
cells.push(/*#__PURE__*/createElement(TableCell, _objectSpread$h(_objectSpread$h({
|
|
406
|
+
className: cell.column.fixed ? 'fixed' : ''
|
|
407
|
+
}, cell.getCellProps({
|
|
408
|
+
style: _objectSpread$h(_objectSpread$h({}, cellStyleHelper(cell)), {}, {
|
|
409
|
+
width: lastFlexible ? undefined : cell.column.width
|
|
410
|
+
})
|
|
439
411
|
})), {}, {
|
|
440
|
-
key: cell.getCellProps().key
|
|
412
|
+
key: cell.getCellProps().key,
|
|
441
413
|
"data-test-id": "table-cell"
|
|
442
|
-
}),
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
left: 0,
|
|
447
|
-
bottom: 0,
|
|
448
|
-
width: 1,
|
|
449
|
-
boxShadow: '-1px 0px 0px 0px rgba(224, 224, 224, 1)'
|
|
450
|
-
}
|
|
451
|
-
})));
|
|
452
|
-
}
|
|
453
|
-
cells.push(/*#__PURE__*/createElement(TableCell, _objectSpread$e(_objectSpread$e({}, cell.getCellProps({
|
|
454
|
-
style: _objectSpread$e({}, cellStyleHelper(cell))
|
|
455
|
-
})), {}, {
|
|
456
|
-
key: cell.getCellProps().key,
|
|
457
|
-
"data-test-id": "table-cell"
|
|
458
|
-
}), cell.isGrouped ?
|
|
459
|
-
/*#__PURE__*/
|
|
460
|
-
// If it's a grouped cell, add an expander and row count
|
|
461
|
-
jsxs("div", {
|
|
462
|
-
style: {
|
|
463
|
-
display: 'flex'
|
|
464
|
-
},
|
|
465
|
-
children: [/*#__PURE__*/jsx(IconButton, _objectSpread$e(_objectSpread$e({
|
|
466
|
-
"aria-label": "expand row",
|
|
467
|
-
size: "small"
|
|
468
|
-
}, row.getToggleRowExpandedProps()), {}, {
|
|
469
|
-
onClick: undefined,
|
|
470
|
-
children: row.isExpanded ? /*#__PURE__*/jsx(KeyboardArrowUpIcon, {}) : /*#__PURE__*/jsx(KeyboardArrowDownIcon, {})
|
|
471
|
-
})), /*#__PURE__*/jsxs("div", {
|
|
414
|
+
}), cell.isGrouped ?
|
|
415
|
+
/*#__PURE__*/
|
|
416
|
+
// If it's a grouped cell, add an expander and row count
|
|
417
|
+
jsxs("div", {
|
|
472
418
|
style: {
|
|
473
|
-
|
|
419
|
+
display: 'flex'
|
|
474
420
|
},
|
|
475
|
-
children: [
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
421
|
+
children: [/*#__PURE__*/jsx(IconButton, _objectSpread$h(_objectSpread$h({
|
|
422
|
+
"aria-label": "expand row",
|
|
423
|
+
size: "small"
|
|
424
|
+
}, row.getToggleRowExpandedProps()), {}, {
|
|
425
|
+
onClick: undefined,
|
|
426
|
+
children: row.isExpanded ? /*#__PURE__*/jsx(KeyboardArrowUpIcon, {}) : /*#__PURE__*/jsx(KeyboardArrowDownIcon, {})
|
|
427
|
+
})), /*#__PURE__*/jsxs("div", {
|
|
428
|
+
style: {
|
|
429
|
+
marginRight: '5px'
|
|
430
|
+
},
|
|
431
|
+
children: ["(", row.subRows.length, ")"]
|
|
432
|
+
}), cell.render('Cell')]
|
|
433
|
+
}) : cell.isAggregated ?
|
|
434
|
+
// If the cell is aggregated, use the Aggregated
|
|
435
|
+
// renderer for cell
|
|
436
|
+
cell.render('Aggregated') : cell.isPlaceholder ? /*#__PURE__*/jsx(Fragment, {}) // For cells with repeated values, render null
|
|
437
|
+
:
|
|
438
|
+
// Otherwise, just render the regular cell
|
|
439
|
+
cell.render('Cell')));
|
|
440
|
+
return cells;
|
|
441
|
+
});
|
|
442
|
+
}()), row.isExpanded && renderSubComponent && !row.isGrouped && /*#__PURE__*/jsx(Fragment, {
|
|
486
443
|
children: renderSubComponent(row)
|
|
487
444
|
})]
|
|
488
445
|
}, row.getRowProps().key + '_fragment');
|
|
@@ -490,12 +447,102 @@ var MyRow = /*#__PURE__*/forwardRef(function (_ref4, ref) {
|
|
|
490
447
|
var useStyles$6 = makeStyles(function () {
|
|
491
448
|
return createStyles({
|
|
492
449
|
table: {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
450
|
+
height: '100%',
|
|
451
|
+
scrollbarWidth: 'thin',
|
|
452
|
+
scrollbarGutter: 'stable',
|
|
453
|
+
backgroundColor: 'white',
|
|
454
|
+
'& .MuiTable-root': {
|
|
455
|
+
width: 'calc(100% - 5px)',
|
|
456
|
+
marginLeft: '5px'
|
|
457
|
+
},
|
|
458
|
+
'& .MuiTableRow-root': {
|
|
459
|
+
backgroundColor: 'unset',
|
|
460
|
+
borderRadius: '10px',
|
|
461
|
+
height: '79px',
|
|
462
|
+
position: 'relative'
|
|
463
|
+
},
|
|
464
|
+
'& .MuiTableRow-root:hover': {
|
|
465
|
+
backgroundColor: 'unset'
|
|
466
|
+
},
|
|
467
|
+
'& .MuiTableRow-head': {
|
|
468
|
+
height: '30px'
|
|
469
|
+
},
|
|
470
|
+
'& .MuiTableRow-root.expandedRow': {
|
|
471
|
+
boxShadow: '0px 7px 3px 0px #E5E7E9',
|
|
472
|
+
zIndex: 1
|
|
473
|
+
},
|
|
474
|
+
'& .MuiTableRow-root.expandedRow + .MuiTableRow-root': {
|
|
475
|
+
zIndex: 0
|
|
476
|
+
},
|
|
477
|
+
'& .MuiTableCell-root': {
|
|
478
|
+
border: 'none'
|
|
479
|
+
},
|
|
480
|
+
'& .MuiTableCell-head': {
|
|
481
|
+
paddingTop: '0px',
|
|
482
|
+
whiteSpace: 'wrap',
|
|
483
|
+
textAlign: 'left',
|
|
484
|
+
verticalAlign: 'bottom',
|
|
485
|
+
paddingBottom: '5px'
|
|
486
|
+
},
|
|
487
|
+
'& .MuiTableCell-body': {
|
|
488
|
+
backgroundColor: '#F6F7F8',
|
|
489
|
+
borderTop: '5px solid white'
|
|
490
|
+
},
|
|
491
|
+
'& .MuiTableCell-body:first-child': {
|
|
492
|
+
borderTopLeftRadius: '10px',
|
|
493
|
+
borderBottomLeftRadius: '10px'
|
|
494
|
+
},
|
|
495
|
+
'& .MuiTableCell-body:last-child': {
|
|
496
|
+
borderTopRightRadius: '10px',
|
|
497
|
+
borderBottomRightRadius: '10px'
|
|
498
|
+
},
|
|
499
|
+
'& .MuiTableRow-root.childRow .MuiTableCell-body': {
|
|
500
|
+
backgroundColor: '#FBFBFB',
|
|
501
|
+
borderWidth: '4px'
|
|
502
|
+
},
|
|
503
|
+
'& .MuiTableCell-root.fixed-spacer1': {
|
|
504
|
+
width: 50,
|
|
505
|
+
minWidth: 50,
|
|
506
|
+
padding: 0,
|
|
507
|
+
position: 'relative',
|
|
508
|
+
zIndex: 4,
|
|
509
|
+
backgroundColor: '#F6F7F8'
|
|
510
|
+
},
|
|
511
|
+
'& .MuiTableRow-root.childRow .MuiTableCell-root.fixed-spacer1': {
|
|
512
|
+
backgroundColor: '#FBFBFB'
|
|
513
|
+
},
|
|
514
|
+
'& .MuiTableCell-root.fixed-spacer2': {
|
|
515
|
+
width: 1,
|
|
516
|
+
minWidth: 1,
|
|
517
|
+
padding: 0,
|
|
518
|
+
position: 'sticky',
|
|
519
|
+
backgroundColor: 'white',
|
|
520
|
+
zIndex: 3,
|
|
521
|
+
right: 247
|
|
522
|
+
},
|
|
523
|
+
'& .MuiTableCell-root.fixed-spacer2 > div': {
|
|
524
|
+
position: 'absolute',
|
|
525
|
+
top: 0,
|
|
526
|
+
left: 3,
|
|
527
|
+
bottom: 0,
|
|
528
|
+
width: 15,
|
|
529
|
+
boxShadow: 'rgb(224, 224, 224) -3px 0px 1px -1px',
|
|
530
|
+
backgroundColor: '#F6F7F8'
|
|
531
|
+
},
|
|
532
|
+
'& .MuiTableRow-root.childRow .MuiTableCell-root.fixed-spacer2 > div': {
|
|
533
|
+
backgroundColor: '#FBFBFB'
|
|
534
|
+
},
|
|
535
|
+
'& .MuiTableRow-root .fixed': {
|
|
536
|
+
backgroundColor: '#F6F7F8'
|
|
537
|
+
},
|
|
538
|
+
'& .MuiTableRow-root.childRow .fixed': {
|
|
539
|
+
backgroundColor: '#FBFBFB'
|
|
540
|
+
},
|
|
541
|
+
'& .drag-handle': {
|
|
542
|
+
padding: 0,
|
|
543
|
+
userSelect: 'unset',
|
|
544
|
+
cursor: 'move'
|
|
545
|
+
}
|
|
499
546
|
}
|
|
500
547
|
});
|
|
501
548
|
});
|
|
@@ -507,66 +554,65 @@ var cellStyleHelper = function cellStyleHelper(cell) {
|
|
|
507
554
|
position: 'sticky',
|
|
508
555
|
right: 0,
|
|
509
556
|
zIndex: 4,
|
|
510
|
-
|
|
557
|
+
minWidth: cell.column.width
|
|
511
558
|
};
|
|
512
559
|
}
|
|
513
560
|
return {
|
|
514
561
|
width: cell.column.width,
|
|
562
|
+
minWidth: cell.column.minWidth,
|
|
515
563
|
padding: cell.column.padding,
|
|
516
564
|
position: 'relative',
|
|
517
565
|
zIndex: 3
|
|
518
566
|
};
|
|
519
567
|
};
|
|
520
568
|
function Loading(_ref5) {
|
|
569
|
+
var _ref6;
|
|
521
570
|
var headerGroups = _ref5.headerGroups,
|
|
571
|
+
parentRow = _ref5.parentRow,
|
|
522
572
|
rowHight = _ref5.rowHight;
|
|
523
|
-
|
|
573
|
+
var headers = headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups[headerGroups.length - 1].headers.flat();
|
|
574
|
+
var cellDefinitions = parentRow === null || parentRow === void 0 ? void 0 : parentRow.cells.flat();
|
|
575
|
+
var depth = parentRow ? parentRow.depth : 0;
|
|
524
576
|
var row = /*#__PURE__*/jsx(TableRow, {
|
|
525
|
-
|
|
577
|
+
className: classnames({
|
|
578
|
+
childRow: !!depth
|
|
579
|
+
}),
|
|
580
|
+
children: ((_ref6 = headers !== null && headers !== void 0 ? headers : cellDefinitions) !== null && _ref6 !== void 0 ? _ref6 : []).map(function (h, i) {
|
|
581
|
+
var _headers$fixed, _headers2, _cellDefinitions, _cellDefinitions$i, _cellDefinitions$i2, _cellDefinitions$i3, _cellDefinitions$i4;
|
|
582
|
+
var lastFlexible = ((_headers$fixed = headers === null || headers === void 0 || (_headers2 = headers[i + 1]) === null || _headers2 === void 0 ? void 0 : _headers2.fixed) !== null && _headers$fixed !== void 0 ? _headers$fixed : cellDefinitions === null || cellDefinitions === void 0 || (_cellDefinitions = cellDefinitions[i + 1]) === null || _cellDefinitions === void 0 ? void 0 : _cellDefinitions.column.fixed) === true;
|
|
583
|
+
var isFixed = 'fixed' in h ? h.fixed : cellDefinitions === null || cellDefinitions === void 0 || (_cellDefinitions$i = cellDefinitions[i]) === null || _cellDefinitions$i === void 0 ? void 0 : _cellDefinitions$i.column.fixed;
|
|
584
|
+
var id = 'id' in h ? h.id : cellDefinitions === null || cellDefinitions === void 0 || (_cellDefinitions$i2 = cellDefinitions[i]) === null || _cellDefinitions$i2 === void 0 ? void 0 : _cellDefinitions$i2.column.id;
|
|
585
|
+
var width = 'width' in h ? h.width : cellDefinitions === null || cellDefinitions === void 0 || (_cellDefinitions$i3 = cellDefinitions[i]) === null || _cellDefinitions$i3 === void 0 ? void 0 : _cellDefinitions$i3.column.width;
|
|
586
|
+
var minWidth = 'minWidth' in h ? h.minWidth : cellDefinitions === null || cellDefinitions === void 0 || (_cellDefinitions$i4 = cellDefinitions[i]) === null || _cellDefinitions$i4 === void 0 ? void 0 : _cellDefinitions$i4.column.minWidth;
|
|
526
587
|
var cells = [];
|
|
527
|
-
if (
|
|
588
|
+
if (isFixed) {
|
|
528
589
|
cells.push(/*#__PURE__*/jsx(TableCell, {
|
|
590
|
+
className: "fixed-spacer1",
|
|
529
591
|
style: {
|
|
530
|
-
width: 1,
|
|
531
|
-
padding: 0,
|
|
532
|
-
position: 'relative',
|
|
533
|
-
backgroundColor: 'white',
|
|
534
|
-
zIndex: 4,
|
|
535
592
|
height: rowHight
|
|
536
593
|
}
|
|
537
|
-
},
|
|
594
|
+
}, id + '1'));
|
|
538
595
|
cells.push(/*#__PURE__*/jsx(TableCell, {
|
|
596
|
+
className: "fixed-spacer2",
|
|
539
597
|
style: {
|
|
540
|
-
width: 1,
|
|
541
|
-
padding: 0,
|
|
542
|
-
position: 'sticky',
|
|
543
|
-
backgroundColor: 'white',
|
|
544
|
-
zIndex: 3,
|
|
545
|
-
right: 242,
|
|
546
598
|
height: rowHight
|
|
547
599
|
},
|
|
548
|
-
children: /*#__PURE__*/jsx("div", {
|
|
549
|
-
|
|
550
|
-
position: 'absolute',
|
|
551
|
-
top: 0,
|
|
552
|
-
left: 0,
|
|
553
|
-
bottom: 0,
|
|
554
|
-
width: 1,
|
|
555
|
-
boxShadow: '-1px 0px 0px 0px rgba(224, 224, 224, 1)'
|
|
556
|
-
}
|
|
557
|
-
})
|
|
558
|
-
}, h.id + '2'));
|
|
600
|
+
children: /*#__PURE__*/jsx("div", {})
|
|
601
|
+
}, id + '2'));
|
|
559
602
|
}
|
|
560
603
|
cells.push(/*#__PURE__*/jsx(TableCell, {
|
|
604
|
+
className: isFixed ? 'fixed' : '',
|
|
561
605
|
style: {
|
|
562
|
-
position:
|
|
563
|
-
right:
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
606
|
+
position: isFixed ? 'sticky' : 'relative',
|
|
607
|
+
right: isFixed ? 0 : undefined,
|
|
608
|
+
zIndex: isFixed ? 4 : 3,
|
|
609
|
+
height: rowHight,
|
|
610
|
+
width: lastFlexible ? undefined : width,
|
|
611
|
+
minWidth: isFixed ? width : minWidth,
|
|
612
|
+
maxWidth: isFixed ? width : undefined
|
|
567
613
|
},
|
|
568
614
|
children: /*#__PURE__*/jsx(Skeleton, {})
|
|
569
|
-
},
|
|
615
|
+
}, id));
|
|
570
616
|
return cells;
|
|
571
617
|
})
|
|
572
618
|
});
|
|
@@ -606,8 +652,8 @@ function GlobalFilter(_ref) {
|
|
|
606
652
|
});
|
|
607
653
|
}
|
|
608
654
|
|
|
609
|
-
function ownKeys$
|
|
610
|
-
function _objectSpread$
|
|
655
|
+
function ownKeys$g(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; }
|
|
656
|
+
function _objectSpread$g(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$g(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$g(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
611
657
|
/**
|
|
612
658
|
* The toolbar component for the grid, it holds filters and general action buttons.
|
|
613
659
|
* If there are filters specified it is expandable, otherwise it its a simple toolbar.
|
|
@@ -714,7 +760,7 @@ function Toolbar(_ref) {
|
|
|
714
760
|
children: view.icon
|
|
715
761
|
}, view.label);
|
|
716
762
|
})
|
|
717
|
-
}), globalFilter && /*#__PURE__*/jsx(GlobalFilter, _objectSpread$
|
|
763
|
+
}), globalFilter && /*#__PURE__*/jsx(GlobalFilter, _objectSpread$g({}, globalFilter))]
|
|
718
764
|
})
|
|
719
765
|
}), /*#__PURE__*/jsx(AccordionDetails, {
|
|
720
766
|
style: {
|
|
@@ -726,14 +772,14 @@ function Toolbar(_ref) {
|
|
|
726
772
|
}
|
|
727
773
|
|
|
728
774
|
var menuItemShowTooltip = "menuItemShowTooltip-m-Rd7";
|
|
729
|
-
var css_248z$
|
|
730
|
-
styleInject(css_248z$
|
|
775
|
+
var css_248z$4 = ".menuItemShowTooltip-m-Rd7 {\n pointer-events: inherit !important;\n}\n";
|
|
776
|
+
styleInject(css_248z$4);
|
|
731
777
|
|
|
732
778
|
function ActionCell(_ref) {
|
|
733
779
|
var row = _ref.row,
|
|
734
780
|
actions = _ref.actions,
|
|
735
|
-
|
|
736
|
-
|
|
781
|
+
_updateData = _ref.updateData,
|
|
782
|
+
_deleteData = _ref.deleteData,
|
|
737
783
|
_ref$groupActions = _ref.groupActions,
|
|
738
784
|
groupActions = _ref$groupActions === void 0 ? 2 : _ref$groupActions;
|
|
739
785
|
var _React$useState = React.useState(null),
|
|
@@ -754,16 +800,16 @@ function ActionCell(_ref) {
|
|
|
754
800
|
case 0:
|
|
755
801
|
_context.next = 2;
|
|
756
802
|
return action.onClick(row.original, row.id, function (data) {
|
|
757
|
-
return
|
|
803
|
+
return _updateData === null || _updateData === void 0 ? void 0 : _updateData(data, row.id);
|
|
758
804
|
}, function () {
|
|
759
|
-
return
|
|
805
|
+
return _deleteData === null || _deleteData === void 0 ? void 0 : _deleteData(row.index);
|
|
760
806
|
});
|
|
761
807
|
case 2:
|
|
762
808
|
callback = _context.sent;
|
|
763
809
|
callback === null || callback === void 0 || callback(row.original, row.id, function (data) {
|
|
764
|
-
return
|
|
810
|
+
return _updateData === null || _updateData === void 0 ? void 0 : _updateData(data, row.id);
|
|
765
811
|
}, function () {
|
|
766
|
-
return
|
|
812
|
+
return _deleteData === null || _deleteData === void 0 ? void 0 : _deleteData(row.index);
|
|
767
813
|
});
|
|
768
814
|
case 4:
|
|
769
815
|
case "end":
|
|
@@ -775,6 +821,19 @@ function ActionCell(_ref) {
|
|
|
775
821
|
return _ref2.apply(this, arguments);
|
|
776
822
|
};
|
|
777
823
|
}();
|
|
824
|
+
if (typeof actions === 'function') {
|
|
825
|
+
return /*#__PURE__*/jsx(Fragment, {
|
|
826
|
+
children: actions({
|
|
827
|
+
row: row,
|
|
828
|
+
updateData: function updateData(data) {
|
|
829
|
+
return _updateData === null || _updateData === void 0 ? void 0 : _updateData(data, row.id);
|
|
830
|
+
},
|
|
831
|
+
deleteData: function deleteData() {
|
|
832
|
+
return _deleteData === null || _deleteData === void 0 ? void 0 : _deleteData(row.index);
|
|
833
|
+
}
|
|
834
|
+
})
|
|
835
|
+
});
|
|
836
|
+
}
|
|
778
837
|
var finalActions = actions.filter(function (a) {
|
|
779
838
|
return typeof a.hide == 'function' ? !a.hide(row.original, row.id) : !a.hide;
|
|
780
839
|
});
|
|
@@ -826,7 +885,7 @@ function ActionCell(_ref) {
|
|
|
826
885
|
children: [" ", a.disabledTooltip, " "]
|
|
827
886
|
}) : '',
|
|
828
887
|
children: /*#__PURE__*/jsx(MenuItem, {
|
|
829
|
-
className:
|
|
888
|
+
className: classnames(a.disabledTooltip && (typeof a.disabled == 'function' ? a.disabled(row.original, row.id) : a.disabled) ? menuItemShowTooltip : undefined, 'additionalActionsMenu'),
|
|
830
889
|
disabled: typeof a.disabled == 'function' ? a.disabled(row.original, row.id) : a.disabled,
|
|
831
890
|
onClick: function onClick(e) {
|
|
832
891
|
if (typeof a.disabled == 'function' ? a.disabled(row.original, row.id) : a.disabled) {
|
|
@@ -845,12 +904,12 @@ function ActionCell(_ref) {
|
|
|
845
904
|
}
|
|
846
905
|
|
|
847
906
|
var _excluded$2 = ["isLoading", "noData"];
|
|
848
|
-
function ownKeys$
|
|
849
|
-
function _objectSpread$
|
|
907
|
+
function ownKeys$f(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; }
|
|
908
|
+
function _objectSpread$f(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$f(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$f(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
850
909
|
function Gallery(_ref) {
|
|
851
|
-
var isLoading = _ref.isLoading
|
|
852
|
-
|
|
853
|
-
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
910
|
+
var isLoading = _ref.isLoading;
|
|
911
|
+
_ref.noData;
|
|
912
|
+
var props = _objectWithoutProperties(_ref, _excluded$2);
|
|
854
913
|
var classes = useStyles$5();
|
|
855
914
|
var GalleryNode;
|
|
856
915
|
if (isLoading) {
|
|
@@ -863,13 +922,13 @@ function Gallery(_ref) {
|
|
|
863
922
|
if (props.rows.length > 0) {
|
|
864
923
|
GalleryNode = props.rows.some(function (r) {
|
|
865
924
|
return r.isExpanded;
|
|
866
|
-
}) ? /*#__PURE__*/jsx(GroupedGallery, _objectSpread$
|
|
925
|
+
}) ? /*#__PURE__*/jsx(GroupedGallery, _objectSpread$f(_objectSpread$f({}, props), {}, {
|
|
867
926
|
className: classes.gallery
|
|
868
|
-
})) : /*#__PURE__*/jsx(SimpleGallery, _objectSpread$
|
|
927
|
+
})) : /*#__PURE__*/jsx(SimpleGallery, _objectSpread$f(_objectSpread$f({}, props), {}, {
|
|
869
928
|
className: classes.gallery
|
|
870
929
|
}));
|
|
871
930
|
} else {
|
|
872
|
-
GalleryNode =
|
|
931
|
+
GalleryNode = /*#__PURE__*/jsx(Fragment, {});
|
|
873
932
|
}
|
|
874
933
|
}
|
|
875
934
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
@@ -1117,8 +1176,8 @@ function parseDate(value) {
|
|
|
1117
1176
|
}
|
|
1118
1177
|
}
|
|
1119
1178
|
|
|
1120
|
-
function ownKeys$
|
|
1121
|
-
function _objectSpread$
|
|
1179
|
+
function ownKeys$e(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; }
|
|
1180
|
+
function _objectSpread$e(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$e(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$e(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1122
1181
|
var localeMap = {
|
|
1123
1182
|
en: enLocale,
|
|
1124
1183
|
fr: frLocale,
|
|
@@ -1141,7 +1200,7 @@ function DateRangeFilter(_ref) {
|
|
|
1141
1200
|
if (date == undefined && (filterValue === null || filterValue === void 0 ? void 0 : filterValue.to) == undefined) {
|
|
1142
1201
|
setFilter(undefined);
|
|
1143
1202
|
} else {
|
|
1144
|
-
setFilter(_objectSpread$
|
|
1203
|
+
setFilter(_objectSpread$e(_objectSpread$e({}, filterValue), {}, {
|
|
1145
1204
|
type: 'date',
|
|
1146
1205
|
from: date || undefined
|
|
1147
1206
|
}));
|
|
@@ -1155,7 +1214,7 @@ function DateRangeFilter(_ref) {
|
|
|
1155
1214
|
if (date == undefined && (filterValue === null || filterValue === void 0 ? void 0 : filterValue.from) == undefined) {
|
|
1156
1215
|
setFilter(undefined);
|
|
1157
1216
|
} else {
|
|
1158
|
-
setFilter(_objectSpread$
|
|
1217
|
+
setFilter(_objectSpread$e(_objectSpread$e({}, filterValue), {}, {
|
|
1159
1218
|
type: 'date',
|
|
1160
1219
|
to: date || undefined
|
|
1161
1220
|
}));
|
|
@@ -1363,11 +1422,11 @@ var ExtendedTooltip = withStyles(function (theme) {
|
|
|
1363
1422
|
|
|
1364
1423
|
var editalbe = "editalbe-jZFBd";
|
|
1365
1424
|
var numbers = "numbers-mJ9nr";
|
|
1366
|
-
var css_248z$
|
|
1367
|
-
styleInject(css_248z$
|
|
1425
|
+
var css_248z$3 = ".editalbe-jZFBd {\n width: 100%;\n min-height: 20px;\n cursor: text;\n}\n.editalbe-jZFBd:hover {\n border-bottom: 1px solid rgba(0, 0, 0, 0.42);\n font-size: 16px;\n font-weight: 400;\n}\n\n.numbers-mJ9nr {\n text-align: right;\n}\n.numbers-mJ9nr input {\n text-align: right;\n}\n";
|
|
1426
|
+
styleInject(css_248z$3);
|
|
1368
1427
|
|
|
1369
|
-
function ownKeys$
|
|
1370
|
-
function _objectSpread$
|
|
1428
|
+
function ownKeys$d(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; }
|
|
1429
|
+
function _objectSpread$d(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$d(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$d(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1371
1430
|
function DefaultCell (_ref) {
|
|
1372
1431
|
var stateValue = _ref.value,
|
|
1373
1432
|
column = _ref.column,
|
|
@@ -1414,7 +1473,7 @@ function DefaultCell (_ref) {
|
|
|
1414
1473
|
break;
|
|
1415
1474
|
case 10:
|
|
1416
1475
|
_context.next = 12;
|
|
1417
|
-
return updateData === null || updateData === void 0 ? void 0 : updateData(unflatten(_objectSpread$
|
|
1476
|
+
return updateData === null || updateData === void 0 ? void 0 : updateData(unflatten(_objectSpread$d(_objectSpread$d({}, row.original), {}, _defineProperty({}, column.id, column.type == 'number' ? Number(value) : value))), row.id);
|
|
1418
1477
|
case 12:
|
|
1419
1478
|
setEditing(false);
|
|
1420
1479
|
case 13:
|
|
@@ -1460,7 +1519,7 @@ function DefaultCell (_ref) {
|
|
|
1460
1519
|
case 2:
|
|
1461
1520
|
setValue(newValue);
|
|
1462
1521
|
_context2.next = 5;
|
|
1463
|
-
return updateData === null || updateData === void 0 ? void 0 : updateData(unflatten(_objectSpread$
|
|
1522
|
+
return updateData === null || updateData === void 0 ? void 0 : updateData(unflatten(_objectSpread$d(_objectSpread$d({}, row.original), {}, _defineProperty({}, column.id, column.type == 'number' ? Number(newValue) : newValue))), row.id);
|
|
1464
1523
|
case 5:
|
|
1465
1524
|
case "end":
|
|
1466
1525
|
return _context2.stop();
|
|
@@ -1470,11 +1529,11 @@ function DefaultCell (_ref) {
|
|
|
1470
1529
|
return function (_x) {
|
|
1471
1530
|
return _ref3.apply(this, arguments);
|
|
1472
1531
|
};
|
|
1473
|
-
}());
|
|
1532
|
+
}(), row);
|
|
1474
1533
|
}
|
|
1475
1534
|
if (!editing || !isEditalbe) {
|
|
1476
1535
|
return /*#__PURE__*/jsx("div", {
|
|
1477
|
-
className:
|
|
1536
|
+
className: classnames(isEditalbe ? editalbe : undefined, column.type == 'number' ? numbers : undefined),
|
|
1478
1537
|
onClick: onClick ? onClick : function () {
|
|
1479
1538
|
return setEditing(true);
|
|
1480
1539
|
},
|
|
@@ -1507,11 +1566,11 @@ function DefaultCell (_ref) {
|
|
|
1507
1566
|
}
|
|
1508
1567
|
|
|
1509
1568
|
var tooltip = "tooltip-uMWFc";
|
|
1510
|
-
var css_248z$
|
|
1511
|
-
styleInject(css_248z$
|
|
1569
|
+
var css_248z$2 = ".tooltip-uMWFc {\n /* margin-top: 1rem; */\n background-color: #1b181a;\n color: white;\n padding: 6px;\n border-radius: 4px;\n}\n";
|
|
1570
|
+
styleInject(css_248z$2);
|
|
1512
1571
|
|
|
1513
|
-
function ownKeys$
|
|
1514
|
-
function _objectSpread$
|
|
1572
|
+
function ownKeys$c(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; }
|
|
1573
|
+
function _objectSpread$c(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$c(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$c(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1515
1574
|
function BooleanCell (_ref) {
|
|
1516
1575
|
var val = _ref.value,
|
|
1517
1576
|
column = _ref.column,
|
|
@@ -1549,15 +1608,25 @@ function BooleanCell (_ref) {
|
|
|
1549
1608
|
if (loading) return;
|
|
1550
1609
|
if (!isEditalbe) return;
|
|
1551
1610
|
setLoading(true);
|
|
1552
|
-
var updatedData = _objectSpread$
|
|
1611
|
+
var updatedData = _objectSpread$c({}, row.original);
|
|
1553
1612
|
column.id.split('.').reduce(function (acc, key, index, arr) {
|
|
1554
1613
|
if (index === arr.length - 1) {
|
|
1555
1614
|
if (column.dataType == 'organizationIdArray') {
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1615
|
+
if (Array.isArray(acc[key])) {
|
|
1616
|
+
var _acc$key;
|
|
1617
|
+
acc[key] = (_acc$key = acc[key]) !== null && _acc$key !== void 0 ? _acc$key : [];
|
|
1618
|
+
acc[key] = acc[key].includes(organization === null || organization === void 0 ? void 0 : organization._id) ? acc[key].filter(function (id) {
|
|
1619
|
+
return id !== (organization === null || organization === void 0 ? void 0 : organization._id);
|
|
1620
|
+
}) : [].concat(_toConsumableArray(acc[key]), [organization === null || organization === void 0 ? void 0 : organization._id]);
|
|
1621
|
+
} else if (acc[key] && _typeof(acc[key]) == 'object' && 'organizations' in acc[key]) {
|
|
1622
|
+
var _acc$key$organization, _acc$key2;
|
|
1623
|
+
acc[key].organizations = (_acc$key$organization = (_acc$key2 = acc[key]) === null || _acc$key2 === void 0 ? void 0 : _acc$key2.organizations) !== null && _acc$key$organization !== void 0 ? _acc$key$organization : [];
|
|
1624
|
+
acc[key].organizations = acc[key].organizations.includes(organization === null || organization === void 0 ? void 0 : organization._id) ? acc[key].organizations.filter(function (id) {
|
|
1625
|
+
return id !== (organization === null || organization === void 0 ? void 0 : organization._id);
|
|
1626
|
+
}) : [].concat(_toConsumableArray(acc[key].organizations), [organization === null || organization === void 0 ? void 0 : organization._id]);
|
|
1627
|
+
} else {
|
|
1628
|
+
acc[key] = !value;
|
|
1629
|
+
}
|
|
1561
1630
|
} else {
|
|
1562
1631
|
acc[key] = !value;
|
|
1563
1632
|
}
|
|
@@ -1587,7 +1656,7 @@ function BooleanCell (_ref) {
|
|
|
1587
1656
|
layerProps = _useLayer.layerProps,
|
|
1588
1657
|
renderLayer = _useLayer.renderLayer;
|
|
1589
1658
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
1590
|
-
children: [/*#__PURE__*/jsx("div", _objectSpread$
|
|
1659
|
+
children: [/*#__PURE__*/jsx("div", _objectSpread$c(_objectSpread$c(_objectSpread$c({}, triggerProps), hoverProps), {}, {
|
|
1591
1660
|
children: /*#__PURE__*/jsx(Checkbox, {
|
|
1592
1661
|
checked: value,
|
|
1593
1662
|
onChange: onChange,
|
|
@@ -1597,7 +1666,7 @@ function BooleanCell (_ref) {
|
|
|
1597
1666
|
disabled: !isEditalbe || !!disabled
|
|
1598
1667
|
})
|
|
1599
1668
|
})), renderLayer(/*#__PURE__*/jsx(Fragment, {
|
|
1600
|
-
children: isOver && !!disabled && /*#__PURE__*/jsx("div", _objectSpread$
|
|
1669
|
+
children: isOver && !!disabled && /*#__PURE__*/jsx("div", _objectSpread$c(_objectSpread$c({}, layerProps), {}, {
|
|
1601
1670
|
className: tooltip,
|
|
1602
1671
|
children: disabled
|
|
1603
1672
|
}))
|
|
@@ -1607,77 +1676,11 @@ function BooleanCell (_ref) {
|
|
|
1607
1676
|
|
|
1608
1677
|
var arMedium = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20height%3D%2248%22%20width%3D%2248%22%3E%3Cpath%20d%3D%22M6%2042V27h3v9.9L36.9%209H27V6h15v15h-3v-9.9L11.1%2039H21v3Z%22%2F%3E%3C%2Fsvg%3E";
|
|
1609
1678
|
|
|
1610
|
-
function MediaViewerCell (props) {
|
|
1611
|
-
if (!props.value) {
|
|
1612
|
-
return /*#__PURE__*/jsx(Fragment, {});
|
|
1613
|
-
}
|
|
1614
|
-
var _useState = useState(undefined),
|
|
1615
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1616
|
-
media = _useState2[0],
|
|
1617
|
-
setMedia = _useState2[1];
|
|
1618
|
-
var _useState3 = useState(Date.now()),
|
|
1619
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
1620
|
-
timeStamp = _useState4[0],
|
|
1621
|
-
setTimeStamp = _useState4[1];
|
|
1622
|
-
var id = props.value[0];
|
|
1623
|
-
useEffect(function () {
|
|
1624
|
-
if (!id) return;
|
|
1625
|
-
handler.mediaHandler.getMediaById(id).then(function (res) {
|
|
1626
|
-
var _mediaItem$urlVariant, _url;
|
|
1627
|
-
var mediaItem = res.data[0];
|
|
1628
|
-
if (!(mediaItem !== null && mediaItem !== void 0 && mediaItem.url)) return;
|
|
1629
|
-
var url = new URL(mediaItem.url);
|
|
1630
|
-
var mediaType = url.pathname.endsWith('.glb') ? 'AR' : 'PCT';
|
|
1631
|
-
if (url.pathname.endsWith('.tif') || url.pathname.endsWith('.tiff') && (_mediaItem$urlVariant = mediaItem.urlVariants) !== null && _mediaItem$urlVariant !== void 0 && _mediaItem$urlVariant[0]) {
|
|
1632
|
-
url = mediaItem.urlVariants[0];
|
|
1633
|
-
}
|
|
1634
|
-
if (mediaType == 'AR') {
|
|
1635
|
-
url.searchParams.append('v', timeStamp.toString());
|
|
1636
|
-
}
|
|
1637
|
-
setMedia({
|
|
1638
|
-
url: (_url = url) === null || _url === void 0 ? void 0 : _url.toString(),
|
|
1639
|
-
mediaType: mediaType,
|
|
1640
|
-
functionType: 'ART',
|
|
1641
|
-
storage: 'OTHER',
|
|
1642
|
-
borderPercentage: mediaItem.borderPercentage
|
|
1643
|
-
});
|
|
1644
|
-
});
|
|
1645
|
-
}, [timeStamp]);
|
|
1646
|
-
if (!id) return /*#__PURE__*/jsx(Fragment, {});
|
|
1647
|
-
var _useDivaCore = useDivaCore(),
|
|
1648
|
-
handler = _useDivaCore.handler,
|
|
1649
|
-
actions = _useDivaCore.actions;
|
|
1650
|
-
var openContentBox = function openContentBox() {
|
|
1651
|
-
setTimeStamp(Date.now());
|
|
1652
|
-
actions.openFullscreen({
|
|
1653
|
-
content: /*#__PURE__*/jsx(ContentBoxComponent, {
|
|
1654
|
-
settings: {
|
|
1655
|
-
contentBoxProps: {
|
|
1656
|
-
type: 'MediaViewer',
|
|
1657
|
-
medias: media ? [media] : undefined,
|
|
1658
|
-
defaultDataOptions: 'fullscreen.enable:false;'
|
|
1659
|
-
}
|
|
1660
|
-
}
|
|
1661
|
-
})
|
|
1662
|
-
});
|
|
1663
|
-
};
|
|
1664
|
-
return /*#__PURE__*/jsx(Fragment, {
|
|
1665
|
-
children: (media === null || media === void 0 ? void 0 : media.mediaType) === 'AR' ? /*#__PURE__*/jsx("img", {
|
|
1666
|
-
src: arMedium,
|
|
1667
|
-
onClick: openContentBox
|
|
1668
|
-
}) : /*#__PURE__*/jsx("img", {
|
|
1669
|
-
src: media === null || media === void 0 ? void 0 : media.url,
|
|
1670
|
-
width: 39,
|
|
1671
|
-
onClick: openContentBox
|
|
1672
|
-
})
|
|
1673
|
-
});
|
|
1674
|
-
}
|
|
1675
|
-
|
|
1676
1679
|
var imageCell = "imageCell-5dnCl";
|
|
1677
1680
|
var loaded = "loaded-RbMyi";
|
|
1678
1681
|
var hasError = "hasError-gzS9i";
|
|
1679
|
-
var css_248z = ".imageCell-5dnCl {\n display: block;\n min-width: 60px;\n height: 60px;\n margin:
|
|
1680
|
-
styleInject(css_248z);
|
|
1682
|
+
var css_248z$1 = ".imageCell-5dnCl {\n display: block;\n min-width: 60px;\n height: 60px;\n margin-top: -20px;\n margin-bottom: -20px;\n}\n\n@keyframes loaded-RbMyi {\n 0% {\n opacity: 0.1;\n }\n 100% {\n opacity: 1;\n }\n}\n\n.imageCell-5dnCl.loaded-RbMyi:not(.hasError-gzS9i) {\n animation: loaded-RbMyi 300ms ease-in-out;\n}\n\n.imageCell-5dnCl.hasError-gzS9i {\n content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAAAAAAfl4auAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElNRQfmBQQGJh52F4jtAAAArElEQVRIx+3SwQ6CMAwG4K5sA8V4MTGejO//Ul48SLJkBDw4YNQLHIeuXvtf1mT7kraZugM/+IcVLFiwYMGs6PSVWk5i4GlcisLm46YvAAiAyivmYpqOh6FGgK5L9r2xMPRNqKqdTb/YWpgx+t3XkYcvUT2CnzUHQ4HPeCMX0oOl7Tz59qTtntM2tq+RnINoVDZW57Vdg9kYymqtKB9v/OkfFvY9ggULFiyYkw/YJiwWdl9zmAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMi0wNS0wNFQwNjozODowNiswMDowMIF3ol0AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjItMDUtMDRUMDY6Mzg6MDYrMDA6MDDwKhrhAAAAAElFTkSuQmCC);\n}\n";
|
|
1683
|
+
styleInject(css_248z$1);
|
|
1681
1684
|
|
|
1682
1685
|
var placeholder = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAAAAAAfl4auAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElNRQfmBQQGJh52F4jtAAAArElEQVRIx+3SwQ6CMAwG4K5sA8V4MTGejO//Ul48SLJkBDw4YNQLHIeuXvtf1mT7kraZugM/+IcVLFiwYMGs6PSVWk5i4GlcisLm46YvAAiAyivmYpqOh6FGgK5L9r2xMPRNqKqdTb/YWpgx+t3XkYcvUT2CnzUHQ4HPeCMX0oOl7Tz59qTtntM2tq+RnINoVDZW57Vdg9kYymqtKB9v/OkfFvY9ggULFiyYkw/YJiwWdl9zmAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMi0wNS0wNFQwNjozODowNiswMDowMIF3ol0AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjItMDUtMDRUMDY6Mzg6MDYrMDA6MDDwKhrhAAAAAElFTkSuQmCC";
|
|
1683
1686
|
|
|
@@ -1774,9 +1777,75 @@ var isImage = function isImage(data) {
|
|
|
1774
1777
|
}
|
|
1775
1778
|
};
|
|
1776
1779
|
|
|
1780
|
+
function ownKeys$b(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; }
|
|
1781
|
+
function _objectSpread$b(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$b(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$b(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1782
|
+
function MediaViewerCell (props) {
|
|
1783
|
+
var _props$value, _props$column$fallbac;
|
|
1784
|
+
var _useState = useState(undefined),
|
|
1785
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1786
|
+
media = _useState2[0],
|
|
1787
|
+
setMedia = _useState2[1];
|
|
1788
|
+
var _useState3 = useState(Date.now()),
|
|
1789
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
1790
|
+
timeStamp = _useState4[0],
|
|
1791
|
+
setTimeStamp = _useState4[1];
|
|
1792
|
+
var _useDivaCore = useDivaCore(),
|
|
1793
|
+
handler = _useDivaCore.handler,
|
|
1794
|
+
actions = _useDivaCore.actions;
|
|
1795
|
+
var id = (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value[0];
|
|
1796
|
+
useEffect(function () {
|
|
1797
|
+
if (!id) return;
|
|
1798
|
+
handler.mediaHandler.getMediaById(id).then(function (res) {
|
|
1799
|
+
var _mediaItem$urlVariant, _url;
|
|
1800
|
+
var mediaItem = res.data[0];
|
|
1801
|
+
if (!(mediaItem !== null && mediaItem !== void 0 && mediaItem.url)) return;
|
|
1802
|
+
var url = new URL(mediaItem.url);
|
|
1803
|
+
var mediaType = url.pathname.endsWith('.glb') ? 'AR' : 'PCT';
|
|
1804
|
+
if (url.pathname.endsWith('.tif') || url.pathname.endsWith('.tiff') && (_mediaItem$urlVariant = mediaItem.urlVariants) !== null && _mediaItem$urlVariant !== void 0 && _mediaItem$urlVariant[0]) {
|
|
1805
|
+
url = mediaItem.urlVariants[0];
|
|
1806
|
+
}
|
|
1807
|
+
if (mediaType == 'AR') {
|
|
1808
|
+
url.searchParams.append('v', timeStamp.toString());
|
|
1809
|
+
}
|
|
1810
|
+
setMedia({
|
|
1811
|
+
url: (_url = url) === null || _url === void 0 ? void 0 : _url.toString(),
|
|
1812
|
+
mediaType: mediaType,
|
|
1813
|
+
functionType: 'ART',
|
|
1814
|
+
storage: 'OTHER',
|
|
1815
|
+
borderPercentage: mediaItem.borderPercentage
|
|
1816
|
+
});
|
|
1817
|
+
});
|
|
1818
|
+
}, [timeStamp]);
|
|
1819
|
+
if (!id) return /*#__PURE__*/jsx(ImgCell, _objectSpread$b(_objectSpread$b({}, props), {}, {
|
|
1820
|
+
value: props.row.original[(_props$column$fallbac = props.column.fallbackField) !== null && _props$column$fallbac !== void 0 ? _props$column$fallbac : '']
|
|
1821
|
+
}));
|
|
1822
|
+
var openContentBox = function openContentBox() {
|
|
1823
|
+
setTimeStamp(Date.now());
|
|
1824
|
+
actions.openFullscreen({
|
|
1825
|
+
content: /*#__PURE__*/jsx(ContentBoxComponent, {
|
|
1826
|
+
settings: {
|
|
1827
|
+
contentBoxProps: {
|
|
1828
|
+
type: 'MediaViewer',
|
|
1829
|
+
medias: media ? [media] : undefined,
|
|
1830
|
+
defaultDataOptions: 'fullscreen.enable:false;'
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
})
|
|
1834
|
+
});
|
|
1835
|
+
};
|
|
1836
|
+
return /*#__PURE__*/jsx("img", {
|
|
1837
|
+
src: (media === null || media === void 0 ? void 0 : media.mediaType) === 'AR' ? arMedium : media === null || media === void 0 ? void 0 : media.url,
|
|
1838
|
+
onClick: openContentBox,
|
|
1839
|
+
className: imageCell,
|
|
1840
|
+
style: {
|
|
1841
|
+
cursor: 'zoom-in'
|
|
1842
|
+
}
|
|
1843
|
+
});
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1777
1846
|
var _excluded$1 = ["showArrows"];
|
|
1778
|
-
function ownKeys$
|
|
1779
|
-
function _objectSpread$
|
|
1847
|
+
function ownKeys$a(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; }
|
|
1848
|
+
function _objectSpread$a(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$a(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$a(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1780
1849
|
function SelectionCell (_ref) {
|
|
1781
1850
|
var _props$value;
|
|
1782
1851
|
var showArrows = _ref.showArrows,
|
|
@@ -1815,7 +1884,7 @@ function SelectionCell (_ref) {
|
|
|
1815
1884
|
if (loading) return;
|
|
1816
1885
|
setLoading(true);
|
|
1817
1886
|
setValue(event.target.value);
|
|
1818
|
-
(_props$updateData = props.updateData) === null || _props$updateData === void 0 || _props$updateData.call(props, _objectSpread$
|
|
1887
|
+
(_props$updateData = props.updateData) === null || _props$updateData === void 0 || _props$updateData.call(props, _objectSpread$a(_objectSpread$a({}, props.row.original), {}, _defineProperty({}, props.column.id, event.target.value)), props.row.id, props.column).then(function () {
|
|
1819
1888
|
setLoading(false);
|
|
1820
1889
|
});
|
|
1821
1890
|
};
|
|
@@ -1830,7 +1899,7 @@ function SelectionCell (_ref) {
|
|
|
1830
1899
|
setLoading(true);
|
|
1831
1900
|
var newIndex = type == 'back' ? currentOptionIndex - 1 : currentOptionIndex + 1;
|
|
1832
1901
|
setValue((_options$newIndex = options[newIndex]) === null || _options$newIndex === void 0 ? void 0 : _options$newIndex.key);
|
|
1833
|
-
(_props$updateData2 = props.updateData) === null || _props$updateData2 === void 0 || _props$updateData2.call(props, _objectSpread$
|
|
1902
|
+
(_props$updateData2 = props.updateData) === null || _props$updateData2 === void 0 || _props$updateData2.call(props, _objectSpread$a(_objectSpread$a({}, props.row.original), {}, _defineProperty({}, props.column.id, (_options$newIndex2 = options[newIndex]) === null || _options$newIndex2 === void 0 ? void 0 : _options$newIndex2.key)), props.row.id, props.column).then(function () {
|
|
1834
1903
|
setLoading(false);
|
|
1835
1904
|
});
|
|
1836
1905
|
};
|
|
@@ -1871,11 +1940,11 @@ function SelectionCell (_ref) {
|
|
|
1871
1940
|
}) :
|
|
1872
1941
|
/*#__PURE__*/
|
|
1873
1942
|
//if it is not editalbe it behaves the same as a string cell
|
|
1874
|
-
jsx(DefaultCell, _objectSpread$
|
|
1943
|
+
jsx(DefaultCell, _objectSpread$a({}, props));
|
|
1875
1944
|
}
|
|
1876
1945
|
|
|
1877
|
-
function ownKeys$
|
|
1878
|
-
function _objectSpread$
|
|
1946
|
+
function ownKeys$9(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; }
|
|
1947
|
+
function _objectSpread$9(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$9(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$9(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1879
1948
|
function TextCell (props) {
|
|
1880
1949
|
var _ref;
|
|
1881
1950
|
var isTranslated = props.column.type == 'textTranslation' || props.column.type == 'richTextTranslation';
|
|
@@ -1894,10 +1963,10 @@ function TextCell (props) {
|
|
|
1894
1963
|
if (save === 0) return;
|
|
1895
1964
|
if (isTranslated) {
|
|
1896
1965
|
var _props$updateData;
|
|
1897
|
-
(_props$updateData = props.updateData) === null || _props$updateData === void 0 || _props$updateData.call(props, _objectSpread$
|
|
1966
|
+
(_props$updateData = props.updateData) === null || _props$updateData === void 0 || _props$updateData.call(props, _objectSpread$9(_objectSpread$9({}, props.row.original), {}, _defineProperty(_defineProperty({}, props.column.id, value[languages[0]]), props.column.id + '_locales', value)), props.row.id);
|
|
1898
1967
|
} else {
|
|
1899
1968
|
var _props$updateData2;
|
|
1900
|
-
(_props$updateData2 = props.updateData) === null || _props$updateData2 === void 0 || _props$updateData2.call(props, _objectSpread$
|
|
1969
|
+
(_props$updateData2 = props.updateData) === null || _props$updateData2 === void 0 || _props$updateData2.call(props, _objectSpread$9(_objectSpread$9({}, props.row.original), {}, _defineProperty({}, props.column.id, value)), props.row.id);
|
|
1901
1970
|
}
|
|
1902
1971
|
}, [save]);
|
|
1903
1972
|
var onChange = function onChange(accepted) {
|
|
@@ -1909,7 +1978,7 @@ function TextCell (props) {
|
|
|
1909
1978
|
};
|
|
1910
1979
|
|
|
1911
1980
|
//if it is not editalbe it behaves the same as a string cell
|
|
1912
|
-
return /*#__PURE__*/jsx(DefaultCell, _objectSpread$
|
|
1981
|
+
return /*#__PURE__*/jsx(DefaultCell, _objectSpread$9(_objectSpread$9({}, props), {}, {
|
|
1913
1982
|
onClick: function onClick() {
|
|
1914
1983
|
var _props$column$type, _props$column$type$st, _props$column$type2, _props$column$type2$e;
|
|
1915
1984
|
return openModal({
|
|
@@ -1948,7 +2017,7 @@ function Text(_ref3) {
|
|
|
1948
2017
|
}, [value]);
|
|
1949
2018
|
function changeText(text) {
|
|
1950
2019
|
if (translation) {
|
|
1951
|
-
setValue(_objectSpread$
|
|
2020
|
+
setValue(_objectSpread$9(_objectSpread$9({}, value), {}, _defineProperty({}, languages[curLangIndex], text)));
|
|
1952
2021
|
} else {
|
|
1953
2022
|
setValue(text);
|
|
1954
2023
|
}
|
|
@@ -1962,7 +2031,7 @@ function Text(_ref3) {
|
|
|
1962
2031
|
defaultValue: translation ? value[languages[curLangIndex]] : value,
|
|
1963
2032
|
onChange: function onChange(e) {
|
|
1964
2033
|
if (translation) {
|
|
1965
|
-
setValue(_objectSpread$
|
|
2034
|
+
setValue(_objectSpread$9(_objectSpread$9({}, value), {}, _defineProperty({}, languages[curLangIndex], e.target.value)));
|
|
1966
2035
|
} else setValue(e.target.value);
|
|
1967
2036
|
},
|
|
1968
2037
|
maxLength: maxLength,
|
|
@@ -1998,7 +2067,7 @@ function TranslationSelector(_ref4) {
|
|
|
1998
2067
|
return setCutLang(newValue);
|
|
1999
2068
|
},
|
|
2000
2069
|
children: languages.map(function (lang, index) {
|
|
2001
|
-
return /*#__PURE__*/jsx(Tab, _objectSpread$
|
|
2070
|
+
return /*#__PURE__*/jsx(Tab, _objectSpread$9({
|
|
2002
2071
|
style: {
|
|
2003
2072
|
minWidth: 72,
|
|
2004
2073
|
height: '30px',
|
|
@@ -2018,8 +2087,8 @@ function a11yProps(index) {
|
|
|
2018
2087
|
}
|
|
2019
2088
|
|
|
2020
2089
|
var _excluded = ["onValueChange", "value"];
|
|
2021
|
-
function ownKeys$
|
|
2022
|
-
function _objectSpread$
|
|
2090
|
+
function ownKeys$8(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; }
|
|
2091
|
+
function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$8(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$8(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2023
2092
|
function PriceCell (props) {
|
|
2024
2093
|
var _useState = useState(false),
|
|
2025
2094
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -2058,7 +2127,7 @@ function PriceCell (props) {
|
|
|
2058
2127
|
break;
|
|
2059
2128
|
case 10:
|
|
2060
2129
|
_context.next = 12;
|
|
2061
|
-
return (_props$updateData2 = props.updateData) === null || _props$updateData2 === void 0 ? void 0 : _props$updateData2.call(props, _objectSpread$
|
|
2130
|
+
return (_props$updateData2 = props.updateData) === null || _props$updateData2 === void 0 ? void 0 : _props$updateData2.call(props, _objectSpread$8(_objectSpread$8({}, props.row.original), {}, _defineProperty({}, props.column.id, value)), props.row.id);
|
|
2062
2131
|
case 12:
|
|
2063
2132
|
setEditing(false);
|
|
2064
2133
|
case 13:
|
|
@@ -2073,8 +2142,8 @@ function PriceCell (props) {
|
|
|
2073
2142
|
}();
|
|
2074
2143
|
var isEditalbe = props.column.editable && props.inlineEditing;
|
|
2075
2144
|
if (!editing || !isEditalbe) {
|
|
2076
|
-
return /*#__PURE__*/jsx(DefaultCell, _objectSpread$
|
|
2077
|
-
column: _objectSpread$
|
|
2145
|
+
return /*#__PURE__*/jsx(DefaultCell, _objectSpread$8(_objectSpread$8({}, props), {}, {
|
|
2146
|
+
column: _objectSpread$8({}, props.column),
|
|
2078
2147
|
value: DivaUtils.formatPrice(props.value),
|
|
2079
2148
|
onClick: function onClick() {
|
|
2080
2149
|
return setEditing(true);
|
|
@@ -2137,7 +2206,7 @@ function ControlledNumberFormat(_ref2) {
|
|
|
2137
2206
|
}
|
|
2138
2207
|
(_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 || _props$onBlur.call(props, e);
|
|
2139
2208
|
};
|
|
2140
|
-
return /*#__PURE__*/jsx(NumericFormat, _objectSpread$
|
|
2209
|
+
return /*#__PURE__*/jsx(NumericFormat, _objectSpread$8(_objectSpread$8({}, props), {}, {
|
|
2141
2210
|
value: value,
|
|
2142
2211
|
customInput: StyledTextFiled,
|
|
2143
2212
|
onChange: function onChange() {
|
|
@@ -2200,8 +2269,8 @@ function getLocale(lang) {
|
|
|
2200
2269
|
}
|
|
2201
2270
|
}
|
|
2202
2271
|
|
|
2203
|
-
function ownKeys$
|
|
2204
|
-
function _objectSpread$
|
|
2272
|
+
function ownKeys$7(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; }
|
|
2273
|
+
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2205
2274
|
function FormularCell (props) {
|
|
2206
2275
|
var _useDivaCore = useDivaCore(),
|
|
2207
2276
|
openModal = _useDivaCore.actions.openModal;
|
|
@@ -2209,7 +2278,7 @@ function FormularCell (props) {
|
|
|
2209
2278
|
t = _useTranslation.t;
|
|
2210
2279
|
function doUpdateVariant(d) {
|
|
2211
2280
|
var _props$updateData;
|
|
2212
|
-
(_props$updateData = props.updateData) === null || _props$updateData === void 0 || _props$updateData.call(props, _objectSpread$
|
|
2281
|
+
(_props$updateData = props.updateData) === null || _props$updateData === void 0 || _props$updateData.call(props, _objectSpread$7({}, d), props.row.id);
|
|
2213
2282
|
}
|
|
2214
2283
|
return /*#__PURE__*/jsx(Fragment, {
|
|
2215
2284
|
children: /*#__PURE__*/jsx(Button, {
|
|
@@ -2232,34 +2301,34 @@ function FormularCell (props) {
|
|
|
2232
2301
|
});
|
|
2233
2302
|
}
|
|
2234
2303
|
|
|
2235
|
-
function ownKeys$
|
|
2236
|
-
function _objectSpread$
|
|
2304
|
+
function ownKeys$6(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; }
|
|
2305
|
+
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2237
2306
|
function CustomCell (props) {
|
|
2238
2307
|
var classes = useStyles$1();
|
|
2239
2308
|
return /*#__PURE__*/jsx("div", {
|
|
2240
2309
|
className: classes.wrapper,
|
|
2241
|
-
children: /*#__PURE__*/jsx(Cell, _objectSpread$
|
|
2310
|
+
children: /*#__PURE__*/jsx(Cell, _objectSpread$6({}, props))
|
|
2242
2311
|
});
|
|
2243
2312
|
}
|
|
2244
2313
|
function Cell(props) {
|
|
2245
2314
|
switch (props.column.type) {
|
|
2246
2315
|
case 'boolean':
|
|
2247
|
-
return /*#__PURE__*/jsx(BooleanCell, _objectSpread$
|
|
2316
|
+
return /*#__PURE__*/jsx(BooleanCell, _objectSpread$6({}, props));
|
|
2248
2317
|
case 'mediaViewer':
|
|
2249
|
-
return /*#__PURE__*/jsx(MediaViewerCell, _objectSpread$
|
|
2318
|
+
return /*#__PURE__*/jsx(MediaViewerCell, _objectSpread$6({}, props));
|
|
2250
2319
|
case 'image':
|
|
2251
|
-
return /*#__PURE__*/jsx(ImgCell, _objectSpread$
|
|
2320
|
+
return /*#__PURE__*/jsx(ImgCell, _objectSpread$6({}, props));
|
|
2252
2321
|
case 'select':
|
|
2253
|
-
return /*#__PURE__*/jsx(SelectionCell, _objectSpread$
|
|
2322
|
+
return /*#__PURE__*/jsx(SelectionCell, _objectSpread$6({}, props));
|
|
2254
2323
|
case 'selectArrows':
|
|
2255
|
-
return /*#__PURE__*/jsx(SelectionCell, _objectSpread$
|
|
2324
|
+
return /*#__PURE__*/jsx(SelectionCell, _objectSpread$6(_objectSpread$6({}, props), {}, {
|
|
2256
2325
|
showArrows: true
|
|
2257
2326
|
}));
|
|
2258
2327
|
case 'text':
|
|
2259
2328
|
case 'textTranslation':
|
|
2260
2329
|
case 'richText':
|
|
2261
2330
|
case 'richTextTranslation':
|
|
2262
|
-
return /*#__PURE__*/jsx(TextCell, _objectSpread$
|
|
2331
|
+
return /*#__PURE__*/jsx(TextCell, _objectSpread$6({}, props));
|
|
2263
2332
|
case 'htmlText':
|
|
2264
2333
|
return /*#__PURE__*/jsx(TextareaAutosize$1, {
|
|
2265
2334
|
value: props.value,
|
|
@@ -2272,32 +2341,31 @@ function Cell(props) {
|
|
|
2272
2341
|
}
|
|
2273
2342
|
});
|
|
2274
2343
|
case 'price':
|
|
2275
|
-
return /*#__PURE__*/jsx(PriceCell, _objectSpread$
|
|
2344
|
+
return /*#__PURE__*/jsx(PriceCell, _objectSpread$6({}, props));
|
|
2276
2345
|
case 'date':
|
|
2277
|
-
return /*#__PURE__*/jsx(DateCell, _objectSpread$
|
|
2346
|
+
return /*#__PURE__*/jsx(DateCell, _objectSpread$6({}, props));
|
|
2278
2347
|
case 'formular':
|
|
2279
|
-
return /*#__PURE__*/jsx(FormularCell, _objectSpread$
|
|
2348
|
+
return /*#__PURE__*/jsx(FormularCell, _objectSpread$6({}, props));
|
|
2280
2349
|
case 'string':
|
|
2281
2350
|
case 'number':
|
|
2282
2351
|
default:
|
|
2283
|
-
return /*#__PURE__*/jsx(DefaultCell, _objectSpread$
|
|
2352
|
+
return /*#__PURE__*/jsx(DefaultCell, _objectSpread$6({}, props));
|
|
2284
2353
|
}
|
|
2285
2354
|
}
|
|
2286
2355
|
var useStyles$1 = makeStyles(function (theme) {
|
|
2287
2356
|
return createStyles({
|
|
2288
2357
|
wrapper: {
|
|
2289
2358
|
maxWidth: theme.spacing(40),
|
|
2290
|
-
marginRight: theme.spacing(3),
|
|
2291
2359
|
minWidth: theme.spacing(5)
|
|
2292
2360
|
}
|
|
2293
2361
|
});
|
|
2294
2362
|
});
|
|
2295
2363
|
|
|
2296
|
-
function ownKeys$
|
|
2297
|
-
function _objectSpread$
|
|
2364
|
+
function ownKeys$5(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; }
|
|
2365
|
+
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2298
2366
|
function useParsedOptions(options) {
|
|
2299
2367
|
return useMemo(function () {
|
|
2300
|
-
var parsedOptions = _objectSpread$
|
|
2368
|
+
var parsedOptions = _objectSpread$5(_objectSpread$5({}, options), {}, {
|
|
2301
2369
|
columns: [],
|
|
2302
2370
|
hiddenColumns: [],
|
|
2303
2371
|
pagination: _typeof(options.pagination) == 'object' ? options.pagination : options.pagination ? {} : undefined
|
|
@@ -2334,9 +2402,12 @@ function parseColumn(value) {
|
|
|
2334
2402
|
disabled: value.disabled,
|
|
2335
2403
|
handleUpdate: value.handleUpdate,
|
|
2336
2404
|
minWidth: value.minWidth,
|
|
2405
|
+
width: value.width,
|
|
2406
|
+
maxWidth: value.maxWidth,
|
|
2337
2407
|
dataType: value.dataType,
|
|
2338
2408
|
preUpdateData: value.preUpdateData,
|
|
2339
|
-
maxLength: value.maxLength
|
|
2409
|
+
maxLength: value.maxLength,
|
|
2410
|
+
fallbackField: value.fallbackField
|
|
2340
2411
|
};
|
|
2341
2412
|
}
|
|
2342
2413
|
function getFilterComponent(value) {
|
|
@@ -2503,53 +2574,73 @@ function fetchData(_x2, _x3, _x4) {
|
|
|
2503
2574
|
}
|
|
2504
2575
|
function _fetchData() {
|
|
2505
2576
|
_fetchData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(abortSignal, url, authToken) {
|
|
2506
|
-
var response;
|
|
2577
|
+
var response, data;
|
|
2507
2578
|
return _regeneratorRuntime.wrap(function _callee2$(_context3) {
|
|
2508
2579
|
while (1) switch (_context3.prev = _context3.next) {
|
|
2509
2580
|
case 0:
|
|
2510
|
-
_context3.
|
|
2581
|
+
_context3.prev = 0;
|
|
2582
|
+
_context3.next = 3;
|
|
2511
2583
|
return fetch(url, {
|
|
2512
2584
|
signal: abortSignal,
|
|
2513
2585
|
headers: authToken ? {
|
|
2514
2586
|
Authorization: "Bearer ".concat(authToken)
|
|
2515
2587
|
} : {}
|
|
2516
|
-
}).then(function (res) {
|
|
2517
|
-
if (!res.ok) {
|
|
2518
|
-
if (res.status == 408) {
|
|
2519
|
-
throw {
|
|
2520
|
-
name: 'TimeoutError',
|
|
2521
|
-
message: 'A timeout occured'
|
|
2522
|
-
};
|
|
2523
|
-
}
|
|
2524
|
-
throw new Error(res.statusText);
|
|
2525
|
-
}
|
|
2526
|
-
return res.json();
|
|
2527
|
-
})["catch"](function (e) {
|
|
2528
|
-
throw e;
|
|
2529
2588
|
});
|
|
2530
|
-
case
|
|
2589
|
+
case 3:
|
|
2531
2590
|
response = _context3.sent;
|
|
2532
|
-
if (
|
|
2591
|
+
if (response.ok) {
|
|
2592
|
+
_context3.next = 8;
|
|
2593
|
+
break;
|
|
2594
|
+
}
|
|
2595
|
+
if (!(response.status === 408)) {
|
|
2533
2596
|
_context3.next = 7;
|
|
2534
2597
|
break;
|
|
2535
2598
|
}
|
|
2536
|
-
|
|
2599
|
+
throw {
|
|
2600
|
+
name: 'TimeoutError',
|
|
2601
|
+
message: 'A timeout occurred'
|
|
2602
|
+
};
|
|
2537
2603
|
case 7:
|
|
2538
|
-
|
|
2539
|
-
|
|
2604
|
+
throw new Error(response.statusText);
|
|
2605
|
+
case 8:
|
|
2606
|
+
_context3.next = 10;
|
|
2607
|
+
return response.json();
|
|
2608
|
+
case 10:
|
|
2609
|
+
data = _context3.sent;
|
|
2610
|
+
if (!(data && data.data !== undefined)) {
|
|
2611
|
+
_context3.next = 15;
|
|
2612
|
+
break;
|
|
2613
|
+
}
|
|
2614
|
+
return _context3.abrupt("return", data);
|
|
2615
|
+
case 15:
|
|
2616
|
+
if (!data) {
|
|
2617
|
+
_context3.next = 17;
|
|
2540
2618
|
break;
|
|
2541
2619
|
}
|
|
2542
2620
|
return _context3.abrupt("return", {
|
|
2543
|
-
data:
|
|
2544
|
-
total:
|
|
2621
|
+
data: Array.isArray(data) ? data : [],
|
|
2622
|
+
total: Array.isArray(data) ? data.length : 0
|
|
2545
2623
|
});
|
|
2546
|
-
case
|
|
2547
|
-
throw new Error('Unexpected
|
|
2548
|
-
case
|
|
2624
|
+
case 17:
|
|
2625
|
+
throw new Error('Unexpected response format');
|
|
2626
|
+
case 20:
|
|
2627
|
+
_context3.prev = 20;
|
|
2628
|
+
_context3.t0 = _context3["catch"](0);
|
|
2629
|
+
if (!(_context3.t0.name === 'AbortError')) {
|
|
2630
|
+
_context3.next = 24;
|
|
2631
|
+
break;
|
|
2632
|
+
}
|
|
2633
|
+
return _context3.abrupt("return", {
|
|
2634
|
+
data: [],
|
|
2635
|
+
total: 0
|
|
2636
|
+
});
|
|
2637
|
+
case 24:
|
|
2638
|
+
throw _context3.t0;
|
|
2639
|
+
case 25:
|
|
2549
2640
|
case "end":
|
|
2550
2641
|
return _context3.stop();
|
|
2551
2642
|
}
|
|
2552
|
-
}, _callee2);
|
|
2643
|
+
}, _callee2, null, [[0, 20]]);
|
|
2553
2644
|
}));
|
|
2554
2645
|
return _fetchData.apply(this, arguments);
|
|
2555
2646
|
}
|
|
@@ -2710,8 +2801,8 @@ function getLeafColumns(columns) {
|
|
|
2710
2801
|
return cl;
|
|
2711
2802
|
}
|
|
2712
2803
|
|
|
2713
|
-
function ownKeys$
|
|
2714
|
-
function _objectSpread$
|
|
2804
|
+
function ownKeys$4(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; }
|
|
2805
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2715
2806
|
var LOG = getLogger('Framework', 'Grid');
|
|
2716
2807
|
function useApiInterface(_ref) {
|
|
2717
2808
|
var apiInterface = _ref.apiInterface,
|
|
@@ -2721,6 +2812,7 @@ function useApiInterface(_ref) {
|
|
|
2721
2812
|
onEdit = _ref.onEdit,
|
|
2722
2813
|
onDelete = _ref.onDelete,
|
|
2723
2814
|
onUpdate = _ref.onUpdate,
|
|
2815
|
+
onLoaded = _ref.onLoaded,
|
|
2724
2816
|
forceNewData = _ref.forceNewData;
|
|
2725
2817
|
var _useReducer = useReducer(reducer, {
|
|
2726
2818
|
data: [],
|
|
@@ -2757,7 +2849,7 @@ function useApiInterface(_ref) {
|
|
|
2757
2849
|
}
|
|
2758
2850
|
return _context.abrupt("return");
|
|
2759
2851
|
case 2:
|
|
2760
|
-
newServerSideFilterState = _objectSpread$
|
|
2852
|
+
newServerSideFilterState = _objectSpread$4({}, filter);
|
|
2761
2853
|
if (filter.globalFilter != ((_state$serverSideFilt = state.serverSideFilterState) === null || _state$serverSideFilt === void 0 ? void 0 : _state$serverSideFilt.globalFilter) || !deepEqual(filter.filters, (_state$serverSideFilt2 = state.serverSideFilterState) === null || _state$serverSideFilt2 === void 0 ? void 0 : _state$serverSideFilt2.filters)) {
|
|
2762
2854
|
//if filters are updated, reset to page 0
|
|
2763
2855
|
newServerSideFilterState.skip = 0;
|
|
@@ -2783,7 +2875,7 @@ function useApiInterface(_ref) {
|
|
|
2783
2875
|
type: 'finishedLoading',
|
|
2784
2876
|
data: result
|
|
2785
2877
|
});
|
|
2786
|
-
|
|
2878
|
+
onLoaded === null || onLoaded === void 0 || onLoaded(result.data, result.total);
|
|
2787
2879
|
//if there is already data, then a new data record should not be created automatically if the result is empty (e.g. when filtering)
|
|
2788
2880
|
if (result.data.length > 0 || state.data.length > 0) {
|
|
2789
2881
|
setDataExists(true);
|
|
@@ -2799,10 +2891,10 @@ function useApiInterface(_ref) {
|
|
|
2799
2891
|
setDataExists(false);
|
|
2800
2892
|
}
|
|
2801
2893
|
onUpdate === null || onUpdate === void 0 || onUpdate(result.data, getUrlParams(apiInterface, columns, newServerSideFilterState.skip, newServerSideFilterState.limit, newServerSideFilterState.sortBy, newServerSideFilterState.filters, newServerSideFilterState.globalFilter, apiInterface.customSettings));
|
|
2802
|
-
_context.next =
|
|
2894
|
+
_context.next = 20;
|
|
2803
2895
|
break;
|
|
2804
|
-
case
|
|
2805
|
-
_context.prev =
|
|
2896
|
+
case 17:
|
|
2897
|
+
_context.prev = 17;
|
|
2806
2898
|
_context.t0 = _context["catch"](5);
|
|
2807
2899
|
if (_context.t0 !== 'Request cancelled') {
|
|
2808
2900
|
LOG.error(new DivaError(_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message, {
|
|
@@ -2814,11 +2906,11 @@ function useApiInterface(_ref) {
|
|
|
2814
2906
|
data: _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message
|
|
2815
2907
|
});
|
|
2816
2908
|
}
|
|
2817
|
-
case
|
|
2909
|
+
case 20:
|
|
2818
2910
|
case "end":
|
|
2819
2911
|
return _context.stop();
|
|
2820
2912
|
}
|
|
2821
|
-
}, _callee, null, [[5,
|
|
2913
|
+
}, _callee, null, [[5, 17]]);
|
|
2822
2914
|
}));
|
|
2823
2915
|
return function (_x, _x2) {
|
|
2824
2916
|
return _ref2.apply(this, arguments);
|
|
@@ -2843,7 +2935,13 @@ function useApiInterface(_ref) {
|
|
|
2843
2935
|
doPatch = column.handleUpdate.patch;
|
|
2844
2936
|
id = item[idAccessor];
|
|
2845
2937
|
doDelete = !column.id.split('.').reduce(function (acc, key) {
|
|
2846
|
-
if (!(acc !== null && acc !== void 0 && acc[key])) return undefined;
|
|
2938
|
+
if (!(acc !== null && acc !== void 0 && acc[key])) return undefined;else if (column.dataType == 'organizationIdArray') {
|
|
2939
|
+
if (Array.isArray(acc[key])) {
|
|
2940
|
+
return acc[key].includes(organization._id);
|
|
2941
|
+
} else if (_typeof(acc[key]) == 'object' && 'organizations' in acc[key]) {
|
|
2942
|
+
return acc[key].organizations.includes(organization._id);
|
|
2943
|
+
}
|
|
2944
|
+
}
|
|
2847
2945
|
return acc[key];
|
|
2848
2946
|
}, item);
|
|
2849
2947
|
if (endPoint.startsWith('/')) {
|
|
@@ -2859,7 +2957,7 @@ function useApiInterface(_ref) {
|
|
|
2859
2957
|
}
|
|
2860
2958
|
if (addValueToQuery) url.searchParams.append(column.id, item[column.id]);
|
|
2861
2959
|
_context2.next = 17;
|
|
2862
|
-
return fetch(url.toString(), _objectSpread$
|
|
2960
|
+
return fetch(url.toString(), _objectSpread$4(_objectSpread$4({
|
|
2863
2961
|
method: endPointMethod ? endPointMethod : doPatch ? 'PATCH' : doDelete ? 'DELETE' : 'POST',
|
|
2864
2962
|
headers: {
|
|
2865
2963
|
Authorization: 'Bearer ' + jwt,
|
|
@@ -3033,38 +3131,38 @@ function reducer(state, action) {
|
|
|
3033
3131
|
var newState = state;
|
|
3034
3132
|
switch (action.type) {
|
|
3035
3133
|
case 'startLoading':
|
|
3036
|
-
newState = _objectSpread$
|
|
3134
|
+
newState = _objectSpread$4({}, state);
|
|
3037
3135
|
newState.loading = true;
|
|
3038
3136
|
newState.error = undefined;
|
|
3039
3137
|
newState.serverSideFilterState = (_action$data = action.data) !== null && _action$data !== void 0 ? _action$data : newState.serverSideFilterState;
|
|
3040
3138
|
break;
|
|
3041
3139
|
case 'loadingFailed':
|
|
3042
|
-
newState = _objectSpread$
|
|
3140
|
+
newState = _objectSpread$4({}, state);
|
|
3043
3141
|
newState.loading = false;
|
|
3044
3142
|
newState.error = action.data;
|
|
3045
3143
|
break;
|
|
3046
3144
|
case 'finishedLoading':
|
|
3047
|
-
newState = _objectSpread$
|
|
3145
|
+
newState = _objectSpread$4({}, state);
|
|
3048
3146
|
newState.loading = false;
|
|
3049
3147
|
newState.data = action.data.data;
|
|
3050
3148
|
newState.custom = action.data.custom;
|
|
3051
3149
|
newState.total = action.data.total;
|
|
3052
3150
|
break;
|
|
3053
3151
|
case 'updateData':
|
|
3054
|
-
newState = _objectSpread$
|
|
3152
|
+
newState = _objectSpread$4(_objectSpread$4({}, state), {}, {
|
|
3055
3153
|
data: _toConsumableArray(state.data)
|
|
3056
3154
|
});
|
|
3057
3155
|
newState.data[action.data.index] = action.data.item;
|
|
3058
3156
|
break;
|
|
3059
3157
|
case 'addData':
|
|
3060
|
-
newState = _objectSpread$
|
|
3158
|
+
newState = _objectSpread$4(_objectSpread$4({}, state), {}, {
|
|
3061
3159
|
data: _toConsumableArray(state.data)
|
|
3062
3160
|
});
|
|
3063
3161
|
newState.data.unshift(action.data);
|
|
3064
3162
|
newState.total = state.total + 1;
|
|
3065
3163
|
break;
|
|
3066
3164
|
case 'removeData':
|
|
3067
|
-
newState = _objectSpread$
|
|
3165
|
+
newState = _objectSpread$4(_objectSpread$4({}, state), {}, {
|
|
3068
3166
|
data: _toConsumableArray(state.data)
|
|
3069
3167
|
});
|
|
3070
3168
|
newState.data.splice(action.data, 1);
|
|
@@ -3170,8 +3268,8 @@ function addColumns(allColumns, _ref) {
|
|
|
3170
3268
|
return [editColumn].concat(_toConsumableArray(allColumns));
|
|
3171
3269
|
}
|
|
3172
3270
|
|
|
3173
|
-
function ownKeys$
|
|
3174
|
-
function _objectSpread$
|
|
3271
|
+
function ownKeys$3(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; }
|
|
3272
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3175
3273
|
function useHightlight (hooks) {
|
|
3176
3274
|
hooks.getCellProps.push(getCellProps);
|
|
3177
3275
|
}
|
|
@@ -3179,13 +3277,90 @@ function getCellProps(props, meta) {
|
|
|
3179
3277
|
var _hightlight$match, _hightlight$match2, _hightlight$match3;
|
|
3180
3278
|
var hightlight = meta.instance.hightlight;
|
|
3181
3279
|
if (_typeof(hightlight) == 'object' && hightlight !== null && hightlight !== void 0 && (_hightlight$match = hightlight.match) !== null && _hightlight$match !== void 0 && _hightlight$match.accessor && (hightlight !== null && hightlight !== void 0 && (_hightlight$match2 = hightlight.match) !== null && _hightlight$match2 !== void 0 && _hightlight$match2.value && meta.cell.row.original[hightlight.match.accessor] == hightlight.match.value || hightlight !== null && hightlight !== void 0 && (_hightlight$match3 = hightlight.match) !== null && _hightlight$match3 !== void 0 && _hightlight$match3.values && hightlight.match.values.includes(meta.cell.row.original[hightlight.match.accessor]))) {
|
|
3182
|
-
props.style = _objectSpread$
|
|
3280
|
+
props.style = _objectSpread$3(_objectSpread$3({}, props.style), hightlight.style);
|
|
3183
3281
|
} else if (typeof hightlight == 'function') {
|
|
3184
|
-
props.style = _objectSpread$
|
|
3282
|
+
props.style = _objectSpread$3(_objectSpread$3({}, props.style), hightlight(meta.cell));
|
|
3185
3283
|
}
|
|
3186
3284
|
return props;
|
|
3187
3285
|
}
|
|
3188
3286
|
|
|
3287
|
+
var beginActionsCell = "begin-actions-cell-27DB3";
|
|
3288
|
+
var amountSpace = "amount-space-3FwU9";
|
|
3289
|
+
var css_248z = ".begin-actions-cell-27DB3 {\n display: flex;\n gap: 10px;\n}\n\n.amount-space-3FwU9 {\n padding: 0px 9px;\n}\n";
|
|
3290
|
+
styleInject(css_248z);
|
|
3291
|
+
|
|
3292
|
+
function ownKeys$2(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; }
|
|
3293
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3294
|
+
function BeginActionsHeader(_ref) {
|
|
3295
|
+
var getToggleAllPageRowsSelectedProps = _ref.getToggleAllPageRowsSelectedProps,
|
|
3296
|
+
selectedRootRows = _ref.selectedRootRows,
|
|
3297
|
+
selection = _ref.selection;
|
|
3298
|
+
_ref.expander;
|
|
3299
|
+
if (!selection) {
|
|
3300
|
+
return /*#__PURE__*/jsx(Fragment, {});
|
|
3301
|
+
}
|
|
3302
|
+
return /*#__PURE__*/jsxs("div", {
|
|
3303
|
+
children: [/*#__PURE__*/jsx(Checkbox, _objectSpread$2(_objectSpread$2({}, getToggleAllPageRowsSelectedProps()), {}, {
|
|
3304
|
+
className: amountSpace
|
|
3305
|
+
})), selectedRootRows.length > 0 ? "(".concat(selectedRootRows.length, ")") : ' ']
|
|
3306
|
+
});
|
|
3307
|
+
}
|
|
3308
|
+
|
|
3309
|
+
function ownKeys$1(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; }
|
|
3310
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3311
|
+
function BeginActionsCell(_ref) {
|
|
3312
|
+
var row = _ref.row,
|
|
3313
|
+
selection = _ref.selection,
|
|
3314
|
+
expander = _ref.expander;
|
|
3315
|
+
return /*#__PURE__*/jsxs("div", {
|
|
3316
|
+
className: beginActionsCell,
|
|
3317
|
+
onClick: function onClick(e) {
|
|
3318
|
+
return e.stopPropagation();
|
|
3319
|
+
},
|
|
3320
|
+
children: [selection && row.depth == 0 && /*#__PURE__*/jsx(Checkbox, _objectSpread$1({}, row.getToggleRowSelectedProps())), expander && row.canExpand && /*#__PURE__*/jsx(IconButton, _objectSpread$1(_objectSpread$1({
|
|
3321
|
+
"aria-label": "expand row",
|
|
3322
|
+
size: "small"
|
|
3323
|
+
}, row.getToggleRowExpandedProps()), {}, {
|
|
3324
|
+
children: row.isExpanded ? /*#__PURE__*/jsx(KeyboardArrowUpIcon, {}) : /*#__PURE__*/jsx(KeyboardArrowDownIcon, {})
|
|
3325
|
+
}))]
|
|
3326
|
+
});
|
|
3327
|
+
}
|
|
3328
|
+
|
|
3329
|
+
var useSelection = function useSelection(hooks) {
|
|
3330
|
+
useRowSelect(hooks);
|
|
3331
|
+
//extend the default rowSelect plugin
|
|
3332
|
+
|
|
3333
|
+
hooks.useInstance.push(function (instance) {
|
|
3334
|
+
var selectedRootRows = useMemo(function () {
|
|
3335
|
+
return instance.selectedFlatRows.filter(function (row) {
|
|
3336
|
+
return row.depth == 0;
|
|
3337
|
+
});
|
|
3338
|
+
}, [instance.selectedFlatRows]);
|
|
3339
|
+
Object.assign(instance, {
|
|
3340
|
+
selectedRootRows: selectedRootRows
|
|
3341
|
+
});
|
|
3342
|
+
});
|
|
3343
|
+
};
|
|
3344
|
+
useSelection.pluginName = useRowSelect.pluginName;
|
|
3345
|
+
|
|
3346
|
+
var nodataicon = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20version%3D%221.1%22%20width%3D%2272%22%20height%3D%2272%22%20viewBox%3D%220%200%20256%20256%22%20xml%3Aspace%3D%22preserve%22%3E%3Cdesc%3ECreated%20with%20Fabric.js%201.7.22%3C%2Fdesc%3E%3Cdefs%3E%3C%2Fdefs%3E%3Cg%20transform%3D%22translate%28128%20128%29%20scale%280.72%200.72%29%22%20style%3D%22%22%3E%20%3Cg%20style%3D%22stroke%3A%20none%3B%20stroke-width%3A%200%3B%20stroke-dasharray%3A%20none%3B%20stroke-linecap%3A%20butt%3B%20stroke-linejoin%3A%20miter%3B%20stroke-miterlimit%3A%2010%3B%20fill%3A%20none%3B%20fill-rule%3A%20nonzero%3B%20opacity%3A%201%3B%22%20transform%3D%22translate%28-175.05%20-175.05000000000004%29%20scale%283.89%203.89%29%22%20%3E%20%3Cpath%20d%3D%22M%2045%2081.889%20c%20-11.691%200%20-21.202%20-9.511%20-21.202%20-21.201%20S%2033.309%2039.485%2045%2039.485%20c%2011.69%200%2021.202%209.512%2021.202%2021.202%20S%2056.69%2081.889%2045%2081.889%20z%20M%2045%2041.485%20c%20-10.588%200%20-19.202%208.614%20-19.202%2019.202%20S%2034.412%2079.889%2045%2079.889%20s%2019.202%20-8.613%2019.202%20-19.201%20S%2055.588%2041.485%2045%2041.485%20z%22%20style%3D%22stroke%3A%20none%3B%20stroke-width%3A%201%3B%20stroke-dasharray%3A%20none%3B%20stroke-linecap%3A%20butt%3B%20stroke-linejoin%3A%20miter%3B%20stroke-miterlimit%3A%2010%3B%20fill%3A%20rgb%28179%2C179%2C179%29%3B%20fill-rule%3A%20nonzero%3B%20opacity%3A%201%3B%22%20transform%3D%22%20matrix%281%200%200%201%200%200%29%20%22%20stroke-linecap%3D%22round%22%20%2F%3E%20%3Cpath%20d%3D%22M%2071.227%2068.699%20H%2063.95%20c%20-0.553%200%20-1%20-0.447%20-1%20-1%20s%200.447%20-1%201%20-1%20h%207.276%20C%2080.476%2066.699%2088%2059.175%2088%2049.926%20s%20-7.524%20-16.774%20-16.773%20-16.774%20h%20-0.339%20c%20-0.508%200%20-0.935%20-0.38%20-0.993%20-0.885%20C%2068.433%2019.636%2057.73%2010.111%2045%2010.111%20s%20-23.433%209.525%20-24.895%2022.156%20c%20-0.058%200.505%20-0.485%200.885%20-0.993%200.885%20h%20-0.338%20C%209.525%2033.152%202%2040.677%202%2049.926%20s%207.525%2016.773%2016.774%2016.773%20h%207.276%20c%200.552%200%201%200.447%201%201%20s%20-0.448%201%20-1%201%20h%20-7.276%20C%208.422%2068.699%200%2060.277%200%2049.926%20c%200%20-10.172%208.131%20-18.48%2018.235%20-18.766%20C%2020.196%2017.958%2031.55%208.111%2045%208.111%20s%2024.804%209.847%2026.766%2023.049%20C%2081.869%2031.445%2090%2039.754%2090%2049.926%20C%2090%2060.277%2081.578%2068.699%2071.227%2068.699%20z%22%20style%3D%22stroke%3A%20none%3B%20stroke-width%3A%201%3B%20stroke-dasharray%3A%20none%3B%20stroke-linecap%3A%20butt%3B%20stroke-linejoin%3A%20miter%3B%20stroke-miterlimit%3A%2010%3B%20fill%3A%20rgb%28179%2C179%2C179%29%3B%20fill-rule%3A%20nonzero%3B%20opacity%3A%201%3B%22%20transform%3D%22%20matrix%281%200%200%201%200%200%29%20%22%20stroke-linecap%3D%22round%22%20%2F%3E%20%3Cpath%20d%3D%22M%2030.737%2075.993%20c%20-0.256%200%20-0.512%20-0.098%20-0.707%20-0.293%20c%20-0.391%20-0.391%20-0.391%20-1.023%200%20-1.414%20l%2028.569%20-28.569%20c%200.391%20-0.391%201.023%20-0.391%201.414%200%20s%200.391%201.023%200%201.414%20L%2031.444%2075.7%20C%2031.249%2075.896%2030.993%2075.993%2030.737%2075.993%20z%22%20style%3D%22stroke%3A%20none%3B%20stroke-width%3A%201%3B%20stroke-dasharray%3A%20none%3B%20stroke-linecap%3A%20butt%3B%20stroke-linejoin%3A%20miter%3B%20stroke-miterlimit%3A%2010%3B%20fill%3A%20rgb%28179%2C179%2C179%29%3B%20fill-rule%3A%20nonzero%3B%20opacity%3A%201%3B%22%20transform%3D%22%20matrix%281%200%200%201%200%200%29%20%22%20stroke-linecap%3D%22round%22%20%2F%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E";
|
|
3347
|
+
|
|
3348
|
+
function NoData(_ref) {
|
|
3349
|
+
var hasToolbar = _ref.hasToolbar;
|
|
3350
|
+
return /*#__PURE__*/jsxs("div", {
|
|
3351
|
+
className: classnames(noData, _defineProperty({}, withToolbar, hasToolbar)),
|
|
3352
|
+
children: [/*#__PURE__*/jsx("img", {
|
|
3353
|
+
src: nodataicon
|
|
3354
|
+
}), /*#__PURE__*/jsx("p", {
|
|
3355
|
+
id: "noDataFound",
|
|
3356
|
+
style: {
|
|
3357
|
+
color: '#b3b3b3'
|
|
3358
|
+
},
|
|
3359
|
+
children: "No Data"
|
|
3360
|
+
})]
|
|
3361
|
+
});
|
|
3362
|
+
}
|
|
3363
|
+
|
|
3189
3364
|
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; }
|
|
3190
3365
|
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; }
|
|
3191
3366
|
function Grid(_ref) {
|
|
@@ -3203,6 +3378,7 @@ function Grid(_ref) {
|
|
|
3203
3378
|
onDelete = _ref.onDelete,
|
|
3204
3379
|
onUpdate = _ref.onUpdate,
|
|
3205
3380
|
onNew = _ref.onNew,
|
|
3381
|
+
onLoaded = _ref.onLoaded,
|
|
3206
3382
|
prepareRowHook = _ref.prepareRow,
|
|
3207
3383
|
customElement = _ref.customElement,
|
|
3208
3384
|
noData = _ref.noData,
|
|
@@ -3239,6 +3415,7 @@ function Grid(_ref) {
|
|
|
3239
3415
|
onEdit: onEdit,
|
|
3240
3416
|
onNew: onNew,
|
|
3241
3417
|
onUpdate: onUpdate,
|
|
3418
|
+
onLoaded: onLoaded,
|
|
3242
3419
|
forceNewData: forceNewData
|
|
3243
3420
|
}),
|
|
3244
3421
|
data = _useApiInterface.data,
|
|
@@ -3298,12 +3475,24 @@ function Grid(_ref) {
|
|
|
3298
3475
|
editingActions: parsedOptions.editable == 'inline' ? false : parsedOptions.editable,
|
|
3299
3476
|
inlineEditing: parsedOptions.editable == 'inline',
|
|
3300
3477
|
hightlight: parsedOptions.hightlight,
|
|
3478
|
+
getSubRows: useCallback(function (row) {
|
|
3479
|
+
var _row$subRows;
|
|
3480
|
+
//row should be of type D but the useRowSelect plugin has a bug and calls it with Row<D>
|
|
3481
|
+
if (((_row$subRows = row.subRows) === null || _row$subRows === void 0 ? void 0 : _row$subRows.length) > 0) {
|
|
3482
|
+
return row.subRows;
|
|
3483
|
+
}
|
|
3484
|
+
if (table !== null && table !== void 0 && table.nestedRows) {
|
|
3485
|
+
var _table$nestedRows;
|
|
3486
|
+
return (_table$nestedRows = row[table.nestedRows]) !== null && _table$nestedRows !== void 0 ? _table$nestedRows : [];
|
|
3487
|
+
}
|
|
3488
|
+
return [];
|
|
3489
|
+
}, [table === null || table === void 0 ? void 0 : table.nestedRows]),
|
|
3301
3490
|
updateData: updateData,
|
|
3302
3491
|
onNew: onInternalNew,
|
|
3303
3492
|
onEdit: onInternalEdit,
|
|
3304
3493
|
onDelete: onInternalDelete,
|
|
3305
3494
|
custom: custom
|
|
3306
|
-
}, useFilters, useGlobalFilter, useGroupBy, useSortBy, useExpanded, usePagination,
|
|
3495
|
+
}, useFilters, useGlobalFilter, useGroupBy, useSortBy, useExpanded, usePagination, useSelection, useEditActions, useHightlight, function (hooks) {
|
|
3307
3496
|
hooks.getCellProps.push(function (props, meta) {
|
|
3308
3497
|
if ((table === null || table === void 0 ? void 0 : table.rowHight) != undefined) {
|
|
3309
3498
|
props.style = _objectSpread(_objectSpread({}, props.style), {}, {
|
|
@@ -3332,67 +3521,25 @@ function Grid(_ref) {
|
|
|
3332
3521
|
}
|
|
3333
3522
|
});
|
|
3334
3523
|
}
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
// to render a checkbox
|
|
3340
|
-
Header: function Header(_ref2) {
|
|
3341
|
-
var getToggleAllPageRowsSelectedProps = _ref2.getToggleAllPageRowsSelectedProps,
|
|
3342
|
-
selectedFlatRows = _ref2.selectedFlatRows;
|
|
3343
|
-
return /*#__PURE__*/jsxs("div", {
|
|
3344
|
-
style: {
|
|
3345
|
-
width: '70px'
|
|
3346
|
-
},
|
|
3347
|
-
children: [/*#__PURE__*/jsx(Checkbox, _objectSpread(_objectSpread({}, getToggleAllPageRowsSelectedProps()), {}, {
|
|
3348
|
-
style: {
|
|
3349
|
-
padding: '0px 9px'
|
|
3350
|
-
}
|
|
3351
|
-
})), selectedFlatRows.length > 0 ? "(".concat(selectedFlatRows.length, ")") : ' ']
|
|
3352
|
-
});
|
|
3353
|
-
},
|
|
3354
|
-
// The cell can use the individual row's getToggleRowSelectedProps method
|
|
3355
|
-
// to the render a checkbox
|
|
3356
|
-
Cell: function Cell(_ref3) {
|
|
3357
|
-
var row = _ref3.row;
|
|
3358
|
-
return /*#__PURE__*/jsx("div", {
|
|
3359
|
-
style: {
|
|
3360
|
-
display: 'inline-block'
|
|
3361
|
-
},
|
|
3362
|
-
onClick: function onClick(e) {
|
|
3363
|
-
return e.stopPropagation();
|
|
3364
|
-
},
|
|
3365
|
-
children: /*#__PURE__*/jsx(Checkbox, _objectSpread({}, row.getToggleRowSelectedProps()))
|
|
3366
|
-
});
|
|
3367
|
-
},
|
|
3368
|
-
width: 50
|
|
3369
|
-
});
|
|
3370
|
-
}
|
|
3371
|
-
if (parsedOptions.subcomponent) {
|
|
3524
|
+
var showSelection = parsedOptions.selectable == true || parsedOptions.selectable == 'multi';
|
|
3525
|
+
var showExpander = !!parsedOptions.subcomponent || !!(table !== null && table !== void 0 && table.nestedRows);
|
|
3526
|
+
var beginActions = showSelection || showExpander;
|
|
3527
|
+
if (beginActions) {
|
|
3372
3528
|
customColumnsBeginning.push({
|
|
3373
|
-
id: '
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
style: {
|
|
3381
|
-
display: 'inline-block'
|
|
3382
|
-
},
|
|
3383
|
-
onClick: function onClick(e) {
|
|
3384
|
-
return e.stopPropagation();
|
|
3385
|
-
},
|
|
3386
|
-
children: /*#__PURE__*/jsx(IconButton, _objectSpread(_objectSpread({
|
|
3387
|
-
"aria-label": "expand row",
|
|
3388
|
-
size: "small"
|
|
3389
|
-
}, row.getToggleRowExpandedProps()), {}, {
|
|
3390
|
-
children: row.isExpanded ? /*#__PURE__*/jsx(KeyboardArrowUpIcon, {}) : /*#__PURE__*/jsx(KeyboardArrowDownIcon, {})
|
|
3391
|
-
}))
|
|
3392
|
-
});
|
|
3529
|
+
id: 'beginActions',
|
|
3530
|
+
width: 50,
|
|
3531
|
+
Header: function Header(props) {
|
|
3532
|
+
return /*#__PURE__*/jsx(BeginActionsHeader, _objectSpread(_objectSpread({}, props), {}, {
|
|
3533
|
+
selection: showSelection,
|
|
3534
|
+
expander: showExpander
|
|
3535
|
+
}));
|
|
3393
3536
|
},
|
|
3394
|
-
|
|
3395
|
-
|
|
3537
|
+
Cell: function Cell(props) {
|
|
3538
|
+
return /*#__PURE__*/jsx(BeginActionsCell, _objectSpread(_objectSpread({}, props), {}, {
|
|
3539
|
+
selection: showSelection,
|
|
3540
|
+
expander: showExpander
|
|
3541
|
+
}));
|
|
3542
|
+
}
|
|
3396
3543
|
});
|
|
3397
3544
|
}
|
|
3398
3545
|
return [].concat(customColumnsBeginning, _toConsumableArray(columns), customColumnsEnd);
|
|
@@ -3415,6 +3562,7 @@ function Grid(_ref) {
|
|
|
3415
3562
|
toggleRowSelected = _useTable.toggleRowSelected,
|
|
3416
3563
|
toggleAllRowsSelected = _useTable.toggleAllRowsSelected,
|
|
3417
3564
|
selectedFlatRows = _useTable.selectedFlatRows,
|
|
3565
|
+
selectedRootRows = _useTable.selectedRootRows,
|
|
3418
3566
|
flatRows = _useTable.flatRows,
|
|
3419
3567
|
_useTable$state = _useTable.state,
|
|
3420
3568
|
pageIndex = _useTable$state.pageIndex,
|
|
@@ -3446,13 +3594,13 @@ function Grid(_ref) {
|
|
|
3446
3594
|
}, [selected, options.selectable]);
|
|
3447
3595
|
useEffect(function () {
|
|
3448
3596
|
if (options.selectable) {
|
|
3449
|
-
onSelect(
|
|
3597
|
+
onSelect(selectedRootRows.filter(function (r) {
|
|
3450
3598
|
return !r.isGrouped;
|
|
3451
3599
|
}).map(function (r) {
|
|
3452
3600
|
return r.original;
|
|
3453
3601
|
}));
|
|
3454
3602
|
}
|
|
3455
|
-
}, [
|
|
3603
|
+
}, [selectedRootRows, options.selectable]);
|
|
3456
3604
|
useEffect(function () {
|
|
3457
3605
|
if (options.apiInterface.filterServerSide && pageIndex > total / pageSize) {
|
|
3458
3606
|
gotoPage(0);
|
|
@@ -3461,22 +3609,26 @@ function Grid(_ref) {
|
|
|
3461
3609
|
|
|
3462
3610
|
/**
|
|
3463
3611
|
* On selection of a row select/unselect rows according to the configuration
|
|
3464
|
-
* and fire the onSelect event, containing all currently selected rows
|
|
3465
3612
|
*/
|
|
3466
3613
|
var selectRow = useCallback(function (rowPath) {
|
|
3467
3614
|
var row = flatRows.find(function (r) {
|
|
3468
3615
|
return r.id == rowPath;
|
|
3469
3616
|
});
|
|
3470
|
-
|
|
3617
|
+
|
|
3618
|
+
//if the row is grouped or can be expanded, toggle the expansion instead of selection
|
|
3619
|
+
if (row !== null && row !== void 0 && row.isGrouped || row !== null && row !== void 0 && row.canExpand) {
|
|
3471
3620
|
row.toggleRowExpanded();
|
|
3621
|
+
return;
|
|
3472
3622
|
}
|
|
3623
|
+
|
|
3624
|
+
//if the row is not a root row, do nothing
|
|
3625
|
+
if (row !== null && row !== void 0 && row.depth && row.depth > 0) return;
|
|
3473
3626
|
if (options.selectable == 'single') {
|
|
3474
3627
|
//if selectable is single, unselect all currently selected rows
|
|
3475
3628
|
//and also remove them from the selected list, since the state is not yet up to date
|
|
3476
3629
|
toggleAllRowsSelected(false);
|
|
3477
3630
|
}
|
|
3478
3631
|
if (options.selectable && !(row !== null && row !== void 0 && row.isGrouped)) {
|
|
3479
|
-
//onSelect(selected.filter((s) => !s.isGrouped).map((s) => s.original));
|
|
3480
3632
|
toggleRowSelected(rowPath);
|
|
3481
3633
|
}
|
|
3482
3634
|
}, [toggleAllRowsSelected, toggleRowSelected, options.selectable, flatRows]);
|
|
@@ -3517,6 +3669,7 @@ function Grid(_ref) {
|
|
|
3517
3669
|
return c.disableGlobalFilter == false;
|
|
3518
3670
|
});
|
|
3519
3671
|
}, [parsedOptions.columns]);
|
|
3672
|
+
var noToolbar = !customElement && filters.length == 0 && !(toolbarActions !== null && toolbarActions !== void 0 && toolbarActions.length) && views.length <= 1 && !globalFilter;
|
|
3520
3673
|
return /*#__PURE__*/jsxs("div", {
|
|
3521
3674
|
className: classes.wrapper,
|
|
3522
3675
|
children: [/*#__PURE__*/jsx(Toolbar, {
|
|
@@ -3551,7 +3704,9 @@ function Grid(_ref) {
|
|
|
3551
3704
|
}), error && /*#__PURE__*/jsx(Alert, {
|
|
3552
3705
|
severity: "error",
|
|
3553
3706
|
children: "".concat(t('grid.error'), " (").concat(error, ")") + ' --- ' + DivaUtils.formatDate(new Date(), true, undefined, true) + (DivaUtils.getCurrentTraceId() ? ' --- ' + t('modal.errorcode') + ': ' + DivaUtils.getCurrentTraceId() : '')
|
|
3554
|
-
}), view === 'Gallery' && /*#__PURE__*/jsx(Gallery, _objectSpread({}, galleryProps)), view == 'Table' && /*#__PURE__*/jsx(MemoizedTable, _objectSpread({}, tableProps)),
|
|
3707
|
+
}), view === 'Gallery' && /*#__PURE__*/jsx(Gallery, _objectSpread({}, galleryProps)), view == 'Table' && /*#__PURE__*/jsx(MemoizedTable, _objectSpread({}, tableProps)), !isLoading && rows.length < 1 && (noData ? noData : /*#__PURE__*/jsx(NoData, {
|
|
3708
|
+
hasToolbar: !noToolbar
|
|
3709
|
+
})), parsedOptions.pagination && !parsedOptions.pagination.hide && /*#__PURE__*/jsx(TablePagination, {
|
|
3555
3710
|
ref: ref,
|
|
3556
3711
|
style: {
|
|
3557
3712
|
minHeight: 52
|
|
@@ -3586,7 +3741,8 @@ var useStyles = makeStyles(function () {
|
|
|
3586
3741
|
display: 'flex',
|
|
3587
3742
|
flexDirection: 'column',
|
|
3588
3743
|
overflow: 'auto',
|
|
3589
|
-
height: '100%'
|
|
3744
|
+
height: '100%',
|
|
3745
|
+
position: 'relative'
|
|
3590
3746
|
},
|
|
3591
3747
|
shortPaging: {
|
|
3592
3748
|
'& .MuiTablePagination-selectRoot': {
|
|
@@ -3599,4 +3755,4 @@ var useStyles = makeStyles(function () {
|
|
|
3599
3755
|
});
|
|
3600
3756
|
});
|
|
3601
3757
|
|
|
3602
|
-
export { Grid as default };
|
|
3758
|
+
export { Loading, cellStyleHelper, Grid as default };
|