@dartech/arsenal-ui 1.3.68 → 1.3.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -38,7 +38,7 @@ import { format, isMatch, isValid, parse } from 'date-fns';
38
38
  import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
39
39
  import { TimePicker } from '@mui/x-date-pickers/TimePicker';
40
40
  import Chip from '@mui/material/Chip';
41
- import Grid from '@mui/material/Unstable_Grid2/Grid2';
41
+ import Grid from '@mui/material/Unstable_Grid2';
42
42
  import { toString, parse as parse$1 } from 'duration-fns';
43
43
  import Pagination from '@mui/material/Pagination';
44
44
  import MuiTablePagination from '@mui/material/TablePagination';
@@ -57,7 +57,6 @@ import MoreHorizIcon from '@mui/icons-material/MoreHoriz';
57
57
  import Paper from '@mui/material/Paper';
58
58
  import Tab from '@mui/material/Tab';
59
59
  import Tabs from '@mui/material/Tabs';
60
- import Grid$1 from '@mui/material/Unstable_Grid2';
61
60
  import Accordion from '@mui/material/Accordion';
62
61
  import AccordionSummary from '@mui/material/AccordionSummary';
63
62
  import AccordionDetails from '@mui/material/AccordionDetails';
@@ -71,10 +70,11 @@ import StepContent from '@mui/material/StepContent';
71
70
  import StepConnector from '@mui/material/StepConnector';
72
71
  import Select from '@mui/material/Select';
73
72
  import InputLabel from '@mui/material/InputLabel';
73
+ import { toast } from 'react-toastify';
74
+ import axios from 'axios';
74
75
  import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
75
76
  import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
76
77
  import classnames from 'classnames';
77
- import { toast } from 'react-toastify';
78
78
  import CssBaseline from '@mui/material/CssBaseline';
79
79
  import MuiDrawer from '@mui/material/Drawer';
80
80
  import MuiList from '@mui/material/List';
@@ -1218,7 +1218,6 @@ const JsonView = /*#__PURE__*/forwardRef(({
1218
1218
  const [loading, setLoading] = useState(true);
1219
1219
  const onCreateEditor = useCallback(view => {
1220
1220
  const onScroll = e => {
1221
- console.log();
1222
1221
  if (view.scrollDOM.scrollHeight - view.scrollDOM.offsetHeight - e.target.scrollTop < 10) {
1223
1222
  setTimeout(() => view.scrollDOM.scrollTo(0, 0), 200);
1224
1223
  }
@@ -3132,7 +3131,7 @@ const BigDecimalPropertyFields = ({
3132
3131
  control
3133
3132
  } = useFormContext();
3134
3133
  return jsxs(Fragment, {
3135
- children: [jsx(Grid$1, {
3134
+ children: [jsx(Grid, {
3136
3135
  children: jsx(ControlNumberInput, {
3137
3136
  required: true,
3138
3137
  control: control,
@@ -3140,7 +3139,7 @@ const BigDecimalPropertyFields = ({
3140
3139
  name: `${propertyFieldName}.precisionScale`,
3141
3140
  label: "Precision Scale"
3142
3141
  })
3143
- }), jsx(Grid$1, {
3142
+ }), jsx(Grid, {
3144
3143
  children: jsx(ControlSelect, {
3145
3144
  required: true,
3146
3145
  control: control,
@@ -3161,7 +3160,7 @@ const DateAdditionalFields = ({
3161
3160
  const {
3162
3161
  control
3163
3162
  } = useFormContext();
3164
- return jsx(Grid$1, {
3163
+ return jsx(Grid, {
3165
3164
  children: jsx(ControlInput, {
3166
3165
  required: true,
3167
3166
  control: control,
@@ -3306,17 +3305,17 @@ const EntityAdditionalFields = ({
3306
3305
  }
3307
3306
  });
3308
3307
  return jsxs(Fragment, {
3309
- children: [jsx(Grid$1, {
3308
+ children: [jsx(Grid, {
3310
3309
  children: jsx(Typography, Object.assign({
3311
3310
  variant: "h6"
3312
3311
  }, {
3313
3312
  children: "Properties"
3314
3313
  }))
3315
- }), jsx(Grid$1, {
3314
+ }), jsx(Grid, {
3316
3315
  children: jsx(EntityPropertiesShortView$1, {
3317
3316
  properties: properties
3318
3317
  })
3319
- }), jsx(Grid$1, {
3318
+ }), jsx(Grid, {
3320
3319
  children: jsx(Button, Object.assign({
3321
3320
  variant: "contained",
3322
3321
  color: "primary",
@@ -3339,7 +3338,7 @@ const EntityAdditionalFields = ({
3339
3338
  overflow: 'hidden'
3340
3339
  }
3341
3340
  }, {
3342
- children: jsxs(Grid$1, Object.assign({
3341
+ children: jsxs(Grid, Object.assign({
3343
3342
  container: true,
3344
3343
  direction: "row",
3345
3344
  spacing: 2,
@@ -3347,7 +3346,7 @@ const EntityAdditionalFields = ({
3347
3346
  height: '100%'
3348
3347
  }
3349
3348
  }, {
3350
- children: [jsxs(Grid$1, Object.assign({
3349
+ children: [jsxs(Grid, Object.assign({
3351
3350
  xs: 3,
3352
3351
  style: {
3353
3352
  backgroundColor: '#f9f9f9',
@@ -3388,7 +3387,7 @@ const EntityAdditionalFields = ({
3388
3387
  }, {
3389
3388
  children: "Add property"
3390
3389
  }))]
3391
- })), jsx(Grid$1, Object.assign({
3390
+ })), jsx(Grid, Object.assign({
3392
3391
  container: true,
3393
3392
  wrap: "nowrap",
3394
3393
  direction: "column",
@@ -3422,35 +3421,72 @@ const EntityAdditionalFields = ({
3422
3421
  };
3423
3422
  var EntityAdditionalFields$1 = EntityAdditionalFields;
3424
3423
 
3424
+ const sources = [{
3425
+ label: 'Arsenal',
3426
+ value: 'ARSENAL'
3427
+ }, {
3428
+ label: 'Scalend',
3429
+ value: 'SCALEND'
3430
+ }];
3431
+ const modules = [{
3432
+ label: 'Customers',
3433
+ value: 'CUSTOMERS'
3434
+ }, {
3435
+ label: 'Products',
3436
+ value: 'PRODUCTS'
3437
+ }, {
3438
+ label: 'Pledges',
3439
+ value: 'PLEDGES'
3440
+ }];
3425
3441
  const EntityReferencePropertyFields = ({
3426
3442
  propertyFieldName
3427
3443
  }) => {
3428
3444
  const {
3429
3445
  control
3430
3446
  } = useFormContext();
3447
+ const source = useWatch({
3448
+ control,
3449
+ name: `${propertyFieldName}.source`
3450
+ });
3431
3451
  return jsxs(Fragment, {
3432
- children: [jsx(Grid$1, {
3433
- children: jsx(ControlInput, {
3452
+ children: [jsx(Grid, {
3453
+ children: jsx(ControlSelect, {
3454
+ required: true,
3455
+ control: control,
3456
+ name: `${propertyFieldName}.source`,
3457
+ label: "Source",
3458
+ options: sources
3459
+ })
3460
+ }), source && jsx(Grid, {
3461
+ children: source === 'ARSENAL' ? jsx(ControlInput, {
3434
3462
  required: true,
3435
3463
  control: control,
3436
3464
  name: `${propertyFieldName}.definitionCode`,
3437
3465
  label: "Definition Code"
3466
+ }) : jsx(ControlSelect, {
3467
+ required: true,
3468
+ control: control,
3469
+ name: `${propertyFieldName}.definitionCode`,
3470
+ label: "Definition Code",
3471
+ valueKey: "value",
3472
+ options: modules
3438
3473
  })
3439
- }), jsx(Grid$1, {
3474
+ }), jsx(Grid, {
3440
3475
  children: jsx(ControlInput, {
3441
3476
  required: true,
3442
3477
  control: control,
3443
3478
  name: `${propertyFieldName}.definitionVersion`,
3444
- label: "Definition Version"
3479
+ label: "Definition Version",
3480
+ defaultValue: 1
3445
3481
  })
3446
- }), jsx(Grid$1, {
3482
+ }), jsx(Grid, {
3447
3483
  children: jsx(ControlInput, {
3448
3484
  required: true,
3449
3485
  control: control,
3450
3486
  name: `${propertyFieldName}.labelPropertyCode`,
3451
3487
  label: "Label Property Code"
3452
3488
  })
3453
- }), jsx(Grid$1, {
3489
+ }), jsx(Grid, {
3454
3490
  children: jsx(ControlInput, {
3455
3491
  required: true,
3456
3492
  control: control,
@@ -3504,13 +3540,13 @@ const StringPropertyFields = ({
3504
3540
  }
3505
3541
  };
3506
3542
  return jsxs(Fragment, {
3507
- children: [jsx(Grid$1, {
3543
+ children: [jsx(Grid, {
3508
3544
  children: jsx(Typography, Object.assign({
3509
3545
  variant: "h6"
3510
3546
  }, {
3511
3547
  children: "Restricted Values"
3512
3548
  }))
3513
- }), !!(restrictedValues === null || restrictedValues === void 0 ? void 0 : restrictedValues.length) && jsx(Grid$1, {
3549
+ }), !!(restrictedValues === null || restrictedValues === void 0 ? void 0 : restrictedValues.length) && jsx(Grid, {
3514
3550
  children: jsx(Box, Object.assign({
3515
3551
  display: "flex",
3516
3552
  flexWrap: "wrap"
@@ -3524,7 +3560,7 @@ const StringPropertyFields = ({
3524
3560
  onDelete: () => handleDelete(index)
3525
3561
  }, index))
3526
3562
  }))
3527
- }), jsx(Grid$1, {
3563
+ }), jsx(Grid, {
3528
3564
  children: jsx(TextField, {
3529
3565
  fullWidth: true,
3530
3566
  variant: "outlined",
@@ -3663,12 +3699,138 @@ const StringValueField = ({
3663
3699
  };
3664
3700
  var StringValueField$1 = StringValueField;
3665
3701
 
3702
+ function useEntitiesService({
3703
+ baseURL
3704
+ }) {
3705
+ const entitiesInstance = axios.create({
3706
+ baseURL: baseURL
3707
+ });
3708
+ const getEntitiesByCodeAndVersion = ({
3709
+ definitionCode,
3710
+ definitionVersion
3711
+ }) => __awaiter(this, void 0, void 0, function* () {
3712
+ const response = yield entitiesInstance.get(`/entities/code/${definitionCode}/version/${definitionVersion}`);
3713
+ console.log(response);
3714
+ return response.data;
3715
+ });
3716
+ const getCustomerApplications = params => __awaiter(this, void 0, void 0, function* () {
3717
+ const response = yield entitiesInstance.get('/customer-application-instances', {
3718
+ params
3719
+ });
3720
+ return response.data['collection'];
3721
+ });
3722
+ const getProducts = params => __awaiter(this, void 0, void 0, function* () {
3723
+ const response = yield entitiesInstance.get('/products', {
3724
+ params
3725
+ });
3726
+ return response.data['collection'];
3727
+ });
3728
+ const getPledgeInstances = params => __awaiter(this, void 0, void 0, function* () {
3729
+ const response = yield entitiesInstance.get('/pledge-instances', {
3730
+ params
3731
+ });
3732
+ return response.data['collection'];
3733
+ });
3734
+ return {
3735
+ getEntitiesByCodeAndVersion,
3736
+ getCustomerApplications,
3737
+ getProducts,
3738
+ getPledgeInstances
3739
+ };
3740
+ }
3741
+
3742
+ const EntityReferenceValueField = ({
3743
+ name,
3744
+ required: _required = false,
3745
+ definitionProperty,
3746
+ baseURL: _baseURL = 'https://dev-sl-api.dar-dev.zone/api/v1'
3747
+ }) => {
3748
+ const {
3749
+ control
3750
+ } = useFormContext();
3751
+ const {
3752
+ source,
3753
+ definitionCode,
3754
+ definitionVersion,
3755
+ valuePropertyCode,
3756
+ labelPropertyCode
3757
+ } = definitionProperty;
3758
+ const {
3759
+ getCustomerApplications,
3760
+ getEntitiesByCodeAndVersion,
3761
+ getPledgeInstances,
3762
+ getProducts
3763
+ } = useEntitiesService({
3764
+ baseURL: _baseURL
3765
+ });
3766
+ const [loading, setLoading] = useState(false);
3767
+ const [referredInstancesValues, setReferredInstancesValues] = useState([]);
3768
+ const scalendCallback = useMemo(() => {
3769
+ if (source === 'SCALEND') {
3770
+ switch (definitionCode) {
3771
+ case 'CUSTOMERS':
3772
+ return getCustomerApplications;
3773
+ case 'PLEDGES':
3774
+ return getPledgeInstances;
3775
+ case 'PRODUCTS':
3776
+ return getProducts;
3777
+ default:
3778
+ return null;
3779
+ }
3780
+ }
3781
+ return null;
3782
+ }, [definitionCode, source]);
3783
+ useEffect(() => {
3784
+ if (definitionCode && definitionVersion) {
3785
+ setLoading(true);
3786
+ if (source === 'ARSENAL') {
3787
+ getEntitiesByCodeAndVersion({
3788
+ definitionCode,
3789
+ definitionVersion
3790
+ }).then(instances => {
3791
+ const instanceValues = instances.map(instance => instance['data'][`${valuePropertyCode}`]);
3792
+ setReferredInstancesValues(instanceValues);
3793
+ }).catch(error => {
3794
+ setReferredInstancesValues([]);
3795
+ toast.error(error);
3796
+ }).finally(() => {
3797
+ setLoading(false);
3798
+ });
3799
+ } else if (source === 'SCALEND') {
3800
+ scalendCallback().then(instances => {
3801
+ const instanceValues = instances.map(instance => instance.id);
3802
+ setReferredInstancesValues(instanceValues);
3803
+ }).catch(error => {
3804
+ setReferredInstancesValues([]);
3805
+ toast.error(error);
3806
+ }).finally(() => {
3807
+ setLoading(false);
3808
+ });
3809
+ }
3810
+ }
3811
+ }, [definitionCode, definitionVersion, valuePropertyCode, source, labelPropertyCode, scalendCallback]);
3812
+ return jsx(Grid, {
3813
+ children: jsx(ControlAutocomplete, {
3814
+ required: _required,
3815
+ control: control,
3816
+ name: source === 'SCALEND' ? name : `${name}.${labelPropertyCode}`,
3817
+ label: labelPropertyCode,
3818
+ labelKey: labelPropertyCode,
3819
+ valueKey: valuePropertyCode,
3820
+ loading: loading,
3821
+ options: referredInstancesValues
3822
+ })
3823
+ });
3824
+ };
3825
+ var EntityReferenceValueField$1 = EntityReferenceValueField;
3826
+
3666
3827
  const PropertyWidget = ({
3667
3828
  property,
3668
3829
  name,
3669
3830
  label,
3670
3831
  useExpression,
3671
- control
3832
+ control,
3833
+ baseURL
3672
3834
  }) => {
3673
3835
  const propertyType = useMemo(() => typeof property.propertyType === 'string' ? property.propertyType : property['propertyType']['value'], [property]);
3674
3836
  switch (propertyType) {
@@ -3750,14 +3912,13 @@ const PropertyWidget = ({
3750
3912
  restrictedValues: property.restrictedValues
3751
3913
  });
3752
3914
  case PropertyType.ENTITY_REFERENCE:
3753
- return jsx(ControlInput
3915
+ return jsx(EntityReferenceValueField$1
3754
3916
  // required
3755
3917
  , {
3756
3918
  // required
3757
- hideErrorMessage: true,
3758
3919
  name: name,
3759
- label: label,
3760
- control: control
3920
+ definitionProperty: property,
3921
+ baseURL: baseURL
3761
3922
  });
3762
3923
  case PropertyType.ANY:
3763
3924
  return jsx(ControlAceEditor, {
@@ -3876,7 +4037,8 @@ const PropertyFiller = ({
3876
4037
  useExpression,
3877
4038
  label,
3878
4039
  required,
3879
- title
4040
+ title,
4041
+ baseURL
3880
4042
  }) => {
3881
4043
  const {
3882
4044
  control,
@@ -3969,7 +4131,7 @@ const PropertyFiller = ({
3969
4131
  setValue(name, defaultProperyValue);
3970
4132
  }
3971
4133
  }, [value, setValue, defaultProperyValue, property, name]);
3972
- return jsxs(Grid$1, Object.assign({
4134
+ return jsxs(Grid, Object.assign({
3973
4135
  xs: 12
3974
4136
  }, {
3975
4137
  children: [title && jsx(Box, Object.assign({
@@ -4032,7 +4194,8 @@ const PropertyFiller = ({
4032
4194
  property: property,
4033
4195
  name: name,
4034
4196
  useExpression: useExpression,
4035
- label: valueLabel
4197
+ label: valueLabel,
4198
+ baseURL: baseURL
4036
4199
  }), fillOption === 'dem_builder' && jsx(CreateDefinition, {
4037
4200
  title: "JSON",
4038
4201
  definitionFieldName: name
@@ -4096,7 +4259,8 @@ const MultiplePropertyWidget = ({
4096
4259
  property,
4097
4260
  useExpression,
4098
4261
  required,
4099
- label
4262
+ label,
4263
+ baseURL
4100
4264
  }) => {
4101
4265
  const {
4102
4266
  control,
@@ -4118,13 +4282,13 @@ const MultiplePropertyWidget = ({
4118
4282
  const handleDeleteValue = useCallback(index => {
4119
4283
  setValue(name, removeArrayItem(values, index));
4120
4284
  }, [name, values, setValue]);
4121
- return jsxs(Grid$1, Object.assign({
4285
+ return jsxs(Grid, Object.assign({
4122
4286
  container: true,
4123
4287
  spacing: 2,
4124
4288
  direction: "column",
4125
4289
  xs: 12
4126
4290
  }, {
4127
- children: [Array.isArray(values) && values.length ? values.map((value, index) => jsx(Grid$1, Object.assign({
4291
+ children: [Array.isArray(values) && values.length ? values.map((value, index) => jsx(Grid, Object.assign({
4128
4292
  xs: 12
4129
4293
  }, {
4130
4294
  children: jsxs(Box, Object.assign({
@@ -4141,12 +4305,14 @@ const MultiplePropertyWidget = ({
4141
4305
  property: property,
4142
4306
  useExpression: useExpression,
4143
4307
  name: `${name}.${index}`,
4144
- label: `${label || property.name} (${index + 1})`
4308
+ label: `${label || property.name} (${index + 1})`,
4309
+ baseURL: baseURL
4145
4310
  }), jsx(Box, Object.assign({
4146
4311
  mt: "8px",
4147
4312
  ml: "4px"
4148
4313
  }, {
4149
4314
  children: jsx(IconButton, Object.assign({
4315
+ id: "close-button",
4150
4316
  size: "small",
4151
4317
  onClick: () => handleDeleteValue(index)
4152
4318
  }, {
@@ -4160,7 +4326,7 @@ const MultiplePropertyWidget = ({
4160
4326
  }))
4161
4327
  }))]
4162
4328
  }))
4163
- }), index)) : null, jsx(Grid$1, {
4329
+ }), index)) : null, jsx(Grid, {
4164
4330
  children: jsx(Button, Object.assign({
4165
4331
  variant: "contained",
4166
4332
  size: "small",
@@ -4180,7 +4346,8 @@ const MultiplePropertyFiller = ({
4180
4346
  useExpression,
4181
4347
  required,
4182
4348
  label,
4183
- title
4349
+ title,
4350
+ baseURL
4184
4351
  }) => {
4185
4352
  var _a;
4186
4353
  const [selectTouched, setSelectTouched] = useState(false);
@@ -4251,7 +4418,7 @@ const MultiplePropertyFiller = ({
4251
4418
  checkFillOption();
4252
4419
  }
4253
4420
  }, [checkFillOption, selectTouched, value]);
4254
- return jsxs(Grid$1, {
4421
+ return jsxs(Grid, {
4255
4422
  children: [title && jsx(Box, Object.assign({
4256
4423
  mb: 2
4257
4424
  }, {
@@ -4304,7 +4471,8 @@ const MultiplePropertyFiller = ({
4304
4471
  name: name,
4305
4472
  useExpression: useExpression,
4306
4473
  required: required,
4307
- label: label
4474
+ label: label,
4475
+ baseURL: baseURL
4308
4476
  }), error && jsx(FormHelperText, Object.assign({
4309
4477
  error: true
4310
4478
  }, {
@@ -4815,26 +4983,26 @@ const CreatePropertyFormFields = ({
4815
4983
  setValue(`${propertyFieldName}.propertyType`, propertyTypes.find(el => el.value === propertyType));
4816
4984
  }
4817
4985
  }, [propertyType, setValue, propertyFieldName]);
4818
- return jsxs(Grid$1, Object.assign({
4986
+ return jsxs(Grid, Object.assign({
4819
4987
  container: true,
4820
4988
  direction: "column",
4821
4989
  spacing: 2
4822
4990
  }, {
4823
- children: [jsx(Grid$1, {
4991
+ children: [jsx(Grid, {
4824
4992
  children: jsx(ControlInput, {
4825
4993
  required: true,
4826
4994
  control: control,
4827
4995
  name: `${propertyFieldName}.key`,
4828
4996
  label: "Key"
4829
4997
  })
4830
- }), jsx(Grid$1, {
4998
+ }), jsx(Grid, {
4831
4999
  children: jsx(ControlInput, {
4832
5000
  required: true,
4833
5001
  control: control,
4834
5002
  name: `${propertyFieldName}.name`,
4835
5003
  label: "Name"
4836
5004
  })
4837
- }), jsx(Grid$1, {
5005
+ }), jsx(Grid, {
4838
5006
  children: jsx(ControlAutocomplete, {
4839
5007
  required: true,
4840
5008
  control: control,
@@ -4843,21 +5011,21 @@ const CreatePropertyFormFields = ({
4843
5011
  options: propertyTypes,
4844
5012
  onChange: handlePropertyTypeChange
4845
5013
  })
4846
- }), jsx(Grid$1, {
5014
+ }), jsx(Grid, {
4847
5015
  children: jsx(ControlNumberInput, {
4848
5016
  required: true,
4849
5017
  control: control,
4850
5018
  name: `${propertyFieldName}.sortOrder`,
4851
5019
  label: "Sort Order"
4852
5020
  })
4853
- }), jsx(Grid$1, {
5021
+ }), jsx(Grid, {
4854
5022
  children: jsx(ControlAceEditor, {
4855
5023
  control: control,
4856
5024
  name: `${propertyFieldName}.uiSettings`,
4857
5025
  label: "UI Settings",
4858
5026
  validateJson: true
4859
5027
  })
4860
- }), jsxs(Grid$1, {
5028
+ }), jsxs(Grid, {
4861
5029
  children: [jsx(ControlCheckbox, {
4862
5030
  control: control,
4863
5031
  name: `${propertyFieldName}.isMultiple`,
@@ -4884,7 +5052,7 @@ const CreatePropertyFormFields = ({
4884
5052
  }, index))
4885
5053
  }) : null]
4886
5054
  }), propertyType && jsxs(Fragment, {
4887
- children: [jsx(Grid$1, {
5055
+ children: [jsx(Grid, {
4888
5056
  children: jsx(PropertyValidatorContext.Provider, Object.assign({
4889
5057
  value: (_a = propertyType.value) !== null && _a !== void 0 ? _a : propertyType
4890
5058
  }, {
@@ -4904,7 +5072,7 @@ const CreatePropertyFormFields = ({
4904
5072
  required: _globalParameter ? isRequired : false
4905
5073
  })]
4906
5074
  }), customFields.length ? jsx(Fragment, {
4907
- children: customFields.map((field, index) => jsx(Grid$1, {
5075
+ children: customFields.map((field, index) => jsx(Grid, {
4908
5076
  children: jsx(CustomPropertyField$1, Object.assign({}, field, {
4909
5077
  propertyFieldName: propertyFieldName
4910
5078
  }))
@@ -4977,7 +5145,7 @@ const CreatePropertiesList = ({
4977
5145
  setValue(`${fieldName}`, removeArrayItem(properties, index));
4978
5146
  }, [properties, fieldName, setValue]);
4979
5147
  return jsxs(Fragment, {
4980
- children: [error && error.message && jsx(Grid$1, Object.assign({
5148
+ children: [error && error.message && jsx(Grid, Object.assign({
4981
5149
  sm: 12
4982
5150
  }, {
4983
5151
  children: jsx(Typography, Object.assign({
@@ -4985,7 +5153,7 @@ const CreatePropertiesList = ({
4985
5153
  }, {
4986
5154
  children: error.message
4987
5155
  }))
4988
- })), Array.isArray(properties) && properties.map((property, index) => jsx(Grid$1, Object.assign({
5156
+ })), Array.isArray(properties) && properties.map((property, index) => jsx(Grid, Object.assign({
4989
5157
  sm: 12,
4990
5158
  ref: ref => refs.current[index] = ref
4991
5159
  }, {
@@ -5022,7 +5190,7 @@ const CreatePropertiesList = ({
5022
5190
  }))
5023
5191
  })]
5024
5192
  }))
5025
- }), index)), !hideAddButton && jsx(Grid$1, Object.assign({
5193
+ }), index)), !hideAddButton && jsx(Grid, Object.assign({
5026
5194
  xs: 12
5027
5195
  }, {
5028
5196
  children: jsx(Button, Object.assign({
@@ -5048,12 +5216,12 @@ const CreateDefinition = ({
5048
5216
  const {
5049
5217
  control
5050
5218
  } = useFormContext();
5051
- return jsxs(Grid$1, Object.assign({
5219
+ return jsxs(Grid, Object.assign({
5052
5220
  container: true,
5053
5221
  direction: "column",
5054
5222
  spacing: 2
5055
5223
  }, {
5056
- children: [title && jsx(Grid$1, Object.assign({
5224
+ children: [title && jsx(Grid, Object.assign({
5057
5225
  sm: 12
5058
5226
  }, {
5059
5227
  children: jsx(Box, Object.assign({
@@ -5065,7 +5233,7 @@ const CreateDefinition = ({
5065
5233
  children: title
5066
5234
  }))
5067
5235
  }))
5068
- })), !hideNameField && jsx(Grid$1, Object.assign({
5236
+ })), !hideNameField && jsx(Grid, Object.assign({
5069
5237
  sm: 12
5070
5238
  }, {
5071
5239
  children: jsx(ControlInput, {
@@ -5074,7 +5242,7 @@ const CreateDefinition = ({
5074
5242
  name: definitionFieldName ? `${definitionFieldName}.name` : `name`,
5075
5243
  label: "Name"
5076
5244
  })
5077
- })), !hideCodeField && jsx(Grid$1, Object.assign({
5245
+ })), !hideCodeField && jsx(Grid, Object.assign({
5078
5246
  sm: 12
5079
5247
  }, {
5080
5248
  children: jsx(ControlInput, {
@@ -5083,7 +5251,7 @@ const CreateDefinition = ({
5083
5251
  name: definitionFieldName ? `${definitionFieldName}.code` : `code`,
5084
5252
  label: "Code"
5085
5253
  })
5086
- })), !hideVersionField && jsx(Grid$1, Object.assign({
5254
+ })), !hideVersionField && jsx(Grid, Object.assign({
5087
5255
  sm: 12
5088
5256
  }, {
5089
5257
  children: jsx(ControlNumberInput, {
@@ -5370,7 +5538,8 @@ const DefinitionFiller = ({
5370
5538
  properties,
5371
5539
  dataFieldName,
5372
5540
  useExpression: _useExpression = false,
5373
- title
5541
+ title,
5542
+ baseURL
5374
5543
  }) => {
5375
5544
  const stepperData = useMemo(() => {
5376
5545
  if (properties) {
@@ -5385,7 +5554,7 @@ const DefinitionFiller = ({
5385
5554
  children: [jsxs("b", {
5386
5555
  children: [property.name, property.isRequired ? '*' : '']
5387
5556
  }), jsxs("span", {
5388
- children: [property.key, " | ", property.isMultiple ? 'multiple' : 'single', " | ", propertyType]
5557
+ children: [property.key, " | ", property.isMultiple ? 'multiple' : 'single', " |", ' ', propertyType]
5389
5558
  })]
5390
5559
  })),
5391
5560
  content: property.isMultiple ? jsx(MultiplePropertyFiller, {
@@ -5393,28 +5562,30 @@ const DefinitionFiller = ({
5393
5562
  name: `${dataFieldName}.${property.key}`,
5394
5563
  useExpression: _useExpression,
5395
5564
  label: property.name,
5396
- required: property.isRequired
5565
+ required: property.isRequired,
5566
+ baseURL: baseURL
5397
5567
  }) : jsx(PropertyFiller, {
5398
5568
  property: property,
5399
5569
  name: `${dataFieldName}.${property.key}`,
5400
5570
  useExpression: _useExpression,
5401
5571
  label: property.name,
5402
- required: property.isRequired
5572
+ required: property.isRequired,
5573
+ baseURL: baseURL
5403
5574
  })
5404
5575
  };
5405
5576
  });
5406
5577
  }
5407
5578
  return [];
5408
- }, [properties, dataFieldName, _useExpression]);
5579
+ }, [properties, dataFieldName, _useExpression, baseURL]);
5409
5580
  return jsx(LocalizationProvider, Object.assign({
5410
5581
  dateAdapter: AdapterDateFns
5411
5582
  }, {
5412
- children: jsxs(Grid$1, Object.assign({
5583
+ children: jsxs(Grid, Object.assign({
5413
5584
  container: true,
5414
5585
  direction: "column",
5415
5586
  spacing: 2
5416
5587
  }, {
5417
- children: [title && jsx(Grid$1, Object.assign({
5588
+ children: [title && jsx(Grid, Object.assign({
5418
5589
  xs: 12
5419
5590
  }, {
5420
5591
  children: jsx("div", Object.assign({
@@ -5541,7 +5712,7 @@ const DefinitionValueView = ({
5541
5712
  }
5542
5713
  return [];
5543
5714
  }, [properties, data]);
5544
- return jsx(Grid$1, Object.assign({
5715
+ return jsx(Grid, Object.assign({
5545
5716
  container: true,
5546
5717
  direction: "column",
5547
5718
  spacing: 2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dartech/arsenal-ui",
3
- "version": "1.3.68",
3
+ "version": "1.3.69",
4
4
  "author": "DAR",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -27,6 +27,7 @@
27
27
  "classnames": "^2.3.1",
28
28
  "@tanstack/react-query": "^4.24.10",
29
29
  "@rollup/plugin-node-resolve": "13.3.0",
30
+ "axios": "1.4.0",
30
31
  "qs": "6.11.0"
31
32
  },
32
33
  "module": "./index.js",
@@ -76,6 +76,7 @@ export interface EntityTypeProperty<T = Record<string, never>> extends Property
76
76
  }
77
77
  export interface EntityReferenceProperty extends Property {
78
78
  propertyType: PropertyType.ENTITY_REFERENCE;
79
+ source: string;
79
80
  definitionCode: string;
80
81
  definitionVersion: string;
81
82
  labelPropertyCode: string;
@@ -104,7 +105,7 @@ export interface TimeProperty extends Property {
104
105
  export interface AnyProperty extends Property {
105
106
  propertyType: PropertyType.ANY;
106
107
  }
107
- export type PropertyUnion<T = Record<string, never>> = BigDecimalProperty | BigIntegerProperty | BooleanProperty | DateProperty | DateTimeProperty | DoubleProperty | EntityTypeProperty<T> | EntityReferenceProperty | FloatProperty | StringProperty | IntegerProperty | JsonProperty | LongProperty | TimeProperty | AnyProperty;
108
+ export type PropertyUnion<T = Record<string, never>> = BigDecimalProperty | BigIntegerProperty | BooleanProperty | DateProperty | DateTimeProperty | DoubleProperty | EntityTypeProperty<T> | EntityReferenceProperty | FloatProperty | StringProperty | IntegerProperty | JsonProperty | LongProperty | TimeProperty | AnyProperty | EntityReferenceProperty;
108
109
  export declare const DATE_DEFAULT_FORMAT = "yyyy-MM-dd";
109
110
  export declare const TIME_DEFAULT_FORMAT = "HH:mm:ss";
110
111
  export declare const DATE_TIME_DEFAULT_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX";
@@ -1,3 +1,4 @@
1
1
  export * from './definition';
2
2
  export * from './ui';
3
3
  export * from './common';
4
+ export * from './instances';
@@ -0,0 +1,71 @@
1
+ export interface Entity {
2
+ id: string;
3
+ definitionCode: string;
4
+ definitionVersion: number;
5
+ data: Record<string, unknown>;
6
+ createdAt: Date;
7
+ updatedAt: Date;
8
+ }
9
+ export interface CustomerApplication {
10
+ id: string;
11
+ customerId: string;
12
+ definitionCode: string;
13
+ definitionVersion: number | string;
14
+ data: Record<string, any>;
15
+ createdAt: string;
16
+ updatedAt: string;
17
+ }
18
+ export interface PledgeInstance {
19
+ id: string;
20
+ definitionCode: string;
21
+ definitionVersion: number | string;
22
+ data: Record<string, any>;
23
+ createdAt: string;
24
+ updatedAt: string;
25
+ definition?: {
26
+ id: string;
27
+ name: string;
28
+ };
29
+ }
30
+ export interface Product {
31
+ id: string;
32
+ definitionCode: string;
33
+ definitionVersion: number;
34
+ data: {
35
+ [key: string]: unknown;
36
+ };
37
+ customerApplicationDefinitionRef: {
38
+ code: string;
39
+ version: number | string;
40
+ }[];
41
+ minAmount: number;
42
+ maxAmount: number;
43
+ periodType: string;
44
+ minTerm: number;
45
+ maxTerm: number;
46
+ interestRate: number;
47
+ currency: string;
48
+ overpaymentCoefficient: number;
49
+ minPartialRepaymentAmount: number;
50
+ principalOverdueRate: number;
51
+ interestOverdueRate: number;
52
+ carteBlanchePeriod: number;
53
+ gracePeriod: number;
54
+ maxOverdueCoefficient: number;
55
+ maxOverdueDays: number;
56
+ maxNumberOfProlongations: number;
57
+ prolongationAvailableOverdueDay: number;
58
+ prolongationSettings: {
59
+ days: number[] | string;
60
+ rate: number;
61
+ availableFromGap: number;
62
+ }[];
63
+ maxProlongationDays: number;
64
+ createdAt: Date;
65
+ updatedAt: Date;
66
+ privateMetadata: Record<string, unknown>;
67
+ isActive: boolean;
68
+ isOverpaymentAllowed: boolean;
69
+ isPartialPaymentAllowed: boolean;
70
+ isProlongationAllowed: boolean;
71
+ }
@@ -5,6 +5,7 @@ type Props = {
5
5
  dataFieldName: string;
6
6
  useExpression?: boolean;
7
7
  title?: string;
8
+ baseURL?: string;
8
9
  };
9
- export declare const DefinitionFiller: ({ properties, dataFieldName, useExpression, title }: Props) => JSX.Element;
10
+ export declare const DefinitionFiller: ({ properties, dataFieldName, useExpression, title, baseURL, }: Props) => JSX.Element;
10
11
  export default DefinitionFiller;
@@ -7,6 +7,7 @@ type Props = {
7
7
  required?: boolean;
8
8
  label?: string;
9
9
  title?: string;
10
+ baseURL?: string;
10
11
  };
11
- export declare const MultiplePropertyFiller: ({ property, name, useExpression, required, label, title, }: Props) => JSX.Element;
12
+ export declare const MultiplePropertyFiller: ({ property, name, useExpression, required, label, title, baseURL, }: Props) => JSX.Element;
12
13
  export default MultiplePropertyFiller;
@@ -6,6 +6,7 @@ type Props = {
6
6
  useExpression?: boolean;
7
7
  required?: boolean;
8
8
  label?: string;
9
+ baseURL?: string;
9
10
  };
10
- declare const MultiplePropertyWidget: ({ name, property, useExpression, required, label, }: Props) => JSX.Element;
11
+ export declare const MultiplePropertyWidget: ({ name, property, useExpression, required, label, baseURL, }: Props) => JSX.Element;
11
12
  export default MultiplePropertyWidget;
@@ -1,12 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { PropertyUnion } from '../../../interfaces';
3
- type Props = {
3
+ export type PropertyFillerProps = {
4
4
  property: PropertyUnion;
5
5
  name: string;
6
6
  useExpression?: boolean;
7
7
  label?: string;
8
8
  required?: boolean;
9
9
  title?: string;
10
+ baseURL?: string;
10
11
  };
11
- export declare const PropertyFiller: ({ property, name, useExpression, label, required, title, }: Props) => JSX.Element;
12
+ export declare const PropertyFiller: ({ property, name, useExpression, label, required, title, baseURL, }: PropertyFillerProps) => JSX.Element;
12
13
  export default PropertyFiller;
@@ -7,6 +7,7 @@ type Props = {
7
7
  label?: string;
8
8
  useExpression?: boolean;
9
9
  control: Control<any>;
10
+ baseURL?: string;
10
11
  };
11
- export declare const PropertyWidget: ({ property, name, label, useExpression, control }: Props) => JSX.Element;
12
+ export declare const PropertyWidget: ({ property, name, label, useExpression, control, baseURL, }: Props) => JSX.Element;
12
13
  export default PropertyWidget;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type Props = {
3
2
  name: string;
4
3
  label?: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type Props = {
3
2
  name: string;
4
3
  label?: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type Props = {
3
2
  name: string;
4
3
  format: string;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { EntityReferenceProperty } from '../../../../interfaces/definition';
3
+ type Props = {
4
+ name: string;
5
+ required?: boolean;
6
+ definitionProperty: EntityReferenceProperty;
7
+ baseURL?: string;
8
+ };
9
+ declare const EntityReferenceValueField: ({ name, required, definitionProperty, baseURL, }: Props) => JSX.Element;
10
+ export default EntityReferenceValueField;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type Props = {
3
2
  name: string;
4
3
  label?: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type Props = {
3
2
  name: string;
4
3
  label?: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { PropertyUnion } from '../../../interfaces';
3
2
  type PropertyItemProps = {
4
3
  property: PropertyUnion;
@@ -0,0 +1,23 @@
1
+ import { CustomerApplication, Entity, PledgeInstance, Product } from '../interfaces';
2
+ type Props = {
3
+ baseURL: string;
4
+ };
5
+ export declare function useEntitiesService({ baseURL }: Props): {
6
+ getEntitiesByCodeAndVersion: ({ definitionCode, definitionVersion, }: {
7
+ definitionCode: any;
8
+ definitionVersion: any;
9
+ }) => Promise<Entity[]>;
10
+ getCustomerApplications: (params?: {
11
+ definitionCode;
12
+ definitionVersion;
13
+ }) => Promise<CustomerApplication[]>;
14
+ getProducts: (params?: {
15
+ definitionCode;
16
+ definitionVersion;
17
+ }) => Promise<Product[]>;
18
+ getPledgeInstances: (params?: {
19
+ definitionCode;
20
+ definitionVersion;
21
+ }) => Promise<PledgeInstance[]>;
22
+ };
23
+ export {};
@@ -0,0 +1,166 @@
1
+ import { PropertiesArrayType } from '../interfaces';
2
+ export declare const mockProperties: PropertiesArrayType<Record<string, never>>;
3
+ export declare const mockPropsArray: ({
4
+ key: string;
5
+ propertyType: string;
6
+ name: string;
7
+ isRequired: boolean;
8
+ isMultiple: boolean;
9
+ sortOrder: number;
10
+ isEnabled: boolean;
11
+ uiSettings: any;
12
+ validationNode: any;
13
+ isViewableInList: boolean;
14
+ restrictedValues: any;
15
+ defaultValue: string;
16
+ defaultValues: any;
17
+ precisionScale?: undefined;
18
+ roundingMode?: undefined;
19
+ definitionCode?: undefined;
20
+ definitionVersion?: undefined;
21
+ labelPropertyCode?: undefined;
22
+ valuePropertyCode?: undefined;
23
+ } | {
24
+ key: string;
25
+ propertyType: string;
26
+ name: string;
27
+ isRequired: boolean;
28
+ isMultiple: boolean;
29
+ sortOrder: number;
30
+ isEnabled: boolean;
31
+ uiSettings: any;
32
+ validationNode: any;
33
+ isViewableInList: boolean;
34
+ defaultValue: number;
35
+ defaultValues: any;
36
+ precisionScale: number;
37
+ roundingMode: string;
38
+ restrictedValues?: undefined;
39
+ definitionCode?: undefined;
40
+ definitionVersion?: undefined;
41
+ labelPropertyCode?: undefined;
42
+ valuePropertyCode?: undefined;
43
+ } | {
44
+ key: string;
45
+ propertyType: string;
46
+ name: string;
47
+ isRequired: boolean;
48
+ isMultiple: boolean;
49
+ sortOrder: number;
50
+ isEnabled: boolean;
51
+ uiSettings: any;
52
+ validationNode: any;
53
+ isViewableInList: boolean;
54
+ definitionCode: string;
55
+ definitionVersion: string;
56
+ labelPropertyCode: string;
57
+ valuePropertyCode: string;
58
+ defaultValue: string;
59
+ defaultValues: any;
60
+ restrictedValues?: undefined;
61
+ precisionScale?: undefined;
62
+ roundingMode?: undefined;
63
+ })[];
64
+ export declare const mockPropsObject: {
65
+ any: {
66
+ propertyType: string;
67
+ name: string;
68
+ isRequired: boolean;
69
+ isMultiple: boolean;
70
+ sortOrder: number;
71
+ isEnabled: boolean;
72
+ uiSettings: any;
73
+ validationNode: any;
74
+ isViewableInList: boolean;
75
+ restrictedValues: any;
76
+ defaultValue: any;
77
+ defaultValues: any;
78
+ };
79
+ int: {
80
+ propertyType: string;
81
+ name: string;
82
+ isRequired: boolean;
83
+ isMultiple: boolean;
84
+ sortOrder: number;
85
+ isEnabled: boolean;
86
+ uiSettings: any;
87
+ validationNode: any;
88
+ isViewableInList: boolean;
89
+ restrictedValues: any;
90
+ defaultValue: any;
91
+ defaultValues: any;
92
+ };
93
+ string: {
94
+ propertyType: string;
95
+ name: string;
96
+ isRequired: boolean;
97
+ isMultiple: boolean;
98
+ sortOrder: number;
99
+ isEnabled: boolean;
100
+ uiSettings: any;
101
+ validationNode: any;
102
+ isViewableInList: boolean;
103
+ restrictedValues: any;
104
+ defaultValue: any;
105
+ defaultValues: any;
106
+ };
107
+ entity: {
108
+ propertyType: string;
109
+ name: string;
110
+ isRequired: boolean;
111
+ isMultiple: boolean;
112
+ sortOrder: number;
113
+ isEnabled: boolean;
114
+ uiSettings: any;
115
+ validationNode: any;
116
+ isViewableInList: boolean;
117
+ properties: {
118
+ foo: {
119
+ propertyType: string;
120
+ name: string;
121
+ isRequired: boolean;
122
+ isMultiple: boolean;
123
+ sortOrder: number;
124
+ isEnabled: boolean;
125
+ uiSettings: any;
126
+ validationNode: any;
127
+ isViewableInList: boolean;
128
+ restrictedValues: string[];
129
+ defaultValue: string;
130
+ defaultValues: any;
131
+ };
132
+ };
133
+ defaultValue: {
134
+ asd: string;
135
+ };
136
+ defaultValues: any;
137
+ };
138
+ b_decimal: {
139
+ propertyType: string;
140
+ name: string;
141
+ isRequired: boolean;
142
+ isMultiple: boolean;
143
+ sortOrder: number;
144
+ isEnabled: boolean;
145
+ uiSettings: any;
146
+ validationNode: any;
147
+ isViewableInList: boolean;
148
+ defaultValue: any;
149
+ defaultValues: any;
150
+ precisionScale: number;
151
+ roundingMode: string;
152
+ };
153
+ json: {
154
+ propertyType: string;
155
+ name: string;
156
+ isRequired: boolean;
157
+ isMultiple: boolean;
158
+ sortOrder: number;
159
+ isEnabled: boolean;
160
+ uiSettings: any;
161
+ validationNode: any;
162
+ isViewableInList: boolean;
163
+ defaultValue: any;
164
+ defaultValues: any;
165
+ };
166
+ };