@dartech/arsenal-ui 1.3.67 → 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,7 @@ const JsonView = /*#__PURE__*/forwardRef(({
1218
1218
  const [loading, setLoading] = useState(true);
1219
1219
  const onCreateEditor = useCallback(view => {
1220
1220
  const onScroll = e => {
1221
- if (e.target.scrollTop === view.scrollDOM.scrollHeight - view.scrollDOM.offsetHeight) {
1221
+ if (view.scrollDOM.scrollHeight - view.scrollDOM.offsetHeight - e.target.scrollTop < 10) {
1222
1222
  setTimeout(() => view.scrollDOM.scrollTo(0, 0), 200);
1223
1223
  }
1224
1224
  if (e.target.scrollTop === 0) {
@@ -1274,12 +1274,6 @@ const JsonModalView = ({
1274
1274
  jsonViewProps
1275
1275
  }) => {
1276
1276
  const editorRef = useRef();
1277
- // useEffect(() => {
1278
- // if (editorRef.current) {
1279
- // console.log(editorRef.current);
1280
- // editorRef.current.editor.scrollTop = 1000;
1281
- // }
1282
- // }, [open, editorRef]);
1283
1277
  return jsxs(Dialog, Object.assign({
1284
1278
  disableEscapeKeyDown: true,
1285
1279
  open: open,
@@ -3137,7 +3131,7 @@ const BigDecimalPropertyFields = ({
3137
3131
  control
3138
3132
  } = useFormContext();
3139
3133
  return jsxs(Fragment, {
3140
- children: [jsx(Grid$1, {
3134
+ children: [jsx(Grid, {
3141
3135
  children: jsx(ControlNumberInput, {
3142
3136
  required: true,
3143
3137
  control: control,
@@ -3145,7 +3139,7 @@ const BigDecimalPropertyFields = ({
3145
3139
  name: `${propertyFieldName}.precisionScale`,
3146
3140
  label: "Precision Scale"
3147
3141
  })
3148
- }), jsx(Grid$1, {
3142
+ }), jsx(Grid, {
3149
3143
  children: jsx(ControlSelect, {
3150
3144
  required: true,
3151
3145
  control: control,
@@ -3166,7 +3160,7 @@ const DateAdditionalFields = ({
3166
3160
  const {
3167
3161
  control
3168
3162
  } = useFormContext();
3169
- return jsx(Grid$1, {
3163
+ return jsx(Grid, {
3170
3164
  children: jsx(ControlInput, {
3171
3165
  required: true,
3172
3166
  control: control,
@@ -3311,17 +3305,17 @@ const EntityAdditionalFields = ({
3311
3305
  }
3312
3306
  });
3313
3307
  return jsxs(Fragment, {
3314
- children: [jsx(Grid$1, {
3308
+ children: [jsx(Grid, {
3315
3309
  children: jsx(Typography, Object.assign({
3316
3310
  variant: "h6"
3317
3311
  }, {
3318
3312
  children: "Properties"
3319
3313
  }))
3320
- }), jsx(Grid$1, {
3314
+ }), jsx(Grid, {
3321
3315
  children: jsx(EntityPropertiesShortView$1, {
3322
3316
  properties: properties
3323
3317
  })
3324
- }), jsx(Grid$1, {
3318
+ }), jsx(Grid, {
3325
3319
  children: jsx(Button, Object.assign({
3326
3320
  variant: "contained",
3327
3321
  color: "primary",
@@ -3344,7 +3338,7 @@ const EntityAdditionalFields = ({
3344
3338
  overflow: 'hidden'
3345
3339
  }
3346
3340
  }, {
3347
- children: jsxs(Grid$1, Object.assign({
3341
+ children: jsxs(Grid, Object.assign({
3348
3342
  container: true,
3349
3343
  direction: "row",
3350
3344
  spacing: 2,
@@ -3352,7 +3346,7 @@ const EntityAdditionalFields = ({
3352
3346
  height: '100%'
3353
3347
  }
3354
3348
  }, {
3355
- children: [jsxs(Grid$1, Object.assign({
3349
+ children: [jsxs(Grid, Object.assign({
3356
3350
  xs: 3,
3357
3351
  style: {
3358
3352
  backgroundColor: '#f9f9f9',
@@ -3393,7 +3387,7 @@ const EntityAdditionalFields = ({
3393
3387
  }, {
3394
3388
  children: "Add property"
3395
3389
  }))]
3396
- })), jsx(Grid$1, Object.assign({
3390
+ })), jsx(Grid, Object.assign({
3397
3391
  container: true,
3398
3392
  wrap: "nowrap",
3399
3393
  direction: "column",
@@ -3427,35 +3421,72 @@ const EntityAdditionalFields = ({
3427
3421
  };
3428
3422
  var EntityAdditionalFields$1 = EntityAdditionalFields;
3429
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
+ }];
3430
3441
  const EntityReferencePropertyFields = ({
3431
3442
  propertyFieldName
3432
3443
  }) => {
3433
3444
  const {
3434
3445
  control
3435
3446
  } = useFormContext();
3447
+ const source = useWatch({
3448
+ control,
3449
+ name: `${propertyFieldName}.source`
3450
+ });
3436
3451
  return jsxs(Fragment, {
3437
- children: [jsx(Grid$1, {
3438
- 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, {
3439
3462
  required: true,
3440
3463
  control: control,
3441
3464
  name: `${propertyFieldName}.definitionCode`,
3442
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
3443
3473
  })
3444
- }), jsx(Grid$1, {
3474
+ }), jsx(Grid, {
3445
3475
  children: jsx(ControlInput, {
3446
3476
  required: true,
3447
3477
  control: control,
3448
3478
  name: `${propertyFieldName}.definitionVersion`,
3449
- label: "Definition Version"
3479
+ label: "Definition Version",
3480
+ defaultValue: 1
3450
3481
  })
3451
- }), jsx(Grid$1, {
3482
+ }), jsx(Grid, {
3452
3483
  children: jsx(ControlInput, {
3453
3484
  required: true,
3454
3485
  control: control,
3455
3486
  name: `${propertyFieldName}.labelPropertyCode`,
3456
3487
  label: "Label Property Code"
3457
3488
  })
3458
- }), jsx(Grid$1, {
3489
+ }), jsx(Grid, {
3459
3490
  children: jsx(ControlInput, {
3460
3491
  required: true,
3461
3492
  control: control,
@@ -3509,13 +3540,13 @@ const StringPropertyFields = ({
3509
3540
  }
3510
3541
  };
3511
3542
  return jsxs(Fragment, {
3512
- children: [jsx(Grid$1, {
3543
+ children: [jsx(Grid, {
3513
3544
  children: jsx(Typography, Object.assign({
3514
3545
  variant: "h6"
3515
3546
  }, {
3516
3547
  children: "Restricted Values"
3517
3548
  }))
3518
- }), !!(restrictedValues === null || restrictedValues === void 0 ? void 0 : restrictedValues.length) && jsx(Grid$1, {
3549
+ }), !!(restrictedValues === null || restrictedValues === void 0 ? void 0 : restrictedValues.length) && jsx(Grid, {
3519
3550
  children: jsx(Box, Object.assign({
3520
3551
  display: "flex",
3521
3552
  flexWrap: "wrap"
@@ -3529,7 +3560,7 @@ const StringPropertyFields = ({
3529
3560
  onDelete: () => handleDelete(index)
3530
3561
  }, index))
3531
3562
  }))
3532
- }), jsx(Grid$1, {
3563
+ }), jsx(Grid, {
3533
3564
  children: jsx(TextField, {
3534
3565
  fullWidth: true,
3535
3566
  variant: "outlined",
@@ -3668,12 +3699,138 @@ const StringValueField = ({
3668
3699
  };
3669
3700
  var StringValueField$1 = StringValueField;
3670
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
+
3671
3827
  const PropertyWidget = ({
3672
3828
  property,
3673
3829
  name,
3674
3830
  label,
3675
3831
  useExpression,
3676
- control
3832
+ control,
3833
+ baseURL
3677
3834
  }) => {
3678
3835
  const propertyType = useMemo(() => typeof property.propertyType === 'string' ? property.propertyType : property['propertyType']['value'], [property]);
3679
3836
  switch (propertyType) {
@@ -3755,14 +3912,13 @@ const PropertyWidget = ({
3755
3912
  restrictedValues: property.restrictedValues
3756
3913
  });
3757
3914
  case PropertyType.ENTITY_REFERENCE:
3758
- return jsx(ControlInput
3915
+ return jsx(EntityReferenceValueField$1
3759
3916
  // required
3760
3917
  , {
3761
3918
  // required
3762
- hideErrorMessage: true,
3763
3919
  name: name,
3764
- label: label,
3765
- control: control
3920
+ definitionProperty: property,
3921
+ baseURL: baseURL
3766
3922
  });
3767
3923
  case PropertyType.ANY:
3768
3924
  return jsx(ControlAceEditor, {
@@ -3881,7 +4037,8 @@ const PropertyFiller = ({
3881
4037
  useExpression,
3882
4038
  label,
3883
4039
  required,
3884
- title
4040
+ title,
4041
+ baseURL
3885
4042
  }) => {
3886
4043
  const {
3887
4044
  control,
@@ -3974,7 +4131,7 @@ const PropertyFiller = ({
3974
4131
  setValue(name, defaultProperyValue);
3975
4132
  }
3976
4133
  }, [value, setValue, defaultProperyValue, property, name]);
3977
- return jsxs(Grid$1, Object.assign({
4134
+ return jsxs(Grid, Object.assign({
3978
4135
  xs: 12
3979
4136
  }, {
3980
4137
  children: [title && jsx(Box, Object.assign({
@@ -4037,7 +4194,8 @@ const PropertyFiller = ({
4037
4194
  property: property,
4038
4195
  name: name,
4039
4196
  useExpression: useExpression,
4040
- label: valueLabel
4197
+ label: valueLabel,
4198
+ baseURL: baseURL
4041
4199
  }), fillOption === 'dem_builder' && jsx(CreateDefinition, {
4042
4200
  title: "JSON",
4043
4201
  definitionFieldName: name
@@ -4101,7 +4259,8 @@ const MultiplePropertyWidget = ({
4101
4259
  property,
4102
4260
  useExpression,
4103
4261
  required,
4104
- label
4262
+ label,
4263
+ baseURL
4105
4264
  }) => {
4106
4265
  const {
4107
4266
  control,
@@ -4123,13 +4282,13 @@ const MultiplePropertyWidget = ({
4123
4282
  const handleDeleteValue = useCallback(index => {
4124
4283
  setValue(name, removeArrayItem(values, index));
4125
4284
  }, [name, values, setValue]);
4126
- return jsxs(Grid$1, Object.assign({
4285
+ return jsxs(Grid, Object.assign({
4127
4286
  container: true,
4128
4287
  spacing: 2,
4129
4288
  direction: "column",
4130
4289
  xs: 12
4131
4290
  }, {
4132
- 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({
4133
4292
  xs: 12
4134
4293
  }, {
4135
4294
  children: jsxs(Box, Object.assign({
@@ -4146,12 +4305,14 @@ const MultiplePropertyWidget = ({
4146
4305
  property: property,
4147
4306
  useExpression: useExpression,
4148
4307
  name: `${name}.${index}`,
4149
- label: `${label || property.name} (${index + 1})`
4308
+ label: `${label || property.name} (${index + 1})`,
4309
+ baseURL: baseURL
4150
4310
  }), jsx(Box, Object.assign({
4151
4311
  mt: "8px",
4152
4312
  ml: "4px"
4153
4313
  }, {
4154
4314
  children: jsx(IconButton, Object.assign({
4315
+ id: "close-button",
4155
4316
  size: "small",
4156
4317
  onClick: () => handleDeleteValue(index)
4157
4318
  }, {
@@ -4165,7 +4326,7 @@ const MultiplePropertyWidget = ({
4165
4326
  }))
4166
4327
  }))]
4167
4328
  }))
4168
- }), index)) : null, jsx(Grid$1, {
4329
+ }), index)) : null, jsx(Grid, {
4169
4330
  children: jsx(Button, Object.assign({
4170
4331
  variant: "contained",
4171
4332
  size: "small",
@@ -4185,7 +4346,8 @@ const MultiplePropertyFiller = ({
4185
4346
  useExpression,
4186
4347
  required,
4187
4348
  label,
4188
- title
4349
+ title,
4350
+ baseURL
4189
4351
  }) => {
4190
4352
  var _a;
4191
4353
  const [selectTouched, setSelectTouched] = useState(false);
@@ -4256,7 +4418,7 @@ const MultiplePropertyFiller = ({
4256
4418
  checkFillOption();
4257
4419
  }
4258
4420
  }, [checkFillOption, selectTouched, value]);
4259
- return jsxs(Grid$1, {
4421
+ return jsxs(Grid, {
4260
4422
  children: [title && jsx(Box, Object.assign({
4261
4423
  mb: 2
4262
4424
  }, {
@@ -4309,7 +4471,8 @@ const MultiplePropertyFiller = ({
4309
4471
  name: name,
4310
4472
  useExpression: useExpression,
4311
4473
  required: required,
4312
- label: label
4474
+ label: label,
4475
+ baseURL: baseURL
4313
4476
  }), error && jsx(FormHelperText, Object.assign({
4314
4477
  error: true
4315
4478
  }, {
@@ -4820,26 +4983,26 @@ const CreatePropertyFormFields = ({
4820
4983
  setValue(`${propertyFieldName}.propertyType`, propertyTypes.find(el => el.value === propertyType));
4821
4984
  }
4822
4985
  }, [propertyType, setValue, propertyFieldName]);
4823
- return jsxs(Grid$1, Object.assign({
4986
+ return jsxs(Grid, Object.assign({
4824
4987
  container: true,
4825
4988
  direction: "column",
4826
4989
  spacing: 2
4827
4990
  }, {
4828
- children: [jsx(Grid$1, {
4991
+ children: [jsx(Grid, {
4829
4992
  children: jsx(ControlInput, {
4830
4993
  required: true,
4831
4994
  control: control,
4832
4995
  name: `${propertyFieldName}.key`,
4833
4996
  label: "Key"
4834
4997
  })
4835
- }), jsx(Grid$1, {
4998
+ }), jsx(Grid, {
4836
4999
  children: jsx(ControlInput, {
4837
5000
  required: true,
4838
5001
  control: control,
4839
5002
  name: `${propertyFieldName}.name`,
4840
5003
  label: "Name"
4841
5004
  })
4842
- }), jsx(Grid$1, {
5005
+ }), jsx(Grid, {
4843
5006
  children: jsx(ControlAutocomplete, {
4844
5007
  required: true,
4845
5008
  control: control,
@@ -4848,21 +5011,21 @@ const CreatePropertyFormFields = ({
4848
5011
  options: propertyTypes,
4849
5012
  onChange: handlePropertyTypeChange
4850
5013
  })
4851
- }), jsx(Grid$1, {
5014
+ }), jsx(Grid, {
4852
5015
  children: jsx(ControlNumberInput, {
4853
5016
  required: true,
4854
5017
  control: control,
4855
5018
  name: `${propertyFieldName}.sortOrder`,
4856
5019
  label: "Sort Order"
4857
5020
  })
4858
- }), jsx(Grid$1, {
5021
+ }), jsx(Grid, {
4859
5022
  children: jsx(ControlAceEditor, {
4860
5023
  control: control,
4861
5024
  name: `${propertyFieldName}.uiSettings`,
4862
5025
  label: "UI Settings",
4863
5026
  validateJson: true
4864
5027
  })
4865
- }), jsxs(Grid$1, {
5028
+ }), jsxs(Grid, {
4866
5029
  children: [jsx(ControlCheckbox, {
4867
5030
  control: control,
4868
5031
  name: `${propertyFieldName}.isMultiple`,
@@ -4889,7 +5052,7 @@ const CreatePropertyFormFields = ({
4889
5052
  }, index))
4890
5053
  }) : null]
4891
5054
  }), propertyType && jsxs(Fragment, {
4892
- children: [jsx(Grid$1, {
5055
+ children: [jsx(Grid, {
4893
5056
  children: jsx(PropertyValidatorContext.Provider, Object.assign({
4894
5057
  value: (_a = propertyType.value) !== null && _a !== void 0 ? _a : propertyType
4895
5058
  }, {
@@ -4909,7 +5072,7 @@ const CreatePropertyFormFields = ({
4909
5072
  required: _globalParameter ? isRequired : false
4910
5073
  })]
4911
5074
  }), customFields.length ? jsx(Fragment, {
4912
- children: customFields.map((field, index) => jsx(Grid$1, {
5075
+ children: customFields.map((field, index) => jsx(Grid, {
4913
5076
  children: jsx(CustomPropertyField$1, Object.assign({}, field, {
4914
5077
  propertyFieldName: propertyFieldName
4915
5078
  }))
@@ -4982,7 +5145,7 @@ const CreatePropertiesList = ({
4982
5145
  setValue(`${fieldName}`, removeArrayItem(properties, index));
4983
5146
  }, [properties, fieldName, setValue]);
4984
5147
  return jsxs(Fragment, {
4985
- children: [error && error.message && jsx(Grid$1, Object.assign({
5148
+ children: [error && error.message && jsx(Grid, Object.assign({
4986
5149
  sm: 12
4987
5150
  }, {
4988
5151
  children: jsx(Typography, Object.assign({
@@ -4990,7 +5153,7 @@ const CreatePropertiesList = ({
4990
5153
  }, {
4991
5154
  children: error.message
4992
5155
  }))
4993
- })), Array.isArray(properties) && properties.map((property, index) => jsx(Grid$1, Object.assign({
5156
+ })), Array.isArray(properties) && properties.map((property, index) => jsx(Grid, Object.assign({
4994
5157
  sm: 12,
4995
5158
  ref: ref => refs.current[index] = ref
4996
5159
  }, {
@@ -5027,7 +5190,7 @@ const CreatePropertiesList = ({
5027
5190
  }))
5028
5191
  })]
5029
5192
  }))
5030
- }), index)), !hideAddButton && jsx(Grid$1, Object.assign({
5193
+ }), index)), !hideAddButton && jsx(Grid, Object.assign({
5031
5194
  xs: 12
5032
5195
  }, {
5033
5196
  children: jsx(Button, Object.assign({
@@ -5053,12 +5216,12 @@ const CreateDefinition = ({
5053
5216
  const {
5054
5217
  control
5055
5218
  } = useFormContext();
5056
- return jsxs(Grid$1, Object.assign({
5219
+ return jsxs(Grid, Object.assign({
5057
5220
  container: true,
5058
5221
  direction: "column",
5059
5222
  spacing: 2
5060
5223
  }, {
5061
- children: [title && jsx(Grid$1, Object.assign({
5224
+ children: [title && jsx(Grid, Object.assign({
5062
5225
  sm: 12
5063
5226
  }, {
5064
5227
  children: jsx(Box, Object.assign({
@@ -5070,7 +5233,7 @@ const CreateDefinition = ({
5070
5233
  children: title
5071
5234
  }))
5072
5235
  }))
5073
- })), !hideNameField && jsx(Grid$1, Object.assign({
5236
+ })), !hideNameField && jsx(Grid, Object.assign({
5074
5237
  sm: 12
5075
5238
  }, {
5076
5239
  children: jsx(ControlInput, {
@@ -5079,7 +5242,7 @@ const CreateDefinition = ({
5079
5242
  name: definitionFieldName ? `${definitionFieldName}.name` : `name`,
5080
5243
  label: "Name"
5081
5244
  })
5082
- })), !hideCodeField && jsx(Grid$1, Object.assign({
5245
+ })), !hideCodeField && jsx(Grid, Object.assign({
5083
5246
  sm: 12
5084
5247
  }, {
5085
5248
  children: jsx(ControlInput, {
@@ -5088,7 +5251,7 @@ const CreateDefinition = ({
5088
5251
  name: definitionFieldName ? `${definitionFieldName}.code` : `code`,
5089
5252
  label: "Code"
5090
5253
  })
5091
- })), !hideVersionField && jsx(Grid$1, Object.assign({
5254
+ })), !hideVersionField && jsx(Grid, Object.assign({
5092
5255
  sm: 12
5093
5256
  }, {
5094
5257
  children: jsx(ControlNumberInput, {
@@ -5375,7 +5538,8 @@ const DefinitionFiller = ({
5375
5538
  properties,
5376
5539
  dataFieldName,
5377
5540
  useExpression: _useExpression = false,
5378
- title
5541
+ title,
5542
+ baseURL
5379
5543
  }) => {
5380
5544
  const stepperData = useMemo(() => {
5381
5545
  if (properties) {
@@ -5390,7 +5554,7 @@ const DefinitionFiller = ({
5390
5554
  children: [jsxs("b", {
5391
5555
  children: [property.name, property.isRequired ? '*' : '']
5392
5556
  }), jsxs("span", {
5393
- children: [property.key, " | ", property.isMultiple ? 'multiple' : 'single', " | ", propertyType]
5557
+ children: [property.key, " | ", property.isMultiple ? 'multiple' : 'single', " |", ' ', propertyType]
5394
5558
  })]
5395
5559
  })),
5396
5560
  content: property.isMultiple ? jsx(MultiplePropertyFiller, {
@@ -5398,28 +5562,30 @@ const DefinitionFiller = ({
5398
5562
  name: `${dataFieldName}.${property.key}`,
5399
5563
  useExpression: _useExpression,
5400
5564
  label: property.name,
5401
- required: property.isRequired
5565
+ required: property.isRequired,
5566
+ baseURL: baseURL
5402
5567
  }) : jsx(PropertyFiller, {
5403
5568
  property: property,
5404
5569
  name: `${dataFieldName}.${property.key}`,
5405
5570
  useExpression: _useExpression,
5406
5571
  label: property.name,
5407
- required: property.isRequired
5572
+ required: property.isRequired,
5573
+ baseURL: baseURL
5408
5574
  })
5409
5575
  };
5410
5576
  });
5411
5577
  }
5412
5578
  return [];
5413
- }, [properties, dataFieldName, _useExpression]);
5579
+ }, [properties, dataFieldName, _useExpression, baseURL]);
5414
5580
  return jsx(LocalizationProvider, Object.assign({
5415
5581
  dateAdapter: AdapterDateFns
5416
5582
  }, {
5417
- children: jsxs(Grid$1, Object.assign({
5583
+ children: jsxs(Grid, Object.assign({
5418
5584
  container: true,
5419
5585
  direction: "column",
5420
5586
  spacing: 2
5421
5587
  }, {
5422
- children: [title && jsx(Grid$1, Object.assign({
5588
+ children: [title && jsx(Grid, Object.assign({
5423
5589
  xs: 12
5424
5590
  }, {
5425
5591
  children: jsx("div", Object.assign({
@@ -5546,7 +5712,7 @@ const DefinitionValueView = ({
5546
5712
  }
5547
5713
  return [];
5548
5714
  }, [properties, data]);
5549
- return jsx(Grid$1, Object.assign({
5715
+ return jsx(Grid, Object.assign({
5550
5716
  container: true,
5551
5717
  direction: "column",
5552
5718
  spacing: 2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dartech/arsenal-ui",
3
- "version": "1.3.67",
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
+ };