@ng-formworks/core 19.6.6 → 19.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.
@@ -1,7 +1,7 @@
1
1
  import * as i1 from '@angular/common';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { Injectable, inject, input, viewChild, ViewContainerRef, Component, Input, Directive, ChangeDetectionStrategy, ViewChild, signal, ElementRef, NgZone, Inject, NgModule, forwardRef, ChangeDetectorRef, output } from '@angular/core';
4
+ import { Injectable, inject, input, viewChild, ViewContainerRef, Component, Input, Directive, ChangeDetectionStrategy, ViewChild, ChangeDetectorRef, signal, Inject, ElementRef, NgZone, NgModule, forwardRef, output } from '@angular/core';
5
5
  import * as i2 from '@angular/forms';
6
6
  import { UntypedFormControl, UntypedFormArray, UntypedFormGroup, FormsModule, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
7
7
  import addFormats from 'ajv-formats';
@@ -10,7 +10,7 @@ import jsonDraft6 from 'ajv/lib/refs/json-schema-draft-06.json';
10
10
  import jsonDraft7 from 'ajv/lib/refs/json-schema-draft-07.json';
11
11
  import cloneDeep from 'lodash/cloneDeep';
12
12
  import { from, Observable, forkJoin, Subject, BehaviorSubject, lastValueFrom } from 'rxjs';
13
- import { some, isNil, isEmpty as isEmpty$1, pick, isObject as isObject$1, isEqual as isEqual$2 } from 'lodash';
13
+ import { some, isNil, isEmpty as isEmpty$1, pick, isObject as isObject$1, isEqual as isEqual$2, memoize } from 'lodash';
14
14
  import isEqual$1 from 'lodash/isEqual';
15
15
  import { map, takeUntil } from 'rxjs/operators';
16
16
  import omit from 'lodash/omit';
@@ -19,8 +19,8 @@ import map$1 from 'lodash/map';
19
19
  import _isArray from 'lodash/isArray';
20
20
  import _isPlainObject from 'lodash/isPlainObject';
21
21
  import uniqueId from 'lodash/uniqueId';
22
- import * as i2$1 from 'nxt-sortablejs';
23
- import { SortablejsModule } from 'nxt-sortablejs';
22
+ import * as i2$1 from '@angular/cdk/drag-drop';
23
+ import { DragDropModule } from '@angular/cdk/drag-drop';
24
24
  import { HttpClient } from '@angular/common/http';
25
25
 
26
26
  class Framework {
@@ -5265,14 +5265,24 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
5265
5265
  const schemaRefPointer = removeRecursiveReferences(schemaPointer + '/items/' + i, jsf.schemaRecursiveRefMap);
5266
5266
  const itemRefPointer = removeRecursiveReferences(shortDataPointer + '/' + i, jsf.dataRecursiveRefMap, jsf.arrayMap);
5267
5267
  const itemRecursive = itemRefPointer !== shortDataPointer + '/' + i;
5268
+ //if is in templateLibrary then need to check if its a conditional
5269
+ //and conditional pointers match orthewise create a new ref
5270
+ let conditionalRefPointer = `${itemRefPointer}@${schemaPointer}`;
5271
+ let templateRefToUse = itemRefPointer;
5272
+ if (hasOwn(jsf.templateRefLibrary, itemRefPointer)
5273
+ && !hasOwn(jsf.templateRefLibrary, conditionalRefPointer)) {
5274
+ jsf.templateRefLibrary[conditionalRefPointer] = buildFormGroupTemplate(jsf, null, setValues, schemaRefPointer, itemRefPointer, templatePointer + '/controls/' + i);
5275
+ templateRefToUse = conditionalRefPointer;
5276
+ }
5268
5277
  if (!hasOwn(jsf.templateRefLibrary, itemRefPointer)) {
5269
5278
  jsf.templateRefLibrary[itemRefPointer] = null;
5270
5279
  jsf.templateRefLibrary[itemRefPointer] = buildFormGroupTemplate(jsf, null, setValues, schemaRefPointer, itemRefPointer, templatePointer + '/controls/' + i);
5280
+ jsf.templateRefLibrary[conditionalRefPointer] = jsf.templateRefLibrary[itemRefPointer];
5271
5281
  }
5272
5282
  controls.push(isArray(nodeValue) ?
5273
5283
  buildFormGroupTemplate(jsf, nodeValue[i], setValues, schemaPointer + '/items/' + i, dataPointer + '/' + i, templatePointer + '/controls/' + i) :
5274
5284
  itemRecursive ?
5275
- null : cloneDeep(jsf.templateRefLibrary[itemRefPointer]));
5285
+ null : cloneDeep(jsf.templateRefLibrary[templateRefToUse]));
5276
5286
  }
5277
5287
  }
5278
5288
  // If 'additionalItems' is an object = additional list items (after tuple items)
@@ -5288,9 +5298,19 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
5288
5298
  const schemaRefPointer = removeRecursiveReferences(additionalItemsPointer, jsf.schemaRecursiveRefMap);
5289
5299
  const itemRefPointer = removeRecursiveReferences(shortDataPointer + '/-', jsf.dataRecursiveRefMap, jsf.arrayMap);
5290
5300
  const itemRecursive = itemRefPointer !== shortDataPointer + '/-';
5301
+ //if is in templateLibrary then need to check if its a conditional
5302
+ //and conditional pointers match orthewise create a new ref
5303
+ let conditionalRefPointer = `${itemRefPointer}@${schemaPointer}`;
5304
+ let templateRefToUse = itemRefPointer;
5305
+ if (hasOwn(jsf.templateRefLibrary, itemRefPointer)
5306
+ && !hasOwn(jsf.templateRefLibrary, conditionalRefPointer)) {
5307
+ jsf.templateRefLibrary[conditionalRefPointer] = buildFormGroupTemplate(jsf, null, setValues, schemaRefPointer, itemRefPointer, templatePointer + '/controls/-');
5308
+ templateRefToUse = conditionalRefPointer;
5309
+ }
5291
5310
  if (!hasOwn(jsf.templateRefLibrary, itemRefPointer)) {
5292
5311
  jsf.templateRefLibrary[itemRefPointer] = null;
5293
5312
  jsf.templateRefLibrary[itemRefPointer] = buildFormGroupTemplate(jsf, null, setValues, schemaRefPointer, itemRefPointer, templatePointer + '/controls/-');
5313
+ jsf.templateRefLibrary[conditionalRefPointer] = jsf.templateRefLibrary[itemRefPointer];
5294
5314
  }
5295
5315
  // const itemOptions = jsf.dataMap.get(itemRefPointer) || new Map();
5296
5316
  const itemOptions = nodeOptions;
@@ -5301,7 +5321,7 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
5301
5321
  controls.push(isArray(nodeValue) ?
5302
5322
  buildFormGroupTemplate(jsf, nodeValue[i], setValues, schemaRefPointer, dataPointer + '/-', templatePointer + '/controls/-') :
5303
5323
  itemRecursive ?
5304
- null : cloneDeep(jsf.templateRefLibrary[itemRefPointer]));
5324
+ null : cloneDeep(jsf.templateRefLibrary[templateRefToUse]));
5305
5325
  }
5306
5326
  }
5307
5327
  }
@@ -5620,6 +5640,35 @@ function getControl(formGroup, dataPointer, returnGroup = false, schemaPointer)
5620
5640
  // or formGroup.get() failed to return the control,
5621
5641
  // search the formGroup object for dataPointer's control
5622
5642
  let subGroup = formGroup;
5643
+ //if schemapointer provided but no control matched
5644
+ //it could mean the schema pointer is a nested child
5645
+ //for example this could be in form group
5646
+ //formGroup.controls.$allOf$0$then$properties$foo
5647
+ //but schemapointer provided is '/allOf/0/then/properties/foo/items/properties/name'
5648
+ //and dataPointer is '/foo/0/name'
5649
+ //then need to look in formGroup.controls.$allOf$0$then$properties$foo
5650
+ //for control path /0/name
5651
+ if (schemaPointer) {
5652
+ let controlPointer = JsonPointer.toControlPointer(dataPointer, {});
5653
+ let schemaPointerArray = schemaPointer.split('/');
5654
+ let controlPointerArray = JsonPointer.parse(dataPointer);
5655
+ //controlPointer.split('/').splice(1);
5656
+ let currSPAKey;
5657
+ let spFormGroup;
5658
+ while (schemaPointerArray.length > 0) {
5659
+ currSPAKey = schemaPointerArray.pop();
5660
+ let ckey = path2ControlKey(schemaPointerArray.join("/"));
5661
+ spFormGroup = formGroup.get(ckey);
5662
+ if (controlPointerArray[0] == schemaPointerArray[schemaPointerArray.length - 1]) {
5663
+ controlPointerArray.shift();
5664
+ }
5665
+ if (spFormGroup) {
5666
+ break;
5667
+ }
5668
+ }
5669
+ subGroup = spFormGroup || subGroup;
5670
+ dataPointerArray = spFormGroup ? controlPointerArray : dataPointerArray;
5671
+ }
5623
5672
  for (const key of dataPointerArray) {
5624
5673
  if (hasOwn(subGroup, 'controls')) {
5625
5674
  subGroup = subGroup.controls;
@@ -6324,13 +6373,15 @@ function fixNestedArrayLayout(options) {
6324
6373
  function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPointer = '', dataPointer = '', arrayItem = false, arrayItemType = null, removable = null, forRefLibrary = false, dataPointerPrefix = '', jsonSchema) {
6325
6374
  function applyITEConditions(builtLayout, schPointer, keySchemaPointer, negateClause, parentLayout) {
6326
6375
  if (builtLayout) {
6327
- if (parentLayout && parentLayout.isITEItem && parentLayout.options.condition) {
6376
+ const parentCondition = parentLayout && parentLayout.isITEItem && parentLayout.options.condition;
6377
+ if (parentCondition) {
6378
+ //builtLayout.isITEItem=true;
6328
6379
  return;
6329
6380
  }
6330
6381
  if (isArray(builtLayout)) {
6331
6382
  builtLayout.forEach(item => {
6332
6383
  item.isITEItem = true;
6333
- item.options.condition = convertJSONSchemaIfToCondition(schema, item, negateClause);
6384
+ item.options.condition = parentCondition ? null : convertJSONSchemaIfToCondition(schema, item, negateClause);
6334
6385
  applyITEConditions(item, schPointer, keySchemaPointer, negateClause, builtLayout);
6335
6386
  //item.schemaPointer = schPointer + keySchemaPointer + item.dataPointer;
6336
6387
  //item.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
@@ -6348,7 +6399,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6348
6399
  else {
6349
6400
  builtLayout.isITEItem = true;
6350
6401
  //builtLayout.schemaPointer = `${schPointer}${keySchemaPointer}/${builtLayout.name}`;
6351
- builtLayout.options.condition = convertJSONSchemaIfToCondition(schema, builtLayout, negateClause);
6402
+ builtLayout.options.condition = parentCondition ? null : convertJSONSchemaIfToCondition(schema, builtLayout, negateClause);
6352
6403
  //newSection.push(builtLayout)
6353
6404
  }
6354
6405
  }
@@ -6591,6 +6642,13 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6591
6642
  itemRefPointer !== shortDataPointer + '/' + i;
6592
6643
  // If removable, add tuple item layout to layoutRefLibrary
6593
6644
  if (removable && i >= newNode.options.minItems) {
6645
+ let conditionalRefPointer = `${itemRefPointer}@${schemaPointer}`;
6646
+ let templateRefToUse = itemRefPointer;
6647
+ if (hasOwn(jsf.layoutRefLibrary, itemRefPointer)
6648
+ && !hasOwn(jsf.layoutRefLibrary, conditionalRefPointer)) {
6649
+ jsf.layoutRefLibrary[conditionalRefPointer] = buildLayoutFromSchema(jsf, widgetLibrary, isArray(nodeValue) ? nodeValue[i] : null, schemaPointer + '/items/' + i, itemRecursive ? '' : dataPointer + '/' + i, true, 'tuple', true, true, itemRecursive ? dataPointer + '/' + i : '');
6650
+ templateRefToUse = conditionalRefPointer;
6651
+ }
6594
6652
  if (!hasOwn(jsf.layoutRefLibrary, itemRefPointer)) {
6595
6653
  // Set to null first to prevent recursive reference from causing endless loop
6596
6654
  jsf.layoutRefLibrary[itemRefPointer] = null;
@@ -6598,9 +6656,10 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6598
6656
  if (itemRecursive) {
6599
6657
  jsf.layoutRefLibrary[itemRefPointer].recursiveReference = true;
6600
6658
  }
6659
+ jsf.layoutRefLibrary[conditionalRefPointer] = jsf.layoutRefLibrary[itemRefPointer];
6601
6660
  }
6602
6661
  newItem = getLayoutNode({
6603
- $ref: itemRefPointer,
6662
+ $ref: templateRefToUse,
6604
6663
  dataPointer: dataPointer + '/' + i,
6605
6664
  recursiveReference: itemRecursive,
6606
6665
  }, jsf, widgetLibrary, isArray(nodeValue) ? nodeValue[i] : null);
@@ -6626,6 +6685,13 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6626
6685
  const itemRecursive = !itemRefPointer.length ||
6627
6686
  itemRefPointer !== shortDataPointer + '/-';
6628
6687
  const itemSchemaPointer = removeRecursiveReferences(additionalItemsSchemaPointer, jsf.schemaRecursiveRefMap, jsf.arrayMap);
6688
+ let conditionalRefPointer = `${itemRefPointer}@${schemaPointer}`;
6689
+ let templateRefToUse = itemRefPointer;
6690
+ if (hasOwn(jsf.layoutRefLibrary, itemRefPointer)
6691
+ && !hasOwn(jsf.layoutRefLibrary, conditionalRefPointer)) {
6692
+ jsf.layoutRefLibrary[conditionalRefPointer] = buildLayoutFromSchema(jsf, widgetLibrary, null, itemSchemaPointer, itemRecursive ? '' : dataPointer + '/-', true, 'list', removable, true, itemRecursive ? dataPointer + '/-' : '');
6693
+ templateRefToUse = conditionalRefPointer;
6694
+ }
6629
6695
  // Add list item layout to layoutRefLibrary
6630
6696
  if (itemRefPointer.length && !hasOwn(jsf.layoutRefLibrary, itemRefPointer)) {
6631
6697
  // Set to null first to prevent recursive reference from causing endless loop
@@ -6634,6 +6700,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6634
6700
  if (itemRecursive) {
6635
6701
  jsf.layoutRefLibrary[itemRefPointer].recursiveReference = true;
6636
6702
  }
6703
+ jsf.layoutRefLibrary[conditionalRefPointer] = jsf.layoutRefLibrary[itemRefPointer];
6637
6704
  }
6638
6705
  // Add any additional default items
6639
6706
  if (!itemRecursive || newNode.options.required) {
@@ -6642,7 +6709,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6642
6709
  if (newNode.items.length < arrayLength) {
6643
6710
  for (let i = newNode.items.length; i < arrayLength; i++) {
6644
6711
  newNode.items.push(getLayoutNode({
6645
- $ref: itemRefPointer,
6712
+ $ref: templateRefToUse,
6646
6713
  dataPointer: dataPointer + '/-',
6647
6714
  recursiveReference: itemRecursive,
6648
6715
  }, jsf, widgetLibrary, isArray(nodeValue) ? nodeValue[i] : null));
@@ -6677,7 +6744,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6677
6744
  recursiveReference: itemRecursive,
6678
6745
  type: '$ref',
6679
6746
  widget: widgetLibrary.getWidget('$ref'),
6680
- $ref: itemRefPointer,
6747
+ $ref: templateRefToUse //itemRefPointer,
6681
6748
  });
6682
6749
  }
6683
6750
  }
@@ -7028,9 +7095,6 @@ class JsonSchemaFormService {
7028
7095
  setDraggableState(value) {
7029
7096
  this.draggableStateSubject.next(value); // Update the draggable value
7030
7097
  }
7031
- setSortableOptions(value) {
7032
- this.sortableOptionsSubject.next(value); // Update the sortable options value
7033
- }
7034
7098
  createAjvInstance(ajvOptions) {
7035
7099
  let ajvInstance = new Ajv2019(ajvOptions);
7036
7100
  ajvInstance.addMetaSchema(jsonDraft6);
@@ -7151,10 +7215,6 @@ class JsonSchemaFormService {
7151
7215
  //and will only be enabled when/if the caller sets the value back to true
7152
7216
  this.draggableStateSubject = new BehaviorSubject(true); // Default value true
7153
7217
  this.draggableState$ = this.draggableStateSubject.asObservable();
7154
- //this is introduced to look at replacing the orderable directive with
7155
- //nxt-sortablejs and sortablejs
7156
- this.sortableOptionsSubject = new BehaviorSubject({ disabled: false }); // Default value true
7157
- this.sortableOptions$ = this.sortableOptionsSubject.asObservable();
7158
7218
  this.ajvRegistry = {};
7159
7219
  this.setLanguage(this.language);
7160
7220
  this.ajv.addMetaSchema(jsonDraft6);
@@ -7292,12 +7352,12 @@ class JsonSchemaFormService {
7292
7352
  this.formGroup = buildFormGroup(this.formGroupTemplate);
7293
7353
  if (this.formGroup) {
7294
7354
  this.compileAjvSchema(ajvInstanceName);
7295
- this.validateData(this.formGroup.value, true, ajvInstanceName);
7355
+ this.validateData(this.formGroup.getRawValue(), true, ajvInstanceName);
7296
7356
  // Set up observables to emit data and validation info when form data changes
7297
7357
  if (this.formValueSubscription) {
7298
7358
  this.formValueSubscription.unsubscribe();
7299
7359
  }
7300
- this.formValueSubscription = this.formGroup.valueChanges.subscribe(formValue => this.validateData(formValue, true, ajvInstanceName));
7360
+ this.formValueSubscription = this.formGroup.valueChanges.subscribe(formValue => this.validateData(this.formGroup.getRawValue(), true, ajvInstanceName));
7301
7361
  }
7302
7362
  }
7303
7363
  buildLayout(widgetLibrary) {
@@ -7416,6 +7476,12 @@ class JsonSchemaFormService {
7416
7476
  }
7417
7477
  return '';
7418
7478
  }
7479
+ //TODO fix- if template has value in title
7480
+ // "items": {
7481
+ // "title": "{{ 'Input ' + $index+value }}",
7482
+ // "type": "string"
7483
+ // }
7484
+ // result on button will be "Add Input [object Object]"
7419
7485
  setArrayItemTitle(parentCtx = {}, childNode = null, index = null) {
7420
7486
  //for legacy compatibility, parentCtx.layoutNode could either be a value
7421
7487
  //or have been converted to use Signals
@@ -7552,7 +7618,10 @@ class JsonSchemaFormService {
7552
7618
  //set, as the control would only be initialized when the condition is true
7553
7619
  //TODO-review need to decide which of the data sets between data,formValues and default
7554
7620
  //to use for the value
7555
- if (ctx.options?.condition || layoutNode?.oneOfPointer || layoutNode?.anyOfPointer) {
7621
+ //TODO try maybe marking descendants in applyITEConditions
7622
+ let isITEDescendant = layoutNode?.schemaPointer?.split("/")
7623
+ .some(elt => ["then", "else"].includes(elt));
7624
+ if (ctx.options?.condition || layoutNode?.oneOfPointer || layoutNode?.anyOfPointer || isITEDescendant) {
7556
7625
  const dataPointer = this.getDataPointer(ctx);
7557
7626
  const controlValue = ctx.formControl?.value;
7558
7627
  const dataValue = JsonPointer.has(this.data, dataPointer) ?
@@ -7803,6 +7872,9 @@ class JsonSchemaFormService {
7803
7872
  }
7804
7873
  // Move item in the formArray
7805
7874
  const formArray = this.getFormControlGroup(ctx);
7875
+ if (oldIndex >= formArray.length) {
7876
+ return false;
7877
+ }
7806
7878
  const arrayItem = formArray.at(oldIndex);
7807
7879
  formArray.removeAt(oldIndex);
7808
7880
  formArray.insert(newIndex, arrayItem);
@@ -7853,7 +7925,7 @@ class SelectWidgetComponent {
7853
7925
  ngOnInit() {
7854
7926
  this.updateComponent();
7855
7927
  }
7856
- ngOnChanges() {
7928
+ ngOnChanges(changes) {
7857
7929
  this.updateComponent();
7858
7930
  }
7859
7931
  updateComponent() {
@@ -7862,8 +7934,9 @@ class SelectWidgetComponent {
7862
7934
  this.newComponent = widgetContainer.createComponent((this.layoutNode().widget));
7863
7935
  }
7864
7936
  if (this.newComponent) {
7865
- for (const input of ['layoutNode', 'layoutIndex', 'dataIndex']) {
7866
- this.newComponent.instance[input] = this[input];
7937
+ for (const inp of ['layoutNode', 'layoutIndex', 'dataIndex']) {
7938
+ //this.newComponent.instance[inp] = this[inp];
7939
+ this.newComponent.setInput(inp, this[inp]());
7867
7940
  }
7868
7941
  }
7869
7942
  }
@@ -7940,6 +8013,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
7940
8013
  type: Input
7941
8014
  }] } });
7942
8015
 
8016
+ //TODO review:stopPropagation used as a workaround
8017
+ //to prevent dragging onMouseDown and onTouchStart events
8018
+ class StopPropagationDirective {
8019
+ constructor(el, renderer) {
8020
+ this.el = el;
8021
+ this.renderer = renderer;
8022
+ // The input property to receive an array of event names
8023
+ this.events = [];
8024
+ // An array to hold the unsubscribe functions for each event listener
8025
+ this.unsubscribeFunctions = [];
8026
+ }
8027
+ ngOnInit() {
8028
+ // If the input array is empty, default to 'mousedown'
8029
+ const eventsToListen = this.events.length > 0 ? this.events : ['mousedown'];
8030
+ // Loop through the array of event names and set up a listener for each
8031
+ eventsToListen.forEach(eventName => {
8032
+ const unsub = this.renderer.listen(this.el.nativeElement, eventName, (event) => {
8033
+ event.stopPropagation();
8034
+ });
8035
+ // Store the unsubscribe function to be called on destruction
8036
+ this.unsubscribeFunctions.push(unsub);
8037
+ });
8038
+ }
8039
+ ngOnDestroy() {
8040
+ // Call each stored unsubscribe function to clean up listeners
8041
+ this.unsubscribeFunctions.forEach(unsub => unsub());
8042
+ }
8043
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: StopPropagationDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive }); }
8044
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.14", type: StopPropagationDirective, isStandalone: false, selector: "[appStopPropagation]", inputs: { events: ["appStopPropagation", "events"] }, ngImport: i0 }); }
8045
+ }
8046
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: StopPropagationDirective, decorators: [{
8047
+ type: Directive,
8048
+ args: [{
8049
+ selector: '[appStopPropagation]', standalone: false
8050
+ }]
8051
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { events: [{
8052
+ type: Input,
8053
+ args: ['appStopPropagation']
8054
+ }] } });
8055
+
7943
8056
  class AddReferenceComponent {
7944
8057
  constructor() {
7945
8058
  this.jsf = inject(JsonSchemaFormService);
@@ -7971,13 +8084,16 @@ class AddReferenceComponent {
7971
8084
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: AddReferenceComponent, isStandalone: false, selector: "add-reference-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
7972
8085
  <section [class]="options?.htmlClass || ''" align="end">
7973
8086
  <button *ngIf="showAddButton"
7974
- [class]="options?.fieldHtmlClass || ''" class="sortable-filter sortable-fixed"
8087
+ [class]="options?.fieldHtmlClass || ''"
7975
8088
  [disabled]="options?.readonly"
7976
- (click)="addItem($event)">
8089
+ (click)="addItem($event)"
8090
+ [appStopPropagation]="['mousedown', 'touchstart']"
8091
+ >
7977
8092
  <span *ngIf="options?.icon" [class]="options?.icon"></span>
7978
8093
  <span *ngIf="options?.title" [innerHTML]="buttonText"></span>
8094
+
7979
8095
  </button>
7980
- </section>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
8096
+ </section>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: ["appStopPropagation"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
7981
8097
  }
7982
8098
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AddReferenceComponent, decorators: [{
7983
8099
  type: Component,
@@ -7987,11 +8103,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
7987
8103
  template: `
7988
8104
  <section [class]="options?.htmlClass || ''" align="end">
7989
8105
  <button *ngIf="showAddButton"
7990
- [class]="options?.fieldHtmlClass || ''" class="sortable-filter sortable-fixed"
8106
+ [class]="options?.fieldHtmlClass || ''"
7991
8107
  [disabled]="options?.readonly"
7992
- (click)="addItem($event)">
8108
+ (click)="addItem($event)"
8109
+ [appStopPropagation]="['mousedown', 'touchstart']"
8110
+ >
7993
8111
  <span *ngIf="options?.icon" [class]="options?.icon"></span>
7994
8112
  <span *ngIf="options?.title" [innerHTML]="buttonText"></span>
8113
+
7995
8114
  </button>
7996
8115
  </section>`,
7997
8116
  changeDetection: ChangeDetectionStrategy.Default,
@@ -8035,12 +8154,14 @@ class ButtonComponent {
8035
8154
  [name]="controlName"
8036
8155
  [type]="layoutNode()?.type"
8037
8156
  [value]="controlValue"
8038
- (click)="updateValue($event)">
8157
+ (click)="updateValue($event)"
8158
+ [appStopPropagation]="['mousedown', 'touchstart']"
8159
+ >
8039
8160
  <span *ngIf="options?.icon || options?.title"
8040
8161
  [class]="options?.icon"
8041
8162
  [innerHTML]="options?.title"></span>
8042
8163
  </button>
8043
- </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
8164
+ </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: ["appStopPropagation"] }] }); }
8044
8165
  }
8045
8166
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: ButtonComponent, decorators: [{
8046
8167
  type: Component,
@@ -8058,7 +8179,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
8058
8179
  [name]="controlName"
8059
8180
  [type]="layoutNode()?.type"
8060
8181
  [value]="controlValue"
8061
- (click)="updateValue($event)">
8182
+ (click)="updateValue($event)"
8183
+ [appStopPropagation]="['mousedown', 'touchstart']"
8184
+ >
8062
8185
  <span *ngIf="options?.icon || options?.title"
8063
8186
  [class]="options?.icon"
8064
8187
  [innerHTML]="options?.title"></span>
@@ -8072,6 +8195,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
8072
8195
  //this mainly affects checkboxes coupled with conditions
8073
8196
  //-the value is rechecked
8074
8197
  //-see https://github.com/SortableJS/Sortable/issues/1052#issuecomment-369613072
8198
+ //-switched to angular cdk for dnd
8075
8199
  class CheckboxComponent {
8076
8200
  constructor() {
8077
8201
  this.jsf = inject(JsonSchemaFormService);
@@ -8431,7 +8555,7 @@ class InputComponent {
8431
8555
  }
8432
8556
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8433
8557
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: InputComponent, isStandalone: false, selector: "input-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
8434
- <div [class]="options?.htmlClass || ''" class="sortable-filter" >
8558
+ <div [class]="options?.htmlClass || ''" >
8435
8559
  <label *ngIf="options?.title"
8436
8560
  [attr.for]="'control' + layoutNode()?._id"
8437
8561
  [class]="options?.labelHtmlClass || ''"
@@ -8452,6 +8576,7 @@ class InputComponent {
8452
8576
  [readonly]="options?.readonly ? 'readonly' : null"
8453
8577
  [type]="layoutNode()?.type"
8454
8578
  [attributes]="inputAttributes"
8579
+ [appStopPropagation]="['mousedown', 'touchstart']"
8455
8580
  >
8456
8581
  <input *ngIf="!boundControl"
8457
8582
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
@@ -8470,12 +8595,13 @@ class InputComponent {
8470
8595
  [value]="controlValue"
8471
8596
  (input)="updateValue($event)"
8472
8597
  [attributes]="inputAttributes"
8598
+ [appStopPropagation]="['mousedown', 'touchstart']"
8473
8599
  >
8474
8600
  <datalist *ngIf="options?.typeahead?.source"
8475
8601
  [id]="'control' + layoutNode()?._id + 'Autocomplete'">
8476
8602
  <option *ngFor="let word of options?.typeahead?.source" [value]="word">
8477
8603
  </datalist>
8478
- </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: ElementAttributeDirective, selector: "[attributes]", inputs: ["attributes"] }] }); }
8604
+ </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: ElementAttributeDirective, selector: "[attributes]", inputs: ["attributes"] }, { kind: "directive", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: ["appStopPropagation"] }] }); }
8479
8605
  }
8480
8606
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InputComponent, decorators: [{
8481
8607
  type: Component,
@@ -8483,7 +8609,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
8483
8609
  // tslint:disable-next-line:component-selector
8484
8610
  selector: 'input-widget',
8485
8611
  template: `
8486
- <div [class]="options?.htmlClass || ''" class="sortable-filter" >
8612
+ <div [class]="options?.htmlClass || ''" >
8487
8613
  <label *ngIf="options?.title"
8488
8614
  [attr.for]="'control' + layoutNode()?._id"
8489
8615
  [class]="options?.labelHtmlClass || ''"
@@ -8504,6 +8630,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
8504
8630
  [readonly]="options?.readonly ? 'readonly' : null"
8505
8631
  [type]="layoutNode()?.type"
8506
8632
  [attributes]="inputAttributes"
8633
+ [appStopPropagation]="['mousedown', 'touchstart']"
8507
8634
  >
8508
8635
  <input *ngIf="!boundControl"
8509
8636
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
@@ -8522,6 +8649,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
8522
8649
  [value]="controlValue"
8523
8650
  (input)="updateValue($event)"
8524
8651
  [attributes]="inputAttributes"
8652
+ [appStopPropagation]="['mousedown', 'touchstart']"
8525
8653
  >
8526
8654
  <datalist *ngIf="options?.typeahead?.source"
8527
8655
  [id]="'control' + layoutNode()?._id + 'Autocomplete'">
@@ -8616,7 +8744,7 @@ class NumberComponent {
8616
8744
  }
8617
8745
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NumberComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8618
8746
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: NumberComponent, isStandalone: false, selector: "number-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "inputControl", first: true, predicate: ["inputControl"], descendants: true }, { propertyName: "div", first: true, predicate: ["divElt"], descendants: true }], ngImport: i0, template: `
8619
- <div #divElt [class]="options?.htmlClass || ''" class="sortable-filter" >
8747
+ <div #divElt [class]="options?.htmlClass || ''" >
8620
8748
  <label *ngIf="options?.title"
8621
8749
  [attr.for]="'control' + layoutNode()?._id"
8622
8750
  [class]="options?.labelHtmlClass || ''"
@@ -8638,7 +8766,7 @@ class NumberComponent {
8638
8766
  [title]="lastValidNumber"
8639
8767
  [type]="layoutNode()?.type === 'range' ? 'range' : 'number'"
8640
8768
  [attributes]="inputAttributes"
8641
-
8769
+ [appStopPropagation]="['mousedown', 'touchstart']"
8642
8770
  >
8643
8771
  <input #inputControl *ngIf="!boundControl"
8644
8772
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
@@ -8658,9 +8786,10 @@ class NumberComponent {
8658
8786
  [value]="controlValue"
8659
8787
  (input)="updateValue($event)"
8660
8788
  [attributes]="inputAttributes"
8789
+ [appStopPropagation]="['mousedown', 'touchstart']"
8661
8790
  >
8662
8791
  <span *ngIf="layoutNode()?.type === 'range'" [innerHTML]="controlValue"></span>
8663
- </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: ElementAttributeDirective, selector: "[attributes]", inputs: ["attributes"] }] }); }
8792
+ </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: ElementAttributeDirective, selector: "[attributes]", inputs: ["attributes"] }, { kind: "directive", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: ["appStopPropagation"] }] }); }
8664
8793
  }
8665
8794
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NumberComponent, decorators: [{
8666
8795
  type: Component,
@@ -8668,7 +8797,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
8668
8797
  // tslint:disable-next-line:component-selector
8669
8798
  selector: 'number-widget',
8670
8799
  template: `
8671
- <div #divElt [class]="options?.htmlClass || ''" class="sortable-filter" >
8800
+ <div #divElt [class]="options?.htmlClass || ''" >
8672
8801
  <label *ngIf="options?.title"
8673
8802
  [attr.for]="'control' + layoutNode()?._id"
8674
8803
  [class]="options?.labelHtmlClass || ''"
@@ -8690,7 +8819,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
8690
8819
  [title]="lastValidNumber"
8691
8820
  [type]="layoutNode()?.type === 'range' ? 'range' : 'number'"
8692
8821
  [attributes]="inputAttributes"
8693
-
8822
+ [appStopPropagation]="['mousedown', 'touchstart']"
8694
8823
  >
8695
8824
  <input #inputControl *ngIf="!boundControl"
8696
8825
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
@@ -8710,6 +8839,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
8710
8839
  [value]="controlValue"
8711
8840
  (input)="updateValue($event)"
8712
8841
  [attributes]="inputAttributes"
8842
+ [appStopPropagation]="['mousedown', 'touchstart']"
8713
8843
  >
8714
8844
  <span *ngIf="layoutNode()?.type === 'range'" [innerHTML]="controlValue"></span>
8715
8845
  </div>`,
@@ -8726,6 +8856,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
8726
8856
  class SelectFrameworkComponent {
8727
8857
  constructor() {
8728
8858
  this.jsf = inject(JsonSchemaFormService);
8859
+ this.changeDetectorRef = inject(ChangeDetectorRef);
8729
8860
  this.newComponent = null;
8730
8861
  this.layoutNode = input(undefined);
8731
8862
  this.layoutIndex = input(undefined);
@@ -8735,7 +8866,7 @@ class SelectFrameworkComponent {
8735
8866
  ngOnInit() {
8736
8867
  this.updateComponent();
8737
8868
  }
8738
- ngOnChanges() {
8869
+ ngOnChanges(changes) {
8739
8870
  this.updateComponent();
8740
8871
  }
8741
8872
  updateComponent() {
@@ -8746,9 +8877,12 @@ class SelectFrameworkComponent {
8746
8877
  //this.widgetContainer.createComponent<any>(this.jsf.framework)
8747
8878
  }
8748
8879
  if (this.newComponent) {
8749
- for (const input of ['layoutNode', 'layoutIndex', 'dataIndex']) {
8750
- this.newComponent.instance[input] = this[input];
8880
+ for (const inp of ['layoutNode', 'layoutIndex', 'dataIndex']) {
8881
+ //this.newComponent.instance[inp] = this[inp];
8882
+ this.newComponent.setInput(inp, this[inp]());
8751
8883
  }
8884
+ // Manually trigger change detection after updating inputs
8885
+ //this.changeDetectorRef.detectChanges();
8752
8886
  }
8753
8887
  }
8754
8888
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SelectFrameworkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
@@ -8767,6 +8901,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
8767
8901
  class TabsComponent {
8768
8902
  constructor() {
8769
8903
  this.jsf = inject(JsonSchemaFormService);
8904
+ this.cdr = inject(ChangeDetectorRef);
8770
8905
  this.selectedItem = 0;
8771
8906
  this.showAddTab = true;
8772
8907
  this.layoutNode = input(undefined);
@@ -8780,6 +8915,12 @@ class TabsComponent {
8780
8915
  }
8781
8916
  this.itemCount = this.layoutNode().items.length - 1;
8782
8917
  this.updateControl();
8918
+ //TODO review/test-introduced to fix dynamic titles not updating
8919
+ //when their conditional linked field is destroyed
8920
+ //-forces change detection!
8921
+ this.jsf.dataChanges.subscribe((val) => {
8922
+ this.cdr.detectChanges();
8923
+ });
8783
8924
  }
8784
8925
  select(index) {
8785
8926
  const layoutNode = this.layoutNode();
@@ -8804,6 +8945,9 @@ class TabsComponent {
8804
8945
  setTabTitle(item, index) {
8805
8946
  return this.jsf.setArrayItemTitle(this, item, index);
8806
8947
  }
8948
+ ngOnDestroy() {
8949
+ this.dataChangesSubs?.unsubscribe();
8950
+ }
8807
8951
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8808
8952
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: TabsComponent, isStandalone: false, selector: "tabs-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
8809
8953
  <ul
@@ -8827,6 +8971,7 @@ class TabsComponent {
8827
8971
  />
8828
8972
  {{setTabTitle(item, i)}}
8829
8973
  </a>
8974
+
8830
8975
  </li>
8831
8976
  </ul>
8832
8977
 
@@ -8881,6 +9026,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
8881
9026
  />
8882
9027
  {{setTabTitle(item, i)}}
8883
9028
  </a>
9029
+
8884
9030
  </li>
8885
9031
  </ul>
8886
9032
 
@@ -9172,240 +9318,93 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
9172
9318
  }]
9173
9319
  }] });
9174
9320
 
9175
- /**
9176
- * OrderableDirective
9177
- *
9178
- * Enables array elements to be reordered by dragging and dropping.
9179
- *
9180
- * Only works for arrays that have at least two elements.
9181
- *
9182
- * Also detects arrays-within-arrays, and correctly moves either
9183
- * the child array element or the parent array element,
9184
- * depending on the drop targert.
9185
- *
9186
- * Listeners for movable element being dragged:
9187
- * - dragstart: add 'dragging' class to element, set effectAllowed = 'move'
9188
- * - dragover: set dropEffect = 'move'
9189
- * - dragend: remove 'dragging' class from element
9190
- *
9191
- * Listeners for stationary items being dragged over:
9192
- * - dragenter: add 'drag-target-...' classes to element
9193
- * - dragleave: remove 'drag-target-...' classes from element
9194
- * - drop: remove 'drag-target-...' classes from element, move dropped array item
9195
- */
9196
- class OrderableDirective {
9197
- constructor() {
9198
- this.elementRef = inject(ElementRef);
9199
- this.jsf = inject(JsonSchemaFormService);
9200
- this.ngZone = inject(NgZone);
9201
- this.overParentElement = false;
9202
- this.overChildElement = false;
9203
- this.orderable = input(undefined);
9204
- this.layoutNode = input(undefined);
9205
- this.layoutIndex = input(undefined);
9206
- this.dataIndex = input(undefined);
9207
- }
9208
- ngOnInit() {
9209
- const layoutIndex = this.layoutIndex();
9210
- if (this.orderable() && this.layoutNode() && layoutIndex && this.dataIndex()) {
9211
- this.element = this.elementRef.nativeElement;
9212
- this.element.draggable = true;
9213
- this.arrayLayoutIndex = 'move:' + layoutIndex.slice(0, -1).toString();
9214
- this.ngZone.runOutsideAngular(() => {
9215
- // Listeners for movable element being dragged:
9216
- this.element.addEventListener('dragstart', (event) => {
9217
- event.dataTransfer.effectAllowed = 'move';
9218
- event.dataTransfer.setData('text', '');
9219
- // Hack to bypass stupid HTML drag-and-drop dataTransfer protection
9220
- // so drag source info will be available on dragenter
9221
- const sourceArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
9222
- sessionStorage.setItem(this.arrayLayoutIndex, sourceArrayIndex + '');
9223
- });
9224
- this.element.addEventListener('dragover', (event) => {
9225
- if (event.preventDefault) {
9226
- event.preventDefault();
9227
- }
9228
- event.dataTransfer.dropEffect = 'move';
9229
- return false;
9230
- });
9231
- // Listeners for stationary items being dragged over:
9232
- this.element.addEventListener('dragenter', (event) => {
9233
- // Part 1 of a hack, inspired by Dragster, to simulate mouseover and mouseout
9234
- // behavior while dragging items - http://bensmithett.github.io/dragster/
9235
- if (this.overParentElement) {
9236
- return this.overChildElement = true;
9237
- }
9238
- else {
9239
- this.overParentElement = true;
9240
- }
9241
- const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
9242
- if (sourceArrayIndex !== null) {
9243
- if (this.dataIndex()[this.dataIndex().length - 1] < +sourceArrayIndex) {
9244
- this.element.classList.add('drag-target-top');
9245
- }
9246
- else if (this.dataIndex()[this.dataIndex().length - 1] > +sourceArrayIndex) {
9247
- this.element.classList.add('drag-target-bottom');
9248
- }
9249
- }
9250
- });
9251
- this.element.addEventListener('dragleave', (event) => {
9252
- // Part 2 of the Dragster hack
9253
- if (this.overChildElement) {
9254
- this.overChildElement = false;
9255
- }
9256
- else if (this.overParentElement) {
9257
- this.overParentElement = false;
9258
- }
9259
- const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
9260
- if (!this.overParentElement && !this.overChildElement && sourceArrayIndex !== null) {
9261
- this.element.classList.remove('drag-target-top');
9262
- this.element.classList.remove('drag-target-bottom');
9263
- }
9264
- });
9265
- this.element.addEventListener('drop', (event) => {
9266
- this.element.classList.remove('drag-target-top');
9267
- this.element.classList.remove('drag-target-bottom');
9268
- // Confirm that drop target is another item in the same array as source item
9269
- const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
9270
- const destArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
9271
- if (sourceArrayIndex !== null && +sourceArrayIndex !== destArrayIndex) {
9272
- // Move array item
9273
- this.jsf.moveArrayItem(this, +sourceArrayIndex, destArrayIndex);
9274
- }
9275
- sessionStorage.removeItem(this.arrayLayoutIndex);
9276
- return false;
9277
- });
9278
- });
9279
- // Subscribe to the draggable state
9280
- this.draggableStateSubscription = this.jsf.draggableState$.subscribe((value) => {
9281
- this.element.draggable = value;
9282
- });
9283
- }
9284
- }
9285
- ngOnDestroy() {
9286
- if (this.draggableStateSubscription) {
9287
- this.draggableStateSubscription.unsubscribe();
9288
- }
9289
- }
9290
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OrderableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
9291
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.14", type: OrderableDirective, isStandalone: false, selector: "[orderable]", inputs: { orderable: { classPropertyName: "orderable", publicName: "orderable", isSignal: true, isRequired: false, transformFunction: null }, layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
9292
- }
9293
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OrderableDirective, decorators: [{
9294
- type: Directive,
9295
- args: [{
9296
- // tslint:disable-next-line:directive-selector
9297
- selector: '[orderable]',
9298
- standalone: false
9299
- }]
9300
- }] });
9301
-
9302
9321
  class RootComponent {
9303
9322
  constructor() {
9304
9323
  this.jsf = inject(JsonSchemaFormService);
9324
+ this.cdr = inject(ChangeDetectorRef);
9305
9325
  this.dataIndex = input(undefined);
9306
9326
  this.layoutIndex = input(undefined);
9307
9327
  this.layout = input(undefined);
9308
9328
  this.isOrderable = input(undefined);
9309
9329
  this.isFlexItem = input(false);
9310
- this.sortableConfig = {
9311
- filter: ".sortable-filter", //needed to disable dragging on input range elements, class needs to be added to the element or its parent
9312
- preventOnFilter: false, //needed for input range elements slider do still work
9313
- delay: 1000,
9314
- delayOnTouchOnly: true,
9315
- onEnd: (/**Event*/ evt) => {
9316
- evt.newIndex; // most likely why this event is used is to get the dragging element's current index
9317
- // same properties as onEnd
9318
- //console.log(`sortablejs event:${evt}`);
9319
- let srcInd = evt.oldIndex;
9320
- let trgInd = evt.newIndex;
9321
- let layoutItem = this.layout()[trgInd];
9322
- let dataInd = layoutItem?.arrayItem ? (this.dataIndex() || []).concat(trgInd) : (this.dataIndex() || []);
9323
- let layoutInd = (this.layoutIndex() || []).concat(trgInd);
9324
- let itemCtx = {
9325
- dataIndex: () => { return dataInd; },
9326
- layoutIndex: () => { return layoutInd; },
9327
- layoutNode: () => { return layoutItem; },
9328
- };
9329
- //must set moveLayout to false as nxtSortable already moves it
9330
- this.jsf.moveArrayItem(itemCtx, evt.oldIndex, evt.newIndex, false);
9331
- },
9332
- onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
9333
- if (evt.related.classList.contains("sortable-fixed")) {
9334
- //console.log(evt.related);
9335
- return false;
9336
- }
9337
- }
9330
+ this.memoizationEnabled = input(true);
9331
+ /**
9332
+ * Predicate function that disallows '$ref' item sorts
9333
+ * NB declared as a var instead of a function
9334
+ * like sortPredicate(index: number, item: CdkDrag<number>){..}
9335
+ * since 'this' is bound to the draglist and doesn't reference the
9336
+ * FlexLayoutRootComponent instance
9337
+ */
9338
+ //TODO also need to think of other types such as button which can be
9339
+ //created by an arbitrary layout
9340
+ //might not be needed added condition to [cdkDragDisabled]
9341
+ this.sortPredicate = (index, item) => {
9342
+ let layoutItem = this.layout()[index];
9343
+ let result = this.isDraggable(layoutItem);
9344
+ //layoutItem.type != '$ref';
9345
+ return result;
9338
9346
  };
9339
- }
9340
- sortableInit(sortable) {
9341
- this.sortableObj = sortable;
9342
- //Sortable.utils.on(this.sortableObj.el,"nulling",(s)=>{console.log("event nulling sortablejs")})
9343
- ///NB issue caused by sortablejs when it its destroyed
9344
- //this mainly affects checkboxes coupled with conditions
9345
- //-the value is rechecked
9346
- //-see https://github.com/SortableJS/Sortable/issues/1052#issuecomment-369613072
9347
- /* attempt to monkey patch sortable js
9348
- const originalMethod = sortable._nulling;
9349
- let zone=this.zone;
9350
- sortable._nulling=function() {
9351
- console.log(`pluginEvent 2 ${pluginEvent}`)
9352
- zone.runOutsideAngular(() => {
9353
- console.log(`pluginEvent3 ${pluginEvent}`)
9354
- pluginEvent('nulling', this);
9355
-
9356
- rootEl =
9357
- dragEl =
9358
- parentEl =
9359
- ghostEl =
9360
- nextEl =
9361
- cloneEl =
9362
- lastDownEl =
9363
- cloneHidden =
9364
-
9365
- tapEvt =
9366
- touchEvt =
9347
+ //private selectframeworkInputCache = new Map<string, { dataIndex: any[], layoutIndex: any[], layoutNode: any }>();
9348
+ //TODO review caching-if form field values change, the changes are not propagated
9349
+ /*
9350
+ getSelectFrameworkInputs(layoutItem: any, i: number) {
9351
+ // Create a unique key based on the layoutItem and index
9352
+ const cacheKey = `${layoutItem._id}-${i}`;
9353
+
9354
+ // If the result is already in the cache, return it
9355
+ if(this.enableCaching){
9356
+ if (this.selectframeworkInputCache.has(cacheKey)) {
9357
+ return this.selectframeworkInputCache.get(cacheKey);
9358
+ }
9359
+ }
9367
9360
 
9368
- moved =
9369
- newIndex =
9370
- newDraggableIndex =
9371
- oldIndex =
9372
- oldDraggableIndex =
9373
9361
 
9374
- lastTarget =
9375
- lastDirection =
9362
+ // If not cached, calculate the values (assuming dataIndex() and layoutIndex() are functions)
9363
+ const dataIndex = layoutItem?.arrayItem ? (this.dataIndex() || []).concat(i) : (this.dataIndex() || []);
9364
+ const layoutIndex = (this.layoutIndex() || []).concat(i);
9376
9365
 
9377
- putSortable =
9378
- activeGroup =
9379
- Sortable.dragged =
9380
- Sortable.ghost =
9381
- Sortable.clone =
9382
- Sortable.active = null;
9366
+ // Save the result in the cache
9367
+ const result = { dataIndex, layoutIndex, layoutNode: layoutItem };
9368
+ if(this.enableCaching){
9369
+ this.selectframeworkInputCache.set(cacheKey, result);
9370
+ }
9383
9371
 
9384
-
9385
- let el = this.el;
9386
- savedInputChecked.forEach(function (checkEl) {
9387
- if (el.contains(checkEl)) {
9388
- checkEl.checked = true;
9389
- }
9390
- });
9391
-
9392
- savedInputChecked.length =
9393
- lastDx =
9394
- lastDy = 0;
9395
-
9396
- })
9397
-
9398
- }.bind(sortable)
9399
- */
9372
+ return result;
9373
+ }
9374
+ */
9375
+ this._getSelectFrameworkInputsRaw = (layoutItem, i) => {
9376
+ const dataIndexValue = this.dataIndex() || [];
9377
+ const layoutIndexValue = this.layoutIndex() || [];
9378
+ return {
9379
+ layoutNode: layoutItem,
9380
+ layoutIndex: [...layoutIndexValue, i],
9381
+ dataIndex: layoutItem?.arrayItem ? [...dataIndexValue, i] : dataIndexValue,
9382
+ };
9383
+ };
9384
+ // Define a separate function to hold the memoized version
9385
+ this._getSelectFrameworkInputsMemoized = memoize(this._getSelectFrameworkInputsRaw, (layoutItem, i) => {
9386
+ const layoutItemKey = layoutItem?.id ?? JSON.stringify(layoutItem);
9387
+ return `${layoutItemKey}-${i}`;
9388
+ });
9389
+ }
9390
+ drop(event) {
9391
+ // most likely why this event is used is to get the dragging element's current index
9392
+ let srcInd = event.previousIndex;
9393
+ let trgInd = event.currentIndex;
9394
+ let layoutItem = this.layout()[trgInd];
9395
+ let dataInd = layoutItem?.arrayItem ? (this.dataIndex() || []).concat(trgInd) : (this.dataIndex() || []);
9396
+ let layoutInd = (this.layoutIndex() || []).concat(trgInd);
9397
+ let itemCtx = {
9398
+ dataIndex: () => { return dataInd; },
9399
+ layoutIndex: () => { return layoutInd; },
9400
+ layoutNode: () => { return layoutItem; },
9401
+ };
9402
+ this.jsf.moveArrayItem(itemCtx, srcInd, trgInd, true);
9400
9403
  }
9401
9404
  isDraggable(node) {
9402
9405
  let result = node.arrayItem && node.type !== '$ref' &&
9403
- node.arrayItemType === 'list' && this.isOrderable() !== false;
9404
- if (this.sortableObj) {
9405
- //this.sortableObj.option("disabled",true);
9406
- //this.sortableObj.option("sort",false);
9407
- //this.sortableObj.option("disabled",!result);
9408
- }
9406
+ node.arrayItemType === 'list' && this.isOrderable() !== false
9407
+ && node.type !== 'submit';
9409
9408
  return result;
9410
9409
  }
9411
9410
  //TODO also need to think of other types such as button which can be
@@ -9421,93 +9420,162 @@ class RootComponent {
9421
9420
  return ((node.options || {}).flex || '').split(/\s+/)[index] ||
9422
9421
  (node.options || {})[attribute] || ['1', '1', 'auto'][index];
9423
9422
  }
9423
+ // This is the public function that the template calls
9424
+ getSelectFrameworkInputs(layoutItem, i) {
9425
+ if (this.memoizationEnabled) {
9426
+ return this._getSelectFrameworkInputsMemoized(layoutItem, i);
9427
+ }
9428
+ else {
9429
+ return this._getSelectFrameworkInputsRaw(layoutItem, i);
9430
+ }
9431
+ }
9432
+ trackByFn(index, item) {
9433
+ return item._id ?? index;
9434
+ }
9435
+ /*
9436
+ ngOnChanges(changes: SimpleChanges): void {
9437
+ // If any of the input properties change, clear the cache
9438
+ if (changes.dataIndex || changes.layoutIndex || changes.layout) {
9439
+ this.selectframeworkInputCache?.clear(); // Clear the entire cache
9440
+ }
9441
+ }
9442
+ */
9443
+ ngOnChanges(changes) {
9444
+ if (changes['layout'] || changes['dataIndex'] || changes['layoutIndex']) {
9445
+ // Clear the entire cache of the memoized function
9446
+ this._getSelectFrameworkInputsMemoized.cache.clear();
9447
+ this.cdr.markForCheck();
9448
+ }
9449
+ }
9424
9450
  showWidget(layoutNode) {
9425
9451
  return this.jsf.evaluateCondition(layoutNode, this.dataIndex());
9426
9452
  }
9427
9453
  ngOnInit() {
9428
- // Subscribe to the draggable state
9429
- this.sortableOptionsSubscription = this.jsf.sortableOptions$.subscribe((optsValue) => {
9430
- if (this.sortableObj) {
9431
- Object.keys(optsValue).forEach(opt => {
9432
- let optVal = optsValue[opt];
9433
- this.sortableObj.option(opt, optVal);
9434
- });
9435
- //this.sortableObj.option("disabled",true);
9436
- //this.sortableObj.option("sort",false);
9437
- }
9438
- });
9454
+ if (this.memoizationEnabled) {
9455
+ this.jsf.dataChanges.subscribe((val) => {
9456
+ //this.selectframeworkInputCache?.clear();
9457
+ this._getSelectFrameworkInputsMemoized.cache.clear();
9458
+ //TODO-fix for now changed to detectChanges-
9459
+ //used to updated the dynamic titles in tab compnents
9460
+ this.cdr.markForCheck();
9461
+ // this.cdr.detectChanges();-breaks oneOf/ matdatepicker
9462
+ });
9463
+ }
9439
9464
  }
9440
9465
  ngOnDestroy() {
9441
- if (this.sortableOptionsSubscription) {
9442
- this.sortableOptionsSubscription.unsubscribe();
9443
- }
9466
+ //this.selectframeworkInputCache?.clear()
9467
+ //this.selectframeworkInputCache=null;
9468
+ this._getSelectFrameworkInputsMemoized.cache.clear();
9469
+ this.dataChangesSubs?.unsubscribe();
9444
9470
  }
9445
9471
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: RootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9446
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: RootComponent, isStandalone: false, selector: "root-widget", inputs: { dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, isOrderable: { classPropertyName: "isOrderable", publicName: "isOrderable", isSignal: true, isRequired: false, transformFunction: null }, isFlexItem: { classPropertyName: "isFlexItem", publicName: "isFlexItem", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
9447
- <div [class.flex-inherit]="true" #sortableContainter [nxtSortablejs]="layout()" [config]="sortableConfig" (init)="sortableInit($event)">
9448
- <div *ngFor="let layoutItem of layout(); let i = index"
9472
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: RootComponent, isStandalone: false, selector: "root-widget", inputs: { dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, isOrderable: { classPropertyName: "isOrderable", publicName: "isOrderable", isSignal: true, isRequired: false, transformFunction: null }, isFlexItem: { classPropertyName: "isFlexItem", publicName: "isFlexItem", isSignal: true, isRequired: false, transformFunction: null }, memoizationEnabled: { classPropertyName: "memoizationEnabled", publicName: "memoizationEnabled", isSignal: true, isRequired: false, transformFunction: null } }, usesOnChanges: true, ngImport: i0, template: `
9473
+ <div cdkDropList (cdkDropListDropped)="drop($event)"
9474
+ [class.flex-inherit]="true"
9475
+ [cdkDropListSortPredicate]="sortPredicate"
9476
+ >
9477
+ <!-- -for now left out
9478
+ cdkDragHandle directive, by itself, does not disable the
9479
+ default drag behavior of its parent cdkDrag element.
9480
+ You must explicitly disable dragging on the main element
9481
+ and re-enable it only when using the handle.
9482
+ -->
9483
+ <div *ngFor="let layoutItem of layout(); let i = index;trackBy: trackByFn"
9484
+ cdkDrag [cdkDragStartDelay]="{touch:1000,mouse:0}"
9485
+ [cdkDragDisabled]="!isDraggable(layoutItem)"
9449
9486
  [class.form-flex-item]="isFlexItem()"
9450
9487
  [style.align-self]="(layoutItem.options || {})['align-self']"
9451
9488
  [style.flex-basis]="getFlexAttribute(layoutItem, 'flex-basis')"
9452
9489
  [style.flex-grow]="getFlexAttribute(layoutItem, 'flex-grow')"
9453
9490
  [style.flex-shrink]="getFlexAttribute(layoutItem, 'flex-shrink')"
9454
9491
  [style.order]="(layoutItem.options || {}).order"
9455
- [class.sortable-filter]="!isDraggable(layoutItem)"
9456
- [class.sortable-fixed]="isFixed(layoutItem)"
9457
9492
  >
9493
+
9494
+ <!-- workaround to disbale dragging of input fields -->
9495
+ <!--
9496
+ <div *ngIf="layoutItem?.dataType !='object'" cdkDragHandle>
9497
+ <p>Drag Handle {{layoutItem?.dataType}}</p>
9498
+ </div>
9499
+ -->
9458
9500
  <!--NB orderable directive is not used but has been left in for now and set to false
9459
9501
  otherwise the compiler won't recognize dataIndex and other dependent attributes
9460
9502
  -->
9503
+ <!--
9461
9504
  <div
9462
9505
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
9463
9506
  [layoutIndex]="(layoutIndex() || []).concat(i)"
9464
9507
  [layoutNode]="layoutItem"
9465
9508
  [orderable]="false"
9466
- [class.sortable-filter]="!isDraggable(layoutItem)"
9467
- [class.sortable-fixed]="isFixed(layoutItem)"
9468
9509
  >
9469
9510
  <select-framework-widget *ngIf="showWidget(layoutItem)"
9470
9511
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
9471
9512
  [layoutIndex]="(layoutIndex() || []).concat(i)"
9472
9513
  [layoutNode]="layoutItem"></select-framework-widget>
9473
9514
  </div>
9515
+ -->
9516
+ <select-framework-widget *ngIf="showWidget(layoutItem)"
9517
+ [dataIndex]="getSelectFrameworkInputs(layoutItem,i).dataIndex"
9518
+ [layoutIndex]="getSelectFrameworkInputs(layoutItem,i).layoutIndex"
9519
+ [layoutNode]="getSelectFrameworkInputs(layoutItem,i).layoutNode">
9520
+ </select-framework-widget>
9474
9521
  </div>
9475
9522
  </div>
9476
- `, 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"] }] }); }
9523
+ `, isInline: true, styles: ["[draggable=true]{transition:all .15s cubic-bezier(.4,0,.2,1)}[draggable=true]:hover{cursor:move;box-shadow:2px 2px 4px #0003;position:relative;z-index:10;margin:-1px 1px 1px -1px}[draggable=true].drag-target-top{box-shadow:0 -2px #000;position:relative;z-index:20}[draggable=true].drag-target-bottom{box-shadow:0 2px #000;position:relative;z-index:20}.flex-inherit{display:inherit;flex-flow:inherit;flex-wrap:inherit;flex-direction:inherit;width:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: SelectFrameworkComponent, selector: "select-framework-widget", inputs: ["layoutNode", "layoutIndex", "dataIndex"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9477
9524
  }
9478
9525
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: RootComponent, decorators: [{
9479
9526
  type: Component,
9480
9527
  args: [{ selector: 'root-widget', template: `
9481
- <div [class.flex-inherit]="true" #sortableContainter [nxtSortablejs]="layout()" [config]="sortableConfig" (init)="sortableInit($event)">
9482
- <div *ngFor="let layoutItem of layout(); let i = index"
9528
+ <div cdkDropList (cdkDropListDropped)="drop($event)"
9529
+ [class.flex-inherit]="true"
9530
+ [cdkDropListSortPredicate]="sortPredicate"
9531
+ >
9532
+ <!-- -for now left out
9533
+ cdkDragHandle directive, by itself, does not disable the
9534
+ default drag behavior of its parent cdkDrag element.
9535
+ You must explicitly disable dragging on the main element
9536
+ and re-enable it only when using the handle.
9537
+ -->
9538
+ <div *ngFor="let layoutItem of layout(); let i = index;trackBy: trackByFn"
9539
+ cdkDrag [cdkDragStartDelay]="{touch:1000,mouse:0}"
9540
+ [cdkDragDisabled]="!isDraggable(layoutItem)"
9483
9541
  [class.form-flex-item]="isFlexItem()"
9484
9542
  [style.align-self]="(layoutItem.options || {})['align-self']"
9485
9543
  [style.flex-basis]="getFlexAttribute(layoutItem, 'flex-basis')"
9486
9544
  [style.flex-grow]="getFlexAttribute(layoutItem, 'flex-grow')"
9487
9545
  [style.flex-shrink]="getFlexAttribute(layoutItem, 'flex-shrink')"
9488
9546
  [style.order]="(layoutItem.options || {}).order"
9489
- [class.sortable-filter]="!isDraggable(layoutItem)"
9490
- [class.sortable-fixed]="isFixed(layoutItem)"
9491
9547
  >
9548
+
9549
+ <!-- workaround to disbale dragging of input fields -->
9550
+ <!--
9551
+ <div *ngIf="layoutItem?.dataType !='object'" cdkDragHandle>
9552
+ <p>Drag Handle {{layoutItem?.dataType}}</p>
9553
+ </div>
9554
+ -->
9492
9555
  <!--NB orderable directive is not used but has been left in for now and set to false
9493
9556
  otherwise the compiler won't recognize dataIndex and other dependent attributes
9494
9557
  -->
9558
+ <!--
9495
9559
  <div
9496
9560
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
9497
9561
  [layoutIndex]="(layoutIndex() || []).concat(i)"
9498
9562
  [layoutNode]="layoutItem"
9499
9563
  [orderable]="false"
9500
- [class.sortable-filter]="!isDraggable(layoutItem)"
9501
- [class.sortable-fixed]="isFixed(layoutItem)"
9502
9564
  >
9503
9565
  <select-framework-widget *ngIf="showWidget(layoutItem)"
9504
9566
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
9505
9567
  [layoutIndex]="(layoutIndex() || []).concat(i)"
9506
9568
  [layoutNode]="layoutItem"></select-framework-widget>
9507
9569
  </div>
9570
+ -->
9571
+ <select-framework-widget *ngIf="showWidget(layoutItem)"
9572
+ [dataIndex]="getSelectFrameworkInputs(layoutItem,i).dataIndex"
9573
+ [layoutIndex]="getSelectFrameworkInputs(layoutItem,i).layoutIndex"
9574
+ [layoutNode]="getSelectFrameworkInputs(layoutItem,i).layoutNode">
9575
+ </select-framework-widget>
9508
9576
  </div>
9509
9577
  </div>
9510
- `, 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"] }]
9578
+ `, 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"] }]
9511
9579
  }] });
9512
9580
 
9513
9581
  class SectionComponent {
@@ -9633,7 +9701,7 @@ class SectionComponent {
9633
9701
  [class]="options?.labelHelpBlockClass || ''"
9634
9702
  [innerHTML]="options?.description"></p>
9635
9703
  </div>
9636
- </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"] }] }); }
9704
+ </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"] }] }); }
9637
9705
  }
9638
9706
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SectionComponent, decorators: [{
9639
9707
  type: Component,
@@ -9978,8 +10046,10 @@ class SubmitComponent {
9978
10046
  [name]="controlName"
9979
10047
  [type]="layoutNode()?.type"
9980
10048
  [value]="controlValue"
9981
- (click)="updateValue($event)">
9982
- </div>`, isInline: true }); }
10049
+ (click)="updateValue($event)"
10050
+ [appStopPropagation]="['mousedown', 'touchstart']"
10051
+ >
10052
+ </div>`, isInline: true, dependencies: [{ kind: "directive", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: ["appStopPropagation"] }] }); }
9983
10053
  }
9984
10054
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SubmitComponent, decorators: [{
9985
10055
  type: Component,
@@ -9999,7 +10069,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
9999
10069
  [name]="controlName"
10000
10070
  [type]="layoutNode()?.type"
10001
10071
  [value]="controlValue"
10002
- (click)="updateValue($event)">
10072
+ (click)="updateValue($event)"
10073
+ [appStopPropagation]="['mousedown', 'touchstart']"
10074
+ >
10003
10075
  </div>`,
10004
10076
  standalone: false
10005
10077
  }]
@@ -10710,7 +10782,7 @@ class TabComponent {
10710
10782
  [dataIndex]="dataIndex()"
10711
10783
  [layoutIndex]="layoutIndex()"
10712
10784
  [layout]="layoutNode().items"></root-widget>
10713
- </div>`, isInline: true, dependencies: [{ kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }] }); }
10785
+ </div>`, isInline: true, dependencies: [{ kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem", "memoizationEnabled"] }] }); }
10714
10786
  }
10715
10787
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TabComponent, decorators: [{
10716
10788
  type: Component,
@@ -10728,6 +10800,133 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
10728
10800
  }]
10729
10801
  }] });
10730
10802
 
10803
+ /**
10804
+ * OrderableDirective
10805
+ *
10806
+ * Enables array elements to be reordered by dragging and dropping.
10807
+ *
10808
+ * Only works for arrays that have at least two elements.
10809
+ *
10810
+ * Also detects arrays-within-arrays, and correctly moves either
10811
+ * the child array element or the parent array element,
10812
+ * depending on the drop targert.
10813
+ *
10814
+ * Listeners for movable element being dragged:
10815
+ * - dragstart: add 'dragging' class to element, set effectAllowed = 'move'
10816
+ * - dragover: set dropEffect = 'move'
10817
+ * - dragend: remove 'dragging' class from element
10818
+ *
10819
+ * Listeners for stationary items being dragged over:
10820
+ * - dragenter: add 'drag-target-...' classes to element
10821
+ * - dragleave: remove 'drag-target-...' classes from element
10822
+ * - drop: remove 'drag-target-...' classes from element, move dropped array item
10823
+ */
10824
+ class OrderableDirective {
10825
+ constructor() {
10826
+ this.elementRef = inject(ElementRef);
10827
+ this.jsf = inject(JsonSchemaFormService);
10828
+ this.ngZone = inject(NgZone);
10829
+ this.overParentElement = false;
10830
+ this.overChildElement = false;
10831
+ this.orderable = input(undefined);
10832
+ this.layoutNode = input(undefined);
10833
+ this.layoutIndex = input(undefined);
10834
+ this.dataIndex = input(undefined);
10835
+ }
10836
+ ngOnInit() {
10837
+ const layoutIndex = this.layoutIndex();
10838
+ if (this.orderable() && this.layoutNode() && layoutIndex && this.dataIndex()) {
10839
+ this.element = this.elementRef.nativeElement;
10840
+ this.element.draggable = true;
10841
+ this.arrayLayoutIndex = 'move:' + layoutIndex.slice(0, -1).toString();
10842
+ this.ngZone.runOutsideAngular(() => {
10843
+ // Listeners for movable element being dragged:
10844
+ this.element.addEventListener('dragstart', (event) => {
10845
+ event.dataTransfer.effectAllowed = 'move';
10846
+ event.dataTransfer.setData('text', '');
10847
+ // Hack to bypass stupid HTML drag-and-drop dataTransfer protection
10848
+ // so drag source info will be available on dragenter
10849
+ const sourceArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
10850
+ sessionStorage.setItem(this.arrayLayoutIndex, sourceArrayIndex + '');
10851
+ });
10852
+ this.element.addEventListener('dragover', (event) => {
10853
+ if (event.preventDefault) {
10854
+ event.preventDefault();
10855
+ }
10856
+ event.dataTransfer.dropEffect = 'move';
10857
+ return false;
10858
+ });
10859
+ // Listeners for stationary items being dragged over:
10860
+ this.element.addEventListener('dragenter', (event) => {
10861
+ // Part 1 of a hack, inspired by Dragster, to simulate mouseover and mouseout
10862
+ // behavior while dragging items - http://bensmithett.github.io/dragster/
10863
+ if (this.overParentElement) {
10864
+ return this.overChildElement = true;
10865
+ }
10866
+ else {
10867
+ this.overParentElement = true;
10868
+ }
10869
+ const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
10870
+ if (sourceArrayIndex !== null) {
10871
+ if (this.dataIndex()[this.dataIndex().length - 1] < +sourceArrayIndex) {
10872
+ this.element.classList.add('drag-target-top');
10873
+ }
10874
+ else if (this.dataIndex()[this.dataIndex().length - 1] > +sourceArrayIndex) {
10875
+ this.element.classList.add('drag-target-bottom');
10876
+ }
10877
+ }
10878
+ });
10879
+ this.element.addEventListener('dragleave', (event) => {
10880
+ // Part 2 of the Dragster hack
10881
+ if (this.overChildElement) {
10882
+ this.overChildElement = false;
10883
+ }
10884
+ else if (this.overParentElement) {
10885
+ this.overParentElement = false;
10886
+ }
10887
+ const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
10888
+ if (!this.overParentElement && !this.overChildElement && sourceArrayIndex !== null) {
10889
+ this.element.classList.remove('drag-target-top');
10890
+ this.element.classList.remove('drag-target-bottom');
10891
+ }
10892
+ });
10893
+ this.element.addEventListener('drop', (event) => {
10894
+ this.element.classList.remove('drag-target-top');
10895
+ this.element.classList.remove('drag-target-bottom');
10896
+ // Confirm that drop target is another item in the same array as source item
10897
+ const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
10898
+ const destArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
10899
+ if (sourceArrayIndex !== null && +sourceArrayIndex !== destArrayIndex) {
10900
+ // Move array item
10901
+ this.jsf.moveArrayItem(this, +sourceArrayIndex, destArrayIndex);
10902
+ }
10903
+ sessionStorage.removeItem(this.arrayLayoutIndex);
10904
+ return false;
10905
+ });
10906
+ });
10907
+ // Subscribe to the draggable state
10908
+ this.draggableStateSubscription = this.jsf.draggableState$.subscribe((value) => {
10909
+ this.element.draggable = value;
10910
+ });
10911
+ }
10912
+ }
10913
+ ngOnDestroy() {
10914
+ if (this.draggableStateSubscription) {
10915
+ this.draggableStateSubscription.unsubscribe();
10916
+ }
10917
+ }
10918
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OrderableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
10919
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.14", type: OrderableDirective, isStandalone: false, selector: "[orderable]", inputs: { orderable: { classPropertyName: "orderable", publicName: "orderable", isSignal: true, isRequired: false, transformFunction: null }, layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
10920
+ }
10921
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OrderableDirective, decorators: [{
10922
+ type: Directive,
10923
+ args: [{
10924
+ // tslint:disable-next-line:directive-selector
10925
+ selector: '[orderable]',
10926
+ standalone: false
10927
+ }]
10928
+ }] });
10929
+
10731
10930
  const BASIC_WIDGETS = [
10732
10931
  AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent,
10733
10932
  CheckboxesComponent, FileComponent, HiddenComponent, InputComponent,
@@ -10739,39 +10938,16 @@ const BASIC_WIDGETS = [
10739
10938
 
10740
10939
  class WidgetLibraryModule {
10741
10940
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
10742
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryModule, declarations: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, 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] }); }
10743
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryModule, imports: [CommonModule, FormsModule, ReactiveFormsModule,
10744
- SortablejsModule.forRoot({
10745
- //disabled:false,
10746
- //draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
10747
- filter: ".sortable-filter", //needed to disable dragging on input range elements, class needs to be added to the element or its parent
10748
- preventOnFilter: false, //needed for input range elements slider do still work
10749
- onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
10750
- if (evt.related.classList.contains("sortable-fixed")) {
10751
- //console.log(evt.related);
10752
- return false;
10753
- }
10754
- }
10755
- })] }); }
10941
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryModule, declarations: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, 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] }); }
10942
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryModule, imports: [CommonModule, FormsModule, ReactiveFormsModule, DragDropModule] }); }
10756
10943
  }
10757
10944
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryModule, decorators: [{
10758
10945
  type: NgModule,
10759
10946
  args: [{
10760
- imports: [CommonModule, FormsModule, ReactiveFormsModule,
10761
- SortablejsModule.forRoot({
10762
- //disabled:false,
10763
- //draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
10764
- filter: ".sortable-filter", //needed to disable dragging on input range elements, class needs to be added to the element or its parent
10765
- preventOnFilter: false, //needed for input range elements slider do still work
10766
- onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
10767
- if (evt.related.classList.contains("sortable-fixed")) {
10768
- //console.log(evt.related);
10769
- return false;
10770
- }
10771
- }
10772
- })],
10773
- declarations: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective],
10774
- exports: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective]
10947
+ imports: [CommonModule, FormsModule, ReactiveFormsModule, DragDropModule
10948
+ ],
10949
+ declarations: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective, StopPropagationDirective],
10950
+ exports: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective, StopPropagationDirective]
10775
10951
  }]
10776
10952
  }] });
10777
10953
 
@@ -11546,7 +11722,7 @@ class JsonSchemaFormComponent {
11546
11722
  }
11547
11723
  }
11548
11724
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonSchemaFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
11549
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: JsonSchemaFormComponent, isStandalone: false, selector: "json-schema-form", inputs: { schema: { classPropertyName: "schema", publicName: "schema", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, framework: { classPropertyName: "framework", publicName: "framework", isSignal: true, isRequired: false, transformFunction: null }, widgets: { classPropertyName: "widgets", publicName: "widgets", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, JSONSchema: { classPropertyName: "JSONSchema", publicName: "JSONSchema", isSignal: true, isRequired: false, transformFunction: null }, UISchema: { classPropertyName: "UISchema", publicName: "UISchema", isSignal: true, isRequired: false, transformFunction: null }, formData: { classPropertyName: "formData", publicName: "formData", isSignal: true, isRequired: false, transformFunction: null }, ngModel: { classPropertyName: "ngModel", publicName: "ngModel", isSignal: true, isRequired: false, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, loadExternalAssets: { classPropertyName: "loadExternalAssets", publicName: "loadExternalAssets", isSignal: true, isRequired: false, transformFunction: null }, debug: { classPropertyName: "debug", publicName: "debug", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, ajvOptions: { classPropertyName: "ajvOptions", publicName: "ajvOptions", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { onChanges: "onChanges", onSubmit: "onSubmit", isValid: "isValid", validationErrors: "validationErrors", formSchema: "formSchema", formLayout: "formLayout", dataChange: "dataChange", modelChange: "modelChange", formDataChange: "formDataChange", ngModelChange: "ngModelChange" }, providers: [JsonSchemaFormService, JSON_SCHEMA_FORM_VALUE_ACCESSOR], usesOnChanges: true, ngImport: i0, template: "<form [autocomplete]=\"jsf?.formOptions?.autocomplete ? 'on' : 'off'\" class=\"json-schema-form\" (ngSubmit)=\"submitForm()\">\r\n <root-widget [layout]=\"jsf?.layout\"></root-widget>\r\n</form>\r\n<div *ngIf=\"debug() || jsf?.formOptions?.debug\">\r\n Debug output:\r\n <pre>{{debugOutput}}</pre>\r\n</div>", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
11725
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: JsonSchemaFormComponent, isStandalone: false, selector: "json-schema-form", inputs: { schema: { classPropertyName: "schema", publicName: "schema", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, framework: { classPropertyName: "framework", publicName: "framework", isSignal: true, isRequired: false, transformFunction: null }, widgets: { classPropertyName: "widgets", publicName: "widgets", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, JSONSchema: { classPropertyName: "JSONSchema", publicName: "JSONSchema", isSignal: true, isRequired: false, transformFunction: null }, UISchema: { classPropertyName: "UISchema", publicName: "UISchema", isSignal: true, isRequired: false, transformFunction: null }, formData: { classPropertyName: "formData", publicName: "formData", isSignal: true, isRequired: false, transformFunction: null }, ngModel: { classPropertyName: "ngModel", publicName: "ngModel", isSignal: true, isRequired: false, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, loadExternalAssets: { classPropertyName: "loadExternalAssets", publicName: "loadExternalAssets", isSignal: true, isRequired: false, transformFunction: null }, debug: { classPropertyName: "debug", publicName: "debug", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, ajvOptions: { classPropertyName: "ajvOptions", publicName: "ajvOptions", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { onChanges: "onChanges", onSubmit: "onSubmit", isValid: "isValid", validationErrors: "validationErrors", formSchema: "formSchema", formLayout: "formLayout", dataChange: "dataChange", modelChange: "modelChange", formDataChange: "formDataChange", ngModelChange: "ngModelChange" }, providers: [JsonSchemaFormService, JSON_SCHEMA_FORM_VALUE_ACCESSOR], usesOnChanges: true, ngImport: i0, template: "<form [autocomplete]=\"jsf?.formOptions?.autocomplete ? 'on' : 'off'\" class=\"json-schema-form\" (ngSubmit)=\"submitForm()\">\r\n <root-widget [layout]=\"jsf?.layout\"></root-widget>\r\n</form>\r\n<div *ngIf=\"debug() || jsf?.formOptions?.debug\">\r\n Debug output:\r\n <pre>{{debugOutput}}</pre>\r\n</div>", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem", "memoizationEnabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
11550
11726
  }
11551
11727
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonSchemaFormComponent, decorators: [{
11552
11728
  type: Component,
@@ -11582,5 +11758,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
11582
11758
  * Generated bundle index. Do not edit.
11583
11759
  */
11584
11760
 
11585
- 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 };
11761
+ 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 };
11586
11762
  //# sourceMappingURL=ng-formworks-core.mjs.map