@lenne.tech/ng-base 14.13.1 → 14.13.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.
@@ -464,10 +464,10 @@ class BreadcrumbComponent {
464
464
  }
465
465
  }
466
466
  BreadcrumbComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BreadcrumbComponent, deps: [{ token: i1$1.BreadcrumbService }], target: i0.ɵɵFactoryTarget.Component });
467
- BreadcrumbComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: BreadcrumbComponent, selector: "base-breadcrumb", ngImport: i0, template: "<ul class=\"pt-3\">\n <li *ngFor=\"let breadcrumb of breadcrumbs$ | async\">\n <a [routerLink]=\"breadcrumb.url\">{{ breadcrumb.label }}</a>\n </li>\n</ul>\n", styles: ["ul{list-style:none;margin:0;padding:0}ul li{display:inline}ul li:before{content:\">\";margin:0 6px}ul li:first-child:before{content:\"\";margin:0}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] });
467
+ BreadcrumbComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: BreadcrumbComponent, selector: "base-breadcrumb", ngImport: i0, template: "<ul class=\"pt-3\">\n <li *ngFor=\"let breadcrumb of breadcrumbs$ | async\">\n <a [routerLink]=\"breadcrumb.url\">{{ breadcrumb.label }}</a>\n </li>\n</ul>\n", styles: ["ul{list-style:none;margin:0;padding:0}ul li{display:inline}ul li:before{content:\"|\";margin:0 6px}ul li:first-child:before{content:\"\";margin:0}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] });
468
468
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: BreadcrumbComponent, decorators: [{
469
469
  type: Component,
470
- args: [{ selector: 'base-breadcrumb', template: "<ul class=\"pt-3\">\n <li *ngFor=\"let breadcrumb of breadcrumbs$ | async\">\n <a [routerLink]=\"breadcrumb.url\">{{ breadcrumb.label }}</a>\n </li>\n</ul>\n", styles: ["ul{list-style:none;margin:0;padding:0}ul li{display:inline}ul li:before{content:\">\";margin:0 6px}ul li:first-child:before{content:\"\";margin:0}\n"] }]
470
+ args: [{ selector: 'base-breadcrumb', template: "<ul class=\"pt-3\">\n <li *ngFor=\"let breadcrumb of breadcrumbs$ | async\">\n <a [routerLink]=\"breadcrumb.url\">{{ breadcrumb.label }}</a>\n </li>\n</ul>\n", styles: ["ul{list-style:none;margin:0;padding:0}ul li{display:inline}ul li:before{content:\"|\";margin:0 6px}ul li:first-child:before{content:\"\";margin:0}\n"] }]
471
471
  }], ctorParameters: function () { return [{ type: i1$1.BreadcrumbService }]; } });
472
472
 
473
473
  class SortDirective {
@@ -1477,28 +1477,9 @@ class ModelFormComponent {
1477
1477
  if (this.logging) {
1478
1478
  console.log('ModelFormComponent::submit->formValue', this.form.value);
1479
1479
  }
1480
- const data = Object.assign({}, this.form.value);
1481
- for (const [key, value] of Object.entries(data)) {
1482
- if ((this.config[key]?.roles ? !this.user.hasAllRoles(this.config[key]?.roles) : false) ||
1483
- this.config[key]?.exclude) {
1484
- delete data[key];
1485
- }
1486
- if (value && typeof value === 'object' && !Array.isArray(value)) {
1487
- data[key] = Object.keys(data[key])
1488
- .filter((k) => data[key][k] != null)
1489
- .reduce((a, k) => ({ ...a, [k]: data[key][k] }), {});
1490
- if (Object.keys(data[key])?.length === 0) {
1491
- if (this.logging) {
1492
- console.log('Object is empty from result');
1493
- }
1494
- data[key] = null;
1495
- }
1496
- }
1497
- // Set type for graphql method
1498
- if (this.fields[key]?.type === 'Float') {
1499
- data[key] = Number(value);
1500
- }
1501
- }
1480
+ // Prepare data for server request
1481
+ let data = Object.assign({}, this.form.value);
1482
+ data = this.prepareDataForRequest(this.config, this.fields, data);
1502
1483
  if (this.logging) {
1503
1484
  console.log('ModelFormComponent::submit->valueToGraphql', data);
1504
1485
  }
@@ -1567,6 +1548,38 @@ class ModelFormComponent {
1567
1548
  });
1568
1549
  });
1569
1550
  }
1551
+ /**
1552
+ * Prepare data for server
1553
+ */
1554
+ prepareDataForRequest(config, fieldsConfig, data) {
1555
+ if (!data) {
1556
+ return data;
1557
+ }
1558
+ for (const [key, value] of Object.entries(data)) {
1559
+ if ((config[key]?.roles ? !this.user.hasAllRoles(config[key]?.roles) : false) || config[key]?.exclude) {
1560
+ delete data[key];
1561
+ }
1562
+ if (value && typeof value === 'object' && !Array.isArray(value)) {
1563
+ data[key] = Object.keys(data[key])
1564
+ .filter((k) => data[key][k] != null)
1565
+ .reduce((a, k) => ({ ...a, [k]: data[key][k] }), {});
1566
+ if (Object.keys(data[key])?.length === 0) {
1567
+ if (this.logging) {
1568
+ console.log('Object is empty from result');
1569
+ }
1570
+ data[key] = null;
1571
+ }
1572
+ }
1573
+ // Set type for graphql method
1574
+ if (fieldsConfig[key]?.type === 'Float') {
1575
+ data[key] = Number(value);
1576
+ }
1577
+ if (fieldsConfig[key]?.fields && Object.keys(fieldsConfig[key]?.fields).length > 0) {
1578
+ data[key] = this.prepareDataForRequest(config[key]?.fields, fieldsConfig[key]?.fields, data[key]);
1579
+ }
1580
+ }
1581
+ return data;
1582
+ }
1570
1583
  /**
1571
1584
  * Init fab buttons for mobile devices
1572
1585
  */
@@ -1585,6 +1598,9 @@ class ModelFormComponent {
1585
1598
  event.subscribe(() => this.deleteObject());
1586
1599
  }
1587
1600
  }
1601
+ /**
1602
+ * Set file changes for process
1603
+ */
1588
1604
  processFileChanges(event) {
1589
1605
  const index = this.fileChanges?.findIndex((e) => e.field === event.field);
1590
1606
  if (index !== undefined && index !== -1) {