@dartech/arsenal-ui 1.3.76 → 1.3.77

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.
Files changed (2) hide show
  1. package/index.js +104 -23
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1474,8 +1474,8 @@ const formatTableRowValue = ({
1474
1474
  const digitsOnly = new RegExp('^[-+]?[0-9]+$');
1475
1475
  const floatsOnly = new RegExp(/^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/);
1476
1476
  const isExpression = value => {
1477
- if (typeof value === 'string') return /\$(?:S?JS)?\(/g.test(value);
1478
- return false;
1477
+ // return typeof value === 'string' ? value.includes('$(') : false;
1478
+ return typeof value === 'string' ? /\$(?:S?JS)?\(/g.test(value) : false;
1479
1479
  };
1480
1480
  const isDateType = propertyType => {
1481
1481
  return propertyType === PropertyType.DATE || propertyType === PropertyType.DATE_TIME || propertyType === PropertyType.TIME;
@@ -1645,6 +1645,7 @@ const propertiesArrayToObject = (properties, isGlobalParameter) => {
1645
1645
  resultProperty['restrictedValues'] = property.restrictedValues;
1646
1646
  }
1647
1647
  if (propertyType === PropertyType.ENTITY_REFERENCE) {
1648
+ resultProperty['source'] = property.source;
1648
1649
  resultProperty['definitionCode'] = property.definitionCode;
1649
1650
  resultProperty['definitionVersion'] = property.definitionVersion;
1650
1651
  resultProperty['labelPropertyCode'] = property.labelPropertyCode;
@@ -1888,7 +1889,7 @@ const ControlNumberInput = _a => {
1888
1889
  } else if (!decimal && !digitsOnly.test(val)) {
1889
1890
  return 'Not valid integer';
1890
1891
  }
1891
- return validate ? typeof validate === 'function' ? validate(val) : true : true;
1892
+ return true;
1892
1893
  }
1893
1894
  }
1894
1895
  }),
@@ -3429,6 +3430,83 @@ const EntityAdditionalFields = ({
3429
3430
  };
3430
3431
  var EntityAdditionalFields$1 = EntityAdditionalFields;
3431
3432
 
3433
+ const sources = [{
3434
+ label: 'Arsenal',
3435
+ value: 'ARSENAL'
3436
+ }, {
3437
+ label: 'Scalend',
3438
+ value: 'SCALEND'
3439
+ }];
3440
+ const modules = [{
3441
+ label: 'Customers',
3442
+ value: 'CUSTOMERS'
3443
+ }, {
3444
+ label: 'Products',
3445
+ value: 'PRODUCTS'
3446
+ }, {
3447
+ label: 'Pledges',
3448
+ value: 'PLEDGES'
3449
+ }];
3450
+ const EntityReferencePropertyFields = ({
3451
+ propertyFieldName
3452
+ }) => {
3453
+ const {
3454
+ control
3455
+ } = useFormContext();
3456
+ const source = useWatch({
3457
+ control,
3458
+ name: `${propertyFieldName}.source`
3459
+ });
3460
+ return jsxs(Fragment, {
3461
+ children: [jsx(Grid, {
3462
+ children: jsx(ControlSelect, {
3463
+ required: true,
3464
+ control: control,
3465
+ name: `${propertyFieldName}.source`,
3466
+ label: "Source",
3467
+ options: sources
3468
+ })
3469
+ }), source && jsx(Grid, {
3470
+ children: source === 'ARSENAL' ? jsx(ControlInput, {
3471
+ required: true,
3472
+ control: control,
3473
+ name: `${propertyFieldName}.definitionCode`,
3474
+ label: "Definition Code"
3475
+ }) : jsx(ControlSelect, {
3476
+ required: true,
3477
+ control: control,
3478
+ name: `${propertyFieldName}.definitionCode`,
3479
+ label: "Definition Code",
3480
+ valueKey: "value",
3481
+ options: modules
3482
+ })
3483
+ }), jsx(Grid, {
3484
+ children: jsx(ControlInput, {
3485
+ required: true,
3486
+ control: control,
3487
+ name: `${propertyFieldName}.definitionVersion`,
3488
+ label: "Definition Version",
3489
+ defaultValue: 1
3490
+ })
3491
+ }), jsx(Grid, {
3492
+ children: jsx(ControlInput, {
3493
+ required: true,
3494
+ control: control,
3495
+ name: `${propertyFieldName}.labelPropertyCode`,
3496
+ label: "Label Property Code"
3497
+ })
3498
+ }), jsx(Grid, {
3499
+ children: jsx(ControlInput, {
3500
+ required: true,
3501
+ control: control,
3502
+ name: `${propertyFieldName}.valuePropertyCode`,
3503
+ label: "Value Property Code"
3504
+ })
3505
+ })]
3506
+ });
3507
+ };
3508
+ var EntityReferencePropertyFields$1 = EntityReferencePropertyFields;
3509
+
3432
3510
  const StringPropertyFields = ({
3433
3511
  propertyFieldName
3434
3512
  }) => {
@@ -3555,8 +3633,7 @@ const PropertyAdditionalFields = ({
3555
3633
  defaultValue: DATE_TIME_DEFAULT_FORMAT
3556
3634
  });
3557
3635
  case PropertyType.ENTITY_REFERENCE:
3558
- // return <EntityReferencePropertyFields propertyFieldName={propertyFieldName} />;
3559
- return jsx(StringPropertyFields$1, {
3636
+ return jsx(EntityReferencePropertyFields$1, {
3560
3637
  propertyFieldName: propertyFieldName
3561
3638
  });
3562
3639
  case PropertyType.ENTITY:
@@ -5585,25 +5662,29 @@ const PropertyValueComponent = ({
5585
5662
  padding: '4px'
5586
5663
  }
5587
5664
  }, {
5588
- children: value === null ? 'null' : value.toString()
5665
+ children: value === null ? 'null' : value === null || value === void 0 ? void 0 : value.toString()
5589
5666
  }));
5590
- switch (property.propertyType) {
5591
- case PropertyType.JSON:
5592
- return jsx(JsonView, {
5593
- value: data
5594
- });
5595
- case PropertyType.ENTITY:
5596
- return jsx(DefinitionValueView, {
5597
- properties: properties,
5598
- data: data
5599
- });
5600
- case PropertyType.ANY:
5601
- // TODO need to prefetch data and show as is
5602
- return typeof data === 'object' ? jsx(JsonView, {
5603
- value: data
5604
- }) : defaultRender(data);
5605
- default:
5606
- return defaultRender(data);
5667
+ if (isExpression(data)) {
5668
+ return defaultRender(data);
5669
+ } else {
5670
+ switch (property.propertyType) {
5671
+ case PropertyType.JSON:
5672
+ return jsx(JsonView, {
5673
+ value: data
5674
+ });
5675
+ case PropertyType.ENTITY:
5676
+ return jsx(DefinitionValueView, {
5677
+ properties: properties,
5678
+ data: data
5679
+ });
5680
+ case PropertyType.ANY:
5681
+ // TODO need to prefetch data and show as is
5682
+ return typeof data === 'object' ? jsx(JsonView, {
5683
+ value: data
5684
+ }) : defaultRender(data);
5685
+ default:
5686
+ return defaultRender(data);
5687
+ }
5607
5688
  }
5608
5689
  };
5609
5690
  const PropertyDataView = ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dartech/arsenal-ui",
3
- "version": "1.3.76",
3
+ "version": "1.3.77",
4
4
  "author": "DAR",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"