@ng-formworks/core 18.6.6 → 18.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/esm2022/lib/json-schema-form.component.mjs +1 -1
  2. package/esm2022/lib/json-schema-form.service.mjs +16 -11
  3. package/esm2022/lib/shared/form-group.functions.mjs +52 -3
  4. package/esm2022/lib/shared/layout.functions.mjs +25 -7
  5. package/esm2022/lib/widget-library/add-reference.component.mjs +13 -6
  6. package/esm2022/lib/widget-library/button.component.mjs +9 -4
  7. package/esm2022/lib/widget-library/checkbox.component.mjs +2 -1
  8. package/esm2022/lib/widget-library/index.mjs +2 -1
  9. package/esm2022/lib/widget-library/input.component.mjs +9 -4
  10. package/esm2022/lib/widget-library/number.component.mjs +9 -6
  11. package/esm2022/lib/widget-library/root.component.mjs +173 -124
  12. package/esm2022/lib/widget-library/section.component.mjs +2 -2
  13. package/esm2022/lib/widget-library/select-framework.component.mjs +9 -5
  14. package/esm2022/lib/widget-library/select-widget.component.mjs +5 -4
  15. package/esm2022/lib/widget-library/stop-propagation.directive.mjs +42 -0
  16. package/esm2022/lib/widget-library/submit.component.mjs +9 -4
  17. package/esm2022/lib/widget-library/tab.component.mjs +1 -1
  18. package/esm2022/lib/widget-library/tabs.component.mjs +14 -2
  19. package/esm2022/lib/widget-library/widget-library.module.mjs +9 -32
  20. package/fesm2022/ng-formworks-core.mjs +502 -326
  21. package/fesm2022/ng-formworks-core.mjs.map +1 -1
  22. package/lib/json-schema-form.service.d.ts +0 -3
  23. package/lib/shared/validator.functions.d.ts +1 -1
  24. package/lib/widget-library/index.d.ts +1 -0
  25. package/lib/widget-library/root.component.d.ts +26 -7
  26. package/lib/widget-library/select-framework.component.d.ts +2 -1
  27. package/lib/widget-library/select-widget.component.d.ts +2 -2
  28. package/lib/widget-library/stop-propagation.directive.d.ts +13 -0
  29. package/lib/widget-library/tabs.component.d.ts +6 -2
  30. package/lib/widget-library/widget-library.module.d.ts +5 -4
  31. package/package.json +3 -4
@@ -1,7 +1,7 @@
1
1
  import * as i1 from '@angular/common';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { Injectable, inject, input, viewChild, ViewContainerRef, Component, Directive, Input, ChangeDetectionStrategy, ViewChild, signal, ElementRef, NgZone, Inject, NgModule, forwardRef, ChangeDetectorRef, output } from '@angular/core';
4
+ import { Injectable, inject, input, viewChild, ViewContainerRef, Component, Directive, Input, ChangeDetectionStrategy, ViewChild, ChangeDetectorRef, signal, Inject, ElementRef, NgZone, NgModule, forwardRef, output } from '@angular/core';
5
5
  import * as i2 from '@angular/forms';
6
6
  import { UntypedFormControl, UntypedFormArray, UntypedFormGroup, FormsModule, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
7
7
  import addFormats from 'ajv-formats';
@@ -10,7 +10,7 @@ import jsonDraft6 from 'ajv/lib/refs/json-schema-draft-06.json';
10
10
  import jsonDraft7 from 'ajv/lib/refs/json-schema-draft-07.json';
11
11
  import cloneDeep from 'lodash/cloneDeep';
12
12
  import { from, Observable, forkJoin, Subject, BehaviorSubject, lastValueFrom } from 'rxjs';
13
- import { some, isNil, isEmpty as isEmpty$1, isObject as isObject$1, pick, isEqual as isEqual$2 } from 'lodash';
13
+ import { some, isNil, isEmpty as isEmpty$1, isObject as isObject$1, pick, isEqual as isEqual$2, memoize } from 'lodash';
14
14
  import isEqual$1 from 'lodash/isEqual';
15
15
  import { map, takeUntil } from 'rxjs/operators';
16
16
  import omit from 'lodash/omit';
@@ -19,8 +19,8 @@ import map$1 from 'lodash/map';
19
19
  import _isArray from 'lodash/isArray';
20
20
  import _isPlainObject from 'lodash/isPlainObject';
21
21
  import uniqueId from 'lodash/uniqueId';
22
- import * as i2$1 from 'nxt-sortablejs';
23
- import { SortablejsModule } from 'nxt-sortablejs';
22
+ import * as i2$1 from '@angular/cdk/drag-drop';
23
+ import { DragDropModule } from '@angular/cdk/drag-drop';
24
24
  import { HttpClient } from '@angular/common/http';
25
25
 
26
26
  class Framework {
@@ -5265,14 +5265,24 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
5265
5265
  const schemaRefPointer = removeRecursiveReferences(schemaPointer + '/items/' + i, jsf.schemaRecursiveRefMap);
5266
5266
  const itemRefPointer = removeRecursiveReferences(shortDataPointer + '/' + i, jsf.dataRecursiveRefMap, jsf.arrayMap);
5267
5267
  const itemRecursive = itemRefPointer !== shortDataPointer + '/' + i;
5268
+ //if is in templateLibrary then need to check if its a conditional
5269
+ //and conditional pointers match orthewise create a new ref
5270
+ let conditionalRefPointer = `${itemRefPointer}@${schemaPointer}`;
5271
+ let templateRefToUse = itemRefPointer;
5272
+ if (hasOwn(jsf.templateRefLibrary, itemRefPointer)
5273
+ && !hasOwn(jsf.templateRefLibrary, conditionalRefPointer)) {
5274
+ jsf.templateRefLibrary[conditionalRefPointer] = buildFormGroupTemplate(jsf, null, setValues, schemaRefPointer, itemRefPointer, templatePointer + '/controls/' + i);
5275
+ templateRefToUse = conditionalRefPointer;
5276
+ }
5268
5277
  if (!hasOwn(jsf.templateRefLibrary, itemRefPointer)) {
5269
5278
  jsf.templateRefLibrary[itemRefPointer] = null;
5270
5279
  jsf.templateRefLibrary[itemRefPointer] = buildFormGroupTemplate(jsf, null, setValues, schemaRefPointer, itemRefPointer, templatePointer + '/controls/' + i);
5280
+ jsf.templateRefLibrary[conditionalRefPointer] = jsf.templateRefLibrary[itemRefPointer];
5271
5281
  }
5272
5282
  controls.push(isArray(nodeValue) ?
5273
5283
  buildFormGroupTemplate(jsf, nodeValue[i], setValues, schemaPointer + '/items/' + i, dataPointer + '/' + i, templatePointer + '/controls/' + i) :
5274
5284
  itemRecursive ?
5275
- null : cloneDeep(jsf.templateRefLibrary[itemRefPointer]));
5285
+ null : cloneDeep(jsf.templateRefLibrary[templateRefToUse]));
5276
5286
  }
5277
5287
  }
5278
5288
  // If 'additionalItems' is an object = additional list items (after tuple items)
@@ -5288,9 +5298,19 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
5288
5298
  const schemaRefPointer = removeRecursiveReferences(additionalItemsPointer, jsf.schemaRecursiveRefMap);
5289
5299
  const itemRefPointer = removeRecursiveReferences(shortDataPointer + '/-', jsf.dataRecursiveRefMap, jsf.arrayMap);
5290
5300
  const itemRecursive = itemRefPointer !== shortDataPointer + '/-';
5301
+ //if is in templateLibrary then need to check if its a conditional
5302
+ //and conditional pointers match orthewise create a new ref
5303
+ let conditionalRefPointer = `${itemRefPointer}@${schemaPointer}`;
5304
+ let templateRefToUse = itemRefPointer;
5305
+ if (hasOwn(jsf.templateRefLibrary, itemRefPointer)
5306
+ && !hasOwn(jsf.templateRefLibrary, conditionalRefPointer)) {
5307
+ jsf.templateRefLibrary[conditionalRefPointer] = buildFormGroupTemplate(jsf, null, setValues, schemaRefPointer, itemRefPointer, templatePointer + '/controls/-');
5308
+ templateRefToUse = conditionalRefPointer;
5309
+ }
5291
5310
  if (!hasOwn(jsf.templateRefLibrary, itemRefPointer)) {
5292
5311
  jsf.templateRefLibrary[itemRefPointer] = null;
5293
5312
  jsf.templateRefLibrary[itemRefPointer] = buildFormGroupTemplate(jsf, null, setValues, schemaRefPointer, itemRefPointer, templatePointer + '/controls/-');
5313
+ jsf.templateRefLibrary[conditionalRefPointer] = jsf.templateRefLibrary[itemRefPointer];
5294
5314
  }
5295
5315
  // const itemOptions = jsf.dataMap.get(itemRefPointer) || new Map();
5296
5316
  const itemOptions = nodeOptions;
@@ -5301,7 +5321,7 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
5301
5321
  controls.push(isArray(nodeValue) ?
5302
5322
  buildFormGroupTemplate(jsf, nodeValue[i], setValues, schemaRefPointer, dataPointer + '/-', templatePointer + '/controls/-') :
5303
5323
  itemRecursive ?
5304
- null : cloneDeep(jsf.templateRefLibrary[itemRefPointer]));
5324
+ null : cloneDeep(jsf.templateRefLibrary[templateRefToUse]));
5305
5325
  }
5306
5326
  }
5307
5327
  }
@@ -5620,6 +5640,35 @@ function getControl(formGroup, dataPointer, returnGroup = false, schemaPointer)
5620
5640
  // or formGroup.get() failed to return the control,
5621
5641
  // search the formGroup object for dataPointer's control
5622
5642
  let subGroup = formGroup;
5643
+ //if schemapointer provided but no control matched
5644
+ //it could mean the schema pointer is a nested child
5645
+ //for example this could be in form group
5646
+ //formGroup.controls.$allOf$0$then$properties$foo
5647
+ //but schemapointer provided is '/allOf/0/then/properties/foo/items/properties/name'
5648
+ //and dataPointer is '/foo/0/name'
5649
+ //then need to look in formGroup.controls.$allOf$0$then$properties$foo
5650
+ //for control path /0/name
5651
+ if (schemaPointer) {
5652
+ let controlPointer = JsonPointer.toControlPointer(dataPointer, {});
5653
+ let schemaPointerArray = schemaPointer.split('/');
5654
+ let controlPointerArray = JsonPointer.parse(dataPointer);
5655
+ //controlPointer.split('/').splice(1);
5656
+ let currSPAKey;
5657
+ let spFormGroup;
5658
+ while (schemaPointerArray.length > 0) {
5659
+ currSPAKey = schemaPointerArray.pop();
5660
+ let ckey = path2ControlKey(schemaPointerArray.join("/"));
5661
+ spFormGroup = formGroup.get(ckey);
5662
+ if (controlPointerArray[0] == schemaPointerArray[schemaPointerArray.length - 1]) {
5663
+ controlPointerArray.shift();
5664
+ }
5665
+ if (spFormGroup) {
5666
+ break;
5667
+ }
5668
+ }
5669
+ subGroup = spFormGroup || subGroup;
5670
+ dataPointerArray = spFormGroup ? controlPointerArray : dataPointerArray;
5671
+ }
5623
5672
  for (const key of dataPointerArray) {
5624
5673
  if (hasOwn(subGroup, 'controls')) {
5625
5674
  subGroup = subGroup.controls;
@@ -6324,13 +6373,15 @@ function fixNestedArrayLayout(options) {
6324
6373
  function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPointer = '', dataPointer = '', arrayItem = false, arrayItemType = null, removable = null, forRefLibrary = false, dataPointerPrefix = '', jsonSchema) {
6325
6374
  function applyITEConditions(builtLayout, schPointer, keySchemaPointer, negateClause, parentLayout) {
6326
6375
  if (builtLayout) {
6327
- if (parentLayout && parentLayout.isITEItem && parentLayout.options.condition) {
6376
+ const parentCondition = parentLayout && parentLayout.isITEItem && parentLayout.options.condition;
6377
+ if (parentCondition) {
6378
+ //builtLayout.isITEItem=true;
6328
6379
  return;
6329
6380
  }
6330
6381
  if (isArray(builtLayout)) {
6331
6382
  builtLayout.forEach(item => {
6332
6383
  item.isITEItem = true;
6333
- item.options.condition = convertJSONSchemaIfToCondition(schema, item, negateClause);
6384
+ item.options.condition = parentCondition ? null : convertJSONSchemaIfToCondition(schema, item, negateClause);
6334
6385
  applyITEConditions(item, schPointer, keySchemaPointer, negateClause, builtLayout);
6335
6386
  //item.schemaPointer = schPointer + keySchemaPointer + item.dataPointer;
6336
6387
  //item.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
@@ -6348,7 +6399,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6348
6399
  else {
6349
6400
  builtLayout.isITEItem = true;
6350
6401
  //builtLayout.schemaPointer = `${schPointer}${keySchemaPointer}/${builtLayout.name}`;
6351
- builtLayout.options.condition = convertJSONSchemaIfToCondition(schema, builtLayout, negateClause);
6402
+ builtLayout.options.condition = parentCondition ? null : convertJSONSchemaIfToCondition(schema, builtLayout, negateClause);
6352
6403
  //newSection.push(builtLayout)
6353
6404
  }
6354
6405
  }
@@ -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
  }
@@ -7939,6 +8012,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
7939
8012
  type: Input
7940
8013
  }] } });
7941
8014
 
8015
+ //TODO review:stopPropagation used as a workaround
8016
+ //to prevent dragging onMouseDown and onTouchStart events
8017
+ class StopPropagationDirective {
8018
+ constructor(el, renderer) {
8019
+ this.el = el;
8020
+ this.renderer = renderer;
8021
+ // The input property to receive an array of event names
8022
+ this.events = [];
8023
+ // An array to hold the unsubscribe functions for each event listener
8024
+ this.unsubscribeFunctions = [];
8025
+ }
8026
+ ngOnInit() {
8027
+ // If the input array is empty, default to 'mousedown'
8028
+ const eventsToListen = this.events.length > 0 ? this.events : ['mousedown'];
8029
+ // Loop through the array of event names and set up a listener for each
8030
+ eventsToListen.forEach(eventName => {
8031
+ const unsub = this.renderer.listen(this.el.nativeElement, eventName, (event) => {
8032
+ event.stopPropagation();
8033
+ });
8034
+ // Store the unsubscribe function to be called on destruction
8035
+ this.unsubscribeFunctions.push(unsub);
8036
+ });
8037
+ }
8038
+ ngOnDestroy() {
8039
+ // Call each stored unsubscribe function to clean up listeners
8040
+ this.unsubscribeFunctions.forEach(unsub => unsub());
8041
+ }
8042
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: StopPropagationDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive }); }
8043
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: { events: ["appStopPropagation", "events"] }, ngImport: i0 }); }
8044
+ }
8045
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: StopPropagationDirective, decorators: [{
8046
+ type: Directive,
8047
+ args: [{
8048
+ selector: '[appStopPropagation]', standalone: false
8049
+ }]
8050
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { events: [{
8051
+ type: Input,
8052
+ args: ['appStopPropagation']
8053
+ }] } });
8054
+
7942
8055
  class AddReferenceComponent {
7943
8056
  constructor() {
7944
8057
  this.jsf = inject(JsonSchemaFormService);
@@ -7970,13 +8083,16 @@ class AddReferenceComponent {
7970
8083
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: AddReferenceComponent, selector: "add-reference-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
7971
8084
  <section [class]="options?.htmlClass || ''" align="end">
7972
8085
  <button *ngIf="showAddButton"
7973
- [class]="options?.fieldHtmlClass || ''" class="sortable-filter sortable-fixed"
8086
+ [class]="options?.fieldHtmlClass || ''"
7974
8087
  [disabled]="options?.readonly"
7975
- (click)="addItem($event)">
8088
+ (click)="addItem($event)"
8089
+ [appStopPropagation]="['mousedown', 'touchstart']"
8090
+ >
7976
8091
  <span *ngIf="options?.icon" [class]="options?.icon"></span>
7977
8092
  <span *ngIf="options?.title" [innerHTML]="buttonText"></span>
8093
+
7978
8094
  </button>
7979
- </section>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
8095
+ </section>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: ["appStopPropagation"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
7980
8096
  }
7981
8097
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AddReferenceComponent, decorators: [{
7982
8098
  type: Component,
@@ -7986,11 +8102,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
7986
8102
  template: `
7987
8103
  <section [class]="options?.htmlClass || ''" align="end">
7988
8104
  <button *ngIf="showAddButton"
7989
- [class]="options?.fieldHtmlClass || ''" class="sortable-filter sortable-fixed"
8105
+ [class]="options?.fieldHtmlClass || ''"
7990
8106
  [disabled]="options?.readonly"
7991
- (click)="addItem($event)">
8107
+ (click)="addItem($event)"
8108
+ [appStopPropagation]="['mousedown', 'touchstart']"
8109
+ >
7992
8110
  <span *ngIf="options?.icon" [class]="options?.icon"></span>
7993
8111
  <span *ngIf="options?.title" [innerHTML]="buttonText"></span>
8112
+
7994
8113
  </button>
7995
8114
  </section>`,
7996
8115
  changeDetection: ChangeDetectionStrategy.Default,
@@ -8033,12 +8152,14 @@ class ButtonComponent {
8033
8152
  [name]="controlName"
8034
8153
  [type]="layoutNode()?.type"
8035
8154
  [value]="controlValue"
8036
- (click)="updateValue($event)">
8155
+ (click)="updateValue($event)"
8156
+ [appStopPropagation]="['mousedown', 'touchstart']"
8157
+ >
8037
8158
  <span *ngIf="options?.icon || options?.title"
8038
8159
  [class]="options?.icon"
8039
8160
  [innerHTML]="options?.title"></span>
8040
8161
  </button>
8041
- </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
8162
+ </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: ["appStopPropagation"] }] }); }
8042
8163
  }
8043
8164
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ButtonComponent, decorators: [{
8044
8165
  type: Component,
@@ -8056,7 +8177,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8056
8177
  [name]="controlName"
8057
8178
  [type]="layoutNode()?.type"
8058
8179
  [value]="controlValue"
8059
- (click)="updateValue($event)">
8180
+ (click)="updateValue($event)"
8181
+ [appStopPropagation]="['mousedown', 'touchstart']"
8182
+ >
8060
8183
  <span *ngIf="options?.icon || options?.title"
8061
8184
  [class]="options?.icon"
8062
8185
  [innerHTML]="options?.title"></span>
@@ -8069,6 +8192,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8069
8192
  //this mainly affects checkboxes coupled with conditions
8070
8193
  //-the value is rechecked
8071
8194
  //-see https://github.com/SortableJS/Sortable/issues/1052#issuecomment-369613072
8195
+ //-switched to angular cdk for dnd
8072
8196
  class CheckboxComponent {
8073
8197
  constructor() {
8074
8198
  this.jsf = inject(JsonSchemaFormService);
@@ -8424,7 +8548,7 @@ class InputComponent {
8424
8548
  }
8425
8549
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: InputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8426
8550
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: InputComponent, selector: "input-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
8427
- <div [class]="options?.htmlClass || ''" class="sortable-filter" >
8551
+ <div [class]="options?.htmlClass || ''" >
8428
8552
  <label *ngIf="options?.title"
8429
8553
  [attr.for]="'control' + layoutNode()?._id"
8430
8554
  [class]="options?.labelHtmlClass || ''"
@@ -8445,6 +8569,7 @@ class InputComponent {
8445
8569
  [readonly]="options?.readonly ? 'readonly' : null"
8446
8570
  [type]="layoutNode()?.type"
8447
8571
  [attributes]="inputAttributes"
8572
+ [appStopPropagation]="['mousedown', 'touchstart']"
8448
8573
  >
8449
8574
  <input *ngIf="!boundControl"
8450
8575
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
@@ -8463,12 +8588,13 @@ class InputComponent {
8463
8588
  [value]="controlValue"
8464
8589
  (input)="updateValue($event)"
8465
8590
  [attributes]="inputAttributes"
8591
+ [appStopPropagation]="['mousedown', 'touchstart']"
8466
8592
  >
8467
8593
  <datalist *ngIf="options?.typeahead?.source"
8468
8594
  [id]="'control' + layoutNode()?._id + 'Autocomplete'">
8469
8595
  <option *ngFor="let word of options?.typeahead?.source" [value]="word">
8470
8596
  </datalist>
8471
- </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: ElementAttributeDirective, selector: "[attributes]", inputs: ["attributes"] }] }); }
8597
+ </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: ElementAttributeDirective, selector: "[attributes]", inputs: ["attributes"] }, { kind: "directive", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: ["appStopPropagation"] }] }); }
8472
8598
  }
8473
8599
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: InputComponent, decorators: [{
8474
8600
  type: Component,
@@ -8476,7 +8602,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8476
8602
  // tslint:disable-next-line:component-selector
8477
8603
  selector: 'input-widget',
8478
8604
  template: `
8479
- <div [class]="options?.htmlClass || ''" class="sortable-filter" >
8605
+ <div [class]="options?.htmlClass || ''" >
8480
8606
  <label *ngIf="options?.title"
8481
8607
  [attr.for]="'control' + layoutNode()?._id"
8482
8608
  [class]="options?.labelHtmlClass || ''"
@@ -8497,6 +8623,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8497
8623
  [readonly]="options?.readonly ? 'readonly' : null"
8498
8624
  [type]="layoutNode()?.type"
8499
8625
  [attributes]="inputAttributes"
8626
+ [appStopPropagation]="['mousedown', 'touchstart']"
8500
8627
  >
8501
8628
  <input *ngIf="!boundControl"
8502
8629
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
@@ -8515,6 +8642,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8515
8642
  [value]="controlValue"
8516
8643
  (input)="updateValue($event)"
8517
8644
  [attributes]="inputAttributes"
8645
+ [appStopPropagation]="['mousedown', 'touchstart']"
8518
8646
  >
8519
8647
  <datalist *ngIf="options?.typeahead?.source"
8520
8648
  [id]="'control' + layoutNode()?._id + 'Autocomplete'">
@@ -8606,7 +8734,7 @@ class NumberComponent {
8606
8734
  }
8607
8735
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NumberComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8608
8736
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: NumberComponent, selector: "number-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "inputControl", first: true, predicate: ["inputControl"], descendants: true }, { propertyName: "div", first: true, predicate: ["divElt"], descendants: true }], ngImport: i0, template: `
8609
- <div #divElt [class]="options?.htmlClass || ''" class="sortable-filter" >
8737
+ <div #divElt [class]="options?.htmlClass || ''" >
8610
8738
  <label *ngIf="options?.title"
8611
8739
  [attr.for]="'control' + layoutNode()?._id"
8612
8740
  [class]="options?.labelHtmlClass || ''"
@@ -8628,7 +8756,7 @@ class NumberComponent {
8628
8756
  [title]="lastValidNumber"
8629
8757
  [type]="layoutNode()?.type === 'range' ? 'range' : 'number'"
8630
8758
  [attributes]="inputAttributes"
8631
-
8759
+ [appStopPropagation]="['mousedown', 'touchstart']"
8632
8760
  >
8633
8761
  <input #inputControl *ngIf="!boundControl"
8634
8762
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
@@ -8648,9 +8776,10 @@ class NumberComponent {
8648
8776
  [value]="controlValue"
8649
8777
  (input)="updateValue($event)"
8650
8778
  [attributes]="inputAttributes"
8779
+ [appStopPropagation]="['mousedown', 'touchstart']"
8651
8780
  >
8652
8781
  <span *ngIf="layoutNode()?.type === 'range'" [innerHTML]="controlValue"></span>
8653
- </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: ElementAttributeDirective, selector: "[attributes]", inputs: ["attributes"] }] }); }
8782
+ </div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: ElementAttributeDirective, selector: "[attributes]", inputs: ["attributes"] }, { kind: "directive", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: ["appStopPropagation"] }] }); }
8654
8783
  }
8655
8784
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NumberComponent, decorators: [{
8656
8785
  type: Component,
@@ -8658,7 +8787,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8658
8787
  // tslint:disable-next-line:component-selector
8659
8788
  selector: 'number-widget',
8660
8789
  template: `
8661
- <div #divElt [class]="options?.htmlClass || ''" class="sortable-filter" >
8790
+ <div #divElt [class]="options?.htmlClass || ''" >
8662
8791
  <label *ngIf="options?.title"
8663
8792
  [attr.for]="'control' + layoutNode()?._id"
8664
8793
  [class]="options?.labelHtmlClass || ''"
@@ -8680,7 +8809,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8680
8809
  [title]="lastValidNumber"
8681
8810
  [type]="layoutNode()?.type === 'range' ? 'range' : 'number'"
8682
8811
  [attributes]="inputAttributes"
8683
-
8812
+ [appStopPropagation]="['mousedown', 'touchstart']"
8684
8813
  >
8685
8814
  <input #inputControl *ngIf="!boundControl"
8686
8815
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
@@ -8700,6 +8829,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8700
8829
  [value]="controlValue"
8701
8830
  (input)="updateValue($event)"
8702
8831
  [attributes]="inputAttributes"
8832
+ [appStopPropagation]="['mousedown', 'touchstart']"
8703
8833
  >
8704
8834
  <span *ngIf="layoutNode()?.type === 'range'" [innerHTML]="controlValue"></span>
8705
8835
  </div>`,
@@ -8715,6 +8845,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8715
8845
  class SelectFrameworkComponent {
8716
8846
  constructor() {
8717
8847
  this.jsf = inject(JsonSchemaFormService);
8848
+ this.changeDetectorRef = inject(ChangeDetectorRef);
8718
8849
  this.newComponent = null;
8719
8850
  this.layoutNode = input(undefined);
8720
8851
  this.layoutIndex = input(undefined);
@@ -8724,7 +8855,7 @@ class SelectFrameworkComponent {
8724
8855
  ngOnInit() {
8725
8856
  this.updateComponent();
8726
8857
  }
8727
- ngOnChanges() {
8858
+ ngOnChanges(changes) {
8728
8859
  this.updateComponent();
8729
8860
  }
8730
8861
  updateComponent() {
@@ -8735,9 +8866,12 @@ class SelectFrameworkComponent {
8735
8866
  //this.widgetContainer.createComponent<any>(this.jsf.framework)
8736
8867
  }
8737
8868
  if (this.newComponent) {
8738
- for (const input of ['layoutNode', 'layoutIndex', 'dataIndex']) {
8739
- this.newComponent.instance[input] = this[input];
8869
+ for (const inp of ['layoutNode', 'layoutIndex', 'dataIndex']) {
8870
+ //this.newComponent.instance[inp] = this[inp];
8871
+ this.newComponent.setInput(inp, this[inp]());
8740
8872
  }
8873
+ // Manually trigger change detection after updating inputs
8874
+ //this.changeDetectorRef.detectChanges();
8741
8875
  }
8742
8876
  }
8743
8877
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: SelectFrameworkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
@@ -8755,6 +8889,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8755
8889
  class TabsComponent {
8756
8890
  constructor() {
8757
8891
  this.jsf = inject(JsonSchemaFormService);
8892
+ this.cdr = inject(ChangeDetectorRef);
8758
8893
  this.selectedItem = 0;
8759
8894
  this.showAddTab = true;
8760
8895
  this.layoutNode = input(undefined);
@@ -8768,6 +8903,12 @@ class TabsComponent {
8768
8903
  }
8769
8904
  this.itemCount = this.layoutNode().items.length - 1;
8770
8905
  this.updateControl();
8906
+ //TODO review/test-introduced to fix dynamic titles not updating
8907
+ //when their conditional linked field is destroyed
8908
+ //-forces change detection!
8909
+ this.jsf.dataChanges.subscribe((val) => {
8910
+ this.cdr.detectChanges();
8911
+ });
8771
8912
  }
8772
8913
  select(index) {
8773
8914
  const layoutNode = this.layoutNode();
@@ -8792,6 +8933,9 @@ class TabsComponent {
8792
8933
  setTabTitle(item, index) {
8793
8934
  return this.jsf.setArrayItemTitle(this, item, index);
8794
8935
  }
8936
+ ngOnDestroy() {
8937
+ this.dataChangesSubs?.unsubscribe();
8938
+ }
8795
8939
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8796
8940
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: TabsComponent, selector: "tabs-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
8797
8941
  <ul
@@ -8815,6 +8959,7 @@ class TabsComponent {
8815
8959
  />
8816
8960
  {{setTabTitle(item, i)}}
8817
8961
  </a>
8962
+
8818
8963
  </li>
8819
8964
  </ul>
8820
8965
 
@@ -8869,6 +9014,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8869
9014
  />
8870
9015
  {{setTabTitle(item, i)}}
8871
9016
  </a>
9017
+
8872
9018
  </li>
8873
9019
  </ul>
8874
9020
 
@@ -9159,239 +9305,93 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
9159
9305
  }]
9160
9306
  }] });
9161
9307
 
9162
- /**
9163
- * OrderableDirective
9164
- *
9165
- * Enables array elements to be reordered by dragging and dropping.
9166
- *
9167
- * Only works for arrays that have at least two elements.
9168
- *
9169
- * Also detects arrays-within-arrays, and correctly moves either
9170
- * the child array element or the parent array element,
9171
- * depending on the drop targert.
9172
- *
9173
- * Listeners for movable element being dragged:
9174
- * - dragstart: add 'dragging' class to element, set effectAllowed = 'move'
9175
- * - dragover: set dropEffect = 'move'
9176
- * - dragend: remove 'dragging' class from element
9177
- *
9178
- * Listeners for stationary items being dragged over:
9179
- * - dragenter: add 'drag-target-...' classes to element
9180
- * - dragleave: remove 'drag-target-...' classes from element
9181
- * - drop: remove 'drag-target-...' classes from element, move dropped array item
9182
- */
9183
- class OrderableDirective {
9184
- constructor() {
9185
- this.elementRef = inject(ElementRef);
9186
- this.jsf = inject(JsonSchemaFormService);
9187
- this.ngZone = inject(NgZone);
9188
- this.overParentElement = false;
9189
- this.overChildElement = false;
9190
- this.orderable = input(undefined);
9191
- this.layoutNode = input(undefined);
9192
- this.layoutIndex = input(undefined);
9193
- this.dataIndex = input(undefined);
9194
- }
9195
- ngOnInit() {
9196
- const layoutIndex = this.layoutIndex();
9197
- if (this.orderable() && this.layoutNode() && layoutIndex && this.dataIndex()) {
9198
- this.element = this.elementRef.nativeElement;
9199
- this.element.draggable = true;
9200
- this.arrayLayoutIndex = 'move:' + layoutIndex.slice(0, -1).toString();
9201
- this.ngZone.runOutsideAngular(() => {
9202
- // Listeners for movable element being dragged:
9203
- this.element.addEventListener('dragstart', (event) => {
9204
- event.dataTransfer.effectAllowed = 'move';
9205
- event.dataTransfer.setData('text', '');
9206
- // Hack to bypass stupid HTML drag-and-drop dataTransfer protection
9207
- // so drag source info will be available on dragenter
9208
- const sourceArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
9209
- sessionStorage.setItem(this.arrayLayoutIndex, sourceArrayIndex + '');
9210
- });
9211
- this.element.addEventListener('dragover', (event) => {
9212
- if (event.preventDefault) {
9213
- event.preventDefault();
9214
- }
9215
- event.dataTransfer.dropEffect = 'move';
9216
- return false;
9217
- });
9218
- // Listeners for stationary items being dragged over:
9219
- this.element.addEventListener('dragenter', (event) => {
9220
- // Part 1 of a hack, inspired by Dragster, to simulate mouseover and mouseout
9221
- // behavior while dragging items - http://bensmithett.github.io/dragster/
9222
- if (this.overParentElement) {
9223
- return this.overChildElement = true;
9224
- }
9225
- else {
9226
- this.overParentElement = true;
9227
- }
9228
- const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
9229
- if (sourceArrayIndex !== null) {
9230
- if (this.dataIndex()[this.dataIndex().length - 1] < +sourceArrayIndex) {
9231
- this.element.classList.add('drag-target-top');
9232
- }
9233
- else if (this.dataIndex()[this.dataIndex().length - 1] > +sourceArrayIndex) {
9234
- this.element.classList.add('drag-target-bottom');
9235
- }
9236
- }
9237
- });
9238
- this.element.addEventListener('dragleave', (event) => {
9239
- // Part 2 of the Dragster hack
9240
- if (this.overChildElement) {
9241
- this.overChildElement = false;
9242
- }
9243
- else if (this.overParentElement) {
9244
- this.overParentElement = false;
9245
- }
9246
- const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
9247
- if (!this.overParentElement && !this.overChildElement && sourceArrayIndex !== null) {
9248
- this.element.classList.remove('drag-target-top');
9249
- this.element.classList.remove('drag-target-bottom');
9250
- }
9251
- });
9252
- this.element.addEventListener('drop', (event) => {
9253
- this.element.classList.remove('drag-target-top');
9254
- this.element.classList.remove('drag-target-bottom');
9255
- // Confirm that drop target is another item in the same array as source item
9256
- const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
9257
- const destArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
9258
- if (sourceArrayIndex !== null && +sourceArrayIndex !== destArrayIndex) {
9259
- // Move array item
9260
- this.jsf.moveArrayItem(this, +sourceArrayIndex, destArrayIndex);
9261
- }
9262
- sessionStorage.removeItem(this.arrayLayoutIndex);
9263
- return false;
9264
- });
9265
- });
9266
- // Subscribe to the draggable state
9267
- this.draggableStateSubscription = this.jsf.draggableState$.subscribe((value) => {
9268
- this.element.draggable = value;
9269
- });
9270
- }
9271
- }
9272
- ngOnDestroy() {
9273
- if (this.draggableStateSubscription) {
9274
- this.draggableStateSubscription.unsubscribe();
9275
- }
9276
- }
9277
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OrderableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
9278
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: OrderableDirective, selector: "[orderable]", inputs: { orderable: { classPropertyName: "orderable", publicName: "orderable", isSignal: true, isRequired: false, transformFunction: null }, layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
9279
- }
9280
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OrderableDirective, decorators: [{
9281
- type: Directive,
9282
- args: [{
9283
- // tslint:disable-next-line:directive-selector
9284
- selector: '[orderable]',
9285
- }]
9286
- }] });
9287
-
9288
9308
  class RootComponent {
9289
9309
  constructor() {
9290
9310
  this.jsf = inject(JsonSchemaFormService);
9311
+ this.cdr = inject(ChangeDetectorRef);
9291
9312
  this.dataIndex = input(undefined);
9292
9313
  this.layoutIndex = input(undefined);
9293
9314
  this.layout = input(undefined);
9294
9315
  this.isOrderable = input(undefined);
9295
9316
  this.isFlexItem = input(false);
9296
- this.sortableConfig = {
9297
- filter: ".sortable-filter", //needed to disable dragging on input range elements, class needs to be added to the element or its parent
9298
- preventOnFilter: false, //needed for input range elements slider do still work
9299
- delay: 1000,
9300
- delayOnTouchOnly: true,
9301
- onEnd: (/**Event*/ evt) => {
9302
- evt.newIndex; // most likely why this event is used is to get the dragging element's current index
9303
- // same properties as onEnd
9304
- //console.log(`sortablejs event:${evt}`);
9305
- let srcInd = evt.oldIndex;
9306
- let trgInd = evt.newIndex;
9307
- let layoutItem = this.layout()[trgInd];
9308
- let dataInd = layoutItem?.arrayItem ? (this.dataIndex() || []).concat(trgInd) : (this.dataIndex() || []);
9309
- let layoutInd = (this.layoutIndex() || []).concat(trgInd);
9310
- let itemCtx = {
9311
- dataIndex: () => { return dataInd; },
9312
- layoutIndex: () => { return layoutInd; },
9313
- layoutNode: () => { return layoutItem; },
9314
- };
9315
- //must set moveLayout to false as nxtSortable already moves it
9316
- this.jsf.moveArrayItem(itemCtx, evt.oldIndex, evt.newIndex, false);
9317
- },
9318
- onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
9319
- if (evt.related.classList.contains("sortable-fixed")) {
9320
- //console.log(evt.related);
9321
- return false;
9322
- }
9323
- }
9317
+ this.memoizationEnabled = input(true);
9318
+ /**
9319
+ * Predicate function that disallows '$ref' item sorts
9320
+ * NB declared as a var instead of a function
9321
+ * like sortPredicate(index: number, item: CdkDrag<number>){..}
9322
+ * since 'this' is bound to the draglist and doesn't reference the
9323
+ * FlexLayoutRootComponent instance
9324
+ */
9325
+ //TODO also need to think of other types such as button which can be
9326
+ //created by an arbitrary layout
9327
+ //might not be needed added condition to [cdkDragDisabled]
9328
+ this.sortPredicate = (index, item) => {
9329
+ let layoutItem = this.layout()[index];
9330
+ let result = this.isDraggable(layoutItem);
9331
+ //layoutItem.type != '$ref';
9332
+ return result;
9324
9333
  };
9325
- }
9326
- sortableInit(sortable) {
9327
- this.sortableObj = sortable;
9328
- //Sortable.utils.on(this.sortableObj.el,"nulling",(s)=>{console.log("event nulling sortablejs")})
9329
- ///NB issue caused by sortablejs when it its destroyed
9330
- //this mainly affects checkboxes coupled with conditions
9331
- //-the value is rechecked
9332
- //-see https://github.com/SortableJS/Sortable/issues/1052#issuecomment-369613072
9333
- /* attempt to monkey patch sortable js
9334
- const originalMethod = sortable._nulling;
9335
- let zone=this.zone;
9336
- sortable._nulling=function() {
9337
- console.log(`pluginEvent 2 ${pluginEvent}`)
9338
- zone.runOutsideAngular(() => {
9339
- console.log(`pluginEvent3 ${pluginEvent}`)
9340
- pluginEvent('nulling', this);
9341
-
9342
- rootEl =
9343
- dragEl =
9344
- parentEl =
9345
- ghostEl =
9346
- nextEl =
9347
- cloneEl =
9348
- lastDownEl =
9349
- cloneHidden =
9350
-
9351
- tapEvt =
9352
- touchEvt =
9334
+ //private selectframeworkInputCache = new Map<string, { dataIndex: any[], layoutIndex: any[], layoutNode: any }>();
9335
+ //TODO review caching-if form field values change, the changes are not propagated
9336
+ /*
9337
+ getSelectFrameworkInputs(layoutItem: any, i: number) {
9338
+ // Create a unique key based on the layoutItem and index
9339
+ const cacheKey = `${layoutItem._id}-${i}`;
9340
+
9341
+ // If the result is already in the cache, return it
9342
+ if(this.enableCaching){
9343
+ if (this.selectframeworkInputCache.has(cacheKey)) {
9344
+ return this.selectframeworkInputCache.get(cacheKey);
9345
+ }
9346
+ }
9353
9347
 
9354
- moved =
9355
- newIndex =
9356
- newDraggableIndex =
9357
- oldIndex =
9358
- oldDraggableIndex =
9359
9348
 
9360
- lastTarget =
9361
- lastDirection =
9349
+ // If not cached, calculate the values (assuming dataIndex() and layoutIndex() are functions)
9350
+ const dataIndex = layoutItem?.arrayItem ? (this.dataIndex() || []).concat(i) : (this.dataIndex() || []);
9351
+ const layoutIndex = (this.layoutIndex() || []).concat(i);
9362
9352
 
9363
- putSortable =
9364
- activeGroup =
9365
- Sortable.dragged =
9366
- Sortable.ghost =
9367
- Sortable.clone =
9368
- Sortable.active = null;
9353
+ // Save the result in the cache
9354
+ const result = { dataIndex, layoutIndex, layoutNode: layoutItem };
9355
+ if(this.enableCaching){
9356
+ this.selectframeworkInputCache.set(cacheKey, result);
9357
+ }
9369
9358
 
9370
-
9371
- let el = this.el;
9372
- savedInputChecked.forEach(function (checkEl) {
9373
- if (el.contains(checkEl)) {
9374
- checkEl.checked = true;
9375
- }
9376
- });
9377
-
9378
- savedInputChecked.length =
9379
- lastDx =
9380
- lastDy = 0;
9381
-
9382
- })
9383
-
9384
- }.bind(sortable)
9385
- */
9359
+ return result;
9360
+ }
9361
+ */
9362
+ this._getSelectFrameworkInputsRaw = (layoutItem, i) => {
9363
+ const dataIndexValue = this.dataIndex() || [];
9364
+ const layoutIndexValue = this.layoutIndex() || [];
9365
+ return {
9366
+ layoutNode: layoutItem,
9367
+ layoutIndex: [...layoutIndexValue, i],
9368
+ dataIndex: layoutItem?.arrayItem ? [...dataIndexValue, i] : dataIndexValue,
9369
+ };
9370
+ };
9371
+ // Define a separate function to hold the memoized version
9372
+ this._getSelectFrameworkInputsMemoized = memoize(this._getSelectFrameworkInputsRaw, (layoutItem, i) => {
9373
+ const layoutItemKey = layoutItem?.id ?? JSON.stringify(layoutItem);
9374
+ return `${layoutItemKey}-${i}`;
9375
+ });
9376
+ }
9377
+ drop(event) {
9378
+ // most likely why this event is used is to get the dragging element's current index
9379
+ let srcInd = event.previousIndex;
9380
+ let trgInd = event.currentIndex;
9381
+ let layoutItem = this.layout()[trgInd];
9382
+ let dataInd = layoutItem?.arrayItem ? (this.dataIndex() || []).concat(trgInd) : (this.dataIndex() || []);
9383
+ let layoutInd = (this.layoutIndex() || []).concat(trgInd);
9384
+ let itemCtx = {
9385
+ dataIndex: () => { return dataInd; },
9386
+ layoutIndex: () => { return layoutInd; },
9387
+ layoutNode: () => { return layoutItem; },
9388
+ };
9389
+ this.jsf.moveArrayItem(itemCtx, srcInd, trgInd, true);
9386
9390
  }
9387
9391
  isDraggable(node) {
9388
9392
  let result = node.arrayItem && node.type !== '$ref' &&
9389
- node.arrayItemType === 'list' && this.isOrderable() !== false;
9390
- if (this.sortableObj) {
9391
- //this.sortableObj.option("disabled",true);
9392
- //this.sortableObj.option("sort",false);
9393
- //this.sortableObj.option("disabled",!result);
9394
- }
9393
+ node.arrayItemType === 'list' && this.isOrderable() !== false
9394
+ && node.type !== 'submit';
9395
9395
  return result;
9396
9396
  }
9397
9397
  //TODO also need to think of other types such as button which can be
@@ -9407,93 +9407,162 @@ class RootComponent {
9407
9407
  return ((node.options || {}).flex || '').split(/\s+/)[index] ||
9408
9408
  (node.options || {})[attribute] || ['1', '1', 'auto'][index];
9409
9409
  }
9410
+ // This is the public function that the template calls
9411
+ getSelectFrameworkInputs(layoutItem, i) {
9412
+ if (this.memoizationEnabled) {
9413
+ return this._getSelectFrameworkInputsMemoized(layoutItem, i);
9414
+ }
9415
+ else {
9416
+ return this._getSelectFrameworkInputsRaw(layoutItem, i);
9417
+ }
9418
+ }
9419
+ trackByFn(index, item) {
9420
+ return item._id ?? index;
9421
+ }
9422
+ /*
9423
+ ngOnChanges(changes: SimpleChanges): void {
9424
+ // If any of the input properties change, clear the cache
9425
+ if (changes.dataIndex || changes.layoutIndex || changes.layout) {
9426
+ this.selectframeworkInputCache?.clear(); // Clear the entire cache
9427
+ }
9428
+ }
9429
+ */
9430
+ ngOnChanges(changes) {
9431
+ if (changes['layout'] || changes['dataIndex'] || changes['layoutIndex']) {
9432
+ // Clear the entire cache of the memoized function
9433
+ this._getSelectFrameworkInputsMemoized.cache.clear();
9434
+ this.cdr.markForCheck();
9435
+ }
9436
+ }
9410
9437
  showWidget(layoutNode) {
9411
9438
  return this.jsf.evaluateCondition(layoutNode, this.dataIndex());
9412
9439
  }
9413
9440
  ngOnInit() {
9414
- // Subscribe to the draggable state
9415
- this.sortableOptionsSubscription = this.jsf.sortableOptions$.subscribe((optsValue) => {
9416
- if (this.sortableObj) {
9417
- Object.keys(optsValue).forEach(opt => {
9418
- let optVal = optsValue[opt];
9419
- this.sortableObj.option(opt, optVal);
9420
- });
9421
- //this.sortableObj.option("disabled",true);
9422
- //this.sortableObj.option("sort",false);
9423
- }
9424
- });
9441
+ if (this.memoizationEnabled) {
9442
+ this.jsf.dataChanges.subscribe((val) => {
9443
+ //this.selectframeworkInputCache?.clear();
9444
+ this._getSelectFrameworkInputsMemoized.cache.clear();
9445
+ //TODO-fix for now changed to detectChanges-
9446
+ //used to updated the dynamic titles in tab compnents
9447
+ this.cdr.markForCheck();
9448
+ // this.cdr.detectChanges();-breaks oneOf/ matdatepicker
9449
+ });
9450
+ }
9425
9451
  }
9426
9452
  ngOnDestroy() {
9427
- if (this.sortableOptionsSubscription) {
9428
- this.sortableOptionsSubscription.unsubscribe();
9429
- }
9453
+ //this.selectframeworkInputCache?.clear()
9454
+ //this.selectframeworkInputCache=null;
9455
+ this._getSelectFrameworkInputsMemoized.cache.clear();
9456
+ this.dataChangesSubs?.unsubscribe();
9430
9457
  }
9431
9458
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: RootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9432
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: RootComponent, selector: "root-widget", inputs: { dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, isOrderable: { classPropertyName: "isOrderable", publicName: "isOrderable", isSignal: true, isRequired: false, transformFunction: null }, isFlexItem: { classPropertyName: "isFlexItem", publicName: "isFlexItem", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
9433
- <div [class.flex-inherit]="true" #sortableContainter [nxtSortablejs]="layout()" [config]="sortableConfig" (init)="sortableInit($event)">
9434
- <div *ngFor="let layoutItem of layout(); let i = index"
9459
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: RootComponent, selector: "root-widget", inputs: { dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, isOrderable: { classPropertyName: "isOrderable", publicName: "isOrderable", isSignal: true, isRequired: false, transformFunction: null }, isFlexItem: { classPropertyName: "isFlexItem", publicName: "isFlexItem", isSignal: true, isRequired: false, transformFunction: null }, memoizationEnabled: { classPropertyName: "memoizationEnabled", publicName: "memoizationEnabled", isSignal: true, isRequired: false, transformFunction: null } }, usesOnChanges: true, ngImport: i0, template: `
9460
+ <div cdkDropList (cdkDropListDropped)="drop($event)"
9461
+ [class.flex-inherit]="true"
9462
+ [cdkDropListSortPredicate]="sortPredicate"
9463
+ >
9464
+ <!-- -for now left out
9465
+ cdkDragHandle directive, by itself, does not disable the
9466
+ default drag behavior of its parent cdkDrag element.
9467
+ You must explicitly disable dragging on the main element
9468
+ and re-enable it only when using the handle.
9469
+ -->
9470
+ <div *ngFor="let layoutItem of layout(); let i = index;trackBy: trackByFn"
9471
+ cdkDrag [cdkDragStartDelay]="{touch:1000,mouse:0}"
9472
+ [cdkDragDisabled]="!isDraggable(layoutItem)"
9435
9473
  [class.form-flex-item]="isFlexItem()"
9436
9474
  [style.align-self]="(layoutItem.options || {})['align-self']"
9437
9475
  [style.flex-basis]="getFlexAttribute(layoutItem, 'flex-basis')"
9438
9476
  [style.flex-grow]="getFlexAttribute(layoutItem, 'flex-grow')"
9439
9477
  [style.flex-shrink]="getFlexAttribute(layoutItem, 'flex-shrink')"
9440
9478
  [style.order]="(layoutItem.options || {}).order"
9441
- [class.sortable-filter]="!isDraggable(layoutItem)"
9442
- [class.sortable-fixed]="isFixed(layoutItem)"
9443
9479
  >
9480
+
9481
+ <!-- workaround to disbale dragging of input fields -->
9482
+ <!--
9483
+ <div *ngIf="layoutItem?.dataType !='object'" cdkDragHandle>
9484
+ <p>Drag Handle {{layoutItem?.dataType}}</p>
9485
+ </div>
9486
+ -->
9444
9487
  <!--NB orderable directive is not used but has been left in for now and set to false
9445
9488
  otherwise the compiler won't recognize dataIndex and other dependent attributes
9446
9489
  -->
9490
+ <!--
9447
9491
  <div
9448
9492
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
9449
9493
  [layoutIndex]="(layoutIndex() || []).concat(i)"
9450
9494
  [layoutNode]="layoutItem"
9451
9495
  [orderable]="false"
9452
- [class.sortable-filter]="!isDraggable(layoutItem)"
9453
- [class.sortable-fixed]="isFixed(layoutItem)"
9454
9496
  >
9455
9497
  <select-framework-widget *ngIf="showWidget(layoutItem)"
9456
9498
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
9457
9499
  [layoutIndex]="(layoutIndex() || []).concat(i)"
9458
9500
  [layoutNode]="layoutItem"></select-framework-widget>
9459
9501
  </div>
9502
+ -->
9503
+ <select-framework-widget *ngIf="showWidget(layoutItem)"
9504
+ [dataIndex]="getSelectFrameworkInputs(layoutItem,i).dataIndex"
9505
+ [layoutIndex]="getSelectFrameworkInputs(layoutItem,i).layoutIndex"
9506
+ [layoutNode]="getSelectFrameworkInputs(layoutItem,i).layoutNode">
9507
+ </select-framework-widget>
9460
9508
  </div>
9461
9509
  </div>
9462
- `, 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"] }] }); }
9510
+ `, 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 }); }
9463
9511
  }
9464
9512
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: RootComponent, decorators: [{
9465
9513
  type: Component,
9466
9514
  args: [{ selector: 'root-widget', template: `
9467
- <div [class.flex-inherit]="true" #sortableContainter [nxtSortablejs]="layout()" [config]="sortableConfig" (init)="sortableInit($event)">
9468
- <div *ngFor="let layoutItem of layout(); let i = index"
9515
+ <div cdkDropList (cdkDropListDropped)="drop($event)"
9516
+ [class.flex-inherit]="true"
9517
+ [cdkDropListSortPredicate]="sortPredicate"
9518
+ >
9519
+ <!-- -for now left out
9520
+ cdkDragHandle directive, by itself, does not disable the
9521
+ default drag behavior of its parent cdkDrag element.
9522
+ You must explicitly disable dragging on the main element
9523
+ and re-enable it only when using the handle.
9524
+ -->
9525
+ <div *ngFor="let layoutItem of layout(); let i = index;trackBy: trackByFn"
9526
+ cdkDrag [cdkDragStartDelay]="{touch:1000,mouse:0}"
9527
+ [cdkDragDisabled]="!isDraggable(layoutItem)"
9469
9528
  [class.form-flex-item]="isFlexItem()"
9470
9529
  [style.align-self]="(layoutItem.options || {})['align-self']"
9471
9530
  [style.flex-basis]="getFlexAttribute(layoutItem, 'flex-basis')"
9472
9531
  [style.flex-grow]="getFlexAttribute(layoutItem, 'flex-grow')"
9473
9532
  [style.flex-shrink]="getFlexAttribute(layoutItem, 'flex-shrink')"
9474
9533
  [style.order]="(layoutItem.options || {}).order"
9475
- [class.sortable-filter]="!isDraggable(layoutItem)"
9476
- [class.sortable-fixed]="isFixed(layoutItem)"
9477
9534
  >
9535
+
9536
+ <!-- workaround to disbale dragging of input fields -->
9537
+ <!--
9538
+ <div *ngIf="layoutItem?.dataType !='object'" cdkDragHandle>
9539
+ <p>Drag Handle {{layoutItem?.dataType}}</p>
9540
+ </div>
9541
+ -->
9478
9542
  <!--NB orderable directive is not used but has been left in for now and set to false
9479
9543
  otherwise the compiler won't recognize dataIndex and other dependent attributes
9480
9544
  -->
9545
+ <!--
9481
9546
  <div
9482
9547
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
9483
9548
  [layoutIndex]="(layoutIndex() || []).concat(i)"
9484
9549
  [layoutNode]="layoutItem"
9485
9550
  [orderable]="false"
9486
- [class.sortable-filter]="!isDraggable(layoutItem)"
9487
- [class.sortable-fixed]="isFixed(layoutItem)"
9488
9551
  >
9489
9552
  <select-framework-widget *ngIf="showWidget(layoutItem)"
9490
9553
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
9491
9554
  [layoutIndex]="(layoutIndex() || []).concat(i)"
9492
9555
  [layoutNode]="layoutItem"></select-framework-widget>
9493
9556
  </div>
9557
+ -->
9558
+ <select-framework-widget *ngIf="showWidget(layoutItem)"
9559
+ [dataIndex]="getSelectFrameworkInputs(layoutItem,i).dataIndex"
9560
+ [layoutIndex]="getSelectFrameworkInputs(layoutItem,i).layoutIndex"
9561
+ [layoutNode]="getSelectFrameworkInputs(layoutItem,i).layoutNode">
9562
+ </select-framework-widget>
9494
9563
  </div>
9495
9564
  </div>
9496
- `, 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"] }]
9565
+ `, 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"] }]
9497
9566
  }] });
9498
9567
 
9499
9568
  class SectionComponent {
@@ -9619,7 +9688,7 @@ class SectionComponent {
9619
9688
  [class]="options?.labelHelpBlockClass || ''"
9620
9689
  [innerHTML]="options?.description"></p>
9621
9690
  </div>
9622
- </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"] }] }); }
9691
+ </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"] }] }); }
9623
9692
  }
9624
9693
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: SectionComponent, decorators: [{
9625
9694
  type: Component,
@@ -9963,8 +10032,10 @@ class SubmitComponent {
9963
10032
  [name]="controlName"
9964
10033
  [type]="layoutNode()?.type"
9965
10034
  [value]="controlValue"
9966
- (click)="updateValue($event)">
9967
- </div>`, isInline: true }); }
10035
+ (click)="updateValue($event)"
10036
+ [appStopPropagation]="['mousedown', 'touchstart']"
10037
+ >
10038
+ </div>`, isInline: true, dependencies: [{ kind: "directive", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: ["appStopPropagation"] }] }); }
9968
10039
  }
9969
10040
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: SubmitComponent, decorators: [{
9970
10041
  type: Component,
@@ -9984,7 +10055,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
9984
10055
  [name]="controlName"
9985
10056
  [type]="layoutNode()?.type"
9986
10057
  [value]="controlValue"
9987
- (click)="updateValue($event)">
10058
+ (click)="updateValue($event)"
10059
+ [appStopPropagation]="['mousedown', 'touchstart']"
10060
+ >
9988
10061
  </div>`,
9989
10062
  }]
9990
10063
  }] });
@@ -10692,7 +10765,7 @@ class TabComponent {
10692
10765
  [dataIndex]="dataIndex()"
10693
10766
  [layoutIndex]="layoutIndex()"
10694
10767
  [layout]="layoutNode().items"></root-widget>
10695
- </div>`, isInline: true, dependencies: [{ kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }] }); }
10768
+ </div>`, isInline: true, dependencies: [{ kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem", "memoizationEnabled"] }] }); }
10696
10769
  }
10697
10770
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TabComponent, decorators: [{
10698
10771
  type: Component,
@@ -10709,6 +10782,132 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
10709
10782
  }]
10710
10783
  }] });
10711
10784
 
10785
+ /**
10786
+ * OrderableDirective
10787
+ *
10788
+ * Enables array elements to be reordered by dragging and dropping.
10789
+ *
10790
+ * Only works for arrays that have at least two elements.
10791
+ *
10792
+ * Also detects arrays-within-arrays, and correctly moves either
10793
+ * the child array element or the parent array element,
10794
+ * depending on the drop targert.
10795
+ *
10796
+ * Listeners for movable element being dragged:
10797
+ * - dragstart: add 'dragging' class to element, set effectAllowed = 'move'
10798
+ * - dragover: set dropEffect = 'move'
10799
+ * - dragend: remove 'dragging' class from element
10800
+ *
10801
+ * Listeners for stationary items being dragged over:
10802
+ * - dragenter: add 'drag-target-...' classes to element
10803
+ * - dragleave: remove 'drag-target-...' classes from element
10804
+ * - drop: remove 'drag-target-...' classes from element, move dropped array item
10805
+ */
10806
+ class OrderableDirective {
10807
+ constructor() {
10808
+ this.elementRef = inject(ElementRef);
10809
+ this.jsf = inject(JsonSchemaFormService);
10810
+ this.ngZone = inject(NgZone);
10811
+ this.overParentElement = false;
10812
+ this.overChildElement = false;
10813
+ this.orderable = input(undefined);
10814
+ this.layoutNode = input(undefined);
10815
+ this.layoutIndex = input(undefined);
10816
+ this.dataIndex = input(undefined);
10817
+ }
10818
+ ngOnInit() {
10819
+ const layoutIndex = this.layoutIndex();
10820
+ if (this.orderable() && this.layoutNode() && layoutIndex && this.dataIndex()) {
10821
+ this.element = this.elementRef.nativeElement;
10822
+ this.element.draggable = true;
10823
+ this.arrayLayoutIndex = 'move:' + layoutIndex.slice(0, -1).toString();
10824
+ this.ngZone.runOutsideAngular(() => {
10825
+ // Listeners for movable element being dragged:
10826
+ this.element.addEventListener('dragstart', (event) => {
10827
+ event.dataTransfer.effectAllowed = 'move';
10828
+ event.dataTransfer.setData('text', '');
10829
+ // Hack to bypass stupid HTML drag-and-drop dataTransfer protection
10830
+ // so drag source info will be available on dragenter
10831
+ const sourceArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
10832
+ sessionStorage.setItem(this.arrayLayoutIndex, sourceArrayIndex + '');
10833
+ });
10834
+ this.element.addEventListener('dragover', (event) => {
10835
+ if (event.preventDefault) {
10836
+ event.preventDefault();
10837
+ }
10838
+ event.dataTransfer.dropEffect = 'move';
10839
+ return false;
10840
+ });
10841
+ // Listeners for stationary items being dragged over:
10842
+ this.element.addEventListener('dragenter', (event) => {
10843
+ // Part 1 of a hack, inspired by Dragster, to simulate mouseover and mouseout
10844
+ // behavior while dragging items - http://bensmithett.github.io/dragster/
10845
+ if (this.overParentElement) {
10846
+ return this.overChildElement = true;
10847
+ }
10848
+ else {
10849
+ this.overParentElement = true;
10850
+ }
10851
+ const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
10852
+ if (sourceArrayIndex !== null) {
10853
+ if (this.dataIndex()[this.dataIndex().length - 1] < +sourceArrayIndex) {
10854
+ this.element.classList.add('drag-target-top');
10855
+ }
10856
+ else if (this.dataIndex()[this.dataIndex().length - 1] > +sourceArrayIndex) {
10857
+ this.element.classList.add('drag-target-bottom');
10858
+ }
10859
+ }
10860
+ });
10861
+ this.element.addEventListener('dragleave', (event) => {
10862
+ // Part 2 of the Dragster hack
10863
+ if (this.overChildElement) {
10864
+ this.overChildElement = false;
10865
+ }
10866
+ else if (this.overParentElement) {
10867
+ this.overParentElement = false;
10868
+ }
10869
+ const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
10870
+ if (!this.overParentElement && !this.overChildElement && sourceArrayIndex !== null) {
10871
+ this.element.classList.remove('drag-target-top');
10872
+ this.element.classList.remove('drag-target-bottom');
10873
+ }
10874
+ });
10875
+ this.element.addEventListener('drop', (event) => {
10876
+ this.element.classList.remove('drag-target-top');
10877
+ this.element.classList.remove('drag-target-bottom');
10878
+ // Confirm that drop target is another item in the same array as source item
10879
+ const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
10880
+ const destArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
10881
+ if (sourceArrayIndex !== null && +sourceArrayIndex !== destArrayIndex) {
10882
+ // Move array item
10883
+ this.jsf.moveArrayItem(this, +sourceArrayIndex, destArrayIndex);
10884
+ }
10885
+ sessionStorage.removeItem(this.arrayLayoutIndex);
10886
+ return false;
10887
+ });
10888
+ });
10889
+ // Subscribe to the draggable state
10890
+ this.draggableStateSubscription = this.jsf.draggableState$.subscribe((value) => {
10891
+ this.element.draggable = value;
10892
+ });
10893
+ }
10894
+ }
10895
+ ngOnDestroy() {
10896
+ if (this.draggableStateSubscription) {
10897
+ this.draggableStateSubscription.unsubscribe();
10898
+ }
10899
+ }
10900
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OrderableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
10901
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: OrderableDirective, selector: "[orderable]", inputs: { orderable: { classPropertyName: "orderable", publicName: "orderable", isSignal: true, isRequired: false, transformFunction: null }, layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
10902
+ }
10903
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OrderableDirective, decorators: [{
10904
+ type: Directive,
10905
+ args: [{
10906
+ // tslint:disable-next-line:directive-selector
10907
+ selector: '[orderable]',
10908
+ }]
10909
+ }] });
10910
+
10712
10911
  const BASIC_WIDGETS = [
10713
10912
  AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent,
10714
10913
  CheckboxesComponent, FileComponent, HiddenComponent, InputComponent,
@@ -10720,39 +10919,16 @@ const BASIC_WIDGETS = [
10720
10919
 
10721
10920
  class WidgetLibraryModule {
10722
10921
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: WidgetLibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
10723
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: WidgetLibraryModule, declarations: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, SelectCheckboxComponent, OrderableDirective, ElementAttributeDirective], imports: [CommonModule, FormsModule, ReactiveFormsModule, i2$1.SortablejsModule], exports: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, SelectCheckboxComponent, OrderableDirective, ElementAttributeDirective] }); }
10724
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: WidgetLibraryModule, imports: [CommonModule, FormsModule, ReactiveFormsModule,
10725
- SortablejsModule.forRoot({
10726
- //disabled:false,
10727
- //draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
10728
- filter: ".sortable-filter", //needed to disable dragging on input range elements, class needs to be added to the element or its parent
10729
- preventOnFilter: false, //needed for input range elements slider do still work
10730
- onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
10731
- if (evt.related.classList.contains("sortable-fixed")) {
10732
- //console.log(evt.related);
10733
- return false;
10734
- }
10735
- }
10736
- })] }); }
10922
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: WidgetLibraryModule, declarations: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, SelectCheckboxComponent, OrderableDirective, ElementAttributeDirective, StopPropagationDirective], imports: [CommonModule, FormsModule, ReactiveFormsModule, DragDropModule], exports: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, SelectCheckboxComponent, OrderableDirective, ElementAttributeDirective, StopPropagationDirective] }); }
10923
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: WidgetLibraryModule, imports: [CommonModule, FormsModule, ReactiveFormsModule, DragDropModule] }); }
10737
10924
  }
10738
10925
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: WidgetLibraryModule, decorators: [{
10739
10926
  type: NgModule,
10740
10927
  args: [{
10741
- imports: [CommonModule, FormsModule, ReactiveFormsModule,
10742
- SortablejsModule.forRoot({
10743
- //disabled:false,
10744
- //draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
10745
- filter: ".sortable-filter", //needed to disable dragging on input range elements, class needs to be added to the element or its parent
10746
- preventOnFilter: false, //needed for input range elements slider do still work
10747
- onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
10748
- if (evt.related.classList.contains("sortable-fixed")) {
10749
- //console.log(evt.related);
10750
- return false;
10751
- }
10752
- }
10753
- })],
10754
- declarations: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective],
10755
- exports: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective]
10928
+ imports: [CommonModule, FormsModule, ReactiveFormsModule, DragDropModule
10929
+ ],
10930
+ declarations: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective, StopPropagationDirective],
10931
+ exports: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective, StopPropagationDirective]
10756
10932
  }]
10757
10933
  }] });
10758
10934
 
@@ -11527,7 +11703,7 @@ class JsonSchemaFormComponent {
11527
11703
  }
11528
11704
  }
11529
11705
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: JsonSchemaFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
11530
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: JsonSchemaFormComponent, selector: "json-schema-form", inputs: { schema: { classPropertyName: "schema", publicName: "schema", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, framework: { classPropertyName: "framework", publicName: "framework", isSignal: true, isRequired: false, transformFunction: null }, widgets: { classPropertyName: "widgets", publicName: "widgets", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, JSONSchema: { classPropertyName: "JSONSchema", publicName: "JSONSchema", isSignal: true, isRequired: false, transformFunction: null }, UISchema: { classPropertyName: "UISchema", publicName: "UISchema", isSignal: true, isRequired: false, transformFunction: null }, formData: { classPropertyName: "formData", publicName: "formData", isSignal: true, isRequired: false, transformFunction: null }, ngModel: { classPropertyName: "ngModel", publicName: "ngModel", isSignal: true, isRequired: false, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, loadExternalAssets: { classPropertyName: "loadExternalAssets", publicName: "loadExternalAssets", isSignal: true, isRequired: false, transformFunction: null }, debug: { classPropertyName: "debug", publicName: "debug", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, ajvOptions: { classPropertyName: "ajvOptions", publicName: "ajvOptions", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { onChanges: "onChanges", onSubmit: "onSubmit", isValid: "isValid", validationErrors: "validationErrors", formSchema: "formSchema", formLayout: "formLayout", dataChange: "dataChange", modelChange: "modelChange", formDataChange: "formDataChange", ngModelChange: "ngModelChange" }, providers: [JsonSchemaFormService, JSON_SCHEMA_FORM_VALUE_ACCESSOR], usesOnChanges: true, ngImport: i0, template: "<form [autocomplete]=\"jsf?.formOptions?.autocomplete ? 'on' : 'off'\" class=\"json-schema-form\" (ngSubmit)=\"submitForm()\">\r\n <root-widget [layout]=\"jsf?.layout\"></root-widget>\r\n</form>\r\n<div *ngIf=\"debug() || jsf?.formOptions?.debug\">\r\n Debug output:\r\n <pre>{{debugOutput}}</pre>\r\n</div>", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
11706
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: JsonSchemaFormComponent, selector: "json-schema-form", inputs: { schema: { classPropertyName: "schema", publicName: "schema", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, framework: { classPropertyName: "framework", publicName: "framework", isSignal: true, isRequired: false, transformFunction: null }, widgets: { classPropertyName: "widgets", publicName: "widgets", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, JSONSchema: { classPropertyName: "JSONSchema", publicName: "JSONSchema", isSignal: true, isRequired: false, transformFunction: null }, UISchema: { classPropertyName: "UISchema", publicName: "UISchema", isSignal: true, isRequired: false, transformFunction: null }, formData: { classPropertyName: "formData", publicName: "formData", isSignal: true, isRequired: false, transformFunction: null }, ngModel: { classPropertyName: "ngModel", publicName: "ngModel", isSignal: true, isRequired: false, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, loadExternalAssets: { classPropertyName: "loadExternalAssets", publicName: "loadExternalAssets", isSignal: true, isRequired: false, transformFunction: null }, debug: { classPropertyName: "debug", publicName: "debug", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, ajvOptions: { classPropertyName: "ajvOptions", publicName: "ajvOptions", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { onChanges: "onChanges", onSubmit: "onSubmit", isValid: "isValid", validationErrors: "validationErrors", formSchema: "formSchema", formLayout: "formLayout", dataChange: "dataChange", modelChange: "modelChange", formDataChange: "formDataChange", ngModelChange: "ngModelChange" }, providers: [JsonSchemaFormService, JSON_SCHEMA_FORM_VALUE_ACCESSOR], usesOnChanges: true, ngImport: i0, template: "<form [autocomplete]=\"jsf?.formOptions?.autocomplete ? 'on' : 'off'\" class=\"json-schema-form\" (ngSubmit)=\"submitForm()\">\r\n <root-widget [layout]=\"jsf?.layout\"></root-widget>\r\n</form>\r\n<div *ngIf=\"debug() || jsf?.formOptions?.debug\">\r\n Debug output:\r\n <pre>{{debugOutput}}</pre>\r\n</div>", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem", "memoizationEnabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
11531
11707
  }
11532
11708
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: JsonSchemaFormComponent, decorators: [{
11533
11709
  type: Component,
@@ -11563,5 +11739,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
11563
11739
  * Generated bundle index. Do not edit.
11564
11740
  */
11565
11741
 
11566
- 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 };
11742
+ 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 };
11567
11743
  //# sourceMappingURL=ng-formworks-core.mjs.map