@crystaldesign/diva-backoffice 25.16.1-rc.0 → 25.16.1-rc.2

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.
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import React, { createElement, createContext, useState, useEffect, useRef, useMemo, forwardRef, useImperativeHandle, useCallback, createRef, useReducer, useContext, memo, useDeferredValue } from 'react';
3
3
  import 'antd/dist/reset.css';
4
- import { Divider, Form as Form$2, Button, Input as Input$1, Popover, Typography, Progress, Select as Select$1, Avatar, Spin, Radio, Space, Dropdown, DatePicker, Checkbox as Checkbox$1, InputNumber, Modal as Modal$2, Tabs, Cascader, Descriptions, Row, Col, Tooltip as Tooltip$1, Collapse, List as List$1, Skeleton, Alert, Card, Upload as Upload$2, Table as Table$1, Switch, Popconfirm, Image, Slider, Breadcrumb, Result as Result$1, message, Tag, Layout, Drawer, ConfigProvider, theme } from 'antd';
4
+ import { Divider, Form as Form$2, Button, Input as Input$1, Popover, Typography, Progress, Select as Select$1, Avatar, Spin, Radio, Space, Dropdown, DatePicker, Checkbox as Checkbox$1, InputNumber, Modal as Modal$2, Tabs, Cascader, Descriptions, Row, Col, Tooltip as Tooltip$1, Collapse, List as List$1, Skeleton, Alert, Card, Upload as Upload$2, Table as Table$1, message, Switch, Popconfirm, Image, Slider, Breadcrumb, Result as Result$1, Tag, Layout, Drawer, ConfigProvider, theme } from 'antd';
5
5
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
6
6
  import { observer } from 'mobx-react-lite';
7
7
  import { getLogger, DivaError, useTranslation, useDivaCore, DivaUtils } from '@crystaldesign/diva-core';
@@ -16274,7 +16274,7 @@ var DownloadStore = /*#__PURE__*/function () {
16274
16274
  value: function () {
16275
16275
  var _downloadRequest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(download, data) {
16276
16276
  var _this$_rootStore3;
16277
- var url, result, contentDisposition, fileName, fileNameMatch, blob, base64File, a, mimeType, res;
16277
+ var url, result, contentType, contentDisposition, fileName, fileNameMatch, extension, blob, base64File, a, mimeType, res;
16278
16278
  return _regeneratorRuntime.wrap(function _callee5$(_context6) {
16279
16279
  while (1) switch (_context6.prev = _context6.next) {
16280
16280
  case 0:
@@ -16296,44 +16296,64 @@ var DownloadStore = /*#__PURE__*/function () {
16296
16296
  });
16297
16297
  case 3:
16298
16298
  result = _context6.sent;
16299
- result.headers.get('Content-Type');
16299
+ if (result.ok) {
16300
+ _context6.next = 7;
16301
+ break;
16302
+ }
16303
+ LOG$e.error(new DivaError("Download request failed: ".concat(result.status, " ").concat(result.statusText)));
16304
+ throw new Error("Download failed: ".concat(result.status, " ").concat(result.statusText));
16305
+ case 7:
16306
+ contentType = result.headers.get('Content-Type');
16300
16307
  contentDisposition = result.headers.get('Content-Disposition');
16301
- fileName = 'download'; // Extract filename from Content-Disposition header if available
16302
- if (contentDisposition) {
16308
+ fileName = 'download'; // Use fileName from data if available
16309
+ if (data !== null && data !== void 0 && data['fileName']) {
16310
+ fileName = data['fileName'];
16311
+ }
16312
+
16313
+ // Fall back to Content-Disposition header if no fileName in data
16314
+ if (fileName === 'download' && contentDisposition) {
16303
16315
  fileNameMatch = contentDisposition.match(/filename="?([^"]+)"?/i);
16304
16316
  if (fileNameMatch && fileNameMatch[1]) {
16305
16317
  fileName = fileNameMatch[1];
16306
16318
  }
16307
16319
  }
16320
+
16321
+ // If filename has no extension, derive it from contentType
16322
+ if (fileName && !fileName.includes('.') && contentType) {
16323
+ extension = this.getExtensionFromMimeType(contentType);
16324
+ if (extension) {
16325
+ fileName = "".concat(fileName, ".").concat(extension);
16326
+ }
16327
+ }
16308
16328
  _context6.t0 = download.mediaType;
16309
- _context6.next = _context6.t0 === 'file' ? 11 : _context6.t0 === 'base64' ? 16 : _context6.t0 === 'json' ? 25 : 30;
16329
+ _context6.next = _context6.t0 === 'file' ? 16 : _context6.t0 === 'base64' ? 21 : _context6.t0 === 'json' ? 30 : 35;
16310
16330
  break;
16311
- case 11:
16312
- _context6.next = 13;
16331
+ case 16:
16332
+ _context6.next = 18;
16313
16333
  return result.blob();
16314
- case 13:
16334
+ case 18:
16315
16335
  blob = _context6.sent;
16316
16336
  DownloadStore.downloadBlob(blob, fileName);
16317
- return _context6.abrupt("break", 30);
16318
- case 16:
16319
- _context6.next = 18;
16337
+ return _context6.abrupt("break", 35);
16338
+ case 21:
16339
+ _context6.next = 23;
16320
16340
  return result.json();
16321
- case 18:
16341
+ case 23:
16322
16342
  base64File = _context6.sent;
16323
16343
  a = document.createElement('a'); //Create <a>
16324
16344
  mimeType = (data === null || data === void 0 ? void 0 : data['fileFormat']) == 'glb' ? 'model/gltf-binary' : (data === null || data === void 0 ? void 0 : data['fileFormat']) == 'jpg' ? 'image/jpeg' : 'image/png';
16325
16345
  a.href = 'data:' + mimeType + ';base64,' + base64File; //Image Base64 Goes here
16326
16346
  a.download = (data === null || data === void 0 ? void 0 : data['fileName']) + '.' + (data === null || data === void 0 ? void 0 : data['fileFormat']); //File name Here
16327
16347
  a.click();
16328
- return _context6.abrupt("break", 30);
16329
- case 25:
16330
- _context6.next = 27;
16348
+ return _context6.abrupt("break", 35);
16349
+ case 30:
16350
+ _context6.next = 32;
16331
16351
  return result.json();
16332
- case 27:
16352
+ case 32:
16333
16353
  res = _context6.sent;
16334
16354
  DownloadStore.downloadText('hqRenderScript_' + (data === null || data === void 0 ? void 0 : data['fileName']) + '.json', JSON.stringify(res), 'application/json');
16335
- return _context6.abrupt("break", 30);
16336
- case 30:
16355
+ return _context6.abrupt("break", 35);
16356
+ case 35:
16337
16357
  case "end":
16338
16358
  return _context6.stop();
16339
16359
  }
@@ -16353,26 +16373,57 @@ var DownloadStore = /*#__PURE__*/function () {
16353
16373
  return false;
16354
16374
  }
16355
16375
  }
16376
+ }, {
16377
+ key: "getExtensionFromMimeType",
16378
+ value: function getExtensionFromMimeType(mimeType) {
16379
+ var mimeToExt = {
16380
+ 'application/pdf': 'pdf',
16381
+ 'application/json': 'json',
16382
+ 'application/xml': 'xml',
16383
+ 'application/zip': 'zip',
16384
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'xlsx',
16385
+ 'application/vnd.ms-excel': 'xls',
16386
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'docx',
16387
+ 'application/msword': 'doc',
16388
+ 'text/plain': 'txt',
16389
+ 'text/csv': 'csv',
16390
+ 'text/html': 'html',
16391
+ 'image/png': 'png',
16392
+ 'image/jpeg': 'jpg',
16393
+ 'image/gif': 'gif',
16394
+ 'image/webp': 'webp',
16395
+ 'image/tiff': 'tiff',
16396
+ 'image/svg+xml': 'svg',
16397
+ 'model/gltf-binary': 'glb',
16398
+ 'model/gltf+json': 'gltf'
16399
+ };
16400
+
16401
+ // Handle mimeType with charset or other parameters (e.g., "text/plain; charset=utf-8")
16402
+ var baseMimeType = mimeType.split(';')[0].trim().toLowerCase();
16403
+ return mimeToExt[baseMimeType] || null;
16404
+ }
16356
16405
  }, {
16357
16406
  key: "openDownload",
16358
16407
  value: function () {
16359
16408
  var _openDownload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(props) {
16360
16409
  var _props$data;
16361
- var promises, _iterator2, _step2, dt;
16410
+ var successCount, failedCount, promises, _iterator2, _step2, dt, _results, results;
16362
16411
  return _regeneratorRuntime.wrap(function _callee6$(_context7) {
16363
16412
  while (1) switch (_context7.prev = _context7.next) {
16364
16413
  case 0:
16365
16414
  if (!(((_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.length) > 0)) {
16366
- _context7.next = 26;
16415
+ _context7.next = 34;
16367
16416
  break;
16368
16417
  }
16418
+ successCount = 0;
16419
+ failedCount = 0;
16369
16420
  promises = [];
16370
16421
  _iterator2 = _createForOfIteratorHelper$l(props.data);
16371
- _context7.prev = 3;
16422
+ _context7.prev = 5;
16372
16423
  _iterator2.s();
16373
- case 5:
16424
+ case 7:
16374
16425
  if ((_step2 = _iterator2.n()).done) {
16375
- _context7.next = 14;
16426
+ _context7.next = 18;
16376
16427
  break;
16377
16428
  }
16378
16429
  dt = _step2.value;
@@ -16384,41 +16435,69 @@ var DownloadStore = /*#__PURE__*/function () {
16384
16435
  sessionGuid: props.sessionGuid
16385
16436
  }));
16386
16437
  if (!(promises.length == 10)) {
16387
- _context7.next = 12;
16438
+ _context7.next = 16;
16388
16439
  break;
16389
16440
  }
16390
- _context7.next = 11;
16391
- return Promise.all(promises);
16392
- case 11:
16441
+ _context7.next = 13;
16442
+ return Promise.allSettled(promises);
16443
+ case 13:
16444
+ _results = _context7.sent;
16445
+ _results.forEach(function (result) {
16446
+ if (result.status === 'fulfilled') {
16447
+ successCount++;
16448
+ } else {
16449
+ failedCount++;
16450
+ }
16451
+ });
16393
16452
  promises.length = 0;
16394
- case 12:
16395
- _context7.next = 5;
16453
+ case 16:
16454
+ _context7.next = 7;
16396
16455
  break;
16397
- case 14:
16398
- _context7.next = 19;
16456
+ case 18:
16457
+ _context7.next = 23;
16399
16458
  break;
16400
- case 16:
16401
- _context7.prev = 16;
16402
- _context7.t0 = _context7["catch"](3);
16459
+ case 20:
16460
+ _context7.prev = 20;
16461
+ _context7.t0 = _context7["catch"](5);
16403
16462
  _iterator2.e(_context7.t0);
16404
- case 19:
16405
- _context7.prev = 19;
16463
+ case 23:
16464
+ _context7.prev = 23;
16406
16465
  _iterator2.f();
16407
- return _context7.finish(19);
16408
- case 22:
16409
- _context7.next = 24;
16410
- return Promise.all(promises);
16411
- case 24:
16412
- _context7.next = 28;
16413
- break;
16466
+ return _context7.finish(23);
16414
16467
  case 26:
16415
- _context7.next = 28;
16468
+ if (!(promises.length > 0)) {
16469
+ _context7.next = 31;
16470
+ break;
16471
+ }
16472
+ _context7.next = 29;
16473
+ return Promise.allSettled(promises);
16474
+ case 29:
16475
+ results = _context7.sent;
16476
+ results.forEach(function (result) {
16477
+ if (result.status === 'fulfilled') {
16478
+ successCount++;
16479
+ } else {
16480
+ failedCount++;
16481
+ }
16482
+ });
16483
+ case 31:
16484
+ return _context7.abrupt("return", {
16485
+ success: successCount,
16486
+ failed: failedCount
16487
+ });
16488
+ case 34:
16489
+ _context7.next = 36;
16416
16490
  return this.executeDownload(props);
16417
- case 28:
16491
+ case 36:
16492
+ return _context7.abrupt("return", {
16493
+ success: 1,
16494
+ failed: 0
16495
+ });
16496
+ case 37:
16418
16497
  case "end":
16419
16498
  return _context7.stop();
16420
16499
  }
16421
- }, _callee6, this, [[3, 16, 19, 22]]);
16500
+ }, _callee6, this, [[5, 20, 23, 26]]);
16422
16501
  }));
16423
16502
  function openDownload(_x13) {
16424
16503
  return _openDownload.apply(this, arguments);
@@ -27445,6 +27524,10 @@ var TableWrapper = function TableWrapper(_ref) {
27445
27524
  _useState8 = _slicedToArray(_useState7, 2),
27446
27525
  progressBarPercentage = _useState8[0],
27447
27526
  setProgressBarPercentage = _useState8[1];
27527
+ var _useState9 = useState(null),
27528
+ _useState10 = _slicedToArray(_useState9, 2),
27529
+ downloadingIndex = _useState10[0],
27530
+ setDownloadingIndex = _useState10[1];
27448
27531
  useEffect(function () {
27449
27532
  if (!state.loading && state.configuration.canRefresh) state.triggerRefresh();
27450
27533
  }, [root.dataStore.selectedOrganizationId]);
@@ -27567,23 +27650,57 @@ var TableWrapper = function TableWrapper(_ref) {
27567
27650
  var _action$label;
27568
27651
  return /*#__PURE__*/jsx(Button, {
27569
27652
  type: "primary",
27570
- disabled: isDownloadActionDisabled(action),
27653
+ disabled: isDownloadActionDisabled(action) || downloadingIndex !== null,
27571
27654
  icon: /*#__PURE__*/jsx(DownloadOutlined$1, {}),
27572
27655
  size: "middle",
27573
- onClick: function onClick() {
27574
- var _state$catalogItem2, _state$catalogItem3, _state$catalogItem4;
27575
- var selectedData = state.data.filter(function (dt) {
27576
- return state.selected.includes(dt._id);
27577
- });
27578
- root.downloadStore.openDownload({
27579
- data: selectedData.length ? selectedData : state.mappingData,
27580
- action: action,
27581
- catalogCodex: (_state$catalogItem2 = state.catalogItem) === null || _state$catalogItem2 === void 0 ? void 0 : _state$catalogItem2.codex,
27582
- dealerId: (_state$catalogItem3 = state.catalogItem) === null || _state$catalogItem3 === void 0 ? void 0 : _state$catalogItem3.dealerId,
27583
- currentUrl: state.currentFetchUrl,
27584
- sessionGuid: (_state$catalogItem4 = state.catalogItem) === null || _state$catalogItem4 === void 0 ? void 0 : _state$catalogItem4.sessionGuid
27585
- });
27586
- },
27656
+ loading: downloadingIndex === index,
27657
+ onClick: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
27658
+ var selectedData, _state$catalogItem2, _state$catalogItem3, _state$catalogItem4, result;
27659
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
27660
+ while (1) switch (_context.prev = _context.next) {
27661
+ case 0:
27662
+ selectedData = state.data.filter(function (dt) {
27663
+ return state.selected.includes(dt._id);
27664
+ });
27665
+ setDownloadingIndex(index);
27666
+ _context.prev = 2;
27667
+ _context.next = 5;
27668
+ return root.downloadStore.openDownload({
27669
+ data: selectedData.length ? selectedData : state.mappingData,
27670
+ action: action,
27671
+ catalogCodex: (_state$catalogItem2 = state.catalogItem) === null || _state$catalogItem2 === void 0 ? void 0 : _state$catalogItem2.codex,
27672
+ dealerId: (_state$catalogItem3 = state.catalogItem) === null || _state$catalogItem3 === void 0 ? void 0 : _state$catalogItem3.dealerId,
27673
+ currentUrl: state.currentFetchUrl,
27674
+ sessionGuid: (_state$catalogItem4 = state.catalogItem) === null || _state$catalogItem4 === void 0 ? void 0 : _state$catalogItem4.sessionGuid
27675
+ });
27676
+ case 5:
27677
+ result = _context.sent;
27678
+ if (result.failed > 0 && result.success > 0) {
27679
+ message.warning(t('backoffice.download.partial', {
27680
+ success: result.success,
27681
+ failed: result.failed
27682
+ }));
27683
+ } else if (result.failed > 0) {
27684
+ message.error(t('backoffice.download.allFailed', {
27685
+ failed: result.failed
27686
+ }));
27687
+ }
27688
+ _context.next = 12;
27689
+ break;
27690
+ case 9:
27691
+ _context.prev = 9;
27692
+ _context.t0 = _context["catch"](2);
27693
+ message.error(t('backoffice.download.error'));
27694
+ case 12:
27695
+ _context.prev = 12;
27696
+ setDownloadingIndex(null);
27697
+ return _context.finish(12);
27698
+ case 15:
27699
+ case "end":
27700
+ return _context.stop();
27701
+ }
27702
+ }, _callee, null, [[2, 9, 12, 15]]);
27703
+ })),
27587
27704
  children: (_action$label = action.label) !== null && _action$label !== void 0 ? _action$label : t('backoffice.basetable.download')
27588
27705
  }, index);
27589
27706
  }), state.configuration.canRefresh && /*#__PURE__*/jsx(Button, {
@@ -27767,17 +27884,17 @@ var TableWrapper = function TableWrapper(_ref) {
27767
27884
  });
27768
27885
  };
27769
27886
  var BaseTable = observer(TableWrapper);
27770
- function DeleteButton(_ref3) {
27771
- var _ref3$selected = _ref3.selected,
27772
- selected = _ref3$selected === void 0 ? [] : _ref3$selected,
27773
- total = _ref3.total,
27774
- _ref3$min = _ref3.min,
27775
- min = _ref3$min === void 0 ? 0 : _ref3$min,
27776
- deleting = _ref3.deleting,
27777
- onDelete = _ref3.onDelete,
27778
- disabled = _ref3.disabled,
27779
- label = _ref3.label,
27780
- labelDialog = _ref3.labelDialog;
27887
+ function DeleteButton(_ref4) {
27888
+ var _ref4$selected = _ref4.selected,
27889
+ selected = _ref4$selected === void 0 ? [] : _ref4$selected,
27890
+ total = _ref4.total,
27891
+ _ref4$min = _ref4.min,
27892
+ min = _ref4$min === void 0 ? 0 : _ref4$min,
27893
+ deleting = _ref4.deleting,
27894
+ onDelete = _ref4.onDelete,
27895
+ disabled = _ref4.disabled,
27896
+ label = _ref4.label,
27897
+ labelDialog = _ref4.labelDialog;
27781
27898
  var _useTranslation2 = useTranslation(),
27782
27899
  t = _useTranslation2.t;
27783
27900
  var hasSelected = (selected === null || selected === void 0 ? void 0 : selected.length) > 0;
@@ -27805,20 +27922,20 @@ function DeleteButton(_ref3) {
27805
27922
  })
27806
27923
  });
27807
27924
  }
27808
- function CopyButton(_ref4) {
27925
+ function CopyButton(_ref5) {
27809
27926
  var _state$configuration$24;
27810
- var state = _ref4.state;
27927
+ var state = _ref5.state;
27811
27928
  var root = useStore();
27812
27929
  new _default$d({
27813
27930
  apiInterface: state.configuration.apiInterface,
27814
27931
  type: 'Table'
27815
27932
  }, root);
27816
27933
  var onCopy = /*#__PURE__*/function () {
27817
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
27934
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
27818
27935
  var _state$configuration$21;
27819
27936
  var copyAction, _iterator3, _step3, selectedRow;
27820
- return _regeneratorRuntime.wrap(function _callee$(_context) {
27821
- while (1) switch (_context.prev = _context.next) {
27937
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
27938
+ while (1) switch (_context2.prev = _context2.next) {
27822
27939
  case 0:
27823
27940
  copyAction = state.configuration.copyAction;
27824
27941
  if (((_state$configuration$21 = state.configuration.copyAction) === null || _state$configuration$21 === void 0 ? void 0 : _state$configuration$21.apiInterface) != undefined) {
@@ -27846,33 +27963,33 @@ function CopyButton(_ref4) {
27846
27963
  }
27847
27964
  case 2:
27848
27965
  case "end":
27849
- return _context.stop();
27966
+ return _context2.stop();
27850
27967
  }
27851
- }, _callee);
27968
+ }, _callee2);
27852
27969
  }));
27853
27970
  return function onCopy() {
27854
- return _ref5.apply(this, arguments);
27971
+ return _ref6.apply(this, arguments);
27855
27972
  };
27856
27973
  }();
27857
27974
  var onCopyAction = /*#__PURE__*/function () {
27858
- var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
27975
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
27859
27976
  var _state$configuration$22, _state$configuration$23;
27860
27977
  var copyAction, id, data;
27861
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
27862
- while (1) switch (_context3.prev = _context3.next) {
27978
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
27979
+ while (1) switch (_context4.prev = _context4.next) {
27863
27980
  case 0:
27864
27981
  copyAction = state.configuration.copyAction;
27865
27982
  if (!(copyAction.id == undefined || copyAction.actionType != 'Detail' || ((_state$configuration$22 = state.configuration.createAction) === null || _state$configuration$22 === void 0 ? void 0 : _state$configuration$22.actionType) != 'Detail')) {
27866
- _context3.next = 3;
27983
+ _context4.next = 3;
27867
27984
  break;
27868
27985
  }
27869
27986
  throw new Error('configuration needs to be of type Detail');
27870
27987
  case 3:
27871
27988
  id = state.selected[0];
27872
- _context3.next = 6;
27989
+ _context4.next = 6;
27873
27990
  return state.getDataById(id);
27874
27991
  case 6:
27875
- data = _context3.sent;
27992
+ data = _context4.sent;
27876
27993
  data.data[0] = applyMapping({
27877
27994
  mappable: {},
27878
27995
  mappingData: data.data[0],
@@ -27889,19 +28006,19 @@ function CopyButton(_ref4) {
27889
28006
  mapping: (_state$configuration$23 = state.configuration.createAction) === null || _state$configuration$23 === void 0 ? void 0 : _state$configuration$23.mapping,
27890
28007
  mappingData: data.data[0],
27891
28008
  callback: function () {
27892
- var _callback = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(e) {
27893
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
27894
- while (1) switch (_context2.prev = _context2.next) {
28009
+ var _callback = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(e) {
28010
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
28011
+ while (1) switch (_context3.prev = _context3.next) {
27895
28012
  case 0:
27896
- _context2.next = 2;
28013
+ _context3.next = 2;
27897
28014
  return state.onUpdate(e);
27898
28015
  case 2:
27899
28016
  if (copyAction.resetToggleAfter) state.resetToggle();
27900
28017
  case 3:
27901
28018
  case "end":
27902
- return _context2.stop();
28019
+ return _context3.stop();
27903
28020
  }
27904
- }, _callee2);
28021
+ }, _callee3);
27905
28022
  }));
27906
28023
  function callback(_x) {
27907
28024
  return _callback.apply(this, arguments);
@@ -27911,12 +28028,12 @@ function CopyButton(_ref4) {
27911
28028
  });
27912
28029
  case 9:
27913
28030
  case "end":
27914
- return _context3.stop();
28031
+ return _context4.stop();
27915
28032
  }
27916
- }, _callee3);
28033
+ }, _callee4);
27917
28034
  }));
27918
28035
  return function onCopyAction() {
27919
- return _ref6.apply(this, arguments);
28036
+ return _ref7.apply(this, arguments);
27920
28037
  };
27921
28038
  }();
27922
28039
  var _useTranslation3 = useTranslation(),
@@ -27928,11 +28045,11 @@ function CopyButton(_ref4) {
27928
28045
  children: t('backoffice.basetable.copy')
27929
28046
  });
27930
28047
  }
27931
- function BulkAction(_ref7) {
28048
+ function BulkAction(_ref8) {
27932
28049
  var _state$selected3;
27933
- var action = _ref7.action,
27934
- state = _ref7.state,
27935
- progressBar = _ref7.progressBar;
28050
+ var action = _ref8.action,
28051
+ state = _ref8.state,
28052
+ progressBar = _ref8.progressBar;
27936
28053
  var root = useStore();
27937
28054
  var _useTranslation4 = useTranslation(),
27938
28055
  t = _useTranslation4.t;
@@ -27943,10 +28060,10 @@ function BulkAction(_ref7) {
27943
28060
  return state.selected.includes(d._id);
27944
28061
  })) || [];
27945
28062
  }, [state.selected, state.data]);
27946
- var _useState9 = useState(),
27947
- _useState10 = _slicedToArray(_useState9, 2),
27948
- showPopover = _useState10[0],
27949
- setShowPopover = _useState10[1];
28063
+ var _useState11 = useState(),
28064
+ _useState12 = _slicedToArray(_useState11, 2),
28065
+ showPopover = _useState12[0],
28066
+ setShowPopover = _useState12[1];
27950
28067
  var allowed = useMemo(function () {
27951
28068
  // if isValue is not set check if all fields have the same value, otherwise check if all fields have the given isValue
27952
28069
  if (!action.rule) return true;
@@ -28017,22 +28134,22 @@ function BulkAction(_ref7) {
28017
28134
  return true;
28018
28135
  };
28019
28136
  var callback = /*#__PURE__*/function () {
28020
- var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(updatedData) {
28137
+ var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(updatedData) {
28021
28138
  var _action$callback;
28022
28139
  var apiInterface, data, i, dataEntry;
28023
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
28024
- while (1) switch (_context4.prev = _context4.next) {
28140
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
28141
+ while (1) switch (_context5.prev = _context5.next) {
28025
28142
  case 0:
28026
28143
  apiInterface = new _default$d({
28027
28144
  apiInterface: action.apiInterface,
28028
28145
  type: 'Form'
28029
28146
  }, root);
28030
28147
  data = [];
28031
- _context4.prev = 2;
28148
+ _context5.prev = 2;
28032
28149
  i = 0;
28033
28150
  case 4:
28034
28151
  if (!(i < selectedData.length)) {
28035
- _context4.next = 33;
28152
+ _context5.next = 33;
28036
28153
  break;
28037
28154
  }
28038
28155
  if (progressBar) {
@@ -28040,46 +28157,46 @@ function BulkAction(_ref7) {
28040
28157
  }
28041
28158
  dataEntry = selectedData[i];
28042
28159
  if (!apiInterface.canUpdate) {
28043
- _context4.next = 15;
28160
+ _context5.next = 15;
28044
28161
  break;
28045
28162
  }
28046
- _context4.t0 = data;
28047
- _context4.next = 11;
28163
+ _context5.t0 = data;
28164
+ _context5.next = 11;
28048
28165
  return apiInterface.update(_objectSpread$F(_objectSpread$F({}, dataEntry), updatedData), dataEntry, action.apiCallbackMapping);
28049
28166
  case 11:
28050
- _context4.t1 = _context4.sent;
28051
- _context4.t0.push.call(_context4.t0, _context4.t1);
28052
- _context4.next = 29;
28167
+ _context5.t1 = _context5.sent;
28168
+ _context5.t0.push.call(_context5.t0, _context5.t1);
28169
+ _context5.next = 29;
28053
28170
  break;
28054
28171
  case 15:
28055
28172
  if (!apiInterface.canCreate) {
28056
- _context4.next = 23;
28173
+ _context5.next = 23;
28057
28174
  break;
28058
28175
  }
28059
- _context4.t2 = data;
28060
- _context4.next = 19;
28176
+ _context5.t2 = data;
28177
+ _context5.next = 19;
28061
28178
  return apiInterface.create(dataEntry, updatedData);
28062
28179
  case 19:
28063
- _context4.t3 = _context4.sent;
28064
- _context4.t2.push.call(_context4.t2, _context4.t3);
28065
- _context4.next = 29;
28180
+ _context5.t3 = _context5.sent;
28181
+ _context5.t2.push.call(_context5.t2, _context5.t3);
28182
+ _context5.next = 29;
28066
28183
  break;
28067
28184
  case 23:
28068
28185
  if (!apiInterface.canDelete) {
28069
- _context4.next = 29;
28186
+ _context5.next = 29;
28070
28187
  break;
28071
28188
  }
28072
- _context4.t4 = data;
28073
- _context4.next = 27;
28189
+ _context5.t4 = data;
28190
+ _context5.next = 27;
28074
28191
  return apiInterface["delete"](state.selected[i], updatedData);
28075
28192
  case 27:
28076
- _context4.t5 = _context4.sent;
28077
- _context4.t4.push.call(_context4.t4, _context4.t5);
28193
+ _context5.t5 = _context5.sent;
28194
+ _context5.t4.push.call(_context5.t4, _context5.t5);
28078
28195
  case 29:
28079
28196
  if (progressBar) progressBar.setProgressBarPercentage(Math.floor(i / selectedData.length * 100));
28080
28197
  case 30:
28081
28198
  i++;
28082
- _context4.next = 4;
28199
+ _context5.next = 4;
28083
28200
  break;
28084
28201
  case 33:
28085
28202
  state.onUpdate(data);
@@ -28088,17 +28205,17 @@ function BulkAction(_ref7) {
28088
28205
  progressBar.setProgressBarOpen(false);
28089
28206
  progressBar.setProgressBarPercentage(0);
28090
28207
  }
28091
- _context4.next = 42;
28208
+ _context5.next = 42;
28092
28209
  break;
28093
28210
  case 37:
28094
- _context4.prev = 37;
28095
- _context4.t6 = _context4["catch"](2);
28211
+ _context5.prev = 37;
28212
+ _context5.t6 = _context5["catch"](2);
28096
28213
  if (progressBar) {
28097
28214
  progressBar.setProgressBarOpen(false);
28098
28215
  progressBar.setProgressBarPercentage(0);
28099
28216
  }
28100
28217
  LOG$4.error(new DivaError('Error changing data', {
28101
- cause: _context4.t6,
28218
+ cause: _context5.t6,
28102
28219
  code: 'BACKO_0002'
28103
28220
  }));
28104
28221
  setShowPopover(t('errorcodes._source.labels.error.BACKO_0002'));
@@ -28106,12 +28223,12 @@ function BulkAction(_ref7) {
28106
28223
  (_action$callback = action.callback) === null || _action$callback === void 0 || _action$callback.call(action, updatedData);
28107
28224
  case 43:
28108
28225
  case "end":
28109
- return _context4.stop();
28226
+ return _context5.stop();
28110
28227
  }
28111
- }, _callee4, null, [[2, 37]]);
28228
+ }, _callee5, null, [[2, 37]]);
28112
28229
  }));
28113
28230
  return function callback(_x2) {
28114
- return _ref8.apply(this, arguments);
28231
+ return _ref9.apply(this, arguments);
28115
28232
  };
28116
28233
  }();
28117
28234
  return /*#__PURE__*/jsx(Popover, {
@@ -28141,8 +28258,8 @@ function BulkAction(_ref7) {
28141
28258
  }, 'edit')
28142
28259
  });
28143
28260
  }
28144
- function SelectionText(_ref9) {
28145
- var selected = _ref9.selected;
28261
+ function SelectionText(_ref10) {
28262
+ var selected = _ref10.selected;
28146
28263
  var _useTranslation5 = useTranslation(),
28147
28264
  t = _useTranslation5.t;
28148
28265
  if (!(selected !== null && selected !== void 0 && selected.length)) {
@@ -21,8 +21,12 @@ export default class DownloadStore {
21
21
  }>;
22
22
  downloadRequest(download: downloadRequest, data: any): Promise<void>;
23
23
  checkCondition(download: downloadPrefab | downloadRequest | downloadField | downloadUrl, data: any): boolean;
24
+ private getExtensionFromMimeType;
24
25
  executeDownload: ({ data, action, catalogCodex, dealerId, currentUrl, sessionGuid }: DownloadProps) => Promise<void>;
25
- openDownload(props: DownloadProps): Promise<void>;
26
+ openDownload(props: DownloadProps): Promise<{
27
+ success: number;
28
+ failed: number;
29
+ }>;
26
30
  getCsvUrl(action: CsvExport, url: string): URL;
27
31
  }
28
32
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"DownloadStore.d.ts","sourceRoot":"","sources":["../../../../../src/store/DownloadStore.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpH,OAAO,SAAS,MAAM,aAA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AAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAgDtF,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM;CAOzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/Table/BaseTable/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAK5D,OAAO,EAAE,KAAK,EAAwB,MAAM,UAAU,CAAC;AA8BvD,eAAO,MAAM,UAAU,yCAAoB,CAAC;AAG5C,UAAU,KAAK,CAAC,CAAC;IACf,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;CACjB;0BAEqB,CAAC,SAAS,MAAM,aAAa,KAAK,CAAC,CAAC,CAAC;;;AAmV3D,wBAAsC;AACtC,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/Table/BaseTable/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAK5D,OAAO,EAAE,KAAK,EAAwB,MAAM,UAAU,CAAC;AA8BvD,eAAO,MAAM,UAAU,yCAAoB,CAAC;AAG5C,UAAU,KAAK,CAAC,CAAC;IACf,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;CACjB;0BAEqB,CAAC,SAAS,MAAM,aAAa,KAAK,CAAC,CAAC,CAAC;;;AA2W3D,wBAAsC;AACtC,cAAc,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystaldesign/diva-backoffice",
3
- "version": "25.16.1-rc.0",
3
+ "version": "25.16.1-rc.2",
4
4
  "license": "COMMERCIAL",
5
5
  "devDependencies": {
6
6
  "@testing-library/jest-dom": "^6.5.0",
@@ -15,13 +15,13 @@
15
15
  "dependencies": {
16
16
  "@ant-design/icons": "5.4.0",
17
17
  "@babel/runtime": "7.24.7",
18
- "@crystaldesign/content-box": "25.16.1-rc.0",
19
- "@crystaldesign/content-item": "25.16.1-rc.0",
20
- "@crystaldesign/diva-core": "25.16.1-rc.0",
21
- "@crystaldesign/diva-utils": "25.16.1-rc.0",
22
- "@crystaldesign/media-upload": "25.16.1-rc.0",
23
- "@crystaldesign/rtf-editor": "25.16.1-rc.0",
24
- "@crystaldesign/spreadsheet": "25.16.1-rc.0",
18
+ "@crystaldesign/content-box": "25.16.1-rc.2",
19
+ "@crystaldesign/content-item": "25.16.1-rc.2",
20
+ "@crystaldesign/diva-core": "25.16.1-rc.2",
21
+ "@crystaldesign/diva-utils": "25.16.1-rc.2",
22
+ "@crystaldesign/media-upload": "25.16.1-rc.2",
23
+ "@crystaldesign/rtf-editor": "25.16.1-rc.2",
24
+ "@crystaldesign/spreadsheet": "25.16.1-rc.2",
25
25
  "@google/model-viewer": "3.5.0",
26
26
  "ag-charts-community": "^10.1.0",
27
27
  "ag-charts-react": "^10.1.0",
@@ -51,5 +51,5 @@
51
51
  },
52
52
  "module": "build/esm/index.js",
53
53
  "types": "./build/types/backoffice/src/index.d.ts",
54
- "gitHead": "06f6bed56999c68e649b01bcb96df85d8378073b"
54
+ "gitHead": "647a0673151d60ffc8f509e34ee5450b872e2170"
55
55
  }