@ng-formworks/core 19.5.8 → 19.6.2

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.
@@ -1,16 +1,19 @@
1
1
  import * as i1 from '@angular/common';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { Injectable, inject, input, viewChild, ViewContainerRef, Component, Input, Directive, ChangeDetectionStrategy, ViewChild, ElementRef, NgZone, signal, NgModule, Inject, forwardRef, ChangeDetectorRef, output } from '@angular/core';
4
+ import { Injectable, inject, input, viewChild, ViewContainerRef, Component, Input, Directive, ChangeDetectionStrategy, ViewChild, signal, ElementRef, NgZone, NgModule, Inject, forwardRef, ChangeDetectorRef, output } from '@angular/core';
5
5
  import * as i2 from '@angular/forms';
6
6
  import { UntypedFormControl, UntypedFormArray, UntypedFormGroup, FormsModule, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
7
+ import addFormats from 'ajv-formats';
7
8
  import Ajv2019 from 'ajv/dist/2019';
8
9
  import jsonDraft6 from 'ajv/lib/refs/json-schema-draft-06.json';
9
10
  import jsonDraft7 from 'ajv/lib/refs/json-schema-draft-07.json';
10
11
  import cloneDeep from 'lodash/cloneDeep';
11
12
  import { from, Observable, forkJoin, Subject, BehaviorSubject, lastValueFrom } from 'rxjs';
13
+ import { some, isNil, isEmpty as isEmpty$1, pick, isObject as isObject$1, isEqual as isEqual$2 } from 'lodash';
12
14
  import isEqual$1 from 'lodash/isEqual';
13
15
  import { map, takeUntil } from 'rxjs/operators';
16
+ import omit from 'lodash/omit';
14
17
  import filter from 'lodash/filter';
15
18
  import map$1 from 'lodash/map';
16
19
  import _isArray from 'lodash/isArray';
@@ -26,10 +29,10 @@ class Framework {
26
29
  this.stylesheets = [];
27
30
  this.scripts = [];
28
31
  }
29
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: Framework, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
30
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: Framework }); }
32
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: Framework, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
33
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: Framework }); }
31
34
  }
32
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: Framework, decorators: [{
35
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: Framework, decorators: [{
33
36
  type: Injectable
34
37
  }] });
35
38
 
@@ -61,13 +64,15 @@ const deValidationMessages = {
61
64
  case 'uuid':
62
65
  return 'Keine gültige UUID (z. B. "12345678-9ABC-DEF0-1234-56789ABCDEF0")';
63
66
  case 'color':
64
- return 'Kein gültiger Farbwert (z. B. "#FFFFFF" oder "rgb(255, 255, 255)")';
67
+ return 'Kein gültiger Farbwert (z. B. "#FFFFFF")';
65
68
  case 'json-pointer':
66
69
  return 'Kein gültiger JSON-Pointer (z. B. "/pointer/to/something")';
67
70
  case 'relative-json-pointer':
68
71
  return 'Kein gültiger relativer JSON-Pointer (z. B. "2/pointer/to/something")';
69
72
  case 'regex':
70
73
  return 'Kein gültiger regulärer Ausdruck (z. B. "(1-)?\\d{3}-\\d{3}-\\d{4}")';
74
+ case 'duration':
75
+ return "Muss eine gültige ISO 8601-Dauer sein (z. B. 'PT1H30M')";
71
76
  default:
72
77
  return 'Muss diesem Format entsprechen: ' + error.requiredFormat;
73
78
  }
@@ -121,13 +126,15 @@ const enValidationMessages = {
121
126
  case 'uuid':
122
127
  return 'Must be a uuid, like "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
123
128
  case 'color':
124
- return 'Must be a color, like "#FFFFFF" or "rgb(255, 255, 255)"';
129
+ return 'Must be a color, like "#FFFFFF"';
125
130
  case 'json-pointer':
126
131
  return 'Must be a JSON Pointer, like "/pointer/to/something"';
127
132
  case 'relative-json-pointer':
128
133
  return 'Must be a relative JSON Pointer, like "2/pointer/to/something"';
129
134
  case 'regex':
130
135
  return 'Must be a regular expression, like "(1-)?\\d{3}-\\d{3}-\\d{4}"';
136
+ case 'duration':
137
+ return "Must be a valid ISO 8601 duration (e.g., 'PT1H30M')";
131
138
  default:
132
139
  return 'Must be a correctly formatted ' + error.requiredFormat;
133
140
  }
@@ -179,13 +186,15 @@ const esValidationMessages = {
179
186
  case 'uuid':
180
187
  return 'Debe ser un UUID, ej "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
181
188
  case 'color':
182
- return 'Debe ser un color, ej "#FFFFFF" or "rgb(255, 255, 255)"';
189
+ return 'Debe ser un color, ej "#FFFFFF"';
183
190
  case 'json-pointer':
184
191
  return 'Debe ser un JSON Pointer, ej "/pointer/to/something"';
185
192
  case 'relative-json-pointer':
186
193
  return 'Debe ser un JSON Pointer relativo, ej "2/pointer/to/something"';
187
194
  case 'regex':
188
195
  return 'Debe ser una expresión regular, ej "(1-)?\\d{3}-\\d{3}-\\d{4}"';
196
+ case 'duration':
197
+ return "Debe ser una duración válida en formato ISO 8601 (p. ej., 'PT1H30M')";
189
198
  default:
190
199
  return 'Debe tener el formato correcto ' + error.requiredFormat;
191
200
  }
@@ -238,13 +247,15 @@ const frValidationMessages = {
238
247
  case 'uuid':
239
248
  return 'Doit être un UUID, tel que "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
240
249
  case 'color':
241
- return 'Doit être une couleur, tel que "#FFFFFF" or "rgb(255, 255, 255)"';
250
+ return 'Doit être une couleur, tel que "#FFFFFF"';
242
251
  case 'json-pointer':
243
252
  return 'Doit être un JSON Pointer, tel que "/pointer/to/something"';
244
253
  case 'relative-json-pointer':
245
254
  return 'Doit être un relative JSON Pointer, tel que "2/pointer/to/something"';
246
255
  case 'regex':
247
256
  return 'Doit être une expression régulière, tel que "(1-)?\\d{3}-\\d{3}-\\d{4}"';
257
+ case 'duration':
258
+ return "Doit être une durée valide au format ISO 8601 (par ex., 'PT1H30M')";
248
259
  default:
249
260
  return 'Doit être avoir le format correct: ' + error.requiredFormat;
250
261
  }
@@ -298,13 +309,15 @@ const itValidationMessages = {
298
309
  case 'uuid':
299
310
  return 'Deve essere un uuid, come "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
300
311
  case 'color':
301
- return 'Deve essere un colore, come "#FFFFFF" o "rgb(255, 255, 255)"';
312
+ return 'Deve essere un colore, come "#FFFFFF"';
302
313
  case 'json-pointer':
303
314
  return 'Deve essere un JSON Pointer, come "/pointer/to/something"';
304
315
  case 'relative-json-pointer':
305
316
  return 'Deve essere un JSON Pointer relativo, come "2/pointer/to/something"';
306
317
  case 'regex':
307
318
  return 'Deve essere una regular expression, come "(1-)?\\d{3}-\\d{3}-\\d{4}"';
319
+ case 'duration':
320
+ return "Deve essere una durata valida nel formato ISO 8601 (es. 'PT1H30M')";
308
321
  default:
309
322
  return 'Deve essere formattato correttamente ' + error.requiredFormat;
310
323
  }
@@ -358,13 +371,15 @@ const ptValidationMessages = {
358
371
  case 'uuid':
359
372
  return 'Tem que ser um uuid, por exemplo "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
360
373
  case 'color':
361
- return 'Tem que ser uma cor, por exemplo "#FFFFFF" ou "rgb(255, 255, 255)"';
374
+ return 'Tem que ser uma cor, por exemplo "#FFFFFF"';
362
375
  case 'json-pointer':
363
376
  return 'Tem que ser um JSON Pointer, por exemplo "/referencia/para/algo"';
364
377
  case 'relative-json-pointer':
365
378
  return 'Tem que ser um JSON Pointer relativo, por exemplo "2/referencia/para/algo"';
366
379
  case 'regex':
367
380
  return 'Tem que ser uma expressão regular, por exemplo "(1-)?\\d{3}-\\d{3}-\\d{4}"';
381
+ case 'duration':
382
+ return "Deve ser uma duração válida no formato ISO 8601 (ex.: 'PT1H30M')";
368
383
  default:
369
384
  return 'Tem que ser no formato: ' + error.requiredFormat;
370
385
  }
@@ -418,13 +433,15 @@ const zhValidationMessages = {
418
433
  case 'uuid':
419
434
  return '必须为 uuid, 比如 "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
420
435
  case 'color':
421
- return '必须为颜色值, 比如 "#FFFFFF" 或者 "rgb(255, 255, 255)"';
436
+ return '必须为颜色值, 比如 "#FFFFFF"';
422
437
  case 'json-pointer':
423
438
  return '必须为 JSON Pointer, 比如 "/pointer/to/something"';
424
439
  case 'relative-json-pointer':
425
440
  return '必须为相对的 JSON Pointer, 比如 "2/pointer/to/something"';
426
441
  case 'regex':
427
442
  return '必须为正则表达式, 比如 "(1-)?\\d{3}-\\d{3}-\\d{4}"';
443
+ case 'duration':
444
+ return "必须是有效的 ISO 8601 持续时间(例如:'PT1H30M')";
428
445
  default:
429
446
  return '必须为格式正确的 ' + error.requiredFormat;
430
447
  }
@@ -1411,6 +1428,35 @@ function toTitleCase(input, forceWords) {
1411
1428
  }
1412
1429
  });
1413
1430
  }
1431
+ /**
1432
+ * Recursively checks if at least one property of the given object (including nested objects)
1433
+ * has a non-null and non-undefined value.
1434
+ *
1435
+ * @param obj - The object to check.
1436
+ * @returns `true` if at least one property has a non-null and non-undefined value, otherwise `false`.
1437
+ *
1438
+ * @example
1439
+ * const testObj = { a: null, b: { b1: null, b2: undefined } };
1440
+ * console.log(hasNonNullValue(testObj)); // Output: false
1441
+ *
1442
+ * const testObj2 = { a: 1, b: { b1: null, b2: undefined } };
1443
+ * console.log(hasNonNullValue(testObj2)); // Output: true
1444
+ */
1445
+ function hasNonNullValue(obj) {
1446
+ // If the object is null or not an object, return false immediately
1447
+ if (obj === null || typeof obj !== 'object') {
1448
+ return false;
1449
+ }
1450
+ // _.some checks if at least one element passes the given condition.
1451
+ return some(obj, (value) => {
1452
+ // If value is an object, recurse deeper into the object.
1453
+ if (isObject(value)) {
1454
+ return hasNonNullValue(value);
1455
+ }
1456
+ // Check if value is neither null nor undefined.
1457
+ return !isNil(value);
1458
+ });
1459
+ }
1414
1460
 
1415
1461
  class JsonPointer {
1416
1462
  /**
@@ -2427,10 +2473,10 @@ class JsonPointer {
2427
2473
  }
2428
2474
  console.error('parseObjectPath error: Input object path must be a string.');
2429
2475
  }
2430
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonPointer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2431
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonPointer }); }
2476
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonPointer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2477
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonPointer }); }
2432
2478
  }
2433
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonPointer, decorators: [{
2479
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonPointer, decorators: [{
2434
2480
  type: Injectable
2435
2481
  }] });
2436
2482
 
@@ -2475,6 +2521,7 @@ const jsonSchemaFormatTests = {
2475
2521
  // JSON-pointer: https://tools.ietf.org/html/rfc6901
2476
2522
  'json-pointer': /^(?:\/(?:[^~/]|~0|~1)*)*$|^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,
2477
2523
  'relative-json-pointer': /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,
2524
+ 'duration': /^P(?!$)(\d+Y)?(\d+M)?(\d+D)?(T(\d+H)?(\d+M)?(\d+S)?)?$/,
2478
2525
  'regex': function (str) {
2479
2526
  if (/[^\\]\\Z/.test(str)) {
2480
2527
  return false;
@@ -2771,7 +2818,7 @@ class JsonValidators {
2771
2818
  * This validator currently checks the following formsts:
2772
2819
  * date, time, date-time, email, hostname, ipv4, ipv6,
2773
2820
  * uri, uri-reference, uri-template, url, uuid, color,
2774
- * json-pointer, relative-json-pointer, regex
2821
+ * json-pointer, relative-json-pointer,duration, regex
2775
2822
  *
2776
2823
  * Fast format regular expressions copied from AJV:
2777
2824
  * https://github.com/epoberezkin/ajv/blob/master/lib/compile/formats.js
@@ -2790,9 +2837,14 @@ class JsonValidators {
2790
2837
  let isValid;
2791
2838
  const currentValue = control.value;
2792
2839
  if (isString(currentValue)) {
2840
+ //TODO fix-Reg exp last index problem
2841
+ //see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test
2842
+ //before every call to .test it needs to be reset
2843
+ //use either formatTest.lastIndex = 0; // Reset the lastIndex before each test
2844
+ //or new RegExp(formatTest.source, formatTest.flags);
2793
2845
  const formatTest = jsonSchemaFormatTests[requiredFormat];
2794
2846
  if (typeof formatTest === 'object') {
2795
- isValid = formatTest.test(currentValue);
2847
+ isValid = new RegExp(formatTest.source, formatTest.flags).test(currentValue);
2796
2848
  }
2797
2849
  else if (typeof formatTest === 'function') {
2798
2850
  isValid = formatTest(currentValue);
@@ -4029,8 +4081,18 @@ function getInputType(schema, layoutNode = null) {
4029
4081
  if (hasOwn(schema, '$ref')) {
4030
4082
  return '$ref';
4031
4083
  }
4032
- if (isArray(schema.oneOf) || isArray(schema.anyOf)) {
4084
+ //if (isArray(schema.anyOf)) { return 'any-of'; }//treated as allOf
4085
+ if (isArray(schema.oneOf)) {
4033
4086
  return 'one-of';
4087
+ } //{ return 'tabarray'; }
4088
+ if (hasOwn(schema, 'if')) {
4089
+ return 'if';
4090
+ }
4091
+ if (hasOwn(schema, 'then')) {
4092
+ return 'then';
4093
+ }
4094
+ if (hasOwn(schema, 'else')) {
4095
+ return 'else';
4034
4096
  }
4035
4097
  console.error(`getInputType error: Unable to determine input type for ${schemaType}`);
4036
4098
  console.error('schema', schema);
@@ -4443,6 +4505,14 @@ function getSubSchema(schema, pointer, schemaRefLibrary = null, schemaRecursiveR
4443
4505
  return subSchema;
4444
4506
  }, true, pointer);
4445
4507
  }
4508
+ function omitKeys(objects, keysToOmit) {
4509
+ return objects.map((obj) => omit(obj, keysToOmit));
4510
+ }
4511
+ function combineAllOfITE(schema) {
4512
+ if (schema && schema.allOf) {
4513
+ const allITE = schema.allOf.map(item => { return item.if && { if: item.if }; });
4514
+ }
4515
+ }
4446
4516
  /**
4447
4517
  * 'combineAllOf' function
4448
4518
  *
@@ -4456,11 +4526,24 @@ function combineAllOf(schema) {
4456
4526
  if (!isObject(schema) || !isArray(schema.allOf)) {
4457
4527
  return schema;
4458
4528
  }
4459
- let mergedSchema = mergeSchemas(...schema.allOf);
4529
+ const allITE = schema.allOf.map(item => { return item.if && item; })
4530
+ .filter(item => !isEmpty$1(item));
4531
+ //adaped to accomodate ITE by merging all non ITE field
4532
+ //then readding the allOf key with only ITE
4533
+ let schemaITEOmitted = omitKeys(schema.allOf, ['if', 'then', 'else']);
4534
+ let mergedSchema = mergeSchemas(...schemaITEOmitted);
4535
+ //mergeSchemas(...schema.allOf);
4460
4536
  if (Object.keys(schema).length > 1) {
4461
4537
  const extraKeys = { ...schema };
4462
4538
  delete extraKeys.allOf;
4463
- mergedSchema = mergeSchemas(mergedSchema, extraKeys);
4539
+ //TODO Test-changed order to preserve originial order
4540
+ mergedSchema = mergeSchemas(extraKeys, mergedSchema);
4541
+ //mergeSchemas(mergedSchema, extraKeys);
4542
+ //need to put it back if ITE
4543
+ if (allITE && allITE.length > 0) {
4544
+ mergedSchema.allOf = mergedSchema.allOf || [];
4545
+ mergedSchema.allOf.push(...allITE);
4546
+ }
4464
4547
  }
4465
4548
  return mergedSchema;
4466
4549
  }
@@ -4486,6 +4569,65 @@ function fixRequiredArrayProperties(schema) {
4486
4569
  }
4487
4570
  return schema;
4488
4571
  }
4572
+ /**
4573
+ * 'convertJSONSchemaIfToCondition' function
4574
+ * converts something like
4575
+ * "if": {
4576
+ * "properties": {
4577
+ * "animal": {
4578
+ * "const": "Cat"
4579
+ * },
4580
+ * "habitat":{
4581
+ * "const": "City"
4582
+ * }
4583
+ * }
4584
+ * }
4585
+ * to "model.animal=='Cat' && habitat=='City" contion
4586
+ * @param schema:any
4587
+ * @param negate:boolean=false
4588
+ * @returns
4589
+
4590
+ */
4591
+ function convertJSONSchemaIfToCondition(schema, layoutNode, negate = false) {
4592
+ let conditionFun = "";
4593
+ let condition = {};
4594
+ let notOp = negate ? "!" : "";
4595
+ // expects "dataPointer" to be like "/a/b/c"
4596
+ //TODO-test
4597
+ //dataPointer can be something like /cities/-/name
4598
+ //must end up like model.cities[arrayIndices].name
4599
+ //also check can possibly be nested array like /cities/-/sites/-/siteName
4600
+ //in this case must probably end up like
4601
+ // /cities/arrayIndices[0]/sites/arrayIndices[1]/siteName
4602
+ //but it seems evaluatCondition support only one level for now
4603
+ //and uses arrayIndices as the last index only -check?
4604
+ let parentPath = layoutNode.dataPointer ? layoutNode.dataPointer
4605
+ .split("/")
4606
+ .slice(1, -1)
4607
+ .map((part, ind) => {
4608
+ let sep = ind == 0 ? "" : ".";
4609
+ let ret = part == "-" ? "[arrayIndices]" : sep + part;
4610
+ return ret;
4611
+ })
4612
+ .join("")
4613
+ : "";
4614
+ let modelPath = parentPath ? `model.${parentPath}` : "model";
4615
+ let checkPath = modelPath.split(".")
4616
+ .reduce((accumulator, currentPart, index) => {
4617
+ const currentExpression = index === 0 ? currentPart : `${accumulator}.${currentPart}`;
4618
+ return index === 0 ? currentExpression : `${accumulator} && ${currentExpression}`;
4619
+ }, '');
4620
+ if (schema.if) {
4621
+ Object.keys(schema.if.properties).forEach((ifProp, ind) => {
4622
+ let amper = ind > 0 ? "&" : "";
4623
+ //Note the model value is first converted to string and so is the condition
4624
+ //so that booleans and numbers can also be compared
4625
+ conditionFun += `${amper} ${checkPath} && ${modelPath}.${ifProp}+""=='${schema.if.properties[ifProp].const}'`;
4626
+ });
4627
+ }
4628
+ condition["functionBody"] = `return ${notOp}(${conditionFun})`;
4629
+ return condition;
4630
+ }
4489
4631
 
4490
4632
  function convertSchemaToDraft6(schema, options = {}) {
4491
4633
  let draft = options.draft || null;
@@ -4786,6 +4928,17 @@ function convertSchemaToDraft6(schema, options = {}) {
4786
4928
  return newSchema;
4787
4929
  }
4788
4930
 
4931
+ /**
4932
+ * path2ControlKey takes a datapointer path like /some/pointer/path
4933
+ * and returns something like $some$pointer$path
4934
+ * used mainly to convert paths so it can be used as keys in FormGroups
4935
+ * fot ITE scenarios
4936
+ * @param path
4937
+ * @returns string
4938
+ */
4939
+ function path2ControlKey(path) {
4940
+ return path.replace(/\//g, "$");
4941
+ }
4789
4942
  /**
4790
4943
  * FormGroup function library:
4791
4944
  *
@@ -4834,11 +4987,13 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
4834
4987
  }
4835
4988
  // TODO: If nodeValue still not set, check layout for default value
4836
4989
  const schemaType = JsonPointer.get(schema, '/type');
4837
- const controlType = (hasOwn(schema, 'properties') || hasOwn(schema, 'additionalProperties')) &&
4838
- schemaType === 'object' ? 'FormGroup' :
4839
- (hasOwn(schema, 'items') || hasOwn(schema, 'additionalItems')) &&
4840
- schemaType === 'array' ? 'FormArray' :
4841
- !schemaType && hasOwn(schema, '$ref') ? '$ref' : 'FormControl';
4990
+ const isIfThenElse = hasOwn(schema, 'if') || hasOwn(schema, 'then') || hasOwn(schema, 'else');
4991
+ const controlType = isIfThenElse && !schemaType ? 'IfThenElse' :
4992
+ (hasOwn(schema, 'properties') || hasOwn(schema, 'additionalProperties')) &&
4993
+ schemaType === 'object' ? 'FormGroup' :
4994
+ (hasOwn(schema, 'items') || hasOwn(schema, 'additionalItems')) &&
4995
+ schemaType === 'array' ? 'FormArray' :
4996
+ !schemaType && hasOwn(schema, '$ref') ? '$ref' : 'FormControl';
4842
4997
  const shortDataPointer = removeRecursiveReferences(dataPointer, jsf.dataRecursiveRefMap, jsf.arrayMap);
4843
4998
  if (!jsf.dataMap.has(shortDataPointer)) {
4844
4999
  jsf.dataMap.set(shortDataPointer, new Map());
@@ -4877,11 +5032,175 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
4877
5032
  propertyKeys
4878
5033
  .filter(key => hasOwn(schema.properties, key) ||
4879
5034
  hasOwn(schema, 'additionalProperties'))
4880
- .forEach(key => controls[key] = buildFormGroupTemplate(jsf, JsonPointer.get(nodeValue, [key]), setValues, schemaPointer + (hasOwn(schema.properties, key) ?
4881
- '/properties/' + key : '/additionalProperties'), dataPointer + '/' + key, templatePointer + '/controls/' + key));
5035
+ .forEach(key => {
5036
+ controls[key] = buildFormGroupTemplate(jsf, JsonPointer.get(nodeValue, [key]), setValues, schemaPointer + (hasOwn(schema.properties, key) ?
5037
+ '/properties/' + key : '/additionalProperties'), dataPointer + '/' + key, templatePointer + '/controls/' + key);
5038
+ //add the $<control> type to the root
5039
+ //so it can be flattened and acceses directly in the formgroup
5040
+ //by its full '$' path
5041
+ ["allOf", "anyOf", "oneOf"].forEach(ofType => {
5042
+ if (controls[key].controls && controls[key].controls[`_${ofType}`]) {
5043
+ Object.keys(controls[key].controls[`_${ofType}`]).forEach($key => {
5044
+ controls[$key] = controls[key].controls[`_${ofType}`][$key];
5045
+ delete controls[key].controls[$key];
5046
+ });
5047
+ delete controls[key].controls[`_${ofType}`];
5048
+ }
5049
+ });
5050
+ });
5051
+ if (hasOwn(schema, "if")) {
5052
+ ["then", "else"].forEach(con => {
5053
+ if (hasOwn(schema, con)) {
5054
+ const keySchemaPointer = `/${con}`;
5055
+ let thenFGTemplate = buildFormGroupTemplate(jsf, nodeValue, false, //JsonPointer.get(nodeValue, keySchemaPointer), setValues,
5056
+ schemaPointer + keySchemaPointer, dataPointer, templatePointer + `/controls/${con}`);
5057
+ Object.assign(controls, thenFGTemplate.controls);
5058
+ }
5059
+ });
5060
+ }
5061
+ /* treat allOf the same as any of but need to add an extra
5062
+ condition for which anyOf item is to be rendered
5063
+ let allOfControls = {}
5064
+ let allOfAllowedKeys = ["allOf", "anyOf", "oneOf", "if", "then", "else", "type", "properties", "items"];
5065
+ if (hasOwn(schema, "allOf") && isArray(schema.allOf)) {
5066
+ schema.allOf.forEach((allOfItem, ind) => {
5067
+ let aoItemKeys = Object.keys(allOfItem);
5068
+ let foundKeys = allOfAllowedKeys.filter(value =>
5069
+ aoItemKeys.includes(value)
5070
+ );
5071
+ if (foundKeys && foundKeys.length > 0) {
5072
+ const keySchemaPointer = `/allOf/${ind}`;
5073
+ //console.log(`found:${keySchemaPointer}`);
5074
+ let allOfFGTemplate = buildFormGroupTemplate(
5075
+ jsf, JsonPointer.get(nodeValue, keySchemaPointer), setValues,
5076
+ schemaPointer + keySchemaPointer,
5077
+ dataPointer,
5078
+ templatePointer + '/controls/' + ind
5079
+ );
5080
+ if (allOfFGTemplate.controls) {
5081
+ Object.keys(allOfFGTemplate.controls).forEach(key => {
5082
+ let controlKey = allOfFGTemplate.controls[key].schemaPointer || `${schemaPointer}${keySchemaPointer}/${key}`;
5083
+ controlKey = path2ControlKey(controlKey);
5084
+ controls[controlKey] = {
5085
+ key: key,
5086
+ schemaPointer: schemaPointer + keySchemaPointer,
5087
+ controls: allOfFGTemplate.controls[key]
5088
+ }
5089
+ controls[controlKey] = allOfFGTemplate.controls[key];
5090
+ controls[controlKey].key = key;
5091
+ controls[controlKey].schemaPointer = allOfFGTemplate.controls[key].schemaPointer || schemaPointer + keySchemaPointer;
5092
+
5093
+ controls[key] = allOfFGTemplate.controls[key];
5094
+ })
5095
+ }
5096
+ //add ui type items to controls
5097
+ if (allOfItem["type"] || allOfItem["properties"] || allOfItem["items"]) {
5098
+ allOfControls[ind] = allOfFGTemplate
5099
+ }
5100
+
5101
+ }
5102
+
5103
+ })
5104
+ controls["allOf"] = allOfControls;
5105
+ }
5106
+ */
5107
+ let ofAllowedKeys = ["allOf", "anyOf", "oneOf", "if", "then", "else", "type", "properties", "items"];
5108
+ ["allOf", "anyOf", "oneOf"].forEach(ofType => {
5109
+ if (hasOwn(schema, ofType) && isArray(schema[ofType])) {
5110
+ schema[ofType].forEach((ofItem, ind) => {
5111
+ let aoItemKeys = Object.keys(ofItem);
5112
+ let foundKeys = ofAllowedKeys.filter(value => aoItemKeys.includes(value));
5113
+ if (foundKeys && foundKeys.length > 0) {
5114
+ const keySchemaPointer = `/${ofType}/${ind}`;
5115
+ //console.log(`found:${keySchemaPointer}`);
5116
+ let newNodeValue = JsonPointer.get(nodeValue, dataPointer);
5117
+ //JsonPointer.get(nodeValue, keySchemaPointer);
5118
+ if (ofType == "oneOf") {
5119
+ newNodeValue = nodeValue;
5120
+ }
5121
+ let allOfFGTemplate = buildFormGroupTemplate(jsf, newNodeValue, setValues, schemaPointer + keySchemaPointer, dataPointer, templatePointer + '/controls/' + ind);
5122
+ if (allOfFGTemplate.controls) {
5123
+ Object.keys(allOfFGTemplate.controls).forEach(key => {
5124
+ const l2SchemaPointer = hasOwn(schema, 'properties') ?
5125
+ '/properties/' + key : key;
5126
+ let controlKey = allOfFGTemplate.controls[key].schemaPointer || `${schemaPointer}${keySchemaPointer}${l2SchemaPointer}`;
5127
+ controlKey = path2ControlKey(controlKey);
5128
+ /*
5129
+ controls[controlKey] = {
5130
+ key: key,
5131
+ schemaPointer: `${schemaPointer}${keySchemaPointer}/${key}`,//schemaPointer + keySchemaPointer,
5132
+ controls: allOfFGTemplate.controls[key]
5133
+ }
5134
+ */
5135
+ let controlItem = cloneDeep(allOfFGTemplate.controls[key]);
5136
+ controlItem.key = key;
5137
+ controlItem.schemaPointer = controlItem.schemaPointer || `${schemaPointer}${keySchemaPointer}${l2SchemaPointer}`;
5138
+ controls[controlKey] = controlItem;
5139
+ //need to test if value matches schema,
5140
+ //as the same oneOf item will be assigned to the same value
5141
+ //if key is a $oneOf key then it was inserted at the root of the controls
5142
+ //as form control name will be the full(escaped) path
5143
+ const pointerPath = key.startsWith('$oneOf') ? controlItem.schemaPointer : keySchemaPointer;
5144
+ let oneOfItemSchema = JsonPointer.get(jsf.schema, controlItem.schemaPointer);
5145
+ //JsonPointer.get(schema,pointerPath);
5146
+ let dPointer = controlItem.schemaPointer.replace(/(anyOf|allOf|oneOf|none)\/[\d]+\//g, '')
5147
+ .replace(/(if|then|else|properties)\//g, '');
5148
+ //JsonPointer.toDataPointer(controlItem.schemaPointer,jsf.schema);
5149
+ let dVal = JsonPointer.get(nodeValue, dPointer);
5150
+ let fkey = key;
5151
+ let oneOfItemValue = dVal;
5152
+ /*
5153
+ if(hasOwn(oneOfItemSchema,"if") && controlItem.schemaPointer
5154
+ && controlItem.schemaPointer.indexOf(keySchemaPointer)==0){
5155
+ let parts=controlItem.schemaPointer
5156
+ .split(keySchemaPointer).join('').split("/")
5157
+ let thenOrElse=parts[1];
5158
+ fkey=parts[parts.length-1];
5159
+ oneOfItemSchema=oneOfItemSchema[thenOrElse];
5160
+ }
5161
+
5162
+ if(oneOfItemSchema.properties && jsf.formValues===undefined){
5163
+ //check if no form data values were supplied
5164
+ //then set it to default otherwise to its nodevalue
5165
+ oneOfItemValue=oneOfItemSchema.default
5166
+ oneOfItemValue[fkey]=oneOfItemSchema.properties[fkey]?.default;
5167
+ }
5168
+ if(oneOfItemSchema.properties && jsf.formValues!=undefined){
5169
+ oneOfItemValue ={};
5170
+ //nodeValue||{};
5171
+ oneOfItemValue[fkey]=nodeValue&&nodeValue[fkey];
5172
+ }
5173
+ if(!oneOfItemSchema.properties && jsf.formValues==undefined){
5174
+ oneOfItemValue=oneOfItemSchema.default;
5175
+ }
5176
+ */
5177
+ if (hasOwn(controlItem, "value")) {
5178
+ if (!jsf.ajv.validate(oneOfItemSchema, oneOfItemValue)) {
5179
+ controlItem.value.value = null;
5180
+ }
5181
+ else {
5182
+ ///controlItem.value.value=oneOfItemValue[fkey];
5183
+ controlItem.value.value = oneOfItemSchema.properties ? oneOfItemValue[fkey] : oneOfItemValue;
5184
+ }
5185
+ }
5186
+ //controls[controlKey] = controlItem;
5187
+ //allOfFGTemplate.controls[key].schemaPointer ||`${schemaPointer}${keySchemaPointer}/${key}`;
5188
+ //allOfFGTemplate.controls[key].schemaPointer || schemaPointer + keySchemaPointer;
5189
+ ///////controls[key] = cloneDeep(allOfFGTemplate.controls[key]);
5190
+ //add schemacontrol to root
5191
+ //controls[controlKey]=controlItem
5192
+ controls[`_${ofType}`] = controls[`_${ofType}`] || {};
5193
+ controls[`_${ofType}`][controlKey] = controlItem;
5194
+ //allOfFGTemplate.controls[key];
5195
+ });
5196
+ }
5197
+ }
5198
+ });
5199
+ }
5200
+ });
4882
5201
  jsf.formOptions.fieldsRequired = setRequiredFields(schema, controls);
4883
5202
  }
4884
- return { controlType, controls, validators };
5203
+ return { controlType, controls, validators, schemaPointer };
4885
5204
  case 'FormArray':
4886
5205
  controls = [];
4887
5206
  const minItems = Math.max(schema.minItems || 0, nodeOptions.get('minItems') || 0);
@@ -4938,7 +5257,7 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
4938
5257
  }
4939
5258
  }
4940
5259
  }
4941
- return { controlType, controls, validators };
5260
+ return { controlType, controls, validators, schemaPointer };
4942
5261
  case '$ref':
4943
5262
  const schemaRef = JsonPointer.compile(schema.$ref);
4944
5263
  const dataRef = JsonPointer.toDataPointer(schemaRef, schema);
@@ -4960,7 +5279,57 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
4960
5279
  value: setValues && isPrimitive(nodeValue) ? nodeValue : null,
4961
5280
  disabled: nodeOptions.get('disabled') || false
4962
5281
  };
4963
- return { controlType, value, validators };
5282
+ return { controlType, value, validators, schemaPointer };
5283
+ //TODO may make an IFThenElse widget or integrate it with the section
5284
+ //widget
5285
+ case 'IfThenElse':
5286
+ controls = {};
5287
+ let conditionType;
5288
+ if (hasOwn(schema, "if")) {
5289
+ ["then", "else"].forEach(con => {
5290
+ if (hasOwn(schema, con)) {
5291
+ const keySchemaPointer = `/${con}`;
5292
+ let thenTFGTemplate = buildFormGroupTemplate(jsf, nodeValue, false, schemaPointer + keySchemaPointer, dataPointer, templatePointer + `/controls/${con}`);
5293
+ //NB same property can be in both then and else
5294
+ //so key must be the unique path to control
5295
+ //let ifItemSchema=JsonPointer.get(schema,keySchemaPointer);
5296
+ //let ifItemValue;
5297
+ Object.keys(thenTFGTemplate.controls).forEach(key => {
5298
+ let controlKey = thenTFGTemplate.controls[key].schemaPointer;
5299
+ ////let controlItem=cloneDeep(thenTFGTemplate.controls[key]);
5300
+ ////thenTFGTemplate.controls[key].schemaPointer || `${schemaPointer}${keySchemaPointer}/${key}`;
5301
+ controlKey = path2ControlKey(controlKey);
5302
+ let cItem = Object.assign({}, thenTFGTemplate.controls[key]);
5303
+ ////cItem.schemaPointer = `${schemaPointer}${keySchemaPointer}/${key}`;
5304
+ /*
5305
+ if(ifItemSchema.properties && jsf.formValues===undefined){
5306
+ //check if no form data values were supplied
5307
+ //then set it to default otherwise to its nodevalue
5308
+ ifItemValue=ifItemSchema.default
5309
+ ifItemValue[key]=ifItemSchema.properties[key]?.default;
5310
+ }
5311
+ if(ifItemSchema.properties && jsf.formValues!=undefined){
5312
+ ifItemValue ={};
5313
+ //nodeValue||{};
5314
+ ifItemValue[key]=nodeValue&&nodeValue[key];
5315
+ }
5316
+ if(!ifItemSchema.properties && jsf.formValues==undefined){
5317
+ ifItemValue=ifItemSchema.default;
5318
+ }
5319
+ if(hasOwn(cItem,"value")){
5320
+ if(!jsf.ajv.validate(ifItemSchema,ifItemValue)){
5321
+ cItem.value.value=null;
5322
+ }else{
5323
+ cItem.value.value=ifItemValue[key];
5324
+ }
5325
+ }
5326
+ */
5327
+ controls[controlKey] = cItem;
5328
+ });
5329
+ }
5330
+ });
5331
+ }
5332
+ return { controlType, controls, validators, schemaPointer };
4964
5333
  default:
4965
5334
  return null;
4966
5335
  }
@@ -4992,7 +5361,23 @@ function buildFormGroup(template) {
4992
5361
  const groupControls = {};
4993
5362
  forEach(template.controls, (controls, key) => {
4994
5363
  const newControl = buildFormGroup(controls);
5364
+ //if (newControl) { groupControls[key] = newControl; }
4995
5365
  if (newControl) {
5366
+ /* experimental idea was to try to be able to switch
5367
+ conditional controls dynamically based on their schema pointer
5368
+ (not datapointer as that only maps to one control)
5369
+ Object.defineProperty(groupControls, key, {
5370
+ get: () => {
5371
+ //console.log(`Accessed control: ${key}`);
5372
+ //add switch logic here
5373
+ return ncontrol;
5374
+ },
5375
+ set:(value)=>{
5376
+ ncontrol=value
5377
+ },
5378
+ enumerable: true
5379
+ })
5380
+ */
4996
5381
  groupControls[key] = newControl;
4997
5382
  }
4998
5383
  });
@@ -5142,6 +5527,9 @@ function formatFormData(formData, dataMap, recursiveRefMap, arrayMap, returnEmpt
5142
5527
  }
5143
5528
  else if (typeof value !== 'object' || isDate(value) ||
5144
5529
  (value === null && returnEmptyFields)) {
5530
+ if (genericPointer.indexOf("/$") >= 0) {
5531
+ return formattedData;
5532
+ }
5145
5533
  console.error('formatFormData error: ' +
5146
5534
  `Schema type not found for form value at ${genericPointer}`);
5147
5535
  console.error('dataMap', dataMap);
@@ -5166,14 +5554,15 @@ function formatFormData(formData, dataMap, recursiveRefMap, arrayMap, returnEmpt
5166
5554
  * // {Pointer} dataPointer - JSON Pointer (string or array)
5167
5555
  * // {boolean = false} returnGroup - If true, return group containing control
5168
5556
  * // {group} - Located value (or null, if no control found)
5557
+ * // {string} schemaPointer - string used for conditional controls coming from schema if/then/else
5169
5558
  */
5170
- function getControl(formGroup, dataPointer, returnGroup = false) {
5559
+ function getControl(formGroup, dataPointer, returnGroup = false, schemaPointer) {
5171
5560
  if (!isObject(formGroup) || !JsonPointer.isJsonPointer(dataPointer)) {
5172
5561
  if (!JsonPointer.isJsonPointer(dataPointer)) {
5173
5562
  // If dataPointer input is not a valid JSON pointer, check to
5174
5563
  // see if it is instead a valid object path, using dot notaion
5175
5564
  if (typeof dataPointer === 'string') {
5176
- const formControl = formGroup.get(dataPointer);
5565
+ const formControl = formGroup.get(path2ControlKey(schemaPointer || "")) || formGroup.get(dataPointer);
5177
5566
  if (formControl) {
5178
5567
  return formControl;
5179
5568
  }
@@ -5193,7 +5582,7 @@ function getControl(formGroup, dataPointer, returnGroup = false) {
5193
5582
  // try using formGroup.get() to return the control
5194
5583
  if (typeof formGroup.get === 'function' &&
5195
5584
  dataPointerArray.every(key => key.indexOf('.') === -1)) {
5196
- const formControl = formGroup.get(dataPointerArray.join('.'));
5585
+ const formControl = formGroup.get(path2ControlKey(schemaPointer || "")) || formGroup.get(dataPointerArray.join('.'));
5197
5586
  if (formControl) {
5198
5587
  return formControl;
5199
5588
  }
@@ -5212,6 +5601,9 @@ function getControl(formGroup, dataPointer, returnGroup = false) {
5212
5601
  else if (hasOwn(subGroup, key)) {
5213
5602
  subGroup = subGroup[key];
5214
5603
  }
5604
+ else if (schemaPointer && hasOwn(subGroup, path2ControlKey(schemaPointer))) {
5605
+ subGroup = subGroup[path2ControlKey(schemaPointer)];
5606
+ }
5215
5607
  else {
5216
5608
  console.error(`getControl error: Unable to find "${key}" item in FormGroup.`);
5217
5609
  console.error(dataPointer);
@@ -5221,6 +5613,68 @@ function getControl(formGroup, dataPointer, returnGroup = false) {
5221
5613
  }
5222
5614
  return subGroup;
5223
5615
  }
5616
+ /**
5617
+ * 'setControl' function
5618
+ *
5619
+ * Uses a JSON Pointer for a data object to retrieve a control from
5620
+ * an Angular formGroup or formGroup template. (Note: though a formGroup
5621
+ * template is much simpler, its basic structure is idential to a formGroup).
5622
+ *
5623
+ * If the optional third parameter 'returnGroup' is set to TRUE, the group
5624
+ * containing the control is returned, rather than the control itself.
5625
+ *
5626
+ * // {FormGroup} formGroup - Angular FormGroup to get value from
5627
+ * // {Pointer} dataPointer - JSON Pointer (string or array)
5628
+ * // {AbstractControl} control - control used to replace existing or add
5629
+ * // {targetKey} - optional string used as the new key-not implemented as yet
5630
+ */
5631
+ function setControl(formGroup, dataPointer, control, targetKey) {
5632
+ let dataPointerArray = JsonPointer.parse(dataPointer);
5633
+ // If formGroup input is a real formGroup (not a formGroup template)
5634
+ // try using formGroup.get() to return the control
5635
+ /*
5636
+ if (typeof formGroup.get === 'function' &&
5637
+ dataPointerArray.every(key => key.indexOf('.') === -1)
5638
+ ) {
5639
+ formGroup.setControl(dataPointerArray.join('.'), control);
5640
+ return;
5641
+ }
5642
+ */
5643
+ let currentGroup = formGroup;
5644
+ for (let i = 0; i < dataPointerArray.length - 1; i++) {
5645
+ // Navigate down the form structure to find the correct nested FormGroup
5646
+ currentGroup = currentGroup.get(dataPointerArray[i]);
5647
+ // If it's not a FormGroup, we throw an error since we can't set a control in a non-group.
5648
+ if (!(typeof currentGroup.setControl === 'function')) {
5649
+ throw new Error(`Path '${dataPointerArray[i]}' is not a valid FormGroup or FormArray.`);
5650
+ }
5651
+ }
5652
+ // Now we are at the parent FormGroup, set the control at the last part of the path
5653
+ const lastPart = dataPointerArray[dataPointerArray.length - 1];
5654
+ // Set the control at the final path (like 'name' inside 'state')
5655
+ currentGroup.setControl(lastPart, control);
5656
+ // If formGroup input is a formGroup template,
5657
+ // or formGroup.get() failed to return the control,
5658
+ // search the formGroup object for dataPointer's control
5659
+ //TODO needs to be adapted to setControl
5660
+ /*
5661
+ let subGroup = formGroup;
5662
+ for (const key of dataPointerArray) {
5663
+ if (hasOwn(subGroup, 'controls')) { subGroup = subGroup.controls; }
5664
+ if (isArray(subGroup) && (key === '-')) {
5665
+ subGroup = subGroup[subGroup.length - 1];
5666
+ } else if (hasOwn(subGroup, key)) {
5667
+ subGroup = subGroup[key];
5668
+ } else {
5669
+ console.error(`getControl error: Unable to find "${key}" item in FormGroup.`);
5670
+ console.error(dataPointer);
5671
+ console.error(formGroup);
5672
+ return;
5673
+ }
5674
+ }
5675
+ return subGroup;
5676
+ */
5677
+ }
5224
5678
 
5225
5679
  /**
5226
5680
  * Layout function library:
@@ -5390,7 +5844,6 @@ function buildLayout_original(jsf, widgetLibrary) {
5390
5844
  schemaPointer = JsonPointer.toSchemaPointer(shortDataPointer, jsf.schema);
5391
5845
  nodeDataMap.set('schemaPointer', schemaPointer);
5392
5846
  }
5393
- nodeDataMap.set('disabled', !!newNode.options.disabled);
5394
5847
  nodeSchema = JsonPointer.get(jsf.schema, schemaPointer);
5395
5848
  if (nodeSchema) {
5396
5849
  if (!hasOwn(newNode, 'type')) {
@@ -5411,6 +5864,7 @@ function buildLayout_original(jsf, widgetLibrary) {
5411
5864
  newNode.dataType =
5412
5865
  nodeSchema.type || (hasOwn(nodeSchema, '$ref') ? '$ref' : null);
5413
5866
  updateInputOptions(newNode, nodeSchema, jsf);
5867
+ nodeDataMap.set('disabled', !!newNode.options.disabled);
5414
5868
  // Present checkboxes as single control, rather than array
5415
5869
  if (newNode.type === 'checkboxes' && hasOwn(nodeSchema, 'items')) {
5416
5870
  updateInputOptions(newNode, nodeSchema.items, jsf);
@@ -5837,16 +6291,50 @@ function fixNestedArrayLayout(options) {
5837
6291
  * // { string = '' } dataPointerPrefix -
5838
6292
  * //
5839
6293
  */
5840
- function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPointer = '', dataPointer = '', arrayItem = false, arrayItemType = null, removable = null, forRefLibrary = false, dataPointerPrefix = '') {
5841
- const schema = JsonPointer.get(jsf.schema, schemaPointer);
6294
+ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPointer = '', dataPointer = '', arrayItem = false, arrayItemType = null, removable = null, forRefLibrary = false, dataPointerPrefix = '', jsonSchema) {
6295
+ function applyITEConditions(builtLayout, schPointer, keySchemaPointer, negateClause, parentLayout) {
6296
+ if (builtLayout) {
6297
+ if (parentLayout && parentLayout.isITEItem && parentLayout.options.condition) {
6298
+ return;
6299
+ }
6300
+ if (isArray(builtLayout)) {
6301
+ builtLayout.forEach(item => {
6302
+ item.isITEItem = true;
6303
+ item.options.condition = convertJSONSchemaIfToCondition(schema, item, negateClause);
6304
+ applyITEConditions(item, schPointer, keySchemaPointer, negateClause, builtLayout);
6305
+ //item.schemaPointer = schPointer + keySchemaPointer + item.dataPointer;
6306
+ //item.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
6307
+ //newSection.push(item);
6308
+ });
6309
+ }
6310
+ else if (hasOwn(builtLayout, "items")) {
6311
+ applyITEConditions(builtLayout.items, schPointer, keySchemaPointer, negateClause, builtLayout);
6312
+ // builtLayout.items.forEach(item => {
6313
+ // item.isITEItem=true;
6314
+ // item.options.condition = convertJSONSchemaIfToCondition(schema,item, negateClause);
6315
+ // applyITEConditions(item,schPointer,keySchemaPointer,negateClause)
6316
+ // });
6317
+ }
6318
+ else {
6319
+ builtLayout.isITEItem = true;
6320
+ //builtLayout.schemaPointer = `${schPointer}${keySchemaPointer}/${builtLayout.name}`;
6321
+ builtLayout.options.condition = convertJSONSchemaIfToCondition(schema, builtLayout, negateClause);
6322
+ //newSection.push(builtLayout)
6323
+ }
6324
+ }
6325
+ }
6326
+ const jsSchema = jsonSchema || jsf.schema;
6327
+ const schema = JsonPointer.get(jsSchema, schemaPointer);
6328
+ //JsonPointer.get(jsf.schema, schemaPointer);
5842
6329
  if (!hasOwn(schema, 'type') && !hasOwn(schema, '$ref') &&
5843
- !hasOwn(schema, 'x-schema-form')) {
6330
+ !hasOwn(schema, 'x-schema-form')
6331
+ && !hasOwn(schema, 'if') && !hasOwn(schema, 'then') && !hasOwn(schema, 'else')) {
5844
6332
  return null;
5845
6333
  }
5846
6334
  const newNodeType = getInputType(schema);
5847
6335
  if (!isDefined(nodeValue) && (jsf.formOptions.setSchemaDefaults === true ||
5848
6336
  (jsf.formOptions.setSchemaDefaults === 'auto' && isEmpty(jsf.formValues)))) {
5849
- nodeValue = JsonPointer.get(jsf.schema, schemaPointer + '/default');
6337
+ nodeValue = JsonPointer.get(jsSchema, schemaPointer + '/default');
5850
6338
  }
5851
6339
  let newNode = {
5852
6340
  _id: forRefLibrary ? null : uniqueId(),
@@ -5854,7 +6342,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
5854
6342
  dataPointer: JsonPointer.toGenericPointer(dataPointer, jsf.arrayMap),
5855
6343
  dataType: schema.type || (hasOwn(schema, '$ref') ? '$ref' : null),
5856
6344
  options: {},
5857
- required: isInputRequired(jsf.schema, schemaPointer),
6345
+ required: isInputRequired(jsSchema, schemaPointer),
5858
6346
  type: newNodeType,
5859
6347
  widget: widgetLibrary.getWidget(newNodeType),
5860
6348
  };
@@ -5872,6 +6360,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
5872
6360
  if (!jsf.dataMap.has(shortDataPointer)) {
5873
6361
  jsf.dataMap.set(shortDataPointer, new Map());
5874
6362
  }
6363
+ updateInputOptions(newNode, schema, jsf);
5875
6364
  const nodeDataMap = jsf.dataMap.get(shortDataPointer);
5876
6365
  if (!nodeDataMap.has('inputType')) {
5877
6366
  nodeDataMap.set('schemaPointer', schemaPointer);
@@ -5879,7 +6368,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
5879
6368
  nodeDataMap.set('widget', newNode.widget);
5880
6369
  nodeDataMap.set('disabled', !!newNode.options.disabled);
5881
6370
  }
5882
- updateInputOptions(newNode, schema, jsf);
6371
+ //updateInputOptions(newNode, schema, jsf);
5883
6372
  if (!newNode.options.title && newNode.name && !/^\d+$/.test(newNode.name)) {
5884
6373
  newNode.options.title = fixTitle(newNode.name);
5885
6374
  }
@@ -5907,6 +6396,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
5907
6396
  '/properties/' + key : '/additionalProperties';
5908
6397
  const innerItem = buildLayoutFromSchema(jsf, widgetLibrary, isObject(nodeValue) ? nodeValue[key] : null, schemaPointer + keySchemaPointer, dataPointer + '/' + key, false, null, null, forRefLibrary, dataPointerPrefix);
5909
6398
  if (innerItem) {
6399
+ innerItem.schemaPointer = schemaPointer + keySchemaPointer;
5910
6400
  if (isInputRequired(schema, '/' + key)) {
5911
6401
  innerItem.options.required = true;
5912
6402
  jsf.fieldsRequired = true;
@@ -5914,6 +6404,102 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
5914
6404
  newSection.push(innerItem);
5915
6405
  }
5916
6406
  });
6407
+ //treat allOf the same as any of but need to add an extra
6408
+ //condition for which anyOf item is to be rendered
6409
+ ["allOf", "anyOf", "oneOf"].forEach(ofType => {
6410
+ if (hasOwn(schema, ofType) && isArray(schema[ofType])) {
6411
+ let outerOneOfItem;
6412
+ if (ofType == "oneOf") {
6413
+ outerOneOfItem = buildLayoutFromSchema(jsf, widgetLibrary, schema.oneOf, //{type:"tabarray",items:schema.oneOf},
6414
+ "/", //schemaPointer + `/${ofType}`,
6415
+ dataPointer, false, null, null, forRefLibrary, dataPointerPrefix,
6416
+ //{type:"tabarray",items:schema.oneOf,oneOf:schema.oneOf}
6417
+ { type: "one-of", items: schema.oneOf, oneOf: schema.oneOf });
6418
+ //outerItem.items=cloneDeep(newSection);
6419
+ //newSection.length=0;
6420
+ newSection.push(outerOneOfItem);
6421
+ }
6422
+ schema[ofType].forEach((ofItem, ind) => {
6423
+ const keySchemaPointer = `/${ofType}/${ind}`;
6424
+ const innerItem = buildLayoutFromSchema(jsf, widgetLibrary, ofItem, schemaPointer + keySchemaPointer, dataPointer, false, null, null, ofType == "oneOf" /*forRefLibrary*/, dataPointerPrefix);
6425
+ if (innerItem) {
6426
+ //newSection.push(innerItem);
6427
+ if (innerItem.items) {
6428
+ innerItem.items.forEach(innerItemLevel2 => {
6429
+ const l2SchemaPointer = hasOwn(ofItem, 'properties') ?
6430
+ '/properties/' + innerItemLevel2.name : innerItemLevel2.name;
6431
+ //innerItemLevel2.oneOfPointer = schemaPointer + keySchemaPointer + l2SchemaPointer;
6432
+ // innerItemLevel2.schemaPointer=innerItemLevel2.schemaPointer;
6433
+ innerItemLevel2.oneOfPointer = innerItemLevel2.schemaPointer;
6434
+ });
6435
+ }
6436
+ //TODO review-will never reach here if forRefLibrary==true
6437
+ if (isArray(innerItem)) {
6438
+ let outerOneOfItemTpl = cloneDeep(newNode);
6439
+ outerOneOfItemTpl;
6440
+ innerItem.forEach(item => {
6441
+ const l2SchemaPointer = hasOwn(ofItem, 'properties') ?
6442
+ '/properties/' + item.name : item.name;
6443
+ if (outerOneOfItem) {
6444
+ ////item.oneOfPointer = schemaPointer + keySchemaPointer + l2SchemaPointer;
6445
+ //schemaPointer + keySchemaPointer + item.dataPointer;
6446
+ ////item.schemaPointer=item.oneOfPointer;
6447
+ /*
6448
+ outerOneOfItem.items=outerOneOfItem.items||[];
6449
+ outerOneOfItem.items.push(item);
6450
+ */
6451
+ outerOneOfItemTpl.items = outerOneOfItemTpl.items || [];
6452
+ outerOneOfItemTpl.items.push(item);
6453
+ }
6454
+ else {
6455
+ newSection.push(item);
6456
+ }
6457
+ });
6458
+ if (outerOneOfItem) {
6459
+ outerOneOfItem.items = outerOneOfItem.items || [];
6460
+ outerOneOfItem.items.push(outerOneOfItemTpl);
6461
+ }
6462
+ //TODO test-might not work for more than 2 levels of nesting
6463
+ }
6464
+ else {
6465
+ if (outerOneOfItem) {
6466
+ innerItem.oneOfPointer = schemaPointer + keySchemaPointer; // + innerItem.dataPointer;
6467
+ ////innerItem.schemaPointer=innerItem.oneOfPointer;
6468
+ outerOneOfItem.items = outerOneOfItem.items || [];
6469
+ outerOneOfItem.items.push(innerItem);
6470
+ }
6471
+ else {
6472
+ newSection.push(innerItem);
6473
+ }
6474
+ }
6475
+ }
6476
+ });
6477
+ }
6478
+ });
6479
+ if (hasOwn(schema, "if")) {
6480
+ ["then", "else"].forEach(con => {
6481
+ if (hasOwn(schema, con)) {
6482
+ const keySchemaPointer = `/${con}`;
6483
+ const negateClause = con == "else";
6484
+ const innerItem = buildLayoutFromSchema(jsf, widgetLibrary, nodeValue.then, schemaPointer + keySchemaPointer, dataPointer, false, null, null, forRefLibrary, dataPointerPrefix);
6485
+ if (innerItem) {
6486
+ applyITEConditions(innerItem, schemaPointer, keySchemaPointer, negateClause);
6487
+ if (isArray(innerItem)) {
6488
+ innerItem.forEach(item => {
6489
+ //item.schemaPointer = schemaPointer + keySchemaPointer + item.dataPointer;
6490
+ //item.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
6491
+ newSection.push(item);
6492
+ });
6493
+ }
6494
+ else {
6495
+ //innerItem.schemaPointer = schemaPointer + keySchemaPointer + innerItem.dataPointer;
6496
+ //innerItem.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
6497
+ newSection.push(innerItem);
6498
+ }
6499
+ }
6500
+ }
6501
+ });
6502
+ }
5917
6503
  if (dataPointer === '' && !forRefLibrary) {
5918
6504
  newNode = newSection;
5919
6505
  }
@@ -5930,7 +6516,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
5930
6516
  newNode.items = [];
5931
6517
  newNode.options.maxItems = Math.min(schema.maxItems || 1000, newNode.options.maxItems || 1000);
5932
6518
  newNode.options.minItems = Math.max(schema.minItems || 0, newNode.options.minItems || 0);
5933
- if (!newNode.options.minItems && isInputRequired(jsf.schema, schemaPointer)) {
6519
+ if (!newNode.options.minItems && isInputRequired(jsSchema, schemaPointer)) {
5934
6520
  newNode.options.minItems = 1;
5935
6521
  }
5936
6522
  if (!hasOwn(newNode.options, 'listItems')) {
@@ -6063,7 +6649,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6063
6649
  }
6064
6650
  else if (newNode.dataType === '$ref') {
6065
6651
  const schemaRef = JsonPointer.compile(schema.$ref);
6066
- const dataRef = JsonPointer.toDataPointer(schemaRef, jsf.schema);
6652
+ const dataRef = JsonPointer.toDataPointer(schemaRef, jsSchema);
6067
6653
  let buttonText = '';
6068
6654
  // Get newNode title
6069
6655
  if (newNode.options.add) {
@@ -6075,7 +6661,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6075
6661
  // If newNode doesn't have a title, look for title of parent array item
6076
6662
  }
6077
6663
  else {
6078
- const parentSchema = JsonPointer.get(jsf.schema, schemaPointer, 0, -1);
6664
+ const parentSchema = JsonPointer.get(jsSchema, schemaPointer, 0, -1);
6079
6665
  if (hasOwn(parentSchema, 'title')) {
6080
6666
  buttonText = 'Add to ' + parentSchema.title;
6081
6667
  }
@@ -6093,9 +6679,9 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6093
6679
  removable: false,
6094
6680
  title: buttonText,
6095
6681
  });
6096
- if (isNumber(JsonPointer.get(jsf.schema, schemaPointer, 0, -1).maxItems)) {
6682
+ if (isNumber(JsonPointer.get(jsSchema, schemaPointer, 0, -1).maxItems)) {
6097
6683
  newNode.options.maxItems =
6098
- JsonPointer.get(jsf.schema, schemaPointer, 0, -1).maxItems;
6684
+ JsonPointer.get(jsSchema, schemaPointer, 0, -1).maxItems;
6099
6685
  }
6100
6686
  // Add layout template to layoutRefLibrary
6101
6687
  if (dataRef.length) {
@@ -6116,6 +6702,32 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6116
6702
  }
6117
6703
  }
6118
6704
  }
6705
+ else if (newNode.type === 'if') {
6706
+ const newSection = [];
6707
+ ["then", "else"].forEach(con => {
6708
+ if (hasOwn(schema, con)) {
6709
+ const keySchemaPointer = `/${con}`;
6710
+ const negateClause = con == "else";
6711
+ const innerItem = buildLayoutFromSchema(jsf, widgetLibrary, nodeValue.then, schemaPointer + keySchemaPointer, dataPointer, false, null, null, forRefLibrary, dataPointerPrefix);
6712
+ if (innerItem) {
6713
+ applyITEConditions(innerItem, schemaPointer, keySchemaPointer, negateClause);
6714
+ if (isArray(innerItem)) {
6715
+ innerItem.forEach(item => {
6716
+ //item.schemaPointer = schemaPointer + keySchemaPointer + item.dataPointer;
6717
+ //item.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
6718
+ newSection.push(item);
6719
+ newNode = newSection;
6720
+ });
6721
+ }
6722
+ else {
6723
+ //innerItem.schemaPointer = schemaPointer + keySchemaPointer + innerItem.dataPointer;
6724
+ //innerItem.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
6725
+ newNode = innerItem;
6726
+ }
6727
+ }
6728
+ }
6729
+ });
6730
+ }
6119
6731
  return newNode;
6120
6732
  }
6121
6733
  /**
@@ -6382,6 +6994,32 @@ class JsonSchemaFormService {
6382
6994
  setSortableOptions(value) {
6383
6995
  this.sortableOptionsSubject.next(value); // Update the sortable options value
6384
6996
  }
6997
+ createAjvInstance(ajvOptions) {
6998
+ let ajvInstance = new Ajv2019(ajvOptions);
6999
+ ajvInstance.addMetaSchema(jsonDraft6);
7000
+ ajvInstance.addMetaSchema(jsonDraft7);
7001
+ addFormats(ajvInstance);
7002
+ return ajvInstance;
7003
+ }
7004
+ createAndRegisterAjvInstance(ajvOptions, name) {
7005
+ const intanceName = name || `ajv_${Date.now()}`;
7006
+ if (this.ajvRegistry[intanceName]) {
7007
+ throw new Error(`ajv instance with name:'${intanceName}' has already been registered`);
7008
+ }
7009
+ const ajvInstance = this.createAjvInstance(ajvOptions);
7010
+ this.ajvRegistry[intanceName] = {
7011
+ name: intanceName,
7012
+ ajvInstance: ajvInstance,
7013
+ ajvValidator: null
7014
+ };
7015
+ return this.ajvRegistry[intanceName];
7016
+ }
7017
+ getAjvInstance(name = 'default') {
7018
+ return this.ajvRegistry[name].ajvInstance;
7019
+ }
7020
+ getAjvValidator(name = 'default') {
7021
+ return this.ajvRegistry[name]?.ajvValidator;
7022
+ }
6385
7023
  constructor() {
6386
7024
  this.JsonFormCompatibility = false;
6387
7025
  this.ReactJsonSchemaFormCompatibility = false;
@@ -6389,10 +7027,11 @@ class JsonSchemaFormService {
6389
7027
  this.tpldata = {};
6390
7028
  this.ajvOptions = {
6391
7029
  allErrors: true,
6392
- validateFormats: false,
7030
+ //validateFormats:false,
6393
7031
  strict: false
6394
7032
  };
6395
7033
  this.ajv = new Ajv2019(this.ajvOptions); // AJV: Another JSON Schema Validator
7034
+ //Being replaced by getAjvValidator()
6396
7035
  this.validateFormData = null; // Compiled AJV function to validate active form's schema
6397
7036
  this.formValues = {}; // Internal form data (may not have correct types)
6398
7037
  this.data = {}; // Output form data (formValues, formatted with correct data types)
@@ -6466,6 +7105,7 @@ class JsonSchemaFormService {
6466
7105
  validationMessages: {} // set by setLanguage()
6467
7106
  }
6468
7107
  };
7108
+ //TODO-review,may not be needed as sortablejs replaces dnd
6469
7109
  //this has been added to enable or disable the dragabble state of a component
6470
7110
  //using the OrderableDirective, mainly when an <input type="range">
6471
7111
  //elements are present, as the draggable attribute makes it difficult to
@@ -6478,9 +7118,19 @@ class JsonSchemaFormService {
6478
7118
  //nxt-sortablejs and sortablejs
6479
7119
  this.sortableOptionsSubject = new BehaviorSubject({ disabled: false }); // Default value true
6480
7120
  this.sortableOptions$ = this.sortableOptionsSubject.asObservable();
7121
+ this.ajvRegistry = {};
6481
7122
  this.setLanguage(this.language);
6482
7123
  this.ajv.addMetaSchema(jsonDraft6);
6483
7124
  this.ajv.addMetaSchema(jsonDraft7);
7125
+ addFormats(this.ajv);
7126
+ this.ajvRegistry['default'] = { name: 'default', ajvInstance: this.ajv, ajvValidator: null };
7127
+ // Add custom 'duration' format using a regex
7128
+ /*
7129
+ this.ajv.addFormat("duration", {
7130
+ type: "string",
7131
+ validate: (duration) => /^P(?!$)(\d+Y)?(\d+M)?(\d+D)?(T(\d+H)?(\d+M)?(\d+S)?)?$/.test(duration)
7132
+ });
7133
+ */
6484
7134
  }
6485
7135
  ngOnDestroy() {
6486
7136
  this.fcValueChangesSubs?.unsubscribe();
@@ -6519,7 +7169,7 @@ class JsonSchemaFormService {
6519
7169
  this.ReactJsonSchemaFormCompatibility = false;
6520
7170
  this.AngularSchemaFormCompatibility = false;
6521
7171
  this.tpldata = {};
6522
- this.validateFormData = null;
7172
+ this.validateFormData = null; //Being replaced by getAjvValidator()
6523
7173
  this.formValues = {};
6524
7174
  this.schema = {};
6525
7175
  this.layout = [];
@@ -6538,6 +7188,8 @@ class JsonSchemaFormService {
6538
7188
  this.schemaRefLibrary = {};
6539
7189
  this.templateRefLibrary = {};
6540
7190
  this.formOptions = cloneDeep(this.defaultFormOptions);
7191
+ this.ajvRegistry = {};
7192
+ this.ajvRegistry['default'] = { name: 'default', ajvInstance: this.ajv, ajvValidator: null };
6541
7193
  }
6542
7194
  /**
6543
7195
  * 'buildRemoteError' function
@@ -6569,10 +7221,10 @@ class JsonSchemaFormService {
6569
7221
  }
6570
7222
  });
6571
7223
  }
6572
- validateData(newValue, updateSubscriptions = true) {
7224
+ validateData(newValue, updateSubscriptions = true, ajvInstanceName = 'default') {
6573
7225
  // Format raw form data to correct data types
6574
7226
  this.data = formatFormData(newValue, this.dataMap, this.dataRecursiveRefMap, this.arrayMap, this.formOptions.returnEmptyFields);
6575
- this.isValid = this.validateFormData(this.data);
7227
+ this.isValid = this.getAjvValidator(ajvInstanceName)(this.data);
6576
7228
  this.validData = this.isValid ? this.data : null;
6577
7229
  const compileErrors = (errors) => {
6578
7230
  const compiledErrors = {};
@@ -6587,8 +7239,9 @@ class JsonSchemaFormService {
6587
7239
  });
6588
7240
  return compiledErrors;
6589
7241
  };
6590
- this.ajvErrors = this.validateFormData.errors;
6591
- this.validationErrors = compileErrors(this.validateFormData.errors);
7242
+ //TODO:store avjErrors per ajvInstance in registry
7243
+ this.ajvErrors = this.getAjvValidator(ajvInstanceName).errors;
7244
+ this.validationErrors = compileErrors(this.ajvErrors);
6592
7245
  if (updateSubscriptions) {
6593
7246
  this.dataChanges.next(this.data);
6594
7247
  this.isValidChanges.next(this.isValid);
@@ -6598,16 +7251,16 @@ class JsonSchemaFormService {
6598
7251
  buildFormGroupTemplate(formValues = null, setValues = true) {
6599
7252
  this.formGroupTemplate = buildFormGroupTemplate(this, formValues, setValues);
6600
7253
  }
6601
- buildFormGroup() {
7254
+ buildFormGroup(ajvInstanceName) {
6602
7255
  this.formGroup = buildFormGroup(this.formGroupTemplate);
6603
7256
  if (this.formGroup) {
6604
- this.compileAjvSchema();
6605
- this.validateData(this.formGroup.value);
7257
+ this.compileAjvSchema(ajvInstanceName);
7258
+ this.validateData(this.formGroup.value, true, ajvInstanceName);
6606
7259
  // Set up observables to emit data and validation info when form data changes
6607
7260
  if (this.formValueSubscription) {
6608
7261
  this.formValueSubscription.unsubscribe();
6609
7262
  }
6610
- this.formValueSubscription = this.formGroup.valueChanges.subscribe(formValue => this.validateData(formValue));
7263
+ this.formValueSubscription = this.formGroup.valueChanges.subscribe(formValue => this.validateData(formValue, true, ajvInstanceName));
6611
7264
  }
6612
7265
  }
6613
7266
  buildLayout(widgetLibrary) {
@@ -6636,15 +7289,17 @@ class JsonSchemaFormService {
6636
7289
  });
6637
7290
  }
6638
7291
  }
6639
- compileAjvSchema() {
6640
- if (!this.validateFormData) {
7292
+ compileAjvSchema(ajvInstanceName = 'default') {
7293
+ let ajvValidator = this.getAjvValidator(ajvInstanceName);
7294
+ if (!ajvValidator) {
6641
7295
  // if 'ui:order' exists in properties, move it to root before compiling with ajv
6642
7296
  if (Array.isArray(this.schema.properties['ui:order'])) {
6643
7297
  this.schema['ui:order'] = this.schema.properties['ui:order'];
6644
7298
  delete this.schema.properties['ui:order'];
6645
7299
  }
6646
- this.ajv.removeSchema(this.schema);
6647
- this.validateFormData = this.ajv.compile(this.schema);
7300
+ this.getAjvInstance(ajvInstanceName).removeSchema(this.schema);
7301
+ ajvValidator = this.getAjvInstance(ajvInstanceName).compile(this.schema);
7302
+ this.ajvRegistry[ajvInstanceName].ajvValidator = ajvValidator;
6648
7303
  }
6649
7304
  }
6650
7305
  buildSchemaFromData(data, requireAllFields = false) {
@@ -6806,12 +7461,24 @@ class JsonSchemaFormService {
6806
7461
  if (!isObject(ctx)) {
6807
7462
  return false;
6808
7463
  }
7464
+ const layoutNode = ctx.layoutNode();
6809
7465
  if (isEmpty(ctx.options)) {
6810
- ctx.options = !isEmpty((ctx.layoutNode() || {}).options)
6811
- ? ctx.layoutNode().options
7466
+ ctx.options = !isEmpty((layoutNode || {}).options)
7467
+ ? layoutNode.options
6812
7468
  : cloneDeep(this.formOptions);
6813
7469
  }
6814
7470
  ctx.formControl = this.getFormControl(ctx);
7471
+ //introduced to check if the node is part of ITE conditional
7472
+ //then change or add the control
7473
+ if (layoutNode?.schemaPointer && layoutNode.isITEItem ||
7474
+ (layoutNode?.schemaPointer && layoutNode?.oneOfPointer)) {
7475
+ //before changing control, need to set the new data type for data formatting
7476
+ const schemaType = this.dataMap.get(layoutNode?.dataPointer).get("schemaType");
7477
+ if (schemaType != layoutNode.dataType) {
7478
+ this.dataMap.get(layoutNode?.dataPointer).set("schemaType", layoutNode.dataType);
7479
+ }
7480
+ this.setFormControl(ctx, ctx.formControl);
7481
+ }
6815
7482
  ctx.boundControl = bind && !!ctx.formControl;
6816
7483
  if (ctx.formControl) {
6817
7484
  ctx.controlName = this.getFormControlName(ctx);
@@ -6830,27 +7497,40 @@ class JsonSchemaFormService {
6830
7497
  ? null
6831
7498
  : this.formatErrors(ctx.formControl.errors, ctx.options.validationMessages)));
6832
7499
  this.fcValueChangesSubs = ctx.formControl.valueChanges.subscribe(value => {
6833
- //commented out to revert back to previous commits
6834
- //as seems to be causing some issues
6835
- /*
6836
- if (!!value) {
6837
- ctx.controlValue = value;
6838
- }
6839
- */
6840
- //TODO-test,this is the original code
6841
7500
  if (!isEqual$1(ctx.controlValue, value)) {
6842
7501
  ctx.controlValue = value;
6843
7502
  }
6844
7503
  });
6845
7504
  }
6846
7505
  else {
6847
- ctx.controlName = ctx.layoutNode().name;
6848
- ctx.controlValue = ctx.layoutNode().value || null;
7506
+ ctx.controlName = layoutNode.name;
7507
+ ctx.controlValue = layoutNode.value || null;
6849
7508
  const dataPointer = this.getDataPointer(ctx);
6850
7509
  if (bind && dataPointer) {
6851
7510
  console.error(`warning: control "${dataPointer}" is not bound to the Angular FormGroup.`);
6852
7511
  }
6853
7512
  }
7513
+ //if this is a ITE conditional field, the value would not have been
7514
+ //set, as the control would only be initialized when the condition is true
7515
+ //TODO-review need to decide which of the data sets between data,formValues and default
7516
+ //to use for the value
7517
+ if (ctx.options?.condition || layoutNode?.oneOfPointer) {
7518
+ const dataPointer = this.getDataPointer(ctx);
7519
+ const controlValue = ctx.formControl.value;
7520
+ const dataValue = JsonPointer.has(this.data, dataPointer) ?
7521
+ JsonPointer.get(this.data, dataPointer) : undefined;
7522
+ const formValue = JsonPointer.has(this.formValues, dataPointer) ?
7523
+ JsonPointer.get(this.formValues, dataPointer) : undefined;
7524
+ const schemaDefault = ctx.options?.default;
7525
+ //if initial formValues was supplied and controlValue matches formValue then likely
7526
+ //control was initially created with the formValue then set value to data value
7527
+ //if no formValues was supplied and controlValue matches schemaDefault then likely
7528
+ //control was initially created with the default then set value to data value
7529
+ const value = this.formValues && isEqual$1(formValue, controlValue) ? dataValue
7530
+ : !this.formValues && isEqual$1(schemaDefault, controlValue) ? dataValue
7531
+ : schemaDefault;
7532
+ ctx.formControl?.patchValue(value);
7533
+ }
6854
7534
  return ctx.boundControl;
6855
7535
  }
6856
7536
  formatErrors(errors, validationMessages = {}) {
@@ -6932,13 +7612,50 @@ class JsonSchemaFormService {
6932
7612
  }
6933
7613
  formArray.markAsDirty();
6934
7614
  }
7615
+ updateArrayMultiSelectList(ctx, selectList) {
7616
+ this.updateArrayCheckboxList(ctx, selectList);
7617
+ /* const formArray = <UntypedFormArray>this.getFormControl(ctx);
7618
+
7619
+ // Remove all existing items
7620
+ while (formArray.value.length) {
7621
+ formArray.removeAt(0);
7622
+ }
7623
+
7624
+ // Re-add an item for each checked box
7625
+ const refPointer = removeRecursiveReferences(
7626
+ ctx.layoutNode().dataPointer + '/-',
7627
+ this.dataRecursiveRefMap,
7628
+ this.arrayMap
7629
+ );
7630
+ for (const selectItem of selectList) {
7631
+ if (selectItem.value) {
7632
+ const newFormControl = buildFormGroup(
7633
+ this.templateRefLibrary[refPointer]
7634
+ );
7635
+ newFormControl.setValue(selectItem.value);
7636
+ formArray.push(newFormControl);
7637
+ }
7638
+ }
7639
+ formArray.markAsDirty();
7640
+ */
7641
+ }
6935
7642
  getFormControl(ctx) {
6936
7643
  if (!ctx || !ctx.layoutNode ||
6937
7644
  !isDefined(ctx.layoutNode().dataPointer) ||
6938
7645
  ctx.layoutNode().type === '$ref') {
6939
7646
  return null;
6940
7647
  }
6941
- return getControl(this.formGroup, this.getDataPointer(ctx));
7648
+ const schemaPointer = ctx.layoutNode()?.isITEItem ? ctx.layoutNode()?.schemaPointer : null;
7649
+ const oneOfPointer = ctx.layoutNode()?.oneOfPointer;
7650
+ return getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer);
7651
+ }
7652
+ setFormControl(ctx, control) {
7653
+ if (!ctx || !ctx.layoutNode ||
7654
+ !isDefined(ctx.layoutNode().dataPointer) ||
7655
+ ctx.layoutNode().type === '$ref') {
7656
+ return null;
7657
+ }
7658
+ return setControl(this.formGroup, this.getDataPointer(ctx), control);
6942
7659
  }
6943
7660
  getFormControlValue(ctx) {
6944
7661
  if (!ctx || !ctx.layoutNode ||
@@ -6946,14 +7663,18 @@ class JsonSchemaFormService {
6946
7663
  ctx.layoutNode().type === '$ref') {
6947
7664
  return null;
6948
7665
  }
6949
- const control = getControl(this.formGroup, this.getDataPointer(ctx));
7666
+ const schemaPointer = ctx.layoutNode()?.isITEItem ? ctx.layoutNode()?.schemaPointer : null;
7667
+ const oneOfPointer = ctx.layoutNode()?.oneOfPointer;
7668
+ const control = getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer);
6950
7669
  return control ? control.value : null;
6951
7670
  }
6952
7671
  getFormControlGroup(ctx) {
6953
7672
  if (!ctx || !ctx.layoutNode || !isDefined(ctx.layoutNode().dataPointer)) {
6954
7673
  return null;
6955
7674
  }
6956
- return getControl(this.formGroup, this.getDataPointer(ctx), true);
7675
+ const schemaPointer = ctx.layoutNode()?.isITEItem ? ctx.layoutNode()?.schemaPointer : null;
7676
+ const oneOfPointer = ctx.layoutNode()?.oneOfPointer;
7677
+ return getControl(this.formGroup, this.getDataPointer(ctx), true, schemaPointer || oneOfPointer);
6957
7678
  }
6958
7679
  getFormControlName(ctx) {
6959
7680
  if (!ctx || !ctx.layoutNode ||
@@ -7072,10 +7793,10 @@ class JsonSchemaFormService {
7072
7793
  JsonPointer.remove(this.layout, this.getLayoutPointer(ctx));
7073
7794
  return true;
7074
7795
  }
7075
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonSchemaFormService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
7076
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonSchemaFormService }); }
7796
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonSchemaFormService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
7797
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonSchemaFormService }); }
7077
7798
  }
7078
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonSchemaFormService, decorators: [{
7799
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonSchemaFormService, decorators: [{
7079
7800
  type: Injectable
7080
7801
  }], ctorParameters: () => [] });
7081
7802
 
@@ -7105,10 +7826,10 @@ class SelectWidgetComponent {
7105
7826
  }
7106
7827
  }
7107
7828
  }
7108
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SelectWidgetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7109
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.6", type: SelectWidgetComponent, isStandalone: false, selector: "select-widget-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "widgetContainer", first: true, predicate: ["widgetContainer"], descendants: true, read: ViewContainerRef, isSignal: true }], usesOnChanges: true, ngImport: i0, template: `<div #widgetContainer></div>`, isInline: true }); }
7829
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SelectWidgetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7830
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.14", type: SelectWidgetComponent, isStandalone: false, selector: "select-widget-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "widgetContainer", first: true, predicate: ["widgetContainer"], descendants: true, read: ViewContainerRef, isSignal: true }], usesOnChanges: true, ngImport: i0, template: `<div #widgetContainer></div>`, isInline: true }); }
7110
7831
  }
7111
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SelectWidgetComponent, decorators: [{
7832
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SelectWidgetComponent, decorators: [{
7112
7833
  type: Component,
7113
7834
  args: [{
7114
7835
  // tslint:disable-next-line:component-selector
@@ -7124,10 +7845,10 @@ class NoFrameworkComponent {
7124
7845
  this.layoutIndex = input(undefined);
7125
7846
  this.dataIndex = input(undefined);
7126
7847
  }
7127
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoFrameworkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7128
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: NoFrameworkComponent, isStandalone: false, selector: "no-framework", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<select-widget-widget [dataIndex]=\"dataIndex()\" [layoutIndex]=\"layoutIndex()\" [layoutNode]=\"layoutNode()\">\r\n</select-widget-widget>", dependencies: [{ kind: "component", type: SelectWidgetComponent, selector: "select-widget-widget", inputs: ["layoutNode", "layoutIndex", "dataIndex"] }] }); }
7848
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFrameworkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7849
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: NoFrameworkComponent, isStandalone: false, selector: "no-framework", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<select-widget-widget [dataIndex]=\"dataIndex()\" [layoutIndex]=\"layoutIndex()\" [layoutNode]=\"layoutNode()\">\r\n</select-widget-widget>", dependencies: [{ kind: "component", type: SelectWidgetComponent, selector: "select-widget-widget", inputs: ["layoutNode", "layoutIndex", "dataIndex"] }] }); }
7129
7850
  }
7130
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoFrameworkComponent, decorators: [{
7851
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFrameworkComponent, decorators: [{
7131
7852
  type: Component,
7132
7853
  args: [{ selector: 'no-framework', standalone: false, template: "<select-widget-widget [dataIndex]=\"dataIndex()\" [layoutIndex]=\"layoutIndex()\" [layoutNode]=\"layoutNode()\">\r\n</select-widget-widget>" }]
7133
7854
  }] });
@@ -7140,10 +7861,10 @@ class NoFramework extends Framework {
7140
7861
  this.text = 'None (plain HTML)';
7141
7862
  this.framework = NoFrameworkComponent;
7142
7863
  }
7143
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoFramework, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
7144
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoFramework }); }
7864
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFramework, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
7865
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFramework }); }
7145
7866
  }
7146
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoFramework, decorators: [{
7867
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFramework, decorators: [{
7147
7868
  type: Injectable
7148
7869
  }] });
7149
7870
 
@@ -7165,10 +7886,10 @@ class ElementAttributeDirective {
7165
7886
  }
7166
7887
  }
7167
7888
  }
7168
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ElementAttributeDirective, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
7169
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.6", type: ElementAttributeDirective, isStandalone: false, selector: "[attributes]", inputs: { attributes: "attributes" }, usesOnChanges: true, ngImport: i0 }); }
7889
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: ElementAttributeDirective, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
7890
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.14", type: ElementAttributeDirective, isStandalone: false, selector: "[attributes]", inputs: { attributes: "attributes" }, usesOnChanges: true, ngImport: i0 }); }
7170
7891
  }
7171
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ElementAttributeDirective, decorators: [{
7892
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: ElementAttributeDirective, decorators: [{
7172
7893
  type: Directive,
7173
7894
  args: [{
7174
7895
  selector: '[attributes]',
@@ -7205,29 +7926,33 @@ class AddReferenceComponent {
7205
7926
  return parent.layoutNode.add ||
7206
7927
  this.jsf.setArrayItemTitle(parent, this.layoutNode(), this.itemCount);
7207
7928
  }
7208
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: AddReferenceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7209
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: AddReferenceComponent, isStandalone: false, selector: "add-reference-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
7210
- <button *ngIf="showAddButton"
7211
- [class]="options?.fieldHtmlClass || ''"
7212
- [disabled]="options?.readonly"
7213
- (click)="addItem($event)">
7214
- <span *ngIf="options?.icon" [class]="options?.icon"></span>
7215
- <span *ngIf="options?.title" [innerHTML]="buttonText"></span>
7216
- </button>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
7929
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AddReferenceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7930
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: AddReferenceComponent, isStandalone: false, selector: "add-reference-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
7931
+ <section [class]="options?.htmlClass || ''" align="end">
7932
+ <button *ngIf="showAddButton"
7933
+ [class]="options?.fieldHtmlClass || ''" class="sortable-filter sortable-fixed"
7934
+ [disabled]="options?.readonly"
7935
+ (click)="addItem($event)">
7936
+ <span *ngIf="options?.icon" [class]="options?.icon"></span>
7937
+ <span *ngIf="options?.title" [innerHTML]="buttonText"></span>
7938
+ </button>
7939
+ </section>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
7217
7940
  }
7218
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: AddReferenceComponent, decorators: [{
7941
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AddReferenceComponent, decorators: [{
7219
7942
  type: Component,
7220
7943
  args: [{
7221
7944
  // tslint:disable-next-line:component-selector
7222
7945
  selector: 'add-reference-widget',
7223
7946
  template: `
7224
- <button *ngIf="showAddButton"
7225
- [class]="options?.fieldHtmlClass || ''"
7226
- [disabled]="options?.readonly"
7227
- (click)="addItem($event)">
7228
- <span *ngIf="options?.icon" [class]="options?.icon"></span>
7229
- <span *ngIf="options?.title" [innerHTML]="buttonText"></span>
7230
- </button>`,
7947
+ <section [class]="options?.htmlClass || ''" align="end">
7948
+ <button *ngIf="showAddButton"
7949
+ [class]="options?.fieldHtmlClass || ''" class="sortable-filter sortable-fixed"
7950
+ [disabled]="options?.readonly"
7951
+ (click)="addItem($event)">
7952
+ <span *ngIf="options?.icon" [class]="options?.icon"></span>
7953
+ <span *ngIf="options?.title" [innerHTML]="buttonText"></span>
7954
+ </button>
7955
+ </section>`,
7231
7956
  changeDetection: ChangeDetectionStrategy.Default,
7232
7957
  standalone: false
7233
7958
  }]
@@ -7254,8 +7979,11 @@ class ButtonComponent {
7254
7979
  this.jsf.updateValue(this, event.target.value);
7255
7980
  }
7256
7981
  }
7257
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7258
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: ButtonComponent, isStandalone: false, selector: "button-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
7982
+ ngOnDestroy() {
7983
+ this.jsf.updateValue(this, null);
7984
+ }
7985
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7986
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: ButtonComponent, isStandalone: false, selector: "button-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
7259
7987
  <div
7260
7988
  [class]="options?.htmlClass || ''">
7261
7989
  <button
@@ -7273,7 +8001,7 @@ class ButtonComponent {
7273
8001
  </button>
7274
8002
  </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
7275
8003
  }
7276
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ButtonComponent, decorators: [{
8004
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: ButtonComponent, decorators: [{
7277
8005
  type: Component,
7278
8006
  args: [{
7279
8007
  // tslint:disable-next-line:component-selector
@@ -7299,6 +8027,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
7299
8027
  }]
7300
8028
  }] });
7301
8029
 
8030
+ ///NB issue caused by sortablejs when it its destroyed
8031
+ //this mainly affects checkboxes coupled with conditions
8032
+ //-the value is rechecked
8033
+ //-see https://github.com/SortableJS/Sortable/issues/1052#issuecomment-369613072
7302
8034
  class CheckboxComponent {
7303
8035
  constructor() {
7304
8036
  this.jsf = inject(JsonSchemaFormService);
@@ -7314,7 +8046,8 @@ class CheckboxComponent {
7314
8046
  this.options = this.layoutNode().options || {};
7315
8047
  this.jsf.initializeControl(this);
7316
8048
  if (this.controlValue === null || this.controlValue === undefined) {
7317
- this.controlValue = this.options.title;
8049
+ this.controlValue = false;
8050
+ this.jsf.updateValue(this, this.falseValue);
7318
8051
  }
7319
8052
  }
7320
8053
  updateValue(event) {
@@ -7324,8 +8057,11 @@ class CheckboxComponent {
7324
8057
  get isChecked() {
7325
8058
  return this.jsf.getFormControlValue(this) === this.trueValue;
7326
8059
  }
7327
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7328
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: CheckboxComponent, isStandalone: false, selector: "checkbox-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
8060
+ ngOnDestroy() {
8061
+ this.jsf.updateValue(this, null);
8062
+ }
8063
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: CheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8064
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: CheckboxComponent, isStandalone: false, selector: "checkbox-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
7329
8065
  <label
7330
8066
  [attr.for]="'control' + layoutNode()?._id"
7331
8067
  [class]="options?.itemLabelHtmlClass || ''">
@@ -7341,7 +8077,7 @@ class CheckboxComponent {
7341
8077
  type="checkbox">
7342
8078
  <input *ngIf="!boundControl"
7343
8079
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
7344
- [checked]="isChecked ? 'checked' : null"
8080
+ [checked]="isChecked"
7345
8081
  [class]="(options?.fieldHtmlClass || '') + (isChecked ?
7346
8082
  (' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
7347
8083
  (' ' + (options?.style?.unselected || '')))"
@@ -7357,7 +8093,7 @@ class CheckboxComponent {
7357
8093
  [innerHTML]="options?.title"></span>
7358
8094
  </label>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
7359
8095
  }
7360
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CheckboxComponent, decorators: [{
8096
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: CheckboxComponent, decorators: [{
7361
8097
  type: Component,
7362
8098
  args: [{
7363
8099
  // tslint:disable-next-line:component-selector
@@ -7378,7 +8114,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
7378
8114
  type="checkbox">
7379
8115
  <input *ngIf="!boundControl"
7380
8116
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
7381
- [checked]="isChecked ? 'checked' : null"
8117
+ [checked]="isChecked"
7382
8118
  [class]="(options?.fieldHtmlClass || '') + (isChecked ?
7383
8119
  (' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
7384
8120
  (' ' + (options?.style?.unselected || '')))"
@@ -7429,8 +8165,15 @@ class CheckboxesComponent {
7429
8165
  this.jsf.updateArrayCheckboxList(this, this.checkboxList);
7430
8166
  }
7431
8167
  }
7432
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CheckboxesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7433
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: CheckboxesComponent, isStandalone: false, selector: "checkboxes-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
8168
+ //TODO review this
8169
+ ngOnDestroy() {
8170
+ //this.jsf.updateValue(this, null);
8171
+ let nullVal = [];
8172
+ this.formControl.reset(nullVal);
8173
+ this.controlValue = null;
8174
+ }
8175
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: CheckboxesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8176
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: CheckboxesComponent, isStandalone: false, selector: "checkboxes-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
7434
8177
  <label *ngIf="options?.title"
7435
8178
  [class]="options?.labelHtmlClass || ''"
7436
8179
  [style.display]="options?.notitle ? 'none' : ''"
@@ -7480,7 +8223,7 @@ class CheckboxesComponent {
7480
8223
  </div>
7481
8224
  </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
7482
8225
  }
7483
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CheckboxesComponent, decorators: [{
8226
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: CheckboxesComponent, decorators: [{
7484
8227
  type: Component,
7485
8228
  args: [{
7486
8229
  // tslint:disable-next-line:component-selector
@@ -7555,10 +8298,13 @@ class FileComponent {
7555
8298
  updateValue(event) {
7556
8299
  this.jsf.updateValue(this, event.target.value);
7557
8300
  }
7558
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: FileComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7559
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: FileComponent, isStandalone: false, selector: "file-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: ``, isInline: true }); }
8301
+ ngOnDestroy() {
8302
+ this.jsf.updateValue(this, null);
8303
+ }
8304
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FileComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8305
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: FileComponent, isStandalone: false, selector: "file-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: ``, isInline: true }); }
7560
8306
  }
7561
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: FileComponent, decorators: [{
8307
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FileComponent, decorators: [{
7562
8308
  type: Component,
7563
8309
  args: [{
7564
8310
  // tslint:disable-next-line:component-selector
@@ -7580,8 +8326,11 @@ class HiddenComponent {
7580
8326
  ngOnInit() {
7581
8327
  this.jsf.initializeControl(this);
7582
8328
  }
7583
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: HiddenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7584
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: HiddenComponent, isStandalone: false, selector: "hidden-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
8329
+ ngOnDestroy() {
8330
+ this.jsf.updateValue(this, null);
8331
+ }
8332
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: HiddenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8333
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: HiddenComponent, isStandalone: false, selector: "hidden-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
7585
8334
  <input *ngIf="boundControl"
7586
8335
  [formControl]="formControl"
7587
8336
  [id]="'control' + layoutNode()?._id"
@@ -7594,7 +8343,7 @@ class HiddenComponent {
7594
8343
  type="hidden"
7595
8344
  [value]="controlValue">`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
7596
8345
  }
7597
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: HiddenComponent, decorators: [{
8346
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: HiddenComponent, decorators: [{
7598
8347
  type: Component,
7599
8348
  args: [{
7600
8349
  // tslint:disable-next-line:component-selector
@@ -7636,8 +8385,11 @@ class InputComponent {
7636
8385
  updateValue(event) {
7637
8386
  this.jsf.updateValue(this, event.target.value);
7638
8387
  }
7639
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: InputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7640
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: InputComponent, isStandalone: false, selector: "input-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
8388
+ ngOnDestroy() {
8389
+ this.jsf.updateValue(this, null);
8390
+ }
8391
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8392
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: InputComponent, isStandalone: false, selector: "input-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
7641
8393
  <div [class]="options?.htmlClass || ''" class="sortable-filter" >
7642
8394
  <label *ngIf="options?.title"
7643
8395
  [attr.for]="'control' + layoutNode()?._id"
@@ -7684,7 +8436,7 @@ class InputComponent {
7684
8436
  </datalist>
7685
8437
  </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: ElementAttributeDirective, selector: "[attributes]", inputs: ["attributes"] }] }); }
7686
8438
  }
7687
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: InputComponent, decorators: [{
8439
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InputComponent, decorators: [{
7688
8440
  type: Component,
7689
8441
  args: [{
7690
8442
  // tslint:disable-next-line:component-selector
@@ -7752,13 +8504,13 @@ class MessageComponent {
7752
8504
  this.message = this.options.help || this.options.helpvalue ||
7753
8505
  this.options.msg || this.options.message;
7754
8506
  }
7755
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MessageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7756
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: MessageComponent, isStandalone: false, selector: "message-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
8507
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: MessageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8508
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: MessageComponent, isStandalone: false, selector: "message-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
7757
8509
  <span *ngIf="message"
7758
8510
  [class]="options?.labelHtmlClass || ''"
7759
8511
  [innerHTML]="message"></span>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
7760
8512
  }
7761
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MessageComponent, decorators: [{
8513
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: MessageComponent, decorators: [{
7762
8514
  type: Component,
7763
8515
  args: [{
7764
8516
  // tslint:disable-next-line:component-selector
@@ -7777,10 +8529,10 @@ class NoneComponent {
7777
8529
  this.layoutIndex = input(undefined);
7778
8530
  this.dataIndex = input(undefined);
7779
8531
  }
7780
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoneComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7781
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: NoneComponent, isStandalone: false, selector: "none-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: ``, isInline: true }); }
8532
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoneComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8533
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: NoneComponent, isStandalone: false, selector: "none-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: ``, isInline: true }); }
7782
8534
  }
7783
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoneComponent, decorators: [{
8535
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoneComponent, decorators: [{
7784
8536
  type: Component,
7785
8537
  args: [{
7786
8538
  // tslint:disable-next-line:component-selector
@@ -7818,8 +8570,11 @@ class NumberComponent {
7818
8570
  updateValue(event) {
7819
8571
  this.jsf.updateValue(this, event.target.value);
7820
8572
  }
7821
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NumberComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7822
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: NumberComponent, isStandalone: false, selector: "number-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "inputControl", first: true, predicate: ["inputControl"], descendants: true }, { propertyName: "div", first: true, predicate: ["divElt"], descendants: true }], ngImport: i0, template: `
8573
+ ngOnDestroy() {
8574
+ this.jsf.updateValue(this, null);
8575
+ }
8576
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NumberComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8577
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: NumberComponent, isStandalone: false, selector: "number-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "inputControl", first: true, predicate: ["inputControl"], descendants: true }, { propertyName: "div", first: true, predicate: ["divElt"], descendants: true }], ngImport: i0, template: `
7823
8578
  <div #divElt [class]="options?.htmlClass || ''" class="sortable-filter" >
7824
8579
  <label *ngIf="options?.title"
7825
8580
  [attr.for]="'control' + layoutNode()?._id"
@@ -7866,7 +8621,7 @@ class NumberComponent {
7866
8621
  <span *ngIf="layoutNode()?.type === 'range'" [innerHTML]="controlValue"></span>
7867
8622
  </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: ElementAttributeDirective, selector: "[attributes]", inputs: ["attributes"] }] }); }
7868
8623
  }
7869
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NumberComponent, decorators: [{
8624
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NumberComponent, decorators: [{
7870
8625
  type: Component,
7871
8626
  args: [{
7872
8627
  // tslint:disable-next-line:component-selector
@@ -7927,6 +8682,195 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
7927
8682
  args: ['divElt', {}]
7928
8683
  }] } });
7929
8684
 
8685
+ class SelectFrameworkComponent {
8686
+ constructor() {
8687
+ this.jsf = inject(JsonSchemaFormService);
8688
+ this.newComponent = null;
8689
+ this.layoutNode = input(undefined);
8690
+ this.layoutIndex = input(undefined);
8691
+ this.dataIndex = input(undefined);
8692
+ this.widgetContainer = viewChild('widgetContainer', { read: ViewContainerRef });
8693
+ }
8694
+ ngOnInit() {
8695
+ this.updateComponent();
8696
+ }
8697
+ ngOnChanges() {
8698
+ this.updateComponent();
8699
+ }
8700
+ updateComponent() {
8701
+ const widgetContainer = this.widgetContainer();
8702
+ if (widgetContainer && !this.newComponent && this.jsf.framework) {
8703
+ this.newComponent = widgetContainer.createComponent((this.jsf.framework));
8704
+ //TODO fix all deprecated calls and test
8705
+ //this.widgetContainer.createComponent<any>(this.jsf.framework)
8706
+ }
8707
+ if (this.newComponent) {
8708
+ for (const input of ['layoutNode', 'layoutIndex', 'dataIndex']) {
8709
+ this.newComponent.instance[input] = this[input];
8710
+ }
8711
+ }
8712
+ }
8713
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SelectFrameworkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8714
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.14", type: SelectFrameworkComponent, isStandalone: false, selector: "select-framework-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "widgetContainer", first: true, predicate: ["widgetContainer"], descendants: true, read: ViewContainerRef, isSignal: true }], usesOnChanges: true, ngImport: i0, template: `<div #widgetContainer></div>`, isInline: true }); }
8715
+ }
8716
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SelectFrameworkComponent, decorators: [{
8717
+ type: Component,
8718
+ args: [{
8719
+ // tslint:disable-next-line:component-selector
8720
+ selector: 'select-framework-widget',
8721
+ template: `<div #widgetContainer></div>`,
8722
+ standalone: false
8723
+ }]
8724
+ }] });
8725
+
8726
+ class TabsComponent {
8727
+ constructor() {
8728
+ this.jsf = inject(JsonSchemaFormService);
8729
+ this.selectedItem = 0;
8730
+ this.showAddTab = true;
8731
+ this.layoutNode = input(undefined);
8732
+ this.layoutIndex = input(undefined);
8733
+ this.dataIndex = input(undefined);
8734
+ }
8735
+ ngOnInit() {
8736
+ this.options = this.layoutNode().options || {};
8737
+ if (this.options.selectedTab) {
8738
+ this.selectedItem = this.options.selectedTab;
8739
+ }
8740
+ this.itemCount = this.layoutNode().items.length - 1;
8741
+ this.updateControl();
8742
+ }
8743
+ select(index) {
8744
+ const layoutNode = this.layoutNode();
8745
+ if (layoutNode.items[index].type === '$ref') {
8746
+ this.itemCount = layoutNode.items.length;
8747
+ this.jsf.addItem({
8748
+ layoutNode: signal(layoutNode.items[index]),
8749
+ layoutIndex: signal(this.layoutIndex().concat(index)),
8750
+ dataIndex: signal(this.dataIndex().concat(index))
8751
+ });
8752
+ this.updateControl();
8753
+ }
8754
+ this.selectedItem = index;
8755
+ }
8756
+ updateControl() {
8757
+ const lastItem = this.layoutNode().items[this.layoutNode().items.length - 1];
8758
+ if (lastItem.type === '$ref' &&
8759
+ this.itemCount >= (lastItem.options.maxItems || 1000)) {
8760
+ this.showAddTab = false;
8761
+ }
8762
+ }
8763
+ setTabTitle(item, index) {
8764
+ return this.jsf.setArrayItemTitle(this, item, index);
8765
+ }
8766
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8767
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: TabsComponent, isStandalone: false, selector: "tabs-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
8768
+ <ul
8769
+ [class]="options?.labelHtmlClass || ''">
8770
+ <li *ngFor="let item of layoutNode()?.items; let i = index"
8771
+ [class]="(options?.itemLabelHtmlClass || '') + (selectedItem === i ?
8772
+ (' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
8773
+ (' ' + options?.style?.unselected))"
8774
+ role="presentation"
8775
+ data-tabs>
8776
+ <a *ngIf="showAddTab || item.type !== '$ref'"
8777
+ [class]="'nav-link' + (selectedItem === i ? (' ' + options?.activeClass + ' ' + options?.style?.selected) :
8778
+ (' ' + options?.style?.unselected))"
8779
+ (click)="select(i)">
8780
+ <input type="radio" [value]="i" *ngIf="options?.tabMode=='oneOfMode'"
8781
+ name="tabSelection"
8782
+ [(ngModel)]="selectedItem"
8783
+ [class]="(options?.widget_radioClass || '')"
8784
+ [value]="i"
8785
+ (change)="select(i)"
8786
+ />
8787
+ {{setTabTitle(item, i)}}
8788
+ </a>
8789
+ </li>
8790
+ </ul>
8791
+
8792
+ <div *ngFor="let layoutItem of layoutNode()?.items; let i = index"
8793
+ [class]="(options?.htmlClass || '') + (selectedItem != i?' ngf-hidden':'') ">
8794
+ <!--for now the only difference between oneOfMode and the default
8795
+ is that oneOfMode uses the *ngIf="selectedItem === i" clause, which automatically
8796
+ destroys the tabs that are not rendered while default mode only hide them
8797
+ the upshot is that only the active tabs value will be used
8798
+ -->
8799
+ <ng-container *ngIf="options?.tabMode=='oneOfMode'">
8800
+ <select-framework-widget *ngIf="selectedItem === i"
8801
+ [class]="(options?.fieldHtmlClass || '') +
8802
+ ' ' + (options?.activeClass || '') +
8803
+ ' ' + (options?.style?.selected || '')"
8804
+ [dataIndex]="layoutNode()?.dataType === 'array' ? (dataIndex() || []).concat(i) : dataIndex()"
8805
+ [layoutIndex]="(layoutIndex() || []).concat(i)"
8806
+ [layoutNode]="layoutItem"></select-framework-widget>
8807
+ </ng-container>
8808
+ <ng-container *ngIf="options?.tabMode !='oneOfMode'">
8809
+ <select-framework-widget
8810
+ [class]="(options?.fieldHtmlClass || '') +
8811
+ ' ' + (options?.activeClass || '') +
8812
+ ' ' + (options?.style?.selected || '')"
8813
+ [dataIndex]="layoutNode()?.dataType === 'array' ? (dataIndex() || []).concat(i) : dataIndex()"
8814
+ [layoutIndex]="(layoutIndex() || []).concat(i)"
8815
+ [layoutNode]="layoutItem"></select-framework-widget>
8816
+ </ng-container>
8817
+ </div>`, isInline: true, styles: ["a{cursor:pointer}.ngf-hidden{display:none}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: SelectFrameworkComponent, selector: "select-framework-widget", inputs: ["layoutNode", "layoutIndex", "dataIndex"] }] }); }
8818
+ }
8819
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TabsComponent, decorators: [{
8820
+ type: Component,
8821
+ args: [{ selector: 'tabs-widget', template: `
8822
+ <ul
8823
+ [class]="options?.labelHtmlClass || ''">
8824
+ <li *ngFor="let item of layoutNode()?.items; let i = index"
8825
+ [class]="(options?.itemLabelHtmlClass || '') + (selectedItem === i ?
8826
+ (' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
8827
+ (' ' + options?.style?.unselected))"
8828
+ role="presentation"
8829
+ data-tabs>
8830
+ <a *ngIf="showAddTab || item.type !== '$ref'"
8831
+ [class]="'nav-link' + (selectedItem === i ? (' ' + options?.activeClass + ' ' + options?.style?.selected) :
8832
+ (' ' + options?.style?.unselected))"
8833
+ (click)="select(i)">
8834
+ <input type="radio" [value]="i" *ngIf="options?.tabMode=='oneOfMode'"
8835
+ name="tabSelection"
8836
+ [(ngModel)]="selectedItem"
8837
+ [class]="(options?.widget_radioClass || '')"
8838
+ [value]="i"
8839
+ (change)="select(i)"
8840
+ />
8841
+ {{setTabTitle(item, i)}}
8842
+ </a>
8843
+ </li>
8844
+ </ul>
8845
+
8846
+ <div *ngFor="let layoutItem of layoutNode()?.items; let i = index"
8847
+ [class]="(options?.htmlClass || '') + (selectedItem != i?' ngf-hidden':'') ">
8848
+ <!--for now the only difference between oneOfMode and the default
8849
+ is that oneOfMode uses the *ngIf="selectedItem === i" clause, which automatically
8850
+ destroys the tabs that are not rendered while default mode only hide them
8851
+ the upshot is that only the active tabs value will be used
8852
+ -->
8853
+ <ng-container *ngIf="options?.tabMode=='oneOfMode'">
8854
+ <select-framework-widget *ngIf="selectedItem === i"
8855
+ [class]="(options?.fieldHtmlClass || '') +
8856
+ ' ' + (options?.activeClass || '') +
8857
+ ' ' + (options?.style?.selected || '')"
8858
+ [dataIndex]="layoutNode()?.dataType === 'array' ? (dataIndex() || []).concat(i) : dataIndex()"
8859
+ [layoutIndex]="(layoutIndex() || []).concat(i)"
8860
+ [layoutNode]="layoutItem"></select-framework-widget>
8861
+ </ng-container>
8862
+ <ng-container *ngIf="options?.tabMode !='oneOfMode'">
8863
+ <select-framework-widget
8864
+ [class]="(options?.fieldHtmlClass || '') +
8865
+ ' ' + (options?.activeClass || '') +
8866
+ ' ' + (options?.style?.selected || '')"
8867
+ [dataIndex]="layoutNode()?.dataType === 'array' ? (dataIndex() || []).concat(i) : dataIndex()"
8868
+ [layoutIndex]="(layoutIndex() || []).concat(i)"
8869
+ [layoutNode]="layoutItem"></select-framework-widget>
8870
+ </ng-container>
8871
+ </div>`, standalone: false, styles: ["a{cursor:pointer}.ngf-hidden{display:none}\n"] }]
8872
+ }] });
8873
+
7930
8874
  // TODO: Add this control
7931
8875
  class OneOfComponent {
7932
8876
  constructor() {
@@ -7939,20 +8883,100 @@ class OneOfComponent {
7939
8883
  }
7940
8884
  ngOnInit() {
7941
8885
  this.options = this.layoutNode().options || {};
8886
+ this.options.tabMode = "oneOfMode";
8887
+ this.options.selectedTab = this.findSelectedTab();
8888
+ //this.options.description=this.options.description||"choose one of";
7942
8889
  this.jsf.initializeControl(this);
7943
8890
  }
8891
+ findSelectedTab() {
8892
+ //TODO test- this.jsf.formValues seems to be the initial data supplied to the form
8893
+ //while the jsf.formGroup value is derived from the actual controls
8894
+ //let formValue=this.jsf.getFormControlValue(this);
8895
+ let foundInd = -1;
8896
+ //seach for non null value
8897
+ if (this.layoutNode().items) {
8898
+ this.layoutNode().items.forEach((layoutItem, ind) => {
8899
+ let formValue = JsonPointer.get(this.jsf.formValues, layoutItem.dataPointer);
8900
+ if (layoutItem.oneOfPointer) {
8901
+ let controlKey = path2ControlKey(layoutItem.oneOfPointer);
8902
+ let fname = layoutItem.name;
8903
+ if (hasOwn(this.jsf.formGroup.controls, controlKey) &&
8904
+ (formValue || hasNonNullValue(this.jsf.formGroup.controls[controlKey].value))
8905
+ //hasOwn(formValue,fname) && hasOwn(this.jsf.formGroup.controls,controlKey)
8906
+ // && (formValue[fname] || this.jsf.formGroup.controls[controlKey].value)
8907
+ //&&isEqual(formValue[fname],this.jsf.formGroup.controls[controlKey].value)
8908
+ ) {
8909
+ foundInd = ind;
8910
+ }
8911
+ //foundInd=formValue[controlKey]!=null?ind:foundInd;
8912
+ //if no exact match found, then search in descendant values
8913
+ //to see which one of item matches
8914
+ if (foundInd == -1) {
8915
+ //find all descendant oneof paths
8916
+ let descendantOneOfControlNames = Object.keys(this.jsf.formGroup.controls).filter(controlName => {
8917
+ return controlName.startsWith(controlKey);
8918
+ });
8919
+ descendantOneOfControlNames.forEach(controlName => {
8920
+ let parts = controlName.split('$');
8921
+ let fieldName = parts[parts.length - 1];
8922
+ let controlValue = this.jsf.formGroup.controls[controlName].value;
8923
+ let controlSchema = JsonPointer.get(this.jsf.schema, parts.join("/"));
8924
+ let schemaPointer = parts.join("/");
8925
+ let dPointer = schemaPointer.replace(/(anyOf|allOf|oneOf|none)\/[\d]+\//g, '')
8926
+ .replace(/(if|then|else|properties)\//g, '');
8927
+ //JsonPointer.toDataPointer(parts.join("/"),this.jsf.schema);
8928
+ let dVal = JsonPointer.get(this.jsf.formValues, dPointer);
8929
+ let compareVal = dVal; //formValue;
8930
+ //compare only values that are in the subschema properties
8931
+ if (controlSchema && controlSchema.properties) {
8932
+ compareVal = isObject$1(dVal) && hasOwn(dVal, fieldName) ?
8933
+ pick(dVal[fieldName], Object.keys(controlSchema.properties))
8934
+ : pick(dVal, Object.keys(controlSchema.properties));
8935
+ }
8936
+ /*
8937
+ if(isObject(compareVal) && hasOwn(compareVal,fieldName) &&
8938
+ isEqual(compareVal[fieldName],controlValue)
8939
+ ){
8940
+ foundInd=ind;
8941
+ }else //if(formValue || controlValue){
8942
+ if(isEqual(compareVal,controlValue)){
8943
+ foundInd=ind;
8944
+ }
8945
+ */
8946
+ if (isEqual$2(compareVal, controlValue)) {
8947
+ foundInd = ind;
8948
+ }
8949
+ });
8950
+ //now need to compare values
8951
+ }
8952
+ }
8953
+ });
8954
+ }
8955
+ return Math.max(foundInd, 0);
8956
+ }
7944
8957
  updateValue(event) {
7945
8958
  this.jsf.updateValue(this, event.target.value);
7946
8959
  }
7947
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: OneOfComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7948
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: OneOfComponent, isStandalone: false, selector: "one-of-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: ``, isInline: true }); }
8960
+ ngOnDestroy() {
8961
+ //this.jsf.updateValue(this, null);
8962
+ }
8963
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OneOfComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8964
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: OneOfComponent, isStandalone: false, selector: "one-of-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `<h4>{{this.options?.description}}</h4>
8965
+ <tabs-widget #tabs [layoutNode]="layoutNode()"
8966
+ [layoutIndex]="layoutIndex()"
8967
+ [dataIndex]="dataIndex()" >
8968
+ </tabs-widget>`, isInline: true, dependencies: [{ kind: "component", type: TabsComponent, selector: "tabs-widget", inputs: ["layoutNode", "layoutIndex", "dataIndex"] }] }); }
7949
8969
  }
7950
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: OneOfComponent, decorators: [{
8970
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OneOfComponent, decorators: [{
7951
8971
  type: Component,
7952
8972
  args: [{
7953
8973
  // tslint:disable-next-line:component-selector
7954
8974
  selector: 'one-of-widget',
7955
- template: ``,
8975
+ template: `<h4>{{this.options?.description}}</h4>
8976
+ <tabs-widget #tabs [layoutNode]="layoutNode()"
8977
+ [layoutIndex]="layoutIndex()"
8978
+ [dataIndex]="dataIndex()" >
8979
+ </tabs-widget>`,
7956
8980
  standalone: false
7957
8981
  }]
7958
8982
  }] });
@@ -7981,8 +9005,11 @@ class RadiosComponent {
7981
9005
  updateValue(event) {
7982
9006
  this.jsf.updateValue(this, event.target.value);
7983
9007
  }
7984
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: RadiosComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7985
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: RadiosComponent, isStandalone: false, selector: "radios-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
9008
+ ngOnDestroy() {
9009
+ this.jsf.updateValue(this, null);
9010
+ }
9011
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: RadiosComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9012
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: RadiosComponent, isStandalone: false, selector: "radios-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
7986
9013
  <label *ngIf="options?.title"
7987
9014
  [attr.for]="'control' + layoutNode()?._id"
7988
9015
  [class]="options?.labelHtmlClass || ''"
@@ -8039,7 +9066,7 @@ class RadiosComponent {
8039
9066
  </div>
8040
9067
  </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
8041
9068
  }
8042
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: RadiosComponent, decorators: [{
9069
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: RadiosComponent, decorators: [{
8043
9070
  type: Component,
8044
9071
  args: [{
8045
9072
  // tslint:disable-next-line:component-selector
@@ -8104,47 +9131,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
8104
9131
  }]
8105
9132
  }] });
8106
9133
 
8107
- class SelectFrameworkComponent {
8108
- constructor() {
8109
- this.jsf = inject(JsonSchemaFormService);
8110
- this.newComponent = null;
8111
- this.layoutNode = input(undefined);
8112
- this.layoutIndex = input(undefined);
8113
- this.dataIndex = input(undefined);
8114
- this.widgetContainer = viewChild('widgetContainer', { read: ViewContainerRef });
8115
- }
8116
- ngOnInit() {
8117
- this.updateComponent();
8118
- }
8119
- ngOnChanges() {
8120
- this.updateComponent();
8121
- }
8122
- updateComponent() {
8123
- const widgetContainer = this.widgetContainer();
8124
- if (widgetContainer && !this.newComponent && this.jsf.framework) {
8125
- this.newComponent = widgetContainer.createComponent((this.jsf.framework));
8126
- //TODO fix all deprecated calls and test
8127
- //this.widgetContainer.createComponent<any>(this.jsf.framework)
8128
- }
8129
- if (this.newComponent) {
8130
- for (const input of ['layoutNode', 'layoutIndex', 'dataIndex']) {
8131
- this.newComponent.instance[input] = this[input];
8132
- }
8133
- }
8134
- }
8135
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SelectFrameworkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8136
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.6", type: SelectFrameworkComponent, isStandalone: false, selector: "select-framework-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "widgetContainer", first: true, predicate: ["widgetContainer"], descendants: true, read: ViewContainerRef, isSignal: true }], usesOnChanges: true, ngImport: i0, template: `<div #widgetContainer></div>`, isInline: true }); }
8137
- }
8138
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SelectFrameworkComponent, decorators: [{
8139
- type: Component,
8140
- args: [{
8141
- // tslint:disable-next-line:component-selector
8142
- selector: 'select-framework-widget',
8143
- template: `<div #widgetContainer></div>`,
8144
- standalone: false
8145
- }]
8146
- }] });
8147
-
8148
9134
  /**
8149
9135
  * OrderableDirective
8150
9136
  *
@@ -8260,10 +9246,10 @@ class OrderableDirective {
8260
9246
  this.draggableStateSubscription.unsubscribe();
8261
9247
  }
8262
9248
  }
8263
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: OrderableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
8264
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.6", type: OrderableDirective, isStandalone: false, selector: "[orderable]", inputs: { orderable: { classPropertyName: "orderable", publicName: "orderable", isSignal: true, isRequired: false, transformFunction: null }, layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
9249
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OrderableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
9250
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.14", type: OrderableDirective, isStandalone: false, selector: "[orderable]", inputs: { orderable: { classPropertyName: "orderable", publicName: "orderable", isSignal: true, isRequired: false, transformFunction: null }, layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
8265
9251
  }
8266
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: OrderableDirective, decorators: [{
9252
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OrderableDirective, decorators: [{
8267
9253
  type: Directive,
8268
9254
  args: [{
8269
9255
  // tslint:disable-next-line:directive-selector
@@ -8301,11 +9287,74 @@ class RootComponent {
8301
9287
  };
8302
9288
  //must set moveLayout to false as nxtSortable already moves it
8303
9289
  this.jsf.moveArrayItem(itemCtx, evt.oldIndex, evt.newIndex, false);
9290
+ },
9291
+ onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
9292
+ if (evt.related.classList.contains("sortable-fixed")) {
9293
+ //console.log(evt.related);
9294
+ return false;
9295
+ }
8304
9296
  }
8305
9297
  };
8306
9298
  }
8307
9299
  sortableInit(sortable) {
8308
9300
  this.sortableObj = sortable;
9301
+ ///NB issue caused by sortablejs when it its destroyed
9302
+ //this mainly affects checkboxes coupled with conditions
9303
+ //-the value is rechecked
9304
+ //-see https://github.com/SortableJS/Sortable/issues/1052#issuecomment-369613072
9305
+ /* attempt to monkey patch sortable js
9306
+ const originalMethod = sortable._nulling;
9307
+ let zone=this.zone;
9308
+ sortable._nulling=function() {
9309
+ console.log(`pluginEvent 2 ${pluginEvent}`)
9310
+ zone.runOutsideAngular(() => {
9311
+ console.log(`pluginEvent3 ${pluginEvent}`)
9312
+ pluginEvent('nulling', this);
9313
+
9314
+ rootEl =
9315
+ dragEl =
9316
+ parentEl =
9317
+ ghostEl =
9318
+ nextEl =
9319
+ cloneEl =
9320
+ lastDownEl =
9321
+ cloneHidden =
9322
+
9323
+ tapEvt =
9324
+ touchEvt =
9325
+
9326
+ moved =
9327
+ newIndex =
9328
+ newDraggableIndex =
9329
+ oldIndex =
9330
+ oldDraggableIndex =
9331
+
9332
+ lastTarget =
9333
+ lastDirection =
9334
+
9335
+ putSortable =
9336
+ activeGroup =
9337
+ Sortable.dragged =
9338
+ Sortable.ghost =
9339
+ Sortable.clone =
9340
+ Sortable.active = null;
9341
+
9342
+
9343
+ let el = this.el;
9344
+ savedInputChecked.forEach(function (checkEl) {
9345
+ if (el.contains(checkEl)) {
9346
+ checkEl.checked = true;
9347
+ }
9348
+ });
9349
+
9350
+ savedInputChecked.length =
9351
+ lastDx =
9352
+ lastDy = 0;
9353
+
9354
+ })
9355
+
9356
+ }.bind(sortable)
9357
+ */
8309
9358
  }
8310
9359
  isDraggable(node) {
8311
9360
  let result = node.arrayItem && node.type !== '$ref' &&
@@ -8317,6 +9366,12 @@ class RootComponent {
8317
9366
  }
8318
9367
  return result;
8319
9368
  }
9369
+ //TODO also need to think of other types such as button which can be
9370
+ //created by an arbitrary layout
9371
+ isFixed(node) {
9372
+ let result = node.type == '$ref';
9373
+ return result;
9374
+ }
8320
9375
  // Set attributes for flexbox child
8321
9376
  // (container attributes are set in section.component)
8322
9377
  getFlexAttribute(node, attribute) {
@@ -8345,8 +9400,8 @@ class RootComponent {
8345
9400
  this.sortableOptionsSubscription.unsubscribe();
8346
9401
  }
8347
9402
  }
8348
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: RootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8349
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: RootComponent, isStandalone: false, selector: "root-widget", inputs: { dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, isOrderable: { classPropertyName: "isOrderable", publicName: "isOrderable", isSignal: true, isRequired: false, transformFunction: null }, isFlexItem: { classPropertyName: "isFlexItem", publicName: "isFlexItem", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
9403
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: RootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9404
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: RootComponent, isStandalone: false, selector: "root-widget", inputs: { dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, isOrderable: { classPropertyName: "isOrderable", publicName: "isOrderable", isSignal: true, isRequired: false, transformFunction: null }, isFlexItem: { classPropertyName: "isFlexItem", publicName: "isFlexItem", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
8350
9405
  <div [class.flex-inherit]="true" #sortableContainter [nxtSortablejs]="layout()" [config]="sortableConfig" (init)="sortableInit($event)">
8351
9406
  <div *ngFor="let layoutItem of layout(); let i = index"
8352
9407
  [class.form-flex-item]="isFlexItem()"
@@ -8356,6 +9411,7 @@ class RootComponent {
8356
9411
  [style.flex-shrink]="getFlexAttribute(layoutItem, 'flex-shrink')"
8357
9412
  [style.order]="(layoutItem.options || {}).order"
8358
9413
  [class.sortable-filter]="!isDraggable(layoutItem)"
9414
+ [class.sortable-fixed]="isFixed(layoutItem)"
8359
9415
  >
8360
9416
  <!--NB orderable directive is not used but has been left in for now and set to false
8361
9417
  otherwise the compiler won't recognize dataIndex and other dependent attributes
@@ -8366,6 +9422,7 @@ class RootComponent {
8366
9422
  [layoutNode]="layoutItem"
8367
9423
  [orderable]="false"
8368
9424
  [class.sortable-filter]="!isDraggable(layoutItem)"
9425
+ [class.sortable-fixed]="isFixed(layoutItem)"
8369
9426
  >
8370
9427
  <select-framework-widget *ngIf="showWidget(layoutItem)"
8371
9428
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
@@ -8376,7 +9433,7 @@ class RootComponent {
8376
9433
  </div>
8377
9434
  `, isInline: true, styles: ["[draggable=true]{transition:all .15s cubic-bezier(.4,0,.2,1)}[draggable=true]:hover{cursor:move;box-shadow:2px 2px 4px #0003;position:relative;z-index:10;margin:-1px 1px 1px -1px}[draggable=true].drag-target-top{box-shadow:0 -2px #000;position:relative;z-index:20}[draggable=true].drag-target-bottom{box-shadow:0 2px #000;position:relative;z-index:20}.flex-inherit{display:inherit;flex-flow:inherit;flex-wrap:inherit;flex-direction:inherit;width:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.SortablejsDirective, selector: "[nxtSortablejs]", inputs: ["nxtSortablejs", "sortablejsContainer", "config", "cloneFunction"], outputs: ["init"] }, { kind: "component", type: SelectFrameworkComponent, selector: "select-framework-widget", inputs: ["layoutNode", "layoutIndex", "dataIndex"] }, { kind: "directive", type: OrderableDirective, selector: "[orderable]", inputs: ["orderable", "layoutNode", "layoutIndex", "dataIndex"] }] }); }
8378
9435
  }
8379
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: RootComponent, decorators: [{
9436
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: RootComponent, decorators: [{
8380
9437
  type: Component,
8381
9438
  args: [{ selector: 'root-widget', template: `
8382
9439
  <div [class.flex-inherit]="true" #sortableContainter [nxtSortablejs]="layout()" [config]="sortableConfig" (init)="sortableInit($event)">
@@ -8388,6 +9445,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
8388
9445
  [style.flex-shrink]="getFlexAttribute(layoutItem, 'flex-shrink')"
8389
9446
  [style.order]="(layoutItem.options || {}).order"
8390
9447
  [class.sortable-filter]="!isDraggable(layoutItem)"
9448
+ [class.sortable-fixed]="isFixed(layoutItem)"
8391
9449
  >
8392
9450
  <!--NB orderable directive is not used but has been left in for now and set to false
8393
9451
  otherwise the compiler won't recognize dataIndex and other dependent attributes
@@ -8398,6 +9456,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
8398
9456
  [layoutNode]="layoutItem"
8399
9457
  [orderable]="false"
8400
9458
  [class.sortable-filter]="!isDraggable(layoutItem)"
9459
+ [class.sortable-fixed]="isFixed(layoutItem)"
8401
9460
  >
8402
9461
  <select-framework-widget *ngIf="showWidget(layoutItem)"
8403
9462
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
@@ -8470,8 +9529,8 @@ class SectionComponent {
8470
9529
  return this.options[attribute];
8471
9530
  }
8472
9531
  }
8473
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8474
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: SectionComponent, isStandalone: false, selector: "section-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
9532
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9533
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: SectionComponent, isStandalone: false, selector: "section-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
8475
9534
  <div *ngIf="containerType === 'div'"
8476
9535
  [class]="options?.htmlClass || ''"
8477
9536
  [class.expandable]="options?.expandable && !expanded"
@@ -8534,7 +9593,7 @@ class SectionComponent {
8534
9593
  </div>
8535
9594
  </fieldset>`, isInline: true, styles: [".legend{font-weight:700}.expandable>legend:before,.expandable>label:before{content:\"\\25b6\";padding-right:.3em;font-family:auto}.expanded>legend:before,.expanded>label:before{content:\"\\25bc\";padding-right:.2em}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }] }); }
8536
9595
  }
8537
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SectionComponent, decorators: [{
9596
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SectionComponent, decorators: [{
8538
9597
  type: Component,
8539
9598
  args: [{ selector: 'section-widget', template: `
8540
9599
  <div *ngIf="containerType === 'div'"
@@ -8606,6 +9665,7 @@ class SelectComponent {
8606
9665
  this.controlDisabled = false;
8607
9666
  this.boundControl = false;
8608
9667
  this.selectList = [];
9668
+ this.selectListFlatGroup = [];
8609
9669
  this.isArray = isArray;
8610
9670
  this.layoutNode = input(undefined);
8611
9671
  this.layoutIndex = input(undefined);
@@ -8614,13 +9674,43 @@ class SelectComponent {
8614
9674
  ngOnInit() {
8615
9675
  this.options = this.layoutNode().options || {};
8616
9676
  this.selectList = buildTitleMap(this.options.titleMap || this.options.enumNames, this.options.enum, !!this.options.required, !!this.options.flatList);
9677
+ //the selectListFlatGroup array will be used to update the formArray values
9678
+ //while the selectList array will be bound to the form select
9679
+ //as either a grouped select or a flat select
9680
+ this.selectListFlatGroup = buildTitleMap(this.options.titleMap || this.options.enumNames, this.options.enum, !!this.options.required, true);
8617
9681
  this.jsf.initializeControl(this);
8618
9682
  }
9683
+ deselectAll() {
9684
+ this.selectListFlatGroup.forEach(selItem => {
9685
+ selItem.checked = false;
9686
+ });
9687
+ }
8619
9688
  updateValue(event) {
8620
- this.jsf.updateValue(this, event.target.value);
9689
+ this.options.showErrors = true;
9690
+ if (this.options.multiple) {
9691
+ if (this.controlValue?.includes(null)) {
9692
+ this.deselectAll();
9693
+ //this.control.setValue([]); // Reset the form control to an empty array
9694
+ //this.selectList=JSON.parse(JSON.stringify(this.selectList));
9695
+ this.jsf.updateArrayMultiSelectList(this, []);
9696
+ }
9697
+ else {
9698
+ this.selectListFlatGroup.forEach(selItem => {
9699
+ selItem.checked = this.controlValue?.indexOf(selItem.value) >= 0 ? true : false;
9700
+ });
9701
+ this.jsf.updateArrayMultiSelectList(this, this.selectListFlatGroup);
9702
+ }
9703
+ return;
9704
+ }
9705
+ this.jsf.updateValue(this, this.controlValue);
9706
+ }
9707
+ ngOnDestroy() {
9708
+ let nullVal = this.options.multiple ? [null] : null;
9709
+ this.formControl.reset(nullVal);
9710
+ this.controlValue = null;
8621
9711
  }
8622
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8623
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: SelectComponent, isStandalone: false, selector: "select-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
9712
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9713
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: SelectComponent, isStandalone: false, selector: "select-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
8624
9714
  <div
8625
9715
  [class]="options?.htmlClass || ''">
8626
9716
  <label *ngIf="options?.title"
@@ -8628,7 +9718,7 @@ class SelectComponent {
8628
9718
  [class]="options?.labelHtmlClass || ''"
8629
9719
  [style.display]="options?.notitle ? 'none' : ''"
8630
9720
  [innerHTML]="options?.title"></label>
8631
- <select *ngIf="boundControl"
9721
+ <select *ngIf="boundControl && !options?.multiple"
8632
9722
  [formControl]="formControl"
8633
9723
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
8634
9724
  [attr.readonly]="options?.readonly ? 'readonly' : null"
@@ -8675,9 +9765,36 @@ class SelectComponent {
8675
9765
  </optgroup>
8676
9766
  </ng-template>
8677
9767
  </select>
8678
- </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
9768
+ <select *ngIf="boundControl && options?.multiple"
9769
+ [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
9770
+ [attr.readonly]="options?.readonly ? 'readonly' : null"
9771
+ [attr.required]="options?.required"
9772
+ [class]="options?.fieldHtmlClass || ''"
9773
+ [disabled]="controlDisabled"
9774
+ [id]="'control' + layoutNode()?._id"
9775
+ [multiple]="options?.multiple"
9776
+ [name]="controlName"
9777
+ [(ngModel)]="controlValue"
9778
+ (change)="updateValue($event)">
9779
+ <ng-template ngFor let-selectItem [ngForOf]="selectList">
9780
+ <option *ngIf="!isArray(selectItem?.items)"
9781
+ [selected]="selectItem?.value === controlValue"
9782
+ [value]="selectItem?.value">
9783
+ <span [innerHTML]="selectItem?.name"></span>
9784
+ </option>
9785
+ <optgroup *ngIf="isArray(selectItem?.items)"
9786
+ [label]="selectItem?.group">
9787
+ <option *ngFor="let subItem of selectItem.items"
9788
+ [attr.selected]="subItem?.value === controlValue"
9789
+ [value]="subItem?.value">
9790
+ <span [innerHTML]="subItem?.name"></span>
9791
+ </option>
9792
+ </optgroup>
9793
+ </ng-template>
9794
+ </select>
9795
+ </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.SelectMultipleControlValueAccessor, selector: "select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
8679
9796
  }
8680
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SelectComponent, decorators: [{
9797
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SelectComponent, decorators: [{
8681
9798
  type: Component,
8682
9799
  args: [{
8683
9800
  // tslint:disable-next-line:component-selector
@@ -8690,7 +9807,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
8690
9807
  [class]="options?.labelHtmlClass || ''"
8691
9808
  [style.display]="options?.notitle ? 'none' : ''"
8692
9809
  [innerHTML]="options?.title"></label>
8693
- <select *ngIf="boundControl"
9810
+ <select *ngIf="boundControl && !options?.multiple"
8694
9811
  [formControl]="formControl"
8695
9812
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
8696
9813
  [attr.readonly]="options?.readonly ? 'readonly' : null"
@@ -8737,6 +9854,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
8737
9854
  </optgroup>
8738
9855
  </ng-template>
8739
9856
  </select>
9857
+ <select *ngIf="boundControl && options?.multiple"
9858
+ [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
9859
+ [attr.readonly]="options?.readonly ? 'readonly' : null"
9860
+ [attr.required]="options?.required"
9861
+ [class]="options?.fieldHtmlClass || ''"
9862
+ [disabled]="controlDisabled"
9863
+ [id]="'control' + layoutNode()?._id"
9864
+ [multiple]="options?.multiple"
9865
+ [name]="controlName"
9866
+ [(ngModel)]="controlValue"
9867
+ (change)="updateValue($event)">
9868
+ <ng-template ngFor let-selectItem [ngForOf]="selectList">
9869
+ <option *ngIf="!isArray(selectItem?.items)"
9870
+ [selected]="selectItem?.value === controlValue"
9871
+ [value]="selectItem?.value">
9872
+ <span [innerHTML]="selectItem?.name"></span>
9873
+ </option>
9874
+ <optgroup *ngIf="isArray(selectItem?.items)"
9875
+ [label]="selectItem?.group">
9876
+ <option *ngFor="let subItem of selectItem.items"
9877
+ [attr.selected]="subItem?.value === controlValue"
9878
+ [value]="subItem?.value">
9879
+ <span [innerHTML]="subItem?.name"></span>
9880
+ </option>
9881
+ </optgroup>
9882
+ </ng-template>
9883
+ </select>
8740
9884
  </div>`,
8741
9885
  standalone: false
8742
9886
  }]
@@ -8754,6 +9898,7 @@ class SubmitComponent {
8754
9898
  ngOnDestroy() {
8755
9899
  this.isValidChangesSubs?.unsubscribe();
8756
9900
  this.isValidChangesSubs = null;
9901
+ this.updateValue({ target: { value: null } });
8757
9902
  }
8758
9903
  ngOnInit() {
8759
9904
  this.options = this.layoutNode().options || {};
@@ -8777,8 +9922,8 @@ class SubmitComponent {
8777
9922
  this.jsf.updateValue(this, event.target.value);
8778
9923
  }
8779
9924
  }
8780
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SubmitComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8781
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: SubmitComponent, isStandalone: false, selector: "submit-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
9925
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SubmitComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9926
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: SubmitComponent, isStandalone: false, selector: "submit-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
8782
9927
  <div
8783
9928
  [class]="options?.htmlClass || ''">
8784
9929
  <input
@@ -8794,7 +9939,7 @@ class SubmitComponent {
8794
9939
  (click)="updateValue($event)">
8795
9940
  </div>`, isInline: true }); }
8796
9941
  }
8797
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SubmitComponent, decorators: [{
9942
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SubmitComponent, decorators: [{
8798
9943
  type: Component,
8799
9944
  args: [{
8800
9945
  // tslint:disable-next-line:component-selector
@@ -8828,8 +9973,8 @@ class TabComponent {
8828
9973
  ngOnInit() {
8829
9974
  this.options = this.layoutNode().options || {};
8830
9975
  }
8831
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TabComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8832
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: TabComponent, isStandalone: false, selector: "tab-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
9976
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TabComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9977
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: TabComponent, isStandalone: false, selector: "tab-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
8833
9978
  <div [class]="options?.htmlClass || ''">
8834
9979
  <root-widget
8835
9980
  [dataIndex]="dataIndex()"
@@ -8837,7 +9982,7 @@ class TabComponent {
8837
9982
  [layout]="layoutNode().items"></root-widget>
8838
9983
  </div>`, isInline: true, dependencies: [{ kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }] }); }
8839
9984
  }
8840
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TabComponent, decorators: [{
9985
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TabComponent, decorators: [{
8841
9986
  type: Component,
8842
9987
  args: [{
8843
9988
  // tslint:disable-next-line:component-selector
@@ -8853,107 +9998,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
8853
9998
  }]
8854
9999
  }] });
8855
10000
 
8856
- class TabsComponent {
8857
- constructor() {
8858
- this.jsf = inject(JsonSchemaFormService);
8859
- this.selectedItem = 0;
8860
- this.showAddTab = true;
8861
- this.layoutNode = input(undefined);
8862
- this.layoutIndex = input(undefined);
8863
- this.dataIndex = input(undefined);
8864
- }
8865
- ngOnInit() {
8866
- this.options = this.layoutNode().options || {};
8867
- this.itemCount = this.layoutNode().items.length - 1;
8868
- this.updateControl();
8869
- }
8870
- select(index) {
8871
- const layoutNode = this.layoutNode();
8872
- if (layoutNode.items[index].type === '$ref') {
8873
- this.itemCount = layoutNode.items.length;
8874
- this.jsf.addItem({
8875
- layoutNode: signal(layoutNode.items[index]),
8876
- layoutIndex: signal(this.layoutIndex().concat(index)),
8877
- dataIndex: signal(this.dataIndex().concat(index))
8878
- });
8879
- this.updateControl();
8880
- }
8881
- this.selectedItem = index;
8882
- }
8883
- updateControl() {
8884
- const lastItem = this.layoutNode().items[this.layoutNode().items.length - 1];
8885
- if (lastItem.type === '$ref' &&
8886
- this.itemCount >= (lastItem.options.maxItems || 1000)) {
8887
- this.showAddTab = false;
8888
- }
8889
- }
8890
- setTabTitle(item, index) {
8891
- return this.jsf.setArrayItemTitle(this, item, index);
8892
- }
8893
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8894
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: TabsComponent, isStandalone: false, selector: "tabs-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
8895
- <ul
8896
- [class]="options?.labelHtmlClass || ''">
8897
- <li *ngFor="let item of layoutNode()?.items; let i = index"
8898
- [class]="(options?.itemLabelHtmlClass || '') + (selectedItem === i ?
8899
- (' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
8900
- (' ' + options?.style?.unselected))"
8901
- role="presentation"
8902
- data-tabs>
8903
- <a *ngIf="showAddTab || item.type !== '$ref'"
8904
- [class]="'nav-link' + (selectedItem === i ? (' ' + options?.activeClass + ' ' + options?.style?.selected) :
8905
- (' ' + options?.style?.unselected))"
8906
- [innerHTML]="setTabTitle(item, i)"
8907
- (click)="select(i)"></a>
8908
- </li>
8909
- </ul>
8910
-
8911
- <div *ngFor="let layoutItem of layoutNode()?.items; let i = index"
8912
- [class]="options?.htmlClass || ''">
8913
-
8914
- <select-framework-widget *ngIf="selectedItem === i"
8915
- [class]="(options?.fieldHtmlClass || '') +
8916
- ' ' + (options?.activeClass || '') +
8917
- ' ' + (options?.style?.selected || '')"
8918
- [dataIndex]="layoutNode()?.dataType === 'array' ? (dataIndex() || []).concat(i) : dataIndex()"
8919
- [layoutIndex]="(layoutIndex() || []).concat(i)"
8920
- [layoutNode]="layoutItem"></select-framework-widget>
8921
-
8922
- </div>`, isInline: true, styles: ["a{cursor:pointer}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: SelectFrameworkComponent, selector: "select-framework-widget", inputs: ["layoutNode", "layoutIndex", "dataIndex"] }] }); }
8923
- }
8924
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TabsComponent, decorators: [{
8925
- type: Component,
8926
- args: [{ selector: 'tabs-widget', template: `
8927
- <ul
8928
- [class]="options?.labelHtmlClass || ''">
8929
- <li *ngFor="let item of layoutNode()?.items; let i = index"
8930
- [class]="(options?.itemLabelHtmlClass || '') + (selectedItem === i ?
8931
- (' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
8932
- (' ' + options?.style?.unselected))"
8933
- role="presentation"
8934
- data-tabs>
8935
- <a *ngIf="showAddTab || item.type !== '$ref'"
8936
- [class]="'nav-link' + (selectedItem === i ? (' ' + options?.activeClass + ' ' + options?.style?.selected) :
8937
- (' ' + options?.style?.unselected))"
8938
- [innerHTML]="setTabTitle(item, i)"
8939
- (click)="select(i)"></a>
8940
- </li>
8941
- </ul>
8942
-
8943
- <div *ngFor="let layoutItem of layoutNode()?.items; let i = index"
8944
- [class]="options?.htmlClass || ''">
8945
-
8946
- <select-framework-widget *ngIf="selectedItem === i"
8947
- [class]="(options?.fieldHtmlClass || '') +
8948
- ' ' + (options?.activeClass || '') +
8949
- ' ' + (options?.style?.selected || '')"
8950
- [dataIndex]="layoutNode()?.dataType === 'array' ? (dataIndex() || []).concat(i) : dataIndex()"
8951
- [layoutIndex]="(layoutIndex() || []).concat(i)"
8952
- [layoutNode]="layoutItem"></select-framework-widget>
8953
-
8954
- </div>`, standalone: false, styles: ["a{cursor:pointer}\n"] }]
8955
- }] });
8956
-
8957
10001
  class TemplateComponent {
8958
10002
  constructor() {
8959
10003
  this.jsf = inject(JsonSchemaFormService);
@@ -8981,10 +10025,10 @@ class TemplateComponent {
8981
10025
  }
8982
10026
  }
8983
10027
  }
8984
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TemplateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8985
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.6", type: TemplateComponent, isStandalone: false, selector: "template-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "widgetContainer", first: true, predicate: ["widgetContainer"], descendants: true, read: ViewContainerRef, isSignal: true }], usesOnChanges: true, ngImport: i0, template: `<div #widgetContainer></div>`, isInline: true }); }
10028
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TemplateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
10029
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.14", type: TemplateComponent, isStandalone: false, selector: "template-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "widgetContainer", first: true, predicate: ["widgetContainer"], descendants: true, read: ViewContainerRef, isSignal: true }], usesOnChanges: true, ngImport: i0, template: `<div #widgetContainer></div>`, isInline: true }); }
8986
10030
  }
8987
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TemplateComponent, decorators: [{
10031
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TemplateComponent, decorators: [{
8988
10032
  type: Component,
8989
10033
  args: [{
8990
10034
  // tslint:disable-next-line:component-selector
@@ -9010,8 +10054,11 @@ class TextareaComponent {
9010
10054
  updateValue(event) {
9011
10055
  this.jsf.updateValue(this, event.target.value);
9012
10056
  }
9013
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TextareaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9014
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: TextareaComponent, isStandalone: false, selector: "textarea-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
10057
+ ngOnDestroy() {
10058
+ this.jsf.updateValue(this, null);
10059
+ }
10060
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TextareaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
10061
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: TextareaComponent, isStandalone: false, selector: "textarea-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
9015
10062
  <div
9016
10063
  [class]="options?.htmlClass || ''">
9017
10064
  <label *ngIf="options?.title"
@@ -9047,7 +10094,7 @@ class TextareaComponent {
9047
10094
  (input)="updateValue($event)">{{controlValue}}</textarea>
9048
10095
  </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
9049
10096
  }
9050
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TextareaComponent, decorators: [{
10097
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TextareaComponent, decorators: [{
9051
10098
  type: Component,
9052
10099
  args: [{
9053
10100
  // tslint:disable-next-line:component-selector
@@ -9284,10 +10331,10 @@ class WidgetLibraryService {
9284
10331
  activeWidgets: this.activeWidgets,
9285
10332
  };
9286
10333
  }
9287
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: WidgetLibraryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
9288
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: WidgetLibraryService, providedIn: 'root' }); }
10334
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
10335
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryService, providedIn: 'root' }); }
9289
10336
  }
9290
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: WidgetLibraryService, decorators: [{
10337
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryService, decorators: [{
9291
10338
  type: Injectable,
9292
10339
  args: [{
9293
10340
  providedIn: 'root',
@@ -9304,17 +10351,23 @@ const BASIC_WIDGETS = [
9304
10351
  ];
9305
10352
 
9306
10353
  class WidgetLibraryModule {
9307
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: WidgetLibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
9308
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.6", ngImport: i0, type: WidgetLibraryModule, declarations: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, OrderableDirective, ElementAttributeDirective], imports: [CommonModule, FormsModule, ReactiveFormsModule, i2$1.SortablejsModule], exports: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, OrderableDirective, ElementAttributeDirective] }); }
9309
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: WidgetLibraryModule, imports: [CommonModule, FormsModule, ReactiveFormsModule,
10354
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
10355
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryModule, declarations: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, OrderableDirective, ElementAttributeDirective], imports: [CommonModule, FormsModule, ReactiveFormsModule, i2$1.SortablejsModule], exports: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, OrderableDirective, ElementAttributeDirective] }); }
10356
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryModule, imports: [CommonModule, FormsModule, ReactiveFormsModule,
9310
10357
  SortablejsModule.forRoot({
9311
10358
  //disabled:false,
9312
10359
  //draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
9313
10360
  filter: ".sortable-filter", //needed to disable dragging on input range elements, class needs to be added to the element or its parent
9314
- preventOnFilter: false //needed for input range elements slider do still work
10361
+ preventOnFilter: false, //needed for input range elements slider do still work
10362
+ onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
10363
+ if (evt.related.classList.contains("sortable-fixed")) {
10364
+ //console.log(evt.related);
10365
+ return false;
10366
+ }
10367
+ }
9315
10368
  })] }); }
9316
10369
  }
9317
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: WidgetLibraryModule, decorators: [{
10370
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryModule, decorators: [{
9318
10371
  type: NgModule,
9319
10372
  args: [{
9320
10373
  imports: [CommonModule, FormsModule, ReactiveFormsModule,
@@ -9322,7 +10375,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
9322
10375
  //disabled:false,
9323
10376
  //draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
9324
10377
  filter: ".sortable-filter", //needed to disable dragging on input range elements, class needs to be added to the element or its parent
9325
- preventOnFilter: false //needed for input range elements slider do still work
10378
+ preventOnFilter: false, //needed for input range elements slider do still work
10379
+ onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
10380
+ if (evt.related.classList.contains("sortable-fixed")) {
10381
+ //console.log(evt.related);
10382
+ return false;
10383
+ }
10384
+ }
9326
10385
  })],
9327
10386
  declarations: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective],
9328
10387
  exports: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective]
@@ -9331,13 +10390,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
9331
10390
 
9332
10391
  // No framework - plain HTML controls (styles from form layout only)
9333
10392
  class NoFrameworkModule {
9334
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoFrameworkModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
9335
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.6", ngImport: i0, type: NoFrameworkModule, declarations: [NoFrameworkComponent], imports: [CommonModule, WidgetLibraryModule], exports: [NoFrameworkComponent] }); }
9336
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoFrameworkModule, providers: [
10393
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFrameworkModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
10394
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: NoFrameworkModule, declarations: [NoFrameworkComponent], imports: [CommonModule, WidgetLibraryModule], exports: [NoFrameworkComponent] }); }
10395
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFrameworkModule, providers: [
9337
10396
  { provide: Framework, useClass: NoFramework, multi: true }
9338
10397
  ], imports: [CommonModule, WidgetLibraryModule] }); }
9339
10398
  }
9340
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoFrameworkModule, decorators: [{
10399
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFrameworkModule, decorators: [{
9341
10400
  type: NgModule,
9342
10401
  args: [{
9343
10402
  imports: [CommonModule, WidgetLibraryModule],
@@ -9501,10 +10560,10 @@ class FrameworkLibraryService {
9501
10560
  return actFramework.unregisterTheme(name);
9502
10561
  }
9503
10562
  }
9504
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: FrameworkLibraryService, deps: [{ token: Framework }], target: i0.ɵɵFactoryTarget.Injectable }); }
9505
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: FrameworkLibraryService, providedIn: 'root' }); }
10563
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FrameworkLibraryService, deps: [{ token: Framework }], target: i0.ɵɵFactoryTarget.Injectable }); }
10564
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FrameworkLibraryService, providedIn: 'root' }); }
9506
10565
  }
9507
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: FrameworkLibraryService, decorators: [{
10566
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FrameworkLibraryService, decorators: [{
9508
10567
  type: Injectable,
9509
10568
  args: [{
9510
10569
  providedIn: 'root',
@@ -9567,7 +10626,7 @@ class JsonSchemaFormComponent {
9567
10626
  this.previousInputs = {
9568
10627
  schema: null, layout: null, data: null, options: null, framework: null,
9569
10628
  widgets: null, form: null, model: null, JSONSchema: null, UISchema: null,
9570
- formData: null, loadExternalAssets: null, debug: null,
10629
+ formData: null, loadExternalAssets: null, debug: null, ajvOptions: null
9571
10630
  };
9572
10631
  // Recommended inputs
9573
10632
  this.schema = input(undefined); // The JSON Schema
@@ -9590,6 +10649,7 @@ class JsonSchemaFormComponent {
9590
10649
  this.loadExternalAssets = input(undefined); // Load external framework assets?
9591
10650
  this.debug = input(undefined); // Show debug information?
9592
10651
  this.theme = input(undefined); // Theme
10652
+ this.ajvOptions = input(undefined); // ajvOptions
9593
10653
  // Outputs
9594
10654
  this.onChanges = output(); // Live unvalidated internal form data
9595
10655
  this.onSubmit = output(); // Complete validated form data
@@ -9811,6 +10871,7 @@ class JsonSchemaFormComponent {
9811
10871
  this.jsf.data) {
9812
10872
  // Reset all form values to defaults
9813
10873
  this.jsf.resetAllValues();
10874
+ this.initializeAjv();
9814
10875
  this.initializeOptions(); // Update options
9815
10876
  this.initializeSchema(); // Update schema, schemaRefLibrary,
9816
10877
  // schemaRecursiveRefMap, & dataRecursiveRefMap
@@ -9861,6 +10922,20 @@ class JsonSchemaFormComponent {
9861
10922
  this.formInitialized = true;
9862
10923
  }
9863
10924
  }
10925
+ /**
10926
+ * 'initializeAjv' function
10927
+ *
10928
+ * Initialize ajv from 'ajvOptions'
10929
+ */
10930
+ initializeAjv() {
10931
+ const form = this.form();
10932
+ const ajvOptions = cloneDeep(this.ajvOptions()) ||
10933
+ (form && hasOwn(form, 'ajvOptions') && isObject(form.ajvOptions)
10934
+ && cloneDeep(form.ajvOptions));
10935
+ if (ajvOptions) {
10936
+ this.ajvInstanceName = this.jsf.createAndRegisterAjvInstance(ajvOptions).name;
10937
+ }
10938
+ }
9864
10939
  /**
9865
10940
  * 'initializeOptions' function
9866
10941
  *
@@ -9984,7 +11059,8 @@ class JsonSchemaFormComponent {
9984
11059
  // draft 3 (JSON Form style) and draft 4 (Angular Schema Form style)
9985
11060
  this.jsf.schema = convertSchemaToDraft6(this.jsf.schema);
9986
11061
  // Initialize ajv and compile schema
9987
- this.jsf.compileAjvSchema();
11062
+ //this.jsf.compileAjvSchema();
11063
+ //moved to initializeAjv()
9988
11064
  // Create schemaRefLibrary, schemaRecursiveRefMap, dataRecursiveRefMap, & arrayMap
9989
11065
  this.jsf.schema = resolveSchemaReferences(this.jsf.schema, this.jsf.schemaRefLibrary, this.jsf.schemaRecursiveRefMap, this.jsf.dataRecursiveRefMap, this.jsf.arrayMap);
9990
11066
  if (hasOwn(this.jsf.schemaRefLibrary, '')) {
@@ -10188,7 +11264,8 @@ class JsonSchemaFormComponent {
10188
11264
  }
10189
11265
  if (!isEmpty(this.jsf.schema)) {
10190
11266
  // If not already initialized, initialize ajv and compile schema
10191
- this.jsf.compileAjvSchema();
11267
+ //this.jsf.compileAjvSchema();
11268
+ //moved to initializeAjv()
10192
11269
  // Update all layout elements, add values, widgets, and validators,
10193
11270
  // replace any '*' with a layout built from all schema elements,
10194
11271
  // and update the FormGroup template with any new validators
@@ -10196,7 +11273,7 @@ class JsonSchemaFormComponent {
10196
11273
  // Build the Angular FormGroup template from the schema
10197
11274
  this.jsf.buildFormGroupTemplate(this.jsf.formValues);
10198
11275
  // Build the real Angular FormGroup from the FormGroup template
10199
- this.jsf.buildFormGroup();
11276
+ this.jsf.buildFormGroup(this.ajvInstanceName);
10200
11277
  }
10201
11278
  if (this.jsf.formGroup) {
10202
11279
  // Reset initial form values
@@ -10246,10 +11323,10 @@ class JsonSchemaFormComponent {
10246
11323
  }
10247
11324
  }
10248
11325
  }
10249
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonSchemaFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
10250
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: JsonSchemaFormComponent, isStandalone: false, selector: "json-schema-form", inputs: { schema: { classPropertyName: "schema", publicName: "schema", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, framework: { classPropertyName: "framework", publicName: "framework", isSignal: true, isRequired: false, transformFunction: null }, widgets: { classPropertyName: "widgets", publicName: "widgets", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, JSONSchema: { classPropertyName: "JSONSchema", publicName: "JSONSchema", isSignal: true, isRequired: false, transformFunction: null }, UISchema: { classPropertyName: "UISchema", publicName: "UISchema", isSignal: true, isRequired: false, transformFunction: null }, formData: { classPropertyName: "formData", publicName: "formData", isSignal: true, isRequired: false, transformFunction: null }, ngModel: { classPropertyName: "ngModel", publicName: "ngModel", isSignal: true, isRequired: false, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, loadExternalAssets: { classPropertyName: "loadExternalAssets", publicName: "loadExternalAssets", isSignal: true, isRequired: false, transformFunction: null }, debug: { classPropertyName: "debug", publicName: "debug", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { onChanges: "onChanges", onSubmit: "onSubmit", isValid: "isValid", validationErrors: "validationErrors", formSchema: "formSchema", formLayout: "formLayout", dataChange: "dataChange", modelChange: "modelChange", formDataChange: "formDataChange", ngModelChange: "ngModelChange" }, providers: [JsonSchemaFormService, JSON_SCHEMA_FORM_VALUE_ACCESSOR], usesOnChanges: true, ngImport: i0, template: "<form [autocomplete]=\"jsf?.formOptions?.autocomplete ? 'on' : 'off'\" class=\"json-schema-form\" (ngSubmit)=\"submitForm()\">\r\n <root-widget [layout]=\"jsf?.layout\"></root-widget>\r\n</form>\r\n<div *ngIf=\"debug() || jsf?.formOptions?.debug\">\r\n Debug output:\r\n <pre>{{debugOutput}}</pre>\r\n</div>", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
11326
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonSchemaFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
11327
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: JsonSchemaFormComponent, isStandalone: false, selector: "json-schema-form", inputs: { schema: { classPropertyName: "schema", publicName: "schema", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, framework: { classPropertyName: "framework", publicName: "framework", isSignal: true, isRequired: false, transformFunction: null }, widgets: { classPropertyName: "widgets", publicName: "widgets", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, JSONSchema: { classPropertyName: "JSONSchema", publicName: "JSONSchema", isSignal: true, isRequired: false, transformFunction: null }, UISchema: { classPropertyName: "UISchema", publicName: "UISchema", isSignal: true, isRequired: false, transformFunction: null }, formData: { classPropertyName: "formData", publicName: "formData", isSignal: true, isRequired: false, transformFunction: null }, ngModel: { classPropertyName: "ngModel", publicName: "ngModel", isSignal: true, isRequired: false, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, loadExternalAssets: { classPropertyName: "loadExternalAssets", publicName: "loadExternalAssets", isSignal: true, isRequired: false, transformFunction: null }, debug: { classPropertyName: "debug", publicName: "debug", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, ajvOptions: { classPropertyName: "ajvOptions", publicName: "ajvOptions", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { onChanges: "onChanges", onSubmit: "onSubmit", isValid: "isValid", validationErrors: "validationErrors", formSchema: "formSchema", formLayout: "formLayout", dataChange: "dataChange", modelChange: "modelChange", formDataChange: "formDataChange", ngModelChange: "ngModelChange" }, providers: [JsonSchemaFormService, JSON_SCHEMA_FORM_VALUE_ACCESSOR], usesOnChanges: true, ngImport: i0, template: "<form [autocomplete]=\"jsf?.formOptions?.autocomplete ? 'on' : 'off'\" class=\"json-schema-form\" (ngSubmit)=\"submitForm()\">\r\n <root-widget [layout]=\"jsf?.layout\"></root-widget>\r\n</form>\r\n<div *ngIf=\"debug() || jsf?.formOptions?.debug\">\r\n Debug output:\r\n <pre>{{debugOutput}}</pre>\r\n</div>", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
10251
11328
  }
10252
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonSchemaFormComponent, decorators: [{
11329
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonSchemaFormComponent, decorators: [{
10253
11330
  type: Component,
10254
11331
  args: [{ selector: 'json-schema-form', changeDetection: ChangeDetectionStrategy.OnPush, providers: [JsonSchemaFormService, JSON_SCHEMA_FORM_VALUE_ACCESSOR], standalone: false, template: "<form [autocomplete]=\"jsf?.formOptions?.autocomplete ? 'on' : 'off'\" class=\"json-schema-form\" (ngSubmit)=\"submitForm()\">\r\n <root-widget [layout]=\"jsf?.layout\"></root-widget>\r\n</form>\r\n<div *ngIf=\"debug() || jsf?.formOptions?.debug\">\r\n Debug output:\r\n <pre>{{debugOutput}}</pre>\r\n</div>" }]
10255
11332
  }], propDecorators: { value: [{
@@ -10257,13 +11334,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
10257
11334
  }] } });
10258
11335
 
10259
11336
  class JsonSchemaFormModule {
10260
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonSchemaFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
10261
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.6", ngImport: i0, type: JsonSchemaFormModule, declarations: [JsonSchemaFormComponent], imports: [CommonModule, FormsModule, ReactiveFormsModule,
11337
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonSchemaFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
11338
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: JsonSchemaFormModule, declarations: [JsonSchemaFormComponent], imports: [CommonModule, FormsModule, ReactiveFormsModule,
10262
11339
  WidgetLibraryModule, NoFrameworkModule], exports: [JsonSchemaFormComponent, WidgetLibraryModule] }); }
10263
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonSchemaFormModule, imports: [CommonModule, FormsModule, ReactiveFormsModule,
11340
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonSchemaFormModule, imports: [CommonModule, FormsModule, ReactiveFormsModule,
10264
11341
  WidgetLibraryModule, NoFrameworkModule, WidgetLibraryModule] }); }
10265
11342
  }
10266
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonSchemaFormModule, decorators: [{
11343
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonSchemaFormModule, decorators: [{
10267
11344
  type: NgModule,
10268
11345
  args: [{
10269
11346
  imports: [
@@ -10283,5 +11360,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
10283
11360
  * Generated bundle index. Do not edit.
10284
11361
  */
10285
11362
 
10286
- export { AddReferenceComponent, BASIC_WIDGETS, ButtonComponent, CheckboxComponent, CheckboxesComponent, ElementAttributeDirective, FileComponent, Framework, FrameworkLibraryService, HiddenComponent, InputComponent, JsonPointer, JsonSchemaFormComponent, JsonSchemaFormModule, JsonSchemaFormService, JsonValidators, MessageComponent, NoneComponent, NumberComponent, OneOfComponent, OrderableDirective, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, WidgetLibraryModule, WidgetLibraryService, _executeAsyncValidators, _executeValidators, _mergeErrors, _mergeObjects, _toPromise, addClasses, buildFormGroup, buildFormGroupTemplate, buildLayout, buildLayoutFromSchema, buildSchemaFromData, buildSchemaFromLayout, buildTitleMap, checkInlineType, combineAllOf, commonItems, convertSchemaToDraft6, copy, deValidationMessages, enValidationMessages, esValidationMessages, fixRequiredArrayProperties, fixTitle, forEach, forEachCopy, formatFormData, frValidationMessages, getControl, getControlValidators, getFromSchema, getInputType, getLayoutNode, getSubSchema, getTitleMapFromOneOf, getType, hasOwn, hasValue, inArray, isArray, isBoolean, isDate, isDefined, isEmpty, isFunction, isInputRequired, isInteger, isMap, isNumber, isObject, isObservable, isPrimitive, isPromise, isSet, isString, isType, itValidationMessages, mapLayout, mergeFilteredObject, mergeSchemas, ptValidationMessages, removeRecursiveReferences, resolveSchemaReferences, setRequiredFields, toJavaScriptType, toObservable, toSchemaType, toTitleCase, uniqueItems, updateInputOptions, xor, zhValidationMessages };
11363
+ export { AddReferenceComponent, BASIC_WIDGETS, ButtonComponent, CheckboxComponent, CheckboxesComponent, ElementAttributeDirective, FileComponent, Framework, FrameworkLibraryService, HiddenComponent, InputComponent, JsonPointer, JsonSchemaFormComponent, JsonSchemaFormModule, JsonSchemaFormService, JsonValidators, MessageComponent, NoneComponent, NumberComponent, OneOfComponent, OrderableDirective, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, WidgetLibraryModule, WidgetLibraryService, _executeAsyncValidators, _executeValidators, _mergeErrors, _mergeObjects, _toPromise, addClasses, buildFormGroup, buildFormGroupTemplate, buildLayout, buildLayoutFromSchema, buildSchemaFromData, buildSchemaFromLayout, buildTitleMap, checkInlineType, combineAllOf, commonItems, convertSchemaToDraft6, copy, deValidationMessages, enValidationMessages, esValidationMessages, fixRequiredArrayProperties, fixTitle, forEach, forEachCopy, formatFormData, frValidationMessages, getControl, getControlValidators, getFromSchema, getInputType, getLayoutNode, getSubSchema, getTitleMapFromOneOf, getType, hasNonNullValue, hasOwn, hasValue, inArray, isArray, isBoolean, isDate, isDefined, isEmpty, isFunction, isInputRequired, isInteger, isMap, isNumber, isObject, isObservable, isPrimitive, isPromise, isSet, isString, isType, itValidationMessages, mapLayout, mergeFilteredObject, mergeSchemas, path2ControlKey, ptValidationMessages, removeRecursiveReferences, resolveSchemaReferences, setControl, setRequiredFields, toJavaScriptType, toObservable, toSchemaType, toTitleCase, uniqueItems, updateInputOptions, xor, zhValidationMessages };
10287
11364
  //# sourceMappingURL=ng-formworks-core.mjs.map