@crystaldesign/diva-backoffice 24.2.3 → 24.3.0-beta.1

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.
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import React, { createContext, useState, useEffect, useMemo, useCallback, useRef, useImperativeHandle, useReducer, createRef, forwardRef, useContext, memo } from 'react';
3
3
  import 'antd/dist/reset.css';
4
- import { Button, Spin, Descriptions, Select as Select$1, Alert, Modal as Modal$2, Input, Popover, Typography, Divider, Avatar, Form as Form$1, Radio, DatePicker, Checkbox, InputNumber, Card, Tooltip, Upload, Space, Row, Col, Steps, Result as Result$1, Layout, Switch, Menu as Menu$1, Collapse, Table as Table$1, Popconfirm, Tabs, Image, Progress, Slider, Breadcrumb, List as List$1, message, Cascader, Skeleton, Drawer, ConfigProvider, theme } from 'antd';
4
+ import { Button, Spin, Descriptions, Select as Select$2, Alert, Modal as Modal$2, Input, Popover, Typography, Divider, Avatar, Form as Form$1, Radio, DatePicker, Checkbox, InputNumber, Card, Tooltip, Upload, Space, Row, Col, Steps, Result as Result$1, Layout, Switch, Menu as Menu$1, Collapse, Table as Table$1, Popconfirm, Tabs, Image, Progress, Slider, Breadcrumb, List as List$1, message, Cascader, Skeleton, Drawer, ConfigProvider, theme } from 'antd';
5
5
  import { observer } from 'mobx-react-lite';
6
6
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
7
7
  import { getLogger, CoreError, useDivaCore, useTranslation, DivaUtils } from '@crystaldesign/diva-core';
@@ -96,6 +96,7 @@ import classnames from 'classnames';
96
96
  import Collapsible from 'react-collapsible';
97
97
  import QuestionOutlined from '@ant-design/icons/QuestionOutlined';
98
98
  import { TransformWrapper, TransformComponent } from 'react-zoom-pan-pinch';
99
+ import { useTranslation as useTranslation$1 } from 'react-i18next';
99
100
  import { stringify } from 'csv';
100
101
  import InfiniteScroll from 'react-infinite-scroll-component';
101
102
  import ReactCrop from 'react-image-crop';
@@ -1913,26 +1914,28 @@ function loadConfiguration(t, root, config, lang) {
1913
1914
  },
1914
1915
  select: {
1915
1916
  filterField: 'status',
1916
- search: false,
1917
- defaultValue: t('backoffice.table.applicationlogs.filter.dropdown.all'),
1918
- applyDefaultValue: false,
1919
- options: [{
1920
- lable: t('backoffice.table.applicationlogs.filter.dropdown.all'),
1921
- value: '',
1922
- data: ''
1923
- }, {
1924
- lable: 'Timeout',
1925
- value: 'Timeout',
1926
- data: 'TIMEOUT'
1927
- }, {
1928
- lable: 'Success',
1929
- value: 'Success',
1930
- data: 'SUCCESS'
1931
- }, {
1932
- lable: 'Error',
1933
- value: 'Error',
1934
- data: 'ERROR'
1935
- }]
1917
+ settings: {
1918
+ search: false,
1919
+ options: [{
1920
+ label: t('backoffice.table.applicationlogs.filter.dropdown.all'),
1921
+ value: 'ALL',
1922
+ data: 'ALL'
1923
+ }, {
1924
+ label: 'Timeout',
1925
+ value: 'Timeout',
1926
+ data: 'TIMEOUT'
1927
+ }, {
1928
+ label: 'Success',
1929
+ value: 'Success',
1930
+ data: 'SUCCESS'
1931
+ }, {
1932
+ label: 'Error',
1933
+ value: 'Error',
1934
+ data: 'ERROR'
1935
+ }]
1936
+ },
1937
+ defaultValue: 'ALL',
1938
+ applyDefaultValue: false
1936
1939
  }
1937
1940
  },
1938
1941
  mapping: {
@@ -2054,7 +2057,37 @@ function loadConfiguration(t, root, config, lang) {
2054
2057
  }],
2055
2058
  title: t('backoffice.table.allusers.roleselector.title'),
2056
2059
  label: t('backoffice.table.allusers.roleselector.features')
2057
- }]
2060
+ }, {
2061
+ actionType: 'Modal',
2062
+ title: t('backoffice.table.allusers.modal.title.aktivateuser'),
2063
+ text: t('backoffice.table.allusers.modal.text11'),
2064
+ label: t('backoffice.table.allusers.modal.label.aktivate'),
2065
+ type: 'Form',
2066
+ id: 'FormActivateUser',
2067
+ mapping: {
2068
+ type: 'body',
2069
+ map: [{
2070
+ sourceField: '_id',
2071
+ targetField: 'id'
2072
+ }, {
2073
+ sourceValue: window.location.origin,
2074
+ targetField: 'redirectTo'
2075
+ }]
2076
+ },
2077
+ rule: [{
2078
+ match: {
2079
+ sourceField: 'isActive',
2080
+ value: false
2081
+ }
2082
+ }]
2083
+ }],
2084
+ createAction: {
2085
+ actionType: 'Detail',
2086
+ type: 'Form',
2087
+ id: 'FormUserDetails',
2088
+ title: t('backoffice.table.allusers.createaction.title.userdetails'),
2089
+ permission: 'backoffice_admin_users'
2090
+ }
2058
2091
  },
2059
2092
  TableAllOrganizations: {
2060
2093
  type: 'Table',
@@ -2740,6 +2773,7 @@ function loadConfiguration(t, root, config, lang) {
2740
2773
  canRefresh: true,
2741
2774
  initialCall: false,
2742
2775
  clientRelations: true,
2776
+ dontLoadCatalogData: true,
2743
2777
  columns: [{
2744
2778
  title: t('backoffice.table.partlists.columns.ArticleCodex'),
2745
2779
  field: 'ArticleCodex',
@@ -2795,6 +2829,7 @@ function loadConfiguration(t, root, config, lang) {
2795
2829
  }, {
2796
2830
  title: t('backoffice.table.partlists.columns.RetailPrefix'),
2797
2831
  field: 'RetailPrefix',
2832
+ editable: true,
2798
2833
  sorter: 9,
2799
2834
  filter: 'advanced',
2800
2835
  width: 110
@@ -2948,21 +2983,17 @@ function loadConfiguration(t, root, config, lang) {
2948
2983
  type: 'Form',
2949
2984
  id: 'FormApplicationTranslationsEdit',
2950
2985
  title: t('backoffice.table.translation.title')
2951
- }, {
2952
- actionType: 'Detail',
2953
- type: 'Form',
2954
- id: 'FormApplicationTranslations',
2955
- title: 'Lokalisierung',
2956
- label: t('backoffice.rowAction.title.overwrite')
2957
2986
  }],
2958
2987
  filter: {
2959
2988
  select: {
2960
- search: true,
2989
+ settings: {
2990
+ search: true,
2991
+ apiInterface: {
2992
+ read: '${adminService}/locales/namespaces'
2993
+ }
2994
+ },
2961
2995
  defaultValue: 'default',
2962
- filterField: 'namespace',
2963
- apiInterface: {
2964
- read: '${adminService}/locales/namespaces'
2965
- }
2996
+ filterField: 'namespace'
2966
2997
  },
2967
2998
  search: {
2968
2999
  fields: ['key', 'locales.de.default', 'locales.fr.default', 'locales.en.default', 'locales.it.default']
@@ -3736,33 +3767,9 @@ function loadConfiguration(t, root, config, lang) {
3736
3767
  actionType: 'Modal',
3737
3768
  title: t('backoffice.table.invitations.rowAction.aktivateuser.title'),
3738
3769
  text: t('backoffice.table.invitations.rowAction.aktivateuser.text'),
3739
- label: t('backoffice.table.invitations.rowAction.aktivateuser.label'),
3740
- type: 'Form',
3741
- id: 'FormSendInvitation',
3742
- mapping: {
3743
- type: 'body',
3744
- map: [{
3745
- sourceField: '_id',
3746
- targetField: 'id'
3747
- }, {
3748
- sourceValue: window.location.origin,
3749
- targetField: 'redirectTo'
3750
- }, {
3751
- sourceField: 'organizationId',
3752
- targetField: 'organizationId'
3753
- }]
3770
+ label: function label(data) {
3771
+ return data.send == false ? t('backoffice.table.invitations.rowAction.aktivateuser.label') : t('backoffice.table.invitations.rowAction.resendMail');
3754
3772
  },
3755
- rule: [{
3756
- match: {
3757
- sourceField: 'send',
3758
- value: false
3759
- }
3760
- }]
3761
- }, {
3762
- actionType: 'Modal',
3763
- title: t('backoffice.table.invitations.rowAction.aktivateuser.title'),
3764
- text: t('backoffice.table.invitations.rowAction.aktivateuser.text'),
3765
- label: t('backoffice.table.invitations.rowAction.resendMail'),
3766
3773
  type: 'Form',
3767
3774
  id: 'FormSendInvitation',
3768
3775
  mapping: {
@@ -3777,13 +3784,7 @@ function loadConfiguration(t, root, config, lang) {
3777
3784
  sourceField: 'organizationId',
3778
3785
  targetField: 'organizationId'
3779
3786
  }]
3780
- },
3781
- rule: [{
3782
- match: {
3783
- sourceField: 'send',
3784
- value: true
3785
- }
3786
- }]
3787
+ }
3787
3788
  }]
3788
3789
  },
3789
3790
  TableSubOrganizations: {
@@ -3976,6 +3977,15 @@ function loadConfiguration(t, root, config, lang) {
3976
3977
  targetField: 'organizationId'
3977
3978
  }]
3978
3979
  },
3980
+ createAction: {
3981
+ actionType: 'Detail',
3982
+ type: 'SelectOrCreate',
3983
+ id: 'SelectOrCreateNewMember',
3984
+ title: t('backoffice.table.allorgusers.createAction.title'),
3985
+ label: t('backoffice.table.allorgusers.createAction.title'),
3986
+ disableOnToggle: true,
3987
+ permission: 'backoffice_create_user'
3988
+ },
3979
3989
  downloadAction: {
3980
3990
  actionType: 'CsvExport',
3981
3991
  fileName: 'benutzer'
@@ -4007,6 +4017,30 @@ function loadConfiguration(t, root, config, lang) {
4007
4017
  sourceField: 'phoneNumber'
4008
4018
  }]
4009
4019
  }
4020
+ }, {
4021
+ actionType: 'Modal',
4022
+ title: t('backoffice.table.allorgusers.rowAction.title.aktivateuser'),
4023
+ text: t('backoffice.table.allorgusers.rowAction.text'),
4024
+ label: t('backoffice.table.allorgusers.rowAction.lable.aktivate'),
4025
+ type: 'Form',
4026
+ id: 'FormActivateUser',
4027
+ permission: 'backoffice_create_user',
4028
+ mapping: {
4029
+ type: 'body',
4030
+ map: [{
4031
+ sourceField: '_id',
4032
+ targetField: 'id'
4033
+ }, {
4034
+ sourceValue: window.location.origin,
4035
+ targetField: 'redirectTo'
4036
+ }]
4037
+ },
4038
+ rule: [{
4039
+ match: {
4040
+ sourceField: 'isActive',
4041
+ value: false
4042
+ }
4043
+ }]
4010
4044
  }]
4011
4045
  },
4012
4046
  TableViewpoints: {
@@ -5213,8 +5247,7 @@ function loadConfiguration(t, root, config, lang) {
5213
5247
  }, {
5214
5248
  title: t('backoffice.table.idmimports.fullName'),
5215
5249
  field: 'fullName',
5216
- sorter: 6,
5217
- filter: 'advanced'
5250
+ sorter: 6
5218
5251
  }, {
5219
5252
  title: t('backoffice.table.idmimports.user.name'),
5220
5253
  field: 'user.name',
@@ -5230,13 +5263,14 @@ function loadConfiguration(t, root, config, lang) {
5230
5263
  field: 'startTime',
5231
5264
  sorter: 3,
5232
5265
  type: 'unixTimeStamp',
5233
- filter: 'advanced'
5266
+ filter: 'interval'
5234
5267
  }, {
5235
5268
  title: t('backoffice.table.idmimports.endTime'),
5236
5269
  field: 'endTime',
5237
5270
  type: 'unixTimeStamp',
5238
5271
  sorter: 2,
5239
- dateInSeconds: false
5272
+ dateInSeconds: false,
5273
+ filter: 'interval'
5240
5274
  }, {
5241
5275
  title: t('backoffice.table.idmimports.lastUpdated'),
5242
5276
  field: 'lastUpdated',
@@ -5288,6 +5322,11 @@ function loadConfiguration(t, root, config, lang) {
5288
5322
  title: t('backoffice.table.idmimports.fileName'),
5289
5323
  field: 'fileName'
5290
5324
  }],
5325
+ filter: {
5326
+ search: {
5327
+ fields: ['_id', 'user.name', 'user.familyName', 'state', 'stateMessage', 'fullProgress', 'organizationId', 'serverName', 'fileName']
5328
+ }
5329
+ },
5291
5330
  apiInterface: {
5292
5331
  read: {
5293
5332
  list: '${catalogService}/idmImports',
@@ -6757,6 +6796,29 @@ function loadConfiguration(t, root, config, lang) {
6757
6796
  }]
6758
6797
  }
6759
6798
  },
6799
+ FormActivateUser: {
6800
+ type: 'Form',
6801
+ apiInterface: {
6802
+ create: {
6803
+ url: '${authService}/v2/users/{id}/activate?redirectTo={redirectTo}',
6804
+ method: 'POST'
6805
+ }
6806
+ },
6807
+ items: [{
6808
+ name: 'id',
6809
+ hidden: true,
6810
+ readonly: true
6811
+ }, {
6812
+ name: 'redirectTo',
6813
+ label: t('backoffice.form.activateuser.items.redirectTo'),
6814
+ rules: [{
6815
+ pattern: new RegExp('((https?)://).*'),
6816
+ required: true,
6817
+ message: t('backoffice.form.activateuser.items.redirectTo.rules')
6818
+ }],
6819
+ type: 'input'
6820
+ }]
6821
+ },
6760
6822
  FormApplicationTranslationsEdit: {
6761
6823
  type: 'Form',
6762
6824
  title: t('backoffice.form.applicationtranslationedit.title'),
@@ -8403,7 +8465,33 @@ function loadConfiguration(t, root, config, lang) {
8403
8465
  var _root$dataStore;
8404
8466
  root === null || root === void 0 || (_root$dataStore = root.dataStore) === null || _root$dataStore === void 0 || _root$dataStore.setSelectedOrganizationId(data._id);
8405
8467
  }
8406
- }
8468
+ },
8469
+ additionalActions: [{
8470
+ actionType: 'Callback',
8471
+ label: t('backoffice.orgtree.openAction'),
8472
+ id: 'ChangeToOrganization',
8473
+ rule: [{
8474
+ or: [{
8475
+ match: {
8476
+ sourceField: 'type',
8477
+ value: 'DEALER'
8478
+ }
8479
+ }, {
8480
+ match: {
8481
+ sourceField: 'type',
8482
+ value: 'RETAILER'
8483
+ }
8484
+ }, {
8485
+ match: {
8486
+ sourceField: 'type',
8487
+ value: 'RETAILERCHILD'
8488
+ }
8489
+ }]
8490
+ }],
8491
+ callback: function callback(data) {
8492
+ root === null || root === void 0 || root.actions.setOrganization(data.id);
8493
+ }
8494
+ }]
8407
8495
  },
8408
8496
  DescriptionCurrentOrganization: {
8409
8497
  type: 'Description',
@@ -8924,6 +9012,50 @@ function loadConfiguration(t, root, config, lang) {
8924
9012
  }]
8925
9013
  }
8926
9014
  },
9015
+ SelectOrCreateNewMember: {
9016
+ type: 'SelectOrCreate',
9017
+ mode: 'single',
9018
+ apiInterface: {
9019
+ create: '${authService}/v2/organizations/{organizationId}/members/{userId}?roleId=seller',
9020
+ read: {
9021
+ list: '${authService}/v2/organizations/${organizationId}/members?all=true',
9022
+ filterServerSide: true,
9023
+ fallBackToParams: false,
9024
+ permissions: {
9025
+ backoffice_admin_users: '${authService}/v2/users'
9026
+ }
9027
+ }
9028
+ },
9029
+ readMapping: {
9030
+ type: 'query',
9031
+ map: [{
9032
+ targetField: 'organizationId',
9033
+ globalValue: 'selectedOrganizationId'
9034
+ }]
9035
+ },
9036
+ selectMapping: {
9037
+ label: 'mainEmail',
9038
+ value: '_id',
9039
+ searchField: [{
9040
+ field: 'mainEmail',
9041
+ filter: 'contains'
9042
+ }]
9043
+ },
9044
+ formId: 'FormUserDetails',
9045
+ actionMapping: {
9046
+ type: 'body',
9047
+ map: [{
9048
+ targetField: 'userId',
9049
+ sourceField: '_id'
9050
+ }, {
9051
+ targetField: 'organizationId',
9052
+ globalValue: 'selectedOrganizationId'
9053
+ }]
9054
+ },
9055
+ onError: {
9056
+ AUTH_0020: t('errorcodes._source.labels.error.AUTH_0020')
9057
+ }
9058
+ },
8927
9059
  MediaUploadOrganizationLogoMobile: {
8928
9060
  type: 'MediaUpload',
8929
9061
  size: 'medium',
@@ -11396,6 +11528,7 @@ function ActionButton (_ref) {
11396
11528
  danger = _ref.danger,
11397
11529
  buttonType = _ref.buttonType;
11398
11530
  var root = useStore();
11531
+ var label = typeof action.label == 'function' ? action.label(data) : action.label;
11399
11532
  var ButtonType = type == 'Button' ? Button : A;
11400
11533
  var disable = false;
11401
11534
  if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
@@ -11472,7 +11605,7 @@ function ActionButton (_ref) {
11472
11605
  width: action.width,
11473
11606
  footer: action.footer
11474
11607
  });
11475
- return _context.abrupt("break", 31);
11608
+ return _context.abrupt("break", 34);
11476
11609
  case 8:
11477
11610
  if (!(disable || shouldExecuted && !shouldExecuted())) {
11478
11611
  _context.next = 10;
@@ -11481,7 +11614,7 @@ function ActionButton (_ref) {
11481
11614
  return _context.abrupt("return");
11482
11615
  case 10:
11483
11616
  root.contentStore.setSelectedMenuItem(action.id);
11484
- return _context.abrupt("break", 31);
11617
+ return _context.abrupt("break", 34);
11485
11618
  case 12:
11486
11619
  if (!(disable || shouldExecuted && !shouldExecuted())) {
11487
11620
  _context.next = 14;
@@ -11494,7 +11627,7 @@ function ActionButton (_ref) {
11494
11627
  data: data,
11495
11628
  callback: callback !== null && callback !== void 0 ? callback : function () {}
11496
11629
  });
11497
- return _context.abrupt("break", 31);
11630
+ return _context.abrupt("break", 34);
11498
11631
  case 16:
11499
11632
  apiInterface = new _default$d({
11500
11633
  apiInterface: action.apiInterface,
@@ -11531,8 +11664,16 @@ function ActionButton (_ref) {
11531
11664
  _context.t1 = _context["catch"](17);
11532
11665
  root.error = action.errorText;
11533
11666
  case 30:
11534
- return _context.abrupt("break", 31);
11667
+ return _context.abrupt("break", 34);
11535
11668
  case 31:
11669
+ if (!(disable || shouldExecuted && !shouldExecuted())) {
11670
+ _context.next = 33;
11671
+ break;
11672
+ }
11673
+ return _context.abrupt("return");
11674
+ case 33:
11675
+ callback === null || callback === void 0 || callback(data);
11676
+ case 34:
11536
11677
  case "end":
11537
11678
  return _context.stop();
11538
11679
  }
@@ -11544,13 +11685,13 @@ function ActionButton (_ref) {
11544
11685
  }();
11545
11686
  switch (action.actionType) {
11546
11687
  case 'SwitchButton':
11547
- var lable;
11688
+ var switchLabel;
11548
11689
  var _iterator3 = _createForOfIteratorHelper$h(action.switchLable),
11549
11690
  _step3;
11550
11691
  try {
11551
11692
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
11552
11693
  var element = _step3.value;
11553
- if (element.sourceValue == data[action.switchField]) lable = element.targetValue;
11694
+ if (element.sourceValue == data[action.switchField]) switchLabel = element.targetValue;
11554
11695
  }
11555
11696
  } catch (err) {
11556
11697
  _iterator3.e(err);
@@ -11561,7 +11702,7 @@ function ActionButton (_ref) {
11561
11702
  disabled: disable,
11562
11703
  style: style,
11563
11704
  onClick: onClick,
11564
- children: lable
11705
+ children: switchLabel
11565
11706
  }, id);
11566
11707
  case 'Detail':
11567
11708
  return /*#__PURE__*/jsx(ButtonType, {
@@ -11570,7 +11711,7 @@ function ActionButton (_ref) {
11570
11711
  disabled: disable,
11571
11712
  style: style,
11572
11713
  onClick: onClick,
11573
- children: action.label || defaultLabel
11714
+ children: label || defaultLabel
11574
11715
  }, id);
11575
11716
  case 'GoTo':
11576
11717
  return /*#__PURE__*/jsx(ButtonType, {
@@ -11579,7 +11720,7 @@ function ActionButton (_ref) {
11579
11720
  disabled: disable,
11580
11721
  style: style,
11581
11722
  onClick: onClick,
11582
- children: action.label || defaultLabel
11723
+ children: label || defaultLabel
11583
11724
  }, id);
11584
11725
  case 'Modal':
11585
11726
  return /*#__PURE__*/jsx(ButtonType, {
@@ -11588,7 +11729,7 @@ function ActionButton (_ref) {
11588
11729
  disabled: disable,
11589
11730
  style: style,
11590
11731
  onClick: onClick,
11591
- children: action.label || defaultLabel
11732
+ children: label || defaultLabel
11592
11733
  }, id);
11593
11734
  case 'Download':
11594
11735
  var icon = /*#__PURE__*/jsx(FileExcelOutlined, {});
@@ -11610,7 +11751,16 @@ function ActionButton (_ref) {
11610
11751
  action: action
11611
11752
  });
11612
11753
  },
11613
- children: action.label || icon
11754
+ children: label || icon
11755
+ }, id);
11756
+ case 'Callback':
11757
+ return /*#__PURE__*/jsx(ButtonType, {
11758
+ type: buttonType,
11759
+ danger: danger,
11760
+ disabled: disable,
11761
+ style: style,
11762
+ onClick: onClick,
11763
+ children: label || defaultLabel
11614
11764
  }, id);
11615
11765
  default:
11616
11766
  throw new Error("Action type ".concat(action.actionType, " is not supported"));
@@ -12131,7 +12281,7 @@ var SelectWrapper$1 = function SelectWrapper(_ref) {
12131
12281
  var filterServerSide = _typeof(apiInterface) == 'object' && _typeof(apiInterface.read) == 'object' && apiInterface.read.filterServerSide;
12132
12282
  var selected = state.selected;
12133
12283
  return /*#__PURE__*/jsx(Fragment, {
12134
- children: /*#__PURE__*/jsx(Select$1, {
12284
+ children: /*#__PURE__*/jsx(Select$2, {
12135
12285
  labelInValue: mode === 'tags' ? false : true,
12136
12286
  style: {
12137
12287
  width: '100%',
@@ -12157,7 +12307,7 @@ var SelectWrapper$1 = function SelectWrapper(_ref) {
12157
12307
  })
12158
12308
  });
12159
12309
  };
12160
- var Select = observer(SelectWrapper$1, {
12310
+ var Select$1 = observer(SelectWrapper$1, {
12161
12311
  forwardRef: true
12162
12312
  });
12163
12313
 
@@ -12279,7 +12429,7 @@ var FileUploadWrapper = function FileUploadWrapper(_ref) {
12279
12429
  style: {
12280
12430
  marginTop: 18
12281
12431
  },
12282
- children: /*#__PURE__*/jsx(Select, {
12432
+ children: /*#__PURE__*/jsx(Select$1, {
12283
12433
  mode: "multiple",
12284
12434
  apiInterface: {
12285
12435
  read: {
@@ -12921,7 +13071,7 @@ var Presets = function Presets(_ref) {
12921
13071
  setUsedPreset = _ref.setUsedPreset,
12922
13072
  presets = _ref.presets,
12923
13073
  setPresets = _ref.setPresets;
12924
- var Option = Select$1.Option;
13074
+ var Option = Select$2.Option;
12925
13075
  var _useState = useState(false),
12926
13076
  _useState2 = _slicedToArray(_useState, 2),
12927
13077
  isModalVisible = _useState2[0],
@@ -13025,7 +13175,7 @@ var Presets = function Presets(_ref) {
13025
13175
  setValue(undefined);
13026
13176
  };
13027
13177
  return /*#__PURE__*/jsxs(Fragment, {
13028
- children: [/*#__PURE__*/jsx(Select$1, {
13178
+ children: [/*#__PURE__*/jsx(Select$2, {
13029
13179
  showSearch: true,
13030
13180
  value: value,
13031
13181
  placeholder: t('backoffice.form.presets.placeholder'),
@@ -14316,7 +14466,7 @@ var Selector = function Selector(_ref) {
14316
14466
  }
14317
14467
  }, [valueState]);
14318
14468
  return /*#__PURE__*/jsx(Fragment, {
14319
- children: /*#__PURE__*/jsx(Select$1, {
14469
+ children: /*#__PURE__*/jsx(Select$2, {
14320
14470
  className: customSelect,
14321
14471
  showSearch: true,
14322
14472
  labelInValue: true,
@@ -14335,7 +14485,7 @@ var Selector = function Selector(_ref) {
14335
14485
  return onSelect(option === null || option === void 0 ? void 0 : option.key);
14336
14486
  },
14337
14487
  children: items === null || items === void 0 ? void 0 : items.map(function (i) {
14338
- return /*#__PURE__*/jsxs(Select$1.Option, {
14488
+ return /*#__PURE__*/jsxs(Select$2.Option, {
14339
14489
  value: i.name,
14340
14490
  className: customSelectOption,
14341
14491
  children: [/*#__PURE__*/jsx("div", {
@@ -14429,7 +14579,8 @@ function useSelectSimpleData (_ref) {
14429
14579
  var apiInterface = _ref.apiInterface,
14430
14580
  selectMapping = _ref.selectMapping,
14431
14581
  onChange = _ref.onChange,
14432
- value = _ref.value;
14582
+ value = _ref.value,
14583
+ configuredOptions = _ref.options;
14433
14584
  var root = useStore();
14434
14585
  var _useMemo = useMemo(function () {
14435
14586
  return {
@@ -14440,23 +14591,18 @@ function useSelectSimpleData (_ref) {
14440
14591
  };
14441
14592
  }, []),
14442
14593
  apiHandler = _useMemo.apiHandler;
14443
- var _useState = useState(false),
14594
+ var _useState = useState(true),
14444
14595
  _useState2 = _slicedToArray(_useState, 2),
14445
14596
  loading = _useState2[0],
14446
14597
  setLoading = _useState2[1];
14447
- // used to skip the first render, because antd for some reason sets the value only on the second render
14448
- var _useState3 = useState(true),
14598
+ var _useState3 = useState(),
14449
14599
  _useState4 = _slicedToArray(_useState3, 2),
14450
- skipOnRender = _useState4[0],
14451
- setSkipOnRender = _useState4[1];
14452
- var _useState5 = useState([]),
14600
+ options = _useState4[0],
14601
+ setOptions = _useState4[1];
14602
+ var _useState5 = useState(),
14453
14603
  _useState6 = _slicedToArray(_useState5, 2),
14454
- options = _useState6[0],
14455
- setOptions = _useState6[1];
14456
- var _useState7 = useState(),
14457
- _useState8 = _slicedToArray(_useState7, 2),
14458
- selected = _useState8[0],
14459
- setSelected = _useState8[1];
14604
+ selected = _useState6[0],
14605
+ setSelected = _useState6[1];
14460
14606
  var currentValue = useMemo(function () {
14461
14607
  if (!selected) return undefined;
14462
14608
  if (Array.isArray(selected)) return selected.map(function (item) {
@@ -14465,8 +14611,10 @@ function useSelectSimpleData (_ref) {
14465
14611
  return selected.value;
14466
14612
  }, [selected]);
14467
14613
  useEffect(function () {
14468
- if (skipOnRender) {
14469
- setSkipOnRender(false);
14614
+ if (configuredOptions) {
14615
+ if (apiHandler.canReadList) LOG$8.warn('If options are provided, apiInterface will not be used');
14616
+ setOptions(configuredOptions);
14617
+ setLoading(false);
14470
14618
  return;
14471
14619
  }
14472
14620
  if (!apiHandler.canReadList) throw Error('SelectSimple: apiInterface must have readList method');
@@ -14478,13 +14626,17 @@ function useSelectSimpleData (_ref) {
14478
14626
  return parseDataEntry(item, selectMapping);
14479
14627
  });
14480
14628
  setOptions(options);
14481
- if (value) {
14482
- setSelected(findByValue(value, options, selectMapping));
14483
- }
14484
14629
  })["finally"](function () {
14485
14630
  setLoading(false);
14486
14631
  });
14487
- }, [skipOnRender]);
14632
+ }, []);
14633
+ useEffect(function () {
14634
+ // set the selected option only after the options are loaded
14635
+ if (value && options) {
14636
+ LOG$8.debug('value changed', value);
14637
+ setSelected(findByValue(value, options, selectMapping));
14638
+ }
14639
+ }, [value, options]);
14488
14640
  var onSelectionChanged = function onSelectionChanged(value, option) {
14489
14641
  setSelected(option);
14490
14642
  onChange === null || onChange === void 0 || onChange(parseReturnData(option, selectMapping));
@@ -14548,7 +14700,7 @@ function parseReturnData(options, selectMapping) {
14548
14700
  return (selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.externalValue) == 'value' ? options.value : options.data;
14549
14701
  }
14550
14702
 
14551
- var _excluded$2 = ["apiInterface", "selectMapping", "onChange", "value", "search"];
14703
+ var _excluded$2 = ["apiInterface", "selectMapping", "onChange", "value", "search", "options"];
14552
14704
  function ownKeys$t(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; }
14553
14705
  function _objectSpread$t(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$t(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$t(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
14554
14706
  var SelectWrapper = function SelectWrapper(_ref) {
@@ -14557,15 +14709,17 @@ var SelectWrapper = function SelectWrapper(_ref) {
14557
14709
  onChange = _ref.onChange,
14558
14710
  value = _ref.value,
14559
14711
  search = _ref.search,
14712
+ options = _ref.options,
14560
14713
  selectProps = _objectWithoutProperties(_ref, _excluded$2);
14561
14714
  var state = useSelectSimpleData({
14562
14715
  apiInterface: apiInterface,
14563
14716
  selectMapping: selectMapping,
14564
14717
  onChange: onChange,
14565
14718
  value: value,
14566
- type: 'SelectSimple'
14719
+ type: 'SelectSimple',
14720
+ options: options
14567
14721
  });
14568
- return /*#__PURE__*/jsx(Select$1, _objectSpread$t(_objectSpread$t({}, selectProps), {}, {
14722
+ return /*#__PURE__*/jsx(Select$2, _objectSpread$t(_objectSpread$t({}, selectProps), {}, {
14569
14723
  showSearch: search,
14570
14724
  loading: state.loading,
14571
14725
  options: state.options,
@@ -14575,7 +14729,7 @@ var SelectWrapper = function SelectWrapper(_ref) {
14575
14729
  filterOption: filterOption
14576
14730
  }));
14577
14731
  };
14578
- var SelectSimple = observer(SelectWrapper, {
14732
+ var Select = observer(SelectWrapper, {
14579
14733
  forwardRef: true
14580
14734
  });
14581
14735
  var filterOption = function filterOption(input, option) {
@@ -14764,7 +14918,7 @@ var FormWrapper$1 = function FormWrapper(_ref, ref) {
14764
14918
  var disabled = (_isReadonly = isReadonly(item, data)) !== null && _isReadonly !== void 0 ? _isReadonly : (_state$hiddenRequired2 = state.hiddenRequiredDisabled[typeof item.name == 'string' ? item.name : item.name.join('.')]) === null || _state$hiddenRequired2 === void 0 ? void 0 : _state$hiddenRequired2.disabled;
14765
14919
  switch (item.type) {
14766
14920
  case 'select':
14767
- return /*#__PURE__*/jsx(Select, {
14921
+ return /*#__PURE__*/jsx(Select$1, {
14768
14922
  initialValue: item.defaultValue,
14769
14923
  apiInterface: item.apiInterface,
14770
14924
  mode: item.mode,
@@ -14789,7 +14943,7 @@ var FormWrapper$1 = function FormWrapper(_ref, ref) {
14789
14943
  }
14790
14944
  }, state.selectedItemsIndex);
14791
14945
  case 'selectSimple':
14792
- return /*#__PURE__*/jsx(SelectSimple, _objectSpread$s(_objectSpread$s({}, item), {}, {
14946
+ return /*#__PURE__*/jsx(Select, _objectSpread$s(_objectSpread$s({}, item), {}, {
14793
14947
  disabled: disabled,
14794
14948
  onChange: function onChange(value) {
14795
14949
  _onChange(item.name, value);
@@ -15898,7 +16052,7 @@ var FormWrapper = function FormWrapper(_ref, ref) {
15898
16052
  span: 4
15899
16053
  }), /*#__PURE__*/jsx(Col, {
15900
16054
  span: 20,
15901
- children: /*#__PURE__*/jsx(Select$1, {
16055
+ children: /*#__PURE__*/jsx(Select$2, {
15902
16056
  style: {
15903
16057
  width: '100%'
15904
16058
  },
@@ -16609,7 +16763,7 @@ function DropdownCell (_ref) {
16609
16763
  noStyle: true,
16610
16764
  name: dataIndex,
16611
16765
  initialValue: column.translationPrefix ? t(column.translationPrefix + '.' + children[1]) : children,
16612
- children: /*#__PURE__*/jsx(Select$1, {
16766
+ children: /*#__PURE__*/jsx(Select$2, {
16613
16767
  style: {
16614
16768
  width: column.width - 20
16615
16769
  },
@@ -17592,10 +17746,10 @@ dayjs.extend(weekday);
17592
17746
  dayjs.extend(localeData);
17593
17747
  dayjs.extend(weekOfYear);
17594
17748
  dayjs.extend(weekYear);
17595
- Select$1.Option;
17749
+ Select$2.Option;
17596
17750
  var LOG$4 = getLogger('Backoffice', 'BaseTable');
17597
17751
  var TableWrapper = function TableWrapper(_ref) {
17598
- var _state$configuration$, _state$configuration$2, _state$configuration$3, _state$configuration$4, _state$configuration$5, _state$configuration$6, _state$globalFilter, _state$globalFilter2, _state$globalFilter3, _state$globalFilter4, _state$configuration$7, _state$configuration$8, _state$globalFilter$s, _state$configuration$9, _state$configuration$10, _state$configuration$11, _state$configuration$12, _state$configuration$13, _state$configuration$14, _state$configuration$15, _state$configuration$18;
17752
+ var _state$configuration$, _state$configuration$2, _state$configuration$3, _state$configuration$4, _state$configuration$5, _state$configuration$6, _state$globalFilter, _state$globalFilter2, _state$globalFilter3, _state$globalFilter4, _state$configuration$7, _state$configuration$8, _state$globalFilter$s, _state$configuration$9, _state$configuration$10, _state$configuration$13;
17599
17753
  var state = _ref.state;
17600
17754
  var root = useStore();
17601
17755
  var _useState = useState(0),
@@ -17673,6 +17827,10 @@ var TableWrapper = function TableWrapper(_ref) {
17673
17827
  rules: state.configuration.downloadAction.rule
17674
17828
  });
17675
17829
  }
17830
+ function checkPermission(permission) {
17831
+ if (!permission) return true;
17832
+ return root.actions.userHasPermission(permission);
17833
+ }
17676
17834
  return /*#__PURE__*/jsxs(Fragment, {
17677
17835
  children: [(state.canDelete || state.configuration.createAction || state.title || state.configuration.canRefresh || state.configuration.clientRelations) && /*#__PURE__*/jsx(Fragment, {
17678
17836
  children: /*#__PURE__*/jsx(Descriptions, {
@@ -17681,8 +17839,11 @@ var TableWrapper = function TableWrapper(_ref) {
17681
17839
  style: {
17682
17840
  "float": 'right'
17683
17841
  },
17684
- children: [state.configuration.clientRelations && state.configuration.variant !== 'CatalogTable' && /*#__PURE__*/jsx(SelectClientRelationCatalog, {
17685
- onSelectedCatalog: state.onSelectedCatalog
17842
+ children: [state.configuration.clientRelations && state.configuration.variant !== 'CatalogTable' && /*#__PURE__*/jsx(Fragment, {
17843
+ children: /*#__PURE__*/jsx(SelectClientRelationCatalog, {
17844
+ onSelectedCatalog: state.onSelectedCatalog,
17845
+ dontLoadCatalogData: state.configuration.dontLoadCatalogData
17846
+ })
17686
17847
  }), state.configuration.downloadAction && /*#__PURE__*/jsx(Button, {
17687
17848
  type: "primary",
17688
17849
  disabled: isDownloadActionDisabled(),
@@ -17736,44 +17897,35 @@ var TableWrapper = function TableWrapper(_ref) {
17736
17897
  // Convert to Dayjs
17737
17898
  (_state$globalFilter3 = state.globalFilter) !== null && _state$globalFilter3 !== void 0 && (_state$globalFilter3 = _state$globalFilter3.timeStamp) !== null && _state$globalFilter3 !== void 0 && (_state$globalFilter3 = _state$globalFilter3['toTimeStamp']) !== null && _state$globalFilter3 !== void 0 && _state$globalFilter3[0] ? dayjs((_state$globalFilter4 = state.globalFilter) === null || _state$globalFilter4 === void 0 || (_state$globalFilter4 = _state$globalFilter4.timeStamp) === null || _state$globalFilter4 === void 0 || (_state$globalFilter4 = _state$globalFilter4['toTimeStamp']) === null || _state$globalFilter4 === void 0 ? void 0 : _state$globalFilter4[0]) : dayjs(new Date()) // Convert to Dayjs
17738
17899
  ]
17739
- }), ((_state$configuration$7 = state.configuration.filter) === null || _state$configuration$7 === void 0 ? void 0 : _state$configuration$7.select) && /*#__PURE__*/jsx(Select, _objectSpread$l(_objectSpread$l({
17740
- minWidth: "200px"
17741
- }, (_state$configuration$8 = state.configuration.filter) === null || _state$configuration$8 === void 0 ? void 0 : _state$configuration$8.select), {}, {
17742
- value: (_state$globalFilter$s = state.globalFilter.select) === null || _state$globalFilter$s === void 0 ? void 0 : _state$globalFilter$s[state.configuration.filter.select.filterField],
17743
- onChange: function onChange(option, applyDefaultValue, defaultValue) {
17744
- if (defaultValue != (Array.isArray(option) ? option[0] : option) || applyDefaultValue === true) {
17745
- var _value;
17746
- state.onGlobalFilterSelect((_value = option.value) !== null && _value !== void 0 ? _value : option);
17747
- } else {
17748
- state.onGlobalFilterSelect('');
17749
- }
17900
+ }), ((_state$configuration$7 = state.configuration.filter) === null || _state$configuration$7 === void 0 ? void 0 : _state$configuration$7.select) && /*#__PURE__*/jsx(Select, _objectSpread$l(_objectSpread$l({}, (_state$configuration$8 = state.configuration.filter) === null || _state$configuration$8 === void 0 ? void 0 : _state$configuration$8.select.settings), {}, {
17901
+ style: {
17902
+ minWidth: '200px'
17750
17903
  },
17751
- search: (_state$configuration$9 = (_state$configuration$10 = state.configuration.filter) === null || _state$configuration$10 === void 0 ? void 0 : _state$configuration$10.select.search) !== null && _state$configuration$9 !== void 0 ? _state$configuration$9 : false,
17752
- mode: "single",
17753
- options: (_state$configuration$11 = state.configuration.filter) === null || _state$configuration$11 === void 0 ? void 0 : _state$configuration$11.select.options,
17754
- initialValue: (_state$configuration$12 = state.configuration.filter) === null || _state$configuration$12 === void 0 ? void 0 : _state$configuration$12.select.defaultValue,
17755
- applyDefaultValue: (_state$configuration$13 = state.configuration.filter) === null || _state$configuration$13 === void 0 ? void 0 : _state$configuration$13.select.applyDefaultValue
17904
+ value: (_state$globalFilter$s = state.globalFilter.select) === null || _state$globalFilter$s === void 0 || (_state$globalFilter$s = _state$globalFilter$s[state.configuration.filter.select.filterField]) === null || _state$globalFilter$s === void 0 ? void 0 : _state$globalFilter$s[0],
17905
+ onChange: function onChange(selected) {
17906
+ state.onGlobalFilterSelect(selected);
17907
+ }
17756
17908
  })), /*#__PURE__*/jsx(SelectionText, {
17757
17909
  selected: state.selected
17758
17910
  }), state.canDelete && /*#__PURE__*/jsx(DeleteButton, {
17759
17911
  selected: state.selected,
17760
17912
  total: state.pagination.total,
17761
- min: (_state$configuration$14 = state.configuration.rules) === null || _state$configuration$14 === void 0 ? void 0 : _state$configuration$14.min,
17913
+ min: (_state$configuration$9 = state.configuration.rules) === null || _state$configuration$9 === void 0 ? void 0 : _state$configuration$9.min,
17762
17914
  deleting: state.deleting,
17763
17915
  onDelete: state.onDelete
17764
17916
  }), state.configuration.copyAction !== undefined && /*#__PURE__*/jsx(CopyButton, {
17765
17917
  state: state
17766
- }), (_state$configuration$15 = state.configuration.bulkActions) === null || _state$configuration$15 === void 0 ? void 0 : _state$configuration$15.map(function (action) {
17918
+ }), (_state$configuration$10 = state.configuration.bulkActions) === null || _state$configuration$10 === void 0 ? void 0 : _state$configuration$10.map(function (action) {
17767
17919
  return /*#__PURE__*/jsx(BulkAction, {
17768
17920
  action: action,
17769
17921
  state: state
17770
17922
  }, action.id);
17771
- }), state.configuration.createAction && /*#__PURE__*/jsx(ActionButton, {
17923
+ }), state.configuration.createAction && checkPermission(state.configuration.createAction.permission) && /*#__PURE__*/jsx(ActionButton, {
17772
17924
  action: state.configuration.createAction,
17773
17925
  callback: function callback(data) {
17774
- var _state$onUpdate, _state$configuration$16, _state$configuration$17;
17926
+ var _state$onUpdate, _state$configuration$11, _state$configuration$12;
17775
17927
  (_state$onUpdate = state.onUpdate) === null || _state$onUpdate === void 0 || _state$onUpdate.call(state, data);
17776
- (_state$configuration$16 = state.configuration.createAction) === null || _state$configuration$16 === void 0 || (_state$configuration$17 = _state$configuration$16.callback) === null || _state$configuration$17 === void 0 || _state$configuration$17.call(_state$configuration$16, data);
17928
+ (_state$configuration$11 = state.configuration.createAction) === null || _state$configuration$11 === void 0 || (_state$configuration$12 = _state$configuration$11.callback) === null || _state$configuration$12 === void 0 || _state$configuration$12.call(_state$configuration$11, data);
17777
17929
  },
17778
17930
  type: "Button",
17779
17931
  id: 'create',
@@ -17820,13 +17972,13 @@ var TableWrapper = function TableWrapper(_ref) {
17820
17972
  }), /*#__PURE__*/jsx(Table$1, {
17821
17973
  scroll: {
17822
17974
  x: '100%',
17823
- y: (_state$configuration$18 = state.configuration.height) !== null && _state$configuration$18 !== void 0 ? _state$configuration$18 : '60vh'
17975
+ y: (_state$configuration$13 = state.configuration.height) !== null && _state$configuration$13 !== void 0 ? _state$configuration$13 : '60vh'
17824
17976
  },
17825
17977
  rowClassName: editableRow,
17826
17978
  components: cellRenderer,
17827
17979
  rowKey: function rowKey(dataRow) {
17828
- var _state$configuration$19, _state$configuration$20;
17829
- return goTroughObject(dataRow, (_state$configuration$19 = (_state$configuration$20 = state.configuration.rowKey) === null || _state$configuration$20 === void 0 ? void 0 : _state$configuration$20.split('.')) !== null && _state$configuration$19 !== void 0 ? _state$configuration$19 : ['_id'], 0);
17980
+ var _state$configuration$14, _state$configuration$15;
17981
+ return goTroughObject(dataRow, (_state$configuration$14 = (_state$configuration$15 = state.configuration.rowKey) === null || _state$configuration$15 === void 0 ? void 0 : _state$configuration$15.split('.')) !== null && _state$configuration$14 !== void 0 ? _state$configuration$14 : ['_id'], 0);
17830
17982
  },
17831
17983
  dataSource: data,
17832
17984
  loading: state.loading,
@@ -17900,13 +18052,13 @@ function CopyButton(_ref3) {
17900
18052
  }, root);
17901
18053
  var onCopy = /*#__PURE__*/function () {
17902
18054
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
17903
- var _state$configuration$21;
18055
+ var _state$configuration$16;
17904
18056
  var copyAction, _iterator3, _step3, selectedRow;
17905
18057
  return _regeneratorRuntime.wrap(function _callee$(_context) {
17906
18058
  while (1) switch (_context.prev = _context.next) {
17907
18059
  case 0:
17908
18060
  copyAction = state.configuration.copyAction;
17909
- if (((_state$configuration$21 = state.configuration.copyAction) === null || _state$configuration$21 === void 0 ? void 0 : _state$configuration$21.apiInterface) != undefined) {
18061
+ if (((_state$configuration$16 = state.configuration.copyAction) === null || _state$configuration$16 === void 0 ? void 0 : _state$configuration$16.apiInterface) != undefined) {
17910
18062
  _iterator3 = _createForOfIteratorHelper$8(state.selected);
17911
18063
  try {
17912
18064
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
@@ -17941,13 +18093,13 @@ function CopyButton(_ref3) {
17941
18093
  }();
17942
18094
  var onCopyAction = /*#__PURE__*/function () {
17943
18095
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
17944
- var _state$configuration$22, _state$configuration$23;
18096
+ var _state$configuration$17, _state$configuration$18;
17945
18097
  var copyAction, id, filter, data;
17946
18098
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
17947
18099
  while (1) switch (_context3.prev = _context3.next) {
17948
18100
  case 0:
17949
18101
  copyAction = state.configuration.copyAction;
17950
- if (!(copyAction.id == undefined || copyAction.actionType != 'Detail' || ((_state$configuration$22 = state.configuration.createAction) === null || _state$configuration$22 === void 0 ? void 0 : _state$configuration$22.actionType) != 'Detail')) {
18102
+ if (!(copyAction.id == undefined || copyAction.actionType != 'Detail' || ((_state$configuration$17 = state.configuration.createAction) === null || _state$configuration$17 === void 0 ? void 0 : _state$configuration$17.actionType) != 'Detail')) {
17951
18103
  _context3.next = 3;
17952
18104
  break;
17953
18105
  }
@@ -17977,7 +18129,7 @@ function CopyButton(_ref3) {
17977
18129
  configurationId: copyAction === null || copyAction === void 0 ? void 0 : copyAction.id,
17978
18130
  data: data.data[0],
17979
18131
  type: copyAction === null || copyAction === void 0 ? void 0 : copyAction.type,
17980
- mapping: (_state$configuration$23 = state.configuration.createAction) === null || _state$configuration$23 === void 0 ? void 0 : _state$configuration$23.mapping,
18132
+ mapping: (_state$configuration$18 = state.configuration.createAction) === null || _state$configuration$18 === void 0 ? void 0 : _state$configuration$18.mapping,
17981
18133
  mappingData: data.data[0],
17982
18134
  callback: function () {
17983
18135
  var _callback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(e) {
@@ -18395,7 +18547,7 @@ var advancedProps = function advancedProps(title) {
18395
18547
  },
18396
18548
  children: /*#__PURE__*/jsxs(Space, {
18397
18549
  direction: "vertical",
18398
- children: [/*#__PURE__*/jsxs(Select$1, {
18550
+ children: [/*#__PURE__*/jsxs(Select$2, {
18399
18551
  defaultValue: "contains",
18400
18552
  style: {
18401
18553
  width: 188,
@@ -18404,28 +18556,28 @@ var advancedProps = function advancedProps(title) {
18404
18556
  onSelect: function onSelect(value) {
18405
18557
  setSelectedKeys([selectedKeys[0], value]);
18406
18558
  },
18407
- children: [/*#__PURE__*/jsx(Select$1.Option, {
18559
+ children: [/*#__PURE__*/jsx(Select$2.Option, {
18408
18560
  value: "eq",
18409
18561
  children: "Ist equivalent zu"
18410
- }), /*#__PURE__*/jsx(Select$1.Option, {
18562
+ }), /*#__PURE__*/jsx(Select$2.Option, {
18411
18563
  value: "ne",
18412
18564
  children: "Ist nicht equivalent zu"
18413
- }), /*#__PURE__*/jsx(Select$1.Option, {
18565
+ }), /*#__PURE__*/jsx(Select$2.Option, {
18414
18566
  value: "contains",
18415
18567
  children: "Enth\xE4lt"
18416
- }), /*#__PURE__*/jsx(Select$1.Option, {
18568
+ }), /*#__PURE__*/jsx(Select$2.Option, {
18417
18569
  value: "doesnotcontain",
18418
18570
  children: "Enth\xE4lt nicht"
18419
- }), /*#__PURE__*/jsx(Select$1.Option, {
18571
+ }), /*#__PURE__*/jsx(Select$2.Option, {
18420
18572
  value: "startswith",
18421
18573
  children: "Beginnt mit"
18422
- }), /*#__PURE__*/jsx(Select$1.Option, {
18574
+ }), /*#__PURE__*/jsx(Select$2.Option, {
18423
18575
  value: "endswith",
18424
18576
  children: "Endet mit"
18425
- }), /*#__PURE__*/jsx(Select$1.Option, {
18577
+ }), /*#__PURE__*/jsx(Select$2.Option, {
18426
18578
  value: "isnull",
18427
18579
  children: "Ist Null"
18428
- }), /*#__PURE__*/jsx(Select$1.Option, {
18580
+ }), /*#__PURE__*/jsx(Select$2.Option, {
18429
18581
  value: "isnotnull",
18430
18582
  children: "Ist nicht Null"
18431
18583
  })]
@@ -18572,7 +18724,7 @@ var selectProps = function selectProps(title, filter) {
18572
18724
  },
18573
18725
  children: /*#__PURE__*/jsxs(Space, {
18574
18726
  direction: "vertical",
18575
- children: [/*#__PURE__*/jsx(Select$1, {
18727
+ children: [/*#__PURE__*/jsx(Select$2, {
18576
18728
  placeholder: "Filter ".concat(title),
18577
18729
  value: selectedKeys[0],
18578
18730
  style: {
@@ -19233,7 +19385,7 @@ function ownKeys$g(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
19233
19385
  function _objectSpread$g(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$g(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$g(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
19234
19386
  var LOG$3 = getLogger('Backoffice', 'TableData');
19235
19387
  function useTableData (_ref) {
19236
- var _configuration$filter, _configuration$filter2, _configuration$filter3, _configuration$filter4, _configuration$bulkAc, _configuration$apiInt;
19388
+ var _configuration$filter, _configuration$filter2, _configuration$filter3, _configuration$bulkAc, _configuration$apiInt;
19237
19389
  var id = _ref.id,
19238
19390
  i18n = _ref.i18n,
19239
19391
  parentData = _ref.parentData,
@@ -19273,7 +19425,7 @@ function useTableData (_ref) {
19273
19425
  return defaultFilter[f] = [configuration.filter["default"].globalValue ? root.getGlobalValue(configuration.filter["default"].globalValue) : true, 'eq'];
19274
19426
  });
19275
19427
  var _useState9 = useState({
19276
- select: (_configuration$filter3 = configuration.filter) !== null && _configuration$filter3 !== void 0 && _configuration$filter3.select && ((_configuration$filter4 = configuration.filter) === null || _configuration$filter4 === void 0 ? void 0 : _configuration$filter4.select.applyDefaultValue) !== false ? _defineProperty({}, configuration.filter.select.filterField, [configuration.filter.select.defaultValue, 'eq']) : undefined,
19428
+ select: (_configuration$filter3 = configuration.filter) !== null && _configuration$filter3 !== void 0 && (_configuration$filter3 = _configuration$filter3.select) !== null && _configuration$filter3 !== void 0 && _configuration$filter3.defaultValue ? _defineProperty({}, configuration.filter.select.filterField, [configuration.filter.select.defaultValue, 'eq']) : undefined,
19277
19429
  toggle: toggleConfig !== null && toggleConfig !== void 0 && toggleConfig.defaultChecked && !(toggleConfig !== null && toggleConfig !== void 0 && toggleConfig.inverted) || !(toggleConfig !== null && toggleConfig !== void 0 && toggleConfig.defaultChecked) && toggleConfig !== null && toggleConfig !== void 0 && toggleConfig.inverted ? toggleFilter : undefined,
19278
19430
  "default": defaultFilter ? defaultFilter : undefined
19279
19431
  }),
@@ -19359,8 +19511,8 @@ function useTableData (_ref) {
19359
19511
  for (var i = 0; i < dataArray.length; i++) {
19360
19512
  var dataRow = dataArray[i];
19361
19513
  if (filterServerSide) {
19362
- var _configuration$filter5;
19363
- if ((_configuration$filter5 = configuration.filter) !== null && _configuration$filter5 !== void 0 && (_configuration$filter5 = _configuration$filter5.select) !== null && _configuration$filter5 !== void 0 && _configuration$filter5.filterField) {
19514
+ var _configuration$filter4;
19515
+ if ((_configuration$filter4 = configuration.filter) !== null && _configuration$filter4 !== void 0 && (_configuration$filter4 = _configuration$filter4.select) !== null && _configuration$filter4 !== void 0 && _configuration$filter4.filterField) {
19364
19516
  onGlobalFilterSelect(dataRow[configuration.filter.select.filterField]);
19365
19517
  } else {
19366
19518
  var _pagination;
@@ -19376,15 +19528,15 @@ function useTableData (_ref) {
19376
19528
  });
19377
19529
  }
19378
19530
  } else {
19379
- var _configuration$filter6, _configuration$filter7;
19531
+ var _configuration$filter5, _configuration$filter6;
19380
19532
  var _updateData2 = updateData({
19381
19533
  data: newInitData,
19382
19534
  dataRow: dataRow
19383
19535
  }),
19384
19536
  nextInitData = _updateData2.data;
19385
19537
  var _aplyFilterAndSortati = aplyFilterAndSortation(_objectSpread$g(_objectSpread$g(_objectSpread$g({}, filterData), {}, {
19386
- filters: _objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g({}, filterData.filters), globalFilter.search), !(configuration !== null && configuration !== void 0 && (_configuration$filter6 = configuration.filter) !== null && _configuration$filter6 !== void 0 && (_configuration$filter6 = _configuration$filter6.toggle) !== null && _configuration$filter6 !== void 0 && _configuration$filter6.inQuery) ? globalFilter.toggle : undefined), globalFilter.select), globalFilter.timeStamp), globalFilter["default"])
19387
- }, configuration !== null && configuration !== void 0 && (_configuration$filter7 = configuration.filter) !== null && _configuration$filter7 !== void 0 && (_configuration$filter7 = _configuration$filter7.toggle) !== null && _configuration$filter7 !== void 0 && _configuration$filter7.inQuery ? {
19538
+ filters: _objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g({}, filterData.filters), globalFilter.search), !(configuration !== null && configuration !== void 0 && (_configuration$filter5 = configuration.filter) !== null && _configuration$filter5 !== void 0 && (_configuration$filter5 = _configuration$filter5.toggle) !== null && _configuration$filter5 !== void 0 && _configuration$filter5.inQuery) ? globalFilter.toggle : undefined), globalFilter.select), globalFilter.timeStamp), globalFilter["default"])
19539
+ }, configuration !== null && configuration !== void 0 && (_configuration$filter6 = configuration.filter) !== null && _configuration$filter6 !== void 0 && (_configuration$filter6 = _configuration$filter6.toggle) !== null && _configuration$filter6 !== void 0 && _configuration$filter6.inQuery ? {
19388
19540
  genericProps: globalFilter.toggle
19389
19541
  } : undefined), {}, {
19390
19542
  data: nextInitData,
@@ -19471,7 +19623,7 @@ function useTableData (_ref) {
19471
19623
  }, [configuration.title, parentData]);
19472
19624
  var onChange = /*#__PURE__*/function () {
19473
19625
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(p) {
19474
- var _configuration$filter8;
19626
+ var _configuration$filter7, _configuration$filter8, _configuration$filter9, _prefilter$select, _configuration$filter10, _configuration$filter11;
19475
19627
  var prefilter,
19476
19628
  refresh,
19477
19629
  currentData,
@@ -19479,7 +19631,7 @@ function useTableData (_ref) {
19479
19631
  currentFilterHash,
19480
19632
  currentPagination,
19481
19633
  currentUrl,
19482
- _configuration$filter9,
19634
+ _configuration$filter12,
19483
19635
  ssf,
19484
19636
  data,
19485
19637
  _data3,
@@ -19496,7 +19648,7 @@ function useTableData (_ref) {
19496
19648
  loading: true
19497
19649
  }));
19498
19650
  currentData = initData;
19499
- filterData = _objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g({}, p.filters), prefilter.search), !(configuration !== null && configuration !== void 0 && (_configuration$filter8 = configuration.filter) !== null && _configuration$filter8 !== void 0 && (_configuration$filter8 = _configuration$filter8.toggle) !== null && _configuration$filter8 !== void 0 && _configuration$filter8.inQuery) ? prefilter.toggle : undefined), prefilter.select), prefilter.timeStamp), prefilter["default"]); //remove all null values
19651
+ filterData = _objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g({}, p.filters), prefilter.search), !(configuration !== null && configuration !== void 0 && (_configuration$filter7 = configuration.filter) !== null && _configuration$filter7 !== void 0 && (_configuration$filter7 = _configuration$filter7.toggle) !== null && _configuration$filter7 !== void 0 && _configuration$filter7.inQuery) ? prefilter.toggle : undefined), ((_configuration$filter8 = configuration.filter) === null || _configuration$filter8 === void 0 || (_configuration$filter8 = _configuration$filter8.select) === null || _configuration$filter8 === void 0 ? void 0 : _configuration$filter8.applyDefaultValue) !== false || ((_configuration$filter9 = configuration.filter) === null || _configuration$filter9 === void 0 || (_configuration$filter9 = _configuration$filter9.select) === null || _configuration$filter9 === void 0 ? void 0 : _configuration$filter9.defaultValue) !== ((_prefilter$select = prefilter.select) === null || _prefilter$select === void 0 || (_prefilter$select = _prefilter$select[(_configuration$filter10 = (_configuration$filter11 = configuration.filter) === null || _configuration$filter11 === void 0 || (_configuration$filter11 = _configuration$filter11.select) === null || _configuration$filter11 === void 0 ? void 0 : _configuration$filter11.filterField) !== null && _configuration$filter10 !== void 0 ? _configuration$filter10 : '']) === null || _prefilter$select === void 0 ? void 0 : _prefilter$select[0]) ? prefilter.select : undefined), prefilter.timeStamp), prefilter["default"]); //remove all null values
19500
19652
  filterData = Object.fromEntries(Object.entries(filterData).filter(function (_ref5) {
19501
19653
  var _ref6 = _slicedToArray(_ref5, 2);
19502
19654
  _ref6[0];
@@ -19517,7 +19669,7 @@ function useTableData (_ref) {
19517
19669
  columns: configuration.columns,
19518
19670
  filters: filterData,
19519
19671
  sorter: p.sorter
19520
- }, configuration !== null && configuration !== void 0 && (_configuration$filter9 = configuration.filter) !== null && _configuration$filter9 !== void 0 && (_configuration$filter9 = _configuration$filter9.toggle) !== null && _configuration$filter9 !== void 0 && _configuration$filter9.inQuery ? {
19672
+ }, configuration !== null && configuration !== void 0 && (_configuration$filter12 = configuration.filter) !== null && _configuration$filter12 !== void 0 && (_configuration$filter12 = _configuration$filter12.toggle) !== null && _configuration$filter12 !== void 0 && _configuration$filter12.inQuery ? {
19521
19673
  genericProps: prefilter.toggle
19522
19674
  } : undefined);
19523
19675
  _context2.next = 13;
@@ -19583,7 +19735,7 @@ function useTableData (_ref) {
19583
19735
  var onDelete = /*#__PURE__*/function () {
19584
19736
  var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
19585
19737
  var _configuration$apiInt2;
19586
- var newData, newInitData, deleted, userPermissions, _loop, mappingData, deleteResult, _ret, index, total, pages, current, _configuration$filter10, _configuration$filter11, data;
19738
+ var newData, newInitData, deleted, userPermissions, _loop, mappingData, deleteResult, _ret, index, total, pages, current, _configuration$filter13, _configuration$filter14, data;
19587
19739
  return _regeneratorRuntime.wrap(function _callee3$(_context4) {
19588
19740
  while (1) switch (_context4.prev = _context4.next) {
19589
19741
  case 0:
@@ -19598,7 +19750,7 @@ function useTableData (_ref) {
19598
19750
  case 6:
19599
19751
  userPermissions = _context4.sent;
19600
19752
  _loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop(index) {
19601
- var _configuration$rowKey, _configuration$filter12, _configuration$filter13;
19753
+ var _configuration$rowKey, _configuration$filter15, _configuration$filter16;
19602
19754
  var id, _newData$filter, _newData$filter2, mapToggle, _iterator, _step, _globalFilter$toggle, field, _globalFilter$toggle2, _configuration$delete, _configuration$onErro, _configuration$onErro2, deletedIndex, initDeletedIndex;
19603
19755
  return _regeneratorRuntime.wrap(function _loop$(_context3) {
19604
19756
  while (1) switch (_context3.prev = _context3.next) {
@@ -19614,7 +19766,7 @@ function useTableData (_ref) {
19614
19766
  })) === null || _newData$filter2 === void 0 ? void 0 : _newData$filter2[0];
19615
19767
  }
19616
19768
  mapToggle = {};
19617
- _iterator = _createForOfIteratorHelper$7((_configuration$filter12 = (_configuration$filter13 = configuration.filter) === null || _configuration$filter13 === void 0 || (_configuration$filter13 = _configuration$filter13.toggle) === null || _configuration$filter13 === void 0 ? void 0 : _configuration$filter13.fields) !== null && _configuration$filter12 !== void 0 ? _configuration$filter12 : []);
19769
+ _iterator = _createForOfIteratorHelper$7((_configuration$filter15 = (_configuration$filter16 = configuration.filter) === null || _configuration$filter16 === void 0 || (_configuration$filter16 = _configuration$filter16.toggle) === null || _configuration$filter16 === void 0 ? void 0 : _configuration$filter16.fields) !== null && _configuration$filter15 !== void 0 ? _configuration$filter15 : []);
19618
19770
  try {
19619
19771
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
19620
19772
  field = _step.value;
@@ -19723,9 +19875,9 @@ function useTableData (_ref) {
19723
19875
  current: current
19724
19876
  }),
19725
19877
  columns: configuration.columns,
19726
- filters: _objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g({}, filterData.filters), globalFilter.search), !(configuration !== null && configuration !== void 0 && (_configuration$filter10 = configuration.filter) !== null && _configuration$filter10 !== void 0 && (_configuration$filter10 = _configuration$filter10.toggle) !== null && _configuration$filter10 !== void 0 && _configuration$filter10.inQuery) ? globalFilter.toggle : undefined), globalFilter.select), globalFilter.timeStamp), globalFilter["default"]),
19878
+ filters: _objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g({}, filterData.filters), globalFilter.search), !(configuration !== null && configuration !== void 0 && (_configuration$filter13 = configuration.filter) !== null && _configuration$filter13 !== void 0 && (_configuration$filter13 = _configuration$filter13.toggle) !== null && _configuration$filter13 !== void 0 && _configuration$filter13.inQuery) ? globalFilter.toggle : undefined), globalFilter.select), globalFilter.timeStamp), globalFilter["default"]),
19727
19879
  sorter: filterData.sorter
19728
- }, configuration !== null && configuration !== void 0 && (_configuration$filter11 = configuration.filter) !== null && _configuration$filter11 !== void 0 && (_configuration$filter11 = _configuration$filter11.toggle) !== null && _configuration$filter11 !== void 0 && _configuration$filter11.inQuery ? {
19880
+ }, configuration !== null && configuration !== void 0 && (_configuration$filter14 = configuration.filter) !== null && _configuration$filter14 !== void 0 && (_configuration$filter14 = _configuration$filter14.toggle) !== null && _configuration$filter14 !== void 0 && _configuration$filter14.inQuery ? {
19729
19881
  genericProps: globalFilter.toggle
19730
19882
  } : undefined));
19731
19883
  case 25:
@@ -19754,13 +19906,13 @@ function useTableData (_ref) {
19754
19906
  };
19755
19907
  }();
19756
19908
  var onGlobalFilterSelect = function onGlobalFilterSelect(value) {
19757
- var _configuration$filter14;
19758
- if (!((_configuration$filter14 = configuration.filter) !== null && _configuration$filter14 !== void 0 && _configuration$filter14.select)) {
19909
+ var _configuration$filter17;
19910
+ if (!((_configuration$filter17 = configuration.filter) !== null && _configuration$filter17 !== void 0 && _configuration$filter17.select)) {
19759
19911
  LOG$3.error('No global select filter defiend');
19760
19912
  return;
19761
19913
  }
19762
19914
  var newGlobalFilter = _objectSpread$g({}, globalFilter);
19763
- if (value != '') {
19915
+ if (value !== null && value !== void 0 && value.length) {
19764
19916
  newGlobalFilter.select = _defineProperty({}, configuration.filter.select.filterField, Array.isArray(value) ? value : [value]);
19765
19917
  } else {
19766
19918
  newGlobalFilter.select = {};
@@ -19771,8 +19923,8 @@ function useTableData (_ref) {
19771
19923
  }, filterData), newGlobalFilter);
19772
19924
  };
19773
19925
  var onGlobalFilterToggle = function onGlobalFilterToggle() {
19774
- var _configuration$filter15;
19775
- if (!((_configuration$filter15 = configuration.filter) !== null && _configuration$filter15 !== void 0 && _configuration$filter15.toggle)) {
19926
+ var _configuration$filter18;
19927
+ if (!((_configuration$filter18 = configuration.filter) !== null && _configuration$filter18 !== void 0 && _configuration$filter18.toggle)) {
19776
19928
  LOG$3.error('No global toggle filter defiend');
19777
19929
  return;
19778
19930
  }
@@ -19789,8 +19941,8 @@ function useTableData (_ref) {
19789
19941
  }, filterData), newGlobalFilter);
19790
19942
  };
19791
19943
  var onGlobalFilterSearch = function onGlobalFilterSearch(value) {
19792
- var _configuration$filter16;
19793
- if (!((_configuration$filter16 = configuration.filter) !== null && _configuration$filter16 !== void 0 && _configuration$filter16.search)) {
19944
+ var _configuration$filter19;
19945
+ if (!((_configuration$filter19 = configuration.filter) !== null && _configuration$filter19 !== void 0 && _configuration$filter19.search)) {
19794
19946
  LOG$3.error('No global search filter defiend');
19795
19947
  return;
19796
19948
  }
@@ -19798,8 +19950,8 @@ function useTableData (_ref) {
19798
19950
  search: {}
19799
19951
  });
19800
19952
  if (value) {
19801
- var _configuration$filter17;
19802
- (_configuration$filter17 = configuration.filter) === null || _configuration$filter17 === void 0 || _configuration$filter17.search.fields.forEach(function (f) {
19953
+ var _configuration$filter20;
19954
+ (_configuration$filter20 = configuration.filter) === null || _configuration$filter20 === void 0 || _configuration$filter20.search.fields.forEach(function (f) {
19803
19955
  if (typeof f == 'string') {
19804
19956
  newGlobalFilter.search[f] = [value, 'contains', 0];
19805
19957
  } else {
@@ -19813,8 +19965,8 @@ function useTableData (_ref) {
19813
19965
  }, filterData), newGlobalFilter);
19814
19966
  };
19815
19967
  var onGlobalFilterPeriod = function onGlobalFilterPeriod(from, to) {
19816
- var _configuration$filter18;
19817
- if (!((_configuration$filter18 = configuration.filter) !== null && _configuration$filter18 !== void 0 && _configuration$filter18.period)) {
19968
+ var _configuration$filter21;
19969
+ if (!((_configuration$filter21 = configuration.filter) !== null && _configuration$filter21 !== void 0 && _configuration$filter21.period)) {
19818
19970
  LOG$3.error('No global period filter defiend');
19819
19971
  return;
19820
19972
  }
@@ -20648,7 +20800,7 @@ var FilterBox = /*#__PURE__*/memo(function (_ref) {
20648
20800
  return /*#__PURE__*/jsxs("div", {
20649
20801
  children: [/*#__PURE__*/jsx(Typography.Text, {
20650
20802
  children: filter.title
20651
- }), /*#__PURE__*/jsx("br", {}), /*#__PURE__*/jsx(Select, {
20803
+ }), /*#__PURE__*/jsx("br", {}), /*#__PURE__*/jsx(Select$1, {
20652
20804
  mode: "single",
20653
20805
  apiInterface: filter.requestOptions,
20654
20806
  wholeData: _objectSpread$a(_objectSpread$a({}, state.filter), {}, {
@@ -21089,7 +21241,7 @@ function getColorClass(data) {
21089
21241
  }
21090
21242
  }
21091
21243
  var OrgItem = function OrgItem(_ref) {
21092
- var _data$description, _itemChain, _itemChain2, _data$children;
21244
+ var _data$description, _itemChain, _itemChain2, _data$children, _itemChain3, _configuration$additi;
21093
21245
  var data = _ref.data,
21094
21246
  itemChain = _ref.itemChain,
21095
21247
  configuration = _ref.configuration,
@@ -21120,7 +21272,7 @@ var OrgItem = function OrgItem(_ref) {
21120
21272
  }), /*#__PURE__*/jsx("div", {
21121
21273
  className: description$1,
21122
21274
  children: (_data$description = data.description) !== null && _data$description !== void 0 ? _data$description : ''
21123
- }), configuration.createAction && data.writePermission && !data.isNav && ((_itemChain = itemChain[itemChain.length - 1]) === null || _itemChain === void 0 ? void 0 : _itemChain.id) == data.id && /*#__PURE__*/jsx(ActionButton, {
21275
+ }), configuration.createAction && data.writePermission && ((_itemChain = itemChain[itemChain.length - 1]) === null || _itemChain === void 0 ? void 0 : _itemChain.id) == data.id && /*#__PURE__*/jsx(ActionButton, {
21124
21276
  action: configuration.createAction,
21125
21277
  type: "Button",
21126
21278
  buttonType: "primary",
@@ -21136,7 +21288,7 @@ var OrgItem = function OrgItem(_ref) {
21136
21288
  setUpdate(update + 1);
21137
21289
  (_configuration$create = configuration.createAction) === null || _configuration$create === void 0 || (_configuration$create2 = _configuration$create.callback) === null || _configuration$create2 === void 0 || _configuration$create2.call(_configuration$create, data);
21138
21290
  }
21139
- }, "create"), configuration.deleteAction && data.deletePermission && !data.isNav && ((_itemChain2 = itemChain[itemChain.length - 1]) === null || _itemChain2 === void 0 ? void 0 : _itemChain2.id) == data.id && !((_data$children = data.children) !== null && _data$children !== void 0 && _data$children.length) && /*#__PURE__*/jsx(ActionButton, {
21291
+ }, "create"), configuration.deleteAction && data.deletePermission && ((_itemChain2 = itemChain[itemChain.length - 1]) === null || _itemChain2 === void 0 ? void 0 : _itemChain2.id) == data.id && !((_data$children = data.children) !== null && _data$children !== void 0 && _data$children.length) && /*#__PURE__*/jsx(ActionButton, {
21140
21292
  action: configuration.deleteAction,
21141
21293
  type: "Button",
21142
21294
  buttonType: "primary",
@@ -21154,7 +21306,23 @@ var OrgItem = function OrgItem(_ref) {
21154
21306
  setUpdate(update + 1);
21155
21307
  });
21156
21308
  }
21157
- }, "delete")]
21309
+ }, "delete"), ((_itemChain3 = itemChain[itemChain.length - 1]) === null || _itemChain3 === void 0 ? void 0 : _itemChain3.id) == data.id && root.dataStore.organizationId !== data.id && ((_configuration$additi = configuration.additionalActions) === null || _configuration$additi === void 0 ? void 0 : _configuration$additi.map(function (action, i) {
21310
+ var _action$id;
21311
+ return /*#__PURE__*/jsx(ActionButton, {
21312
+ action: action,
21313
+ type: "Button",
21314
+ buttonType: "default",
21315
+ id: (_action$id = action.id) !== null && _action$id !== void 0 ? _action$id : i.toString(),
21316
+ mappingData: data,
21317
+ defaultLabel: "",
21318
+ data: data,
21319
+ callback: function callback() {
21320
+ var _action$callback;
21321
+ setUpdate(update + 1);
21322
+ action === null || action === void 0 || (_action$callback = action.callback) === null || _action$callback === void 0 || _action$callback.call(action, data);
21323
+ }
21324
+ }, action.id);
21325
+ }))]
21158
21326
  }, data.id);
21159
21327
  };
21160
21328
  var OrgItem$1 = observer(OrgItem);
@@ -21287,7 +21455,7 @@ var openClass = "open-class--gGXs";
21287
21455
  var breadcrumb = "breadcrumb-Z0VvH";
21288
21456
  var selected = "selected-w-sfW";
21289
21457
  var disabled = "disabled-0nado";
21290
- var css_248z$6 = ".trigger-wrapper-OkPRc {\n width: 100%;\n padding: 12px 0px;\n display: flex;\n gap: 32px;\n}\n\n.arrow-Rd0hp {\n background-image: url(\"data:image/svg+xml,%3Csvg width%3D%228%22 height%3D%2213%22 viewBox%3D%220 0 8 13%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E %3Cpath d%3D%22M0.947266 1.14893L6.94727 6.29178L0.947266 11.9489%22 stroke%3D%22%236F6F6F%22 stroke-linecap%3D%22round%22 stroke-linejoin%3D%22round%22%2F%3E %3C%2Fsvg%3E\");\n background-repeat: no-repeat;\n background-position: center;\n background-size: contain;\n transform: rotateZ(0deg);\n transition: all 0.35s ease;\n width: 20.8px;\n height: 22.4px;\n}\n\n.open-class--gGXs {\n transform: rotateZ(90deg);\n}\n\n.breadcrumb-Z0VvH {\n transition: color 0.3s;\n}\n.breadcrumb-Z0VvH:hover:not(.selected-w-sfW) {\n cursor: pointer;\n color: #000;\n}\n\n.selected-w-sfW {\n color: #000;\n font-weight: 400;\n}\n\n.selected-w-sfW {\n color: #000;\n font-weight: 400;\n}\n\n.disabled-0nado {\n pointer-events: none;\n color: lightgray;\n}\n\n.darkmode .selected-w-sfW {\n color: #fff;\n font-weight: 400;\n}\n";
21458
+ var css_248z$6 = ".trigger-wrapper-OkPRc {\n width: 100%;\n padding: 12px 0px;\n display: flex;\n gap: 32px;\n}\n\n.arrow-Rd0hp {\n background-image: url(\"data:image/svg+xml,%3Csvg width%3D%228%22 height%3D%2213%22 viewBox%3D%220 0 8 13%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E %3Cpath d%3D%22M0.947266 1.14893L6.94727 6.29178L0.947266 11.9489%22 stroke%3D%22%236F6F6F%22 stroke-linecap%3D%22round%22 stroke-linejoin%3D%22round%22%2F%3E %3C%2Fsvg%3E\");\n background-repeat: no-repeat;\n background-position: center;\n background-size: contain;\n transform: rotateZ(0deg);\n transition: all 0.35s ease;\n width: 20.8px;\n height: 22.4px;\n cursor: pointer;\n}\n\n.open-class--gGXs {\n transform: rotateZ(90deg);\n}\n\n.breadcrumb-Z0VvH {\n transition: color 0.3s;\n}\n.breadcrumb-Z0VvH:hover:not(.selected-w-sfW) {\n cursor: pointer;\n color: #000;\n}\n\n.selected-w-sfW {\n color: #000;\n font-weight: 400;\n}\n\n.selected-w-sfW {\n color: #000;\n font-weight: 400;\n}\n\n.disabled-0nado {\n pointer-events: none;\n color: lightgray;\n}\n\n.darkmode .selected-w-sfW {\n color: #fff;\n font-weight: 400;\n}\n";
21291
21459
  styleInject(css_248z$6);
21292
21460
 
21293
21461
  var BreadCrumbsTrigger = function BreadCrumbsTrigger(_ref) {
@@ -21373,33 +21541,103 @@ var Legend = function Legend(props) {
21373
21541
  };
21374
21542
 
21375
21543
  var buttonsWrapper = "buttons-wrapper-Bubkr";
21376
- var css_248z$4 = ".buttons-wrapper-Bubkr {\n display: flex;\n gap: 6px;\n}\n\n.buttons-wrapper-Bubkr button {\n min-width: 24px;\n}\n";
21544
+ var mask = "mask-ssagp";
21545
+ var transformWrapper = "transform-wrapper--8t0v";
21546
+ var css_248z$4 = ".buttons-wrapper-Bubkr {\n display: flex;\n gap: 6px;\n}\n\n.buttons-wrapper-Bubkr button {\n min-width: 24px;\n}\n\n.mask-ssagp {\n position: absolute;\n top: 0;\n bottom: 0;\n z-index: 1;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.45);\n width: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n -webkit-backdrop-filter: blur(3px);\n backdrop-filter: blur(3px);\n}\n.mask-ssagp p {\n font-size: 18px;\n font-weight: bold;\n background: rgba(255, 255, 255, 0.4);\n padding: 10px;\n border-radius: 5px;\n}\n\n.transform-wrapper--8t0v .ant-modal-mask,\n.transform-wrapper--8t0v .ant-modal-wrap {\n position: absolute;\n}\n";
21377
21547
  styleInject(css_248z$4);
21378
21548
 
21379
21549
  var ZoomWrapper = function ZoomWrapper(_ref) {
21380
21550
  var _children = _ref.children,
21381
- zoomToId = _ref.zoomToId;
21551
+ zoomToId = _ref.zoomToId,
21552
+ onInitialized = _ref.onInitialized;
21382
21553
  var transformComponentRef = useRef(null);
21383
21554
  var _useState = useState(true),
21384
21555
  _useState2 = _slicedToArray(_useState, 2),
21385
21556
  isInit = _useState2[0],
21386
21557
  setIsInit = _useState2[1];
21558
+ var _useState3 = useState(false),
21559
+ _useState4 = _slicedToArray(_useState3, 2),
21560
+ isGrapping = _useState4[0],
21561
+ setIsGrapping = _useState4[1];
21562
+ var _useState5 = useState(false),
21563
+ _useState6 = _slicedToArray(_useState5, 2),
21564
+ isZooming = _useState6[0],
21565
+ setIsZooming = _useState6[1];
21566
+ var _useState7 = useState(false),
21567
+ _useState8 = _slicedToArray(_useState7, 2),
21568
+ showModal = _useState8[0],
21569
+ setShowModal = _useState8[1];
21570
+ var _useState9 = useState(false),
21571
+ _useState10 = _slicedToArray(_useState9, 2),
21572
+ focused = _useState10[0],
21573
+ setFocused = _useState10[1];
21574
+ var _useTranslation = useTranslation$1(),
21575
+ t = _useTranslation.t;
21576
+ var zoomToImage = useCallback(function (id) {
21577
+ if (transformComponentRef.current) {
21578
+ var zoomToElement = transformComponentRef.current.zoomToElement;
21579
+ zoomToElement(id, 1, 700, 'easeOut');
21580
+ }
21581
+ }, []);
21387
21582
  useEffect(function () {
21388
21583
  if (!zoomToId) return;
21389
21584
  if (isInit) {
21390
21585
  setIsInit(false);
21391
21586
  setTimeout(function () {
21392
21587
  zoomToImage(zoomToId);
21588
+ onInitialized();
21393
21589
  }, 300);
21394
21590
  }
21395
21591
  zoomToImage(zoomToId);
21396
21592
  }, [zoomToId]);
21397
- var zoomToImage = function zoomToImage(id) {
21398
- if (transformComponentRef.current) {
21399
- var zoomToElement = transformComponentRef.current.zoomToElement;
21400
- zoomToElement(id, 1, 700, 'easeOut');
21593
+ var onKeyDown = useCallback(function (e) {
21594
+ if (e.key === 'Shift') {
21595
+ setIsZooming(true);
21401
21596
  }
21402
- };
21597
+ }, []);
21598
+ var onKeyUp = useCallback(function (e) {
21599
+ if (e.key === 'Shift') {
21600
+ setIsZooming(false);
21601
+ }
21602
+ }, []);
21603
+ var wheelEventTimout;
21604
+ var onScrolling = useCallback(function () {
21605
+ if (!isZooming) {
21606
+ clearTimeout(wheelEventTimout);
21607
+ setShowModal(true);
21608
+ wheelEventTimout = setTimeout(function () {
21609
+ setShowModal(false);
21610
+ }, 2000);
21611
+ }
21612
+ }, [isZooming]);
21613
+ var onMouseEnter = useCallback(function () {
21614
+ setFocused(true);
21615
+ }, [onScrolling]);
21616
+ var onMouseLeave = useCallback(function () {
21617
+ setFocused(false);
21618
+ }, [onScrolling]);
21619
+ var onMouseDown = useCallback(function () {
21620
+ setIsGrapping(true);
21621
+ }, []);
21622
+ var onMouseUp = useCallback(function () {
21623
+ setIsGrapping(false);
21624
+ }, []);
21625
+ useEffect(function () {
21626
+ if (focused) {
21627
+ window.addEventListener('keydown', onKeyDown);
21628
+ window.addEventListener('keyup', onKeyUp);
21629
+ window.addEventListener('wheel', onScrolling);
21630
+ } else {
21631
+ window.removeEventListener('keydown', onKeyDown);
21632
+ window.removeEventListener('keyup', onKeyUp);
21633
+ window.removeEventListener('wheel', onScrolling);
21634
+ }
21635
+ return function () {
21636
+ window.removeEventListener('keydown', onKeyDown);
21637
+ window.removeEventListener('keyup', onKeyUp);
21638
+ window.removeEventListener('wheel', onScrolling);
21639
+ };
21640
+ }, [onScrolling, focused]);
21403
21641
  return /*#__PURE__*/jsx(TransformWrapper, {
21404
21642
  ref: transformComponentRef,
21405
21643
  pinch: {
@@ -21409,7 +21647,8 @@ var ZoomWrapper = function ZoomWrapper(_ref) {
21409
21647
  minScale: 0.2,
21410
21648
  wheel: {
21411
21649
  smoothStep: 0.001,
21412
- step: 0.2
21650
+ step: 0.2,
21651
+ activationKeys: ['Shift']
21413
21652
  },
21414
21653
  children: function children(_ref2) {
21415
21654
  var zoomIn = _ref2.zoomIn,
@@ -21445,11 +21684,26 @@ var ZoomWrapper = function ZoomWrapper(_ref) {
21445
21684
  }),
21446
21685
  size: 'small'
21447
21686
  })]
21687
+ }), showModal && /*#__PURE__*/jsx("div", {
21688
+ className: mask,
21689
+ children: /*#__PURE__*/jsx("p", {
21690
+ children: t('backoffice.orgtree.zoomwrapper.zoominfo')
21691
+ })
21448
21692
  }), /*#__PURE__*/jsx(TransformComponent, {
21449
21693
  wrapperStyle: {
21450
- width: '100%'
21694
+ width: '100%',
21695
+ cursor: isZooming ? 'nesw-resize' : isGrapping ? 'grabbing' : 'grab'
21696
+ },
21697
+ wrapperProps: {
21698
+ onMouseEnter: onMouseEnter,
21699
+ onMouseLeave: onMouseLeave,
21700
+ onMouseDown: onMouseDown,
21701
+ onMouseUp: onMouseUp
21451
21702
  },
21452
- children: _children
21703
+ wrapperClass: transformWrapper,
21704
+ children: /*#__PURE__*/jsx(Fragment, {
21705
+ children: _children
21706
+ })
21453
21707
  })]
21454
21708
  });
21455
21709
  }
@@ -21465,7 +21719,7 @@ var SearchSelect = function SearchSelect(_ref) {
21465
21719
  var _root$dataStore;
21466
21720
  root === null || root === void 0 || (_root$dataStore = root.dataStore) === null || _root$dataStore === void 0 || _root$dataStore.setSelectedOrganizationId(value);
21467
21721
  };
21468
- return /*#__PURE__*/jsx(Select$1, {
21722
+ return /*#__PURE__*/jsx(Select$2, {
21469
21723
  showSearch: true,
21470
21724
  placeholder: t('filter.global'),
21471
21725
  allowClear: true,
@@ -21507,12 +21761,13 @@ var OrgTreeComponent = function OrgTreeComponent(_ref) {
21507
21761
  breadcrumbs: itemChain,
21508
21762
  open: open
21509
21763
  }),
21510
- onOpen: function onOpen() {
21764
+ onTriggerOpening: function onTriggerOpening() {
21511
21765
  return setOpen(true);
21512
21766
  },
21513
- onClose: function onClose() {
21767
+ onTriggerClosing: function onTriggerClosing() {
21514
21768
  return setOpen(false);
21515
21769
  },
21770
+ open: open,
21516
21771
  children: [/*#__PURE__*/jsxs("div", {
21517
21772
  className: toolbarLeft,
21518
21773
  children: [/*#__PURE__*/jsx(SearchSelect, {
@@ -21530,6 +21785,9 @@ var OrgTreeComponent = function OrgTreeComponent(_ref) {
21530
21785
  })]
21531
21786
  }), /*#__PURE__*/jsx(ZoomWrapper, {
21532
21787
  zoomToId: zoomToId,
21788
+ onInitialized: function onInitialized() {
21789
+ return setOpen(true);
21790
+ },
21533
21791
  children: /*#__PURE__*/jsx(OrgTree, {
21534
21792
  data: data,
21535
21793
  horizontal: !!configuration.horizontal,
@@ -23981,7 +24239,7 @@ var DropDown = function DropDown(_ref) {
23981
24239
  }, item.item._id);
23982
24240
  };
23983
24241
 
23984
- var Option = Select$1.Option;
24242
+ var Option = Select$2.Option;
23985
24243
  var RelationSelector = function RelationSelector(_ref, ref) {
23986
24244
  var _relationState$config, _relationState$config2, _relationState$config3, _searchPlaceholder;
23987
24245
  var id = _ref.id,
@@ -24007,7 +24265,7 @@ var RelationSelector = function RelationSelector(_ref, ref) {
24007
24265
  relationState.searchItems('');
24008
24266
  }, []);
24009
24267
  return /*#__PURE__*/jsxs(Fragment, {
24010
- children: [relationState.configuration.search != undefined && (((_relationState$config = relationState.configuration.filter) === null || _relationState$config === void 0 ? void 0 : _relationState$config.type) === 'default' ? /*#__PURE__*/jsxs(Select$1, {
24268
+ children: [relationState.configuration.search != undefined && (((_relationState$config = relationState.configuration.filter) === null || _relationState$config === void 0 ? void 0 : _relationState$config.type) === 'default' ? /*#__PURE__*/jsxs(Select$2, {
24011
24269
  className: select,
24012
24270
  showSearch: true,
24013
24271
  suffixIcon: /*#__PURE__*/jsx(PlusSquareOutlined, {}),