@crystaldesign/diva-backoffice 24.11.0-rc.5 → 24.12.0-beta.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.
- package/build/esm/index.js +303 -292
- package/build/types/backoffice/src/Configuration.d.ts +0 -1
- package/build/types/backoffice/src/Configuration.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/Form/elements.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/Form/useFormData.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/Table/BaseTable/cellRenderer/MediaItemViewerCell/index.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/Table/BaseTable/cellRenderer/MediaViewerCell/index.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/Table/CatalogTable/useTableData.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/Table/StandardTable/useTableData.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/Table/types.d.ts +0 -2
- package/build/types/backoffice/src/ui/Table/types.d.ts.map +1 -1
- package/package.json +3 -3
package/build/esm/index.js
CHANGED
|
@@ -3144,6 +3144,17 @@ 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
|
+
},
|
|
3147
3158
|
ContentItems: {
|
|
3148
3159
|
title: t('backoffice.table.contentitems.title'),
|
|
3149
3160
|
type: 'Table',
|
|
@@ -3151,22 +3162,13 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
3151
3162
|
pagination: {
|
|
3152
3163
|
pageSize: 50
|
|
3153
3164
|
},
|
|
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
|
-
},
|
|
3162
3165
|
copyAction: {
|
|
3163
3166
|
actionType: 'Detail',
|
|
3164
3167
|
type: 'Form',
|
|
3165
3168
|
id: 'FormEditContentItem',
|
|
3166
|
-
disableOnMultiselect: true,
|
|
3167
|
-
resetToggleAfter: true,
|
|
3168
3169
|
title: t('backoffice.table.contentItem.copyAction.title'),
|
|
3169
3170
|
label: t('backoffice.table.services.copyAction.label'),
|
|
3171
|
+
disableOnMultiselect: true,
|
|
3170
3172
|
mapping: {
|
|
3171
3173
|
type: 'body',
|
|
3172
3174
|
map: [{
|
|
@@ -3181,18 +3183,10 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
3181
3183
|
}]
|
|
3182
3184
|
}
|
|
3183
3185
|
},
|
|
3184
|
-
createAction: {
|
|
3185
|
-
actionType: 'Detail',
|
|
3186
|
-
type: 'JsonEditor',
|
|
3187
|
-
id: 'JsonEditorCreateContentItem',
|
|
3188
|
-
title: t('backoffice.table.contentItem.label.create'),
|
|
3189
|
-
label: t('backoffice.table.contentItem.label.create'),
|
|
3190
|
-
permission: 'backoffice_create_contentitem_template'
|
|
3191
|
-
},
|
|
3192
3186
|
deleteAction: {
|
|
3193
3187
|
disabled: function disabled(datas) {
|
|
3194
3188
|
return (datas === null || datas === void 0 ? void 0 : datas.find(function (d) {
|
|
3195
|
-
return !
|
|
3189
|
+
return !d.organizationId;
|
|
3196
3190
|
})) && !root.actions.userHasPermission('backoffice_delete_contentitem_template');
|
|
3197
3191
|
}
|
|
3198
3192
|
},
|
|
@@ -3223,7 +3217,6 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
3223
3217
|
}, {
|
|
3224
3218
|
title: t('backoffice.table.views.lastUpdated'),
|
|
3225
3219
|
field: 'lastUpdated',
|
|
3226
|
-
defaultSortOrder: 'descend',
|
|
3227
3220
|
type: 'unixTimeStamp',
|
|
3228
3221
|
sorter: 1,
|
|
3229
3222
|
filter: 'advanced',
|
|
@@ -3245,6 +3238,106 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
3245
3238
|
filter: 'advanced',
|
|
3246
3239
|
width: 150
|
|
3247
3240
|
}],
|
|
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
|
+
}],
|
|
3248
3341
|
rowAction: [{
|
|
3249
3342
|
actionType: 'Detail',
|
|
3250
3343
|
disabled: function disabled(data) {
|
|
@@ -3276,7 +3369,7 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
3276
3369
|
}],
|
|
3277
3370
|
apiInterface: {
|
|
3278
3371
|
read: {
|
|
3279
|
-
list: '${catalogService}/contentItems',
|
|
3372
|
+
list: '${catalogService}/contentItems?onlyTemplates=true',
|
|
3280
3373
|
filterServerSide: true
|
|
3281
3374
|
},
|
|
3282
3375
|
"delete": '${catalogService}/contentItems/${id}'
|
|
@@ -12157,7 +12250,7 @@ var menu = [{
|
|
|
12157
12250
|
}
|
|
12158
12251
|
}]
|
|
12159
12252
|
}, {
|
|
12160
|
-
id: '
|
|
12253
|
+
id: 'GroupContentItems',
|
|
12161
12254
|
path: 'contentitems',
|
|
12162
12255
|
label: 'backoffice.menu.items.label.ContentItems',
|
|
12163
12256
|
icon: 'OrderedListOutlined',
|
|
@@ -13786,7 +13879,6 @@ function useFormData (_ref) {
|
|
|
13786
13879
|
removedMedias = _useState12[0],
|
|
13787
13880
|
setRemovedMedias = _useState12[1];
|
|
13788
13881
|
var _useMemo = useMemo(function () {
|
|
13789
|
-
setCanSave === null || setCanSave === void 0 || setCanSave(true);
|
|
13790
13882
|
var c = {
|
|
13791
13883
|
apiHandler: root.getApiHandler(id, apiInterface),
|
|
13792
13884
|
configuration: root.configurationStore.getConfiguration(id, 'Form')
|
|
@@ -13802,7 +13894,7 @@ function useFormData (_ref) {
|
|
|
13802
13894
|
if (configuration.disableSave) setCanSave === null || setCanSave === void 0 || setCanSave(false);
|
|
13803
13895
|
}, [configuration]);
|
|
13804
13896
|
var _onLoadFields = function onLoadFields(data) {
|
|
13805
|
-
var items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
13897
|
+
var items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : selectedItems !== null && selectedItems !== void 0 ? selectedItems : configuration.items;
|
|
13806
13898
|
var _iterator = _createForOfIteratorHelper$j(items),
|
|
13807
13899
|
_step;
|
|
13808
13900
|
try {
|
|
@@ -13999,28 +14091,27 @@ function useFormData (_ref) {
|
|
|
13999
14091
|
}
|
|
14000
14092
|
return _context2.abrupt("return", newData);
|
|
14001
14093
|
case 3:
|
|
14002
|
-
|
|
14003
|
-
_context2.next = 6;
|
|
14094
|
+
_context2.next = 5;
|
|
14004
14095
|
return setDynamicFields(_objectSpread$I({}, state.data), newData);
|
|
14005
|
-
case
|
|
14096
|
+
case 5:
|
|
14006
14097
|
newData = _context2.sent;
|
|
14007
|
-
_context2.next =
|
|
14098
|
+
_context2.next = 8;
|
|
14008
14099
|
return preSaveProcess(newData, selectedItems !== null && selectedItems !== void 0 ? selectedItems : configuration.items);
|
|
14009
|
-
case
|
|
14100
|
+
case 8:
|
|
14010
14101
|
newData = removeEmpty(newData);
|
|
14011
14102
|
setState(_objectSpread$I(_objectSpread$I({}, state), {}, {
|
|
14012
14103
|
loading: true
|
|
14013
14104
|
}));
|
|
14014
14105
|
finalData = state.data;
|
|
14015
|
-
_context2.prev =
|
|
14016
|
-
_context2.next =
|
|
14106
|
+
_context2.prev = 11;
|
|
14107
|
+
_context2.next = 14;
|
|
14017
14108
|
return apiCall(newData);
|
|
14018
|
-
case
|
|
14109
|
+
case 14:
|
|
14019
14110
|
response = _context2.sent;
|
|
14020
14111
|
i = 0;
|
|
14021
|
-
case
|
|
14112
|
+
case 16:
|
|
14022
14113
|
if (!(i < (((_configuration$additi = configuration.additionals) === null || _configuration$additi === void 0 ? void 0 : _configuration$additi.length) || 0))) {
|
|
14023
|
-
_context2.next =
|
|
14114
|
+
_context2.next = 26;
|
|
14024
14115
|
break;
|
|
14025
14116
|
}
|
|
14026
14117
|
// perform additional server actions before returning the data
|
|
@@ -14032,20 +14123,20 @@ function useFormData (_ref) {
|
|
|
14032
14123
|
if (additional.addBaseUrl) {
|
|
14033
14124
|
data[additional.addBaseUrl] = window.location.origin;
|
|
14034
14125
|
}
|
|
14035
|
-
_context2.next =
|
|
14126
|
+
_context2.next = 23;
|
|
14036
14127
|
return additionalApi.create(data, additional.mapping, response);
|
|
14037
|
-
case
|
|
14128
|
+
case 23:
|
|
14038
14129
|
i++;
|
|
14039
|
-
_context2.next =
|
|
14130
|
+
_context2.next = 16;
|
|
14040
14131
|
break;
|
|
14041
|
-
case
|
|
14132
|
+
case 26:
|
|
14042
14133
|
finalData = response;
|
|
14043
14134
|
return _context2.abrupt("return", response);
|
|
14044
|
-
case
|
|
14045
|
-
_context2.prev =
|
|
14046
|
-
_context2.t0 = _context2["catch"](
|
|
14135
|
+
case 30:
|
|
14136
|
+
_context2.prev = 30;
|
|
14137
|
+
_context2.t0 = _context2["catch"](11);
|
|
14047
14138
|
if (!(_context2.t0 instanceof DivaError && _context2.t0.name)) {
|
|
14048
|
-
_context2.next =
|
|
14139
|
+
_context2.next = 38;
|
|
14049
14140
|
break;
|
|
14050
14141
|
}
|
|
14051
14142
|
errorCode = _context2.t0.name;
|
|
@@ -14054,26 +14145,25 @@ function useFormData (_ref) {
|
|
|
14054
14145
|
return (_item$onError = item.onError) === null || _item$onError === void 0 ? void 0 : _item$onError[errorCode];
|
|
14055
14146
|
});
|
|
14056
14147
|
if (!item) {
|
|
14057
|
-
_context2.next =
|
|
14148
|
+
_context2.next = 38;
|
|
14058
14149
|
break;
|
|
14059
14150
|
}
|
|
14060
14151
|
setFieldErrors(_objectSpread$I(_objectSpread$I({}, fieldErrors), {}, _defineProperty({}, item.name.toString(), item.onError[errorCode])));
|
|
14061
14152
|
return _context2.abrupt("return", undefined);
|
|
14062
|
-
case
|
|
14153
|
+
case 38:
|
|
14063
14154
|
throw _context2.t0;
|
|
14064
|
-
case
|
|
14065
|
-
_context2.prev =
|
|
14066
|
-
root.actions.toggleLoading('saving_form');
|
|
14155
|
+
case 39:
|
|
14156
|
+
_context2.prev = 39;
|
|
14067
14157
|
setState(_objectSpread$I(_objectSpread$I({}, state), {}, {
|
|
14068
14158
|
data: finalData,
|
|
14069
14159
|
loading: false
|
|
14070
14160
|
}));
|
|
14071
|
-
return _context2.finish(
|
|
14072
|
-
case
|
|
14161
|
+
return _context2.finish(39);
|
|
14162
|
+
case 42:
|
|
14073
14163
|
case "end":
|
|
14074
14164
|
return _context2.stop();
|
|
14075
14165
|
}
|
|
14076
|
-
}, _callee2, null, [[
|
|
14166
|
+
}, _callee2, null, [[11, 30, 39, 42]]);
|
|
14077
14167
|
}));
|
|
14078
14168
|
return function onSave(_x2) {
|
|
14079
14169
|
return _ref3.apply(this, arguments);
|
|
@@ -17479,7 +17569,6 @@ function getElement(item, setCanSave, state, absoluteName, _onChange, _onError,
|
|
|
17479
17569
|
});
|
|
17480
17570
|
case 'radio':
|
|
17481
17571
|
return /*#__PURE__*/jsx(Radio.Group, {
|
|
17482
|
-
defaultValue: item.defaultValue,
|
|
17483
17572
|
value: item.value,
|
|
17484
17573
|
options: item.options.map(function (o) {
|
|
17485
17574
|
var _o$disabled;
|
|
@@ -22316,7 +22405,7 @@ var useMediaUpload = function useMediaUpload(_ref) {
|
|
|
22316
22405
|
var small = "small-NY1-k";
|
|
22317
22406
|
var medium = "medium---QcO";
|
|
22318
22407
|
var big = "big--E39S";
|
|
22319
|
-
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-
|
|
22408
|
+
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";
|
|
22320
22409
|
styleInject(css_248z$d);
|
|
22321
22410
|
|
|
22322
22411
|
var MediaUpload = observer(function (_ref) {
|
|
@@ -22715,8 +22804,6 @@ if (!window.customElements.get('model-viewer')) {
|
|
|
22715
22804
|
function MediaViewerCell (_ref) {
|
|
22716
22805
|
var children = _ref.children,
|
|
22717
22806
|
column = _ref.column;
|
|
22718
|
-
var _useDivaCore = useDivaCore(),
|
|
22719
|
-
isFirefox = _useDivaCore.state.isFirefox;
|
|
22720
22807
|
if (!(children !== null && children !== void 0 && children[1])) {
|
|
22721
22808
|
return /*#__PURE__*/jsx(Fragment, {});
|
|
22722
22809
|
}
|
|
@@ -22762,7 +22849,7 @@ function MediaViewerCell (_ref) {
|
|
|
22762
22849
|
src: children[1],
|
|
22763
22850
|
ar: true,
|
|
22764
22851
|
"ar-scale": 'fixed',
|
|
22765
|
-
"ar-modes":
|
|
22852
|
+
"ar-modes": 'webxr quick-look',
|
|
22766
22853
|
"shadow-intensity": "1",
|
|
22767
22854
|
"camera-controls": true,
|
|
22768
22855
|
"touch-action": "pan-y",
|
|
@@ -22902,8 +22989,6 @@ function MediaItemViewerCell (_ref) {
|
|
|
22902
22989
|
timeStamp = _useState4[0],
|
|
22903
22990
|
setTimeStamp = _useState4[1];
|
|
22904
22991
|
var id;
|
|
22905
|
-
var _useDivaCore = useDivaCore(),
|
|
22906
|
-
isFirefox = _useDivaCore.state.isFirefox;
|
|
22907
22992
|
|
|
22908
22993
|
//! for renderjob table mediaItems because can't filter mediaItems.0
|
|
22909
22994
|
if (Array.isArray(children[1])) {
|
|
@@ -22935,9 +23020,9 @@ function MediaItemViewerCell (_ref) {
|
|
|
22935
23020
|
});
|
|
22936
23021
|
}, [timeStamp, id]);
|
|
22937
23022
|
if (!id) return /*#__PURE__*/jsx(FileUnknownOutlined, {});
|
|
22938
|
-
var
|
|
22939
|
-
handler =
|
|
22940
|
-
actions =
|
|
23023
|
+
var _useDivaCore = useDivaCore(),
|
|
23024
|
+
handler = _useDivaCore.handler,
|
|
23025
|
+
actions = _useDivaCore.actions;
|
|
22941
23026
|
var openModelViewer = function openModelViewer() {
|
|
22942
23027
|
actions.openFullscreen({
|
|
22943
23028
|
content: /*#__PURE__*/jsx("model-viewer", {
|
|
@@ -22945,7 +23030,7 @@ function MediaItemViewerCell (_ref) {
|
|
|
22945
23030
|
src: children[1],
|
|
22946
23031
|
ar: true,
|
|
22947
23032
|
"ar-scale": 'fixed',
|
|
22948
|
-
"ar-modes":
|
|
23033
|
+
"ar-modes": 'webxr quick-look',
|
|
22949
23034
|
"shadow-intensity": "1",
|
|
22950
23035
|
"camera-controls": true,
|
|
22951
23036
|
"touch-action": "pan-y",
|
|
@@ -23502,7 +23587,7 @@ dayjs.extend(weekYear);
|
|
|
23502
23587
|
Select$1.Option;
|
|
23503
23588
|
var LOG$3 = getLogger('Backoffice', 'BaseTable');
|
|
23504
23589
|
var TableWrapper = function TableWrapper(_ref) {
|
|
23505
|
-
var _state$configuration$,
|
|
23590
|
+
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;
|
|
23506
23591
|
var state = _ref.state;
|
|
23507
23592
|
var root = useStore();
|
|
23508
23593
|
var _useState = useState(0),
|
|
@@ -23596,7 +23681,6 @@ var TableWrapper = function TableWrapper(_ref) {
|
|
|
23596
23681
|
if (!permission) return true;
|
|
23597
23682
|
return root.actions.userHasPermission(permission);
|
|
23598
23683
|
}
|
|
23599
|
-
var toggleConfig = (_state$configuration$ = state.configuration.filter) === null || _state$configuration$ === void 0 ? void 0 : _state$configuration$.toggle;
|
|
23600
23684
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
23601
23685
|
children: [(state.canDelete || state.configuration.createAction || state.title || state.configuration.canRefresh || state.configuration.clientRelations) && /*#__PURE__*/jsx(Fragment, {
|
|
23602
23686
|
children: /*#__PURE__*/jsx(Descriptions, {
|
|
@@ -23655,17 +23739,16 @@ var TableWrapper = function TableWrapper(_ref) {
|
|
|
23655
23739
|
state.triggerRefresh();
|
|
23656
23740
|
},
|
|
23657
23741
|
children: /*#__PURE__*/jsx(ReloadOutlined, {})
|
|
23658
|
-
}),
|
|
23742
|
+
}), ((_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", {
|
|
23659
23743
|
children: /*#__PURE__*/jsx(Switch, {
|
|
23660
|
-
defaultChecked:
|
|
23661
|
-
checkedChildren: (
|
|
23662
|
-
unCheckedChildren: (
|
|
23744
|
+
defaultChecked: (_state$configuration$2 = state.configuration.filter) === null || _state$configuration$2 === void 0 ? void 0 : _state$configuration$2.toggle.defaultChecked,
|
|
23745
|
+
checkedChildren: (_state$configuration$3 = state.configuration.filter.toggle.label) !== null && _state$configuration$3 !== void 0 ? _state$configuration$3 : 'unfiltered',
|
|
23746
|
+
unCheckedChildren: (_state$configuration$4 = state.configuration.filter.toggle.labelOff) !== null && _state$configuration$4 !== void 0 ? _state$configuration$4 : 'filtered',
|
|
23663
23747
|
onChange: function onChange() {
|
|
23664
23748
|
return state.onGlobalFilterToggle();
|
|
23665
|
-
}
|
|
23666
|
-
checked: !!((_state$globalFilter = state.globalFilter) !== null && _state$globalFilter !== void 0 && _state$globalFilter.toggle) != !!toggleConfig.inverted
|
|
23749
|
+
}
|
|
23667
23750
|
})
|
|
23668
|
-
}), ((_state$configuration$
|
|
23751
|
+
}), ((_state$configuration$5 = state.configuration.filter) === null || _state$configuration$5 === void 0 ? void 0 : _state$configuration$5.search) && /*#__PURE__*/jsx(Input.Search, {
|
|
23669
23752
|
placeholder: t('filter.global'),
|
|
23670
23753
|
onSearch: function onSearch(v) {
|
|
23671
23754
|
return state.onGlobalFilterSearch(v);
|
|
@@ -23674,17 +23757,17 @@ var TableWrapper = function TableWrapper(_ref) {
|
|
|
23674
23757
|
style: {
|
|
23675
23758
|
width: 200
|
|
23676
23759
|
}
|
|
23677
|
-
}), ((_state$configuration$
|
|
23760
|
+
}), ((_state$configuration$6 = state.configuration.filter) === null || _state$configuration$6 === void 0 ? void 0 : _state$configuration$6.period) && /*#__PURE__*/jsx(DatePicker.RangePicker, {
|
|
23678
23761
|
onCalendarChange: function onCalendarChange(values) {
|
|
23679
23762
|
if (values && values[0] && values[1]) {
|
|
23680
23763
|
state.onGlobalFilterPeriod(values[0].valueOf(), values[1].valueOf());
|
|
23681
23764
|
}
|
|
23682
23765
|
},
|
|
23683
|
-
value: [(_state$
|
|
23766
|
+
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)),
|
|
23684
23767
|
// Convert to Dayjs
|
|
23685
|
-
(_state$
|
|
23768
|
+
(_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
|
|
23686
23769
|
]
|
|
23687
|
-
}), ((_state$configuration$
|
|
23770
|
+
}), ((_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), {}, {
|
|
23688
23771
|
style: {
|
|
23689
23772
|
minWidth: '200px'
|
|
23690
23773
|
},
|
|
@@ -23697,17 +23780,17 @@ var TableWrapper = function TableWrapper(_ref) {
|
|
|
23697
23780
|
}), state.canDelete && /*#__PURE__*/jsx(DeleteButton, {
|
|
23698
23781
|
selected: state.selected,
|
|
23699
23782
|
total: state.pagination.total,
|
|
23700
|
-
min: (_state$configuration$
|
|
23783
|
+
min: (_state$configuration$9 = state.configuration.rules) === null || _state$configuration$9 === void 0 ? void 0 : _state$configuration$9.min,
|
|
23701
23784
|
deleting: state.deleting,
|
|
23702
23785
|
onDelete: state.onDelete,
|
|
23703
|
-
disabled: !!((_state$configuration$
|
|
23786
|
+
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) {
|
|
23704
23787
|
return state.data.find(function (d) {
|
|
23705
23788
|
return d._id == id;
|
|
23706
23789
|
});
|
|
23707
23790
|
})))
|
|
23708
23791
|
}), state.configuration.copyAction !== undefined && /*#__PURE__*/jsx(CopyButton, {
|
|
23709
23792
|
state: state
|
|
23710
|
-
}), (_state$configuration$
|
|
23793
|
+
}), (_state$configuration$12 = state.configuration.bulkActions) === null || _state$configuration$12 === void 0 ? void 0 : _state$configuration$12.map(function (action) {
|
|
23711
23794
|
return /*#__PURE__*/jsx(BulkAction, {
|
|
23712
23795
|
action: action,
|
|
23713
23796
|
state: state,
|
|
@@ -23718,18 +23801,18 @@ var TableWrapper = function TableWrapper(_ref) {
|
|
|
23718
23801
|
setProgressBarPercentage: setProgressBarPercentage
|
|
23719
23802
|
} : undefined
|
|
23720
23803
|
}, action.id);
|
|
23721
|
-
}), state.configuration.createAction && checkPermission(state.configuration.createAction.permission) && !((_state$configuration$
|
|
23804
|
+
}), 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, {
|
|
23722
23805
|
action: state.configuration.createAction,
|
|
23723
23806
|
callback: function callback(data) {
|
|
23724
|
-
var _state$onUpdate, _state$configuration$
|
|
23807
|
+
var _state$onUpdate, _state$configuration$15, _state$configuration$16;
|
|
23725
23808
|
(_state$onUpdate = state.onUpdate) === null || _state$onUpdate === void 0 || _state$onUpdate.call(state, data);
|
|
23726
|
-
(_state$configuration$
|
|
23809
|
+
(_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);
|
|
23727
23810
|
},
|
|
23728
23811
|
type: "Button",
|
|
23729
23812
|
id: 'create',
|
|
23730
23813
|
defaultLabel: t('backoffice.table.emailtemplates.createAction.title'),
|
|
23731
23814
|
isCreateButton: true,
|
|
23732
|
-
disabled: state.configuration.createAction.disableOnToggle === !!state.globalFilter.toggle || ((_state$configuration$
|
|
23815
|
+
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)),
|
|
23733
23816
|
data: state.configuration.createActionMapping ? aplyMapping({
|
|
23734
23817
|
mapable: {},
|
|
23735
23818
|
mapping: state.configuration.createActionMapping,
|
|
@@ -23777,13 +23860,13 @@ var TableWrapper = function TableWrapper(_ref) {
|
|
|
23777
23860
|
className: "andt-table",
|
|
23778
23861
|
scroll: {
|
|
23779
23862
|
x: '100%',
|
|
23780
|
-
y: (_state$configuration$
|
|
23863
|
+
y: (_state$configuration$19 = state.configuration.height) !== null && _state$configuration$19 !== void 0 ? _state$configuration$19 : '100%'
|
|
23781
23864
|
},
|
|
23782
23865
|
rowClassName: editableRow,
|
|
23783
23866
|
components: cellRenderer,
|
|
23784
23867
|
rowKey: function rowKey(dataRow) {
|
|
23785
|
-
var _state$configuration$
|
|
23786
|
-
return goTroughObject(dataRow, (_state$configuration$
|
|
23868
|
+
var _state$configuration$20, _state$configuration$21;
|
|
23869
|
+
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);
|
|
23787
23870
|
},
|
|
23788
23871
|
dataSource: data,
|
|
23789
23872
|
loading: state.loading,
|
|
@@ -23853,22 +23936,22 @@ function DeleteButton(_ref2) {
|
|
|
23853
23936
|
});
|
|
23854
23937
|
}
|
|
23855
23938
|
function CopyButton(_ref3) {
|
|
23856
|
-
var _state$configuration$
|
|
23939
|
+
var _state$configuration$25;
|
|
23857
23940
|
var state = _ref3.state;
|
|
23858
23941
|
var root = useStore();
|
|
23859
|
-
new _default$d({
|
|
23942
|
+
var apiHandler = new _default$d({
|
|
23860
23943
|
apiInterface: state.configuration.apiInterface,
|
|
23861
23944
|
type: 'Table'
|
|
23862
23945
|
}, root);
|
|
23863
23946
|
var onCopy = /*#__PURE__*/function () {
|
|
23864
23947
|
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
23865
|
-
var _state$configuration$
|
|
23948
|
+
var _state$configuration$22;
|
|
23866
23949
|
var copyAction, _iterator3, _step3, selectedRow;
|
|
23867
23950
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
23868
23951
|
while (1) switch (_context.prev = _context.next) {
|
|
23869
23952
|
case 0:
|
|
23870
23953
|
copyAction = state.configuration.copyAction;
|
|
23871
|
-
if (((_state$configuration$
|
|
23954
|
+
if (((_state$configuration$22 = state.configuration.copyAction) === null || _state$configuration$22 === void 0 ? void 0 : _state$configuration$22.apiInterface) != undefined) {
|
|
23872
23955
|
_iterator3 = _createForOfIteratorHelper$4(state.selected);
|
|
23873
23956
|
try {
|
|
23874
23957
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
@@ -23903,22 +23986,28 @@ function CopyButton(_ref3) {
|
|
|
23903
23986
|
}();
|
|
23904
23987
|
var onCopyAction = /*#__PURE__*/function () {
|
|
23905
23988
|
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
23906
|
-
var _state$configuration$
|
|
23907
|
-
var copyAction, id, data;
|
|
23989
|
+
var _state$configuration$23, _state$configuration$24;
|
|
23990
|
+
var copyAction, id, filter, data;
|
|
23908
23991
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
23909
23992
|
while (1) switch (_context3.prev = _context3.next) {
|
|
23910
23993
|
case 0:
|
|
23911
23994
|
copyAction = state.configuration.copyAction;
|
|
23912
|
-
if (!(copyAction.id == undefined || copyAction.actionType != 'Detail' || ((_state$configuration$
|
|
23995
|
+
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')) {
|
|
23913
23996
|
_context3.next = 3;
|
|
23914
23997
|
break;
|
|
23915
23998
|
}
|
|
23916
23999
|
throw new Error('configuration needs to be of type Detail');
|
|
23917
24000
|
case 3:
|
|
23918
24001
|
id = state.selected[0];
|
|
23919
|
-
|
|
23920
|
-
|
|
23921
|
-
|
|
24002
|
+
filter = {};
|
|
24003
|
+
filter['_id'] = [id, 'eq', false];
|
|
24004
|
+
_context3.next = 8;
|
|
24005
|
+
return apiHandler.readList(undefined, undefined, {
|
|
24006
|
+
pagination: {},
|
|
24007
|
+
columns: [],
|
|
24008
|
+
filters: filter
|
|
24009
|
+
});
|
|
24010
|
+
case 8:
|
|
23922
24011
|
data = _context3.sent;
|
|
23923
24012
|
data.data[0] = aplyMapping({
|
|
23924
24013
|
mapable: {},
|
|
@@ -23933,7 +24022,7 @@ function CopyButton(_ref3) {
|
|
|
23933
24022
|
configurationId: copyAction === null || copyAction === void 0 ? void 0 : copyAction.id,
|
|
23934
24023
|
data: data.data[0],
|
|
23935
24024
|
type: copyAction === null || copyAction === void 0 ? void 0 : copyAction.type,
|
|
23936
|
-
mapping: (_state$configuration$
|
|
24025
|
+
mapping: (_state$configuration$24 = state.configuration.createAction) === null || _state$configuration$24 === void 0 ? void 0 : _state$configuration$24.mapping,
|
|
23937
24026
|
mappingData: data.data[0],
|
|
23938
24027
|
callback: function () {
|
|
23939
24028
|
var _callback = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(e) {
|
|
@@ -23943,8 +24032,6 @@ function CopyButton(_ref3) {
|
|
|
23943
24032
|
_context2.next = 2;
|
|
23944
24033
|
return state.onUpdate(e);
|
|
23945
24034
|
case 2:
|
|
23946
|
-
if (copyAction.resetToggleAfter) state.resetToggle();
|
|
23947
|
-
case 3:
|
|
23948
24035
|
case "end":
|
|
23949
24036
|
return _context2.stop();
|
|
23950
24037
|
}
|
|
@@ -23956,7 +24043,7 @@ function CopyButton(_ref3) {
|
|
|
23956
24043
|
return callback;
|
|
23957
24044
|
}()
|
|
23958
24045
|
});
|
|
23959
|
-
case
|
|
24046
|
+
case 11:
|
|
23960
24047
|
case "end":
|
|
23961
24048
|
return _context3.stop();
|
|
23962
24049
|
}
|
|
@@ -23971,7 +24058,7 @@ function CopyButton(_ref3) {
|
|
|
23971
24058
|
return /*#__PURE__*/jsx(Button, {
|
|
23972
24059
|
type: "primary",
|
|
23973
24060
|
onClick: onCopy,
|
|
23974
|
-
disabled: state.selected.length == 0 || state.selected.length > 1 && ((_state$configuration$
|
|
24061
|
+
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),
|
|
23975
24062
|
children: t('backoffice.basetable.copy')
|
|
23976
24063
|
});
|
|
23977
24064
|
}
|
|
@@ -24185,8 +24272,6 @@ function BulkAction(_ref6) {
|
|
|
24185
24272
|
}
|
|
24186
24273
|
function SelectionText(_ref8) {
|
|
24187
24274
|
var selected = _ref8.selected;
|
|
24188
|
-
var _useTranslation5 = useTranslation(),
|
|
24189
|
-
t = _useTranslation5.t;
|
|
24190
24275
|
if (!(selected !== null && selected !== void 0 && selected.length)) {
|
|
24191
24276
|
return /*#__PURE__*/jsx(Fragment, {});
|
|
24192
24277
|
}
|
|
@@ -24196,7 +24281,7 @@ function SelectionText(_ref8) {
|
|
|
24196
24281
|
fontWeight: 'normal',
|
|
24197
24282
|
fontSize: 'small'
|
|
24198
24283
|
},
|
|
24199
|
-
children: "".concat(selected.length, " ")
|
|
24284
|
+
children: "".concat(selected.length, " Eintr\xE4ge ausgew\xE4hlt")
|
|
24200
24285
|
});
|
|
24201
24286
|
}
|
|
24202
24287
|
|
|
@@ -25080,44 +25165,16 @@ function useTableData$1 (_ref) {
|
|
|
25080
25165
|
});
|
|
25081
25166
|
}
|
|
25082
25167
|
};
|
|
25083
|
-
var getDataById = /*#__PURE__*/function () {
|
|
25084
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(id) {
|
|
25085
|
-
var filters, data;
|
|
25086
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
25087
|
-
while (1) switch (_context.prev = _context.next) {
|
|
25088
|
-
case 0:
|
|
25089
|
-
filters = {};
|
|
25090
|
-
filters['_id'] = [id, 'eq', false];
|
|
25091
|
-
_context.next = 4;
|
|
25092
|
-
return apiHandler.readList(configuration.mapping, {
|
|
25093
|
-
pagination: _objectSpread$h({}, state.pagination),
|
|
25094
|
-
columns: configuration.columns,
|
|
25095
|
-
filters: filters,
|
|
25096
|
-
sorter: filterData.sorter
|
|
25097
|
-
});
|
|
25098
|
-
case 4:
|
|
25099
|
-
data = _context.sent;
|
|
25100
|
-
return _context.abrupt("return", data);
|
|
25101
|
-
case 6:
|
|
25102
|
-
case "end":
|
|
25103
|
-
return _context.stop();
|
|
25104
|
-
}
|
|
25105
|
-
}, _callee);
|
|
25106
|
-
}));
|
|
25107
|
-
return function getDataById(_x) {
|
|
25108
|
-
return _ref2.apply(this, arguments);
|
|
25109
|
-
};
|
|
25110
|
-
}();
|
|
25111
25168
|
var onSelect = function onSelect(keys) {
|
|
25112
25169
|
setState(_objectSpread$h(_objectSpread$h({}, state), {}, {
|
|
25113
25170
|
selected: keys
|
|
25114
25171
|
}));
|
|
25115
25172
|
};
|
|
25116
25173
|
var onDelete = /*#__PURE__*/function () {
|
|
25117
|
-
var
|
|
25174
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
25118
25175
|
var newData, deleted, _loop, mappingData, index, total, pages, current, data;
|
|
25119
|
-
return _regeneratorRuntime.wrap(function
|
|
25120
|
-
while (1) switch (
|
|
25176
|
+
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
|
25177
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
25121
25178
|
case 0:
|
|
25122
25179
|
setState(_objectSpread$h(_objectSpread$h({}, state), {}, {
|
|
25123
25180
|
deleting: true
|
|
@@ -25127,24 +25184,24 @@ function useTableData$1 (_ref) {
|
|
|
25127
25184
|
_loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop(index) {
|
|
25128
25185
|
var _newData$filter, _configuration$delete;
|
|
25129
25186
|
var id, deleteResult, deletedIndex;
|
|
25130
|
-
return _regeneratorRuntime.wrap(function _loop$(
|
|
25131
|
-
while (1) switch (
|
|
25187
|
+
return _regeneratorRuntime.wrap(function _loop$(_context) {
|
|
25188
|
+
while (1) switch (_context.prev = _context.next) {
|
|
25132
25189
|
case 0:
|
|
25133
25190
|
id = state.selected[index];
|
|
25134
25191
|
mappingData = (_newData$filter = newData.filter(function (nd) {
|
|
25135
25192
|
return nd._id === state.selected[index];
|
|
25136
25193
|
})) === null || _newData$filter === void 0 ? void 0 : _newData$filter[0];
|
|
25137
25194
|
mappingData = _objectSpread$h(_objectSpread$h({}, mappingData), state.mappingData);
|
|
25138
|
-
|
|
25195
|
+
_context.next = 5;
|
|
25139
25196
|
return apiHandler["delete"](id, (_configuration$delete = configuration.deleteMapping) !== null && _configuration$delete !== void 0 ? _configuration$delete : configuration.mapping, mappingData, true);
|
|
25140
25197
|
case 5:
|
|
25141
|
-
deleteResult =
|
|
25198
|
+
deleteResult = _context.sent;
|
|
25142
25199
|
if (deleteResult) {
|
|
25143
|
-
|
|
25200
|
+
_context.next = 9;
|
|
25144
25201
|
break;
|
|
25145
25202
|
}
|
|
25146
25203
|
setError('Fehler beim löschen eines Elementes.');
|
|
25147
|
-
return
|
|
25204
|
+
return _context.abrupt("return", 1);
|
|
25148
25205
|
case 9:
|
|
25149
25206
|
deletedIndex = newData.findIndex(function (d) {
|
|
25150
25207
|
return (d === null || d === void 0 ? void 0 : d._id) == id;
|
|
@@ -25153,36 +25210,36 @@ function useTableData$1 (_ref) {
|
|
|
25153
25210
|
deleted++;
|
|
25154
25211
|
case 12:
|
|
25155
25212
|
case "end":
|
|
25156
|
-
return
|
|
25213
|
+
return _context.stop();
|
|
25157
25214
|
}
|
|
25158
25215
|
}, _loop);
|
|
25159
25216
|
});
|
|
25160
25217
|
index = 0;
|
|
25161
25218
|
case 5:
|
|
25162
25219
|
if (!(index < state.selected.length)) {
|
|
25163
|
-
|
|
25220
|
+
_context2.next = 12;
|
|
25164
25221
|
break;
|
|
25165
25222
|
}
|
|
25166
|
-
return
|
|
25223
|
+
return _context2.delegateYield(_loop(index), "t0", 7);
|
|
25167
25224
|
case 7:
|
|
25168
|
-
if (!
|
|
25169
|
-
|
|
25225
|
+
if (!_context2.t0) {
|
|
25226
|
+
_context2.next = 9;
|
|
25170
25227
|
break;
|
|
25171
25228
|
}
|
|
25172
|
-
return
|
|
25229
|
+
return _context2.abrupt("continue", 9);
|
|
25173
25230
|
case 9:
|
|
25174
25231
|
index++;
|
|
25175
|
-
|
|
25232
|
+
_context2.next = 5;
|
|
25176
25233
|
break;
|
|
25177
25234
|
case 12:
|
|
25178
25235
|
total = state.pagination.total - deleted;
|
|
25179
25236
|
pages = Math.ceil(total / state.pagination.pageSize);
|
|
25180
25237
|
current = state.pagination.current > pages ? pages || 1 : state.pagination.current;
|
|
25181
25238
|
if (!(pages > 0 && state.pagination.current > pages && filterServerSide || state.selected.length === 0)) {
|
|
25182
|
-
|
|
25239
|
+
_context2.next = 21;
|
|
25183
25240
|
break;
|
|
25184
25241
|
}
|
|
25185
|
-
|
|
25242
|
+
_context2.next = 18;
|
|
25186
25243
|
return apiHandler.readList(configuration.mapping, {
|
|
25187
25244
|
pagination: _objectSpread$h(_objectSpread$h({}, state.pagination), {}, {
|
|
25188
25245
|
current: current
|
|
@@ -25192,7 +25249,7 @@ function useTableData$1 (_ref) {
|
|
|
25192
25249
|
sorter: filterData.sorter
|
|
25193
25250
|
});
|
|
25194
25251
|
case 18:
|
|
25195
|
-
data =
|
|
25252
|
+
data = _context2.sent;
|
|
25196
25253
|
newData = data.data;
|
|
25197
25254
|
total = data.total;
|
|
25198
25255
|
case 21:
|
|
@@ -25207,12 +25264,12 @@ function useTableData$1 (_ref) {
|
|
|
25207
25264
|
}));
|
|
25208
25265
|
case 22:
|
|
25209
25266
|
case "end":
|
|
25210
|
-
return
|
|
25267
|
+
return _context2.stop();
|
|
25211
25268
|
}
|
|
25212
|
-
},
|
|
25269
|
+
}, _callee);
|
|
25213
25270
|
}));
|
|
25214
25271
|
return function onDelete() {
|
|
25215
|
-
return
|
|
25272
|
+
return _ref2.apply(this, arguments);
|
|
25216
25273
|
};
|
|
25217
25274
|
}();
|
|
25218
25275
|
function setLoading() {
|
|
@@ -25232,10 +25289,6 @@ function useTableData$1 (_ref) {
|
|
|
25232
25289
|
onChange: onChange,
|
|
25233
25290
|
onUpdate: onUpdate,
|
|
25234
25291
|
onDelete: onDelete,
|
|
25235
|
-
getDataById: getDataById,
|
|
25236
|
-
resetToggle: function resetToggle() {
|
|
25237
|
-
throw new Error('not implemented for CatalogTable');
|
|
25238
|
-
},
|
|
25239
25292
|
triggerRefresh: function triggerRefresh() {
|
|
25240
25293
|
throw new Error('not implemented for CatalogTable');
|
|
25241
25294
|
},
|
|
@@ -25585,74 +25638,38 @@ function useTableData (_ref) {
|
|
|
25585
25638
|
}
|
|
25586
25639
|
return title;
|
|
25587
25640
|
}, [configuration.title, parentData]);
|
|
25588
|
-
var getDataById = /*#__PURE__*/function () {
|
|
25589
|
-
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(id) {
|
|
25590
|
-
var _configuration$filter9;
|
|
25591
|
-
var filters, ssf, data;
|
|
25592
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
25593
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
25594
|
-
case 0:
|
|
25595
|
-
filters = {};
|
|
25596
|
-
filters['_id'] = [id, 'eq', false];
|
|
25597
|
-
ssf = _objectSpread$g({
|
|
25598
|
-
pagination: {
|
|
25599
|
-
current: 1,
|
|
25600
|
-
pageSize: 1
|
|
25601
|
-
},
|
|
25602
|
-
columns: configuration.columns,
|
|
25603
|
-
filters: filters
|
|
25604
|
-
}, 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 ? {
|
|
25605
|
-
genericProps: globalFilter.toggle
|
|
25606
|
-
} : undefined);
|
|
25607
|
-
_context2.next = 5;
|
|
25608
|
-
return apiHandler.readList(parentMapping || configuration.mapping, mapping, ssf);
|
|
25609
|
-
case 5:
|
|
25610
|
-
data = _context2.sent;
|
|
25611
|
-
return _context2.abrupt("return", data);
|
|
25612
|
-
case 7:
|
|
25613
|
-
case "end":
|
|
25614
|
-
return _context2.stop();
|
|
25615
|
-
}
|
|
25616
|
-
}, _callee2);
|
|
25617
|
-
}));
|
|
25618
|
-
return function getDataById(_x2) {
|
|
25619
|
-
return _ref4.apply(this, arguments);
|
|
25620
|
-
};
|
|
25621
|
-
}();
|
|
25622
25641
|
var onChange = /*#__PURE__*/function () {
|
|
25623
|
-
var
|
|
25624
|
-
var _configuration$
|
|
25642
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(p) {
|
|
25643
|
+
var _configuration$filter9, _configuration$filter10, _configuration$filter11, _prefilter$select, _configuration$filter12, _configuration$filter13;
|
|
25625
25644
|
var prefilter,
|
|
25626
25645
|
refresh,
|
|
25627
|
-
clearSelection,
|
|
25628
25646
|
currentData,
|
|
25629
25647
|
filterData,
|
|
25630
25648
|
currentFilterHash,
|
|
25631
25649
|
currentPagination,
|
|
25632
25650
|
currentUrl,
|
|
25633
|
-
_configuration$
|
|
25651
|
+
_configuration$filter14,
|
|
25634
25652
|
ssf,
|
|
25635
25653
|
data,
|
|
25636
25654
|
_data3,
|
|
25637
25655
|
_aplyFilterAndSortati2,
|
|
25638
25656
|
_data4,
|
|
25639
25657
|
pagination,
|
|
25640
|
-
|
|
25641
|
-
return _regeneratorRuntime.wrap(function
|
|
25642
|
-
while (1) switch (
|
|
25658
|
+
_args2 = arguments;
|
|
25659
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
25660
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
25643
25661
|
case 0:
|
|
25644
|
-
prefilter =
|
|
25645
|
-
refresh =
|
|
25646
|
-
clearSelection = _args3.length > 3 ? _args3[3] : undefined;
|
|
25662
|
+
prefilter = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : globalFilter;
|
|
25663
|
+
refresh = _args2.length > 2 ? _args2[2] : undefined;
|
|
25647
25664
|
setState(_objectSpread$g(_objectSpread$g({}, state), {}, {
|
|
25648
25665
|
loading: true
|
|
25649
25666
|
}));
|
|
25650
25667
|
currentData = initData;
|
|
25651
|
-
filterData = _objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g({}, p.filters), prefilter.search), !(configuration !== null && configuration !== void 0 && (_configuration$
|
|
25652
|
-
filterData = Object.fromEntries(Object.entries(filterData).filter(function (
|
|
25653
|
-
var
|
|
25654
|
-
|
|
25655
|
-
var v =
|
|
25668
|
+
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
|
|
25669
|
+
filterData = Object.fromEntries(Object.entries(filterData).filter(function (_ref5) {
|
|
25670
|
+
var _ref6 = _slicedToArray(_ref5, 2);
|
|
25671
|
+
_ref6[0];
|
|
25672
|
+
var v = _ref6[1];
|
|
25656
25673
|
return v != null;
|
|
25657
25674
|
}));
|
|
25658
25675
|
currentFilterHash = objectHash(filterData);
|
|
@@ -25661,7 +25678,7 @@ function useTableData (_ref) {
|
|
|
25661
25678
|
});
|
|
25662
25679
|
filterHash.current = currentFilterHash;
|
|
25663
25680
|
if (!filterServerSide) {
|
|
25664
|
-
|
|
25681
|
+
_context2.next = 19;
|
|
25665
25682
|
break;
|
|
25666
25683
|
}
|
|
25667
25684
|
ssf = _objectSpread$g({
|
|
@@ -25669,32 +25686,32 @@ function useTableData (_ref) {
|
|
|
25669
25686
|
columns: configuration.columns,
|
|
25670
25687
|
filters: filterData,
|
|
25671
25688
|
sorter: p.sorter
|
|
25672
|
-
}, configuration !== null && configuration !== void 0 && (_configuration$
|
|
25689
|
+
}, 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 ? {
|
|
25673
25690
|
genericProps: prefilter.toggle
|
|
25674
25691
|
} : undefined);
|
|
25675
|
-
|
|
25692
|
+
_context2.next = 13;
|
|
25676
25693
|
return apiHandler.readList(parentMapping || configuration.mapping, mapping, ssf);
|
|
25677
|
-
case
|
|
25678
|
-
data =
|
|
25694
|
+
case 13:
|
|
25695
|
+
data = _context2.sent;
|
|
25679
25696
|
currentUrl = apiHandler.getReadListUrl(parentMapping || configuration.mapping, mapping, ssf);
|
|
25680
25697
|
currentData = data.data;
|
|
25681
25698
|
currentPagination = _objectSpread$g(_objectSpread$g({}, currentPagination), {}, {
|
|
25682
25699
|
total: data.total
|
|
25683
25700
|
});
|
|
25684
|
-
|
|
25701
|
+
_context2.next = 28;
|
|
25685
25702
|
break;
|
|
25686
|
-
case
|
|
25703
|
+
case 19:
|
|
25687
25704
|
if (!(!currentData || currentData.length === 0 || refresh)) {
|
|
25688
|
-
|
|
25705
|
+
_context2.next = 25;
|
|
25689
25706
|
break;
|
|
25690
25707
|
}
|
|
25691
|
-
|
|
25708
|
+
_context2.next = 22;
|
|
25692
25709
|
return apiHandler.readList(parentMapping || configuration.mapping, mapping, undefined);
|
|
25693
|
-
case
|
|
25694
|
-
_data3 =
|
|
25710
|
+
case 22:
|
|
25711
|
+
_data3 = _context2.sent;
|
|
25695
25712
|
currentData = _data3.data;
|
|
25696
25713
|
setInitData(currentData);
|
|
25697
|
-
case
|
|
25714
|
+
case 25:
|
|
25698
25715
|
_aplyFilterAndSortati2 = aplyFilterAndSortation(_objectSpread$g(_objectSpread$g({}, p), {}, {
|
|
25699
25716
|
pagination: currentPagination,
|
|
25700
25717
|
filters: filterData,
|
|
@@ -25703,7 +25720,7 @@ function useTableData (_ref) {
|
|
|
25703
25720
|
})), _data4 = _aplyFilterAndSortati2.data, pagination = _aplyFilterAndSortati2.pagination;
|
|
25704
25721
|
currentData = _data4;
|
|
25705
25722
|
currentPagination = pagination;
|
|
25706
|
-
case
|
|
25723
|
+
case 28:
|
|
25707
25724
|
setState(_objectSpread$g(_objectSpread$g({}, state), {}, {
|
|
25708
25725
|
loading: false,
|
|
25709
25726
|
data: currentData,
|
|
@@ -25712,21 +25729,19 @@ function useTableData (_ref) {
|
|
|
25712
25729
|
prefilter: prefilter
|
|
25713
25730
|
}),
|
|
25714
25731
|
currentFetchUrl: currentUrl
|
|
25715
|
-
}
|
|
25716
|
-
selected: []
|
|
25717
|
-
} : {}));
|
|
25732
|
+
}));
|
|
25718
25733
|
setFilter({
|
|
25719
25734
|
filters: p.filters,
|
|
25720
25735
|
sorter: p.sorter
|
|
25721
25736
|
});
|
|
25722
|
-
case
|
|
25737
|
+
case 30:
|
|
25723
25738
|
case "end":
|
|
25724
|
-
return
|
|
25739
|
+
return _context2.stop();
|
|
25725
25740
|
}
|
|
25726
|
-
},
|
|
25741
|
+
}, _callee2);
|
|
25727
25742
|
}));
|
|
25728
|
-
return function onChange(
|
|
25729
|
-
return
|
|
25743
|
+
return function onChange(_x2) {
|
|
25744
|
+
return _ref4.apply(this, arguments);
|
|
25730
25745
|
};
|
|
25731
25746
|
}();
|
|
25732
25747
|
var onSelect = function onSelect(keys) {
|
|
@@ -25735,11 +25750,11 @@ function useTableData (_ref) {
|
|
|
25735
25750
|
}));
|
|
25736
25751
|
};
|
|
25737
25752
|
var onDelete = /*#__PURE__*/function () {
|
|
25738
|
-
var
|
|
25753
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
25739
25754
|
var _configuration$apiInt2;
|
|
25740
|
-
var newData, newInitData, deleted, userPermissions, _loop, mappingData, deleteResult, _ret, index, total, pages, current, _configuration$
|
|
25741
|
-
return _regeneratorRuntime.wrap(function
|
|
25742
|
-
while (1) switch (
|
|
25755
|
+
var newData, newInitData, deleted, userPermissions, _loop, mappingData, deleteResult, _ret, index, total, pages, current, _configuration$filter15, _configuration$filter16, data;
|
|
25756
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context4) {
|
|
25757
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
25743
25758
|
case 0:
|
|
25744
25759
|
setState(_objectSpread$g(_objectSpread$g({}, state), {}, {
|
|
25745
25760
|
deleting: true
|
|
@@ -25747,15 +25762,15 @@ function useTableData (_ref) {
|
|
|
25747
25762
|
newData = _toConsumableArray(state.data);
|
|
25748
25763
|
newInitData = initData ? _toConsumableArray(initData) : undefined;
|
|
25749
25764
|
deleted = 0;
|
|
25750
|
-
|
|
25765
|
+
_context4.next = 6;
|
|
25751
25766
|
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;
|
|
25752
25767
|
case 6:
|
|
25753
|
-
userPermissions =
|
|
25768
|
+
userPermissions = _context4.sent;
|
|
25754
25769
|
_loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop(index) {
|
|
25755
|
-
var _configuration$
|
|
25770
|
+
var _configuration$rowKey, _configuration$filter17, _configuration$filter18;
|
|
25756
25771
|
var id, _newData$filter, _newData$filter2, mapToggle, _iterator, _step, _globalFilter$toggle, field, _globalFilter$toggle2, _configuration$delete, _configuration$onErro, _configuration$onErro2, deletedIndex, initDeletedIndex;
|
|
25757
|
-
return _regeneratorRuntime.wrap(function _loop$(
|
|
25758
|
-
while (1) switch (
|
|
25772
|
+
return _regeneratorRuntime.wrap(function _loop$(_context3) {
|
|
25773
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
25759
25774
|
case 0:
|
|
25760
25775
|
id = state.selected[index];
|
|
25761
25776
|
if (configuration.rowKey) {
|
|
@@ -25768,7 +25783,7 @@ function useTableData (_ref) {
|
|
|
25768
25783
|
})) === null || _newData$filter2 === void 0 ? void 0 : _newData$filter2[0];
|
|
25769
25784
|
}
|
|
25770
25785
|
mapToggle = {};
|
|
25771
|
-
_iterator = _createForOfIteratorHelper$3((_configuration$
|
|
25786
|
+
_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 : []);
|
|
25772
25787
|
try {
|
|
25773
25788
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
25774
25789
|
field = _step.value;
|
|
@@ -25783,106 +25798,107 @@ function useTableData (_ref) {
|
|
|
25783
25798
|
}
|
|
25784
25799
|
mappingData = _objectSpread$g(_objectSpread$g(_objectSpread$g({}, mappingData), state.mappingData), mapToggle);
|
|
25785
25800
|
deleteResult = undefined;
|
|
25786
|
-
|
|
25801
|
+
_context3.prev = 7;
|
|
25787
25802
|
if (!(userPermissions && !root.actions.userHasPermission(userPermissions))) {
|
|
25788
|
-
|
|
25803
|
+
_context3.next = 11;
|
|
25789
25804
|
break;
|
|
25790
25805
|
}
|
|
25791
25806
|
setError('Sie haben keine Berechtigung ein Mediaitem zu löschen.');
|
|
25792
|
-
return
|
|
25807
|
+
return _context3.abrupt("return", 0);
|
|
25793
25808
|
case 11:
|
|
25794
|
-
|
|
25809
|
+
_context3.next = 13;
|
|
25795
25810
|
return apiHandler["delete"](id, (_configuration$delete = configuration.deleteMapping) !== null && _configuration$delete !== void 0 ? _configuration$delete : configuration.mapping, mappingData);
|
|
25796
25811
|
case 13:
|
|
25797
|
-
deleteResult =
|
|
25798
|
-
|
|
25812
|
+
deleteResult = _context3.sent;
|
|
25813
|
+
_context3.next = 24;
|
|
25799
25814
|
break;
|
|
25800
25815
|
case 16:
|
|
25801
|
-
|
|
25802
|
-
|
|
25803
|
-
if (!(
|
|
25804
|
-
|
|
25816
|
+
_context3.prev = 16;
|
|
25817
|
+
_context3.t0 = _context3["catch"](7);
|
|
25818
|
+
if (!(_context3.t0 instanceof DivaError && _context3.t0.name)) {
|
|
25819
|
+
_context3.next = 22;
|
|
25805
25820
|
break;
|
|
25806
25821
|
}
|
|
25807
|
-
if (!((_configuration$onErro = configuration.onError) !== null && _configuration$onErro !== void 0 && _configuration$onErro[
|
|
25808
|
-
|
|
25822
|
+
if (!((_configuration$onErro = configuration.onError) !== null && _configuration$onErro !== void 0 && _configuration$onErro[_context3.t0.name])) {
|
|
25823
|
+
_context3.next = 22;
|
|
25809
25824
|
break;
|
|
25810
25825
|
}
|
|
25811
|
-
setError((_configuration$onErro2 = configuration.onError) === null || _configuration$onErro2 === void 0 ? void 0 : _configuration$onErro2[
|
|
25812
|
-
return
|
|
25826
|
+
setError((_configuration$onErro2 = configuration.onError) === null || _configuration$onErro2 === void 0 ? void 0 : _configuration$onErro2[_context3.t0.name]);
|
|
25827
|
+
return _context3.abrupt("return", 0);
|
|
25813
25828
|
case 22:
|
|
25814
|
-
setError(
|
|
25815
|
-
return
|
|
25829
|
+
setError(_context3.t0.message);
|
|
25830
|
+
return _context3.abrupt("return", 0);
|
|
25816
25831
|
case 24:
|
|
25817
25832
|
if (deleteResult) {
|
|
25818
|
-
|
|
25833
|
+
_context3.next = 27;
|
|
25819
25834
|
break;
|
|
25820
25835
|
}
|
|
25821
25836
|
setError('Fehler beim löschen eines Elementes.');
|
|
25822
|
-
return
|
|
25837
|
+
return _context3.abrupt("return", 1);
|
|
25823
25838
|
case 27:
|
|
25839
|
+
(_configuration$rowKey = configuration.rowKey) !== null && _configuration$rowKey !== void 0 ? _configuration$rowKey : '_id';
|
|
25824
25840
|
deletedIndex = newData.findIndex(function (d) {
|
|
25825
|
-
var _configuration$
|
|
25826
|
-
return goTroughObject(d, (_configuration$
|
|
25841
|
+
var _configuration$rowKey2, _configuration$rowKey3;
|
|
25842
|
+
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;
|
|
25827
25843
|
});
|
|
25828
25844
|
newData.splice(deletedIndex, 1);
|
|
25829
25845
|
initDeletedIndex = newInitData === null || newInitData === void 0 ? void 0 : newInitData.findIndex(function (d) {
|
|
25830
|
-
var _configuration$
|
|
25831
|
-
return goTroughObject(d, (_configuration$
|
|
25846
|
+
var _configuration$rowKey4, _configuration$rowKey5;
|
|
25847
|
+
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;
|
|
25832
25848
|
});
|
|
25833
25849
|
newInitData === null || newInitData === void 0 || newInitData.splice(initDeletedIndex, 1);
|
|
25834
25850
|
deleted++;
|
|
25835
|
-
case
|
|
25851
|
+
case 33:
|
|
25836
25852
|
case "end":
|
|
25837
|
-
return
|
|
25853
|
+
return _context3.stop();
|
|
25838
25854
|
}
|
|
25839
25855
|
}, _loop, null, [[7, 16]]);
|
|
25840
25856
|
});
|
|
25841
25857
|
index = 0;
|
|
25842
25858
|
case 9:
|
|
25843
25859
|
if (!(index < state.selected.length)) {
|
|
25844
|
-
|
|
25860
|
+
_context4.next = 19;
|
|
25845
25861
|
break;
|
|
25846
25862
|
}
|
|
25847
|
-
return
|
|
25863
|
+
return _context4.delegateYield(_loop(index), "t0", 11);
|
|
25848
25864
|
case 11:
|
|
25849
|
-
_ret =
|
|
25865
|
+
_ret = _context4.t0;
|
|
25850
25866
|
if (!(_ret === 0)) {
|
|
25851
|
-
|
|
25867
|
+
_context4.next = 14;
|
|
25852
25868
|
break;
|
|
25853
25869
|
}
|
|
25854
|
-
return
|
|
25870
|
+
return _context4.abrupt("break", 19);
|
|
25855
25871
|
case 14:
|
|
25856
25872
|
if (!(_ret === 1)) {
|
|
25857
|
-
|
|
25873
|
+
_context4.next = 16;
|
|
25858
25874
|
break;
|
|
25859
25875
|
}
|
|
25860
|
-
return
|
|
25876
|
+
return _context4.abrupt("continue", 16);
|
|
25861
25877
|
case 16:
|
|
25862
25878
|
index++;
|
|
25863
|
-
|
|
25879
|
+
_context4.next = 9;
|
|
25864
25880
|
break;
|
|
25865
25881
|
case 19:
|
|
25866
25882
|
total = state.pagination.total - deleted;
|
|
25867
25883
|
pages = Math.ceil(total / state.pagination.pageSize);
|
|
25868
25884
|
current = state.pagination.current > pages ? pages : state.pagination.current;
|
|
25869
25885
|
if (!(state.pagination.current > pages && filterServerSide || state.selected.length === 0)) {
|
|
25870
|
-
|
|
25886
|
+
_context4.next = 28;
|
|
25871
25887
|
break;
|
|
25872
25888
|
}
|
|
25873
|
-
|
|
25889
|
+
_context4.next = 25;
|
|
25874
25890
|
return apiHandler.readList(parentMapping || configuration.mapping, mapping, _objectSpread$g({
|
|
25875
25891
|
pagination: _objectSpread$g(_objectSpread$g({}, state.pagination), {}, {
|
|
25876
25892
|
current: current
|
|
25877
25893
|
}),
|
|
25878
25894
|
columns: configuration.columns,
|
|
25879
|
-
filters: _objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g({}, filterData.filters), globalFilter.search), !(configuration !== null && configuration !== void 0 && (_configuration$
|
|
25895
|
+
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"]),
|
|
25880
25896
|
sorter: filterData.sorter
|
|
25881
|
-
}, configuration !== null && configuration !== void 0 && (_configuration$
|
|
25897
|
+
}, 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 ? {
|
|
25882
25898
|
genericProps: globalFilter.toggle
|
|
25883
25899
|
} : undefined));
|
|
25884
25900
|
case 25:
|
|
25885
|
-
data =
|
|
25901
|
+
data = _context4.sent;
|
|
25886
25902
|
newData = data.data;
|
|
25887
25903
|
total = data.total;
|
|
25888
25904
|
case 28:
|
|
@@ -25898,17 +25914,17 @@ function useTableData (_ref) {
|
|
|
25898
25914
|
}));
|
|
25899
25915
|
case 30:
|
|
25900
25916
|
case "end":
|
|
25901
|
-
return
|
|
25917
|
+
return _context4.stop();
|
|
25902
25918
|
}
|
|
25903
|
-
},
|
|
25919
|
+
}, _callee3);
|
|
25904
25920
|
}));
|
|
25905
25921
|
return function onDelete() {
|
|
25906
|
-
return
|
|
25922
|
+
return _ref7.apply(this, arguments);
|
|
25907
25923
|
};
|
|
25908
25924
|
}();
|
|
25909
25925
|
var onGlobalFilterSelect = function onGlobalFilterSelect(value) {
|
|
25910
|
-
var _configuration$
|
|
25911
|
-
if (!((_configuration$
|
|
25926
|
+
var _configuration$filter19;
|
|
25927
|
+
if (!((_configuration$filter19 = configuration.filter) !== null && _configuration$filter19 !== void 0 && _configuration$filter19.select)) {
|
|
25912
25928
|
LOG$2.error(new DivaError('No global select filter defiend'));
|
|
25913
25929
|
return;
|
|
25914
25930
|
}
|
|
@@ -25924,8 +25940,8 @@ function useTableData (_ref) {
|
|
|
25924
25940
|
}, filterData), newGlobalFilter);
|
|
25925
25941
|
};
|
|
25926
25942
|
var onGlobalFilterToggle = function onGlobalFilterToggle() {
|
|
25927
|
-
var _configuration$
|
|
25928
|
-
if (!((_configuration$
|
|
25943
|
+
var _configuration$filter20;
|
|
25944
|
+
if (!((_configuration$filter20 = configuration.filter) !== null && _configuration$filter20 !== void 0 && _configuration$filter20.toggle)) {
|
|
25929
25945
|
LOG$2.error(new DivaError('No global toggle filter defined'));
|
|
25930
25946
|
return;
|
|
25931
25947
|
}
|
|
@@ -25939,14 +25955,11 @@ function useTableData (_ref) {
|
|
|
25939
25955
|
setGlobaFilter(newGlobalFilter);
|
|
25940
25956
|
onChange(_objectSpread$g({
|
|
25941
25957
|
pagination: state.pagination
|
|
25942
|
-
}, filterData), newGlobalFilter
|
|
25943
|
-
};
|
|
25944
|
-
var resetToggle = function resetToggle() {
|
|
25945
|
-
if (globalFilter !== null && globalFilter !== void 0 && globalFilter.toggle) onGlobalFilterToggle();
|
|
25958
|
+
}, filterData), newGlobalFilter);
|
|
25946
25959
|
};
|
|
25947
25960
|
var onGlobalFilterSearch = function onGlobalFilterSearch(value) {
|
|
25948
|
-
var _configuration$
|
|
25949
|
-
if (!((_configuration$
|
|
25961
|
+
var _configuration$filter21;
|
|
25962
|
+
if (!((_configuration$filter21 = configuration.filter) !== null && _configuration$filter21 !== void 0 && _configuration$filter21.search)) {
|
|
25950
25963
|
LOG$2.error(new DivaError('No global search filter defiend'));
|
|
25951
25964
|
return;
|
|
25952
25965
|
}
|
|
@@ -25954,8 +25967,8 @@ function useTableData (_ref) {
|
|
|
25954
25967
|
search: {}
|
|
25955
25968
|
});
|
|
25956
25969
|
if (value) {
|
|
25957
|
-
var _configuration$
|
|
25958
|
-
(_configuration$
|
|
25970
|
+
var _configuration$filter22;
|
|
25971
|
+
(_configuration$filter22 = configuration.filter) === null || _configuration$filter22 === void 0 || _configuration$filter22.search.fields.forEach(function (f) {
|
|
25959
25972
|
if (typeof f == 'string') {
|
|
25960
25973
|
newGlobalFilter.search[f] = [value, 'contains', 0];
|
|
25961
25974
|
} else {
|
|
@@ -25969,8 +25982,8 @@ function useTableData (_ref) {
|
|
|
25969
25982
|
}, filterData), newGlobalFilter);
|
|
25970
25983
|
};
|
|
25971
25984
|
var onGlobalFilterPeriod = function onGlobalFilterPeriod(from, to) {
|
|
25972
|
-
var _configuration$
|
|
25973
|
-
if (!((_configuration$
|
|
25985
|
+
var _configuration$filter23;
|
|
25986
|
+
if (!((_configuration$filter23 = configuration.filter) !== null && _configuration$filter23 !== void 0 && _configuration$filter23.period)) {
|
|
25974
25987
|
LOG$2.error(new DivaError('No global period filter defiend'));
|
|
25975
25988
|
return;
|
|
25976
25989
|
}
|
|
@@ -25992,9 +26005,7 @@ function useTableData (_ref) {
|
|
|
25992
26005
|
onUpdate: onUpdate,
|
|
25993
26006
|
onDelete: onDelete,
|
|
25994
26007
|
onSelect: onSelect,
|
|
25995
|
-
getDataById: getDataById,
|
|
25996
26008
|
triggerRefresh: triggerRefresh,
|
|
25997
|
-
resetToggle: resetToggle,
|
|
25998
26009
|
onSelectedCatalog: onSelectedCatalog,
|
|
25999
26010
|
error: error,
|
|
26000
26011
|
catalogItem: catalogItem,
|