@crystaldesign/diva-backoffice 24.11.0-beta.39 → 24.11.0-beta.40
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 +1286 -243
- package/build/types/backoffice/src/layout/Toolbar/index.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/AssetMananger/MediaItem.d.ts +24 -0
- package/build/types/backoffice/src/ui/AssetMananger/MediaItem.d.ts.map +1 -0
- package/build/types/backoffice/src/ui/AssetMananger/Upload/FileFromWeb.d.ts +4 -0
- package/build/types/backoffice/src/ui/AssetMananger/Upload/FileFromWeb.d.ts.map +1 -0
- package/build/types/backoffice/src/ui/AssetMananger/Upload/index.d.ts +12 -0
- package/build/types/backoffice/src/ui/AssetMananger/Upload/index.d.ts.map +1 -0
- package/build/types/backoffice/src/ui/AssetMananger/index.d.ts +3 -0
- package/build/types/backoffice/src/ui/AssetMananger/index.d.ts.map +1 -0
- package/build/types/backoffice/src/ui/AssetMananger/utils.d.ts +9 -0
- package/build/types/backoffice/src/ui/AssetMananger/utils.d.ts.map +1 -0
- package/build/types/backoffice/src/ui/Description/index.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/Form/Fields/FormList/index.d.ts +4 -4
- package/build/types/backoffice/src/ui/Form/Fields/FormList/index.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/Form/Fields/Media/index.d.ts +11 -0
- package/build/types/backoffice/src/ui/Form/Fields/Media/index.d.ts.map +1 -0
- package/build/types/backoffice/src/ui/Form/Fields/Translation/index.d.ts +4 -1
- package/build/types/backoffice/src/ui/Form/Fields/Translation/index.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/Form/elements.d.ts +1 -1
- package/build/types/backoffice/src/ui/Form/elements.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/Form/index.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/Form/types.d.ts +10 -2
- package/build/types/backoffice/src/ui/Form/types.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/Form/useFormData.d.ts +5 -2
- package/build/types/backoffice/src/ui/Form/useFormData.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/Table/CatalogTable/index.d.ts.map +1 -1
- package/package.json +3 -3
package/build/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import React, { createElement, createContext, useState, useEffect, useRef, useMemo, useImperativeHandle, useCallback, createRef, useReducer, useContext, memo } from 'react';
|
|
3
3
|
import 'antd/dist/reset.css';
|
|
4
|
-
import { Form as Form$1, Button, Input, Popover, Typography, Divider, Select as Select$1, Avatar, Spin, Radio, DatePicker, Checkbox, InputNumber, Modal as Modal$2, Progress,
|
|
4
|
+
import { Form as Form$1, Button, Input, Popover, Typography, Divider, Select as Select$1, Avatar, Spin, Radio, Space, DatePicker, Checkbox, InputNumber, Modal as Modal$2, Progress, Cascader, Descriptions, Row, Col, Tooltip as Tooltip$1, Collapse, List as List$1, Skeleton, Alert, Card, Upload as Upload$2, Switch, Table as Table$1, Popconfirm, Tabs, Image, Slider, Breadcrumb, Result as Result$1, message, Layout, Drawer, ConfigProvider, theme } from 'antd';
|
|
5
5
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
6
6
|
import { observer } from 'mobx-react-lite';
|
|
7
7
|
import { getLogger, DivaError, useTranslation, useDivaCore, DivaUtils } from '@crystaldesign/diva-core';
|
|
@@ -65,20 +65,23 @@ import FolderOutlined from '@ant-design/icons/FolderOutlined';
|
|
|
65
65
|
import SettingOutlined from '@ant-design/icons/SettingOutlined';
|
|
66
66
|
import PieChartOutlined from '@ant-design/icons/PieChartOutlined';
|
|
67
67
|
import InfoCircleOutlined from '@ant-design/icons/InfoCircleOutlined';
|
|
68
|
-
import { merge as merge$1 } from 'lodash';
|
|
68
|
+
import { cloneDeep, merge as merge$1, mergeWith } from 'lodash';
|
|
69
|
+
import DivaUtils$1, { nanoid, DivaError as DivaError$1 } from '@crystaldesign/diva-utils';
|
|
69
70
|
import DeleteOutlined from '@ant-design/icons/DeleteOutlined';
|
|
70
71
|
import JSONEditor from 'jsoneditor';
|
|
71
72
|
import 'jsoneditor/dist/jsoneditor.css';
|
|
72
|
-
import { MinusCircleOutlined, PlusOutlined, DownloadOutlined as DownloadOutlined$1, PlusSquareOutlined, DeleteOutlined as DeleteOutlined$1, FullscreenOutlined, FileUnknownOutlined, CloseOutlined as CloseOutlined$1, PlusCircleOutlined as PlusCircleOutlined$1, HomeOutlined as HomeOutlined$1, InboxOutlined, PushpinOutlined, PushpinFilled, ReloadOutlined as ReloadOutlined$1 } from '@ant-design/icons';
|
|
73
73
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
74
|
+
import { MinusCircleOutlined, PlusOutlined, DownloadOutlined as DownloadOutlined$1, PlusSquareOutlined, DeleteOutlined as DeleteOutlined$1, FullscreenOutlined, FileUnknownOutlined, CloseOutlined as CloseOutlined$1, PlusCircleOutlined as PlusCircleOutlined$1, HomeOutlined as HomeOutlined$1, InboxOutlined, PushpinOutlined, PushpinFilled, ReloadOutlined as ReloadOutlined$1 } from '@ant-design/icons';
|
|
74
75
|
import classnames from 'classnames';
|
|
75
76
|
import { Editor } from '@tinymce/tinymce-react';
|
|
76
77
|
import debounce from 'lodash/debounce';
|
|
78
|
+
import Button$1 from 'antd/es/button';
|
|
79
|
+
import Upload$1 from 'antd/es/upload';
|
|
80
|
+
import Space$1 from 'antd/es/space';
|
|
77
81
|
import { stringify } from 'csv';
|
|
78
82
|
import InfiniteScroll from 'react-infinite-scroll-component';
|
|
79
83
|
import SearchOutlined from '@ant-design/icons/SearchOutlined';
|
|
80
84
|
import PlusOutlined$1 from '@ant-design/icons/PlusOutlined';
|
|
81
|
-
import DivaUtils$1, { nanoid, DivaError as DivaError$1 } from '@crystaldesign/diva-utils';
|
|
82
85
|
import ReactCrop from 'react-image-crop';
|
|
83
86
|
import 'react-image-crop/dist/ReactCrop.css';
|
|
84
87
|
import RoomSelection from '@crystaldesign/room-selection';
|
|
@@ -113,7 +116,6 @@ import Descriptions$1 from 'antd/es/descriptions';
|
|
|
113
116
|
import { Spreadsheet } from '@crystaldesign/spreadsheet';
|
|
114
117
|
import EditOutlined from '@ant-design/icons/lib/icons/EditOutlined';
|
|
115
118
|
import UploadOutlined$1 from '@ant-design/icons/lib/icons/UploadOutlined';
|
|
116
|
-
import Space$1 from 'antd/es/space';
|
|
117
119
|
import Switch$1 from 'antd/es/switch';
|
|
118
120
|
import Layout$1 from 'antd/es/layout';
|
|
119
121
|
import Menu from 'antd/es/menu';
|
|
@@ -3142,6 +3144,17 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
3142
3144
|
}]
|
|
3143
3145
|
}
|
|
3144
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
|
+
},
|
|
3145
3158
|
ContentItems: {
|
|
3146
3159
|
title: t('backoffice.table.contentitems.title'),
|
|
3147
3160
|
type: 'Table',
|
|
@@ -3155,6 +3168,7 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
3155
3168
|
id: 'FormEditContentItem',
|
|
3156
3169
|
title: t('backoffice.table.contentItem.copyAction.title'),
|
|
3157
3170
|
label: t('backoffice.table.services.copyAction.label'),
|
|
3171
|
+
disableOnMultiselect: true,
|
|
3158
3172
|
mapping: {
|
|
3159
3173
|
type: 'body',
|
|
3160
3174
|
map: [{
|
|
@@ -3169,14 +3183,6 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
3169
3183
|
}]
|
|
3170
3184
|
}
|
|
3171
3185
|
},
|
|
3172
|
-
createAction: {
|
|
3173
|
-
actionType: 'Detail',
|
|
3174
|
-
type: 'JsonEditor',
|
|
3175
|
-
id: 'JsonEditorCreateContentItem',
|
|
3176
|
-
title: t('backoffice.table.contentItem.label.create'),
|
|
3177
|
-
label: t('backoffice.table.contentItem.label.create'),
|
|
3178
|
-
permission: 'backoffice_create_contentitem_template'
|
|
3179
|
-
},
|
|
3180
3186
|
deleteAction: {
|
|
3181
3187
|
disabled: function disabled(datas) {
|
|
3182
3188
|
return (datas === null || datas === void 0 ? void 0 : datas.find(function (d) {
|
|
@@ -3195,19 +3201,19 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
3195
3201
|
field: 'supplierName',
|
|
3196
3202
|
sorter: 1,
|
|
3197
3203
|
filter: 'advanced',
|
|
3198
|
-
width:
|
|
3204
|
+
width: 150
|
|
3199
3205
|
}, {
|
|
3200
3206
|
title: t('backoffice.table.roles.columns.catalogName'),
|
|
3201
3207
|
field: 'catalogName',
|
|
3202
3208
|
sorter: 1,
|
|
3203
3209
|
filter: 'advanced',
|
|
3204
|
-
width:
|
|
3210
|
+
width: 150
|
|
3205
3211
|
}, {
|
|
3206
|
-
title: t('backoffice.
|
|
3207
|
-
field: '
|
|
3212
|
+
title: t('backoffice._id'),
|
|
3213
|
+
field: '_id',
|
|
3208
3214
|
sorter: 1,
|
|
3209
3215
|
filter: 'advanced',
|
|
3210
|
-
width:
|
|
3216
|
+
width: 100
|
|
3211
3217
|
}, {
|
|
3212
3218
|
title: t('backoffice.table.views.lastUpdated'),
|
|
3213
3219
|
field: 'lastUpdated',
|
|
@@ -3215,6 +3221,12 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
3215
3221
|
sorter: 1,
|
|
3216
3222
|
filter: 'advanced',
|
|
3217
3223
|
width: 200
|
|
3224
|
+
}, {
|
|
3225
|
+
title: t('backoffice.table.views.lastUpdatedBy'),
|
|
3226
|
+
field: 'lastUpdatedBy_displayText',
|
|
3227
|
+
sorter: 1,
|
|
3228
|
+
filter: 'advanced',
|
|
3229
|
+
width: 150
|
|
3218
3230
|
}, {
|
|
3219
3231
|
title: 'backoffice.content',
|
|
3220
3232
|
field: 'content',
|
|
@@ -3223,9 +3235,102 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
3223
3235
|
title: t('backoffice.table.medien.columns.title.organizationId'),
|
|
3224
3236
|
field: 'organizationId',
|
|
3225
3237
|
sorter: 1,
|
|
3226
|
-
defaultSortOrder: 'ascend',
|
|
3227
3238
|
filter: 'advanced',
|
|
3228
3239
|
width: 150
|
|
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
|
|
3229
3334
|
}, {
|
|
3230
3335
|
title: t('backoffice._id'),
|
|
3231
3336
|
field: '_id',
|
|
@@ -3264,7 +3369,7 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
3264
3369
|
}],
|
|
3265
3370
|
apiInterface: {
|
|
3266
3371
|
read: {
|
|
3267
|
-
list: '${catalogService}/contentItems',
|
|
3372
|
+
list: '${catalogService}/contentItems?onlyTemplates=true',
|
|
3268
3373
|
filterServerSide: true
|
|
3269
3374
|
},
|
|
3270
3375
|
"delete": '${catalogService}/contentItems/${id}'
|
|
@@ -6938,7 +7043,7 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
6938
7043
|
hidden: function hidden(data) {
|
|
6939
7044
|
return (data === null || data === void 0 ? void 0 : data.type) !== 'RETAILER' && (data === null || data === void 0 ? void 0 : data.parentType) !== 'RETAILER';
|
|
6940
7045
|
},
|
|
6941
|
-
onSave: function onSave(
|
|
7046
|
+
onSave: function onSave(newD) {
|
|
6942
7047
|
if (!newD) return;
|
|
6943
7048
|
if (!newD.iwofurn) newD.iwoFurnOptions = undefined;
|
|
6944
7049
|
delete newD.iwofurn;
|
|
@@ -7517,10 +7622,45 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
7517
7622
|
label: 'Video'
|
|
7518
7623
|
}]
|
|
7519
7624
|
}, {
|
|
7520
|
-
name: '
|
|
7521
|
-
type: '
|
|
7625
|
+
name: 'mediaItemImage',
|
|
7626
|
+
type: 'media',
|
|
7627
|
+
allowedTypes: ['image/*'],
|
|
7628
|
+
mediaItemRefField: 'mediaItemRefImage',
|
|
7629
|
+
urlField: 'image',
|
|
7522
7630
|
label: t('backoffice.form.api2servers.items.url'),
|
|
7523
|
-
|
|
7631
|
+
functionType: 'CAT',
|
|
7632
|
+
hidden: function hidden(d) {
|
|
7633
|
+
return (d === null || d === void 0 ? void 0 : d.type) !== 'Image' && d !== undefined;
|
|
7634
|
+
},
|
|
7635
|
+
onSave: function onSave(data) {
|
|
7636
|
+
if ((data === null || data === void 0 ? void 0 : data.type) !== 'Image' && data !== undefined) {
|
|
7637
|
+
delete data.image;
|
|
7638
|
+
delete data.mediaItemRefImage;
|
|
7639
|
+
delete data.mediaItemImage;
|
|
7640
|
+
return data;
|
|
7641
|
+
}
|
|
7642
|
+
return data;
|
|
7643
|
+
}
|
|
7644
|
+
}, {
|
|
7645
|
+
name: 'mediaItemVideo',
|
|
7646
|
+
type: 'media',
|
|
7647
|
+
allowedTypes: ['video/*'],
|
|
7648
|
+
mediaItemRefField: 'mediaItemRefVideo',
|
|
7649
|
+
urlField: 'video',
|
|
7650
|
+
label: t('backoffice.form.api2servers.items.url'),
|
|
7651
|
+
functionType: 'INF',
|
|
7652
|
+
hidden: function hidden(d) {
|
|
7653
|
+
return (d === null || d === void 0 ? void 0 : d.type) !== 'Video';
|
|
7654
|
+
},
|
|
7655
|
+
onSave: function onSave(data) {
|
|
7656
|
+
if (data.type !== 'Video') {
|
|
7657
|
+
delete data.video;
|
|
7658
|
+
delete data.mediaItemRefVideo;
|
|
7659
|
+
delete data.mediaItemVideo;
|
|
7660
|
+
return data;
|
|
7661
|
+
}
|
|
7662
|
+
return data;
|
|
7663
|
+
}
|
|
7524
7664
|
}, {
|
|
7525
7665
|
name: 'altText',
|
|
7526
7666
|
type: 'input',
|
|
@@ -7532,6 +7672,18 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
7532
7672
|
}, {
|
|
7533
7673
|
name: 'cover',
|
|
7534
7674
|
hidden: true
|
|
7675
|
+
}, {
|
|
7676
|
+
name: 'image',
|
|
7677
|
+
hidden: true
|
|
7678
|
+
}, {
|
|
7679
|
+
name: 'mediaItemRefImage',
|
|
7680
|
+
hidden: true
|
|
7681
|
+
}, {
|
|
7682
|
+
name: 'video',
|
|
7683
|
+
hidden: true
|
|
7684
|
+
}, {
|
|
7685
|
+
name: 'mediaItemRefVideo',
|
|
7686
|
+
hidden: true
|
|
7535
7687
|
}]
|
|
7536
7688
|
});
|
|
7537
7689
|
break;
|
|
@@ -7708,7 +7860,7 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
7708
7860
|
break;
|
|
7709
7861
|
case 'Gallery':
|
|
7710
7862
|
translationItems.push({
|
|
7711
|
-
name: 'Gallery',
|
|
7863
|
+
name: [].concat(_toConsumableArray(p), ['Gallery']),
|
|
7712
7864
|
type: 'subTitle'
|
|
7713
7865
|
});
|
|
7714
7866
|
translationItems.push({
|
|
@@ -7758,7 +7910,7 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
7758
7910
|
break;
|
|
7759
7911
|
case 'Image':
|
|
7760
7912
|
translationItems.push({
|
|
7761
|
-
name: 'Image',
|
|
7913
|
+
name: [].concat(_toConsumableArray(p), ['Image']),
|
|
7762
7914
|
type: 'subTitle'
|
|
7763
7915
|
});
|
|
7764
7916
|
translationItems.push({
|
|
@@ -7788,7 +7940,7 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
7788
7940
|
break;
|
|
7789
7941
|
case 'Video':
|
|
7790
7942
|
translationItems.push({
|
|
7791
|
-
name: 'Video',
|
|
7943
|
+
name: [].concat(_toConsumableArray(p), ['Video']),
|
|
7792
7944
|
type: 'subTitle'
|
|
7793
7945
|
});
|
|
7794
7946
|
translationItems.push({
|
|
@@ -7830,6 +7982,7 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
7830
7982
|
});
|
|
7831
7983
|
return result;
|
|
7832
7984
|
},
|
|
7985
|
+
disableSave: true,
|
|
7833
7986
|
tools: [{
|
|
7834
7987
|
id: 'WYSIWYG_ContentItem',
|
|
7835
7988
|
name: 'ContentItem Preview',
|
|
@@ -8079,7 +8232,7 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
8079
8232
|
name: 'viewPoint',
|
|
8080
8233
|
label: t('backoffice.form.createorupdaterenderpackages.items.viewpoint'),
|
|
8081
8234
|
hidden: function hidden(data) {
|
|
8082
|
-
return data.job !== 'HQ';
|
|
8235
|
+
return (data === null || data === void 0 ? void 0 : data.job) !== 'HQ' && data !== undefined;
|
|
8083
8236
|
}
|
|
8084
8237
|
}, {
|
|
8085
8238
|
name: 'preset',
|
|
@@ -12028,18 +12181,6 @@ var menu = [{
|
|
|
12028
12181
|
label: 'backoffice.menu.items.label.GroupCurrentOrganization',
|
|
12029
12182
|
permission: 'backoffice_current_organization',
|
|
12030
12183
|
icon: 'ApartmentOutlined'
|
|
12031
|
-
}, {
|
|
12032
|
-
id: 'GridShopMonitoring',
|
|
12033
|
-
path: 'monitoring',
|
|
12034
|
-
label: 'backoffice.menu.items.label.GridShopMonitoring',
|
|
12035
|
-
permission: 'backoffice_monitoring_shop',
|
|
12036
|
-
icon: 'DashboardOutlined'
|
|
12037
|
-
}, {
|
|
12038
|
-
id: 'TableApplicationLogs',
|
|
12039
|
-
path: 'applicationlogs',
|
|
12040
|
-
label: 'backoffice.menu.items.label.TableApplicationLogs',
|
|
12041
|
-
permission: 'backoffice_application_status',
|
|
12042
|
-
icon: 'AlertOutlined'
|
|
12043
12184
|
}, {
|
|
12044
12185
|
id: 'TableClientRenderJobs',
|
|
12045
12186
|
path: 'renderjobs',
|
|
@@ -12109,7 +12250,7 @@ var menu = [{
|
|
|
12109
12250
|
}
|
|
12110
12251
|
}]
|
|
12111
12252
|
}, {
|
|
12112
|
-
id: '
|
|
12253
|
+
id: 'GroupContentItems',
|
|
12113
12254
|
path: 'contentitems',
|
|
12114
12255
|
label: 'backoffice.menu.items.label.ContentItems',
|
|
12115
12256
|
icon: 'OrderedListOutlined',
|
|
@@ -12294,7 +12435,7 @@ var menu = [{
|
|
|
12294
12435
|
permission: 'backoffice_admin_tests',
|
|
12295
12436
|
icon: 'HistoryOutlined'
|
|
12296
12437
|
}, {
|
|
12297
|
-
label: '
|
|
12438
|
+
label: 'backoffice.menu.items.label.fileupload',
|
|
12298
12439
|
path: 'fileupload',
|
|
12299
12440
|
id: 'FileUploadBeta',
|
|
12300
12441
|
permission: 'backoffice_admin_fileupload',
|
|
@@ -12305,6 +12446,12 @@ var menu = [{
|
|
|
12305
12446
|
label: 'backoffice.menu.items.label.TableEmailTemplates',
|
|
12306
12447
|
permission: 'backoffice_admin_emailtemplates',
|
|
12307
12448
|
icon: 'MailOutlined'
|
|
12449
|
+
}, {
|
|
12450
|
+
id: 'GridShopMonitoring',
|
|
12451
|
+
path: 'monitoring',
|
|
12452
|
+
label: 'backoffice.menu.items.label.GridShopMonitoring',
|
|
12453
|
+
permission: 'backoffice_monitoring_shop',
|
|
12454
|
+
icon: 'DashboardOutlined'
|
|
12308
12455
|
}]
|
|
12309
12456
|
}]
|
|
12310
12457
|
}, {
|
|
@@ -12400,6 +12547,12 @@ var menu = [{
|
|
|
12400
12547
|
label: 'backoffice.menu.items.label.UIBuilderAnalytics',
|
|
12401
12548
|
permission: 'backoffice_analytics_optionvalues',
|
|
12402
12549
|
icon: 'OrderedListOutlined'
|
|
12550
|
+
}, {
|
|
12551
|
+
id: 'TableApplicationLogs',
|
|
12552
|
+
path: 'applicationlogs',
|
|
12553
|
+
label: 'backoffice.menu.items.label.TableApplicationLogs',
|
|
12554
|
+
permission: 'backoffice_application_status',
|
|
12555
|
+
icon: 'AlertOutlined'
|
|
12403
12556
|
}]
|
|
12404
12557
|
}];
|
|
12405
12558
|
|
|
@@ -13286,6 +13439,399 @@ function removeEmpty(data) {
|
|
|
13286
13439
|
return undefined;
|
|
13287
13440
|
}
|
|
13288
13441
|
|
|
13442
|
+
function fetchFileData(_x) {
|
|
13443
|
+
return _fetchFileData.apply(this, arguments);
|
|
13444
|
+
}
|
|
13445
|
+
function _fetchFileData() {
|
|
13446
|
+
_fetchFileData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(url) {
|
|
13447
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
13448
|
+
while (1) switch (_context.prev = _context.next) {
|
|
13449
|
+
case 0:
|
|
13450
|
+
_context.next = 2;
|
|
13451
|
+
return fetch(url).then(function (response) {
|
|
13452
|
+
return response.blob();
|
|
13453
|
+
}).then(function (blob) {
|
|
13454
|
+
return new File([blob], nameFromUrl(url), {
|
|
13455
|
+
type: blob.type
|
|
13456
|
+
});
|
|
13457
|
+
});
|
|
13458
|
+
case 2:
|
|
13459
|
+
return _context.abrupt("return", _context.sent);
|
|
13460
|
+
case 3:
|
|
13461
|
+
case "end":
|
|
13462
|
+
return _context.stop();
|
|
13463
|
+
}
|
|
13464
|
+
}, _callee);
|
|
13465
|
+
}));
|
|
13466
|
+
return _fetchFileData.apply(this, arguments);
|
|
13467
|
+
}
|
|
13468
|
+
function nameFromUrl(url) {
|
|
13469
|
+
var noParams = url.split('?')[0];
|
|
13470
|
+
var name = noParams.split('/').pop();
|
|
13471
|
+
return name !== null && name !== void 0 ? name : 'file';
|
|
13472
|
+
}
|
|
13473
|
+
function getFileAsDataUri(_x2) {
|
|
13474
|
+
return _getFileAsDataUri.apply(this, arguments);
|
|
13475
|
+
}
|
|
13476
|
+
function _getFileAsDataUri() {
|
|
13477
|
+
_getFileAsDataUri = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(file) {
|
|
13478
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
13479
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
13480
|
+
case 0:
|
|
13481
|
+
return _context2.abrupt("return", new Promise(function (resolve, reject) {
|
|
13482
|
+
var reader = new FileReader();
|
|
13483
|
+
reader.onload = function () {
|
|
13484
|
+
if (reader.result) {
|
|
13485
|
+
resolve(reader.result.toString());
|
|
13486
|
+
} else {
|
|
13487
|
+
reject(new Error('Failed to read file as data URI'));
|
|
13488
|
+
}
|
|
13489
|
+
};
|
|
13490
|
+
reader.onerror = function () {
|
|
13491
|
+
reject(new Error('Error reading file'));
|
|
13492
|
+
};
|
|
13493
|
+
reader.readAsDataURL(file);
|
|
13494
|
+
}));
|
|
13495
|
+
case 1:
|
|
13496
|
+
case "end":
|
|
13497
|
+
return _context2.stop();
|
|
13498
|
+
}
|
|
13499
|
+
}, _callee2);
|
|
13500
|
+
}));
|
|
13501
|
+
return _getFileAsDataUri.apply(this, arguments);
|
|
13502
|
+
}
|
|
13503
|
+
function isFileOfType(file) {
|
|
13504
|
+
var typeList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
13505
|
+
var fileType = file.type.toLocaleLowerCase();
|
|
13506
|
+
var fileName = file.name;
|
|
13507
|
+
var fileExtension = fileName.substring(fileName.lastIndexOf('.')).toLowerCase();
|
|
13508
|
+
if (typeList.length === 0) return true;
|
|
13509
|
+
return typeList.some(function (type) {
|
|
13510
|
+
if (type.startsWith('.')) {
|
|
13511
|
+
// Check file extension
|
|
13512
|
+
return fileExtension === type.toLowerCase();
|
|
13513
|
+
} else if (type.endsWith('/*')) {
|
|
13514
|
+
// Check wildcard MIME type
|
|
13515
|
+
var baseType = type.split('/')[0];
|
|
13516
|
+
return fileType.startsWith(baseType.toLocaleLowerCase());
|
|
13517
|
+
} else {
|
|
13518
|
+
// Check exact MIME type
|
|
13519
|
+
return fileType === type;
|
|
13520
|
+
}
|
|
13521
|
+
});
|
|
13522
|
+
}
|
|
13523
|
+
function getMediaItemRef(_x3, _x4, _x5) {
|
|
13524
|
+
return _getMediaItemRef.apply(this, arguments);
|
|
13525
|
+
}
|
|
13526
|
+
function _getMediaItemRef() {
|
|
13527
|
+
_getMediaItemRef = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(baseUrl, jwt, ref) {
|
|
13528
|
+
var url, filter, result;
|
|
13529
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
13530
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
13531
|
+
case 0:
|
|
13532
|
+
url = new URL("".concat(baseUrl, "/v1/mediaitems/refs"));
|
|
13533
|
+
filter = "{_id,eq,".concat(ref, "}");
|
|
13534
|
+
url.searchParams.append('limit', '1');
|
|
13535
|
+
url.searchParams.append('filter', encodeURIComponent("[".concat(filter, "]")));
|
|
13536
|
+
_context3.prev = 4;
|
|
13537
|
+
_context3.next = 7;
|
|
13538
|
+
return fetch(url.toString(), {
|
|
13539
|
+
method: 'GET',
|
|
13540
|
+
headers: {
|
|
13541
|
+
Authorization: "Bearer ".concat(jwt)
|
|
13542
|
+
}
|
|
13543
|
+
}).then(function (r) {
|
|
13544
|
+
return r.json();
|
|
13545
|
+
});
|
|
13546
|
+
case 7:
|
|
13547
|
+
result = _context3.sent;
|
|
13548
|
+
if (!(result.data.length === 0)) {
|
|
13549
|
+
_context3.next = 10;
|
|
13550
|
+
break;
|
|
13551
|
+
}
|
|
13552
|
+
throw new Error('Media item not found');
|
|
13553
|
+
case 10:
|
|
13554
|
+
return _context3.abrupt("return", result.data[0]);
|
|
13555
|
+
case 13:
|
|
13556
|
+
_context3.prev = 13;
|
|
13557
|
+
_context3.t0 = _context3["catch"](4);
|
|
13558
|
+
throw new Error('Could not fetch media item ref', {
|
|
13559
|
+
cause: _context3.t0
|
|
13560
|
+
});
|
|
13561
|
+
case 16:
|
|
13562
|
+
case "end":
|
|
13563
|
+
return _context3.stop();
|
|
13564
|
+
}
|
|
13565
|
+
}, _callee3, null, [[4, 13]]);
|
|
13566
|
+
}));
|
|
13567
|
+
return _getMediaItemRef.apply(this, arguments);
|
|
13568
|
+
}
|
|
13569
|
+
function uploadMediaItem(_x6, _x7, _x8) {
|
|
13570
|
+
return _uploadMediaItem.apply(this, arguments);
|
|
13571
|
+
}
|
|
13572
|
+
function _uploadMediaItem() {
|
|
13573
|
+
_uploadMediaItem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(baseUrl, jwt, formData) {
|
|
13574
|
+
var url;
|
|
13575
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
13576
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
13577
|
+
case 0:
|
|
13578
|
+
url = new URL("".concat(baseUrl, "/v1/mediaitems?ref=true"));
|
|
13579
|
+
_context4.prev = 1;
|
|
13580
|
+
return _context4.abrupt("return", fetch(url.toString(), {
|
|
13581
|
+
method: 'POST',
|
|
13582
|
+
headers: {
|
|
13583
|
+
Authorization: "Bearer ".concat(jwt)
|
|
13584
|
+
},
|
|
13585
|
+
body: formData
|
|
13586
|
+
}).then(function (r) {
|
|
13587
|
+
return r.json();
|
|
13588
|
+
}));
|
|
13589
|
+
case 5:
|
|
13590
|
+
_context4.prev = 5;
|
|
13591
|
+
_context4.t0 = _context4["catch"](1);
|
|
13592
|
+
throw new Error('Could not upload media item', {
|
|
13593
|
+
cause: _context4.t0
|
|
13594
|
+
});
|
|
13595
|
+
case 8:
|
|
13596
|
+
case "end":
|
|
13597
|
+
return _context4.stop();
|
|
13598
|
+
}
|
|
13599
|
+
}, _callee4, null, [[1, 5]]);
|
|
13600
|
+
}));
|
|
13601
|
+
return _uploadMediaItem.apply(this, arguments);
|
|
13602
|
+
}
|
|
13603
|
+
function removeMediaItemRef(_x9, _x10, _x11) {
|
|
13604
|
+
return _removeMediaItemRef.apply(this, arguments);
|
|
13605
|
+
}
|
|
13606
|
+
function _removeMediaItemRef() {
|
|
13607
|
+
_removeMediaItemRef = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(baseUrl, jwt, id) {
|
|
13608
|
+
var url;
|
|
13609
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
13610
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
13611
|
+
case 0:
|
|
13612
|
+
url = new URL("".concat(baseUrl, "/v1/mediaitems/refs/").concat(id));
|
|
13613
|
+
_context5.prev = 1;
|
|
13614
|
+
return _context5.abrupt("return", fetch(url.toString(), {
|
|
13615
|
+
method: 'DELETE',
|
|
13616
|
+
headers: {
|
|
13617
|
+
Authorization: "Bearer ".concat(jwt)
|
|
13618
|
+
}
|
|
13619
|
+
}).then(function (r) {
|
|
13620
|
+
return r.json();
|
|
13621
|
+
}));
|
|
13622
|
+
case 5:
|
|
13623
|
+
_context5.prev = 5;
|
|
13624
|
+
_context5.t0 = _context5["catch"](1);
|
|
13625
|
+
throw new Error('Could not delete media item ref', {
|
|
13626
|
+
cause: _context5.t0
|
|
13627
|
+
});
|
|
13628
|
+
case 8:
|
|
13629
|
+
case "end":
|
|
13630
|
+
return _context5.stop();
|
|
13631
|
+
}
|
|
13632
|
+
}, _callee5, null, [[1, 5]]);
|
|
13633
|
+
}));
|
|
13634
|
+
return _removeMediaItemRef.apply(this, arguments);
|
|
13635
|
+
}
|
|
13636
|
+
function isExternalVid(file) {
|
|
13637
|
+
return (file === null || file === void 0 ? void 0 : file.startsWith('https://youtu.be')) || (file === null || file === void 0 ? void 0 : file.startsWith('https://www.youtube.com')) || (file === null || file === void 0 ? void 0 : file.startsWith('https://vimeo.com'));
|
|
13638
|
+
}
|
|
13639
|
+
|
|
13640
|
+
var VIDEO_THUMB_PLACEHOLDER = 'data:image/svg+xml;base64,PHN2ZyBmaWxsPSIjMDAwMDAwIiBoZWlnaHQ9IjgwMHB4IiB3aWR0aD0iODAwcHgiIHZlcnNpb249IjEuMSIgaWQ9IkNhcGFfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgCgkgdmlld0JveD0iMCAwIDQ5IDQ5IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPGc+Cgk8Zz4KCQk8cGF0aCBkPSJNMzkuMjU2LDYuNUg5Ljc0NEM0LjM3MSw2LjUsMCwxMC44ODUsMCwxNi4yNzR2MTYuNDUxYzAsNS4zOSw0LjM3MSw5Ljc3NCw5Ljc0NCw5Ljc3NGgyOS41MTIKCQkJYzUuMzczLDAsOS43NDQtNC4zODUsOS43NDQtOS43NzRWMTYuMjc0QzQ5LDEwLjg4NSw0NC42MjksNi41LDM5LjI1Niw2LjV6IE00NywzMi43MjZjMCw0LjI4Ny0zLjQ3NCw3Ljc3NC03Ljc0NCw3Ljc3NEg5Ljc0NAoJCQlDNS40NzQsNDAuNSwyLDM3LjAxMiwyLDMyLjcyNlYxNi4yNzRDMiwxMS45ODgsNS40NzQsOC41LDkuNzQ0LDguNWgyOS41MTJjNC4yNywwLDcuNzQ0LDMuNDg4LDcuNzQ0LDcuNzc0VjMyLjcyNnoiLz4KCQk8cGF0aCBkPSJNMzMuMzYsMjQuMTM4bC0xMy44NTUtOC4xMTVjLTAuMzA4LTAuMTgtMC42OTEtMC4xODMtMS4wMDItMC4wMDVTMTgsMTYuNTI3LDE4LDE2Ljg4NnYxNi4yMjkKCQkJYzAsMC4zNTgsMC4xOTIsMC42OSwwLjUwMiwwLjg2OGMwLjE1NCwwLjA4OCwwLjMyNiwwLjEzMiwwLjQ5OCwwLjEzMmMwLjE3NSwwLDAuMzQ5LTAuMDQ2LDAuNTA1LTAuMTM3bDEzLjg1NS04LjExMwoJCQljMC4zMDYtMC4xNzksMC40OTUtMC41MDgsMC40OTUtMC44NjNTMzMuNjY3LDI0LjMxNywzMy4zNiwyNC4xMzh6IE0yMCwzMS4zN1YxOC42M2wxMC44NzYsNi4zNzFMMjAsMzEuMzd6Ii8+Cgk8L2c+CjwvZz4KPC9zdmc+';
|
|
13641
|
+
var MediaItem = /*#__PURE__*/function () {
|
|
13642
|
+
function MediaItem(media, config, mediaItemId, medaItemRefId) {
|
|
13643
|
+
_classCallCheck(this, MediaItem);
|
|
13644
|
+
this.config = config;
|
|
13645
|
+
_defineProperty(this, "_url", void 0);
|
|
13646
|
+
_defineProperty(this, "_file", void 0);
|
|
13647
|
+
_defineProperty(this, "_mediaItemId", void 0);
|
|
13648
|
+
_defineProperty(this, "_mediaItemRefId", void 0);
|
|
13649
|
+
_defineProperty(this, "_itemRef", void 0);
|
|
13650
|
+
_defineProperty(this, "_isRemoteUrl", void 0);
|
|
13651
|
+
if (typeof media === 'string') {
|
|
13652
|
+
this._url = media;
|
|
13653
|
+
this._isRemoteUrl = isExternalVid(media);
|
|
13654
|
+
} else {
|
|
13655
|
+
this._file = media;
|
|
13656
|
+
}
|
|
13657
|
+
this._mediaItemId = mediaItemId;
|
|
13658
|
+
this._mediaItemRefId = medaItemRefId;
|
|
13659
|
+
}
|
|
13660
|
+
return _createClass(MediaItem, [{
|
|
13661
|
+
key: "file",
|
|
13662
|
+
get: function get() {
|
|
13663
|
+
return this._file;
|
|
13664
|
+
}
|
|
13665
|
+
}, {
|
|
13666
|
+
key: "url",
|
|
13667
|
+
get: function get() {
|
|
13668
|
+
return this._url;
|
|
13669
|
+
}
|
|
13670
|
+
}, {
|
|
13671
|
+
key: "itemRefId",
|
|
13672
|
+
get: function get() {
|
|
13673
|
+
return this._mediaItemRefId;
|
|
13674
|
+
}
|
|
13675
|
+
}, {
|
|
13676
|
+
key: "itemId",
|
|
13677
|
+
get: function get() {
|
|
13678
|
+
return this._mediaItemId;
|
|
13679
|
+
}
|
|
13680
|
+
}, {
|
|
13681
|
+
key: "antdFile",
|
|
13682
|
+
get: function get() {
|
|
13683
|
+
var _this$_itemRef$_id, _this$_itemRef, _ref, _this$_itemRef$fileNa, _this$_itemRef2, _this$_file, _this$_url;
|
|
13684
|
+
return {
|
|
13685
|
+
uid: (_this$_itemRef$_id = (_this$_itemRef = this._itemRef) === null || _this$_itemRef === void 0 ? void 0 : _this$_itemRef._id) !== null && _this$_itemRef$_id !== void 0 ? _this$_itemRef$_id : nanoid(),
|
|
13686
|
+
name: this._isRemoteUrl ? this._url : (_ref = (_this$_itemRef$fileNa = (_this$_itemRef2 = this._itemRef) === null || _this$_itemRef2 === void 0 ? void 0 : _this$_itemRef2.fileName) !== null && _this$_itemRef$fileNa !== void 0 ? _this$_itemRef$fileNa : (_this$_file = this._file) === null || _this$_file === void 0 ? void 0 : _this$_file.name) !== null && _ref !== void 0 ? _ref : nameFromUrl((_this$_url = this._url) !== null && _this$_url !== void 0 ? _this$_url : ''),
|
|
13687
|
+
url: this._url,
|
|
13688
|
+
thumbUrl: this._isRemoteUrl ? VIDEO_THUMB_PLACEHOLDER : undefined
|
|
13689
|
+
};
|
|
13690
|
+
}
|
|
13691
|
+
}, {
|
|
13692
|
+
key: "delete",
|
|
13693
|
+
value: function () {
|
|
13694
|
+
var _delete2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
13695
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
13696
|
+
while (1) switch (_context.prev = _context.next) {
|
|
13697
|
+
case 0:
|
|
13698
|
+
this._url = undefined;
|
|
13699
|
+
this._file = undefined;
|
|
13700
|
+
if (this._mediaItemRefId) {
|
|
13701
|
+
_context.next = 4;
|
|
13702
|
+
break;
|
|
13703
|
+
}
|
|
13704
|
+
return _context.abrupt("return");
|
|
13705
|
+
case 4:
|
|
13706
|
+
_context.next = 6;
|
|
13707
|
+
return removeMediaItemRef(this.config.baseUrl, this.config.jwt, this._mediaItemRefId);
|
|
13708
|
+
case 6:
|
|
13709
|
+
this._mediaItemId = undefined;
|
|
13710
|
+
this._mediaItemRefId = undefined;
|
|
13711
|
+
return _context.abrupt("return");
|
|
13712
|
+
case 9:
|
|
13713
|
+
case "end":
|
|
13714
|
+
return _context.stop();
|
|
13715
|
+
}
|
|
13716
|
+
}, _callee, this);
|
|
13717
|
+
}));
|
|
13718
|
+
function _delete() {
|
|
13719
|
+
return _delete2.apply(this, arguments);
|
|
13720
|
+
}
|
|
13721
|
+
return _delete;
|
|
13722
|
+
}()
|
|
13723
|
+
}, {
|
|
13724
|
+
key: "init",
|
|
13725
|
+
value: function () {
|
|
13726
|
+
var _init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(allowedTypes) {
|
|
13727
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
13728
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
13729
|
+
case 0:
|
|
13730
|
+
if (!this._mediaItemRefId) {
|
|
13731
|
+
_context2.next = 5;
|
|
13732
|
+
break;
|
|
13733
|
+
}
|
|
13734
|
+
_context2.next = 3;
|
|
13735
|
+
return getMediaItemRef(this.config.baseUrl, this.config.jwt, this._mediaItemRefId);
|
|
13736
|
+
case 3:
|
|
13737
|
+
this._itemRef = _context2.sent;
|
|
13738
|
+
this._url = this._itemRef.url;
|
|
13739
|
+
case 5:
|
|
13740
|
+
if (!(this.file && !this._url)) {
|
|
13741
|
+
_context2.next = 11;
|
|
13742
|
+
break;
|
|
13743
|
+
}
|
|
13744
|
+
_context2.next = 8;
|
|
13745
|
+
return getFileAsDataUri(this.file);
|
|
13746
|
+
case 8:
|
|
13747
|
+
this._url = _context2.sent;
|
|
13748
|
+
_context2.next = 15;
|
|
13749
|
+
break;
|
|
13750
|
+
case 11:
|
|
13751
|
+
if (!(this._url && !this._file && !this._isRemoteUrl)) {
|
|
13752
|
+
_context2.next = 15;
|
|
13753
|
+
break;
|
|
13754
|
+
}
|
|
13755
|
+
_context2.next = 14;
|
|
13756
|
+
return fetchFileData(this._url);
|
|
13757
|
+
case 14:
|
|
13758
|
+
this._file = _context2.sent;
|
|
13759
|
+
case 15:
|
|
13760
|
+
if (!(this.file && !isFileOfType(this.file, allowedTypes))) {
|
|
13761
|
+
_context2.next = 17;
|
|
13762
|
+
break;
|
|
13763
|
+
}
|
|
13764
|
+
throw new Error('File type is not allowed');
|
|
13765
|
+
case 17:
|
|
13766
|
+
case "end":
|
|
13767
|
+
return _context2.stop();
|
|
13768
|
+
}
|
|
13769
|
+
}, _callee2, this);
|
|
13770
|
+
}));
|
|
13771
|
+
function init(_x) {
|
|
13772
|
+
return _init.apply(this, arguments);
|
|
13773
|
+
}
|
|
13774
|
+
return init;
|
|
13775
|
+
}()
|
|
13776
|
+
}, {
|
|
13777
|
+
key: "upload",
|
|
13778
|
+
value: function () {
|
|
13779
|
+
var _upload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(organizationId, functionType) {
|
|
13780
|
+
var formData, mediaitem, response;
|
|
13781
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
13782
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
13783
|
+
case 0:
|
|
13784
|
+
if (!(this._itemRef || this._isRemoteUrl)) {
|
|
13785
|
+
_context3.next = 2;
|
|
13786
|
+
break;
|
|
13787
|
+
}
|
|
13788
|
+
return _context3.abrupt("return");
|
|
13789
|
+
case 2:
|
|
13790
|
+
if (this._file) {
|
|
13791
|
+
_context3.next = 4;
|
|
13792
|
+
break;
|
|
13793
|
+
}
|
|
13794
|
+
throw new Error('The MediaItem must be initialized before uploading');
|
|
13795
|
+
case 4:
|
|
13796
|
+
formData = new FormData();
|
|
13797
|
+
mediaitem = {
|
|
13798
|
+
fileName: this._file.name,
|
|
13799
|
+
organizationId: organizationId
|
|
13800
|
+
};
|
|
13801
|
+
if (isFileOfType(this._file, ['image/svg+xml'])) {
|
|
13802
|
+
mediaitem.mediaType = 'SVG';
|
|
13803
|
+
} else if (isFileOfType(this._file, ['image/*'])) {
|
|
13804
|
+
mediaitem.mediaType = 'PCT';
|
|
13805
|
+
} else if (isFileOfType(this._file, ['video/*'])) {
|
|
13806
|
+
mediaitem.mediaType = 'VID';
|
|
13807
|
+
} else ;
|
|
13808
|
+
formData.append('mediaItem', JSON.stringify(mediaitem));
|
|
13809
|
+
formData.append('mediaItemRef', JSON.stringify({
|
|
13810
|
+
functionType: functionType
|
|
13811
|
+
}));
|
|
13812
|
+
formData.append('file', this._file, this._file.name);
|
|
13813
|
+
_context3.next = 12;
|
|
13814
|
+
return uploadMediaItem(this.config.baseUrl, this.config.jwt, formData);
|
|
13815
|
+
case 12:
|
|
13816
|
+
response = _context3.sent;
|
|
13817
|
+
this._mediaItemRefId = response.ref._id;
|
|
13818
|
+
this._mediaItemId = response._id;
|
|
13819
|
+
this._itemRef = response.ref;
|
|
13820
|
+
this._url = response.ref.url;
|
|
13821
|
+
case 17:
|
|
13822
|
+
case "end":
|
|
13823
|
+
return _context3.stop();
|
|
13824
|
+
}
|
|
13825
|
+
}, _callee3, this);
|
|
13826
|
+
}));
|
|
13827
|
+
function upload(_x2, _x3) {
|
|
13828
|
+
return _upload.apply(this, arguments);
|
|
13829
|
+
}
|
|
13830
|
+
return upload;
|
|
13831
|
+
}()
|
|
13832
|
+
}]);
|
|
13833
|
+
}();
|
|
13834
|
+
|
|
13289
13835
|
function ownKeys$I(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13290
13836
|
function _objectSpread$I(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$I(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$I(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13291
13837
|
function _createForOfIteratorHelper$j(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$j(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
@@ -13328,6 +13874,10 @@ function useFormData (_ref) {
|
|
|
13328
13874
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
13329
13875
|
progressBarPercentage = _useState10[0],
|
|
13330
13876
|
setProgressBarPercentage = _useState10[1];
|
|
13877
|
+
var _useState11 = useState([]),
|
|
13878
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
13879
|
+
removedMedias = _useState12[0],
|
|
13880
|
+
setRemovedMedias = _useState12[1];
|
|
13331
13881
|
var _useMemo = useMemo(function () {
|
|
13332
13882
|
var c = {
|
|
13333
13883
|
apiHandler: root.getApiHandler(id, apiInterface),
|
|
@@ -13340,56 +13890,57 @@ function useFormData (_ref) {
|
|
|
13340
13890
|
}, [id]),
|
|
13341
13891
|
apiHandler = _useMemo.apiHandler,
|
|
13342
13892
|
configuration = _useMemo.configuration;
|
|
13343
|
-
|
|
13344
|
-
|
|
13893
|
+
useEffect(function () {
|
|
13894
|
+
if (configuration.disableSave) setCanSave === null || setCanSave === void 0 || setCanSave(false);
|
|
13895
|
+
}, [configuration]);
|
|
13896
|
+
var _onLoadFields = function onLoadFields(data) {
|
|
13897
|
+
var items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : selectedItems !== null && selectedItems !== void 0 ? selectedItems : configuration.items;
|
|
13345
13898
|
var _iterator = _createForOfIteratorHelper$j(items),
|
|
13346
13899
|
_step;
|
|
13347
13900
|
try {
|
|
13348
13901
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
13349
13902
|
var item = _step.value;
|
|
13350
|
-
if (item.onSave) {
|
|
13351
|
-
newData = item === null || item === void 0 ? void 0 : item.onSave(oldData, newData);
|
|
13352
|
-
}
|
|
13353
|
-
}
|
|
13354
|
-
} catch (err) {
|
|
13355
|
-
_iterator.e(err);
|
|
13356
|
-
} finally {
|
|
13357
|
-
_iterator.f();
|
|
13358
|
-
}
|
|
13359
|
-
return newData;
|
|
13360
|
-
};
|
|
13361
|
-
useEffect(function () {
|
|
13362
|
-
if (!configuration.apiInterface) setCanSave === null || setCanSave === void 0 || setCanSave(false);
|
|
13363
|
-
if (configuration.apiInterface) setCanSave === null || setCanSave === void 0 || setCanSave(true);
|
|
13364
|
-
}, [configuration]);
|
|
13365
|
-
var onLoadFields = function onLoadFields(data) {
|
|
13366
|
-
var items = selectedItems !== null && selectedItems !== void 0 ? selectedItems : configuration.items;
|
|
13367
|
-
if (Array.isArray(items[0])) items = configuration.items[0];
|
|
13368
|
-
var _iterator2 = _createForOfIteratorHelper$j(items),
|
|
13369
|
-
_step2;
|
|
13370
|
-
try {
|
|
13371
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
13372
|
-
var item = _step2.value;
|
|
13373
|
-
if (item.onLoad) {
|
|
13374
|
-
data = item === null || item === void 0 ? void 0 : item.onLoad(data);
|
|
13375
|
-
}
|
|
13376
13903
|
if (item.defaultValue && getData(item.name, data) === undefined) {
|
|
13377
13904
|
setFieldInObject(item.name, data, item.defaultValue);
|
|
13378
13905
|
}
|
|
13906
|
+
var itemName = typeof item.name == 'string' ? [item.name] : item.name;
|
|
13907
|
+
if (item.type == 'media') {
|
|
13908
|
+
var urlName = typeof item.urlField == 'string' ? [item.urlField] : item.urlField;
|
|
13909
|
+
var ref = typeof item.mediaItemRefField == 'string' ? [item.mediaItemRefField] : item.mediaItemRefField;
|
|
13910
|
+
var media = getData(itemName, data);
|
|
13911
|
+
if (media) {
|
|
13912
|
+
var mediaItem = new MediaItem(getData(urlName, data), {
|
|
13913
|
+
baseUrl: root.configurationStore.apiConfig.mediaService,
|
|
13914
|
+
jwt: root.dataStore.jwt
|
|
13915
|
+
}, media, getData(ref, data));
|
|
13916
|
+
mediaItem.init(item.allowedTypes);
|
|
13917
|
+
setFieldInObject(itemName, data, mediaItem);
|
|
13918
|
+
}
|
|
13919
|
+
} else if (item.type == 'translation') {
|
|
13920
|
+
_onLoadFields(data, item.items);
|
|
13921
|
+
} else if (item.type == 'array') {
|
|
13922
|
+
var arrayData = getData(item.name, data);
|
|
13923
|
+
if (arrayData) {
|
|
13924
|
+
for (var i = 0; i < arrayData.length; i++) {
|
|
13925
|
+
_onLoadFields(arrayData[i], item.items);
|
|
13926
|
+
}
|
|
13927
|
+
}
|
|
13928
|
+
}
|
|
13929
|
+
if (item.onLoad) data = item === null || item === void 0 ? void 0 : item.onLoad(data);
|
|
13379
13930
|
}
|
|
13380
13931
|
} catch (err) {
|
|
13381
|
-
|
|
13932
|
+
_iterator.e(err);
|
|
13382
13933
|
} finally {
|
|
13383
|
-
|
|
13934
|
+
_iterator.f();
|
|
13384
13935
|
}
|
|
13385
13936
|
return data;
|
|
13386
13937
|
};
|
|
13387
13938
|
var _useMemo2 = useMemo(function () {
|
|
13388
|
-
var dt = inboundData;
|
|
13939
|
+
var dt = cloneDeep(inboundData);
|
|
13389
13940
|
var multipleEditingData = undefined;
|
|
13390
|
-
if (Array.isArray(
|
|
13391
|
-
var _data =
|
|
13392
|
-
|
|
13941
|
+
if (Array.isArray(dt)) {
|
|
13942
|
+
var _data = dt[0];
|
|
13943
|
+
dt.forEach(function (dt) {
|
|
13393
13944
|
if (dt.state > _data.state) {
|
|
13394
13945
|
_data = dt;
|
|
13395
13946
|
}
|
|
@@ -13398,13 +13949,13 @@ function useFormData (_ref) {
|
|
|
13398
13949
|
multipleEditingData = inboundData;
|
|
13399
13950
|
}
|
|
13400
13951
|
return {
|
|
13401
|
-
loadedData:
|
|
13952
|
+
loadedData: _onLoadFields(_objectSpread$I({}, dt)),
|
|
13402
13953
|
multipleEditingData: multipleEditingData
|
|
13403
13954
|
};
|
|
13404
13955
|
}, [inboundData, selectedItemsIndex]),
|
|
13405
13956
|
loadedData = _useMemo2.loadedData,
|
|
13406
13957
|
multipleEditingData = _useMemo2.multipleEditingData;
|
|
13407
|
-
var
|
|
13958
|
+
var _useState13 = useState({
|
|
13408
13959
|
loading: false,
|
|
13409
13960
|
data: loadedData,
|
|
13410
13961
|
origData: JSON.parse(JSON.stringify(inboundData !== null && inboundData !== void 0 ? inboundData : {})),
|
|
@@ -13412,27 +13963,27 @@ function useFormData (_ref) {
|
|
|
13412
13963
|
update: !!((_loadedData$_id = loadedData === null || loadedData === void 0 ? void 0 : loadedData._id) !== null && _loadedData$_id !== void 0 ? _loadedData$_id : loadedData === null || loadedData === void 0 ? void 0 : loadedData.ID),
|
|
13413
13964
|
form: form
|
|
13414
13965
|
}),
|
|
13415
|
-
|
|
13416
|
-
state =
|
|
13417
|
-
setState =
|
|
13966
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
13967
|
+
state = _useState14[0],
|
|
13968
|
+
setState = _useState14[1];
|
|
13418
13969
|
var selectedItemsInitValues = undefined;
|
|
13419
13970
|
if (!Array.isArray(configuration.items[0])) {
|
|
13420
13971
|
selectedItemsInitValues = configuration.items;
|
|
13421
13972
|
} else if (configuration.itemSelector && configuration.itemSelectorDefautIndex !== undefined) {
|
|
13422
13973
|
selectedItemsInitValues = filterItems(configuration.items[configuration.itemSelectorDefautIndex], userHasPermission);
|
|
13423
13974
|
}
|
|
13424
|
-
var
|
|
13425
|
-
_useState14 = _slicedToArray(_useState13, 2),
|
|
13426
|
-
selectedItems = _useState14[0],
|
|
13427
|
-
setSelectedItems = _useState14[1];
|
|
13428
|
-
var _useState15 = useState(getHiddenRequredDisabled(loadedData, selectedItems !== null && selectedItems !== void 0 ? selectedItems : [])),
|
|
13975
|
+
var _useState15 = useState(selectedItemsInitValues ? filterItems(selectedItemsInitValues, userHasPermission) : undefined),
|
|
13429
13976
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
13430
|
-
|
|
13431
|
-
|
|
13432
|
-
var _useState17 = useState(
|
|
13977
|
+
selectedItems = _useState16[0],
|
|
13978
|
+
setSelectedItems = _useState16[1];
|
|
13979
|
+
var _useState17 = useState(getHiddenRequredDisabled(loadedData, selectedItems !== null && selectedItems !== void 0 ? selectedItems : [])),
|
|
13433
13980
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
13434
|
-
|
|
13435
|
-
|
|
13981
|
+
hiddenRequiredDisabled = _useState18[0],
|
|
13982
|
+
setHiddenRequiredDisabled = _useState18[1];
|
|
13983
|
+
var _useState19 = useState({}),
|
|
13984
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
13985
|
+
fieldErrors = _useState20[0],
|
|
13986
|
+
setFieldErrors = _useState20[1];
|
|
13436
13987
|
useEffect(function () {
|
|
13437
13988
|
var _loadedData$_id2;
|
|
13438
13989
|
setState(_objectSpread$I(_objectSpread$I({}, state), {}, {
|
|
@@ -13544,21 +14095,23 @@ function useFormData (_ref) {
|
|
|
13544
14095
|
return setDynamicFields(_objectSpread$I({}, state.data), newData);
|
|
13545
14096
|
case 5:
|
|
13546
14097
|
newData = _context2.sent;
|
|
13547
|
-
|
|
14098
|
+
_context2.next = 8;
|
|
14099
|
+
return preSaveProcess(newData, selectedItems !== null && selectedItems !== void 0 ? selectedItems : configuration.items);
|
|
14100
|
+
case 8:
|
|
13548
14101
|
newData = removeEmpty(newData);
|
|
13549
14102
|
setState(_objectSpread$I(_objectSpread$I({}, state), {}, {
|
|
13550
14103
|
loading: true
|
|
13551
14104
|
}));
|
|
13552
14105
|
finalData = state.data;
|
|
13553
|
-
_context2.prev =
|
|
13554
|
-
_context2.next =
|
|
14106
|
+
_context2.prev = 11;
|
|
14107
|
+
_context2.next = 14;
|
|
13555
14108
|
return apiCall(newData);
|
|
13556
|
-
case
|
|
14109
|
+
case 14:
|
|
13557
14110
|
response = _context2.sent;
|
|
13558
14111
|
i = 0;
|
|
13559
|
-
case
|
|
14112
|
+
case 16:
|
|
13560
14113
|
if (!(i < (((_configuration$additi = configuration.additionals) === null || _configuration$additi === void 0 ? void 0 : _configuration$additi.length) || 0))) {
|
|
13561
|
-
_context2.next =
|
|
14114
|
+
_context2.next = 26;
|
|
13562
14115
|
break;
|
|
13563
14116
|
}
|
|
13564
14117
|
// perform additional server actions before returning the data
|
|
@@ -13570,20 +14123,20 @@ function useFormData (_ref) {
|
|
|
13570
14123
|
if (additional.addBaseUrl) {
|
|
13571
14124
|
data[additional.addBaseUrl] = window.location.origin;
|
|
13572
14125
|
}
|
|
13573
|
-
_context2.next =
|
|
14126
|
+
_context2.next = 23;
|
|
13574
14127
|
return additionalApi.create(data, additional.mapping, response);
|
|
13575
|
-
case
|
|
14128
|
+
case 23:
|
|
13576
14129
|
i++;
|
|
13577
|
-
_context2.next =
|
|
14130
|
+
_context2.next = 16;
|
|
13578
14131
|
break;
|
|
13579
|
-
case
|
|
14132
|
+
case 26:
|
|
13580
14133
|
finalData = response;
|
|
13581
14134
|
return _context2.abrupt("return", response);
|
|
13582
|
-
case
|
|
13583
|
-
_context2.prev =
|
|
13584
|
-
_context2.t0 = _context2["catch"](
|
|
14135
|
+
case 30:
|
|
14136
|
+
_context2.prev = 30;
|
|
14137
|
+
_context2.t0 = _context2["catch"](11);
|
|
13585
14138
|
if (!(_context2.t0 instanceof DivaError && _context2.t0.name)) {
|
|
13586
|
-
_context2.next =
|
|
14139
|
+
_context2.next = 38;
|
|
13587
14140
|
break;
|
|
13588
14141
|
}
|
|
13589
14142
|
errorCode = _context2.t0.name;
|
|
@@ -13592,25 +14145,25 @@ function useFormData (_ref) {
|
|
|
13592
14145
|
return (_item$onError = item.onError) === null || _item$onError === void 0 ? void 0 : _item$onError[errorCode];
|
|
13593
14146
|
});
|
|
13594
14147
|
if (!item) {
|
|
13595
|
-
_context2.next =
|
|
14148
|
+
_context2.next = 38;
|
|
13596
14149
|
break;
|
|
13597
14150
|
}
|
|
13598
14151
|
setFieldErrors(_objectSpread$I(_objectSpread$I({}, fieldErrors), {}, _defineProperty({}, item.name.toString(), item.onError[errorCode])));
|
|
13599
14152
|
return _context2.abrupt("return", undefined);
|
|
13600
|
-
case 37:
|
|
13601
|
-
throw _context2.t0;
|
|
13602
14153
|
case 38:
|
|
13603
|
-
_context2.
|
|
14154
|
+
throw _context2.t0;
|
|
14155
|
+
case 39:
|
|
14156
|
+
_context2.prev = 39;
|
|
13604
14157
|
setState(_objectSpread$I(_objectSpread$I({}, state), {}, {
|
|
13605
14158
|
data: finalData,
|
|
13606
14159
|
loading: false
|
|
13607
14160
|
}));
|
|
13608
|
-
return _context2.finish(
|
|
13609
|
-
case
|
|
14161
|
+
return _context2.finish(39);
|
|
14162
|
+
case 42:
|
|
13610
14163
|
case "end":
|
|
13611
14164
|
return _context2.stop();
|
|
13612
14165
|
}
|
|
13613
|
-
}, _callee2, null, [[
|
|
14166
|
+
}, _callee2, null, [[11, 30, 39, 42]]);
|
|
13614
14167
|
}));
|
|
13615
14168
|
return function onSave(_x2) {
|
|
13616
14169
|
return _ref3.apply(this, arguments);
|
|
@@ -13644,7 +14197,7 @@ function useFormData (_ref) {
|
|
|
13644
14197
|
}
|
|
13645
14198
|
};
|
|
13646
14199
|
var onInputChanged = function onInputChanged(id, value, d) {
|
|
13647
|
-
var data = d !== null && d !== void 0 ? d :
|
|
14200
|
+
var data = d !== null && d !== void 0 ? d : mergeWith(_objectSpread$I({}, state.data), state.form.getFieldsValue(), mergeCustomizer);
|
|
13648
14201
|
if (id) {
|
|
13649
14202
|
setFieldInObject(id, data, value);
|
|
13650
14203
|
var newFieldErrors = _objectSpread$I({}, fieldErrors);
|
|
@@ -13656,6 +14209,12 @@ function useFormData (_ref) {
|
|
|
13656
14209
|
}));
|
|
13657
14210
|
return data;
|
|
13658
14211
|
};
|
|
14212
|
+
|
|
14213
|
+
//if at an array an entry got added or deleted, its handeled by and so we take the data from the formdata
|
|
14214
|
+
var mergeCustomizer = function mergeCustomizer(obj, src) {
|
|
14215
|
+
if (Array.isArray(obj) && obj.length != src.length) return src;
|
|
14216
|
+
return undefined;
|
|
14217
|
+
};
|
|
13659
14218
|
var setNewData = function setNewData(newData, orig) {
|
|
13660
14219
|
if (usedPreset.used === true) {
|
|
13661
14220
|
var usdPreset = presets.data[usedPreset.index];
|
|
@@ -13700,31 +14259,159 @@ function useFormData (_ref) {
|
|
|
13700
14259
|
data: _objectSpread$I(_objectSpread$I({}, state.data), {}, _defineProperty({}, name, val))
|
|
13701
14260
|
}));
|
|
13702
14261
|
}
|
|
13703
|
-
setSelectedItemsIndex(idx);
|
|
13704
|
-
}
|
|
13705
|
-
});
|
|
13706
|
-
};
|
|
13707
|
-
useEffect(function () {
|
|
13708
|
-
if (!Array.isArray(configuration.items[0])) return;
|
|
13709
|
-
setSelectedItems(filterItems(configuration.items[selectedItemsIndex], userHasPermission));
|
|
13710
|
-
}, [selectedItemsIndex]);
|
|
13711
|
-
useEffect(function () {
|
|
13712
|
-
updateHiddenRequiredDisabled(state.data);
|
|
13713
|
-
}, [selectedItems]);
|
|
13714
|
-
function
|
|
14262
|
+
setSelectedItemsIndex(idx);
|
|
14263
|
+
}
|
|
14264
|
+
});
|
|
14265
|
+
};
|
|
14266
|
+
useEffect(function () {
|
|
14267
|
+
if (!Array.isArray(configuration.items[0])) return;
|
|
14268
|
+
setSelectedItems(filterItems(configuration.items[selectedItemsIndex], userHasPermission));
|
|
14269
|
+
}, [selectedItemsIndex]);
|
|
14270
|
+
useEffect(function () {
|
|
14271
|
+
updateHiddenRequiredDisabled(state.data);
|
|
14272
|
+
}, [selectedItems]);
|
|
14273
|
+
function preSaveProcess(_x3, _x4) {
|
|
14274
|
+
return _preSaveProcess.apply(this, arguments);
|
|
14275
|
+
}
|
|
14276
|
+
function _preSaveProcess() {
|
|
14277
|
+
_preSaveProcess = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data, items) {
|
|
14278
|
+
var _iterator3, _step3, item, itemName, media, mediaItemRefIdPath, urlPath, arrayData, i, _iterator4, _step4, _media;
|
|
14279
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
14280
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
14281
|
+
case 0:
|
|
14282
|
+
_iterator3 = _createForOfIteratorHelper$j(items);
|
|
14283
|
+
_context4.prev = 1;
|
|
14284
|
+
_iterator3.s();
|
|
14285
|
+
case 3:
|
|
14286
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
14287
|
+
_context4.next = 37;
|
|
14288
|
+
break;
|
|
14289
|
+
}
|
|
14290
|
+
item = _step3.value;
|
|
14291
|
+
itemName = typeof item.name == 'string' ? [item.name] : item.name;
|
|
14292
|
+
if (item !== null && item !== void 0 && item.onSave) {
|
|
14293
|
+
data = item.onSave(data);
|
|
14294
|
+
}
|
|
14295
|
+
if (!(item.type == 'media')) {
|
|
14296
|
+
_context4.next = 19;
|
|
14297
|
+
break;
|
|
14298
|
+
}
|
|
14299
|
+
media = getData(itemName, data);
|
|
14300
|
+
if (!(media instanceof MediaItem)) {
|
|
14301
|
+
_context4.next = 17;
|
|
14302
|
+
break;
|
|
14303
|
+
}
|
|
14304
|
+
_context4.next = 12;
|
|
14305
|
+
return media.upload(root.dataStore.organizationId, item.functionType);
|
|
14306
|
+
case 12:
|
|
14307
|
+
mediaItemRefIdPath = item.mediaItemRefField ? itemName.slice(0, -1).concat(item.mediaItemRefField) : undefined;
|
|
14308
|
+
urlPath = item.urlField ? itemName.slice(0, -1).concat(item.urlField) : undefined;
|
|
14309
|
+
setFieldInObject(itemName, data, media.itemId);
|
|
14310
|
+
if (urlPath) {
|
|
14311
|
+
setFieldInObject(urlPath, data, media.url);
|
|
14312
|
+
}
|
|
14313
|
+
if (mediaItemRefIdPath) {
|
|
14314
|
+
setFieldInObject(mediaItemRefIdPath, data, media.itemRefId);
|
|
14315
|
+
}
|
|
14316
|
+
case 17:
|
|
14317
|
+
_context4.next = 35;
|
|
14318
|
+
break;
|
|
14319
|
+
case 19:
|
|
14320
|
+
if (!(item.type == 'translation')) {
|
|
14321
|
+
_context4.next = 24;
|
|
14322
|
+
break;
|
|
14323
|
+
}
|
|
14324
|
+
_context4.next = 22;
|
|
14325
|
+
return preSaveProcess(data, item.items);
|
|
14326
|
+
case 22:
|
|
14327
|
+
_context4.next = 35;
|
|
14328
|
+
break;
|
|
14329
|
+
case 24:
|
|
14330
|
+
if (!(item.type == 'array')) {
|
|
14331
|
+
_context4.next = 35;
|
|
14332
|
+
break;
|
|
14333
|
+
}
|
|
14334
|
+
arrayData = getData(item.name, data);
|
|
14335
|
+
if (!arrayData) {
|
|
14336
|
+
_context4.next = 34;
|
|
14337
|
+
break;
|
|
14338
|
+
}
|
|
14339
|
+
i = 0;
|
|
14340
|
+
case 28:
|
|
14341
|
+
if (!(i < arrayData.length)) {
|
|
14342
|
+
_context4.next = 34;
|
|
14343
|
+
break;
|
|
14344
|
+
}
|
|
14345
|
+
_context4.next = 31;
|
|
14346
|
+
return preSaveProcess(arrayData[i], item.items);
|
|
14347
|
+
case 31:
|
|
14348
|
+
i++;
|
|
14349
|
+
_context4.next = 28;
|
|
14350
|
+
break;
|
|
14351
|
+
case 34:
|
|
14352
|
+
setFieldInObject(item.name, data, arrayData);
|
|
14353
|
+
case 35:
|
|
14354
|
+
_context4.next = 3;
|
|
14355
|
+
break;
|
|
14356
|
+
case 37:
|
|
14357
|
+
_context4.next = 42;
|
|
14358
|
+
break;
|
|
14359
|
+
case 39:
|
|
14360
|
+
_context4.prev = 39;
|
|
14361
|
+
_context4.t0 = _context4["catch"](1);
|
|
14362
|
+
_iterator3.e(_context4.t0);
|
|
14363
|
+
case 42:
|
|
14364
|
+
_context4.prev = 42;
|
|
14365
|
+
_iterator3.f();
|
|
14366
|
+
return _context4.finish(42);
|
|
14367
|
+
case 45:
|
|
14368
|
+
_iterator4 = _createForOfIteratorHelper$j(removedMedias);
|
|
14369
|
+
_context4.prev = 46;
|
|
14370
|
+
_iterator4.s();
|
|
14371
|
+
case 48:
|
|
14372
|
+
if ((_step4 = _iterator4.n()).done) {
|
|
14373
|
+
_context4.next = 54;
|
|
14374
|
+
break;
|
|
14375
|
+
}
|
|
14376
|
+
_media = _step4.value;
|
|
14377
|
+
_context4.next = 52;
|
|
14378
|
+
return _media["delete"]();
|
|
14379
|
+
case 52:
|
|
14380
|
+
_context4.next = 48;
|
|
14381
|
+
break;
|
|
14382
|
+
case 54:
|
|
14383
|
+
_context4.next = 59;
|
|
14384
|
+
break;
|
|
14385
|
+
case 56:
|
|
14386
|
+
_context4.prev = 56;
|
|
14387
|
+
_context4.t1 = _context4["catch"](46);
|
|
14388
|
+
_iterator4.e(_context4.t1);
|
|
14389
|
+
case 59:
|
|
14390
|
+
_context4.prev = 59;
|
|
14391
|
+
_iterator4.f();
|
|
14392
|
+
return _context4.finish(59);
|
|
14393
|
+
case 62:
|
|
14394
|
+
case "end":
|
|
14395
|
+
return _context4.stop();
|
|
14396
|
+
}
|
|
14397
|
+
}, _callee4, null, [[1, 39, 42, 45], [46, 56, 59, 62]]);
|
|
14398
|
+
}));
|
|
14399
|
+
return _preSaveProcess.apply(this, arguments);
|
|
14400
|
+
}
|
|
14401
|
+
function setDynamicFields(_x5, _x6) {
|
|
13715
14402
|
return _setDynamicFields.apply(this, arguments);
|
|
13716
14403
|
}
|
|
13717
14404
|
function _setDynamicFields() {
|
|
13718
|
-
_setDynamicFields = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
13719
|
-
var items, getDynamicValue, _getDynamicValue,
|
|
13720
|
-
return _regeneratorRuntime.wrap(function
|
|
13721
|
-
while (1) switch (
|
|
14405
|
+
_setDynamicFields = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(oldData, newData) {
|
|
14406
|
+
var items, getDynamicValue, _getDynamicValue, _iterator5, _step5, item, oldDynamicValue, newDynamicValue;
|
|
14407
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
14408
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
13722
14409
|
case 0:
|
|
13723
14410
|
_getDynamicValue = function _getDynamicValue3() {
|
|
13724
|
-
_getDynamicValue = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
14411
|
+
_getDynamicValue = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(dynamic, data) {
|
|
13725
14412
|
var val, scene, accessorie, room;
|
|
13726
|
-
return _regeneratorRuntime.wrap(function
|
|
13727
|
-
while (1) switch (
|
|
14413
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
14414
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
13728
14415
|
case 0:
|
|
13729
14416
|
val = dynamic.fields.map(function (field) {
|
|
13730
14417
|
return data[field];
|
|
@@ -13734,13 +14421,13 @@ function useFormData (_ref) {
|
|
|
13734
14421
|
scene = data['renderScene'];
|
|
13735
14422
|
accessorie = data['alternativeRendering'];
|
|
13736
14423
|
if (!scene) {
|
|
13737
|
-
|
|
14424
|
+
_context5.next = 8;
|
|
13738
14425
|
break;
|
|
13739
14426
|
}
|
|
13740
|
-
|
|
14427
|
+
_context5.next = 6;
|
|
13741
14428
|
return mediaHandler.getRooms(scene);
|
|
13742
14429
|
case 6:
|
|
13743
|
-
room =
|
|
14430
|
+
room = _context5.sent[0];
|
|
13744
14431
|
if (room) {
|
|
13745
14432
|
val += '_MOOD';
|
|
13746
14433
|
}
|
|
@@ -13748,66 +14435,66 @@ function useFormData (_ref) {
|
|
|
13748
14435
|
if (accessorie) {
|
|
13749
14436
|
val += '_MODIF';
|
|
13750
14437
|
}
|
|
13751
|
-
return
|
|
14438
|
+
return _context5.abrupt("return", val);
|
|
13752
14439
|
case 10:
|
|
13753
14440
|
case "end":
|
|
13754
|
-
return
|
|
14441
|
+
return _context5.stop();
|
|
13755
14442
|
}
|
|
13756
|
-
},
|
|
14443
|
+
}, _callee5);
|
|
13757
14444
|
}));
|
|
13758
14445
|
return _getDynamicValue.apply(this, arguments);
|
|
13759
14446
|
};
|
|
13760
|
-
getDynamicValue = function _getDynamicValue2(
|
|
14447
|
+
getDynamicValue = function _getDynamicValue2(_x9, _x10) {
|
|
13761
14448
|
return _getDynamicValue.apply(this, arguments);
|
|
13762
14449
|
};
|
|
13763
14450
|
items = selectedItems !== null && selectedItems !== void 0 ? selectedItems : configuration.items;
|
|
13764
|
-
|
|
13765
|
-
|
|
13766
|
-
|
|
14451
|
+
_iterator5 = _createForOfIteratorHelper$j(items);
|
|
14452
|
+
_context6.prev = 4;
|
|
14453
|
+
_iterator5.s();
|
|
13767
14454
|
case 6:
|
|
13768
|
-
if ((
|
|
13769
|
-
|
|
14455
|
+
if ((_step5 = _iterator5.n()).done) {
|
|
14456
|
+
_context6.next = 19;
|
|
13770
14457
|
break;
|
|
13771
14458
|
}
|
|
13772
|
-
item =
|
|
14459
|
+
item = _step5.value;
|
|
13773
14460
|
if (!(item.dynamic && typeof item.name == 'string')) {
|
|
13774
|
-
|
|
14461
|
+
_context6.next = 17;
|
|
13775
14462
|
break;
|
|
13776
14463
|
}
|
|
13777
|
-
|
|
14464
|
+
_context6.next = 11;
|
|
13778
14465
|
return getDynamicValue(item.dynamic, oldData);
|
|
13779
14466
|
case 11:
|
|
13780
|
-
oldDynamicValue =
|
|
14467
|
+
oldDynamicValue = _context6.sent;
|
|
13781
14468
|
if (!(oldData[item.name] == oldDynamicValue && newData[item.name] == oldData[item.name])) {
|
|
13782
|
-
|
|
14469
|
+
_context6.next = 17;
|
|
13783
14470
|
break;
|
|
13784
14471
|
}
|
|
13785
|
-
|
|
14472
|
+
_context6.next = 15;
|
|
13786
14473
|
return getDynamicValue(item.dynamic, newData);
|
|
13787
14474
|
case 15:
|
|
13788
|
-
newDynamicValue =
|
|
14475
|
+
newDynamicValue = _context6.sent;
|
|
13789
14476
|
newData[item.name] = newDynamicValue;
|
|
13790
14477
|
case 17:
|
|
13791
|
-
|
|
14478
|
+
_context6.next = 6;
|
|
13792
14479
|
break;
|
|
13793
14480
|
case 19:
|
|
13794
|
-
|
|
14481
|
+
_context6.next = 24;
|
|
13795
14482
|
break;
|
|
13796
14483
|
case 21:
|
|
13797
|
-
|
|
13798
|
-
|
|
13799
|
-
|
|
14484
|
+
_context6.prev = 21;
|
|
14485
|
+
_context6.t0 = _context6["catch"](4);
|
|
14486
|
+
_iterator5.e(_context6.t0);
|
|
13800
14487
|
case 24:
|
|
13801
|
-
|
|
13802
|
-
|
|
13803
|
-
return
|
|
14488
|
+
_context6.prev = 24;
|
|
14489
|
+
_iterator5.f();
|
|
14490
|
+
return _context6.finish(24);
|
|
13804
14491
|
case 27:
|
|
13805
|
-
return
|
|
14492
|
+
return _context6.abrupt("return", newData);
|
|
13806
14493
|
case 28:
|
|
13807
14494
|
case "end":
|
|
13808
|
-
return
|
|
14495
|
+
return _context6.stop();
|
|
13809
14496
|
}
|
|
13810
|
-
},
|
|
14497
|
+
}, _callee6, null, [[4, 21, 24, 27]]);
|
|
13811
14498
|
}));
|
|
13812
14499
|
return _setDynamicFields.apply(this, arguments);
|
|
13813
14500
|
}
|
|
@@ -13833,10 +14520,11 @@ function useFormData (_ref) {
|
|
|
13833
14520
|
}
|
|
13834
14521
|
return rules;
|
|
13835
14522
|
}
|
|
13836
|
-
var getIsHidden = function getIsHidden(item, data) {
|
|
13837
|
-
var
|
|
14523
|
+
var getIsHidden = function getIsHidden(item, data, absolutName) {
|
|
14524
|
+
var _state$hiddenRequired;
|
|
13838
14525
|
var hidden = !!item.hidden;
|
|
13839
|
-
if (
|
|
14526
|
+
if (absolutName) data = getData(absolutName, data);
|
|
14527
|
+
if (typeof item.hidden === 'function') hidden = item.hidden(data);
|
|
13840
14528
|
if (!hidden) hidden = (_state$hiddenRequired = state.hiddenRequiredDisabled) === null || _state$hiddenRequired === void 0 || (_state$hiddenRequired = _state$hiddenRequired[typeof item.name == 'string' ? item.name : item.name.join('.')]) === null || _state$hiddenRequired === void 0 ? void 0 : _state$hiddenRequired.hidden;
|
|
13841
14529
|
return hidden;
|
|
13842
14530
|
};
|
|
@@ -13864,6 +14552,92 @@ function useFormData (_ref) {
|
|
|
13864
14552
|
}
|
|
13865
14553
|
return;
|
|
13866
14554
|
}, [state.data]);
|
|
14555
|
+
var _keepRemovedMeidaItem = /*#__PURE__*/function () {
|
|
14556
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data, items) {
|
|
14557
|
+
var _iterator2, _step2, item, itemName, media, arrayData, i;
|
|
14558
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
14559
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
14560
|
+
case 0:
|
|
14561
|
+
_iterator2 = _createForOfIteratorHelper$j(items);
|
|
14562
|
+
_context3.prev = 1;
|
|
14563
|
+
_iterator2.s();
|
|
14564
|
+
case 3:
|
|
14565
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
14566
|
+
_context3.next = 28;
|
|
14567
|
+
break;
|
|
14568
|
+
}
|
|
14569
|
+
item = _step2.value;
|
|
14570
|
+
itemName = typeof item.name == 'string' ? [item.name] : item.name;
|
|
14571
|
+
if (!(item.type == 'media')) {
|
|
14572
|
+
_context3.next = 11;
|
|
14573
|
+
break;
|
|
14574
|
+
}
|
|
14575
|
+
media = getData(itemName, data);
|
|
14576
|
+
if (media) pushRemovedMeidaItem(media);
|
|
14577
|
+
_context3.next = 26;
|
|
14578
|
+
break;
|
|
14579
|
+
case 11:
|
|
14580
|
+
if (!(item.type == 'translation')) {
|
|
14581
|
+
_context3.next = 16;
|
|
14582
|
+
break;
|
|
14583
|
+
}
|
|
14584
|
+
_context3.next = 14;
|
|
14585
|
+
return _keepRemovedMeidaItem(data, item.items);
|
|
14586
|
+
case 14:
|
|
14587
|
+
_context3.next = 26;
|
|
14588
|
+
break;
|
|
14589
|
+
case 16:
|
|
14590
|
+
if (!(item.type == 'array')) {
|
|
14591
|
+
_context3.next = 26;
|
|
14592
|
+
break;
|
|
14593
|
+
}
|
|
14594
|
+
arrayData = getData(item.name, data);
|
|
14595
|
+
if (!arrayData) {
|
|
14596
|
+
_context3.next = 26;
|
|
14597
|
+
break;
|
|
14598
|
+
}
|
|
14599
|
+
i = 0;
|
|
14600
|
+
case 20:
|
|
14601
|
+
if (!(i < arrayData.length)) {
|
|
14602
|
+
_context3.next = 26;
|
|
14603
|
+
break;
|
|
14604
|
+
}
|
|
14605
|
+
_context3.next = 23;
|
|
14606
|
+
return _keepRemovedMeidaItem(arrayData[i], item.items);
|
|
14607
|
+
case 23:
|
|
14608
|
+
i++;
|
|
14609
|
+
_context3.next = 20;
|
|
14610
|
+
break;
|
|
14611
|
+
case 26:
|
|
14612
|
+
_context3.next = 3;
|
|
14613
|
+
break;
|
|
14614
|
+
case 28:
|
|
14615
|
+
_context3.next = 33;
|
|
14616
|
+
break;
|
|
14617
|
+
case 30:
|
|
14618
|
+
_context3.prev = 30;
|
|
14619
|
+
_context3.t0 = _context3["catch"](1);
|
|
14620
|
+
_iterator2.e(_context3.t0);
|
|
14621
|
+
case 33:
|
|
14622
|
+
_context3.prev = 33;
|
|
14623
|
+
_iterator2.f();
|
|
14624
|
+
return _context3.finish(33);
|
|
14625
|
+
case 36:
|
|
14626
|
+
case "end":
|
|
14627
|
+
return _context3.stop();
|
|
14628
|
+
}
|
|
14629
|
+
}, _callee3, null, [[1, 30, 33, 36]]);
|
|
14630
|
+
}));
|
|
14631
|
+
return function keepRemovedMeidaItem(_x7, _x8) {
|
|
14632
|
+
return _ref7.apply(this, arguments);
|
|
14633
|
+
};
|
|
14634
|
+
}();
|
|
14635
|
+
var pushRemovedMeidaItem = function pushRemovedMeidaItem(media) {
|
|
14636
|
+
if (removedMedias.find(function (m) {
|
|
14637
|
+
return m.itemRefId === media.itemRefId;
|
|
14638
|
+
})) return;
|
|
14639
|
+
setRemovedMedias([].concat(_toConsumableArray(removedMedias), [media]));
|
|
14640
|
+
};
|
|
13867
14641
|
return _objectSpread$I(_objectSpread$I({}, state), {}, {
|
|
13868
14642
|
getIsHidden: getIsHidden,
|
|
13869
14643
|
setUsedPreset: setUsedPreset,
|
|
@@ -13886,7 +14660,9 @@ function useFormData (_ref) {
|
|
|
13886
14660
|
updateHiddenRequiredDisabled: updateHiddenRequiredDisabled,
|
|
13887
14661
|
getRules: getRules,
|
|
13888
14662
|
progressBarOpen: progressBarOpen,
|
|
13889
|
-
progressBarPercentage: progressBarPercentage
|
|
14663
|
+
progressBarPercentage: progressBarPercentage,
|
|
14664
|
+
keepRemovedMeidaItem: _keepRemovedMeidaItem,
|
|
14665
|
+
pushRemovedMeidaItem: pushRemovedMeidaItem
|
|
13890
14666
|
});
|
|
13891
14667
|
}
|
|
13892
14668
|
function setFieldInObject(id, data, value) {
|
|
@@ -13978,6 +14754,7 @@ var JsonEditor$2 = function JsonEditor(_ref) {
|
|
|
13978
14754
|
});
|
|
13979
14755
|
};
|
|
13980
14756
|
|
|
14757
|
+
var _excluded$3 = ["key", "name"];
|
|
13981
14758
|
function ownKeys$H(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13982
14759
|
function _objectSpread$H(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$H(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$H(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13983
14760
|
var FormList$2 = function FormList(_ref) {
|
|
@@ -13985,51 +14762,56 @@ var FormList$2 = function FormList(_ref) {
|
|
|
13985
14762
|
var value = _ref.value,
|
|
13986
14763
|
item = _ref.item,
|
|
13987
14764
|
state = _ref.state,
|
|
13988
|
-
data = _ref.data,
|
|
13989
14765
|
setCanSave = _ref.setCanSave,
|
|
13990
14766
|
onError = _ref.onError,
|
|
13991
14767
|
form = _ref.form,
|
|
13992
14768
|
root = _ref.root,
|
|
13993
|
-
postFixName = _ref.postFixName
|
|
14769
|
+
postFixName = _ref.postFixName,
|
|
14770
|
+
absoluteName = _ref.absoluteName;
|
|
13994
14771
|
var _useTranslation = useTranslation(),
|
|
13995
14772
|
t = _useTranslation.t;
|
|
13996
14773
|
var remove = function remove(index, r) {
|
|
14774
|
+
var _state$getData;
|
|
14775
|
+
var data = (_state$getData = state.getData(absoluteName, state.data)) === null || _state$getData === void 0 ? void 0 : _state$getData[index];
|
|
14776
|
+
state.keepRemovedMeidaItem(data, item.items);
|
|
13997
14777
|
r(index);
|
|
13998
|
-
|
|
13999
|
-
if (array) {
|
|
14000
|
-
array.splice(index, 1);
|
|
14001
|
-
state.onInputChanged(Array.isArray(item.name) ? item.name : _toConsumableArray(item.name), array);
|
|
14002
|
-
}
|
|
14778
|
+
state.onInputChanged();
|
|
14003
14779
|
};
|
|
14004
14780
|
var add = function add(a) {
|
|
14005
14781
|
a();
|
|
14006
14782
|
};
|
|
14007
14783
|
return /*#__PURE__*/jsx(Form$1.List, {
|
|
14008
|
-
name:
|
|
14784
|
+
name: absoluteName,
|
|
14009
14785
|
initialValue: (_item$initialValue = item.initialValue) !== null && _item$initialValue !== void 0 ? _item$initialValue : value,
|
|
14010
14786
|
children: function children(fields, _ref2) {
|
|
14011
14787
|
var a = _ref2.add,
|
|
14012
14788
|
r = _ref2.remove;
|
|
14013
14789
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
14014
|
-
children: [fields.map(function (
|
|
14790
|
+
children: [fields.map(function (_ref3) {
|
|
14791
|
+
var key = _ref3.key,
|
|
14792
|
+
name = _ref3.name,
|
|
14793
|
+
restField = _objectWithoutProperties(_ref3, _excluded$3);
|
|
14015
14794
|
return /*#__PURE__*/jsxs("div", {
|
|
14016
|
-
id:
|
|
14795
|
+
id: key.toString(),
|
|
14017
14796
|
style: {
|
|
14018
14797
|
display: 'flex'
|
|
14019
14798
|
},
|
|
14020
14799
|
children: [!item.disablePushOrPop && /*#__PURE__*/jsx(MinusCircleOutlined, {
|
|
14021
14800
|
onClick: function onClick() {
|
|
14022
|
-
|
|
14801
|
+
remove(name, r);
|
|
14023
14802
|
}
|
|
14024
14803
|
}), /*#__PURE__*/jsx("div", {
|
|
14025
14804
|
style: {
|
|
14026
14805
|
flexGrow: 1
|
|
14027
14806
|
},
|
|
14028
14807
|
children: item.items.map(function (i, idx) {
|
|
14029
|
-
var n = [
|
|
14030
|
-
var
|
|
14031
|
-
|
|
14032
|
-
|
|
14808
|
+
var n = [name].concat(_toConsumableArray(Array.isArray(i.name) ? i.name : [i.name]), _toConsumableArray(i.doTranslate && postFixName ? Array.isArray(postFixName) ? postFixName : [postFixName] : []));
|
|
14809
|
+
var aName = [].concat(_toConsumableArray(Array.isArray(absoluteName) ? absoluteName : [absoluteName]), _toConsumableArray(n));
|
|
14810
|
+
var hidden = state.getIsHidden(i, state.data, [].concat(_toConsumableArray(Array.isArray(absoluteName) ? absoluteName : [absoluteName]), [name]));
|
|
14811
|
+
if (hidden) return /*#__PURE__*/jsx(Fragment, {});
|
|
14812
|
+
return /*#__PURE__*/createElement(Form$1.Item, _objectSpread$H(_objectSpread$H({}, restField), {}, {
|
|
14813
|
+
id: n.join(),
|
|
14814
|
+
key: n.join(),
|
|
14033
14815
|
name: n,
|
|
14034
14816
|
rules: state.getRules(i, state.data),
|
|
14035
14817
|
label: getLabel(i, t),
|
|
@@ -14038,14 +14820,13 @@ var FormList$2 = function FormList(_ref) {
|
|
|
14038
14820
|
hasFeedback: !!state.fieldErrors[n.toString()],
|
|
14039
14821
|
validateStatus: !!state.fieldErrors[n.toString()] ? 'error' : undefined,
|
|
14040
14822
|
help: state.fieldErrors[n.toString()],
|
|
14041
|
-
hidden: hidden
|
|
14042
|
-
|
|
14043
|
-
|
|
14044
|
-
|
|
14045
|
-
}, idx);
|
|
14823
|
+
hidden: hidden
|
|
14824
|
+
}), getElement(_objectSpread$H(_objectSpread$H({}, i), {}, {
|
|
14825
|
+
name: n
|
|
14826
|
+
}), setCanSave, state, aName, state.onInputChanged, onError, root, form, hidden));
|
|
14046
14827
|
})
|
|
14047
14828
|
})]
|
|
14048
|
-
},
|
|
14829
|
+
}, key);
|
|
14049
14830
|
}), !item.disablePushOrPop && /*#__PURE__*/jsx(Form$1.Item, {
|
|
14050
14831
|
children: /*#__PURE__*/jsx(Button, {
|
|
14051
14832
|
type: "dashed",
|
|
@@ -16244,7 +17025,8 @@ var Translation = function Translation(_ref) {
|
|
|
16244
17025
|
setCanSave = _ref.setCanSave,
|
|
16245
17026
|
onError = _ref.onError,
|
|
16246
17027
|
form = _ref.form,
|
|
16247
|
-
root = _ref.root
|
|
17028
|
+
root = _ref.root,
|
|
17029
|
+
absoluteName = _ref.absoluteName;
|
|
16248
17030
|
var _useTranslation = useTranslation(),
|
|
16249
17031
|
t = _useTranslation.t;
|
|
16250
17032
|
var _useTranslationHook = useTranslationHook(item, state),
|
|
@@ -16281,13 +17063,13 @@ var Translation = function Translation(_ref) {
|
|
|
16281
17063
|
},
|
|
16282
17064
|
children: item.items.map(function (i, idx) {
|
|
16283
17065
|
var n = [].concat(_toConsumableArray(Array.isArray(i.name) ? i.name : [i.name]), _toConsumableArray(i.doTranslate ? [currentLang] : []));
|
|
17066
|
+
var key = typeof n == 'string' ? n : n.join('.');
|
|
16284
17067
|
var hidden = state.getIsHidden(i, data);
|
|
16285
|
-
|
|
16286
|
-
|
|
16287
|
-
|
|
16288
|
-
|
|
16289
|
-
|
|
16290
|
-
}) : /*#__PURE__*/jsx(Form$1.Item, {
|
|
17068
|
+
var newAbsoluteName = absoluteName !== '' ? [].concat(_toConsumableArray(Array.isArray(absoluteName) ? absoluteName : [absoluteName]), _toConsumableArray(n)) : n;
|
|
17069
|
+
return /*#__PURE__*/jsx(React.Fragment, {
|
|
17070
|
+
children: ['subTitle', 'array'].includes(i.type) ? getElement(_objectSpread$B(_objectSpread$B({}, i), {}, {
|
|
17071
|
+
name: n
|
|
17072
|
+
}), setCanSave, state, newAbsoluteName, state.onInputChanged, onError, root, form, hidden, currentLang) : /*#__PURE__*/jsx(Form$1.Item, {
|
|
16291
17073
|
id: idx.toString(),
|
|
16292
17074
|
name: n,
|
|
16293
17075
|
rules: state.getRules(i, state.data),
|
|
@@ -16300,9 +17082,9 @@ var Translation = function Translation(_ref) {
|
|
|
16300
17082
|
hidden: hidden,
|
|
16301
17083
|
children: getElement(_objectSpread$B(_objectSpread$B({}, i), {}, {
|
|
16302
17084
|
name: n
|
|
16303
|
-
}),
|
|
16304
|
-
}
|
|
16305
|
-
});
|
|
17085
|
+
}), setCanSave, state, newAbsoluteName, state.onInputChanged, onError, root, form, hidden)
|
|
17086
|
+
})
|
|
17087
|
+
}, key);
|
|
16306
17088
|
})
|
|
16307
17089
|
})]
|
|
16308
17090
|
});
|
|
@@ -16311,16 +17093,266 @@ var Translation$1 = observer(Translation, {
|
|
|
16311
17093
|
forwardRef: true
|
|
16312
17094
|
});
|
|
16313
17095
|
|
|
17096
|
+
function FileFromWeb (_ref) {
|
|
17097
|
+
var _onEnter = _ref.onEnter;
|
|
17098
|
+
var _useState = useState(false),
|
|
17099
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
17100
|
+
uploadFromWeb = _useState2[0],
|
|
17101
|
+
setUploadFromWeb = _useState2[1];
|
|
17102
|
+
if (uploadFromWeb) {
|
|
17103
|
+
return /*#__PURE__*/jsx(FileInput, {
|
|
17104
|
+
onEnter: function onEnter(f) {
|
|
17105
|
+
_onEnter(f);
|
|
17106
|
+
setUploadFromWeb(false);
|
|
17107
|
+
},
|
|
17108
|
+
onAbort: function onAbort() {
|
|
17109
|
+
return setUploadFromWeb(false);
|
|
17110
|
+
}
|
|
17111
|
+
});
|
|
17112
|
+
}
|
|
17113
|
+
return /*#__PURE__*/jsx(Teaser, {
|
|
17114
|
+
onClick: function onClick() {
|
|
17115
|
+
return setUploadFromWeb(true);
|
|
17116
|
+
}
|
|
17117
|
+
});
|
|
17118
|
+
}
|
|
17119
|
+
function Teaser(_ref2) {
|
|
17120
|
+
var _onClick = _ref2.onClick;
|
|
17121
|
+
var _useTranslation = useTranslation(),
|
|
17122
|
+
t = _useTranslation.t;
|
|
17123
|
+
return /*#__PURE__*/jsx(Button, {
|
|
17124
|
+
type: "link",
|
|
17125
|
+
onClick: function onClick(e) {
|
|
17126
|
+
e.stopPropagation();
|
|
17127
|
+
_onClick();
|
|
17128
|
+
},
|
|
17129
|
+
children: t('backoffice.mediaupload.alternative_url')
|
|
17130
|
+
});
|
|
17131
|
+
}
|
|
17132
|
+
function FileInput(_ref3) {
|
|
17133
|
+
var onEnter = _ref3.onEnter,
|
|
17134
|
+
onAbort = _ref3.onAbort;
|
|
17135
|
+
var _useState3 = useState(''),
|
|
17136
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
17137
|
+
value = _useState4[0],
|
|
17138
|
+
setValue = _useState4[1];
|
|
17139
|
+
return /*#__PURE__*/jsxs(Space, {
|
|
17140
|
+
direction: "horizontal",
|
|
17141
|
+
onClick: function onClick(e) {
|
|
17142
|
+
return e.stopPropagation();
|
|
17143
|
+
},
|
|
17144
|
+
children: [/*#__PURE__*/jsxs(Space.Compact, {
|
|
17145
|
+
children: [/*#__PURE__*/jsx(Input, {
|
|
17146
|
+
onChange: function onChange(e) {
|
|
17147
|
+
return setValue(e.target.value);
|
|
17148
|
+
},
|
|
17149
|
+
onPressEnter: function onPressEnter(e) {
|
|
17150
|
+
e.stopPropagation();
|
|
17151
|
+
value ? onEnter(value) : undefined;
|
|
17152
|
+
},
|
|
17153
|
+
allowClear: true
|
|
17154
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
17155
|
+
onClick: function onClick() {
|
|
17156
|
+
onEnter(value);
|
|
17157
|
+
},
|
|
17158
|
+
disabled: !value,
|
|
17159
|
+
children: "\xDCbernehmen"
|
|
17160
|
+
})]
|
|
17161
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
17162
|
+
type: "link",
|
|
17163
|
+
onClick: onAbort,
|
|
17164
|
+
children: "Abbrechen"
|
|
17165
|
+
})]
|
|
17166
|
+
});
|
|
17167
|
+
}
|
|
17168
|
+
|
|
17169
|
+
function Upload (_ref) {
|
|
17170
|
+
var allowedTypes = _ref.allowedTypes,
|
|
17171
|
+
media = _ref.media,
|
|
17172
|
+
onRemove = _ref.onRemove,
|
|
17173
|
+
onAdd = _ref.onAdd,
|
|
17174
|
+
onError = _ref.onError,
|
|
17175
|
+
config = _ref.config;
|
|
17176
|
+
var _React$useState = React.useState([]),
|
|
17177
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
17178
|
+
files = _React$useState2[0],
|
|
17179
|
+
setFiles = _React$useState2[1];
|
|
17180
|
+
var _React$useState3 = React.useState(false),
|
|
17181
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
17182
|
+
loading = _React$useState4[0],
|
|
17183
|
+
setLoading = _React$useState4[1];
|
|
17184
|
+
var fileList = useMemo(function () {
|
|
17185
|
+
return files.map(function (f) {
|
|
17186
|
+
return f.antdFile;
|
|
17187
|
+
});
|
|
17188
|
+
}, [files]);
|
|
17189
|
+
useEffect(function () {
|
|
17190
|
+
_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
17191
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
17192
|
+
while (1) switch (_context.prev = _context.next) {
|
|
17193
|
+
case 0:
|
|
17194
|
+
if (media !== null && media !== void 0 && media.url) {
|
|
17195
|
+
_context.next = 4;
|
|
17196
|
+
break;
|
|
17197
|
+
}
|
|
17198
|
+
setFiles([]);
|
|
17199
|
+
_context.next = 17;
|
|
17200
|
+
break;
|
|
17201
|
+
case 4:
|
|
17202
|
+
setLoading(true);
|
|
17203
|
+
_context.prev = 5;
|
|
17204
|
+
_context.next = 8;
|
|
17205
|
+
return media.init(allowedTypes);
|
|
17206
|
+
case 8:
|
|
17207
|
+
setFiles([media]);
|
|
17208
|
+
_context.next = 14;
|
|
17209
|
+
break;
|
|
17210
|
+
case 11:
|
|
17211
|
+
_context.prev = 11;
|
|
17212
|
+
_context.t0 = _context["catch"](5);
|
|
17213
|
+
onError === null || onError === void 0 || onError(_context.t0);
|
|
17214
|
+
case 14:
|
|
17215
|
+
_context.prev = 14;
|
|
17216
|
+
setLoading(false);
|
|
17217
|
+
return _context.finish(14);
|
|
17218
|
+
case 17:
|
|
17219
|
+
case "end":
|
|
17220
|
+
return _context.stop();
|
|
17221
|
+
}
|
|
17222
|
+
}, _callee, null, [[5, 11, 14, 17]]);
|
|
17223
|
+
}))();
|
|
17224
|
+
}, [media === null || media === void 0 ? void 0 : media.url]);
|
|
17225
|
+
var addMediaItem = /*#__PURE__*/function () {
|
|
17226
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(media) {
|
|
17227
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
17228
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
17229
|
+
case 0:
|
|
17230
|
+
setLoading(true);
|
|
17231
|
+
_context2.prev = 1;
|
|
17232
|
+
_context2.next = 4;
|
|
17233
|
+
return media.init(allowedTypes);
|
|
17234
|
+
case 4:
|
|
17235
|
+
setFiles([media]);
|
|
17236
|
+
onAdd === null || onAdd === void 0 || onAdd(media);
|
|
17237
|
+
_context2.next = 11;
|
|
17238
|
+
break;
|
|
17239
|
+
case 8:
|
|
17240
|
+
_context2.prev = 8;
|
|
17241
|
+
_context2.t0 = _context2["catch"](1);
|
|
17242
|
+
onError === null || onError === void 0 || onError(_context2.t0);
|
|
17243
|
+
case 11:
|
|
17244
|
+
_context2.prev = 11;
|
|
17245
|
+
setLoading(false);
|
|
17246
|
+
return _context2.finish(11);
|
|
17247
|
+
case 14:
|
|
17248
|
+
case "end":
|
|
17249
|
+
return _context2.stop();
|
|
17250
|
+
}
|
|
17251
|
+
}, _callee2, null, [[1, 8, 11, 14]]);
|
|
17252
|
+
}));
|
|
17253
|
+
return function addMediaItem(_x) {
|
|
17254
|
+
return _ref3.apply(this, arguments);
|
|
17255
|
+
};
|
|
17256
|
+
}();
|
|
17257
|
+
var onRemoveMedia = function onRemoveMedia() {
|
|
17258
|
+
var media = files[0];
|
|
17259
|
+
if (media) {
|
|
17260
|
+
onRemove === null || onRemove === void 0 || onRemove(media);
|
|
17261
|
+
setFiles([]);
|
|
17262
|
+
}
|
|
17263
|
+
};
|
|
17264
|
+
var beforeUpload = function beforeUpload(file) {
|
|
17265
|
+
var mediaItem = new MediaItem(file, config);
|
|
17266
|
+
addMediaItem(mediaItem);
|
|
17267
|
+
return Upload$1.LIST_IGNORE;
|
|
17268
|
+
};
|
|
17269
|
+
var onFileFormWeb = function onFileFormWeb(url) {
|
|
17270
|
+
var mediaItem = new MediaItem(url, config);
|
|
17271
|
+
addMediaItem(mediaItem);
|
|
17272
|
+
};
|
|
17273
|
+
return /*#__PURE__*/jsx(Upload$1, {
|
|
17274
|
+
listType: "picture",
|
|
17275
|
+
maxCount: 1,
|
|
17276
|
+
fileList: fileList,
|
|
17277
|
+
beforeUpload: beforeUpload,
|
|
17278
|
+
onRemove: onRemoveMedia,
|
|
17279
|
+
accept: allowedTypes === null || allowedTypes === void 0 ? void 0 : allowedTypes.join(','),
|
|
17280
|
+
children: /*#__PURE__*/jsxs(Space$1, {
|
|
17281
|
+
direction: "horizontal",
|
|
17282
|
+
children: [/*#__PURE__*/jsx(Button$1, {
|
|
17283
|
+
type: "primary",
|
|
17284
|
+
icon: /*#__PURE__*/jsx(UploadOutlined, {}),
|
|
17285
|
+
loading: loading,
|
|
17286
|
+
children: "Upload"
|
|
17287
|
+
}), /*#__PURE__*/jsx(FileFromWeb, {
|
|
17288
|
+
onEnter: onFileFormWeb
|
|
17289
|
+
})]
|
|
17290
|
+
})
|
|
17291
|
+
});
|
|
17292
|
+
}
|
|
17293
|
+
|
|
17294
|
+
function Media (_ref) {
|
|
17295
|
+
var item = _ref.item,
|
|
17296
|
+
value = _ref.value,
|
|
17297
|
+
state = _ref.state,
|
|
17298
|
+
absoluteName = _ref.absoluteName;
|
|
17299
|
+
var mediaItemRefIdPath = item.mediaItemRefField ? absoluteName.slice(0, -1).concat(item.mediaItemRefField) : undefined;
|
|
17300
|
+
var urlPath = item.urlField ? absoluteName.slice(0, -1).concat(item.urlField) : undefined;
|
|
17301
|
+
var mediaItemRefId = mediaItemRefIdPath ? state.getData(mediaItemRefIdPath, state.data) : undefined;
|
|
17302
|
+
var url = urlPath ? state.getData(urlPath, state.data) : undefined;
|
|
17303
|
+
var _React$useState = React.useState(value ? new MediaItem(url, {
|
|
17304
|
+
baseUrl: state.root.configurationStore.apiConfig.mediaService,
|
|
17305
|
+
jwt: state.root.dataStore.jwt
|
|
17306
|
+
}, value, mediaItemRefId) : undefined),
|
|
17307
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
17308
|
+
media = _React$useState2[0],
|
|
17309
|
+
setMedia = _React$useState2[1];
|
|
17310
|
+
var onAdd = function onAdd(media) {
|
|
17311
|
+
setMedia(media);
|
|
17312
|
+
var newData = state.onInputChanged(absoluteName, media);
|
|
17313
|
+
if (item.urlField) {
|
|
17314
|
+
newData = state.onInputChanged(urlPath, media.url, newData);
|
|
17315
|
+
}
|
|
17316
|
+
if (item.mediaItemRefField) {
|
|
17317
|
+
state.onInputChanged(mediaItemRefIdPath, media.itemRefId, newData);
|
|
17318
|
+
}
|
|
17319
|
+
};
|
|
17320
|
+
var onRemove = function onRemove(media) {
|
|
17321
|
+
setMedia(undefined);
|
|
17322
|
+
var newData = state.onInputChanged(absoluteName, undefined);
|
|
17323
|
+
if (item.urlField) {
|
|
17324
|
+
newData = state.onInputChanged(urlPath, undefined, newData);
|
|
17325
|
+
}
|
|
17326
|
+
if (item.mediaItemRefField) {
|
|
17327
|
+
state.onInputChanged(mediaItemRefIdPath, undefined, newData);
|
|
17328
|
+
}
|
|
17329
|
+
if (media) state.pushRemovedMeidaItem(media);
|
|
17330
|
+
};
|
|
17331
|
+
var onError = function onError(e) {
|
|
17332
|
+
onRemove();
|
|
17333
|
+
};
|
|
17334
|
+
return /*#__PURE__*/jsx(Upload, {
|
|
17335
|
+
allowedTypes: item.allowedTypes,
|
|
17336
|
+
media: media,
|
|
17337
|
+
onAdd: onAdd,
|
|
17338
|
+
onRemove: onRemove,
|
|
17339
|
+
onError: onError,
|
|
17340
|
+
config: {
|
|
17341
|
+
baseUrl: state.root.configurationStore.apiConfig.mediaService,
|
|
17342
|
+
jwt: state.root.dataStore.jwt
|
|
17343
|
+
}
|
|
17344
|
+
});
|
|
17345
|
+
}
|
|
17346
|
+
|
|
16314
17347
|
function _createForOfIteratorHelper$g(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$g(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
16315
17348
|
function _unsupportedIterableToArray$g(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$g(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$g(r, a) : void 0; } }
|
|
16316
17349
|
function _arrayLikeToArray$g(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
16317
17350
|
function ownKeys$A(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16318
17351
|
function _objectSpread$A(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$A(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$A(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16319
|
-
function getElement(item,
|
|
17352
|
+
function getElement(item, setCanSave, state, absoluteName, _onChange, _onError, root, form, hidden, postFixName) {
|
|
16320
17353
|
var _isReadonly, _state$hiddenRequired;
|
|
16321
17354
|
if (hidden) return /*#__PURE__*/jsx(Fragment, {});
|
|
16322
|
-
var
|
|
16323
|
-
var disabled = (_isReadonly = isReadonly(item, data)) !== null && _isReadonly !== void 0 ? _isReadonly : (_state$hiddenRequired = state.hiddenRequiredDisabled[typeof name == 'string' ? name : name.join('.')]) === null || _state$hiddenRequired === void 0 ? void 0 : _state$hiddenRequired.disabled;
|
|
17355
|
+
var disabled = (_isReadonly = isReadonly(item, state.data)) !== null && _isReadonly !== void 0 ? _isReadonly : (_state$hiddenRequired = state.hiddenRequiredDisabled[typeof absoluteName == 'string' ? absoluteName : absoluteName.join('.')]) === null || _state$hiddenRequired === void 0 ? void 0 : _state$hiddenRequired.disabled;
|
|
16324
17356
|
switch (item.type) {
|
|
16325
17357
|
case 'select':
|
|
16326
17358
|
return /*#__PURE__*/jsx(Select, {
|
|
@@ -16340,7 +17372,7 @@ function getElement(item, data, setCanSave, state, _onChange, _onError, root, fo
|
|
|
16340
17372
|
wholeData: state.data,
|
|
16341
17373
|
disabledConfig: item === null || item === void 0 ? void 0 : item['disabledSelection'],
|
|
16342
17374
|
onChange: function onChange(value) {
|
|
16343
|
-
_onChange(
|
|
17375
|
+
_onChange(absoluteName, item.valueField ? value[item.valueField] : value);
|
|
16344
17376
|
},
|
|
16345
17377
|
allowClear: item.allowClear,
|
|
16346
17378
|
placeholder: item.placeholder,
|
|
@@ -16352,7 +17384,7 @@ function getElement(item, data, setCanSave, state, _onChange, _onError, root, fo
|
|
|
16352
17384
|
return /*#__PURE__*/jsx(SimpleSelect, _objectSpread$A(_objectSpread$A({}, item), {}, {
|
|
16353
17385
|
disabled: disabled,
|
|
16354
17386
|
onChange: function onChange(value) {
|
|
16355
|
-
_onChange(
|
|
17387
|
+
_onChange(absoluteName, value);
|
|
16356
17388
|
}
|
|
16357
17389
|
}));
|
|
16358
17390
|
case 'textarea':
|
|
@@ -16365,7 +17397,7 @@ function getElement(item, data, setCanSave, state, _onChange, _onError, root, fo
|
|
|
16365
17397
|
defaultValue: item.value,
|
|
16366
17398
|
placeholder: item.placeholder,
|
|
16367
17399
|
onChange: function onChange(e) {
|
|
16368
|
-
return _onChange === null || _onChange === void 0 ? void 0 : _onChange(
|
|
17400
|
+
return _onChange === null || _onChange === void 0 ? void 0 : _onChange(absoluteName, e.target.value);
|
|
16369
17401
|
}
|
|
16370
17402
|
});
|
|
16371
17403
|
case 'input':
|
|
@@ -16374,7 +17406,7 @@ function getElement(item, data, setCanSave, state, _onChange, _onError, root, fo
|
|
|
16374
17406
|
if (item.syncDataWithUserInput) {
|
|
16375
17407
|
return /*#__PURE__*/jsx(InputComponent$1, {
|
|
16376
17408
|
item: item,
|
|
16377
|
-
data: data,
|
|
17409
|
+
data: state.data,
|
|
16378
17410
|
value: item.value,
|
|
16379
17411
|
onChange: state.onInputChanged
|
|
16380
17412
|
});
|
|
@@ -16403,8 +17435,8 @@ function getElement(item, data, setCanSave, state, _onChange, _onError, root, fo
|
|
|
16403
17435
|
var _root$detailStore$ope, _root$detailStore;
|
|
16404
17436
|
return root === null || root === void 0 || (_root$detailStore$ope = (_root$detailStore = root.detailStore).openLeftDetail) === null || _root$detailStore$ope === void 0 ? void 0 : _root$detailStore$ope.call(_root$detailStore, {
|
|
16405
17437
|
configurationId: item.action.id,
|
|
16406
|
-
data: data,
|
|
16407
|
-
mappingData: data,
|
|
17438
|
+
data: state.data,
|
|
17439
|
+
mappingData: state.data,
|
|
16408
17440
|
callback: function callback(data) {
|
|
16409
17441
|
if (!item.callbackMapping) return;
|
|
16410
17442
|
var _iterator = _createForOfIteratorHelper$g(item.callbackMapping),
|
|
@@ -16436,8 +17468,8 @@ function getElement(item, data, setCanSave, state, _onChange, _onError, root, fo
|
|
|
16436
17468
|
});
|
|
16437
17469
|
case 'richText':
|
|
16438
17470
|
return /*#__PURE__*/jsx(RichTextEditor, {
|
|
16439
|
-
initValue: state.getData(
|
|
16440
|
-
name:
|
|
17471
|
+
initValue: state.getData(absoluteName, state.data),
|
|
17472
|
+
name: absoluteName,
|
|
16441
17473
|
onChange: _onChange
|
|
16442
17474
|
});
|
|
16443
17475
|
case 'number':
|
|
@@ -16455,7 +17487,7 @@ function getElement(item, data, setCanSave, state, _onChange, _onError, root, fo
|
|
|
16455
17487
|
if (value && cbItem !== null && cbItem !== void 0 && cbItem.valueOnEnabled) {
|
|
16456
17488
|
value = root === null || root === void 0 ? void 0 : root.getGlobalValue(cbItem.valueOnEnabled.globalValue);
|
|
16457
17489
|
}
|
|
16458
|
-
_onChange(
|
|
17490
|
+
_onChange(absoluteName, value);
|
|
16459
17491
|
}
|
|
16460
17492
|
});
|
|
16461
17493
|
case 'display':
|
|
@@ -16465,28 +17497,29 @@ function getElement(item, data, setCanSave, state, _onChange, _onError, root, fo
|
|
|
16465
17497
|
case 'array':
|
|
16466
17498
|
return /*#__PURE__*/jsx(FormList$3, {
|
|
16467
17499
|
item: item,
|
|
16468
|
-
data: data,
|
|
16469
17500
|
state: state,
|
|
16470
17501
|
onError: _onError,
|
|
16471
17502
|
root: root,
|
|
16472
17503
|
setCanSave: setCanSave,
|
|
16473
17504
|
form: form,
|
|
16474
|
-
postFixName: postFixName
|
|
17505
|
+
postFixName: postFixName,
|
|
17506
|
+
absoluteName: absoluteName
|
|
16475
17507
|
});
|
|
16476
17508
|
case 'translation':
|
|
16477
17509
|
return /*#__PURE__*/jsx(Translation$1, {
|
|
16478
17510
|
item: item,
|
|
16479
|
-
data: data,
|
|
17511
|
+
data: state.data,
|
|
16480
17512
|
state: state,
|
|
16481
17513
|
onError: _onError,
|
|
16482
17514
|
root: root,
|
|
16483
17515
|
setCanSave: setCanSave,
|
|
16484
|
-
form: form
|
|
17516
|
+
form: form,
|
|
17517
|
+
absoluteName: absoluteName
|
|
16485
17518
|
});
|
|
16486
17519
|
case 'object':
|
|
16487
17520
|
return /*#__PURE__*/jsx(JsonEditor$2, {
|
|
16488
17521
|
setCanSave: setCanSave,
|
|
16489
|
-
data: data,
|
|
17522
|
+
data: state.data,
|
|
16490
17523
|
height: item.height,
|
|
16491
17524
|
savable: true
|
|
16492
17525
|
});
|
|
@@ -16497,7 +17530,7 @@ function getElement(item, data, setCanSave, state, _onChange, _onError, root, fo
|
|
|
16497
17530
|
case 'subTitle':
|
|
16498
17531
|
return /*#__PURE__*/jsx(SubTitle$1, {
|
|
16499
17532
|
item: item,
|
|
16500
|
-
data: data
|
|
17533
|
+
data: state.data
|
|
16501
17534
|
});
|
|
16502
17535
|
case 'apiKey':
|
|
16503
17536
|
return /*#__PURE__*/jsx(ApiKey, {
|
|
@@ -16516,16 +17549,16 @@ function getElement(item, data, setCanSave, state, _onChange, _onError, root, fo
|
|
|
16516
17549
|
if (item.accountName) {
|
|
16517
17550
|
var newData = state.onInputChanged(item.accountName, supplier === null || supplier === void 0 ? void 0 : supplier._id);
|
|
16518
17551
|
if (!supplier) {
|
|
16519
|
-
newData = state.onInputChanged(
|
|
17552
|
+
newData = state.onInputChanged(absoluteName, undefined, newData);
|
|
16520
17553
|
if (item.catalogCodex) state.onInputChanged(item.catalogCodex, undefined, newData);
|
|
16521
17554
|
}
|
|
16522
17555
|
}
|
|
16523
17556
|
},
|
|
16524
|
-
initAccountId: item.accountName ? state.getData(item.accountName, data) : undefined,
|
|
16525
|
-
initCatalogId: state.getData(
|
|
16526
|
-
currentOrganizationId: data._id,
|
|
17557
|
+
initAccountId: item.accountName ? state.getData(item.accountName, state.data) : undefined,
|
|
17558
|
+
initCatalogId: state.getData(absoluteName, state.data),
|
|
17559
|
+
currentOrganizationId: state.data._id,
|
|
16527
17560
|
onSelectedCatalog: function onSelectedCatalog(catalogItem) {
|
|
16528
|
-
var newData = state.onInputChanged(
|
|
17561
|
+
var newData = state.onInputChanged(absoluteName, catalogItem === null || catalogItem === void 0 ? void 0 : catalogItem._id);
|
|
16529
17562
|
if (item.catalogCodex) state.onInputChanged(item.catalogCodex, catalogItem === null || catalogItem === void 0 ? void 0 : catalogItem.codex, newData);
|
|
16530
17563
|
},
|
|
16531
17564
|
onError: function onError(text) {
|
|
@@ -16540,21 +17573,20 @@ function getElement(item, data, setCanSave, state, _onChange, _onError, root, fo
|
|
|
16540
17573
|
options: item.options.map(function (o) {
|
|
16541
17574
|
var _o$disabled;
|
|
16542
17575
|
return _objectSpread$A(_objectSpread$A({}, o), {}, {
|
|
16543
|
-
disabled: (_o$disabled = o.disabled) === null || _o$disabled === void 0 ? void 0 : _o$disabled.call(o, data)
|
|
17576
|
+
disabled: (_o$disabled = o.disabled) === null || _o$disabled === void 0 ? void 0 : _o$disabled.call(o, state.data)
|
|
16544
17577
|
});
|
|
16545
17578
|
}),
|
|
16546
17579
|
buttonStyle: item.buttonStyle,
|
|
16547
17580
|
optionType: item.optionType,
|
|
16548
|
-
defaultValue: item.defaultValue,
|
|
16549
17581
|
onChange: function onChange(_ref) {
|
|
16550
17582
|
var value = _ref.target.value;
|
|
16551
|
-
_onChange(
|
|
17583
|
+
_onChange(absoluteName, value);
|
|
16552
17584
|
}
|
|
16553
17585
|
});
|
|
16554
17586
|
case 'button':
|
|
16555
17587
|
return /*#__PURE__*/jsx(CustomButton$1, {
|
|
16556
17588
|
id: item.buttonId,
|
|
16557
|
-
data: data,
|
|
17589
|
+
data: state.data,
|
|
16558
17590
|
useActionResult: {
|
|
16559
17591
|
styles: true,
|
|
16560
17592
|
message: true
|
|
@@ -16564,6 +17596,13 @@ function getElement(item, data, setCanSave, state, _onChange, _onError, root, fo
|
|
|
16564
17596
|
return form === null || form === void 0 ? void 0 : form.setFieldsValue(_objectSpread$A(_objectSpread$A({}, state.data), data));
|
|
16565
17597
|
}
|
|
16566
17598
|
});
|
|
17599
|
+
case 'media':
|
|
17600
|
+
return /*#__PURE__*/jsx(Media, {
|
|
17601
|
+
item: item,
|
|
17602
|
+
state: state,
|
|
17603
|
+
absoluteName: absoluteName,
|
|
17604
|
+
value: item.value
|
|
17605
|
+
});
|
|
16567
17606
|
default:
|
|
16568
17607
|
return /*#__PURE__*/jsx(Fragment, {});
|
|
16569
17608
|
}
|
|
@@ -16957,11 +17996,11 @@ var FormWrapper$1 = function FormWrapper(_ref, ref) {
|
|
|
16957
17996
|
rules: state.getRules(state.configuration.itemSelector, state.data),
|
|
16958
17997
|
label: state.configuration.itemSelector.label ? t(state.configuration.itemSelector.label, state.configuration.itemSelector.label) : state.configuration.itemSelector.name,
|
|
16959
17998
|
valuePropName: state.configuration.itemSelector.type == 'checkbox' ? 'checked' : 'value',
|
|
16960
|
-
children: getElement(state.configuration.itemSelector,
|
|
17999
|
+
children: getElement(state.configuration.itemSelector, setCanSave, state, state.configuration.itemSelector.name, state.onItemSelectorChanged, onErrorInternal)
|
|
16961
18000
|
}, state.configuration.itemSelector.name.toString()), (_state$selectedItems2 = state.selectedItems) === null || _state$selectedItems2 === void 0 ? void 0 : _state$selectedItems2.map(function (item) {
|
|
16962
18001
|
var _state$hiddenRequired, _state$hiddenRequired2, _state$hiddenRequired3;
|
|
16963
18002
|
return /*#__PURE__*/jsxs("div", {
|
|
16964
|
-
children: [item.marker && /*#__PURE__*/jsx(InfoCircleOutlined, {}), ['subTitle', 'array'].includes(item.type) ? getElement(item,
|
|
18003
|
+
children: [item.marker && /*#__PURE__*/jsx(InfoCircleOutlined, {}), ['subTitle', 'array'].includes(item.type) ? getElement(item, setCanSave, state, item.name, state.onInputChanged, onErrorInternal, undefined, undefined, (_state$hiddenRequired = state.hiddenRequiredDisabled[typeof item.name == 'string' ? item.name : item.name.join('.')]) === null || _state$hiddenRequired === void 0 ? void 0 : _state$hiddenRequired.hidden) : /*#__PURE__*/jsx(Form$1.Item, {
|
|
16965
18004
|
name: item.name,
|
|
16966
18005
|
rules: state.getRules(item, state.data),
|
|
16967
18006
|
label: getLabel(item, t),
|
|
@@ -16971,7 +18010,7 @@ var FormWrapper$1 = function FormWrapper(_ref, ref) {
|
|
|
16971
18010
|
validateStatus: !!state.fieldErrors[item.name.toString()] ? 'error' : undefined,
|
|
16972
18011
|
help: state.fieldErrors[item.name.toString()],
|
|
16973
18012
|
hidden: (_state$hiddenRequired2 = state.hiddenRequiredDisabled[typeof item.name == 'string' ? item.name : item.name.join('.')]) === null || _state$hiddenRequired2 === void 0 ? void 0 : _state$hiddenRequired2.hidden,
|
|
16974
|
-
children: getElement(item,
|
|
18013
|
+
children: getElement(item, setCanSave, state, item.name, state.onInputChanged, onErrorInternal, root, form, (_state$hiddenRequired3 = state.hiddenRequiredDisabled[typeof item.name == 'string' ? item.name : item.name.join('.')]) === null || _state$hiddenRequired3 === void 0 ? void 0 : _state$hiddenRequired3.hidden)
|
|
16975
18014
|
}, Array.isArray(item.name) ? item.name.join('.') : item.name)]
|
|
16976
18015
|
}, item.name.toString());
|
|
16977
18016
|
})]
|
|
@@ -20974,7 +22013,7 @@ var FileUploadWrapper = function FileUploadWrapper(_ref) {
|
|
|
20974
22013
|
setOrganizations = _useState10[1];
|
|
20975
22014
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
20976
22015
|
children: [/*#__PURE__*/jsx(Descriptions, {
|
|
20977
|
-
title:
|
|
22016
|
+
title: t('backoffice.menu.items.label.fileupload')
|
|
20978
22017
|
}), success && /*#__PURE__*/jsx(Alert, {
|
|
20979
22018
|
message: success,
|
|
20980
22019
|
type: "success",
|
|
@@ -21390,7 +22429,7 @@ var MediaUpload = observer(function (_ref) {
|
|
|
21390
22429
|
className: size == 'big' ? big : size == 'small' ? small : medium,
|
|
21391
22430
|
children: /*#__PURE__*/jsx(Spin, {
|
|
21392
22431
|
spinning: loading,
|
|
21393
|
-
children: /*#__PURE__*/jsx(Upload, {
|
|
22432
|
+
children: /*#__PURE__*/jsx(Upload$2, {
|
|
21394
22433
|
name: 'file',
|
|
21395
22434
|
disabled: loading,
|
|
21396
22435
|
maxCount: 1,
|
|
@@ -22897,6 +23936,7 @@ function DeleteButton(_ref2) {
|
|
|
22897
23936
|
});
|
|
22898
23937
|
}
|
|
22899
23938
|
function CopyButton(_ref3) {
|
|
23939
|
+
var _state$configuration$25;
|
|
22900
23940
|
var state = _ref3.state;
|
|
22901
23941
|
var root = useStore();
|
|
22902
23942
|
var apiHandler = new _default$d({
|
|
@@ -23018,7 +24058,7 @@ function CopyButton(_ref3) {
|
|
|
23018
24058
|
return /*#__PURE__*/jsx(Button, {
|
|
23019
24059
|
type: "primary",
|
|
23020
24060
|
onClick: onCopy,
|
|
23021
|
-
disabled: state.selected.length == 0,
|
|
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),
|
|
23022
24062
|
children: t('backoffice.basetable.copy')
|
|
23023
24063
|
});
|
|
23024
24064
|
}
|
|
@@ -24281,19 +25321,22 @@ function CatalogTable (props) {
|
|
|
24281
25321
|
fontSize: 20
|
|
24282
25322
|
},
|
|
24283
25323
|
children: state.title
|
|
24284
|
-
}), /*#__PURE__*/
|
|
25324
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
24285
25325
|
style: {
|
|
24286
|
-
|
|
25326
|
+
display: 'flex',
|
|
25327
|
+
justifyContent: 'space-between'
|
|
24287
25328
|
},
|
|
24288
|
-
children: /*#__PURE__*/jsx(
|
|
24289
|
-
|
|
24290
|
-
|
|
24291
|
-
|
|
24292
|
-
})
|
|
24293
|
-
|
|
24294
|
-
|
|
24295
|
-
|
|
24296
|
-
|
|
25329
|
+
children: [/*#__PURE__*/jsx(TranslationTabs, {
|
|
25330
|
+
filterContex: state.filterContex,
|
|
25331
|
+
setFilterContext: state.setFilterContext,
|
|
25332
|
+
tabs: state.configuration.tabs
|
|
25333
|
+
}), /*#__PURE__*/jsx("div", {
|
|
25334
|
+
children: /*#__PURE__*/jsx(SelectClientRelationCatalog, {
|
|
25335
|
+
onSelectedCatalog: state.onSelectedCatalog,
|
|
25336
|
+
onLoadingCatalog: state.setLoading,
|
|
25337
|
+
dontLoadCatalogData: true
|
|
25338
|
+
})
|
|
25339
|
+
})]
|
|
24297
25340
|
}), /*#__PURE__*/jsx(BaseTable, {
|
|
24298
25341
|
state: state
|
|
24299
25342
|
})]
|
|
@@ -27035,7 +28078,7 @@ function DragDropUpload(_ref) {
|
|
|
27035
28078
|
startImport = _ref.startImport;
|
|
27036
28079
|
var _useTranslation = useTranslation(),
|
|
27037
28080
|
t = _useTranslation.t;
|
|
27038
|
-
var Dragger = Upload.Dragger;
|
|
28081
|
+
var Dragger = Upload$2.Dragger;
|
|
27039
28082
|
var _useState = useState(''),
|
|
27040
28083
|
_useState2 = _slicedToArray(_useState, 2),
|
|
27041
28084
|
fileName = _useState2[0],
|
|
@@ -30437,7 +31480,7 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
30437
31480
|
}
|
|
30438
31481
|
},
|
|
30439
31482
|
children: t.name
|
|
30440
|
-
});
|
|
31483
|
+
}, t.id);
|
|
30441
31484
|
})
|
|
30442
31485
|
})]
|
|
30443
31486
|
});
|