ecomlab-components-next 0.1.102 → 0.1.104

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