@vgip/meta-ui 1.3.1 → 1.3.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.
@@ -276,9 +276,9 @@ const richtextFieldNormalizer = (field) => {
276
276
  * @Last Modified by: Alexander.Vangelov@vonage.com
277
277
  * @Last Modified time: 2021-03-22 17:09:12
278
278
  */
279
- const uniqueNameFilter = (fields, uniqFieldNames) => {
279
+ const uniqueNameFilter = (fields, uniqFieldNames, allowDuplicates = false) => {
280
280
  if (fields instanceof Array) {
281
- return fields.filter((f) => {
281
+ return allowDuplicates ? fields : fields.filter((f) => {
282
282
  if (f.name) {
283
283
  if (uniqFieldNames.indexOf(f.name) !== -1) {
284
284
  return false;
@@ -336,10 +336,10 @@ const fieldNormalizer = (field, uniqFieldNames) => {
336
336
  }
337
337
  else if (fieldType === 'composite') {
338
338
  f = {
339
- type: field.name ? 'composite' : 'missing name',
339
+ type: 'composite',
340
340
  label: field.label,
341
341
  name: field.name,
342
- fields: uniqueNameFilter(field.fields || field.reference || [], uniqFieldNames).map((v) => fieldNormalizer(v, uniqFieldNames))
342
+ fields: uniqueNameFilter(field.fields || field.reference || [], uniqFieldNames, (typeof (field.name) !== 'undefined')).map((v) => fieldNormalizer(v, uniqFieldNames))
343
343
  };
344
344
  }
345
345
  else if (fieldType === 'list') {
@@ -654,9 +654,6 @@ const metaNormalizer = (meta, integration, resourceType) => {
654
654
  for (const ff of f.fields) {
655
655
  fieldFixesByIntegration(ff);
656
656
  }
657
- if (f.name && /composite/.test(f.name)) {
658
- delete f.name;
659
- }
660
657
  }
661
658
  };
662
659
  // common fixes for all integrations
@@ -2810,7 +2807,7 @@ class FieldComposite extends FieldAbstract {
2810
2807
  let nestedFieldsRegex;
2811
2808
  if (this.meta.name) {
2812
2809
  this.value = this.parent[this.meta.name] || {};
2813
- nestedFieldsRegex = new RegExp(`${this.meta.name}\.(.*)`);
2810
+ nestedFieldsRegex = new RegExp(`^${this.meta.name}\\.(.*)`);
2814
2811
  Object.defineProperty(this.parent, this.meta.name, {
2815
2812
  set: (value) => {
2816
2813
  if (value) {
@@ -2833,11 +2830,9 @@ class FieldComposite extends FieldAbstract {
2833
2830
  f.type = 'string';
2834
2831
  }
2835
2832
  }
2836
- if (nestedFieldsRegex) {
2837
- const nestedFieldMatch = f.name.match(nestedFieldsRegex);
2838
- if (nestedFieldMatch) {
2839
- f.name = nestedFieldMatch[1];
2840
- }
2833
+ const nestedFieldMatch = f.name.match(nestedFieldsRegex);
2834
+ if (nestedFieldMatch) {
2835
+ f.name = nestedFieldMatch[1]; // for VGIS V2 backward compatibility normalize name with dotted syntax
2841
2836
  }
2842
2837
  }
2843
2838
  }
@@ -4510,7 +4505,8 @@ class MetaResource {
4510
4505
  };
4511
4506
  }
4512
4507
  this.model._vgis.layoutId = this.currentLayoutId;
4513
- this.model._vgis.timeZoneOffsetInMinutes = new Date().getTimezoneOffset();
4508
+ // eslint-disable-next-line max-len
4509
+ this.model._vgis.timeZoneOffsetInMinutes = 0; // we are not providing timezone anymore (as V3), instead the 'time' and 'date' objects are converted so the UTC time/date is correct
4514
4510
  this.model._vgis.eventId = this.metaContext.vgipEventId;
4515
4511
  /* eslint-enable no-underscore-dangle */
4516
4512
  }
@@ -5361,3 +5357,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImpor
5361
5357
  */
5362
5358
 
5363
5359
  export { FieldBoolean, FieldComposite, FieldDatetime, FieldInput, FieldList, FieldRadio, FieldReference, FieldRichtext, FieldSelect, FieldText, FieldUnknown, MetaAutofocusDirective, MetaContextService, MetaField, MetaFieldContentDirective, MetaHttpClient, MetaIconsPipe, MetaLayout, MetaModelPipe, MetaModule, MetaMsgService, MetaRefDialog, MetaReferenceService, MetaResource, MetaResourceCard, MetaResourceService, MetaStripHtmlPipe, MetaTrackerService, ResourceDraftsService, metaDark, metaLight, metaNormalizer, relativeTimeBuilder };
5360
+ //# sourceMappingURL=vgip-meta-ui.mjs.map