@crystaldesign/diva-backoffice 24.10.0-beta.2 → 24.10.0-beta.20
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 +1423 -1318
- package/build/types/backoffice/src/layout/Toolbar/Tools/WYSIWYG/useWysiwyg.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/FileUploadBeta/index.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/FilterBox/index.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/Form/Fields/FormList/index.d.ts +37 -0
- package/build/types/backoffice/src/ui/Form/Fields/FormList/index.d.ts.map +1 -0
- package/build/types/backoffice/src/ui/Form/Presets/index.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/Form/elements.d.ts +7 -0
- package/build/types/backoffice/src/ui/Form/elements.d.ts.map +1 -0
- package/build/types/backoffice/src/ui/Form/index.d.ts +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 +2 -1
- package/build/types/backoffice/src/ui/Form/types.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/Form/useFormData.d.ts +2 -0
- package/build/types/backoffice/src/ui/Form/useFormData.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/Select/index.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/Table/BaseTable/cellRenderer/TextCell/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 {
|
|
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, Space, Cascader, Descriptions, Row, Col, Tooltip as Tooltip$1, Collapse, List as List$1, Skeleton, Alert, Card, Upload, Switch, Table as Table$1, Popconfirm, Tabs, Image, Progress, 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, useDivaCore, useTranslation as useTranslation$1, DivaUtils } from '@crystaldesign/diva-core';
|
|
@@ -65,14 +65,14 @@ 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 debounce from 'lodash/debounce';
|
|
69
|
-
import { isArray } from 'lodash';
|
|
70
68
|
import DeleteOutlined from '@ant-design/icons/DeleteOutlined';
|
|
71
69
|
import JSONEditor from 'jsoneditor';
|
|
72
70
|
import 'jsoneditor/dist/jsoneditor.css';
|
|
73
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
74
71
|
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';
|
|
72
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
75
73
|
import { Editor } from '@tinymce/tinymce-react';
|
|
74
|
+
import debounce from 'lodash/debounce';
|
|
75
|
+
import { isArray } from 'lodash';
|
|
76
76
|
import { stringify } from 'csv';
|
|
77
77
|
import InfiniteScroll from 'react-infinite-scroll-component';
|
|
78
78
|
import SearchOutlined from '@ant-design/icons/SearchOutlined';
|
|
@@ -4512,6 +4512,10 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
4512
4512
|
type: 'unixTimeStamp',
|
|
4513
4513
|
sorter: 8,
|
|
4514
4514
|
width: 150
|
|
4515
|
+
}, {
|
|
4516
|
+
title: 'variants',
|
|
4517
|
+
field: 'variants',
|
|
4518
|
+
hidden: true
|
|
4515
4519
|
}],
|
|
4516
4520
|
apiInterface: {
|
|
4517
4521
|
read: {
|
|
@@ -4521,6 +4525,12 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
4521
4525
|
"delete": '${mediaService}/rooms/${id}'
|
|
4522
4526
|
},
|
|
4523
4527
|
rowAction: [{
|
|
4528
|
+
actionType: 'Detail',
|
|
4529
|
+
type: 'Form',
|
|
4530
|
+
id: 'FormRoom',
|
|
4531
|
+
title: t('backoffice.table.rooms.rowAction.editRoom'),
|
|
4532
|
+
label: t('backoffice.table.rooms.rowAction.editRoom')
|
|
4533
|
+
}, {
|
|
4524
4534
|
actionType: 'Detail',
|
|
4525
4535
|
type: 'Form',
|
|
4526
4536
|
id: 'FormMergeRoom',
|
|
@@ -4538,6 +4548,12 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
4538
4548
|
id: 'RoomVariantList',
|
|
4539
4549
|
title: t('backoffice.table.apikeys.rowAction.showRoomVariants'),
|
|
4540
4550
|
label: t('backoffice.table.apikeys.rowAction.showRoomVariants')
|
|
4551
|
+
}, {
|
|
4552
|
+
actionType: 'Detail',
|
|
4553
|
+
type: 'Form',
|
|
4554
|
+
id: 'FormRoomViewpoints',
|
|
4555
|
+
title: t('backoffice.table.rooms.rowAction.viewpoints'),
|
|
4556
|
+
label: t('backoffice.table.rooms.rowAction.viewpoints')
|
|
4541
4557
|
}]
|
|
4542
4558
|
},
|
|
4543
4559
|
TableRenderjobs: {
|
|
@@ -4622,13 +4638,6 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
4622
4638
|
width: 200,
|
|
4623
4639
|
translationPrefix: 'renderjob.state',
|
|
4624
4640
|
type: 'string'
|
|
4625
|
-
}, {
|
|
4626
|
-
title: t('backoffice.table.renderjobs.columns.cachedRefs'),
|
|
4627
|
-
field: 'cachedRefs',
|
|
4628
|
-
type: 'boolean',
|
|
4629
|
-
sorter: 2,
|
|
4630
|
-
width: 100,
|
|
4631
|
-
align: 'center'
|
|
4632
4641
|
}, {
|
|
4633
4642
|
title: t('backoffice.table.renderjobs.columns.priority'),
|
|
4634
4643
|
sorter: 2,
|
|
@@ -4903,46 +4912,6 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
4903
4912
|
setType: 'addToSourceValue'
|
|
4904
4913
|
}]
|
|
4905
4914
|
}
|
|
4906
|
-
}, {
|
|
4907
|
-
actionType: 'Modal',
|
|
4908
|
-
id: 'CacheModal',
|
|
4909
|
-
title: t('backoffice.table.renderjobs.bulkActions.CacheModal.title'),
|
|
4910
|
-
label: t('backoffice.table.renderjobs.bulkActions.CacheModal.title'),
|
|
4911
|
-
rule: [{
|
|
4912
|
-
match: {
|
|
4913
|
-
sourceField: 'state',
|
|
4914
|
-
value: 12
|
|
4915
|
-
}
|
|
4916
|
-
}, {
|
|
4917
|
-
match: {
|
|
4918
|
-
sourceField: 'cachedRefs',
|
|
4919
|
-
value: []
|
|
4920
|
-
}
|
|
4921
|
-
}],
|
|
4922
|
-
errorText: t('backoffice.table.renderjobs.bulkActions.CacheModal.errorText'),
|
|
4923
|
-
apiInterface: {
|
|
4924
|
-
create: '${mediaService}/renderjobs/{_id}/cache'
|
|
4925
|
-
}
|
|
4926
|
-
}, {
|
|
4927
|
-
actionType: 'Modal',
|
|
4928
|
-
id: 'ClearCacheModal',
|
|
4929
|
-
title: t('backoffice.table.renderjobs.bulkActions.ClearCacheModal.title'),
|
|
4930
|
-
label: t('backoffice.table.renderjobs.bulkActions.ClearCacheModal.label'),
|
|
4931
|
-
rule: [{
|
|
4932
|
-
match: {
|
|
4933
|
-
sourceField: 'state',
|
|
4934
|
-
value: 12
|
|
4935
|
-
}
|
|
4936
|
-
}, {
|
|
4937
|
-
match: {
|
|
4938
|
-
sourceField: 'cachedRefs',
|
|
4939
|
-
value: '$length'
|
|
4940
|
-
}
|
|
4941
|
-
}],
|
|
4942
|
-
errorText: t('backoffice.table.renderjobs.bulkActions.ClearCacheModal.errorText'),
|
|
4943
|
-
apiInterface: {
|
|
4944
|
-
"delete": '${mediaService}/renderjobs/${id}/cache'
|
|
4945
|
-
}
|
|
4946
4915
|
}],
|
|
4947
4916
|
deselectOnUpdate: false,
|
|
4948
4917
|
copyAction: {
|
|
@@ -5032,6 +5001,12 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
5032
5001
|
field: '_id',
|
|
5033
5002
|
sorter: 1,
|
|
5034
5003
|
filter: 'advanced'
|
|
5004
|
+
}, {
|
|
5005
|
+
title: t('backoffice.table.renderpackages.columns.position'),
|
|
5006
|
+
field: 'position',
|
|
5007
|
+
sorter: 3,
|
|
5008
|
+
filter: 'advanced',
|
|
5009
|
+
width: 100
|
|
5035
5010
|
}, {
|
|
5036
5011
|
title: t('backoffice.table.renderpackages.columns.name'),
|
|
5037
5012
|
field: 'name',
|
|
@@ -7738,6 +7713,11 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
7738
7713
|
label: t('backoffice.form.createorupdaterenderpackages.items.category'),
|
|
7739
7714
|
type: 'input',
|
|
7740
7715
|
required: true
|
|
7716
|
+
}, {
|
|
7717
|
+
name: 'position',
|
|
7718
|
+
label: t('backoffice.form.createorupdaterenderpackages.items.position'),
|
|
7719
|
+
type: 'number',
|
|
7720
|
+
required: false
|
|
7741
7721
|
}, {
|
|
7742
7722
|
type: 'subTitle',
|
|
7743
7723
|
name: 'Presets'
|
|
@@ -7975,6 +7955,13 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
7975
7955
|
label: t('backoffice.form.renderjob.items.productName'),
|
|
7976
7956
|
type: 'input',
|
|
7977
7957
|
readonly: true
|
|
7958
|
+
}, {
|
|
7959
|
+
name: 'functionType',
|
|
7960
|
+
label: t('backoffice.form.renderjob.items.functionType'),
|
|
7961
|
+
type: 'select',
|
|
7962
|
+
mode: 'single',
|
|
7963
|
+
allowClear: true,
|
|
7964
|
+
values: ['PROD', 'PROD_SEC', 'PROD_CLOSE', 'PROD_MILIEU', 'SHO', 'CONFIG_INFO', 'AR_INFO', 'PROD_DETAIL', 'CAT', 'PLN', 'LOG', 'FUNC', 'COMMERCIAL', 'TPL', 'ASI', 'PLT', 'CAI', 'BAN', 'INF', 'OTH', 'ART', 'OPV']
|
|
7978
7965
|
}, {
|
|
7979
7966
|
name: 'priority',
|
|
7980
7967
|
label: t('backoffice.form.renderjob.items.priority'),
|
|
@@ -8223,6 +8210,13 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
8223
8210
|
label: t('backoffice.form.renderjob.items.productName'),
|
|
8224
8211
|
type: 'input',
|
|
8225
8212
|
readonly: true
|
|
8213
|
+
}, {
|
|
8214
|
+
name: 'functionType',
|
|
8215
|
+
label: t('backoffice.form.renderjob.items.functionType'),
|
|
8216
|
+
type: 'select',
|
|
8217
|
+
mode: 'single',
|
|
8218
|
+
allowClear: true,
|
|
8219
|
+
values: ['PROD', 'PROD_SEC', 'PROD_CLOSE', 'PROD_MILIEU', 'SHO', 'CONFIG_INFO', 'AR_INFO', 'PROD_DETAIL', 'CAT', 'PLN', 'LOG', 'FUNC', 'COMMERCIAL', 'TPL', 'ASI', 'PLT', 'CAI', 'BAN', 'INF', 'OTH', 'ART', 'OPV']
|
|
8226
8220
|
}, {
|
|
8227
8221
|
name: 'priority',
|
|
8228
8222
|
label: t('backoffice.form.renderjob.items.priority'),
|
|
@@ -8375,6 +8369,13 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
8375
8369
|
label: t('backoffice.form.renderjob.items.productName'),
|
|
8376
8370
|
type: 'input',
|
|
8377
8371
|
readonly: true
|
|
8372
|
+
}, {
|
|
8373
|
+
name: 'functionType',
|
|
8374
|
+
label: t('backoffice.form.renderjob.items.functionType'),
|
|
8375
|
+
type: 'select',
|
|
8376
|
+
mode: 'single',
|
|
8377
|
+
allowClear: true,
|
|
8378
|
+
values: ['PROD', 'PROD_SEC', 'PROD_CLOSE', 'PROD_MILIEU', 'SHO', 'CONFIG_INFO', 'AR_INFO', 'PROD_DETAIL', 'CAT', 'PLN', 'LOG', 'FUNC', 'COMMERCIAL', 'TPL', 'ASI', 'PLT', 'CAI', 'BAN', 'INF', 'OTH', 'ART', 'OPV']
|
|
8378
8379
|
}, {
|
|
8379
8380
|
name: 'priority',
|
|
8380
8381
|
label: t('backoffice.form.renderjob.items.priority'),
|
|
@@ -9270,6 +9271,95 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
9270
9271
|
type: 'input'
|
|
9271
9272
|
}]
|
|
9272
9273
|
},
|
|
9274
|
+
FormRoom: {
|
|
9275
|
+
type: 'Form',
|
|
9276
|
+
title: 'Renderjob',
|
|
9277
|
+
apiInterface: {
|
|
9278
|
+
update: {
|
|
9279
|
+
url: '${mediaService}/rooms/{_id}/',
|
|
9280
|
+
method: 'PATCH',
|
|
9281
|
+
jsonPatch: true
|
|
9282
|
+
}
|
|
9283
|
+
},
|
|
9284
|
+
items: [{
|
|
9285
|
+
name: '_id',
|
|
9286
|
+
label: 'ID',
|
|
9287
|
+
type: 'input',
|
|
9288
|
+
readonly: true
|
|
9289
|
+
}, {
|
|
9290
|
+
name: 'blenderVersion',
|
|
9291
|
+
label: 'Blender Version',
|
|
9292
|
+
type: 'input',
|
|
9293
|
+
readonly: true
|
|
9294
|
+
}, {
|
|
9295
|
+
name: 'mainCategory',
|
|
9296
|
+
label: 'Haupt Kategorie',
|
|
9297
|
+
type: 'input'
|
|
9298
|
+
}, {
|
|
9299
|
+
name: 'name',
|
|
9300
|
+
label: 'Name',
|
|
9301
|
+
type: 'input'
|
|
9302
|
+
}, {
|
|
9303
|
+
name: 'variants',
|
|
9304
|
+
label: 'variants',
|
|
9305
|
+
value: 'variants',
|
|
9306
|
+
type: 'array',
|
|
9307
|
+
disablePushOrPop: true,
|
|
9308
|
+
items: [{
|
|
9309
|
+
type: 'subTitle',
|
|
9310
|
+
name: 'Variante'
|
|
9311
|
+
}, {
|
|
9312
|
+
type: 'input',
|
|
9313
|
+
name: 'name'
|
|
9314
|
+
}, {
|
|
9315
|
+
type: 'input',
|
|
9316
|
+
name: 'description'
|
|
9317
|
+
}, {
|
|
9318
|
+
type: 'select',
|
|
9319
|
+
name: 'compatibleColors',
|
|
9320
|
+
mode: 'multiple',
|
|
9321
|
+
allowClear: true,
|
|
9322
|
+
values: ['black', 'silver', 'gray', 'white', 'maroon', 'red', 'purple', 'fuchsia', 'green', 'lime', 'olive', 'yellow', 'navy', 'blue', 'teal', 'aqua']
|
|
9323
|
+
}, {
|
|
9324
|
+
type: 'checkbox',
|
|
9325
|
+
name: 'default',
|
|
9326
|
+
readonly: true
|
|
9327
|
+
}, {
|
|
9328
|
+
type: 'input',
|
|
9329
|
+
name: 'sceneName'
|
|
9330
|
+
}, {
|
|
9331
|
+
type: 'select',
|
|
9332
|
+
name: 'style',
|
|
9333
|
+
mode: 'multiple',
|
|
9334
|
+
allowCreate: true
|
|
9335
|
+
}]
|
|
9336
|
+
}]
|
|
9337
|
+
},
|
|
9338
|
+
FormRoomViewpoints: {
|
|
9339
|
+
type: 'Form',
|
|
9340
|
+
title: 'Renderjob',
|
|
9341
|
+
items: [{
|
|
9342
|
+
name: 'variants',
|
|
9343
|
+
label: 'variants',
|
|
9344
|
+
value: 'variants',
|
|
9345
|
+
type: 'array',
|
|
9346
|
+
disablePushOrPop: true,
|
|
9347
|
+
items: [{
|
|
9348
|
+
type: 'input',
|
|
9349
|
+
name: 'name',
|
|
9350
|
+
readonly: true
|
|
9351
|
+
}, {
|
|
9352
|
+
type: 'array',
|
|
9353
|
+
name: 'viewpoints',
|
|
9354
|
+
items: [{
|
|
9355
|
+
type: 'input',
|
|
9356
|
+
name: 'name',
|
|
9357
|
+
readonly: true
|
|
9358
|
+
}],
|
|
9359
|
+
disablePushOrPop: true
|
|
9360
|
+
}]
|
|
9361
|
+
}]
|
|
9362
|
+
},
|
|
9273
9363
|
OrgTree: {
|
|
9274
9364
|
type: 'OrgTree',
|
|
9275
9365
|
expandAll: true,
|
|
@@ -13345,6 +13435,28 @@ function useFormData (_ref) {
|
|
|
13345
13435
|
}));
|
|
13346
13436
|
return _setDynamicFields.apply(this, arguments);
|
|
13347
13437
|
}
|
|
13438
|
+
function getRules(item, data) {
|
|
13439
|
+
var _item$rules;
|
|
13440
|
+
var rules = [];
|
|
13441
|
+
if (item.required != undefined) {
|
|
13442
|
+
var _hiddenRequiredDisabl;
|
|
13443
|
+
rules.push({
|
|
13444
|
+
required: (_hiddenRequiredDisabl = hiddenRequiredDisabled[typeof item.name == 'string' ? item.name : item.name.join('.')]) === null || _hiddenRequiredDisabl === void 0 ? void 0 : _hiddenRequiredDisabl.required
|
|
13445
|
+
});
|
|
13446
|
+
}
|
|
13447
|
+
if (((_item$rules = item.rules) === null || _item$rules === void 0 ? void 0 : _item$rules.type) == 'condition') {
|
|
13448
|
+
var condition = item.rules;
|
|
13449
|
+
var flatData = flatten(data);
|
|
13450
|
+
if (!condition.match.op && flatData[condition.match.field] == condition.match.value) {
|
|
13451
|
+
rules.push.apply(rules, _toConsumableArray(condition.rules));
|
|
13452
|
+
} else if (condition.match.op == 'gt' && flatData[condition.match.field] > condition.match.value) {
|
|
13453
|
+
rules.push.apply(rules, _toConsumableArray(condition.rules));
|
|
13454
|
+
}
|
|
13455
|
+
} else if (item.rules) {
|
|
13456
|
+
rules.push.apply(rules, _toConsumableArray(item.rules));
|
|
13457
|
+
}
|
|
13458
|
+
return rules;
|
|
13459
|
+
}
|
|
13348
13460
|
return _objectSpread$E(_objectSpread$E({}, state), {}, {
|
|
13349
13461
|
setUsedPreset: setUsedPreset,
|
|
13350
13462
|
configuration: configuration,
|
|
@@ -13363,7 +13475,8 @@ function useFormData (_ref) {
|
|
|
13363
13475
|
fieldErrors: fieldErrors,
|
|
13364
13476
|
hiddenRequiredDisabled: hiddenRequiredDisabled,
|
|
13365
13477
|
getData: getData,
|
|
13366
|
-
updateHiddenRequiredDisabled: updateHiddenRequiredDisabled
|
|
13478
|
+
updateHiddenRequiredDisabled: updateHiddenRequiredDisabled,
|
|
13479
|
+
getRules: getRules
|
|
13367
13480
|
});
|
|
13368
13481
|
}
|
|
13369
13482
|
function setFieldInObject(id, data, value) {
|
|
@@ -13403,730 +13516,139 @@ function getData(id, data) {
|
|
|
13403
13516
|
}
|
|
13404
13517
|
}
|
|
13405
13518
|
|
|
13406
|
-
|
|
13407
|
-
|
|
13408
|
-
|
|
13409
|
-
|
|
13410
|
-
|
|
13411
|
-
|
|
13412
|
-
|
|
13413
|
-
var
|
|
13414
|
-
var
|
|
13415
|
-
|
|
13416
|
-
|
|
13417
|
-
|
|
13418
|
-
|
|
13419
|
-
|
|
13420
|
-
|
|
13519
|
+
var JsonEditor$2 = function JsonEditor(_ref) {
|
|
13520
|
+
var value = _ref.value,
|
|
13521
|
+
_onChange = _ref.onChange,
|
|
13522
|
+
setCanSave = _ref.setCanSave,
|
|
13523
|
+
data = _ref.data,
|
|
13524
|
+
height = _ref.height,
|
|
13525
|
+
savable = _ref.savable;
|
|
13526
|
+
var container = useRef(null);
|
|
13527
|
+
var _useState = useState(0),
|
|
13528
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13529
|
+
counter = _useState2[0],
|
|
13530
|
+
setCounter = _useState2[1];
|
|
13531
|
+
var jsonEditor = useRef(null);
|
|
13532
|
+
var options = {
|
|
13533
|
+
mode: 'code',
|
|
13534
|
+
onChange: function onChange() {
|
|
13535
|
+
try {
|
|
13536
|
+
var e = jsonEditor.current.get();
|
|
13537
|
+
jsonEditor.current.validate();
|
|
13538
|
+
_onChange === null || _onChange === void 0 || _onChange(e);
|
|
13539
|
+
setCanSave(savable);
|
|
13540
|
+
} catch (_unused) {
|
|
13541
|
+
setCanSave(false);
|
|
13542
|
+
return;
|
|
13543
|
+
}
|
|
13421
13544
|
}
|
|
13422
|
-
}
|
|
13423
|
-
|
|
13424
|
-
|
|
13425
|
-
|
|
13426
|
-
|
|
13427
|
-
|
|
13428
|
-
|
|
13545
|
+
};
|
|
13546
|
+
useEffect(function () {
|
|
13547
|
+
jsonEditor.current = new JSONEditor(container.current, options);
|
|
13548
|
+
}, []);
|
|
13549
|
+
useEffect(function () {
|
|
13550
|
+
setCanSave(savable);
|
|
13551
|
+
// antd sets value after initiating once as undefined, the jsoneditor should only be set once with the initial value that gets set by antd
|
|
13552
|
+
if (counter == 2) {
|
|
13553
|
+
return;
|
|
13554
|
+
}
|
|
13555
|
+
if (!value) {
|
|
13556
|
+
jsonEditor.current.set(data !== null && data !== void 0 ? data : {});
|
|
13557
|
+
} else {
|
|
13558
|
+
jsonEditor.current.set(value);
|
|
13559
|
+
}
|
|
13560
|
+
setCounter(counter + 1);
|
|
13561
|
+
}, [value]);
|
|
13562
|
+
return /*#__PURE__*/jsx("div", {
|
|
13563
|
+
ref: container,
|
|
13564
|
+
id: "jsoneditor",
|
|
13565
|
+
style: {
|
|
13566
|
+
height: height !== null && height !== void 0 ? height : 600
|
|
13567
|
+
}
|
|
13568
|
+
});
|
|
13569
|
+
};
|
|
13429
13570
|
|
|
13430
|
-
|
|
13431
|
-
|
|
13432
|
-
|
|
13433
|
-
|
|
13434
|
-
|
|
13435
|
-
|
|
13436
|
-
|
|
13437
|
-
onChange = _ref.onChange,
|
|
13571
|
+
var FormList$2 = function FormList(_ref) {
|
|
13572
|
+
var _item$initialValue;
|
|
13573
|
+
var value = _ref.value,
|
|
13574
|
+
item = _ref.item,
|
|
13575
|
+
state = _ref.state,
|
|
13576
|
+
data = _ref.data,
|
|
13577
|
+
setCanSave = _ref.setCanSave,
|
|
13438
13578
|
onError = _ref.onError,
|
|
13439
|
-
|
|
13440
|
-
|
|
13441
|
-
|
|
13442
|
-
mode = _ref.mode,
|
|
13443
|
-
allowCreate = _ref.allowCreate,
|
|
13444
|
-
flow = _ref.flow,
|
|
13445
|
-
translationPrefix = _ref.translationPrefix,
|
|
13446
|
-
values = _ref.values,
|
|
13447
|
-
wholeData = _ref.wholeData,
|
|
13448
|
-
disabledConfig = _ref.disabledConfig,
|
|
13449
|
-
hardOptions = _ref.hardOptions,
|
|
13450
|
-
_ref$applyDefaultValu = _ref.applyDefaultValue,
|
|
13451
|
-
applyDefaultValue = _ref$applyDefaultValu === void 0 ? true : _ref$applyDefaultValu,
|
|
13452
|
-
defaultValue = _ref.defaultValue,
|
|
13453
|
-
useFirstValueAsDefault = _ref.useFirstValueAsDefault,
|
|
13454
|
-
canSetToUndefined = _ref.canSetToUndefined;
|
|
13455
|
-
var root = useStore();
|
|
13456
|
-
var _useTranslation = useTranslation$1(),
|
|
13579
|
+
form = _ref.form,
|
|
13580
|
+
root = _ref.root;
|
|
13581
|
+
var _useTranslation = useTranslation(),
|
|
13457
13582
|
t = _useTranslation.t;
|
|
13458
|
-
|
|
13459
|
-
|
|
13460
|
-
|
|
13461
|
-
|
|
13462
|
-
|
|
13463
|
-
|
|
13464
|
-
|
|
13465
|
-
|
|
13466
|
-
|
|
13467
|
-
|
|
13468
|
-
|
|
13469
|
-
|
|
13470
|
-
|
|
13471
|
-
|
|
13472
|
-
|
|
13473
|
-
|
|
13474
|
-
|
|
13475
|
-
|
|
13476
|
-
|
|
13477
|
-
|
|
13478
|
-
|
|
13479
|
-
|
|
13480
|
-
|
|
13481
|
-
|
|
13482
|
-
|
|
13483
|
-
|
|
13484
|
-
|
|
13485
|
-
|
|
13486
|
-
|
|
13487
|
-
|
|
13488
|
-
|
|
13489
|
-
|
|
13490
|
-
|
|
13491
|
-
|
|
13492
|
-
|
|
13493
|
-
|
|
13494
|
-
|
|
13495
|
-
|
|
13496
|
-
|
|
13497
|
-
|
|
13498
|
-
|
|
13499
|
-
|
|
13500
|
-
|
|
13501
|
-
|
|
13502
|
-
|
|
13503
|
-
|
|
13504
|
-
|
|
13505
|
-
|
|
13506
|
-
|
|
13507
|
-
|
|
13508
|
-
|
|
13509
|
-
|
|
13510
|
-
|
|
13511
|
-
|
|
13512
|
-
|
|
13513
|
-
|
|
13514
|
-
|
|
13515
|
-
|
|
13516
|
-
|
|
13517
|
-
|
|
13518
|
-
|
|
13519
|
-
|
|
13520
|
-
|
|
13521
|
-
setOptions(_toConsumableArray(hardOptions.map(function (v) {
|
|
13522
|
-
return {
|
|
13523
|
-
label: v.lable,
|
|
13524
|
-
value: v.value,
|
|
13525
|
-
data: v.data,
|
|
13526
|
-
disabled: v.disabled
|
|
13527
|
-
};
|
|
13528
|
-
})));
|
|
13529
|
-
}
|
|
13530
|
-
}, [wholeData]);
|
|
13531
|
-
useEffect(function () {
|
|
13532
|
-
if (!canSetToUndefined && (selected == undefined || selected.length == 0)) {
|
|
13533
|
-
doSetOptions();
|
|
13534
|
-
}
|
|
13535
|
-
}, [data]);
|
|
13536
|
-
useEffect(function () {
|
|
13537
|
-
if (!(selected !== null && selected !== void 0 && selected.length) && defaultValue && applyDefaultValue !== false) {
|
|
13538
|
-
setSelected([defaultValue]);
|
|
13539
|
-
}
|
|
13540
|
-
}, [defaultValue]);
|
|
13541
|
-
function doSetOptions() {
|
|
13542
|
-
var newData = data !== null && data !== void 0 ? data : defaultValue;
|
|
13543
|
-
if (newData != undefined && (!Array.isArray(newData) || newData.length != 0)) {
|
|
13544
|
-
if (initalValue == undefined) {
|
|
13545
|
-
setInitValue(newData);
|
|
13546
|
-
}
|
|
13547
|
-
var initData = isArray(newData) ? newData : [newData];
|
|
13548
|
-
var value = initData.map(function (d) {
|
|
13549
|
-
var _d$data, _d$_id, _d$selectMapping$valu, _d$data2, _ref2, _d$value, _d$data3;
|
|
13550
|
-
return {
|
|
13551
|
-
label: selectMapping !== null && selectMapping !== void 0 && selectMapping.label ? getCombinedValues((_d$data = d === null || d === void 0 ? void 0 : d.data) !== null && _d$data !== void 0 ? _d$data : d, selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.label) : _typeof(d) == 'object' ? (_d$_id = d._id) !== null && _d$_id !== void 0 ? _d$_id : d.label : translationPrefix ? t(translationPrefix + '.' + d) : d,
|
|
13552
|
-
value: selectMapping !== null && selectMapping !== void 0 && selectMapping.value ? (_d$selectMapping$valu = d === null || d === void 0 ? void 0 : d[selectMapping.value]) !== null && _d$selectMapping$valu !== void 0 ? _d$selectMapping$valu : d === null || d === void 0 || (_d$data2 = d.data) === null || _d$data2 === void 0 ? void 0 : _d$data2[selectMapping.value] : _typeof(d) == 'object' ? (_ref2 = (_d$value = d === null || d === void 0 ? void 0 : d.value) !== null && _d$value !== void 0 ? _d$value : d === null || d === void 0 || (_d$data3 = d.data) === null || _d$data3 === void 0 ? void 0 : _d$data3.value) !== null && _ref2 !== void 0 ? _ref2 : d === null || d === void 0 ? void 0 : d._id : d,
|
|
13553
|
-
data: d,
|
|
13554
|
-
disabled: false
|
|
13555
|
-
};
|
|
13556
|
-
});
|
|
13557
|
-
var val = value.length == 1 ? value[0].data : value;
|
|
13558
|
-
if (Array.isArray(val) && val.length) {
|
|
13559
|
-
val = val.map(function (v) {
|
|
13560
|
-
return v.data;
|
|
13561
|
-
});
|
|
13562
|
-
} else if (Array.isArray(val)) {
|
|
13563
|
-
val = initData;
|
|
13564
|
-
}
|
|
13565
|
-
if (flow && initData.length) {
|
|
13566
|
-
var _value$, _flow$value$0$value, _value$2;
|
|
13567
|
-
if (mode != 'single') {
|
|
13568
|
-
throw new Error('Flow is only implemented for single mode');
|
|
13569
|
-
}
|
|
13570
|
-
var missingFields = verifySelection((_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.value);
|
|
13571
|
-
if (missingFields.length) {
|
|
13572
|
-
onError === null || onError === void 0 || onError((missingFields === null || missingFields === void 0 ? void 0 : missingFields.join(', ')) + ' not set or wrong value');
|
|
13573
|
-
return;
|
|
13574
|
-
} else {
|
|
13575
|
-
onError === null || onError === void 0 || onError('');
|
|
13576
|
-
}
|
|
13577
|
-
var flowData = (flow === null || flow === void 0 || (_flow$value$0$value = flow[(_value$2 = value[0]) === null || _value$2 === void 0 ? void 0 : _value$2.value]) === null || _flow$value$0$value === void 0 ? void 0 : _flow$value$0$value.map(function (opt) {
|
|
13578
|
-
return {
|
|
13579
|
-
label: translationPrefix ? t(translationPrefix + '.' + opt) : opt.toString(),
|
|
13580
|
-
value: opt,
|
|
13581
|
-
data: opt
|
|
13582
|
-
};
|
|
13583
|
-
})) || [];
|
|
13584
|
-
var _defaultValue = initalValue !== null && initalValue !== void 0 ? initalValue : data;
|
|
13585
|
-
if (!flowData.find(function (fd) {
|
|
13586
|
-
return fd.value == _defaultValue;
|
|
13587
|
-
})) {
|
|
13588
|
-
flowData.push({
|
|
13589
|
-
label: translationPrefix ? t(translationPrefix + '.' + _defaultValue) : _defaultValue.toString(),
|
|
13590
|
-
value: _defaultValue,
|
|
13591
|
-
data: _defaultValue
|
|
13592
|
-
});
|
|
13593
|
-
}
|
|
13594
|
-
setOptions(_toConsumableArray(flowData));
|
|
13595
|
-
}
|
|
13596
|
-
onChange === null || onChange === void 0 || onChange(val, applyDefaultValue, defaultValue);
|
|
13597
|
-
setSelected(value);
|
|
13598
|
-
}
|
|
13599
|
-
}
|
|
13600
|
-
var loadOptions = /*#__PURE__*/function () {
|
|
13601
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(value) {
|
|
13602
|
-
var fetchId, newOptions, serverSideParams;
|
|
13603
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
13604
|
-
while (1) switch (_context.prev = _context.next) {
|
|
13605
|
-
case 0:
|
|
13606
|
-
fetchRef.current += 1;
|
|
13607
|
-
fetchId = fetchRef.current;
|
|
13608
|
-
if (!filterServerSide) {
|
|
13609
|
-
_context.next = 10;
|
|
13610
|
-
break;
|
|
13611
|
-
}
|
|
13612
|
-
setFetching(true);
|
|
13613
|
-
serverSideParams = {
|
|
13614
|
-
filters: selectMapping !== null && selectMapping !== void 0 && selectMapping.searchField ? selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.searchField.reduce(function (filter, field) {
|
|
13615
|
-
return _objectSpread$D(_objectSpread$D({}, filter), value !== undefined ? _defineProperty({}, field.field, [value, field.filter, true]) : {});
|
|
13616
|
-
}, {}) : {
|
|
13617
|
-
_id: [value, 'contains']
|
|
13618
|
-
},
|
|
13619
|
-
pagination: {
|
|
13620
|
-
pageSize: 100
|
|
13621
|
-
}
|
|
13622
|
-
};
|
|
13623
|
-
_context.next = 7;
|
|
13624
|
-
return apiHandler.readList(selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.prefilterMapping, wholeData, serverSideParams, undefined, selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.prefilter).then(function (body) {
|
|
13625
|
-
return (body === null || body === void 0 ? void 0 : body.data.map(function (data) {
|
|
13626
|
-
return {
|
|
13627
|
-
label: selectMapping !== null && selectMapping !== void 0 && selectMapping.label ? getCombinedValues(data, selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.label) : data._id,
|
|
13628
|
-
value: selectMapping !== null && selectMapping !== void 0 && selectMapping.value ? data[selectMapping.value] : data._id,
|
|
13629
|
-
disabled: false,
|
|
13630
|
-
data: data
|
|
13631
|
-
};
|
|
13632
|
-
})) || [];
|
|
13633
|
-
});
|
|
13634
|
-
case 7:
|
|
13635
|
-
newOptions = _context.sent;
|
|
13636
|
-
_context.next = 12;
|
|
13637
|
-
break;
|
|
13638
|
-
case 10:
|
|
13639
|
-
newOptions = initOptions.filter(function (opt) {
|
|
13640
|
-
var _value$toLocaleLowerC;
|
|
13641
|
-
return opt.label.toLocaleLowerCase().includes((_value$toLocaleLowerC = value === null || value === void 0 ? void 0 : value.toLocaleLowerCase()) !== null && _value$toLocaleLowerC !== void 0 ? _value$toLocaleLowerC : '');
|
|
13642
|
-
});
|
|
13643
|
-
if (allowCreate && !newOptions.length) {
|
|
13644
|
-
newOptions = [{
|
|
13645
|
-
data: value,
|
|
13646
|
-
label: value,
|
|
13647
|
-
disabled: false,
|
|
13648
|
-
value: value
|
|
13649
|
-
}];
|
|
13650
|
-
}
|
|
13651
|
-
case 12:
|
|
13652
|
-
if (!(fetchId !== fetchRef.current)) {
|
|
13653
|
-
_context.next = 14;
|
|
13654
|
-
break;
|
|
13655
|
-
}
|
|
13656
|
-
return _context.abrupt("return");
|
|
13657
|
-
case 14:
|
|
13658
|
-
setOptions(newOptions);
|
|
13659
|
-
setFetching(false);
|
|
13660
|
-
case 16:
|
|
13661
|
-
case "end":
|
|
13662
|
-
return _context.stop();
|
|
13663
|
-
}
|
|
13664
|
-
}, _callee);
|
|
13665
|
-
}));
|
|
13666
|
-
return function loadOptions(_x) {
|
|
13667
|
-
return _ref3.apply(this, arguments);
|
|
13668
|
-
};
|
|
13669
|
-
}();
|
|
13670
|
-
var fetch = React.useMemo(function () {
|
|
13671
|
-
return debounce(loadOptions, 800);
|
|
13672
|
-
}, [selectMapping, initOptions, wholeData]);
|
|
13673
|
-
var verifySelection = function verifySelection(opt) {
|
|
13674
|
-
if (disabledConfig == undefined) return [];
|
|
13675
|
-
var _missingFields = [];
|
|
13676
|
-
var _iterator = _createForOfIteratorHelper$h(disabledConfig),
|
|
13677
|
-
_step;
|
|
13678
|
-
try {
|
|
13679
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
13680
|
-
var disabled = _step.value;
|
|
13681
|
-
if (opt == (disabled === null || disabled === void 0 ? void 0 : disabled.value) && wholeData[disabled.onField.field] == disabled.onField.value) {
|
|
13682
|
-
if (!disabled.requiredFields) {
|
|
13683
|
-
return ['Job HQ', 'Job AR'];
|
|
13684
|
-
}
|
|
13685
|
-
disabled.requiredFields.forEach(function (fd) {
|
|
13686
|
-
if (typeof fd === 'string' && (wholeData[fd] === '' || wholeData[fd] === undefined)) {
|
|
13687
|
-
_missingFields.push(fd);
|
|
13688
|
-
} else if (_typeof(fd) == 'object') {
|
|
13689
|
-
if (!fd.value.some(function (v) {
|
|
13690
|
-
return v == wholeData[fd.field];
|
|
13691
|
-
})) {
|
|
13692
|
-
_missingFields.push(fd.field);
|
|
13693
|
-
}
|
|
13694
|
-
}
|
|
13695
|
-
});
|
|
13696
|
-
return _missingFields;
|
|
13697
|
-
}
|
|
13698
|
-
}
|
|
13699
|
-
} catch (err) {
|
|
13700
|
-
_iterator.e(err);
|
|
13701
|
-
} finally {
|
|
13702
|
-
_iterator.f();
|
|
13703
|
-
}
|
|
13704
|
-
return [];
|
|
13705
|
-
};
|
|
13706
|
-
|
|
13707
|
-
//state.configuration.dependencyRule.
|
|
13708
|
-
var onSelect = function onSelect(data) {
|
|
13709
|
-
//! tags works without labelInValue; data = string; get's converted to option afterwards in useeffect
|
|
13710
|
-
//because of a error in the typedefinition we have to cast it here
|
|
13711
|
-
var newSelected = data;
|
|
13712
|
-
var sel = selected;
|
|
13713
|
-
var option = options.find(function (o) {
|
|
13714
|
-
return o.value == newSelected.value;
|
|
13715
|
-
});
|
|
13716
|
-
if (option) {
|
|
13717
|
-
if (mode == 'tags') {
|
|
13718
|
-
throw new Error('select with options is not yet supported for mode tags');
|
|
13719
|
-
}
|
|
13720
|
-
if (mode == 'single') {
|
|
13721
|
-
var _option$data;
|
|
13722
|
-
if (flow) {
|
|
13723
|
-
var _flow$option$value;
|
|
13724
|
-
var missingFields = verifySelection(option.value);
|
|
13725
|
-
if (missingFields.length) {
|
|
13726
|
-
onError === null || onError === void 0 || onError((missingFields === null || missingFields === void 0 ? void 0 : missingFields.join(', ')) + ' not set or wrong value');
|
|
13727
|
-
return;
|
|
13728
|
-
} else {
|
|
13729
|
-
onError === null || onError === void 0 || onError('');
|
|
13730
|
-
}
|
|
13731
|
-
var flowData = (flow === null || flow === void 0 || (_flow$option$value = flow[option.value]) === null || _flow$option$value === void 0 ? void 0 : _flow$option$value.map(function (opt) {
|
|
13732
|
-
return {
|
|
13733
|
-
label: translationPrefix ? t(translationPrefix + '.' + opt) : opt.toString(),
|
|
13734
|
-
value: opt,
|
|
13735
|
-
data: opt
|
|
13736
|
-
};
|
|
13737
|
-
})) || [];
|
|
13738
|
-
var _defaultValue2 = initalValue !== null && initalValue !== void 0 ? initalValue : data;
|
|
13739
|
-
if (!flowData.find(function (fd) {
|
|
13740
|
-
return fd.value == _defaultValue2;
|
|
13741
|
-
})) {
|
|
13742
|
-
flowData.push({
|
|
13743
|
-
label: translationPrefix ? t(translationPrefix + '.' + _defaultValue2) : _defaultValue2.toString(),
|
|
13744
|
-
value: _defaultValue2,
|
|
13745
|
-
data: _defaultValue2
|
|
13746
|
-
});
|
|
13747
|
-
}
|
|
13748
|
-
setOptions(_toConsumableArray(flowData));
|
|
13749
|
-
}
|
|
13750
|
-
//if it is single mode there can always only be one selected or one new entry
|
|
13751
|
-
onChange === null || onChange === void 0 || onChange((_option$data = option === null || option === void 0 ? void 0 : option.data) !== null && _option$data !== void 0 ? _option$data : option, applyDefaultValue, defaultValue);
|
|
13752
|
-
setSelected([option]);
|
|
13753
|
-
} else {
|
|
13754
|
-
var selectedList = [].concat(_toConsumableArray(sel), [option]);
|
|
13755
|
-
setSelected(selectedList);
|
|
13756
|
-
onChange === null || onChange === void 0 || onChange(selectedList.map(function (s) {
|
|
13757
|
-
return s.data;
|
|
13758
|
-
}), applyDefaultValue, defaultValue);
|
|
13759
|
-
}
|
|
13760
|
-
} else {
|
|
13761
|
-
if (mode == 'tags' && typeof data === 'string') {
|
|
13762
|
-
onChange === null || onChange === void 0 || onChange([].concat(_toConsumableArray(sel.map(function (s) {
|
|
13763
|
-
return s.data;
|
|
13764
|
-
})), [data]), applyDefaultValue, defaultValue);
|
|
13765
|
-
setSelected([].concat(_toConsumableArray(sel), [data]));
|
|
13766
|
-
} else {
|
|
13767
|
-
throw new Error('select without options is not yet supported for modes other than tags');
|
|
13768
|
-
}
|
|
13769
|
-
}
|
|
13770
|
-
};
|
|
13771
|
-
|
|
13772
|
-
// if useFirstValueAsDefault is true we load the options and trigger an update with setGettingDefaultValue
|
|
13773
|
-
// at the 2. useEffect the options are loaded and set in state so we can set the first option
|
|
13774
|
-
useEffect(function () {
|
|
13775
|
-
if (useFirstValueAsDefault && !selected.length) {
|
|
13776
|
-
loadOptions(undefined).then(function () {
|
|
13777
|
-
return setGettingDefaultValue(true);
|
|
13778
|
-
});
|
|
13779
|
-
}
|
|
13780
|
-
}, []);
|
|
13781
|
-
useEffect(function () {
|
|
13782
|
-
if (gettingDefaultValue) onSelect(options[0]);
|
|
13783
|
-
}, [gettingDefaultValue]);
|
|
13784
|
-
var onFocus = function onFocus() {
|
|
13785
|
-
loadOptions(undefined);
|
|
13786
|
-
};
|
|
13787
|
-
var onRemove = function onRemove(data) {
|
|
13788
|
-
//because of a error in the typedefinition we have to cast it here
|
|
13789
|
-
var removed = data;
|
|
13790
|
-
var sel = selected;
|
|
13791
|
-
var newSelected;
|
|
13792
|
-
if (removed) {
|
|
13793
|
-
var index = sel.findIndex(function (s) {
|
|
13794
|
-
return s.value == removed.value;
|
|
13795
|
-
});
|
|
13796
|
-
newSelected = _toConsumableArray(sel);
|
|
13797
|
-
newSelected.splice(index, 1);
|
|
13798
|
-
} else {
|
|
13799
|
-
newSelected = [];
|
|
13800
|
-
}
|
|
13801
|
-
setSelected(newSelected);
|
|
13802
|
-
if (mode == 'single') {
|
|
13803
|
-
onChange === null || onChange === void 0 || onChange(undefined, applyDefaultValue, defaultValue);
|
|
13804
|
-
} else {
|
|
13805
|
-
onChange === null || onChange === void 0 || onChange(newSelected.map(function (s) {
|
|
13806
|
-
return s.data;
|
|
13807
|
-
}), applyDefaultValue, defaultValue);
|
|
13808
|
-
}
|
|
13809
|
-
};
|
|
13810
|
-
return {
|
|
13811
|
-
fetching: fetching,
|
|
13812
|
-
options: options,
|
|
13813
|
-
selected: selected,
|
|
13814
|
-
fetch: fetch,
|
|
13815
|
-
onRemove: onRemove,
|
|
13816
|
-
onFocus: onFocus,
|
|
13817
|
-
onSelect: onSelect
|
|
13818
|
-
};
|
|
13819
|
-
}
|
|
13820
|
-
|
|
13821
|
-
var css_248z$m = ".darkmode .ant-select-selection-search-input {\n color: #fff;\n}\n";
|
|
13822
|
-
styleInject(css_248z$m);
|
|
13823
|
-
|
|
13824
|
-
var SelectWrapper$1 = function SelectWrapper(_ref) {
|
|
13825
|
-
var onChange = _ref.onChange,
|
|
13826
|
-
onError = _ref.onError,
|
|
13827
|
-
value = _ref.value,
|
|
13828
|
-
apiInterface = _ref.apiInterface,
|
|
13829
|
-
selectMapping = _ref.selectMapping,
|
|
13830
|
-
mapping = _ref.mapping,
|
|
13831
|
-
mode = _ref.mode,
|
|
13832
|
-
initialValue = _ref.initialValue,
|
|
13833
|
-
minWidth = _ref.minWidth,
|
|
13834
|
-
allowCreate = _ref.allowCreate,
|
|
13835
|
-
allowClear = _ref.allowClear,
|
|
13836
|
-
search = _ref.search,
|
|
13837
|
-
flow = _ref.flow,
|
|
13838
|
-
translationPrefix = _ref.translationPrefix,
|
|
13839
|
-
values = _ref.values,
|
|
13840
|
-
disabled = _ref.disabled,
|
|
13841
|
-
wholeData = _ref.wholeData,
|
|
13842
|
-
disabledConfig = _ref.disabledConfig,
|
|
13843
|
-
placeholder = _ref.placeholder,
|
|
13844
|
-
options = _ref.options,
|
|
13845
|
-
applyDefaultValue = _ref.applyDefaultValue,
|
|
13846
|
-
useFirstValueAsDefault = _ref.useFirstValueAsDefault,
|
|
13847
|
-
canSetToUndefined = _ref.canSetToUndefined;
|
|
13848
|
-
var state = useSelectData({
|
|
13849
|
-
onChange: onChange,
|
|
13850
|
-
onError: onError,
|
|
13851
|
-
data: value,
|
|
13852
|
-
apiInterface: apiInterface,
|
|
13853
|
-
selectMapping: selectMapping,
|
|
13854
|
-
mapping: mapping,
|
|
13855
|
-
mode: mode,
|
|
13856
|
-
allowCreate: allowCreate,
|
|
13857
|
-
defaultValue: initialValue,
|
|
13858
|
-
flow: flow,
|
|
13859
|
-
translationPrefix: translationPrefix,
|
|
13860
|
-
values: values,
|
|
13861
|
-
wholeData: wholeData,
|
|
13862
|
-
disabledConfig: disabledConfig,
|
|
13863
|
-
hardOptions: options,
|
|
13864
|
-
applyDefaultValue: applyDefaultValue,
|
|
13865
|
-
useFirstValueAsDefault: useFirstValueAsDefault,
|
|
13866
|
-
canSetToUndefined: canSetToUndefined
|
|
13867
|
-
});
|
|
13868
|
-
var _useTranslation = useTranslation$1(),
|
|
13869
|
-
t = _useTranslation.t;
|
|
13870
|
-
var filterServerSide = _typeof(apiInterface) == 'object' && _typeof(apiInterface.read) == 'object' && apiInterface.read.filterServerSide;
|
|
13871
|
-
var selected = state.selected;
|
|
13872
|
-
return /*#__PURE__*/jsx(Fragment, {
|
|
13873
|
-
children: /*#__PURE__*/jsx(Select$1, {
|
|
13874
|
-
labelInValue: mode === 'tags' ? false : true,
|
|
13875
|
-
style: {
|
|
13876
|
-
width: '100%',
|
|
13877
|
-
minWidth: minWidth
|
|
13878
|
-
},
|
|
13879
|
-
filterOption: false,
|
|
13880
|
-
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t('filter.global'),
|
|
13881
|
-
allowClear: allowClear !== null && allowClear !== void 0 ? allowClear : filterServerSide,
|
|
13882
|
-
showArrow: !filterServerSide || allowCreate || search,
|
|
13883
|
-
mode: mode == 'single' ? undefined : mode,
|
|
13884
|
-
showSearch: filterServerSide || allowCreate || search,
|
|
13885
|
-
onSearch: filterServerSide || allowCreate || search ? state.fetch : undefined,
|
|
13886
|
-
notFoundContent: state.fetching ? /*#__PURE__*/jsx(Spin, {
|
|
13887
|
-
size: "small"
|
|
13888
|
-
}) : null,
|
|
13889
|
-
options: state.options,
|
|
13890
|
-
onSelect: state.onSelect,
|
|
13891
|
-
disabled: disabled,
|
|
13892
|
-
onDeselect: state.onRemove,
|
|
13893
|
-
onFocus: filterServerSide || allowCreate || search ? state.onFocus : undefined,
|
|
13894
|
-
onClear: state.onRemove,
|
|
13895
|
-
value: selected
|
|
13896
|
-
})
|
|
13897
|
-
});
|
|
13898
|
-
};
|
|
13899
|
-
var Select = observer(SelectWrapper$1, {
|
|
13900
|
-
forwardRef: true
|
|
13901
|
-
});
|
|
13902
|
-
|
|
13903
|
-
function ownKeys$C(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; }
|
|
13904
|
-
function _objectSpread$C(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$C(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$C(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13905
|
-
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; } } }; }
|
|
13906
|
-
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; } }
|
|
13907
|
-
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; }
|
|
13908
|
-
var Presets = function Presets(_ref) {
|
|
13909
|
-
var state = _ref.state,
|
|
13910
|
-
apiHandler = _ref.apiHandler,
|
|
13911
|
-
form = _ref.form,
|
|
13912
|
-
root = _ref.root,
|
|
13913
|
-
setUsedPreset = _ref.setUsedPreset,
|
|
13914
|
-
presets = _ref.presets,
|
|
13915
|
-
setPresets = _ref.setPresets;
|
|
13916
|
-
var Option = Select$1.Option;
|
|
13917
|
-
var _useState = useState(false),
|
|
13918
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
13919
|
-
isModalVisible = _useState2[0],
|
|
13920
|
-
setIsModalVisible = _useState2[1];
|
|
13921
|
-
var _useState3 = useState(''),
|
|
13922
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
13923
|
-
newPresetName = _useState4[0],
|
|
13924
|
-
setNewPresetName = _useState4[1];
|
|
13925
|
-
var _useState5 = useState(),
|
|
13926
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
13927
|
-
value = _useState6[0],
|
|
13928
|
-
setValue = _useState6[1];
|
|
13929
|
-
var _useState7 = useState([]),
|
|
13930
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
13931
|
-
presetIds = _useState8[0],
|
|
13932
|
-
setPresetIds = _useState8[1];
|
|
13933
|
-
var _useTranslation = useTranslation$1(),
|
|
13934
|
-
t = _useTranslation.t;
|
|
13935
|
-
useEffect(function () {
|
|
13936
|
-
getPresets();
|
|
13937
|
-
}, []);
|
|
13938
|
-
var savePreset = function savePreset() {
|
|
13939
|
-
if (state.selectedItems == undefined) return;
|
|
13940
|
-
setIsModalVisible(false);
|
|
13941
|
-
var names = [];
|
|
13942
|
-
var _iterator = _createForOfIteratorHelper$g(state.selectedItems),
|
|
13943
|
-
_step;
|
|
13944
|
-
try {
|
|
13945
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
13946
|
-
var item = _step.value;
|
|
13947
|
-
names.push(item.name);
|
|
13948
|
-
}
|
|
13949
|
-
} catch (err) {
|
|
13950
|
-
_iterator.e(err);
|
|
13951
|
-
} finally {
|
|
13952
|
-
_iterator.f();
|
|
13953
|
-
}
|
|
13954
|
-
var data = _objectSpread$C(_objectSpread$C({}, form.getFieldsValue(names)), {}, {
|
|
13955
|
-
newPresetName: newPresetName
|
|
13956
|
-
});
|
|
13957
|
-
data.dpi = parseInt(data.dpi);
|
|
13958
|
-
data.organization = root.getGlobalValue('organizationId');
|
|
13959
|
-
apiHandler.create({}, state.configuration.createPresetMapping, data);
|
|
13960
|
-
var dt = _objectSpread$C(_objectSpread$C({}, form.getFieldsValue(names)), {}, {
|
|
13961
|
-
name: newPresetName
|
|
13962
|
-
});
|
|
13963
|
-
setPresets({
|
|
13964
|
-
data: [dt].concat(_toConsumableArray(presets.data)),
|
|
13965
|
-
total: presets.total
|
|
13966
|
-
});
|
|
13967
|
-
};
|
|
13968
|
-
var getPresets = /*#__PURE__*/function () {
|
|
13969
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
13970
|
-
var res, ids, preset;
|
|
13971
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
13972
|
-
while (1) switch (_context.prev = _context.next) {
|
|
13973
|
-
case 0:
|
|
13974
|
-
_context.next = 2;
|
|
13975
|
-
return apiHandler.readList();
|
|
13976
|
-
case 2:
|
|
13977
|
-
res = _context.sent;
|
|
13978
|
-
ids = [];
|
|
13979
|
-
for (preset in res.data) {
|
|
13980
|
-
ids.push(res.data[preset]._id);
|
|
13981
|
-
delete res.data[preset]._id;
|
|
13982
|
-
}
|
|
13983
|
-
setPresetIds(ids);
|
|
13984
|
-
setPresets(res);
|
|
13985
|
-
case 7:
|
|
13986
|
-
case "end":
|
|
13987
|
-
return _context.stop();
|
|
13988
|
-
}
|
|
13989
|
-
}, _callee);
|
|
13990
|
-
}));
|
|
13991
|
-
return function getPresets() {
|
|
13992
|
-
return _ref2.apply(this, arguments);
|
|
13993
|
-
};
|
|
13994
|
-
}();
|
|
13995
|
-
var onPresetSelect = function onPresetSelect(index) {
|
|
13996
|
-
var preset = presets.data[index];
|
|
13997
|
-
if (!state.selectedItems) return;
|
|
13998
|
-
state.selectedItems.map(function (item) {
|
|
13999
|
-
if (isReadonly(item, form.getFieldsValue())) {
|
|
14000
|
-
delete preset[item.name];
|
|
14001
|
-
}
|
|
14002
|
-
});
|
|
14003
|
-
form.setFieldsValue(presets.data[index]);
|
|
14004
|
-
setUsedPreset({
|
|
14005
|
-
used: true,
|
|
14006
|
-
index: index
|
|
14007
|
-
});
|
|
14008
|
-
};
|
|
14009
|
-
var deletePreset = function deletePreset(index) {
|
|
14010
|
-
apiHandler["delete"](presetIds[index]);
|
|
14011
|
-
var data = presets.data;
|
|
14012
|
-
data.splice(index, 1);
|
|
14013
|
-
setPresets({
|
|
14014
|
-
data: data,
|
|
14015
|
-
total: presets.total
|
|
14016
|
-
});
|
|
14017
|
-
setValue(undefined);
|
|
14018
|
-
};
|
|
14019
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
14020
|
-
children: [/*#__PURE__*/jsx(Select$1, {
|
|
14021
|
-
showSearch: true,
|
|
14022
|
-
value: value,
|
|
14023
|
-
placeholder: t('backoffice.form.presets.placeholder'),
|
|
14024
|
-
optionFilterProp: "children",
|
|
14025
|
-
style: {
|
|
14026
|
-
width: '94%',
|
|
14027
|
-
paddingLeft: 0,
|
|
14028
|
-
marginBottom: 30
|
|
14029
|
-
},
|
|
14030
|
-
onChange: function onChange(index) {
|
|
14031
|
-
setValue(index);
|
|
14032
|
-
onPresetSelect(index);
|
|
14033
|
-
},
|
|
14034
|
-
children: presets === null || presets === void 0 ? void 0 : presets.data.map(function (dt, idx) {
|
|
14035
|
-
return /*#__PURE__*/jsx(Fragment, {
|
|
14036
|
-
children: /*#__PURE__*/jsxs(Option, {
|
|
14037
|
-
value: idx,
|
|
14038
|
-
children: [dt.name, /*#__PURE__*/jsx(Button, {
|
|
14039
|
-
icon: /*#__PURE__*/jsx(DeleteOutlined, {}),
|
|
14040
|
-
style: {
|
|
14041
|
-
"float": 'right'
|
|
14042
|
-
},
|
|
14043
|
-
onClick: function onClick() {
|
|
14044
|
-
return deletePreset(idx);
|
|
14045
|
-
}
|
|
14046
|
-
})]
|
|
14047
|
-
}, idx)
|
|
14048
|
-
});
|
|
14049
|
-
})
|
|
14050
|
-
}), /*#__PURE__*/jsx(Button, {
|
|
14051
|
-
type: "primary",
|
|
14052
|
-
onClick: function onClick() {
|
|
14053
|
-
return setIsModalVisible(true);
|
|
14054
|
-
},
|
|
14055
|
-
children: "Create"
|
|
14056
|
-
}), /*#__PURE__*/jsx(Modal$2, {
|
|
14057
|
-
title: "Create Preset",
|
|
14058
|
-
visible: isModalVisible,
|
|
14059
|
-
onOk: function onOk(e) {
|
|
14060
|
-
return savePreset();
|
|
14061
|
-
},
|
|
14062
|
-
onCancel: function onCancel() {
|
|
14063
|
-
return setIsModalVisible(false);
|
|
14064
|
-
},
|
|
14065
|
-
children: /*#__PURE__*/jsx(Input, {
|
|
14066
|
-
value: newPresetName,
|
|
14067
|
-
placeholder: "Preset Name",
|
|
14068
|
-
onChange: function onChange(e) {
|
|
14069
|
-
setNewPresetName(e.target.value);
|
|
14070
|
-
},
|
|
14071
|
-
style: {
|
|
14072
|
-
marginBottom: 15
|
|
14073
|
-
}
|
|
14074
|
-
})
|
|
14075
|
-
})]
|
|
14076
|
-
});
|
|
14077
|
-
};
|
|
14078
|
-
|
|
14079
|
-
var JsonEditor$2 = function JsonEditor(_ref) {
|
|
14080
|
-
var value = _ref.value,
|
|
14081
|
-
_onChange = _ref.onChange,
|
|
14082
|
-
setCanSave = _ref.setCanSave,
|
|
14083
|
-
data = _ref.data,
|
|
14084
|
-
height = _ref.height,
|
|
14085
|
-
savable = _ref.savable;
|
|
14086
|
-
var container = useRef(null);
|
|
14087
|
-
var _useState = useState(0),
|
|
14088
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
14089
|
-
counter = _useState2[0],
|
|
14090
|
-
setCounter = _useState2[1];
|
|
14091
|
-
var jsonEditor = useRef(null);
|
|
14092
|
-
var options = {
|
|
14093
|
-
mode: 'code',
|
|
14094
|
-
onChange: function onChange() {
|
|
14095
|
-
try {
|
|
14096
|
-
var e = jsonEditor.current.get();
|
|
14097
|
-
jsonEditor.current.validate();
|
|
14098
|
-
_onChange === null || _onChange === void 0 || _onChange(e);
|
|
14099
|
-
setCanSave(savable);
|
|
14100
|
-
} catch (_unused) {
|
|
14101
|
-
setCanSave(false);
|
|
14102
|
-
return;
|
|
14103
|
-
}
|
|
14104
|
-
}
|
|
14105
|
-
};
|
|
14106
|
-
useEffect(function () {
|
|
14107
|
-
jsonEditor.current = new JSONEditor(container.current, options);
|
|
14108
|
-
}, []);
|
|
14109
|
-
useEffect(function () {
|
|
14110
|
-
setCanSave(savable);
|
|
14111
|
-
// antd sets value after initiating once as undefined, the jsoneditor should only be set once with the initial value that gets set by antd
|
|
14112
|
-
if (counter == 2) {
|
|
14113
|
-
return;
|
|
14114
|
-
}
|
|
14115
|
-
if (!value) {
|
|
14116
|
-
jsonEditor.current.set(data !== null && data !== void 0 ? data : {});
|
|
14117
|
-
} else {
|
|
14118
|
-
jsonEditor.current.set(value);
|
|
14119
|
-
}
|
|
14120
|
-
setCounter(counter + 1);
|
|
14121
|
-
}, [value]);
|
|
14122
|
-
return /*#__PURE__*/jsx("div", {
|
|
14123
|
-
ref: container,
|
|
14124
|
-
id: "jsoneditor",
|
|
14125
|
-
style: {
|
|
14126
|
-
height: height !== null && height !== void 0 ? height : 600
|
|
13583
|
+
return /*#__PURE__*/jsx(Form$1.List, {
|
|
13584
|
+
name: item.name,
|
|
13585
|
+
initialValue: (_item$initialValue = item.initialValue) !== null && _item$initialValue !== void 0 ? _item$initialValue : value,
|
|
13586
|
+
children: function children(fields, _ref2) {
|
|
13587
|
+
var add = _ref2.add,
|
|
13588
|
+
remove = _ref2.remove;
|
|
13589
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
13590
|
+
children: [fields.map(function (field, idx) {
|
|
13591
|
+
return /*#__PURE__*/jsxs("div", {
|
|
13592
|
+
id: field.key.toString(),
|
|
13593
|
+
style: {
|
|
13594
|
+
display: 'flex'
|
|
13595
|
+
},
|
|
13596
|
+
children: [!item.disablePushOrPop && /*#__PURE__*/jsx(MinusCircleOutlined, {
|
|
13597
|
+
onClick: function onClick() {
|
|
13598
|
+
return remove(field.name);
|
|
13599
|
+
}
|
|
13600
|
+
}), /*#__PURE__*/jsx("div", {
|
|
13601
|
+
style: {
|
|
13602
|
+
flexGrow: 1
|
|
13603
|
+
},
|
|
13604
|
+
children: item.items.map(function (i, idx) {
|
|
13605
|
+
var _state$hiddenRequired;
|
|
13606
|
+
var n = [field.name].concat(_toConsumableArray(Array.isArray(i.name) ? i.name : [i.name]));
|
|
13607
|
+
var hidden = !!i.hidden;
|
|
13608
|
+
if (i.hidden && data) {
|
|
13609
|
+
if (typeof i.hidden === 'function') {
|
|
13610
|
+
var _data;
|
|
13611
|
+
if ((_data = data[item.name]) !== null && _data !== void 0 && _data[n[0]]) {
|
|
13612
|
+
hidden = i.hidden(data[item.name][n[0]]);
|
|
13613
|
+
} else hidden = false;
|
|
13614
|
+
}
|
|
13615
|
+
}
|
|
13616
|
+
if (!hidden) hidden = (_state$hiddenRequired = state.hiddenRequiredDisabled[typeof n == 'string' ? n : n.join('.')]) === null || _state$hiddenRequired === void 0 ? void 0 : _state$hiddenRequired.hidden;
|
|
13617
|
+
var pathName = [].concat(_toConsumableArray(Array.isArray(item.name) ? item.name : [item.name]), _toConsumableArray(Array.isArray(n) ? n : [n]));
|
|
13618
|
+
return /*#__PURE__*/jsx(Form$1.Item, {
|
|
13619
|
+
id: idx.toString(),
|
|
13620
|
+
name: n,
|
|
13621
|
+
rules: state.getRules(i, state.data),
|
|
13622
|
+
label: getLabel(i, t),
|
|
13623
|
+
valuePropName: i.type == 'checkbox' ? 'checked' : 'value',
|
|
13624
|
+
initialValue: i === null || i === void 0 ? void 0 : i.defaultValue,
|
|
13625
|
+
hasFeedback: !!state.fieldErrors[n.toString()],
|
|
13626
|
+
validateStatus: !!state.fieldErrors[n.toString()] ? 'error' : undefined,
|
|
13627
|
+
help: state.fieldErrors[n.toString()],
|
|
13628
|
+
hidden: hidden,
|
|
13629
|
+
children: getElement(i, state.data, setCanSave, state, state.onInputChanged, onError, root, form, hidden, pathName)
|
|
13630
|
+
}, idx);
|
|
13631
|
+
})
|
|
13632
|
+
})]
|
|
13633
|
+
}, field.key);
|
|
13634
|
+
}), !item.disablePushOrPop && /*#__PURE__*/jsx(Form$1.Item, {
|
|
13635
|
+
children: /*#__PURE__*/jsx(Button, {
|
|
13636
|
+
type: "dashed",
|
|
13637
|
+
onClick: function onClick() {
|
|
13638
|
+
return add();
|
|
13639
|
+
},
|
|
13640
|
+
block: true,
|
|
13641
|
+
icon: /*#__PURE__*/jsx(PlusOutlined, {}),
|
|
13642
|
+
children: t('backoffice.add_field')
|
|
13643
|
+
})
|
|
13644
|
+
})]
|
|
13645
|
+
});
|
|
14127
13646
|
}
|
|
14128
13647
|
});
|
|
14129
13648
|
};
|
|
13649
|
+
var FormList$3 = observer(FormList$2, {
|
|
13650
|
+
forwardRef: true
|
|
13651
|
+
});
|
|
14130
13652
|
|
|
14131
13653
|
var ApiKey = function ApiKey(_ref) {
|
|
14132
13654
|
var value = _ref.value,
|
|
@@ -14270,8 +13792,8 @@ var Result = function Result(_ref) {
|
|
|
14270
13792
|
|
|
14271
13793
|
var success = "success-tRJ7j";
|
|
14272
13794
|
var error = "error-MtAFB";
|
|
14273
|
-
var css_248z$
|
|
14274
|
-
styleInject(css_248z$
|
|
13795
|
+
var css_248z$m = ".success-tRJ7j {\n color: #fff !important;\n background-color: #449d44 !important;\n border-color: #398439 !important;\n}\n\n.error-MtAFB {\n color: #fff !important;\n background-color: #c9302c !important;\n border-color: #ac2925 !important;\n}\n";
|
|
13796
|
+
styleInject(css_248z$m);
|
|
14275
13797
|
|
|
14276
13798
|
var azureIcon = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2048%2048%22%20width%3D%2248px%22%20height%3D%2248px%22%3E%20%3ClinearGradient%20id%3D%22k8yl7~hDat~FaoWq8WjN6a%22%20x1%3D%22-1254.397%22%20x2%3D%22-1261.911%22%20y1%3D%22877.268%22%20y2%3D%22899.466%22%20gradientTransform%3D%22translate%281981.75%20-1362.063%29%20scale%281.5625%29%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%20%20%3Cstop%20offset%3D%220%22%20stop-color%3D%22%23114a8b%22%2F%3E%20%20%3Cstop%20offset%3D%221%22%20stop-color%3D%22%230669bc%22%2F%3E%20%3C%2FlinearGradient%3E%20%3Cpath%20fill%3D%22url%28%23k8yl7~hDat~FaoWq8WjN6a%29%22%20d%3D%22M17.634%2C6h11.305L17.203%2C40.773c-0.247%2C0.733-0.934%2C1.226-1.708%2C1.226H6.697%20c-0.994%2C0-1.8-0.806-1.8-1.8c0-0.196%2C0.032-0.39%2C0.094-0.576L15.926%2C7.227C16.173%2C6.494%2C16.86%2C6%2C17.634%2C6L17.634%2C6z%22%2F%3E%20%3Cpath%20fill%3D%22%230078d4%22%20d%3D%22M34.062%2C29.324H16.135c-0.458-0.001-0.83%2C0.371-0.831%2C0.829c0%2C0.231%2C0.095%2C0.451%2C0.264%2C0.608%20l11.52%2C10.752C27.423%2C41.826%2C27.865%2C42%2C28.324%2C42h10.151L34.062%2C29.324z%22%2F%3E%20%3ClinearGradient%20id%3D%22k8yl7~hDat~FaoWq8WjN6b%22%20x1%3D%22-1252.05%22%20x2%3D%22-1253.788%22%20y1%3D%22887.612%22%20y2%3D%22888.2%22%20gradientTransform%3D%22translate%281981.75%20-1362.063%29%20scale%281.5625%29%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%20%20%3Cstop%20offset%3D%220%22%20stop-opacity%3D%22.3%22%2F%3E%20%20%3Cstop%20offset%3D%22.071%22%20stop-opacity%3D%22.2%22%2F%3E%20%20%3Cstop%20offset%3D%22.321%22%20stop-opacity%3D%22.1%22%2F%3E%20%20%3Cstop%20offset%3D%22.623%22%20stop-opacity%3D%22.05%22%2F%3E%20%20%3Cstop%20offset%3D%221%22%20stop-opacity%3D%220%22%2F%3E%20%3C%2FlinearGradient%3E%20%3Cpath%20fill%3D%22url%28%23k8yl7~hDat~FaoWq8WjN6b%29%22%20d%3D%22M17.634%2C6c-0.783-0.003-1.476%2C0.504-1.712%2C1.25L5.005%2C39.595%20c-0.335%2C0.934%2C0.151%2C1.964%2C1.085%2C2.299C6.286%2C41.964%2C6.493%2C42%2C6.702%2C42h9.026c0.684-0.122%2C1.25-0.603%2C1.481-1.259l2.177-6.416%20l7.776%2C7.253c0.326%2C0.27%2C0.735%2C0.419%2C1.158%2C0.422h10.114l-4.436-12.676l-12.931%2C0.003L28.98%2C6H17.634z%22%2F%3E%20%3ClinearGradient%20id%3D%22k8yl7~hDat~FaoWq8WjN6c%22%20x1%3D%22-1252.952%22%20x2%3D%22-1244.704%22%20y1%3D%22876.6%22%20y2%3D%22898.575%22%20gradientTransform%3D%22translate%281981.75%20-1362.063%29%20scale%281.5625%29%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%20%20%3Cstop%20offset%3D%220%22%20stop-color%3D%22%233ccbf4%22%2F%3E%20%20%3Cstop%20offset%3D%221%22%20stop-color%3D%22%232892df%22%2F%3E%20%3C%2FlinearGradient%3E%20%3Cpath%20fill%3D%22url%28%23k8yl7~hDat~FaoWq8WjN6c%29%22%20d%3D%22M32.074%2C7.225C31.827%2C6.493%2C31.141%2C6%2C30.368%2C6h-12.6c0.772%2C0%2C1.459%2C0.493%2C1.705%2C1.224%20l10.935%2C32.399c0.318%2C0.942-0.188%2C1.963-1.13%2C2.281C29.093%2C41.968%2C28.899%2C42%2C28.703%2C42h12.6c0.994%2C0%2C1.8-0.806%2C1.8-1.801%20c0-0.196-0.032-0.39-0.095-0.575L32.074%2C7.225z%22%2F%3E%3C%2Fsvg%3E";
|
|
14277
13799
|
|
|
@@ -14337,11 +13859,11 @@ var CustomButton$1 = observer(CustomButton, {
|
|
|
14337
13859
|
|
|
14338
13860
|
var wrapper$3 = "wrapper-GVe2h";
|
|
14339
13861
|
var buttonGroup = "button-group-GYt-T";
|
|
14340
|
-
var css_248z$
|
|
14341
|
-
styleInject(css_248z$
|
|
13862
|
+
var css_248z$l = ".wrapper-GVe2h {\n display: flex;\n flex-direction: row;\n gap: 12px;\n}\n\n.button-group-GYt-T {\n display: flex;\n flex-direction: row;\n gap: 12px;\n margin: 0 12px;\n}\n";
|
|
13863
|
+
styleInject(css_248z$l);
|
|
14342
13864
|
|
|
14343
|
-
function ownKeys$
|
|
14344
|
-
function _objectSpread$
|
|
13865
|
+
function ownKeys$D(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; }
|
|
13866
|
+
function _objectSpread$D(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$D(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$D(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14345
13867
|
var SubTitle = function SubTitle(_ref) {
|
|
14346
13868
|
var _item$orientation, _item$buttonIds;
|
|
14347
13869
|
var item = _ref.item,
|
|
@@ -14350,7 +13872,7 @@ var SubTitle = function SubTitle(_ref) {
|
|
|
14350
13872
|
t = _useTranslation.t;
|
|
14351
13873
|
return /*#__PURE__*/jsx(Divider, {
|
|
14352
13874
|
orientation: (_item$orientation = item.orientation) !== null && _item$orientation !== void 0 ? _item$orientation : 'left',
|
|
14353
|
-
style: _objectSpread$
|
|
13875
|
+
style: _objectSpread$D({}, item.style),
|
|
14354
13876
|
children: /*#__PURE__*/jsxs("div", {
|
|
14355
13877
|
className: wrapper$3,
|
|
14356
13878
|
children: [Array.isArray(item.name) ? t(item.name[0].toString()) : t(item.name), ((_item$buttonIds = item.buttonIds) === null || _item$buttonIds === void 0 ? void 0 : _item$buttonIds.length) && item.buttonIds.map(function (b) {
|
|
@@ -14430,9 +13952,224 @@ var InputComponent = function InputComponent(_ref) {
|
|
|
14430
13952
|
}
|
|
14431
13953
|
});
|
|
14432
13954
|
};
|
|
14433
|
-
var InputComponent$1 = observer(InputComponent, {
|
|
14434
|
-
forwardRef: true
|
|
14435
|
-
});
|
|
13955
|
+
var InputComponent$1 = observer(InputComponent, {
|
|
13956
|
+
forwardRef: true
|
|
13957
|
+
});
|
|
13958
|
+
|
|
13959
|
+
function _createForOfIteratorHelper$i(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$i(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; } } }; }
|
|
13960
|
+
function _unsupportedIterableToArray$i(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$i(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$i(r, a) : void 0; } }
|
|
13961
|
+
function _arrayLikeToArray$i(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; }
|
|
13962
|
+
function getCombinedValues(data, pattern) {
|
|
13963
|
+
if (!pattern || !data) {
|
|
13964
|
+
return data;
|
|
13965
|
+
}
|
|
13966
|
+
var value = pattern;
|
|
13967
|
+
var _iterator = _createForOfIteratorHelper$i(pattern.matchAll(/\$\{(.*?)\}/g)),
|
|
13968
|
+
_step;
|
|
13969
|
+
try {
|
|
13970
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
13971
|
+
var _flatten$match$;
|
|
13972
|
+
var match = _step.value;
|
|
13973
|
+
value = value.replace(match[0], (_flatten$match$ = flat(data)[match[1]]) !== null && _flatten$match$ !== void 0 ? _flatten$match$ : '');
|
|
13974
|
+
}
|
|
13975
|
+
} catch (err) {
|
|
13976
|
+
_iterator.e(err);
|
|
13977
|
+
} finally {
|
|
13978
|
+
_iterator.f();
|
|
13979
|
+
}
|
|
13980
|
+
return value;
|
|
13981
|
+
}
|
|
13982
|
+
|
|
13983
|
+
var LOG$8 = getLogger('Backoffice', 'SelectSimple');
|
|
13984
|
+
function useSelectSimpleData (_ref) {
|
|
13985
|
+
var apiInterface = _ref.apiInterface,
|
|
13986
|
+
selectMapping = _ref.selectMapping,
|
|
13987
|
+
apiMapping = _ref.apiMapping,
|
|
13988
|
+
onChange = _ref.onChange,
|
|
13989
|
+
value = _ref.value,
|
|
13990
|
+
configuredOptions = _ref.options;
|
|
13991
|
+
var root = useStore();
|
|
13992
|
+
var _useMemo = useMemo(function () {
|
|
13993
|
+
return {
|
|
13994
|
+
apiHandler: new _default$d({
|
|
13995
|
+
type: 'SelectSimple',
|
|
13996
|
+
apiInterface: apiInterface
|
|
13997
|
+
}, root)
|
|
13998
|
+
};
|
|
13999
|
+
}, []),
|
|
14000
|
+
apiHandler = _useMemo.apiHandler;
|
|
14001
|
+
var _useState = useState(true),
|
|
14002
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
14003
|
+
loading = _useState2[0],
|
|
14004
|
+
setLoading = _useState2[1];
|
|
14005
|
+
var _useState3 = useState(),
|
|
14006
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
14007
|
+
options = _useState4[0],
|
|
14008
|
+
setOptions = _useState4[1];
|
|
14009
|
+
var _useState5 = useState(),
|
|
14010
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
14011
|
+
selected = _useState6[0],
|
|
14012
|
+
setSelected = _useState6[1];
|
|
14013
|
+
var currentValue = useMemo(function () {
|
|
14014
|
+
if (!selected) return undefined;
|
|
14015
|
+
if (Array.isArray(selected)) return selected.map(function (item) {
|
|
14016
|
+
return item.value;
|
|
14017
|
+
});
|
|
14018
|
+
return selected.value;
|
|
14019
|
+
}, [selected]);
|
|
14020
|
+
useEffect(function () {
|
|
14021
|
+
if (configuredOptions) {
|
|
14022
|
+
if (apiHandler.canReadList) LOG$8.warn('If options are provided, apiInterface will not be used');
|
|
14023
|
+
setOptions(configuredOptions);
|
|
14024
|
+
setLoading(false);
|
|
14025
|
+
return;
|
|
14026
|
+
}
|
|
14027
|
+
if (!apiHandler.canReadList) throw Error('SelectSimple: apiInterface must have readList method');
|
|
14028
|
+
setLoading(true);
|
|
14029
|
+
apiHandler.readList(apiMapping).then(function (data) {
|
|
14030
|
+
var _data$data;
|
|
14031
|
+
if (_typeof((_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data[0]) == 'object' && !selectMapping) throw Error('SelectSimple: selectMapping is required when data is an object');
|
|
14032
|
+
var options = data.data.map(function (item) {
|
|
14033
|
+
return parseDataEntry(item, selectMapping);
|
|
14034
|
+
});
|
|
14035
|
+
setOptions(options);
|
|
14036
|
+
})["finally"](function () {
|
|
14037
|
+
setLoading(false);
|
|
14038
|
+
});
|
|
14039
|
+
}, []);
|
|
14040
|
+
useEffect(function () {
|
|
14041
|
+
// set the selected option only after the options are loaded
|
|
14042
|
+
if (value && options) {
|
|
14043
|
+
LOG$8.debug('value changed', value);
|
|
14044
|
+
setSelected(findByValue(value, options, selectMapping));
|
|
14045
|
+
}
|
|
14046
|
+
}, [value, options]);
|
|
14047
|
+
var onSelectionChanged = function onSelectionChanged(value, option) {
|
|
14048
|
+
setSelected(option);
|
|
14049
|
+
onChange === null || onChange === void 0 || onChange(parseReturnData(option, selectMapping));
|
|
14050
|
+
};
|
|
14051
|
+
var onClear = function onClear() {
|
|
14052
|
+
setSelected(undefined);
|
|
14053
|
+
onChange === null || onChange === void 0 || onChange(undefined);
|
|
14054
|
+
};
|
|
14055
|
+
return {
|
|
14056
|
+
loading: loading,
|
|
14057
|
+
options: options,
|
|
14058
|
+
value: currentValue,
|
|
14059
|
+
onChange: onSelectionChanged,
|
|
14060
|
+
onClear: onClear
|
|
14061
|
+
};
|
|
14062
|
+
}
|
|
14063
|
+
|
|
14064
|
+
/**
|
|
14065
|
+
* Returns the option(s) that match the given external value
|
|
14066
|
+
*/
|
|
14067
|
+
function findByValue(value, options, selectMapping) {
|
|
14068
|
+
if (!value) return undefined;
|
|
14069
|
+
if (Array.isArray(value)) return value.map(function (item) {
|
|
14070
|
+
return findByValue(item, options, selectMapping);
|
|
14071
|
+
});
|
|
14072
|
+
// if the externalValue is value we can compare it directly, otherwise we have to parse both option.data and value with the selectMapping.value
|
|
14073
|
+
var option = options.find(function (option) {
|
|
14074
|
+
return (selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.externalValue) == 'value' ? option.value == value : getCombinedValues(option.data, selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.value) == getCombinedValues(value, selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.value);
|
|
14075
|
+
});
|
|
14076
|
+
if (!option) {
|
|
14077
|
+
LOG$8.debug('findByValue: option not found, add dummy option for current value', value, options);
|
|
14078
|
+
//TODO: if we and server side filtering, the dummy option must be handled differently
|
|
14079
|
+
option = {
|
|
14080
|
+
label: (selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.externalValue) == 'value' ? value : getCombinedValues(value, selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.label),
|
|
14081
|
+
value: (selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.externalValue) == 'value' ? value : getCombinedValues(value, selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.value),
|
|
14082
|
+
data: value,
|
|
14083
|
+
isDummy: true
|
|
14084
|
+
};
|
|
14085
|
+
}
|
|
14086
|
+
return option;
|
|
14087
|
+
}
|
|
14088
|
+
|
|
14089
|
+
/**
|
|
14090
|
+
* Returns an option entry based on the selectMapping configuration
|
|
14091
|
+
*/
|
|
14092
|
+
function parseDataEntry(item, selectMapping) {
|
|
14093
|
+
return {
|
|
14094
|
+
label: selectMapping ? getCombinedValues(item, selectMapping.label) : item,
|
|
14095
|
+
value: selectMapping ? getCombinedValues(item, selectMapping.value) : item,
|
|
14096
|
+
data: item
|
|
14097
|
+
};
|
|
14098
|
+
}
|
|
14099
|
+
|
|
14100
|
+
/**
|
|
14101
|
+
* Returns the data of the selected option(s) based on the selectMapping configuration
|
|
14102
|
+
*/
|
|
14103
|
+
function parseReturnData(options, selectMapping) {
|
|
14104
|
+
if (Array.isArray(options)) return options.map(function (option) {
|
|
14105
|
+
return parseReturnData(option, selectMapping);
|
|
14106
|
+
});
|
|
14107
|
+
return (selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.externalValue) == 'value' ? options.value : options.data;
|
|
14108
|
+
}
|
|
14109
|
+
|
|
14110
|
+
var _excluded$3 = ["apiInterface", "selectMapping", "apiMapping", "onChange", "value", "search", "options"];
|
|
14111
|
+
function ownKeys$C(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; }
|
|
14112
|
+
function _objectSpread$C(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$C(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$C(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14113
|
+
var SelectWrapper$1 = function SelectWrapper(_ref) {
|
|
14114
|
+
var apiInterface = _ref.apiInterface,
|
|
14115
|
+
selectMapping = _ref.selectMapping,
|
|
14116
|
+
apiMapping = _ref.apiMapping,
|
|
14117
|
+
onChange = _ref.onChange,
|
|
14118
|
+
value = _ref.value,
|
|
14119
|
+
search = _ref.search,
|
|
14120
|
+
options = _ref.options,
|
|
14121
|
+
selectProps = _objectWithoutProperties(_ref, _excluded$3);
|
|
14122
|
+
var state = useSelectSimpleData({
|
|
14123
|
+
apiInterface: apiInterface,
|
|
14124
|
+
selectMapping: selectMapping,
|
|
14125
|
+
apiMapping: apiMapping,
|
|
14126
|
+
onChange: onChange,
|
|
14127
|
+
value: value,
|
|
14128
|
+
type: 'SelectSimple',
|
|
14129
|
+
options: options
|
|
14130
|
+
});
|
|
14131
|
+
return /*#__PURE__*/jsx(Select$1, _objectSpread$C(_objectSpread$C({}, selectProps), {}, {
|
|
14132
|
+
showSearch: search,
|
|
14133
|
+
loading: state.loading,
|
|
14134
|
+
options: state.options,
|
|
14135
|
+
value: state.value,
|
|
14136
|
+
onChange: state.onChange,
|
|
14137
|
+
onClear: state.onClear,
|
|
14138
|
+
filterOption: filterOption
|
|
14139
|
+
}));
|
|
14140
|
+
};
|
|
14141
|
+
var SimpleSelect = observer(SelectWrapper$1, {
|
|
14142
|
+
forwardRef: true
|
|
14143
|
+
});
|
|
14144
|
+
var filterOption = function filterOption(input, option) {
|
|
14145
|
+
var _option$label;
|
|
14146
|
+
return ((_option$label = option === null || option === void 0 ? void 0 : option.label) !== null && _option$label !== void 0 ? _option$label : '').toLowerCase().includes(input.toLowerCase());
|
|
14147
|
+
};
|
|
14148
|
+
|
|
14149
|
+
var RichTextEditor = function RichTextEditor(_ref) {
|
|
14150
|
+
var initValue = _ref.initValue,
|
|
14151
|
+
onChange = _ref.onChange,
|
|
14152
|
+
name = _ref.name;
|
|
14153
|
+
var val = useRef(initValue);
|
|
14154
|
+
return /*#__PURE__*/jsx(Editor, {
|
|
14155
|
+
apiKey: "m7260i0wfvki2sqkam6mfogklidxr229sk7499yjty92q8ww",
|
|
14156
|
+
onEditorChange: function onEditorChange(val, e) {
|
|
14157
|
+
onChange === null || onChange === void 0 || onChange(name, val);
|
|
14158
|
+
},
|
|
14159
|
+
initialValue: val.current,
|
|
14160
|
+
textareaName: "text",
|
|
14161
|
+
init: {
|
|
14162
|
+
height: 500,
|
|
14163
|
+
menubar: false,
|
|
14164
|
+
plugins: ['advlist autolink lists link table paste'],
|
|
14165
|
+
contextmenu: '',
|
|
14166
|
+
resize: false,
|
|
14167
|
+
statusbar: false,
|
|
14168
|
+
toolbar: 'undo redo | formatselect | ' + 'bold italic backcolor | alignleft aligncenter ' + 'alignright alignjustify | bullist numlist outdent indent | table ',
|
|
14169
|
+
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }'
|
|
14170
|
+
}
|
|
14171
|
+
});
|
|
14172
|
+
};
|
|
14436
14173
|
|
|
14437
14174
|
function _callSuper$1(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
14438
14175
|
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
@@ -15019,8 +14756,8 @@ var _default = /*#__PURE__*/function (_ApiHandler) {
|
|
|
15019
14756
|
}]);
|
|
15020
14757
|
}(_default$d);
|
|
15021
14758
|
|
|
15022
|
-
function ownKeys$
|
|
15023
|
-
function _objectSpread$
|
|
14759
|
+
function ownKeys$B(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; }
|
|
14760
|
+
function _objectSpread$B(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$B(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$B(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15024
14761
|
getLogger('Backoffice', 'SelectClientRelationCatalog');
|
|
15025
14762
|
function useSelectClientRelationCatalog (_ref) {
|
|
15026
14763
|
var onSelectedCatalog = _ref.onSelectedCatalog,
|
|
@@ -15189,7 +14926,7 @@ function useSelectClientRelationCatalog (_ref) {
|
|
|
15189
14926
|
case 22:
|
|
15190
14927
|
supplierData = _context2.sent;
|
|
15191
14928
|
case 23:
|
|
15192
|
-
onSelectedSupplier === null || onSelectedSupplier === void 0 || onSelectedSupplier(_objectSpread$
|
|
14929
|
+
onSelectedSupplier === null || onSelectedSupplier === void 0 || onSelectedSupplier(_objectSpread$B(_objectSpread$B({}, _selectedSupplier), {}, {
|
|
15193
14930
|
supplierGuid: catalogList === null || catalogList === void 0 || (_catalogList$ = catalogList[0]) === null || _catalogList$ === void 0 ? void 0 : _catalogList$.Subfolder
|
|
15194
14931
|
}), supplierData);
|
|
15195
14932
|
if (catalogId && catalogList.find(function (c) {
|
|
@@ -15255,8 +14992,8 @@ var customSelect = "custom-select-ESUJX";
|
|
|
15255
14992
|
var customSelectOption = "custom-select-option-dUA7N";
|
|
15256
14993
|
var avatarWrapper = "avatar-wrapper-Vg-xe";
|
|
15257
14994
|
var selectTextWrapper = "select-text-wrapper-hPSZW";
|
|
15258
|
-
var css_248z$
|
|
15259
|
-
styleInject(css_248z$
|
|
14995
|
+
var css_248z$k = ".custom-select-ESUJX {\n width: 300px;\n}\n\n.custom-select-option-dUA7N {\n margin: 0px 12px;\n padding: 5px 0px;\n border-bottom: 1px solid #ddd;\n}\n\n.avatar-wrapper-Vg-xe {\n margin-right: 5px;\n height: 100%;\n width: 24px;\n float: left;\n position: relative;\n}\n\n.avatar-wrapper-Vg-xe > span {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n}\n\n.select-text-wrapper-hPSZW {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: normal;\n width: calc(100% - 29px);\n}\n";
|
|
14996
|
+
styleInject(css_248z$k);
|
|
15260
14997
|
|
|
15261
14998
|
var Selector = function Selector(_ref) {
|
|
15262
14999
|
var items = _ref.items,
|
|
@@ -15407,202 +15144,915 @@ function SelectClientRelationCatalog (_ref) {
|
|
|
15407
15144
|
});
|
|
15408
15145
|
}
|
|
15409
15146
|
|
|
15410
|
-
var
|
|
15411
|
-
function
|
|
15412
|
-
|
|
15413
|
-
|
|
15414
|
-
|
|
15415
|
-
|
|
15416
|
-
|
|
15417
|
-
|
|
15418
|
-
|
|
15419
|
-
|
|
15420
|
-
|
|
15421
|
-
|
|
15422
|
-
|
|
15423
|
-
|
|
15424
|
-
|
|
15425
|
-
|
|
15426
|
-
|
|
15427
|
-
|
|
15428
|
-
|
|
15429
|
-
|
|
15430
|
-
|
|
15431
|
-
|
|
15432
|
-
|
|
15433
|
-
|
|
15434
|
-
|
|
15435
|
-
|
|
15436
|
-
var
|
|
15437
|
-
|
|
15438
|
-
|
|
15439
|
-
|
|
15440
|
-
|
|
15441
|
-
|
|
15442
|
-
|
|
15443
|
-
|
|
15147
|
+
function _createForOfIteratorHelper$h(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$h(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; } } }; }
|
|
15148
|
+
function _unsupportedIterableToArray$h(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$h(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$h(r, a) : void 0; } }
|
|
15149
|
+
function _arrayLikeToArray$h(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; }
|
|
15150
|
+
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; }
|
|
15151
|
+
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; }
|
|
15152
|
+
function useSelectData (_ref) {
|
|
15153
|
+
var data = _ref.data,
|
|
15154
|
+
onChange = _ref.onChange,
|
|
15155
|
+
onError = _ref.onError,
|
|
15156
|
+
apiInterface = _ref.apiInterface,
|
|
15157
|
+
selectMapping = _ref.selectMapping,
|
|
15158
|
+
mapping = _ref.mapping,
|
|
15159
|
+
mode = _ref.mode,
|
|
15160
|
+
allowCreate = _ref.allowCreate,
|
|
15161
|
+
flow = _ref.flow,
|
|
15162
|
+
translationPrefix = _ref.translationPrefix,
|
|
15163
|
+
values = _ref.values,
|
|
15164
|
+
wholeData = _ref.wholeData,
|
|
15165
|
+
disabledConfig = _ref.disabledConfig,
|
|
15166
|
+
hardOptions = _ref.hardOptions,
|
|
15167
|
+
_ref$applyDefaultValu = _ref.applyDefaultValue,
|
|
15168
|
+
applyDefaultValue = _ref$applyDefaultValu === void 0 ? true : _ref$applyDefaultValu,
|
|
15169
|
+
defaultValue = _ref.defaultValue,
|
|
15170
|
+
useFirstValueAsDefault = _ref.useFirstValueAsDefault,
|
|
15171
|
+
canSetToUndefined = _ref.canSetToUndefined;
|
|
15172
|
+
var root = useStore();
|
|
15173
|
+
var _useTranslation = useTranslation$1(),
|
|
15174
|
+
t = _useTranslation.t;
|
|
15175
|
+
var filterServerSide = _typeof(apiInterface) == 'object' && _typeof(apiInterface.read) == 'object' && apiInterface.read.filterServerSide;
|
|
15176
|
+
var _useMemo = useMemo(function () {
|
|
15177
|
+
return {
|
|
15178
|
+
apiHandler: new _default$d({
|
|
15179
|
+
type: 'SelectOrCreate',
|
|
15180
|
+
apiInterface: apiInterface
|
|
15181
|
+
}, root)
|
|
15182
|
+
};
|
|
15183
|
+
}, []),
|
|
15184
|
+
apiHandler = _useMemo.apiHandler;
|
|
15185
|
+
var fetchRef = React.useRef(0);
|
|
15186
|
+
var _React$useState = React.useState(false),
|
|
15187
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
15188
|
+
fetching = _React$useState2[0],
|
|
15189
|
+
setFetching = _React$useState2[1];
|
|
15190
|
+
var _React$useState3 = React.useState([]),
|
|
15191
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
15192
|
+
initOptions = _React$useState4[0],
|
|
15193
|
+
setInitOptions = _React$useState4[1];
|
|
15194
|
+
var _React$useState5 = React.useState([]),
|
|
15195
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
15196
|
+
options = _React$useState6[0],
|
|
15197
|
+
setOptions = _React$useState6[1];
|
|
15198
|
+
var _React$useState7 = React.useState([]),
|
|
15199
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
15200
|
+
selected = _React$useState8[0],
|
|
15201
|
+
setSelected = _React$useState8[1];
|
|
15202
|
+
var _React$useState9 = React.useState(data),
|
|
15203
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
15204
|
+
initalValue = _React$useState10[0],
|
|
15205
|
+
setInitValue = _React$useState10[1];
|
|
15206
|
+
var _useState = useState(false),
|
|
15207
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
15208
|
+
gettingDefaultValue = _useState2[0],
|
|
15209
|
+
setGettingDefaultValue = _useState2[1];
|
|
15210
|
+
useEffect(function () {
|
|
15211
|
+
if (!filterServerSide && apiHandler.canReadList) {
|
|
15212
|
+
setFetching(true);
|
|
15213
|
+
apiHandler.readList(mapping, wholeData).then(function (body) {
|
|
15214
|
+
var result = body === null || body === void 0 ? void 0 : body.data.map(function (d) {
|
|
15215
|
+
return {
|
|
15216
|
+
label: selectMapping !== null && selectMapping !== void 0 && selectMapping.label ? getCombinedValues(d, selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.label) : _typeof(d) == 'object' ? d._id : d,
|
|
15217
|
+
value: selectMapping !== null && selectMapping !== void 0 && selectMapping.value ? d[selectMapping.value] : _typeof(d) == 'object' ? d._id : d,
|
|
15218
|
+
data: d
|
|
15219
|
+
};
|
|
15220
|
+
});
|
|
15221
|
+
var opts = result.sort(function (a, b) {
|
|
15222
|
+
return a.label.localeCompare(b.label);
|
|
15223
|
+
});
|
|
15224
|
+
setOptions(opts);
|
|
15225
|
+
setInitOptions(opts);
|
|
15226
|
+
setFetching(false);
|
|
15227
|
+
});
|
|
15228
|
+
} else if (values) {
|
|
15229
|
+
setOptions(_toConsumableArray(values.map(function (v) {
|
|
15230
|
+
return {
|
|
15231
|
+
label: v,
|
|
15232
|
+
value: v,
|
|
15233
|
+
data: v,
|
|
15234
|
+
disabled: false
|
|
15235
|
+
};
|
|
15236
|
+
})));
|
|
15237
|
+
} else if (hardOptions) {
|
|
15238
|
+
setOptions(_toConsumableArray(hardOptions.map(function (v) {
|
|
15239
|
+
return {
|
|
15240
|
+
label: v.lable,
|
|
15241
|
+
value: v.value,
|
|
15242
|
+
data: v.data,
|
|
15243
|
+
disabled: v.disabled
|
|
15244
|
+
};
|
|
15245
|
+
})));
|
|
15246
|
+
}
|
|
15247
|
+
}, [wholeData]);
|
|
15248
|
+
useEffect(function () {
|
|
15249
|
+
if (!canSetToUndefined && (selected == undefined || selected.length == 0)) {
|
|
15250
|
+
doSetOptions();
|
|
15251
|
+
}
|
|
15252
|
+
}, [data]);
|
|
15253
|
+
useEffect(function () {
|
|
15254
|
+
if (!(selected !== null && selected !== void 0 && selected.length) && defaultValue && applyDefaultValue !== false) {
|
|
15255
|
+
setSelected([defaultValue]);
|
|
15256
|
+
}
|
|
15257
|
+
}, [defaultValue]);
|
|
15258
|
+
function doSetOptions() {
|
|
15259
|
+
var newData = data !== null && data !== void 0 ? data : defaultValue;
|
|
15260
|
+
if (newData != undefined && (!Array.isArray(newData) || newData.length != 0)) {
|
|
15261
|
+
if (initalValue == undefined) {
|
|
15262
|
+
setInitValue(newData);
|
|
15263
|
+
}
|
|
15264
|
+
var initData = isArray(newData) ? newData : [newData];
|
|
15265
|
+
var value = initData.map(function (d) {
|
|
15266
|
+
var _d$data, _d$_id, _d$selectMapping$valu, _d$data2, _ref2, _d$value, _d$data3;
|
|
15267
|
+
return {
|
|
15268
|
+
label: selectMapping !== null && selectMapping !== void 0 && selectMapping.label ? getCombinedValues((_d$data = d === null || d === void 0 ? void 0 : d.data) !== null && _d$data !== void 0 ? _d$data : d, selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.label) : _typeof(d) == 'object' ? (_d$_id = d._id) !== null && _d$_id !== void 0 ? _d$_id : d.label : translationPrefix ? t(translationPrefix + '.' + d) : d,
|
|
15269
|
+
value: selectMapping !== null && selectMapping !== void 0 && selectMapping.value ? (_d$selectMapping$valu = d === null || d === void 0 ? void 0 : d[selectMapping.value]) !== null && _d$selectMapping$valu !== void 0 ? _d$selectMapping$valu : d === null || d === void 0 || (_d$data2 = d.data) === null || _d$data2 === void 0 ? void 0 : _d$data2[selectMapping.value] : _typeof(d) == 'object' ? (_ref2 = (_d$value = d === null || d === void 0 ? void 0 : d.value) !== null && _d$value !== void 0 ? _d$value : d === null || d === void 0 || (_d$data3 = d.data) === null || _d$data3 === void 0 ? void 0 : _d$data3.value) !== null && _ref2 !== void 0 ? _ref2 : d === null || d === void 0 ? void 0 : d._id : d,
|
|
15270
|
+
data: d,
|
|
15271
|
+
disabled: false
|
|
15272
|
+
};
|
|
15273
|
+
});
|
|
15274
|
+
var val = value.length == 1 ? value[0].data : value;
|
|
15275
|
+
if (Array.isArray(val) && val.length) {
|
|
15276
|
+
val = val.map(function (v) {
|
|
15277
|
+
return v.data;
|
|
15278
|
+
});
|
|
15279
|
+
} else if (Array.isArray(val)) {
|
|
15280
|
+
val = initData;
|
|
15281
|
+
}
|
|
15282
|
+
if (flow && initData.length) {
|
|
15283
|
+
var _value$, _flow$value$0$value, _value$2;
|
|
15284
|
+
if (mode != 'single') {
|
|
15285
|
+
throw new Error('Flow is only implemented for single mode');
|
|
15286
|
+
}
|
|
15287
|
+
var missingFields = verifySelection((_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.value);
|
|
15288
|
+
if (missingFields.length) {
|
|
15289
|
+
onError === null || onError === void 0 || onError((missingFields === null || missingFields === void 0 ? void 0 : missingFields.join(', ')) + ' not set or wrong value');
|
|
15290
|
+
return;
|
|
15291
|
+
} else {
|
|
15292
|
+
onError === null || onError === void 0 || onError('');
|
|
15293
|
+
}
|
|
15294
|
+
var flowData = (flow === null || flow === void 0 || (_flow$value$0$value = flow[(_value$2 = value[0]) === null || _value$2 === void 0 ? void 0 : _value$2.value]) === null || _flow$value$0$value === void 0 ? void 0 : _flow$value$0$value.map(function (opt) {
|
|
15295
|
+
return {
|
|
15296
|
+
label: translationPrefix ? t(translationPrefix + '.' + opt) : opt.toString(),
|
|
15297
|
+
value: opt,
|
|
15298
|
+
data: opt
|
|
15299
|
+
};
|
|
15300
|
+
})) || [];
|
|
15301
|
+
var _defaultValue = initalValue !== null && initalValue !== void 0 ? initalValue : data;
|
|
15302
|
+
if (!flowData.find(function (fd) {
|
|
15303
|
+
return fd.value == _defaultValue;
|
|
15304
|
+
})) {
|
|
15305
|
+
flowData.push({
|
|
15306
|
+
label: translationPrefix ? t(translationPrefix + '.' + _defaultValue) : _defaultValue.toString(),
|
|
15307
|
+
value: _defaultValue,
|
|
15308
|
+
data: _defaultValue
|
|
15309
|
+
});
|
|
15310
|
+
}
|
|
15311
|
+
setOptions(_toConsumableArray(flowData));
|
|
15312
|
+
}
|
|
15313
|
+
onChange === null || onChange === void 0 || onChange(val, applyDefaultValue, defaultValue);
|
|
15314
|
+
setSelected(value);
|
|
15315
|
+
}
|
|
15316
|
+
}
|
|
15317
|
+
var loadOptions = /*#__PURE__*/function () {
|
|
15318
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(value) {
|
|
15319
|
+
var fetchId, newOptions, serverSideParams;
|
|
15320
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
15321
|
+
while (1) switch (_context.prev = _context.next) {
|
|
15322
|
+
case 0:
|
|
15323
|
+
fetchRef.current += 1;
|
|
15324
|
+
fetchId = fetchRef.current;
|
|
15325
|
+
if (!filterServerSide) {
|
|
15326
|
+
_context.next = 10;
|
|
15327
|
+
break;
|
|
15328
|
+
}
|
|
15329
|
+
setFetching(true);
|
|
15330
|
+
serverSideParams = {
|
|
15331
|
+
filters: selectMapping !== null && selectMapping !== void 0 && selectMapping.searchField ? selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.searchField.reduce(function (filter, field) {
|
|
15332
|
+
return _objectSpread$A(_objectSpread$A({}, filter), value !== undefined ? _defineProperty({}, field.field, [value, field.filter, true]) : {});
|
|
15333
|
+
}, {}) : {
|
|
15334
|
+
_id: [value, 'contains']
|
|
15335
|
+
},
|
|
15336
|
+
pagination: {
|
|
15337
|
+
pageSize: 100
|
|
15338
|
+
}
|
|
15339
|
+
};
|
|
15340
|
+
_context.next = 7;
|
|
15341
|
+
return apiHandler.readList(selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.prefilterMapping, wholeData, serverSideParams, undefined, selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.prefilter).then(function (body) {
|
|
15342
|
+
return (body === null || body === void 0 ? void 0 : body.data.map(function (data) {
|
|
15343
|
+
return {
|
|
15344
|
+
label: selectMapping !== null && selectMapping !== void 0 && selectMapping.label ? getCombinedValues(data, selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.label) : data._id,
|
|
15345
|
+
value: selectMapping !== null && selectMapping !== void 0 && selectMapping.value ? data[selectMapping.value] : data._id,
|
|
15346
|
+
disabled: false,
|
|
15347
|
+
data: data
|
|
15348
|
+
};
|
|
15349
|
+
})) || [];
|
|
15350
|
+
});
|
|
15351
|
+
case 7:
|
|
15352
|
+
newOptions = _context.sent;
|
|
15353
|
+
_context.next = 12;
|
|
15354
|
+
break;
|
|
15355
|
+
case 10:
|
|
15356
|
+
newOptions = initOptions.filter(function (opt) {
|
|
15357
|
+
var _value$toLocaleLowerC;
|
|
15358
|
+
return opt.label.toLocaleLowerCase().includes((_value$toLocaleLowerC = value === null || value === void 0 ? void 0 : value.toLocaleLowerCase()) !== null && _value$toLocaleLowerC !== void 0 ? _value$toLocaleLowerC : '');
|
|
15359
|
+
});
|
|
15360
|
+
if (allowCreate && !newOptions.length) {
|
|
15361
|
+
newOptions = [{
|
|
15362
|
+
data: value,
|
|
15363
|
+
label: value,
|
|
15364
|
+
disabled: false,
|
|
15365
|
+
value: value
|
|
15366
|
+
}];
|
|
15367
|
+
}
|
|
15368
|
+
case 12:
|
|
15369
|
+
if (!(fetchId !== fetchRef.current)) {
|
|
15370
|
+
_context.next = 14;
|
|
15371
|
+
break;
|
|
15372
|
+
}
|
|
15373
|
+
return _context.abrupt("return");
|
|
15374
|
+
case 14:
|
|
15375
|
+
setOptions(newOptions);
|
|
15376
|
+
setFetching(false);
|
|
15377
|
+
case 16:
|
|
15378
|
+
case "end":
|
|
15379
|
+
return _context.stop();
|
|
15380
|
+
}
|
|
15381
|
+
}, _callee);
|
|
15382
|
+
}));
|
|
15383
|
+
return function loadOptions(_x) {
|
|
15384
|
+
return _ref3.apply(this, arguments);
|
|
15385
|
+
};
|
|
15386
|
+
}();
|
|
15387
|
+
var fetch = React.useMemo(function () {
|
|
15388
|
+
return debounce(loadOptions, 800);
|
|
15389
|
+
}, [selectMapping, initOptions, wholeData]);
|
|
15390
|
+
var verifySelection = function verifySelection(opt) {
|
|
15391
|
+
if (disabledConfig == undefined) return [];
|
|
15392
|
+
var _missingFields = [];
|
|
15393
|
+
var _iterator = _createForOfIteratorHelper$h(disabledConfig),
|
|
15394
|
+
_step;
|
|
15395
|
+
try {
|
|
15396
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
15397
|
+
var disabled = _step.value;
|
|
15398
|
+
if (opt == (disabled === null || disabled === void 0 ? void 0 : disabled.value) && wholeData[disabled.onField.field] == disabled.onField.value) {
|
|
15399
|
+
if (!disabled.requiredFields) {
|
|
15400
|
+
return ['Job HQ', 'Job AR'];
|
|
15401
|
+
}
|
|
15402
|
+
disabled.requiredFields.forEach(function (fd) {
|
|
15403
|
+
if (typeof fd === 'string' && (wholeData[fd] === '' || wholeData[fd] === undefined)) {
|
|
15404
|
+
_missingFields.push(fd);
|
|
15405
|
+
} else if (_typeof(fd) == 'object') {
|
|
15406
|
+
if (!fd.value.some(function (v) {
|
|
15407
|
+
return v == wholeData[fd.field];
|
|
15408
|
+
})) {
|
|
15409
|
+
_missingFields.push(fd.field);
|
|
15410
|
+
}
|
|
15411
|
+
}
|
|
15412
|
+
});
|
|
15413
|
+
return _missingFields;
|
|
15414
|
+
}
|
|
15415
|
+
}
|
|
15416
|
+
} catch (err) {
|
|
15417
|
+
_iterator.e(err);
|
|
15418
|
+
} finally {
|
|
15419
|
+
_iterator.f();
|
|
15420
|
+
}
|
|
15421
|
+
return [];
|
|
15422
|
+
};
|
|
15423
|
+
|
|
15424
|
+
//state.configuration.dependencyRule.
|
|
15425
|
+
var onSelect = function onSelect(data) {
|
|
15426
|
+
//! tags works without labelInValue; data = string; get's converted to option afterwards in useeffect
|
|
15427
|
+
//because of a error in the typedefinition we have to cast it here
|
|
15428
|
+
var newSelected = data;
|
|
15429
|
+
var sel = selected;
|
|
15430
|
+
var option = options.find(function (o) {
|
|
15431
|
+
return o.value == newSelected.value;
|
|
15444
15432
|
});
|
|
15445
|
-
|
|
15446
|
-
|
|
15447
|
-
|
|
15448
|
-
|
|
15449
|
-
if (
|
|
15450
|
-
|
|
15451
|
-
|
|
15452
|
-
|
|
15433
|
+
if (option) {
|
|
15434
|
+
if (mode == 'tags') {
|
|
15435
|
+
throw new Error('select with options is not yet supported for mode tags');
|
|
15436
|
+
}
|
|
15437
|
+
if (mode == 'single') {
|
|
15438
|
+
var _option$data;
|
|
15439
|
+
if (flow) {
|
|
15440
|
+
var _flow$option$value;
|
|
15441
|
+
var missingFields = verifySelection(option.value);
|
|
15442
|
+
if (missingFields.length) {
|
|
15443
|
+
onError === null || onError === void 0 || onError((missingFields === null || missingFields === void 0 ? void 0 : missingFields.join(', ')) + ' not set or wrong value');
|
|
15444
|
+
return;
|
|
15445
|
+
} else {
|
|
15446
|
+
onError === null || onError === void 0 || onError('');
|
|
15447
|
+
}
|
|
15448
|
+
var flowData = (flow === null || flow === void 0 || (_flow$option$value = flow[option.value]) === null || _flow$option$value === void 0 ? void 0 : _flow$option$value.map(function (opt) {
|
|
15449
|
+
return {
|
|
15450
|
+
label: translationPrefix ? t(translationPrefix + '.' + opt) : opt.toString(),
|
|
15451
|
+
value: opt,
|
|
15452
|
+
data: opt
|
|
15453
|
+
};
|
|
15454
|
+
})) || [];
|
|
15455
|
+
var _defaultValue2 = initalValue !== null && initalValue !== void 0 ? initalValue : data;
|
|
15456
|
+
if (!flowData.find(function (fd) {
|
|
15457
|
+
return fd.value == _defaultValue2;
|
|
15458
|
+
})) {
|
|
15459
|
+
flowData.push({
|
|
15460
|
+
label: translationPrefix ? t(translationPrefix + '.' + _defaultValue2) : _defaultValue2.toString(),
|
|
15461
|
+
value: _defaultValue2,
|
|
15462
|
+
data: _defaultValue2
|
|
15463
|
+
});
|
|
15464
|
+
}
|
|
15465
|
+
setOptions(_toConsumableArray(flowData));
|
|
15466
|
+
}
|
|
15467
|
+
//if it is single mode there can always only be one selected or one new entry
|
|
15468
|
+
onChange === null || onChange === void 0 || onChange((_option$data = option === null || option === void 0 ? void 0 : option.data) !== null && _option$data !== void 0 ? _option$data : option, applyDefaultValue, defaultValue);
|
|
15469
|
+
setSelected([option]);
|
|
15470
|
+
} else {
|
|
15471
|
+
var selectedList = [].concat(_toConsumableArray(sel), [option]);
|
|
15472
|
+
setSelected(selectedList);
|
|
15473
|
+
onChange === null || onChange === void 0 || onChange(selectedList.map(function (s) {
|
|
15474
|
+
return s.data;
|
|
15475
|
+
}), applyDefaultValue, defaultValue);
|
|
15476
|
+
}
|
|
15477
|
+
} else {
|
|
15478
|
+
if (mode == 'tags' && typeof data === 'string') {
|
|
15479
|
+
onChange === null || onChange === void 0 || onChange([].concat(_toConsumableArray(sel.map(function (s) {
|
|
15480
|
+
return s.data;
|
|
15481
|
+
})), [data]), applyDefaultValue, defaultValue);
|
|
15482
|
+
setSelected([].concat(_toConsumableArray(sel), [data]));
|
|
15483
|
+
} else {
|
|
15484
|
+
throw new Error('select without options is not yet supported for modes other than tags');
|
|
15485
|
+
}
|
|
15453
15486
|
}
|
|
15454
|
-
|
|
15455
|
-
|
|
15456
|
-
|
|
15457
|
-
|
|
15458
|
-
|
|
15459
|
-
|
|
15460
|
-
|
|
15487
|
+
};
|
|
15488
|
+
|
|
15489
|
+
// if useFirstValueAsDefault is true we load the options and trigger an update with setGettingDefaultValue
|
|
15490
|
+
// at the 2. useEffect the options are loaded and set in state so we can set the first option
|
|
15491
|
+
useEffect(function () {
|
|
15492
|
+
if (useFirstValueAsDefault && !selected.length) {
|
|
15493
|
+
loadOptions(undefined).then(function () {
|
|
15494
|
+
return setGettingDefaultValue(true);
|
|
15461
15495
|
});
|
|
15462
|
-
|
|
15463
|
-
})["finally"](function () {
|
|
15464
|
-
setLoading(false);
|
|
15465
|
-
});
|
|
15496
|
+
}
|
|
15466
15497
|
}, []);
|
|
15467
15498
|
useEffect(function () {
|
|
15468
|
-
|
|
15469
|
-
|
|
15470
|
-
|
|
15471
|
-
|
|
15472
|
-
}
|
|
15473
|
-
}, [value, options]);
|
|
15474
|
-
var onSelectionChanged = function onSelectionChanged(value, option) {
|
|
15475
|
-
setSelected(option);
|
|
15476
|
-
onChange === null || onChange === void 0 || onChange(parseReturnData(option, selectMapping));
|
|
15499
|
+
if (gettingDefaultValue) onSelect(options[0]);
|
|
15500
|
+
}, [gettingDefaultValue]);
|
|
15501
|
+
var onFocus = function onFocus() {
|
|
15502
|
+
loadOptions(undefined);
|
|
15477
15503
|
};
|
|
15478
|
-
var
|
|
15479
|
-
|
|
15480
|
-
|
|
15504
|
+
var onRemove = function onRemove(data) {
|
|
15505
|
+
//because of a error in the typedefinition we have to cast it here
|
|
15506
|
+
var removed = data;
|
|
15507
|
+
var sel = selected;
|
|
15508
|
+
var newSelected;
|
|
15509
|
+
if (removed) {
|
|
15510
|
+
var index = sel.findIndex(function (s) {
|
|
15511
|
+
return s.value == removed.value;
|
|
15512
|
+
});
|
|
15513
|
+
newSelected = _toConsumableArray(sel);
|
|
15514
|
+
newSelected.splice(index, 1);
|
|
15515
|
+
} else {
|
|
15516
|
+
newSelected = [];
|
|
15517
|
+
}
|
|
15518
|
+
setSelected(newSelected);
|
|
15519
|
+
if (mode == 'single') {
|
|
15520
|
+
onChange === null || onChange === void 0 || onChange(undefined, applyDefaultValue, defaultValue);
|
|
15521
|
+
} else {
|
|
15522
|
+
onChange === null || onChange === void 0 || onChange(newSelected.map(function (s) {
|
|
15523
|
+
return s.data;
|
|
15524
|
+
}), applyDefaultValue, defaultValue);
|
|
15525
|
+
}
|
|
15481
15526
|
};
|
|
15482
15527
|
return {
|
|
15483
|
-
|
|
15528
|
+
fetching: fetching,
|
|
15484
15529
|
options: options,
|
|
15485
|
-
|
|
15486
|
-
|
|
15487
|
-
|
|
15488
|
-
|
|
15489
|
-
|
|
15490
|
-
|
|
15491
|
-
/**
|
|
15492
|
-
* Returns the option(s) that match the given external value
|
|
15493
|
-
*/
|
|
15494
|
-
function findByValue(value, options, selectMapping) {
|
|
15495
|
-
if (!value) return undefined;
|
|
15496
|
-
if (Array.isArray(value)) return value.map(function (item) {
|
|
15497
|
-
return findByValue(item, options, selectMapping);
|
|
15498
|
-
});
|
|
15499
|
-
// if the externalValue is value we can compare it directly, otherwise we have to parse both option.data and value with the selectMapping.value
|
|
15500
|
-
var option = options.find(function (option) {
|
|
15501
|
-
return (selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.externalValue) == 'value' ? option.value == value : getCombinedValues(option.data, selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.value) == getCombinedValues(value, selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.value);
|
|
15502
|
-
});
|
|
15503
|
-
if (!option) {
|
|
15504
|
-
LOG$8.debug('findByValue: option not found, add dummy option for current value', value, options);
|
|
15505
|
-
//TODO: if we and server side filtering, the dummy option must be handled differently
|
|
15506
|
-
option = {
|
|
15507
|
-
label: (selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.externalValue) == 'value' ? value : getCombinedValues(value, selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.label),
|
|
15508
|
-
value: (selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.externalValue) == 'value' ? value : getCombinedValues(value, selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.value),
|
|
15509
|
-
data: value,
|
|
15510
|
-
isDummy: true
|
|
15511
|
-
};
|
|
15512
|
-
}
|
|
15513
|
-
return option;
|
|
15514
|
-
}
|
|
15515
|
-
|
|
15516
|
-
/**
|
|
15517
|
-
* Returns an option entry based on the selectMapping configuration
|
|
15518
|
-
*/
|
|
15519
|
-
function parseDataEntry(item, selectMapping) {
|
|
15520
|
-
return {
|
|
15521
|
-
label: selectMapping ? getCombinedValues(item, selectMapping.label) : item,
|
|
15522
|
-
value: selectMapping ? getCombinedValues(item, selectMapping.value) : item,
|
|
15523
|
-
data: item
|
|
15530
|
+
selected: selected,
|
|
15531
|
+
fetch: fetch,
|
|
15532
|
+
onRemove: onRemove,
|
|
15533
|
+
onFocus: onFocus,
|
|
15534
|
+
onSelect: onSelect
|
|
15524
15535
|
};
|
|
15525
15536
|
}
|
|
15526
15537
|
|
|
15527
|
-
|
|
15528
|
-
|
|
15529
|
-
*/
|
|
15530
|
-
function parseReturnData(options, selectMapping) {
|
|
15531
|
-
if (Array.isArray(options)) return options.map(function (option) {
|
|
15532
|
-
return parseReturnData(option, selectMapping);
|
|
15533
|
-
});
|
|
15534
|
-
return (selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.externalValue) == 'value' ? options.value : options.data;
|
|
15535
|
-
}
|
|
15538
|
+
var css_248z$j = ".darkmode .ant-select-selection-search-input {\n color: #fff;\n}\n";
|
|
15539
|
+
styleInject(css_248z$j);
|
|
15536
15540
|
|
|
15537
|
-
var _excluded$3 = ["apiInterface", "selectMapping", "apiMapping", "onChange", "value", "search", "options"];
|
|
15538
|
-
function ownKeys$z(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; }
|
|
15539
|
-
function _objectSpread$z(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$z(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$z(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15540
15541
|
var SelectWrapper = function SelectWrapper(_ref) {
|
|
15541
|
-
var
|
|
15542
|
-
|
|
15543
|
-
apiMapping = _ref.apiMapping,
|
|
15544
|
-
onChange = _ref.onChange,
|
|
15542
|
+
var onChange = _ref.onChange,
|
|
15543
|
+
onError = _ref.onError,
|
|
15545
15544
|
value = _ref.value,
|
|
15545
|
+
apiInterface = _ref.apiInterface,
|
|
15546
|
+
selectMapping = _ref.selectMapping,
|
|
15547
|
+
mapping = _ref.mapping,
|
|
15548
|
+
mode = _ref.mode,
|
|
15549
|
+
initialValue = _ref.initialValue,
|
|
15550
|
+
minWidth = _ref.minWidth,
|
|
15551
|
+
allowCreate = _ref.allowCreate,
|
|
15552
|
+
allowClear = _ref.allowClear,
|
|
15546
15553
|
search = _ref.search,
|
|
15554
|
+
flow = _ref.flow,
|
|
15555
|
+
translationPrefix = _ref.translationPrefix,
|
|
15556
|
+
values = _ref.values,
|
|
15557
|
+
disabled = _ref.disabled,
|
|
15558
|
+
wholeData = _ref.wholeData,
|
|
15559
|
+
disabledConfig = _ref.disabledConfig,
|
|
15560
|
+
placeholder = _ref.placeholder,
|
|
15547
15561
|
options = _ref.options,
|
|
15548
|
-
|
|
15549
|
-
|
|
15562
|
+
applyDefaultValue = _ref.applyDefaultValue,
|
|
15563
|
+
useFirstValueAsDefault = _ref.useFirstValueAsDefault,
|
|
15564
|
+
canSetToUndefined = _ref.canSetToUndefined;
|
|
15565
|
+
var state = useSelectData({
|
|
15566
|
+
onChange: onChange,
|
|
15567
|
+
onError: onError,
|
|
15568
|
+
data: value,
|
|
15550
15569
|
apiInterface: apiInterface,
|
|
15551
15570
|
selectMapping: selectMapping,
|
|
15552
|
-
|
|
15553
|
-
|
|
15554
|
-
|
|
15555
|
-
|
|
15556
|
-
|
|
15571
|
+
mapping: mapping,
|
|
15572
|
+
mode: mode,
|
|
15573
|
+
allowCreate: allowCreate,
|
|
15574
|
+
defaultValue: initialValue,
|
|
15575
|
+
flow: flow,
|
|
15576
|
+
translationPrefix: translationPrefix,
|
|
15577
|
+
values: values,
|
|
15578
|
+
wholeData: wholeData,
|
|
15579
|
+
disabledConfig: disabledConfig,
|
|
15580
|
+
hardOptions: options,
|
|
15581
|
+
applyDefaultValue: applyDefaultValue,
|
|
15582
|
+
useFirstValueAsDefault: useFirstValueAsDefault,
|
|
15583
|
+
canSetToUndefined: canSetToUndefined
|
|
15557
15584
|
});
|
|
15558
|
-
|
|
15559
|
-
|
|
15560
|
-
|
|
15585
|
+
var _useTranslation = useTranslation$1(),
|
|
15586
|
+
t = _useTranslation.t;
|
|
15587
|
+
var filterServerSide = _typeof(apiInterface) == 'object' && _typeof(apiInterface.read) == 'object' && apiInterface.read.filterServerSide;
|
|
15588
|
+
var selected = state.selected;
|
|
15589
|
+
return /*#__PURE__*/jsx(Select$1, {
|
|
15590
|
+
labelInValue: mode === 'tags' ? false : true,
|
|
15591
|
+
style: {
|
|
15592
|
+
width: '100%',
|
|
15593
|
+
minWidth: minWidth
|
|
15594
|
+
},
|
|
15595
|
+
filterOption: false,
|
|
15596
|
+
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t('filter.global'),
|
|
15597
|
+
allowClear: allowClear !== null && allowClear !== void 0 ? allowClear : filterServerSide,
|
|
15598
|
+
showArrow: !filterServerSide || allowCreate || search,
|
|
15599
|
+
mode: mode == 'single' ? undefined : mode,
|
|
15600
|
+
showSearch: filterServerSide || allowCreate || search,
|
|
15601
|
+
onSearch: filterServerSide || allowCreate || search ? state.fetch : undefined,
|
|
15602
|
+
notFoundContent: state.fetching ? /*#__PURE__*/jsx(Spin, {
|
|
15603
|
+
size: "small"
|
|
15604
|
+
}) : null,
|
|
15561
15605
|
options: state.options,
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
|
|
15565
|
-
|
|
15566
|
-
|
|
15606
|
+
onSelect: state.onSelect,
|
|
15607
|
+
disabled: disabled,
|
|
15608
|
+
onDeselect: state.onRemove,
|
|
15609
|
+
onFocus: filterServerSide || allowCreate || search ? state.onFocus : undefined,
|
|
15610
|
+
onClear: state.onRemove,
|
|
15611
|
+
value: selected
|
|
15612
|
+
});
|
|
15567
15613
|
};
|
|
15568
|
-
var
|
|
15614
|
+
var Select = observer(SelectWrapper, {
|
|
15569
15615
|
forwardRef: true
|
|
15570
15616
|
});
|
|
15571
|
-
var filterOption = function filterOption(input, option) {
|
|
15572
|
-
var _option$label;
|
|
15573
|
-
return ((_option$label = option === null || option === void 0 ? void 0 : option.label) !== null && _option$label !== void 0 ? _option$label : '').toLowerCase().includes(input.toLowerCase());
|
|
15574
|
-
};
|
|
15575
15617
|
|
|
15576
|
-
var
|
|
15577
|
-
|
|
15578
|
-
|
|
15579
|
-
|
|
15580
|
-
|
|
15581
|
-
|
|
15582
|
-
|
|
15583
|
-
|
|
15584
|
-
|
|
15585
|
-
|
|
15586
|
-
|
|
15587
|
-
|
|
15588
|
-
|
|
15589
|
-
|
|
15590
|
-
|
|
15591
|
-
|
|
15592
|
-
|
|
15593
|
-
|
|
15594
|
-
|
|
15595
|
-
|
|
15596
|
-
|
|
15618
|
+
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; } } }; }
|
|
15619
|
+
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; } }
|
|
15620
|
+
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; }
|
|
15621
|
+
function ownKeys$z(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; }
|
|
15622
|
+
function _objectSpread$z(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$z(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$z(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15623
|
+
function getElement(item, data, setCanSave, state, _onChange, _onError, root, form, hidden, overwrittenName) {
|
|
15624
|
+
var _isReadonly, _state$hiddenRequired;
|
|
15625
|
+
if (hidden) return /*#__PURE__*/jsx(Fragment, {});
|
|
15626
|
+
var name = overwrittenName || item.name;
|
|
15627
|
+
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;
|
|
15628
|
+
switch (item.type) {
|
|
15629
|
+
case 'select':
|
|
15630
|
+
return /*#__PURE__*/jsx(Select, {
|
|
15631
|
+
initialValue: item.defaultValue,
|
|
15632
|
+
apiInterface: item.apiInterface,
|
|
15633
|
+
mode: item.mode,
|
|
15634
|
+
useFirstValueAsDefault: item.useFirstValueAsDefault,
|
|
15635
|
+
canSetToUndefined: item.canSetToUndefined,
|
|
15636
|
+
selectMapping: item.selectMapping,
|
|
15637
|
+
mapping: item.mapping,
|
|
15638
|
+
allowCreate: item.allowCreate,
|
|
15639
|
+
flow: item.flow,
|
|
15640
|
+
translationPrefix: item.translationPrefix,
|
|
15641
|
+
values: item.values,
|
|
15642
|
+
search: item.search,
|
|
15643
|
+
disabled: disabled,
|
|
15644
|
+
wholeData: state.data,
|
|
15645
|
+
disabledConfig: item === null || item === void 0 ? void 0 : item['disabledSelection'],
|
|
15646
|
+
onChange: function onChange(value) {
|
|
15647
|
+
_onChange(name, item.valueField ? value[item.valueField] : value);
|
|
15648
|
+
},
|
|
15649
|
+
allowClear: item.allowClear,
|
|
15650
|
+
placeholder: item.placeholder,
|
|
15651
|
+
onError: function onError(text) {
|
|
15652
|
+
return _onError(text, text);
|
|
15653
|
+
}
|
|
15654
|
+
});
|
|
15655
|
+
case 'selectSimple':
|
|
15656
|
+
return /*#__PURE__*/jsx(SimpleSelect, _objectSpread$z(_objectSpread$z({}, item), {}, {
|
|
15657
|
+
disabled: disabled,
|
|
15658
|
+
onChange: function onChange(value) {
|
|
15659
|
+
_onChange(name, value);
|
|
15660
|
+
}
|
|
15661
|
+
}));
|
|
15662
|
+
case 'textarea':
|
|
15663
|
+
return /*#__PURE__*/jsx(Input.TextArea, {
|
|
15664
|
+
disabled: disabled,
|
|
15665
|
+
autoSize: {
|
|
15666
|
+
minRows: 2,
|
|
15667
|
+
maxRows: 5
|
|
15668
|
+
},
|
|
15669
|
+
defaultValue: item.value,
|
|
15670
|
+
placeholder: item.placeholder,
|
|
15671
|
+
onChange: function onChange(e) {
|
|
15672
|
+
return _onChange === null || _onChange === void 0 ? void 0 : _onChange(name, e.target.value);
|
|
15673
|
+
}
|
|
15674
|
+
});
|
|
15675
|
+
case 'input':
|
|
15676
|
+
case 'password':
|
|
15677
|
+
case undefined:
|
|
15678
|
+
if (item.syncDataWithUserInput) {
|
|
15679
|
+
return /*#__PURE__*/jsx(InputComponent$1, {
|
|
15680
|
+
item: item,
|
|
15681
|
+
data: data,
|
|
15682
|
+
value: item.value,
|
|
15683
|
+
onChange: state.onInputChanged
|
|
15684
|
+
});
|
|
15685
|
+
}
|
|
15686
|
+
if (item.type == 'password') return /*#__PURE__*/jsx(Input.Password, {
|
|
15687
|
+
addonBefore: item.prefix,
|
|
15688
|
+
addonAfter: item.suffix,
|
|
15689
|
+
disabled: disabled,
|
|
15690
|
+
value: item.value,
|
|
15691
|
+
placeholder: item.placeholder,
|
|
15692
|
+
autoComplete: "new-password"
|
|
15693
|
+
});
|
|
15694
|
+
return /*#__PURE__*/jsx(Input, {
|
|
15695
|
+
addonBefore: item.prefix,
|
|
15696
|
+
addonAfter: item.suffix,
|
|
15697
|
+
disabled: disabled,
|
|
15698
|
+
value: item.value,
|
|
15699
|
+
placeholder: item.placeholder
|
|
15700
|
+
});
|
|
15701
|
+
case 'detailaction':
|
|
15702
|
+
return /*#__PURE__*/jsx(Button, {
|
|
15703
|
+
onClick: function onClick() {
|
|
15704
|
+
var _root$detailStore$ope, _root$detailStore;
|
|
15705
|
+
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, {
|
|
15706
|
+
configurationId: item.action.id,
|
|
15707
|
+
data: data,
|
|
15708
|
+
mappingData: data,
|
|
15709
|
+
callback: function callback(data) {
|
|
15710
|
+
if (!item.callbackMapping) return;
|
|
15711
|
+
var _iterator = _createForOfIteratorHelper$g(item.callbackMapping),
|
|
15712
|
+
_step;
|
|
15713
|
+
try {
|
|
15714
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
15715
|
+
var map = _step.value;
|
|
15716
|
+
form === null || form === void 0 || form.setFieldValue(map.sourceField, data[map.targetField]);
|
|
15717
|
+
}
|
|
15718
|
+
} catch (err) {
|
|
15719
|
+
_iterator.e(err);
|
|
15720
|
+
} finally {
|
|
15721
|
+
_iterator.f();
|
|
15722
|
+
}
|
|
15723
|
+
},
|
|
15724
|
+
title: item.action.label,
|
|
15725
|
+
type: item.action.type,
|
|
15726
|
+
description: item.action.description,
|
|
15727
|
+
footer: item.action.footer,
|
|
15728
|
+
width: item.action.width
|
|
15729
|
+
});
|
|
15730
|
+
},
|
|
15731
|
+
style: {
|
|
15732
|
+
width: '40%',
|
|
15733
|
+
marginLeft: '25%'
|
|
15734
|
+
},
|
|
15735
|
+
disabled: disabled,
|
|
15736
|
+
children: item.label
|
|
15737
|
+
});
|
|
15738
|
+
case 'richText':
|
|
15739
|
+
return /*#__PURE__*/jsx(RichTextEditor, {
|
|
15740
|
+
initValue: state.getData(name, data),
|
|
15741
|
+
name: name,
|
|
15742
|
+
onChange: _onChange
|
|
15743
|
+
});
|
|
15744
|
+
case 'number':
|
|
15745
|
+
return /*#__PURE__*/jsx(InputNumber, {
|
|
15746
|
+
disabled: disabled,
|
|
15747
|
+
value: item.value
|
|
15748
|
+
});
|
|
15749
|
+
case 'checkbox':
|
|
15750
|
+
return /*#__PURE__*/jsx(Checkbox, {
|
|
15751
|
+
disabled: disabled,
|
|
15752
|
+
value: item.value,
|
|
15753
|
+
onChange: function onChange(e) {
|
|
15754
|
+
var value = e.target.checked;
|
|
15755
|
+
var cbItem = item;
|
|
15756
|
+
if (value && cbItem !== null && cbItem !== void 0 && cbItem.valueOnEnabled) {
|
|
15757
|
+
value = root === null || root === void 0 ? void 0 : root.getGlobalValue(cbItem.valueOnEnabled.globalValue);
|
|
15758
|
+
}
|
|
15759
|
+
_onChange(name, value);
|
|
15760
|
+
}
|
|
15761
|
+
});
|
|
15762
|
+
case 'display':
|
|
15763
|
+
return /*#__PURE__*/jsx(DisplayInput, {
|
|
15764
|
+
translationPrefix: item.translationPrefix
|
|
15765
|
+
});
|
|
15766
|
+
case 'array':
|
|
15767
|
+
return /*#__PURE__*/jsx(FormList$3, {
|
|
15768
|
+
item: item,
|
|
15769
|
+
data: data,
|
|
15770
|
+
state: state,
|
|
15771
|
+
onError: _onError,
|
|
15772
|
+
root: root,
|
|
15773
|
+
setCanSave: setCanSave,
|
|
15774
|
+
form: form
|
|
15775
|
+
});
|
|
15776
|
+
case 'object':
|
|
15777
|
+
return /*#__PURE__*/jsx(JsonEditor$2, {
|
|
15778
|
+
setCanSave: setCanSave,
|
|
15779
|
+
data: data,
|
|
15780
|
+
height: item.height,
|
|
15781
|
+
savable: true
|
|
15782
|
+
});
|
|
15783
|
+
case 'date':
|
|
15784
|
+
return /*#__PURE__*/jsx(DatePicker, {
|
|
15785
|
+
disabled: disabled
|
|
15786
|
+
});
|
|
15787
|
+
case 'subTitle':
|
|
15788
|
+
return /*#__PURE__*/jsx(SubTitle$1, {
|
|
15789
|
+
item: item,
|
|
15790
|
+
data: data
|
|
15791
|
+
});
|
|
15792
|
+
case 'apiKey':
|
|
15793
|
+
return /*#__PURE__*/jsx(ApiKey, {
|
|
15794
|
+
value: item.value,
|
|
15795
|
+
placeholder: item.placeholder
|
|
15796
|
+
});
|
|
15797
|
+
case 'selectClientRelationCatalog':
|
|
15798
|
+
return /*#__PURE__*/jsx("div", {
|
|
15799
|
+
style: {
|
|
15800
|
+
display: 'flex',
|
|
15801
|
+
gap: 16
|
|
15802
|
+
},
|
|
15803
|
+
children: /*#__PURE__*/jsx(SelectClientRelationCatalog, {
|
|
15804
|
+
dontLoadCatalogData: true,
|
|
15805
|
+
onSelectedSupplier: function onSelectedSupplier(supplier) {
|
|
15806
|
+
if (item.accountName) {
|
|
15807
|
+
var newData = state.onInputChanged(item.accountName, supplier === null || supplier === void 0 ? void 0 : supplier._id);
|
|
15808
|
+
if (!supplier) {
|
|
15809
|
+
newData = state.onInputChanged(name, undefined, newData);
|
|
15810
|
+
if (item.catalogCodex) state.onInputChanged(item.catalogCodex, undefined, newData);
|
|
15811
|
+
}
|
|
15812
|
+
}
|
|
15813
|
+
},
|
|
15814
|
+
initAccountId: item.accountName ? state.getData(item.accountName, data) : undefined,
|
|
15815
|
+
initCatalogId: state.getData(name, data),
|
|
15816
|
+
currentOrganizationId: data._id,
|
|
15817
|
+
onSelectedCatalog: function onSelectedCatalog(catalogItem) {
|
|
15818
|
+
var newData = state.onInputChanged(name, catalogItem === null || catalogItem === void 0 ? void 0 : catalogItem._id);
|
|
15819
|
+
if (item.catalogCodex) state.onInputChanged(item.catalogCodex, catalogItem === null || catalogItem === void 0 ? void 0 : catalogItem.codex, newData);
|
|
15820
|
+
},
|
|
15821
|
+
onError: function onError(text) {
|
|
15822
|
+
return _onError(text, text);
|
|
15823
|
+
},
|
|
15824
|
+
apiInterface: item.apiInterface
|
|
15825
|
+
})
|
|
15826
|
+
});
|
|
15827
|
+
case 'radio':
|
|
15828
|
+
return /*#__PURE__*/jsx(Radio.Group, {
|
|
15829
|
+
value: item.value,
|
|
15830
|
+
options: item.options.map(function (o) {
|
|
15831
|
+
var _o$disabled;
|
|
15832
|
+
return _objectSpread$z(_objectSpread$z({}, o), {}, {
|
|
15833
|
+
disabled: (_o$disabled = o.disabled) === null || _o$disabled === void 0 ? void 0 : _o$disabled.call(o, data)
|
|
15834
|
+
});
|
|
15835
|
+
}),
|
|
15836
|
+
buttonStyle: item.buttonStyle,
|
|
15837
|
+
optionType: item.optionType,
|
|
15838
|
+
defaultValue: item.defaultValue,
|
|
15839
|
+
onChange: function onChange(_ref) {
|
|
15840
|
+
var value = _ref.target.value;
|
|
15841
|
+
_onChange(name, value);
|
|
15842
|
+
}
|
|
15843
|
+
});
|
|
15844
|
+
case 'button':
|
|
15845
|
+
return /*#__PURE__*/jsx(CustomButton$1, {
|
|
15846
|
+
id: item.buttonId,
|
|
15847
|
+
data: data,
|
|
15848
|
+
useActionResult: {
|
|
15849
|
+
styles: true,
|
|
15850
|
+
message: true
|
|
15851
|
+
},
|
|
15852
|
+
icon: item.icon,
|
|
15853
|
+
callback: function callback(data) {
|
|
15854
|
+
return form === null || form === void 0 ? void 0 : form.setFieldsValue(_objectSpread$z(_objectSpread$z({}, state.data), data));
|
|
15855
|
+
}
|
|
15856
|
+
});
|
|
15857
|
+
default:
|
|
15858
|
+
return /*#__PURE__*/jsx(Fragment, {});
|
|
15859
|
+
}
|
|
15860
|
+
}
|
|
15861
|
+
function DisplayInput(props) {
|
|
15862
|
+
var _useTranslation = useTranslation(),
|
|
15863
|
+
t = _useTranslation.t;
|
|
15864
|
+
return /*#__PURE__*/jsx(Input, _objectSpread$z(_objectSpread$z({}, props), {}, {
|
|
15865
|
+
disabled: true,
|
|
15866
|
+
value: t(props.translationPrefix + '.' + props.value)
|
|
15867
|
+
}));
|
|
15868
|
+
}
|
|
15869
|
+
function isReadonly(item, data) {
|
|
15870
|
+
if (_typeof(item.readonly) != 'object') {
|
|
15871
|
+
return item.readonly;
|
|
15872
|
+
}
|
|
15873
|
+
var flatData = flatten(data);
|
|
15874
|
+
if (!item.readonly.op && flatData[item.readonly.field] == item.readonly.value) {
|
|
15875
|
+
return true;
|
|
15876
|
+
} else if (item.readonly.op == 'gt' && flatData[item.readonly.field] > item.readonly.value) {
|
|
15877
|
+
return true;
|
|
15878
|
+
}
|
|
15879
|
+
return false;
|
|
15880
|
+
}
|
|
15881
|
+
|
|
15882
|
+
function ownKeys$y(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; }
|
|
15883
|
+
function _objectSpread$y(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$y(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$y(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15884
|
+
function _createForOfIteratorHelper$f(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$f(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; } } }; }
|
|
15885
|
+
function _unsupportedIterableToArray$f(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$f(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$f(r, a) : void 0; } }
|
|
15886
|
+
function _arrayLikeToArray$f(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; }
|
|
15887
|
+
var Presets = function Presets(_ref) {
|
|
15888
|
+
var state = _ref.state,
|
|
15889
|
+
apiHandler = _ref.apiHandler,
|
|
15890
|
+
form = _ref.form,
|
|
15891
|
+
root = _ref.root,
|
|
15892
|
+
setUsedPreset = _ref.setUsedPreset,
|
|
15893
|
+
presets = _ref.presets,
|
|
15894
|
+
setPresets = _ref.setPresets;
|
|
15895
|
+
var Option = Select$1.Option;
|
|
15896
|
+
var _useState = useState(false),
|
|
15897
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
15898
|
+
isModalVisible = _useState2[0],
|
|
15899
|
+
setIsModalVisible = _useState2[1];
|
|
15900
|
+
var _useState3 = useState(''),
|
|
15901
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
15902
|
+
newPresetName = _useState4[0],
|
|
15903
|
+
setNewPresetName = _useState4[1];
|
|
15904
|
+
var _useState5 = useState(),
|
|
15905
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
15906
|
+
value = _useState6[0],
|
|
15907
|
+
setValue = _useState6[1];
|
|
15908
|
+
var _useState7 = useState([]),
|
|
15909
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
15910
|
+
presetIds = _useState8[0],
|
|
15911
|
+
setPresetIds = _useState8[1];
|
|
15912
|
+
var _useTranslation = useTranslation$1(),
|
|
15913
|
+
t = _useTranslation.t;
|
|
15914
|
+
useEffect(function () {
|
|
15915
|
+
getPresets();
|
|
15916
|
+
}, []);
|
|
15917
|
+
var savePreset = function savePreset() {
|
|
15918
|
+
if (state.selectedItems == undefined) return;
|
|
15919
|
+
setIsModalVisible(false);
|
|
15920
|
+
var names = [];
|
|
15921
|
+
var _iterator = _createForOfIteratorHelper$f(state.selectedItems),
|
|
15922
|
+
_step;
|
|
15923
|
+
try {
|
|
15924
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
15925
|
+
var item = _step.value;
|
|
15926
|
+
names.push(item.name);
|
|
15927
|
+
}
|
|
15928
|
+
} catch (err) {
|
|
15929
|
+
_iterator.e(err);
|
|
15930
|
+
} finally {
|
|
15931
|
+
_iterator.f();
|
|
15597
15932
|
}
|
|
15933
|
+
var data = _objectSpread$y(_objectSpread$y({}, form.getFieldsValue(names)), {}, {
|
|
15934
|
+
newPresetName: newPresetName
|
|
15935
|
+
});
|
|
15936
|
+
data.dpi = parseInt(data.dpi);
|
|
15937
|
+
data.organization = root.getGlobalValue('organizationId');
|
|
15938
|
+
apiHandler.create({}, state.configuration.createPresetMapping, data);
|
|
15939
|
+
var dt = _objectSpread$y(_objectSpread$y({}, form.getFieldsValue(names)), {}, {
|
|
15940
|
+
name: newPresetName
|
|
15941
|
+
});
|
|
15942
|
+
setPresets({
|
|
15943
|
+
data: [dt].concat(_toConsumableArray(presets.data)),
|
|
15944
|
+
total: presets.total
|
|
15945
|
+
});
|
|
15946
|
+
};
|
|
15947
|
+
var getPresets = /*#__PURE__*/function () {
|
|
15948
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
15949
|
+
var res, ids, preset;
|
|
15950
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
15951
|
+
while (1) switch (_context.prev = _context.next) {
|
|
15952
|
+
case 0:
|
|
15953
|
+
_context.next = 2;
|
|
15954
|
+
return apiHandler.readList();
|
|
15955
|
+
case 2:
|
|
15956
|
+
res = _context.sent;
|
|
15957
|
+
ids = [];
|
|
15958
|
+
for (preset in res.data) {
|
|
15959
|
+
ids.push(res.data[preset]._id);
|
|
15960
|
+
delete res.data[preset]._id;
|
|
15961
|
+
}
|
|
15962
|
+
setPresetIds(ids);
|
|
15963
|
+
setPresets(res);
|
|
15964
|
+
case 7:
|
|
15965
|
+
case "end":
|
|
15966
|
+
return _context.stop();
|
|
15967
|
+
}
|
|
15968
|
+
}, _callee);
|
|
15969
|
+
}));
|
|
15970
|
+
return function getPresets() {
|
|
15971
|
+
return _ref2.apply(this, arguments);
|
|
15972
|
+
};
|
|
15973
|
+
}();
|
|
15974
|
+
var onPresetSelect = function onPresetSelect(index) {
|
|
15975
|
+
var preset = presets.data[index];
|
|
15976
|
+
if (!state.selectedItems) return;
|
|
15977
|
+
state.selectedItems.map(function (item) {
|
|
15978
|
+
if (isReadonly(item, form.getFieldsValue())) {
|
|
15979
|
+
delete preset[item.name];
|
|
15980
|
+
}
|
|
15981
|
+
});
|
|
15982
|
+
form.setFieldsValue(presets.data[index]);
|
|
15983
|
+
setUsedPreset({
|
|
15984
|
+
used: true,
|
|
15985
|
+
index: index
|
|
15986
|
+
});
|
|
15987
|
+
};
|
|
15988
|
+
var deletePreset = function deletePreset(index) {
|
|
15989
|
+
apiHandler["delete"](presetIds[index]);
|
|
15990
|
+
var data = presets.data;
|
|
15991
|
+
data.splice(index, 1);
|
|
15992
|
+
setPresets({
|
|
15993
|
+
data: data,
|
|
15994
|
+
total: presets.total
|
|
15995
|
+
});
|
|
15996
|
+
setValue(undefined);
|
|
15997
|
+
};
|
|
15998
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
15999
|
+
children: [/*#__PURE__*/jsx(Select$1, {
|
|
16000
|
+
showSearch: true,
|
|
16001
|
+
value: value,
|
|
16002
|
+
placeholder: t('backoffice.form.presets.placeholder'),
|
|
16003
|
+
optionFilterProp: "children",
|
|
16004
|
+
style: {
|
|
16005
|
+
width: '94%',
|
|
16006
|
+
paddingLeft: 0,
|
|
16007
|
+
marginBottom: 30
|
|
16008
|
+
},
|
|
16009
|
+
onChange: function onChange(index) {
|
|
16010
|
+
setValue(index);
|
|
16011
|
+
onPresetSelect(index);
|
|
16012
|
+
},
|
|
16013
|
+
children: presets === null || presets === void 0 ? void 0 : presets.data.map(function (dt, idx) {
|
|
16014
|
+
return /*#__PURE__*/jsxs(Option, {
|
|
16015
|
+
value: idx,
|
|
16016
|
+
children: [dt.name, /*#__PURE__*/jsx(Button, {
|
|
16017
|
+
icon: /*#__PURE__*/jsx(DeleteOutlined, {}),
|
|
16018
|
+
style: {
|
|
16019
|
+
"float": 'right'
|
|
16020
|
+
},
|
|
16021
|
+
onClick: function onClick() {
|
|
16022
|
+
return deletePreset(idx);
|
|
16023
|
+
}
|
|
16024
|
+
})]
|
|
16025
|
+
}, idx);
|
|
16026
|
+
})
|
|
16027
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
16028
|
+
type: "primary",
|
|
16029
|
+
onClick: function onClick() {
|
|
16030
|
+
return setIsModalVisible(true);
|
|
16031
|
+
},
|
|
16032
|
+
children: "Create"
|
|
16033
|
+
}), /*#__PURE__*/jsx(Modal$2, {
|
|
16034
|
+
title: "Create Preset",
|
|
16035
|
+
visible: isModalVisible,
|
|
16036
|
+
onOk: function onOk(e) {
|
|
16037
|
+
return savePreset();
|
|
16038
|
+
},
|
|
16039
|
+
onCancel: function onCancel() {
|
|
16040
|
+
return setIsModalVisible(false);
|
|
16041
|
+
},
|
|
16042
|
+
children: /*#__PURE__*/jsx(Input, {
|
|
16043
|
+
value: newPresetName,
|
|
16044
|
+
placeholder: "Preset Name",
|
|
16045
|
+
onChange: function onChange(e) {
|
|
16046
|
+
setNewPresetName(e.target.value);
|
|
16047
|
+
},
|
|
16048
|
+
style: {
|
|
16049
|
+
marginBottom: 15
|
|
16050
|
+
}
|
|
16051
|
+
})
|
|
16052
|
+
})]
|
|
15598
16053
|
});
|
|
15599
16054
|
};
|
|
15600
16055
|
|
|
15601
|
-
function _createForOfIteratorHelper$f(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$f(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; } } }; }
|
|
15602
|
-
function _unsupportedIterableToArray$f(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$f(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$f(r, a) : void 0; } }
|
|
15603
|
-
function _arrayLikeToArray$f(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; }
|
|
15604
|
-
function ownKeys$y(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; }
|
|
15605
|
-
function _objectSpread$y(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$y(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$y(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15606
16056
|
var LOG$7 = getLogger('Backoffice', 'Form');
|
|
15607
16057
|
var FormWrapper$1 = function FormWrapper(_ref, ref) {
|
|
15608
16058
|
var _state$selectedItems2;
|
|
@@ -15717,9 +16167,6 @@ var FormWrapper$1 = function FormWrapper(_ref, ref) {
|
|
|
15717
16167
|
return _ref4.apply(this, arguments);
|
|
15718
16168
|
};
|
|
15719
16169
|
}();
|
|
15720
|
-
var updateFormData = function updateFormData(data) {
|
|
15721
|
-
form.setFieldsValue(_objectSpread$y(_objectSpread$y({}, state.data), data));
|
|
15722
|
-
};
|
|
15723
16170
|
var onErrorInternal = function onErrorInternal(err, errorText) {
|
|
15724
16171
|
if (err instanceof DivaError && err.name) {
|
|
15725
16172
|
var _state$configuration$;
|
|
@@ -15750,263 +16197,6 @@ var FormWrapper$1 = function FormWrapper(_ref, ref) {
|
|
|
15750
16197
|
onErrorInternal('An unexpected error prevented finishing');
|
|
15751
16198
|
}
|
|
15752
16199
|
};
|
|
15753
|
-
function getRules(item, data) {
|
|
15754
|
-
var _item$rules;
|
|
15755
|
-
var rules = [];
|
|
15756
|
-
if (item.required != undefined) {
|
|
15757
|
-
var _state$hiddenRequired;
|
|
15758
|
-
rules.push({
|
|
15759
|
-
required: (_state$hiddenRequired = state.hiddenRequiredDisabled[typeof item.name == 'string' ? item.name : item.name.join('.')]) === null || _state$hiddenRequired === void 0 ? void 0 : _state$hiddenRequired.required
|
|
15760
|
-
});
|
|
15761
|
-
}
|
|
15762
|
-
if (((_item$rules = item.rules) === null || _item$rules === void 0 ? void 0 : _item$rules.type) == 'condition') {
|
|
15763
|
-
var condition = item.rules;
|
|
15764
|
-
var flatData = flatten(data);
|
|
15765
|
-
if (!condition.match.op && flatData[condition.match.field] == condition.match.value) {
|
|
15766
|
-
rules.push.apply(rules, _toConsumableArray(condition.rules));
|
|
15767
|
-
} else if (condition.match.op == 'gt' && flatData[condition.match.field] > condition.match.value) {
|
|
15768
|
-
rules.push.apply(rules, _toConsumableArray(condition.rules));
|
|
15769
|
-
}
|
|
15770
|
-
} else if (item.rules) {
|
|
15771
|
-
rules.push.apply(rules, _toConsumableArray(item.rules));
|
|
15772
|
-
}
|
|
15773
|
-
return rules;
|
|
15774
|
-
}
|
|
15775
|
-
function getLabel(item) {
|
|
15776
|
-
if (!item.label && item.type === 'button') return undefined;
|
|
15777
|
-
return item.label ? t(item.label, item.label) : item.name;
|
|
15778
|
-
}
|
|
15779
|
-
function getElement(item, data, setCanSave, state, _onChange, root, form, hidden, overwrittenName) {
|
|
15780
|
-
var _isReadonly, _state$hiddenRequired2;
|
|
15781
|
-
if (hidden) return /*#__PURE__*/jsx(Fragment, {});
|
|
15782
|
-
var name = overwrittenName || item.name;
|
|
15783
|
-
var disabled = (_isReadonly = isReadonly(item, data)) !== null && _isReadonly !== void 0 ? _isReadonly : (_state$hiddenRequired2 = state.hiddenRequiredDisabled[typeof name == 'string' ? name : name.join('.')]) === null || _state$hiddenRequired2 === void 0 ? void 0 : _state$hiddenRequired2.disabled;
|
|
15784
|
-
switch (item.type) {
|
|
15785
|
-
case 'select':
|
|
15786
|
-
return /*#__PURE__*/jsx(Select, {
|
|
15787
|
-
initialValue: item.defaultValue,
|
|
15788
|
-
apiInterface: item.apiInterface,
|
|
15789
|
-
mode: item.mode,
|
|
15790
|
-
useFirstValueAsDefault: item.useFirstValueAsDefault,
|
|
15791
|
-
canSetToUndefined: item.canSetToUndefined,
|
|
15792
|
-
selectMapping: item.selectMapping,
|
|
15793
|
-
mapping: item.mapping,
|
|
15794
|
-
allowCreate: item.allowCreate,
|
|
15795
|
-
flow: item.flow,
|
|
15796
|
-
translationPrefix: item.translationPrefix,
|
|
15797
|
-
values: item.values,
|
|
15798
|
-
search: item.search,
|
|
15799
|
-
disabled: disabled,
|
|
15800
|
-
wholeData: state.data,
|
|
15801
|
-
disabledConfig: item === null || item === void 0 ? void 0 : item['disabledSelection'],
|
|
15802
|
-
onChange: function onChange(value) {
|
|
15803
|
-
_onChange(name, item.valueField ? value[item.valueField] : value);
|
|
15804
|
-
},
|
|
15805
|
-
allowClear: item.allowClear,
|
|
15806
|
-
placeholder: item.placeholder,
|
|
15807
|
-
onError: function onError(text) {
|
|
15808
|
-
return onErrorInternal(text, text);
|
|
15809
|
-
}
|
|
15810
|
-
}, state.selectedItemsIndex);
|
|
15811
|
-
case 'selectSimple':
|
|
15812
|
-
return /*#__PURE__*/jsx(SimpleSelect, _objectSpread$y(_objectSpread$y({}, item), {}, {
|
|
15813
|
-
disabled: disabled,
|
|
15814
|
-
onChange: function onChange(value) {
|
|
15815
|
-
_onChange(name, value);
|
|
15816
|
-
}
|
|
15817
|
-
}));
|
|
15818
|
-
case 'textarea':
|
|
15819
|
-
return /*#__PURE__*/jsx(Input.TextArea, {
|
|
15820
|
-
disabled: disabled,
|
|
15821
|
-
autoSize: {
|
|
15822
|
-
minRows: 2,
|
|
15823
|
-
maxRows: 5
|
|
15824
|
-
},
|
|
15825
|
-
defaultValue: item.value,
|
|
15826
|
-
placeholder: item.placeholder,
|
|
15827
|
-
onChange: function onChange(e) {
|
|
15828
|
-
return _onChange === null || _onChange === void 0 ? void 0 : _onChange(name, e.target.value);
|
|
15829
|
-
}
|
|
15830
|
-
});
|
|
15831
|
-
case 'input':
|
|
15832
|
-
case 'password':
|
|
15833
|
-
case undefined:
|
|
15834
|
-
if (item.syncDataWithUserInput) {
|
|
15835
|
-
return /*#__PURE__*/jsx(InputComponent$1, {
|
|
15836
|
-
item: item,
|
|
15837
|
-
data: data,
|
|
15838
|
-
value: item.value,
|
|
15839
|
-
onChange: state.onInputChanged
|
|
15840
|
-
});
|
|
15841
|
-
}
|
|
15842
|
-
if (item.type == 'password') return /*#__PURE__*/jsx(Input.Password, {
|
|
15843
|
-
addonBefore: item.prefix,
|
|
15844
|
-
addonAfter: item.suffix,
|
|
15845
|
-
disabled: disabled,
|
|
15846
|
-
value: item.value,
|
|
15847
|
-
placeholder: item.placeholder,
|
|
15848
|
-
autoComplete: "new-password"
|
|
15849
|
-
});
|
|
15850
|
-
return /*#__PURE__*/jsx(Input, {
|
|
15851
|
-
addonBefore: item.prefix,
|
|
15852
|
-
addonAfter: item.suffix,
|
|
15853
|
-
disabled: disabled,
|
|
15854
|
-
value: item.value,
|
|
15855
|
-
placeholder: item.placeholder
|
|
15856
|
-
});
|
|
15857
|
-
case 'detailaction':
|
|
15858
|
-
return /*#__PURE__*/jsx(Button, {
|
|
15859
|
-
onClick: function onClick() {
|
|
15860
|
-
var _root$detailStore$ope, _root$detailStore;
|
|
15861
|
-
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, {
|
|
15862
|
-
configurationId: item.action.id,
|
|
15863
|
-
data: data,
|
|
15864
|
-
mappingData: data,
|
|
15865
|
-
callback: function callback(data) {
|
|
15866
|
-
if (!item.callbackMapping) return;
|
|
15867
|
-
var _iterator = _createForOfIteratorHelper$f(item.callbackMapping),
|
|
15868
|
-
_step;
|
|
15869
|
-
try {
|
|
15870
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
15871
|
-
var map = _step.value;
|
|
15872
|
-
form === null || form === void 0 || form.setFieldValue(map.sourceField, data[map.targetField]);
|
|
15873
|
-
}
|
|
15874
|
-
} catch (err) {
|
|
15875
|
-
_iterator.e(err);
|
|
15876
|
-
} finally {
|
|
15877
|
-
_iterator.f();
|
|
15878
|
-
}
|
|
15879
|
-
},
|
|
15880
|
-
title: item.action.label,
|
|
15881
|
-
type: item.action.type,
|
|
15882
|
-
description: item.action.description,
|
|
15883
|
-
footer: item.action.footer,
|
|
15884
|
-
width: item.action.width
|
|
15885
|
-
});
|
|
15886
|
-
},
|
|
15887
|
-
style: {
|
|
15888
|
-
width: '40%',
|
|
15889
|
-
marginLeft: '25%'
|
|
15890
|
-
},
|
|
15891
|
-
disabled: disabled,
|
|
15892
|
-
children: item.label
|
|
15893
|
-
});
|
|
15894
|
-
case 'richText':
|
|
15895
|
-
return /*#__PURE__*/jsx(RichTextEditor, {
|
|
15896
|
-
initValue: state.getData(name, data),
|
|
15897
|
-
name: name,
|
|
15898
|
-
onChange: _onChange
|
|
15899
|
-
});
|
|
15900
|
-
case 'number':
|
|
15901
|
-
return /*#__PURE__*/jsx(InputNumber, {
|
|
15902
|
-
disabled: disabled,
|
|
15903
|
-
value: item.value
|
|
15904
|
-
});
|
|
15905
|
-
case 'checkbox':
|
|
15906
|
-
return /*#__PURE__*/jsx(Checkbox, {
|
|
15907
|
-
disabled: disabled,
|
|
15908
|
-
value: item.value,
|
|
15909
|
-
onChange: function onChange(e) {
|
|
15910
|
-
var value = e.target.checked;
|
|
15911
|
-
var cbItem = item;
|
|
15912
|
-
if (value && cbItem !== null && cbItem !== void 0 && cbItem.valueOnEnabled) {
|
|
15913
|
-
value = root === null || root === void 0 ? void 0 : root.getGlobalValue(cbItem.valueOnEnabled.globalValue);
|
|
15914
|
-
}
|
|
15915
|
-
_onChange(name, value);
|
|
15916
|
-
}
|
|
15917
|
-
});
|
|
15918
|
-
case 'display':
|
|
15919
|
-
return /*#__PURE__*/jsx(DisplayInput, {
|
|
15920
|
-
translationPrefix: item.translationPrefix
|
|
15921
|
-
});
|
|
15922
|
-
case 'array':
|
|
15923
|
-
return /*#__PURE__*/jsx(FormList, {
|
|
15924
|
-
item: item,
|
|
15925
|
-
data: data
|
|
15926
|
-
});
|
|
15927
|
-
case 'object':
|
|
15928
|
-
return /*#__PURE__*/jsx(JsonEditor$2, {
|
|
15929
|
-
setCanSave: setCanSave,
|
|
15930
|
-
data: data,
|
|
15931
|
-
height: item.height,
|
|
15932
|
-
savable: true
|
|
15933
|
-
});
|
|
15934
|
-
case 'date':
|
|
15935
|
-
return /*#__PURE__*/jsx(DatePicker, {
|
|
15936
|
-
disabled: disabled
|
|
15937
|
-
});
|
|
15938
|
-
case 'subTitle':
|
|
15939
|
-
return /*#__PURE__*/jsx(SubTitle$1, {
|
|
15940
|
-
item: item,
|
|
15941
|
-
data: data
|
|
15942
|
-
});
|
|
15943
|
-
case 'apiKey':
|
|
15944
|
-
return /*#__PURE__*/jsx(ApiKey, {
|
|
15945
|
-
value: item.value,
|
|
15946
|
-
placeholder: item.placeholder
|
|
15947
|
-
});
|
|
15948
|
-
case 'selectClientRelationCatalog':
|
|
15949
|
-
return /*#__PURE__*/jsx("div", {
|
|
15950
|
-
style: {
|
|
15951
|
-
display: 'flex',
|
|
15952
|
-
gap: 16
|
|
15953
|
-
},
|
|
15954
|
-
children: /*#__PURE__*/jsx(SelectClientRelationCatalog, {
|
|
15955
|
-
dontLoadCatalogData: true,
|
|
15956
|
-
onSelectedSupplier: function onSelectedSupplier(supplier) {
|
|
15957
|
-
if (item.accountName) {
|
|
15958
|
-
var newData = state.onInputChanged(item.accountName, supplier === null || supplier === void 0 ? void 0 : supplier._id);
|
|
15959
|
-
if (!supplier) {
|
|
15960
|
-
newData = state.onInputChanged(name, undefined, newData);
|
|
15961
|
-
if (item.catalogCodex) state.onInputChanged(item.catalogCodex, undefined, newData);
|
|
15962
|
-
}
|
|
15963
|
-
}
|
|
15964
|
-
},
|
|
15965
|
-
initAccountId: item.accountName ? state.getData(item.accountName, data) : undefined,
|
|
15966
|
-
initCatalogId: state.getData(name, data),
|
|
15967
|
-
currentOrganizationId: data._id,
|
|
15968
|
-
onSelectedCatalog: function onSelectedCatalog(catalogItem) {
|
|
15969
|
-
var newData = state.onInputChanged(name, catalogItem === null || catalogItem === void 0 ? void 0 : catalogItem._id);
|
|
15970
|
-
if (item.catalogCodex) state.onInputChanged(item.catalogCodex, catalogItem === null || catalogItem === void 0 ? void 0 : catalogItem.codex, newData);
|
|
15971
|
-
},
|
|
15972
|
-
onError: function onError(text) {
|
|
15973
|
-
return onErrorInternal(text, text);
|
|
15974
|
-
},
|
|
15975
|
-
apiInterface: item.apiInterface
|
|
15976
|
-
})
|
|
15977
|
-
});
|
|
15978
|
-
case 'radio':
|
|
15979
|
-
return /*#__PURE__*/jsx(Radio.Group, {
|
|
15980
|
-
value: item.value,
|
|
15981
|
-
options: item.options.map(function (o) {
|
|
15982
|
-
var _o$disabled;
|
|
15983
|
-
return _objectSpread$y(_objectSpread$y({}, o), {}, {
|
|
15984
|
-
disabled: (_o$disabled = o.disabled) === null || _o$disabled === void 0 ? void 0 : _o$disabled.call(o, data)
|
|
15985
|
-
});
|
|
15986
|
-
}),
|
|
15987
|
-
buttonStyle: item.buttonStyle,
|
|
15988
|
-
optionType: item.optionType,
|
|
15989
|
-
defaultValue: item.defaultValue,
|
|
15990
|
-
onChange: function onChange(_ref7) {
|
|
15991
|
-
var value = _ref7.target.value;
|
|
15992
|
-
_onChange(name, value);
|
|
15993
|
-
}
|
|
15994
|
-
});
|
|
15995
|
-
case 'button':
|
|
15996
|
-
return /*#__PURE__*/jsx(CustomButton$1, {
|
|
15997
|
-
id: item.buttonId,
|
|
15998
|
-
data: data,
|
|
15999
|
-
useActionResult: {
|
|
16000
|
-
styles: true,
|
|
16001
|
-
message: true
|
|
16002
|
-
},
|
|
16003
|
-
icon: item.icon,
|
|
16004
|
-
callback: updateFormData
|
|
16005
|
-
});
|
|
16006
|
-
default:
|
|
16007
|
-
return /*#__PURE__*/jsx(Fragment, {});
|
|
16008
|
-
}
|
|
16009
|
-
}
|
|
16010
16200
|
return /*#__PURE__*/jsxs(Spin, {
|
|
16011
16201
|
spinning: state.loading,
|
|
16012
16202
|
children: [state.configuration.presetApiInterface && /*#__PURE__*/jsx(Presets, {
|
|
@@ -16035,125 +16225,37 @@ var FormWrapper$1 = function FormWrapper(_ref, ref) {
|
|
|
16035
16225
|
},
|
|
16036
16226
|
children: [state.configuration.itemSelector && /*#__PURE__*/jsx(Form$1.Item, {
|
|
16037
16227
|
name: state.configuration.itemSelector.name,
|
|
16038
|
-
rules: getRules(state.configuration.itemSelector, state.data),
|
|
16228
|
+
rules: state.getRules(state.configuration.itemSelector, state.data),
|
|
16039
16229
|
label: state.configuration.itemSelector.label ? t(state.configuration.itemSelector.label, state.configuration.itemSelector.label) : state.configuration.itemSelector.name,
|
|
16040
16230
|
valuePropName: state.configuration.itemSelector.type == 'checkbox' ? 'checked' : 'value',
|
|
16041
|
-
children: getElement(state.configuration.itemSelector, state.data, setCanSave, state, state.onItemSelectorChanged)
|
|
16231
|
+
children: getElement(state.configuration.itemSelector, state.data, setCanSave, state, state.onItemSelectorChanged, onErrorInternal)
|
|
16042
16232
|
}, state.configuration.itemSelector.name.toString()), (_state$selectedItems2 = state.selectedItems) === null || _state$selectedItems2 === void 0 ? void 0 : _state$selectedItems2.map(function (item) {
|
|
16043
|
-
var _state$
|
|
16233
|
+
var _state$hiddenRequired, _state$hiddenRequired2, _state$hiddenRequired3;
|
|
16044
16234
|
return /*#__PURE__*/jsxs("div", {
|
|
16045
|
-
children: [item.marker && /*#__PURE__*/jsx(InfoCircleOutlined, {}), ['subTitle', 'array'].includes(item.type) ? getElement(item, state.data, setCanSave, state, state.onInputChanged, undefined, undefined, (_state$
|
|
16235
|
+
children: [item.marker && /*#__PURE__*/jsx(InfoCircleOutlined, {}), ['subTitle', 'array'].includes(item.type) ? getElement(item, state.data, setCanSave, state, 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, {
|
|
16046
16236
|
name: item.name,
|
|
16047
|
-
rules: getRules(item, state.data),
|
|
16048
|
-
label: getLabel(item),
|
|
16237
|
+
rules: state.getRules(item, state.data),
|
|
16238
|
+
label: getLabel(item, t),
|
|
16049
16239
|
valuePropName: item.type == 'checkbox' ? 'checked' : 'value',
|
|
16050
16240
|
initialValue: item === null || item === void 0 ? void 0 : item.defaultValue,
|
|
16051
16241
|
hasFeedback: !!state.fieldErrors[item.name.toString()],
|
|
16052
16242
|
validateStatus: !!state.fieldErrors[item.name.toString()] ? 'error' : undefined,
|
|
16053
16243
|
help: state.fieldErrors[item.name.toString()],
|
|
16054
|
-
hidden: (_state$
|
|
16055
|
-
children: getElement(item, state.data, setCanSave, state, state.onInputChanged, root, form, (_state$
|
|
16244
|
+
hidden: (_state$hiddenRequired2 = state.hiddenRequiredDisabled[typeof item.name == 'string' ? item.name : item.name.join('.')]) === null || _state$hiddenRequired2 === void 0 ? void 0 : _state$hiddenRequired2.hidden,
|
|
16245
|
+
children: getElement(item, state.data, setCanSave, state, 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)
|
|
16056
16246
|
}, Array.isArray(item.name) ? item.name.join('.') : item.name)]
|
|
16057
16247
|
}, item.name.toString());
|
|
16058
16248
|
})]
|
|
16059
16249
|
})]
|
|
16060
16250
|
});
|
|
16061
|
-
function FormList(_ref8) {
|
|
16062
|
-
var item = _ref8.item,
|
|
16063
|
-
data = _ref8.data;
|
|
16064
|
-
return /*#__PURE__*/jsx(Form$1.List, {
|
|
16065
|
-
name: item.name,
|
|
16066
|
-
initialValue: item.initialValue,
|
|
16067
|
-
children: function children(fields, _ref9) {
|
|
16068
|
-
var add = _ref9.add,
|
|
16069
|
-
remove = _ref9.remove;
|
|
16070
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
16071
|
-
children: [fields.map(function (_ref10) {
|
|
16072
|
-
var key = _ref10.key,
|
|
16073
|
-
name = _ref10.name;
|
|
16074
|
-
return /*#__PURE__*/jsx(Fragment, {
|
|
16075
|
-
children: /*#__PURE__*/jsxs("div", {
|
|
16076
|
-
style: {
|
|
16077
|
-
display: 'flex'
|
|
16078
|
-
},
|
|
16079
|
-
children: [/*#__PURE__*/jsx(MinusCircleOutlined, {
|
|
16080
|
-
onClick: function onClick() {
|
|
16081
|
-
return remove(name);
|
|
16082
|
-
}
|
|
16083
|
-
}), /*#__PURE__*/jsx("div", {
|
|
16084
|
-
style: {
|
|
16085
|
-
flexGrow: 1
|
|
16086
|
-
},
|
|
16087
|
-
children: item.items.map(function (i) {
|
|
16088
|
-
var _state$hiddenRequired6;
|
|
16089
|
-
var n = [name].concat(_toConsumableArray(Array.isArray(i.name) ? i.name : [i.name]));
|
|
16090
|
-
var hidden = !!i.hidden;
|
|
16091
|
-
if (i.hidden && data) {
|
|
16092
|
-
if (typeof i.hidden === 'function') {
|
|
16093
|
-
var _data;
|
|
16094
|
-
if ((_data = data[item.name]) !== null && _data !== void 0 && _data[n[0]]) {
|
|
16095
|
-
hidden = i.hidden(data[item.name][n[0]]);
|
|
16096
|
-
} else hidden = false;
|
|
16097
|
-
}
|
|
16098
|
-
}
|
|
16099
|
-
if (!hidden) hidden = (_state$hiddenRequired6 = state.hiddenRequiredDisabled[typeof n == 'string' ? n : n.join('.')]) === null || _state$hiddenRequired6 === void 0 ? void 0 : _state$hiddenRequired6.hidden;
|
|
16100
|
-
return /*#__PURE__*/jsx(Fragment, {
|
|
16101
|
-
children: /*#__PURE__*/jsx(Form$1.Item, {
|
|
16102
|
-
name: n,
|
|
16103
|
-
rules: getRules(i, state.data),
|
|
16104
|
-
label: getLabel(i),
|
|
16105
|
-
valuePropName: i.type == 'checkbox' ? 'checked' : 'value',
|
|
16106
|
-
initialValue: i === null || i === void 0 ? void 0 : i.defaultValue,
|
|
16107
|
-
hasFeedback: !!state.fieldErrors[n.toString()],
|
|
16108
|
-
validateStatus: !!state.fieldErrors[n.toString()] ? 'error' : undefined,
|
|
16109
|
-
help: state.fieldErrors[n.toString()],
|
|
16110
|
-
hidden: hidden,
|
|
16111
|
-
children: getElement(i, state.data, setCanSave, state, state.onInputChanged, root, form, hidden, [].concat(_toConsumableArray(item.name), _toConsumableArray(Array.isArray(n) ? n : [n])))
|
|
16112
|
-
}, key)
|
|
16113
|
-
});
|
|
16114
|
-
})
|
|
16115
|
-
})]
|
|
16116
|
-
})
|
|
16117
|
-
});
|
|
16118
|
-
}), /*#__PURE__*/jsx(Form$1.Item, {
|
|
16119
|
-
children: /*#__PURE__*/jsx(Button, {
|
|
16120
|
-
type: "dashed",
|
|
16121
|
-
onClick: function onClick() {
|
|
16122
|
-
return add();
|
|
16123
|
-
},
|
|
16124
|
-
block: true,
|
|
16125
|
-
icon: /*#__PURE__*/jsx(PlusOutlined, {}),
|
|
16126
|
-
children: t('backoffice.add_field')
|
|
16127
|
-
})
|
|
16128
|
-
})]
|
|
16129
|
-
});
|
|
16130
|
-
}
|
|
16131
|
-
});
|
|
16132
|
-
}
|
|
16133
16251
|
};
|
|
16252
|
+
function getLabel(item, t) {
|
|
16253
|
+
if (!item.label && item.type === 'button') return undefined;
|
|
16254
|
+
return item.label ? t(item.label, item.label) : item.name;
|
|
16255
|
+
}
|
|
16134
16256
|
var Form = observer(FormWrapper$1, {
|
|
16135
16257
|
forwardRef: true
|
|
16136
16258
|
});
|
|
16137
|
-
function DisplayInput(props) {
|
|
16138
|
-
var _useTranslation2 = useTranslation$1(),
|
|
16139
|
-
t = _useTranslation2.t;
|
|
16140
|
-
return /*#__PURE__*/jsx(Input, _objectSpread$y(_objectSpread$y({}, props), {}, {
|
|
16141
|
-
disabled: true,
|
|
16142
|
-
value: t(props.translationPrefix + '.' + props.value)
|
|
16143
|
-
}));
|
|
16144
|
-
}
|
|
16145
|
-
function isReadonly(item, data) {
|
|
16146
|
-
if (_typeof(item.readonly) != 'object') {
|
|
16147
|
-
return item.readonly;
|
|
16148
|
-
}
|
|
16149
|
-
var flatData = flatten(data);
|
|
16150
|
-
if (!item.readonly.op && flatData[item.readonly.field] == item.readonly.value) {
|
|
16151
|
-
return true;
|
|
16152
|
-
} else if (item.readonly.op == 'gt' && flatData[item.readonly.field] > item.readonly.value) {
|
|
16153
|
-
return true;
|
|
16154
|
-
}
|
|
16155
|
-
return false;
|
|
16156
|
-
}
|
|
16157
16259
|
|
|
16158
16260
|
function ownKeys$x(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; }
|
|
16159
16261
|
function _objectSpread$x(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$x(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$x(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -20111,7 +20213,7 @@ function _createForOfIteratorHelper$8(r, e) { var t = "undefined" != typeof Symb
|
|
|
20111
20213
|
function _unsupportedIterableToArray$8(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$8(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$8(r, a) : void 0; } }
|
|
20112
20214
|
function _arrayLikeToArray$8(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; }
|
|
20113
20215
|
var FileUploadWrapper = function FileUploadWrapper(_ref) {
|
|
20114
|
-
_ref.id;
|
|
20216
|
+
var id = _ref.id;
|
|
20115
20217
|
var _useDivaCore = useDivaCore(),
|
|
20116
20218
|
apiConfig = _useDivaCore.state.apiConfig;
|
|
20117
20219
|
var root = useStore();
|
|
@@ -20250,7 +20352,7 @@ var FileUploadWrapper = function FileUploadWrapper(_ref) {
|
|
|
20250
20352
|
return dt._id;
|
|
20251
20353
|
}));
|
|
20252
20354
|
}
|
|
20253
|
-
})
|
|
20355
|
+
}, id)
|
|
20254
20356
|
}), /*#__PURE__*/jsx(Button, {
|
|
20255
20357
|
htmlType: "submit",
|
|
20256
20358
|
type: "primary",
|
|
@@ -20591,7 +20693,8 @@ function getExpandedRowRenderer (config, root) {
|
|
|
20591
20693
|
var editableRow = "editable-row-9BEHi";
|
|
20592
20694
|
var checkbox = "checkbox-H7R-w";
|
|
20593
20695
|
var editableCellValueWrap = "editable-cell-value-wrap-ugTs4";
|
|
20594
|
-
var
|
|
20696
|
+
var contentWidth = "content-width-hGyVI";
|
|
20697
|
+
var css_248z$c = ".checkbox-readonly-0-bzT {\n cursor: default;\n}\n\n.checkbox-readonly-0-bzT .ant-checkbox-input {\n cursor: default;\n}\n\n.checkbox-readonly-0-bzT .ant-checkbox {\n cursor: default;\n}\n\n.editable-row-9BEHi:hover .checkbox-H7R-w .ant-checkbox {\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.6);\n}\n\n.editable-cell-value-wrap-ugTs4 {\n padding: 5px 12px;\n cursor: pointer;\n}\n\n.editable-row-9BEHi:hover .editable-cell-value-wrap-ugTs4 {\n padding: 4px 11px;\n border: 1px solid #d9d9d9;\n border-radius: 4px;\n}\n\n.content-width-hGyVI .ant-modal-confirm-content {\n width: 100%;\n}\n";
|
|
20595
20698
|
styleInject(css_248z$c);
|
|
20596
20699
|
|
|
20597
20700
|
function BooleanCell (_ref) {
|
|
@@ -20812,6 +20915,7 @@ function TextCell (_ref) {
|
|
|
20812
20915
|
onCancel: function onCancel() {
|
|
20813
20916
|
return setShowModal(false);
|
|
20814
20917
|
},
|
|
20918
|
+
className: contentWidth,
|
|
20815
20919
|
icon: /*#__PURE__*/jsx(Fragment, {}),
|
|
20816
20920
|
content: /*#__PURE__*/jsx(Form$1, {
|
|
20817
20921
|
form: form,
|
|
@@ -20824,7 +20928,7 @@ function TextCell (_ref) {
|
|
|
20824
20928
|
}] : [],
|
|
20825
20929
|
children: /*#__PURE__*/jsx(Input.TextArea, {
|
|
20826
20930
|
autoSize: {
|
|
20827
|
-
minRows:
|
|
20931
|
+
minRows: 6,
|
|
20828
20932
|
maxRows: 6
|
|
20829
20933
|
},
|
|
20830
20934
|
ref: inputRef
|
|
@@ -24920,7 +25024,7 @@ var FilterBox = /*#__PURE__*/memo(function (_ref) {
|
|
|
24920
25024
|
value: getLabelByValue((_value2 = data.value) !== null && _value2 !== void 0 ? _value2 : data, filter.options)
|
|
24921
25025
|
}]);
|
|
24922
25026
|
}
|
|
24923
|
-
})]
|
|
25027
|
+
}, id)]
|
|
24924
25028
|
}, filter.type + filter.title);
|
|
24925
25029
|
case 'slider':
|
|
24926
25030
|
//Masse
|
|
@@ -30055,7 +30159,7 @@ styleInject(css_248z$3);
|
|
|
30055
30159
|
var wrapper = "wrapper-wuBie";
|
|
30056
30160
|
var select = "select-w181d";
|
|
30057
30161
|
var button = "button-g8Tp4";
|
|
30058
|
-
var css_248z$2 = ".wrapper-wuBie {\n display: flex;\n gap: 16px;\n margin: 8px;\n justify-content: start;\n}\n\n.select-w181d {\n z-index: 1000;\n margin: 8px;\n flex-grow: 0.8;\n min-width: 100px;\n}\n.select-w181d div {\n border-color: grey !important;\n}\n.select-w181d div {\n box-shadow: none;\n box-shadow: initial;\n}\n\n.button-g8Tp4 {\n width: 40px;\n justify-content: center;\n}\n";
|
|
30162
|
+
var css_248z$2 = ".wrapper-wuBie {\n display: flex;\n gap: 16px;\n margin: 8px;\n justify-content: flex-start;\n}\n\n.select-w181d {\n z-index: 1000;\n margin: 8px;\n flex-grow: 0.8;\n min-width: 100px;\n}\n.select-w181d div {\n border-color: grey !important;\n}\n.select-w181d div {\n box-shadow: none;\n box-shadow: initial;\n}\n\n.button-g8Tp4 {\n width: 40px;\n justify-content: center;\n}\n";
|
|
30059
30163
|
styleInject(css_248z$2);
|
|
30060
30164
|
|
|
30061
30165
|
var ArticleSelection = function ArticleSelection(_ref) {
|
|
@@ -30275,11 +30379,12 @@ function useWysiwyg(_ref) {
|
|
|
30275
30379
|
return function () {
|
|
30276
30380
|
return unSubscribeEvents(onEventCalled);
|
|
30277
30381
|
};
|
|
30278
|
-
}, []);
|
|
30382
|
+
}, [articleCodex]);
|
|
30279
30383
|
var settings = useMemo(function () {
|
|
30280
30384
|
return {
|
|
30281
30385
|
language: 'DE',
|
|
30282
30386
|
showSelectionModeZero: true,
|
|
30387
|
+
dontLoadAdditionalModelInfos: true,
|
|
30283
30388
|
onErrorHandling: {
|
|
30284
30389
|
hideErrorMsg: false,
|
|
30285
30390
|
errorMsg: 'WYSIWYG currently not working for this mask'
|