@crystaldesign/diva-backoffice 24.10.0-beta.14 → 24.10.0-beta.16
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 +1418 -1280
- 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/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: {
|
|
@@ -7939,6 +7955,13 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
7939
7955
|
label: t('backoffice.form.renderjob.items.productName'),
|
|
7940
7956
|
type: 'input',
|
|
7941
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']
|
|
7942
7965
|
}, {
|
|
7943
7966
|
name: 'priority',
|
|
7944
7967
|
label: t('backoffice.form.renderjob.items.priority'),
|
|
@@ -8187,6 +8210,13 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
8187
8210
|
label: t('backoffice.form.renderjob.items.productName'),
|
|
8188
8211
|
type: 'input',
|
|
8189
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']
|
|
8190
8220
|
}, {
|
|
8191
8221
|
name: 'priority',
|
|
8192
8222
|
label: t('backoffice.form.renderjob.items.priority'),
|
|
@@ -8339,6 +8369,13 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
8339
8369
|
label: t('backoffice.form.renderjob.items.productName'),
|
|
8340
8370
|
type: 'input',
|
|
8341
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']
|
|
8342
8379
|
}, {
|
|
8343
8380
|
name: 'priority',
|
|
8344
8381
|
label: t('backoffice.form.renderjob.items.priority'),
|
|
@@ -9234,6 +9271,95 @@ function loadConfiguration(t, root, config, lang) {
|
|
|
9234
9271
|
type: 'input'
|
|
9235
9272
|
}]
|
|
9236
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
|
+
},
|
|
9237
9363
|
OrgTree: {
|
|
9238
9364
|
type: 'OrgTree',
|
|
9239
9365
|
expandAll: true,
|
|
@@ -13309,6 +13435,28 @@ function useFormData (_ref) {
|
|
|
13309
13435
|
}));
|
|
13310
13436
|
return _setDynamicFields.apply(this, arguments);
|
|
13311
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
|
+
}
|
|
13312
13460
|
return _objectSpread$E(_objectSpread$E({}, state), {}, {
|
|
13313
13461
|
setUsedPreset: setUsedPreset,
|
|
13314
13462
|
configuration: configuration,
|
|
@@ -13327,7 +13475,8 @@ function useFormData (_ref) {
|
|
|
13327
13475
|
fieldErrors: fieldErrors,
|
|
13328
13476
|
hiddenRequiredDisabled: hiddenRequiredDisabled,
|
|
13329
13477
|
getData: getData,
|
|
13330
|
-
updateHiddenRequiredDisabled: updateHiddenRequiredDisabled
|
|
13478
|
+
updateHiddenRequiredDisabled: updateHiddenRequiredDisabled,
|
|
13479
|
+
getRules: getRules
|
|
13331
13480
|
});
|
|
13332
13481
|
}
|
|
13333
13482
|
function setFieldInObject(id, data, value) {
|
|
@@ -13367,739 +13516,148 @@ function getData(id, data) {
|
|
|
13367
13516
|
}
|
|
13368
13517
|
}
|
|
13369
13518
|
|
|
13370
|
-
|
|
13371
|
-
|
|
13372
|
-
|
|
13373
|
-
|
|
13374
|
-
|
|
13375
|
-
|
|
13376
|
-
|
|
13377
|
-
var
|
|
13378
|
-
var
|
|
13379
|
-
|
|
13380
|
-
|
|
13381
|
-
|
|
13382
|
-
|
|
13383
|
-
|
|
13384
|
-
|
|
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
|
+
}
|
|
13385
13544
|
}
|
|
13386
|
-
}
|
|
13387
|
-
|
|
13388
|
-
|
|
13389
|
-
|
|
13390
|
-
|
|
13391
|
-
|
|
13392
|
-
|
|
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
|
+
};
|
|
13393
13570
|
|
|
13394
|
-
|
|
13395
|
-
|
|
13396
|
-
|
|
13397
|
-
|
|
13398
|
-
|
|
13399
|
-
|
|
13400
|
-
|
|
13401
|
-
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,
|
|
13402
13578
|
onError = _ref.onError,
|
|
13403
|
-
|
|
13404
|
-
|
|
13405
|
-
|
|
13406
|
-
|
|
13407
|
-
|
|
13408
|
-
|
|
13409
|
-
|
|
13410
|
-
|
|
13411
|
-
|
|
13412
|
-
|
|
13413
|
-
|
|
13414
|
-
|
|
13415
|
-
|
|
13416
|
-
|
|
13417
|
-
|
|
13418
|
-
|
|
13419
|
-
|
|
13420
|
-
|
|
13421
|
-
|
|
13422
|
-
|
|
13423
|
-
|
|
13424
|
-
|
|
13425
|
-
|
|
13426
|
-
|
|
13427
|
-
|
|
13428
|
-
|
|
13429
|
-
|
|
13430
|
-
|
|
13431
|
-
|
|
13432
|
-
|
|
13433
|
-
|
|
13434
|
-
|
|
13435
|
-
|
|
13436
|
-
|
|
13437
|
-
|
|
13438
|
-
|
|
13439
|
-
|
|
13440
|
-
|
|
13441
|
-
|
|
13442
|
-
|
|
13443
|
-
|
|
13444
|
-
|
|
13445
|
-
|
|
13446
|
-
|
|
13447
|
-
|
|
13448
|
-
|
|
13449
|
-
|
|
13450
|
-
|
|
13451
|
-
|
|
13452
|
-
|
|
13453
|
-
|
|
13454
|
-
|
|
13455
|
-
|
|
13456
|
-
|
|
13457
|
-
|
|
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
|
-
setOptions(_toConsumableArray(hardOptions.map(function (v) {
|
|
13486
|
-
return {
|
|
13487
|
-
label: v.lable,
|
|
13488
|
-
value: v.value,
|
|
13489
|
-
data: v.data,
|
|
13490
|
-
disabled: v.disabled
|
|
13491
|
-
};
|
|
13492
|
-
})));
|
|
13493
|
-
}
|
|
13494
|
-
}, [wholeData]);
|
|
13495
|
-
useEffect(function () {
|
|
13496
|
-
if (!canSetToUndefined && (selected == undefined || selected.length == 0)) {
|
|
13497
|
-
doSetOptions();
|
|
13498
|
-
}
|
|
13499
|
-
}, [data]);
|
|
13500
|
-
useEffect(function () {
|
|
13501
|
-
if (!(selected !== null && selected !== void 0 && selected.length) && defaultValue && applyDefaultValue !== false) {
|
|
13502
|
-
setSelected([defaultValue]);
|
|
13503
|
-
}
|
|
13504
|
-
}, [defaultValue]);
|
|
13505
|
-
function doSetOptions() {
|
|
13506
|
-
var newData = data !== null && data !== void 0 ? data : defaultValue;
|
|
13507
|
-
if (newData != undefined && (!Array.isArray(newData) || newData.length != 0)) {
|
|
13508
|
-
if (initalValue == undefined) {
|
|
13509
|
-
setInitValue(newData);
|
|
13510
|
-
}
|
|
13511
|
-
var initData = isArray(newData) ? newData : [newData];
|
|
13512
|
-
var value = initData.map(function (d) {
|
|
13513
|
-
var _d$data, _d$_id, _d$selectMapping$valu, _d$data2, _ref2, _d$value, _d$data3;
|
|
13514
|
-
return {
|
|
13515
|
-
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,
|
|
13516
|
-
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,
|
|
13517
|
-
data: d,
|
|
13518
|
-
disabled: false
|
|
13519
|
-
};
|
|
13520
|
-
});
|
|
13521
|
-
var val = value.length == 1 ? value[0].data : value;
|
|
13522
|
-
if (Array.isArray(val) && val.length) {
|
|
13523
|
-
val = val.map(function (v) {
|
|
13524
|
-
return v.data;
|
|
13525
|
-
});
|
|
13526
|
-
} else if (Array.isArray(val)) {
|
|
13527
|
-
val = initData;
|
|
13528
|
-
}
|
|
13529
|
-
if (flow && initData.length) {
|
|
13530
|
-
var _value$, _flow$value$0$value, _value$2;
|
|
13531
|
-
if (mode != 'single') {
|
|
13532
|
-
throw new Error('Flow is only implemented for single mode');
|
|
13533
|
-
}
|
|
13534
|
-
var missingFields = verifySelection((_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.value);
|
|
13535
|
-
if (missingFields.length) {
|
|
13536
|
-
onError === null || onError === void 0 || onError((missingFields === null || missingFields === void 0 ? void 0 : missingFields.join(', ')) + ' not set or wrong value');
|
|
13537
|
-
return;
|
|
13538
|
-
} else {
|
|
13539
|
-
onError === null || onError === void 0 || onError('');
|
|
13540
|
-
}
|
|
13541
|
-
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) {
|
|
13542
|
-
return {
|
|
13543
|
-
label: translationPrefix ? t(translationPrefix + '.' + opt) : opt.toString(),
|
|
13544
|
-
value: opt,
|
|
13545
|
-
data: opt
|
|
13546
|
-
};
|
|
13547
|
-
})) || [];
|
|
13548
|
-
var _defaultValue = initalValue !== null && initalValue !== void 0 ? initalValue : data;
|
|
13549
|
-
if (!flowData.find(function (fd) {
|
|
13550
|
-
return fd.value == _defaultValue;
|
|
13551
|
-
})) {
|
|
13552
|
-
flowData.push({
|
|
13553
|
-
label: translationPrefix ? t(translationPrefix + '.' + _defaultValue) : _defaultValue.toString(),
|
|
13554
|
-
value: _defaultValue,
|
|
13555
|
-
data: _defaultValue
|
|
13556
|
-
});
|
|
13557
|
-
}
|
|
13558
|
-
setOptions(_toConsumableArray(flowData));
|
|
13559
|
-
}
|
|
13560
|
-
onChange === null || onChange === void 0 || onChange(val, applyDefaultValue, defaultValue);
|
|
13561
|
-
setSelected(value);
|
|
13562
|
-
}
|
|
13563
|
-
}
|
|
13564
|
-
var loadOptions = /*#__PURE__*/function () {
|
|
13565
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(value) {
|
|
13566
|
-
var fetchId, newOptions, serverSideParams;
|
|
13567
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
13568
|
-
while (1) switch (_context.prev = _context.next) {
|
|
13569
|
-
case 0:
|
|
13570
|
-
fetchRef.current += 1;
|
|
13571
|
-
fetchId = fetchRef.current;
|
|
13572
|
-
if (!filterServerSide) {
|
|
13573
|
-
_context.next = 10;
|
|
13574
|
-
break;
|
|
13575
|
-
}
|
|
13576
|
-
setFetching(true);
|
|
13577
|
-
serverSideParams = {
|
|
13578
|
-
filters: selectMapping !== null && selectMapping !== void 0 && selectMapping.searchField ? selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.searchField.reduce(function (filter, field) {
|
|
13579
|
-
return _objectSpread$D(_objectSpread$D({}, filter), value !== undefined ? _defineProperty({}, field.field, [value, field.filter, true]) : {});
|
|
13580
|
-
}, {}) : {
|
|
13581
|
-
_id: [value, 'contains']
|
|
13582
|
-
},
|
|
13583
|
-
pagination: {
|
|
13584
|
-
pageSize: 100
|
|
13585
|
-
}
|
|
13586
|
-
};
|
|
13587
|
-
_context.next = 7;
|
|
13588
|
-
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) {
|
|
13589
|
-
return (body === null || body === void 0 ? void 0 : body.data.map(function (data) {
|
|
13590
|
-
return {
|
|
13591
|
-
label: selectMapping !== null && selectMapping !== void 0 && selectMapping.label ? getCombinedValues(data, selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.label) : data._id,
|
|
13592
|
-
value: selectMapping !== null && selectMapping !== void 0 && selectMapping.value ? data[selectMapping.value] : data._id,
|
|
13593
|
-
disabled: false,
|
|
13594
|
-
data: data
|
|
13595
|
-
};
|
|
13596
|
-
})) || [];
|
|
13597
|
-
});
|
|
13598
|
-
case 7:
|
|
13599
|
-
newOptions = _context.sent;
|
|
13600
|
-
_context.next = 12;
|
|
13601
|
-
break;
|
|
13602
|
-
case 10:
|
|
13603
|
-
newOptions = initOptions.filter(function (opt) {
|
|
13604
|
-
var _value$toLocaleLowerC;
|
|
13605
|
-
return opt.label.toLocaleLowerCase().includes((_value$toLocaleLowerC = value === null || value === void 0 ? void 0 : value.toLocaleLowerCase()) !== null && _value$toLocaleLowerC !== void 0 ? _value$toLocaleLowerC : '');
|
|
13606
|
-
});
|
|
13607
|
-
if (allowCreate && !newOptions.length) {
|
|
13608
|
-
newOptions = [{
|
|
13609
|
-
data: value,
|
|
13610
|
-
label: value,
|
|
13611
|
-
disabled: false,
|
|
13612
|
-
value: value
|
|
13613
|
-
}];
|
|
13614
|
-
}
|
|
13615
|
-
case 12:
|
|
13616
|
-
if (!(fetchId !== fetchRef.current)) {
|
|
13617
|
-
_context.next = 14;
|
|
13618
|
-
break;
|
|
13619
|
-
}
|
|
13620
|
-
return _context.abrupt("return");
|
|
13621
|
-
case 14:
|
|
13622
|
-
setOptions(newOptions);
|
|
13623
|
-
setFetching(false);
|
|
13624
|
-
case 16:
|
|
13625
|
-
case "end":
|
|
13626
|
-
return _context.stop();
|
|
13627
|
-
}
|
|
13628
|
-
}, _callee);
|
|
13629
|
-
}));
|
|
13630
|
-
return function loadOptions(_x) {
|
|
13631
|
-
return _ref3.apply(this, arguments);
|
|
13632
|
-
};
|
|
13633
|
-
}();
|
|
13634
|
-
var fetch = React.useMemo(function () {
|
|
13635
|
-
return debounce(loadOptions, 800);
|
|
13636
|
-
}, [selectMapping, initOptions, wholeData]);
|
|
13637
|
-
var verifySelection = function verifySelection(opt) {
|
|
13638
|
-
if (disabledConfig == undefined) return [];
|
|
13639
|
-
var _missingFields = [];
|
|
13640
|
-
var _iterator = _createForOfIteratorHelper$h(disabledConfig),
|
|
13641
|
-
_step;
|
|
13642
|
-
try {
|
|
13643
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
13644
|
-
var disabled = _step.value;
|
|
13645
|
-
if (opt == (disabled === null || disabled === void 0 ? void 0 : disabled.value) && wholeData[disabled.onField.field] == disabled.onField.value) {
|
|
13646
|
-
if (!disabled.requiredFields) {
|
|
13647
|
-
return ['Job HQ', 'Job AR'];
|
|
13648
|
-
}
|
|
13649
|
-
disabled.requiredFields.forEach(function (fd) {
|
|
13650
|
-
if (typeof fd === 'string' && (wholeData[fd] === '' || wholeData[fd] === undefined)) {
|
|
13651
|
-
_missingFields.push(fd);
|
|
13652
|
-
} else if (_typeof(fd) == 'object') {
|
|
13653
|
-
if (!fd.value.some(function (v) {
|
|
13654
|
-
return v == wholeData[fd.field];
|
|
13655
|
-
})) {
|
|
13656
|
-
_missingFields.push(fd.field);
|
|
13657
|
-
}
|
|
13658
|
-
}
|
|
13659
|
-
});
|
|
13660
|
-
return _missingFields;
|
|
13661
|
-
}
|
|
13662
|
-
}
|
|
13663
|
-
} catch (err) {
|
|
13664
|
-
_iterator.e(err);
|
|
13665
|
-
} finally {
|
|
13666
|
-
_iterator.f();
|
|
13667
|
-
}
|
|
13668
|
-
return [];
|
|
13669
|
-
};
|
|
13670
|
-
|
|
13671
|
-
//state.configuration.dependencyRule.
|
|
13672
|
-
var onSelect = function onSelect(data) {
|
|
13673
|
-
//! tags works without labelInValue; data = string; get's converted to option afterwards in useeffect
|
|
13674
|
-
//because of a error in the typedefinition we have to cast it here
|
|
13675
|
-
var newSelected = data;
|
|
13676
|
-
var sel = selected;
|
|
13677
|
-
var option = options.find(function (o) {
|
|
13678
|
-
return o.value == newSelected.value;
|
|
13679
|
-
});
|
|
13680
|
-
if (option) {
|
|
13681
|
-
if (mode == 'tags') {
|
|
13682
|
-
throw new Error('select with options is not yet supported for mode tags');
|
|
13683
|
-
}
|
|
13684
|
-
if (mode == 'single') {
|
|
13685
|
-
var _option$data;
|
|
13686
|
-
if (flow) {
|
|
13687
|
-
var _flow$option$value;
|
|
13688
|
-
var missingFields = verifySelection(option.value);
|
|
13689
|
-
if (missingFields.length) {
|
|
13690
|
-
onError === null || onError === void 0 || onError((missingFields === null || missingFields === void 0 ? void 0 : missingFields.join(', ')) + ' not set or wrong value');
|
|
13691
|
-
return;
|
|
13692
|
-
} else {
|
|
13693
|
-
onError === null || onError === void 0 || onError('');
|
|
13694
|
-
}
|
|
13695
|
-
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) {
|
|
13696
|
-
return {
|
|
13697
|
-
label: translationPrefix ? t(translationPrefix + '.' + opt) : opt.toString(),
|
|
13698
|
-
value: opt,
|
|
13699
|
-
data: opt
|
|
13700
|
-
};
|
|
13701
|
-
})) || [];
|
|
13702
|
-
var _defaultValue2 = initalValue !== null && initalValue !== void 0 ? initalValue : data;
|
|
13703
|
-
if (!flowData.find(function (fd) {
|
|
13704
|
-
return fd.value == _defaultValue2;
|
|
13705
|
-
})) {
|
|
13706
|
-
flowData.push({
|
|
13707
|
-
label: translationPrefix ? t(translationPrefix + '.' + _defaultValue2) : _defaultValue2.toString(),
|
|
13708
|
-
value: _defaultValue2,
|
|
13709
|
-
data: _defaultValue2
|
|
13710
|
-
});
|
|
13711
|
-
}
|
|
13712
|
-
setOptions(_toConsumableArray(flowData));
|
|
13713
|
-
}
|
|
13714
|
-
//if it is single mode there can always only be one selected or one new entry
|
|
13715
|
-
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);
|
|
13716
|
-
setSelected([option]);
|
|
13717
|
-
} else {
|
|
13718
|
-
var selectedList = [].concat(_toConsumableArray(sel), [option]);
|
|
13719
|
-
setSelected(selectedList);
|
|
13720
|
-
onChange === null || onChange === void 0 || onChange(selectedList.map(function (s) {
|
|
13721
|
-
return s.data;
|
|
13722
|
-
}), applyDefaultValue, defaultValue);
|
|
13723
|
-
}
|
|
13724
|
-
} else {
|
|
13725
|
-
if (mode == 'tags' && typeof data === 'string') {
|
|
13726
|
-
onChange === null || onChange === void 0 || onChange([].concat(_toConsumableArray(sel.map(function (s) {
|
|
13727
|
-
return s.data;
|
|
13728
|
-
})), [data]), applyDefaultValue, defaultValue);
|
|
13729
|
-
setSelected([].concat(_toConsumableArray(sel), [data]));
|
|
13730
|
-
} else {
|
|
13731
|
-
throw new Error('select without options is not yet supported for modes other than tags');
|
|
13732
|
-
}
|
|
13733
|
-
}
|
|
13734
|
-
};
|
|
13735
|
-
|
|
13736
|
-
// if useFirstValueAsDefault is true we load the options and trigger an update with setGettingDefaultValue
|
|
13737
|
-
// at the 2. useEffect the options are loaded and set in state so we can set the first option
|
|
13738
|
-
useEffect(function () {
|
|
13739
|
-
if (useFirstValueAsDefault && !selected.length) {
|
|
13740
|
-
loadOptions(undefined).then(function () {
|
|
13741
|
-
return setGettingDefaultValue(true);
|
|
13742
|
-
});
|
|
13743
|
-
}
|
|
13744
|
-
}, []);
|
|
13745
|
-
useEffect(function () {
|
|
13746
|
-
if (gettingDefaultValue) onSelect(options[0]);
|
|
13747
|
-
}, [gettingDefaultValue]);
|
|
13748
|
-
var onFocus = function onFocus() {
|
|
13749
|
-
loadOptions(undefined);
|
|
13750
|
-
};
|
|
13751
|
-
var onRemove = function onRemove(data) {
|
|
13752
|
-
//because of a error in the typedefinition we have to cast it here
|
|
13753
|
-
var removed = data;
|
|
13754
|
-
var sel = selected;
|
|
13755
|
-
var newSelected;
|
|
13756
|
-
if (removed) {
|
|
13757
|
-
var index = sel.findIndex(function (s) {
|
|
13758
|
-
return s.value == removed.value;
|
|
13759
|
-
});
|
|
13760
|
-
newSelected = _toConsumableArray(sel);
|
|
13761
|
-
newSelected.splice(index, 1);
|
|
13762
|
-
} else {
|
|
13763
|
-
newSelected = [];
|
|
13764
|
-
}
|
|
13765
|
-
setSelected(newSelected);
|
|
13766
|
-
if (mode == 'single') {
|
|
13767
|
-
onChange === null || onChange === void 0 || onChange(undefined, applyDefaultValue, defaultValue);
|
|
13768
|
-
} else {
|
|
13769
|
-
onChange === null || onChange === void 0 || onChange(newSelected.map(function (s) {
|
|
13770
|
-
return s.data;
|
|
13771
|
-
}), applyDefaultValue, defaultValue);
|
|
13772
|
-
}
|
|
13773
|
-
};
|
|
13774
|
-
return {
|
|
13775
|
-
fetching: fetching,
|
|
13776
|
-
options: options,
|
|
13777
|
-
selected: selected,
|
|
13778
|
-
fetch: fetch,
|
|
13779
|
-
onRemove: onRemove,
|
|
13780
|
-
onFocus: onFocus,
|
|
13781
|
-
onSelect: onSelect
|
|
13782
|
-
};
|
|
13783
|
-
}
|
|
13784
|
-
|
|
13785
|
-
var css_248z$m = ".darkmode .ant-select-selection-search-input {\n color: #fff;\n}\n";
|
|
13786
|
-
styleInject(css_248z$m);
|
|
13787
|
-
|
|
13788
|
-
var SelectWrapper$1 = function SelectWrapper(_ref) {
|
|
13789
|
-
var onChange = _ref.onChange,
|
|
13790
|
-
onError = _ref.onError,
|
|
13791
|
-
value = _ref.value,
|
|
13792
|
-
apiInterface = _ref.apiInterface,
|
|
13793
|
-
selectMapping = _ref.selectMapping,
|
|
13794
|
-
mapping = _ref.mapping,
|
|
13795
|
-
mode = _ref.mode,
|
|
13796
|
-
initialValue = _ref.initialValue,
|
|
13797
|
-
minWidth = _ref.minWidth,
|
|
13798
|
-
allowCreate = _ref.allowCreate,
|
|
13799
|
-
allowClear = _ref.allowClear,
|
|
13800
|
-
search = _ref.search,
|
|
13801
|
-
flow = _ref.flow,
|
|
13802
|
-
translationPrefix = _ref.translationPrefix,
|
|
13803
|
-
values = _ref.values,
|
|
13804
|
-
disabled = _ref.disabled,
|
|
13805
|
-
wholeData = _ref.wholeData,
|
|
13806
|
-
disabledConfig = _ref.disabledConfig,
|
|
13807
|
-
placeholder = _ref.placeholder,
|
|
13808
|
-
options = _ref.options,
|
|
13809
|
-
applyDefaultValue = _ref.applyDefaultValue,
|
|
13810
|
-
useFirstValueAsDefault = _ref.useFirstValueAsDefault,
|
|
13811
|
-
canSetToUndefined = _ref.canSetToUndefined;
|
|
13812
|
-
var state = useSelectData({
|
|
13813
|
-
onChange: onChange,
|
|
13814
|
-
onError: onError,
|
|
13815
|
-
data: value,
|
|
13816
|
-
apiInterface: apiInterface,
|
|
13817
|
-
selectMapping: selectMapping,
|
|
13818
|
-
mapping: mapping,
|
|
13819
|
-
mode: mode,
|
|
13820
|
-
allowCreate: allowCreate,
|
|
13821
|
-
defaultValue: initialValue,
|
|
13822
|
-
flow: flow,
|
|
13823
|
-
translationPrefix: translationPrefix,
|
|
13824
|
-
values: values,
|
|
13825
|
-
wholeData: wholeData,
|
|
13826
|
-
disabledConfig: disabledConfig,
|
|
13827
|
-
hardOptions: options,
|
|
13828
|
-
applyDefaultValue: applyDefaultValue,
|
|
13829
|
-
useFirstValueAsDefault: useFirstValueAsDefault,
|
|
13830
|
-
canSetToUndefined: canSetToUndefined
|
|
13831
|
-
});
|
|
13832
|
-
var _useTranslation = useTranslation$1(),
|
|
13833
|
-
t = _useTranslation.t;
|
|
13834
|
-
var filterServerSide = _typeof(apiInterface) == 'object' && _typeof(apiInterface.read) == 'object' && apiInterface.read.filterServerSide;
|
|
13835
|
-
var selected = state.selected;
|
|
13836
|
-
return /*#__PURE__*/jsx(Fragment, {
|
|
13837
|
-
children: /*#__PURE__*/jsx(Select$1, {
|
|
13838
|
-
labelInValue: mode === 'tags' ? false : true,
|
|
13839
|
-
style: {
|
|
13840
|
-
width: '100%',
|
|
13841
|
-
minWidth: minWidth
|
|
13842
|
-
},
|
|
13843
|
-
filterOption: false,
|
|
13844
|
-
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t('filter.global'),
|
|
13845
|
-
allowClear: allowClear !== null && allowClear !== void 0 ? allowClear : filterServerSide,
|
|
13846
|
-
showArrow: !filterServerSide || allowCreate || search,
|
|
13847
|
-
mode: mode == 'single' ? undefined : mode,
|
|
13848
|
-
showSearch: filterServerSide || allowCreate || search,
|
|
13849
|
-
onSearch: filterServerSide || allowCreate || search ? state.fetch : undefined,
|
|
13850
|
-
notFoundContent: state.fetching ? /*#__PURE__*/jsx(Spin, {
|
|
13851
|
-
size: "small"
|
|
13852
|
-
}) : null,
|
|
13853
|
-
options: state.options,
|
|
13854
|
-
onSelect: state.onSelect,
|
|
13855
|
-
disabled: disabled,
|
|
13856
|
-
onDeselect: state.onRemove,
|
|
13857
|
-
onFocus: filterServerSide || allowCreate || search ? state.onFocus : undefined,
|
|
13858
|
-
onClear: state.onRemove,
|
|
13859
|
-
value: selected
|
|
13860
|
-
})
|
|
13861
|
-
});
|
|
13862
|
-
};
|
|
13863
|
-
var Select = observer(SelectWrapper$1, {
|
|
13864
|
-
forwardRef: true
|
|
13865
|
-
});
|
|
13866
|
-
|
|
13867
|
-
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; }
|
|
13868
|
-
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; }
|
|
13869
|
-
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; } } }; }
|
|
13870
|
-
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; } }
|
|
13871
|
-
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; }
|
|
13872
|
-
var Presets = function Presets(_ref) {
|
|
13873
|
-
var state = _ref.state,
|
|
13874
|
-
apiHandler = _ref.apiHandler,
|
|
13875
|
-
form = _ref.form,
|
|
13876
|
-
root = _ref.root,
|
|
13877
|
-
setUsedPreset = _ref.setUsedPreset,
|
|
13878
|
-
presets = _ref.presets,
|
|
13879
|
-
setPresets = _ref.setPresets;
|
|
13880
|
-
var Option = Select$1.Option;
|
|
13881
|
-
var _useState = useState(false),
|
|
13882
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
13883
|
-
isModalVisible = _useState2[0],
|
|
13884
|
-
setIsModalVisible = _useState2[1];
|
|
13885
|
-
var _useState3 = useState(''),
|
|
13886
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
13887
|
-
newPresetName = _useState4[0],
|
|
13888
|
-
setNewPresetName = _useState4[1];
|
|
13889
|
-
var _useState5 = useState(),
|
|
13890
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
13891
|
-
value = _useState6[0],
|
|
13892
|
-
setValue = _useState6[1];
|
|
13893
|
-
var _useState7 = useState([]),
|
|
13894
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
13895
|
-
presetIds = _useState8[0],
|
|
13896
|
-
setPresetIds = _useState8[1];
|
|
13897
|
-
var _useTranslation = useTranslation$1(),
|
|
13898
|
-
t = _useTranslation.t;
|
|
13899
|
-
useEffect(function () {
|
|
13900
|
-
getPresets();
|
|
13901
|
-
}, []);
|
|
13902
|
-
var savePreset = function savePreset() {
|
|
13903
|
-
if (state.selectedItems == undefined) return;
|
|
13904
|
-
setIsModalVisible(false);
|
|
13905
|
-
var names = [];
|
|
13906
|
-
var _iterator = _createForOfIteratorHelper$g(state.selectedItems),
|
|
13907
|
-
_step;
|
|
13908
|
-
try {
|
|
13909
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
13910
|
-
var item = _step.value;
|
|
13911
|
-
names.push(item.name);
|
|
13912
|
-
}
|
|
13913
|
-
} catch (err) {
|
|
13914
|
-
_iterator.e(err);
|
|
13915
|
-
} finally {
|
|
13916
|
-
_iterator.f();
|
|
13917
|
-
}
|
|
13918
|
-
var data = _objectSpread$C(_objectSpread$C({}, form.getFieldsValue(names)), {}, {
|
|
13919
|
-
newPresetName: newPresetName
|
|
13920
|
-
});
|
|
13921
|
-
data.dpi = parseInt(data.dpi);
|
|
13922
|
-
data.organization = root.getGlobalValue('organizationId');
|
|
13923
|
-
apiHandler.create({}, state.configuration.createPresetMapping, data);
|
|
13924
|
-
var dt = _objectSpread$C(_objectSpread$C({}, form.getFieldsValue(names)), {}, {
|
|
13925
|
-
name: newPresetName
|
|
13926
|
-
});
|
|
13927
|
-
setPresets({
|
|
13928
|
-
data: [dt].concat(_toConsumableArray(presets.data)),
|
|
13929
|
-
total: presets.total
|
|
13930
|
-
});
|
|
13931
|
-
};
|
|
13932
|
-
var getPresets = /*#__PURE__*/function () {
|
|
13933
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
13934
|
-
var res, ids, preset;
|
|
13935
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
13936
|
-
while (1) switch (_context.prev = _context.next) {
|
|
13937
|
-
case 0:
|
|
13938
|
-
_context.next = 2;
|
|
13939
|
-
return apiHandler.readList();
|
|
13940
|
-
case 2:
|
|
13941
|
-
res = _context.sent;
|
|
13942
|
-
ids = [];
|
|
13943
|
-
for (preset in res.data) {
|
|
13944
|
-
ids.push(res.data[preset]._id);
|
|
13945
|
-
delete res.data[preset]._id;
|
|
13946
|
-
}
|
|
13947
|
-
setPresetIds(ids);
|
|
13948
|
-
setPresets(res);
|
|
13949
|
-
case 7:
|
|
13950
|
-
case "end":
|
|
13951
|
-
return _context.stop();
|
|
13952
|
-
}
|
|
13953
|
-
}, _callee);
|
|
13954
|
-
}));
|
|
13955
|
-
return function getPresets() {
|
|
13956
|
-
return _ref2.apply(this, arguments);
|
|
13957
|
-
};
|
|
13958
|
-
}();
|
|
13959
|
-
var onPresetSelect = function onPresetSelect(index) {
|
|
13960
|
-
var preset = presets.data[index];
|
|
13961
|
-
if (!state.selectedItems) return;
|
|
13962
|
-
state.selectedItems.map(function (item) {
|
|
13963
|
-
if (isReadonly(item, form.getFieldsValue())) {
|
|
13964
|
-
delete preset[item.name];
|
|
13965
|
-
}
|
|
13966
|
-
});
|
|
13967
|
-
form.setFieldsValue(presets.data[index]);
|
|
13968
|
-
setUsedPreset({
|
|
13969
|
-
used: true,
|
|
13970
|
-
index: index
|
|
13971
|
-
});
|
|
13972
|
-
};
|
|
13973
|
-
var deletePreset = function deletePreset(index) {
|
|
13974
|
-
apiHandler["delete"](presetIds[index]);
|
|
13975
|
-
var data = presets.data;
|
|
13976
|
-
data.splice(index, 1);
|
|
13977
|
-
setPresets({
|
|
13978
|
-
data: data,
|
|
13979
|
-
total: presets.total
|
|
13980
|
-
});
|
|
13981
|
-
setValue(undefined);
|
|
13982
|
-
};
|
|
13983
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
13984
|
-
children: [/*#__PURE__*/jsx(Select$1, {
|
|
13985
|
-
showSearch: true,
|
|
13986
|
-
value: value,
|
|
13987
|
-
placeholder: t('backoffice.form.presets.placeholder'),
|
|
13988
|
-
optionFilterProp: "children",
|
|
13989
|
-
style: {
|
|
13990
|
-
width: '94%',
|
|
13991
|
-
paddingLeft: 0,
|
|
13992
|
-
marginBottom: 30
|
|
13993
|
-
},
|
|
13994
|
-
onChange: function onChange(index) {
|
|
13995
|
-
setValue(index);
|
|
13996
|
-
onPresetSelect(index);
|
|
13997
|
-
},
|
|
13998
|
-
children: presets === null || presets === void 0 ? void 0 : presets.data.map(function (dt, idx) {
|
|
13999
|
-
return /*#__PURE__*/jsx(Fragment, {
|
|
14000
|
-
children: /*#__PURE__*/jsxs(Option, {
|
|
14001
|
-
value: idx,
|
|
14002
|
-
children: [dt.name, /*#__PURE__*/jsx(Button, {
|
|
14003
|
-
icon: /*#__PURE__*/jsx(DeleteOutlined, {}),
|
|
14004
|
-
style: {
|
|
14005
|
-
"float": 'right'
|
|
14006
|
-
},
|
|
14007
|
-
onClick: function onClick() {
|
|
14008
|
-
return deletePreset(idx);
|
|
14009
|
-
}
|
|
14010
|
-
})]
|
|
14011
|
-
}, idx)
|
|
14012
|
-
});
|
|
14013
|
-
})
|
|
14014
|
-
}), /*#__PURE__*/jsx(Button, {
|
|
14015
|
-
type: "primary",
|
|
14016
|
-
onClick: function onClick() {
|
|
14017
|
-
return setIsModalVisible(true);
|
|
14018
|
-
},
|
|
14019
|
-
children: "Create"
|
|
14020
|
-
}), /*#__PURE__*/jsx(Modal$2, {
|
|
14021
|
-
title: "Create Preset",
|
|
14022
|
-
visible: isModalVisible,
|
|
14023
|
-
onOk: function onOk(e) {
|
|
14024
|
-
return savePreset();
|
|
14025
|
-
},
|
|
14026
|
-
onCancel: function onCancel() {
|
|
14027
|
-
return setIsModalVisible(false);
|
|
14028
|
-
},
|
|
14029
|
-
children: /*#__PURE__*/jsx(Input, {
|
|
14030
|
-
value: newPresetName,
|
|
14031
|
-
placeholder: "Preset Name",
|
|
14032
|
-
onChange: function onChange(e) {
|
|
14033
|
-
setNewPresetName(e.target.value);
|
|
14034
|
-
},
|
|
14035
|
-
style: {
|
|
14036
|
-
marginBottom: 15
|
|
14037
|
-
}
|
|
14038
|
-
})
|
|
14039
|
-
})]
|
|
14040
|
-
});
|
|
14041
|
-
};
|
|
14042
|
-
|
|
14043
|
-
var JsonEditor$2 = function JsonEditor(_ref) {
|
|
14044
|
-
var value = _ref.value,
|
|
14045
|
-
_onChange = _ref.onChange,
|
|
14046
|
-
setCanSave = _ref.setCanSave,
|
|
14047
|
-
data = _ref.data,
|
|
14048
|
-
height = _ref.height,
|
|
14049
|
-
savable = _ref.savable;
|
|
14050
|
-
var container = useRef(null);
|
|
14051
|
-
var _useState = useState(0),
|
|
14052
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
14053
|
-
counter = _useState2[0],
|
|
14054
|
-
setCounter = _useState2[1];
|
|
14055
|
-
var jsonEditor = useRef(null);
|
|
14056
|
-
var options = {
|
|
14057
|
-
mode: 'code',
|
|
14058
|
-
onChange: function onChange() {
|
|
14059
|
-
try {
|
|
14060
|
-
var e = jsonEditor.current.get();
|
|
14061
|
-
jsonEditor.current.validate();
|
|
14062
|
-
_onChange === null || _onChange === void 0 || _onChange(e);
|
|
14063
|
-
setCanSave(savable);
|
|
14064
|
-
} catch (_unused) {
|
|
14065
|
-
setCanSave(false);
|
|
14066
|
-
return;
|
|
14067
|
-
}
|
|
14068
|
-
}
|
|
14069
|
-
};
|
|
14070
|
-
useEffect(function () {
|
|
14071
|
-
jsonEditor.current = new JSONEditor(container.current, options);
|
|
14072
|
-
}, []);
|
|
14073
|
-
useEffect(function () {
|
|
14074
|
-
setCanSave(savable);
|
|
14075
|
-
// antd sets value after initiating once as undefined, the jsoneditor should only be set once with the initial value that gets set by antd
|
|
14076
|
-
if (counter == 2) {
|
|
14077
|
-
return;
|
|
14078
|
-
}
|
|
14079
|
-
if (!value) {
|
|
14080
|
-
jsonEditor.current.set(data !== null && data !== void 0 ? data : {});
|
|
14081
|
-
} else {
|
|
14082
|
-
jsonEditor.current.set(value);
|
|
14083
|
-
}
|
|
14084
|
-
setCounter(counter + 1);
|
|
14085
|
-
}, [value]);
|
|
14086
|
-
return /*#__PURE__*/jsx("div", {
|
|
14087
|
-
ref: container,
|
|
14088
|
-
id: "jsoneditor",
|
|
14089
|
-
style: {
|
|
14090
|
-
height: height !== null && height !== void 0 ? height : 600
|
|
14091
|
-
}
|
|
14092
|
-
});
|
|
14093
|
-
};
|
|
14094
|
-
|
|
14095
|
-
var ApiKey = function ApiKey(_ref) {
|
|
14096
|
-
var value = _ref.value,
|
|
14097
|
-
onChange = _ref.onChange,
|
|
14098
|
-
placeholder = _ref.placeholder;
|
|
14099
|
-
var _useState = useState(value),
|
|
14100
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
14101
|
-
_value = _useState2[0],
|
|
14102
|
-
setValue = _useState2[1];
|
|
13579
|
+
form = _ref.form,
|
|
13580
|
+
root = _ref.root;
|
|
13581
|
+
var _useTranslation = useTranslation(),
|
|
13582
|
+
t = _useTranslation.t;
|
|
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
|
+
});
|
|
13646
|
+
}
|
|
13647
|
+
});
|
|
13648
|
+
};
|
|
13649
|
+
var FormList$3 = observer(FormList$2, {
|
|
13650
|
+
forwardRef: true
|
|
13651
|
+
});
|
|
13652
|
+
|
|
13653
|
+
var ApiKey = function ApiKey(_ref) {
|
|
13654
|
+
var value = _ref.value,
|
|
13655
|
+
onChange = _ref.onChange,
|
|
13656
|
+
placeholder = _ref.placeholder;
|
|
13657
|
+
var _useState = useState(value),
|
|
13658
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13659
|
+
_value = _useState2[0],
|
|
13660
|
+
setValue = _useState2[1];
|
|
14103
13661
|
var _useTranslation = useTranslation$1(),
|
|
14104
13662
|
t = _useTranslation.t;
|
|
14105
13663
|
var generateApiKey = function generateApiKey() {
|
|
@@ -14234,8 +13792,8 @@ var Result = function Result(_ref) {
|
|
|
14234
13792
|
|
|
14235
13793
|
var success = "success-tRJ7j";
|
|
14236
13794
|
var error = "error-MtAFB";
|
|
14237
|
-
var css_248z$
|
|
14238
|
-
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);
|
|
14239
13797
|
|
|
14240
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";
|
|
14241
13799
|
|
|
@@ -14301,11 +13859,11 @@ var CustomButton$1 = observer(CustomButton, {
|
|
|
14301
13859
|
|
|
14302
13860
|
var wrapper$3 = "wrapper-GVe2h";
|
|
14303
13861
|
var buttonGroup = "button-group-GYt-T";
|
|
14304
|
-
var css_248z$
|
|
14305
|
-
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);
|
|
14306
13864
|
|
|
14307
|
-
function ownKeys$
|
|
14308
|
-
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; }
|
|
14309
13867
|
var SubTitle = function SubTitle(_ref) {
|
|
14310
13868
|
var _item$orientation, _item$buttonIds;
|
|
14311
13869
|
var item = _ref.item,
|
|
@@ -14314,7 +13872,7 @@ var SubTitle = function SubTitle(_ref) {
|
|
|
14314
13872
|
t = _useTranslation.t;
|
|
14315
13873
|
return /*#__PURE__*/jsx(Divider, {
|
|
14316
13874
|
orientation: (_item$orientation = item.orientation) !== null && _item$orientation !== void 0 ? _item$orientation : 'left',
|
|
14317
|
-
style: _objectSpread$
|
|
13875
|
+
style: _objectSpread$D({}, item.style),
|
|
14318
13876
|
children: /*#__PURE__*/jsxs("div", {
|
|
14319
13877
|
className: wrapper$3,
|
|
14320
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) {
|
|
@@ -14394,9 +13952,224 @@ var InputComponent = function InputComponent(_ref) {
|
|
|
14394
13952
|
}
|
|
14395
13953
|
});
|
|
14396
13954
|
};
|
|
14397
|
-
var InputComponent$1 = observer(InputComponent, {
|
|
14398
|
-
forwardRef: true
|
|
14399
|
-
});
|
|
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
|
+
};
|
|
14400
14173
|
|
|
14401
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)); }
|
|
14402
14175
|
function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
@@ -14983,8 +14756,8 @@ var _default = /*#__PURE__*/function (_ApiHandler) {
|
|
|
14983
14756
|
}]);
|
|
14984
14757
|
}(_default$d);
|
|
14985
14758
|
|
|
14986
|
-
function ownKeys$
|
|
14987
|
-
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; }
|
|
14988
14761
|
getLogger('Backoffice', 'SelectClientRelationCatalog');
|
|
14989
14762
|
function useSelectClientRelationCatalog (_ref) {
|
|
14990
14763
|
var onSelectedCatalog = _ref.onSelectedCatalog,
|
|
@@ -15153,7 +14926,7 @@ function useSelectClientRelationCatalog (_ref) {
|
|
|
15153
14926
|
case 22:
|
|
15154
14927
|
supplierData = _context2.sent;
|
|
15155
14928
|
case 23:
|
|
15156
|
-
onSelectedSupplier === null || onSelectedSupplier === void 0 || onSelectedSupplier(_objectSpread$
|
|
14929
|
+
onSelectedSupplier === null || onSelectedSupplier === void 0 || onSelectedSupplier(_objectSpread$B(_objectSpread$B({}, _selectedSupplier), {}, {
|
|
15157
14930
|
supplierGuid: catalogList === null || catalogList === void 0 || (_catalogList$ = catalogList[0]) === null || _catalogList$ === void 0 ? void 0 : _catalogList$.Subfolder
|
|
15158
14931
|
}), supplierData);
|
|
15159
14932
|
if (catalogId && catalogList.find(function (c) {
|
|
@@ -15219,8 +14992,8 @@ var customSelect = "custom-select-ESUJX";
|
|
|
15219
14992
|
var customSelectOption = "custom-select-option-dUA7N";
|
|
15220
14993
|
var avatarWrapper = "avatar-wrapper-Vg-xe";
|
|
15221
14994
|
var selectTextWrapper = "select-text-wrapper-hPSZW";
|
|
15222
|
-
var css_248z$
|
|
15223
|
-
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);
|
|
15224
14997
|
|
|
15225
14998
|
var Selector = function Selector(_ref) {
|
|
15226
14999
|
var items = _ref.items,
|
|
@@ -15371,202 +15144,915 @@ function SelectClientRelationCatalog (_ref) {
|
|
|
15371
15144
|
});
|
|
15372
15145
|
}
|
|
15373
15146
|
|
|
15374
|
-
var
|
|
15375
|
-
function
|
|
15376
|
-
|
|
15377
|
-
|
|
15378
|
-
|
|
15379
|
-
|
|
15380
|
-
|
|
15381
|
-
|
|
15382
|
-
|
|
15383
|
-
|
|
15384
|
-
|
|
15385
|
-
|
|
15386
|
-
|
|
15387
|
-
|
|
15388
|
-
|
|
15389
|
-
|
|
15390
|
-
|
|
15391
|
-
|
|
15392
|
-
|
|
15393
|
-
|
|
15394
|
-
|
|
15395
|
-
|
|
15396
|
-
|
|
15397
|
-
|
|
15398
|
-
|
|
15399
|
-
|
|
15400
|
-
var
|
|
15401
|
-
|
|
15402
|
-
|
|
15403
|
-
|
|
15404
|
-
|
|
15405
|
-
|
|
15406
|
-
|
|
15407
|
-
|
|
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;
|
|
15408
15432
|
});
|
|
15409
|
-
|
|
15410
|
-
|
|
15411
|
-
|
|
15412
|
-
|
|
15413
|
-
if (
|
|
15414
|
-
|
|
15415
|
-
|
|
15416
|
-
|
|
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
|
+
}
|
|
15417
15486
|
}
|
|
15418
|
-
|
|
15419
|
-
|
|
15420
|
-
|
|
15421
|
-
|
|
15422
|
-
|
|
15423
|
-
|
|
15424
|
-
|
|
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);
|
|
15425
15495
|
});
|
|
15426
|
-
|
|
15427
|
-
})["finally"](function () {
|
|
15428
|
-
setLoading(false);
|
|
15429
|
-
});
|
|
15496
|
+
}
|
|
15430
15497
|
}, []);
|
|
15431
15498
|
useEffect(function () {
|
|
15432
|
-
|
|
15433
|
-
|
|
15434
|
-
|
|
15435
|
-
|
|
15436
|
-
}
|
|
15437
|
-
}, [value, options]);
|
|
15438
|
-
var onSelectionChanged = function onSelectionChanged(value, option) {
|
|
15439
|
-
setSelected(option);
|
|
15440
|
-
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);
|
|
15441
15503
|
};
|
|
15442
|
-
var
|
|
15443
|
-
|
|
15444
|
-
|
|
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
|
+
}
|
|
15445
15526
|
};
|
|
15446
15527
|
return {
|
|
15447
|
-
|
|
15528
|
+
fetching: fetching,
|
|
15448
15529
|
options: options,
|
|
15449
|
-
|
|
15450
|
-
|
|
15451
|
-
|
|
15452
|
-
|
|
15453
|
-
|
|
15454
|
-
|
|
15455
|
-
/**
|
|
15456
|
-
* Returns the option(s) that match the given external value
|
|
15457
|
-
*/
|
|
15458
|
-
function findByValue(value, options, selectMapping) {
|
|
15459
|
-
if (!value) return undefined;
|
|
15460
|
-
if (Array.isArray(value)) return value.map(function (item) {
|
|
15461
|
-
return findByValue(item, options, selectMapping);
|
|
15462
|
-
});
|
|
15463
|
-
// if the externalValue is value we can compare it directly, otherwise we have to parse both option.data and value with the selectMapping.value
|
|
15464
|
-
var option = options.find(function (option) {
|
|
15465
|
-
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);
|
|
15466
|
-
});
|
|
15467
|
-
if (!option) {
|
|
15468
|
-
LOG$8.debug('findByValue: option not found, add dummy option for current value', value, options);
|
|
15469
|
-
//TODO: if we and server side filtering, the dummy option must be handled differently
|
|
15470
|
-
option = {
|
|
15471
|
-
label: (selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.externalValue) == 'value' ? value : getCombinedValues(value, selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.label),
|
|
15472
|
-
value: (selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.externalValue) == 'value' ? value : getCombinedValues(value, selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.value),
|
|
15473
|
-
data: value,
|
|
15474
|
-
isDummy: true
|
|
15475
|
-
};
|
|
15476
|
-
}
|
|
15477
|
-
return option;
|
|
15478
|
-
}
|
|
15479
|
-
|
|
15480
|
-
/**
|
|
15481
|
-
* Returns an option entry based on the selectMapping configuration
|
|
15482
|
-
*/
|
|
15483
|
-
function parseDataEntry(item, selectMapping) {
|
|
15484
|
-
return {
|
|
15485
|
-
label: selectMapping ? getCombinedValues(item, selectMapping.label) : item,
|
|
15486
|
-
value: selectMapping ? getCombinedValues(item, selectMapping.value) : item,
|
|
15487
|
-
data: item
|
|
15530
|
+
selected: selected,
|
|
15531
|
+
fetch: fetch,
|
|
15532
|
+
onRemove: onRemove,
|
|
15533
|
+
onFocus: onFocus,
|
|
15534
|
+
onSelect: onSelect
|
|
15488
15535
|
};
|
|
15489
15536
|
}
|
|
15490
15537
|
|
|
15491
|
-
|
|
15492
|
-
|
|
15493
|
-
*/
|
|
15494
|
-
function parseReturnData(options, selectMapping) {
|
|
15495
|
-
if (Array.isArray(options)) return options.map(function (option) {
|
|
15496
|
-
return parseReturnData(option, selectMapping);
|
|
15497
|
-
});
|
|
15498
|
-
return (selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.externalValue) == 'value' ? options.value : options.data;
|
|
15499
|
-
}
|
|
15538
|
+
var css_248z$j = ".darkmode .ant-select-selection-search-input {\n color: #fff;\n}\n";
|
|
15539
|
+
styleInject(css_248z$j);
|
|
15500
15540
|
|
|
15501
|
-
var _excluded$3 = ["apiInterface", "selectMapping", "apiMapping", "onChange", "value", "search", "options"];
|
|
15502
|
-
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; }
|
|
15503
|
-
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; }
|
|
15504
15541
|
var SelectWrapper = function SelectWrapper(_ref) {
|
|
15505
|
-
var
|
|
15506
|
-
|
|
15507
|
-
apiMapping = _ref.apiMapping,
|
|
15508
|
-
onChange = _ref.onChange,
|
|
15542
|
+
var onChange = _ref.onChange,
|
|
15543
|
+
onError = _ref.onError,
|
|
15509
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,
|
|
15510
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,
|
|
15511
15561
|
options = _ref.options,
|
|
15512
|
-
|
|
15513
|
-
|
|
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,
|
|
15514
15569
|
apiInterface: apiInterface,
|
|
15515
15570
|
selectMapping: selectMapping,
|
|
15516
|
-
|
|
15517
|
-
|
|
15518
|
-
|
|
15519
|
-
|
|
15520
|
-
|
|
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
|
|
15521
15584
|
});
|
|
15522
|
-
|
|
15523
|
-
|
|
15524
|
-
|
|
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,
|
|
15525
15605
|
options: state.options,
|
|
15526
|
-
|
|
15527
|
-
|
|
15528
|
-
|
|
15529
|
-
|
|
15530
|
-
|
|
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
|
+
});
|
|
15531
15613
|
};
|
|
15532
|
-
var
|
|
15614
|
+
var Select = observer(SelectWrapper, {
|
|
15533
15615
|
forwardRef: true
|
|
15534
15616
|
});
|
|
15535
|
-
var filterOption = function filterOption(input, option) {
|
|
15536
|
-
var _option$label;
|
|
15537
|
-
return ((_option$label = option === null || option === void 0 ? void 0 : option.label) !== null && _option$label !== void 0 ? _option$label : '').toLowerCase().includes(input.toLowerCase());
|
|
15538
|
-
};
|
|
15539
15617
|
|
|
15540
|
-
var
|
|
15541
|
-
|
|
15542
|
-
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
|
|
15550
|
-
|
|
15551
|
-
|
|
15552
|
-
|
|
15553
|
-
|
|
15554
|
-
|
|
15555
|
-
|
|
15556
|
-
|
|
15557
|
-
|
|
15558
|
-
|
|
15559
|
-
|
|
15560
|
-
|
|
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();
|
|
15561
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
|
+
})]
|
|
15562
16053
|
});
|
|
15563
16054
|
};
|
|
15564
16055
|
|
|
15565
|
-
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; } } }; }
|
|
15566
|
-
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; } }
|
|
15567
|
-
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; }
|
|
15568
|
-
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; }
|
|
15569
|
-
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; }
|
|
15570
16056
|
var LOG$7 = getLogger('Backoffice', 'Form');
|
|
15571
16057
|
var FormWrapper$1 = function FormWrapper(_ref, ref) {
|
|
15572
16058
|
var _state$selectedItems2;
|
|
@@ -15681,9 +16167,6 @@ var FormWrapper$1 = function FormWrapper(_ref, ref) {
|
|
|
15681
16167
|
return _ref4.apply(this, arguments);
|
|
15682
16168
|
};
|
|
15683
16169
|
}();
|
|
15684
|
-
var updateFormData = function updateFormData(data) {
|
|
15685
|
-
form.setFieldsValue(_objectSpread$y(_objectSpread$y({}, state.data), data));
|
|
15686
|
-
};
|
|
15687
16170
|
var onErrorInternal = function onErrorInternal(err, errorText) {
|
|
15688
16171
|
if (err instanceof DivaError && err.name) {
|
|
15689
16172
|
var _state$configuration$;
|
|
@@ -15714,263 +16197,6 @@ var FormWrapper$1 = function FormWrapper(_ref, ref) {
|
|
|
15714
16197
|
onErrorInternal('An unexpected error prevented finishing');
|
|
15715
16198
|
}
|
|
15716
16199
|
};
|
|
15717
|
-
function getRules(item, data) {
|
|
15718
|
-
var _item$rules;
|
|
15719
|
-
var rules = [];
|
|
15720
|
-
if (item.required != undefined) {
|
|
15721
|
-
var _state$hiddenRequired;
|
|
15722
|
-
rules.push({
|
|
15723
|
-
required: (_state$hiddenRequired = state.hiddenRequiredDisabled[typeof item.name == 'string' ? item.name : item.name.join('.')]) === null || _state$hiddenRequired === void 0 ? void 0 : _state$hiddenRequired.required
|
|
15724
|
-
});
|
|
15725
|
-
}
|
|
15726
|
-
if (((_item$rules = item.rules) === null || _item$rules === void 0 ? void 0 : _item$rules.type) == 'condition') {
|
|
15727
|
-
var condition = item.rules;
|
|
15728
|
-
var flatData = flatten(data);
|
|
15729
|
-
if (!condition.match.op && flatData[condition.match.field] == condition.match.value) {
|
|
15730
|
-
rules.push.apply(rules, _toConsumableArray(condition.rules));
|
|
15731
|
-
} else if (condition.match.op == 'gt' && flatData[condition.match.field] > condition.match.value) {
|
|
15732
|
-
rules.push.apply(rules, _toConsumableArray(condition.rules));
|
|
15733
|
-
}
|
|
15734
|
-
} else if (item.rules) {
|
|
15735
|
-
rules.push.apply(rules, _toConsumableArray(item.rules));
|
|
15736
|
-
}
|
|
15737
|
-
return rules;
|
|
15738
|
-
}
|
|
15739
|
-
function getLabel(item) {
|
|
15740
|
-
if (!item.label && item.type === 'button') return undefined;
|
|
15741
|
-
return item.label ? t(item.label, item.label) : item.name;
|
|
15742
|
-
}
|
|
15743
|
-
function getElement(item, data, setCanSave, state, _onChange, root, form, hidden, overwrittenName) {
|
|
15744
|
-
var _isReadonly, _state$hiddenRequired2;
|
|
15745
|
-
if (hidden) return /*#__PURE__*/jsx(Fragment, {});
|
|
15746
|
-
var name = overwrittenName || item.name;
|
|
15747
|
-
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;
|
|
15748
|
-
switch (item.type) {
|
|
15749
|
-
case 'select':
|
|
15750
|
-
return /*#__PURE__*/jsx(Select, {
|
|
15751
|
-
initialValue: item.defaultValue,
|
|
15752
|
-
apiInterface: item.apiInterface,
|
|
15753
|
-
mode: item.mode,
|
|
15754
|
-
useFirstValueAsDefault: item.useFirstValueAsDefault,
|
|
15755
|
-
canSetToUndefined: item.canSetToUndefined,
|
|
15756
|
-
selectMapping: item.selectMapping,
|
|
15757
|
-
mapping: item.mapping,
|
|
15758
|
-
allowCreate: item.allowCreate,
|
|
15759
|
-
flow: item.flow,
|
|
15760
|
-
translationPrefix: item.translationPrefix,
|
|
15761
|
-
values: item.values,
|
|
15762
|
-
search: item.search,
|
|
15763
|
-
disabled: disabled,
|
|
15764
|
-
wholeData: state.data,
|
|
15765
|
-
disabledConfig: item === null || item === void 0 ? void 0 : item['disabledSelection'],
|
|
15766
|
-
onChange: function onChange(value) {
|
|
15767
|
-
_onChange(name, item.valueField ? value[item.valueField] : value);
|
|
15768
|
-
},
|
|
15769
|
-
allowClear: item.allowClear,
|
|
15770
|
-
placeholder: item.placeholder,
|
|
15771
|
-
onError: function onError(text) {
|
|
15772
|
-
return onErrorInternal(text, text);
|
|
15773
|
-
}
|
|
15774
|
-
}, state.selectedItemsIndex);
|
|
15775
|
-
case 'selectSimple':
|
|
15776
|
-
return /*#__PURE__*/jsx(SimpleSelect, _objectSpread$y(_objectSpread$y({}, item), {}, {
|
|
15777
|
-
disabled: disabled,
|
|
15778
|
-
onChange: function onChange(value) {
|
|
15779
|
-
_onChange(name, value);
|
|
15780
|
-
}
|
|
15781
|
-
}));
|
|
15782
|
-
case 'textarea':
|
|
15783
|
-
return /*#__PURE__*/jsx(Input.TextArea, {
|
|
15784
|
-
disabled: disabled,
|
|
15785
|
-
autoSize: {
|
|
15786
|
-
minRows: 2,
|
|
15787
|
-
maxRows: 5
|
|
15788
|
-
},
|
|
15789
|
-
defaultValue: item.value,
|
|
15790
|
-
placeholder: item.placeholder,
|
|
15791
|
-
onChange: function onChange(e) {
|
|
15792
|
-
return _onChange === null || _onChange === void 0 ? void 0 : _onChange(name, e.target.value);
|
|
15793
|
-
}
|
|
15794
|
-
});
|
|
15795
|
-
case 'input':
|
|
15796
|
-
case 'password':
|
|
15797
|
-
case undefined:
|
|
15798
|
-
if (item.syncDataWithUserInput) {
|
|
15799
|
-
return /*#__PURE__*/jsx(InputComponent$1, {
|
|
15800
|
-
item: item,
|
|
15801
|
-
data: data,
|
|
15802
|
-
value: item.value,
|
|
15803
|
-
onChange: state.onInputChanged
|
|
15804
|
-
});
|
|
15805
|
-
}
|
|
15806
|
-
if (item.type == 'password') return /*#__PURE__*/jsx(Input.Password, {
|
|
15807
|
-
addonBefore: item.prefix,
|
|
15808
|
-
addonAfter: item.suffix,
|
|
15809
|
-
disabled: disabled,
|
|
15810
|
-
value: item.value,
|
|
15811
|
-
placeholder: item.placeholder,
|
|
15812
|
-
autoComplete: "new-password"
|
|
15813
|
-
});
|
|
15814
|
-
return /*#__PURE__*/jsx(Input, {
|
|
15815
|
-
addonBefore: item.prefix,
|
|
15816
|
-
addonAfter: item.suffix,
|
|
15817
|
-
disabled: disabled,
|
|
15818
|
-
value: item.value,
|
|
15819
|
-
placeholder: item.placeholder
|
|
15820
|
-
});
|
|
15821
|
-
case 'detailaction':
|
|
15822
|
-
return /*#__PURE__*/jsx(Button, {
|
|
15823
|
-
onClick: function onClick() {
|
|
15824
|
-
var _root$detailStore$ope, _root$detailStore;
|
|
15825
|
-
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, {
|
|
15826
|
-
configurationId: item.action.id,
|
|
15827
|
-
data: data,
|
|
15828
|
-
mappingData: data,
|
|
15829
|
-
callback: function callback(data) {
|
|
15830
|
-
if (!item.callbackMapping) return;
|
|
15831
|
-
var _iterator = _createForOfIteratorHelper$f(item.callbackMapping),
|
|
15832
|
-
_step;
|
|
15833
|
-
try {
|
|
15834
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
15835
|
-
var map = _step.value;
|
|
15836
|
-
form === null || form === void 0 || form.setFieldValue(map.sourceField, data[map.targetField]);
|
|
15837
|
-
}
|
|
15838
|
-
} catch (err) {
|
|
15839
|
-
_iterator.e(err);
|
|
15840
|
-
} finally {
|
|
15841
|
-
_iterator.f();
|
|
15842
|
-
}
|
|
15843
|
-
},
|
|
15844
|
-
title: item.action.label,
|
|
15845
|
-
type: item.action.type,
|
|
15846
|
-
description: item.action.description,
|
|
15847
|
-
footer: item.action.footer,
|
|
15848
|
-
width: item.action.width
|
|
15849
|
-
});
|
|
15850
|
-
},
|
|
15851
|
-
style: {
|
|
15852
|
-
width: '40%',
|
|
15853
|
-
marginLeft: '25%'
|
|
15854
|
-
},
|
|
15855
|
-
disabled: disabled,
|
|
15856
|
-
children: item.label
|
|
15857
|
-
});
|
|
15858
|
-
case 'richText':
|
|
15859
|
-
return /*#__PURE__*/jsx(RichTextEditor, {
|
|
15860
|
-
initValue: state.getData(name, data),
|
|
15861
|
-
name: name,
|
|
15862
|
-
onChange: _onChange
|
|
15863
|
-
});
|
|
15864
|
-
case 'number':
|
|
15865
|
-
return /*#__PURE__*/jsx(InputNumber, {
|
|
15866
|
-
disabled: disabled,
|
|
15867
|
-
value: item.value
|
|
15868
|
-
});
|
|
15869
|
-
case 'checkbox':
|
|
15870
|
-
return /*#__PURE__*/jsx(Checkbox, {
|
|
15871
|
-
disabled: disabled,
|
|
15872
|
-
value: item.value,
|
|
15873
|
-
onChange: function onChange(e) {
|
|
15874
|
-
var value = e.target.checked;
|
|
15875
|
-
var cbItem = item;
|
|
15876
|
-
if (value && cbItem !== null && cbItem !== void 0 && cbItem.valueOnEnabled) {
|
|
15877
|
-
value = root === null || root === void 0 ? void 0 : root.getGlobalValue(cbItem.valueOnEnabled.globalValue);
|
|
15878
|
-
}
|
|
15879
|
-
_onChange(name, value);
|
|
15880
|
-
}
|
|
15881
|
-
});
|
|
15882
|
-
case 'display':
|
|
15883
|
-
return /*#__PURE__*/jsx(DisplayInput, {
|
|
15884
|
-
translationPrefix: item.translationPrefix
|
|
15885
|
-
});
|
|
15886
|
-
case 'array':
|
|
15887
|
-
return /*#__PURE__*/jsx(FormList, {
|
|
15888
|
-
item: item,
|
|
15889
|
-
data: data
|
|
15890
|
-
});
|
|
15891
|
-
case 'object':
|
|
15892
|
-
return /*#__PURE__*/jsx(JsonEditor$2, {
|
|
15893
|
-
setCanSave: setCanSave,
|
|
15894
|
-
data: data,
|
|
15895
|
-
height: item.height,
|
|
15896
|
-
savable: true
|
|
15897
|
-
});
|
|
15898
|
-
case 'date':
|
|
15899
|
-
return /*#__PURE__*/jsx(DatePicker, {
|
|
15900
|
-
disabled: disabled
|
|
15901
|
-
});
|
|
15902
|
-
case 'subTitle':
|
|
15903
|
-
return /*#__PURE__*/jsx(SubTitle$1, {
|
|
15904
|
-
item: item,
|
|
15905
|
-
data: data
|
|
15906
|
-
});
|
|
15907
|
-
case 'apiKey':
|
|
15908
|
-
return /*#__PURE__*/jsx(ApiKey, {
|
|
15909
|
-
value: item.value,
|
|
15910
|
-
placeholder: item.placeholder
|
|
15911
|
-
});
|
|
15912
|
-
case 'selectClientRelationCatalog':
|
|
15913
|
-
return /*#__PURE__*/jsx("div", {
|
|
15914
|
-
style: {
|
|
15915
|
-
display: 'flex',
|
|
15916
|
-
gap: 16
|
|
15917
|
-
},
|
|
15918
|
-
children: /*#__PURE__*/jsx(SelectClientRelationCatalog, {
|
|
15919
|
-
dontLoadCatalogData: true,
|
|
15920
|
-
onSelectedSupplier: function onSelectedSupplier(supplier) {
|
|
15921
|
-
if (item.accountName) {
|
|
15922
|
-
var newData = state.onInputChanged(item.accountName, supplier === null || supplier === void 0 ? void 0 : supplier._id);
|
|
15923
|
-
if (!supplier) {
|
|
15924
|
-
newData = state.onInputChanged(name, undefined, newData);
|
|
15925
|
-
if (item.catalogCodex) state.onInputChanged(item.catalogCodex, undefined, newData);
|
|
15926
|
-
}
|
|
15927
|
-
}
|
|
15928
|
-
},
|
|
15929
|
-
initAccountId: item.accountName ? state.getData(item.accountName, data) : undefined,
|
|
15930
|
-
initCatalogId: state.getData(name, data),
|
|
15931
|
-
currentOrganizationId: data._id,
|
|
15932
|
-
onSelectedCatalog: function onSelectedCatalog(catalogItem) {
|
|
15933
|
-
var newData = state.onInputChanged(name, catalogItem === null || catalogItem === void 0 ? void 0 : catalogItem._id);
|
|
15934
|
-
if (item.catalogCodex) state.onInputChanged(item.catalogCodex, catalogItem === null || catalogItem === void 0 ? void 0 : catalogItem.codex, newData);
|
|
15935
|
-
},
|
|
15936
|
-
onError: function onError(text) {
|
|
15937
|
-
return onErrorInternal(text, text);
|
|
15938
|
-
},
|
|
15939
|
-
apiInterface: item.apiInterface
|
|
15940
|
-
})
|
|
15941
|
-
});
|
|
15942
|
-
case 'radio':
|
|
15943
|
-
return /*#__PURE__*/jsx(Radio.Group, {
|
|
15944
|
-
value: item.value,
|
|
15945
|
-
options: item.options.map(function (o) {
|
|
15946
|
-
var _o$disabled;
|
|
15947
|
-
return _objectSpread$y(_objectSpread$y({}, o), {}, {
|
|
15948
|
-
disabled: (_o$disabled = o.disabled) === null || _o$disabled === void 0 ? void 0 : _o$disabled.call(o, data)
|
|
15949
|
-
});
|
|
15950
|
-
}),
|
|
15951
|
-
buttonStyle: item.buttonStyle,
|
|
15952
|
-
optionType: item.optionType,
|
|
15953
|
-
defaultValue: item.defaultValue,
|
|
15954
|
-
onChange: function onChange(_ref7) {
|
|
15955
|
-
var value = _ref7.target.value;
|
|
15956
|
-
_onChange(name, value);
|
|
15957
|
-
}
|
|
15958
|
-
});
|
|
15959
|
-
case 'button':
|
|
15960
|
-
return /*#__PURE__*/jsx(CustomButton$1, {
|
|
15961
|
-
id: item.buttonId,
|
|
15962
|
-
data: data,
|
|
15963
|
-
useActionResult: {
|
|
15964
|
-
styles: true,
|
|
15965
|
-
message: true
|
|
15966
|
-
},
|
|
15967
|
-
icon: item.icon,
|
|
15968
|
-
callback: updateFormData
|
|
15969
|
-
});
|
|
15970
|
-
default:
|
|
15971
|
-
return /*#__PURE__*/jsx(Fragment, {});
|
|
15972
|
-
}
|
|
15973
|
-
}
|
|
15974
16200
|
return /*#__PURE__*/jsxs(Spin, {
|
|
15975
16201
|
spinning: state.loading,
|
|
15976
16202
|
children: [state.configuration.presetApiInterface && /*#__PURE__*/jsx(Presets, {
|
|
@@ -15999,125 +16225,37 @@ var FormWrapper$1 = function FormWrapper(_ref, ref) {
|
|
|
15999
16225
|
},
|
|
16000
16226
|
children: [state.configuration.itemSelector && /*#__PURE__*/jsx(Form$1.Item, {
|
|
16001
16227
|
name: state.configuration.itemSelector.name,
|
|
16002
|
-
rules: getRules(state.configuration.itemSelector, state.data),
|
|
16228
|
+
rules: state.getRules(state.configuration.itemSelector, state.data),
|
|
16003
16229
|
label: state.configuration.itemSelector.label ? t(state.configuration.itemSelector.label, state.configuration.itemSelector.label) : state.configuration.itemSelector.name,
|
|
16004
16230
|
valuePropName: state.configuration.itemSelector.type == 'checkbox' ? 'checked' : 'value',
|
|
16005
|
-
children: getElement(state.configuration.itemSelector, state.data, setCanSave, state, state.onItemSelectorChanged)
|
|
16231
|
+
children: getElement(state.configuration.itemSelector, state.data, setCanSave, state, state.onItemSelectorChanged, onErrorInternal)
|
|
16006
16232
|
}, state.configuration.itemSelector.name.toString()), (_state$selectedItems2 = state.selectedItems) === null || _state$selectedItems2 === void 0 ? void 0 : _state$selectedItems2.map(function (item) {
|
|
16007
|
-
var _state$
|
|
16233
|
+
var _state$hiddenRequired, _state$hiddenRequired2, _state$hiddenRequired3;
|
|
16008
16234
|
return /*#__PURE__*/jsxs("div", {
|
|
16009
|
-
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, {
|
|
16010
16236
|
name: item.name,
|
|
16011
|
-
rules: getRules(item, state.data),
|
|
16012
|
-
label: getLabel(item),
|
|
16237
|
+
rules: state.getRules(item, state.data),
|
|
16238
|
+
label: getLabel(item, t),
|
|
16013
16239
|
valuePropName: item.type == 'checkbox' ? 'checked' : 'value',
|
|
16014
16240
|
initialValue: item === null || item === void 0 ? void 0 : item.defaultValue,
|
|
16015
16241
|
hasFeedback: !!state.fieldErrors[item.name.toString()],
|
|
16016
16242
|
validateStatus: !!state.fieldErrors[item.name.toString()] ? 'error' : undefined,
|
|
16017
16243
|
help: state.fieldErrors[item.name.toString()],
|
|
16018
|
-
hidden: (_state$
|
|
16019
|
-
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)
|
|
16020
16246
|
}, Array.isArray(item.name) ? item.name.join('.') : item.name)]
|
|
16021
16247
|
}, item.name.toString());
|
|
16022
16248
|
})]
|
|
16023
16249
|
})]
|
|
16024
16250
|
});
|
|
16025
|
-
function FormList(_ref8) {
|
|
16026
|
-
var item = _ref8.item,
|
|
16027
|
-
data = _ref8.data;
|
|
16028
|
-
return /*#__PURE__*/jsx(Form$1.List, {
|
|
16029
|
-
name: item.name,
|
|
16030
|
-
initialValue: item.initialValue,
|
|
16031
|
-
children: function children(fields, _ref9) {
|
|
16032
|
-
var add = _ref9.add,
|
|
16033
|
-
remove = _ref9.remove;
|
|
16034
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
16035
|
-
children: [fields.map(function (_ref10) {
|
|
16036
|
-
var key = _ref10.key,
|
|
16037
|
-
name = _ref10.name;
|
|
16038
|
-
return /*#__PURE__*/jsx(Fragment, {
|
|
16039
|
-
children: /*#__PURE__*/jsxs("div", {
|
|
16040
|
-
style: {
|
|
16041
|
-
display: 'flex'
|
|
16042
|
-
},
|
|
16043
|
-
children: [/*#__PURE__*/jsx(MinusCircleOutlined, {
|
|
16044
|
-
onClick: function onClick() {
|
|
16045
|
-
return remove(name);
|
|
16046
|
-
}
|
|
16047
|
-
}), /*#__PURE__*/jsx("div", {
|
|
16048
|
-
style: {
|
|
16049
|
-
flexGrow: 1
|
|
16050
|
-
},
|
|
16051
|
-
children: item.items.map(function (i) {
|
|
16052
|
-
var _state$hiddenRequired6;
|
|
16053
|
-
var n = [name].concat(_toConsumableArray(Array.isArray(i.name) ? i.name : [i.name]));
|
|
16054
|
-
var hidden = !!i.hidden;
|
|
16055
|
-
if (i.hidden && data) {
|
|
16056
|
-
if (typeof i.hidden === 'function') {
|
|
16057
|
-
var _data;
|
|
16058
|
-
if ((_data = data[item.name]) !== null && _data !== void 0 && _data[n[0]]) {
|
|
16059
|
-
hidden = i.hidden(data[item.name][n[0]]);
|
|
16060
|
-
} else hidden = false;
|
|
16061
|
-
}
|
|
16062
|
-
}
|
|
16063
|
-
if (!hidden) hidden = (_state$hiddenRequired6 = state.hiddenRequiredDisabled[typeof n == 'string' ? n : n.join('.')]) === null || _state$hiddenRequired6 === void 0 ? void 0 : _state$hiddenRequired6.hidden;
|
|
16064
|
-
return /*#__PURE__*/jsx(Fragment, {
|
|
16065
|
-
children: /*#__PURE__*/jsx(Form$1.Item, {
|
|
16066
|
-
name: n,
|
|
16067
|
-
rules: getRules(i, state.data),
|
|
16068
|
-
label: getLabel(i),
|
|
16069
|
-
valuePropName: i.type == 'checkbox' ? 'checked' : 'value',
|
|
16070
|
-
initialValue: i === null || i === void 0 ? void 0 : i.defaultValue,
|
|
16071
|
-
hasFeedback: !!state.fieldErrors[n.toString()],
|
|
16072
|
-
validateStatus: !!state.fieldErrors[n.toString()] ? 'error' : undefined,
|
|
16073
|
-
help: state.fieldErrors[n.toString()],
|
|
16074
|
-
hidden: hidden,
|
|
16075
|
-
children: getElement(i, state.data, setCanSave, state, state.onInputChanged, root, form, hidden, [].concat(_toConsumableArray(item.name), _toConsumableArray(Array.isArray(n) ? n : [n])))
|
|
16076
|
-
}, key)
|
|
16077
|
-
});
|
|
16078
|
-
})
|
|
16079
|
-
})]
|
|
16080
|
-
})
|
|
16081
|
-
});
|
|
16082
|
-
}), /*#__PURE__*/jsx(Form$1.Item, {
|
|
16083
|
-
children: /*#__PURE__*/jsx(Button, {
|
|
16084
|
-
type: "dashed",
|
|
16085
|
-
onClick: function onClick() {
|
|
16086
|
-
return add();
|
|
16087
|
-
},
|
|
16088
|
-
block: true,
|
|
16089
|
-
icon: /*#__PURE__*/jsx(PlusOutlined, {}),
|
|
16090
|
-
children: t('backoffice.add_field')
|
|
16091
|
-
})
|
|
16092
|
-
})]
|
|
16093
|
-
});
|
|
16094
|
-
}
|
|
16095
|
-
});
|
|
16096
|
-
}
|
|
16097
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
|
+
}
|
|
16098
16256
|
var Form = observer(FormWrapper$1, {
|
|
16099
16257
|
forwardRef: true
|
|
16100
16258
|
});
|
|
16101
|
-
function DisplayInput(props) {
|
|
16102
|
-
var _useTranslation2 = useTranslation$1(),
|
|
16103
|
-
t = _useTranslation2.t;
|
|
16104
|
-
return /*#__PURE__*/jsx(Input, _objectSpread$y(_objectSpread$y({}, props), {}, {
|
|
16105
|
-
disabled: true,
|
|
16106
|
-
value: t(props.translationPrefix + '.' + props.value)
|
|
16107
|
-
}));
|
|
16108
|
-
}
|
|
16109
|
-
function isReadonly(item, data) {
|
|
16110
|
-
if (_typeof(item.readonly) != 'object') {
|
|
16111
|
-
return item.readonly;
|
|
16112
|
-
}
|
|
16113
|
-
var flatData = flatten(data);
|
|
16114
|
-
if (!item.readonly.op && flatData[item.readonly.field] == item.readonly.value) {
|
|
16115
|
-
return true;
|
|
16116
|
-
} else if (item.readonly.op == 'gt' && flatData[item.readonly.field] > item.readonly.value) {
|
|
16117
|
-
return true;
|
|
16118
|
-
}
|
|
16119
|
-
return false;
|
|
16120
|
-
}
|
|
16121
16259
|
|
|
16122
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; }
|
|
16123
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; }
|
|
@@ -20075,7 +20213,7 @@ function _createForOfIteratorHelper$8(r, e) { var t = "undefined" != typeof Symb
|
|
|
20075
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; } }
|
|
20076
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; }
|
|
20077
20215
|
var FileUploadWrapper = function FileUploadWrapper(_ref) {
|
|
20078
|
-
_ref.id;
|
|
20216
|
+
var id = _ref.id;
|
|
20079
20217
|
var _useDivaCore = useDivaCore(),
|
|
20080
20218
|
apiConfig = _useDivaCore.state.apiConfig;
|
|
20081
20219
|
var root = useStore();
|
|
@@ -20214,7 +20352,7 @@ var FileUploadWrapper = function FileUploadWrapper(_ref) {
|
|
|
20214
20352
|
return dt._id;
|
|
20215
20353
|
}));
|
|
20216
20354
|
}
|
|
20217
|
-
})
|
|
20355
|
+
}, id)
|
|
20218
20356
|
}), /*#__PURE__*/jsx(Button, {
|
|
20219
20357
|
htmlType: "submit",
|
|
20220
20358
|
type: "primary",
|
|
@@ -24884,7 +25022,7 @@ var FilterBox = /*#__PURE__*/memo(function (_ref) {
|
|
|
24884
25022
|
value: getLabelByValue((_value2 = data.value) !== null && _value2 !== void 0 ? _value2 : data, filter.options)
|
|
24885
25023
|
}]);
|
|
24886
25024
|
}
|
|
24887
|
-
})]
|
|
25025
|
+
}, id)]
|
|
24888
25026
|
}, filter.type + filter.title);
|
|
24889
25027
|
case 'slider':
|
|
24890
25028
|
//Masse
|