@dartech/arsenal-ui 1.3.75 → 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.
package/index.js CHANGED
@@ -1474,18 +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
- if (Array.isArray(value)) {
1479
- for (const item of value) {
1480
- if (isExpression(item)) return true;
1481
- }
1482
- }
1483
- if (typeof value === 'object') {
1484
- for (const key in value) {
1485
- if (isExpression(value[key])) return true;
1486
- }
1487
- }
1488
- return false;
1477
+ // return typeof value === 'string' ? value.includes('$(') : false;
1478
+ return typeof value === 'string' ? /\$(?:S?JS)?\(/g.test(value) : false;
1489
1479
  };
1490
1480
  const isDateType = propertyType => {
1491
1481
  return propertyType === PropertyType.DATE || propertyType === PropertyType.DATE_TIME || propertyType === PropertyType.TIME;
@@ -1655,6 +1645,7 @@ const propertiesArrayToObject = (properties, isGlobalParameter) => {
1655
1645
  resultProperty['restrictedValues'] = property.restrictedValues;
1656
1646
  }
1657
1647
  if (propertyType === PropertyType.ENTITY_REFERENCE) {
1648
+ resultProperty['source'] = property.source;
1658
1649
  resultProperty['definitionCode'] = property.definitionCode;
1659
1650
  resultProperty['definitionVersion'] = property.definitionVersion;
1660
1651
  resultProperty['labelPropertyCode'] = property.labelPropertyCode;
@@ -1898,7 +1889,7 @@ const ControlNumberInput = _a => {
1898
1889
  } else if (!decimal && !digitsOnly.test(val)) {
1899
1890
  return 'Not valid integer';
1900
1891
  }
1901
- return validate ? typeof validate === 'function' ? validate(val) : true : true;
1892
+ return true;
1902
1893
  }
1903
1894
  }
1904
1895
  }),
@@ -3439,6 +3430,83 @@ const EntityAdditionalFields = ({
3439
3430
  };
3440
3431
  var EntityAdditionalFields$1 = EntityAdditionalFields;
3441
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
+
3442
3510
  const StringPropertyFields = ({
3443
3511
  propertyFieldName
3444
3512
  }) => {
@@ -3565,8 +3633,7 @@ const PropertyAdditionalFields = ({
3565
3633
  defaultValue: DATE_TIME_DEFAULT_FORMAT
3566
3634
  });
3567
3635
  case PropertyType.ENTITY_REFERENCE:
3568
- // return <EntityReferencePropertyFields propertyFieldName={propertyFieldName} />;
3569
- return jsx(StringPropertyFields$1, {
3636
+ return jsx(EntityReferencePropertyFields$1, {
3570
3637
  propertyFieldName: propertyFieldName
3571
3638
  });
3572
3639
  case PropertyType.ENTITY:
@@ -5595,25 +5662,29 @@ const PropertyValueComponent = ({
5595
5662
  padding: '4px'
5596
5663
  }
5597
5664
  }, {
5598
- children: value === null ? 'null' : value.toString()
5665
+ children: value === null ? 'null' : value === null || value === void 0 ? void 0 : value.toString()
5599
5666
  }));
5600
- switch (property.propertyType) {
5601
- case PropertyType.JSON:
5602
- return jsx(JsonView, {
5603
- value: data
5604
- });
5605
- case PropertyType.ENTITY:
5606
- return jsx(DefinitionValueView, {
5607
- properties: properties,
5608
- data: data
5609
- });
5610
- case PropertyType.ANY:
5611
- // TODO need to prefetch data and show as is
5612
- return typeof data === 'object' ? jsx(JsonView, {
5613
- value: data
5614
- }) : defaultRender(data);
5615
- default:
5616
- 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
+ }
5617
5688
  }
5618
5689
  };
5619
5690
  const PropertyDataView = ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dartech/arsenal-ui",
3
- "version": "1.3.75",
3
+ "version": "1.3.77",
4
4
  "author": "DAR",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -3,7 +3,6 @@ import { PropertiesArrayType } from '../../../interfaces';
3
3
  type Props = {
4
4
  properties: PropertiesArrayType<unknown>;
5
5
  data: unknown;
6
- update?: number;
7
6
  };
8
7
  export declare const DefinitionValueView: ({ properties, data }: Props) => JSX.Element;
9
8
  export default DefinitionValueView;