@ng-formworks/core 19.6.0 → 19.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import * as i1 from '@angular/common';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { Injectable, inject, input, viewChild, ViewContainerRef, Component, Input, Directive, ChangeDetectionStrategy, ViewChild, signal, ElementRef, NgZone, NgModule, Inject, forwardRef, ChangeDetectorRef, output } from '@angular/core';
4
+ import { Injectable, inject, input, viewChild, ViewContainerRef, Component, Input, Directive, ChangeDetectionStrategy, ViewChild, signal, ElementRef, NgZone, Inject, NgModule, forwardRef, ChangeDetectorRef, output } from '@angular/core';
5
5
  import * as i2 from '@angular/forms';
6
6
  import { UntypedFormControl, UntypedFormArray, UntypedFormGroup, FormsModule, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
7
7
  import addFormats from 'ajv-formats';
@@ -10,7 +10,7 @@ import jsonDraft6 from 'ajv/lib/refs/json-schema-draft-06.json';
10
10
  import jsonDraft7 from 'ajv/lib/refs/json-schema-draft-07.json';
11
11
  import cloneDeep from 'lodash/cloneDeep';
12
12
  import { from, Observable, forkJoin, Subject, BehaviorSubject, lastValueFrom } from 'rxjs';
13
- import { some, isNil, isEmpty as isEmpty$1, isObject as isObject$1, isEqual as isEqual$2 } from 'lodash';
13
+ import { some, isNil, isEmpty as isEmpty$1, pick, isObject as isObject$1, isEqual as isEqual$2 } 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';
@@ -4586,18 +4586,76 @@ function fixRequiredArrayProperties(schema) {
4586
4586
  * @param schema:any
4587
4587
  * @param negate:boolean=false
4588
4588
  * @returns
4589
-
4590
4589
  */
4591
- function convertJSONSchemaIfToCondition(schema, negate = false) {
4590
+ //TODO also handle ifs with mixed conditional such as allOf/oneOf etc
4591
+ /*
4592
+
4593
+ "if": {
4594
+ "allOf": [
4595
+ {
4596
+ "properties": {
4597
+ "animalType": {
4598
+ "enum": ["Cat", "Fish"]
4599
+ }
4600
+ }
4601
+ },
4602
+ {
4603
+ "properties": {
4604
+ "color": {
4605
+ "const": "orange"
4606
+ }
4607
+ }
4608
+ }
4609
+ ]
4610
+ }
4611
+
4612
+
4613
+
4614
+ */
4615
+ function convertJSONSchemaIfToCondition(schema, layoutNode, negate = false) {
4592
4616
  let conditionFun = "";
4593
4617
  let condition = {};
4594
4618
  let notOp = negate ? "!" : "";
4619
+ // expects "dataPointer" to be like "/a/b/c"
4620
+ //TODO-test
4621
+ //dataPointer can be something like /cities/-/name
4622
+ //must end up like model.cities[arrayIndices].name
4623
+ //also check can possibly be nested array like /cities/-/sites/-/siteName
4624
+ //in this case must probably end up like
4625
+ // /cities/arrayIndices[0]/sites/arrayIndices[1]/siteName
4626
+ //but it seems evaluatCondition support only one level for now
4627
+ //and uses arrayIndices as the last index only -check?
4628
+ let parentPath = layoutNode.dataPointer ? layoutNode.dataPointer
4629
+ .split("/")
4630
+ .slice(1, -1)
4631
+ .map((part, ind) => {
4632
+ let sep = ind == 0 ? "" : ".";
4633
+ let ret = part == "-" ? "[arrayIndices]" : sep + part;
4634
+ return ret;
4635
+ })
4636
+ .join("")
4637
+ : "";
4638
+ let modelPath = parentPath ? `model.${parentPath}` : "model";
4639
+ let checkPath = modelPath.split('.')
4640
+ .map((_, index, array) => {
4641
+ return array.slice(0, index + 1).join('.'); // Build each part of the path dynamically
4642
+ }).join(' && '); // Join the parts with '&&'
4643
+ // .reduce((accumulator, currentPart, index) => {
4644
+ // const currentExpression = index === 0 ? currentPart : `${accumulator}.${currentPart}`;
4645
+ // return index === 0 ? currentExpression : `${accumulator} && ${currentExpression}`;
4646
+ // }, '');
4595
4647
  if (schema.if) {
4596
4648
  Object.keys(schema.if.properties).forEach((ifProp, ind) => {
4597
4649
  let amper = ind > 0 ? "&" : "";
4598
4650
  //Note the model value is first converted to string and so is the condition
4599
4651
  //so that booleans and numbers can also be compared
4600
- conditionFun += `${amper}model.${ifProp}+""=='${schema.if.properties[ifProp].const}'`;
4652
+ //changed to an includesList to handle cases such as
4653
+ const includesList = hasOwn(schema.if.properties[ifProp], "const") ? [schema.if.properties[ifProp].const]
4654
+ : hasOwn(schema.if.properties[ifProp], "enum") ? schema.if.properties[ifProp].enum
4655
+ : [];
4656
+ const includesListAsStr = includesList.map(val => { return `"${val}"`; });
4657
+ conditionFun += `${amper} ${checkPath} && [${includesListAsStr}].includes(${modelPath}.${ifProp}+"")`;
4658
+ //conditionFun+=`${amper} ${checkPath} && ${modelPath}.${ifProp}+""=='${schema.if.properties[ifProp].const}'`
4601
4659
  });
4602
4660
  }
4603
4661
  condition["functionBody"] = `return ${notOp}(${conditionFun})`;
@@ -5027,7 +5085,7 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
5027
5085
  ["then", "else"].forEach(con => {
5028
5086
  if (hasOwn(schema, con)) {
5029
5087
  const keySchemaPointer = `/${con}`;
5030
- let thenFGTemplate = buildFormGroupTemplate(jsf, nodeValue, false, //JsonPointer.get(nodeValue, keySchemaPointer), setValues,
5088
+ let thenFGTemplate = buildFormGroupTemplate(jsf, nodeValue, setValues, //false,//JsonPointer.get(nodeValue, keySchemaPointer), setValues,
5031
5089
  schemaPointer + keySchemaPointer, dataPointer, templatePointer + `/controls/${con}`);
5032
5090
  Object.assign(controls, thenFGTemplate.controls);
5033
5091
  }
@@ -5088,7 +5146,9 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
5088
5146
  if (foundKeys && foundKeys.length > 0) {
5089
5147
  const keySchemaPointer = `/${ofType}/${ind}`;
5090
5148
  //console.log(`found:${keySchemaPointer}`);
5091
- let newNodeValue = JsonPointer.get(nodeValue, keySchemaPointer);
5149
+ let newNodeValue = nodeValue;
5150
+ //JsonPointer.get(nodeValue, dataPointer);
5151
+ //JsonPointer.get(nodeValue, keySchemaPointer);
5092
5152
  if (ofType == "oneOf") {
5093
5153
  newNodeValue = nodeValue;
5094
5154
  }
@@ -5115,16 +5175,59 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
5115
5175
  //if key is a $oneOf key then it was inserted at the root of the controls
5116
5176
  //as form control name will be the full(escaped) path
5117
5177
  const pointerPath = key.startsWith('$oneOf') ? controlItem.schemaPointer : keySchemaPointer;
5118
- let oneOfItemSchema = JsonPointer.get(schema, pointerPath);
5119
- let oneOfItemValue = {};
5120
- oneOfItemValue[key] = controlItem.value?.value;
5121
- if (controlItem.value && !jsf.ajv.validate(oneOfItemSchema, oneOfItemValue)) {
5122
- controlItem.value.value = null;
5178
+ let oneOfItemSchema = JsonPointer.get(jsf.schema, controlItem.schemaPointer);
5179
+ //JsonPointer.get(schema,pointerPath);
5180
+ let dPointer = controlItem.schemaPointer.replace(/(anyOf|allOf|oneOf|none)\/[\d]+\//g, '')
5181
+ .replace(/(if|then|else|properties)\//g, '').replace(/\/items\//g, '/-/');
5182
+ dPointer = dPointer.indexOf(dataPointer) == 0
5183
+ ? dPointer.substring(dataPointer.length) : dPointer;
5184
+ //dataPointer+"/"+controlItem.schemaPointer.split("/").slice(-1)[0];
5185
+ ////controlItem.schemaPointer.replace(/(anyOf|allOf|oneOf|none)\/[\d]+\//g, '')
5186
+ ////.replace(/(if|then|else|properties)\//g, '').replace(/\/items\//g,'/-/');
5187
+ //JsonPointer.toDataPointer(controlItem.schemaPointer,jsf.schema);
5188
+ //console.log(`dataPointer:${dataPointer}\ndPointer:${dPointer}`)
5189
+ let dVal = //JsonPointer.get(jsf.formValues,dPointer);
5190
+ JsonPointer.get(nodeValue, dPointer);
5191
+ let fkey = key;
5192
+ let oneOfItemValue = dVal;
5193
+ /*
5194
+ if(hasOwn(oneOfItemSchema,"if") && controlItem.schemaPointer
5195
+ && controlItem.schemaPointer.indexOf(keySchemaPointer)==0){
5196
+ let parts=controlItem.schemaPointer
5197
+ .split(keySchemaPointer).join('').split("/")
5198
+ let thenOrElse=parts[1];
5199
+ fkey=parts[parts.length-1];
5200
+ oneOfItemSchema=oneOfItemSchema[thenOrElse];
5201
+ }
5202
+
5203
+ if(oneOfItemSchema.properties && jsf.formValues===undefined){
5204
+ //check if no form data values were supplied
5205
+ //then set it to default otherwise to its nodevalue
5206
+ oneOfItemValue=oneOfItemSchema.default
5207
+ oneOfItemValue[fkey]=oneOfItemSchema.properties[fkey]?.default;
5208
+ }
5209
+ if(oneOfItemSchema.properties && jsf.formValues!=undefined){
5210
+ oneOfItemValue ={};
5211
+ //nodeValue||{};
5212
+ oneOfItemValue[fkey]=nodeValue&&nodeValue[fkey];
5213
+ }
5214
+ if(!oneOfItemSchema.properties && jsf.formValues==undefined){
5215
+ oneOfItemValue=oneOfItemSchema.default;
5216
+ }
5217
+ */
5218
+ if (hasOwn(controlItem, "value")) {
5219
+ if (!jsf.ajv.validate(oneOfItemSchema, oneOfItemValue)) {
5220
+ controlItem.value.value = null;
5221
+ }
5222
+ else {
5223
+ ///controlItem.value.value=oneOfItemValue[fkey];
5224
+ controlItem.value.value = oneOfItemSchema.properties ? oneOfItemValue[fkey] : oneOfItemValue;
5225
+ }
5123
5226
  }
5124
5227
  //controls[controlKey] = controlItem;
5125
5228
  //allOfFGTemplate.controls[key].schemaPointer ||`${schemaPointer}${keySchemaPointer}/${key}`;
5126
5229
  //allOfFGTemplate.controls[key].schemaPointer || schemaPointer + keySchemaPointer;
5127
- controls[key] = cloneDeep(allOfFGTemplate.controls[key]);
5230
+ ///////controls[key] = cloneDeep(allOfFGTemplate.controls[key]);
5128
5231
  //add schemacontrol to root
5129
5232
  //controls[controlKey]=controlItem
5130
5233
  controls[`_${ofType}`] = controls[`_${ofType}`] || {};
@@ -5138,7 +5241,7 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
5138
5241
  });
5139
5242
  jsf.formOptions.fieldsRequired = setRequiredFields(schema, controls);
5140
5243
  }
5141
- return { controlType, controls, validators };
5244
+ return { controlType, controls, validators, schemaPointer };
5142
5245
  case 'FormArray':
5143
5246
  controls = [];
5144
5247
  const minItems = Math.max(schema.minItems || 0, nodeOptions.get('minItems') || 0);
@@ -5195,7 +5298,7 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
5195
5298
  }
5196
5299
  }
5197
5300
  }
5198
- return { controlType, controls, validators };
5301
+ return { controlType, controls, validators, schemaPointer };
5199
5302
  case '$ref':
5200
5303
  const schemaRef = JsonPointer.compile(schema.$ref);
5201
5304
  const dataRef = JsonPointer.toDataPointer(schemaRef, schema);
@@ -5217,7 +5320,7 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
5217
5320
  value: setValues && isPrimitive(nodeValue) ? nodeValue : null,
5218
5321
  disabled: nodeOptions.get('disabled') || false
5219
5322
  };
5220
- return { controlType, value, validators };
5323
+ return { controlType, value, validators, schemaPointer };
5221
5324
  //TODO may make an IFThenElse widget or integrate it with the section
5222
5325
  //widget
5223
5326
  case 'IfThenElse':
@@ -5227,20 +5330,26 @@ function buildFormGroupTemplate(jsf, nodeValue = null, setValues = true, schemaP
5227
5330
  ["then", "else"].forEach(con => {
5228
5331
  if (hasOwn(schema, con)) {
5229
5332
  const keySchemaPointer = `/${con}`;
5230
- let thenTFGTemplate = buildFormGroupTemplate(jsf, nodeValue, false, schemaPointer + keySchemaPointer, dataPointer, templatePointer + `/controls/${con}`);
5333
+ let thenTFGTemplate = buildFormGroupTemplate(jsf, nodeValue, setValues, //false,
5334
+ schemaPointer + keySchemaPointer, dataPointer, templatePointer + `/controls/${con}`);
5231
5335
  //NB same property can be in both then and else
5232
5336
  //so key must be the unique path to control
5233
- Object.keys(thenTFGTemplate.controls).forEach(key => {
5234
- let controlKey = thenTFGTemplate.controls[key].schemaPointer || `${schemaPointer}${keySchemaPointer}/${key}`;
5235
- controlKey = path2ControlKey(controlKey);
5236
- let cItem = Object.assign({}, thenTFGTemplate.controls[key]);
5237
- cItem.schemaPointer = `${schemaPointer}${keySchemaPointer}/${key}`;
5238
- controls[controlKey] = cItem;
5239
- });
5337
+ //let ifItemSchema=JsonPointer.get(schema,keySchemaPointer);
5338
+ //let ifItemValue;
5339
+ if (hasOwn(thenTFGTemplate, 'controls')) {
5340
+ Object.keys(thenTFGTemplate.controls).forEach(key => {
5341
+ let controlKey = thenTFGTemplate.controls[key].schemaPointer;
5342
+ if (controlKey) {
5343
+ controlKey = path2ControlKey(controlKey);
5344
+ let cItem = Object.assign({}, thenTFGTemplate.controls[key]);
5345
+ controls[controlKey] = cItem;
5346
+ }
5347
+ });
5348
+ }
5240
5349
  }
5241
5350
  });
5242
5351
  }
5243
- return { controlType, controls, validators };
5352
+ return { controlType, controls, validators, schemaPointer };
5244
5353
  default:
5245
5354
  return null;
5246
5355
  }
@@ -5438,7 +5547,7 @@ function formatFormData(formData, dataMap, recursiveRefMap, arrayMap, returnEmpt
5438
5547
  }
5439
5548
  else if (typeof value !== 'object' || isDate(value) ||
5440
5549
  (value === null && returnEmptyFields)) {
5441
- if (genericPointer.substring(0, 2) == "/$") {
5550
+ if (genericPointer.indexOf("/$") >= 0) {
5442
5551
  return formattedData;
5443
5552
  }
5444
5553
  console.error('formatFormData error: ' +
@@ -5473,7 +5582,8 @@ function getControl(formGroup, dataPointer, returnGroup = false, schemaPointer)
5473
5582
  // If dataPointer input is not a valid JSON pointer, check to
5474
5583
  // see if it is instead a valid object path, using dot notaion
5475
5584
  if (typeof dataPointer === 'string') {
5476
- const formControl = formGroup.get(path2ControlKey(schemaPointer || "")) || formGroup.get(dataPointer);
5585
+ const controlPath = !!schemaPointer ? path2ControlKey(schemaPointer) : dataPointer;
5586
+ const formControl = formGroup.get(controlPath);
5477
5587
  if (formControl) {
5478
5588
  return formControl;
5479
5589
  }
@@ -5493,7 +5603,8 @@ function getControl(formGroup, dataPointer, returnGroup = false, schemaPointer)
5493
5603
  // try using formGroup.get() to return the control
5494
5604
  if (typeof formGroup.get === 'function' &&
5495
5605
  dataPointerArray.every(key => key.indexOf('.') === -1)) {
5496
- const formControl = formGroup.get(path2ControlKey(schemaPointer || "")) || formGroup.get(dataPointerArray.join('.'));
5606
+ const controlPath = !!schemaPointer ? path2ControlKey(schemaPointer) : dataPointerArray.join('.');
5607
+ const formControl = formGroup.get(controlPath);
5497
5608
  if (formControl) {
5498
5609
  return formControl;
5499
5610
  }
@@ -5506,7 +5617,11 @@ function getControl(formGroup, dataPointer, returnGroup = false, schemaPointer)
5506
5617
  if (hasOwn(subGroup, 'controls')) {
5507
5618
  subGroup = subGroup.controls;
5508
5619
  }
5509
- if (isArray(subGroup) && (key === '-')) {
5620
+ if (schemaPointer && hasOwn(subGroup, path2ControlKey(schemaPointer))) {
5621
+ subGroup = subGroup[path2ControlKey(schemaPointer)];
5622
+ return subGroup;
5623
+ }
5624
+ else if (isArray(subGroup) && (key === '-')) {
5510
5625
  subGroup = subGroup[subGroup.length - 1];
5511
5626
  }
5512
5627
  else if (hasOwn(subGroup, key)) {
@@ -5752,7 +5867,6 @@ function buildLayout_original(jsf, widgetLibrary) {
5752
5867
  schemaPointer = JsonPointer.toSchemaPointer(shortDataPointer, jsf.schema);
5753
5868
  nodeDataMap.set('schemaPointer', schemaPointer);
5754
5869
  }
5755
- nodeDataMap.set('disabled', !!newNode.options.disabled);
5756
5870
  nodeSchema = JsonPointer.get(jsf.schema, schemaPointer);
5757
5871
  if (nodeSchema) {
5758
5872
  if (!hasOwn(newNode, 'type')) {
@@ -5773,6 +5887,7 @@ function buildLayout_original(jsf, widgetLibrary) {
5773
5887
  newNode.dataType =
5774
5888
  nodeSchema.type || (hasOwn(nodeSchema, '$ref') ? '$ref' : null);
5775
5889
  updateInputOptions(newNode, nodeSchema, jsf);
5890
+ nodeDataMap.set('disabled', !!newNode.options.disabled);
5776
5891
  // Present checkboxes as single control, rather than array
5777
5892
  if (newNode.type === 'checkboxes' && hasOwn(nodeSchema, 'items')) {
5778
5893
  updateInputOptions(newNode, nodeSchema.items, jsf);
@@ -6200,6 +6315,37 @@ function fixNestedArrayLayout(options) {
6200
6315
  * //
6201
6316
  */
6202
6317
  function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPointer = '', dataPointer = '', arrayItem = false, arrayItemType = null, removable = null, forRefLibrary = false, dataPointerPrefix = '', jsonSchema) {
6318
+ function applyITEConditions(builtLayout, schPointer, keySchemaPointer, negateClause, parentLayout) {
6319
+ if (builtLayout) {
6320
+ if (parentLayout && parentLayout.isITEItem && parentLayout.options.condition) {
6321
+ return;
6322
+ }
6323
+ if (isArray(builtLayout)) {
6324
+ builtLayout.forEach(item => {
6325
+ item.isITEItem = true;
6326
+ item.options.condition = convertJSONSchemaIfToCondition(schema, item, negateClause);
6327
+ applyITEConditions(item, schPointer, keySchemaPointer, negateClause, builtLayout);
6328
+ //item.schemaPointer = schPointer + keySchemaPointer + item.dataPointer;
6329
+ //item.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
6330
+ //newSection.push(item);
6331
+ });
6332
+ }
6333
+ else if (hasOwn(builtLayout, "items")) {
6334
+ applyITEConditions(builtLayout.items, schPointer, keySchemaPointer, negateClause, builtLayout);
6335
+ // builtLayout.items.forEach(item => {
6336
+ // item.isITEItem=true;
6337
+ // item.options.condition = convertJSONSchemaIfToCondition(schema,item, negateClause);
6338
+ // applyITEConditions(item,schPointer,keySchemaPointer,negateClause)
6339
+ // });
6340
+ }
6341
+ else {
6342
+ builtLayout.isITEItem = true;
6343
+ //builtLayout.schemaPointer = `${schPointer}${keySchemaPointer}/${builtLayout.name}`;
6344
+ builtLayout.options.condition = convertJSONSchemaIfToCondition(schema, builtLayout, negateClause);
6345
+ //newSection.push(builtLayout)
6346
+ }
6347
+ }
6348
+ }
6203
6349
  const jsSchema = jsonSchema || jsf.schema;
6204
6350
  const schema = JsonPointer.get(jsSchema, schemaPointer);
6205
6351
  //JsonPointer.get(jsf.schema, schemaPointer);
@@ -6237,6 +6383,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6237
6383
  if (!jsf.dataMap.has(shortDataPointer)) {
6238
6384
  jsf.dataMap.set(shortDataPointer, new Map());
6239
6385
  }
6386
+ updateInputOptions(newNode, schema, jsf);
6240
6387
  const nodeDataMap = jsf.dataMap.get(shortDataPointer);
6241
6388
  if (!nodeDataMap.has('inputType')) {
6242
6389
  nodeDataMap.set('schemaPointer', schemaPointer);
@@ -6244,7 +6391,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6244
6391
  nodeDataMap.set('widget', newNode.widget);
6245
6392
  nodeDataMap.set('disabled', !!newNode.options.disabled);
6246
6393
  }
6247
- updateInputOptions(newNode, schema, jsf);
6394
+ //updateInputOptions(newNode, schema, jsf);
6248
6395
  if (!newNode.options.title && newNode.name && !/^\d+$/.test(newNode.name)) {
6249
6396
  newNode.options.title = fixTitle(newNode.name);
6250
6397
  }
@@ -6272,6 +6419,7 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6272
6419
  '/properties/' + key : '/additionalProperties';
6273
6420
  const innerItem = buildLayoutFromSchema(jsf, widgetLibrary, isObject(nodeValue) ? nodeValue[key] : null, schemaPointer + keySchemaPointer, dataPointer + '/' + key, false, null, null, forRefLibrary, dataPointerPrefix);
6274
6421
  if (innerItem) {
6422
+ innerItem.schemaPointer = schemaPointer + keySchemaPointer;
6275
6423
  if (isInputRequired(schema, '/' + key)) {
6276
6424
  innerItem.options.required = true;
6277
6425
  jsf.fieldsRequired = true;
@@ -6296,38 +6444,50 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6296
6444
  }
6297
6445
  schema[ofType].forEach((ofItem, ind) => {
6298
6446
  const keySchemaPointer = `/${ofType}/${ind}`;
6299
- const innerItem = buildLayoutFromSchema(jsf, widgetLibrary, ofItem, schemaPointer + keySchemaPointer, dataPointer, false, null, null, forRefLibrary, dataPointerPrefix);
6447
+ const innerItem = buildLayoutFromSchema(jsf, widgetLibrary, ofItem, schemaPointer + keySchemaPointer, dataPointer, false, null, null, ofType == "oneOf" /*forRefLibrary*/, dataPointerPrefix);
6300
6448
  if (innerItem) {
6301
6449
  //newSection.push(innerItem);
6302
6450
  if (innerItem.items) {
6303
6451
  innerItem.items.forEach(innerItemLevel2 => {
6304
6452
  const l2SchemaPointer = hasOwn(ofItem, 'properties') ?
6305
6453
  '/properties/' + innerItemLevel2.name : innerItemLevel2.name;
6306
- innerItemLevel2.oneOfPointer = schemaPointer + keySchemaPointer + l2SchemaPointer;
6307
- innerItemLevel2.schemaPointer = innerItemLevel2.oneOfPointer;
6454
+ //innerItemLevel2.oneOfPointer = schemaPointer + keySchemaPointer + l2SchemaPointer;
6455
+ // innerItemLevel2.schemaPointer=innerItemLevel2.schemaPointer;
6456
+ innerItemLevel2.oneOfPointer = innerItemLevel2.schemaPointer;
6308
6457
  });
6309
6458
  }
6459
+ //TODO review-will never reach here if forRefLibrary==true
6310
6460
  if (isArray(innerItem)) {
6461
+ let outerOneOfItemTpl = cloneDeep(newNode);
6462
+ outerOneOfItemTpl;
6311
6463
  innerItem.forEach(item => {
6312
6464
  const l2SchemaPointer = hasOwn(ofItem, 'properties') ?
6313
6465
  '/properties/' + item.name : item.name;
6314
6466
  if (outerOneOfItem) {
6315
- item.oneOfPointer = schemaPointer + keySchemaPointer + l2SchemaPointer;
6467
+ ////item.oneOfPointer = schemaPointer + keySchemaPointer + l2SchemaPointer;
6316
6468
  //schemaPointer + keySchemaPointer + item.dataPointer;
6317
- item.schemaPointer = item.oneOfPointer;
6318
- outerOneOfItem.items = outerOneOfItem.items || [];
6469
+ ////item.schemaPointer=item.oneOfPointer;
6470
+ /*
6471
+ outerOneOfItem.items=outerOneOfItem.items||[];
6319
6472
  outerOneOfItem.items.push(item);
6473
+ */
6474
+ outerOneOfItemTpl.items = outerOneOfItemTpl.items || [];
6475
+ outerOneOfItemTpl.items.push(item);
6320
6476
  }
6321
6477
  else {
6322
6478
  newSection.push(item);
6323
6479
  }
6324
6480
  });
6481
+ if (outerOneOfItem) {
6482
+ outerOneOfItem.items = outerOneOfItem.items || [];
6483
+ outerOneOfItem.items.push(outerOneOfItemTpl);
6484
+ }
6325
6485
  //TODO test-might not work for more than 2 levels of nesting
6326
6486
  }
6327
6487
  else {
6328
6488
  if (outerOneOfItem) {
6329
6489
  innerItem.oneOfPointer = schemaPointer + keySchemaPointer; // + innerItem.dataPointer;
6330
- innerItem.schemaPointer = innerItem.oneOfPointer;
6490
+ ////innerItem.schemaPointer=innerItem.oneOfPointer;
6331
6491
  outerOneOfItem.items = outerOneOfItem.items || [];
6332
6492
  outerOneOfItem.items.push(innerItem);
6333
6493
  }
@@ -6344,18 +6504,19 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6344
6504
  if (hasOwn(schema, con)) {
6345
6505
  const keySchemaPointer = `/${con}`;
6346
6506
  const negateClause = con == "else";
6347
- const innerItem = buildLayoutFromSchema(jsf, widgetLibrary, nodeValue.then, schemaPointer + keySchemaPointer, dataPointer, false, null, null, forRefLibrary, dataPointerPrefix);
6507
+ const innerItem = buildLayoutFromSchema(jsf, widgetLibrary, nodeValue[con], schemaPointer + keySchemaPointer, dataPointer, false, null, null, forRefLibrary, dataPointerPrefix);
6348
6508
  if (innerItem) {
6509
+ applyITEConditions(innerItem, schemaPointer, keySchemaPointer, negateClause);
6349
6510
  if (isArray(innerItem)) {
6350
6511
  innerItem.forEach(item => {
6351
- item.schemaPointer = schemaPointer + keySchemaPointer + item.dataPointer;
6352
- item.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
6512
+ //item.schemaPointer = schemaPointer + keySchemaPointer + item.dataPointer;
6513
+ //item.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
6353
6514
  newSection.push(item);
6354
6515
  });
6355
6516
  }
6356
6517
  else {
6357
- innerItem.schemaPointer = schemaPointer + keySchemaPointer + innerItem.dataPointer;
6358
- innerItem.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
6518
+ //innerItem.schemaPointer = schemaPointer + keySchemaPointer + innerItem.dataPointer;
6519
+ //innerItem.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
6359
6520
  newSection.push(innerItem);
6360
6521
  }
6361
6522
  }
@@ -6570,24 +6731,27 @@ function buildLayoutFromSchema(jsf, widgetLibrary, nodeValue = null, schemaPoint
6570
6731
  if (hasOwn(schema, con)) {
6571
6732
  const keySchemaPointer = `/${con}`;
6572
6733
  const negateClause = con == "else";
6573
- const innerItem = buildLayoutFromSchema(jsf, widgetLibrary, nodeValue.then, schemaPointer + keySchemaPointer, dataPointer, false, null, null, forRefLibrary, dataPointerPrefix);
6734
+ const innerItem = buildLayoutFromSchema(jsf, widgetLibrary, nodeValue[con], schemaPointer + keySchemaPointer, dataPointer, false, null, null, forRefLibrary, dataPointerPrefix);
6574
6735
  if (innerItem) {
6736
+ applyITEConditions(innerItem, schemaPointer, keySchemaPointer, negateClause);
6575
6737
  if (isArray(innerItem)) {
6576
6738
  innerItem.forEach(item => {
6577
- item.schemaPointer = schemaPointer + keySchemaPointer + item.dataPointer;
6578
- item.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
6739
+ //item.schemaPointer = schemaPointer + keySchemaPointer + item.dataPointer;
6740
+ //item.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
6579
6741
  newSection.push(item);
6580
- newNode = newSection;
6742
+ /////// newNode = newSection
6581
6743
  });
6582
6744
  }
6583
6745
  else {
6584
- innerItem.schemaPointer = schemaPointer + keySchemaPointer + innerItem.dataPointer;
6585
- innerItem.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
6586
- newNode = innerItem;
6746
+ //innerItem.schemaPointer = schemaPointer + keySchemaPointer + innerItem.dataPointer;
6747
+ //innerItem.options.condition = convertJSONSchemaIfToCondition(schema, negateClause);
6748
+ ///////newNode = innerItem
6749
+ newSection.push(innerItem);
6587
6750
  }
6588
6751
  }
6589
6752
  }
6590
6753
  });
6754
+ newNode = newSection;
6591
6755
  }
6592
6756
  return newNode;
6593
6757
  }
@@ -7331,7 +7495,8 @@ class JsonSchemaFormService {
7331
7495
  ctx.formControl = this.getFormControl(ctx);
7332
7496
  //introduced to check if the node is part of ITE conditional
7333
7497
  //then change or add the control
7334
- if (layoutNode?.schemaPointer) {
7498
+ if (layoutNode?.schemaPointer && layoutNode.isITEItem ||
7499
+ (layoutNode?.schemaPointer && layoutNode?.oneOfPointer)) {
7335
7500
  //before changing control, need to set the new data type for data formatting
7336
7501
  const schemaType = this.dataMap.get(layoutNode?.dataPointer).get("schemaType");
7337
7502
  if (schemaType != layoutNode.dataType) {
@@ -7372,11 +7537,24 @@ class JsonSchemaFormService {
7372
7537
  }
7373
7538
  //if this is a ITE conditional field, the value would not have been
7374
7539
  //set, as the control would only be initialized when the condition is true
7375
- if (ctx.options?.condition) {
7376
- const value = JsonPointer.has(this.formValues, layoutNode.dataPointer)
7377
- ? JsonPointer.get(this.formValues, layoutNode.dataPointer)
7378
- : ctx.options?.default;
7379
- ctx.formControl?.setValue(value);
7540
+ //TODO-review need to decide which of the data sets between data,formValues and default
7541
+ //to use for the value
7542
+ if (ctx.options?.condition || layoutNode?.oneOfPointer) {
7543
+ const dataPointer = this.getDataPointer(ctx);
7544
+ const controlValue = ctx.formControl.value;
7545
+ const dataValue = JsonPointer.has(this.data, dataPointer) ?
7546
+ JsonPointer.get(this.data, dataPointer) : undefined;
7547
+ const formValue = JsonPointer.has(this.formValues, dataPointer) ?
7548
+ JsonPointer.get(this.formValues, dataPointer) : undefined;
7549
+ const schemaDefault = ctx.options?.default;
7550
+ //if initial formValues was supplied and controlValue matches formValue then likely
7551
+ //control was initially created with the formValue then set value to data value
7552
+ //if no formValues was supplied and controlValue matches schemaDefault then likely
7553
+ //control was initially created with the default then set value to data value
7554
+ const value = this.formValues && isEqual$1(formValue, controlValue) ? dataValue
7555
+ : !this.formValues && isEqual$1(schemaDefault, controlValue) ? dataValue
7556
+ : schemaDefault;
7557
+ ctx.formControl?.patchValue(value);
7380
7558
  }
7381
7559
  return ctx.boundControl;
7382
7560
  }
@@ -7492,7 +7670,9 @@ class JsonSchemaFormService {
7492
7670
  ctx.layoutNode().type === '$ref') {
7493
7671
  return null;
7494
7672
  }
7495
- return getControl(this.formGroup, this.getDataPointer(ctx), false, ctx.layoutNode()?.schemaPointer);
7673
+ const schemaPointer = ctx.layoutNode()?.isITEItem ? ctx.layoutNode()?.schemaPointer : null;
7674
+ const oneOfPointer = ctx.layoutNode()?.oneOfPointer;
7675
+ return getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer);
7496
7676
  }
7497
7677
  setFormControl(ctx, control) {
7498
7678
  if (!ctx || !ctx.layoutNode ||
@@ -7508,14 +7688,18 @@ class JsonSchemaFormService {
7508
7688
  ctx.layoutNode().type === '$ref') {
7509
7689
  return null;
7510
7690
  }
7511
- const control = getControl(this.formGroup, this.getDataPointer(ctx));
7691
+ const schemaPointer = ctx.layoutNode()?.isITEItem ? ctx.layoutNode()?.schemaPointer : null;
7692
+ const oneOfPointer = ctx.layoutNode()?.oneOfPointer;
7693
+ const control = getControl(this.formGroup, this.getDataPointer(ctx), false, schemaPointer || oneOfPointer);
7512
7694
  return control ? control.value : null;
7513
7695
  }
7514
7696
  getFormControlGroup(ctx) {
7515
7697
  if (!ctx || !ctx.layoutNode || !isDefined(ctx.layoutNode().dataPointer)) {
7516
7698
  return null;
7517
7699
  }
7518
- return getControl(this.formGroup, this.getDataPointer(ctx), true, ctx.layoutNode()?.schemaPointer);
7700
+ const schemaPointer = ctx.layoutNode()?.isITEItem ? ctx.layoutNode()?.schemaPointer : null;
7701
+ const oneOfPointer = ctx.layoutNode()?.oneOfPointer;
7702
+ return getControl(this.formGroup, this.getDataPointer(ctx), true, schemaPointer || oneOfPointer);
7519
7703
  }
7520
7704
  getFormControlName(ctx) {
7521
7705
  if (!ctx || !ctx.layoutNode ||
@@ -7868,6 +8052,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
7868
8052
  }]
7869
8053
  }] });
7870
8054
 
8055
+ ///NB issue caused by sortablejs when it its destroyed
8056
+ //this mainly affects checkboxes coupled with conditions
8057
+ //-the value is rechecked
8058
+ //-see https://github.com/SortableJS/Sortable/issues/1052#issuecomment-369613072
7871
8059
  class CheckboxComponent {
7872
8060
  constructor() {
7873
8061
  this.jsf = inject(JsonSchemaFormService);
@@ -7883,7 +8071,8 @@ class CheckboxComponent {
7883
8071
  this.options = this.layoutNode().options || {};
7884
8072
  this.jsf.initializeControl(this);
7885
8073
  if (this.controlValue === null || this.controlValue === undefined) {
7886
- this.controlValue = this.options.title;
8074
+ this.controlValue = false;
8075
+ this.jsf.updateValue(this, this.falseValue);
7887
8076
  }
7888
8077
  }
7889
8078
  updateValue(event) {
@@ -7913,7 +8102,7 @@ class CheckboxComponent {
7913
8102
  type="checkbox">
7914
8103
  <input *ngIf="!boundControl"
7915
8104
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
7916
- [checked]="isChecked ? 'checked' : null"
8105
+ [checked]="isChecked"
7917
8106
  [class]="(options?.fieldHtmlClass || '') + (isChecked ?
7918
8107
  (' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
7919
8108
  (' ' + (options?.style?.unselected || '')))"
@@ -7950,7 +8139,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
7950
8139
  type="checkbox">
7951
8140
  <input *ngIf="!boundControl"
7952
8141
  [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
7953
- [checked]="isChecked ? 'checked' : null"
8142
+ [checked]="isChecked"
7954
8143
  [class]="(options?.fieldHtmlClass || '') + (isChecked ?
7955
8144
  (' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
7956
8145
  (' ' + (options?.style?.unselected || '')))"
@@ -8756,14 +8945,30 @@ class OneOfComponent {
8756
8945
  let parts = controlName.split('$');
8757
8946
  let fieldName = parts[parts.length - 1];
8758
8947
  let controlValue = this.jsf.formGroup.controls[controlName].value;
8759
- if (isObject$1(formValue) && hasOwn(formValue, fieldName) &&
8760
- formValue[fieldName] == controlValue
8761
- //formValue[fieldName]||controlValue
8762
- ) {
8763
- foundInd = ind;
8948
+ let controlSchema = JsonPointer.get(this.jsf.schema, parts.join("/"));
8949
+ let schemaPointer = parts.join("/");
8950
+ let dPointer = schemaPointer.replace(/(anyOf|allOf|oneOf|none)\/[\d]+\//g, '')
8951
+ .replace(/(if|then|else|properties)\//g, '').replace(/\/items\//g, '/-/');
8952
+ //JsonPointer.toDataPointer(parts.join("/"),this.jsf.schema);
8953
+ let dVal = JsonPointer.get(this.jsf.formValues, dPointer);
8954
+ let compareVal = dVal; //formValue;
8955
+ //compare only values that are in the subschema properties
8956
+ if (controlSchema && controlSchema.properties) {
8957
+ compareVal = isObject$1(dVal) && hasOwn(dVal, fieldName) ?
8958
+ pick(dVal[fieldName], Object.keys(controlSchema.properties))
8959
+ : pick(dVal, Object.keys(controlSchema.properties));
8960
+ }
8961
+ /*
8962
+ if(isObject(compareVal) && hasOwn(compareVal,fieldName) &&
8963
+ isEqual(compareVal[fieldName],controlValue)
8964
+ ){
8965
+ foundInd=ind;
8966
+ }else //if(formValue || controlValue){
8967
+ if(isEqual(compareVal,controlValue)){
8968
+ foundInd=ind;
8764
8969
  }
8765
- else //if(formValue || controlValue){
8766
- if (isEqual$2(formValue, controlValue)) {
8970
+ */
8971
+ if (isEqual$2(compareVal, controlValue)) {
8767
8972
  foundInd = ind;
8768
8973
  }
8769
8974
  });
@@ -9118,6 +9323,64 @@ class RootComponent {
9118
9323
  }
9119
9324
  sortableInit(sortable) {
9120
9325
  this.sortableObj = sortable;
9326
+ //Sortable.utils.on(this.sortableObj.el,"nulling",(s)=>{console.log("event nulling sortablejs")})
9327
+ ///NB issue caused by sortablejs when it its destroyed
9328
+ //this mainly affects checkboxes coupled with conditions
9329
+ //-the value is rechecked
9330
+ //-see https://github.com/SortableJS/Sortable/issues/1052#issuecomment-369613072
9331
+ /* attempt to monkey patch sortable js
9332
+ const originalMethod = sortable._nulling;
9333
+ let zone=this.zone;
9334
+ sortable._nulling=function() {
9335
+ console.log(`pluginEvent 2 ${pluginEvent}`)
9336
+ zone.runOutsideAngular(() => {
9337
+ console.log(`pluginEvent3 ${pluginEvent}`)
9338
+ pluginEvent('nulling', this);
9339
+
9340
+ rootEl =
9341
+ dragEl =
9342
+ parentEl =
9343
+ ghostEl =
9344
+ nextEl =
9345
+ cloneEl =
9346
+ lastDownEl =
9347
+ cloneHidden =
9348
+
9349
+ tapEvt =
9350
+ touchEvt =
9351
+
9352
+ moved =
9353
+ newIndex =
9354
+ newDraggableIndex =
9355
+ oldIndex =
9356
+ oldDraggableIndex =
9357
+
9358
+ lastTarget =
9359
+ lastDirection =
9360
+
9361
+ putSortable =
9362
+ activeGroup =
9363
+ Sortable.dragged =
9364
+ Sortable.ghost =
9365
+ Sortable.clone =
9366
+ Sortable.active = null;
9367
+
9368
+
9369
+ let el = this.el;
9370
+ savedInputChecked.forEach(function (checkEl) {
9371
+ if (el.contains(checkEl)) {
9372
+ checkEl.checked = true;
9373
+ }
9374
+ });
9375
+
9376
+ savedInputChecked.length =
9377
+ lastDx =
9378
+ lastDy = 0;
9379
+
9380
+ })
9381
+
9382
+ }.bind(sortable)
9383
+ */
9121
9384
  }
9122
9385
  isDraggable(node) {
9123
9386
  let result = node.arrayItem && node.type !== '$ref' &&
@@ -9726,41 +9989,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
9726
9989
  }]
9727
9990
  }] });
9728
9991
 
9729
- class TabComponent {
9730
- constructor() {
9731
- this.jsf = inject(JsonSchemaFormService);
9732
- this.layoutNode = input(undefined);
9733
- this.layoutIndex = input(undefined);
9734
- this.dataIndex = input(undefined);
9735
- }
9736
- ngOnInit() {
9737
- this.options = this.layoutNode().options || {};
9738
- }
9739
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TabComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9740
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: TabComponent, isStandalone: false, selector: "tab-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
9741
- <div [class]="options?.htmlClass || ''">
9742
- <root-widget
9743
- [dataIndex]="dataIndex()"
9744
- [layoutIndex]="layoutIndex()"
9745
- [layout]="layoutNode().items"></root-widget>
9746
- </div>`, isInline: true, dependencies: [{ kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }] }); }
9747
- }
9748
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TabComponent, decorators: [{
9749
- type: Component,
9750
- args: [{
9751
- // tslint:disable-next-line:component-selector
9752
- selector: 'tab-widget',
9753
- template: `
9754
- <div [class]="options?.htmlClass || ''">
9755
- <root-widget
9756
- [dataIndex]="dataIndex()"
9757
- [layoutIndex]="layoutIndex()"
9758
- [layout]="layoutNode().items"></root-widget>
9759
- </div>`,
9760
- standalone: false
9761
- }]
9762
- }] });
9763
-
9764
9992
  class TemplateComponent {
9765
9993
  constructor() {
9766
9994
  this.jsf = inject(JsonSchemaFormService);
@@ -9988,6 +10216,7 @@ class WidgetLibraryService {
9988
10216
  'wizard': 'section', // TODO: Sequential panels with "Next" and "Previous" buttons
9989
10217
  // Widgets included for compatibility with other libraries
9990
10218
  'textline': 'text',
10219
+ 'selectcheckbox': SelectCheckboxComponent,
9991
10220
  // Recommended 3rd-party add-on widgets (TODO: create wrappers for these...)
9992
10221
  // 'ng2-select': Select control replacement - http://valor-software.com/ng2-select/
9993
10222
  // 'flatpickr': Flatpickr date picker - https://github.com/chmln/flatpickr
@@ -10104,73 +10333,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
10104
10333
  }]
10105
10334
  }], ctorParameters: () => [] });
10106
10335
 
10107
- const BASIC_WIDGETS = [
10108
- AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent,
10109
- CheckboxesComponent, FileComponent, HiddenComponent, InputComponent,
10110
- MessageComponent, NoneComponent, NumberComponent, RadiosComponent,
10111
- RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent,
10112
- SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent,
10113
- TemplateComponent, TextareaComponent
10114
- ];
10115
-
10116
- class WidgetLibraryModule {
10117
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
10118
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryModule, declarations: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, OrderableDirective, ElementAttributeDirective], imports: [CommonModule, FormsModule, ReactiveFormsModule, i2$1.SortablejsModule], exports: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, OrderableDirective, ElementAttributeDirective] }); }
10119
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryModule, imports: [CommonModule, FormsModule, ReactiveFormsModule,
10120
- SortablejsModule.forRoot({
10121
- //disabled:false,
10122
- //draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
10123
- filter: ".sortable-filter", //needed to disable dragging on input range elements, class needs to be added to the element or its parent
10124
- preventOnFilter: false, //needed for input range elements slider do still work
10125
- onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
10126
- if (evt.related.classList.contains("sortable-fixed")) {
10127
- //console.log(evt.related);
10128
- return false;
10129
- }
10130
- }
10131
- })] }); }
10132
- }
10133
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryModule, decorators: [{
10134
- type: NgModule,
10135
- args: [{
10136
- imports: [CommonModule, FormsModule, ReactiveFormsModule,
10137
- SortablejsModule.forRoot({
10138
- //disabled:false,
10139
- //draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
10140
- filter: ".sortable-filter", //needed to disable dragging on input range elements, class needs to be added to the element or its parent
10141
- preventOnFilter: false, //needed for input range elements slider do still work
10142
- onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
10143
- if (evt.related.classList.contains("sortable-fixed")) {
10144
- //console.log(evt.related);
10145
- return false;
10146
- }
10147
- }
10148
- })],
10149
- declarations: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective],
10150
- exports: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective]
10151
- }]
10152
- }] });
10153
-
10154
- // No framework - plain HTML controls (styles from form layout only)
10155
- class NoFrameworkModule {
10156
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFrameworkModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
10157
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: NoFrameworkModule, declarations: [NoFrameworkComponent], imports: [CommonModule, WidgetLibraryModule], exports: [NoFrameworkComponent] }); }
10158
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFrameworkModule, providers: [
10159
- { provide: Framework, useClass: NoFramework, multi: true }
10160
- ], imports: [CommonModule, WidgetLibraryModule] }); }
10161
- }
10162
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFrameworkModule, decorators: [{
10163
- type: NgModule,
10164
- args: [{
10165
- imports: [CommonModule, WidgetLibraryModule],
10166
- declarations: [NoFrameworkComponent],
10167
- exports: [NoFrameworkComponent],
10168
- providers: [
10169
- { provide: Framework, useClass: NoFramework, multi: true }
10170
- ]
10171
- }]
10172
- }] });
10173
-
10174
10336
  // Possible future frameworks:
10175
10337
  // - Foundation 6:
10176
10338
  // http://justindavis.co/2017/06/15/using-foundation-6-in-angular-4/
@@ -10336,6 +10498,284 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
10336
10498
  args: [Framework]
10337
10499
  }] }] });
10338
10500
 
10501
+ //component created as a fallback for the checkbox/sortabljs issue
10502
+ //its meant to display a select as a checkbox
10503
+ class SelectCheckboxComponent {
10504
+ constructor() {
10505
+ this.jsf = inject(JsonSchemaFormService);
10506
+ this.jsfFLService = inject(FrameworkLibraryService);
10507
+ this.controlDisabled = false;
10508
+ this.boundControl = false;
10509
+ this.selectList = [];
10510
+ this.selectListFlatGroup = [];
10511
+ this.isArray = isArray;
10512
+ this.layoutNode = input(undefined);
10513
+ this.layoutIndex = input(undefined);
10514
+ this.dataIndex = input(undefined);
10515
+ this.frameworkStyles = {
10516
+ daisyui: { selectClass: "select-box", optionClass: "checkbox tw:dui-checkbox", optionChecked: "active", optionUnchecked: "" },
10517
+ "bootstrap-3": { selectClass: "select-box", optionClass: "bs3-option checkbox display-inline-block", optionChecked: "active", optionUnchecked: "" },
10518
+ "bootstrap-4": { selectClass: "select-box", optionClass: "bs4-option checkbox display-inline-block", optionChecked: "active", optionUnchecked: "" },
10519
+ "bootstrap-5": { selectClass: " select-box", optionClass: "form-check-input display-inline-block", optionChecked: "active", optionUnchecked: "" },
10520
+ //"material-design":{selectClass:" ",optionClass:" "}
10521
+ };
10522
+ }
10523
+ ngOnInit() {
10524
+ this.options = this.layoutNode().options || {};
10525
+ this.activeFramework = this.jsfFLService.activeFramework.name;
10526
+ this.selectList = buildTitleMap(
10527
+ //this.options.titleMap || this.options.enumNames,
10528
+ //TODO review-title is set to null in the setTitle() method of CssFrameworkComponent
10529
+ this.options.enumNames || (this.options?.title && [this.options?.title])
10530
+ || [this.layoutNode().name],
10531
+ //this.options.enum,
10532
+ [true],
10533
+ //make required true to avoid creating 'none' select option
10534
+ true, !!this.options.flatList);
10535
+ //the selectListFlatGroup array will be used to update the formArray values
10536
+ //while the selectList array will be bound to the form select
10537
+ //as either a grouped select or a flat select
10538
+ /*
10539
+ this.selectListFlatGroup = buildTitleMap(
10540
+ this.options.titleMap || this.options.enumNames,
10541
+ this.options.enum, !!this.options.required, true
10542
+ )
10543
+ */
10544
+ this.jsf.initializeControl(this);
10545
+ this.selectValue = [this.controlValue];
10546
+ }
10547
+ deselectAll() {
10548
+ this.selectListFlatGroup.forEach(selItem => {
10549
+ selItem.checked = false;
10550
+ });
10551
+ }
10552
+ updateValue(event) {
10553
+ this.options.showErrors = true;
10554
+ this.controlValue = this.selectValue[0];
10555
+ this.jsf.updateValue(this, this.controlValue);
10556
+ }
10557
+ onSelectClicked($event) {
10558
+ this.selectValue = this.selectValue && this.selectValue[0] ? [false] : [true];
10559
+ this.controlValue = this.selectValue[0];
10560
+ this.jsf.updateValue(this, this.controlValue);
10561
+ }
10562
+ ngOnDestroy() {
10563
+ let nullVal = this.options.multiple ? [null] : null;
10564
+ this.formControl.reset(nullVal);
10565
+ this.controlValue = null;
10566
+ }
10567
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SelectCheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
10568
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: SelectCheckboxComponent, isStandalone: false, selector: "selectcheckbox-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
10569
+ <div
10570
+ [class]="options?.htmlClass || ''">
10571
+ <select *ngIf="boundControl"
10572
+ [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
10573
+ [attr.readonly]="options?.readonly ? 'readonly' : null"
10574
+ [attr.required]="options?.required"
10575
+ [class]=" frameworkStyles[activeFramework].selectClass"
10576
+ [multiple]="true"
10577
+ [id]="'control' + layoutNode()?._id"
10578
+ [name]="controlName"
10579
+ [ngModel]="selectValue"
10580
+ >
10581
+ <ng-template ngFor let-selectItem [ngForOf]="selectList">
10582
+ <option *ngIf="!isArray(selectItem?.items)"
10583
+ [class]="frameworkStyles[activeFramework].optionClass"
10584
+ [class.active]="selectItem?.value === controlValue"
10585
+ [class.unchecked-notusing]="selectItem?.value != controlValue"
10586
+ [value]="selectItem?.value"
10587
+ (click)="onSelectClicked($event)"
10588
+ type="checkbox"
10589
+ >
10590
+ </option>
10591
+ <!--NB the text is out of the option element to display besides the checkbox-->
10592
+ <span [innerHTML]="selectItem?.name"></span>
10593
+ </ng-template>
10594
+ </select>
10595
+ <select *ngIf="!boundControl"
10596
+ [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
10597
+ [attr.readonly]="options?.readonly ? 'readonly' : null"
10598
+ [attr.required]="options?.required"
10599
+ [class]="frameworkStyles[activeFramework].selectClass +' select-box'"
10600
+ [multiple]="true"
10601
+ [disabled]="controlDisabled"
10602
+ [id]="'control' + layoutNode()?._id"
10603
+ [name]="controlName"
10604
+ (change)="updateValue($event)">
10605
+ <ng-template ngFor let-selectItem [ngForOf]="selectList">
10606
+ <option *ngIf="!isArray(selectItem?.items)"
10607
+ [selected]="selectItem?.value === controlValue"
10608
+ [class]="frameworkStyles[activeFramework].optionClass"
10609
+ [class.checked-notusing]="selectItem?.value === controlValue"
10610
+ [class.unchecked-notusing]]="selectItem?.value != controlValue"
10611
+ [value]="selectItem?.value"
10612
+ type="checkbox">
10613
+ </option>
10614
+ <!--NB the text is out of the option element to display besides the checkbox-->
10615
+ <span [innerHTML]="selectItem?.name"></span>
10616
+ </ng-template>
10617
+ </select>
10618
+
10619
+ </div>`, isInline: true, styles: [".select-box{font-size:16px;border:none;appearance:none;-webkit-appearance:none;-moz-appearance:none;height:25px;overflow:hidden;text-overflow:ellipsis;background-color:#fff;color:#000;background-color:transparent}.select-box:focus{outline:none}.select-option{font-size:20px;color:#000;background-color:#fff;display:inline-block}.unchecked:before{content:\"\\2610\";left:5px;top:50%;transform:translateY(-50%);font-size:30px}.checked:before{content:\"\\2611\";left:5px;top:50%;transform:translateY(-50%);font-size:30px}.select-option:checked{background-image:linear-gradient(0deg,#fff 0% 100%);color:#000}.select-box[multiple]:focus{background-color:transparent;color:#00f;-webkit-text-fill-color:black}.display-inline-block{display:inline-block}.bs4-option,.bs3-option{width:14px;height:14px;border:solid 1px;color:#a9a9a9;min-block-size:auto;border-radius:3px}.bs4-option:checked[type=checkbox],.bs3-option:checked[type=checkbox]{background-image:url(data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3C!--%20License%3A%20MIT.%20Made%20by%20jaynewey%3A%20https%3A%2F%2Fgithub.com%2Fjaynewey%2Fcharm-icons%20--%3E%3Csvg%20viewBox%3D%220%200%2016%2016%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20fill%3D%22none%22%20stroke%3D%22%23000000%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20stroke-width%3D%222.5%22%3E%3Cpolyline%20points%3D%224%208.75%2C6.25%2012.25%2C13.25%203.5%22%2F%3E%3C%2Fsvg%3E);background-color:#00ced1}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectMultipleControlValueAccessor, selector: "select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
10620
+ }
10621
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SelectCheckboxComponent, decorators: [{
10622
+ type: Component,
10623
+ args: [{ selector: 'selectcheckbox-widget', template: `
10624
+ <div
10625
+ [class]="options?.htmlClass || ''">
10626
+ <select *ngIf="boundControl"
10627
+ [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
10628
+ [attr.readonly]="options?.readonly ? 'readonly' : null"
10629
+ [attr.required]="options?.required"
10630
+ [class]=" frameworkStyles[activeFramework].selectClass"
10631
+ [multiple]="true"
10632
+ [id]="'control' + layoutNode()?._id"
10633
+ [name]="controlName"
10634
+ [ngModel]="selectValue"
10635
+ >
10636
+ <ng-template ngFor let-selectItem [ngForOf]="selectList">
10637
+ <option *ngIf="!isArray(selectItem?.items)"
10638
+ [class]="frameworkStyles[activeFramework].optionClass"
10639
+ [class.active]="selectItem?.value === controlValue"
10640
+ [class.unchecked-notusing]="selectItem?.value != controlValue"
10641
+ [value]="selectItem?.value"
10642
+ (click)="onSelectClicked($event)"
10643
+ type="checkbox"
10644
+ >
10645
+ </option>
10646
+ <!--NB the text is out of the option element to display besides the checkbox-->
10647
+ <span [innerHTML]="selectItem?.name"></span>
10648
+ </ng-template>
10649
+ </select>
10650
+ <select *ngIf="!boundControl"
10651
+ [attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
10652
+ [attr.readonly]="options?.readonly ? 'readonly' : null"
10653
+ [attr.required]="options?.required"
10654
+ [class]="frameworkStyles[activeFramework].selectClass +' select-box'"
10655
+ [multiple]="true"
10656
+ [disabled]="controlDisabled"
10657
+ [id]="'control' + layoutNode()?._id"
10658
+ [name]="controlName"
10659
+ (change)="updateValue($event)">
10660
+ <ng-template ngFor let-selectItem [ngForOf]="selectList">
10661
+ <option *ngIf="!isArray(selectItem?.items)"
10662
+ [selected]="selectItem?.value === controlValue"
10663
+ [class]="frameworkStyles[activeFramework].optionClass"
10664
+ [class.checked-notusing]="selectItem?.value === controlValue"
10665
+ [class.unchecked-notusing]]="selectItem?.value != controlValue"
10666
+ [value]="selectItem?.value"
10667
+ type="checkbox">
10668
+ </option>
10669
+ <!--NB the text is out of the option element to display besides the checkbox-->
10670
+ <span [innerHTML]="selectItem?.name"></span>
10671
+ </ng-template>
10672
+ </select>
10673
+
10674
+ </div>`, standalone: false, styles: [".select-box{font-size:16px;border:none;appearance:none;-webkit-appearance:none;-moz-appearance:none;height:25px;overflow:hidden;text-overflow:ellipsis;background-color:#fff;color:#000;background-color:transparent}.select-box:focus{outline:none}.select-option{font-size:20px;color:#000;background-color:#fff;display:inline-block}.unchecked:before{content:\"\\2610\";left:5px;top:50%;transform:translateY(-50%);font-size:30px}.checked:before{content:\"\\2611\";left:5px;top:50%;transform:translateY(-50%);font-size:30px}.select-option:checked{background-image:linear-gradient(0deg,#fff 0% 100%);color:#000}.select-box[multiple]:focus{background-color:transparent;color:#00f;-webkit-text-fill-color:black}.display-inline-block{display:inline-block}.bs4-option,.bs3-option{width:14px;height:14px;border:solid 1px;color:#a9a9a9;min-block-size:auto;border-radius:3px}.bs4-option:checked[type=checkbox],.bs3-option:checked[type=checkbox]{background-image:url(data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3C!--%20License%3A%20MIT.%20Made%20by%20jaynewey%3A%20https%3A%2F%2Fgithub.com%2Fjaynewey%2Fcharm-icons%20--%3E%3Csvg%20viewBox%3D%220%200%2016%2016%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20fill%3D%22none%22%20stroke%3D%22%23000000%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20stroke-width%3D%222.5%22%3E%3Cpolyline%20points%3D%224%208.75%2C6.25%2012.25%2C13.25%203.5%22%2F%3E%3C%2Fsvg%3E);background-color:#00ced1}\n"] }]
10675
+ }] });
10676
+
10677
+ class TabComponent {
10678
+ constructor() {
10679
+ this.jsf = inject(JsonSchemaFormService);
10680
+ this.layoutNode = input(undefined);
10681
+ this.layoutIndex = input(undefined);
10682
+ this.dataIndex = input(undefined);
10683
+ }
10684
+ ngOnInit() {
10685
+ this.options = this.layoutNode().options || {};
10686
+ }
10687
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TabComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
10688
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", type: TabComponent, isStandalone: false, selector: "tab-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
10689
+ <div [class]="options?.htmlClass || ''">
10690
+ <root-widget
10691
+ [dataIndex]="dataIndex()"
10692
+ [layoutIndex]="layoutIndex()"
10693
+ [layout]="layoutNode().items"></root-widget>
10694
+ </div>`, isInline: true, dependencies: [{ kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }] }); }
10695
+ }
10696
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TabComponent, decorators: [{
10697
+ type: Component,
10698
+ args: [{
10699
+ // tslint:disable-next-line:component-selector
10700
+ selector: 'tab-widget',
10701
+ template: `
10702
+ <div [class]="options?.htmlClass || ''">
10703
+ <root-widget
10704
+ [dataIndex]="dataIndex()"
10705
+ [layoutIndex]="layoutIndex()"
10706
+ [layout]="layoutNode().items"></root-widget>
10707
+ </div>`,
10708
+ standalone: false
10709
+ }]
10710
+ }] });
10711
+
10712
+ const BASIC_WIDGETS = [
10713
+ AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent,
10714
+ CheckboxesComponent, FileComponent, HiddenComponent, InputComponent,
10715
+ MessageComponent, NoneComponent, NumberComponent, RadiosComponent,
10716
+ RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent,
10717
+ SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent,
10718
+ TemplateComponent, TextareaComponent, SelectCheckboxComponent
10719
+ ];
10720
+
10721
+ class WidgetLibraryModule {
10722
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
10723
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryModule, declarations: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, SelectCheckboxComponent, OrderableDirective, ElementAttributeDirective], imports: [CommonModule, FormsModule, ReactiveFormsModule, i2$1.SortablejsModule], exports: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, SelectCheckboxComponent, OrderableDirective, ElementAttributeDirective] }); }
10724
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryModule, imports: [CommonModule, FormsModule, ReactiveFormsModule,
10725
+ SortablejsModule.forRoot({
10726
+ //disabled:false,
10727
+ //draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
10728
+ filter: ".sortable-filter", //needed to disable dragging on input range elements, class needs to be added to the element or its parent
10729
+ preventOnFilter: false, //needed for input range elements slider do still work
10730
+ onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
10731
+ if (evt.related.classList.contains("sortable-fixed")) {
10732
+ //console.log(evt.related);
10733
+ return false;
10734
+ }
10735
+ }
10736
+ })] }); }
10737
+ }
10738
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WidgetLibraryModule, decorators: [{
10739
+ type: NgModule,
10740
+ args: [{
10741
+ imports: [CommonModule, FormsModule, ReactiveFormsModule,
10742
+ SortablejsModule.forRoot({
10743
+ //disabled:false,
10744
+ //draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
10745
+ filter: ".sortable-filter", //needed to disable dragging on input range elements, class needs to be added to the element or its parent
10746
+ preventOnFilter: false, //needed for input range elements slider do still work
10747
+ onMove: function (/**Event*/ evt, /**Event*/ originalEvent) {
10748
+ if (evt.related.classList.contains("sortable-fixed")) {
10749
+ //console.log(evt.related);
10750
+ return false;
10751
+ }
10752
+ }
10753
+ })],
10754
+ declarations: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective],
10755
+ exports: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective]
10756
+ }]
10757
+ }] });
10758
+
10759
+ // No framework - plain HTML controls (styles from form layout only)
10760
+ class NoFrameworkModule {
10761
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFrameworkModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
10762
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: NoFrameworkModule, declarations: [NoFrameworkComponent], imports: [CommonModule, WidgetLibraryModule], exports: [NoFrameworkComponent] }); }
10763
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFrameworkModule, providers: [
10764
+ { provide: Framework, useClass: NoFramework, multi: true }
10765
+ ], imports: [CommonModule, WidgetLibraryModule] }); }
10766
+ }
10767
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoFrameworkModule, decorators: [{
10768
+ type: NgModule,
10769
+ args: [{
10770
+ imports: [CommonModule, WidgetLibraryModule],
10771
+ declarations: [NoFrameworkComponent],
10772
+ exports: [NoFrameworkComponent],
10773
+ providers: [
10774
+ { provide: Framework, useClass: NoFramework, multi: true }
10775
+ ]
10776
+ }]
10777
+ }] });
10778
+
10339
10779
  const JSON_SCHEMA_FORM_VALUE_ACCESSOR = {
10340
10780
  provide: NG_VALUE_ACCESSOR,
10341
10781
  useExisting: forwardRef(() => JsonSchemaFormComponent),
@@ -10692,7 +11132,9 @@ class JsonSchemaFormComponent {
10692
11132
  */
10693
11133
  initializeAjv() {
10694
11134
  const form = this.form();
10695
- const ajvOptions = cloneDeep(this.ajvOptions()) || cloneDeep(form.ajvOptions);
11135
+ const ajvOptions = cloneDeep(this.ajvOptions()) ||
11136
+ (form && hasOwn(form, 'ajvOptions') && isObject(form.ajvOptions)
11137
+ && cloneDeep(form.ajvOptions));
10696
11138
  if (ajvOptions) {
10697
11139
  this.ajvInstanceName = this.jsf.createAndRegisterAjvInstance(ajvOptions).name;
10698
11140
  }
@@ -11121,5 +11563,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
11121
11563
  * Generated bundle index. Do not edit.
11122
11564
  */
11123
11565
 
11124
- 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, 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 };
11566
+ export { AddReferenceComponent, BASIC_WIDGETS, ButtonComponent, CheckboxComponent, CheckboxesComponent, ElementAttributeDirective, FileComponent, Framework, FrameworkLibraryService, HiddenComponent, InputComponent, JsonPointer, JsonSchemaFormComponent, JsonSchemaFormModule, JsonSchemaFormService, JsonValidators, MessageComponent, NoneComponent, NumberComponent, OneOfComponent, OrderableDirective, RadiosComponent, RootComponent, SectionComponent, SelectCheckboxComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, WidgetLibraryModule, WidgetLibraryService, _executeAsyncValidators, _executeValidators, _mergeErrors, _mergeObjects, _toPromise, addClasses, buildFormGroup, buildFormGroupTemplate, buildLayout, buildLayoutFromSchema, buildSchemaFromData, buildSchemaFromLayout, buildTitleMap, checkInlineType, combineAllOf, commonItems, convertSchemaToDraft6, copy, deValidationMessages, enValidationMessages, esValidationMessages, fixRequiredArrayProperties, fixTitle, forEach, forEachCopy, formatFormData, frValidationMessages, getControl, getControlValidators, getFromSchema, getInputType, getLayoutNode, getSubSchema, getTitleMapFromOneOf, getType, hasNonNullValue, hasOwn, hasValue, inArray, isArray, isBoolean, isDate, isDefined, isEmpty, isFunction, isInputRequired, isInteger, isMap, isNumber, isObject, isObservable, isPrimitive, isPromise, isSet, isString, isType, itValidationMessages, mapLayout, mergeFilteredObject, mergeSchemas, path2ControlKey, ptValidationMessages, removeRecursiveReferences, resolveSchemaReferences, setControl, setRequiredFields, toJavaScriptType, toObservable, toSchemaType, toTitleCase, uniqueItems, updateInputOptions, xor, zhValidationMessages };
11125
11567
  //# sourceMappingURL=ng-formworks-core.mjs.map