@ng-formworks/core 18.6.5 → 18.6.7

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.
Files changed (29) hide show
  1. package/esm2022/lib/json-schema-form.component.mjs +1 -1
  2. package/esm2022/lib/json-schema-form.service.mjs +25 -16
  3. package/esm2022/lib/shared/form-group.functions.mjs +52 -3
  4. package/esm2022/lib/shared/layout.functions.mjs +32 -9
  5. package/esm2022/lib/widget-library/add-reference.component.mjs +13 -6
  6. package/esm2022/lib/widget-library/button.component.mjs +9 -4
  7. package/esm2022/lib/widget-library/checkbox.component.mjs +2 -1
  8. package/esm2022/lib/widget-library/index.mjs +2 -1
  9. package/esm2022/lib/widget-library/input.component.mjs +9 -4
  10. package/esm2022/lib/widget-library/number.component.mjs +9 -6
  11. package/esm2022/lib/widget-library/root.component.mjs +167 -124
  12. package/esm2022/lib/widget-library/section.component.mjs +2 -2
  13. package/esm2022/lib/widget-library/select-framework.component.mjs +9 -5
  14. package/esm2022/lib/widget-library/select-widget.component.mjs +5 -4
  15. package/esm2022/lib/widget-library/stop-propagation.directive.mjs +42 -0
  16. package/esm2022/lib/widget-library/submit.component.mjs +9 -4
  17. package/esm2022/lib/widget-library/tab.component.mjs +1 -1
  18. package/esm2022/lib/widget-library/widget-library.module.mjs +9 -32
  19. package/fesm2022/ng-formworks-core.mjs +500 -333
  20. package/fesm2022/ng-formworks-core.mjs.map +1 -1
  21. package/lib/json-schema-form.service.d.ts +0 -3
  22. package/lib/shared/validator.functions.d.ts +1 -1
  23. package/lib/widget-library/index.d.ts +1 -0
  24. package/lib/widget-library/root.component.d.ts +25 -7
  25. package/lib/widget-library/select-framework.component.d.ts +2 -1
  26. package/lib/widget-library/select-widget.component.d.ts +2 -2
  27. package/lib/widget-library/stop-propagation.directive.d.ts +13 -0
  28. package/lib/widget-library/widget-library.module.d.ts +5 -4
  29. package/package.json +3 -4
@@ -1,7 +1,7 @@
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, Directive, Input, ChangeDetectionStrategy, ViewChild, signal, ElementRef, NgZone, Inject, NgModule, forwardRef, ChangeDetectorRef, output } from '@angular/core';
4
+ import { Injectable, inject, input, viewChild, ViewContainerRef, Component, Directive, Input, ChangeDetectionStrategy, ViewChild, ChangeDetectorRef, signal, Inject, ElementRef, NgZone, NgModule, forwardRef, 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
7
  import addFormats from 'ajv-formats';
@@ -10,7 +10,7 @@ import jsonDraft6 from 'ajv/lib/refs/json-schema-draft-06.json';
10
10
  import jsonDraft7 from 'ajv/lib/refs/json-schema-draft-07.json';
11
11
  import cloneDeep from 'lodash/cloneDeep';
12
12
  import { from, Observable, forkJoin, Subject, BehaviorSubject, lastValueFrom } from 'rxjs';
13
- import { some, isNil, isEmpty as isEmpty$1, isObject as isObject$1, pick, isEqual as isEqual$2 } from 'lodash';
13
+ import { some, isNil, isEmpty as isEmpty$1, isObject as isObject$1, pick, isEqual as isEqual$2, memoize } from 'lodash';
14
14
  import isEqual$1 from 'lodash/isEqual';
15
15
  import { map, takeUntil } from 'rxjs/operators';
16
16
  import omit from 'lodash/omit';
@@ -19,8 +19,8 @@ import map$1 from 'lodash/map';
19
19
  import _isArray from 'lodash/isArray';
20
20
  import _isPlainObject from 'lodash/isPlainObject';
21
21
  import uniqueId from 'lodash/uniqueId';
22
- import * as i2$1 from 'nxt-sortablejs';
23
- import { SortablejsModule } from 'nxt-sortablejs';
22
+ import * as i2$1 from '@angular/cdk/drag-drop';
23
+ import { DragDropModule } from '@angular/cdk/drag-drop';
24
24
  import { HttpClient } from '@angular/common/http';
25
25
 
26
26
  class Framework {
@@ -5265,14 +5265,24 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
5265
5265
  const schemaRefPointer = removeRecursiveReferences(schemaPointer + '/items/' + i, jsf.schemaRecursiveRefMap);
5266
5266
  const itemRefPointer = removeRecursiveReferences(shortDataPointer + '/' + i, jsf.dataRecursiveRefMap, jsf.arrayMap);
5267
5267
  const itemRecursive = itemRefPointer !== shortDataPointer + '/' + i;
5268
+ //if is in templateLibrary then need to check if its a conditional
5269
+ //and conditional pointers match orthewise create a new ref
5270
+ let conditionalRefPointer = `${itemRefPointer}@${schemaPointer}`;
5271
+ let templateRefToUse = itemRefPointer;
5272
+ if (hasOwn(jsf.templateRefLibrary, itemRefPointer)
5273
+ && !hasOwn(jsf.templateRefLibrary, conditionalRefPointer)) {
5274
+ jsf.templateRefLibrary[conditionalRefPointer] = buildFormGroupTemplate(jsf, null, setValues, schemaRefPointer, itemRefPointer, templatePointer + '/controls/' + i);
5275
+ templateRefToUse = conditionalRefPointer;
5276
+ }
5268
5277
  if (!hasOwn(jsf.templateRefLibrary, itemRefPointer)) {
5269
5278
  jsf.templateRefLibrary[itemRefPointer] = null;
5270
5279
  jsf.templateRefLibrary[itemRefPointer] = buildFormGroupTemplate(jsf, null, setValues, schemaRefPointer, itemRefPointer, templatePointer + '/controls/' + i);
5280
+ jsf.templateRefLibrary[conditionalRefPointer] = jsf.templateRefLibrary[itemRefPointer];
5271
5281
  }
5272
5282
  controls.push(isArray(nodeValue) ?
5273
5283
  buildFormGroupTemplate(jsf, nodeValue[i], setValues, schemaPointer + '/items/' + i, dataPointer + '/' + i, templatePointer + '/controls/' + i) :
5274
5284
  itemRecursive ?
5275
- null : cloneDeep(jsf.templateRefLibrary[itemRefPointer]));
5285
+ null : cloneDeep(jsf.templateRefLibrary[templateRefToUse]));
5276
5286
  }
5277
5287
  }
5278
5288
  // If 'additionalItems' is an object = additional list items (after tuple items)
@@ -5288,9 +5298,19 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
5288
5298
  const schemaRefPointer = removeRecursiveReferences(additionalItemsPointer, jsf.schemaRecursiveRefMap);
5289
5299
  const itemRefPointer = removeRecursiveReferences(shortDataPointer + '/-', jsf.dataRecursiveRefMap, jsf.arrayMap);
5290
5300
  const itemRecursive = itemRefPointer !== shortDataPointer + '/-';
5301
+ //if is in templateLibrary then need to check if its a conditional
5302
+ //and conditional pointers match orthewise create a new ref
5303
+ let conditionalRefPointer = `${itemRefPointer}@${schemaPointer}`;
5304
+ let templateRefToUse = itemRefPointer;
5305
+ if (hasOwn(jsf.templateRefLibrary, itemRefPointer)
5306
+ && !hasOwn(jsf.templateRefLibrary, conditionalRefPointer)) {
5307
+ jsf.templateRefLibrary[conditionalRefPointer] = buildFormGroupTemplate(jsf, null, setValues, schemaRefPointer, itemRefPointer, templatePointer + '/controls/-');
5308
+ templateRefToUse = conditionalRefPointer;
5309
+ }
5291
5310
  if (!hasOwn(jsf.templateRefLibrary, itemRefPointer)) {
5292
5311
  jsf.templateRefLibrary[itemRefPointer] = null;
5293
5312
  jsf.templateRefLibrary[itemRefPointer] = buildFormGroupTemplate(jsf, null, setValues, schemaRefPointer, itemRefPointer, templatePointer + '/controls/-');
5313
+ jsf.templateRefLibrary[conditionalRefPointer] = jsf.templateRefLibrary[itemRefPointer];
5294
5314
  }
5295
5315
  // const itemOptions = jsf.dataMap.get(itemRefPointer) || new Map();
5296
5316
  const itemOptions = nodeOptions;
@@ -5301,7 +5321,7 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
5301
5321
  controls.push(isArray(nodeValue) ?
5302
5322
  buildFormGroupTemplate(jsf, nodeValue[i], setValues, schemaRefPointer, dataPointer + '/-', templatePointer + '/controls/-') :
5303
5323
  itemRecursive ?
5304
- null : cloneDeep(jsf.templateRefLibrary[itemRefPointer]));
5324
+ null : cloneDeep(jsf.templateRefLibrary[templateRefToUse]));
5305
5325
  }
5306
5326
  }
5307
5327
  }
@@ -5620,6 +5640,35 @@ function getControl(formGroup, dataPointer, returnGroup = false, schemaPointer)
5620
5640
  // or formGroup.get() failed to return the control,
5621
5641
  // search the formGroup object for dataPointer's control
5622
5642
  let subGroup = formGroup;
5643
+ //if schemapointer provided but no control matched
5644
+ //it could mean the schema pointer is a nested child
5645
+ //for example this could be in form group
5646
+ //formGroup.controls.$allOf$0$then$properties$foo
5647
+ //but schemapointer provided is '/allOf/0/then/properties/foo/items/properties/name'
5648
+ //and dataPointer is '/foo/0/name'
5649
+ //then need to look in formGroup.controls.$allOf$0$then$properties$foo
5650
+ //for control path /0/name
5651
+ if (schemaPointer) {
5652
+ let controlPointer = JsonPointer.toControlPointer(dataPointer, {});
5653
+ let schemaPointerArray = schemaPointer.split('/');
5654
+ let controlPointerArray = JsonPointer.parse(dataPointer);
5655
+ //controlPointer.split('/').splice(1);
5656
+ let currSPAKey;
5657
+ let spFormGroup;
5658
+ while (schemaPointerArray.length > 0) {
5659
+ currSPAKey = schemaPointerArray.pop();
5660
+ let ckey = path2ControlKey(schemaPointerArray.join("/"));
5661
+ spFormGroup = formGroup.get(ckey);
5662
+ if (controlPointerArray[0] == schemaPointerArray[schemaPointerArray.length - 1]) {
5663
+ controlPointerArray.shift();
5664
+ }
5665
+ if (spFormGroup) {
5666
+ break;
5667
+ }
5668
+ }
5669
+ subGroup = spFormGroup || subGroup;
5670
+ dataPointerArray = spFormGroup ? controlPointerArray : dataPointerArray;
5671
+ }
5623
5672
  for (const key of dataPointerArray) {
5624
5673
  if (hasOwn(subGroup, 'controls')) {
5625
5674
  subGroup = subGroup.controls;
@@ -6324,13 +6373,15 @@ function fixNestedArrayLayout(options) {
6324
6373
  function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPointer = '', dataPointer = '', arrayItem = false, arrayItemType = null, removable = null, forRefLibrary = false, dataPointerPrefix = '', jsonSchema) {
6325
6374
  function applyITEConditions(builtLayout, schPointer, keySchemaPointer, negateClause, parentLayout) {
6326
6375
  if (builtLayout) {
6327
- if (parentLayout && parentLayout.isITEItem && parentLayout.options.condition) {
6376
+ const parentCondition = parentLayout && parentLayout.isITEItem && parentLayout.options.condition;
6377
+ if (parentCondition) {
6378
+ //builtLayout.isITEItem=true;
6328
6379
  return;
6329
6380
  }
6330
6381
  if (isArray(builtLayout)) {
6331
6382
  builtLayout.forEach(item => {
6332
6383
  item.isITEItem = true;
6333
- item.options.condition = convertJSONSchemaIfToCondition(schema, item, negateClause);
6384
+ item.options.condition = parentCondition ? null : convertJSONSchemaIfToCondition(schema, item, negateClause);
6334
6385
  applyITEConditions(item, schPointer, keySchemaPointer, negateClause, builtLayout);
6335
6386
  //item.schemaPointer = schPointer + keySchemaPointer + item.dataPointer;
6336
6387
  //item.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
@@ -6348,7 +6399,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6348
6399
  else {
6349
6400
  builtLayout.isITEItem = true;
6350
6401
  //builtLayout.schemaPointer = `${schPointer}${keySchemaPointer}/${builtLayout.name}`;
6351
- builtLayout.options.condition = convertJSONSchemaIfToCondition(schema, builtLayout, negateClause);
6402
+ builtLayout.options.condition = parentCondition ? null : convertJSONSchemaIfToCondition(schema, builtLayout, negateClause);
6352
6403
  //newSection.push(builtLayout)
6353
6404
  }
6354
6405
  }
@@ -6460,7 +6511,8 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6460
6511
  '/properties/' + innerItemLevel2.name : innerItemLevel2.name;
6461
6512
  //innerItemLevel2.oneOfPointer = schemaPointer + keySchemaPointer + l2SchemaPointer;
6462
6513
  // innerItemLevel2.schemaPointer=innerItemLevel2.schemaPointer;
6463
- innerItemLevel2.oneOfPointer = innerItemLevel2.schemaPointer;
6514
+ const ofPointer = { anyOf: "anyOfPointer", oneOf: "oneOfPointer" }[ofType];
6515
+ innerItemLevel2[ofPointer] = ofPointer ? innerItemLevel2.schemaPointer : undefined;
6464
6516
  });
6465
6517
  }
6466
6518
  //TODO review-will never reach here if forRefLibrary==true
@@ -6470,6 +6522,9 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6470
6522
  innerItem.forEach(item => {
6471
6523
  const l2SchemaPointer = hasOwn(ofItem, 'properties') ?
6472
6524
  '/properties/' + item.name : item.name;
6525
+ if (ofType == "anyOf") {
6526
+ item.anyOfPointer = item.schemaPointer;
6527
+ }
6473
6528
  if (outerOneOfItem) {
6474
6529
  ////item.oneOfPointer = schemaPointer + keySchemaPointer + l2SchemaPointer;
6475
6530
  //schemaPointer + keySchemaPointer + item.dataPointer;
@@ -6493,7 +6548,8 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6493
6548
  }
6494
6549
  else {
6495
6550
  if (outerOneOfItem) {
6496
- innerItem.oneOfPointer = schemaPointer + keySchemaPointer; // + innerItem.dataPointer;
6551
+ const ofPointer = { anyOf: "anyOfPointer", oneOf: "oneOfPointer" }[ofType];
6552
+ innerItem[ofPointer] = ofPointer ? schemaPointer + keySchemaPointer : undefined;
6497
6553
  ////innerItem.schemaPointer=innerItem.oneOfPointer;
6498
6554
  outerOneOfItem.items = outerOneOfItem.items || [];
6499
6555
  outerOneOfItem.items.push(innerItem);
@@ -6586,6 +6642,13 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6586
6642
  itemRefPointer !== shortDataPointer + '/' + i;
6587
6643
  // If removable, add tuple item layout to layoutRefLibrary
6588
6644
  if (removable && i >= newNode.options.minItems) {
6645
+ let conditionalRefPointer = `${itemRefPointer}@${schemaPointer}`;
6646
+ let templateRefToUse = itemRefPointer;
6647
+ if (hasOwn(jsf.layoutRefLibrary, itemRefPointer)
6648
+ && !hasOwn(jsf.layoutRefLibrary, conditionalRefPointer)) {
6649
+ jsf.layoutRefLibrary[conditionalRefPointer] = buildLayoutFromSchema(jsf, widgetLibrary, isArray(nodeValue) ? nodeValue[i] : null, schemaPointer + '/items/' + i, itemRecursive ? '' : dataPointer + '/' + i, true, 'tuple', true, true, itemRecursive ? dataPointer + '/' + i : '');
6650
+ templateRefToUse = conditionalRefPointer;
6651
+ }
6589
6652
  if (!hasOwn(jsf.layoutRefLibrary, itemRefPointer)) {
6590
6653
  // Set to null first to prevent recursive reference from causing endless loop
6591
6654
  jsf.layoutRefLibrary[itemRefPointer] = null;
@@ -6593,9 +6656,10 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6593
6656
  if (itemRecursive) {
6594
6657
  jsf.layoutRefLibrary[itemRefPointer].recursiveReference = true;
6595
6658
  }
6659
+ jsf.layoutRefLibrary[conditionalRefPointer] = jsf.layoutRefLibrary[itemRefPointer];
6596
6660
  }
6597
6661
  newItem = getLayoutNode({
6598
- $ref: itemRefPointer,
6662
+ $ref: templateRefToUse,
6599
6663
  dataPointer: dataPointer + '/' + i,
6600
6664
  recursiveReference: itemRecursive,
6601
6665
  }, jsf, widgetLibrary, isArray(nodeValue) ? nodeValue[i] : null);
@@ -6621,6 +6685,13 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6621
6685
  const itemRecursive = !itemRefPointer.length ||
6622
6686
  itemRefPointer !== shortDataPointer + '/-';
6623
6687
  const itemSchemaPointer = removeRecursiveReferences(additionalItemsSchemaPointer, jsf.schemaRecursiveRefMap, jsf.arrayMap);
6688
+ let conditionalRefPointer = `${itemRefPointer}@${schemaPointer}`;
6689
+ let templateRefToUse = itemRefPointer;
6690
+ if (hasOwn(jsf.layoutRefLibrary, itemRefPointer)
6691
+ && !hasOwn(jsf.layoutRefLibrary, conditionalRefPointer)) {
6692
+ jsf.layoutRefLibrary[conditionalRefPointer] = buildLayoutFromSchema(jsf, widgetLibrary, null, itemSchemaPointer, itemRecursive ? '' : dataPointer + '/-', true, 'list', removable, true, itemRecursive ? dataPointer + '/-' : '');
6693
+ templateRefToUse = conditionalRefPointer;
6694
+ }
6624
6695
  // Add list item layout to layoutRefLibrary
6625
6696
  if (itemRefPointer.length && !hasOwn(jsf.layoutRefLibrary, itemRefPointer)) {
6626
6697
  // Set to null first to prevent recursive reference from causing endless loop
@@ -6629,6 +6700,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6629
6700
  if (itemRecursive) {
6630
6701
  jsf.layoutRefLibrary[itemRefPointer].recursiveReference = true;
6631
6702
  }
6703
+ jsf.layoutRefLibrary[conditionalRefPointer] = jsf.layoutRefLibrary[itemRefPointer];
6632
6704
  }
6633
6705
  // Add any additional default items
6634
6706
  if (!itemRecursive || newNode.options.required) {
@@ -6637,7 +6709,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6637
6709
  if (newNode.items.length < arrayLength) {
6638
6710
  for (let i = newNode.items.length; i < arrayLength; i++) {
6639
6711
  newNode.items.push(getLayoutNode({
6640
- $ref: itemRefPointer,
6712
+ $ref: templateRefToUse,
6641
6713
  dataPointer: dataPointer + '/-',
6642
6714
  recursiveReference: itemRecursive,
6643
6715
  }, jsf, widgetLibrary, isArray(nodeValue) ? nodeValue[i] : null));
@@ -6672,7 +6744,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6672
6744
  recursiveReference: itemRecursive,
6673
6745
  type: '$ref',
6674
6746
  widget: widgetLibrary.getWidget('$ref'),
6675
- $ref: itemRefPointer,
6747
+ $ref: templateRefToUse //itemRefPointer,
6676
6748
  });
6677
6749
  }
6678
6750
  }
@@ -7023,9 +7095,6 @@ class JsonSchemaFormService {
7023
7095
  setDraggableState(value) {
7024
7096
  this.draggableStateSubject.next(value); // Update the draggable value
7025
7097
  }
7026
- setSortableOptions(value) {
7027
- this.sortableOptionsSubject.next(value); // Update the sortable options value
7028
- }
7029
7098
  createAjvInstance(ajvOptions) {
7030
7099
  let ajvInstance = new Ajv2019(ajvOptions);
7031
7100
  ajvInstance.addMetaSchema(jsonDraft6);
@@ -7146,10 +7215,6 @@ class JsonSchemaFormService {
7146
7215
  //and will only be enabled when/if the caller sets the value back to true
7147
7216
  this.draggableStateSubject = new BehaviorSubject(true); // Default value true
7148
7217
  this.draggableState$ = this.draggableStateSubject.asObservable();
7149
- //this is introduced to look at replacing the orderable directive with
7150
- //nxt-sortablejs and sortablejs
7151
- this.sortableOptionsSubject = new BehaviorSubject({ disabled: false }); // Default value true
7152
- this.sortableOptions$ = this.sortableOptionsSubject.asObservable();
7153
7218
  this.ajvRegistry = {};
7154
7219
  this.setLanguage(this.language);
7155
7220
  this.ajv.addMetaSchema(jsonDraft6);
@@ -7287,12 +7352,12 @@ class JsonSchemaFormService {
7287
7352
  this.formGroup = buildFormGroup(this.formGroupTemplate);
7288
7353
  if (this.formGroup) {
7289
7354
  this.compileAjvSchema(ajvInstanceName);
7290
- this.validateData(this.formGroup.value, true, ajvInstanceName);
7355
+ this.validateData(this.formGroup.getRawValue(), true, ajvInstanceName);
7291
7356
  // Set up observables to emit data and validation info when form data changes
7292
7357
  if (this.formValueSubscription) {
7293
7358
  this.formValueSubscription.unsubscribe();
7294
7359
  }
7295
- this.formValueSubscription = this.formGroup.valueChanges.subscribe(formValue => this.validateData(formValue, true, ajvInstanceName));
7360
+ this.formValueSubscription = this.formGroup.valueChanges.subscribe(formValue => this.validateData(this.formGroup.getRawValue(), true, ajvInstanceName));
7296
7361
  }
7297
7362
  }
7298
7363
  buildLayout(widgetLibrary) {
@@ -7411,6 +7476,12 @@ class JsonSchemaFormService {
7411
7476
  }
7412
7477
  return '';
7413
7478
  }
7479
+ //TODO fix- if template has value in title
7480
+ // "items": {
7481
+ // "title": "{{ 'Input ' + $index+value }}",
7482
+ // "type": "string"
7483
+ // }
7484
+ // result on button will be "Add Input [object Object]"
7414
7485
  setArrayItemTitle(parentCtx = {}, childNode = null, index = null) {
7415
7486
  //for legacy compatibility, parentCtx.layoutNode could either be a value
7416
7487
  //or have been converted to use Signals
@@ -7503,7 +7574,8 @@ class JsonSchemaFormService {
7503
7574
  //introduced to check if the node is part of ITE conditional
7504
7575
  //then change or add the control
7505
7576
  if (layoutNode?.schemaPointer && layoutNode.isITEItem ||
7506
- (layoutNode?.schemaPointer && layoutNode?.oneOfPointer)) {
7577
+ (layoutNode?.schemaPointer && layoutNode?.oneOfPointer) ||
7578
+ layoutNode?.schemaPointer && layoutNode.anyOfPointer) {
7507
7579
  //before changing control, need to set the new data type for data formatting
7508
7580
  const schemaType = this.dataMap.get(layoutNode?.dataPointer).get("schemaType");
7509
7581
  if (schemaType != layoutNode.dataType) {
@@ -7546,9 +7618,12 @@ class JsonSchemaFormService {
7546
7618
  //set, as the control would only be initialized when the condition is true
7547
7619
  //TODO-review need to decide which of the data sets between data,formValues and default
7548
7620
  //to use for the value
7549
- if (ctx.options?.condition || layoutNode?.oneOfPointer) {
7621
+ //TODO try maybe marking descendants in applyITEConditions
7622
+ let isITEDescendant = layoutNode?.schemaPointer?.split("/")
7623
+ .some(elt => ["then", "else"].includes(elt));
7624
+ if (ctx.options?.condition || layoutNode?.oneOfPointer || layoutNode?.anyOfPointer || isITEDescendant) {
7550
7625
  const dataPointer = this.getDataPointer(ctx);
7551
- const controlValue = ctx.formControl.value;
7626
+ const controlValue = ctx.formControl?.value;
7552
7627
  const dataValue = JsonPointer.has(this.data, dataPointer) ?
7553
7628
  JsonPointer.get(this.data, dataPointer) : undefined;
7554
7629
  const formValue = JsonPointer.has(this.formValues, dataPointer) ?
@@ -7679,7 +7754,8 @@ class JsonSchemaFormService {
7679
7754
  }
7680
7755
  const schemaPointer = ctx.layoutNode()?.isITEItem ? ctx.layoutNode()?.schemaPointer : null;
7681
7756
  const oneOfPointer = ctx.layoutNode()?.oneOfPointer;
7682
- return getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer);
7757
+ const anyOfPointer = ctx.layoutNode()?.anyOfPointer;
7758
+ return getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer || anyOfPointer);
7683
7759
  }
7684
7760
  setFormControl(ctx, control) {
7685
7761
  if (!ctx || !ctx.layoutNode ||
@@ -7697,7 +7773,8 @@ class JsonSchemaFormService {
7697
7773
  }
7698
7774
  const schemaPointer = ctx.layoutNode()?.isITEItem ? ctx.layoutNode()?.schemaPointer : null;
7699
7775
  const oneOfPointer = ctx.layoutNode()?.oneOfPointer;
7700
- const control = getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer);
7776
+ const anyOfPointer = ctx.layoutNode()?.anyOfPointer;
7777
+ const control = getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer || anyOfPointer);
7701
7778
  return control ? control.value : null;
7702
7779
  }
7703
7780
  getFormControlGroup(ctx) {
@@ -7706,7 +7783,8 @@ class JsonSchemaFormService {
7706
7783
  }
7707
7784
  const schemaPointer = ctx.layoutNode()?.isITEItem ? ctx.layoutNode()?.schemaPointer : null;
7708
7785
  const oneOfPointer = ctx.layoutNode()?.oneOfPointer;
7709
- return getControl(this.formGroup, this.getDataPointer(ctx), true, schemaPointer || oneOfPointer);
7786
+ const anyOfPointer = ctx.layoutNode()?.anyOfPointer;
7787
+ return getControl(this.formGroup, this.getDataPointer(ctx), true, schemaPointer || oneOfPointer || anyOfPointer);
7710
7788
  }
7711
7789
  getFormControlName(ctx) {
7712
7790
  if (!ctx || !ctx.layoutNode ||
@@ -7794,6 +7872,9 @@ class JsonSchemaFormService {
7794
7872
  }
7795
7873
  // Move item in the formArray
7796
7874
  const formArray = this.getFormControlGroup(ctx);
7875
+ if (oldIndex >= formArray.length) {
7876
+ return false;
7877
+ }
7797
7878
  const arrayItem = formArray.at(oldIndex);
7798
7879
  formArray.removeAt(oldIndex);
7799
7880
  formArray.insert(newIndex, arrayItem);
@@ -7844,7 +7925,7 @@ class SelectWidgetComponent {
7844
7925
  ngOnInit() {
7845
7926
  this.updateComponent();
7846
7927
  }
7847
- ngOnChanges() {
7928
+ ngOnChanges(changes) {
7848
7929
  this.updateComponent();
7849
7930
  }
7850
7931
  updateComponent() {
@@ -7853,8 +7934,9 @@ class SelectWidgetComponent {
7853
7934
  this.newComponent = widgetContainer.createComponent((this.layoutNode().widget));
7854
7935
  }
7855
7936
  if (this.newComponent) {
7856
- for (const input of ['layoutNode', 'layoutIndex', 'dataIndex']) {
7857
- this.newComponent.instance[input] = this[input];
7937
+ for (const inp of ['layoutNode', 'layoutIndex', 'dataIndex']) {
7938
+ //this.newComponent.instance[inp] = this[inp];
7939
+ this.newComponent.setInput(inp, this[inp]());
7858
7940
  }
7859
7941
  }
7860
7942
  }
@@ -7930,6 +8012,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
7930
8012
  type: Input
7931
8013
  }] } });
7932
8014
 
8015
+ //TODO review:stopPropagation used as a workaround
8016
+ //to prevent dragging onMouseDown and onTouchStart events
8017
+ class StopPropagationDirective {
8018
+ constructor(el, renderer) {
8019
+ this.el = el;
8020
+ this.renderer = renderer;
8021
+ // The input property to receive an array of event names
8022
+ this.events = [];
8023
+ // An array to hold the unsubscribe functions for each event listener
8024
+ this.unsubscribeFunctions = [];
8025
+ }
8026
+ ngOnInit() {
8027
+ // If the input array is empty, default to 'mousedown'
8028
+ const eventsToListen = this.events.length > 0 ? this.events : ['mousedown'];
8029
+ // Loop through the array of event names and set up a listener for each
8030
+ eventsToListen.forEach(eventName => {
8031
+ const unsub = this.renderer.listen(this.el.nativeElement, eventName, (event) => {
8032
+ event.stopPropagation();
8033
+ });
8034
+ // Store the unsubscribe function to be called on destruction
8035
+ this.unsubscribeFunctions.push(unsub);
8036
+ });
8037
+ }
8038
+ ngOnDestroy() {
8039
+ // Call each stored unsubscribe function to clean up listeners
8040
+ this.unsubscribeFunctions.forEach(unsub => unsub());
8041
+ }
8042
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: StopPropagationDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive }); }
8043
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: { events: ["appStopPropagation", "events"] }, ngImport: i0 }); }
8044
+ }
8045
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: StopPropagationDirective, decorators: [{
8046
+ type: Directive,
8047
+ args: [{
8048
+ selector: '[appStopPropagation]', standalone: false
8049
+ }]
8050
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { events: [{
8051
+ type: Input,
8052
+ args: ['appStopPropagation']
8053
+ }] } });
8054
+
7933
8055
  class AddReferenceComponent {
7934
8056
  constructor() {
7935
8057
  this.jsf = inject(JsonSchemaFormService);
@@ -7961,13 +8083,16 @@ class AddReferenceComponent {
7961
8083
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: AddReferenceComponent, 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: `
7962
8084
  <section [class]="options?.htmlClass || ''" align="end">
7963
8085
  <button *ngIf="showAddButton"
7964
- [class]="options?.fieldHtmlClass || ''" class="sortable-filter sortable-fixed"
8086
+ [class]="options?.fieldHtmlClass || ''"
7965
8087
  [disabled]="options?.readonly"
7966
- (click)="addItem($event)">
8088
+ (click)="addItem($event)"
8089
+ [appStopPropagation]="['mousedown', 'touchstart']"
8090
+ >
7967
8091
  <span *ngIf="options?.icon" [class]="options?.icon"></span>
7968
8092
  <span *ngIf="options?.title" [innerHTML]="buttonText"></span>
8093
+
7969
8094
  </button>
7970
- </section>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
8095
+ </section>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: ["appStopPropagation"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
7971
8096
  }
7972
8097
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AddReferenceComponent, decorators: [{
7973
8098
  type: Component,
@@ -7977,11 +8102,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
7977
8102
  template: `
7978
8103
  <section [class]="options?.htmlClass || ''" align="end">
7979
8104
  <button *ngIf="showAddButton"
7980
- [class]="options?.fieldHtmlClass || ''" class="sortable-filter sortable-fixed"
8105
+ [class]="options?.fieldHtmlClass || ''"
7981
8106
  [disabled]="options?.readonly"
7982
- (click)="addItem($event)">
8107
+ (click)="addItem($event)"
8108
+ [appStopPropagation]="['mousedown', 'touchstart']"
8109
+ >
7983
8110
  <span *ngIf="options?.icon" [class]="options?.icon"></span>
7984
8111
  <span *ngIf="options?.title" [innerHTML]="buttonText"></span>
8112
+
7985
8113
  </button>
7986
8114
  </section>`,
7987
8115
  changeDetection: ChangeDetectionStrategy.Default,
@@ -8024,12 +8152,14 @@ class ButtonComponent {
8024
8152
  [name]="controlName"
8025
8153
  [type]="layoutNode()?.type"
8026
8154
  [value]="controlValue"
8027
- (click)="updateValue($event)">
8155
+ (click)="updateValue($event)"
8156
+ [appStopPropagation]="['mousedown', 'touchstart']"
8157
+ >
8028
8158
  <span *ngIf="options?.icon || options?.title"
8029
8159
  [class]="options?.icon"
8030
8160
  [innerHTML]="options?.title"></span>
8031
8161
  </button>
8032
- </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
8162
+ </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: ["appStopPropagation"] }] }); }
8033
8163
  }
8034
8164
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ButtonComponent, decorators: [{
8035
8165
  type: Component,
@@ -8047,7 +8177,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8047
8177
  [name]="controlName"
8048
8178
  [type]="layoutNode()?.type"
8049
8179
  [value]="controlValue"
8050
- (click)="updateValue($event)">
8180
+ (click)="updateValue($event)"
8181
+ [appStopPropagation]="['mousedown', 'touchstart']"
8182
+ >
8051
8183
  <span *ngIf="options?.icon || options?.title"
8052
8184
  [class]="options?.icon"
8053
8185
  [innerHTML]="options?.title"></span>
@@ -8060,6 +8192,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8060
8192
  //this mainly affects checkboxes coupled with conditions
8061
8193
  //-the value is rechecked
8062
8194
  //-see https://github.com/SortableJS/Sortable/issues/1052#issuecomment-369613072
8195
+ //-switched to angular cdk for dnd
8063
8196
  class CheckboxComponent {
8064
8197
  constructor() {
8065
8198
  this.jsf = inject(JsonSchemaFormService);
@@ -8415,7 +8548,7 @@ class InputComponent {
8415
8548
  }
8416
8549
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: InputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8417
8550
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: InputComponent, 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: `
8418
- <div [class]="options?.htmlClass || ''" class="sortable-filter" >
8551
+ <div [class]="options?.htmlClass || ''" >
8419
8552
  <label *ngIf="options?.title"
8420
8553
  [attr.for]="'control' + layoutNode()?._id"
8421
8554
  [class]="options?.labelHtmlClass || ''"
@@ -8436,6 +8569,7 @@ class InputComponent {
8436
8569
  [readonly]="options?.readonly ? 'readonly' : null"
8437
8570
  [type]="layoutNode()?.type"
8438
8571
  [attributes]="inputAttributes"
8572
+ [appStopPropagation]="['mousedown', 'touchstart']"
8439
8573
  >
8440
8574
  <input *ngIf="!boundControl"
8441
8575
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
@@ -8454,12 +8588,13 @@ class InputComponent {
8454
8588
  [value]="controlValue"
8455
8589
  (input)="updateValue($event)"
8456
8590
  [attributes]="inputAttributes"
8591
+ [appStopPropagation]="['mousedown', 'touchstart']"
8457
8592
  >
8458
8593
  <datalist *ngIf="options?.typeahead?.source"
8459
8594
  [id]="'control' + layoutNode()?._id + 'Autocomplete'">
8460
8595
  <option *ngFor="let word of options?.typeahead?.source" [value]="word">
8461
8596
  </datalist>
8462
- </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"] }] }); }
8597
+ </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"] }, { kind: "directive", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: ["appStopPropagation"] }] }); }
8463
8598
  }
8464
8599
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: InputComponent, decorators: [{
8465
8600
  type: Component,
@@ -8467,7 +8602,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8467
8602
  // tslint:disable-next-line:component-selector
8468
8603
  selector: 'input-widget',
8469
8604
  template: `
8470
- <div [class]="options?.htmlClass || ''" class="sortable-filter" >
8605
+ <div [class]="options?.htmlClass || ''" >
8471
8606
  <label *ngIf="options?.title"
8472
8607
  [attr.for]="'control' + layoutNode()?._id"
8473
8608
  [class]="options?.labelHtmlClass || ''"
@@ -8488,6 +8623,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8488
8623
  [readonly]="options?.readonly ? 'readonly' : null"
8489
8624
  [type]="layoutNode()?.type"
8490
8625
  [attributes]="inputAttributes"
8626
+ [appStopPropagation]="['mousedown', 'touchstart']"
8491
8627
  >
8492
8628
  <input *ngIf="!boundControl"
8493
8629
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
@@ -8506,6 +8642,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8506
8642
  [value]="controlValue"
8507
8643
  (input)="updateValue($event)"
8508
8644
  [attributes]="inputAttributes"
8645
+ [appStopPropagation]="['mousedown', 'touchstart']"
8509
8646
  >
8510
8647
  <datalist *ngIf="options?.typeahead?.source"
8511
8648
  [id]="'control' + layoutNode()?._id + 'Autocomplete'">
@@ -8597,7 +8734,7 @@ class NumberComponent {
8597
8734
  }
8598
8735
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NumberComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8599
8736
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: NumberComponent, 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: `
8600
- <div #divElt [class]="options?.htmlClass || ''" class="sortable-filter" >
8737
+ <div #divElt [class]="options?.htmlClass || ''" >
8601
8738
  <label *ngIf="options?.title"
8602
8739
  [attr.for]="'control' + layoutNode()?._id"
8603
8740
  [class]="options?.labelHtmlClass || ''"
@@ -8619,7 +8756,7 @@ class NumberComponent {
8619
8756
  [title]="lastValidNumber"
8620
8757
  [type]="layoutNode()?.type === 'range' ? 'range' : 'number'"
8621
8758
  [attributes]="inputAttributes"
8622
-
8759
+ [appStopPropagation]="['mousedown', 'touchstart']"
8623
8760
  >
8624
8761
  <input #inputControl *ngIf="!boundControl"
8625
8762
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
@@ -8639,9 +8776,10 @@ class NumberComponent {
8639
8776
  [value]="controlValue"
8640
8777
  (input)="updateValue($event)"
8641
8778
  [attributes]="inputAttributes"
8779
+ [appStopPropagation]="['mousedown', 'touchstart']"
8642
8780
  >
8643
8781
  <span *ngIf="layoutNode()?.type === 'range'" [innerHTML]="controlValue"></span>
8644
- </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"] }] }); }
8782
+ </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"] }, { kind: "directive", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: ["appStopPropagation"] }] }); }
8645
8783
  }
8646
8784
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NumberComponent, decorators: [{
8647
8785
  type: Component,
@@ -8649,7 +8787,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8649
8787
  // tslint:disable-next-line:component-selector
8650
8788
  selector: 'number-widget',
8651
8789
  template: `
8652
- <div #divElt [class]="options?.htmlClass || ''" class="sortable-filter" >
8790
+ <div #divElt [class]="options?.htmlClass || ''" >
8653
8791
  <label *ngIf="options?.title"
8654
8792
  [attr.for]="'control' + layoutNode()?._id"
8655
8793
  [class]="options?.labelHtmlClass || ''"
@@ -8671,7 +8809,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8671
8809
  [title]="lastValidNumber"
8672
8810
  [type]="layoutNode()?.type === 'range' ? 'range' : 'number'"
8673
8811
  [attributes]="inputAttributes"
8674
-
8812
+ [appStopPropagation]="['mousedown', 'touchstart']"
8675
8813
  >
8676
8814
  <input #inputControl *ngIf="!boundControl"
8677
8815
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
@@ -8691,6 +8829,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8691
8829
  [value]="controlValue"
8692
8830
  (input)="updateValue($event)"
8693
8831
  [attributes]="inputAttributes"
8832
+ [appStopPropagation]="['mousedown', 'touchstart']"
8694
8833
  >
8695
8834
  <span *ngIf="layoutNode()?.type === 'range'" [innerHTML]="controlValue"></span>
8696
8835
  </div>`,
@@ -8706,6 +8845,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8706
8845
  class SelectFrameworkComponent {
8707
8846
  constructor() {
8708
8847
  this.jsf = inject(JsonSchemaFormService);
8848
+ this.changeDetectorRef = inject(ChangeDetectorRef);
8709
8849
  this.newComponent = null;
8710
8850
  this.layoutNode = input(undefined);
8711
8851
  this.layoutIndex = input(undefined);
@@ -8715,7 +8855,7 @@ class SelectFrameworkComponent {
8715
8855
  ngOnInit() {
8716
8856
  this.updateComponent();
8717
8857
  }
8718
- ngOnChanges() {
8858
+ ngOnChanges(changes) {
8719
8859
  this.updateComponent();
8720
8860
  }
8721
8861
  updateComponent() {
@@ -8726,9 +8866,12 @@ class SelectFrameworkComponent {
8726
8866
  //this.widgetContainer.createComponent<any>(this.jsf.framework)
8727
8867
  }
8728
8868
  if (this.newComponent) {
8729
- for (const input of ['layoutNode', 'layoutIndex', 'dataIndex']) {
8730
- this.newComponent.instance[input] = this[input];
8869
+ for (const inp of ['layoutNode', 'layoutIndex', 'dataIndex']) {
8870
+ //this.newComponent.instance[inp] = this[inp];
8871
+ this.newComponent.setInput(inp, this[inp]());
8731
8872
  }
8873
+ // Manually trigger change detection after updating inputs
8874
+ //this.changeDetectorRef.detectChanges();
8732
8875
  }
8733
8876
  }
8734
8877
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: SelectFrameworkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
@@ -9150,132 +9293,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
9150
9293
  }]
9151
9294
  }] });
9152
9295
 
9153
- /**
9154
- * OrderableDirective
9155
- *
9156
- * Enables array elements to be reordered by dragging and dropping.
9157
- *
9158
- * Only works for arrays that have at least two elements.
9159
- *
9160
- * Also detects arrays-within-arrays, and correctly moves either
9161
- * the child array element or the parent array element,
9162
- * depending on the drop targert.
9163
- *
9164
- * Listeners for movable element being dragged:
9165
- * - dragstart: add 'dragging' class to element, set effectAllowed = 'move'
9166
- * - dragover: set dropEffect = 'move'
9167
- * - dragend: remove 'dragging' class from element
9168
- *
9169
- * Listeners for stationary items being dragged over:
9170
- * - dragenter: add 'drag-target-...' classes to element
9171
- * - dragleave: remove 'drag-target-...' classes from element
9172
- * - drop: remove 'drag-target-...' classes from element, move dropped array item
9173
- */
9174
- class OrderableDirective {
9175
- constructor() {
9176
- this.elementRef = inject(ElementRef);
9177
- this.jsf = inject(JsonSchemaFormService);
9178
- this.ngZone = inject(NgZone);
9179
- this.overParentElement = false;
9180
- this.overChildElement = false;
9181
- this.orderable = input(undefined);
9182
- this.layoutNode = input(undefined);
9183
- this.layoutIndex = input(undefined);
9184
- this.dataIndex = input(undefined);
9185
- }
9186
- ngOnInit() {
9187
- const layoutIndex = this.layoutIndex();
9188
- if (this.orderable() && this.layoutNode() && layoutIndex && this.dataIndex()) {
9189
- this.element = this.elementRef.nativeElement;
9190
- this.element.draggable = true;
9191
- this.arrayLayoutIndex = 'move:' + layoutIndex.slice(0, -1).toString();
9192
- this.ngZone.runOutsideAngular(() => {
9193
- // Listeners for movable element being dragged:
9194
- this.element.addEventListener('dragstart', (event) => {
9195
- event.dataTransfer.effectAllowed = 'move';
9196
- event.dataTransfer.setData('text', '');
9197
- // Hack to bypass stupid HTML drag-and-drop dataTransfer protection
9198
- // so drag source info will be available on dragenter
9199
- const sourceArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
9200
- sessionStorage.setItem(this.arrayLayoutIndex, sourceArrayIndex + '');
9201
- });
9202
- this.element.addEventListener('dragover', (event) => {
9203
- if (event.preventDefault) {
9204
- event.preventDefault();
9205
- }
9206
- event.dataTransfer.dropEffect = 'move';
9207
- return false;
9208
- });
9209
- // Listeners for stationary items being dragged over:
9210
- this.element.addEventListener('dragenter', (event) => {
9211
- // Part 1 of a hack, inspired by Dragster, to simulate mouseover and mouseout
9212
- // behavior while dragging items - http://bensmithett.github.io/dragster/
9213
- if (this.overParentElement) {
9214
- return this.overChildElement = true;
9215
- }
9216
- else {
9217
- this.overParentElement = true;
9218
- }
9219
- const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
9220
- if (sourceArrayIndex !== null) {
9221
- if (this.dataIndex()[this.dataIndex().length - 1] < +sourceArrayIndex) {
9222
- this.element.classList.add('drag-target-top');
9223
- }
9224
- else if (this.dataIndex()[this.dataIndex().length - 1] > +sourceArrayIndex) {
9225
- this.element.classList.add('drag-target-bottom');
9226
- }
9227
- }
9228
- });
9229
- this.element.addEventListener('dragleave', (event) => {
9230
- // Part 2 of the Dragster hack
9231
- if (this.overChildElement) {
9232
- this.overChildElement = false;
9233
- }
9234
- else if (this.overParentElement) {
9235
- this.overParentElement = false;
9236
- }
9237
- const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
9238
- if (!this.overParentElement && !this.overChildElement && sourceArrayIndex !== null) {
9239
- this.element.classList.remove('drag-target-top');
9240
- this.element.classList.remove('drag-target-bottom');
9241
- }
9242
- });
9243
- this.element.addEventListener('drop', (event) => {
9244
- this.element.classList.remove('drag-target-top');
9245
- this.element.classList.remove('drag-target-bottom');
9246
- // Confirm that drop target is another item in the same array as source item
9247
- const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
9248
- const destArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
9249
- if (sourceArrayIndex !== null && +sourceArrayIndex !== destArrayIndex) {
9250
- // Move array item
9251
- this.jsf.moveArrayItem(this, +sourceArrayIndex, destArrayIndex);
9252
- }
9253
- sessionStorage.removeItem(this.arrayLayoutIndex);
9254
- return false;
9255
- });
9256
- });
9257
- // Subscribe to the draggable state
9258
- this.draggableStateSubscription = this.jsf.draggableState$.subscribe((value) => {
9259
- this.element.draggable = value;
9260
- });
9261
- }
9262
- }
9263
- ngOnDestroy() {
9264
- if (this.draggableStateSubscription) {
9265
- this.draggableStateSubscription.unsubscribe();
9266
- }
9267
- }
9268
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OrderableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
9269
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: OrderableDirective, 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 }); }
9270
- }
9271
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OrderableDirective, decorators: [{
9272
- type: Directive,
9273
- args: [{
9274
- // tslint:disable-next-line:directive-selector
9275
- selector: '[orderable]',
9276
- }]
9277
- }] });
9278
-
9279
9296
  class RootComponent {
9280
9297
  constructor() {
9281
9298
  this.jsf = inject(JsonSchemaFormService);
@@ -9284,105 +9301,84 @@ class RootComponent {
9284
9301
  this.layout = input(undefined);
9285
9302
  this.isOrderable = input(undefined);
9286
9303
  this.isFlexItem = input(false);
9287
- this.sortableConfig = {
9288
- filter: ".sortable-filter", //needed to disable dragging on input range elements, class needs to be added to the element or its parent
9289
- preventOnFilter: false, //needed for input range elements slider do still work
9290
- delay: 1000,
9291
- delayOnTouchOnly: true,
9292
- onEnd: (/**Event*/ evt) => {
9293
- evt.newIndex; // most likely why this event is used is to get the dragging element's current index
9294
- // same properties as onEnd
9295
- //console.log(`sortablejs event:${evt}`);
9296
- let srcInd = evt.oldIndex;
9297
- let trgInd = evt.newIndex;
9298
- let layoutItem = this.layout()[trgInd];
9299
- let dataInd = layoutItem?.arrayItem ? (this.dataIndex() || []).concat(trgInd) : (this.dataIndex() || []);
9300
- let layoutInd = (this.layoutIndex() || []).concat(trgInd);
9301
- let itemCtx = {
9302
- dataIndex: () => { return dataInd; },
9303
- layoutIndex: () => { return layoutInd; },
9304
- layoutNode: () => { return layoutItem; },
9305
- };
9306
- //must set moveLayout to false as nxtSortable already moves it
9307
- this.jsf.moveArrayItem(itemCtx, evt.oldIndex, evt.newIndex, false);
9308
- },
9309
- onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
9310
- if (evt.related.classList.contains("sortable-fixed")) {
9311
- //console.log(evt.related);
9312
- return false;
9313
- }
9314
- }
9304
+ this.memoizationEnabled = input(true);
9305
+ /**
9306
+ * Predicate function that disallows '$ref' item sorts
9307
+ * NB declared as a var instead of a function
9308
+ * like sortPredicate(index: number, item: CdkDrag<number>){..}
9309
+ * since 'this' is bound to the draglist and doesn't reference the
9310
+ * FlexLayoutRootComponent instance
9311
+ */
9312
+ //TODO also need to think of other types such as button which can be
9313
+ //created by an arbitrary layout
9314
+ //might not be needed added condition to [cdkDragDisabled]
9315
+ this.sortPredicate = (index, item) => {
9316
+ let layoutItem = this.layout()[index];
9317
+ let result = this.isDraggable(layoutItem);
9318
+ //layoutItem.type != '$ref';
9319
+ return result;
9315
9320
  };
9316
- }
9317
- sortableInit(sortable) {
9318
- this.sortableObj = sortable;
9319
- //Sortable.utils.on(this.sortableObj.el,"nulling",(s)=>{console.log("event nulling sortablejs")})
9320
- ///NB issue caused by sortablejs when it its destroyed
9321
- //this mainly affects checkboxes coupled with conditions
9322
- //-the value is rechecked
9323
- //-see https://github.com/SortableJS/Sortable/issues/1052#issuecomment-369613072
9324
- /* attempt to monkey patch sortable js
9325
- const originalMethod = sortable._nulling;
9326
- let zone=this.zone;
9327
- sortable._nulling=function() {
9328
- console.log(`pluginEvent 2 ${pluginEvent}`)
9329
- zone.runOutsideAngular(() => {
9330
- console.log(`pluginEvent3 ${pluginEvent}`)
9331
- pluginEvent('nulling', this);
9332
-
9333
- rootEl =
9334
- dragEl =
9335
- parentEl =
9336
- ghostEl =
9337
- nextEl =
9338
- cloneEl =
9339
- lastDownEl =
9340
- cloneHidden =
9341
-
9342
- tapEvt =
9343
- touchEvt =
9321
+ //private selectframeworkInputCache = new Map<string, { dataIndex: any[], layoutIndex: any[], layoutNode: any }>();
9322
+ //TODO review caching-if form field values change, the changes are not propagated
9323
+ /*
9324
+ getSelectFrameworkInputs(layoutItem: any, i: number) {
9325
+ // Create a unique key based on the layoutItem and index
9326
+ const cacheKey = `${layoutItem._id}-${i}`;
9327
+
9328
+ // If the result is already in the cache, return it
9329
+ if(this.enableCaching){
9330
+ if (this.selectframeworkInputCache.has(cacheKey)) {
9331
+ return this.selectframeworkInputCache.get(cacheKey);
9332
+ }
9333
+ }
9344
9334
 
9345
- moved =
9346
- newIndex =
9347
- newDraggableIndex =
9348
- oldIndex =
9349
- oldDraggableIndex =
9350
9335
 
9351
- lastTarget =
9352
- lastDirection =
9336
+ // If not cached, calculate the values (assuming dataIndex() and layoutIndex() are functions)
9337
+ const dataIndex = layoutItem?.arrayItem ? (this.dataIndex() || []).concat(i) : (this.dataIndex() || []);
9338
+ const layoutIndex = (this.layoutIndex() || []).concat(i);
9353
9339
 
9354
- putSortable =
9355
- activeGroup =
9356
- Sortable.dragged =
9357
- Sortable.ghost =
9358
- Sortable.clone =
9359
- Sortable.active = null;
9340
+ // Save the result in the cache
9341
+ const result = { dataIndex, layoutIndex, layoutNode: layoutItem };
9342
+ if(this.enableCaching){
9343
+ this.selectframeworkInputCache.set(cacheKey, result);
9344
+ }
9360
9345
 
9361
-
9362
- let el = this.el;
9363
- savedInputChecked.forEach(function (checkEl) {
9364
- if (el.contains(checkEl)) {
9365
- checkEl.checked = true;
9366
- }
9367
- });
9368
-
9369
- savedInputChecked.length =
9370
- lastDx =
9371
- lastDy = 0;
9372
-
9373
- })
9374
-
9375
- }.bind(sortable)
9376
- */
9346
+ return result;
9347
+ }
9348
+ */
9349
+ this._getSelectFrameworkInputsRaw = (layoutItem, i) => {
9350
+ const dataIndexValue = this.dataIndex() || [];
9351
+ const layoutIndexValue = this.layoutIndex() || [];
9352
+ return {
9353
+ layoutNode: layoutItem,
9354
+ layoutIndex: [...layoutIndexValue, i],
9355
+ dataIndex: layoutItem?.arrayItem ? [...dataIndexValue, i] : dataIndexValue,
9356
+ };
9357
+ };
9358
+ // Define a separate function to hold the memoized version
9359
+ this._getSelectFrameworkInputsMemoized = memoize(this._getSelectFrameworkInputsRaw, (layoutItem, i) => {
9360
+ const layoutItemKey = layoutItem?.id ?? JSON.stringify(layoutItem);
9361
+ return `${layoutItemKey}-${i}`;
9362
+ });
9363
+ }
9364
+ drop(event) {
9365
+ // most likely why this event is used is to get the dragging element's current index
9366
+ let srcInd = event.previousIndex;
9367
+ let trgInd = event.currentIndex;
9368
+ let layoutItem = this.layout()[trgInd];
9369
+ let dataInd = layoutItem?.arrayItem ? (this.dataIndex() || []).concat(trgInd) : (this.dataIndex() || []);
9370
+ let layoutInd = (this.layoutIndex() || []).concat(trgInd);
9371
+ let itemCtx = {
9372
+ dataIndex: () => { return dataInd; },
9373
+ layoutIndex: () => { return layoutInd; },
9374
+ layoutNode: () => { return layoutItem; },
9375
+ };
9376
+ this.jsf.moveArrayItem(itemCtx, srcInd, trgInd, true);
9377
9377
  }
9378
9378
  isDraggable(node) {
9379
9379
  let result = node.arrayItem && node.type !== '$ref' &&
9380
- node.arrayItemType === 'list' && this.isOrderable() !== false;
9381
- if (this.sortableObj) {
9382
- //this.sortableObj.option("disabled",true);
9383
- //this.sortableObj.option("sort",false);
9384
- //this.sortableObj.option("disabled",!result);
9385
- }
9380
+ node.arrayItemType === 'list' && this.isOrderable() !== false
9381
+ && node.type !== 'submit';
9386
9382
  return result;
9387
9383
  }
9388
9384
  //TODO also need to think of other types such as button which can be
@@ -9398,93 +9394,157 @@ class RootComponent {
9398
9394
  return ((node.options || {}).flex || '').split(/\s+/)[index] ||
9399
9395
  (node.options || {})[attribute] || ['1', '1', 'auto'][index];
9400
9396
  }
9397
+ // This is the public function that the template calls
9398
+ getSelectFrameworkInputs(layoutItem, i) {
9399
+ if (this.memoizationEnabled) {
9400
+ return this._getSelectFrameworkInputsMemoized(layoutItem, i);
9401
+ }
9402
+ else {
9403
+ return this._getSelectFrameworkInputsRaw(layoutItem, i);
9404
+ }
9405
+ }
9406
+ trackByFn(index, item) {
9407
+ return item._id ?? index;
9408
+ }
9409
+ /*
9410
+ ngOnChanges(changes: SimpleChanges): void {
9411
+ // If any of the input properties change, clear the cache
9412
+ if (changes.dataIndex || changes.layoutIndex || changes.layout) {
9413
+ this.selectframeworkInputCache?.clear(); // Clear the entire cache
9414
+ }
9415
+ }
9416
+ */
9417
+ ngOnChanges(changes) {
9418
+ if (changes['layout'] || changes['dataIndex'] || changes['layoutIndex']) {
9419
+ // Clear the entire cache of the memoized function
9420
+ this._getSelectFrameworkInputsMemoized.cache.clear();
9421
+ }
9422
+ }
9401
9423
  showWidget(layoutNode) {
9402
9424
  return this.jsf.evaluateCondition(layoutNode, this.dataIndex());
9403
9425
  }
9404
9426
  ngOnInit() {
9405
- // Subscribe to the draggable state
9406
- this.sortableOptionsSubscription = this.jsf.sortableOptions$.subscribe((optsValue) => {
9407
- if (this.sortableObj) {
9408
- Object.keys(optsValue).forEach(opt => {
9409
- let optVal = optsValue[opt];
9410
- this.sortableObj.option(opt, optVal);
9411
- });
9412
- //this.sortableObj.option("disabled",true);
9413
- //this.sortableObj.option("sort",false);
9414
- }
9415
- });
9427
+ if (this.memoizationEnabled) {
9428
+ this.jsf.dataChanges.subscribe((val) => {
9429
+ //this.selectframeworkInputCache?.clear();
9430
+ this._getSelectFrameworkInputsMemoized.cache.clear();
9431
+ });
9432
+ }
9416
9433
  }
9417
9434
  ngOnDestroy() {
9418
- if (this.sortableOptionsSubscription) {
9419
- this.sortableOptionsSubscription.unsubscribe();
9420
- }
9435
+ //this.selectframeworkInputCache?.clear()
9436
+ //this.selectframeworkInputCache=null;
9437
+ this._getSelectFrameworkInputsMemoized.cache.clear();
9438
+ this.dataChangesSubs?.unsubscribe();
9421
9439
  }
9422
9440
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: RootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9423
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: RootComponent, 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: `
9424
- <div [class.flex-inherit]="true" #sortableContainter [nxtSortablejs]="layout()" [config]="sortableConfig" (init)="sortableInit($event)">
9425
- <div *ngFor="let layoutItem of layout(); let i = index"
9441
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: RootComponent, 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 }, memoizationEnabled: { classPropertyName: "memoizationEnabled", publicName: "memoizationEnabled", isSignal: true, isRequired: false, transformFunction: null } }, usesOnChanges: true, ngImport: i0, template: `
9442
+ <div cdkDropList (cdkDropListDropped)="drop($event)"
9443
+ [class.flex-inherit]="true"
9444
+ [cdkDropListSortPredicate]="sortPredicate"
9445
+ >
9446
+ <!-- -for now left out
9447
+ cdkDragHandle directive, by itself, does not disable the
9448
+ default drag behavior of its parent cdkDrag element.
9449
+ You must explicitly disable dragging on the main element
9450
+ and re-enable it only when using the handle.
9451
+ -->
9452
+ <div *ngFor="let layoutItem of layout(); let i = index;trackBy: trackByFn"
9453
+ cdkDrag [cdkDragStartDelay]="{touch:1000,mouse:0}"
9454
+ [cdkDragDisabled]="!isDraggable(layoutItem)"
9426
9455
  [class.form-flex-item]="isFlexItem()"
9427
9456
  [style.align-self]="(layoutItem.options || {})['align-self']"
9428
9457
  [style.flex-basis]="getFlexAttribute(layoutItem, 'flex-basis')"
9429
9458
  [style.flex-grow]="getFlexAttribute(layoutItem, 'flex-grow')"
9430
9459
  [style.flex-shrink]="getFlexAttribute(layoutItem, 'flex-shrink')"
9431
9460
  [style.order]="(layoutItem.options || {}).order"
9432
- [class.sortable-filter]="!isDraggable(layoutItem)"
9433
- [class.sortable-fixed]="isFixed(layoutItem)"
9434
9461
  >
9462
+
9463
+ <!-- workaround to disbale dragging of input fields -->
9464
+ <!--
9465
+ <div *ngIf="layoutItem?.dataType !='object'" cdkDragHandle>
9466
+ <p>Drag Handle {{layoutItem?.dataType}}</p>
9467
+ </div>
9468
+ -->
9435
9469
  <!--NB orderable directive is not used but has been left in for now and set to false
9436
9470
  otherwise the compiler won't recognize dataIndex and other dependent attributes
9437
9471
  -->
9472
+ <!--
9438
9473
  <div
9439
9474
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
9440
9475
  [layoutIndex]="(layoutIndex() || []).concat(i)"
9441
9476
  [layoutNode]="layoutItem"
9442
9477
  [orderable]="false"
9443
- [class.sortable-filter]="!isDraggable(layoutItem)"
9444
- [class.sortable-fixed]="isFixed(layoutItem)"
9445
9478
  >
9446
9479
  <select-framework-widget *ngIf="showWidget(layoutItem)"
9447
9480
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
9448
9481
  [layoutIndex]="(layoutIndex() || []).concat(i)"
9449
9482
  [layoutNode]="layoutItem"></select-framework-widget>
9450
9483
  </div>
9484
+ -->
9485
+ <select-framework-widget *ngIf="showWidget(layoutItem)"
9486
+ [dataIndex]="getSelectFrameworkInputs(layoutItem,i).dataIndex"
9487
+ [layoutIndex]="getSelectFrameworkInputs(layoutItem,i).layoutIndex"
9488
+ [layoutNode]="getSelectFrameworkInputs(layoutItem,i).layoutNode">
9489
+ </select-framework-widget>
9451
9490
  </div>
9452
9491
  </div>
9453
- `, 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"] }] }); }
9492
+ `, 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.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: SelectFrameworkComponent, selector: "select-framework-widget", inputs: ["layoutNode", "layoutIndex", "dataIndex"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9454
9493
  }
9455
9494
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: RootComponent, decorators: [{
9456
9495
  type: Component,
9457
9496
  args: [{ selector: 'root-widget', template: `
9458
- <div [class.flex-inherit]="true" #sortableContainter [nxtSortablejs]="layout()" [config]="sortableConfig" (init)="sortableInit($event)">
9459
- <div *ngFor="let layoutItem of layout(); let i = index"
9497
+ <div cdkDropList (cdkDropListDropped)="drop($event)"
9498
+ [class.flex-inherit]="true"
9499
+ [cdkDropListSortPredicate]="sortPredicate"
9500
+ >
9501
+ <!-- -for now left out
9502
+ cdkDragHandle directive, by itself, does not disable the
9503
+ default drag behavior of its parent cdkDrag element.
9504
+ You must explicitly disable dragging on the main element
9505
+ and re-enable it only when using the handle.
9506
+ -->
9507
+ <div *ngFor="let layoutItem of layout(); let i = index;trackBy: trackByFn"
9508
+ cdkDrag [cdkDragStartDelay]="{touch:1000,mouse:0}"
9509
+ [cdkDragDisabled]="!isDraggable(layoutItem)"
9460
9510
  [class.form-flex-item]="isFlexItem()"
9461
9511
  [style.align-self]="(layoutItem.options || {})['align-self']"
9462
9512
  [style.flex-basis]="getFlexAttribute(layoutItem, 'flex-basis')"
9463
9513
  [style.flex-grow]="getFlexAttribute(layoutItem, 'flex-grow')"
9464
9514
  [style.flex-shrink]="getFlexAttribute(layoutItem, 'flex-shrink')"
9465
9515
  [style.order]="(layoutItem.options || {}).order"
9466
- [class.sortable-filter]="!isDraggable(layoutItem)"
9467
- [class.sortable-fixed]="isFixed(layoutItem)"
9468
9516
  >
9517
+
9518
+ <!-- workaround to disbale dragging of input fields -->
9519
+ <!--
9520
+ <div *ngIf="layoutItem?.dataType !='object'" cdkDragHandle>
9521
+ <p>Drag Handle {{layoutItem?.dataType}}</p>
9522
+ </div>
9523
+ -->
9469
9524
  <!--NB orderable directive is not used but has been left in for now and set to false
9470
9525
  otherwise the compiler won't recognize dataIndex and other dependent attributes
9471
9526
  -->
9527
+ <!--
9472
9528
  <div
9473
9529
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
9474
9530
  [layoutIndex]="(layoutIndex() || []).concat(i)"
9475
9531
  [layoutNode]="layoutItem"
9476
9532
  [orderable]="false"
9477
- [class.sortable-filter]="!isDraggable(layoutItem)"
9478
- [class.sortable-fixed]="isFixed(layoutItem)"
9479
9533
  >
9480
9534
  <select-framework-widget *ngIf="showWidget(layoutItem)"
9481
9535
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
9482
9536
  [layoutIndex]="(layoutIndex() || []).concat(i)"
9483
9537
  [layoutNode]="layoutItem"></select-framework-widget>
9484
9538
  </div>
9539
+ -->
9540
+ <select-framework-widget *ngIf="showWidget(layoutItem)"
9541
+ [dataIndex]="getSelectFrameworkInputs(layoutItem,i).dataIndex"
9542
+ [layoutIndex]="getSelectFrameworkInputs(layoutItem,i).layoutIndex"
9543
+ [layoutNode]="getSelectFrameworkInputs(layoutItem,i).layoutNode">
9544
+ </select-framework-widget>
9485
9545
  </div>
9486
9546
  </div>
9487
- `, 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"] }]
9547
+ `, changeDetection: ChangeDetectionStrategy.OnPush, 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"] }]
9488
9548
  }] });
9489
9549
 
9490
9550
  class SectionComponent {
@@ -9610,7 +9670,7 @@ class SectionComponent {
9610
9670
  [class]="options?.labelHelpBlockClass || ''"
9611
9671
  [innerHTML]="options?.description"></p>
9612
9672
  </div>
9613
- </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"] }] }); }
9673
+ </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", "memoizationEnabled"] }] }); }
9614
9674
  }
9615
9675
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: SectionComponent, decorators: [{
9616
9676
  type: Component,
@@ -9954,8 +10014,10 @@ class SubmitComponent {
9954
10014
  [name]="controlName"
9955
10015
  [type]="layoutNode()?.type"
9956
10016
  [value]="controlValue"
9957
- (click)="updateValue($event)">
9958
- </div>`, isInline: true }); }
10017
+ (click)="updateValue($event)"
10018
+ [appStopPropagation]="['mousedown', 'touchstart']"
10019
+ >
10020
+ </div>`, isInline: true, dependencies: [{ kind: "directive", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: ["appStopPropagation"] }] }); }
9959
10021
  }
9960
10022
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: SubmitComponent, decorators: [{
9961
10023
  type: Component,
@@ -9975,7 +10037,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
9975
10037
  [name]="controlName"
9976
10038
  [type]="layoutNode()?.type"
9977
10039
  [value]="controlValue"
9978
- (click)="updateValue($event)">
10040
+ (click)="updateValue($event)"
10041
+ [appStopPropagation]="['mousedown', 'touchstart']"
10042
+ >
9979
10043
  </div>`,
9980
10044
  }]
9981
10045
  }] });
@@ -10683,7 +10747,7 @@ class TabComponent {
10683
10747
  [dataIndex]="dataIndex()"
10684
10748
  [layoutIndex]="layoutIndex()"
10685
10749
  [layout]="layoutNode().items"></root-widget>
10686
- </div>`, isInline: true, dependencies: [{ kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }] }); }
10750
+ </div>`, isInline: true, dependencies: [{ kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem", "memoizationEnabled"] }] }); }
10687
10751
  }
10688
10752
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TabComponent, decorators: [{
10689
10753
  type: Component,
@@ -10700,6 +10764,132 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
10700
10764
  }]
10701
10765
  }] });
10702
10766
 
10767
+ /**
10768
+ * OrderableDirective
10769
+ *
10770
+ * Enables array elements to be reordered by dragging and dropping.
10771
+ *
10772
+ * Only works for arrays that have at least two elements.
10773
+ *
10774
+ * Also detects arrays-within-arrays, and correctly moves either
10775
+ * the child array element or the parent array element,
10776
+ * depending on the drop targert.
10777
+ *
10778
+ * Listeners for movable element being dragged:
10779
+ * - dragstart: add 'dragging' class to element, set effectAllowed = 'move'
10780
+ * - dragover: set dropEffect = 'move'
10781
+ * - dragend: remove 'dragging' class from element
10782
+ *
10783
+ * Listeners for stationary items being dragged over:
10784
+ * - dragenter: add 'drag-target-...' classes to element
10785
+ * - dragleave: remove 'drag-target-...' classes from element
10786
+ * - drop: remove 'drag-target-...' classes from element, move dropped array item
10787
+ */
10788
+ class OrderableDirective {
10789
+ constructor() {
10790
+ this.elementRef = inject(ElementRef);
10791
+ this.jsf = inject(JsonSchemaFormService);
10792
+ this.ngZone = inject(NgZone);
10793
+ this.overParentElement = false;
10794
+ this.overChildElement = false;
10795
+ this.orderable = input(undefined);
10796
+ this.layoutNode = input(undefined);
10797
+ this.layoutIndex = input(undefined);
10798
+ this.dataIndex = input(undefined);
10799
+ }
10800
+ ngOnInit() {
10801
+ const layoutIndex = this.layoutIndex();
10802
+ if (this.orderable() && this.layoutNode() && layoutIndex && this.dataIndex()) {
10803
+ this.element = this.elementRef.nativeElement;
10804
+ this.element.draggable = true;
10805
+ this.arrayLayoutIndex = 'move:' + layoutIndex.slice(0, -1).toString();
10806
+ this.ngZone.runOutsideAngular(() => {
10807
+ // Listeners for movable element being dragged:
10808
+ this.element.addEventListener('dragstart', (event) => {
10809
+ event.dataTransfer.effectAllowed = 'move';
10810
+ event.dataTransfer.setData('text', '');
10811
+ // Hack to bypass stupid HTML drag-and-drop dataTransfer protection
10812
+ // so drag source info will be available on dragenter
10813
+ const sourceArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
10814
+ sessionStorage.setItem(this.arrayLayoutIndex, sourceArrayIndex + '');
10815
+ });
10816
+ this.element.addEventListener('dragover', (event) => {
10817
+ if (event.preventDefault) {
10818
+ event.preventDefault();
10819
+ }
10820
+ event.dataTransfer.dropEffect = 'move';
10821
+ return false;
10822
+ });
10823
+ // Listeners for stationary items being dragged over:
10824
+ this.element.addEventListener('dragenter', (event) => {
10825
+ // Part 1 of a hack, inspired by Dragster, to simulate mouseover and mouseout
10826
+ // behavior while dragging items - http://bensmithett.github.io/dragster/
10827
+ if (this.overParentElement) {
10828
+ return this.overChildElement = true;
10829
+ }
10830
+ else {
10831
+ this.overParentElement = true;
10832
+ }
10833
+ const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
10834
+ if (sourceArrayIndex !== null) {
10835
+ if (this.dataIndex()[this.dataIndex().length - 1] < +sourceArrayIndex) {
10836
+ this.element.classList.add('drag-target-top');
10837
+ }
10838
+ else if (this.dataIndex()[this.dataIndex().length - 1] > +sourceArrayIndex) {
10839
+ this.element.classList.add('drag-target-bottom');
10840
+ }
10841
+ }
10842
+ });
10843
+ this.element.addEventListener('dragleave', (event) => {
10844
+ // Part 2 of the Dragster hack
10845
+ if (this.overChildElement) {
10846
+ this.overChildElement = false;
10847
+ }
10848
+ else if (this.overParentElement) {
10849
+ this.overParentElement = false;
10850
+ }
10851
+ const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
10852
+ if (!this.overParentElement && !this.overChildElement && sourceArrayIndex !== null) {
10853
+ this.element.classList.remove('drag-target-top');
10854
+ this.element.classList.remove('drag-target-bottom');
10855
+ }
10856
+ });
10857
+ this.element.addEventListener('drop', (event) => {
10858
+ this.element.classList.remove('drag-target-top');
10859
+ this.element.classList.remove('drag-target-bottom');
10860
+ // Confirm that drop target is another item in the same array as source item
10861
+ const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
10862
+ const destArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
10863
+ if (sourceArrayIndex !== null && +sourceArrayIndex !== destArrayIndex) {
10864
+ // Move array item
10865
+ this.jsf.moveArrayItem(this, +sourceArrayIndex, destArrayIndex);
10866
+ }
10867
+ sessionStorage.removeItem(this.arrayLayoutIndex);
10868
+ return false;
10869
+ });
10870
+ });
10871
+ // Subscribe to the draggable state
10872
+ this.draggableStateSubscription = this.jsf.draggableState$.subscribe((value) => {
10873
+ this.element.draggable = value;
10874
+ });
10875
+ }
10876
+ }
10877
+ ngOnDestroy() {
10878
+ if (this.draggableStateSubscription) {
10879
+ this.draggableStateSubscription.unsubscribe();
10880
+ }
10881
+ }
10882
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OrderableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
10883
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: OrderableDirective, 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 }); }
10884
+ }
10885
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OrderableDirective, decorators: [{
10886
+ type: Directive,
10887
+ args: [{
10888
+ // tslint:disable-next-line:directive-selector
10889
+ selector: '[orderable]',
10890
+ }]
10891
+ }] });
10892
+
10703
10893
  const BASIC_WIDGETS = [
10704
10894
  AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent,
10705
10895
  CheckboxesComponent, FileComponent, HiddenComponent, InputComponent,
@@ -10711,39 +10901,16 @@ const BASIC_WIDGETS = [
10711
10901
 
10712
10902
  class WidgetLibraryModule {
10713
10903
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: WidgetLibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
10714
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", 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, SelectCheckboxComponent, 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, SelectCheckboxComponent, OrderableDirective, ElementAttributeDirective] }); }
10715
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: WidgetLibraryModule, imports: [CommonModule, FormsModule, ReactiveFormsModule,
10716
- SortablejsModule.forRoot({
10717
- //disabled:false,
10718
- //draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
10719
- filter: ".sortable-filter", //needed to disable dragging on input range elements, class needs to be added to the element or its parent
10720
- preventOnFilter: false, //needed for input range elements slider do still work
10721
- onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
10722
- if (evt.related.classList.contains("sortable-fixed")) {
10723
- //console.log(evt.related);
10724
- return false;
10725
- }
10726
- }
10727
- })] }); }
10904
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", 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, SelectCheckboxComponent, OrderableDirective, ElementAttributeDirective, StopPropagationDirective], imports: [CommonModule, FormsModule, ReactiveFormsModule, DragDropModule], exports: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, SelectCheckboxComponent, OrderableDirective, ElementAttributeDirective, StopPropagationDirective] }); }
10905
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: WidgetLibraryModule, imports: [CommonModule, FormsModule, ReactiveFormsModule, DragDropModule] }); }
10728
10906
  }
10729
10907
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: WidgetLibraryModule, decorators: [{
10730
10908
  type: NgModule,
10731
10909
  args: [{
10732
- imports: [CommonModule, FormsModule, ReactiveFormsModule,
10733
- SortablejsModule.forRoot({
10734
- //disabled:false,
10735
- //draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
10736
- filter: ".sortable-filter", //needed to disable dragging on input range elements, class needs to be added to the element or its parent
10737
- preventOnFilter: false, //needed for input range elements slider do still work
10738
- onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
10739
- if (evt.related.classList.contains("sortable-fixed")) {
10740
- //console.log(evt.related);
10741
- return false;
10742
- }
10743
- }
10744
- })],
10745
- declarations: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective],
10746
- exports: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective]
10910
+ imports: [CommonModule, FormsModule, ReactiveFormsModule, DragDropModule
10911
+ ],
10912
+ declarations: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective, StopPropagationDirective],
10913
+ exports: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective, StopPropagationDirective]
10747
10914
  }]
10748
10915
  }] });
10749
10916
 
@@ -11518,7 +11685,7 @@ class JsonSchemaFormComponent {
11518
11685
  }
11519
11686
  }
11520
11687
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: JsonSchemaFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
11521
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: JsonSchemaFormComponent, 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 }); }
11688
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: JsonSchemaFormComponent, 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", "memoizationEnabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
11522
11689
  }
11523
11690
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: JsonSchemaFormComponent, decorators: [{
11524
11691
  type: Component,
@@ -11554,5 +11721,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
11554
11721
  * Generated bundle index. Do not edit.
11555
11722
  */
11556
11723
 
11557
- 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, SelectCheckboxComponent, 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 };
11724
+ 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, SelectCheckboxComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, StopPropagationDirective, 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 };
11558
11725
  //# sourceMappingURL=ng-formworks-core.mjs.map