@ng-formworks/core 16.6.5 → 16.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/esm2022/lib/json-schema-form.component.mjs +1 -1
  2. package/esm2022/lib/json-schema-form.service.mjs +25 -17
  3. package/esm2022/lib/shared/form-group.functions.mjs +52 -3
  4. package/esm2022/lib/shared/layout.functions.mjs +32 -9
  5. package/esm2022/lib/widget-library/add-reference.component.mjs +13 -6
  6. package/esm2022/lib/widget-library/button.component.mjs +9 -4
  7. package/esm2022/lib/widget-library/checkbox.component.mjs +2 -1
  8. package/esm2022/lib/widget-library/index.mjs +2 -1
  9. package/esm2022/lib/widget-library/input.component.mjs +9 -4
  10. package/esm2022/lib/widget-library/number.component.mjs +9 -6
  11. package/esm2022/lib/widget-library/root.component.mjs +169 -122
  12. package/esm2022/lib/widget-library/section.component.mjs +2 -2
  13. package/esm2022/lib/widget-library/select-framework.component.mjs +7 -4
  14. package/esm2022/lib/widget-library/select-widget.component.mjs +5 -4
  15. package/esm2022/lib/widget-library/stop-propagation.directive.mjs +42 -0
  16. package/esm2022/lib/widget-library/submit.component.mjs +9 -4
  17. package/esm2022/lib/widget-library/tab.component.mjs +1 -1
  18. package/esm2022/lib/widget-library/widget-library.module.mjs +9 -32
  19. package/fesm2022/ng-formworks-core.mjs +503 -334
  20. package/fesm2022/ng-formworks-core.mjs.map +1 -1
  21. package/lib/json-schema-form.service.d.ts +0 -3
  22. package/lib/widget-library/index.d.ts +1 -0
  23. package/lib/widget-library/root.component.d.ts +25 -7
  24. package/lib/widget-library/select-framework.component.d.ts +1 -1
  25. package/lib/widget-library/select-widget.component.d.ts +2 -2
  26. package/lib/widget-library/stop-propagation.directive.d.ts +13 -0
  27. package/lib/widget-library/widget-library.module.d.ts +5 -4
  28. package/package.json +3 -4
@@ -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 i3$1 from 'nxt-sortablejs';
23
- import { SortablejsModule } from 'nxt-sortablejs';
22
+ import * as i3$1 from '@angular/cdk/drag-drop';
23
+ import { DragDropModule } from '@angular/cdk/drag-drop';
24
24
  import * as i1 from '@angular/common/http';
25
25
 
26
26
  class Framework {
@@ -5265,14 +5265,24 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
5265
5265
  const schemaRefPointer = removeRecursiveReferences(schemaPointer + '/items/' + i, jsf.schemaRecursiveRefMap);
5266
5266
  const itemRefPointer = removeRecursiveReferences(shortDataPointer + '/' + i, jsf.dataRecursiveRefMap, jsf.arrayMap);
5267
5267
  const itemRecursive = itemRefPointer !== shortDataPointer + '/' + i;
5268
+ //if is in templateLibrary then need to check if its a conditional
5269
+ //and conditional pointers match orthewise create a new ref
5270
+ let conditionalRefPointer = `${itemRefPointer}@${schemaPointer}`;
5271
+ let templateRefToUse = itemRefPointer;
5272
+ if (hasOwn(jsf.templateRefLibrary, itemRefPointer)
5273
+ && !hasOwn(jsf.templateRefLibrary, conditionalRefPointer)) {
5274
+ jsf.templateRefLibrary[conditionalRefPointer] = buildFormGroupTemplate(jsf, null, setValues, schemaRefPointer, itemRefPointer, templatePointer + '/controls/' + i);
5275
+ templateRefToUse = conditionalRefPointer;
5276
+ }
5268
5277
  if (!hasOwn(jsf.templateRefLibrary, itemRefPointer)) {
5269
5278
  jsf.templateRefLibrary[itemRefPointer] = null;
5270
5279
  jsf.templateRefLibrary[itemRefPointer] = buildFormGroupTemplate(jsf, null, setValues, schemaRefPointer, itemRefPointer, templatePointer + '/controls/' + i);
5280
+ jsf.templateRefLibrary[conditionalRefPointer] = jsf.templateRefLibrary[itemRefPointer];
5271
5281
  }
5272
5282
  controls.push(isArray(nodeValue) ?
5273
5283
  buildFormGroupTemplate(jsf, nodeValue[i], setValues, schemaPointer + '/items/' + i, dataPointer + '/' + i, templatePointer + '/controls/' + i) :
5274
5284
  itemRecursive ?
5275
- null : cloneDeep(jsf.templateRefLibrary[itemRefPointer]));
5285
+ null : cloneDeep(jsf.templateRefLibrary[templateRefToUse]));
5276
5286
  }
5277
5287
  }
5278
5288
  // If 'additionalItems' is an object = additional list items (after tuple items)
@@ -5288,9 +5298,19 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
5288
5298
  const schemaRefPointer = removeRecursiveReferences(additionalItemsPointer, jsf.schemaRecursiveRefMap);
5289
5299
  const itemRefPointer = removeRecursiveReferences(shortDataPointer + '/-', jsf.dataRecursiveRefMap, jsf.arrayMap);
5290
5300
  const itemRecursive = itemRefPointer !== shortDataPointer + '/-';
5301
+ //if is in templateLibrary then need to check if its a conditional
5302
+ //and conditional pointers match orthewise create a new ref
5303
+ let conditionalRefPointer = `${itemRefPointer}@${schemaPointer}`;
5304
+ let templateRefToUse = itemRefPointer;
5305
+ if (hasOwn(jsf.templateRefLibrary, itemRefPointer)
5306
+ && !hasOwn(jsf.templateRefLibrary, conditionalRefPointer)) {
5307
+ jsf.templateRefLibrary[conditionalRefPointer] = buildFormGroupTemplate(jsf, null, setValues, schemaRefPointer, itemRefPointer, templatePointer + '/controls/-');
5308
+ templateRefToUse = conditionalRefPointer;
5309
+ }
5291
5310
  if (!hasOwn(jsf.templateRefLibrary, itemRefPointer)) {
5292
5311
  jsf.templateRefLibrary[itemRefPointer] = null;
5293
5312
  jsf.templateRefLibrary[itemRefPointer] = buildFormGroupTemplate(jsf, null, setValues, schemaRefPointer, itemRefPointer, templatePointer + '/controls/-');
5313
+ jsf.templateRefLibrary[conditionalRefPointer] = jsf.templateRefLibrary[itemRefPointer];
5294
5314
  }
5295
5315
  // const itemOptions = jsf.dataMap.get(itemRefPointer) || new Map();
5296
5316
  const itemOptions = nodeOptions;
@@ -5301,7 +5321,7 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
5301
5321
  controls.push(isArray(nodeValue) ?
5302
5322
  buildFormGroupTemplate(jsf, nodeValue[i], setValues, schemaRefPointer, dataPointer + '/-', templatePointer + '/controls/-') :
5303
5323
  itemRecursive ?
5304
- null : cloneDeep(jsf.templateRefLibrary[itemRefPointer]));
5324
+ null : cloneDeep(jsf.templateRefLibrary[templateRefToUse]));
5305
5325
  }
5306
5326
  }
5307
5327
  }
@@ -5620,6 +5640,35 @@ function getControl(formGroup, dataPointer, returnGroup = false, schemaPointer)
5620
5640
  // or formGroup.get() failed to return the control,
5621
5641
  // search the formGroup object for dataPointer's control
5622
5642
  let subGroup = formGroup;
5643
+ //if schemapointer provided but no control matched
5644
+ //it could mean the schema pointer is a nested child
5645
+ //for example this could be in form group
5646
+ //formGroup.controls.$allOf$0$then$properties$foo
5647
+ //but schemapointer provided is '/allOf/0/then/properties/foo/items/properties/name'
5648
+ //and dataPointer is '/foo/0/name'
5649
+ //then need to look in formGroup.controls.$allOf$0$then$properties$foo
5650
+ //for control path /0/name
5651
+ if (schemaPointer) {
5652
+ let controlPointer = JsonPointer.toControlPointer(dataPointer, {});
5653
+ let schemaPointerArray = schemaPointer.split('/');
5654
+ let controlPointerArray = JsonPointer.parse(dataPointer);
5655
+ //controlPointer.split('/').splice(1);
5656
+ let currSPAKey;
5657
+ let spFormGroup;
5658
+ while (schemaPointerArray.length > 0) {
5659
+ currSPAKey = schemaPointerArray.pop();
5660
+ let ckey = path2ControlKey(schemaPointerArray.join("/"));
5661
+ spFormGroup = formGroup.get(ckey);
5662
+ if (controlPointerArray[0] == schemaPointerArray[schemaPointerArray.length - 1]) {
5663
+ controlPointerArray.shift();
5664
+ }
5665
+ if (spFormGroup) {
5666
+ break;
5667
+ }
5668
+ }
5669
+ subGroup = spFormGroup || subGroup;
5670
+ dataPointerArray = spFormGroup ? controlPointerArray : dataPointerArray;
5671
+ }
5623
5672
  for (const key of dataPointerArray) {
5624
5673
  if (hasOwn(subGroup, 'controls')) {
5625
5674
  subGroup = subGroup.controls;
@@ -6320,13 +6369,15 @@ function fixNestedArrayLayout(options) {
6320
6369
  function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPointer = '', dataPointer = '', arrayItem = false, arrayItemType = null, removable = null, forRefLibrary = false, dataPointerPrefix = '', jsonSchema) {
6321
6370
  function applyITEConditions(builtLayout, schPointer, keySchemaPointer, negateClause, parentLayout) {
6322
6371
  if (builtLayout) {
6323
- if (parentLayout && parentLayout.isITEItem && parentLayout.options.condition) {
6372
+ const parentCondition = parentLayout && parentLayout.isITEItem && parentLayout.options.condition;
6373
+ if (parentCondition) {
6374
+ //builtLayout.isITEItem=true;
6324
6375
  return;
6325
6376
  }
6326
6377
  if (isArray(builtLayout)) {
6327
6378
  builtLayout.forEach(item => {
6328
6379
  item.isITEItem = true;
6329
- item.options.condition = convertJSONSchemaIfToCondition(schema, item, negateClause);
6380
+ item.options.condition = parentCondition ? null : convertJSONSchemaIfToCondition(schema, item, negateClause);
6330
6381
  applyITEConditions(item, schPointer, keySchemaPointer, negateClause, builtLayout);
6331
6382
  //item.schemaPointer = schPointer + keySchemaPointer + item.dataPointer;
6332
6383
  //item.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
@@ -6344,7 +6395,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6344
6395
  else {
6345
6396
  builtLayout.isITEItem = true;
6346
6397
  //builtLayout.schemaPointer = `${schPointer}${keySchemaPointer}/${builtLayout.name}`;
6347
- builtLayout.options.condition = convertJSONSchemaIfToCondition(schema, builtLayout, negateClause);
6398
+ builtLayout.options.condition = parentCondition ? null : convertJSONSchemaIfToCondition(schema, builtLayout, negateClause);
6348
6399
  //newSection.push(builtLayout)
6349
6400
  }
6350
6401
  }
@@ -6456,7 +6507,8 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6456
6507
  '/properties/' + innerItemLevel2.name : innerItemLevel2.name;
6457
6508
  //innerItemLevel2.oneOfPointer = schemaPointer + keySchemaPointer + l2SchemaPointer;
6458
6509
  // innerItemLevel2.schemaPointer=innerItemLevel2.schemaPointer;
6459
- innerItemLevel2.oneOfPointer = innerItemLevel2.schemaPointer;
6510
+ const ofPointer = { anyOf: "anyOfPointer", oneOf: "oneOfPointer" }[ofType];
6511
+ innerItemLevel2[ofPointer] = ofPointer ? innerItemLevel2.schemaPointer : undefined;
6460
6512
  });
6461
6513
  }
6462
6514
  //TODO review-will never reach here if forRefLibrary==true
@@ -6466,6 +6518,9 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6466
6518
  innerItem.forEach(item => {
6467
6519
  const l2SchemaPointer = hasOwn(ofItem, 'properties') ?
6468
6520
  '/properties/' + item.name : item.name;
6521
+ if (ofType == "anyOf") {
6522
+ item.anyOfPointer = item.schemaPointer;
6523
+ }
6469
6524
  if (outerOneOfItem) {
6470
6525
  ////item.oneOfPointer = schemaPointer + keySchemaPointer + l2SchemaPointer;
6471
6526
  //schemaPointer + keySchemaPointer + item.dataPointer;
@@ -6489,7 +6544,8 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6489
6544
  }
6490
6545
  else {
6491
6546
  if (outerOneOfItem) {
6492
- innerItem.oneOfPointer = schemaPointer + keySchemaPointer; // + innerItem.dataPointer;
6547
+ const ofPointer = { anyOf: "anyOfPointer", oneOf: "oneOfPointer" }[ofType];
6548
+ innerItem[ofPointer] = ofPointer ? schemaPointer + keySchemaPointer : undefined;
6493
6549
  ////innerItem.schemaPointer=innerItem.oneOfPointer;
6494
6550
  outerOneOfItem.items = outerOneOfItem.items || [];
6495
6551
  outerOneOfItem.items.push(innerItem);
@@ -6582,6 +6638,13 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6582
6638
  itemRefPointer !== shortDataPointer + '/' + i;
6583
6639
  // If removable, add tuple item layout to layoutRefLibrary
6584
6640
  if (removable && i >= newNode.options.minItems) {
6641
+ let conditionalRefPointer = `${itemRefPointer}@${schemaPointer}`;
6642
+ let templateRefToUse = itemRefPointer;
6643
+ if (hasOwn(jsf.layoutRefLibrary, itemRefPointer)
6644
+ && !hasOwn(jsf.layoutRefLibrary, conditionalRefPointer)) {
6645
+ jsf.layoutRefLibrary[conditionalRefPointer] = buildLayoutFromSchema(jsf, widgetLibrary, isArray(nodeValue) ? nodeValue[i] : null, schemaPointer + '/items/' + i, itemRecursive ? '' : dataPointer + '/' + i, true, 'tuple', true, true, itemRecursive ? dataPointer + '/' + i : '');
6646
+ templateRefToUse = conditionalRefPointer;
6647
+ }
6585
6648
  if (!hasOwn(jsf.layoutRefLibrary, itemRefPointer)) {
6586
6649
  // Set to null first to prevent recursive reference from causing endless loop
6587
6650
  jsf.layoutRefLibrary[itemRefPointer] = null;
@@ -6589,9 +6652,10 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6589
6652
  if (itemRecursive) {
6590
6653
  jsf.layoutRefLibrary[itemRefPointer].recursiveReference = true;
6591
6654
  }
6655
+ jsf.layoutRefLibrary[conditionalRefPointer] = jsf.layoutRefLibrary[itemRefPointer];
6592
6656
  }
6593
6657
  newItem = getLayoutNode({
6594
- $ref: itemRefPointer,
6658
+ $ref: templateRefToUse,
6595
6659
  dataPointer: dataPointer + '/' + i,
6596
6660
  recursiveReference: itemRecursive,
6597
6661
  }, jsf, widgetLibrary, isArray(nodeValue) ? nodeValue[i] : null);
@@ -6617,6 +6681,13 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6617
6681
  const itemRecursive = !itemRefPointer.length ||
6618
6682
  itemRefPointer !== shortDataPointer + '/-';
6619
6683
  const itemSchemaPointer = removeRecursiveReferences(additionalItemsSchemaPointer, jsf.schemaRecursiveRefMap, jsf.arrayMap);
6684
+ let conditionalRefPointer = `${itemRefPointer}@${schemaPointer}`;
6685
+ let templateRefToUse = itemRefPointer;
6686
+ if (hasOwn(jsf.layoutRefLibrary, itemRefPointer)
6687
+ && !hasOwn(jsf.layoutRefLibrary, conditionalRefPointer)) {
6688
+ jsf.layoutRefLibrary[conditionalRefPointer] = buildLayoutFromSchema(jsf, widgetLibrary, null, itemSchemaPointer, itemRecursive ? '' : dataPointer + '/-', true, 'list', removable, true, itemRecursive ? dataPointer + '/-' : '');
6689
+ templateRefToUse = conditionalRefPointer;
6690
+ }
6620
6691
  // Add list item layout to layoutRefLibrary
6621
6692
  if (itemRefPointer.length && !hasOwn(jsf.layoutRefLibrary, itemRefPointer)) {
6622
6693
  // Set to null first to prevent recursive reference from causing endless loop
@@ -6625,6 +6696,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6625
6696
  if (itemRecursive) {
6626
6697
  jsf.layoutRefLibrary[itemRefPointer].recursiveReference = true;
6627
6698
  }
6699
+ jsf.layoutRefLibrary[conditionalRefPointer] = jsf.layoutRefLibrary[itemRefPointer];
6628
6700
  }
6629
6701
  // Add any additional default items
6630
6702
  if (!itemRecursive || newNode.options.required) {
@@ -6633,7 +6705,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6633
6705
  if (newNode.items.length < arrayLength) {
6634
6706
  for (let i = newNode.items.length; i < arrayLength; i++) {
6635
6707
  newNode.items.push(getLayoutNode({
6636
- $ref: itemRefPointer,
6708
+ $ref: templateRefToUse,
6637
6709
  dataPointer: dataPointer + '/-',
6638
6710
  recursiveReference: itemRecursive,
6639
6711
  }, jsf, widgetLibrary, isArray(nodeValue) ? nodeValue[i] : null));
@@ -6668,7 +6740,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6668
6740
  recursiveReference: itemRecursive,
6669
6741
  type: '$ref',
6670
6742
  widget: widgetLibrary.getWidget('$ref'),
6671
- $ref: itemRefPointer,
6743
+ $ref: templateRefToUse //itemRefPointer,
6672
6744
  });
6673
6745
  }
6674
6746
  }
@@ -7019,9 +7091,6 @@ class JsonSchemaFormService {
7019
7091
  setDraggableState(value) {
7020
7092
  this.draggableStateSubject.next(value); // Update the draggable value
7021
7093
  }
7022
- setSortableOptions(value) {
7023
- this.sortableOptionsSubject.next(value); // Update the sortable options value
7024
- }
7025
7094
  createAjvInstance(ajvOptions) {
7026
7095
  let ajvInstance = new Ajv2019(ajvOptions);
7027
7096
  ajvInstance.addMetaSchema(jsonDraft6);
@@ -7142,17 +7211,12 @@ class JsonSchemaFormService {
7142
7211
  //and will only be enabled when/if the caller sets the value back to true
7143
7212
  this.draggableStateSubject = new BehaviorSubject(true); // Default value true
7144
7213
  this.draggableState$ = this.draggableStateSubject.asObservable();
7145
- //this is introduced to look at replacing the orderable directive with
7146
- //nxt-sortablejs and sortablejs
7147
- this.sortableOptionsSubject = new BehaviorSubject({ disabled: false }); // Default value true
7148
- this.sortableOptions$ = this.sortableOptionsSubject.asObservable();
7149
7214
  this.ajvRegistry = {};
7150
7215
  this.setLanguage(this.language);
7151
7216
  this.ajv.addMetaSchema(jsonDraft6);
7152
7217
  this.ajv.addMetaSchema(jsonDraft7);
7153
7218
  addFormats(this.ajv);
7154
7219
  this.ajvRegistry['default'] = { name: 'default', ajvInstance: this.ajv, ajvValidator: null };
7155
- console.log(this.ajvRegistry);
7156
7220
  // Add custom 'duration' format using a regex
7157
7221
  /*
7158
7222
  this.ajv.addFormat("duration", {
@@ -7284,12 +7348,12 @@ class JsonSchemaFormService {
7284
7348
  this.formGroup = buildFormGroup(this.formGroupTemplate);
7285
7349
  if (this.formGroup) {
7286
7350
  this.compileAjvSchema(ajvInstanceName);
7287
- this.validateData(this.formGroup.value, true, ajvInstanceName);
7351
+ this.validateData(this.formGroup.getRawValue(), true, ajvInstanceName);
7288
7352
  // Set up observables to emit data and validation info when form data changes
7289
7353
  if (this.formValueSubscription) {
7290
7354
  this.formValueSubscription.unsubscribe();
7291
7355
  }
7292
- this.formValueSubscription = this.formGroup.valueChanges.subscribe(formValue => this.validateData(formValue, true, ajvInstanceName));
7356
+ this.formValueSubscription = this.formGroup.valueChanges.subscribe(formValue => this.validateData(this.formGroup.getRawValue(), true, ajvInstanceName));
7293
7357
  }
7294
7358
  }
7295
7359
  buildLayout(widgetLibrary) {
@@ -7408,6 +7472,12 @@ class JsonSchemaFormService {
7408
7472
  }
7409
7473
  return '';
7410
7474
  }
7475
+ //TODO fix- if template has value in title
7476
+ // "items": {
7477
+ // "title": "{{ 'Input ' + $index+value }}",
7478
+ // "type": "string"
7479
+ // }
7480
+ // result on button will be "Add Input [object Object]"
7411
7481
  setArrayItemTitle(parentCtx = {}, childNode = null, index = null) {
7412
7482
  const parentNode = parentCtx.layoutNode;
7413
7483
  const parentValues = this.getFormControlValue(parentCtx);
@@ -7484,7 +7554,8 @@ class JsonSchemaFormService {
7484
7554
  //introduced to check if the node is part of ITE conditional
7485
7555
  //then change or add the control
7486
7556
  if (layoutNode?.schemaPointer && layoutNode.isITEItem ||
7487
- (layoutNode?.schemaPointer && layoutNode?.oneOfPointer)) {
7557
+ (layoutNode?.schemaPointer && layoutNode?.oneOfPointer) ||
7558
+ layoutNode?.schemaPointer && layoutNode.anyOfPointer) {
7488
7559
  //before changing control, need to set the new data type for data formatting
7489
7560
  const schemaType = this.dataMap.get(layoutNode?.dataPointer).get("schemaType");
7490
7561
  if (schemaType != layoutNode.dataType) {
@@ -7527,9 +7598,12 @@ class JsonSchemaFormService {
7527
7598
  //set, as the control would only be initialized when the condition is true
7528
7599
  //TODO-review need to decide which of the data sets between data,formValues and default
7529
7600
  //to use for the value
7530
- if (ctx.options?.condition || layoutNode?.oneOfPointer) {
7601
+ //TODO try maybe marking descendants in applyITEConditions
7602
+ let isITEDescendant = layoutNode?.schemaPointer?.split("/")
7603
+ .some(elt => ["then", "else"].includes(elt));
7604
+ if (ctx.options?.condition || layoutNode?.oneOfPointer || layoutNode?.anyOfPointer || isITEDescendant) {
7531
7605
  const dataPointer = this.getDataPointer(ctx);
7532
- const controlValue = ctx.formControl.value;
7606
+ const controlValue = ctx.formControl?.value;
7533
7607
  const dataValue = JsonPointer.has(this.data, dataPointer) ?
7534
7608
  JsonPointer.get(this.data, dataPointer) : undefined;
7535
7609
  const formValue = JsonPointer.has(this.formValues, dataPointer) ?
@@ -7660,7 +7734,8 @@ class JsonSchemaFormService {
7660
7734
  }
7661
7735
  const schemaPointer = ctx.layoutNode?.isITEItem ? ctx.layoutNode?.schemaPointer : null;
7662
7736
  const oneOfPointer = ctx.layoutNode?.oneOfPointer;
7663
- return getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer);
7737
+ const anyOfPointer = ctx.layoutNode?.anyOfPointer;
7738
+ return getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer || anyOfPointer);
7664
7739
  }
7665
7740
  setFormControl(ctx, control) {
7666
7741
  if (!ctx || !ctx.layoutNode ||
@@ -7678,7 +7753,8 @@ class JsonSchemaFormService {
7678
7753
  }
7679
7754
  const schemaPointer = ctx.layoutNode?.isITEItem ? ctx.layoutNode?.schemaPointer : null;
7680
7755
  const oneOfPointer = ctx.layoutNode?.oneOfPointer;
7681
- const control = getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer);
7756
+ const anyOfPointer = ctx.layoutNode?.anyOfPointer;
7757
+ const control = getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer || anyOfPointer);
7682
7758
  return control ? control.value : null;
7683
7759
  }
7684
7760
  getFormControlGroup(ctx) {
@@ -7687,7 +7763,8 @@ class JsonSchemaFormService {
7687
7763
  }
7688
7764
  const schemaPointer = ctx.layoutNode?.isITEItem ? ctx.layoutNode?.schemaPointer : null;
7689
7765
  const oneOfPointer = ctx.layoutNode?.oneOfPointer;
7690
- return getControl(this.formGroup, this.getDataPointer(ctx), true, schemaPointer || oneOfPointer);
7766
+ const anyOfPointer = ctx.layoutNode?.anyOfPointer;
7767
+ return getControl(this.formGroup, this.getDataPointer(ctx), true, schemaPointer || oneOfPointer || anyOfPointer);
7691
7768
  }
7692
7769
  getFormControlName(ctx) {
7693
7770
  if (!ctx.layoutNode ||
@@ -7775,6 +7852,9 @@ class JsonSchemaFormService {
7775
7852
  }
7776
7853
  // Move item in the formArray
7777
7854
  const formArray = this.getFormControlGroup(ctx);
7855
+ if (oldIndex >= formArray.length) {
7856
+ return false;
7857
+ }
7778
7858
  const arrayItem = formArray.at(oldIndex);
7779
7859
  formArray.removeAt(oldIndex);
7780
7860
  formArray.insert(newIndex, arrayItem);
@@ -7821,7 +7901,7 @@ class SelectWidgetComponent {
7821
7901
  ngOnInit() {
7822
7902
  this.updateComponent();
7823
7903
  }
7824
- ngOnChanges() {
7904
+ ngOnChanges(changes) {
7825
7905
  this.updateComponent();
7826
7906
  }
7827
7907
  updateComponent() {
@@ -7830,8 +7910,9 @@ class SelectWidgetComponent {
7830
7910
  this.newComponent = widgetContainer.createComponent((this.layoutNode.widget));
7831
7911
  }
7832
7912
  if (this.newComponent) {
7833
- for (const input of ['layoutNode', 'layoutIndex', 'dataIndex']) {
7834
- this.newComponent.instance[input] = this[input];
7913
+ for (const inp of ['layoutNode', 'layoutIndex', 'dataIndex']) {
7914
+ //this.newComponent.instance[inp] = this[inp];
7915
+ this.newComponent.setInput(inp, this[inp]);
7835
7916
  }
7836
7917
  }
7837
7918
  }
@@ -7917,6 +7998,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
7917
7998
  type: Input
7918
7999
  }] } });
7919
8000
 
8001
+ //TODO review:stopPropagation used as a workaround
8002
+ //to prevent dragging onMouseDown and onTouchStart events
8003
+ class StopPropagationDirective {
8004
+ constructor(el, renderer) {
8005
+ this.el = el;
8006
+ this.renderer = renderer;
8007
+ // The input property to receive an array of event names
8008
+ this.events = [];
8009
+ // An array to hold the unsubscribe functions for each event listener
8010
+ this.unsubscribeFunctions = [];
8011
+ }
8012
+ ngOnInit() {
8013
+ // If the input array is empty, default to 'mousedown'
8014
+ const eventsToListen = this.events.length > 0 ? this.events : ['mousedown'];
8015
+ // Loop through the array of event names and set up a listener for each
8016
+ eventsToListen.forEach(eventName => {
8017
+ const unsub = this.renderer.listen(this.el.nativeElement, eventName, (event) => {
8018
+ event.stopPropagation();
8019
+ });
8020
+ // Store the unsubscribe function to be called on destruction
8021
+ this.unsubscribeFunctions.push(unsub);
8022
+ });
8023
+ }
8024
+ ngOnDestroy() {
8025
+ // Call each stored unsubscribe function to clean up listeners
8026
+ this.unsubscribeFunctions.forEach(unsub => unsub());
8027
+ }
8028
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: StopPropagationDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive }); }
8029
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: { events: ["appStopPropagation", "events"] }, ngImport: i0 }); }
8030
+ }
8031
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: StopPropagationDirective, decorators: [{
8032
+ type: Directive,
8033
+ args: [{
8034
+ selector: '[appStopPropagation]', standalone: false
8035
+ }]
8036
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { events: [{
8037
+ type: Input,
8038
+ args: ['appStopPropagation']
8039
+ }] } });
8040
+
7920
8041
  class AddReferenceComponent {
7921
8042
  constructor(jsf) {
7922
8043
  this.jsf = jsf;
@@ -7945,13 +8066,16 @@ class AddReferenceComponent {
7945
8066
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AddReferenceComponent, selector: "add-reference-widget", inputs: { layoutNode: "layoutNode", layoutIndex: "layoutIndex", dataIndex: "dataIndex" }, ngImport: i0, template: `
7946
8067
  <section [class]="options?.htmlClass || ''" align="end">
7947
8068
  <button *ngIf="showAddButton"
7948
- [class]="options?.fieldHtmlClass || ''" class="sortable-filter sortable-fixed"
8069
+ [class]="options?.fieldHtmlClass || ''"
7949
8070
  [disabled]="options?.readonly"
7950
- (click)="addItem($event)">
8071
+ (click)="addItem($event)"
8072
+ [appStopPropagation]="['mousedown', 'touchstart']"
8073
+ >
7951
8074
  <span *ngIf="options?.icon" [class]="options?.icon"></span>
7952
8075
  <span *ngIf="options?.title" [innerHTML]="buttonText"></span>
8076
+
7953
8077
  </button>
7954
- </section>`, isInline: true, dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
8078
+ </section>`, isInline: true, dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: ["appStopPropagation"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
7955
8079
  }
7956
8080
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AddReferenceComponent, decorators: [{
7957
8081
  type: Component,
@@ -7961,11 +8085,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
7961
8085
  template: `
7962
8086
  <section [class]="options?.htmlClass || ''" align="end">
7963
8087
  <button *ngIf="showAddButton"
7964
- [class]="options?.fieldHtmlClass || ''" class="sortable-filter sortable-fixed"
8088
+ [class]="options?.fieldHtmlClass || ''"
7965
8089
  [disabled]="options?.readonly"
7966
- (click)="addItem($event)">
8090
+ (click)="addItem($event)"
8091
+ [appStopPropagation]="['mousedown', 'touchstart']"
8092
+ >
7967
8093
  <span *ngIf="options?.icon" [class]="options?.icon"></span>
7968
8094
  <span *ngIf="options?.title" [innerHTML]="buttonText"></span>
8095
+
7969
8096
  </button>
7970
8097
  </section>`,
7971
8098
  changeDetection: ChangeDetectionStrategy.Default,
@@ -8011,12 +8138,14 @@ class ButtonComponent {
8011
8138
  [name]="controlName"
8012
8139
  [type]="layoutNode?.type"
8013
8140
  [value]="controlValue"
8014
- (click)="updateValue($event)">
8141
+ (click)="updateValue($event)"
8142
+ [appStopPropagation]="['mousedown', 'touchstart']"
8143
+ >
8015
8144
  <span *ngIf="options?.icon || options?.title"
8016
8145
  [class]="options?.icon"
8017
8146
  [innerHTML]="options?.title"></span>
8018
8147
  </button>
8019
- </div>`, isInline: true, dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
8148
+ </div>`, isInline: true, dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: ["appStopPropagation"] }] }); }
8020
8149
  }
8021
8150
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ButtonComponent, decorators: [{
8022
8151
  type: Component,
@@ -8034,7 +8163,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
8034
8163
  [name]="controlName"
8035
8164
  [type]="layoutNode?.type"
8036
8165
  [value]="controlValue"
8037
- (click)="updateValue($event)">
8166
+ (click)="updateValue($event)"
8167
+ [appStopPropagation]="['mousedown', 'touchstart']"
8168
+ >
8038
8169
  <span *ngIf="options?.icon || options?.title"
8039
8170
  [class]="options?.icon"
8040
8171
  [innerHTML]="options?.title"></span>
@@ -8053,6 +8184,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
8053
8184
  //this mainly affects checkboxes coupled with conditions
8054
8185
  //-the value is rechecked
8055
8186
  //-see https://github.com/SortableJS/Sortable/issues/1052#issuecomment-369613072
8187
+ //-switched to angular cdk for dnd
8056
8188
  class CheckboxComponent {
8057
8189
  constructor(jsf) {
8058
8190
  this.jsf = jsf;
@@ -8416,7 +8548,7 @@ class InputComponent {
8416
8548
  }
8417
8549
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InputComponent, deps: [{ token: JsonSchemaFormService }], target: i0.ɵɵFactoryTarget.Component }); }
8418
8550
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: InputComponent, selector: "input-widget", inputs: { layoutNode: "layoutNode", layoutIndex: "layoutIndex", dataIndex: "dataIndex" }, ngImport: i0, template: `
8419
- <div [class]="options?.htmlClass || ''" class="sortable-filter" >
8551
+ <div [class]="options?.htmlClass || ''" >
8420
8552
  <label *ngIf="options?.title"
8421
8553
  [attr.for]="'control' + layoutNode?._id"
8422
8554
  [class]="options?.labelHtmlClass || ''"
@@ -8437,6 +8569,7 @@ class InputComponent {
8437
8569
  [readonly]="options?.readonly ? 'readonly' : null"
8438
8570
  [type]="layoutNode?.type"
8439
8571
  [attributes]="inputAttributes"
8572
+ [appStopPropagation]="['mousedown', 'touchstart']"
8440
8573
  >
8441
8574
  <input *ngIf="!boundControl"
8442
8575
  [attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
@@ -8455,12 +8588,13 @@ class InputComponent {
8455
8588
  [value]="controlValue"
8456
8589
  (input)="updateValue($event)"
8457
8590
  [attributes]="inputAttributes"
8591
+ [appStopPropagation]="['mousedown', 'touchstart']"
8458
8592
  >
8459
8593
  <datalist *ngIf="options?.typeahead?.source"
8460
8594
  [id]="'control' + layoutNode?._id + 'Autocomplete'">
8461
8595
  <option *ngFor="let word of options?.typeahead?.source" [value]="word">
8462
8596
  </datalist>
8463
- </div>`, isInline: true, dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.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: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.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: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.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: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.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"] }] }); }
8464
8598
  }
8465
8599
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InputComponent, decorators: [{
8466
8600
  type: Component,
@@ -8468,7 +8602,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
8468
8602
  // tslint:disable-next-line:component-selector
8469
8603
  selector: 'input-widget',
8470
8604
  template: `
8471
- <div [class]="options?.htmlClass || ''" class="sortable-filter" >
8605
+ <div [class]="options?.htmlClass || ''" >
8472
8606
  <label *ngIf="options?.title"
8473
8607
  [attr.for]="'control' + layoutNode?._id"
8474
8608
  [class]="options?.labelHtmlClass || ''"
@@ -8489,6 +8623,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
8489
8623
  [readonly]="options?.readonly ? 'readonly' : null"
8490
8624
  [type]="layoutNode?.type"
8491
8625
  [attributes]="inputAttributes"
8626
+ [appStopPropagation]="['mousedown', 'touchstart']"
8492
8627
  >
8493
8628
  <input *ngIf="!boundControl"
8494
8629
  [attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
@@ -8507,6 +8642,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
8507
8642
  [value]="controlValue"
8508
8643
  (input)="updateValue($event)"
8509
8644
  [attributes]="inputAttributes"
8645
+ [appStopPropagation]="['mousedown', 'touchstart']"
8510
8646
  >
8511
8647
  <datalist *ngIf="options?.typeahead?.source"
8512
8648
  [id]="'control' + layoutNode?._id + 'Autocomplete'">
@@ -8605,7 +8741,7 @@ class NumberComponent {
8605
8741
  }
8606
8742
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NumberComponent, deps: [{ token: JsonSchemaFormService }], target: i0.ɵɵFactoryTarget.Component }); }
8607
8743
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: NumberComponent, selector: "number-widget", inputs: { layoutNode: "layoutNode", layoutIndex: "layoutIndex", dataIndex: "dataIndex" }, ngImport: i0, template: `
8608
- <div #divElt [class]="options?.htmlClass || ''" class="sortable-filter" >
8744
+ <div #divElt [class]="options?.htmlClass || ''" >
8609
8745
  <label *ngIf="options?.title"
8610
8746
  [attr.for]="'control' + layoutNode?._id"
8611
8747
  [class]="options?.labelHtmlClass || ''"
@@ -8627,7 +8763,7 @@ class NumberComponent {
8627
8763
  [title]="lastValidNumber"
8628
8764
  [type]="layoutNode?.type === 'range' ? 'range' : 'number'"
8629
8765
  [attributes]="inputAttributes"
8630
-
8766
+ [appStopPropagation]="['mousedown', 'touchstart']"
8631
8767
  >
8632
8768
  <input #inputControl *ngIf="!boundControl"
8633
8769
  [attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
@@ -8647,9 +8783,10 @@ class NumberComponent {
8647
8783
  [value]="controlValue"
8648
8784
  (input)="updateValue($event)"
8649
8785
  [attributes]="inputAttributes"
8786
+ [appStopPropagation]="['mousedown', 'touchstart']"
8650
8787
  >
8651
8788
  <span *ngIf="layoutNode?.type === 'range'" [innerHTML]="controlValue"></span>
8652
- </div>`, isInline: true, dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.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: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: ElementAttributeDirective, selector: "[attributes]", inputs: ["attributes"] }] }); }
8789
+ </div>`, isInline: true, dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.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: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.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"] }] }); }
8653
8790
  }
8654
8791
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NumberComponent, decorators: [{
8655
8792
  type: Component,
@@ -8657,7 +8794,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
8657
8794
  // tslint:disable-next-line:component-selector
8658
8795
  selector: 'number-widget',
8659
8796
  template: `
8660
- <div #divElt [class]="options?.htmlClass || ''" class="sortable-filter" >
8797
+ <div #divElt [class]="options?.htmlClass || ''" >
8661
8798
  <label *ngIf="options?.title"
8662
8799
  [attr.for]="'control' + layoutNode?._id"
8663
8800
  [class]="options?.labelHtmlClass || ''"
@@ -8679,7 +8816,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
8679
8816
  [title]="lastValidNumber"
8680
8817
  [type]="layoutNode?.type === 'range' ? 'range' : 'number'"
8681
8818
  [attributes]="inputAttributes"
8682
-
8819
+ [appStopPropagation]="['mousedown', 'touchstart']"
8683
8820
  >
8684
8821
  <input #inputControl *ngIf="!boundControl"
8685
8822
  [attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
@@ -8699,6 +8836,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
8699
8836
  [value]="controlValue"
8700
8837
  (input)="updateValue($event)"
8701
8838
  [attributes]="inputAttributes"
8839
+ [appStopPropagation]="['mousedown', 'touchstart']"
8702
8840
  >
8703
8841
  <span *ngIf="layoutNode?.type === 'range'" [innerHTML]="controlValue"></span>
8704
8842
  </div>`,
@@ -8719,7 +8857,7 @@ class SelectFrameworkComponent {
8719
8857
  ngOnInit() {
8720
8858
  this.updateComponent();
8721
8859
  }
8722
- ngOnChanges() {
8860
+ ngOnChanges(changes) {
8723
8861
  this.updateComponent();
8724
8862
  }
8725
8863
  updateComponent() {
@@ -8730,9 +8868,12 @@ class SelectFrameworkComponent {
8730
8868
  //this.widgetContainer.createComponent<any>(this.jsf.framework)
8731
8869
  }
8732
8870
  if (this.newComponent) {
8733
- for (const input of ['layoutNode', 'layoutIndex', 'dataIndex']) {
8734
- this.newComponent.instance[input] = this[input];
8871
+ for (const inp of ['layoutNode', 'layoutIndex', 'dataIndex']) {
8872
+ //this.newComponent.instance[inp] = this[inp];
8873
+ this.newComponent.setInput(inp, this[inp]);
8735
8874
  }
8875
+ // Manually trigger change detection after updating inputs
8876
+ //this.changeDetectorRef.detectChanges();
8736
8877
  }
8737
8878
  }
8738
8879
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SelectFrameworkComponent, deps: [{ token: JsonSchemaFormService }], target: i0.ɵɵFactoryTarget.Component }); }
@@ -9173,236 +9314,88 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
9173
9314
  type: Input
9174
9315
  }] } });
9175
9316
 
9176
- /**
9177
- * OrderableDirective
9178
- *
9179
- * Enables array elements to be reordered by dragging and dropping.
9180
- *
9181
- * Only works for arrays that have at least two elements.
9182
- *
9183
- * Also detects arrays-within-arrays, and correctly moves either
9184
- * the child array element or the parent array element,
9185
- * depending on the drop targert.
9186
- *
9187
- * Listeners for movable element being dragged:
9188
- * - dragstart: add 'dragging' class to element, set effectAllowed = 'move'
9189
- * - dragover: set dropEffect = 'move'
9190
- * - dragend: remove 'dragging' class from element
9191
- *
9192
- * Listeners for stationary items being dragged over:
9193
- * - dragenter: add 'drag-target-...' classes to element
9194
- * - dragleave: remove 'drag-target-...' classes from element
9195
- * - drop: remove 'drag-target-...' classes from element, move dropped array item
9196
- */
9197
- class OrderableDirective {
9198
- constructor(elementRef, jsf, ngZone) {
9199
- this.elementRef = elementRef;
9200
- this.jsf = jsf;
9201
- this.ngZone = ngZone;
9202
- this.overParentElement = false;
9203
- this.overChildElement = false;
9204
- }
9205
- ngOnInit() {
9206
- if (this.orderable && this.layoutNode && this.layoutIndex && this.dataIndex) {
9207
- this.element = this.elementRef.nativeElement;
9208
- this.element.draggable = true;
9209
- this.arrayLayoutIndex = 'move:' + this.layoutIndex.slice(0, -1).toString();
9210
- this.ngZone.runOutsideAngular(() => {
9211
- // Listeners for movable element being dragged:
9212
- this.element.addEventListener('dragstart', (event) => {
9213
- event.dataTransfer.effectAllowed = 'move';
9214
- event.dataTransfer.setData('text', '');
9215
- // Hack to bypass stupid HTML drag-and-drop dataTransfer protection
9216
- // so drag source info will be available on dragenter
9217
- const sourceArrayIndex = this.dataIndex[this.dataIndex.length - 1];
9218
- sessionStorage.setItem(this.arrayLayoutIndex, sourceArrayIndex + '');
9219
- });
9220
- this.element.addEventListener('dragover', (event) => {
9221
- if (event.preventDefault) {
9222
- event.preventDefault();
9223
- }
9224
- event.dataTransfer.dropEffect = 'move';
9225
- return false;
9226
- });
9227
- // Listeners for stationary items being dragged over:
9228
- this.element.addEventListener('dragenter', (event) => {
9229
- // Part 1 of a hack, inspired by Dragster, to simulate mouseover and mouseout
9230
- // behavior while dragging items - http://bensmithett.github.io/dragster/
9231
- if (this.overParentElement) {
9232
- return this.overChildElement = true;
9233
- }
9234
- else {
9235
- this.overParentElement = true;
9236
- }
9237
- const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
9238
- if (sourceArrayIndex !== null) {
9239
- if (this.dataIndex[this.dataIndex.length - 1] < +sourceArrayIndex) {
9240
- this.element.classList.add('drag-target-top');
9241
- }
9242
- else if (this.dataIndex[this.dataIndex.length - 1] > +sourceArrayIndex) {
9243
- this.element.classList.add('drag-target-bottom');
9244
- }
9245
- }
9246
- });
9247
- this.element.addEventListener('dragleave', (event) => {
9248
- // Part 2 of the Dragster hack
9249
- if (this.overChildElement) {
9250
- this.overChildElement = false;
9251
- }
9252
- else if (this.overParentElement) {
9253
- this.overParentElement = false;
9254
- }
9255
- const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
9256
- if (!this.overParentElement && !this.overChildElement && sourceArrayIndex !== null) {
9257
- this.element.classList.remove('drag-target-top');
9258
- this.element.classList.remove('drag-target-bottom');
9259
- }
9260
- });
9261
- this.element.addEventListener('drop', (event) => {
9262
- this.element.classList.remove('drag-target-top');
9263
- this.element.classList.remove('drag-target-bottom');
9264
- // Confirm that drop target is another item in the same array as source item
9265
- const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
9266
- const destArrayIndex = this.dataIndex[this.dataIndex.length - 1];
9267
- if (sourceArrayIndex !== null && +sourceArrayIndex !== destArrayIndex) {
9268
- // Move array item
9269
- this.jsf.moveArrayItem(this, +sourceArrayIndex, destArrayIndex);
9270
- }
9271
- sessionStorage.removeItem(this.arrayLayoutIndex);
9272
- return false;
9273
- });
9274
- });
9275
- // Subscribe to the draggable state
9276
- this.draggableStateSubscription = this.jsf.draggableState$.subscribe((value) => {
9277
- this.element.draggable = value;
9278
- });
9279
- }
9280
- }
9281
- ngOnDestroy() {
9282
- if (this.draggableStateSubscription) {
9283
- this.draggableStateSubscription.unsubscribe();
9284
- }
9285
- }
9286
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OrderableDirective, deps: [{ token: i0.ElementRef }, { token: JsonSchemaFormService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
9287
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: OrderableDirective, selector: "[orderable]", inputs: { orderable: "orderable", layoutNode: "layoutNode", layoutIndex: "layoutIndex", dataIndex: "dataIndex" }, ngImport: i0 }); }
9288
- }
9289
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OrderableDirective, decorators: [{
9290
- type: Directive,
9291
- args: [{
9292
- // tslint:disable-next-line:directive-selector
9293
- selector: '[orderable]',
9294
- }]
9295
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: JsonSchemaFormService }, { type: i0.NgZone }]; }, propDecorators: { orderable: [{
9296
- type: Input
9297
- }], layoutNode: [{
9298
- type: Input
9299
- }], layoutIndex: [{
9300
- type: Input
9301
- }], dataIndex: [{
9302
- type: Input
9303
- }] } });
9304
-
9305
9317
  class RootComponent {
9306
9318
  constructor(jsf) {
9307
9319
  this.jsf = jsf;
9308
9320
  this.isFlexItem = false;
9309
- this.sortableConfig = {
9310
- filter: ".sortable-filter",
9311
- preventOnFilter: false,
9312
- onEnd: (/**Event*/ evt) => {
9313
- evt.newIndex; // most likely why this event is used is to get the dragging element's current index
9314
- // same properties as onEnd
9315
- //console.log(`sortablejs event:${evt}`);
9316
- let srcInd = evt.oldIndex;
9317
- let trgInd = evt.newIndex;
9318
- let layoutItem = this.layout[trgInd];
9319
- let dataInd = layoutItem?.arrayItem ? (this.dataIndex || []).concat(trgInd) : (this.dataIndex || []);
9320
- let layoutInd = (this.layoutIndex || []).concat(trgInd);
9321
- let itemCtx = {
9322
- dataIndex: dataInd,
9323
- layoutIndex: layoutInd,
9324
- layoutNode: layoutItem,
9325
- };
9326
- //must set moveLayout to false as nxtSortable already moves it
9327
- this.jsf.moveArrayItem(itemCtx, evt.oldIndex, evt.newIndex, false);
9328
- },
9329
- onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
9330
- if (evt.related.classList.contains("sortable-fixed")) {
9331
- //console.log(evt.related);
9332
- return false;
9333
- }
9334
- }
9321
+ this.memoizationEnabled = true;
9322
+ /**
9323
+ * Predicate function that disallows '$ref' item sorts
9324
+ * NB declared as a var instead of a function
9325
+ * like sortPredicate(index: number, item: CdkDrag<number>){..}
9326
+ * since 'this' is bound to the draglist and doesn't reference the
9327
+ * FlexLayoutRootComponent instance
9328
+ */
9329
+ //TODO also need to think of other types such as button which can be
9330
+ //created by an arbitrary layout
9331
+ //might not be needed added condition to [cdkDragDisabled]
9332
+ this.sortPredicate = (index, item) => {
9333
+ let layoutItem = this.layout[index];
9334
+ let result = this.isDraggable(layoutItem);
9335
+ //layoutItem.type != '$ref';
9336
+ return result;
9335
9337
  };
9336
- }
9337
- sortableInit(sortable) {
9338
- this.sortableObj = sortable;
9339
- //Sortable.utils.on(this.sortableObj.el,"nulling",(s)=>{console.log("event nulling sortablejs")})
9340
- ///NB issue caused by sortablejs when it its destroyed
9341
- //this mainly affects checkboxes coupled with conditions
9342
- //-the value is rechecked
9343
- //-see https://github.com/SortableJS/Sortable/issues/1052#issuecomment-369613072
9344
- /* attempt to monkey patch sortable js
9345
- const originalMethod = sortable._nulling;
9346
- let zone=this.zone;
9347
- sortable._nulling=function() {
9348
- console.log(`pluginEvent 2 ${pluginEvent}`)
9349
- zone.runOutsideAngular(() => {
9350
- console.log(`pluginEvent3 ${pluginEvent}`)
9351
- pluginEvent('nulling', this);
9352
-
9353
- rootEl =
9354
- dragEl =
9355
- parentEl =
9356
- ghostEl =
9357
- nextEl =
9358
- cloneEl =
9359
- lastDownEl =
9360
- cloneHidden =
9361
-
9362
- tapEvt =
9363
- touchEvt =
9338
+ //private selectframeworkInputCache = new Map<string, { dataIndex: any[], layoutIndex: any[], layoutNode: any }>();
9339
+ //TODO review caching-if form field values change, the changes are not propagated
9340
+ /*
9341
+ getSelectFrameworkInputs(layoutItem: any, i: number) {
9342
+ // Create a unique key based on the layoutItem and index
9343
+ const cacheKey = `${layoutItem._id}-${i}`;
9344
+
9345
+ // If the result is already in the cache, return it
9346
+ if(this.enableCaching){
9347
+ if (this.selectframeworkInputCache.has(cacheKey)) {
9348
+ return this.selectframeworkInputCache.get(cacheKey);
9349
+ }
9350
+ }
9364
9351
 
9365
- moved =
9366
- newIndex =
9367
- newDraggableIndex =
9368
- oldIndex =
9369
- oldDraggableIndex =
9370
9352
 
9371
- lastTarget =
9372
- lastDirection =
9353
+ // If not cached, calculate the values (assuming dataIndex() and layoutIndex() are functions)
9354
+ const dataIndex = layoutItem?.arrayItem ? (this.dataIndex() || []).concat(i) : (this.dataIndex() || []);
9355
+ const layoutIndex = (this.layoutIndex() || []).concat(i);
9373
9356
 
9374
- putSortable =
9375
- activeGroup =
9376
- Sortable.dragged =
9377
- Sortable.ghost =
9378
- Sortable.clone =
9379
- Sortable.active = null;
9357
+ // Save the result in the cache
9358
+ const result = { dataIndex, layoutIndex, layoutNode: layoutItem };
9359
+ if(this.enableCaching){
9360
+ this.selectframeworkInputCache.set(cacheKey, result);
9361
+ }
9380
9362
 
9381
-
9382
- let el = this.el;
9383
- savedInputChecked.forEach(function (checkEl) {
9384
- if (el.contains(checkEl)) {
9385
- checkEl.checked = true;
9386
- }
9387
- });
9388
-
9389
- savedInputChecked.length =
9390
- lastDx =
9391
- lastDy = 0;
9392
-
9393
- })
9394
-
9395
- }.bind(sortable)
9396
- */
9363
+ return result;
9364
+ }
9365
+ */
9366
+ this._getSelectFrameworkInputsRaw = (layoutItem, i) => {
9367
+ const dataIndexValue = this.dataIndex || [];
9368
+ const layoutIndexValue = this.layoutIndex || [];
9369
+ return {
9370
+ layoutNode: layoutItem,
9371
+ layoutIndex: [...layoutIndexValue, i],
9372
+ dataIndex: layoutItem?.arrayItem ? [...dataIndexValue, i] : dataIndexValue,
9373
+ };
9374
+ };
9375
+ // Define a separate function to hold the memoized version
9376
+ this._getSelectFrameworkInputsMemoized = memoize(this._getSelectFrameworkInputsRaw, (layoutItem, i) => {
9377
+ const layoutItemKey = layoutItem?.id ?? JSON.stringify(layoutItem);
9378
+ return `${layoutItemKey}-${i}`;
9379
+ });
9380
+ }
9381
+ drop(event) {
9382
+ // most likely why this event is used is to get the dragging element's current index
9383
+ let srcInd = event.previousIndex;
9384
+ let trgInd = event.currentIndex;
9385
+ let layoutItem = this.layout[trgInd];
9386
+ let dataInd = layoutItem?.arrayItem ? (this.dataIndex || []).concat(trgInd) : (this.dataIndex || []);
9387
+ let layoutInd = (this.layoutIndex || []).concat(trgInd);
9388
+ let itemCtx = {
9389
+ dataIndex: dataInd,
9390
+ layoutIndex: layoutInd,
9391
+ layoutNode: layoutItem
9392
+ };
9393
+ this.jsf.moveArrayItem(itemCtx, srcInd, trgInd, true);
9397
9394
  }
9398
9395
  isDraggable(node) {
9399
9396
  let result = node.arrayItem && node.type !== '$ref' &&
9400
- node.arrayItemType === 'list' && this.isOrderable !== false;
9401
- if (this.sortableObj) {
9402
- //this.sortableObj.option("disabled",true);
9403
- //this.sortableObj.option("sort",false);
9404
- //this.sortableObj.option("disabled",!result);
9405
- }
9397
+ node.arrayItemType === 'list' && this.isOrderable !== false
9398
+ && node.type !== 'submit';
9406
9399
  return result;
9407
9400
  }
9408
9401
  //TODO also need to think of other types such as button which can be
@@ -9418,93 +9411,157 @@ class RootComponent {
9418
9411
  return ((node.options || {}).flex || '').split(/\s+/)[index] ||
9419
9412
  (node.options || {})[attribute] || ['1', '1', 'auto'][index];
9420
9413
  }
9414
+ // This is the public function that the template calls
9415
+ getSelectFrameworkInputs(layoutItem, i) {
9416
+ if (this.memoizationEnabled) {
9417
+ return this._getSelectFrameworkInputsMemoized(layoutItem, i);
9418
+ }
9419
+ else {
9420
+ return this._getSelectFrameworkInputsRaw(layoutItem, i);
9421
+ }
9422
+ }
9423
+ trackByFn(index, item) {
9424
+ return item._id ?? index;
9425
+ }
9426
+ /*
9427
+ ngOnChanges(changes: SimpleChanges): void {
9428
+ // If any of the input properties change, clear the cache
9429
+ if (changes.dataIndex || changes.layoutIndex || changes.layout) {
9430
+ this.selectframeworkInputCache?.clear(); // Clear the entire cache
9431
+ }
9432
+ }
9433
+ */
9434
+ ngOnChanges(changes) {
9435
+ if (changes['layout'] || changes['dataIndex'] || changes['layoutIndex']) {
9436
+ // Clear the entire cache of the memoized function
9437
+ this._getSelectFrameworkInputsMemoized.cache.clear();
9438
+ }
9439
+ }
9421
9440
  showWidget(layoutNode) {
9422
9441
  return this.jsf.evaluateCondition(layoutNode, this.dataIndex);
9423
9442
  }
9424
9443
  ngOnInit() {
9425
- // Subscribe to the draggable state
9426
- this.sortableOptionsSubscription = this.jsf.sortableOptions$.subscribe((optsValue) => {
9427
- if (this.sortableObj) {
9428
- Object.keys(optsValue).forEach(opt => {
9429
- let optVal = optsValue[opt];
9430
- this.sortableObj.option(opt, optVal);
9431
- });
9432
- //this.sortableObj.option("disabled",true);
9433
- //this.sortableObj.option("sort",false);
9434
- }
9435
- });
9444
+ if (this.memoizationEnabled) {
9445
+ this.jsf.dataChanges.subscribe((val) => {
9446
+ //this.selectframeworkInputCache?.clear();
9447
+ this._getSelectFrameworkInputsMemoized.cache.clear();
9448
+ });
9449
+ }
9436
9450
  }
9437
9451
  ngOnDestroy() {
9438
- if (this.sortableOptionsSubscription) {
9439
- this.sortableOptionsSubscription.unsubscribe();
9440
- }
9452
+ //this.selectframeworkInputCache?.clear()
9453
+ //this.selectframeworkInputCache=null;
9454
+ this._getSelectFrameworkInputsMemoized.cache.clear();
9455
+ this.dataChangesSubs?.unsubscribe();
9441
9456
  }
9442
9457
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RootComponent, deps: [{ token: JsonSchemaFormService }], target: i0.ɵɵFactoryTarget.Component }); }
9443
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: RootComponent, selector: "root-widget", inputs: { dataIndex: "dataIndex", layoutIndex: "layoutIndex", layout: "layout", isOrderable: "isOrderable", isFlexItem: "isFlexItem" }, ngImport: i0, template: `
9444
- <div [class.flex-inherit]="true" #sortableContainter [nxtSortablejs]="layout" [config]="sortableConfig" (init)="sortableInit($event)">
9445
- <div *ngFor="let layoutItem of layout; let i = index"
9458
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: RootComponent, selector: "root-widget", inputs: { dataIndex: "dataIndex", layoutIndex: "layoutIndex", layout: "layout", isOrderable: "isOrderable", isFlexItem: "isFlexItem", memoizationEnabled: "memoizationEnabled" }, usesOnChanges: true, ngImport: i0, template: `
9459
+ <div cdkDropList (cdkDropListDropped)="drop($event)"
9460
+ [class.flex-inherit]="true"
9461
+ [cdkDropListSortPredicate]="sortPredicate"
9462
+ >
9463
+ <!-- -for now left out
9464
+ cdkDragHandle directive, by itself, does not disable the
9465
+ default drag behavior of its parent cdkDrag element.
9466
+ You must explicitly disable dragging on the main element
9467
+ and re-enable it only when using the handle.
9468
+ -->
9469
+ <div *ngFor="let layoutItem of layout; let i = index;trackBy: trackByFn"
9470
+ cdkDrag [cdkDragStartDelay]="{touch:1000,mouse:0}"
9471
+ [cdkDragDisabled]="!isDraggable(layoutItem)"
9446
9472
  [class.form-flex-item]="isFlexItem"
9447
9473
  [style.align-self]="(layoutItem.options || {})['align-self']"
9448
9474
  [style.flex-basis]="getFlexAttribute(layoutItem, 'flex-basis')"
9449
9475
  [style.flex-grow]="getFlexAttribute(layoutItem, 'flex-grow')"
9450
9476
  [style.flex-shrink]="getFlexAttribute(layoutItem, 'flex-shrink')"
9451
9477
  [style.order]="(layoutItem.options || {}).order"
9452
- [class.sortable-filter]="!isDraggable(layoutItem)"
9453
- [class.sortable-fixed]="isFixed(layoutItem)"
9454
9478
  >
9479
+
9480
+ <!-- workaround to disbale dragging of input fields -->
9481
+ <!--
9482
+ <div *ngIf="layoutItem?.dataType !='object'" cdkDragHandle>
9483
+ <p>Drag Handle {{layoutItem?.dataType}}</p>
9484
+ </div>
9485
+ -->
9455
9486
  <!--NB orderable directive is not used but has been left in for now and set to false
9456
9487
  otherwise the compiler won't recognize dataIndex and other dependent attributes
9457
9488
  -->
9489
+ <!--
9458
9490
  <div
9459
9491
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex || []).concat(i) : (dataIndex || [])"
9460
9492
  [layoutIndex]="(layoutIndex || []).concat(i)"
9461
9493
  [layoutNode]="layoutItem"
9462
9494
  [orderable]="false"
9463
- [class.sortable-filter]="!isDraggable(layoutItem)"
9464
- [class.sortable-fixed]="isFixed(layoutItem)"
9465
9495
  >
9466
9496
  <select-framework-widget *ngIf="showWidget(layoutItem)"
9467
9497
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex || []).concat(i) : (dataIndex || [])"
9468
9498
  [layoutIndex]="(layoutIndex || []).concat(i)"
9469
9499
  [layoutNode]="layoutItem"></select-framework-widget>
9470
9500
  </div>
9501
+ -->
9502
+ <select-framework-widget *ngIf="showWidget(layoutItem)"
9503
+ [dataIndex]="getSelectFrameworkInputs(layoutItem,i).dataIndex"
9504
+ [layoutIndex]="getSelectFrameworkInputs(layoutItem,i).layoutIndex"
9505
+ [layoutNode]="getSelectFrameworkInputs(layoutItem,i).layoutNode">
9506
+ </select-framework-widget>
9471
9507
  </div>
9472
9508
  </div>
9473
- `, 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: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$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"] }] }); }
9509
+ `, 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: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i3$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: SelectFrameworkComponent, selector: "select-framework-widget", inputs: ["layoutNode", "layoutIndex", "dataIndex"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9474
9510
  }
9475
9511
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RootComponent, decorators: [{
9476
9512
  type: Component,
9477
9513
  args: [{ selector: 'root-widget', template: `
9478
- <div [class.flex-inherit]="true" #sortableContainter [nxtSortablejs]="layout" [config]="sortableConfig" (init)="sortableInit($event)">
9479
- <div *ngFor="let layoutItem of layout; let i = index"
9514
+ <div cdkDropList (cdkDropListDropped)="drop($event)"
9515
+ [class.flex-inherit]="true"
9516
+ [cdkDropListSortPredicate]="sortPredicate"
9517
+ >
9518
+ <!-- -for now left out
9519
+ cdkDragHandle directive, by itself, does not disable the
9520
+ default drag behavior of its parent cdkDrag element.
9521
+ You must explicitly disable dragging on the main element
9522
+ and re-enable it only when using the handle.
9523
+ -->
9524
+ <div *ngFor="let layoutItem of layout; let i = index;trackBy: trackByFn"
9525
+ cdkDrag [cdkDragStartDelay]="{touch:1000,mouse:0}"
9526
+ [cdkDragDisabled]="!isDraggable(layoutItem)"
9480
9527
  [class.form-flex-item]="isFlexItem"
9481
9528
  [style.align-self]="(layoutItem.options || {})['align-self']"
9482
9529
  [style.flex-basis]="getFlexAttribute(layoutItem, 'flex-basis')"
9483
9530
  [style.flex-grow]="getFlexAttribute(layoutItem, 'flex-grow')"
9484
9531
  [style.flex-shrink]="getFlexAttribute(layoutItem, 'flex-shrink')"
9485
9532
  [style.order]="(layoutItem.options || {}).order"
9486
- [class.sortable-filter]="!isDraggable(layoutItem)"
9487
- [class.sortable-fixed]="isFixed(layoutItem)"
9488
9533
  >
9534
+
9535
+ <!-- workaround to disbale dragging of input fields -->
9536
+ <!--
9537
+ <div *ngIf="layoutItem?.dataType !='object'" cdkDragHandle>
9538
+ <p>Drag Handle {{layoutItem?.dataType}}</p>
9539
+ </div>
9540
+ -->
9489
9541
  <!--NB orderable directive is not used but has been left in for now and set to false
9490
9542
  otherwise the compiler won't recognize dataIndex and other dependent attributes
9491
9543
  -->
9544
+ <!--
9492
9545
  <div
9493
9546
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex || []).concat(i) : (dataIndex || [])"
9494
9547
  [layoutIndex]="(layoutIndex || []).concat(i)"
9495
9548
  [layoutNode]="layoutItem"
9496
9549
  [orderable]="false"
9497
- [class.sortable-filter]="!isDraggable(layoutItem)"
9498
- [class.sortable-fixed]="isFixed(layoutItem)"
9499
9550
  >
9500
9551
  <select-framework-widget *ngIf="showWidget(layoutItem)"
9501
9552
  [dataIndex]="layoutItem?.arrayItem ? (dataIndex || []).concat(i) : (dataIndex || [])"
9502
9553
  [layoutIndex]="(layoutIndex || []).concat(i)"
9503
9554
  [layoutNode]="layoutItem"></select-framework-widget>
9504
9555
  </div>
9556
+ -->
9557
+ <select-framework-widget *ngIf="showWidget(layoutItem)"
9558
+ [dataIndex]="getSelectFrameworkInputs(layoutItem,i).dataIndex"
9559
+ [layoutIndex]="getSelectFrameworkInputs(layoutItem,i).layoutIndex"
9560
+ [layoutNode]="getSelectFrameworkInputs(layoutItem,i).layoutNode">
9561
+ </select-framework-widget>
9505
9562
  </div>
9506
9563
  </div>
9507
- `, 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"] }]
9564
+ `, 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"] }]
9508
9565
  }], ctorParameters: function () { return [{ type: JsonSchemaFormService }]; }, propDecorators: { dataIndex: [{
9509
9566
  type: Input
9510
9567
  }], layoutIndex: [{
@@ -9515,6 +9572,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
9515
9572
  type: Input
9516
9573
  }], isFlexItem: [{
9517
9574
  type: Input
9575
+ }], memoizationEnabled: [{
9576
+ type: Input
9518
9577
  }] } });
9519
9578
 
9520
9579
  class SectionComponent {
@@ -9637,7 +9696,7 @@ class SectionComponent {
9637
9696
  [class]="options?.labelHelpBlockClass || ''"
9638
9697
  [innerHTML]="options?.description"></p>
9639
9698
  </div>
9640
- </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: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }] }); }
9699
+ </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: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem", "memoizationEnabled"] }] }); }
9641
9700
  }
9642
9701
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SectionComponent, decorators: [{
9643
9702
  type: Component,
@@ -9987,8 +10046,10 @@ class SubmitComponent {
9987
10046
  [name]="controlName"
9988
10047
  [type]="layoutNode?.type"
9989
10048
  [value]="controlValue"
9990
- (click)="updateValue($event)">
9991
- </div>`, isInline: true }); }
10049
+ (click)="updateValue($event)"
10050
+ [appStopPropagation]="['mousedown', 'touchstart']"
10051
+ >
10052
+ </div>`, isInline: true, dependencies: [{ kind: "directive", type: StopPropagationDirective, selector: "[appStopPropagation]", inputs: ["appStopPropagation"] }] }); }
9992
10053
  }
9993
10054
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SubmitComponent, decorators: [{
9994
10055
  type: Component,
@@ -10008,7 +10069,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
10008
10069
  [name]="controlName"
10009
10070
  [type]="layoutNode?.type"
10010
10071
  [value]="controlValue"
10011
- (click)="updateValue($event)">
10072
+ (click)="updateValue($event)"
10073
+ [appStopPropagation]="['mousedown', 'touchstart']"
10074
+ >
10012
10075
  </div>`,
10013
10076
  }]
10014
10077
  }], ctorParameters: function () { return [{ type: JsonSchemaFormService }]; }, propDecorators: { layoutNode: [{
@@ -10732,7 +10795,7 @@ class TabComponent {
10732
10795
  [dataIndex]="dataIndex"
10733
10796
  [layoutIndex]="layoutIndex"
10734
10797
  [layout]="layoutNode.items"></root-widget>
10735
- </div>`, isInline: true, dependencies: [{ kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }] }); }
10798
+ </div>`, isInline: true, dependencies: [{ kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem", "memoizationEnabled"] }] }); }
10736
10799
  }
10737
10800
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TabComponent, decorators: [{
10738
10801
  type: Component,
@@ -10755,6 +10818,135 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
10755
10818
  type: Input
10756
10819
  }] } });
10757
10820
 
10821
+ /**
10822
+ * OrderableDirective
10823
+ *
10824
+ * Enables array elements to be reordered by dragging and dropping.
10825
+ *
10826
+ * Only works for arrays that have at least two elements.
10827
+ *
10828
+ * Also detects arrays-within-arrays, and correctly moves either
10829
+ * the child array element or the parent array element,
10830
+ * depending on the drop targert.
10831
+ *
10832
+ * Listeners for movable element being dragged:
10833
+ * - dragstart: add 'dragging' class to element, set effectAllowed = 'move'
10834
+ * - dragover: set dropEffect = 'move'
10835
+ * - dragend: remove 'dragging' class from element
10836
+ *
10837
+ * Listeners for stationary items being dragged over:
10838
+ * - dragenter: add 'drag-target-...' classes to element
10839
+ * - dragleave: remove 'drag-target-...' classes from element
10840
+ * - drop: remove 'drag-target-...' classes from element, move dropped array item
10841
+ */
10842
+ class OrderableDirective {
10843
+ constructor(elementRef, jsf, ngZone) {
10844
+ this.elementRef = elementRef;
10845
+ this.jsf = jsf;
10846
+ this.ngZone = ngZone;
10847
+ this.overParentElement = false;
10848
+ this.overChildElement = false;
10849
+ }
10850
+ ngOnInit() {
10851
+ if (this.orderable && this.layoutNode && this.layoutIndex && this.dataIndex) {
10852
+ this.element = this.elementRef.nativeElement;
10853
+ this.element.draggable = true;
10854
+ this.arrayLayoutIndex = 'move:' + this.layoutIndex.slice(0, -1).toString();
10855
+ this.ngZone.runOutsideAngular(() => {
10856
+ // Listeners for movable element being dragged:
10857
+ this.element.addEventListener('dragstart', (event) => {
10858
+ event.dataTransfer.effectAllowed = 'move';
10859
+ event.dataTransfer.setData('text', '');
10860
+ // Hack to bypass stupid HTML drag-and-drop dataTransfer protection
10861
+ // so drag source info will be available on dragenter
10862
+ const sourceArrayIndex = this.dataIndex[this.dataIndex.length - 1];
10863
+ sessionStorage.setItem(this.arrayLayoutIndex, sourceArrayIndex + '');
10864
+ });
10865
+ this.element.addEventListener('dragover', (event) => {
10866
+ if (event.preventDefault) {
10867
+ event.preventDefault();
10868
+ }
10869
+ event.dataTransfer.dropEffect = 'move';
10870
+ return false;
10871
+ });
10872
+ // Listeners for stationary items being dragged over:
10873
+ this.element.addEventListener('dragenter', (event) => {
10874
+ // Part 1 of a hack, inspired by Dragster, to simulate mouseover and mouseout
10875
+ // behavior while dragging items - http://bensmithett.github.io/dragster/
10876
+ if (this.overParentElement) {
10877
+ return this.overChildElement = true;
10878
+ }
10879
+ else {
10880
+ this.overParentElement = true;
10881
+ }
10882
+ const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
10883
+ if (sourceArrayIndex !== null) {
10884
+ if (this.dataIndex[this.dataIndex.length - 1] < +sourceArrayIndex) {
10885
+ this.element.classList.add('drag-target-top');
10886
+ }
10887
+ else if (this.dataIndex[this.dataIndex.length - 1] > +sourceArrayIndex) {
10888
+ this.element.classList.add('drag-target-bottom');
10889
+ }
10890
+ }
10891
+ });
10892
+ this.element.addEventListener('dragleave', (event) => {
10893
+ // Part 2 of the Dragster hack
10894
+ if (this.overChildElement) {
10895
+ this.overChildElement = false;
10896
+ }
10897
+ else if (this.overParentElement) {
10898
+ this.overParentElement = false;
10899
+ }
10900
+ const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
10901
+ if (!this.overParentElement && !this.overChildElement && sourceArrayIndex !== null) {
10902
+ this.element.classList.remove('drag-target-top');
10903
+ this.element.classList.remove('drag-target-bottom');
10904
+ }
10905
+ });
10906
+ this.element.addEventListener('drop', (event) => {
10907
+ this.element.classList.remove('drag-target-top');
10908
+ this.element.classList.remove('drag-target-bottom');
10909
+ // Confirm that drop target is another item in the same array as source item
10910
+ const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
10911
+ const destArrayIndex = this.dataIndex[this.dataIndex.length - 1];
10912
+ if (sourceArrayIndex !== null && +sourceArrayIndex !== destArrayIndex) {
10913
+ // Move array item
10914
+ this.jsf.moveArrayItem(this, +sourceArrayIndex, destArrayIndex);
10915
+ }
10916
+ sessionStorage.removeItem(this.arrayLayoutIndex);
10917
+ return false;
10918
+ });
10919
+ });
10920
+ // Subscribe to the draggable state
10921
+ this.draggableStateSubscription = this.jsf.draggableState$.subscribe((value) => {
10922
+ this.element.draggable = value;
10923
+ });
10924
+ }
10925
+ }
10926
+ ngOnDestroy() {
10927
+ if (this.draggableStateSubscription) {
10928
+ this.draggableStateSubscription.unsubscribe();
10929
+ }
10930
+ }
10931
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OrderableDirective, deps: [{ token: i0.ElementRef }, { token: JsonSchemaFormService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
10932
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: OrderableDirective, selector: "[orderable]", inputs: { orderable: "orderable", layoutNode: "layoutNode", layoutIndex: "layoutIndex", dataIndex: "dataIndex" }, ngImport: i0 }); }
10933
+ }
10934
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OrderableDirective, decorators: [{
10935
+ type: Directive,
10936
+ args: [{
10937
+ // tslint:disable-next-line:directive-selector
10938
+ selector: '[orderable]',
10939
+ }]
10940
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: JsonSchemaFormService }, { type: i0.NgZone }]; }, propDecorators: { orderable: [{
10941
+ type: Input
10942
+ }], layoutNode: [{
10943
+ type: Input
10944
+ }], layoutIndex: [{
10945
+ type: Input
10946
+ }], dataIndex: [{
10947
+ type: Input
10948
+ }] } });
10949
+
10758
10950
  const BASIC_WIDGETS = [
10759
10951
  AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent,
10760
10952
  CheckboxesComponent, FileComponent, HiddenComponent, InputComponent,
@@ -10766,39 +10958,16 @@ const BASIC_WIDGETS = [
10766
10958
 
10767
10959
  class WidgetLibraryModule {
10768
10960
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WidgetLibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
10769
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: WidgetLibraryModule, declarations: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, SelectCheckboxComponent, OrderableDirective, ElementAttributeDirective], imports: [CommonModule, FormsModule, ReactiveFormsModule, i3$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] }); }
10770
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WidgetLibraryModule, imports: [CommonModule, FormsModule, ReactiveFormsModule,
10771
- SortablejsModule.forRoot({
10772
- //disabled:false,
10773
- //draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
10774
- filter: ".sortable-filter",
10775
- preventOnFilter: false,
10776
- onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
10777
- if (evt.related.classList.contains("sortable-fixed")) {
10778
- //console.log(evt.related);
10779
- return false;
10780
- }
10781
- }
10782
- })] }); }
10961
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: WidgetLibraryModule, declarations: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, SelectCheckboxComponent, OrderableDirective, ElementAttributeDirective, StopPropagationDirective], imports: [CommonModule, FormsModule, ReactiveFormsModule, DragDropModule], exports: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, SelectCheckboxComponent, OrderableDirective, ElementAttributeDirective, StopPropagationDirective] }); }
10962
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WidgetLibraryModule, imports: [CommonModule, FormsModule, ReactiveFormsModule, DragDropModule] }); }
10783
10963
  }
10784
10964
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WidgetLibraryModule, decorators: [{
10785
10965
  type: NgModule,
10786
10966
  args: [{
10787
- imports: [CommonModule, FormsModule, ReactiveFormsModule,
10788
- SortablejsModule.forRoot({
10789
- //disabled:false,
10790
- //draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
10791
- filter: ".sortable-filter",
10792
- preventOnFilter: false,
10793
- onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
10794
- if (evt.related.classList.contains("sortable-fixed")) {
10795
- //console.log(evt.related);
10796
- return false;
10797
- }
10798
- }
10799
- })],
10800
- declarations: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective],
10801
- exports: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective]
10967
+ imports: [CommonModule, FormsModule, ReactiveFormsModule, DragDropModule
10968
+ ],
10969
+ declarations: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective, StopPropagationDirective],
10970
+ exports: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective, StopPropagationDirective]
10802
10971
  }]
10803
10972
  }] });
10804
10973
 
@@ -11524,7 +11693,7 @@ class JsonSchemaFormComponent {
11524
11693
  }
11525
11694
  }
11526
11695
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: JsonSchemaFormComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: FrameworkLibraryService }, { token: WidgetLibraryService }, { token: JsonSchemaFormService }], target: i0.ɵɵFactoryTarget.Component }); }
11527
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: JsonSchemaFormComponent, selector: "json-schema-form", inputs: { schema: "schema", layout: "layout", data: "data", options: "options", framework: "framework", widgets: "widgets", form: "form", model: "model", JSONSchema: "JSONSchema", UISchema: "UISchema", formData: "formData", ngModel: "ngModel", language: "language", loadExternalAssets: "loadExternalAssets", debug: "debug", theme: "theme", ajvOptions: "ajvOptions", value: "value" }, 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: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.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 }); }
11696
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: JsonSchemaFormComponent, selector: "json-schema-form", inputs: { schema: "schema", layout: "layout", data: "data", options: "options", framework: "framework", widgets: "widgets", form: "form", model: "model", JSONSchema: "JSONSchema", UISchema: "UISchema", formData: "formData", ngModel: "ngModel", language: "language", loadExternalAssets: "loadExternalAssets", debug: "debug", theme: "theme", ajvOptions: "ajvOptions", value: "value" }, 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: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem", "memoizationEnabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
11528
11697
  }
11529
11698
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: JsonSchemaFormComponent, decorators: [{
11530
11699
  type: Component,
@@ -11614,5 +11783,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
11614
11783
  * Generated bundle index. Do not edit.
11615
11784
  */
11616
11785
 
11617
- 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 };
11786
+ 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 };
11618
11787
  //# sourceMappingURL=ng-formworks-core.mjs.map