@crystaldesign/diva-backoffice 24.12.0-beta.5 → 24.12.0-beta.7

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.
@@ -3144,17 +3144,6 @@ function loadConfiguration(t, root, config, lang) {
3144
3144
  }]
3145
3145
  }
3146
3146
  },
3147
- GroupContentItems: {
3148
- type: 'Group',
3149
- items: [{
3150
- id: 'ContentItems',
3151
- type: 'Table'
3152
- }, {
3153
- id: 'ContentItemsTemplate',
3154
- type: 'Table'
3155
- }],
3156
- setSelectedOrganization: true
3157
- },
3158
3147
  ContentItems: {
3159
3148
  title: t('backoffice.table.contentitems.title'),
3160
3149
  type: 'Table',
@@ -3162,18 +3151,33 @@ function loadConfiguration(t, root, config, lang) {
3162
3151
  pagination: {
3163
3152
  pageSize: 50
3164
3153
  },
3154
+ filter: {
3155
+ toggle: {
3156
+ fields: ['onlyTemplates'],
3157
+ label: t('backoffice.table.contentitemstemplate.title'),
3158
+ labelOff: t('backoffice.table.contentitems.toggleOff'),
3159
+ inQuery: true
3160
+ }
3161
+ },
3165
3162
  copyAction: {
3166
3163
  actionType: 'Detail',
3167
3164
  type: 'Form',
3168
3165
  id: 'FormEditContentItem',
3166
+ disableOnMultiselect: true,
3167
+ resetToggleAfter: true,
3169
3168
  title: t('backoffice.table.contentItem.copyAction.title'),
3170
3169
  label: t('backoffice.table.services.copyAction.label'),
3171
- disableOnMultiselect: true,
3172
3170
  mapping: {
3173
3171
  type: 'body',
3174
3172
  map: [{
3175
3173
  targetField: 'content',
3176
3174
  sourceField: 'content'
3175
+ }, {
3176
+ targetField: 'catalogName',
3177
+ sourceField: 'catalogName'
3178
+ }, {
3179
+ targetField: 'supplierName',
3180
+ sourceField: 'supplierName'
3177
3181
  }, {
3178
3182
  targetField: 'description',
3179
3183
  sourceField: 'description'
@@ -3183,10 +3187,18 @@ function loadConfiguration(t, root, config, lang) {
3183
3187
  }]
3184
3188
  }
3185
3189
  },
3190
+ createAction: {
3191
+ actionType: 'Detail',
3192
+ type: 'JsonEditor',
3193
+ id: 'JsonEditorCreateContentItem',
3194
+ title: t('backoffice.table.contentItem.label.create'),
3195
+ label: t('backoffice.table.contentItem.label.create'),
3196
+ permission: 'backoffice_create_contentitem_template'
3197
+ },
3186
3198
  deleteAction: {
3187
3199
  disabled: function disabled(datas) {
3188
3200
  return (datas === null || datas === void 0 ? void 0 : datas.find(function (d) {
3189
- return !d.organizationId;
3201
+ return !(d !== null && d !== void 0 && d.organizationId);
3190
3202
  })) && !root.actions.userHasPermission('backoffice_delete_contentitem_template');
3191
3203
  }
3192
3204
  },
@@ -3217,6 +3229,7 @@ function loadConfiguration(t, root, config, lang) {
3217
3229
  }, {
3218
3230
  title: t('backoffice.table.views.lastUpdated'),
3219
3231
  field: 'lastUpdated',
3232
+ defaultSortOrder: 'descend',
3220
3233
  type: 'unixTimeStamp',
3221
3234
  sorter: 1,
3222
3235
  filter: 'advanced',
@@ -3238,106 +3251,6 @@ function loadConfiguration(t, root, config, lang) {
3238
3251
  filter: 'advanced',
3239
3252
  width: 150
3240
3253
  }],
3241
- rowAction: [{
3242
- actionType: 'Detail',
3243
- disabled: function disabled(data) {
3244
- return !(data !== null && data !== void 0 && data.organizationId) && !root.actions.userHasPermission('backoffice_edit_contentitem_template');
3245
- },
3246
- disableOnMultiselect: true,
3247
- type: 'Form',
3248
- id: 'FormEditContentItem',
3249
- title: t('backoffice.table.contentItem.edit'),
3250
- label: t('backoffice.edit')
3251
- }, {
3252
- disableOnMultiselect: true,
3253
- actionType: 'Detail',
3254
- permission: 'backoffice_edit_contentitem_template',
3255
- type: 'JsonEditor',
3256
- label: t('backoffice.table.contentItem.editjson'),
3257
- id: 'JsonEditorEditContentItem',
3258
- title: t('backoffice.table.contentItem.edit')
3259
- }],
3260
- apiInterface: {
3261
- read: {
3262
- list: '${catalogService}/contentItems',
3263
- filterServerSide: true
3264
- },
3265
- "delete": '${catalogService}/contentItems/${id}'
3266
- }
3267
- },
3268
- ContentItemsTemplate: {
3269
- title: t('backoffice.table.contentitemstemplate.title'),
3270
- type: 'Table',
3271
- canRefresh: true,
3272
- pagination: {
3273
- pageSize: 50
3274
- },
3275
- copyAction: {
3276
- actionType: 'Detail',
3277
- type: 'Form',
3278
- id: 'FormEditContentItem',
3279
- disableOnMultiselect: true,
3280
- title: t('backoffice.table.contentItem.copyAction.title'),
3281
- label: t('backoffice.table.services.copyAction.label'),
3282
- mapping: {
3283
- type: 'body',
3284
- map: [{
3285
- targetField: 'content',
3286
- sourceField: 'content'
3287
- }, {
3288
- targetField: 'description',
3289
- sourceField: 'description'
3290
- }, {
3291
- targetField: 'organizationId',
3292
- globalValue: 'organizationId'
3293
- }]
3294
- }
3295
- },
3296
- createAction: {
3297
- actionType: 'Detail',
3298
- type: 'JsonEditor',
3299
- id: 'JsonEditorCreateContentItem',
3300
- title: t('backoffice.table.contentItem.label.create'),
3301
- label: t('backoffice.table.contentItem.label.create'),
3302
- permission: 'backoffice_create_contentitem_template'
3303
- },
3304
- deleteAction: {
3305
- disabled: function disabled(datas) {
3306
- return (datas === null || datas === void 0 ? void 0 : datas.find(function (d) {
3307
- return !d.organizationId;
3308
- })) && !root.actions.userHasPermission('backoffice_delete_contentitem_template');
3309
- }
3310
- },
3311
- columns: [{
3312
- title: t('backoffice.table.roles.columns.description'),
3313
- field: 'description',
3314
- sorter: 1,
3315
- filter: 'advanced',
3316
- width: 500
3317
- }, {
3318
- title: t('backoffice.table.views.lastUpdatedBy'),
3319
- field: 'lastUpdatedBy_displayText',
3320
- sorter: 1,
3321
- filter: 'advanced',
3322
- width: 150
3323
- }, {
3324
- title: t('backoffice.table.views.lastUpdated'),
3325
- field: 'lastUpdated',
3326
- type: 'unixTimeStamp',
3327
- sorter: 1,
3328
- filter: 'advanced',
3329
- width: 200
3330
- }, {
3331
- title: 'backoffice.content',
3332
- field: 'content',
3333
- hidden: true
3334
- }, {
3335
- title: t('backoffice._id'),
3336
- field: '_id',
3337
- sorter: 1,
3338
- filter: 'advanced',
3339
- width: 100
3340
- }],
3341
3254
  rowAction: [{
3342
3255
  actionType: 'Detail',
3343
3256
  disabled: function disabled(data) {
@@ -3369,7 +3282,7 @@ function loadConfiguration(t, root, config, lang) {
3369
3282
  }],
3370
3283
  apiInterface: {
3371
3284
  read: {
3372
- list: '${catalogService}/contentItems?onlyTemplates=true',
3285
+ list: '${catalogService}/contentItems',
3373
3286
  filterServerSide: true
3374
3287
  },
3375
3288
  "delete": '${catalogService}/contentItems/${id}'
@@ -7624,6 +7537,7 @@ function loadConfiguration(t, root, config, lang) {
7624
7537
  }, {
7625
7538
  name: 'mediaItemImage',
7626
7539
  type: 'media',
7540
+ hideTrash: true,
7627
7541
  allowedTypes: ['image/*'],
7628
7542
  mediaItemRefField: 'mediaItemRefImage',
7629
7543
  urlField: 'image',
@@ -7644,6 +7558,7 @@ function loadConfiguration(t, root, config, lang) {
7644
7558
  }, {
7645
7559
  name: 'mediaItemVideo',
7646
7560
  type: 'media',
7561
+ hideTrash: true,
7647
7562
  allowedTypes: ['video/*'],
7648
7563
  mediaItemRefField: 'mediaItemRefVideo',
7649
7564
  urlField: 'video',
@@ -12250,7 +12165,7 @@ var menu = [{
12250
12165
  }
12251
12166
  }]
12252
12167
  }, {
12253
- id: 'GroupContentItems',
12168
+ id: 'ContentItems',
12254
12169
  path: 'contentitems',
12255
12170
  label: 'backoffice.menu.items.label.ContentItems',
12256
12171
  icon: 'OrderedListOutlined',
@@ -13879,6 +13794,7 @@ function useFormData (_ref) {
13879
13794
  removedMedias = _useState12[0],
13880
13795
  setRemovedMedias = _useState12[1];
13881
13796
  var _useMemo = useMemo(function () {
13797
+ setCanSave === null || setCanSave === void 0 || setCanSave(true);
13882
13798
  var c = {
13883
13799
  apiHandler: root.getApiHandler(id, apiInterface),
13884
13800
  configuration: root.configurationStore.getConfiguration(id, 'Form')
@@ -13894,7 +13810,7 @@ function useFormData (_ref) {
13894
13810
  if (configuration.disableSave) setCanSave === null || setCanSave === void 0 || setCanSave(false);
13895
13811
  }, [configuration]);
13896
13812
  var _onLoadFields = function onLoadFields(data) {
13897
- var items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : selectedItems !== null && selectedItems !== void 0 ? selectedItems : configuration.items;
13813
+ var items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (selectedItems !== null && selectedItems !== void 0 ? selectedItems : configuration.itemSelector && Array.isArray(configuration.items[0])) ? configuration.items[0] : configuration.items;
13898
13814
  var _iterator = _createForOfIteratorHelper$j(items),
13899
13815
  _step;
13900
13816
  try {
@@ -14095,27 +14011,37 @@ function useFormData (_ref) {
14095
14011
  }
14096
14012
  return _context2.abrupt("return", newData);
14097
14013
  case 3:
14098
- _context2.next = 5;
14014
+ root.actions.toggleLoading('saving_form');
14015
+ _context2.prev = 4;
14016
+ _context2.next = 7;
14099
14017
  return setDynamicFields(_objectSpread$I({}, state.data), newData);
14100
- case 5:
14018
+ case 7:
14101
14019
  newData = _context2.sent;
14102
- _context2.next = 8;
14020
+ _context2.next = 10;
14103
14021
  return preSaveProcess(newData, selectedItems !== null && selectedItems !== void 0 ? selectedItems : configuration.items);
14104
- case 8:
14022
+ case 10:
14105
14023
  newData = removeEmpty(newData);
14024
+ _context2.next = 17;
14025
+ break;
14026
+ case 13:
14027
+ _context2.prev = 13;
14028
+ _context2.t0 = _context2["catch"](4);
14029
+ root.actions.toggleLoading('saving_form');
14030
+ throw _context2.t0;
14031
+ case 17:
14106
14032
  setState(_objectSpread$I(_objectSpread$I({}, state), {}, {
14107
14033
  loading: true
14108
14034
  }));
14109
14035
  finalData = state.data;
14110
- _context2.prev = 11;
14111
- _context2.next = 14;
14036
+ _context2.prev = 19;
14037
+ _context2.next = 22;
14112
14038
  return apiCall(newData);
14113
- case 14:
14039
+ case 22:
14114
14040
  response = _context2.sent;
14115
14041
  i = 0;
14116
- case 16:
14042
+ case 24:
14117
14043
  if (!(i < (((_configuration$additi = configuration.additionals) === null || _configuration$additi === void 0 ? void 0 : _configuration$additi.length) || 0))) {
14118
- _context2.next = 26;
14044
+ _context2.next = 34;
14119
14045
  break;
14120
14046
  }
14121
14047
  // perform additional server actions before returning the data
@@ -14127,51 +14053,52 @@ function useFormData (_ref) {
14127
14053
  if (additional.addBaseUrl) {
14128
14054
  data[additional.addBaseUrl] = window.location.origin;
14129
14055
  }
14130
- _context2.next = 23;
14056
+ _context2.next = 31;
14131
14057
  return additionalApi.create(data, additional.mapping, response);
14132
- case 23:
14058
+ case 31:
14133
14059
  i++;
14134
- _context2.next = 16;
14060
+ _context2.next = 24;
14135
14061
  break;
14136
- case 26:
14062
+ case 34:
14137
14063
  finalData = response;
14138
14064
  return _context2.abrupt("return", response);
14139
- case 30:
14140
- _context2.prev = 30;
14141
- _context2.t0 = _context2["catch"](11);
14065
+ case 38:
14066
+ _context2.prev = 38;
14067
+ _context2.t1 = _context2["catch"](19);
14142
14068
  if (configuration.showProgressBar) {
14143
14069
  setProgressBarOpen(false);
14144
14070
  setProgressBarPercentage(0);
14145
14071
  }
14146
- if (!(_context2.t0 instanceof DivaError && _context2.t0.name)) {
14147
- _context2.next = 39;
14072
+ if (!(_context2.t1 instanceof DivaError && _context2.t1.name)) {
14073
+ _context2.next = 47;
14148
14074
  break;
14149
14075
  }
14150
- errorCode = _context2.t0.name;
14076
+ errorCode = _context2.t1.name;
14151
14077
  item = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.find(function (item) {
14152
14078
  var _item$onError;
14153
14079
  return (_item$onError = item.onError) === null || _item$onError === void 0 ? void 0 : _item$onError[errorCode];
14154
14080
  });
14155
14081
  if (!item) {
14156
- _context2.next = 39;
14082
+ _context2.next = 47;
14157
14083
  break;
14158
14084
  }
14159
14085
  setFieldErrors(_objectSpread$I(_objectSpread$I({}, fieldErrors), {}, _defineProperty({}, item.name.toString(), item.onError[errorCode])));
14160
14086
  return _context2.abrupt("return", undefined);
14161
- case 39:
14162
- throw _context2.t0;
14163
- case 40:
14164
- _context2.prev = 40;
14087
+ case 47:
14088
+ throw _context2.t1;
14089
+ case 48:
14090
+ _context2.prev = 48;
14091
+ root.actions.toggleLoading('saving_form');
14165
14092
  setState(_objectSpread$I(_objectSpread$I({}, state), {}, {
14166
14093
  data: finalData,
14167
14094
  loading: false
14168
14095
  }));
14169
- return _context2.finish(40);
14170
- case 43:
14096
+ return _context2.finish(48);
14097
+ case 52:
14171
14098
  case "end":
14172
14099
  return _context2.stop();
14173
14100
  }
14174
- }, _callee2, null, [[11, 30, 40, 43]]);
14101
+ }, _callee2, null, [[4, 13], [19, 38, 48, 52]]);
14175
14102
  }));
14176
14103
  return function onSave(_x2) {
14177
14104
  return _ref3.apply(this, arguments);
@@ -17285,6 +17212,9 @@ function Upload (_ref) {
17285
17212
  beforeUpload: beforeUpload,
17286
17213
  onRemove: onRemoveMedia,
17287
17214
  accept: allowedTypes === null || allowedTypes === void 0 ? void 0 : allowedTypes.join(','),
17215
+ showUploadList: {
17216
+ showRemoveIcon: !config.hideTrash
17217
+ },
17288
17218
  children: /*#__PURE__*/jsxs(Space$1, {
17289
17219
  direction: "horizontal",
17290
17220
  children: [/*#__PURE__*/jsx(Button$1, {
@@ -17347,7 +17277,8 @@ function Media (_ref) {
17347
17277
  onError: onError,
17348
17278
  config: {
17349
17279
  baseUrl: state.root.configurationStore.apiConfig.mediaService,
17350
- jwt: state.root.dataStore.jwt
17280
+ jwt: state.root.dataStore.jwt,
17281
+ hideTrash: item.hideTrash
17351
17282
  }
17352
17283
  });
17353
17284
  }
@@ -17577,6 +17508,7 @@ function getElement(item, setCanSave, state, absoluteName, _onChange, _onError,
17577
17508
  });
17578
17509
  case 'radio':
17579
17510
  return /*#__PURE__*/jsx(Radio.Group, {
17511
+ defaultValue: item.defaultValue,
17580
17512
  value: item.value,
17581
17513
  options: item.options.map(function (o) {
17582
17514
  var _o$disabled;
@@ -22413,7 +22345,7 @@ var useMediaUpload = function useMediaUpload(_ref) {
22413
22345
  var small = "small-NY1-k";
22414
22346
  var medium = "medium---QcO";
22415
22347
  var big = "big--E39S";
22416
- var css_248z$d = ".diva-component-DIVA_BACKOFFICE_NEW .ant-upload-wrapper {\n width: 100%;\n height: 100%;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-spin-nested-loading {\n width: 100%;\n height: 100%;\n}\n.diva-component-DIVA_BACKOFFICE_NEW .ant-table-wrapper, .diva-component-DIVA_BACKOFFICE_NEW .ant-table {\n height: inherit;\n overflow: auto;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-spin-container {\n width: 100%;\n height: 100%;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .andt-table .ant-spin-container {\n display: flex;\n flex-direction: column;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-space-item .andt-table .ant-spin-container {\n height: calc(60vh - 90px);\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .andt-table .ant-table-container {\n height: calc(100% - 80px);\n}\n.diva-component-DIVA_BACKOFFICE_NEW .ant-upload-list {\n width: 100%;\n height: 100%;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-upload-list-item-container {\n width: 100% !important;\n height: 100% !important;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-upload-select {\n width: 100% !important;\n height: 100% !important;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .small-NY1-k {\n width: 104px;\n height: 104px;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .medium---QcO {\n width: 200px;\n height: 200px;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .big--E39S {\n width: 400px;\n height: 400px;\n}\n";
22348
+ var css_248z$d = ".diva-component-DIVA_BACKOFFICE_NEW .ant-upload-wrapper {\n width: 100%;\n height: 100%;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-spin-nested-loading {\n width: 100%;\n height: 100%;\n}\n.diva-component-DIVA_BACKOFFICE_NEW .ant-table-wrapper, .diva-component-DIVA_BACKOFFICE_NEW .ant-table {\n height: inherit;\n overflow: auto;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-drawer-body .ant-spin-nested-loading {\n width: 100%;\n height: 80%;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-spin-container {\n width: 100%;\n height: 100%;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .andt-table .ant-spin-container {\n display: flex;\n flex-direction: column;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-space-item .andt-table .ant-spin-container {\n height: calc(60vh - 90px);\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .andt-table .ant-table-container {\n height: calc(100% - 80px);\n}\n.diva-component-DIVA_BACKOFFICE_NEW .ant-upload-list {\n width: 100%;\n height: 100%;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-upload-list-item-container {\n width: 100% !important;\n height: 100% !important;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-upload-select {\n width: 100% !important;\n height: 100% !important;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .small-NY1-k {\n width: 104px;\n height: 104px;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .medium---QcO {\n width: 200px;\n height: 200px;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .big--E39S {\n width: 400px;\n height: 400px;\n}\n";
22417
22349
  styleInject(css_248z$d);
22418
22350
 
22419
22351
  var MediaUpload = observer(function (_ref) {
@@ -22812,6 +22744,8 @@ if (!window.customElements.get('model-viewer')) {
22812
22744
  function MediaViewerCell (_ref) {
22813
22745
  var children = _ref.children,
22814
22746
  column = _ref.column;
22747
+ var _useDivaCore = useDivaCore(),
22748
+ isFirefox = _useDivaCore.state.isFirefox;
22815
22749
  if (!(children !== null && children !== void 0 && children[1])) {
22816
22750
  return /*#__PURE__*/jsx(Fragment, {});
22817
22751
  }
@@ -22857,7 +22791,7 @@ function MediaViewerCell (_ref) {
22857
22791
  src: children[1],
22858
22792
  ar: true,
22859
22793
  "ar-scale": 'fixed',
22860
- "ar-modes": 'webxr quick-look',
22794
+ "ar-modes": !isFirefox ? 'webxr quick-look' : '',
22861
22795
  "shadow-intensity": "1",
22862
22796
  "camera-controls": true,
22863
22797
  "touch-action": "pan-y",
@@ -22997,6 +22931,8 @@ function MediaItemViewerCell (_ref) {
22997
22931
  timeStamp = _useState4[0],
22998
22932
  setTimeStamp = _useState4[1];
22999
22933
  var id;
22934
+ var _useDivaCore = useDivaCore(),
22935
+ isFirefox = _useDivaCore.state.isFirefox;
23000
22936
 
23001
22937
  //! for renderjob table mediaItems because can't filter mediaItems.0
23002
22938
  if (Array.isArray(children[1])) {
@@ -23028,9 +22964,9 @@ function MediaItemViewerCell (_ref) {
23028
22964
  });
23029
22965
  }, [timeStamp, id]);
23030
22966
  if (!id) return /*#__PURE__*/jsx(FileUnknownOutlined, {});
23031
- var _useDivaCore = useDivaCore(),
23032
- handler = _useDivaCore.handler,
23033
- actions = _useDivaCore.actions;
22967
+ var _useDivaCore2 = useDivaCore(),
22968
+ handler = _useDivaCore2.handler,
22969
+ actions = _useDivaCore2.actions;
23034
22970
  var openModelViewer = function openModelViewer() {
23035
22971
  actions.openFullscreen({
23036
22972
  content: /*#__PURE__*/jsx("model-viewer", {
@@ -23038,7 +22974,7 @@ function MediaItemViewerCell (_ref) {
23038
22974
  src: children[1],
23039
22975
  ar: true,
23040
22976
  "ar-scale": 'fixed',
23041
- "ar-modes": 'webxr quick-look',
22977
+ "ar-modes": !isFirefox ? 'webxr quick-look' : '',
23042
22978
  "shadow-intensity": "1",
23043
22979
  "camera-controls": true,
23044
22980
  "touch-action": "pan-y",
@@ -23595,7 +23531,7 @@ dayjs.extend(weekYear);
23595
23531
  Select$1.Option;
23596
23532
  var LOG$3 = getLogger('Backoffice', 'BaseTable');
23597
23533
  var TableWrapper = function TableWrapper(_ref) {
23598
- var _state$configuration$, _state$configuration$2, _state$configuration$3, _state$configuration$4, _state$configuration$5, _state$configuration$6, _state$globalFilter, _state$globalFilter2, _state$globalFilter3, _state$globalFilter4, _state$configuration$7, _state$configuration$8, _state$globalFilter$s, _state$configuration$9, _state$configuration$10, _state$configuration$11, _state$selected2, _state$configuration$12, _state$configuration$13, _state$configuration$14, _state$configuration$17, _state$configuration$18, _state$configuration$19;
23534
+ var _state$configuration$, _toggleConfig$label, _toggleConfig$labelOf, _state$globalFilter, _state$configuration$2, _state$configuration$3, _state$globalFilter2, _state$globalFilter3, _state$globalFilter4, _state$globalFilter5, _state$configuration$4, _state$configuration$5, _state$globalFilter$s, _state$configuration$6, _state$configuration$7, _state$configuration$8, _state$selected2, _state$configuration$9, _state$configuration$10, _state$configuration$11, _state$configuration$14, _state$configuration$15, _state$configuration$16;
23599
23535
  var state = _ref.state;
23600
23536
  var root = useStore();
23601
23537
  var _useState = useState(0),
@@ -23689,6 +23625,7 @@ var TableWrapper = function TableWrapper(_ref) {
23689
23625
  if (!permission) return true;
23690
23626
  return root.actions.userHasPermission(permission);
23691
23627
  }
23628
+ var toggleConfig = (_state$configuration$ = state.configuration.filter) === null || _state$configuration$ === void 0 ? void 0 : _state$configuration$.toggle;
23692
23629
  return /*#__PURE__*/jsxs(Fragment, {
23693
23630
  children: [(state.canDelete || state.configuration.createAction || state.title || state.configuration.canRefresh || state.configuration.clientRelations) && /*#__PURE__*/jsx(Fragment, {
23694
23631
  children: /*#__PURE__*/jsx(Descriptions, {
@@ -23747,16 +23684,17 @@ var TableWrapper = function TableWrapper(_ref) {
23747
23684
  state.triggerRefresh();
23748
23685
  },
23749
23686
  children: /*#__PURE__*/jsx(ReloadOutlined, {})
23750
- }), ((_state$configuration$ = state.configuration.filter) === null || _state$configuration$ === void 0 ? void 0 : _state$configuration$.toggle) && (!state.configuration.filter.toggle.permission || root.actions.userHasPermission(state.configuration.filter.toggle.permission)) && /*#__PURE__*/jsx("div", {
23687
+ }), toggleConfig && (!toggleConfig.permission || root.actions.userHasPermission(toggleConfig.permission)) && /*#__PURE__*/jsx("div", {
23751
23688
  children: /*#__PURE__*/jsx(Switch, {
23752
- defaultChecked: (_state$configuration$2 = state.configuration.filter) === null || _state$configuration$2 === void 0 ? void 0 : _state$configuration$2.toggle.defaultChecked,
23753
- checkedChildren: (_state$configuration$3 = state.configuration.filter.toggle.label) !== null && _state$configuration$3 !== void 0 ? _state$configuration$3 : 'unfiltered',
23754
- unCheckedChildren: (_state$configuration$4 = state.configuration.filter.toggle.labelOff) !== null && _state$configuration$4 !== void 0 ? _state$configuration$4 : 'filtered',
23689
+ defaultChecked: toggleConfig.defaultChecked,
23690
+ checkedChildren: (_toggleConfig$label = toggleConfig.label) !== null && _toggleConfig$label !== void 0 ? _toggleConfig$label : 'unfiltered',
23691
+ unCheckedChildren: (_toggleConfig$labelOf = toggleConfig.labelOff) !== null && _toggleConfig$labelOf !== void 0 ? _toggleConfig$labelOf : 'filtered',
23755
23692
  onChange: function onChange() {
23756
23693
  return state.onGlobalFilterToggle();
23757
- }
23694
+ },
23695
+ checked: !!((_state$globalFilter = state.globalFilter) !== null && _state$globalFilter !== void 0 && _state$globalFilter.toggle) != !!toggleConfig.inverted
23758
23696
  })
23759
- }), ((_state$configuration$5 = state.configuration.filter) === null || _state$configuration$5 === void 0 ? void 0 : _state$configuration$5.search) && /*#__PURE__*/jsx(Input.Search, {
23697
+ }), ((_state$configuration$2 = state.configuration.filter) === null || _state$configuration$2 === void 0 ? void 0 : _state$configuration$2.search) && /*#__PURE__*/jsx(Input.Search, {
23760
23698
  placeholder: t('filter.global'),
23761
23699
  onSearch: function onSearch(v) {
23762
23700
  return state.onGlobalFilterSearch(v);
@@ -23765,17 +23703,17 @@ var TableWrapper = function TableWrapper(_ref) {
23765
23703
  style: {
23766
23704
  width: 200
23767
23705
  }
23768
- }), ((_state$configuration$6 = state.configuration.filter) === null || _state$configuration$6 === void 0 ? void 0 : _state$configuration$6.period) && /*#__PURE__*/jsx(DatePicker.RangePicker, {
23706
+ }), ((_state$configuration$3 = state.configuration.filter) === null || _state$configuration$3 === void 0 ? void 0 : _state$configuration$3.period) && /*#__PURE__*/jsx(DatePicker.RangePicker, {
23769
23707
  onCalendarChange: function onCalendarChange(values) {
23770
23708
  if (values && values[0] && values[1]) {
23771
23709
  state.onGlobalFilterPeriod(values[0].valueOf(), values[1].valueOf());
23772
23710
  }
23773
23711
  },
23774
- value: [(_state$globalFilter = state.globalFilter) !== null && _state$globalFilter !== void 0 && (_state$globalFilter = _state$globalFilter.timeStamp) !== null && _state$globalFilter !== void 0 && (_state$globalFilter = _state$globalFilter['fromTimeStamp']) !== null && _state$globalFilter !== void 0 && _state$globalFilter[0] ? dayjs((_state$globalFilter2 = state.globalFilter) === null || _state$globalFilter2 === void 0 || (_state$globalFilter2 = _state$globalFilter2.timeStamp) === null || _state$globalFilter2 === void 0 || (_state$globalFilter2 = _state$globalFilter2['fromTimeStamp']) === null || _state$globalFilter2 === void 0 ? void 0 : _state$globalFilter2[0]) : dayjs(new Date(Date.now() - 30 * 24 * 60 * 60 * 1000)),
23712
+ value: [(_state$globalFilter2 = state.globalFilter) !== null && _state$globalFilter2 !== void 0 && (_state$globalFilter2 = _state$globalFilter2.timeStamp) !== null && _state$globalFilter2 !== void 0 && (_state$globalFilter2 = _state$globalFilter2['fromTimeStamp']) !== null && _state$globalFilter2 !== void 0 && _state$globalFilter2[0] ? dayjs((_state$globalFilter3 = state.globalFilter) === null || _state$globalFilter3 === void 0 || (_state$globalFilter3 = _state$globalFilter3.timeStamp) === null || _state$globalFilter3 === void 0 || (_state$globalFilter3 = _state$globalFilter3['fromTimeStamp']) === null || _state$globalFilter3 === void 0 ? void 0 : _state$globalFilter3[0]) : dayjs(new Date(Date.now() - 30 * 24 * 60 * 60 * 1000)),
23775
23713
  // Convert to Dayjs
23776
- (_state$globalFilter3 = state.globalFilter) !== null && _state$globalFilter3 !== void 0 && (_state$globalFilter3 = _state$globalFilter3.timeStamp) !== null && _state$globalFilter3 !== void 0 && (_state$globalFilter3 = _state$globalFilter3['toTimeStamp']) !== null && _state$globalFilter3 !== void 0 && _state$globalFilter3[0] ? dayjs((_state$globalFilter4 = state.globalFilter) === null || _state$globalFilter4 === void 0 || (_state$globalFilter4 = _state$globalFilter4.timeStamp) === null || _state$globalFilter4 === void 0 || (_state$globalFilter4 = _state$globalFilter4['toTimeStamp']) === null || _state$globalFilter4 === void 0 ? void 0 : _state$globalFilter4[0]) : dayjs(new Date()) // Convert to Dayjs
23714
+ (_state$globalFilter4 = state.globalFilter) !== null && _state$globalFilter4 !== void 0 && (_state$globalFilter4 = _state$globalFilter4.timeStamp) !== null && _state$globalFilter4 !== void 0 && (_state$globalFilter4 = _state$globalFilter4['toTimeStamp']) !== null && _state$globalFilter4 !== void 0 && _state$globalFilter4[0] ? dayjs((_state$globalFilter5 = state.globalFilter) === null || _state$globalFilter5 === void 0 || (_state$globalFilter5 = _state$globalFilter5.timeStamp) === null || _state$globalFilter5 === void 0 || (_state$globalFilter5 = _state$globalFilter5['toTimeStamp']) === null || _state$globalFilter5 === void 0 ? void 0 : _state$globalFilter5[0]) : dayjs(new Date()) // Convert to Dayjs
23777
23715
  ]
23778
- }), ((_state$configuration$7 = state.configuration.filter) === null || _state$configuration$7 === void 0 ? void 0 : _state$configuration$7.select) && /*#__PURE__*/jsx(SimpleSelect, _objectSpread$l(_objectSpread$l({}, (_state$configuration$8 = state.configuration.filter) === null || _state$configuration$8 === void 0 ? void 0 : _state$configuration$8.select.settings), {}, {
23716
+ }), ((_state$configuration$4 = state.configuration.filter) === null || _state$configuration$4 === void 0 ? void 0 : _state$configuration$4.select) && /*#__PURE__*/jsx(SimpleSelect, _objectSpread$l(_objectSpread$l({}, (_state$configuration$5 = state.configuration.filter) === null || _state$configuration$5 === void 0 ? void 0 : _state$configuration$5.select.settings), {}, {
23779
23717
  style: {
23780
23718
  minWidth: '200px'
23781
23719
  },
@@ -23788,17 +23726,17 @@ var TableWrapper = function TableWrapper(_ref) {
23788
23726
  }), state.canDelete && /*#__PURE__*/jsx(DeleteButton, {
23789
23727
  selected: state.selected,
23790
23728
  total: state.pagination.total,
23791
- min: (_state$configuration$9 = state.configuration.rules) === null || _state$configuration$9 === void 0 ? void 0 : _state$configuration$9.min,
23729
+ min: (_state$configuration$6 = state.configuration.rules) === null || _state$configuration$6 === void 0 ? void 0 : _state$configuration$6.min,
23792
23730
  deleting: state.deleting,
23793
23731
  onDelete: state.onDelete,
23794
- disabled: !!((_state$configuration$10 = state.configuration.deleteAction) !== null && _state$configuration$10 !== void 0 && (_state$configuration$11 = _state$configuration$10.disabled) !== null && _state$configuration$11 !== void 0 && _state$configuration$11.call(_state$configuration$10, ((_state$selected2 = state.selected) !== null && _state$selected2 !== void 0 ? _state$selected2 : []).map(function (id) {
23732
+ disabled: !!((_state$configuration$7 = state.configuration.deleteAction) !== null && _state$configuration$7 !== void 0 && (_state$configuration$8 = _state$configuration$7.disabled) !== null && _state$configuration$8 !== void 0 && _state$configuration$8.call(_state$configuration$7, ((_state$selected2 = state.selected) !== null && _state$selected2 !== void 0 ? _state$selected2 : []).map(function (id) {
23795
23733
  return state.data.find(function (d) {
23796
23734
  return d._id == id;
23797
23735
  });
23798
23736
  })))
23799
23737
  }), state.configuration.copyAction !== undefined && /*#__PURE__*/jsx(CopyButton, {
23800
23738
  state: state
23801
- }), (_state$configuration$12 = state.configuration.bulkActions) === null || _state$configuration$12 === void 0 ? void 0 : _state$configuration$12.map(function (action) {
23739
+ }), (_state$configuration$9 = state.configuration.bulkActions) === null || _state$configuration$9 === void 0 ? void 0 : _state$configuration$9.map(function (action) {
23802
23740
  return /*#__PURE__*/jsx(BulkAction, {
23803
23741
  action: action,
23804
23742
  state: state,
@@ -23809,18 +23747,18 @@ var TableWrapper = function TableWrapper(_ref) {
23809
23747
  setProgressBarPercentage: setProgressBarPercentage
23810
23748
  } : undefined
23811
23749
  }, action.id);
23812
- }), state.configuration.createAction && checkPermission(state.configuration.createAction.permission) && !((_state$configuration$13 = (_state$configuration$14 = state.configuration.createAction).hidden) !== null && _state$configuration$13 !== void 0 && _state$configuration$13.call(_state$configuration$14, data)) && /*#__PURE__*/jsx(ActionButton, {
23750
+ }), state.configuration.createAction && checkPermission(state.configuration.createAction.permission) && !((_state$configuration$10 = (_state$configuration$11 = state.configuration.createAction).hidden) !== null && _state$configuration$10 !== void 0 && _state$configuration$10.call(_state$configuration$11, data)) && /*#__PURE__*/jsx(ActionButton, {
23813
23751
  action: state.configuration.createAction,
23814
23752
  callback: function callback(data) {
23815
- var _state$onUpdate, _state$configuration$15, _state$configuration$16;
23753
+ var _state$onUpdate, _state$configuration$12, _state$configuration$13;
23816
23754
  (_state$onUpdate = state.onUpdate) === null || _state$onUpdate === void 0 || _state$onUpdate.call(state, data);
23817
- (_state$configuration$15 = state.configuration.createAction) === null || _state$configuration$15 === void 0 || (_state$configuration$16 = _state$configuration$15.callback) === null || _state$configuration$16 === void 0 || _state$configuration$16.call(_state$configuration$15, data);
23755
+ (_state$configuration$12 = state.configuration.createAction) === null || _state$configuration$12 === void 0 || (_state$configuration$13 = _state$configuration$12.callback) === null || _state$configuration$13 === void 0 || _state$configuration$13.call(_state$configuration$12, data);
23818
23756
  },
23819
23757
  type: "Button",
23820
23758
  id: 'create',
23821
23759
  defaultLabel: t('backoffice.table.emailtemplates.createAction.title'),
23822
23760
  isCreateButton: true,
23823
- disabled: state.configuration.createAction.disableOnToggle === !!state.globalFilter.toggle || ((_state$configuration$17 = (_state$configuration$18 = state.configuration.createAction).disabled) === null || _state$configuration$17 === void 0 ? void 0 : _state$configuration$17.call(_state$configuration$18, data)),
23761
+ disabled: state.configuration.createAction.disableOnToggle === !!state.globalFilter.toggle || ((_state$configuration$14 = (_state$configuration$15 = state.configuration.createAction).disabled) === null || _state$configuration$14 === void 0 ? void 0 : _state$configuration$14.call(_state$configuration$15, data)),
23824
23762
  data: state.configuration.createActionMapping ? aplyMapping({
23825
23763
  mapable: {},
23826
23764
  mapping: state.configuration.createActionMapping,
@@ -23868,13 +23806,13 @@ var TableWrapper = function TableWrapper(_ref) {
23868
23806
  className: "andt-table",
23869
23807
  scroll: {
23870
23808
  x: '100%',
23871
- y: (_state$configuration$19 = state.configuration.height) !== null && _state$configuration$19 !== void 0 ? _state$configuration$19 : '100%'
23809
+ y: (_state$configuration$16 = state.configuration.height) !== null && _state$configuration$16 !== void 0 ? _state$configuration$16 : '100%'
23872
23810
  },
23873
23811
  rowClassName: editableRow,
23874
23812
  components: cellRenderer,
23875
23813
  rowKey: function rowKey(dataRow) {
23876
- var _state$configuration$20, _state$configuration$21;
23877
- return goTroughObject(dataRow, (_state$configuration$20 = (_state$configuration$21 = state.configuration.rowKey) === null || _state$configuration$21 === void 0 ? void 0 : _state$configuration$21.split('.')) !== null && _state$configuration$20 !== void 0 ? _state$configuration$20 : ['_id'], 0);
23814
+ var _state$configuration$17, _state$configuration$18;
23815
+ return goTroughObject(dataRow, (_state$configuration$17 = (_state$configuration$18 = state.configuration.rowKey) === null || _state$configuration$18 === void 0 ? void 0 : _state$configuration$18.split('.')) !== null && _state$configuration$17 !== void 0 ? _state$configuration$17 : ['_id'], 0);
23878
23816
  },
23879
23817
  dataSource: data,
23880
23818
  loading: state.loading,
@@ -23944,22 +23882,22 @@ function DeleteButton(_ref2) {
23944
23882
  });
23945
23883
  }
23946
23884
  function CopyButton(_ref3) {
23947
- var _state$configuration$25;
23885
+ var _state$configuration$22;
23948
23886
  var state = _ref3.state;
23949
23887
  var root = useStore();
23950
- var apiHandler = new _default$d({
23888
+ new _default$d({
23951
23889
  apiInterface: state.configuration.apiInterface,
23952
23890
  type: 'Table'
23953
23891
  }, root);
23954
23892
  var onCopy = /*#__PURE__*/function () {
23955
23893
  var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
23956
- var _state$configuration$22;
23894
+ var _state$configuration$19;
23957
23895
  var copyAction, _iterator3, _step3, selectedRow;
23958
23896
  return _regeneratorRuntime.wrap(function _callee$(_context) {
23959
23897
  while (1) switch (_context.prev = _context.next) {
23960
23898
  case 0:
23961
23899
  copyAction = state.configuration.copyAction;
23962
- if (((_state$configuration$22 = state.configuration.copyAction) === null || _state$configuration$22 === void 0 ? void 0 : _state$configuration$22.apiInterface) != undefined) {
23900
+ if (((_state$configuration$19 = state.configuration.copyAction) === null || _state$configuration$19 === void 0 ? void 0 : _state$configuration$19.apiInterface) != undefined) {
23963
23901
  _iterator3 = _createForOfIteratorHelper$4(state.selected);
23964
23902
  try {
23965
23903
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
@@ -23994,28 +23932,22 @@ function CopyButton(_ref3) {
23994
23932
  }();
23995
23933
  var onCopyAction = /*#__PURE__*/function () {
23996
23934
  var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
23997
- var _state$configuration$23, _state$configuration$24;
23998
- var copyAction, id, filter, data;
23935
+ var _state$configuration$20, _state$configuration$21;
23936
+ var copyAction, id, data;
23999
23937
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
24000
23938
  while (1) switch (_context3.prev = _context3.next) {
24001
23939
  case 0:
24002
23940
  copyAction = state.configuration.copyAction;
24003
- if (!(copyAction.id == undefined || copyAction.actionType != 'Detail' || ((_state$configuration$23 = state.configuration.createAction) === null || _state$configuration$23 === void 0 ? void 0 : _state$configuration$23.actionType) != 'Detail')) {
23941
+ if (!(copyAction.id == undefined || copyAction.actionType != 'Detail' || ((_state$configuration$20 = state.configuration.createAction) === null || _state$configuration$20 === void 0 ? void 0 : _state$configuration$20.actionType) != 'Detail')) {
24004
23942
  _context3.next = 3;
24005
23943
  break;
24006
23944
  }
24007
23945
  throw new Error('configuration needs to be of type Detail');
24008
23946
  case 3:
24009
23947
  id = state.selected[0];
24010
- filter = {};
24011
- filter['_id'] = [id, 'eq', false];
24012
- _context3.next = 8;
24013
- return apiHandler.readList(undefined, undefined, {
24014
- pagination: {},
24015
- columns: [],
24016
- filters: filter
24017
- });
24018
- case 8:
23948
+ _context3.next = 6;
23949
+ return state.getDataById(id);
23950
+ case 6:
24019
23951
  data = _context3.sent;
24020
23952
  data.data[0] = aplyMapping({
24021
23953
  mapable: {},
@@ -24030,7 +23962,7 @@ function CopyButton(_ref3) {
24030
23962
  configurationId: copyAction === null || copyAction === void 0 ? void 0 : copyAction.id,
24031
23963
  data: data.data[0],
24032
23964
  type: copyAction === null || copyAction === void 0 ? void 0 : copyAction.type,
24033
- mapping: (_state$configuration$24 = state.configuration.createAction) === null || _state$configuration$24 === void 0 ? void 0 : _state$configuration$24.mapping,
23965
+ mapping: (_state$configuration$21 = state.configuration.createAction) === null || _state$configuration$21 === void 0 ? void 0 : _state$configuration$21.mapping,
24034
23966
  mappingData: data.data[0],
24035
23967
  callback: function () {
24036
23968
  var _callback = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(e) {
@@ -24040,6 +23972,8 @@ function CopyButton(_ref3) {
24040
23972
  _context2.next = 2;
24041
23973
  return state.onUpdate(e);
24042
23974
  case 2:
23975
+ if (copyAction.resetToggleAfter) state.resetToggle();
23976
+ case 3:
24043
23977
  case "end":
24044
23978
  return _context2.stop();
24045
23979
  }
@@ -24051,7 +23985,7 @@ function CopyButton(_ref3) {
24051
23985
  return callback;
24052
23986
  }()
24053
23987
  });
24054
- case 11:
23988
+ case 9:
24055
23989
  case "end":
24056
23990
  return _context3.stop();
24057
23991
  }
@@ -24066,7 +24000,7 @@ function CopyButton(_ref3) {
24066
24000
  return /*#__PURE__*/jsx(Button, {
24067
24001
  type: "primary",
24068
24002
  onClick: onCopy,
24069
- disabled: state.selected.length == 0 || state.selected.length > 1 && ((_state$configuration$25 = state.configuration.copyAction) === null || _state$configuration$25 === void 0 ? void 0 : _state$configuration$25.disableOnMultiselect),
24003
+ disabled: state.selected.length == 0 || state.selected.length > 1 && ((_state$configuration$22 = state.configuration.copyAction) === null || _state$configuration$22 === void 0 ? void 0 : _state$configuration$22.disableOnMultiselect),
24070
24004
  children: t('backoffice.basetable.copy')
24071
24005
  });
24072
24006
  }
@@ -24285,6 +24219,8 @@ function BulkAction(_ref6) {
24285
24219
  }
24286
24220
  function SelectionText(_ref8) {
24287
24221
  var selected = _ref8.selected;
24222
+ var _useTranslation5 = useTranslation(),
24223
+ t = _useTranslation5.t;
24288
24224
  if (!(selected !== null && selected !== void 0 && selected.length)) {
24289
24225
  return /*#__PURE__*/jsx(Fragment, {});
24290
24226
  }
@@ -24294,7 +24230,7 @@ function SelectionText(_ref8) {
24294
24230
  fontWeight: 'normal',
24295
24231
  fontSize: 'small'
24296
24232
  },
24297
- children: "".concat(selected.length, " Eintr\xE4ge ausgew\xE4hlt")
24233
+ children: "".concat(selected.length, " ") + t('backoffice.table.selected_entries')
24298
24234
  });
24299
24235
  }
24300
24236
 
@@ -25178,16 +25114,44 @@ function useTableData$1 (_ref) {
25178
25114
  });
25179
25115
  }
25180
25116
  };
25117
+ var getDataById = /*#__PURE__*/function () {
25118
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(id) {
25119
+ var filters, data;
25120
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
25121
+ while (1) switch (_context.prev = _context.next) {
25122
+ case 0:
25123
+ filters = {};
25124
+ filters['_id'] = [id, 'eq', false];
25125
+ _context.next = 4;
25126
+ return apiHandler.readList(configuration.mapping, {
25127
+ pagination: _objectSpread$h({}, state.pagination),
25128
+ columns: configuration.columns,
25129
+ filters: filters,
25130
+ sorter: filterData.sorter
25131
+ });
25132
+ case 4:
25133
+ data = _context.sent;
25134
+ return _context.abrupt("return", data);
25135
+ case 6:
25136
+ case "end":
25137
+ return _context.stop();
25138
+ }
25139
+ }, _callee);
25140
+ }));
25141
+ return function getDataById(_x) {
25142
+ return _ref2.apply(this, arguments);
25143
+ };
25144
+ }();
25181
25145
  var onSelect = function onSelect(keys) {
25182
25146
  setState(_objectSpread$h(_objectSpread$h({}, state), {}, {
25183
25147
  selected: keys
25184
25148
  }));
25185
25149
  };
25186
25150
  var onDelete = /*#__PURE__*/function () {
25187
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
25151
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
25188
25152
  var newData, deleted, _loop, mappingData, index, total, pages, current, data;
25189
- return _regeneratorRuntime.wrap(function _callee$(_context2) {
25190
- while (1) switch (_context2.prev = _context2.next) {
25153
+ return _regeneratorRuntime.wrap(function _callee2$(_context3) {
25154
+ while (1) switch (_context3.prev = _context3.next) {
25191
25155
  case 0:
25192
25156
  setState(_objectSpread$h(_objectSpread$h({}, state), {}, {
25193
25157
  deleting: true
@@ -25197,24 +25161,24 @@ function useTableData$1 (_ref) {
25197
25161
  _loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop(index) {
25198
25162
  var _newData$filter, _configuration$delete;
25199
25163
  var id, deleteResult, deletedIndex;
25200
- return _regeneratorRuntime.wrap(function _loop$(_context) {
25201
- while (1) switch (_context.prev = _context.next) {
25164
+ return _regeneratorRuntime.wrap(function _loop$(_context2) {
25165
+ while (1) switch (_context2.prev = _context2.next) {
25202
25166
  case 0:
25203
25167
  id = state.selected[index];
25204
25168
  mappingData = (_newData$filter = newData.filter(function (nd) {
25205
25169
  return nd._id === state.selected[index];
25206
25170
  })) === null || _newData$filter === void 0 ? void 0 : _newData$filter[0];
25207
25171
  mappingData = _objectSpread$h(_objectSpread$h({}, mappingData), state.mappingData);
25208
- _context.next = 5;
25172
+ _context2.next = 5;
25209
25173
  return apiHandler["delete"](id, (_configuration$delete = configuration.deleteMapping) !== null && _configuration$delete !== void 0 ? _configuration$delete : configuration.mapping, mappingData, true);
25210
25174
  case 5:
25211
- deleteResult = _context.sent;
25175
+ deleteResult = _context2.sent;
25212
25176
  if (deleteResult) {
25213
- _context.next = 9;
25177
+ _context2.next = 9;
25214
25178
  break;
25215
25179
  }
25216
25180
  setError('Fehler beim löschen eines Elementes.');
25217
- return _context.abrupt("return", 1);
25181
+ return _context2.abrupt("return", 1);
25218
25182
  case 9:
25219
25183
  deletedIndex = newData.findIndex(function (d) {
25220
25184
  return (d === null || d === void 0 ? void 0 : d._id) == id;
@@ -25223,36 +25187,36 @@ function useTableData$1 (_ref) {
25223
25187
  deleted++;
25224
25188
  case 12:
25225
25189
  case "end":
25226
- return _context.stop();
25190
+ return _context2.stop();
25227
25191
  }
25228
25192
  }, _loop);
25229
25193
  });
25230
25194
  index = 0;
25231
25195
  case 5:
25232
25196
  if (!(index < state.selected.length)) {
25233
- _context2.next = 12;
25197
+ _context3.next = 12;
25234
25198
  break;
25235
25199
  }
25236
- return _context2.delegateYield(_loop(index), "t0", 7);
25200
+ return _context3.delegateYield(_loop(index), "t0", 7);
25237
25201
  case 7:
25238
- if (!_context2.t0) {
25239
- _context2.next = 9;
25202
+ if (!_context3.t0) {
25203
+ _context3.next = 9;
25240
25204
  break;
25241
25205
  }
25242
- return _context2.abrupt("continue", 9);
25206
+ return _context3.abrupt("continue", 9);
25243
25207
  case 9:
25244
25208
  index++;
25245
- _context2.next = 5;
25209
+ _context3.next = 5;
25246
25210
  break;
25247
25211
  case 12:
25248
25212
  total = state.pagination.total - deleted;
25249
25213
  pages = Math.ceil(total / state.pagination.pageSize);
25250
25214
  current = state.pagination.current > pages ? pages || 1 : state.pagination.current;
25251
25215
  if (!(pages > 0 && state.pagination.current > pages && filterServerSide || state.selected.length === 0)) {
25252
- _context2.next = 21;
25216
+ _context3.next = 21;
25253
25217
  break;
25254
25218
  }
25255
- _context2.next = 18;
25219
+ _context3.next = 18;
25256
25220
  return apiHandler.readList(configuration.mapping, {
25257
25221
  pagination: _objectSpread$h(_objectSpread$h({}, state.pagination), {}, {
25258
25222
  current: current
@@ -25262,7 +25226,7 @@ function useTableData$1 (_ref) {
25262
25226
  sorter: filterData.sorter
25263
25227
  });
25264
25228
  case 18:
25265
- data = _context2.sent;
25229
+ data = _context3.sent;
25266
25230
  newData = data.data;
25267
25231
  total = data.total;
25268
25232
  case 21:
@@ -25277,12 +25241,12 @@ function useTableData$1 (_ref) {
25277
25241
  }));
25278
25242
  case 22:
25279
25243
  case "end":
25280
- return _context2.stop();
25244
+ return _context3.stop();
25281
25245
  }
25282
- }, _callee);
25246
+ }, _callee2);
25283
25247
  }));
25284
25248
  return function onDelete() {
25285
- return _ref2.apply(this, arguments);
25249
+ return _ref3.apply(this, arguments);
25286
25250
  };
25287
25251
  }();
25288
25252
  function setLoading() {
@@ -25302,6 +25266,10 @@ function useTableData$1 (_ref) {
25302
25266
  onChange: onChange,
25303
25267
  onUpdate: onUpdate,
25304
25268
  onDelete: onDelete,
25269
+ getDataById: getDataById,
25270
+ resetToggle: function resetToggle() {
25271
+ throw new Error('not implemented for CatalogTable');
25272
+ },
25305
25273
  triggerRefresh: function triggerRefresh() {
25306
25274
  throw new Error('not implemented for CatalogTable');
25307
25275
  },
@@ -25651,38 +25619,74 @@ function useTableData (_ref) {
25651
25619
  }
25652
25620
  return title;
25653
25621
  }, [configuration.title, parentData]);
25622
+ var getDataById = /*#__PURE__*/function () {
25623
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(id) {
25624
+ var _configuration$filter9;
25625
+ var filters, ssf, data;
25626
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
25627
+ while (1) switch (_context2.prev = _context2.next) {
25628
+ case 0:
25629
+ filters = {};
25630
+ filters['_id'] = [id, 'eq', false];
25631
+ ssf = _objectSpread$g({
25632
+ pagination: {
25633
+ current: 1,
25634
+ pageSize: 1
25635
+ },
25636
+ columns: configuration.columns,
25637
+ filters: filters
25638
+ }, configuration !== null && configuration !== void 0 && (_configuration$filter9 = configuration.filter) !== null && _configuration$filter9 !== void 0 && (_configuration$filter9 = _configuration$filter9.toggle) !== null && _configuration$filter9 !== void 0 && _configuration$filter9.inQuery ? {
25639
+ genericProps: globalFilter.toggle
25640
+ } : undefined);
25641
+ _context2.next = 5;
25642
+ return apiHandler.readList(parentMapping || configuration.mapping, mapping, ssf);
25643
+ case 5:
25644
+ data = _context2.sent;
25645
+ return _context2.abrupt("return", data);
25646
+ case 7:
25647
+ case "end":
25648
+ return _context2.stop();
25649
+ }
25650
+ }, _callee2);
25651
+ }));
25652
+ return function getDataById(_x2) {
25653
+ return _ref4.apply(this, arguments);
25654
+ };
25655
+ }();
25654
25656
  var onChange = /*#__PURE__*/function () {
25655
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(p) {
25656
- var _configuration$filter9, _configuration$filter10, _configuration$filter11, _prefilter$select, _configuration$filter12, _configuration$filter13;
25657
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(p) {
25658
+ var _configuration$filter10, _configuration$filter11, _configuration$filter12, _prefilter$select, _configuration$filter13, _configuration$filter14;
25657
25659
  var prefilter,
25658
25660
  refresh,
25661
+ clearSelection,
25659
25662
  currentData,
25660
25663
  filterData,
25661
25664
  currentFilterHash,
25662
25665
  currentPagination,
25663
25666
  currentUrl,
25664
- _configuration$filter14,
25667
+ _configuration$filter15,
25665
25668
  ssf,
25666
25669
  data,
25667
25670
  _data3,
25668
25671
  _aplyFilterAndSortati2,
25669
25672
  _data4,
25670
25673
  pagination,
25671
- _args2 = arguments;
25672
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
25673
- while (1) switch (_context2.prev = _context2.next) {
25674
+ _args3 = arguments;
25675
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
25676
+ while (1) switch (_context3.prev = _context3.next) {
25674
25677
  case 0:
25675
- prefilter = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : globalFilter;
25676
- refresh = _args2.length > 2 ? _args2[2] : undefined;
25678
+ prefilter = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : globalFilter;
25679
+ refresh = _args3.length > 2 ? _args3[2] : undefined;
25680
+ clearSelection = _args3.length > 3 ? _args3[3] : undefined;
25677
25681
  setState(_objectSpread$g(_objectSpread$g({}, state), {}, {
25678
25682
  loading: true
25679
25683
  }));
25680
25684
  currentData = initData;
25681
- filterData = _objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g({}, p.filters), prefilter.search), !(configuration !== null && configuration !== void 0 && (_configuration$filter9 = configuration.filter) !== null && _configuration$filter9 !== void 0 && (_configuration$filter9 = _configuration$filter9.toggle) !== null && _configuration$filter9 !== void 0 && _configuration$filter9.inQuery) ? prefilter.toggle : undefined), ((_configuration$filter10 = configuration.filter) === null || _configuration$filter10 === void 0 || (_configuration$filter10 = _configuration$filter10.select) === null || _configuration$filter10 === void 0 ? void 0 : _configuration$filter10.applyDefaultValue) !== false || ((_configuration$filter11 = configuration.filter) === null || _configuration$filter11 === void 0 || (_configuration$filter11 = _configuration$filter11.select) === null || _configuration$filter11 === void 0 ? void 0 : _configuration$filter11.defaultValue) !== ((_prefilter$select = prefilter.select) === null || _prefilter$select === void 0 || (_prefilter$select = _prefilter$select[(_configuration$filter12 = (_configuration$filter13 = configuration.filter) === null || _configuration$filter13 === void 0 || (_configuration$filter13 = _configuration$filter13.select) === null || _configuration$filter13 === void 0 ? void 0 : _configuration$filter13.filterField) !== null && _configuration$filter12 !== void 0 ? _configuration$filter12 : '']) === null || _prefilter$select === void 0 ? void 0 : _prefilter$select[0]) ? prefilter.select : undefined), prefilter.timeStamp), prefilter["default"]); //remove all null values
25682
- filterData = Object.fromEntries(Object.entries(filterData).filter(function (_ref5) {
25683
- var _ref6 = _slicedToArray(_ref5, 2);
25684
- _ref6[0];
25685
- var v = _ref6[1];
25685
+ filterData = _objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g({}, p.filters), prefilter.search), !(configuration !== null && configuration !== void 0 && (_configuration$filter10 = configuration.filter) !== null && _configuration$filter10 !== void 0 && (_configuration$filter10 = _configuration$filter10.toggle) !== null && _configuration$filter10 !== void 0 && _configuration$filter10.inQuery) ? prefilter.toggle : undefined), ((_configuration$filter11 = configuration.filter) === null || _configuration$filter11 === void 0 || (_configuration$filter11 = _configuration$filter11.select) === null || _configuration$filter11 === void 0 ? void 0 : _configuration$filter11.applyDefaultValue) !== false || ((_configuration$filter12 = configuration.filter) === null || _configuration$filter12 === void 0 || (_configuration$filter12 = _configuration$filter12.select) === null || _configuration$filter12 === void 0 ? void 0 : _configuration$filter12.defaultValue) !== ((_prefilter$select = prefilter.select) === null || _prefilter$select === void 0 || (_prefilter$select = _prefilter$select[(_configuration$filter13 = (_configuration$filter14 = configuration.filter) === null || _configuration$filter14 === void 0 || (_configuration$filter14 = _configuration$filter14.select) === null || _configuration$filter14 === void 0 ? void 0 : _configuration$filter14.filterField) !== null && _configuration$filter13 !== void 0 ? _configuration$filter13 : '']) === null || _prefilter$select === void 0 ? void 0 : _prefilter$select[0]) ? prefilter.select : undefined), prefilter.timeStamp), prefilter["default"]); //remove all null values
25686
+ filterData = Object.fromEntries(Object.entries(filterData).filter(function (_ref6) {
25687
+ var _ref7 = _slicedToArray(_ref6, 2);
25688
+ _ref7[0];
25689
+ var v = _ref7[1];
25686
25690
  return v != null;
25687
25691
  }));
25688
25692
  currentFilterHash = objectHash(filterData);
@@ -25691,7 +25695,7 @@ function useTableData (_ref) {
25691
25695
  });
25692
25696
  filterHash.current = currentFilterHash;
25693
25697
  if (!filterServerSide) {
25694
- _context2.next = 19;
25698
+ _context3.next = 20;
25695
25699
  break;
25696
25700
  }
25697
25701
  ssf = _objectSpread$g({
@@ -25699,32 +25703,32 @@ function useTableData (_ref) {
25699
25703
  columns: configuration.columns,
25700
25704
  filters: filterData,
25701
25705
  sorter: p.sorter
25702
- }, configuration !== null && configuration !== void 0 && (_configuration$filter14 = configuration.filter) !== null && _configuration$filter14 !== void 0 && (_configuration$filter14 = _configuration$filter14.toggle) !== null && _configuration$filter14 !== void 0 && _configuration$filter14.inQuery ? {
25706
+ }, configuration !== null && configuration !== void 0 && (_configuration$filter15 = configuration.filter) !== null && _configuration$filter15 !== void 0 && (_configuration$filter15 = _configuration$filter15.toggle) !== null && _configuration$filter15 !== void 0 && _configuration$filter15.inQuery ? {
25703
25707
  genericProps: prefilter.toggle
25704
25708
  } : undefined);
25705
- _context2.next = 13;
25709
+ _context3.next = 14;
25706
25710
  return apiHandler.readList(parentMapping || configuration.mapping, mapping, ssf);
25707
- case 13:
25708
- data = _context2.sent;
25711
+ case 14:
25712
+ data = _context3.sent;
25709
25713
  currentUrl = apiHandler.getReadListUrl(parentMapping || configuration.mapping, mapping, ssf);
25710
25714
  currentData = data.data;
25711
25715
  currentPagination = _objectSpread$g(_objectSpread$g({}, currentPagination), {}, {
25712
25716
  total: data.total
25713
25717
  });
25714
- _context2.next = 28;
25718
+ _context3.next = 29;
25715
25719
  break;
25716
- case 19:
25720
+ case 20:
25717
25721
  if (!(!currentData || currentData.length === 0 || refresh)) {
25718
- _context2.next = 25;
25722
+ _context3.next = 26;
25719
25723
  break;
25720
25724
  }
25721
- _context2.next = 22;
25725
+ _context3.next = 23;
25722
25726
  return apiHandler.readList(parentMapping || configuration.mapping, mapping, undefined);
25723
- case 22:
25724
- _data3 = _context2.sent;
25727
+ case 23:
25728
+ _data3 = _context3.sent;
25725
25729
  currentData = _data3.data;
25726
25730
  setInitData(currentData);
25727
- case 25:
25731
+ case 26:
25728
25732
  _aplyFilterAndSortati2 = aplyFilterAndSortation(_objectSpread$g(_objectSpread$g({}, p), {}, {
25729
25733
  pagination: currentPagination,
25730
25734
  filters: filterData,
@@ -25733,7 +25737,7 @@ function useTableData (_ref) {
25733
25737
  })), _data4 = _aplyFilterAndSortati2.data, pagination = _aplyFilterAndSortati2.pagination;
25734
25738
  currentData = _data4;
25735
25739
  currentPagination = pagination;
25736
- case 28:
25740
+ case 29:
25737
25741
  setState(_objectSpread$g(_objectSpread$g({}, state), {}, {
25738
25742
  loading: false,
25739
25743
  data: currentData,
@@ -25742,19 +25746,21 @@ function useTableData (_ref) {
25742
25746
  prefilter: prefilter
25743
25747
  }),
25744
25748
  currentFetchUrl: currentUrl
25745
- }));
25749
+ }, clearSelection ? {
25750
+ selected: []
25751
+ } : {}));
25746
25752
  setFilter({
25747
25753
  filters: p.filters,
25748
25754
  sorter: p.sorter
25749
25755
  });
25750
- case 30:
25756
+ case 31:
25751
25757
  case "end":
25752
- return _context2.stop();
25758
+ return _context3.stop();
25753
25759
  }
25754
- }, _callee2);
25760
+ }, _callee3);
25755
25761
  }));
25756
- return function onChange(_x2) {
25757
- return _ref4.apply(this, arguments);
25762
+ return function onChange(_x3) {
25763
+ return _ref5.apply(this, arguments);
25758
25764
  };
25759
25765
  }();
25760
25766
  var onSelect = function onSelect(keys) {
@@ -25763,11 +25769,11 @@ function useTableData (_ref) {
25763
25769
  }));
25764
25770
  };
25765
25771
  var onDelete = /*#__PURE__*/function () {
25766
- var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
25772
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
25767
25773
  var _configuration$apiInt2;
25768
- var newData, newInitData, deleted, userPermissions, _loop, mappingData, deleteResult, _ret, index, total, pages, current, _configuration$filter15, _configuration$filter16, data;
25769
- return _regeneratorRuntime.wrap(function _callee3$(_context4) {
25770
- while (1) switch (_context4.prev = _context4.next) {
25774
+ var newData, newInitData, deleted, userPermissions, _loop, mappingData, deleteResult, _ret, index, total, pages, current, _configuration$filter16, _configuration$filter17, data;
25775
+ return _regeneratorRuntime.wrap(function _callee4$(_context5) {
25776
+ while (1) switch (_context5.prev = _context5.next) {
25771
25777
  case 0:
25772
25778
  setState(_objectSpread$g(_objectSpread$g({}, state), {}, {
25773
25779
  deleting: true
@@ -25775,15 +25781,15 @@ function useTableData (_ref) {
25775
25781
  newData = _toConsumableArray(state.data);
25776
25782
  newInitData = initData ? _toConsumableArray(initData) : undefined;
25777
25783
  deleted = 0;
25778
- _context4.next = 6;
25784
+ _context5.next = 6;
25779
25785
  return _typeof(configuration.apiInterface) == 'object' && _typeof(configuration.apiInterface["delete"]) == 'object' ? (_configuration$apiInt2 = configuration.apiInterface["delete"]) === null || _configuration$apiInt2 === void 0 ? void 0 : _configuration$apiInt2.permission : undefined;
25780
25786
  case 6:
25781
- userPermissions = _context4.sent;
25787
+ userPermissions = _context5.sent;
25782
25788
  _loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop(index) {
25783
- var _configuration$rowKey, _configuration$filter17, _configuration$filter18;
25789
+ var _configuration$filter18, _configuration$filter19;
25784
25790
  var id, _newData$filter, _newData$filter2, mapToggle, _iterator, _step, _globalFilter$toggle, field, _globalFilter$toggle2, _configuration$delete, _configuration$onErro, _configuration$onErro2, deletedIndex, initDeletedIndex;
25785
- return _regeneratorRuntime.wrap(function _loop$(_context3) {
25786
- while (1) switch (_context3.prev = _context3.next) {
25791
+ return _regeneratorRuntime.wrap(function _loop$(_context4) {
25792
+ while (1) switch (_context4.prev = _context4.next) {
25787
25793
  case 0:
25788
25794
  id = state.selected[index];
25789
25795
  if (configuration.rowKey) {
@@ -25796,7 +25802,7 @@ function useTableData (_ref) {
25796
25802
  })) === null || _newData$filter2 === void 0 ? void 0 : _newData$filter2[0];
25797
25803
  }
25798
25804
  mapToggle = {};
25799
- _iterator = _createForOfIteratorHelper$3((_configuration$filter17 = (_configuration$filter18 = configuration.filter) === null || _configuration$filter18 === void 0 || (_configuration$filter18 = _configuration$filter18.toggle) === null || _configuration$filter18 === void 0 ? void 0 : _configuration$filter18.fields) !== null && _configuration$filter17 !== void 0 ? _configuration$filter17 : []);
25805
+ _iterator = _createForOfIteratorHelper$3((_configuration$filter18 = (_configuration$filter19 = configuration.filter) === null || _configuration$filter19 === void 0 || (_configuration$filter19 = _configuration$filter19.toggle) === null || _configuration$filter19 === void 0 ? void 0 : _configuration$filter19.fields) !== null && _configuration$filter18 !== void 0 ? _configuration$filter18 : []);
25800
25806
  try {
25801
25807
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
25802
25808
  field = _step.value;
@@ -25811,107 +25817,106 @@ function useTableData (_ref) {
25811
25817
  }
25812
25818
  mappingData = _objectSpread$g(_objectSpread$g(_objectSpread$g({}, mappingData), state.mappingData), mapToggle);
25813
25819
  deleteResult = undefined;
25814
- _context3.prev = 7;
25820
+ _context4.prev = 7;
25815
25821
  if (!(userPermissions && !root.actions.userHasPermission(userPermissions))) {
25816
- _context3.next = 11;
25822
+ _context4.next = 11;
25817
25823
  break;
25818
25824
  }
25819
25825
  setError('Sie haben keine Berechtigung ein Mediaitem zu löschen.');
25820
- return _context3.abrupt("return", 0);
25826
+ return _context4.abrupt("return", 0);
25821
25827
  case 11:
25822
- _context3.next = 13;
25828
+ _context4.next = 13;
25823
25829
  return apiHandler["delete"](id, (_configuration$delete = configuration.deleteMapping) !== null && _configuration$delete !== void 0 ? _configuration$delete : configuration.mapping, mappingData);
25824
25830
  case 13:
25825
- deleteResult = _context3.sent;
25826
- _context3.next = 24;
25831
+ deleteResult = _context4.sent;
25832
+ _context4.next = 24;
25827
25833
  break;
25828
25834
  case 16:
25829
- _context3.prev = 16;
25830
- _context3.t0 = _context3["catch"](7);
25831
- if (!(_context3.t0 instanceof DivaError && _context3.t0.name)) {
25832
- _context3.next = 22;
25835
+ _context4.prev = 16;
25836
+ _context4.t0 = _context4["catch"](7);
25837
+ if (!(_context4.t0 instanceof DivaError && _context4.t0.name)) {
25838
+ _context4.next = 22;
25833
25839
  break;
25834
25840
  }
25835
- if (!((_configuration$onErro = configuration.onError) !== null && _configuration$onErro !== void 0 && _configuration$onErro[_context3.t0.name])) {
25836
- _context3.next = 22;
25841
+ if (!((_configuration$onErro = configuration.onError) !== null && _configuration$onErro !== void 0 && _configuration$onErro[_context4.t0.name])) {
25842
+ _context4.next = 22;
25837
25843
  break;
25838
25844
  }
25839
- setError((_configuration$onErro2 = configuration.onError) === null || _configuration$onErro2 === void 0 ? void 0 : _configuration$onErro2[_context3.t0.name]);
25840
- return _context3.abrupt("return", 0);
25845
+ setError((_configuration$onErro2 = configuration.onError) === null || _configuration$onErro2 === void 0 ? void 0 : _configuration$onErro2[_context4.t0.name]);
25846
+ return _context4.abrupt("return", 0);
25841
25847
  case 22:
25842
- setError(_context3.t0.message);
25843
- return _context3.abrupt("return", 0);
25848
+ setError(_context4.t0.message);
25849
+ return _context4.abrupt("return", 0);
25844
25850
  case 24:
25845
25851
  if (deleteResult) {
25846
- _context3.next = 27;
25852
+ _context4.next = 27;
25847
25853
  break;
25848
25854
  }
25849
25855
  setError('Fehler beim löschen eines Elementes.');
25850
- return _context3.abrupt("return", 1);
25856
+ return _context4.abrupt("return", 1);
25851
25857
  case 27:
25852
- (_configuration$rowKey = configuration.rowKey) !== null && _configuration$rowKey !== void 0 ? _configuration$rowKey : '_id';
25853
25858
  deletedIndex = newData.findIndex(function (d) {
25854
- var _configuration$rowKey2, _configuration$rowKey3;
25855
- return goTroughObject(d, (_configuration$rowKey2 = (_configuration$rowKey3 = configuration.rowKey) === null || _configuration$rowKey3 === void 0 ? void 0 : _configuration$rowKey3.split('.')) !== null && _configuration$rowKey2 !== void 0 ? _configuration$rowKey2 : ['_id']) == id;
25859
+ var _configuration$rowKey, _configuration$rowKey2;
25860
+ return goTroughObject(d, (_configuration$rowKey = (_configuration$rowKey2 = configuration.rowKey) === null || _configuration$rowKey2 === void 0 ? void 0 : _configuration$rowKey2.split('.')) !== null && _configuration$rowKey !== void 0 ? _configuration$rowKey : ['_id']) == id;
25856
25861
  });
25857
25862
  newData.splice(deletedIndex, 1);
25858
25863
  initDeletedIndex = newInitData === null || newInitData === void 0 ? void 0 : newInitData.findIndex(function (d) {
25859
- var _configuration$rowKey4, _configuration$rowKey5;
25860
- return goTroughObject(d, (_configuration$rowKey4 = (_configuration$rowKey5 = configuration.rowKey) === null || _configuration$rowKey5 === void 0 ? void 0 : _configuration$rowKey5.split('.')) !== null && _configuration$rowKey4 !== void 0 ? _configuration$rowKey4 : ['_id']) == id;
25864
+ var _configuration$rowKey3, _configuration$rowKey4;
25865
+ return goTroughObject(d, (_configuration$rowKey3 = (_configuration$rowKey4 = configuration.rowKey) === null || _configuration$rowKey4 === void 0 ? void 0 : _configuration$rowKey4.split('.')) !== null && _configuration$rowKey3 !== void 0 ? _configuration$rowKey3 : ['_id']) == id;
25861
25866
  });
25862
25867
  newInitData === null || newInitData === void 0 || newInitData.splice(initDeletedIndex, 1);
25863
25868
  deleted++;
25864
- case 33:
25869
+ case 32:
25865
25870
  case "end":
25866
- return _context3.stop();
25871
+ return _context4.stop();
25867
25872
  }
25868
25873
  }, _loop, null, [[7, 16]]);
25869
25874
  });
25870
25875
  index = 0;
25871
25876
  case 9:
25872
25877
  if (!(index < state.selected.length)) {
25873
- _context4.next = 19;
25878
+ _context5.next = 19;
25874
25879
  break;
25875
25880
  }
25876
- return _context4.delegateYield(_loop(index), "t0", 11);
25881
+ return _context5.delegateYield(_loop(index), "t0", 11);
25877
25882
  case 11:
25878
- _ret = _context4.t0;
25883
+ _ret = _context5.t0;
25879
25884
  if (!(_ret === 0)) {
25880
- _context4.next = 14;
25885
+ _context5.next = 14;
25881
25886
  break;
25882
25887
  }
25883
- return _context4.abrupt("break", 19);
25888
+ return _context5.abrupt("break", 19);
25884
25889
  case 14:
25885
25890
  if (!(_ret === 1)) {
25886
- _context4.next = 16;
25891
+ _context5.next = 16;
25887
25892
  break;
25888
25893
  }
25889
- return _context4.abrupt("continue", 16);
25894
+ return _context5.abrupt("continue", 16);
25890
25895
  case 16:
25891
25896
  index++;
25892
- _context4.next = 9;
25897
+ _context5.next = 9;
25893
25898
  break;
25894
25899
  case 19:
25895
25900
  total = state.pagination.total - deleted;
25896
25901
  pages = Math.ceil(total / state.pagination.pageSize);
25897
25902
  current = state.pagination.current > pages ? pages : state.pagination.current;
25898
25903
  if (!(state.pagination.current > pages && filterServerSide || state.selected.length === 0)) {
25899
- _context4.next = 28;
25904
+ _context5.next = 28;
25900
25905
  break;
25901
25906
  }
25902
- _context4.next = 25;
25907
+ _context5.next = 25;
25903
25908
  return apiHandler.readList(parentMapping || configuration.mapping, mapping, _objectSpread$g({
25904
25909
  pagination: _objectSpread$g(_objectSpread$g({}, state.pagination), {}, {
25905
25910
  current: current
25906
25911
  }),
25907
25912
  columns: configuration.columns,
25908
- filters: _objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g({}, filterData.filters), globalFilter.search), !(configuration !== null && configuration !== void 0 && (_configuration$filter15 = configuration.filter) !== null && _configuration$filter15 !== void 0 && (_configuration$filter15 = _configuration$filter15.toggle) !== null && _configuration$filter15 !== void 0 && _configuration$filter15.inQuery) ? globalFilter.toggle : undefined), globalFilter.select), globalFilter.timeStamp), globalFilter["default"]),
25913
+ filters: _objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g({}, filterData.filters), globalFilter.search), !(configuration !== null && configuration !== void 0 && (_configuration$filter16 = configuration.filter) !== null && _configuration$filter16 !== void 0 && (_configuration$filter16 = _configuration$filter16.toggle) !== null && _configuration$filter16 !== void 0 && _configuration$filter16.inQuery) ? globalFilter.toggle : undefined), globalFilter.select), globalFilter.timeStamp), globalFilter["default"]),
25909
25914
  sorter: filterData.sorter
25910
- }, configuration !== null && configuration !== void 0 && (_configuration$filter16 = configuration.filter) !== null && _configuration$filter16 !== void 0 && (_configuration$filter16 = _configuration$filter16.toggle) !== null && _configuration$filter16 !== void 0 && _configuration$filter16.inQuery ? {
25915
+ }, configuration !== null && configuration !== void 0 && (_configuration$filter17 = configuration.filter) !== null && _configuration$filter17 !== void 0 && (_configuration$filter17 = _configuration$filter17.toggle) !== null && _configuration$filter17 !== void 0 && _configuration$filter17.inQuery ? {
25911
25916
  genericProps: globalFilter.toggle
25912
25917
  } : undefined));
25913
25918
  case 25:
25914
- data = _context4.sent;
25919
+ data = _context5.sent;
25915
25920
  newData = data.data;
25916
25921
  total = data.total;
25917
25922
  case 28:
@@ -25927,17 +25932,17 @@ function useTableData (_ref) {
25927
25932
  }));
25928
25933
  case 30:
25929
25934
  case "end":
25930
- return _context4.stop();
25935
+ return _context5.stop();
25931
25936
  }
25932
- }, _callee3);
25937
+ }, _callee4);
25933
25938
  }));
25934
25939
  return function onDelete() {
25935
- return _ref7.apply(this, arguments);
25940
+ return _ref8.apply(this, arguments);
25936
25941
  };
25937
25942
  }();
25938
25943
  var onGlobalFilterSelect = function onGlobalFilterSelect(value) {
25939
- var _configuration$filter19;
25940
- if (!((_configuration$filter19 = configuration.filter) !== null && _configuration$filter19 !== void 0 && _configuration$filter19.select)) {
25944
+ var _configuration$filter20;
25945
+ if (!((_configuration$filter20 = configuration.filter) !== null && _configuration$filter20 !== void 0 && _configuration$filter20.select)) {
25941
25946
  LOG$2.error(new DivaError('No global select filter defiend'));
25942
25947
  return;
25943
25948
  }
@@ -25953,8 +25958,8 @@ function useTableData (_ref) {
25953
25958
  }, filterData), newGlobalFilter);
25954
25959
  };
25955
25960
  var onGlobalFilterToggle = function onGlobalFilterToggle() {
25956
- var _configuration$filter20;
25957
- if (!((_configuration$filter20 = configuration.filter) !== null && _configuration$filter20 !== void 0 && _configuration$filter20.toggle)) {
25961
+ var _configuration$filter21;
25962
+ if (!((_configuration$filter21 = configuration.filter) !== null && _configuration$filter21 !== void 0 && _configuration$filter21.toggle)) {
25958
25963
  LOG$2.error(new DivaError('No global toggle filter defined'));
25959
25964
  return;
25960
25965
  }
@@ -25968,11 +25973,14 @@ function useTableData (_ref) {
25968
25973
  setGlobaFilter(newGlobalFilter);
25969
25974
  onChange(_objectSpread$g({
25970
25975
  pagination: state.pagination
25971
- }, filterData), newGlobalFilter);
25976
+ }, filterData), newGlobalFilter, undefined, true);
25977
+ };
25978
+ var resetToggle = function resetToggle() {
25979
+ if (globalFilter !== null && globalFilter !== void 0 && globalFilter.toggle) onGlobalFilterToggle();
25972
25980
  };
25973
25981
  var onGlobalFilterSearch = function onGlobalFilterSearch(value) {
25974
- var _configuration$filter21;
25975
- if (!((_configuration$filter21 = configuration.filter) !== null && _configuration$filter21 !== void 0 && _configuration$filter21.search)) {
25982
+ var _configuration$filter22;
25983
+ if (!((_configuration$filter22 = configuration.filter) !== null && _configuration$filter22 !== void 0 && _configuration$filter22.search)) {
25976
25984
  LOG$2.error(new DivaError('No global search filter defiend'));
25977
25985
  return;
25978
25986
  }
@@ -25980,8 +25988,8 @@ function useTableData (_ref) {
25980
25988
  search: {}
25981
25989
  });
25982
25990
  if (value) {
25983
- var _configuration$filter22;
25984
- (_configuration$filter22 = configuration.filter) === null || _configuration$filter22 === void 0 || _configuration$filter22.search.fields.forEach(function (f) {
25991
+ var _configuration$filter23;
25992
+ (_configuration$filter23 = configuration.filter) === null || _configuration$filter23 === void 0 || _configuration$filter23.search.fields.forEach(function (f) {
25985
25993
  if (typeof f == 'string') {
25986
25994
  newGlobalFilter.search[f] = [value, 'contains', 0];
25987
25995
  } else {
@@ -25995,8 +26003,8 @@ function useTableData (_ref) {
25995
26003
  }, filterData), newGlobalFilter);
25996
26004
  };
25997
26005
  var onGlobalFilterPeriod = function onGlobalFilterPeriod(from, to) {
25998
- var _configuration$filter23;
25999
- if (!((_configuration$filter23 = configuration.filter) !== null && _configuration$filter23 !== void 0 && _configuration$filter23.period)) {
26006
+ var _configuration$filter24;
26007
+ if (!((_configuration$filter24 = configuration.filter) !== null && _configuration$filter24 !== void 0 && _configuration$filter24.period)) {
26000
26008
  LOG$2.error(new DivaError('No global period filter defiend'));
26001
26009
  return;
26002
26010
  }
@@ -26018,7 +26026,9 @@ function useTableData (_ref) {
26018
26026
  onUpdate: onUpdate,
26019
26027
  onDelete: onDelete,
26020
26028
  onSelect: onSelect,
26029
+ getDataById: getDataById,
26021
26030
  triggerRefresh: triggerRefresh,
26031
+ resetToggle: resetToggle,
26022
26032
  onSelectedCatalog: onSelectedCatalog,
26023
26033
  error: error,
26024
26034
  catalogItem: catalogItem,