@crystaldesign/diva-backoffice 24.2.4 → 24.3.0-beta.10

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: {
@@ -3865,13 +3866,6 @@ function loadConfiguration(t, root, config, lang) {
3865
3866
  fields: true
3866
3867
  }
3867
3868
  },
3868
- mapping: {
3869
- type: 'query',
3870
- map: [{
3871
- globalValue: 'organizationId',
3872
- targetField: 'id'
3873
- }]
3874
- },
3875
3869
  filter: {
3876
3870
  "default": {
3877
3871
  globalValue: 'selectedOrganizationId',
@@ -3976,6 +3970,15 @@ function loadConfiguration(t, root, config, lang) {
3976
3970
  targetField: 'organizationId'
3977
3971
  }]
3978
3972
  },
3973
+ createAction: {
3974
+ actionType: 'Detail',
3975
+ type: 'SelectOrCreate',
3976
+ id: 'SelectOrCreateNewMember',
3977
+ title: t('backoffice.table.allorgusers.createAction.title'),
3978
+ label: t('backoffice.table.allorgusers.createAction.title'),
3979
+ disableOnToggle: true,
3980
+ permission: 'backoffice_create_user'
3981
+ },
3979
3982
  downloadAction: {
3980
3983
  actionType: 'CsvExport',
3981
3984
  fileName: 'benutzer'
@@ -4007,6 +4010,30 @@ function loadConfiguration(t, root, config, lang) {
4007
4010
  sourceField: 'phoneNumber'
4008
4011
  }]
4009
4012
  }
4013
+ }, {
4014
+ actionType: 'Modal',
4015
+ title: t('backoffice.table.allorgusers.rowAction.title.aktivateuser'),
4016
+ text: t('backoffice.table.allorgusers.rowAction.text'),
4017
+ label: t('backoffice.table.allorgusers.rowAction.lable.aktivate'),
4018
+ type: 'Form',
4019
+ id: 'FormActivateUser',
4020
+ permission: 'backoffice_create_user',
4021
+ mapping: {
4022
+ type: 'body',
4023
+ map: [{
4024
+ sourceField: '_id',
4025
+ targetField: 'id'
4026
+ }, {
4027
+ sourceValue: window.location.origin,
4028
+ targetField: 'redirectTo'
4029
+ }]
4030
+ },
4031
+ rule: [{
4032
+ match: {
4033
+ sourceField: 'isActive',
4034
+ value: false
4035
+ }
4036
+ }]
4010
4037
  }]
4011
4038
  },
4012
4039
  TableViewpoints: {
@@ -5213,8 +5240,7 @@ function loadConfiguration(t, root, config, lang) {
5213
5240
  }, {
5214
5241
  title: t('backoffice.table.idmimports.fullName'),
5215
5242
  field: 'fullName',
5216
- sorter: 6,
5217
- filter: 'advanced'
5243
+ sorter: 6
5218
5244
  }, {
5219
5245
  title: t('backoffice.table.idmimports.user.name'),
5220
5246
  field: 'user.name',
@@ -5230,13 +5256,14 @@ function loadConfiguration(t, root, config, lang) {
5230
5256
  field: 'startTime',
5231
5257
  sorter: 3,
5232
5258
  type: 'unixTimeStamp',
5233
- filter: 'advanced'
5259
+ filter: 'interval'
5234
5260
  }, {
5235
5261
  title: t('backoffice.table.idmimports.endTime'),
5236
5262
  field: 'endTime',
5237
5263
  type: 'unixTimeStamp',
5238
5264
  sorter: 2,
5239
- dateInSeconds: false
5265
+ dateInSeconds: false,
5266
+ filter: 'interval'
5240
5267
  }, {
5241
5268
  title: t('backoffice.table.idmimports.lastUpdated'),
5242
5269
  field: 'lastUpdated',
@@ -5288,6 +5315,11 @@ function loadConfiguration(t, root, config, lang) {
5288
5315
  title: t('backoffice.table.idmimports.fileName'),
5289
5316
  field: 'fileName'
5290
5317
  }],
5318
+ filter: {
5319
+ search: {
5320
+ fields: ['_id', 'user.name', 'user.familyName', 'state', 'stateMessage', 'fullProgress', 'organizationId', 'serverName', 'fileName']
5321
+ }
5322
+ },
5291
5323
  apiInterface: {
5292
5324
  read: {
5293
5325
  list: '${catalogService}/idmImports',
@@ -6757,6 +6789,29 @@ function loadConfiguration(t, root, config, lang) {
6757
6789
  }]
6758
6790
  }
6759
6791
  },
6792
+ FormActivateUser: {
6793
+ type: 'Form',
6794
+ apiInterface: {
6795
+ create: {
6796
+ url: '${authService}/v2/users/{id}/activate?redirectTo={redirectTo}',
6797
+ method: 'POST'
6798
+ }
6799
+ },
6800
+ items: [{
6801
+ name: 'id',
6802
+ hidden: true,
6803
+ readonly: true
6804
+ }, {
6805
+ name: 'redirectTo',
6806
+ label: t('backoffice.form.activateuser.items.redirectTo'),
6807
+ rules: [{
6808
+ pattern: new RegExp('((https?)://).*'),
6809
+ required: true,
6810
+ message: t('backoffice.form.activateuser.items.redirectTo.rules')
6811
+ }],
6812
+ type: 'input'
6813
+ }]
6814
+ },
6760
6815
  FormApplicationTranslationsEdit: {
6761
6816
  type: 'Form',
6762
6817
  title: t('backoffice.form.applicationtranslationedit.title'),
@@ -8403,7 +8458,33 @@ function loadConfiguration(t, root, config, lang) {
8403
8458
  var _root$dataStore;
8404
8459
  root === null || root === void 0 || (_root$dataStore = root.dataStore) === null || _root$dataStore === void 0 || _root$dataStore.setSelectedOrganizationId(data._id);
8405
8460
  }
8406
- }
8461
+ },
8462
+ additionalActions: [{
8463
+ actionType: 'Callback',
8464
+ label: t('backoffice.orgtree.openAction'),
8465
+ id: 'ChangeToOrganization',
8466
+ rule: [{
8467
+ or: [{
8468
+ match: {
8469
+ sourceField: 'type',
8470
+ value: 'DEALER'
8471
+ }
8472
+ }, {
8473
+ match: {
8474
+ sourceField: 'type',
8475
+ value: 'RETAILER'
8476
+ }
8477
+ }, {
8478
+ match: {
8479
+ sourceField: 'type',
8480
+ value: 'RETAILERCHILD'
8481
+ }
8482
+ }]
8483
+ }],
8484
+ callback: function callback(data) {
8485
+ root === null || root === void 0 || root.actions.setOrganization(data.id);
8486
+ }
8487
+ }]
8407
8488
  },
8408
8489
  DescriptionCurrentOrganization: {
8409
8490
  type: 'Description',
@@ -8924,6 +9005,50 @@ function loadConfiguration(t, root, config, lang) {
8924
9005
  }]
8925
9006
  }
8926
9007
  },
9008
+ SelectOrCreateNewMember: {
9009
+ type: 'SelectOrCreate',
9010
+ mode: 'single',
9011
+ apiInterface: {
9012
+ create: '${authService}/v2/organizations/{organizationId}/members/{userId}',
9013
+ read: {
9014
+ list: '${authService}/v2/organizations/${organizationId}/members?all=true',
9015
+ filterServerSide: true,
9016
+ fallBackToParams: false,
9017
+ permissions: {
9018
+ backoffice_admin_users: '${authService}/v2/users'
9019
+ }
9020
+ }
9021
+ },
9022
+ readMapping: {
9023
+ type: 'query',
9024
+ map: [{
9025
+ targetField: 'organizationId',
9026
+ globalValue: 'selectedOrganizationId'
9027
+ }]
9028
+ },
9029
+ selectMapping: {
9030
+ label: 'mainEmail',
9031
+ value: '_id',
9032
+ searchField: [{
9033
+ field: 'mainEmail',
9034
+ filter: 'contains'
9035
+ }]
9036
+ },
9037
+ formId: 'FormUserDetails',
9038
+ actionMapping: {
9039
+ type: 'body',
9040
+ map: [{
9041
+ targetField: 'userId',
9042
+ sourceField: '_id'
9043
+ }, {
9044
+ targetField: 'organizationId',
9045
+ globalValue: 'selectedOrganizationId'
9046
+ }]
9047
+ },
9048
+ onError: {
9049
+ AUTH_0020: t('errorcodes._source.labels.error.AUTH_0020')
9050
+ }
9051
+ },
8927
9052
  MediaUploadOrganizationLogoMobile: {
8928
9053
  type: 'MediaUpload',
8929
9054
  size: 'medium',
@@ -11396,6 +11521,7 @@ function ActionButton (_ref) {
11396
11521
  danger = _ref.danger,
11397
11522
  buttonType = _ref.buttonType;
11398
11523
  var root = useStore();
11524
+ var label = typeof action.label == 'function' ? action.label(data) : action.label;
11399
11525
  var ButtonType = type == 'Button' ? Button : A;
11400
11526
  var disable = false;
11401
11527
  if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
@@ -11472,7 +11598,7 @@ function ActionButton (_ref) {
11472
11598
  width: action.width,
11473
11599
  footer: action.footer
11474
11600
  });
11475
- return _context.abrupt("break", 31);
11601
+ return _context.abrupt("break", 34);
11476
11602
  case 8:
11477
11603
  if (!(disable || shouldExecuted && !shouldExecuted())) {
11478
11604
  _context.next = 10;
@@ -11481,7 +11607,7 @@ function ActionButton (_ref) {
11481
11607
  return _context.abrupt("return");
11482
11608
  case 10:
11483
11609
  root.contentStore.setSelectedMenuItem(action.id);
11484
- return _context.abrupt("break", 31);
11610
+ return _context.abrupt("break", 34);
11485
11611
  case 12:
11486
11612
  if (!(disable || shouldExecuted && !shouldExecuted())) {
11487
11613
  _context.next = 14;
@@ -11494,7 +11620,7 @@ function ActionButton (_ref) {
11494
11620
  data: data,
11495
11621
  callback: callback !== null && callback !== void 0 ? callback : function () {}
11496
11622
  });
11497
- return _context.abrupt("break", 31);
11623
+ return _context.abrupt("break", 34);
11498
11624
  case 16:
11499
11625
  apiInterface = new _default$d({
11500
11626
  apiInterface: action.apiInterface,
@@ -11531,8 +11657,16 @@ function ActionButton (_ref) {
11531
11657
  _context.t1 = _context["catch"](17);
11532
11658
  root.error = action.errorText;
11533
11659
  case 30:
11534
- return _context.abrupt("break", 31);
11660
+ return _context.abrupt("break", 34);
11535
11661
  case 31:
11662
+ if (!(disable || shouldExecuted && !shouldExecuted())) {
11663
+ _context.next = 33;
11664
+ break;
11665
+ }
11666
+ return _context.abrupt("return");
11667
+ case 33:
11668
+ callback === null || callback === void 0 || callback(data);
11669
+ case 34:
11536
11670
  case "end":
11537
11671
  return _context.stop();
11538
11672
  }
@@ -11544,13 +11678,13 @@ function ActionButton (_ref) {
11544
11678
  }();
11545
11679
  switch (action.actionType) {
11546
11680
  case 'SwitchButton':
11547
- var lable;
11681
+ var switchLabel;
11548
11682
  var _iterator3 = _createForOfIteratorHelper$h(action.switchLable),
11549
11683
  _step3;
11550
11684
  try {
11551
11685
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
11552
11686
  var element = _step3.value;
11553
- if (element.sourceValue == data[action.switchField]) lable = element.targetValue;
11687
+ if (element.sourceValue == data[action.switchField]) switchLabel = element.targetValue;
11554
11688
  }
11555
11689
  } catch (err) {
11556
11690
  _iterator3.e(err);
@@ -11561,7 +11695,7 @@ function ActionButton (_ref) {
11561
11695
  disabled: disable,
11562
11696
  style: style,
11563
11697
  onClick: onClick,
11564
- children: lable
11698
+ children: switchLabel
11565
11699
  }, id);
11566
11700
  case 'Detail':
11567
11701
  return /*#__PURE__*/jsx(ButtonType, {
@@ -11570,7 +11704,7 @@ function ActionButton (_ref) {
11570
11704
  disabled: disable,
11571
11705
  style: style,
11572
11706
  onClick: onClick,
11573
- children: action.label || defaultLabel
11707
+ children: label || defaultLabel
11574
11708
  }, id);
11575
11709
  case 'GoTo':
11576
11710
  return /*#__PURE__*/jsx(ButtonType, {
@@ -11579,7 +11713,7 @@ function ActionButton (_ref) {
11579
11713
  disabled: disable,
11580
11714
  style: style,
11581
11715
  onClick: onClick,
11582
- children: action.label || defaultLabel
11716
+ children: label || defaultLabel
11583
11717
  }, id);
11584
11718
  case 'Modal':
11585
11719
  return /*#__PURE__*/jsx(ButtonType, {
@@ -11588,7 +11722,7 @@ function ActionButton (_ref) {
11588
11722
  disabled: disable,
11589
11723
  style: style,
11590
11724
  onClick: onClick,
11591
- children: action.label || defaultLabel
11725
+ children: label || defaultLabel
11592
11726
  }, id);
11593
11727
  case 'Download':
11594
11728
  var icon = /*#__PURE__*/jsx(FileExcelOutlined, {});
@@ -11610,7 +11744,16 @@ function ActionButton (_ref) {
11610
11744
  action: action
11611
11745
  });
11612
11746
  },
11613
- children: action.label || icon
11747
+ children: label || icon
11748
+ }, id);
11749
+ case 'Callback':
11750
+ return /*#__PURE__*/jsx(ButtonType, {
11751
+ type: buttonType,
11752
+ danger: danger,
11753
+ disabled: disable,
11754
+ style: style,
11755
+ onClick: onClick,
11756
+ children: label || defaultLabel
11614
11757
  }, id);
11615
11758
  default:
11616
11759
  throw new Error("Action type ".concat(action.actionType, " is not supported"));
@@ -12131,7 +12274,7 @@ var SelectWrapper$1 = function SelectWrapper(_ref) {
12131
12274
  var filterServerSide = _typeof(apiInterface) == 'object' && _typeof(apiInterface.read) == 'object' && apiInterface.read.filterServerSide;
12132
12275
  var selected = state.selected;
12133
12276
  return /*#__PURE__*/jsx(Fragment, {
12134
- children: /*#__PURE__*/jsx(Select$1, {
12277
+ children: /*#__PURE__*/jsx(Select$2, {
12135
12278
  labelInValue: mode === 'tags' ? false : true,
12136
12279
  style: {
12137
12280
  width: '100%',
@@ -12157,7 +12300,7 @@ var SelectWrapper$1 = function SelectWrapper(_ref) {
12157
12300
  })
12158
12301
  });
12159
12302
  };
12160
- var Select = observer(SelectWrapper$1, {
12303
+ var Select$1 = observer(SelectWrapper$1, {
12161
12304
  forwardRef: true
12162
12305
  });
12163
12306
 
@@ -12279,7 +12422,7 @@ var FileUploadWrapper = function FileUploadWrapper(_ref) {
12279
12422
  style: {
12280
12423
  marginTop: 18
12281
12424
  },
12282
- children: /*#__PURE__*/jsx(Select, {
12425
+ children: /*#__PURE__*/jsx(Select$1, {
12283
12426
  mode: "multiple",
12284
12427
  apiInterface: {
12285
12428
  read: {
@@ -12921,7 +13064,7 @@ var Presets = function Presets(_ref) {
12921
13064
  setUsedPreset = _ref.setUsedPreset,
12922
13065
  presets = _ref.presets,
12923
13066
  setPresets = _ref.setPresets;
12924
- var Option = Select$1.Option;
13067
+ var Option = Select$2.Option;
12925
13068
  var _useState = useState(false),
12926
13069
  _useState2 = _slicedToArray(_useState, 2),
12927
13070
  isModalVisible = _useState2[0],
@@ -13025,7 +13168,7 @@ var Presets = function Presets(_ref) {
13025
13168
  setValue(undefined);
13026
13169
  };
13027
13170
  return /*#__PURE__*/jsxs(Fragment, {
13028
- children: [/*#__PURE__*/jsx(Select$1, {
13171
+ children: [/*#__PURE__*/jsx(Select$2, {
13029
13172
  showSearch: true,
13030
13173
  value: value,
13031
13174
  placeholder: t('backoffice.form.presets.placeholder'),
@@ -14316,7 +14459,7 @@ var Selector = function Selector(_ref) {
14316
14459
  }
14317
14460
  }, [valueState]);
14318
14461
  return /*#__PURE__*/jsx(Fragment, {
14319
- children: /*#__PURE__*/jsx(Select$1, {
14462
+ children: /*#__PURE__*/jsx(Select$2, {
14320
14463
  className: customSelect,
14321
14464
  showSearch: true,
14322
14465
  labelInValue: true,
@@ -14335,7 +14478,7 @@ var Selector = function Selector(_ref) {
14335
14478
  return onSelect(option === null || option === void 0 ? void 0 : option.key);
14336
14479
  },
14337
14480
  children: items === null || items === void 0 ? void 0 : items.map(function (i) {
14338
- return /*#__PURE__*/jsxs(Select$1.Option, {
14481
+ return /*#__PURE__*/jsxs(Select$2.Option, {
14339
14482
  value: i.name,
14340
14483
  className: customSelectOption,
14341
14484
  children: [/*#__PURE__*/jsx("div", {
@@ -14429,7 +14572,8 @@ function useSelectSimpleData (_ref) {
14429
14572
  var apiInterface = _ref.apiInterface,
14430
14573
  selectMapping = _ref.selectMapping,
14431
14574
  onChange = _ref.onChange,
14432
- value = _ref.value;
14575
+ value = _ref.value,
14576
+ configuredOptions = _ref.options;
14433
14577
  var root = useStore();
14434
14578
  var _useMemo = useMemo(function () {
14435
14579
  return {
@@ -14440,23 +14584,18 @@ function useSelectSimpleData (_ref) {
14440
14584
  };
14441
14585
  }, []),
14442
14586
  apiHandler = _useMemo.apiHandler;
14443
- var _useState = useState(false),
14587
+ var _useState = useState(true),
14444
14588
  _useState2 = _slicedToArray(_useState, 2),
14445
14589
  loading = _useState2[0],
14446
14590
  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),
14591
+ var _useState3 = useState(),
14449
14592
  _useState4 = _slicedToArray(_useState3, 2),
14450
- skipOnRender = _useState4[0],
14451
- setSkipOnRender = _useState4[1];
14452
- var _useState5 = useState([]),
14593
+ options = _useState4[0],
14594
+ setOptions = _useState4[1];
14595
+ var _useState5 = useState(),
14453
14596
  _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];
14597
+ selected = _useState6[0],
14598
+ setSelected = _useState6[1];
14460
14599
  var currentValue = useMemo(function () {
14461
14600
  if (!selected) return undefined;
14462
14601
  if (Array.isArray(selected)) return selected.map(function (item) {
@@ -14465,8 +14604,10 @@ function useSelectSimpleData (_ref) {
14465
14604
  return selected.value;
14466
14605
  }, [selected]);
14467
14606
  useEffect(function () {
14468
- if (skipOnRender) {
14469
- setSkipOnRender(false);
14607
+ if (configuredOptions) {
14608
+ if (apiHandler.canReadList) LOG$8.warn('If options are provided, apiInterface will not be used');
14609
+ setOptions(configuredOptions);
14610
+ setLoading(false);
14470
14611
  return;
14471
14612
  }
14472
14613
  if (!apiHandler.canReadList) throw Error('SelectSimple: apiInterface must have readList method');
@@ -14478,13 +14619,17 @@ function useSelectSimpleData (_ref) {
14478
14619
  return parseDataEntry(item, selectMapping);
14479
14620
  });
14480
14621
  setOptions(options);
14481
- if (value) {
14482
- setSelected(findByValue(value, options, selectMapping));
14483
- }
14484
14622
  })["finally"](function () {
14485
14623
  setLoading(false);
14486
14624
  });
14487
- }, [skipOnRender]);
14625
+ }, []);
14626
+ useEffect(function () {
14627
+ // set the selected option only after the options are loaded
14628
+ if (value && options) {
14629
+ LOG$8.debug('value changed', value);
14630
+ setSelected(findByValue(value, options, selectMapping));
14631
+ }
14632
+ }, [value, options]);
14488
14633
  var onSelectionChanged = function onSelectionChanged(value, option) {
14489
14634
  setSelected(option);
14490
14635
  onChange === null || onChange === void 0 || onChange(parseReturnData(option, selectMapping));
@@ -14548,7 +14693,7 @@ function parseReturnData(options, selectMapping) {
14548
14693
  return (selectMapping === null || selectMapping === void 0 ? void 0 : selectMapping.externalValue) == 'value' ? options.value : options.data;
14549
14694
  }
14550
14695
 
14551
- var _excluded$2 = ["apiInterface", "selectMapping", "onChange", "value", "search"];
14696
+ var _excluded$2 = ["apiInterface", "selectMapping", "onChange", "value", "search", "options"];
14552
14697
  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
14698
  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
14699
  var SelectWrapper = function SelectWrapper(_ref) {
@@ -14557,15 +14702,17 @@ var SelectWrapper = function SelectWrapper(_ref) {
14557
14702
  onChange = _ref.onChange,
14558
14703
  value = _ref.value,
14559
14704
  search = _ref.search,
14705
+ options = _ref.options,
14560
14706
  selectProps = _objectWithoutProperties(_ref, _excluded$2);
14561
14707
  var state = useSelectSimpleData({
14562
14708
  apiInterface: apiInterface,
14563
14709
  selectMapping: selectMapping,
14564
14710
  onChange: onChange,
14565
14711
  value: value,
14566
- type: 'SelectSimple'
14712
+ type: 'SelectSimple',
14713
+ options: options
14567
14714
  });
14568
- return /*#__PURE__*/jsx(Select$1, _objectSpread$t(_objectSpread$t({}, selectProps), {}, {
14715
+ return /*#__PURE__*/jsx(Select$2, _objectSpread$t(_objectSpread$t({}, selectProps), {}, {
14569
14716
  showSearch: search,
14570
14717
  loading: state.loading,
14571
14718
  options: state.options,
@@ -14575,7 +14722,7 @@ var SelectWrapper = function SelectWrapper(_ref) {
14575
14722
  filterOption: filterOption
14576
14723
  }));
14577
14724
  };
14578
- var SelectSimple = observer(SelectWrapper, {
14725
+ var Select = observer(SelectWrapper, {
14579
14726
  forwardRef: true
14580
14727
  });
14581
14728
  var filterOption = function filterOption(input, option) {
@@ -14764,7 +14911,7 @@ var FormWrapper$1 = function FormWrapper(_ref, ref) {
14764
14911
  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
14912
  switch (item.type) {
14766
14913
  case 'select':
14767
- return /*#__PURE__*/jsx(Select, {
14914
+ return /*#__PURE__*/jsx(Select$1, {
14768
14915
  initialValue: item.defaultValue,
14769
14916
  apiInterface: item.apiInterface,
14770
14917
  mode: item.mode,
@@ -14789,7 +14936,7 @@ var FormWrapper$1 = function FormWrapper(_ref, ref) {
14789
14936
  }
14790
14937
  }, state.selectedItemsIndex);
14791
14938
  case 'selectSimple':
14792
- return /*#__PURE__*/jsx(SelectSimple, _objectSpread$s(_objectSpread$s({}, item), {}, {
14939
+ return /*#__PURE__*/jsx(Select, _objectSpread$s(_objectSpread$s({}, item), {}, {
14793
14940
  disabled: disabled,
14794
14941
  onChange: function onChange(value) {
14795
14942
  _onChange(item.name, value);
@@ -15898,7 +16045,7 @@ var FormWrapper = function FormWrapper(_ref, ref) {
15898
16045
  span: 4
15899
16046
  }), /*#__PURE__*/jsx(Col, {
15900
16047
  span: 20,
15901
- children: /*#__PURE__*/jsx(Select$1, {
16048
+ children: /*#__PURE__*/jsx(Select$2, {
15902
16049
  style: {
15903
16050
  width: '100%'
15904
16051
  },
@@ -16609,7 +16756,7 @@ function DropdownCell (_ref) {
16609
16756
  noStyle: true,
16610
16757
  name: dataIndex,
16611
16758
  initialValue: column.translationPrefix ? t(column.translationPrefix + '.' + children[1]) : children,
16612
- children: /*#__PURE__*/jsx(Select$1, {
16759
+ children: /*#__PURE__*/jsx(Select$2, {
16613
16760
  style: {
16614
16761
  width: column.width - 20
16615
16762
  },
@@ -17592,10 +17739,10 @@ dayjs.extend(weekday);
17592
17739
  dayjs.extend(localeData);
17593
17740
  dayjs.extend(weekOfYear);
17594
17741
  dayjs.extend(weekYear);
17595
- Select$1.Option;
17742
+ Select$2.Option;
17596
17743
  var LOG$4 = getLogger('Backoffice', 'BaseTable');
17597
17744
  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;
17745
+ 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
17746
  var state = _ref.state;
17600
17747
  var root = useStore();
17601
17748
  var _useState = useState(0),
@@ -17673,6 +17820,10 @@ var TableWrapper = function TableWrapper(_ref) {
17673
17820
  rules: state.configuration.downloadAction.rule
17674
17821
  });
17675
17822
  }
17823
+ function checkPermission(permission) {
17824
+ if (!permission) return true;
17825
+ return root.actions.userHasPermission(permission);
17826
+ }
17676
17827
  return /*#__PURE__*/jsxs(Fragment, {
17677
17828
  children: [(state.canDelete || state.configuration.createAction || state.title || state.configuration.canRefresh || state.configuration.clientRelations) && /*#__PURE__*/jsx(Fragment, {
17678
17829
  children: /*#__PURE__*/jsx(Descriptions, {
@@ -17681,8 +17832,11 @@ var TableWrapper = function TableWrapper(_ref) {
17681
17832
  style: {
17682
17833
  "float": 'right'
17683
17834
  },
17684
- children: [state.configuration.clientRelations && state.configuration.variant !== 'CatalogTable' && /*#__PURE__*/jsx(SelectClientRelationCatalog, {
17685
- onSelectedCatalog: state.onSelectedCatalog
17835
+ children: [state.configuration.clientRelations && state.configuration.variant !== 'CatalogTable' && /*#__PURE__*/jsx(Fragment, {
17836
+ children: /*#__PURE__*/jsx(SelectClientRelationCatalog, {
17837
+ onSelectedCatalog: state.onSelectedCatalog,
17838
+ dontLoadCatalogData: state.configuration.dontLoadCatalogData
17839
+ })
17686
17840
  }), state.configuration.downloadAction && /*#__PURE__*/jsx(Button, {
17687
17841
  type: "primary",
17688
17842
  disabled: isDownloadActionDisabled(),
@@ -17736,44 +17890,35 @@ var TableWrapper = function TableWrapper(_ref) {
17736
17890
  // Convert to Dayjs
17737
17891
  (_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
17892
  ]
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
- }
17893
+ }), ((_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), {}, {
17894
+ style: {
17895
+ minWidth: '200px'
17750
17896
  },
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
17897
+ 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],
17898
+ onChange: function onChange(selected) {
17899
+ state.onGlobalFilterSelect(selected);
17900
+ }
17756
17901
  })), /*#__PURE__*/jsx(SelectionText, {
17757
17902
  selected: state.selected
17758
17903
  }), state.canDelete && /*#__PURE__*/jsx(DeleteButton, {
17759
17904
  selected: state.selected,
17760
17905
  total: state.pagination.total,
17761
- min: (_state$configuration$14 = state.configuration.rules) === null || _state$configuration$14 === void 0 ? void 0 : _state$configuration$14.min,
17906
+ min: (_state$configuration$9 = state.configuration.rules) === null || _state$configuration$9 === void 0 ? void 0 : _state$configuration$9.min,
17762
17907
  deleting: state.deleting,
17763
17908
  onDelete: state.onDelete
17764
17909
  }), state.configuration.copyAction !== undefined && /*#__PURE__*/jsx(CopyButton, {
17765
17910
  state: state
17766
- }), (_state$configuration$15 = state.configuration.bulkActions) === null || _state$configuration$15 === void 0 ? void 0 : _state$configuration$15.map(function (action) {
17911
+ }), (_state$configuration$10 = state.configuration.bulkActions) === null || _state$configuration$10 === void 0 ? void 0 : _state$configuration$10.map(function (action) {
17767
17912
  return /*#__PURE__*/jsx(BulkAction, {
17768
17913
  action: action,
17769
17914
  state: state
17770
17915
  }, action.id);
17771
- }), state.configuration.createAction && /*#__PURE__*/jsx(ActionButton, {
17916
+ }), state.configuration.createAction && checkPermission(state.configuration.createAction.permission) && /*#__PURE__*/jsx(ActionButton, {
17772
17917
  action: state.configuration.createAction,
17773
17918
  callback: function callback(data) {
17774
- var _state$onUpdate, _state$configuration$16, _state$configuration$17;
17919
+ var _state$onUpdate, _state$configuration$11, _state$configuration$12;
17775
17920
  (_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);
17921
+ (_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
17922
  },
17778
17923
  type: "Button",
17779
17924
  id: 'create',
@@ -17820,13 +17965,13 @@ var TableWrapper = function TableWrapper(_ref) {
17820
17965
  }), /*#__PURE__*/jsx(Table$1, {
17821
17966
  scroll: {
17822
17967
  x: '100%',
17823
- y: (_state$configuration$18 = state.configuration.height) !== null && _state$configuration$18 !== void 0 ? _state$configuration$18 : '60vh'
17968
+ y: (_state$configuration$13 = state.configuration.height) !== null && _state$configuration$13 !== void 0 ? _state$configuration$13 : '60vh'
17824
17969
  },
17825
17970
  rowClassName: editableRow,
17826
17971
  components: cellRenderer,
17827
17972
  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);
17973
+ var _state$configuration$14, _state$configuration$15;
17974
+ 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
17975
  },
17831
17976
  dataSource: data,
17832
17977
  loading: state.loading,
@@ -17900,13 +18045,13 @@ function CopyButton(_ref3) {
17900
18045
  }, root);
17901
18046
  var onCopy = /*#__PURE__*/function () {
17902
18047
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
17903
- var _state$configuration$21;
18048
+ var _state$configuration$16;
17904
18049
  var copyAction, _iterator3, _step3, selectedRow;
17905
18050
  return _regeneratorRuntime.wrap(function _callee$(_context) {
17906
18051
  while (1) switch (_context.prev = _context.next) {
17907
18052
  case 0:
17908
18053
  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) {
18054
+ if (((_state$configuration$16 = state.configuration.copyAction) === null || _state$configuration$16 === void 0 ? void 0 : _state$configuration$16.apiInterface) != undefined) {
17910
18055
  _iterator3 = _createForOfIteratorHelper$8(state.selected);
17911
18056
  try {
17912
18057
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
@@ -17941,13 +18086,13 @@ function CopyButton(_ref3) {
17941
18086
  }();
17942
18087
  var onCopyAction = /*#__PURE__*/function () {
17943
18088
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
17944
- var _state$configuration$22, _state$configuration$23;
18089
+ var _state$configuration$17, _state$configuration$18;
17945
18090
  var copyAction, id, filter, data;
17946
18091
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
17947
18092
  while (1) switch (_context3.prev = _context3.next) {
17948
18093
  case 0:
17949
18094
  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')) {
18095
+ 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
18096
  _context3.next = 3;
17952
18097
  break;
17953
18098
  }
@@ -17977,7 +18122,7 @@ function CopyButton(_ref3) {
17977
18122
  configurationId: copyAction === null || copyAction === void 0 ? void 0 : copyAction.id,
17978
18123
  data: data.data[0],
17979
18124
  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,
18125
+ mapping: (_state$configuration$18 = state.configuration.createAction) === null || _state$configuration$18 === void 0 ? void 0 : _state$configuration$18.mapping,
17981
18126
  mappingData: data.data[0],
17982
18127
  callback: function () {
17983
18128
  var _callback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(e) {
@@ -18395,7 +18540,7 @@ var advancedProps = function advancedProps(title) {
18395
18540
  },
18396
18541
  children: /*#__PURE__*/jsxs(Space, {
18397
18542
  direction: "vertical",
18398
- children: [/*#__PURE__*/jsxs(Select$1, {
18543
+ children: [/*#__PURE__*/jsxs(Select$2, {
18399
18544
  defaultValue: "contains",
18400
18545
  style: {
18401
18546
  width: 188,
@@ -18404,28 +18549,28 @@ var advancedProps = function advancedProps(title) {
18404
18549
  onSelect: function onSelect(value) {
18405
18550
  setSelectedKeys([selectedKeys[0], value]);
18406
18551
  },
18407
- children: [/*#__PURE__*/jsx(Select$1.Option, {
18552
+ children: [/*#__PURE__*/jsx(Select$2.Option, {
18408
18553
  value: "eq",
18409
18554
  children: "Ist equivalent zu"
18410
- }), /*#__PURE__*/jsx(Select$1.Option, {
18555
+ }), /*#__PURE__*/jsx(Select$2.Option, {
18411
18556
  value: "ne",
18412
18557
  children: "Ist nicht equivalent zu"
18413
- }), /*#__PURE__*/jsx(Select$1.Option, {
18558
+ }), /*#__PURE__*/jsx(Select$2.Option, {
18414
18559
  value: "contains",
18415
18560
  children: "Enth\xE4lt"
18416
- }), /*#__PURE__*/jsx(Select$1.Option, {
18561
+ }), /*#__PURE__*/jsx(Select$2.Option, {
18417
18562
  value: "doesnotcontain",
18418
18563
  children: "Enth\xE4lt nicht"
18419
- }), /*#__PURE__*/jsx(Select$1.Option, {
18564
+ }), /*#__PURE__*/jsx(Select$2.Option, {
18420
18565
  value: "startswith",
18421
18566
  children: "Beginnt mit"
18422
- }), /*#__PURE__*/jsx(Select$1.Option, {
18567
+ }), /*#__PURE__*/jsx(Select$2.Option, {
18423
18568
  value: "endswith",
18424
18569
  children: "Endet mit"
18425
- }), /*#__PURE__*/jsx(Select$1.Option, {
18570
+ }), /*#__PURE__*/jsx(Select$2.Option, {
18426
18571
  value: "isnull",
18427
18572
  children: "Ist Null"
18428
- }), /*#__PURE__*/jsx(Select$1.Option, {
18573
+ }), /*#__PURE__*/jsx(Select$2.Option, {
18429
18574
  value: "isnotnull",
18430
18575
  children: "Ist nicht Null"
18431
18576
  })]
@@ -18572,7 +18717,7 @@ var selectProps = function selectProps(title, filter) {
18572
18717
  },
18573
18718
  children: /*#__PURE__*/jsxs(Space, {
18574
18719
  direction: "vertical",
18575
- children: [/*#__PURE__*/jsx(Select$1, {
18720
+ children: [/*#__PURE__*/jsx(Select$2, {
18576
18721
  placeholder: "Filter ".concat(title),
18577
18722
  value: selectedKeys[0],
18578
18723
  style: {
@@ -19233,7 +19378,7 @@ function ownKeys$g(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
19233
19378
  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
19379
  var LOG$3 = getLogger('Backoffice', 'TableData');
19235
19380
  function useTableData (_ref) {
19236
- var _configuration$filter, _configuration$filter2, _configuration$filter3, _configuration$filter4, _configuration$bulkAc, _configuration$apiInt;
19381
+ var _configuration$filter, _configuration$filter2, _configuration$filter3, _configuration$bulkAc, _configuration$apiInt;
19237
19382
  var id = _ref.id,
19238
19383
  i18n = _ref.i18n,
19239
19384
  parentData = _ref.parentData,
@@ -19273,7 +19418,7 @@ function useTableData (_ref) {
19273
19418
  return defaultFilter[f] = [configuration.filter["default"].globalValue ? root.getGlobalValue(configuration.filter["default"].globalValue) : true, 'eq'];
19274
19419
  });
19275
19420
  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,
19421
+ 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
19422
  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
19423
  "default": defaultFilter ? defaultFilter : undefined
19279
19424
  }),
@@ -19359,8 +19504,8 @@ function useTableData (_ref) {
19359
19504
  for (var i = 0; i < dataArray.length; i++) {
19360
19505
  var dataRow = dataArray[i];
19361
19506
  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) {
19507
+ var _configuration$filter4;
19508
+ if ((_configuration$filter4 = configuration.filter) !== null && _configuration$filter4 !== void 0 && (_configuration$filter4 = _configuration$filter4.select) !== null && _configuration$filter4 !== void 0 && _configuration$filter4.filterField) {
19364
19509
  onGlobalFilterSelect(dataRow[configuration.filter.select.filterField]);
19365
19510
  } else {
19366
19511
  var _pagination;
@@ -19376,15 +19521,15 @@ function useTableData (_ref) {
19376
19521
  });
19377
19522
  }
19378
19523
  } else {
19379
- var _configuration$filter6, _configuration$filter7;
19524
+ var _configuration$filter5, _configuration$filter6;
19380
19525
  var _updateData2 = updateData({
19381
19526
  data: newInitData,
19382
19527
  dataRow: dataRow
19383
19528
  }),
19384
19529
  nextInitData = _updateData2.data;
19385
19530
  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 ? {
19531
+ 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"])
19532
+ }, 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
19533
  genericProps: globalFilter.toggle
19389
19534
  } : undefined), {}, {
19390
19535
  data: nextInitData,
@@ -19415,10 +19560,22 @@ function useTableData (_ref) {
19415
19560
  _useState16 = _slicedToArray(_useState15, 1),
19416
19561
  columns = _useState16[0];
19417
19562
  var triggerRefresh = function triggerRefresh() {
19563
+ var _configuration$filter7;
19418
19564
  setError(undefined);
19565
+ var newGlobalFilter = _objectSpread$g({}, globalFilter);
19566
+ //on refresh update default filter, since global value can change
19567
+ if ((_configuration$filter7 = configuration.filter) !== null && _configuration$filter7 !== void 0 && _configuration$filter7["default"]) {
19568
+ var _configuration$filter8;
19569
+ var _defaultFilter = {};
19570
+ (_configuration$filter8 = configuration.filter) === null || _configuration$filter8 === void 0 || (_configuration$filter8 = _configuration$filter8["default"]) === null || _configuration$filter8 === void 0 || _configuration$filter8.fields.forEach(function (f) {
19571
+ return _defaultFilter[f] = [configuration.filter["default"].globalValue ? root.getGlobalValue(configuration.filter["default"].globalValue) : true, 'eq'];
19572
+ });
19573
+ newGlobalFilter["default"] = _defaultFilter;
19574
+ setGlobaFilter(newGlobalFilter);
19575
+ }
19419
19576
  onChange(_objectSpread$g({
19420
19577
  pagination: state.pagination
19421
- }, filterData), undefined, true);
19578
+ }, filterData), newGlobalFilter, true);
19422
19579
  };
19423
19580
  useEffect(function () {
19424
19581
  if (_typeof(configuration.apiInterface) !== 'object') {
@@ -19471,7 +19628,7 @@ function useTableData (_ref) {
19471
19628
  }, [configuration.title, parentData]);
19472
19629
  var onChange = /*#__PURE__*/function () {
19473
19630
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(p) {
19474
- var _configuration$filter8;
19631
+ var _configuration$filter9, _configuration$filter10, _configuration$filter11, _prefilter$select, _configuration$filter12, _configuration$filter13;
19475
19632
  var prefilter,
19476
19633
  refresh,
19477
19634
  currentData,
@@ -19479,7 +19636,7 @@ function useTableData (_ref) {
19479
19636
  currentFilterHash,
19480
19637
  currentPagination,
19481
19638
  currentUrl,
19482
- _configuration$filter9,
19639
+ _configuration$filter14,
19483
19640
  ssf,
19484
19641
  data,
19485
19642
  _data3,
@@ -19496,7 +19653,7 @@ function useTableData (_ref) {
19496
19653
  loading: true
19497
19654
  }));
19498
19655
  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
19656
+ filterData = _objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g({}, p.filters), prefilter.search), !(configuration !== null && configuration !== void 0 && (_configuration$filter9 = configuration.filter) !== null && _configuration$filter9 !== void 0 && (_configuration$filter9 = _configuration$filter9.toggle) !== null && _configuration$filter9 !== void 0 && _configuration$filter9.inQuery) ? prefilter.toggle : undefined), ((_configuration$filter10 = configuration.filter) === null || _configuration$filter10 === void 0 || (_configuration$filter10 = _configuration$filter10.select) === null || _configuration$filter10 === void 0 ? void 0 : _configuration$filter10.applyDefaultValue) !== false || ((_configuration$filter11 = configuration.filter) === null || _configuration$filter11 === void 0 || (_configuration$filter11 = _configuration$filter11.select) === null || _configuration$filter11 === void 0 ? void 0 : _configuration$filter11.defaultValue) !== ((_prefilter$select = prefilter.select) === null || _prefilter$select === void 0 || (_prefilter$select = _prefilter$select[(_configuration$filter12 = (_configuration$filter13 = configuration.filter) === null || _configuration$filter13 === void 0 || (_configuration$filter13 = _configuration$filter13.select) === null || _configuration$filter13 === void 0 ? void 0 : _configuration$filter13.filterField) !== null && _configuration$filter12 !== void 0 ? _configuration$filter12 : '']) === null || _prefilter$select === void 0 ? void 0 : _prefilter$select[0]) ? prefilter.select : undefined), prefilter.timeStamp), prefilter["default"]); //remove all null values
19500
19657
  filterData = Object.fromEntries(Object.entries(filterData).filter(function (_ref5) {
19501
19658
  var _ref6 = _slicedToArray(_ref5, 2);
19502
19659
  _ref6[0];
@@ -19517,7 +19674,7 @@ function useTableData (_ref) {
19517
19674
  columns: configuration.columns,
19518
19675
  filters: filterData,
19519
19676
  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 ? {
19677
+ }, 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 ? {
19521
19678
  genericProps: prefilter.toggle
19522
19679
  } : undefined);
19523
19680
  _context2.next = 13;
@@ -19583,7 +19740,7 @@ function useTableData (_ref) {
19583
19740
  var onDelete = /*#__PURE__*/function () {
19584
19741
  var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
19585
19742
  var _configuration$apiInt2;
19586
- var newData, newInitData, deleted, userPermissions, _loop, mappingData, deleteResult, _ret, index, total, pages, current, _configuration$filter10, _configuration$filter11, data;
19743
+ var newData, newInitData, deleted, userPermissions, _loop, mappingData, deleteResult, _ret, index, total, pages, current, _configuration$filter15, _configuration$filter16, data;
19587
19744
  return _regeneratorRuntime.wrap(function _callee3$(_context4) {
19588
19745
  while (1) switch (_context4.prev = _context4.next) {
19589
19746
  case 0:
@@ -19598,7 +19755,7 @@ function useTableData (_ref) {
19598
19755
  case 6:
19599
19756
  userPermissions = _context4.sent;
19600
19757
  _loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop(index) {
19601
- var _configuration$rowKey, _configuration$filter12, _configuration$filter13;
19758
+ var _configuration$rowKey, _configuration$filter17, _configuration$filter18;
19602
19759
  var id, _newData$filter, _newData$filter2, mapToggle, _iterator, _step, _globalFilter$toggle, field, _globalFilter$toggle2, _configuration$delete, _configuration$onErro, _configuration$onErro2, deletedIndex, initDeletedIndex;
19603
19760
  return _regeneratorRuntime.wrap(function _loop$(_context3) {
19604
19761
  while (1) switch (_context3.prev = _context3.next) {
@@ -19614,7 +19771,7 @@ function useTableData (_ref) {
19614
19771
  })) === null || _newData$filter2 === void 0 ? void 0 : _newData$filter2[0];
19615
19772
  }
19616
19773
  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 : []);
19774
+ _iterator = _createForOfIteratorHelper$7((_configuration$filter17 = (_configuration$filter18 = configuration.filter) === null || _configuration$filter18 === void 0 || (_configuration$filter18 = _configuration$filter18.toggle) === null || _configuration$filter18 === void 0 ? void 0 : _configuration$filter18.fields) !== null && _configuration$filter17 !== void 0 ? _configuration$filter17 : []);
19618
19775
  try {
19619
19776
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
19620
19777
  field = _step.value;
@@ -19723,9 +19880,9 @@ function useTableData (_ref) {
19723
19880
  current: current
19724
19881
  }),
19725
19882
  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"]),
19883
+ filters: _objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g(_objectSpread$g({}, filterData.filters), globalFilter.search), !(configuration !== null && configuration !== void 0 && (_configuration$filter15 = configuration.filter) !== null && _configuration$filter15 !== void 0 && (_configuration$filter15 = _configuration$filter15.toggle) !== null && _configuration$filter15 !== void 0 && _configuration$filter15.inQuery) ? globalFilter.toggle : undefined), globalFilter.select), globalFilter.timeStamp), globalFilter["default"]),
19727
19884
  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 ? {
19885
+ }, configuration !== null && configuration !== void 0 && (_configuration$filter16 = configuration.filter) !== null && _configuration$filter16 !== void 0 && (_configuration$filter16 = _configuration$filter16.toggle) !== null && _configuration$filter16 !== void 0 && _configuration$filter16.inQuery ? {
19729
19886
  genericProps: globalFilter.toggle
19730
19887
  } : undefined));
19731
19888
  case 25:
@@ -19754,13 +19911,13 @@ function useTableData (_ref) {
19754
19911
  };
19755
19912
  }();
19756
19913
  var onGlobalFilterSelect = function onGlobalFilterSelect(value) {
19757
- var _configuration$filter14;
19758
- if (!((_configuration$filter14 = configuration.filter) !== null && _configuration$filter14 !== void 0 && _configuration$filter14.select)) {
19914
+ var _configuration$filter19;
19915
+ if (!((_configuration$filter19 = configuration.filter) !== null && _configuration$filter19 !== void 0 && _configuration$filter19.select)) {
19759
19916
  LOG$3.error('No global select filter defiend');
19760
19917
  return;
19761
19918
  }
19762
19919
  var newGlobalFilter = _objectSpread$g({}, globalFilter);
19763
- if (value != '') {
19920
+ if (value !== null && value !== void 0 && value.length) {
19764
19921
  newGlobalFilter.select = _defineProperty({}, configuration.filter.select.filterField, Array.isArray(value) ? value : [value]);
19765
19922
  } else {
19766
19923
  newGlobalFilter.select = {};
@@ -19771,8 +19928,8 @@ function useTableData (_ref) {
19771
19928
  }, filterData), newGlobalFilter);
19772
19929
  };
19773
19930
  var onGlobalFilterToggle = function onGlobalFilterToggle() {
19774
- var _configuration$filter15;
19775
- if (!((_configuration$filter15 = configuration.filter) !== null && _configuration$filter15 !== void 0 && _configuration$filter15.toggle)) {
19931
+ var _configuration$filter20;
19932
+ if (!((_configuration$filter20 = configuration.filter) !== null && _configuration$filter20 !== void 0 && _configuration$filter20.toggle)) {
19776
19933
  LOG$3.error('No global toggle filter defiend');
19777
19934
  return;
19778
19935
  }
@@ -19789,8 +19946,8 @@ function useTableData (_ref) {
19789
19946
  }, filterData), newGlobalFilter);
19790
19947
  };
19791
19948
  var onGlobalFilterSearch = function onGlobalFilterSearch(value) {
19792
- var _configuration$filter16;
19793
- if (!((_configuration$filter16 = configuration.filter) !== null && _configuration$filter16 !== void 0 && _configuration$filter16.search)) {
19949
+ var _configuration$filter21;
19950
+ if (!((_configuration$filter21 = configuration.filter) !== null && _configuration$filter21 !== void 0 && _configuration$filter21.search)) {
19794
19951
  LOG$3.error('No global search filter defiend');
19795
19952
  return;
19796
19953
  }
@@ -19798,8 +19955,8 @@ function useTableData (_ref) {
19798
19955
  search: {}
19799
19956
  });
19800
19957
  if (value) {
19801
- var _configuration$filter17;
19802
- (_configuration$filter17 = configuration.filter) === null || _configuration$filter17 === void 0 || _configuration$filter17.search.fields.forEach(function (f) {
19958
+ var _configuration$filter22;
19959
+ (_configuration$filter22 = configuration.filter) === null || _configuration$filter22 === void 0 || _configuration$filter22.search.fields.forEach(function (f) {
19803
19960
  if (typeof f == 'string') {
19804
19961
  newGlobalFilter.search[f] = [value, 'contains', 0];
19805
19962
  } else {
@@ -19813,8 +19970,8 @@ function useTableData (_ref) {
19813
19970
  }, filterData), newGlobalFilter);
19814
19971
  };
19815
19972
  var onGlobalFilterPeriod = function onGlobalFilterPeriod(from, to) {
19816
- var _configuration$filter18;
19817
- if (!((_configuration$filter18 = configuration.filter) !== null && _configuration$filter18 !== void 0 && _configuration$filter18.period)) {
19973
+ var _configuration$filter23;
19974
+ if (!((_configuration$filter23 = configuration.filter) !== null && _configuration$filter23 !== void 0 && _configuration$filter23.period)) {
19818
19975
  LOG$3.error('No global period filter defiend');
19819
19976
  return;
19820
19977
  }
@@ -20648,7 +20805,7 @@ var FilterBox = /*#__PURE__*/memo(function (_ref) {
20648
20805
  return /*#__PURE__*/jsxs("div", {
20649
20806
  children: [/*#__PURE__*/jsx(Typography.Text, {
20650
20807
  children: filter.title
20651
- }), /*#__PURE__*/jsx("br", {}), /*#__PURE__*/jsx(Select, {
20808
+ }), /*#__PURE__*/jsx("br", {}), /*#__PURE__*/jsx(Select$1, {
20652
20809
  mode: "single",
20653
20810
  apiInterface: filter.requestOptions,
20654
20811
  wholeData: _objectSpread$a(_objectSpread$a({}, state.filter), {}, {
@@ -21069,7 +21226,7 @@ var retailerChild = "retailer-child-5ll0K";
21069
21226
  var supplier = "supplier-8sm0I";
21070
21227
  var dealer = "dealer-xgnku";
21071
21228
  var association = "association-b8uVW";
21072
- var css_248z$7 = ".label-rYNbb {\n width: 225px;\n background-color: #fff;\n cursor: pointer;\n padding: 10px 15px;\n border-radius: 5px;\n display: flex;\n gap: 12px;\n flex-direction: column;\n font-weight: 500;\n}\n\n.not-clickable-wHc5V {\n cursor: inherit;\n color: grey;\n}\n\n.selected-34dYg {\n font-weight: 630;\n}\n\n.description-iFui2 {\n font-weight: 300;\n font-size: small;\n margin-top: -8px;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .org-tree-node-label .org-tree-node-label-inner {\n padding: 0;\n padding: initial;\n}\n\n.darkmode .org-tree-container {\n background-color: rgb(20, 20, 20);\n}\n\n.org-tree-container .org-tree-node-label .ant-btn-primary:disabled {\n border-color: #d9d9d9;\n color: rgba(0, 0, 0, 0.25);\n background-color: rgba(0, 0, 0, 0.04);\n}\n\n.retailer-YNzAh {\n border-bottom: #81c784 solid 5px;\n}\n\n.retailer-child-5ll0K {\n border-bottom: #c8e6c9 solid 5px;\n}\n\n.supplier-8sm0I {\n border-bottom: #ba68c8 solid 5px;\n}\n\n.dealer-xgnku {\n border-bottom: #e1bee7 solid 5px;\n}\n\n.association-b8uVW {\n border-bottom: #fff176 solid 5px;\n}\n";
21229
+ var css_248z$7 = ".label-rYNbb {\n width: 225px;\n background-color: #fff;\n cursor: pointer;\n padding: 10px 15px;\n border-radius: 5px;\n display: flex;\n gap: 12px;\n flex-direction: column;\n font-weight: 500;\n}\n\n.not-clickable-wHc5V {\n cursor: inherit;\n color: grey;\n}\n\n.selected-34dYg {\n font-weight: 630;\n}\n\n.description-iFui2 {\n font-weight: 300;\n font-size: small;\n margin-top: -8px;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .org-tree-node-label .org-tree-node-label-inner {\n padding: 0;\n padding: initial;\n}\n\n.darkmode .org-tree-container {\n background-color: rgb(20, 20, 20);\n}\n\n.org-tree-container .org-tree-node-label .ant-btn-default:disabled, .org-tree-container .org-tree-node-label .ant-btn-primary:disabled {\n border-color: #d9d9d9;\n color: rgba(0, 0, 0, 0.25);\n background-color: rgba(0, 0, 0, 0.04);\n}\n\n.retailer-YNzAh {\n border-bottom: #81c784 solid 5px;\n}\n\n.retailer-child-5ll0K {\n border-bottom: #c8e6c9 solid 5px;\n}\n\n.supplier-8sm0I {\n border-bottom: #ba68c8 solid 5px;\n}\n\n.dealer-xgnku {\n border-bottom: #e1bee7 solid 5px;\n}\n\n.association-b8uVW {\n border-bottom: #fff176 solid 5px;\n}\n";
21073
21230
  styleInject(css_248z$7);
21074
21231
 
21075
21232
  function getColorClass(data) {
@@ -21089,7 +21246,7 @@ function getColorClass(data) {
21089
21246
  }
21090
21247
  }
21091
21248
  var OrgItem = function OrgItem(_ref) {
21092
- var _data$description, _itemChain, _itemChain2, _data$children;
21249
+ var _data$description, _itemChain, _itemChain2, _data$children, _itemChain3, _configuration$additi;
21093
21250
  var data = _ref.data,
21094
21251
  itemChain = _ref.itemChain,
21095
21252
  configuration = _ref.configuration,
@@ -21120,7 +21277,7 @@ var OrgItem = function OrgItem(_ref) {
21120
21277
  }), /*#__PURE__*/jsx("div", {
21121
21278
  className: description$1,
21122
21279
  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, {
21280
+ }), configuration.createAction && data.writePermission && ((_itemChain = itemChain[itemChain.length - 1]) === null || _itemChain === void 0 ? void 0 : _itemChain.id) == data.id && /*#__PURE__*/jsx(ActionButton, {
21124
21281
  action: configuration.createAction,
21125
21282
  type: "Button",
21126
21283
  buttonType: "primary",
@@ -21136,7 +21293,7 @@ var OrgItem = function OrgItem(_ref) {
21136
21293
  setUpdate(update + 1);
21137
21294
  (_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
21295
  }
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, {
21296
+ }, "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
21297
  action: configuration.deleteAction,
21141
21298
  type: "Button",
21142
21299
  buttonType: "primary",
@@ -21154,7 +21311,23 @@ var OrgItem = function OrgItem(_ref) {
21154
21311
  setUpdate(update + 1);
21155
21312
  });
21156
21313
  }
21157
- }, "delete")]
21314
+ }, "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) {
21315
+ var _action$id;
21316
+ return /*#__PURE__*/jsx(ActionButton, {
21317
+ action: action,
21318
+ type: "Button",
21319
+ buttonType: "default",
21320
+ id: (_action$id = action.id) !== null && _action$id !== void 0 ? _action$id : i.toString(),
21321
+ mappingData: data,
21322
+ defaultLabel: "",
21323
+ data: data,
21324
+ callback: function callback() {
21325
+ var _action$callback;
21326
+ setUpdate(update + 1);
21327
+ action === null || action === void 0 || (_action$callback = action.callback) === null || _action$callback === void 0 || _action$callback.call(action, data);
21328
+ }
21329
+ }, action.id);
21330
+ }))]
21158
21331
  }, data.id);
21159
21332
  };
21160
21333
  var OrgItem$1 = observer(OrgItem);
@@ -21287,7 +21460,7 @@ var openClass = "open-class--gGXs";
21287
21460
  var breadcrumb = "breadcrumb-Z0VvH";
21288
21461
  var selected = "selected-w-sfW";
21289
21462
  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";
21463
+ 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
21464
  styleInject(css_248z$6);
21292
21465
 
21293
21466
  var BreadCrumbsTrigger = function BreadCrumbsTrigger(_ref) {
@@ -21373,33 +21546,103 @@ var Legend = function Legend(props) {
21373
21546
  };
21374
21547
 
21375
21548
  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";
21549
+ var mask = "mask-ssagp";
21550
+ var transformWrapper = "transform-wrapper--8t0v";
21551
+ 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
21552
  styleInject(css_248z$4);
21378
21553
 
21379
21554
  var ZoomWrapper = function ZoomWrapper(_ref) {
21380
21555
  var _children = _ref.children,
21381
- zoomToId = _ref.zoomToId;
21556
+ zoomToId = _ref.zoomToId,
21557
+ onInitialized = _ref.onInitialized;
21382
21558
  var transformComponentRef = useRef(null);
21383
21559
  var _useState = useState(true),
21384
21560
  _useState2 = _slicedToArray(_useState, 2),
21385
21561
  isInit = _useState2[0],
21386
21562
  setIsInit = _useState2[1];
21563
+ var _useState3 = useState(false),
21564
+ _useState4 = _slicedToArray(_useState3, 2),
21565
+ isGrapping = _useState4[0],
21566
+ setIsGrapping = _useState4[1];
21567
+ var _useState5 = useState(false),
21568
+ _useState6 = _slicedToArray(_useState5, 2),
21569
+ isZooming = _useState6[0],
21570
+ setIsZooming = _useState6[1];
21571
+ var _useState7 = useState(false),
21572
+ _useState8 = _slicedToArray(_useState7, 2),
21573
+ showModal = _useState8[0],
21574
+ setShowModal = _useState8[1];
21575
+ var _useState9 = useState(false),
21576
+ _useState10 = _slicedToArray(_useState9, 2),
21577
+ focused = _useState10[0],
21578
+ setFocused = _useState10[1];
21579
+ var _useTranslation = useTranslation$1(),
21580
+ t = _useTranslation.t;
21581
+ var zoomToImage = useCallback(function (id) {
21582
+ if (transformComponentRef.current) {
21583
+ var zoomToElement = transformComponentRef.current.zoomToElement;
21584
+ zoomToElement(id, 1, 700, 'easeOut');
21585
+ }
21586
+ }, []);
21387
21587
  useEffect(function () {
21388
21588
  if (!zoomToId) return;
21389
21589
  if (isInit) {
21390
21590
  setIsInit(false);
21391
21591
  setTimeout(function () {
21392
21592
  zoomToImage(zoomToId);
21593
+ onInitialized();
21393
21594
  }, 300);
21394
21595
  }
21395
21596
  zoomToImage(zoomToId);
21396
21597
  }, [zoomToId]);
21397
- var zoomToImage = function zoomToImage(id) {
21398
- if (transformComponentRef.current) {
21399
- var zoomToElement = transformComponentRef.current.zoomToElement;
21400
- zoomToElement(id, 1, 700, 'easeOut');
21598
+ var onKeyDown = useCallback(function (e) {
21599
+ if (e.key === 'Shift') {
21600
+ setIsZooming(true);
21401
21601
  }
21402
- };
21602
+ }, []);
21603
+ var onKeyUp = useCallback(function (e) {
21604
+ if (e.key === 'Shift') {
21605
+ setIsZooming(false);
21606
+ }
21607
+ }, []);
21608
+ var wheelEventTimout;
21609
+ var onScrolling = useCallback(function () {
21610
+ if (!isZooming) {
21611
+ clearTimeout(wheelEventTimout);
21612
+ setShowModal(true);
21613
+ wheelEventTimout = setTimeout(function () {
21614
+ setShowModal(false);
21615
+ }, 2000);
21616
+ }
21617
+ }, [isZooming]);
21618
+ var onMouseEnter = useCallback(function () {
21619
+ setFocused(true);
21620
+ }, [onScrolling]);
21621
+ var onMouseLeave = useCallback(function () {
21622
+ setFocused(false);
21623
+ }, [onScrolling]);
21624
+ var onMouseDown = useCallback(function () {
21625
+ setIsGrapping(true);
21626
+ }, []);
21627
+ var onMouseUp = useCallback(function () {
21628
+ setIsGrapping(false);
21629
+ }, []);
21630
+ useEffect(function () {
21631
+ if (focused) {
21632
+ window.addEventListener('keydown', onKeyDown);
21633
+ window.addEventListener('keyup', onKeyUp);
21634
+ window.addEventListener('wheel', onScrolling);
21635
+ } else {
21636
+ window.removeEventListener('keydown', onKeyDown);
21637
+ window.removeEventListener('keyup', onKeyUp);
21638
+ window.removeEventListener('wheel', onScrolling);
21639
+ }
21640
+ return function () {
21641
+ window.removeEventListener('keydown', onKeyDown);
21642
+ window.removeEventListener('keyup', onKeyUp);
21643
+ window.removeEventListener('wheel', onScrolling);
21644
+ };
21645
+ }, [onScrolling, focused]);
21403
21646
  return /*#__PURE__*/jsx(TransformWrapper, {
21404
21647
  ref: transformComponentRef,
21405
21648
  pinch: {
@@ -21409,7 +21652,8 @@ var ZoomWrapper = function ZoomWrapper(_ref) {
21409
21652
  minScale: 0.2,
21410
21653
  wheel: {
21411
21654
  smoothStep: 0.001,
21412
- step: 0.2
21655
+ step: 0.2,
21656
+ activationKeys: ['Shift']
21413
21657
  },
21414
21658
  children: function children(_ref2) {
21415
21659
  var zoomIn = _ref2.zoomIn,
@@ -21445,11 +21689,26 @@ var ZoomWrapper = function ZoomWrapper(_ref) {
21445
21689
  }),
21446
21690
  size: 'small'
21447
21691
  })]
21692
+ }), showModal && /*#__PURE__*/jsx("div", {
21693
+ className: mask,
21694
+ children: /*#__PURE__*/jsx("p", {
21695
+ children: t('backoffice.orgtree.zoomwrapper.zoominfo')
21696
+ })
21448
21697
  }), /*#__PURE__*/jsx(TransformComponent, {
21449
21698
  wrapperStyle: {
21450
- width: '100%'
21699
+ width: '100%',
21700
+ cursor: isZooming ? 'nesw-resize' : isGrapping ? 'grabbing' : 'grab'
21701
+ },
21702
+ wrapperProps: {
21703
+ onMouseEnter: onMouseEnter,
21704
+ onMouseLeave: onMouseLeave,
21705
+ onMouseDown: onMouseDown,
21706
+ onMouseUp: onMouseUp
21451
21707
  },
21452
- children: _children
21708
+ wrapperClass: transformWrapper,
21709
+ children: /*#__PURE__*/jsx(Fragment, {
21710
+ children: _children
21711
+ })
21453
21712
  })]
21454
21713
  });
21455
21714
  }
@@ -21465,7 +21724,7 @@ var SearchSelect = function SearchSelect(_ref) {
21465
21724
  var _root$dataStore;
21466
21725
  root === null || root === void 0 || (_root$dataStore = root.dataStore) === null || _root$dataStore === void 0 || _root$dataStore.setSelectedOrganizationId(value);
21467
21726
  };
21468
- return /*#__PURE__*/jsx(Select$1, {
21727
+ return /*#__PURE__*/jsx(Select$2, {
21469
21728
  showSearch: true,
21470
21729
  placeholder: t('filter.global'),
21471
21730
  allowClear: true,
@@ -21507,12 +21766,13 @@ var OrgTreeComponent = function OrgTreeComponent(_ref) {
21507
21766
  breadcrumbs: itemChain,
21508
21767
  open: open
21509
21768
  }),
21510
- onOpen: function onOpen() {
21769
+ onTriggerOpening: function onTriggerOpening() {
21511
21770
  return setOpen(true);
21512
21771
  },
21513
- onClose: function onClose() {
21772
+ onTriggerClosing: function onTriggerClosing() {
21514
21773
  return setOpen(false);
21515
21774
  },
21775
+ open: open,
21516
21776
  children: [/*#__PURE__*/jsxs("div", {
21517
21777
  className: toolbarLeft,
21518
21778
  children: [/*#__PURE__*/jsx(SearchSelect, {
@@ -21530,6 +21790,9 @@ var OrgTreeComponent = function OrgTreeComponent(_ref) {
21530
21790
  })]
21531
21791
  }), /*#__PURE__*/jsx(ZoomWrapper, {
21532
21792
  zoomToId: zoomToId,
21793
+ onInitialized: function onInitialized() {
21794
+ return setOpen(true);
21795
+ },
21533
21796
  children: /*#__PURE__*/jsx(OrgTree, {
21534
21797
  data: data,
21535
21798
  horizontal: !!configuration.horizontal,
@@ -23981,7 +24244,7 @@ var DropDown = function DropDown(_ref) {
23981
24244
  }, item.item._id);
23982
24245
  };
23983
24246
 
23984
- var Option = Select$1.Option;
24247
+ var Option = Select$2.Option;
23985
24248
  var RelationSelector = function RelationSelector(_ref, ref) {
23986
24249
  var _relationState$config, _relationState$config2, _relationState$config3, _searchPlaceholder;
23987
24250
  var id = _ref.id,
@@ -24007,7 +24270,7 @@ var RelationSelector = function RelationSelector(_ref, ref) {
24007
24270
  relationState.searchItems('');
24008
24271
  }, []);
24009
24272
  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, {
24273
+ 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
24274
  className: select,
24012
24275
  showSearch: true,
24013
24276
  suffixIcon: /*#__PURE__*/jsx(PlusSquareOutlined, {}),