@ng-formworks/core 19.5.7 → 19.6.0

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, 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,40 @@ 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, negate = false) {
4592
+ let conditionFun = "";
4593
+ let condition = {};
4594
+ let notOp = negate ? "!" : "";
4595
+ if (schema.if) {
4596
+ Object.keys(schema.if.properties).forEach((ifProp, ind) => {
4597
+ let amper = ind > 0 ? "&" : "";
4598
+ //Note the model value is first converted to string and so is the condition
4599
+ //so that booleans and numbers can also be compared
4600
+ conditionFun += `${amper}model.${ifProp}+""=='${schema.if.properties[ifProp].const}'`;
4601
+ });
4602
+ }
4603
+ condition["functionBody"] = `return ${notOp}(${conditionFun})`;
4604
+ return condition;
4605
+ }
4489
4606
 
4490
4607
  function convertSchemaToDraft6(schema, options = {}) {
4491
4608
  let draft = options.draft || null;
@@ -4786,6 +4903,17 @@ function convertSchemaToDraft6(schema, options = {}) {
4786
4903
  return newSchema;
4787
4904
  }
4788
4905
 
4906
+ /**
4907
+ * path2ControlKey takes a datapointer path like /some/pointer/path
4908
+ * and returns something like $some$pointer$path
4909
+ * used mainly to convert paths so it can be used as keys in FormGroups
4910
+ * fot ITE scenarios
4911
+ * @param path
4912
+ * @returns string
4913
+ */
4914
+ function path2ControlKey(path) {
4915
+ return path.replace(/\//g, "$");
4916
+ }
4789
4917
  /**
4790
4918
  * FormGroup function library:
4791
4919
  *
@@ -4834,11 +4962,13 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
4834
4962
  }
4835
4963
  // TODO: If nodeValue still not set, check layout for default value
4836
4964
  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';
4965
+ const isIfThenElse = hasOwn(schema, 'if') || hasOwn(schema, 'then') || hasOwn(schema, 'else');
4966
+ const controlType = isIfThenElse && !schemaType ? 'IfThenElse' :
4967
+ (hasOwn(schema, 'properties') || hasOwn(schema, 'additionalProperties')) &&
4968
+ schemaType === 'object' ? 'FormGroup' :
4969
+ (hasOwn(schema, 'items') || hasOwn(schema, 'additionalItems')) &&
4970
+ schemaType === 'array' ? 'FormArray' :
4971
+ !schemaType && hasOwn(schema, '$ref') ? '$ref' : 'FormControl';
4842
4972
  const shortDataPointer = removeRecursiveReferences(dataPointer, jsf.dataRecursiveRefMap, jsf.arrayMap);
4843
4973
  if (!jsf.dataMap.has(shortDataPointer)) {
4844
4974
  jsf.dataMap.set(shortDataPointer, new Map());
@@ -4877,8 +5007,135 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
4877
5007
  propertyKeys
4878
5008
  .filter(key => hasOwn(schema.properties, key) ||
4879
5009
  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));
5010
+ .forEach(key => {
5011
+ controls[key] = buildFormGroupTemplate(jsf, JsonPointer.get(nodeValue, [key]), setValues, schemaPointer + (hasOwn(schema.properties, key) ?
5012
+ '/properties/' + key : '/additionalProperties'), dataPointer + '/' + key, templatePointer + '/controls/' + key);
5013
+ //add the $<control> type to the root
5014
+ //so it can be flattened and acceses directly in the formgroup
5015
+ //by its full '$' path
5016
+ ["allOf", "anyOf", "oneOf"].forEach(ofType => {
5017
+ if (controls[key].controls && controls[key].controls[`_${ofType}`]) {
5018
+ Object.keys(controls[key].controls[`_${ofType}`]).forEach($key => {
5019
+ controls[$key] = controls[key].controls[`_${ofType}`][$key];
5020
+ delete controls[key].controls[$key];
5021
+ });
5022
+ delete controls[key].controls[`_${ofType}`];
5023
+ }
5024
+ });
5025
+ });
5026
+ if (hasOwn(schema, "if")) {
5027
+ ["then", "else"].forEach(con => {
5028
+ if (hasOwn(schema, con)) {
5029
+ const keySchemaPointer = `/${con}`;
5030
+ let thenFGTemplate = buildFormGroupTemplate(jsf, nodeValue, false, //JsonPointer.get(nodeValue, keySchemaPointer), setValues,
5031
+ schemaPointer + keySchemaPointer, dataPointer, templatePointer + `/controls/${con}`);
5032
+ Object.assign(controls, thenFGTemplate.controls);
5033
+ }
5034
+ });
5035
+ }
5036
+ /* treat allOf the same as any of but need to add an extra
5037
+ condition for which anyOf item is to be rendered
5038
+ let allOfControls = {}
5039
+ let allOfAllowedKeys = ["allOf", "anyOf", "oneOf", "if", "then", "else", "type", "properties", "items"];
5040
+ if (hasOwn(schema, "allOf") && isArray(schema.allOf)) {
5041
+ schema.allOf.forEach((allOfItem, ind) => {
5042
+ let aoItemKeys = Object.keys(allOfItem);
5043
+ let foundKeys = allOfAllowedKeys.filter(value =>
5044
+ aoItemKeys.includes(value)
5045
+ );
5046
+ if (foundKeys && foundKeys.length > 0) {
5047
+ const keySchemaPointer = `/allOf/${ind}`;
5048
+ //console.log(`found:${keySchemaPointer}`);
5049
+ let allOfFGTemplate = buildFormGroupTemplate(
5050
+ jsf, JsonPointer.get(nodeValue, keySchemaPointer), setValues,
5051
+ schemaPointer + keySchemaPointer,
5052
+ dataPointer,
5053
+ templatePointer + '/controls/' + ind
5054
+ );
5055
+ if (allOfFGTemplate.controls) {
5056
+ Object.keys(allOfFGTemplate.controls).forEach(key => {
5057
+ let controlKey = allOfFGTemplate.controls[key].schemaPointer || `${schemaPointer}${keySchemaPointer}/${key}`;
5058
+ controlKey = path2ControlKey(controlKey);
5059
+ controls[controlKey] = {
5060
+ key: key,
5061
+ schemaPointer: schemaPointer + keySchemaPointer,
5062
+ controls: allOfFGTemplate.controls[key]
5063
+ }
5064
+ controls[controlKey] = allOfFGTemplate.controls[key];
5065
+ controls[controlKey].key = key;
5066
+ controls[controlKey].schemaPointer = allOfFGTemplate.controls[key].schemaPointer || schemaPointer + keySchemaPointer;
5067
+
5068
+ controls[key] = allOfFGTemplate.controls[key];
5069
+ })
5070
+ }
5071
+ //add ui type items to controls
5072
+ if (allOfItem["type"] || allOfItem["properties"] || allOfItem["items"]) {
5073
+ allOfControls[ind] = allOfFGTemplate
5074
+ }
5075
+
5076
+ }
5077
+
5078
+ })
5079
+ controls["allOf"] = allOfControls;
5080
+ }
5081
+ */
5082
+ let ofAllowedKeys = ["allOf", "anyOf", "oneOf", "if", "then", "else", "type", "properties", "items"];
5083
+ ["allOf", "anyOf", "oneOf"].forEach(ofType => {
5084
+ if (hasOwn(schema, ofType) && isArray(schema[ofType])) {
5085
+ schema[ofType].forEach((ofItem, ind) => {
5086
+ let aoItemKeys = Object.keys(ofItem);
5087
+ let foundKeys = ofAllowedKeys.filter(value => aoItemKeys.includes(value));
5088
+ if (foundKeys && foundKeys.length > 0) {
5089
+ const keySchemaPointer = `/${ofType}/${ind}`;
5090
+ //console.log(`found:${keySchemaPointer}`);
5091
+ let newNodeValue = JsonPointer.get(nodeValue, keySchemaPointer);
5092
+ if (ofType == "oneOf") {
5093
+ newNodeValue = nodeValue;
5094
+ }
5095
+ let allOfFGTemplate = buildFormGroupTemplate(jsf, newNodeValue, setValues, schemaPointer + keySchemaPointer, dataPointer, templatePointer + '/controls/' + ind);
5096
+ if (allOfFGTemplate.controls) {
5097
+ Object.keys(allOfFGTemplate.controls).forEach(key => {
5098
+ const l2SchemaPointer = hasOwn(schema, 'properties') ?
5099
+ '/properties/' + key : key;
5100
+ let controlKey = allOfFGTemplate.controls[key].schemaPointer || `${schemaPointer}${keySchemaPointer}${l2SchemaPointer}`;
5101
+ controlKey = path2ControlKey(controlKey);
5102
+ /*
5103
+ controls[controlKey] = {
5104
+ key: key,
5105
+ schemaPointer: `${schemaPointer}${keySchemaPointer}/${key}`,//schemaPointer + keySchemaPointer,
5106
+ controls: allOfFGTemplate.controls[key]
5107
+ }
5108
+ */
5109
+ let controlItem = cloneDeep(allOfFGTemplate.controls[key]);
5110
+ controlItem.key = key;
5111
+ controlItem.schemaPointer = controlItem.schemaPointer || `${schemaPointer}${keySchemaPointer}${l2SchemaPointer}`;
5112
+ controls[controlKey] = controlItem;
5113
+ //need to test if value matches schema,
5114
+ //as the same oneOf item will be assigned to the same value
5115
+ //if key is a $oneOf key then it was inserted at the root of the controls
5116
+ //as form control name will be the full(escaped) path
5117
+ const pointerPath = key.startsWith('$oneOf') ? controlItem.schemaPointer : keySchemaPointer;
5118
+ let oneOfItemSchema = JsonPointer.get(schema, pointerPath);
5119
+ let oneOfItemValue = {};
5120
+ oneOfItemValue[key] = controlItem.value?.value;
5121
+ if (controlItem.value && !jsf.ajv.validate(oneOfItemSchema, oneOfItemValue)) {
5122
+ controlItem.value.value = null;
5123
+ }
5124
+ //controls[controlKey] = controlItem;
5125
+ //allOfFGTemplate.controls[key].schemaPointer ||`${schemaPointer}${keySchemaPointer}/${key}`;
5126
+ //allOfFGTemplate.controls[key].schemaPointer || schemaPointer + keySchemaPointer;
5127
+ controls[key] = cloneDeep(allOfFGTemplate.controls[key]);
5128
+ //add schemacontrol to root
5129
+ //controls[controlKey]=controlItem
5130
+ controls[`_${ofType}`] = controls[`_${ofType}`] || {};
5131
+ controls[`_${ofType}`][controlKey] = controlItem;
5132
+ //allOfFGTemplate.controls[key];
5133
+ });
5134
+ }
5135
+ }
5136
+ });
5137
+ }
5138
+ });
4882
5139
  jsf.formOptions.fieldsRequired = setRequiredFields(schema, controls);
4883
5140
  }
4884
5141
  return { controlType, controls, validators };
@@ -4961,6 +5218,29 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
4961
5218
  disabled: nodeOptions.get('disabled') || false
4962
5219
  };
4963
5220
  return { controlType, value, validators };
5221
+ //TODO may make an IFThenElse widget or integrate it with the section
5222
+ //widget
5223
+ case 'IfThenElse':
5224
+ controls = {};
5225
+ let conditionType;
5226
+ if (hasOwn(schema, "if")) {
5227
+ ["then", "else"].forEach(con => {
5228
+ if (hasOwn(schema, con)) {
5229
+ const keySchemaPointer = `/${con}`;
5230
+ let thenTFGTemplate = buildFormGroupTemplate(jsf, nodeValue, false, schemaPointer + keySchemaPointer, dataPointer, templatePointer + `/controls/${con}`);
5231
+ //NB same property can be in both then and else
5232
+ //so key must be the unique path to control
5233
+ Object.keys(thenTFGTemplate.controls).forEach(key => {
5234
+ let controlKey = thenTFGTemplate.controls[key].schemaPointer || `${schemaPointer}${keySchemaPointer}/${key}`;
5235
+ controlKey = path2ControlKey(controlKey);
5236
+ let cItem = Object.assign({}, thenTFGTemplate.controls[key]);
5237
+ cItem.schemaPointer = `${schemaPointer}${keySchemaPointer}/${key}`;
5238
+ controls[controlKey] = cItem;
5239
+ });
5240
+ }
5241
+ });
5242
+ }
5243
+ return { controlType, controls, validators };
4964
5244
  default:
4965
5245
  return null;
4966
5246
  }
@@ -4992,7 +5272,23 @@ function buildFormGroup(template) {
4992
5272
  const groupControls = {};
4993
5273
  forEach(template.controls, (controls, key) => {
4994
5274
  const newControl = buildFormGroup(controls);
5275
+ //if (newControl) { groupControls[key] = newControl; }
4995
5276
  if (newControl) {
5277
+ /* experimental idea was to try to be able to switch
5278
+ conditional controls dynamically based on their schema pointer
5279
+ (not datapointer as that only maps to one control)
5280
+ Object.defineProperty(groupControls, key, {
5281
+ get: () => {
5282
+ //console.log(`Accessed control: ${key}`);
5283
+ //add switch logic here
5284
+ return ncontrol;
5285
+ },
5286
+ set:(value)=>{
5287
+ ncontrol=value
5288
+ },
5289
+ enumerable: true
5290
+ })
5291
+ */
4996
5292
  groupControls[key] = newControl;
4997
5293
  }
4998
5294
  });
@@ -5142,6 +5438,9 @@ function formatFormData(formData, dataMap, recursiveRefMap, arrayMap, returnEmpt
5142
5438
  }
5143
5439
  else if (typeof value !== 'object' || isDate(value) ||
5144
5440
  (value === null && returnEmptyFields)) {
5441
+ if (genericPointer.substring(0, 2) == "/$") {
5442
+ return formattedData;
5443
+ }
5145
5444
  console.error('formatFormData error: ' +
5146
5445
  `Schema type not found for form value at ${genericPointer}`);
5147
5446
  console.error('dataMap', dataMap);
@@ -5166,14 +5465,15 @@ function formatFormData(formData, dataMap, recursiveRefMap, arrayMap, returnEmpt
5166
5465
  * // {Pointer} dataPointer - JSON Pointer (string or array)
5167
5466
  * // {boolean = false} returnGroup - If true, return group containing control
5168
5467
  * // {group} - Located value (or null, if no control found)
5468
+ * // {string} schemaPointer - string used for conditional controls coming from schema if/then/else
5169
5469
  */
5170
- function getControl(formGroup, dataPointer, returnGroup = false) {
5470
+ function getControl(formGroup, dataPointer, returnGroup = false, schemaPointer) {
5171
5471
  if (!isObject(formGroup) || !JsonPointer.isJsonPointer(dataPointer)) {
5172
5472
  if (!JsonPointer.isJsonPointer(dataPointer)) {
5173
5473
  // If dataPointer input is not a valid JSON pointer, check to
5174
5474
  // see if it is instead a valid object path, using dot notaion
5175
5475
  if (typeof dataPointer === 'string') {
5176
- const formControl = formGroup.get(dataPointer);
5476
+ const formControl = formGroup.get(path2ControlKey(schemaPointer || "")) || formGroup.get(dataPointer);
5177
5477
  if (formControl) {
5178
5478
  return formControl;
5179
5479
  }
@@ -5193,7 +5493,7 @@ function getControl(formGroup, dataPointer, returnGroup = false) {
5193
5493
  // try using formGroup.get() to return the control
5194
5494
  if (typeof formGroup.get === 'function' &&
5195
5495
  dataPointerArray.every(key => key.indexOf('.') === -1)) {
5196
- const formControl = formGroup.get(dataPointerArray.join('.'));
5496
+ const formControl = formGroup.get(path2ControlKey(schemaPointer || "")) || formGroup.get(dataPointerArray.join('.'));
5197
5497
  if (formControl) {
5198
5498
  return formControl;
5199
5499
  }
@@ -5221,6 +5521,68 @@ function getControl(formGroup, dataPointer, returnGroup = false) {
5221
5521
  }
5222
5522
  return subGroup;
5223
5523
  }
5524
+ /**
5525
+ * 'setControl' function
5526
+ *
5527
+ * Uses a JSON Pointer for a data object to retrieve a control from
5528
+ * an Angular formGroup or formGroup template. (Note: though a formGroup
5529
+ * template is much simpler, its basic structure is idential to a formGroup).
5530
+ *
5531
+ * If the optional third parameter 'returnGroup' is set to TRUE, the group
5532
+ * containing the control is returned, rather than the control itself.
5533
+ *
5534
+ * // {FormGroup} formGroup - Angular FormGroup to get value from
5535
+ * // {Pointer} dataPointer - JSON Pointer (string or array)
5536
+ * // {AbstractControl} control - control used to replace existing or add
5537
+ * // {targetKey} - optional string used as the new key-not implemented as yet
5538
+ */
5539
+ function setControl(formGroup, dataPointer, control, targetKey) {
5540
+ let dataPointerArray = JsonPointer.parse(dataPointer);
5541
+ // If formGroup input is a real formGroup (not a formGroup template)
5542
+ // try using formGroup.get() to return the control
5543
+ /*
5544
+ if (typeof formGroup.get === 'function' &&
5545
+ dataPointerArray.every(key => key.indexOf('.') === -1)
5546
+ ) {
5547
+ formGroup.setControl(dataPointerArray.join('.'), control);
5548
+ return;
5549
+ }
5550
+ */
5551
+ let currentGroup = formGroup;
5552
+ for (let i = 0; i < dataPointerArray.length - 1; i++) {
5553
+ // Navigate down the form structure to find the correct nested FormGroup
5554
+ currentGroup = currentGroup.get(dataPointerArray[i]);
5555
+ // If it's not a FormGroup, we throw an error since we can't set a control in a non-group.
5556
+ if (!(typeof currentGroup.setControl === 'function')) {
5557
+ throw new Error(`Path '${dataPointerArray[i]}' is not a valid FormGroup or FormArray.`);
5558
+ }
5559
+ }
5560
+ // Now we are at the parent FormGroup, set the control at the last part of the path
5561
+ const lastPart = dataPointerArray[dataPointerArray.length - 1];
5562
+ // Set the control at the final path (like 'name' inside 'state')
5563
+ currentGroup.setControl(lastPart, control);
5564
+ // If formGroup input is a formGroup template,
5565
+ // or formGroup.get() failed to return the control,
5566
+ // search the formGroup object for dataPointer's control
5567
+ //TODO needs to be adapted to setControl
5568
+ /*
5569
+ let subGroup = formGroup;
5570
+ for (const key of dataPointerArray) {
5571
+ if (hasOwn(subGroup, 'controls')) { subGroup = subGroup.controls; }
5572
+ if (isArray(subGroup) && (key === '-')) {
5573
+ subGroup = subGroup[subGroup.length - 1];
5574
+ } else if (hasOwn(subGroup, key)) {
5575
+ subGroup = subGroup[key];
5576
+ } else {
5577
+ console.error(`getControl error: Unable to find "${key}" item in FormGroup.`);
5578
+ console.error(dataPointer);
5579
+ console.error(formGroup);
5580
+ return;
5581
+ }
5582
+ }
5583
+ return subGroup;
5584
+ */
5585
+ }
5224
5586
 
5225
5587
  /**
5226
5588
  * Layout function library:
@@ -5837,16 +6199,19 @@ function fixNestedArrayLayout(options) {
5837
6199
  * // { string = '' } dataPointerPrefix -
5838
6200
  * //
5839
6201
  */
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);
6202
+ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPointer = '', dataPointer = '', arrayItem = false, arrayItemType = null, removable = null, forRefLibrary = false, dataPointerPrefix = '', jsonSchema) {
6203
+ const jsSchema = jsonSchema || jsf.schema;
6204
+ const schema = JsonPointer.get(jsSchema, schemaPointer);
6205
+ //JsonPointer.get(jsf.schema, schemaPointer);
5842
6206
  if (!hasOwn(schema, 'type') && !hasOwn(schema, '$ref') &&
5843
- !hasOwn(schema, 'x-schema-form')) {
6207
+ !hasOwn(schema, 'x-schema-form')
6208
+ && !hasOwn(schema, 'if') && !hasOwn(schema, 'then') && !hasOwn(schema, 'else')) {
5844
6209
  return null;
5845
6210
  }
5846
6211
  const newNodeType = getInputType(schema);
5847
6212
  if (!isDefined(nodeValue) && (jsf.formOptions.setSchemaDefaults === true ||
5848
6213
  (jsf.formOptions.setSchemaDefaults === 'auto' && isEmpty(jsf.formValues)))) {
5849
- nodeValue = JsonPointer.get(jsf.schema, schemaPointer + '/default');
6214
+ nodeValue = JsonPointer.get(jsSchema, schemaPointer + '/default');
5850
6215
  }
5851
6216
  let newNode = {
5852
6217
  _id: forRefLibrary ? null : uniqueId(),
@@ -5854,7 +6219,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
5854
6219
  dataPointer: JsonPointer.toGenericPointer(dataPointer, jsf.arrayMap),
5855
6220
  dataType: schema.type || (hasOwn(schema, '$ref') ? '$ref' : null),
5856
6221
  options: {},
5857
- required: isInputRequired(jsf.schema, schemaPointer),
6222
+ required: isInputRequired(jsSchema, schemaPointer),
5858
6223
  type: newNodeType,
5859
6224
  widget: widgetLibrary.getWidget(newNodeType),
5860
6225
  };
@@ -5914,6 +6279,89 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
5914
6279
  newSection.push(innerItem);
5915
6280
  }
5916
6281
  });
6282
+ //treat allOf the same as any of but need to add an extra
6283
+ //condition for which anyOf item is to be rendered
6284
+ ["allOf", "anyOf", "oneOf"].forEach(ofType => {
6285
+ if (hasOwn(schema, ofType) && isArray(schema[ofType])) {
6286
+ let outerOneOfItem;
6287
+ if (ofType == "oneOf") {
6288
+ outerOneOfItem = buildLayoutFromSchema(jsf, widgetLibrary, schema.oneOf, //{type:"tabarray",items:schema.oneOf},
6289
+ "/", //schemaPointer + `/${ofType}`,
6290
+ dataPointer, false, null, null, forRefLibrary, dataPointerPrefix,
6291
+ //{type:"tabarray",items:schema.oneOf,oneOf:schema.oneOf}
6292
+ { type: "one-of", items: schema.oneOf, oneOf: schema.oneOf });
6293
+ //outerItem.items=cloneDeep(newSection);
6294
+ //newSection.length=0;
6295
+ newSection.push(outerOneOfItem);
6296
+ }
6297
+ schema[ofType].forEach((ofItem, ind) => {
6298
+ const keySchemaPointer = `/${ofType}/${ind}`;
6299
+ const innerItem = buildLayoutFromSchema(jsf, widgetLibrary, ofItem, schemaPointer + keySchemaPointer, dataPointer, false, null, null, forRefLibrary, dataPointerPrefix);
6300
+ if (innerItem) {
6301
+ //newSection.push(innerItem);
6302
+ if (innerItem.items) {
6303
+ innerItem.items.forEach(innerItemLevel2 => {
6304
+ const l2SchemaPointer = hasOwn(ofItem, 'properties') ?
6305
+ '/properties/' + innerItemLevel2.name : innerItemLevel2.name;
6306
+ innerItemLevel2.oneOfPointer = schemaPointer + keySchemaPointer + l2SchemaPointer;
6307
+ innerItemLevel2.schemaPointer = innerItemLevel2.oneOfPointer;
6308
+ });
6309
+ }
6310
+ if (isArray(innerItem)) {
6311
+ innerItem.forEach(item => {
6312
+ const l2SchemaPointer = hasOwn(ofItem, 'properties') ?
6313
+ '/properties/' + item.name : item.name;
6314
+ if (outerOneOfItem) {
6315
+ item.oneOfPointer = schemaPointer + keySchemaPointer + l2SchemaPointer;
6316
+ //schemaPointer + keySchemaPointer + item.dataPointer;
6317
+ item.schemaPointer = item.oneOfPointer;
6318
+ outerOneOfItem.items = outerOneOfItem.items || [];
6319
+ outerOneOfItem.items.push(item);
6320
+ }
6321
+ else {
6322
+ newSection.push(item);
6323
+ }
6324
+ });
6325
+ //TODO test-might not work for more than 2 levels of nesting
6326
+ }
6327
+ else {
6328
+ if (outerOneOfItem) {
6329
+ innerItem.oneOfPointer = schemaPointer + keySchemaPointer; // + innerItem.dataPointer;
6330
+ innerItem.schemaPointer = innerItem.oneOfPointer;
6331
+ outerOneOfItem.items = outerOneOfItem.items || [];
6332
+ outerOneOfItem.items.push(innerItem);
6333
+ }
6334
+ else {
6335
+ newSection.push(innerItem);
6336
+ }
6337
+ }
6338
+ }
6339
+ });
6340
+ }
6341
+ });
6342
+ if (hasOwn(schema, "if")) {
6343
+ ["then", "else"].forEach(con => {
6344
+ if (hasOwn(schema, con)) {
6345
+ const keySchemaPointer = `/${con}`;
6346
+ const negateClause = con == "else";
6347
+ const innerItem = buildLayoutFromSchema(jsf, widgetLibrary, nodeValue.then, schemaPointer + keySchemaPointer, dataPointer, false, null, null, forRefLibrary, dataPointerPrefix);
6348
+ if (innerItem) {
6349
+ if (isArray(innerItem)) {
6350
+ innerItem.forEach(item => {
6351
+ item.schemaPointer = schemaPointer + keySchemaPointer + item.dataPointer;
6352
+ item.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
6353
+ newSection.push(item);
6354
+ });
6355
+ }
6356
+ else {
6357
+ innerItem.schemaPointer = schemaPointer + keySchemaPointer + innerItem.dataPointer;
6358
+ innerItem.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
6359
+ newSection.push(innerItem);
6360
+ }
6361
+ }
6362
+ }
6363
+ });
6364
+ }
5917
6365
  if (dataPointer === '' && !forRefLibrary) {
5918
6366
  newNode = newSection;
5919
6367
  }
@@ -5930,7 +6378,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
5930
6378
  newNode.items = [];
5931
6379
  newNode.options.maxItems = Math.min(schema.maxItems || 1000, newNode.options.maxItems || 1000);
5932
6380
  newNode.options.minItems = Math.max(schema.minItems || 0, newNode.options.minItems || 0);
5933
- if (!newNode.options.minItems && isInputRequired(jsf.schema, schemaPointer)) {
6381
+ if (!newNode.options.minItems && isInputRequired(jsSchema, schemaPointer)) {
5934
6382
  newNode.options.minItems = 1;
5935
6383
  }
5936
6384
  if (!hasOwn(newNode.options, 'listItems')) {
@@ -6063,7 +6511,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6063
6511
  }
6064
6512
  else if (newNode.dataType === '$ref') {
6065
6513
  const schemaRef = JsonPointer.compile(schema.$ref);
6066
- const dataRef = JsonPointer.toDataPointer(schemaRef, jsf.schema);
6514
+ const dataRef = JsonPointer.toDataPointer(schemaRef, jsSchema);
6067
6515
  let buttonText = '';
6068
6516
  // Get newNode title
6069
6517
  if (newNode.options.add) {
@@ -6075,7 +6523,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6075
6523
  // If newNode doesn't have a title, look for title of parent array item
6076
6524
  }
6077
6525
  else {
6078
- const parentSchema = JsonPointer.get(jsf.schema, schemaPointer, 0, -1);
6526
+ const parentSchema = JsonPointer.get(jsSchema, schemaPointer, 0, -1);
6079
6527
  if (hasOwn(parentSchema, 'title')) {
6080
6528
  buttonText = 'Add to ' + parentSchema.title;
6081
6529
  }
@@ -6093,9 +6541,9 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6093
6541
  removable: false,
6094
6542
  title: buttonText,
6095
6543
  });
6096
- if (isNumber(JsonPointer.get(jsf.schema, schemaPointer, 0, -1).maxItems)) {
6544
+ if (isNumber(JsonPointer.get(jsSchema, schemaPointer, 0, -1).maxItems)) {
6097
6545
  newNode.options.maxItems =
6098
- JsonPointer.get(jsf.schema, schemaPointer, 0, -1).maxItems;
6546
+ JsonPointer.get(jsSchema, schemaPointer, 0, -1).maxItems;
6099
6547
  }
6100
6548
  // Add layout template to layoutRefLibrary
6101
6549
  if (dataRef.length) {
@@ -6116,6 +6564,31 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6116
6564
  }
6117
6565
  }
6118
6566
  }
6567
+ else if (newNode.type === 'if') {
6568
+ const newSection = [];
6569
+ ["then", "else"].forEach(con => {
6570
+ if (hasOwn(schema, con)) {
6571
+ const keySchemaPointer = `/${con}`;
6572
+ const negateClause = con == "else";
6573
+ const innerItem = buildLayoutFromSchema(jsf, widgetLibrary, nodeValue.then, schemaPointer + keySchemaPointer, dataPointer, false, null, null, forRefLibrary, dataPointerPrefix);
6574
+ if (innerItem) {
6575
+ if (isArray(innerItem)) {
6576
+ innerItem.forEach(item => {
6577
+ item.schemaPointer = schemaPointer + keySchemaPointer + item.dataPointer;
6578
+ item.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
6579
+ newSection.push(item);
6580
+ newNode = newSection;
6581
+ });
6582
+ }
6583
+ else {
6584
+ innerItem.schemaPointer = schemaPointer + keySchemaPointer + innerItem.dataPointer;
6585
+ innerItem.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
6586
+ newNode = innerItem;
6587
+ }
6588
+ }
6589
+ }
6590
+ });
6591
+ }
6119
6592
  return newNode;
6120
6593
  }
6121
6594
  /**
@@ -6382,6 +6855,32 @@ class JsonSchemaFormService {
6382
6855
  setSortableOptions(value) {
6383
6856
  this.sortableOptionsSubject.next(value); // Update the sortable options value
6384
6857
  }
6858
+ createAjvInstance(ajvOptions) {
6859
+ let ajvInstance = new Ajv2019(ajvOptions);
6860
+ ajvInstance.addMetaSchema(jsonDraft6);
6861
+ ajvInstance.addMetaSchema(jsonDraft7);
6862
+ addFormats(ajvInstance);
6863
+ return ajvInstance;
6864
+ }
6865
+ createAndRegisterAjvInstance(ajvOptions, name) {
6866
+ const intanceName = name || `ajv_${Date.now()}`;
6867
+ if (this.ajvRegistry[intanceName]) {
6868
+ throw new Error(`ajv instance with name:'${intanceName}' has already been registered`);
6869
+ }
6870
+ const ajvInstance = this.createAjvInstance(ajvOptions);
6871
+ this.ajvRegistry[intanceName] = {
6872
+ name: intanceName,
6873
+ ajvInstance: ajvInstance,
6874
+ ajvValidator: null
6875
+ };
6876
+ return this.ajvRegistry[intanceName];
6877
+ }
6878
+ getAjvInstance(name = 'default') {
6879
+ return this.ajvRegistry[name].ajvInstance;
6880
+ }
6881
+ getAjvValidator(name = 'default') {
6882
+ return this.ajvRegistry[name]?.ajvValidator;
6883
+ }
6385
6884
  constructor() {
6386
6885
  this.JsonFormCompatibility = false;
6387
6886
  this.ReactJsonSchemaFormCompatibility = false;
@@ -6389,10 +6888,11 @@ class JsonSchemaFormService {
6389
6888
  this.tpldata = {};
6390
6889
  this.ajvOptions = {
6391
6890
  allErrors: true,
6392
- validateFormats: false,
6891
+ //validateFormats:false,
6393
6892
  strict: false
6394
6893
  };
6395
6894
  this.ajv = new Ajv2019(this.ajvOptions); // AJV: Another JSON Schema Validator
6895
+ //Being replaced by getAjvValidator()
6396
6896
  this.validateFormData = null; // Compiled AJV function to validate active form's schema
6397
6897
  this.formValues = {}; // Internal form data (may not have correct types)
6398
6898
  this.data = {}; // Output form data (formValues, formatted with correct data types)
@@ -6466,6 +6966,7 @@ class JsonSchemaFormService {
6466
6966
  validationMessages: {} // set by setLanguage()
6467
6967
  }
6468
6968
  };
6969
+ //TODO-review,may not be needed as sortablejs replaces dnd
6469
6970
  //this has been added to enable or disable the dragabble state of a component
6470
6971
  //using the OrderableDirective, mainly when an <input type="range">
6471
6972
  //elements are present, as the draggable attribute makes it difficult to
@@ -6478,9 +6979,19 @@ class JsonSchemaFormService {
6478
6979
  //nxt-sortablejs and sortablejs
6479
6980
  this.sortableOptionsSubject = new BehaviorSubject({ disabled: false }); // Default value true
6480
6981
  this.sortableOptions$ = this.sortableOptionsSubject.asObservable();
6982
+ this.ajvRegistry = {};
6481
6983
  this.setLanguage(this.language);
6482
6984
  this.ajv.addMetaSchema(jsonDraft6);
6483
6985
  this.ajv.addMetaSchema(jsonDraft7);
6986
+ addFormats(this.ajv);
6987
+ this.ajvRegistry['default'] = { name: 'default', ajvInstance: this.ajv, ajvValidator: null };
6988
+ // Add custom 'duration' format using a regex
6989
+ /*
6990
+ this.ajv.addFormat("duration", {
6991
+ type: "string",
6992
+ validate: (duration) => /^P(?!$)(\d+Y)?(\d+M)?(\d+D)?(T(\d+H)?(\d+M)?(\d+S)?)?$/.test(duration)
6993
+ });
6994
+ */
6484
6995
  }
6485
6996
  ngOnDestroy() {
6486
6997
  this.fcValueChangesSubs?.unsubscribe();
@@ -6519,7 +7030,7 @@ class JsonSchemaFormService {
6519
7030
  this.ReactJsonSchemaFormCompatibility = false;
6520
7031
  this.AngularSchemaFormCompatibility = false;
6521
7032
  this.tpldata = {};
6522
- this.validateFormData = null;
7033
+ this.validateFormData = null; //Being replaced by getAjvValidator()
6523
7034
  this.formValues = {};
6524
7035
  this.schema = {};
6525
7036
  this.layout = [];
@@ -6538,6 +7049,8 @@ class JsonSchemaFormService {
6538
7049
  this.schemaRefLibrary = {};
6539
7050
  this.templateRefLibrary = {};
6540
7051
  this.formOptions = cloneDeep(this.defaultFormOptions);
7052
+ this.ajvRegistry = {};
7053
+ this.ajvRegistry['default'] = { name: 'default', ajvInstance: this.ajv, ajvValidator: null };
6541
7054
  }
6542
7055
  /**
6543
7056
  * 'buildRemoteError' function
@@ -6569,10 +7082,10 @@ class JsonSchemaFormService {
6569
7082
  }
6570
7083
  });
6571
7084
  }
6572
- validateData(newValue, updateSubscriptions = true) {
7085
+ validateData(newValue, updateSubscriptions = true, ajvInstanceName = 'default') {
6573
7086
  // Format raw form data to correct data types
6574
7087
  this.data = formatFormData(newValue, this.dataMap, this.dataRecursiveRefMap, this.arrayMap, this.formOptions.returnEmptyFields);
6575
- this.isValid = this.validateFormData(this.data);
7088
+ this.isValid = this.getAjvValidator(ajvInstanceName)(this.data);
6576
7089
  this.validData = this.isValid ? this.data : null;
6577
7090
  const compileErrors = (errors) => {
6578
7091
  const compiledErrors = {};
@@ -6587,8 +7100,9 @@ class JsonSchemaFormService {
6587
7100
  });
6588
7101
  return compiledErrors;
6589
7102
  };
6590
- this.ajvErrors = this.validateFormData.errors;
6591
- this.validationErrors = compileErrors(this.validateFormData.errors);
7103
+ //TODO:store avjErrors per ajvInstance in registry
7104
+ this.ajvErrors = this.getAjvValidator(ajvInstanceName).errors;
7105
+ this.validationErrors = compileErrors(this.ajvErrors);
6592
7106
  if (updateSubscriptions) {
6593
7107
  this.dataChanges.next(this.data);
6594
7108
  this.isValidChanges.next(this.isValid);
@@ -6598,16 +7112,16 @@ class JsonSchemaFormService {
6598
7112
  buildFormGroupTemplate(formValues = null, setValues = true) {
6599
7113
  this.formGroupTemplate = buildFormGroupTemplate(this, formValues, setValues);
6600
7114
  }
6601
- buildFormGroup() {
7115
+ buildFormGroup(ajvInstanceName) {
6602
7116
  this.formGroup = buildFormGroup(this.formGroupTemplate);
6603
7117
  if (this.formGroup) {
6604
- this.compileAjvSchema();
6605
- this.validateData(this.formGroup.value);
7118
+ this.compileAjvSchema(ajvInstanceName);
7119
+ this.validateData(this.formGroup.value, true, ajvInstanceName);
6606
7120
  // Set up observables to emit data and validation info when form data changes
6607
7121
  if (this.formValueSubscription) {
6608
7122
  this.formValueSubscription.unsubscribe();
6609
7123
  }
6610
- this.formValueSubscription = this.formGroup.valueChanges.subscribe(formValue => this.validateData(formValue));
7124
+ this.formValueSubscription = this.formGroup.valueChanges.subscribe(formValue => this.validateData(formValue, true, ajvInstanceName));
6611
7125
  }
6612
7126
  }
6613
7127
  buildLayout(widgetLibrary) {
@@ -6636,15 +7150,17 @@ class JsonSchemaFormService {
6636
7150
  });
6637
7151
  }
6638
7152
  }
6639
- compileAjvSchema() {
6640
- if (!this.validateFormData) {
7153
+ compileAjvSchema(ajvInstanceName = 'default') {
7154
+ let ajvValidator = this.getAjvValidator(ajvInstanceName);
7155
+ if (!ajvValidator) {
6641
7156
  // if 'ui:order' exists in properties, move it to root before compiling with ajv
6642
7157
  if (Array.isArray(this.schema.properties['ui:order'])) {
6643
7158
  this.schema['ui:order'] = this.schema.properties['ui:order'];
6644
7159
  delete this.schema.properties['ui:order'];
6645
7160
  }
6646
- this.ajv.removeSchema(this.schema);
6647
- this.validateFormData = this.ajv.compile(this.schema);
7161
+ this.getAjvInstance(ajvInstanceName).removeSchema(this.schema);
7162
+ ajvValidator = this.getAjvInstance(ajvInstanceName).compile(this.schema);
7163
+ this.ajvRegistry[ajvInstanceName].ajvValidator = ajvValidator;
6648
7164
  }
6649
7165
  }
6650
7166
  buildSchemaFromData(data, requireAllFields = false) {
@@ -6806,12 +7322,23 @@ class JsonSchemaFormService {
6806
7322
  if (!isObject(ctx)) {
6807
7323
  return false;
6808
7324
  }
7325
+ const layoutNode = ctx.layoutNode();
6809
7326
  if (isEmpty(ctx.options)) {
6810
- ctx.options = !isEmpty((ctx.layoutNode() || {}).options)
6811
- ? ctx.layoutNode().options
7327
+ ctx.options = !isEmpty((layoutNode || {}).options)
7328
+ ? layoutNode.options
6812
7329
  : cloneDeep(this.formOptions);
6813
7330
  }
6814
7331
  ctx.formControl = this.getFormControl(ctx);
7332
+ //introduced to check if the node is part of ITE conditional
7333
+ //then change or add the control
7334
+ if (layoutNode?.schemaPointer) {
7335
+ //before changing control, need to set the new data type for data formatting
7336
+ const schemaType = this.dataMap.get(layoutNode?.dataPointer).get("schemaType");
7337
+ if (schemaType != layoutNode.dataType) {
7338
+ this.dataMap.get(layoutNode?.dataPointer).set("schemaType", layoutNode.dataType);
7339
+ }
7340
+ this.setFormControl(ctx, ctx.formControl);
7341
+ }
6815
7342
  ctx.boundControl = bind && !!ctx.formControl;
6816
7343
  if (ctx.formControl) {
6817
7344
  ctx.controlName = this.getFormControlName(ctx);
@@ -6830,27 +7357,27 @@ class JsonSchemaFormService {
6830
7357
  ? null
6831
7358
  : this.formatErrors(ctx.formControl.errors, ctx.options.validationMessages)));
6832
7359
  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
7360
  if (!isEqual$1(ctx.controlValue, value)) {
6842
7361
  ctx.controlValue = value;
6843
7362
  }
6844
7363
  });
6845
7364
  }
6846
7365
  else {
6847
- ctx.controlName = ctx.layoutNode().name;
6848
- ctx.controlValue = ctx.layoutNode().value || null;
7366
+ ctx.controlName = layoutNode.name;
7367
+ ctx.controlValue = layoutNode.value || null;
6849
7368
  const dataPointer = this.getDataPointer(ctx);
6850
7369
  if (bind && dataPointer) {
6851
7370
  console.error(`warning: control "${dataPointer}" is not bound to the Angular FormGroup.`);
6852
7371
  }
6853
7372
  }
7373
+ //if this is a ITE conditional field, the value would not have been
7374
+ //set, as the control would only be initialized when the condition is true
7375
+ if (ctx.options?.condition) {
7376
+ const value = JsonPointer.has(this.formValues, layoutNode.dataPointer)
7377
+ ? JsonPointer.get(this.formValues, layoutNode.dataPointer)
7378
+ : ctx.options?.default;
7379
+ ctx.formControl?.setValue(value);
7380
+ }
6854
7381
  return ctx.boundControl;
6855
7382
  }
6856
7383
  formatErrors(errors, validationMessages = {}) {
@@ -6932,13 +7459,48 @@ class JsonSchemaFormService {
6932
7459
  }
6933
7460
  formArray.markAsDirty();
6934
7461
  }
7462
+ updateArrayMultiSelectList(ctx, selectList) {
7463
+ this.updateArrayCheckboxList(ctx, selectList);
7464
+ /* const formArray = <UntypedFormArray>this.getFormControl(ctx);
7465
+
7466
+ // Remove all existing items
7467
+ while (formArray.value.length) {
7468
+ formArray.removeAt(0);
7469
+ }
7470
+
7471
+ // Re-add an item for each checked box
7472
+ const refPointer = removeRecursiveReferences(
7473
+ ctx.layoutNode().dataPointer + '/-',
7474
+ this.dataRecursiveRefMap,
7475
+ this.arrayMap
7476
+ );
7477
+ for (const selectItem of selectList) {
7478
+ if (selectItem.value) {
7479
+ const newFormControl = buildFormGroup(
7480
+ this.templateRefLibrary[refPointer]
7481
+ );
7482
+ newFormControl.setValue(selectItem.value);
7483
+ formArray.push(newFormControl);
7484
+ }
7485
+ }
7486
+ formArray.markAsDirty();
7487
+ */
7488
+ }
6935
7489
  getFormControl(ctx) {
6936
7490
  if (!ctx || !ctx.layoutNode ||
6937
7491
  !isDefined(ctx.layoutNode().dataPointer) ||
6938
7492
  ctx.layoutNode().type === '$ref') {
6939
7493
  return null;
6940
7494
  }
6941
- return getControl(this.formGroup, this.getDataPointer(ctx));
7495
+ return getControl(this.formGroup, this.getDataPointer(ctx), false, ctx.layoutNode()?.schemaPointer);
7496
+ }
7497
+ setFormControl(ctx, control) {
7498
+ if (!ctx || !ctx.layoutNode ||
7499
+ !isDefined(ctx.layoutNode().dataPointer) ||
7500
+ ctx.layoutNode().type === '$ref') {
7501
+ return null;
7502
+ }
7503
+ return setControl(this.formGroup, this.getDataPointer(ctx), control);
6942
7504
  }
6943
7505
  getFormControlValue(ctx) {
6944
7506
  if (!ctx || !ctx.layoutNode ||
@@ -6953,7 +7515,7 @@ class JsonSchemaFormService {
6953
7515
  if (!ctx || !ctx.layoutNode || !isDefined(ctx.layoutNode().dataPointer)) {
6954
7516
  return null;
6955
7517
  }
6956
- return getControl(this.formGroup, this.getDataPointer(ctx), true);
7518
+ return getControl(this.formGroup, this.getDataPointer(ctx), true, ctx.layoutNode()?.schemaPointer);
6957
7519
  }
6958
7520
  getFormControlName(ctx) {
6959
7521
  if (!ctx || !ctx.layoutNode ||
@@ -7072,10 +7634,10 @@ class JsonSchemaFormService {
7072
7634
  JsonPointer.remove(this.layout, this.getLayoutPointer(ctx));
7073
7635
  return true;
7074
7636
  }
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 }); }
7637
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonSchemaFormService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
7638
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonSchemaFormService }); }
7077
7639
  }
7078
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonSchemaFormService, decorators: [{
7640
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonSchemaFormService, decorators: [{
7079
7641
  type: Injectable
7080
7642
  }], ctorParameters: () => [] });
7081
7643
 
@@ -7105,10 +7667,10 @@ class SelectWidgetComponent {
7105
7667
  }
7106
7668
  }
7107
7669
  }
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 }); }
7670
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SelectWidgetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7671
+ 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
7672
  }
7111
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SelectWidgetComponent, decorators: [{
7673
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SelectWidgetComponent, decorators: [{
7112
7674
  type: Component,
7113
7675
  args: [{
7114
7676
  // tslint:disable-next-line:component-selector
@@ -7124,10 +7686,10 @@ class NoFrameworkComponent {
7124
7686
  this.layoutIndex = input(undefined);
7125
7687
  this.dataIndex = input(undefined);
7126
7688
  }
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"] }] }); }
7689
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFrameworkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7690
+ 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
7691
  }
7130
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoFrameworkComponent, decorators: [{
7692
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFrameworkComponent, decorators: [{
7131
7693
  type: Component,
7132
7694
  args: [{ selector: 'no-framework', standalone: false, template: "<select-widget-widget [dataIndex]=\"dataIndex()\" [layoutIndex]=\"layoutIndex()\" [layoutNode]=\"layoutNode()\">\r\n</select-widget-widget>" }]
7133
7695
  }] });
@@ -7140,10 +7702,10 @@ class NoFramework extends Framework {
7140
7702
  this.text = 'None (plain HTML)';
7141
7703
  this.framework = NoFrameworkComponent;
7142
7704
  }
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 }); }
7705
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFramework, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
7706
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFramework }); }
7145
7707
  }
7146
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoFramework, decorators: [{
7708
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFramework, decorators: [{
7147
7709
  type: Injectable
7148
7710
  }] });
7149
7711
 
@@ -7165,10 +7727,10 @@ class ElementAttributeDirective {
7165
7727
  }
7166
7728
  }
7167
7729
  }
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 }); }
7730
+ 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 }); }
7731
+ 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
7732
  }
7171
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ElementAttributeDirective, decorators: [{
7733
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: ElementAttributeDirective, decorators: [{
7172
7734
  type: Directive,
7173
7735
  args: [{
7174
7736
  selector: '[attributes]',
@@ -7205,29 +7767,33 @@ class AddReferenceComponent {
7205
7767
  return parent.layoutNode.add ||
7206
7768
  this.jsf.setArrayItemTitle(parent, this.layoutNode(), this.itemCount);
7207
7769
  }
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 }); }
7770
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AddReferenceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7771
+ 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: `
7772
+ <section [class]="options?.htmlClass || ''" align="end">
7773
+ <button *ngIf="showAddButton"
7774
+ [class]="options?.fieldHtmlClass || ''" class="sortable-filter sortable-fixed"
7775
+ [disabled]="options?.readonly"
7776
+ (click)="addItem($event)">
7777
+ <span *ngIf="options?.icon" [class]="options?.icon"></span>
7778
+ <span *ngIf="options?.title" [innerHTML]="buttonText"></span>
7779
+ </button>
7780
+ </section>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
7217
7781
  }
7218
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: AddReferenceComponent, decorators: [{
7782
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AddReferenceComponent, decorators: [{
7219
7783
  type: Component,
7220
7784
  args: [{
7221
7785
  // tslint:disable-next-line:component-selector
7222
7786
  selector: 'add-reference-widget',
7223
7787
  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>`,
7788
+ <section [class]="options?.htmlClass || ''" align="end">
7789
+ <button *ngIf="showAddButton"
7790
+ [class]="options?.fieldHtmlClass || ''" class="sortable-filter sortable-fixed"
7791
+ [disabled]="options?.readonly"
7792
+ (click)="addItem($event)">
7793
+ <span *ngIf="options?.icon" [class]="options?.icon"></span>
7794
+ <span *ngIf="options?.title" [innerHTML]="buttonText"></span>
7795
+ </button>
7796
+ </section>`,
7231
7797
  changeDetection: ChangeDetectionStrategy.Default,
7232
7798
  standalone: false
7233
7799
  }]
@@ -7254,8 +7820,11 @@ class ButtonComponent {
7254
7820
  this.jsf.updateValue(this, event.target.value);
7255
7821
  }
7256
7822
  }
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: `
7823
+ ngOnDestroy() {
7824
+ this.jsf.updateValue(this, null);
7825
+ }
7826
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7827
+ 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
7828
  <div
7260
7829
  [class]="options?.htmlClass || ''">
7261
7830
  <button
@@ -7273,7 +7842,7 @@ class ButtonComponent {
7273
7842
  </button>
7274
7843
  </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
7275
7844
  }
7276
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ButtonComponent, decorators: [{
7845
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: ButtonComponent, decorators: [{
7277
7846
  type: Component,
7278
7847
  args: [{
7279
7848
  // tslint:disable-next-line:component-selector
@@ -7324,8 +7893,11 @@ class CheckboxComponent {
7324
7893
  get isChecked() {
7325
7894
  return this.jsf.getFormControlValue(this) === this.trueValue;
7326
7895
  }
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: `
7896
+ ngOnDestroy() {
7897
+ this.jsf.updateValue(this, null);
7898
+ }
7899
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: CheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7900
+ 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
7901
  <label
7330
7902
  [attr.for]="'control' + layoutNode()?._id"
7331
7903
  [class]="options?.itemLabelHtmlClass || ''">
@@ -7357,7 +7929,7 @@ class CheckboxComponent {
7357
7929
  [innerHTML]="options?.title"></span>
7358
7930
  </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
7931
  }
7360
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CheckboxComponent, decorators: [{
7932
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: CheckboxComponent, decorators: [{
7361
7933
  type: Component,
7362
7934
  args: [{
7363
7935
  // tslint:disable-next-line:component-selector
@@ -7429,8 +8001,15 @@ class CheckboxesComponent {
7429
8001
  this.jsf.updateArrayCheckboxList(this, this.checkboxList);
7430
8002
  }
7431
8003
  }
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: `
8004
+ //TODO review this
8005
+ ngOnDestroy() {
8006
+ //this.jsf.updateValue(this, null);
8007
+ let nullVal = [];
8008
+ this.formControl.reset(nullVal);
8009
+ this.controlValue = null;
8010
+ }
8011
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: CheckboxesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8012
+ 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
8013
  <label *ngIf="options?.title"
7435
8014
  [class]="options?.labelHtmlClass || ''"
7436
8015
  [style.display]="options?.notitle ? 'none' : ''"
@@ -7480,7 +8059,7 @@ class CheckboxesComponent {
7480
8059
  </div>
7481
8060
  </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
8061
  }
7483
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CheckboxesComponent, decorators: [{
8062
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: CheckboxesComponent, decorators: [{
7484
8063
  type: Component,
7485
8064
  args: [{
7486
8065
  // tslint:disable-next-line:component-selector
@@ -7555,10 +8134,13 @@ class FileComponent {
7555
8134
  updateValue(event) {
7556
8135
  this.jsf.updateValue(this, event.target.value);
7557
8136
  }
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 }); }
8137
+ ngOnDestroy() {
8138
+ this.jsf.updateValue(this, null);
8139
+ }
8140
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FileComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8141
+ 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
8142
  }
7561
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: FileComponent, decorators: [{
8143
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FileComponent, decorators: [{
7562
8144
  type: Component,
7563
8145
  args: [{
7564
8146
  // tslint:disable-next-line:component-selector
@@ -7580,8 +8162,11 @@ class HiddenComponent {
7580
8162
  ngOnInit() {
7581
8163
  this.jsf.initializeControl(this);
7582
8164
  }
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: `
8165
+ ngOnDestroy() {
8166
+ this.jsf.updateValue(this, null);
8167
+ }
8168
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: HiddenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8169
+ 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
8170
  <input *ngIf="boundControl"
7586
8171
  [formControl]="formControl"
7587
8172
  [id]="'control' + layoutNode()?._id"
@@ -7594,7 +8179,7 @@ class HiddenComponent {
7594
8179
  type="hidden"
7595
8180
  [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
8181
  }
7597
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: HiddenComponent, decorators: [{
8182
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: HiddenComponent, decorators: [{
7598
8183
  type: Component,
7599
8184
  args: [{
7600
8185
  // tslint:disable-next-line:component-selector
@@ -7636,8 +8221,11 @@ class InputComponent {
7636
8221
  updateValue(event) {
7637
8222
  this.jsf.updateValue(this, event.target.value);
7638
8223
  }
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: `
8224
+ ngOnDestroy() {
8225
+ this.jsf.updateValue(this, null);
8226
+ }
8227
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8228
+ 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
8229
  <div [class]="options?.htmlClass || ''" class="sortable-filter" >
7642
8230
  <label *ngIf="options?.title"
7643
8231
  [attr.for]="'control' + layoutNode()?._id"
@@ -7684,7 +8272,7 @@ class InputComponent {
7684
8272
  </datalist>
7685
8273
  </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
8274
  }
7687
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: InputComponent, decorators: [{
8275
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InputComponent, decorators: [{
7688
8276
  type: Component,
7689
8277
  args: [{
7690
8278
  // tslint:disable-next-line:component-selector
@@ -7752,13 +8340,13 @@ class MessageComponent {
7752
8340
  this.message = this.options.help || this.options.helpvalue ||
7753
8341
  this.options.msg || this.options.message;
7754
8342
  }
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: `
8343
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: MessageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8344
+ 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
8345
  <span *ngIf="message"
7758
8346
  [class]="options?.labelHtmlClass || ''"
7759
8347
  [innerHTML]="message"></span>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
7760
8348
  }
7761
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MessageComponent, decorators: [{
8349
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: MessageComponent, decorators: [{
7762
8350
  type: Component,
7763
8351
  args: [{
7764
8352
  // tslint:disable-next-line:component-selector
@@ -7777,10 +8365,10 @@ class NoneComponent {
7777
8365
  this.layoutIndex = input(undefined);
7778
8366
  this.dataIndex = input(undefined);
7779
8367
  }
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 }); }
8368
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoneComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8369
+ 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
8370
  }
7783
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoneComponent, decorators: [{
8371
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoneComponent, decorators: [{
7784
8372
  type: Component,
7785
8373
  args: [{
7786
8374
  // tslint:disable-next-line:component-selector
@@ -7818,8 +8406,11 @@ class NumberComponent {
7818
8406
  updateValue(event) {
7819
8407
  this.jsf.updateValue(this, event.target.value);
7820
8408
  }
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: `
8409
+ ngOnDestroy() {
8410
+ this.jsf.updateValue(this, null);
8411
+ }
8412
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NumberComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8413
+ 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
8414
  <div #divElt [class]="options?.htmlClass || ''" class="sortable-filter" >
7824
8415
  <label *ngIf="options?.title"
7825
8416
  [attr.for]="'control' + layoutNode()?._id"
@@ -7866,7 +8457,7 @@ class NumberComponent {
7866
8457
  <span *ngIf="layoutNode()?.type === 'range'" [innerHTML]="controlValue"></span>
7867
8458
  </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
8459
  }
7869
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NumberComponent, decorators: [{
8460
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NumberComponent, decorators: [{
7870
8461
  type: Component,
7871
8462
  args: [{
7872
8463
  // tslint:disable-next-line:component-selector
@@ -7927,6 +8518,195 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
7927
8518
  args: ['divElt', {}]
7928
8519
  }] } });
7929
8520
 
8521
+ class SelectFrameworkComponent {
8522
+ constructor() {
8523
+ this.jsf = inject(JsonSchemaFormService);
8524
+ this.newComponent = null;
8525
+ this.layoutNode = input(undefined);
8526
+ this.layoutIndex = input(undefined);
8527
+ this.dataIndex = input(undefined);
8528
+ this.widgetContainer = viewChild('widgetContainer', { read: ViewContainerRef });
8529
+ }
8530
+ ngOnInit() {
8531
+ this.updateComponent();
8532
+ }
8533
+ ngOnChanges() {
8534
+ this.updateComponent();
8535
+ }
8536
+ updateComponent() {
8537
+ const widgetContainer = this.widgetContainer();
8538
+ if (widgetContainer && !this.newComponent && this.jsf.framework) {
8539
+ this.newComponent = widgetContainer.createComponent((this.jsf.framework));
8540
+ //TODO fix all deprecated calls and test
8541
+ //this.widgetContainer.createComponent<any>(this.jsf.framework)
8542
+ }
8543
+ if (this.newComponent) {
8544
+ for (const input of ['layoutNode', 'layoutIndex', 'dataIndex']) {
8545
+ this.newComponent.instance[input] = this[input];
8546
+ }
8547
+ }
8548
+ }
8549
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SelectFrameworkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8550
+ 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 }); }
8551
+ }
8552
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SelectFrameworkComponent, decorators: [{
8553
+ type: Component,
8554
+ args: [{
8555
+ // tslint:disable-next-line:component-selector
8556
+ selector: 'select-framework-widget',
8557
+ template: `<div #widgetContainer></div>`,
8558
+ standalone: false
8559
+ }]
8560
+ }] });
8561
+
8562
+ class TabsComponent {
8563
+ constructor() {
8564
+ this.jsf = inject(JsonSchemaFormService);
8565
+ this.selectedItem = 0;
8566
+ this.showAddTab = true;
8567
+ this.layoutNode = input(undefined);
8568
+ this.layoutIndex = input(undefined);
8569
+ this.dataIndex = input(undefined);
8570
+ }
8571
+ ngOnInit() {
8572
+ this.options = this.layoutNode().options || {};
8573
+ if (this.options.selectedTab) {
8574
+ this.selectedItem = this.options.selectedTab;
8575
+ }
8576
+ this.itemCount = this.layoutNode().items.length - 1;
8577
+ this.updateControl();
8578
+ }
8579
+ select(index) {
8580
+ const layoutNode = this.layoutNode();
8581
+ if (layoutNode.items[index].type === '$ref') {
8582
+ this.itemCount = layoutNode.items.length;
8583
+ this.jsf.addItem({
8584
+ layoutNode: signal(layoutNode.items[index]),
8585
+ layoutIndex: signal(this.layoutIndex().concat(index)),
8586
+ dataIndex: signal(this.dataIndex().concat(index))
8587
+ });
8588
+ this.updateControl();
8589
+ }
8590
+ this.selectedItem = index;
8591
+ }
8592
+ updateControl() {
8593
+ const lastItem = this.layoutNode().items[this.layoutNode().items.length - 1];
8594
+ if (lastItem.type === '$ref' &&
8595
+ this.itemCount >= (lastItem.options.maxItems || 1000)) {
8596
+ this.showAddTab = false;
8597
+ }
8598
+ }
8599
+ setTabTitle(item, index) {
8600
+ return this.jsf.setArrayItemTitle(this, item, index);
8601
+ }
8602
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8603
+ 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: `
8604
+ <ul
8605
+ [class]="options?.labelHtmlClass || ''">
8606
+ <li *ngFor="let item of layoutNode()?.items; let i = index"
8607
+ [class]="(options?.itemLabelHtmlClass || '') + (selectedItem === i ?
8608
+ (' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
8609
+ (' ' + options?.style?.unselected))"
8610
+ role="presentation"
8611
+ data-tabs>
8612
+ <a *ngIf="showAddTab || item.type !== '$ref'"
8613
+ [class]="'nav-link' + (selectedItem === i ? (' ' + options?.activeClass + ' ' + options?.style?.selected) :
8614
+ (' ' + options?.style?.unselected))"
8615
+ (click)="select(i)">
8616
+ <input type="radio" [value]="i" *ngIf="options?.tabMode=='oneOfMode'"
8617
+ name="tabSelection"
8618
+ [(ngModel)]="selectedItem"
8619
+ [class]="(options?.widget_radioClass || '')"
8620
+ [value]="i"
8621
+ (change)="select(i)"
8622
+ />
8623
+ {{setTabTitle(item, i)}}
8624
+ </a>
8625
+ </li>
8626
+ </ul>
8627
+
8628
+ <div *ngFor="let layoutItem of layoutNode()?.items; let i = index"
8629
+ [class]="(options?.htmlClass || '') + (selectedItem != i?' ngf-hidden':'') ">
8630
+ <!--for now the only difference between oneOfMode and the default
8631
+ is that oneOfMode uses the *ngIf="selectedItem === i" clause, which automatically
8632
+ destroys the tabs that are not rendered while default mode only hide them
8633
+ the upshot is that only the active tabs value will be used
8634
+ -->
8635
+ <ng-container *ngIf="options?.tabMode=='oneOfMode'">
8636
+ <select-framework-widget *ngIf="selectedItem === i"
8637
+ [class]="(options?.fieldHtmlClass || '') +
8638
+ ' ' + (options?.activeClass || '') +
8639
+ ' ' + (options?.style?.selected || '')"
8640
+ [dataIndex]="layoutNode()?.dataType === 'array' ? (dataIndex() || []).concat(i) : dataIndex()"
8641
+ [layoutIndex]="(layoutIndex() || []).concat(i)"
8642
+ [layoutNode]="layoutItem"></select-framework-widget>
8643
+ </ng-container>
8644
+ <ng-container *ngIf="options?.tabMode !='oneOfMode'">
8645
+ <select-framework-widget
8646
+ [class]="(options?.fieldHtmlClass || '') +
8647
+ ' ' + (options?.activeClass || '') +
8648
+ ' ' + (options?.style?.selected || '')"
8649
+ [dataIndex]="layoutNode()?.dataType === 'array' ? (dataIndex() || []).concat(i) : dataIndex()"
8650
+ [layoutIndex]="(layoutIndex() || []).concat(i)"
8651
+ [layoutNode]="layoutItem"></select-framework-widget>
8652
+ </ng-container>
8653
+ </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"] }] }); }
8654
+ }
8655
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TabsComponent, decorators: [{
8656
+ type: Component,
8657
+ args: [{ selector: 'tabs-widget', template: `
8658
+ <ul
8659
+ [class]="options?.labelHtmlClass || ''">
8660
+ <li *ngFor="let item of layoutNode()?.items; let i = index"
8661
+ [class]="(options?.itemLabelHtmlClass || '') + (selectedItem === i ?
8662
+ (' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
8663
+ (' ' + options?.style?.unselected))"
8664
+ role="presentation"
8665
+ data-tabs>
8666
+ <a *ngIf="showAddTab || item.type !== '$ref'"
8667
+ [class]="'nav-link' + (selectedItem === i ? (' ' + options?.activeClass + ' ' + options?.style?.selected) :
8668
+ (' ' + options?.style?.unselected))"
8669
+ (click)="select(i)">
8670
+ <input type="radio" [value]="i" *ngIf="options?.tabMode=='oneOfMode'"
8671
+ name="tabSelection"
8672
+ [(ngModel)]="selectedItem"
8673
+ [class]="(options?.widget_radioClass || '')"
8674
+ [value]="i"
8675
+ (change)="select(i)"
8676
+ />
8677
+ {{setTabTitle(item, i)}}
8678
+ </a>
8679
+ </li>
8680
+ </ul>
8681
+
8682
+ <div *ngFor="let layoutItem of layoutNode()?.items; let i = index"
8683
+ [class]="(options?.htmlClass || '') + (selectedItem != i?' ngf-hidden':'') ">
8684
+ <!--for now the only difference between oneOfMode and the default
8685
+ is that oneOfMode uses the *ngIf="selectedItem === i" clause, which automatically
8686
+ destroys the tabs that are not rendered while default mode only hide them
8687
+ the upshot is that only the active tabs value will be used
8688
+ -->
8689
+ <ng-container *ngIf="options?.tabMode=='oneOfMode'">
8690
+ <select-framework-widget *ngIf="selectedItem === i"
8691
+ [class]="(options?.fieldHtmlClass || '') +
8692
+ ' ' + (options?.activeClass || '') +
8693
+ ' ' + (options?.style?.selected || '')"
8694
+ [dataIndex]="layoutNode()?.dataType === 'array' ? (dataIndex() || []).concat(i) : dataIndex()"
8695
+ [layoutIndex]="(layoutIndex() || []).concat(i)"
8696
+ [layoutNode]="layoutItem"></select-framework-widget>
8697
+ </ng-container>
8698
+ <ng-container *ngIf="options?.tabMode !='oneOfMode'">
8699
+ <select-framework-widget
8700
+ [class]="(options?.fieldHtmlClass || '') +
8701
+ ' ' + (options?.activeClass || '') +
8702
+ ' ' + (options?.style?.selected || '')"
8703
+ [dataIndex]="layoutNode()?.dataType === 'array' ? (dataIndex() || []).concat(i) : dataIndex()"
8704
+ [layoutIndex]="(layoutIndex() || []).concat(i)"
8705
+ [layoutNode]="layoutItem"></select-framework-widget>
8706
+ </ng-container>
8707
+ </div>`, standalone: false, styles: ["a{cursor:pointer}.ngf-hidden{display:none}\n"] }]
8708
+ }] });
8709
+
7930
8710
  // TODO: Add this control
7931
8711
  class OneOfComponent {
7932
8712
  constructor() {
@@ -7939,20 +8719,84 @@ class OneOfComponent {
7939
8719
  }
7940
8720
  ngOnInit() {
7941
8721
  this.options = this.layoutNode().options || {};
8722
+ this.options.tabMode = "oneOfMode";
8723
+ this.options.selectedTab = this.findSelectedTab();
8724
+ //this.options.description=this.options.description||"choose one of";
7942
8725
  this.jsf.initializeControl(this);
7943
8726
  }
8727
+ findSelectedTab() {
8728
+ //TODO test- this.jsf.formValues seems to be the initial data supplied to the form
8729
+ //while the jsf.formGroup value is derived from the actual controls
8730
+ //let formValue=this.jsf.getFormControlValue(this);
8731
+ let foundInd = -1;
8732
+ //seach for non null value
8733
+ if (this.layoutNode().items) {
8734
+ this.layoutNode().items.forEach((layoutItem, ind) => {
8735
+ let formValue = JsonPointer.get(this.jsf.formValues, layoutItem.dataPointer);
8736
+ if (layoutItem.oneOfPointer) {
8737
+ let controlKey = path2ControlKey(layoutItem.oneOfPointer);
8738
+ let fname = layoutItem.name;
8739
+ if (hasOwn(this.jsf.formGroup.controls, controlKey) &&
8740
+ (formValue || hasNonNullValue(this.jsf.formGroup.controls[controlKey].value))
8741
+ //hasOwn(formValue,fname) && hasOwn(this.jsf.formGroup.controls,controlKey)
8742
+ // && (formValue[fname] || this.jsf.formGroup.controls[controlKey].value)
8743
+ //&&isEqual(formValue[fname],this.jsf.formGroup.controls[controlKey].value)
8744
+ ) {
8745
+ foundInd = ind;
8746
+ }
8747
+ //foundInd=formValue[controlKey]!=null?ind:foundInd;
8748
+ //if no exact match found, then search in descendant values
8749
+ //to see which one of item matches
8750
+ if (foundInd == -1) {
8751
+ //find all descendant oneof paths
8752
+ let descendantOneOfControlNames = Object.keys(this.jsf.formGroup.controls).filter(controlName => {
8753
+ return controlName.startsWith(controlKey);
8754
+ });
8755
+ descendantOneOfControlNames.forEach(controlName => {
8756
+ let parts = controlName.split('$');
8757
+ let fieldName = parts[parts.length - 1];
8758
+ let controlValue = this.jsf.formGroup.controls[controlName].value;
8759
+ if (isObject$1(formValue) && hasOwn(formValue, fieldName) &&
8760
+ formValue[fieldName] == controlValue
8761
+ //formValue[fieldName]||controlValue
8762
+ ) {
8763
+ foundInd = ind;
8764
+ }
8765
+ else //if(formValue || controlValue){
8766
+ if (isEqual$2(formValue, controlValue)) {
8767
+ foundInd = ind;
8768
+ }
8769
+ });
8770
+ //now need to compare values
8771
+ }
8772
+ }
8773
+ });
8774
+ }
8775
+ return Math.max(foundInd, 0);
8776
+ }
7944
8777
  updateValue(event) {
7945
8778
  this.jsf.updateValue(this, event.target.value);
7946
8779
  }
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 }); }
8780
+ ngOnDestroy() {
8781
+ //this.jsf.updateValue(this, null);
8782
+ }
8783
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OneOfComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8784
+ 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>
8785
+ <tabs-widget #tabs [layoutNode]="layoutNode()"
8786
+ [layoutIndex]="layoutIndex()"
8787
+ [dataIndex]="dataIndex()" >
8788
+ </tabs-widget>`, isInline: true, dependencies: [{ kind: "component", type: TabsComponent, selector: "tabs-widget", inputs: ["layoutNode", "layoutIndex", "dataIndex"] }] }); }
7949
8789
  }
7950
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: OneOfComponent, decorators: [{
8790
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OneOfComponent, decorators: [{
7951
8791
  type: Component,
7952
8792
  args: [{
7953
8793
  // tslint:disable-next-line:component-selector
7954
8794
  selector: 'one-of-widget',
7955
- template: ``,
8795
+ template: `<h4>{{this.options?.description}}</h4>
8796
+ <tabs-widget #tabs [layoutNode]="layoutNode()"
8797
+ [layoutIndex]="layoutIndex()"
8798
+ [dataIndex]="dataIndex()" >
8799
+ </tabs-widget>`,
7956
8800
  standalone: false
7957
8801
  }]
7958
8802
  }] });
@@ -7981,8 +8825,11 @@ class RadiosComponent {
7981
8825
  updateValue(event) {
7982
8826
  this.jsf.updateValue(this, event.target.value);
7983
8827
  }
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: `
8828
+ ngOnDestroy() {
8829
+ this.jsf.updateValue(this, null);
8830
+ }
8831
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: RadiosComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8832
+ 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
8833
  <label *ngIf="options?.title"
7987
8834
  [attr.for]="'control' + layoutNode()?._id"
7988
8835
  [class]="options?.labelHtmlClass || ''"
@@ -8039,7 +8886,7 @@ class RadiosComponent {
8039
8886
  </div>
8040
8887
  </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
8888
  }
8042
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: RadiosComponent, decorators: [{
8889
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: RadiosComponent, decorators: [{
8043
8890
  type: Component,
8044
8891
  args: [{
8045
8892
  // tslint:disable-next-line:component-selector
@@ -8104,47 +8951,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
8104
8951
  }]
8105
8952
  }] });
8106
8953
 
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
8954
  /**
8149
8955
  * OrderableDirective
8150
8956
  *
@@ -8260,10 +9066,10 @@ class OrderableDirective {
8260
9066
  this.draggableStateSubscription.unsubscribe();
8261
9067
  }
8262
9068
  }
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 }); }
9069
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OrderableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
9070
+ 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
9071
  }
8266
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: OrderableDirective, decorators: [{
9072
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OrderableDirective, decorators: [{
8267
9073
  type: Directive,
8268
9074
  args: [{
8269
9075
  // tslint:disable-next-line:directive-selector
@@ -8301,6 +9107,12 @@ class RootComponent {
8301
9107
  };
8302
9108
  //must set moveLayout to false as nxtSortable already moves it
8303
9109
  this.jsf.moveArrayItem(itemCtx, evt.oldIndex, evt.newIndex, false);
9110
+ },
9111
+ onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
9112
+ if (evt.related.classList.contains("sortable-fixed")) {
9113
+ //console.log(evt.related);
9114
+ return false;
9115
+ }
8304
9116
  }
8305
9117
  };
8306
9118
  }
@@ -8317,6 +9129,12 @@ class RootComponent {
8317
9129
  }
8318
9130
  return result;
8319
9131
  }
9132
+ //TODO also need to think of other types such as button which can be
9133
+ //created by an arbitrary layout
9134
+ isFixed(node) {
9135
+ let result = node.type == '$ref';
9136
+ return result;
9137
+ }
8320
9138
  // Set attributes for flexbox child
8321
9139
  // (container attributes are set in section.component)
8322
9140
  getFlexAttribute(node, attribute) {
@@ -8345,9 +9163,9 @@ class RootComponent {
8345
9163
  this.sortableOptionsSubscription.unsubscribe();
8346
9164
  }
8347
9165
  }
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: `
8350
- <div #sortableContainter [nxtSortablejs]="layout()" [config]="sortableConfig" (init)="sortableInit($event)">
9166
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: RootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9167
+ 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: `
9168
+ <div [class.flex-inherit]="true" #sortableContainter [nxtSortablejs]="layout()" [config]="sortableConfig" (init)="sortableInit($event)">
8351
9169
  <div *ngFor="let layoutItem of layout(); let i = index"
8352
9170
  [class.form-flex-item]="isFlexItem()"
8353
9171
  [style.align-self]="(layoutItem.options || {})['align-self']"
@@ -8356,6 +9174,7 @@ class RootComponent {
8356
9174
  [style.flex-shrink]="getFlexAttribute(layoutItem, 'flex-shrink')"
8357
9175
  [style.order]="(layoutItem.options || {}).order"
8358
9176
  [class.sortable-filter]="!isDraggable(layoutItem)"
9177
+ [class.sortable-fixed]="isFixed(layoutItem)"
8359
9178
  >
8360
9179
  <!--NB orderable directive is not used but has been left in for now and set to false
8361
9180
  otherwise the compiler won't recognize dataIndex and other dependent attributes
@@ -8366,6 +9185,7 @@ class RootComponent {
8366
9185
  [layoutNode]="layoutItem"
8367
9186
  [orderable]="false"
8368
9187
  [class.sortable-filter]="!isDraggable(layoutItem)"
9188
+ [class.sortable-fixed]="isFixed(layoutItem)"
8369
9189
  >
8370
9190
  <select-framework-widget *ngIf="showWidget(layoutItem)"
8371
9191
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
@@ -8374,12 +9194,12 @@ class RootComponent {
8374
9194
  </div>
8375
9195
  </div>
8376
9196
  </div>
8377
- `, 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}\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"] }] }); }
9197
+ `, 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
9198
  }
8379
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: RootComponent, decorators: [{
9199
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: RootComponent, decorators: [{
8380
9200
  type: Component,
8381
9201
  args: [{ selector: 'root-widget', template: `
8382
- <div #sortableContainter [nxtSortablejs]="layout()" [config]="sortableConfig" (init)="sortableInit($event)">
9202
+ <div [class.flex-inherit]="true" #sortableContainter [nxtSortablejs]="layout()" [config]="sortableConfig" (init)="sortableInit($event)">
8383
9203
  <div *ngFor="let layoutItem of layout(); let i = index"
8384
9204
  [class.form-flex-item]="isFlexItem()"
8385
9205
  [style.align-self]="(layoutItem.options || {})['align-self']"
@@ -8388,6 +9208,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
8388
9208
  [style.flex-shrink]="getFlexAttribute(layoutItem, 'flex-shrink')"
8389
9209
  [style.order]="(layoutItem.options || {}).order"
8390
9210
  [class.sortable-filter]="!isDraggable(layoutItem)"
9211
+ [class.sortable-fixed]="isFixed(layoutItem)"
8391
9212
  >
8392
9213
  <!--NB orderable directive is not used but has been left in for now and set to false
8393
9214
  otherwise the compiler won't recognize dataIndex and other dependent attributes
@@ -8398,6 +9219,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
8398
9219
  [layoutNode]="layoutItem"
8399
9220
  [orderable]="false"
8400
9221
  [class.sortable-filter]="!isDraggable(layoutItem)"
9222
+ [class.sortable-fixed]="isFixed(layoutItem)"
8401
9223
  >
8402
9224
  <select-framework-widget *ngIf="showWidget(layoutItem)"
8403
9225
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
@@ -8406,7 +9228,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
8406
9228
  </div>
8407
9229
  </div>
8408
9230
  </div>
8409
- `, standalone: false, 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}\n"] }]
9231
+ `, standalone: false, 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"] }]
8410
9232
  }] });
8411
9233
 
8412
9234
  class SectionComponent {
@@ -8470,8 +9292,8 @@ class SectionComponent {
8470
9292
  return this.options[attribute];
8471
9293
  }
8472
9294
  }
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: `
9295
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9296
+ 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
9297
  <div *ngIf="containerType === 'div'"
8476
9298
  [class]="options?.htmlClass || ''"
8477
9299
  [class.expandable]="options?.expandable && !expanded"
@@ -8534,7 +9356,7 @@ class SectionComponent {
8534
9356
  </div>
8535
9357
  </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
9358
  }
8537
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SectionComponent, decorators: [{
9359
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SectionComponent, decorators: [{
8538
9360
  type: Component,
8539
9361
  args: [{ selector: 'section-widget', template: `
8540
9362
  <div *ngIf="containerType === 'div'"
@@ -8606,6 +9428,7 @@ class SelectComponent {
8606
9428
  this.controlDisabled = false;
8607
9429
  this.boundControl = false;
8608
9430
  this.selectList = [];
9431
+ this.selectListFlatGroup = [];
8609
9432
  this.isArray = isArray;
8610
9433
  this.layoutNode = input(undefined);
8611
9434
  this.layoutIndex = input(undefined);
@@ -8614,13 +9437,43 @@ class SelectComponent {
8614
9437
  ngOnInit() {
8615
9438
  this.options = this.layoutNode().options || {};
8616
9439
  this.selectList = buildTitleMap(this.options.titleMap || this.options.enumNames, this.options.enum, !!this.options.required, !!this.options.flatList);
9440
+ //the selectListFlatGroup array will be used to update the formArray values
9441
+ //while the selectList array will be bound to the form select
9442
+ //as either a grouped select or a flat select
9443
+ this.selectListFlatGroup = buildTitleMap(this.options.titleMap || this.options.enumNames, this.options.enum, !!this.options.required, true);
8617
9444
  this.jsf.initializeControl(this);
8618
9445
  }
9446
+ deselectAll() {
9447
+ this.selectListFlatGroup.forEach(selItem => {
9448
+ selItem.checked = false;
9449
+ });
9450
+ }
8619
9451
  updateValue(event) {
8620
- this.jsf.updateValue(this, event.target.value);
9452
+ this.options.showErrors = true;
9453
+ if (this.options.multiple) {
9454
+ if (this.controlValue?.includes(null)) {
9455
+ this.deselectAll();
9456
+ //this.control.setValue([]); // Reset the form control to an empty array
9457
+ //this.selectList=JSON.parse(JSON.stringify(this.selectList));
9458
+ this.jsf.updateArrayMultiSelectList(this, []);
9459
+ }
9460
+ else {
9461
+ this.selectListFlatGroup.forEach(selItem => {
9462
+ selItem.checked = this.controlValue?.indexOf(selItem.value) >= 0 ? true : false;
9463
+ });
9464
+ this.jsf.updateArrayMultiSelectList(this, this.selectListFlatGroup);
9465
+ }
9466
+ return;
9467
+ }
9468
+ this.jsf.updateValue(this, this.controlValue);
9469
+ }
9470
+ ngOnDestroy() {
9471
+ let nullVal = this.options.multiple ? [null] : null;
9472
+ this.formControl.reset(nullVal);
9473
+ this.controlValue = null;
8621
9474
  }
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: `
9475
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9476
+ 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
9477
  <div
8625
9478
  [class]="options?.htmlClass || ''">
8626
9479
  <label *ngIf="options?.title"
@@ -8628,7 +9481,7 @@ class SelectComponent {
8628
9481
  [class]="options?.labelHtmlClass || ''"
8629
9482
  [style.display]="options?.notitle ? 'none' : ''"
8630
9483
  [innerHTML]="options?.title"></label>
8631
- <select *ngIf="boundControl"
9484
+ <select *ngIf="boundControl && !options?.multiple"
8632
9485
  [formControl]="formControl"
8633
9486
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
8634
9487
  [attr.readonly]="options?.readonly ? 'readonly' : null"
@@ -8675,9 +9528,36 @@ class SelectComponent {
8675
9528
  </optgroup>
8676
9529
  </ng-template>
8677
9530
  </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"] }] }); }
9531
+ <select *ngIf="boundControl && options?.multiple"
9532
+ [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
9533
+ [attr.readonly]="options?.readonly ? 'readonly' : null"
9534
+ [attr.required]="options?.required"
9535
+ [class]="options?.fieldHtmlClass || ''"
9536
+ [disabled]="controlDisabled"
9537
+ [id]="'control' + layoutNode()?._id"
9538
+ [multiple]="options?.multiple"
9539
+ [name]="controlName"
9540
+ [(ngModel)]="controlValue"
9541
+ (change)="updateValue($event)">
9542
+ <ng-template ngFor let-selectItem [ngForOf]="selectList">
9543
+ <option *ngIf="!isArray(selectItem?.items)"
9544
+ [selected]="selectItem?.value === controlValue"
9545
+ [value]="selectItem?.value">
9546
+ <span [innerHTML]="selectItem?.name"></span>
9547
+ </option>
9548
+ <optgroup *ngIf="isArray(selectItem?.items)"
9549
+ [label]="selectItem?.group">
9550
+ <option *ngFor="let subItem of selectItem.items"
9551
+ [attr.selected]="subItem?.value === controlValue"
9552
+ [value]="subItem?.value">
9553
+ <span [innerHTML]="subItem?.name"></span>
9554
+ </option>
9555
+ </optgroup>
9556
+ </ng-template>
9557
+ </select>
9558
+ </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
9559
  }
8680
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SelectComponent, decorators: [{
9560
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SelectComponent, decorators: [{
8681
9561
  type: Component,
8682
9562
  args: [{
8683
9563
  // tslint:disable-next-line:component-selector
@@ -8690,7 +9570,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
8690
9570
  [class]="options?.labelHtmlClass || ''"
8691
9571
  [style.display]="options?.notitle ? 'none' : ''"
8692
9572
  [innerHTML]="options?.title"></label>
8693
- <select *ngIf="boundControl"
9573
+ <select *ngIf="boundControl && !options?.multiple"
8694
9574
  [formControl]="formControl"
8695
9575
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
8696
9576
  [attr.readonly]="options?.readonly ? 'readonly' : null"
@@ -8737,6 +9617,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
8737
9617
  </optgroup>
8738
9618
  </ng-template>
8739
9619
  </select>
9620
+ <select *ngIf="boundControl && options?.multiple"
9621
+ [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
9622
+ [attr.readonly]="options?.readonly ? 'readonly' : null"
9623
+ [attr.required]="options?.required"
9624
+ [class]="options?.fieldHtmlClass || ''"
9625
+ [disabled]="controlDisabled"
9626
+ [id]="'control' + layoutNode()?._id"
9627
+ [multiple]="options?.multiple"
9628
+ [name]="controlName"
9629
+ [(ngModel)]="controlValue"
9630
+ (change)="updateValue($event)">
9631
+ <ng-template ngFor let-selectItem [ngForOf]="selectList">
9632
+ <option *ngIf="!isArray(selectItem?.items)"
9633
+ [selected]="selectItem?.value === controlValue"
9634
+ [value]="selectItem?.value">
9635
+ <span [innerHTML]="selectItem?.name"></span>
9636
+ </option>
9637
+ <optgroup *ngIf="isArray(selectItem?.items)"
9638
+ [label]="selectItem?.group">
9639
+ <option *ngFor="let subItem of selectItem.items"
9640
+ [attr.selected]="subItem?.value === controlValue"
9641
+ [value]="subItem?.value">
9642
+ <span [innerHTML]="subItem?.name"></span>
9643
+ </option>
9644
+ </optgroup>
9645
+ </ng-template>
9646
+ </select>
8740
9647
  </div>`,
8741
9648
  standalone: false
8742
9649
  }]
@@ -8754,6 +9661,7 @@ class SubmitComponent {
8754
9661
  ngOnDestroy() {
8755
9662
  this.isValidChangesSubs?.unsubscribe();
8756
9663
  this.isValidChangesSubs = null;
9664
+ this.updateValue({ target: { value: null } });
8757
9665
  }
8758
9666
  ngOnInit() {
8759
9667
  this.options = this.layoutNode().options || {};
@@ -8777,8 +9685,8 @@ class SubmitComponent {
8777
9685
  this.jsf.updateValue(this, event.target.value);
8778
9686
  }
8779
9687
  }
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: `
9688
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SubmitComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9689
+ 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
9690
  <div
8783
9691
  [class]="options?.htmlClass || ''">
8784
9692
  <input
@@ -8794,7 +9702,7 @@ class SubmitComponent {
8794
9702
  (click)="updateValue($event)">
8795
9703
  </div>`, isInline: true }); }
8796
9704
  }
8797
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SubmitComponent, decorators: [{
9705
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SubmitComponent, decorators: [{
8798
9706
  type: Component,
8799
9707
  args: [{
8800
9708
  // tslint:disable-next-line:component-selector
@@ -8828,8 +9736,8 @@ class TabComponent {
8828
9736
  ngOnInit() {
8829
9737
  this.options = this.layoutNode().options || {};
8830
9738
  }
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: `
9739
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TabComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9740
+ 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
9741
  <div [class]="options?.htmlClass || ''">
8834
9742
  <root-widget
8835
9743
  [dataIndex]="dataIndex()"
@@ -8837,7 +9745,7 @@ class TabComponent {
8837
9745
  [layout]="layoutNode().items"></root-widget>
8838
9746
  </div>`, isInline: true, dependencies: [{ kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }] }); }
8839
9747
  }
8840
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TabComponent, decorators: [{
9748
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TabComponent, decorators: [{
8841
9749
  type: Component,
8842
9750
  args: [{
8843
9751
  // tslint:disable-next-line:component-selector
@@ -8853,107 +9761,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
8853
9761
  }]
8854
9762
  }] });
8855
9763
 
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
9764
  class TemplateComponent {
8958
9765
  constructor() {
8959
9766
  this.jsf = inject(JsonSchemaFormService);
@@ -8981,10 +9788,10 @@ class TemplateComponent {
8981
9788
  }
8982
9789
  }
8983
9790
  }
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 }); }
9791
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TemplateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9792
+ 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
9793
  }
8987
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TemplateComponent, decorators: [{
9794
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TemplateComponent, decorators: [{
8988
9795
  type: Component,
8989
9796
  args: [{
8990
9797
  // tslint:disable-next-line:component-selector
@@ -9010,8 +9817,11 @@ class TextareaComponent {
9010
9817
  updateValue(event) {
9011
9818
  this.jsf.updateValue(this, event.target.value);
9012
9819
  }
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: `
9820
+ ngOnDestroy() {
9821
+ this.jsf.updateValue(this, null);
9822
+ }
9823
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TextareaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9824
+ 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
9825
  <div
9016
9826
  [class]="options?.htmlClass || ''">
9017
9827
  <label *ngIf="options?.title"
@@ -9047,7 +9857,7 @@ class TextareaComponent {
9047
9857
  (input)="updateValue($event)">{{controlValue}}</textarea>
9048
9858
  </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
9859
  }
9050
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TextareaComponent, decorators: [{
9860
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TextareaComponent, decorators: [{
9051
9861
  type: Component,
9052
9862
  args: [{
9053
9863
  // tslint:disable-next-line:component-selector
@@ -9284,10 +10094,10 @@ class WidgetLibraryService {
9284
10094
  activeWidgets: this.activeWidgets,
9285
10095
  };
9286
10096
  }
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' }); }
10097
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
10098
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryService, providedIn: 'root' }); }
9289
10099
  }
9290
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: WidgetLibraryService, decorators: [{
10100
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryService, decorators: [{
9291
10101
  type: Injectable,
9292
10102
  args: [{
9293
10103
  providedIn: 'root',
@@ -9304,17 +10114,23 @@ const BASIC_WIDGETS = [
9304
10114
  ];
9305
10115
 
9306
10116
  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,
10117
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
10118
+ 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] }); }
10119
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryModule, imports: [CommonModule, FormsModule, ReactiveFormsModule,
9310
10120
  SortablejsModule.forRoot({
9311
10121
  //disabled:false,
9312
10122
  //draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
9313
10123
  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
10124
+ preventOnFilter: false, //needed for input range elements slider do still work
10125
+ onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
10126
+ if (evt.related.classList.contains("sortable-fixed")) {
10127
+ //console.log(evt.related);
10128
+ return false;
10129
+ }
10130
+ }
9315
10131
  })] }); }
9316
10132
  }
9317
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: WidgetLibraryModule, decorators: [{
10133
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryModule, decorators: [{
9318
10134
  type: NgModule,
9319
10135
  args: [{
9320
10136
  imports: [CommonModule, FormsModule, ReactiveFormsModule,
@@ -9322,7 +10138,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
9322
10138
  //disabled:false,
9323
10139
  //draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
9324
10140
  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
10141
+ preventOnFilter: false, //needed for input range elements slider do still work
10142
+ onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
10143
+ if (evt.related.classList.contains("sortable-fixed")) {
10144
+ //console.log(evt.related);
10145
+ return false;
10146
+ }
10147
+ }
9326
10148
  })],
9327
10149
  declarations: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective],
9328
10150
  exports: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective]
@@ -9331,13 +10153,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
9331
10153
 
9332
10154
  // No framework - plain HTML controls (styles from form layout only)
9333
10155
  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: [
10156
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFrameworkModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
10157
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: NoFrameworkModule, declarations: [NoFrameworkComponent], imports: [CommonModule, WidgetLibraryModule], exports: [NoFrameworkComponent] }); }
10158
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFrameworkModule, providers: [
9337
10159
  { provide: Framework, useClass: NoFramework, multi: true }
9338
10160
  ], imports: [CommonModule, WidgetLibraryModule] }); }
9339
10161
  }
9340
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoFrameworkModule, decorators: [{
10162
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFrameworkModule, decorators: [{
9341
10163
  type: NgModule,
9342
10164
  args: [{
9343
10165
  imports: [CommonModule, WidgetLibraryModule],
@@ -9501,10 +10323,10 @@ class FrameworkLibraryService {
9501
10323
  return actFramework.unregisterTheme(name);
9502
10324
  }
9503
10325
  }
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' }); }
10326
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FrameworkLibraryService, deps: [{ token: Framework }], target: i0.ɵɵFactoryTarget.Injectable }); }
10327
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FrameworkLibraryService, providedIn: 'root' }); }
9506
10328
  }
9507
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: FrameworkLibraryService, decorators: [{
10329
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FrameworkLibraryService, decorators: [{
9508
10330
  type: Injectable,
9509
10331
  args: [{
9510
10332
  providedIn: 'root',
@@ -9567,7 +10389,7 @@ class JsonSchemaFormComponent {
9567
10389
  this.previousInputs = {
9568
10390
  schema: null, layout: null, data: null, options: null, framework: null,
9569
10391
  widgets: null, form: null, model: null, JSONSchema: null, UISchema: null,
9570
- formData: null, loadExternalAssets: null, debug: null,
10392
+ formData: null, loadExternalAssets: null, debug: null, ajvOptions: null
9571
10393
  };
9572
10394
  // Recommended inputs
9573
10395
  this.schema = input(undefined); // The JSON Schema
@@ -9590,6 +10412,7 @@ class JsonSchemaFormComponent {
9590
10412
  this.loadExternalAssets = input(undefined); // Load external framework assets?
9591
10413
  this.debug = input(undefined); // Show debug information?
9592
10414
  this.theme = input(undefined); // Theme
10415
+ this.ajvOptions = input(undefined); // ajvOptions
9593
10416
  // Outputs
9594
10417
  this.onChanges = output(); // Live unvalidated internal form data
9595
10418
  this.onSubmit = output(); // Complete validated form data
@@ -9811,6 +10634,7 @@ class JsonSchemaFormComponent {
9811
10634
  this.jsf.data) {
9812
10635
  // Reset all form values to defaults
9813
10636
  this.jsf.resetAllValues();
10637
+ this.initializeAjv();
9814
10638
  this.initializeOptions(); // Update options
9815
10639
  this.initializeSchema(); // Update schema, schemaRefLibrary,
9816
10640
  // schemaRecursiveRefMap, & dataRecursiveRefMap
@@ -9861,6 +10685,18 @@ class JsonSchemaFormComponent {
9861
10685
  this.formInitialized = true;
9862
10686
  }
9863
10687
  }
10688
+ /**
10689
+ * 'initializeAjv' function
10690
+ *
10691
+ * Initialize ajv from 'ajvOptions'
10692
+ */
10693
+ initializeAjv() {
10694
+ const form = this.form();
10695
+ const ajvOptions = cloneDeep(this.ajvOptions()) || cloneDeep(form.ajvOptions);
10696
+ if (ajvOptions) {
10697
+ this.ajvInstanceName = this.jsf.createAndRegisterAjvInstance(ajvOptions).name;
10698
+ }
10699
+ }
9864
10700
  /**
9865
10701
  * 'initializeOptions' function
9866
10702
  *
@@ -9984,7 +10820,8 @@ class JsonSchemaFormComponent {
9984
10820
  // draft 3 (JSON Form style) and draft 4 (Angular Schema Form style)
9985
10821
  this.jsf.schema = convertSchemaToDraft6(this.jsf.schema);
9986
10822
  // Initialize ajv and compile schema
9987
- this.jsf.compileAjvSchema();
10823
+ //this.jsf.compileAjvSchema();
10824
+ //moved to initializeAjv()
9988
10825
  // Create schemaRefLibrary, schemaRecursiveRefMap, dataRecursiveRefMap, & arrayMap
9989
10826
  this.jsf.schema = resolveSchemaReferences(this.jsf.schema, this.jsf.schemaRefLibrary, this.jsf.schemaRecursiveRefMap, this.jsf.dataRecursiveRefMap, this.jsf.arrayMap);
9990
10827
  if (hasOwn(this.jsf.schemaRefLibrary, '')) {
@@ -10188,7 +11025,8 @@ class JsonSchemaFormComponent {
10188
11025
  }
10189
11026
  if (!isEmpty(this.jsf.schema)) {
10190
11027
  // If not already initialized, initialize ajv and compile schema
10191
- this.jsf.compileAjvSchema();
11028
+ //this.jsf.compileAjvSchema();
11029
+ //moved to initializeAjv()
10192
11030
  // Update all layout elements, add values, widgets, and validators,
10193
11031
  // replace any '*' with a layout built from all schema elements,
10194
11032
  // and update the FormGroup template with any new validators
@@ -10196,7 +11034,7 @@ class JsonSchemaFormComponent {
10196
11034
  // Build the Angular FormGroup template from the schema
10197
11035
  this.jsf.buildFormGroupTemplate(this.jsf.formValues);
10198
11036
  // Build the real Angular FormGroup from the FormGroup template
10199
- this.jsf.buildFormGroup();
11037
+ this.jsf.buildFormGroup(this.ajvInstanceName);
10200
11038
  }
10201
11039
  if (this.jsf.formGroup) {
10202
11040
  // Reset initial form values
@@ -10246,10 +11084,10 @@ class JsonSchemaFormComponent {
10246
11084
  }
10247
11085
  }
10248
11086
  }
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 }); }
11087
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonSchemaFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
11088
+ 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
11089
  }
10252
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonSchemaFormComponent, decorators: [{
11090
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonSchemaFormComponent, decorators: [{
10253
11091
  type: Component,
10254
11092
  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
11093
  }], propDecorators: { value: [{
@@ -10257,13 +11095,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
10257
11095
  }] } });
10258
11096
 
10259
11097
  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,
11098
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonSchemaFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
11099
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: JsonSchemaFormModule, declarations: [JsonSchemaFormComponent], imports: [CommonModule, FormsModule, ReactiveFormsModule,
10262
11100
  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,
11101
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonSchemaFormModule, imports: [CommonModule, FormsModule, ReactiveFormsModule,
10264
11102
  WidgetLibraryModule, NoFrameworkModule, WidgetLibraryModule] }); }
10265
11103
  }
10266
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonSchemaFormModule, decorators: [{
11104
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonSchemaFormModule, decorators: [{
10267
11105
  type: NgModule,
10268
11106
  args: [{
10269
11107
  imports: [
@@ -10283,5 +11121,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
10283
11121
  * Generated bundle index. Do not edit.
10284
11122
  */
10285
11123
 
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 };
11124
+ 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
11125
  //# sourceMappingURL=ng-formworks-core.mjs.map