@ng-formworks/material 15.8.0 → 15.8.2

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.
@@ -50,7 +50,7 @@ import { MatToolbarModule } from '@angular/material/toolbar';
50
50
  import { MatTooltipModule } from '@angular/material/tooltip';
51
51
  import * as i21 from 'nxt-sortablejs';
52
52
  import { SortablejsModule } from 'nxt-sortablejs';
53
- import { isObject, isEqual } from 'lodash';
53
+ import { isObject, pick, isEqual } from 'lodash';
54
54
 
55
55
  const cssFrameworkCfgMaterialDesign = {
56
56
  "name": "material-design",
@@ -1925,14 +1925,30 @@ class MaterialOneOfComponent {
1925
1925
  let parts = controlName.split('$');
1926
1926
  let fieldName = parts[parts.length - 1];
1927
1927
  let controlValue = this.jsf.formGroup.controls[controlName].value;
1928
- if (isObject(formValue) && hasOwn(formValue, fieldName) &&
1929
- formValue[fieldName] == controlValue
1930
- //formValue[fieldName]||controlValue
1931
- ) {
1932
- foundInd = ind;
1928
+ let controlSchema = JsonPointer.get(this.jsf.schema, parts.join("/"));
1929
+ let schemaPointer = parts.join("/");
1930
+ let dPointer = schemaPointer.replace(/(anyOf|allOf|oneOf|none)\/[\d]+\//g, '')
1931
+ .replace(/(if|then|else|properties)\//g, '');
1932
+ //JsonPointer.toDataPointer(parts.join("/"),this.jsf.schema);
1933
+ let dVal = JsonPointer.get(this.jsf.formValues, dPointer);
1934
+ let compareVal = dVal; //formValue;
1935
+ //compare only values that are in the subschema properties
1936
+ if (controlSchema && controlSchema.properties) {
1937
+ compareVal = isObject(dVal) && hasOwn(dVal, fieldName) ?
1938
+ pick(dVal[fieldName], Object.keys(controlSchema.properties))
1939
+ : pick(dVal, Object.keys(controlSchema.properties));
1940
+ }
1941
+ /*
1942
+ if(isObject(compareVal) && hasOwn(compareVal,fieldName) &&
1943
+ isEqual(compareVal[fieldName],controlValue)
1944
+ ){
1945
+ foundInd=ind;
1946
+ }else //if(formValue || controlValue){
1947
+ if(isEqual(compareVal,controlValue)){
1948
+ foundInd=ind;
1933
1949
  }
1934
- else //if(formValue || controlValue){
1935
- if (isEqual(formValue, controlValue)) {
1950
+ */
1951
+ if (isEqual(compareVal, controlValue)) {
1936
1952
  foundInd = ind;
1937
1953
  }
1938
1954
  });