@ng-formworks/core 20.6.4 → 20.6.6
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.
|
@@ -2488,6 +2488,10 @@ const jsonSchemaFormatTests = {
|
|
|
2488
2488
|
// Modified to allow incomplete entries, such as
|
|
2489
2489
|
// "2000-03-14T01:59:26.535" (needs "Z") or "2000-03-14T01:59" (needs ":00Z")
|
|
2490
2490
|
'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s][0-2]\d:[0-5]\d(?::[0-5]\d)?(?:\.\d+)?(?:z|[+-]\d\d:\d\d)?$/i,
|
|
2491
|
+
// "2000-03-14T01:59:26.535" (doesn't need "Z") or "2000-03-14T01:59" (needs ":00Z")
|
|
2492
|
+
//'iso-date-time':^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|([+-]\d{2}:\d{2}))?$
|
|
2493
|
+
//for now same as 'date-time' until better tested
|
|
2494
|
+
'iso-date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s][0-2]\d:[0-5]\d(?::[0-5]\d)?(?:\.\d+)?(?:z|[+-]\d\d:\d\d)?$/i,
|
|
2491
2495
|
// email (sources from jsen validator):
|
|
2492
2496
|
// http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363
|
|
2493
2497
|
// http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation')
|
|
@@ -2856,7 +2860,7 @@ class JsonValidators {
|
|
|
2856
2860
|
}
|
|
2857
2861
|
else {
|
|
2858
2862
|
// Allow JavaScript Date objects
|
|
2859
|
-
isValid = ['date', 'time', 'date-time'].includes(requiredFormat) &&
|
|
2863
|
+
isValid = ['date', 'time', 'iso-date-time'].includes(requiredFormat) &&
|
|
2860
2864
|
Object.prototype.toString.call(currentValue) === '[object Date]';
|
|
2861
2865
|
}
|
|
2862
2866
|
return xor(isValid, invert) ?
|
|
@@ -4072,7 +4076,10 @@ function getInputType(schema, layoutNode = null) {
|
|
|
4072
4076
|
return {
|
|
4073
4077
|
'color': 'color',
|
|
4074
4078
|
'date': 'date',
|
|
4075
|
-
|
|
4079
|
+
//as per ajv date-time requires a timezone but input
|
|
4080
|
+
//datetime-local doesn't
|
|
4081
|
+
//'date-time': 'datetime-local',
|
|
4082
|
+
'iso-date-time': 'datetime-local',
|
|
4076
4083
|
'email': 'email',
|
|
4077
4084
|
'uri': 'url',
|
|
4078
4085
|
}[schema.format] || 'text';
|
|
@@ -6453,7 +6460,8 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
|
|
|
6453
6460
|
'/properties/' + innerItemLevel2.name : innerItemLevel2.name;
|
|
6454
6461
|
//innerItemLevel2.oneOfPointer = schemaPointer + keySchemaPointer + l2SchemaPointer;
|
|
6455
6462
|
// innerItemLevel2.schemaPointer=innerItemLevel2.schemaPointer;
|
|
6456
|
-
|
|
6463
|
+
const ofPointer = { anyOf: "anyOfPointer", oneOf: "oneOfPointer" }[ofType];
|
|
6464
|
+
innerItemLevel2[ofPointer] = ofPointer ? innerItemLevel2.schemaPointer : undefined;
|
|
6457
6465
|
});
|
|
6458
6466
|
}
|
|
6459
6467
|
//TODO review-will never reach here if forRefLibrary==true
|
|
@@ -6463,6 +6471,9 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
|
|
|
6463
6471
|
innerItem.forEach(item => {
|
|
6464
6472
|
const l2SchemaPointer = hasOwn(ofItem, 'properties') ?
|
|
6465
6473
|
'/properties/' + item.name : item.name;
|
|
6474
|
+
if (ofType == "anyOf") {
|
|
6475
|
+
item.anyOfPointer = item.schemaPointer;
|
|
6476
|
+
}
|
|
6466
6477
|
if (outerOneOfItem) {
|
|
6467
6478
|
////item.oneOfPointer = schemaPointer + keySchemaPointer + l2SchemaPointer;
|
|
6468
6479
|
//schemaPointer + keySchemaPointer + item.dataPointer;
|
|
@@ -6486,7 +6497,8 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
|
|
|
6486
6497
|
}
|
|
6487
6498
|
else {
|
|
6488
6499
|
if (outerOneOfItem) {
|
|
6489
|
-
|
|
6500
|
+
const ofPointer = { anyOf: "anyOfPointer", oneOf: "oneOfPointer" }[ofType];
|
|
6501
|
+
innerItem[ofPointer] = ofPointer ? schemaPointer + keySchemaPointer : undefined;
|
|
6490
6502
|
////innerItem.schemaPointer=innerItem.oneOfPointer;
|
|
6491
6503
|
outerOneOfItem.items = outerOneOfItem.items || [];
|
|
6492
6504
|
outerOneOfItem.items.push(innerItem);
|
|
@@ -7496,7 +7508,8 @@ class JsonSchemaFormService {
|
|
|
7496
7508
|
//introduced to check if the node is part of ITE conditional
|
|
7497
7509
|
//then change or add the control
|
|
7498
7510
|
if (layoutNode?.schemaPointer && layoutNode.isITEItem ||
|
|
7499
|
-
(layoutNode?.schemaPointer && layoutNode?.oneOfPointer)
|
|
7511
|
+
(layoutNode?.schemaPointer && layoutNode?.oneOfPointer) ||
|
|
7512
|
+
layoutNode?.schemaPointer && layoutNode.anyOfPointer) {
|
|
7500
7513
|
//before changing control, need to set the new data type for data formatting
|
|
7501
7514
|
const schemaType = this.dataMap.get(layoutNode?.dataPointer).get("schemaType");
|
|
7502
7515
|
if (schemaType != layoutNode.dataType) {
|
|
@@ -7539,9 +7552,9 @@ class JsonSchemaFormService {
|
|
|
7539
7552
|
//set, as the control would only be initialized when the condition is true
|
|
7540
7553
|
//TODO-review need to decide which of the data sets between data,formValues and default
|
|
7541
7554
|
//to use for the value
|
|
7542
|
-
if (ctx.options?.condition || layoutNode?.oneOfPointer) {
|
|
7555
|
+
if (ctx.options?.condition || layoutNode?.oneOfPointer || layoutNode?.anyOfPointer) {
|
|
7543
7556
|
const dataPointer = this.getDataPointer(ctx);
|
|
7544
|
-
const controlValue = ctx.formControl
|
|
7557
|
+
const controlValue = ctx.formControl?.value;
|
|
7545
7558
|
const dataValue = JsonPointer.has(this.data, dataPointer) ?
|
|
7546
7559
|
JsonPointer.get(this.data, dataPointer) : undefined;
|
|
7547
7560
|
const formValue = JsonPointer.has(this.formValues, dataPointer) ?
|
|
@@ -7672,7 +7685,8 @@ class JsonSchemaFormService {
|
|
|
7672
7685
|
}
|
|
7673
7686
|
const schemaPointer = ctx.layoutNode()?.isITEItem ? ctx.layoutNode()?.schemaPointer : null;
|
|
7674
7687
|
const oneOfPointer = ctx.layoutNode()?.oneOfPointer;
|
|
7675
|
-
|
|
7688
|
+
const anyOfPointer = ctx.layoutNode()?.anyOfPointer;
|
|
7689
|
+
return getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer || anyOfPointer);
|
|
7676
7690
|
}
|
|
7677
7691
|
setFormControl(ctx, control) {
|
|
7678
7692
|
if (!ctx || !ctx.layoutNode ||
|
|
@@ -7690,7 +7704,8 @@ class JsonSchemaFormService {
|
|
|
7690
7704
|
}
|
|
7691
7705
|
const schemaPointer = ctx.layoutNode()?.isITEItem ? ctx.layoutNode()?.schemaPointer : null;
|
|
7692
7706
|
const oneOfPointer = ctx.layoutNode()?.oneOfPointer;
|
|
7693
|
-
const
|
|
7707
|
+
const anyOfPointer = ctx.layoutNode()?.anyOfPointer;
|
|
7708
|
+
const control = getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer || anyOfPointer);
|
|
7694
7709
|
return control ? control.value : null;
|
|
7695
7710
|
}
|
|
7696
7711
|
getFormControlGroup(ctx) {
|
|
@@ -7699,7 +7714,8 @@ class JsonSchemaFormService {
|
|
|
7699
7714
|
}
|
|
7700
7715
|
const schemaPointer = ctx.layoutNode()?.isITEItem ? ctx.layoutNode()?.schemaPointer : null;
|
|
7701
7716
|
const oneOfPointer = ctx.layoutNode()?.oneOfPointer;
|
|
7702
|
-
|
|
7717
|
+
const anyOfPointer = ctx.layoutNode()?.anyOfPointer;
|
|
7718
|
+
return getControl(this.formGroup, this.getDataPointer(ctx), true, schemaPointer || oneOfPointer || anyOfPointer);
|
|
7703
7719
|
}
|
|
7704
7720
|
getFormControlName(ctx) {
|
|
7705
7721
|
if (!ctx || !ctx.layoutNode ||
|
|
@@ -9754,13 +9770,13 @@ class SelectComponent {
|
|
|
9754
9770
|
[name]="controlName">
|
|
9755
9771
|
<ng-template ngFor let-selectItem [ngForOf]="selectList">
|
|
9756
9772
|
<option *ngIf="!isArray(selectItem?.items)"
|
|
9757
|
-
[
|
|
9773
|
+
[ngValue]="selectItem?.value">
|
|
9758
9774
|
<span [innerHTML]="selectItem?.name"></span>
|
|
9759
9775
|
</option>
|
|
9760
9776
|
<optgroup *ngIf="isArray(selectItem?.items)"
|
|
9761
9777
|
[label]="selectItem?.group">
|
|
9762
9778
|
<option *ngFor="let subItem of selectItem.items"
|
|
9763
|
-
[
|
|
9779
|
+
[ngValue]="subItem?.value">
|
|
9764
9780
|
<span [innerHTML]="subItem?.name"></span>
|
|
9765
9781
|
</option>
|
|
9766
9782
|
</optgroup>
|
|
@@ -9778,14 +9794,14 @@ class SelectComponent {
|
|
|
9778
9794
|
<ng-template ngFor let-selectItem [ngForOf]="selectList">
|
|
9779
9795
|
<option *ngIf="!isArray(selectItem?.items)"
|
|
9780
9796
|
[selected]="selectItem?.value === controlValue"
|
|
9781
|
-
[
|
|
9797
|
+
[ngValue]="selectItem?.value">
|
|
9782
9798
|
<span [innerHTML]="selectItem?.name"></span>
|
|
9783
9799
|
</option>
|
|
9784
9800
|
<optgroup *ngIf="isArray(selectItem?.items)"
|
|
9785
9801
|
[label]="selectItem?.group">
|
|
9786
9802
|
<option *ngFor="let subItem of selectItem.items"
|
|
9787
9803
|
[attr.selected]="subItem?.value === controlValue"
|
|
9788
|
-
[
|
|
9804
|
+
[ngValue]="subItem?.value">
|
|
9789
9805
|
<span [innerHTML]="subItem?.name"></span>
|
|
9790
9806
|
</option>
|
|
9791
9807
|
</optgroup>
|
|
@@ -9805,14 +9821,14 @@ class SelectComponent {
|
|
|
9805
9821
|
<ng-template ngFor let-selectItem [ngForOf]="selectList">
|
|
9806
9822
|
<option *ngIf="!isArray(selectItem?.items)"
|
|
9807
9823
|
[selected]="selectItem?.value === controlValue"
|
|
9808
|
-
[
|
|
9824
|
+
[ngValue]="selectItem?.value">
|
|
9809
9825
|
<span [innerHTML]="selectItem?.name"></span>
|
|
9810
9826
|
</option>
|
|
9811
9827
|
<optgroup *ngIf="isArray(selectItem?.items)"
|
|
9812
9828
|
[label]="selectItem?.group">
|
|
9813
9829
|
<option *ngFor="let subItem of selectItem.items"
|
|
9814
9830
|
[attr.selected]="subItem?.value === controlValue"
|
|
9815
|
-
[
|
|
9831
|
+
[ngValue]="subItem?.value">
|
|
9816
9832
|
<span [innerHTML]="subItem?.name"></span>
|
|
9817
9833
|
</option>
|
|
9818
9834
|
</optgroup>
|
|
@@ -9843,13 +9859,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
|
|
|
9843
9859
|
[name]="controlName">
|
|
9844
9860
|
<ng-template ngFor let-selectItem [ngForOf]="selectList">
|
|
9845
9861
|
<option *ngIf="!isArray(selectItem?.items)"
|
|
9846
|
-
[
|
|
9862
|
+
[ngValue]="selectItem?.value">
|
|
9847
9863
|
<span [innerHTML]="selectItem?.name"></span>
|
|
9848
9864
|
</option>
|
|
9849
9865
|
<optgroup *ngIf="isArray(selectItem?.items)"
|
|
9850
9866
|
[label]="selectItem?.group">
|
|
9851
9867
|
<option *ngFor="let subItem of selectItem.items"
|
|
9852
|
-
[
|
|
9868
|
+
[ngValue]="subItem?.value">
|
|
9853
9869
|
<span [innerHTML]="subItem?.name"></span>
|
|
9854
9870
|
</option>
|
|
9855
9871
|
</optgroup>
|
|
@@ -9867,14 +9883,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
|
|
|
9867
9883
|
<ng-template ngFor let-selectItem [ngForOf]="selectList">
|
|
9868
9884
|
<option *ngIf="!isArray(selectItem?.items)"
|
|
9869
9885
|
[selected]="selectItem?.value === controlValue"
|
|
9870
|
-
[
|
|
9886
|
+
[ngValue]="selectItem?.value">
|
|
9871
9887
|
<span [innerHTML]="selectItem?.name"></span>
|
|
9872
9888
|
</option>
|
|
9873
9889
|
<optgroup *ngIf="isArray(selectItem?.items)"
|
|
9874
9890
|
[label]="selectItem?.group">
|
|
9875
9891
|
<option *ngFor="let subItem of selectItem.items"
|
|
9876
9892
|
[attr.selected]="subItem?.value === controlValue"
|
|
9877
|
-
[
|
|
9893
|
+
[ngValue]="subItem?.value">
|
|
9878
9894
|
<span [innerHTML]="subItem?.name"></span>
|
|
9879
9895
|
</option>
|
|
9880
9896
|
</optgroup>
|
|
@@ -9894,14 +9910,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
|
|
|
9894
9910
|
<ng-template ngFor let-selectItem [ngForOf]="selectList">
|
|
9895
9911
|
<option *ngIf="!isArray(selectItem?.items)"
|
|
9896
9912
|
[selected]="selectItem?.value === controlValue"
|
|
9897
|
-
[
|
|
9913
|
+
[ngValue]="selectItem?.value">
|
|
9898
9914
|
<span [innerHTML]="selectItem?.name"></span>
|
|
9899
9915
|
</option>
|
|
9900
9916
|
<optgroup *ngIf="isArray(selectItem?.items)"
|
|
9901
9917
|
[label]="selectItem?.group">
|
|
9902
9918
|
<option *ngFor="let subItem of selectItem.items"
|
|
9903
9919
|
[attr.selected]="subItem?.value === controlValue"
|
|
9904
|
-
[
|
|
9920
|
+
[ngValue]="subItem?.value">
|
|
9905
9921
|
<span [innerHTML]="subItem?.name"></span>
|
|
9906
9922
|
</option>
|
|
9907
9923
|
</optgroup>
|
|
@@ -10209,7 +10225,10 @@ class WidgetLibraryService {
|
|
|
10209
10225
|
// See: http://ulion.github.io/jsonform/playground/?example=fields-checkboxbuttons
|
|
10210
10226
|
// Widgets included for compatibility with React JSON Schema Form API
|
|
10211
10227
|
'updown': 'number',
|
|
10212
|
-
'date-time': 'datetime-local',
|
|
10228
|
+
//'date-time': 'datetime-local',
|
|
10229
|
+
//as per ajv date-time requires a timezone but input
|
|
10230
|
+
//datetime-local doesn't
|
|
10231
|
+
'iso-date-time': 'datetime-local',
|
|
10213
10232
|
'alt-datetime': 'datetime-local',
|
|
10214
10233
|
'alt-date': 'date',
|
|
10215
10234
|
// Widgets included for compatibility with Angular Schema Form API
|