@ng-formworks/core 17.6.6 → 17.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/esm2022/lib/json-schema-form.component.mjs +1 -1
  2. package/esm2022/lib/json-schema-form.service.mjs +16 -12
  3. package/esm2022/lib/shared/form-group.functions.mjs +52 -3
  4. package/esm2022/lib/shared/layout.functions.mjs +25 -7
  5. package/esm2022/lib/widget-library/add-reference.component.mjs +13 -6
  6. package/esm2022/lib/widget-library/button.component.mjs +9 -4
  7. package/esm2022/lib/widget-library/checkbox.component.mjs +2 -1
  8. package/esm2022/lib/widget-library/index.mjs +2 -1
  9. package/esm2022/lib/widget-library/input.component.mjs +9 -4
  10. package/esm2022/lib/widget-library/number.component.mjs +9 -6
  11. package/esm2022/lib/widget-library/root.component.mjs +173 -124
  12. package/esm2022/lib/widget-library/section.component.mjs +2 -2
  13. package/esm2022/lib/widget-library/select-framework.component.mjs +9 -5
  14. package/esm2022/lib/widget-library/select-widget.component.mjs +5 -4
  15. package/esm2022/lib/widget-library/stop-propagation.directive.mjs +42 -0
  16. package/esm2022/lib/widget-library/submit.component.mjs +9 -4
  17. package/esm2022/lib/widget-library/tab.component.mjs +1 -1
  18. package/esm2022/lib/widget-library/tabs.component.mjs +14 -2
  19. package/esm2022/lib/widget-library/widget-library.module.mjs +9 -32
  20. package/fesm2022/ng-formworks-core.mjs +502 -327
  21. package/fesm2022/ng-formworks-core.mjs.map +1 -1
  22. package/lib/json-schema-form.service.d.ts +0 -3
  23. package/lib/shared/validator.functions.d.ts +1 -1
  24. package/lib/widget-library/index.d.ts +1 -0
  25. package/lib/widget-library/root.component.d.ts +26 -7
  26. package/lib/widget-library/select-framework.component.d.ts +2 -1
  27. package/lib/widget-library/select-widget.component.d.ts +2 -2
  28. package/lib/widget-library/stop-propagation.directive.d.ts +13 -0
  29. package/lib/widget-library/tabs.component.d.ts +6 -2
  30. package/lib/widget-library/widget-library.module.d.ts +5 -4
  31. package/package.json +3 -4
@@ -1,7 +1,7 @@
1
1
  import * as i1 from '@angular/common';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { Injectable, inject, input, viewChild, ViewContainerRef, Component, 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;
@@ -6320,13 +6369,15 @@ function fixNestedArrayLayout(options) {
6320
6369
  function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPointer = '', dataPointer = '', arrayItem = false, arrayItemType = null, removable = null, forRefLibrary = false, dataPointerPrefix = '', jsonSchema) {
6321
6370
  function applyITEConditions(builtLayout, schPointer, keySchemaPointer, negateClause, parentLayout) {
6322
6371
  if (builtLayout) {
6323
- if (parentLayout && parentLayout.isITEItem && parentLayout.options.condition) {
6372
+ const parentCondition = parentLayout && parentLayout.isITEItem && parentLayout.options.condition;
6373
+ if (parentCondition) {
6374
+ //builtLayout.isITEItem=true;
6324
6375
  return;
6325
6376
  }
6326
6377
  if (isArray(builtLayout)) {
6327
6378
  builtLayout.forEach(item => {
6328
6379
  item.isITEItem = true;
6329
- item.options.condition = convertJSONSchemaIfToCondition(schema, item, negateClause);
6380
+ item.options.condition = parentCondition ? null : convertJSONSchemaIfToCondition(schema, item, negateClause);
6330
6381
  applyITEConditions(item, schPointer, keySchemaPointer, negateClause, builtLayout);
6331
6382
  //item.schemaPointer = schPointer + keySchemaPointer + item.dataPointer;
6332
6383
  //item.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
@@ -6344,7 +6395,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6344
6395
  else {
6345
6396
  builtLayout.isITEItem = true;
6346
6397
  //builtLayout.schemaPointer = `${schPointer}${keySchemaPointer}/${builtLayout.name}`;
6347
- builtLayout.options.condition = convertJSONSchemaIfToCondition(schema, builtLayout, negateClause);
6398
+ builtLayout.options.condition = parentCondition ? null : convertJSONSchemaIfToCondition(schema, builtLayout, negateClause);
6348
6399
  //newSection.push(builtLayout)
6349
6400
  }
6350
6401
  }
@@ -6587,6 +6638,13 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6587
6638
  itemRefPointer !== shortDataPointer + '/' + i;
6588
6639
  // If removable, add tuple item layout to layoutRefLibrary
6589
6640
  if (removable && i >= newNode.options.minItems) {
6641
+ let conditionalRefPointer = `${itemRefPointer}@${schemaPointer}`;
6642
+ let templateRefToUse = itemRefPointer;
6643
+ if (hasOwn(jsf.layoutRefLibrary, itemRefPointer)
6644
+ && !hasOwn(jsf.layoutRefLibrary, conditionalRefPointer)) {
6645
+ jsf.layoutRefLibrary[conditionalRefPointer] = buildLayoutFromSchema(jsf, widgetLibrary, isArray(nodeValue) ? nodeValue[i] : null, schemaPointer + '/items/' + i, itemRecursive ? '' : dataPointer + '/' + i, true, 'tuple', true, true, itemRecursive ? dataPointer + '/' + i : '');
6646
+ templateRefToUse = conditionalRefPointer;
6647
+ }
6590
6648
  if (!hasOwn(jsf.layoutRefLibrary, itemRefPointer)) {
6591
6649
  // Set to null first to prevent recursive reference from causing endless loop
6592
6650
  jsf.layoutRefLibrary[itemRefPointer] = null;
@@ -6594,9 +6652,10 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6594
6652
  if (itemRecursive) {
6595
6653
  jsf.layoutRefLibrary[itemRefPointer].recursiveReference = true;
6596
6654
  }
6655
+ jsf.layoutRefLibrary[conditionalRefPointer] = jsf.layoutRefLibrary[itemRefPointer];
6597
6656
  }
6598
6657
  newItem = getLayoutNode({
6599
- $ref: itemRefPointer,
6658
+ $ref: templateRefToUse,
6600
6659
  dataPointer: dataPointer + '/' + i,
6601
6660
  recursiveReference: itemRecursive,
6602
6661
  }, jsf, widgetLibrary, isArray(nodeValue) ? nodeValue[i] : null);
@@ -6622,6 +6681,13 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6622
6681
  const itemRecursive = !itemRefPointer.length ||
6623
6682
  itemRefPointer !== shortDataPointer + '/-';
6624
6683
  const itemSchemaPointer = removeRecursiveReferences(additionalItemsSchemaPointer, jsf.schemaRecursiveRefMap, jsf.arrayMap);
6684
+ let conditionalRefPointer = `${itemRefPointer}@${schemaPointer}`;
6685
+ let templateRefToUse = itemRefPointer;
6686
+ if (hasOwn(jsf.layoutRefLibrary, itemRefPointer)
6687
+ && !hasOwn(jsf.layoutRefLibrary, conditionalRefPointer)) {
6688
+ jsf.layoutRefLibrary[conditionalRefPointer] = buildLayoutFromSchema(jsf, widgetLibrary, null, itemSchemaPointer, itemRecursive ? '' : dataPointer + '/-', true, 'list', removable, true, itemRecursive ? dataPointer + '/-' : '');
6689
+ templateRefToUse = conditionalRefPointer;
6690
+ }
6625
6691
  // Add list item layout to layoutRefLibrary
6626
6692
  if (itemRefPointer.length && !hasOwn(jsf.layoutRefLibrary, itemRefPointer)) {
6627
6693
  // Set to null first to prevent recursive reference from causing endless loop
@@ -6630,6 +6696,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6630
6696
  if (itemRecursive) {
6631
6697
  jsf.layoutRefLibrary[itemRefPointer].recursiveReference = true;
6632
6698
  }
6699
+ jsf.layoutRefLibrary[conditionalRefPointer] = jsf.layoutRefLibrary[itemRefPointer];
6633
6700
  }
6634
6701
  // Add any additional default items
6635
6702
  if (!itemRecursive || newNode.options.required) {
@@ -6638,7 +6705,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6638
6705
  if (newNode.items.length < arrayLength) {
6639
6706
  for (let i = newNode.items.length; i < arrayLength; i++) {
6640
6707
  newNode.items.push(getLayoutNode({
6641
- $ref: itemRefPointer,
6708
+ $ref: templateRefToUse,
6642
6709
  dataPointer: dataPointer + '/-',
6643
6710
  recursiveReference: itemRecursive,
6644
6711
  }, jsf, widgetLibrary, isArray(nodeValue) ? nodeValue[i] : null));
@@ -6673,7 +6740,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6673
6740
  recursiveReference: itemRecursive,
6674
6741
  type: '$ref',
6675
6742
  widget: widgetLibrary.getWidget('$ref'),
6676
- $ref: itemRefPointer,
6743
+ $ref: templateRefToUse //itemRefPointer,
6677
6744
  });
6678
6745
  }
6679
6746
  }
@@ -7024,9 +7091,6 @@ class JsonSchemaFormService {
7024
7091
  setDraggableState(value) {
7025
7092
  this.draggableStateSubject.next(value); // Update the draggable value
7026
7093
  }
7027
- setSortableOptions(value) {
7028
- this.sortableOptionsSubject.next(value); // Update the sortable options value
7029
- }
7030
7094
  createAjvInstance(ajvOptions) {
7031
7095
  let ajvInstance = new Ajv2019(ajvOptions);
7032
7096
  ajvInstance.addMetaSchema(jsonDraft6);
@@ -7147,17 +7211,12 @@ class JsonSchemaFormService {
7147
7211
  //and will only be enabled when/if the caller sets the value back to true
7148
7212
  this.draggableStateSubject = new BehaviorSubject(true); // Default value true
7149
7213
  this.draggableState$ = this.draggableStateSubject.asObservable();
7150
- //this is introduced to look at replacing the orderable directive with
7151
- //nxt-sortablejs and sortablejs
7152
- this.sortableOptionsSubject = new BehaviorSubject({ disabled: false }); // Default value true
7153
- this.sortableOptions$ = this.sortableOptionsSubject.asObservable();
7154
7214
  this.ajvRegistry = {};
7155
7215
  this.setLanguage(this.language);
7156
7216
  this.ajv.addMetaSchema(jsonDraft6);
7157
7217
  this.ajv.addMetaSchema(jsonDraft7);
7158
7218
  addFormats(this.ajv);
7159
7219
  this.ajvRegistry['default'] = { name: 'default', ajvInstance: this.ajv, ajvValidator: null };
7160
- console.log(this.ajvRegistry);
7161
7220
  // Add custom 'duration' format using a regex
7162
7221
  /*
7163
7222
  this.ajv.addFormat("duration", {
@@ -7289,12 +7348,12 @@ class JsonSchemaFormService {
7289
7348
  this.formGroup = buildFormGroup(this.formGroupTemplate);
7290
7349
  if (this.formGroup) {
7291
7350
  this.compileAjvSchema(ajvInstanceName);
7292
- this.validateData(this.formGroup.value, true, ajvInstanceName);
7351
+ this.validateData(this.formGroup.getRawValue(), true, ajvInstanceName);
7293
7352
  // Set up observables to emit data and validation info when form data changes
7294
7353
  if (this.formValueSubscription) {
7295
7354
  this.formValueSubscription.unsubscribe();
7296
7355
  }
7297
- this.formValueSubscription = this.formGroup.valueChanges.subscribe(formValue => this.validateData(formValue, true, ajvInstanceName));
7356
+ this.formValueSubscription = this.formGroup.valueChanges.subscribe(formValue => this.validateData(this.formGroup.getRawValue(), true, ajvInstanceName));
7298
7357
  }
7299
7358
  }
7300
7359
  buildLayout(widgetLibrary) {
@@ -7413,6 +7472,12 @@ class JsonSchemaFormService {
7413
7472
  }
7414
7473
  return '';
7415
7474
  }
7475
+ //TODO fix- if template has value in title
7476
+ // "items": {
7477
+ // "title": "{{ 'Input ' + $index+value }}",
7478
+ // "type": "string"
7479
+ // }
7480
+ // result on button will be "Add Input [object Object]"
7416
7481
  setArrayItemTitle(parentCtx = {}, childNode = null, index = null) {
7417
7482
  //for legacy compatibility, parentCtx.layoutNode could either be a value
7418
7483
  //or have been converted to use Signals
@@ -7549,7 +7614,10 @@ class JsonSchemaFormService {
7549
7614
  //set, as the control would only be initialized when the condition is true
7550
7615
  //TODO-review need to decide which of the data sets between data,formValues and default
7551
7616
  //to use for the value
7552
- if (ctx.options?.condition || layoutNode?.oneOfPointer || layoutNode?.anyOfPointer) {
7617
+ //TODO try maybe marking descendants in applyITEConditions
7618
+ let isITEDescendant = layoutNode?.schemaPointer?.split("/")
7619
+ .some(elt => ["then", "else"].includes(elt));
7620
+ if (ctx.options?.condition || layoutNode?.oneOfPointer || layoutNode?.anyOfPointer || isITEDescendant) {
7553
7621
  const dataPointer = this.getDataPointer(ctx);
7554
7622
  const controlValue = ctx.formControl?.value;
7555
7623
  const dataValue = JsonPointer.has(this.data, dataPointer) ?
@@ -7800,6 +7868,9 @@ class JsonSchemaFormService {
7800
7868
  }
7801
7869
  // Move item in the formArray
7802
7870
  const formArray = this.getFormControlGroup(ctx);
7871
+ if (oldIndex >= formArray.length) {
7872
+ return false;
7873
+ }
7803
7874
  const arrayItem = formArray.at(oldIndex);
7804
7875
  formArray.removeAt(oldIndex);
7805
7876
  formArray.insert(newIndex, arrayItem);
@@ -7850,7 +7921,7 @@ class SelectWidgetComponent {
7850
7921
  ngOnInit() {
7851
7922
  this.updateComponent();
7852
7923
  }
7853
- ngOnChanges() {
7924
+ ngOnChanges(changes) {
7854
7925
  this.updateComponent();
7855
7926
  }
7856
7927
  updateComponent() {
@@ -7859,8 +7930,9 @@ class SelectWidgetComponent {
7859
7930
  this.newComponent = widgetContainer.createComponent((this.layoutNode().widget));
7860
7931
  }
7861
7932
  if (this.newComponent) {
7862
- for (const input of ['layoutNode', 'layoutIndex', 'dataIndex']) {
7863
- this.newComponent.instance[input] = this[input];
7933
+ for (const inp of ['layoutNode', 'layoutIndex', 'dataIndex']) {
7934
+ //this.newComponent.instance[inp] = this[inp];
7935
+ this.newComponent.setInput(inp, this[inp]());
7864
7936
  }
7865
7937
  }
7866
7938
  }
@@ -7936,6 +8008,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
7936
8008
  type: Input
7937
8009
  }] } });
7938
8010
 
8011
+ //TODO review:stopPropagation used as a workaround
8012
+ //to prevent dragging onMouseDown and onTouchStart events
8013
+ class StopPropagationDirective {
8014
+ constructor(el, renderer) {
8015
+ this.el = el;
8016
+ this.renderer = renderer;
8017
+ // The input property to receive an array of event names
8018
+ this.events = [];
8019
+ // An array to hold the unsubscribe functions for each event listener
8020
+ this.unsubscribeFunctions = [];
8021
+ }
8022
+ ngOnInit() {
8023
+ // If the input array is empty, default to 'mousedown'
8024
+ const eventsToListen = this.events.length > 0 ? this.events : ['mousedown'];
8025
+ // Loop through the array of event names and set up a listener for each
8026
+ eventsToListen.forEach(eventName => {
8027
+ const unsub = this.renderer.listen(this.el.nativeElement, eventName, (event) => {
8028
+ event.stopPropagation();
8029
+ });
8030
+ // Store the unsubscribe function to be called on destruction
8031
+ this.unsubscribeFunctions.push(unsub);
8032
+ });
8033
+ }
8034
+ ngOnDestroy() {
8035
+ // Call each stored unsubscribe function to clean up listeners
8036
+ this.unsubscribeFunctions.forEach(unsub => unsub());
8037
+ }
8038
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: StopPropagationDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive }); }
8039
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.12", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: { events: ["appStopPropagation", "events"] }, ngImport: i0 }); }
8040
+ }
8041
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: StopPropagationDirective, decorators: [{
8042
+ type: Directive,
8043
+ args: [{
8044
+ selector: '[appStopPropagation]', standalone: false
8045
+ }]
8046
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { events: [{
8047
+ type: Input,
8048
+ args: ['appStopPropagation']
8049
+ }] } });
8050
+
7939
8051
  class AddReferenceComponent {
7940
8052
  constructor() {
7941
8053
  this.jsf = inject(JsonSchemaFormService);
@@ -7967,13 +8079,16 @@ class AddReferenceComponent {
7967
8079
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: AddReferenceComponent, selector: "add-reference-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
7968
8080
  <section [class]="options?.htmlClass || ''" align="end">
7969
8081
  <button *ngIf="showAddButton"
7970
- [class]="options?.fieldHtmlClass || ''" class="sortable-filter sortable-fixed"
8082
+ [class]="options?.fieldHtmlClass || ''"
7971
8083
  [disabled]="options?.readonly"
7972
- (click)="addItem($event)">
8084
+ (click)="addItem($event)"
8085
+ [appStopPropagation]="['mousedown', 'touchstart']"
8086
+ >
7973
8087
  <span *ngIf="options?.icon" [class]="options?.icon"></span>
7974
8088
  <span *ngIf="options?.title" [innerHTML]="buttonText"></span>
8089
+
7975
8090
  </button>
7976
- </section>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
8091
+ </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 }); }
7977
8092
  }
7978
8093
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AddReferenceComponent, decorators: [{
7979
8094
  type: Component,
@@ -7983,11 +8098,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
7983
8098
  template: `
7984
8099
  <section [class]="options?.htmlClass || ''" align="end">
7985
8100
  <button *ngIf="showAddButton"
7986
- [class]="options?.fieldHtmlClass || ''" class="sortable-filter sortable-fixed"
8101
+ [class]="options?.fieldHtmlClass || ''"
7987
8102
  [disabled]="options?.readonly"
7988
- (click)="addItem($event)">
8103
+ (click)="addItem($event)"
8104
+ [appStopPropagation]="['mousedown', 'touchstart']"
8105
+ >
7989
8106
  <span *ngIf="options?.icon" [class]="options?.icon"></span>
7990
8107
  <span *ngIf="options?.title" [innerHTML]="buttonText"></span>
8108
+
7991
8109
  </button>
7992
8110
  </section>`,
7993
8111
  changeDetection: ChangeDetectionStrategy.Default,
@@ -8030,12 +8148,14 @@ class ButtonComponent {
8030
8148
  [name]="controlName"
8031
8149
  [type]="layoutNode()?.type"
8032
8150
  [value]="controlValue"
8033
- (click)="updateValue($event)">
8151
+ (click)="updateValue($event)"
8152
+ [appStopPropagation]="['mousedown', 'touchstart']"
8153
+ >
8034
8154
  <span *ngIf="options?.icon || options?.title"
8035
8155
  [class]="options?.icon"
8036
8156
  [innerHTML]="options?.title"></span>
8037
8157
  </button>
8038
- </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
8158
+ </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: ["appStopPropagation"] }] }); }
8039
8159
  }
8040
8160
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ButtonComponent, decorators: [{
8041
8161
  type: Component,
@@ -8053,7 +8173,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
8053
8173
  [name]="controlName"
8054
8174
  [type]="layoutNode()?.type"
8055
8175
  [value]="controlValue"
8056
- (click)="updateValue($event)">
8176
+ (click)="updateValue($event)"
8177
+ [appStopPropagation]="['mousedown', 'touchstart']"
8178
+ >
8057
8179
  <span *ngIf="options?.icon || options?.title"
8058
8180
  [class]="options?.icon"
8059
8181
  [innerHTML]="options?.title"></span>
@@ -8066,6 +8188,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
8066
8188
  //this mainly affects checkboxes coupled with conditions
8067
8189
  //-the value is rechecked
8068
8190
  //-see https://github.com/SortableJS/Sortable/issues/1052#issuecomment-369613072
8191
+ //-switched to angular cdk for dnd
8069
8192
  class CheckboxComponent {
8070
8193
  constructor() {
8071
8194
  this.jsf = inject(JsonSchemaFormService);
@@ -8421,7 +8544,7 @@ class InputComponent {
8421
8544
  }
8422
8545
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: InputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8423
8546
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: InputComponent, selector: "input-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
8424
- <div [class]="options?.htmlClass || ''" class="sortable-filter" >
8547
+ <div [class]="options?.htmlClass || ''" >
8425
8548
  <label *ngIf="options?.title"
8426
8549
  [attr.for]="'control' + layoutNode()?._id"
8427
8550
  [class]="options?.labelHtmlClass || ''"
@@ -8442,6 +8565,7 @@ class InputComponent {
8442
8565
  [readonly]="options?.readonly ? 'readonly' : null"
8443
8566
  [type]="layoutNode()?.type"
8444
8567
  [attributes]="inputAttributes"
8568
+ [appStopPropagation]="['mousedown', 'touchstart']"
8445
8569
  >
8446
8570
  <input *ngIf="!boundControl"
8447
8571
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
@@ -8460,12 +8584,13 @@ class InputComponent {
8460
8584
  [value]="controlValue"
8461
8585
  (input)="updateValue($event)"
8462
8586
  [attributes]="inputAttributes"
8587
+ [appStopPropagation]="['mousedown', 'touchstart']"
8463
8588
  >
8464
8589
  <datalist *ngIf="options?.typeahead?.source"
8465
8590
  [id]="'control' + layoutNode()?._id + 'Autocomplete'">
8466
8591
  <option *ngFor="let word of options?.typeahead?.source" [value]="word">
8467
8592
  </datalist>
8468
- </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"] }] }); }
8593
+ </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"] }] }); }
8469
8594
  }
8470
8595
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: InputComponent, decorators: [{
8471
8596
  type: Component,
@@ -8473,7 +8598,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
8473
8598
  // tslint:disable-next-line:component-selector
8474
8599
  selector: 'input-widget',
8475
8600
  template: `
8476
- <div [class]="options?.htmlClass || ''" class="sortable-filter" >
8601
+ <div [class]="options?.htmlClass || ''" >
8477
8602
  <label *ngIf="options?.title"
8478
8603
  [attr.for]="'control' + layoutNode()?._id"
8479
8604
  [class]="options?.labelHtmlClass || ''"
@@ -8494,6 +8619,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
8494
8619
  [readonly]="options?.readonly ? 'readonly' : null"
8495
8620
  [type]="layoutNode()?.type"
8496
8621
  [attributes]="inputAttributes"
8622
+ [appStopPropagation]="['mousedown', 'touchstart']"
8497
8623
  >
8498
8624
  <input *ngIf="!boundControl"
8499
8625
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
@@ -8512,6 +8638,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
8512
8638
  [value]="controlValue"
8513
8639
  (input)="updateValue($event)"
8514
8640
  [attributes]="inputAttributes"
8641
+ [appStopPropagation]="['mousedown', 'touchstart']"
8515
8642
  >
8516
8643
  <datalist *ngIf="options?.typeahead?.source"
8517
8644
  [id]="'control' + layoutNode()?._id + 'Autocomplete'">
@@ -8603,7 +8730,7 @@ class NumberComponent {
8603
8730
  }
8604
8731
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NumberComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8605
8732
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: NumberComponent, selector: "number-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "inputControl", first: true, predicate: ["inputControl"], descendants: true }, { propertyName: "div", first: true, predicate: ["divElt"], descendants: true }], ngImport: i0, template: `
8606
- <div #divElt [class]="options?.htmlClass || ''" class="sortable-filter" >
8733
+ <div #divElt [class]="options?.htmlClass || ''" >
8607
8734
  <label *ngIf="options?.title"
8608
8735
  [attr.for]="'control' + layoutNode()?._id"
8609
8736
  [class]="options?.labelHtmlClass || ''"
@@ -8625,7 +8752,7 @@ class NumberComponent {
8625
8752
  [title]="lastValidNumber"
8626
8753
  [type]="layoutNode()?.type === 'range' ? 'range' : 'number'"
8627
8754
  [attributes]="inputAttributes"
8628
-
8755
+ [appStopPropagation]="['mousedown', 'touchstart']"
8629
8756
  >
8630
8757
  <input #inputControl *ngIf="!boundControl"
8631
8758
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
@@ -8645,9 +8772,10 @@ class NumberComponent {
8645
8772
  [value]="controlValue"
8646
8773
  (input)="updateValue($event)"
8647
8774
  [attributes]="inputAttributes"
8775
+ [appStopPropagation]="['mousedown', 'touchstart']"
8648
8776
  >
8649
8777
  <span *ngIf="layoutNode()?.type === 'range'" [innerHTML]="controlValue"></span>
8650
- </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"] }] }); }
8778
+ </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"] }] }); }
8651
8779
  }
8652
8780
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NumberComponent, decorators: [{
8653
8781
  type: Component,
@@ -8655,7 +8783,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
8655
8783
  // tslint:disable-next-line:component-selector
8656
8784
  selector: 'number-widget',
8657
8785
  template: `
8658
- <div #divElt [class]="options?.htmlClass || ''" class="sortable-filter" >
8786
+ <div #divElt [class]="options?.htmlClass || ''" >
8659
8787
  <label *ngIf="options?.title"
8660
8788
  [attr.for]="'control' + layoutNode()?._id"
8661
8789
  [class]="options?.labelHtmlClass || ''"
@@ -8677,7 +8805,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
8677
8805
  [title]="lastValidNumber"
8678
8806
  [type]="layoutNode()?.type === 'range' ? 'range' : 'number'"
8679
8807
  [attributes]="inputAttributes"
8680
-
8808
+ [appStopPropagation]="['mousedown', 'touchstart']"
8681
8809
  >
8682
8810
  <input #inputControl *ngIf="!boundControl"
8683
8811
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
@@ -8697,6 +8825,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
8697
8825
  [value]="controlValue"
8698
8826
  (input)="updateValue($event)"
8699
8827
  [attributes]="inputAttributes"
8828
+ [appStopPropagation]="['mousedown', 'touchstart']"
8700
8829
  >
8701
8830
  <span *ngIf="layoutNode()?.type === 'range'" [innerHTML]="controlValue"></span>
8702
8831
  </div>`,
@@ -8712,6 +8841,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
8712
8841
  class SelectFrameworkComponent {
8713
8842
  constructor() {
8714
8843
  this.jsf = inject(JsonSchemaFormService);
8844
+ this.changeDetectorRef = inject(ChangeDetectorRef);
8715
8845
  this.newComponent = null;
8716
8846
  this.layoutNode = input(undefined);
8717
8847
  this.layoutIndex = input(undefined);
@@ -8721,7 +8851,7 @@ class SelectFrameworkComponent {
8721
8851
  ngOnInit() {
8722
8852
  this.updateComponent();
8723
8853
  }
8724
- ngOnChanges() {
8854
+ ngOnChanges(changes) {
8725
8855
  this.updateComponent();
8726
8856
  }
8727
8857
  updateComponent() {
@@ -8732,9 +8862,12 @@ class SelectFrameworkComponent {
8732
8862
  //this.widgetContainer.createComponent<any>(this.jsf.framework)
8733
8863
  }
8734
8864
  if (this.newComponent) {
8735
- for (const input of ['layoutNode', 'layoutIndex', 'dataIndex']) {
8736
- this.newComponent.instance[input] = this[input];
8865
+ for (const inp of ['layoutNode', 'layoutIndex', 'dataIndex']) {
8866
+ //this.newComponent.instance[inp] = this[inp];
8867
+ this.newComponent.setInput(inp, this[inp]());
8737
8868
  }
8869
+ // Manually trigger change detection after updating inputs
8870
+ //this.changeDetectorRef.detectChanges();
8738
8871
  }
8739
8872
  }
8740
8873
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectFrameworkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
@@ -8752,6 +8885,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
8752
8885
  class TabsComponent {
8753
8886
  constructor() {
8754
8887
  this.jsf = inject(JsonSchemaFormService);
8888
+ this.cdr = inject(ChangeDetectorRef);
8755
8889
  this.selectedItem = 0;
8756
8890
  this.showAddTab = true;
8757
8891
  this.layoutNode = input(undefined);
@@ -8765,6 +8899,12 @@ class TabsComponent {
8765
8899
  }
8766
8900
  this.itemCount = this.layoutNode().items.length - 1;
8767
8901
  this.updateControl();
8902
+ //TODO review/test-introduced to fix dynamic titles not updating
8903
+ //when their conditional linked field is destroyed
8904
+ //-forces change detection!
8905
+ this.jsf.dataChanges.subscribe((val) => {
8906
+ this.cdr.detectChanges();
8907
+ });
8768
8908
  }
8769
8909
  select(index) {
8770
8910
  const layoutNode = this.layoutNode();
@@ -8789,6 +8929,9 @@ class TabsComponent {
8789
8929
  setTabTitle(item, index) {
8790
8930
  return this.jsf.setArrayItemTitle(this, item, index);
8791
8931
  }
8932
+ ngOnDestroy() {
8933
+ this.dataChangesSubs?.unsubscribe();
8934
+ }
8792
8935
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8793
8936
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: TabsComponent, selector: "tabs-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
8794
8937
  <ul
@@ -8812,6 +8955,7 @@ class TabsComponent {
8812
8955
  />
8813
8956
  {{setTabTitle(item, i)}}
8814
8957
  </a>
8958
+
8815
8959
  </li>
8816
8960
  </ul>
8817
8961
 
@@ -8866,6 +9010,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
8866
9010
  />
8867
9011
  {{setTabTitle(item, i)}}
8868
9012
  </a>
9013
+
8869
9014
  </li>
8870
9015
  </ul>
8871
9016
 
@@ -9156,239 +9301,93 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
9156
9301
  }]
9157
9302
  }] });
9158
9303
 
9159
- /**
9160
- * OrderableDirective
9161
- *
9162
- * Enables array elements to be reordered by dragging and dropping.
9163
- *
9164
- * Only works for arrays that have at least two elements.
9165
- *
9166
- * Also detects arrays-within-arrays, and correctly moves either
9167
- * the child array element or the parent array element,
9168
- * depending on the drop targert.
9169
- *
9170
- * Listeners for movable element being dragged:
9171
- * - dragstart: add 'dragging' class to element, set effectAllowed = 'move'
9172
- * - dragover: set dropEffect = 'move'
9173
- * - dragend: remove 'dragging' class from element
9174
- *
9175
- * Listeners for stationary items being dragged over:
9176
- * - dragenter: add 'drag-target-...' classes to element
9177
- * - dragleave: remove 'drag-target-...' classes from element
9178
- * - drop: remove 'drag-target-...' classes from element, move dropped array item
9179
- */
9180
- class OrderableDirective {
9181
- constructor() {
9182
- this.elementRef = inject(ElementRef);
9183
- this.jsf = inject(JsonSchemaFormService);
9184
- this.ngZone = inject(NgZone);
9185
- this.overParentElement = false;
9186
- this.overChildElement = false;
9187
- this.orderable = input(undefined);
9188
- this.layoutNode = input(undefined);
9189
- this.layoutIndex = input(undefined);
9190
- this.dataIndex = input(undefined);
9191
- }
9192
- ngOnInit() {
9193
- const layoutIndex = this.layoutIndex();
9194
- if (this.orderable() && this.layoutNode() && layoutIndex && this.dataIndex()) {
9195
- this.element = this.elementRef.nativeElement;
9196
- this.element.draggable = true;
9197
- this.arrayLayoutIndex = 'move:' + layoutIndex.slice(0, -1).toString();
9198
- this.ngZone.runOutsideAngular(() => {
9199
- // Listeners for movable element being dragged:
9200
- this.element.addEventListener('dragstart', (event) => {
9201
- event.dataTransfer.effectAllowed = 'move';
9202
- event.dataTransfer.setData('text', '');
9203
- // Hack to bypass stupid HTML drag-and-drop dataTransfer protection
9204
- // so drag source info will be available on dragenter
9205
- const sourceArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
9206
- sessionStorage.setItem(this.arrayLayoutIndex, sourceArrayIndex + '');
9207
- });
9208
- this.element.addEventListener('dragover', (event) => {
9209
- if (event.preventDefault) {
9210
- event.preventDefault();
9211
- }
9212
- event.dataTransfer.dropEffect = 'move';
9213
- return false;
9214
- });
9215
- // Listeners for stationary items being dragged over:
9216
- this.element.addEventListener('dragenter', (event) => {
9217
- // Part 1 of a hack, inspired by Dragster, to simulate mouseover and mouseout
9218
- // behavior while dragging items - http://bensmithett.github.io/dragster/
9219
- if (this.overParentElement) {
9220
- return this.overChildElement = true;
9221
- }
9222
- else {
9223
- this.overParentElement = true;
9224
- }
9225
- const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
9226
- if (sourceArrayIndex !== null) {
9227
- if (this.dataIndex()[this.dataIndex().length - 1] < +sourceArrayIndex) {
9228
- this.element.classList.add('drag-target-top');
9229
- }
9230
- else if (this.dataIndex()[this.dataIndex().length - 1] > +sourceArrayIndex) {
9231
- this.element.classList.add('drag-target-bottom');
9232
- }
9233
- }
9234
- });
9235
- this.element.addEventListener('dragleave', (event) => {
9236
- // Part 2 of the Dragster hack
9237
- if (this.overChildElement) {
9238
- this.overChildElement = false;
9239
- }
9240
- else if (this.overParentElement) {
9241
- this.overParentElement = false;
9242
- }
9243
- const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
9244
- if (!this.overParentElement && !this.overChildElement && sourceArrayIndex !== null) {
9245
- this.element.classList.remove('drag-target-top');
9246
- this.element.classList.remove('drag-target-bottom');
9247
- }
9248
- });
9249
- this.element.addEventListener('drop', (event) => {
9250
- this.element.classList.remove('drag-target-top');
9251
- this.element.classList.remove('drag-target-bottom');
9252
- // Confirm that drop target is another item in the same array as source item
9253
- const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
9254
- const destArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
9255
- if (sourceArrayIndex !== null && +sourceArrayIndex !== destArrayIndex) {
9256
- // Move array item
9257
- this.jsf.moveArrayItem(this, +sourceArrayIndex, destArrayIndex);
9258
- }
9259
- sessionStorage.removeItem(this.arrayLayoutIndex);
9260
- return false;
9261
- });
9262
- });
9263
- // Subscribe to the draggable state
9264
- this.draggableStateSubscription = this.jsf.draggableState$.subscribe((value) => {
9265
- this.element.draggable = value;
9266
- });
9267
- }
9268
- }
9269
- ngOnDestroy() {
9270
- if (this.draggableStateSubscription) {
9271
- this.draggableStateSubscription.unsubscribe();
9272
- }
9273
- }
9274
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
9275
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "17.3.12", type: OrderableDirective, selector: "[orderable]", inputs: { orderable: { classPropertyName: "orderable", publicName: "orderable", isSignal: true, isRequired: false, transformFunction: null }, layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
9276
- }
9277
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderableDirective, decorators: [{
9278
- type: Directive,
9279
- args: [{
9280
- // tslint:disable-next-line:directive-selector
9281
- selector: '[orderable]',
9282
- }]
9283
- }] });
9284
-
9285
9304
  class RootComponent {
9286
9305
  constructor() {
9287
9306
  this.jsf = inject(JsonSchemaFormService);
9307
+ this.cdr = inject(ChangeDetectorRef);
9288
9308
  this.dataIndex = input(undefined);
9289
9309
  this.layoutIndex = input(undefined);
9290
9310
  this.layout = input(undefined);
9291
9311
  this.isOrderable = input(undefined);
9292
9312
  this.isFlexItem = input(false);
9293
- this.sortableConfig = {
9294
- filter: ".sortable-filter",
9295
- preventOnFilter: false,
9296
- delay: 1000,
9297
- delayOnTouchOnly: true,
9298
- onEnd: (/**Event*/ evt) => {
9299
- evt.newIndex; // most likely why this event is used is to get the dragging element's current index
9300
- // same properties as onEnd
9301
- //console.log(`sortablejs event:${evt}`);
9302
- let srcInd = evt.oldIndex;
9303
- let trgInd = evt.newIndex;
9304
- let layoutItem = this.layout()[trgInd];
9305
- let dataInd = layoutItem?.arrayItem ? (this.dataIndex() || []).concat(trgInd) : (this.dataIndex() || []);
9306
- let layoutInd = (this.layoutIndex() || []).concat(trgInd);
9307
- let itemCtx = {
9308
- dataIndex: () => { return dataInd; },
9309
- layoutIndex: () => { return layoutInd; },
9310
- layoutNode: () => { return layoutItem; },
9311
- };
9312
- //must set moveLayout to false as nxtSortable already moves it
9313
- this.jsf.moveArrayItem(itemCtx, evt.oldIndex, evt.newIndex, false);
9314
- },
9315
- onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
9316
- if (evt.related.classList.contains("sortable-fixed")) {
9317
- //console.log(evt.related);
9318
- return false;
9319
- }
9320
- }
9313
+ this.memoizationEnabled = input(true);
9314
+ /**
9315
+ * Predicate function that disallows '$ref' item sorts
9316
+ * NB declared as a var instead of a function
9317
+ * like sortPredicate(index: number, item: CdkDrag<number>){..}
9318
+ * since 'this' is bound to the draglist and doesn't reference the
9319
+ * FlexLayoutRootComponent instance
9320
+ */
9321
+ //TODO also need to think of other types such as button which can be
9322
+ //created by an arbitrary layout
9323
+ //might not be needed added condition to [cdkDragDisabled]
9324
+ this.sortPredicate = (index, item) => {
9325
+ let layoutItem = this.layout()[index];
9326
+ let result = this.isDraggable(layoutItem);
9327
+ //layoutItem.type != '$ref';
9328
+ return result;
9321
9329
  };
9322
- }
9323
- sortableInit(sortable) {
9324
- this.sortableObj = sortable;
9325
- //Sortable.utils.on(this.sortableObj.el,"nulling",(s)=>{console.log("event nulling sortablejs")})
9326
- ///NB issue caused by sortablejs when it its destroyed
9327
- //this mainly affects checkboxes coupled with conditions
9328
- //-the value is rechecked
9329
- //-see https://github.com/SortableJS/Sortable/issues/1052#issuecomment-369613072
9330
- /* attempt to monkey patch sortable js
9331
- const originalMethod = sortable._nulling;
9332
- let zone=this.zone;
9333
- sortable._nulling=function() {
9334
- console.log(`pluginEvent 2 ${pluginEvent}`)
9335
- zone.runOutsideAngular(() => {
9336
- console.log(`pluginEvent3 ${pluginEvent}`)
9337
- pluginEvent('nulling', this);
9338
-
9339
- rootEl =
9340
- dragEl =
9341
- parentEl =
9342
- ghostEl =
9343
- nextEl =
9344
- cloneEl =
9345
- lastDownEl =
9346
- cloneHidden =
9347
-
9348
- tapEvt =
9349
- touchEvt =
9330
+ //private selectframeworkInputCache = new Map<string, { dataIndex: any[], layoutIndex: any[], layoutNode: any }>();
9331
+ //TODO review caching-if form field values change, the changes are not propagated
9332
+ /*
9333
+ getSelectFrameworkInputs(layoutItem: any, i: number) {
9334
+ // Create a unique key based on the layoutItem and index
9335
+ const cacheKey = `${layoutItem._id}-${i}`;
9336
+
9337
+ // If the result is already in the cache, return it
9338
+ if(this.enableCaching){
9339
+ if (this.selectframeworkInputCache.has(cacheKey)) {
9340
+ return this.selectframeworkInputCache.get(cacheKey);
9341
+ }
9342
+ }
9350
9343
 
9351
- moved =
9352
- newIndex =
9353
- newDraggableIndex =
9354
- oldIndex =
9355
- oldDraggableIndex =
9356
9344
 
9357
- lastTarget =
9358
- lastDirection =
9345
+ // If not cached, calculate the values (assuming dataIndex() and layoutIndex() are functions)
9346
+ const dataIndex = layoutItem?.arrayItem ? (this.dataIndex() || []).concat(i) : (this.dataIndex() || []);
9347
+ const layoutIndex = (this.layoutIndex() || []).concat(i);
9359
9348
 
9360
- putSortable =
9361
- activeGroup =
9362
- Sortable.dragged =
9363
- Sortable.ghost =
9364
- Sortable.clone =
9365
- Sortable.active = null;
9349
+ // Save the result in the cache
9350
+ const result = { dataIndex, layoutIndex, layoutNode: layoutItem };
9351
+ if(this.enableCaching){
9352
+ this.selectframeworkInputCache.set(cacheKey, result);
9353
+ }
9366
9354
 
9367
-
9368
- let el = this.el;
9369
- savedInputChecked.forEach(function (checkEl) {
9370
- if (el.contains(checkEl)) {
9371
- checkEl.checked = true;
9372
- }
9373
- });
9374
-
9375
- savedInputChecked.length =
9376
- lastDx =
9377
- lastDy = 0;
9378
-
9379
- })
9380
-
9381
- }.bind(sortable)
9382
- */
9355
+ return result;
9356
+ }
9357
+ */
9358
+ this._getSelectFrameworkInputsRaw = (layoutItem, i) => {
9359
+ const dataIndexValue = this.dataIndex() || [];
9360
+ const layoutIndexValue = this.layoutIndex() || [];
9361
+ return {
9362
+ layoutNode: layoutItem,
9363
+ layoutIndex: [...layoutIndexValue, i],
9364
+ dataIndex: layoutItem?.arrayItem ? [...dataIndexValue, i] : dataIndexValue,
9365
+ };
9366
+ };
9367
+ // Define a separate function to hold the memoized version
9368
+ this._getSelectFrameworkInputsMemoized = memoize(this._getSelectFrameworkInputsRaw, (layoutItem, i) => {
9369
+ const layoutItemKey = layoutItem?.id ?? JSON.stringify(layoutItem);
9370
+ return `${layoutItemKey}-${i}`;
9371
+ });
9372
+ }
9373
+ drop(event) {
9374
+ // most likely why this event is used is to get the dragging element's current index
9375
+ let srcInd = event.previousIndex;
9376
+ let trgInd = event.currentIndex;
9377
+ let layoutItem = this.layout()[trgInd];
9378
+ let dataInd = layoutItem?.arrayItem ? (this.dataIndex() || []).concat(trgInd) : (this.dataIndex() || []);
9379
+ let layoutInd = (this.layoutIndex() || []).concat(trgInd);
9380
+ let itemCtx = {
9381
+ dataIndex: () => { return dataInd; },
9382
+ layoutIndex: () => { return layoutInd; },
9383
+ layoutNode: () => { return layoutItem; },
9384
+ };
9385
+ this.jsf.moveArrayItem(itemCtx, srcInd, trgInd, true);
9383
9386
  }
9384
9387
  isDraggable(node) {
9385
9388
  let result = node.arrayItem && node.type !== '$ref' &&
9386
- node.arrayItemType === 'list' && this.isOrderable() !== false;
9387
- if (this.sortableObj) {
9388
- //this.sortableObj.option("disabled",true);
9389
- //this.sortableObj.option("sort",false);
9390
- //this.sortableObj.option("disabled",!result);
9391
- }
9389
+ node.arrayItemType === 'list' && this.isOrderable() !== false
9390
+ && node.type !== 'submit';
9392
9391
  return result;
9393
9392
  }
9394
9393
  //TODO also need to think of other types such as button which can be
@@ -9404,93 +9403,162 @@ class RootComponent {
9404
9403
  return ((node.options || {}).flex || '').split(/\s+/)[index] ||
9405
9404
  (node.options || {})[attribute] || ['1', '1', 'auto'][index];
9406
9405
  }
9406
+ // This is the public function that the template calls
9407
+ getSelectFrameworkInputs(layoutItem, i) {
9408
+ if (this.memoizationEnabled) {
9409
+ return this._getSelectFrameworkInputsMemoized(layoutItem, i);
9410
+ }
9411
+ else {
9412
+ return this._getSelectFrameworkInputsRaw(layoutItem, i);
9413
+ }
9414
+ }
9415
+ trackByFn(index, item) {
9416
+ return item._id ?? index;
9417
+ }
9418
+ /*
9419
+ ngOnChanges(changes: SimpleChanges): void {
9420
+ // If any of the input properties change, clear the cache
9421
+ if (changes.dataIndex || changes.layoutIndex || changes.layout) {
9422
+ this.selectframeworkInputCache?.clear(); // Clear the entire cache
9423
+ }
9424
+ }
9425
+ */
9426
+ ngOnChanges(changes) {
9427
+ if (changes['layout'] || changes['dataIndex'] || changes['layoutIndex']) {
9428
+ // Clear the entire cache of the memoized function
9429
+ this._getSelectFrameworkInputsMemoized.cache.clear();
9430
+ this.cdr.markForCheck();
9431
+ }
9432
+ }
9407
9433
  showWidget(layoutNode) {
9408
9434
  return this.jsf.evaluateCondition(layoutNode, this.dataIndex());
9409
9435
  }
9410
9436
  ngOnInit() {
9411
- // Subscribe to the draggable state
9412
- this.sortableOptionsSubscription = this.jsf.sortableOptions$.subscribe((optsValue) => {
9413
- if (this.sortableObj) {
9414
- Object.keys(optsValue).forEach(opt => {
9415
- let optVal = optsValue[opt];
9416
- this.sortableObj.option(opt, optVal);
9417
- });
9418
- //this.sortableObj.option("disabled",true);
9419
- //this.sortableObj.option("sort",false);
9420
- }
9421
- });
9437
+ if (this.memoizationEnabled) {
9438
+ this.jsf.dataChanges.subscribe((val) => {
9439
+ //this.selectframeworkInputCache?.clear();
9440
+ this._getSelectFrameworkInputsMemoized.cache.clear();
9441
+ //TODO-fix for now changed to detectChanges-
9442
+ //used to updated the dynamic titles in tab compnents
9443
+ this.cdr.markForCheck();
9444
+ // this.cdr.detectChanges();-breaks oneOf/ matdatepicker
9445
+ });
9446
+ }
9422
9447
  }
9423
9448
  ngOnDestroy() {
9424
- if (this.sortableOptionsSubscription) {
9425
- this.sortableOptionsSubscription.unsubscribe();
9426
- }
9449
+ //this.selectframeworkInputCache?.clear()
9450
+ //this.selectframeworkInputCache=null;
9451
+ this._getSelectFrameworkInputsMemoized.cache.clear();
9452
+ this.dataChangesSubs?.unsubscribe();
9427
9453
  }
9428
9454
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: RootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9429
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: RootComponent, selector: "root-widget", inputs: { dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, isOrderable: { classPropertyName: "isOrderable", publicName: "isOrderable", isSignal: true, isRequired: false, transformFunction: null }, isFlexItem: { classPropertyName: "isFlexItem", publicName: "isFlexItem", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
9430
- <div [class.flex-inherit]="true" #sortableContainter [nxtSortablejs]="layout()" [config]="sortableConfig" (init)="sortableInit($event)">
9431
- <div *ngFor="let layoutItem of layout(); let i = index"
9455
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: RootComponent, selector: "root-widget", inputs: { dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, isOrderable: { classPropertyName: "isOrderable", publicName: "isOrderable", isSignal: true, isRequired: false, transformFunction: null }, isFlexItem: { classPropertyName: "isFlexItem", publicName: "isFlexItem", isSignal: true, isRequired: false, transformFunction: null }, memoizationEnabled: { classPropertyName: "memoizationEnabled", publicName: "memoizationEnabled", isSignal: true, isRequired: false, transformFunction: null } }, usesOnChanges: true, ngImport: i0, template: `
9456
+ <div cdkDropList (cdkDropListDropped)="drop($event)"
9457
+ [class.flex-inherit]="true"
9458
+ [cdkDropListSortPredicate]="sortPredicate"
9459
+ >
9460
+ <!-- -for now left out
9461
+ cdkDragHandle directive, by itself, does not disable the
9462
+ default drag behavior of its parent cdkDrag element.
9463
+ You must explicitly disable dragging on the main element
9464
+ and re-enable it only when using the handle.
9465
+ -->
9466
+ <div *ngFor="let layoutItem of layout(); let i = index;trackBy: trackByFn"
9467
+ cdkDrag [cdkDragStartDelay]="{touch:1000,mouse:0}"
9468
+ [cdkDragDisabled]="!isDraggable(layoutItem)"
9432
9469
  [class.form-flex-item]="isFlexItem()"
9433
9470
  [style.align-self]="(layoutItem.options || {})['align-self']"
9434
9471
  [style.flex-basis]="getFlexAttribute(layoutItem, 'flex-basis')"
9435
9472
  [style.flex-grow]="getFlexAttribute(layoutItem, 'flex-grow')"
9436
9473
  [style.flex-shrink]="getFlexAttribute(layoutItem, 'flex-shrink')"
9437
9474
  [style.order]="(layoutItem.options || {}).order"
9438
- [class.sortable-filter]="!isDraggable(layoutItem)"
9439
- [class.sortable-fixed]="isFixed(layoutItem)"
9440
9475
  >
9476
+
9477
+ <!-- workaround to disbale dragging of input fields -->
9478
+ <!--
9479
+ <div *ngIf="layoutItem?.dataType !='object'" cdkDragHandle>
9480
+ <p>Drag Handle {{layoutItem?.dataType}}</p>
9481
+ </div>
9482
+ -->
9441
9483
  <!--NB orderable directive is not used but has been left in for now and set to false
9442
9484
  otherwise the compiler won't recognize dataIndex and other dependent attributes
9443
9485
  -->
9486
+ <!--
9444
9487
  <div
9445
9488
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
9446
9489
  [layoutIndex]="(layoutIndex() || []).concat(i)"
9447
9490
  [layoutNode]="layoutItem"
9448
9491
  [orderable]="false"
9449
- [class.sortable-filter]="!isDraggable(layoutItem)"
9450
- [class.sortable-fixed]="isFixed(layoutItem)"
9451
9492
  >
9452
9493
  <select-framework-widget *ngIf="showWidget(layoutItem)"
9453
9494
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
9454
9495
  [layoutIndex]="(layoutIndex() || []).concat(i)"
9455
9496
  [layoutNode]="layoutItem"></select-framework-widget>
9456
9497
  </div>
9498
+ -->
9499
+ <select-framework-widget *ngIf="showWidget(layoutItem)"
9500
+ [dataIndex]="getSelectFrameworkInputs(layoutItem,i).dataIndex"
9501
+ [layoutIndex]="getSelectFrameworkInputs(layoutItem,i).layoutIndex"
9502
+ [layoutNode]="getSelectFrameworkInputs(layoutItem,i).layoutNode">
9503
+ </select-framework-widget>
9457
9504
  </div>
9458
9505
  </div>
9459
- `, 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"] }] }); }
9506
+ `, 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"], 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"], 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 }); }
9460
9507
  }
9461
9508
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: RootComponent, decorators: [{
9462
9509
  type: Component,
9463
9510
  args: [{ selector: 'root-widget', template: `
9464
- <div [class.flex-inherit]="true" #sortableContainter [nxtSortablejs]="layout()" [config]="sortableConfig" (init)="sortableInit($event)">
9465
- <div *ngFor="let layoutItem of layout(); let i = index"
9511
+ <div cdkDropList (cdkDropListDropped)="drop($event)"
9512
+ [class.flex-inherit]="true"
9513
+ [cdkDropListSortPredicate]="sortPredicate"
9514
+ >
9515
+ <!-- -for now left out
9516
+ cdkDragHandle directive, by itself, does not disable the
9517
+ default drag behavior of its parent cdkDrag element.
9518
+ You must explicitly disable dragging on the main element
9519
+ and re-enable it only when using the handle.
9520
+ -->
9521
+ <div *ngFor="let layoutItem of layout(); let i = index;trackBy: trackByFn"
9522
+ cdkDrag [cdkDragStartDelay]="{touch:1000,mouse:0}"
9523
+ [cdkDragDisabled]="!isDraggable(layoutItem)"
9466
9524
  [class.form-flex-item]="isFlexItem()"
9467
9525
  [style.align-self]="(layoutItem.options || {})['align-self']"
9468
9526
  [style.flex-basis]="getFlexAttribute(layoutItem, 'flex-basis')"
9469
9527
  [style.flex-grow]="getFlexAttribute(layoutItem, 'flex-grow')"
9470
9528
  [style.flex-shrink]="getFlexAttribute(layoutItem, 'flex-shrink')"
9471
9529
  [style.order]="(layoutItem.options || {}).order"
9472
- [class.sortable-filter]="!isDraggable(layoutItem)"
9473
- [class.sortable-fixed]="isFixed(layoutItem)"
9474
9530
  >
9531
+
9532
+ <!-- workaround to disbale dragging of input fields -->
9533
+ <!--
9534
+ <div *ngIf="layoutItem?.dataType !='object'" cdkDragHandle>
9535
+ <p>Drag Handle {{layoutItem?.dataType}}</p>
9536
+ </div>
9537
+ -->
9475
9538
  <!--NB orderable directive is not used but has been left in for now and set to false
9476
9539
  otherwise the compiler won't recognize dataIndex and other dependent attributes
9477
9540
  -->
9541
+ <!--
9478
9542
  <div
9479
9543
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
9480
9544
  [layoutIndex]="(layoutIndex() || []).concat(i)"
9481
9545
  [layoutNode]="layoutItem"
9482
9546
  [orderable]="false"
9483
- [class.sortable-filter]="!isDraggable(layoutItem)"
9484
- [class.sortable-fixed]="isFixed(layoutItem)"
9485
9547
  >
9486
9548
  <select-framework-widget *ngIf="showWidget(layoutItem)"
9487
9549
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
9488
9550
  [layoutIndex]="(layoutIndex() || []).concat(i)"
9489
9551
  [layoutNode]="layoutItem"></select-framework-widget>
9490
9552
  </div>
9553
+ -->
9554
+ <select-framework-widget *ngIf="showWidget(layoutItem)"
9555
+ [dataIndex]="getSelectFrameworkInputs(layoutItem,i).dataIndex"
9556
+ [layoutIndex]="getSelectFrameworkInputs(layoutItem,i).layoutIndex"
9557
+ [layoutNode]="getSelectFrameworkInputs(layoutItem,i).layoutNode">
9558
+ </select-framework-widget>
9491
9559
  </div>
9492
9560
  </div>
9493
- `, 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"] }]
9561
+ `, 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"] }]
9494
9562
  }] });
9495
9563
 
9496
9564
  class SectionComponent {
@@ -9616,7 +9684,7 @@ class SectionComponent {
9616
9684
  [class]="options?.labelHelpBlockClass || ''"
9617
9685
  [innerHTML]="options?.description"></p>
9618
9686
  </div>
9619
- </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"] }] }); }
9687
+ </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"] }] }); }
9620
9688
  }
9621
9689
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SectionComponent, decorators: [{
9622
9690
  type: Component,
@@ -9960,8 +10028,10 @@ class SubmitComponent {
9960
10028
  [name]="controlName"
9961
10029
  [type]="layoutNode()?.type"
9962
10030
  [value]="controlValue"
9963
- (click)="updateValue($event)">
9964
- </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"] }] }); }
9965
10035
  }
9966
10036
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SubmitComponent, decorators: [{
9967
10037
  type: Component,
@@ -9981,7 +10051,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
9981
10051
  [name]="controlName"
9982
10052
  [type]="layoutNode()?.type"
9983
10053
  [value]="controlValue"
9984
- (click)="updateValue($event)">
10054
+ (click)="updateValue($event)"
10055
+ [appStopPropagation]="['mousedown', 'touchstart']"
10056
+ >
9985
10057
  </div>`,
9986
10058
  }]
9987
10059
  }] });
@@ -10689,7 +10761,7 @@ class TabComponent {
10689
10761
  [dataIndex]="dataIndex()"
10690
10762
  [layoutIndex]="layoutIndex()"
10691
10763
  [layout]="layoutNode().items"></root-widget>
10692
- </div>`, isInline: true, dependencies: [{ kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }] }); }
10764
+ </div>`, isInline: true, dependencies: [{ kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem", "memoizationEnabled"] }] }); }
10693
10765
  }
10694
10766
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TabComponent, decorators: [{
10695
10767
  type: Component,
@@ -10706,6 +10778,132 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
10706
10778
  }]
10707
10779
  }] });
10708
10780
 
10781
+ /**
10782
+ * OrderableDirective
10783
+ *
10784
+ * Enables array elements to be reordered by dragging and dropping.
10785
+ *
10786
+ * Only works for arrays that have at least two elements.
10787
+ *
10788
+ * Also detects arrays-within-arrays, and correctly moves either
10789
+ * the child array element or the parent array element,
10790
+ * depending on the drop targert.
10791
+ *
10792
+ * Listeners for movable element being dragged:
10793
+ * - dragstart: add 'dragging' class to element, set effectAllowed = 'move'
10794
+ * - dragover: set dropEffect = 'move'
10795
+ * - dragend: remove 'dragging' class from element
10796
+ *
10797
+ * Listeners for stationary items being dragged over:
10798
+ * - dragenter: add 'drag-target-...' classes to element
10799
+ * - dragleave: remove 'drag-target-...' classes from element
10800
+ * - drop: remove 'drag-target-...' classes from element, move dropped array item
10801
+ */
10802
+ class OrderableDirective {
10803
+ constructor() {
10804
+ this.elementRef = inject(ElementRef);
10805
+ this.jsf = inject(JsonSchemaFormService);
10806
+ this.ngZone = inject(NgZone);
10807
+ this.overParentElement = false;
10808
+ this.overChildElement = false;
10809
+ this.orderable = input(undefined);
10810
+ this.layoutNode = input(undefined);
10811
+ this.layoutIndex = input(undefined);
10812
+ this.dataIndex = input(undefined);
10813
+ }
10814
+ ngOnInit() {
10815
+ const layoutIndex = this.layoutIndex();
10816
+ if (this.orderable() && this.layoutNode() && layoutIndex && this.dataIndex()) {
10817
+ this.element = this.elementRef.nativeElement;
10818
+ this.element.draggable = true;
10819
+ this.arrayLayoutIndex = 'move:' + layoutIndex.slice(0, -1).toString();
10820
+ this.ngZone.runOutsideAngular(() => {
10821
+ // Listeners for movable element being dragged:
10822
+ this.element.addEventListener('dragstart', (event) => {
10823
+ event.dataTransfer.effectAllowed = 'move';
10824
+ event.dataTransfer.setData('text', '');
10825
+ // Hack to bypass stupid HTML drag-and-drop dataTransfer protection
10826
+ // so drag source info will be available on dragenter
10827
+ const sourceArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
10828
+ sessionStorage.setItem(this.arrayLayoutIndex, sourceArrayIndex + '');
10829
+ });
10830
+ this.element.addEventListener('dragover', (event) => {
10831
+ if (event.preventDefault) {
10832
+ event.preventDefault();
10833
+ }
10834
+ event.dataTransfer.dropEffect = 'move';
10835
+ return false;
10836
+ });
10837
+ // Listeners for stationary items being dragged over:
10838
+ this.element.addEventListener('dragenter', (event) => {
10839
+ // Part 1 of a hack, inspired by Dragster, to simulate mouseover and mouseout
10840
+ // behavior while dragging items - http://bensmithett.github.io/dragster/
10841
+ if (this.overParentElement) {
10842
+ return this.overChildElement = true;
10843
+ }
10844
+ else {
10845
+ this.overParentElement = true;
10846
+ }
10847
+ const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
10848
+ if (sourceArrayIndex !== null) {
10849
+ if (this.dataIndex()[this.dataIndex().length - 1] < +sourceArrayIndex) {
10850
+ this.element.classList.add('drag-target-top');
10851
+ }
10852
+ else if (this.dataIndex()[this.dataIndex().length - 1] > +sourceArrayIndex) {
10853
+ this.element.classList.add('drag-target-bottom');
10854
+ }
10855
+ }
10856
+ });
10857
+ this.element.addEventListener('dragleave', (event) => {
10858
+ // Part 2 of the Dragster hack
10859
+ if (this.overChildElement) {
10860
+ this.overChildElement = false;
10861
+ }
10862
+ else if (this.overParentElement) {
10863
+ this.overParentElement = false;
10864
+ }
10865
+ const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
10866
+ if (!this.overParentElement && !this.overChildElement && sourceArrayIndex !== null) {
10867
+ this.element.classList.remove('drag-target-top');
10868
+ this.element.classList.remove('drag-target-bottom');
10869
+ }
10870
+ });
10871
+ this.element.addEventListener('drop', (event) => {
10872
+ this.element.classList.remove('drag-target-top');
10873
+ this.element.classList.remove('drag-target-bottom');
10874
+ // Confirm that drop target is another item in the same array as source item
10875
+ const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
10876
+ const destArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
10877
+ if (sourceArrayIndex !== null && +sourceArrayIndex !== destArrayIndex) {
10878
+ // Move array item
10879
+ this.jsf.moveArrayItem(this, +sourceArrayIndex, destArrayIndex);
10880
+ }
10881
+ sessionStorage.removeItem(this.arrayLayoutIndex);
10882
+ return false;
10883
+ });
10884
+ });
10885
+ // Subscribe to the draggable state
10886
+ this.draggableStateSubscription = this.jsf.draggableState$.subscribe((value) => {
10887
+ this.element.draggable = value;
10888
+ });
10889
+ }
10890
+ }
10891
+ ngOnDestroy() {
10892
+ if (this.draggableStateSubscription) {
10893
+ this.draggableStateSubscription.unsubscribe();
10894
+ }
10895
+ }
10896
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
10897
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "17.3.12", type: OrderableDirective, selector: "[orderable]", inputs: { orderable: { classPropertyName: "orderable", publicName: "orderable", isSignal: true, isRequired: false, transformFunction: null }, layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
10898
+ }
10899
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderableDirective, decorators: [{
10900
+ type: Directive,
10901
+ args: [{
10902
+ // tslint:disable-next-line:directive-selector
10903
+ selector: '[orderable]',
10904
+ }]
10905
+ }] });
10906
+
10709
10907
  const BASIC_WIDGETS = [
10710
10908
  AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent,
10711
10909
  CheckboxesComponent, FileComponent, HiddenComponent, InputComponent,
@@ -10717,39 +10915,16 @@ const BASIC_WIDGETS = [
10717
10915
 
10718
10916
  class WidgetLibraryModule {
10719
10917
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: WidgetLibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
10720
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", 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] }); }
10721
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: WidgetLibraryModule, imports: [CommonModule, FormsModule, ReactiveFormsModule,
10722
- SortablejsModule.forRoot({
10723
- //disabled:false,
10724
- //draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
10725
- filter: ".sortable-filter",
10726
- preventOnFilter: false,
10727
- onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
10728
- if (evt.related.classList.contains("sortable-fixed")) {
10729
- //console.log(evt.related);
10730
- return false;
10731
- }
10732
- }
10733
- })] }); }
10918
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", 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] }); }
10919
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: WidgetLibraryModule, imports: [CommonModule, FormsModule, ReactiveFormsModule, DragDropModule] }); }
10734
10920
  }
10735
10921
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: WidgetLibraryModule, decorators: [{
10736
10922
  type: NgModule,
10737
10923
  args: [{
10738
- imports: [CommonModule, FormsModule, ReactiveFormsModule,
10739
- SortablejsModule.forRoot({
10740
- //disabled:false,
10741
- //draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
10742
- filter: ".sortable-filter",
10743
- preventOnFilter: false,
10744
- onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
10745
- if (evt.related.classList.contains("sortable-fixed")) {
10746
- //console.log(evt.related);
10747
- return false;
10748
- }
10749
- }
10750
- })],
10751
- declarations: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective],
10752
- exports: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective]
10924
+ imports: [CommonModule, FormsModule, ReactiveFormsModule, DragDropModule
10925
+ ],
10926
+ declarations: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective, StopPropagationDirective],
10927
+ exports: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective, StopPropagationDirective]
10753
10928
  }]
10754
10929
  }] });
10755
10930
 
@@ -11524,7 +11699,7 @@ class JsonSchemaFormComponent {
11524
11699
  }
11525
11700
  }
11526
11701
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: JsonSchemaFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
11527
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: JsonSchemaFormComponent, selector: "json-schema-form", inputs: { schema: { classPropertyName: "schema", publicName: "schema", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, framework: { classPropertyName: "framework", publicName: "framework", isSignal: true, isRequired: false, transformFunction: null }, widgets: { classPropertyName: "widgets", publicName: "widgets", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, JSONSchema: { classPropertyName: "JSONSchema", publicName: "JSONSchema", isSignal: true, isRequired: false, transformFunction: null }, UISchema: { classPropertyName: "UISchema", publicName: "UISchema", isSignal: true, isRequired: false, transformFunction: null }, formData: { classPropertyName: "formData", publicName: "formData", isSignal: true, isRequired: false, transformFunction: null }, ngModel: { classPropertyName: "ngModel", publicName: "ngModel", isSignal: true, isRequired: false, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, loadExternalAssets: { classPropertyName: "loadExternalAssets", publicName: "loadExternalAssets", isSignal: true, isRequired: false, transformFunction: null }, debug: { classPropertyName: "debug", publicName: "debug", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, ajvOptions: { classPropertyName: "ajvOptions", publicName: "ajvOptions", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { onChanges: "onChanges", onSubmit: "onSubmit", isValid: "isValid", validationErrors: "validationErrors", formSchema: "formSchema", formLayout: "formLayout", dataChange: "dataChange", modelChange: "modelChange", formDataChange: "formDataChange", ngModelChange: "ngModelChange" }, providers: [JsonSchemaFormService, JSON_SCHEMA_FORM_VALUE_ACCESSOR], usesOnChanges: true, ngImport: i0, template: "<form [autocomplete]=\"jsf?.formOptions?.autocomplete ? 'on' : 'off'\" class=\"json-schema-form\" (ngSubmit)=\"submitForm()\">\r\n <root-widget [layout]=\"jsf?.layout\"></root-widget>\r\n</form>\r\n<div *ngIf=\"debug() || jsf?.formOptions?.debug\">\r\n Debug output:\r\n <pre>{{debugOutput}}</pre>\r\n</div>", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
11702
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: JsonSchemaFormComponent, selector: "json-schema-form", inputs: { schema: { classPropertyName: "schema", publicName: "schema", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, framework: { classPropertyName: "framework", publicName: "framework", isSignal: true, isRequired: false, transformFunction: null }, widgets: { classPropertyName: "widgets", publicName: "widgets", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, JSONSchema: { classPropertyName: "JSONSchema", publicName: "JSONSchema", isSignal: true, isRequired: false, transformFunction: null }, UISchema: { classPropertyName: "UISchema", publicName: "UISchema", isSignal: true, isRequired: false, transformFunction: null }, formData: { classPropertyName: "formData", publicName: "formData", isSignal: true, isRequired: false, transformFunction: null }, ngModel: { classPropertyName: "ngModel", publicName: "ngModel", isSignal: true, isRequired: false, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, loadExternalAssets: { classPropertyName: "loadExternalAssets", publicName: "loadExternalAssets", isSignal: true, isRequired: false, transformFunction: null }, debug: { classPropertyName: "debug", publicName: "debug", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, ajvOptions: { classPropertyName: "ajvOptions", publicName: "ajvOptions", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { onChanges: "onChanges", onSubmit: "onSubmit", isValid: "isValid", validationErrors: "validationErrors", formSchema: "formSchema", formLayout: "formLayout", dataChange: "dataChange", modelChange: "modelChange", formDataChange: "formDataChange", ngModelChange: "ngModelChange" }, providers: [JsonSchemaFormService, JSON_SCHEMA_FORM_VALUE_ACCESSOR], usesOnChanges: true, ngImport: i0, template: "<form [autocomplete]=\"jsf?.formOptions?.autocomplete ? 'on' : 'off'\" class=\"json-schema-form\" (ngSubmit)=\"submitForm()\">\r\n <root-widget [layout]=\"jsf?.layout\"></root-widget>\r\n</form>\r\n<div *ngIf=\"debug() || jsf?.formOptions?.debug\">\r\n Debug output:\r\n <pre>{{debugOutput}}</pre>\r\n</div>", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem", "memoizationEnabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
11528
11703
  }
11529
11704
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: JsonSchemaFormComponent, decorators: [{
11530
11705
  type: Component,
@@ -11560,5 +11735,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
11560
11735
  * Generated bundle index. Do not edit.
11561
11736
  */
11562
11737
 
11563
- 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 };
11738
+ 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 };
11564
11739
  //# sourceMappingURL=ng-formworks-core.mjs.map