@dartech/arsenal-ui 1.3.72 → 1.3.74
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,8 +1474,18 @@ 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
|
-
|
1478
|
-
|
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;
|
1479
1489
|
};
|
1480
1490
|
const isDateType = propertyType => {
|
1481
1491
|
return propertyType === PropertyType.DATE || propertyType === PropertyType.DATE_TIME || propertyType === PropertyType.TIME;
|
@@ -1888,7 +1898,7 @@ const ControlNumberInput = _a => {
|
|
1888
1898
|
} else if (!decimal && !digitsOnly.test(val)) {
|
1889
1899
|
return 'Not valid integer';
|
1890
1900
|
}
|
1891
|
-
return true;
|
1901
|
+
return validate ? typeof validate === 'function' ? validate(val) : true : true;
|
1892
1902
|
}
|
1893
1903
|
}
|
1894
1904
|
}),
|
@@ -3429,83 +3439,6 @@ const EntityAdditionalFields = ({
|
|
3429
3439
|
};
|
3430
3440
|
var EntityAdditionalFields$1 = EntityAdditionalFields;
|
3431
3441
|
|
3432
|
-
const sources = [{
|
3433
|
-
label: 'Arsenal',
|
3434
|
-
value: 'ARSENAL'
|
3435
|
-
}, {
|
3436
|
-
label: 'Scalend',
|
3437
|
-
value: 'SCALEND'
|
3438
|
-
}];
|
3439
|
-
const modules = [{
|
3440
|
-
label: 'Customers',
|
3441
|
-
value: 'CUSTOMERS'
|
3442
|
-
}, {
|
3443
|
-
label: 'Products',
|
3444
|
-
value: 'PRODUCTS'
|
3445
|
-
}, {
|
3446
|
-
label: 'Pledges',
|
3447
|
-
value: 'PLEDGES'
|
3448
|
-
}];
|
3449
|
-
const EntityReferencePropertyFields = ({
|
3450
|
-
propertyFieldName
|
3451
|
-
}) => {
|
3452
|
-
const {
|
3453
|
-
control
|
3454
|
-
} = useFormContext();
|
3455
|
-
const source = useWatch({
|
3456
|
-
control,
|
3457
|
-
name: `${propertyFieldName}.source`
|
3458
|
-
});
|
3459
|
-
return jsxs(Fragment, {
|
3460
|
-
children: [jsx(Grid, {
|
3461
|
-
children: jsx(ControlSelect, {
|
3462
|
-
required: true,
|
3463
|
-
control: control,
|
3464
|
-
name: `${propertyFieldName}.source`,
|
3465
|
-
label: "Source",
|
3466
|
-
options: sources
|
3467
|
-
})
|
3468
|
-
}), source && jsx(Grid, {
|
3469
|
-
children: source === 'ARSENAL' ? jsx(ControlInput, {
|
3470
|
-
required: true,
|
3471
|
-
control: control,
|
3472
|
-
name: `${propertyFieldName}.definitionCode`,
|
3473
|
-
label: "Definition Code"
|
3474
|
-
}) : jsx(ControlSelect, {
|
3475
|
-
required: true,
|
3476
|
-
control: control,
|
3477
|
-
name: `${propertyFieldName}.definitionCode`,
|
3478
|
-
label: "Definition Code",
|
3479
|
-
valueKey: "value",
|
3480
|
-
options: modules
|
3481
|
-
})
|
3482
|
-
}), jsx(Grid, {
|
3483
|
-
children: jsx(ControlInput, {
|
3484
|
-
required: true,
|
3485
|
-
control: control,
|
3486
|
-
name: `${propertyFieldName}.definitionVersion`,
|
3487
|
-
label: "Definition Version",
|
3488
|
-
defaultValue: 1
|
3489
|
-
})
|
3490
|
-
}), jsx(Grid, {
|
3491
|
-
children: jsx(ControlInput, {
|
3492
|
-
required: true,
|
3493
|
-
control: control,
|
3494
|
-
name: `${propertyFieldName}.labelPropertyCode`,
|
3495
|
-
label: "Label Property Code"
|
3496
|
-
})
|
3497
|
-
}), jsx(Grid, {
|
3498
|
-
children: jsx(ControlInput, {
|
3499
|
-
required: true,
|
3500
|
-
control: control,
|
3501
|
-
name: `${propertyFieldName}.valuePropertyCode`,
|
3502
|
-
label: "Value Property Code"
|
3503
|
-
})
|
3504
|
-
})]
|
3505
|
-
});
|
3506
|
-
};
|
3507
|
-
var EntityReferencePropertyFields$1 = EntityReferencePropertyFields;
|
3508
|
-
|
3509
3442
|
const StringPropertyFields = ({
|
3510
3443
|
propertyFieldName
|
3511
3444
|
}) => {
|
@@ -3632,7 +3565,8 @@ const PropertyAdditionalFields = ({
|
|
3632
3565
|
defaultValue: DATE_TIME_DEFAULT_FORMAT
|
3633
3566
|
});
|
3634
3567
|
case PropertyType.ENTITY_REFERENCE:
|
3635
|
-
return
|
3568
|
+
// return <EntityReferencePropertyFields propertyFieldName={propertyFieldName} />;
|
3569
|
+
return jsx(StringPropertyFields$1, {
|
3636
3570
|
propertyFieldName: propertyFieldName
|
3637
3571
|
});
|
3638
3572
|
case PropertyType.ENTITY:
|
@@ -5661,29 +5595,25 @@ const PropertyValueComponent = ({
|
|
5661
5595
|
padding: '4px'
|
5662
5596
|
}
|
5663
5597
|
}, {
|
5664
|
-
children: value === null ? 'null' :
|
5598
|
+
children: value === null ? 'null' : JSON.stringify(value)
|
5665
5599
|
}));
|
5666
|
-
|
5667
|
-
|
5668
|
-
|
5669
|
-
|
5670
|
-
|
5671
|
-
|
5672
|
-
|
5673
|
-
|
5674
|
-
|
5675
|
-
|
5676
|
-
|
5677
|
-
|
5678
|
-
|
5679
|
-
|
5680
|
-
|
5681
|
-
|
5682
|
-
|
5683
|
-
}) : defaultRender(data);
|
5684
|
-
default:
|
5685
|
-
return defaultRender(data);
|
5686
|
-
}
|
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);
|
5687
5617
|
}
|
5688
5618
|
};
|
5689
5619
|
const PropertyDataView = ({
|
package/package.json
CHANGED
@@ -3,6 +3,7 @@ import { PropertiesArrayType } from '../../../interfaces';
|
|
3
3
|
type Props = {
|
4
4
|
properties: PropertiesArrayType<unknown>;
|
5
5
|
data: unknown;
|
6
|
+
update?: number;
|
6
7
|
};
|
7
8
|
export declare const DefinitionValueView: ({ properties, data }: Props) => JSX.Element;
|
8
9
|
export default DefinitionValueView;
|