@ng-formworks/core 20.6.5 → 20.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.
@@ -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, Input, Directive, ChangeDetectionStrategy, ViewChild, signal, ElementRef, NgZone, Inject, NgModule, forwardRef, ChangeDetectorRef, output } from '@angular/core';
4
+ import { Injectable, inject, input, viewChild, ViewContainerRef, Component, Input, Directive, 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, pick, isObject as isObject$1, isEqual as isEqual$2 } from 'lodash';
13
+ import { some, isNil, isEmpty as isEmpty$1, pick, isObject as isObject$1, 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
  }
@@ -7931,6 +8013,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
7931
8013
  type: Input
7932
8014
  }] } });
7933
8015
 
8016
+ //TODO review:stopPropagation used as a workaround
8017
+ //to prevent dragging onMouseDown and onTouchStart events
8018
+ class StopPropagationDirective {
8019
+ constructor(el, renderer) {
8020
+ this.el = el;
8021
+ this.renderer = renderer;
8022
+ // The input property to receive an array of event names
8023
+ this.events = [];
8024
+ // An array to hold the unsubscribe functions for each event listener
8025
+ this.unsubscribeFunctions = [];
8026
+ }
8027
+ ngOnInit() {
8028
+ // If the input array is empty, default to 'mousedown'
8029
+ const eventsToListen = this.events.length > 0 ? this.events : ['mousedown'];
8030
+ // Loop through the array of event names and set up a listener for each
8031
+ eventsToListen.forEach(eventName => {
8032
+ const unsub = this.renderer.listen(this.el.nativeElement, eventName, (event) => {
8033
+ event.stopPropagation();
8034
+ });
8035
+ // Store the unsubscribe function to be called on destruction
8036
+ this.unsubscribeFunctions.push(unsub);
8037
+ });
8038
+ }
8039
+ ngOnDestroy() {
8040
+ // Call each stored unsubscribe function to clean up listeners
8041
+ this.unsubscribeFunctions.forEach(unsub => unsub());
8042
+ }
8043
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: StopPropagationDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive }); }
8044
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.6", type: StopPropagationDirective, isStandalone: false, selector: "[appStopPropagation]", inputs: { events: ["appStopPropagation", "events"] }, ngImport: i0 }); }
8045
+ }
8046
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: StopPropagationDirective, decorators: [{
8047
+ type: Directive,
8048
+ args: [{
8049
+ selector: '[appStopPropagation]', standalone: false
8050
+ }]
8051
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { events: [{
8052
+ type: Input,
8053
+ args: ['appStopPropagation']
8054
+ }] } });
8055
+
7934
8056
  class AddReferenceComponent {
7935
8057
  constructor() {
7936
8058
  this.jsf = inject(JsonSchemaFormService);
@@ -7962,13 +8084,16 @@ class AddReferenceComponent {
7962
8084
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.6", type: AddReferenceComponent, isStandalone: false, selector: "add-reference-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
7963
8085
  <section [class]="options?.htmlClass || ''" align="end">
7964
8086
  <button *ngIf="showAddButton"
7965
- [class]="options?.fieldHtmlClass || ''" class="sortable-filter sortable-fixed"
8087
+ [class]="options?.fieldHtmlClass || ''"
7966
8088
  [disabled]="options?.readonly"
7967
- (click)="addItem($event)">
8089
+ (click)="addItem($event)"
8090
+ [appStopPropagation]="['mousedown', 'touchstart']"
8091
+ >
7968
8092
  <span *ngIf="options?.icon" [class]="options?.icon"></span>
7969
8093
  <span *ngIf="options?.title" [innerHTML]="buttonText"></span>
8094
+
7970
8095
  </button>
7971
- </section>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
8096
+ </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 }); }
7972
8097
  }
7973
8098
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: AddReferenceComponent, decorators: [{
7974
8099
  type: Component,
@@ -7978,11 +8103,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
7978
8103
  template: `
7979
8104
  <section [class]="options?.htmlClass || ''" align="end">
7980
8105
  <button *ngIf="showAddButton"
7981
- [class]="options?.fieldHtmlClass || ''" class="sortable-filter sortable-fixed"
8106
+ [class]="options?.fieldHtmlClass || ''"
7982
8107
  [disabled]="options?.readonly"
7983
- (click)="addItem($event)">
8108
+ (click)="addItem($event)"
8109
+ [appStopPropagation]="['mousedown', 'touchstart']"
8110
+ >
7984
8111
  <span *ngIf="options?.icon" [class]="options?.icon"></span>
7985
8112
  <span *ngIf="options?.title" [innerHTML]="buttonText"></span>
8113
+
7986
8114
  </button>
7987
8115
  </section>`,
7988
8116
  changeDetection: ChangeDetectionStrategy.Default,
@@ -8026,12 +8154,14 @@ class ButtonComponent {
8026
8154
  [name]="controlName"
8027
8155
  [type]="layoutNode()?.type"
8028
8156
  [value]="controlValue"
8029
- (click)="updateValue($event)">
8157
+ (click)="updateValue($event)"
8158
+ [appStopPropagation]="['mousedown', 'touchstart']"
8159
+ >
8030
8160
  <span *ngIf="options?.icon || options?.title"
8031
8161
  [class]="options?.icon"
8032
8162
  [innerHTML]="options?.title"></span>
8033
8163
  </button>
8034
- </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
8164
+ </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: ["appStopPropagation"] }] }); }
8035
8165
  }
8036
8166
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ButtonComponent, decorators: [{
8037
8167
  type: Component,
@@ -8049,7 +8179,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
8049
8179
  [name]="controlName"
8050
8180
  [type]="layoutNode()?.type"
8051
8181
  [value]="controlValue"
8052
- (click)="updateValue($event)">
8182
+ (click)="updateValue($event)"
8183
+ [appStopPropagation]="['mousedown', 'touchstart']"
8184
+ >
8053
8185
  <span *ngIf="options?.icon || options?.title"
8054
8186
  [class]="options?.icon"
8055
8187
  [innerHTML]="options?.title"></span>
@@ -8063,6 +8195,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
8063
8195
  //this mainly affects checkboxes coupled with conditions
8064
8196
  //-the value is rechecked
8065
8197
  //-see https://github.com/SortableJS/Sortable/issues/1052#issuecomment-369613072
8198
+ //-switched to angular cdk for dnd
8066
8199
  class CheckboxComponent {
8067
8200
  constructor() {
8068
8201
  this.jsf = inject(JsonSchemaFormService);
@@ -8422,7 +8555,7 @@ class InputComponent {
8422
8555
  }
8423
8556
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: InputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8424
8557
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.6", type: InputComponent, isStandalone: false, selector: "input-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
8425
- <div [class]="options?.htmlClass || ''" class="sortable-filter" >
8558
+ <div [class]="options?.htmlClass || ''" >
8426
8559
  <label *ngIf="options?.title"
8427
8560
  [attr.for]="'control' + layoutNode()?._id"
8428
8561
  [class]="options?.labelHtmlClass || ''"
@@ -8443,6 +8576,7 @@ class InputComponent {
8443
8576
  [readonly]="options?.readonly ? 'readonly' : null"
8444
8577
  [type]="layoutNode()?.type"
8445
8578
  [attributes]="inputAttributes"
8579
+ [appStopPropagation]="['mousedown', 'touchstart']"
8446
8580
  >
8447
8581
  <input *ngIf="!boundControl"
8448
8582
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
@@ -8461,12 +8595,13 @@ class InputComponent {
8461
8595
  [value]="controlValue"
8462
8596
  (input)="updateValue($event)"
8463
8597
  [attributes]="inputAttributes"
8598
+ [appStopPropagation]="['mousedown', 'touchstart']"
8464
8599
  >
8465
8600
  <datalist *ngIf="options?.typeahead?.source"
8466
8601
  [id]="'control' + layoutNode()?._id + 'Autocomplete'">
8467
8602
  <option *ngFor="let word of options?.typeahead?.source" [value]="word">
8468
8603
  </datalist>
8469
- </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"] }] }); }
8604
+ </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"] }] }); }
8470
8605
  }
8471
8606
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: InputComponent, decorators: [{
8472
8607
  type: Component,
@@ -8474,7 +8609,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
8474
8609
  // tslint:disable-next-line:component-selector
8475
8610
  selector: 'input-widget',
8476
8611
  template: `
8477
- <div [class]="options?.htmlClass || ''" class="sortable-filter" >
8612
+ <div [class]="options?.htmlClass || ''" >
8478
8613
  <label *ngIf="options?.title"
8479
8614
  [attr.for]="'control' + layoutNode()?._id"
8480
8615
  [class]="options?.labelHtmlClass || ''"
@@ -8495,6 +8630,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
8495
8630
  [readonly]="options?.readonly ? 'readonly' : null"
8496
8631
  [type]="layoutNode()?.type"
8497
8632
  [attributes]="inputAttributes"
8633
+ [appStopPropagation]="['mousedown', 'touchstart']"
8498
8634
  >
8499
8635
  <input *ngIf="!boundControl"
8500
8636
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
@@ -8513,6 +8649,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
8513
8649
  [value]="controlValue"
8514
8650
  (input)="updateValue($event)"
8515
8651
  [attributes]="inputAttributes"
8652
+ [appStopPropagation]="['mousedown', 'touchstart']"
8516
8653
  >
8517
8654
  <datalist *ngIf="options?.typeahead?.source"
8518
8655
  [id]="'control' + layoutNode()?._id + 'Autocomplete'">
@@ -8607,7 +8744,7 @@ class NumberComponent {
8607
8744
  }
8608
8745
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: NumberComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8609
8746
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.6", type: NumberComponent, isStandalone: false, selector: "number-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "inputControl", first: true, predicate: ["inputControl"], descendants: true }, { propertyName: "div", first: true, predicate: ["divElt"], descendants: true }], ngImport: i0, template: `
8610
- <div #divElt [class]="options?.htmlClass || ''" class="sortable-filter" >
8747
+ <div #divElt [class]="options?.htmlClass || ''" >
8611
8748
  <label *ngIf="options?.title"
8612
8749
  [attr.for]="'control' + layoutNode()?._id"
8613
8750
  [class]="options?.labelHtmlClass || ''"
@@ -8629,7 +8766,7 @@ class NumberComponent {
8629
8766
  [title]="lastValidNumber"
8630
8767
  [type]="layoutNode()?.type === 'range' ? 'range' : 'number'"
8631
8768
  [attributes]="inputAttributes"
8632
-
8769
+ [appStopPropagation]="['mousedown', 'touchstart']"
8633
8770
  >
8634
8771
  <input #inputControl *ngIf="!boundControl"
8635
8772
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
@@ -8649,9 +8786,10 @@ class NumberComponent {
8649
8786
  [value]="controlValue"
8650
8787
  (input)="updateValue($event)"
8651
8788
  [attributes]="inputAttributes"
8789
+ [appStopPropagation]="['mousedown', 'touchstart']"
8652
8790
  >
8653
8791
  <span *ngIf="layoutNode()?.type === 'range'" [innerHTML]="controlValue"></span>
8654
- </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"] }] }); }
8792
+ </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"] }] }); }
8655
8793
  }
8656
8794
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: NumberComponent, decorators: [{
8657
8795
  type: Component,
@@ -8659,7 +8797,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
8659
8797
  // tslint:disable-next-line:component-selector
8660
8798
  selector: 'number-widget',
8661
8799
  template: `
8662
- <div #divElt [class]="options?.htmlClass || ''" class="sortable-filter" >
8800
+ <div #divElt [class]="options?.htmlClass || ''" >
8663
8801
  <label *ngIf="options?.title"
8664
8802
  [attr.for]="'control' + layoutNode()?._id"
8665
8803
  [class]="options?.labelHtmlClass || ''"
@@ -8681,7 +8819,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
8681
8819
  [title]="lastValidNumber"
8682
8820
  [type]="layoutNode()?.type === 'range' ? 'range' : 'number'"
8683
8821
  [attributes]="inputAttributes"
8684
-
8822
+ [appStopPropagation]="['mousedown', 'touchstart']"
8685
8823
  >
8686
8824
  <input #inputControl *ngIf="!boundControl"
8687
8825
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
@@ -8701,6 +8839,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
8701
8839
  [value]="controlValue"
8702
8840
  (input)="updateValue($event)"
8703
8841
  [attributes]="inputAttributes"
8842
+ [appStopPropagation]="['mousedown', 'touchstart']"
8704
8843
  >
8705
8844
  <span *ngIf="layoutNode()?.type === 'range'" [innerHTML]="controlValue"></span>
8706
8845
  </div>`,
@@ -8717,6 +8856,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
8717
8856
  class SelectFrameworkComponent {
8718
8857
  constructor() {
8719
8858
  this.jsf = inject(JsonSchemaFormService);
8859
+ this.changeDetectorRef = inject(ChangeDetectorRef);
8720
8860
  this.newComponent = null;
8721
8861
  this.layoutNode = input(undefined, ...(ngDevMode ? [{ debugName: "layoutNode" }] : []));
8722
8862
  this.layoutIndex = input(undefined, ...(ngDevMode ? [{ debugName: "layoutIndex" }] : []));
@@ -8726,7 +8866,7 @@ class SelectFrameworkComponent {
8726
8866
  ngOnInit() {
8727
8867
  this.updateComponent();
8728
8868
  }
8729
- ngOnChanges() {
8869
+ ngOnChanges(changes) {
8730
8870
  this.updateComponent();
8731
8871
  }
8732
8872
  updateComponent() {
@@ -8737,9 +8877,12 @@ class SelectFrameworkComponent {
8737
8877
  //this.widgetContainer.createComponent<any>(this.jsf.framework)
8738
8878
  }
8739
8879
  if (this.newComponent) {
8740
- for (const input of ['layoutNode', 'layoutIndex', 'dataIndex']) {
8741
- this.newComponent.instance[input] = this[input];
8880
+ for (const inp of ['layoutNode', 'layoutIndex', 'dataIndex']) {
8881
+ //this.newComponent.instance[inp] = this[inp];
8882
+ this.newComponent.setInput(inp, this[inp]());
8742
8883
  }
8884
+ // Manually trigger change detection after updating inputs
8885
+ //this.changeDetectorRef.detectChanges();
8743
8886
  }
8744
8887
  }
8745
8888
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: SelectFrameworkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
@@ -9163,133 +9306,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
9163
9306
  }]
9164
9307
  }] });
9165
9308
 
9166
- /**
9167
- * OrderableDirective
9168
- *
9169
- * Enables array elements to be reordered by dragging and dropping.
9170
- *
9171
- * Only works for arrays that have at least two elements.
9172
- *
9173
- * Also detects arrays-within-arrays, and correctly moves either
9174
- * the child array element or the parent array element,
9175
- * depending on the drop targert.
9176
- *
9177
- * Listeners for movable element being dragged:
9178
- * - dragstart: add 'dragging' class to element, set effectAllowed = 'move'
9179
- * - dragover: set dropEffect = 'move'
9180
- * - dragend: remove 'dragging' class from element
9181
- *
9182
- * Listeners for stationary items being dragged over:
9183
- * - dragenter: add 'drag-target-...' classes to element
9184
- * - dragleave: remove 'drag-target-...' classes from element
9185
- * - drop: remove 'drag-target-...' classes from element, move dropped array item
9186
- */
9187
- class OrderableDirective {
9188
- constructor() {
9189
- this.elementRef = inject(ElementRef);
9190
- this.jsf = inject(JsonSchemaFormService);
9191
- this.ngZone = inject(NgZone);
9192
- this.overParentElement = false;
9193
- this.overChildElement = false;
9194
- this.orderable = input(undefined, ...(ngDevMode ? [{ debugName: "orderable" }] : []));
9195
- this.layoutNode = input(undefined, ...(ngDevMode ? [{ debugName: "layoutNode" }] : []));
9196
- this.layoutIndex = input(undefined, ...(ngDevMode ? [{ debugName: "layoutIndex" }] : []));
9197
- this.dataIndex = input(undefined, ...(ngDevMode ? [{ debugName: "dataIndex" }] : []));
9198
- }
9199
- ngOnInit() {
9200
- const layoutIndex = this.layoutIndex();
9201
- if (this.orderable() && this.layoutNode() && layoutIndex && this.dataIndex()) {
9202
- this.element = this.elementRef.nativeElement;
9203
- this.element.draggable = true;
9204
- this.arrayLayoutIndex = 'move:' + layoutIndex.slice(0, -1).toString();
9205
- this.ngZone.runOutsideAngular(() => {
9206
- // Listeners for movable element being dragged:
9207
- this.element.addEventListener('dragstart', (event) => {
9208
- event.dataTransfer.effectAllowed = 'move';
9209
- event.dataTransfer.setData('text', '');
9210
- // Hack to bypass stupid HTML drag-and-drop dataTransfer protection
9211
- // so drag source info will be available on dragenter
9212
- const sourceArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
9213
- sessionStorage.setItem(this.arrayLayoutIndex, sourceArrayIndex + '');
9214
- });
9215
- this.element.addEventListener('dragover', (event) => {
9216
- if (event.preventDefault) {
9217
- event.preventDefault();
9218
- }
9219
- event.dataTransfer.dropEffect = 'move';
9220
- return false;
9221
- });
9222
- // Listeners for stationary items being dragged over:
9223
- this.element.addEventListener('dragenter', (event) => {
9224
- // Part 1 of a hack, inspired by Dragster, to simulate mouseover and mouseout
9225
- // behavior while dragging items - http://bensmithett.github.io/dragster/
9226
- if (this.overParentElement) {
9227
- return this.overChildElement = true;
9228
- }
9229
- else {
9230
- this.overParentElement = true;
9231
- }
9232
- const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
9233
- if (sourceArrayIndex !== null) {
9234
- if (this.dataIndex()[this.dataIndex().length - 1] < +sourceArrayIndex) {
9235
- this.element.classList.add('drag-target-top');
9236
- }
9237
- else if (this.dataIndex()[this.dataIndex().length - 1] > +sourceArrayIndex) {
9238
- this.element.classList.add('drag-target-bottom');
9239
- }
9240
- }
9241
- });
9242
- this.element.addEventListener('dragleave', (event) => {
9243
- // Part 2 of the Dragster hack
9244
- if (this.overChildElement) {
9245
- this.overChildElement = false;
9246
- }
9247
- else if (this.overParentElement) {
9248
- this.overParentElement = false;
9249
- }
9250
- const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
9251
- if (!this.overParentElement && !this.overChildElement && sourceArrayIndex !== null) {
9252
- this.element.classList.remove('drag-target-top');
9253
- this.element.classList.remove('drag-target-bottom');
9254
- }
9255
- });
9256
- this.element.addEventListener('drop', (event) => {
9257
- this.element.classList.remove('drag-target-top');
9258
- this.element.classList.remove('drag-target-bottom');
9259
- // Confirm that drop target is another item in the same array as source item
9260
- const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
9261
- const destArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
9262
- if (sourceArrayIndex !== null && +sourceArrayIndex !== destArrayIndex) {
9263
- // Move array item
9264
- this.jsf.moveArrayItem(this, +sourceArrayIndex, destArrayIndex);
9265
- }
9266
- sessionStorage.removeItem(this.arrayLayoutIndex);
9267
- return false;
9268
- });
9269
- });
9270
- // Subscribe to the draggable state
9271
- this.draggableStateSubscription = this.jsf.draggableState$.subscribe((value) => {
9272
- this.element.draggable = value;
9273
- });
9274
- }
9275
- }
9276
- ngOnDestroy() {
9277
- if (this.draggableStateSubscription) {
9278
- this.draggableStateSubscription.unsubscribe();
9279
- }
9280
- }
9281
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: OrderableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
9282
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.1.6", type: OrderableDirective, isStandalone: false, selector: "[orderable]", inputs: { orderable: { classPropertyName: "orderable", publicName: "orderable", isSignal: true, isRequired: false, transformFunction: null }, layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
9283
- }
9284
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: OrderableDirective, decorators: [{
9285
- type: Directive,
9286
- args: [{
9287
- // tslint:disable-next-line:directive-selector
9288
- selector: '[orderable]',
9289
- standalone: false
9290
- }]
9291
- }] });
9292
-
9293
9309
  class RootComponent {
9294
9310
  constructor() {
9295
9311
  this.jsf = inject(JsonSchemaFormService);
@@ -9298,105 +9314,84 @@ class RootComponent {
9298
9314
  this.layout = input(undefined, ...(ngDevMode ? [{ debugName: "layout" }] : []));
9299
9315
  this.isOrderable = input(undefined, ...(ngDevMode ? [{ debugName: "isOrderable" }] : []));
9300
9316
  this.isFlexItem = input(false, ...(ngDevMode ? [{ debugName: "isFlexItem" }] : []));
9301
- this.sortableConfig = {
9302
- filter: ".sortable-filter", //needed to disable dragging on input range elements, class needs to be added to the element or its parent
9303
- preventOnFilter: false, //needed for input range elements slider do still work
9304
- delay: 1000,
9305
- delayOnTouchOnly: true,
9306
- onEnd: (/**Event*/ evt) => {
9307
- evt.newIndex; // most likely why this event is used is to get the dragging element's current index
9308
- // same properties as onEnd
9309
- //console.log(`sortablejs event:${evt}`);
9310
- let srcInd = evt.oldIndex;
9311
- let trgInd = evt.newIndex;
9312
- let layoutItem = this.layout()[trgInd];
9313
- let dataInd = layoutItem?.arrayItem ? (this.dataIndex() || []).concat(trgInd) : (this.dataIndex() || []);
9314
- let layoutInd = (this.layoutIndex() || []).concat(trgInd);
9315
- let itemCtx = {
9316
- dataIndex: () => { return dataInd; },
9317
- layoutIndex: () => { return layoutInd; },
9318
- layoutNode: () => { return layoutItem; },
9319
- };
9320
- //must set moveLayout to false as nxtSortable already moves it
9321
- this.jsf.moveArrayItem(itemCtx, evt.oldIndex, evt.newIndex, false);
9322
- },
9323
- onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
9324
- if (evt.related.classList.contains("sortable-fixed")) {
9325
- //console.log(evt.related);
9326
- return false;
9327
- }
9328
- }
9317
+ this.memoizationEnabled = input(true, ...(ngDevMode ? [{ debugName: "memoizationEnabled" }] : []));
9318
+ /**
9319
+ * Predicate function that disallows '$ref' item sorts
9320
+ * NB declared as a var instead of a function
9321
+ * like sortPredicate(index: number, item: CdkDrag<number>){..}
9322
+ * since 'this' is bound to the draglist and doesn't reference the
9323
+ * FlexLayoutRootComponent instance
9324
+ */
9325
+ //TODO also need to think of other types such as button which can be
9326
+ //created by an arbitrary layout
9327
+ //might not be needed added condition to [cdkDragDisabled]
9328
+ this.sortPredicate = (index, item) => {
9329
+ let layoutItem = this.layout()[index];
9330
+ let result = this.isDraggable(layoutItem);
9331
+ //layoutItem.type != '$ref';
9332
+ return result;
9329
9333
  };
9330
- }
9331
- sortableInit(sortable) {
9332
- this.sortableObj = sortable;
9333
- //Sortable.utils.on(this.sortableObj.el,"nulling",(s)=>{console.log("event nulling sortablejs")})
9334
- ///NB issue caused by sortablejs when it its destroyed
9335
- //this mainly affects checkboxes coupled with conditions
9336
- //-the value is rechecked
9337
- //-see https://github.com/SortableJS/Sortable/issues/1052#issuecomment-369613072
9338
- /* attempt to monkey patch sortable js
9339
- const originalMethod = sortable._nulling;
9340
- let zone=this.zone;
9341
- sortable._nulling=function() {
9342
- console.log(`pluginEvent 2 ${pluginEvent}`)
9343
- zone.runOutsideAngular(() => {
9344
- console.log(`pluginEvent3 ${pluginEvent}`)
9345
- pluginEvent('nulling', this);
9346
-
9347
- rootEl =
9348
- dragEl =
9349
- parentEl =
9350
- ghostEl =
9351
- nextEl =
9352
- cloneEl =
9353
- lastDownEl =
9354
- cloneHidden =
9355
-
9356
- tapEvt =
9357
- touchEvt =
9334
+ //private selectframeworkInputCache = new Map<string, { dataIndex: any[], layoutIndex: any[], layoutNode: any }>();
9335
+ //TODO review caching-if form field values change, the changes are not propagated
9336
+ /*
9337
+ getSelectFrameworkInputs(layoutItem: any, i: number) {
9338
+ // Create a unique key based on the layoutItem and index
9339
+ const cacheKey = `${layoutItem._id}-${i}`;
9340
+
9341
+ // If the result is already in the cache, return it
9342
+ if(this.enableCaching){
9343
+ if (this.selectframeworkInputCache.has(cacheKey)) {
9344
+ return this.selectframeworkInputCache.get(cacheKey);
9345
+ }
9346
+ }
9358
9347
 
9359
- moved =
9360
- newIndex =
9361
- newDraggableIndex =
9362
- oldIndex =
9363
- oldDraggableIndex =
9364
9348
 
9365
- lastTarget =
9366
- lastDirection =
9349
+ // If not cached, calculate the values (assuming dataIndex() and layoutIndex() are functions)
9350
+ const dataIndex = layoutItem?.arrayItem ? (this.dataIndex() || []).concat(i) : (this.dataIndex() || []);
9351
+ const layoutIndex = (this.layoutIndex() || []).concat(i);
9367
9352
 
9368
- putSortable =
9369
- activeGroup =
9370
- Sortable.dragged =
9371
- Sortable.ghost =
9372
- Sortable.clone =
9373
- Sortable.active = null;
9353
+ // Save the result in the cache
9354
+ const result = { dataIndex, layoutIndex, layoutNode: layoutItem };
9355
+ if(this.enableCaching){
9356
+ this.selectframeworkInputCache.set(cacheKey, result);
9357
+ }
9374
9358
 
9375
-
9376
- let el = this.el;
9377
- savedInputChecked.forEach(function (checkEl) {
9378
- if (el.contains(checkEl)) {
9379
- checkEl.checked = true;
9380
- }
9381
- });
9382
-
9383
- savedInputChecked.length =
9384
- lastDx =
9385
- lastDy = 0;
9386
-
9387
- })
9388
-
9389
- }.bind(sortable)
9390
- */
9359
+ return result;
9360
+ }
9361
+ */
9362
+ this._getSelectFrameworkInputsRaw = (layoutItem, i) => {
9363
+ const dataIndexValue = this.dataIndex() || [];
9364
+ const layoutIndexValue = this.layoutIndex() || [];
9365
+ return {
9366
+ layoutNode: layoutItem,
9367
+ layoutIndex: [...layoutIndexValue, i],
9368
+ dataIndex: layoutItem?.arrayItem ? [...dataIndexValue, i] : dataIndexValue,
9369
+ };
9370
+ };
9371
+ // Define a separate function to hold the memoized version
9372
+ this._getSelectFrameworkInputsMemoized = memoize(this._getSelectFrameworkInputsRaw, (layoutItem, i) => {
9373
+ const layoutItemKey = layoutItem?.id ?? JSON.stringify(layoutItem);
9374
+ return `${layoutItemKey}-${i}`;
9375
+ });
9376
+ }
9377
+ drop(event) {
9378
+ // most likely why this event is used is to get the dragging element's current index
9379
+ let srcInd = event.previousIndex;
9380
+ let trgInd = event.currentIndex;
9381
+ let layoutItem = this.layout()[trgInd];
9382
+ let dataInd = layoutItem?.arrayItem ? (this.dataIndex() || []).concat(trgInd) : (this.dataIndex() || []);
9383
+ let layoutInd = (this.layoutIndex() || []).concat(trgInd);
9384
+ let itemCtx = {
9385
+ dataIndex: () => { return dataInd; },
9386
+ layoutIndex: () => { return layoutInd; },
9387
+ layoutNode: () => { return layoutItem; },
9388
+ };
9389
+ this.jsf.moveArrayItem(itemCtx, srcInd, trgInd, true);
9391
9390
  }
9392
9391
  isDraggable(node) {
9393
9392
  let result = node.arrayItem && node.type !== '$ref' &&
9394
- node.arrayItemType === 'list' && this.isOrderable() !== false;
9395
- if (this.sortableObj) {
9396
- //this.sortableObj.option("disabled",true);
9397
- //this.sortableObj.option("sort",false);
9398
- //this.sortableObj.option("disabled",!result);
9399
- }
9393
+ node.arrayItemType === 'list' && this.isOrderable() !== false
9394
+ && node.type !== 'submit';
9400
9395
  return result;
9401
9396
  }
9402
9397
  //TODO also need to think of other types such as button which can be
@@ -9412,93 +9407,157 @@ class RootComponent {
9412
9407
  return ((node.options || {}).flex || '').split(/\s+/)[index] ||
9413
9408
  (node.options || {})[attribute] || ['1', '1', 'auto'][index];
9414
9409
  }
9410
+ // This is the public function that the template calls
9411
+ getSelectFrameworkInputs(layoutItem, i) {
9412
+ if (this.memoizationEnabled) {
9413
+ return this._getSelectFrameworkInputsMemoized(layoutItem, i);
9414
+ }
9415
+ else {
9416
+ return this._getSelectFrameworkInputsRaw(layoutItem, i);
9417
+ }
9418
+ }
9419
+ trackByFn(index, item) {
9420
+ return item._id ?? index;
9421
+ }
9422
+ /*
9423
+ ngOnChanges(changes: SimpleChanges): void {
9424
+ // If any of the input properties change, clear the cache
9425
+ if (changes.dataIndex || changes.layoutIndex || changes.layout) {
9426
+ this.selectframeworkInputCache?.clear(); // Clear the entire cache
9427
+ }
9428
+ }
9429
+ */
9430
+ ngOnChanges(changes) {
9431
+ if (changes['layout'] || changes['dataIndex'] || changes['layoutIndex']) {
9432
+ // Clear the entire cache of the memoized function
9433
+ this._getSelectFrameworkInputsMemoized.cache.clear();
9434
+ }
9435
+ }
9415
9436
  showWidget(layoutNode) {
9416
9437
  return this.jsf.evaluateCondition(layoutNode, this.dataIndex());
9417
9438
  }
9418
9439
  ngOnInit() {
9419
- // Subscribe to the draggable state
9420
- this.sortableOptionsSubscription = this.jsf.sortableOptions$.subscribe((optsValue) => {
9421
- if (this.sortableObj) {
9422
- Object.keys(optsValue).forEach(opt => {
9423
- let optVal = optsValue[opt];
9424
- this.sortableObj.option(opt, optVal);
9425
- });
9426
- //this.sortableObj.option("disabled",true);
9427
- //this.sortableObj.option("sort",false);
9428
- }
9429
- });
9440
+ if (this.memoizationEnabled) {
9441
+ this.jsf.dataChanges.subscribe((val) => {
9442
+ //this.selectframeworkInputCache?.clear();
9443
+ this._getSelectFrameworkInputsMemoized.cache.clear();
9444
+ });
9445
+ }
9430
9446
  }
9431
9447
  ngOnDestroy() {
9432
- if (this.sortableOptionsSubscription) {
9433
- this.sortableOptionsSubscription.unsubscribe();
9434
- }
9448
+ //this.selectframeworkInputCache?.clear()
9449
+ //this.selectframeworkInputCache=null;
9450
+ this._getSelectFrameworkInputsMemoized.cache.clear();
9451
+ this.dataChangesSubs?.unsubscribe();
9435
9452
  }
9436
9453
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: RootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9437
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.6", type: RootComponent, isStandalone: false, selector: "root-widget", inputs: { dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, isOrderable: { classPropertyName: "isOrderable", publicName: "isOrderable", isSignal: true, isRequired: false, transformFunction: null }, isFlexItem: { classPropertyName: "isFlexItem", publicName: "isFlexItem", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
9438
- <div [class.flex-inherit]="true" #sortableContainter [nxtSortablejs]="layout()" [config]="sortableConfig" (init)="sortableInit($event)">
9439
- <div *ngFor="let layoutItem of layout(); let i = index"
9454
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.6", type: RootComponent, isStandalone: false, selector: "root-widget", inputs: { dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, isOrderable: { classPropertyName: "isOrderable", publicName: "isOrderable", isSignal: true, isRequired: false, transformFunction: null }, isFlexItem: { classPropertyName: "isFlexItem", publicName: "isFlexItem", isSignal: true, isRequired: false, transformFunction: null }, memoizationEnabled: { classPropertyName: "memoizationEnabled", publicName: "memoizationEnabled", isSignal: true, isRequired: false, transformFunction: null } }, usesOnChanges: true, ngImport: i0, template: `
9455
+ <div cdkDropList (cdkDropListDropped)="drop($event)"
9456
+ [class.flex-inherit]="true"
9457
+ [cdkDropListSortPredicate]="sortPredicate"
9458
+ >
9459
+ <!-- -for now left out
9460
+ cdkDragHandle directive, by itself, does not disable the
9461
+ default drag behavior of its parent cdkDrag element.
9462
+ You must explicitly disable dragging on the main element
9463
+ and re-enable it only when using the handle.
9464
+ -->
9465
+ <div *ngFor="let layoutItem of layout(); let i = index;trackBy: trackByFn"
9466
+ cdkDrag [cdkDragStartDelay]="{touch:1000,mouse:0}"
9467
+ [cdkDragDisabled]="!isDraggable(layoutItem)"
9440
9468
  [class.form-flex-item]="isFlexItem()"
9441
9469
  [style.align-self]="(layoutItem.options || {})['align-self']"
9442
9470
  [style.flex-basis]="getFlexAttribute(layoutItem, 'flex-basis')"
9443
9471
  [style.flex-grow]="getFlexAttribute(layoutItem, 'flex-grow')"
9444
9472
  [style.flex-shrink]="getFlexAttribute(layoutItem, 'flex-shrink')"
9445
9473
  [style.order]="(layoutItem.options || {}).order"
9446
- [class.sortable-filter]="!isDraggable(layoutItem)"
9447
- [class.sortable-fixed]="isFixed(layoutItem)"
9448
9474
  >
9475
+
9476
+ <!-- workaround to disbale dragging of input fields -->
9477
+ <!--
9478
+ <div *ngIf="layoutItem?.dataType !='object'" cdkDragHandle>
9479
+ <p>Drag Handle {{layoutItem?.dataType}}</p>
9480
+ </div>
9481
+ -->
9449
9482
  <!--NB orderable directive is not used but has been left in for now and set to false
9450
9483
  otherwise the compiler won't recognize dataIndex and other dependent attributes
9451
9484
  -->
9485
+ <!--
9452
9486
  <div
9453
9487
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
9454
9488
  [layoutIndex]="(layoutIndex() || []).concat(i)"
9455
9489
  [layoutNode]="layoutItem"
9456
9490
  [orderable]="false"
9457
- [class.sortable-filter]="!isDraggable(layoutItem)"
9458
- [class.sortable-fixed]="isFixed(layoutItem)"
9459
9491
  >
9460
9492
  <select-framework-widget *ngIf="showWidget(layoutItem)"
9461
9493
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
9462
9494
  [layoutIndex]="(layoutIndex() || []).concat(i)"
9463
9495
  [layoutNode]="layoutItem"></select-framework-widget>
9464
9496
  </div>
9497
+ -->
9498
+ <select-framework-widget *ngIf="showWidget(layoutItem)"
9499
+ [dataIndex]="getSelectFrameworkInputs(layoutItem,i).dataIndex"
9500
+ [layoutIndex]="getSelectFrameworkInputs(layoutItem,i).layoutIndex"
9501
+ [layoutNode]="getSelectFrameworkInputs(layoutItem,i).layoutNode">
9502
+ </select-framework-widget>
9465
9503
  </div>
9466
9504
  </div>
9467
- `, 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"] }] }); }
9505
+ `, 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", "cdkDropListHasAnchor"], 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 }); }
9468
9506
  }
9469
9507
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: RootComponent, decorators: [{
9470
9508
  type: Component,
9471
9509
  args: [{ selector: 'root-widget', template: `
9472
- <div [class.flex-inherit]="true" #sortableContainter [nxtSortablejs]="layout()" [config]="sortableConfig" (init)="sortableInit($event)">
9473
- <div *ngFor="let layoutItem of layout(); let i = index"
9510
+ <div cdkDropList (cdkDropListDropped)="drop($event)"
9511
+ [class.flex-inherit]="true"
9512
+ [cdkDropListSortPredicate]="sortPredicate"
9513
+ >
9514
+ <!-- -for now left out
9515
+ cdkDragHandle directive, by itself, does not disable the
9516
+ default drag behavior of its parent cdkDrag element.
9517
+ You must explicitly disable dragging on the main element
9518
+ and re-enable it only when using the handle.
9519
+ -->
9520
+ <div *ngFor="let layoutItem of layout(); let i = index;trackBy: trackByFn"
9521
+ cdkDrag [cdkDragStartDelay]="{touch:1000,mouse:0}"
9522
+ [cdkDragDisabled]="!isDraggable(layoutItem)"
9474
9523
  [class.form-flex-item]="isFlexItem()"
9475
9524
  [style.align-self]="(layoutItem.options || {})['align-self']"
9476
9525
  [style.flex-basis]="getFlexAttribute(layoutItem, 'flex-basis')"
9477
9526
  [style.flex-grow]="getFlexAttribute(layoutItem, 'flex-grow')"
9478
9527
  [style.flex-shrink]="getFlexAttribute(layoutItem, 'flex-shrink')"
9479
9528
  [style.order]="(layoutItem.options || {}).order"
9480
- [class.sortable-filter]="!isDraggable(layoutItem)"
9481
- [class.sortable-fixed]="isFixed(layoutItem)"
9482
9529
  >
9530
+
9531
+ <!-- workaround to disbale dragging of input fields -->
9532
+ <!--
9533
+ <div *ngIf="layoutItem?.dataType !='object'" cdkDragHandle>
9534
+ <p>Drag Handle {{layoutItem?.dataType}}</p>
9535
+ </div>
9536
+ -->
9483
9537
  <!--NB orderable directive is not used but has been left in for now and set to false
9484
9538
  otherwise the compiler won't recognize dataIndex and other dependent attributes
9485
9539
  -->
9540
+ <!--
9486
9541
  <div
9487
9542
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
9488
9543
  [layoutIndex]="(layoutIndex() || []).concat(i)"
9489
9544
  [layoutNode]="layoutItem"
9490
9545
  [orderable]="false"
9491
- [class.sortable-filter]="!isDraggable(layoutItem)"
9492
- [class.sortable-fixed]="isFixed(layoutItem)"
9493
9546
  >
9494
9547
  <select-framework-widget *ngIf="showWidget(layoutItem)"
9495
9548
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
9496
9549
  [layoutIndex]="(layoutIndex() || []).concat(i)"
9497
9550
  [layoutNode]="layoutItem"></select-framework-widget>
9498
9551
  </div>
9552
+ -->
9553
+ <select-framework-widget *ngIf="showWidget(layoutItem)"
9554
+ [dataIndex]="getSelectFrameworkInputs(layoutItem,i).dataIndex"
9555
+ [layoutIndex]="getSelectFrameworkInputs(layoutItem,i).layoutIndex"
9556
+ [layoutNode]="getSelectFrameworkInputs(layoutItem,i).layoutNode">
9557
+ </select-framework-widget>
9499
9558
  </div>
9500
9559
  </div>
9501
- `, 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"] }]
9560
+ `, 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"] }]
9502
9561
  }] });
9503
9562
 
9504
9563
  class SectionComponent {
@@ -9624,7 +9683,7 @@ class SectionComponent {
9624
9683
  [class]="options?.labelHelpBlockClass || ''"
9625
9684
  [innerHTML]="options?.description"></p>
9626
9685
  </div>
9627
- </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"] }] }); }
9686
+ </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"] }] }); }
9628
9687
  }
9629
9688
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: SectionComponent, decorators: [{
9630
9689
  type: Component,
@@ -9969,8 +10028,10 @@ class SubmitComponent {
9969
10028
  [name]="controlName"
9970
10029
  [type]="layoutNode()?.type"
9971
10030
  [value]="controlValue"
9972
- (click)="updateValue($event)">
9973
- </div>`, isInline: true }); }
10031
+ (click)="updateValue($event)"
10032
+ [appStopPropagation]="['mousedown', 'touchstart']"
10033
+ >
10034
+ </div>`, isInline: true, dependencies: [{ kind: "directive", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: ["appStopPropagation"] }] }); }
9974
10035
  }
9975
10036
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: SubmitComponent, decorators: [{
9976
10037
  type: Component,
@@ -9990,7 +10051,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
9990
10051
  [name]="controlName"
9991
10052
  [type]="layoutNode()?.type"
9992
10053
  [value]="controlValue"
9993
- (click)="updateValue($event)">
10054
+ (click)="updateValue($event)"
10055
+ [appStopPropagation]="['mousedown', 'touchstart']"
10056
+ >
9994
10057
  </div>`,
9995
10058
  standalone: false
9996
10059
  }]
@@ -10701,7 +10764,7 @@ class TabComponent {
10701
10764
  [dataIndex]="dataIndex()"
10702
10765
  [layoutIndex]="layoutIndex()"
10703
10766
  [layout]="layoutNode().items"></root-widget>
10704
- </div>`, isInline: true, dependencies: [{ kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }] }); }
10767
+ </div>`, isInline: true, dependencies: [{ kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem", "memoizationEnabled"] }] }); }
10705
10768
  }
10706
10769
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: TabComponent, decorators: [{
10707
10770
  type: Component,
@@ -10719,6 +10782,133 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
10719
10782
  }]
10720
10783
  }] });
10721
10784
 
10785
+ /**
10786
+ * OrderableDirective
10787
+ *
10788
+ * Enables array elements to be reordered by dragging and dropping.
10789
+ *
10790
+ * Only works for arrays that have at least two elements.
10791
+ *
10792
+ * Also detects arrays-within-arrays, and correctly moves either
10793
+ * the child array element or the parent array element,
10794
+ * depending on the drop targert.
10795
+ *
10796
+ * Listeners for movable element being dragged:
10797
+ * - dragstart: add 'dragging' class to element, set effectAllowed = 'move'
10798
+ * - dragover: set dropEffect = 'move'
10799
+ * - dragend: remove 'dragging' class from element
10800
+ *
10801
+ * Listeners for stationary items being dragged over:
10802
+ * - dragenter: add 'drag-target-...' classes to element
10803
+ * - dragleave: remove 'drag-target-...' classes from element
10804
+ * - drop: remove 'drag-target-...' classes from element, move dropped array item
10805
+ */
10806
+ class OrderableDirective {
10807
+ constructor() {
10808
+ this.elementRef = inject(ElementRef);
10809
+ this.jsf = inject(JsonSchemaFormService);
10810
+ this.ngZone = inject(NgZone);
10811
+ this.overParentElement = false;
10812
+ this.overChildElement = false;
10813
+ this.orderable = input(undefined, ...(ngDevMode ? [{ debugName: "orderable" }] : []));
10814
+ this.layoutNode = input(undefined, ...(ngDevMode ? [{ debugName: "layoutNode" }] : []));
10815
+ this.layoutIndex = input(undefined, ...(ngDevMode ? [{ debugName: "layoutIndex" }] : []));
10816
+ this.dataIndex = input(undefined, ...(ngDevMode ? [{ debugName: "dataIndex" }] : []));
10817
+ }
10818
+ ngOnInit() {
10819
+ const layoutIndex = this.layoutIndex();
10820
+ if (this.orderable() && this.layoutNode() && layoutIndex && this.dataIndex()) {
10821
+ this.element = this.elementRef.nativeElement;
10822
+ this.element.draggable = true;
10823
+ this.arrayLayoutIndex = 'move:' + layoutIndex.slice(0, -1).toString();
10824
+ this.ngZone.runOutsideAngular(() => {
10825
+ // Listeners for movable element being dragged:
10826
+ this.element.addEventListener('dragstart', (event) => {
10827
+ event.dataTransfer.effectAllowed = 'move';
10828
+ event.dataTransfer.setData('text', '');
10829
+ // Hack to bypass stupid HTML drag-and-drop dataTransfer protection
10830
+ // so drag source info will be available on dragenter
10831
+ const sourceArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
10832
+ sessionStorage.setItem(this.arrayLayoutIndex, sourceArrayIndex + '');
10833
+ });
10834
+ this.element.addEventListener('dragover', (event) => {
10835
+ if (event.preventDefault) {
10836
+ event.preventDefault();
10837
+ }
10838
+ event.dataTransfer.dropEffect = 'move';
10839
+ return false;
10840
+ });
10841
+ // Listeners for stationary items being dragged over:
10842
+ this.element.addEventListener('dragenter', (event) => {
10843
+ // Part 1 of a hack, inspired by Dragster, to simulate mouseover and mouseout
10844
+ // behavior while dragging items - http://bensmithett.github.io/dragster/
10845
+ if (this.overParentElement) {
10846
+ return this.overChildElement = true;
10847
+ }
10848
+ else {
10849
+ this.overParentElement = true;
10850
+ }
10851
+ const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
10852
+ if (sourceArrayIndex !== null) {
10853
+ if (this.dataIndex()[this.dataIndex().length - 1] < +sourceArrayIndex) {
10854
+ this.element.classList.add('drag-target-top');
10855
+ }
10856
+ else if (this.dataIndex()[this.dataIndex().length - 1] > +sourceArrayIndex) {
10857
+ this.element.classList.add('drag-target-bottom');
10858
+ }
10859
+ }
10860
+ });
10861
+ this.element.addEventListener('dragleave', (event) => {
10862
+ // Part 2 of the Dragster hack
10863
+ if (this.overChildElement) {
10864
+ this.overChildElement = false;
10865
+ }
10866
+ else if (this.overParentElement) {
10867
+ this.overParentElement = false;
10868
+ }
10869
+ const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
10870
+ if (!this.overParentElement && !this.overChildElement && sourceArrayIndex !== null) {
10871
+ this.element.classList.remove('drag-target-top');
10872
+ this.element.classList.remove('drag-target-bottom');
10873
+ }
10874
+ });
10875
+ this.element.addEventListener('drop', (event) => {
10876
+ this.element.classList.remove('drag-target-top');
10877
+ this.element.classList.remove('drag-target-bottom');
10878
+ // Confirm that drop target is another item in the same array as source item
10879
+ const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
10880
+ const destArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
10881
+ if (sourceArrayIndex !== null && +sourceArrayIndex !== destArrayIndex) {
10882
+ // Move array item
10883
+ this.jsf.moveArrayItem(this, +sourceArrayIndex, destArrayIndex);
10884
+ }
10885
+ sessionStorage.removeItem(this.arrayLayoutIndex);
10886
+ return false;
10887
+ });
10888
+ });
10889
+ // Subscribe to the draggable state
10890
+ this.draggableStateSubscription = this.jsf.draggableState$.subscribe((value) => {
10891
+ this.element.draggable = value;
10892
+ });
10893
+ }
10894
+ }
10895
+ ngOnDestroy() {
10896
+ if (this.draggableStateSubscription) {
10897
+ this.draggableStateSubscription.unsubscribe();
10898
+ }
10899
+ }
10900
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: OrderableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
10901
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.1.6", type: OrderableDirective, isStandalone: false, selector: "[orderable]", inputs: { orderable: { classPropertyName: "orderable", publicName: "orderable", isSignal: true, isRequired: false, transformFunction: null }, layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
10902
+ }
10903
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: OrderableDirective, decorators: [{
10904
+ type: Directive,
10905
+ args: [{
10906
+ // tslint:disable-next-line:directive-selector
10907
+ selector: '[orderable]',
10908
+ standalone: false
10909
+ }]
10910
+ }] });
10911
+
10722
10912
  const BASIC_WIDGETS = [
10723
10913
  AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent,
10724
10914
  CheckboxesComponent, FileComponent, HiddenComponent, InputComponent,
@@ -10730,39 +10920,16 @@ const BASIC_WIDGETS = [
10730
10920
 
10731
10921
  class WidgetLibraryModule {
10732
10922
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: WidgetLibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
10733
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.6", ngImport: i0, type: WidgetLibraryModule, declarations: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, 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] }); }
10734
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: WidgetLibraryModule, imports: [CommonModule, FormsModule, ReactiveFormsModule,
10735
- SortablejsModule.forRoot({
10736
- //disabled:false,
10737
- //draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
10738
- filter: ".sortable-filter", //needed to disable dragging on input range elements, class needs to be added to the element or its parent
10739
- preventOnFilter: false, //needed for input range elements slider do still work
10740
- onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
10741
- if (evt.related.classList.contains("sortable-fixed")) {
10742
- //console.log(evt.related);
10743
- return false;
10744
- }
10745
- }
10746
- })] }); }
10923
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.6", ngImport: i0, type: WidgetLibraryModule, declarations: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, 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] }); }
10924
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: WidgetLibraryModule, imports: [CommonModule, FormsModule, ReactiveFormsModule, DragDropModule] }); }
10747
10925
  }
10748
10926
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: WidgetLibraryModule, decorators: [{
10749
10927
  type: NgModule,
10750
10928
  args: [{
10751
- imports: [CommonModule, FormsModule, ReactiveFormsModule,
10752
- SortablejsModule.forRoot({
10753
- //disabled:false,
10754
- //draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
10755
- filter: ".sortable-filter", //needed to disable dragging on input range elements, class needs to be added to the element or its parent
10756
- preventOnFilter: false, //needed for input range elements slider do still work
10757
- onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
10758
- if (evt.related.classList.contains("sortable-fixed")) {
10759
- //console.log(evt.related);
10760
- return false;
10761
- }
10762
- }
10763
- })],
10764
- declarations: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective],
10765
- exports: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective]
10929
+ imports: [CommonModule, FormsModule, ReactiveFormsModule, DragDropModule
10930
+ ],
10931
+ declarations: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective, StopPropagationDirective],
10932
+ exports: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective, StopPropagationDirective]
10766
10933
  }]
10767
10934
  }] });
10768
10935
 
@@ -11537,7 +11704,7 @@ class JsonSchemaFormComponent {
11537
11704
  }
11538
11705
  }
11539
11706
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: JsonSchemaFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
11540
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.6", type: JsonSchemaFormComponent, isStandalone: false, selector: "json-schema-form", inputs: { schema: { classPropertyName: "schema", publicName: "schema", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, framework: { classPropertyName: "framework", publicName: "framework", isSignal: true, isRequired: false, transformFunction: null }, widgets: { classPropertyName: "widgets", publicName: "widgets", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, JSONSchema: { classPropertyName: "JSONSchema", publicName: "JSONSchema", isSignal: true, isRequired: false, transformFunction: null }, UISchema: { classPropertyName: "UISchema", publicName: "UISchema", isSignal: true, isRequired: false, transformFunction: null }, formData: { classPropertyName: "formData", publicName: "formData", isSignal: true, isRequired: false, transformFunction: null }, ngModel: { classPropertyName: "ngModel", publicName: "ngModel", isSignal: true, isRequired: false, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, loadExternalAssets: { classPropertyName: "loadExternalAssets", publicName: "loadExternalAssets", isSignal: true, isRequired: false, transformFunction: null }, debug: { classPropertyName: "debug", publicName: "debug", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, 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 }); }
11707
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.6", type: JsonSchemaFormComponent, isStandalone: false, selector: "json-schema-form", inputs: { schema: { classPropertyName: "schema", publicName: "schema", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, framework: { classPropertyName: "framework", publicName: "framework", isSignal: true, isRequired: false, transformFunction: null }, widgets: { classPropertyName: "widgets", publicName: "widgets", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, JSONSchema: { classPropertyName: "JSONSchema", publicName: "JSONSchema", isSignal: true, isRequired: false, transformFunction: null }, UISchema: { classPropertyName: "UISchema", publicName: "UISchema", isSignal: true, isRequired: false, transformFunction: null }, formData: { classPropertyName: "formData", publicName: "formData", isSignal: true, isRequired: false, transformFunction: null }, ngModel: { classPropertyName: "ngModel", publicName: "ngModel", isSignal: true, isRequired: false, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, loadExternalAssets: { classPropertyName: "loadExternalAssets", publicName: "loadExternalAssets", isSignal: true, isRequired: false, transformFunction: null }, debug: { classPropertyName: "debug", publicName: "debug", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, 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 }); }
11541
11708
  }
11542
11709
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: JsonSchemaFormComponent, decorators: [{
11543
11710
  type: Component,
@@ -11573,5 +11740,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
11573
11740
  * Generated bundle index. Do not edit.
11574
11741
  */
11575
11742
 
11576
- 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 };
11743
+ 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 };
11577
11744
  //# sourceMappingURL=ng-formworks-core.mjs.map