ecomlab-components-next 0.1.102 → 0.1.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AuthorAvatar/AuthorAvatar.js +36 -0
- package/dist/components/AuthorAvatar/AuthorAvatar.scss +53 -0
- package/dist/components/Table/Paginator/Paginator.scss +1 -1
- package/dist/components/Table/Table/Table.js +1433 -1007
- package/dist/components/Table/Table/Table.scss +1230 -1300
- package/dist/components/Table/TableBox/TableBox.stories.js +4 -229
- package/package.json +1 -1
|
@@ -23,6 +23,8 @@ var _TableWithoutData = require("../TableWithoutData/TableWithoutData");
|
|
|
23
23
|
var _Checkbox = _interopRequireDefault(require("../../Checkbox/Checkbox/Checkbox"));
|
|
24
24
|
var _TableInput = _interopRequireDefault(require("../TableInput/TableInput"));
|
|
25
25
|
var _CheckboxToggle = _interopRequireDefault(require("../CheckboxToggle/CheckboxToggle"));
|
|
26
|
+
var _SliderCarousel = _interopRequireDefault(require("../../Slider/SliderCarousel/SliderCarousel"));
|
|
27
|
+
var _AuthorAvatar = require("../../AuthorAvatar/AuthorAvatar");
|
|
26
28
|
require("./Table.scss");
|
|
27
29
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
28
30
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -50,8 +52,8 @@ var SORT_DIRECTIONS = {
|
|
|
50
52
|
descending: 'DESC'
|
|
51
53
|
};
|
|
52
54
|
var DEFAULT_COL_WIDTH_PX = '150px';
|
|
53
|
-
var
|
|
54
|
-
var _headers$tooltips, _headers$tooltips2
|
|
55
|
+
var Table = function Table(_ref) {
|
|
56
|
+
var _headers$tooltips, _headers$tooltips2;
|
|
55
57
|
var noDataText = _ref.noDataText,
|
|
56
58
|
loading = _ref.loading,
|
|
57
59
|
_ref$fetchedData = _ref.fetchedData,
|
|
@@ -60,12 +62,12 @@ var _Table = function Table(_ref) {
|
|
|
60
62
|
selectedHeaders = _ref.selectedHeaders,
|
|
61
63
|
onCheck = _ref.onCheck,
|
|
62
64
|
onInputHandler = _ref.onInputHandler,
|
|
65
|
+
_ref$onInputAction = _ref.onInputAction,
|
|
66
|
+
onInputAction = _ref$onInputAction === void 0 ? false : _ref$onInputAction,
|
|
63
67
|
_ref$setCheckedStateE = _ref.setCheckedStateEmpty,
|
|
64
68
|
setCheckedStateEmpty = _ref$setCheckedStateE === void 0 ? false : _ref$setCheckedStateE,
|
|
65
69
|
_ref$setState = _ref.setState,
|
|
66
70
|
setState = _ref$setState === void 0 ? false : _ref$setState,
|
|
67
|
-
_ref$isSortable = _ref.isSortable,
|
|
68
|
-
isSortable = _ref$isSortable === void 0 ? true : _ref$isSortable,
|
|
69
71
|
_ref$onBooleanCheckbo = _ref.onBooleanCheckbox,
|
|
70
72
|
onBooleanCheckbox = _ref$onBooleanCheckbo === void 0 ? false : _ref$onBooleanCheckbo,
|
|
71
73
|
_ref$onAction = _ref.onAction,
|
|
@@ -106,20 +108,27 @@ var _Table = function Table(_ref) {
|
|
|
106
108
|
topHeader = _ref.topHeader,
|
|
107
109
|
page = _ref.page,
|
|
108
110
|
contextMenuArr = _ref.contextMenuArr,
|
|
109
|
-
maxHeight = _ref.maxHeight
|
|
111
|
+
maxHeight = _ref.maxHeight,
|
|
112
|
+
onUncheckAllDependence = _ref.onUncheckAllDependence,
|
|
113
|
+
tableBody = _ref.tableBody,
|
|
114
|
+
rowCount = _ref.rowCount,
|
|
115
|
+
setRowCount = _ref.setRowCount,
|
|
116
|
+
refBody = _ref.refBody,
|
|
117
|
+
refHeader = _ref.refHeader,
|
|
118
|
+
isEditing = _ref.isEditing,
|
|
119
|
+
tableIdCRM = _ref.tableIdCRM,
|
|
120
|
+
fetchHead = _ref.fetchHead;
|
|
110
121
|
////////////////////TRANSLATE////////////////////////
|
|
111
122
|
|
|
112
|
-
var _useState = (0, _react.useState)('
|
|
123
|
+
var _useState = (0, _react.useState)(localStorage.getItem('lang') || 'rus'),
|
|
113
124
|
_useState2 = _slicedToArray(_useState, 2),
|
|
114
125
|
lang = _useState2[0],
|
|
115
126
|
setLang = _useState2[1];
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
127
|
+
(0, _react.useEffect)(function () {
|
|
128
|
+
setLang(localStorage.getItem('lang'));
|
|
129
|
+
}, [localStorage.getItem('lang')]);
|
|
120
130
|
var translateNoData = function translateNoData() {
|
|
121
|
-
if (lang == 'en') return 'Select
|
|
122
|
-
if (lang == 'th') return 'เลือกพารามิเตอร์สำหรับการโหลดข้อมูลตาราง';
|
|
131
|
+
if (lang == 'en') return 'Select options to load the table';
|
|
123
132
|
return 'Выберите параметры для загрузки данных таблицы';
|
|
124
133
|
};
|
|
125
134
|
var translateTextСopied = function translateTextСopied() {
|
|
@@ -134,6 +143,18 @@ var _Table = function Table(_ref) {
|
|
|
134
143
|
if (lang == 'eng') return 'No data';
|
|
135
144
|
return 'Нет данных';
|
|
136
145
|
};
|
|
146
|
+
var translateCopyId = function translateCopyId() {
|
|
147
|
+
if (lang == 'en') return 'Copy ID';
|
|
148
|
+
return 'Скопировать артикул';
|
|
149
|
+
};
|
|
150
|
+
var translateCopiedId = function translateCopiedId() {
|
|
151
|
+
if (lang == 'en') return 'ID copied';
|
|
152
|
+
return 'Артикул скопирован';
|
|
153
|
+
};
|
|
154
|
+
var translateId = function translateId() {
|
|
155
|
+
if (lang == 'en') return 'ID:';
|
|
156
|
+
return 'Арт:';
|
|
157
|
+
};
|
|
137
158
|
var translateContext = function translateContext(label) {
|
|
138
159
|
switch (label) {
|
|
139
160
|
case 'Удалить':
|
|
@@ -149,9 +170,8 @@ var _Table = function Table(_ref) {
|
|
|
149
170
|
}
|
|
150
171
|
};
|
|
151
172
|
var translateNoParametr = function translateNoParametr() {
|
|
152
|
-
if (lang == 'en') return 'No data
|
|
153
|
-
if (lang == 'tr') return
|
|
154
|
-
if (lang == 'th') return "ไม่พบข้อมูล ลองเปลี่ยนพารามิเตอร์ดู";
|
|
173
|
+
if (lang == 'en') return 'No data found, try to reset filters ';
|
|
174
|
+
if (lang == 'tr') return 'Veri bulunmadı, filtreleri sıfırlamaya deneyin';
|
|
155
175
|
return 'По заданым параметрам не найдено данных, попробуйте поменять параметры';
|
|
156
176
|
};
|
|
157
177
|
var refTable = (0, _react.useRef)();
|
|
@@ -220,10 +240,10 @@ var _Table = function Table(_ref) {
|
|
|
220
240
|
_useState34 = _slicedToArray(_useState33, 2),
|
|
221
241
|
initialSort = _useState34[0],
|
|
222
242
|
setInitialSort = _useState34[1];
|
|
223
|
-
var _useState35 = (0, _react.useState)(
|
|
243
|
+
var _useState35 = (0, _react.useState)({}),
|
|
224
244
|
_useState36 = _slicedToArray(_useState35, 2),
|
|
225
|
-
|
|
226
|
-
|
|
245
|
+
insideBody = _useState36[0],
|
|
246
|
+
setInsideBody = _useState36[1];
|
|
227
247
|
var _useState37 = (0, _react.useState)({}),
|
|
228
248
|
_useState38 = _slicedToArray(_useState37, 2),
|
|
229
249
|
inputState = _useState38[0],
|
|
@@ -261,7 +281,6 @@ var _Table = function Table(_ref) {
|
|
|
261
281
|
_useState54 = _slicedToArray(_useState53, 2),
|
|
262
282
|
checkedAll = _useState54[0],
|
|
263
283
|
_setCheckedAll = _useState54[1];
|
|
264
|
-
var refBody = (0, _react.useRef)();
|
|
265
284
|
var refThead = (0, _react.useRef)();
|
|
266
285
|
var typeIndexArr = selectedHeaders !== null && selectedHeaders !== void 0 && selectedHeaders.type ? selectedHeaders === null || selectedHeaders === void 0 ? void 0 : selectedHeaders.type : headers === null || headers === void 0 ? void 0 : headers.type;
|
|
267
286
|
var hiddenHeaders = typeIndexArr === null || typeIndexArr === void 0 ? void 0 : typeIndexArr.map(function (el, ind) {
|
|
@@ -306,7 +325,7 @@ var _Table = function Table(_ref) {
|
|
|
306
325
|
return data === null || data === void 0 ? void 0 : data.reduce(function (result, current) {
|
|
307
326
|
var valueToAdd;
|
|
308
327
|
if (Array.isArray(current)) {
|
|
309
|
-
valueToAdd = _getId(current,
|
|
328
|
+
valueToAdd = _getId(current, '');
|
|
310
329
|
} else {
|
|
311
330
|
valueToAdd = _typeof(current) === 'object' ? '' : current === null || current === void 0 ? void 0 : current.toString();
|
|
312
331
|
}
|
|
@@ -319,8 +338,9 @@ var _Table = function Table(_ref) {
|
|
|
319
338
|
|
|
320
339
|
// Table row object
|
|
321
340
|
var getRowObj = function getRowObj(data) {
|
|
341
|
+
var _headers$header;
|
|
322
342
|
var rowObj = {};
|
|
323
|
-
headers === null || headers === void 0 || headers.header.forEach(function (el, index) {
|
|
343
|
+
headers === null || headers === void 0 || (_headers$header = headers.header) === null || _headers$header === void 0 || _headers$header.forEach(function (el, index) {
|
|
324
344
|
if (_typeof(el) === 'object') {
|
|
325
345
|
el = headers === null || headers === void 0 ? void 0 : headers.type[index];
|
|
326
346
|
rowObj[el] = data[index];
|
|
@@ -424,8 +444,9 @@ var _Table = function Table(_ref) {
|
|
|
424
444
|
};
|
|
425
445
|
|
|
426
446
|
// Table column sort logic
|
|
427
|
-
var columnSort = function columnSort(
|
|
447
|
+
var columnSort = function columnSort(element) {
|
|
428
448
|
var sortActual;
|
|
449
|
+
var el = element.replace(/\n/g, '');
|
|
429
450
|
if (initialSorting) {
|
|
430
451
|
sortActual = [el, SORT_DIRECTIONS.descending];
|
|
431
452
|
setInitialSorting(false);
|
|
@@ -444,919 +465,1245 @@ var _Table = function Table(_ref) {
|
|
|
444
465
|
}
|
|
445
466
|
}
|
|
446
467
|
setSortParam(sortActual);
|
|
447
|
-
setSortDirection(sortActual);
|
|
468
|
+
// setSortDirection(sortActual);
|
|
448
469
|
_sortingFunc([sortActual, filtersTable]);
|
|
449
470
|
_setParams([sortActual, filtersTable]);
|
|
450
471
|
};
|
|
451
|
-
|
|
452
|
-
|
|
472
|
+
(0, _react.useEffect)(function () {
|
|
473
|
+
setSortDirection(sort);
|
|
474
|
+
}, [sort]);
|
|
453
475
|
var typesTd = function typesTd(arr, rowInd) {
|
|
454
|
-
var tdList
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
var stringArr = el === null || el === void 0 ? void 0 : el.map(function (item, itemInd) {
|
|
483
|
-
var styles;
|
|
484
|
-
if (Array.isArray(headers === null || headers === void 0 ? void 0 : headers.styles)) {
|
|
485
|
-
var _headers$styles, _headers$styles2;
|
|
486
|
-
styles = headers !== null && headers !== void 0 && (_headers$styles = headers.styles) !== null && _headers$styles !== void 0 && (_headers$styles = _headers$styles[rowInd]) !== null && _headers$styles !== void 0 && (_headers$styles = _headers$styles[ind]) !== null && _headers$styles !== void 0 && _headers$styles[itemInd] ? headers === null || headers === void 0 || (_headers$styles2 = headers.styles) === null || _headers$styles2 === void 0 || (_headers$styles2 = _headers$styles2[rowInd]) === null || _headers$styles2 === void 0 || (_headers$styles2 = _headers$styles2[ind]) === null || _headers$styles2 === void 0 ? void 0 : _headers$styles2[itemInd] : {};
|
|
487
|
-
}
|
|
488
|
-
if (Array.isArray(item)) {
|
|
489
|
-
return /*#__PURE__*/_react["default"].createElement("p", null, item.map(function (str, strInd) {
|
|
490
|
-
var strItemStyles;
|
|
491
|
-
if (styles) {
|
|
492
|
-
var _styles;
|
|
493
|
-
strItemStyles = (_styles = styles) === null || _styles === void 0 ? void 0 : _styles[strInd];
|
|
494
|
-
}
|
|
495
|
-
var checkedStyles = _typeof(strItemStyles) === 'object' && !Array.isArray(strItemStyles) ? strItemStyles : {};
|
|
496
|
-
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
497
|
-
className: 'text_grey',
|
|
498
|
-
style: checkedStyles
|
|
499
|
-
}, str);
|
|
500
|
-
}));
|
|
501
|
-
} else {
|
|
502
|
-
return /*#__PURE__*/_react["default"].createElement("p", {
|
|
503
|
-
className: 'text_grey',
|
|
504
|
-
style: Array.isArray(styles) ? styles[itemInd] : styles
|
|
505
|
-
}, item);
|
|
506
|
-
}
|
|
507
|
-
});
|
|
508
|
-
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
509
|
-
className: "type-td_string-layers ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
510
|
-
key: _getId([tableId, el, ind], 'stringLayers')
|
|
511
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
512
|
-
className: "type-td_string-layers__content"
|
|
513
|
-
}, stringArr));
|
|
476
|
+
var tdList;
|
|
477
|
+
try {
|
|
478
|
+
tdList = arr === null || arr === void 0 ? void 0 : arr.map(function (el, ind) {
|
|
479
|
+
var _ref2;
|
|
480
|
+
var currentType = typeIndexArr === null || typeIndexArr === void 0 ? void 0 : typeIndexArr[ind];
|
|
481
|
+
var currentWidth = (_ref2 = (columnSize === null || columnSize === void 0 ? void 0 : columnSize.length) > 0 ? columnSize[ind] : DEFAULT_COL_WIDTH_PX) !== null && _ref2 !== void 0 ? _ref2 : DEFAULT_COL_WIDTH_PX;
|
|
482
|
+
if ((typeIndexArr === null || typeIndexArr === void 0 ? void 0 : typeIndexArr.length) > 0) {
|
|
483
|
+
if (isEditing && currentType === 'textEditable') {
|
|
484
|
+
var _headers$header2;
|
|
485
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
486
|
+
key: _getId([tableId, el, ind], 'input')
|
|
487
|
+
}, /*#__PURE__*/_react["default"].createElement(_TableInput["default"], {
|
|
488
|
+
props: [el],
|
|
489
|
+
getId: function getId(e) {
|
|
490
|
+
return _getId(e);
|
|
491
|
+
},
|
|
492
|
+
staticTD: staticTD,
|
|
493
|
+
ind: ind,
|
|
494
|
+
tableId: tableId,
|
|
495
|
+
rowObj: getRowObj(arr),
|
|
496
|
+
state: inputState,
|
|
497
|
+
setState: function setState(e) {
|
|
498
|
+
return setInputState(e);
|
|
499
|
+
},
|
|
500
|
+
inputRowInfo: [getRowObj(arr), String(el), headers === null || headers === void 0 || (_headers$header2 = headers.header) === null || _headers$header2 === void 0 ? void 0 : _headers$header2[ind]],
|
|
501
|
+
onInputAction: onInputAction
|
|
502
|
+
}));
|
|
503
|
+
}
|
|
514
504
|
}
|
|
515
|
-
if (
|
|
516
|
-
if (
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
key: _getId([tableId, el, ind], 'toggleStatus')
|
|
523
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
524
|
-
className: "text-box"
|
|
525
|
-
}, /*#__PURE__*/_react["default"].createElement(_CheckboxToggle["default"], {
|
|
526
|
-
value: value,
|
|
527
|
-
onChange: function onChange(e) {
|
|
528
|
-
if (onToggle) {
|
|
529
|
-
onToggle(getRowObj(arr));
|
|
505
|
+
if ((typeIndexArr === null || typeIndexArr === void 0 ? void 0 : typeIndexArr.length) > 0) {
|
|
506
|
+
if (currentType === 'link') {
|
|
507
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
508
|
+
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
509
|
+
key: _getId([tableId, el, ind], 'link'),
|
|
510
|
+
onContextMenu: function onContextMenu(e) {
|
|
511
|
+
return e.stopPropagation();
|
|
530
512
|
}
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
553
|
-
className: "img-box"
|
|
554
|
-
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
555
|
-
className: "collect_info_img",
|
|
556
|
-
src: imgLink.src,
|
|
557
|
-
onError: function onError(e) {
|
|
558
|
-
return e.target.src = imageNotFound;
|
|
559
|
-
},
|
|
560
|
-
alt: "table_info_img"
|
|
561
|
-
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
562
|
-
className: "text_info_box"
|
|
563
|
-
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
564
|
-
className: "text_info_name",
|
|
565
|
-
onClick: isNameArr ? function (e) {
|
|
566
|
-
return onAction(['name', name]);
|
|
567
|
-
} : function () {},
|
|
568
|
-
style: isNameArr ? {
|
|
569
|
-
color: '#0009E8'
|
|
570
|
-
} : {}
|
|
571
|
-
}, name ? isNameArr ? name === null || name === void 0 ? void 0 : name[0] : name : '-'), /*#__PURE__*/_react["default"].createElement("p", {
|
|
572
|
-
className: "text_info_desc",
|
|
573
|
-
onClick: isDescArr ? function (e) {
|
|
574
|
-
return onAction(['desc', desc]);
|
|
575
|
-
} : function () {},
|
|
576
|
-
style: isDescArr ? {
|
|
577
|
-
color: '#0009E8'
|
|
578
|
-
} : {}
|
|
579
|
-
}, desc ? isDescArr ? desc === null || desc === void 0 ? void 0 : desc[0] : desc : '-'), /*#__PURE__*/_react["default"].createElement("p", {
|
|
580
|
-
className: "text_info_brand",
|
|
581
|
-
onClick: isBrandArr ? function (e) {
|
|
582
|
-
return onAction(['brand', brand]);
|
|
583
|
-
} : function () {},
|
|
584
|
-
style: isBrandArr ? {
|
|
585
|
-
color: '#0009E8'
|
|
586
|
-
} : {}
|
|
587
|
-
}, brand ? isBrandArr ? brand === null || brand === void 0 ? void 0 : brand[0] : brand : '-'), /*#__PURE__*/_react["default"].createElement("div", {
|
|
588
|
-
className: "text_info_sub_desc_box"
|
|
589
|
-
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
590
|
-
className: "text_info_sub_desc",
|
|
591
|
-
onClick: isOfferArr ? function (e) {
|
|
592
|
-
return onAction(['offerId', offerId]);
|
|
593
|
-
} : function () {},
|
|
594
|
-
style: isOfferArr ? {
|
|
595
|
-
color: '#0009E8'
|
|
596
|
-
} : {}
|
|
597
|
-
}, "\u0410\u0440\u0442: ", /*#__PURE__*/_react["default"].createElement("span", null, offerId ? isOfferArr ? offerId === null || offerId === void 0 ? void 0 : offerId[0] : offerId : '-')), count && /*#__PURE__*/_react["default"].createElement("p", {
|
|
598
|
-
className: "text_sum"
|
|
599
|
-
}, count, /*#__PURE__*/_react["default"].createElement("span", null, "\u0448\u0442")), /*#__PURE__*/_react["default"].createElement(_ButtonCopy.ButtonCopy, {
|
|
600
|
-
value: el === null || el === void 0 ? void 0 : el[(el === null || el === void 0 ? void 0 : el.length) - 1]
|
|
601
|
-
})))));
|
|
602
|
-
}
|
|
603
|
-
if (currentType === 'imageWithText') {
|
|
604
|
-
if (!Array.isArray(el)) return 'ㅤ';
|
|
605
|
-
var _el3 = _slicedToArray(el, 2),
|
|
606
|
-
link = _el3[0],
|
|
607
|
-
text = _el3[1];
|
|
608
|
-
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
609
|
-
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
610
|
-
key: _getId([tableId, el, ind], 'imageWithText')
|
|
611
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
612
|
-
className: "type-td_image-with-text",
|
|
613
|
-
style: {
|
|
614
|
-
justifyContent: text ? 'flex-start' : 'center'
|
|
615
|
-
}
|
|
616
|
-
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
617
|
-
src: link,
|
|
618
|
-
alt: "table_icon",
|
|
619
|
-
onError: function onError(e) {
|
|
620
|
-
return e.target.src = imageNotFound;
|
|
621
|
-
}
|
|
622
|
-
}), /*#__PURE__*/_react["default"].createElement("p", null, text)));
|
|
623
|
-
}
|
|
624
|
-
if (currentType === 'author') {
|
|
625
|
-
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
626
|
-
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
627
|
-
key: _getId([tableId, el, ind], 'author')
|
|
628
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
629
|
-
className: "type-td_image-with-text",
|
|
630
|
-
style: {
|
|
631
|
-
justifyContent: el ? 'flex-start' : 'center'
|
|
632
|
-
}
|
|
633
|
-
}, /*#__PURE__*/_react["default"].createElement("p", null, lang === 'eng' ? (0, _utils.transliter)(el) : el)));
|
|
634
|
-
}
|
|
635
|
-
if (currentType === 'name') {
|
|
636
|
-
var _fullName$split$, _fullName$split$2;
|
|
637
|
-
if (!Array.isArray(el)) return 'ㅤ';
|
|
638
|
-
var _el4 = _slicedToArray(el, 2),
|
|
639
|
-
fullName = _el4[0],
|
|
640
|
-
color = _el4[1];
|
|
641
|
-
var _name = fullName === null || fullName === void 0 || (_fullName$split$ = fullName.split(' ')[0]) === null || _fullName$split$ === void 0 || (_fullName$split$ = _fullName$split$.substr(0, 1)) === null || _fullName$split$ === void 0 ? void 0 : _fullName$split$.toUpperCase();
|
|
642
|
-
var surname = fullName === null || fullName === void 0 || (_fullName$split$2 = fullName.split(' ')[1]) === null || _fullName$split$2 === void 0 || (_fullName$split$2 = _fullName$split$2.substr(0, 1)) === null || _fullName$split$2 === void 0 ? void 0 : _fullName$split$2.toUpperCase();
|
|
643
|
-
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
644
|
-
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
645
|
-
key: _getId([tableId, el, ind], 'name')
|
|
646
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
647
|
-
className: "type-td_name",
|
|
648
|
-
style: {
|
|
649
|
-
justifyContent: el ? 'flex-start' : 'center'
|
|
650
|
-
}
|
|
651
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
652
|
-
className: "icon-name",
|
|
653
|
-
style: {
|
|
654
|
-
background: color
|
|
655
|
-
}
|
|
656
|
-
}, "".concat(_name ? _name : '').concat(surname ? surname : '')), /*#__PURE__*/_react["default"].createElement("p", {
|
|
657
|
-
className: "text_name"
|
|
658
|
-
}, fullName)));
|
|
659
|
-
}
|
|
660
|
-
if (currentType === 'stringLayersWithLink') {
|
|
661
|
-
if (!Array.isArray(el)) return 'ㅤ';
|
|
662
|
-
var _stringArr = el === null || el === void 0 ? void 0 : el.map(function (el, strInd) {
|
|
663
|
-
if (Array.isArray(el)) {
|
|
664
|
-
if ((el === null || el === void 0 ? void 0 : el.length) > 1) {
|
|
665
|
-
var _el5 = _slicedToArray(el, 2),
|
|
666
|
-
_text = _el5[0],
|
|
667
|
-
_link = _el5[1];
|
|
668
|
-
return /*#__PURE__*/_react["default"].createElement("a", {
|
|
669
|
-
// style={headers?.styles?.[rowInd]?.[ind] ? headers?.styles?.[rowInd]?.[ind] : {}}
|
|
670
|
-
key: _getId([tableId, el, ind], 'stringLayersWithLink'),
|
|
671
|
-
href: _link,
|
|
672
|
-
target: "_blank",
|
|
673
|
-
rel: "noopener noreferrer",
|
|
674
|
-
className: "btn"
|
|
675
|
-
}, _text);
|
|
513
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
514
|
+
className: "type-td_link"
|
|
515
|
+
}, /*#__PURE__*/_react["default"].createElement("a", {
|
|
516
|
+
href: el,
|
|
517
|
+
target: "_blank",
|
|
518
|
+
rel: "noopener noreferrer",
|
|
519
|
+
className: "link__blue"
|
|
520
|
+
}, (el === null || el === void 0 ? void 0 : el.length) > 20 ? el.slice(0, 20) + '...' : el), (el === null || el === void 0 ? void 0 : el.length) > 20 && /*#__PURE__*/_react["default"].createElement("a", {
|
|
521
|
+
href: el,
|
|
522
|
+
target: "_blank",
|
|
523
|
+
rel: "noopener noreferrer",
|
|
524
|
+
className: "link__blue popup-td"
|
|
525
|
+
}, el)));
|
|
526
|
+
}
|
|
527
|
+
if (currentType === 'stringLayers') {
|
|
528
|
+
if (!Array.isArray(el)) return 'ㅤ';
|
|
529
|
+
var stringArr = el === null || el === void 0 ? void 0 : el.map(function (item, itemInd) {
|
|
530
|
+
var styles;
|
|
531
|
+
if (Array.isArray(headers === null || headers === void 0 ? void 0 : headers.styles)) {
|
|
532
|
+
var _headers$styles, _headers$styles2;
|
|
533
|
+
styles = headers !== null && headers !== void 0 && (_headers$styles = headers.styles) !== null && _headers$styles !== void 0 && (_headers$styles = _headers$styles[rowInd]) !== null && _headers$styles !== void 0 && (_headers$styles = _headers$styles[ind]) !== null && _headers$styles !== void 0 && _headers$styles[itemInd] ? headers === null || headers === void 0 || (_headers$styles2 = headers.styles) === null || _headers$styles2 === void 0 || (_headers$styles2 = _headers$styles2[rowInd]) === null || _headers$styles2 === void 0 || (_headers$styles2 = _headers$styles2[ind]) === null || _headers$styles2 === void 0 ? void 0 : _headers$styles2[itemInd] : {};
|
|
676
534
|
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
value: el[0]
|
|
691
|
-
})), _stringArr && /*#__PURE__*/_react["default"].createElement("div", {
|
|
692
|
-
className: "text-box"
|
|
693
|
-
}, _stringArr));
|
|
694
|
-
}
|
|
695
|
-
if (currentType === 'copyText') {
|
|
696
|
-
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
697
|
-
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
698
|
-
key: _getId([tableId, el, ind], 'stringLayersWithLink'),
|
|
699
|
-
onContextMenu: function onContextMenu(e) {
|
|
700
|
-
return e.stopPropagation();
|
|
701
|
-
}
|
|
702
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
703
|
-
className: "type-td_copy-text"
|
|
704
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
705
|
-
className: "copy-box"
|
|
706
|
-
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
707
|
-
className: "text"
|
|
708
|
-
}, el), /*#__PURE__*/_react["default"].createElement(_ButtonCopy.ButtonCopy, {
|
|
709
|
-
value: el
|
|
710
|
-
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
711
|
-
className: "tooltip-box"
|
|
712
|
-
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
713
|
-
className: "btn-copy",
|
|
714
|
-
onClick: function onClick() {
|
|
715
|
-
navigator.clipboard.writeText(el[0]);
|
|
716
|
-
setActiveBuffer(el[0]);
|
|
717
|
-
}
|
|
718
|
-
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
719
|
-
className: "tooltip_black"
|
|
720
|
-
}, activeBuffer == el[0] ? translateTextСopied() : translateCopyText())))));
|
|
721
|
-
}
|
|
722
|
-
if (currentType === 'textWithLink') {
|
|
723
|
-
if (!Array.isArray(el)) return 'ㅤ';
|
|
724
|
-
var _el6 = _slicedToArray(el, 2),
|
|
725
|
-
_text2 = _el6[0],
|
|
726
|
-
_link2 = _el6[1];
|
|
727
|
-
var type_link = _link2 !== null && _link2 !== void 0 && _link2.includes('http') ? '_blank' : false;
|
|
728
|
-
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
729
|
-
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
730
|
-
key: _getId([tableId, el, ind], 'textWithLink'),
|
|
731
|
-
onContextMenu: function onContextMenu(e) {
|
|
732
|
-
return e.stopPropagation();
|
|
733
|
-
}
|
|
734
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
735
|
-
className: "type-td_image-with-text"
|
|
736
|
-
}, /*#__PURE__*/_react["default"].createElement(_link3["default"], {
|
|
737
|
-
onClick: function onClick(e) {
|
|
738
|
-
if (typeof onRedirect === 'function') {
|
|
739
|
-
var _headers$header;
|
|
740
|
-
e.preventDefault();
|
|
741
|
-
onRedirect(onRedirectInfo ? [getRowObj(arr), el, headers === null || headers === void 0 || (_headers$header = headers.header) === null || _headers$header === void 0 ? void 0 : _headers$header[ind]] : [getRowObj(arr), _link2]);
|
|
535
|
+
if (Array.isArray(item)) {
|
|
536
|
+
return /*#__PURE__*/_react["default"].createElement("p", null, item.map(function (str, strInd) {
|
|
537
|
+
var strItemStyles;
|
|
538
|
+
if (styles) {
|
|
539
|
+
var _styles;
|
|
540
|
+
strItemStyles = (_styles = styles) === null || _styles === void 0 ? void 0 : _styles[strInd];
|
|
541
|
+
}
|
|
542
|
+
var checkedStyles = _typeof(strItemStyles) === 'object' && !Array.isArray(strItemStyles) ? strItemStyles : {};
|
|
543
|
+
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
544
|
+
className: 'text_grey',
|
|
545
|
+
style: checkedStyles
|
|
546
|
+
}, str);
|
|
547
|
+
}));
|
|
742
548
|
} else {
|
|
743
|
-
|
|
549
|
+
return /*#__PURE__*/_react["default"].createElement("p", {
|
|
550
|
+
className: 'text_grey',
|
|
551
|
+
style: Array.isArray(styles) ? styles[itemInd] : styles
|
|
552
|
+
}, item);
|
|
744
553
|
}
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
554
|
+
});
|
|
555
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
556
|
+
className: "type-td_string-layers ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
557
|
+
key: _getId([tableId, el, ind], 'stringLayers')
|
|
558
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
559
|
+
className: "type-td_string-layers__content"
|
|
560
|
+
}, stringArr));
|
|
561
|
+
}
|
|
562
|
+
if (currentType === 'toggleStatus') {
|
|
563
|
+
if (!Array.isArray(el)) return 'ㅤ';
|
|
564
|
+
var _el = _slicedToArray(el, 2),
|
|
565
|
+
value = _el[0],
|
|
566
|
+
id = _el[1];
|
|
567
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
568
|
+
className: "type-td_toggle_status ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
569
|
+
key: _getId([tableId, el, ind], 'toggleStatus')
|
|
570
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
571
|
+
className: "text-box"
|
|
572
|
+
}, /*#__PURE__*/_react["default"].createElement(_CheckboxToggle["default"], {
|
|
573
|
+
value: value,
|
|
574
|
+
onChange: function onChange(e) {
|
|
575
|
+
if (onToggle) {
|
|
576
|
+
onToggle(getRowObj(arr));
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
})));
|
|
580
|
+
}
|
|
581
|
+
if (currentType === 'collectInfo') {
|
|
582
|
+
if (!Array.isArray(el)) return 'ㅤ';
|
|
583
|
+
var _el2 = _slicedToArray(el, 6),
|
|
584
|
+
imgLink = _el2[0],
|
|
585
|
+
name = _el2[1],
|
|
586
|
+
desc = _el2[2],
|
|
587
|
+
brand = _el2[3],
|
|
588
|
+
offerId = _el2[4],
|
|
589
|
+
count = _el2[5];
|
|
590
|
+
var isNameArr = Array.isArray(name);
|
|
591
|
+
var isDescArr = Array.isArray(desc);
|
|
592
|
+
var isBrandArr = Array.isArray(brand);
|
|
593
|
+
var isOfferArr = Array.isArray(offerId);
|
|
594
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
595
|
+
className: "type-td_collect-info ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
596
|
+
key: _getId([tableId, el, ind], 'collectInfo')
|
|
597
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
598
|
+
className: "collect_info_box"
|
|
599
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
600
|
+
className: "img-box"
|
|
601
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
602
|
+
className: "collect_info_img",
|
|
603
|
+
src: imgLink,
|
|
604
|
+
onError: function onError(e) {
|
|
605
|
+
return e.target.src = imageNotFound;
|
|
606
|
+
},
|
|
607
|
+
alt: "table_info_img"
|
|
608
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
609
|
+
className: "text_info_box"
|
|
610
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
611
|
+
className: "text_info_name",
|
|
612
|
+
onClick: isNameArr ? function (e) {
|
|
613
|
+
return onAction(['name', name]);
|
|
614
|
+
} : function () {},
|
|
615
|
+
style: isNameArr ? {
|
|
616
|
+
color: '#0009E8'
|
|
617
|
+
} : {}
|
|
618
|
+
}, name ? isNameArr ? name === null || name === void 0 ? void 0 : name[0] : name : '-'), /*#__PURE__*/_react["default"].createElement("p", {
|
|
619
|
+
className: "text_info_desc",
|
|
620
|
+
onClick: isDescArr ? function (e) {
|
|
621
|
+
return onAction(['desc', desc]);
|
|
622
|
+
} : function () {},
|
|
623
|
+
style: isDescArr ? {
|
|
624
|
+
color: '#0009E8'
|
|
625
|
+
} : {}
|
|
626
|
+
}, desc ? isDescArr ? desc === null || desc === void 0 ? void 0 : desc[0] : desc : '-'), /*#__PURE__*/_react["default"].createElement("p", {
|
|
627
|
+
className: "text_info_brand",
|
|
628
|
+
onClick: isBrandArr ? function (e) {
|
|
629
|
+
return onAction(['brand', brand]);
|
|
630
|
+
} : function () {},
|
|
631
|
+
style: isBrandArr ? {
|
|
632
|
+
color: '#0009E8'
|
|
633
|
+
} : {}
|
|
634
|
+
}, brand ? isBrandArr ? brand === null || brand === void 0 ? void 0 : brand[0] : brand : '-'), /*#__PURE__*/_react["default"].createElement("div", {
|
|
635
|
+
className: "text_info_sub_desc_box"
|
|
636
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
637
|
+
className: "text_info_sub_desc",
|
|
638
|
+
onClick: isOfferArr ? function (e) {
|
|
639
|
+
return onAction(['offerId', offerId]);
|
|
640
|
+
} : function () {}
|
|
641
|
+
}, translateId(), ' ', Array.isArray(offerId) ? /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement("a", {
|
|
642
|
+
style: isOfferArr ? {
|
|
643
|
+
color: '#0009E8'
|
|
644
|
+
} : {},
|
|
645
|
+
onClick: function onClick(e) {
|
|
646
|
+
return e.stopPropagation();
|
|
647
|
+
},
|
|
648
|
+
href: offerId !== null && offerId !== void 0 && offerId[1] ? offerId === null || offerId === void 0 ? void 0 : offerId[1] : '#',
|
|
649
|
+
target: "_blank"
|
|
650
|
+
}, offerId === null || offerId === void 0 ? void 0 : offerId[0])) : /*#__PURE__*/_react["default"].createElement("span", null, offerId)), count && /*#__PURE__*/_react["default"].createElement("p", {
|
|
651
|
+
className: "text_sum"
|
|
652
|
+
}, count, /*#__PURE__*/_react["default"].createElement("span", null, "\u0448\u0442")), /*#__PURE__*/_react["default"].createElement(_ButtonCopy.ButtonCopy, {
|
|
653
|
+
value: el === null || el === void 0 ? void 0 : el[(el === null || el === void 0 ? void 0 : el.length) - 1],
|
|
654
|
+
copyText: translateCopyId(),
|
|
655
|
+
copiedText: translateCopiedId()
|
|
656
|
+
})))));
|
|
657
|
+
}
|
|
658
|
+
if (currentType === 'collectInfoArr') {
|
|
659
|
+
if (!Array.isArray(el)) return 'ㅤ';
|
|
660
|
+
var _arr = el === null || el === void 0 ? void 0 : el.map(function (collectInfo) {
|
|
661
|
+
var _collectInfo = _slicedToArray(collectInfo, 6),
|
|
662
|
+
imgLink = _collectInfo[0],
|
|
663
|
+
name = _collectInfo[1],
|
|
664
|
+
desc = _collectInfo[2],
|
|
665
|
+
brand = _collectInfo[3],
|
|
666
|
+
offerId = _collectInfo[4],
|
|
667
|
+
count = _collectInfo[5];
|
|
668
|
+
var isNameArr = Array.isArray(name);
|
|
669
|
+
var isDescArr = Array.isArray(desc);
|
|
670
|
+
var isBrandArr = Array.isArray(brand);
|
|
671
|
+
var isOfferArr = Array.isArray(offerId);
|
|
672
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
673
|
+
className: "type-td_collect-info ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
674
|
+
key: _getId([tableId, collectInfo, ind], 'collectInfo')
|
|
675
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
676
|
+
className: "collect_info_box"
|
|
677
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
678
|
+
className: "img-box"
|
|
679
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
680
|
+
className: "collect_info_img",
|
|
681
|
+
src: imgLink,
|
|
682
|
+
onError: function onError(e) {
|
|
683
|
+
return e.target.src = imageNotFound;
|
|
684
|
+
},
|
|
685
|
+
alt: "table_info_img"
|
|
686
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
687
|
+
className: "text_info_box"
|
|
688
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
689
|
+
className: "text_info_name",
|
|
690
|
+
onClick: isNameArr ? function (e) {
|
|
691
|
+
return onAction(['name', name]);
|
|
692
|
+
} : function () {},
|
|
693
|
+
style: isNameArr ? {
|
|
694
|
+
color: '#0009E8'
|
|
695
|
+
} : {}
|
|
696
|
+
}, name ? isNameArr ? name === null || name === void 0 ? void 0 : name[0] : name : '-'), /*#__PURE__*/_react["default"].createElement("p", {
|
|
697
|
+
className: "text_info_desc",
|
|
698
|
+
onClick: isDescArr ? function (e) {
|
|
699
|
+
return onAction(['desc', desc]);
|
|
700
|
+
} : function () {},
|
|
701
|
+
style: isDescArr ? {
|
|
702
|
+
color: '#0009E8'
|
|
703
|
+
} : {}
|
|
704
|
+
}, desc ? isDescArr ? desc === null || desc === void 0 ? void 0 : desc[0] : desc : '-'), /*#__PURE__*/_react["default"].createElement("p", {
|
|
705
|
+
className: "text_info_brand",
|
|
706
|
+
onClick: isBrandArr ? function (e) {
|
|
707
|
+
return onAction(['brand', brand]);
|
|
708
|
+
} : function () {},
|
|
709
|
+
style: isBrandArr ? {
|
|
710
|
+
color: '#0009E8'
|
|
711
|
+
} : {}
|
|
712
|
+
}, brand ? isBrandArr ? brand === null || brand === void 0 ? void 0 : brand[0] : brand : '-'), /*#__PURE__*/_react["default"].createElement("div", {
|
|
713
|
+
className: "text_info_sub_desc_box"
|
|
714
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
715
|
+
className: "text_info_sub_desc",
|
|
716
|
+
onClick: isOfferArr ? function (e) {
|
|
717
|
+
return onAction(['offerId', offerId]);
|
|
718
|
+
} : function () {}
|
|
719
|
+
}, translateId(), ' ', Array.isArray(offerId) ? /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement("a", {
|
|
720
|
+
style: isOfferArr ? {
|
|
721
|
+
color: '#0009E8'
|
|
722
|
+
} : {},
|
|
723
|
+
onClick: function onClick(e) {
|
|
724
|
+
return e.stopPropagation();
|
|
725
|
+
},
|
|
726
|
+
href: offerId !== null && offerId !== void 0 && offerId[1] ? offerId === null || offerId === void 0 ? void 0 : offerId[1] : '#',
|
|
727
|
+
target: "_blank"
|
|
728
|
+
}, offerId === null || offerId === void 0 ? void 0 : offerId[0])) : /*#__PURE__*/_react["default"].createElement("span", null, offerId)), count && /*#__PURE__*/_react["default"].createElement("p", {
|
|
729
|
+
className: "text_sum"
|
|
730
|
+
}, count, /*#__PURE__*/_react["default"].createElement("span", null, "\u0448\u0442")), /*#__PURE__*/_react["default"].createElement(_ButtonCopy.ButtonCopy, {
|
|
731
|
+
value: collectInfo === null || collectInfo === void 0 ? void 0 : collectInfo[(collectInfo === null || collectInfo === void 0 ? void 0 : collectInfo.length) - 1],
|
|
732
|
+
copyText: translateCopyId(),
|
|
733
|
+
copiedText: translateCopiedId()
|
|
734
|
+
})))));
|
|
735
|
+
});
|
|
736
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
737
|
+
style: {
|
|
738
|
+
display: 'flex',
|
|
739
|
+
flexDirection: 'column'
|
|
740
|
+
}
|
|
741
|
+
}, _arr);
|
|
742
|
+
}
|
|
743
|
+
if (currentType === 'imageWithText') {
|
|
744
|
+
if (!Array.isArray(el)) return 'ㅤ';
|
|
745
|
+
var _el3 = _slicedToArray(el, 2),
|
|
746
|
+
link = _el3[0],
|
|
747
|
+
text = _el3[1];
|
|
748
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
749
|
+
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
750
|
+
key: _getId([tableId, el, ind], 'imageWithText')
|
|
751
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
752
|
+
className: "type-td_image-with-text",
|
|
753
|
+
style: {
|
|
754
|
+
justifyContent: text ? 'flex-start' : 'center'
|
|
755
|
+
}
|
|
756
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
757
|
+
src: link,
|
|
758
|
+
alt: "table_icon",
|
|
759
|
+
onError: function onError(e) {
|
|
760
|
+
return e.target.src = imageNotFound;
|
|
761
|
+
}
|
|
762
|
+
}), /*#__PURE__*/_react["default"].createElement("p", null, text)));
|
|
763
|
+
}
|
|
764
|
+
if (currentType === 'author') {
|
|
765
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
766
|
+
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
767
|
+
key: _getId([tableId, el, ind], 'author')
|
|
768
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
769
|
+
className: "type-td_image-with-text",
|
|
770
|
+
style: {
|
|
771
|
+
justifyContent: el ? 'flex-start' : 'center'
|
|
772
|
+
}
|
|
773
|
+
}, /*#__PURE__*/_react["default"].createElement(_AuthorAvatar.AuthorAvatar, {
|
|
774
|
+
show_name: true,
|
|
775
|
+
size: "s",
|
|
776
|
+
author: [lang !== 'ru' ? (0, _utils.transliter)(el[0]) : el[0], el[1]]
|
|
777
|
+
})));
|
|
778
|
+
}
|
|
779
|
+
if (currentType === 'name') {
|
|
780
|
+
var _fullName$split$, _fullName$split$2;
|
|
781
|
+
if (!Array.isArray(el)) return 'ㅤ';
|
|
782
|
+
var _el4 = _slicedToArray(el, 2),
|
|
783
|
+
fullName = _el4[0],
|
|
784
|
+
color = _el4[1];
|
|
785
|
+
var _name = fullName === null || fullName === void 0 || (_fullName$split$ = fullName.split(' ')[0]) === null || _fullName$split$ === void 0 || (_fullName$split$ = _fullName$split$.substr(0, 1)) === null || _fullName$split$ === void 0 ? void 0 : _fullName$split$.toUpperCase();
|
|
786
|
+
var surname = fullName === null || fullName === void 0 || (_fullName$split$2 = fullName.split(' ')[1]) === null || _fullName$split$2 === void 0 || (_fullName$split$2 = _fullName$split$2.substr(0, 1)) === null || _fullName$split$2 === void 0 ? void 0 : _fullName$split$2.toUpperCase();
|
|
787
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
788
|
+
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
789
|
+
key: _getId([tableId, el, ind], 'name')
|
|
790
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
791
|
+
className: "type-td_name",
|
|
792
|
+
style: {
|
|
793
|
+
justifyContent: el ? 'flex-start' : 'center'
|
|
794
|
+
}
|
|
795
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
796
|
+
className: "icon-name",
|
|
797
|
+
style: {
|
|
798
|
+
background: color
|
|
799
|
+
}
|
|
800
|
+
}, "".concat(_name ? _name : '').concat(surname ? surname : '')), /*#__PURE__*/_react["default"].createElement("p", {
|
|
801
|
+
className: "text_name"
|
|
802
|
+
}, fullName)));
|
|
803
|
+
}
|
|
804
|
+
if (currentType === 'stringLayersWithLink') {
|
|
805
|
+
if (!Array.isArray(el)) return 'ㅤ';
|
|
806
|
+
var _stringArr = el === null || el === void 0 ? void 0 : el.map(function (el, strInd) {
|
|
807
|
+
if (Array.isArray(el)) {
|
|
808
|
+
if ((el === null || el === void 0 ? void 0 : el.length) > 1) {
|
|
809
|
+
var _el5 = _slicedToArray(el, 2),
|
|
810
|
+
_text = _el5[0],
|
|
811
|
+
_link = _el5[1];
|
|
812
|
+
return /*#__PURE__*/_react["default"].createElement("a", {
|
|
813
|
+
// style={headers?.styles?.[rowInd]?.[ind] ? headers?.styles?.[rowInd]?.[ind] : {}}
|
|
814
|
+
key: _getId([tableId, el, ind], 'stringLayersWithLink'),
|
|
815
|
+
href: _link,
|
|
816
|
+
target: "_blank",
|
|
817
|
+
rel: "noopener noreferrer",
|
|
818
|
+
className: "btn"
|
|
819
|
+
}, _text);
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
824
|
+
className: "type-td_string-layers ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
825
|
+
key: _getId([tableId, el, ind], 'stringLayersWithLink'),
|
|
826
|
+
onContextMenu: function onContextMenu(e) {
|
|
827
|
+
return e.stopPropagation();
|
|
828
|
+
}
|
|
829
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
830
|
+
className: "copy-box"
|
|
831
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
832
|
+
className: "text"
|
|
833
|
+
}, el[0]), /*#__PURE__*/_react["default"].createElement(_ButtonCopy.ButtonCopy, {
|
|
834
|
+
value: el[0]
|
|
835
|
+
})), _stringArr && /*#__PURE__*/_react["default"].createElement("div", {
|
|
836
|
+
className: "text-box"
|
|
837
|
+
}, _stringArr));
|
|
838
|
+
}
|
|
839
|
+
if (currentType === 'copyText') {
|
|
840
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
841
|
+
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
842
|
+
key: _getId([tableId, el, ind], 'stringLayersWithLink'),
|
|
843
|
+
onContextMenu: function onContextMenu(e) {
|
|
844
|
+
return e.stopPropagation();
|
|
845
|
+
}
|
|
846
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
847
|
+
className: "type-td_copy-text"
|
|
848
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
849
|
+
className: "copy-box"
|
|
850
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
851
|
+
className: "text"
|
|
852
|
+
}, el), /*#__PURE__*/_react["default"].createElement(_ButtonCopy.ButtonCopy, {
|
|
853
|
+
value: el
|
|
854
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
855
|
+
className: "tooltip-box"
|
|
856
|
+
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
857
|
+
className: "btn-copy",
|
|
858
|
+
onClick: function onClick() {
|
|
859
|
+
navigator.clipboard.writeText(el[0]);
|
|
860
|
+
setActiveBuffer(el[0]);
|
|
861
|
+
}
|
|
862
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
863
|
+
className: "tooltip_black"
|
|
864
|
+
}, activeBuffer == el[0] ? translateTextСopied() : translateCopyText())))));
|
|
865
|
+
}
|
|
866
|
+
if (currentType === 'textWithLink') {
|
|
867
|
+
if (!Array.isArray(el)) return '';
|
|
868
|
+
var _el6 = _slicedToArray(el, 2),
|
|
869
|
+
_text2 = _el6[0],
|
|
870
|
+
_link2 = _el6[1];
|
|
871
|
+
var type_link = _link2 !== null && _link2 !== void 0 && _link2.includes('http') ? '_blank' : false;
|
|
872
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
873
|
+
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
874
|
+
key: _getId([tableId, el, ind], 'textWithLink'),
|
|
875
|
+
onContextMenu: function onContextMenu(e) {
|
|
876
|
+
return e.stopPropagation();
|
|
877
|
+
}
|
|
878
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
879
|
+
className: "type-td_image-with-text"
|
|
880
|
+
}, /*#__PURE__*/_react["default"].createElement(_link3["default"], {
|
|
881
|
+
href: _link2,
|
|
882
|
+
target: '_blank',
|
|
883
|
+
onClick: function onClick(e) {
|
|
884
|
+
if (onRedirect === 'function') {
|
|
885
|
+
var _headers$header3;
|
|
886
|
+
e.preventDefault();
|
|
887
|
+
onRedirect(onRedirectInfo ? [getRowObj(arr), el, headers === null || headers === void 0 || (_headers$header3 = headers.header) === null || _headers$header3 === void 0 ? void 0 : _headers$header3[ind]] : [getRowObj(arr), _link2]);
|
|
888
|
+
} else {
|
|
889
|
+
window.open(_link2, type_link);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
// style={headers?.styles?.[rowInd]?.[ind] ? headers?.styles?.[rowInd]?.[ind] : {}}
|
|
893
|
+
}, _text2)));
|
|
894
|
+
}
|
|
895
|
+
if (currentType === 'statusWithColor') {
|
|
896
|
+
if (!Array.isArray(el)) return 'ㅤ';
|
|
897
|
+
var _el7 = _slicedToArray(el, 3),
|
|
898
|
+
_text3 = _el7[0],
|
|
899
|
+
_color = _el7[1],
|
|
900
|
+
backgroundColor = _el7[2];
|
|
901
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
902
|
+
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
903
|
+
key: _getId([_text3 + ind]),
|
|
904
|
+
style: {
|
|
905
|
+
background: backgroundColor ? '#' + backgroundColor : ''
|
|
906
|
+
}
|
|
907
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
908
|
+
className: "type-td_status-with-color",
|
|
909
|
+
style: {
|
|
910
|
+
justifyContent: el ? 'flex-start' : 'center'
|
|
911
|
+
}
|
|
912
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
913
|
+
className: "text",
|
|
914
|
+
style: {
|
|
915
|
+
color: _color ? '#' + _color : ''
|
|
916
|
+
}
|
|
917
|
+
}, _text3 ? _text3 : '-')));
|
|
918
|
+
}
|
|
919
|
+
if (currentType === 'image') {
|
|
920
|
+
var _el$, _el$2, _el$3, _el$4;
|
|
921
|
+
var isArray = Array.isArray(el);
|
|
922
|
+
var denominator = isArray ? el === null || el === void 0 ? void 0 : el.length : 1;
|
|
923
|
+
var imgWidthPercents = showAllImages ? 100 / denominator : 100;
|
|
924
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
925
|
+
className: "type-td_image ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
926
|
+
key: _getId([tableId, el, ind], 'image')
|
|
927
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
928
|
+
className: "img-box"
|
|
929
|
+
}, showAllImages && isArray ? el === null || el === void 0 ? void 0 : el.map(function (el, index) {
|
|
930
|
+
return /*#__PURE__*/_react["default"].createElement(_TypeTdImage.TypeTdImage, {
|
|
931
|
+
imgWidthPercents: imgWidthPercents,
|
|
932
|
+
src: el ? el : imageNotFound,
|
|
933
|
+
key: JSON.stringify(el) + index
|
|
934
|
+
});
|
|
935
|
+
}) : isArray ? /*#__PURE__*/_react["default"].createElement(_TypeTdImage.TypeTdImage, {
|
|
936
|
+
imgWidthPercents: imgWidthPercents,
|
|
937
|
+
key: JSON.stringify(el === null || el === void 0 ? void 0 : el[0]),
|
|
938
|
+
src: el !== null && el !== void 0 && (_el$ = el[0]) !== null && _el$ !== void 0 && _el$.value ? el === null || el === void 0 || (_el$2 = el[0]) === null || _el$2 === void 0 ? void 0 : _el$2.value : imageNotFound,
|
|
939
|
+
alt: el !== null && el !== void 0 && (_el$3 = el[0]) !== null && _el$3 !== void 0 && _el$3.alt ? el === null || el === void 0 || (_el$4 = el[0]) === null || _el$4 === void 0 ? void 0 : _el$4.alt : ''
|
|
940
|
+
}) : /*#__PURE__*/_react["default"].createElement(_TypeTdImage.TypeTdImage, {
|
|
941
|
+
imgWidthPercents: imgWidthPercents,
|
|
942
|
+
key: el,
|
|
943
|
+
src: el ? el : imageNotFound
|
|
944
|
+
})));
|
|
945
|
+
}
|
|
946
|
+
if (currentType === 'num') {
|
|
947
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
948
|
+
// style={headers?.styles?.[rowInd]?.[ind] ? headers?.styles?.[rowInd]?.[ind] : {}}
|
|
949
|
+
className: "type-td_num ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
950
|
+
key: _getId([tableId, el, ind], 'num')
|
|
951
|
+
}, el === null || el === void 0 ? void 0 : el.toLocaleString());
|
|
952
|
+
}
|
|
953
|
+
if (currentType === 'postDataTd') {
|
|
954
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
955
|
+
onClick: function onClick(e) {
|
|
956
|
+
e.preventDefault();
|
|
957
|
+
if (postDataTd) postDataTd(getRowObj(arr));
|
|
958
|
+
},
|
|
959
|
+
className: "type-td_num ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
960
|
+
key: _getId([tableId, el, ind], 'num')
|
|
961
|
+
}, el === null || el === void 0 ? void 0 : el.toLocaleString());
|
|
962
|
+
}
|
|
963
|
+
if (currentType === 'bar') {
|
|
964
|
+
if (!Array.isArray(el)) return 'ㅤ';
|
|
965
|
+
var _el8 = _slicedToArray(el, 2),
|
|
966
|
+
_count = _el8[0],
|
|
967
|
+
out_of = _el8[1];
|
|
968
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
969
|
+
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
970
|
+
key: _getId([tableId, el, ind], 'bar')
|
|
971
|
+
}, /*#__PURE__*/_react["default"].createElement("span", null, _count, " \u0438\u0437 ", out_of));
|
|
972
|
+
}
|
|
973
|
+
if (currentType === 'roundIcons') {
|
|
974
|
+
var _isArray = Array.isArray(el);
|
|
975
|
+
if (_isArray) {
|
|
976
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
977
|
+
className: "type-td_image ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
978
|
+
key: _getId([tableId, el, ind], 'image')
|
|
979
|
+
}, /*#__PURE__*/_react["default"].createElement(RoundIcons, {
|
|
980
|
+
arrImg: el
|
|
981
|
+
}));
|
|
761
982
|
}
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
983
|
+
}
|
|
984
|
+
if (currentType === 'imgSlider') {
|
|
985
|
+
var _isArray2 = Array.isArray(el);
|
|
986
|
+
if (_isArray2) {
|
|
987
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
988
|
+
className: "type-td_image ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
989
|
+
key: _getId([tableId, el, ind], 'image')
|
|
990
|
+
}, /*#__PURE__*/_react["default"].createElement(_SliderCarousel["default"], {
|
|
991
|
+
imgArr: el
|
|
992
|
+
}));
|
|
766
993
|
}
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
994
|
+
}
|
|
995
|
+
if (currentType === 'chart') {
|
|
996
|
+
// const { datasets, labels, label } = el
|
|
997
|
+
try {
|
|
998
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
999
|
+
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
1000
|
+
key: _getId([tableId, el, ind], 'chart')
|
|
1001
|
+
}, /*#__PURE__*/_react["default"].createElement(_TableChartTd["default"], {
|
|
1002
|
+
labels_prop: el !== null && el !== void 0 && el.labels ? el === null || el === void 0 ? void 0 : el.labels : [],
|
|
1003
|
+
datasets_prop: el !== null && el !== void 0 && el.datasets ? el === null || el === void 0 ? void 0 : el.datasets : [],
|
|
1004
|
+
label: el !== null && el !== void 0 && el.label ? el === null || el === void 0 ? void 0 : el.label : []
|
|
1005
|
+
}));
|
|
1006
|
+
} catch (error) {
|
|
1007
|
+
console.error(error);
|
|
1008
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
1009
|
+
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
1010
|
+
key: _getId([tableId, el, ind], 'chart')
|
|
1011
|
+
}, ' ');
|
|
771
1012
|
}
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
1013
|
+
}
|
|
1014
|
+
if (currentType === 'input') {
|
|
1015
|
+
var _headers$header4;
|
|
1016
|
+
if (!Array.isArray(el)) return 'ㅤ';
|
|
1017
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
1018
|
+
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
1019
|
+
key: _getId([tableId, el, ind], 'input')
|
|
1020
|
+
}, /*#__PURE__*/_react["default"].createElement(_TableInput["default"], {
|
|
1021
|
+
props: el,
|
|
1022
|
+
getId: function getId(e) {
|
|
1023
|
+
return _getId(e);
|
|
1024
|
+
},
|
|
1025
|
+
staticTD: staticTD,
|
|
1026
|
+
ind: ind,
|
|
1027
|
+
tableId: tableId,
|
|
1028
|
+
rowObj: getRowObj(arr),
|
|
1029
|
+
state: inputState,
|
|
1030
|
+
setState: function setState(e) {
|
|
1031
|
+
return setInputState(e);
|
|
1032
|
+
},
|
|
1033
|
+
inputRowInfo: [getRowObj(arr), String(el), headers === null || headers === void 0 || (_headers$header4 = headers.header) === null || _headers$header4 === void 0 ? void 0 : _headers$header4[ind]],
|
|
1034
|
+
onInputAction: onInputAction
|
|
1035
|
+
}));
|
|
1036
|
+
}
|
|
1037
|
+
if (currentType === 'inputNum') {
|
|
1038
|
+
var _headers$header5;
|
|
1039
|
+
if (!Array.isArray(el)) return ' ';
|
|
1040
|
+
return /*#__PURE__*/_react["default"].createElement(TableInputNum, {
|
|
1041
|
+
props: el,
|
|
1042
|
+
getId: function getId(e) {
|
|
1043
|
+
return _getId(e);
|
|
1044
|
+
},
|
|
1045
|
+
staticTD: staticTD,
|
|
1046
|
+
ind: ind,
|
|
1047
|
+
tableId: tableId,
|
|
1048
|
+
rowObj: getRowObj(arr),
|
|
1049
|
+
state: inputState,
|
|
1050
|
+
setState: function setState(e) {
|
|
1051
|
+
return setInputState(e);
|
|
1052
|
+
},
|
|
1053
|
+
inputRowInfo: [getRowObj(arr), String(el), headers === null || headers === void 0 || (_headers$header5 = headers.header) === null || _headers$header5 === void 0 ? void 0 : _headers$header5[ind]],
|
|
1054
|
+
onInputAction: onInputAction
|
|
789
1055
|
});
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
src: el !== null && el !== void 0 && (_el$ = el[0]) !== null && _el$ !== void 0 && _el$.value ? el === null || el === void 0 || (_el$2 = el[0]) === null || _el$2 === void 0 ? void 0 : _el$2.value : imageNotFound,
|
|
794
|
-
alt: el !== null && el !== void 0 && (_el$3 = el[0]) !== null && _el$3 !== void 0 && _el$3.alt ? el === null || el === void 0 || (_el$4 = el[0]) === null || _el$4 === void 0 ? void 0 : _el$4.alt : ''
|
|
795
|
-
}) : /*#__PURE__*/_react["default"].createElement(_TypeTdImage.TypeTdImage, {
|
|
796
|
-
imgWidthPercents: imgWidthPercents,
|
|
797
|
-
key: el,
|
|
798
|
-
src: el ? el : imageNotFound
|
|
799
|
-
})));
|
|
800
|
-
}
|
|
801
|
-
if (currentType === 'num') {
|
|
802
|
-
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
803
|
-
// style={headers?.styles?.[rowInd]?.[ind] ? headers?.styles?.[rowInd]?.[ind] : {}}
|
|
804
|
-
className: "type-td_num ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
805
|
-
key: _getId([tableId, el, ind], 'num')
|
|
806
|
-
}, el === null || el === void 0 ? void 0 : el.toLocaleString());
|
|
807
|
-
}
|
|
808
|
-
if (currentType === 'postDataTd') {
|
|
809
|
-
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
810
|
-
onClick: function onClick(e) {
|
|
811
|
-
e.preventDefault();
|
|
812
|
-
if (postDataTd) postDataTd(getRowObj(arr));
|
|
813
|
-
},
|
|
814
|
-
className: "type-td_num ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
815
|
-
key: _getId([tableId, el, ind], 'num')
|
|
816
|
-
}, el === null || el === void 0 ? void 0 : el.toLocaleString());
|
|
817
|
-
}
|
|
818
|
-
if (currentType === 'bar') {
|
|
819
|
-
if (!Array.isArray(el)) return 'ㅤ';
|
|
820
|
-
var _el8 = _slicedToArray(el, 2),
|
|
821
|
-
_count = _el8[0],
|
|
822
|
-
out_of = _el8[1];
|
|
823
|
-
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
824
|
-
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
825
|
-
key: _getId([tableId, el, ind], 'bar')
|
|
826
|
-
}, /*#__PURE__*/_react["default"].createElement("span", null, _count, " \u0438\u0437 ", out_of));
|
|
827
|
-
}
|
|
828
|
-
if (currentType === 'chart') {
|
|
829
|
-
// if(!el?.datasets) return 'ㅤ'
|
|
830
|
-
var datasets = el.datasets,
|
|
831
|
-
labels = el.labels,
|
|
832
|
-
label = el.label;
|
|
833
|
-
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
834
|
-
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
835
|
-
key: _getId([tableId, el, ind], 'chart')
|
|
836
|
-
}, /*#__PURE__*/_react["default"].createElement(_TableChartTd["default"], {
|
|
837
|
-
labels_prop: labels,
|
|
838
|
-
datasets_prop: datasets,
|
|
839
|
-
label: label
|
|
840
|
-
}));
|
|
841
|
-
}
|
|
842
|
-
if (currentType === 'input') {
|
|
843
|
-
if (!Array.isArray(el)) return 'ㅤ';
|
|
844
|
-
return /*#__PURE__*/_react["default"].createElement(_TableInput["default"], {
|
|
845
|
-
props: el,
|
|
846
|
-
getId: function getId(e) {
|
|
847
|
-
return _getId(e);
|
|
848
|
-
},
|
|
849
|
-
staticTD: staticTD,
|
|
850
|
-
ind: ind,
|
|
851
|
-
tableId: tableId,
|
|
852
|
-
state: inputState,
|
|
853
|
-
setState: function setState(e) {
|
|
854
|
-
return setInputState(e);
|
|
855
|
-
}
|
|
856
|
-
});
|
|
857
|
-
}
|
|
858
|
-
if (currentType === 'email') {
|
|
859
|
-
var regexEmail = /^((([0-9A-Za-z]{1}[-0-9A-z\.]{0,30}[0-9A-Za-z]?)|([0-9А-Яа-я]{1}[-0-9А-я\.]{0,30}[0-9А-Яа-я]?))@([-A-Za-z]{1,}\.){1,}[-A-Za-z]{2,})$/;
|
|
860
|
-
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
861
|
-
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
862
|
-
key: _getId([tableId, el, ind], 'email')
|
|
863
|
-
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
864
|
-
type: "text",
|
|
865
|
-
style: !regexEmail.test(el) ? {
|
|
866
|
-
outlineColor: 'red'
|
|
867
|
-
} : {},
|
|
868
|
-
value: el
|
|
869
|
-
}));
|
|
870
|
-
}
|
|
871
|
-
if (currentType === 'editableDate') {
|
|
872
|
-
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
873
|
-
// style={headers?.styles?.[rowInd]?.[ind] ? headers?.styles?.[rowInd]?.[ind] : {}}
|
|
874
|
-
className: "type-td_date ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
875
|
-
key: _getId([tableId, el, ind], 'editableDate')
|
|
876
|
-
}, /*#__PURE__*/_react["default"].createElement(_TdDate.TdDate, {
|
|
877
|
-
date: el
|
|
878
|
-
}));
|
|
879
|
-
}
|
|
880
|
-
if (currentType === 'date') {
|
|
881
|
-
var _Date;
|
|
882
|
-
if (!el) return 'ㅤ';
|
|
883
|
-
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
884
|
-
// style={headers?.styles?.[rowInd]?.[ind] ? headers?.styles?.[rowInd]?.[ind] : {}}
|
|
885
|
-
className: "type-td_date ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
886
|
-
key: _getId([tableId, el, ind], 'date')
|
|
887
|
-
}, (_Date = new Date(el)) === null || _Date === void 0 ? void 0 : _Date.toLocaleDateString('ru-RU'));
|
|
888
|
-
}
|
|
889
|
-
if (currentType === 'fullDate') {
|
|
890
|
-
var _Date2, _Date3;
|
|
891
|
-
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
892
|
-
// style={headers?.styles?.[rowInd]?.[ind] ? headers?.styles?.[rowInd]?.[ind] : {}}
|
|
893
|
-
className: "type-td_date ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
894
|
-
key: _getId([tableId, el, ind], 'date')
|
|
895
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
896
|
-
className: "date-with-time"
|
|
897
|
-
}, /*#__PURE__*/_react["default"].createElement("span", null, ((_Date2 = new Date(el)) === null || _Date2 === void 0 ? void 0 : _Date2.toLocaleDateString('ru-RU')) + ' ', /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement("span", {
|
|
898
|
-
style: {
|
|
899
|
-
color: '#9298CF'
|
|
900
|
-
}
|
|
901
|
-
}, ' ' + ((_Date3 = new Date(el)) === null || _Date3 === void 0 ? void 0 : _Date3.toLocaleTimeString('ru-RU', {
|
|
902
|
-
hour: '2-digit',
|
|
903
|
-
minute: '2-digit'
|
|
904
|
-
}))))));
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
// if (currentType === 'rating') {
|
|
908
|
-
// let value
|
|
909
|
-
// if (el) value = Number(el)
|
|
910
|
-
// return <td className={`${(staticTD && ind === 0) ? 'sticky_th' : ''}`} key={getId([tableId, el, ind], 'rating')}>
|
|
911
|
-
// <div className='type-td_rating' style={{ justifyContent: 'flex-end' }}>
|
|
912
|
-
// {
|
|
913
|
-
// el ?
|
|
914
|
-
// <>
|
|
915
|
-
// <Rating
|
|
916
|
-
// name={`rating-comp-${ind + el}`}
|
|
917
|
-
// precision={0.2}
|
|
918
|
-
// defaultValue={Math.floor(value) * 0.2}
|
|
919
|
-
// max={1}
|
|
920
|
-
// readOnly
|
|
921
|
-
// emptyIcon={<StarIcon style={{ opacity: '.1' }} />}
|
|
922
|
-
// icon={<StarIcon style={{ fill: '#faaf00' }} />}
|
|
923
|
-
// size="large"
|
|
924
|
-
// />
|
|
925
|
-
// <span style={{ fontSize: '16px' }}>{el}</span>
|
|
926
|
-
// </>
|
|
927
|
-
// :
|
|
928
|
-
// <span>-</span>
|
|
929
|
-
// }
|
|
930
|
-
// </div>
|
|
931
|
-
// </td>
|
|
932
|
-
// }
|
|
1056
|
+
}
|
|
1057
|
+
if (currentType === 'dictionary') {
|
|
1058
|
+
// if (!Array.isArray(el)) return ' ';
|
|
933
1059
|
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
1060
|
+
if (isEditing) {
|
|
1061
|
+
var _headers$header6;
|
|
1062
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
1063
|
+
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
1064
|
+
key: _getId([tableId, el, ind], 'dictionary')
|
|
1065
|
+
}, /*#__PURE__*/_react["default"].createElement(TableInputDropDown, {
|
|
1066
|
+
rowObj: getRowObj(arr),
|
|
1067
|
+
selectedOption: inputState[el] || [],
|
|
1068
|
+
onSelectOption: function onSelectOption(selected) {
|
|
1069
|
+
setInputState(function (prevState) {
|
|
1070
|
+
return _objectSpread(_objectSpread({}, prevState), {}, _defineProperty({}, el, selected));
|
|
1071
|
+
});
|
|
1072
|
+
},
|
|
1073
|
+
placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435",
|
|
1074
|
+
defaultValue: [el],
|
|
1075
|
+
inputRowInfo: [getRowObj(arr), el, headers === null || headers === void 0 || (_headers$header6 = headers.header) === null || _headers$header6 === void 0 ? void 0 : _headers$header6[ind]],
|
|
1076
|
+
onInputAction: onInputAction,
|
|
1077
|
+
tableIdCRM: tableIdCRM,
|
|
1078
|
+
fetchHead: fetchHead
|
|
1079
|
+
}));
|
|
1080
|
+
} else {
|
|
1081
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
1082
|
+
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
1083
|
+
key: _getId([tableId, el, ind])
|
|
1084
|
+
}, el === null || el === void 0 ? void 0 : el.label);
|
|
948
1085
|
}
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
1086
|
+
}
|
|
1087
|
+
if (currentType === 'email') {
|
|
1088
|
+
var regexEmail = /^((([0-9A-Za-z]{1}[-0-9A-z\.]{0,30}[0-9A-Za-z]?)|([0-9А-Яа-я]{1}[-0-9А-я\.]{0,30}[0-9А-Яа-я]?))@([-A-Za-z]{1,}\.){1,}[-A-Za-z]{2,})$/;
|
|
1089
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
1090
|
+
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
1091
|
+
key: _getId([tableId, el, ind], 'email')
|
|
1092
|
+
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
1093
|
+
type: "text",
|
|
1094
|
+
style: !regexEmail.test(el) ? {
|
|
1095
|
+
outlineColor: 'red'
|
|
1096
|
+
} : {},
|
|
1097
|
+
value: el
|
|
1098
|
+
}));
|
|
1099
|
+
}
|
|
1100
|
+
if (currentType === 'editableDate') {
|
|
1101
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
1102
|
+
// style={headers?.styles?.[rowInd]?.[ind] ? headers?.styles?.[rowInd]?.[ind] : {}}
|
|
1103
|
+
className: "type-td_date ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
1104
|
+
key: _getId([tableId, el, ind], 'editableDate')
|
|
1105
|
+
}, /*#__PURE__*/_react["default"].createElement(_TdDate.TdDate, {
|
|
1106
|
+
date: el
|
|
1107
|
+
}));
|
|
1108
|
+
}
|
|
1109
|
+
if (currentType === 'date') {
|
|
1110
|
+
var _Date;
|
|
1111
|
+
if (!el) return 'ㅤ';
|
|
1112
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
1113
|
+
// style={headers?.styles?.[rowInd]?.[ind] ? headers?.styles?.[rowInd]?.[ind] : {}}
|
|
1114
|
+
className: "type-td_date ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
1115
|
+
key: _getId([tableId, el, ind], 'date')
|
|
1116
|
+
}, (_Date = new Date(el)) === null || _Date === void 0 ? void 0 : _Date.toLocaleDateString('ru-RU'));
|
|
1117
|
+
}
|
|
1118
|
+
if (currentType === 'fullDate') {
|
|
1119
|
+
var _Date2, _Date3;
|
|
1120
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
1121
|
+
// style={headers?.styles?.[rowInd]?.[ind] ? headers?.styles?.[rowInd]?.[ind] : {}}
|
|
1122
|
+
className: "type-td_date ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
1123
|
+
key: _getId([tableId, el, ind], 'date')
|
|
1124
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1125
|
+
className: "date-with-time"
|
|
1126
|
+
}, /*#__PURE__*/_react["default"].createElement("span", null, ((_Date2 = new Date(el)) === null || _Date2 === void 0 ? void 0 : _Date2.toLocaleDateString('ru-RU')) + ' ', /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement("span", {
|
|
1127
|
+
style: {
|
|
1128
|
+
color: '#9298CF'
|
|
967
1129
|
}
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
1130
|
+
}, ' ' + ((_Date3 = new Date(el)) === null || _Date3 === void 0 ? void 0 : _Date3.toLocaleTimeString('ru-RU', {
|
|
1131
|
+
hour: '2-digit',
|
|
1132
|
+
minute: '2-digit'
|
|
1133
|
+
}))))));
|
|
1134
|
+
}
|
|
1135
|
+
if (currentType === 'rating') {
|
|
1136
|
+
var _value;
|
|
1137
|
+
if (el) _value = Number(el);
|
|
1138
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
1139
|
+
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
1140
|
+
key: _getId([tableId, el, ind], 'rating')
|
|
1141
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1142
|
+
className: "type-td_rating",
|
|
1143
|
+
style: {
|
|
1144
|
+
justifyContent: 'flex-end'
|
|
976
1145
|
}
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
1146
|
+
}, el ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(Rating, {
|
|
1147
|
+
name: "rating-comp-".concat(ind + el),
|
|
1148
|
+
precision: 0.2,
|
|
1149
|
+
defaultValue: Math.floor(_value) * 0.2,
|
|
1150
|
+
max: 1,
|
|
1151
|
+
readOnly: true,
|
|
1152
|
+
emptyIcon: /*#__PURE__*/_react["default"].createElement(StarIcon, {
|
|
984
1153
|
style: {
|
|
985
|
-
|
|
1154
|
+
opacity: '.1'
|
|
986
1155
|
}
|
|
987
|
-
})
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
},
|
|
993
|
-
|
|
1156
|
+
}),
|
|
1157
|
+
icon: /*#__PURE__*/_react["default"].createElement(StarIcon, {
|
|
1158
|
+
style: {
|
|
1159
|
+
fill: '#faaf00'
|
|
1160
|
+
}
|
|
1161
|
+
}),
|
|
1162
|
+
size: "large"
|
|
1163
|
+
}), /*#__PURE__*/_react["default"].createElement("span", {
|
|
1164
|
+
style: {
|
|
1165
|
+
fontSize: '16px'
|
|
1166
|
+
}
|
|
1167
|
+
}, el)) : /*#__PURE__*/_react["default"].createElement("span", null, "-")));
|
|
1168
|
+
}
|
|
1169
|
+
if (currentType === 'checkbox') {
|
|
1170
|
+
var _id = getCheckboxId(arr);
|
|
1171
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
1172
|
+
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
1173
|
+
key: getCheckboxId([tableId].concat(_toConsumableArray(arr))),
|
|
1174
|
+
style: {
|
|
1175
|
+
textAlign: 'center',
|
|
1176
|
+
padding: 0
|
|
1177
|
+
}
|
|
1178
|
+
}, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
1179
|
+
id: _id,
|
|
1180
|
+
value: onCheckCheckboxData(arr),
|
|
1181
|
+
onChange: function onChange(e) {
|
|
1182
|
+
return onCheckboxChange(arr);
|
|
1183
|
+
}
|
|
1184
|
+
}));
|
|
1185
|
+
}
|
|
1186
|
+
if (currentType === 'booleanCheckbox') {
|
|
1187
|
+
if (!Array.isArray(el)) return 'ㅤ';
|
|
1188
|
+
var _el9 = _slicedToArray(el, 2),
|
|
1189
|
+
_value2 = _el9[0],
|
|
1190
|
+
extraValue = _el9[1];
|
|
1191
|
+
if (selectedBooleanItems[extraValue] === undefined & _value2) onCheckboxChange(arr, extraValue);
|
|
994
1192
|
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
995
1193
|
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
996
|
-
key: _getId([tableId, el, ind], '
|
|
1194
|
+
key: _getId([tableId, el, ind], 'booleanCheckbox')
|
|
1195
|
+
}, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
1196
|
+
id: getCheckboxId(arr),
|
|
1197
|
+
value: onCheckCheckboxData(arr, extraValue),
|
|
1198
|
+
onChange: function onChange(e) {
|
|
1199
|
+
if (onBooleanCheckbox) {
|
|
1200
|
+
onBooleanCheckbox(selectedBooleanItems);
|
|
1201
|
+
onCheckboxChange(arr, extraValue);
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
}));
|
|
1205
|
+
}
|
|
1206
|
+
if (currentType === 'actionBtn') {
|
|
1207
|
+
if (Array.isArray(el)) return /*#__PURE__*/_react["default"].createElement("td", {
|
|
997
1208
|
onClick: function onClick(e) {
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1209
|
+
if (onAction) {
|
|
1210
|
+
var _headers$header7;
|
|
1211
|
+
onAction(onActionInfo ? [getRowObj(arr), String(el), headers === null || headers === void 0 || (_headers$header7 = headers.header) === null || _headers$header7 === void 0 ? void 0 : _headers$header7[ind]] : getRowObj(arr));
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
}, el);
|
|
1215
|
+
if ((el === null || el === void 0 ? void 0 : el.length) > 0) {
|
|
1216
|
+
var render_element = '';
|
|
1217
|
+
if (el !== null && el !== void 0 && el.match('https')) {
|
|
1218
|
+
render_element = /*#__PURE__*/_react["default"].createElement("button", {
|
|
1219
|
+
className: "btn__action",
|
|
1220
|
+
style: {
|
|
1221
|
+
backgroundImage: "url(".concat(el, ")")
|
|
1222
|
+
}
|
|
1223
|
+
});
|
|
1224
|
+
} else {
|
|
1225
|
+
render_element = /*#__PURE__*/_react["default"].createElement("p", {
|
|
1226
|
+
// style={headers?.styles?.[rowInd]?.[ind] ? headers?.styles?.[rowInd]?.[ind] : {}}
|
|
1227
|
+
className: "text_blue"
|
|
1228
|
+
}, el);
|
|
1001
1229
|
}
|
|
1230
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
1231
|
+
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
1232
|
+
key: _getId([tableId, el, ind], 'actionBtn'),
|
|
1233
|
+
onClick: function onClick(e) {
|
|
1234
|
+
var _headers$header8;
|
|
1235
|
+
e.stopPropagation();
|
|
1236
|
+
if (onAction) onAction(onActionInfo ? [getRowObj(arr), el, headers === null || headers === void 0 || (_headers$header8 = headers.header) === null || _headers$header8 === void 0 ? void 0 : _headers$header8[ind]] : getRowObj(arr));
|
|
1237
|
+
}
|
|
1238
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1239
|
+
className: "type-td_action-btn"
|
|
1240
|
+
}, (el === null || el === void 0 ? void 0 : el.length) > 0 && render_element));
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
if (currentType === 'currency') {
|
|
1244
|
+
if (!Array.isArray(el)) return 'ㅤ';
|
|
1245
|
+
var _el10 = _slicedToArray(el, 2),
|
|
1246
|
+
_value3 = _el10[0],
|
|
1247
|
+
curr = _el10[1];
|
|
1248
|
+
var currency;
|
|
1249
|
+
if (typeof _value3 === 'number') {
|
|
1250
|
+
var _Number;
|
|
1251
|
+
_value3 = (_Number = Number(_value3)) === null || _Number === void 0 ? void 0 : _Number.toLocaleString();
|
|
1252
|
+
currency = /*#__PURE__*/_react["default"].createElement("span", {
|
|
1253
|
+
className: "val"
|
|
1254
|
+
}, /*#__PURE__*/_react["default"].createElement("span", null, curr), " ", _value3);
|
|
1255
|
+
} else {
|
|
1256
|
+
currency = /*#__PURE__*/_react["default"].createElement("span", {
|
|
1257
|
+
className: "curr"
|
|
1258
|
+
}, /*#__PURE__*/_react["default"].createElement("span", null, _value3), " ", curr);
|
|
1259
|
+
}
|
|
1260
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
1261
|
+
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
1262
|
+
key: _getId([tableId, el, ind], 'currency')
|
|
1002
1263
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1003
|
-
|
|
1004
|
-
|
|
1264
|
+
// style={headers?.styles?.[rowInd]?.[ind] ? headers?.styles?.[rowInd]?.[ind] : {}}
|
|
1265
|
+
className: "type-td_currency"
|
|
1266
|
+
}, currency));
|
|
1005
1267
|
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
}, /*#__PURE__*/_react["default"].createElement("
|
|
1268
|
+
if (currentType === 'textWithTooltip') {
|
|
1269
|
+
var _useState69 = (0, _react.useState)(false),
|
|
1270
|
+
_useState70 = _slicedToArray(_useState69, 2),
|
|
1271
|
+
tooltipVisible = _useState70[0],
|
|
1272
|
+
setTooltipVisible = _useState70[1];
|
|
1273
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
1274
|
+
key: _getId([tableId, el, ind], 'tooltip'),
|
|
1275
|
+
style: {
|
|
1276
|
+
position: 'relative'
|
|
1277
|
+
},
|
|
1278
|
+
onMouseEnter: function onMouseEnter() {
|
|
1279
|
+
return setTooltipVisible(true);
|
|
1280
|
+
},
|
|
1281
|
+
onMouseLeave: function onMouseLeave() {
|
|
1282
|
+
return setTooltipVisible(false);
|
|
1283
|
+
}
|
|
1284
|
+
}, Array.isArray(el) && el.length === 2 && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("a", {
|
|
1285
|
+
href: el[0][1],
|
|
1286
|
+
target: "_blank",
|
|
1287
|
+
style: {
|
|
1288
|
+
textDecoration: 'none',
|
|
1289
|
+
color: 'blue'
|
|
1290
|
+
}
|
|
1291
|
+
}, el[0][0]), tooltipVisible && /*#__PURE__*/_react["default"].createElement("div", {
|
|
1292
|
+
style: {
|
|
1293
|
+
visibility: tooltipVisible ? 'visible' : 'hidden',
|
|
1294
|
+
backgroundColor: '#555',
|
|
1295
|
+
color: '#fff',
|
|
1296
|
+
textAlign: 'center',
|
|
1297
|
+
borderRadius: '6px',
|
|
1298
|
+
padding: '5px 10px',
|
|
1299
|
+
position: 'absolute',
|
|
1300
|
+
transform: 'translateX(-50%)',
|
|
1301
|
+
marginLeft: '0',
|
|
1302
|
+
width: '200px',
|
|
1303
|
+
opacity: tooltipVisible ? 1 : 0,
|
|
1304
|
+
transition: 'opacity 0.3s',
|
|
1305
|
+
zIndex: '100'
|
|
1306
|
+
},
|
|
1307
|
+
className: "tooltip-text"
|
|
1308
|
+
}, el[1].map(function (tooltipItem, index) {
|
|
1309
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
1310
|
+
key: index
|
|
1311
|
+
}, tooltipItem);
|
|
1312
|
+
}))));
|
|
1313
|
+
}
|
|
1314
|
+
if (currentType === 'hidden') {
|
|
1315
|
+
return;
|
|
1316
|
+
}
|
|
1317
|
+
if (currentType === 'contextMenu') {
|
|
1318
|
+
var prefix = 'nested-table';
|
|
1319
|
+
var trGetId = _getId(arr, prefix);
|
|
1320
|
+
return /*#__PURE__*/_react["default"].createElement(TypeContext, {
|
|
1321
|
+
el: el,
|
|
1322
|
+
onContextMenu: _onContextMenu,
|
|
1323
|
+
contextMenuBtn: _contextMenu["default"],
|
|
1324
|
+
contextMenuArr: contextMenuArr,
|
|
1325
|
+
staticTD: staticTD,
|
|
1326
|
+
ind: ind,
|
|
1327
|
+
contextId: contextId,
|
|
1328
|
+
trGetId: trGetId,
|
|
1329
|
+
getId: _getId,
|
|
1330
|
+
tableId: tableId,
|
|
1331
|
+
arr: arr,
|
|
1332
|
+
showContext: showContext,
|
|
1333
|
+
lang: lang,
|
|
1334
|
+
setShowContext: setShowContext,
|
|
1335
|
+
contextArr: contextArr
|
|
1336
|
+
})
|
|
1337
|
+
// <td
|
|
1338
|
+
// key={getId([tableId, el, ind], 'contextMenu')}
|
|
1339
|
+
// data-value={el}
|
|
1340
|
+
// className={`type-td_context-menu ${staticTD && ind === 0 ? 'sticky_th' : ''
|
|
1341
|
+
// }`}
|
|
1342
|
+
// onClick={(e) => {
|
|
1343
|
+
// e.preventDefault();
|
|
1344
|
+
// e.stopPropagation();
|
|
1345
|
+
// onContextMenu(e, arr, trGetId);
|
|
1346
|
+
// }}
|
|
1347
|
+
// onContextMenu={(e) => {
|
|
1348
|
+
// e.preventDefault();
|
|
1349
|
+
// e.stopPropagation();
|
|
1350
|
+
// onContextMenu(e, arr, trGetId);
|
|
1351
|
+
// }}
|
|
1352
|
+
// >
|
|
1353
|
+
// <div
|
|
1354
|
+
// style={{
|
|
1355
|
+
// display: 'flex',
|
|
1356
|
+
// justifyContent: 'center',
|
|
1357
|
+
// alignItems: 'center',
|
|
1358
|
+
// position: 'relative',
|
|
1359
|
+
// }}
|
|
1360
|
+
// >
|
|
1361
|
+
// <img
|
|
1362
|
+
// src={contextMenuBtn}
|
|
1363
|
+
// alt="context menu button"
|
|
1364
|
+
// style={{
|
|
1365
|
+
// objectFit: 'contain',
|
|
1366
|
+
// width: '1.75em',
|
|
1367
|
+
// height: '1.75em',
|
|
1368
|
+
// }}
|
|
1369
|
+
// />
|
|
1370
|
+
// {contextId === trGetId ? (
|
|
1371
|
+
// <div
|
|
1372
|
+
// className="drop-context-menu"
|
|
1373
|
+
// style={{ display: showContext ? 'flex' : 'none' }}
|
|
1374
|
+
// >
|
|
1375
|
+
// {contextMenuArr?.map((el) => {
|
|
1376
|
+
// const { label, onClick, type } = el;
|
|
1377
|
+
// return (
|
|
1378
|
+
// <button
|
|
1379
|
+
// className={`drop-context-menu__btn ${type === 'delete' ? 'btn-delete' : ''
|
|
1380
|
+
// }`}
|
|
1381
|
+
// onClick={(e) => {
|
|
1382
|
+
// e.preventDefault();
|
|
1383
|
+
// e.stopPropagation();
|
|
1384
|
+
// setShowContext(false);
|
|
1385
|
+
// onClick(contextArr, label);
|
|
1386
|
+
// }}
|
|
1387
|
+
// >
|
|
1388
|
+
// {lang == 'eng' ? translateContext(label) : label}
|
|
1389
|
+
// </button>
|
|
1390
|
+
// );
|
|
1391
|
+
// })}
|
|
1392
|
+
// </div>
|
|
1393
|
+
// ) : null}
|
|
1394
|
+
// </div>
|
|
1395
|
+
// </td>
|
|
1396
|
+
;
|
|
1023
1397
|
}
|
|
1024
|
-
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
1025
|
-
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
1026
|
-
key: _getId([tableId, el, ind], 'currency')
|
|
1027
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1028
|
-
// style={headers?.styles?.[rowInd]?.[ind] ? headers?.styles?.[rowInd]?.[ind] : {}}
|
|
1029
|
-
className: "type-td_currency"
|
|
1030
|
-
}, currency));
|
|
1031
|
-
}
|
|
1032
|
-
if (currentType === 'hidden') {
|
|
1033
|
-
return;
|
|
1034
1398
|
}
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1399
|
+
try {
|
|
1400
|
+
if (!Array.isArray(el)) {
|
|
1401
|
+
throw new Error('wrong type');
|
|
1402
|
+
}
|
|
1038
1403
|
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
className: "type-td_context-menu ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
1042
|
-
onClick: function onClick(e) {
|
|
1043
|
-
e.preventDefault();
|
|
1044
|
-
e.stopPropagation();
|
|
1045
|
-
_onContextMenu(e, arr, trGetId);
|
|
1046
|
-
},
|
|
1047
|
-
onContextMenu: function onContextMenu(e) {
|
|
1048
|
-
e.preventDefault();
|
|
1049
|
-
e.stopPropagation();
|
|
1050
|
-
_onContextMenu(e, arr, trGetId);
|
|
1051
|
-
}
|
|
1052
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1053
|
-
style: {
|
|
1054
|
-
display: 'flex',
|
|
1055
|
-
justifyContent: 'center',
|
|
1056
|
-
alignItems: 'center',
|
|
1057
|
-
position: 'relative'
|
|
1058
|
-
}
|
|
1059
|
-
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
1060
|
-
src: _contextMenu["default"],
|
|
1061
|
-
alt: "context menu button",
|
|
1404
|
+
className: "type-td_text ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
1405
|
+
key: _getId([tableId, el, ind], 'td'),
|
|
1062
1406
|
style: {
|
|
1063
|
-
|
|
1064
|
-
width: '
|
|
1065
|
-
height: '1.75em'
|
|
1407
|
+
textAlign: 'left',
|
|
1408
|
+
width: currentWidth ? currentWidth : ''
|
|
1066
1409
|
}
|
|
1067
|
-
}
|
|
1068
|
-
className: "
|
|
1410
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
1411
|
+
className: "text"
|
|
1412
|
+
// style={headers?.styles?.[rowInd]?.[ind] ? headers?.styles?.[rowInd]?.[ind] : {}}
|
|
1413
|
+
}, Array.isArray(el) ? el.join(', ') : _typeof(el) !== 'object' ? el : el));
|
|
1414
|
+
} catch (error) {
|
|
1415
|
+
// console.error(error);
|
|
1416
|
+
if (!Array.isArray(el)) {
|
|
1417
|
+
// console.log(el);
|
|
1418
|
+
}
|
|
1419
|
+
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
1420
|
+
className: "type-td_text ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
1421
|
+
key: _getId([tableId, el, ind], 'td'),
|
|
1069
1422
|
style: {
|
|
1070
|
-
|
|
1423
|
+
textAlign: 'left',
|
|
1424
|
+
width: currentWidth ? currentWidth : ''
|
|
1071
1425
|
}
|
|
1072
|
-
},
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
return /*#__PURE__*/_react["default"].createElement("button", {
|
|
1077
|
-
className: "drop-context-menu__btn ".concat(type === 'delete' ? 'btn-delete' : ''),
|
|
1078
|
-
onClick: function onClick(e) {
|
|
1079
|
-
e.preventDefault();
|
|
1080
|
-
e.stopPropagation();
|
|
1081
|
-
setShowContext(false);
|
|
1082
|
-
_onClick(contextArr, label);
|
|
1083
|
-
}
|
|
1084
|
-
}, translateContext(label));
|
|
1085
|
-
})) : null));
|
|
1086
|
-
}
|
|
1087
|
-
}
|
|
1088
|
-
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
1089
|
-
className: "type-td_text ".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
1090
|
-
key: _getId([tableId, el, ind], 'td'),
|
|
1091
|
-
style: {
|
|
1092
|
-
textAlign: 'left',
|
|
1093
|
-
width: currentWidth ? currentWidth : ''
|
|
1426
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
1427
|
+
className: "text"
|
|
1428
|
+
// style={headers?.styles?.[rowInd]?.[ind] ? headers?.styles?.[rowInd]?.[ind] : {}}
|
|
1429
|
+
}, Array.isArray(el) ? el.join(', ') : _typeof(el) === 'object' ? el : el));
|
|
1094
1430
|
}
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
});
|
|
1431
|
+
});
|
|
1432
|
+
} catch (error) {
|
|
1433
|
+
console.error(error);
|
|
1434
|
+
}
|
|
1100
1435
|
return tdList;
|
|
1101
1436
|
};
|
|
1102
1437
|
|
|
1103
|
-
// Nested table request template
|
|
1104
|
-
var fetchDataInsideFunc = function fetchDataInsideFunc(params) {
|
|
1105
|
-
// let sort;
|
|
1106
|
-
// let filtersParam;
|
|
1107
|
-
|
|
1108
|
-
// if (params) {
|
|
1109
|
-
// [sort, filtersParam] = params
|
|
1110
|
-
// }
|
|
1111
|
-
// setLoadingInside(true)
|
|
1112
|
-
|
|
1113
|
-
// let url
|
|
1114
|
-
// if (!window.location.hostname.match('localhost')) {
|
|
1115
|
-
// url = `${OlegHttps}/api/v1/account/all_account${sort?.length > 0 ? '?order_param=' + sort[0] + '&order_param_direction=' + sort[1] : ''}`
|
|
1116
|
-
// } else {
|
|
1117
|
-
// url = `${OlegHttp}/api/v1/account/all_account${sort?.length > 0 ? '?order_param=' + sort[0] + '&order_param_direction=' + sort[1] : ''}`
|
|
1118
|
-
// }
|
|
1119
|
-
|
|
1120
|
-
// const body = JSON.stringify({
|
|
1121
|
-
// page: 1,
|
|
1122
|
-
// limit: 25,
|
|
1123
|
-
// filters: filtersParam
|
|
1124
|
-
// })
|
|
1125
|
-
|
|
1126
|
-
// fetch(url, { body, method: 'POST', headers })
|
|
1127
|
-
// .then(res => res.json())
|
|
1128
|
-
// .then(json => {
|
|
1129
|
-
// const { data, labels, total, sort } = json
|
|
1130
|
-
// if (sort) setSortInside(sort)
|
|
1131
|
-
// if (labels) setHeadersInside(labels)
|
|
1132
|
-
// setFetchedDataInside(data.length > 0 ? data : [[]])
|
|
1133
|
-
// setLoadingInside(false)
|
|
1134
|
-
// })
|
|
1135
|
-
// .catch(err => {
|
|
1136
|
-
// setLoadingInside(false)
|
|
1137
|
-
// console.error(err)
|
|
1138
|
-
// })
|
|
1139
|
-
};
|
|
1140
|
-
|
|
1141
1438
|
// Table body row logic
|
|
1142
|
-
var bodyRowsList
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1439
|
+
var bodyRowsList;
|
|
1440
|
+
try {
|
|
1441
|
+
bodyRowsList = _toConsumableArray(fetchedData === null || fetchedData === void 0 ? void 0 : fetchedData.map(function (arr, ind) {
|
|
1442
|
+
if (Array !== null && Array !== void 0 && Array.isArray(arr)) {
|
|
1443
|
+
var prefix = 'nested-table';
|
|
1444
|
+
var tdList = typesTd(arr, ind);
|
|
1445
|
+
var trGetId = _getId(arr, prefix);
|
|
1147
1446
|
|
|
1148
|
-
|
|
1447
|
+
// buttonTd(tdList, arr)
|
|
1149
1448
|
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
}
|
|
1162
|
-
if (isInsideTable) {
|
|
1163
|
-
fetchDataInsideFunc();
|
|
1164
|
-
if (ind === indTr) {
|
|
1165
|
-
setIndTr(null);
|
|
1166
|
-
} else {
|
|
1167
|
-
setIndTr(trGetId);
|
|
1449
|
+
return indTr !== trGetId ? /*#__PURE__*/_react["default"].createElement("tr", {
|
|
1450
|
+
key: _getId([tableId].concat(_toConsumableArray(arr), [ind]), 'tr'),
|
|
1451
|
+
style: {
|
|
1452
|
+
backgroundColor: nestedTable ? 'rgb(70, 231, 240, 0.1)' : '',
|
|
1453
|
+
cursor: 'pointer'
|
|
1454
|
+
},
|
|
1455
|
+
onClick: function onClick(e) {
|
|
1456
|
+
var productId = arr === null || arr === void 0 ? void 0 : arr[hiddenHeaders === null || hiddenHeaders === void 0 ? void 0 : hiddenHeaders[ind]];
|
|
1457
|
+
setShowContext(false);
|
|
1458
|
+
if (setState) {
|
|
1459
|
+
setState(productId);
|
|
1168
1460
|
}
|
|
1461
|
+
if (isInsideTable) {
|
|
1462
|
+
if (ind === indTr) {
|
|
1463
|
+
setIndTr(null);
|
|
1464
|
+
} else {
|
|
1465
|
+
if (arr) {
|
|
1466
|
+
var _getRowObj;
|
|
1467
|
+
setInsideBody((_getRowObj = getRowObj(arr)) === null || _getRowObj === void 0 ? void 0 : _getRowObj.nestedTable);
|
|
1468
|
+
}
|
|
1469
|
+
setIndTr(trGetId);
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
},
|
|
1473
|
+
onContextMenu: function onContextMenu(e) {
|
|
1474
|
+
e.preventDefault();
|
|
1475
|
+
_onContextMenu(e, arr, trGetId, true);
|
|
1169
1476
|
}
|
|
1170
|
-
},
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
var productId = arr[hiddenHeaders[ind]];
|
|
1184
|
-
if (setState) {
|
|
1185
|
-
setState(productId);
|
|
1477
|
+
}, tdList) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("tr", {
|
|
1478
|
+
id: ind + tableId,
|
|
1479
|
+
key: _getId([tableId].concat(_toConsumableArray(arr), [ind]), 'tr'),
|
|
1480
|
+
style: {
|
|
1481
|
+
backgroundColor: 'rgb(70, 231, 240, 0.1)',
|
|
1482
|
+
outline: '3px solid rgb(70, 231, 240, 0.4)'
|
|
1483
|
+
},
|
|
1484
|
+
onClick: function onClick(e) {
|
|
1485
|
+
var productId = arr[hiddenHeaders[ind]];
|
|
1486
|
+
if (setState) {
|
|
1487
|
+
setState(productId);
|
|
1488
|
+
}
|
|
1489
|
+
setIndTr(null);
|
|
1186
1490
|
}
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
sortingFunc: function sortingFunc(e) {
|
|
1197
|
-
return fetchDataInsideFunc(e);
|
|
1198
|
-
},
|
|
1199
|
-
nestedTable: true,
|
|
1200
|
-
paginatorDependepcies: []
|
|
1201
|
-
}));
|
|
1202
|
-
}
|
|
1203
|
-
}));
|
|
1491
|
+
}, tdList), /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement(InsideTableContainer, {
|
|
1492
|
+
_url: headers === null || headers === void 0 ? void 0 : headers.next_table_url,
|
|
1493
|
+
body: insideBody
|
|
1494
|
+
})));
|
|
1495
|
+
}
|
|
1496
|
+
}));
|
|
1497
|
+
} catch (error) {
|
|
1498
|
+
console.error(error);
|
|
1499
|
+
}
|
|
1204
1500
|
|
|
1205
1501
|
// Table header row logic
|
|
1206
|
-
var headerRowList
|
|
1207
|
-
|
|
1208
|
-
var
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1502
|
+
var headerRowList;
|
|
1503
|
+
try {
|
|
1504
|
+
var _headers$header9;
|
|
1505
|
+
headerRowList = headers === null || headers === void 0 || (_headers$header9 = headers.header) === null || _headers$header9 === void 0 ? void 0 : _headers$header9.map(function (el, ind) {
|
|
1506
|
+
var classPostfix = activeSortColumn.current === el ? " ".concat(sortDirection) : '';
|
|
1507
|
+
var currentWidth = (columnSize === null || columnSize === void 0 ? void 0 : columnSize.length) > 0 ? columnSize[ind] : DEFAULT_COL_WIDTH_PX;
|
|
1508
|
+
if (hiddenHeaders !== null && hiddenHeaders !== void 0 && hiddenHeaders.includes(ind)) return null;
|
|
1509
|
+
if ((typeIndexArr === null || typeIndexArr === void 0 ? void 0 : typeIndexArr[ind]) === 'image') {
|
|
1510
|
+
try {
|
|
1511
|
+
return /*#__PURE__*/_react["default"].createElement("th", {
|
|
1512
|
+
key: _getId([tableId, el, ind], 'th'),
|
|
1513
|
+
style: {
|
|
1514
|
+
padding: '9px 12px',
|
|
1515
|
+
zIndex: staticTD && ind == 0 ? 3 : ''
|
|
1516
|
+
},
|
|
1517
|
+
className: "col col".concat(ind + classPostfix, " \n ").concat(staticTD && ind == 0 ? 'sticky_th' : '')
|
|
1518
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1519
|
+
className: "text-and-icon"
|
|
1520
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
1521
|
+
className: "td-text-table"
|
|
1522
|
+
}, el)), tooltips && tooltips[ind] ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
1523
|
+
className: "tooltip_black"
|
|
1524
|
+
}, tooltips[ind]) : null);
|
|
1525
|
+
} catch (error) {
|
|
1526
|
+
console.error(error);
|
|
1527
|
+
/*#__PURE__*/_react["default"].createElement("th", {
|
|
1528
|
+
key: _getId([tableId, el, ind], 'th'),
|
|
1529
|
+
style: {
|
|
1530
|
+
padding: '9px 12px',
|
|
1531
|
+
zIndex: staticTD && ind == 0 ? 3 : ''
|
|
1532
|
+
},
|
|
1533
|
+
className: "col col".concat(ind + classPostfix, " \n ").concat(staticTD && ind == 0 ? 'sticky_th' : '')
|
|
1534
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1535
|
+
className: "text-and-icon"
|
|
1536
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
1537
|
+
className: "td-text-table"
|
|
1538
|
+
}, "'-'")));
|
|
1234
1539
|
}
|
|
1235
|
-
}
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
if (checkedAll) {
|
|
1246
|
-
_onUncheckAll();
|
|
1247
|
-
} else {
|
|
1248
|
-
onCheckAll();
|
|
1540
|
+
}
|
|
1541
|
+
if (typeIndexArr[ind] === 'contextMenu') {
|
|
1542
|
+
return /*#__PURE__*/_react["default"].createElement("th", {
|
|
1543
|
+
className: "".concat(staticTD && ind === 0 ? 'sticky_th' : ''),
|
|
1544
|
+
key: _getId([tableId, el, ind], 'contextMenu th')
|
|
1545
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1546
|
+
className: "col-th-border col-th-border_context",
|
|
1547
|
+
style: {
|
|
1548
|
+
resize: 'none',
|
|
1549
|
+
borderRight: staticTD && ind == 0 ? 'none' : ''
|
|
1249
1550
|
}
|
|
1250
|
-
}
|
|
1251
|
-
}));
|
|
1252
|
-
}
|
|
1253
|
-
return /*#__PURE__*/_react["default"].createElement("th", {
|
|
1254
|
-
key: _getId([tableId, el, ind], 'th'),
|
|
1255
|
-
className: "col col".concat(ind + classPostfix, " ").concat(staticTD && ind == 0 ? 'sticky_th' : '')
|
|
1256
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1257
|
-
className: "col-th-border",
|
|
1258
|
-
style: {
|
|
1259
|
-
borderRight: staticTD && ind == 0 ? 'none' : '',
|
|
1260
|
-
resize: 'horizontal',
|
|
1261
|
-
overflow: 'hidden',
|
|
1262
|
-
width: currentWidth
|
|
1551
|
+
}));
|
|
1263
1552
|
}
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1553
|
+
if (typeIndexArr[ind] === 'checkbox') {
|
|
1554
|
+
try {
|
|
1555
|
+
return /*#__PURE__*/_react["default"].createElement("th", {
|
|
1556
|
+
key: "check-".concat(tableId),
|
|
1557
|
+
style: {
|
|
1558
|
+
zIndex: staticTD && ind == 0 ? 3 : ''
|
|
1559
|
+
},
|
|
1560
|
+
className: "th-check col".concat(ind, " ").concat(staticTD && ind === 0 ? 'sticky_th' : '')
|
|
1561
|
+
}, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
1562
|
+
id: getCheckboxId(fetchedData),
|
|
1563
|
+
value: checkedAll,
|
|
1564
|
+
onChange: function onChange(e) {
|
|
1565
|
+
if (checkedAll) {
|
|
1566
|
+
_onUncheckAll();
|
|
1567
|
+
} else {
|
|
1568
|
+
onCheckAll();
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
}));
|
|
1572
|
+
} catch (error) {
|
|
1573
|
+
return /*#__PURE__*/_react["default"].createElement("th", {
|
|
1574
|
+
key: "check-".concat(tableId),
|
|
1575
|
+
style: {
|
|
1576
|
+
zIndex: staticTD && ind == 0 ? 3 : ''
|
|
1577
|
+
},
|
|
1578
|
+
className: "th-check col".concat(ind, " ").concat(staticTD && ind === 0 ? 'sticky_th' : '')
|
|
1579
|
+
}, "-");
|
|
1580
|
+
}
|
|
1268
1581
|
}
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1582
|
+
try {
|
|
1583
|
+
return /*#__PURE__*/_react["default"].createElement("th", {
|
|
1584
|
+
key: _getId([tableId, el, ind], 'th'),
|
|
1585
|
+
style: {
|
|
1586
|
+
zIndex: staticTD && ind == 0 ? 3 : ''
|
|
1587
|
+
},
|
|
1588
|
+
className: "col col".concat(ind + classPostfix, " ").concat(staticTD && ind == 0 ? 'sticky_th' : '')
|
|
1589
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1590
|
+
className: "col-th-border",
|
|
1591
|
+
style: {
|
|
1592
|
+
borderRight: staticTD && ind == 0 ? 'none' : '',
|
|
1593
|
+
resize: 'horizontal',
|
|
1594
|
+
overflow: 'hidden',
|
|
1595
|
+
width: currentWidth
|
|
1596
|
+
}
|
|
1597
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1598
|
+
className: "text-and-icon",
|
|
1599
|
+
onClick: function onClick() {
|
|
1600
|
+
return columnSort(el);
|
|
1601
|
+
}
|
|
1602
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
1603
|
+
className: "td-text-table"
|
|
1604
|
+
}, el !== null && el !== void 0 && el.includes('http') ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
1279
1605
|
className: "header-img",
|
|
1280
|
-
src:
|
|
1281
|
-
})
|
|
1282
|
-
|
|
1283
|
-
|
|
1606
|
+
src: el
|
|
1607
|
+
}) : !Array.isArray(el) ? el : null, (el === null || el === void 0 ? void 0 : el.length) > 10 & !(el !== null && el !== void 0 && el.includes('http')) & !Array.isArray(el) ? /*#__PURE__*/_react["default"].createElement("span", {
|
|
1608
|
+
className: "popup-th"
|
|
1609
|
+
}, el) : null, Array.isArray(el) ? el === null || el === void 0 ? void 0 : el.map(function (item) {
|
|
1610
|
+
if (el !== null && el !== void 0 && el.includes('http')) {
|
|
1611
|
+
return /*#__PURE__*/_react["default"].createElement("img", {
|
|
1612
|
+
className: "header-img",
|
|
1613
|
+
src: item
|
|
1614
|
+
});
|
|
1615
|
+
} else {
|
|
1616
|
+
return /*#__PURE__*/_react["default"].createElement("p", null, item);
|
|
1617
|
+
}
|
|
1618
|
+
}) : null), !hideSorting && /*#__PURE__*/_react["default"].createElement("img", {
|
|
1619
|
+
style: {
|
|
1620
|
+
width: '13px',
|
|
1621
|
+
height: '13px'
|
|
1622
|
+
},
|
|
1623
|
+
src: (sortDirection === null || sortDirection === void 0 ? void 0 : sortDirection.length) > 1 && sortDirection[0] === (el === null || el === void 0 ? void 0 : el.replace(/\n/g, '')) & typeof sortDirection[1] === 'string' ? (sortDirection === null || sortDirection === void 0 ? void 0 : sortDirection.length) > 1 && sortDirection[1] === SORT_DIRECTIONS.ascending ? _sort_arrow_up["default"] : _sort_arrow_down["default"] : _sort_table["default"]
|
|
1624
|
+
}))), tooltips && tooltips[ind] ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
1625
|
+
className: "tooltip_black"
|
|
1626
|
+
}, tooltips[ind]) : null);
|
|
1627
|
+
} catch (error) {
|
|
1628
|
+
console.error(error);
|
|
1629
|
+
return 'Что-то пошло не так';
|
|
1284
1630
|
}
|
|
1285
|
-
})
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
},
|
|
1290
|
-
src: (sortDirection === null || sortDirection === void 0 ? void 0 : sortDirection.length) > 1 && sortDirection[0] === el & typeof sortDirection[1] === 'string' ? (sortDirection === null || sortDirection === void 0 ? void 0 : sortDirection.length) > 1 && sortDirection[1] === SORT_DIRECTIONS.ascending ? _sort_arrow_up["default"] : _sort_arrow_down["default"] : _sort_table["default"]
|
|
1291
|
-
}))), tooltips && tooltips[ind] ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
1292
|
-
className: "tooltip_black"
|
|
1293
|
-
}, tooltips[ind]) : null);
|
|
1294
|
-
});
|
|
1631
|
+
});
|
|
1632
|
+
} catch (error) {
|
|
1633
|
+
console.error(error);
|
|
1634
|
+
}
|
|
1295
1635
|
|
|
1296
1636
|
// Formatting table headers and column filters logic
|
|
1297
|
-
var tableHeaders
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1637
|
+
var tableHeaders;
|
|
1638
|
+
try {
|
|
1639
|
+
tableHeaders = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("tr", {
|
|
1640
|
+
className: "tr-col-headers"
|
|
1641
|
+
}, headerRowList), !hideFilters && /*#__PURE__*/_react["default"].createElement("tr", {
|
|
1642
|
+
className: "tr-col-filters"
|
|
1643
|
+
}, /*#__PURE__*/_react["default"].createElement(_RenderFiltersTh.RenderFiltersTh, {
|
|
1644
|
+
onUncheckAll: function onUncheckAll(e) {
|
|
1645
|
+
return _onUncheckAll(e);
|
|
1646
|
+
},
|
|
1647
|
+
setCheckedAll: function setCheckedAll(e) {
|
|
1648
|
+
return _setCheckedAll(e);
|
|
1649
|
+
},
|
|
1650
|
+
lang: lang,
|
|
1651
|
+
staticTD: staticTD,
|
|
1652
|
+
fetchedData: fetchedData,
|
|
1653
|
+
onCheck: onCheck,
|
|
1654
|
+
activeItem: activeItem,
|
|
1655
|
+
headers: selectedHeaders !== null && selectedHeaders !== void 0 && selectedHeaders.type ? selectedHeaders : headers,
|
|
1656
|
+
showOption: showOption,
|
|
1657
|
+
setShowOption: function setShowOption(e) {
|
|
1658
|
+
return _setShowOption(e);
|
|
1659
|
+
},
|
|
1660
|
+
filters: filters,
|
|
1661
|
+
filterTypes: headers === null || headers === void 0 ? void 0 : headers.filterTypes,
|
|
1662
|
+
filterList: headers === null || headers === void 0 ? void 0 : headers.filterList,
|
|
1663
|
+
setFilters: function setFilters(e) {
|
|
1664
|
+
return _setFilters(e);
|
|
1665
|
+
},
|
|
1666
|
+
sort: sort,
|
|
1667
|
+
setFiltersTable: function setFiltersTable(e) {
|
|
1668
|
+
return _setFiltersTable(e);
|
|
1669
|
+
},
|
|
1670
|
+
sortingFunc: function sortingFunc(e) {
|
|
1671
|
+
return _sortingFunc(e);
|
|
1672
|
+
},
|
|
1673
|
+
sortParam: sortParam,
|
|
1674
|
+
setActiveItem: function setActiveItem(e) {
|
|
1675
|
+
return _setActiveItem(e);
|
|
1676
|
+
},
|
|
1677
|
+
filtersTable: filtersTable,
|
|
1678
|
+
params: params,
|
|
1679
|
+
setParams: function setParams(e) {
|
|
1680
|
+
return _setParams(e);
|
|
1681
|
+
},
|
|
1682
|
+
fileFilters: fileFilters,
|
|
1683
|
+
setFileFilters: function setFileFilters(e) {
|
|
1684
|
+
return _setFileFilters(e);
|
|
1685
|
+
},
|
|
1686
|
+
showAllImages: showAllImages,
|
|
1687
|
+
setShowAllImages: function setShowAllImages(e) {
|
|
1688
|
+
return _setShowAllImages(e);
|
|
1689
|
+
}
|
|
1690
|
+
})));
|
|
1691
|
+
} catch (error) {
|
|
1692
|
+
console.error(error);
|
|
1693
|
+
tableHeaders = 'Что-то пошло не так';
|
|
1694
|
+
}
|
|
1349
1695
|
|
|
1350
|
-
// onScroll handler
|
|
1696
|
+
// onScroll handler
|
|
1351
1697
|
var scroll = function scroll() {
|
|
1352
|
-
var _refBody$current;
|
|
1698
|
+
var _refHeader$current, _refBody$current;
|
|
1353
1699
|
scrollBottom();
|
|
1700
|
+
var height_panel = refHeader === null || refHeader === void 0 || (_refHeader$current = refHeader.current) === null || _refHeader$current === void 0 || (_refHeader$current = _refHeader$current.getBoundingClientRect()) === null || _refHeader$current === void 0 ? void 0 : _refHeader$current.height;
|
|
1354
1701
|
var tbody = refBody === null || refBody === void 0 || (_refBody$current = refBody.current) === null || _refBody$current === void 0 ? void 0 : _refBody$current.getBoundingClientRect();
|
|
1355
1702
|
var thead = refThead === null || refThead === void 0 ? void 0 : refThead.current;
|
|
1356
1703
|
var top = tbody === null || tbody === void 0 ? void 0 : tbody.top;
|
|
1357
1704
|
var height = thead === null || thead === void 0 ? void 0 : thead.getBoundingClientRect().height;
|
|
1358
|
-
if (top <= height) {
|
|
1359
|
-
setRowCount(-top +
|
|
1705
|
+
if (top <= height + height_panel) {
|
|
1706
|
+
setRowCount(height - top + height_panel);
|
|
1360
1707
|
} else {
|
|
1361
1708
|
setRowCount(0);
|
|
1362
1709
|
}
|
|
@@ -1369,7 +1716,7 @@ var _Table = function Table(_ref) {
|
|
|
1369
1716
|
|
|
1370
1717
|
// Attach the scroll listener to the div
|
|
1371
1718
|
(0, _react.useEffect)(function () {
|
|
1372
|
-
window.addEventListener(
|
|
1719
|
+
window.addEventListener('scroll', scroll);
|
|
1373
1720
|
return function () {
|
|
1374
1721
|
return window.removeEventListener('scroll', scroll);
|
|
1375
1722
|
};
|
|
@@ -1388,76 +1735,84 @@ var _Table = function Table(_ref) {
|
|
|
1388
1735
|
|
|
1389
1736
|
// Обработчик на клик вне элемента,для закрытия блока с options
|
|
1390
1737
|
(0, _react.useEffect)(function () {
|
|
1391
|
-
|
|
1392
|
-
var
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1738
|
+
var showFilterOptions = function showFilterOptions(e) {
|
|
1739
|
+
var el = e.target;
|
|
1740
|
+
if (!el.closest('.filter-btn-box') && !el.closest('.date-box-filter-table')) {
|
|
1741
|
+
_setActiveItem(null);
|
|
1742
|
+
_setShowOption(false);
|
|
1743
|
+
}
|
|
1744
|
+
};
|
|
1745
|
+
document.addEventListener('click', showFilterOptions);
|
|
1746
|
+
return function () {
|
|
1399
1747
|
document.addEventListener('click', showFilterOptions);
|
|
1400
|
-
|
|
1401
|
-
document.addEventListener('click', showFilterOptions);
|
|
1402
|
-
};
|
|
1403
|
-
}
|
|
1748
|
+
};
|
|
1404
1749
|
}, []);
|
|
1405
1750
|
|
|
1406
1751
|
// Horizontal scroll resize handler
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
// }, [refTable]);
|
|
1752
|
+
var observer = new ResizeObserver(function (entries) {
|
|
1753
|
+
var width = entries[0].contentRect.width;
|
|
1754
|
+
setWidthTable(width);
|
|
1755
|
+
});
|
|
1756
|
+
(0, _react.useEffect)(function () {
|
|
1757
|
+
if (refTable !== null && refTable !== void 0 && refTable.current) {
|
|
1758
|
+
observer.observe(refTable === null || refTable === void 0 ? void 0 : refTable.current);
|
|
1759
|
+
}
|
|
1760
|
+
}, [refTable, observer]);
|
|
1417
1761
|
|
|
1418
1762
|
// Horizontal onScroll handler
|
|
1419
1763
|
var scrollBottom = function scrollBottom() {
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
var _scrollWidth = paginatorBoxRef === null || paginatorBoxRef === void 0 || (_paginatorBoxRef$curr4 = paginatorBoxRef.current) === null || _paginatorBoxRef$curr4 === void 0 ? void 0 : _paginatorBoxRef$curr4.scrollWidth;
|
|
1764
|
+
var _paginatorBoxRef$curr, _paginatorBoxRef$curr2, _paginatorBoxRef$curr3, _paginatorBoxRef$curr4, _refTable$current, _refContainer$current;
|
|
1765
|
+
positionScroll();
|
|
1766
|
+
var top = paginatorBoxRef === null || paginatorBoxRef === void 0 || (_paginatorBoxRef$curr = paginatorBoxRef.current) === null || _paginatorBoxRef$curr === void 0 ? void 0 : _paginatorBoxRef$curr.getBoundingClientRect().top;
|
|
1767
|
+
var left = paginatorBoxRef === null || paginatorBoxRef === void 0 || (_paginatorBoxRef$curr2 = paginatorBoxRef.current) === null || _paginatorBoxRef$curr2 === void 0 ? void 0 : _paginatorBoxRef$curr2.getBoundingClientRect().left;
|
|
1768
|
+
var width = paginatorBoxRef === null || paginatorBoxRef === void 0 || (_paginatorBoxRef$curr3 = paginatorBoxRef.current) === null || _paginatorBoxRef$curr3 === void 0 ? void 0 : _paginatorBoxRef$curr3.getBoundingClientRect().width;
|
|
1769
|
+
var scrollWidth = paginatorBoxRef === null || paginatorBoxRef === void 0 || (_paginatorBoxRef$curr4 = paginatorBoxRef.current) === null || _paginatorBoxRef$curr4 === void 0 ? void 0 : _paginatorBoxRef$curr4.scrollWidth;
|
|
1427
1770
|
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1771
|
+
// Ширина таблицы
|
|
1772
|
+
var widthTable = refTable === null || refTable === void 0 || (_refTable$current = refTable.current) === null || _refTable$current === void 0 ? void 0 : _refTable$current.getBoundingClientRect().width;
|
|
1773
|
+
setWidthTable(widthTable);
|
|
1774
|
+
setLeftPosition(left); //left
|
|
1775
|
+
setWidtContainer(width); //right
|
|
1776
|
+
setScrollWidth(scrollWidth); //width
|
|
1434
1777
|
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1778
|
+
// Видимость скроллбара
|
|
1779
|
+
var heightDocument = document.documentElement.clientHeight;
|
|
1780
|
+
setBottom(refContainer === null || refContainer === void 0 || (_refContainer$current = refContainer.current) === null || _refContainer$current === void 0 ? void 0 : _refContainer$current.getBoundingClientRect().bottom);
|
|
1781
|
+
if (heightDocument) {
|
|
1782
|
+
var _refContainer$current2;
|
|
1783
|
+
var pointBottom = (refContainer === null || refContainer === void 0 || (_refContainer$current2 = refContainer.current) === null || _refContainer$current2 === void 0 ? void 0 : _refContainer$current2.getBoundingClientRect().bottom) > document.documentElement.clientHeight;
|
|
1784
|
+
var pointTop = (refContainer === null || refContainer === void 0 ? void 0 : refContainer.top) > 0;
|
|
1785
|
+
setIsFixed(pointBottom || pointTop ? true : false);
|
|
1786
|
+
}
|
|
1444
1787
|
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
}
|
|
1788
|
+
//верхняя точка скроллбара
|
|
1789
|
+
if (heightDocument) {
|
|
1790
|
+
var _refContainer$current3;
|
|
1791
|
+
var _pointTop = (refContainer === null || refContainer === void 0 || (_refContainer$current3 = refContainer.current) === null || _refContainer$current3 === void 0 ? void 0 : _refContainer$current3.getBoundingClientRect().top) > document.documentElement.clientHeight;
|
|
1792
|
+
setIsVisible(_pointTop ? false : true);
|
|
1451
1793
|
}
|
|
1452
1794
|
};
|
|
1795
|
+
var _useState71 = (0, _react.useState)(false),
|
|
1796
|
+
_useState72 = _slicedToArray(_useState71, 2),
|
|
1797
|
+
initialScroll = _useState72[0],
|
|
1798
|
+
setInitialScroll = _useState72[1];
|
|
1453
1799
|
|
|
1454
1800
|
// Синхронизируем скролл
|
|
1455
1801
|
var positionScroll = function positionScroll() {
|
|
1456
1802
|
if (paginatorBoxRef !== null && paginatorBoxRef !== void 0 && paginatorBoxRef.current && refDiv !== null && refDiv !== void 0 && refDiv.current) {
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1803
|
+
if (!initialScroll) {
|
|
1804
|
+
var _refTable$current2;
|
|
1805
|
+
paginatorBoxRef.current.scrollLeft = refDiv.current.scrollLeft;
|
|
1806
|
+
var _widthTable = (_refTable$current2 = refTable.current) === null || _refTable$current2 === void 0 ? void 0 : _refTable$current2.getBoundingClientRect().width;
|
|
1807
|
+
setWidthTable(_widthTable);
|
|
1808
|
+
} else {
|
|
1809
|
+
var savedScrollPosition = sessionStorage.getItem('scrollPosition');
|
|
1810
|
+
console.log('save save save', savedScrollPosition);
|
|
1811
|
+
if (savedScrollPosition) {
|
|
1812
|
+
refDiv.current.scrollLeft = savedScrollPosition;
|
|
1813
|
+
setInitialScroll(false);
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1461
1816
|
}
|
|
1462
1817
|
};
|
|
1463
1818
|
|
|
@@ -1468,16 +1823,27 @@ var _Table = function Table(_ref) {
|
|
|
1468
1823
|
refDiv.current.scrollLeft = paginatorBoxRef.current.scrollLeft;
|
|
1469
1824
|
}
|
|
1470
1825
|
};
|
|
1826
|
+
|
|
1827
|
+
// сброс чекбоксов
|
|
1828
|
+
(0, _react.useEffect)(function () {
|
|
1829
|
+
if (onUncheckAllDependence && onCheck) {
|
|
1830
|
+
_onUncheckAll();
|
|
1831
|
+
}
|
|
1832
|
+
}, onUncheckAllDependence);
|
|
1471
1833
|
(0, _react.useEffect)(function () {
|
|
1472
1834
|
var _paginatorBoxRef$curr5;
|
|
1473
|
-
window.addEventListener(
|
|
1474
|
-
window.addEventListener(
|
|
1475
|
-
paginatorBoxRef === null || paginatorBoxRef === void 0 || (_paginatorBoxRef$curr5 = paginatorBoxRef.current) === null || _paginatorBoxRef$curr5 === void 0 || _paginatorBoxRef$curr5.addEventListener('wheel', scrollWheel
|
|
1835
|
+
window.addEventListener('scroll', scrollBottom);
|
|
1836
|
+
window.addEventListener('resize', scrollBottom);
|
|
1837
|
+
paginatorBoxRef === null || paginatorBoxRef === void 0 || (_paginatorBoxRef$curr5 = paginatorBoxRef.current) === null || _paginatorBoxRef$curr5 === void 0 || _paginatorBoxRef$curr5.addEventListener('wheel', scrollWheel, {
|
|
1838
|
+
passive: true
|
|
1839
|
+
});
|
|
1476
1840
|
return function () {
|
|
1477
1841
|
var _paginatorBoxRef$curr6;
|
|
1478
1842
|
window.removeEventListener('scroll', scrollBottom);
|
|
1479
|
-
window.removeEventListener(
|
|
1480
|
-
paginatorBoxRef === null || paginatorBoxRef === void 0 || (_paginatorBoxRef$curr6 = paginatorBoxRef.current) === null || _paginatorBoxRef$curr6 === void 0 || _paginatorBoxRef$curr6.removeEventListener('wheel', scrollWheel
|
|
1843
|
+
window.removeEventListener('resize', scrollBottom);
|
|
1844
|
+
paginatorBoxRef === null || paginatorBoxRef === void 0 || (_paginatorBoxRef$curr6 = paginatorBoxRef.current) === null || _paginatorBoxRef$curr6 === void 0 || _paginatorBoxRef$curr6.removeEventListener('wheel', scrollWheel, {
|
|
1845
|
+
passive: true
|
|
1846
|
+
});
|
|
1481
1847
|
};
|
|
1482
1848
|
}, []);
|
|
1483
1849
|
(0, _react.useEffect)(function () {
|
|
@@ -1487,6 +1853,39 @@ var _Table = function Table(_ref) {
|
|
|
1487
1853
|
(0, _react.useEffect)(function () {
|
|
1488
1854
|
scrollBottom();
|
|
1489
1855
|
}, [total, page]);
|
|
1856
|
+
var handleScrollBar = function handleScrollBar() {
|
|
1857
|
+
if (refDiv !== null && refDiv !== void 0 && refDiv.current) {
|
|
1858
|
+
sessionStorage.setItem('scrollPosition', refDiv.current.scrollLeft);
|
|
1859
|
+
console.log('save', refDiv.current.scrollLeft);
|
|
1860
|
+
}
|
|
1861
|
+
};
|
|
1862
|
+
(0, _react.useEffect)(function () {
|
|
1863
|
+
positionScroll();
|
|
1864
|
+
}, [initialScroll]);
|
|
1865
|
+
(0, _react.useEffect)(function () {
|
|
1866
|
+
setInitialScroll(true);
|
|
1867
|
+
}, [sort, page, filters]);
|
|
1868
|
+
|
|
1869
|
+
// useEffect(() => {
|
|
1870
|
+
// if (refScrollbar?.current) {
|
|
1871
|
+
// const savedScrollPosition = localStorage.getItem('scrollPosition');
|
|
1872
|
+
// console.log(savedScrollPosition, refScrollbar?.current)
|
|
1873
|
+
|
|
1874
|
+
// refScrollbar.current.scrollLeft = 900
|
|
1875
|
+
// if (savedScrollPosition && refScrollbar.current) {
|
|
1876
|
+
// refScrollbar.current.scrollLeft = savedScrollPosition;
|
|
1877
|
+
// }
|
|
1878
|
+
|
|
1879
|
+
// // const container = refScrollbar.current;
|
|
1880
|
+
// // container?.addEventListener('scroll', handleScrollBar);
|
|
1881
|
+
|
|
1882
|
+
// return () => {
|
|
1883
|
+
// // localStorage.setItem('scrollPosition', refScrollbar.current.scrollLeft);
|
|
1884
|
+
// // container?.removeEventListener('scroll', handleScrollBar);
|
|
1885
|
+
// };
|
|
1886
|
+
// }
|
|
1887
|
+
|
|
1888
|
+
// }, [widthTaskList]);
|
|
1490
1889
|
|
|
1491
1890
|
// Attach the scroll listener to the div
|
|
1492
1891
|
(0, _react.useEffect)(function () {
|
|
@@ -1496,76 +1895,103 @@ var _Table = function Table(_ref) {
|
|
|
1496
1895
|
setWidtContainer(right);
|
|
1497
1896
|
setLeftPosition(left);
|
|
1498
1897
|
}, [selectedHeaders, widthTable]);
|
|
1898
|
+
|
|
1899
|
+
// useEffect(() => {
|
|
1900
|
+
// if (paginatorBoxRef?.current && refDiv?.current) {
|
|
1901
|
+
// paginatorBoxRef.current.scrollLeft = 0;
|
|
1902
|
+
// refDiv.current.scrollLeft = 0;
|
|
1903
|
+
// }
|
|
1904
|
+
// }, [selectedHeaders]);
|
|
1905
|
+
|
|
1499
1906
|
(0, _react.useEffect)(function () {
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1907
|
+
_setFilters([]);
|
|
1908
|
+
}, [headers]);
|
|
1909
|
+
{
|
|
1910
|
+
loading && (headers === null || headers === void 0 ? void 0 : headers.header) && /*#__PURE__*/_react["default"].createElement("div", {
|
|
1911
|
+
className: "loader-table-background"
|
|
1912
|
+
}, /*#__PURE__*/_react["default"].createElement(_reactSpinners.MoonLoader, {
|
|
1913
|
+
color: "#1890FF",
|
|
1914
|
+
speedMultiplier: 0.5
|
|
1915
|
+
}));
|
|
1916
|
+
}
|
|
1917
|
+
try {
|
|
1918
|
+
var _fetchedData$;
|
|
1919
|
+
return loading && !(headers !== null && headers !== void 0 && headers.header) ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
1920
|
+
className: "loader-table"
|
|
1921
|
+
}, /*#__PURE__*/_react["default"].createElement(SceletonTable, {
|
|
1922
|
+
height: 400
|
|
1923
|
+
})) : headers !== null && headers !== void 0 && headers.header ? !nestedTable ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("table", {
|
|
1924
|
+
className: "table-ver-3",
|
|
1925
|
+
style: {
|
|
1926
|
+
height: headers !== null && headers !== void 0 && headers.header && loading ? '100%' : ''
|
|
1927
|
+
},
|
|
1928
|
+
ref: refTable
|
|
1929
|
+
}, /*#__PURE__*/_react["default"].createElement("thead", {
|
|
1930
|
+
ref: refThead,
|
|
1931
|
+
className: "thead",
|
|
1932
|
+
style: {
|
|
1933
|
+
backgroundColor: 'white',
|
|
1934
|
+
transform: "translateY(".concat(rowCount + (topHeader ? topHeader : 0), "px)"),
|
|
1935
|
+
transition: '.3s'
|
|
1936
|
+
}
|
|
1937
|
+
}, tableHeaders), /*#__PURE__*/_react["default"].createElement("tbody", {
|
|
1938
|
+
ref: refBody,
|
|
1939
|
+
className: "tbody"
|
|
1940
|
+
//style={{ position: 'relative' }}
|
|
1941
|
+
}, headers !== null && headers !== void 0 && headers.header && loading ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
1942
|
+
className: "loader-table"
|
|
1943
|
+
}, /*#__PURE__*/_react["default"].createElement(SceletonTable, {
|
|
1944
|
+
height: 400
|
|
1945
|
+
})) : ((_fetchedData$ = fetchedData[0]) === null || _fetchedData$ === void 0 ? void 0 : _fetchedData$.length) > 0 ? bodyRowsList : /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", {
|
|
1946
|
+
className: "loader-box-tr",
|
|
1947
|
+
colSpan: "88",
|
|
1948
|
+
style: {
|
|
1949
|
+
padding: '24px'
|
|
1950
|
+
}
|
|
1951
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
1952
|
+
className: "text_grey"
|
|
1953
|
+
}, translateNoParametr()))))), isVisible && /*#__PURE__*/_react["default"].createElement("div", {
|
|
1954
|
+
className: "scrollbar",
|
|
1955
|
+
ref: refDiv,
|
|
1956
|
+
onScroll: function onScroll(e) {
|
|
1957
|
+
scrollBottom();
|
|
1958
|
+
positionScroll();
|
|
1959
|
+
handleScrollBar();
|
|
1960
|
+
},
|
|
1961
|
+
style: {
|
|
1962
|
+
height: '16px',
|
|
1963
|
+
position: 'fixed',
|
|
1964
|
+
bottom: isFixed ? 0 : '',
|
|
1965
|
+
top: !isFixed ? bottom : '',
|
|
1966
|
+
left: leftPosition + 'px',
|
|
1967
|
+
maxWidth: widtContainer + 'px',
|
|
1968
|
+
width: '100%',
|
|
1969
|
+
overflowX: 'scroll',
|
|
1970
|
+
overflowY: 'hidden'
|
|
1971
|
+
}
|
|
1972
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1973
|
+
style: {
|
|
1974
|
+
minWidth: widthTable,
|
|
1975
|
+
maxWidth: widthTable
|
|
1976
|
+
}
|
|
1977
|
+
}))) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, tableHeaders, fetchedData[0].length > 0 ? bodyRowsList : /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", {
|
|
1978
|
+
className: "loader-box-tr",
|
|
1979
|
+
colSpan: "88",
|
|
1980
|
+
style: {
|
|
1981
|
+
padding: '24px'
|
|
1982
|
+
}
|
|
1983
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
1984
|
+
className: "text_grey"
|
|
1985
|
+
}, translateNoParametr())))) : /*#__PURE__*/_react["default"].createElement(_TableWithoutData.TableWithoutData, {
|
|
1986
|
+
maxHeight: maxHeight,
|
|
1987
|
+
text: noDataText ? noDataText : textTable
|
|
1988
|
+
});
|
|
1989
|
+
} catch (error) {
|
|
1990
|
+
console.error(error);
|
|
1991
|
+
return /*#__PURE__*/_react["default"].createElement(_TableWithoutData.TableWithoutData, {
|
|
1992
|
+
maxHeight: maxHeight,
|
|
1993
|
+
text: 'Что-то пошло не так'
|
|
1994
|
+
});
|
|
1995
|
+
}
|
|
1570
1996
|
};
|
|
1571
|
-
var _default = exports["default"] =
|
|
1997
|
+
var _default = exports["default"] = Table;
|